@spark-ui/components 10.8.2 → 10.10.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/{DialogTrigger-5SI4dvpK.d.mts → DialogTrigger-woU7vsJi.d.mts} +9 -9
  3. package/dist/{DialogTrigger-5SI4dvpK.d.ts → DialogTrigger-woU7vsJi.d.ts} +9 -9
  4. package/dist/accordion/index.d.mts +13 -25
  5. package/dist/accordion/index.d.ts +13 -25
  6. package/dist/accordion/index.js +114 -250
  7. package/dist/accordion/index.js.map +1 -1
  8. package/dist/accordion/index.mjs +92 -134
  9. package/dist/accordion/index.mjs.map +1 -1
  10. package/dist/alert-dialog/index.d.mts +1 -1
  11. package/dist/alert-dialog/index.d.ts +1 -1
  12. package/dist/alert-dialog/index.js +60 -46
  13. package/dist/alert-dialog/index.js.map +1 -1
  14. package/dist/alert-dialog/index.mjs +1 -1
  15. package/dist/{chunk-T26TYEWV.mjs → chunk-I7UIKCZK.mjs} +56 -42
  16. package/dist/chunk-I7UIKCZK.mjs.map +1 -0
  17. package/dist/collapsible/index.d.mts +18 -35
  18. package/dist/collapsible/index.d.ts +18 -35
  19. package/dist/collapsible/index.js +47 -78
  20. package/dist/collapsible/index.js.map +1 -1
  21. package/dist/collapsible/index.mjs +73 -4
  22. package/dist/collapsible/index.mjs.map +1 -1
  23. package/dist/dialog/index.d.mts +2 -2
  24. package/dist/dialog/index.d.ts +2 -2
  25. package/dist/dialog/index.js +52 -38
  26. package/dist/dialog/index.js.map +1 -1
  27. package/dist/dialog/index.mjs +1 -1
  28. package/dist/drawer/index.d.mts +6 -2
  29. package/dist/drawer/index.d.ts +6 -2
  30. package/dist/drawer/index.js +105 -59
  31. package/dist/drawer/index.js.map +1 -1
  32. package/dist/drawer/index.mjs +81 -35
  33. package/dist/drawer/index.mjs.map +1 -1
  34. package/dist/scrolling-list/index.d.mts +2 -2
  35. package/dist/scrolling-list/index.d.ts +2 -2
  36. package/dist/scrolling-list/index.js +32 -68
  37. package/dist/scrolling-list/index.js.map +1 -1
  38. package/dist/scrolling-list/index.mjs +7 -43
  39. package/dist/scrolling-list/index.mjs.map +1 -1
  40. package/dist/spinner/index.d.mts +1 -1
  41. package/dist/spinner/index.d.ts +1 -1
  42. package/package.json +6 -7
  43. package/dist/chunk-3LEFXZNI.mjs +0 -97
  44. package/dist/chunk-3LEFXZNI.mjs.map +0 -1
  45. package/dist/chunk-T26TYEWV.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/collapsible/index.ts","../../src/collapsible/Collapsible.tsx","../../src/slot/Slot.tsx","../../src/collapsible/CollapsibleContent.tsx","../../src/collapsible/CollapsibleTrigger.tsx"],"sourcesContent":["import { Collapsible as Root } from './Collapsible'\nimport { Content } from './CollapsibleContent'\nimport { Trigger } from './CollapsibleTrigger'\n\nexport const Collapsible: typeof Root & {\n Trigger: typeof Trigger\n Content: typeof Content\n} = Object.assign(Root, {\n Trigger,\n Content,\n})\n\nCollapsible.displayName = 'Collapsible'\nTrigger.displayName = 'Collapsible.Trigger'\nContent.displayName = 'Collapsible.Content'\n\nexport { type CollapsibleProps } from './Collapsible'\nexport { type CollapsibleContentProps } from './CollapsibleContent'\nexport { type CollapsibleTriggerProps } from './CollapsibleTrigger'\n","import * as collapsible from '@zag-js/collapsible'\nimport { mergeProps, normalizeProps, type PropTypes, useMachine } from '@zag-js/react'\nimport { type ComponentProps, createContext, Ref, useContext, useId } from 'react'\n\nimport { Slot } from '../slot'\n\nexport interface CollapsibleProps extends ComponentProps<'div'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n /**\n * The open state of the collapsible when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultOpen?: boolean\n /**\n * When `true`, prevents the user from interacting with the collapsible.\n */\n disabled?: boolean\n /**\n * Event handler called when the open state of the collapsible changes.\n */\n onOpenChange?: (open: boolean) => void\n /**\n * The controlled open state of the collapsible. Must be used in conjunction with `onOpenChange`.\n */\n open?: boolean\n /**\n * The ids of the elements in the collapsible. Useful for composition\n */\n ids?: collapsible.Props['ids']\n ref?: Ref<HTMLDivElement>\n}\n\nconst CollapsibleContext = createContext<collapsible.Api<PropTypes> | null>(null)\n\nexport const Collapsible = ({\n asChild = false,\n children,\n defaultOpen = false,\n disabled = false,\n onOpenChange,\n open,\n ids,\n ref,\n ...props\n}: CollapsibleProps) => {\n const service = useMachine(collapsible.machine, {\n open,\n defaultOpen,\n disabled,\n id: useId(),\n ids,\n onOpenChange(details) {\n onOpenChange?.(details.open)\n },\n })\n const api = collapsible.connect(service, normalizeProps)\n const Component = asChild ? Slot : 'div'\n\n const mergedProps = mergeProps(api.getRootProps(), props)\n\n return (\n <CollapsibleContext.Provider value={api}>\n <Component data-spark-component=\"collapsible\" ref={ref} {...mergedProps}>\n {children}\n </Component>\n </CollapsibleContext.Provider>\n )\n}\n\nCollapsible.displayName = 'Collapsible'\n\nexport const useCollapsibleContext = () => {\n const context = useContext(CollapsibleContext)\n\n if (!context) {\n throw Error('useCollapsibleContext must be used within a Collapsible provider')\n }\n\n return context\n}\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { mergeProps } from '@zag-js/react'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { useCollapsibleContext } from './Collapsible'\n\nexport interface CollapsibleContentProps extends ComponentPropsWithoutRef<'div'> {\n asChild?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Content = ({\n asChild = false,\n className,\n children,\n ref,\n ...props\n}: CollapsibleContentProps) => {\n const { getContentProps } = useCollapsibleContext()\n\n const Component = asChild ? Slot : 'div'\n const contentProps = getContentProps()\n const mergedProps = mergeProps(contentProps, {\n className: cx(\n 'overflow-hidden',\n 'motion-reduce:animate-none!',\n '[&[hidden]]:hidden',\n 'data-[state=open]:animate-standalone-collapse-in data-[state=closed]:animate-standalone-collapse-out',\n className\n ),\n ...props,\n })\n\n return (\n <Component ref={ref} data-spark-component=\"collapsible-content\" {...mergedProps}>\n {children}\n </Component>\n )\n}\n\nContent.displayName = 'Collapsible.Content'\n","import { mergeProps } from '@zag-js/react'\nimport { type ComponentPropsWithoutRef, Ref } from 'react'\n\nimport { Slot } from '../slot'\nimport { useCollapsibleContext } from './Collapsible'\n\nexport interface CollapsibleTriggerProps extends ComponentPropsWithoutRef<'button'> {\n asChild?: boolean\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = ({ asChild = false, children, ref, ...props }: CollapsibleTriggerProps) => {\n const collapsibleContext = useCollapsibleContext()\n const Component = asChild ? Slot : 'button'\n const mergedProps = mergeProps(collapsibleContext.getTriggerProps(), props)\n\n return (\n <Component ref={ref} data-spark-component=\"collapsible-trigger\" {...mergedProps}>\n {children}\n </Component>\n )\n}\n\nTrigger.displayName = 'Collapsible.Trigger'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,qBAAAA;AAAA;AAAA;;;ACAA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,EAAE,gBAAgB,IAAI,sBAAsB;AAElD,QAAM,YAAY,UAAU,OAAO;AACnC,QAAM,eAAe,gBAAgB;AACrC,QAAM,kBAAc,0BAAW,cAAc;AAAA,IAC3C,eAAW;AAAA,MACT;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,GAAG;AAAA,EACL,CAAC;AAED,SACE,6CAAC,aAAU,KAAU,wBAAqB,uBAAuB,GAAG,aACjE,UACH;AAEJ;AAEA,QAAQ,cAAc;;;ACzCtB,IAAAC,gBAA2B;AAiBvB,IAAAC,sBAAA;AANG,IAAM,UAAU,CAAC,EAAE,UAAU,OAAO,UAAU,KAAK,GAAG,MAAM,MAA+B;AAChG,QAAM,qBAAqB,sBAAsB;AACjD,QAAM,YAAY,UAAU,OAAO;AACnC,QAAM,kBAAc,0BAAW,mBAAmB,gBAAgB,GAAG,KAAK;AAE1E,SACE,6CAAC,aAAU,KAAU,wBAAqB,uBAAuB,GAAG,aACjE,UACH;AAEJ;AAEA,QAAQ,cAAc;;;AJnBf,IAAMC,eAGT,OAAO,OAAO,aAAM;AAAA,EACtB;AAAA,EACA;AACF,CAAC;AAEDA,aAAY,cAAc;AAC1B,QAAQ,cAAc;AACtB,QAAQ,cAAc;","names":["Collapsible","import_react","RadixSlot","import_jsx_runtime","import_react","import_jsx_runtime","import_react","import_jsx_runtime","Collapsible"]}
1
+ {"version":3,"sources":["../../src/collapsible/index.ts","../../src/collapsible/Content.tsx","../../src/slot/Slot.tsx","../../src/collapsible/useRenderSlot.tsx","../../src/collapsible/Root.tsx","../../src/collapsible/Trigger.tsx"],"sourcesContent":["import { Content } from './Content'\nimport { Root } from './Root'\nimport { Trigger } from './Trigger'\n\nexport const Collapsible: typeof Root & {\n Trigger: typeof Trigger\n Content: typeof Content\n} = Object.assign(Root, {\n Trigger,\n Content,\n})\n\nCollapsible.displayName = 'Collapsible'\nTrigger.displayName = 'Collapsible.Trigger'\nContent.displayName = 'Collapsible.Content'\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ContentProps extends ComponentProps<typeof Collapsible.Panel> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Content = ({\n asChild = false,\n className,\n children,\n hiddenUntilFound = true,\n ...props\n}: ContentProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <Collapsible.Panel\n data-spark-component=\"collapsible-content\"\n className={cx(\n 'overflow-hidden',\n 'h-[var(--collapsible-panel-height)]',\n 'transition-all duration-200',\n 'motion-reduce:transition-none',\n 'data-[starting-style]:h-0',\n 'data-[ending-style]:h-0',\n className\n )}\n render={renderSlot}\n hiddenUntilFound={hiddenUntilFound}\n {...props}\n >\n {children}\n </Collapsible.Panel>\n )\n}\n\nContent.displayName = 'Collapsible.Content'\n","import { Slot as RadixSlot } from 'radix-ui'\nimport {\n cloneElement,\n HTMLAttributes,\n isValidElement,\n PropsWithChildren,\n ReactNode,\n Ref,\n} from 'react'\n\nexport const Slottable: typeof RadixSlot.Slottable = RadixSlot.Slottable\n\nexport type SlotProps = PropsWithChildren<HTMLAttributes<HTMLElement>> & {\n ref?: Ref<HTMLElement>\n}\n\nexport const Slot = ({ ref, ...props }: SlotProps) => {\n return <RadixSlot.Root ref={ref} {...props} />\n}\n\n/**\n * When using Radix `Slot` component, it will consider its first child to merge its props with.\n * In some cases, you might need to wrap the top child with additional markup without breaking this behaviour.\n */\nexport const wrapPolymorphicSlot = (\n asChild: boolean | undefined,\n children: ReactNode,\n callback: (children: ReactNode) => ReactNode\n) => {\n if (!asChild) return callback(children) // If polymorphic behaviour is not used, we keep the original children\n\n return isValidElement(children)\n ? cloneElement(\n children,\n undefined,\n callback((children.props as { children: ReactNode }).children)\n )\n : null\n}\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface RootProps extends ComponentProps<typeof Collapsible.Root> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Root = ({ asChild = false, children, ...props }: RootProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <Collapsible.Root data-spark-component=\"collapsible\" render={renderSlot} {...props}>\n {children}\n </Collapsible.Root>\n )\n}\n\nRoot.displayName = 'Collapsible'\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface TriggerProps extends ComponentProps<'button'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Trigger = ({ asChild = false, children, ...props }: TriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return (\n <Collapsible.Trigger data-spark-component=\"collapsible-trigger\" render={renderSlot} {...props}>\n {children}\n </Collapsible.Trigger>\n )\n}\n\nTrigger.displayName = 'Collapsible.Trigger'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,qBAAAA;AAAA;AAAA;;;ACAA,yBAA4B;AAC5B,sCAAmB;;;ACDnB,sBAAkC;AAClC,mBAOO;AASE;AAPF,IAAM,YAAwC,gBAAAC,KAAU;AAMxD,IAAM,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,MAAiB;AACpD,SAAO,4CAAC,gBAAAA,KAAU,MAAV,EAAe,KAAW,GAAG,OAAO;AAC9C;;;ACbqC,IAAAC,sBAAA;AAH9B,SAAS,cAAc,SAAkB,YAAoB;AAClE,QAAM,YAAY,UAAU,OAAO;AAEnC,SAAO,UAAU,CAAC,EAAE,GA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sible","import_jsx_runtime","Collapsible"]}
@@ -1,8 +1,77 @@
1
1
  import {
2
- Collapsible
3
- } from "../chunk-3LEFXZNI.mjs";
4
- import "../chunk-6QCEPQ3U.mjs";
2
+ Slot
3
+ } from "../chunk-6QCEPQ3U.mjs";
4
+
5
+ // src/collapsible/Content.tsx
6
+ import { Collapsible } from "@base-ui-components/react/collapsible";
7
+ import { cx } from "class-variance-authority";
8
+
9
+ // src/collapsible/useRenderSlot.tsx
10
+ import { jsx } from "react/jsx-runtime";
11
+ function useRenderSlot(asChild, defaultTag) {
12
+ const Component = asChild ? Slot : defaultTag;
13
+ return asChild ? ({ ...props }) => /* @__PURE__ */ jsx(Component, { ...props }) : void 0;
14
+ }
15
+
16
+ // src/collapsible/Content.tsx
17
+ import { jsx as jsx2 } from "react/jsx-runtime";
18
+ var Content = ({
19
+ asChild = false,
20
+ className,
21
+ children,
22
+ hiddenUntilFound = true,
23
+ ...props
24
+ }) => {
25
+ const renderSlot = useRenderSlot(asChild, "div");
26
+ return /* @__PURE__ */ jsx2(
27
+ Collapsible.Panel,
28
+ {
29
+ "data-spark-component": "collapsible-content",
30
+ className: cx(
31
+ "overflow-hidden",
32
+ "h-[var(--collapsible-panel-height)]",
33
+ "transition-all duration-200",
34
+ "motion-reduce:transition-none",
35
+ "data-[starting-style]:h-0",
36
+ "data-[ending-style]:h-0",
37
+ className
38
+ ),
39
+ render: renderSlot,
40
+ hiddenUntilFound,
41
+ ...props,
42
+ children
43
+ }
44
+ );
45
+ };
46
+ Content.displayName = "Collapsible.Content";
47
+
48
+ // src/collapsible/Root.tsx
49
+ import { Collapsible as Collapsible2 } from "@base-ui-components/react/collapsible";
50
+ import { jsx as jsx3 } from "react/jsx-runtime";
51
+ var Root = ({ asChild = false, children, ...props }) => {
52
+ const renderSlot = useRenderSlot(asChild, "div");
53
+ return /* @__PURE__ */ jsx3(Collapsible2.Root, { "data-spark-component": "collapsible", render: renderSlot, ...props, children });
54
+ };
55
+ Root.displayName = "Collapsible";
56
+
57
+ // src/collapsible/Trigger.tsx
58
+ import { Collapsible as Collapsible3 } from "@base-ui-components/react/collapsible";
59
+ import { jsx as jsx4 } from "react/jsx-runtime";
60
+ var Trigger = ({ asChild = false, children, ...props }) => {
61
+ const renderSlot = useRenderSlot(asChild, "button");
62
+ return /* @__PURE__ */ jsx4(Collapsible3.Trigger, { "data-spark-component": "collapsible-trigger", render: renderSlot, ...props, children });
63
+ };
64
+ Trigger.displayName = "Collapsible.Trigger";
65
+
66
+ // src/collapsible/index.ts
67
+ var Collapsible4 = Object.assign(Root, {
68
+ Trigger,
69
+ Content
70
+ });
71
+ Collapsible4.displayName = "Collapsible";
72
+ Trigger.displayName = "Collapsible.Trigger";
73
+ Content.displayName = "Collapsible.Content";
5
74
  export {
6
- Collapsible
75
+ Collapsible4 as Collapsible
7
76
  };
