@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.
Files changed (75) hide show
  1. package/dist/fondue-components10.js +1 -1
  2. package/dist/fondue-components11.js +2 -2
  3. package/dist/fondue-components12.js +1 -1
  4. package/dist/fondue-components13.js +1 -1
  5. package/dist/fondue-components15.js +1 -1
  6. package/dist/fondue-components16.js +1 -1
  7. package/dist/fondue-components17.js +26 -24
  8. package/dist/fondue-components17.js.map +1 -1
  9. package/dist/fondue-components18.js +1 -1
  10. package/dist/fondue-components19.js +2 -2
  11. package/dist/fondue-components20.js +6 -6
  12. package/dist/fondue-components21.js +1 -1
  13. package/dist/fondue-components22.js +1 -1
  14. package/dist/fondue-components23.js +1 -1
  15. package/dist/fondue-components24.js +1 -1
  16. package/dist/fondue-components32.js +1 -1
  17. package/dist/fondue-components32.js.map +1 -1
  18. package/dist/fondue-components41.js +8 -13
  19. package/dist/fondue-components41.js.map +1 -1
  20. package/dist/fondue-components42.js +13 -15
  21. package/dist/fondue-components42.js.map +1 -1
  22. package/dist/fondue-components43.js +15 -60
  23. package/dist/fondue-components43.js.map +1 -1
  24. package/dist/fondue-components44.js +59 -17
  25. package/dist/fondue-components44.js.map +1 -1
  26. package/dist/fondue-components45.js +18 -19
  27. package/dist/fondue-components45.js.map +1 -1
  28. package/dist/fondue-components46.js +18 -4
  29. package/dist/fondue-components46.js.map +1 -1
  30. package/dist/fondue-components47.js +3 -13
  31. package/dist/fondue-components47.js.map +1 -1
  32. package/dist/fondue-components48.js +13 -3
  33. package/dist/fondue-components48.js.map +1 -1
  34. package/dist/fondue-components49.js +3 -17
  35. package/dist/fondue-components49.js.map +1 -1
  36. package/dist/fondue-components50.js +19 -35
  37. package/dist/fondue-components50.js.map +1 -1
  38. package/dist/fondue-components51.js +35 -7
  39. package/dist/fondue-components51.js.map +1 -1
  40. package/dist/fondue-components52.js +6 -12
  41. package/dist/fondue-components52.js.map +1 -1
  42. package/dist/fondue-components53.js +12 -4
  43. package/dist/fondue-components53.js.map +1 -1
  44. package/dist/fondue-components54.js +4 -24
  45. package/dist/fondue-components54.js.map +1 -1
  46. package/dist/fondue-components55.js +24 -16
  47. package/dist/fondue-components55.js.map +1 -1
  48. package/dist/fondue-components56.js +16 -141
  49. package/dist/fondue-components56.js.map +1 -1
  50. package/dist/fondue-components57.js +142 -16
  51. package/dist/fondue-components57.js.map +1 -1
  52. package/dist/fondue-components58.js +16 -73
  53. package/dist/fondue-components58.js.map +1 -1
  54. package/dist/fondue-components59.js +73 -8
  55. package/dist/fondue-components59.js.map +1 -1
  56. package/dist/fondue-components60.js +8 -33
  57. package/dist/fondue-components60.js.map +1 -1
  58. package/dist/fondue-components61.js +32 -48
  59. package/dist/fondue-components61.js.map +1 -1
  60. package/dist/fondue-components62.js +48 -10
  61. package/dist/fondue-components62.js.map +1 -1
  62. package/dist/fondue-components63.js +10 -12
  63. package/dist/fondue-components63.js.map +1 -1
  64. package/dist/fondue-components64.js +12 -7
  65. package/dist/fondue-components64.js.map +1 -1
  66. package/dist/fondue-components66.js +15 -15
  67. package/dist/fondue-components7.js +98 -87
  68. package/dist/fondue-components7.js.map +1 -1
  69. package/dist/fondue-components76.js +1 -1
  70. package/dist/fondue-components8.js +1 -1
  71. package/dist/fondue-components9.js +74 -71
  72. package/dist/fondue-components9.js.map +1 -1
  73. package/dist/index.d.ts +10 -0
  74. package/dist/style.css +1 -1
  75. package/package.json +5 -5
