@frontify/fondue-components 19.5.0 → 19.6.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 (157) hide show
  1. package/dist/fondue-components.js +20 -18
  2. package/dist/fondue-components.js.map +1 -1
  3. package/dist/fondue-components10.js +3 -3
  4. package/dist/fondue-components11.js +3 -3
  5. package/dist/fondue-components12.js +2 -2
  6. package/dist/fondue-components13.js +3 -3
  7. package/dist/fondue-components14.js +2 -2
  8. package/dist/fondue-components15.js +2 -2
  9. package/dist/fondue-components16.js +19 -29
  10. package/dist/fondue-components16.js.map +1 -1
  11. package/dist/fondue-components17.js +1 -1
  12. package/dist/fondue-components18.js +1 -1
  13. package/dist/fondue-components19.js +1 -1
  14. package/dist/fondue-components20.js +2 -2
  15. package/dist/fondue-components21.js +2 -2
  16. package/dist/fondue-components22.js +6 -6
  17. package/dist/fondue-components23.js +1 -1
  18. package/dist/fondue-components24.js +2 -2
  19. package/dist/fondue-components25.js +4 -4
  20. package/dist/fondue-components26.js +135 -127
  21. package/dist/fondue-components26.js.map +1 -1
  22. package/dist/fondue-components27.js +127 -31
  23. package/dist/fondue-components27.js.map +1 -1
  24. package/dist/fondue-components28.js +33 -59
  25. package/dist/fondue-components28.js.map +1 -1
  26. package/dist/fondue-components29.js +58 -101
  27. package/dist/fondue-components29.js.map +1 -1
  28. package/dist/fondue-components3.js +1 -1
  29. package/dist/fondue-components30.js +101 -12
  30. package/dist/fondue-components30.js.map +1 -1
  31. package/dist/fondue-components31.js +12 -55
  32. package/dist/fondue-components31.js.map +1 -1
  33. package/dist/fondue-components32.js +55 -20
  34. package/dist/fondue-components32.js.map +1 -1
  35. package/dist/fondue-components33.js +20 -7
  36. package/dist/fondue-components33.js.map +1 -1
  37. package/dist/fondue-components34.js +7 -6
  38. package/dist/fondue-components34.js.map +1 -1
  39. package/dist/fondue-components35.js +7 -32
  40. package/dist/fondue-components35.js.map +1 -1
  41. package/dist/fondue-components36.js +32 -5
  42. package/dist/fondue-components36.js.map +1 -1
  43. package/dist/fondue-components37.js +5 -12
  44. package/dist/fondue-components37.js.map +1 -1
  45. package/dist/fondue-components38.js +10 -153
  46. package/dist/fondue-components38.js.map +1 -1
  47. package/dist/fondue-components39.js +59 -22
  48. package/dist/fondue-components39.js.map +1 -1
  49. package/dist/fondue-components4.js +29 -38
  50. package/dist/fondue-components4.js.map +1 -1
  51. package/dist/fondue-components40.js +17 -17
  52. package/dist/fondue-components40.js.map +1 -1
  53. package/dist/fondue-components41.js +112 -15
  54. package/dist/fondue-components41.js.map +1 -1
  55. package/dist/fondue-components42.js +19 -30
  56. package/dist/fondue-components42.js.map +1 -1
  57. package/dist/fondue-components43.js +32 -62
  58. package/dist/fondue-components43.js.map +1 -1
  59. package/dist/fondue-components44.js +53 -121
  60. package/dist/fondue-components44.js.map +1 -1
  61. package/dist/fondue-components45.js +129 -20
  62. package/dist/fondue-components45.js.map +1 -1
  63. package/dist/fondue-components46.js +21 -45
  64. package/dist/fondue-components46.js.map +1 -1
  65. package/dist/fondue-components47.js +53 -8
  66. package/dist/fondue-components47.js.map +1 -1
  67. package/dist/fondue-components48.js +8 -13
  68. package/dist/fondue-components48.js.map +1 -1
  69. package/dist/fondue-components49.js +13 -15
  70. package/dist/fondue-components49.js.map +1 -1
  71. package/dist/fondue-components5.js +2 -2
  72. package/dist/fondue-components50.js +14 -4
  73. package/dist/fondue-components50.js.map +1 -1
  74. package/dist/fondue-components51.js +5 -60
  75. package/dist/fondue-components51.js.map +1 -1
  76. package/dist/fondue-components52.js +59 -17
  77. package/dist/fondue-components52.js.map +1 -1
  78. package/dist/fondue-components53.js +18 -19
  79. package/dist/fondue-components53.js.map +1 -1
  80. package/dist/fondue-components54.js +18 -4
  81. package/dist/fondue-components54.js.map +1 -1
  82. package/dist/fondue-components55.js +3 -13
  83. package/dist/fondue-components55.js.map +1 -1
  84. package/dist/fondue-components56.js +13 -3
  85. package/dist/fondue-components56.js.map +1 -1
  86. package/dist/fondue-components57.js +3 -17
  87. package/dist/fondue-components57.js.map +1 -1
  88. package/dist/fondue-components58.js +19 -35
  89. package/dist/fondue-components58.js.map +1 -1
  90. package/dist/fondue-components59.js +8 -4
  91. package/dist/fondue-components59.js.map +1 -1
  92. package/dist/fondue-components6.js +4 -4
  93. package/dist/fondue-components60.js +35 -13
  94. package/dist/fondue-components60.js.map +1 -1
  95. package/dist/fondue-components61.js +1 -1
  96. package/dist/fondue-components62.js +12 -24
  97. package/dist/fondue-components62.js.map +1 -1
  98. package/dist/fondue-components63.js +4 -16
  99. package/dist/fondue-components63.js.map +1 -1
  100. package/dist/fondue-components64.js +23 -149
  101. package/dist/fondue-components64.js.map +1 -1
  102. package/dist/fondue-components65.js +17 -19
  103. package/dist/fondue-components65.js.map +1 -1
  104. package/dist/fondue-components66.js +148 -75
  105. package/dist/fondue-components66.js.map +1 -1
  106. package/dist/fondue-components67.js +19 -8
  107. package/dist/fondue-components67.js.map +1 -1
  108. package/dist/fondue-components68.js +77 -34
  109. package/dist/fondue-components68.js.map +1 -1
  110. package/dist/fondue-components69.js +8 -71
  111. package/dist/fondue-components69.js.map +1 -1
  112. package/dist/fondue-components7.js +2 -2
  113. package/dist/fondue-components70.js +34 -10
  114. package/dist/fondue-components70.js.map +1 -1
  115. package/dist/fondue-components71.js +70 -12
  116. package/dist/fondue-components71.js.map +1 -1
  117. package/dist/fondue-components72.js +10 -12
  118. package/dist/fondue-components72.js.map +1 -1
  119. package/dist/fondue-components73.js +12 -20
  120. package/dist/fondue-components73.js.map +1 -1
  121. package/dist/fondue-components74.js +13 -34
  122. package/dist/fondue-components74.js.map +1 -1
  123. package/dist/fondue-components75.js +20 -55
  124. package/dist/fondue-components75.js.map +1 -1
  125. package/dist/fondue-components76.js +34 -15
  126. package/dist/fondue-components76.js.map +1 -1
  127. package/dist/fondue-components77.js +9 -24
  128. package/dist/fondue-components77.js.map +1 -1
  129. package/dist/fondue-components78.js +55 -14
  130. package/dist/fondue-components78.js.map +1 -1
  131. package/dist/fondue-components79.js +14 -22
  132. package/dist/fondue-components79.js.map +1 -1
  133. package/dist/fondue-components8.js +5 -5
  134. package/dist/fondue-components80.js +25 -6
  135. package/dist/fondue-components80.js.map +1 -1
  136. package/dist/fondue-components81.js +13 -5
  137. package/dist/fondue-components81.js.map +1 -1
  138. package/dist/fondue-components82.js +23 -2
  139. package/dist/fondue-components82.js.map +1 -1
  140. package/dist/fondue-components83.js +5 -15
  141. package/dist/fondue-components83.js.map +1 -1
  142. package/dist/fondue-components84.js +4 -2
  143. package/dist/fondue-components84.js.map +1 -1
  144. package/dist/fondue-components85.js +4 -4
  145. package/dist/fondue-components85.js.map +1 -1
  146. package/dist/fondue-components86.js +4 -39
  147. package/dist/fondue-components86.js.map +1 -1
  148. package/dist/fondue-components87.js +5 -0
  149. package/dist/fondue-components87.js.map +1 -0
  150. package/dist/fondue-components88.js +20 -0
  151. package/dist/fondue-components88.js.map +1 -0
  152. package/dist/fondue-components89.js +43 -0
  153. package/dist/fondue-components89.js.map +1 -0
  154. package/dist/fondue-components9.js +4 -4
  155. package/dist/index.d.ts +74 -8
  156. package/dist/style.css +1 -1
  157. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components85.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
