@frontify/fondue-components 20.0.0-rc.0 → 21.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 (175) hide show
  1. package/dist/fondue-components.js +46 -50
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +3 -3
  4. package/dist/fondue-components10.js.map +1 -1
  5. package/dist/fondue-components11.js +66 -84
  6. package/dist/fondue-components11.js.map +1 -1
  7. package/dist/fondue-components12.js +2 -2
  8. package/dist/fondue-components13.js +49 -50
  9. package/dist/fondue-components13.js.map +1 -1
  10. package/dist/fondue-components14.js +2 -2
  11. package/dist/fondue-components15.js +2 -2
  12. package/dist/fondue-components16.js +2 -2
  13. package/dist/fondue-components17.js +36 -56
  14. package/dist/fondue-components17.js.map +1 -1
  15. package/dist/fondue-components18.js +16 -34
  16. package/dist/fondue-components18.js.map +1 -1
  17. package/dist/fondue-components19.js +71 -21
  18. package/dist/fondue-components19.js.map +1 -1
  19. package/dist/fondue-components20.js +36 -18
  20. package/dist/fondue-components20.js.map +1 -1
  21. package/dist/fondue-components21.js +55 -71
  22. package/dist/fondue-components21.js.map +1 -1
  23. package/dist/fondue-components22.js +138 -36
  24. package/dist/fondue-components22.js.map +1 -1
  25. package/dist/fondue-components23.js +50 -50
  26. package/dist/fondue-components23.js.map +1 -1
  27. package/dist/fondue-components24.js +29 -138
  28. package/dist/fondue-components24.js.map +1 -1
  29. package/dist/fondue-components25.js +157 -53
  30. package/dist/fondue-components25.js.map +1 -1
  31. package/dist/fondue-components26.js +137 -29
  32. package/dist/fondue-components26.js.map +1 -1
  33. package/dist/fondue-components27.js +127 -157
  34. package/dist/fondue-components27.js.map +1 -1
  35. package/dist/fondue-components28.js +30 -134
  36. package/dist/fondue-components28.js.map +1 -1
  37. package/dist/fondue-components29.js +58 -128
  38. package/dist/fondue-components29.js.map +1 -1
  39. package/dist/fondue-components3.js +1 -1
  40. package/dist/fondue-components30.js +101 -31
  41. package/dist/fondue-components30.js.map +1 -1
  42. package/dist/fondue-components31.js +12 -59
  43. package/dist/fondue-components31.js.map +1 -1
  44. package/dist/fondue-components32.js +52 -97
  45. package/dist/fondue-components32.js.map +1 -1
  46. package/dist/fondue-components33.js +20 -12
  47. package/dist/fondue-components33.js.map +1 -1
  48. package/dist/fondue-components34.js +7 -56
  49. package/dist/fondue-components34.js.map +1 -1
  50. package/dist/fondue-components35.js +6 -20
  51. package/dist/fondue-components35.js.map +1 -1
  52. package/dist/fondue-components36.js +32 -8
  53. package/dist/fondue-components36.js.map +1 -1
  54. package/dist/fondue-components37.js +3 -5
  55. package/dist/fondue-components37.js.map +1 -1
  56. package/dist/fondue-components38.js +12 -32
  57. package/dist/fondue-components38.js.map +1 -1
  58. package/dist/fondue-components39.js +155 -5
  59. package/dist/fondue-components39.js.map +1 -1
  60. package/dist/fondue-components4.js +2 -2
  61. package/dist/fondue-components40.js +116 -18
  62. package/dist/fondue-components40.js.map +1 -1
  63. package/dist/fondue-components41.js +22 -59
  64. package/dist/fondue-components41.js.map +1 -1
  65. package/dist/fondue-components42.js +14 -111
  66. package/dist/fondue-components42.js.map +1 -1
  67. package/dist/fondue-components43.js +30 -116
  68. package/dist/fondue-components43.js.map +1 -1
  69. package/dist/fondue-components44.js +53 -21
  70. package/dist/fondue-components44.js.map +1 -1
  71. package/dist/fondue-components45.js +129 -31
  72. package/dist/fondue-components45.js.map +1 -1
  73. package/dist/fondue-components46.js +20 -52
  74. package/dist/fondue-components46.js.map +1 -1
  75. package/dist/fondue-components47.js +53 -130
  76. package/dist/fondue-components47.js.map +1 -1
  77. package/dist/fondue-components48.js +7 -20
  78. package/dist/fondue-components48.js.map +1 -1
  79. package/dist/fondue-components49.js +13 -53
  80. package/dist/fondue-components49.js.map +1 -1
  81. package/dist/fondue-components5.js +2 -2
  82. package/dist/fondue-components50.js +14 -7
  83. package/dist/fondue-components50.js.map +1 -1
  84. package/dist/fondue-components51.js +5 -13
  85. package/dist/fondue-components51.js.map +1 -1
  86. package/dist/fondue-components52.js +60 -15
  87. package/dist/fondue-components52.js.map +1 -1
  88. package/dist/fondue-components53.js +18 -5
  89. package/dist/fondue-components53.js.map +1 -1
  90. package/dist/fondue-components54.js +19 -59
  91. package/dist/fondue-components54.js.map +1 -1
  92. package/dist/fondue-components55.js +5 -18
  93. package/dist/fondue-components55.js.map +1 -1
  94. package/dist/fondue-components56.js +14 -18
  95. package/dist/fondue-components56.js.map +1 -1
  96. package/dist/fondue-components57.js +1 -1
  97. package/dist/fondue-components58.js +16 -10
  98. package/dist/fondue-components58.js.map +1 -1
  99. package/dist/fondue-components59.js +10 -4
  100. package/dist/fondue-components59.js.map +1 -1
  101. package/dist/fondue-components6.js +4 -4
  102. package/dist/fondue-components60.js +35 -18
  103. package/dist/fondue-components60.js.map +1 -1
  104. package/dist/fondue-components61.js +4 -10
  105. package/dist/fondue-components61.js.map +1 -1
  106. package/dist/fondue-components62.js +10 -34
  107. package/dist/fondue-components62.js.map +1 -1
  108. package/dist/fondue-components63.js +5 -35
  109. package/dist/fondue-components63.js.map +1 -1
  110. package/dist/fondue-components64.js +24 -4
  111. package/dist/fondue-components64.js.map +1 -1
  112. package/dist/fondue-components65.js +16 -12
  113. package/dist/fondue-components65.js.map +1 -1
  114. package/dist/fondue-components66.js +150 -4
  115. package/dist/fondue-components66.js.map +1 -1
  116. package/dist/fondue-components67.js +19 -25
  117. package/dist/fondue-components67.js.map +1 -1
  118. package/dist/fondue-components68.js +77 -16
  119. package/dist/fondue-components68.js.map +1 -1
  120. package/dist/fondue-components69.js +8 -151
  121. package/dist/fondue-components69.js.map +1 -1
  122. package/dist/fondue-components7.js +2 -2
  123. package/dist/fondue-components70.js +37 -19
  124. package/dist/fondue-components70.js.map +1 -1
  125. package/dist/fondue-components71.js +69 -76
  126. package/dist/fondue-components71.js.map +1 -1
  127. package/dist/fondue-components72.js +11 -8
  128. package/dist/fondue-components72.js.map +1 -1
  129. package/dist/fondue-components73.js +12 -36
  130. package/dist/fondue-components73.js.map +1 -1
  131. package/dist/fondue-components74.js +12 -70
  132. package/dist/fondue-components74.js.map +1 -1
  133. package/dist/fondue-components75.js +20 -10
  134. package/dist/fondue-components75.js.map +1 -1
  135. package/dist/fondue-components76.js +34 -13
  136. package/dist/fondue-components76.js.map +1 -1
  137. package/dist/fondue-components77.js +10 -12
  138. package/dist/fondue-components77.js.map +1 -1
  139. package/dist/fondue-components78.js +55 -20
  140. package/dist/fondue-components78.js.map +1 -1
  141. package/dist/fondue-components79.js +15 -34
  142. package/dist/fondue-components79.js.map +1 -1
  143. package/dist/fondue-components8.js +5 -5
  144. package/dist/fondue-components80.js +24 -9
  145. package/dist/fondue-components80.js.map +1 -1
  146. package/dist/fondue-components81.js +14 -55
  147. package/dist/fondue-components81.js.map +1 -1
  148. package/dist/fondue-components82.js +22 -14
  149. package/dist/fondue-components82.js.map +1 -1
  150. package/dist/fondue-components83.js +6 -24
  151. package/dist/fondue-components83.js.map +1 -1
  152. package/dist/fondue-components84.js +5 -13
  153. package/dist/fondue-components84.js.map +1 -1
  154. package/dist/fondue-components85.js +4 -22
  155. package/dist/fondue-components85.js.map +1 -1
  156. package/dist/fondue-components86.js +4 -8
  157. package/dist/fondue-components86.js.map +1 -1
  158. package/dist/fondue-components87.js +2 -7
  159. package/dist/fondue-components87.js.map +1 -1
  160. package/dist/fondue-components88.js +15 -3
  161. package/dist/fondue-components88.js.map +1 -1
  162. package/dist/fondue-components89.js +39 -4
  163. package/dist/fondue-components89.js.map +1 -1
  164. package/dist/fondue-components9.js +4 -4
  165. package/dist/fondue-components90.js +6 -17
  166. package/dist/fondue-components90.js.map +1 -1
  167. package/dist/index.d.ts +4 -117
  168. package/dist/style.css +1 -1
  169. package/package.json +5 -6
  170. package/dist/fondue-components91.js +0 -43
  171. package/dist/fondue-components91.js.map +0 -1
  172. package/dist/fondue-components92.js +0 -9
  173. package/dist/fondue-components92.js.map +0 -1
  174. package/dist/fondue-components93.js +0 -5
  175. package/dist/fondue-components93.js.map +0 -1
