@fuf-stack/uniform 2.0.0-next.1 → 2.0.0-next.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/Checkboxes/index.d.mts +57 -37
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +19 -20
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +71 -31
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +31 -29
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldArray/index.d.mts +8 -16
- package/dist/FieldArray/index.d.mts.map +1 -1
- package/dist/FieldArray/index.mjs +18 -32
- package/dist/FieldArray/index.mjs.map +1 -1
- package/dist/FieldCard/index.d.mts +0 -4
- package/dist/FieldCard/index.d.mts.map +1 -1
- package/dist/FieldCard/index.mjs +11 -19
- package/dist/FieldCard/index.mjs.map +1 -1
- package/dist/{FieldCopyTestIdButton-DV0tkdh2.mjs → FieldCopyTestIdButton-D3_jZYJ1.mjs} +3 -5
- package/dist/{FieldCopyTestIdButton-DV0tkdh2.mjs.map → FieldCopyTestIdButton-D3_jZYJ1.mjs.map} +1 -1
- package/dist/{FieldDescription-C4l0HKGL.mjs → FieldDescription-X_0s1Lhu.mjs} +5 -6
- package/dist/FieldDescription-X_0s1Lhu.mjs.map +1 -0
- package/dist/{FieldLabel-DKzqkuY1.mjs → FieldLabel-DrNWJIVh.mjs} +15 -12
- package/dist/FieldLabel-DrNWJIVh.mjs.map +1 -0
- package/dist/{FieldLayout-BLW5S-Jm.mjs → FieldLayout-DcvQU0zN.mjs} +4 -5
- package/dist/{FieldLayout-BLW5S-Jm.mjs.map → FieldLayout-DcvQU0zN.mjs.map} +1 -1
- package/dist/FieldReset/index.d.mts +420 -0
- package/dist/FieldReset/index.d.mts.map +1 -0
- package/dist/FieldReset/index.mjs +258 -0
- package/dist/FieldReset/index.mjs.map +1 -0
- package/dist/{FieldValidationError-DgkCL3cC.mjs → FieldValidationError-iAayfTEw.mjs} +3 -5
- package/dist/{FieldValidationError-DgkCL3cC.mjs.map → FieldValidationError-iAayfTEw.mjs.map} +1 -1
- package/dist/Form/index.d.mts +12 -14
- package/dist/Form/index.d.mts.map +1 -1
- package/dist/Form/index.mjs +7 -10
- package/dist/Form/index.mjs.map +1 -1
- package/dist/FormContext-BnNJYZOo.d.mts +124 -0
- package/dist/FormContext-BnNJYZOo.d.mts.map +1 -0
- package/dist/{FormContext-CHctWFAP.mjs → FormContext-PXkVlBdU.mjs} +5 -9
- package/dist/{FormContext-CHctWFAP.mjs.map → FormContext-PXkVlBdU.mjs.map} +1 -1
- package/dist/Grid/index.d.mts +0 -2
- package/dist/Grid/index.d.mts.map +1 -1
- package/dist/Grid/index.mjs +1 -1
- package/dist/{Grid-DfcZeuib.mjs → Grid-DBL29Kwb.mjs} +3 -5
- package/dist/{Grid-DfcZeuib.mjs.map → Grid-DBL29Kwb.mjs.map} +1 -1
- package/dist/Input/index.d.mts +167 -115
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +20 -24
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +226 -2222
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +24 -28
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +121 -66
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +16 -19
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +140 -2056
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +11 -14
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +154 -21
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +65 -49
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +143 -77
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +26 -18
- package/dist/Slider/index.mjs.map +1 -1
- package/dist/SubmitButton/index.d.mts +0 -2
- package/dist/SubmitButton/index.d.mts.map +1 -1
- package/dist/SubmitButton/index.mjs +2 -4
- package/dist/SubmitButton/index.mjs.map +1 -1
- package/dist/Switch/index.d.mts +1 -1
- package/dist/Switch/index.mjs +16 -18
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/{Switch-CvPO8IF9.d.mts → Switch-Db2dpGz7.d.mts} +115 -68
- package/dist/{Switch-CvPO8IF9.d.mts.map → Switch-Db2dpGz7.d.mts.map} +1 -1
- package/dist/SwitchBox/index.d.mts +169 -126
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +18 -18
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +100 -57
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +14 -16
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +44 -28
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +13 -17
- package/dist/Time/index.mjs.map +1 -1
- package/dist/helpers/index.d.mts +0 -6
- package/dist/helpers/index.d.mts.map +1 -1
- package/dist/helpers/index.mjs +3 -6
- package/dist/helpers/index.mjs.map +1 -1
- package/dist/hooks/useClientValidation/index.d.mts +0 -2
- package/dist/hooks/useClientValidation/index.d.mts.map +1 -1
- package/dist/hooks/useClientValidation/index.mjs +3 -5
- package/dist/hooks/useController/index.d.mts +0 -2
- package/dist/hooks/useController/index.d.mts.map +1 -1
- package/dist/hooks/useController/index.mjs +2 -3
- package/dist/hooks/useFormContext/index.d.mts +31 -52
- package/dist/hooks/useFormContext/index.d.mts.map +1 -1
- package/dist/hooks/useFormContext/index.mjs +2 -3
- package/dist/hooks/useInputValueDebounce/index.d.mts +0 -2
- package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
- package/dist/hooks/useInputValueDebounce/index.mjs +3 -5
- package/dist/hooks/useInputValueTransform/index.d.mts +1 -1
- package/dist/hooks/useInputValueTransform/index.mjs +2 -3
- package/dist/hooks/useWatchFormReset/index.d.mts +0 -2
- package/dist/hooks/useWatchFormReset/index.d.mts.map +1 -1
- package/dist/hooks/useWatchFormReset/index.mjs +3 -5
- package/dist/hooks/useWatchUserChange/index.d.mts +0 -2
- package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
- package/dist/hooks/useWatchUserChange/index.mjs +3 -5
- package/dist/{index-BS8IoBOn.d.mts → index-cevZBrIN.d.mts} +1 -3
- package/dist/index-cevZBrIN.d.mts.map +1 -0
- package/dist/partials/FieldCopyTestIdButton/index.d.mts +0 -2
- package/dist/partials/FieldCopyTestIdButton/index.d.mts.map +1 -1
- package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -1
- package/dist/partials/FieldValidationError/index.d.mts +11 -13
- package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
- package/dist/partials/FieldValidationError/index.mjs +1 -1
- package/dist/{radioControlVariants-Cm6WufWo.mjs → radioControlVariants-BYRfaD6y.mjs} +24 -25
- package/dist/radioControlVariants-BYRfaD6y.mjs.map +1 -0
- package/dist/{switchVariants-BaQw2DA7.mjs → switchVariants-D16b2VaT.mjs} +4 -4
- package/dist/{switchVariants-BaQw2DA7.mjs.map → switchVariants-D16b2VaT.mjs.map} +1 -1
- package/dist/{timeVariants-B9HDfNYt.mjs → timeVariants-CtXyNKmW.mjs} +3 -3
- package/dist/{timeVariants-B9HDfNYt.mjs.map → timeVariants-CtXyNKmW.mjs.map} +1 -1
- package/dist/{useController-BCFeZbBZ.mjs → useController-JtIeurpw.mjs} +3 -4
- package/dist/{useController-BCFeZbBZ.mjs.map → useController-JtIeurpw.mjs.map} +1 -1
- package/dist/{useFormContext-BPjJjNnM.mjs → useFormContext-piqnN2L-.mjs} +3 -4
- package/dist/useFormContext-piqnN2L-.mjs.map +1 -0
- package/dist/{useInputValueTransform-Mw8YEOXT.mjs → useInputValueTransform-CXWWFhy_.mjs} +2 -3
- package/dist/{useInputValueTransform-Mw8YEOXT.mjs.map → useInputValueTransform-CXWWFhy_.mjs.map} +1 -1
- package/package.json +8 -7
- package/dist/FieldDescription-C4l0HKGL.mjs.map +0 -1
- package/dist/FieldLabel-DKzqkuY1.mjs.map +0 -1
- package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
- package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
- package/dist/index-BS8IoBOn.d.mts.map +0 -1
- package/dist/radioControlVariants-Cm6WufWo.mjs.map +0 -1
- package/dist/useFormContext-BPjJjNnM.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Select/selectVariants.ts","../../src/Select/Select.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Select/selectVariants.ts","../../src/Select/Select.tsx"],"mappings":";;;;qBAIa,kBAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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B;;EAEf;;;;;EAKA;;EAEA,QAAQ;;EAER;;UAGe;;EAEf;;EAEA,YAAY;;EAEZ;;EAEA;;EAGA,cAAc;;EAEd;;EAEA,6BACgB,SAAS,cAAc;;EAEvC;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;EAEA,gBAAgB;;EAEhB,SAAS;;EAET;;EAEA;;EAEA,qBAAqB;;EAErB,gCAAgC;;;;;;;;EAQhC,yBAAyB,eAAe;;EAExC;;EAEA,YAAY;;;cAIR,WAAU,WAAA,WAAA,eAAA,cAAA,YAAA,SAAA,aAAA,MAAA,eAAA,SAAA,aAAA,oBAAA,mBAAA,2BAAA,qBAgBb,gCAAW,IAAA"}
|
package/dist/Select/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { n as useFormContext } from "../useFormContext-piqnN2L-.mjs";
|
|
2
|
+
import { n as useUniformField } from "../FieldLabel-DrNWJIVh.mjs";
|
|
3
|
+
import { n as getFieldControlProps, r as getFieldDataAttributes } from "../FieldDescription-X_0s1Lhu.mjs";
|
|
4
|
+
import { t as FieldLayout } from "../FieldLayout-DcvQU0zN.mjs";
|
|
1
5
|
import { createOptionValueConverter, isValueEmpty } from "../helpers/index.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import { n as useUniformField } from "../FieldLabel-DKzqkuY1.mjs";
|
|
4
|
-
import { n as getFieldControlProps, r as getFieldDataAttributes } from "../FieldDescription-C4l0HKGL.mjs";
|
|
5
|
-
import { t as FieldLayout } from "../FieldLayout-BLW5S-Jm.mjs";
|
|
6
|
-
import { createContext, useContext, useState } from "react";
|
|
6
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
7
7
|
import { jsx } from "react/jsx-runtime";
|
|
8
8
|
import { slugify, tv } from "@fuf-stack/pixel-utils";
|
|
9
9
|
import { useStyling } from "@fuf-stack/pixels/StylingProvider";
|
|
10
10
|
import ReactSelect, { components } from "react-select";
|
|
11
|
-
|
|
11
|
+
// src/Select/selectVariants.ts
|
|
12
12
|
const selectVariants = tv({
|
|
13
13
|
slots: {
|
|
14
14
|
base: [
|
|
@@ -57,12 +57,22 @@ const selectVariants = tv({
|
|
|
57
57
|
valueContainer: "gap-1 p-1"
|
|
58
58
|
},
|
|
59
59
|
variants: {
|
|
60
|
-
disabled: { true: {
|
|
61
|
-
|
|
60
|
+
disabled: { true: {
|
|
61
|
+
base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed",
|
|
62
|
+
clearIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500",
|
|
63
|
+
control: "hover:border-default-200",
|
|
64
|
+
dropdownIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500"
|
|
65
|
+
} },
|
|
66
|
+
invalid: { true: { selectedValue: "text-danger!" } },
|
|
67
|
+
readOnly: { true: {
|
|
68
|
+
base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed",
|
|
69
|
+
clearIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500",
|
|
70
|
+
control: "hover:border-default-200",
|
|
71
|
+
dropdownIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500"
|
|
72
|
+
} }
|
|
62
73
|
}
|
|
63
74
|
});
|
|
64
|
-
|
|
65
|
-
//#region src/Select/helpers/getSelectClassNames.ts
|
|
75
|
+
// src/Select/helpers/getSelectClassNames.ts
|
|
66
76
|
/** Maps resolved Uniform slots to React Select's class callbacks */
|
|
67
77
|
const getSelectClassNames = (classNames, cn, isFocused, invalid) => {
|
|
68
78
|
return {
|
|
@@ -138,8 +148,7 @@ const getSelectClassNames = (classNames, cn, isFocused, invalid) => {
|
|
|
138
148
|
}
|
|
139
149
|
};
|
|
140
150
|
};
|
|
141
|
-
|
|
142
|
-
//#region src/Select/helpers/resolveSelectValue.ts
|
|
151
|
+
// src/Select/helpers/resolveSelectValue.ts
|
|
143
152
|
/** Finds selected options, preserving fallback labels for asynchronous searches */
|
|
144
153
|
const resolveSelectValue = (value, options, multiSelect, selectedOptionFallback) => {
|
|
145
154
|
const findOption = (v) => {
|
|
@@ -170,14 +179,12 @@ const resolveSelectValue = (value, options, multiSelect, selectedOptionFallback)
|
|
|
170
179
|
if (isValueEmpty(value)) return null;
|
|
171
180
|
return findOption(value);
|
|
172
181
|
};
|
|
173
|
-
|
|
174
|
-
//#region src/Select/subcomponents/SelectContext.ts
|
|
182
|
+
// src/Select/subcomponents/SelectContext.ts
|
|
175
183
|
/** Resolved slot classes shared with the select's engine adapters */
|
|
176
184
|
const SelectSlotContext = createContext({});
|
|
177
185
|
/** Native input associations supplied by the field binding */
|
|
178
186
|
const SelectControlContext = createContext({});
|
|
179
|
-
|
|
180
|
-
//#region src/Select/subcomponents/SelectCrossIcon.tsx
|
|
187
|
+
// src/Select/subcomponents/SelectCrossIcon.tsx
|
|
181
188
|
/** Bind the declared icon/container slots to React Select's corresponding elements. */
|
|
182
189
|
const SelectCrossIcon = (props) => {
|
|
183
190
|
const { className } = props;
|
|
@@ -188,16 +195,14 @@ const SelectCrossIcon = (props) => {
|
|
|
188
195
|
className: cn(className, slots.crossIcon)
|
|
189
196
|
});
|
|
190
197
|
};
|
|
191
|
-
|
|
192
|
-
//#region src/Select/subcomponents/SelectClearIndicator.tsx
|
|
198
|
+
// src/Select/subcomponents/SelectClearIndicator.tsx
|
|
193
199
|
const SelectClearIndicator = (props) => {
|
|
194
200
|
return /* @__PURE__ */ jsx(components.ClearIndicator, {
|
|
195
201
|
...props,
|
|
196
202
|
children: /* @__PURE__ */ jsx(SelectCrossIcon, {})
|
|
197
203
|
});
|
|
198
204
|
};
|
|
199
|
-
|
|
200
|
-
//#region src/Select/subcomponents/SelectDownChevron.tsx
|
|
205
|
+
// src/Select/subcomponents/SelectDownChevron.tsx
|
|
201
206
|
const SelectDownChevron = (props) => {
|
|
202
207
|
const { className } = props;
|
|
203
208
|
const slots = useContext(SelectSlotContext);
|
|
@@ -207,8 +212,7 @@ const SelectDownChevron = (props) => {
|
|
|
207
212
|
className: cn(className, slots.downChevron)
|
|
208
213
|
});
|
|
209
214
|
};
|
|
210
|
-
|
|
211
|
-
//#region src/Select/subcomponents/SelectDropdownIndicator.tsx
|
|
215
|
+
// src/Select/subcomponents/SelectDropdownIndicator.tsx
|
|
212
216
|
/** Wraps the dropdown indicator with a predictable test id for automation. */
|
|
213
217
|
const SelectDropdownIndicator = (props) => {
|
|
214
218
|
const testId = props?.selectProps["data-testid"];
|
|
@@ -220,8 +224,7 @@ const SelectDropdownIndicator = (props) => {
|
|
|
220
224
|
})
|
|
221
225
|
});
|
|
222
226
|
};
|
|
223
|
-
|
|
224
|
-
//#region src/Select/subcomponents/SelectInput.tsx
|
|
227
|
+
// src/Select/subcomponents/SelectInput.tsx
|
|
225
228
|
/** Mirrors the select test id onto the underlying react-select input element. */
|
|
226
229
|
const SelectInput = (props) => {
|
|
227
230
|
const associations = useContext(SelectControlContext);
|
|
@@ -235,8 +238,7 @@ const SelectInput = (props) => {
|
|
|
235
238
|
"data-testid": testId
|
|
236
239
|
});
|
|
237
240
|
};
|
|
238
|
-
|
|
239
|
-
//#region src/Select/subcomponents/SelectInputControl.tsx
|
|
241
|
+
// src/Select/subcomponents/SelectInputControl.tsx
|
|
240
242
|
/** Wraps the control root to expose a stable `*_select` test id hook. */
|
|
241
243
|
const SelectInputControl = (props) => {
|
|
242
244
|
const testId = `${props.selectProps["data-testid"]}_select`;
|
|
@@ -245,8 +247,7 @@ const SelectInputControl = (props) => {
|
|
|
245
247
|
children: /* @__PURE__ */ jsx(components.Control, { ...props })
|
|
246
248
|
});
|
|
247
249
|
};
|
|
248
|
-
|
|
249
|
-
//#region src/Select/subcomponents/SelectMultiValueContainer.tsx
|
|
250
|
+
// src/Select/subcomponents/SelectMultiValueContainer.tsx
|
|
250
251
|
const SelectMultiValueContainer = (props) => {
|
|
251
252
|
const slots = useContext(SelectSlotContext);
|
|
252
253
|
const { cn } = useStyling();
|
|
@@ -259,16 +260,14 @@ const SelectMultiValueContainer = (props) => {
|
|
|
259
260
|
}
|
|
260
261
|
});
|
|
261
262
|
};
|
|
262
|
-
|
|
263
|
-
//#region src/Select/subcomponents/SelectMultiValueRemove.tsx
|
|
263
|
+
// src/Select/subcomponents/SelectMultiValueRemove.tsx
|
|
264
264
|
const SelectMultiValueRemove = (props) => {
|
|
265
265
|
return /* @__PURE__ */ jsx(components.MultiValueRemove, {
|
|
266
266
|
...props,
|
|
267
267
|
children: /* @__PURE__ */ jsx(SelectCrossIcon, { size: 14 })
|
|
268
268
|
});
|
|
269
269
|
};
|
|
270
|
-
|
|
271
|
-
//#region src/Select/subcomponents/SelectOption.tsx
|
|
270
|
+
// src/Select/subcomponents/SelectOption.tsx
|
|
272
271
|
/** Adds deterministic option test ids and forwards disabled state semantics. */
|
|
273
272
|
const SelectOption = (props) => {
|
|
274
273
|
const { isDisabled } = props;
|
|
@@ -279,8 +278,7 @@ const SelectOption = (props) => {
|
|
|
279
278
|
children: /* @__PURE__ */ jsx(components.Option, { ...props })
|
|
280
279
|
});
|
|
281
280
|
};
|
|
282
|
-
|
|
283
|
-
//#region src/Select/subcomponents/SelectCombobox.tsx
|
|
281
|
+
// src/Select/subcomponents/SelectCombobox.tsx
|
|
284
282
|
const selectComponents = {
|
|
285
283
|
Control: SelectInputControl,
|
|
286
284
|
ClearIndicator: SelectClearIndicator,
|
|
@@ -291,6 +289,14 @@ const selectComponents = {
|
|
|
291
289
|
Input: SelectInput,
|
|
292
290
|
Option: SelectOption
|
|
293
291
|
};
|
|
292
|
+
/** Hides React Select actions that would change a read-only selection */
|
|
293
|
+
const HiddenSelectAction = () => {
|
|
294
|
+
return null;
|
|
295
|
+
};
|
|
296
|
+
const readOnlySelectComponents = {
|
|
297
|
+
...selectComponents,
|
|
298
|
+
MultiValueRemove: HiddenSelectAction
|
|
299
|
+
};
|
|
294
300
|
/**
|
|
295
301
|
* Searchable option engine with value conversion, menu slots and touched timing
|
|
296
302
|
*
|
|
@@ -299,8 +305,15 @@ const selectComponents = {
|
|
|
299
305
|
const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field, filterOption, getIsTouched, inputValue, loading, multiSelect = false, onInputChange, options, placeholder, renderEmptyOptions, renderOptionLabel, selectedOptionFallback }) => {
|
|
300
306
|
const styling = useStyling();
|
|
301
307
|
const [isFocused, setIsFocused] = useState(false);
|
|
302
|
-
const { disabled, ids, invalid, name, onBlur, onChange: onValueChange, ref: inputRef, testId, value } = field;
|
|
308
|
+
const { disabled, ids, invalid, name, onBlur, onChange: onValueChange, readOnly, ref: inputRef, testId, value } = field;
|
|
303
309
|
const controlProps = getFieldControlProps(field);
|
|
310
|
+
const inputAssociations = useMemo(() => {
|
|
311
|
+
return {
|
|
312
|
+
...controlProps,
|
|
313
|
+
"aria-readonly": readOnly || void 0
|
|
314
|
+
};
|
|
315
|
+
}, [controlProps, readOnly]);
|
|
316
|
+
const isClearable = !!clearable && !readOnly;
|
|
304
317
|
const { convertToOriginalType } = createOptionValueConverter(options);
|
|
305
318
|
const reactSelectClassNames = getSelectClassNames(classNames, styling.cn, isFocused, invalid);
|
|
306
319
|
const reactSelectOptions = options.map((option) => {
|
|
@@ -311,6 +324,7 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
311
324
|
});
|
|
312
325
|
const reactSelectValue = resolveSelectValue(value, options, multiSelect, selectedOptionFallback);
|
|
313
326
|
const handleChange = (option) => {
|
|
327
|
+
if (readOnly) return;
|
|
314
328
|
if (multiSelect) onValueChange(option?.map((selectedOption) => {
|
|
315
329
|
return convertToOriginalType(selectedOption.value);
|
|
316
330
|
}));
|
|
@@ -322,6 +336,9 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
322
336
|
onBlur();
|
|
323
337
|
});
|
|
324
338
|
};
|
|
339
|
+
let menuIsOpen;
|
|
340
|
+
if (readOnly) menuIsOpen = false;
|
|
341
|
+
else if (debugMenuOpen) menuIsOpen = true;
|
|
325
342
|
const handleBlur = () => {
|
|
326
343
|
setIsFocused(false);
|
|
327
344
|
onBlur();
|
|
@@ -330,7 +347,7 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
330
347
|
setIsFocused(true);
|
|
331
348
|
};
|
|
332
349
|
return /* @__PURE__ */ jsx(SelectControlContext.Provider, {
|
|
333
|
-
value:
|
|
350
|
+
value: inputAssociations,
|
|
334
351
|
children: /* @__PURE__ */ jsx(SelectSlotContext.Provider, {
|
|
335
352
|
value: classNames,
|
|
336
353
|
children: /* @__PURE__ */ jsx(ReactSelect, {
|
|
@@ -339,19 +356,21 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
339
356
|
"aria-invalid": invalid,
|
|
340
357
|
"aria-label": controlProps["aria-label"],
|
|
341
358
|
"aria-labelledby": controlProps["aria-labelledby"],
|
|
359
|
+
backspaceRemovesValue: !readOnly,
|
|
342
360
|
classNames: reactSelectClassNames,
|
|
343
|
-
components: selectComponents,
|
|
361
|
+
components: readOnly ? readOnlySelectComponents : selectComponents,
|
|
344
362
|
"data-testid": testId,
|
|
345
363
|
filterOption,
|
|
346
364
|
formatOptionLabel: renderOptionLabel,
|
|
347
365
|
inputId: ids.control,
|
|
348
|
-
inputValue,
|
|
366
|
+
inputValue: readOnly ? "" : inputValue,
|
|
349
367
|
instanceId: ids.control,
|
|
350
|
-
isClearable
|
|
368
|
+
isClearable,
|
|
351
369
|
isDisabled: disabled,
|
|
352
370
|
isLoading: loading,
|
|
353
371
|
isMulti: multiSelect,
|
|
354
|
-
|
|
372
|
+
isSearchable: !readOnly,
|
|
373
|
+
menuIsOpen,
|
|
355
374
|
menuPosition: "fixed",
|
|
356
375
|
menuShouldBlockScroll: true,
|
|
357
376
|
name,
|
|
@@ -368,15 +387,15 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
368
387
|
})
|
|
369
388
|
});
|
|
370
389
|
};
|
|
371
|
-
|
|
372
|
-
//#region src/Select/subcomponents/SelectControl.tsx
|
|
390
|
+
// src/Select/subcomponents/SelectControl.tsx
|
|
373
391
|
/** Searchable selection field layout and styling around the option engine */
|
|
374
392
|
const SelectControl = ({ className, field, ...props }) => {
|
|
375
393
|
const styling = useStyling();
|
|
376
|
-
const { description, disabled, errorMessage, ids, invalid, label, required, testId } = field;
|
|
394
|
+
const { description, disabled, errorMessage, ids, invalid, label, readOnly, required, testId } = field;
|
|
377
395
|
const variants = styling.resolve(selectVariants, {
|
|
378
396
|
disabled,
|
|
379
|
-
invalid
|
|
397
|
+
invalid,
|
|
398
|
+
readOnly
|
|
380
399
|
});
|
|
381
400
|
const classNames = styling.variantsToClassNames(variants, className, "base");
|
|
382
401
|
return /* @__PURE__ */ jsx(FieldLayout, {
|
|
@@ -399,8 +418,7 @@ const SelectControl = ({ className, field, ...props }) => {
|
|
|
399
418
|
})
|
|
400
419
|
});
|
|
401
420
|
};
|
|
402
|
-
|
|
403
|
-
//#region src/Select/Select.tsx
|
|
421
|
+
// src/Select/Select.tsx
|
|
404
422
|
/** Form selection field with searchable single or multiple options */
|
|
405
423
|
const Select = ({ className = void 0, clearable = true, debugMenuOpen = false, filterOption = void 0, inputValue = void 0, loading = false, multiSelect = false, name, onInputChange = void 0, options, placeholder = void 0, renderEmptyOptions = void 0, renderOptionLabel = void 0, selectedOptionFallback = void 0, ...uniformFieldProps }) => {
|
|
406
424
|
const { getFieldState } = useFormContext();
|
|
@@ -430,10 +448,8 @@ const Select = ({ className = void 0, clearable = true, debugMenuOpen = false, f
|
|
|
430
448
|
selectedOptionFallback
|
|
431
449
|
});
|
|
432
450
|
};
|
|
433
|
-
|
|
434
|
-
//#region src/Select/index.ts
|
|
451
|
+
// src/Select/index.ts
|
|
435
452
|
var Select_default = Select;
|
|
436
|
-
//#endregion
|
|
437
453
|
export { Select_default as default, selectVariants };
|
|
438
454
|
|
|
439
455
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/Select/selectVariants.ts","../../src/Select/helpers/getSelectClassNames.ts","../../src/Select/helpers/resolveSelectValue.ts","../../src/Select/subcomponents/SelectContext.ts","../../src/Select/subcomponents/SelectCrossIcon.tsx","../../src/Select/subcomponents/SelectClearIndicator.tsx","../../src/Select/subcomponents/SelectDownChevron.tsx","../../src/Select/subcomponents/SelectDropdownIndicator.tsx","../../src/Select/subcomponents/SelectInput.tsx","../../src/Select/subcomponents/SelectInputControl.tsx","../../src/Select/subcomponents/SelectMultiValueContainer.tsx","../../src/Select/subcomponents/SelectMultiValueRemove.tsx","../../src/Select/subcomponents/SelectOption.tsx","../../src/Select/subcomponents/SelectCombobox.tsx","../../src/Select/subcomponents/SelectControl.tsx","../../src/Select/Select.tsx","../../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const selectVariants = tv({\n slots: {\n base: [\n // Enables group-data selectors used by child slots.\n 'group',\n // Make field wrappers align with other form controls.\n 'flex w-full flex-col',\n // Keep label/control vertical rhythm consistent.\n 'gap-y-1.5',\n // Preserve existing text flow for select content.\n 'leading-normal',\n ],\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control: [\n // control surface and transition\n 'duration-150! min-h-10 rounded-lg border-2 border-default-200 bg-content1 transition-background',\n // hover and validation borders\n 'hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n control_focused: 'border-focus',\n crossIcon: '',\n description: 'text-foreground-500 text-tiny',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n errorMessage: 'text-danger text-tiny',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n helperWrapper: 'relative flex flex-col gap-1.5 p-0',\n indicatorSeparator: 'bg-default-300',\n indicatorsContainer: 'gap-1 p-1',\n input: 'py-0.5 pl-1',\n label: [\n // label interaction and typography\n 'pointer-events-auto inline-flex cursor-default text-sm text-foreground subpixel-antialiased',\n // validation color\n 'group-data-[invalid=true]:!text-danger',\n ],\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n menuPortal: 'z-50!',\n multiValue: 'h-6 items-center gap-1.5 rounded bg-default-100 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0 leading-5',\n multiValueRemove: [\n // remove button layout and appearance\n 'flex h-5 w-5 items-center justify-center rounded text-default-500',\n // hover feedback\n 'hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n ],\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_disabled:\n 'cursor-not-allowed! hover:cursor-not-allowed! opacity-disabled',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n selectedValue: 'w-full truncate text-start font-normal text-small',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n variants: {\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n invalid: { true: { selectedValue: 'text-danger!' } },\n },\n});\n\nexport type VariantProps = TVProps<typeof selectVariants>;\n\nexport type ClassName = TVClassName<typeof selectVariants>;\n\nexport type SelectClassNames = Record<\n keyof ReturnType<typeof selectVariants>,\n string\n>;\n","import type { useStyling } from '@fuf-stack/pixels/StylingProvider';\nimport type { SelectClassNames } from '../selectVariants';\n\n/** Maps resolved Uniform slots to React Select's class callbacks */\nconst getSelectClassNames = (\n classNames: SelectClassNames,\n cn: ReturnType<typeof useStyling>['cn'],\n isFocused: boolean,\n invalid: boolean,\n) => {\n // React-select classNames configuration\n return {\n container: () => {\n return classNames.selectContainer;\n },\n group: () => {\n return classNames.group;\n },\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n input: () => {\n return classNames.input;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(classNames.selectedValue, classNames.multiValueLabel);\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isDisabled: optionIsDisabled,\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }: {\n isDisabled: boolean;\n isFocused: boolean;\n isSelected: boolean;\n }) => {\n return cn(classNames.option, {\n [classNames.option_disabled]: optionIsDisabled,\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.selectedValue, classNames.singleValue);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n };\n};\n\nexport default getSelectClassNames;\n","import type { SelectOption } from '../Select';\n\nimport { isValueEmpty } from '../../helpers';\n\n/** Finds selected options, preserving fallback labels for asynchronous searches */\nconst resolveSelectValue = (\n value: unknown,\n options: SelectOption[],\n multiSelect: boolean,\n selectedOptionFallback: SelectOption | SelectOption[] | undefined,\n) => {\n // Helper to find option by value\n const findOption = (v: string | number): SelectOption => {\n // First, look in options list\n const inOptions = options.find((option) => {\n return String(option.value) === String(v);\n });\n if (inOptions) {\n return inOptions;\n }\n\n // Second, look in selectedOptionFallback prop (for async selects)\n if (selectedOptionFallback) {\n if (Array.isArray(selectedOptionFallback)) {\n const inSelected = selectedOptionFallback.find((option) => {\n return String(option.value) === String(v);\n });\n if (inSelected) {\n return inSelected;\n }\n } else if (String(selectedOptionFallback.value) === String(v)) {\n return selectedOptionFallback;\n }\n }\n\n // Fallback: create option with value as label, marked as fallback\n return { isFallback: true, label: String(v), value: v };\n };\n\n if (multiSelect) {\n if (!Array.isArray(value) || isValueEmpty(value)) {\n return [];\n }\n return value.map((v) => {\n return findOption(v);\n });\n }\n\n // Single select - use isValueEmpty to handle marker strings (__NULL__, etc.)\n if (isValueEmpty(value)) {\n return null;\n }\n return findOption(value as string | number);\n};\n\nexport default resolveSelectValue;\n","import type { HTMLAttributes } from 'react';\n\nimport { createContext } from 'react';\n\n/** Resolved slot classes shared with the select's engine adapters */\nexport const SelectSlotContext = createContext<Record<string, string>>({});\n\n/** Native input associations supplied by the field binding */\nexport const SelectControlContext = createContext<\n HTMLAttributes<HTMLInputElement>\n>({});\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { SelectSlotContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectCrossIconProps = Parameters<typeof components.CrossIcon>[0];\n\n/** Bind the declared icon/container slots to React Select's corresponding elements. */\nconst SelectCrossIcon = (props: SelectCrossIconProps) => {\n const { className } = props;\n const slots = useContext(SelectSlotContext);\n const { cn } = useStyling();\n return (\n <components.CrossIcon\n {...props}\n className={cn(className, slots.crossIcon)}\n />\n );\n};\n\nexport default SelectCrossIcon;\n","import { components } from 'react-select';\n\nimport SelectCrossIcon from './SelectCrossIcon';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectClearIndicatorProps = Parameters<\n typeof components.ClearIndicator\n>[0];\n\nconst SelectClearIndicator = (props: SelectClearIndicatorProps) => {\n return (\n <components.ClearIndicator {...props}>\n <SelectCrossIcon />\n </components.ClearIndicator>\n );\n};\n\nexport default SelectClearIndicator;\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { SelectSlotContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectDownChevronProps = Parameters<typeof components.DownChevron>[0];\n\nconst SelectDownChevron = (props: SelectDownChevronProps) => {\n const { className } = props;\n const slots = useContext(SelectSlotContext);\n const { cn } = useStyling();\n return (\n <components.DownChevron\n {...props}\n className={cn(className, slots.downChevron)}\n />\n );\n};\n\nexport default SelectDownChevron;\n","import { components } from 'react-select';\n\nimport SelectDownChevron from './SelectDownChevron';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectDropdownIndicatorProps = Parameters<\n typeof components.DropdownIndicator\n>[0];\n\n/** Wraps the dropdown indicator with a predictable test id for automation. */\nconst SelectDropdownIndicator = (props: SelectDropdownIndicatorProps) => {\n // @ts-expect-error data-testid is not a default prop\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n <components.DropdownIndicator {...props}>\n <SelectDownChevron />\n </components.DropdownIndicator>\n </div>\n );\n};\n\nexport default SelectDropdownIndicator;\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { SelectControlContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectInputProps = Parameters<typeof components.Input>[0];\n\n/** Mirrors the select test id onto the underlying react-select input element. */\nconst SelectInput = (props: SelectInputProps) => {\n const associations = useContext(SelectControlContext);\n\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n\n const { 'aria-describedby': engineDescription } = props;\n const describedBy =\n [engineDescription, associations['aria-describedby']]\n .filter(Boolean)\n .join(' ') || undefined;\n return (\n <components.Input\n {...props}\n {...associations}\n aria-describedby={describedBy}\n data-testid={testId}\n />\n );\n};\n\nexport default SelectInput;\n","import { components } from 'react-select';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectInputControlProps = Parameters<typeof components.Control>[0];\n\n/** Wraps the control root to expose a stable `*_select` test id hook. */\nconst SelectInputControl = (props: SelectInputControlProps) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n\n return (\n <div data-testid={testId}>\n <components.Control {...props} />\n </div>\n );\n};\n\nexport default SelectInputControl;\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { SelectSlotContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectMultiValueContainerProps = Parameters<\n typeof components.MultiValueContainer\n>[0];\n\nconst SelectMultiValueContainer = (props: SelectMultiValueContainerProps) => {\n const slots = useContext(SelectSlotContext);\n const { cn } = useStyling();\n\n const { innerProps } = props;\n return (\n <components.MultiValueContainer\n {...props}\n innerProps={{\n ...innerProps,\n className: cn(innerProps.className, slots.multiValueContainer),\n }}\n />\n );\n};\n\nexport default SelectMultiValueContainer;\n","import { components } from 'react-select';\n\nimport SelectCrossIcon from './SelectCrossIcon';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectMultiValueRemoveProps = Parameters<\n typeof components.MultiValueRemove\n>[0];\n\nconst SelectMultiValueRemove = (props: SelectMultiValueRemoveProps) => {\n return (\n <components.MultiValueRemove {...props}>\n <SelectCrossIcon size={14} />\n </components.MultiValueRemove>\n );\n};\n\nexport default SelectMultiValueRemove;\n","import { components } from 'react-select';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectOptionProps = Parameters<typeof components.Option>[0];\n\n/** Adds deterministic option test ids and forwards disabled state semantics. */\nconst SelectOption = (props: SelectOptionProps) => {\n const { isDisabled } = props;\n\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div aria-disabled={isDisabled ? true : undefined} data-testid={testId}>\n <components.Option {...props} />\n </div>\n );\n};\n\nexport default SelectOption;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SelectOption as SelectOptionData, SelectProps } from '../Select';\nimport type { SelectClassNames } from '../selectVariants';\n\nimport { useState } from 'react';\nimport ReactSelect from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { createOptionValueConverter } from '../../helpers';\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport getSelectClassNames from '../helpers/getSelectClassNames';\nimport resolveSelectValue from '../helpers/resolveSelectValue';\nimport SelectClearIndicator from './SelectClearIndicator';\nimport { SelectControlContext, SelectSlotContext } from './SelectContext';\nimport SelectDownChevron from './SelectDownChevron';\nimport SelectDropdownIndicator from './SelectDropdownIndicator';\nimport SelectInput from './SelectInput';\nimport SelectInputControl from './SelectInputControl';\nimport SelectMultiValueContainer from './SelectMultiValueContainer';\nimport SelectMultiValueRemove from './SelectMultiValueRemove';\nimport SelectOption from './SelectOption';\n\nconst selectComponents = {\n Control: SelectInputControl,\n ClearIndicator: SelectClearIndicator,\n MultiValueRemove: SelectMultiValueRemove,\n DownChevron: SelectDownChevron,\n MultiValueContainer: SelectMultiValueContainer,\n DropdownIndicator: SelectDropdownIndicator,\n Input: SelectInput,\n Option: SelectOption,\n};\n\ninterface SelectComboboxProps extends Omit<\n SelectProps,\n keyof UniformField | 'className' | 'transform'\n> {\n /** CSS class name */\n className: SelectClassNames;\n /** Bound field values, interactions and metadata */\n field: UniformField;\n /** Reads the current touched state after a selection commits */\n getIsTouched: () => boolean;\n}\n\n/**\n * Searchable option engine with value conversion, menu slots and touched timing\n *\n * @see https://react-select.com/components\n */\nconst SelectCombobox = ({\n className: classNames,\n clearable,\n debugMenuOpen,\n field,\n filterOption,\n getIsTouched,\n inputValue,\n loading,\n multiSelect = false,\n onInputChange,\n options,\n placeholder,\n renderEmptyOptions,\n renderOptionLabel,\n selectedOptionFallback,\n}: SelectComboboxProps) => {\n const styling = useStyling();\n const [isFocused, setIsFocused] = useState(false);\n\n const {\n disabled,\n ids,\n invalid,\n name,\n onBlur,\n onChange: onValueChange,\n ref: inputRef,\n testId,\n value,\n } = field;\n const controlProps = getFieldControlProps(field);\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const reactSelectClassNames = getSelectClassNames(\n classNames,\n styling.cn,\n isFocused,\n invalid,\n );\n\n // adapt option disabled state for react-select\n const reactSelectOptions = options.map((option) => {\n return {\n ...option,\n isDisabled: option.disabled,\n };\n });\n\n const reactSelectValue = resolveSelectValue(\n value,\n options,\n multiSelect,\n selectedOptionFallback,\n );\n\n // convert React Select options into the original value types\n const handleChange = (option: unknown) => {\n if (multiSelect) {\n onValueChange(\n (option as SelectOptionData[])?.map((selectedOption) => {\n return convertToOriginalType(selectedOption.value);\n }),\n );\n } else {\n const nextValue = (option as SelectOptionData)?.value;\n\n // an empty single selection is stored as null\n onValueChange(\n nextValue != null ? convertToOriginalType(nextValue) : null,\n );\n }\n\n // defer the first touched update so validation reads the committed selection\n if (!getIsTouched()) {\n queueMicrotask(() => {\n onBlur();\n });\n }\n };\n\n // update focus state and notify the field on blur\n const handleBlur = () => {\n setIsFocused(false);\n onBlur();\n };\n\n // track focus for the control styles\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n return (\n <SelectControlContext.Provider value={controlProps}>\n <SelectSlotContext.Provider value={classNames}>\n <ReactSelect<unknown, boolean>\n ref={inputRef}\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={controlProps['aria-label']}\n aria-labelledby={controlProps['aria-labelledby']}\n classNames={reactSelectClassNames}\n components={selectComponents}\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputId={ids.control}\n inputValue={inputValue}\n instanceId={ids.control}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n menuIsOpen={debugMenuOpen ? true : undefined}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n name={name}\n noOptionsMessage={renderEmptyOptions}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onInputChange={onInputChange}\n options={reactSelectOptions}\n placeholder={placeholder}\n unstyled\n value={reactSelectValue}\n />\n </SelectSlotContext.Provider>\n </SelectControlContext.Provider>\n );\n};\n\nexport default SelectCombobox;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SelectProps } from '../Select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldDataAttributes } from '../../helpers/fieldProps/fieldProps';\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport { selectVariants } from '../selectVariants';\nimport SelectCombobox from './SelectCombobox';\n\ninterface SelectControlProps extends Omit<\n SelectProps,\n keyof UniformField | 'transform'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField;\n /** Reads the current touched state after a selection commits */\n getIsTouched: () => boolean;\n}\n\n/** Searchable selection field layout and styling around the option engine */\nconst SelectControl = ({ className, field, ...props }: SelectControlProps) => {\n const styling = useStyling();\n\n const {\n description,\n disabled,\n errorMessage,\n ids,\n invalid,\n label,\n required,\n testId,\n } = field;\n\n // classNames from slots\n const variants = styling.resolve(selectVariants, { disabled, invalid });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n return (\n <FieldLayout\n baseProps={{\n ...getFieldDataAttributes(field),\n 'data-component': 'select',\n 'data-testid': `${testId}_wrapper`,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n required={required}\n >\n <SelectCombobox {...props} className={classNames} field={field} />\n </FieldLayout>\n );\n};\n\nexport default SelectControl;\n","import type { ReactNode } from 'react';\nimport type { Props } from 'react-select';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\nimport type { ClassName } from './selectVariants';\n\nimport { useFormContext } from '../hooks/useFormContext';\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SelectControl from './subcomponents/SelectControl';\n\nexport { selectVariants } from './selectVariants';\n\nexport interface SelectOption {\n /** Disables the field */\n disabled?: boolean;\n /**\n * True when option was auto-generated because the value wasn't found in options.\n * Use in renderOptionLabel to render a component that fetches the real label.\n */\n isFallback?: boolean;\n /** Field label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\nexport interface SelectProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determine if the */\n clearable?: boolean;\n /** Force menu open for debugging or visual testing. */\n debugMenuOpen?: boolean;\n // string;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n undefined | ((option?: SelectOption, inputValue?: string) => boolean);\n /** The value of the search input */\n inputValue?: string;\n /** Field label */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** Field name */\n name: string;\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** Available options */\n options: SelectOption[];\n /** Placeholder text */\n placeholder?: string;\n /** Render custom content when no options match the current search input. */\n renderEmptyOptions?: Props['noOptionsMessage'];\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /**\n * Fallback option(s) for async selects when value isn't in current options.\n * Use when the selected value may not be in the options list (e.g., after\n * search results change). Used only if value not found in options.\n * For single select: pass the option object or undefined\n * For multi-select: pass an array of option objects\n */\n selectedOptionFallback?: SelectOption | SelectOption[];\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Allows disentangled display and form values for a field. */\n transform?: InputValueTransform;\n}\n\n/** Form selection field with searchable single or multiple options */\nconst Select = ({\n className = undefined,\n clearable = true,\n debugMenuOpen = false,\n filterOption = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n renderEmptyOptions = undefined,\n renderOptionLabel = undefined,\n selectedOptionFallback = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const { getFieldState } = useFormContext();\n const { field } = useUniformField({\n ...uniformFieldProps,\n isArrayValue: multiSelect,\n name,\n });\n\n const getIsTouched = () => {\n return getFieldState(name, field.testId).isTouched;\n };\n\n return (\n <SelectControl\n className={className}\n clearable={clearable}\n debugMenuOpen={debugMenuOpen}\n field={field}\n filterOption={filterOption}\n getIsTouched={getIsTouched}\n inputValue={inputValue}\n loading={loading}\n multiSelect={multiSelect}\n onInputChange={onInputChange}\n options={options}\n placeholder={placeholder}\n renderEmptyOptions={renderEmptyOptions}\n renderOptionLabel={renderOptionLabel}\n selectedOptionFallback={selectedOptionFallback}\n />\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps, SelectOption } from './Select';\n\nexport { selectVariants } from './Select';\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAIA,MAAa,iBAAiB,GAAG;CAC/B,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;GAEA;EACF;EACA,gBACE;EACF,SAAS;GAEP;GAEA;GAEA;EACF;EACA,iBAAiB;EACjB,WAAW;EACX,aAAa;EACb,aAAa;EACb,mBACE;EACF,cAAc;EACd,OAAO;EACP,cAAc;EACd,eAAe;EACf,oBAAoB;EACpB,qBAAqB;EACrB,OAAO;EACP,OAAO,CAEL,+FAEA,wCACF;EACA,kBAAkB;EAClB,gBAAgB;EAChB,MAAM;EACN,UAAU;EAEV,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,iBAAiB;EACjB,kBAAkB,CAEhB,qEAEA,sEACF;EACA,kBAAkB;EAClB,QAAQ;EACR,iBACE;EACF,gBAAg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,WAAW;EACE;EACC;EACT;EACI;EACF;EACG;EAEV,UAAA,oBAAC,gBAAD;GAAgB,GAAI;GAAO,WAAW;GAAmB;EAAQ,CAAA;CACtD,CAAA;AAEjB;;;;ACoBA,MAAM,UAAU,EACd,YAAY,KAAA,GACZ,YAAY,MACZ,gBAAgB,OAChB,eAAe,KAAA,GACf,aAAa,KAAA,GACb,UAAU,OACV,cAAc,OACd,MACA,gBAAgB,KAAA,GAChB,SACA,cAAc,KAAA,GACd,qBAAqB,KAAA,GACrB,oBAAoB,KAAA,GACpB,yBAAyB,KAAA,GACzB,GAAG,wBACc;CACjB,MAAM,EAAE,kBAAkB,eAAe;CACzC,MAAM,EAAE,UAAU,gBAAgB;EAChC,GAAG;EACH,cAAc;EACd;CACF,CAAC;CAED,MAAM,qBAAqB;EACzB,OAAO,cAAc,MAAM,MAAM,MAAM,CAAC,CAAC;CAC3C;CAEA,OACE,oBAAC,eAAD;EACa;EACA;EACI;EACR;EACO;EACA;EACF;EACH;EACI;EACE;EACN;EACI;EACO;EACD;EACK;CACzB,CAAA;AAEL;;;ACtHA,IAAA,iBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/Select/selectVariants.ts","../../src/Select/helpers/getSelectClassNames.ts","../../src/Select/helpers/resolveSelectValue.ts","../../src/Select/subcomponents/SelectContext.ts","../../src/Select/subcomponents/SelectCrossIcon.tsx","../../src/Select/subcomponents/SelectClearIndicator.tsx","../../src/Select/subcomponents/SelectDownChevron.tsx","../../src/Select/subcomponents/SelectDropdownIndicator.tsx","../../src/Select/subcomponents/SelectInput.tsx","../../src/Select/subcomponents/SelectInputControl.tsx","../../src/Select/subcomponents/SelectMultiValueContainer.tsx","../../src/Select/subcomponents/SelectMultiValueRemove.tsx","../../src/Select/subcomponents/SelectOption.tsx","../../src/Select/subcomponents/SelectCombobox.tsx","../../src/Select/subcomponents/SelectControl.tsx","../../src/Select/Select.tsx","../../src/Select/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const selectVariants = tv({\n slots: {\n base: [\n // Enables group-data selectors used by child slots.\n 'group',\n // Make field wrappers align with other form controls.\n 'flex w-full flex-col',\n // Keep label/control vertical rhythm consistent.\n 'gap-y-1.5',\n // Preserve existing text flow for select content.\n 'leading-normal',\n ],\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control: [\n // control surface and transition\n 'duration-150! min-h-10 rounded-lg border-2 border-default-200 bg-content1 transition-background',\n // hover and validation borders\n 'hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n control_focused: 'border-focus',\n crossIcon: '',\n description: 'text-foreground-500 text-tiny',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n errorMessage: 'text-danger text-tiny',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n helperWrapper: 'relative flex flex-col gap-1.5 p-0',\n indicatorSeparator: 'bg-default-300',\n indicatorsContainer: 'gap-1 p-1',\n input: 'py-0.5 pl-1',\n label: [\n // label interaction and typography\n 'pointer-events-auto inline-flex cursor-default text-sm text-foreground subpixel-antialiased',\n // validation color\n 'group-data-[invalid=true]:!text-danger',\n ],\n loadingIndicator: '',\n loadingMessage: 'rounded-sm p-2 text-foreground-500',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n menuPortal: 'z-50!',\n multiValue: 'h-6 items-center gap-1.5 rounded bg-default-100 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0 leading-5',\n multiValueRemove: [\n // remove button layout and appearance\n 'flex h-5 w-5 items-center justify-center rounded text-default-500',\n // hover feedback\n 'hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n ],\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n option_disabled:\n 'cursor-not-allowed! hover:cursor-not-allowed! opacity-disabled',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n placeholder: 'ml-1 py-0.5 pl-1 text-sm text-foreground-500',\n selectContainer: '',\n selectedValue: 'w-full truncate text-start font-normal text-small',\n singleValue: 'ml-1! leading-7!',\n valueContainer: 'gap-1 p-1',\n },\n variants: {\n disabled: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n // drop hover feedback on the locked control and its actions\n clearIndicator:\n 'hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500',\n control: 'hover:border-default-200',\n dropdownIndicator:\n 'hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500',\n },\n },\n invalid: { true: { selectedValue: 'text-danger!' } },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed',\n // drop hover feedback on the locked control and its actions\n clearIndicator:\n 'hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500',\n control: 'hover:border-default-200',\n dropdownIndicator:\n 'hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof selectVariants>;\n\nexport type ClassName = TVClassName<typeof selectVariants>;\n\nexport type SelectClassNames = Record<\n keyof ReturnType<typeof selectVariants>,\n string\n>;\n","import type { useStyling } from '@fuf-stack/pixels/StylingProvider';\nimport type { SelectClassNames } from '../selectVariants';\n\n/** Maps resolved Uniform slots to React Select's class callbacks */\nconst getSelectClassNames = (\n classNames: SelectClassNames,\n cn: ReturnType<typeof useStyling>['cn'],\n isFocused: boolean,\n invalid: boolean,\n) => {\n // React-select classNames configuration\n return {\n container: () => {\n return classNames.selectContainer;\n },\n group: () => {\n return classNames.group;\n },\n clearIndicator: () => {\n return classNames.clearIndicator;\n },\n control: () => {\n return cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n });\n },\n dropdownIndicator: () => {\n return classNames.dropdownIndicator;\n },\n groupHeading: () => {\n return classNames.groupHeading;\n },\n indicatorSeparator: () => {\n return classNames.indicatorSeparator;\n },\n indicatorsContainer: () => {\n return classNames.indicatorsContainer;\n },\n input: () => {\n return classNames.input;\n },\n loadingIndicator: () => {\n return classNames.loadingIndicator;\n },\n loadingMessage: () => {\n return classNames.loadingMessage;\n },\n menu: () => {\n return classNames.menu;\n },\n menuList: () => {\n return classNames.menuList;\n },\n menuPortal: () => {\n return classNames.menuPortal;\n },\n multiValue: () => {\n return classNames.multiValue;\n },\n multiValueLabel: () => {\n return cn(classNames.selectedValue, classNames.multiValueLabel);\n },\n multiValueRemove: () => {\n return classNames.multiValueRemove;\n },\n noOptionsMessage: () => {\n return classNames.noOptionsMessage;\n },\n option: ({\n isDisabled: optionIsDisabled,\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }: {\n isDisabled: boolean;\n isFocused: boolean;\n isSelected: boolean;\n }) => {\n return cn(classNames.option, {\n [classNames.option_disabled]: optionIsDisabled,\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n });\n },\n placeholder: () => {\n return classNames.placeholder;\n },\n singleValue: () => {\n return cn(classNames.selectedValue, classNames.singleValue);\n },\n valueContainer: () => {\n return classNames.valueContainer;\n },\n };\n};\n\nexport default getSelectClassNames;\n","import type { SelectOption } from '../Select';\n\nimport { isValueEmpty } from '../../helpers';\n\n/** Finds selected options, preserving fallback labels for asynchronous searches */\nconst resolveSelectValue = (\n value: unknown,\n options: SelectOption[],\n multiSelect: boolean,\n selectedOptionFallback: SelectOption | SelectOption[] | undefined,\n) => {\n // Helper to find option by value\n const findOption = (v: string | number): SelectOption => {\n // First, look in options list\n const inOptions = options.find((option) => {\n return String(option.value) === String(v);\n });\n if (inOptions) {\n return inOptions;\n }\n\n // Second, look in selectedOptionFallback prop (for async selects)\n if (selectedOptionFallback) {\n if (Array.isArray(selectedOptionFallback)) {\n const inSelected = selectedOptionFallback.find((option) => {\n return String(option.value) === String(v);\n });\n if (inSelected) {\n return inSelected;\n }\n } else if (String(selectedOptionFallback.value) === String(v)) {\n return selectedOptionFallback;\n }\n }\n\n // Fallback: create option with value as label, marked as fallback\n return { isFallback: true, label: String(v), value: v };\n };\n\n if (multiSelect) {\n if (!Array.isArray(value) || isValueEmpty(value)) {\n return [];\n }\n return value.map((v) => {\n return findOption(v);\n });\n }\n\n // Single select - use isValueEmpty to handle marker strings (__NULL__, etc.)\n if (isValueEmpty(value)) {\n return null;\n }\n return findOption(value as string | number);\n};\n\nexport default resolveSelectValue;\n","import type { HTMLAttributes } from 'react';\n\nimport { createContext } from 'react';\n\n/** Resolved slot classes shared with the select's engine adapters */\nexport const SelectSlotContext = createContext<Record<string, string>>({});\n\n/** Native input associations supplied by the field binding */\nexport const SelectControlContext = createContext<\n HTMLAttributes<HTMLInputElement>\n>({});\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { SelectSlotContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectCrossIconProps = Parameters<typeof components.CrossIcon>[0];\n\n/** Bind the declared icon/container slots to React Select's corresponding elements. */\nconst SelectCrossIcon = (props: SelectCrossIconProps) => {\n const { className } = props;\n const slots = useContext(SelectSlotContext);\n const { cn } = useStyling();\n return (\n <components.CrossIcon\n {...props}\n className={cn(className, slots.crossIcon)}\n />\n );\n};\n\nexport default SelectCrossIcon;\n","import { components } from 'react-select';\n\nimport SelectCrossIcon from './SelectCrossIcon';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectClearIndicatorProps = Parameters<\n typeof components.ClearIndicator\n>[0];\n\nconst SelectClearIndicator = (props: SelectClearIndicatorProps) => {\n return (\n <components.ClearIndicator {...props}>\n <SelectCrossIcon />\n </components.ClearIndicator>\n );\n};\n\nexport default SelectClearIndicator;\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { SelectSlotContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectDownChevronProps = Parameters<typeof components.DownChevron>[0];\n\nconst SelectDownChevron = (props: SelectDownChevronProps) => {\n const { className } = props;\n const slots = useContext(SelectSlotContext);\n const { cn } = useStyling();\n return (\n <components.DownChevron\n {...props}\n className={cn(className, slots.downChevron)}\n />\n );\n};\n\nexport default SelectDownChevron;\n","import { components } from 'react-select';\n\nimport SelectDownChevron from './SelectDownChevron';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectDropdownIndicatorProps = Parameters<\n typeof components.DropdownIndicator\n>[0];\n\n/** Wraps the dropdown indicator with a predictable test id for automation. */\nconst SelectDropdownIndicator = (props: SelectDropdownIndicatorProps) => {\n // @ts-expect-error data-testid is not a default prop\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_select_dropdown`}>\n <components.DropdownIndicator {...props}>\n <SelectDownChevron />\n </components.DropdownIndicator>\n </div>\n );\n};\n\nexport default SelectDropdownIndicator;\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { SelectControlContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectInputProps = Parameters<typeof components.Input>[0];\n\n/** Mirrors the select test id onto the underlying react-select input element. */\nconst SelectInput = (props: SelectInputProps) => {\n const associations = useContext(SelectControlContext);\n\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}`;\n\n const { 'aria-describedby': engineDescription } = props;\n const describedBy =\n [engineDescription, associations['aria-describedby']]\n .filter(Boolean)\n .join(' ') || undefined;\n return (\n <components.Input\n {...props}\n {...associations}\n aria-describedby={describedBy}\n data-testid={testId}\n />\n );\n};\n\nexport default SelectInput;\n","import { components } from 'react-select';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectInputControlProps = Parameters<typeof components.Control>[0];\n\n/** Wraps the control root to expose a stable `*_select` test id hook. */\nconst SelectInputControl = (props: SelectInputControlProps) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select`;\n\n return (\n <div data-testid={testId}>\n <components.Control {...props} />\n </div>\n );\n};\n\nexport default SelectInputControl;\n","import { useContext } from 'react';\nimport { components } from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { SelectSlotContext } from './SelectContext';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectMultiValueContainerProps = Parameters<\n typeof components.MultiValueContainer\n>[0];\n\nconst SelectMultiValueContainer = (props: SelectMultiValueContainerProps) => {\n const slots = useContext(SelectSlotContext);\n const { cn } = useStyling();\n\n const { innerProps } = props;\n return (\n <components.MultiValueContainer\n {...props}\n innerProps={{\n ...innerProps,\n className: cn(innerProps.className, slots.multiValueContainer),\n }}\n />\n );\n};\n\nexport default SelectMultiValueContainer;\n","import { components } from 'react-select';\n\nimport SelectCrossIcon from './SelectCrossIcon';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectMultiValueRemoveProps = Parameters<\n typeof components.MultiValueRemove\n>[0];\n\nconst SelectMultiValueRemove = (props: SelectMultiValueRemoveProps) => {\n return (\n <components.MultiValueRemove {...props}>\n <SelectCrossIcon size={14} />\n </components.MultiValueRemove>\n );\n};\n\nexport default SelectMultiValueRemove;\n","import { components } from 'react-select';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\n\n/** Props inherited from the corresponding React Select adapter */\ntype SelectOptionProps = Parameters<typeof components.Option>[0];\n\n/** Adds deterministic option test ids and forwards disabled state semantics. */\nconst SelectOption = (props: SelectOptionProps) => {\n const { isDisabled } = props;\n\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_select_option_${slugify(String(props?.data?.testId ?? props?.data?.value), { replaceDots: true })}`;\n return (\n <div aria-disabled={isDisabled ? true : undefined} data-testid={testId}>\n <components.Option {...props} />\n </div>\n );\n};\n\nexport default SelectOption;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SelectOption as SelectOptionData, SelectProps } from '../Select';\nimport type { SelectClassNames } from '../selectVariants';\n\nimport { useMemo, useState } from 'react';\nimport ReactSelect from 'react-select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { createOptionValueConverter } from '../../helpers';\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport getSelectClassNames from '../helpers/getSelectClassNames';\nimport resolveSelectValue from '../helpers/resolveSelectValue';\nimport SelectClearIndicator from './SelectClearIndicator';\nimport { SelectControlContext, SelectSlotContext } from './SelectContext';\nimport SelectDownChevron from './SelectDownChevron';\nimport SelectDropdownIndicator from './SelectDropdownIndicator';\nimport SelectInput from './SelectInput';\nimport SelectInputControl from './SelectInputControl';\nimport SelectMultiValueContainer from './SelectMultiValueContainer';\nimport SelectMultiValueRemove from './SelectMultiValueRemove';\nimport SelectOption from './SelectOption';\n\nconst selectComponents = {\n Control: SelectInputControl,\n ClearIndicator: SelectClearIndicator,\n MultiValueRemove: SelectMultiValueRemove,\n DownChevron: SelectDownChevron,\n MultiValueContainer: SelectMultiValueContainer,\n DropdownIndicator: SelectDropdownIndicator,\n Input: SelectInput,\n Option: SelectOption,\n};\n\n/** Hides React Select actions that would change a read-only selection */\nconst HiddenSelectAction = () => {\n return null;\n};\n\nconst readOnlySelectComponents = {\n ...selectComponents,\n MultiValueRemove: HiddenSelectAction,\n};\n\ninterface SelectComboboxProps extends Omit<\n SelectProps,\n keyof UniformField | 'className' | 'transform'\n> {\n /** CSS class name */\n className: SelectClassNames;\n /** Bound field values, interactions and metadata */\n field: UniformField;\n /** Reads the current touched state after a selection commits */\n getIsTouched: () => boolean;\n}\n\n/**\n * Searchable option engine with value conversion, menu slots and touched timing\n *\n * @see https://react-select.com/components\n */\nconst SelectCombobox = ({\n className: classNames,\n clearable,\n debugMenuOpen,\n field,\n filterOption,\n getIsTouched,\n inputValue,\n loading,\n multiSelect = false,\n onInputChange,\n options,\n placeholder,\n renderEmptyOptions,\n renderOptionLabel,\n selectedOptionFallback,\n}: SelectComboboxProps) => {\n const styling = useStyling();\n const [isFocused, setIsFocused] = useState(false);\n\n const {\n disabled,\n ids,\n invalid,\n name,\n onBlur,\n onChange: onValueChange,\n readOnly,\n ref: inputRef,\n testId,\n value,\n } = field;\n const controlProps = getFieldControlProps(field);\n\n // react-select has no read-only mode, the input announces the state while\n // the menu, search, clearing and value removal are blocked below\n const inputAssociations = useMemo(() => {\n return { ...controlProps, 'aria-readonly': readOnly || undefined };\n }, [controlProps, readOnly]);\n\n // read-only selections are never cleared\n const isClearable = !!clearable && !readOnly;\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n const reactSelectClassNames = getSelectClassNames(\n classNames,\n styling.cn,\n isFocused,\n invalid,\n );\n\n // adapt option disabled state for react-select\n const reactSelectOptions = options.map((option) => {\n return {\n ...option,\n isDisabled: option.disabled,\n };\n });\n\n const reactSelectValue = resolveSelectValue(\n value,\n options,\n multiSelect,\n selectedOptionFallback,\n );\n\n // convert React Select options into the original value types\n const handleChange = (option: unknown) => {\n if (readOnly) {\n return;\n }\n\n if (multiSelect) {\n onValueChange(\n (option as SelectOptionData[])?.map((selectedOption) => {\n return convertToOriginalType(selectedOption.value);\n }),\n );\n } else {\n const nextValue = (option as SelectOptionData)?.value;\n\n // an empty single selection is stored as null\n onValueChange(\n nextValue != null ? convertToOriginalType(nextValue) : null,\n );\n }\n\n // defer the first touched update so validation reads the committed selection\n if (!getIsTouched()) {\n queueMicrotask(() => {\n onBlur();\n });\n }\n };\n\n // read-only selects never open their menu\n let menuIsOpen: boolean | undefined;\n if (readOnly) {\n menuIsOpen = false;\n } else if (debugMenuOpen) {\n menuIsOpen = true;\n }\n\n // update focus state and notify the field on blur\n const handleBlur = () => {\n setIsFocused(false);\n onBlur();\n };\n\n // track focus for the control styles\n const handleFocus = () => {\n setIsFocused(true);\n };\n\n return (\n <SelectControlContext.Provider value={inputAssociations}>\n <SelectSlotContext.Provider value={classNames}>\n <ReactSelect<unknown, boolean>\n ref={inputRef}\n aria-errormessage=\"\"\n aria-invalid={invalid}\n aria-label={controlProps['aria-label']}\n aria-labelledby={controlProps['aria-labelledby']}\n backspaceRemovesValue={!readOnly}\n classNames={reactSelectClassNames}\n components={readOnly ? readOnlySelectComponents : selectComponents}\n data-testid={testId}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputId={ids.control}\n // a pending search hides the selected value, read-only selects show it\n inputValue={readOnly ? '' : inputValue}\n instanceId={ids.control}\n isClearable={isClearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n isSearchable={!readOnly}\n menuIsOpen={menuIsOpen}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n name={name}\n noOptionsMessage={renderEmptyOptions}\n onBlur={handleBlur}\n onChange={handleChange}\n onFocus={handleFocus}\n onInputChange={onInputChange}\n options={reactSelectOptions}\n placeholder={placeholder}\n unstyled\n value={reactSelectValue}\n />\n </SelectSlotContext.Provider>\n </SelectControlContext.Provider>\n );\n};\n\nexport default SelectCombobox;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SelectProps } from '../Select';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldDataAttributes } from '../../helpers/fieldProps/fieldProps';\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport { selectVariants } from '../selectVariants';\nimport SelectCombobox from './SelectCombobox';\n\ninterface SelectControlProps extends Omit<\n SelectProps,\n keyof UniformField | 'transform'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField;\n /** Reads the current touched state after a selection commits */\n getIsTouched: () => boolean;\n}\n\n/** Searchable selection field layout and styling around the option engine */\nconst SelectControl = ({ className, field, ...props }: SelectControlProps) => {\n const styling = useStyling();\n\n const {\n description,\n disabled,\n errorMessage,\n ids,\n invalid,\n label,\n readOnly,\n required,\n testId,\n } = field;\n\n // classNames from slots\n const variants = styling.resolve(selectVariants, {\n disabled,\n invalid,\n readOnly,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n return (\n <FieldLayout\n baseProps={{\n ...getFieldDataAttributes(field),\n 'data-component': 'select',\n 'data-testid': `${testId}_wrapper`,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n required={required}\n >\n <SelectCombobox {...props} className={classNames} field={field} />\n </FieldLayout>\n );\n};\n\nexport default SelectControl;\n","import type { ReactNode } from 'react';\nimport type { Props } from 'react-select';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\nimport type { ClassName } from './selectVariants';\n\nimport { useFormContext } from '../hooks/useFormContext';\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SelectControl from './subcomponents/SelectControl';\n\nexport { selectVariants } from './selectVariants';\n\nexport interface SelectOption {\n /** Disables the field */\n disabled?: boolean;\n /**\n * True when option was auto-generated because the value wasn't found in options.\n * Use in renderOptionLabel to render a component that fetches the real label.\n */\n isFallback?: boolean;\n /** Field label */\n label?: ReactNode;\n /** option value */\n value: string | number;\n}\n\nexport interface SelectProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determine if the */\n clearable?: boolean;\n /** Force menu open for debugging or visual testing. */\n debugMenuOpen?: boolean;\n // string;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n undefined | ((option?: SelectOption, inputValue?: string) => boolean);\n /** The value of the search input */\n inputValue?: string;\n /** Field label */\n label?: ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** Field name */\n name: string;\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** Available options */\n options: SelectOption[];\n /** Placeholder text */\n placeholder?: string;\n /** Prevents changes while keeping the selection in validation and submission */\n readOnly?: boolean;\n /** Render custom content when no options match the current search input. */\n renderEmptyOptions?: Props['noOptionsMessage'];\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /**\n * Fallback option(s) for async selects when value isn't in current options.\n * Use when the selected value may not be in the options list (e.g., after\n * search results change). Used only if value not found in options.\n * For single select: pass the option object or undefined\n * For multi-select: pass an array of option objects\n */\n selectedOptionFallback?: SelectOption | SelectOption[];\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Allows disentangled display and form values for a field. */\n transform?: InputValueTransform;\n}\n\n/** Form selection field with searchable single or multiple options */\nconst Select = ({\n className = undefined,\n clearable = true,\n debugMenuOpen = false,\n filterOption = undefined,\n inputValue = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n renderEmptyOptions = undefined,\n renderOptionLabel = undefined,\n selectedOptionFallback = undefined,\n ...uniformFieldProps\n}: SelectProps) => {\n const { getFieldState } = useFormContext();\n const { field } = useUniformField({\n ...uniformFieldProps,\n isArrayValue: multiSelect,\n name,\n });\n\n const getIsTouched = () => {\n return getFieldState(name, field.testId).isTouched;\n };\n\n return (\n <SelectControl\n className={className}\n clearable={clearable}\n debugMenuOpen={debugMenuOpen}\n field={field}\n filterOption={filterOption}\n getIsTouched={getIsTouched}\n inputValue={inputValue}\n loading={loading}\n multiSelect={multiSelect}\n onInputChange={onInputChange}\n options={options}\n placeholder={placeholder}\n renderEmptyOptions={renderEmptyOptions}\n renderOptionLabel={renderOptionLabel}\n selectedOptionFallback={selectedOptionFallback}\n />\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps, SelectOption } from './Select';\n\nexport { selectVariants } from './Select';\n\nexport default Select;\n"],"mappings":";;;;;;;;;;;AAIA,MAAa,iBAAiB,GAAG;CAC/B,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;GAEA;EACF;EACA,gBACE;EACF,SAAS;GAEP;GAEA;GAEA;EACF;EACA,iBAAiB;EACjB,WAAW;EACX,aAAa;EACb,aAAa;EACb,mBACE;EACF,cAAc;EACd,OAAO;EACP,cAAc;EACd,eAAe;EACf,oBAAoB;EACpB,qBAAqB;EACrB,OAAO;EACP,OAAO,CAEL,+FAEA,wCACF;EACA,kBAAkB;EAClB,gBAAgB;EAChB,MAAM;EACN,UAAU;EAEV,YAAY;EACZ,YAAY;EACZ,qBAAqB;EACrB,iBAAiB;EACjB,kBAAkB,CAEhB,qEAEA,sEACF;EACA,kBAAkB;EAClB,QAAQ;EACR,iBACE;EACF,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,iBAAiB;EACjB,eAAe;EACf,aAAa;EACb,gBAAgB;CAClB;CACA,UAAU;EACR,UAAU,EACR,MAAM;GAEJ,MAAM;GAEN,gBACE;GACF,SAAS;GACT,mBACE;EACJ,EACF;EACA,SAAS,EAAE,MAAM,EAAE,eAAe,eAAe,EAAE;EACnD,UAAU,EACR,MAAM;GAEJ,MAAM;GAEN,gBACE;GACF,SAAS;GACT,mBACE;EACJ,EACF;CACF;AACF,CAAC;;;AC/FD,MAAM,uBACJ,YACA,IACA,WACA,YACG;CAEH,OAAO;EACL,iBAAiB;GACf,OAAO,WAAW;EACpB;EACA,aAAa;GACX,OAAO,WAAW;EACpB;EACA,sBAAsB;GACpB,OAAO,WAAW;EACpB;EACA,eAAe;GACb,OAAO,GAAG,WAAW,SAAS,GAC3B,WAAW,kBAAkB,aAAa,CAAC,QAC9C,CAAC;EACH;EACA,yBAAyB;GACvB,OAAO,WAAW;EACpB;EACA,oBAAoB;GAClB,OAAO,WAAW;EACpB;EACA,0BAA0B;GACxB,OAAO,WAAW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