@frontify/fondue-components 15.0.1 → 16.0.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.
- package/dist/fondue-components10.js +92 -85
- package/dist/fondue-components10.js.map +1 -1
- package/dist/fondue-components12.js +39 -35
- package/dist/fondue-components12.js.map +1 -1
- package/dist/fondue-components21.js +47 -45
- package/dist/fondue-components21.js.map +1 -1
- package/dist/fondue-components24.js +51 -51
- package/dist/fondue-components25.js +4 -4
- package/dist/fondue-components25.js.map +1 -1
- package/dist/fondue-components29.js +19 -19
- package/dist/fondue-components3.js +49 -51
- package/dist/fondue-components3.js.map +1 -1
- package/dist/fondue-components30.js +4 -8
- package/dist/fondue-components30.js.map +1 -1
- package/dist/fondue-components31.js +5 -5
- package/dist/fondue-components38.js +15 -15
- package/dist/fondue-components39.js +31 -28
- package/dist/fondue-components39.js.map +1 -1
- package/dist/fondue-components40.js +13 -13
- package/dist/fondue-components42.js +15 -15
- package/dist/fondue-components42.js.map +1 -1
- package/dist/fondue-components54.js +4 -6
- package/dist/fondue-components54.js.map +1 -1
- package/dist/fondue-components57.js +3 -3
- package/dist/fondue-components59.js +43 -41
- package/dist/fondue-components59.js.map +1 -1
- package/dist/fondue-components6.js +3 -3
- package/dist/fondue-components61.js +42 -38
- package/dist/fondue-components61.js.map +1 -1
- package/dist/fondue-components64.js +13 -13
- package/dist/fondue-components66.js +9 -9
- package/dist/fondue-components7.js +37 -34
- package/dist/fondue-components7.js.map +1 -1
- package/dist/fondue-components73.js +6 -9
- package/dist/fondue-components73.js.map +1 -1
- package/dist/fondue-components77.js +6 -6
- package/dist/fondue-components8.js +3 -3
- package/dist/index.d.ts +42 -8
- package/dist/style.css +1 -1
- package/package.json +54 -54
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs as m, jsx as t } from "react/jsx-runtime";
|
|
2
|
-
import { IconCaretDown as
|
|
2
|
+
import { IconCaretDown as q, IconCheckMark as G, IconExclamationMarkTriangle as J } from "@frontify/fondue-icons";
|
|
3
3
|
import * as w 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 K } from "@radix-ui/react-slot";
|
|
5
|
+
import { useCombobox as Q } from "downshift";
|
|
6
|
+
import { forwardRef as U, useState as W, useRef as X, useMemo as Y } from "react";
|
|
7
|
+
import { SelectMenu as Z } from "./fondue-components61.js";
|
|
8
8
|
import o from "./fondue-components63.js";
|
|
9
|
-
import { useSelectData as
|
|
9
|
+
import { useSelectData as _ } from "./fondue-components64.js";
|
|
10
10
|
const N = ({
|
|
11
11
|
children: S,
|
|
12
12
|
onSelect: l,
|
|
@@ -16,49 +16,50 @@ const N = ({
|
|
|
16
16
|
status: s = "neutral",
|
|
17
17
|
disabled: g,
|
|
18
18
|
"data-test-id": i = "fondue-select-combobox",
|
|
19
|
-
alignMenu:
|
|
20
|
-
side:
|
|
21
|
-
id:
|
|
19
|
+
alignMenu: v = "start",
|
|
20
|
+
side: M = "bottom",
|
|
21
|
+
id: y,
|
|
22
|
+
viewportCollisionPadding: F = "compact",
|
|
22
23
|
...a
|
|
23
24
|
}, L) => {
|
|
24
|
-
const { inputSlots: P, menuSlots: k, items: c, filterText:
|
|
25
|
+
const { inputSlots: P, menuSlots: k, items: c, filterText: D, clearButton: f, getItemByValue: p, setFilterText: H } = _(S), [T, h] = W(!1), {
|
|
25
26
|
getInputProps: u,
|
|
26
|
-
getToggleButtonProps:
|
|
27
|
-
getMenuProps:
|
|
28
|
-
getItemProps:
|
|
27
|
+
getToggleButtonProps: V,
|
|
28
|
+
getMenuProps: z,
|
|
29
|
+
getItemProps: j,
|
|
29
30
|
reset: b,
|
|
30
31
|
selectedItem: r,
|
|
31
|
-
isOpen:
|
|
32
|
-
highlightedIndex:
|
|
32
|
+
isOpen: $,
|
|
33
|
+
highlightedIndex: A,
|
|
33
34
|
inputValue: d
|
|
34
|
-
} =
|
|
35
|
+
} = Q({
|
|
35
36
|
items: c,
|
|
36
|
-
selectedItem:
|
|
37
|
-
defaultSelectedItem:
|
|
37
|
+
selectedItem: p(B),
|
|
38
|
+
defaultSelectedItem: p(O),
|
|
38
39
|
defaultHighlightedIndex: 0,
|
|
39
|
-
toggleButtonId:
|
|
40
|
+
toggleButtonId: y,
|
|
40
41
|
labelId: "aria-labelledby" in a ? a["aria-labelledby"] : void 0,
|
|
41
42
|
onSelectedItemChange: ({ selectedItem: e }) => {
|
|
42
43
|
l == null || l((e == null ? void 0 : e.value) ?? null);
|
|
43
44
|
},
|
|
44
45
|
onInputValueChange: ({ inputValue: e }) => {
|
|
45
|
-
|
|
46
|
+
H(e);
|
|
46
47
|
},
|
|
47
48
|
onIsOpenChange: () => {
|
|
48
|
-
|
|
49
|
+
h(!1);
|
|
49
50
|
},
|
|
50
51
|
onHighlightedIndexChange: () => {
|
|
51
|
-
|
|
52
|
+
h(!0);
|
|
52
53
|
},
|
|
53
54
|
itemToString: (e) => e ? e.label : ""
|
|
54
|
-
}), n =
|
|
55
|
+
}), n = X(!1), C = Y(
|
|
55
56
|
() => !c.find((e) => e.label.toLowerCase().includes(d.toLowerCase())),
|
|
56
57
|
[d, c]
|
|
57
|
-
),
|
|
58
|
+
), E = (e) => {
|
|
58
59
|
var x, I;
|
|
59
60
|
e.target.dataset.showFocusRing = "false", n.current = !1, (r == null ? void 0 : r.label.toLocaleLowerCase()) !== d.toLocaleLowerCase() && b(), u().onBlur && ((I = (x = u()).onBlur) == null || I.call(x, e));
|
|
60
61
|
};
|
|
61
|
-
return /* @__PURE__ */ m(w.Root, { open:
|
|
62
|
+
return /* @__PURE__ */ m(w.Root, { open: $, children: [
|
|
62
63
|
/* @__PURE__ */ t(w.Anchor, { asChild: !0, children: /* @__PURE__ */ m("div", { ref: L, className: o.root, "data-status": C ? "error" : s, children: [
|
|
63
64
|
/* @__PURE__ */ t(
|
|
64
65
|
"input",
|
|
@@ -76,12 +77,12 @@ const N = ({
|
|
|
76
77
|
onFocus: (e) => {
|
|
77
78
|
n.current || (e.target.dataset.showFocusRing = "true");
|
|
78
79
|
},
|
|
79
|
-
onBlur:
|
|
80
|
+
onBlur: E
|
|
80
81
|
}
|
|
81
82
|
),
|
|
82
83
|
P,
|
|
83
84
|
f && /* @__PURE__ */ t(
|
|
84
|
-
|
|
85
|
+
K,
|
|
85
86
|
{
|
|
86
87
|
onClick: (e) => {
|
|
87
88
|
e.stopPropagation(), b();
|
|
@@ -96,17 +97,17 @@ const N = ({
|
|
|
96
97
|
"button",
|
|
97
98
|
{
|
|
98
99
|
"aria-label": "toggle menu",
|
|
99
|
-
...
|
|
100
|
+
...V(),
|
|
100
101
|
type: "button",
|
|
101
102
|
disabled: g,
|
|
102
103
|
onMouseDown: () => {
|
|
103
104
|
n.current = !0;
|
|
104
105
|
},
|
|
105
|
-
children: /* @__PURE__ */ t(
|
|
106
|
+
children: /* @__PURE__ */ t(q, { size: 16, className: o.caret })
|
|
106
107
|
}
|
|
107
108
|
),
|
|
108
109
|
s === "success" ? /* @__PURE__ */ t(
|
|
109
|
-
|
|
110
|
+
G,
|
|
110
111
|
{
|
|
111
112
|
size: 16,
|
|
112
113
|
className: o.iconSuccess,
|
|
@@ -114,7 +115,7 @@ const N = ({
|
|
|
114
115
|
}
|
|
115
116
|
) : null,
|
|
116
117
|
C || s === "error" ? /* @__PURE__ */ t(
|
|
117
|
-
|
|
118
|
+
J,
|
|
118
119
|
{
|
|
119
120
|
size: 16,
|
|
120
121
|
className: o.iconError,
|
|
@@ -124,25 +125,26 @@ const N = ({
|
|
|
124
125
|
] })
|
|
125
126
|
] }) }),
|
|
126
127
|
/* @__PURE__ */ t(
|
|
127
|
-
|
|
128
|
+
Z,
|
|
128
129
|
{
|
|
129
|
-
align:
|
|
130
|
-
side:
|
|
131
|
-
highlightedIndex:
|
|
132
|
-
filterText:
|
|
133
|
-
getMenuProps:
|
|
134
|
-
getItemProps:
|
|
130
|
+
align: v,
|
|
131
|
+
side: M,
|
|
132
|
+
highlightedIndex: A,
|
|
133
|
+
filterText: D,
|
|
134
|
+
getMenuProps: z,
|
|
135
|
+
getItemProps: j,
|
|
135
136
|
selectedItem: r,
|
|
136
|
-
hasInteractedSinceOpening:
|
|
137
|
+
hasInteractedSinceOpening: T,
|
|
138
|
+
viewportCollisionPadding: F,
|
|
137
139
|
children: k
|
|
138
140
|
}
|
|
139
141
|
)
|
|
140
142
|
] });
|
|
141
143
|
};
|
|
142
144
|
N.displayName = "Select.Combobox";
|
|
143
|
-
const
|
|
145
|
+
const ce = U(N);
|
|
144
146
|
export {
|
|
145
|
-
|
|
147
|
+
ce as ForwardedRefCombobox,
|
|
146
148
|
N as SelectCombobox
|
|
147
149
|
};
|
|
148
150
|
//# sourceMappingURL=fondue-components59.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components59.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 { type CommonAriaProps } from '#/helpers/aria';\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 | null) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string | null;\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 * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */;\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component.\n */\n 'data-test-id'?: string;\n} & CommonAriaProps;\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n ...props\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 toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\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': 'aria-label' in props ? props['aria-label'] : undefined,\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 aria-label=\"toggle menu\"\n {...getToggleButtonProps()}\n type=\"button\"\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 side={side}\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","dataTestId","alignMenu","side","id","props","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":";;;;;;;;;AA+DO,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,gBAAgBC,IAAa;AAAA,EAC7B,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,IAAAC;AAAA,EACA,GAAGC;AACP,GACAC,MACC;AACK,QAAA,EAAE,YAAAC,GAAY,WAAAC,GAAW,OAAAC,GAAO,YAAAC,GAAY,aAAAC,GAAa,gBAAAC,GAAgB,eAAAC,EAAA,IAC3EC,EAAcpB,CAAQ,GAEpB,CAACqB,GAA2BC,CAA4B,IAAIC,EAAS,EAAK,GAE1E;AAAA,IACF,eAAAC;AAAA,IACA,sBAAAC;AAAA,IACA,cAAAC;AAAA,IACA,cAA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UAACO;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWN,EAAO;AAAA,YAClB,gBAAc,GAAGvC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,QACH8B,KAAgBhC,MAAW,UACxB,gBAAAwC;AAAA,UAACQ;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWP,EAAO;AAAA,YAClB,gBAAc,GAAGvC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,MAAA,EACR,CAAA;AAAA,IAAA,EAAA,CACJ,EACJ,CAAA;AAAA,IAEA,gBAAAsC;AAAA,MAACS;AAAA,MAAA;AAAA,QACG,OAAO9C;AAAA,QACP,MAAAC;AAAA,QACA,kBAAAsB;AAAA,QACA,YAAAf;AAAA,QACA,cAAAU;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAR;AAAA,QAEC,UAAAP;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACAf,EAAe,cAAc;AAEhB,MAAAwD,KAAuBC,EAA0CzD,CAAc;"}
|
|
1
|
+
{"version":3,"file":"fondue-components59.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 { type CommonAriaProps } from '#/helpers/aria';\n\nimport { SelectMenu, type SelectMenuViewportCollisionPadding } 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 | null) => void;\n /**\n * The active value in the combobox component. This is used to control the combobox externally.\n */\n value?: string | null;\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 * Defines the preferred side of the combobox. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */;\n side?: 'left' | 'right' | 'bottom' | 'top';\n /**\n * Id of the combobox component\n */\n id?: string;\n /**\n * The data test id of the combobox component.\n */\n 'data-test-id'?: string;\n /**\n * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n} & CommonAriaProps;\n\nexport const SelectCombobox = (\n {\n children,\n onSelect,\n value,\n defaultValue,\n placeholder = '',\n status = 'neutral',\n disabled,\n 'data-test-id': dataTestId = 'fondue-select-combobox',\n alignMenu = 'start',\n side = 'bottom',\n id,\n viewportCollisionPadding = 'compact',\n ...props\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 toggleButtonId: id,\n labelId: 'aria-labelledby' in props ? props['aria-labelledby'] : undefined,\n onSelectedItemChange: ({ selectedItem }) => {\n onSelect?.(selectedItem?.value ?? null);\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': 'aria-label' in props ? props['aria-label'] : undefined,\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 aria-label=\"toggle menu\"\n {...getToggleButtonProps()}\n type=\"button\"\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 side={side}\n highlightedIndex={highlightedIndex}\n filterText={filterText}\n getMenuProps={getMenuProps}\n getItemProps={getItemProps}\n selectedItem={selectedItem}\n hasInteractedSinceOpening={hasInteractedSinceOpening}\n viewportCollisionPadding={viewportCollisionPadding}\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","dataTestId","alignMenu","side","id","viewportCollisionPadding","props","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":";;;;;;;;;AAoEO,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,gBAAgBC,IAAa;AAAA,EAC7B,WAAAC,IAAY;AAAA,EACZ,MAAAC,IA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AI,WAAWG,EAAO,OACnB,UAAA;AAAA,QAAA,gBAAAD;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,cAAW;AAAA,YACV,GAAGpB,EAAqB;AAAA,YACzB,MAAK;AAAA,YACL,UAAApB;AAAA,YACA,aAAa,MAAM;AACf,cAAA8B,EAAW,UAAU;AAAA,YACzB;AAAA,YAEA,4BAACgB,GAAc,EAAA,MAAM,IAAI,WAAWL,EAAO,MAAO,CAAA;AAAA,UAAA;AAAA,QACtD;AAAA,QACC1C,MAAW,YACR,gBAAAyC;AAAA,UAACO;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWN,EAAO;AAAA,YAClB,gBAAc,GAAGxC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,QACH+B,KAAgBjC,MAAW,UACxB,gBAAAyC;AAAA,UAACQ;AAAA,UAAA;AAAA,YACG,MAAM;AAAA,YACN,WAAWP,EAAO;AAAA,YAClB,gBAAc,GAAGxC,CAAU;AAAA,UAAA;AAAA,QAAA,IAE/B;AAAA,MAAA,EACR,CAAA;AAAA,IAAA,EAAA,CACJ,EACJ,CAAA;AAAA,IAEA,gBAAAuC;AAAA,MAACS;AAAA,MAAA;AAAA,QACG,OAAO/C;AAAA,QACP,MAAAC;AAAA,QACA,kBAAAuB;AAAA,QACA,YAAAf;AAAA,QACA,cAAAU;AAAA,QACA,cAAAC;AAAA,QACA,cAAAE;AAAA,QACA,2BAAAR;AAAA,QACA,0BAAAX;AAAA,QAEC,UAAAI;AAAA,MAAA;AAAA,IAAA;AAAA,EACL,GACJ;AAER;AACAhB,EAAe,cAAc;AAEhB,MAAAyD,KAAuBC,EAA0C1D,CAAc;"}
|
|
@@ -3,7 +3,7 @@ import { IconMinus as m, IconCheckMark as h } from "@frontify/fondue-icons";
|
|
|
3
3
|
import * as o from "@radix-ui/react-checkbox";
|
|
4
4
|
import { forwardRef as k } from "react";
|
|
5
5
|
import { cn as p } from "./fondue-components33.js";
|
|
6
|
-
import {
|
|
6
|
+
import { checkboxIndicatorStyles as l, checkboxStyles as w } from "./fondue-components37.js";
|
|
7
7
|
const f = ({
|
|
8
8
|
className: a,
|
|
9
9
|
value: c,
|
|
@@ -17,11 +17,11 @@ const f = ({
|
|
|
17
17
|
ref: n,
|
|
18
18
|
checked: c,
|
|
19
19
|
defaultChecked: d,
|
|
20
|
-
className: p(
|
|
20
|
+
className: p(w(e), a),
|
|
21
21
|
onClick: i,
|
|
22
22
|
"data-test-id": r,
|
|
23
23
|
...e,
|
|
24
|
-
children: /* @__PURE__ */ s(o.Indicator, { className:
|
|
24
|
+
children: /* @__PURE__ */ s(o.Indicator, { className: l, children: [
|
|
25
25
|
/* @__PURE__ */ t(
|
|
26
26
|
m,
|
|
27
27
|
{
|
|
@@ -1,57 +1,61 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { isValidElement as
|
|
5
|
-
import { useFondueTheme as
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "@radix-ui/react-popover";
|
|
3
|
+
import { Slot as C } from "@radix-ui/react-slot";
|
|
4
|
+
import { isValidElement as V } from "react";
|
|
5
|
+
import { useFondueTheme as g, ThemeProvider as A } from "./fondue-components28.js";
|
|
6
6
|
import n from "./fondue-components63.js";
|
|
7
|
-
import { recursiveMap as
|
|
8
|
-
const
|
|
9
|
-
highlightedIndex:
|
|
10
|
-
getMenuProps:
|
|
11
|
-
getItemProps:
|
|
12
|
-
children:
|
|
13
|
-
filterText:
|
|
14
|
-
align:
|
|
7
|
+
import { recursiveMap as D, getSelectOptionValue as M } from "./fondue-components78.js";
|
|
8
|
+
const T = ({
|
|
9
|
+
highlightedIndex: p,
|
|
10
|
+
getMenuProps: l,
|
|
11
|
+
getItemProps: m,
|
|
12
|
+
children: u,
|
|
13
|
+
filterText: c,
|
|
14
|
+
align: f,
|
|
15
15
|
side: d,
|
|
16
16
|
selectedItem: t,
|
|
17
|
-
hasInteractedSinceOpening: h
|
|
17
|
+
hasInteractedSinceOpening: h,
|
|
18
|
+
viewportCollisionPadding: v = "compact"
|
|
18
19
|
}) => {
|
|
19
|
-
const
|
|
20
|
+
const P = (e) => {
|
|
20
21
|
e.preventDefault();
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
}, O = {
|
|
23
|
+
compact: 8,
|
|
24
|
+
spacious: 24
|
|
25
|
+
}, N = g();
|
|
26
|
+
return /* @__PURE__ */ r(i.Portal, { children: /* @__PURE__ */ r(A, { theme: N, children: /* @__PURE__ */ r(
|
|
27
|
+
i.Content,
|
|
24
28
|
{
|
|
25
|
-
align:
|
|
29
|
+
align: f,
|
|
26
30
|
side: d,
|
|
27
|
-
collisionPadding:
|
|
28
|
-
onOpenAutoFocus:
|
|
31
|
+
collisionPadding: O[v] + 8,
|
|
32
|
+
onOpenAutoFocus: P,
|
|
29
33
|
className: n.portal,
|
|
30
|
-
children: /* @__PURE__ */
|
|
34
|
+
children: /* @__PURE__ */ r(
|
|
31
35
|
"ul",
|
|
32
36
|
{
|
|
33
37
|
className: n.menu,
|
|
34
|
-
...
|
|
38
|
+
...l({}, { suppressRefError: !0 }),
|
|
35
39
|
"data-has-interacted": h ? "true" : "false",
|
|
36
40
|
"data-test-id": "fondue-select-menu",
|
|
37
|
-
children:
|
|
38
|
-
|
|
39
|
-
(e,
|
|
40
|
-
if (((
|
|
41
|
+
children: D(
|
|
42
|
+
u,
|
|
43
|
+
(e, s) => {
|
|
44
|
+
if (((o) => (
|
|
41
45
|
// @ts-expect-error - We are explicitly checking for ref
|
|
42
|
-
|
|
46
|
+
V(o) && o.ref !== void 0
|
|
43
47
|
))(e)) {
|
|
44
|
-
const
|
|
45
|
-
item:
|
|
46
|
-
index:
|
|
48
|
+
const o = M(e.props), a = m({
|
|
49
|
+
item: o,
|
|
50
|
+
index: s,
|
|
47
51
|
...e.ref ? { ref: e.ref } : {}
|
|
48
52
|
});
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
|
|
53
|
+
return /* @__PURE__ */ r(
|
|
54
|
+
C,
|
|
51
55
|
{
|
|
52
56
|
className: n.item,
|
|
53
|
-
"data-highlighted":
|
|
54
|
-
"data-selected": (t == null ? void 0 : t.value) ===
|
|
57
|
+
"data-highlighted": p === s,
|
|
58
|
+
"data-selected": (t == null ? void 0 : t.value) === o.value,
|
|
55
59
|
onTouchStart: (S) => {
|
|
56
60
|
a.onClick && a.onClick(S);
|
|
57
61
|
},
|
|
@@ -62,15 +66,15 @@ const M = ({
|
|
|
62
66
|
);
|
|
63
67
|
}
|
|
64
68
|
},
|
|
65
|
-
|
|
69
|
+
c
|
|
66
70
|
).parsedChildren
|
|
67
71
|
}
|
|
68
72
|
)
|
|
69
73
|
}
|
|
70
74
|
) }) });
|
|
71
75
|
};
|
|
72
|
-
|
|
76
|
+
T.displayName = "Select.Menu";
|
|
73
77
|
export {
|
|
74
|
-
|
|
78
|
+
T as SelectMenu
|
|
75
79
|
};
|
|
76
80
|
//# sourceMappingURL=fondue-components61.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components61.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, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\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 * Defines the preferred side of the select. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side: 'left' | 'right' | 'bottom' | 'top';\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 side,\n selectedItem,\n hasInteractedSinceOpening,\n}: SelectMenuProps) => {\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n };\n\n const theme = useFondueTheme();\n return (\n <RadixPopover.Portal>\n <ThemeProvider theme={theme}>\n <RadixPopover.Content\n align={align}\n side={side}\n collisionPadding={
|
|
1
|
+
{"version":3,"file":"fondue-components61.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, type ForwardedRef, type MouseEvent, type ReactElement, type ReactNode } from 'react';\n\nimport { ThemeProvider, useFondueTheme } from '../ThemeProvider/ThemeProvider';\n\nimport { type SelectItemProps } from './SelectItem';\nimport styles from './styles/select.module.scss';\nimport { getSelectOptionValue, recursiveMap } from './utils';\n\nexport type SelectMenuViewportCollisionPadding = 'compact' | 'spacious';\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 * Defines the preferred side of the select. It will not be respected if there are collisions with the viewport.\n * @default \"bottom\"\n */\n side: 'left' | 'right' | 'bottom' | 'top';\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 * Define the minimum distance between the select menu and the viewport edge\n * @default 'compact'\n */\n viewportCollisionPadding?: SelectMenuViewportCollisionPadding;\n};\n\nexport const SelectMenu = ({\n highlightedIndex,\n getMenuProps,\n getItemProps,\n children,\n filterText,\n align,\n side,\n selectedItem,\n hasInteractedSinceOpening,\n viewportCollisionPadding = 'compact',\n}: SelectMenuProps) => {\n const handleOnOpenAutoFocus = (event: Event) => {\n event.preventDefault();\n };\n\n const VIEWPORT_COLLISION_PADDING_MAP: Record<SelectMenuViewportCollisionPadding, number> = {\n compact: 8,\n spacious: 24,\n };\n\n const theme = useFondueTheme();\n return (\n <RadixPopover.Portal>\n <ThemeProvider theme={theme}>\n <RadixPopover.Content\n align={align}\n side={side}\n collisionPadding={VIEWPORT_COLLISION_PADDING_MAP[viewportCollisionPadding] + 8}\n onOpenAutoFocus={handleOnOpenAutoFocus}\n className={styles.portal}\n >\n <ul\n className={styles.menu}\n // TODO: fix this accessibility issue\n // We are mounting/unmounting the menu on open/close\n // We should instead toggle its visibility for accessibility reasons\n // https://github.com/downshift-js/downshift?tab=readme-ov-file#getmenuprops\n {...getMenuProps({}, { suppressRefError: true })}\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 </ThemeProvider>\n </RadixPopover.Portal>\n );\n};\nSelectMenu.displayName = 'Select.Menu';\n"],"names":["SelectMenu","highlightedIndex","getMenuProps","getItemProps","children","filterText","align","side","selectedItem","hasInteractedSinceOpening","viewportCollisionPadding","handleOnOpenAutoFocus","event","VIEWPORT_COLLISION_PADDING_MAP","theme","useFondueTheme","RadixPopover","jsx","ThemeProvider","styles","recursiveMap","child","index","isValidElement","optionData","getSelectOptionValue","itemProps","RadixSlot"],"mappings":";;;;;;;AAwEO,MAAMA,IAAa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O;AAAA,oBAClB,oBAAkBlB,MAAqBqB;AAAA,oBACvC,kBAAed,KAAA,gBAAAA,EAAc,WAAUgB,EAAW;AAAA,oBAGlD,cAAc,CAACZ,MAAU;AACrB,sBAAIc,EAAU,WACVA,EAAU,QAAQd,CAA2C;AAAA,oBAErE;AAAA,oBACC,GAAGc;AAAA,oBAEH,UAAAL;AAAA,kBAAA;AAAA,kBATIA,EAAM,MAAM;AAAA,gBAUrB;AAAA,cAAA;AAAA,YAGZ;AAAA,YACAhB;AAAA,UAAA,EACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAEV;AAAA,KAER,EACJ,CAAA;AAER;AACAL,EAAW,cAAc;"}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { jsx as w } from "react/jsx-runtime";
|
|
2
2
|
import { IconCross as x } from "@frontify/fondue-icons";
|
|
3
|
-
import { useState as B, useMemo as i, Children as f, isValidElement as
|
|
4
|
-
import { ForwardedRefSelectItem as
|
|
3
|
+
import { useState as B, useMemo as i, Children as f, isValidElement as a, cloneElement as E, useCallback as v } from "react";
|
|
4
|
+
import { ForwardedRefSelectItem as F } from "./fondue-components60.js";
|
|
5
5
|
import { ForwardedRefSelectSlot as c } from "./fondue-components62.js";
|
|
6
|
-
import { getSelectOptionValue as
|
|
6
|
+
import { getSelectOptionValue as I } from "./fondue-components78.js";
|
|
7
7
|
const S = (r) => {
|
|
8
8
|
const t = [];
|
|
9
9
|
return f.forEach(r, (o) => {
|
|
10
|
-
if (
|
|
11
|
-
t.push(
|
|
12
|
-
else if (
|
|
13
|
-
const
|
|
14
|
-
for (const l of
|
|
10
|
+
if (a(o) && o.type === F)
|
|
11
|
+
t.push(I(o.props));
|
|
12
|
+
else if (a(o) && o.props.children) {
|
|
13
|
+
const u = S(o.props.children);
|
|
14
|
+
for (const l of u)
|
|
15
15
|
t.push(l);
|
|
16
16
|
}
|
|
17
17
|
}), t;
|
|
18
18
|
}, z = (r) => {
|
|
19
|
-
const [t, o] = B(""), { inputSlots:
|
|
19
|
+
const [t, o] = B(""), { inputSlots: u, menuSlots: l, itemValues: p, clearButton: V } = i(() => {
|
|
20
20
|
const s = [], n = [];
|
|
21
21
|
let m;
|
|
22
22
|
f.toArray(r).some(
|
|
23
|
-
(e) =>
|
|
23
|
+
(e) => a(e) && e.type === c
|
|
24
24
|
) ? f.forEach(r, (e) => {
|
|
25
|
-
|
|
25
|
+
a(e) && e.type === c && (e.props.name === "menu" ? n.push(e.props.children) : e.props.name === "left" || e.props.name === "right" ? s.push(e) : e.props.name === "clear" && (e.props.children ? m = e : m = E(e, { children: /* @__PURE__ */ w(x, { size: 16 }) })));
|
|
26
26
|
}) : n.push(r);
|
|
27
27
|
const g = S(n);
|
|
28
28
|
return { inputSlots: s, menuSlots: n, itemValues: g, clearButton: m };
|
|
@@ -31,7 +31,7 @@ const S = (r) => {
|
|
|
31
31
|
(s) => t === "" || s.label.toLowerCase().includes(t.toLowerCase())
|
|
32
32
|
),
|
|
33
33
|
[p, t]
|
|
34
|
-
), C =
|
|
34
|
+
), C = v(
|
|
35
35
|
(s) => s ? p.find((n) => n.value === s) : void 0,
|
|
36
36
|
[p]
|
|
37
37
|
);
|
|
@@ -39,7 +39,7 @@ const S = (r) => {
|
|
|
39
39
|
items: y,
|
|
40
40
|
menuSlots: l,
|
|
41
41
|
filterText: t,
|
|
42
|
-
inputSlots:
|
|
42
|
+
inputSlots: u,
|
|
43
43
|
clearButton: V,
|
|
44
44
|
setFilterText: o,
|
|
45
45
|
getItemByValue: C
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
const
|
|
2
|
-
root:
|
|
3
|
-
small:
|
|
4
|
-
medium:
|
|
1
|
+
const t = "_root_1a79q_5", _ = "_small_1a79q_13", a = "_medium_1a79q_17", o = "_large_1a79q_21", m = "_thumb_1a79q_58", s = {
|
|
2
|
+
root: t,
|
|
3
|
+
small: _,
|
|
4
|
+
medium: a,
|
|
5
5
|
large: o,
|
|
6
|
-
thumb:
|
|
6
|
+
thumb: m
|
|
7
7
|
};
|
|
8
8
|
export {
|
|
9
9
|
s as default,
|
|
10
10
|
o as large,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
a as medium,
|
|
12
|
+
t as root,
|
|
13
|
+
_ as small,
|
|
14
|
+
m as thumb
|
|
15
15
|
};
|
|
16
16
|
//# sourceMappingURL=fondue-components66.js.map
|
|
@@ -1,43 +1,46 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { Slot as
|
|
3
|
-
import { forwardRef as
|
|
4
|
-
import { ForwardedRefColorGradientInput as
|
|
5
|
-
import { ForwardedRefColorPickerInput as
|
|
6
|
-
import { ForwardedRefColorValueInput as
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
const
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { Slot as P } from "@radix-ui/react-slot";
|
|
3
|
+
import { forwardRef as F, useState as y, useMemo as N, Children as I } from "react";
|
|
4
|
+
import { ForwardedRefColorGradientInput as w } from "./fondue-components38.js";
|
|
5
|
+
import { ForwardedRefColorPickerInput as h } from "./fondue-components39.js";
|
|
6
|
+
import { ForwardedRefColorValueInput as G } from "./fondue-components40.js";
|
|
7
|
+
import V from "./fondue-components41.js";
|
|
8
|
+
import { DEFAULT_FORMAT as g, DEFAULT_COLOR as A, getColorWithName as s } from "./fondue-components42.js";
|
|
9
|
+
const p = ({
|
|
10
10
|
children: t,
|
|
11
|
-
currentColor:
|
|
12
|
-
onColorChange:
|
|
11
|
+
currentColor: r = A,
|
|
12
|
+
onColorChange: i = () => {
|
|
13
13
|
},
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
currentFormat: l,
|
|
15
|
+
onFormatChange: c = () => {
|
|
16
|
+
},
|
|
17
|
+
defaultFormat: n = g,
|
|
18
|
+
"data-test-id": f = "color-picker-input",
|
|
19
|
+
...C
|
|
20
|
+
}, u) => {
|
|
21
|
+
const [d, k] = y(n), m = N(() => l ?? d, [l, d]);
|
|
22
|
+
return /* @__PURE__ */ a("div", { className: V.root, "data-picker-type": "custom-color", "data-test-id": f, ref: u, children: I.map(t, (R) => /* @__PURE__ */ a(
|
|
23
|
+
L,
|
|
21
24
|
{
|
|
22
|
-
...
|
|
23
|
-
onColorChange: (
|
|
24
|
-
|
|
25
|
+
...C,
|
|
26
|
+
onColorChange: (o) => {
|
|
27
|
+
i(s(o, m));
|
|
25
28
|
},
|
|
26
|
-
currentColor:
|
|
27
|
-
currentFormat:
|
|
28
|
-
setCurrentFormat: (
|
|
29
|
-
|
|
29
|
+
currentColor: r,
|
|
30
|
+
currentFormat: m,
|
|
31
|
+
setCurrentFormat: (o) => {
|
|
32
|
+
k(o), c(o), i(s(r, o));
|
|
30
33
|
},
|
|
31
|
-
children:
|
|
34
|
+
children: R
|
|
32
35
|
}
|
|
33
36
|
)) });
|
|
34
37
|
};
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
Root:
|
|
38
|
-
Values:
|
|
39
|
-
Gradient:
|
|
40
|
-
Input:
|
|
38
|
+
p.displayName = "ColorPicker";
|
|
39
|
+
const L = ({ children: t, ...r }) => /* @__PURE__ */ a(P, { ...r, children: t }), M = F(p), e = {
|
|
40
|
+
Root: M,
|
|
41
|
+
Values: G,
|
|
42
|
+
Gradient: w,
|
|
43
|
+
Input: h
|
|
41
44
|
};
|
|
42
45
|
e.Root.displayName = "ColorPicker.Root";
|
|
43
46
|
e.Values.displayName = "ColorPicker.Values";
|
|
@@ -45,7 +48,7 @@ e.Gradient.displayName = "ColorPicker.Gradient";
|
|
|
45
48
|
e.Input.displayName = "ColorPicker.Input";
|
|
46
49
|
export {
|
|
47
50
|
e as ColorPicker,
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
p as ColorPickerRoot,
|
|
52
|
+
M as ForwardedRefColorPicker
|
|
50
53
|
};
|
|
51
54
|
//# sourceMappingURL=fondue-components7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fondue-components7.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The default format to use for the color input\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [
|
|
1
|
+
{"version":3,"file":"fondue-components7.js","sources":["../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { Slot as RadixSlot } from '@radix-ui/react-slot';\nimport { Children, forwardRef, useMemo, useState, type ForwardedRef, type ReactNode } from 'react';\n\nimport { ForwardedRefColorGradientInput } from './ColorGradientInput';\nimport { ForwardedRefColorPickerInput } from './ColorPickerInput';\nimport { ForwardedRefColorValueInput } from './ColorValueInput';\nimport styles from './styles/customColorPicker.module.scss';\nimport { type ColorFormat, type RgbaColor } from './types';\nimport { DEFAULT_COLOR, DEFAULT_FORMAT, getColorWithName } from './utils';\n\ntype ColorPickerProps = {\n /**\n * The children of the color picker component. This can contain multiple `ColorPicker.Values` or `ColorPicker.Gradient` components.\n */\n children?: ReactNode;\n /**\n * The active color in the color picker\n */\n currentColor?: RgbaColor;\n /**\n * Event handler called when the color changes\n */\n onColorChange?: (color: RgbaColor) => void;\n /**\n * The active color format in the color picker\n */\n currentFormat?: ColorFormat;\n /**\n * Event handler called when the color format changes\n */\n onFormatChange?: (format: ColorFormat) => void;\n /**\n * The default format to use for the color input when not controlled externally\n * @default \"HEX\"\n */\n defaultFormat?: ColorFormat;\n /**\n * The test id of the color picker\n */\n 'data-test-id'?: string;\n};\n\nexport const ColorPickerRoot = (\n {\n children,\n currentColor = DEFAULT_COLOR,\n onColorChange = () => {},\n currentFormat,\n onFormatChange = () => {},\n defaultFormat = DEFAULT_FORMAT,\n 'data-test-id': dataTestId = 'color-picker-input',\n ...props\n }: ColorPickerProps,\n forwardedRef: ForwardedRef<HTMLDivElement>,\n) => {\n const [managedFormat, setManagedFormat] = useState<ColorFormat>(defaultFormat);\n const activeFormat = useMemo(() => currentFormat ?? managedFormat, [currentFormat, managedFormat]);\n\n return (\n <div className={styles.root} data-picker-type=\"custom-color\" data-test-id={dataTestId} ref={forwardedRef}>\n {Children.map(children, (child) => (\n <ColorPickerSlot\n {...props}\n onColorChange={(color: RgbaColor) => {\n onColorChange(getColorWithName(color, activeFormat));\n }}\n currentColor={currentColor}\n currentFormat={activeFormat}\n setCurrentFormat={(currentFormat: ColorFormat) => {\n setManagedFormat(currentFormat);\n onFormatChange(currentFormat);\n onColorChange(getColorWithName(currentColor, currentFormat));\n }}\n >\n {child}\n </ColorPickerSlot>\n ))}\n </div>\n );\n};\nColorPickerRoot.displayName = 'ColorPicker';\n\ntype ColorPickerSlotProps = ColorPickerProps & {\n currentFormat?: ColorFormat;\n setCurrentFormat?: (format: ColorFormat) => void;\n};\nconst ColorPickerSlot = ({ children, ...props }: ColorPickerSlotProps) => <RadixSlot {...props}>{children}</RadixSlot>;\n\nexport const ForwardedRefColorPicker = forwardRef<HTMLDivElement, ColorPickerProps>(ColorPickerRoot);\n\nexport const ColorPicker = {\n Root: ForwardedRefColorPicker,\n Values: ForwardedRefColorValueInput,\n Gradient: ForwardedRefColorGradientInput,\n Input: ForwardedRefColorPickerInput,\n};\n\nColorPicker.Root.displayName = 'ColorPicker.Root';\nColorPicker.Values.displayName = 'ColorPicker.Values';\nColorPicker.Gradient.displayName = 'ColorPicker.Gradient';\nColorPicker.Input.displayName = 'ColorPicker.Input';\n"],"names":["ColorPickerRoot","children","currentColor","DEFAULT_COLOR","onColorChange","currentFormat","onFormatChange","defaultFormat","DEFAULT_FORMAT","dataTestId","props","forwardedRef","managedFormat","setManagedFormat","useState","activeFormat","useMemo","jsx","styles","Children","child","ColorPickerSlot","color","getColorWithName","RadixSlot","ForwardedRefColorPicker","forwardRef","ColorPicker","ForwardedRefColorValueInput","ForwardedRefColorGradientInput","ForwardedRefColorPickerInput"],"mappings":";;;;;;;;AA4CO,MAAMA,IAAkB,CAC3B;AAAA,EACI,UAAAC;AAAA,EACA,cAAAC,IAAeC;AAAA,EACf,eAAAC,IAAgB,MAAM;AAAA,EAAC;AAAA,EACvB,eAAAC;AAAA,EACA,gBAAAC,IAAiB,MAAM;AAAA,EAAC;AAAA,EACxB,eAAAC,IAAgBC;AAAA,EAChB,gBAAgBC,IAAa;AAAA,EAC7B,GAAGC;AACP,GACAC,MACC;AACD,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAsBP,CAAa,GACvEQ,IAAeC,EAAQ,MAAMX,KAAiBO,GAAe,CAACP,GAAeO,CAAa,CAAC;AAEjG,SACK,gBAAAK,EAAA,OAAA,EAAI,WAAWC,EAAO,MAAM,oBAAiB,gBAAe,gBAAcT,GAAY,KAAKE,GACvF,UAAAQ,EAAS,I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