@@ -1,16 +1,37 @@
1
- const o = "_root_16o1v_5", t = "_small_16o1v_16", _ = "_medium_16o1v_20", m = "_large_16o1v_24", s = "_thumb_16o1v_62", l = {
2
- root: o,
3
- small: t,
4
- medium: _,
5
- large: m,
6
- thumb: s
7
- };
1
+ function s(e, n) {
2
+ const r = 'tr[tabindex="0"]', t = e.closest("table");
3
+ if (!t)
4
+ return null;
5
+ const o = Array.from(t.querySelectorAll(r)), l = o.indexOf(e) + (n === "ArrowUp" ? -1 : 1);
6
+ return l >= 0 && l < o.length ? o[l] : null;
7
+ }
8
+ function a(e) {
9
+ const n = e.target, r = n.closest("tr");
10
+ if (!r || n !== r || !["ArrowUp", "ArrowDown"].includes(e.key))
11
+ return;
12
+ const t = s(r, e.key);
13
+ t && (e.preventDefault(), t.focus());
14
+ }
15
+ const u = [HTMLButtonElement, HTMLAnchorElement], i = ["button", "link"];
16
+ function f(e) {
17
+ if (!e)
18
+ return !1;
19
+ const { target: n, currentTarget: r } = e;
20
+ let t = n instanceof Element ? n : null;
21
+ if (!r.contains(t))
22
+ return !0;
23
+ for (; t && !(t instanceof HTMLTableRowElement); ) {
24
+ if (u.some((c) => t instanceof c))
25
+ return !0;
26
+ const o = t.getAttribute("role");
27
+ if (o && i.includes(o))
28
+ return !0;
29
+ t = t.parentElement;
30
+ }
31
+ return !1;
32
+ }
8
33
  export {
9
- l as default,
10
- m as large,
11
- _ as medium,
12
- o as root,
13
- t as small,
14
- s as thumb
34
+ a as handleKeyDown,
35
+ f as shouldIgnoreRowClick
15
36
  };
