@frontify/fondue-components 3.3.6 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fondue-components11.js +29 -29
- package/dist/fondue-components11.js.map +1 -1
- package/dist/fondue-components18.js +38 -36
- package/dist/fondue-components18.js.map +1 -1
- package/dist/fondue-components22.js +12 -12
- package/dist/fondue-components22.js.map +1 -1
- package/dist/fondue-components26.js +1 -1
- package/dist/fondue-components29.js +1 -1
- package/dist/fondue-components31.js +15 -15
- package/dist/fondue-components31.js.map +1 -1
- package/dist/fondue-components36.js +13 -13
- package/dist/fondue-components39.js +14 -12
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components44.js +4 -4
- package/dist/fondue-components47.js +10 -10
- package/dist/fondue-components48.js +42 -40
- package/dist/fondue-components48.js.map +1 -1
- package/dist/fondue-components49.js +7 -7
- package/dist/fondue-components49.js.map +1 -1
- package/dist/fondue-components50.js +57 -47
- package/dist/fondue-components50.js.map +1 -1
- package/dist/fondue-components52.js +28 -24
- package/dist/fondue-components52.js.map +1 -1
- package/dist/fondue-components54.js +8 -8
- package/dist/fondue-components56.js +9 -9
- package/dist/fondue-components58.js +2 -11
- package/dist/fondue-components58.js.map +1 -1
- package/dist/fondue-components59.js +11 -2
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components7.js +92 -67
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components9.js +25 -25
- package/dist/fondue-components9.js.map +1 -1
- package/dist/index.d.ts +42 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const o = "
|
|
1
|
+
const o = "_root_1qzyp_3", r = "_viewport_1qzyp_10", t = "_scrollbar_1qzyp_16", _ = "_thumb_1qzyp_42", c = "_corner_1qzyp_61", s = {
|
|
2
2
|
root: o,
|
|
3
3
|
viewport: r,
|
|
4
4
|
scrollbar: t,
|
|
5
5
|
thumb: _,
|
|
6
|
-
corner:
|
|
6
|
+
corner: c
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
c as corner,
|
|
10
|
+
s as default,
|
|
11
11
|
o as root,
|
|
12
12
|
t as scrollbar,
|
|
13
13
|
_ as thumb,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_root_1ioi3_5", i = "_item_1ioi3_26", e = "_itemLabel_1ioi3_46", o = "_itemLabelActive_1ioi3_65", a = "_itemLabelInactive_1ioi3_88", _ = "_activeIndicator_1ioi3_112", c = "_separator_1ioi3_203", n = {
|
|
2
2
|
root: t,
|
|
3
|
-
item:
|
|
4
|
-
itemLabel:
|
|
5
|
-
itemLabelActive:
|
|
6
|
-
itemLabelInactive:
|
|
3
|
+
item: i,
|
|
4
|
+
itemLabel: e,
|
|
5
|
+
itemLabelActive: o,
|
|
6
|
+
itemLabelInactive: a,
|
|
7
7
|
activeIndicator: _,
|
|
8
8
|
separator: c
|
|
9
9
|
};
|
|
10
10
|
export {
|
|
11
11
|
_ as activeIndicator,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
n as default,
|
|
13
|
+
i as item,
|
|
14
|
+
e as itemLabel,
|
|
15
|
+
o as itemLabelActive,
|
|
16
|
+
a as itemLabelInactive,
|
|
17
17
|
t as root,
|
|
18
18
|
c as separator
|
|
19
19
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as u, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { IconCaretDown as
|
|
2
|
+
import { IconCaretDown as $, IconCheckMark as A, IconExclamationMarkTriangle as E } from "@frontify/fondue-icons";
|
|
3
3
|
import * as x from "@radix-ui/react-popover";
|
|
4
|
-
import { Slot as
|
|
5
|
-
import { useCombobox as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { SelectMenu as
|
|
4
|
+
import { Slot as q } from "@radix-ui/react-slot";
|
|
5
|
+
import { useCombobox as G } from "downshift";
|
|
6
|
+
import { forwardRef as J, useState as K, useRef as Q, useMemo as U } from "react";
|
|
7
|
+
import { SelectMenu as W } from "./fondue-components50.js";
|
|
8
8
|
import o from "./fondue-components52.js";
|
|
9
|
-
import { useSelectData as
|
|
9
|
+
import { useSelectData as X } from "./fondue-components53.js";
|
|
10
10
|
const w = ({
|
|
11
11
|
children: S,
|
|
12
12
|
onSelect: d,
|
|
@@ -16,28 +16,29 @@ const w = ({
|
|
|
16
16
|
status: n = "neutral",
|
|
17
17
|
disabled: m,
|
|
18
18
|
"aria-label": B,
|
|
19
|
-
"data-test-id": s = "fondue-select-combobox"
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
"data-test-id": s = "fondue-select-combobox",
|
|
20
|
+
alignMenu: M = "start"
|
|
21
|
+
}, F) => {
|
|
22
|
+
const { inputSlots: L, menuSlots: P, items: l, filterText: k, clearButton: g, getItemByValue: p, setFilterText: v } = X(S), [y, f] = K(!1), {
|
|
22
23
|
getInputProps: c,
|
|
23
|
-
getToggleButtonProps:
|
|
24
|
-
getMenuProps:
|
|
25
|
-
getItemProps:
|
|
24
|
+
getToggleButtonProps: D,
|
|
25
|
+
getMenuProps: H,
|
|
26
|
+
getItemProps: T,
|
|
26
27
|
reset: h,
|
|
27
28
|
selectedItem: r,
|
|
28
|
-
isOpen:
|
|
29
|
-
highlightedIndex:
|
|
29
|
+
isOpen: V,
|
|
30
|
+
highlightedIndex: z,
|
|
30
31
|
inputValue: i
|
|
31
|
-
} =
|
|
32
|
+
} = G({
|
|
32
33
|
items: l,
|
|
33
|
-
selectedItem:
|
|
34
|
-
defaultSelectedItem:
|
|
34
|
+
selectedItem: p(N),
|
|
35
|
+
defaultSelectedItem: p(O),
|
|
35
36
|
defaultHighlightedIndex: 0,
|
|
36
37
|
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
37
38
|
d && d(e.value);
|
|
38
39
|
},
|
|
39
40
|
onInputValueChange: ({ inputValue: e }) => {
|
|
40
|
-
|
|
41
|
+
v(e);
|
|
41
42
|
},
|
|
42
43
|
onIsOpenChange: () => {
|
|
43
44
|
f(!1);
|
|
@@ -46,15 +47,15 @@ const w = ({
|
|
|
46
47
|
f(!0);
|
|
47
48
|
},
|
|
48
49
|
itemToString: (e) => e ? e.label : ""
|
|
49
|
-
}), a =
|
|
50
|
+
}), a = Q(!1), b = U(
|
|
50
51
|
() => !l.find((e) => e.label.toLowerCase().includes(i.toLowerCase())),
|
|
51
52
|
[i, l]
|
|
52
|
-
),
|
|
53
|
+
), j = (e) => {
|
|
53
54
|
var C, I;
|
|
54
55
|
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));
|
|
55
56
|
};
|
|
56
|
-
return /* @__PURE__ */ u(x.Root, { open:
|
|
57
|
-
/* @__PURE__ */ t(x.Anchor, { asChild: !0, children: /* @__PURE__ */ u("div", { ref:
|
|
57
|
+
return /* @__PURE__ */ u(x.Root, { open: V, children: [
|
|
58
|
+
/* @__PURE__ */ t(x.Anchor, { asChild: !0, children: /* @__PURE__ */ u("div", { ref: F, className: o.root, "data-status": b ? "error" : n, children: [
|
|
58
59
|
/* @__PURE__ */ t(
|
|
59
60
|
"input",
|
|
60
61
|
{
|
|
@@ -71,37 +72,37 @@ const w = ({
|
|
|
71
72
|
onFocus: (e) => {
|
|
72
73
|
a.current || (e.target.dataset.showFocusRing = "true");
|
|
73
74
|
},
|
|
74
|
-
onBlur:
|
|
75
|
+
onBlur: j
|
|
75
76
|
}
|
|
76
77
|
),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
L,
|
|
79
|
+
g && /* @__PURE__ */ t(
|
|
80
|
+
q,
|
|
80
81
|
{
|
|
81
82
|
onClick: (e) => {
|
|
82
83
|
e.stopPropagation(), h();
|
|
83
84
|
},
|
|
84
85
|
className: o.clear,
|
|
85
86
|
role: "button",
|
|
86
|
-
children:
|
|
87
|
+
children: g
|
|
87
88
|
}
|
|
88
89
|
),
|
|
89
90
|
/* @__PURE__ */ u("div", { className: o.icons, children: [
|
|
90
91
|
/* @__PURE__ */ t(
|
|
91
92
|
"button",
|
|
92
93
|
{
|
|
93
|
-
...
|
|
94
|
+
...D(),
|
|
94
95
|
type: "button",
|
|
95
96
|
"aria-label": "toggle menu",
|
|
96
97
|
disabled: m,
|
|
97
98
|
onMouseDown: () => {
|
|
98
99
|
a.current = !0;
|
|
99
100
|
},
|
|
100
|
-
children: /* @__PURE__ */ t(
|
|
101
|
+
children: /* @__PURE__ */ t($, { size: 16, className: o.caret })
|
|
101
102
|
}
|
|
102
103
|
),
|
|
103
104
|
n === "success" ? /* @__PURE__ */ t(
|
|
104
|
-
|
|
105
|
+
A,
|
|
105
106
|
{
|
|
106
107
|
size: 16,
|
|
107
108
|
className: o.iconSuccess,
|
|
@@ -109,7 +110,7 @@ const w = ({
|
|
|
109
110
|
}
|
|
110
111
|
) : null,
|
|
111
112
|
b || n === "error" ? /* @__PURE__ */ t(
|
|
112
|
-
|
|
113
|
+
E,
|
|
113
114
|
{
|
|
114
115
|
size: 16,
|
|
115
116
|
className: o.iconError,
|
|
@@ -119,23 +120,24 @@ const w = ({
|
|
|
119
120
|
] })
|
|
120
121
|
] }) }),
|
|
121
122
|
/* @__PURE__ */ t(
|
|
122
|
-
|
|
123
|
+
W,
|
|
123
124
|
{
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
align: M,
|
|
126
|
+
highlightedIndex: z,
|
|
127
|
+
filterText: k,
|
|
128
|
+
getMenuProps: H,
|
|
129
|
+
getItemProps: T,
|
|
128
130
|
selectedItem: r,
|
|
129
|
-
hasInteractedSinceOpening:
|
|
130
|
-
children:
|
|
131
|
+
hasInteractedSinceOpening: y,
|
|
132
|
+
children: P
|
|
131
133
|
}
|
|
132
134
|
)
|
|
133
135
|
] });
|
|
134
136
|
};
|
|
135
137
|
w.displayName = "Select.Combobox";
|
|
136
|
-
const
|
|
138
|
+
const se = J(w);
|
|
137
139
|
export {
|
|
138
|
-
|
|
140
|
+
se as ForwardedRefCombobox,
|
|
139
141
|
w as SelectCombobox
|
|
140
142
|
};
|
|
141
143
|
//# 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 { 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","IconC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AAA,QAAA;AAAA,MACL;AAAA,MAEH,gBAAA0B,EAAA,OAAA,EAAI,WAAWG,EAAO,OACnB,UAAA;AAAA,QAAA,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YACI,GAAGpB,EAAqB;AAAA,YACzB,MAAK;AAAA,YACL,cAAW;AAAA,YACX,UAAAhB;AAAA,YACA,aAAa,MAAM;AACf,cAAA0B,EAAW,UAAU;AAAA,YACzB;AAAA,YAEA,4BAACgB,GAAc,EAAA,MAAM,IAAI,WAAWL,EAAO,OAAO;AAAA,UAAA;AAAA,QACtD;AAAA,QACCtC,MAAW,YACR,gBAAAqC;AAAA,UAACO;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWN,EAAO;AAAA,YAClB,gBAAc,GAAGnC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,QACH0B,KAAgB7B,MAAW,UACxB,gBAAAqC;AAAA,UAACQ;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWP,EAAO;AAAA,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
|
+
{"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 alignment of the menu.\n * @default \"start\"\n */\n alignMenu?: 'start' | 'center' | 'end';\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 alignMenu = 'start',\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 align={alignMenu}\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","alignMenu","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":";;;;;;;;;AAyDO,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;AAAA,EAC7B,WAAAC,IAAY;AAChB,GACAC,MACC;AACK,QAAA,EAAE,YAAA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,EAAO,OAAO;AAAA,UAAA;AAAA,QACtD;AAAA,QACCvC,MAAW,YACR,gBAAAsC;AAAA,UAACO;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWN,EAAO;AAAA,YAClB,gBAAc,GAAGpC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,QACH2B,KAAgB9B,MAAW,UACxB,gBAAAsC;AAAA,UAACQ;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWP,EAAO;AAAA,YAClB,gBAAc,GAAGpC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,MAAA,GACR;AAAA,IAAA,EAAA,CACJ,EACJ,CAAA;AAAA,IAEA,gBAAAmC;AAAA,MAACS;AAAA,MAAA;AAAA,QACG,OAAO3C;AAAA,QACP,kBAAAoB;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;AACAb,EAAe,cAAc;AAEhB,MAAAsD,KAAuBC,EAA0CvD,CAAc;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { jsxs as i, jsx as
|
|
1
|
+
import { jsxs as i, jsx as a } from "react/jsx-runtime";
|
|
2
2
|
import { IconCheckMark as l } from "@frontify/fondue-icons";
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import
|
|
3
|
+
import { forwardRef as c } from "react";
|
|
4
|
+
import o from "./fondue-components52.js";
|
|
5
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__ */
|
|
6
|
+
/* @__PURE__ */ a("div", { className: o.itemValue, children: e.children }),
|
|
7
|
+
/* @__PURE__ */ a(l, { className: o.checkmarkIcon })
|
|
8
8
|
] });
|
|
9
9
|
d.displayName = "Select.Item";
|
|
10
|
-
const I =
|
|
10
|
+
const I = c(d), m = ({ children: t, groupId: e, "data-test-id": r = "fondue-select-item-group" }, s) => /* @__PURE__ */ a("div", { "data-test-id": r, className: o.group, ref: s, children: t }, e);
|
|
11
11
|
m.displayName = "Select.Group";
|
|
12
|
-
const S =
|
|
12
|
+
const S = c(m);
|
|
13
13
|
export {
|
|
14
14
|
I as ForwardedRefSelectItem,
|
|
15
15
|
S as ForwardedRefSelectItemGroup,
|
|
@@ -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 { 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}
|
|
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 <div className={styles.itemValue}>{props.children}</div>\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","styles","IconCheckMark","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,GACjD,UAAA;AAAA,EAAA,gBAAAE,EAAC,OAAI,EAAA,WAAWC,EAAO,WAAY,YAAM,UAAS;AAAA,EACjD,gBAAAD,EAAAE,GAAA,EAAc,WAAWD,EAAO,cAAe,CAAA;AACpD,EAAA,CAAA;AAGRL,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,WAAWI,EAAO,OAAO,KAAKF,GACxD,UAAAO,EAAA,GAD2EC,CAEhF;AAGRF,EAAgB,cAAc;AAEjB,MAAAG,IAA8BJ,EAAiDC,CAAe;"}
|
|
@@ -1,65 +1,75 @@
|
|
|
1
1
|
import { jsx as t } from "react/jsx-runtime";
|
|
2
2
|
import * as l from "@radix-ui/react-popover";
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { useRef as
|
|
3
|
+
import { Slot as P } from "@radix-ui/react-slot";
|
|
4
|
+
import { useRef as S, isValidElement as C } from "react";
|
|
5
5
|
import { usePreventDropdownOverflow as M } from "./fondue-components38.js";
|
|
6
6
|
import n from "./fondue-components52.js";
|
|
7
|
-
import { recursiveMap as N, getSelectOptionValue as
|
|
8
|
-
const
|
|
7
|
+
import { recursiveMap as N, getSelectOptionValue as V } from "./fondue-components60.js";
|
|
8
|
+
const x = ({
|
|
9
9
|
highlightedIndex: p,
|
|
10
10
|
getMenuProps: u,
|
|
11
11
|
getItemProps: m,
|
|
12
12
|
children: f,
|
|
13
13
|
filterText: c,
|
|
14
|
+
align: d,
|
|
14
15
|
selectedItem: r,
|
|
15
|
-
hasInteractedSinceOpening:
|
|
16
|
+
hasInteractedSinceOpening: v
|
|
16
17
|
}) => {
|
|
17
|
-
const s =
|
|
18
|
-
e.preventDefault(),
|
|
18
|
+
const s = S(null), { setMaxHeight: h } = M(s), g = (e) => {
|
|
19
|
+
e.preventDefault(), h();
|
|
19
20
|
};
|
|
20
|
-
return /* @__PURE__ */ t(l.Portal, { children: /* @__PURE__ */ t(
|
|
21
|
-
|
|
21
|
+
return /* @__PURE__ */ t(l.Portal, { children: /* @__PURE__ */ t(
|
|
22
|
+
l.Content,
|
|
22
23
|
{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
24
|
+
align: d,
|
|
25
|
+
collisionPadding: 16,
|
|
26
|
+
onOpenAutoFocus: g,
|
|
27
|
+
className: n.portal,
|
|
28
|
+
children: /* @__PURE__ */ t(
|
|
29
|
+
"ul",
|
|
30
|
+
{
|
|
31
|
+
className: n.menu,
|
|
32
|
+
...u(),
|
|
33
|
+
ref: s,
|
|
34
|
+
"data-has-interacted": v ? "true" : "false",
|
|
35
|
+
"data-test-id": "fondue-select-menu",
|
|
36
|
+
children: N(
|
|
37
|
+
f,
|
|
38
|
+
(e, i) => {
|
|
39
|
+
if (((o) => (
|
|
40
|
+
// @ts-expect-error - We are explicitly checking for ref
|
|
41
|
+
C(o) && o.ref !== void 0
|
|
42
|
+
))(e)) {
|
|
43
|
+
const o = V(e.props), a = m({
|
|
44
|
+
item: o,
|
|
45
|
+
index: i,
|
|
46
|
+
...e.ref ? { ref: e.ref } : {}
|
|
47
|
+
});
|
|
48
|
+
return /* @__PURE__ */ t(
|
|
49
|
+
P,
|
|
50
|
+
{
|
|
51
|
+
className: n.item,
|
|
52
|
+
"data-highlighted": p === i,
|
|
53
|
+
"data-selected": (r == null ? void 0 : r.value) === o.value,
|
|
54
|
+
onTouchStart: (O) => {
|
|
55
|
+
a.onClick && a.onClick(O);
|
|
56
|
+
},
|
|
57
|
+
...a,
|
|
58
|
+
children: e
|
|
59
|
+
},
|
|
60
|
+
e.props.value
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
c
|
|
65
|
+
).parsedChildren
|
|
66
|
+
}
|
|
67
|
+
)
|
|
58
68
|
}
|
|
59
|
-
) })
|
|
69
|
+
) });
|
|
60
70
|
};
|
|
61
|
-
|
|
71
|
+
x.displayName = "Select.Menu";
|
|
62
72
|
export {
|
|
63
|
-
|
|
73
|
+
x as SelectMenu
|
|
64
74
|
};
|
|
65
75
|
//# sourceMappingURL=fondue-components50.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components50.js","sources":["../src/components/Select/SelectMenu.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { type UseComboboxPropGetters, type UseSelectPropGetters } from 'downshift';\nimport { isValidElement, useRef, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { usePreventDropdownOverflow } from '#/hooks/usePreventDropdownOverflow';\n\nimport { type SelectItemProps } from './SelectItem';\nimport styles from './styles/select.module.scss';\nimport { getSelectOptionValue, recursiveMap } from './utils';\n\nexport type SelectMenuProps = {\n /**\n * @internal\n * The index of the highlighted item in the menu.\n */\n highlightedIndex: number;\n /**\n * @internal\n * Callback function to retrieve the props for a menu element.\n */\n getMenuProps: UseSelectPropGetters<unknown>['getMenuProps'] | UseComboboxPropGetters<unknown>['getMenuProps'];\n /**\n * @internal\n * Callback function to retrieve the props for a item element.\n */\n getItemProps: UseSelectPropGetters<unknown>['getItemProps'] | UseComboboxPropGetters<unknown>['getItemProps'];\n /**\n * @internal\n * The children of the menu component. This can contain multiple `Select.Item` or `Select.Group` components.\n */\n children: ReactNode;\n /**\n * @internal\n * The filter text shown in the combobox input element.\n */\n filterText?: string;\n /**\n * @internal\n * The type of the menu.\n */\n selectedItem?: {\n value: string;\n } | null;\n /**\n * @internal\n * A boolean to indicate if highlighted item was changed since opening the menu.\n * This is used to determine the style of the selected/highlighted item.\n */\n hasInteractedSinceOpening?: boolean;\n};\n\nexport const SelectMenu = ({\n highlightedIndex,\n getMenuProps,\n getItemProps,\n children,\n filterText,\n selectedItem,\n hasInteractedSinceOpening,\n}: SelectMenuProps) => {\n const ref = useRef<HTMLUListElement | null>(null);\n\n const { setMaxHeight } = usePreventDropdownOverflow(ref);\n\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n setMaxHeight();\n };\n\n return (\n <RadixPopover.Portal>\n <RadixPopover.Content
|
|
1
|
+
{"version":3,"file":"fondue-components50.js","sources":["../src/components/Select/SelectMenu.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport * as RadixPopover from '@radix-ui/react-popover';\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { type UseComboboxPropGetters, type UseSelectPropGetters } from 'downshift';\nimport { isValidElement, useRef, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { usePreventDropdownOverflow } from '#/hooks/usePreventDropdownOverflow';\n\nimport { type SelectItemProps } from './SelectItem';\nimport styles from './styles/select.module.scss';\nimport { getSelectOptionValue, recursiveMap } from './utils';\n\nexport type SelectMenuProps = {\n /**\n * @internal\n * The index of the highlighted item in the menu.\n */\n highlightedIndex: number;\n /**\n * @internal\n * Callback function to retrieve the props for a menu element.\n */\n getMenuProps: UseSelectPropGetters<unknown>['getMenuProps'] | UseComboboxPropGetters<unknown>['getMenuProps'];\n /**\n * @internal\n * Callback function to retrieve the props for a item element.\n */\n getItemProps: UseSelectPropGetters<unknown>['getItemProps'] | UseComboboxPropGetters<unknown>['getItemProps'];\n /**\n * @internal\n * The children of the menu component. This can contain multiple `Select.Item` or `Select.Group` components.\n */\n children: ReactNode;\n /**\n * @internal\n * The filter text shown in the combobox input element.\n */\n filterText?: string;\n /**\n * @internal\n * The alignment of the menu.\n */\n align: 'start' | 'center' | 'end';\n /**\n * @internal\n * The type of the menu.\n */\n selectedItem?: {\n value: string;\n } | null;\n /**\n * @internal\n * A boolean to indicate if highlighted item was changed since opening the menu.\n * This is used to determine the style of the selected/highlighted item.\n */\n hasInteractedSinceOpening?: boolean;\n};\n\nexport const SelectMenu = ({\n highlightedIndex,\n getMenuProps,\n getItemProps,\n children,\n filterText,\n align,\n selectedItem,\n hasInteractedSinceOpening,\n}: SelectMenuProps) => {\n const ref = useRef<HTMLUListElement | null>(null);\n\n const { setMaxHeight } = usePreventDropdownOverflow(ref);\n\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n setMaxHeight();\n };\n\n return (\n <RadixPopover.Portal>\n <RadixPopover.Content\n align={align}\n collisionPadding={16}\n onOpenAutoFocus={handleOnOpenAutoFocus}\n className={styles.portal}\n >\n <ul\n className={styles.menu}\n {...getMenuProps()}\n ref={ref}\n data-has-interacted={hasInteractedSinceOpening ? 'true' : 'false'}\n data-test-id=\"fondue-select-menu\"\n >\n {\n recursiveMap(\n children,\n (child, index) => {\n const isValid = <TProps,>(\n child: ReactNode,\n ): child is ReactElement<TProps> & { ref: ForwardedRef<HTMLElement> } =>\n // @ts-expect-error - We are explicitly checking for ref\n isValidElement<TProps>(child) && child.ref !== undefined;\n\n if (isValid<SelectItemProps>(child)) {\n const optionData = getSelectOptionValue(child.props);\n const itemProps = getItemProps({\n item: optionData,\n index,\n ...(child.ref ? { ref: child.ref } : {}),\n });\n\n return (\n <RadixSlot\n className={styles.item}\n data-highlighted={highlightedIndex === index}\n data-selected={selectedItem?.value === optionData.value}\n key={child.props.value}\n // Workaround for the issue where the onClick event is not fired on touch devices because of portal usage\n onTouchStart={(event) => {\n if (itemProps.onClick) {\n itemProps.onClick(event as unknown as MouseEvent<HTMLElement>);\n }\n }}\n {...itemProps}\n >\n {child}\n </RadixSlot>\n );\n }\n },\n filterText,\n ).parsedChildren\n }\n </ul>\n </RadixPopover.Content>\n </RadixPopover.Portal>\n );\n};\nSelectMenu.displayName = 'Select.Menu';\n"],"names":["SelectMenu","highlightedIndex","getMenuProps","getItemProps","children","filterText","align","selectedItem","hasInteractedSinceOpening","ref","useRef","setMaxHeight","usePreventDropdownOverflow","handleOnOpenAutoFocus","event","jsx","RadixPopover","styles","recursiveMap","child","index","isValidElement","optionData","getSelectOptionValue","itemProps","RadixSlot"],"mappings":";;;;;;;AA2DO,MAAMA,IAAa,CAAC;AAAA,EACvB,kBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,cAAAC;AAAA,EACA,UAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,2BAAAC;AACJ,MAAuB;AACb,QAAAC,IAAMC,EAAgC,IAAI,GAE1C,EAAE,cAAAC,EAAA,IAAiBC,EAA2BH,CAAG,GAEjDI,IAAwB,CAACC,MAAiB;AAC5C,IAAAA,EAAM,eAAe,GACRH;EAAA;AAIb,SAAA,gBAAAI,EAACC,EAAa,QAAb,EACG,UAAA,gBAAAD;AAAA,IAACC,EAAa;AAAA,IAAb;AAAA,MACG,OAAAV;AAAA,MACA,kBAAkB;AAAA,MAClB,iBAAiBO;AAAA,MACjB,WAAWI,EAAO;AAAA,MAElB,UAAA,gBAAAF;AAAA,QAAC;AAAA,QAAA;AAAA,UACG,WAAWE,EAAO;AAAA,UACjB,GAAGf,EAAa;AAAA,UACjB,KAAAO;AAAA,UACA,uBAAqBD,IAA4B,SAAS;AAAA,UAC1D,gBAAa;AAAA,UAGT,UAAAU;AAAA,YACId;AAAA,YACA,CAACe,GAAOC,MAAU;AAOV,mBANY,CACZD;AAAAA;AAAAA,gBAGAE,EAAuBF,CAAK,KAAKA,EAAM,QAAQ;AAAA,iBAEtBA,CAAK,GAAG;AAC3B,sBAAAG,IAAaC,EAAqBJ,EAAM,KAAK,GAC7CK,IAAYrB,EAAa;AAAA,kBAC3B,MAAMmB;AAAA,kBACN,OAAAF;AAAA,kBACA,GAAID,EAAM,MAAM,EAAE,KAAKA,EAAM,IAAA,IAAQ,CAAC;AAAA,gBAAA,CACzC;AAGG,uBAAA,gBAAAJ;AAAA,kBAACU;AAAAA,kBAAA;AAAA,oBACG,WAAWR,EAAO;AAAA,oBAClB,oBAAkBhB,MAAqBmB;AAAA,oBACvC,kBAAeb,KAAA,gBAAAA,EAAc,WAAUe,EAAW;AAAA,oBAGlD,cAAc,CAACR,MAAU;AACrB,sBAAIU,EAAU,WACVA,EAAU,QAAQV,CAA2C;AAAA,oBAErE;AAAA,oBACC,GAAGU;AAAA,oBAEH,UAAAL;AAAA,kBAAA;AAAA,kBATIA,EAAM,MAAM;AAAA,gBAAA;AAAA,cAY7B;AAAA,YACJ;AAAA,YACAd;AAAA,UAAA,EACF;AAAA,QAAA;AAAA,MAEV;AAAA,IAAA;AAAA,EAER,EAAA,CAAA;AAER;AACAL,EAAW,cAAc;"}
|
|
@@ -1,32 +1,36 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
1
|
+
const c = "_root_1mhnr_6", n = "_selectedValue_1mhnr_62", o = "_input_1mhnr_74", _ = "_slot_1mhnr_100", r = "_clear_1mhnr_152", t = "_icons_1mhnr_165", e = "_caret_1mhnr_171", s = "_iconSuccess_1mhnr_193", m = "_iconError_1mhnr_199", a = "_menu_1mhnr_205", l = "_portal_1mhnr_225", u = "_item_1mhnr_229", h = "_checkmarkIcon_1mhnr_248", i = "_itemValue_1mhnr_255", p = "_group_1mhnr_269", k = {
|
|
2
|
+
root: c,
|
|
3
|
+
selectedValue: n,
|
|
3
4
|
input: o,
|
|
4
|
-
slot:
|
|
5
|
-
clear:
|
|
5
|
+
slot: _,
|
|
6
|
+
clear: r,
|
|
6
7
|
icons: t,
|
|
7
|
-
caret:
|
|
8
|
-
iconSuccess:
|
|
9
|
-
iconError:
|
|
10
|
-
menu:
|
|
11
|
-
portal:
|
|
12
|
-
item:
|
|
13
|
-
checkmarkIcon:
|
|
14
|
-
|
|
8
|
+
caret: e,
|
|
9
|
+
iconSuccess: s,
|
|
10
|
+
iconError: m,
|
|
11
|
+
menu: a,
|
|
12
|
+
portal: l,
|
|
13
|
+
item: u,
|
|
14
|
+
checkmarkIcon: h,
|
|
15
|
+
itemValue: i,
|
|
16
|
+
group: p
|
|
15
17
|
};
|
|
16
18
|
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
e as caret,
|
|
20
|
+
h as checkmarkIcon,
|
|
21
|
+
r as clear,
|
|
22
|
+
k as default,
|
|
23
|
+
p as group,
|
|
24
|
+
m as iconError,
|
|
25
|
+
s as iconSuccess,
|
|
24
26
|
t as icons,
|
|
25
27
|
o as input,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
c as
|
|
28
|
+
u as item,
|
|
29
|
+
i as itemValue,
|
|
30
|
+
a as menu,
|
|
31
|
+
l as portal,
|
|
32
|
+
c as root,
|
|
33
|
+
n as selectedValue,
|
|
34
|
+
_ as slot
|
|
31
35
|
};
|
|
32
36
|
//# sourceMappingURL=fondue-components52.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components52.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components52.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
const t = "
|
|
1
|
+
const t = "_root_u7y8i_5", o = "_thumb_u7y8i_17", _ = "_track_u7y8i_21", r = "_range_u7y8i_28", a = {
|
|
2
2
|
root: t,
|
|
3
|
-
thumb:
|
|
4
|
-
track:
|
|
5
|
-
range:
|
|
3
|
+
thumb: o,
|
|
4
|
+
track: _,
|
|
5
|
+
range: r
|
|
6
6
|
};
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
a as default,
|
|
9
|
+
r as range,
|
|
10
10
|
t as root,
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
o as thumb,
|
|
12
|
+
_ as track
|
|
13
13
|
};
|
|
14
14
|
//# sourceMappingURL=fondue-components54.js.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
const o = "
|
|
1
|
+
const o = "_root_l0xje_5", t = "_input_l0xje_53", s = "_slot_l0xje_72", _ = "_iconSuccess_l0xje_122", n = "_iconError_l0xje_130", c = "_loadingStatus_l0xje_138", l = "_spin_l0xje_1", i = {
|
|
2
2
|
root: o,
|
|
3
3
|
input: t,
|
|
4
4
|
slot: s,
|
|
5
5
|
iconSuccess: _,
|
|
6
|
-
iconError:
|
|
7
|
-
loadingStatus:
|
|
8
|
-
spin:
|
|
9
|
-
"tw-dark": "_tw-
|
|
6
|
+
iconError: n,
|
|
7
|
+
loadingStatus: c,
|
|
8
|
+
spin: l,
|
|
9
|
+
"tw-dark": "_tw-dark_l0xje_170"
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
i as default,
|
|
13
|
+
n as iconError,
|
|
14
14
|
_ as iconSuccess,
|
|
15
15
|
t as input,
|
|
16
|
-
|
|
16
|
+
c as loadingStatus,
|
|
17
17
|
o as root,
|
|
18
18
|
s as slot,
|
|
19
|
-
|
|
19
|
+
l as spin
|
|
20
20
|
};
|
|
21
21
|
//# sourceMappingURL=fondue-components56.js.map
|
|
@@ -1,14 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
root: o,
|
|
3
|
-
colorName: c,
|
|
4
|
-
colorIndicator: t,
|
|
5
|
-
caret: r
|
|
6
|
-
};
|
|
1
|
+
const t = "focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue";
|
|
7
2
|
export {
|
|
8
|
-
|
|
9
|
-
t as colorIndicator,
|
|
10
|
-
c as colorName,
|
|
11
|
-
_ as default,
|
|
12
|
-
o as root
|
|
3
|
+
t as FOCUS_OUTLINE
|
|
13
4
|
};
|
|
14
5
|
//# sourceMappingURL=fondue-components58.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components58.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fondue-components58.js","sources":["../src/utilities/focusStyle.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nexport const FOCUS_OUTLINE =\n 'focus-visible:tw-outline has-[[data-show-focus-ring=true]]:tw-outline tw-outline-4 tw-outline-offset-2 tw-outline-blue focus-visible:tw-outline-blue'; // second declaration of tw-outline-blue is to assure that in firefox the outline isn't overriden by a global definition of :-moz-focusring which is coming from tailwinds normalization styling\n"],"names":["FOCUS_OUTLINE"],"mappings":"AAEO,MAAMA,IACT;"}
|