+ {"version":3,"file":"fondue-components85.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,43 +1,8 @@
1
- import { Children as a, isValidElement as u, cloneElement as f } from "react";
2
- import { ForwardedRefSelectItem as E } from "./fondue-components65.js";
3
- const g = ({
4
- children: o,
5
- value: r,
6
- label: s
7
- }) => o && typeof o == "string" ? {
8
- value: r || o,
9
- label: s || o
10
- } : {
11
- value: r || "",
12
- label: s || r || "",
13
- ...o ? { children: o } : null
14
- }, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
15
- const n = [];
16
- let t = 0;
17
- return a.forEach(o, (e) => {
18
- if (w(e, E) && u(e))
19
- g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
20
- else if (u(e) && (e != null && e.props.children)) {
21
- const { parsedChildren: m, subElementCount: C } = y(
22
- e.props.children,
23
- r,
24
- "",
25
- p + t
26
- );
27
- e = f(e, {
28
- children: m,
29
- key: `group-${p + t}`
30
- }), n.push(e), t += C;
31
- } else
32
- n.push(e);
33
- }), {
34
- parsedChildren: n,
35
- subElementCount: t
36
- };
1
+ const r = (e) => {
2
+ if (e)
3
+ return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
37
4
  };
38
5
  export {
39
- g as getSelectOptionValue,
40
- w as isReactLeaf,
41
- y as recursiveMap
6
+ r as colorToCss
42
7
  };
43
8
  //# sourceMappingURL=fondue-components86.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components86.js","sources":["../src/components/Select/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n type JSXElementConstructor,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\n\n/**\n * Extracts and returns an object containing `value` and `label` from a given SelectItemProps object.\n * It prioritizes explicit `value` and `label` properties but will fall back to using `children` as the value or label if necessary.\n *\n * @param {SelectItemProps} props - The properties of a select item, which include potential children, value, and label.\n * @returns {{ value: string; label: string, children?: ReactNode }} An object containing `value` and `label` as strings.\n *\n * @example\n * // Returns { value: 'option1', label: 'Option 1' }\n * getSelectOptionValue({ value: 'option1', label: 'Option 1' });\n *\n * @example\n * // Uses children as the value and label when they are not explicitly provided\n * // Returns { value: 'Default', label: 'Default' }\n * getSelectOptionValue({ children: 'Default' });\n */\nexport const getSelectOptionValue = ({\n children,\n value,\n label,\n}: SelectItemProps): {\n value: string;\n label: string;\n children?: ReactNode;\n} => {\n if (children && typeof children === 'string') {\n return {\n value: value ? value : children,\n label: label ? label : children,\n };\n }\n\n return {\n value: value || '',\n label: label ? label : value || '',\n ...(children ? { children } : null),\n };\n};\n/**\n * Determines if the child is a leaf node of React, meaning it has one final child of a native type;\n *\n * @param {ReactNode} child - The React child node to check.\n * @param {JSXElementConstructor<never>} Component - The React component constructor used for comparison.\n * @returns {boolean} Returns true if the `child` is a valid React element of the specified `Component` type.\n *\n * @example\n * // Assuming ForwardedRefSelectItem is a component that renders an <input> element\n * // Returns true\n * isReactLeaf(<ForwardedRefSelectItem />, ForwardedRefSelectItem);\n *\n * @example\n * // Returns false for non-matching types or non-leaf components\n * isReactLeaf(<div><ForwardedRefSelectItem /></div>, ForwardedRefSelectItem);\n */\nexport const isReactLeaf = (child: ReactNode, Component: JSXElementConstructor<never>): child is ReactElement =>\n isValidElement(child) && child.type === Component;\n\n/**\n * Recursively maps through React children, applying a callback to each child that meets the specified conditions.\n * This function is useful for deeply nested structures where modifications or checks are needed at multiple levels.\n *\n * @param {ReactNode} children - The children to be recursively processed.\n * @param {function(ReactNode, number): ReactNode} callback - A function that is called for each child that meets the condition. It receives the child and its index, and returns a React node.\n * @param {string} [filterText=''] - Optional text used to filter children based on their properties.\n * @param {number} [nextIndex=0] - The starting index for numbering children, defaults to 0.\n * @returns {{ parsedChildren: ReactNode[], subElementCount: number }} An object containing the transformed children array and the count of all processed sub-elements.\n *\n * @example\n * // Example usage in a select component where only items containing a certain text are modified\n * recursiveMap(children, (child, index) => React.cloneElement(child, { extraProp: 'value' }), 'specific text');\n *\n * @example\n * // Nested structure transformation, adding class names based on index\n * recursiveMap(children, (child, index) => React.cloneElement(child, { className: `item-${index}` }));\n */\nexport const recursiveMap = (\n children: ReactNode,\n callback: (child: ReactNode, nextIndex: number) => ReactNode,\n filterText?: string,\n nextIndex: number = 0,\n): {\n parsedChildren: ReactNode[];\n subElementCount: number;\n} => {\n const resultingChildren: ReactNode[] = [];\n let itemCounter = 0;\n Children.forEach(children, (child) => {\n if (isReactLeaf(child, ForwardedRefSelectItem) && isValidElement<SelectItemProps>(child)) {\n if (\n getSelectOptionValue(child.props)\n .label.toLowerCase()\n .includes(filterText?.toLowerCase() || '')\n ) {\n resultingChildren.push(callback(child, nextIndex + itemCounter));\n itemCounter++;\n }\n } else if (isValidElement<{ children: ReactNode }>(child) && child?.props.children) {\n const { parsedChildren, subElementCount } = recursiveMap(\n child.props.children,\n callback,\n '',\n nextIndex + itemCounter,\n );\n child = cloneElement(child, {\n children: parsedChildren,\n key: `group-${nextIndex + itemCounter}`,\n });\n resultingChildren.push(child);\n itemCounter += subElementCount;\n } else {\n resultingChildren.push(child);\n }\n });\n return {\n parsedChildren: resultingChildren,\n subElementCount: itemCounter,\n };\n};\n"],"names":["getSelectOptionValue","children","value","label","isReactLeaf","child","Component","isValidElement","recursiveMap","callback","filterText","nextIndex","resultingChildren","itemCounter","Children","ForwardedRefSelectItem","parsedChildren","subElementCount","cloneElement"],"mappings":";;AA6BO,MAAMA,IAAuB,CAAC;AAAA,EACjC,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AACJ,MAKQF,KAAY,OAAOA,KAAa,WACzB;AAAA,EACH,OAAOC,KAAgBD;AAAA,EACvB,OAAOE,KAAgBF;AAAA,IAIxB;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,KAAgBD,KAAS;AAAA,EAChC,GAAID,IAAW,EAAE,UAAAA,MAAa;AAAA,GAmBzBG,IAAc,CAACC,GAAkBC,MAC1CC,EAAeF,CAAK,KAAKA,EAAM,SAASC,GAoB/BE,IAAe,CACxBP,GACAQ,GACAC,GACAC,IAAoB,MAInB;AACD,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAAc;AAClB,SAAAC,EAAS,QAAQb,GAAU,CAACI,MAAU;AAClC,QAAID,EAAYC,GAAOU,CAAsB,KAAKR,EAAgCF,CAAK;AACnF,MACIL,EAAqBK,EAAM,KAAK,EAC3B,MAAM,cACN,UAASK,KAAA,gBAAAA,EAAY,kBAAiB,EAAE,MAE7CE,EAAkB,KAAKH,EAASJ,GAAOM,IAAYE,CAAW,CAAC,GAC/DA;AAAA,aAEGN,EAAwCF,CAAK,MAAKA,KAAA,QAAAA,EAAO,MAAM,WAAU;AAChF,YAAM,EAAE,gBAAAW,GAAgB,iBAAAC,EAAA,IAAoBT;AAAA,QACxCH,EAAM,MAAM;AAAA,QACZI;AAAA,QACA;AAAA,QACAE,IAAYE;AAAA,MAAA;AAEhB,MAAAR,IAAQa,EAAab,GAAO;AAAA,QACxB,UAAUW;AAAA,QACV,KAAK,SAASL,IAAYE,CAAW;AAAA,MAAA,CACxC,GACDD,EAAkB,KAAKP,CAAK,GAC5BQ,KAAeI;AAAA,IACnB;AACI,MAAAL,EAAkB,KAAKP,CAAK;AAAA,EAEpC,CAAC,GACM;AAAA,IACH,gBAAgBO;AAAA,IAChB,iBAAiBC;AAAA,EAAA;AAEzB;"}
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;"}
@@ -0,0 +1,5 @@
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";
2
+ export {
3
+ t as FOCUS_OUTLINE
4
+ };
5
+ //# sourceMappingURL=fondue-components87.js.map
@@ -0,0 +1 @@
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;"}
@@ -0,0 +1,20 @@
1
+ const o = "_root_1761r_5", t = "_colorName_1761r_55", c = "_button_1761r_63", r = "_colorIndicator_1761r_76", _ = "_actions_1761r_95", a = "_clear_1761r_105", n = "_caret_1761r_118", s = {
2
+ root: o,
3
+ colorName: t,
4
+ button: c,
5
+ colorIndicator: r,
6
+ actions: _,
7
+ clear: a,
8
+ caret: n
9
+ };
10
+ export {
11
+ _ as actions,
12
+ c as button,
13
+ n as caret,
14
+ a as clear,
15
+ r as colorIndicator,
16
+ t as colorName,
17
+ s as default,
18
+ o as root
19
+ };
20
+ //# sourceMappingURL=fondue-components88.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fondue-components88.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
@@ -0,0 +1,43 @@
1
+ import { Children as a, isValidElement as u, cloneElement as f } from "react";
2
+ import { ForwardedRefSelectItem as E } from "./fondue-components67.js";
3
+ const g = ({
4
+ children: o,
5
+ value: r,
6
+ label: s
7
+ }) => o && typeof o == "string" ? {
8
+ value: r || o,
9
+ label: s || o
10
+ } : {
11
+ value: r || "",
12
+ label: s || r || "",
13
+ ...o ? { children: o } : null
14
+ }, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
15
+ const n = [];
16
+ let t = 0;
17
+ return a.forEach(o, (e) => {
18
+ if (w(e, E) && u(e))
19
+ g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
20
+ else if (u(e) && (e != null && e.props.children)) {
21
+ const { parsedChildren: m, subElementCount: C } = y(
22
+ e.props.children,
23
+ r,
24
+ "",
25
+ p + t
26
+ );
27
+ e = f(e, {
28
+ children: m,
29
+ key: `group-${p + t}`
30
+ }), n.push(e), t += C;
31
+ } else
32
+ n.push(e);
33
+ }), {
34
+ parsedChildren: n,
35
+ subElementCount: t
36
+ };
37
+ };
38
+ export {
39
+ g as getSelectOptionValue,
40
+ w as isReactLeaf,
41
+ y as recursiveMap
42
+ };
43
+ //# sourceMappingURL=fondue-components89.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fondue-components89.js","sources":["../src/components/Select/utils.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n type JSXElementConstructor,\n type ReactElement,\n type ReactNode,\n} from 'react';\n\nimport { ForwardedRefSelectItem, type SelectItemProps } from './SelectItem';\n\n/**\n * Extracts and returns an object containing `value` and `label` from a given SelectItemProps object.\n * It prioritizes explicit `value` and `label` properties but will fall back to using `children` as the value or label if necessary.\n *\n * @param {SelectItemProps} props - The properties of a select item, which include potential children, value, and label.\n * @returns {{ value: string; label: string, children?: ReactNode }} An object containing `value` and `label` as strings.\n *\n * @example\n * // Returns { value: 'option1', label: 'Option 1' }\n * getSelectOptionValue({ value: 'option1', label: 'Option 1' });\n *\n * @example\n * // Uses children as the value and label when they are not explicitly provided\n * // Returns { value: 'Default', label: 'Default' }\n * getSelectOptionValue({ children: 'Default' });\n */\nexport const getSelectOptionValue = ({\n children,\n value,\n label,\n}: SelectItemProps): {\n value: string;\n label: string;\n children?: ReactNode;\n} => {\n if (children && typeof children === 'string') {\n return {\n value: value ? value : children,\n label: label ? label : children,\n };\n }\n\n return {\n value: value || '',\n label: label ? label : value || '',\n ...(children ? { children } : null),\n };\n};\n/**\n * Determines if the child is a leaf node of React, meaning it has one final child of a native type;\n *\n * @param {ReactNode} child - The React child node to check.\n * @param {JSXElementConstructor<never>} Component - The React component constructor used for comparison.\n * @returns {boolean} Returns true if the `child` is a valid React element of the specified `Component` type.\n *\n * @example\n * // Assuming ForwardedRefSelectItem is a component that renders an <input> element\n * // Returns true\n * isReactLeaf(<ForwardedRefSelectItem />, ForwardedRefSelectItem);\n *\n * @example\n * // Returns false for non-matching types or non-leaf components\n * isReactLeaf(<div><ForwardedRefSelectItem /></div>, ForwardedRefSelectItem);\n */\nexport const isReactLeaf = (child: ReactNode, Component: JSXElementConstructor<never>): child is ReactElement =>\n isValidElement(child) && child.type === Component;\n\n/**\n * Recursively maps through React children, applying a callback to each child that meets the specified conditions.\n * This function is useful for deeply nested structures where modifications or checks are needed at multiple levels.\n *\n * @param {ReactNode} children - The children to be recursively processed.\n * @param {function(ReactNode, number): ReactNode} callback - A function that is called for each child that meets the condition. It receives the child and its index, and returns a React node.\n * @param {string} [filterText=''] - Optional text used to filter children based on their properties.\n * @param {number} [nextIndex=0] - The starting index for numbering children, defaults to 0.\n * @returns {{ parsedChildren: ReactNode[], subElementCount: number }} An object containing the transformed children array and the count of all processed sub-elements.\n *\n * @example\n * // Example usage in a select component where only items containing a certain text are modified\n * recursiveMap(children, (child, index) => React.cloneElement(child, { extraProp: 'value' }), 'specific text');\n *\n * @example\n * // Nested structure transformation, adding class names based on index\n * recursiveMap(children, (child, index) => React.cloneElement(child, { className: `item-${index}` }));\n */\nexport const recursiveMap = (\n children: ReactNode,\n callback: (child: ReactNode, nextIndex: number) => ReactNode,\n filterText?: string,\n nextIndex: number = 0,\n): {\n parsedChildren: ReactNode[];\n subElementCount: number;\n} => {\n const resultingChildren: ReactNode[] = [];\n let itemCounter = 0;\n Children.forEach(children, (child) => {\n if (isReactLeaf(child, ForwardedRefSelectItem) && isValidElement<SelectItemProps>(child)) {\n if (\n getSelectOptionValue(child.props)\n .label.toLowerCase()\n .includes(filterText?.toLowerCase() || '')\n ) {\n resultingChildren.push(callback(child, nextIndex + itemCounter));\n itemCounter++;\n }\n } else if (isValidElement<{ children: ReactNode }>(child) && child?.props.children) {\n const { parsedChildren, subElementCount } = recursiveMap(\n child.props.children,\n callback,\n '',\n nextIndex + itemCounter,\n );\n child = cloneElement(child, {\n children: parsedChildren,\n key: `group-${nextIndex + itemCounter}`,\n });\n resultingChildren.push(child);\n itemCounter += subElementCount;\n } else {\n resultingChildren.push(child);\n }\n });\n return {\n parsedChildren: resultingChildren,\n subElementCount: itemCounter,\n };\n};\n"],"names":["getSelectOptionValue","children","value","label","isReactLeaf","child","Component","isValidElement","recursiveMap","callback","filterText","nextIndex","resultingChildren","itemCounter","Children","ForwardedRefSelectItem","parsedChildren","subElementCount","cloneElement"],"mappings":";;AA6BO,MAAMA,IAAuB,CAAC;AAAA,EACjC,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AACJ,MAKQF,KAAY,OAAOA,KAAa,WACzB;AAAA,EACH,OAAOC,KAAgBD;AAAA,EACvB,OAAOE,KAAgBF;AAAA,IAIxB;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,KAAgBD,KAAS;AAAA,EAChC,GAAID,IAAW,EAAE,UAAAA,MAAa;AAAA,GAmBzBG,IAAc,CAACC,GAAkBC,MAC1CC,EAAeF,CAAK,KAAKA,EAAM,SAASC,GAoB/BE,IAAe,CACxBP,GACAQ,GACAC,GACAC,IAAoB,MAInB;AACD,QAAMC,IAAiC,CAAA;AACvC,MAAIC,IAAc;AAClB,SAAAC,EAAS,QAAQb,GAAU,CAACI,MAAU;AAClC,QAAID,EAAYC,GAAOU,CAAsB,KAAKR,EAAgCF,CAAK;AACnF,MACIL,EAAqBK,EAAM,KAAK,EAC3B,MAAM,cACN,UAASK,KAAA,gBAAAA,EAAY,kBAAiB,EAAE,MAE7CE,EAAkB,KAAKH,EAASJ,GAAOM,IAAYE,CAAW,CAAC,GAC/DA;AAAA,aAEGN,EAAwCF,CAAK,MAAKA,KAAA,QAAAA,EAAO,MAAM,WAAU;AAChF,YAAM,EAAE,gBAAAW,GAAgB,iBAAAC,EAAA,IAAoBT;AAAA,QACxCH,EAAM,MAAM;AAAA,QACZI;AAAA,QACA;AAAA,QACAE,IAAYE;AAAA,MAAA;AAEhB,MAAAR,IAAQa,EAAab,GAAO;AAAA,QACxB,UAAUW;AAAA,QACV,KAAK,SAASL,IAAYE,CAAW;AAAA,MAAA,CACxC,GACDD,EAAkB,KAAKP,CAAK,GAC5BQ,KAAeI;AAAA,IACnB;AACI,MAAAL,EAAkB,KAAKP,CAAK;AAAA,EAEpC,CAAC,GACM;AAAA,IACH,gBAAgBO;AAAA,IAChB,iBAAiBC;AAAA,EAAA;AAEzB;"}
@@ -2,10 +2,10 @@ import { jsx as o, jsxs as P } from "react/jsx-runtime";
2
2
  import { IconCross as j } from "@frontify/fondue-icons";
