@frontify/fondue-components 22.2.0 → 23.0.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/dist/fondue-components10.js +27 -24
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components11.js +2 -2
- package/dist/fondue-components12.js +2 -2
- package/dist/fondue-components13.js +63 -59
- package/dist/fondue-components13.js.map +1 -1
- package/dist/fondue-components14.js +2 -2
- package/dist/fondue-components15.js +2 -2
- package/dist/fondue-components16.js +2 -2
- package/dist/fondue-components17.js +1 -1
- package/dist/fondue-components18.js +1 -1
- package/dist/fondue-components19.js +1 -1
- package/dist/fondue-components20.js +2 -2
- package/dist/fondue-components21.js +2 -2
- package/dist/fondue-components22.js +6 -6
- package/dist/fondue-components23.js +1 -1
- package/dist/fondue-components24.js +29 -25
- package/dist/fondue-components24.js.map +1 -1
- package/dist/fondue-components25.js +142 -119
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components26.js +1 -1
- package/dist/fondue-components27.js +3 -3
- package/dist/fondue-components28.js +2 -2
- package/dist/fondue-components29.js +2 -2
- package/dist/fondue-components30.js +1 -1
- package/dist/fondue-components31.js +28 -10
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components32.js +2 -2
- package/dist/fondue-components33.js +1 -1
- package/dist/fondue-components34.js +23 -7
- package/dist/fondue-components34.js.map +1 -1
- package/dist/fondue-components35.js +7 -6
- package/dist/fondue-components35.js.map +1 -1
- package/dist/fondue-components36.js +7 -32
- package/dist/fondue-components36.js.map +1 -1
- package/dist/fondue-components37.js +32 -5
- package/dist/fondue-components37.js.map +1 -1
- package/dist/fondue-components38.js +5 -12
- package/dist/fondue-components38.js.map +1 -1
- package/dist/fondue-components39.js +10 -153
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components4.js +35 -31
- package/dist/fondue-components4.js.map +1 -1
- package/dist/fondue-components40.js +59 -22
- package/dist/fondue-components40.js.map +1 -1
- package/dist/fondue-components41.js +17 -17
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +112 -15
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +19 -30
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +32 -53
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +48 -124
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +130 -20
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +21 -53
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +53 -8
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +8 -13
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components5.js +2 -2
- package/dist/fondue-components50.js +13 -15
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +14 -4
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +5 -60
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +59 -17
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +18 -19
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +18 -4
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +3 -13
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +13 -3
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +3 -17
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +18 -10
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +4 -4
- package/dist/fondue-components60.js +11 -35
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +35 -5
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +4 -12
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +12 -4
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +4 -24
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components65.js +24 -16
- package/dist/fondue-components65.js.map +1 -1
- package/dist/fondue-components66.js +16 -150
- package/dist/fondue-components66.js.map +1 -1
- package/dist/fondue-components67.js +152 -19
- package/dist/fondue-components67.js.map +1 -1
- package/dist/fondue-components68.js +19 -78
- package/dist/fondue-components68.js.map +1 -1
- package/dist/fondue-components69.js +78 -8
- package/dist/fondue-components69.js.map +1 -1
- package/dist/fondue-components7.js +2 -2
- package/dist/fondue-components70.js +8 -37
- package/dist/fondue-components70.js.map +1 -1
- package/dist/fondue-components71.js +36 -70
- package/dist/fondue-components71.js.map +1 -1
- package/dist/fondue-components72.js +70 -10
- package/dist/fondue-components72.js.map +1 -1
- package/dist/fondue-components73.js +10 -12
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components74.js +12 -12
- package/dist/fondue-components74.js.map +1 -1
- package/dist/fondue-components75.js +12 -22
- package/dist/fondue-components75.js.map +1 -1
- package/dist/fondue-components76.js +23 -34
- package/dist/fondue-components76.js.map +1 -1
- package/dist/fondue-components77.js +34 -11
- package/dist/fondue-components77.js.map +1 -1
- package/dist/fondue-components78.js +10 -67
- package/dist/fondue-components78.js.map +1 -1
- package/dist/fondue-components79.js +67 -14
- package/dist/fondue-components79.js.map +1 -1
- package/dist/fondue-components8.js +5 -5
- package/dist/fondue-components80.js +13 -24
- package/dist/fondue-components80.js.map +1 -1
- package/dist/fondue-components81.js +24 -17
- package/dist/fondue-components81.js.map +1 -1
- package/dist/fondue-components82.js +15 -19
- package/dist/fondue-components82.js.map +1 -1
- package/dist/fondue-components83.js +22 -6
- package/dist/fondue-components83.js.map +1 -1
- package/dist/fondue-components84.js +6 -6
- package/dist/fondue-components85.js +19 -4
- package/dist/fondue-components85.js.map +1 -1
- package/dist/fondue-components86.js +6 -4
- package/dist/fondue-components86.js.map +1 -1
- package/dist/fondue-components87.js +3 -15
- package/dist/fondue-components87.js.map +1 -1
- package/dist/fondue-components88.js +5 -2
- package/dist/fondue-components88.js.map +1 -1
- package/dist/fondue-components89.js +16 -39
- package/dist/fondue-components89.js.map +1 -1
- package/dist/fondue-components9.js +91 -87
- package/dist/fondue-components9.js.map +1 -1
- package/dist/fondue-components90.js +2 -6
- package/dist/fondue-components90.js.map +1 -1
- package/dist/fondue-components91.js +43 -0
- package/dist/fondue-components91.js.map +1 -0
- package/dist/fondue-components92.js +24 -0
- package/dist/fondue-components92.js.map +1 -0
- package/dist/index.d.ts +63 -5
- package/dist/style.css +1 -1
- package/package.json +8 -4
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e, jsxs as P } from "react/jsx-runtime";
|
|
2
2
|
import { IconCross as j } from "@frontify/fondue-icons";
|
|
3
3
|
import * as d from "@radix-ui/react-dialog";
|
|
4
4
|
import { createContext as q, forwardRef as l, useRef as B, useContext as z, useMemo as E } from "react";
|
|
5
|
-
import { useSyncRefs as L } from "./fondue-
|
|
6
|
-
import {
|
|
5
|
+
import { useSyncRefs as L } from "./fondue-components49.js";
|
|
6
|
+
import { useTranslation as _ } from "./fondue-components34.js";
|
|
7
|
+
import { addShowFocusRing as $, addAutoFocusAttribute as k } from "./fondue-components50.js";
|
|
7
8
|
import { useFondueTheme as G, ThemeProvider as I } from "./fondue-components31.js";
|
|
8
|
-
import n from "./fondue-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const r = E(() => ({ isModal:
|
|
13
|
-
return /* @__PURE__ */
|
|
9
|
+
import n from "./fondue-components51.js";
|
|
10
|
+
const p = q({ isModal: !1 });
|
|
11
|
+
p.displayName = "DialogContext";
|
|
12
|
+
const h = ({ children: t, modal: o, onOpenChange: a, open: i }) => {
|
|
13
|
+
const r = E(() => ({ isModal: o ?? !1 }), [o]);
|
|
14
|
+
return /* @__PURE__ */ e(p.Provider, { value: r, children: /* @__PURE__ */ e(d.Root, { open: i, onOpenChange: a, modal: o, children: t }) });
|
|
14
15
|
};
|
|
15
|
-
|
|
16
|
-
const
|
|
16
|
+
h.displayName = "Dialog.Root";
|
|
17
|
+
const C = ({ asChild: t = !0, children: o, "data-test-id": a = "fondue-dialog-trigger" }, i) => /* @__PURE__ */ e(
|
|
17
18
|
d.Trigger,
|
|
18
19
|
{
|
|
19
20
|
onMouseDown: k,
|
|
@@ -22,103 +23,106 @@ const h = ({ asChild: t = !0, children: e, "data-test-id": a = "fondue-dialog-tr
|
|
|
22
23
|
"data-test-id": a,
|
|
23
24
|
asChild: t,
|
|
24
25
|
ref: i,
|
|
25
|
-
children:
|
|
26
|
+
children: o
|
|
26
27
|
}
|
|
27
28
|
);
|
|
28
|
-
|
|
29
|
-
const J = ({ children: t, showUnderlay:
|
|
30
|
-
const { isModal: a } = z(
|
|
31
|
-
return a ? /* @__PURE__ */
|
|
32
|
-
},
|
|
29
|
+
C.displayName = "Dialog.Trigger";
|
|
30
|
+
const J = ({ children: t, showUnderlay: o }) => {
|
|
31
|
+
const { isModal: a } = z(p);
|
|
32
|
+
return a ? /* @__PURE__ */ e(d.Overlay, { "data-visible": o, className: n.underlay, children: t }) : /* @__PURE__ */ e("div", { className: n.underlay, "data-visible": o, children: t });
|
|
33
|
+
}, N = ({
|
|
33
34
|
maxWidth: t = "800px",
|
|
34
|
-
minWidth:
|
|
35
|
+
minWidth: o = "400px",
|
|
35
36
|
minHeight: a = "200px",
|
|
36
37
|
padding: i = "compact",
|
|
37
38
|
verticalAlign: r = "center",
|
|
38
39
|
"data-test-id": s = "fondue-dialog-content",
|
|
39
40
|
showUnderlay: c = !1,
|
|
40
|
-
rounded:
|
|
41
|
+
rounded: u = !0,
|
|
41
42
|
children: S
|
|
42
43
|
}, M) => {
|
|
43
|
-
const { theme: A, dir:
|
|
44
|
-
L(
|
|
44
|
+
const { theme: A, dir: f } = G(), g = B(null);
|
|
45
|
+
L(g, M);
|
|
45
46
|
const H = (O) => {
|
|
46
47
|
var y;
|
|
47
48
|
O.preventDefault();
|
|
48
|
-
const
|
|
49
|
+
const m = (y = g.current) == null ? void 0 : y.querySelector('[data-dialog-layout-component="body"]'), D = m == null ? void 0 : m.querySelector(
|
|
49
50
|
'button:not([data-tooltip-trigger="true"]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
50
51
|
);
|
|
51
|
-
|
|
52
|
+
D instanceof HTMLElement && D.focus();
|
|
52
53
|
};
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ e(d.Portal, { children: /* @__PURE__ */ e(I, { theme: A, dir: f, children: /* @__PURE__ */ e(J, { showUnderlay: c, children: /* @__PURE__ */ e(
|
|
54
55
|
d.Content,
|
|
55
56
|
{
|
|
56
57
|
style: {
|
|
57
58
|
"--dialog-max-width": t,
|
|
58
|
-
"--dialog-min-width":
|
|
59
|
+
"--dialog-min-width": o,
|
|
59
60
|
"--dialog-min-height": a
|
|
60
61
|
},
|
|
61
|
-
ref:
|
|
62
|
+
ref: g,
|
|
62
63
|
className: n.content,
|
|
63
64
|
onFocus: $,
|
|
64
65
|
onOpenAutoFocus: H,
|
|
65
66
|
"data-dialog-padding": i,
|
|
66
|
-
"data-dialog-rounded":
|
|
67
|
+
"data-dialog-rounded": u,
|
|
67
68
|
"data-test-id": s,
|
|
68
69
|
"data-dialog-vertical-align": r,
|
|
69
|
-
dir:
|
|
70
|
+
dir: f,
|
|
70
71
|
children: S
|
|
71
72
|
}
|
|
72
73
|
) }) }) });
|
|
73
74
|
};
|
|
74
|
-
|
|
75
|
-
const
|
|
75
|
+
N.displayName = "Dialog.Content";
|
|
76
|
+
const b = ({
|
|
76
77
|
padding: t,
|
|
77
|
-
showBorder:
|
|
78
|
+
showBorder: o = !0,
|
|
78
79
|
showCloseButton: a = !0,
|
|
79
80
|
closeProps: i,
|
|
80
81
|
children: r,
|
|
81
82
|
"data-test-id": s = "fondue-dialog-header"
|
|
82
|
-
}, c) =>
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
83
|
+
}, c) => {
|
|
84
|
+
const { t: u } = _();
|
|
85
|
+
return /* @__PURE__ */ P(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
"data-test-id": s,
|
|
89
|
+
ref: c,
|
|
90
|
+
className: n.header,
|
|
91
|
+
"data-dialog-header-padding": t,
|
|
92
|
+
"data-show-border": o,
|
|
93
|
+
"data-dialog-layout-component": "header",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ e("div", { children: r }),
|
|
96
|
+
a && /* @__PURE__ */ e(
|
|
97
|
+
d.Close,
|
|
98
|
+
{
|
|
99
|
+
role: "button",
|
|
100
|
+
"data-test-id": `${s}-close`,
|
|
101
|
+
className: "tw-cursor-pointer",
|
|
102
|
+
"aria-label": u("Dialog_close"),
|
|
103
|
+
...i,
|
|
104
|
+
children: /* @__PURE__ */ e(j, { size: 20 })
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
b.displayName = "Dialog.Header";
|
|
112
|
+
const v = ({ padding: t, showBorder: o = !0, children: a, "data-test-id": i = "fondue-dialog-footer" }, r) => /* @__PURE__ */ e(
|
|
109
113
|
"div",
|
|
110
114
|
{
|
|
111
115
|
"data-test-id": i,
|
|
112
116
|
ref: r,
|
|
113
117
|
className: n.footer,
|
|
114
118
|
"data-dialog-footer-padding": t,
|
|
115
|
-
"data-show-border":
|
|
119
|
+
"data-show-border": o,
|
|
116
120
|
"data-dialog-layout-component": "footer",
|
|
117
121
|
children: a
|
|
118
122
|
}
|
|
119
123
|
);
|
|
120
|
-
|
|
121
|
-
const
|
|
124
|
+
v.displayName = "Dialog.Footer";
|
|
125
|
+
const x = ({ padding: t, children: o, "data-test-id": a = "fondue-dialog-body" }, i) => /* @__PURE__ */ e(
|
|
122
126
|
"div",
|
|
123
127
|
{
|
|
124
128
|
"data-test-id": a,
|
|
@@ -126,41 +130,41 @@ const v = ({ padding: t, children: e, "data-test-id": a = "fondue-dialog-body" }
|
|
|
126
130
|
className: n.body,
|
|
127
131
|
"data-dialog-body-padding": t,
|
|
128
132
|
"data-dialog-layout-component": "body",
|
|
129
|
-
children:
|
|
133
|
+
children: o
|
|
130
134
|
}
|
|
131
135
|
);
|
|
132
|
-
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
const F = ({ children: t }) => /* @__PURE__ */
|
|
136
|
+
x.displayName = "Dialog.Body";
|
|
137
|
+
const T = ({ children: t, "data-test-id": o = "fondue-dialog-side-content" }, a) => /* @__PURE__ */ e("div", { "data-test-id": o, ref: a, className: n.sideContent, "data-dialog-layout-component": !0, children: t });
|
|
138
|
+
T.displayName = "Dialog.SideContent";
|
|
139
|
+
const F = ({ children: t }) => /* @__PURE__ */ e(d.Close, { asChild: !0, children: t });
|
|
136
140
|
F.displayName = "Dialog.Close";
|
|
137
|
-
const R = ({ children: t, asChild:
|
|
141
|
+
const R = ({ children: t, asChild: o }) => /* @__PURE__ */ e(d.Title, { asChild: o, children: t });
|
|
138
142
|
R.displayName = "Dialog.Title";
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
Root:
|
|
143
|
+
const w = ({ children: t, asChild: o }) => /* @__PURE__ */ e(d.Description, { asChild: o, children: t });
|
|
144
|
+
w.displayName = "Dialog.Description";
|
|
145
|
+
const tt = {
|
|
146
|
+
Root: h,
|
|
143
147
|
Title: R,
|
|
144
|
-
Description:
|
|
148
|
+
Description: w,
|
|
145
149
|
Close: F,
|
|
146
|
-
Trigger: l(
|
|
147
|
-
Content: l(
|
|
148
|
-
Header: l(
|
|
149
|
-
Footer: l(
|
|
150
|
-
Body: l(
|
|
151
|
-
SideContent: l(
|
|
150
|
+
Trigger: l(C),
|
|
151
|
+
Content: l(N),
|
|
152
|
+
Header: l(b),
|
|
153
|
+
Footer: l(v),
|
|
154
|
+
Body: l(x),
|
|
155
|
+
SideContent: l(T)
|
|
152
156
|
};
|
|
153
157
|
export {
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
tt as Dialog,
|
|
159
|
+
x as DialogBody,
|
|
156
160
|
F as DialogClose,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
N as DialogContent,
|
|
162
|
+
w as DialogDescription,
|
|
163
|
+
v as DialogFooter,
|
|
164
|
+
b as DialogHeader,
|
|
165
|
+
h as DialogRoot,
|
|
166
|
+
T as DialogSideContent,
|
|
163
167
|
R as DialogTitle,
|
|
164
|
-
|
|
168
|
+
C as DialogTrigger
|
|
165
169
|
};
|
|
166
170
|
//# sourceMappingURL=fondue-components9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/dialog.module.scss';\n\nexport type DialogRootProps = {\n /**\n * Disable interaction with the rest of the page\n * @default false\n */\n modal?: boolean;\n /**\n * The controlled `open` state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Event handler called when the `open` state changes\n */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\nexport type DialogContentProps = {\n /**\n * Add rounded corners to the dialog\n * @default true\n */\n rounded?: boolean;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The vertical alignment of the divider\n * @default \"center\"\n */\n verticalAlign?: 'top' | 'center';\n\n /**\n * Define a maximum width for the dialog\n * @default \"800px\"\n */\n maxWidth?: string;\n /**\n * Define a minimum width for the dialog\n * @default \"400px\"\n */\n minWidth?: string;\n /**\n * Define a minimum height for the dialog\n * @default \"200px\"\n */\n minHeight?: string;\n /**\n * Show a dark underlay behind the dialog\n * @default false\n */\n showUnderlay?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogHeaderProps = {\n /**\n * Define the padding for the dialog header\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the bottom of the header\n * @default true\n */\n showBorder?: boolean;\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n closeProps?: CommonAriaProps;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\n /**\n * Define the padding for the dialog footer\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the top of the footer\n * @default true\n */\n showBorder?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogBodyProps = {\n /**\n * Define the padding for the dialog body\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogSideContentProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogCloseProps = { children?: ReactNode };\n\nexport type DialogAnnouncementProps = { children?: ReactNode; asChild?: boolean };\n\ntype DialogContextType = {\n isModal: boolean;\n};\n\nconst DialogContext = createContext<DialogContextType>({ isModal: false });\nDialogContext.displayName = 'DialogContext';\n\nexport const DialogRoot = ({ children, modal, onOpenChange, open }: DialogRootProps) => {\n const value = useMemo(() => ({ isModal: modal ?? false }), [modal]);\n\n return (\n <DialogContext.Provider value={value}>\n <RadixDialog.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n {children}\n </RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dialog-trigger' }: DialogTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDialog.Trigger\n onMouseDown={addAutoFocusAttribute}\n data-auto-focus-visible=\"true\"\n data-auto-focus-trigger\n data-test-id={dataTestId}\n asChild={asChild}\n ref={ref}\n >\n {children}\n </RadixDialog.Trigger>\n );\n};\nDialogTrigger.displayName = 'Dialog.Trigger';\n\nconst DialogUnderlay = ({ children, showUnderlay }: { children: ReactNode; showUnderlay: boolean }) => {\n const { isModal } = useContext(DialogContext);\n if (isModal) {\n return (\n <RadixDialog.Overlay data-visible={showUnderlay} className={styles.underlay}>\n {children}\n </RadixDialog.Overlay>\n );\n }\n return (\n <div className={styles.underlay} data-visible={showUnderlay}>\n {children}\n </div>\n );\n};\n\nexport const DialogContent = (\n {\n maxWidth = '800px',\n minWidth = '400px',\n minHeight = '200px',\n padding = 'compact',\n verticalAlign = 'center',\n 'data-test-id': dataTestId = 'fondue-dialog-content',\n showUnderlay = false,\n rounded = true,\n children,\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n const contentRef = useRef<HTMLDivElement>(null);\n\n useSyncRefs<HTMLDivElement>(contentRef, ref);\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const dialogBody = contentRef.current?.querySelector('[data-dialog-layout-component=\"body\"]');\n\n const firstFocusable = dialogBody?.querySelector(\n 'button:not([data-tooltip-trigger=\"true\"]), [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (firstFocusable instanceof HTMLElement) {\n firstFocusable.focus();\n }\n };\n\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <DialogUnderlay showUnderlay={showUnderlay}>\n <RadixDialog.Content\n style={\n {\n '--dialog-max-width': maxWidth,\n '--dialog-min-width': minWidth,\n '--dialog-min-height': minHeight,\n } as CSSProperties\n }\n ref={contentRef}\n className={styles.content}\n onFocus={addShowFocusRing}\n onOpenAutoFocus={handleOpenAutoFocus}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n dir={dir}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </ThemeProvider>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n padding,\n showBorder = true,\n showCloseButton = true,\n closeProps,\n children,\n 'data-test-id': dataTestId = 'fondue-dialog-header',\n }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.header}\n data-dialog-header-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"header\"\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close\n role=\"button\"\n data-test-id={`${dataTestId}-close`}\n className=\"tw-cursor-pointer\"\n aria-label=\"Close\"\n {...closeProps}\n >\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { padding, showBorder = true, children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.footer}\n data-dialog-footer-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"footer\"\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { padding, children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.body}\n data-dialog-body-padding={padding}\n data-dialog-layout-component=\"body\"\n >\n {children}\n </div>\n );\n};\nDialogBody.displayName = 'Dialog.Body';\n\nexport const DialogSideContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-side-content' }: DialogSideContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.sideContent} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogSideContent.displayName = 'Dialog.SideContent';\n\nexport const DialogClose = ({ children }: DialogCloseProps) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>;\n};\nDialogClose.displayName = 'Dialog.Close';\n\nexport const DialogTitle = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Title asChild={asChild}>{children}</RadixDialog.Title>;\n};\nDialogTitle.displayName = 'Dialog.Title';\n\nexport const DialogDescription = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Description asChild={asChild}>{children}</RadixDialog.Description>;\n};\nDialogDescription.displayName = 'Dialog.Description';\n\nexport const Dialog = {\n Root: DialogRoot,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Trigger: forwardRef<HTMLButtonElement, DialogTriggerProps>(DialogTrigger),\n Content: forwardRef<HTMLDivElement, DialogContentProps>(DialogContent),\n Header: forwardRef<HTMLDivElement, DialogHeaderProps>(DialogHeader),\n Footer: forwardRef<HTMLDivElement, DialogFooterProps>(DialogFooter),\n Body: forwardRef<HTMLDivElement, DialogBodyProps>(DialogBody),\n SideContent: forwardRef<HTMLDivElement, DialogSideContentProps>(DialogSideContent),\n};\n"],"names":["DialogContext","createContext","DialogRoot","children","modal","onOpenChange","open","value","useMemo","jsx","RadixDialog","DialogTrigger","asChild","dataTestId","ref","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","dir","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","closeProps","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;;AAiJA,MAAMA,IAAgBC,EAAiC,EAAE,SAAS,IAAO;AACzED,EAAc,cAAc;AAErB,MAAME,IAAa,CAAC,EAAE,UAAAC,GAAU,OAAAC,GAAO,cAAAC,GAAc,MAAAC,QAA4B;AACpF,QAAMC,IAAQC,EAAQ,OAAO,EAAE,SAASJ,KAAS,GAAA,IAAU,CAACA,CAAK,CAAC;AAElE,SACI,gBAAAK,EAACT,EAAc,UAAd,EAAuB,OAAAO,GACpB,UAAA,gBAAAE,EAACC,EAAY,MAAZ,EAAiB,MAAAJ,GAAY,cAAAD,GAA4B,OAAAD,GACrD,UAAAD,GACL,GACJ;AAER;AACAD,EAAW,cAAc;AAElB,MAAMS,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAT,GAAU,gBAAgBU,IAAa,wBAAA,GACzDC,MAGI,gBAAAL;AAAA,EAACC,EAAY;AAAA,EAAZ;AAAA,IACG,aAAaK;AAAA,IACb,2BAAwB;AAAA,IACxB,2BAAuB;AAAA,IACvB,gBAAcF;AAAA,IACd,SAAAD;AAAA,IACA,KAAAE;AAAA,IAEC,UAAAX;AAAA,EA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AAQa,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
1
|
+
{"version":3,"file":"fondue-components9.js","sources":["../src/components/Dialog/Dialog.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixDialog from '@radix-ui/react-dialog';\nimport {\n createContext,\n forwardRef,\n useContext,\n useMemo,\n useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useSyncRefs } from '#/hooks/useSyncRefs';\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/dialog.module.scss';\n\nexport type DialogRootProps = {\n /**\n * Disable interaction with the rest of the page\n * @default false\n */\n modal?: boolean;\n /**\n * The controlled `open` state of the dialog\n * @default false\n */\n open?: boolean;\n /**\n * Event handler called when the `open` state changes\n */\n onOpenChange?: (open: boolean) => void;\n children?: ReactNode;\n};\n\nexport type DialogContentProps = {\n /**\n * Add rounded corners to the dialog\n * @default true\n */\n rounded?: boolean;\n /**\n * Define the padding of the dialog\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * The vertical alignment of the divider\n * @default \"center\"\n */\n verticalAlign?: 'top' | 'center';\n\n /**\n * Define a maximum width for the dialog\n * @default \"800px\"\n */\n maxWidth?: string;\n /**\n * Define a minimum width for the dialog\n * @default \"400px\"\n */\n minWidth?: string;\n /**\n * Define a minimum height for the dialog\n * @default \"200px\"\n */\n minHeight?: string;\n /**\n * Show a dark underlay behind the dialog\n * @default false\n */\n showUnderlay?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogTriggerProps = {\n /**\n * Change the default rendered element for the one passed as a child, merging their props and behavior.\n * @default true\n */\n asChild?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogHeaderProps = {\n /**\n * Define the padding for the dialog header\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the bottom of the header\n * @default true\n */\n showBorder?: boolean;\n /**\n * Show a close button in the header\n * @default true\n */\n showCloseButton?: boolean;\n closeProps?: CommonAriaProps;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogFooterProps = {\n /**\n * Define the padding for the dialog footer\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Show a border at the top of the footer\n * @default true\n */\n showBorder?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogBodyProps = {\n /**\n * Define the padding for the dialog body\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport type DialogSideContentProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport type DialogCloseProps = { children?: ReactNode };\n\nexport type DialogAnnouncementProps = { children?: ReactNode; asChild?: boolean };\n\ntype DialogContextType = {\n isModal: boolean;\n};\n\nconst DialogContext = createContext<DialogContextType>({ isModal: false });\nDialogContext.displayName = 'DialogContext';\n\nexport const DialogRoot = ({ children, modal, onOpenChange, open }: DialogRootProps) => {\n const value = useMemo(() => ({ isModal: modal ?? false }), [modal]);\n\n return (\n <DialogContext.Provider value={value}>\n <RadixDialog.Root open={open} onOpenChange={onOpenChange} modal={modal}>\n {children}\n </RadixDialog.Root>\n </DialogContext.Provider>\n );\n};\nDialogRoot.displayName = 'Dialog.Root';\n\nexport const DialogTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-dialog-trigger' }: DialogTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDialog.Trigger\n onMouseDown={addAutoFocusAttribute}\n data-auto-focus-visible=\"true\"\n data-auto-focus-trigger\n data-test-id={dataTestId}\n asChild={asChild}\n ref={ref}\n >\n {children}\n </RadixDialog.Trigger>\n );\n};\nDialogTrigger.displayName = 'Dialog.Trigger';\n\nconst DialogUnderlay = ({ children, showUnderlay }: { children: ReactNode; showUnderlay: boolean }) => {\n const { isModal } = useContext(DialogContext);\n if (isModal) {\n return (\n <RadixDialog.Overlay data-visible={showUnderlay} className={styles.underlay}>\n {children}\n </RadixDialog.Overlay>\n );\n }\n return (\n <div className={styles.underlay} data-visible={showUnderlay}>\n {children}\n </div>\n );\n};\n\nexport const DialogContent = (\n {\n maxWidth = '800px',\n minWidth = '400px',\n minHeight = '200px',\n padding = 'compact',\n verticalAlign = 'center',\n 'data-test-id': dataTestId = 'fondue-dialog-content',\n showUnderlay = false,\n rounded = true,\n children,\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n const contentRef = useRef<HTMLDivElement>(null);\n\n useSyncRefs<HTMLDivElement>(contentRef, ref);\n\n const handleOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n\n const dialogBody = contentRef.current?.querySelector('[data-dialog-layout-component=\"body\"]');\n\n const firstFocusable = dialogBody?.querySelector(\n 'button:not([data-tooltip-trigger=\"true\"]), [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])',\n );\n\n if (firstFocusable instanceof HTMLElement) {\n firstFocusable.focus();\n }\n };\n\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <DialogUnderlay showUnderlay={showUnderlay}>\n <RadixDialog.Content\n style={\n {\n '--dialog-max-width': maxWidth,\n '--dialog-min-width': minWidth,\n '--dialog-min-height': minHeight,\n } as CSSProperties\n }\n ref={contentRef}\n className={styles.content}\n onFocus={addShowFocusRing}\n onOpenAutoFocus={handleOpenAutoFocus}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n dir={dir}\n >\n {children}\n </RadixDialog.Content>\n </DialogUnderlay>\n </ThemeProvider>\n </RadixDialog.Portal>\n );\n};\nDialogContent.displayName = 'Dialog.Content';\n\nexport const DialogHeader = (\n {\n padding,\n showBorder = true,\n showCloseButton = true,\n closeProps,\n children,\n 'data-test-id': dataTestId = 'fondue-dialog-header',\n }: DialogHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.header}\n data-dialog-header-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"header\"\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close\n role=\"button\"\n data-test-id={`${dataTestId}-close`}\n className=\"tw-cursor-pointer\"\n aria-label={t('Dialog_close')}\n {...closeProps}\n >\n <IconCross size={20} />\n </RadixDialog.Close>\n )}\n </div>\n );\n};\nDialogHeader.displayName = 'Dialog.Header';\n\nexport const DialogFooter = (\n { padding, showBorder = true, children, 'data-test-id': dataTestId = 'fondue-dialog-footer' }: DialogFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.footer}\n data-dialog-footer-padding={padding}\n data-show-border={showBorder}\n data-dialog-layout-component=\"footer\"\n >\n {children}\n </div>\n );\n};\nDialogFooter.displayName = 'Dialog.Footer';\n\nexport const DialogBody = (\n { padding, children, 'data-test-id': dataTestId = 'fondue-dialog-body' }: DialogBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n className={styles.body}\n data-dialog-body-padding={padding}\n data-dialog-layout-component=\"body\"\n >\n {children}\n </div>\n );\n};\nDialogBody.displayName = 'Dialog.Body';\n\nexport const DialogSideContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dialog-side-content' }: DialogSideContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.sideContent} data-dialog-layout-component>\n {children}\n </div>\n );\n};\nDialogSideContent.displayName = 'Dialog.SideContent';\n\nexport const DialogClose = ({ children }: DialogCloseProps) => {\n return <RadixDialog.Close asChild>{children}</RadixDialog.Close>;\n};\nDialogClose.displayName = 'Dialog.Close';\n\nexport const DialogTitle = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Title asChild={asChild}>{children}</RadixDialog.Title>;\n};\nDialogTitle.displayName = 'Dialog.Title';\n\nexport const DialogDescription = ({ children, asChild }: DialogAnnouncementProps) => {\n return <RadixDialog.Description asChild={asChild}>{children}</RadixDialog.Description>;\n};\nDialogDescription.displayName = 'Dialog.Description';\n\nexport const Dialog = {\n Root: DialogRoot,\n Title: DialogTitle,\n Description: DialogDescription,\n Close: DialogClose,\n Trigger: forwardRef<HTMLButtonElement, DialogTriggerProps>(DialogTrigger),\n Content: forwardRef<HTMLDivElement, DialogContentProps>(DialogContent),\n Header: forwardRef<HTMLDivElement, DialogHeaderProps>(DialogHeader),\n Footer: forwardRef<HTMLDivElement, DialogFooterProps>(DialogFooter),\n Body: forwardRef<HTMLDivElement, DialogBodyProps>(DialogBody),\n SideContent: forwardRef<HTMLDivElement, DialogSideContentProps>(DialogSideContent),\n};\n"],"names":["DialogContext","createContext","DialogRoot","children","modal","onOpenChange","open","value","useMemo","jsx","RadixDialog","DialogTrigger","asChild","dataTestId","ref","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","dir","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","closeProps","t","useTranslation","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;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A,GACzCC,MAGI,gBAAAL,EAAC,OAAA,EAAI,gBAAcI,GAAY,KAAAC,GAAU,WAAWM,EAAO,aAAa,gCAA4B,IAC/F,UAAAjB,EAAA,CACL;AAGRgD,EAAkB,cAAc;AAEzB,MAAMC,IAAc,CAAC,EAAE,UAAAjD,0BAClBO,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAP,GAAS;AAEhDiD,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAAlD,GAAU,SAAAS,QAC7B,gBAAAH,EAACC,EAAY,OAAZ,EAAkB,SAAAE,GAAmB,UAAAT,EAAA,CAAS;AAE1DkD,EAAY,cAAc;AAEnB,MAAMC,IAAoB,CAAC,EAAE,UAAAnD,GAAU,SAAAS,QACnC,gBAAAH,EAACC,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAT,EAAA,CAAS;AAEhEmD,EAAkB,cAAc;AAEzB,MAAMC,KAAS;AAAA,EAClB,MAAMrD;AAAA,EACN,OAAOmD;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkD7C,CAAa;AAAA,EACxE,SAAS6C,EAA+CnC,CAAa;AAAA,EACrE,QAAQmC,EAA8Cf,CAAY;AAAA,EAClE,QAAQe,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { IconCross as s } from "@frontify/fondue-icons";
|
|
3
|
-
import { Button as o } from "./fondue-components6.js";
|
|
4
|
-
import t from "./fondue-components70.js";
|
|
5
|
-
const c = ({ onClear: r }) => /* @__PURE__ */ e(o, { "aria-label": "clear input", type: "button", size: "small", emphasis: "weak", aspect: "square", onPress: r, children: /* @__PURE__ */ e(s, { className: t.clearIcon, size: 16 }) });
|
|
1
|
+
const t = "focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue";
|
|
6
2
|
export {
|
|
7
|
-
|
|
3
|
+
t as FOCUS_OUTLINE
|
|
8
4
|
};
|
|
9
5
|
//# sourceMappingURL=fondue-components90.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components90.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"fondue-components90.js","sources":["../src/utilities/focusStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const FOCUS_OUTLINE =\n 'focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue'; // second declaration of tw-outline-blue is to assure that in firefox the outline isn't overriden by a global definition of :-moz-focusring which is coming from tailwinds normalization styling\n"],"names":["FOCUS_OUTLINE"],"mappings":"AAEO,MAAMA,IACT;"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Children as a, isValidElement as u, cloneElement as f } from "react";
|
|
2
|
+
import { ForwardedRefSelectItem as E } from "./fondue-components68.js";
|
|
3
|
+
const g = ({
|
|
4
|
+
children: o,
|
|
5
|
+
value: r,
|
|
6
|
+
label: s
|
|
7
|
+
}) => o && typeof o == "string" ? {
|
|
8
|
+
value: r || o,
|
|
9
|
+
label: s || o
|
|
10
|
+
} : {
|
|
11
|
+
value: r || "",
|
|
12
|
+
label: s || r || "",
|
|
13
|
+
...o ? { children: o } : null
|
|
14
|
+
}, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
|
|
15
|
+
const n = [];
|
|
16
|
+
let t = 0;
|
|
17
|
+
return a.forEach(o, (e) => {
|
|
18
|
+
if (w(e, E) && u(e))
|
|
19
|
+
g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
|
|
20
|
+
else if (u(e) && (e != null && e.props.children)) {
|
|
21
|
+
const { parsedChildren: m, subElementCount: C } = y(
|
|
22
|
+
e.props.children,
|
|
23
|
+
r,
|
|
24
|
+
"",
|
|
25
|
+
p + t
|
|
26
|
+
);
|
|
27
|
+
e = f(e, {
|
|
28
|
+
children: m,
|
|
29
|
+
key: `group-${p + t}`
|
|
30
|
+
}), n.push(e), t += C;
|
|
31
|
+
} else
|
|
32
|
+
n.push(e);
|
|
33
|
+
}), {
|
|
34
|
+
parsedChildren: n,
|
|
35
|
+
subElementCount: t
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export {
|
|
39
|
+
g as getSelectOptionValue,
|
|
40
|
+
w as isReactLeaf,
|
|
41
|
+
y as recursiveMap
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=fondue-components91.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components91.js","sources":["../src/components/Select/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n type JSXElementConstructor,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\n\n/**\n * Extracts and returns an object containing `value` and `label` from a given SelectItemProps object.\n * It prioritizes explicit `value` and `label` properties but will fall back to using `children` as the value or label if necessary.\n *\n * @param {SelectItemProps} props - The properties of a select item, which include potential children, value, and label.\n * @returns {{ value: string; label: string, children?: ReactNode }} An object containing `value` and `label` as strings.\n *\n * @example\n * // Returns { value: 'option1', label: 'Option 1' }\n * getSelectOptionValue({ value: 'option1', label: 'Option 1' });\n *\n * @example\n * // Uses children as the value and label when they are not explicitly provided\n * // Returns { value: 'Default', label: 'Default' }\n * getSelectOptionValue({ children: 'Default' });\n */\nexport const getSelectOptionValue = ({\n children,\n value,\n label,\n}: SelectItemProps): {\n value: string;\n label: string;\n children?: ReactNode;\n} => {\n if (children && typeof children === 'string') {\n return {\n value: value ? value : children,\n label: label ? label : children,\n };\n }\n\n return {\n value: value || '',\n label: label ? label : value || '',\n ...(children ? { children } : null),\n };\n};\n/**\n * Determines if the child is a leaf node of React, meaning it has one final child of a native type;\n *\n * @param {ReactNode} child - The React child node to check.\n * @param {JSXElementConstructor<never>} Component - The React component constructor used for comparison.\n * @returns {boolean} Returns true if the `child` is a valid React element of the specified `Component` type.\n *\n * @example\n * // Assuming ForwardedRefSelectItem is a component that renders an <input> element\n * // Returns true\n * isReactLeaf(<ForwardedRefSelectItem />, ForwardedRefSelectItem);\n *\n * @example\n * // Returns false for non-matching types or non-leaf components\n * isReactLeaf(<div><ForwardedRefSelectItem /></div>, ForwardedRefSelectItem);\n */\nexport const isReactLeaf = (child: ReactNode, Component: JSXElementConstructor<never>): child is ReactElement =>\n isValidElement(child) && child.type === Component;\n\n/**\n * Recursively maps through React children, applying a callback to each child that meets the specified conditions.\n * This function is useful for deeply nested structures where modifications or checks are needed at multiple levels.\n *\n * @param {ReactNode} children - The children to be recursively processed.\n * @param {function(ReactNode, number): ReactNode} callback - A function that is called for each child that meets the condition. It receives the child and its index, and returns a React node.\n * @param {string} [filterText=''] - Optional text used to filter children based on their properties.\n * @param {number} [nextIndex=0] - The starting index for numbering children, defaults to 0.\n * @returns {{ parsedChildren: ReactNode[], subElementCount: number }} An object containing the transformed children array and the count of all processed sub-elements.\n *\n * @example\n * // Example usage in a select component where only items containing a certain text are modified\n * recursiveMap(children, (child, index) => React.cloneElement(child, { extraProp: 'value' }), 'specific text');\n *\n * @example\n * // Nested structure transformation, adding class names based on index\n * recursiveMap(children, (child, index) => React.cloneElement(child, { className: `item-${index}` }));\n */\nexport const recursiveMap = (\n children: ReactNode,\n callback: (child: ReactNode, nextIndex: number) => ReactNode,\n filterText?: string,\n nextIndex: number = 0,\n): {\n parsedChildren: ReactNode[];\n subElementCount: number;\n} => {\n const resultingChildren: ReactNode[] = [];\n let itemCounter = 0;\n Children.forEach(children, (child) => {\n if (isReactLeaf(child, ForwardedRefSelectItem) && isValidElement<SelectItemProps>(child)) {\n if (\n getSelectOptionValue(child.props)\n .label.toLowerCase()\n .includes(filterText?.toLowerCase() || '')\n ) {\n resultingChildren.push(callback(child, nextIndex + itemCounter));\n itemCounter++;\n }\n } else if (isValidElement<{ children: ReactNode }>(child) && child?.props.children) {\n const { parsedChildren, subElementCount } = recursiveMap(\n child.props.children,\n callback,\n '',\n nextIndex + itemCounter,\n );\n child = cloneElement(child, {\n children: parsedChildren,\n key: `group-${nextIndex + itemCounter}`,\n });\n resultingChildren.push(child);\n itemCounter += subElementCount;\n } else {\n resultingChildren.push(child);\n }\n });\n return {\n parsedChildren: resultingChildren,\n subElementCount: itemCounter,\n };\n};\n"],"names":["getSelectOptionValue","children","value","label","isReactLeaf","child","Component","isValidElement","recursiveMap","callback","filterText","nextIndex","resultingChildren","itemCounter","Children","ForwardedRefSelectItem","parsedChildren","subElementCount","cloneElement"],"mappings":";;AA6BO,MAAMA,IAAuB,CAAC;AAAA,EACjC,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AACJ,MAKQF,KAAY,OAAOA,KAAa,WACzB;AAAA,EACH,OAAOC,KAAgBD;AAAA,EACvB,OAAOE,KAAgBF;AAAA,IAIxB;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,KAAgBD,KAAS;AAAA,EAChC,GAAID,IAAW,EAAE,UAAAA,MAAa;AAAA,GAmBzBG,IAAc,CAACC,GAAkBC,MAC1CC,EAAeF,CAAK,KAAKA,EAAM,SAASC,GAoB/BE,IAAe,CACxBP,GACAQ,GACAC,GACAC,IAAoB,MAInB;AACD,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAAc;AAClB,SAAAC,EAAS,QAAQb,GAAU,CAACI,MAAU;AAClC,QAAID,EAAYC,GAAOU,CAAsB,KAAKR,EAAgCF,CAAK;AACnF,MACIL,EAAqBK,EAAM,KAAK,EAC3B,MAAM,cACN,UAASK,KAAA,gBAAAA,EAAY,kBAAiB,EAAE,MAE7CE,EAAkB,KAAKH,EAASJ,GAAOM,IAAYE,CAAW,CAAC,GAC/DA;AAAA,aAEGN,EAAwCF,CAAK,MAAKA,KAAA,QAAAA,EAAO,MAAM,WAAU;AAChF,YAAM,EAAE,gBAAAW,GAAgB,iBAAAC,EAAA,IAAoBT;AAAA,QACxCH,EAAM,MAAM;AAAA,QACZI;AAAA,QACA;AAAA,QACAE,IAAYE;AAAA,MAAA;AAEhB,MAAAR,IAAQa,EAAab,GAAO;AAAA,QACxB,UAAUW;AAAA,QACV,KAAK,SAASL,IAAYE,CAAW;AAAA,MAAA,CACxC,GACDD,EAAkB,KAAKP,CAAK,GAC5BQ,KAAeI;AAAA,IACnB;AACI,MAAAL,EAAkB,KAAKP,CAAK;AAAA,EAEpC,CAAC,GACM;AAAA,IACH,gBAAgBO;AAAA,IAChB,iBAAiBC;AAAA,EAAA;AAEzB;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as s } from "@frontify/fondue-icons";
|
|
3
|
+
import { useTranslation as t } from "./fondue-components34.js";
|
|
4
|
+
import { Button as a } from "./fondue-components6.js";
|
|
5
|
+
import l from "./fondue-components71.js";
|
|
6
|
+
const f = ({ onClear: r }) => {
|
|
7
|
+
const { t: o } = t();
|
|
8
|
+
return /* @__PURE__ */ e(
|
|
9
|
+
a,
|
|
10
|
+
{
|
|
11
|
+
"aria-label": o("Select_clear"),
|
|
12
|
+
type: "button",
|
|
13
|
+
size: "small",
|
|
14
|
+
emphasis: "weak",
|
|
15
|
+
aspect: "square",
|
|
16
|
+
onPress: r,
|
|
17
|
+
children: /* @__PURE__ */ e(s, { className: l.clearIcon, size: 16 })
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
export {
|
|
22
|
+
f as SelectClear
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=fondue-components92.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fondue-components92.js","sources":["../src/components/Select/SelectClear.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\n\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { Button } from '../Button/Button';\n\nimport styles from './styles/select.module.scss';\n\nexport const SelectClear = ({ onClear }: { onClear?: () => void }) => {\n const { t } = useTranslation();\n\n return (\n <Button\n aria-label={t('Select_clear')}\n type=\"button\"\n size=\"small\"\n emphasis=\"weak\"\n aspect=\"square\"\n onPress={onClear}\n >\n <IconCross className={styles.clearIcon} size={16} />\n </Button>\n );\n};\n"],"names":["SelectClear","onClear","t","useTranslation","jsx","Button","IconCross","styles"],"mappings":";;;;;AAUO,MAAMA,IAAc,CAAC,EAAE,SAAAC,QAAwC;AAClE,QAAM,EAAE,GAAAC,EAAA,IAAMC,EAAA;AAEd,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,cAAYH,EAAE,cAAc;AAAA,MAC5B,MAAK;AAAA,MACL,MAAK;AAAA,MACL,UAAS;AAAA,MACT,QAAO;AAAA,MACP,SAASD;AAAA,MAET,4BAACK,GAAA,EAAU,WAAWC,EAAO,WAAW,MAAM,GAAA,CAAI;AAAA,IAAA;AAAA,EAAA;AAG9D;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -780,6 +780,26 @@ declare type DropdownTriggerProps = {
|
|
|
780
780
|
|
|
781
781
|
declare type DropdownViewportCollisionPadding = 'compact' | 'spacious';
|
|
782
782
|
|
|
783
|
+
declare const enUS: {
|
|
784
|
+
ColorPicker_selectColor: string;
|
|
785
|
+
ColorPicker_selectFormat: string;
|
|
786
|
+
ColorPicker_hexValue: string;
|
|
787
|
+
ColorPicker_redChannel: string;
|
|
788
|
+
ColorPicker_greenChannel: string;
|
|
789
|
+
ColorPicker_blueChannel: string;
|
|
790
|
+
ColorPicker_opacity: string;
|
|
791
|
+
Dialog_close: string;
|
|
792
|
+
Flyout_close: string;
|
|
793
|
+
Select_clear: string;
|
|
794
|
+
Select_toggleMenu: string;
|
|
795
|
+
Switch_defaultLabel: string;
|
|
796
|
+
Table_sortByDescending: string;
|
|
797
|
+
Table_sortByAscending: string;
|
|
798
|
+
Table_sortDescending: string;
|
|
799
|
+
Table_sortAscending: string;
|
|
800
|
+
Badge_dismiss: string;
|
|
801
|
+
};
|
|
802
|
+
|
|
783
803
|
declare type ExtraAction = {
|
|
784
804
|
icon: ReactElement;
|
|
785
805
|
title: string;
|
|
@@ -1758,11 +1778,29 @@ declare type TableRootProps = {
|
|
|
1758
1778
|
* @default 'small'
|
|
1759
1779
|
*/
|
|
1760
1780
|
fontSize?: 'small' | 'medium';
|
|
1781
|
+
/**
|
|
1782
|
+
* Additional spacing between table cells (both horizontal and vertical)
|
|
1783
|
+
*
|
|
1784
|
+
* This value is added to the default cell spacing. For example, with `gutter="48px"`,
|
|
1785
|
+
* cells will have 48px of additional space between them in both directions
|
|
1786
|
+
* (24px added to each side).
|
|
1787
|
+
*
|
|
1788
|
+
* Accepts any CSS length value with units (e.g., '16px', '1rem', '48px')
|
|
1789
|
+
*
|
|
1790
|
+
* **Important:** Always include a unit, even for zero (use '0px', not '0')
|
|
1791
|
+
* @default '0px'
|
|
1792
|
+
*/
|
|
1793
|
+
gutter?: CSSProperties['borderSpacing'];
|
|
1761
1794
|
/**
|
|
1762
1795
|
* Whether header should stick to the top when scrolling
|
|
1763
1796
|
* @deprecated Use `Table.Header sticky` prop instead. For sticky columns, use `Table.Body firstColumnSticky` or `lastColumnSticky` props
|
|
1764
1797
|
*/
|
|
1765
1798
|
sticky?: 'head' | 'col' | 'both';
|
|
1799
|
+
/**
|
|
1800
|
+
* Whether to remove the top and bottom borders from the table
|
|
1801
|
+
* @default false
|
|
1802
|
+
*/
|
|
1803
|
+
noBorder?: boolean;
|
|
1766
1804
|
children: ReactNode;
|
|
1767
1805
|
} & CommonAriaAttrs_2 & Pick<AriaAttributes, 'aria-multiselectable'>;
|
|
1768
1806
|
|
|
@@ -2236,9 +2274,15 @@ declare type TextSize = 'x-small' | 'small' | 'medium' | 'large';
|
|
|
2236
2274
|
|
|
2237
2275
|
declare type TextWeight = 'default' | 'strong' | 'x-strong';
|
|
2238
2276
|
|
|
2239
|
-
export declare const ThemeContext: Context<
|
|
2277
|
+
export declare const ThemeContext: Context<ThemeContextValue>;
|
|
2240
2278
|
|
|
2241
|
-
|
|
2279
|
+
declare type ThemeContextValue = {
|
|
2280
|
+
theme: AvailableTheme;
|
|
2281
|
+
dir: 'ltr' | 'rtl';
|
|
2282
|
+
translations: Translations;
|
|
2283
|
+
};
|
|
2284
|
+
|
|
2285
|
+
export declare const ThemeProvider: ({ children, theme, dir, translations, asChild, }: ThemeProviderProps) => JSX_2.Element;
|
|
2242
2286
|
|
|
2243
2287
|
declare type ThemeProviderProps = {
|
|
2244
2288
|
children: ReactNode;
|
|
@@ -2246,12 +2290,24 @@ declare type ThemeProviderProps = {
|
|
|
2246
2290
|
* The theme to apply
|
|
2247
2291
|
* @default "light"
|
|
2248
2292
|
* */
|
|
2249
|
-
theme
|
|
2293
|
+
theme?: AvailableTheme;
|
|
2250
2294
|
/**
|
|
2251
2295
|
* Direction to apply to the theme
|
|
2252
2296
|
* @default "ltr"
|
|
2253
2297
|
*/
|
|
2254
|
-
dir
|
|
2298
|
+
dir?: 'ltr' | 'rtl';
|
|
2299
|
+
/**
|
|
2300
|
+
* Translations object to use for component strings.
|
|
2301
|
+
* Import from '@frontify/fondue/components/locales' or provide your own.
|
|
2302
|
+
* Must be a complete Translations object.
|
|
2303
|
+
* @default "enUS"
|
|
2304
|
+
* @example
|
|
2305
|
+
* ```tsx
|
|
2306
|
+
* import { deDE } from '@frontify/fondue/components/locales';
|
|
2307
|
+
* <ThemeProvider translations={deDE}>...</ThemeProvider>
|
|
2308
|
+
* ```
|
|
2309
|
+
*/
|
|
2310
|
+
translations?: Translations;
|
|
2255
2311
|
/**
|
|
2256
2312
|
* Change the default rendered element for the one passed as a child, merging their props and behavior.
|
|
2257
2313
|
* @default false
|
|
@@ -2310,7 +2366,9 @@ declare type TooltipTriggerProps = {
|
|
|
2310
2366
|
'data-test-id'?: string;
|
|
2311
2367
|
};
|
|
2312
2368
|
|
|
2313
|
-
|
|
2369
|
+
declare type Translations = typeof enUS;
|
|
2370
|
+
|
|
2371
|
+
export declare const useFondueTheme: () => ThemeContextValue;
|
|
2314
2372
|
|
|
2315
2373
|
export { }
|
|
2316
2374
|
|