@@ -1,14 +1,52 @@
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: _
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
- r as default,
9
- _ as range,
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,EAAyBI,EAAM,MAAM,QAAQ;AAClE,iBAAWK,KAAeD;AACtB,QAAAN,EAAO,KAAKO,CAAW;AAAA,IAC3B;AAAA,EACJ,CACH,GACMP;AACX,GAQaQ,IAAgB,CAACT,MAAwB;AAClD,QAAM,CAACU,G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AAAA,IACA,YAAAG;AAAA,IACA,aAAAG;AAAA,IACA,eAAAL;AAAA,IACA,gBAAAY;AAAA,EACJ;AACJ;"}
@@ -1,16 +1,14 @@
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
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
- s as default,
10
- o as large,
11
- _ as medium,
12
- m as root,
13
- t as small,
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
- import { useEffect as f } from "react";
2
- import { syncRefs as o } from "./fondue-components41.js";
3
- const m = (s, e) => {
4
- f(() => {
5
- o(s, e);
6
- }, [s]);
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
- m as useSyncRefs
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":["../src/hooks/useSyncRefs.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ForwardedRef, useEffect, type RefObject } from 'react';\n\nimport { syncRefs } from '#/utilities/domUtilities';\n\n/**\n * A custom React hook that synchronizes a local ref with a forwarded ref.\n * This is useful when you need to maintain both an internal reference to a DOM element\n * and allow external access through a forwarded ref.\n *\n * @template TElement - The type of the DOM element being referenced. Defaults to HTMLElement.\n * @param {RefObject<TElement>} localRef - The local ref object used internally by the component.\n * @param {ForwardedRef<TElement>} forwardedRef - The ref forwarded from a parent component.\n *\n * @example\n * ```tsx\n * const MyComponent = forwardRef<HTMLDivElement>((props, ref) => {\n * const localRef = useRef<HTMLDivElement>(null);\n * useSyncRefs(localRef, ref);\n *\n * return <div ref={localRef}>Content</div>;\n * });\n * ```\n */\nexport const useSyncRefs = <TElement = HTMLElement>(\n localRef: RefObject<TElement>,\n forwardedRef: ForwardedRef<TElement>,\n) => {\n useEffect(() => {\n syncRefs<TElement>(localRef, forwardedRef);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [localRef]);\n};\n"],"names":["useSyncRefs","localRef","forwardedRef","useEffect","syncRefs"],"mappings":";;AAyBa,MAAAA,IAAc,CACvBC,GACAC,MACC;AACD,EAAAC,EAAU,MAAM;AACZ,IAAAC,EAAmBH,GAAUC,CAAY;AAAA,EAAA,GAE1C,CAACD,CAAQ,CAAC;AACjB;"}
1
+ {"version":3,"file":"fondue-components64.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,24 +1,24 @@
1
- const t = "_table_1nbhe_4", e = "_headerCell_1nbhe_18", o = "_rowCell_1nbhe_19", n = "_caption_1nbhe_46", _ = "_cellContent_1nbhe_71", l = "_buttonText_1nbhe_90", c = "_sortIndicator_1nbhe_99", b = "_body_1nbhe_103", r = "_row_1nbhe_19", s = {
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: e,
4
- rowCell: o,
5
- caption: n,
3
+ headerCell: o,
4
+ rowCell: l,
5
+ caption: e,
6
6
  cellContent: _,
7
- buttonText: l,
8
- sortIndicator: c,
9
- body: b,
10
- row: r
7
+ sortIndicator: n,
8
+ body: c,
9
+ row: j,
10
+ buttonText: r
11
11
  };
12
12
  export {
13
- b as body,
14
- l as buttonText,
15
- n as caption,
13
+ c as body,
14
+ r as buttonText,
15
+ e as caption,
16
16
  _ as cellContent,
17
17
  s as default,
18
- e as headerCell,
19
- r as row,
20
- o as rowCell,
21
- c as sortIndicator,
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 o, jsxs as R } from "react/jsx-runtime";
2
- import { IconCross as M } from "@frontify/fondue-icons";
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 S, forwardRef as n, useContext as B } from "react";
5
- import { addAutoFocusAttribute as H, addShowFocusRing as P } from "./fondue-components41.js";
6
- import { useFondueTheme as j, ThemeProvider as A } from "./fondue-components27.js";
7
- import l from "./fondue-components42.js";
8
- const g = S({ isModal: !1 }), u = ({ children: t, ...a }) => /* @__PURE__ */ o(g.Provider, { value: { isModal: a.modal ?? !1 }, children: /* @__PURE__ */ o(d.Root, { ...a, children: t }) });
9
- u.displayName = "Dialog.Root";
10
- const c = ({ asChild: t = !0, children: a, "data-test-id": e = "fondue-dialog-trigger", ...i }, r) => /* @__PURE__ */ o(
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: H,
14
+ onMouseDown: L,
14
15
  "data-auto-focus-visible": "true",
15
16
  "data-auto-focus-trigger": !0,
16
- "data-test-id": e,
17
+ "data-test-id": a,
17
18
  asChild: t,
18
19
  ref: r,
19
20
  ...i,
20
- children: a
21
+ children: o
21
22
  }
22
23
  );
