@frontify/fondue-components 13.0.2 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/fondue-components.js +56 -54
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +124 -34
  4. package/dist/fondue-components10.js.map +1 -1
  5. package/dist/fondue-components11.js +36 -84
  6. package/dist/fondue-components11.js.map +1 -1
  7. package/dist/fondue-components12.js +89 -36
  8. package/dist/fondue-components12.js.map +1 -1
  9. package/dist/fondue-components13.js +30 -40
  10. package/dist/fondue-components13.js.map +1 -1
  11. package/dist/fondue-components14.js +47 -24
  12. package/dist/fondue-components14.js.map +1 -1
  13. package/dist/fondue-components15.js +28 -39
  14. package/dist/fondue-components15.js.map +1 -1
  15. package/dist/fondue-components16.js +34 -16
  16. package/dist/fondue-components16.js.map +1 -1
  17. package/dist/fondue-components17.js +21 -68
  18. package/dist/fondue-components17.js.map +1 -1
  19. package/dist/fondue-components18.js +68 -36
  20. package/dist/fondue-components18.js.map +1 -1
  21. package/dist/fondue-components19.js +34 -45
  22. package/dist/fondue-components19.js.map +1 -1
  23. package/dist/fondue-components20.js +53 -130
  24. package/dist/fondue-components20.js.map +1 -1
  25. package/dist/fondue-components21.js +133 -53
  26. package/dist/fondue-components21.js.map +1 -1
  27. package/dist/fondue-components22.js +54 -28
  28. package/dist/fondue-components22.js.map +1 -1
  29. package/dist/fondue-components23.js +28 -153
  30. package/dist/fondue-components23.js.map +1 -1
  31. package/dist/fondue-components24.js +151 -116
  32. package/dist/fondue-components24.js.map +1 -1
  33. package/dist/fondue-components25.js +117 -31
  34. package/dist/fondue-components25.js.map +1 -1
  35. package/dist/fondue-components26.js +32 -65
  36. package/dist/fondue-components26.js.map +1 -1
  37. package/dist/fondue-components27.js +66 -7
  38. package/dist/fondue-components27.js.map +1 -1
  39. package/dist/fondue-components28.js +10 -55
  40. package/dist/fondue-components28.js.map +1 -1
  41. package/dist/fondue-components29.js +56 -32
  42. package/dist/fondue-components29.js.map +1 -1
  43. package/dist/fondue-components3.js +89 -36
  44. package/dist/fondue-components3.js.map +1 -1
  45. package/dist/fondue-components30.js +18 -4
  46. package/dist/fondue-components30.js.map +1 -1
  47. package/dist/fondue-components31.js +32 -12
  48. package/dist/fondue-components31.js.map +1 -1
  49. package/dist/fondue-components32.js +5 -155
  50. package/dist/fondue-components32.js.map +1 -1
  51. package/dist/fondue-components33.js +10 -116
  52. package/dist/fondue-components33.js.map +1 -1
  53. package/dist/fondue-components34.js +59 -22
  54. package/dist/fondue-components34.js.map +1 -1
  55. package/dist/fondue-components35.js +112 -15
  56. package/dist/fondue-components35.js.map +1 -1
  57. package/dist/fondue-components36.js +116 -30
  58. package/dist/fondue-components36.js.map +1 -1
  59. package/dist/fondue-components37.js +21 -37
  60. package/dist/fondue-components37.js.map +1 -1
  61. package/dist/fondue-components38.js +31 -129
  62. package/dist/fondue-components38.js.map +1 -1
  63. package/dist/fondue-components39.js +37 -21
  64. package/dist/fondue-components39.js.map +1 -1
  65. package/dist/fondue-components4.js +32 -38
  66. package/dist/fondue-components4.js.map +1 -1
  67. package/dist/fondue-components40.js +130 -45
  68. package/dist/fondue-components40.js.map +1 -1
  69. package/dist/fondue-components41.js +20 -7
  70. package/dist/fondue-components41.js.map +1 -1
  71. package/dist/fondue-components42.js +45 -13
  72. package/dist/fondue-components42.js.map +1 -1
  73. package/dist/fondue-components43.js +7 -14
  74. package/dist/fondue-components43.js.map +1 -1
  75. package/dist/fondue-components44.js +13 -60
  76. package/dist/fondue-components44.js.map +1 -1
  77. package/dist/fondue-components45.js +15 -18
  78. package/dist/fondue-components45.js.map +1 -1
  79. package/dist/fondue-components46.js +60 -19
  80. package/dist/fondue-components46.js.map +1 -1
  81. package/dist/fondue-components47.js +18 -5
  82. package/dist/fondue-components47.js.map +1 -1
  83. package/dist/fondue-components48.js +18 -14
  84. package/dist/fondue-components48.js.map +1 -1
  85. package/dist/fondue-components49.js +1 -1
  86. package/dist/fondue-components5.js +42 -45
  87. package/dist/fondue-components5.js.map +1 -1
  88. package/dist/fondue-components50.js +12 -16
  89. package/dist/fondue-components50.js.map +1 -1
  90. package/dist/fondue-components51.js +5 -35
  91. package/dist/fondue-components51.js.map +1 -1
  92. package/dist/fondue-components52.js +18 -6
  93. package/dist/fondue-components52.js.map +1 -1
  94. package/dist/fondue-components53.js +35 -13
  95. package/dist/fondue-components53.js.map +1 -1
  96. package/dist/fondue-components54.js +6 -4
  97. package/dist/fondue-components54.js.map +1 -1
  98. package/dist/fondue-components55.js +12 -24
  99. package/dist/fondue-components55.js.map +1 -1
  100. package/dist/fondue-components56.js +4 -16
  101. package/dist/fondue-components56.js.map +1 -1
  102. package/dist/fondue-components57.js +23 -140
  103. package/dist/fondue-components57.js.map +1 -1
  104. package/dist/fondue-components58.js +17 -16
  105. package/dist/fondue-components58.js.map +1 -1
  106. package/dist/fondue-components59.js +142 -70
  107. package/dist/fondue-components59.js.map +1 -1
  108. package/dist/fondue-components6.js +46 -48
  109. package/dist/fondue-components6.js.map +1 -1
  110. package/dist/fondue-components60.js +16 -8
  111. package/dist/fondue-components60.js.map +1 -1
  112. package/dist/fondue-components61.js +72 -32
  113. package/dist/fondue-components61.js.map +1 -1
  114. package/dist/fondue-components62.js +8 -49
  115. package/dist/fondue-components62.js.map +1 -1
  116. package/dist/fondue-components63.js +32 -10
  117. package/dist/fondue-components63.js.map +1 -1
  118. package/dist/fondue-components64.js +48 -12
  119. package/dist/fondue-components64.js.map +1 -1
  120. package/dist/fondue-components65.js +10 -12
  121. package/dist/fondue-components65.js.map +1 -1
  122. package/dist/fondue-components66.js +11 -19
  123. package/dist/fondue-components66.js.map +1 -1
  124. package/dist/fondue-components67.js +13 -15
  125. package/dist/fondue-components67.js.map +1 -1
  126. package/dist/fondue-components68.js +20 -52
  127. package/dist/fondue-components68.js.map +1 -1
  128. package/dist/fondue-components69.js +15 -15
  129. package/dist/fondue-components69.js.map +1 -1
  130. package/dist/fondue-components7.js +43 -144
  131. package/dist/fondue-components7.js.map +1 -1
  132. package/dist/fondue-components70.js +52 -25
  133. package/dist/fondue-components70.js.map +1 -1
  134. package/dist/fondue-components71.js +14 -17
  135. package/dist/fondue-components71.js.map +1 -1
  136. package/dist/fondue-components72.js +24 -5
  137. package/dist/fondue-components72.js.map +1 -1
  138. package/dist/fondue-components73.js +16 -5
  139. package/dist/fondue-components73.js.map +1 -1
  140. package/dist/fondue-components74.js +7 -2
  141. package/dist/fondue-components74.js.map +1 -1
  142. package/dist/fondue-components75.js +4 -12
  143. package/dist/fondue-components75.js.map +1 -1
  144. package/dist/fondue-components76.js +2 -39
  145. package/dist/fondue-components76.js.map +1 -1
  146. package/dist/fondue-components77.js +18 -0
  147. package/dist/fondue-components77.js.map +1 -0
  148. package/dist/fondue-components78.js +42 -0
  149. package/dist/fondue-components78.js.map +1 -0
  150. package/dist/fondue-components8.js +146 -27
  151. package/dist/fondue-components8.js.map +1 -1
  152. package/dist/fondue-components9.js +28 -125
  153. package/dist/fondue-components9.js.map +1 -1
  154. package/dist/index.d.ts +183 -57
  155. package/dist/style.css +1 -1
  156. package/package.json +6 -5