8
77
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"sources":["../../src/collapsible/Content.tsx","../../src/collapsible/useRenderSlot.tsx","../../src/collapsible/Root.tsx","../../src/collapsible/Trigger.tsx","../../src/collapsible/index.ts"],"sourcesContent":["import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { cx } from 'class-variance-authority'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface ContentProps extends ComponentProps<typeof Collapsible.Panel> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Content = ({\n asChild = false,\n className,\n children,\n hiddenUntilFound = true,\n ...props\n}: ContentProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <Collapsible.Panel\n data-spark-component=\"collapsible-content\"\n className={cx(\n 'overflow-hidden',\n 'h-[var(--collapsible-panel-height)]',\n 'transition-all duration-200',\n 'motion-reduce:transition-none',\n 'data-[starting-style]:h-0',\n 'data-[ending-style]:h-0',\n className\n )}\n render={renderSlot}\n hiddenUntilFound={hiddenUntilFound}\n {...props}\n >\n {children}\n </Collapsible.Panel>\n )\n}\n\nContent.displayName = 'Collapsible.Content'\n","import { Slot } from '../slot'\n\nexport function useRenderSlot(asChild: boolean, defaultTag: string) {\n const Component = asChild ? Slot : defaultTag\n\n return asChild ? ({ ...props }) => <Component {...props} /> : undefined\n}\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface RootProps extends ComponentProps<typeof Collapsible.Root> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Root = ({ asChild = false, children, ...props }: RootProps) => {\n const renderSlot = useRenderSlot(asChild, 'div')\n\n return (\n <Collapsible.Root data-spark-component=\"collapsible\" render={renderSlot} {...props}>\n {children}\n </Collapsible.Root>\n )\n}\n\nRoot.displayName = 'Collapsible'\n","import { Collapsible } from '@base-ui-components/react/collapsible'\nimport { type ComponentProps } from 'react'\n\nimport { useRenderSlot } from './useRenderSlot'\n\nexport interface TriggerProps extends ComponentProps<'button'> {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n */\n asChild?: boolean\n}\n\nexport const Trigger = ({ asChild = false, children, ...props }: TriggerProps) => {\n const renderSlot = useRenderSlot(asChild, 'button')\n\n return (\n <Collapsible.Trigger data-spark-component=\"collapsible-trigger\" render={renderSlot} {...props}>\n {children}\n </Collapsible.Trigger>\n )\n}\n\nTrigger.displayName = 'Collapsible.Trigger'\n","import { Content } from './Content'\nimport { Root } from './Root'\nimport { Trigger } from './Trigger'\n\nexport const Collapsible: typeof Root & {\n Trigger: typeof Trigger\n Content: typeof Content\n} = Object.assign(Root, {\n Trigger,\n Content,\n})\n\nCollapsible.displayName = 'Collapsible'\nTrigger.displayName = 'Collapsible.Trigger'\nContent.displayName = 'Collapsible.Content'\n"],"mappings":";;;;;AAAA,SAAS,mBAAmB;AAC5B,SAAS,UAAU;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F,CAAC;AAEDA,aAAY,cAAc;AAC1B,QAAQ,cAAc;AACtB,QAAQ,cAAc;","names":["jsx","Collapsible","jsx","Collapsible","Collapsible","jsx","Collapsible","Collapsible"]}
@@ -1,5 +1,5 @@
1
- import { C as CloseProps, D as Dialog$1, T as Trigger, P as Portal, O as Overlay, a as Content, H as Header, B as Body, F as Footer, b as Close, c as Title, d as Description } from '../DialogTrigger-5SI4dvpK.mjs';
2
- export { h as DialogBodyProps, f as DialogContentProps, n as DialogDescriptionProps, i as DialogFooterProps, g as DialogHeaderProps, k as DialogOverlayProps, l as DialogPortalProps, e as DialogProps, m as DialogTitleProps, j as DialogTriggerProps } from '../DialogTrigger-5SI4dvpK.mjs';
1
+ import { C as CloseProps, D as Dialog$1, T as Trigger, P as Portal, O as Overlay, a as Content, H as Header, B as Body, F as Footer, b as Close, c as Title, d as Description } from '../DialogTrigger-woU7vsJi.mjs';
2
+ export { h as DialogBodyProps, f as DialogContentProps, n as DialogDescriptionProps, i as DialogFooterProps, g as DialogHeaderProps, k as DialogOverlayProps, l as DialogPortalProps, e as DialogProps, m as DialogTitleProps, j as DialogTriggerProps } from '../DialogTrigger-woU7vsJi.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { IconButtonProps } from '../icon-button/index.mjs';
5
5
  import 'radix-ui';