16
37
  //# sourceMappingURL=fondue-components76.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components76.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"fondue-components76.js","sources":["../src/components/Table/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type KeyboardEvent, type MouseEvent } 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\nconst INTERACTIVE_ELEMENTS_LIST = [HTMLButtonElement, HTMLAnchorElement];\nconst INTERACTIVE_ROLES_LIST = ['button', 'link'];\n\nexport function shouldIgnoreRowClick(event?: MouseEvent): boolean {\n if (!event) {\n return false;\n }\n\n const { target, currentTarget } = event;\n\n let element = target instanceof Element ? target : null;\n\n if (!currentTarget.contains(element)) {\n return true;\n }\n\n while (element && !(element instanceof HTMLTableRowElement)) {\n if (INTERACTIVE_ELEMENTS_LIST.some((interactiveElement) => element instanceof interactiveElement)) {\n return true;\n }\n\n const role = element.getAttribute('role');\n if (role && INTERACTIVE_ROLES_LIST.includes(role)) {\n return true;\n }\n\n element = element.parentElement;\n }\n\n return false;\n}\n"],"names":["getAdjacentRow","currentRow","key","selector","table","rows","nextIndex","handleKeyDown","event","target","nextRow","INTERACTIVE_ELEMENTS_LIST","INTERACTIVE_ROLES_LIST","shouldIgnoreRowClick","currentTarget","element","interactiveElement","role"],"mappings":"AAIA,SAASA,EAAeC,GAAyBC,GAAkD;AAC/F,QAAMC,IAAW,oBACXC,IAAQH,EAAW,QAAQ,OAAO;AACxC,MAAI,CAACG;AACD,WAAO;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,eAAA,GACNE,EAAQ,MAAA;AAEhB;AAEA,MAAMC,IAA4B,CAAC,mBAAmB,iBAAiB,GACjEC,IAAyB,CAAC,UAAU,MAAM;AAEzC,SAASC,EAAqBL,GAA6B;AAC9D,MAAI,CAACA;AACD,WAAO;AAGX,QAAM,EAAE,QAAAC,GAAQ,eAAAK,EAAA,IAAkBN;AAElC,MAAIO,IAAUN,aAAkB,UAAUA,IAAS;AAEnD,MAAI,CAACK,EAAc,SAASC,CAAO;AAC/B,WAAO;AAGX,SAAOA,KAAW,EAAEA,aAAmB,wBAAsB;AACzD,QAAIJ,EAA0B,KAAK,CAACK,MAAuBD,aAAmBC,CAAkB;AAC5F,aAAO;AAGX,UAAMC,IAAOF,EAAQ,aAAa,MAAM;AACxC,QAAIE,KAAQL,EAAuB,SAASK,CAAI;AAC5C,aAAO;AAGX,IAAAF,IAAUA,EAAQ;AAAA,EACtB;AAEA,SAAO;AACX;"}