@@ -1,16 +1,14 @@
1
- import { useEffect as c } from "react";
2
- const s = (t) => {
3
- c(() => {
4
- if (!t.current)
5
- return;
6
- const e = t.current, n = new ResizeObserver(() => {
7
- const r = e.scrollWidth > e.clientWidth;
8
- e.title = r && e.textContent || "";
9
- });
10
- return n.observe(e), () => n.disconnect();
11
- }, [t]);
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: _
12
6
  };
13
7
  export {
14
- s as useTextTruncation
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-components65.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components65.js","sources":["../src/hooks/useTextTruncation.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEffect, type RefObject } from 'react';\n\n/**\n * A custom React hook that automatically manages text truncation and tooltips.\n * It observes the element's size and adds a title attribute with the full text\n * when the content is truncated.\n *\n * @param {RefObject<HTMLElement>} ref - Reference to the HTML element to observe for truncation.\n *\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const textRef = useRef<HTMLDivElement>(null);\n * useTextTruncation(textRef);\n *\n * return <div ref={textRef} className=\"truncate\">Long text content...</div>;\n * });\n * ```\n */\nexport const useTextTruncation = (ref: RefObject<HTMLElement>) => {\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const element = ref.current;\n const observer = new ResizeObserver(() => {\n const isTruncated = element.scrollWidth > element.clientWidth;\n element.title = isTruncated ? element.textContent || '' : '';\n });\n\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref]);\n};\n"],"names":["useTextTruncation","ref","useEffect","element","observer","isTruncated"],"mappings":";AAqBa,MAAAA,IAAoB,CAACC,MAAgC;AAC9D,EAAAC,EAAU,MAAM;AACR,QAAA,CAACD,EAAI;AACL;AAGJ,UAAME,IAAUF,EAAI,SACdG,IAAW,IAAI,eAAe,MAAM;AAChC,YAAAC,IAAcF,EAAQ,cAAcA,EAAQ;AAClD,MAAAA,EAAQ,QAAQE,KAAcF,EAAQ,eAAe;AAAA,IAAK,CAC7D;AAED,WAAAC,EAAS,QAAQD,CAAO,GACjB,MAAMC,EAAS,WAAW;AAAA,EAAA,GAClC,CAACH,CAAG,CAAC;AACZ;"}
1
+ {"version":3,"file":"fondue-components65.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,24 +1,16 @@
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
- table: t,
3
- headerCell: o,
4
- rowCell: l,
5
- caption: e,
6
- cellContent: _,
7
- sortIndicator: n,
8
- body: c,
9
- row: j,
10
- buttonText: r
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
11
7
  };
