@frontify/fondue-components 25.0.0-rc.3 → 25.0.0-rc.5

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 (126) hide show
  1. package/dist/fondue-components10.js +21 -21
  2. package/dist/fondue-components10.js.map +1 -1
  3. package/dist/fondue-components11.js +74 -72
  4. package/dist/fondue-components11.js.map +1 -1
  5. package/dist/fondue-components13.js.map +1 -1
  6. package/dist/fondue-components15.js +21 -22
  7. package/dist/fondue-components15.js.map +1 -1
  8. package/dist/fondue-components16.js +24 -16
  9. package/dist/fondue-components16.js.map +1 -1
  10. package/dist/fondue-components17.js +22 -23
  11. package/dist/fondue-components17.js.map +1 -1
  12. package/dist/fondue-components18.js +1 -1
  13. package/dist/fondue-components19.js +1 -1
  14. package/dist/fondue-components20.js +8 -8
  15. package/dist/fondue-components20.js.map +1 -1
  16. package/dist/fondue-components21.js +35 -36
  17. package/dist/fondue-components21.js.map +1 -1
  18. package/dist/fondue-components23.js +1 -1
  19. package/dist/fondue-components24.js +1 -1
  20. package/dist/fondue-components25.js +2 -2
  21. package/dist/fondue-components26.js +45 -40
  22. package/dist/fondue-components26.js.map +1 -1
  23. package/dist/fondue-components27.js +1 -1
  24. package/dist/fondue-components28.js +1 -1
  25. package/dist/fondue-components29.js +1 -1
  26. package/dist/fondue-components30.js +3 -3
  27. package/dist/fondue-components31.js +1 -1
  28. package/dist/fondue-components31.js.map +1 -1
  29. package/dist/fondue-components32.js +3 -3
  30. package/dist/fondue-components33.js +22 -23
  31. package/dist/fondue-components33.js.map +1 -1
  32. package/dist/fondue-components34.js +77 -61
  33. package/dist/fondue-components34.js.map +1 -1
  34. package/dist/fondue-components35.js +25 -17
  35. package/dist/fondue-components35.js.map +1 -1
  36. package/dist/fondue-components36.js +2 -2
  37. package/dist/fondue-components37.js +23 -24
  38. package/dist/fondue-components37.js.map +1 -1
  39. package/dist/fondue-components40.js +2 -2
  40. package/dist/fondue-components47.js +1 -1
  41. package/dist/fondue-components53.js +10 -10
  42. package/dist/fondue-components56.js +2 -2
  43. package/dist/fondue-components6.js +20 -20
  44. package/dist/fondue-components6.js.map +1 -1
  45. package/dist/fondue-components60.js +18 -19
  46. package/dist/fondue-components60.js.map +1 -1
  47. package/dist/fondue-components61.js +9 -16
  48. package/dist/fondue-components61.js.map +1 -1
  49. package/dist/fondue-components62.js +36 -10
  50. package/dist/fondue-components62.js.map +1 -1
  51. package/dist/fondue-components63.js +6 -36
  52. package/dist/fondue-components63.js.map +1 -1
  53. package/dist/fondue-components64.js +4 -6
  54. package/dist/fondue-components64.js.map +1 -1
  55. package/dist/fondue-components65.js +11 -3
  56. package/dist/fondue-components65.js.map +1 -1
  57. package/dist/fondue-components66.js +6 -10
  58. package/dist/fondue-components66.js.map +1 -1
  59. package/dist/fondue-components67.js +12 -8
  60. package/dist/fondue-components67.js.map +1 -1
  61. package/dist/fondue-components68.js +4 -12
  62. package/dist/fondue-components68.js.map +1 -1
  63. package/dist/fondue-components69.js +24 -4
  64. package/dist/fondue-components69.js.map +1 -1
  65. package/dist/fondue-components7.js +22 -22
  66. package/dist/fondue-components7.js.map +1 -1
  67. package/dist/fondue-components70.js +16 -24
  68. package/dist/fondue-components70.js.map +1 -1
  69. package/dist/fondue-components71.js +153 -16
  70. package/dist/fondue-components71.js.map +1 -1
  71. package/dist/fondue-components72.js +19 -152
  72. package/dist/fondue-components72.js.map +1 -1
  73. package/dist/fondue-components73.js +81 -19
  74. package/dist/fondue-components73.js.map +1 -1
  75. package/dist/fondue-components74.js +8 -79
  76. package/dist/fondue-components74.js.map +1 -1
  77. package/dist/fondue-components75.js +37 -8
  78. package/dist/fondue-components75.js.map +1 -1
  79. package/dist/fondue-components76.js +70 -36
  80. package/dist/fondue-components76.js.map +1 -1
  81. package/dist/fondue-components77.js +10 -70
  82. package/dist/fondue-components77.js.map +1 -1
  83. package/dist/fondue-components78.js +8 -8
  84. package/dist/fondue-components79.js +5 -9
  85. package/dist/fondue-components79.js.map +1 -1
  86. package/dist/fondue-components80.js +12 -6
  87. package/dist/fondue-components80.js.map +1 -1
  88. package/dist/fondue-components81.js +22 -12
  89. package/dist/fondue-components81.js.map +1 -1
  90. package/dist/fondue-components82.js +34 -23
  91. package/dist/fondue-components82.js.map +1 -1
  92. package/dist/fondue-components83.js +11 -34
  93. package/dist/fondue-components83.js.map +1 -1
  94. package/dist/fondue-components84.js +67 -10
  95. package/dist/fondue-components84.js.map +1 -1
  96. package/dist/fondue-components85.js +14 -67
  97. package/dist/fondue-components85.js.map +1 -1
  98. package/dist/fondue-components86.js +23 -13
  99. package/dist/fondue-components86.js.map +1 -1
  100. package/dist/fondue-components87.js +18 -24
  101. package/dist/fondue-components87.js.map +1 -1
  102. package/dist/fondue-components88.js +24 -18
  103. package/dist/fondue-components88.js.map +1 -1
  104. package/dist/fondue-components89.js +8 -24
  105. package/dist/fondue-components89.js.map +1 -1
  106. package/dist/fondue-components9.js +39 -38
  107. package/dist/fondue-components9.js.map +1 -1
  108. package/dist/fondue-components90.js +20 -8
  109. package/dist/fondue-components90.js.map +1 -1
  110. package/dist/fondue-components91.js +6 -20
  111. package/dist/fondue-components91.js.map +1 -1
  112. package/dist/fondue-components92.js +3 -5
  113. package/dist/fondue-components92.js.map +1 -1
  114. package/dist/fondue-components93.js +4 -4
  115. package/dist/fondue-components93.js.map +1 -1
  116. package/dist/fondue-components94.js +16 -4
  117. package/dist/fondue-components94.js.map +1 -1
  118. package/dist/fondue-components95.js +39 -16
  119. package/dist/fondue-components95.js.map +1 -1
  120. package/dist/fondue-components96.js +20 -39
  121. package/dist/fondue-components96.js.map +1 -1
  122. package/dist/index.d.ts +25 -6
  123. package/dist/style.css +1 -1
  124. package/package.json +32 -32
  125. package/dist/fondue-components97.js +0 -24
  126. package/dist/fondue-components97.js.map +0 -1
@@ -1,32 +1,32 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import * as p from "@radix-ui/react-separator";
3
- import { forwardRef as f } from "react";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import * as f from "@radix-ui/react-separator";
3
+ import { forwardRef as p } from "react";
4
4
  import c from "./fondue-components54.js";
