@frontify/fondue-components 3.3.2 → 3.3.3

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.
@@ -1,90 +1,96 @@
1
- import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { IconCaretDown as G, IconCheckMark as z, IconExclamationMarkTriangle as D } from "@frontify/fondue-icons";
3
- import * as f from "@radix-ui/react-popover";
4
- import { Slot as j } from "@radix-ui/react-slot";
5
- import { useSelect as E } from "downshift";
6
- import { forwardRef as T, useRef as $ } from "react";
7
- import { ForwardedRefCombobox as A } from "./fondue-components48.js";
8
- import { ForwardedRefSelectItem as O, ForwardedRefSelectItemGroup as V } from "./fondue-components49.js";
9
- import { SelectMenu as q } from "./fondue-components50.js";
10
- import { ForwardedRefSelectSlot as H } from "./fondue-components51.js";
11
- import r from "./fondue-components52.js";
12
- import { useSelectData as J } from "./fondue-components53.js";
13
- const S = ({
14
- children: g,
15
- onSelect: m,
16
- value: h,
17
- defaultValue: I,
18
- placeholder: N = "",
19
- status: a = "neutral",
20
- disabled: n,
21
- "aria-label": b,
22
- "data-test-id": s = "fondue-select"
1
+ import { jsxs as n, jsx as o } from "react/jsx-runtime";
2
+ import { IconCaretDown as z, IconCheckMark as D, IconExclamationMarkTriangle as j } from "@frontify/fondue-icons";
3
+ import * as S from "@radix-ui/react-popover";
4
+ import { Slot as E } from "@radix-ui/react-slot";
5
+ import { useSelect as H } from "downshift";
6
+ import { forwardRef as T, useRef as $, useState as A } from "react";
7
+ import { ForwardedRefCombobox as V } from "./fondue-components48.js";
8
+ import { ForwardedRefSelectItem as q, ForwardedRefSelectItemGroup as J } from "./fondue-components49.js";
9
+ import { SelectMenu as K } from "./fondue-components50.js";
10
+ import { ForwardedRefSelectSlot as L } from "./fondue-components51.js";
11
+ import a from "./fondue-components52.js";
12
+ import { useSelectData as Q } from "./fondue-components53.js";
13
+ const g = ({
14
+ children: h,
15
+ onSelect: i,
16
+ value: I,
17
+ defaultValue: N,
18
+ placeholder: b = "",
19
+ status: s = "neutral",
20
+ disabled: m,
21
+ "aria-label": C,
22
+ "data-test-id": l = "fondue-select"
23
23
  }, d) => {
24
- const { inputSlots: w, menuSlots: R, items: x, clearButton: u, getItemByValue: p } = J(g), C = p(I), y = p(h), l = $(!1), { getToggleButtonProps: F, getMenuProps: k, getItemProps: v, reset: M, selectedItem: c, isOpen: P, highlightedIndex: B } = E({
25
- items: x,
26
- defaultSelectedItem: C,
27
- selectedItem: y,
24
+ const { inputSlots: w, menuSlots: x, items: R, clearButton: u, getItemByValue: p } = Q(h), y = p(N), F = p(I), c = $(!1), [k, f] = A(!1), { getToggleButtonProps: v, getMenuProps: M, getItemProps: P, reset: B, selectedItem: r, isOpen: G, highlightedIndex: O } = H({
25
+ items: R,
26
+ defaultSelectedItem: y,
27
+ selectedItem: F,
28
+ onIsOpenChange: () => {
29
+ f(!1);
30
+ },
31
+ onHighlightedIndexChange: () => {
32
+ f(!0);
33
+ },
28
34
  onSelectedItemChange: ({ selectedItem: e }) => {
29
- m && m(e.value);
35
+ i && i(e.value);
30
36
  },
31
37
  itemToString: (e) => e ? e.label : ""
32
38
  });
33
- return /* @__PURE__ */ i(f.Root, { open: P, children: [
39
+ return /* @__PURE__ */ n(S.Root, { open: G, children: [
34
40
  /* @__PURE__ */ o(
35
- f.Anchor,
41
+ S.Anchor,
36
42
  {
37
43
  asChild: !0,
38
44
  onMouseDown: (e) => {
39
- l.current = !0, e.currentTarget.dataset.showFocusRing = "false";
45
+ c.current = !0, e.currentTarget.dataset.showFocusRing = "false";
40
46
  },
41
47
  onFocus: (e) => {
42
- l.current || (e.target.dataset.showFocusRing = "true");
48
+ c.current || (e.target.dataset.showFocusRing = "true");
43
49
  },
44
50
  onBlur: (e) => {
45
- e.target.dataset.showFocusRing = "false", l.current = !1;
51
+ e.target.dataset.showFocusRing = "false", c.current = !1;
46
52
  },
47
- children: /* @__PURE__ */ i(
53
+ children: /* @__PURE__ */ n(
48
54
  "div",
49
55
  {
50
- className: r.root,
51
- "data-status": a,
52
- "data-disabled": n,
53
- "data-empty": !c,
54
- "data-test-id": s,
55
- ...n ? {} : F({
56
- "aria-label": b,
56
+ className: a.root,
57
+ "data-status": s,
58
+ "data-disabled": m,
59
+ "data-empty": !r,
60
+ "data-test-id": l,
61
+ ...m ? {} : v({
62
+ "aria-label": C,
57
63
  ...d ? { ref: d } : {}
58
64
  }),
59
65
  children: [
60
- /* @__PURE__ */ o("span", { className: r.input, children: c ? c.label : N }),
66
+ /* @__PURE__ */ o("span", { className: a.input, children: r ? r.label : b }),
61
67
  w,
62
68
  u && /* @__PURE__ */ o(
63
- j,
69
+ E,
64
70
  {
65
71
  onClick: (e) => {
66
- e.stopPropagation(), M();
72
+ e.stopPropagation(), B();
67
73
  },
68
- className: r.clear,
74
+ className: a.clear,
69
75
  children: u
70
76
  }
71
77
  ),
72
- /* @__PURE__ */ i("div", { className: r.icons, children: [
73
- /* @__PURE__ */ o(G, { size: 16, className: r.caret }),
74
- a === "success" ? /* @__PURE__ */ o(
75
- z,
78
+ /* @__PURE__ */ n("div", { className: a.icons, children: [
79
+ /* @__PURE__ */ o(z, { size: 16, className: a.caret }),
80
+ s === "success" ? /* @__PURE__ */ o(
81
+ D,
76
82
  {
77
83
  size: 16,
78
- className: r.iconSuccess,
79
- "data-test-id": `${s}-success-icon`
84
+ className: a.iconSuccess,
85
+ "data-test-id": `${l}-success-icon`
80
86
  }
81
87
  ) : null,
82
- a === "error" ? /* @__PURE__ */ o(
83
- D,
88
+ s === "error" ? /* @__PURE__ */ o(
89
+ j,
84
90
  {
85
91
  size: 16,
86
- className: r.iconError,
87
- "data-test-id": `${s}-error-icon`
92
+ className: a.iconError,
93
+ "data-test-id": `${l}-error-icon`
88
94
  }
89
95
  ) : null
90
96
  ] })
@@ -93,23 +99,33 @@ const S = ({
93
99
  )
94
100
  }
95
101
  ),
96
- /* @__PURE__ */ o(q, { highlightedIndex: B, getMenuProps: k, getItemProps: v, children: R })
102
+ /* @__PURE__ */ o(
103
+ K,
104
+ {
105
+ highlightedIndex: O,
106
+ getMenuProps: M,
107
+ getItemProps: P,
108
+ selectedItem: r,
109
+ hasInteractedSinceOpening: k,
110
+ children: x
111
+ }
112
+ )
97
113
  ] });
98
114
  };
99
- S.displayName = "Select";
100
- const K = T(S), t = K;
115
+ g.displayName = "Select";
116
+ const U = T(g), t = U;
101
117
  t.displayName = "Select";
102
- t.Combobox = A;
118
+ t.Combobox = V;
103
119
  t.Combobox.displayName = "Select.Combobox";
104
- t.Item = O;
120
+ t.Item = q;
105
121
  t.Item.displayName = "Select.Item";
106
- t.Group = V;
122
+ t.Group = J;
107
123
  t.Group.displayName = "Select.Group";
108
- t.Slot = H;
124
+ t.Slot = L;
109
125
  t.Slot.displayName = "Select.Slot";
110
126
  export {
111
- K as ForwardedRefSelect,
127
+ U as ForwardedRefSelect,
112
128
  t as Select,
113
- S as SelectInput
129
+ g as SelectInput
114
130
  };
115
131
  //# sourceMappingURL=fondue-components18.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components18.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useSelect } from 'downshift';\nimport { forwardRef, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefCombobox } from './Combobox';\nimport { ForwardedRefSelectItem, ForwardedRefSelectItemGroup } from './SelectItem';\nimport { SelectMenu } from './SelectMenu';\nimport { ForwardedRefSelectSlot } from './SelectSlot';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type SelectComponentProps = {\n /**\n * Children of the Select component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string) => void;\n /**\n * The active value in the select component. This is used to control the select externally.\n */\n value?: string;\n /**\n * The default value of the select component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the select 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 select component.\n */\n disabled?: boolean;\n /**\n * The aria label of the select component.\n */\n 'aria-label'?: string;\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectInput = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'fondue-select',\n }: SelectComponentProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, clearButton, getItemByValue } = useSelectData(children);\n\n const defaultItem = getItemByValue(defaultValue);\n const activeItem = getItemByValue(value);\n\n const wasClicked = useRef(false);\n\n const { getToggleButtonProps, getMenuProps, getItemProps, reset, selectedItem, isOpen, highlightedIndex } =\n useSelect({\n items,\n defaultSelectedItem: defaultItem,\n selectedItem: activeItem,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect && onSelect(selectedItem.value);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor\n asChild\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n }}\n >\n <div\n className={styles.root}\n data-status={status}\n data-disabled={disabled}\n data-empty={!selectedItem}\n data-test-id={dataTestId}\n {...(disabled\n ? {}\n : getToggleButtonProps({\n 'aria-label': ariaLabel,\n ...(forwardedRef ? { ref: forwardedRef } : {}),\n }))}\n >\n <span className={styles.input}>{selectedItem ? selectedItem.label : placeholder}</span>\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n >\n {clearButton}\n </RadixSlot>\n )}\n <div className={styles.icons}>\n <IconCaretDown size={16} className={styles.caret} />\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu highlightedIndex={highlightedIndex} getMenuProps={getMenuProps} getItemProps={getItemProps}>\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectInput.displayName = 'Select';\n\nexport const ForwardedRefSelect = forwardRef<HTMLDivElement, SelectComponentProps>(SelectInput);\n\n// @ts-expect-error We support both Select and Select.Combobox as the Root\nexport const Select: typeof SelectInput & {\n Combobox: typeof ForwardedRefCombobox;\n Item: typeof ForwardedRefSelectItem;\n Group: typeof ForwardedRefSelectItemGroup;\n Slot: typeof ForwardedRefSelectSlot;\n} = ForwardedRefSelect;\nSelect.displayName = 'Select';\nSelect.Combobox = ForwardedRefCombobox;\nSelect.Combobox.displayName = 'Select.Combobox';\nSelect.Item = ForwardedRefSelectItem;\nSelect.Item.displayName = 'Select.Item';\nSelect.Group = ForwardedRefSelectItemGroup;\nSelect.Group.displayName = 'Select.Group';\nSelect.Slot = ForwardedRefSelectSlot;\nSelect.Slot.displayName = 'Select.Slot';\n"],"names":["SelectInput","children","onSelect","value","defaultValue","placeholder","status","disabled","ariaLabel","dataTestId","forwardedRef","inputSlots","menuSlots","items","clearButton","getItemByValue","useSelectData","defaultItem","activeItem","wasClicked","useRef","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","useSelect","item","jsxs","RadixPopover","jsx","mouseEvent","focusEvent","blurEvent","styles","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefSelect","forwardRef","Select","ForwardedRefCombobox","ForwardedRefSelectItem","ForwardedRefSelectItemGroup","ForwardedRefSelectSlot"],"mappings":";;;;;;;;;;;;AAuDO,MAAMA,IAAc,CACvB;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,gBAAAC,EAAe,IAAIC,EAAcf,CAAQ,GAEtFgB,IAAcF,EAAeX,CAAY,GACzCc,IAAaH,EAAeZ,CAAK,GAEjCgB,IAAaC,EAAO,EAAK,GAEzB,EAAE,sBAAAC,GAAsB,cAAAC,GAAc,cAAAC,GAAc,OAAAC,GAAO,cAAAC,GAAc,QAAAC,GAAQ,kBAAAC,EAAiB,IACpGC,EAAU;AAAA,IACN,OAAAf;AAAA,IACA,qBAAqBI;AAAA,IACrB,cAAcC;AAAA,IACd,sBAAsB,CAAC,EAAE,cAAAO,QAAmB;AAC5B,MAAAvB,KAAAA,EAASuB,EAAa,KAAK;AAAA,IAC3C;AAAA,IACA,cAAc,CAACI,MAAUA,IAAOA,EAAK,QAAQ;AAAA,EAAA,CAChD;AAEL,SACK,gBAAAC,EAAAC,EAAa,MAAb,EAAkB,MAAML,GACrB,UAAA;AAAA,IAAA,gBAAAM;AAAA,MAACD,EAAa;AAAA,MAAb;AAAA,QACG,SAAO;AAAA,QACP,aAAa,CAACE,MAAe;AACzB,UAAAd,EAAW,UAAU,IACVc,EAAA,cAAc,QAAQ,gBAAgB;AA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AO;AAAA,oBAClB,gBAAc,GAAG3B,CAAU;AAAA,kBAAA;AAAA,gBAAA,IAE/B;AAAA,cAAA,GACR;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ;AAAA,MAAA;AAAA,IACJ;AAAA,IAEC,gBAAAuB,EAAAU,GAAA,EAAW,kBAAAf,GAAoC,cAAAL,GAA4B,cAAAC,GACvE,UACLX,GAAA;AAAA,EACJ,EAAA,CAAA;AAER;AACAZ,EAAY,cAAc;AAEb,MAAA2C,IAAqBC,EAAiD5C,CAAW,GAGjF6C,IAKTF;AACJE,EAAO,cAAc;AACrBA,EAAO,WAAWC;AAClBD,EAAO,SAAS,cAAc;AAC9BA,EAAO,OAAOE;AACdF,EAAO,KAAK,cAAc;AAC1BA,EAAO,QAAQG;AACfH,EAAO,MAAM,cAAc;AAC3BA,EAAO,OAAOI;AACdJ,EAAO,KAAK,cAAc;"}
1
+ {"version":3,"file":"fondue-components18.js","sources":["../src/components/Select/Select.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useSelect } from 'downshift';\nimport { forwardRef, useRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefCombobox } from './Combobox';\nimport { ForwardedRefSelectItem, ForwardedRefSelectItemGroup } from './SelectItem';\nimport { SelectMenu } from './SelectMenu';\nimport { ForwardedRefSelectSlot } from './SelectSlot';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type SelectComponentProps = {\n /**\n * Children of the Select component. This can contain the `Select.Slot` components for the label, decorators, clear action and menu.\n */\n children?: ReactNode;\n /**\n * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string) => void;\n /**\n * The active value in the select component. This is used to control the select externally.\n */\n value?: string;\n /**\n * The default value of the select component. Used for uncontrolled usages.\n */\n defaultValue?: string;\n /**\n * The placeholder in the select 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 select component.\n */\n disabled?: boolean;\n /**\n * The aria label of the select component.\n */\n 'aria-label'?: string;\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectInput = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'fondue-select',\n }: SelectComponentProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, clearButton, getItemByValue } = useSelectData(children);\n\n const defaultItem = getItemByValue(defaultValue);\n const activeItem = getItemByValue(value);\n\n const wasClicked = useRef(false);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const { getToggleButtonProps, getMenuProps, getItemProps, reset, selectedItem, isOpen, highlightedIndex } =\n useSelect({\n items,\n defaultSelectedItem: defaultItem,\n selectedItem: activeItem,\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect && onSelect(selectedItem.value);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n return (\n <RadixPopover.Root open={isOpen}>\n <RadixPopover.Anchor\n asChild\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={(blurEvent) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n }}\n >\n <div\n className={styles.root}\n data-status={status}\n data-disabled={disabled}\n data-empty={!selectedItem}\n data-test-id={dataTestId}\n {...(disabled\n ? {}\n : getToggleButtonProps({\n 'aria-label': ariaLabel,\n ...(forwardedRef ? { ref: forwardedRef } : {}),\n }))}\n >\n <span className={styles.input}>{selectedItem ? selectedItem.label : placeholder}</span>\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n >\n {clearButton}\n </RadixSlot>\n )}\n <div className={styles.icons}>\n <IconCaretDown size={16} className={styles.caret} />\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n highlightedIndex={highlightedIndex}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectInput.displayName = 'Select';\n\nexport const ForwardedRefSelect = forwardRef<HTMLDivElement, SelectComponentProps>(SelectInput);\n\n// @ts-expect-error We support both Select and Select.Combobox as the Root\nexport const Select: typeof SelectInput & {\n Combobox: typeof ForwardedRefCombobox;\n Item: typeof ForwardedRefSelectItem;\n Group: typeof ForwardedRefSelectItemGroup;\n Slot: typeof ForwardedRefSelectSlot;\n} = ForwardedRefSelect;\nSelect.displayName = 'Select';\nSelect.Combobox = ForwardedRefCombobox;\nSelect.Combobox.displayName = 'Select.Combobox';\nSelect.Item = ForwardedRefSelectItem;\nSelect.Item.displayName = 'Select.Item';\nSelect.Group = ForwardedRefSelectItemGroup;\nSelect.Group.displayName = 'Select.Group';\nSelect.Slot = ForwardedRefSelectSlot;\nSelect.Slot.displayName = 'Select.Slot';\n"],"names":["SelectInput","children","onSelect","value","defaultValue","placeholder","status","disabled","ariaLabel","dataTestId","forwardedRef","inputSlots","menuSlots","items","clearButton","getItemByValue","useSelectData","defaultItem","activeItem","wasClicked","useRef","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","useSelect","item","jsxs","RadixPopover","jsx","mouseEvent","focusEvent","blurEvent","styles","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefSelect","forwardRef","Select","ForwardedRefCombobox","ForwardedRefSelectItem","ForwardedRefSelectItemGroup","ForwardedRefSelectSlot"],"mappings":";;;;;;;;;;;;AAuDO,MAAMA,IAAc,CACvB;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,aAAAC,GAAa,gBAAAC,EAAe,IAAIC,EAAcf,CAAQ,GAEtFgB,IAAcF,EAAeX,CAAY,GACzCc,IAAaH,EAAeZ,CAAK,GAEjCgB,IAAaC,EAAO,EAAK,GAEzB,CAACC,GAA2BC,CAA4B,IAAIC,EAAS,EAAK,GAE1E,EAAE,sBAAAC,GAAsB,cAAAC,GAAc,cAAAC,GAAc,OAAAC,GAAO,cAAAC,GAAc,QAAAC,GAAQ,kBAAAC,EAAiB,IACpGC,EAAU;AAAA,IACN,OAAAlB;AAAA,IACA,qBAAqBI;AAAA,IACrB,cAAcC;AAAA,IACd,gBAAgB,MAAM;AAClB,MAAAI,EAA6B,EAAK;AAAA,IACtC;AAAA,IACA,0BAA0B,MAAM;AAC5B,MAAAA,EAA6B,EAAI;AAAA,IACrC;AAAA,IACA,sBAAsB,CAAC,EAAE,cAAAM,QAAmB;AAC5B,MAAA1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AA,gBAAAJ,EAACO,GAAc,EAAA,MAAM,IAAI,WAAWH,EAAO,OAAO;AAAA,gBACjDjC,MAAW,YACR,gBAAA6B;AAAA,kBAACQ;AAAA,kBAAA;AAAA,oBACG,MAAM;AAAA,oBACN,WAAWJ,EAAO;AAAA,oBAClB,gBAAc,GAAG9B,CAAU;AAAA,kBAAA;AAAA,gBAAA,IAE/B;AAAA,gBACHH,MAAW,UACR,gBAAA6B;AAAA,kBAACS;AAAA,kBAAA;AAAA,oBACG,MAAM;AAAA,oBACN,WAAWL,EAAO;AAAA,oBAClB,gBAAc,GAAG9B,CAAU;AAAA,kBAAA;AAAA,gBAAA,IAE/B;AAAA,cAAA,GACR;AAAA,YAAA;AAAA,UAAA;AAAA,QACJ;AAAA,MAAA;AAAA,IACJ;AAAA,IAEA,gBAAA0B;AAAA,MAACU;AAAA,MAAA;AAAA,QACG,kBAAAf;AAAA,QACA,cAAAL;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAP;AAAA,QAEC,UAAAT;AAAA,MAAA;AAAA,IACL;AAAA,EACJ,EAAA,CAAA;AAER;AACAZ,EAAY,cAAc;AAEb,MAAA8C,IAAqBC,EAAiD/C,CAAW,GAGjFgD,IAKTF;AACJE,EAAO,cAAc;AACrBA,EAAO,WAAWC;AAClBD,EAAO,SAAS,cAAc;AAC9BA,EAAO,OAAOE;AACdF,EAAO,KAAK,cAAc;AAC1BA,EAAO,QAAQG;AACfH,EAAO,MAAM,cAAc;AAC3BA,EAAO,OAAOI;AACdJ,EAAO,KAAK,cAAc;"}
@@ -1,7 +1,7 @@
1
1
  import { jsxs as d, jsx as a, Fragment as m } from "react/jsx-runtime";
2
2
  import { IconDroplet as n, IconTrashBin as p, IconCaretDown as f } from "@frontify/fondue-icons";
3
3
  import { forwardRef as I, useId as N } from "react";
4
- import i from "./fondue-components59.js";
4
+ import i from "./fondue-components60.js";
5
5
  import { colorToCss as h } from "./fondue-components34.js";
6
6
  const c = ({ currentColor: e, onClear: s, "data-test-id": t = "color-picker-input", ...r }, l) => {
7
7
  const o = N();
@@ -1,18 +1,18 @@
1
- const t = "_content_duup7_6", e = "_header_duup7_50", o = "_footer_duup7_51", n = "_body_duup7_52", d = "_underlay_duup7_77", _ = "_sideContent_duup7_86", u = {
2
- content: t,
3
- header: e,
4
- footer: o,
1
+ const o = "_content_hob09_6", t = "_header_hob09_50", e = "_footer_hob09_51", n = "_body_hob09_52", _ = "_underlay_hob09_77", d = "_sideContent_hob09_90", s = {
2
+ content: o,
3
+ header: t,
4
+ footer: e,
5
5
  body: n,
6
- underlay: d,
7
- sideContent: _
6
+ underlay: _,
7
+ sideContent: d
8
8
  };
9
9
  export {
10
10
  n as body,
11
- t as content,
12
- u as default,
13
- o as footer,
14
- e as header,
15
- _ as sideContent,
16
- d as underlay
11
+ o as content,
12
+ s as default,
13
+ e as footer,
14
+ t as header,
15
+ d as sideContent,
16
+ _ as underlay
17
17
  };
18
18
  //# sourceMappingURL=fondue-components36.js.map
@@ -1,20 +1,20 @@
1
- const t = "_content_ca3qa_4", n = "_subContent_ca3qa_5", o = "_item_ca3qa_15", s = "_subTrigger_ca3qa_16", c = "_subMenuIndicator_ca3qa_53", _ = "_group_ca3qa_59", a = "_slot_ca3qa_66", e = {
2
- content: t,
1
+ const o = "_content_ojnoh_4", n = "_subContent_ojnoh_5", t = "_item_ojnoh_23", s = "_subTrigger_ojnoh_24", _ = "_subMenuIndicator_ojnoh_63", e = "_group_ojnoh_69", u = "_slot_ojnoh_76", c = {
2
+ content: o,
3
3
  subContent: n,
4
- item: o,
4
+ item: t,
5
5
  subTrigger: s,
6
- subMenuIndicator: c,
7
- group: _,
8
- slot: a
6
+ subMenuIndicator: _,
7
+ group: e,
8
+ slot: u
9
9
  };
10
10
  export {
11
- t as content,
12
- e as default,
13
- _ as group,
14
- o as item,
15
- a as slot,
11
+ o as content,
12
+ c as default,
13
+ e as group,
14
+ t as item,
15
+ u as slot,
16
16
  n as subContent,
17
- c as subMenuIndicator,
17
+ _ as subMenuIndicator,
18
18
  s as subTrigger
19
19
  };
20
20
  //# sourceMappingURL=fondue-components39.js.map
@@ -1,79 +1,85 @@
1
1
  import { jsxs as u, jsx as t } from "react/jsx-runtime";
2
- import { IconCaretDown as z, IconCheckMark as j, IconExclamationMarkTriangle as H } from "@frontify/fondue-icons";
2
+ import { IconCaretDown as j, IconCheckMark as $, IconExclamationMarkTriangle as A } from "@frontify/fondue-icons";
3
3
  import * as x from "@radix-ui/react-popover";
4
- import { Slot as $ } from "@radix-ui/react-slot";
5
- import { useCombobox as A } from "downshift";
6
- import { forwardRef as E, useRef as q, useMemo as G } from "react";
7
- import { SelectMenu as J } from "./fondue-components50.js";
4
+ import { Slot as E } from "@radix-ui/react-slot";
5
+ import { useCombobox as q } from "downshift";
6
+ import { forwardRef as G, useState as J, useRef as K, useMemo as Q } from "react";
7
+ import { SelectMenu as U } from "./fondue-components50.js";
8
8
  import o from "./fondue-components52.js";
9
- import { useSelectData as K } from "./fondue-components53.js";
9
+ import { useSelectData as W } from "./fondue-components53.js";
10
10
  const w = ({
11
- children: I,
12
- onSelect: m,
11
+ children: S,
12
+ onSelect: d,
13
13
  value: N,
14
- defaultValue: S,
14
+ defaultValue: O,
15
15
  placeholder: R = "",
16
- status: a = "neutral",
17
- disabled: d,
16
+ status: n = "neutral",
17
+ disabled: m,
18
18
  "aria-label": B,
19
- "data-test-id": l = "fondue-select-combobox"
19
+ "data-test-id": s = "fondue-select-combobox"
20
20
  }, M) => {
21
- const { inputSlots: F, menuSlots: L, items: s, filterText: P, clearButton: p, getItemByValue: f, setFilterText: k } = K(I), {
22
- getInputProps: n,
23
- getToggleButtonProps: v,
24
- getMenuProps: O,
25
- getItemProps: y,
26
- reset: g,
27
- selectedItem: c,
28
- isOpen: D,
29
- highlightedIndex: T,
21
+ const { inputSlots: F, menuSlots: L, items: l, filterText: P, clearButton: p, getItemByValue: g, setFilterText: k } = W(S), [v, f] = J(!1), {
22
+ getInputProps: c,
23
+ getToggleButtonProps: y,
24
+ getMenuProps: D,
25
+ getItemProps: H,
26
+ reset: h,
27
+ selectedItem: r,
28
+ isOpen: T,
29
+ highlightedIndex: V,
30
30
  inputValue: i
31
- } = A({
32
- items: s,
33
- selectedItem: f(N),
34
- defaultSelectedItem: f(S),
31
+ } = q({
32
+ items: l,
33
+ selectedItem: g(N),
34
+ defaultSelectedItem: g(O),
35
35
  defaultHighlightedIndex: 0,
36
36
  onSelectedItemChange: ({ selectedItem: e }) => {
37
- m && m(e.value);
37
+ d && d(e.value);
38
38
  },
39
39
  onInputValueChange: ({ inputValue: e }) => {
40
40
  k(e);
41
41
  },
42
+ onIsOpenChange: () => {
43
+ f(!1);
44
+ },
45
+ onHighlightedIndexChange: () => {
46
+ f(!0);
47
+ },
42
48
  itemToString: (e) => e ? e.label : ""
43
- }), r = q(!1), h = G(
44
- () => !s.find((e) => e.label.toLowerCase().includes(i.toLowerCase())),
45
- [i, s]
46
- ), V = (e) => {
47
- var b, C;
48
- e.target.dataset.showFocusRing = "false", r.current = !1, (c == null ? void 0 : c.label.toLocaleLowerCase()) !== i.toLocaleLowerCase() && g(), n().onBlur && ((C = (b = n()).onBlur) == null || C.call(b, e));
49
+ }), a = K(!1), b = Q(
50
+ () => !l.find((e) => e.label.toLowerCase().includes(i.toLowerCase())),
51
+ [i, l]
52
+ ), z = (e) => {
53
+ var C, I;
54
+ e.target.dataset.showFocusRing = "false", a.current = !1, (r == null ? void 0 : r.label.toLocaleLowerCase()) !== i.toLocaleLowerCase() && h(), c().onBlur && ((I = (C = c()).onBlur) == null || I.call(C, e));
49
55
  };
50
- return /* @__PURE__ */ u(x.Root, { open: D, children: [
51
- /* @__PURE__ */ t(x.Anchor, { asChild: !0, children: /* @__PURE__ */ u("div", { ref: M, className: o.root, "data-status": h ? "error" : a, children: [
56
+ return /* @__PURE__ */ u(x.Root, { open: T, children: [
57
+ /* @__PURE__ */ t(x.Anchor, { asChild: !0, children: /* @__PURE__ */ u("div", { ref: M, className: o.root, "data-status": b ? "error" : n, children: [
52
58
  /* @__PURE__ */ t(
53
59
  "input",
54
60
  {
55
- ...n({
61
+ ...c({
56
62
  "aria-label": B
57
63
  }),
58
- "data-test-id": l,
64
+ "data-test-id": s,
59
65
  placeholder: R,
60
66
  className: o.input,
61
- disabled: d,
67
+ disabled: m,
62
68
  onMouseDown: (e) => {
63
- r.current = !0, e.currentTarget.dataset.showFocusRing = "false";
69
+ a.current = !0, e.currentTarget.dataset.showFocusRing = "false";
64
70
  },
65
71
  onFocus: (e) => {
66
- r.current || (e.target.dataset.showFocusRing = "true");
72
+ a.current || (e.target.dataset.showFocusRing = "true");
67
73
  },
68
- onBlur: V
74
+ onBlur: z
69
75
  }
70
76
  ),
71
77
  F,
72
78
  p && /* @__PURE__ */ t(
73
- $,
79
+ E,
74
80
  {
75
81
  onClick: (e) => {
76
- e.stopPropagation(), g();
82
+ e.stopPropagation(), h();
77
83
  },
78
84
  className: o.clear,
79
85
  role: "button",
@@ -84,50 +90,52 @@ const w = ({
84
90
  /* @__PURE__ */ t(
85
91
  "button",
86
92
  {
87
- ...v(),
93
+ ...y(),
88
94
  type: "button",
89
95
  "aria-label": "toggle menu",
90
- disabled: d,
96
+ disabled: m,
91
97
  onMouseDown: () => {
92
- r.current = !0;
98
+ a.current = !0;
93
99
  },
94
- children: /* @__PURE__ */ t(z, { size: 16, className: o.caret })
100
+ children: /* @__PURE__ */ t(j, { size: 16, className: o.caret })
95
101
  }
96
102
  ),
97
- a === "success" ? /* @__PURE__ */ t(
98
- j,
103
+ n === "success" ? /* @__PURE__ */ t(
104
+ $,
99
105
  {
100
106
  size: 16,
101
107
  className: o.iconSuccess,
102
- "data-test-id": `${l}-success-icon`
108
+ "data-test-id": `${s}-success-icon`
103
109
  }
104
110
  ) : null,
105
- h || a === "error" ? /* @__PURE__ */ t(
106
- H,
111
+ b || n === "error" ? /* @__PURE__ */ t(
112
+ A,
107
113
  {
108
114
  size: 16,
109
115
  className: o.iconError,
110
- "data-test-id": `${l}-error-icon`
116
+ "data-test-id": `${s}-error-icon`
111
117
  }
112
118
  ) : null
113
119
  ] })
114
120
  ] }) }),
115
121
  /* @__PURE__ */ t(
116
- J,
122
+ U,
117
123
  {
118
- highlightedIndex: T,
124
+ highlightedIndex: V,
119
125
  filterText: P,
120
- getMenuProps: O,
121
- getItemProps: y,
126
+ getMenuProps: D,
127
+ getItemProps: H,
128
+ selectedItem: r,
129
+ hasInteractedSinceOpening: v,
122
130
  children: L
123
131
  }
124
132
  )
125
133
  ] });
126
134
  };
127
135
  w.displayName = "Select.Combobox";
128
- const oe = E(w);
136
+ const ne = G(w);
129
137
  export {
130
- oe as ForwardedRefCombobox,
138
+ ne as ForwardedRefCombobox,
131
139
  w as SelectCombobox
132
140
  };
133
141
  //# sourceMappingURL=fondue-components48.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components48.js","sources":["../src/components/Select/Combobox.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useCombobox } from 'downshift';\nimport { type FocusEvent, forwardRef, useMemo, useRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport { SelectMenu } from './SelectMenu';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type ComboboxProps = {\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 * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string;\n /**\n * The default value of the combobox component. Used for uncontrolled usages.\n */\n defaultValue?: string;\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 aria label of the combobox component.\n */\n 'aria-label'?: string;\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n }: ComboboxProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText } =\n useSelectData(children);\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox({\n items,\n selectedItem: getItemByValue(value),\n defaultSelectedItem: getItemByValue(defaultValue),\n defaultHighlightedIndex: 0,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect && onSelect(selectedItem.value);\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const wasClicked = useRef(false);\n\n const valueInvalid = useMemo(\n () => !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase())),\n [inputValue, items],\n );\n\n const onBlurHandler = (blurEvent: FocusEvent<HTMLInputElement, Element>) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n\n const selectedItemNullOrOutdated = selectedItem?.label.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (selectedItemNullOrOutdated) {\n // if there is no selection or\n // the existing selected value is not the same as the input value (old),\n // reset the input\n reset();\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 ref={forwardedRef} className={styles.root} data-status={valueInvalid ? 'error' : status}>\n <input\n {...getInputProps({\n 'aria-label': ariaLabel,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={onBlurHandler}\n />\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n role=\"button\"\n >\n {clearButton}\n </RadixSlot>\n )}\n <div className={styles.icons}>\n <button\n {...getToggleButtonProps()}\n type=\"button\"\n aria-label=\"toggle menu\"\n disabled={disabled}\n onMouseDown={() => {\n wasClicked.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {valueInvalid || status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectCombobox.displayName = 'Select.Combobox';\n\nexport const ForwardedRefCombobox = forwardRef<HTMLDivElement, ComboboxProps>(SelectCombobox);\n"],"names":["SelectCombobox","children","onSelect","value","defaultValue","placeholder","status","disabled","ariaLabel","dataTestId","forwardedRef","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","useSelectData","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","item","wasClicked","useRef","valueInvalid","useMemo","onBlurHandler","blurEvent","_b","_a","jsxs","RadixPopover","jsx","styles","mouseEvent","focusEvent","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefCombobox","forwardRef"],"mappings":";;;;;;;;;AAoDO,MAAMA,IAAiB,CAC1B;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,YAAAC,GAAY,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,EAAA,IAC3EC,EAAcjB,CAAQ,GAEpB;AAAA,IACF,eAAAkB;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,kBAAAC;AAAA,IACA,YAAAC;AAAA,MACAC,EAAY;AAAA,IACZ,OAAAf;AAAA,IACA,cAAcG,EAAeb,CAAK;AAAA,IAClC,qBAAqBa,EAAeZ,CAAY;AAAA,IAChD,yBAAyB;AAAA,IACzB,sBAAsB,CAAC,EAAE,cAAAoB,QAAmB;AAC5B,MAAAtB,KAAAA,EAASsB,EAAa,KAAK;AAAA,IAC3C;AAAA,IACA,oBAAoB,CAAC,EAAE,YAAAG,QAAiB;AACpC,MAAAV,EAAcU,CAAU;AAAA,IAC5B;AAAA,IACA,cAAc,CAACE,MAAUA,IAAOA,EAAK,QAAQ;AAAA,EAAA,CAChD,GAEKC,IAAaC,EAAO,EAAK,GAEzBC,IAAeC;AAAA,IACjB,MAAM,CAACpB,EAAM,KAAK,CAACgB,MAASA,EAAK,MAAM,YAAc,EAAA,SAASF,EAAW,YAAa,CAAA,CAAC;AAAA,IACvF,CAACA,GAAYd,CAAK;AAAA,EAAA,GAGhBqB,IAAgB,CAACC,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,EAAqB;AAAA,YACzB,MAAK;AAAA,YACL,cAAW;AAAA,YACX,UAAAb;AAAA,YACA,aAAa,MAAM;AACf,cAAAuB,EAAW,UAAU;AAAA,YACzB;AAAA,YAEA,4BAACgB,GAAc,EAAA,MAAM,IAAI,WAAWL,EAAO,OAAO;AAAA,UAAA;AAAA,QACtD;AAAA,QACCnC,MAAW,YACR,gBAAAkC;AAAA,UAACO;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWN,EAAO;AAAA,YAClB,gBAAc,GAAGhC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,QACHuB,KAAgB1B,MAAW,UACxB,gBAAAkC;AAAA,UAACQ;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWP,EAAO;AAAA,YAClB,gBAAc,GAAGhC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,MAAA,GACR;AAAA,IAAA,EAAA,CACJ,EACJ,CAAA;AAAA,IAEA,gBAAA+B;AAAA,MAACS;AAAA,MAAA;AAAA,QACG,kBAAAvB;AAAA,QACA,YAAAZ;AAAA,QACA,cAAAO;AAAA,QACA,cAAAC;AAAA,QAEC,UAAAV;AAAA,MAAA;AAAA,IACL;AAAA,EACJ,EAAA,CAAA;AAER;AACAZ,EAAe,cAAc;AAEhB,MAAAkD,KAAuBC,EAA0CnD,CAAc;"}
1
+ {"version":3,"file":"fondue-components48.js","sources":["../src/components/Select/Combobox.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCaretDown, IconCheckMark, IconExclamationMarkTriangle } from '@frontify/fondue-icons';\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { useCombobox } from 'downshift';\nimport { forwardRef, useMemo, useRef, useState, type FocusEvent, type ForwardedRef, type ReactNode } from 'react';\n\nimport { SelectMenu } from './SelectMenu';\nimport styles from './styles/select.module.scss';\nimport { useSelectData } from './useSelectData';\n\nexport type ComboboxProps = {\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 * Callback function that is called when an item is selected.\n */\n onSelect?: (selectedValue: string) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string;\n /**\n * The default value of the combobox component. Used for uncontrolled usages.\n */\n defaultValue?: string;\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 aria label of the combobox component.\n */\n 'aria-label'?: string;\n /**\n * The data test id of the select component.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'aria-label': ariaLabel,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n }: ComboboxProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const { inputSlots, menuSlots, items, filterText, clearButton, getItemByValue, setFilterText } =\n useSelectData(children);\n\n const [hasInteractedSinceOpening, setHasInteractedSinceOpening] = useState(false);\n\n const {\n getInputProps,\n getToggleButtonProps,\n getMenuProps,\n getItemProps,\n reset,\n selectedItem,\n isOpen,\n highlightedIndex,\n inputValue,\n } = useCombobox({\n items,\n selectedItem: getItemByValue(value),\n defaultSelectedItem: getItemByValue(defaultValue),\n defaultHighlightedIndex: 0,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect && onSelect(selectedItem.value);\n },\n onInputValueChange: ({ inputValue }) => {\n setFilterText(inputValue);\n },\n onIsOpenChange: () => {\n setHasInteractedSinceOpening(false);\n },\n onHighlightedIndexChange: () => {\n setHasInteractedSinceOpening(true);\n },\n itemToString: (item) => (item ? item.label : ''),\n });\n\n const wasClicked = useRef(false);\n\n const valueInvalid = useMemo(\n () => !items.find((item) => item.label.toLowerCase().includes(inputValue.toLowerCase())),\n [inputValue, items],\n );\n\n const onBlurHandler = (blurEvent: FocusEvent<HTMLInputElement, Element>) => {\n blurEvent.target.dataset.showFocusRing = 'false';\n wasClicked.current = false;\n\n const selectedItemNullOrOutdated = selectedItem?.label.toLocaleLowerCase() !== inputValue.toLocaleLowerCase();\n\n if (selectedItemNullOrOutdated) {\n // if there is no selection or\n // the existing selected value is not the same as the input value (old),\n // reset the input\n reset();\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 ref={forwardedRef} className={styles.root} data-status={valueInvalid ? 'error' : status}>\n <input\n {...getInputProps({\n 'aria-label': ariaLabel,\n })}\n data-test-id={dataTestId}\n placeholder={placeholder}\n className={styles.input}\n disabled={disabled}\n onMouseDown={(mouseEvent) => {\n wasClicked.current = true;\n mouseEvent.currentTarget.dataset.showFocusRing = 'false';\n }}\n onFocus={(focusEvent) => {\n if (!wasClicked.current) {\n focusEvent.target.dataset.showFocusRing = 'true';\n }\n }}\n onBlur={onBlurHandler}\n />\n {inputSlots}\n {clearButton && (\n <RadixSlot\n onClick={(event) => {\n event.stopPropagation();\n reset();\n }}\n className={styles.clear}\n role=\"button\"\n >\n {clearButton}\n </RadixSlot>\n )}\n <div className={styles.icons}>\n <button\n {...getToggleButtonProps()}\n type=\"button\"\n aria-label=\"toggle menu\"\n disabled={disabled}\n onMouseDown={() => {\n wasClicked.current = true;\n }}\n >\n <IconCaretDown size={16} className={styles.caret} />\n </button>\n {status === 'success' ? (\n <IconCheckMark\n size={16}\n className={styles.iconSuccess}\n data-test-id={`${dataTestId}-success-icon`}\n />\n ) : null}\n {valueInvalid || status === 'error' ? (\n <IconExclamationMarkTriangle\n size={16}\n className={styles.iconError}\n data-test-id={`${dataTestId}-error-icon`}\n />\n ) : null}\n </div>\n </div>\n </RadixPopover.Anchor>\n\n <SelectMenu\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n >\n {menuSlots}\n </SelectMenu>\n </RadixPopover.Root>\n );\n};\nSelectCombobox.displayName = 'Select.Combobox';\n\nexport const ForwardedRefCombobox = forwardRef<HTMLDivElement, ComboboxProps>(SelectCombobox);\n"],"names":["SelectCombobox","children","onSelect","value","defaultValue","placeholder","status","disabled","ariaLabel","dataTestId","forwardedRef","inputSlots","menuSlots","items","filterText","clearButton","getItemByValue","setFilterText","useSelectData","hasInteractedSinceOpening","setHasInteractedSinceOpening","useState","getInputProps","getToggleButtonProps","getMenuProps","getItemProps","reset","selectedItem","isOpen","highlightedIndex","inputValue","useCombobox","item","wasClicked","useRef","valueInvalid","useMemo","onBlurHandler","blurEvent","_b","_a","jsxs","RadixPopover","jsx","styles","mouseEvent","focusEvent","RadixSlot","event","IconCaretDown","IconCheckMark","IconExclamationMarkTriangle","SelectMenu","ForwardedRefCombobox","forwardRef"],"mappings":";;;;;;;;;AAoDO,MAAMA,IAAiB,CAC1B;AAAA,EACI,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,aAAAC,IAAc;AAAA,EACd,QAAAC,IAAS;AAAA,EACT,UAAAC;AAAA,EACA,cAAcC;AAAA,EACd,gBAAgBC,IAAa;AACjC,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,YAAAC,GAAY,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,EAAA,IAC3EC,EAAcjB,CAAQ,GAEpB,CAACkB,GAA2BC,CAA4B,IAAIC,EAAS,EAAK,GAE1E;AAAA,IACF,eAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAAAC;AAAA,IACA,OAAAC;AAAA,IACA,cAAAC;AAAA,IACA,QAAAC;AAAA,IACA,kBAAAC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A,YAClB,gBAAc,GAAGnC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,MAAA,GACR;AAAA,IAAA,EAAA,CACJ,EACJ,CAAA;AAAA,IAEA,gBAAAkC;AAAA,MAACS;AAAA,MAAA;AAAA,QACG,kBAAAvB;AAAA,QACA,YAAAf;AAAA,QACA,cAAAU;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAR;AAAA,QAEC,UAAAP;AAAA,MAAA;AAAA,IACL;AAAA,EACJ,EAAA,CAAA;AAER;AACAZ,EAAe,cAAc;AAEhB,MAAAqD,KAAuBC,EAA0CtD,CAAc;"}
@@ -1,15 +1,19 @@
1
- import { jsx as d } from "react/jsx-runtime";
2
- import { forwardRef as o } from "react";
1
+ import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
+ import { IconCheckMark as l } from "@frontify/fondue-icons";
3
+ import { forwardRef as a } from "react";
3
4
  import c from "./fondue-components52.js";
4
- const a = ({ "data-test-id": t = "fondue-select-item", ...e }, r) => /* @__PURE__ */ d("li", { "data-test-id": t, ref: r, ...e, children: e.children });
5
- a.displayName = "Select.Item";
6
- const n = o(a), m = ({ children: t, groupId: e, "data-test-id": r = "fondue-select-item-group" }, s) => /* @__PURE__ */ d("div", { "data-test-id": r, className: c.group, ref: s, children: t }, e);
5
+ const d = ({ "data-test-id": t = "fondue-select-item", ...e }, r) => /* @__PURE__ */ i("li", { "data-test-id": t, ref: r, ...e, children: [
6
+ e.children,
7
+ /* @__PURE__ */ o(l, { className: c.checkmarkIcon })
8
+ ] });
9
+ d.displayName = "Select.Item";
10
+ const I = a(d), m = ({ children: t, groupId: e, "data-test-id": r = "fondue-select-item-group" }, s) => /* @__PURE__ */ o("div", { "data-test-id": r, className: c.group, ref: s, children: t }, e);
7
11
  m.displayName = "Select.Group";
8
- const p = o(m);
12
+ const S = a(m);
9
13
  export {
10
- n as ForwardedRefSelectItem,
11
- p as ForwardedRefSelectItemGroup,
12
- a as SelectItem,
14
+ I as ForwardedRefSelectItem,
15
+ S as ForwardedRefSelectItemGroup,
16
+ d as SelectItem,
13
17
  m as SelectItemGroup
14
18
  };
15
19
  //# sourceMappingURL=fondue-components49.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"fondue-components49.js","sources":["../src/components/Select/SelectItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectItemProps = {\n /**\n * The value of the select item.\n */\n value: string;\n /**\n * The data test id of the select item.\n */\n 'data-test-id'?: string;\n} & (\n | {\n /**\n * The label of the select item. Required when the child is not a string.\n */\n label: string;\n /**\n * The children of the select item. This can be a custom component or a string.\n */\n children?: ReactNode;\n }\n | {\n label?: string;\n children: string;\n }\n);\n\nexport const SelectItem = (\n { 'data-test-id': dataTestId = 'fondue-select-item', ...props }: SelectItemProps,\n forwardedRef?: ForwardedRef<HTMLLIElement>,\n) => {\n return (\n <li data-test-id={dataTestId} ref={forwardedRef} {...props}>\n {props.children}\n </li>\n );\n};\nSelectItem.displayName = 'Select.Item';\n\nexport const ForwardedRefSelectItem = forwardRef<HTMLLIElement, SelectItemProps>(SelectItem);\n\nexport type SelectItemGroupProps = {\n /**\n * The children of the select item group. This can contain multiple `Select.Item` components.\n */\n children: ReactNode;\n /**\n * The internal group ID of the select item group.\n */\n groupId: string;\n /**\n * The data test id of the select item group.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectItemGroup = (\n { children, groupId, 'data-test-id': dataTestId = 'fondue-select-item-group' }: SelectItemGroupProps,\n forwardedRef?: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} className={styles.group} ref={forwardedRef} key={groupId}>\n {children}\n </div>\n );\n};\nSelectItemGroup.displayName = 'Select.Group';\n\nexport const ForwardedRefSelectItemGroup = forwardRef<HTMLDivElement, SelectItemGroupProps>(SelectItemGroup);\n"],"names":["SelectItem","dataTestId","props","forwardedRef","jsx","ForwardedRefSelectItem","forwardRef","SelectItemGroup","children","groupId","styles","ForwardedRefSelectItemGroup"],"mappings":";;;AAgCa,MAAAA,IAAa,CACtB,EAAE,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAM,GAC9DC,MAGI,gBAAAC,EAAC,QAAG,gBAAcH,GAAY,KAAKE,GAAe,GAAGD,GAChD,UAAAA,EAAM,SACX,CAAA;AAGRF,EAAW,cAAc;AAEZ,MAAAK,IAAyBC,EAA2CN,CAAU,GAiB9EO,IAAkB,CAC3B,EAAE,UAAAC,GAAU,SAAAC,GAAS,gBAAgBR,IAAa,2BAA2B,GAC7EE,MAGI,gBAAAC,EAAC,OAAI,EAAA,gBAAcH,GAAY,WAAWS,EAAO,OAAO,KAAKP,GACxD,UAAAK,EAAA,GAD2EC,CAEhF;AAGRF,EAAgB,cAAc;AAEjB,MAAAI,IAA8BL,EAAiDC,CAAe;"}
1
+ {"version":3,"file":"fondue-components49.js","sources":["../src/components/Select/SelectItem.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { IconCheckMark } from '@frontify/fondue-icons';\nimport { forwardRef, type ForwardedRef, type ReactNode } from 'react';\n\nimport styles from './styles/select.module.scss';\n\nexport type SelectItemProps = {\n /**\n * The value of the select item.\n */\n value: string;\n /**\n * The data test id of the select item.\n */\n 'data-test-id'?: string;\n} & (\n | {\n /**\n * The label of the select item. Required when the child is not a string.\n */\n label: string;\n /**\n * The children of the select item. This can be a custom component or a string.\n */\n children?: ReactNode;\n }\n | {\n label?: string;\n children: string;\n }\n);\n\nexport const SelectItem = (\n { 'data-test-id': dataTestId = 'fondue-select-item', ...props }: SelectItemProps,\n forwardedRef?: ForwardedRef<HTMLLIElement>,\n) => {\n return (\n <li data-test-id={dataTestId} ref={forwardedRef} {...props}>\n {props.children}\n <IconCheckMark className={styles.checkmarkIcon} />\n </li>\n );\n};\nSelectItem.displayName = 'Select.Item';\n\nexport const ForwardedRefSelectItem = forwardRef<HTMLLIElement, SelectItemProps>(SelectItem);\n\nexport type SelectItemGroupProps = {\n /**\n * The children of the select item group. This can contain multiple `Select.Item` components.\n */\n children: ReactNode;\n /**\n * The internal group ID of the select item group.\n */\n groupId: string;\n /**\n * The data test id of the select item group.\n */\n 'data-test-id'?: string;\n};\n\nexport const SelectItemGroup = (\n { children, groupId, 'data-test-id': dataTestId = 'fondue-select-item-group' }: SelectItemGroupProps,\n forwardedRef?: ForwardedRef<HTMLDivElement>,\n) => {\n return (\n <div data-test-id={dataTestId} className={styles.group} ref={forwardedRef} key={groupId}>\n {children}\n </div>\n );\n};\nSelectItemGroup.displayName = 'Select.Group';\n\nexport const ForwardedRefSelectItemGroup = forwardRef<HTMLDivElement, SelectItemGroupProps>(SelectItemGroup);\n"],"names":["SelectItem","dataTestId","props","forwardedRef","jsx","IconCheckMark","styles","ForwardedRefSelectItem","forwardRef","SelectItemGroup","children","groupId","ForwardedRefSelectItemGroup"],"mappings":";;;;AAiCa,MAAAA,IAAa,CACtB,EAAE,gBAAgBC,IAAa,sBAAsB,GAAGC,EAAM,GAC9DC,wBAGK,MAAG,EAAA,gBAAcF,GAAY,KAAKE,GAAe,GAAGD,GAChD,UAAA;AAAA,EAAMA,EAAA;AAAA,EACN,gBAAAE,EAAAC,GAAA,EAAc,WAAWC,EAAO,cAAe,CAAA;AACpD,EAAA,CAAA;AAGRN,EAAW,cAAc;AAEZ,MAAAO,IAAyBC,EAA2CR,CAAU,GAiB9ES,IAAkB,CAC3B,EAAE,UAAAC,GAAU,SAAAC,GAAS,gBAAgBV,IAAa,2BAA2B,GAC7EE,MAGI,gBAAAC,EAAC,OAAI,EAAA,gBAAcH,GAAY,WAAWK,EAAO,OAAO,KAAKH,GACxD,UAAAO,EAAA,GAD2EC,CAEhF;AAGRF,EAAgB,cAAc;AAEjB,MAAAG,IAA8BJ,EAAiDC,CAAe;"}