{"version":3,"sources":["../src/tab-panel.tsx"],"sourcesContent":["import type { CSSUIObject, HTMLUIProps } from \"@yamada-ui/core\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { useLazyDisclosure } from \"@yamada-ui/use-disclosure\"\nimport { cx, mergeRefs } from \"@yamada-ui/utils\"\nimport { useId, useRef } from \"react\"\nimport {\n  useTabDescendant,\n  useTabPanelContext,\n  useTabPanelDescendant,\n  useTabsContext,\n} from \"./tabs-context\"\n\nexport interface TabPanelProps extends HTMLUIProps {}\n\nexport const TabPanel = forwardRef<TabPanelProps, \"div\">(\n  ({ id, className, children, ...rest }, ref) => {\n    const uuid = useId()\n    const { lazy: enabled, lazyBehavior: mode, styles } = useTabsContext()\n    const { index, selected } = useTabPanelContext()\n    const { register } = useTabPanelDescendant()\n    const { descendants } = useTabDescendant()\n    const hasBeenSelected = useRef<boolean>(false)\n    const tabId = descendants.value(index)?.node.id\n\n    if (selected) hasBeenSelected.current = true\n\n    const shouldRenderChildren = useLazyDisclosure({\n      enabled,\n      isSelected: selected,\n      mode,\n      wasSelected: hasBeenSelected.current,\n    })\n    const css: CSSUIObject = { ...styles.tabPanel }\n\n    id ??= uuid\n\n    return (\n      <ui.div\n        id={id}\n        ref={mergeRefs(register, ref)}\n        className={cx(\"ui-tabs__panel\", className)}\n        aria-labelledby={tabId}\n        role=\"tabpanel\"\n        __css={css}\n        {...rest}\n        hidden={!selected}\n      >\n        {shouldRenderChildren ? children : null}\n      </ui.div>\n    )\n  },\n)\n\nTabPanel.displayName = \"TabPanel\"\nTabPanel.__ui__ = \"TabPanel\"\n"],"mappings":";;;;;;;;;AACA,SAAS,YAAY,UAAU;AAC/B,SAAS,yBAAyB;AAClC,SAAS,IAAI,iBAAiB;AAC9B,SAAS,OAAO,cAAc;AAiCxB;AAvBC,IAAM,WAAW;AAAA,EACtB,CAAC,EAAE,IAAI,WAAW,UAAU,GAAG,KAAK,GAAG,QAAQ;AAfjD;AAgBI,UAAM,OAAO,MAAM;AACnB,UAAM,EAAE,MAAM,SAAS,cAAc,MAAM,OAAO,IAAI,eAAe;AACrE,UAAM,EAAE,OAAO,SAAS,IAAI,mBAAmB;AAC/C,UAAM,EAAE,SAAS,IAAI,sBAAsB;AAC3C,UAAM,EAAE,YAAY,IAAI,iBAAiB;AACzC,UAAM,kBAAkB,OAAgB,KAAK;AAC7C,UAAM,SAAQ,iBAAY,MAAM,KAAK,MAAvB,mBAA0B,KAAK;AAE7C,QAAI,SAAU,iBAAgB,UAAU;AAExC,UAAM,uBAAuB,kBAAkB;AAAA,MAC7C;AAAA,MACA,YAAY;AAAA,MACZ;AAAA,MACA,aAAa,gBAAgB;AAAA,IAC/B,CAAC;AACD,UAAM,MAAmB,EAAE,GAAG,OAAO,SAAS;AAE9C,2BAAO;AAEP,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,KAAK,UAAU,UAAU,GAAG;AAAA,QAC5B,WAAW,GAAG,kBAAkB,SAAS;AAAA,QACzC,mBAAiB;AAAA,QACjB,MAAK;AAAA,QACL,OAAO;AAAA,QACN,GAAG;AAAA,QACJ,QAAQ,CAAC;AAAA,QAER,iCAAuB,WAAW;AAAA;AAAA,IACrC;AAAA,EAEJ;AACF;AAEA,SAAS,cAAc;AACvB,SAAS,SAAS;","names":[]}