12
8
  export {
13
- c as body,
14
- r as buttonText,
15
- e as caption,
16
- _ as cellContent,
17
9
  s as default,
18
- o as headerCell,
19
- j as row,
20
- l as rowCell,
21
- n as sortIndicator,
22
- t as table
10
+ o as large,
11
+ _ as medium,
12
+ m as root,
13
+ t as small,
14
+ r as thumb
23
15
  };
24
16
  //# sourceMappingURL=fondue-components66.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components66.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components66.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -1,18 +1,16 @@
1
- function l(t, r) {
2
- const n = 'tr[tabindex="0"]', e = t.closest("table");
3
- if (!e)
4
- return null;
5
- const o = Array.from(e.querySelectorAll(n)), c = o.indexOf(t) + (r === "ArrowUp" ? -1 : 1);
6
- return c >= 0 && c < o.length ? o[c] : null;
7
- }
8
- function u(t) {
9
- const r = t.target, n = r.closest("tr");
10
- if (!n || r !== n || !["ArrowUp", "ArrowDown"].includes(t.key))
11
- return;
12
- const e = l(n, t.key);
13
- e && (t.preventDefault(), e.focus());
14
- }
1
+ import { useEffect as c } from "react";
2
+ const s = (t) => {
3
+ c(() => {
4
+ if (!t.current)
5
+ return;
6
+ const e = t.current, n = new ResizeObserver(() => {
7
+ const r = e.scrollWidth > e.clientWidth;
8
+ e.title = r && e.textContent || "";
9
+ });
10
+ return n.observe(e), () => n.disconnect();
11
+ }, [t]);
12
+ };
15
13
  export {
16
- u as handleKeyDown
14
+ s as useTextTruncation
17
15
  };
18
16
  //# sourceMappingURL=fondue-components67.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components67.js","sources":["../src/components/Table/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type KeyboardEvent } from 'react';\n\nfunction getAdjacentRow(currentRow: HTMLElement, key: 'ArrowUp' | 'ArrowDown'): HTMLElement | null {\n const selector = 'tr[tabindex=\"0\"]';\n const table = currentRow.closest('table');\n if (!table) {\n return null;\n }\n\n const rows = Array.from(table.querySelectorAll(selector));\n const currentIndex = rows.indexOf(currentRow);\n const nextIndex = currentIndex + (key === 'ArrowUp' ? -1 : 1);\n\n return nextIndex >= 0 && nextIndex < rows.length ? (rows[nextIndex] as HTMLElement) : null;\n}\n\nexport function handleKeyDown(event: KeyboardEvent<HTMLTableElement>) {\n const target = event.target as HTMLElement;\n const currentRow = target.closest('tr');\n\n if (!currentRow || target !== currentRow || !['ArrowUp', 'ArrowDown'].includes(event.key)) {\n return;\n }\n\n const nextRow = getAdjacentRow(currentRow, event.key as 'ArrowUp' | 'ArrowDown');\n if (nextRow) {\n event.preventDefault();\n nextRow.focus();\n }\n}\n"],"names":["getAdjacentRow","currentRow","key","selector","table","rows","nextIndex","handleKeyDown","event","target","nextRow"],"mappings":"AAIA,SAASA,EAAeC,GAAyBC,GAAkD;AAC/F,QAAMC,IAAW,oBACXC,IAAQH,EAAW,QAAQ,OAAO;AACxC,MAAI,CAACG;AACM,WAAA;AAGX,QAAMC,IAAO,MAAM,KAAKD,EAAM,iBAAiBD,CAAQ,CAAC,GAElDG,IADeD,EAAK,QAAQJ,CAAU,KACVC,MAAQ,YAAY,KAAK;AAE3D,SAAOI,KAAa,KAAKA,IAAYD,EAAK,SAAUA,EAAKC,CAAS,IAAoB;AAC1F;AAEO,SAASC,EAAcC,GAAwC;AAClE,QAAMC,IAASD,EAAM,QACfP,IAAaQ,EAAO,QAAQ,IAAI;AAEtC,MAAI,CAACR,KAAcQ,MAAWR,KAAc,CAAC,CAAC,WAAW,WAAW,EAAE,SAASO,EAAM,GAAG;AACpF;AAGJ,QAAME,IAAUV,EAAeC,GAAYO,EAAM,GAA8B;AAC/E,EAAIE,MACAF,EAAM,eAAe,GACrBE,EAAQ,MAAM;AAEtB;"}