5
- const u = f(
5
+ const u = p(
6
6
  ({
7
- "data-test-id": a = "fondue-divider",
8
- direction: o = "horizontal",
7
+ "data-test-id": t = "fondue-divider",
8
+ direction: a = "horizontal",
9
9
  padding: r = "medium",
10
- className: d = "",
11
- variant: i = "solid",
10
+ className: i = "",
11
+ variant: d = "solid",
12
12
  color: e = "default",
13
- as: m = "div",
14
- decorative: s
15
- }, n) => {
16
- const l = m;
17
- return /* @__PURE__ */ t(
18
- p.Root,
13
+ as: n = "div",
14
+ decorative: m
15
+ }, s) => {
16
+ const l = n;
17
+ return /* @__PURE__ */ o(
18
+ f.Root,
19
19
  {
20
- ref: n,
21
- className: `${c.root} ${d}`,
22
- "data-variant": i,
20
+ ref: s,
21
+ className: [c.root, i].filter(Boolean).join(" "),
22
+ "data-variant": d,
23
23
  "data-color": e,
24
24
  "data-padding": r,
25
- "data-test-id": a,
26
- decorative: s,
27
- "data-orientation": o,
25
+ "data-test-id": t,
26
+ decorative: m,
27
+ "data-orientation": a,
28
28
  asChild: !0,
29
- children: /* @__PURE__ */ t(l, {})
29
+ children: /* @__PURE__ */ o(l, {})
30
30
  }
31
31
  );
32
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components10.js","sources":["../src/components/Divider/Divider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as Separator from '@radix-ui/react-separator';\nimport { forwardRef, type ForwardedRef, type ReactElement } from 'react';\n\nimport styles from './styles/divider.module.scss';\n\ntype DividerStyle = 'noline' | 'dashed' | 'solid';\ntype DividerPadding = 'none' | 'small' | 'medium' | 'large';\ntype DividerDirection = 'horizontal' | 'vertical';\ntype DividerColor = 'weak' | 'default' | 'strong';\n\nexport type DividerProps = {\n /**\n * The style of the divider\n * @default \"solid\"\n */\n variant?: DividerStyle;\n /**\n * The padding of the divider\n * @default \"medium\"\n */\n padding?: DividerPadding;\n /**\n * The color of the divider\n * @default \"default\"\n */\n color?: DividerColor;\n /**\n * The direction of the divider\n * @default \"horizontal\"\n */\n direction?: DividerDirection;\n /**\n * The html element to be used\n * @default \"div\"\n */\n as?: 'div' | 'li';\n /**\n * When `true`, signifies that it is purely visual, carries no semantic\n * meaning, and ensures it is not present in the accessibility tree.\n * @default false\n */\n decorative?: boolean;\n 'data-test-id'?: string;\n className?: string;\n};\n\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(\n (\n {\n 'data-test-id': dataTestId = 'fondue-divider',\n direction = 'horizontal',\n padding = 'medium',\n className = '',\n variant = 'solid',\n color = 'default',\n as = 'div',\n decorative,\n }: DividerProps,\n ref: ForwardedRef<HTMLDivElement | null>,\n ): ReactElement => {\n const Component = as;\n\n return (\n <Separator.Root\n ref={ref}\n className={`${styles.root} ${className}`}\n data-variant={variant}\n data-color={color}\n data-padding={padding}\n data-test-id={dataTestId}\n decorative={decorative}\n data-orientation={direction}\n asChild\n >\n <Component />\n </Separator.Root>\n );\n },\n);\n\nDivider.displayName = 'Divider';\n"],"names":["Divider","forwardRef","dataTestId","direction","padding","className","variant","color","as","decorative","ref","Component","jsx","Separator","styles"],"mappings":";;;;AAgDO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,gBAAgBC,IAAa;AAAA,IAC7B,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU;AAAA,IACV,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU;AAAA,IACV,OAAAC,IAAQ;AAAA,IACR,IAAAC,IAAK;AAAA,IACL,YAAAC;AAAA,EAAA,GAEJC,MACe;AACf,UAAMC,IAAYH;AAElB,WACI,gBAAAI;AAAA,MAACC,EAAU;AAAA,MAAV;AAAA,QACG,KAAAH;AAAA,QACA,WAAW,GAAGI,EAAO,IAAI,IAAIT,CAAS;AAAA,QACtC,gBAAcC;AAAA,QACd,cAAYC;AAAA,QACZ,gBAAcH;AAAA,QACd,gBAAcF;AAAA,QACd,YAAAO;AAAA,QACA,oBAAkBN;AAAA,QAClB,SAAO;AAAA,QAEP,4BAACQ,GAAA,CAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGvB;AACJ;AAEAX,EAAQ,cAAc;"}
1
+ {"version":3,"file":"fondue-components10.js","sources":["../src/components/Divider/Divider.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as Separator from '@radix-ui/react-separator';\nimport { forwardRef, type ForwardedRef, type ReactElement } from 'react';\n\nimport styles from './styles/divider.module.scss';\n\ntype DividerStyle = 'noline' | 'dashed' | 'solid';\ntype DividerPadding = 'none' | 'small' | 'medium' | 'large';\ntype DividerDirection = 'horizontal' | 'vertical';\ntype DividerColor = 'weak' | 'default' | 'strong';\n\nexport type DividerProps = {\n /**\n * The style of the divider\n * @default \"solid\"\n */\n variant?: DividerStyle;\n /**\n * The padding of the divider\n * @default \"medium\"\n */\n padding?: DividerPadding;\n /**\n * The color of the divider\n * @default \"default\"\n */\n color?: DividerColor;\n /**\n * The direction of the divider\n * @default \"horizontal\"\n */\n direction?: DividerDirection;\n /**\n * The html element to be used\n * @default \"div\"\n */\n as?: 'div' | 'li';\n /**\n * When `true`, signifies that it is purely visual, carries no semantic\n * meaning, and ensures it is not present in the accessibility tree.\n * @default false\n */\n decorative?: boolean;\n 'data-test-id'?: string;\n className?: string;\n};\n\nexport const Divider = forwardRef<HTMLDivElement, DividerProps>(\n (\n {\n 'data-test-id': dataTestId = 'fondue-divider',\n direction = 'horizontal',\n padding = 'medium',\n className = '',\n variant = 'solid',\n color = 'default',\n as = 'div',\n decorative,\n }: DividerProps,\n ref: ForwardedRef<HTMLDivElement | null>,\n ): ReactElement => {\n const Component = as;\n\n return (\n <Separator.Root\n ref={ref}\n className={[styles.root, className].filter(Boolean).join(' ')}\n data-variant={variant}\n data-color={color}\n data-padding={padding}\n data-test-id={dataTestId}\n decorative={decorative}\n data-orientation={direction}\n asChild\n >\n <Component />\n </Separator.Root>\n );\n },\n);\n\nDivider.displayName = 'Divider';\n"],"names":["Divider","forwardRef","dataTestId","direction","padding","className","variant","color","as","decorative","ref","Component","jsx","Separator","styles"],"mappings":";;;;AAgDO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,gBAAgBC,IAAa;AAAA,IAC7B,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU;AAAA,IACV,WAAAC,IAAY;AAAA,IACZ,SAAAC,IAAU;AAAA,IACV,OAAAC,IAAQ;AAAA,IACR,IAAAC,IAAK;AAAA,IACL,YAAAC;AAAA,EAAA,GAEJC,MACe;AACf,UAAMC,IAAYH;AAElB,WACI,gBAAAI;AAAA,MAACC,EAAU;AAAA,MAAV;AAAA,QACG,KAAAH;AAAA,QACA,WAAW,CAACI,EAAO,MAAMT,CAAS,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG;AAAA,QAC5D,gBAAcC;AAAA,QACd,cAAYC;AAAA,QACZ,gBAAcH;AAAA,QACd,gBAAcF;AAAA,QACd,YAAAO;AAAA,QACA,oBAAkBN;AAAA,QAClB,SAAO;AAAA,QAEP,4BAACQ,GAAA,CAAA,CAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EAGvB;AACJ;AAEAX,EAAQ,cAAc;"}
@@ -1,88 +1,90 @@
1
- import { jsx as d, jsxs as S } from "react/jsx-runtime";
2
- import { IconCaretRight as x } from "@frontify/fondue-icons";
1
+ import { jsx as d, jsxs as C } from "react/jsx-runtime";
2
+ import { IconCaretRight as _ } from "@frontify/fondue-icons";
3
3
  import * as a from "@radix-ui/react-dropdown-menu";
4
- import { forwardRef as i, useRef as R, useMemo as _, Children as j } from "react";
5
- import { useFondueTheme as C, ThemeProvider as F } from "./fondue-components36.js";
6
- import { useProcessedChildren as I } from "./fondue-components55.js";
4
+ import { forwardRef as i, useRef as R, useMemo as j, Children as B } from "react";
5
+ import { useFondueTheme as F, ThemeProvider as I } from "./fondue-components36.js";
6
+ import { useProcessedChildren as T } from "./fondue-components55.js";
7
7
  import u from "./fondue-components56.js";
8
- const T = ({
8
+ const y = ({
9
9
  children: t,
10
10
  open: o,
11
11
  modal: r = !1,
12
12
  onOpenChange: n,
13
13
  "data-test-id": e = "fondue-dropdown"
14
14
  }) => /* @__PURE__ */ d(a.Root, { open: o, modal: r, onOpenChange: n, "data-test-id": e, children: t });
15
- T.displayName = "Dropdown.Root";
16
- const y = ({
15
+ y.displayName = "Dropdown.Root";
16
+ const M = ({
17
17
  asChild: t = !0,
18
18
  children: o,
19
19
  "data-test-id": r = "fondue-dropdown-trigger",
20
20
  ...n
21
21
  }, e) => /* @__PURE__ */ d(a.Trigger, { asChild: t, "data-test-id": r, ref: e, ...n, children: o });
22
- y.displayName = "Dropdown.Trigger";
23
- const B = {
22
+ M.displayName = "Dropdown.Trigger";
23
+ const L = {
24
24
  compact: 8,
25
25
  comfortable: 12,
26
26
  spacious: 16
27
- }, L = {
27
+ }, k = {
28
28
  compact: 8,
29
29
  spacious: 24
30
- }, M = ({
30
+ }, P = ({
31
31
  side: t = "bottom",
32
32
  align: o = "start",
33
33
  triggerOffset: r = "compact",
34
34
  children: n,
35
35
  preventTriggerFocusOnClose: e,
36
36
  viewportCollisionPadding: s = "compact",
37
- forceMount: p = !1,
38
- "data-test-id": g = "fondue-dropdown-content"
39
- }, D) => {
40
- const b = R(null), { theme: c, dir: l } = C(), w = D || b;
41
- return /* @__PURE__ */ d(a.Portal, { forceMount: p || void 0, children: /* @__PURE__ */ d(F, { theme: c, dir: l, children: /* @__PURE__ */ d(
37
+ forceMount: l = !1,
38
+ onEscapeKeyDown: g,
39
+ "data-test-id": D = "fondue-dropdown-content"
40
+ }, b) => {
41
+ const c = R(null), { theme: p, dir: N } = F(), w = b || c;
42
+ return /* @__PURE__ */ d(a.Portal, { forceMount: l || void 0, children: /* @__PURE__ */ d(I, { theme: p, dir: N, children: /* @__PURE__ */ d(
42
43
  a.Content,
43
44
  {
44
- dir: l,
45
+ dir: N,
45
46
  align: o,
46
- collisionPadding: L[s],
47
- sideOffset: B[r],
47
+ collisionPadding: k[s],
48
+ sideOffset: L[r],
48
49
  side: t,
49
50
  className: u.content,
50
- "data-test-id": g,
51
+ "data-test-id": D,
51
52
  ref: w,
53
+ onEscapeKeyDown: g,
52
54
  onPointerDownOutside: (f) => {
53
- var N;
54
- if (!p || !(f.target instanceof Element) || !(w instanceof Object) || !("current" in w))
55
+ var S;
56
+ if (!l || !(f.target instanceof Element) || !(w instanceof Object) || !("current" in w))
55
57
  return;
56
58
  let m = f.target, h = null;
57
59
  for (; m && m !== document.body && (h = m.getAttribute("aria-controls"), !h); )
58
60
  m = m.parentElement;
59
- h === ((N = w.current) == null ? void 0 : N.id) && f.preventDefault();
61
+ h === ((S = w.current) == null ? void 0 : S.id) && f.preventDefault();
60
62
  },
61
63
  onCloseAutoFocus: (f) => {
62
64
  e && f.preventDefault();
63
65
  },
64
- forceMount: p || void 0,
66
+ forceMount: l || void 0,
65
67
  children: n
66
68
  }
67
69
  ) }) });
68
70
  };
69
- M.displayName = "Dropdown.Content";
70
- const P = ({ children: t, heading: o, "data-test-id": r = "fondue-dropdown-group" }, n) => _(
71
- () => j.toArray(t).filter((s) => s !== null).length > 0,
71
+ P.displayName = "Dropdown.Content";
72
+ const A = ({ children: t, heading: o, "data-test-id": r = "fondue-dropdown-group" }, n) => j(
73
+ () => B.toArray(t).filter((s) => s !== null).length > 0,
72
74
  [t]
73
- ) ? /* @__PURE__ */ S(a.Group, { className: u.group, "data-test-id": r, ref: n, children: [
75
+ ) ? /* @__PURE__ */ C(a.Group, { className: u.group, "data-test-id": r, ref: n, children: [
74
76
  o ? /* @__PURE__ */ d("div", { className: u.groupHeading, children: /* @__PURE__ */ d("span", { "aria-label": o, children: o }) }) : null,
75
77
  t
76
78
  ] }) : null;
77
- P.displayName = "Dropdown.Group";
78
- const A = ({
79
+ A.displayName = "Dropdown.Group";
80
+ const G = ({
79
81
  children: t,
80
82
  "data-test-id": o = "fondue-dropdown-submenu"
81
83
  }) => /* @__PURE__ */ d(a.Sub, { "data-test-id": o, children: t });
82
- A.displayName = "Dropdown.SubMenu";
83
- const G = ({ children: t, "data-test-id": o = "fondue-dropdown-subtrigger" }, r) => {
84
- const { content: n } = I(t), e = R(!1);
85
- return /* @__PURE__ */ S(
84
+ G.displayName = "Dropdown.SubMenu";
85
+ const O = ({ children: t, "data-test-id": o = "fondue-dropdown-subtrigger" }, r) => {
86
+ const { content: n } = T(t), e = R(!1);
87
+ return /* @__PURE__ */ C(
86
88
  a.SubTrigger,
87
89
  {
88
90
  className: u.subTrigger,
@@ -100,15 +102,15 @@ const G = ({ children: t, "data-test-id": o = "fondue-dropdown-subtrigger" }, r)
100
102
  },
101
103
  children: [
102
104
  n,
103
- /* @__PURE__ */ d(x, { className: u.subMenuIndicator, size: 16 })
105
+ /* @__PURE__ */ d(_, { className: u.subMenuIndicator, size: 16 })
104
106
  ]
105
107
  }
106
108
  );
107
109
  };
108
- G.displayName = "Dropdown.SubTrigger";
109
- const O = ({ children: t, "data-test-id": o = "fondue-dropdown-subcontent" }, r) => {
110
- const { theme: n, dir: e } = C();
111
- return /* @__PURE__ */ d(a.Portal, { children: /* @__PURE__ */ d(F, { theme: n, dir: e, children: /* @__PURE__ */ d(
110
+ O.displayName = "Dropdown.SubTrigger";
111
+ const v = ({ children: t, "data-test-id": o = "fondue-dropdown-subcontent" }, r) => {
112
+ const { theme: n, dir: e } = F();
113
+ return /* @__PURE__ */ d(a.Portal, { children: /* @__PURE__ */ d(I, { theme: n, dir: e, children: /* @__PURE__ */ d(
112
114
  a.SubContent,
113
115
  {
114
116
  dir: e,
@@ -119,25 +121,25 @@ const O = ({ children: t, "data-test-id": o = "fondue-dropdown-subcontent" }, r)
119
121
  }
120
122
  ) }) });
121
123
  };
122
- O.displayName = "Dropdown.SubContent";
123
- const v = ({
124
+ v.displayName = "Dropdown.SubContent";
125
+ const E = ({
124
126
  children: t,
125
127
  disabled: o,
126
128
  textValue: r,
127
129
  onSelect: n,
128
130
  emphasis: e = "default",
129
131
  asChild: s = !1,
130
- "data-test-id": p = "fondue-dropdown-subtrigger",
132
+ "data-test-id": l = "fondue-dropdown-subtrigger",
131
133
  ...g
132
134
  }, D) => {
133
- const { content: b } = I(t), c = R(!1);
135
+ const { content: b } = T(t), c = R(!1);
134
136
  return /* @__PURE__ */ d(
135
137
  a.Item,
136
138
  {
137
139
  onSelect: n,
138
140
  className: u.item,
139
141
  textValue: r,
140
- "data-test-id": p,
142
+ "data-test-id": l,
141
143
  "data-emphasis": e,
142
144
  ref: D,
143
145
  disabled: o,
@@ -146,41 +148,41 @@ const v = ({
146
148
  onMouseEnter: () => {
147
149
  c.current = !0;
148
150
  },
149
- onFocus: (l) => {
150
- c.current || (l.target.dataset.showFocusRing = "true");
151
+ onFocus: (p) => {
152
+ c.current || (p.target.dataset.showFocusRing = "true");
151
153
  },
152
- onBlur: (l) => {
153
- l.target.dataset.showFocusRing = "false", c.current = !1;
154
+ onBlur: (p) => {
155
+ p.target.dataset.showFocusRing = "false", c.current = !1;
154
156
  },
155
157
  ...g,
156
158
  children: b
157
159
  }
158
160
  );
159
161
  };
160
- v.displayName = "Dropdown.Item";
161
- const E = ({ children: t, name: o, "data-test-id": r = "fondue-dropdown-slot" }, n) => /* @__PURE__ */ d("div", { "data-name": o, className: u.slot, "data-test-id": r, ref: n, children: t });
162
- E.displayName = "Dropdown.Slot";
163
- const k = i(y), z = i(M), H = i(P), V = i(G), W = i(O), q = i(v), J = i(E), $ = {
164
- Root: T,
165
- Trigger: k,
166
- Content: z,
167
- Group: H,
168
- SubMenu: A,
169
- SubTrigger: V,
170
- SubContent: W,
171
- Item: q,
172
- Slot: J
162
+ E.displayName = "Dropdown.Item";
163
+ const x = ({ children: t, name: o, "data-test-id": r = "fondue-dropdown-slot" }, n) => /* @__PURE__ */ d("div", { "data-name": o, className: u.slot, "data-test-id": r, ref: n, children: t });
164
+ x.displayName = "Dropdown.Slot";
165
+ const z = i(M), H = i(P), V = i(A), W = i(O), q = i(v), J = i(E), K = i(x), tt = {
166
+ Root: y,
167
+ Trigger: z,
168
+ Content: H,
169
+ Group: V,
170
+ SubMenu: G,
171
+ SubTrigger: W,
172
+ SubContent: q,
173
+ Item: J,
174
+ Slot: K
173
175
  };
174
176
  export {
175
- $ as Dropdown,
176
- M as DropdownContent,
177
- P as DropdownGroup,
178
- v as DropdownItem,
179
- T as DropdownRoot,
180
- E as DropdownSlot,
181
- O as DropdownSubContent,
182
- A as DropdownSubMenu,
183
- G as DropdownSubTrigger,
184
- y as DropdownTrigger
177
+ tt as Dropdown,
178
+ P as DropdownContent,
179
+ A as DropdownGroup,
180
+ E as DropdownItem,
181
+ y as DropdownRoot,
182
+ x as DropdownSlot,
183
+ v as DropdownSubContent,
184
+ G as DropdownSubMenu,
185
+ O as DropdownSubTrigger,
186
+ M as DropdownTrigger
185
187
  };
186
188
  //# sourceMappingURL=fondue-components11.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components11.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretRight } from '@frontify/fondue-icons';\nimport * as RadixDropdown from '@radix-ui/react-dropdown-menu';\nimport { Children, forwardRef, useMemo, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { useProcessedChildren } from './hooks/useProcessedChildren';\nimport styles from './styles/dropdown.module.scss';\n\nexport type DropdownRootProps = {\n children?: ReactNode;\n /**\n * When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.\n * @default false\n */\n modal?: boolean;\n /**\n * Controls the open state of the dropdown.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the dropdown changes.\n */\n onOpenChange?: (open: boolean) => void;\n\n 'data-test-id'?: string;\n};\n\nexport const DropdownRoot = ({\n children,\n open,\n modal = false,\n onOpenChange,\n 'data-test-id': dataTestId = 'fondue-dropdown',\n}: DropdownRootProps) => {\n return (\n <RadixDropdown.Root open={open} modal={modal} onOpenChange={onOpenChange} data-test-id={dataTestId}>\n {children}\n </RadixDropdown.Root>\n );\n};\nDropdownRoot.displayName = 'Dropdown.Root';\n\nexport type DropdownTriggerProps = {\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 const DropdownTrigger = (\n {\n asChild = true,\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-trigger',\n ...props\n }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger asChild={asChild} data-test-id={dataTestId} ref={ref} {...props}>\n {children}\n </RadixDropdown.Trigger>\n );\n};\nDropdownTrigger.displayName = 'Dropdown.Trigger';\n\ntype DropdownSpacing = 'compact' | 'comfortable' | 'spacious';\ntype DropdownViewportCollisionPadding = 'compact' | 'spacious';\nexport type DropdownContentProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n /**\n * Defines the alignment of the dropdown.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Defines the spacing between the dropdown and its trigger.\n * @default 'compact'\n */\n triggerOffset?: DropdownSpacing;\n /**\n * Prevents the focus from being set on the trigger when the dropdown is closed.\n */\n preventTriggerFocusOnClose?: boolean;\n /**\n * Define the minimum distance between the dropdown and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: DropdownViewportCollisionPadding;\n /**\n * When true, the content will always be mounted in the DOM. Before enabling, make sure you really need it.\n * @default false\n */\n forceMount?: boolean;\n};\n\nconst SPACING_MAP: Record<DropdownSpacing, number> = {\n compact: 8,\n comfortable: 12,\n spacious: 16,\n};\n\nconst VIEWPORT_COLLISION_PADDING_MAP: Record<DropdownViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n};\n\nexport const DropdownContent = (\n {\n side = 'bottom',\n align = 'start',\n triggerOffset = 'compact',\n children,\n preventTriggerFocusOnClose,\n viewportCollisionPadding = 'compact',\n forceMount = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-content',\n }: DropdownContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const localRef = useRef<HTMLDivElement>(null);\n const { theme, dir } = useFondueTheme();\n const actualRef = ref || localRef;\n return (\n <RadixDropdown.Portal forceMount={forceMount || undefined}>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.Content\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n align={align}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding]}\n sideOffset={SPACING_MAP[triggerOffset]}\n side={side}\n className={styles.content}\n data-test-id={dataTestId}\n ref={actualRef}\n onPointerDownOutside={(event) => {\n if (!forceMount) {\n return;\n }\n\n if (!(event.target instanceof Element)) {\n return;\n }\n\n if (!(actualRef instanceof Object) || !('current' in actualRef)) {\n return;\n }\n\n let element: Element | null = event.target;\n let controlsId: string | null = null;\n\n while (element && element !== document.body) {\n controlsId = element.getAttribute('aria-controls');\n\n if (controlsId) {\n break;\n }\n\n element = element.parentElement;\n }\n\n if (controlsId === actualRef.current?.id) {\n event.preventDefault();\n }\n }}\n onCloseAutoFocus={(event) => {\n if (preventTriggerFocusOnClose) {\n event.preventDefault();\n }\n }}\n forceMount={forceMount || undefined}\n >\n {children}\n </RadixDropdown.Content>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownContent.displayName = 'Dropdown.Content';\n\nexport type DropdownGroupProps = { children: ReactNode; heading?: string; 'data-test-id'?: string };\n\nexport const DropdownGroup = (\n { children, heading, 'data-test-id': dataTestId = 'fondue-dropdown-group' }: DropdownGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const hasChildren = useMemo(\n () => Children.toArray(children).filter((child) => child !== null).length > 0,\n [children],\n );\n\n if (!hasChildren) {\n return null;\n }\n\n return (\n <RadixDropdown.Group className={styles.group} data-test-id={dataTestId} ref={ref}>\n {heading ? (\n <div className={styles.groupHeading}>\n <span aria-label={heading}>{heading}</span>\n </div>\n ) : null}\n {children}\n </RadixDropdown.Group>\n );\n};\nDropdownGroup.displayName = 'Dropdown.Group';\n\nexport type DropdownSubMenuProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubMenu = ({\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-submenu',\n}: DropdownSubMenuProps) => {\n return <RadixDropdown.Sub data-test-id={dataTestId}>{children}</RadixDropdown.Sub>;\n};\nDropdownSubMenu.displayName = 'Dropdown.SubMenu';\n\nexport type DropdownSubTriggerProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger' }: DropdownSubTriggerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n const wasMouseInteracted = useRef(false);\n return (\n <RadixDropdown.SubTrigger\n className={styles.subTrigger}\n data-show-focus-ring={wasMouseInteracted.current}\n data-test-id={dataTestId}\n ref={ref}\n onMouseEnter={() => {\n wasMouseInteracted.current = true;\n }}\n onFocus={(focusEvent) => {\n if (!wasMouseInteracted.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasMouseInteracted.current = false;\n }}\n >\n {content}\n <IconCaretRight className={styles.subMenuIndicator} size={16} />\n </RadixDropdown.SubTrigger>\n );\n};\nDropdownSubTrigger.displayName = 'Dropdown.SubTrigger';\n\nexport type DropdownSubContentProps = {\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownSubContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subcontent' }: DropdownSubContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n return (\n <RadixDropdown.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.SubContent\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n className={styles.subContent}\n data-test-id={dataTestId}\n ref={ref}\n >\n {children}\n </RadixDropdown.SubContent>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownSubContent.displayName = 'Dropdown.SubContent';\n\nexport type DropdownItemProps = {\n children: ReactNode;\n /**\n * Disables the item.\n */\n disabled?: boolean;\n /**\n * The text value of the item that is passed to the onSelect callback.\n */\n textValue?: string;\n /**\n * The style of the item.\n * @default \"default\"\n */\n emphasis?: 'default' | 'danger';\n /**\n * Callback that is called when the item is selected.\n */\n onSelect?: (event: Event) => void;\n /**\n * If true, the item props will be passed to the child element.\n * @default false\n */\n asChild?: boolean;\n 'data-test-id'?: string;\n};\n\nexport const DropdownItem = (\n {\n children,\n disabled,\n textValue,\n onSelect,\n emphasis = 'default',\n asChild = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger',\n ...props\n }: DropdownItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n const wasMouseInteracted = useRef(false);\n\n return (\n <RadixDropdown.Item\n onSelect={onSelect}\n className={styles.item}\n textValue={textValue}\n data-test-id={dataTestId}\n data-emphasis={emphasis}\n ref={ref}\n disabled={disabled}\n asChild={asChild}\n data-show-focus-ring={wasMouseInteracted.current}\n onMouseEnter={() => {\n wasMouseInteracted.current = true;\n }}\n onFocus={(focusEvent) => {\n if (!wasMouseInteracted.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasMouseInteracted.current = false;\n }}\n {...props}\n >\n {content}\n </RadixDropdown.Item>\n );\n};\nDropdownItem.displayName = 'Dropdown.Item';\n\nexport type DropdownSlotProps = { children: ReactNode; name?: 'left' | 'right'; 'data-test-id'?: string };\n\nexport const DropdownSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-dropdown-slot' }: DropdownSlotProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-name={name} className={styles.slot} data-test-id={dataTestId} ref={ref}>\n {children}\n </div>\n );\n};\nDropdownSlot.displayName = 'Dropdown.Slot';\n\nconst ForwardedRefDropdownTrigger = forwardRef<HTMLButtonElement, DropdownTriggerProps>(DropdownTrigger);\nconst ForwardedRefDropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(DropdownContent);\nconst ForwardedRefDropdownGroup = forwardRef<HTMLDivElement, DropdownGroupProps>(DropdownGroup);\nconst ForwardedRefDropdownSubTrigger = forwardRef<HTMLDivElement, DropdownSubTriggerProps>(DropdownSubTrigger);\nconst ForwardedRefDropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(DropdownSubContent);\nconst ForwardedRefDropdownItem = forwardRef<HTMLDivElement, DropdownItemProps>(DropdownItem);\nconst ForwardedRefDropdownSlot = forwardRef<HTMLDivElement, DropdownSlotProps>(DropdownSlot);\n\nexport const Dropdown = {\n Root: DropdownRoot,\n Trigger: ForwardedRefDropdownTrigger,\n Content: ForwardedRefDropdownContent,\n Group: ForwardedRefDropdownGroup,\n SubMenu: DropdownSubMenu,\n SubTrigger: ForwardedRefDropdownSubTrigger,\n SubContent: ForwardedRefDropdownSubContent,\n Item: ForwardedRefDropdownItem,\n Slot: ForwardedRefDropdownSlot,\n};\n"],"names":["DropdownRoot","children","open","modal","onOpenChange","dataTestId","jsx","RadixDropdown","DropdownTrigger","asChild","props","ref","SPACING_MAP","VIEWPORT_COLLISION_PADDING_MAP","DropdownContent","side","align","triggerOffset","preventTriggerFocusOnClose","viewportCollisionPadding","forceMount","localRef","useRef","theme","dir","useFondueTheme","actualRef","ThemeProvider","styles","event","element","controlsId","_a","DropdownGroup","heading","useMemo","Children","child","jsxs","DropdownSubMenu","DropdownSubTrigger","content","useProcessedChildren","wasMouseInteracted","focusEvent","blurEvent","IconCaretRight","DropdownSubContent","DropdownItem","disabled","textValue","onSelect","emphasis","DropdownSlot","name","ForwardedRefDropdownTrigger","forwardRef","ForwardedRefDropdownContent","ForwardedRefDropdownGroup","ForwardedRefDropdownSubTrigger","ForwardedRefDropdownSubContent","ForwardedRefDropdownItem","ForwardedRefDropdownSlot","Dropdown"],"mappings":";;;;;;;AA8BO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,cAAAC;AAAA,EACA,gBAAgBC,IAAa;AACjC,MAEQ,gBAAAC,EAACC,EAAc,MAAd,EAAmB,MAAAL,GAAY,OAAAC,GAAc,cAAAC,GAA4B,gBAAcC,GACnF,UAAAJ,GACL;AAGRD,EAAa,cAAc;AAYpB,MAAMQ,IAAkB,CAC3B;AAAA,EACI,SAAAC,IAAU;AAAA,EACV,UAAAR;AAAA,EACA,gBAAgBI,IAAa;AAAA,EAC7B,GAAGK;AACP,GACAC,MAGI,gBAAAL,EAACC,EAAc,SAAd,EAAsB,SAAAE,GAAkB,gBAAcJ,GAAY,KAAAM,GAAW,GAAGD,GAC5E,UAAAT,EAAA,CACL;AAGRO,EAAgB,cAAc;AAsC9B,MAAMI,IAA+C;AAAA,EACjD,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AACd,GAEMC,IAAmF;AAAA,EACrF,SAAS;AAAA,EACT,UAAU;AACd,GAEaC,IAAkB,CAC3B;AAAA,EACI,MAAAC,IAAO;AAAA,EACP,OAAAC,IAAQ;AAAA,EACR,eAAAC,IAAgB;AAAA,EAChB,UAAAhB;AAAA,EACA,4BAAAiB;AAAA,EACA,0BAAAC,IAA2B;AAAA,EAC3B,YAAAC,IAAa;AAAA,EACb,gBAAgBf,IAAa;AACjC,GACAM,MACC;AACD,QAAMU,IAAWC,EAAuB,IAAI,GACtC,EAAE,OA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;AAAA,IAAA;AAAA,EAAA;AAGb;AACAO,EAAa,cAAc;AAIpB,MAAMK,IAAe,CACxB,EAAE,UAAApD,GAAU,MAAAqD,GAAM,gBAAgBjD,IAAa,uBAAA,GAC/CM,MAGI,gBAAAL,EAAC,OAAA,EAAI,aAAWgD,GAAM,WAAW1B,EAAO,MAAM,gBAAcvB,GAAY,KAAAM,GACnE,UAAAV,EAAA,CACL;AAGRoD,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoDhD,CAAe,GACjGiD,IAA8BD,EAAiD1C,CAAe,GAC9F4C,IAA4BF,EAA+CvB,CAAa,GACxF0B,IAAiCH,EAAoDhB,CAAkB,GACvGoB,IAAiCJ,EAAoDT,CAAkB,GACvGc,IAA2BL,EAA8CR,CAAY,GACrFc,IAA2BN,EAA8CH,CAAY,GAE9EU,IAAW;AAAA,EACpB,MAAM/D;AAAA,EACN,SAASuD;AAAA,EACT,SAASE;AAAA,EACT,OAAOC;AAAA,EACP,SAASnB;AAAA,EACT,YAAYoB;AAAA,EACZ,YAAYC;AAAA,EACZ,MAAMC;AAAA,EACN,MAAMC;AACV;"}
1
+ {"version":3,"file":"fondue-components11.js","sources":["../src/components/Dropdown/Dropdown.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretRight } from '@frontify/fondue-icons';\nimport * as RadixDropdown from '@radix-ui/react-dropdown-menu';\nimport { Children, forwardRef, useMemo, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { useProcessedChildren } from './hooks/useProcessedChildren';\nimport styles from './styles/dropdown.module.scss';\n\nexport type DropdownRootProps = {\n children?: ReactNode;\n /**\n * When set to true, interaction with outside elements will be disabled and only menu content will be visible to screen readers.\n * @default false\n */\n modal?: boolean;\n /**\n * Controls the open state of the dropdown.\n */\n open?: boolean;\n /**\n * Callback that is called when the open state of the dropdown changes.\n */\n onOpenChange?: (open: boolean) => void;\n\n 'data-test-id'?: string;\n};\n\nexport const DropdownRoot = ({\n children,\n open,\n modal = false,\n onOpenChange,\n 'data-test-id': dataTestId = 'fondue-dropdown',\n}: DropdownRootProps) => {\n return (\n <RadixDropdown.Root open={open} modal={modal} onOpenChange={onOpenChange} data-test-id={dataTestId}>\n {children}\n </RadixDropdown.Root>\n );\n};\nDropdownRoot.displayName = 'Dropdown.Root';\n\nexport type DropdownTriggerProps = {\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 const DropdownTrigger = (\n {\n asChild = true,\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-trigger',\n ...props\n }: DropdownTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixDropdown.Trigger asChild={asChild} data-test-id={dataTestId} ref={ref} {...props}>\n {children}\n </RadixDropdown.Trigger>\n );\n};\nDropdownTrigger.displayName = 'Dropdown.Trigger';\n\ntype DropdownSpacing = 'compact' | 'comfortable' | 'spacious';\ntype DropdownViewportCollisionPadding = 'compact' | 'spacious';\nexport type DropdownContentProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n /**\n * Defines the alignment of the dropdown.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the dropdown. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Defines the spacing between the dropdown and its trigger.\n * @default 'compact'\n */\n triggerOffset?: DropdownSpacing;\n /**\n * Prevents the focus from being set on the trigger when the dropdown is closed.\n */\n preventTriggerFocusOnClose?: boolean;\n /**\n * Define the minimum distance between the dropdown and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: DropdownViewportCollisionPadding;\n /**\n * When true, the content will always be mounted in the DOM. Before enabling, make sure you really need it.\n * @default false\n */\n forceMount?: boolean;\n /**\n * Event handler called when the escape key is pressed.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n};\n\nconst SPACING_MAP: Record<DropdownSpacing, number> = {\n compact: 8,\n comfortable: 12,\n spacious: 16,\n};\n\nconst VIEWPORT_COLLISION_PADDING_MAP: Record<DropdownViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n};\n\nexport const DropdownContent = (\n {\n side = 'bottom',\n align = 'start',\n triggerOffset = 'compact',\n children,\n preventTriggerFocusOnClose,\n viewportCollisionPadding = 'compact',\n forceMount = false,\n onEscapeKeyDown,\n 'data-test-id': dataTestId = 'fondue-dropdown-content',\n }: DropdownContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const localRef = useRef<HTMLDivElement>(null);\n const { theme, dir } = useFondueTheme();\n const actualRef = ref || localRef;\n return (\n <RadixDropdown.Portal forceMount={forceMount || undefined}>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.Content\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n align={align}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding]}\n sideOffset={SPACING_MAP[triggerOffset]}\n side={side}\n className={styles.content}\n data-test-id={dataTestId}\n ref={actualRef}\n onEscapeKeyDown={onEscapeKeyDown}\n onPointerDownOutside={(event) => {\n if (!forceMount) {\n return;\n }\n\n if (!(event.target instanceof Element)) {\n return;\n }\n\n if (!(actualRef instanceof Object) || !('current' in actualRef)) {\n return;\n }\n\n let element: Element | null = event.target;\n let controlsId: string | null = null;\n\n while (element && element !== document.body) {\n controlsId = element.getAttribute('aria-controls');\n\n if (controlsId) {\n break;\n }\n\n element = element.parentElement;\n }\n\n if (controlsId === actualRef.current?.id) {\n event.preventDefault();\n }\n }}\n onCloseAutoFocus={(event) => {\n if (preventTriggerFocusOnClose) {\n event.preventDefault();\n }\n }}\n forceMount={forceMount || undefined}\n >\n {children}\n </RadixDropdown.Content>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownContent.displayName = 'Dropdown.Content';\n\nexport type DropdownGroupProps = { children: ReactNode; heading?: string; 'data-test-id'?: string };\n\nexport const DropdownGroup = (\n { children, heading, 'data-test-id': dataTestId = 'fondue-dropdown-group' }: DropdownGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const hasChildren = useMemo(\n () => Children.toArray(children).filter((child) => child !== null).length > 0,\n [children],\n );\n\n if (!hasChildren) {\n return null;\n }\n\n return (\n <RadixDropdown.Group className={styles.group} data-test-id={dataTestId} ref={ref}>\n {heading ? (\n <div className={styles.groupHeading}>\n <span aria-label={heading}>{heading}</span>\n </div>\n ) : null}\n {children}\n </RadixDropdown.Group>\n );\n};\nDropdownGroup.displayName = 'Dropdown.Group';\n\nexport type DropdownSubMenuProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubMenu = ({\n children,\n 'data-test-id': dataTestId = 'fondue-dropdown-submenu',\n}: DropdownSubMenuProps) => {\n return <RadixDropdown.Sub data-test-id={dataTestId}>{children}</RadixDropdown.Sub>;\n};\nDropdownSubMenu.displayName = 'Dropdown.SubMenu';\n\nexport type DropdownSubTriggerProps = { children: ReactNode; 'data-test-id'?: string };\n\nexport const DropdownSubTrigger = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger' }: DropdownSubTriggerProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n const wasMouseInteracted = useRef(false);\n return (\n <RadixDropdown.SubTrigger\n className={styles.subTrigger}\n // eslint-disable-next-line react-hooks/refs\n data-show-focus-ring={wasMouseInteracted.current}\n data-test-id={dataTestId}\n ref={ref}\n onMouseEnter={() => {\n wasMouseInteracted.current = true;\n }}\n onFocus={(focusEvent) => {\n if (!wasMouseInteracted.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasMouseInteracted.current = false;\n }}\n >\n {content}\n <IconCaretRight className={styles.subMenuIndicator} size={16} />\n </RadixDropdown.SubTrigger>\n );\n};\nDropdownSubTrigger.displayName = 'Dropdown.SubTrigger';\n\nexport type DropdownSubContentProps = {\n children: ReactNode;\n 'data-test-id'?: string;\n};\n\nexport const DropdownSubContent = (\n { children, 'data-test-id': dataTestId = 'fondue-dropdown-subcontent' }: DropdownSubContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n return (\n <RadixDropdown.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <RadixDropdown.SubContent\n // @ts-expect-error - dir prop works at runtime but is not in the Radix UI type definition\n dir={dir}\n className={styles.subContent}\n data-test-id={dataTestId}\n ref={ref}\n >\n {children}\n </RadixDropdown.SubContent>\n </ThemeProvider>\n </RadixDropdown.Portal>\n );\n};\nDropdownSubContent.displayName = 'Dropdown.SubContent';\n\nexport type DropdownItemProps = {\n children: ReactNode;\n /**\n * Disables the item.\n */\n disabled?: boolean;\n /**\n * The text value of the item that is passed to the onSelect callback.\n */\n textValue?: string;\n /**\n * The style of the item.\n * @default \"default\"\n */\n emphasis?: 'default' | 'danger';\n /**\n * Callback that is called when the item is selected.\n */\n onSelect?: (event: Event) => void;\n /**\n * If true, the item props will be passed to the child element.\n * @default false\n */\n asChild?: boolean;\n 'data-test-id'?: string;\n};\n\nexport const DropdownItem = (\n {\n children,\n disabled,\n textValue,\n onSelect,\n emphasis = 'default',\n asChild = false,\n 'data-test-id': dataTestId = 'fondue-dropdown-subtrigger',\n ...props\n }: DropdownItemProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { content } = useProcessedChildren(children);\n const wasMouseInteracted = useRef(false);\n\n return (\n <RadixDropdown.Item\n onSelect={onSelect}\n className={styles.item}\n textValue={textValue}\n data-test-id={dataTestId}\n data-emphasis={emphasis}\n ref={ref}\n disabled={disabled}\n asChild={asChild}\n // eslint-disable-next-line react-hooks/refs\n data-show-focus-ring={wasMouseInteracted.current}\n onMouseEnter={() => {\n wasMouseInteracted.current = true;\n }}\n onFocus={(focusEvent) => {\n if (!wasMouseInteracted.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasMouseInteracted.current = false;\n }}\n {...props}\n >\n {content}\n </RadixDropdown.Item>\n );\n};\nDropdownItem.displayName = 'Dropdown.Item';\n\nexport type DropdownSlotProps = { children: ReactNode; name?: 'left' | 'right'; 'data-test-id'?: string };\n\nexport const DropdownSlot = (\n { children, name, 'data-test-id': dataTestId = 'fondue-dropdown-slot' }: DropdownSlotProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-name={name} className={styles.slot} data-test-id={dataTestId} ref={ref}>\n {children}\n </div>\n );\n};\nDropdownSlot.displayName = 'Dropdown.Slot';\n\nconst ForwardedRefDropdownTrigger = forwardRef<HTMLButtonElement, DropdownTriggerProps>(DropdownTrigger);\nconst ForwardedRefDropdownContent = forwardRef<HTMLDivElement, DropdownContentProps>(DropdownContent);\nconst ForwardedRefDropdownGroup = forwardRef<HTMLDivElement, DropdownGroupProps>(DropdownGroup);\nconst ForwardedRefDropdownSubTrigger = forwardRef<HTMLDivElement, DropdownSubTriggerProps>(DropdownSubTrigger);\nconst ForwardedRefDropdownSubContent = forwardRef<HTMLDivElement, DropdownSubContentProps>(DropdownSubContent);\nconst ForwardedRefDropdownItem = forwardRef<HTMLDivElement, DropdownItemProps>(DropdownItem);\nconst ForwardedRefDropdownSlot = forwardRef<HTMLDivElement, DropdownSlotProps>(DropdownSlot);\n\nexport const Dropdown = {\n Root: DropdownRoot,\n Trigger: ForwardedRefDropdownTrigger,\n Content: ForwardedRefDropdownContent,\n Group: ForwardedRefDropdownGroup,\n SubMenu: DropdownSubMenu,\n SubTrigger: ForwardedRefDropdownSubTrigger,\n SubContent: ForwardedRefDropdownSubContent,\n Item: ForwardedRefDropdownItem,\n Slot: ForwardedRefDropdownSlot,\n};\n"],"names":["DropdownRoot","children","open","modal","onOpenChange","dataTestId","jsx","RadixDropdown","DropdownTrigger","asChild","props","ref","SPACING_MAP","VIEWPORT_COLLISION_PADDING_MAP","DropdownContent","side","align","triggerOffset","preventTriggerFocusOnClose","viewportCollisionPadding","forceMount","onEscapeKeyDown","localRef","useRef","theme","dir","useFondueTheme","actualRef","ThemeProvider","styles","event","element","controlsId","_a","DropdownGroup","heading","useMemo","Children","child","jsxs","DropdownSubMenu","DropdownSubTrigger","content","useProcessedChildren","wasMouseInteracted","focusEvent","blurEvent","IconCaretRight","DropdownSubContent","DropdownItem","disabled","textValue","onSelect","emphasis","DropdownSlot","name","ForwardedRefDropdownTrigger","forwardRef","ForwardedRefDropdownContent","ForwardedRefDropdownGroup","ForwardedRefDropdownSubTrigger","ForwardedRefDropdownSubContent","ForwardedRefDropdownItem","ForwardedRefDropdownSlot","Dropdown"],"mappings":";;;;;;;AA8BO,MAAMA,IAAe,CAAC;AAAA,EACzB,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,cAAAC;AAAA,EACA,gBAAgBC,IAAa;AACjC,MAEQ,gBAAAC,EAACC,EAAc,MAAd,EAAmB,MAAAL,GAAY,OAAAC,GAAc,cAAAC,GAA4B,gBAAcC,GACnF,UAAAJ,GACL;AAGRD,EAAa,cAAc;AAYpB,MAAMQ,IAAkB,CAC3B;AAAA,EACI,SAAAC,IAAU;AAAA,EACV,UAAAR;AAAA,EACA,gBAAgBI,IAAa;AAAA,EAC7B,GAAGK;AACP,GACAC,MAGI,gBAAAL,EAACC,EAAc,SAAd,EAAsB,SAAAE,GAAkB,gBAAcJ,GAAY,KAAAM,GAAW,GAAGD,GAC5E,UAAAT,EAAA,CACL;AAGRO,EAAgB,cAAc;AA0C9B,MAAMI,IAA+C;AAAA,EACjD,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AACd,GAEMC,IAAmF;AAAA,EACrF,SAAS;AAAA,EACT,UAAU;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AA,MAEA,wBAAsBmC,EAAmB;AAAA,MACzC,cAAc,MAAM;AAChB,QAAAA,EAAmB,UAAU;AAAA,MACjC;AAAA,MACA,SAAS,CAACC,MAAe;AACrB,QAAKD,EAAmB,YACpBC,EAAW,OAAO,QAAQ,gBAAgB;AAAA,MAElD;AAAA,MACA,QAAQ,CAACC,MAAc;AACnB,QAAAA,EAAU,OAAO,QAAQ,gBAAgB,SACzCF,EAAmB,UAAU;AAAA,MACjC;AAAA,MACC,GAAGlC;AAAA,MAEH,UAAAgC;AAAA,IAAA;AAAA,EAAA;AAGb;AACAO,EAAa,cAAc;AAIpB,MAAMK,IAAe,CACxB,EAAE,UAAArD,GAAU,MAAAsD,GAAM,gBAAgBlD,IAAa,uBAAA,GAC/CM,MAGI,gBAAAL,EAAC,OAAA,EAAI,aAAWiD,GAAM,WAAW1B,EAAO,MAAM,gBAAcxB,GAAY,KAAAM,GACnE,UAAAV,EAAA,CACL;AAGRqD,EAAa,cAAc;AAE3B,MAAME,IAA8BC,EAAoDjD,CAAe,GACjGkD,IAA8BD,EAAiD3C,CAAe,GAC9F6C,IAA4BF,EAA+CvB,CAAa,GACxF0B,IAAiCH,EAAoDhB,CAAkB,GACvGoB,IAAiCJ,EAAoDT,CAAkB,GACvGc,IAA2BL,EAA8CR,CAAY,GACrFc,IAA2BN,EAA8CH,CAAY,GAE9EU,KAAW;AAAA,EACpB,MAAMhE;AAAA,EACN,SAASwD;AAAA,EACT,SAASE;AAAA,EACT,OAAOC;AAAA,EACP,SAASnB;AAAA,EACT,YAAYoB;AAAA,EACZ,YAAYC;AAAA,EACZ,MAAMC;AAAA,EACN,MAAMC;AACV;"}
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components13.js","sources":["../src/components/Flyout/Flyout.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { forwardRef, type CSSProperties, type ForwardedRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { Button } from '../Button/Button';\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/flyout.module.scss';\n\nexport type FlyoutRootProps = {\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 flyout\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 const FlyoutRoot = ({ children, ...props }: FlyoutRootProps) => {\n return <RadixPopover.Root {...props}>{children}</RadixPopover.Root>;\n};\nFlyoutRoot.displayName = 'Flyout.Root';\n\nexport type FlyoutTriggerProps = {\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 const FlyoutTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-flyout-trigger', ...props }: FlyoutTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixPopover.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 </RadixPopover.Trigger>\n );\n};\nFlyoutTrigger.displayName = 'Flyout.Trigger';\n\ntype FlyoutSpacing = 'compact' | 'comfortable' | 'spacious';\ntype FlyoutViewportCollisionPadding = 'compact' | 'spacious';\nexport type FlyoutContentProps = {\n /**\n * Add a shadow to the flyout\n * @default \"medium\"\n */\n shadow?: 'none' | 'medium' | 'large';\n /**\n * Add rounded corners to the flyout\n * @default \"medium\"\n */\n rounded?: 'none' | 'medium' | 'large';\n /**\n * Define the prefered side of the flyout. Can be overriden by viewport collisions viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Define the prefered alignment of the flyout. Can be overriden by viewport collisions viewport.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Define the padding of the flyout\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Define the fixed width of the flyout\n * @default \"fit-content\"\n */\n width?: string;\n /**\n * Defines the spacing between the dropdown and its trigger.\n * @default 'compact'\n */\n triggerOffset?: FlyoutSpacing;\n /**\n * Define the maximum width of the flyout\n * @default \"360px\"\n */\n maxWidth?: string;\n /**\n * Define the minimum distance between the flyout and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: FlyoutViewportCollisionPadding;\n /**\n * Event handler called when auto-focusing on open\n */\n onOpenAutoFocus?: (event: Event) => void;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nconst SPACING_MAP: Record<FlyoutSpacing, number> = {\n compact: 8,\n comfortable: 12,\n spacious: 16,\n};\n\nconst VIEWPORT_COLLISION_PADDING_MAP: Record<FlyoutViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n};\n\nexport const FlyoutContent = (\n {\n align = 'start',\n maxWidth = '360px',\n padding = 'compact',\n rounded = 'medium',\n width = 'fit-content',\n shadow = 'medium',\n side,\n triggerOffset = 'compact',\n viewportCollisionPadding = 'compact',\n 'data-test-id': dataTestId = 'fondue-flyout-content',\n children,\n ...props\n }: FlyoutContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n const getAdjustedSide = (side?: 'top' | 'right' | 'bottom' | 'left') => {\n if (!side || dir === 'ltr') {\n return side;\n }\n\n if (side === 'left') {\n return 'right';\n }\n if (side === 'right') {\n return 'left';\n }\n\n return side;\n };\n\n return (\n <RadixPopover.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <div data-test-id=\"fondue-flyout-overlay\" className={styles.overlay} />\n <RadixPopover.Content\n dir={dir}\n style={\n {\n '--flyout-max-width': maxWidth,\n '--flyout-width': width,\n } as CSSProperties\n }\n ref={ref}\n align={align}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding]}\n sideOffset={SPACING_MAP[triggerOffset]}\n side={getAdjustedSide(side)}\n className={styles.root}\n data-flyout-spacing={padding}\n data-rounded={rounded}\n data-shadow={shadow}\n data-test-id={dataTestId}\n onFocus={addShowFocusRing}\n {...props}\n >\n {children}\n </RadixPopover.Content>\n </ThemeProvider>\n </RadixPopover.Portal>\n );\n};\nFlyoutContent.displayName = 'Flyout.Content';\n\nexport type FlyoutHeaderProps = {\n /**\n * Show a close button in the header\n * @default false\n */\n showCloseButton?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n closeProps?: CommonAriaProps;\n};\n\nexport const FlyoutHeader = (\n { showCloseButton, children, 'data-test-id': dataTestId = 'fondue-flyout-header', closeProps }: FlyoutHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.header}>\n <div>{children}</div>\n {showCloseButton && (\n <RadixPopover.Close asChild {...closeProps}>\n <Button\n size=\"small\"\n aspect=\"square\"\n emphasis=\"weak\"\n aria-label={t('Flyout_close')}\n data-test-id={`${dataTestId}-close`}\n >\n <IconCross size={20} />\n </Button>\n </RadixPopover.Close>\n )}\n </div>\n );\n};\nFlyoutHeader.displayName = 'Flyout.Header';\n\nexport type FlyoutFooterProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport const FlyoutFooter = (\n { children, 'data-test-id': dataTestId = 'fondue-flyout-footer' }: FlyoutFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.footer}>\n {children}\n </div>\n );\n};\nFlyoutFooter.displayName = 'Flyout.Footer';\n\nexport type FlyoutBodyProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n /**\n * Allow the body to scroll if the max height of the flyout is reached\n * @default false\n */\n scrollable?: boolean;\n};\n\nexport const FlyoutBody = (\n { children, 'data-test-id': dataTestId = 'fondue-flyout-body', scrollable = false }: FlyoutBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n data-flyout-spacing=\"compact\"\n data-scrollable={scrollable}\n className={styles.body}\n >\n {children}\n </div>\n );\n};\nFlyoutBody.displayName = 'Flyout.Body';\n\nexport const Flyout = {\n Root: FlyoutRoot,\n Trigger: forwardRef<HTMLButtonElement, FlyoutTriggerProps>(FlyoutTrigger),\n Content: forwardRef<HTMLDivElement, FlyoutContentProps>(FlyoutContent),\n Header: forwardRef<HTMLDivElement, FlyoutHeaderProps>(FlyoutHeader),\n Footer: forwardRef<HTMLDivElement, FlyoutFooterProps>(FlyoutFooter),\n Body: forwardRef<HTMLDivElement, FlyoutBodyProps>(FlyoutBody),\n};\n"],"names":["FlyoutRoot","children","props","RadixPopover","FlyoutTrigger","asChild","dataTestId","ref","jsx","addAutoFocusAttribute","SPACING_MAP","VIEWPORT_COLLISION_PADDING_MAP","FlyoutContent","align","maxWidth","padding","rounded","width","shadow","side","triggerOffset","viewportCollisionPadding","theme","dir","useFondueTheme","getAdjustedSide","jsxs","ThemeProvider","styles","addShowFocusRing","FlyoutHeader","showCloseButton","closeProps","t","useTranslation","Button","IconCross","FlyoutFooter","FlyoutBody","scrollable","Flyout","forwardRef"],"mappings":";;;;;;;;;AAiCO,MAAMA,IAAa,CAAC,EAAE,UAAAC,GAAU,GAAGC,0BAC9BC,EAAa,MAAb,EAAmB,GAAGD,GAAQ,UAAAD,GAAS;AAEnDD,EAAW,cAAc;AAYlB,MAAMI,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAJ,GAAU,gBAAgBK,IAAa,yBAAyB,GAAGJ,EAAA,GACrFK,MAGI,gBAAAC;AAAA,EAACL,EAAa;AAAA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AC;AAAA,EAAA;AAAA,IACG,gBAAcF;AAAA,IACd,KAAAC;AAAA,IACA,uBAAoB;AAAA,IACpB,mBAAiBgC;AAAA,IACjB,WAAWX,EAAO;AAAA,IAEjB,UAAA3B;AAAA,EAAA;AAAA;AAIbqC,EAAW,cAAc;AAElB,MAAME,IAAS;AAAA,EAClB,MAAMxC;AAAA,EACN,SAASyC,EAAkDrC,CAAa;AAAA,EACxE,SAASqC,EAA+C7B,CAAa;AAAA,EACrE,QAAQ6B,EAA8CX,CAAY;AAAA,EAClE,QAAQW,EAA8CJ,CAAY;AAAA,EAClE,MAAMI,EAA4CH,CAAU;AAChE;"}
1
+ {"version":3,"file":"fondue-components13.js","sources":["../src/components/Flyout/Flyout.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCross } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { forwardRef, type CSSProperties, type ForwardedRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useTranslation } from '#/hooks/useTranslation';\nimport { addAutoFocusAttribute, addShowFocusRing } from '#/utilities/domUtilities';\n\nimport { Button } from '../Button/Button';\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport styles from './styles/flyout.module.scss';\n\nexport type FlyoutRootProps = {\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 flyout\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 const FlyoutRoot = ({ children, ...props }: FlyoutRootProps) => {\n return <RadixPopover.Root {...props}>{children}</RadixPopover.Root>;\n};\nFlyoutRoot.displayName = 'Flyout.Root';\n\nexport type FlyoutTriggerProps = {\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 const FlyoutTrigger = (\n { asChild = true, children, 'data-test-id': dataTestId = 'fondue-flyout-trigger', ...props }: FlyoutTriggerProps,\n ref: ForwardedRef<HTMLButtonElement>,\n) => {\n return (\n <RadixPopover.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 </RadixPopover.Trigger>\n );\n};\nFlyoutTrigger.displayName = 'Flyout.Trigger';\n\ntype FlyoutSpacing = 'compact' | 'comfortable' | 'spacious';\ntype FlyoutViewportCollisionPadding = 'compact' | 'spacious';\nexport type FlyoutContentProps = {\n /**\n * Add a shadow to the flyout\n * @default \"medium\"\n */\n shadow?: 'none' | 'medium' | 'large';\n /**\n * Add rounded corners to the flyout\n * @default \"medium\"\n */\n rounded?: 'none' | 'medium' | 'large';\n /**\n * Define the prefered side of the flyout. Can be overriden by viewport collisions viewport.\n * @default \"bottom\"\n */\n side?: 'top' | 'right' | 'bottom' | 'left';\n /**\n * Define the prefered alignment of the flyout. Can be overriden by viewport collisions viewport.\n * @default \"start\"\n */\n align?: 'start' | 'center' | 'end';\n /**\n * Define the padding of the flyout\n * @default \"compact\"\n */\n padding?: 'none' | 'tight' | 'compact' | 'comfortable' | 'spacious';\n /**\n * Define the fixed width of the flyout\n * @default \"fit-content\"\n */\n width?: string;\n /**\n * Defines the spacing between the dropdown and its trigger.\n * @default 'compact'\n */\n triggerOffset?: FlyoutSpacing;\n /**\n * Define the maximum width of the flyout\n * @default \"360px\"\n */\n maxWidth?: string;\n /**\n * Define the minimum distance between the flyout and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: FlyoutViewportCollisionPadding;\n /**\n * Event handler called when auto-focusing on open\n */\n onOpenAutoFocus?: (event: Event) => void;\n /**\n * Event handler called when the escape key is pressed.\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n children?: ReactNode;\n 'data-test-id'?: string;\n};\n\nconst SPACING_MAP: Record<FlyoutSpacing, number> = {\n compact: 8,\n comfortable: 12,\n spacious: 16,\n};\n\nconst VIEWPORT_COLLISION_PADDING_MAP: Record<FlyoutViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n};\n\nexport const FlyoutContent = (\n {\n align = 'start',\n maxWidth = '360px',\n padding = 'compact',\n rounded = 'medium',\n width = 'fit-content',\n shadow = 'medium',\n side,\n triggerOffset = 'compact',\n viewportCollisionPadding = 'compact',\n 'data-test-id': dataTestId = 'fondue-flyout-content',\n children,\n ...props\n }: FlyoutContentProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { theme, dir } = useFondueTheme();\n\n const getAdjustedSide = (side?: 'top' | 'right' | 'bottom' | 'left') => {\n if (!side || dir === 'ltr') {\n return side;\n }\n\n if (side === 'left') {\n return 'right';\n }\n if (side === 'right') {\n return 'left';\n }\n\n return side;\n };\n\n return (\n <RadixPopover.Portal>\n <ThemeProvider theme={theme} dir={dir}>\n <div data-test-id=\"fondue-flyout-overlay\" className={styles.overlay} />\n <RadixPopover.Content\n dir={dir}\n style={\n {\n '--flyout-max-width': maxWidth,\n '--flyout-width': width,\n } as CSSProperties\n }\n ref={ref}\n align={align}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding]}\n sideOffset={SPACING_MAP[triggerOffset]}\n side={getAdjustedSide(side)}\n className={styles.root}\n data-flyout-spacing={padding}\n data-rounded={rounded}\n data-shadow={shadow}\n data-test-id={dataTestId}\n onFocus={addShowFocusRing}\n {...props}\n >\n {children}\n </RadixPopover.Content>\n </ThemeProvider>\n </RadixPopover.Portal>\n );\n};\nFlyoutContent.displayName = 'Flyout.Content';\n\nexport type FlyoutHeaderProps = {\n /**\n * Show a close button in the header\n * @default false\n */\n showCloseButton?: boolean;\n children?: ReactNode;\n 'data-test-id'?: string;\n closeProps?: CommonAriaProps;\n};\n\nexport const FlyoutHeader = (\n { showCloseButton, children, 'data-test-id': dataTestId = 'fondue-flyout-header', closeProps }: FlyoutHeaderProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n const { t } = useTranslation();\n\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.header}>\n <div>{children}</div>\n {showCloseButton && (\n <RadixPopover.Close asChild {...closeProps}>\n <Button\n size=\"small\"\n aspect=\"square\"\n emphasis=\"weak\"\n aria-label={t('Flyout_close')}\n data-test-id={`${dataTestId}-close`}\n >\n <IconCross size={20} />\n </Button>\n </RadixPopover.Close>\n )}\n </div>\n );\n};\nFlyoutHeader.displayName = 'Flyout.Header';\n\nexport type FlyoutFooterProps = { children?: ReactNode; 'data-test-id'?: string };\n\nexport const FlyoutFooter = (\n { children, 'data-test-id': dataTestId = 'fondue-flyout-footer' }: FlyoutFooterProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} ref={ref} className={styles.footer}>\n {children}\n </div>\n );\n};\nFlyoutFooter.displayName = 'Flyout.Footer';\n\nexport type FlyoutBodyProps = {\n children?: ReactNode;\n 'data-test-id'?: string;\n /**\n * Allow the body to scroll if the max height of the flyout is reached\n * @default false\n */\n scrollable?: boolean;\n};\n\nexport const FlyoutBody = (\n { children, 'data-test-id': dataTestId = 'fondue-flyout-body', scrollable = false }: FlyoutBodyProps,\n ref: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div\n data-test-id={dataTestId}\n ref={ref}\n data-flyout-spacing=\"compact\"\n data-scrollable={scrollable}\n className={styles.body}\n >\n {children}\n </div>\n );\n};\nFlyoutBody.displayName = 'Flyout.Body';\n\nexport const Flyout = {\n Root: FlyoutRoot,\n Trigger: forwardRef<HTMLButtonElement, FlyoutTriggerProps>(FlyoutTrigger),\n Content: forwardRef<HTMLDivElement, FlyoutContentProps>(FlyoutContent),\n Header: forwardRef<HTMLDivElement, FlyoutHeaderProps>(FlyoutHeader),\n Footer: forwardRef<HTMLDivElement, FlyoutFooterProps>(FlyoutFooter),\n Body: forwardRef<HTMLDivElement, FlyoutBodyProps>(FlyoutBody),\n};\n"],"names":["FlyoutRoot","children","props","RadixPopover","FlyoutTrigger","asChild","dataTestId","ref","jsx","addAutoFocusAttribute","SPACING_MAP","VIEWPORT_COLLISION_PADDING_MAP","FlyoutContent","align","maxWidth","padding","rounded","width","shadow","side","triggerOffset","viewportCollisionPadding","theme","dir","useFondueTheme","getAdjustedSide","jsxs","ThemeProvider","styles","addShowFocusRing","FlyoutHeader","showCloseButton","closeProps","t","useTranslation","Button","IconCross","FlyoutFooter","FlyoutBody","scrollable","Flyout","forwardRef"],"mappings":";;;;;;;;;AAiCO,MAAMA,IAAa,CAAC,EAAE,UAAAC,GAAU,GAAGC,0BAC9BC,EAAa,MAAb,EAAmB,GAAGD,GAAQ,UAAAD,GAAS;AAEnDD,EAAW,cAAc;AAYlB,MAAMI,IAAgB,CACzB,EAAE,SAAAC,IAAU,IAAM,UAAAJ,GAAU,gBAAgBK,IAAa,yBAAyB,GAAGJ,EAAA,GACrFK,MAGI,gBAAAC;AAAA,EAACL,EAAa;AAAA,EAAb;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;AAAA;AAIbG,EAAc,cAAc;AA8D5B,MAAMM,IAA6C;AAAA,EAC/C,SAAS;AAAA,EACT,aAAa;AAAA,EACb,UAAU;AACd,GAEMC,IAAiF;AAAA,EACnF,SAAS;AAAA,EACT,UAAU;AACd,GAEaC,IAAgB,CACzB;AAAA,EACI,OAAAC,IAAQ;AAAA,EACR,UAAAC,IAAW;AAAA,EACX,SAAAC,IAAU;AAAA,EACV,SAAAC,IAAU;AAAA,EACV,OAAAC,IAAQ;AAAA,EACR,QAAAC,IAAS;AAAA,EACT,MAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,0BAAAC,IAA2B;AAA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ACI5B,EAAa,OAAb,EAAmB,SAAO,IAAE,GAAG6B,GAC5B,UAAA,gBAAAxB;AAAA,MAAC2B;AAAA,MAAA;AAAA,QACG,MAAK;AAAA,QACL,QAAO;AAAA,QACP,UAAS;AAAA,QACT,cAAYF,EAAE,cAAc;AAAA,QAC5B,gBAAc,GAAG3B,CAAU;AAAA,QAE3B,UAAA,gBAAAE,EAAC4B,GAAA,EAAU,MAAM,GAAA,CAAI;AAAA,MAAA;AAAA,IAAA,EACzB,CACJ;AAAA,EAAA,GAER;AAER;AACAN,EAAa,cAAc;AAIpB,MAAMO,IAAe,CACxB,EAAE,UAAApC,GAAU,gBAAgBK,IAAa,uBAAA,GACzCC,MAGI,gBAAAC,EAAC,SAAI,gBAAcF,GAAY,KAAAC,GAAU,WAAWqB,EAAO,QACtD,UAAA3B,GACL;AAGRoC,EAAa,cAAc;AAYpB,MAAMC,IAAa,CACtB,EAAE,UAAArC,GAAU,gBAAgBK,IAAa,sBAAsB,YAAAiC,IAAa,GAAA,GAC5EhC,MAGI,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACG,gBAAcF;AAAA,IACd,KAAAC;AAAA,IACA,uBAAoB;AAAA,IACpB,mBAAiBgC;AAAA,IACjB,WAAWX,EAAO;AAAA,IAEjB,UAAA3B;AAAA,EAAA;AAAA;AAIbqC,EAAW,cAAc;AAElB,MAAME,IAAS;AAAA,EAClB,MAAMxC;AAAA,EACN,SAASyC,EAAkDrC,CAAa;AAAA,EACxE,SAASqC,EAA+C7B,CAAa;AAAA,EACrE,QAAQ6B,EAA8CX,CAAY;AAAA,EAClE,QAAQW,EAA8CJ,CAAY;AAAA,EAClE,MAAMI,EAA4CH,CAAU;AAChE;"}
@@ -1,50 +1,49 @@
1
- import { jsx as y } from "react/jsx-runtime";
1
+ import { jsx as c } from "react/jsx-runtime";
2
2
  import { forwardRef as g } from "react";
3
- import { cn as x } from "./fondue-components60.js";
4
- import a from "./fondue-components61.js";
5
- const $ = g(
3
+ import a from "./fondue-components60.js";
4
+ const x = g(
6
5
  ({
7
6
  as: e = "span",
8
7
  children: i,
9
8
  className: r,
10
9
  color: d = "default",
11
10
  role: o,
12
- size: t = "medium",
13
- weight: l = "default",
11
+ size: l = "medium",
12
+ weight: t = "default",
14
13
  "data-test-id": s = "fondue-heading",
15
14
  "aria-describedby": p,
16
- "aria-expanded": m,
17
- "aria-haspopup": n,
18
- "aria-hidden": b,
15
+ "aria-expanded": n,
16
+ "aria-haspopup": b,
17
+ "aria-hidden": m,
19
18
  "aria-label": f,
20
19
  "aria-labelledby": u,
21
- ...c
22
- }, h) => /* @__PURE__ */ y(
20
+ ...h
21
+ }, y) => /* @__PURE__ */ c(
23
22
  e,
24
23
  {
25
- className: x([
24
+ className: [
26
25
  a.root,
27
- a[`size-${t}`],
28
- a[`weight-${l}`],
26
+ a[`size-${l}`],
27
+ a[`weight-${t}`],
29
28
  a[`color-${d}`],
30
29
  r
31
- ]),
30
+ ].filter(Boolean).join(" "),
32
31
  role: o,
33
32
  "aria-label": f,
34
- "aria-hidden": b,
33
+ "aria-hidden": m,
35
34
  "aria-describedby": p,
36
35
  "aria-labelledby": u,
37
- "aria-expanded": m,
38
- "aria-haspopup": n,
36
+ "aria-expanded": n,
37
+ "aria-haspopup": b,
39
38
  "data-test-id": s,
40
- ref: h,
41
- ...c,
39
+ ref: y,
40
+ ...h,
42
41
  children: i
43
42
  }
44
43
  )
45
44
  );
46
- $.displayName = "Heading";
45
+ x.displayName = "Heading";
47
46
  export {
48
- $ as Heading
47
+ x as Heading
49
48
  };
50
49
  //# sourceMappingURL=fondue-components15.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components15.js","sources":["../src/components/Heading/Heading.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ElementType, type ForwardedRef, forwardRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { cn } from '#/utilities/styleUtilities';\n\nimport styles from './styles/heading.module.scss';\n\ntype HeadingWeight = 'default' | 'strong';\ntype HeadingSize = 'medium' | 'large' | 'x-large' | 'xx-large';\ntype HeadingColor = 'default' | 'weak' | 'x-weak' | 'disabled' | 'negative' | 'positive' | 'warning' | 'interactive';\n\ntype TagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p';\n\nexport type HeadingProps<TTag extends TagType = 'span'> = CommonAriaProps & {\n 'data-test-id'?: string;\n as?: TTag;\n children?: ReactNode;\n color?: HeadingColor;\n size?: HeadingSize;\n weight?: HeadingWeight;\n className?: string;\n};\n\ntype HeadingElementType<TTag extends TagType> = TTag extends 'span'\n ? HTMLSpanElement\n : TTag extends 'p'\n ? HTMLParagraphElement\n : HTMLHeadingElement;\n\nexport const Heading = forwardRef(\n (\n {\n as: Tag = 'span' as ElementType,\n children,\n className,\n color = 'default',\n role,\n size = 'medium',\n weight = 'default',\n 'data-test-id': dataTestId = 'fondue-heading',\n 'aria-describedby': ariaDescribedBy,\n 'aria-expanded': ariaExpanded,\n 'aria-haspopup': ariaHasPopup,\n 'aria-hidden': ariaHidden,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n ) => {\n return (\n <Tag\n className={cn([\n styles.root,\n styles[`size-${size}`],\n styles[`weight-${weight}`],\n styles[`color-${color}`],\n className,\n ])}\n role={role}\n aria-label={ariaLabel}\n aria-hidden={ariaHidden}\n aria-describedby={ariaDescribedBy}\n aria-labelledby={ariaLabelledBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n data-test-id={dataTestId}\n ref={ref}\n {...props}\n >\n {children}\n </Tag>\n );\n },\n) as (<TTag extends TagType = 'span'>(\n props: HeadingProps<TTag> & { ref?: ForwardedRef<HeadingElementType<TTag>> },\n) => JSX.Element) & { displayName: string };\n\nHeading.displayName = 'Heading';\n"],"names":["Heading","forwardRef","Tag","children","className","color","role","size","weight","dataTestId","ariaDescribedBy","ariaExpanded","ariaHasPopup","ariaHidden","ariaLabel","ariaLabelledBy","props","ref","jsx","cn","styles"],"mappings":";;;;AA+BO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,IAAIC,IAAM;AAAA,IACV,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,MAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,QAAAC,IAAS;AAAA,IACT,gBAAgBC,IAAa;AAAA,IAC7B,oBAAoBC;AAAA,IACpB,iBAAiBC;AAAA,IACjB,iBAAiBC;AAAA,IACjB,eAAeC;AAAA,IACf,cAAcC;AAAA,IACd,mBAAmBC;AAAA,IACnB,GAAGC;AAAA,EAAA,GAEPC,MAGI,gBAAAC;AAAA,IAAChB;AAAA,IAAA;AAAA,MACG,WAAWiB,EAAG;AAAA,QACVC,EAAO;AAAA,QACPA,EAAO,QAAQb,CAAI,EAAE;AAAA,QACrBa,EAAO,UAAUZ,CAAM,EAAE;AAAA,QACzBY,EAAO,SAASf,CAAK,EAAE;AAAA,QACvBD;AAAA,MAAA,CACH;AAAA,MACD,MAAAE;AAAA,MACA,cAAYQ;AAAA,MACZ,eAAaD;AAAA,MACb,oBAAkBH;AAAA,MAClB,mBAAiBK;AAAA,MACjB,iBAAeJ;AAAA,MACf,iBAAeC;AAAA,MACf,gBAAcH;AAAA,MACd,KAAAQ;AAAA,MACC,GAAGD;AAAA,MAEH,UAAAb;AAAA,IAAA;AAAA,EAAA;AAIjB;AAIAH,EAAQ,cAAc;"}
1
+ {"version":3,"file":"fondue-components15.js","sources":["../src/components/Heading/Heading.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ElementType, type ForwardedRef, forwardRef, type ReactNode } from 'react';\n\nimport { type CommonAriaProps } from '#/helpers/aria';\n\nimport styles from './styles/heading.module.scss';\n\ntype HeadingWeight = 'default' | 'strong';\ntype HeadingSize = 'medium' | 'large' | 'x-large' | 'xx-large';\ntype HeadingColor = 'default' | 'weak' | 'x-weak' | 'disabled' | 'negative' | 'positive' | 'warning' | 'interactive';\n\ntype TagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p';\n\nexport type HeadingProps<TTag extends TagType = 'span'> = CommonAriaProps & {\n 'data-test-id'?: string;\n as?: TTag;\n children?: ReactNode;\n color?: HeadingColor;\n size?: HeadingSize;\n weight?: HeadingWeight;\n className?: string;\n};\n\ntype HeadingElementType<TTag extends TagType> = TTag extends 'span'\n ? HTMLSpanElement\n : TTag extends 'p'\n ? HTMLParagraphElement\n : HTMLHeadingElement;\n\nexport const Heading = forwardRef(\n (\n {\n as: Tag = 'span' as ElementType,\n children,\n className,\n color = 'default',\n role,\n size = 'medium',\n weight = 'default',\n 'data-test-id': dataTestId = 'fondue-heading',\n 'aria-describedby': ariaDescribedBy,\n 'aria-expanded': ariaExpanded,\n 'aria-haspopup': ariaHasPopup,\n 'aria-hidden': ariaHidden,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n ...props\n },\n ref,\n ) => {\n return (\n <Tag\n className={[\n styles.root,\n styles[`size-${size}`],\n styles[`weight-${weight}`],\n styles[`color-${color}`],\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n role={role}\n aria-label={ariaLabel}\n aria-hidden={ariaHidden}\n aria-describedby={ariaDescribedBy}\n aria-labelledby={ariaLabelledBy}\n aria-expanded={ariaExpanded}\n aria-haspopup={ariaHasPopup}\n data-test-id={dataTestId}\n ref={ref}\n {...props}\n >\n {children}\n </Tag>\n );\n },\n) as (<TTag extends TagType = 'span'>(\n props: HeadingProps<TTag> & { ref?: ForwardedRef<HeadingElementType<TTag>> },\n) => JSX.Element) & { displayName: string };\n\nHeading.displayName = 'Heading';\n"],"names":["Heading","forwardRef","Tag","children","className","color","role","size","weight","dataTestId","ariaDescribedBy","ariaExpanded","ariaHasPopup","ariaHidden","ariaLabel","ariaLabelledBy","props","ref","jsx","styles"],"mappings":";;;AA8BO,MAAMA,IAAUC;AAAA,EACnB,CACI;AAAA,IACI,IAAIC,IAAM;AAAA,IACV,UAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,MAAAC;AAAA,IACA,MAAAC,IAAO;AAAA,IACP,QAAAC,IAAS;AAAA,IACT,gBAAgBC,IAAa;AAAA,IAC7B,oBAAoBC;AAAA,IACpB,iBAAiBC;AAAA,IACjB,iBAAiBC;AAAA,IACjB,eAAeC;AAAA,IACf,cAAcC;AAAA,IACd,mBAAmBC;AAAA,IACnB,GAAGC;AAAA,EAAA,GAEPC,MAGI,gBAAAC;AAAA,IAAChB;AAAA,IAAA;AAAA,MACG,WAAW;AAAA,QACPiB,EAAO;AAAA,QACPA,EAAO,QAAQZ,CAAI,EAAE;AAAA,QACrBY,EAAO,UAAUX,CAAM,EAAE;AAAA,QACzBW,EAAO,SAASd,CAAK,EAAE;AAAA,QACvBD;AAAA,MAAA,EAEC,OAAO,OAAO,EACd,KAAK,GAAG;AAAA,MACb,MAAAE;AAAA,MACA,cAAYQ;AAAA,MACZ,eAAaD;AAAA,MACb,oBAAkBH;AAAA,MAClB,mBAAiBK;AAAA,MACjB,iBAAeJ;AAAA,MACf,iBAAeC;AAAA,MACf,gBAAcH;AAAA,MACd,KAAAQ;AAAA,MACC,GAAGD;AAAA,MAEH,UAAAb;AAAA,IAAA;AAAA,EAAA;AAIjB;AAIAH,EAAQ,cAAc;"}