@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
|
@@ -13,14 +13,18 @@ import { useEffect, useRef } from "react";
|
|
|
13
13
|
import { createContext, useContext, useState } from "react";
|
|
14
14
|
import { jsx } from "react/jsx-runtime";
|
|
15
15
|
var DialogContext = createContext(null);
|
|
16
|
-
var DialogProvider = ({
|
|
16
|
+
var DialogProvider = ({
|
|
17
|
+
children: childrenProp,
|
|
18
|
+
withFade = false
|
|
19
|
+
}) => {
|
|
17
20
|
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
18
21
|
return /* @__PURE__ */ jsx(
|
|
19
22
|
DialogContext.Provider,
|
|
20
23
|
{
|
|
21
24
|
value: {
|
|
22
25
|
isFullScreen,
|
|
23
|
-
setIsFullScreen
|
|
26
|
+
setIsFullScreen,
|
|
27
|
+
withFade
|
|
24
28
|
},
|
|
25
29
|
children: childrenProp
|
|
26
30
|
}
|
|
@@ -36,7 +40,7 @@ var useDialog = () => {
|
|
|
36
40
|
|
|
37
41
|
// src/dialog/Dialog.tsx
|
|
38
42
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
39
|
-
var Dialog = ({ children, ...rest }) => {
|
|
43
|
+
var Dialog = ({ children, withFade = false, ...rest }) => {
|
|
40
44
|
const open = rest.open;
|
|
41
45
|
const activeElementRef = useRef(null);
|
|
42
46
|
function handleActiveElementFocus() {
|
|
@@ -51,42 +55,52 @@ var Dialog = ({ children, ...rest }) => {
|
|
|
51
55
|
}
|
|
52
56
|
}
|
|
53
57
|
useEffect(handleActiveElementFocus, [open]);
|
|
54
|
-
return /* @__PURE__ */ jsx2(DialogProvider, { children: /* @__PURE__ */ jsx2(RadixDialog.Root, { ...rest, children }) });
|
|
58
|
+
return /* @__PURE__ */ jsx2(DialogProvider, { withFade, children: /* @__PURE__ */ jsx2(RadixDialog.Root, { ...rest, children }) });
|
|
55
59
|
};
|
|
56
60
|
Dialog.displayName = "Dialog.Root";
|
|
57
61
|
|
|
58
|
-
// src/dialog/DialogBody.styles.ts
|
|
59
|
-
import { cva } from "class-variance-authority";
|
|
60
|
-
var dialogBodyStyles = cva(
|
|
61
|
-
["grow", "overflow-y-auto", "outline-hidden", "focus-visible:u-outline"],
|
|
62
|
-
{
|
|
63
|
-
variants: {
|
|
64
|
-
inset: {
|
|
65
|
-
true: "",
|
|
66
|
-
false: "px-xl py-lg"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
|
|
72
62
|
// src/dialog/DialogBody.tsx
|
|
63
|
+
import { useMergeRefs } from "@spark-ui/hooks/use-merge-refs";
|
|
64
|
+
import { useScrollOverflow } from "@spark-ui/hooks/use-scroll-overflow";
|
|
65
|
+
import { cx } from "class-variance-authority";
|
|
66
|
+
import { useRef as useRef2 } from "react";
|
|
73
67
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
74
68
|
var Body = ({
|
|
75
69
|
children,
|
|
76
70
|
className,
|
|
77
71
|
inset = false,
|
|
78
|
-
ref,
|
|
72
|
+
ref: forwardedRef,
|
|
79
73
|
...rest
|
|
80
|
-
}) =>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
74
|
+
}) => {
|
|
75
|
+
const scrollAreaRef = useRef2(null);
|
|
76
|
+
const ref = useMergeRefs(forwardedRef, scrollAreaRef);
|
|
77
|
+
const { withFade } = useDialog();
|
|
78
|
+
const overflow = useScrollOverflow(scrollAreaRef);
|
|
79
|
+
return /* @__PURE__ */ jsx3(
|
|
80
|
+
"div",
|
|
81
|
+
{
|
|
82
|
+
"data-spark-component": "dialog-body",
|
|
83
|
+
ref,
|
|
84
|
+
className: cx(
|
|
85
|
+
"focus-visible:u-outline relative grow overflow-y-auto outline-hidden",
|
|
86
|
+
"transition-all duration-300",
|
|
87
|
+
{
|
|
88
|
+
["px-xl py-lg"]: !inset
|
|
89
|
+
},
|
|
90
|
+
className
|
|
91
|
+
),
|
|
92
|
+
style: {
|
|
93
|
+
...withFade && {
|
|
94
|
+
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))",
|
|
95
|
+
maskSize: `100% calc(100% + ${overflow.top ? "0px" : "44px"} + ${overflow.bottom ? "0px" : "44px"})`,
|
|
96
|
+
maskPosition: `0 ${overflow.top ? "0px" : "-44px"}`
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
...rest,
|
|
100
|
+
children
|
|
101
|
+
}
|
|
102
|
+
);
|
|
103
|
+
};
|
|
90
104
|
Body.displayName = "Dialog.Body";
|
|
91
105
|
|
|
92
106
|
// src/dialog/DialogClose.tsx
|
|
@@ -97,7 +111,7 @@ Close.displayName = "Dialog.Close";
|
|
|
97
111
|
|
|
98
112
|
// src/dialog/DialogCloseButton.tsx
|
|
99
113
|
import { Close as CloseSVG } from "@spark-ui/icons/Close";
|
|
100
|
-
import { cx } from "class-variance-authority";
|
|
114
|
+
import { cx as cx2 } from "class-variance-authority";
|
|
101
115
|
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
102
116
|
var Root = ({
|
|
103
117
|
"aria-label": ariaLabel,
|
|
@@ -115,7 +129,7 @@ var Root = ({
|
|
|
115
129
|
"data-spark-component": "dialog-close-button",
|
|
116
130
|
"data-part": "close",
|
|
117
131
|
ref,
|
|
118
|
-
className:
|
|
132
|
+
className: cx2(["absolute", "top-md", "right-xl"], className),
|
|
119
133
|
asChild: true,
|
|
120
134
|
...rest,
|
|
121
135
|
children: /* @__PURE__ */ jsx5(IconButton, { intent, size, design, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx5(Icon, { children }) })
|
|
@@ -132,8 +146,8 @@ import { Dialog as RadixDialog3 } from "radix-ui";
|
|
|
132
146
|
import { useEffect as useEffect2 } from "react";
|
|
133
147
|
|
|
134
148
|
// src/dialog/DialogContent.styles.tsx
|
|
135
|
-
import { cva
|
|
136
|
-
var dialogContentStyles =
|
|
149
|
+
import { cva } from "class-variance-authority";
|
|
150
|
+
var dialogContentStyles = cva(
|
|
137
151
|
[
|
|
138
152
|
"z-modal flex flex-col bg-surface group",
|
|
139
153
|
"focus-visible:outline-hidden focus-visible:u-outline",
|
|
@@ -224,14 +238,14 @@ var Description = (props) => /* @__PURE__ */ jsx7(RadixDialog4.Description, { "d
|
|
|
224
238
|
Description.displayName = "Dialog.Description";
|
|
225
239
|
|
|
226
240
|
// src/dialog/DialogFooter.tsx
|
|
227
|
-
import { cx as
|
|
241
|
+
import { cx as cx3 } from "class-variance-authority";
|
|
228
242
|
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
229
243
|
var Footer = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx8(
|
|
230
244
|
"footer",
|
|
231
245
|
{
|
|
232
246
|
"data-spark-component": "dialog-footer",
|
|
233
247
|
ref,
|
|
234
|
-
className:
|
|
248
|
+
className: cx3(className, ["px-xl", "py-lg"]),
|
|
235
249
|
...rest,
|
|
236
250
|
children
|
|
237
251
|
}
|
|
@@ -239,14 +253,14 @@ var Footer = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx8(
|
|
|
239
253
|
Footer.displayName = "Dialog.Footer";
|
|
240
254
|
|
|
241
255
|
// src/dialog/DialogHeader.tsx
|
|
242
|
-
import { cx as
|
|
256
|
+
import { cx as cx4 } from "class-variance-authority";
|
|
243
257
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
244
258
|
var Header = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx9(
|
|
245
259
|
"header",
|
|
246
260
|
{
|
|
247
261
|
"data-spark-component": "dialog-header",
|
|
248
262
|
ref,
|
|
249
|
-
className:
|
|
263
|
+
className: cx4(className, ["px-xl", "py-lg"]),
|
|
250
264
|
...rest,
|
|
251
265
|
children
|
|
252
266
|
}
|
|
@@ -254,7 +268,7 @@ var Header = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx9(
|
|
|
254
268
|
Header.displayName = "Dialog.Header";
|
|
255
269
|
|
|
256
270
|
// src/dialog/DialogOverlay.tsx
|
|
257
|
-
import { cx as
|
|
271
|
+
import { cx as cx5 } from "class-variance-authority";
|
|
258
272
|
import { Dialog as RadixDialog5 } from "radix-ui";
|
|
259
273
|
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
260
274
|
var Overlay = ({ className, ref, ...rest }) => {
|
|
@@ -264,7 +278,7 @@ var Overlay = ({ className, ref, ...rest }) => {
|
|
|
264
278
|
{
|
|
265
279
|
"data-spark-component": "dialog-overlay",
|
|
266
280
|
ref,
|
|
267
|
-
className:
|
|
281
|
+
className: cx5(
|
|
268
282
|
isFullScreen ? "hidden" : "fixed",
|
|
269
283
|
["top-0", "left-0", "w-screen", "h-screen", "z-overlay"],
|
|
270
284
|
["bg-overlay/dim-1"],
|
|
@@ -285,7 +299,7 @@ var Portal = ({ children, ...rest }) => /* @__PURE__ */ jsx11(RadixDialog6.Porta
|
|
|
285
299
|
Portal.displayName = "Dialog.Portal";
|
|
286
300
|
|
|
287
301
|
// src/dialog/DialogTitle.tsx
|
|
288
|
-
import { cx as
|
|
302
|
+
import { cx as cx6 } from "class-variance-authority";
|
|
289
303
|
import { Dialog as RadixDialog7 } from "radix-ui";
|
|
290
304
|
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
291
305
|
var Title = ({ className, ref, ...others }) => {
|
|
@@ -294,7 +308,7 @@ var Title = ({ className, ref, ...others }) => {
|
|
|
294
308
|
{
|
|
295
309
|
"data-spark-component": "dialog-title",
|
|
296
310
|
ref,
|
|
297
|
-
className:
|
|
311
|
+
className: cx6(
|
|
298
312
|
"text-headline-1 text-on-surface",
|
|
299
313
|
"group-has-data-[part=close]:pr-3xl",
|
|
300
314
|
className
|
|
@@ -341,4 +355,4 @@ Description.displayName = "Dialog.Description";
|
|
|
341
355
|
export {
|
|
342
356
|
Dialog2 as Dialog
|
|
343
357
|
};
|
|
344
|
-
//# sourceMappingURL=chunk-
|
|
358
|
+
//# sourceMappingURL=chunk-I7UIKCZK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/dialog/Dialog.tsx","../src/dialog/DialogContext.tsx","../src/dialog/DialogBody.tsx","../src/dialog/DialogClose.tsx","../src/dialog/DialogCloseButton.tsx","../src/dialog/DialogContent.tsx","../src/dialog/DialogContent.styles.tsx","../src/dialog/DialogDescription.tsx","../src/dialog/DialogFooter.tsx","../src/dialog/DialogHeader.tsx","../src/dialog/DialogOverlay.tsx","../src/dialog/DialogPortal.tsx","../src/dialog/DialogTitle.tsx","../src/dialog/DialogTrigger.tsx","../src/dialog/index.ts"],"sourcesContent":["import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, useEffect, useRef } from 'react'\n\nimport { DialogProvider } from './DialogContext'\n\nexport interface DialogProps {\n /**\n * Children of the component.\n */\n children?: RadixDialog.DialogProps['children']\n /**\n * Specifies if the dialog is open or not.\n */\n open?: RadixDialog.DialogProps['open']\n /**\n * Default open state.\n */\n defaultOpen?: RadixDialog.DialogProps['defaultOpen']\n /**\n * Handler executen on every dialog open state change.\n */\n onOpenChange?: RadixDialog.DialogProps['onOpenChange']\n /**\n * Specifies if the dialog is a modal.\n */\n modal?: RadixDialog.DialogProps['modal']\n /**\n * Specifies if the dialog should have a fade animation on its body (in case it is scrollable).\n */\n withFade?: boolean\n}\n\nexport const Dialog = ({ children, withFade = false, ...rest }: DialogProps): ReactElement => {\n const open = rest.open\n const activeElementRef = useRef<Element>(null)\n\n /**\n * This function captures the active element when the Dialog is opened\n * and sets focus back to it when the Dialog is closed.\n */\n function handleActiveElementFocus() {\n if (open && document.activeElement) {\n activeElementRef.current = document.activeElement\n }\n\n if (!open) {\n setTimeout(() => {\n if (!(activeElementRef.current instanceof HTMLElement)) return\n activeElementRef.current.focus()\n }, 0)\n }\n }\n\n useEffect(handleActiveElementFocus, [open])\n\n return (\n <DialogProvider withFade={withFade}>\n <RadixDialog.Root {...rest}>{children}</RadixDialog.Root>\n </DialogProvider>\n )\n}\n\nDialog.displayName = 'Dialog.Root'\n","import { createContext, type ReactNode, useContext, useState } from 'react'\n\nexport interface DialogContextState {\n isFullScreen: boolean\n setIsFullScreen: (value: boolean) => void\n withFade: boolean\n}\n\nconst DialogContext = createContext<DialogContextState | null>(null)\n\nexport const DialogProvider = ({\n children: childrenProp,\n withFade = false,\n}: {\n children: ReactNode\n withFade?: boolean\n}) => {\n const [isFullScreen, setIsFullScreen] = useState(false)\n\n return (\n <DialogContext.Provider\n value={{\n isFullScreen,\n setIsFullScreen,\n withFade,\n }}\n >\n {childrenProp}\n </DialogContext.Provider>\n )\n}\n\nexport const useDialog = () => {\n const context = useContext(DialogContext)\n\n if (!context) {\n throw Error('useDialog must be used within a Dialog 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 { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref, useRef } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport interface BodyProps {\n children: ReactNode\n className?: string\n tabIndex?: number\n ref?: Ref<HTMLDivElement>\n inset?: boolean\n}\n\nexport const Body = ({\n children,\n className,\n inset = false,\n ref: forwardedRef,\n ...rest\n}: BodyProps): ReactElement => {\n const scrollAreaRef = useRef<HTMLDivElement>(null)\n const ref = useMergeRefs(forwardedRef, scrollAreaRef)\n\n const { withFade } = useDialog()\n\n const overflow = useScrollOverflow(scrollAreaRef)\n\n return (\n <div\n data-spark-component=\"dialog-body\"\n ref={ref}\n className={cx(\n 'focus-visible:u-outline relative grow overflow-y-auto outline-hidden',\n 'transition-all duration-300',\n {\n ['px-xl py-lg']: !inset,\n },\n className\n )}\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\nBody.displayName = 'Dialog.Body'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type CloseProps = RadixDialog.DialogCloseProps & {\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Close = (props: CloseProps) => <RadixDialog.Close {...props} />\n\nClose.displayName = 'Dialog.Close'\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 { Close, CloseProps } from './DialogClose'\n\nexport type CloseButtonProps = CloseProps &\n Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>\n\nconst Root = ({\n 'aria-label': ariaLabel,\n className,\n size = 'md',\n intent = 'neutral',\n design = 'ghost',\n children = <CloseSVG />,\n ref,\n ...rest\n}: CloseButtonProps) => {\n return (\n <Close\n data-spark-component=\"dialog-close-button\"\n data-part=\"close\"\n ref={ref}\n className={cx(['absolute', 'top-md', '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 </Close>\n )\n}\n\nexport const CloseButton = Object.assign(Root, {\n id: 'CloseButton',\n})\n\nRoot.displayName = 'Dialog.CloseButton'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, Ref, useEffect } from 'react'\n\nimport { dialogContentStyles, type DialogContentStylesProps } from './DialogContent.styles'\nimport { useDialog } from './DialogContext'\n\nexport interface ContentProps extends RadixDialog.DialogContentProps, DialogContentStylesProps {\n /**\n * When set to true, the content will adjust its width to fit the content rather than taking up the full available width.\n */\n isNarrow?: boolean\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Content = ({\n children,\n className,\n isNarrow = false,\n size = 'md',\n onInteractOutside,\n ref,\n ...rest\n}: ContentProps): ReactElement => {\n const { setIsFullScreen } = useDialog()\n\n useEffect(() => {\n if (size === 'fullscreen') setIsFullScreen(true)\n\n return () => setIsFullScreen(false)\n }, [setIsFullScreen, size])\n\n return (\n <RadixDialog.Content\n data-spark-component=\"dialog-content\"\n ref={ref}\n className={dialogContentStyles({\n className,\n isNarrow,\n size,\n })}\n onInteractOutside={e => {\n const isForegroundElement = (e.target as HTMLElement).closest('.z-toast, .z-popover')\n\n /**\n * The focus trap of the dialog 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 dialog. We want to prevent this.\n */\n if (isForegroundElement) {\n e.preventDefault()\n }\n\n onInteractOutside?.(e)\n }}\n {...rest}\n >\n {children}\n </RadixDialog.Content>\n )\n}\n\nContent.displayName = 'Dialog.Content'\n","import { cva, VariantProps } from 'class-variance-authority'\n\nexport const dialogContentStyles = cva(\n [\n 'z-modal flex flex-col bg-surface group',\n 'focus-visible:outline-hidden focus-visible:u-outline',\n '[&:not(:has(footer))]:pb-lg',\n '[&:not(:has(header))]:pt-lg',\n ],\n {\n variants: {\n size: {\n fullscreen: 'fixed size-full top-0 left-0',\n sm: 'max-w-sz-480',\n md: 'max-w-sz-672',\n lg: 'max-w-sz-864',\n },\n isNarrow: {\n true: [],\n false: [],\n },\n },\n compoundVariants: [\n {\n size: ['sm', 'md', 'lg'],\n class: [\n 'fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2',\n 'max-h-[80%]',\n 'shadow-md rounded-lg',\n 'data-[state=open]:animate-fade-in',\n 'data-[state=closed]:animate-fade-out',\n ],\n },\n {\n size: ['sm', 'md', 'lg'],\n isNarrow: false,\n class: ['w-full'],\n },\n ],\n defaultVariants: {\n size: 'md',\n isNarrow: false,\n },\n }\n)\n\nexport type DialogContentStylesProps = VariantProps<typeof dialogContentStyles>\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type DescriptionProps = RadixDialog.DialogDescriptionProps & {\n ref?: Ref<HTMLParagraphElement>\n}\n\nexport const Description = (props: DescriptionProps) => (\n <RadixDialog.Description data-spark-component=\"dialog-description\" {...props} />\n)\n\nDescription.displayName = 'Dialog.Description'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface FooterProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Footer = ({ children, className, ref, ...rest }: FooterProps): ReactElement => (\n <footer\n data-spark-component=\"dialog-footer\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </footer>\n)\n\nFooter.displayName = 'Dialog.Footer'\n","import { cx } from 'class-variance-authority'\nimport { type ReactElement, type ReactNode, Ref } from 'react'\n\nexport interface HeaderProps {\n children: ReactNode\n className?: string\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Header = ({ children, className, ref, ...rest }: HeaderProps): ReactElement => (\n <header\n data-spark-component=\"dialog-header\"\n ref={ref}\n className={cx(className, ['px-xl', 'py-lg'])}\n {...rest}\n >\n {children}\n </header>\n)\n\nHeader.displayName = 'Dialog.Header'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, Ref } from 'react'\n\nimport { useDialog } from './DialogContext'\n\nexport type OverlayProps = RadixDialog.DialogOverlayProps & {\n ref?: Ref<HTMLDivElement>\n}\n\nexport const Overlay = ({ className, ref, ...rest }: OverlayProps): ReactElement | null => {\n const { isFullScreen } = useDialog()\n\n return (\n <RadixDialog.Overlay\n data-spark-component=\"dialog-overlay\"\n ref={ref}\n className={cx(\n isFullScreen ? 'hidden' : 'fixed',\n ['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}\n\nOverlay.displayName = 'Dialog.Overlay'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement } from 'react'\n\nexport type PortalProps = RadixDialog.DialogPortalProps\n\nexport const Portal = ({ children, ...rest }: PortalProps): ReactElement => (\n <RadixDialog.Portal {...rest}>{children}</RadixDialog.Portal>\n)\n\nPortal.displayName = 'Dialog.Portal'\n","import { cx } from 'class-variance-authority'\nimport { Dialog as RadixDialog } from 'radix-ui'\nimport { Ref } from 'react'\n\nexport type TitleProps = RadixDialog.DialogTitleProps & {\n ref?: Ref<HTMLHeadingElement>\n}\n\nexport const Title = ({ className, ref, ...others }: TitleProps) => {\n return (\n <RadixDialog.Title\n data-spark-component=\"dialog-title\"\n ref={ref}\n className={cx(\n 'text-headline-1 text-on-surface',\n 'group-has-data-[part=close]:pr-3xl',\n className\n )}\n {...others}\n />\n )\n}\n\nTitle.displayName = 'Dialog.Title'\n","import { Dialog as RadixDialog } from 'radix-ui'\nimport { type ReactElement, ReactNode, Ref } from 'react'\n\nexport interface TriggerProps {\n /**\n * Children of the component.\n */\n children?: ReactNode\n /**\n * Change the component to the HTML tag or custom component of the only child.\n */\n asChild?: RadixDialog.DialogTriggerProps['asChild']\n ref?: Ref<HTMLButtonElement>\n}\n\nexport const Trigger = (props: TriggerProps): ReactElement => (\n <RadixDialog.Trigger data-spark-component=\"dialog-trigger\" {...props} />\n)\n\nTrigger.displayName = 'Dialog.Trigger'\n","import { Dialog as Root } from './Dialog'\nimport { Body } from './DialogBody'\nimport { Close } from './DialogClose'\nimport { CloseButton } from './DialogCloseButton'\nimport { Content } from './DialogContent'\nimport { Description } from './DialogDescription' // aria-describedby\nimport { Footer } from './DialogFooter'\nimport { Header } from './DialogHeader'\nimport { Overlay } from './DialogOverlay'\nimport { Portal } from './DialogPortal'\nimport { Title } from './DialogTitle' // aria-labelledby\nimport { Trigger } from './DialogTrigger'\n\nexport const Dialog: typeof Root & {\n Trigger: typeof Trigger\n Portal: typeof Portal\n Overlay: typeof Overlay\n Content: typeof Content\n Header: typeof Header\n Body: typeof Body\n Footer: typeof Footer\n Close: typeof Close\n CloseButton: typeof CloseButton\n Title: typeof Title\n Description: typeof Description\n} = Object.assign(Root, {\n Trigger,\n Portal,\n Overlay,\n Content,\n Header,\n Body,\n Footer,\n Close,\n CloseButton,\n Title,\n Description,\n})\n\nDialog.displayName = 'Dialog'\nDialog.Trigger.displayName = 'Dialog.Trigger'\nTrigger.displayName = 'Dialog.Trigger'\nPortal.displayName = 'Dialog.Portal'\nOverlay.displayName = 'Dialog.Overlay'\nContent.displayName = 'Dialog.Content'\nHeader.displayName = 'Dialog.Header'\nBody.displayName = 'Dialog.Body'\nFooter.displayName = 'Dialog.Footer'\nCloseButton.displayName = 'Dialog.CloseButton'\nTitle.displayName = 'Dialog.Title'\nDescription.displayName = 'Dialog.Description'\n\nexport { type DialogProps } from './Dialog'\nexport { type ContentProps as DialogContentProps } from './DialogContent'\nexport { type HeaderProps as DialogHeaderProps } from './DialogHeader'\nexport { type BodyProps as DialogBodyProps } from './DialogBody'\nexport { type FooterProps as DialogFooterProps } from './DialogFooter'\nexport { type TriggerProps as DialogTriggerProps } from './DialogTrigger'\nexport { type OverlayProps as DialogOverlayProps } from './DialogOverlay'\nexport { type PortalProps as DialogPortalProps } from './DialogPortal'\nexport { type TitleProps as DialogTitleProps } from './DialogTitle'\nexport { type DescriptionProps as DialogDescriptionProps } from './DialogDescription'\nexport { type CloseProps as DialogCloseProps } from './DialogClose'\nexport { type CloseButtonProps as DialogCloseButtonProps } from './DialogCloseButton'\n"],"mappings":";;;;;;;;AAAA,SAAS,UAAU,mBAAmB;AACtC,SAA4B,WAAW,cAAc;;;ACDrD,SAAS,eAA+B,YAAY,gBAAgB;AAoBhE;AAZJ,IAAM,gBAAgB,cAAyC,IAAI;AAE5D,IAAM,iBAAiB,CAAC;AAAA,EAC7B,UAAU;AAAA,EACV,WAAW;AACb,MAGM;AACJ,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,KAAK;AAEtD,SACE;AAAA,IAAC,cAAc;AAAA,IAAd;AAAA,MACC,OAAO;AAAA,QACL;AAAA,QACA;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,YAAY,cAAc;AAC1B,MAAM,cAAc;AACpB,YAAY,cAAc;","names":["jsx","useRef","jsx","useRef","RadixDialog","jsx","cx","jsx","cx","RadixDialog","useEffect","jsx","useEffect","RadixDialog","RadixDialog","jsx","cx","jsx","cx","jsx","cx","RadixDialog","jsx","RadixDialog","cx","RadixDialog","jsx","cx","RadixDialog","jsx","RadixDialog","jsx","Dialog"]}
|
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]);
|