@frontify/fondue-components 26.0.1 → 26.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/fondue-components102.js +10 -10
  2. package/dist/fondue-components102.js.map +1 -1
  3. package/dist/fondue-components104.js +1 -1
  4. package/dist/fondue-components105.js +1 -1
  5. package/dist/fondue-components106.js +1 -1
  6. package/dist/fondue-components107.js +1 -1
  7. package/dist/fondue-components108.js +1 -1
  8. package/dist/fondue-components109.js +9 -9
  9. package/dist/fondue-components109.js.map +1 -1
  10. package/dist/fondue-components40.js +2 -2
  11. package/dist/fondue-components47.js +1 -1
  12. package/dist/fondue-components71.js +2 -2
  13. package/dist/fondue-components72.js +2 -2
  14. package/dist/fondue-components73.js +2 -2
  15. package/dist/fondue-components74.js +2 -2
  16. package/dist/fondue-components75.js +1 -1
  17. package/dist/fondue-components76.js +1 -1
  18. package/dist/fondue-components92.js +3 -15
  19. package/dist/fondue-components92.js.map +1 -1
  20. package/dist/fondue-components93.js +4 -210
  21. package/dist/fondue-components93.js.map +1 -1
  22. package/dist/fondue-components94.js +16 -18
  23. package/dist/fondue-components94.js.map +1 -1
  24. package/dist/fondue-components95.js +208 -17
  25. package/dist/fondue-components95.js.map +1 -1
  26. package/dist/fondue-components96.js +17 -149
  27. package/dist/fondue-components96.js.map +1 -1
  28. package/dist/fondue-components97.js +19 -44
  29. package/dist/fondue-components97.js.map +1 -1
  30. package/dist/fondue-components98.js +150 -4
  31. package/dist/fondue-components98.js.map +1 -1
  32. package/dist/fondue-components99.js +44 -4
  33. package/dist/fondue-components99.js.map +1 -1
  34. package/package.json +5 -5
@@ -1,10 +1,10 @@
1
1
  import { jsx as E } from "react/jsx-runtime";
2
- import { useState as S, useMemo as b, Children as v, isValidElement as C, cloneElement as w, useCallback as B, useEffect as x } from "react";
2
+ import { useState as S, useMemo as b, Children as V, isValidElement as C, cloneElement as w, useCallback as B, useEffect as x } from "react";
3
3
  import { SelectClear as F } from "./fondue-components108.js";
4
4
  import { ForwardedRefSelectItem as L } from "./fondue-components75.js";
5
5
  import { ForwardedRefSelectSlot as y } from "./fondue-components76.js";
6
6
  import { getSelectOptionValue as I } from "./fondue-components109.js";
