@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/tabs/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/tabs/TabsContext.tsx","../../src/tabs/TabsRoot.styles.ts","../../src/tabs/useRenderSlot.tsx","../../src/tabs/Tabs.tsx","../../src/tabs/TabsContent.styles.ts","../../src/tabs/TabsContent.tsx","../../src/tabs/TabsList.styles.ts","../../src/tabs/useResizeObserver.ts","../../src/tabs/TabsList.tsx","../../src/tabs/TabsPopoverAbstraction.tsx","../../src/tabs/TabsTrigger.styles.ts","../../src/tabs/TabsTrigger.tsx","../../src/tabs/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { TabsTriggerVariantsProps } from './TabsTrigger.styles'\n\nexport type TabsContextInterface = TabsTriggerVariantsProps & {\n orientation?: 'horizontal' | 'vertical'\n forceMount?: boolean\n}\n\nexport const TabsContext = createContext<TabsContextInterface>({} as TabsContextInterface)\n\nexport const useTabsContext = () => {\n const context = useContext(TabsContext)\n\n if (!context) {\n throw Error('useTabsContext must be used within a TabsContext Provider')\n }\n\n return context\n}\n","import { cva } from 'class-variance-authority'\n\nexport const rootStyles = cva([\n 'flex',\n 'data-[orientation=horizontal]:flex-col',\n 'data-[orientation=vertical]:flex-row',\n 'max-w-full',\n])\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean) {\n return asChild ? ({ ...props }: object) => <Slot {...props} /> : undefined\n}\n","import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { type ComponentProps, type PropsWithChildren, Ref } from 'react'\n\nimport { TabsContext } from './TabsContext'\nimport { rootStyles } from './TabsRoot.styles'\nimport type { TabsTriggerVariantsProps } from './TabsTrigger.styles'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface TabsProps\n extends\n Omit<ComponentProps<typeof BaseTabs.Root>, 'render'>,\n PropsWithChildren<Omit<TabsTriggerVariantsProps, 'orientation'>> {\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * Whether to keep inactive tabs content in the DOM.\n * @default false\n */\n forceMount?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * @deprecated\n */\nexport type TabsRootProps = TabsProps\n\nexport const Tabs = ({\n intent = 'support',\n size = 'md',\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n asChild = false,\n forceMount = false,\n orientation = 'horizontal',\n children,\n className,\n ref,\n ...rest\n}: TabsProps) => {\n const renderSlot = useRenderSlot(asChild)\n\n return (\n <TabsContext\n value={{\n intent,\n size,\n orientation,\n forceMount,\n }}\n >\n <BaseTabs.Root\n ref={ref}\n orientation={orientation}\n className={rootStyles({ className })}\n data-spark-component=\"tabs\"\n render={renderSlot}\n {...rest}\n >\n {children}\n </BaseTabs.Root>\n </TabsContext>\n )\n}\n\nTabs.displayName = 'Tabs'\n","import { cva } from 'class-variance-authority'\n\nexport const contentStyles = cva(['w-full p-lg', 'focus-visible:u-outline-inset'], {\n variants: {\n forceMount: {\n true: 'data-[hidden]:hidden',\n false: '',\n },\n },\n})\n","import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { type ComponentProps, type PropsWithChildren, Ref } from 'react'\n\nimport { contentStyles } from './TabsContent.styles'\nimport { useTabsContext } from './TabsContext'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface TabsContentProps extends PropsWithChildren<\n Omit<ComponentProps<typeof BaseTabs.Panel>, 'keepMounted' | 'render'>\n> {\n /**\n * A unique value that associates the content with a trigger.\n */\n value: string\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true\n ref?: Ref<HTMLDivElement>\n}\n\n/** The panel that displays content associated with a tab. Renders a <div> element. */\nexport const TabsContent = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n children,\n asChild = false,\n className,\n ref,\n forceMount,\n ...rest\n}: TabsContentProps) => {\n const { forceMount: contextForceMount } = useTabsContext()\n const renderSlot = useRenderSlot(asChild)\n const keepMounted = contextForceMount || forceMount\n\n return (\n <BaseTabs.Panel\n data-spark-component=\"tabs-content\"\n ref={ref}\n keepMounted={keepMounted}\n className={contentStyles({ className, forceMount: keepMounted })}\n render={renderSlot}\n {...rest}\n >\n {children}\n </BaseTabs.Panel>\n )\n}\n\nTabsContent.displayName = 'Tabs.Content'\n","import { cva } from 'class-variance-authority'\n\nexport const wrapperStyles = cva(['relative flex'])\n\nexport const listStyles = cva([\n 'flex w-full',\n 'data-[orientation=horizontal]:flex-row',\n 'data-[orientation=vertical]:flex-col',\n 'overflow-y-hidden u-no-scrollbar data-[orientation=vertical]:overflow-x-hidden',\n 'after:flex after:shrink after:grow after:border-outline',\n 'data-[orientation=horizontal]:after:border-b-sm',\n 'data-[orientation=vertical]:after:border-r-sm',\n])\n\nexport const navigationArrowStyles = cva([\n 'h-auto! flex-none',\n 'border-b-sm border-outline',\n 'outline-hidden',\n 'focus-visible:border-none focus-visible:bg-surface-hovered focus-visible:u-outline-inset!',\n])\n","import { type RefObject, useEffect, useRef, useState } from 'react'\n\ninterface Size {\n width?: number\n height?: number\n}\n\ntype ResizeCallback = (entry?: ResizeObserverEntry) => void\n\nexport const useResizeObserver = <T extends HTMLElement>(\n target: RefObject<T | null> | T | null,\n onResize?: ResizeCallback\n): Size => {\n const [size, setSize] = useState<Size>({ width: undefined, height: undefined })\n const resizeObserverRef = useRef<ResizeObserver>(null)\n const resizeCallbackRef = useRef<ResizeCallback | undefined>(onResize)\n\n useEffect(() => {\n resizeCallbackRef.current = onResize\n }, [onResize])\n\n useEffect(() => {\n const targetElm = target && 'current' in target ? target.current : target\n if (!targetElm || resizeObserverRef.current) {\n return\n }\n\n resizeObserverRef.current = new ResizeObserver(([entry]) => {\n const { inlineSize: width, blockSize: height } = entry?.borderBoxSize?.[0] ?? {}\n resizeCallbackRef.current?.(entry)\n\n setSize({ width, height })\n })\n\n resizeObserverRef.current.observe(targetElm as unknown as HTMLElement)\n\n return () => {\n resizeObserverRef.current &&\n resizeObserverRef.current.unobserve(targetElm as unknown as HTMLElement)\n }\n }, [target, resizeObserverRef, resizeCallbackRef])\n\n return size\n}\n","/* eslint-disable max-lines-per-function */\nimport { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { ArrowVerticalLeft } from '@spark-ui/icons/ArrowVerticalLeft'\nimport { ArrowVerticalRight } from '@spark-ui/icons/ArrowVerticalRight'\nimport { type ComponentProps, type ReactElement, Ref, useEffect, useRef, useState } from 'react'\n\nimport { Button } from '../button'\nimport { Icon } from '../icon'\nimport { useTabsContext } from './TabsContext'\nimport { listStyles, navigationArrowStyles, wrapperStyles } from './TabsList.styles'\nimport { useRenderSlot } from './useRenderSlot'\nimport { useResizeObserver } from './useResizeObserver'\n\nexport interface TabsListProps extends Omit<\n ComponentProps<typeof BaseTabs.List>,\n 'render' | 'loopFocus'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * When true, keyboard navigation will loop from last tab to first, and vice versa.\n * @default false\n */\n loop?: boolean\n children: ReactElement[] | ReactElement\n ref?: Ref<HTMLDivElement>\n}\n\ntype ArrowState = 'visible' | 'hidden' | 'disabled'\n\n/** The container for the tab triggers. Renders a <div> element. */\nexport const TabsList = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n asChild = false,\n loop = false,\n children,\n className,\n ref,\n ...rest\n}: TabsListProps) => {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const innerRef = useRef(null)\n const listRef = ref || innerRef\n const { orientation } = useTabsContext()\n const renderSlot = useRenderSlot(asChild)\n\n const { width } = useResizeObserver(wrapperRef)\n\n const [arrows, setArrows] = useState<Record<'prev' | 'next', ArrowState>>({\n prev: 'hidden',\n next: 'hidden',\n })\n\n useEffect(() => {\n /**\n * Show/hide arrows\n */\n if (typeof listRef === 'function' || !listRef.current) {\n return\n }\n\n if (orientation !== 'horizontal') {\n setArrows({ prev: 'hidden', next: 'hidden' })\n } else {\n setArrows({\n prev: listRef.current.scrollWidth > listRef.current.clientWidth ? 'visible' : 'hidden',\n next: listRef.current.scrollWidth > listRef.current.clientWidth ? 'visible' : 'hidden',\n })\n }\n }, [orientation, listRef, width])\n\n useEffect(() => {\n /**\n * Enable/disable arrows\n */\n if (typeof listRef === 'function' || !listRef.current || arrows.prev === 'hidden' || loop) {\n return\n }\n\n const toggleArrowsVisibility = (target: HTMLDivElement) => {\n setArrows({\n prev: target.scrollLeft > 0 ? 'visible' : 'disabled',\n next: target.scrollLeft + target.clientWidth < target.scrollWidth ? 'visible' : 'disabled',\n })\n }\n\n const currentList = listRef.current\n\n toggleArrowsVisibility(currentList)\n\n currentList.addEventListener('scroll', ({ target }) =>\n toggleArrowsVisibility(target as HTMLDivElement)\n )\n\n return () =>\n currentList.removeEventListener('scroll', ({ target }) =>\n toggleArrowsVisibility(target as HTMLDivElement)\n )\n }, [listRef, arrows.prev, loop])\n\n const handlePrevClick = () => {\n if (typeof listRef === 'function' || !listRef.current) {\n return\n }\n\n const shouldLoopForward = loop && listRef.current.scrollLeft <= 0\n\n listRef.current.scrollTo({\n left: shouldLoopForward\n ? listRef.current.scrollLeft + listRef.current.scrollWidth - listRef.current.clientWidth\n : listRef.current.scrollLeft - listRef.current.clientWidth,\n behavior: 'smooth',\n })\n }\n\n const handleNextClick = () => {\n if (typeof listRef === 'function' || !listRef.current) {\n return\n }\n\n const shouldLoopBackward =\n loop &&\n listRef.current.scrollLeft + listRef.current.clientWidth >= listRef.current.scrollWidth\n\n listRef.current.scrollTo({\n left: shouldLoopBackward ? 0 : listRef.current.scrollLeft + listRef.current.clientWidth,\n behavior: 'smooth',\n })\n }\n\n return (\n <div className={wrapperStyles({ className })} ref={wrapperRef}>\n {arrows.prev !== 'hidden' && (\n <Button\n shape=\"square\"\n intent=\"surface\"\n size=\"sm\"\n className={navigationArrowStyles()}\n onClick={handlePrevClick}\n disabled={arrows.prev === 'disabled'}\n aria-label=\"Scroll left\"\n >\n <Icon>\n <ArrowVerticalLeft />\n </Icon>\n </Button>\n )}\n\n <BaseTabs.List\n data-spark-component=\"tabs-list\"\n ref={listRef}\n className={listStyles()}\n render={renderSlot}\n loopFocus={loop}\n activateOnFocus\n {...rest}\n >\n {children}\n </BaseTabs.List>\n\n {arrows.next !== 'hidden' && (\n <Button\n shape=\"square\"\n intent=\"surface\"\n size=\"sm\"\n className={navigationArrowStyles()}\n onClick={handleNextClick}\n disabled={arrows.next === 'disabled'}\n aria-label=\"Scroll right\"\n >\n <Icon>\n <ArrowVerticalRight />\n </Icon>\n </Button>\n )}\n </div>\n )\n}\n\nTabsList.displayName = 'Tabs.List'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { MoreMenuHorizontal } from '@spark-ui/icons/MoreMenuHorizontal'\nimport { cx } from 'class-variance-authority'\nimport {\n type ComponentType,\n createContext,\n forwardRef,\n type ReactNode,\n type RefObject,\n useContext,\n useMemo,\n} from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { Popover as SparkPopover } from '../popover'\nimport type { PopoverProps } from '../popover/Popover'\nimport type { ContentProps as PopoverContentProps } from '../popover/PopoverContent'\nimport type { TriggerProps as PopoverTriggerProps } from '../popover/PopoverTrigger'\n\ninterface TabsPopoverContextValue {\n popoverSide: 'right' | 'bottom'\n popoverTriggerRef: RefObject<HTMLButtonElement | null>\n}\n\nconst TabsPopoverContext = createContext<TabsPopoverContextValue | undefined>(undefined)\n\nconst useTabsPopoverContext = () => {\n const context = useContext(TabsPopoverContext)\n if (!context) {\n throw new Error('TabsPopover components must be used within TabsPopover')\n }\n\n return context\n}\n\n// Trigger component that uses context\ninterface TabsPopoverTriggerProps extends Omit<PopoverTriggerProps, 'asChild' | 'children'> {\n 'aria-label': string\n children?: ReactNode\n}\n\nconst TabsPopoverTrigger = forwardRef<HTMLButtonElement, TabsPopoverTriggerProps>(\n ({ 'aria-label': ariaLabel, children: iconChildren, ...triggerProps }, forwardedRef) => {\n const { popoverTriggerRef } = useTabsPopoverContext()\n const mergedRef = useMergeRefs(forwardedRef, popoverTriggerRef)\n\n return (\n <SparkPopover.Trigger asChild {...triggerProps}>\n <IconButton\n ref={mergedRef}\n size=\"sm\"\n intent=\"surfaceInverse\"\n design=\"ghost\"\n aria-label={ariaLabel}\n tabIndex={-1}\n >\n <Icon>{iconChildren || <MoreMenuHorizontal />}</Icon>\n </IconButton>\n </SparkPopover.Trigger>\n )\n }\n)\n\nTabsPopoverTrigger.displayName = 'Popover.Trigger'\n\n// Content component that uses context\nconst TabsPopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n ({ side, align = 'start', className, ...contentProps }, ref) => {\n const { popoverSide } = useTabsPopoverContext()\n const mergedClassName = cx('gap-sm flex flex-col', className)\n\n return (\n <SparkPopover.Content\n ref={ref}\n {...contentProps}\n side={side ?? popoverSide}\n align={align}\n className={mergedClassName}\n />\n )\n }\n)\n\nTabsPopoverContent.displayName = 'Popover.Content'\n\n// Export types\nexport type TabsPopoverTriggerComponent = typeof TabsPopoverTrigger\nexport type TabsPopoverContentComponent = typeof TabsPopoverContent\n\n// Create a type that extends SparkPopover but overrides Content and Trigger\n// Use ComponentType for JSX compatibility and Omit to exclude only Content and Trigger,\n// then add them back with the overridden types\nexport type ConfiguredPopoverComponent = ComponentType<PopoverProps> &\n Omit<typeof SparkPopover, 'Content' | 'Trigger'> & {\n Content: TabsPopoverContentComponent\n Trigger: TabsPopoverTriggerComponent\n }\n\ninterface PopoverAbstractionProps {\n popoverSide: 'right' | 'bottom'\n popoverTriggerRef: RefObject<HTMLButtonElement | null>\n children: (Popover: ConfiguredPopoverComponent) => ReactNode\n}\n\nexport const Popover = ({ popoverSide, popoverTriggerRef, children }: PopoverAbstractionProps) => {\n const contextValue = useMemo(\n () => ({ popoverSide, popoverTriggerRef }),\n [popoverSide, popoverTriggerRef]\n )\n\n const PopoverWrapper: typeof SparkPopover = ((props: PopoverProps) => (\n <TabsPopoverContext value={contextValue}>\n <SparkPopover {...props}>{props.children}</SparkPopover>\n </TabsPopoverContext>\n )) as typeof SparkPopover\n\n const PopoverComponent = Object.assign(PopoverWrapper, SparkPopover, {\n Content: TabsPopoverContent,\n Trigger: TabsPopoverTrigger,\n }) as ConfiguredPopoverComponent\n\n return <TabsPopoverContext value={contextValue}>{children(PopoverComponent)}</TabsPopoverContext>\n}\n\nPopover.displayName = 'Popover'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const triggerVariants = cva(\n [\n 'px-md',\n 'relative flex flex-none items-center',\n 'border-outline',\n 'hover:not-disabled:bg-surface-hovered',\n 'after:absolute',\n 'data-[active]:font-medium',\n 'not-data-[active]:not-disabled:cursor-pointer',\n 'data-[orientation=horizontal]:border-b-sm data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:bottom-[-1px] data-[orientation=horizontal]:after:h-sz-2',\n 'data-[orientation=vertical]:border-r-sm data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:right-[-1px] data-[orientation=vertical]:after:w-sz-2',\n 'focus-visible:border-none focus-visible:bg-surface-hovered focus-visible:u-outline-inset',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'gap-md [&>*:first-child]:ml-md [&>*:last-child]:mr-md',\n '[&>svg:last-child:first-child]:mx-auto',\n ],\n {\n variants: {\n /**\n * Change the color scheme of the tabs\n * @default support\n */\n intent: makeVariants<'intent', ['main', 'support']>({\n main: ['data-[active]:text-main data-[active]:after:bg-main'],\n support: ['data-[active]:text-support data-[active]:after:bg-support'],\n }),\n /**\n * Change the size of the tabs\n * @default md\n */\n size: {\n xs: ['h-sz-32 min-w-sz-32 text-caption'],\n sm: ['h-sz-36 min-w-sz-36 text-body-2'],\n md: ['h-sz-40 min-w-sz-40 text-body-1'],\n },\n hasMenu: {\n true: 'pr-3xl',\n },\n orientation: {\n horizontal: '',\n vertical: '',\n },\n },\n compoundVariants: [\n {\n hasMenu: true,\n orientation: 'vertical',\n class: 'w-full',\n },\n ],\n defaultVariants: {\n intent: 'support',\n size: 'md',\n hasMenu: false,\n orientation: 'horizontal',\n },\n }\n)\n\nexport type TabsTriggerVariantsProps = VariantProps<typeof triggerVariants>\n","import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { type ComponentProps, type FocusEvent, type ReactNode, Ref, useRef } from 'react'\n\ntype TabKeyDownEvent = Parameters<NonNullable<ComponentProps<typeof BaseTabs.Tab>['onKeyDown']>>[0]\n\nimport { useTabsContext } from './TabsContext'\nimport { type ConfiguredPopoverComponent, Popover } from './TabsPopoverAbstraction'\nimport { triggerVariants } from './TabsTrigger.styles'\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface TabsTriggerProps extends Omit<ComponentProps<typeof BaseTabs.Tab>, 'render'> {\n /**\n * A unique value that associates the trigger with a content.\n */\n value: string\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * When true, prevents the user from interacting with the tab.\n * @default false\n */\n disabled?: boolean\n /**\n * Function that receives a pre-configured Popover component and returns the popover structure.\n * @example\n * renderMenu={({ Popover }) => (\n * <Popover>\n * <Popover.Trigger aria-label=\"Options\">\n * <CustomIcon />\n * </Popover.Trigger>\n * <Popover.Content>\n * <Button>Action</Button>\n * </Popover.Content>\n * </Popover>\n * )}\n */\n renderMenu?: (props: { Popover: ConfiguredPopoverComponent }) => ReactNode\n ref?: Ref<HTMLButtonElement>\n}\n\n/** A button that activates a tab panel. Renders a <button> element. */\nexport const TabsTrigger = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n asChild = false,\n value,\n disabled = false,\n children,\n className,\n ref,\n onKeyDown,\n renderMenu,\n ...rest\n}: TabsTriggerProps) => {\n const { intent, size, orientation } = useTabsContext()\n const popoverTriggerRef = useRef<HTMLButtonElement>(null)\n const tabsTriggerRef = useRef<HTMLButtonElement>(null)\n const renderSlot = useRenderSlot(asChild)\n\n // Combine internal ref with forwarded ref\n const mergedRef = useMergeRefs(ref, tabsTriggerRef)\n\n const handleKeyDown = (e: TabKeyDownEvent) => {\n // Handle Shift+F10 for popover\n if (e.key === 'F10' && e.shiftKey && renderMenu && popoverTriggerRef.current) {\n e.preventDefault()\n popoverTriggerRef.current.click()\n }\n\n // Call original onKeyDown if provided\n onKeyDown?.(e)\n }\n\n const hasMenu = !!renderMenu\n const popoverSide = orientation === 'vertical' ? 'right' : 'bottom'\n\n const trigger = (\n <BaseTabs.Tab\n data-spark-component=\"tabs-trigger\"\n ref={mergedRef}\n className={triggerVariants({\n intent,\n size,\n hasMenu,\n orientation: orientation ?? 'horizontal',\n className,\n })}\n render={renderSlot}\n disabled={disabled}\n value={value}\n onFocus={({ target }: FocusEvent<HTMLButtonElement>) =>\n target.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n })\n }\n onKeyDown={handleKeyDown}\n aria-haspopup={hasMenu ? 'true' : undefined}\n {...rest}\n >\n {children}\n </BaseTabs.Tab>\n )\n\n if (!hasMenu) {\n return trigger\n }\n\n return (\n <div className={orientation === 'vertical' ? 'relative w-full' : 'relative'}>\n {trigger}\n <div className=\"right-md mr-md pointer-events-auto absolute top-1/2 -translate-y-1/2\">\n <Popover popoverSide={popoverSide} popoverTriggerRef={popoverTriggerRef}>\n {PopoverAbstraction => renderMenu?.({ Popover: PopoverAbstraction })}\n </Popover>\n </div>\n </div>\n )\n}\n\nTabsTrigger.displayName = 'Tabs.Trigger'\n","import { Tabs as Root } from './Tabs'\nimport { TabsContent as Content } from './TabsContent'\nimport { TabsList as List } from './TabsList'\nimport { TabsTrigger as Trigger } from './TabsTrigger'\n\n/**\n * A set of layered sections of content that users can navigate between using tab controls.\n */\nexport const Tabs: typeof Root & {\n List: typeof List\n Trigger: typeof Trigger\n Content: typeof Content\n} = Object.assign(Root, {\n List,\n Trigger,\n Content,\n})\n\nTabs.displayName = 'Tabs'\nList.displayName = 'Tabs.List'\nTrigger.displayName = 'Tabs.Trigger'\nContent.displayName = 'Tabs.Content'\n\nexport { type TabsContentProps } from './TabsContent'\nexport { type TabsListProps } from './TabsList'\nexport { type TabsProps, type TabsRootProps } from './Tabs'\nexport { type TabsTriggerProps } from './TabsTrigger'\n"],"mappings":";;;;;;;;;;;;;;;AASA,IAAa,IAAc,EAAoC,CAAC,CAAyB,GAE5E,UAAuB;CAClC,IAAM,IAAU,EAAW,CAAW;CAEtC,IAAI,CAAC,GACH,MAAM,MAAM,2DAA2D;CAGzE,OAAO;AACT,GCjBa,IAAa,EAAI;CAC5B;CACA;CACA;CACA;AACF,CAAC;;;ACLD,SAAgB,EAAc,GAAkB;CAC9C,OAAO,KAAW,EAAE,GAAG,QAAoB,kBAAC,GAAD,EAAM,GAAI,EAAQ,CAAA,IAAI,KAAA;AACnE;;;AC0BA,IAAa,KAAQ,EACnB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E;EACH;EACP,UAAU,EAAE,gBACV,EAAO,eAAe;GACpB,UAAU;GACV,OAAO;GACP,QAAQ;EACV,CAAC;EAEH,WAAW;EACX,iBAAe,IAAU,SAAS,KAAA;EAClC,GAAI;EAEH;CACW,CAAA;CAOhB,OAJK,IAKH,kBAAC,OAAD;EAAK,WAAW,MAAgB,aAAa,oBAAoB;YAAjE,CACG,GACD,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,GAAD;IAAsB;IAAgC;eACnD,MAAsB,IAAa,EAAE,SAAS,EAAmB,CAAC;GAC5D,CAAA;EACN,CAAA,CACF;MAXE;AAaX;AAEA,EAAY,cAAc;;;ACvH1B,IAAa,IAIT,OAAO,OAAO,GAAM;CACtB,MAAA;CACA,SAAA;CACA,SAAA;AACF,CAAC;AAED,EAAK,cAAc,QACnB,EAAK,cAAc,aACnB,EAAQ,cAAc,gBACtB,EAAQ,cAAc"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/tabs/TabsContext.tsx","../../src/tabs/TabsRoot.styles.ts","../../src/tabs/Tabs.tsx","../../src/tabs/TabsContent.styles.ts","../../src/tabs/TabsContent.tsx","../../src/tabs/TabsList.styles.ts","../../src/tabs/useResizeObserver.ts","../../src/tabs/TabsList.tsx","../../src/tabs/TabsPopoverAbstraction.tsx","../../src/tabs/TabsTrigger.styles.ts","../../src/tabs/TabsTrigger.tsx","../../src/tabs/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\n\nimport type { TabsTriggerVariantsProps } from './TabsTrigger.styles'\n\nexport type TabsContextInterface = TabsTriggerVariantsProps & {\n orientation?: 'horizontal' | 'vertical'\n forceMount?: boolean\n}\n\nexport const TabsContext = createContext<TabsContextInterface>({} as TabsContextInterface)\n\nexport const useTabsContext = () => {\n const context = useContext(TabsContext)\n\n if (!context) {\n throw Error('useTabsContext must be used within a TabsContext Provider')\n }\n\n return context\n}\n","import { cva } from 'class-variance-authority'\n\nexport const rootStyles = cva([\n 'flex',\n 'data-[orientation=horizontal]:flex-col',\n 'data-[orientation=vertical]:flex-row',\n 'max-w-full',\n])\n","import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { type ComponentProps, type PropsWithChildren, Ref } from 'react'\n\nimport { TabsContext } from './TabsContext'\nimport { rootStyles } from './TabsRoot.styles'\nimport type { TabsTriggerVariantsProps } from './TabsTrigger.styles'\n\nexport interface TabsProps\n extends\n Omit<ComponentProps<typeof BaseTabs.Root>, 'render'>,\n PropsWithChildren<Omit<TabsTriggerVariantsProps, 'orientation'>> {\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * Whether to keep inactive tabs content in the DOM.\n * @default false\n */\n forceMount?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\n/**\n * @deprecated\n */\nexport type TabsRootProps = TabsProps\n\nexport const Tabs = ({\n intent = 'support',\n size = 'md',\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n asChild = false,\n forceMount = false,\n orientation = 'horizontal',\n children,\n className,\n ref,\n ...rest\n}: TabsProps) => {\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n return (\n <TabsContext\n value={{\n intent,\n size,\n orientation,\n forceMount,\n }}\n >\n <BaseTabs.Root\n ref={ref}\n orientation={orientation}\n className={rootStyles({ className })}\n data-spark-component=\"tabs\"\n render={renderProp}\n {...rest}\n >\n {innerChildren}\n </BaseTabs.Root>\n </TabsContext>\n )\n}\n\nTabs.displayName = 'Tabs'\n","import { cva } from 'class-variance-authority'\n\nexport const contentStyles = cva(['w-full p-lg', 'focus-visible:u-outline-inset'], {\n variants: {\n forceMount: {\n true: 'data-[hidden]:hidden',\n false: '',\n },\n },\n})\n","import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { type ComponentProps, type PropsWithChildren, Ref } from 'react'\n\nimport { contentStyles } from './TabsContent.styles'\nimport { useTabsContext } from './TabsContext'\n\nexport interface TabsContentProps extends PropsWithChildren<\n Omit<ComponentProps<typeof BaseTabs.Panel>, 'keepMounted' | 'render'>\n> {\n /**\n * A unique value that associates the content with a trigger.\n */\n value: string\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries.\n */\n forceMount?: true\n ref?: Ref<HTMLDivElement>\n}\n\n/** The panel that displays content associated with a tab. Renders a <div> element. */\nexport const TabsContent = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n children,\n asChild = false,\n className,\n ref,\n forceMount,\n ...rest\n}: TabsContentProps) => {\n const { forceMount: contextForceMount } = useTabsContext()\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n const keepMounted = contextForceMount || forceMount\n\n return (\n <BaseTabs.Panel\n data-spark-component=\"tabs-content\"\n ref={ref}\n keepMounted={keepMounted}\n className={contentStyles({ className, forceMount: keepMounted })}\n render={renderProp}\n {...rest}\n >\n {innerChildren}\n </BaseTabs.Panel>\n )\n}\n\nTabsContent.displayName = 'Tabs.Content'\n","import { cva } from 'class-variance-authority'\n\nexport const wrapperStyles = cva(['relative flex'])\n\nexport const listStyles = cva([\n 'flex w-full',\n 'data-[orientation=horizontal]:flex-row',\n 'data-[orientation=vertical]:flex-col',\n 'overflow-y-hidden u-no-scrollbar data-[orientation=vertical]:overflow-x-hidden',\n 'after:flex after:shrink after:grow after:border-outline',\n 'data-[orientation=horizontal]:after:border-b-sm',\n 'data-[orientation=vertical]:after:border-r-sm',\n])\n\nexport const navigationArrowStyles = cva([\n 'h-auto! flex-none',\n 'border-b-sm border-outline',\n 'outline-hidden',\n 'focus-visible:border-none focus-visible:bg-surface-hovered focus-visible:u-outline-inset!',\n])\n","import { type RefObject, useEffect, useRef, useState } from 'react'\n\ninterface Size {\n width?: number\n height?: number\n}\n\ntype ResizeCallback = (entry?: ResizeObserverEntry) => void\n\nexport const useResizeObserver = <T extends HTMLElement>(\n target: RefObject<T | null> | T | null,\n onResize?: ResizeCallback\n): Size => {\n const [size, setSize] = useState<Size>({ width: undefined, height: undefined })\n const resizeObserverRef = useRef<ResizeObserver>(null)\n const resizeCallbackRef = useRef<ResizeCallback | undefined>(onResize)\n\n useEffect(() => {\n resizeCallbackRef.current = onResize\n }, [onResize])\n\n useEffect(() => {\n const targetElm = target && 'current' in target ? target.current : target\n if (!targetElm || resizeObserverRef.current) {\n return\n }\n\n resizeObserverRef.current = new ResizeObserver(([entry]) => {\n const { inlineSize: width, blockSize: height } = entry?.borderBoxSize?.[0] ?? {}\n resizeCallbackRef.current?.(entry)\n\n setSize({ width, height })\n })\n\n resizeObserverRef.current.observe(targetElm as unknown as HTMLElement)\n\n return () => {\n resizeObserverRef.current &&\n resizeObserverRef.current.unobserve(targetElm as unknown as HTMLElement)\n }\n }, [target, resizeObserverRef, resizeCallbackRef])\n\n return size\n}\n","/* eslint-disable max-lines-per-function */\nimport { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { ArrowVerticalLeft } from '@spark-ui/icons/ArrowVerticalLeft'\nimport { ArrowVerticalRight } from '@spark-ui/icons/ArrowVerticalRight'\nimport { createRenderSlot } from '@spark-ui/internal-utils'\nimport { type ComponentProps, type ReactElement, Ref, useEffect, useRef, useState } from 'react'\n\nimport { Button } from '../button'\nimport { Icon } from '../icon'\nimport { useTabsContext } from './TabsContext'\nimport { listStyles, navigationArrowStyles, wrapperStyles } from './TabsList.styles'\nimport { useResizeObserver } from './useResizeObserver'\n\nexport interface TabsListProps extends Omit<\n ComponentProps<typeof BaseTabs.List>,\n 'render' | 'loopFocus'\n> {\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * When true, keyboard navigation will loop from last tab to first, and vice versa.\n * @default false\n */\n loop?: boolean\n children: ReactElement[] | ReactElement\n ref?: Ref<HTMLDivElement>\n}\n\ntype ArrowState = 'visible' | 'hidden' | 'disabled'\n\n/** The container for the tab triggers. Renders a <div> element. */\nexport const TabsList = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n asChild = false,\n loop = false,\n children,\n className,\n ref,\n ...rest\n}: TabsListProps) => {\n const wrapperRef = useRef<HTMLDivElement>(null)\n const innerRef = useRef(null)\n const listRef = ref || innerRef\n const { orientation } = useTabsContext()\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n const { width } = useResizeObserver(wrapperRef)\n\n const [arrows, setArrows] = useState<Record<'prev' | 'next', ArrowState>>({\n prev: 'hidden',\n next: 'hidden',\n })\n\n useEffect(() => {\n /**\n * Show/hide arrows\n */\n if (typeof listRef === 'function' || !listRef.current) {\n return\n }\n\n if (orientation !== 'horizontal') {\n setArrows({ prev: 'hidden', next: 'hidden' })\n } else {\n setArrows({\n prev: listRef.current.scrollWidth > listRef.current.clientWidth ? 'visible' : 'hidden',\n next: listRef.current.scrollWidth > listRef.current.clientWidth ? 'visible' : 'hidden',\n })\n }\n }, [orientation, listRef, width])\n\n useEffect(() => {\n /**\n * Enable/disable arrows\n */\n if (typeof listRef === 'function' || !listRef.current || arrows.prev === 'hidden' || loop) {\n return\n }\n\n const toggleArrowsVisibility = (target: HTMLDivElement) => {\n setArrows({\n prev: target.scrollLeft > 0 ? 'visible' : 'disabled',\n next: target.scrollLeft + target.clientWidth < target.scrollWidth ? 'visible' : 'disabled',\n })\n }\n\n const currentList = listRef.current\n\n toggleArrowsVisibility(currentList)\n\n currentList.addEventListener('scroll', ({ target }) =>\n toggleArrowsVisibility(target as HTMLDivElement)\n )\n\n return () =>\n currentList.removeEventListener('scroll', ({ target }) =>\n toggleArrowsVisibility(target as HTMLDivElement)\n )\n }, [listRef, arrows.prev, loop])\n\n const handlePrevClick = () => {\n if (typeof listRef === 'function' || !listRef.current) {\n return\n }\n\n const shouldLoopForward = loop && listRef.current.scrollLeft <= 0\n\n listRef.current.scrollTo({\n left: shouldLoopForward\n ? listRef.current.scrollLeft + listRef.current.scrollWidth - listRef.current.clientWidth\n : listRef.current.scrollLeft - listRef.current.clientWidth,\n behavior: 'smooth',\n })\n }\n\n const handleNextClick = () => {\n if (typeof listRef === 'function' || !listRef.current) {\n return\n }\n\n const shouldLoopBackward =\n loop &&\n listRef.current.scrollLeft + listRef.current.clientWidth >= listRef.current.scrollWidth\n\n listRef.current.scrollTo({\n left: shouldLoopBackward ? 0 : listRef.current.scrollLeft + listRef.current.clientWidth,\n behavior: 'smooth',\n })\n }\n\n return (\n <div className={wrapperStyles({ className })} ref={wrapperRef}>\n {arrows.prev !== 'hidden' && (\n <Button\n shape=\"square\"\n intent=\"surface\"\n size=\"sm\"\n className={navigationArrowStyles()}\n onClick={handlePrevClick}\n disabled={arrows.prev === 'disabled'}\n aria-label=\"Scroll left\"\n >\n <Icon>\n <ArrowVerticalLeft />\n </Icon>\n </Button>\n )}\n\n <BaseTabs.List\n data-spark-component=\"tabs-list\"\n ref={listRef}\n className={listStyles()}\n render={renderProp}\n loopFocus={loop}\n activateOnFocus\n {...rest}\n >\n {innerChildren}\n </BaseTabs.List>\n\n {arrows.next !== 'hidden' && (\n <Button\n shape=\"square\"\n intent=\"surface\"\n size=\"sm\"\n className={navigationArrowStyles()}\n onClick={handleNextClick}\n disabled={arrows.next === 'disabled'}\n aria-label=\"Scroll right\"\n >\n <Icon>\n <ArrowVerticalRight />\n </Icon>\n </Button>\n )}\n </div>\n )\n}\n\nTabsList.displayName = 'Tabs.List'\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { MoreMenuHorizontal } from '@spark-ui/icons/MoreMenuHorizontal'\nimport { cx } from 'class-variance-authority'\nimport {\n type ComponentType,\n createContext,\n forwardRef,\n type ReactNode,\n type RefObject,\n useContext,\n useMemo,\n} from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton } from '../icon-button'\nimport { Popover as SparkPopover } from '../popover'\nimport type { PopoverProps } from '../popover/Popover'\nimport type { ContentProps as PopoverContentProps } from '../popover/PopoverContent'\nimport type { TriggerProps as PopoverTriggerProps } from '../popover/PopoverTrigger'\n\ninterface TabsPopoverContextValue {\n popoverSide: 'right' | 'bottom'\n popoverTriggerRef: RefObject<HTMLButtonElement | null>\n}\n\nconst TabsPopoverContext = createContext<TabsPopoverContextValue | undefined>(undefined)\n\nconst useTabsPopoverContext = () => {\n const context = useContext(TabsPopoverContext)\n if (!context) {\n throw new Error('TabsPopover components must be used within TabsPopover')\n }\n\n return context\n}\n\n// Trigger component that uses context\ninterface TabsPopoverTriggerProps extends Omit<PopoverTriggerProps, 'asChild' | 'children'> {\n 'aria-label': string\n children?: ReactNode\n}\n\nconst TabsPopoverTrigger = forwardRef<HTMLButtonElement, TabsPopoverTriggerProps>(\n ({ 'aria-label': ariaLabel, children: iconChildren, ...triggerProps }, forwardedRef) => {\n const { popoverTriggerRef } = useTabsPopoverContext()\n const mergedRef = useMergeRefs(forwardedRef, popoverTriggerRef)\n\n return (\n <SparkPopover.Trigger asChild {...triggerProps}>\n <IconButton\n ref={mergedRef}\n size=\"sm\"\n intent=\"surfaceInverse\"\n design=\"ghost\"\n aria-label={ariaLabel}\n tabIndex={-1}\n >\n <Icon>{iconChildren || <MoreMenuHorizontal />}</Icon>\n </IconButton>\n </SparkPopover.Trigger>\n )\n }\n)\n\nTabsPopoverTrigger.displayName = 'Popover.Trigger'\n\n// Content component that uses context\nconst TabsPopoverContent = forwardRef<HTMLDivElement, PopoverContentProps>(\n ({ side, align = 'start', className, ...contentProps }, ref) => {\n const { popoverSide } = useTabsPopoverContext()\n const mergedClassName = cx('gap-sm flex flex-col', className)\n\n return (\n <SparkPopover.Content\n ref={ref}\n {...contentProps}\n side={side ?? popoverSide}\n align={align}\n className={mergedClassName}\n />\n )\n }\n)\n\nTabsPopoverContent.displayName = 'Popover.Content'\n\n// Export types\nexport type TabsPopoverTriggerComponent = typeof TabsPopoverTrigger\nexport type TabsPopoverContentComponent = typeof TabsPopoverContent\n\n// Create a type that extends SparkPopover but overrides Content and Trigger\n// Use ComponentType for JSX compatibility and Omit to exclude only Content and Trigger,\n// then add them back with the overridden types\nexport type ConfiguredPopoverComponent = ComponentType<PopoverProps> &\n Omit<typeof SparkPopover, 'Content' | 'Trigger'> & {\n Content: TabsPopoverContentComponent\n Trigger: TabsPopoverTriggerComponent\n }\n\ninterface PopoverAbstractionProps {\n popoverSide: 'right' | 'bottom'\n popoverTriggerRef: RefObject<HTMLButtonElement | null>\n children: (Popover: ConfiguredPopoverComponent) => ReactNode\n}\n\nexport const Popover = ({ popoverSide, popoverTriggerRef, children }: PopoverAbstractionProps) => {\n const contextValue = useMemo(\n () => ({ popoverSide, popoverTriggerRef }),\n [popoverSide, popoverTriggerRef]\n )\n\n const PopoverWrapper: typeof SparkPopover = ((props: PopoverProps) => (\n <TabsPopoverContext value={contextValue}>\n <SparkPopover {...props}>{props.children}</SparkPopover>\n </TabsPopoverContext>\n )) as typeof SparkPopover\n\n const PopoverComponent = Object.assign(PopoverWrapper, SparkPopover, {\n Content: TabsPopoverContent,\n Trigger: TabsPopoverTrigger,\n }) as ConfiguredPopoverComponent\n\n return <TabsPopoverContext value={contextValue}>{children(PopoverComponent)}</TabsPopoverContext>\n}\n\nPopover.displayName = 'Popover'\n","import { makeVariants } from '@spark-ui/internal-utils'\nimport { cva, VariantProps } from 'class-variance-authority'\n\nexport const triggerVariants = cva(\n [\n 'px-md',\n 'relative flex flex-none items-center',\n 'border-outline',\n 'hover:not-disabled:bg-surface-hovered',\n 'after:absolute',\n 'data-[active]:font-medium',\n 'not-data-[active]:not-disabled:cursor-pointer',\n 'data-[orientation=horizontal]:border-b-sm data-[orientation=horizontal]:after:inset-x-0 data-[orientation=horizontal]:after:bottom-[-1px] data-[orientation=horizontal]:after:h-sz-2',\n 'data-[orientation=vertical]:border-r-sm data-[orientation=vertical]:after:inset-y-0 data-[orientation=vertical]:after:right-[-1px] data-[orientation=vertical]:after:w-sz-2',\n 'focus-visible:border-none focus-visible:bg-surface-hovered focus-visible:u-outline-inset',\n 'disabled:cursor-not-allowed disabled:opacity-dim-3',\n 'gap-md [&>*:first-child]:ml-md [&>*:last-child]:mr-md',\n '[&>svg:last-child:first-child]:mx-auto',\n ],\n {\n variants: {\n /**\n * Change the color scheme of the tabs\n * @default support\n */\n intent: makeVariants<'intent', ['main', 'support']>({\n main: ['data-[active]:text-main data-[active]:after:bg-main'],\n support: ['data-[active]:text-support data-[active]:after:bg-support'],\n }),\n /**\n * Change the size of the tabs\n * @default md\n */\n size: {\n xs: ['h-sz-32 min-w-sz-32 text-caption'],\n sm: ['h-sz-36 min-w-sz-36 text-body-2'],\n md: ['h-sz-40 min-w-sz-40 text-body-1'],\n },\n hasMenu: {\n true: 'pr-3xl',\n },\n orientation: {\n horizontal: '',\n vertical: '',\n },\n },\n compoundVariants: [\n {\n hasMenu: true,\n orientation: 'vertical',\n class: 'w-full',\n },\n ],\n defaultVariants: {\n intent: 'support',\n size: 'md',\n hasMenu: false,\n orientation: 'horizontal',\n },\n }\n)\n\nexport type TabsTriggerVariantsProps = VariantProps<typeof triggerVariants>\n","import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { type ComponentProps, type FocusEvent, type ReactNode, Ref, useRef } from 'react'\n\ntype TabKeyDownEvent = Parameters<NonNullable<ComponentProps<typeof BaseTabs.Tab>['onKeyDown']>>[0]\n\nimport { createRenderSlot } from '@spark-ui/internal-utils'\n\nimport { useTabsContext } from './TabsContext'\nimport { type ConfiguredPopoverComponent, Popover } from './TabsPopoverAbstraction'\nimport { triggerVariants } from './TabsTrigger.styles'\n\nexport interface TabsTriggerProps extends Omit<ComponentProps<typeof BaseTabs.Tab>, 'render'> {\n /**\n * A unique value that associates the trigger with a content.\n */\n value: string\n /**\n * Change the component to the HTML tag or custom component of the only child. 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 /**\n * When true, prevents the user from interacting with the tab.\n * @default false\n */\n disabled?: boolean\n /**\n * Function that receives a pre-configured Popover component and returns the popover structure.\n * @example\n * renderMenu={({ Popover }) => (\n * <Popover>\n * <Popover.Trigger aria-label=\"Options\">\n * <CustomIcon />\n * </Popover.Trigger>\n * <Popover.Content>\n * <Button>Action</Button>\n * </Popover.Content>\n * </Popover>\n * )}\n */\n renderMenu?: (props: { Popover: ConfiguredPopoverComponent }) => ReactNode\n ref?: Ref<HTMLButtonElement>\n}\n\n/** A button that activates a tab panel. Renders a <button> element. */\nexport const TabsTrigger = ({\n /**\n * Default Base UI Primitive values\n * see https://base-ui.com/react/components/tabs\n */\n asChild = false,\n value,\n disabled = false,\n children,\n className,\n ref,\n onKeyDown,\n renderMenu,\n ...rest\n}: TabsTriggerProps) => {\n const { intent, size, orientation } = useTabsContext()\n const popoverTriggerRef = useRef<HTMLButtonElement>(null)\n const tabsTriggerRef = useRef<HTMLButtonElement>(null)\n\n // Combine internal ref with forwarded ref\n const mergedRef = useMergeRefs(ref, tabsTriggerRef)\n\n const { renderProp, innerChildren } = createRenderSlot(asChild, children)\n\n const handleKeyDown = (e: TabKeyDownEvent) => {\n // Handle Shift+F10 for popover\n if (e.key === 'F10' && e.shiftKey && renderMenu && popoverTriggerRef.current) {\n e.preventDefault()\n popoverTriggerRef.current.click()\n }\n\n // Call original onKeyDown if provided\n onKeyDown?.(e)\n }\n\n const hasMenu = !!renderMenu\n const popoverSide = orientation === 'vertical' ? 'right' : 'bottom'\n\n const trigger = (\n <BaseTabs.Tab\n data-spark-component=\"tabs-trigger\"\n ref={mergedRef}\n className={triggerVariants({\n intent,\n size,\n hasMenu,\n orientation: orientation ?? 'horizontal',\n className,\n })}\n render={renderProp}\n disabled={disabled}\n value={value}\n onFocus={({ target }: FocusEvent<HTMLButtonElement>) =>\n target.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n })\n }\n onKeyDown={handleKeyDown}\n aria-haspopup={hasMenu ? 'true' : undefined}\n {...rest}\n >\n {innerChildren}\n </BaseTabs.Tab>\n )\n\n if (!hasMenu) {\n return trigger\n }\n\n return (\n <div className={orientation === 'vertical' ? 'relative w-full' : 'relative'}>\n {trigger}\n <div className=\"right-md mr-md pointer-events-auto absolute top-1/2 -translate-y-1/2\">\n <Popover popoverSide={popoverSide} popoverTriggerRef={popoverTriggerRef}>\n {PopoverAbstraction => renderMenu?.({ Popover: PopoverAbstraction })}\n </Popover>\n </div>\n </div>\n )\n}\n\nTabsTrigger.displayName = 'Tabs.Trigger'\n","import { Tabs as Root } from './Tabs'\nimport { TabsContent as Content } from './TabsContent'\nimport { TabsList as List } from './TabsList'\nimport { TabsTrigger as Trigger } from './TabsTrigger'\n\n/**\n * A set of layered sections of content that users can navigate between using tab controls.\n */\nexport const Tabs: typeof Root & {\n List: typeof List\n Trigger: typeof Trigger\n Content: typeof Content\n} = Object.assign(Root, {\n List,\n Trigger,\n Content,\n})\n\nTabs.displayName = 'Tabs'\nList.displayName = 'Tabs.List'\nTrigger.displayName = 'Tabs.Trigger'\nContent.displayName = 'Tabs.Content'\n\nexport { type TabsContentProps } from './TabsContent'\nexport { type TabsListProps } from './TabsList'\nexport { type TabsProps, type TabsRootProps } from './Tabs'\nexport { type TabsTriggerProps } from './TabsTrigger'\n"],"mappings":";;;;;;;;;;;;;;AASA,IAAa,IAAc,EAAoC,CAAC,CAAyB,GAE5E,UAAuB;CAClC,IAAM,IAAU,EAAW,CAAW;CAEtC,IAAI,CAAC,GACH,MAAM,MAAM,2DAA2D;CAGzE,OAAO;AACT,GCjBa,IAAa,EAAI;CAC5B;CACA;CACA;CACA;AACF,CAAC,GCuBY,KAAQ,EACnB,YAAS,WACT,UAAO,MAKP,aAAU,IACV,gBAAa,IACb,iBAAc,cACd,aACA,cACA,QACA,GAAG,QACY;CACf,IAAM,EAAE,eAAY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EAAO,eAAe;GACpB,UAAU;GACV,OAAO;GACP,QAAQ;EACV,CAAC;EAEH,WAAW;EACX,iBAAe,IAAU,SAAS,KAAA;EAClC,GAAI;YAEH;CACW,CAAA;CAOhB,OAJK,IAKH,kBAAC,OAAD;EAAK,WAAW,MAAgB,aAAa,oBAAoB;YAAjE,CACG,GACD,kBAAC,OAAD;GAAK,WAAU;aACb,kBAAC,GAAD;IAAsB;IAAgC;eACnD,MAAsB,IAAa,EAAE,SAAS,EAAmB,CAAC;GAC5D,CAAA;EACN,CAAA,CACF;MAXE;AAaX;AAEA,EAAY,cAAc;;;ACzH1B,IAAa,IAIT,OAAO,OAAO,GAAM;CACtB,MAAA;CACA,SAAA;CACA,SAAA;AACF,CAAC;AAED,EAAK,cAAc,QACnB,EAAK,cAAc,aACnB,EAAQ,cAAc,gBACtB,EAAQ,cAAc"}
|
package/dist/tag/Tag.styles.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export declare const tagStyles: (props?: ({
|
|
|
3
3
|
design?: "filled" | "outlined" | "tinted" | null | undefined;
|
|
4
4
|
size?: "md" | "lg" | null | undefined;
|
|
5
5
|
shape?: "square" | "rounded" | "pill" | null | undefined;
|
|
6
|
-
intent?: "main" | "
|
|
6
|
+
intent?: "main" | "surface" | "support" | "alert" | "accent" | "success" | "info" | "neutral" | "ai" | "danger" | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
8
8
|
export type TagStylesProps = VariantProps<typeof tagStyles>;
|
package/dist/tag/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../slot/index.js");let t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../slot/index.js");let t=require("@spark-ui/internal-utils"),n=require("class-variance-authority"),r=require("react/jsx-runtime");var i=[{intent:`main`,design:`filled`,class:(0,t.tw)([`bg-main`,`text-on-main`])},{intent:`support`,design:`filled`,class:(0,t.tw)([`bg-support`,`text-on-support`])},{intent:`accent`,design:`filled`,class:(0,t.tw)([`bg-accent`,`text-on-accent`])},{intent:`success`,design:`filled`,class:(0,t.tw)([`bg-success`,`text-on-success`])},{intent:`alert`,design:`filled`,class:(0,t.tw)([`bg-alert`,`text-on-alert`])},{intent:`danger`,design:`filled`,class:(0,t.tw)([`bg-error`,`text-on-error`])},{intent:`info`,design:`filled`,class:(0,t.tw)([`bg-info`,`text-on-info`])},{intent:`neutral`,design:`filled`,class:(0,t.tw)([`bg-neutral`,`text-on-neutral`])},{intent:`surface`,design:`filled`,class:(0,t.tw)([`bg-surface`,`text-on-surface`])}],a=[{intent:`main`,design:`outlined`,class:(0,t.tw)([`text-main`])},{intent:`support`,design:`outlined`,class:(0,t.tw)([`text-support`])},{intent:`accent`,design:`outlined`,class:(0,t.tw)([`text-accent`])},{intent:`success`,design:`outlined`,class:(0,t.tw)([`text-success`])},{intent:`alert`,design:`outlined`,class:(0,t.tw)([`text-alert`])},{intent:`danger`,design:`outlined`,class:(0,t.tw)([`text-error`])},{intent:`info`,design:`outlined`,class:(0,t.tw)([`text-info`])},{intent:`neutral`,design:`outlined`,class:(0,t.tw)([`text-neutral`])}],o=[{intent:`main`,design:`tinted`,class:(0,t.tw)([`bg-main-container`,`text-on-main-container`])},{intent:`support`,design:`tinted`,class:(0,t.tw)([`bg-support-container`,`text-on-support-container`])},{intent:`accent`,design:`tinted`,class:(0,t.tw)([`bg-accent-container`,`text-on-accent-container`])},{intent:`success`,design:`tinted`,class:(0,t.tw)([`bg-success-container`,`text-on-success-container`])},{intent:`alert`,design:`tinted`,class:(0,t.tw)([`bg-alert-container`,`text-on-alert-container`])},{intent:`danger`,design:`tinted`,class:(0,t.tw)([`bg-error-container`,`text-on-error-container`])},{intent:`info`,design:`tinted`,class:(0,t.tw)([`bg-info-container`,`text-on-info-container`])},{intent:`neutral`,design:`tinted`,class:(0,t.tw)([`bg-neutral-container`,`text-on-neutral-container`])},{intent:`ai`,design:`tinted`,class:(0,t.tw)([`bg-ai-container`,`text-on-ai-container`])}],s=(0,n.cva)([`box-border default:inline-flex default:w-fit items-center justify-center gap-sm whitespace-nowrap`,`text-caption-highlight`,`px-md`],{variants:{design:(0,t.makeVariants)({filled:[],outlined:[`border-sm`,`border-current`],tinted:[]}),size:(0,t.makeVariants)({md:[`h-sz-20`],lg:[`h-sz-24`]}),shape:(0,t.makeVariants)({square:[],rounded:[`rounded-tag`],pill:[`rounded-full`]}),intent:(0,t.makeVariants)({main:[],support:[],accent:[],success:[],alert:[],danger:[],info:[],neutral:[],surface:[],ai:[]})},compoundVariants:[...i,...a,...o],defaultVariants:{design:`filled`,intent:`support`,size:`md`,shape:`pill`}}),c=({design:t=`filled`,intent:n=`support`,size:i=`md`,shape:a=`rounded`,asChild:o,className:c,ref:l,...u})=>(0,r.jsx)(o?e.Slot:`span`,{"data-spark-component":`tag`,ref:l,className:s({className:c,design:t,intent:n,size:i,shape:a}),...u});exports.Tag=c;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/tag/index.mjs
CHANGED
|
@@ -1,162 +1,162 @@
|
|
|
1
1
|
import { Slot as e } from "../slot/index.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { makeVariants as t, tw as n } from "@spark-ui/internal-utils";
|
|
3
|
+
import { cva as r } from "class-variance-authority";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
5
|
//#region src/tag/variants/filled.ts
|
|
6
6
|
var a = [
|
|
7
7
|
{
|
|
8
8
|
intent: "main",
|
|
9
9
|
design: "filled",
|
|
10
|
-
class:
|
|
10
|
+
class: n(["bg-main", "text-on-main"])
|
|
11
11
|
},
|
|
12
12
|
{
|
|
13
13
|
intent: "support",
|
|
14
14
|
design: "filled",
|
|
15
|
-
class:
|
|
15
|
+
class: n(["bg-support", "text-on-support"])
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
intent: "accent",
|
|
19
19
|
design: "filled",
|
|
20
|
-
class:
|
|
20
|
+
class: n(["bg-accent", "text-on-accent"])
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
intent: "success",
|
|
24
24
|
design: "filled",
|
|
25
|
-
class:
|
|
25
|
+
class: n(["bg-success", "text-on-success"])
|
|
26
26
|
},
|
|
27
27
|
{
|
|
28
28
|
intent: "alert",
|
|
29
29
|
design: "filled",
|
|
30
|
-
class:
|
|
30
|
+
class: n(["bg-alert", "text-on-alert"])
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
intent: "danger",
|
|
34
34
|
design: "filled",
|
|
35
|
-
class:
|
|
35
|
+
class: n(["bg-error", "text-on-error"])
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
intent: "info",
|
|
39
39
|
design: "filled",
|
|
40
|
-
class:
|
|
40
|
+
class: n(["bg-info", "text-on-info"])
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
intent: "neutral",
|
|
44
44
|
design: "filled",
|
|
45
|
-
class:
|
|
45
|
+
class: n(["bg-neutral", "text-on-neutral"])
|
|
46
46
|
},
|
|
47
47
|
{
|
|
48
48
|
intent: "surface",
|
|
49
49
|
design: "filled",
|
|
50
|
-
class:
|
|
50
|
+
class: n(["bg-surface", "text-on-surface"])
|
|
51
51
|
}
|
|
52
52
|
], o = [
|
|
53
53
|
{
|
|
54
54
|
intent: "main",
|
|
55
55
|
design: "outlined",
|
|
56
|
-
class:
|
|
56
|
+
class: n(["text-main"])
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
intent: "support",
|
|
60
60
|
design: "outlined",
|
|
61
|
-
class:
|
|
61
|
+
class: n(["text-support"])
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
intent: "accent",
|
|
65
65
|
design: "outlined",
|
|
66
|
-
class:
|
|
66
|
+
class: n(["text-accent"])
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
intent: "success",
|
|
70
70
|
design: "outlined",
|
|
71
|
-
class:
|
|
71
|
+
class: n(["text-success"])
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
intent: "alert",
|
|
75
75
|
design: "outlined",
|
|
76
|
-
class:
|
|
76
|
+
class: n(["text-alert"])
|
|
77
77
|
},
|
|
78
78
|
{
|
|
79
79
|
intent: "danger",
|
|
80
80
|
design: "outlined",
|
|
81
|
-
class:
|
|
81
|
+
class: n(["text-error"])
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
84
|
intent: "info",
|
|
85
85
|
design: "outlined",
|
|
86
|
-
class:
|
|
86
|
+
class: n(["text-info"])
|
|
87
87
|
},
|
|
88
88
|
{
|
|
89
89
|
intent: "neutral",
|
|
90
90
|
design: "outlined",
|
|
91
|
-
class:
|
|
91
|
+
class: n(["text-neutral"])
|
|
92
92
|
}
|
|
93
93
|
], s = [
|
|
94
94
|
{
|
|
95
95
|
intent: "main",
|
|
96
96
|
design: "tinted",
|
|
97
|
-
class:
|
|
97
|
+
class: n(["bg-main-container", "text-on-main-container"])
|
|
98
98
|
},
|
|
99
99
|
{
|
|
100
100
|
intent: "support",
|
|
101
101
|
design: "tinted",
|
|
102
|
-
class:
|
|
102
|
+
class: n(["bg-support-container", "text-on-support-container"])
|
|
103
103
|
},
|
|
104
104
|
{
|
|
105
105
|
intent: "accent",
|
|
106
106
|
design: "tinted",
|
|
107
|
-
class:
|
|
107
|
+
class: n(["bg-accent-container", "text-on-accent-container"])
|
|
108
108
|
},
|
|
109
109
|
{
|
|
110
110
|
intent: "success",
|
|
111
111
|
design: "tinted",
|
|
112
|
-
class:
|
|
112
|
+
class: n(["bg-success-container", "text-on-success-container"])
|
|
113
113
|
},
|
|
114
114
|
{
|
|
115
115
|
intent: "alert",
|
|
116
116
|
design: "tinted",
|
|
117
|
-
class:
|
|
117
|
+
class: n(["bg-alert-container", "text-on-alert-container"])
|
|
118
118
|
},
|
|
119
119
|
{
|
|
120
120
|
intent: "danger",
|
|
121
121
|
design: "tinted",
|
|
122
|
-
class:
|
|
122
|
+
class: n(["bg-error-container", "text-on-error-container"])
|
|
123
123
|
},
|
|
124
124
|
{
|
|
125
125
|
intent: "info",
|
|
126
126
|
design: "tinted",
|
|
127
|
-
class:
|
|
127
|
+
class: n(["bg-info-container", "text-on-info-container"])
|
|
128
128
|
},
|
|
129
129
|
{
|
|
130
130
|
intent: "neutral",
|
|
131
131
|
design: "tinted",
|
|
132
|
-
class:
|
|
132
|
+
class: n(["bg-neutral-container", "text-on-neutral-container"])
|
|
133
133
|
},
|
|
134
134
|
{
|
|
135
135
|
intent: "ai",
|
|
136
136
|
design: "tinted",
|
|
137
|
-
class:
|
|
137
|
+
class: n(["bg-ai-container", "text-on-ai-container"])
|
|
138
138
|
}
|
|
139
|
-
], c =
|
|
139
|
+
], c = r([
|
|
140
140
|
"box-border default:inline-flex default:w-fit items-center justify-center gap-sm whitespace-nowrap",
|
|
141
141
|
"text-caption-highlight",
|
|
142
142
|
"px-md"
|
|
143
143
|
], {
|
|
144
144
|
variants: {
|
|
145
|
-
design:
|
|
145
|
+
design: t({
|
|
146
146
|
filled: [],
|
|
147
147
|
outlined: ["border-sm", "border-current"],
|
|
148
148
|
tinted: []
|
|
149
149
|
}),
|
|
150
|
-
size:
|
|
150
|
+
size: t({
|
|
151
151
|
md: ["h-sz-20"],
|
|
152
152
|
lg: ["h-sz-24"]
|
|
153
153
|
}),
|
|
154
|
-
shape:
|
|
154
|
+
shape: t({
|
|
155
155
|
square: [],
|
|
156
156
|
rounded: ["rounded-tag"],
|
|
157
157
|
pill: ["rounded-full"]
|
|
158
158
|
}),
|
|
159
|
-
intent:
|
|
159
|
+
intent: t({
|
|
160
160
|
main: [],
|
|
161
161
|
support: [],
|
|
162
162
|
accent: [],
|
|
@@ -180,14 +180,14 @@ var a = [
|
|
|
180
180
|
size: "md",
|
|
181
181
|
shape: "pill"
|
|
182
182
|
}
|
|
183
|
-
}), l = ({ design: t = "filled", intent:
|
|
183
|
+
}), l = ({ design: t = "filled", intent: n = "support", size: r = "md", shape: a = "rounded", asChild: o, className: s, ref: l, ...u }) => /* @__PURE__ */ i(o ? e : "span", {
|
|
184
184
|
"data-spark-component": "tag",
|
|
185
185
|
ref: l,
|
|
186
186
|
className: c({
|
|
187
187
|
className: s,
|
|
188
188
|
design: t,
|
|
189
|
-
intent:
|
|
190
|
-
size:
|
|
189
|
+
intent: n,
|
|
190
|
+
size: r,
|
|
191
191
|
shape: a
|
|
192
192
|
}),
|
|
193
193
|
...u
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
import { ComponentPropsWithRef } from 'react';
|
|
3
3
|
declare const textLinkStyles: (props?: ({
|
|
4
|
-
intent?: "main" | "
|
|
4
|
+
intent?: "main" | "support" | "alert" | "current" | "accent" | "success" | "info" | "neutral" | "danger" | null | undefined;
|
|
5
5
|
bold?: boolean | null | undefined;
|
|
6
6
|
underline?: boolean | null | undefined;
|
|
7
7
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
package/dist/textarea/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../input-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../input-CADvgFpY.js");let t=require("class-variance-authority"),n=require("react/jsx-runtime");var r=t=>(0,n.jsx)(e.t.ClearButton,{inline:!0,"data-spark-component":`textarea-group-trailing-icon`,...t});r.id=e.t.ClearButton.id,r.displayName=`TextareaGroup.ClearButton`;var i=t=>(0,n.jsx)(e.t,{...t});i.displayName=`TextareaGroup`;var a=t=>(0,n.jsx)(e.t.LeadingIcon,{"data-spark-component":`textarea-group-leading-icon`,...t});a.id=e.t.LeadingIcon.id,a.displayName=`TextareaGroup.LeadingIcon`;var o=t=>(0,n.jsx)(e.t.TrailingIcon,{"data-spark-component":`textarea-group-trailing-icon`,...t});o.id=e.t.TrailingIcon.id,o.displayName=`TextareaGroup.TrailingIcon`;var s=({className:r,disabled:i,rows:a=1,isResizable:o=!0,ref:s,onValueChange:c,...l})=>(0,n.jsx)(e.n,{className:(0,t.cx)(r,`py-sz-10 rounded-xl!`,o?`resize-y`:`resize-none`),"data-spark-component":`textarea`,disabled:i,asChild:!0,onValueChange:c,children:(0,n.jsx)(`textarea`,{ref:s,rows:a,...l})}),c=Object.assign(s,{id:e.n.id});s.displayName=`Textarea`;var l=Object.assign(i,{LeadingIcon:a,TrailingIcon:o,ClearButton:r});l.displayName=`TextareaGroup`,a.displayName=`TextareaGroup.LeadingIcon`,o.displayName=`TextareaGroup.TrailingIcon`,r.displayName=`TextareaGroup.ClearButton`,exports.Textarea=c,exports.TextareaGroup=l;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/textarea/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VariantProps } from 'class-variance-authority';
|
|
2
2
|
export declare const toastStyles: (props?: ({
|
|
3
3
|
design?: "filled" | "tinted" | null | undefined;
|
|
4
|
-
intent?: "main" | "
|
|
4
|
+
intent?: "main" | "surface" | "support" | "alert" | "error" | "accent" | "success" | "info" | "neutral" | "surfaceInverse" | null | undefined;
|
|
5
5
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
6
|
export type ToastVariantProps = VariantProps<typeof toastStyles>;
|
package/dist/toast/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("../slot/index.js"),n=require("../icon-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-CMqjfN_6.js"),t=require("../slot/index.js"),n=require("../icon-CfEsla9z.js"),r=require("../button-3vvMrf1L.js"),i=require("../icon-button-B2TM0Xby.js");let a=require("class-variance-authority"),o=require("react");o=e.t(o);let s=require("react/jsx-runtime"),c=require("@spark-ui/icons/Close"),l=require("@base-ui/react/toast"),u=require("@spark-ui/icons/AlertFill"),d=require("@spark-ui/icons/InfoFill"),f=require("@spark-ui/icons/ValidFill"),p=require("@spark-ui/icons/WarningFill");var m=(0,a.cva)([`gap-lg p-md flex w-max w-[min(400px,calc(100vw-var(--spacing-sz-32)))]! flex-col rounded-lg border-md`,`absolute right-0 bottom-0 left-auto mr-0`,`bg-clip-padding shadow-md select-none`,`focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none`,`z-[calc(1000-var(--toast-index))]`,`after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']`,`[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-16px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]`,`ease-standard [transition-property:opacity,transform]`,`duration-400`,`data-[starting-style]:[transform:translateY(150%)]`,`data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]`,`data-[ending-style]:duration-250`,`data-[ending-style]:opacity-0`,`data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]`,`data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]`,`data-[limited]:opacity-0`],{variants:{design:{filled:``,tinted:``},intent:{success:``,alert:``,error:``,info:``,neutral:``,main:``,support:``,accent:``,surface:``,surfaceInverse:``}},compoundVariants:[{design:`filled`,intent:`success`,class:[`bg-success text-on-success border-success`]},{design:`filled`,intent:`alert`,class:[`bg-alert text-on-alert border-alert`]},{design:`filled`,intent:`error`,class:[`bg-error text-on-error border-error`]},{design:`filled`,intent:`info`,class:[`bg-info text-on-info border-info`]},{design:`filled`,intent:`neutral`,class:[`bg-neutral text-on-neutral border-neutral`]},{design:`filled`,intent:`main`,class:[`bg-main text-on-main border-main`]},{design:`filled`,intent:`support`,class:[`bg-support text-on-support border-support`]},{design:`filled`,intent:`accent`,class:[`bg-accent text-on-accent border-accent`]},{design:`filled`,intent:`surface`,class:[`bg-surface text-on-surface border-surface`]},{design:`filled`,intent:`surfaceInverse`,class:[`bg-surface-inverse text-on-surface-inverse border-surface-inverse`]},{design:`tinted`,intent:`success`,class:[`bg-success-container text-on-success-container border-success`]},{design:`tinted`,intent:`alert`,class:[`bg-alert-container text-on-alert-container border-alert`]},{design:`tinted`,intent:`error`,class:[`bg-error-container text-on-error-container border-error`]},{design:`tinted`,intent:`info`,class:[`bg-info-container text-on-info-container border-info`]},{design:`tinted`,intent:`neutral`,class:[`bg-neutral-container text-on-neutral-container border-neutral`]},{design:`tinted`,intent:`main`,class:[`bg-main-container text-on-main-container border-main`]},{design:`tinted`,intent:`support`,class:[`bg-support-container text-on-support-container border-support`]},{design:`tinted`,intent:`accent`,class:[`bg-accent-container text-on-accent-container border-accent`]},{design:`tinted`,intent:`surface`,class:[`bg-surface text-on-surface border-surface`]},{design:`tinted`,intent:`surfaceInverse`,class:[`bg-surface-inverse text-on-surface-inverse border-surface-inverse`]}],defaultVariants:{design:`filled`,intent:`neutral`}});function h(e){return e===`surfaceInverse`?`surface`:e===`surface`?`surfaceInverse`:e===`error`?`danger`:e}function g(e){return e===`surfaceInverse`?`surfaceInverse`:e===`surface`?`surface`:e===`error`?`danger`:e}var _=(e,{toastDesign:t,toastIntent:n})=>{if(!e)return{};let{design:r,intent:i,className:o,onClick:s,...c}=e;return{design:r??t,intent:i??h(n),className:(0,a.cx)(`ml-auto`,o),onClick:s,...c}},v=(e,t,n)=>({swipeDirection:[`down`,`right`],toast:e,className:(0,a.cx)(m({design:t,intent:n})),style:{"--gap":`var(--spacing-md)`,"--offset-y":`calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))`}});function y(e){switch(e){case`info`:return(0,s.jsx)(d.InfoFill,{});case`success`:return(0,s.jsx)(f.ValidFill,{});case`alert`:return(0,s.jsx)(p.WarningFill,{});case`error`:return(0,s.jsx)(u.AlertFill,{});default:return(0,s.jsx)(d.InfoFill,{})}}function b({toast:e}){let{icon:t,intent:o=`info`,design:u,action:d,isClosable:f,closeLabel:p=`Close`,compact:m=!1}=e.data??{},h=`tinted`,b=d?.close?l.Toast.Close:l.Toast.Action,x=_(d,{toastDesign:h,toastIntent:o}),S=v(e,h,o),C=t??y(o),w=e=>f?(0,s.jsx)(l.Toast.Close,{className:e,render:(0,s.jsx)(i.t,{"aria-label":p,design:h,intent:g(o),size:`md`}),children:(0,s.jsx)(n.t,{children:(0,s.jsx)(c.Close,{})})}):null,T=()=>{let t=e.data?.title??e.title,n=!!(e.data?.description??e.description);return typeof t!=`string`&&t!==void 0?(0,s.jsx)(l.Toast.Title,{className:n?`text-headline-2`:`text-body-1`,render:(0,s.jsx)(`div`,{}),children:t}):(0,s.jsx)(l.Toast.Title,{className:n?`text-headline-2`:`text-body-1`})},E=()=>{let t=e.data?.description??e.description;return t?typeof t==`string`?(0,s.jsx)(l.Toast.Description,{className:`text-body-1`}):(0,s.jsx)(l.Toast.Description,{className:`text-body-1`,render:(0,s.jsx)(`div`,{}),children:t}):null};return(0,s.jsx)(l.Toast.Root,{...S,children:(0,s.jsxs)(`div`,{className:(0,a.cx)(`flex`,m?`gap-lg items-center`:`gap-md flex-col`),children:[(0,s.jsxs)(`div`,{className:`gap-lg p-md flex grow items-center`,children:[(0,s.jsx)(n.t,{size:`md`,children:C}),(0,s.jsxs)(`div`,{className:(0,a.cx)(`gap-sm flex flex-col`,m&&`flex-1`,!m&&f&&`pr-3xl`),children:[T(),E()]})]}),(0,s.jsxs)(`div`,{className:(0,a.cx)(`flex`),children:[d&&(0,s.jsx)(b,{render:(0,s.jsx)(r.t,{...x}),children:d.label}),m&&w()]}),!m&&w(`top-md right-md absolute`)]})},e.id)}function x(){let e=l.Toast.useToastManager(),t=o.useRef(e);return t.current=e,o.useMemo(()=>({get toasts(){return t.current.toasts},add:e=>t.current.add(e),update:(e,n)=>t.current.update(e,n),close:e=>t.current.close(e),promise:(e,n)=>t.current.promise(e,n),closeAll:()=>t.current.toasts.forEach(({id:e})=>t.current.close(e))}),[])}function S(){let{toasts:e}=x();return e.map(e=>(0,s.jsx)(b,{toast:e},e.id))}function C({children:e,limit:t=3,...n}){return(0,s.jsxs)(l.Toast.Provider,{limit:t,...n,children:[(0,s.jsx)(l.Toast.Portal,{children:(0,s.jsx)(l.Toast.Viewport,{className:(0,a.cx)(`z-toast right-lg bottom-lg text-on-surfa- fixed top-auto mx-auto flex w-fit flex-col items-end`),children:(0,s.jsx)(S,{})})}),e]})}function w({children:e,onClick:n,asChild:r=!1,title:i,description:a,timeout:o=5e3,design:c=`filled`,intent:l=`neutral`,isClosable:u=!0,icon:d,action:f,compact:p,priority:m=`low`}){let h=x(),g=r?t.Slot:`button`;function _(e){n?.(e),h.add({title:i,description:a,timeout:o,priority:m,data:{design:c,intent:l,isClosable:u,...d&&{icon:d},action:f,...p!==void 0&&{compact:p}}})}return(0,s.jsx)(g,{...!r&&{type:`button`},onClick:_,children:e})}var T=l.Toast.createToastManager;exports.ToastProvider=C,exports.ToastTrigger=w,exports.createToastManager=T,exports.useToastManager=x;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/toast/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/toast/Toast.styles.ts","../../src/toast/Toast.tsx","../../src/toast/useToastManager.ts","../../src/toast/index.tsx"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority'\n\nexport const toastStyles = cva(\n [\n 'gap-lg p-md flex w-max !w-[min(400px,calc(100vw-2rem))] flex-col rounded-lg border-md',\n 'absolute right-0 bottom-0 left-auto mr-0',\n 'bg-clip-padding shadow-md select-none',\n 'focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none',\n 'z-[calc(1000-var(--toast-index))]',\n \"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n // Stack effect while not focused\n '[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-16px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]',\n // Scale and translate\n 'ease-standard [transition-property:opacity,transform]',\n 'duration-400',\n // Present when the toast is animating in.\n 'data-[starting-style]:[transform:translateY(150%)]',\n // Expanded: Present when the toast is expanded in the viewport.\n 'data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]',\n // Present when the toast is animating out.\n 'data-[ending-style]:duration-250',\n 'data-[ending-style]:opacity-0',\n 'data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]',\n 'data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n 'data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n // Limited: Present when the toast was removed due to exceeding the limit.\n 'data-[limited]:opacity-0',\n ],\n {\n variants: {\n design: {\n filled: '',\n tinted: '',\n },\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n support: '',\n accent: '',\n surface: '',\n surfaceInverse: '',\n },\n },\n compoundVariants: [\n // Filled variants\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success border-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert border-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error border-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info border-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral border-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main border-main'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support border-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent border-accent'],\n },\n {\n design: 'filled',\n intent: 'surface',\n class: ['bg-surface text-on-surface border-surface'],\n },\n {\n design: 'filled',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse border-surface-inverse'],\n },\n\n // Tinted variants\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container border-success'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container border-alert'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container border-error'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container border-info'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container border-neutral'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container border-main'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container border-support'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container border-accent'],\n },\n {\n design: 'tinted',\n intent: 'surface',\n class: ['bg-surface text-on-surface border-surface'],\n },\n {\n design: 'tinted',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse border-surface-inverse'],\n },\n ],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport type ToastVariantProps = VariantProps<typeof toastStyles>\n","import { Toast as BaseToast } from '@base-ui/react/toast'\nimport { Button, ButtonProps } from '@spark-ui/components/button'\nimport { Icon } from '@spark-ui/components/icon'\nimport { IconButton } from '@spark-ui/components/icon-button'\nimport { AlertFill } from '@spark-ui/icons/AlertFill'\nimport { Close } from '@spark-ui/icons/Close'\nimport { InfoFill } from '@spark-ui/icons/InfoFill'\nimport { ValidFill } from '@spark-ui/icons/ValidFill'\nimport { WarningFill } from '@spark-ui/icons/WarningFill'\nimport { cx } from 'class-variance-authority'\n\nimport { toastStyles } from './Toast.styles'\nimport type { ToastData, ToastDesign, ToastIntent, ToastObject } from './types'\n\nfunction getButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surface'\n if (intent === 'surface') return 'surfaceInverse'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nfunction getCloseButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surfaceInverse'\n if (intent === 'surface') return 'surface'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nconst getActionProps = (\n action: ToastData['action'],\n { toastDesign, toastIntent }: { toastDesign?: ToastDesign; toastIntent?: ToastIntent }\n): ButtonProps => {\n if (!action) return {}\n\n const { design, intent, className, onClick, ...rest } = action\n\n return {\n design: design ?? toastDesign,\n intent: intent ?? getButtonIntent(toastIntent),\n className: cx('ml-auto', className),\n onClick,\n ...rest,\n }\n}\n\nconst getToastRootProps = (toast: ToastObject, design: ToastDesign, intent: ToastIntent) => ({\n swipeDirection: ['down', 'right'] as ['down', 'right'],\n toast,\n className: cx(toastStyles({ design, intent })),\n style: {\n ['--gap' as string]: 'var(--spacing-md)',\n ['--offset-y' as string]:\n 'calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))',\n },\n})\n\nfunction getDefaultIcon(intent: ToastIntent): React.ReactNode {\n switch (intent) {\n case 'info':\n return <InfoFill />\n case 'success':\n return <ValidFill />\n case 'alert':\n return <WarningFill />\n case 'error':\n return <AlertFill />\n case 'main':\n case 'support':\n case 'accent':\n case 'neutral':\n case 'surface':\n case 'surfaceInverse':\n default:\n return <InfoFill />\n }\n}\n\nexport function Toast({ toast }: { toast: ToastObject }) {\n const {\n icon: ToastIcon,\n intent = 'info',\n design: _design, // deprecated prop, ignored\n action,\n isClosable,\n closeLabel = 'Close',\n compact = false,\n } = toast.data ?? {}\n\n // Always use 'tinted' design regardless of prop value\n const design = 'tinted' as const\n\n const ActionButton = action?.close ? BaseToast.Close : BaseToast.Action\n const actionProps = getActionProps(action, { toastDesign: design, toastIntent: intent })\n const rootProps = getToastRootProps(toast, design, intent)\n\n // Use provided icon or default icon based on intent\n const icon = ToastIcon ?? getDefaultIcon(intent)\n\n const getCloseButton = (className?: string) => {\n if (!isClosable) return null\n\n return (\n <BaseToast.Close\n className={className}\n render={\n <IconButton\n aria-label={closeLabel}\n design={design}\n intent={getCloseButtonIntent(intent)}\n size=\"md\"\n />\n }\n >\n <Icon>\n <Close />\n </Icon>\n </BaseToast.Close>\n )\n }\n\n const renderTitle = () => {\n // Check ToastData first for JSX, then fallback to toast.title (string)\n const title = toast.data?.title ?? toast.title\n const hasDescription = !!(toast.data?.description ?? toast.description)\n\n if (typeof title !== 'string' && title !== undefined) {\n return (\n <BaseToast.Title\n className={hasDescription ? 'text-headline-2' : 'text-body-1'}\n render={<div />}\n >\n {title}\n </BaseToast.Title>\n )\n }\n\n return <BaseToast.Title className={hasDescription ? 'text-headline-2' : 'text-body-1'} />\n }\n\n const renderDescription = () => {\n // Check ToastData first for JSX, then fallback to toast.description (string)\n const description = toast.data?.description ?? toast.description\n\n if (!description) return null\n\n if (typeof description !== 'string') {\n return (\n <BaseToast.Description className=\"text-body-1\" render={<div />}>\n {description}\n </BaseToast.Description>\n )\n }\n\n return <BaseToast.Description className=\"text-body-1\" />\n }\n\n return (\n <BaseToast.Root key={toast.id} {...rootProps}>\n <div className={cx('flex', compact ? 'gap-lg items-center' : 'gap-md flex-col')}>\n <div className=\"gap-lg p-md flex grow items-center\">\n {/* Icon */}\n <Icon size=\"md\">{icon}</Icon>\n {/* Title and description */}\n <div\n className={cx(\n 'gap-sm flex flex-col',\n compact && 'flex-1',\n !compact && isClosable && 'pr-3xl'\n )}\n >\n {renderTitle()}\n {renderDescription()}\n </div>\n </div>\n\n <div className={cx('flex')}>\n {/* Action button */}\n {action && (\n <ActionButton render={<Button {...actionProps} />}>{action.label}</ActionButton>\n )}\n {/* Close button - compact layout only */}\n {compact && getCloseButton()}\n </div>\n\n {/* Close button - default layout only */}\n {!compact && getCloseButton('top-md right-md absolute')}\n </div>\n </BaseToast.Root>\n )\n}\n","import { Toast as BaseToast } from '@base-ui/react/toast'\nimport * as React from 'react'\n\nimport type { UseToastManagerReturnValue } from './types'\n\nexport function useToastManager(): UseToastManagerReturnValue {\n const manager = BaseToast.useToastManager()\n const managerRef = React.useRef(manager)\n managerRef.current = manager\n\n return React.useMemo(\n () => ({\n get toasts() {\n return managerRef.current.toasts\n },\n add: options => managerRef.current.add(options),\n update: (id, options) => managerRef.current.update(id, options),\n close: id => managerRef.current.close(id),\n promise: (p, options) => managerRef.current.promise(p, options),\n closeAll: () => managerRef.current.toasts.forEach(({ id }) => managerRef.current.close(id)),\n }),\n []\n )\n}\n","import { Toast as BaseToast } from '@base-ui/react/toast'\nimport { Slot } from '@spark-ui/components/slot'\nimport { cx } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Toast } from './Toast'\nimport type { ToastData, ToastObject } from './types'\nimport { useToastManager } from './useToastManager'\n\nexport * from './types'\n\nfunction ToastList() {\n const { toasts } = useToastManager()\n\n return toasts.map(toast => <Toast key={toast.id} toast={toast} />)\n}\n\ninterface ToastProviderProps extends React.ComponentProps<typeof BaseToast.Provider> {\n children: React.ReactNode\n}\n\n/**\n * A provider component that manages and displays temporary notification messages to users.\n */\nexport function ToastProvider({ children, limit = 3, ...props }: ToastProviderProps) {\n return (\n <BaseToast.Provider limit={limit} {...props}>\n <BaseToast.Portal>\n <BaseToast.Viewport\n className={cx(\n 'z-toast right-lg bottom-lg text-on-surfa- fixed top-auto mx-auto flex w-fit flex-col items-end'\n )}\n >\n <ToastList />\n </BaseToast.Viewport>\n </BaseToast.Portal>\n {children}\n </BaseToast.Provider>\n )\n}\n\ninterface ToastTriggerProps\n extends\n Omit<React.ComponentPropsWithRef<'button'>, 'title'>,\n Pick<ToastObject, 'priority'>,\n Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {\n children: React.ReactNode\n asChild?: boolean\n title: string | React.ReactNode\n description?: string | React.ReactNode\n timeout?: number\n}\n\nexport function ToastTrigger({\n children,\n onClick,\n asChild = false,\n title,\n description,\n timeout = 5000,\n design = 'filled',\n intent = 'neutral',\n isClosable = true,\n icon,\n action,\n compact,\n priority = 'low',\n}: ToastTriggerProps) {\n const toastManager = useToastManager()\n\n const Component = asChild ? Slot : 'button'\n\n function createToast(e: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(e)\n toastManager.add({\n title,\n description,\n timeout,\n priority,\n data: {\n design,\n intent,\n isClosable,\n ...(icon && { icon }),\n action,\n ...(compact !== undefined && { compact }),\n },\n })\n }\n\n return (\n <Component {...(!asChild && { type: 'button' })} onClick={createToast}>\n {children}\n </Component>\n )\n}\n\nexport type ToastManager = ReturnType<typeof BaseToast.createToastManager>\n\nexport const createToastManager: () => ToastManager = BaseToast.createToastManager\n\nexport { useToastManager }\n"],"mappings":"2kBAEA,IAAa,GAAA,EAAA,EAAA,IAAA,CACX,CACE,wFACA,2CACA,wCACA,2EACA,oCACA,+GAEA,8LAEA,wDACA,eAEA,qDAEA,wLAEA,mCACA,gCACA,mHACA,gJACA,gKAEA,0BACF,EACA,CACE,SAAU,CACR,OAAQ,CACN,OAAQ,GACR,OAAQ,EACV,EACA,OAAQ,CACN,QAAS,GACT,MAAO,GACP,MAAO,GACP,KAAM,GACN,QAAS,GACT,KAAM,GACN,QAAS,GACT,OAAQ,GACR,QAAS,GACT,eAAgB,EAClB,CAC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AAO,SAAS,CAAE,QAAS,EAAW,QAAQ,MAAM,CAAE,CAAC,CAC5F,GACA,CAAC,CACH,CACF,CCZA,SAAS,GAAY,CACnB,GAAM,CAAE,UAAW,EAAgB,EAEnC,OAAO,EAAO,IAAI,IAAS,EAAA,EAAA,IAAA,CAAC,EAAD,CAA6B,OAAQ,EAAzB,EAAM,EAAmB,CAAC,CACnE,CASA,SAAgB,EAAc,CAAE,WAAU,QAAQ,EAAG,GAAG,GAA6B,CACnF,OACE,EAAA,EAAA,KAAA,CAAC,EAAA,MAAU,SAAX,CAA2B,QAAO,GAAI,WAAtC,EACE,EAAA,EAAA,IAAA,CAAC,EAAA,MAAU,OAAX,CAAA,UACE,EAAA,EAAA,IAAA,CAAC,EAAA,MAAU,SAAX,CACE,WAAA,EAAA,EAAA,GAAA,CACE,gGACF,YAEA,EAAA,EAAA,IAAA,CAAC,EAAD,CAAY,CAAA,CACM,CAAA,CACJ,CAAA,EACjB,CACiB,GAExB,CAcA,SAAgB,EAAa,CAC3B,WACA,UACA,UAAU,GACV,QACA,cACA,UAAU,IACV,SAAS,SACT,SAAS,UACT,aAAa,GACb,OACA,SACA,UACA,WAAW,OACS,CACpB,IAAM,EAAe,EAAgB,EAE/B,EAAY,EAAU,EAAA,KAAO,SAEnC,SAAS,EAAY,EAAwC,CAC3D,IAAU,CAAC,EACX,EAAa,IAAI,CACf,QACA,cACA,UACA,WACA,KAAM,CACJ,SACA,SACA,aACA,GAAI,GAAQ,CAAE,MAAK,EACnB,SACA,GAAI,IAAY,IAAA,IAAa,CAAE,SAAQ,CACzC,CACF,CAAC,CACH,CAEA,OACE,EAAA,EAAA,IAAA,CAAC,EAAD,CAAW,GAAK,CAAC,GAAW,CAAE,KAAM,QAAS,EAAI,QAAS,EACvD,UACQ,CAAA,CAEf,CAIA,IAAa,EAAyC,EAAA,MAAU"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/toast/Toast.styles.ts","../../src/toast/Toast.tsx","../../src/toast/useToastManager.ts","../../src/toast/index.tsx"],"sourcesContent":["import { cva, VariantProps } from 'class-variance-authority'\n\nexport const toastStyles = cva(\n [\n 'gap-lg p-md flex w-max w-[min(400px,calc(100vw-var(--spacing-sz-32)))]! flex-col rounded-lg border-md',\n 'absolute right-0 bottom-0 left-auto mr-0',\n 'bg-clip-padding shadow-md select-none',\n 'focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none',\n 'z-[calc(1000-var(--toast-index))]',\n \"after:absolute after:bottom-full after:left-0 after:h-[calc(var(--gap)+1px)] after:w-full after:content-['']\",\n // Stack effect while not focused\n '[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-swipe-movement-y)+calc(min(var(--toast-index),10)*-16px)))_scale(calc(max(0,1-(var(--toast-index)*0.1))))]',\n // Scale and translate\n 'ease-standard [transition-property:opacity,transform]',\n 'duration-400',\n // Present when the toast is animating in.\n 'data-[starting-style]:[transform:translateY(150%)]',\n // Expanded: Present when the toast is expanded in the viewport.\n 'data-[expanded]:[transform:translateX(var(--toast-swipe-movement-x))_translateY(calc(var(--toast-offset-y)*-1+calc(var(--toast-index)*var(--gap)*-1)+var(--toast-swipe-movement-y)))]',\n // Present when the toast is animating out.\n 'data-[ending-style]:duration-250',\n 'data-[ending-style]:opacity-0',\n 'data-[ending-style]:data-[swipe-direction=down]:[transform:translateY(calc(var(--toast-swipe-movement-y)+150%))]',\n 'data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n 'data-[expanded]:data-[ending-style]:data-[swipe-direction=right]:[transform:translateX(calc(var(--toast-swipe-movement-x)+150%))_translateY(var(--offset-y))]',\n // Limited: Present when the toast was removed due to exceeding the limit.\n 'data-[limited]:opacity-0',\n ],\n {\n variants: {\n design: {\n filled: '',\n tinted: '',\n },\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n support: '',\n accent: '',\n surface: '',\n surfaceInverse: '',\n },\n },\n compoundVariants: [\n // Filled variants\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success border-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert border-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error border-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info border-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral border-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main border-main'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support border-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent border-accent'],\n },\n {\n design: 'filled',\n intent: 'surface',\n class: ['bg-surface text-on-surface border-surface'],\n },\n {\n design: 'filled',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse border-surface-inverse'],\n },\n\n // Tinted variants\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container border-success'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container border-alert'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container border-error'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container border-info'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container border-neutral'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container border-main'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container border-support'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container border-accent'],\n },\n {\n design: 'tinted',\n intent: 'surface',\n class: ['bg-surface text-on-surface border-surface'],\n },\n {\n design: 'tinted',\n intent: 'surfaceInverse',\n class: ['bg-surface-inverse text-on-surface-inverse border-surface-inverse'],\n },\n ],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport type ToastVariantProps = VariantProps<typeof toastStyles>\n","import { Toast as BaseToast } from '@base-ui/react/toast'\nimport { Button, ButtonProps } from '@spark-ui/components/button'\nimport { Icon } from '@spark-ui/components/icon'\nimport { IconButton } from '@spark-ui/components/icon-button'\nimport { AlertFill } from '@spark-ui/icons/AlertFill'\nimport { Close } from '@spark-ui/icons/Close'\nimport { InfoFill } from '@spark-ui/icons/InfoFill'\nimport { ValidFill } from '@spark-ui/icons/ValidFill'\nimport { WarningFill } from '@spark-ui/icons/WarningFill'\nimport { cx } from 'class-variance-authority'\n\nimport { toastStyles } from './Toast.styles'\nimport type { ToastData, ToastDesign, ToastIntent, ToastObject } from './types'\n\nfunction getButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surface'\n if (intent === 'surface') return 'surfaceInverse'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nfunction getCloseButtonIntent(intent?: ToastIntent): ButtonProps['intent'] {\n if (intent === 'surfaceInverse') return 'surfaceInverse'\n if (intent === 'surface') return 'surface'\n if (intent === 'error') return 'danger'\n\n return intent as ButtonProps['intent']\n}\n\nconst getActionProps = (\n action: ToastData['action'],\n { toastDesign, toastIntent }: { toastDesign?: ToastDesign; toastIntent?: ToastIntent }\n): ButtonProps => {\n if (!action) return {}\n\n const { design, intent, className, onClick, ...rest } = action\n\n return {\n design: design ?? toastDesign,\n intent: intent ?? getButtonIntent(toastIntent),\n className: cx('ml-auto', className),\n onClick,\n ...rest,\n }\n}\n\nconst getToastRootProps = (toast: ToastObject, design: ToastDesign, intent: ToastIntent) => ({\n swipeDirection: ['down', 'right'] as ['down', 'right'],\n toast,\n className: cx(toastStyles({ design, intent })),\n style: {\n ['--gap' as string]: 'var(--spacing-md)',\n ['--offset-y' as string]:\n 'calc(var(--toast-offset-y) * -1 + (var(--toast-index) * var(--gap) * -1) + var(--toast-swipe-movement-y))',\n },\n})\n\nfunction getDefaultIcon(intent: ToastIntent): React.ReactNode {\n switch (intent) {\n case 'info':\n return <InfoFill />\n case 'success':\n return <ValidFill />\n case 'alert':\n return <WarningFill />\n case 'error':\n return <AlertFill />\n case 'main':\n case 'support':\n case 'accent':\n case 'neutral':\n case 'surface':\n case 'surfaceInverse':\n default:\n return <InfoFill />\n }\n}\n\nexport function Toast({ toast }: { toast: ToastObject }) {\n const {\n icon: ToastIcon,\n intent = 'info',\n design: _design, // deprecated prop, ignored\n action,\n isClosable,\n closeLabel = 'Close',\n compact = false,\n } = toast.data ?? {}\n\n // Always use 'tinted' design regardless of prop value\n const design = 'tinted' as const\n\n const ActionButton = action?.close ? BaseToast.Close : BaseToast.Action\n const actionProps = getActionProps(action, { toastDesign: design, toastIntent: intent })\n const rootProps = getToastRootProps(toast, design, intent)\n\n // Use provided icon or default icon based on intent\n const icon = ToastIcon ?? getDefaultIcon(intent)\n\n const getCloseButton = (className?: string) => {\n if (!isClosable) return null\n\n return (\n <BaseToast.Close\n className={className}\n render={\n <IconButton\n aria-label={closeLabel}\n design={design}\n intent={getCloseButtonIntent(intent)}\n size=\"md\"\n />\n }\n >\n <Icon>\n <Close />\n </Icon>\n </BaseToast.Close>\n )\n }\n\n const renderTitle = () => {\n // Check ToastData first for JSX, then fallback to toast.title (string)\n const title = toast.data?.title ?? toast.title\n const hasDescription = !!(toast.data?.description ?? toast.description)\n\n if (typeof title !== 'string' && title !== undefined) {\n return (\n <BaseToast.Title\n className={hasDescription ? 'text-headline-2' : 'text-body-1'}\n render={<div />}\n >\n {title}\n </BaseToast.Title>\n )\n }\n\n return <BaseToast.Title className={hasDescription ? 'text-headline-2' : 'text-body-1'} />\n }\n\n const renderDescription = () => {\n // Check ToastData first for JSX, then fallback to toast.description (string)\n const description = toast.data?.description ?? toast.description\n\n if (!description) return null\n\n if (typeof description !== 'string') {\n return (\n <BaseToast.Description className=\"text-body-1\" render={<div />}>\n {description}\n </BaseToast.Description>\n )\n }\n\n return <BaseToast.Description className=\"text-body-1\" />\n }\n\n return (\n <BaseToast.Root key={toast.id} {...rootProps}>\n <div className={cx('flex', compact ? 'gap-lg items-center' : 'gap-md flex-col')}>\n <div className=\"gap-lg p-md flex grow items-center\">\n {/* Icon */}\n <Icon size=\"md\">{icon}</Icon>\n {/* Title and description */}\n <div\n className={cx(\n 'gap-sm flex flex-col',\n compact && 'flex-1',\n !compact && isClosable && 'pr-3xl'\n )}\n >\n {renderTitle()}\n {renderDescription()}\n </div>\n </div>\n\n <div className={cx('flex')}>\n {/* Action button */}\n {action && (\n <ActionButton render={<Button {...actionProps} />}>{action.label}</ActionButton>\n )}\n {/* Close button - compact layout only */}\n {compact && getCloseButton()}\n </div>\n\n {/* Close button - default layout only */}\n {!compact && getCloseButton('top-md right-md absolute')}\n </div>\n </BaseToast.Root>\n )\n}\n","import { Toast as BaseToast } from '@base-ui/react/toast'\nimport * as React from 'react'\n\nimport type { UseToastManagerReturnValue } from './types'\n\nexport function useToastManager(): UseToastManagerReturnValue {\n const manager = BaseToast.useToastManager()\n const managerRef = React.useRef(manager)\n managerRef.current = manager\n\n return React.useMemo(\n () => ({\n get toasts() {\n return managerRef.current.toasts\n },\n add: options => managerRef.current.add(options),\n update: (id, options) => managerRef.current.update(id, options),\n close: id => managerRef.current.close(id),\n promise: (p, options) => managerRef.current.promise(p, options),\n closeAll: () => managerRef.current.toasts.forEach(({ id }) => managerRef.current.close(id)),\n }),\n []\n )\n}\n","import { Toast as BaseToast } from '@base-ui/react/toast'\nimport { Slot } from '@spark-ui/components/slot'\nimport { cx } from 'class-variance-authority'\nimport * as React from 'react'\n\nimport { Toast } from './Toast'\nimport type { ToastData, ToastObject } from './types'\nimport { useToastManager } from './useToastManager'\n\nexport * from './types'\n\nfunction ToastList() {\n const { toasts } = useToastManager()\n\n return toasts.map(toast => <Toast key={toast.id} toast={toast} />)\n}\n\ninterface ToastProviderProps extends React.ComponentProps<typeof BaseToast.Provider> {\n children: React.ReactNode\n}\n\n/**\n * A provider component that manages and displays temporary notification messages to users.\n */\nexport function ToastProvider({ children, limit = 3, ...props }: ToastProviderProps) {\n return (\n <BaseToast.Provider limit={limit} {...props}>\n <BaseToast.Portal>\n <BaseToast.Viewport\n className={cx(\n 'z-toast right-lg bottom-lg text-on-surfa- fixed top-auto mx-auto flex w-fit flex-col items-end'\n )}\n >\n <ToastList />\n </BaseToast.Viewport>\n </BaseToast.Portal>\n {children}\n </BaseToast.Provider>\n )\n}\n\ninterface ToastTriggerProps\n extends\n Omit<React.ComponentPropsWithRef<'button'>, 'title'>,\n Pick<ToastObject, 'priority'>,\n Pick<ToastData, 'design' | 'intent' | 'icon' | 'isClosable' | 'action' | 'compact'> {\n children: React.ReactNode\n asChild?: boolean\n title: string | React.ReactNode\n description?: string | React.ReactNode\n timeout?: number\n}\n\nexport function ToastTrigger({\n children,\n onClick,\n asChild = false,\n title,\n description,\n timeout = 5000,\n design = 'filled',\n intent = 'neutral',\n isClosable = true,\n icon,\n action,\n compact,\n priority = 'low',\n}: ToastTriggerProps) {\n const toastManager = useToastManager()\n\n const Component = asChild ? Slot : 'button'\n\n function createToast(e: React.MouseEvent<HTMLButtonElement>) {\n onClick?.(e)\n toastManager.add({\n title,\n description,\n timeout,\n priority,\n data: {\n design,\n intent,\n isClosable,\n ...(icon && { icon }),\n action,\n ...(compact !== undefined && { compact }),\n },\n })\n }\n\n return (\n <Component {...(!asChild && { type: 'button' })} onClick={createToast}>\n {children}\n </Component>\n )\n}\n\nexport type ToastManager = ReturnType<typeof BaseToast.createToastManager>\n\nexport const createToastManager: () => ToastManager = BaseToast.createToastManager\n\nexport { useToastManager }\n"],"mappings":"2kBAEA,IAAa,GAAA,EAAA,EAAA,IAAA,CACX,CACE,wGACA,2CACA,wCACA,2EACA,oCACA,+GAEA,8LAEA,wDACA,eAEA,qDAEA,wLAEA,mCACA,gCACA,mHACA,gJACA,gKAEA,0BACF,EACA,CACE,SAAU,CAC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E,KAAM,QAAS,EAAI,QAAS,EACvD,UACQ,CAAA,CAEf,CAIA,IAAa,EAAyC,EAAA,MAAU"}
|
package/dist/toast/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Slot as e } from "../slot/index.mjs";
|
|
2
|
-
import { t } from "../icon-
|
|
3
|
-
import { t as n } from "../button-
|
|
4
|
-
import { t as r } from "../icon-button-
|
|
2
|
+
import { t } from "../icon-VM_Ys9Xn.mjs";
|
|
3
|
+
import { t as n } from "../button-DBNjh3Bi.mjs";
|
|
4
|
+
import { t as r } from "../icon-button-CexCkoV0.mjs";
|
|
5
5
|
import { cva as i, cx as a } from "class-variance-authority";
|
|
6
6
|
import * as o from "react";
|
|
7
7
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
@@ -13,7 +13,7 @@ import { ValidFill as p } from "@spark-ui/icons/ValidFill";
|
|
|
13
13
|
import { WarningFill as m } from "@spark-ui/icons/WarningFill";
|
|
14
14
|
//#region src/toast/Toast.styles.ts
|
|
15
15
|
var h = i([
|
|
16
|
-
"gap-lg p-md flex w-max
|
|
16
|
+
"gap-lg p-md flex w-max w-[min(400px,calc(100vw-var(--spacing-sz-32)))]! flex-col rounded-lg border-md",
|
|
17
17
|
"absolute right-0 bottom-0 left-auto mr-0",
|
|
18
18
|
"bg-clip-padding shadow-md select-none",
|
|
19
19
|
"focus-visible:ring-focus focus-visible:ring-2 focus-visible:outline-none",
|