@studiocubics/components 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/Cards/Card/Card.js +1 -44
- package/dist/Cards/Card/Card.js.map +1 -1
- package/dist/Cards/Card/Card.module.css.js +1 -3
- package/dist/Cards/Card/Card.module.css.js.map +1 -1
- package/dist/Cards/CollectionItemCard/CollectionItemCard.js +1 -47
- package/dist/Cards/CollectionItemCard/CollectionItemCard.js.map +1 -1
- package/dist/Cards/CollectionItemCard/CollectionItemCard.module.css.js +1 -3
- package/dist/Cards/CollectionItemCard/CollectionItemCard.module.css.js.map +1 -1
- package/dist/Cards/CollectionItemCard/CollectionItemCardActions.js +1 -33
- package/dist/Cards/CollectionItemCard/CollectionItemCardActions.js.map +1 -1
- package/dist/Cards/GlassCard/GlassCard.js +1 -51
- package/dist/Cards/GlassCard/GlassCard.js.map +1 -1
- package/dist/Cards/GlassCard/GlassCard.module.css.js +1 -3
- package/dist/Cards/GlassCard/GlassCard.module.css.js.map +1 -1
- package/dist/Display/Accordion/Accordion.js +1 -27
- package/dist/Display/Accordion/Accordion.js.map +1 -1
- package/dist/Display/Accordion/Accordion.module.css.js +1 -3
- package/dist/Display/Accordion/Accordion.module.css.js.map +1 -1
- package/dist/Display/Accordion/AccordionItem.js +1 -55
- package/dist/Display/Accordion/AccordionItem.js.map +1 -1
- package/dist/Display/Chip/Chip.js +1 -42
- package/dist/Display/Chip/Chip.js.map +1 -1
- package/dist/Display/Chip/Chip.module.css.js +1 -3
- package/dist/Display/Chip/Chip.module.css.js.map +1 -1
- package/dist/Display/IdentityDisplay/IdentityDisplay.js +1 -35
- package/dist/Display/IdentityDisplay/IdentityDisplay.js.map +1 -1
- package/dist/Display/IdentityDisplay/IdentityDisplay.module.css.js +1 -3
- package/dist/Display/IdentityDisplay/IdentityDisplay.module.css.js.map +1 -1
- package/dist/Display/InputErrors/InputErrors.js +1 -24
- package/dist/Display/InputErrors/InputErrors.js.map +1 -1
- package/dist/Display/InputErrors/InputErrors.module.css.js +1 -3
- package/dist/Display/InputErrors/InputErrors.module.css.js.map +1 -1
- package/dist/Display/Kbd/Kbd.js +1 -18
- package/dist/Display/Kbd/Kbd.js.map +1 -1
- package/dist/Display/Kbd/Kbd.module.css.js +1 -3
- package/dist/Display/Kbd/Kbd.module.css.js.map +1 -1
- package/dist/Display/Kbd/buttonList.js +1 -197
- package/dist/Display/Kbd/buttonList.js.map +1 -1
- package/dist/Display/LabeledValue/LabeledValue.js +1 -10
- package/dist/Display/LabeledValue/LabeledValue.js.map +1 -1
- package/dist/Display/LabeledValue/LabeledValue.module.css.js +1 -3
- package/dist/Display/LabeledValue/LabeledValue.module.css.js.map +1 -1
- package/dist/Display/List/List.js +1 -95
- package/dist/Display/List/List.js.map +1 -1
- package/dist/Display/List/List.module.css.js +1 -3
- package/dist/Display/List/List.module.css.js.map +1 -1
- package/dist/Display/PasswordStrength/PasswordStrength.js +1 -16
- package/dist/Display/PasswordStrength/PasswordStrength.js.map +1 -1
- package/dist/Display/PasswordStrength/PasswordStrength.module.css.js +1 -3
- package/dist/Display/PasswordStrength/PasswordStrength.module.css.js.map +1 -1
- package/dist/Display/PasswordStrength/usePasswordStrength.js +1 -48
- package/dist/Display/PasswordStrength/usePasswordStrength.js.map +1 -1
- package/dist/Display/Skeleton/Skeleton.d.ts +1 -1
- package/dist/Display/Skeleton/Skeleton.js +1 -10
- package/dist/Display/Skeleton/Skeleton.js.map +1 -1
- package/dist/Display/Skeleton/Skeleton.module.css.js +1 -3
- package/dist/Display/Skeleton/Skeleton.module.css.js.map +1 -1
- package/dist/Display/Toast/Toaster.js +1 -44
- package/dist/Display/Toast/Toaster.js.map +1 -1
- package/dist/Display/Toast/toast.js +1 -31
- package/dist/Display/Toast/toast.js.map +1 -1
- package/dist/Display/Tooltip/Tooltip.js +1 -44
- package/dist/Display/Tooltip/Tooltip.js.map +1 -1
- package/dist/Display/Tooltip/Tooltip.module.css.js +1 -3
- package/dist/Display/Tooltip/Tooltip.module.css.js.map +1 -1
- package/dist/Display/Tooltip/getArrowDirection.js +1 -47
- package/dist/Display/Tooltip/getArrowDirection.js.map +1 -1
- package/dist/Display/Tooltip/useTooltip.js +1 -47
- package/dist/Display/Tooltip/useTooltip.js.map +1 -1
- package/dist/Display/WIP/WIP.d.ts +5 -0
- package/dist/Forms/ConfirmationForm/ConfirmationForm.js +1 -11
- package/dist/Forms/ConfirmationForm/ConfirmationForm.js.map +1 -1
- package/dist/Forms/ConfirmationForm/ConfirmationForm.module.css.js +1 -3
- package/dist/Forms/ConfirmationForm/ConfirmationForm.module.css.js.map +1 -1
- package/dist/Inputs/Button/Button.js +1 -55
- package/dist/Inputs/Button/Button.js.map +1 -1
- package/dist/Inputs/Button/Button.module.css.js +1 -3
- package/dist/Inputs/Button/Button.module.css.js.map +1 -1
- package/dist/Inputs/Checkbox/Checkbox.js +1 -54
- package/dist/Inputs/Checkbox/Checkbox.js.map +1 -1
- package/dist/Inputs/Checkbox/Checkbox.module.css.js +1 -3
- package/dist/Inputs/Checkbox/Checkbox.module.css.js.map +1 -1
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js +1 -34
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.module.css.js +1 -3
- package/dist/Inputs/Checkbox/CheckboxGroup/CheckboxGroup.module.css.js.map +1 -1
- package/dist/Inputs/Checkbox/CheckboxSelectAll.js +1 -18
- package/dist/Inputs/Checkbox/CheckboxSelectAll.js.map +1 -1
- package/dist/Inputs/PasswordInput/PasswordInput.js +1 -44
- package/dist/Inputs/PasswordInput/PasswordInput.js.map +1 -1
- package/dist/Inputs/PasswordInput/PasswordInput.module.css.js +1 -3
- package/dist/Inputs/PasswordInput/PasswordInput.module.css.js.map +1 -1
- package/dist/Inputs/Select/Select.js +1 -25
- package/dist/Inputs/Select/Select.js.map +1 -1
- package/dist/Inputs/Select/Select.module.css.js +1 -3
- package/dist/Inputs/Select/Select.module.css.js.map +1 -1
- package/dist/Inputs/Switch/Switch.js +1 -80
- package/dist/Inputs/Switch/Switch.js.map +1 -1
- package/dist/Inputs/Switch/Switch.module.css.js +1 -3
- package/dist/Inputs/Switch/Switch.module.css.js.map +1 -1
- package/dist/Inputs/TextAreaInput/TextAreaInput.js +1 -29
- package/dist/Inputs/TextAreaInput/TextAreaInput.js.map +1 -1
- package/dist/Inputs/TextAreaInput/TextAreaInput.module.css.js +1 -3
- package/dist/Inputs/TextAreaInput/TextAreaInput.module.css.js.map +1 -1
- package/dist/Inputs/TextInput/TextInput.js +1 -22
- package/dist/Inputs/TextInput/TextInput.js.map +1 -1
- package/dist/Inputs/TextInput/TextInput.module.css.js +1 -3
- package/dist/Inputs/TextInput/TextInput.module.css.js.map +1 -1
- package/dist/Inputs/ThemeToggle/ThemeToggleListItem.js +1 -30
- package/dist/Inputs/ThemeToggle/ThemeToggleListItem.js.map +1 -1
- package/dist/Layout/Dialog/Dialog.d.ts +1 -1
- package/dist/Layout/Dialog/Dialog.js +1 -73
- package/dist/Layout/Dialog/Dialog.js.map +1 -1
- package/dist/Layout/Dialog/Dialog.module.css.js +1 -3
- package/dist/Layout/Dialog/Dialog.module.css.js.map +1 -1
- package/dist/Layout/Drawer/Drawer.d.ts +15 -0
- package/dist/Layout/Drawer/Drawer.js +2 -0
- package/dist/Layout/Drawer/Drawer.js.map +1 -0
- package/dist/Layout/Drawer/Drawer.module.css.js +2 -0
- package/dist/Layout/Drawer/Drawer.module.css.js.map +1 -0
- package/dist/Layout/PageLayout/PageLayout.js +1 -24
- package/dist/Layout/PageLayout/PageLayout.js.map +1 -1
- package/dist/Layout/PageLayout/PageLayout.module.css.js +1 -3
- package/dist/Layout/PageLayout/PageLayout.module.css.js.map +1 -1
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.js +1 -12
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.js.map +1 -1
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.module.css.js +1 -3
- package/dist/Layout/PageLayoutPagination/PageLayoutPagination.module.css.js.map +1 -1
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.js +1 -21
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.js.map +1 -1
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.module.css.js +1 -3
- package/dist/Layout/PageLayoutTabs/PageLayoutTabs.module.css.js.map +1 -1
- package/dist/Layout/Popover/Popover.js +1 -102
- package/dist/Layout/Popover/Popover.js.map +1 -1
- package/dist/Layout/Popover/Popover.module.css.js +1 -3
- package/dist/Layout/Popover/Popover.module.css.js.map +1 -1
- package/dist/Layout/SectionWrapper/SectionWrapper.js +1 -10
- package/dist/Layout/SectionWrapper/SectionWrapper.js.map +1 -1
- package/dist/Layout/SectionWrapper/SectionWrapper.module.css.js +1 -3
- package/dist/Layout/SectionWrapper/SectionWrapper.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/Sidebar.js +1 -24
- package/dist/Layout/Sidebar/Sidebar.js.map +1 -1
- package/dist/Layout/Sidebar/Sidebar.module.css.js +1 -3
- package/dist/Layout/Sidebar/Sidebar.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.js +1 -13
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarBody/SidebarBody.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.js +1 -13
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarDrawer/SidebarDrawer.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.js +1 -13
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarFooter/SidebarFooter.module.css.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarHeader/SidebarHeader.js +1 -11
- package/dist/Layout/Sidebar/SidebarHeader/SidebarHeader.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.js +1 -10
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.js.map +1 -1
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.module.css.js +1 -3
- package/dist/Layout/Sidebar/SidebarViewport/SidebarViewport.module.css.js.map +1 -1
- package/dist/Layout/Table/Table.js +1 -130
- package/dist/Layout/Table/Table.js.map +1 -1
- package/dist/Layout/Table/Table.module.css.js +1 -3
- package/dist/Layout/Table/Table.module.css.js.map +1 -1
- package/dist/Layout/Table/TableFooter.js +1 -8
- package/dist/Layout/Table/TableFooter.js.map +1 -1
- package/dist/Layout/Table/TableHeader.js +1 -8
- package/dist/Layout/Table/TableHeader.js.map +1 -1
- package/dist/Layout/Table/tableUtils.js +1 -123
- package/dist/Layout/Table/tableUtils.js.map +1 -1
- package/dist/Layout/_index.d.ts +1 -0
- package/dist/Misc/Cursor/Cursor.js +1 -58
- package/dist/Misc/Cursor/Cursor.js.map +1 -1
- package/dist/Misc/Cursor/Cursor.module.css.js +1 -3
- package/dist/Misc/Cursor/Cursor.module.css.js.map +1 -1
- package/dist/Misc/Logos.js +1 -28
- package/dist/Misc/Logos.js.map +1 -1
- package/dist/Misc/PoweredByBanner/PoweredByBanner.d.ts +5 -2
- package/dist/Misc/PoweredByBanner/PoweredByBanner.js +1 -10
- package/dist/Misc/PoweredByBanner/PoweredByBanner.js.map +1 -1
- package/dist/Misc/PoweredByBanner/PoweredByBanner.module.css.js +1 -3
- package/dist/Misc/PoweredByBanner/PoweredByBanner.module.css.js.map +1 -1
- package/dist/Misc/Ripple/Ripple.js +1 -61
- package/dist/Misc/Ripple/Ripple.js.map +1 -1
- package/dist/Misc/Ripple/Ripple.module.css.js +1 -3
- package/dist/Misc/Ripple/Ripple.module.css.js.map +1 -1
- package/dist/Misc/Spinner/Spinner.js +1 -11
- package/dist/Misc/Spinner/Spinner.js.map +1 -1
- package/dist/Misc/Spinner/Spinner.module.css.js +1 -3
- package/dist/Misc/Spinner/Spinner.module.css.js.map +1 -1
- package/dist/Misc/TransitionAnimation/TransitionAnimation.js +1 -86
- package/dist/Misc/TransitionAnimation/TransitionAnimation.js.map +1 -1
- package/dist/Misc/TransitionAnimation/TransitionAnimation.module.css.js +1 -3
- package/dist/Misc/TransitionAnimation/TransitionAnimation.module.css.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.js +1 -35
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.module.css.js +1 -3
- package/dist/Navigation/Breadcrumbs/Breadcrumbs.module.css.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/BreadcrumbsItem.js +1 -14
- package/dist/Navigation/Breadcrumbs/BreadcrumbsItem.js.map +1 -1
- package/dist/Navigation/Breadcrumbs/useBreadcrumbs.js +1 -43
- package/dist/Navigation/Breadcrumbs/useBreadcrumbs.js.map +1 -1
- package/dist/Navigation/Pagination/Pagination.js +1 -60
- package/dist/Navigation/Pagination/Pagination.js.map +1 -1
- package/dist/Navigation/Pagination/Pagination.module.css.js +1 -3
- package/dist/Navigation/Pagination/Pagination.module.css.js.map +1 -1
- package/dist/Navigation/Pagination/PaginationItem.js +1 -13
- package/dist/Navigation/Pagination/PaginationItem.js.map +1 -1
- package/dist/Navigation/Pagination/usePagination.js +1 -37
- package/dist/Navigation/Pagination/usePagination.js.map +1 -1
- package/dist/Navigation/Tabs/Tab/Tab.js +1 -69
- package/dist/Navigation/Tabs/Tab/Tab.js.map +1 -1
- package/dist/Navigation/Tabs/Tab/Tab.module.css.js +1 -3
- package/dist/Navigation/Tabs/Tab/Tab.module.css.js.map +1 -1
- package/dist/Navigation/Tabs/Tabs.js +1 -21
- package/dist/Navigation/Tabs/Tabs.js.map +1 -1
- package/dist/Navigation/Tabs/TabsBar/TabsBar.d.ts +10 -7
- package/dist/Navigation/Tabs/TabsBar/TabsBar.js +1 -43
- package/dist/Navigation/Tabs/TabsBar/TabsBar.js.map +1 -1
- package/dist/Navigation/Tabs/TabsBar/TabsBar.module.css.js +1 -3
- package/dist/Navigation/Tabs/TabsBar/TabsBar.module.css.js.map +1 -1
- package/dist/Typography/ClampedText/ClampedText.js +1 -43
- package/dist/Typography/ClampedText/ClampedText.js.map +1 -1
- package/dist/Typography/ClampedText/ClampedText.module.css.js +1 -3
- package/dist/Typography/ClampedText/ClampedText.module.css.js.map +1 -1
- package/dist/Typography/CopyableText/CopyableText.js +1 -38
- package/dist/Typography/CopyableText/CopyableText.js.map +1 -1
- package/dist/Typography/CopyableText/CopyableText.module.css.js +1 -3
- package/dist/Typography/CopyableText/CopyableText.module.css.js.map +1 -1
- package/dist/Typography/PageTitle/PageTitle.js +1 -9
- package/dist/Typography/PageTitle/PageTitle.js.map +1 -1
- package/dist/Typography/PageTitle/PageTitle.module.css.js +1 -3
- package/dist/Typography/PageTitle/PageTitle.module.css.js.map +1 -1
- package/dist/index.css +1 -2392
- package/dist/index.js +1 -63
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/rollup.config.js +0 -34
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sources":["../../../src/Display/Tooltip/Tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useMemo,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useTooltip } from \"./useTooltip\";\nimport styles from \"./Tooltip.module.css\";\nimport getArrowDirection from \"./getArrowDirection\";\nimport { cn, type SafePositionOptions } from \"@studiocubics/utils\";\n\nexport interface TooltipProps extends SafePositionOptions {\n title?: ReactNode;\n renderArrow?: boolean;\n children: ReactElement;\n}\n\nexport function Tooltip({\n title,\n children,\n renderArrow = false,\n anchorOrigin,\n transformOrigin,\n margin,\n}: TooltipProps) {\n const options = useMemo(() => {\n return {\n anchorOrigin: anchorOrigin ?? \"bottom center\",\n transformOrigin: transformOrigin ?? \"top center\",\n margin: margin ?? 8,\n };\n }, [anchorOrigin, transformOrigin, margin]);\n const { anchorRef, showTooltip, tooltipRef, position, updatePosition } =\n useTooltip(options);\n\n const direction = renderArrow\n ? getArrowDirection(\n anchorOrigin ?? \"bottom center\",\n transformOrigin ?? \"top center\"\n )\n : null;\n\n // Ensure only one child is passed\n const child = Children.only(children);\n\n const childWithRef = () => {\n if (isValidElement(child))\n return cloneElement(child, { ref: anchorRef } as {\n ref: RefObject<HTMLElement | null>;\n });\n else {\n throw new Error(\n \"Children passed to Tooltip should be a valid react element\"\n );\n }\n };\n\n useEffect(() => {\n if (showTooltip) updatePosition();\n }, [title, showTooltip, updatePosition]);\n\n if (!title) return child;\n\n return (\n <>\n {showTooltip &&\n createPortal(\n <div\n className={cn(\n styles.root,\n renderArrow && direction ? styles[`arrow-${direction}`] : \"\"\n )}\n ref={tooltipRef}\n style={{\n left: `${position.x}px`,\n top: `${position.y}px`,\n }}\n >\n {title}\n </div>,\n document.body\n )}\n {childWithRef()}\n </>\n );\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"Tooltip.js","sources":["../../../src/Display/Tooltip/Tooltip.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n useEffect,\n useMemo,\n type ReactElement,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { useTooltip } from \"./useTooltip\";\nimport styles from \"./Tooltip.module.css\";\nimport getArrowDirection from \"./getArrowDirection\";\nimport { cn, type SafePositionOptions } from \"@studiocubics/utils\";\n\nexport interface TooltipProps extends SafePositionOptions {\n title?: ReactNode;\n renderArrow?: boolean;\n children: ReactElement;\n}\n\nexport function Tooltip({\n title,\n children,\n renderArrow = false,\n anchorOrigin,\n transformOrigin,\n margin,\n}: TooltipProps) {\n const options = useMemo(() => {\n return {\n anchorOrigin: anchorOrigin ?? \"bottom center\",\n transformOrigin: transformOrigin ?? \"top center\",\n margin: margin ?? 8,\n };\n }, [anchorOrigin, transformOrigin, margin]);\n const { anchorRef, showTooltip, tooltipRef, position, updatePosition } =\n useTooltip(options);\n\n const direction = renderArrow\n ? getArrowDirection(\n anchorOrigin ?? \"bottom center\",\n transformOrigin ?? \"top center\"\n )\n : null;\n\n // Ensure only one child is passed\n const child = Children.only(children);\n\n const childWithRef = () => {\n if (isValidElement(child))\n return cloneElement(child, { ref: anchorRef } as {\n ref: RefObject<HTMLElement | null>;\n });\n else {\n throw new Error(\n \"Children passed to Tooltip should be a valid react element\"\n );\n }\n };\n\n useEffect(() => {\n if (showTooltip) updatePosition();\n }, [title, showTooltip, updatePosition]);\n\n if (!title) return child;\n\n return (\n <>\n {showTooltip &&\n createPortal(\n <div\n className={cn(\n styles.root,\n renderArrow && direction ? styles[`arrow-${direction}`] : \"\"\n )}\n ref={tooltipRef}\n style={{\n left: `${position.x}px`,\n top: `${position.y}px`,\n }}\n >\n {title}\n </div>,\n document.body\n )}\n {childWithRef()}\n </>\n );\n}\n"],"names":["Tooltip","title","children","renderArrow","anchorOrigin","transformOrigin","margin","options","useMemo","anchorRef","showTooltip","tooltipRef","position","updatePosition","useTooltip","direction","getArrowDirection","child","Children","only","useEffect","_jsxs","createPortal","_jsx","className","cn","styles","root","ref","style","left","x","top","y","document","body","isValidElement","cloneElement","Error","childWithRef"],"mappings":"qYAwBgBA,GAAQC,MACtBA,EAAKC,SACLA,EAAQC,YACRA,GAAc,EAAKC,aACnBA,EAAYC,gBACZA,EAAeC,OACfA,IAEA,MAAMC,EAAUC,EAAQ,KACf,CACLJ,aAAcA,GAAgB,gBAC9BC,gBAAiBA,GAAmB,aACpCC,OAAQA,GAAU,IAEnB,CAACF,EAAcC,EAAiBC,KAC7BG,UAAEA,EAASC,YAAEA,EAAWC,WAAEA,EAAUC,SAAEA,EAAQC,eAAEA,GACpDC,EAAWP,GAEPQ,EAAYZ,EACda,EACEZ,GAAgB,gBAChBC,GAAmB,cAErB,KAGEY,EAAQC,EAASC,KAAKjB,GAkB5B,OAJAkB,EAAU,KACJV,GAAaG,KAChB,CAACZ,EAAOS,EAAaG,IAEnBZ,EAGHoB,eACGX,GACCY,EACEC,EAAA,MAAA,CACEC,UAAWC,EACTC,EAAOC,KACPxB,GAAeY,EAAYW,EAAO,SAASX,KAAe,IAE5Da,IAAKjB,EACLkB,MAAO,CACLC,KAAM,GAAGlB,EAASmB,MAClBC,IAAK,GAAGpB,EAASqB,OAClB/B,SAEAD,IAEHiC,SAASC,MAnCI,MACnB,GAAIC,EAAenB,GACjB,OAAOoB,EAAapB,EAAO,CAAEW,IAAKnB,IAIlC,MAAM,IAAI6B,MACR,+DA8BDC,MArBctB,CAwBrB"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var o={root:"Tooltip-module_root__nip6a","arrow-bottom":"Tooltip-module_arrow-bottom__CuvK2","arrow-top":"Tooltip-module_arrow-top__XaUyR","arrow-right":"Tooltip-module_arrow-right__O1HnI","arrow-left":"Tooltip-module_arrow-left__4o1J4","arrow-topLeft":"Tooltip-module_arrow-topLeft__WyNAm","arrow-topRight":"Tooltip-module_arrow-topRight__-ILdh","arrow-bottomLeft":"Tooltip-module_arrow-bottomLeft__E6w40","arrow-bottomRight":"Tooltip-module_arrow-bottomRight__mefBZ"};export{o as default};
|
|
4
2
|
//# sourceMappingURL=Tooltip.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tooltip.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
function
|
|
2
|
-
const parse = (origin) => origin.toLowerCase().trim().split(/\s+/);
|
|
3
|
-
const [aV = "top", aH = "left"] = parse(anchorOrigin);
|
|
4
|
-
const [tV = "top", tH = "left"] = parse(transformOrigin);
|
|
5
|
-
// Vertical priority
|
|
6
|
-
if (aV !== tV) {
|
|
7
|
-
// anchor top, tooltip attached bottom -> tooltip is above anchor -> arrow on bottom side
|
|
8
|
-
if (aV === "top" && tV === "bottom") {
|
|
9
|
-
if (aH === "left" && tH === "right")
|
|
10
|
-
return "bottomRight";
|
|
11
|
-
if (aH === "right" && tH === "left")
|
|
12
|
-
return "bottomLeft";
|
|
13
|
-
return "bottom";
|
|
14
|
-
}
|
|
15
|
-
// anchor bottom, tooltip attached top -> tooltip is below anchor -> arrow on top side
|
|
16
|
-
if (aV === "bottom" && tV === "top") {
|
|
17
|
-
if (aH === "left" && tH === "right")
|
|
18
|
-
return "topRight";
|
|
19
|
-
if (aH === "right" && tH === "left")
|
|
20
|
-
return "topLeft";
|
|
21
|
-
return "top";
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
// Horizontal fallback
|
|
25
|
-
if (aH !== tH) {
|
|
26
|
-
// anchor left, tooltip attached right -> tooltip sits left of anchor -> arrow on right side
|
|
27
|
-
if (aH === "left" && tH === "right") {
|
|
28
|
-
if (aV === "top" && tV === "top")
|
|
29
|
-
return "topRight";
|
|
30
|
-
if (aV === "bottom" && tV === "bottom")
|
|
31
|
-
return "bottomRight";
|
|
32
|
-
return "right";
|
|
33
|
-
}
|
|
34
|
-
// anchor right, tooltip attached left -> tooltip sits right of anchor -> arrow on left side
|
|
35
|
-
if (aH === "right" && tH === "left") {
|
|
36
|
-
if (aV === "top" && tV === "top")
|
|
37
|
-
return "topLeft";
|
|
38
|
-
if (aV === "bottom" && tV === "bottom")
|
|
39
|
-
return "bottomLeft";
|
|
40
|
-
return "left";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// No clear difference (both centers or identical origins)
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { getArrowDirection as default };
|
|
1
|
+
function t(t,o){const e=t=>t.toLowerCase().trim().split(/\s+/),[f="top",i="left"]=e(t),[r="top",p="left"]=e(o);if(f!==r){if("top"===f&&"bottom"===r)return"left"===i&&"right"===p?"bottomRight":"right"===i&&"left"===p?"bottomLeft":"bottom";if("bottom"===f&&"top"===r)return"left"===i&&"right"===p?"topRight":"right"===i&&"left"===p?"topLeft":"top"}if(i!==p){if("left"===i&&"right"===p)return"top"===f&&"top"===r?"topRight":"bottom"===f&&"bottom"===r?"bottomRight":"right";if("right"===i&&"left"===p)return"top"===f&&"top"===r?"topLeft":"bottom"===f&&"bottom"===r?"bottomLeft":"left"}return null}export{t as default};
|
|
48
2
|
//# sourceMappingURL=getArrowDirection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getArrowDirection.js","sources":["../../../src/Display/Tooltip/getArrowDirection.ts"],"sourcesContent":["export default function getArrowDirection(\n anchorOrigin: string,\n transformOrigin: string\n):\n | \"top\"\n | \"bottom\"\n | \"left\"\n | \"right\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\"\n | null {\n const parse = (origin: string) => origin.toLowerCase().trim().split(/\\s+/);\n\n const [aV = \"top\", aH = \"left\"] = parse(anchorOrigin);\n const [tV = \"top\", tH = \"left\"] = parse(transformOrigin);\n\n // Vertical priority\n if (aV !== tV) {\n // anchor top, tooltip attached bottom -> tooltip is above anchor -> arrow on bottom side\n if (aV === \"top\" && tV === \"bottom\") {\n if (aH === \"left\" && tH === \"right\") return \"bottomRight\";\n if (aH === \"right\" && tH === \"left\") return \"bottomLeft\";\n return \"bottom\";\n }\n\n // anchor bottom, tooltip attached top -> tooltip is below anchor -> arrow on top side\n if (aV === \"bottom\" && tV === \"top\") {\n if (aH === \"left\" && tH === \"right\") return \"topRight\";\n if (aH === \"right\" && tH === \"left\") return \"topLeft\";\n return \"top\";\n }\n }\n\n // Horizontal fallback\n if (aH !== tH) {\n // anchor left, tooltip attached right -> tooltip sits left of anchor -> arrow on right side\n if (aH === \"left\" && tH === \"right\") {\n if (aV === \"top\" && tV === \"top\") return \"topRight\";\n if (aV === \"bottom\" && tV === \"bottom\") return \"bottomRight\";\n return \"right\";\n }\n\n // anchor right, tooltip attached left -> tooltip sits right of anchor -> arrow on left side\n if (aH === \"right\" && tH === \"left\") {\n if (aV === \"top\" && tV === \"top\") return \"topLeft\";\n if (aV === \"bottom\" && tV === \"bottom\") return \"bottomLeft\";\n return \"left\";\n }\n }\n\n // No clear difference (both centers or identical origins)\n return null;\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"getArrowDirection.js","sources":["../../../src/Display/Tooltip/getArrowDirection.ts"],"sourcesContent":["export default function getArrowDirection(\n anchorOrigin: string,\n transformOrigin: string\n):\n | \"top\"\n | \"bottom\"\n | \"left\"\n | \"right\"\n | \"topLeft\"\n | \"topRight\"\n | \"bottomLeft\"\n | \"bottomRight\"\n | null {\n const parse = (origin: string) => origin.toLowerCase().trim().split(/\\s+/);\n\n const [aV = \"top\", aH = \"left\"] = parse(anchorOrigin);\n const [tV = \"top\", tH = \"left\"] = parse(transformOrigin);\n\n // Vertical priority\n if (aV !== tV) {\n // anchor top, tooltip attached bottom -> tooltip is above anchor -> arrow on bottom side\n if (aV === \"top\" && tV === \"bottom\") {\n if (aH === \"left\" && tH === \"right\") return \"bottomRight\";\n if (aH === \"right\" && tH === \"left\") return \"bottomLeft\";\n return \"bottom\";\n }\n\n // anchor bottom, tooltip attached top -> tooltip is below anchor -> arrow on top side\n if (aV === \"bottom\" && tV === \"top\") {\n if (aH === \"left\" && tH === \"right\") return \"topRight\";\n if (aH === \"right\" && tH === \"left\") return \"topLeft\";\n return \"top\";\n }\n }\n\n // Horizontal fallback\n if (aH !== tH) {\n // anchor left, tooltip attached right -> tooltip sits left of anchor -> arrow on right side\n if (aH === \"left\" && tH === \"right\") {\n if (aV === \"top\" && tV === \"top\") return \"topRight\";\n if (aV === \"bottom\" && tV === \"bottom\") return \"bottomRight\";\n return \"right\";\n }\n\n // anchor right, tooltip attached left -> tooltip sits right of anchor -> arrow on left side\n if (aH === \"right\" && tH === \"left\") {\n if (aV === \"top\" && tV === \"top\") return \"topLeft\";\n if (aV === \"bottom\" && tV === \"bottom\") return \"bottomLeft\";\n return \"left\";\n }\n }\n\n // No clear difference (both centers or identical origins)\n return null;\n}\n"],"names":["getArrowDirection","anchorOrigin","transformOrigin","parse","origin","toLowerCase","trim","split","aV","aH","tV","tH"],"mappings":"AAAc,SAAUA,EACtBC,EACAC,GAWA,MAAMC,EAASC,GAAmBA,EAAOC,cAAcC,OAAOC,MAAM,QAE7DC,EAAK,MAAOC,EAAK,QAAUN,EAAMF,IACjCS,EAAK,MAAOC,EAAK,QAAUR,EAAMD,GAGxC,GAAIM,IAAOE,EAAI,CAEb,GAAW,QAAPF,GAAuB,WAAPE,EAClB,MAAW,SAAPD,GAAwB,UAAPE,EAAuB,cACjC,UAAPF,GAAyB,SAAPE,EAAsB,aACrC,SAIT,GAAW,WAAPH,GAA0B,QAAPE,EACrB,MAAW,SAAPD,GAAwB,UAAPE,EAAuB,WACjC,UAAPF,GAAyB,SAAPE,EAAsB,UACrC,KAEX,CAGA,GAAIF,IAAOE,EAAI,CAEb,GAAW,SAAPF,GAAwB,UAAPE,EACnB,MAAW,QAAPH,GAAuB,QAAPE,EAAqB,WAC9B,WAAPF,GAA0B,WAAPE,EAAwB,cACxC,QAIT,GAAW,UAAPD,GAAyB,SAAPE,EACpB,MAAW,QAAPH,GAAuB,QAAPE,EAAqB,UAC9B,WAAPF,GAA0B,WAAPE,EAAwB,aACxC,MAEX,CAGA,OAAO,IACT"}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { calculateSafePosition } from '@studiocubics/utils';
|
|
3
|
-
import { useState, useRef, useEffect, useCallback } from 'react';
|
|
4
|
-
|
|
5
|
-
function useTooltip(options = {}) {
|
|
6
|
-
const [showTooltip, setShowTooltip] = useState(false);
|
|
7
|
-
const [position, setPosition] = useState({ x: -9999, y: -9999 });
|
|
8
|
-
const anchorRef = useRef(null);
|
|
9
|
-
const tooltipRef = useRef(null);
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
const element = anchorRef.current;
|
|
12
|
-
if (!element)
|
|
13
|
-
return;
|
|
14
|
-
const handleMouseEnter = () => {
|
|
15
|
-
setShowTooltip(true);
|
|
16
|
-
};
|
|
17
|
-
const handleMouseLeave = () => {
|
|
18
|
-
setShowTooltip(false);
|
|
19
|
-
};
|
|
20
|
-
element.addEventListener("mouseenter", handleMouseEnter);
|
|
21
|
-
element.addEventListener("mouseleave", handleMouseLeave);
|
|
22
|
-
return () => {
|
|
23
|
-
element.removeEventListener("mouseenter", handleMouseEnter);
|
|
24
|
-
element.removeEventListener("mouseleave", handleMouseLeave);
|
|
25
|
-
};
|
|
26
|
-
}, []);
|
|
27
|
-
const updatePosition = useCallback(() => {
|
|
28
|
-
const safePos = calculateSafePosition(tooltipRef.current, anchorRef.current, options);
|
|
29
|
-
setPosition(safePos);
|
|
30
|
-
}, [options]);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (!showTooltip)
|
|
33
|
-
return;
|
|
34
|
-
// Initial position calculation
|
|
35
|
-
updatePosition();
|
|
36
|
-
// Update position on scroll and resize
|
|
37
|
-
window.addEventListener("scroll", updatePosition);
|
|
38
|
-
window.addEventListener("resize", updatePosition);
|
|
39
|
-
return () => {
|
|
40
|
-
window.removeEventListener("scroll", updatePosition);
|
|
41
|
-
window.removeEventListener("resize", updatePosition);
|
|
42
|
-
};
|
|
43
|
-
}, [showTooltip]);
|
|
44
|
-
return { showTooltip, position, anchorRef, tooltipRef, updatePosition };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { useTooltip };
|
|
1
|
+
"use client";import{calculateSafePosition as e}from"@studiocubics/utils";import{useState as t,useRef as n,useEffect as r,useCallback as o}from"react";function i(i={}){const[s,u]=t(!1),[c,d]=t({x:-9999,y:-9999}),l=n(null),v=n(null);r(()=>{const e=l.current;if(!e)return;const t=()=>{u(!0)},n=()=>{u(!1)};return e.addEventListener("mouseenter",t),e.addEventListener("mouseleave",n),()=>{e.removeEventListener("mouseenter",t),e.removeEventListener("mouseleave",n)}},[]);const m=o(()=>{const t=e(v.current,l.current,i);d(t)},[i]);return r(()=>{if(s)return m(),window.addEventListener("scroll",m),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m),window.removeEventListener("resize",m)}},[s]),{showTooltip:s,position:c,anchorRef:l,tooltipRef:v,updatePosition:m}}export{i as useTooltip};
|
|
48
2
|
//# sourceMappingURL=useTooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTooltip.js","sources":["../../../src/Display/Tooltip/useTooltip.tsx"],"sourcesContent":["\"use client\"\nimport {\n calculateSafePosition,\n type Position,\n type SafePositionOptions,\n} from \"@studiocubics/utils\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport function useTooltip(options: SafePositionOptions = {}) {\n const [showTooltip, setShowTooltip] = useState(false);\n const [position, setPosition] = useState<Position>({ x: -9999, y: -9999 });\n const anchorRef = useRef<HTMLElement>(null);\n const tooltipRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const element = anchorRef.current;\n if (!element) return;\n\n const handleMouseEnter = () => {\n setShowTooltip(true);\n };\n\n const handleMouseLeave = () => {\n setShowTooltip(false);\n };\n\n element.addEventListener(\"mouseenter\", handleMouseEnter);\n element.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n element.removeEventListener(\"mouseenter\", handleMouseEnter);\n element.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }, []);\n\n const updatePosition = useCallback(() => {\n const safePos = calculateSafePosition(\n tooltipRef.current,\n anchorRef.current,\n options\n );\n\n setPosition(safePos);\n }, [options]);\n\n useEffect(() => {\n if (!showTooltip) return;\n\n // Initial position calculation\n updatePosition();\n\n // Update position on scroll and resize\n window.addEventListener(\"scroll\", updatePosition);\n window.addEventListener(\"resize\", updatePosition);\n\n return () => {\n window.removeEventListener(\"scroll\", updatePosition);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }, [showTooltip]);\n\n return { showTooltip, position, anchorRef, tooltipRef, updatePosition };\n}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"useTooltip.js","sources":["../../../src/Display/Tooltip/useTooltip.tsx"],"sourcesContent":["\"use client\"\nimport {\n calculateSafePosition,\n type Position,\n type SafePositionOptions,\n} from \"@studiocubics/utils\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\n\nexport function useTooltip(options: SafePositionOptions = {}) {\n const [showTooltip, setShowTooltip] = useState(false);\n const [position, setPosition] = useState<Position>({ x: -9999, y: -9999 });\n const anchorRef = useRef<HTMLElement>(null);\n const tooltipRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n const element = anchorRef.current;\n if (!element) return;\n\n const handleMouseEnter = () => {\n setShowTooltip(true);\n };\n\n const handleMouseLeave = () => {\n setShowTooltip(false);\n };\n\n element.addEventListener(\"mouseenter\", handleMouseEnter);\n element.addEventListener(\"mouseleave\", handleMouseLeave);\n\n return () => {\n element.removeEventListener(\"mouseenter\", handleMouseEnter);\n element.removeEventListener(\"mouseleave\", handleMouseLeave);\n };\n }, []);\n\n const updatePosition = useCallback(() => {\n const safePos = calculateSafePosition(\n tooltipRef.current,\n anchorRef.current,\n options\n );\n\n setPosition(safePos);\n }, [options]);\n\n useEffect(() => {\n if (!showTooltip) return;\n\n // Initial position calculation\n updatePosition();\n\n // Update position on scroll and resize\n window.addEventListener(\"scroll\", updatePosition);\n window.addEventListener(\"resize\", updatePosition);\n\n return () => {\n window.removeEventListener(\"scroll\", updatePosition);\n window.removeEventListener(\"resize\", updatePosition);\n };\n }, [showTooltip]);\n\n return { showTooltip, position, anchorRef, tooltipRef, updatePosition };\n}\n"],"names":["useTooltip","options","showTooltip","setShowTooltip","useState","position","setPosition","x","y","anchorRef","useRef","tooltipRef","useEffect","element","current","handleMouseEnter","handleMouseLeave","addEventListener","removeEventListener","updatePosition","useCallback","safePos","calculateSafePosition","window"],"mappings":"sJAQM,SAAUA,EAAWC,EAA+B,IACxD,MAAOC,EAAaC,GAAkBC,GAAS,IACxCC,EAAUC,GAAeF,EAAmB,CAAEG,GAAG,KAAOC,GAAG,OAC5DC,EAAYC,EAAoB,MAChCC,EAAaD,EAAuB,MAE1CE,EAAU,KACR,MAAMC,EAAUJ,EAAUK,QAC1B,IAAKD,EAAS,OAEd,MAAME,EAAmB,KACvBZ,GAAe,IAGXa,EAAmB,KACvBb,GAAe,IAMjB,OAHAU,EAAQI,iBAAiB,aAAcF,GACvCF,EAAQI,iBAAiB,aAAcD,GAEhC,KACLH,EAAQK,oBAAoB,aAAcH,GAC1CF,EAAQK,oBAAoB,aAAcF,KAE3C,IAEH,MAAMG,EAAiBC,EAAY,KACjC,MAAMC,EAAUC,EACdX,EAAWG,QACXL,EAAUK,QACVb,GAGFK,EAAYe,IACX,CAACpB,IAkBJ,OAhBAW,EAAU,KACR,GAAKV,EASL,OANAiB,IAGAI,OAAON,iBAAiB,SAAUE,GAClCI,OAAON,iBAAiB,SAAUE,GAE3B,KACLI,OAAOL,oBAAoB,SAAUC,GACrCI,OAAOL,oBAAoB,SAAUC,KAEtC,CAACjB,IAEG,CAAEA,cAAaG,WAAUI,YAAWE,aAAYQ,iBACzD"}
|
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import styles from './ConfirmationForm.module.css.js';
|
|
3
|
-
import { cn } from '@studiocubics/utils';
|
|
4
|
-
import { Button } from '../../Inputs/Button/Button.js';
|
|
5
|
-
|
|
6
|
-
function ConfirmationForm(props) {
|
|
7
|
-
const { onCancel, formTitle, variant = "info", confirmText = "Confirm", cancelText = "Cancel", disabled, slotProps = {}, className, children, ...rest } = props;
|
|
8
|
-
return (jsxs("form", { "aria-disabled": disabled, className: cn(styles.root, className, styles[variant]), ...rest, children: [jsx("h4", { children: formTitle }), children, jsxs("div", { className: styles.actions, children: [jsx(Button, { variant: variant == "danger" ? "contained" : "text", disabled: disabled, type: "button", onClick: () => onCancel?.(), ...slotProps.cancelButton, children: cancelText }), jsx(Button, { disabled: disabled, variant: variant == "danger" ? "text" : "contained", color: variant == "danger" ? "error" : undefined, type: "submit", ...slotProps.confirmButton, children: confirmText })] })] }));
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export { ConfirmationForm };
|
|
1
|
+
import{jsxs as t,jsx as n}from"react/jsx-runtime";import o from"./ConfirmationForm.module.css.js";import{cn as r}from"@studiocubics/utils";import{Button as i}from"../../Inputs/Button/Button.js";function e(e){const{onCancel:a,formTitle:c,variant:s="info",confirmText:d="Confirm",cancelText:l="Cancel",disabled:m,slotProps:u={},className:f,children:p,...b}=e;return t("form",{"aria-disabled":m,className:r(o.root,f,o[s]),...b,children:[n("h4",{children:c}),p,t("div",{className:o.actions,children:[n(i,{variant:"danger"==s?"contained":"text",disabled:m,type:"button",onClick:()=>a?.(),...u.cancelButton,children:l}),n(i,{disabled:m,variant:"danger"==s?"text":"contained",color:"danger"==s?"error":void 0,type:"submit",...u.confirmButton,children:d})]})]})}export{e as ConfirmationForm};
|
|
12
2
|
//# sourceMappingURL=ConfirmationForm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationForm.js","sources":["../../../src/Forms/ConfirmationForm/ConfirmationForm.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport styles from \"./ConfirmationForm.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nimport { Button, type ButtonProps } from \"../../Inputs/Button/Button\";\nexport interface ConfirmationFormProps extends ComponentProps<\"form\"> {\n formTitle?: string;\n onCancel?: () => void;\n variant?: \"danger\" | \"info\";\n confirmText?: string;\n cancelText?: string;\n disabled?: boolean;\n slotProps?: {\n confirmButton?: ButtonProps;\n cancelButton?: ButtonProps;\n };\n}\nexport function ConfirmationForm(props: ConfirmationFormProps) {\n const {\n onCancel,\n formTitle,\n variant = \"info\",\n confirmText = \"Confirm\",\n cancelText = \"Cancel\",\n disabled,\n slotProps = {},\n className,\n children,\n ...rest\n } = props;\n return (\n <form\n aria-disabled={disabled}\n className={cn(styles.root, className, styles[variant])}\n {...rest}\n >\n <h4>{formTitle}</h4>\n {children}\n <div className={styles.actions}>\n <Button\n variant={variant == \"danger\" ? \"contained\" : \"text\"}\n disabled={disabled}\n type=\"button\"\n onClick={() => onCancel?.()}\n {...slotProps.cancelButton}\n >\n {cancelText}\n </Button>\n <Button\n disabled={disabled}\n variant={variant == \"danger\" ? \"text\" : \"contained\"}\n color={variant == \"danger\" ? \"error\" : undefined}\n type=\"submit\"\n {...slotProps.confirmButton}\n >\n {confirmText}\n </Button>\n </div>\n </form>\n );\n}\n"],"names":["
|
|
1
|
+
{"version":3,"file":"ConfirmationForm.js","sources":["../../../src/Forms/ConfirmationForm/ConfirmationForm.tsx"],"sourcesContent":["import type { ComponentProps } from \"react\";\nimport styles from \"./ConfirmationForm.module.css\";\nimport { cn } from \"@studiocubics/utils\";\nimport { Button, type ButtonProps } from \"../../Inputs/Button/Button\";\nexport interface ConfirmationFormProps extends ComponentProps<\"form\"> {\n formTitle?: string;\n onCancel?: () => void;\n variant?: \"danger\" | \"info\";\n confirmText?: string;\n cancelText?: string;\n disabled?: boolean;\n slotProps?: {\n confirmButton?: ButtonProps;\n cancelButton?: ButtonProps;\n };\n}\nexport function ConfirmationForm(props: ConfirmationFormProps) {\n const {\n onCancel,\n formTitle,\n variant = \"info\",\n confirmText = \"Confirm\",\n cancelText = \"Cancel\",\n disabled,\n slotProps = {},\n className,\n children,\n ...rest\n } = props;\n return (\n <form\n aria-disabled={disabled}\n className={cn(styles.root, className, styles[variant])}\n {...rest}\n >\n <h4>{formTitle}</h4>\n {children}\n <div className={styles.actions}>\n <Button\n variant={variant == \"danger\" ? \"contained\" : \"text\"}\n disabled={disabled}\n type=\"button\"\n onClick={() => onCancel?.()}\n {...slotProps.cancelButton}\n >\n {cancelText}\n </Button>\n <Button\n disabled={disabled}\n variant={variant == \"danger\" ? \"text\" : \"contained\"}\n color={variant == \"danger\" ? \"error\" : undefined}\n type=\"submit\"\n {...slotProps.confirmButton}\n >\n {confirmText}\n </Button>\n </div>\n </form>\n );\n}\n"],"names":["ConfirmationForm","props","onCancel","formTitle","variant","confirmText","cancelText","disabled","slotProps","className","children","rest","_jsxs","cn","styles","root","_jsx","actions","Button","type","onClick","cancelButton","color","undefined","confirmButton"],"mappings":"kMAgBM,SAAUA,EAAiBC,GAC/B,MAAMC,SACJA,EAAQC,UACRA,EAASC,QACTA,EAAU,OAAMC,YAChBA,EAAc,UAASC,WACvBA,EAAa,SAAQC,SACrBA,EAAQC,UACRA,EAAY,GAAEC,UACdA,EAASC,SACTA,KACGC,GACDV,EACJ,OACEW,EAAA,OAAA,CAAA,gBACiBL,EACfE,UAAWI,EAAGC,EAAOC,KAAMN,EAAWK,EAAOV,OACzCO,EAAID,SAAA,CAERM,EAAA,KAAA,CAAAN,SAAKP,IACJO,EACDE,EAAA,MAAA,CAAKH,UAAWK,EAAOG,QAAOP,SAAA,CAC5BM,EAACE,EAAM,CACLd,QAAoB,UAAXA,EAAsB,YAAc,OAC7CG,SAAUA,EACVY,KAAK,SACLC,QAAS,IAAMlB,SACXM,EAAUa,aAAYX,SAEzBJ,IAEHU,EAACE,EAAM,CACLX,SAAUA,EACVH,QAAoB,UAAXA,EAAsB,OAAS,YACxCkB,MAAkB,UAAXlB,EAAsB,aAAUmB,EACvCJ,KAAK,YACDX,EAAUgB,cAAad,SAE1BL,SAKX"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var o={root:"ConfirmationForm-module_root__ltcoI",danger:"ConfirmationForm-module_danger__C1MyS",actions:"ConfirmationForm-module_actions__TSHEJ"};export{o as default};
|
|
4
2
|
//# sourceMappingURL=ConfirmationForm.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmationForm.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ConfirmationForm.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,56 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import 'react';
|
|
4
|
-
import { useRipple, eventWithRipple } from '../../Misc/Ripple/Ripple.js';
|
|
5
|
-
import { cn } from '@studiocubics/utils';
|
|
6
|
-
import styles from './Button.module.css.js';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Button is love button is life
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const defaultElement = "button";
|
|
13
|
-
/**
|
|
14
|
-
* Base implementation for the Button component.
|
|
15
|
-
*
|
|
16
|
-
* This is a polymorphic component that defaults to rendering a `<button>`.
|
|
17
|
-
* Use the `as` prop to change the underlying element.
|
|
18
|
-
*
|
|
19
|
-
* @typeParam C - The intrinsic or custom element type to render.
|
|
20
|
-
*
|
|
21
|
-
* @group button
|
|
22
|
-
* @category inputs
|
|
23
|
-
*/
|
|
24
|
-
function ButtonBase(props) {
|
|
25
|
-
const { as, className, children, variant = "text", size = "md", startIcon, color, endIcon, square, fullWidth = false, onTouchStart, onClick, position, slotProps: _slotProps, ...restProps } = props;
|
|
26
|
-
const slotProps = _slotProps ?? {};
|
|
27
|
-
const Component = (as || defaultElement);
|
|
28
|
-
const { rippleElements, createRipple } = useRipple(slotProps.ripple);
|
|
29
|
-
const componentProps = {
|
|
30
|
-
className: cn(className, styles.root, square ? styles.square : "", fullWidth ? styles.fullWidth : "", position ? styles[`position_${position}`] : "", styles[`size_${size}`], styles[variant]),
|
|
31
|
-
onTouchStart: eventWithRipple(createRipple, onTouchStart),
|
|
32
|
-
onClick: eventWithRipple(createRipple, onClick),
|
|
33
|
-
"data-color": color,
|
|
34
|
-
...restProps,
|
|
35
|
-
};
|
|
36
|
-
return (jsxs(Component, { ...componentProps, children: [rippleElements, startIcon && (jsx("span", { ...slotProps.startIcon, className: cn(styles.iconContainer, slotProps.startIcon?.className), children: startIcon })), children, endIcon && (jsx("span", { ...slotProps.endIcon, className: cn(styles.iconContainer, slotProps.endIcon?.className), children: endIcon }))] }));
|
|
37
|
-
}
|
|
38
|
-
ButtonBase.displayName = "Button";
|
|
39
|
-
/**
|
|
40
|
-
* A polymorphic button component.
|
|
41
|
-
*
|
|
42
|
-
* By default it renders a `<button>`, but any element can be used via the `as` prop:
|
|
43
|
-
*
|
|
44
|
-
* ```tsx
|
|
45
|
-
* <Button as="a" href="/docs">Read docs</Button>
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* Supports variants, sizes, icons, and ripple effects.
|
|
49
|
-
*
|
|
50
|
-
* @group button
|
|
51
|
-
* @category inputs
|
|
52
|
-
*/
|
|
53
|
-
const Button = ButtonBase;
|
|
54
|
-
|
|
55
|
-
export { Button, ButtonBase };
|
|
1
|
+
"use client";import{jsxs as o,jsx as t}from"react/jsx-runtime";import"react";import{useRipple as s,eventWithRipple as n}from"../../Misc/Ripple/Ripple.js";import{cn as e}from"@studiocubics/utils";import i from"./Button.module.css.js";function r(r){const{as:c,className:a,children:l,variant:p="text",size:m="md",startIcon:u,color:d,endIcon:h,square:f,fullWidth:N=!1,onTouchStart:I,onClick:C,position:j,slotProps:x,...R}=r,b=x??{},k=c||"button",{rippleElements:q,createRipple:z}=s(b.ripple),B={className:e(a,i.root,f?i.square:"",N?i.fullWidth:"",j?i[`position_${j}`]:"",i[`size_${m}`],i[p]),onTouchStart:n(z,I),onClick:n(z,C),"data-color":d,...R};return o(k,{...B,children:[q,u&&t("span",{...b.startIcon,className:e(i.iconContainer,b.startIcon?.className),children:u}),l,h&&t("span",{...b.endIcon,className:e(i.iconContainer,b.endIcon?.className),children:h})]})}r.displayName="Button";const c=r;export{c as Button,r as ButtonBase};
|
|
56
2
|
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/Inputs/Button/Button.tsx"],"sourcesContent":["/**\n * Button is love button is life\n */\n\"use client\";\n\nimport type {\n PolymorphicComponentProps,\n PolymorphicComponentType,\n} from \"@studiocubics/types\";\nimport {\n type ComponentProps,\n type CSSProperties,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/Ripple/Ripple\";\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./Button.module.css\";\n\n/**\n * Props specific to the Button component.\n *\n * These extend the intrinsic element props of whatever element is passed via `as`.\n * @group button\n * @category inputs\n */\nexport interface ButtonBaseProps {\n /** Renders an icon at the beginning of the button. */\n startIcon?: ReactNode;\n\n /** Renders an icon at the end of the button. */\n endIcon?: ReactNode;\n\n /** Marks the button as selected. */\n selected?: boolean;\n\n /** Visual style variant. */\n variant?: \"contained\" | \"text\" | \"outlined\";\n\n /** Expands width to 100%. */\n fullWidth?: boolean;\n\n /** Force a 1:1 aspect ratio. */\n square?: boolean;\n\n /** Button size. */\n size?: \"sm\" | \"md\" | \"lg\";\n\n /** Overrides the CSS `position` property of the root element. */\n position?: CSSProperties[\"position\"];\n\n color?: \"primary\" | \"secondary\" | \"error\";\n /**\n * Slot props for customizing internal elements.\n */\n slotProps?: {\n /** Props for the ripple effect. */\n ripple?: UseRippleProps;\n\n /** Wrapper span for the start icon. */\n startIcon?: ComponentProps<\"span\">;\n\n /** Wrapper span for the end icon. */\n endIcon?: ComponentProps<\"span\">;\n };\n}\nconst defaultElement = \"button\";\ntype DefaultElement = typeof defaultElement;\n/**\n * Polymorphic props for the Button component.\n *\n * `C` defines the element type rendered by the component (e.g. `\"button\"`, `\"a\"`, `\"div\"`).\n * All intrinsic props for `C` are supported unless overridden by `ButtonBaseProps`.\n *\n * @group button\n * @category inputs\n */\nexport type ButtonProps<C extends ElementType = DefaultElement> =\n PolymorphicComponentProps<C, ButtonBaseProps>;\n\n/**\n * Base implementation for the Button component.\n *\n * This is a polymorphic component that defaults to rendering a `<button>`.\n * Use the `as` prop to change the underlying element.\n *\n * @typeParam C - The intrinsic or custom element type to render.\n *\n * @group button\n * @category inputs\n */\nexport function ButtonBase<C extends ElementType = DefaultElement>(\n props: ButtonProps<C>\n) {\n const {\n as,\n className,\n children,\n variant = \"text\",\n size = \"md\",\n startIcon,\n color,\n endIcon,\n square,\n fullWidth = false,\n onTouchStart,\n onClick,\n position,\n slotProps: _slotProps,\n ...restProps\n } = props as ButtonProps<DefaultElement>;\n const slotProps: NonNullable<ButtonBaseProps[\"slotProps\"]> = _slotProps ?? {};\n const Component = (as || defaultElement) as ElementType;\n const { rippleElements, createRipple } = useRipple(slotProps.ripple);\n\n const componentProps = {\n className: cn(\n className,\n styles.root,\n square ? styles.square : \"\",\n fullWidth ? styles.fullWidth : \"\",\n position ? styles[`position_${position}`] : \"\",\n styles[`size_${size}`],\n styles[variant]\n ),\n onTouchStart: eventWithRipple(createRipple, onTouchStart),\n onClick: eventWithRipple(createRipple, onClick),\n \"data-color\": color,\n ...restProps,\n };\n\n return (\n <Component {...componentProps}>\n {rippleElements}\n {startIcon && (\n <span\n {...slotProps.startIcon}\n className={cn(styles.iconContainer, slotProps.startIcon?.className)}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n {...slotProps.endIcon}\n className={cn(styles.iconContainer, slotProps.endIcon?.className)}\n >\n {endIcon}\n </span>\n )}\n </Component>\n );\n}\nButtonBase.displayName = \"Button\";\n\n/**\n * A polymorphic button component.\n *\n * By default it renders a `<button>`, but any element can be used via the `as` prop:\n *\n * ```tsx\n * <Button as=\"a\" href=\"/docs\">Read docs</Button>\n * ```\n *\n * Supports variants, sizes, icons, and ripple effects.\n *\n * @group button\n * @category inputs\n */\nexport const Button = ButtonBase as PolymorphicComponentType<\n ButtonBaseProps,\n DefaultElement\n>;\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;AAAA,CAAA,CAAA;;AAEG,CAAA,CAAA;;AAoEH,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAc,GAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ;AAc/B,CAAA,CAAA;;;;;;;;;;AAUG,CAAA,CAAA;AACG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CACxB,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA;AAErB,CAAA,CAAA,CAAA,CAAA,MAAM,CAAA,CACJ,CAAA,CAAE,EACF,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CACT,QAAQ,CAAA,CACR,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,GAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,CAAA,CAChB,IAAI,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAI,EACX,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CACT,KAAK,CAAA,CACL,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CACP,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,EACN,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,CAAA,CAAA,CAAG,KAAK,CAAA,CACjB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAY,EACZ,CAAA,CAAA,CAAA,CAAA,C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,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAQ;AAEjC,CAAA,CAAA;;;;;;;;;;;;;AAaG,CAAA,CAAA;AACI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,MAAM,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;;"}
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/Inputs/Button/Button.tsx"],"sourcesContent":["/**\n * Button is love button is life\n */\n\"use client\";\n\nimport type {\n PolymorphicComponentProps,\n PolymorphicComponentType,\n} from \"@studiocubics/types\";\nimport {\n type ComponentProps,\n type CSSProperties,\n type ElementType,\n type ReactNode,\n} from \"react\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/Ripple/Ripple\";\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./Button.module.css\";\n\n/**\n * Props specific to the Button component.\n *\n * These extend the intrinsic element props of whatever element is passed via `as`.\n * @group button\n * @category inputs\n */\nexport interface ButtonBaseProps {\n /** Renders an icon at the beginning of the button. */\n startIcon?: ReactNode;\n\n /** Renders an icon at the end of the button. */\n endIcon?: ReactNode;\n\n /** Marks the button as selected. */\n selected?: boolean;\n\n /** Visual style variant. */\n variant?: \"contained\" | \"text\" | \"outlined\";\n\n /** Expands width to 100%. */\n fullWidth?: boolean;\n\n /** Force a 1:1 aspect ratio. */\n square?: boolean;\n\n /** Button size. */\n size?: \"sm\" | \"md\" | \"lg\";\n\n /** Overrides the CSS `position` property of the root element. */\n position?: CSSProperties[\"position\"];\n\n color?: \"primary\" | \"secondary\" | \"error\";\n /**\n * Slot props for customizing internal elements.\n */\n slotProps?: {\n /** Props for the ripple effect. */\n ripple?: UseRippleProps;\n\n /** Wrapper span for the start icon. */\n startIcon?: ComponentProps<\"span\">;\n\n /** Wrapper span for the end icon. */\n endIcon?: ComponentProps<\"span\">;\n };\n}\nconst defaultElement = \"button\";\ntype DefaultElement = typeof defaultElement;\n/**\n * Polymorphic props for the Button component.\n *\n * `C` defines the element type rendered by the component (e.g. `\"button\"`, `\"a\"`, `\"div\"`).\n * All intrinsic props for `C` are supported unless overridden by `ButtonBaseProps`.\n *\n * @group button\n * @category inputs\n */\nexport type ButtonProps<C extends ElementType = DefaultElement> =\n PolymorphicComponentProps<C, ButtonBaseProps>;\n\n/**\n * Base implementation for the Button component.\n *\n * This is a polymorphic component that defaults to rendering a `<button>`.\n * Use the `as` prop to change the underlying element.\n *\n * @typeParam C - The intrinsic or custom element type to render.\n *\n * @group button\n * @category inputs\n */\nexport function ButtonBase<C extends ElementType = DefaultElement>(\n props: ButtonProps<C>\n) {\n const {\n as,\n className,\n children,\n variant = \"text\",\n size = \"md\",\n startIcon,\n color,\n endIcon,\n square,\n fullWidth = false,\n onTouchStart,\n onClick,\n position,\n slotProps: _slotProps,\n ...restProps\n } = props as ButtonProps<DefaultElement>;\n const slotProps: NonNullable<ButtonBaseProps[\"slotProps\"]> = _slotProps ?? {};\n const Component = (as || defaultElement) as ElementType;\n const { rippleElements, createRipple } = useRipple(slotProps.ripple);\n\n const componentProps = {\n className: cn(\n className,\n styles.root,\n square ? styles.square : \"\",\n fullWidth ? styles.fullWidth : \"\",\n position ? styles[`position_${position}`] : \"\",\n styles[`size_${size}`],\n styles[variant]\n ),\n onTouchStart: eventWithRipple(createRipple, onTouchStart),\n onClick: eventWithRipple(createRipple, onClick),\n \"data-color\": color,\n ...restProps,\n };\n\n return (\n <Component {...componentProps}>\n {rippleElements}\n {startIcon && (\n <span\n {...slotProps.startIcon}\n className={cn(styles.iconContainer, slotProps.startIcon?.className)}\n >\n {startIcon}\n </span>\n )}\n {children}\n {endIcon && (\n <span\n {...slotProps.endIcon}\n className={cn(styles.iconContainer, slotProps.endIcon?.className)}\n >\n {endIcon}\n </span>\n )}\n </Component>\n );\n}\nButtonBase.displayName = \"Button\";\n\n/**\n * A polymorphic button component.\n *\n * By default it renders a `<button>`, but any element can be used via the `as` prop:\n *\n * ```tsx\n * <Button as=\"a\" href=\"/docs\">Read docs</Button>\n * ```\n *\n * Supports variants, sizes, icons, and ripple effects.\n *\n * @group button\n * @category inputs\n */\nexport const Button = ButtonBase as PolymorphicComponentType<\n ButtonBaseProps,\n DefaultElement\n>;\n"],"names":["ButtonBase","props","as","className","children","variant","size","startIcon","color","endIcon","square","fullWidth","onTouchStart","onClick","position","slotProps","_slotProps","restProps","Component","rippleElements","createRipple","useRipple","ripple","componentProps","cn","styles","root","eventWithRipple","_jsxs","_jsx","iconContainer","displayName","Button"],"mappings":"yOA+FM,SAAUA,EACdC,GAEA,MAAMC,GACJA,EAAEC,UACFA,EAASC,SACTA,EAAQC,QACRA,EAAU,OAAMC,KAChBA,EAAO,KAAIC,UACXA,EAASC,MACTA,EAAKC,QACLA,EAAOC,OACPA,EAAMC,UACNA,GAAY,EAAKC,aACjBA,EAAYC,QACZA,EAAOC,SACPA,EACAC,UAAWC,KACRC,GACDhB,EACEc,EAAuDC,GAAc,CAAA,EACrEE,EAAahB,GA9CE,UA+CfiB,eAAEA,EAAcC,aAAEA,GAAiBC,EAAUN,EAAUO,QAEvDC,EAAiB,CACrBpB,UAAWqB,EACTrB,EACAsB,EAAOC,KACPhB,EAASe,EAAOf,OAAS,GACzBC,EAAYc,EAAOd,UAAY,GAC/BG,EAAWW,EAAO,YAAYX,KAAc,GAC5CW,EAAO,QAAQnB,KACfmB,EAAOpB,IAETO,aAAce,EAAgBP,EAAcR,GAC5CC,QAASc,EAAgBP,EAAcP,GACvC,aAAcL,KACXS,GAGL,OACEW,EAACV,EAAS,IAAKK,EAAcnB,SAAA,CAC1Be,EACAZ,GACCsB,EAAA,OAAA,IACMd,EAAUR,UACdJ,UAAWqB,EAAGC,EAAOK,cAAef,EAAUR,WAAWJ,WAAUC,SAElEG,IAGJH,EACAK,GACCoB,EAAA,OAAA,IACMd,EAAUN,QACdN,UAAWqB,EAAGC,EAAOK,cAAef,EAAUN,SAASN,WAAUC,SAEhEK,MAKX,CACAT,EAAW+B,YAAc,SAgBlB,MAAMC,EAAShC"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var o={root:"Button-module_root__hmumx",iconContainer:"Button-module_iconContainer__-VER1",square:"Button-module_square__Wu8jt",size_sm:"Button-module_size_sm__Qk6rp",size_md:"Button-module_size_md__qWVt-",size_lg:"Button-module_size_lg__e7Ely",contained:"Button-module_contained__tlUyK",outlined:"Button-module_outlined__rgbFf",position_absolute:"Button-module_position_absolute__NN8P1",position_relative:"Button-module_position_relative__r0CV0",position_fixed:"Button-module_position_fixed__LilZy",position_sticky:"Button-module_position_sticky__2ixpW",fullWidth:"Button-module_fullWidth__5o7qa"};export{o as default};
|
|
4
2
|
//# sourceMappingURL=Button.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,55 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useContext, useState, useRef, useEffect } from 'react';
|
|
4
|
-
import { CheckboxGroupContext } from './CheckboxGroup/CheckboxGroup.js';
|
|
5
|
-
import { cn } from '@studiocubics/utils';
|
|
6
|
-
import styles from './Checkbox.module.css.js';
|
|
7
|
-
import { useRipple, eventWithRipple } from '../../Misc/Ripple/Ripple.js';
|
|
8
|
-
|
|
9
|
-
function Checkbox(props) {
|
|
10
|
-
const { label, checked, indeterminate = false, skipGroup, checkedIcon, indeterminateIcon, slotProps = {}, "aria-label": ariaLabel, onChange, onTouchStart, onClick, ...inputProps } = props;
|
|
11
|
-
const group = useContext(CheckboxGroupContext);
|
|
12
|
-
const [index, setIndex] = useState(null);
|
|
13
|
-
const [selfChecked, setSelfChecked] = useState(false);
|
|
14
|
-
const inputRef = useRef(null);
|
|
15
|
-
const isRegistered = useRef(false);
|
|
16
|
-
const { rippleElements, createRipple } = useRipple();
|
|
17
|
-
const isChecked = group && !skipGroup && index !== null
|
|
18
|
-
? group.values[index]
|
|
19
|
-
: (checked ?? selfChecked);
|
|
20
|
-
const handleChange = (e) => {
|
|
21
|
-
const next = e.target.checked;
|
|
22
|
-
if (group && !skipGroup && index !== null) {
|
|
23
|
-
group.update(index, next);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
setSelfChecked(next);
|
|
27
|
-
}
|
|
28
|
-
onChange?.(e, next);
|
|
29
|
-
};
|
|
30
|
-
// Register with group if present
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (!group || skipGroup || isRegistered.current)
|
|
33
|
-
return;
|
|
34
|
-
isRegistered.current = true;
|
|
35
|
-
setIndex(group.register());
|
|
36
|
-
}, [group, skipGroup, index]);
|
|
37
|
-
// Set indeterminate state
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (inputRef.current) {
|
|
40
|
-
inputRef.current.indeterminate = indeterminate;
|
|
41
|
-
}
|
|
42
|
-
}, [indeterminate]);
|
|
43
|
-
return (jsxs("div", { ...slotProps.root, className: cn(styles.root, slotProps.root?.className), children: [jsxs("div", { ...slotProps.inputWrapper, className: cn(styles.inputWrapper, slotProps.inputWrapper?.className), children: [rippleElements, jsx("input", { ref: inputRef, type: "checkbox", checked: isChecked, "aria-checked": isChecked ?? false, "aria-label": ariaLabel || label, onChange: handleChange, id: label, onTouchStart: eventWithRipple(createRipple, onTouchStart), onClick: eventWithRipple(createRipple, onClick), ...inputProps }), jsxs("span", { children: [checkedIcon ?? jsx(CheckboxCheckedIcon, { checked: isChecked }), indeterminateIcon ?? (jsx(CheckboxIndeterminateIcon, { indeterminate: indeterminate }))] })] }), label && (jsx("label", { ...slotProps.label, htmlFor: label, className: cn(slotProps.label?.className, styles.label), children: label }))] }));
|
|
44
|
-
}
|
|
45
|
-
function CheckboxCheckedIcon(props) {
|
|
46
|
-
const { checked, className, ...rest } = props;
|
|
47
|
-
return (jsx("svg", { ...rest, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.3", strokeLinecap: "round", strokeLinejoin: "round", className: cn(checked ? styles.show : styles.hide, styles.checked, className), children: jsx("path", { d: "M4 12 9 17l11 -11" }) }));
|
|
48
|
-
}
|
|
49
|
-
function CheckboxIndeterminateIcon(props) {
|
|
50
|
-
const { indeterminate, className, ...rest } = props;
|
|
51
|
-
return (jsx("svg", { ...rest, viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", className: cn(indeterminate ? styles.show : styles.hide, styles.indeterminate, className), stroke: "currentColor", strokeWidth: "2.3", strokeLinecap: "round", strokeLinejoin: "round", children: jsx("path", { d: "M5 12h14" }) }));
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { Checkbox };
|
|
1
|
+
"use client";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useContext as t,useState as n,useRef as o,useEffect as c}from"react";import{CheckboxGroupContext as i}from"./CheckboxGroup/CheckboxGroup.js";import{cn as l}from"@studiocubics/utils";import s from"./Checkbox.module.css.js";import{useRipple as a,eventWithRipple as p}from"../../Misc/Ripple/Ripple.js";function u(u){const{label:m,checked:k,indeterminate:b=!1,skipGroup:w,checkedIcon:f,indeterminateIcon:g,slotProps:x={},"aria-label":N,onChange:v,onTouchStart:C,onClick:j,...W}=u,L=t(i),[G,M]=n(null),[R,B]=n(!1),I=o(null),S=o(!1),{rippleElements:T,createRipple:y}=a(),E=L&&!w&&null!==G?L.values[G]:k??R;return c(()=>{!L||w||S.current||(S.current=!0,M(L.register()))},[L,w,G]),c(()=>{I.current&&(I.current.indeterminate=b)},[b]),e("div",{...x.root,className:l(s.root,x.root?.className),children:[e("div",{...x.inputWrapper,className:l(s.inputWrapper,x.inputWrapper?.className),children:[T,r("input",{ref:I,type:"checkbox",checked:E,"aria-checked":E??!1,"aria-label":N||m,onChange:e=>{const r=e.target.checked;L&&!w&&null!==G?L.update(G,r):B(r),v?.(e,r)},id:m,onTouchStart:p(y,C),onClick:p(y,j),...W}),e("span",{children:[f??r(d,{checked:E}),g??r(h,{indeterminate:b})]})]}),m&&r("label",{...x.label,htmlFor:m,className:l(x.label?.className,s.label),children:m})]})}function d(e){const{checked:t,className:n,...o}=e;return r("svg",{...o,xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round",className:l(t?s.show:s.hide,s.checked,n),children:r("path",{d:"M4 12 9 17l11 -11"})})}function h(e){const{indeterminate:t,className:n,...o}=e;return r("svg",{...o,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",className:l(t?s.show:s.hide,s.indeterminate,n),stroke:"currentColor",strokeWidth:"2.3",strokeLinecap:"round",strokeLinejoin:"round",children:r("path",{d:"M5 12h14"})})}export{u as Checkbox};
|
|
55
2
|
//# sourceMappingURL=Checkbox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.js","sources":["../../../src/Inputs/Checkbox/Checkbox.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n type ReactElement,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { CheckboxGroupContext } from \"./CheckboxGroup/CheckboxGroup\";\n\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./Checkbox.module.css\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/Ripple/Ripple\";\n\ninterface CheckboxProps\n extends Omit<ComponentProps<\"input\">, \"onChange\" | \"type\"> {\n label?: string;\n checked?: boolean;\n indeterminate?: boolean;\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n ) => void;\n checkedIcon?: ReactElement<\n Required<Pick<CheckboxProps, \"checked\">> & ComponentProps<\"svg\">\n >;\n indeterminateIcon?: ReactElement<\n Required<Pick<CheckboxProps, \"indeterminate\">> & ComponentProps<\"svg\">\n >;\n slotProps?: {\n ripple?: UseRippleProps;\n startIcon?: ComponentProps<\"span\">;\n endIcon?: ComponentProps<\"span\">;\n root?: ComponentProps<\"div\">;\n inputWrapper?: ComponentProps<\"div\">;\n label?: ComponentProps<\"label\">;\n error?: ComponentProps<\"p\">;\n };\n /** INTERNAL: prevent group registration */\n skipGroup?: boolean;\n // TODO add size\n // TODO add color\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const {\n label,\n checked,\n indeterminate = false,\n skipGroup,\n checkedIcon,\n indeterminateIcon,\n slotProps = {},\n \"aria-label\": ariaLabel,\n onChange,\n onTouchStart,\n onClick,\n ...inputProps\n } = props;\n const group = useContext(CheckboxGroupContext);\n const [index, setIndex] = useState<number | null>(null);\n const [selfChecked, setSelfChecked] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const isRegistered = useRef(false);\n\n const { rippleElements, createRipple } = useRipple();\n\n const isChecked =\n group && !skipGroup && index !== null\n ? group.values[index]\n : (checked ?? selfChecked);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const next = e.target.checked;\n if (group && !skipGroup && index !== null) {\n group.update(index, next);\n } else {\n setSelfChecked(next);\n }\n onChange?.(e, next);\n };\n // Register with group if present\n useEffect(() => {\n if (!group || skipGroup || isRegistered.current) return;\n isRegistered.current = true;\n setIndex(group.register());\n }, [group, skipGroup, index]);\n\n // Set indeterminate state\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n return (\n <div\n {...slotProps.root}\n className={cn(styles.root, slotProps.root?.className)}\n >\n <div\n {...slotProps.inputWrapper}\n className={cn(styles.inputWrapper, slotProps.inputWrapper?.className)}\n >\n {rippleElements}\n <input\n ref={inputRef}\n type=\"checkbox\"\n checked={isChecked}\n aria-checked={isChecked ?? false}\n aria-label={ariaLabel || label}\n onChange={handleChange}\n id={label}\n onTouchStart={eventWithRipple(createRipple, onTouchStart)}\n onClick={eventWithRipple(createRipple, onClick)}\n {...inputProps}\n />\n <span>\n {checkedIcon ?? <CheckboxCheckedIcon checked={isChecked} />}\n {indeterminateIcon ?? (\n <CheckboxIndeterminateIcon indeterminate={indeterminate} />\n )}\n </span>\n </div>\n {label && (\n <label\n {...slotProps.label}\n htmlFor={label}\n className={cn(slotProps.label?.className, styles.label)}\n >\n {label}\n </label>\n )}\n </div>\n );\n}\nfunction CheckboxCheckedIcon(\n props: Required<Pick<CheckboxProps, \"checked\">> & ComponentProps<\"svg\">,\n) {\n const { checked, className, ...rest } = props;\n return (\n <svg\n {...rest}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn(\n checked ? styles.show : styles.hide,\n styles.checked,\n className,\n )}\n >\n <path d=\"M4 12 9 17l11 -11\" />\n </svg>\n );\n}\n\nfunction CheckboxIndeterminateIcon(\n props: Required<Pick<CheckboxProps, \"indeterminate\">> & ComponentProps<\"svg\">,\n) {\n const { indeterminate, className, ...rest } = props;\n return (\n <svg\n {...rest}\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n indeterminate ? styles.show : styles.hide,\n styles.indeterminate,\n className,\n )}\n stroke=\"currentColor\"\n strokeWidth=\"2.3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M5 12h14\" />\n </svg>\n );\n}\n"],"names":["_jsxs","_jsx"],"mappings":";;;;;;;;AAkDM,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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sx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentProps,\n type ReactElement,\n useContext,\n useEffect,\n useRef,\n useState,\n} from \"react\";\nimport { CheckboxGroupContext } from \"./CheckboxGroup/CheckboxGroup\";\n\nimport { cn } from \"@studiocubics/utils\";\nimport styles from \"./Checkbox.module.css\";\nimport {\n eventWithRipple,\n useRipple,\n type UseRippleProps,\n} from \"../../Misc/Ripple/Ripple\";\n\ninterface CheckboxProps\n extends Omit<ComponentProps<\"input\">, \"onChange\" | \"type\"> {\n label?: string;\n checked?: boolean;\n indeterminate?: boolean;\n onChange?: (\n event: React.ChangeEvent<HTMLInputElement>,\n checked: boolean,\n ) => void;\n checkedIcon?: ReactElement<\n Required<Pick<CheckboxProps, \"checked\">> & ComponentProps<\"svg\">\n >;\n indeterminateIcon?: ReactElement<\n Required<Pick<CheckboxProps, \"indeterminate\">> & ComponentProps<\"svg\">\n >;\n slotProps?: {\n ripple?: UseRippleProps;\n startIcon?: ComponentProps<\"span\">;\n endIcon?: ComponentProps<\"span\">;\n root?: ComponentProps<\"div\">;\n inputWrapper?: ComponentProps<\"div\">;\n label?: ComponentProps<\"label\">;\n error?: ComponentProps<\"p\">;\n };\n /** INTERNAL: prevent group registration */\n skipGroup?: boolean;\n // TODO add size\n // TODO add color\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const {\n label,\n checked,\n indeterminate = false,\n skipGroup,\n checkedIcon,\n indeterminateIcon,\n slotProps = {},\n \"aria-label\": ariaLabel,\n onChange,\n onTouchStart,\n onClick,\n ...inputProps\n } = props;\n const group = useContext(CheckboxGroupContext);\n const [index, setIndex] = useState<number | null>(null);\n const [selfChecked, setSelfChecked] = useState(false);\n\n const inputRef = useRef<HTMLInputElement>(null);\n const isRegistered = useRef(false);\n\n const { rippleElements, createRipple } = useRipple();\n\n const isChecked =\n group && !skipGroup && index !== null\n ? group.values[index]\n : (checked ?? selfChecked);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const next = e.target.checked;\n if (group && !skipGroup && index !== null) {\n group.update(index, next);\n } else {\n setSelfChecked(next);\n }\n onChange?.(e, next);\n };\n // Register with group if present\n useEffect(() => {\n if (!group || skipGroup || isRegistered.current) return;\n isRegistered.current = true;\n setIndex(group.register());\n }, [group, skipGroup, index]);\n\n // Set indeterminate state\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.indeterminate = indeterminate;\n }\n }, [indeterminate]);\n\n return (\n <div\n {...slotProps.root}\n className={cn(styles.root, slotProps.root?.className)}\n >\n <div\n {...slotProps.inputWrapper}\n className={cn(styles.inputWrapper, slotProps.inputWrapper?.className)}\n >\n {rippleElements}\n <input\n ref={inputRef}\n type=\"checkbox\"\n checked={isChecked}\n aria-checked={isChecked ?? false}\n aria-label={ariaLabel || label}\n onChange={handleChange}\n id={label}\n onTouchStart={eventWithRipple(createRipple, onTouchStart)}\n onClick={eventWithRipple(createRipple, onClick)}\n {...inputProps}\n />\n <span>\n {checkedIcon ?? <CheckboxCheckedIcon checked={isChecked} />}\n {indeterminateIcon ?? (\n <CheckboxIndeterminateIcon indeterminate={indeterminate} />\n )}\n </span>\n </div>\n {label && (\n <label\n {...slotProps.label}\n htmlFor={label}\n className={cn(slotProps.label?.className, styles.label)}\n >\n {label}\n </label>\n )}\n </div>\n );\n}\nfunction CheckboxCheckedIcon(\n props: Required<Pick<CheckboxProps, \"checked\">> & ComponentProps<\"svg\">,\n) {\n const { checked, className, ...rest } = props;\n return (\n <svg\n {...rest}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2.3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className={cn(\n checked ? styles.show : styles.hide,\n styles.checked,\n className,\n )}\n >\n <path d=\"M4 12 9 17l11 -11\" />\n </svg>\n );\n}\n\nfunction CheckboxIndeterminateIcon(\n props: Required<Pick<CheckboxProps, \"indeterminate\">> & ComponentProps<\"svg\">,\n) {\n const { indeterminate, className, ...rest } = props;\n return (\n <svg\n {...rest}\n viewBox=\"0 0 24 24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className={cn(\n indeterminate ? styles.show : styles.hide,\n styles.indeterminate,\n className,\n )}\n stroke=\"currentColor\"\n strokeWidth=\"2.3\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <path d=\"M5 12h14\" />\n </svg>\n );\n}\n"],"names":["Checkbox","props","label","checked","indeterminate","skipGroup","checkedIcon","indeterminateIcon","slotProps","ariaLabel","onChange","onTouchStart","onClick","inputProps","group","useContext","CheckboxGroupContext","index","setIndex","useState","selfChecked","setSelfChecked","inputRef","useRef","isRegistered","rippleElements","createRipple","useRipple","isChecked","values","useEffect","current","register","_jsxs","root","className","cn","styles","children","inputWrapper","_jsx","ref","type","e","next","target","update","id","eventWithRipple","CheckboxCheckedIcon","CheckboxIndeterminateIcon","htmlFor","rest","xmlns","viewBox","fill","stroke","strokeWidth","strokeLinecap","strokeLinejoin","show","hide","d"],"mappings":"iXAkDM,SAAUA,EAASC,GACvB,MAAMC,MACJA,EAAKC,QACLA,EAAOC,cACPA,GAAgB,EAAKC,UACrBA,EAASC,YACTA,EAAWC,kBACXA,EAAiBC,UACjBA,EAAY,CAAA,EACZ,aAAcC,EAASC,SACvBA,EAAQC,aACRA,EAAYC,QACZA,KACGC,GACDZ,EACEa,EAAQC,EAAWC,IAClBC,EAAOC,GAAYC,EAAwB,OAC3CC,EAAaC,GAAkBF,GAAS,GAEzCG,EAAWC,EAAyB,MACpCC,EAAeD,GAAO,IAEtBE,eAAEA,EAAcC,aAAEA,GAAiBC,IAEnCC,EACJd,IAAUT,GAAuB,OAAVY,EACnBH,EAAMe,OAAOZ,GACZd,GAAWiB,EAyBlB,OAbAU,EAAU,MACHhB,GAAST,GAAamB,EAAaO,UACxCP,EAAaO,SAAU,EACvBb,EAASJ,EAAMkB,cACd,CAAClB,EAAOT,EAAWY,IAGtBa,EAAU,KACJR,EAASS,UACXT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9C,OACEuC,EAAA,MAAA,IACMY,EACJE,QAAQ,YACRD,MAAM,6BACNlB,UAAWC,EACThC,EAAgBiC,EAAOuB,KAAOvB,EAAOwB,KACrCxB,EAAOjC,cACP+B,GAEFqB,OAAO,eACPC,YAAY,MACZC,cAAc,QACdC,eAAe,QAAOrB,SAEtBE,EAAA,OAAA,CAAMsB,EAAE,cAGd"}
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
export { styles as default };
|
|
1
|
+
var e={root:"Checkbox-module_root__52eFu",inputWrapper:"Checkbox-module_inputWrapper__JZjHc",show:"Checkbox-module_show__jXFKu",hide:"Checkbox-module_hide__j-2PL",label:"Checkbox-module_label__4Llik"};export{e as default};
|
|
4
2
|
//# sourceMappingURL=Checkbox.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Checkbox.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,35 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { createContext, useState, useRef, useCallback, useMemo } from 'react';
|
|
4
|
-
import styles from './CheckboxGroup.module.css.js';
|
|
5
|
-
|
|
6
|
-
const CheckboxGroupContext = createContext(null);
|
|
7
|
-
function CheckboxGroup({ children, onChange, label, }) {
|
|
8
|
-
const [values, setValues] = useState([]);
|
|
9
|
-
const indexRef = useRef(-1);
|
|
10
|
-
const register = useCallback(() => {
|
|
11
|
-
const index = indexRef.current++;
|
|
12
|
-
setValues((prev) => [...prev, false]);
|
|
13
|
-
return index;
|
|
14
|
-
}, []);
|
|
15
|
-
const update = useCallback((index, checked) => {
|
|
16
|
-
setValues((prev) => {
|
|
17
|
-
const next = [...prev];
|
|
18
|
-
next[index] = checked;
|
|
19
|
-
onChange?.(next);
|
|
20
|
-
return next;
|
|
21
|
-
});
|
|
22
|
-
}, [onChange]);
|
|
23
|
-
const setAll = useCallback((checked) => {
|
|
24
|
-
setValues((prev) => {
|
|
25
|
-
const next = prev.map(() => checked);
|
|
26
|
-
onChange?.(next);
|
|
27
|
-
return next;
|
|
28
|
-
});
|
|
29
|
-
}, [onChange]);
|
|
30
|
-
const context = useMemo(() => ({ values, register, update, setAll }), [values, register, update, setAll]);
|
|
31
|
-
return (jsxs("fieldset", { className: styles.root, children: [label && (jsx("legend", { className: styles.legend, id: label, children: label })), jsx(CheckboxGroupContext.Provider, { value: context, children: children })] }));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export { CheckboxGroup, CheckboxGroupContext };
|
|
1
|
+
"use client";import{jsxs as e,jsx as r}from"react/jsx-runtime";import{createContext as t,useState as n,useRef as o,useCallback as l,useMemo as c}from"react";import s from"./CheckboxGroup.module.css.js";const i=t(null);function u({children:t,onChange:u,label:a}){const[d,m]=n([]),p=o(-1),h=l(()=>{const e=p.current++;return m(e=>[...e,!1]),e},[]),f=l((e,r)=>{m(t=>{const n=[...t];return n[e]=r,u?.(n),n})},[u]),g=l(e=>{m(r=>{const t=r.map(()=>e);return u?.(t),t})},[u]),v=c(()=>({values:d,register:h,update:f,setAll:g}),[d,h,f,g]);return e("fieldset",{className:s.root,children:[a&&r("legend",{className:s.legend,id:a,children:a}),r(i.Provider,{value:v,children:t})]})}export{u as CheckboxGroup,i as CheckboxGroupContext};
|
|
35
2
|
//# sourceMappingURL=CheckboxGroup.js.map
|