@spark-ui/components 10.7.4 → 10.7.5
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/CHANGELOG.md +6 -0
- package/dist/alert-dialog/index.js +36 -5
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +2 -2
- package/dist/avatar/index.js +3 -0
- package/dist/avatar/index.js.map +1 -1
- package/dist/avatar/index.mjs +3 -1
- package/dist/avatar/index.mjs.map +1 -1
- package/dist/breadcrumb/index.js +1 -0
- package/dist/breadcrumb/index.js.map +1 -1
- package/dist/breadcrumb/index.mjs +1 -1
- package/dist/carousel/index.js +9 -0
- package/dist/carousel/index.js.map +1 -1
- package/dist/carousel/index.mjs +9 -1
- package/dist/carousel/index.mjs.map +1 -1
- package/dist/{chunk-O42QOEJ6.mjs → chunk-ESSJY557.mjs} +2 -2
- package/dist/{chunk-73YYIDSP.mjs → chunk-OQ4ALBBN.mjs} +6 -1
- package/dist/chunk-OQ4ALBBN.mjs.map +1 -0
- package/dist/{chunk-SBJNVOF7.mjs → chunk-QNYSDG6F.mjs} +2 -1
- package/dist/{chunk-SBJNVOF7.mjs.map → chunk-QNYSDG6F.mjs.map} +1 -1
- package/dist/{chunk-TOKVRWXL.mjs → chunk-RKPP7ZOK.mjs} +2 -1
- package/dist/{chunk-TOKVRWXL.mjs.map → chunk-RKPP7ZOK.mjs.map} +1 -1
- package/dist/{chunk-3PRCMWLU.mjs → chunk-T26TYEWV.mjs} +37 -7
- package/dist/chunk-T26TYEWV.mjs.map +1 -0
- package/dist/combobox/index.js +1 -0
- package/dist/combobox/index.js.map +1 -1
- package/dist/combobox/index.mjs +2 -2
- package/dist/dialog/index.js +36 -5
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +2 -2
- package/dist/divider/index.js +1 -0
- package/dist/divider/index.js.map +1 -1
- package/dist/divider/index.mjs +1 -0
- package/dist/divider/index.mjs.map +1 -1
- package/dist/drawer/index.js +36 -6
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +36 -7
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/dropdown/index.js +1 -0
- package/dist/dropdown/index.js.map +1 -1
- package/dist/dropdown/index.mjs +2 -2
- package/dist/icon-button/index.js +1 -0
- package/dist/icon-button/index.js.map +1 -1
- package/dist/icon-button/index.mjs +1 -1
- package/dist/input/index.js +5 -0
- package/dist/input/index.js.map +1 -1
- package/dist/input/index.mjs +1 -1
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/index.js.map +1 -1
- package/dist/kbd/index.mjs +1 -0
- package/dist/kbd/index.mjs.map +1 -1
- package/dist/pagination/index.js +1 -0
- package/dist/pagination/index.js.map +1 -1
- package/dist/pagination/index.mjs +1 -1
- package/dist/popover/index.js +1 -0
- package/dist/popover/index.js.map +1 -1
- package/dist/popover/index.mjs +2 -2
- package/dist/progress/index.js +23 -2
- package/dist/progress/index.js.map +1 -1
- package/dist/progress/index.mjs +23 -2
- package/dist/progress/index.mjs.map +1 -1
- package/dist/progress-tracker/index.js +1 -0
- package/dist/progress-tracker/index.js.map +1 -1
- package/dist/progress-tracker/index.mjs +1 -0
- package/dist/progress-tracker/index.mjs.map +1 -1
- package/dist/radio-group/index.js +9 -1
- package/dist/radio-group/index.js.map +1 -1
- package/dist/radio-group/index.mjs +9 -1
- package/dist/radio-group/index.mjs.map +1 -1
- package/dist/rating/index.js +1 -0
- package/dist/rating/index.js.map +1 -1
- package/dist/rating/index.mjs +1 -0
- package/dist/rating/index.mjs.map +1 -1
- package/dist/scrolling-list/index.js +14 -1
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +14 -2
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/slider/index.js +12 -1
- package/dist/slider/index.js.map +1 -1
- package/dist/slider/index.mjs +12 -1
- package/dist/slider/index.mjs.map +1 -1
- package/dist/snackbar/index.js +4 -0
- package/dist/snackbar/index.js.map +1 -1
- package/dist/snackbar/index.mjs +4 -1
- package/dist/snackbar/index.mjs.map +1 -1
- package/dist/stepper/index.js +8 -2
- package/dist/stepper/index.js.map +1 -1
- package/dist/stepper/index.mjs +4 -4
- package/dist/stepper/index.mjs.map +1 -1
- package/dist/switch/index.js +9 -1
- package/dist/switch/index.js.map +1 -1
- package/dist/switch/index.mjs +9 -1
- package/dist/switch/index.mjs.map +1 -1
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +3 -0
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/text-link/index.js +1 -0
- package/dist/text-link/index.js.map +1 -1
- package/dist/text-link/index.mjs +1 -1
- package/dist/textarea/index.js +5 -0
- package/dist/textarea/index.js.map +1 -1
- package/dist/textarea/index.mjs +1 -1
- package/package.json +5 -5
- package/dist/chunk-3PRCMWLU.mjs.map +0 -1
- package/dist/chunk-73YYIDSP.mjs.map +0 -1
- /package/dist/{chunk-O42QOEJ6.mjs.map → chunk-ESSJY557.mjs.map} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/snackbar/Snackbar.tsx","../../src/snackbar/SnackbarRegion.tsx","../../src/snackbar/SnackbarItem.tsx","../../src/snackbar/SnackbarItem.styles.ts","../../src/snackbar/snackbarVariants.ts","../../src/snackbar/SnackbarItemAction.tsx","../../src/snackbar/SnackbarItemContext.tsx","../../src/snackbar/SnackbarItemClose.tsx","../../src/snackbar/SnackbarItemIcon.tsx","../../src/snackbar/useSwipe.ts","../../src/snackbar/SnackbarRegion.styles.ts","../../src/snackbar/useSnackbarGlobalStore.ts","../../src/snackbar/index.ts"],"sourcesContent":["import {\n type ToastOptions as SnackBarItemOptions,\n ToastQueue,\n useToastQueue,\n} from '@react-stately/toast'\nimport { type ReactElement, Ref, type RefObject, useEffect, useRef } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { type SnackbarItemValue } from './SnackbarItem'\nimport { SnackbarRegion, type SnackbarRegionProps } from './SnackbarRegion'\nimport { useSnackbarGlobalStore } from './useSnackbarGlobalStore'\n\n/**\n * We define here a global queue thanks to dedicated util from React Spectrum.\n * It is based on React `useSyncExternalStore` and allows us to consume data from\n * an external data store, and thus preventing use of React context that could\n * lead to unwanted rerenderings. It also simplifies initial implementation.\n */\nlet GLOBAL_SNACKBAR_QUEUE: ToastQueue<SnackbarItemValue> | null = null\n\nconst getGlobalSnackBarQueue = () => {\n if (!GLOBAL_SNACKBAR_QUEUE) {\n GLOBAL_SNACKBAR_QUEUE = new ToastQueue({\n maxVisibleToasts: 1,\n hasExitAnimation: true,\n })\n }\n\n return GLOBAL_SNACKBAR_QUEUE\n}\n\nexport const clearSnackbarQueue = () => {\n GLOBAL_SNACKBAR_QUEUE = null\n}\n\n/**\n * We define a global store to keep track of all providers instances, to ensure\n * we always have a single Snackbar container.\n */\nconst GLOBAL_SNACKBAR_STORE = {\n providers: new Set<RefObject<HTMLDivElement | null>>(),\n subscriptions: new Set<() => void>(),\n}\n\nexport type SnackbarProps = Omit<SnackbarRegionProps, 'state'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Snackbar = ({ ref: forwardedRef, ...props }: SnackbarProps): ReactElement | null => {\n const ref = useRef<HTMLDivElement>(null)\n\n const state = useToastQueue(getGlobalSnackBarQueue())\n\n const { provider, addProvider, deleteProvider } = useSnackbarGlobalStore(GLOBAL_SNACKBAR_STORE)\n\n useEffect(() => {\n addProvider(ref)\n\n return () => {\n for (const toast of getGlobalSnackBarQueue().visibleToasts) {\n toast.animation = undefined\n }\n\n deleteProvider(ref)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return ref === provider && state.visibleToasts.length > 0\n ? createPortal(<SnackbarRegion ref={forwardedRef} state={state} {...props} />, document.body)\n : null\n}\n\nSnackbar.displayName = 'Snackbar'\n\nexport interface AddSnackbarArgs extends SnackbarItemValue, Omit<SnackBarItemOptions, 'timeout'> {\n /**\n * Handler that is called when the snackbar is closed, either by the user\n * or after a timeout.\n */\n onClose?: () => void\n /**\n * A timeout to automatically close the snackbar after, in milliseconds.\n * @default 5000\n */\n timeout?: number | null\n /**\n * The priority of the snackbar relative to other snackbars. Larger numbers indicate higher priority.\n */\n priority?: number\n}\n\nexport const addSnackbar = ({ onClose, timeout = 5000, priority, ...content }: AddSnackbarArgs) => {\n const queue = getGlobalSnackBarQueue()\n\n queue.add(content, {\n onClose,\n timeout: timeout && !content.onAction ? Math.max(timeout, 5000) : undefined,\n priority,\n })\n}\n","import { type AriaToastRegionProps, useToastRegion } from '@react-aria/toast'\nimport { cloneElement, type ComponentPropsWithRef, type ReactElement, useRef } from 'react'\n\nimport { SnackbarItem, type SnackbarItemProps } from './SnackbarItem'\nimport { SnackbarItemContext, type SnackbarItemState } from './SnackbarItemContext'\nimport { snackbarRegionVariant, type SnackbarRegionVariantProps } from './SnackbarRegion.styles'\n\nexport interface SnackbarRegionProps\n extends ComponentPropsWithRef<'div'>,\n AriaToastRegionProps,\n SnackbarRegionVariantProps,\n Pick<SnackbarItemState, 'state'> {\n /**\n * An accessibility label for the snackbar region.\n * @default 'Notifications'\n */\n 'aria-label'?: string\n /**\n * Identifies the element (or elements) that labels the current element.\n */\n 'aria-labelledby'?: string\n /**\n * Identifies the element (or elements) that describes the object.\n */\n 'aria-describedby'?: string\n /**\n * Identifies the element (or elements) that provide a detailed, extended description for the object.\n */\n 'aria-details'?: string\n /**\n * The component/template used to display each snackbar from the queue\n * @default 'Snackbar.Item'\n */\n children?: ReactElement<SnackbarItemProps, typeof SnackbarItem>\n}\n\nexport const SnackbarRegion = ({\n children = <SnackbarItem />,\n state,\n position = 'bottom',\n className,\n ref: forwardedRef,\n ...rest\n}: SnackbarRegionProps): ReactElement => {\n const innerRef = useRef<HTMLDivElement>(null)\n const ref = forwardedRef && typeof forwardedRef !== 'function' ? forwardedRef : innerRef\n\n const { regionProps } = useToastRegion(rest, state, ref)\n\n return (\n <div\n {...regionProps}\n ref={ref}\n data-position={position}\n className={snackbarRegionVariant({ position, className })}\n >\n {state.visibleToasts.map(toast => (\n <SnackbarItemContext.Provider key={toast.key} value={{ toast, state }}>\n {cloneElement(children, { key: toast.key })}\n </SnackbarItemContext.Provider>\n ))}\n </div>\n )\n}\n","/* eslint-disable complexity */\nimport { useToast } from '@react-aria/toast'\nimport {\n Children,\n cloneElement,\n type ComponentPropsWithRef,\n type FC,\n isValidElement,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useCallback,\n useRef,\n} from 'react'\n\nimport {\n snackbarItemVariant,\n snackbarItemVariantContent,\n type SnackbarItemVariantContentProps,\n type SnackbarItemVariantProps,\n} from './SnackbarItem.styles'\nimport { SnackbarItemAction, SnackbarItemActionProps } from './SnackbarItemAction'\nimport { SnackbarItemClose, SnackbarItemCloseProps } from './SnackbarItemClose'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\nimport { SnackbarItemIcon, SnackbarItemIconProps } from './SnackbarItemIcon'\nimport { useSwipe } from './useSwipe'\n\nexport interface SnackbarItemValue extends SnackbarItemVariantProps {\n /**\n * Icon that will be prepended before snackbar message\n */\n icon?: ReactNode\n message: ReactNode\n /**\n * If `true` snackbar will display a close button\n * @default false\n */\n isClosable?: boolean\n /**\n * A label for the action button within the toast.\n */\n actionLabel?: string\n /**\n * Handler that is called when the action button is pressed.\n */\n onAction?: () => void\n /**\n * If `true` the action button will be displayed on a new line.\n * @default false\n */\n actionOnNewline?: boolean\n}\n\nexport interface SnackbarItemProps\n extends ComponentPropsWithRef<'div'>,\n SnackbarItemVariantProps,\n SnackbarItemVariantContentProps {\n /**\n * Defines a string value that labels the current element.\n */\n 'aria-label'?: string\n /**\n * Identifies the element (or elements) that labels the current element.\n */\n 'aria-labelledby'?: string\n /**\n * Identifies the element (or elements) that describes the object.\n */\n 'aria-describedby'?: string\n /**\n * Identifies the element (or elements) that provide a detailed, extended description for the object.\n */\n 'aria-details'?: string\n}\n\nexport const SnackbarItem = ({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n design: designProp,\n intent: intentProp,\n actionOnNewline: actionOnNewlineProp,\n className,\n children,\n ref: forwardedRef,\n ...rest\n}: PropsWithChildren<SnackbarItemProps>) => {\n const innerRef = useRef(null)\n const ref = typeof forwardedRef !== 'function' ? forwardedRef || innerRef : innerRef\n\n const { toast, state } = useSnackbarItemContext()\n\n const { state: swipeState, direction: swipeDirection } = useSwipe({\n swipeRef: ref,\n onSwipeStart: state.pauseAll,\n onSwipeCancel: state.resumeAll,\n onSwipeEnd: ({ direction }) => {\n ;['left', 'right'].includes(`${direction}`) && state.close(toast.key)\n },\n })\n\n const { message, icon, isClosable, onAction, actionLabel } = toast.content\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n const actionOnNewline = actionOnNewlineProp ?? toast.content.actionOnNewline\n\n const ariaProps = {\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaDetails,\n }\n\n const { toastProps, titleProps, closeButtonProps, contentProps } = useToast(\n { toast, ...ariaProps },\n state,\n ref\n )\n\n const findElement = useCallback(\n <P extends object>(elementDisplayName: string): ReactElement<P> | undefined => {\n const childrenArray = Children.toArray(children)\n\n const match = childrenArray\n .filter(isValidElement)\n .find(\n (child): child is ReactElement<P> =>\n !!(child.type as FC<P> & { displayName?: string }).displayName?.includes(\n elementDisplayName\n )\n )\n\n return match as ReactElement<P> | undefined\n },\n [children]\n )\n\n const iconFromChildren = findElement<SnackbarItemIconProps>('Snackbar.ItemIcon')\n const actionBtnFromChildren = findElement<SnackbarItemActionProps>('Snackbar.ItemAction')\n const closeBtnFromChildren = findElement<SnackbarItemCloseProps>('Snackbar.ItemClose')\n\n return (\n <div\n className={snackbarItemVariant({ design, intent, className })}\n data-animation={toast.animation}\n {...(!(swipeState === 'cancel' && toast.animation === 'exiting') && {\n 'data-swipe': swipeState,\n 'data-swipe-direction': swipeDirection,\n })}\n {...(toast.animation === 'exiting' && {\n // Remove snackbar when the exiting animation completes\n onAnimationEnd: () => state.remove(toast.key),\n })}\n ref={ref}\n {...toastProps}\n {...rest}\n >\n <div className={snackbarItemVariantContent({ actionOnNewline })} {...contentProps}>\n {/* 1. ICON */}\n {renderSubComponent(iconFromChildren, icon ? SnackbarItemIcon : null, {\n children: icon,\n })}\n\n {/* 2. MESSAGE */}\n <p\n className=\"px-md py-lg text-body-2 row-span-3\"\n style={{ gridArea: 'message' }}\n {...titleProps}\n >\n {message}\n </p>\n\n {/* 3. ACTION BUTTON */}\n {renderSubComponent(\n actionBtnFromChildren,\n actionLabel && onAction ? SnackbarItemAction : null,\n { intent, design, onClick: onAction, children: actionLabel }\n )}\n\n {/* 4. CLOSE BUTTON */}\n {renderSubComponent(closeBtnFromChildren, isClosable ? SnackbarItemClose : null, {\n intent,\n design,\n /**\n * React Spectrum typing of aria-label is inaccurate, and aria-label value should never be undefined.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useLocalizedStringFormatter.ts#L40\n */\n 'aria-label': closeButtonProps['aria-label'] as string,\n })}\n </div>\n </div>\n )\n}\n\nSnackbarItem.displayName = 'Snackbar.Item'\n\n/**\n * Returns compound item if found in children prop.\n * If not fallbacks to default item, conditionned by addSnackbar options.\n */\nconst renderSubComponent = <P extends object>(\n childItem?: ReactElement<P>,\n defaultItem?: FC<P> | null,\n props?: P\n) => {\n if (childItem) {\n return cloneElement(childItem, { ...props, ...childItem.props })\n } else if (defaultItem) {\n const Item = defaultItem\n\n return <Item {...(props as P)} />\n } else {\n return null\n }\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, tintedVariants } from './snackbarVariants'\n\nexport const snackbarItemVariant = cva(\n [\n 'rounded-md shadow-sm',\n 'max-w-[600px]',\n 'cursor-default pointer-events-auto touch-none select-none',\n 'absolute',\n /**\n * Focus\n */\n 'group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset',\n /**\n * Positionning\n */\n 'group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0',\n 'group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0',\n /**\n * Animation and opacity\n */\n '[animation-fill-mode: forwards]!',\n 'data-[animation=queued]:animate-fade-in',\n 'data-[animation=entering]:easing-decelerate-back',\n 'data-[animation=exiting]:easing-standard',\n // Parent position bottom|bottom-left|bottom-right\n 'data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity',\n 'data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom',\n 'data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom',\n 'data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom',\n // Parent position top|top-left|top-right\n 'data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top',\n 'data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top',\n 'data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top',\n /**\n * Swipe\n */\n 'data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x)',\n 'data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x)',\n 'data-[swipe=cancel]:translate-x-0',\n 'data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right',\n 'data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left',\n ],\n {\n variants: {\n /**\n * Set different look and feel\n * @default 'filled'\n */\n design: {\n filled: '',\n tinted: '',\n },\n /**\n * Set color intent\n * @default 'neutral'\n */\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n basic: '',\n support: '',\n accent: '',\n inverse: '',\n },\n },\n compoundVariants: [...filledVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport const snackbarItemVariantContent = cva(\n [\n 'inline-grid items-center',\n 'col-start-1 row-start-1',\n 'pl-md pr-lg', // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷\n ],\n {\n variants: {\n /**\n * Force action button displaying on a new line\n * @default false\n */\n actionOnNewline: {\n true: [\n 'grid-rows-[52px_1fr_52px]',\n 'grid-cols-[min-content_1fr_min-content]',\n \"[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']\",\n ],\n false: [\n 'grid-cols-[min-content_1fr_min-content_min-content]',\n \"[grid-template-areas:'icon_message_action_close']\",\n ],\n },\n },\n defaultVariants: {\n actionOnNewline: false,\n },\n }\n)\n\nexport type SnackbarItemVariantProps = VariantProps<typeof snackbarItemVariant>\nexport type SnackbarItemVariantContentProps = VariantProps<typeof snackbarItemVariantContent>\n","export const filledVariants = [\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main'],\n },\n {\n design: 'filled',\n intent: 'basic',\n class: ['bg-basic text-on-basic'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent'],\n },\n {\n design: 'filled',\n intent: 'inverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n] as const\n\nexport const tintedVariants = [\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container'],\n },\n {\n design: 'tinted',\n intent: 'basic',\n class: ['bg-basic-container text-on-basic-container'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container'],\n },\n {\n design: 'tinted',\n intent: 'inverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n] as const\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Button, type ButtonProps } from '../button'\nimport type { SnackbarItemVariantProps } from './SnackbarItem.styles'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\n\nexport type SnackbarItemActionProps = Omit<ButtonProps, 'size' | 'shape' | 'intent'> &\n SnackbarItemVariantProps & {\n ref?: Ref<HTMLButtonElement>\n }\n\nexport const SnackbarItemAction = ({\n design: designProp = 'filled',\n intent: intentProp = 'neutral',\n onClick,\n children,\n className,\n ref,\n ...rest\n}: SnackbarItemActionProps) => {\n const { toast, state } = useSnackbarItemContext()\n\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n\n return (\n <Button\n ref={ref}\n size=\"md\"\n shape=\"rounded\"\n {...(intent === 'inverse'\n ? {\n design: 'ghost',\n intent: 'surface',\n }\n : {\n design,\n intent: intent === 'error' ? 'danger' : intent,\n })}\n onClick={e => {\n onClick?.(e)\n state.close(toast.key)\n }}\n style={{ gridArea: 'action', ...rest.style }}\n className={cx('ml-md justify-self-end', className)}\n {...rest}\n >\n {children}\n </Button>\n )\n}\n\nSnackbarItemAction.displayName = 'Snackbar.ItemAction'\n","import { QueuedToast, ToastState } from '@react-stately/toast'\nimport { createContext, useContext } from 'react'\n\nimport type { SnackbarItemValue } from './SnackbarItem'\n\nexport interface SnackbarItemState<T = SnackbarItemValue> {\n toast: QueuedToast<T>\n state: ToastState<T>\n}\n\nexport const SnackbarItemContext = createContext<SnackbarItemState>({} as SnackbarItemState)\n\nexport const useSnackbarItemContext = () => useContext(SnackbarItemContext)\n","import { Close } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithRef } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport type { SnackbarItemVariantProps } from './SnackbarItem.styles'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\n\nexport interface SnackbarItemCloseProps\n extends Omit<ComponentPropsWithRef<'button'>, 'aria-label' | 'disabled'>,\n Pick<IconButtonProps, 'aria-label'>,\n SnackbarItemVariantProps {}\n\nexport const SnackbarItemClose = ({\n design: designProp = 'filled',\n intent: intentProp = 'neutral',\n 'aria-label': ariaLabel,\n onClick,\n className,\n ref,\n ...rest\n}: SnackbarItemCloseProps) => {\n const { toast, state } = useSnackbarItemContext()\n\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n\n return (\n <IconButton\n ref={ref}\n size=\"md\"\n shape=\"rounded\"\n {...(intent === 'inverse'\n ? {\n design: 'ghost',\n intent: 'surface',\n }\n : {\n design,\n intent: intent === 'error' ? 'danger' : intent,\n })}\n aria-label={ariaLabel}\n onClick={e => {\n onClick?.(e)\n state.close(toast.key)\n }}\n style={{ gridArea: 'close', ...rest.style }}\n className={cx('ml-md justify-self-end', className)}\n {...rest}\n >\n <Icon size=\"sm\">\n <Close />\n </Icon>\n </IconButton>\n )\n}\n\nSnackbarItemClose.displayName = 'Snackbar.ItemClose'\n","import { cx } from 'class-variance-authority'\nimport type { ReactElement } from 'react'\n\nimport { Icon, type IconProps } from '../icon'\n\nexport type SnackbarItemIconProps = IconProps\n\nexport const SnackbarItemIcon = ({\n children,\n className,\n ...rest\n}: SnackbarItemIconProps): ReactElement => (\n <Icon\n size=\"md\"\n className={cx('mx-md', className)}\n style={{ gridArea: 'icon', ...rest.style }}\n {...rest}\n >\n {children}\n </Icon>\n)\n\nSnackbarItemIcon.displayName = 'Snackbar.ItemIcon'\n","/* eslint-disable complexity */\nimport { type RefObject, useEffect, useRef, useState } from 'react'\n\ninterface SwipeArgs<T> {\n swipeRef: RefObject<T | null>\n onSwipeStart?: ({ state, direction }: SwipeReturn) => void\n onSwipeMove?: ({ state, direction }: SwipeReturn) => void\n onSwipeCancel?: ({ state, direction }: SwipeReturn) => void\n onSwipeEnd?: ({ state, direction }: SwipeReturn) => void\n threshold?: number\n}\n\ninterface SwipeReturn {\n state?: 'start' | 'move' | 'cancel' | 'end'\n direction?: 'up' | 'down' | 'right' | 'left' | null\n}\n\nconst SWIPE_THRESHOLD = 75\n\nexport const useSwipe = <T extends HTMLElement>({\n swipeRef,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n threshold = 10,\n}: SwipeArgs<T>): SwipeReturn => {\n const [state, setState] = useState<SwipeReturn['state']>()\n\n const direction = useRef<SwipeReturn['direction']>(null)\n const origin = useRef<Record<'x' | 'y', number> | null>(null)\n const delta = useRef<Record<'x' | 'y', number> | null>(null)\n\n const handleSwipeStart = (evt: PointerEvent) => {\n origin.current = { x: evt.clientX, y: evt.clientY }\n\n /**\n * Prevents unwanted text selection in Safari browser (longpress)\n */\n document.addEventListener('selectstart', e => e.preventDefault())\n }\n\n const handleSwipeMove = (evt: PointerEvent) => {\n if (!origin.current) return\n\n const deltaX = Math.abs(evt.clientX - origin.current.x)\n const deltaY = Math.abs(evt.clientY - origin.current.y)\n\n let moveState: SwipeReturn['state']\n\n if (deltaX > deltaY && deltaX > threshold) {\n direction.current = evt.clientX > origin.current.x ? 'right' : 'left'\n } else if (deltaY > threshold) {\n direction.current = evt.clientY > origin.current.y ? 'down' : 'up'\n }\n\n /**\n * If no direction could be defined, then no move should be handled.\n * This is particularly true with trackpads working with MacOS/Windows.\n */\n if (!direction.current) return\n\n if (!delta.current) {\n moveState = 'start'\n delta.current = { x: deltaX, y: deltaY }\n onSwipeStart?.({ state: moveState, direction: direction.current })\n } else {\n moveState = 'move'\n delta.current = { x: deltaX, y: deltaY }\n ;(swipeRef.current as T).style.setProperty(\n '--swipe-position-x',\n `${deltaX > deltaY ? evt.clientX - origin.current.x : 0}px`\n )\n ;(swipeRef.current as T).style.setProperty(\n '--swipe-position-y',\n `${!(deltaX > deltaY) ? evt.clientY - origin.current.y : 0}px`\n )\n onSwipeMove?.({ state: moveState, direction: direction.current })\n }\n\n setState(moveState)\n }\n\n const handleSwipeEnd = () => {\n const proxyDelta = delta.current\n\n origin.current = null\n delta.current = null\n\n if (proxyDelta) {\n const { x: deltaX, y: deltaY } = proxyDelta\n\n let endState: SwipeReturn['state']\n\n if (deltaX > deltaY) {\n if (deltaX > SWIPE_THRESHOLD) {\n endState = 'end'\n onSwipeEnd?.({ state: endState, direction: direction.current })\n } else {\n endState = 'cancel'\n onSwipeCancel?.({ state: endState, direction: direction.current })\n }\n } else {\n if (deltaY > SWIPE_THRESHOLD) {\n endState = 'end'\n onSwipeEnd?.({ state: endState, direction: direction.current })\n } else {\n endState = 'cancel'\n onSwipeCancel?.({ state: endState, direction: direction.current })\n }\n }\n\n setState(endState)\n\n /**\n * Prevents unwanted text selection in Safari browser (longpress)\n */\n document.removeEventListener('selectstart', e => e.preventDefault())\n }\n }\n\n useEffect(() => {\n if (!swipeRef.current) return\n\n const swipeElement = swipeRef.current\n\n swipeElement.addEventListener('pointerdown', handleSwipeStart)\n document.addEventListener('pointermove', handleSwipeMove)\n document.addEventListener('pointerup', handleSwipeEnd)\n\n return () => {\n swipeElement.removeEventListener('pointerdown', handleSwipeStart)\n document.removeEventListener('pointermove', handleSwipeMove)\n document.removeEventListener('pointerup', handleSwipeEnd)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return {\n state,\n direction: direction.current,\n }\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const snackbarRegionVariant = cva(\n [\n 'fixed inset-x-lg z-toast group',\n 'outline-hidden pointer-events-none',\n 'grid grid-rows-1 grid-cols-1 gap-lg',\n ],\n {\n variants: {\n /**\n * Set snackbar item position\n * @default 'bottom'\n */\n position: {\n top: 'top-lg justify-items-center',\n 'top-right': 'top-lg justify-items-end',\n 'top-left': 'top-lg justify-items-start',\n bottom: 'bottom-lg justify-items-center',\n 'bottom-right': 'bottom-lg justify-items-end',\n 'bottom-left': 'bottom-lg justify-items-start',\n },\n },\n defaultVariants: {\n position: 'bottom',\n },\n }\n)\n\nexport type SnackbarRegionVariantProps = VariantProps<typeof snackbarRegionVariant>\n","import { type RefObject, useCallback, useSyncExternalStore } from 'react'\n\ninterface UseSnackbarGlobalStoreArgs<T> {\n providers: Set<T>\n subscriptions: Set<() => void>\n}\n\ninterface UseSnackbarGlobalStoreReturn<T> {\n provider: T\n addProvider: (ref: T) => void\n deleteProvider: (ref: T) => void\n}\n\n/**\n * This hook is a basic abstraction of useSyncExternalStore hook which allows us\n * to consume data from an external data store.\n *\n * Cf. https://react.dev/reference/react/useSyncExternalStore#subscribing-to-an-external-store\n */\n\nexport const useSnackbarGlobalStore = <T = RefObject<HTMLDivElement | null>>({\n providers,\n subscriptions,\n}: UseSnackbarGlobalStoreArgs<T>): UseSnackbarGlobalStoreReturn<T> => {\n const subscribe = useCallback(\n (listener: () => void) => {\n subscriptions.add(listener)\n\n return () => subscriptions.delete(listener)\n },\n [subscriptions]\n )\n\n const getLastSnackbarProvider = useCallback(() => [...providers].reverse()[0] as T, [providers])\n\n const addProvider = useCallback(\n (provider: T) => {\n providers.add(provider)\n\n for (const subscribeFn of subscriptions) {\n subscribeFn()\n }\n },\n [providers, subscriptions]\n )\n\n const deleteProvider = useCallback(\n (provider: T) => {\n providers.delete(provider)\n\n for (const subscribeFn of subscriptions) {\n subscribeFn()\n }\n },\n [providers, subscriptions]\n )\n\n const provider = useSyncExternalStore(subscribe, getLastSnackbarProvider, getLastSnackbarProvider)\n\n return {\n provider,\n addProvider,\n deleteProvider,\n }\n}\n","import {\n addSnackbar,\n type AddSnackbarArgs,\n clearSnackbarQueue,\n Snackbar as Root,\n type SnackbarProps,\n} from './Snackbar'\nimport { SnackbarItem as Item, type SnackbarItemProps } from './SnackbarItem'\nimport {\n SnackbarItemAction as ItemAction,\n type SnackbarItemActionProps,\n} from './SnackbarItemAction'\nimport { SnackbarItemClose as ItemClose, type SnackbarItemCloseProps } from './SnackbarItemClose'\nimport { SnackbarItemIcon as ItemIcon, type SnackbarItemIconProps } from './SnackbarItemIcon'\n\nexport const Snackbar: typeof Root & {\n Item: typeof Item\n ItemAction: typeof ItemAction\n ItemClose: typeof ItemClose\n ItemIcon: typeof ItemIcon\n} = Object.assign(Root, {\n Item,\n ItemAction,\n ItemClose,\n ItemIcon,\n})\n\nSnackbar.displayName = 'Snackbar'\nItem.displayName = 'Snackbar.Item'\nItemAction.displayName = 'Snackbar.ItemAction'\nItemClose.displayName = 'Snackbar.ItemClose'\nItemIcon.displayName = 'Snackbar.ItemIcon'\n\nexport type {\n SnackbarProps,\n SnackbarItemProps,\n SnackbarItemActionProps,\n SnackbarItemCloseProps,\n SnackbarItemIconProps,\n AddSnackbarArgs,\n}\nexport { addSnackbar, clearSnackbarQueue }\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA,EAEE;AAAA,EACA;AAAA,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;AAmBhB,IAAM,cAAc,CAAC,EAAE,SAAS,UAAU,KAAM,UAAU,GAAG,QAAQ,MAAuB;AACjG,QAAM,QAAQ,uBAAuB;AAErC,QAAM,IAAI,SAAS;AAAA,IACjB;AAAA,IACA,SAAS,WAAW,CAAC,QAAQ,WAAW,KAAK,IAAI,SAAS,GAAI,IAAI;AAAA,IAClE;AAAA,EACF,CAAC;AACH;;;AYrFO,IAAMG,YAKT,OAAO,OAAO,UAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDA,UAAS,cAAc;AACvB,aAAK,cAAc;AACnB,mBAAW,cAAc;AACzB,kBAAU,cAAc;AACxB,iBAAS,cAAc;","names":["useEffect","useRef","cloneElement","useRef","useRef","cx","jsx","cx","cx","jsx","cx","jsx","useRef","cva","jsx","useRef","cloneElement","useCallback","provider","jsx","useRef","useEffect","Snackbar"]}
|
|
1
|
+
{"version":3,"sources":["../../src/snackbar/Snackbar.tsx","../../src/snackbar/SnackbarRegion.tsx","../../src/snackbar/SnackbarItem.tsx","../../src/snackbar/SnackbarItem.styles.ts","../../src/snackbar/snackbarVariants.ts","../../src/snackbar/SnackbarItemAction.tsx","../../src/snackbar/SnackbarItemContext.tsx","../../src/snackbar/SnackbarItemClose.tsx","../../src/snackbar/SnackbarItemIcon.tsx","../../src/snackbar/useSwipe.ts","../../src/snackbar/SnackbarRegion.styles.ts","../../src/snackbar/useSnackbarGlobalStore.ts","../../src/snackbar/index.ts"],"sourcesContent":["import {\n type ToastOptions as SnackBarItemOptions,\n ToastQueue,\n useToastQueue,\n} from '@react-stately/toast'\nimport { type ReactElement, Ref, type RefObject, useEffect, useRef } from 'react'\nimport { createPortal } from 'react-dom'\n\nimport { type SnackbarItemValue } from './SnackbarItem'\nimport { SnackbarRegion, type SnackbarRegionProps } from './SnackbarRegion'\nimport { useSnackbarGlobalStore } from './useSnackbarGlobalStore'\n\n/**\n * We define here a global queue thanks to dedicated util from React Spectrum.\n * It is based on React `useSyncExternalStore` and allows us to consume data from\n * an external data store, and thus preventing use of React context that could\n * lead to unwanted rerenderings. It also simplifies initial implementation.\n */\nlet GLOBAL_SNACKBAR_QUEUE: ToastQueue<SnackbarItemValue> | null = null\n\nconst getGlobalSnackBarQueue = () => {\n if (!GLOBAL_SNACKBAR_QUEUE) {\n GLOBAL_SNACKBAR_QUEUE = new ToastQueue({\n maxVisibleToasts: 1,\n hasExitAnimation: true,\n })\n }\n\n return GLOBAL_SNACKBAR_QUEUE\n}\n\nexport const clearSnackbarQueue = () => {\n GLOBAL_SNACKBAR_QUEUE = null\n}\n\n/**\n * We define a global store to keep track of all providers instances, to ensure\n * we always have a single Snackbar container.\n */\nconst GLOBAL_SNACKBAR_STORE = {\n providers: new Set<RefObject<HTMLDivElement | null>>(),\n subscriptions: new Set<() => void>(),\n}\n\nexport type SnackbarProps = Omit<SnackbarRegionProps, 'state'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Snackbar = ({ ref: forwardedRef, ...props }: SnackbarProps): ReactElement | null => {\n const ref = useRef<HTMLDivElement>(null)\n\n const state = useToastQueue(getGlobalSnackBarQueue())\n\n const { provider, addProvider, deleteProvider } = useSnackbarGlobalStore(GLOBAL_SNACKBAR_STORE)\n\n useEffect(() => {\n addProvider(ref)\n\n return () => {\n for (const toast of getGlobalSnackBarQueue().visibleToasts) {\n toast.animation = undefined\n }\n\n deleteProvider(ref)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return ref === provider && state.visibleToasts.length > 0\n ? createPortal(<SnackbarRegion ref={forwardedRef} state={state} {...props} />, document.body)\n : null\n}\n\nSnackbar.displayName = 'Snackbar'\n\nexport interface AddSnackbarArgs extends SnackbarItemValue, Omit<SnackBarItemOptions, 'timeout'> {\n /**\n * Handler that is called when the snackbar is closed, either by the user\n * or after a timeout.\n */\n onClose?: () => void\n /**\n * A timeout to automatically close the snackbar after, in milliseconds.\n * @default 5000\n */\n timeout?: number | null\n /**\n * The priority of the snackbar relative to other snackbars. Larger numbers indicate higher priority.\n */\n priority?: number\n}\n\nexport const addSnackbar = ({ onClose, timeout = 5000, priority, ...content }: AddSnackbarArgs) => {\n const queue = getGlobalSnackBarQueue()\n\n queue.add(content, {\n onClose,\n timeout: timeout && !content.onAction ? Math.max(timeout, 5000) : undefined,\n priority,\n })\n}\n","import { type AriaToastRegionProps, useToastRegion } from '@react-aria/toast'\nimport { cloneElement, type ComponentPropsWithRef, type ReactElement, useRef } from 'react'\n\nimport { SnackbarItem, type SnackbarItemProps } from './SnackbarItem'\nimport { SnackbarItemContext, type SnackbarItemState } from './SnackbarItemContext'\nimport { snackbarRegionVariant, type SnackbarRegionVariantProps } from './SnackbarRegion.styles'\n\nexport interface SnackbarRegionProps\n extends ComponentPropsWithRef<'div'>,\n AriaToastRegionProps,\n SnackbarRegionVariantProps,\n Pick<SnackbarItemState, 'state'> {\n /**\n * An accessibility label for the snackbar region.\n * @default 'Notifications'\n */\n 'aria-label'?: string\n /**\n * Identifies the element (or elements) that labels the current element.\n */\n 'aria-labelledby'?: string\n /**\n * Identifies the element (or elements) that describes the object.\n */\n 'aria-describedby'?: string\n /**\n * Identifies the element (or elements) that provide a detailed, extended description for the object.\n */\n 'aria-details'?: string\n /**\n * The component/template used to display each snackbar from the queue\n * @default 'Snackbar.Item'\n */\n children?: ReactElement<SnackbarItemProps, typeof SnackbarItem>\n}\n\nexport const SnackbarRegion = ({\n children = <SnackbarItem />,\n state,\n position = 'bottom',\n className,\n ref: forwardedRef,\n ...rest\n}: SnackbarRegionProps): ReactElement => {\n const innerRef = useRef<HTMLDivElement>(null)\n const ref = forwardedRef && typeof forwardedRef !== 'function' ? forwardedRef : innerRef\n\n const { regionProps } = useToastRegion(rest, state, ref)\n\n return (\n <div\n {...regionProps}\n ref={ref}\n data-position={position}\n className={snackbarRegionVariant({ position, className })}\n >\n {state.visibleToasts.map(toast => (\n <SnackbarItemContext.Provider key={toast.key} value={{ toast, state }}>\n {cloneElement(children, { key: toast.key })}\n </SnackbarItemContext.Provider>\n ))}\n </div>\n )\n}\n","/* eslint-disable max-lines-per-function */\n\nimport { useToast } from '@react-aria/toast'\nimport {\n Children,\n cloneElement,\n type ComponentPropsWithRef,\n type FC,\n isValidElement,\n type PropsWithChildren,\n type ReactElement,\n type ReactNode,\n useCallback,\n useRef,\n} from 'react'\n\nimport {\n snackbarItemVariant,\n snackbarItemVariantContent,\n type SnackbarItemVariantContentProps,\n type SnackbarItemVariantProps,\n} from './SnackbarItem.styles'\nimport { SnackbarItemAction, SnackbarItemActionProps } from './SnackbarItemAction'\nimport { SnackbarItemClose, SnackbarItemCloseProps } from './SnackbarItemClose'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\nimport { SnackbarItemIcon, SnackbarItemIconProps } from './SnackbarItemIcon'\nimport { useSwipe } from './useSwipe'\n\nexport interface SnackbarItemValue extends SnackbarItemVariantProps {\n /**\n * Icon that will be prepended before snackbar message\n */\n icon?: ReactNode\n message: ReactNode\n /**\n * If `true` snackbar will display a close button\n * @default false\n */\n isClosable?: boolean\n /**\n * A label for the action button within the toast.\n */\n actionLabel?: string\n /**\n * Handler that is called when the action button is pressed.\n */\n onAction?: () => void\n /**\n * If `true` the action button will be displayed on a new line.\n * @default false\n */\n actionOnNewline?: boolean\n}\n\nexport interface SnackbarItemProps\n extends ComponentPropsWithRef<'div'>,\n SnackbarItemVariantProps,\n SnackbarItemVariantContentProps {\n /**\n * Defines a string value that labels the current element.\n */\n 'aria-label'?: string\n /**\n * Identifies the element (or elements) that labels the current element.\n */\n 'aria-labelledby'?: string\n /**\n * Identifies the element (or elements) that describes the object.\n */\n 'aria-describedby'?: string\n /**\n * Identifies the element (or elements) that provide a detailed, extended description for the object.\n */\n 'aria-details'?: string\n}\n\nexport const SnackbarItem = ({\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-details': ariaDetails,\n design: designProp,\n intent: intentProp,\n actionOnNewline: actionOnNewlineProp,\n className,\n children,\n ref: forwardedRef,\n ...rest\n}: PropsWithChildren<SnackbarItemProps>) => {\n const innerRef = useRef(null)\n const ref = typeof forwardedRef !== 'function' ? forwardedRef || innerRef : innerRef\n\n const { toast, state } = useSnackbarItemContext()\n\n const { state: swipeState, direction: swipeDirection } = useSwipe({\n swipeRef: ref,\n onSwipeStart: state.pauseAll,\n onSwipeCancel: state.resumeAll,\n onSwipeEnd: ({ direction }) => {\n ;['left', 'right'].includes(`${direction}`) && state.close(toast.key)\n },\n })\n\n const { message, icon, isClosable, onAction, actionLabel } = toast.content\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n const actionOnNewline = actionOnNewlineProp ?? toast.content.actionOnNewline\n\n const ariaProps = {\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n ariaDetails,\n }\n\n const { toastProps, titleProps, closeButtonProps, contentProps } = useToast(\n { toast, ...ariaProps },\n state,\n ref\n )\n\n const findElement = useCallback(\n <P extends object>(elementDisplayName: string): ReactElement<P> | undefined => {\n const childrenArray = Children.toArray(children)\n\n const match = childrenArray\n .filter(isValidElement)\n .find(\n (child): child is ReactElement<P> =>\n !!(child.type as FC<P> & { displayName?: string }).displayName?.includes(\n elementDisplayName\n )\n )\n\n return match as ReactElement<P> | undefined\n },\n [children]\n )\n\n const iconFromChildren = findElement<SnackbarItemIconProps>('Snackbar.ItemIcon')\n const actionBtnFromChildren = findElement<SnackbarItemActionProps>('Snackbar.ItemAction')\n const closeBtnFromChildren = findElement<SnackbarItemCloseProps>('Snackbar.ItemClose')\n\n return (\n <div\n data-spark-component=\"snackbar-item\"\n className={snackbarItemVariant({ design, intent, className })}\n data-animation={toast.animation}\n {...(!(swipeState === 'cancel' && toast.animation === 'exiting') && {\n 'data-swipe': swipeState,\n 'data-swipe-direction': swipeDirection,\n })}\n {...(toast.animation === 'exiting' && {\n // Remove snackbar when the exiting animation completes\n onAnimationEnd: () => state.remove(toast.key),\n })}\n ref={ref}\n {...toastProps}\n {...rest}\n >\n <div className={snackbarItemVariantContent({ actionOnNewline })} {...contentProps}>\n {/* 1. ICON */}\n {renderSubComponent(iconFromChildren, icon ? SnackbarItemIcon : null, {\n children: icon,\n })}\n\n {/* 2. MESSAGE */}\n <p\n className=\"px-md py-lg text-body-2 row-span-3\"\n style={{ gridArea: 'message' }}\n {...titleProps}\n >\n {message}\n </p>\n\n {/* 3. ACTION BUTTON */}\n {renderSubComponent(\n actionBtnFromChildren,\n actionLabel && onAction ? SnackbarItemAction : null,\n { intent, design, onClick: onAction, children: actionLabel }\n )}\n\n {/* 4. CLOSE BUTTON */}\n {renderSubComponent(closeBtnFromChildren, isClosable ? SnackbarItemClose : null, {\n intent,\n design,\n /**\n * React Spectrum typing of aria-label is inaccurate, and aria-label value should never be undefined.\n * See https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/i18n/src/useLocalizedStringFormatter.ts#L40\n */\n 'aria-label': closeButtonProps['aria-label'] as string,\n })}\n </div>\n </div>\n )\n}\n\nSnackbarItem.displayName = 'Snackbar.Item'\n\n/**\n * Returns compound item if found in children prop.\n * If not fallbacks to default item, conditionned by addSnackbar options.\n */\nconst renderSubComponent = <P extends object>(\n childItem?: ReactElement<P>,\n defaultItem?: FC<P> | null,\n props?: P\n) => {\n if (childItem) {\n return cloneElement(childItem, { ...props, ...childItem.props })\n } else if (defaultItem) {\n const Item = defaultItem\n\n return <Item {...(props as P)} />\n } else {\n return null\n }\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nimport { filledVariants, tintedVariants } from './snackbarVariants'\n\nexport const snackbarItemVariant = cva(\n [\n 'rounded-md shadow-sm',\n 'max-w-[600px]',\n 'cursor-default pointer-events-auto touch-none select-none',\n 'absolute',\n /**\n * Focus\n */\n 'group-focus-visible:outline-hidden group-focus-visible:u-outline group-not-focus-visible:ring-inset',\n /**\n * Positionning\n */\n 'group-data-[position=bottom]:bottom-0 group-data-[position=bottom-left]:bottom-0 group-data-[position=bottom-right]:bottom-0',\n 'group-data-[position=top]:top-0 group-data-[position=top-left]:top-0 group-data-[position=top-right]:top-0',\n /**\n * Animation and opacity\n */\n '[animation-fill-mode: forwards]!',\n 'data-[animation=queued]:animate-fade-in',\n 'data-[animation=entering]:easing-decelerate-back',\n 'data-[animation=exiting]:easing-standard',\n // Parent position bottom|bottom-left|bottom-right\n 'data-[animation=entering]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:opacity-0 data-[animation=exiting]:transition-opacity',\n 'data-[animation=exiting]:group-data-[position=bottom]:[&:not([data-swipe])]:animate-slide-out-bottom',\n 'data-[animation=entering]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:group-data-[position=bottom-left]:[&:not([data-swipe])]:animate-slide-out-bottom',\n 'data-[animation=entering]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-in-bottom',\n 'data-[animation=exiting]:group-data-[position=bottom-right]:[&:not([data-swipe])]:animate-slide-out-bottom',\n // Parent position top|top-left|top-right\n 'data-[animation=entering]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top]:[&:not([data-swipe])]:animate-slide-out-top',\n 'data-[animation=entering]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top-left]:[&:not([data-swipe])]:animate-slide-out-top',\n 'data-[animation=entering]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-in-top',\n 'data-[animation=exiting]:group-data-[position=top-right]:[&:not([data-swipe])]:animate-slide-out-top',\n /**\n * Swipe\n */\n 'data-[swipe=move]:data-[swipe-direction=right]:translate-x-(--swipe-position-x)',\n 'data-[swipe=move]:data-[swipe-direction=left]:translate-x-(--swipe-position-x)',\n 'data-[swipe=cancel]:translate-x-0',\n 'data-[swipe=end]:data-[swipe-direction=right]:animate-standalone-swipe-out-right',\n 'data-[swipe=end]:data-[swipe-direction=left]:animate-standalone-swipe-out-left',\n ],\n {\n variants: {\n /**\n * Set different look and feel\n * @default 'filled'\n */\n design: {\n filled: '',\n tinted: '',\n },\n /**\n * Set color intent\n * @default 'neutral'\n */\n intent: {\n success: '',\n alert: '',\n error: '',\n info: '',\n neutral: '',\n main: '',\n basic: '',\n support: '',\n accent: '',\n inverse: '',\n },\n },\n compoundVariants: [...filledVariants, ...tintedVariants],\n defaultVariants: {\n design: 'filled',\n intent: 'neutral',\n },\n }\n)\n\nexport const snackbarItemVariantContent = cva(\n [\n 'inline-grid items-center',\n 'col-start-1 row-start-1',\n 'pl-md pr-lg', // applying padding on the parent prevents VoiceOver on Safari from reading snackbar content 🤷\n ],\n {\n variants: {\n /**\n * Force action button displaying on a new line\n * @default false\n */\n actionOnNewline: {\n true: [\n 'grid-rows-[52px_1fr_52px]',\n 'grid-cols-[min-content_1fr_min-content]',\n \"[grid-template-areas:'icon_message_close'_'._message_.'_'action_action_action']\",\n ],\n false: [\n 'grid-cols-[min-content_1fr_min-content_min-content]',\n \"[grid-template-areas:'icon_message_action_close']\",\n ],\n },\n },\n defaultVariants: {\n actionOnNewline: false,\n },\n }\n)\n\nexport type SnackbarItemVariantProps = VariantProps<typeof snackbarItemVariant>\nexport type SnackbarItemVariantContentProps = VariantProps<typeof snackbarItemVariantContent>\n","export const filledVariants = [\n {\n design: 'filled',\n intent: 'success',\n class: ['bg-success text-on-success'],\n },\n {\n design: 'filled',\n intent: 'alert',\n class: ['bg-alert text-on-alert'],\n },\n {\n design: 'filled',\n intent: 'error',\n class: ['bg-error text-on-error'],\n },\n {\n design: 'filled',\n intent: 'info',\n class: ['bg-info text-on-info'],\n },\n {\n design: 'filled',\n intent: 'neutral',\n class: ['bg-neutral text-on-neutral'],\n },\n {\n design: 'filled',\n intent: 'main',\n class: ['bg-main text-on-main'],\n },\n {\n design: 'filled',\n intent: 'basic',\n class: ['bg-basic text-on-basic'],\n },\n {\n design: 'filled',\n intent: 'support',\n class: ['bg-support text-on-support'],\n },\n {\n design: 'filled',\n intent: 'accent',\n class: ['bg-accent text-on-accent'],\n },\n {\n design: 'filled',\n intent: 'inverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n] as const\n\nexport const tintedVariants = [\n {\n design: 'tinted',\n intent: 'success',\n class: ['bg-success-container text-on-success-container'],\n },\n {\n design: 'tinted',\n intent: 'alert',\n class: ['bg-alert-container text-on-alert-container'],\n },\n {\n design: 'tinted',\n intent: 'error',\n class: ['bg-error-container text-on-error-container'],\n },\n {\n design: 'tinted',\n intent: 'info',\n class: ['bg-info-container text-on-info-container'],\n },\n {\n design: 'tinted',\n intent: 'neutral',\n class: ['bg-neutral-container text-on-neutral-container'],\n },\n {\n design: 'tinted',\n intent: 'main',\n class: ['bg-main-container text-on-main-container'],\n },\n {\n design: 'tinted',\n intent: 'basic',\n class: ['bg-basic-container text-on-basic-container'],\n },\n {\n design: 'tinted',\n intent: 'support',\n class: ['bg-support-container text-on-support-container'],\n },\n {\n design: 'tinted',\n intent: 'accent',\n class: ['bg-accent-container text-on-accent-container'],\n },\n {\n design: 'tinted',\n intent: 'inverse',\n class: ['bg-surface-inverse text-on-surface-inverse'],\n },\n] as const\n","import { cx } from 'class-variance-authority'\nimport { Ref } from 'react'\n\nimport { Button, type ButtonProps } from '../button'\nimport type { SnackbarItemVariantProps } from './SnackbarItem.styles'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\n\nexport type SnackbarItemActionProps = Omit<ButtonProps, 'size' | 'shape' | 'intent'> &\n SnackbarItemVariantProps & {\n ref?: Ref<HTMLButtonElement>\n }\n\nexport const SnackbarItemAction = ({\n design: designProp = 'filled',\n intent: intentProp = 'neutral',\n onClick,\n children,\n className,\n ref,\n ...rest\n}: SnackbarItemActionProps) => {\n const { toast, state } = useSnackbarItemContext()\n\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n\n return (\n <Button\n data-spark-component=\"snackbar-item-action\"\n ref={ref}\n size=\"md\"\n shape=\"rounded\"\n {...(intent === 'inverse'\n ? {\n design: 'ghost',\n intent: 'surface',\n }\n : {\n design,\n intent: intent === 'error' ? 'danger' : intent,\n })}\n onClick={e => {\n onClick?.(e)\n state.close(toast.key)\n }}\n style={{ gridArea: 'action', ...rest.style }}\n className={cx('ml-md justify-self-end', className)}\n {...rest}\n >\n {children}\n </Button>\n )\n}\n\nSnackbarItemAction.displayName = 'Snackbar.ItemAction'\n","import { QueuedToast, ToastState } from '@react-stately/toast'\nimport { createContext, useContext } from 'react'\n\nimport type { SnackbarItemValue } from './SnackbarItem'\n\nexport interface SnackbarItemState<T = SnackbarItemValue> {\n toast: QueuedToast<T>\n state: ToastState<T>\n}\n\nexport const SnackbarItemContext = createContext<SnackbarItemState>({} as SnackbarItemState)\n\nexport const useSnackbarItemContext = () => useContext(SnackbarItemContext)\n","import { Close } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithRef } from 'react'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport type { SnackbarItemVariantProps } from './SnackbarItem.styles'\nimport { useSnackbarItemContext } from './SnackbarItemContext'\n\nexport interface SnackbarItemCloseProps\n extends Omit<ComponentPropsWithRef<'button'>, 'aria-label' | 'disabled'>,\n Pick<IconButtonProps, 'aria-label'>,\n SnackbarItemVariantProps {}\n\nexport const SnackbarItemClose = ({\n design: designProp = 'filled',\n intent: intentProp = 'neutral',\n 'aria-label': ariaLabel,\n onClick,\n className,\n ref,\n ...rest\n}: SnackbarItemCloseProps) => {\n const { toast, state } = useSnackbarItemContext()\n\n const intent = intentProp ?? toast.content.intent\n const design = designProp ?? toast.content.design\n\n return (\n <IconButton\n data-spark-component=\"snackbar-item-close\"\n ref={ref}\n size=\"md\"\n shape=\"rounded\"\n {...(intent === 'inverse'\n ? {\n design: 'ghost',\n intent: 'surface',\n }\n : {\n design,\n intent: intent === 'error' ? 'danger' : intent,\n })}\n aria-label={ariaLabel}\n onClick={e => {\n onClick?.(e)\n state.close(toast.key)\n }}\n style={{ gridArea: 'close', ...rest.style }}\n className={cx('ml-md justify-self-end', className)}\n {...rest}\n >\n <Icon size=\"sm\">\n <Close />\n </Icon>\n </IconButton>\n )\n}\n\nSnackbarItemClose.displayName = 'Snackbar.ItemClose'\n","import { cx } from 'class-variance-authority'\nimport type { ReactElement } from 'react'\n\nimport { Icon, type IconProps } from '../icon'\n\nexport type SnackbarItemIconProps = IconProps\n\nexport const SnackbarItemIcon = ({\n children,\n className,\n ...rest\n}: SnackbarItemIconProps): ReactElement => (\n <Icon\n size=\"md\"\n className={cx('mx-md', className)}\n style={{ gridArea: 'icon', ...rest.style }}\n {...rest}\n >\n {children}\n </Icon>\n)\n\nSnackbarItemIcon.displayName = 'Snackbar.ItemIcon'\n","/* eslint-disable complexity */\nimport { type RefObject, useEffect, useRef, useState } from 'react'\n\ninterface SwipeArgs<T> {\n swipeRef: RefObject<T | null>\n onSwipeStart?: ({ state, direction }: SwipeReturn) => void\n onSwipeMove?: ({ state, direction }: SwipeReturn) => void\n onSwipeCancel?: ({ state, direction }: SwipeReturn) => void\n onSwipeEnd?: ({ state, direction }: SwipeReturn) => void\n threshold?: number\n}\n\ninterface SwipeReturn {\n state?: 'start' | 'move' | 'cancel' | 'end'\n direction?: 'up' | 'down' | 'right' | 'left' | null\n}\n\nconst SWIPE_THRESHOLD = 75\n\nexport const useSwipe = <T extends HTMLElement>({\n swipeRef,\n onSwipeStart,\n onSwipeMove,\n onSwipeCancel,\n onSwipeEnd,\n threshold = 10,\n}: SwipeArgs<T>): SwipeReturn => {\n const [state, setState] = useState<SwipeReturn['state']>()\n\n const direction = useRef<SwipeReturn['direction']>(null)\n const origin = useRef<Record<'x' | 'y', number> | null>(null)\n const delta = useRef<Record<'x' | 'y', number> | null>(null)\n\n const handleSwipeStart = (evt: PointerEvent) => {\n origin.current = { x: evt.clientX, y: evt.clientY }\n\n /**\n * Prevents unwanted text selection in Safari browser (longpress)\n */\n document.addEventListener('selectstart', e => e.preventDefault())\n }\n\n const handleSwipeMove = (evt: PointerEvent) => {\n if (!origin.current) return\n\n const deltaX = Math.abs(evt.clientX - origin.current.x)\n const deltaY = Math.abs(evt.clientY - origin.current.y)\n\n let moveState: SwipeReturn['state']\n\n if (deltaX > deltaY && deltaX > threshold) {\n direction.current = evt.clientX > origin.current.x ? 'right' : 'left'\n } else if (deltaY > threshold) {\n direction.current = evt.clientY > origin.current.y ? 'down' : 'up'\n }\n\n /**\n * If no direction could be defined, then no move should be handled.\n * This is particularly true with trackpads working with MacOS/Windows.\n */\n if (!direction.current) return\n\n if (!delta.current) {\n moveState = 'start'\n delta.current = { x: deltaX, y: deltaY }\n onSwipeStart?.({ state: moveState, direction: direction.current })\n } else {\n moveState = 'move'\n delta.current = { x: deltaX, y: deltaY }\n ;(swipeRef.current as T).style.setProperty(\n '--swipe-position-x',\n `${deltaX > deltaY ? evt.clientX - origin.current.x : 0}px`\n )\n ;(swipeRef.current as T).style.setProperty(\n '--swipe-position-y',\n `${!(deltaX > deltaY) ? evt.clientY - origin.current.y : 0}px`\n )\n onSwipeMove?.({ state: moveState, direction: direction.current })\n }\n\n setState(moveState)\n }\n\n const handleSwipeEnd = () => {\n const proxyDelta = delta.current\n\n origin.current = null\n delta.current = null\n\n if (proxyDelta) {\n const { x: deltaX, y: deltaY } = proxyDelta\n\n let endState: SwipeReturn['state']\n\n if (deltaX > deltaY) {\n if (deltaX > SWIPE_THRESHOLD) {\n endState = 'end'\n onSwipeEnd?.({ state: endState, direction: direction.current })\n } else {\n endState = 'cancel'\n onSwipeCancel?.({ state: endState, direction: direction.current })\n }\n } else {\n if (deltaY > SWIPE_THRESHOLD) {\n endState = 'end'\n onSwipeEnd?.({ state: endState, direction: direction.current })\n } else {\n endState = 'cancel'\n onSwipeCancel?.({ state: endState, direction: direction.current })\n }\n }\n\n setState(endState)\n\n /**\n * Prevents unwanted text selection in Safari browser (longpress)\n */\n document.removeEventListener('selectstart', e => e.preventDefault())\n }\n }\n\n useEffect(() => {\n if (!swipeRef.current) return\n\n const swipeElement = swipeRef.current\n\n swipeElement.addEventListener('pointerdown', handleSwipeStart)\n document.addEventListener('pointermove', handleSwipeMove)\n document.addEventListener('pointerup', handleSwipeEnd)\n\n return () => {\n swipeElement.removeEventListener('pointerdown', handleSwipeStart)\n document.removeEventListener('pointermove', handleSwipeMove)\n document.removeEventListener('pointerup', handleSwipeEnd)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n\n return {\n state,\n direction: direction.current,\n }\n}\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const snackbarRegionVariant = cva(\n [\n 'fixed inset-x-lg z-toast group',\n 'outline-hidden pointer-events-none',\n 'grid grid-rows-1 grid-cols-1 gap-lg',\n ],\n {\n variants: {\n /**\n * Set snackbar item position\n * @default 'bottom'\n */\n position: {\n top: 'top-lg justify-items-center',\n 'top-right': 'top-lg justify-items-end',\n 'top-left': 'top-lg justify-items-start',\n bottom: 'bottom-lg justify-items-center',\n 'bottom-right': 'bottom-lg justify-items-end',\n 'bottom-left': 'bottom-lg justify-items-start',\n },\n },\n defaultVariants: {\n position: 'bottom',\n },\n }\n)\n\nexport type SnackbarRegionVariantProps = VariantProps<typeof snackbarRegionVariant>\n","import { type RefObject, useCallback, useSyncExternalStore } from 'react'\n\ninterface UseSnackbarGlobalStoreArgs<T> {\n providers: Set<T>\n subscriptions: Set<() => void>\n}\n\ninterface UseSnackbarGlobalStoreReturn<T> {\n provider: T\n addProvider: (ref: T) => void\n deleteProvider: (ref: T) => void\n}\n\n/**\n * This hook is a basic abstraction of useSyncExternalStore hook which allows us\n * to consume data from an external data store.\n *\n * Cf. https://react.dev/reference/react/useSyncExternalStore#subscribing-to-an-external-store\n */\n\nexport const useSnackbarGlobalStore = <T = RefObject<HTMLDivElement | null>>({\n providers,\n subscriptions,\n}: UseSnackbarGlobalStoreArgs<T>): UseSnackbarGlobalStoreReturn<T> => {\n const subscribe = useCallback(\n (listener: () => void) => {\n subscriptions.add(listener)\n\n return () => subscriptions.delete(listener)\n },\n [subscriptions]\n )\n\n const getLastSnackbarProvider = useCallback(() => [...providers].reverse()[0] as T, [providers])\n\n const addProvider = useCallback(\n (provider: T) => {\n providers.add(provider)\n\n for (const subscribeFn of subscriptions) {\n subscribeFn()\n }\n },\n [providers, subscriptions]\n )\n\n const deleteProvider = useCallback(\n (provider: T) => {\n providers.delete(provider)\n\n for (const subscribeFn of subscriptions) {\n subscribeFn()\n }\n },\n [providers, subscriptions]\n )\n\n const provider = useSyncExternalStore(subscribe, getLastSnackbarProvider, getLastSnackbarProvider)\n\n return {\n provider,\n addProvider,\n deleteProvider,\n }\n}\n","import {\n addSnackbar,\n type AddSnackbarArgs,\n clearSnackbarQueue,\n Snackbar as Root,\n type SnackbarProps,\n} from './Snackbar'\nimport { SnackbarItem as Item, type SnackbarItemProps } from './SnackbarItem'\nimport {\n SnackbarItemAction as ItemAction,\n type SnackbarItemActionProps,\n} from './SnackbarItemAction'\nimport { SnackbarItemClose as ItemClose, type SnackbarItemCloseProps } from './SnackbarItemClose'\nimport { SnackbarItemIcon as ItemIcon, type SnackbarItemIconProps } from './SnackbarItemIcon'\n\nexport const Snackbar: typeof Root & {\n Item: typeof Item\n ItemAction: typeof ItemAction\n ItemClose: typeof ItemClose\n ItemIcon: typeof ItemIcon\n} = Object.assign(Root, {\n Item,\n ItemAction,\n ItemClose,\n ItemIcon,\n})\n\nSnackbar.displayName = 'Snackbar'\nItem.displayName = 'Snackbar.Item'\nItemAction.displayName = 'Snackbar.ItemAction'\nItemClose.displayName = 'Snackbar.ItemClose'\nItemIcon.displayName = 'Snackbar.ItemIcon'\n\nexport type {\n SnackbarProps,\n SnackbarItemProps,\n SnackbarItemActionProps,\n SnackbarItemCloseProps,\n SnackbarItemIconProps,\n AddSnackbarArgs,\n}\nexport { addSnackbar, clearSnackbarQueue }\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA,EAEE;AAAA,EACA;AAAA,OACK;AACP,SAAiD,aAAA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SAAS,IAAI,IAC1F;AACN;AAEA,SAAS,cAAc;AAmBhB,IAAM,cAAc,CAAC,EAAE,SAAS,UAAU,KAAM,UAAU,GAAG,QAAQ,MAAuB;AACjG,QAAM,QAAQ,uBAAuB;AAErC,QAAM,IAAI,SAAS;AAAA,IACjB;AAAA,IACA,SAAS,WAAW,CAAC,QAAQ,WAAW,KAAK,IAAI,SAAS,GAAI,IAAI;AAAA,IAClE;AAAA,EACF,CAAC;AACH;;;AYrFO,IAAMG,YAKT,OAAO,OAAO,UAAM;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAEDA,UAAS,cAAc;AACvB,aAAK,cAAc;AACnB,mBAAW,cAAc;AACzB,kBAAU,cAAc;AACxB,iBAAS,cAAc;","names":["useEffect","useRef","cloneElement","useRef","useRef","cx","jsx","cx","cx","jsx","cx","jsx","useRef","cva","jsx","useRef","cloneElement","useCallback","provider","jsx","useRef","useEffect","Snackbar"]}
|
package/dist/stepper/index.js
CHANGED
|
@@ -168,6 +168,7 @@ var Root = ({
|
|
|
168
168
|
"button",
|
|
169
169
|
{
|
|
170
170
|
ref,
|
|
171
|
+
"data-spark-component": "input-clear-button",
|
|
171
172
|
className: (0, import_class_variance_authority2.cx)(
|
|
172
173
|
className,
|
|
173
174
|
"pointer-events-auto absolute",
|
|
@@ -318,6 +319,7 @@ var InputGroup = ({
|
|
|
318
319
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(InputGroupContext.Provider, { value: current, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
319
320
|
"div",
|
|
320
321
|
{
|
|
322
|
+
"data-spark-component": "input-group",
|
|
321
323
|
ref: forwardedRef,
|
|
322
324
|
className: inputGroupStyles({ disabled, readOnly, className }),
|
|
323
325
|
...others,
|
|
@@ -438,6 +440,7 @@ var InputAddon = ({
|
|
|
438
440
|
Component,
|
|
439
441
|
{
|
|
440
442
|
ref,
|
|
443
|
+
"data-spark-component": "input-addon",
|
|
441
444
|
className: inputAddonStyles({
|
|
442
445
|
className,
|
|
443
446
|
intent: state,
|
|
@@ -485,6 +488,7 @@ var InputIcon = ({ className, intent, children, ...others }) => {
|
|
|
485
488
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
486
489
|
Icon,
|
|
487
490
|
{
|
|
491
|
+
"data-spark-component": "input-icon",
|
|
488
492
|
intent,
|
|
489
493
|
className: (0, import_class_variance_authority6.cx)(
|
|
490
494
|
className,
|
|
@@ -680,6 +684,7 @@ var Root4 = ({
|
|
|
680
684
|
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
681
685
|
Component,
|
|
682
686
|
{
|
|
687
|
+
"data-spark-component": "input",
|
|
683
688
|
ref,
|
|
684
689
|
id,
|
|
685
690
|
name,
|
|
@@ -1680,6 +1685,7 @@ var IconButton = ({
|
|
|
1680
1685
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1681
1686
|
Button,
|
|
1682
1687
|
{
|
|
1688
|
+
"data-spark-component": "icon-button",
|
|
1683
1689
|
ref,
|
|
1684
1690
|
className: iconButtonStyles({ size, className }),
|
|
1685
1691
|
design,
|
|
@@ -1707,7 +1713,7 @@ var IncrementButton = ({
|
|
|
1707
1713
|
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
1708
1714
|
const { incrementButtonProps } = useStepperContext();
|
|
1709
1715
|
const { buttonProps } = (0, import_button2.useButton)({ ...incrementButtonProps, ...rest }, ref);
|
|
1710
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.TrailingAddon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.TrailingAddon, { asChild: true, "data-spark-component": "stepper-increment-button", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1711
1717
|
IconButton,
|
|
1712
1718
|
{
|
|
1713
1719
|
ref,
|
|
@@ -1733,7 +1739,7 @@ var DecrementButton = ({
|
|
|
1733
1739
|
const ref = forwardedRef && typeof forwardedRef !== "function" ? forwardedRef : innerRef;
|
|
1734
1740
|
const { decrementButtonProps } = useStepperContext();
|
|
1735
1741
|
const { buttonProps } = (0, import_button2.useButton)({ ...decrementButtonProps, ...rest }, ref);
|
|
1736
|
-
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.LeadingAddon, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1742
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(InputGroup2.LeadingAddon, { asChild: true, "data-spark-component": "stepper-decrement-button", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1737
1743
|
IconButton,
|
|
1738
1744
|
{
|
|
1739
1745
|
ref,
|