1
+ {"version":3,"file":"fondue-components67.js","sources":["../src/hooks/useTextTruncation.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEffect, type RefObject } from 'react';\n\n/**\n * A custom React hook that automatically manages text truncation and tooltips.\n * It observes the element's size and adds a title attribute with the full text\n * when the content is truncated.\n *\n * @param {RefObject<HTMLElement>} ref - Reference to the HTML element to observe for truncation.\n *\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const textRef = useRef<HTMLDivElement>(null);\n * useTextTruncation(textRef);\n *\n * return <div ref={textRef} className=\"truncate\">Long text content...</div>;\n * });\n * ```\n */\nexport const useTextTruncation = (ref: RefObject<HTMLElement>) => {\n useEffect(() => {\n if (!ref.current) {\n return;\n }\n\n const element = ref.current;\n const observer = new ResizeObserver(() => {\n const isTruncated = element.scrollWidth > element.clientWidth;\n element.title = isTruncated ? element.textContent || '' : '';\n });\n\n observer.observe(element);\n return () => observer.disconnect();\n }, [ref]);\n};\n"],"names":["useTextTruncation","ref","useEffect","element","observer","isTruncated"],"mappings":";AAqBa,MAAAA,IAAoB,CAACC,MAAgC;AAC9D,EAAAC,EAAU,MAAM;AACR,QAAA,CAACD,EAAI;AACL;AAGJ,UAAME,IAAUF,EAAI,SACdG,IAAW,IAAI,eAAe,MAAM;AAChC,YAAAC,IAAcF,EAAQ,cAAcA,EAAQ;AAClD,MAAAA,EAAQ,QAAQE,KAAcF,EAAQ,eAAe;AAAA,IAAK,CAC7D;AAED,WAAAC,EAAS,QAAQD,CAAO,GACjB,MAAMC,EAAS,WAAW;AAAA,EAAA,GAClC,CAACH,CAAG,CAAC;AACZ;"}
@@ -1,56 +1,24 @@
1
- import { useRef as v, useState as w, useEffect as W, useLayoutEffect as p } from "react";
2
- const b = (e, s) => e.filter((f) => {
3
- var c;
4
- const o = (c = f.ref) == null ? void 0 : c.current;
5
- return o ? o.offsetLeft + o.offsetWidth > (s == null ? void 0 : s.scrollLeft) + s.offsetWidth || o.offsetLeft - s.scrollLeft < 0 : !1;
6
- }), a = (e, s) => {
7
- const f = s.current, o = e == null ? void 0 : e.querySelector('[data-state="active"]');
8
- if (!e || !(o instanceof HTMLButtonElement) || !(f instanceof HTMLSpanElement))
9
- return;
10
- const c = (e == null ? void 0 : e.scrollLeft) > (o == null ? void 0 : o.offsetLeft), d = (o == null ? void 0 : o.offsetLeft) + (o == null ? void 0 : o.offsetWidth) > (e == null ? void 0 : e.offsetWidth);
11
- c ? (e.offsetWidth > o.offsetWidth + o.offsetLeft ? f.style.left = `${o.offsetLeft}px` : f.style.left = `${e.offsetWidth - o.offsetWidth}px`, f.style.width = `${o == null ? void 0 : o.offsetWidth}px`) : d ? (f.style.left = `${e.clientWidth - o.offsetWidth}px`, f.style.width = `${o.offsetWidth}px`) : (f.style.left = `${o.offsetLeft}px`, f.style.width = `${o.offsetWidth}px`);
12
- }, O = ({
13
- activeTab: e
14
- }) => {
15
- const s = v(null), f = v(null), [o, c] = w([]), [d, u] = w([]);
16
- return W(() => {
17
- const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
18
- n instanceof HTMLButtonElement && t instanceof HTMLDivElement && (a(t, f), n.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end" }));
19
- }, [e, f]), p(() => {
20
- var l;
21
- const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
22
- if (t instanceof HTMLDivElement && n instanceof HTMLButtonElement) {
23
- a(t, f);
24
- const r = new MutationObserver(() => {
25
- n.scrollIntoView({ behavior: "instant", block: "nearest", inline: "end" }), a(t, f);
26
- });
27
- t.parentNode && r.observe(t.parentNode, { childList: !0 });
28
- const h = new IntersectionObserver(
29
- () => {
30
- u(b(o, t)), a(t, f);
31
- },
32
- {
33
- root: t,
34
- threshold: 1
35
- }
36
- );
37
- for (const i of o)
38
- (l = i.ref) != null && l.current && h.observe(i.ref.current);
39
- return () => {
40
- h.disconnect(), r.disconnect();
41
- };
42
- }
43
- }, [o, s, f]), {
44
- triggerListRef: s,
45
- activeIndicatorRef: f,
46
- triggersOutOfView: d,
47
- triggers: o,
48
- addTrigger: (t) => {
49
- c((n) => [...n, t]);
50
- }
51
- };
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
+ table: t,
3
+ headerCell: o,
4
+ rowCell: l,
5
+ caption: e,
6
+ cellContent: _,
7
+ sortIndicator: n,
8
+ body: c,
9
+ row: j,
10
+ buttonText: r
52
11
  };
53
12
  export {
54
- O as useTabTriggers
13
+ c as body,
14
+ r as buttonText,
15
+ e as caption,
16
+ _ as cellContent,
17
+ s as default,
18
+ o as headerCell,
19
+ j as row,
20
+ l as rowCell,
21
+ n as sortIndicator,
22
+ t as table
55
23
  };
56
24
  //# sourceMappingURL=fondue-components68.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components68.js","sources":["../src/components/Tabs/hooks/useTabTriggers.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RefObject, useEffect, useLayoutEffect, useRef, useState } from 'react';\n\nimport { type TabTrigger } from '../types';\n\nconst getOverflowingTriggers = (triggers: TabTrigger[], triggerListElement: HTMLDivElement) => {\n return triggers.filter((trigger) => {\n const triggerElement = trigger.ref?.current;\n if (!triggerElement) {\n return false;\n }\n return (\n triggerElement.offsetLeft + triggerElement.offsetWidth >\n triggerListElement?.scrollLeft + triggerListElement.offsetWidth ||\n triggerElement.offsetLeft - triggerListElement.scrollLeft < 0\n );\n });\n};\n\nconst moveActiveIndicator = (triggerListElement: HTMLDivElement, activeIndicatorRef: RefObject<HTMLSpanElement>) => {\n const activeIndicatorElement = activeIndicatorRef.current;\n const activeTriggerElement = triggerListElement?.querySelector('[data-state=\"active\"]');\n\n if (\n !triggerListElement ||\n !(activeTriggerElement instanceof HTMLButtonElement) ||\n !(activeIndicatorElement instanceof HTMLSpanElement)\n ) {\n return;\n }\n\n const isOverflowingLeft = triggerListElement?.scrollLeft > activeTriggerElement?.offsetLeft;\n const isOverflowingRight =\n activeTriggerElement?.offsetLeft + activeTriggerElement?.offsetWidth > triggerListElement?.offsetWidth;\n\n if (isOverflowingLeft) {\n const willFitAllItemsToTheLeft =\n triggerListElement.offsetWidth > activeTriggerElement.offsetWidth + activeTriggerElement.offsetLeft;\n if (willFitAllItemsToTheLeft) {\n activeIndicatorElement.style.left = `${activeTriggerElement.offsetLeft}px`;\n } else {\n activeIndicatorElement.style.left = `${triggerListElement.offsetWidth - activeTriggerElement.offsetWidth}px`;\n }\n activeIndicatorElement.style.width = `${activeTriggerElement?.offsetWidth}px`;\n } else if (isOverflowingRight) {\n activeIndicatorElement.style.left = `${triggerListElement.clientWidth - activeTriggerElement.offsetWidth}px`;\n activeIndicatorElement.style.width = `${activeTriggerElement.offsetWidth}px`;\n } else {\n activeIndicatorElement.style.left = `${activeTriggerElement.offsetLeft}px`;\n activeIndicatorElement.style.width = `${activeTriggerElement.offsetWidth}px`;\n }\n};\n\nexport const useTabTriggers = ({\n activeTab,\n}: {\n activeTab?: string;\n}): {\n triggerListRef: RefObject<HTMLDivElement>;\n activeIndicatorRef: RefObject<HTMLSpanElement>;\n triggers: TabTrigger[];\n triggersOutOfView: TabTrigger[];\n addTrigger: (trigger: TabTrigger) => void;\n} => {\n const triggerListRef = useRef<HTMLDivElement | null>(null);\n const activeIndicatorRef = useRef<HTMLSpanElement | null>(null);\n const [triggers, setTriggers] = useState<TabTrigger[]>([]);\n const [triggersOutOfView, setTriggersOutOfView] = useState<TabTrigger[]>([]);\n\n // move the active indicator and scroll to the correct position when the tab changes\n useEffect(() => {\n const triggerListElement = triggerListRef.current;\n const activeTriggerElement = triggerListElement?.querySelector('[data-state=\"active\"]');\n\n if (activeTriggerElement instanceof HTMLButtonElement && triggerListElement instanceof HTMLDivElement) {\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n activeTriggerElement.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'end' });\n }\n }, [activeTab, activeIndicatorRef]);\n\n useLayoutEffect(() => {\n const triggerListElement = triggerListRef.current;\n const activeTriggerElement = triggerListElement?.querySelector('[data-state=\"active\"]');\n\n if (triggerListElement instanceof HTMLDivElement && activeTriggerElement instanceof HTMLButtonElement) {\n // move the active indicator to the initial active tab\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n\n // observe addition of the dropdown trigger which reduces the available width\n const mutationObserver = new MutationObserver(() => {\n activeTriggerElement.scrollIntoView({ behavior: 'instant', block: 'nearest', inline: 'end' });\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n });\n if (triggerListElement.parentNode) {\n mutationObserver.observe(triggerListElement.parentNode, { childList: true });\n }\n\n // calculate the overflowing elements when item starts overflowing the parent\n const intersectionObserver = new IntersectionObserver(\n () => {\n setTriggersOutOfView(getOverflowingTriggers(triggers, triggerListElement));\n moveActiveIndicator(triggerListElement, activeIndicatorRef);\n },\n {\n root: triggerListElement,\n threshold: 1,\n },\n );\n for (const trigger of triggers) {\n if (trigger.ref?.current) {\n intersectionObserver.observe(trigger.ref.current);\n }\n }\n\n return () => {\n intersectionObserver.disconnect();\n mutationObserver.disconnect();\n };\n }\n }, [triggers, triggerListRef, activeIndicatorRef]);\n\n return {\n triggerListRef,\n activeIndicatorRef,\n triggersOutOfView,\n triggers,\n addTrigger: (trigger) => {\n setTriggers((prev) => [...prev, trigger]);\n },\n };\n};\n"],"names":["getOverflowingTriggers","triggers","triggerListElement","trigger","triggerElement","_a","moveActiveIndicator","activeIndicatorRef","activeIndicatorElement","activeTriggerElement","isOverflowingLeft","isOverflowingRight","useTabTriggers","activeTab","triggerListRef","useRef","setTriggers","useState","triggersOutOfView","setTriggersOutOfView","useEffect","useLayoutEffect","mutationObserver","intersectionObserver","prev"],"mappings":"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"}
1
+ {"version":3,"file":"fondue-components68.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -1,18 +1,18 @@
1
- const t = "_root_13jbx_5", r = "_triggerList_13jbx_14", e = "_triggerListWrapper_13jbx_28", i = "_trigger_13jbx_14", o = "_content_13jbx_78", g = "_activeIndicator_13jbx_94", _ = {
2
- root: t,
3
- triggerList: r,
4
- triggerListWrapper: e,
5
- trigger: i,
6
- content: o,
7
- activeIndicator: g
8
- };
1
+ function l(t, r) {
2
+ const n = 'tr[tabindex="0"]', e = t.closest("table");
3
+ if (!e)
4
+ return null;
5
+ const o = Array.from(e.querySelectorAll(n)), c = o.indexOf(t) + (r === "ArrowUp" ? -1 : 1);
6
+ return c >= 0 && c < o.length ? o[c] : null;
7
+ }
8
+ function u(t) {
9
+ const r = t.target, n = r.closest("tr");
10
+ if (!n || r !== n || !["ArrowUp", "ArrowDown"].includes(t.key))
11
+ return;
12
+ const e = l(n, t.key);
13
+ e && (t.preventDefault(), e.focus());
14
+ }
9
15
  export {
10
- g as activeIndicator,
11
- o as content,
12
- _ as default,
13
- t as root,
14
- i as trigger,
15
- r as triggerList,
16
- e as triggerListWrapper
16
+ u as handleKeyDown
17
17
  };
18
18
  //# sourceMappingURL=fondue-components69.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components69.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"fondue-components69.js","sources":["../src/components/Table/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type KeyboardEvent } from 'react';\n\nfunction getAdjacentRow(currentRow: HTMLElement, key: 'ArrowUp' | 'ArrowDown'): HTMLElement | null {\n const selector = 'tr[tabindex=\"0\"]';\n const table = currentRow.closest('table');\n if (!table) {\n return null;\n }\n\n const rows = Array.from(table.querySelectorAll(selector));\n const currentIndex = rows.indexOf(currentRow);\n const nextIndex = currentIndex + (key === 'ArrowUp' ? -1 : 1);\n\n return nextIndex >= 0 && nextIndex < rows.length ? (rows[nextIndex] as HTMLElement) : null;\n}\n\nexport function handleKeyDown(event: KeyboardEvent<HTMLTableElement>) {\n const target = event.target as HTMLElement;\n const currentRow = target.closest('tr');\n\n if (!currentRow || target !== currentRow || !['ArrowUp', 'ArrowDown'].includes(event.key)) {\n return;\n }\n\n const nextRow = getAdjacentRow(currentRow, event.key as 'ArrowUp' | 'ArrowDown');\n if (nextRow) {\n event.preventDefault();\n nextRow.focus();\n }\n}\n"],"names":["getAdjacentRow","currentRow","key","selector","table","rows","nextIndex","handleKeyDown","event","target","nextRow"],"mappings":"AAIA,SAASA,EAAeC,GAAyBC,GAAkD;AAC/F,QAAMC,IAAW,oBACXC,IAAQH,EAAW,QAAQ,OAAO;AACxC,MAAI,CAACG;AACM,WAAA;AAGX,QAAMC,IAAO,MAAM,KAAKD,EAAM,iBAAiBD,CAAQ,CAAC,GAElDG,IADeD,EAAK,QAAQJ,CAAU,KACVC,MAAQ,YAAY,KAAK;AAE3D,SAAOI,KAAa,KAAKA,IAAYD,EAAK,SAAUA,EAAKC,CAAS,IAAoB;AAC1F;AAEO,SAASC,EAAcC,GAAwC;AAClE,QAAMC,IAASD,EAAM,QACfP,IAAaQ,EAAO,QAAQ,IAAI;AAEtC,MAAI,CAACR,KAAcQ,MAAWR,KAAc,CAAC,CAAC,WAAW,WAAW,EAAE,SAASO,EAAM,GAAG;AACpF;AAGJ,QAAME,IAAUV,EAAeC,GAAYO,EAAM,GAA8B;AAC/E,EAAIE,MACAF,EAAM,eAAe,GACrBE,EAAQ,MAAM;AAEtB;"}
@@ -1,152 +1,51 @@
1
- import { jsx as e, jsxs as P } from "react/jsx-runtime";
2
- import { IconCross as j } from "@frontify/fondue-icons";
3
- import * as d from "@radix-ui/react-dialog";
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(
12
- d.Trigger,
13
- {
14
- onMouseDown: L,
15
- "data-auto-focus-visible": "true",
16
- "data-auto-focus-trigger": !0,
17
- "data-test-id": a,
18
- asChild: t,
19
- ref: r,
20
- ...i,
21
- children: o
22
- }
23
- );
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 = ({
29
- maxWidth: t = "800px",
30
- minWidth: o = "400px",
31
- minHeight: a = "200px",
32
- padding: i = "compact",
33
- verticalAlign: r = "center",
34
- "data-test-id": s = "fondue-dialog-content",
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(
51
- d.Content,
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { Slot as u } from "@radix-ui/react-slot";
3
+ import { forwardRef as k, useState as R, Children as P } from "react";
4
+ import { ForwardedRefColorGradientInput as F } from "./fondue-components38.js";
5
+ import { ForwardedRefColorPickerInput as y } from "./fondue-components39.js";
6
+ import { ForwardedRefColorValueInput as N } from "./fondue-components40.js";
7
+ import I from "./fondue-components41.js";
8
+ import { getColorWithName as d, DEFAULT_COLOR as w, DEFAULT_FORMAT as h } from "./fondue-components42.js";
9
+ const m = ({
10
+ children: t,
11
+ currentColor: o = w,
12
+ onColorChange: a = () => {
13
+ },
14
+ defaultFormat: p = h,
15
+ "data-test-id": s = "color-picker-input",
16
+ ...c
17
+ }, n) => {
18
+ const [l, C] = R(p);
19
+ return /* @__PURE__ */ i("div", { className: I.root, "data-picker-type": "custom-color", "data-test-id": s, ref: n, children: P.map(t, (f) => /* @__PURE__ */ i(
20
+ G,
52
21
  {
53
- style: {
54
- "--dialog-max-width": t,
55
- "--dialog-min-width": o,
56
- "--dialog-min-height": a
22
+ ...c,
23
+ onColorChange: (r) => {
24
+ a(d(r, l));
57
25
  },
58
- ref: c,
59
- className: n.content,
60
- onFocus: $,
61
- onOpenAutoFocus: H,
62
- "data-dialog-padding": i,
63
- "data-dialog-rounded": T,
64
- "data-test-id": s,
65
- "data-dialog-vertical-align": r,
66
- ...S,
67
- children: w
26
+ currentColor: o,
27
+ currentFormat: l,
28
+ setCurrentFormat: (r) => {
29
+ C(r), a(d(o, r));
30
+ },
31
+ children: f
68
32
  }
69
- ) }) }) });
33
+ )) });
70
34
  };
