@spark-ui/components 10.8.2 → 10.9.0
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 +7 -0
- package/dist/{DialogTrigger-5SI4dvpK.d.mts → DialogTrigger-woU7vsJi.d.mts} +9 -9
- package/dist/{DialogTrigger-5SI4dvpK.d.ts → DialogTrigger-woU7vsJi.d.ts} +9 -9
- package/dist/alert-dialog/index.d.mts +1 -1
- package/dist/alert-dialog/index.d.ts +1 -1
- package/dist/alert-dialog/index.js +60 -46
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +1 -1
- package/dist/{chunk-T26TYEWV.mjs → chunk-I7UIKCZK.mjs} +56 -42
- package/dist/chunk-I7UIKCZK.mjs.map +1 -0
- package/dist/dialog/index.d.mts +2 -2
- package/dist/dialog/index.d.ts +2 -2
- package/dist/dialog/index.js +52 -38
- package/dist/dialog/index.js.map +1 -1
- package/dist/dialog/index.mjs +1 -1
- package/dist/drawer/index.d.mts +6 -2
- package/dist/drawer/index.d.ts +6 -2
- package/dist/drawer/index.js +105 -59
- package/dist/drawer/index.js.map +1 -1
- package/dist/drawer/index.mjs +81 -35
- package/dist/drawer/index.mjs.map +1 -1
- package/dist/scrolling-list/index.d.mts +2 -2
- package/dist/scrolling-list/index.d.ts +2 -2
- package/dist/scrolling-list/index.js +32 -68
- package/dist/scrolling-list/index.js.map +1 -1
- package/dist/scrolling-list/index.mjs +7 -43
- package/dist/scrolling-list/index.mjs.map +1 -1
- package/dist/spinner/index.d.mts +1 -1
- package/dist/spinner/index.d.ts +1 -1
- package/package.json +5 -5
- package/dist/chunk-T26TYEWV.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/drawer/Drawer.tsx","../../src/drawer/DrawerBody.styles.ts","../../src/drawer/DrawerBody.tsx","../../src/drawer/DrawerCloseButton.tsx","../../src/drawer/DrawerClose.tsx","../../src/drawer/DrawerContent.tsx","../../src/drawer/DrawerContent.styles.tsx","../../src/drawer/DrawerDescription.tsx","../../src/drawer/DrawerFooter.tsx","../../src/drawer/DrawerHeader.tsx","../../src/drawer/DrawerOverlay.tsx","../../src/drawer/DrawerPortal.tsx","../../src/drawer/DrawerTitle.tsx","../../src/drawer/DrawerTrigger.tsx","../../src/drawer/index.ts"],"sourcesContent":["import { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement, ReactNode } from 'react'\n\nexport interface DrawerProps {\n /**\n * Children of the component.\n */\n children?: RadixDrawer.DialogProps['children']\n /**\n * Specifies if the dialog is open or not.\n */\n open?: RadixDrawer.DialogProps['open']\n /**\n * Default open state.\n */\n defaultOpen?: RadixDrawer.DialogProps['defaultOpen']\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: RadixDrawer.DialogProps['onOpenChange']\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: RadixDrawer.DialogProps['modal']\n}\n\nexport interface DialogProps {\n children?: ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n modal?: boolean\n}\n\nexport const Drawer = ({ children, ...rest }: DrawerProps): ReactElement => (\n <RadixDrawer.Root {...rest}>{children}</RadixDrawer.Root>\n)\n\nDrawer.displayName = 'Drawer.Root'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n defaultVariants: {\n inset: false,\n },\n }\n)\n\nexport type DrawerBodyStylesProps = VariantProps<typeof drawerBodyStyles>\n","import { type ReactNode, Ref } from 'react'\n\nimport { drawerBodyStyles, type DrawerBodyStylesProps } from './DrawerBody.styles'\n\nexport interface DrawerBodyProps extends DrawerBodyStylesProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerBody = ({\n children,\n inset = false,\n className,\n ref,\n ...rest\n}: DrawerBodyProps) => (\n <div\n data-spark-component=\"drawer-body\"\n ref={ref}\n className={drawerBodyStyles({ inset, className })}\n {...rest}\n >\n {children}\n </div>\n)\n\nDrawerBody.displayName = 'Drawer.Body'\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { DrawerClose, type DrawerCloseProps } from './DrawerClose'\n\nexport type DrawerCloseButtonProps = DrawerCloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nexport const DrawerCloseButton = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: DrawerCloseButtonProps) => (\n <DrawerClose\n data-spark-component=\"drawer-close-button\"\n ref={ref}\n className={cx(['absolute', 'top-sm', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </DrawerClose>\n)\n\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DrawerCloseProps = RadixDrawer.DialogCloseProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerClose = (props: DrawerCloseProps) => (\n <RadixDrawer.Close data-spark-component=\"drawer-close\" {...props} />\n)\n\nDrawerClose.displayName = 'Drawer.Close'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { drawerContentStyles, type DrawerContentStylesProps } from './DrawerContent.styles'\n\nexport type DrawerContentProps = RadixDrawer.DialogContentProps &\n DrawerContentStylesProps & {\n ref?: Ref<HTMLDivElement>\n }\n\nexport const DrawerContent = ({\n className,\n size = 'md',\n side = 'right',\n onInteractOutside,\n ref,\n ...rest\n}: DrawerContentProps) => (\n <RadixDrawer.Content\n data-spark-component=\"drawer-content\"\n ref={ref}\n className={drawerContentStyles({\n size,\n side,\n className,\n })}\n onInteractOutside={e => {\n const isForegroundElement = (e.target as HTMLElement).closest('.z-toast, .z-popover')\n\n /**\n * The focus trap of the drawer applies `pointer-events-none` on the body of the page in the background, but\n * some components with an higher z-index have `pointer-events-auto` applied on them to remain interactive and ignore the focust trap (ex: a Snackbar with actions).\n *\n * Clicking on the snackbar will be considered as an \"outside click\" and close the drawer. We want to prevent this.\n */\n if (isForegroundElement) {\n e.preventDefault()\n }\n\n onInteractOutside?.(e)\n }}\n {...rest}\n />\n)\n\nDrawerContent.displayName = 'Drawer.Content'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerContentStyles = cva(\n [\n ['fixed', 'z-modal', 'flex', 'flex-col'],\n ['bg-surface', 'shadow-md'],\n ],\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n fluid: '',\n fullscreen: 'h-screen w-screen',\n },\n side: {\n right: [\n 'inset-y-0 right-0',\n 'data-[state=open]:animate-slide-in-right',\n 'data-[state=closed]:animate-slide-out-right',\n ],\n left: [\n 'inset-y-0 left-0',\n 'data-[state=open]:animate-slide-in-left',\n 'data-[state=closed]:animate-slide-out-left',\n ],\n top: [\n 'top-0 left-0',\n 'w-screen',\n 'data-[state=open]:animate-slide-in-top',\n 'data-[state=closed]:animate-slide-out-top',\n ],\n bottom: [\n 'bottom-0 left-0',\n 'w-screen',\n 'data-[state=open]:animate-slide-in-bottom',\n 'data-[state=closed]:animate-slide-out-bottom',\n ],\n },\n },\n compoundVariants: [\n {\n side: ['right', 'left'],\n size: 'sm',\n class: ['w-sz-480', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'md',\n class: ['w-sz-672', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'lg',\n class: ['w-sz-864', 'max-w-full'],\n },\n {\n side: ['left', 'right'],\n size: 'fluid',\n class: ['w-auto', 'max-w-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'sm',\n class: ['h-sz-480', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'md',\n class: ['h-sz-672', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'lg',\n class: ['h-sz-864', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'fluid',\n class: ['h-auto', 'max-h-full'],\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n }\n)\n\nexport type DrawerContentStylesProps = VariantProps<typeof drawerContentStyles>\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DrawerDescriptionProps = RadixDrawer.DialogDescriptionProps & {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const DrawerDescription = (props: DrawerDescriptionProps) => (\n <RadixDrawer.Description data-spark-component=\"drawer-description\" {...props} />\n)\n\nDrawerDescription.displayName = 'Drawer.Description'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, type ReactElement, Ref } from 'react'\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerFooter = ({ className, ref, ...rest }: DrawerFooterProps): ReactElement => (\n <footer\n data-spark-component=\"drawer-footer\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n />\n)\n\nDrawerFooter.displayName = 'Drawer.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface DrawerHeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerHeader = ({\n children,\n className,\n ref,\n ...rest\n}: DrawerHeaderProps): ReactElement => (\n <header\n data-spark-component=\"drawer-header\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n >\n {children}\n </header>\n)\n\nDrawerHeader.displayName = 'Dialog.Header'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nexport type DrawerOverlayProps = RadixDrawer.DialogOverlayProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerOverlay = ({ className, ref, ...rest }: DrawerOverlayProps): ReactElement => (\n <RadixDrawer.Overlay\n data-spark-component=\"drawer-overlay\"\n ref={ref}\n className={cx(\n ['fixed', 'top-0', 'left-0', 'w-screen', 'h-screen', 'z-overlay'],\n ['bg-overlay/dim-1'],\n ['data-[state=open]:animate-fade-in'],\n ['data-[state=closed]:animate-fade-out'],\n className\n )}\n {...rest}\n />\n)\n\nDrawerOverlay.displayName = 'Drawer.Overlay'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement } from 'react'\n\nexport type DrawerPortalProps = RadixDrawer.DialogPortalProps\n\nexport const DrawerPortal = ({ children, ...rest }: DrawerPortalProps): ReactElement => (\n <RadixDrawer.Portal {...rest}>{children}</RadixDrawer.Portal>\n)\n\nDrawerPortal.displayName = 'Drawer.Portal'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DrawerTitleProps = RadixDrawer.DialogTitleProps & {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const DrawerTitle = ({ className, ref, ...others }: DrawerTitleProps) => (\n <RadixDrawer.Title\n data-spark-component=\"drawer-title\"\n ref={ref}\n className={cx('text-headline-2 text-on-surface', className)}\n {...others}\n />\n)\n\nDrawerTitle.displayName = 'Drawer.Title'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nexport interface DrawerTriggerProps extends RadixDrawer.DialogTriggerProps {\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 */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerTrigger = (props: DrawerTriggerProps): ReactElement => (\n <RadixDrawer.Trigger data-spark-component=\"drawer-trigger\" {...props} />\n)\n\nDrawerTrigger.displayName = 'Drawer.Trigger'\n","import { Drawer as Root } from './Drawer'\nimport { DrawerBody } from './DrawerBody'\nimport { DrawerCloseButton } from './DrawerCloseButton'\nimport { DrawerContent } from './DrawerContent'\nimport { DrawerDescription } from './DrawerDescription' // aria-describedby\nimport { DrawerFooter } from './DrawerFooter'\nimport { DrawerHeader } from './DrawerHeader'\nimport { DrawerOverlay } from './DrawerOverlay'\nimport { DrawerPortal } from './DrawerPortal'\nimport { DrawerTitle } from './DrawerTitle'\nimport { DrawerTrigger } from './DrawerTrigger'\n\nexport const Drawer: typeof Root & {\n Trigger: typeof DrawerTrigger\n Portal: typeof DrawerPortal\n Overlay: typeof DrawerOverlay\n Content: typeof DrawerContent\n Header: typeof DrawerHeader\n Body: typeof DrawerBody\n Footer: typeof DrawerFooter\n CloseButton: typeof DrawerCloseButton\n Title: typeof DrawerTitle\n Description: typeof DrawerDescription\n} = Object.assign(Root, {\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Overlay: DrawerOverlay,\n Content: DrawerContent,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n CloseButton: DrawerCloseButton,\n Title: DrawerTitle,\n Description: DrawerDescription,\n})\n\nDrawer.displayName = 'Drawer'\nDrawerTrigger.displayName = 'Drawer.Trigger'\nDrawerPortal.displayName = 'Drawer.Portal'\nDrawerOverlay.displayName = 'Drawer.Overlay'\nDrawerContent.displayName = 'Drawer.Content'\nDrawerHeader.displayName = 'Drawer.Header'\nDrawerBody.displayName = 'Drawer.Body'\nDrawerFooter.displayName = 'Drawer.Footer'\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\nDrawerTitle.displayName = 'Drawer.Title'\nDrawerDescription.displayName = 'Drawer.Description'\n\nexport { type DrawerProps } from './Drawer'\nexport { type DrawerContentProps } from './DrawerContent'\nexport { type DrawerHeaderProps } from './DrawerHeader'\nexport { type DrawerBodyProps } from './DrawerBody'\nexport { type DrawerFooterProps } from './DrawerFooter'\nexport { type DrawerTriggerProps } from './DrawerTrigger'\nexport { type DrawerOverlayProps } from './DrawerOverlay'\nexport { type DrawerPortalProps } from './DrawerPortal'\nexport { type DrawerTitleProps } from './DrawerTitle'\nexport { type DrawerDescriptionProps } from './DrawerDescription'\nexport { type DrawerCloseProps } from './DrawerClose'\nexport { type DrawerCloseButtonProps } from './DrawerCloseButton'\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,UAAU,mBAAmB;AAmCpC;AADK,IAAM,SAAS,CAAC,EAAE,UAAU,GAAG,KAAK,MACzC,oBAAC,YAAY,MAAZ,EAAkB,GAAG,MAAO,UAAS;AAGxC,OAAO,cAAc;;;ACtCrB,SAAS,WAAyB;AAE3B,IAAM,mBAAmB;AAAA,EAC9B,CAAC,QAAQ,mBAAmB,kBAAkB,yBAAyB;AAAA,EACvE;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,OAAO;AAAA,IACT;AAAA,EACF;AACF;;;ACEE,gBAAAA,YAAA;AAPK,IAAM,aAAa,CAAC;AAAA,EACzB;AAAA,EACA,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA,GAAG;AACL,MACE,gBAAAA;AAAA,EAAC;AAAA;AAAA,IACC,wBAAqB;AAAA,IACrB;AAAA,IACA,WAAW,iBAAiB,EAAE,OAAO,UAAU,CAAC;AAAA,IAC/C,GAAG;AAAA,IAEH;AAAA;AACH;AAGF,WAAW,cAAc;;;AC3BzB,SAAS,SAAS,gBAAgB;AAClC,SAAS,UAAU;;;ACDnB,SAAS,UAAUC,oBAAmB;AAQpC,gBAAAC,YAAA;AADK,IAAM,cAAc,CAAC,UAC1B,gBAAAA,KAACD,aAAY,OAAZ,EAAkB,wBAAqB,gBAAgB,GAAG,OAAO;AAGpE,YAAY,cAAc;;;ADKb,gBAAAE,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x","jsx","cx","jsx","cx","RadixDrawer","jsx","RadixDrawer","jsx","cx","RadixDrawer","jsx","RadixDrawer","jsx","Drawer"]}
|
|
1
|
+
{"version":3,"sources":["../../src/drawer/Drawer.tsx","../../src/drawer/DrawerContext.tsx","../../src/drawer/DrawerBody.tsx","../../src/drawer/DrawerBody.styles.ts","../../src/drawer/DrawerCloseButton.tsx","../../src/drawer/DrawerClose.tsx","../../src/drawer/DrawerContent.tsx","../../src/drawer/DrawerContent.styles.tsx","../../src/drawer/DrawerDescription.tsx","../../src/drawer/DrawerFooter.tsx","../../src/drawer/DrawerHeader.tsx","../../src/drawer/DrawerOverlay.tsx","../../src/drawer/DrawerPortal.tsx","../../src/drawer/DrawerTitle.tsx","../../src/drawer/DrawerTrigger.tsx","../../src/drawer/index.ts"],"sourcesContent":["import { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement, ReactNode } from 'react'\n\nimport { DrawerProvider } from './DrawerContext'\n\nexport interface DrawerProps {\n /**\n * Children of the component.\n */\n children?: RadixDrawer.DialogProps['children']\n /**\n * Specifies if the dialog is open or not.\n */\n open?: RadixDrawer.DialogProps['open']\n /**\n * Default open state.\n */\n defaultOpen?: RadixDrawer.DialogProps['defaultOpen']\n /**\n * Handler executed on every dialog open state change.\n */\n onOpenChange?: RadixDrawer.DialogProps['onOpenChange']\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: RadixDrawer.DialogProps['modal']\n /**\n * Specifies if the drawer should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n}\n\nexport interface DialogProps {\n children?: ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?(open: boolean): void\n modal?: boolean\n}\n\nexport const Drawer = ({ children, withFade = false, ...rest }: DrawerProps): ReactElement => (\n <DrawerProvider withFade={withFade}>\n <RadixDrawer.Root {...rest}>{children}</RadixDrawer.Root>\n </DrawerProvider>\n)\n\nDrawer.displayName = 'Drawer.Root'\n","import { createContext, type ReactNode, useContext } from 'react'\n\nexport interface DrawerContextState {\n withFade: boolean\n}\n\nconst DrawerContext = createContext<DrawerContextState | null>(null)\n\nexport const DrawerProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n return (\n <DrawerContext.Provider\n value={{\n withFade,\n }}\n >\n {childrenProp}\n </DrawerContext.Provider>\n )\n}\n\nexport const useDrawer = () => {\n const context = useContext(DrawerContext)\n\n if (!context) {\n throw Error('useDrawer must be used within a Drawer provider')\n }\n\n return context\n}\n","import { useMergeRefs } from '@spark-ui/hooks/use-merge-refs'\nimport { useScrollOverflow } from '@spark-ui/hooks/use-scroll-overflow'\nimport { type ReactNode, Ref, useRef } from 'react'\n\nimport { drawerBodyStyles, type DrawerBodyStylesProps } from './DrawerBody.styles'\nimport { useDrawer } from './DrawerContext'\n\nexport interface DrawerBodyProps extends DrawerBodyStylesProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerBody = ({\n children,\n inset = false,\n className,\n ref: forwardedRef,\n ...rest\n}: DrawerBodyProps) => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDrawer()\n\n const overflow = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"drawer-body\"\n ref={ref}\n className={drawerBodyStyles({ inset, className })}\n style={{\n ...(withFade && {\n maskImage:\n 'linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))',\n maskSize: `100% calc(100% + ${overflow.top ? '0px' : '44px'} + ${overflow.bottom ? '0px' : '44px'})`,\n maskPosition: `0 ${overflow.top ? '0px' : '-44px'}`,\n }),\n }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\nDrawerBody.displayName = 'Drawer.Body'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerBodyStyles = cva(\n ['grow', 'overflow-y-auto', 'outline-hidden', 'focus-visible:u-outline'],\n {\n variants: {\n inset: {\n true: '',\n false: 'px-xl py-lg',\n },\n },\n defaultVariants: {\n inset: false,\n },\n }\n)\n\nexport type DrawerBodyStylesProps = VariantProps<typeof drawerBodyStyles>\n","import { Close as CloseSVG } from '@spark-ui/icons/Close'\nimport { cx } from 'class-variance-authority'\n\nimport { Icon } from '../icon'\nimport { IconButton, type IconButtonProps } from '../icon-button'\nimport { DrawerClose, type DrawerCloseProps } from './DrawerClose'\n\nexport type DrawerCloseButtonProps = DrawerCloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nexport const DrawerCloseButton = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: DrawerCloseButtonProps) => (\n <DrawerClose\n data-spark-component=\"drawer-close-button\"\n ref={ref}\n className={cx(['absolute', 'top-sm', 'right-xl'], className)}\n asChild\n {...rest}\n >\n <IconButton intent={intent} size={size} design={design} aria-label={ariaLabel}>\n <Icon>{children}</Icon>\n </IconButton>\n </DrawerClose>\n)\n\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DrawerCloseProps = RadixDrawer.DialogCloseProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerClose = (props: DrawerCloseProps) => (\n <RadixDrawer.Close data-spark-component=\"drawer-close\" {...props} />\n)\n\nDrawerClose.displayName = 'Drawer.Close'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nimport { drawerContentStyles, type DrawerContentStylesProps } from './DrawerContent.styles'\n\nexport type DrawerContentProps = RadixDrawer.DialogContentProps &\n DrawerContentStylesProps & {\n ref?: Ref<HTMLDivElement>\n }\n\nexport const DrawerContent = ({\n className,\n size = 'md',\n side = 'right',\n onInteractOutside,\n ref,\n ...rest\n}: DrawerContentProps) => (\n <RadixDrawer.Content\n data-spark-component=\"drawer-content\"\n ref={ref}\n className={drawerContentStyles({\n size,\n side,\n className,\n })}\n onInteractOutside={e => {\n const isForegroundElement = (e.target as HTMLElement).closest('.z-toast, .z-popover')\n\n /**\n * The focus trap of the drawer applies `pointer-events-none` on the body of the page in the background, but\n * some components with an higher z-index have `pointer-events-auto` applied on them to remain interactive and ignore the focust trap (ex: a Snackbar with actions).\n *\n * Clicking on the snackbar will be considered as an \"outside click\" and close the drawer. We want to prevent this.\n */\n if (isForegroundElement) {\n e.preventDefault()\n }\n\n onInteractOutside?.(e)\n }}\n {...rest}\n />\n)\n\nDrawerContent.displayName = 'Drawer.Content'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const drawerContentStyles = cva(\n [\n ['fixed', 'z-modal', 'flex', 'flex-col'],\n ['bg-surface', 'shadow-md'],\n ],\n {\n variants: {\n size: {\n sm: '',\n md: '',\n lg: '',\n fluid: '',\n fullscreen: 'h-screen w-screen',\n },\n side: {\n right: [\n 'inset-y-0 right-0',\n 'data-[state=open]:animate-slide-in-right',\n 'data-[state=closed]:animate-slide-out-right',\n ],\n left: [\n 'inset-y-0 left-0',\n 'data-[state=open]:animate-slide-in-left',\n 'data-[state=closed]:animate-slide-out-left',\n ],\n top: [\n 'top-0 left-0',\n 'w-screen',\n 'data-[state=open]:animate-slide-in-top',\n 'data-[state=closed]:animate-slide-out-top',\n ],\n bottom: [\n 'bottom-0 left-0',\n 'w-screen',\n 'data-[state=open]:animate-slide-in-bottom',\n 'data-[state=closed]:animate-slide-out-bottom',\n ],\n },\n },\n compoundVariants: [\n {\n side: ['right', 'left'],\n size: 'sm',\n class: ['w-sz-480', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'md',\n class: ['w-sz-672', 'max-w-full'],\n },\n {\n side: ['right', 'left'],\n size: 'lg',\n class: ['w-sz-864', 'max-w-full'],\n },\n {\n side: ['left', 'right'],\n size: 'fluid',\n class: ['w-auto', 'max-w-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'sm',\n class: ['h-sz-480', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'md',\n class: ['h-sz-672', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'lg',\n class: ['h-sz-864', 'max-h-full'],\n },\n {\n side: ['top', 'bottom'],\n size: 'fluid',\n class: ['h-auto', 'max-h-full'],\n },\n ],\n defaultVariants: {\n side: 'right',\n size: 'md',\n },\n }\n)\n\nexport type DrawerContentStylesProps = VariantProps<typeof drawerContentStyles>\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DrawerDescriptionProps = RadixDrawer.DialogDescriptionProps & {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const DrawerDescription = (props: DrawerDescriptionProps) => (\n <RadixDrawer.Description data-spark-component=\"drawer-description\" {...props} />\n)\n\nDrawerDescription.displayName = 'Drawer.Description'\n","import { cx } from 'class-variance-authority'\nimport { ComponentPropsWithoutRef, type ReactElement, Ref } from 'react'\n\nexport type DrawerFooterProps = ComponentPropsWithoutRef<'footer'> & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerFooter = ({ className, ref, ...rest }: DrawerFooterProps): ReactElement => (\n <footer\n data-spark-component=\"drawer-footer\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n />\n)\n\nDrawerFooter.displayName = 'Drawer.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface DrawerHeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerHeader = ({\n children,\n className,\n ref,\n ...rest\n}: DrawerHeaderProps): ReactElement => (\n <header\n data-spark-component=\"drawer-header\"\n ref={ref}\n className={cx(['px-xl', 'py-lg'], className)}\n {...rest}\n >\n {children}\n </header>\n)\n\nDrawerHeader.displayName = 'Dialog.Header'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nexport type DrawerOverlayProps = RadixDrawer.DialogOverlayProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const DrawerOverlay = ({ className, ref, ...rest }: DrawerOverlayProps): ReactElement => (\n <RadixDrawer.Overlay\n data-spark-component=\"drawer-overlay\"\n ref={ref}\n className={cx(\n ['fixed', 'top-0', 'left-0', 'w-screen', 'h-screen', 'z-overlay'],\n ['bg-overlay/dim-1'],\n ['data-[state=open]:animate-fade-in'],\n ['data-[state=closed]:animate-fade-out'],\n className\n )}\n {...rest}\n />\n)\n\nDrawerOverlay.displayName = 'Drawer.Overlay'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement } from 'react'\n\nexport type DrawerPortalProps = RadixDrawer.DialogPortalProps\n\nexport const DrawerPortal = ({ children, ...rest }: DrawerPortalProps): ReactElement => (\n <RadixDrawer.Portal {...rest}>{children}</RadixDrawer.Portal>\n)\n\nDrawerPortal.displayName = 'Drawer.Portal'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDrawer } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DrawerTitleProps = RadixDrawer.DialogTitleProps & {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const DrawerTitle = ({ className, ref, ...others }: DrawerTitleProps) => (\n <RadixDrawer.Title\n data-spark-component=\"drawer-title\"\n ref={ref}\n className={cx('text-headline-2 text-on-surface', className)}\n {...others}\n />\n)\n\nDrawerTitle.displayName = 'Drawer.Title'\n","import { Dialog as RadixDrawer } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nexport interface DrawerTriggerProps extends RadixDrawer.DialogTriggerProps {\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 */\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const DrawerTrigger = (props: DrawerTriggerProps): ReactElement => (\n <RadixDrawer.Trigger data-spark-component=\"drawer-trigger\" {...props} />\n)\n\nDrawerTrigger.displayName = 'Drawer.Trigger'\n","import { Drawer as Root } from './Drawer'\nimport { DrawerBody } from './DrawerBody'\nimport { DrawerCloseButton } from './DrawerCloseButton'\nimport { DrawerContent } from './DrawerContent'\nimport { DrawerDescription } from './DrawerDescription' // aria-describedby\nimport { DrawerFooter } from './DrawerFooter'\nimport { DrawerHeader } from './DrawerHeader'\nimport { DrawerOverlay } from './DrawerOverlay'\nimport { DrawerPortal } from './DrawerPortal'\nimport { DrawerTitle } from './DrawerTitle'\nimport { DrawerTrigger } from './DrawerTrigger'\n\nexport const Drawer: typeof Root & {\n Trigger: typeof DrawerTrigger\n Portal: typeof DrawerPortal\n Overlay: typeof DrawerOverlay\n Content: typeof DrawerContent\n Header: typeof DrawerHeader\n Body: typeof DrawerBody\n Footer: typeof DrawerFooter\n CloseButton: typeof DrawerCloseButton\n Title: typeof DrawerTitle\n Description: typeof DrawerDescription\n} = Object.assign(Root, {\n Trigger: DrawerTrigger,\n Portal: DrawerPortal,\n Overlay: DrawerOverlay,\n Content: DrawerContent,\n Header: DrawerHeader,\n Body: DrawerBody,\n Footer: DrawerFooter,\n CloseButton: DrawerCloseButton,\n Title: DrawerTitle,\n Description: DrawerDescription,\n})\n\nDrawer.displayName = 'Drawer'\nDrawerTrigger.displayName = 'Drawer.Trigger'\nDrawerPortal.displayName = 'Drawer.Portal'\nDrawerOverlay.displayName = 'Drawer.Overlay'\nDrawerContent.displayName = 'Drawer.Content'\nDrawerHeader.displayName = 'Drawer.Header'\nDrawerBody.displayName = 'Drawer.Body'\nDrawerFooter.displayName = 'Drawer.Footer'\nDrawerCloseButton.displayName = 'Drawer.CloseButton'\nDrawerTitle.displayName = 'Drawer.Title'\nDrawerDescription.displayName = 'Drawer.Description'\n\nexport { type DrawerProps } from './Drawer'\nexport { type DrawerContentProps } from './DrawerContent'\nexport { type DrawerHeaderProps } from './DrawerHeader'\nexport { type DrawerBodyProps } from './DrawerBody'\nexport { type DrawerFooterProps } from './DrawerFooter'\nexport { type DrawerTriggerProps } from './DrawerTrigger'\nexport { type DrawerOverlayProps } from './DrawerOverlay'\nexport { type DrawerPortalProps } from './DrawerPortal'\nexport { type DrawerTitleProps } from './DrawerTitle'\nexport { type DrawerDescriptionProps } from './DrawerDescription'\nexport { type DrawerCloseProps } from './DrawerClose'\nexport { type DrawerCloseButtonProps } from './DrawerCloseButton'\n"],"mappings":";;;;;;;;;;;;AAAA,SAAS,UAAU,mBAAmB;;;ACAtC,SAAS,eAA+B,kBAAkB;AAgBtD;AAVJ,IAAM,gBAAgB,cAAyC,IAAI;AAE5D,IAAM,iBAAiB,CAAC;AAAA,EAC7B,UAAU;AAAA,EACV,WAAW;AACb,MAGM;AACJ,SACE;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACC,OAAO;AAAA,QACL;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEO,IAAM,YAAY,MAAM;AAC7B,QAAM,UAAU,WAAW,aAAa;AAExC,MAAI,CAAC,SAAS;AACZ,UAAM,MAAM,iDAAiD;AAAA,EAC/D;AAEA,SAAO;AACT;;;ADQI,gBAAAA,YAAA;AAFG,IAAM,SAAS,CAAC,EAAE,UAAU,WAAW,OAAO,GAAG,KAAK,MAC3D,gBAAAA,KAAC,kBAAe,UACd,0BAAAA,KAAC,YAAY,MAAZ,EAAkB,GAAG,MAAO,UAAS,GACxC;AAGF,OAAO,cAAc;;;AE9CrB,SAAS,oBAAoB;AAC7B,SAAS,yBAAyB;AAClC,SAA8B,cAAc;;;ACF5C,SAAS,WAAyB;AAE3B,IAAM,mBAAmB;AAAA,EAC9B,CAAC,QAAQ,mBAAmB,kBAAkB,yBAAyB;AAAA,EACvE;AAAA,IACE,UAAU;AAAA,MACR,OAAO;AAAA,QACL,MAAM;AAAA,QACN,OAAO;AAAA,MACT;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf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nB,SAAS,UAAUC,oBAAmB;AAQpC,gBAAAC,aAAA;AADK,IAAM,cAAc,CAAC,EAAE,WAAW,KAAK,GAAG,OAAO,MACtD,gBAAAA;AAAA,EAACD,aAAY;AAAA,EAAZ;AAAA,IACC,wBAAqB;AAAA,IACrB;AAAA,IACA,WAAWD,IAAG,mCAAmC,SAAS;AAAA,IACzD,GAAG;AAAA;AACN;AAGF,YAAY,cAAc;;;ACjB1B,SAAS,UAAUG,oBAAmB;AAYpC,gBAAAC,aAAA;AADK,IAAM,gBAAgB,CAAC,UAC5B,gBAAAA,MAACD,aAAY,SAAZ,EAAoB,wBAAqB,kBAAkB,GAAG,OAAO;AAGxE,cAAc,cAAc;;;ACHrB,IAAME,UAWT,OAAO,OAAO,QAAM;AAAA,EACtB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,OAAO;AAAA,EACP,aAAa;AACf,CAAC;AAEDA,QAAO,cAAc;AACrB,cAAc,cAAc;AAC5B,aAAa,cAAc;AAC3B,cAAc,cAAc;AAC5B,cAAc,cAAc;AAC5B,aAAa,cAAc;AAC3B,WAAW,cAAc;AACzB,aAAa,cAAc;AAC3B,kBAAkB,cAAc;AAChC,YAAY,cAAc;AAC1B,kBAAkB,cAAc;","names":["jsx","jsx","RadixDrawer","jsx","jsx","RadixDrawer","cva","jsx","RadixDrawer","RadixDrawer","jsx","cx","jsx","cx","jsx","cx","RadixDrawer","jsx","RadixDrawer","jsx","cx","RadixDrawer","jsx","RadixDrawer","jsx","Drawer"]}
|
|
@@ -24,7 +24,7 @@ interface Props$2 {
|
|
|
24
24
|
/**
|
|
25
25
|
* Add a fade effect to indicate content overflow.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
withFade?: boolean;
|
|
28
28
|
children?: ReactNode;
|
|
29
29
|
/**
|
|
30
30
|
* When `true`, allow previous and next buttons to be used when reaching the edges of the list.
|
|
@@ -40,7 +40,7 @@ interface Props$2 {
|
|
|
40
40
|
scrollPadding?: number;
|
|
41
41
|
}
|
|
42
42
|
declare const ScrollingList$1: {
|
|
43
|
-
({ snapType, snapStop, scrollBehavior, loop, gap,
|
|
43
|
+
({ snapType, snapStop, scrollBehavior, loop, gap, withFade, scrollPadding, children, }: Props$2): react_jsx_runtime.JSX.Element;
|
|
44
44
|
displayName: string;
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -24,7 +24,7 @@ interface Props$2 {
|
|
|
24
24
|
/**
|
|
25
25
|
* Add a fade effect to indicate content overflow.
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
withFade?: boolean;
|
|
28
28
|
children?: ReactNode;
|
|
29
29
|
/**
|
|
30
30
|
* When `true`, allow previous and next buttons to be used when reaching the edges of the list.
|
|
@@ -40,7 +40,7 @@ interface Props$2 {
|
|
|
40
40
|
scrollPadding?: number;
|
|
41
41
|
}
|
|
42
42
|
declare const ScrollingList$1: {
|
|
43
|
-
({ snapType, snapStop, scrollBehavior, loop, gap,
|
|
43
|
+
({ snapType, snapStop, scrollBehavior, loop, gap, withFade, scrollPadding, children, }: Props$2): react_jsx_runtime.JSX.Element;
|
|
44
44
|
displayName: string;
|
|
45
45
|
};
|
|
46
46
|
|
|
@@ -25,46 +25,11 @@ __export(scrolling_list_exports, {
|
|
|
25
25
|
module.exports = __toCommonJS(scrolling_list_exports);
|
|
26
26
|
|
|
27
27
|
// src/scrolling-list/ScrollingList.tsx
|
|
28
|
-
var
|
|
29
|
-
var import_react_snap_carousel = require("react-snap-carousel");
|
|
30
|
-
|
|
31
|
-
// src/scrolling-list/useScrollOverflow.ts
|
|
28
|
+
var import_use_scroll_overflow = require("@spark-ui/hooks/use-scroll-overflow");
|
|
32
29
|
var import_react = require("react");
|
|
33
|
-
|
|
34
|
-
const [overflow, setOverflow] = (0, import_react.useState)({
|
|
35
|
-
left: 0,
|
|
36
|
-
right: 0
|
|
37
|
-
});
|
|
38
|
-
(0, import_react.useEffect)(() => {
|
|
39
|
-
const checkScrollContent = () => {
|
|
40
|
-
const scrollElement2 = scrollRef.current;
|
|
41
|
-
if (scrollElement2) {
|
|
42
|
-
const { scrollLeft, scrollWidth, clientWidth } = scrollElement2;
|
|
43
|
-
setOverflow({
|
|
44
|
-
left: scrollLeft,
|
|
45
|
-
right: scrollWidth - (scrollLeft + clientWidth)
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
checkScrollContent();
|
|
50
|
-
const scrollElement = scrollRef.current;
|
|
51
|
-
if (scrollElement) {
|
|
52
|
-
scrollElement.addEventListener("scroll", checkScrollContent);
|
|
53
|
-
window.addEventListener("resize", checkScrollContent);
|
|
54
|
-
}
|
|
55
|
-
return () => {
|
|
56
|
-
if (scrollElement) {
|
|
57
|
-
scrollElement.removeEventListener("scroll", checkScrollContent);
|
|
58
|
-
window.addEventListener("resize", checkScrollContent);
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
}, [scrollRef]);
|
|
62
|
-
return overflow;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// src/scrolling-list/ScrollingList.tsx
|
|
30
|
+
var import_react_snap_carousel = require("react-snap-carousel");
|
|
66
31
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
67
|
-
var ScrollingListContext = (0,
|
|
32
|
+
var ScrollingListContext = (0, import_react.createContext)(
|
|
68
33
|
null
|
|
69
34
|
);
|
|
70
35
|
var ScrollingList = ({
|
|
@@ -73,15 +38,14 @@ var ScrollingList = ({
|
|
|
73
38
|
scrollBehavior = "smooth",
|
|
74
39
|
loop = false,
|
|
75
40
|
gap = 16,
|
|
76
|
-
|
|
77
|
-
// TODO: ask for default value + why it has been removed from specs
|
|
41
|
+
withFade = false,
|
|
78
42
|
scrollPadding = 0,
|
|
79
43
|
children
|
|
80
44
|
}) => {
|
|
81
|
-
const scrollAreaRef = (0,
|
|
82
|
-
const skipAnchorRef = (0,
|
|
45
|
+
const scrollAreaRef = (0, import_react.useRef)(null);
|
|
46
|
+
const skipAnchorRef = (0, import_react.useRef)(null);
|
|
83
47
|
const snapCarouselAPI = (0, import_react_snap_carousel.useSnapCarousel)();
|
|
84
|
-
const overflow = useScrollOverflow(scrollAreaRef);
|
|
48
|
+
const overflow = (0, import_use_scroll_overflow.useScrollOverflow)(scrollAreaRef);
|
|
85
49
|
const { activePageIndex, pages } = snapCarouselAPI;
|
|
86
50
|
const visibleItems = pages[activePageIndex];
|
|
87
51
|
const visibleItemsRange = visibleItems ? [visibleItems[0] + 1, visibleItems[visibleItems.length - 1] + 1] : [0, 0];
|
|
@@ -97,7 +61,7 @@ var ScrollingList = ({
|
|
|
97
61
|
visibleItemsRange,
|
|
98
62
|
loop,
|
|
99
63
|
gap,
|
|
100
|
-
|
|
64
|
+
withFade,
|
|
101
65
|
scrollPadding,
|
|
102
66
|
scrollAreaRef,
|
|
103
67
|
overflow
|
|
@@ -146,11 +110,11 @@ ScrollingListControls.displayName = "ScrollingList.Controls";
|
|
|
146
110
|
|
|
147
111
|
// src/scrolling-list/ScrollingListItem.tsx
|
|
148
112
|
var import_class_variance_authority2 = require("class-variance-authority");
|
|
149
|
-
var
|
|
113
|
+
var import_react4 = require("react");
|
|
150
114
|
|
|
151
115
|
// src/slot/Slot.tsx
|
|
152
116
|
var import_radix_ui = require("radix-ui");
|
|
153
|
-
var
|
|
117
|
+
var import_react2 = require("react");
|
|
154
118
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
155
119
|
var Slottable = import_radix_ui.Slot.Slottable;
|
|
156
120
|
var Slot = ({ ref, ...props }) => {
|
|
@@ -158,7 +122,7 @@ var Slot = ({ ref, ...props }) => {
|
|
|
158
122
|
};
|
|
159
123
|
var wrapPolymorphicSlot = (asChild, children, callback) => {
|
|
160
124
|
if (!asChild) return callback(children);
|
|
161
|
-
return (0,
|
|
125
|
+
return (0, import_react2.isValidElement)(children) ? (0, import_react2.cloneElement)(
|
|
162
126
|
children,
|
|
163
127
|
void 0,
|
|
164
128
|
callback(children.props.children)
|
|
@@ -166,10 +130,10 @@ var wrapPolymorphicSlot = (asChild, children, callback) => {
|
|
|
166
130
|
};
|
|
167
131
|
|
|
168
132
|
// src/scrolling-list/useFocusWithinScroll.tsx
|
|
169
|
-
var
|
|
133
|
+
var import_react3 = require("react");
|
|
170
134
|
function useFocusWithinScroll(ref, scrollRef) {
|
|
171
|
-
const [isFocusWithin, setIsFocusWithin] = (0,
|
|
172
|
-
(0,
|
|
135
|
+
const [isFocusWithin, setIsFocusWithin] = (0, import_react3.useState)(false);
|
|
136
|
+
(0, import_react3.useEffect)(() => {
|
|
173
137
|
const handleFocusIn = (event) => {
|
|
174
138
|
setIsFocusWithin(true);
|
|
175
139
|
const focusedElement = event.target;
|
|
@@ -212,8 +176,8 @@ var ScrollingListItem = ({
|
|
|
212
176
|
className = "",
|
|
213
177
|
...rest
|
|
214
178
|
}) => {
|
|
215
|
-
const ctx = (0,
|
|
216
|
-
const itemRef = (0,
|
|
179
|
+
const ctx = (0, import_react4.useContext)(ScrollingListContext);
|
|
180
|
+
const itemRef = (0, import_react4.useRef)(null);
|
|
217
181
|
const isSnapPoint = ctx.snapPointIndexes.has(index);
|
|
218
182
|
useFocusWithinScroll(itemRef, ctx.scrollAreaRef);
|
|
219
183
|
const Component = asChild ? Slot : "div";
|
|
@@ -241,7 +205,7 @@ ScrollingListItem.displayName = "ScrollingList.Item";
|
|
|
241
205
|
|
|
242
206
|
// src/scrolling-list/ScrollingListItems.tsx
|
|
243
207
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
244
|
-
var
|
|
208
|
+
var import_react5 = require("react");
|
|
245
209
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
246
210
|
function mergeRefs(...refs) {
|
|
247
211
|
return (value) => {
|
|
@@ -256,7 +220,7 @@ function mergeRefs(...refs) {
|
|
|
256
220
|
};
|
|
257
221
|
}
|
|
258
222
|
var ScrollingListItems = ({ children, className = "", ...rest }) => {
|
|
259
|
-
const ctx = (0,
|
|
223
|
+
const ctx = (0, import_react5.useContext)(ScrollingListContext);
|
|
260
224
|
const snapConfig = {
|
|
261
225
|
mandatory: "x mandatory",
|
|
262
226
|
proximity: "x proximity",
|
|
@@ -287,7 +251,7 @@ var ScrollingListItems = ({ children, className = "", ...rest }) => {
|
|
|
287
251
|
scrollPaddingInline: "var(--scrolling-list-px)",
|
|
288
252
|
"--scrolling-list-px": `${ctx.scrollPadding}px`,
|
|
289
253
|
"--scrolling-list-gap": `${ctx.gap}px`,
|
|
290
|
-
...ctx.
|
|
254
|
+
...ctx.withFade && {
|
|
291
255
|
maskImage: "linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 1) 44px, rgba(0, 0, 0, 1) calc(100% - 44px), rgba(0, 0, 0, 0))",
|
|
292
256
|
maskSize: `calc(100% + ${ctx.overflow.left ? "0px" : "44px"} + ${ctx.overflow.right ? "0px" : "44px"}) 100%`,
|
|
293
257
|
maskPosition: `${ctx.overflow.left ? "0px" : "-44px"} 0`
|
|
@@ -310,9 +274,9 @@ var ScrollingListItems = ({ children, className = "", ...rest }) => {
|
|
|
310
274
|
style: inlineStyles,
|
|
311
275
|
onKeyDown: handleKeyDown,
|
|
312
276
|
...rest,
|
|
313
|
-
children:
|
|
277
|
+
children: import_react5.Children.map(
|
|
314
278
|
children,
|
|
315
|
-
(child, index) => (0,
|
|
279
|
+
(child, index) => (0, import_react5.isValidElement)(child) ? (0, import_react5.cloneElement)(child, { index }) : child
|
|
316
280
|
)
|
|
317
281
|
}
|
|
318
282
|
);
|
|
@@ -322,10 +286,10 @@ ScrollingListItems.displayName = "ScrollingList.Items";
|
|
|
322
286
|
// src/scrolling-list/ScrollingListNextButton.tsx
|
|
323
287
|
var import_ArrowVerticalRight = require("@spark-ui/icons/ArrowVerticalRight");
|
|
324
288
|
var import_class_variance_authority9 = require("class-variance-authority");
|
|
325
|
-
var
|
|
289
|
+
var import_react8 = require("react");
|
|
326
290
|
|
|
327
291
|
// src/icon/Icon.tsx
|
|
328
|
-
var
|
|
292
|
+
var import_react6 = require("react");
|
|
329
293
|
|
|
330
294
|
// src/visually-hidden/VisuallyHidden.tsx
|
|
331
295
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
@@ -398,9 +362,9 @@ var Icon = ({
|
|
|
398
362
|
children,
|
|
399
363
|
...others
|
|
400
364
|
}) => {
|
|
401
|
-
const child =
|
|
365
|
+
const child = import_react6.Children.only(children);
|
|
402
366
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
403
|
-
(0,
|
|
367
|
+
(0, import_react6.cloneElement)(child, {
|
|
404
368
|
className: iconStyles({ className, size, intent }),
|
|
405
369
|
"data-spark-component": "icon",
|
|
406
370
|
"aria-hidden": "true",
|
|
@@ -414,7 +378,7 @@ Icon.displayName = "Icon";
|
|
|
414
378
|
|
|
415
379
|
// src/button/Button.tsx
|
|
416
380
|
var import_class_variance_authority7 = require("class-variance-authority");
|
|
417
|
-
var
|
|
381
|
+
var import_react7 = require("react");
|
|
418
382
|
|
|
419
383
|
// src/spinner/Spinner.styles.tsx
|
|
420
384
|
var import_internal_utils2 = require("@spark-ui/internal-utils");
|
|
@@ -1166,7 +1130,7 @@ var Button = ({
|
|
|
1166
1130
|
}) => {
|
|
1167
1131
|
const Component = asChild ? Slot : "button";
|
|
1168
1132
|
const shouldNotInteract = !!disabled || isLoading;
|
|
1169
|
-
const disabledEventHandlers = (0,
|
|
1133
|
+
const disabledEventHandlers = (0, import_react7.useMemo)(() => {
|
|
1170
1134
|
const result = {};
|
|
1171
1135
|
if (shouldNotInteract) {
|
|
1172
1136
|
blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
|
|
@@ -1267,7 +1231,7 @@ IconButton.displayName = "IconButton";
|
|
|
1267
1231
|
// src/scrolling-list/ScrollingListNextButton.tsx
|
|
1268
1232
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1269
1233
|
var ScrollingListNextButton = ({ "aria-label": ariaLabel, ...rest }) => {
|
|
1270
|
-
const ctx = (0,
|
|
1234
|
+
const ctx = (0, import_react8.useContext)(ScrollingListContext);
|
|
1271
1235
|
const handleNextPage = () => {
|
|
1272
1236
|
if (ctx.hasNextPage) {
|
|
1273
1237
|
ctx.next({ behavior: ctx.scrollBehavior });
|
|
@@ -1302,13 +1266,13 @@ ScrollingListNextButton.displayName = "ScrollingList.NextButton";
|
|
|
1302
1266
|
// src/scrolling-list/ScrollingListPrevButton.tsx
|
|
1303
1267
|
var import_ArrowVerticalLeft = require("@spark-ui/icons/ArrowVerticalLeft");
|
|
1304
1268
|
var import_class_variance_authority10 = require("class-variance-authority");
|
|
1305
|
-
var
|
|
1269
|
+
var import_react9 = require("react");
|
|
1306
1270
|
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1307
1271
|
var ScrollingListPrevButton = ({
|
|
1308
1272
|
"aria-label": ariaLabel,
|
|
1309
1273
|
...rest
|
|
1310
1274
|
}) => {
|
|
1311
|
-
const ctx = (0,
|
|
1275
|
+
const ctx = (0, import_react9.useContext)(ScrollingListContext);
|
|
1312
1276
|
const handlePrevPage = () => {
|
|
1313
1277
|
const shouldSnapFirstPage = ctx.activePageIndex === 0 && (ctx.scrollAreaRef.current?.scrollLeft || 0) > 0;
|
|
1314
1278
|
if (shouldSnapFirstPage) {
|
|
@@ -1345,10 +1309,10 @@ ScrollingListPrevButton.displayName = "ScrollingList.PrevButton";
|
|
|
1345
1309
|
|
|
1346
1310
|
// src/scrolling-list/ScrollingListSkipButton.tsx
|
|
1347
1311
|
var import_class_variance_authority11 = require("class-variance-authority");
|
|
1348
|
-
var
|
|
1312
|
+
var import_react10 = require("react");
|
|
1349
1313
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1350
1314
|
var ScrollingListSkipButton = ({ children, ...rest }) => {
|
|
1351
|
-
const ctx = (0,
|
|
1315
|
+
const ctx = (0, import_react10.useContext)(ScrollingListContext);
|
|
1352
1316
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1353
1317
|
Button,
|
|
1354
1318
|
{
|