@@ -1,5 +1,5 @@
1
- import { C as CloseProps, D as Dialog$1, T as Trigger, P as Portal, O as Overlay, a as Content, H as Header, B as Body, F as Footer, b as Close, c as Title, d as Description } from '../DialogTrigger-5SI4dvpK.js';
2
- export { h as DialogBodyProps, f as DialogContentProps, n as DialogDescriptionProps, i as DialogFooterProps, g as DialogHeaderProps, k as DialogOverlayProps, l as DialogPortalProps, e as DialogProps, m as DialogTitleProps, j as DialogTriggerProps } from '../DialogTrigger-5SI4dvpK.js';
1
+ import { C as CloseProps, D as Dialog$1, T as Trigger, P as Portal, O as Overlay, a as Content, H as Header, B as Body, F as Footer, b as Close, c as Title, d as Description } from '../DialogTrigger-woU7vsJi.js';
2
+ export { h as DialogBodyProps, f as DialogContentProps, n as DialogDescriptionProps, i as DialogFooterProps, g as DialogHeaderProps, k as DialogOverlayProps, l as DialogPortalProps, e as DialogProps, m as DialogTitleProps, j as DialogTriggerProps } from '../DialogTrigger-woU7vsJi.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import { IconButtonProps } from '../icon-button/index.js';
5
5
  import 'radix-ui';
