@frontify/fondue-components 13.0.0 → 13.0.2
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 +1 -1
- package/dist/fondue-components11.js +2 -2
- package/dist/fondue-components12.js +1 -1
- package/dist/fondue-components13.js +1 -1
- package/dist/fondue-components15.js +1 -1
- package/dist/fondue-components16.js +1 -1
- package/dist/fondue-components17.js +26 -24
- package/dist/fondue-components17.js.map +1 -1
- package/dist/fondue-components18.js +1 -1
- package/dist/fondue-components19.js +2 -2
- package/dist/fondue-components20.js +6 -6
- package/dist/fondue-components21.js +1 -1
- package/dist/fondue-components22.js +1 -1
- package/dist/fondue-components23.js +1 -1
- package/dist/fondue-components24.js +1 -1
- package/dist/fondue-components32.js +1 -1
- package/dist/fondue-components32.js.map +1 -1
- package/dist/fondue-components41.js +8 -13
- package/dist/fondue-components41.js.map +1 -1
- package/dist/fondue-components42.js +13 -15
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components43.js +15 -60
- package/dist/fondue-components43.js.map +1 -1
- package/dist/fondue-components44.js +59 -17
- package/dist/fondue-components44.js.map +1 -1
- package/dist/fondue-components45.js +18 -19
- package/dist/fondue-components45.js.map +1 -1
- package/dist/fondue-components46.js +18 -4
- package/dist/fondue-components46.js.map +1 -1
- package/dist/fondue-components47.js +3 -13
- package/dist/fondue-components47.js.map +1 -1
- package/dist/fondue-components48.js +13 -3
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +3 -17
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components50.js +19 -35
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components51.js +35 -7
- package/dist/fondue-components51.js.map +1 -1
- package/dist/fondue-components52.js +6 -12
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components53.js +12 -4
- package/dist/fondue-components53.js.map +1 -1
- package/dist/fondue-components54.js +4 -24
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components55.js +24 -16
- package/dist/fondue-components55.js.map +1 -1
- package/dist/fondue-components56.js +16 -141
- package/dist/fondue-components56.js.map +1 -1
- package/dist/fondue-components57.js +142 -16
- package/dist/fondue-components57.js.map +1 -1
- package/dist/fondue-components58.js +16 -73
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +73 -8
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components60.js +8 -33
- package/dist/fondue-components60.js.map +1 -1
- package/dist/fondue-components61.js +32 -48
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components62.js +48 -10
- package/dist/fondue-components62.js.map +1 -1
- package/dist/fondue-components63.js +10 -12
- package/dist/fondue-components63.js.map +1 -1
- package/dist/fondue-components64.js +12 -7
- package/dist/fondue-components64.js.map +1 -1
- package/dist/fondue-components66.js +15 -15
- package/dist/fondue-components7.js +98 -87
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components76.js +1 -1
- package/dist/fondue-components8.js +1 -1
- package/dist/fondue-components9.js +74 -71
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +10 -0
- package/dist/style.css +1 -1
- package/package.json +5 -5
|
@@ -1,14 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as w } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as x } from "@frontify/fondue-icons";
|
|
3
|
+
import { useState as B, useMemo as i, Children as f, isValidElement as u, cloneElement as E, useCallback as F } from "react";
|
|
4
|
+
import { ForwardedRefSelectItem as I } from "./fondue-components58.js";
|
|
5
|
+
import { ForwardedRefSelectSlot as c } from "./fondue-components60.js";
|
|
6
|
+
import { getSelectOptionValue as R } from "./fondue-components76.js";
|
|
7
|
+
const S = (r) => {
|
|
8
|
+
const t = [];
|
|
9
|
+
return f.forEach(r, (o) => {
|
|
10
|
+
if (u(o) && o.type === I)
|
|
11
|
+
t.push(R(o.props));
|
|
12
|
+
else if (u(o) && o.props.children) {
|
|
13
|
+
const a = S(o.props.children);
|
|
14
|
+
for (const l of a)
|
|
15
|
+
t.push(l);
|
|
16
|
+
}
|
|
17
|
+
}), t;
|
|
18
|
+
}, z = (r) => {
|
|
19
|
+
const [t, o] = B(""), { inputSlots: a, menuSlots: l, itemValues: p, clearButton: V } = i(() => {
|
|
20
|
+
const s = [], n = [];
|
|
21
|
+
let m;
|
|
22
|
+
f.toArray(r).some(
|
|
23
|
+
(e) => u(e) && e.type === c
|
|
24
|
+
) ? f.forEach(r, (e) => {
|
|
25
|
+
u(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? s.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = E(e, { children: /* @__PURE__ */ w(x, { size: 16 }) })));
|
|
26
|
+
}) : n.push(r);
|
|
27
|
+
const g = S(n);
|
|
28
|
+
return { inputSlots: s, menuSlots: n, itemValues: g, clearButton: m };
|
|
29
|
+
}, [r]), y = i(
|
|
30
|
+
() => p.filter(
|
|
31
|
+
(s) => t === "" || s.label.toLowerCase().includes(t.toLowerCase())
|
|
32
|
+
),
|
|
33
|
+
[p, t]
|
|
34
|
+
), C = F(
|
|
35
|
+
(s) => s ? p.find((n) => n.value === s) : void 0,
|
|
36
|
+
[p]
|
|
37
|
+
);
|
|
38
|
+
return {
|
|
39
|
+
items: y,
|
|
40
|
+
menuSlots: l,
|
|
41
|
+
filterText: t,
|
|
42
|
+
inputSlots: a,
|
|
43
|
+
clearButton: V,
|
|
44
|
+
setFilterText: o,
|
|
45
|
+
getItemByValue: C
|
|
46
|
+
};
|
|
6
47
|
};
|
|
7
48
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
t as root,
|
|
11
|
-
o as thumb,
|
|
12
|
-
s as track
|
|
49
|
+
S as getRecursiveOptionValues,
|
|
50
|
+
z as useSelectData
|
|
13
51
|
};
|
|
14
52
|
//# sourceMappingURL=fondue-components62.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components62.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
1
|
+
{"version":3,"file":"fondue-components62.js","sources":["../src/components/Select/useSelectData.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport { Children, cloneElement, isValidElement, useCallback, useMemo, useState, type ReactNode } from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\nimport { ForwardedRefSelectSlot, type SelectSlotProps } from './SelectSlot';\nimport { getSelectOptionValue } from './utils';\n\nexport type SelectItemType = {\n value: string;\n label: string;\n};\n\n/**\n * Recursively extracts option values from children.\n * This function traverses through the React component tree and collects all SelectItem values.\n *\n * @param {ReactNode} children - The React children to extract values from.\n * @returns {SelectItemType[]} An array of SelectItemType objects.\n *\n * @example\n * const options = (\n * <SelectItem value=\"1\">Option 1</SelectItem>\n * <SelectItem value=\"2\">Option 2</SelectItem>\n * );\n * const values = getRecursiveOptionValues(options);\n * // Returns: [{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]\n */\nexport const getRecursiveOptionValues = (children: ReactNode): { value: string; label: string }[] => {\n const values: { value: string; label: string }[] = [];\n Children.forEach(children, (child) => {\n if (isValidElement<SelectItemProps>(child) && child.type === ForwardedRefSelectItem) {\n values.push(getSelectOptionValue(child.props));\n } else if (isValidElement<{ children: ReactNode }>(child) && child.props.children) {\n const optionValues = getRecursiveOptionValues(child.props.children);\n for (const optionValue of optionValues) {\n values.push(optionValue);\n }\n }\n });\n return values;\n};\n\n/**\n * Custom hook for managing select data and filtering.\n *\n * @param {ReactNode} children - The React children to process, typically SelectItem components.\n * @returns {Object} An object containing the processed data.\n */\nexport const useSelectData = (children: ReactNode) => {\n const [filterText, setFilterText] = useState('');\n const { inputSlots, menuSlots, itemValues, clearButton } = useMemo(() => {\n const inputSlots: ReactNode[] = [];\n const menuSlots: ReactNode[] = [];\n let clearButton: ReactNode;\n\n const hasSlots = Children.toArray(children).some(\n (child) => isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot,\n );\n\n if (hasSlots) {\n Children.forEach(children, (child) => {\n if (isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot) {\n if (child.props.name === 'menu') {\n menuSlots.push(child.props.children);\n } else if (child.props.name === 'left' || child.props.name === 'right') {\n inputSlots.push(child);\n } else if (child.props.name === 'clear') {\n if (child.props.children) {\n clearButton = child;\n } else {\n clearButton = cloneElement(child, { children: <IconCross size={16} /> });\n }\n }\n }\n });\n } else {\n menuSlots.push(children);\n }\n\n const itemValues = getRecursiveOptionValues(menuSlots);\n\n return { inputSlots, menuSlots, itemValues, clearButton };\n }, [children]);\n\n const items = useMemo(\n () =>\n itemValues.filter(\n (item) => filterText === '' || item.label.toLowerCase().includes(filterText.toLowerCase()),\n ),\n [itemValues, filterText],\n );\n\n const getItemByValue = useCallback(\n (value?: string | null) => (value ? itemValues.find((item) => item.value === value) : undefined),\n [itemValues],\n );\n\n return {\n items,\n menuSlots,\n filterText,\n inputSlots,\n clearButton,\n setFilterText,\n getItemByValue,\n };\n};\n"],"names":["getRecursiveOptionValues","children","values","Children","child","isValidElement","ForwardedRefSelectItem","getSelectOptionValue","optionValues","optionValue","useSelectData","filterText","setFilterText","useState","inputSlots","menuSlots","itemValues","clearButton","useMemo","ForwardedRefSelectSlot","cloneElement","IconCross","items","item","getItemByValue","useCallback","value"],"mappings":";;;;;;AA6Ba,MAAAA,IAA2B,CAACC,MAA4D;AACjG,QAAMC,IAA6C,CAAC;AAC3C,SAAAC,EAAA,QAAQF,GAAU,CAACG,MAAU;AAClC,QAAIC,EAAgCD,CAAK,KAAKA,EAAM,SAASE;AACzD,MAAAJ,EAAO,KAAKK,EAAqBH,EAAM,KAAK,CAAC;AAAA,aACtCC,EAAwCD,CAAK,KAAKA,EAAM,MAAM,UAAU;AAC/E,YAAMI,IAAeR,E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C,MAA2BA,IAAQV,EAAW,KAAK,CAACO,MAASA,EAAK,UAAUG,CAAK,IAAI;AAAA,IACtF,CAACV,CAAU;AAAA,EACf;AAEO,SAAA;AAAA,IACH,OAAAM;AAAA,IACA,WAAAP;AAAA,IACA,YAAAJ;AAAA,IACA,YAAAG;AAAA,IACA,aAAAG;AAAA,IACA,eAAAL;AAAA,IACA,gBAAAY;AAAA,EACJ;AACJ;"}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
thumb: r
|
|
1
|
+
const t = "_root_fs3zj_5", o = "_thumb_fs3zj_17", s = "_track_fs3zj_21", _ = "_range_fs3zj_28", r = {
|
|
2
|
+
root: t,
|
|
3
|
+
thumb: o,
|
|
4
|
+
track: s,
|
|
5
|
+
range: _
|
|
7
6
|
};
|
|
8
7
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
r as thumb
|
|
8
|
+
r as default,
|
|
9
|
+
_ as range,
|
|
10
|
+
t as root,
|
|
11
|
+
o as thumb,
|
|
12
|
+
s as track
|
|
15
13
|
};
|
|
16
14
|
//# sourceMappingURL=fondue-components63.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components63.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components63.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
const m = "_root_hrjmg_5", t = "_small_hrjmg_33", _ = "_medium_hrjmg_37", o = "_large_hrjmg_41", r = "_thumb_hrjmg_55", s = {
|
|
2
|
+
root: m,
|
|
3
|
+
small: t,
|
|
4
|
+
medium: _,
|
|
5
|
+
large: o,
|
|
6
|
+
thumb: r
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
s as default,
|
|
10
|
+
o as large,
|
|
11
|
+
_ as medium,
|
|
12
|
+
m as root,
|
|
13
|
+
t as small,
|
|
14
|
+
r as thumb
|
|
10
15
|
};
|
|
11
16
|
//# sourceMappingURL=fondue-components64.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components64.js","sources":[
|
|
1
|
+
{"version":3,"file":"fondue-components64.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_table_lj8j6_4", o = "_headerCell_lj8j6_18", l = "_rowCell_lj8j6_19", e = "_caption_lj8j6_46", _ = "_cellContent_lj8j6_71", n = "_sortIndicator_lj8j6_96", c = "_body_lj8j6_100", j = "_row_lj8j6_19", r = "_buttonText_lj8j6_164", s = {
|
|
2
2
|
table: t,
|
|
3
|
-
headerCell:
|
|
4
|
-
rowCell:
|
|
5
|
-
caption:
|
|
3
|
+
headerCell: o,
|
|
4
|
+
rowCell: l,
|
|
5
|
+
caption: e,
|
|
6
6
|
cellContent: _,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
sortIndicator: n,
|
|
8
|
+
body: c,
|
|
9
|
+
row: j,
|
|
10
|
+
buttonText: r
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
c as body,
|
|
14
|
+
r as buttonText,
|
|
15
|
+
e as caption,
|
|
16
16
|
_ as cellContent,
|
|
17
17
|
s as default,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
o as headerCell,
|
|
19
|
+
j as row,
|
|
20
|
+
l as rowCell,
|
|
21
|
+
n as sortIndicator,
|
|
22
22
|
t as table
|
|
23
23
|
};
|
|
24
24
|
//# sourceMappingURL=fondue-components66.js.map
|
|
@@ -1,141 +1,152 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { IconCross as
|
|
1
|
+
import { jsx as e, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { IconCross as j } from "@frontify/fondue-icons";
|
|
3
3
|
import * as d from "@radix-ui/react-dialog";
|
|
4
|
-
import { createContext as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
import { createContext as q, forwardRef as l, useRef as B, useContext as z } from "react";
|
|
5
|
+
import { useSyncRefs as E } from "./fondue-components41.js";
|
|
6
|
+
import { addAutoFocusAttribute as L, addShowFocusRing as $ } from "./fondue-components42.js";
|
|
7
|
+
import { useFondueTheme as k, ThemeProvider as G } from "./fondue-components27.js";
|
|
8
|
+
import n from "./fondue-components43.js";
|
|
9
|
+
const p = q({ isModal: !1 }), f = ({ children: t, ...o }) => /* @__PURE__ */ e(p.Provider, { value: { isModal: o.modal ?? !1 }, children: /* @__PURE__ */ e(d.Root, { ...o, children: t }) });
|
|
10
|
+
f.displayName = "Dialog.Root";
|
|
11
|
+
const y = ({ asChild: t = !0, children: o, "data-test-id": a = "fondue-dialog-trigger", ...i }, r) => /* @__PURE__ */ e(
|
|
11
12
|
d.Trigger,
|
|
12
13
|
{
|
|
13
|
-
onMouseDown:
|
|
14
|
+
onMouseDown: L,
|
|
14
15
|
"data-auto-focus-visible": "true",
|
|
15
16
|
"data-auto-focus-trigger": !0,
|
|
16
|
-
"data-test-id":
|
|
17
|
+
"data-test-id": a,
|
|
17
18
|
asChild: t,
|
|
18
19
|
ref: r,
|
|
19
20
|
...i,
|
|
20
|
-
children:
|
|
21
|
+
children: o
|
|
21
22
|
}
|
|
22
23
|
);
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
const { isModal:
|
|
26
|
-
return
|
|
27
|
-
},
|
|
24
|
+
y.displayName = "Dialog.Trigger";
|
|
25
|
+
const I = ({ children: t, showUnderlay: o }) => {
|
|
26
|
+
const { isModal: a } = z(p);
|
|
27
|
+
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 });
|
|
28
|
+
}, D = ({
|
|
28
29
|
maxWidth: t = "800px",
|
|
29
|
-
minWidth:
|
|
30
|
-
minHeight:
|
|
30
|
+
minWidth: o = "400px",
|
|
31
|
+
minHeight: a = "200px",
|
|
31
32
|
padding: i = "compact",
|
|
32
33
|
verticalAlign: r = "center",
|
|
33
34
|
"data-test-id": s = "fondue-dialog-content",
|
|
34
|
-
showUnderlay:
|
|
35
|
-
rounded:
|
|
36
|
-
children:
|
|
37
|
-
...
|
|
38
|
-
},
|
|
39
|
-
const
|
|
40
|
-
|
|
35
|
+
showUnderlay: R = !1,
|
|
36
|
+
rounded: T = !0,
|
|
37
|
+
children: w,
|
|
38
|
+
...S
|
|
39
|
+
}, M) => {
|
|
40
|
+
const A = k(), c = B(null);
|
|
41
|
+
E(c, M);
|
|
42
|
+
const H = (O) => {
|
|
43
|
+
var m;
|
|
44
|
+
O.preventDefault();
|
|
45
|
+
const u = (m = c.current) == null ? void 0 : m.querySelector('[data-dialog-layout-component="body"]'), g = u == null ? void 0 : u.querySelector(
|
|
46
|
+
'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'
|
|
47
|
+
);
|
|
48
|
+
g instanceof HTMLElement && g.focus();
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ e(d.Portal, { children: /* @__PURE__ */ e(G, { theme: A, children: /* @__PURE__ */ e(I, { showUnderlay: R, children: /* @__PURE__ */ e(
|
|
41
51
|
d.Content,
|
|
42
52
|
{
|
|
43
53
|
style: {
|
|
44
54
|
"--dialog-max-width": t,
|
|
45
|
-
"--dialog-min-width":
|
|
46
|
-
"--dialog-min-height":
|
|
55
|
+
"--dialog-min-width": o,
|
|
56
|
+
"--dialog-min-height": a
|
|
47
57
|
},
|
|
48
|
-
ref:
|
|
49
|
-
className:
|
|
50
|
-
onFocus:
|
|
58
|
+
ref: c,
|
|
59
|
+
className: n.content,
|
|
60
|
+
onFocus: $,
|
|
61
|
+
onOpenAutoFocus: H,
|
|
51
62
|
"data-dialog-padding": i,
|
|
52
|
-
"data-dialog-rounded":
|
|
63
|
+
"data-dialog-rounded": T,
|
|
53
64
|
"data-test-id": s,
|
|
54
65
|
"data-dialog-vertical-align": r,
|
|
55
|
-
...
|
|
56
|
-
children:
|
|
66
|
+
...S,
|
|
67
|
+
children: w
|
|
57
68
|
}
|
|
58
69
|
) }) }) });
|
|
59
70
|
};
|
|
60
|
-
|
|
61
|
-
const
|
|
71
|
+
D.displayName = "Dialog.Content";
|
|
72
|
+
const h = ({
|
|
62
73
|
padding: t,
|
|
63
|
-
showBorder:
|
|
64
|
-
showCloseButton:
|
|
74
|
+
showBorder: o = !0,
|
|
75
|
+
showCloseButton: a = !0,
|
|
65
76
|
children: i,
|
|
66
77
|
"data-test-id": r = "fondue-dialog-header"
|
|
67
|
-
}, s) => /* @__PURE__ */
|
|
78
|
+
}, s) => /* @__PURE__ */ P(
|
|
68
79
|
"div",
|
|
69
80
|
{
|
|
70
81
|
"data-test-id": r,
|
|
71
82
|
ref: s,
|
|
72
|
-
className:
|
|
83
|
+
className: n.header,
|
|
73
84
|
"data-dialog-header-padding": t,
|
|
74
|
-
"data-show-border":
|
|
75
|
-
"data-dialog-layout-component":
|
|
85
|
+
"data-show-border": o,
|
|
86
|
+
"data-dialog-layout-component": "header",
|
|
76
87
|
children: [
|
|
77
|
-
/* @__PURE__ */
|
|
78
|
-
|
|
88
|
+
/* @__PURE__ */ e("div", { children: i }),
|
|
89
|
+
a && /* @__PURE__ */ e(d.Close, { role: "button", "data-test-id": `${r}-close`, className: "tw-cursor-pointer", children: /* @__PURE__ */ e(j, { size: 20 }) })
|
|
79
90
|
]
|
|
80
91
|
}
|
|
81
92
|
);
|
|
82
|
-
|
|
83
|
-
const
|
|
93
|
+
h.displayName = "Dialog.Header";
|
|
94
|
+
const C = ({ padding: t, showBorder: o = !0, children: a, "data-test-id": i = "fondue-dialog-footer" }, r) => /* @__PURE__ */ e(
|
|
84
95
|
"div",
|
|
85
96
|
{
|
|
86
97
|
"data-test-id": i,
|
|
87
98
|
ref: r,
|
|
88
|
-
className:
|
|
99
|
+
className: n.footer,
|
|
89
100
|
"data-dialog-footer-padding": t,
|
|
90
|
-
"data-show-border":
|
|
91
|
-
"data-dialog-layout-component":
|
|
92
|
-
children:
|
|
101
|
+
"data-show-border": o,
|
|
102
|
+
"data-dialog-layout-component": "footer",
|
|
103
|
+
children: a
|
|
93
104
|
}
|
|
94
105
|
);
|
|
95
|
-
|
|
96
|
-
const
|
|
106
|
+
C.displayName = "Dialog.Footer";
|
|
107
|
+
const N = ({ padding: t, children: o, "data-test-id": a = "fondue-dialog-body" }, i) => /* @__PURE__ */ e(
|
|
97
108
|
"div",
|
|
98
109
|
{
|
|
99
|
-
"data-test-id":
|
|
110
|
+
"data-test-id": a,
|
|
100
111
|
ref: i,
|
|
101
|
-
className:
|
|
112
|
+
className: n.body,
|
|
102
113
|
"data-dialog-body-padding": t,
|
|
103
|
-
"data-dialog-layout-component":
|
|
104
|
-
children:
|
|
114
|
+
"data-dialog-layout-component": "body",
|
|
115
|
+
children: o
|
|
105
116
|
}
|
|
106
117
|
);
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
Root:
|
|
118
|
-
Title:
|
|
119
|
-
Description:
|
|
120
|
-
Close:
|
|
121
|
-
Trigger:
|
|
122
|
-
Content:
|
|
123
|
-
Header:
|
|
124
|
-
Footer:
|
|
125
|
-
Body:
|
|
126
|
-
SideContent:
|
|
118
|
+
N.displayName = "Dialog.Body";
|
|
119
|
+
const b = ({ 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 });
|
|
120
|
+
b.displayName = "Dialog.SideContent";
|
|
121
|
+
const v = ({ children: t }) => /* @__PURE__ */ e(d.Close, { asChild: !0, children: t });
|
|
122
|
+
v.displayName = "Dialog.Close";
|
|
123
|
+
const x = ({ children: t, asChild: o }) => /* @__PURE__ */ e(d.Title, { asChild: o, children: t });
|
|
124
|
+
x.displayName = "Dialog.Title";
|
|
125
|
+
const F = ({ children: t, asChild: o }) => /* @__PURE__ */ e(d.Description, { asChild: o, children: t });
|
|
126
|
+
F.displayName = "Dialog.Description";
|
|
127
|
+
const Y = {
|
|
128
|
+
Root: f,
|
|
129
|
+
Title: x,
|
|
130
|
+
Description: F,
|
|
131
|
+
Close: v,
|
|
132
|
+
Trigger: l(y),
|
|
133
|
+
Content: l(D),
|
|
134
|
+
Header: l(h),
|
|
135
|
+
Footer: l(C),
|
|
136
|
+
Body: l(N),
|
|
137
|
+
SideContent: l(b)
|
|
127
138
|
};
|
|
128
139
|
export {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
+
Y as Dialog,
|
|
141
|
+
N as DialogBody,
|
|
142
|
+
v as DialogClose,
|
|
143
|
+
D as DialogContent,
|
|
144
|
+
F as DialogDescription,
|
|
145
|
+
C as DialogFooter,
|
|
146
|
+
h as DialogHeader,
|
|
147
|
+
f as DialogRoot,
|
|
148
|
+
b as DialogSideContent,
|
|
149
|
+
x as DialogTitle,
|
|
150
|
+
y as DialogTrigger
|
|
140
151
|
};
|
|
141
152
|
//# sourceMappingURL=fondue-components7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components7.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 { createContext, forwardRef, useContext, type CSSProperties, type ForwardedRef, type ReactNode } from 'react';\n\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 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 });\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n return (\n <DialogContext.Provider value={{ isModal: props.modal ?? false }}>\n <RadixDialog.Root {...props}>{children}</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', ...props }: 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 {...props}\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 ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const theme = useFondueTheme();\n return (\n <RadixDialog.Portal>\n <ThemeProvider theme={theme}>\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={ref}\n className={styles.content}\n onFocus={addShowFocusRing}\n data-dialog-padding={padding}\n data-dialog-rounded={rounded}\n data-test-id={dataTestId}\n data-dialog-vertical-align={verticalAlign}\n {...props}\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 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\n >\n <div>{children}</div>\n {showCloseButton && (\n <RadixDialog.Close role=\"button\" data-test-id={`${dataTestId}-close`} className=\"tw-cursor-pointer\">\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\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\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","props","RadixDialog","DialogTrigger","asChild","dataTestId","ref","jsx","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","useFondueTheme","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","jsxs","IconCross","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;AAqIA,MAAMA,IAAgBC,EAAiC,EAAE,SAAS,IAAO,GAE5DC,IAAa,CAAC,EAAE,UAAAC,GAAU,GAAGC,0BAEjCJ,EAAc,UAAd,EAAuB,OAAO,EAAE,SAASI,EAAM,SAAS,GAAM,GAC3D,4BAACC,EAAY,MAAZ,EAAkB,GAAGD,GAAQ,UAAAD,EAAS,CAAA,GAC3C;AAGRD,EAAW,cAAc;AAElB,MAAMI,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAJ,GAAU,gBAAgBK,IAAa,yBAAyB,GAAGJ,EAAM,GAC3FK,MAGI,gBAAAC;AAAA,EAACL,EAAY;AAAA,EAAZ;AAAA,IACG,aAAaM;AAAA,IACb,2BAAwB;AAAA,IACxB,2BAAuB;AAAA,IACvB,gBAAcH;AAAA,IACd,SAAAD;AAAA,IACA,KAAAE;AAAA,IACC,GAAGL;AAAA,IAEH,UAAAD;AAAA,EAAA;AACL;AAGRG,EAAc,cAAc;AAE5B,MAAMM,IAAiB,CAAC,EAAE,UAAAT,GAAU,cAAAU,QAAmE;AACnG,QAAM,EAAE,SAAAC,EAAA,IAAYC,EAAWf,CAAa;AAC5C,SAAIc,IAEI,gBAAAJ,EAACL,EAAY,SAAZ,EAAoB,gBAAcQ,GAAc,WAAWG,EAAO,UAC9D,UAAAb,GACL,sBAIH,OAAI,EAAA,WAAWa,EAAO,UAAU,gBAAcH,GAC1C,UAAAV,GACL;AAER,GAEac,IAAgB,CACzB;AAAA,EACI,UAAAC,IAAW;AAA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EAAY,cAAc;AAEnB,MAAMC,IAAoB,CAAC,EAAE,UAAAnC,GAAU,SAAAI,QAClC,gBAAAG,EAAAL,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAEhEmC,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAMrC;AAAA,EACN,OAAOmC;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkDlC,CAAa;AAAA,EACxE,SAASkC,EAA+CvB,CAAa;AAAA,EACrE,QAAQuB,EAA8CZ,CAAY;AAAA,EAClE,QAAQY,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
1
|
+
{"version":3,"file":"fondue-components7.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 useRef,\n type CSSProperties,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\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 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 });\n\nexport const DialogRoot = ({ children, ...props }: DialogRootProps) => {\n return (\n <DialogContext.Provider value={{ isModal: props.modal ?? false }}>\n <RadixDialog.Root {...props}>{children}</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', ...props }: 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 {...props}\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 ...props\n }: DialogContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const theme = 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, [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}>\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 {...props}\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 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 role=\"button\" data-test-id={`${dataTestId}-close`} className=\"tw-cursor-pointer\">\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","props","RadixDialog","DialogTrigger","asChild","dataTestId","ref","jsx","addAutoFocusAttribute","DialogUnderlay","showUnderlay","isModal","useContext","styles","DialogContent","maxWidth","minWidth","minHeight","padding","verticalAlign","rounded","theme","useFondueTheme","contentRef","useRef","useSyncRefs","handleOpenAutoFocus","event","dialogBody","_a","firstFocusable","ThemeProvider","addShowFocusRing","DialogHeader","showBorder","showCloseButton","jsxs","IconCross","DialogFoo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AA1C,GAAU,SAAAI,QAC5B,gBAAAG,EAAAL,EAAY,OAAZ,EAAkB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAE1D0C,EAAY,cAAc;AAEnB,MAAMC,IAAoB,CAAC,EAAE,UAAA3C,GAAU,SAAAI,QAClC,gBAAAG,EAAAL,EAAY,aAAZ,EAAwB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAEhE2C,EAAkB,cAAc;AAEzB,MAAMC,IAAS;AAAA,EAClB,MAAM7C;AAAA,EACN,OAAO2C;AAAA,EACP,aAAaC;AAAA,EACb,OAAOF;AAAA,EACP,SAASI,EAAkD1C,CAAa;AAAA,EACxE,SAAS0C,EAA+C/B,CAAa;AAAA,EACrE,QAAQ+B,EAA8CZ,CAAY;AAAA,EAClE,QAAQY,EAA8CP,CAAY;AAAA,EAClE,MAAMO,EAA4CN,CAAU;AAAA,EAC5D,aAAaM,EAAmDL,CAAiB;AACrF;"}
|
|
@@ -2,7 +2,7 @@ import { jsx as d } from "react/jsx-runtime";
|
|
|
2
2
|
import * as m from "@radix-ui/react-separator";
|
|
3
3
|
import { forwardRef as s } from "react";
|
|
4
4
|
import { cn as f } from "./fondue-components31.js";
|
|
5
|
-
import { dividerStyles as p } from "./fondue-
|
|
5
|
+
import { dividerStyles as p } from "./fondue-components44.js";
|
|
6
6
|
const n = s(
|
|
7
7
|
({
|
|
8
8
|
"data-test-id": r = "fondue-divider",
|