3
3
  import * as d from "@radix-ui/react-dialog";
4
4
  import { createContext as q, forwardRef as l, useRef as B, useContext as z, useMemo as E } from "react";
5
- import { useSyncRefs as L } from "./fondue-components47.js";
6
- import { addShowFocusRing as $, addAutoFocusAttribute as k } from "./fondue-components48.js";
7
- import { useFondueTheme as G, ThemeProvider as I } from "./fondue-components30.js";
8
- import r from "./fondue-components49.js";
5
+ import { useSyncRefs as L } from "./fondue-components48.js";
6
+ import { addShowFocusRing as $, addAutoFocusAttribute as k } from "./fondue-components49.js";
7
+ import { useFondueTheme as G, ThemeProvider as I } from "./fondue-components31.js";
8
+ import r from "./fondue-components50.js";
9
9
  const m = q({ isModal: !1 });
10
10
  m.displayName = "DialogContext";
11
11
  const y = ({ children: t, ...e }) => {
package/dist/index.d.ts CHANGED
@@ -160,7 +160,7 @@ declare type AtLeastOneAttr<T> = Partial<T> & {
160
160
 
161
161
  declare type AvailableTheme = keyof typeof default_2;
162
162
 
163
- export declare const Badge: ({ "aria-label": ariaLabel, "data-test-id": dataTestId, children, disabled, dismissable, emphasis, onClick, onDismiss, size, status, title, variant, }: BadgeProps) => JSX_2.Element;
163
+ export declare const Badge: ({ "aria-label": ariaLabel, "data-test-id": dataTestId, children, disabled, emphasis, onClick, onDismiss, size, status, title, variant, }: BadgeProps) => JSX_2.Element;
164
164
 
165
165
  declare type BadgeEmphasis = 'strong' | 'weak';
166
166
 
@@ -186,11 +186,7 @@ declare type BadgeProps = {
186
186
  */
187
187
  onClick?: (event?: MouseEvent_2<HTMLButtonElement>) => void;
188
188
  /**
189
- * @default false
190
- */
191
- dismissable?: boolean;
192
- /**
193
- * Click handler on dismiss
189
+ * Click handler on dismiss - providing this will show the dismiss button
194
190
  */
195
191
  onDismiss?: (event?: MouseEvent_2<HTMLButtonElement>) => void;
196
192
  /**
@@ -1835,6 +1831,23 @@ declare type TabsTriggerProps = {
1835
1831
  children: ReactNode;
1836
1832
  };
1837
1833
 
1834
+ export declare const Tag: typeof TagRoot & {
1835
+ HoverContent: typeof TagHoverContent;
1836
+ SecondaryContent: typeof TagSecondaryContent;
1837
+ displayName?: string;
1838
+ };
1839
+
1840
+ declare type TagEmphasis = 'strong' | 'weak';
1841
+
1842
+ declare const TagHoverContent: {
1843
+ ({ children }: TagHoverContentProps): JSX_2.Element;
1844
+ displayName: string;
1845
+ };
1846
+
1847
+ declare type TagHoverContentProps = {
1848
+ children: ReactNode;
1849
+ };
1850
+
1838
1851
  declare type TagPropMap = {
1839
1852
  a: {
1840
1853
  href?: string;
@@ -1861,7 +1874,60 @@ declare type TagPropMap = {
1861
1874
  };
1862
1875
  };
1863
1876
 
1864
- declare type TagProps<TTag extends TagType_2> = TagPropMap[TTag];
1877
+ declare type TagProps = {
1878
+ /**
1879
+ * @default 'strong'
1880
+ */
1881
+ emphasis?: TagEmphasis;
1882
+ /**
1883
+ * @default 'default'
1884
+ */
1885
+ variant?: TagStyle;
1886
+ /**
1887
+ * @default 'default'
1888
+ */
1889
+ size?: TagSize;
1890
+ /**
1891
+ * @default false
1892
+ */
1893
+ disabled?: boolean;
1894
+ /**
1895
+ * Click handler
1896
+ */
1897
+ onClick?: (event?: MouseEvent_2<HTMLButtonElement>) => void;
1898
+ /**
1899
+ * Click handler on dismiss - providing this will show the dismiss button
1900
+ */
1901
+ onDismiss?: (event?: MouseEvent_2<HTMLButtonElement>) => void;
1902
+ /**
1903
+ * Click handler on add click - providing this will show the add button
1904
+ */
1905
+ onAddClick?: (event?: MouseEvent_2<HTMLButtonElement>) => void;
1906
+ title?: string;
1907
+ 'aria-label'?: string;
1908
+ 'data-test-id'?: string;
1909
+ children: ReactNode;
1910
+ };
1911
+
1912
+ declare type TagProps_2<TTag extends TagType_2> = TagPropMap[TTag];
1913
+
1914
+ declare const TagRoot: {
1915
+ ({ "aria-label": ariaLabel, "data-test-id": dataTestId, children, disabled, emphasis, onAddClick, onClick, onDismiss, size, title, variant, }: TagProps): JSX_2.Element;
1916
+ displayName: string;
1917
+ };
1918
+
1919
+ declare const TagSecondaryContent: {
1920
+ ({ children }: TagSecondaryContentProps): JSX_2.Element;
1921
+ displayName: string;
1922
+ };
1923
+
1924
+ declare type TagSecondaryContentProps = {
1925
+ children: ReactNode;
1926
+ };
1927
+
1928
+ declare type TagSize = 'default' | 'small';
1929
+
1930
+ declare type TagStyle = 'default' | 'positive' | 'highlight' | 'warning' | 'negative';
1865
1931
 
1866
1932
  declare type TagType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p';
1867
1933
 
@@ -2080,7 +2146,7 @@ declare type TextInputProps = {
2080
2146
  'aria-errormessage'?: string;
2081
2147
  };
2082
2148
 
2083
- declare type TextProps<TTag extends TagType_2 = 'span'> = CommonAriaProps & TagProps<TTag> & {
2149
+ declare type TextProps<TTag extends TagType_2 = 'span'> = CommonAriaProps & TagProps_2<TTag> & {
2084
2150
  /**
2085
2151
  * Id of the element
2086
2152
  */