23
- c.displayName = "Dialog.Trigger";
24
- const z = ({ children: t, showUnderlay: a }) => {
25
- const { isModal: e } = B(g);
26
- return e ? /* @__PURE__ */ o(d.Overlay, { "data-visible": a, className: l.underlay, children: t }) : /* @__PURE__ */ o("div", { className: l.underlay, "data-visible": a, children: t });
27
- }, m = ({
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: a = "400px",
30
- minHeight: e = "200px",
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: v = !1,
35
- rounded: x = !0,
36
- children: b,
37
- ...T
38
- }, w) => {
39
- const F = j();
40
- return /* @__PURE__ */ o(d.Portal, { children: /* @__PURE__ */ o(A, { theme: F, children: /* @__PURE__ */ o(z, { showUnderlay: v, children: /* @__PURE__ */ o(
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": a,
46
- "--dialog-min-height": e
55
+ "--dialog-min-width": o,
56
+ "--dialog-min-height": a
47
57
  },
48
- ref: w,
49
- className: l.content,
50
- onFocus: P,
58
+ ref: c,
59
+ className: n.content,
60
+ onFocus: $,
61
+ onOpenAutoFocus: H,
51
62
  "data-dialog-padding": i,
52
- "data-dialog-rounded": x,
63
+ "data-dialog-rounded": T,
53
64
  "data-test-id": s,
54
65
  "data-dialog-vertical-align": r,
55
- ...T,
56
- children: b
66
+ ...S,
67
+ children: w
57
68
  }
58
69
  ) }) }) });
59
70
  };