7
- const O = (n, s) => {
7
+ const d = (n, s) => {
8
8
  const [e, r] = S(!1), [m, i] = S(null), [l, f] = S({
9
9
  menuComponents: [],
10
10
  items: []
@@ -24,7 +24,7 @@ const O = (n, s) => {
24
24
  }, [n, s]), { isLoading: e, error: m, menuComponents: l.menuComponents, items: l.items };
25
25
  }, g = (n) => {
26
26
  const s = [];
27
- return v.forEach(n, (e) => {
27
+ return V.forEach(n, (e) => {
28
28
  if (C(e) && e.type === L)
29
29
  s.push(I(e.props));
30
30
  else if (C(e) && e.props.children) {
@@ -36,23 +36,23 @@ const O = (n, s) => {
36
36
  }, q = (n, s) => {
37
37
  const [e, r] = S(""), { inputSlots: m, menuSlots: i, itemValues: l, clearButton: f } = b(() => {
38
38
  const a = [], p = [];
39
- let V;
40
- v.toArray(n).some(
39
+ let v;
40
+ V.toArray(n).some(
41
41
  (t) => C(t) && t.type === y
42
- ) ? v.forEach(n, (t) => {
43
- C(t) && t.type === y && (t.props.name === "menu" ? p.push(t.props.children) : t.props.name === "left" || t.props.name === "right" ? a.push(t) : t.props.name === "clear" && (t.props.children ? V = t : V = w(t, { children: /* @__PURE__ */ E(F, {}) })));
42
+ ) ? V.forEach(n, (t) => {
43
+ C(t) && t.type === y && (t.props.name === "menu" ? p.push(t.props.children) : t.props.name === "left" || t.props.name === "right" ? a.push(t) : t.props.name === "clear" && (t.props.children ? v = t : v = w(t, { children: /* @__PURE__ */ E(F, {}) })));
44
44
  }) : p.push(n);
45
45
  const R = g(p);
46
- return { inputSlots: a, menuSlots: p, itemValues: R, clearButton: V };
46
+ return { inputSlots: a, menuSlots: p, itemValues: R, clearButton: v };
47
47
  }, [n]), u = b(
48
48
  () => l.filter(
49
49
  (a) => e === "" || a.label.toLowerCase().includes(e.toLowerCase())
50
50
  ),
51
51
  [l, e]
52
52
  ), o = B(
53
- (a) => a ? l.find((p) => p.value === a) : void 0,
53
+ (a) => a !== void 0 ? l.find((p) => p.value === a) : void 0,
54
54
  [l]
55
- ), c = O(e, s);
55
+ ), c = d(e, s);
56
56
  return {
57
57
  items: [...u, ...c.items],
58
58
  menuSlots: [...i, ...c.menuComponents],
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components102.js","sources":["../src/components/Select/hooks/useSelectData.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\n\nimport { SelectClear } from '../components/SelectClear';\nimport { ForwardedRefSelectItem, type SelectItemProps } from '../components/SelectItem';\nimport { ForwardedRefSelectSlot, type SelectSlotProps } from '../components/SelectSlot';\nimport { getSelectOptionValue } from '../utils';\n\nexport type SelectItemType = {\n value: string;\n label: string;\n};\n\nexport type AsyncItem = { label: string; value: string; content?: ReactNode };\n\nexport type AsyncItemsFetcher = (filterText: string) => Promise<AsyncItem[]>;\n\nconst useAsyncItems = (filterText: string, getAsyncItems?: AsyncItemsFetcher) => {\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [asyncResult, setAsyncResult] = useState<{\n menuComponents: ReactNode[];\n items: { value: string; label: string; children?: ReactNode }[];\n }>({\n menuComponents: [],\n items: [],\n });\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setError(null);\n if (!getAsyncItems) {\n setAsyncResult({\n menuComponents: [],\n items: [],\n });\n }\n\n if (getAsyncItems) {\n setIsLoading(true);\n getAsyncItems(filterText)\n .then((items) => {\n setAsyncResult({\n menuComponents: items.map((item) => (\n <ForwardedRefSelectItem key={item.value} label={item.label} value={item.value}>\n {item.content ? item.content : item.label}\n </ForwardedRefSelectItem>\n )),\n items: items.map((item) => ({ value: item.value, label: item.label, children: item.content })),\n });\n setIsLoading(false);\n })\n .catch((error: Error) => {\n setError(error);\n setIsLoading(false);\n });\n }\n }, [filterText, getAsyncItems]);\n\n return { isLoading, error, menuComponents: asyncResult.menuComponents, items: asyncResult.items };\n};\n\n/**\n * Recursively extracts option values from children.\n * This function traverses through the React component tree and collects all SelectItem values.\n *\n * @param {ReactNode} children - The React children to extract values from.\n * @returns {SelectItemType[]} An array of SelectItemType objects.\n *\n * @example\n * const options = (\n * <SelectItem value=\"1\">Option 1</SelectItem>\n * <SelectItem value=\"2\">Option 2</SelectItem>\n * );\n * const values = getRecursiveOptionValues(options);\n * // Returns: [{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]\n */\nexport const getRecursiveOptionValues = (\n children: ReactNode,\n): { value: string; label: string; children?: ReactNode }[] => {\n const values: { value: string; label: string }[] = [];\n Children.forEach(children, (child) => {\n if (isValidElement<SelectItemProps>(child) && child.type === ForwardedRefSelectItem) {\n values.push(getSelectOptionValue(child.props));\n } else if (isValidElement<{ children: ReactNode }>(child) && child.props.children) {\n const optionValues = getRecursiveOptionValues(child.props.children);\n for (const optionValue of optionValues) {\n values.push(optionValue);\n }\n }\n });\n return values;\n};\n\n/**\n * Custom hook for managing select data and filtering.\n *\n * @param {ReactNode} children - The React children to process, typically SelectItem components.\n * @param {AsyncItemsFetcher} [getAsyncItems] - Optional function to fetch items asynchronously based on filter text.\n * @returns {Object} An object containing the processed data.\n */\nexport const useSelectData = (children: ReactNode, getAsyncItems?: AsyncItemsFetcher) => {\n const [filterText, setFilterText] = useState('');\n // eslint-disable-next-line react-hooks/preserve-manual-memoization\n const { inputSlots, menuSlots, itemValues, clearButton } = useMemo(() => {\n const inputSlots: ReactNode[] = [];\n const menuSlots: ReactNode[] = [];\n let clearButton: ReactNode;\n\n const hasSlots = Children.toArray(children).some(\n (child) => isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot,\n );\n\n if (hasSlots) {\n Children.forEach(children, (child) => {\n if (isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot) {\n if (child.props.name === 'menu') {\n menuSlots.push(child.props.children);\n } else if (child.props.name === 'left' || child.props.name === 'right') {\n inputSlots.push(child);\n } else if (child.props.name === 'clear') {\n if (child.props.children) {\n clearButton = child;\n } else {\n clearButton = cloneElement(child, { children: <SelectClear /> });\n }\n }\n }\n });\n } else {\n menuSlots.push(children);\n }\n\n const itemValues = getRecursiveOptionValues(menuSlots);\n\n return { inputSlots, menuSlots, itemValues, clearButton };\n }, [children]);\n\n const items = useMemo(\n () =>\n itemValues.filter(\n (item) => filterText === '' || item.label.toLowerCase().includes(filterText.toLowerCase()),\n ),\n [itemValues, filterText],\n );\n\n const getItemByValue = useCallback(\n (value?: string | null) => (value ? itemValues.find((item) => item.value === value) : undefined),\n [itemValues],\n );\n\n const asyncItems = useAsyncItems(filterText, getAsyncItems);\n\n return {\n items: [...items, ...asyncItems.items],\n menuSlots: [...menuSlots, ...asyncItems.menuComponents],\n filterText,\n inputSlots,\n clearButton,\n setFilterText,\n getItemByValue,\n asyncItemStatus: {\n isLoading: asyncItems.isLoading,\n error: asyncItems.error,\n },\n };\n};\n"],"names":["useAsyncItems","filterText","getAsyncItems","isLoading","setIsLoading","useState","error","setError","asyncResult","setAsyncResult","useEffect","items","item","jsx","ForwardedRefSelectItem","getRecursiveOptionValues","children","values","Children","child","isValidElement","getSelectOptionValue","optionValues","optionValue","useSelectData","setFilterText","inputSlots","menuSlots","itemValues","clearButton","useMemo","ForwardedRefSelectSlot","cloneElement","SelectClear","getItemByValue","useCallback","value","asyncItems"],"mappings":";;;;;;AA2BA,MAAMA,IAAgB,CAACC,GAAoBC,MAAsC;AAC7E,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1C,CAACC,GAAOC,CAAQ,IAAIF,EAAuB,IAAI,GAC/C,CAACG,GAAaC,CAAc,IAAIJ,EAGnC;AAAA,IACC,gBAAgB,CAAA;AAAA,IAChB,OAAO,CAA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1D,SAAO;AAAA,IACH,OAAO,CAAC,GAAGS,GAAO,GAAG0B,EAAW,KAAK;AAAA,IACrC,WAAW,CAAC,GAAGV,GAAW,GAAGU,EAAW,cAAc;AAAA,IACtD,YAAApC;AAAA,IACA,YAAAyB;AAAA,IACA,aAAAG;AAAA,IACA,eAAAJ;AAAA,IACA,gBAAAS;AAAA,IACA,iBAAiB;AAAA,MACb,WAAWG,EAAW;AAAA,MACtB,OAAOA,EAAW;AAAA,IAAA;AAAA,EACtB;AAER;"}
1
+ {"version":3,"file":"fondue-components102.js","sources":["../src/components/Select/hooks/useSelectData.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n Children,\n cloneElement,\n isValidElement,\n useCallback,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\n\nimport { SelectClear } from '../components/SelectClear';\nimport { ForwardedRefSelectItem, type SelectItemProps } from '../components/SelectItem';\nimport { ForwardedRefSelectSlot, type SelectSlotProps } from '../components/SelectSlot';\nimport { getSelectOptionValue } from '../utils';\n\nexport type SelectItemType = {\n value: string;\n label: string;\n};\n\nexport type AsyncItem = { label: string; value: string; content?: ReactNode };\n\nexport type AsyncItemsFetcher = (filterText: string) => Promise<AsyncItem[]>;\n\nconst useAsyncItems = (filterText: string, getAsyncItems?: AsyncItemsFetcher) => {\n const [isLoading, setIsLoading] = useState(false);\n const [error, setError] = useState<Error | null>(null);\n const [asyncResult, setAsyncResult] = useState<{\n menuComponents: ReactNode[];\n items: { value: string; label: string; children?: ReactNode }[];\n }>({\n menuComponents: [],\n items: [],\n });\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setError(null);\n if (!getAsyncItems) {\n setAsyncResult({\n menuComponents: [],\n items: [],\n });\n }\n\n if (getAsyncItems) {\n setIsLoading(true);\n getAsyncItems(filterText)\n .then((items) => {\n setAsyncResult({\n menuComponents: items.map((item) => (\n <ForwardedRefSelectItem key={item.value} label={item.label} value={item.value}>\n {item.content ? item.content : item.label}\n </ForwardedRefSelectItem>\n )),\n items: items.map((item) => ({ value: item.value, label: item.label, children: item.content })),\n });\n setIsLoading(false);\n })\n .catch((error: Error) => {\n setError(error);\n setIsLoading(false);\n });\n }\n }, [filterText, getAsyncItems]);\n\n return { isLoading, error, menuComponents: asyncResult.menuComponents, items: asyncResult.items };\n};\n\n/**\n * Recursively extracts option values from children.\n * This function traverses through the React component tree and collects all SelectItem values.\n *\n * @param {ReactNode} children - The React children to extract values from.\n * @returns {SelectItemType[]} An array of SelectItemType objects.\n *\n * @example\n * const options = (\n * <SelectItem value=\"1\">Option 1</SelectItem>\n * <SelectItem value=\"2\">Option 2</SelectItem>\n * );\n * const values = getRecursiveOptionValues(options);\n * // Returns: [{ value: '1', label: 'Option 1' }, { value: '2', label: 'Option 2' }]\n */\nexport const getRecursiveOptionValues = (\n children: ReactNode,\n): { value: string; label: string; children?: ReactNode }[] => {\n const values: { value: string; label: string }[] = [];\n Children.forEach(children, (child) => {\n if (isValidElement<SelectItemProps>(child) && child.type === ForwardedRefSelectItem) {\n values.push(getSelectOptionValue(child.props));\n } else if (isValidElement<{ children: ReactNode }>(child) && child.props.children) {\n const optionValues = getRecursiveOptionValues(child.props.children);\n for (const optionValue of optionValues) {\n values.push(optionValue);\n }\n }\n });\n return values;\n};\n\n/**\n * Custom hook for managing select data and filtering.\n *\n * @param {ReactNode} children - The React children to process, typically SelectItem components.\n * @param {AsyncItemsFetcher} [getAsyncItems] - Optional function to fetch items asynchronously based on filter text.\n * @returns {Object} An object containing the processed data.\n */\nexport const useSelectData = (children: ReactNode, getAsyncItems?: AsyncItemsFetcher) => {\n const [filterText, setFilterText] = useState('');\n // eslint-disable-next-line react-hooks/preserve-manual-memoization\n const { inputSlots, menuSlots, itemValues, clearButton } = useMemo(() => {\n const inputSlots: ReactNode[] = [];\n const menuSlots: ReactNode[] = [];\n let clearButton: ReactNode;\n\n const hasSlots = Children.toArray(children).some(\n (child) => isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot,\n );\n\n if (hasSlots) {\n Children.forEach(children, (child) => {\n if (isValidElement<SelectSlotProps>(child) && child.type === ForwardedRefSelectSlot) {\n if (child.props.name === 'menu') {\n menuSlots.push(child.props.children);\n } else if (child.props.name === 'left' || child.props.name === 'right') {\n inputSlots.push(child);\n } else if (child.props.name === 'clear') {\n if (child.props.children) {\n clearButton = child;\n } else {\n clearButton = cloneElement(child, { children: <SelectClear /> });\n }\n }\n }\n });\n } else {\n menuSlots.push(children);\n }\n\n const itemValues = getRecursiveOptionValues(menuSlots);\n\n return { inputSlots, menuSlots, itemValues, clearButton };\n }, [children]);\n\n const items = useMemo(\n () =>\n itemValues.filter(\n (item) => filterText === '' || item.label.toLowerCase().includes(filterText.toLowerCase()),\n ),\n [itemValues, filterText],\n );\n\n const getItemByValue = useCallback(\n (value?: string | null) => (value !== undefined ? itemValues.find((item) => item.value === value) : undefined),\n [itemValues],\n );\n\n const asyncItems = useAsyncItems(filterText, getAsyncItems);\n\n return {\n items: [...items, ...asyncItems.items],\n menuSlots: [...menuSlots, ...asyncItems.menuComponents],\n filterText,\n inputSlots,\n clearButton,\n setFilterText,\n getItemByValue,\n asyncItemStatus: {\n isLoading: asyncItems.isLoading,\n error: asyncItems.error,\n },\n };\n};\n"],"names":["useAsyncItems","filterText","getAsyncItems","isLoading","setIsLoading","useState","error","setError","asyncResult","setAsyncResult","useEffect","items","item","jsx","ForwardedRefSelectItem","getRecursiveOptionValues","children","values","Children","child","isValidElement","getSelectOptionValue","optionValues","optionValue","useSelectData","setFilterText","inputSlots","menuSlots","itemValues","clearButton","useMemo","ForwardedRefSelectSlot","cloneElement","SelectClear","getItemByValue","useCallback","value","asyncItems"],"mappings":";;;;;;AA2BA,MAAMA,IAAgB,CAACC,GAAoBC,MAAsC;AAC7E,QAAM,CAACC,GAAWC,CAAY,IAAIC,EAAS,EAAK,GAC1C,CAACC,GAAOC,CAAQ,IAAIF,EAAuB,IAAI,GAC/C,CAACG,GA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AAI;AAAA,IACpG,CAACR,CAAU;AAAA,EAAA,GAGTS,IAAarC,EAAcC,GAAYC,CAAa;AAE1D,SAAO;AAAA,IACH,OAAO,CAAC,GAAGS,GAAO,GAAG0B,EAAW,KAAK;AAAA,IACrC,WAAW,CAAC,GAAGV,GAAW,GAAGU,EAAW,cAAc;AAAA,IACtD,YAAApC;AAAA,IACA,YAAAyB;AAAA,IACA,aAAAG;AAAA,IACA,eAAAJ;AAAA,IACA,gBAAAS;AAAA,IACA,iBAAiB;AAAA,MACb,WAAWG,EAAW;AAAA,MACtB,OAAOA,EAAW;AAAA,IAAA;AAAA,EACtB;AAER;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { Slot as e } from "@radix-ui/react-slot";
3
- import a from "./fondue-components97.js";
3
+ import a from "./fondue-components99.js";
4
4
  const m = ({ children: o, onClear: t }) => /* @__PURE__ */ r(e, { onClick: (l) => {
5
5
  l.stopPropagation(), t();
6
6
  }, className: a.clear, role: "button", "aria-label": "Clear selection", children: o });
@@ -2,7 +2,7 @@ import { jsxs as S, jsx as f } from "react/jsx-runtime";
2
2
  import { useRef as m, useState as C, useEffect as _ } from "react";
3
3
  import { Badge as w } from "./fondue-components4.js";
4
4
  import { useTranslation as I } from "./fondue-components39.js";
5
- import p from "./fondue-components97.js";
5
+ import p from "./fondue-components99.js";
6
6
  const W = 4, D = 40, E = 24, M = (r, h, u, o) => {
7
7
  const g = r.offsetWidth;
8
8
  let s = o ? E + W : 0, n = 0;
@@ -3,7 +3,7 @@ import * as p from "@radix-ui/react-popover";
3
3
  import { Slot as M } from "@radix-ui/react-slot";
4
4
  import { isValidElement as T } from "react";
5
5
  import { useFondueTheme as E, ThemeProvider as F } from "./fondue-components36.js";
6
- import a from "./fondue-components97.js";
6
+ import a from "./fondue-components99.js";
7
7
  import { recursiveMap as R, getSelectOptionValue as _ } from "./fondue-components109.js";
8
8
  const j = ({
9
9
  highlightedIndex: l,
@@ -1,7 +1,7 @@
1
1
  import { jsxs as c, Fragment as n, jsx as r } from "react/jsx-runtime";
2
2
  import { IconCheckMark as i, IconExclamationMarkTriangle as l } from "@frontify/fondue-icons";
3
3
  import { useTranslation as m } from "./fondue-components39.js";
4
- import s from "./fondue-components97.js";
4
+ import s from "./fondue-components99.js";
5
5
  const f = ({ status: o, hasError: a, dataTestId: e }) => {
6
6
  const { t } = m();
7
7
  return /* @__PURE__ */ c(n, { children: [
@@ -2,7 +2,7 @@ import { jsx as e } from "react/jsx-runtime";
2
2
  import { IconCross as s } from "@frontify/fondue-icons";
3
3
  import { Button as t } from "./fondue-components6.js";
4
4
  import { useTranslation as a } from "./fondue-components39.js";
5
- import l from "./fondue-components97.js";
5
+ import l from "./fondue-components99.js";
6
6
  const f = ({ onClear: r }) => {
7
7
  const { t: o } = a();
8
8
  return /* @__PURE__ */ e(
@@ -5,20 +5,20 @@ const g = ({
5
5
  value: r,
6
6
  label: s
7
7
  }) => o && typeof o == "string" ? {
8
- value: r || o,
9
- label: s || o
8
+ value: r !== void 0 ? r : o,
9
+ label: s !== void 0 ? s : o
10
10
  } : {
11
- value: r || "",
12
- label: s || r || "",
11
+ value: r ?? "",
12
+ label: s !== void 0 ? s : r ?? "",
13
13
  ...o ? { children: o } : null
14
- }, w = (o, r) => u(o) && o.type === r, y = (o, r, s, p = 0) => {
14
+ }, v = (o, r) => u(o) && o.type === r, w = (o, r, s, p = 0) => {
15
15
  const n = [];
16
16
  let t = 0;
17
17
  return a.forEach(o, (e) => {
18
- if (w(e, E) && u(e))
18
+ if (v(e, E) && u(e))
19
19
  g(e.props).label.toLowerCase().includes((s == null ? void 0 : s.toLowerCase()) || "") && (n.push(r(e, p + t)), t++);
20
20
  else if (u(e) && (e != null && e.props.children)) {
21
- const { parsedChildren: m, subElementCount: C } = y(
21
+ const { parsedChildren: m, subElementCount: C } = w(
22
22
  e.props.children,
23
23
  r,
24
24
  "",
@@ -37,7 +37,7 @@ const g = ({
37
37
  };
38
38
  export {
39
39
  g as getSelectOptionValue,
40
- w as isReactLeaf,
41
- y as recursiveMap
40
+ v as isReactLeaf,
41
+ w as recursiveMap
42
42
  };
43
43
  //# sourceMappingURL=fondue-components109.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components109.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 './components/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-components109.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 './components/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 !== undefined ? value : children,\n label: label !== undefined ? label : children,\n };\n }\n\n return {\n value: value ?? '',\n label: label !== undefined ? 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,MAAU,SAAYA,IAAQD;AAAA,EACrC,OAAOE,MAAU,SAAYA,IAAQF;AAAA,IAItC;AAAA,EACH,OAAOC,KAAS;AAAA,EAChB,OAAOC,MAAU,SAAYA,IAASD,KAAS;AAAA,EAC/C,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,6 +1,6 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import s from "./fondue-components98.js";
3
- import { colorToCss as e } from "./fondue-components99.js";
2
+ import s from "./fondue-components92.js";
3
+ import { colorToCss as e } from "./fondue-components93.js";
4
4
  const a = ["default", "positive", "highlight", "warning", "negative"], i = (t) => typeof t == "string" && a.includes(t), p = ({ status: t }) => {
5
5
  const o = i(t) ? { "data-status": t } : { style: { backgroundColor: typeof t == "string" ? t : e(t) || "transparent" } };
6
6
  return /* @__PURE__ */ r("div", { "data-test-id": "badge-status", className: s.root, ...o });
@@ -3,7 +3,7 @@ import { IconDroplet as I, IconCross as k, IconCaretDown as v } from "@frontify/
3
3
  import { forwardRef as P } from "react";
4
4
  import { useTranslation as w } from "./fondue-components39.js";
5
5
  import { Button as y } from "./fondue-components6.js";
6
- import a from "./fondue-components92.js";
6
+ import a from "./fondue-components94.js";
7
7
  import { getColorWithName as z, colorToCss as x } from "./fondue-components50.js";
8
8
  const c = ({
9
9
  id: m,
@@ -1,7 +1,7 @@
1
1
  import { jsx as s } from "react/jsx-runtime";
2
2
  import { forwardRef as u } from "react";
3
- import { ComboboxBase as c } from "./fondue-components93.js";
4
- import { useMultiselect as b } from "./fondue-components94.js";
3
+ import { ComboboxBase as c } from "./fondue-components95.js";
4
+ import { useMultiselect as b } from "./fondue-components96.js";
5
5
  const a = ({ value: e, onSelect: o, defaultValue: t, ...l }, m) => {
6
6
  const { selectedItemValues: r, toggleSelectedItem: p, clear: i } = b(o, e, t);
7
7
  return /* @__PURE__ */ s(
@@ -1,7 +1,7 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
2
  import { forwardRef as i } from "react";
3
- import { ComboboxBase as a } from "./fondue-components93.js";
4
- import { useSingleSelect as b } from "./fondue-components95.js";
3
+ import { ComboboxBase as a } from "./fondue-components95.js";
4
+ import { useSingleSelect as b } from "./fondue-components97.js";
5
5
  const p = ({ value: e, onSelect: o, defaultValue: t, ...m }, l) => {
6
6
  const { selectedItemValues: r, selectItem: s, clear: n } = b(o, e, t);
7
7
  return /* @__PURE__ */ c(
@@ -1,7 +1,7 @@
1
1
  import { jsx as p } from "react/jsx-runtime";
2
2
  import { forwardRef as s } from "react";
3
- import { SelectBase as u } from "./fondue-components96.js";
4
- import { useMultiselect as a } from "./fondue-components94.js";
3
+ import { SelectBase as u } from "./fondue-components98.js";
4
+ import { useMultiselect as a } from "./fondue-components96.js";
5
5
  const n = ({ value: e, onSelect: t, defaultValue: l, ...o }, r) => {
6
6
  const { selectedItemValues: m, toggleSelectedItem: c, clear: i } = a(t, e, l);
7
7
  return /* @__PURE__ */ p(
@@ -1,7 +1,7 @@
1
1
  import { jsx as n } from "react/jsx-runtime";
2
2
  import { forwardRef as i } from "react";
3
- import { SelectBase as S } from "./fondue-components96.js";
4
- import { useSingleSelect as a } from "./fondue-components95.js";
3
+ import { SelectBase as S } from "./fondue-components98.js";
4
+ import { useSingleSelect as a } from "./fondue-components97.js";
5
5
  const p = ({ value: e, onSelect: t, defaultValue: l, ...o }, r) => {
6
6
  const { selectedItemValues: m, selectItem: c, clear: s } = a(t, e, l);
7
7
  return /* @__PURE__ */ n(
@@ -1,7 +1,7 @@
1
1
  import { jsxs as d, jsx as r } from "react/jsx-runtime";
2
2
  import { IconCheckMark as n } from "@frontify/fondue-icons";
3
3
  import { forwardRef as l } from "react";
4
- import a from "./fondue-components97.js";
4
+ import a from "./fondue-components99.js";
5
5
  const o = ({ "data-test-id": c = "fondue-select-item", ...e }, t) => /* @__PURE__ */ d("li", { "data-test-id": c, ref: t, ...e, children: [
6
6
  /* @__PURE__ */ r("div", { className: a.itemValue, children: e.children }),
7
7
  /* @__PURE__ */ r(n, { className: a.checkmarkIcon })
@@ -1,6 +1,6 @@
1
1
  import { jsx as l } from "react/jsx-runtime";
2
2
  import { forwardRef as d } from "react";
3
- import m from "./fondue-components97.js";
3
+ import m from "./fondue-components99.js";
4
4
  const t = ({ children: e, name: o, "data-test-id": r = "fondue-select-slot", ...a }, s) => /* @__PURE__ */ l("div", { "data-test-id": r, ref: s, className: m.slot, "data-name": o, ...a, children: e });
5
5
  t.displayName = "Select.Slot";
6
6
  const S = d(t);
@@ -1,20 +1,8 @@
1
- const o = "_root_18649_5", c = "_caret_18649_43", t = "_colorName_18649_58", _ = "_colorIndicator_18649_61", n = "_button_18649_82", r = "_actions_18649_113", a = "_clearIcon_18649_122", s = {
2
- root: o,
3
- caret: c,
4
- colorName: t,
5
- colorIndicator: _,
6
- button: n,
7
- actions: r,
8
- clearIcon: a
1
+ const o = "_root_1y4f3_2", t = {
2
+ root: o
9
3
  };
10
4
  export {
11
- r as actions,
12
- n as button,
13
- c as caret,
14
- a as clearIcon,
15
- _ as colorIndicator,
16
- t as colorName,
17
- s as default,
5
+ t as default,
18
6
  o as root
19
7
  };
20
8
  //# sourceMappingURL=fondue-components92.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components92.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"fondue-components92.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
@@ -1,214 +1,8 @@
1
- import { jsxs as f, jsx as n, Fragment as ue } from "react/jsx-runtime";
2
- import { IconCaretDown as me } from "@frontify/fondue-icons";
3
- import * as H from "@radix-ui/react-popover";
4
- import { useMultipleSelection as j, useCombobox as g } from "downshift";
5
- import { forwardRef as be, useRef as fe, useCallback as ge, useState as he, useMemo as z } from "react";
6
- import { LoadingCircle as pe } from "./fondue-components19.js";
7
- import { useTranslation as Ce } from "./fondue-components39.js";
8
- import { useBadgeItems as ye } from "./fondue-components100.js";
9
- import { useFocusRing as Be } from "./fondue-components101.js";
10
- import { useSelectData as ve } from "./fondue-components102.js";
11
- import { useSelectionDescription as xe } from "./fondue-components103.js";
12
- import s from "./fondue-components97.js";
13
- import { ClearButton as Ie } from "./fondue-components104.js";
14
- import { CollapsibleBadges as Se } from "./fondue-components105.js";
15
- import { SelectMenu as Re } from "./fondue-components106.js";
16
- import { ForwardedRefSelectSlot as De } from "./fondue-components76.js";
17
- import { StatusIcons as we } from "./fondue-components107.js";
18
- const K = ({
19
- children: $,
20
- selectedItemValues: i,
21
- onItemSelect: h,
22
- onClear: E,
23
- placeholder: I = "",
24
- status: p = "neutral",
25
- disabled: d,
26
- "data-test-id": c = "fondue-select-combobox",
27
- alignMenu: _ = "start",
28
- side: q = "bottom",
29
- id: G,
30
- viewportCollisionPadding: J = "compact",
31
- getAsyncItems: C,
32
- onEscapeKeyDown: Q,
33
- multiple: o,
34
- ...t
35
- }, U) => {
36
- const u = fe(null), W = ge((e) => {
37
- u.current = e;
38
- }, []), { t: X } = Ce(), { inputSlots: Y, menuSlots: Z, items: y, filterText: A, clearButton: S, getItemByValue: l, setFilterText: B, asyncItemStatus: R } = ve($, C), { wasClickedRef: V, onMouseDown: D, onFocus: w, onBlur: ee } = Be(), { selectionDescriptionId: L, selectionDescription: O } = xe(
39
- o,
40
- i,
41
- l
42
- ), te = ye(i, l), [ae, M] = he(!1), N = z(() => i.map((e) => l(e)).filter((e) => e !== void 0 && "value" in e && "label" in e), [i, l]), ne = j(
43
- o ? {
44
- selectedItems: N,
45
- onStateChange({ selectedItems: e, type: r }) {
46
- if (r === j.stateChangeTypes.SelectedItemKeyDownBackspace) {
47
- const a = N.find((b) => !(e != null && e.includes(b)));
48
- a && h(a.value);
49
- }
50
- }
51
- } : { selectedItems: [] }
52
- ), oe = o ? ne.removeSelectedItem : () => {
53
- }, {
54
- getInputProps: m,
55
- getToggleButtonProps: ie,
56
- getMenuProps: re,
57
- getItemProps: le,
58
- reset: F,
59
- selectedItem: v,
60
- isOpen: k,
61
- highlightedIndex: se,
62
- inputValue: x
63
- } = g({
64
- items: y,
65
- selectedItem: o ? null : l(i[0]),
66
- defaultHighlightedIndex: 0,
67
- toggleButtonId: G,
68
- // Only set labelId if aria-labelledby is explicitly provided, otherwise downshift generates an orphan ID
69
- ..."aria-labelledby" in t && t["aria-labelledby"] ? { labelId: t["aria-labelledby"] } : {},
70
- onSelectedItemChange: ({ selectedItem: e }) => {
71
- e && h(e.value), o && B("");
72
- },
73
- onInputValueChange: ({ inputValue: e }) => {
74
- B(e);
75
- },
76
- onIsOpenChange: () => {
77
- M(!1), B("");
78
- },
79
- onHighlightedIndexChange: () => {
80
- M(!0);
81
- },
82
- itemToString: (e) => e ? e.label : "",
83
- ...o ? {
84
- stateReducer: (e, r) => {
85
- const { changes: a, type: b } = r;
86
- switch (b) {
87
- case g.stateChangeTypes.InputKeyDownEnter:
88
- case g.stateChangeTypes.ItemClick:
89
- return {
90
- ...a,
91
- isOpen: !0,
92
- highlightedIndex: e.highlightedIndex,
93
- inputValue: ""
94
- };
95
- case g.stateChangeTypes.InputBlur:
96
- return {
97
- ...a,
98
- inputValue: ""
99
- };
100
- }
101
- return a;
102
- }
103
- } : {}
104
- }), P = z(() => o ? !1 : !C && !y.find((e) => e.label.toLowerCase().includes(x.toLowerCase())), [x, y, C, o]) || !!R.error || p === "error", ce = (e, r) => {
105
- const a = l(e);
106
- a && (oe(a), h(e), u.current && (u.current.focus(), r && (u.current.dataset.showFocusRing = "false")));
107
- }, de = () => {
108
- E(), F();
109
- }, T = (e) => {
110
- var r, a;
111
- ee(e), o || ((v == null ? void 0 : v.label) ?? "").toLocaleLowerCase() !== x.toLocaleLowerCase() && F(), m().onBlur && ((a = (r = m()).onBlur) == null || a.call(r, e));
112
- };
113
- return /* @__PURE__ */ f(H.Root, { open: k, children: [
114
- /* @__PURE__ */ n(H.Anchor, { asChild: !0, children: /* @__PURE__ */ f(
115
- "div",
116
- {
117
- ref: U,
118
- className: s.root,
119
- "data-status": P ? "error" : p,
120
- "data-disabled": d,
121
- "data-empty": i.length === 0,
122
- children: [
123
- o ? /* @__PURE__ */ f(ue, { children: [
124
- /* @__PURE__ */ n("span", { id: L, className: s.srOnly, children: O }),
125
- /* @__PURE__ */ n(
126
- Se,
127
- {
128
- items: te,
129
- onDismiss: ce,
130
- selectedCount: i.length,
131
- children: /* @__PURE__ */ n(
132
- "input",
133
- {
134
- ...m({
135
- ref: W,
136
- "aria-label": "aria-label" in t ? t["aria-label"] : void 0,
137
- // Remove auto-generated aria-labelledby if not explicitly provided
138
- "aria-labelledby": "aria-labelledby" in t && t["aria-labelledby"] ? t["aria-labelledby"] : void 0,
139
- "aria-describedby": O ? L : void 0
140
- }),
141
- "data-test-id": c,
142
- placeholder: i.length === 0 ? I : "",
143
- className: s.multiSelectInput,
144
- disabled: d,
145
- onMouseDown: D,
146
- onFocus: w,
147
- onBlur: T
148
- }
149
- )
150
- }
151
- )
152
- ] }) : /* @__PURE__ */ n(
153
- "input",
154
- {
155
- ...m({
156
- "aria-label": "aria-label" in t ? t["aria-label"] : void 0,
157
- // Remove auto-generated aria-labelledby if not explicitly provided
158
- "aria-labelledby": "aria-labelledby" in t && t["aria-labelledby"] ? t["aria-labelledby"] : void 0
159
- }),
160
- "data-test-id": c,
161
- placeholder: I,
162
- className: s.input,
163
- disabled: d,
164
- onMouseDown: D,
165
- onFocus: w,
166
- onBlur: T
167
- }
168
- ),
169
- Y,
170
- S ? /* @__PURE__ */ n(Ie, { onClear: de, children: S }) : null,
171
- R.isLoading && k ? /* @__PURE__ */ n(De, { name: "right", "data-test-id": `${c}-right-slot`, children: /* @__PURE__ */ n(pe, { size: "x-small", "data-test-id": `${c}-loading-circle` }) }) : null,
172
- /* @__PURE__ */ f("div", { className: s.icons, children: [
173
- /* @__PURE__ */ n(
174
- "button",
175
- {
176
- "aria-label": X("Select_toggleMenu"),
177
- ...ie(),
178
- type: "button",
179
- disabled: d,
180
- onMouseDown: () => {
181
- V.current = !0;
182
- },
183
- children: /* @__PURE__ */ n(me, { size: 16, className: s.caret })
184
- }
185
- ),
186
- /* @__PURE__ */ n(we, { status: p, hasError: P, dataTestId: c })
187
- ] })
188
- ]
189
- }
190
- ) }),
191
- /* @__PURE__ */ n(
192
- Re,
193
- {
194
- align: _,
195
- side: q,
196
- highlightedIndex: se,
197
- filterText: A,
198
- getMenuProps: re,
199
- getItemProps: le,
200
- selectedItemValues: i,
201
- hasInteractedSinceOpening: ae,
202
- viewportCollisionPadding: J,
203
- onEscapeKeyDown: Q,
204
- children: Z
205
- }
206
- )
207
- ] });
1
+ const r = (e) => {
2
+ if (e)
3
+ return `rgba(${e.red}, ${e.green}, ${e.blue}, ${e.alpha ?? 1})`;
208
4
  };
209
- K.displayName = "Select.Combobox";
210
- const Qe = be(K);
211
5
  export {
212
- Qe as ComboboxBase
6
+ r as colorToCss
213
7
  };
214
8
  //# sourceMappingURL=fondue-components93.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components93.js","sources":["../src/components/Select/components/ComboboxBase.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { useCombobox, useMultipleSelection } from 'downshift';\nimport {\n forwardRef,\n useCallback,\n useMemo,\n useRef,\n useState,\n type FocusEvent,\n type ForwardedRef,\n type ReactNode,\n} from 'react';\n\nimport { LoadingCircle } from '#/components/LoadingCircle/LoadingCircle.tsx';\nimport { type CommonAriaProps } from '#/helpers/aria';\nimport { useTranslation } from '#/hooks/useTranslation';\n\nimport { useBadgeItems } from '../hooks/useBadgeItems';\nimport { useFocusRing } from '../hooks/useFocusRing';\nimport { useSelectData, type AsyncItemsFetcher } from '../hooks/useSelectData';\nimport { useSelectionDescription } from '../hooks/useSelectionDescription';\nimport styles from '../styles/select.module.scss';\n\nimport { ClearButton } from './ClearButton';\nimport { CollapsibleBadges } from './CollapsibleBadges';\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } from './SelectMenu';\nimport { ForwardedRefSelectSlot } from './SelectSlot';\nimport { StatusIcons } from './StatusIcons';\n\ntype SelectItem = {\n value: string;\n label: string;\n children?: ReactNode;\n};\n\nexport type ComboboxSharedProps = {\n /**\n * Children of the Combobox component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu\n */\n children?: ReactNode;\n /**\n * The placeholder in the combobox component\n */\n placeholder?: string;\n /**\n * Status of the text input\n * @default \"neutral\"\n */\n status?: 'neutral' | 'success' | 'error';\n /**\n * Disables the combobox component\n */\n disabled?: boolean;\n /**\n * The alignment of the menu\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end';\n /**\n * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport\n * @default \"bottom\"\n */\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component\n */\n 'data-test-id'?: string;\n /**\n * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n /**\n * Function to fetch items asynchronously\n */\n getAsyncItems?: AsyncItemsFetcher;\n /**\n * Event handler called when the escape key is pressed\n */\n onEscapeKeyDown?: (event: KeyboardEvent) => void;\n} & CommonAriaProps;\n\ntype ComboboxBaseProps = ComboboxSharedProps & {\n /**\n * The currently selected item values\n */\n selectedItemValues: string[];\n /**\n * Callback fired when an item is selected or deselected\n */\n onItemSelect: (value?: string) => void;\n /**\n * Callback fired when the selection is cleared\n */\n onClear: () => void;\n /**\n * Whether the combobox allows multiple selections\n */\n multiple: boolean;\n};\n\nconst ComboboxBaseInput = (\n {\n children,\n selectedItemValues,\n onItemSelect,\n onClear,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n viewportCollisionPadding = 'compact',\n getAsyncItems,\n onEscapeKeyDown,\n multiple,\n ...props\n }: ComboboxBaseProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n): ReactNode => {\n const inputRef = useRef<HTMLInputElement | null>(null);\n const inputCallbackRef = useCallback((node: HTMLInputElement | null): void => {\n inputRef.current = node;\n }, []);\n const { t } = useTranslation();\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText, asyncItemStatus } =\n useSelectData(children, getAsyncItems);\n const { wasClickedRef, onMouseDown, onFocus, onBlur } = useFocusRing();\n const { selectionDescriptionId, selectionDescription } = useSelectionDescription(\n multiple,\n selectedItemValues,\n getItemByValue,\n );\n const badgeItems = useBadgeItems(selectedItemValues, getItemByValue);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const selectedItems = useMemo((): SelectItem[] => {\n return selectedItemValues\n .map((value) => getItemByValue(value))\n .filter((item): item is SelectItem => item !== undefined && 'value' in item && 'label' in item);\n }, [selectedItemValues, getItemByValue]);\n\n const multipleSelectionResult = useMultipleSelection<SelectItem>(\n multiple\n ? {\n selectedItems,\n onStateChange({ selectedItems: newSelectedItems, type }) {\n if (type === useMultipleSelection.stateChangeTypes.SelectedItemKeyDownBackspace) {\n const removedItem = selectedItems.find((item) => !newSelectedItems?.includes(item));\n if (removedItem) {\n onItemSelect(removedItem.value);\n }\n }\n },\n }\n : { selectedItems: [] },\n );\n const removeSelectedItem = multiple ? multipleSelectionResult.removeSelectedItem : (): void => {};\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox<SelectItem>({\n items,\n selectedItem: multiple ? null : (getItemByValue(selectedItemValues[0]) as SelectItem | null | undefined),\n defaultHighlightedIndex: 0,\n toggleButtonId: id,\n // Only set labelId if aria-labelledby is explicitly provided, otherwise downshift generates an orphan ID\n ...('aria-labelledby' in props && props['aria-labelledby'] ? { labelId: props['aria-labelledby'] } : {}),\n onSelectedItemChange: ({ selectedItem }) => {\n if (selectedItem) {\n onItemSelect(selectedItem.value);\n }\n if (multiple) {\n setFilterText('');\n }\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n setFilterText('');\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n itemToString: (item) => (item ? item.label : ''),\n ...(multiple\n ? {\n stateReducer: (state, actionAndChanges) => {\n const { changes, type } = actionAndChanges;\n switch (type) {\n case useCombobox.stateChangeTypes.InputKeyDownEnter:\n case useCombobox.stateChangeTypes.ItemClick:\n return {\n ...changes,\n isOpen: true,\n highlightedIndex: state.highlightedIndex,\n inputValue: '',\n };\n case useCombobox.stateChangeTypes.InputBlur:\n // Select item on blur (Tab key) but clear the input\n return {\n ...changes,\n inputValue: '',\n };\n }\n return changes;\n },\n }\n : {}),\n });\n\n const valueInvalid = useMemo(() => {\n if (multiple) {\n return false;\n }\n return !getAsyncItems && !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase()));\n }, [inputValue, items, getAsyncItems, multiple]);\n\n const hasError = valueInvalid || !!asyncItemStatus.error || status === 'error';\n\n const handleDismissBadge = (value: string, preventFocusRing: boolean): void => {\n const item = getItemByValue(value) as SelectItem | undefined;\n if (item) {\n removeSelectedItem(item);\n onItemSelect(value);\n if (inputRef.current) {\n inputRef.current.focus();\n if (preventFocusRing) {\n inputRef.current.dataset.showFocusRing = 'false';\n }\n }\n }\n };\n\n const handleClear = (): void => {\n onClear();\n reset();\n };\n\n const handleBlur = (blurEvent: FocusEvent<HTMLInputElement, Element>): void => {\n onBlur(blurEvent);\n\n if (!multiple) {\n const selectedItemLabel = selectedItem?.label ?? '';\n const isOutdated = selectedItemLabel.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (isOutdated) {\n reset();\n }\n }\n\n if (getInputProps().onBlur) {\n getInputProps().onBlur?.(blurEvent);\n }\n };\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor asChild>\n <div\n ref={forwardedRef}\n className={styles.root}\n data-status={hasError ? 'error' : status}\n data-disabled={disabled}\n data-empty={selectedItemValues.length === 0}\n >\n {multiple ? (\n <>\n {/* Hidden description for screen readers - announced on focus */}\n <span id={selectionDescriptionId} className={styles.srOnly}>\n {selectionDescription}\n </span>\n <CollapsibleBadges\n items={badgeItems}\n onDismiss={handleDismissBadge}\n selectedCount={selectedItemValues.length}\n >\n <input\n // eslint-disable-next-line react-hooks/refs\n {...getInputProps({\n ref: inputCallbackRef,\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n // Remove auto-generated aria-labelledby if not explicitly provided\n 'aria-labelledby':\n 'aria-labelledby' in props && props['aria-labelledby']\n ? props['aria-labelledby']\n : undefined,\n 'aria-describedby': selectionDescription ? selectionDescriptionId : undefined,\n })}\n data-test-id={dataTestId}\n placeholder={selectedItemValues.length === 0 ? placeholder : ''}\n className={styles.multiSelectInput}\n disabled={disabled}\n onMouseDown={onMouseDown}\n onFocus={onFocus}\n onBlur={handleBlur}\n />\n </CollapsibleBadges>\n </>\n ) : (\n <input\n {...getInputProps({\n 'aria-label': 'aria-label' in props ? props['aria-label'] : undefined,\n // Remove auto-generated aria-labelledby if not explicitly provided\n 'aria-labelledby':\n 'aria-labelledby' in props && props['aria-labelledby']\n ? props['aria-labelledby']\n : undefined,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\n onMouseDown={onMouseDown}\n onFocus={onFocus}\n onBlur={handleBlur}\n />\n )}\n {inputSlots}\n {clearButton ? <ClearButton onClear={handleClear}>{clearButton}</ClearButton> : null}\n {asyncItemStatus.isLoading && isOpen ? (\n <ForwardedRefSelectSlot name=\"right\" data-test-id={`${dataTestId}-right-slot`}>\n <LoadingCircle size=\"x-small\" data-test-id={`${dataTestId}-loading-circle`} />\n </ForwardedRefSelectSlot>\n ) : null}\n <div className={styles.icons}>\n <button\n aria-label={t('Select_toggleMenu')}\n {...getToggleButtonProps()}\n type=\"button\"\n disabled={disabled}\n onMouseDown={() => {\n wasClickedRef.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n <StatusIcons status={status} hasError={hasError} dataTestId={dataTestId} />\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n align={alignMenu}\n side={side}\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItemValues={selectedItemValues}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\n onEscapeKeyDown={onEscapeKeyDown}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nComboboxBaseInput.displayName = 'Select.Combobox';\n\nexport const ComboboxBase = forwardRef<HTMLDivElement, ComboboxBaseProps>(ComboboxBaseInput);\n"],"names":["ComboboxBaseInput","children","selectedItemValues","onItemSelect","onClear","placeholder","status","disabled","dataTestId","alignMenu","side","id","viewportCollisionPadding","getAsyncItems","onEscapeKeyDown","multiple","props","forwardedRef","inputRef","useRef","inputCallbackRef","useCallback","node","t","useTranslation","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","asyncItemStatus","useSelectData","wasClickedRef","onMouseDown","onFocus","onBlur","useFocusRing","selectionDescriptionId","selectionDescription","useSelectionDescription","badgeItems","useBadgeItems","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","selectedItems","useMemo","value","item","multipleSelectionResult","useMultipleSelection","newSelectedItems","type","removedItem","removeSelectedItem","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","state","actionAndChanges","changes","hasError","handleDismissBadge","preventFocusRing","handleClear","handleBlur","blurEvent","_b","_a","jsxs","RadixPopover","jsx","styles","Fragment","CollapsibleBadges","ClearButton","ForwardedRefSelectSlot","LoadingCircle","IconCaretDown","StatusIcons","SelectMenu","ComboboxB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AAAC;AAAA,QACA,oBAAA1D;AAAA,QACA,2BAAA0C;AAAA,QACA,0BAAAhC;AAAA,QACA,iBAAAE;AAAA,QAEC,UAAAY;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACA1B,EAAkB,cAAc;AAEzB,MAAM0F,KAAeC,GAA8C3F,CAAiB;"}
1
+ {"version":3,"file":"fondue-components93.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;"}