@@ -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_1cw3g_3", n = "_mainContent_1cw3g_15", o = "_actionButton_1cw3g_28", c = "_secondaryContent_1cw3g_123", e = {
2
+ root: t,
3
+ mainContent: n,
4
+ actionButton: o,
5
+ secondaryContent: c
12
6
  };
13
7
  export {
14
- s as useTextTruncation
8
+ o as actionButton,
9
+ e as default,
10
+ n as mainContent,
11
+ t as root,
12
+ c as secondaryContent
15
13
  };
16
14
  //# sourceMappingURL=fondue-components77.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components77.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":";AAqBO,MAAMA,IAAoB,CAACC,MAAgC;AAC9D,EAAAC,EAAU,MAAM;AACZ,QAAI,CAACD,EAAI;AACL;AAGJ,UAAME,IAAUF,EAAI,SACdG,IAAW,IAAI,eAAe,MAAM;AACtC,YAAMC,IAAcF,EAAQ,cAAcA,EAAQ;AAClD,MAAAA,EAAQ,QAAQE,KAAcF,EAAQ,eAAe;AAAA,IACzD,CAAC;AAED,WAAAC,EAAS,QAAQD,CAAO,GACjB,MAAMC,EAAS,WAAA;AAAA,EAC1B,GAAG,CAACH,CAAG,CAAC;AACZ;"}
