@spark-ui/components 18.1.1 → 18.1.3
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/dist/{DialogContent.styles-ClKRO43s.mjs → DialogContent.styles-BVyH8M3z.mjs} +5 -5
- package/dist/{DialogContent.styles-ClKRO43s.mjs.map → DialogContent.styles-BVyH8M3z.mjs.map} +1 -1
- package/dist/{DialogContent.styles-FnwXayCC.js → DialogContent.styles-Bh6DymkD.js} +2 -2
- package/dist/{DialogContent.styles-FnwXayCC.js.map → DialogContent.styles-Bh6DymkD.js.map} +1 -1
- package/dist/{FormFieldRequiredIndicator-DY3STDp1.js → FormFieldRequiredIndicator-BxZgeZ9H.js} +2 -2
- package/dist/{FormFieldRequiredIndicator-DY3STDp1.js.map → FormFieldRequiredIndicator-BxZgeZ9H.js.map} +1 -1
- package/dist/{FormFieldRequiredIndicator-COKYxTNs.mjs → FormFieldRequiredIndicator-CfE6AOta.mjs} +2 -2
- package/dist/{FormFieldRequiredIndicator-COKYxTNs.mjs.map → FormFieldRequiredIndicator-CfE6AOta.mjs.map} +1 -1
- package/dist/accordion/index.js +1 -1
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +45 -50
- package/dist/accordion/index.mjs.map +1 -1
- package/dist/alert-dialog/AlertDialogAction.d.ts +1 -1
- package/dist/alert-dialog/AlertDialogCancel.d.ts +1 -1
- package/dist/alert-dialog/AlertDialogTrigger.d.ts +1 -1
- package/dist/alert-dialog/index.js +1 -1
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +53 -56
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/avatar/index.js +1 -1
- package/dist/avatar/index.mjs +2 -2
- package/dist/badge/BadgeItem.styles.d.ts +1 -1
- package/dist/badge/index.js +1 -1
- package/dist/badge/index.mjs +13 -13
- package/dist/breadcrumb/index.js +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/button/Button.styles.d.ts +1 -1
- package/dist/button/index.js +1 -1
- package/dist/button/index.mjs +1 -1
- package/dist/{button-D0s-21qo.js → button-3vvMrf1L.js} +2 -2
- package/dist/{button-D0s-21qo.js.map → button-3vvMrf1L.js.map} +1 -1
- package/dist/{button-DwLTXeJX.mjs → button-DBNjh3Bi.mjs} +76 -76
- package/dist/{button-DwLTXeJX.mjs.map → button-DBNjh3Bi.mjs.map} +1 -1
- package/dist/card/Backdrop.d.ts +1 -1
- package/dist/card/Card.styles.d.ts +1 -1
- package/dist/card/Content.styles.d.ts +1 -1
- package/dist/card/Type.d.ts +1 -1
- package/dist/card/index.js +1 -1
- package/dist/card/index.mjs +53 -53
- package/dist/carousel/index.js +1 -1
- package/dist/carousel/index.mjs +2 -2
- package/dist/checkbox/CheckboxInput.styles.d.ts +1 -1
- package/dist/checkbox/index.js +1 -1
- package/dist/checkbox/index.mjs +1 -1
- package/dist/{checkbox-uSINHQYe.mjs → checkbox-BEo9AVSB.mjs} +26 -26
- package/dist/{checkbox-uSINHQYe.mjs.map → checkbox-BEo9AVSB.mjs.map} +1 -1
- package/dist/{checkbox-Cbewcw6G.js → checkbox-Cr60_jql.js} +2 -2
- package/dist/{checkbox-Cbewcw6G.js.map → checkbox-Cr60_jql.js.map} +1 -1
- package/dist/chip/Chip.styles.d.ts +1 -1
- package/dist/chip/index.js +1 -1
- package/dist/chip/index.mjs +86 -86
- package/dist/collapsible/index.js +1 -1
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs +18 -24
- package/dist/collapsible/index.mjs.map +1 -1
- package/dist/combobox/index.js +1 -1
- package/dist/combobox/index.mjs +4 -4
- package/dist/dialog/DialogClose.d.ts +1 -1
- package/dist/dialog/DialogTrigger.d.ts +1 -1
- package/dist/dialog/index.js +1 -1
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +14 -12
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/divider/index.js +1 -1
- package/dist/divider/index.mjs +26 -26
- package/dist/drawer/DrawerClose.d.ts +1 -1
- package/dist/drawer/DrawerTrigger.d.ts +1 -1
- package/dist/drawer/index.js +1 -1
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +13 -11
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown/index.js +1 -1
- package/dist/dropdown/index.mjs +2 -2
- package/dist/file-upload/index.js +1 -1
- package/dist/file-upload/index.mjs +3 -3
- package/dist/form-field/index.js +1 -1
- package/dist/form-field/index.mjs +1 -1
- package/dist/{form-field-B38U0zp8.js → form-field-DMHwopHt.js} +2 -2
- package/dist/{form-field-B38U0zp8.js.map → form-field-DMHwopHt.js.map} +1 -1
- package/dist/{form-field-DCKyhBmv.mjs → form-field-Doq4zLEX.mjs} +4 -4
- package/dist/{form-field-DCKyhBmv.mjs.map → form-field-Doq4zLEX.mjs.map} +1 -1
- package/dist/icon/Icon.styles.d.ts +1 -1
- package/dist/icon/index.js +1 -1
- package/dist/icon/index.mjs +1 -1
- package/dist/icon-CfEsla9z.js +2 -0
- package/dist/{icon-DY4l9nsc.js.map → icon-CfEsla9z.js.map} +1 -1
- package/dist/{icon-Bs-39J-H.mjs → icon-VM_Ys9Xn.mjs} +11 -11
- package/dist/{icon-Bs-39J-H.mjs.map → icon-VM_Ys9Xn.mjs.map} +1 -1
- package/dist/icon-button/index.js +1 -1
- package/dist/icon-button/index.mjs +1 -1
- package/dist/icon-button-B2TM0Xby.js +2 -0
- package/dist/{icon-button-DRFf308H.js.map → icon-button-B2TM0Xby.js.map} +1 -1
- package/dist/icon-button-CexCkoV0.mjs +29 -0
- package/dist/{icon-button-C1ThqdK1.mjs.map → icon-button-CexCkoV0.mjs.map} +1 -1
- package/dist/input/index.js +1 -1
- package/dist/input/index.mjs +1 -1
- package/dist/{input-BoxJZira.js → input-CADvgFpY.js} +2 -2
- package/dist/{input-BoxJZira.js.map → input-CADvgFpY.js.map} +1 -1
- package/dist/{input-Du9YSgAt.mjs → input-CmlNZ4Bo.mjs} +2 -2
- package/dist/{input-Du9YSgAt.mjs.map → input-CmlNZ4Bo.mjs.map} +1 -1
- package/dist/label/index.js +1 -1
- package/dist/label/index.mjs +1 -1
- package/dist/{label-DO48yda7.js → label-B085X0Sg.js} +2 -2
- package/dist/{label-DO48yda7.js.map → label-B085X0Sg.js.map} +1 -1
- package/dist/{label-RKaPen31.mjs → label-BqWu-wLT.mjs} +6 -6
- package/dist/{label-RKaPen31.mjs.map → label-BqWu-wLT.mjs.map} +1 -1
- package/dist/menu/MenuItemStyles.d.ts +1 -1
- package/dist/menu/index.js +1 -1
- package/dist/menu/index.js.map +1 -1
- package/dist/menu/index.mjs +131 -140
- package/dist/menu/index.mjs.map +1 -1
- package/dist/meter/MeterTrack.styles.d.ts +1 -1
- package/dist/pagination/index.js +1 -1
- package/dist/pagination/index.mjs +3 -3
- package/dist/popover/PopoverContent.styles.d.ts +1 -1
- package/dist/popover/index.js +1 -1
- package/dist/popover/index.mjs +1 -1
- package/dist/{popover-DVz0JvON.js → popover-B-mcHcLF.js} +2 -2
- package/dist/{popover-DVz0JvON.js.map → popover-B-mcHcLF.js.map} +1 -1
- package/dist/{popover-CGhSHQzb.mjs → popover-COqbFikI.mjs} +17 -17
- package/dist/{popover-CGhSHQzb.mjs.map → popover-COqbFikI.mjs.map} +1 -1
- package/dist/progress/ProgressIndicator.d.ts +1 -1
- package/dist/progress-tracker/index.js +1 -1
- package/dist/progress-tracker/index.mjs +1 -1
- package/dist/radio-group/RadioIndicator.styles.d.ts +1 -1
- package/dist/radio-group/RadioInput.styles.d.ts +1 -1
- package/dist/radio-group/index.js +1 -1
- package/dist/radio-group/index.mjs +37 -37
- package/dist/rating/index.js +1 -1
- package/dist/rating/index.mjs +2 -2
- package/dist/rating-display/index.js +1 -1
- package/dist/rating-display/index.mjs +1 -1
- package/dist/scrolling-list/index.js +1 -1
- package/dist/scrolling-list/index.mjs +3 -3
- package/dist/select/index.js +1 -1
- package/dist/select/index.mjs +1 -1
- package/dist/slider/SliderThumb.styles.d.ts +1 -1
- package/dist/slider/SliderTrack.styles.d.ts +1 -1
- package/dist/slider/index.js +1 -1
- package/dist/slider/index.mjs +2 -2
- package/dist/slot/index.js +1 -1
- package/dist/slot/index.mjs +3 -3
- package/dist/spinner/Spinner.styles.d.ts +1 -1
- package/dist/spinner/index.js +1 -1
- package/dist/spinner/index.mjs +1 -1
- package/dist/{spinner-CmPypfJR.js → spinner-BAreohbs.js} +2 -2
- package/dist/{spinner-CmPypfJR.js.map → spinner-BAreohbs.js.map} +1 -1
- package/dist/{spinner-TfGcjNm3.mjs → spinner-DnrZf01S.mjs} +9 -9
- package/dist/{spinner-TfGcjNm3.mjs.map → spinner-DnrZf01S.mjs.map} +1 -1
- package/dist/stepper/index.js +1 -1
- package/dist/stepper/index.mjs +3 -3
- package/dist/switch/SwitchInput.d.ts +1 -1
- package/dist/switch/index.js +1 -1
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +43 -44
- package/dist/switch/index.mjs.map +1 -1
- package/dist/table/index.js +1 -1
- package/dist/table/index.mjs +3 -3
- package/dist/tabs/index.js +1 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +144 -153
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/tag/Tag.styles.d.ts +1 -1
- package/dist/tag/index.js +1 -1
- package/dist/tag/index.mjs +37 -37
- package/dist/text-link/TextLink.d.ts +1 -1
- package/dist/textarea/index.js +1 -1
- package/dist/textarea/index.mjs +1 -1
- package/dist/toast/Toast.styles.d.ts +1 -1
- package/dist/toast/index.js +1 -1
- package/dist/toast/index.js.map +1 -1
- package/dist/toast/index.mjs +4 -4
- package/dist/toast/index.mjs.map +1 -1
- package/dist/toggle-group/index.js +1 -1
- package/dist/toggle-group/index.js.map +1 -1
- package/dist/toggle-group/index.mjs +16 -21
- package/dist/toggle-group/index.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/accordion/useRenderSlot.d.ts +0 -3
- package/dist/alert-dialog/useRenderSlot.d.ts +0 -3
- package/dist/collapsible/useRenderSlot.d.ts +0 -3
- package/dist/drawer/useRenderSlot.d.ts +0 -3
- package/dist/icon-DY4l9nsc.js +0 -2
- package/dist/icon-button-C1ThqdK1.mjs +0 -29
- package/dist/icon-button-DRFf308H.js +0 -2
- package/dist/menu/useRenderSlot.d.ts +0 -1
- package/dist/tabs/useRenderSlot.d.ts +0 -1
- package/dist/toast/useRenderSlot.d.ts +0 -3
- package/dist/toggle-group/useRenderSlot.d.ts +0 -1
- package/dist/useRenderSlot-5CPC9Lkj.mjs +0 -11
- package/dist/useRenderSlot-5CPC9Lkj.mjs.map +0 -1
- package/dist/useRenderSlot-DHV0CegV.js +0 -2
- package/dist/useRenderSlot-DHV0CegV.js.map +0 -1
package/dist/menu/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/menu/Menu.tsx","../../src/menu/MenuItemStyles.tsx","../../src/menu/useRenderSlot.tsx","../../src/menu/MenuCheckboxItem.tsx","../../src/menu/MenuGroup.tsx","../../src/menu/MenuGroupLabel.tsx","../../src/menu/MenuItem.tsx","../../src/menu/MenuLinkItem.tsx","../../src/menu/MenuPopup.tsx","../../src/menu/MenuPortal.tsx","../../src/menu/MenuSubmenuContext.tsx","../../src/menu/MenuPositioner.tsx","../../src/menu/MenuRadioGroup.tsx","../../src/menu/MenuRadioItem.tsx","../../src/menu/MenuSeparator.tsx","../../src/menu/MenuSubmenu.tsx","../../src/menu/MenuSubmenuTrigger.tsx","../../src/menu/MenuTrigger.tsx","../../src/menu/index.ts"],"sourcesContent":["import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nexport interface MenuProps extends Omit<ComponentProps<typeof BaseMenu.Root>, 'children'> {\n /**\n * The content of the menu (trigger, portal, etc.)\n */\n children: ReactNode\n}\n\n/**\n * Root container for menu state and styling context.\n */\nexport const Menu = ({ children, ...rest }: MenuProps) => {\n return (\n <BaseMenu.Root data-spark-component=\"menu\" {...rest}>\n {children}\n </BaseMenu.Root>\n )\n}\n\nMenu.displayName = 'Menu'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nexport const menuItemStyles = cva(\n [\n 'gap-md flex w-full cursor-pointer items-center justify-start',\n 'text-left text-body-1',\n 'transition-colors duration-100',\n 'outline-none',\n 'focus-visible:u-outline focus-visible:-outline-offset-2',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-dim-3',\n 'min-h-sz-44',\n 'px-lg py-md',\n 'data-highlighted:bg-surface-hovered',\n 'data-popup-open:bg-surface-hovered',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['surface', 'main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral']\n >({\n surface: ['text-on-surface'],\n main: ['text-on-surface'],\n support: ['text-on-surface'],\n accent: ['text-on-surface'],\n success: ['text-on-surface'],\n alert: ['text-on-surface'],\n danger: ['text-on-surface'],\n info: ['text-on-surface'],\n neutral: ['text-on-surface'],\n }),\n },\n defaultVariants: {\n intent: 'surface',\n },\n }\n)\n\nexport type MenuItemStylesProps = VariantProps<typeof menuItemStyles>\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean) {\n return asChild ? ({ ...props }: object) => <Slot {...props} /> : undefined\n}\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { Check } from '@spark-ui/icons/Check'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { menuItemStyles } from './MenuItemStyles'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuCheckboxItemProps extends Omit<\n ComponentProps<typeof BaseMenu.CheckboxItem>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item with checkbox functionality.\n * Can be toggled on and off, allowing multiple selections.\n * The checkbox indicator is automatically rendered on the left side.\n */\nexport const MenuCheckboxItem = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuCheckboxItemProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseMenu.CheckboxItem\n ref={ref}\n data-spark-component=\"menu-checkbox-item\"\n render={renderSlot}\n className={cx(\n menuItemStyles({\n className,\n }),\n 'data-checked:font-bold'\n )}\n {...rest}\n >\n <BaseMenu.CheckboxItemIndicator\n keepMounted\n className={cx(\n 'mr-md flex shrink-0 items-center justify-center',\n 'w-sz-16 h-sz-16',\n 'transition-opacity',\n 'data-checked:opacity-100',\n 'opacity-0'\n )}\n >\n <Icon size=\"sm\" intent=\"current\">\n <Check />\n </Icon>\n </BaseMenu.CheckboxItemIndicator>\n {children}\n </BaseMenu.CheckboxItem>\n )\n}\n\nMenuCheckboxItem.displayName = 'Menu.CheckboxItem'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuGroupProps extends ComponentProps<typeof BaseMenu.Group> {}\n\n/**\n * A container for grouping related menu items together.\n * Works with Menu.GroupLabel for semantic grouping.\n */\nexport const MenuGroup = ({ children, className, ...rest }: MenuGroupProps) => {\n return (\n <BaseMenu.Group data-spark-component=\"menu-group\" className={cx('py-sm', className)} {...rest}>\n {children}\n </BaseMenu.Group>\n )\n}\n\nMenuGroup.displayName = 'Menu.Group'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuGroupLabelProps extends Omit<\n ComponentProps<typeof BaseMenu.GroupLabel>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A label for a group of menu items.\n * Provides semantic context and visual separation for grouped items.\n */\nexport const MenuGroupLabel = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuGroupLabelProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseMenu.GroupLabel\n ref={ref}\n data-spark-component=\"menu-group-label\"\n render={renderSlot}\n className={cx('text-on-surface/dim-1 text-body-2 font-bold', 'px-lg py-sm', className)}\n {...rest}\n >\n {children}\n </BaseMenu.GroupLabel>\n )\n}\n\nMenuGroupLabel.displayName = 'Menu.GroupLabel'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { menuItemStyles } from './MenuItemStyles'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuItemProps extends Omit<ComponentProps<typeof BaseMenu.Item>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item that triggers an action when activated.\n * Renders a clickable menu option with keyboard support.\n */\nexport const MenuItem = ({ asChild = false, children, className, ref, ...rest }: MenuItemProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseMenu.Item\n ref={ref}\n data-spark-component=\"menu-item\"\n render={renderSlot}\n className={menuItemStyles({\n className,\n })}\n {...rest}\n >\n {children}\n </BaseMenu.Item>\n )\n}\n\nMenuItem.displayName = 'Menu.Item'\n","import { Link } from '@spark-ui/icons/Link'\nimport { type ComponentPropsWithoutRef } from 'react'\n\nimport { Icon } from '../icon'\nimport { MenuItem } from './MenuItem'\n\nexport interface MenuLinkItemProps extends Omit<\n ComponentPropsWithoutRef<typeof MenuItem>,\n 'asChild'\n> {\n /**\n * The URL to navigate to.\n */\n href: string\n /**\n * Where to display the linked URL.\n * @default undefined\n */\n target?: string\n /**\n * The relationship between the current document and the linked document.\n * @default undefined\n */\n rel?: string\n}\n\n/**\n * A menu item that acts as a link.\n * Navigates to a URL when activated, useful for navigation menus.\n * Use with Next.js Link or React Router Link via the children prop.\n */\nexport const MenuLinkItem = ({ children, href, target, rel, ...rest }: MenuLinkItemProps) => {\n return (\n <MenuItem asChild {...rest}>\n <a href={href} target={target} rel={rel}>\n <Icon size=\"sm\" intent=\"current\" className=\"ml-auto shrink-0\">\n <Link />\n </Icon>\n <span className=\"flex-1\">{children}</span>\n </a>\n </MenuItem>\n )\n}\n\nMenuLinkItem.displayName = 'Menu.LinkItem'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuPopupProps extends Omit<ComponentProps<typeof BaseMenu.Popup>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The scrollable menu container that holds menu items.\n * Serves as the viewport for menu content with overflow handling.\n */\nexport const MenuPopup = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuPopupProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseMenu.Popup\n ref={ref}\n data-spark-component=\"menu-popup\"\n render={renderSlot}\n className={cx(\n [\n 'rounded-md bg-surface shadow-lg min-w-sz-192',\n 'p-sm',\n 'overflow-auto',\n 'z-popover',\n 'data-starting-style:opacity-0',\n 'data-ending-style:opacity-0',\n 'opacity-100',\n 'transition-opacity duration-200',\n ],\n className\n )}\n {...rest}\n >\n {children}\n </BaseMenu.Popup>\n )\n}\n\nMenuPopup.displayName = 'Menu.Popup'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuPortalProps extends ComponentProps<typeof BaseMenu.Portal> {}\n\n/**\n * Portal wrapper that renders the menu in a different part of the DOM tree.\n * Useful for avoiding z-index and overflow issues.\n */\nexport const MenuPortal = ({ children, ...rest }: MenuPortalProps) => {\n return <BaseMenu.Portal {...rest}>{children}</BaseMenu.Portal>\n}\n\nMenuPortal.displayName = 'Menu.Portal'\n","import { createContext, useContext } from 'react'\n\n/**\n * Context to track if we're inside a submenu\n */\nexport const MenuSubmenuContext = createContext<boolean>(false)\n\n/**\n * Hook to check if the current menu is a submenu\n */\nexport const useIsSubmenu = () => {\n return useContext(MenuSubmenuContext)\n}\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps } from 'react'\n\nimport { useIsSubmenu } from './MenuSubmenuContext'\n\nexport interface MenuPositionerProps extends ComponentProps<typeof BaseMenu.Positioner> {}\n\n/**\n * Positioning wrapper for the menu with collision detection.\n * Handles menu placement relative to the trigger and viewport boundaries.\n */\nexport const MenuPositioner = ({ children, sideOffset, ...rest }: MenuPositionerProps) => {\n const isSubmenu = useIsSubmenu()\n\n // Apply sideOffset of 8 for root menu, 0 for submenus (unless explicitly overridden)\n const defaultSideOffset = isSubmenu ? 0 : 8\n const finalSideOffset = sideOffset ?? defaultSideOffset\n\n return (\n <BaseMenu.Positioner sideOffset={finalSideOffset} {...rest}>\n {children}\n </BaseMenu.Positioner>\n )\n}\n\nMenuPositioner.displayName = 'Menu.Positioner'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuRadioGroupProps extends ComponentProps<typeof BaseMenu.RadioGroup> {}\n\n/**\n * A container for radio menu items where only one item can be selected at a time.\n * Manages the selection state for its radio items.\n */\nexport const MenuRadioGroup = ({ children, className, ...rest }: MenuRadioGroupProps) => {\n return (\n <BaseMenu.RadioGroup\n data-spark-component=\"menu-radio-group\"\n className={cx('py-sm', className)}\n {...rest}\n >\n {children}\n </BaseMenu.RadioGroup>\n )\n}\n\nMenuRadioGroup.displayName = 'Menu.RadioGroup'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { Check } from '@spark-ui/icons/Check'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { menuItemStyles } from './MenuItemStyles'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuRadioItemProps extends Omit<\n ComponentProps<typeof BaseMenu.RadioItem>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item with radio button functionality.\n * Only one radio item can be selected within its RadioGroup.\n * The radio indicator is automatically rendered on the left side.\n */\nexport const MenuRadioItem = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuRadioItemProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseMenu.RadioItem\n ref={ref}\n data-spark-component=\"menu-radio-item\"\n render={renderSlot}\n className={cx(\n menuItemStyles({\n className,\n }),\n 'data-checked:font-bold'\n )}\n {...rest}\n >\n <BaseMenu.RadioItemIndicator\n keepMounted\n className={cx(\n 'mr-md flex shrink-0 items-center justify-center',\n 'w-sz-16 h-sz-16',\n 'transition-opacity',\n 'data-checked:opacity-100',\n 'opacity-0'\n )}\n >\n <Icon size=\"sm\" intent=\"current\">\n <Check />\n </Icon>\n </BaseMenu.RadioItemIndicator>\n {children}\n </BaseMenu.RadioItem>\n )\n}\n\nMenuRadioItem.displayName = 'Menu.RadioItem'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuSeparatorProps extends ComponentProps<typeof BaseMenu.Separator> {}\n\n/**\n * A visual divider between menu items or groups.\n * Creates clear separation between different sections of the menu.\n */\nexport const MenuSeparator = ({ className, ...rest }: MenuSeparatorProps) => {\n return (\n <BaseMenu.Separator\n data-spark-component=\"menu-separator\"\n className={cx('my-sm h-px bg-outline/dim-2', className)}\n {...rest}\n />\n )\n}\n\nMenuSeparator.displayName = 'Menu.Separator'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nimport { MenuSubmenuContext } from './MenuSubmenuContext'\n\nexport interface MenuSubmenuProps extends Omit<\n ComponentProps<typeof BaseMenu.SubmenuRoot>,\n 'children'\n> {\n /**\n * The content of the submenu (trigger, positioner, popup, etc.)\n */\n children: ReactNode\n}\n\n/**\n * A nested submenu that appears when its trigger is activated.\n * Inherits styling context from the parent menu.\n */\nexport const MenuSubmenu = ({ children, ...rest }: MenuSubmenuProps) => {\n return (\n <BaseMenu.SubmenuRoot data-spark-component=\"menu-submenu\" {...rest}>\n <MenuSubmenuContext value={true}>{children}</MenuSubmenuContext>\n </BaseMenu.SubmenuRoot>\n )\n}\n\nMenuSubmenu.displayName = 'Menu.Submenu'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { ArrowVerticalRight } from '@spark-ui/icons/ArrowVerticalRight'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { menuItemStyles } from './MenuItemStyles'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuSubmenuTriggerProps extends Omit<\n ComponentProps<typeof BaseMenu.SubmenuTrigger>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item that opens a submenu when activated.\n * Displays an arrow indicator to show submenu availability.\n */\nexport const MenuSubmenuTrigger = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuSubmenuTriggerProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <BaseMenu.SubmenuTrigger\n ref={ref}\n data-spark-component=\"menu-submenu-trigger\"\n render={renderSlot}\n className={menuItemStyles({\n className,\n })}\n {...rest}\n >\n <span className=\"flex-1\">{children}</span>\n <Icon size=\"sm\" intent=\"current\" className=\"ml-auto shrink-0\">\n <ArrowVerticalRight />\n </Icon>\n </BaseMenu.SubmenuTrigger>\n )\n}\n\nMenuSubmenuTrigger.displayName = 'Menu.SubmenuTrigger'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { cx } from 'class-variance-authority'\nimport {\n cloneElement,\n isValidElement,\n type ComponentProps,\n type ReactElement,\n type Ref,\n} from 'react'\n\nimport { Icon } from '../icon'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface MenuTriggerProps extends Omit<ComponentProps<typeof BaseMenu.Trigger>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * The button that toggles the menu.\n * Renders a <button> element by default, or uses asChild for custom elements.\n * When used with asChild and a Button component, automatically adds an ArrowHorizontalDown icon.\n * Button components should use design=\"outlined\" and intent=\"support\".\n */\nexport const MenuTrigger = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuTriggerProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n // When asChild is used with a Button, enhance it with the arrow icon\n const enhancedChildren =\n asChild && isValidElement(children)\n ? cloneElement(\n children as ReactElement,\n {\n design: (children.props as { design?: string }).design ?? 'outlined',\n intent: (children.props as { intent?: string }).intent ?? 'support',\n children: (\n <>\n {(children.props as { children: React.ReactNode }).children}\n <Icon size=\"sm\" intent=\"current\" className=\"shrink-0\">\n <ArrowHorizontalDown />\n </Icon>\n </>\n ),\n } as Partial<unknown>\n )\n : children\n\n return (\n <BaseMenu.Trigger\n ref={ref}\n data-spark-component=\"menu-trigger\"\n render={renderSlot}\n className={cx(\n 'inline-flex items-center justify-center',\n 'focus-visible:u-outline',\n className\n )}\n {...rest}\n >\n {enhancedChildren}\n </BaseMenu.Trigger>\n )\n}\n\nMenuTrigger.displayName = 'Menu.Trigger'\n","import { Menu as Root } from './Menu'\nimport { MenuCheckboxItem } from './MenuCheckboxItem'\nimport { MenuGroup } from './MenuGroup'\nimport { MenuGroupLabel } from './MenuGroupLabel'\nimport { MenuItem } from './MenuItem'\nimport { MenuLinkItem } from './MenuLinkItem'\nimport { MenuPopup } from './MenuPopup'\nimport { MenuPortal } from './MenuPortal'\nimport { MenuPositioner } from './MenuPositioner'\nimport { MenuRadioGroup } from './MenuRadioGroup'\nimport { MenuRadioItem } from './MenuRadioItem'\nimport { MenuSeparator } from './MenuSeparator'\nimport { MenuSubmenu } from './MenuSubmenu'\nimport { MenuSubmenuTrigger } from './MenuSubmenuTrigger'\nimport { MenuTrigger } from './MenuTrigger'\n\n/**\n * A menu component that enables users to select options from a dropdown menu triggered by a button or other interactive element.\n */\nexport const Menu: typeof Root & {\n Trigger: typeof MenuTrigger\n Portal: typeof MenuPortal\n Positioner: typeof MenuPositioner\n Popup: typeof MenuPopup\n Item: typeof MenuItem\n LinkItem: typeof MenuLinkItem\n Submenu: typeof MenuSubmenu\n SubmenuTrigger: typeof MenuSubmenuTrigger\n Group: typeof MenuGroup\n GroupLabel: typeof MenuGroupLabel\n RadioGroup: typeof MenuRadioGroup\n RadioItem: typeof MenuRadioItem\n CheckboxItem: typeof MenuCheckboxItem\n Separator: typeof MenuSeparator\n} = Object.assign(Root, {\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Submenu: MenuSubmenu,\n SubmenuTrigger: MenuSubmenuTrigger,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n RadioGroup: MenuRadioGroup,\n RadioItem: MenuRadioItem,\n CheckboxItem: MenuCheckboxItem,\n Separator: MenuSeparator,\n})\n\nMenu.displayName = 'Menu'\nMenuTrigger.displayName = 'Menu.Trigger'\nMenuPortal.displayName = 'Menu.Portal'\nMenuPositioner.displayName = 'Menu.Positioner'\nMenuPopup.displayName = 'Menu.Popup'\nMenuItem.displayName = 'Menu.Item'\nMenuLinkItem.displayName = 'Menu.LinkItem'\nMenuSubmenu.displayName = 'Menu.Submenu'\nMenuSubmenuTrigger.displayName = 'Menu.SubmenuTrigger'\nMenuGroup.displayName = 'Menu.Group'\nMenuGroupLabel.displayName = 'Menu.GroupLabel'\nMenuRadioGroup.displayName = 'Menu.RadioGroup'\nMenuRadioItem.displayName = 'Menu.RadioItem'\nMenuCheckboxItem.displayName = 'Menu.CheckboxItem'\nMenuSeparator.displayName = 'Menu.Separator'\n\nexport { type MenuProps } from './Menu'\nexport { type MenuTriggerProps } from './MenuTrigger'\nexport { type MenuPortalProps } from './MenuPortal'\nexport { type MenuPositionerProps } from './MenuPositioner'\nexport { type MenuPopupProps } from './MenuPopup'\nexport { type MenuItemProps } from './MenuItem'\nexport { type MenuLinkItemProps } from './MenuLinkItem'\nexport { type MenuSubmenuProps } from './MenuSubmenu'\nexport { type MenuSubmenuTriggerProps } from './MenuSubmenuTrigger'\nexport { type MenuGroupProps } from './MenuGroup'\nexport { type MenuGroupLabelProps } from './MenuGroupLabel'\nexport { type MenuRadioGroupProps } from './MenuRadioGroup'\nexport { type MenuRadioItemProps } from './MenuRadioItem'\nexport { type MenuCheckboxItemProps } from './MenuCheckboxItem'\nexport { type MenuSeparatorProps } from './MenuSeparator'\n"],"mappings":";;;;;;;;;;;;AAaA,IAAa,KAAQ,EAAE,aAAU,GAAG,QAEhC,kBAAC,EAAS,MAAV;CAAe,wBAAqB;CAAO,GAAI;CAC5C;AACY,CAAA;AAInB,EAAK,cAAc;;;AClBnB,IAAa,IAAiB,EAC5B;CACE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACA;CACE,UAAU,EACR,QAAQ,EAGN;EACA,SAAS,CAAC,iBA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"index.mjs","names":[],"sources":["../../src/menu/Menu.tsx","../../src/menu/MenuItemStyles.tsx","../../src/menu/MenuCheckboxItem.tsx","../../src/menu/MenuGroup.tsx","../../src/menu/MenuGroupLabel.tsx","../../src/menu/MenuItem.tsx","../../src/menu/MenuLinkItem.tsx","../../src/menu/MenuPopup.tsx","../../src/menu/MenuPortal.tsx","../../src/menu/MenuSubmenuContext.tsx","../../src/menu/MenuPositioner.tsx","../../src/menu/MenuRadioGroup.tsx","../../src/menu/MenuRadioItem.tsx","../../src/menu/MenuSeparator.tsx","../../src/menu/MenuSubmenu.tsx","../../src/menu/MenuSubmenuTrigger.tsx","../../src/menu/MenuTrigger.tsx","../../src/menu/index.ts"],"sourcesContent":["import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nexport interface MenuProps extends Omit<ComponentProps<typeof BaseMenu.Root>, 'children'> {\n /**\n * The content of the menu (trigger, portal, etc.)\n */\n children: ReactNode\n}\n\n/**\n * Root container for menu state and styling context.\n */\nexport const Menu = ({ children, ...rest }: MenuProps) => {\n return (\n <BaseMenu.Root data-spark-component=\"menu\" {...rest}>\n {children}\n </BaseMenu.Root>\n )\n}\n\nMenu.displayName = 'Menu'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, type VariantProps } from 'class-variance-authority'\n\nexport const menuItemStyles = cva(\n [\n 'gap-md flex w-full cursor-pointer items-center justify-start',\n 'text-left text-body-1',\n 'transition-colors duration-100',\n 'outline-none',\n 'focus-visible:u-outline focus-visible:-outline-offset-2',\n 'data-disabled:cursor-not-allowed data-disabled:opacity-dim-3',\n 'min-h-sz-44',\n 'px-lg py-md',\n 'data-highlighted:bg-surface-hovered',\n 'data-popup-open:bg-surface-hovered',\n ],\n {\n variants: {\n intent: makeVariants<\n 'intent',\n ['surface', 'main', 'support', 'accent', 'success', 'alert', 'danger', 'info', 'neutral']\n >({\n surface: ['text-on-surface'],\n main: ['text-on-surface'],\n support: ['text-on-surface'],\n accent: ['text-on-surface'],\n success: ['text-on-surface'],\n alert: ['text-on-surface'],\n danger: ['text-on-surface'],\n info: ['text-on-surface'],\n neutral: ['text-on-surface'],\n }),\n },\n defaultVariants: {\n intent: 'surface',\n },\n }\n)\n\nexport type MenuItemStylesProps = VariantProps<typeof menuItemStyles>\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { Check } from '@spark-ui/icons/Check'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { menuItemStyles } from './MenuItemStyles'\n\nexport interface MenuCheckboxItemProps extends Omit<\n ComponentProps<typeof BaseMenu.CheckboxItem>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item with checkbox functionality.\n * Can be toggled on and off, allowing multiple selections.\n * The checkbox indicator is automatically rendered on the left side.\n */\nexport const MenuCheckboxItem = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuCheckboxItemProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <BaseMenu.CheckboxItem\n ref={ref}\n data-spark-component=\"menu-checkbox-item\"\n render={renderProp}\n className={cx(\n menuItemStyles({\n className,\n }),\n 'data-checked:font-bold'\n )}\n {...rest}\n >\n <BaseMenu.CheckboxItemIndicator\n keepMounted\n className={cx(\n 'mr-md flex shrink-0 items-center justify-center',\n 'w-sz-16 h-sz-16',\n 'transition-opacity',\n 'data-checked:opacity-100',\n 'opacity-0'\n )}\n >\n <Icon size=\"sm\" intent=\"current\">\n <Check />\n </Icon>\n </BaseMenu.CheckboxItemIndicator>\n {innerChildren}\n </BaseMenu.CheckboxItem>\n )\n}\n\nMenuCheckboxItem.displayName = 'Menu.CheckboxItem'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuGroupProps extends ComponentProps<typeof BaseMenu.Group> {}\n\n/**\n * A container for grouping related menu items together.\n * Works with Menu.GroupLabel for semantic grouping.\n */\nexport const MenuGroup = ({ children, className, ...rest }: MenuGroupProps) => {\n return (\n <BaseMenu.Group data-spark-component=\"menu-group\" className={cx('py-sm', className)} {...rest}>\n {children}\n </BaseMenu.Group>\n )\n}\n\nMenuGroup.displayName = 'Menu.Group'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nexport interface MenuGroupLabelProps extends Omit<\n ComponentProps<typeof BaseMenu.GroupLabel>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A label for a group of menu items.\n * Provides semantic context and visual separation for grouped items.\n */\nexport const MenuGroupLabel = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuGroupLabelProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <BaseMenu.GroupLabel\n ref={ref}\n data-spark-component=\"menu-group-label\"\n render={renderProp}\n className={cx('text-on-surface/dim-1 text-body-2 font-bold', 'px-lg py-sm', className)}\n {...rest}\n >\n {innerChildren}\n </BaseMenu.GroupLabel>\n )\n}\n\nMenuGroupLabel.displayName = 'Menu.GroupLabel'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { menuItemStyles } from './MenuItemStyles'\n\nexport interface MenuItemProps extends Omit<ComponentProps<typeof BaseMenu.Item>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item that triggers an action when activated.\n * Renders a clickable menu option with keyboard support.\n */\nexport const MenuItem = ({ asChild = false, children, className, ref, ...rest }: MenuItemProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <BaseMenu.Item\n ref={ref}\n data-spark-component=\"menu-item\"\n render={renderProp}\n className={menuItemStyles({\n className,\n })}\n {...rest}\n >\n {innerChildren}\n </BaseMenu.Item>\n )\n}\n\nMenuItem.displayName = 'Menu.Item'\n","import { Link } from '@spark-ui/icons/Link'\nimport { type ComponentPropsWithoutRef } from 'react'\n\nimport { Icon } from '../icon'\nimport { MenuItem } from './MenuItem'\n\nexport interface MenuLinkItemProps extends Omit<\n ComponentPropsWithoutRef<typeof MenuItem>,\n 'asChild'\n> {\n /**\n * The URL to navigate to.\n */\n href: string\n /**\n * Where to display the linked URL.\n * @default undefined\n */\n target?: string\n /**\n * The relationship between the current document and the linked document.\n * @default undefined\n */\n rel?: string\n}\n\n/**\n * A menu item that acts as a link.\n * Navigates to a URL when activated, useful for navigation menus.\n * Use with Next.js Link or React Router Link via the children prop.\n */\nexport const MenuLinkItem = ({ children, href, target, rel, ...rest }: MenuLinkItemProps) => {\n return (\n <MenuItem asChild {...rest}>\n <a href={href} target={target} rel={rel}>\n <Icon size=\"sm\" intent=\"current\" className=\"ml-auto shrink-0\">\n <Link />\n </Icon>\n <span className=\"flex-1\">{children}</span>\n </a>\n </MenuItem>\n )\n}\n\nMenuLinkItem.displayName = 'Menu.LinkItem'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nexport interface MenuPopupProps extends Omit<ComponentProps<typeof BaseMenu.Popup>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The scrollable menu container that holds menu items.\n * Serves as the viewport for menu content with overflow handling.\n */\nexport const MenuPopup = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuPopupProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <BaseMenu.Popup\n ref={ref}\n data-spark-component=\"menu-popup\"\n render={renderProp}\n className={cx(\n [\n 'rounded-md bg-surface shadow-lg min-w-sz-192',\n 'p-sm',\n 'overflow-auto',\n 'z-popover',\n 'data-starting-style:opacity-0',\n 'data-ending-style:opacity-0',\n 'opacity-100',\n 'transition-opacity duration-200',\n ],\n className\n )}\n {...rest}\n >\n {innerChildren}\n </BaseMenu.Popup>\n )\n}\n\nMenuPopup.displayName = 'Menu.Popup'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuPortalProps extends ComponentProps<typeof BaseMenu.Portal> {}\n\n/**\n * Portal wrapper that renders the menu in a different part of the DOM tree.\n * Useful for avoiding z-index and overflow issues.\n */\nexport const MenuPortal = ({ children, ...rest }: MenuPortalProps) => {\n return <BaseMenu.Portal {...rest}>{children}</BaseMenu.Portal>\n}\n\nMenuPortal.displayName = 'Menu.Portal'\n","import { createContext, useContext } from 'react'\n\n/**\n * Context to track if we're inside a submenu\n */\nexport const MenuSubmenuContext = createContext<boolean>(false)\n\n/**\n * Hook to check if the current menu is a submenu\n */\nexport const useIsSubmenu = () => {\n return useContext(MenuSubmenuContext)\n}\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps } from 'react'\n\nimport { useIsSubmenu } from './MenuSubmenuContext'\n\nexport interface MenuPositionerProps extends ComponentProps<typeof BaseMenu.Positioner> {}\n\n/**\n * Positioning wrapper for the menu with collision detection.\n * Handles menu placement relative to the trigger and viewport boundaries.\n */\nexport const MenuPositioner = ({ children, sideOffset, ...rest }: MenuPositionerProps) => {\n const isSubmenu = useIsSubmenu()\n\n // Apply sideOffset of 8 for root menu, 0 for submenus (unless explicitly overridden)\n const defaultSideOffset = isSubmenu ? 0 : 8\n const finalSideOffset = sideOffset ?? defaultSideOffset\n\n return (\n <BaseMenu.Positioner sideOffset={finalSideOffset} {...rest}>\n {children}\n </BaseMenu.Positioner>\n )\n}\n\nMenuPositioner.displayName = 'Menu.Positioner'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuRadioGroupProps extends ComponentProps<typeof BaseMenu.RadioGroup> {}\n\n/**\n * A container for radio menu items where only one item can be selected at a time.\n * Manages the selection state for its radio items.\n */\nexport const MenuRadioGroup = ({ children, className, ...rest }: MenuRadioGroupProps) => {\n return (\n <BaseMenu.RadioGroup\n data-spark-component=\"menu-radio-group\"\n className={cx('py-sm', className)}\n {...rest}\n >\n {children}\n </BaseMenu.RadioGroup>\n )\n}\n\nMenuRadioGroup.displayName = 'Menu.RadioGroup'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { Check } from '@spark-ui/icons/Check'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { menuItemStyles } from './MenuItemStyles'\n\nexport interface MenuRadioItemProps extends Omit<\n ComponentProps<typeof BaseMenu.RadioItem>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item with radio button functionality.\n * Only one radio item can be selected within its RadioGroup.\n * The radio indicator is automatically rendered on the left side.\n */\nexport const MenuRadioItem = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuRadioItemProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <BaseMenu.RadioItem\n ref={ref}\n data-spark-component=\"menu-radio-item\"\n render={renderProp}\n className={cx(\n menuItemStyles({\n className,\n }),\n 'data-checked:font-bold'\n )}\n {...rest}\n >\n <BaseMenu.RadioItemIndicator\n keepMounted\n className={cx(\n 'mr-md flex shrink-0 items-center justify-center',\n 'w-sz-16 h-sz-16',\n 'transition-opacity',\n 'data-checked:opacity-100',\n 'opacity-0'\n )}\n >\n <Icon size=\"sm\" intent=\"current\">\n <Check />\n </Icon>\n </BaseMenu.RadioItemIndicator>\n {innerChildren}\n </BaseMenu.RadioItem>\n )\n}\n\nMenuRadioItem.displayName = 'Menu.RadioItem'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nexport interface MenuSeparatorProps extends ComponentProps<typeof BaseMenu.Separator> {}\n\n/**\n * A visual divider between menu items or groups.\n * Creates clear separation between different sections of the menu.\n */\nexport const MenuSeparator = ({ className, ...rest }: MenuSeparatorProps) => {\n return (\n <BaseMenu.Separator\n data-spark-component=\"menu-separator\"\n className={cx('my-sm h-px bg-outline/dim-2', className)}\n {...rest}\n />\n )\n}\n\nMenuSeparator.displayName = 'Menu.Separator'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { type ComponentProps, type ReactNode } from 'react'\n\nimport { MenuSubmenuContext } from './MenuSubmenuContext'\n\nexport interface MenuSubmenuProps extends Omit<\n ComponentProps<typeof BaseMenu.SubmenuRoot>,\n 'children'\n> {\n /**\n * The content of the submenu (trigger, positioner, popup, etc.)\n */\n children: ReactNode\n}\n\n/**\n * A nested submenu that appears when its trigger is activated.\n * Inherits styling context from the parent menu.\n */\nexport const MenuSubmenu = ({ children, ...rest }: MenuSubmenuProps) => {\n return (\n <BaseMenu.SubmenuRoot data-spark-component=\"menu-submenu\" {...rest}>\n <MenuSubmenuContext value={true}>{children}</MenuSubmenuContext>\n </BaseMenu.SubmenuRoot>\n )\n}\n\nMenuSubmenu.displayName = 'Menu.Submenu'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { ArrowVerticalRight } from '@spark-ui/icons/ArrowVerticalRight'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { type ComponentProps, type Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { menuItemStyles } from './MenuItemStyles'\n\nexport interface MenuSubmenuTriggerProps extends Omit<\n ComponentProps<typeof BaseMenu.SubmenuTrigger>,\n 'render'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * A menu item that opens a submenu when activated.\n * Displays an arrow indicator to show submenu availability.\n */\nexport const MenuSubmenuTrigger = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuSubmenuTriggerProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <BaseMenu.SubmenuTrigger\n ref={ref}\n data-spark-component=\"menu-submenu-trigger\"\n render={renderProp}\n className={menuItemStyles({\n className,\n })}\n {...rest}\n >\n <span className=\"flex-1\">{innerChildren}</span>\n <Icon size=\"sm\" intent=\"current\" className=\"ml-auto shrink-0\">\n <ArrowVerticalRight />\n </Icon>\n </BaseMenu.SubmenuTrigger>\n )\n}\n\nMenuSubmenuTrigger.displayName = 'Menu.SubmenuTrigger'\n","import { Menu as BaseMenu } from '@base-ui/react/menu'\nimport { ArrowHorizontalDown } from '@spark-ui/icons/ArrowHorizontalDown'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { cx } from 'class-variance-authority'\nimport {\n cloneElement,\n isValidElement,\n type ComponentProps,\n type ReactElement,\n type Ref,\n} from 'react'\n\nimport { Icon } from '../icon'\n\nexport interface MenuTriggerProps extends Omit<ComponentProps<typeof BaseMenu.Trigger>, 'render'> {\n /**\n * Change the component to the HTML tag or custom component of the only child.\n * This will merge the original component props with the props of the supplied element/component and change the underlying DOM node.\n * @default false\n */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * The button that toggles the menu.\n * Renders a <button> element by default, or uses asChild for custom elements.\n * When used with asChild and a Button component, automatically adds an ArrowHorizontalDown icon.\n * Button components should use design=\"outlined\" and intent=\"support\".\n */\nexport const MenuTrigger = ({\n asChild = false,\n children,\n className,\n ref,\n ...rest\n}: MenuTriggerProps) => {\n // When asChild is used with a Button, enhance it with the arrow icon\n const enhancedChildren =\n asChild && isValidElement(children)\n ? cloneElement(\n children as ReactElement,\n {\n design: (children.props as { design?: string }).design ?? 'outlined',\n intent: (children.props as { intent?: string }).intent ?? 'support',\n children: (\n <>\n {(children.props as { children: React.ReactNode }).children}\n <Icon size=\"sm\" intent=\"current\" className=\"shrink-0\">\n <ArrowHorizontalDown />\n </Icon>\n </>\n ),\n } as Partial<unknown>\n )\n : children\n\n const { renderProp, innerChildren } = createRenderSlot(asChild, enhancedChildren)\n\n return (\n <BaseMenu.Trigger\n ref={ref}\n data-spark-component=\"menu-trigger\"\n render={renderProp}\n className={cx(\n 'inline-flex items-center justify-center',\n 'focus-visible:u-outline',\n className\n )}\n {...rest}\n >\n {innerChildren}\n </BaseMenu.Trigger>\n )\n}\n\nMenuTrigger.displayName = 'Menu.Trigger'\n","import { Menu as Root } from './Menu'\nimport { MenuCheckboxItem } from './MenuCheckboxItem'\nimport { MenuGroup } from './MenuGroup'\nimport { MenuGroupLabel } from './MenuGroupLabel'\nimport { MenuItem } from './MenuItem'\nimport { MenuLinkItem } from './MenuLinkItem'\nimport { MenuPopup } from './MenuPopup'\nimport { MenuPortal } from './MenuPortal'\nimport { MenuPositioner } from './MenuPositioner'\nimport { MenuRadioGroup } from './MenuRadioGroup'\nimport { MenuRadioItem } from './MenuRadioItem'\nimport { MenuSeparator } from './MenuSeparator'\nimport { MenuSubmenu } from './MenuSubmenu'\nimport { MenuSubmenuTrigger } from './MenuSubmenuTrigger'\nimport { MenuTrigger } from './MenuTrigger'\n\n/**\n * A menu component that enables users to select options from a dropdown menu triggered by a button or other interactive element.\n */\nexport const Menu: typeof Root & {\n Trigger: typeof MenuTrigger\n Portal: typeof MenuPortal\n Positioner: typeof MenuPositioner\n Popup: typeof MenuPopup\n Item: typeof MenuItem\n LinkItem: typeof MenuLinkItem\n Submenu: typeof MenuSubmenu\n SubmenuTrigger: typeof MenuSubmenuTrigger\n Group: typeof MenuGroup\n GroupLabel: typeof MenuGroupLabel\n RadioGroup: typeof MenuRadioGroup\n RadioItem: typeof MenuRadioItem\n CheckboxItem: typeof MenuCheckboxItem\n Separator: typeof MenuSeparator\n} = Object.assign(Root, {\n Trigger: MenuTrigger,\n Portal: MenuPortal,\n Positioner: MenuPositioner,\n Popup: MenuPopup,\n Item: MenuItem,\n LinkItem: MenuLinkItem,\n Submenu: MenuSubmenu,\n SubmenuTrigger: MenuSubmenuTrigger,\n Group: MenuGroup,\n GroupLabel: MenuGroupLabel,\n RadioGroup: MenuRadioGroup,\n RadioItem: MenuRadioItem,\n CheckboxItem: MenuCheckboxItem,\n Separator: MenuSeparator,\n})\n\nMenu.displayName = 'Menu'\nMenuTrigger.displayName = 'Menu.Trigger'\nMenuPortal.displayName = 'Menu.Portal'\nMenuPositioner.displayName = 'Menu.Positioner'\nMenuPopup.displayName = 'Menu.Popup'\nMenuItem.displayName = 'Menu.Item'\nMenuLinkItem.displayName = 'Menu.LinkItem'\nMenuSubmenu.displayName = 'Menu.Submenu'\nMenuSubmenuTrigger.displayName = 'Menu.SubmenuTrigger'\nMenuGroup.displayName = 'Menu.Group'\nMenuGroupLabel.displayName = 'Menu.GroupLabel'\nMenuRadioGroup.displayName = 'Menu.RadioGroup'\nMenuRadioItem.displayName = 'Menu.RadioItem'\nMenuCheckboxItem.displayName = 'Menu.CheckboxItem'\nMenuSeparator.displayName = 'Menu.Separator'\n\nexport { type MenuProps } from './Menu'\nexport { type MenuTriggerProps } from './MenuTrigger'\nexport { type MenuPortalProps } from './MenuPortal'\nexport { type MenuPositionerProps } from './MenuPositioner'\nexport { type MenuPopupProps } from './MenuPopup'\nexport { type MenuItemProps } from './MenuItem'\nexport { type MenuLinkItemProps } from './MenuLinkItem'\nexport { type MenuSubmenuProps } from './MenuSubmenu'\nexport { type MenuSubmenuTriggerProps } from './MenuSubmenuTrigger'\nexport { type MenuGroupProps } from './MenuGroup'\nexport { type MenuGroupLabelProps } from './MenuGroupLabel'\nexport { type MenuRadioGroupProps } from './MenuRadioGroup'\nexport { type MenuRadioItemProps } from './MenuRadioItem'\nexport { type MenuCheckboxItemProps } from './MenuCheckboxItem'\nexport { type MenuSeparatorProps } from './MenuSeparator'\n"],"mappings":";;;;;;;;;;;AAaA,IAAa,KAAQ,EAAE,aAAU,GAAG,QAEhC,kBAAC,EAAS,MAAV;CAAe,wBAAqB;CAAO,GAAI;CAC5C;AACY,CAAA;AAInB,EAAK,cAAc;;;AClBnB,IAAa,IAAiB,EAC5B;CACE;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACA;CACE,UAAU,EACR,QAAQ,EAGN;EACA,SAAS,CAAC,iBAAiB;EAC3B,MAAM,CAAC,iBAAiB;EACxB,SAAS,CAAC,iBAAiB;EAC3B,QAAQ,CAAC,iBAAiB;EAC1B,SAAS,CAAC,iBAAiB;EAC3B,OAAO,CAAC,iBAAiB;EACzB,QAAQ,CAAC,iBAAiB;EAC1B,MAAM,CAAC,iBAAiB;EACxB,SAAS,CAAC,iBAAiB;CAC7B,CAAC,EACH;CACA,iBAAiB,EACf,QAAQ,UACV;AACF,CACF,GCVa,KAAoB,EAC/B,aAAU,IACV,aACA,cACA,QACA,GAAG,QACwB;CAC3B,IAAM,EAAE,eAAY,qBAAkB,EAAiB,GAAS,CAAQ;CAExE,OACE,kBAAC,EAAS,cAAV;EACO;EACL,wBAAqB;EACrB,QAAQ;EACR,WAAW,EACT,EAAe,EACb,aACF,CAAC,GACD,wBACF;EACA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,CAAsB,CAAA;EAClB,CAAA,CACN,EAAA,CAAA;CAEN,CACF,IACA,CAE0E;CAEhF,OACE,kBAAC,EAAS,SAAV;EACO;EACL,wBAAqB;EACrB,QAAQ;EACR,WAAW,EACT,2CACA,2BACA,CACF;EACA,GAAI;YAEH;CACe,CAAA;AAEtB;AAEA,EAAY,cAAc;;;ACzD1B,IAAa,IAeT,OAAO,OAAO,GAAM;CACtB,SAAS;CACT,QAAQ;CACR,YAAY;CACZ,OAAO;CACP,MAAM;CACN,UAAU;CACV,SAAS;CACT,gBAAgB;CAChB,OAAO;CACP,YAAY;CACZ,YAAY;CACZ,WAAW;CACX,cAAc;CACd,WAAW;AACb,CAAC;AAED,EAAK,cAAc,QACnB,EAAY,cAAc,gBAC1B,EAAW,cAAc,eACzB,EAAe,cAAc,mBAC7B,EAAU,cAAc,cACxB,EAAS,cAAc,aACvB,EAAa,cAAc,iBAC3B,EAAY,cAAc,gBAC1B,EAAmB,cAAc,uBACjC,EAAU,cAAc,cACxB,EAAe,cAAc,mBAC7B,EAAe,cAAc,mBAC7B,EAAc,cAAc,kBAC5B,EAAiB,cAAc,qBAC/B,EAAc,cAAc"}
|
|
@@ -2,7 +2,7 @@ import { VariantProps } from 'class-variance-authority';
|
|
|
2
2
|
export declare const meterTrackStyles: (props?: import('class-variance-authority/types').ClassProp | undefined) => string;
|
|
3
3
|
export type MeterTrackStylesProps = VariantProps<typeof meterTrackStyles>;
|
|
4
4
|
export declare const meterIndicatorStyles: (props?: ({
|
|
5
|
-
intent?: "main" | "
|
|
5
|
+
intent?: "main" | "support" | "alert" | "success" | "info" | "danger" | null | undefined;
|
|
6
6
|
shape?: "square" | "rounded" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
export type MeterIndicatorStylesProps = VariantProps<typeof meterIndicatorStyles>;
|
package/dist/pagination/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-CMqjfN_6.js"),t=require("../icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-CMqjfN_6.js"),t=require("../icon-CfEsla9z.js"),n=require("../button-3vvMrf1L.js"),r=require("../icon-button-B2TM0Xby.js");let i=require("class-variance-authority"),a=require("react"),o=require("react/jsx-runtime"),s=require("@spark-ui/icons/ArrowVerticalRight"),c=require("@spark-ui/icons/ArrowVerticalLeft"),l=require("@zag-js/pagination");l=e.t(l);let u=require("@zag-js/react"),d=require("@spark-ui/icons/ArrowDoubleLeft"),f=require("@spark-ui/icons/ArrowDoubleRight");function p(e,t,n){let r=(n-1)/2,i=Math.max(0,t-r),a=Math.min(e.length,t+r+1);return a-i<n&&(i=Math.max(0,Math.min(i,e.length-n)),a=Math.min(e.length,i+n)),e.slice(i,a)}var m=(0,a.createContext)(null),h=({children:e,count:t,visiblePageItems:n=7,pageSize:r,page:i,onPageChange:s,noEllipsis:c,type:d=`link`})=>{let f=c?1/0:Math.max(0,Math.floor((n-5)/2)),h=(0,a.useId)(),g=(0,u.useMachine)(l.machine,{id:h,count:t,siblingCount:f,pageSize:r,page:i,onPageChange:s,type:d}),_=l.connect(g,u.normalizeProps),v=c?p(_.pages,_.page-1,n):_.pages;return(0,o.jsx)(m,{value:{type:d,pagination:{..._,pages:v,getFirstPageTriggerProps:()=>({..._.getPrevTriggerProps(),id:`${_.getRootProps().id}:first`,"data-part":`first-page-trigger`,onClick:_.goToFirstPage}),getLastPageTriggerProps:()=>({..._.getNextTriggerProps(),id:`${_.getRootProps().id}:last`,"data-part":`last-page-trigger`,onClick:_.goToLastPage})}},children:e})},g=()=>{let e=(0,a.useContext)(m);if(!e)throw Error(`usePagination must be used within a Pagination provider`);return e},_=({children:e,visiblePageItems:t=5,type:n=`link`,noEllipsis:r=!1,className:i,...a})=>(0,o.jsx)(h,{visiblePageItems:t,noEllipsis:r,type:n,...a,children:(0,o.jsx)(v,{className:i,children:e})}),v=({children:e,className:t})=>{let{pagination:n}=g();return(0,o.jsx)(`nav`,{"data-spark-component":`pagination`,...n.getRootProps(),className:t,children:(0,o.jsx)(`ul`,{className:`gap-md flex flex-wrap`,children:e})})};_.displayName=`Pagination`;var y=({children:e,index:t,className:n,ref:r,...a})=>{let{pagination:s}=g();return(0,o.jsx)(`li`,{children:(0,o.jsx)(`span`,{"data-spark-component":`pagination-ellipsis`,ref:r,...(0,u.mergeProps)(s.getEllipsisProps({index:t}),{className:(0,i.cx)(`flex size-sz-44 items-center justify-center`,n),...a}),children:e||`…`})})};y.displayName=`Pagination.Ellipsis`;var b=({children:e,className:n,href:i,ref:a,...s})=>{let{pagination:c,type:l}=g(),f=c.getFirstPageTriggerProps(),p=l===`link`&&f[`data-disabled`]===``,m=(0,u.mergeProps)(f,{"data-spark-component":`pagination-first-page-trigger`,intent:`support`,design:`contrast`,...s,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(d.ArrowDoubleLeft,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};b.displayName=`Pagination.FirstPageTrigger`;function x({children:e,value:t,className:r,href:a,ref:s,...c}){let{pagination:l}=g(),d=l.getItemProps({type:`page`,value:t}),f=(0,u.mergeProps)(d,{"data-spark-component":`pagination-item`,intent:`support`,design:d[`aria-current`]===`page`?`filled`:`contrast`,className:(0,i.cx)(`size-sz-44`,r),...c});return(0,o.jsx)(`li`,{children:a?(0,o.jsx)(n.t,{ref:s,...f,asChild:!0,children:(0,o.jsx)(`a`,{href:a,children:e||t})}):(0,o.jsx)(n.t,{ref:s,...f,children:e||t})})}x.displayName=`Pagination.Item`;var S=({children:e,className:n,href:i,ref:a,...s})=>{let{pagination:c,type:l}=g(),d=c.getLastPageTriggerProps(),p=l===`link`&&d[`data-disabled`]===``,m=(0,u.mergeProps)(d,{"data-spark-component":`pagination-last-page-trigger`,intent:`support`,design:`contrast`,...s,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(f.ArrowDoubleRight,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};S.displayName=`Pagination.LastPageTrigger`;var C=({children:e,className:n,href:i,ref:a,...c})=>{let{pagination:l,type:d}=g(),f=l.getNextTriggerProps(),p=d===`link`&&f[`data-disabled`]===``,m=(0,u.mergeProps)(f,{"data-spark-component":`pagination-next-trigger`,intent:`support`,design:`contrast`,...c,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(s.ArrowVerticalRight,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};C.displayName=`Pagination.NextTrigger`;var w=({children:e})=>{let{pagination:t}=g();return e(t)};w.displayName=`Pagination.Pages`;var T=({children:e,className:n,href:i,ref:a,...s})=>{let{pagination:l,type:d}=g(),f=l.getPrevTriggerProps(),p=d===`link`&&f[`data-disabled`]===``,m=(0,u.mergeProps)(f,{"data-spark-component":`pagination-prev-trigger`,intent:`support`,design:`contrast`,...s,className:n,...p&&{disabled:!0,role:`link`,"aria-disabled":!0}}),h=e||(0,o.jsx)(t.t,{children:(0,o.jsx)(c.ArrowVerticalLeft,{})});return(0,o.jsx)(`li`,{children:i?(0,o.jsx)(r.t,{ref:a,...m,asChild:!0,children:(0,o.jsx)(`a`,{href:p?void 0:i,children:h})}):(0,o.jsx)(r.t,{ref:a,...m,children:h})})};T.displayName=`Pagination.PrevTrigger`;var E=Object.assign(_,{PrevTrigger:T,NextTrigger:C,Pages:w,Item:x,Ellipsis:y,FirstPageTrigger:b,LastPageTrigger:S});E.displayName=`Pagination`,T.displayName=`Pagination.PrevTrigger`,C.displayName=`Pagination.NextTrigger`,w.displayName=`Pagination.Pages`,x.displayName=`Pagination.Item`,y.displayName=`Pagination.Ellipsis`,b.displayName=`Pagination.FirstPageTrigger`,S.displayName=`Pagination.LastPageTrigger`,exports.Pagination=E;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as e } from "../icon-
|
|
2
|
-
import { t } from "../button-
|
|
3
|
-
import { t as n } from "../icon-button-
|
|
1
|
+
import { t as e } from "../icon-VM_Ys9Xn.mjs";
|
|
2
|
+
import { t } from "../button-DBNjh3Bi.mjs";
|
|
3
|
+
import { t as n } from "../icon-button-CexCkoV0.mjs";
|
|
4
4
|
import { cx as r } from "class-variance-authority";
|
|
5
5
|
import { createContext as i, useContext as a, useId as o } from "react";
|
|
6
6
|
import { jsx as s } from "react/jsx-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const styles: (props?: ({
|
|
3
|
-
intent?: "main" | "
|
|
3
|
+
intent?: "main" | "surface" | "support" | "alert" | "accent" | "success" | "info" | "neutral" | "danger" | null | undefined;
|
|
4
4
|
matchTriggerWidth?: boolean | null | undefined;
|
|
5
5
|
enforceBoundaries?: boolean | null | undefined;
|
|
6
6
|
inset?: boolean | null | undefined;
|
package/dist/popover/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../popover-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../popover-B-mcHcLF.js");exports.Popover=e.t;
|
package/dist/popover/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../popover-
|
|
1
|
+
import { t as e } from "../popover-COqbFikI.mjs";
|
|
2
2
|
export { e as Popover };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e=require("./icon-
|
|
2
|
-
//# sourceMappingURL=popover-
|
|
1
|
+
const e=require("./icon-CfEsla9z.js"),t=require("./icon-button-B2TM0Xby.js");let n=require("class-variance-authority"),r=require("react"),i=require("react/jsx-runtime"),a=require("radix-ui"),o=require("@spark-ui/icons/Close");var s=(0,r.createContext)(null),c=`:popover`,l=({children:e,intent:t})=>{let[n,a]=(0,r.useState)(null);return(0,i.jsx)(s,{value:{headerId:n,setHeaderId:a,intent:t},children:e})},u=()=>{let e=(0,r.useContext)(s);if(!e)throw Error(`usePopover must be used within a Popover provider`);return e},d=({children:e,intent:t=`surface`,modal:n=!1,...r})=>(0,i.jsx)(l,{intent:t,children:(0,i.jsx)(a.Popover.Root,{"data-spark-component":`popover`,modal:n,...r,children:e})});d.displayName=`Popover`;var f=({asChild:e=!1,children:t,ref:n,...r})=>(0,i.jsx)(a.Popover.Anchor,{"data-spark-component":`popover-anchor`,ref:n,asChild:e,...r,children:t});f.displayName=`Popover.Anchor`;var p=({asChild:e=!1,width:t=16,height:r=8,className:o,ref:s,...c})=>{let{intent:l}=u(),d=(0,n.cva)(`visible`,{variants:{intent:{surface:`fill-surface`,main:`fill-main-container`,support:`fill-support-container`,accent:`fill-accent-container`,success:`fill-success-container`,alert:`fill-alert-container`,danger:`fill-error-container`,info:`fill-info-container`,neutral:`fill-neutral-container`}},defaultVariants:{intent:`surface`}});return(0,i.jsx)(a.Popover.Arrow,{"data-spark-component":`popover-arrow`,ref:s,className:d({intent:l,className:o}),asChild:e,width:t,height:r,...c})};p.displayName=`Popover.Arrow`;var m=({"aria-label":r,className:s,ref:c,...l})=>(0,i.jsx)(a.Popover.Close,{"data-spark-component":`popover-close-button`,ref:c,className:(0,n.cx)(`right-lg top-md absolute`,s),asChild:!0,...l,children:(0,i.jsx)(t.t,{size:`sm`,intent:`neutral`,design:`ghost`,"aria-label":r,children:(0,i.jsx)(e.t,{children:(0,i.jsx)(o.Close,{})})})});m.displayName=`Popover.CloseButton`;var h=(0,n.cva)([`rounded-md`,`shadow-sm`,`focus-visible:outline-hidden focus-visible:u-outline`,`max-h-(--radix-popper-available-height) overflow-y-auto`],{variants:{intent:{surface:`bg-surface text-on-surface`,main:`bg-main-container text-on-main-container`,support:`bg-support-container text-on-support-container`,accent:`bg-accent-container text-on-accent-container`,success:`bg-success-container text-on-success-container`,alert:`bg-alert-container text-on-alert-container`,danger:`bg-error-container text-on-error-container`,info:`bg-info-container text-on-info-container`,neutral:`bg-neutral-container text-on-neutral-container`},matchTriggerWidth:{true:`w-(--radix-popper-anchor-width)`},enforceBoundaries:{true:[`max-w-(--radix-popper-available-width)`]},inset:{true:`overflow-hidden`,false:`p-lg`},elevation:{dropdown:`z-dropdown`,popover:`z-popover`}},compoundVariants:[{inset:!1,class:`has-data-[spark-component=popover-close-button]:pr-3xl`},{enforceBoundaries:!1,matchTriggerWidth:!1,class:`max-w-[min(var(--spacing-sz-384),100vw)]`}],defaultVariants:{matchTriggerWidth:!1,enforceBoundaries:!1,inset:!1,intent:`surface`,elevation:`popover`}}),g=({className:e,children:t,matchTriggerWidth:n=!1,align:r=`center`,arrowPadding:o=16,asChild:s=!1,avoidCollisions:c=!0,"aria-labelledby":l,collisionBoundary:d,collisionPadding:f=0,hideWhenDetached:p=!1,side:m=`bottom`,sideOffset:g=8,sticky:_=`partial`,inset:v=!1,elevation:y=`popover`,ref:b,...x})=>{let{headerId:S,intent:C}=u();return(0,i.jsx)(a.Popover.Content,{"aria-labelledby":S||l,className:h({enforceBoundaries:!!d,matchTriggerWidth:n,inset:v,elevation:y,intent:C,className:e}),"data-spark-component":`popover-content`,ref:b,align:r,arrowPadding:o,asChild:s,avoidCollisions:c,collisionBoundary:d,collisionPadding:f,hideWhenDetached:p,side:m,sideOffset:g,sticky:_,...x,children:t})};g.displayName=`Popover.Content`;var _=({children:e,className:t,ref:a,...o})=>{let s=`${c}-header-${(0,r.useId)()}`,{setHeaderId:l}=u();return(0,r.useLayoutEffect)(()=>(l(s),()=>l(null)),[s,l]),(0,i.jsx)(`header`,{id:s,ref:a,className:(0,n.cx)(`mb-md text-headline-2`,t),...o,children:e})};_.displayName=`Popover.Header`;var v=({children:e,...t})=>(0,i.jsx)(a.Popover.Portal,{...t,children:e});v.displayName=`Popover.Portal`;var y=({asChild:e=!1,children:t,ref:n,...r})=>(0,i.jsx)(a.Popover.Trigger,{"data-spark-component":`popover-trigger`,ref:n,asChild:e,...r,children:t});y.displayName=`Popover.Trigger`;var b=Object.assign(d,{Anchor:f,Arrow:p,CloseButton:m,Content:g,Header:_,Portal:v,Trigger:y});b.displayName=`Popover`,f.displayName=`Popover.Anchor`,p.displayName=`Popover.Arrow`,m.displayName=`Popover.CloseButton`,g.displayName=`Popover.Content`,_.displayName=`Popover.Header`,v.displayName=`Popover.Portal`,y.displayName=`Popover.Trigger`,Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return b}});
|
|
2
|
+
//# sourceMappingURL=popover-B-mcHcLF.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-DVz0JvON.js","names":[],"sources":["../src/popover/PopoverContext.tsx","../src/popover/Popover.tsx","../src/popover/PopoverAnchor.tsx","../src/popover/PopoverArrow.tsx","../src/popover/PopoverCloseButton.tsx","../src/popover/PopoverContent.styles.ts","../src/popover/PopoverContent.tsx","../src/popover/PopoverHeader.tsx","../src/popover/PopoverPortal.tsx","../src/popover/PopoverTrigger.tsx","../src/popover/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from 'react'\n\ntype HeaderId = string | null\n\nexport type PopoverIntent =\n | 'surface'\n | 'main'\n | 'support'\n | 'accent'\n | 'success'\n | 'alert'\n | 'danger'\n | 'info'\n | 'neutral'\nexport interface PopoverContextState {\n headerId: HeaderId\n setHeaderId: (id: HeaderId) => void\n intent: PopoverIntent\n}\n\nconst PopoverContext = createContext<PopoverContextState | null>(null)\n\nexport const ID_PREFIX = ':popover'\n\nexport const PopoverProvider = ({\n children,\n intent,\n}: {\n children: ReactNode\n intent: PopoverIntent\n}) => {\n const [headerId, setHeaderId] = useState<HeaderId>(null)\n\n return (\n <PopoverContext\n value={{\n headerId,\n setHeaderId,\n intent,\n }}\n >\n {children}\n </PopoverContext>\n )\n}\n\nexport const usePopover = () => {\n const context = useContext(PopoverContext)\n\n if (!context) {\n throw Error('usePopover must be used within a Popover provider')\n }\n\n return context\n}\n","import { Popover as RadixPopover } from 'radix-ui'\n\nimport { type PopoverIntent, PopoverProvider } from './PopoverContext'\n\nexport type PopoverProps = RadixPopover.PopoverProps & {\n intent?: PopoverIntent\n}\n\nexport const Popover = ({ children, intent = 'surface', modal = false, ...rest }: PopoverProps) => {\n return (\n <PopoverProvider intent={intent}>\n <RadixPopover.Root data-spark-component=\"popover\" modal={modal} {...rest}>\n {children}\n </RadixPopover.Root>\n </PopoverProvider>\n )\n}\n\nPopover.displayName = 'Popover'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type AnchorProps = RadixPopover.PopoverAnchorProps & {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The anchor element for positioning the popover. Renders a <div> element.\n */\n\nexport const Anchor = ({ asChild = false, children, ref, ...rest }: AnchorProps) => (\n <RadixPopover.Anchor data-spark-component=\"popover-anchor\" ref={ref} asChild={asChild} {...rest}>\n {children}\n </RadixPopover.Anchor>\n)\n\nAnchor.displayName = 'Popover.Anchor'\n","import { cva } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { usePopover } from './PopoverContext'\n\nexport type ArrowProps = RadixPopover.PopoverArrowProps & {\n ref?: Ref<SVGSVGElement>\n}\n\n/**\n * An arrow pointing to the anchor element. Renders an <svg> element.\n */\n\nexport const Arrow = ({\n asChild = false,\n width = 16,\n height = 8,\n className,\n ref,\n ...rest\n}: ArrowProps) => {\n const { intent } = usePopover()\n\n /**\n * This is necessary to override a Radix UI behaviour.\n * Radix hides the arrow when the Popover is too misaligned from its trigger element.\n */\n const styles = cva('visible', {\n variants: {\n intent: {\n surface: 'fill-surface',\n main: 'fill-main-container',\n support: 'fill-support-container',\n accent: 'fill-accent-container',\n success: 'fill-success-container',\n alert: 'fill-alert-container',\n danger: 'fill-error-container',\n info: 'fill-info-container',\n neutral: 'fill-neutral-container',\n },\n },\n defaultVariants: {\n intent: 'surface',\n },\n })\n\n return (\n <RadixPopover.Arrow\n data-spark-component=\"popover-arrow\"\n ref={ref}\n className={styles({ intent, className })}\n asChild={asChild}\n width={width}\n height={height}\n {...rest}\n />\n )\n}\n\nArrow.displayName = 'Popover.Arrow'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\n\nexport type CloseButtonProps = RadixPopover.PopoverCloseProps & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the popover. Renders a <button> element.\n */\n\nexport const CloseButton = ({\n 'aria-label': ariaLabel,\n className,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <RadixPopover.Close\n data-spark-component=\"popover-close-button\"\n ref={ref}\n className={cx('right-lg top-md absolute', className)}\n asChild\n {...rest}\n >\n <IconButton size=\"sm\" intent=\"neutral\" design=\"ghost\" aria-label={ariaLabel}>\n <Icon>\n <CloseSVG />\n </Icon>\n </IconButton>\n </RadixPopover.Close>\n )\n}\n\nCloseButton.displayName = 'Popover.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'rounded-md',\n 'shadow-sm',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n 'max-h-(--radix-popper-available-height) overflow-y-auto',\n ],\n {\n variants: {\n intent: {\n surface: 'bg-surface text-on-surface',\n main: 'bg-main-container text-on-main-container',\n support: 'bg-support-container text-on-support-container',\n accent: 'bg-accent-container text-on-accent-container',\n success: 'bg-success-container text-on-success-container',\n alert: 'bg-alert-container text-on-alert-container',\n danger: 'bg-error-container text-on-error-container',\n info: 'bg-info-container text-on-info-container',\n neutral: 'bg-neutral-container text-on-neutral-container',\n },\n matchTriggerWidth: {\n true: 'w-(--radix-popper-anchor-width)',\n },\n enforceBoundaries: {\n true: ['max-w-(--radix-popper-available-width)'],\n },\n\n inset: {\n true: 'overflow-hidden',\n false: 'p-lg',\n },\n elevation: {\n dropdown: 'z-dropdown',\n popover: 'z-popover',\n },\n },\n compoundVariants: [\n {\n inset: false,\n /**\n * When there is a close button, padding to the right side must be adjusted to avoid content overlapping with it.\n */\n class: 'has-data-[spark-component=popover-close-button]:pr-3xl',\n },\n {\n enforceBoundaries: false,\n matchTriggerWidth: false,\n class: 'max-w-[min(var(--spacing-sz-384),100vw)]',\n },\n ],\n defaultVariants: {\n matchTriggerWidth: false,\n enforceBoundaries: false,\n inset: false,\n intent: 'surface',\n elevation: 'popover',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { styles, type StylesProps } from './PopoverContent.styles'\nimport { usePopover } from './PopoverContext'\n\nexport type ContentProps = RadixPopover.PopoverContentProps &\n StylesProps & {\n ref?: Ref<HTMLDivElement>\n }\n\n/**\n * The popup element containing popover content. Renders a <div> element.\n */\n\nexport const Content = ({\n // Spark props\n className,\n children,\n matchTriggerWidth = false,\n // Radix props\n align = 'center',\n arrowPadding = 16, // In order not to overlap the arrow on the rounded corners of the popover.\n asChild = false,\n avoidCollisions = true,\n 'aria-labelledby': ariaLabelledBy,\n collisionBoundary,\n collisionPadding = 0,\n hideWhenDetached = false,\n side = 'bottom',\n sideOffset = 8,\n sticky = 'partial',\n inset = false,\n elevation = 'popover',\n ref,\n ...rest\n}: ContentProps) => {\n const { headerId, intent } = usePopover()\n\n return (\n <RadixPopover.Content\n aria-labelledby={headerId || ariaLabelledBy}\n className={styles({\n enforceBoundaries: !!collisionBoundary,\n matchTriggerWidth,\n inset,\n elevation,\n intent,\n className,\n })}\n data-spark-component=\"popover-content\"\n ref={ref}\n {...{\n align,\n arrowPadding,\n asChild,\n avoidCollisions,\n collisionBoundary,\n collisionPadding,\n hideWhenDetached,\n side,\n sideOffset,\n sticky,\n }}\n {...rest}\n >\n {children}\n </RadixPopover.Content>\n )\n}\n\nContent.displayName = 'Popover.Content'\n","import { cx } from 'class-variance-authority'\nimport { type ReactNode, Ref, useId, useLayoutEffect } from 'react'\n\nimport { ID_PREFIX, usePopover } from './PopoverContext'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the popover. Renders a <header> element.\n */\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps) => {\n const id = `${ID_PREFIX}-header-${useId()}`\n const { setHeaderId } = usePopover()\n\n useLayoutEffect(() => {\n setHeaderId(id)\n\n return () => setHeaderId(null)\n }, [id, setHeaderId])\n\n return (\n <header id={id} ref={ref} className={cx('mb-md text-headline-2', className)} {...rest}>\n {children}\n </header>\n )\n}\n\nHeader.displayName = 'Popover.Header'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { ReactElement } from 'react'\n\nexport type PortalProps = RadixPopover.PopoverPortalProps\n\n/**\n * A portal that renders the popover in a different part of the DOM. Renders a <div> element.\n */\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixPopover.Portal {...rest}>{children}</RadixPopover.Portal>\n)\n\nPortal.displayName = 'Popover.Portal'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TriggerProps = RadixPopover.PopoverTriggerProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the popover. Renders a <button> element.\n */\n\nexport const Trigger = ({ asChild = false, children, ref, ...rest }: TriggerProps) => (\n <RadixPopover.Trigger\n data-spark-component=\"popover-trigger\"\n ref={ref}\n asChild={asChild}\n {...rest}\n >\n {children}\n </RadixPopover.Trigger>\n)\n\nTrigger.displayName = 'Popover.Trigger'\n","import { Popover as Root } from './Popover'\nimport { Anchor } from './PopoverAnchor'\nimport { Arrow } from './PopoverArrow'\nimport { CloseButton } from './PopoverCloseButton'\nimport { Content } from './PopoverContent'\nimport { Header } from './PopoverHeader'\nimport { Portal } from './PopoverPortal'\nimport { Trigger } from './PopoverTrigger'\n\n/**\n * A floating container that displays additional content when triggered, positioned relative to its trigger element.\n */\nexport const Popover: typeof Root & {\n Anchor: typeof Anchor\n Arrow: typeof Arrow\n CloseButton: typeof CloseButton\n Content: typeof Content\n Header: typeof Header\n Portal: typeof Portal\n Trigger: typeof Trigger\n} = Object.assign(Root, {\n Anchor,\n Arrow,\n CloseButton,\n Content,\n Header,\n Portal,\n Trigger,\n})\n\nPopover.displayName = 'Popover'\nAnchor.displayName = 'Popover.Anchor'\nArrow.displayName = 'Popover.Arrow'\nCloseButton.displayName = 'Popover.CloseButton'\nContent.displayName = 'Popover.Content'\nHeader.displayName = 'Popover.Header'\nPortal.displayName = 'Popover.Portal'\nTrigger.displayName = 'Popover.Trigger'\n"],"mappings":"kOAoBA,IAAM,GAAA,EAAA,EAAA,cAAA,CAA2D,IAAI,EAExD,EAAY,WAEZ,GAAmB,CAC9B,WACA,YAII,CACJ,GAAM,CAAC,EAAU,IAAA,EAAA,EAAA,SAAA,CAAkC,IAAI,EAEvD,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,MAAO,CACL,WACA,cACA,QACF,EAEC,UACa,CAAA,CAEpB,EAEa,MAAmB,CAC9B,IAAM,GAAA,EAAA,EAAA,WAAA,CAAqB,CAAc,EAEzC,GAAI,CAAC,EACH,MAAM,MAAM,mDAAmD,EAGjE,OAAO,CACT,EC9Ca,GAAW,CAAE,WAAU,SAAS,UAAW,Q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U,CAAE,WAAU,YAAW,MAAK,GAAG,KAAwB,CAC5E,IAAM,EAAK,GAAG,EAAU,WAAA,EAAA,EAAA,MAAA,CAAgB,IAClC,CAAE,eAAgB,EAAW,EAQnC,OANA,EAAA,EAAA,gBAAA,MACE,EAAY,CAAE,MAED,EAAY,IAAI,GAC5B,CAAC,EAAI,CAAW,CAAC,GAGlB,EAAA,EAAA,IAAA,CAAC,SAAD,CAAY,KAAS,MAAK,WAAA,EAAA,EAAA,GAAA,CAAc,wBAAyB,CAAS,EAAG,GAAI,EAC9E,UACK,CAAA,CAEZ,EAEA,EAAO,YAAc,iBCvBrB,IAAa,GAAU,CAAE,WAAU,GAAG,MACpC,EAAA,EAAA,IAAA,CAAC,EAAA,QAAa,OAAd,CAAqB,GAAI,EAAO,UAA8B,CAAA,EAGhE,EAAO,YAAc,iBCFrB,IAAa,GAAW,CAAE,UAAU,GAAO,WAAU,MAAK,GAAG,MAC3D,EAAA,EAAA,IAAA,CAAC,EAAA,QAAa,QAAd,CACE,uBAAqB,kBAChB,MACI,UACT,GAAI,EAEH,UACmB,CAAA,EAGxB,EAAQ,YAAc,kBCVtB,IAAa,EAQT,OAAO,OAAO,EAAM,CACtB,SACA,QACA,cACA,UACA,SACA,SACA,SACF,CAAC,EAED,EAAQ,YAAc,UACtB,EAAO,YAAc,iBACrB,EAAM,YAAc,gBACpB,EAAY,YAAc,sBAC1B,EAAQ,YAAc,kBACtB,EAAO,YAAc,iBACrB,EAAO,YAAc,iBACrB,EAAQ,YAAc"}
|
|
1
|
+
{"version":3,"file":"popover-B-mcHcLF.js","names":[],"sources":["../src/popover/PopoverContext.tsx","../src/popover/Popover.tsx","../src/popover/PopoverAnchor.tsx","../src/popover/PopoverArrow.tsx","../src/popover/PopoverCloseButton.tsx","../src/popover/PopoverContent.styles.ts","../src/popover/PopoverContent.tsx","../src/popover/PopoverHeader.tsx","../src/popover/PopoverPortal.tsx","../src/popover/PopoverTrigger.tsx","../src/popover/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from 'react'\n\ntype HeaderId = string | null\n\nexport type PopoverIntent =\n | 'surface'\n | 'main'\n | 'support'\n | 'accent'\n | 'success'\n | 'alert'\n | 'danger'\n | 'info'\n | 'neutral'\nexport interface PopoverContextState {\n headerId: HeaderId\n setHeaderId: (id: HeaderId) => void\n intent: PopoverIntent\n}\n\nconst PopoverContext = createContext<PopoverContextState | null>(null)\n\nexport const ID_PREFIX = ':popover'\n\nexport const PopoverProvider = ({\n children,\n intent,\n}: {\n children: ReactNode\n intent: PopoverIntent\n}) => {\n const [headerId, setHeaderId] = useState<HeaderId>(null)\n\n return (\n <PopoverContext\n value={{\n headerId,\n setHeaderId,\n intent,\n }}\n >\n {children}\n </PopoverContext>\n )\n}\n\nexport const usePopover = () => {\n const context = useContext(PopoverContext)\n\n if (!context) {\n throw Error('usePopover must be used within a Popover provider')\n }\n\n return context\n}\n","import { Popover as RadixPopover } from 'radix-ui'\n\nimport { type PopoverIntent, PopoverProvider } from './PopoverContext'\n\nexport type PopoverProps = RadixPopover.PopoverProps & {\n intent?: PopoverIntent\n}\n\nexport const Popover = ({ children, intent = 'surface', modal = false, ...rest }: PopoverProps) => {\n return (\n <PopoverProvider intent={intent}>\n <RadixPopover.Root data-spark-component=\"popover\" modal={modal} {...rest}>\n {children}\n </RadixPopover.Root>\n </PopoverProvider>\n )\n}\n\nPopover.displayName = 'Popover'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type AnchorProps = RadixPopover.PopoverAnchorProps & {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The anchor element for positioning the popover. Renders a <div> element.\n */\n\nexport const Anchor = ({ asChild = false, children, ref, ...rest }: AnchorProps) => (\n <RadixPopover.Anchor data-spark-component=\"popover-anchor\" ref={ref} asChild={asChild} {...rest}>\n {children}\n </RadixPopover.Anchor>\n)\n\nAnchor.displayName = 'Popover.Anchor'\n","import { cva } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { usePopover } from './PopoverContext'\n\nexport type ArrowProps = RadixPopover.PopoverArrowProps & {\n ref?: Ref<SVGSVGElement>\n}\n\n/**\n * An arrow pointing to the anchor element. Renders an <svg> element.\n */\n\nexport const Arrow = ({\n asChild = false,\n width = 16,\n height = 8,\n className,\n ref,\n ...rest\n}: ArrowProps) => {\n const { intent } = usePopover()\n\n /**\n * This is necessary to override a Radix UI behaviour.\n * Radix hides the arrow when the Popover is too misaligned from its trigger element.\n */\n const styles = cva('visible', {\n variants: {\n intent: {\n surface: 'fill-surface',\n main: 'fill-main-container',\n support: 'fill-support-container',\n accent: 'fill-accent-container',\n success: 'fill-success-container',\n alert: 'fill-alert-container',\n danger: 'fill-error-container',\n info: 'fill-info-container',\n neutral: 'fill-neutral-container',\n },\n },\n defaultVariants: {\n intent: 'surface',\n },\n })\n\n return (\n <RadixPopover.Arrow\n data-spark-component=\"popover-arrow\"\n ref={ref}\n className={styles({ intent, className })}\n asChild={asChild}\n width={width}\n height={height}\n {...rest}\n />\n )\n}\n\nArrow.displayName = 'Popover.Arrow'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\n\nexport type CloseButtonProps = RadixPopover.PopoverCloseProps & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the popover. Renders a <button> element.\n */\n\nexport const CloseButton = ({\n 'aria-label': ariaLabel,\n className,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <RadixPopover.Close\n data-spark-component=\"popover-close-button\"\n ref={ref}\n className={cx('right-lg top-md absolute', className)}\n asChild\n {...rest}\n >\n <IconButton size=\"sm\" intent=\"neutral\" design=\"ghost\" aria-label={ariaLabel}>\n <Icon>\n <CloseSVG />\n </Icon>\n </IconButton>\n </RadixPopover.Close>\n )\n}\n\nCloseButton.displayName = 'Popover.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'rounded-md',\n 'shadow-sm',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n 'max-h-(--radix-popper-available-height) overflow-y-auto',\n ],\n {\n variants: {\n intent: {\n surface: 'bg-surface text-on-surface',\n main: 'bg-main-container text-on-main-container',\n support: 'bg-support-container text-on-support-container',\n accent: 'bg-accent-container text-on-accent-container',\n success: 'bg-success-container text-on-success-container',\n alert: 'bg-alert-container text-on-alert-container',\n danger: 'bg-error-container text-on-error-container',\n info: 'bg-info-container text-on-info-container',\n neutral: 'bg-neutral-container text-on-neutral-container',\n },\n matchTriggerWidth: {\n true: 'w-(--radix-popper-anchor-width)',\n },\n enforceBoundaries: {\n true: ['max-w-(--radix-popper-available-width)'],\n },\n\n inset: {\n true: 'overflow-hidden',\n false: 'p-lg',\n },\n elevation: {\n dropdown: 'z-dropdown',\n popover: 'z-popover',\n },\n },\n compoundVariants: [\n {\n inset: false,\n /**\n * When there is a close button, padding to the right side must be adjusted to avoid content overlapping with it.\n */\n class: 'has-data-[spark-component=popover-close-button]:pr-3xl',\n },\n {\n enforceBoundaries: false,\n matchTriggerWidth: false,\n class: 'max-w-[min(var(--spacing-sz-384),100vw)]',\n },\n ],\n defaultVariants: {\n matchTriggerWidth: false,\n enforceBoundaries: false,\n inset: false,\n intent: 'surface',\n elevation: 'popover',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { styles, type StylesProps } from './PopoverContent.styles'\nimport { usePopover } from './PopoverContext'\n\nexport type ContentProps = RadixPopover.PopoverContentProps &\n StylesProps & {\n ref?: Ref<HTMLDivElement>\n }\n\n/**\n * The popup element containing popover content. Renders a <div> element.\n */\n\nexport const Content = ({\n // Spark props\n className,\n children,\n matchTriggerWidth = false,\n // Radix props\n align = 'center',\n arrowPadding = 16, // In order not to overlap the arrow on the rounded corners of the popover.\n asChild = false,\n avoidCollisions = true,\n 'aria-labelledby': ariaLabelledBy,\n collisionBoundary,\n collisionPadding = 0,\n hideWhenDetached = false,\n side = 'bottom',\n sideOffset = 8,\n sticky = 'partial',\n inset = false,\n elevation = 'popover',\n ref,\n ...rest\n}: ContentProps) => {\n const { headerId, intent } = usePopover()\n\n return (\n <RadixPopover.Content\n aria-labelledby={headerId || ariaLabelledBy}\n className={styles({\n enforceBoundaries: !!collisionBoundary,\n matchTriggerWidth,\n inset,\n elevation,\n intent,\n className,\n })}\n data-spark-component=\"popover-content\"\n ref={ref}\n {...{\n align,\n arrowPadding,\n asChild,\n avoidCollisions,\n collisionBoundary,\n collisionPadding,\n hideWhenDetached,\n side,\n sideOffset,\n sticky,\n }}\n {...rest}\n >\n {children}\n </RadixPopover.Content>\n )\n}\n\nContent.displayName = 'Popover.Content'\n","import { cx } from 'class-variance-authority'\nimport { type ReactNode, Ref, useId, useLayoutEffect } from 'react'\n\nimport { ID_PREFIX, usePopover } from './PopoverContext'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the popover. Renders a <header> element.\n */\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps) => {\n const id = `${ID_PREFIX}-header-${useId()}`\n const { setHeaderId } = usePopover()\n\n useLayoutEffect(() => {\n setHeaderId(id)\n\n return () => setHeaderId(null)\n }, [id, setHeaderId])\n\n return (\n <header id={id} ref={ref} className={cx('mb-md text-headline-2', className)} {...rest}>\n {children}\n </header>\n )\n}\n\nHeader.displayName = 'Popover.Header'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { ReactElement } from 'react'\n\nexport type PortalProps = RadixPopover.PopoverPortalProps\n\n/**\n * A portal that renders the popover in a different part of the DOM. Renders a <div> element.\n */\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixPopover.Portal {...rest}>{children}</RadixPopover.Portal>\n)\n\nPortal.displayName = 'Popover.Portal'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TriggerProps = RadixPopover.PopoverTriggerProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the popover. Renders a <button> element.\n */\n\nexport const Trigger = ({ asChild = false, children, ref, ...rest }: TriggerProps) => (\n <RadixPopover.Trigger\n data-spark-component=\"popover-trigger\"\n ref={ref}\n asChild={asChild}\n {...rest}\n >\n {children}\n </RadixPopover.Trigger>\n)\n\nTrigger.displayName = 'Popover.Trigger'\n","import { Popover as Root } from './Popover'\nimport { Anchor } from './PopoverAnchor'\nimport { Arrow } from './PopoverArrow'\nimport { CloseButton } from './PopoverCloseButton'\nimport { Content } from './PopoverContent'\nimport { Header } from './PopoverHeader'\nimport { Portal } from './PopoverPortal'\nimport { Trigger } from './PopoverTrigger'\n\n/**\n * A floating container that displays additional content when triggered, positioned relative to its trigger element.\n */\nexport const Popover: typeof Root & {\n Anchor: typeof Anchor\n Arrow: typeof Arrow\n CloseButton: typeof CloseButton\n Content: typeof Content\n Header: typeof Header\n Portal: typeof Portal\n Trigger: typeof Trigger\n} = Object.assign(Root, {\n Anchor,\n Arrow,\n CloseButton,\n Content,\n Header,\n Portal,\n Trigger,\n})\n\nPopover.displayName = 'Popover'\nAnchor.displayName = 'Popover.Anchor'\nArrow.displayName = 'Popover.Arrow'\nCloseButton.displayName = 'Popover.CloseButton'\nContent.displayName = 'Popover.Content'\nHeader.displayName = 'Popover.Header'\nPortal.displayName = 'Popover.Portal'\nTrigger.displayName = 'Popover.Trigger'\n"],"mappings":"kOAoBA,IAAM,GAAA,EAAA,EAAA,cAAA,CAA2D,IAAI,EAExD,EAAY,WAEZ,GAAmB,CAC9B,WACA,YAII,CACJ,GAAM,CAAC,EAAU,IAAA,EAAA,EAAA,SAAA,CAAkC,IAAI,EAEvD,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CACE,MAAO,CACL,WACA,c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
import { t as e } from "./icon-VM_Ys9Xn.mjs";
|
|
2
|
+
import { t } from "./icon-button-CexCkoV0.mjs";
|
|
3
3
|
import { cva as n, cx as r } from "class-variance-authority";
|
|
4
4
|
import { createContext as i, useContext as a, useId as o, useLayoutEffect as s, useState as c } from "react";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
6
|
+
import { Popover as u } from "radix-ui";
|
|
7
7
|
import { Close as d } from "@spark-ui/icons/Close";
|
|
8
8
|
//#region src/popover/PopoverContext.tsx
|
|
9
9
|
var f = i(null), p = ":popover", m = ({ children: e, intent: t }) => {
|
|
10
10
|
let [n, r] = c(null);
|
|
11
|
-
return /* @__PURE__ */
|
|
11
|
+
return /* @__PURE__ */ l(f, {
|
|
12
12
|
value: {
|
|
13
13
|
headerId: n,
|
|
14
14
|
setHeaderId: r,
|
|
@@ -20,9 +20,9 @@ var f = i(null), p = ":popover", m = ({ children: e, intent: t }) => {
|
|
|
20
20
|
let e = a(f);
|
|
21
21
|
if (!e) throw Error("usePopover must be used within a Popover provider");
|
|
22
22
|
return e;
|
|
23
|
-
}, g = ({ children: e, intent: t = "surface", modal: n = !1, ...r }) => /* @__PURE__ */
|
|
23
|
+
}, g = ({ children: e, intent: t = "surface", modal: n = !1, ...r }) => /* @__PURE__ */ l(m, {
|
|
24
24
|
intent: t,
|
|
25
|
-
children: /* @__PURE__ */ u
|
|
25
|
+
children: /* @__PURE__ */ l(u.Root, {
|
|
26
26
|
"data-spark-component": "popover",
|
|
27
27
|
modal: n,
|
|
28
28
|
...r,
|
|
@@ -32,7 +32,7 @@ var f = i(null), p = ":popover", m = ({ children: e, intent: t }) => {
|
|
|
32
32
|
g.displayName = "Popover";
|
|
33
33
|
//#endregion
|
|
34
34
|
//#region src/popover/PopoverAnchor.tsx
|
|
35
|
-
var _ = ({ asChild: e = !1, children: t, ref: n, ...r }) => /* @__PURE__ */ u
|
|
35
|
+
var _ = ({ asChild: e = !1, children: t, ref: n, ...r }) => /* @__PURE__ */ l(u.Anchor, {
|
|
36
36
|
"data-spark-component": "popover-anchor",
|
|
37
37
|
ref: n,
|
|
38
38
|
asChild: e,
|
|
@@ -57,7 +57,7 @@ var v = ({ asChild: e = !1, width: t = 16, height: r = 8, className: i, ref: a,
|
|
|
57
57
|
} },
|
|
58
58
|
defaultVariants: { intent: "surface" }
|
|
59
59
|
});
|
|
60
|
-
return /* @__PURE__ */ u
|
|
60
|
+
return /* @__PURE__ */ l(u.Arrow, {
|
|
61
61
|
"data-spark-component": "popover-arrow",
|
|
62
62
|
ref: a,
|
|
63
63
|
className: c({
|
|
@@ -73,18 +73,18 @@ var v = ({ asChild: e = !1, width: t = 16, height: r = 8, className: i, ref: a,
|
|
|
73
73
|
v.displayName = "Popover.Arrow";
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/popover/PopoverCloseButton.tsx
|
|
76
|
-
var y = ({ "aria-label": n, className: i, ref: a, ...o }) => /* @__PURE__ */ u
|
|
76
|
+
var y = ({ "aria-label": n, className: i, ref: a, ...o }) => /* @__PURE__ */ l(u.Close, {
|
|
77
77
|
"data-spark-component": "popover-close-button",
|
|
78
78
|
ref: a,
|
|
79
79
|
className: r("right-lg top-md absolute", i),
|
|
80
80
|
asChild: !0,
|
|
81
81
|
...o,
|
|
82
|
-
children: /* @__PURE__ */
|
|
82
|
+
children: /* @__PURE__ */ l(t, {
|
|
83
83
|
size: "sm",
|
|
84
84
|
intent: "neutral",
|
|
85
85
|
design: "ghost",
|
|
86
86
|
"aria-label": n,
|
|
87
|
-
children: /* @__PURE__ */
|
|
87
|
+
children: /* @__PURE__ */ l(e, { children: /* @__PURE__ */ l(d, {}) })
|
|
88
88
|
})
|
|
89
89
|
});
|
|
90
90
|
y.displayName = "Popover.CloseButton";
|
|
@@ -136,7 +136,7 @@ var b = n([
|
|
|
136
136
|
}
|
|
137
137
|
}), x = ({ className: e, children: t, matchTriggerWidth: n = !1, align: r = "center", arrowPadding: i = 16, asChild: a = !1, avoidCollisions: o = !0, "aria-labelledby": s, collisionBoundary: c, collisionPadding: d = 0, hideWhenDetached: f = !1, side: p = "bottom", sideOffset: m = 8, sticky: g = "partial", inset: _ = !1, elevation: v = "popover", ref: y, ...x }) => {
|
|
138
138
|
let { headerId: S, intent: C } = h();
|
|
139
|
-
return /* @__PURE__ */ u
|
|
139
|
+
return /* @__PURE__ */ l(u.Content, {
|
|
140
140
|
"aria-labelledby": S || s,
|
|
141
141
|
className: b({
|
|
142
142
|
enforceBoundaries: !!c,
|
|
@@ -167,7 +167,7 @@ x.displayName = "Popover.Content";
|
|
|
167
167
|
//#region src/popover/PopoverHeader.tsx
|
|
168
168
|
var S = ({ children: e, className: t, ref: n, ...i }) => {
|
|
169
169
|
let a = `${p}-header-${o()}`, { setHeaderId: c } = h();
|
|
170
|
-
return s(() => (c(a), () => c(null)), [a, c]), /* @__PURE__ */
|
|
170
|
+
return s(() => (c(a), () => c(null)), [a, c]), /* @__PURE__ */ l("header", {
|
|
171
171
|
id: a,
|
|
172
172
|
ref: n,
|
|
173
173
|
className: r("mb-md text-headline-2", t),
|
|
@@ -178,14 +178,14 @@ var S = ({ children: e, className: t, ref: n, ...i }) => {
|
|
|
178
178
|
S.displayName = "Popover.Header";
|
|
179
179
|
//#endregion
|
|
180
180
|
//#region src/popover/PopoverPortal.tsx
|
|
181
|
-
var C = ({ children: e, ...t }) => /* @__PURE__ */ u
|
|
181
|
+
var C = ({ children: e, ...t }) => /* @__PURE__ */ l(u.Portal, {
|
|
182
182
|
...t,
|
|
183
183
|
children: e
|
|
184
184
|
});
|
|
185
185
|
C.displayName = "Popover.Portal";
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/popover/PopoverTrigger.tsx
|
|
188
|
-
var w = ({ asChild: e = !1, children: t, ref: n, ...r }) => /* @__PURE__ */ u
|
|
188
|
+
var w = ({ asChild: e = !1, children: t, ref: n, ...r }) => /* @__PURE__ */ l(u.Trigger, {
|
|
189
189
|
"data-spark-component": "popover-trigger",
|
|
190
190
|
ref: n,
|
|
191
191
|
asChild: e,
|
|
@@ -208,4 +208,4 @@ T.displayName = "Popover", _.displayName = "Popover.Anchor", v.displayName = "Po
|
|
|
208
208
|
//#endregion
|
|
209
209
|
export { T as t };
|
|
210
210
|
|
|
211
|
-
//# sourceMappingURL=popover-
|
|
211
|
+
//# sourceMappingURL=popover-COqbFikI.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"popover-CGhSHQzb.mjs","names":[],"sources":["../src/popover/PopoverContext.tsx","../src/popover/Popover.tsx","../src/popover/PopoverAnchor.tsx","../src/popover/PopoverArrow.tsx","../src/popover/PopoverCloseButton.tsx","../src/popover/PopoverContent.styles.ts","../src/popover/PopoverContent.tsx","../src/popover/PopoverHeader.tsx","../src/popover/PopoverPortal.tsx","../src/popover/PopoverTrigger.tsx","../src/popover/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from 'react'\n\ntype HeaderId = string | null\n\nexport type PopoverIntent =\n | 'surface'\n | 'main'\n | 'support'\n | 'accent'\n | 'success'\n | 'alert'\n | 'danger'\n | 'info'\n | 'neutral'\nexport interface PopoverContextState {\n headerId: HeaderId\n setHeaderId: (id: HeaderId) => void\n intent: PopoverIntent\n}\n\nconst PopoverContext = createContext<PopoverContextState | null>(null)\n\nexport const ID_PREFIX = ':popover'\n\nexport const PopoverProvider = ({\n children,\n intent,\n}: {\n children: ReactNode\n intent: PopoverIntent\n}) => {\n const [headerId, setHeaderId] = useState<HeaderId>(null)\n\n return (\n <PopoverContext\n value={{\n headerId,\n setHeaderId,\n intent,\n }}\n >\n {children}\n </PopoverContext>\n )\n}\n\nexport const usePopover = () => {\n const context = useContext(PopoverContext)\n\n if (!context) {\n throw Error('usePopover must be used within a Popover provider')\n }\n\n return context\n}\n","import { Popover as RadixPopover } from 'radix-ui'\n\nimport { type PopoverIntent, PopoverProvider } from './PopoverContext'\n\nexport type PopoverProps = RadixPopover.PopoverProps & {\n intent?: PopoverIntent\n}\n\nexport const Popover = ({ children, intent = 'surface', modal = false, ...rest }: PopoverProps) => {\n return (\n <PopoverProvider intent={intent}>\n <RadixPopover.Root data-spark-component=\"popover\" modal={modal} {...rest}>\n {children}\n </RadixPopover.Root>\n </PopoverProvider>\n )\n}\n\nPopover.displayName = 'Popover'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type AnchorProps = RadixPopover.PopoverAnchorProps & {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The anchor element for positioning the popover. Renders a <div> element.\n */\n\nexport const Anchor = ({ asChild = false, children, ref, ...rest }: AnchorProps) => (\n <RadixPopover.Anchor data-spark-component=\"popover-anchor\" ref={ref} asChild={asChild} {...rest}>\n {children}\n </RadixPopover.Anchor>\n)\n\nAnchor.displayName = 'Popover.Anchor'\n","import { cva } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { usePopover } from './PopoverContext'\n\nexport type ArrowProps = RadixPopover.PopoverArrowProps & {\n ref?: Ref<SVGSVGElement>\n}\n\n/**\n * An arrow pointing to the anchor element. Renders an <svg> element.\n */\n\nexport const Arrow = ({\n asChild = false,\n width = 16,\n height = 8,\n className,\n ref,\n ...rest\n}: ArrowProps) => {\n const { intent } = usePopover()\n\n /**\n * This is necessary to override a Radix UI behaviour.\n * Radix hides the arrow when the Popover is too misaligned from its trigger element.\n */\n const styles = cva('visible', {\n variants: {\n intent: {\n surface: 'fill-surface',\n main: 'fill-main-container',\n support: 'fill-support-container',\n accent: 'fill-accent-container',\n success: 'fill-success-container',\n alert: 'fill-alert-container',\n danger: 'fill-error-container',\n info: 'fill-info-container',\n neutral: 'fill-neutral-container',\n },\n },\n defaultVariants: {\n intent: 'surface',\n },\n })\n\n return (\n <RadixPopover.Arrow\n data-spark-component=\"popover-arrow\"\n ref={ref}\n className={styles({ intent, className })}\n asChild={asChild}\n width={width}\n height={height}\n {...rest}\n />\n )\n}\n\nArrow.displayName = 'Popover.Arrow'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\n\nexport type CloseButtonProps = RadixPopover.PopoverCloseProps & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the popover. Renders a <button> element.\n */\n\nexport const CloseButton = ({\n 'aria-label': ariaLabel,\n className,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <RadixPopover.Close\n data-spark-component=\"popover-close-button\"\n ref={ref}\n className={cx('right-lg top-md absolute', className)}\n asChild\n {...rest}\n >\n <IconButton size=\"sm\" intent=\"neutral\" design=\"ghost\" aria-label={ariaLabel}>\n <Icon>\n <CloseSVG />\n </Icon>\n </IconButton>\n </RadixPopover.Close>\n )\n}\n\nCloseButton.displayName = 'Popover.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'rounded-md',\n 'shadow-sm',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n 'max-h-(--radix-popper-available-height) overflow-y-auto',\n ],\n {\n variants: {\n intent: {\n surface: 'bg-surface text-on-surface',\n main: 'bg-main-container text-on-main-container',\n support: 'bg-support-container text-on-support-container',\n accent: 'bg-accent-container text-on-accent-container',\n success: 'bg-success-container text-on-success-container',\n alert: 'bg-alert-container text-on-alert-container',\n danger: 'bg-error-container text-on-error-container',\n info: 'bg-info-container text-on-info-container',\n neutral: 'bg-neutral-container text-on-neutral-container',\n },\n matchTriggerWidth: {\n true: 'w-(--radix-popper-anchor-width)',\n },\n enforceBoundaries: {\n true: ['max-w-(--radix-popper-available-width)'],\n },\n\n inset: {\n true: 'overflow-hidden',\n false: 'p-lg',\n },\n elevation: {\n dropdown: 'z-dropdown',\n popover: 'z-popover',\n },\n },\n compoundVariants: [\n {\n inset: false,\n /**\n * When there is a close button, padding to the right side must be adjusted to avoid content overlapping with it.\n */\n class: 'has-data-[spark-component=popover-close-button]:pr-3xl',\n },\n {\n enforceBoundaries: false,\n matchTriggerWidth: false,\n class: 'max-w-[min(var(--spacing-sz-384),100vw)]',\n },\n ],\n defaultVariants: {\n matchTriggerWidth: false,\n enforceBoundaries: false,\n inset: false,\n intent: 'surface',\n elevation: 'popover',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { styles, type StylesProps } from './PopoverContent.styles'\nimport { usePopover } from './PopoverContext'\n\nexport type ContentProps = RadixPopover.PopoverContentProps &\n StylesProps & {\n ref?: Ref<HTMLDivElement>\n }\n\n/**\n * The popup element containing popover content. Renders a <div> element.\n */\n\nexport const Content = ({\n // Spark props\n className,\n children,\n matchTriggerWidth = false,\n // Radix props\n align = 'center',\n arrowPadding = 16, // In order not to overlap the arrow on the rounded corners of the popover.\n asChild = false,\n avoidCollisions = true,\n 'aria-labelledby': ariaLabelledBy,\n collisionBoundary,\n collisionPadding = 0,\n hideWhenDetached = false,\n side = 'bottom',\n sideOffset = 8,\n sticky = 'partial',\n inset = false,\n elevation = 'popover',\n ref,\n ...rest\n}: ContentProps) => {\n const { headerId, intent } = usePopover()\n\n return (\n <RadixPopover.Content\n aria-labelledby={headerId || ariaLabelledBy}\n className={styles({\n enforceBoundaries: !!collisionBoundary,\n matchTriggerWidth,\n inset,\n elevation,\n intent,\n className,\n })}\n data-spark-component=\"popover-content\"\n ref={ref}\n {...{\n align,\n arrowPadding,\n asChild,\n avoidCollisions,\n collisionBoundary,\n collisionPadding,\n hideWhenDetached,\n side,\n sideOffset,\n sticky,\n }}\n {...rest}\n >\n {children}\n </RadixPopover.Content>\n )\n}\n\nContent.displayName = 'Popover.Content'\n","import { cx } from 'class-variance-authority'\nimport { type ReactNode, Ref, useId, useLayoutEffect } from 'react'\n\nimport { ID_PREFIX, usePopover } from './PopoverContext'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the popover. Renders a <header> element.\n */\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps) => {\n const id = `${ID_PREFIX}-header-${useId()}`\n const { setHeaderId } = usePopover()\n\n useLayoutEffect(() => {\n setHeaderId(id)\n\n return () => setHeaderId(null)\n }, [id, setHeaderId])\n\n return (\n <header id={id} ref={ref} className={cx('mb-md text-headline-2', className)} {...rest}>\n {children}\n </header>\n )\n}\n\nHeader.displayName = 'Popover.Header'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { ReactElement } from 'react'\n\nexport type PortalProps = RadixPopover.PopoverPortalProps\n\n/**\n * A portal that renders the popover in a different part of the DOM. Renders a <div> element.\n */\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixPopover.Portal {...rest}>{children}</RadixPopover.Portal>\n)\n\nPortal.displayName = 'Popover.Portal'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TriggerProps = RadixPopover.PopoverTriggerProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the popover. Renders a <button> element.\n */\n\nexport const Trigger = ({ asChild = false, children, ref, ...rest }: TriggerProps) => (\n <RadixPopover.Trigger\n data-spark-component=\"popover-trigger\"\n ref={ref}\n asChild={asChild}\n {...rest}\n >\n {children}\n </RadixPopover.Trigger>\n)\n\nTrigger.displayName = 'Popover.Trigger'\n","import { Popover as Root } from './Popover'\nimport { Anchor } from './PopoverAnchor'\nimport { Arrow } from './PopoverArrow'\nimport { CloseButton } from './PopoverCloseButton'\nimport { Content } from './PopoverContent'\nimport { Header } from './PopoverHeader'\nimport { Portal } from './PopoverPortal'\nimport { Trigger } from './PopoverTrigger'\n\n/**\n * A floating container that displays additional content when triggered, positioned relative to its trigger element.\n */\nexport const Popover: typeof Root & {\n Anchor: typeof Anchor\n Arrow: typeof Arrow\n CloseButton: typeof CloseButton\n Content: typeof Content\n Header: typeof Header\n Portal: typeof Portal\n Trigger: typeof Trigger\n} = Object.assign(Root, {\n Anchor,\n Arrow,\n CloseButton,\n Content,\n Header,\n Portal,\n Trigger,\n})\n\nPopover.displayName = 'Popover'\nAnchor.displayName = 'Popover.Anchor'\nArrow.displayName = 'Popover.Arrow'\nCloseButton.displayName = 'Popover.CloseButton'\nContent.displayName = 'Popover.Content'\nHeader.displayName = 'Popover.Header'\nPortal.displayName = 'Popover.Portal'\nTrigger.displayName = 'Popover.Trigger'\n"],"mappings":";;;;;;;;AAoBA,IAAM,IAAiB,EAA0C,IAAI,GAExD,IAAY,YAEZ,KAAmB,EAC9B,aACA,gBAII;CACJ,IAAM,CAAC,GAAU,KAAe,EAAmB,IAAI;CAEvD,OACE,kBAAC,GAAD;EACE,OAAO;GACL;GACA;GACA;EACF;EAEC;CACa,CAAA;AAEpB,GAEa,UAAmB;CAC9B,IAAM,IAAU,EAAW,CAAc;CAEzC,IAAI,CAAC,GACH,MAAM,MAAM,mDAAmD;CAGjE,OAAO;AACT,GC9Ca,KAAW,EAAE,aAAU,YAAS,WAAW,WAAQ,IAAO,GAAG,QAEtE,kBAAC,GAAD;CAAyB;WACvB,kBAAC,EAAa,MAAd;EAAmB,wBAAqB;EAAiB;EAAO,GAAI;EACjE;CACgB,CAAA;AACJ,CAAA;AAIrB,EAAQ,cAAc;;;ACPtB,IAAa,KAAU,EAAE,aAAU,IAAO,aAAU,QAAK,GAAG,QAC1D,kBAAC,EAAa,QAAd;CAAqB,wBAAqB;CAAsB;CAAc;CAAS,GAAI;CACxF;AACkB,CAAA;AAGvB,EAAO,cAAc;;;ACHrB,IAAa,KAAS,EACpB,aAAU,IACV,WAAQ,IACR,YAAS,GACT,cACA,QACA,GAAG,QACa;CAChB,IAAM,EAAE,cAAW,EAAW,GAMxB,IAAS,EAAI,WAAW;EAC5B,UAAU,EACR,QAAQ;GACN,SAAS;GACT,MAAM;GACN,SAAS;GACT,QAAQ;GACR,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AQ,cAAc"}
|
|
1
|
+
{"version":3,"file":"popover-COqbFikI.mjs","names":[],"sources":["../src/popover/PopoverContext.tsx","../src/popover/Popover.tsx","../src/popover/PopoverAnchor.tsx","../src/popover/PopoverArrow.tsx","../src/popover/PopoverCloseButton.tsx","../src/popover/PopoverContent.styles.ts","../src/popover/PopoverContent.tsx","../src/popover/PopoverHeader.tsx","../src/popover/PopoverPortal.tsx","../src/popover/PopoverTrigger.tsx","../src/popover/index.ts"],"sourcesContent":["import { createContext, type ReactNode, useContext, useState } from 'react'\n\ntype HeaderId = string | null\n\nexport type PopoverIntent =\n | 'surface'\n | 'main'\n | 'support'\n | 'accent'\n | 'success'\n | 'alert'\n | 'danger'\n | 'info'\n | 'neutral'\nexport interface PopoverContextState {\n headerId: HeaderId\n setHeaderId: (id: HeaderId) => void\n intent: PopoverIntent\n}\n\nconst PopoverContext = createContext<PopoverContextState | null>(null)\n\nexport const ID_PREFIX = ':popover'\n\nexport const PopoverProvider = ({\n children,\n intent,\n}: {\n children: ReactNode\n intent: PopoverIntent\n}) => {\n const [headerId, setHeaderId] = useState<HeaderId>(null)\n\n return (\n <PopoverContext\n value={{\n headerId,\n setHeaderId,\n intent,\n }}\n >\n {children}\n </PopoverContext>\n )\n}\n\nexport const usePopover = () => {\n const context = useContext(PopoverContext)\n\n if (!context) {\n throw Error('usePopover must be used within a Popover provider')\n }\n\n return context\n}\n","import { Popover as RadixPopover } from 'radix-ui'\n\nimport { type PopoverIntent, PopoverProvider } from './PopoverContext'\n\nexport type PopoverProps = RadixPopover.PopoverProps & {\n intent?: PopoverIntent\n}\n\nexport const Popover = ({ children, intent = 'surface', modal = false, ...rest }: PopoverProps) => {\n return (\n <PopoverProvider intent={intent}>\n <RadixPopover.Root data-spark-component=\"popover\" modal={modal} {...rest}>\n {children}\n </RadixPopover.Root>\n </PopoverProvider>\n )\n}\n\nPopover.displayName = 'Popover'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type AnchorProps = RadixPopover.PopoverAnchorProps & {\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The anchor element for positioning the popover. Renders a <div> element.\n */\n\nexport const Anchor = ({ asChild = false, children, ref, ...rest }: AnchorProps) => (\n <RadixPopover.Anchor data-spark-component=\"popover-anchor\" ref={ref} asChild={asChild} {...rest}>\n {children}\n </RadixPopover.Anchor>\n)\n\nAnchor.displayName = 'Popover.Anchor'\n","import { cva } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { usePopover } from './PopoverContext'\n\nexport type ArrowProps = RadixPopover.PopoverArrowProps & {\n ref?: Ref<SVGSVGElement>\n}\n\n/**\n * An arrow pointing to the anchor element. Renders an <svg> element.\n */\n\nexport const Arrow = ({\n asChild = false,\n width = 16,\n height = 8,\n className,\n ref,\n ...rest\n}: ArrowProps) => {\n const { intent } = usePopover()\n\n /**\n * This is necessary to override a Radix UI behaviour.\n * Radix hides the arrow when the Popover is too misaligned from its trigger element.\n */\n const styles = cva('visible', {\n variants: {\n intent: {\n surface: 'fill-surface',\n main: 'fill-main-container',\n support: 'fill-support-container',\n accent: 'fill-accent-container',\n success: 'fill-success-container',\n alert: 'fill-alert-container',\n danger: 'fill-error-container',\n info: 'fill-info-container',\n neutral: 'fill-neutral-container',\n },\n },\n defaultVariants: {\n intent: 'surface',\n },\n })\n\n return (\n <RadixPopover.Arrow\n data-spark-component=\"popover-arrow\"\n ref={ref}\n className={styles({ intent, className })}\n asChild={asChild}\n width={width}\n height={height}\n {...rest}\n />\n )\n}\n\nArrow.displayName = 'Popover.Arrow'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\n\nexport type CloseButtonProps = RadixPopover.PopoverCloseProps & {\n 'aria-label': string\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that closes the popover. Renders a <button> element.\n */\n\nexport const CloseButton = ({\n 'aria-label': ariaLabel,\n className,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <RadixPopover.Close\n data-spark-component=\"popover-close-button\"\n ref={ref}\n className={cx('right-lg top-md absolute', className)}\n asChild\n {...rest}\n >\n <IconButton size=\"sm\" intent=\"neutral\" design=\"ghost\" aria-label={ariaLabel}>\n <Icon>\n <CloseSVG />\n </Icon>\n </IconButton>\n </RadixPopover.Close>\n )\n}\n\nCloseButton.displayName = 'Popover.CloseButton'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const styles = cva(\n [\n 'rounded-md',\n 'shadow-sm',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n 'max-h-(--radix-popper-available-height) overflow-y-auto',\n ],\n {\n variants: {\n intent: {\n surface: 'bg-surface text-on-surface',\n main: 'bg-main-container text-on-main-container',\n support: 'bg-support-container text-on-support-container',\n accent: 'bg-accent-container text-on-accent-container',\n success: 'bg-success-container text-on-success-container',\n alert: 'bg-alert-container text-on-alert-container',\n danger: 'bg-error-container text-on-error-container',\n info: 'bg-info-container text-on-info-container',\n neutral: 'bg-neutral-container text-on-neutral-container',\n },\n matchTriggerWidth: {\n true: 'w-(--radix-popper-anchor-width)',\n },\n enforceBoundaries: {\n true: ['max-w-(--radix-popper-available-width)'],\n },\n\n inset: {\n true: 'overflow-hidden',\n false: 'p-lg',\n },\n elevation: {\n dropdown: 'z-dropdown',\n popover: 'z-popover',\n },\n },\n compoundVariants: [\n {\n inset: false,\n /**\n * When there is a close button, padding to the right side must be adjusted to avoid content overlapping with it.\n */\n class: 'has-data-[spark-component=popover-close-button]:pr-3xl',\n },\n {\n enforceBoundaries: false,\n matchTriggerWidth: false,\n class: 'max-w-[min(var(--spacing-sz-384),100vw)]',\n },\n ],\n defaultVariants: {\n matchTriggerWidth: false,\n enforceBoundaries: false,\n inset: false,\n intent: 'surface',\n elevation: 'popover',\n },\n }\n)\n\nexport type StylesProps = VariantProps<typeof styles>\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { styles, type StylesProps } from './PopoverContent.styles'\nimport { usePopover } from './PopoverContext'\n\nexport type ContentProps = RadixPopover.PopoverContentProps &\n StylesProps & {\n ref?: Ref<HTMLDivElement>\n }\n\n/**\n * The popup element containing popover content. Renders a <div> element.\n */\n\nexport const Content = ({\n // Spark props\n className,\n children,\n matchTriggerWidth = false,\n // Radix props\n align = 'center',\n arrowPadding = 16, // In order not to overlap the arrow on the rounded corners of the popover.\n asChild = false,\n avoidCollisions = true,\n 'aria-labelledby': ariaLabelledBy,\n collisionBoundary,\n collisionPadding = 0,\n hideWhenDetached = false,\n side = 'bottom',\n sideOffset = 8,\n sticky = 'partial',\n inset = false,\n elevation = 'popover',\n ref,\n ...rest\n}: ContentProps) => {\n const { headerId, intent } = usePopover()\n\n return (\n <RadixPopover.Content\n aria-labelledby={headerId || ariaLabelledBy}\n className={styles({\n enforceBoundaries: !!collisionBoundary,\n matchTriggerWidth,\n inset,\n elevation,\n intent,\n className,\n })}\n data-spark-component=\"popover-content\"\n ref={ref}\n {...{\n align,\n arrowPadding,\n asChild,\n avoidCollisions,\n collisionBoundary,\n collisionPadding,\n hideWhenDetached,\n side,\n sideOffset,\n sticky,\n }}\n {...rest}\n >\n {children}\n </RadixPopover.Content>\n )\n}\n\nContent.displayName = 'Popover.Content'\n","import { cx } from 'class-variance-authority'\nimport { type ReactNode, Ref, useId, useLayoutEffect } from 'react'\n\nimport { ID_PREFIX, usePopover } from './PopoverContext'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * The header section of the popover. Renders a <header> element.\n */\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps) => {\n const id = `${ID_PREFIX}-header-${useId()}`\n const { setHeaderId } = usePopover()\n\n useLayoutEffect(() => {\n setHeaderId(id)\n\n return () => setHeaderId(null)\n }, [id, setHeaderId])\n\n return (\n <header id={id} ref={ref} className={cx('mb-md text-headline-2', className)} {...rest}>\n {children}\n </header>\n )\n}\n\nHeader.displayName = 'Popover.Header'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { ReactElement } from 'react'\n\nexport type PortalProps = RadixPopover.PopoverPortalProps\n\n/**\n * A portal that renders the popover in a different part of the DOM. Renders a <div> element.\n */\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixPopover.Portal {...rest}>{children}</RadixPopover.Portal>\n)\n\nPortal.displayName = 'Popover.Portal'\n","import { Popover as RadixPopover } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TriggerProps = RadixPopover.PopoverTriggerProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\n/**\n * A button that opens the popover. Renders a <button> element.\n */\n\nexport const Trigger = ({ asChild = false, children, ref, ...rest }: TriggerProps) => (\n <RadixPopover.Trigger\n data-spark-component=\"popover-trigger\"\n ref={ref}\n asChild={asChild}\n {...rest}\n >\n {children}\n </RadixPopover.Trigger>\n)\n\nTrigger.displayName = 'Popover.Trigger'\n","import { Popover as Root } from './Popover'\nimport { Anchor } from './PopoverAnchor'\nimport { Arrow } from './PopoverArrow'\nimport { CloseButton } from './PopoverCloseButton'\nimport { Content } from './PopoverContent'\nimport { Header } from './PopoverHeader'\nimport { Portal } from './PopoverPortal'\nimport { Trigger } from './PopoverTrigger'\n\n/**\n * A floating container that displays additional content when triggered, positioned relative to its trigger element.\n */\nexport const Popover: typeof Root & {\n Anchor: typeof Anchor\n Arrow: typeof Arrow\n CloseButton: typeof CloseButton\n Content: typeof Content\n Header: typeof Header\n Portal: typeof Portal\n Trigger: typeof Trigger\n} = Object.assign(Root, {\n Anchor,\n Arrow,\n CloseButton,\n Content,\n Header,\n Portal,\n Trigger,\n})\n\nPopover.displayName = 'Popover'\nAnchor.displayName = 'Popover.Anchor'\nArrow.displayName = 'Popover.Arrow'\nCloseButton.displayName = 'Popover.CloseButton'\nContent.displayName = 'Popover.Content'\nHeader.displayName = 'Popover.Header'\nPortal.displayName = 'Popover.Portal'\nTrigger.displayName = 'Popover.Trigger'\n"],"mappings":";;;;;;;;AAoBA,IAAM,IAAiB,EAA0C,IAAI,GAExD,IAAY,YAEZ,KAAmB,EAC9B,aACA,gBAII;CACJ,IAAM,CAAC,GAAU,KAAe,EAAmB,IAAI;CAEvD,OACE,kBAAC,GAAD;EACE,OAAO;GACL;GACA;GACA;EACF;EAEC;CACa,CAAA;AAEpB,GAEa,UAAmB;CAC9B,IAAM,IAAU,EAAW,CAAc;CAEzC,IAAI,CAAC,GACH,MAAM,MAAM,mDAAmD;CAGjE,OAAO;AACT,GC9Ca,KAAW,EAAE,aAAU,YAAS,WAAW,WAAQ,IAAO,GAAG,QAEtE,kBAAC,GAAD;CAAyB;WACvB,kBAAC,EAAa,MAAd;EAAmB,wBAAqB;EAAiB;EAAO,GAAI;EACjE;CACgB,CAAA;AACJ,CAAA;AAIrB,EAAQ,cAAc;;;ACPtB,IAAa,KAAU,EAAE,aAAU,IAAO,aAAU,QAAK,GAAG,QAC1D,kBAAC,EAAa,QAAd;CAAqB,wBAAqB;CAAsB;CAAc;CAAS,GAAI;CACxF;AACkB,CAAA;AAGvB,EAAO,cAAc;;;ACHrB,IAAa,KAAS,EACpB,aAAU,IACV,WAAQ,IACR,YAAS,GACT,cACA,QACA,GAAG,QACa;CAChB,IAAM,EAAE,cAAW,EAAW,GAMxB,IAAS,EAAI,WAAW;EAC5B,UAAU,EACR,QAAQ;GACN,SAAS;GACT,MAAM;GACN,SAAS;GACT,QAAQ;GACR,SAAS;GACT,OAAO;GACP,QAAQ;GACR,MAAM;GACN,SAAS;EACX,EACF;EACA,iBAAiB,EACf,QAAQ,UACV;CACF,CAAC;CAED,OACE,kBAAC,EAAa,OAAd;EACE,wBAAqB;EAChB;EACL,WAAW,EAAO;GAAE;GAAQ;EAAU,CAAC;EAC9B;EACF;EACC;EACR,GAAI;CACL,CAAA;AAEL;AAEA,EAAM,cAAc;;;AC3C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A;EACF,CAAC;EACD,wBAAqB;EAChB;EAEH;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEF,GAAI;EAEH;CACmB,CAAA;AAE1B;AAEA,EAAQ,cAAc;;;ACxDtB,IAAa,KAAU,EAAE,aAAU,cAAW,QAAK,GAAG,QAAwB;CAC5E,IAAM,IAAK,GAAG,EAAU,UAAU,EAAM,KAClC,EAAE,mBAAgB,EAAW;CAQnC,OANA,SACE,EAAY,CAAE,SAED,EAAY,IAAI,IAC5B,CAAC,GAAI,CAAW,CAAC,GAGlB,kBAAC,UAAD;EAAY;EAAS;EAAK,WAAW,EAAG,yBAAyB,CAAS;EAAG,GAAI;EAC9E;CACK,CAAA;AAEZ;AAEA,EAAO,cAAc;;;ACvBrB,IAAa,KAAU,EAAE,aAAU,GAAG,QACpC,kBAAC,EAAa,QAAd;CAAqB,GAAI;CAAO;AAA8B,CAAA;AAGhE,EAAO,cAAc;;;ACFrB,IAAa,KAAW,EAAE,aAAU,IAAO,aAAU,QAAK,GAAG,QAC3D,kBAAC,EAAa,SAAd;CACE,wBAAqB;CAChB;CACI;CACT,GAAI;CAEH;AACmB,CAAA;AAGxB,EAAQ,cAAc;;;ACVtB,IAAa,IAQT,OAAO,OAAO,GAAM;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;AAED,EAAQ,cAAc,WACtB,EAAO,cAAc,kBACrB,EAAM,cAAc,iBACpB,EAAY,cAAc,uBAC1B,EAAQ,cAAc,mBACtB,EAAO,cAAc,kBACrB,EAAO,cAAc,kBACrB,EAAQ,cAAc"}
|
|
@@ -2,7 +2,7 @@ import { Progress as BaseProgress } from '@base-ui/react/progress';
|
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { ComponentProps, PropsWithChildren } from 'react';
|
|
4
4
|
export declare const progressIndicatorStyles: (props?: ({
|
|
5
|
-
intent?: "main" | "
|
|
5
|
+
intent?: "main" | "support" | "alert" | "accent" | "success" | "info" | "neutral" | "danger" | null | undefined;
|
|
6
6
|
shape?: "square" | "rounded" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
export type ProgressIndicatorStylesProps = VariantProps<typeof progressIndicatorStyles>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../icon-CfEsla9z.js");let t=require("class-variance-authority"),n=require("react"),r=require("react/jsx-runtime"),i=require("@spark-ui/icons/Check");var a=(0,t.cx)([`flex flex-nowrap items-start group/list`,`data-[orientation=horizontal]:flex-row data-[orientation=horizontal]:w-full`,`data-[orientation=vertical]:flex-col`]),o=(0,n.createContext)({}),s=(0,n.createContext)({}),c=()=>(0,n.useContext)(o),l=()=>(0,n.useContext)(s),u=`:progress-tracker`,d=({stepIndex:e=0,onStepClick:i,readOnly:s=!1,intent:c=`support`,size:l=`lg`,orientation:u=`horizontal`,children:d,className:f,ref:p,...m})=>{let[h,g]=(0,n.useState)(new Map);return(0,r.jsx)(o,{value:{stepIndex:e,onStepClick:i,steps:h,setSteps:g,size:l,intent:c,readOnly:s},children:(0,r.jsx)(s?`div`:`nav`,{ref:p,"data-spark-component":`progress-tracker`,className:(0,t.cx)(`inline-flex`,f),...m,children:(0,r.jsx)(`ol`,{"data-orientation":u,className:a,style:{counterReset:`step`},children:d})})})};d.displayName=`ProgressTracker`;var f=(0,t.cva)([`relative inline-flex items-start flex-auto first:grow-0 justify-center group/item`,`after:absolute after:z-base`,`last:after:content-none`,`after:bg-outline`,`group-data-[orientation=horizontal]/list:before:bg-outline`,`group-data-[orientation=horizontal]/list:px-[1px]`,`group-data-[orientation=horizontal]/list:before:absolute group-data-[orientation=horizontal]/list:before:z-base`,`group-data-[orientation=horizontal]/list:before:left-0 group-data-[orientation=horizontal]/list:after:right-0`,`group-data-[orientation=horizontal]/list:before:h-[1px] group-data-[orientation=horizontal]/list:after:h-[1px]`,`first:group-data-[orientation=horizontal]/list:before:content-none`,`group-data-[orientation=vertical]/list:py-[1px]`,`group-data-[orientation=vertical]/list:items-start`,`group-data-[orientation=vertical]/list:after:w-[1px] group-data-[orientation=vertical]/list:after:bottom-[-1px]`],{variants:{size:{sm:[`group-data-[orientation=horizontal]/list:before:top-[8px] group-data-[orientation=horizontal]/list:after:top-[8px]`,`group-data-[orientation=horizontal]/list:before:right-[calc(50%+12px)] group-data-[orientation=horizontal]/list:after:left-[calc(50%+12px)]`,`first:group-data-[orientation=horizontal]/list:after:left-[calc(50%+10px)]`,`last:group-data-[orientation=horizontal]/list:before:right-[calc(50%+10px)]`,`group-data-[orientation=vertical]/list:after:left-[8px]`,`group-data-[orientation=vertical]/list:after:top-[25px]`,`first:group-data-[orientation=vertical]/list:after:top-[21px]`],md:[`group-data-[orientation=horizontal]/list:before:top-[12px] group-data-[orientation=horizontal]/list:after:top-[12px]`,`group-data-[orientation=horizontal]/list:before:right-[calc(50%+16px)] group-data-[orientation=horizontal]/list:after:left-[calc(50%+16px)]`,`first:group-data-[orientation=horizontal]/list:after:left-[calc(50%+14px)]`,`last:group-data-[orientation=horizontal]/list:before:right-[calc(50%+14px)]`,`group-data-[orientation=vertical]/list:after:left-[12px]`,`group-data-[orientation=vertical]/list:after:top-[33px]`,`first:group-data-[orientation=vertical]/list:after:top-[29px]`],lg:[`group-data-[orientation=horizontal]/list:before:top-[16px] group-data-[orientation=horizontal]/list:after:top-[16px]`,`group-data-[orientation=horizontal]/list:before:right-[calc(50%+20px)] group-data-[orientation=horizontal]/list:after:left-[calc(50%+20px)]`,`first:group-data-[orientation=horizontal]/list:after:left-[calc(50%+18px)]`,`last:group-data-[orientation=horizontal]/list:before:right-[calc(50%+18px)]`,`group-data-[orientation=vertical]/list:after:left-[16px]`,`group-data-[orientation=vertical]/list:after:top-[41px]`,`first:group-data-[orientation=vertical]/list:after:top-[37px]`]},intent:{support:``,neutral:``,success:``},disabled:{true:`before:opacity-dim-3`,false:``},disabledAfter:{true:`after:opacity-dim-3`,false:``}},defaultVariants:{disabled:!1,disabledAfter:!1,size:`lg`,intent:`support`}}),p=(0,t.cva)([`relative flex group/btn disabled:cursor-default`,`group-data-[orientation=horizontal]/list:flex-col group-data-[orientation=horizontal]/list:items-center`,`group-data-[orientation=horizontal]/list:text-center group-data-[orientation=horizontal]/list:mx-sm`,`group-first/item:group-data-[orientation=horizontal]/list:ml-0 group-last/item:group-data-[orientation=horizontal]/list:mr-0`,`group-data-[orientation=vertical]/list:flex-row group-data-[orientation=vertical]/list:items-start`,`group-data-[orientation=vertical]/list:text-left group-data-[orientation=vertical]/list:my-sm`,`group-first/item:group-data-[orientation=vertical]/list:mt-0 group-last/item:group-data-[orientation=vertical]/list:mb-0`],{variants:{size:{sm:[`group-data-[orientation=horizontal]/list:min-w-sz-16 group-data-[orientation=horizontal]/list:mt-[16px]`,`group-data-[orientation=vertical]/list:min-h-sz-16 group-data-[orientation=vertical]/list:ml-[16px]`],md:[`group-data-[orientation=horizontal]/list:min-w-sz-24 group-data-[orientation=horizontal]/list:mt-[24px]`,`group-data-[orientation=vertical]/list:min-h-sz-24 group-data-[orientation=vertical]/list:ml-[24px]`],lg:[`group-data-[orientation=horizontal]/list:min-w-sz-32 group-data-[orientation=horizontal]/list:mt-[32px]`,`group-data-[orientation=vertical]/list:min-h-sz-32 group-data-[orientation=vertical]/list:ml-[32px]`]},readOnly:{true:`cursor-default`,false:`cursor-pointer`}},defaultVariants:{size:`lg`,readOnly:!1}}),m=(0,t.cva)([`relative flex shrink-0 justify-center items-center`,`rounded-full`,`text-body-2-highlight`,`group-disabled/btn:opacity-dim-3`],{variants:{size:{sm:[`w-sz-16 h-sz-16`,`group-data-[orientation=horizontal]/list:mt-[-16px]`,`group-data-[orientation=vertical]/list:ml-[-16px]`],md:[`w-sz-24 h-sz-24`,`group-data-[orientation=horizontal]/list:mt-[-24px]`,`group-data-[orientation=vertical]/list:ml-[-24px]`],lg:[`w-sz-32 h-sz-32`,`group-data-[orientation=horizontal]/list:mt-[-32px]`,`group-data-[orientation=vertical]/list:ml-[-32px]`]},intent:{support:``,neutral:``,success:``},state:{complete:``,incomplete:``,active:``}},compoundVariants:[{intent:`support`,state:[`complete`,`incomplete`],class:[`text-on-support-container bg-support-container`,`group-hover/btn:group-data-[interactive=true]/btn:bg-support-container-hovered`,`group-hover/btn:group-data-[interactive=false]/btn:bg-support-container`]},{intent:`support`,state:`active`,class:`text-on-support bg-support`},{intent:`neutral`,state:[`complete`,`incomplete`],class:[`text-on-neutral-container bg-neutral-container`,`group-hover/btn:group-data-[interactive=true]/btn:bg-neutral-container-hovered`,`group-hover/btn:group-data-[interactive=false]/btn:bg-neutral-container`]},{intent:`neutral`,state:`active`,class:`text-on-neutral bg-neutral`},{intent:`success`,state:[`complete`,`incomplete`],class:[`text-on-success-container bg-success-container`,`group-hover/btn:group-data-[interactive=true]/btn:bg-success-container-hovered`,`group-hover/btn:group-data-[interactive=false]/btn:bg-success-container`]},{intent:`success`,state:`active`,class:`text-on-success bg-success`}],defaultVariants:{size:`lg`,state:`incomplete`,intent:`support`}}),h=()=>(0,r.jsx)(e.t,{size:`sm`,children:(0,r.jsx)(i.Check,{})}),g=({complete:e,incomplete:t,className:n})=>{let{size:i,intent:a}=c(),{index:o,state:s}=l();return(0,r.jsx)(`span`,{className:m({size:i,intent:a,state:s,className:n}),"aria-hidden":`true`,children:i!==`sm`&&(0,r.jsxs)(r.Fragment,{children:[s===`complete`&&(e===void 0?(0,r.jsx)(h,{}):e),s!==`complete`&&(t===void 0?`${o+1}`:t)]})})};g.displayName=`ProgressTracker.StepIndicator`;var _=({disabled:e=!1,children:t,"aria-label":i,className:a,ref:o,...l})=>{let{stepIndex:d,steps:m,onStepClick:h,setSteps:_,size:v,intent:y,readOnly:b}=c(),x=`${u}-step-${(0,n.useId)()}`,S=[...m.keys()].indexOf(x),C=(()=>{let e=[...m.keys()][S+1];return!!(e&&m.get(e)?.includes(`disabled`))})(),w=S===d?`active`:S<d?`complete`:`incomplete`;return(0,n.useEffect)(()=>(_(t=>new Map(t).set(x,[w,e?`disabled`:``].filter(e=>!!e))),()=>{_(e=>(e.delete(x),e))}),[]),(0,r.jsx)(`li`,{"data-spark-component":`progress-tracker-step`,id:x,ref:o,"data-state":w,...w===`active`&&{"aria-current":`step`},className:f({size:v,intent:y,disabled:e,disabledAfter:C}),...l,children:(0,r.jsx)(`button`,{type:`button`,"aria-label":i,"data-interactive":!e&&!b,...!e&&!b&&{onClick:()=>h?.(S)},disabled:e,className:p({size:v,readOnly:b,className:a}),children:(0,r.jsx)(s,{value:{index:S,state:w},children:t||(0,r.jsx)(g,{})})})})};_.displayName=`ProgressTracker.Step`;var v=(0,t.cva)([`flex text-body-2`,`text-on-surface group-disabled/btn:text-on-surface/dim-1`,`group-data-[orientation=horizontal]/list:mt-md`,`group-data-[orientation=vertical]/list:ml-md`,`group-data-[orientation=vertical]/list:my-auto`],{variants:{state:{complete:``,incomplete:``,active:`font-medium`}}}),y=({className:e,children:t})=>{let{state:n}=l();return(0,r.jsx)(`span`,{className:v({state:n,className:e}),children:t})};y.displayName=`ProgressTracker.StepLabel`;var b=Object.assign(d,{Step:_,StepLabel:y,StepIndicator:g});b.displayName=`ProgressTracker`,_.displayName=`ProgressTracker.Step`,y.displayName=`ProgressTracker.StepLabel`,g.displayName=`ProgressTracker.StepIndicator`,exports.ProgressTracker=b;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../icon-
|
|
1
|
+
import { t as e } from "../icon-VM_Ys9Xn.mjs";
|
|
2
2
|
import { cva as t, cx as n } from "class-variance-authority";
|
|
3
3
|
import { createContext as r, useContext as i, useEffect as a, useId as o, useState as s } from "react";
|
|
4
4
|
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|