@@ -32,14 +32,18 @@ var import_react2 = require("react");
32
32
  var import_react = require("react");
33
33
  var import_jsx_runtime = require("react/jsx-runtime");
34
34
  var DialogContext = (0, import_react.createContext)(null);
35
- var DialogProvider = ({ children: childrenProp }) => {
35
+ var DialogProvider = ({
36
+ children: childrenProp,
37
+ withFade = false
38
+ }) => {
36
39
  const [isFullScreen, setIsFullScreen] = (0, import_react.useState)(false);
37
40
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
38
41
  DialogContext.Provider,
39
42
  {
40
43
  value: {
41
44
  isFullScreen,
42
- setIsFullScreen
45
+ setIsFullScreen,
46
+ withFade
43
47
  },
44
48
  children: childrenProp
45
49
  }
@@ -55,7 +59,7 @@ var useDialog = () => {
55
59
 
56
60
  // src/dialog/Dialog.tsx
57
61
  var import_jsx_runtime2 = require("react/jsx-runtime");
58
- var Dialog = ({ children, ...rest }) => {
62
+ var Dialog = ({ children, withFade = false, ...rest }) => {
59
63
  const open = rest.open;
60
64
  const activeElementRef = (0, import_react2.useRef)(null);
61
65
  function handleActiveElementFocus() {
@@ -70,42 +74,52 @@ var Dialog = ({ children, ...rest }) => {
70
74
  }
71
75
  }
72
76
  (0, import_react2.useEffect)(handleActiveElementFocus, [open]);
73
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DialogProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_radix_ui.Dialog.Root, { ...rest, children }) });
77
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(DialogProvider, { withFade, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_radix_ui.Dialog.Root, { ...rest, children }) });
74
78
  };