71
- D.displayName = "Dialog.Content";
72
- const h = ({
73
- padding: t,
74
- showBorder: o = !0,
75
- showCloseButton: a = !0,
76
- children: i,
77
- "data-test-id": r = "fondue-dialog-header"
78
- }, s) => /* @__PURE__ */ P(
79
- "div",
80
- {
81
- "data-test-id": r,
82
- ref: s,
83
- className: n.header,
84
- "data-dialog-header-padding": t,
85
- "data-show-border": o,
86
- "data-dialog-layout-component": "header",
87
- children: [
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 }) })
90
- ]
91
- }
92
- );
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(
95
- "div",
96
- {
97
- "data-test-id": i,
98
- ref: r,
99
- className: n.footer,
100
- "data-dialog-footer-padding": t,
101
- "data-show-border": o,
102
- "data-dialog-layout-component": "footer",
103
- children: a
104
- }
105
- );
106
- C.displayName = "Dialog.Footer";
107
- const N = ({ padding: t, children: o, "data-test-id": a = "fondue-dialog-body" }, i) => /* @__PURE__ */ e(
108
- "div",
109
- {
110
- "data-test-id": a,
111
- ref: i,
112
- className: n.body,
113
- "data-dialog-body-padding": t,
114
- "data-dialog-layout-component": "body",
115
- children: o
116
- }
117
- );
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)
35
+ m.displayName = "ColorPicker";
36
+ const G = ({ children: t, ...o }) => /* @__PURE__ */ i(u, { ...o, children: t }), V = k(m), e = {
37
+ Root: V,
38
+ Values: N,
39
+ Gradient: F,
40
+ Input: y
138
41
  };
