@spark-ui/components 12.2.0 → 13.0.1
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/dist/alert-dialog/index.d.mts +78 -38
- package/dist/alert-dialog/index.d.ts +78 -38
- package/dist/alert-dialog/index.js +187 -1341
- package/dist/alert-dialog/index.js.map +1 -1
- package/dist/alert-dialog/index.mjs +234 -89
- package/dist/alert-dialog/index.mjs.map +1 -1
- package/dist/chunk-XZ47F6TP.mjs +50 -0
- package/dist/chunk-XZ47F6TP.mjs.map +1 -0
- package/dist/dialog/index.d.mts +140 -7
- package/dist/dialog/index.d.ts +140 -7
- package/dist/dialog/index.mjs +308 -5
- package/dist/dialog/index.mjs.map +1 -1
- package/dist/docgen.json +1017 -888
- package/dist/spinner/index.d.mts +1 -1
- package/dist/spinner/index.d.ts +1 -1
- package/package.json +5 -5
- package/dist/DialogTrigger-woU7vsJi.d.mts +0 -142
- package/dist/DialogTrigger-woU7vsJi.d.ts +0 -142
- package/dist/chunk-WLI4EPS6.mjs +0 -358
- package/dist/chunk-WLI4EPS6.mjs.map +0 -1
package/dist/dialog/index.d.mts
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Dialog as Dialog$2 } from 'radix-ui';
|
|
2
|
+
import { ReactElement, ReactNode, Ref } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { IconButtonProps } from '../icon-button/index.mjs';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import 'class-variance-authority/types';
|
|
8
|
-
import 'class-variance-authority';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
9
7
|
import '../button/index.mjs';
|
|
10
8
|
|
|
9
|
+
interface DialogProps {
|
|
10
|
+
/**
|
|
11
|
+
* Children of the component.
|
|
12
|
+
*/
|
|
13
|
+
children?: Dialog$2.DialogProps['children'];
|
|
14
|
+
/**
|
|
15
|
+
* Specifies if the dialog is open or not.
|
|
16
|
+
*/
|
|
17
|
+
open?: Dialog$2.DialogProps['open'];
|
|
18
|
+
/**
|
|
19
|
+
* Default open state.
|
|
20
|
+
*/
|
|
21
|
+
defaultOpen?: Dialog$2.DialogProps['defaultOpen'];
|
|
22
|
+
/**
|
|
23
|
+
* Handler executen on every dialog open state change.
|
|
24
|
+
*/
|
|
25
|
+
onOpenChange?: Dialog$2.DialogProps['onOpenChange'];
|
|
26
|
+
/**
|
|
27
|
+
* Specifies if the dialog is a modal.
|
|
28
|
+
*/
|
|
29
|
+
modal?: Dialog$2.DialogProps['modal'];
|
|
30
|
+
/**
|
|
31
|
+
* Specifies if the dialog should have a fade animation on its body (in case it is scrollable).
|
|
32
|
+
*/
|
|
33
|
+
withFade?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare const Dialog$1: {
|
|
36
|
+
({ children, withFade, ...rest }: DialogProps): ReactElement;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
interface BodyProps {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
className?: string;
|
|
43
|
+
tabIndex?: number;
|
|
44
|
+
ref?: Ref<HTMLDivElement>;
|
|
45
|
+
inset?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare const Body: {
|
|
48
|
+
({ children, className, inset, ref: forwardedRef, ...rest }: BodyProps): ReactElement;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type CloseProps = Dialog$2.DialogCloseProps & {
|
|
53
|
+
ref?: Ref<HTMLButtonElement>;
|
|
54
|
+
};
|
|
55
|
+
declare const Close: {
|
|
56
|
+
(props: CloseProps): react_jsx_runtime.JSX.Element;
|
|
57
|
+
displayName: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
11
60
|
type CloseButtonProps = CloseProps & Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>;
|
|
12
61
|
declare const CloseButton: {
|
|
13
62
|
({ "aria-label": ariaLabel, className, size, intent, design, children, ref, ...rest }: CloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
@@ -16,6 +65,90 @@ declare const CloseButton: {
|
|
|
16
65
|
id: string;
|
|
17
66
|
};
|
|
18
67
|
|
|
68
|
+
declare const dialogContentStyles: (props?: ({
|
|
69
|
+
size?: "fullscreen" | "sm" | "md" | "lg" | null | undefined;
|
|
70
|
+
isNarrow?: boolean | null | undefined;
|
|
71
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
72
|
+
type DialogContentStylesProps = VariantProps<typeof dialogContentStyles>;
|
|
73
|
+
|
|
74
|
+
interface ContentProps extends Dialog$2.DialogContentProps, DialogContentStylesProps {
|
|
75
|
+
/**
|
|
76
|
+
* When set to true, the content will adjust its width to fit the content rather than taking up the full available width.
|
|
77
|
+
*/
|
|
78
|
+
isNarrow?: boolean;
|
|
79
|
+
ref?: Ref<HTMLDivElement>;
|
|
80
|
+
}
|
|
81
|
+
declare const Content: {
|
|
82
|
+
({ children, className, isNarrow, size, onInteractOutside, ref, ...rest }: ContentProps): ReactElement;
|
|
83
|
+
displayName: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type DescriptionProps = Dialog$2.DialogDescriptionProps & {
|
|
87
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
88
|
+
};
|
|
89
|
+
declare const Description: {
|
|
90
|
+
(props: DescriptionProps): react_jsx_runtime.JSX.Element;
|
|
91
|
+
displayName: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
interface FooterProps {
|
|
95
|
+
children: ReactNode;
|
|
96
|
+
className?: string;
|
|
97
|
+
ref?: Ref<HTMLDivElement>;
|
|
98
|
+
}
|
|
99
|
+
declare const Footer: {
|
|
100
|
+
({ children, className, ref, ...rest }: FooterProps): ReactElement;
|
|
101
|
+
displayName: string;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
interface HeaderProps {
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
className?: string;
|
|
107
|
+
ref?: Ref<HTMLDivElement>;
|
|
108
|
+
}
|
|
109
|
+
declare const Header: {
|
|
110
|
+
({ children, className, ref, ...rest }: HeaderProps): ReactElement;
|
|
111
|
+
displayName: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
type OverlayProps = Dialog$2.DialogOverlayProps & {
|
|
115
|
+
ref?: Ref<HTMLDivElement>;
|
|
116
|
+
};
|
|
117
|
+
declare const Overlay: {
|
|
118
|
+
({ className, ref, ...rest }: OverlayProps): ReactElement | null;
|
|
119
|
+
displayName: string;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
type PortalProps = Dialog$2.DialogPortalProps;
|
|
123
|
+
declare const Portal: {
|
|
124
|
+
({ children, ...rest }: PortalProps): ReactElement;
|
|
125
|
+
displayName: string;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
type TitleProps = Dialog$2.DialogTitleProps & {
|
|
129
|
+
ref?: Ref<HTMLHeadingElement>;
|
|
130
|
+
};
|
|
131
|
+
declare const Title: {
|
|
132
|
+
({ className, ref, ...others }: TitleProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
displayName: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
interface TriggerProps {
|
|
137
|
+
/**
|
|
138
|
+
* Children of the component.
|
|
139
|
+
*/
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
143
|
+
*/
|
|
144
|
+
asChild?: Dialog$2.DialogTriggerProps['asChild'];
|
|
145
|
+
ref?: Ref<HTMLButtonElement>;
|
|
146
|
+
}
|
|
147
|
+
declare const Trigger: {
|
|
148
|
+
(props: TriggerProps): ReactElement;
|
|
149
|
+
displayName: string;
|
|
150
|
+
};
|
|
151
|
+
|
|
19
152
|
declare const Dialog: typeof Dialog$1 & {
|
|
20
153
|
Trigger: typeof Trigger;
|
|
21
154
|
Portal: typeof Portal;
|
|
@@ -30,4 +163,4 @@ declare const Dialog: typeof Dialog$1 & {
|
|
|
30
163
|
Description: typeof Description;
|
|
31
164
|
};
|
|
32
165
|
|
|
33
|
-
export { Dialog, type CloseButtonProps as DialogCloseButtonProps, CloseProps as DialogCloseProps };
|
|
166
|
+
export { Dialog, type BodyProps as DialogBodyProps, type CloseButtonProps as DialogCloseButtonProps, type CloseProps as DialogCloseProps, type ContentProps as DialogContentProps, type DescriptionProps as DialogDescriptionProps, type FooterProps as DialogFooterProps, type HeaderProps as DialogHeaderProps, type OverlayProps as DialogOverlayProps, type PortalProps as DialogPortalProps, type DialogProps, type TitleProps as DialogTitleProps, type TriggerProps as DialogTriggerProps };
|
package/dist/dialog/index.d.ts
CHANGED
|
@@ -1,13 +1,62 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { Dialog as Dialog$2 } from 'radix-ui';
|
|
2
|
+
import { ReactElement, ReactNode, Ref } from 'react';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { IconButtonProps } from '../icon-button/index.js';
|
|
5
|
-
import '
|
|
6
|
-
import '
|
|
7
|
-
import 'class-variance-authority/types';
|
|
8
|
-
import 'class-variance-authority';
|
|
5
|
+
import * as class_variance_authority_types from 'class-variance-authority/types';
|
|
6
|
+
import { VariantProps } from 'class-variance-authority';
|
|
9
7
|
import '../button/index.js';
|
|
10
8
|
|
|
9
|
+
interface DialogProps {
|
|
10
|
+
/**
|
|
11
|
+
* Children of the component.
|
|
12
|
+
*/
|
|
13
|
+
children?: Dialog$2.DialogProps['children'];
|
|
14
|
+
/**
|
|
15
|
+
* Specifies if the dialog is open or not.
|
|
16
|
+
*/
|
|
17
|
+
open?: Dialog$2.DialogProps['open'];
|
|
18
|
+
/**
|
|
19
|
+
* Default open state.
|
|
20
|
+
*/
|
|
21
|
+
defaultOpen?: Dialog$2.DialogProps['defaultOpen'];
|
|
22
|
+
/**
|
|
23
|
+
* Handler executen on every dialog open state change.
|
|
24
|
+
*/
|
|
25
|
+
onOpenChange?: Dialog$2.DialogProps['onOpenChange'];
|
|
26
|
+
/**
|
|
27
|
+
* Specifies if the dialog is a modal.
|
|
28
|
+
*/
|
|
29
|
+
modal?: Dialog$2.DialogProps['modal'];
|
|
30
|
+
/**
|
|
31
|
+
* Specifies if the dialog should have a fade animation on its body (in case it is scrollable).
|
|
32
|
+
*/
|
|
33
|
+
withFade?: boolean;
|
|
34
|
+
}
|
|
35
|
+
declare const Dialog$1: {
|
|
36
|
+
({ children, withFade, ...rest }: DialogProps): ReactElement;
|
|
37
|
+
displayName: string;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
interface BodyProps {
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
className?: string;
|
|
43
|
+
tabIndex?: number;
|
|
44
|
+
ref?: Ref<HTMLDivElement>;
|
|
45
|
+
inset?: boolean;
|
|
46
|
+
}
|
|
47
|
+
declare const Body: {
|
|
48
|
+
({ children, className, inset, ref: forwardedRef, ...rest }: BodyProps): ReactElement;
|
|
49
|
+
displayName: string;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type CloseProps = Dialog$2.DialogCloseProps & {
|
|
53
|
+
ref?: Ref<HTMLButtonElement>;
|
|
54
|
+
};
|
|
55
|
+
declare const Close: {
|
|
56
|
+
(props: CloseProps): react_jsx_runtime.JSX.Element;
|
|
57
|
+
displayName: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
11
60
|
type CloseButtonProps = CloseProps & Pick<IconButtonProps, 'size' | 'intent' | 'design' | 'aria-label'>;
|
|
12
61
|
declare const CloseButton: {
|
|
13
62
|
({ "aria-label": ariaLabel, className, size, intent, design, children, ref, ...rest }: CloseButtonProps): react_jsx_runtime.JSX.Element;
|
|
@@ -16,6 +65,90 @@ declare const CloseButton: {
|
|
|
16
65
|
id: string;
|
|
17
66
|
};
|
|
18
67
|
|
|
68
|
+
declare const dialogContentStyles: (props?: ({
|
|
69
|
+
size?: "fullscreen" | "sm" | "md" | "lg" | null | undefined;
|
|
70
|
+
isNarrow?: boolean | null | undefined;
|
|
71
|
+
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
72
|
+
type DialogContentStylesProps = VariantProps<typeof dialogContentStyles>;
|
|
73
|
+
|
|
74
|
+
interface ContentProps extends Dialog$2.DialogContentProps, DialogContentStylesProps {
|
|
75
|
+
/**
|
|
76
|
+
* When set to true, the content will adjust its width to fit the content rather than taking up the full available width.
|
|
77
|
+
*/
|
|
78
|
+
isNarrow?: boolean;
|
|
79
|
+
ref?: Ref<HTMLDivElement>;
|
|
80
|
+
}
|
|
81
|
+
declare const Content: {
|
|
82
|
+
({ children, className, isNarrow, size, onInteractOutside, ref, ...rest }: ContentProps): ReactElement;
|
|
83
|
+
displayName: string;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
type DescriptionProps = Dialog$2.DialogDescriptionProps & {
|
|
87
|
+
ref?: Ref<HTMLParagraphElement>;
|
|
88
|
+
};
|
|
89
|
+
declare const Description: {
|
|
90
|
+
(props: DescriptionProps): react_jsx_runtime.JSX.Element;
|
|
91
|
+
displayName: string;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
interface FooterProps {
|
|
95
|
+
children: ReactNode;
|
|
96
|
+
className?: string;
|
|
97
|
+
ref?: Ref<HTMLDivElement>;
|
|
98
|
+
}
|
|
99
|
+
declare const Footer: {
|
|
100
|
+
({ children, className, ref, ...rest }: FooterProps): ReactElement;
|
|
101
|
+
displayName: string;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
interface HeaderProps {
|
|
105
|
+
children: ReactNode;
|
|
106
|
+
className?: string;
|
|
107
|
+
ref?: Ref<HTMLDivElement>;
|
|
108
|
+
}
|
|
109
|
+
declare const Header: {
|
|
110
|
+
({ children, className, ref, ...rest }: HeaderProps): ReactElement;
|
|
111
|
+
displayName: string;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
type OverlayProps = Dialog$2.DialogOverlayProps & {
|
|
115
|
+
ref?: Ref<HTMLDivElement>;
|
|
116
|
+
};
|
|
117
|
+
declare const Overlay: {
|
|
118
|
+
({ className, ref, ...rest }: OverlayProps): ReactElement | null;
|
|
119
|
+
displayName: string;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
type PortalProps = Dialog$2.DialogPortalProps;
|
|
123
|
+
declare const Portal: {
|
|
124
|
+
({ children, ...rest }: PortalProps): ReactElement;
|
|
125
|
+
displayName: string;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
type TitleProps = Dialog$2.DialogTitleProps & {
|
|
129
|
+
ref?: Ref<HTMLHeadingElement>;
|
|
130
|
+
};
|
|
131
|
+
declare const Title: {
|
|
132
|
+
({ className, ref, ...others }: TitleProps): react_jsx_runtime.JSX.Element;
|
|
133
|
+
displayName: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
interface TriggerProps {
|
|
137
|
+
/**
|
|
138
|
+
* Children of the component.
|
|
139
|
+
*/
|
|
140
|
+
children?: ReactNode;
|
|
141
|
+
/**
|
|
142
|
+
* Change the component to the HTML tag or custom component of the only child.
|
|
143
|
+
*/
|
|
144
|
+
asChild?: Dialog$2.DialogTriggerProps['asChild'];
|
|
145
|
+
ref?: Ref<HTMLButtonElement>;
|
|
146
|
+
}
|
|
147
|
+
declare const Trigger: {
|
|
148
|
+
(props: TriggerProps): ReactElement;
|
|
149
|
+
displayName: string;
|
|
150
|
+
};
|
|
151
|
+
|
|
19
152
|
declare const Dialog: typeof Dialog$1 & {
|
|
20
153
|
Trigger: typeof Trigger;
|
|
21
154
|
Portal: typeof Portal;
|
|
@@ -30,4 +163,4 @@ declare const Dialog: typeof Dialog$1 & {
|
|
|
30
163
|
Description: typeof Description;
|
|
31
164
|
};
|
|
32
165
|
|
|
33
|
-
export { Dialog, type CloseButtonProps as DialogCloseButtonProps, CloseProps as DialogCloseProps };
|
|
166
|
+
export { Dialog, type BodyProps as DialogBodyProps, type CloseButtonProps as DialogCloseButtonProps, type CloseProps as DialogCloseProps, type ContentProps as DialogContentProps, type DescriptionProps as DialogDescriptionProps, type FooterProps as DialogFooterProps, type HeaderProps as DialogHeaderProps, type OverlayProps as DialogOverlayProps, type PortalProps as DialogPortalProps, type DialogProps, type TitleProps as DialogTitleProps, type TriggerProps as DialogTriggerProps };
|
package/dist/dialog/index.mjs
CHANGED
|
@@ -1,13 +1,316 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import
|
|
5
|
-
|
|
2
|
+
dialogContentStyles
|
|
3
|
+
} from "../chunk-XZ47F6TP.mjs";
|
|
4
|
+
import {
|
|
5
|
+
IconButton
|
|
6
|
+
} from "../chunk-DCXWGQVZ.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Icon
|
|
9
|
+
} from "../chunk-UMUMFMFB.mjs";
|
|
6
10
|
import "../chunk-2YM6GKWW.mjs";
|
|
7
11
|
import "../chunk-GAK4SC2F.mjs";
|
|
8
12
|
import "../chunk-KEGAAGJW.mjs";
|
|
9
13
|
import "../chunk-6QCEPQ3U.mjs";
|
|
14
|
+
|
|
15
|
+
// src/dialog/Dialog.tsx
|
|
16
|
+
import { Dialog as RadixDialog } from "radix-ui";
|
|
17
|
+
import { useEffect, useRef } from "react";
|
|
18
|
+
|
|
19
|
+
// src/dialog/DialogContext.tsx
|
|
20
|
+
import { createContext, useContext, useState } from "react";
|
|
21
|
+
import { jsx } from "react/jsx-runtime";
|
|
22
|
+
var DialogContext = createContext(null);
|
|
23
|
+
var DialogProvider = ({
|
|
24
|
+
children: childrenProp,
|
|
25
|
+
withFade = false
|
|
26
|
+
}) => {
|
|
27
|
+
const [isFullScreen, setIsFullScreen] = useState(false);
|
|
28
|
+
return /* @__PURE__ */ jsx(
|
|
29
|
+
DialogContext.Provider,
|
|
30
|
+
{
|
|
31
|
+
value: {
|
|
32
|
+
isFullScreen,
|
|
33
|
+
setIsFullScreen,
|
|
34
|
+
withFade
|
|
35
|
+
},
|
|
36
|
+
children: childrenProp
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
};
|
|
40
|
+
var useDialog = () => {
|
|
41
|
+
const context = useContext(DialogContext);
|
|
42
|
+
if (!context) {
|
|
43
|
+
throw Error("useDialog must be used within a Dialog provider");
|
|
44
|
+
}
|
|
45
|
+
return context;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// src/dialog/Dialog.tsx
|
|
49
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
50
|
+
var Dialog = ({ children, withFade = false, ...rest }) => {
|
|
51
|
+
const open = rest.open;
|
|
52
|
+
const activeElementRef = useRef(null);
|
|
53
|
+
function handleActiveElementFocus() {
|
|
54
|
+
if (open && document.activeElement) {
|
|
55
|
+
activeElementRef.current = document.activeElement;
|
|
56
|
+
}
|
|
57
|
+
if (!open) {
|
|
58
|
+
setTimeout(() => {
|
|
59
|
+
if (!(activeElementRef.current instanceof HTMLElement)) return;
|
|
60
|
+
activeElementRef.current.focus();
|
|
61
|
+
}, 0);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
useEffect(handleActiveElementFocus, [open]);
|
|
65
|
+
return /* @__PURE__ */ jsx2(DialogProvider, { withFade, children: /* @__PURE__ */ jsx2(RadixDialog.Root, { ...rest, children }) });
|
|
66
|
+
};
|
|
67
|
+
Dialog.displayName = "Dialog.Root";
|
|
68
|
+
|
|
69
|
+
// src/dialog/DialogBody.tsx
|
|
70
|
+
import { useMergeRefs } from "@spark-ui/hooks/use-merge-refs";
|
|
71
|
+
import { useScrollOverflow } from "@spark-ui/hooks/use-scroll-overflow";
|
|
72
|
+
import { cx } from "class-variance-authority";
|
|
73
|
+
import { useRef as useRef2 } from "react";
|
|
74
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
75
|
+
var Body = ({
|
|
76
|
+
children,
|
|
77
|
+
className,
|
|
78
|
+
inset = false,
|
|
79
|
+
ref: forwardedRef,
|
|
80
|
+
...rest
|
|
81
|
+
}) => {
|
|
82
|
+
const scrollAreaRef = useRef2(null);
|
|
83
|
+
const ref = useMergeRefs(forwardedRef, scrollAreaRef);
|
|
84
|
+
const { withFade } = useDialog();
|
|
85
|
+
const { overflow } = useScrollOverflow(scrollAreaRef);
|
|
86
|
+
return /* @__PURE__ */ jsx3(
|
|
87
|
+
"div",
|
|
88
|
+
{
|
|
89
|
+
"data-spark-component": "dialog-body",
|
|
90
|
+
ref,
|
|
91
|
+
className: cx(
|
|
92
|
+
"focus-visible:u-outline relative grow overflow-y-auto outline-hidden",
|
|
93
|
+
"transition-all duration-300",
|
|
94
|
+
{
|
|
95
|
+
["px-xl py-lg"]: !inset
|
|
96
|
+
},
|
|
97
|
+
className
|
|
98
|
+
),
|
|
99
|
+
style: {
|
|
100
|
+
...withFade && {
|
|
101
|
+
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))",
|
|
102
|
+
maskSize: `100% calc(100% + ${overflow.top ? "0px" : "44px"} + ${overflow.bottom ? "0px" : "44px"})`,
|
|
103
|
+
maskPosition: `0 ${overflow.top ? "0px" : "-44px"}`
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
...rest,
|
|
107
|
+
children
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
Body.displayName = "Dialog.Body";
|
|
112
|
+
|
|
113
|
+
// src/dialog/DialogClose.tsx
|
|
114
|
+
import { Dialog as RadixDialog2 } from "radix-ui";
|
|
115
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
116
|
+
var Close = (props) => /* @__PURE__ */ jsx4(RadixDialog2.Close, { ...props });
|
|
117
|
+
Close.displayName = "Dialog.Close";
|
|
118
|
+
|
|
119
|
+
// src/dialog/DialogCloseButton.tsx
|
|
120
|
+
import { Close as CloseSVG } from "@spark-ui/icons/Close";
|
|
121
|
+
import { cx as cx2 } from "class-variance-authority";
|
|
122
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
123
|
+
var Root = ({
|
|
124
|
+
"aria-label": ariaLabel,
|
|
125
|
+
className,
|
|
126
|
+
size = "md",
|
|
127
|
+
intent = "neutral",
|
|
128
|
+
design = "ghost",
|
|
129
|
+
children = /* @__PURE__ */ jsx5(CloseSVG, {}),
|
|
130
|
+
ref,
|
|
131
|
+
...rest
|
|
132
|
+
}) => {
|
|
133
|
+
return /* @__PURE__ */ jsx5(
|
|
134
|
+
Close,
|
|
135
|
+
{
|
|
136
|
+
"data-spark-component": "dialog-close-button",
|
|
137
|
+
"data-part": "close",
|
|
138
|
+
ref,
|
|
139
|
+
className: cx2(["absolute", "top-md", "right-xl"], className),
|
|
140
|
+
asChild: true,
|
|
141
|
+
...rest,
|
|
142
|
+
children: /* @__PURE__ */ jsx5(IconButton, { intent, size, design, "aria-label": ariaLabel, children: /* @__PURE__ */ jsx5(Icon, { children }) })
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
var CloseButton = Object.assign(Root, {
|
|
147
|
+
id: "CloseButton"
|
|
148
|
+
});
|
|
149
|
+
Root.displayName = "Dialog.CloseButton";
|
|
150
|
+
|
|
151
|
+
// src/dialog/DialogContent.tsx
|
|
152
|
+
import { Dialog as RadixDialog3 } from "radix-ui";
|
|
153
|
+
import { useEffect as useEffect2 } from "react";
|
|
154
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
155
|
+
var Content = ({
|
|
156
|
+
children,
|
|
157
|
+
className,
|
|
158
|
+
isNarrow = false,
|
|
159
|
+
size = "md",
|
|
160
|
+
onInteractOutside,
|
|
161
|
+
ref,
|
|
162
|
+
...rest
|
|
163
|
+
}) => {
|
|
164
|
+
const { setIsFullScreen } = useDialog();
|
|
165
|
+
useEffect2(() => {
|
|
166
|
+
if (size === "fullscreen") setIsFullScreen(true);
|
|
167
|
+
return () => setIsFullScreen(false);
|
|
168
|
+
}, [setIsFullScreen, size]);
|
|
169
|
+
return /* @__PURE__ */ jsx6(
|
|
170
|
+
RadixDialog3.Content,
|
|
171
|
+
{
|
|
172
|
+
"data-spark-component": "dialog-content",
|
|
173
|
+
ref,
|
|
174
|
+
className: dialogContentStyles({
|
|
175
|
+
className,
|
|
176
|
+
isNarrow,
|
|
177
|
+
size
|
|
178
|
+
}),
|
|
179
|
+
onInteractOutside: (e) => {
|
|
180
|
+
const isForegroundElement = e.target.closest(".z-toast, .z-popover");
|
|
181
|
+
if (isForegroundElement) {
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
}
|
|
184
|
+
onInteractOutside?.(e);
|
|
185
|
+
},
|
|
186
|
+
...rest,
|
|
187
|
+
children
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
Content.displayName = "Dialog.Content";
|
|
192
|
+
|
|
193
|
+
// src/dialog/DialogDescription.tsx
|
|
194
|
+
import { Dialog as RadixDialog4 } from "radix-ui";
|
|
195
|
+
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
196
|
+
var Description = (props) => /* @__PURE__ */ jsx7(RadixDialog4.Description, { "data-spark-component": "dialog-description", ...props });
|
|
197
|
+
Description.displayName = "Dialog.Description";
|
|
198
|
+
|
|
199
|
+
// src/dialog/DialogFooter.tsx
|
|
200
|
+
import { cx as cx3 } from "class-variance-authority";
|
|
201
|
+
import { jsx as jsx8 } from "react/jsx-runtime";
|
|
202
|
+
var Footer = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx8(
|
|
203
|
+
"footer",
|
|
204
|
+
{
|
|
205
|
+
"data-spark-component": "dialog-footer",
|
|
206
|
+
ref,
|
|
207
|
+
className: cx3(className, ["px-xl", "py-lg"]),
|
|
208
|
+
...rest,
|
|
209
|
+
children
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
Footer.displayName = "Dialog.Footer";
|
|
213
|
+
|
|
214
|
+
// src/dialog/DialogHeader.tsx
|
|
215
|
+
import { cx as cx4 } from "class-variance-authority";
|
|
216
|
+
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
217
|
+
var Header = ({ children, className, ref, ...rest }) => /* @__PURE__ */ jsx9(
|
|
218
|
+
"header",
|
|
219
|
+
{
|
|
220
|
+
"data-spark-component": "dialog-header",
|
|
221
|
+
ref,
|
|
222
|
+
className: cx4(className, ["px-xl", "py-lg"]),
|
|
223
|
+
...rest,
|
|
224
|
+
children
|
|
225
|
+
}
|
|
226
|
+
);
|
|
227
|
+
Header.displayName = "Dialog.Header";
|
|
228
|
+
|
|
229
|
+
// src/dialog/DialogOverlay.tsx
|
|
230
|
+
import { cx as cx5 } from "class-variance-authority";
|
|
231
|
+
import { Dialog as RadixDialog5 } from "radix-ui";
|
|
232
|
+
import { jsx as jsx10 } from "react/jsx-runtime";
|
|
233
|
+
var Overlay = ({ className, ref, ...rest }) => {
|
|
234
|
+
const { isFullScreen } = useDialog();
|
|
235
|
+
return /* @__PURE__ */ jsx10(
|
|
236
|
+
RadixDialog5.Overlay,
|
|
237
|
+
{
|
|
238
|
+
"data-spark-component": "dialog-overlay",
|
|
239
|
+
ref,
|
|
240
|
+
className: cx5(
|
|
241
|
+
isFullScreen ? "hidden" : "fixed",
|
|
242
|
+
["top-0", "left-0", "w-screen", "h-screen", "z-overlay"],
|
|
243
|
+
["bg-overlay/dim-1"],
|
|
244
|
+
["data-[state=open]:animate-fade-in"],
|
|
245
|
+
["data-[state=closed]:animate-fade-out"],
|
|
246
|
+
className
|
|
247
|
+
),
|
|
248
|
+
...rest
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
};
|
|
252
|
+
Overlay.displayName = "Dialog.Overlay";
|
|
253
|
+
|
|
254
|
+
// src/dialog/DialogPortal.tsx
|
|
255
|
+
import { Dialog as RadixDialog6 } from "radix-ui";
|
|
256
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
257
|
+
var Portal = ({ children, ...rest }) => /* @__PURE__ */ jsx11(RadixDialog6.Portal, { ...rest, children });
|
|
258
|
+
Portal.displayName = "Dialog.Portal";
|
|
259
|
+
|
|
260
|
+
// src/dialog/DialogTitle.tsx
|
|
261
|
+
import { cx as cx6 } from "class-variance-authority";
|
|
262
|
+
import { Dialog as RadixDialog7 } from "radix-ui";
|
|
263
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
264
|
+
var Title = ({ className, ref, ...others }) => {
|
|
265
|
+
return /* @__PURE__ */ jsx12(
|
|
266
|
+
RadixDialog7.Title,
|
|
267
|
+
{
|
|
268
|
+
"data-spark-component": "dialog-title",
|
|
269
|
+
ref,
|
|
270
|
+
className: cx6(
|
|
271
|
+
"text-headline-1 text-on-surface",
|
|
272
|
+
"group-has-data-[part=close]:pr-3xl",
|
|
273
|
+
className
|
|
274
|
+
),
|
|
275
|
+
...others
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
};
|
|
279
|
+
Title.displayName = "Dialog.Title";
|
|
280
|
+
|
|
281
|
+
// src/dialog/DialogTrigger.tsx
|
|
282
|
+
import { Dialog as RadixDialog8 } from "radix-ui";
|
|
283
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
284
|
+
var Trigger = (props) => /* @__PURE__ */ jsx13(RadixDialog8.Trigger, { "data-spark-component": "dialog-trigger", ...props });
|
|
285
|
+
Trigger.displayName = "Dialog.Trigger";
|
|
286
|
+
|
|
287
|
+
// src/dialog/index.ts
|
|
288
|
+
var Dialog2 = Object.assign(Dialog, {
|
|
289
|
+
Trigger,
|
|
290
|
+
Portal,
|
|
291
|
+
Overlay,
|
|
292
|
+
Content,
|
|
293
|
+
Header,
|
|
294
|
+
Body,
|
|
295
|
+
Footer,
|
|
296
|
+
Close,
|
|
297
|
+
CloseButton,
|
|
298
|
+
Title,
|
|
299
|
+
Description
|
|
300
|
+
});
|
|
301
|
+
Dialog2.displayName = "Dialog";
|
|
302
|
+
Dialog2.Trigger.displayName = "Dialog.Trigger";
|
|
303
|
+
Trigger.displayName = "Dialog.Trigger";
|
|
304
|
+
Portal.displayName = "Dialog.Portal";
|
|
305
|
+
Overlay.displayName = "Dialog.Overlay";
|
|
306
|
+
Content.displayName = "Dialog.Content";
|
|
307
|
+
Header.displayName = "Dialog.Header";
|
|
308
|
+
Body.displayName = "Dialog.Body";
|
|
309
|
+
Footer.displayName = "Dialog.Footer";
|
|
310
|
+
CloseButton.displayName = "Dialog.CloseButton";
|
|
311
|
+
Title.displayName = "Dialog.Title";
|
|
312
|
+
Description.displayName = "Dialog.Description";
|
|
10
313
|
export {
|
|
11
|
-
Dialog
|
|
314
|
+
Dialog2 as Dialog
|
|
12
315
|
};
|
|
13
316
|
//# sourceMappingURL=index.mjs.map
|