75
79
  Dialog.displayName = "Dialog.Root";
76
80
 
77
- // src/dialog/DialogBody.styles.ts
78
- var import_class_variance_authority = require("class-variance-authority");
79
- var dialogBodyStyles = (0, import_class_variance_authority.cva)(
80
- ["grow", "overflow-y-auto", "outline-hidden", "focus-visible:u-outline"],
81
- {
82
- variants: {
83
- inset: {
84
- true: "",
85
- false: "px-xl py-lg"
86
- }
87
- }
88
- }
89
- );
90
-
91
81
  // src/dialog/DialogBody.tsx
82
+ var import_use_merge_refs = require("@spark-ui/hooks/use-merge-refs");
83
+ var import_use_scroll_overflow = require("@spark-ui/hooks/use-scroll-overflow");
84
+ var import_class_variance_authority = require("class-variance-authority");
85
+ var import_react3 = require("react");
92
86
  var import_jsx_runtime3 = require("react/jsx-runtime");
93
87
  var Body = ({
94
88
  children,
95
89
  className,
96
90
  inset = false,
97
- ref,
91
+ ref: forwardedRef,
98
92
  ...rest
99
- }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
100
- "div",
101
- {
102
- "data-spark-component": "dialog-body",
103
- ref,
104
- className: dialogBodyStyles({ inset, className }),
105
- ...rest,
106
- children
107
- }
108
- );
93
+ }) => {
94
+ const scrollAreaRef = (0, import_react3.useRef)(null);
95
+ const ref = (0, import_use_merge_refs.useMergeRefs)(forwardedRef, scrollAreaRef);
96
+ const { withFade } = useDialog();
97
+ const overflow = (0, import_use_scroll_overflow.useScrollOverflow)(scrollAreaRef);
98
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
99
+ "div",
100
+ {
101
+ "data-spark-component": "dialog-body",
102
+ ref,
103
+ className: (0, import_class_variance_authority.cx)(
104
+ "focus-visible:u-outline relative grow overflow-y-auto outline-hidden",
105
+ "transition-all duration-300",
106
+ {
107
+ ["px-xl py-lg"]: !inset
108
+ },
109
+ className
110
+ ),
111
+ style: {
112
+ ...withFade && {
113
+ maskImage: "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))",
114
+ maskSize: `100% calc(100% + ${overflow.top ? "0px" : "44px"} + ${overflow.bottom ? "0px" : "44px"})`,
115
+ maskPosition: `0 ${overflow.top ? "0px" : "-44px"}`
116
+ }
117
+ },
118
+ ...rest,
119
+ children
120
+ }
121
+ );
122
+ };
109
123
  Body.displayName = "Dialog.Body";