42
+ e.Root.displayName = "ColorPicker.Root";
43
+ e.Values.displayName = "ColorPicker.Values";
44
+ e.Gradient.displayName = "ColorPicker.Gradient";
45
+ e.Input.displayName = "ColorPicker.Input";
139
46
  export {
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
47
+ e as ColorPicker,
48
+ m as ColorPickerRoot,
49
+ V as ForwardedRefColorPicker
151
50
  };
152
51
  //# 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 {\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":"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"}
1
+ {"version":3,"file":"fondue-components7.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The default format to use for the color input\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [currentFormat, setCurrentFormat] = useState<ColorFormat>(defaultFormat);\n\n return (\n <div className={styles.root} data-picker-type=\"custom-color\" data-test-id={dataTestId} ref={forwardedRef}>\n {Children.map(children, (child) => (\n <ColorPickerSlot\n {...props}\n onColorChange={(color: RgbaColor) => {\n onColorChange(getColorWithName(color, currentFormat));\n }}\n currentColor={currentColor}\n currentFormat={currentFormat}\n setCurrentFormat={(currentFormat: ColorFormat) => {\n setCurrentFormat(currentFormat);\n onColorChange(getColorWithName(currentColor, currentFormat));\n }}\n >\n {child}\n </ColorPickerSlot>\n ))}\n </div>\n );\n};\nColorPickerRoot.displayName = 'ColorPicker';\n\ntype ColorPickerSlotProps = ColorPickerProps & {\n currentFormat?: ColorFormat;\n setCurrentFormat?: (format: ColorFormat) => void;\n};\nconst ColorPickerSlot = ({ children, ...props }: ColorPickerSlotProps) => <RadixSlot {...props}>{children}</RadixSlot>;\n\nexport const ForwardedRefColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(ColorPickerRoot);\n\nexport const ColorPicker = {\n Root: ForwardedRefColorPicker,\n Values: ForwardedRefColorValueInput,\n Gradient: ForwardedRefColorGradientInput,\n Input: ForwardedRefColorPickerInput,\n};\n\nColorPicker.Root.displayName = 'ColorPicker.Root';\nColorPicker.Values.displayName = 'ColorPicker.Values';\nColorPicker.Gradient.displayName = 'ColorPicker.Gradient';\nColorPicker.Input.displayName = 'ColorPicker.Input';\n"],"names":["ColorPickerRoot","children","currentColor","DEFAULT_COLOR","onColorChange","defaultFormat","DEFAULT_FORMAT","dataTestId","props","forwardedRef","currentFormat","setCurrentFormat","useState","jsx","styles","Children","child","ColorPickerSlot","color","getColorWithName","RadixSlot","ForwardedRefColorPicker","forwardRef","ColorPicker","ForwardedRefColorValueInput","ForwardedRefColorGradientInput","ForwardedRefColorPickerInput"],"mappings":";;;;;;;;AAoCO,MAAMA,IAAkB,CAC3B;AAAA,EACI,UAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC,IAAgBC;AAAA,EAChB,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAsBP,CAAa;AAE7E,SACK,gBAAAQ,EAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,oBAAiB,gBAAe,gBAAcP,GAAY,KAAKE,GACvF,UAAAM,EAAS,IAAId,GAAU,CAACe,MACrB,gBAAAH;AAAA,IAACI;AAAA,IAAA;AAAA,MACI,GAAGT;AAAA,MACJ,eAAe,CAACU,MAAqB;AACnB,QAAAd,EAAAe,EAAiBD,GAAOR,CAAa,CAAC;AAAA,MACxD;AAAA,MACA,cAAAR;AAAA,MACA,eAAAQ;AAAA,MACA,kBAAkB,CAACA,MAA+B;AAC9C,QAAAC,EAAiBD,CAAa,GAChBN,EAAAe,EAAiBjB,GAAcQ,CAAa,CAAC;AAAA,MAC/D;AAAA,MAEC,UAAAM;AAAA,IAAA;AAAA,EAER,CAAA,GACL;AAER;AACAhB,EAAgB,cAAc;AAM9B,MAAMiB,IAAkB,CAAC,EAAE,UAAAhB,GAAU,GAAGO,EAAM,MAA6B,gBAAAK,EAAAO,GAAA,EAAW,GAAGZ,GAAQ,UAAAP,GAAS,GAE7FoB,IAA0BC,EAA6CtB,CAAe,GAEtFuB,IAAc;AAAA,EACvB,MAAMF;AAAA,EACN,QAAQG;AAAA,EACR,UAAUC;AAAA,EACV,OAAOC;AACX;AAEAH,EAAY,KAAK,cAAc;AAC/BA,EAAY,OAAO,cAAc;AACjCA,EAAY,SAAS,cAAc;AACnCA,EAAY,MAAM,cAAc;"}
@@ -1,29 +1,56 @@
1
- const o = "_root_1cjgh_2", _ = {
2
- root: o,
3
- "weight-default": "_weight-default_1cjgh_7",
4
- "weight-strong": "_weight-strong_1cjgh_11",
5
- "weight-x-strong": "_weight-x-strong_1cjgh_15",
6
- "size-x-small": "_size-x-small_1cjgh_19",
7
- "size-small": "_size-small_1cjgh_24",
8
- "size-medium": "_size-medium_1cjgh_29",
9
- "size-large": "_size-large_1cjgh_34",
10
- "color-default": "_color-default_1cjgh_39",
11
- "color-weak": "_color-weak_1cjgh_43",
12
- "color-x-weak": "_color-x-weak_1cjgh_47",
13
- "color-disabled": "_color-disabled_1cjgh_51",
14
- "color-negative": "_color-negative_1cjgh_55",
15
- "color-positive": "_color-positive_1cjgh_59",
16
- "color-warning": "_color-warning_1cjgh_63",
17
- "color-interactive": "_color-interactive_1cjgh_67",
18
- "color-box-neutral": "_color-box-neutral_1cjgh_71",
19
- "color-box-selected": "_color-box-selected_1cjgh_75",
20
- "color-box-disabled": "_color-box-disabled_1cjgh_79",
21
- "color-box-positive": "_color-box-positive_1cjgh_83",
22
- "color-box-negative": "_color-box-negative_1cjgh_87",
23
- "color-box-warning": "_color-box-warning_1cjgh_91"
1
+ import { useRef as v, useState as w, useEffect as W, useLayoutEffect as p } from "react";
2
+ const b = (e, s) => e.filter((f) => {
3
+ var c;
4
+ const o = (c = f.ref) == null ? void 0 : c.current;
5
+ return o ? o.offsetLeft + o.offsetWidth > (s == null ? void 0 : s.scrollLeft) + s.offsetWidth || o.offsetLeft - s.scrollLeft < 0 : !1;
6
+ }), a = (e, s) => {
7
+ const f = s.current, o = e == null ? void 0 : e.querySelector('[data-state="active"]');
8
+ if (!e || !(o instanceof HTMLButtonElement) || !(f instanceof HTMLSpanElement))
9
+ return;
10
+ const c = (e == null ? void 0 : e.scrollLeft) > (o == null ? void 0 : o.offsetLeft), d = (o == null ? void 0 : o.offsetLeft) + (o == null ? void 0 : o.offsetWidth) > (e == null ? void 0 : e.offsetWidth);
11
+ c ? (e.offsetWidth > o.offsetWidth + o.offsetLeft ? f.style.left = `${o.offsetLeft}px` : f.style.left = `${e.offsetWidth - o.offsetWidth}px`, f.style.width = `${o == null ? void 0 : o.offsetWidth}px`) : d ? (f.style.left = `${e.clientWidth - o.offsetWidth}px`, f.style.width = `${o.offsetWidth}px`) : (f.style.left = `${o.offsetLeft}px`, f.style.width = `${o.offsetWidth}px`);
12
+ }, O = ({
13
+ activeTab: e
14
+ }) => {
15
+ const s = v(null), f = v(null), [o, c] = w([]), [d, u] = w([]);
16
+ return W(() => {
17
+ const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
18
+ n instanceof HTMLButtonElement && t instanceof HTMLDivElement && (a(t, f), n.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end" }));
19
+ }, [e, f]), p(() => {
20
+ var l;
21
+ const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
22
+ if (t instanceof HTMLDivElement && n instanceof HTMLButtonElement) {
23
+ a(t, f);
24
+ const r = new MutationObserver(() => {
25
+ n.scrollIntoView({ behavior: "instant", block: "nearest", inline: "end" }), a(t, f);
26
+ });
27
+ t.parentNode && r.observe(t.parentNode, { childList: !0 });
28
+ const h = new IntersectionObserver(
29
+ () => {
30
+ u(b(o, t)), a(t, f);
31
+ },
32
+ {
33
+ root: t,
34
+ threshold: 1
35
+ }
36
+ );
37
+ for (const i of o)
38
+ (l = i.ref) != null && l.current && h.observe(i.ref.current);
39
+ return () => {
40
+ h.disconnect(), r.disconnect();
41
+ };
42
+ }
43
+ }, [o, s, f]), {
44
+ triggerListRef: s,
45
+ activeIndicatorRef: f,
46
+ triggersOutOfView: d,
47
+ triggers: o,
48
+ addTrigger: (t) => {
49
+ c((n) => [...n, t]);
50
+ }
51
+ };
24
52
  };
25
53
  export {
26
- _ as default,
27
- o as root
54
+ O as useTabTriggers
28
55
  };
29
56
  //# sourceMappingURL=fondue-components70.js.map