1
+ {"version":3,"file":"fondue-components77.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
@@ -1,24 +1,59 @@
1
- const t = "_table_16f5p_4", o = "_headerCell_16f5p_18", e = "_rowCell_16f5p_19", _ = "_caption_16f5p_46", n = "_cellContent_16f5p_71", l = "_sortIndicator_16f5p_87", c = "_body_16f5p_103", r = "_row_16f5p_19", s = "_buttonText_16f5p_167", a = {
2
- table: t,
3
- headerCell: o,
4
- rowCell: e,
5
- caption: _,
6
- cellContent: n,
7
- sortIndicator: l,
8
- body: c,
9
- row: r,
10
- buttonText: s
1
+ import { useRef as v, useState as w, useEffect as W, useLayoutEffect as p } from "react";
2
+ const T = (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
+ }), u = (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), l = (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`) : l ? (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([]), [l, i] = 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 && (u(t, f), n.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end" }));
19
+ }, [e, f]), p(() => {
20
+ var d;
21
+ const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
22
+ if (t instanceof HTMLDivElement && n instanceof HTMLButtonElement) {
23
+ u(t, f);
24
+ const a = new MutationObserver(() => {
25
+ n.scrollIntoView({ behavior: "instant", block: "nearest", inline: "end" }), u(t, f);
26
+ });
27
+ t.parentNode && a.observe(t.parentNode, { childList: !0 });
28
+ const r = new IntersectionObserver(
29
+ () => {
30
+ i(T(o, t)), u(t, f);
31
+ },
32
+ {
33
+ root: t,
34
+ threshold: 1
35
+ }
36
+ );
37
+ for (const h of o)
38
+ (d = h.ref) != null && d.current && r.observe(h.ref.current);
39
+ return () => {
40
+ r.disconnect(), a.disconnect();
41
+ };
42
+ }
43
+ }, [o, s, f]), {
44
+ triggerListRef: s,
45
+ activeIndicatorRef: f,
46
+ triggersOutOfView: l,
47
+ triggers: o,
48
+ addTrigger: (t) => {
49
+ t.previousElement || c((n) => [...n, t]), c((n) => {
50
+ const d = n.findIndex((a) => a.element === t.previousElement);
51
+ return n[d] = t, [...n];
52
+ });
53
+ }
54
+ };
11
55
  };
12
56
  export {
13
- c as body,
14
- s as buttonText,
15
- _ as caption,
16
- n as cellContent,
17
- a as default,
18
- o as headerCell,
19
- r as row,
20
- e as rowCell,
21
- l as sortIndicator,
22
- t as table
57
+ O as useTabTriggers
23
58
  };
24
59
  //# sourceMappingURL=fondue-components78.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components78.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components78.js","sources":["../src/components/Tabs/hooks/useTabTriggers.ts"],"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 const addTrigger = (trigger: TabTrigger) => {\n if (!trigger.previousElement) {\n setTriggers((prev) => [...prev, trigger]);\n }\n\n setTriggers((prev) => {\n const index = prev.findIndex((element) => element.element === trigger.previousElement);\n prev[index] = trigger;\n return [...prev];\n });\n };\n\n return {\n triggerListRef,\n activeIndicatorRef,\n triggersOutOfView,\n triggers,\n addTrigger,\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","index","element"],"mappings":"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"}
@@ -1,37 +1,18 @@
1
- function s(e, n) {
2
- const r = 'tr[tabindex="0"]', t = e.closest("table");
3
- if (!t)
4
- return null;
5
- const o = Array.from(t.querySelectorAll(r)), l = o.indexOf(e) + (n === "ArrowUp" ? -1 : 1);
6
- return l >= 0 && l < o.length ? o[l] : null;
7
- }
8
- function a(e) {
9
- const n = e.target, r = n.closest("tr");
10
- if (!r || n !== r || !["ArrowUp", "ArrowDown"].includes(e.key))
11
- return;
12
- const t = s(r, e.key);
13
- t && (e.preventDefault(), t.focus());
14
- }
15
- const u = [HTMLButtonElement, HTMLAnchorElement], i = ["button", "link"];
16
- function f(e) {
17
- if (!e)
18
- return !1;
19
- const { target: n, currentTarget: r } = e;
20
- let t = n instanceof Element ? n : null;
21
- if (!r.contains(t))
22
- return !0;
23
- for (; t && !(t instanceof HTMLTableRowElement); ) {
24
- if (u.some((c) => t instanceof c))
25
- return !0;
26
- const o = t.getAttribute("role");
27
- if (o && i.includes(o))
28
- return !0;
29
- t = t.parentElement;
30
- }
31
- return !1;
32
- }
1
+ const t = "_root_pmkrp_5", r = "_triggerListWrapper_pmkrp_13", e = "_trigger_pmkrp_13", i = "_activeIndicator_pmkrp_61", o = "_triggerList_pmkrp_13", p = "_content_pmkrp_149", g = {
2
+ root: t,
3
+ triggerListWrapper: r,
4
+ trigger: e,
5
+ activeIndicator: i,
6
+ triggerList: o,
7
+ content: p
8
+ };
33
9
  export {
34
- a as handleKeyDown,
35
- f as shouldIgnoreRowClick
10
+ i as activeIndicator,
11
+ p as content,
12
+ g as default,
13
+ t as root,
14
+ e as trigger,
15
+ o as triggerList,
16
+ r as triggerListWrapper
36
17
  };
37
18
  //# sourceMappingURL=fondue-components79.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components79.js","sources":["../src/components/Table/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type KeyboardEvent, type MouseEvent } 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\nconst INTERACTIVE_ELEMENTS_LIST = [HTMLButtonElement, HTMLAnchorElement];\nconst INTERACTIVE_ROLES_LIST = ['button', 'link'];\n\nexport function shouldIgnoreRowClick(event?: MouseEvent): boolean {\n if (!event) {\n return false;\n }\n\n const { target, currentTarget } = event;\n\n let element = target instanceof Element ? target : null;\n\n if (!currentTarget.contains(element)) {\n return true;\n }\n\n while (element && !(element instanceof HTMLTableRowElement)) {\n if (INTERACTIVE_ELEMENTS_LIST.some((interactiveElement) => element instanceof interactiveElement)) {\n return true;\n }\n\n const role = element.getAttribute('role');\n if (role && INTERACTIVE_ROLES_LIST.includes(role)) {\n return true;\n }\n\n element = element.parentElement;\n }\n\n return false;\n}\n"],"names":["getAdjacentRow","currentRow","key","selector","table","rows","nextIndex","handleKeyDown","event","target","nextRow","INTERACTIVE_ELEMENTS_LIST","INTERACTIVE_ROLES_LIST","shouldIgnoreRowClick","currentTarget","element","interactiveElement","role"],"mappings":"AAIA,SAASA,EAAeC,GAAyBC,GAAkD;AAC/F,QAAMC,IAAW,oBACXC,IAAQH,EAAW,QAAQ,OAAO;AACxC,MAAI,CAACG;AACD,WAAO;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,eAAA,GACNE,EAAQ,MAAA;AAEhB;AAEA,MAAMC,IAA4B,CAAC,mBAAmB,iBAAiB,GACjEC,IAAyB,CAAC,UAAU,MAAM;AAEzC,SAASC,EAAqBL,GAA6B;AAC9D,MAAI,CAACA;AACD,WAAO;AAGX,QAAM,EAAE,QAAAC,GAAQ,eAAAK,EAAA,IAAkBN;AAElC,MAAIO,IAAUN,aAAkB,UAAUA,IAAS;AAEnD,MAAI,CAACK,EAAc,SAASC,CAAO;AAC/B,WAAO;AAGX,SAAOA,KAAW,EAAEA,aAAmB,wBAAsB;AACzD,QAAIJ,EAA0B,KAAK,CAACK,MAAuBD,aAAmBC,CAAkB;AAC5F,aAAO;AAGX,UAAMC,IAAOF,EAAQ,aAAa,MAAM;AACxC,QAAIE,KAAQL,EAAuB,SAASK,CAAI;AAC5C,aAAO;AAGX,IAAAF,IAAUA,EAAQ;AAAA,EACtB;AAEA,SAAO;AACX;"}
1
+ {"version":3,"file":"fondue-components79.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,11 +1,11 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
2
  import { Slot as P } from "@radix-ui/react-slot";
3
3
  import { forwardRef as F, useState as y, useMemo as N, Children as I } from "react";
4
- import { ForwardedRefColorGradientInput as w } from "./fondue-components45.js";
5
- import { ForwardedRefColorPickerInput as h } from "./fondue-components46.js";
6
- import { ForwardedRefColorValueInput as G } from "./fondue-components47.js";
7
- import V from "./fondue-components48.js";
8
- import { DEFAULT_FORMAT as g, DEFAULT_COLOR as A, getColorWithName as s } from "./fondue-components49.js";
4
+ import { ForwardedRefColorGradientInput as w } from "./fondue-components43.js";
5
+ import { ForwardedRefColorPickerInput as h } from "./fondue-components44.js";
6
+ import { ForwardedRefColorValueInput as G } from "./fondue-components45.js";
7
+ import V from "./fondue-components46.js";
8
+ import { DEFAULT_FORMAT as g, DEFAULT_COLOR as A, getColorWithName as s } from "./fondue-components47.js";
9
9
  const p = ({
10
10
  children: t,
11
11
  currentColor: r = A,
@@ -1,14 +1,29 @@
1
- const t = "_root_1qig8_3", n = "_mainContent_1qig8_16", o = "_actionButton_1qig8_29", e = "_secondaryContent_1qig8_115", _ = {
2
- root: t,
3
- mainContent: n,
4
- actionButton: o,
5
- secondaryContent: e
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"
6
24
  };
7
25
  export {
8
- o as actionButton,
9
26
  _ as default,
10
- n as mainContent,
11
- t as root,
12
- e as secondaryContent
27
+ o as root
13
28
  };
14
29
  //# sourceMappingURL=fondue-components80.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components80.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
1
+ {"version":3,"file":"fondue-components80.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,59 +1,18 @@
1
- import { useRef as v, useState as w, useEffect as W, useLayoutEffect as p } from "react";
2
- const T = (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
- }), u = (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), l = (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`) : l ? (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([]), [l, i] = 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 && (u(t, f), n.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "end" }));
19
- }, [e, f]), p(() => {
20
- var d;
21
- const t = s.current, n = t == null ? void 0 : t.querySelector('[data-state="active"]');
22
- if (t instanceof HTMLDivElement && n instanceof HTMLButtonElement) {
23
- u(t, f);
24
- const a = new MutationObserver(() => {
25
- n.scrollIntoView({ behavior: "instant", block: "nearest", inline: "end" }), u(t, f);
26
- });
27
- t.parentNode && a.observe(t.parentNode, { childList: !0 });
28
- const r = new IntersectionObserver(
29
- () => {
30
- i(T(o, t)), u(t, f);
31
- },
32
- {
33
- root: t,
34
- threshold: 1
35
- }
36
- );
37
- for (const h of o)
38
- (d = h.ref) != null && d.current && r.observe(h.ref.current);
39
- return () => {
40
- r.disconnect(), a.disconnect();
41
- };
42
- }
43
- }, [o, s, f]), {
44
- triggerListRef: s,
45
- activeIndicatorRef: f,
46
- triggersOutOfView: l,
47
- triggers: o,
48
- addTrigger: (t) => {
49
- t.previousElement || c((n) => [...n, t]), c((n) => {
50
- const d = n.findIndex((a) => a.element === t.previousElement);
51
- return n[d] = t, [...n];
52
- });
53
- }
54
- };
1
+ const o = "_root_kjbh5_5", t = "_input_kjbh5_59", s = "_slot_kjbh5_82", c = "_iconSuccess_kjbh5_132", n = "_iconError_kjbh5_141", _ = "_loadingStatus_kjbh5_155", r = {
2
+ root: o,
3
+ input: t,
4
+ slot: s,
5
+ iconSuccess: c,
6
+ iconError: n,
7
+ loadingStatus: _
55
8
  };