110
124
 
111
125
  // src/dialog/DialogClose.tsx
@@ -119,11 +133,11 @@ var import_Close = require("@spark-ui/icons/Close");
119
133
  var import_class_variance_authority7 = require("class-variance-authority");
120
134
 
121
135
  // src/icon/Icon.tsx
122
- var import_react4 = require("react");
136
+ var import_react5 = require("react");
123
137
 
124
138
  // src/slot/Slot.tsx
125
139
  var import_radix_ui3 = require("radix-ui");
126
- var import_react3 = require("react");
140
+ var import_react4 = require("react");
127
141
  var import_jsx_runtime5 = require("react/jsx-runtime");
128
142
  var Slottable = import_radix_ui3.Slot.Slottable;
129
143
  var Slot = ({ ref, ...props }) => {
@@ -131,7 +145,7 @@ var Slot = ({ ref, ...props }) => {
131
145
  };
132
146
  var wrapPolymorphicSlot = (asChild, children, callback) => {
133
147
  if (!asChild) return callback(children);
134
- return (0, import_react3.isValidElement)(children) ? (0, import_react3.cloneElement)(
148
+ return (0, import_react4.isValidElement)(children) ? (0, import_react4.cloneElement)(
135
149
  children,
136
150
  void 0,
137
151
  callback(children.props.children)
@@ -209,9 +223,9 @@ var Icon = ({
209
223
  children,
210
224
  ...others
211
225
  }) => {
212
- const child = import_react4.Children.only(children);
226
+ const child = import_react5.Children.only(children);
213
227
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
214
- (0, import_react4.cloneElement)(child, {
228
+ (0, import_react5.cloneElement)(child, {
215
229
  className: iconStyles({ className, size, intent }),
216
230
  "data-spark-component": "icon",
217
231
  "aria-hidden": "true",
@@ -225,7 +239,7 @@ Icon.displayName = "Icon";
225
239
 
226
240
  // src/button/Button.tsx
227
241
  var import_class_variance_authority5 = require("class-variance-authority");
228
- var import_react5 = require("react");
242
+ var import_react6 = require("react");
229
243
 
230
244
  // src/spinner/Spinner.styles.tsx
231
245
  var import_internal_utils2 = require("@spark-ui/internal-utils");
@@ -977,7 +991,7 @@ var Button = ({
977
991
  }) => {
978
992
  const Component = asChild ? Slot : "button";
979
993
  const shouldNotInteract = !!disabled || isLoading;
980
- const disabledEventHandlers = (0, import_react5.useMemo)(() => {
994
+ const disabledEventHandlers = (0, import_react6.useMemo)(() => {
981
995
  const result = {};
982
996
  if (shouldNotInteract) {
983
997
  blockedEventHandlers.forEach((eventHandler) => result[eventHandler] = void 0);
@@ -1107,7 +1121,7 @@ Root.displayName = "Dialog.CloseButton";
1107
1121
 
1108
1122
  // src/dialog/DialogContent.tsx
1109
1123
  var import_radix_ui4 = require("radix-ui");
1110
- var import_react6 = require("react");
1124
+ var import_react7 = require("react");
1111
1125
 
1112
1126
  // src/dialog/DialogContent.styles.tsx
1113
1127
  var import_class_variance_authority8 = require("class-variance-authority");
@@ -1167,7 +1181,7 @@ var Content = ({
1167
1181
  ...rest
1168
1182
  }) => {
1169
1183
  const { setIsFullScreen } = useDialog();
1170
- (0, import_react6.useEffect)(() => {
1184
+ (0, import_react7.useEffect)(() => {
1171
1185
  if (size === "fullscreen") setIsFullScreen(true);
1172
1186
  return () => setIsFullScreen(false);
1173
1187
  }, [setIsFullScreen, size]);