@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.
- package/CHANGELOG.md +13 -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/accordion/index.d.mts +13 -25
- package/dist/accordion/index.d.ts +13 -25
- package/dist/accordion/index.js +114 -250
- package/dist/accordion/index.js.map +1 -1
- package/dist/accordion/index.mjs +92 -134
- package/dist/accordion/index.mjs.map +1 -1
- 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/collapsible/index.d.mts +18 -35
- package/dist/collapsible/index.d.ts +18 -35
- package/dist/collapsible/index.js +47 -78
- package/dist/collapsible/index.js.map +1 -1
- package/dist/collapsible/index.mjs +73 -4
- package/dist/collapsible/index.mjs.map +1 -1
- 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 +6 -7
- package/dist/chunk-3LEFXZNI.mjs +0 -97
- package/dist/chunk-3LEFXZNI.mjs.map +0 -1
- package/dist/chunk-T26TYEWV.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/collapsible/index.ts","../../src/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,GAAG,MAAM,MAAM,6CAAC,aAAW,GAAG,OAAO,IAAK;AAChE;;;AFiBI,IAAAC,sBAAA;AAVG,IAAM,UAAU,CAAC;AAAA,EACtB,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,GAAG;AACL,MAAoB;AAClB,QAAM,aAAa,cAAc,SAAS,KAAK;AAE/C,SACE;AAAA,IAAC,+BAAY;AAAA,IAAZ;AAAA,MACC,wBAAqB;AAAA,MACrB,eAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAEA,QAAQ,cAAc;;;AG3CtB,IAAAC,sBAA4B;AAgBxB,IAAAC,sBAAA;AAJG,IAAM,OAAO,CAAC,EAAE,UAAU,OAAO,UAAU,GAAG,MAAM,MAAiB;AAC1E,QAAM,aAAa,cAAc,SAAS,KAAK;AAE/C,SACE,6CAAC,gCAAY,MAAZ,EAAiB,wBAAqB,eAAc,QAAQ,YAAa,GAAG,OAC1E,UACH;AAEJ;AAEA,KAAK,cAAc;;;ACtBnB,IAAAC,sBAA4B;AAgBxB,IAAAC,sBAAA;AAJG,IAAM,UAAU,CAAC,EAAE,UAAU,OAAO,UAAU,GAAG,MAAM,MAAoB;AAChF,QAAM,aAAa,cAAc,SAAS,QAAQ;AAElD,SACE,6CAAC,gCAAY,SAAZ,EAAoB,wBAAqB,uBAAsB,QAAQ,YAAa,GAAG,OACrF,UACH;AAEJ;AAEA,QAAQ,cAAc;;;ALlBf,IAAMC,eAGT,OAAO,OAAO,MAAM;AAAA,EACtB;AAAA,EACA;AACF,CAAC;AAEDA,aAAY,cAAc;AAC1B,QAAQ,cAAc;AACtB,QAAQ,cAAc;","names":["Collapsible","RadixSlot","import_jsx_runtime","import_jsx_runtime","import_collapsible","import_jsx_runtime","import_collapsible","import_jsx_runtime","Collapsible"]}
|
|
@@ -1,8 +1,77 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
|
|
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;;;ACIkB;AAH9B,SAAS,cAAc,SAAkB,YAAoB;AAClE,QAAM,YAAY,UAAU,OAAO;AAEnC,SAAO,UAAU,CAAC,EAAE,GAAG,MAAM,MAAM,oBAAC,aAAW,GAAG,OAAO,IAAK;AAChE;;;ADiBI,gBAAAA,YAAA;AAVG,IAAM,UAAU,CAAC;AAAA,EACtB,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA,mBAAmB;AAAA,EACnB,GAAG;AACL,MAAoB;AAClB,QAAM,aAAa,cAAc,SAAS,KAAK;AAE/C,SACE,gBAAAA;AAAA,IAAC,YAAY;AAAA,IAAZ;AAAA,MACC,wBAAqB;AAAA,MACrB,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,MACC,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAEA,QAAQ,cAAc;;;AE3CtB,SAAS,eAAAC,oBAAmB;AAgBxB,gBAAAC,YAAA;AAJG,IAAM,OAAO,CAAC,EAAE,UAAU,OAAO,UAAU,GAAG,MAAM,MAAiB;AAC1E,QAAM,aAAa,cAAc,SAAS,KAAK;AAE/C,SACE,gBAAAA,KAACC,aAAY,MAAZ,EAAiB,wBAAqB,eAAc,QAAQ,YAAa,GAAG,OAC1E,UACH;AAEJ;AAEA,KAAK,cAAc;;;ACtBnB,SAAS,eAAAC,oBAAmB;AAgBxB,gBAAAC,YAAA;AAJG,IAAM,UAAU,CAAC,EAAE,UAAU,OAAO,UAAU,GAAG,MAAM,MAAoB;AAChF,QAAM,aAAa,cAAc,SAAS,QAAQ;AAElD,SACE,gBAAAA,KAACC,aAAY,SAAZ,EAAoB,wBAAqB,uBAAsB,QAAQ,YAAa,GAAG,OACrF,UACH;AAEJ;AAEA,QAAQ,cAAc;;;AClBf,IAAMC,eAGT,OAAO,OAAO,MAAM;AAAA,EACtB;AAAA,EACA;AACF,CAAC;AAEDA,aAAY,cAAc;AAC1B,QAAQ,cAAc;AACtB,QAAQ,cAAc;","names":["jsx","Collapsible","jsx","Collapsible","Collapsible","jsx","Collapsible","Collapsible"]}
|
package/dist/dialog/index.d.mts
CHANGED
|
@@ -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-
|
|
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-
|
|
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';
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -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-
|
|
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-
|
|
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';
|
package/dist/dialog/index.js
CHANGED
|
@@ -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 = ({
|
|
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
|
-
}) =>
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
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
|
|
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
|
|
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,
|
|
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 =
|
|
226
|
+
const child = import_react5.Children.only(children);
|
|
213
227
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
214
|
-
(0,
|
|
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
|
|
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,
|
|
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
|
|
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,
|
|
1184
|
+
(0, import_react7.useEffect)(() => {
|
|
1171
1185
|
if (size === "fullscreen") setIsFullScreen(true);
|
|
1172
1186
|
return () => setIsFullScreen(false);
|
|
1173
1187
|
}, [setIsFullScreen, size]);
|