60
- m.displayName = "Dialog.Content";
61
- const p = ({
71
+ D.displayName = "Dialog.Content";
72
+ const h = ({
62
73
  padding: t,
63
- showBorder: a = !0,
64
- showCloseButton: e = !0,
74
+ showBorder: o = !0,
75
+ showCloseButton: a = !0,
65
76
  children: i,
66
77
  "data-test-id": r = "fondue-dialog-header"
67
- }, s) => /* @__PURE__ */ R(
78
+ }, s) => /* @__PURE__ */ P(
68
79
  "div",
69
80
  {
70
81
  "data-test-id": r,
71
82
  ref: s,
72
- className: l.header,
83
+ className: n.header,
73
84
  "data-dialog-header-padding": t,
74
- "data-show-border": a,
75
- "data-dialog-layout-component": !0,
85
+ "data-show-border": o,
86
+ "data-dialog-layout-component": "header",
76
87
  children: [
77
- /* @__PURE__ */ o("div", { children: i }),
78
- e && /* @__PURE__ */ o(d.Close, { role: "button", "data-test-id": `${r}-close`, className: "tw-cursor-pointer", children: /* @__PURE__ */ o(M, { size: 20 }) })
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
- p.displayName = "Dialog.Header";
83
- const D = ({ padding: t, showBorder: a = !0, children: e, "data-test-id": i = "fondue-dialog-footer" }, r) => /* @__PURE__ */ o(
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: l.footer,
99
+ className: n.footer,
89
100
  "data-dialog-footer-padding": t,
90
- "data-show-border": a,
91
- "data-dialog-layout-component": !0,
92
- children: e
101
+ "data-show-border": o,
102
+ "data-dialog-layout-component": "footer",
103
+ children: a
93
104
  }
94
105
  );
95
- D.displayName = "Dialog.Footer";
96
- const y = ({ padding: t, children: a, "data-test-id": e = "fondue-dialog-body" }, i) => /* @__PURE__ */ o(
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": e,
110
+ "data-test-id": a,
100
111
  ref: i,
101
- className: l.body,
112
+ className: n.body,
102
113
  "data-dialog-body-padding": t,
103
- "data-dialog-layout-component": !0,
104
- children: a
114
+ "data-dialog-layout-component": "body",
115
+ children: o
105
116
  }
106
117
  );
107
- y.displayName = "Dialog.Body";
108
- const f = ({ children: t, "data-test-id": a = "fondue-dialog-side-content" }, e) => /* @__PURE__ */ o("div", { "data-test-id": a, ref: e, className: l.sideContent, "data-dialog-layout-component": !0, children: t });
109
- f.displayName = "Dialog.SideContent";
110
- const h = ({ children: t }) => /* @__PURE__ */ o(d.Close, { asChild: !0, children: t });
111
- h.displayName = "Dialog.Close";
112
- const C = ({ children: t, asChild: a }) => /* @__PURE__ */ o(d.Title, { asChild: a, children: t });
113
- C.displayName = "Dialog.Title";
114
- const N = ({ children: t, asChild: a }) => /* @__PURE__ */ o(d.Description, { asChild: a, children: t });
115
- N.displayName = "Dialog.Description";
116
- const I = {
117
- Root: u,
118
- Title: C,
119
- Description: N,
120
- Close: h,
121
- Trigger: n(c),
122
- Content: n(m),
123
- Header: n(p),
124
- Footer: n(D),
125
- Body: n(y),
126
- SideContent: n(f)
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
- I as Dialog,
130
- y as DialogBody,
131
- h as DialogClose,
132
- m as DialogContent,
133
- N as DialogDescription,
134
- D as DialogFooter,
135
- p as DialogHeader,
136
- u as DialogRoot,
137
- f as DialogSideContent,
138
- C as DialogTitle,
139
- c as DialogTrigger
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;AAC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AcF,GAAY,KAAAC,GAAU,WAAWO,EAAO,aAAa,gCAA4B,IAC/F,UAAAb,EACL,CAAA;AAGRgC,EAAkB,cAAc;AAEzB,MAAMC,IAAc,CAAC,EAAE,UAAAjC,0BAClBE,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAF,GAAS;AAEhDiC,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAAlC,GAAU,SAAAI,QAC5B,gBAAAG,EAAAL,EAAY,OAAZ,EAAkB,SAAAE,GAAmB,UAAAJ,EAAS,CAAA;AAE1DkC,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","DialogFooter","DialogBody","DialogSideContent","DialogClose","DialogTitle","DialogDescription","Dialog","forwardRef"],"mappings":";;;;;;;;AA8IA,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,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AAC,IAAoB,CAC7B,EAAE,UAAAxC,GAAU,gBAAgBK,IAAa,gCACzCC,MAGI,gBAAAC,EAAC,OAAI,EAAA,gBAAcF,GAAY,KAAAC,GAAU,WAAWO,EAAO,aAAa,gCAA4B,IAC/F,UAAAb,EACL,CAAA;AAGRwC,EAAkB,cAAc;AAEzB,MAAMC,IAAc,CAAC,EAAE,UAAAzC,0BAClBE,EAAY,OAAZ,EAAkB,SAAO,IAAE,UAAAF,GAAS;AAEhDyC,EAAY,cAAc;AAEnB,MAAMC,IAAc,CAAC,EAAE,UAAA1C,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;"}
@@ -1,5 +1,5 @@
1
1
  import { Children as a, isValidElement as u, cloneElement as f } from "react";
2
- import { ForwardedRefSelectItem as E } from "./fondue-components57.js";
2
+ import { ForwardedRefSelectItem as E } from "./fondue-components58.js";
3
3
  const g = ({
4
4
  children: r,
5
5
  value: o,
@@ -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-components43.js";
5
+ import { dividerStyles as p } from "./fondue-components44.js";
6
6
  const n = s(
7
7
  ({
8
8
  "data-test-id": r = "fondue-divider",