56
9
  export {
57
- O as useTabTriggers
10
+ r as default,
11
+ n as iconError,
12
+ c as iconSuccess,
13
+ t as input,
14
+ _ as loadingStatus,
15
+ o as root,
16
+ s as slot
58
17
  };
59
18
  //# sourceMappingURL=fondue-components81.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components81.js","sources":["../src/components/Tabs/hooks/useTabTriggers.ts"],"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 const addTrigger = (trigger: TabTrigger) => {\n if (!trigger.previousElement) {\n setTriggers((prev) => [...prev, trigger]);\n }\n\n setTriggers((prev) => {\n const index = prev.findIndex((element) => element.element === trigger.previousElement);\n prev[index] = trigger;\n return [...prev];\n });\n };\n\n return {\n triggerListRef,\n activeIndicatorRef,\n triggersOutOfView,\n triggers,\n addTrigger,\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","index","element"],"mappings":"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"}
1
+ {"version":3,"file":"fondue-components81.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
@@ -1,18 +1,26 @@
1
- const t = "_root_1ra7u_5", r = "_triggerListWrapper_1ra7u_13", e = "_trigger_1ra7u_13", i = "_activeIndicator_1ra7u_61", o = "_triggerList_1ra7u_13", g = "_content_1ra7u_149", _ = {
2
- root: t,
3
- triggerListWrapper: r,
4
- trigger: e,
5
- activeIndicator: i,
6
- triggerList: o,
7
- content: g
1
+ const o = "_root_18lbr_5", t = "_textarea_18lbr_73", s = "_slot_18lbr_123", r = "_decorator_18lbr_137", _ = "_tools_18lbr_150", l = "_toolsButton_18lbr_162", c = "_success_18lbr_194", n = "_error_18lbr_198", e = "_loadingStatus_18lbr_202", a = "_spin_18lbr_1", b = {
2
+ root: o,
3
+ textarea: t,
4
+ slot: s,
5
+ decorator: r,
6
+ tools: _,
7
+ toolsButton: l,
8
+ success: c,
9
+ error: n,
10
+ loadingStatus: e,
11
+ spin: a
8
12
  };
9
13
  export {
10
- i as activeIndicator,
11
- g as content,
12
- _ as default,
13
- t as root,
14
- e as trigger,
15
- o as triggerList,
16
- r as triggerListWrapper
14
+ r as decorator,
15
+ b as default,
16
+ n as error,
17
+ e as loadingStatus,
18
+ o as root,
19
+ s as slot,
20
+ a as spin,
21
+ c as success,
22
+ t as textarea,
23
+ _ as tools,
24
+ l as toolsButton
17
25
  };
18
26
  //# sourceMappingURL=fondue-components82.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components82.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"fondue-components82.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -1,28 +1,10 @@
1
- const o = "_root_1m55x_2", _ = {
2
- root: o,
3
- "weight-default": "_weight-default_1m55x_7",
4
- "weight-strong": "_weight-strong_1m55x_11",
5
- "weight-x-strong": "_weight-x-strong_1m55x_15",
6
- "size-x-small": "_size-x-small_1m55x_19",
7
- "size-small": "_size-small_1m55x_24",
8
- "size-medium": "_size-medium_1m55x_29",
9
- "size-large": "_size-large_1m55x_34",
10
- "color-default": "_color-default_1m55x_39",
11
- "color-weak": "_color-weak_1m55x_43",
12
- "color-disabled": "_color-disabled_1m55x_47",
13
- "color-negative": "_color-negative_1m55x_51",
14
- "color-positive": "_color-positive_1m55x_55",
15
- "color-warning": "_color-warning_1m55x_59",
16
- "color-interactive": "_color-interactive_1m55x_63",
17
- "color-box-neutral": "_color-box-neutral_1m55x_67",
18
- "color-box-selected": "_color-box-selected_1m55x_71",
19
- "color-box-disabled": "_color-box-disabled_1m55x_75",
20
- "color-box-positive": "_color-box-positive_1m55x_79",
21
- "color-box-negative": "_color-box-negative_1m55x_83",
22
- "color-box-warning": "_color-box-warning_1m55x_87"
1
+ const t = "_dark_1mr83_1", r = "_light_1mr83_250", s = {
2
+ dark: t,
3
+ light: r
23
4
  };
24
5
  export {
25
- _ as default,
26
- o as root
6
+ t as dark,
7
+ s as default,
8
+ r as light
27
9
  };
28
10
  //# sourceMappingURL=fondue-components83.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components83.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components83.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,18 +1,10 @@
1
- const o = "_root_syf9j_5", s = "_input_syf9j_59", t = "_slot_syf9j_82", c = "_iconSuccess_syf9j_132", n = "_iconError_syf9j_141", _ = "_loadingStatus_syf9j_155", r = {
1
+ const o = "_root_13m98_4", r = "_arrow_13m98_25", t = {
2
2
  root: o,
3
- input: s,
4
- slot: t,
5
- iconSuccess: c,
6
- iconError: n,
7
- loadingStatus: _
3
+ arrow: r
8
4
  };
9
5
  export {
10
- r as default,
11
- n as iconError,
12
- c as iconSuccess,
13
- s as input,
14
- _ as loadingStatus,
15
- o as root,
16
- t as slot
6
+ r as arrow,
7
+ t as default,
8
+ o as root
17
9
  };
18
10
  //# sourceMappingURL=fondue-components84.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components84.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
1
+ {"version":3,"file":"fondue-components84.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -1,26 +1,8 @@
1
- const o = "_root_1prse_5", s = "_textarea_1prse_73", t = "_slot_1prse_123", r = "_decorator_1prse_137", _ = "_tools_1prse_150", e = "_toolsButton_1prse_162", c = "_success_1prse_194", n = "_error_1prse_198", a = "_loadingStatus_1prse_202", l = "_spin_1prse_1", p = {
2
- root: o,
3
- textarea: s,
4
- slot: t,
5
- decorator: r,
6
- tools: _,
7
- toolsButton: e,
8
- success: c,
9
- error: n,
10
- loadingStatus: a,
11
- spin: l
1
+ const o = "_root_e5fqt_2", t = {
2
+ root: o
12
3
  };
13
4
  export {
14
- r as decorator,
15
- p as default,
16
- n as error,
17
- a as loadingStatus,
18
- o as root,
19
- t as slot,
20
- l as spin,
21
- c as success,
22
- s as textarea,
23
- _ as tools,
24
- e as toolsButton
5
+ t as default,
6
+ o as root
25
7
  };
26
8
  //# sourceMappingURL=fondue-components85.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components85.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components85.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,12 +1,8 @@
1
- const a = "_base_9n8a0_1", s = "_dark_9n8a0_249", t = "_light_9n8a0_330", _ = {
2
- base: a,
3
- dark: s,
4
- light: t
1
+ const r = (e) => {
2
+ if (e)
3
+ return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
5
4
  };
6
5
  export {
7
- a as base,
8
- s as dark,
9
- _ as default,
10
- t as light
6
+ r as colorToCss
11
7
  };
12
8
  //# sourceMappingURL=fondue-components86.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components86.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
1
+ {"version":3,"file":"fondue-components86.js","sources":["../src/components/Badge/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type RgbaColor } from './types';\n\nexport const DEFAULT_COLOR = { red: 255, green: 255, blue: 255, alpha: 1, name: '' };\n\n/**\n * Converts a color object to a CSS color string.\n * @param {RgbaColor} color - The color object to be converted.\n * @returns {string}\n * @example\n * colorToCss({ red: 255, green: 255, blue: 255, alpha: 1 }); // 'rgba(255, 255, 255, 1)'\n * @example\n * colorToCss({ red: 255, green: 87, blue: 51, alpha: 1 }); // 'rgba(255, 87, 51, 1)'\n * @example\n * colorToCss({ red: 0, green: 0, blue: 0, alpha: 0 }); // 'rgba(0, 0, 0, 0)'\n */\nexport const colorToCss = (color?: RgbaColor) => {\n if (!color) {\n return undefined;\n }\n return `rgba(${color.red}, ${color.green}, ${color.blue}, ${color.alpha ?? 1})`;\n};\n"],"names":["colorToCss","color"],"mappings":"AAiBO,MAAMA,IAAa,CAACC,MAAsB;AAC7C,MAAKA;AAGL,WAAO,QAAQA,EAAM,GAAG,KAAKA,EAAM,KAAK,KAAKA,EAAM,IAAI,KAAKA,EAAM,SAAS,CAAC;AAChF;"}
@@ -1,10 +1,5 @@
1
- const o = "_root_15faa_4", r = "_arrow_15faa_25", a = {
2
- root: o,
3
- arrow: r
4
- };
1
+ const t = "focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue";
5
2
  export {
6
- r as arrow,
7
- a as default,
8
- o as root
3
+ t as FOCUS_OUTLINE
9
4
  };
10
5
  //# sourceMappingURL=fondue-components87.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components87.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"fondue-components87.js","sources":["../src/utilities/focusStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const FOCUS_OUTLINE =\n 'focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue'; // second declaration of tw-outline-blue is to assure that in firefox the outline isn't overriden by a global definition of :-moz-focusring which is coming from tailwinds normalization styling\n"],"names":["FOCUS_OUTLINE"],"mappings":"AAEO,MAAMA,IACT;"}