@fuf-stack/uniform 2.0.0-next.1 → 2.0.0-next.4
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 +47 -27
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +26 -25
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +63 -86
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +43 -49
- 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 +25 -37
- 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 +14 -25
- 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/FieldHelper-B1DWl7eu.mjs +38 -0
- package/dist/FieldHelper-B1DWl7eu.mjs.map +1 -0
- package/dist/FieldLabel-DMTqq0Jj.mjs +29 -0
- package/dist/FieldLabel-DMTqq0Jj.mjs.map +1 -0
- package/dist/{FieldLayout-BLW5S-Jm.mjs → FieldLayout-C9MEBZAC.mjs} +11 -19
- package/dist/FieldLayout-C9MEBZAC.mjs.map +1 -0
- 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-BuLvuRyi.mjs} +5 -7
- package/dist/FieldValidationError-BuLvuRyi.mjs.map +1 -0
- 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 +610 -393
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +24 -31
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +247 -2227
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +25 -37
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +599 -289
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +24 -27
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +164 -2077
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +12 -23
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +809 -484
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +69 -54
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +657 -281
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +42 -42
- 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 +25 -32
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/Switch-aBYStBoY.d.mts +990 -0
- package/dist/Switch-aBYStBoY.d.mts.map +1 -0
- package/dist/SwitchBox/index.d.mts +606 -201
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +29 -33
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +565 -185
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +18 -23
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +60 -44
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +27 -36
- package/dist/Time/index.mjs.map +1 -1
- package/dist/fieldHelperVariants-ClP8taiS.mjs +20 -0
- package/dist/fieldHelperVariants-ClP8taiS.mjs.map +1 -0
- package/dist/fieldLabelVariants-C4ZqECec.mjs +13 -0
- package/dist/fieldLabelVariants-C4ZqECec.mjs.map +1 -0
- package/dist/{FieldDescription-C4l0HKGL.mjs → fieldProps-DWfz2jSO.mjs} +5 -17
- package/dist/fieldProps-DWfz2jSO.mjs.map +1 -0
- 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/{Switch-CvPO8IF9.d.mts → partials/FieldHelper/index.d.mts} +309 -361
- package/dist/partials/FieldHelper/index.d.mts.map +1 -0
- package/dist/partials/FieldHelper/index.mjs +7 -0
- package/dist/partials/FieldHelper/index.mjs.map +1 -0
- package/dist/partials/FieldLabel/index.d.mts +160 -0
- package/dist/partials/FieldLabel/index.d.mts.map +1 -0
- package/dist/partials/FieldLabel/index.mjs +7 -0
- package/dist/partials/FieldLabel/index.mjs.map +1 -0
- package/dist/partials/FieldValidationError/index.d.mts +13 -15
- package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
- package/dist/partials/FieldValidationError/index.mjs +1 -1
- package/dist/{radioControlVariants-Cm6WufWo.mjs → radioControlVariants-CbtG5U4_.mjs} +28 -25
- package/dist/radioControlVariants-CbtG5U4_.mjs.map +1 -0
- package/dist/{switchVariants-BaQw2DA7.mjs → switchVariants-0Xa7TQYg.mjs} +8 -11
- package/dist/switchVariants-0Xa7TQYg.mjs.map +1 -0
- package/dist/{timeVariants-B9HDfNYt.mjs → timeVariants-Bkt4iwXx.mjs} +14 -12
- package/dist/timeVariants-Bkt4iwXx.mjs.map +1 -0
- 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/dist/{FieldLabel-DKzqkuY1.mjs → useUniformField-TTNPTsVn.mjs} +15 -37
- package/dist/useUniformField-TTNPTsVn.mjs.map +1 -0
- package/package.json +10 -7
- package/dist/FieldDescription-C4l0HKGL.mjs.map +0 -1
- package/dist/FieldLabel-DKzqkuY1.mjs.map +0 -1
- package/dist/FieldLayout-BLW5S-Jm.mjs.map +0 -1
- package/dist/FieldValidationError-DgkCL3cC.mjs.map +0 -1
- package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
- package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
- package/dist/Switch-CvPO8IF9.d.mts.map +0 -1
- package/dist/index-BS8IoBOn.d.mts.map +0 -1
- package/dist/radioControlVariants-Cm6WufWo.mjs.map +0 -1
- package/dist/switchVariants-BaQw2DA7.mjs.map +0 -1
- package/dist/timeVariants-B9HDfNYt.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/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AAA,MAAA,eAAA,SAAA,aAAA,oBAAA,mBAAA,2BAAA,qBAgBb,gCAAW,IAAA"}
|
package/dist/Select/index.mjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
+
import { n as useFormContext } from "../useFormContext-piqnN2L-.mjs";
|
|
2
|
+
import { t as useUniformField } from "../useUniformField-TTNPTsVn.mjs";
|
|
3
|
+
import { n as getFieldDataAttributes, t as getFieldControlProps } from "../fieldProps-DWfz2jSO.mjs";
|
|
4
|
+
import { t as FieldLayout } from "../FieldLayout-C9MEBZAC.mjs";
|
|
5
|
+
import { t as fieldHelperVariants } from "../fieldHelperVariants-ClP8taiS.mjs";
|
|
6
|
+
import { t as fieldLabelVariants } from "../fieldLabelVariants-C4ZqECec.mjs";
|
|
1
7
|
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";
|
|
8
|
+
import { createContext, useContext, useMemo, useState } from "react";
|
|
7
9
|
import { jsx } from "react/jsx-runtime";
|
|
8
10
|
import { slugify, tv } from "@fuf-stack/pixel-utils";
|
|
9
11
|
import { useStyling } from "@fuf-stack/pixels/StylingProvider";
|
|
10
12
|
import ReactSelect, { components } from "react-select";
|
|
11
|
-
|
|
13
|
+
// src/Select/selectVariants.ts
|
|
12
14
|
const selectVariants = tv({
|
|
15
|
+
extend: fieldHelperVariants,
|
|
13
16
|
slots: {
|
|
14
17
|
base: [
|
|
15
18
|
"group",
|
|
16
19
|
"flex w-full flex-col",
|
|
17
|
-
"gap-y-1.5",
|
|
18
20
|
"leading-normal"
|
|
19
21
|
],
|
|
20
22
|
clearIndicator: "rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800",
|
|
@@ -25,17 +27,14 @@ const selectVariants = tv({
|
|
|
25
27
|
],
|
|
26
28
|
control_focused: "border-focus",
|
|
27
29
|
crossIcon: "",
|
|
28
|
-
description: "text-foreground-500 text-tiny",
|
|
29
30
|
downChevron: "",
|
|
30
31
|
dropdownIndicator: "rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black",
|
|
31
|
-
errorMessage: "text-danger text-tiny",
|
|
32
32
|
group: "",
|
|
33
33
|
groupHeading: "mb-1 ml-3 mt-2 text-sm text-foreground-500",
|
|
34
|
-
helperWrapper: "relative flex flex-col gap-1.5 p-0",
|
|
35
34
|
indicatorSeparator: "bg-default-300",
|
|
36
35
|
indicatorsContainer: "gap-1 p-1",
|
|
37
36
|
input: "py-0.5 pl-1",
|
|
38
|
-
label: ["pointer-events-auto inline-flex
|
|
37
|
+
label: [fieldLabelVariants.base, "pointer-events-auto inline-flex"],
|
|
39
38
|
loadingIndicator: "",
|
|
40
39
|
loadingMessage: "rounded-sm p-2 text-foreground-500",
|
|
41
40
|
menu: "mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg",
|
|
@@ -57,12 +56,22 @@ const selectVariants = tv({
|
|
|
57
56
|
valueContainer: "gap-1 p-1"
|
|
58
57
|
},
|
|
59
58
|
variants: {
|
|
60
|
-
disabled: { true: {
|
|
61
|
-
|
|
59
|
+
disabled: { true: {
|
|
60
|
+
base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed",
|
|
61
|
+
clearIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500",
|
|
62
|
+
control: "hover:border-default-200",
|
|
63
|
+
dropdownIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500"
|
|
64
|
+
} },
|
|
65
|
+
invalid: { true: { selectedValue: "text-danger!" } },
|
|
66
|
+
readOnly: { true: {
|
|
67
|
+
base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed",
|
|
68
|
+
clearIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500",
|
|
69
|
+
control: "hover:border-default-200",
|
|
70
|
+
dropdownIndicator: "hover:cursor-not-allowed hover:bg-transparent hover:text-foreground-500"
|
|
71
|
+
} }
|
|
62
72
|
}
|
|
63
73
|
});
|
|
64
|
-
|
|
65
|
-
//#region src/Select/helpers/getSelectClassNames.ts
|
|
74
|
+
// src/Select/helpers/getSelectClassNames.ts
|
|
66
75
|
/** Maps resolved Uniform slots to React Select's class callbacks */
|
|
67
76
|
const getSelectClassNames = (classNames, cn, isFocused, invalid) => {
|
|
68
77
|
return {
|
|
@@ -138,8 +147,7 @@ const getSelectClassNames = (classNames, cn, isFocused, invalid) => {
|
|
|
138
147
|
}
|
|
139
148
|
};
|
|
140
149
|
};
|
|
141
|
-
|
|
142
|
-
//#region src/Select/helpers/resolveSelectValue.ts
|
|
150
|
+
// src/Select/helpers/resolveSelectValue.ts
|
|
143
151
|
/** Finds selected options, preserving fallback labels for asynchronous searches */
|
|
144
152
|
const resolveSelectValue = (value, options, multiSelect, selectedOptionFallback) => {
|
|
145
153
|
const findOption = (v) => {
|
|
@@ -170,14 +178,12 @@ const resolveSelectValue = (value, options, multiSelect, selectedOptionFallback)
|
|
|
170
178
|
if (isValueEmpty(value)) return null;
|
|
171
179
|
return findOption(value);
|
|
172
180
|
};
|
|
173
|
-
|
|
174
|
-
//#region src/Select/subcomponents/SelectContext.ts
|
|
181
|
+
// src/Select/subcomponents/SelectContext.ts
|
|
175
182
|
/** Resolved slot classes shared with the select's engine adapters */
|
|
176
183
|
const SelectSlotContext = createContext({});
|
|
177
184
|
/** Native input associations supplied by the field binding */
|
|
178
185
|
const SelectControlContext = createContext({});
|
|
179
|
-
|
|
180
|
-
//#region src/Select/subcomponents/SelectCrossIcon.tsx
|
|
186
|
+
// src/Select/subcomponents/SelectCrossIcon.tsx
|
|
181
187
|
/** Bind the declared icon/container slots to React Select's corresponding elements. */
|
|
182
188
|
const SelectCrossIcon = (props) => {
|
|
183
189
|
const { className } = props;
|
|
@@ -188,16 +194,14 @@ const SelectCrossIcon = (props) => {
|
|
|
188
194
|
className: cn(className, slots.crossIcon)
|
|
189
195
|
});
|
|
190
196
|
};
|
|
191
|
-
|
|
192
|
-
//#region src/Select/subcomponents/SelectClearIndicator.tsx
|
|
197
|
+
// src/Select/subcomponents/SelectClearIndicator.tsx
|
|
193
198
|
const SelectClearIndicator = (props) => {
|
|
194
199
|
return /* @__PURE__ */ jsx(components.ClearIndicator, {
|
|
195
200
|
...props,
|
|
196
201
|
children: /* @__PURE__ */ jsx(SelectCrossIcon, {})
|
|
197
202
|
});
|
|
198
203
|
};
|
|
199
|
-
|
|
200
|
-
//#region src/Select/subcomponents/SelectDownChevron.tsx
|
|
204
|
+
// src/Select/subcomponents/SelectDownChevron.tsx
|
|
201
205
|
const SelectDownChevron = (props) => {
|
|
202
206
|
const { className } = props;
|
|
203
207
|
const slots = useContext(SelectSlotContext);
|
|
@@ -207,8 +211,7 @@ const SelectDownChevron = (props) => {
|
|
|
207
211
|
className: cn(className, slots.downChevron)
|
|
208
212
|
});
|
|
209
213
|
};
|
|
210
|
-
|
|
211
|
-
//#region src/Select/subcomponents/SelectDropdownIndicator.tsx
|
|
214
|
+
// src/Select/subcomponents/SelectDropdownIndicator.tsx
|
|
212
215
|
/** Wraps the dropdown indicator with a predictable test id for automation. */
|
|
213
216
|
const SelectDropdownIndicator = (props) => {
|
|
214
217
|
const testId = props?.selectProps["data-testid"];
|
|
@@ -220,8 +223,7 @@ const SelectDropdownIndicator = (props) => {
|
|
|
220
223
|
})
|
|
221
224
|
});
|
|
222
225
|
};
|
|
223
|
-
|
|
224
|
-
//#region src/Select/subcomponents/SelectInput.tsx
|
|
226
|
+
// src/Select/subcomponents/SelectInput.tsx
|
|
225
227
|
/** Mirrors the select test id onto the underlying react-select input element. */
|
|
226
228
|
const SelectInput = (props) => {
|
|
227
229
|
const associations = useContext(SelectControlContext);
|
|
@@ -235,8 +237,7 @@ const SelectInput = (props) => {
|
|
|
235
237
|
"data-testid": testId
|
|
236
238
|
});
|
|
237
239
|
};
|
|
238
|
-
|
|
239
|
-
//#region src/Select/subcomponents/SelectInputControl.tsx
|
|
240
|
+
// src/Select/subcomponents/SelectInputControl.tsx
|
|
240
241
|
/** Wraps the control root to expose a stable `*_select` test id hook. */
|
|
241
242
|
const SelectInputControl = (props) => {
|
|
242
243
|
const testId = `${props.selectProps["data-testid"]}_select`;
|
|
@@ -245,8 +246,7 @@ const SelectInputControl = (props) => {
|
|
|
245
246
|
children: /* @__PURE__ */ jsx(components.Control, { ...props })
|
|
246
247
|
});
|
|
247
248
|
};
|
|
248
|
-
|
|
249
|
-
//#region src/Select/subcomponents/SelectMultiValueContainer.tsx
|
|
249
|
+
// src/Select/subcomponents/SelectMultiValueContainer.tsx
|
|
250
250
|
const SelectMultiValueContainer = (props) => {
|
|
251
251
|
const slots = useContext(SelectSlotContext);
|
|
252
252
|
const { cn } = useStyling();
|
|
@@ -259,16 +259,14 @@ const SelectMultiValueContainer = (props) => {
|
|
|
259
259
|
}
|
|
260
260
|
});
|
|
261
261
|
};
|
|
262
|
-
|
|
263
|
-
//#region src/Select/subcomponents/SelectMultiValueRemove.tsx
|
|
262
|
+
// src/Select/subcomponents/SelectMultiValueRemove.tsx
|
|
264
263
|
const SelectMultiValueRemove = (props) => {
|
|
265
264
|
return /* @__PURE__ */ jsx(components.MultiValueRemove, {
|
|
266
265
|
...props,
|
|
267
266
|
children: /* @__PURE__ */ jsx(SelectCrossIcon, { size: 14 })
|
|
268
267
|
});
|
|
269
268
|
};
|
|
270
|
-
|
|
271
|
-
//#region src/Select/subcomponents/SelectOption.tsx
|
|
269
|
+
// src/Select/subcomponents/SelectOption.tsx
|
|
272
270
|
/** Adds deterministic option test ids and forwards disabled state semantics. */
|
|
273
271
|
const SelectOption = (props) => {
|
|
274
272
|
const { isDisabled } = props;
|
|
@@ -279,8 +277,7 @@ const SelectOption = (props) => {
|
|
|
279
277
|
children: /* @__PURE__ */ jsx(components.Option, { ...props })
|
|
280
278
|
});
|
|
281
279
|
};
|
|
282
|
-
|
|
283
|
-
//#region src/Select/subcomponents/SelectCombobox.tsx
|
|
280
|
+
// src/Select/subcomponents/SelectCombobox.tsx
|
|
284
281
|
const selectComponents = {
|
|
285
282
|
Control: SelectInputControl,
|
|
286
283
|
ClearIndicator: SelectClearIndicator,
|
|
@@ -291,6 +288,14 @@ const selectComponents = {
|
|
|
291
288
|
Input: SelectInput,
|
|
292
289
|
Option: SelectOption
|
|
293
290
|
};
|
|
291
|
+
/** Hides React Select actions that would change a read-only selection */
|
|
292
|
+
const HiddenSelectAction = () => {
|
|
293
|
+
return null;
|
|
294
|
+
};
|
|
295
|
+
const readOnlySelectComponents = {
|
|
296
|
+
...selectComponents,
|
|
297
|
+
MultiValueRemove: HiddenSelectAction
|
|
298
|
+
};
|
|
294
299
|
/**
|
|
295
300
|
* Searchable option engine with value conversion, menu slots and touched timing
|
|
296
301
|
*
|
|
@@ -299,8 +304,15 @@ const selectComponents = {
|
|
|
299
304
|
const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field, filterOption, getIsTouched, inputValue, loading, multiSelect = false, onInputChange, options, placeholder, renderEmptyOptions, renderOptionLabel, selectedOptionFallback }) => {
|
|
300
305
|
const styling = useStyling();
|
|
301
306
|
const [isFocused, setIsFocused] = useState(false);
|
|
302
|
-
const { disabled, ids, invalid, name, onBlur, onChange: onValueChange, ref: inputRef, testId, value } = field;
|
|
307
|
+
const { disabled, ids, invalid, name, onBlur, onChange: onValueChange, readOnly, ref: inputRef, testId, value } = field;
|
|
303
308
|
const controlProps = getFieldControlProps(field);
|
|
309
|
+
const inputAssociations = useMemo(() => {
|
|
310
|
+
return {
|
|
311
|
+
...controlProps,
|
|
312
|
+
"aria-readonly": readOnly || void 0
|
|
313
|
+
};
|
|
314
|
+
}, [controlProps, readOnly]);
|
|
315
|
+
const isClearable = !!clearable && !readOnly;
|
|
304
316
|
const { convertToOriginalType } = createOptionValueConverter(options);
|
|
305
317
|
const reactSelectClassNames = getSelectClassNames(classNames, styling.cn, isFocused, invalid);
|
|
306
318
|
const reactSelectOptions = options.map((option) => {
|
|
@@ -311,6 +323,7 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
311
323
|
});
|
|
312
324
|
const reactSelectValue = resolveSelectValue(value, options, multiSelect, selectedOptionFallback);
|
|
313
325
|
const handleChange = (option) => {
|
|
326
|
+
if (readOnly) return;
|
|
314
327
|
if (multiSelect) onValueChange(option?.map((selectedOption) => {
|
|
315
328
|
return convertToOriginalType(selectedOption.value);
|
|
316
329
|
}));
|
|
@@ -322,6 +335,9 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
322
335
|
onBlur();
|
|
323
336
|
});
|
|
324
337
|
};
|
|
338
|
+
let menuIsOpen;
|
|
339
|
+
if (readOnly) menuIsOpen = false;
|
|
340
|
+
else if (debugMenuOpen) menuIsOpen = true;
|
|
325
341
|
const handleBlur = () => {
|
|
326
342
|
setIsFocused(false);
|
|
327
343
|
onBlur();
|
|
@@ -330,7 +346,7 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
330
346
|
setIsFocused(true);
|
|
331
347
|
};
|
|
332
348
|
return /* @__PURE__ */ jsx(SelectControlContext.Provider, {
|
|
333
|
-
value:
|
|
349
|
+
value: inputAssociations,
|
|
334
350
|
children: /* @__PURE__ */ jsx(SelectSlotContext.Provider, {
|
|
335
351
|
value: classNames,
|
|
336
352
|
children: /* @__PURE__ */ jsx(ReactSelect, {
|
|
@@ -339,19 +355,21 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
339
355
|
"aria-invalid": invalid,
|
|
340
356
|
"aria-label": controlProps["aria-label"],
|
|
341
357
|
"aria-labelledby": controlProps["aria-labelledby"],
|
|
358
|
+
backspaceRemovesValue: !readOnly,
|
|
342
359
|
classNames: reactSelectClassNames,
|
|
343
|
-
components: selectComponents,
|
|
360
|
+
components: readOnly ? readOnlySelectComponents : selectComponents,
|
|
344
361
|
"data-testid": testId,
|
|
345
362
|
filterOption,
|
|
346
363
|
formatOptionLabel: renderOptionLabel,
|
|
347
364
|
inputId: ids.control,
|
|
348
|
-
inputValue,
|
|
365
|
+
inputValue: readOnly ? "" : inputValue,
|
|
349
366
|
instanceId: ids.control,
|
|
350
|
-
isClearable
|
|
367
|
+
isClearable,
|
|
351
368
|
isDisabled: disabled,
|
|
352
369
|
isLoading: loading,
|
|
353
370
|
isMulti: multiSelect,
|
|
354
|
-
|
|
371
|
+
isSearchable: !readOnly,
|
|
372
|
+
menuIsOpen,
|
|
355
373
|
menuPosition: "fixed",
|
|
356
374
|
menuShouldBlockScroll: true,
|
|
357
375
|
name,
|
|
@@ -368,15 +386,15 @@ const SelectCombobox = ({ className: classNames, clearable, debugMenuOpen, field
|
|
|
368
386
|
})
|
|
369
387
|
});
|
|
370
388
|
};
|
|
371
|
-
|
|
372
|
-
//#region src/Select/subcomponents/SelectControl.tsx
|
|
389
|
+
// src/Select/subcomponents/SelectControl.tsx
|
|
373
390
|
/** Searchable selection field layout and styling around the option engine */
|
|
374
391
|
const SelectControl = ({ className, field, ...props }) => {
|
|
375
392
|
const styling = useStyling();
|
|
376
|
-
const { description, disabled, errorMessage, ids, invalid, label, required, testId } = field;
|
|
393
|
+
const { description, disabled, errorMessage, ids, invalid, label, readOnly, required, testId } = field;
|
|
377
394
|
const variants = styling.resolve(selectVariants, {
|
|
378
395
|
disabled,
|
|
379
|
-
invalid
|
|
396
|
+
invalid,
|
|
397
|
+
readOnly
|
|
380
398
|
});
|
|
381
399
|
const classNames = styling.variantsToClassNames(variants, className, "base");
|
|
382
400
|
return /* @__PURE__ */ jsx(FieldLayout, {
|
|
@@ -399,8 +417,7 @@ const SelectControl = ({ className, field, ...props }) => {
|
|
|
399
417
|
})
|
|
400
418
|
});
|
|
401
419
|
};
|
|
402
|
-
|
|
403
|
-
//#region src/Select/Select.tsx
|
|
420
|
+
// src/Select/Select.tsx
|
|
404
421
|
/** Form selection field with searchable single or multiple options */
|
|
405
422
|
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
423
|
const { getFieldState } = useFormContext();
|
|
@@ -430,10 +447,8 @@ const Select = ({ className = void 0, clearable = true, debugMenuOpen = false, f
|
|
|
430
447
|
selectedOptionFallback
|
|
431
448
|
});
|
|
432
449
|
};
|
|
433
|
-
|
|
434
|
-
//#region src/Select/index.ts
|
|
450
|
+
// src/Select/index.ts
|
|
435
451
|
var Select_default = Select;
|
|
436
|
-
//#endregion
|
|
437
452
|
export { Select_default as default, selectVariants };
|
|
438
453
|
|
|
439
454
|
//# 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,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,iBAAiB;EACjB,eAAe;EACf,aAAa;EACb,gBAAgB;CAClB;CACA,UAAU;EACR,UAAU,EAAE,MAAM,EAAE,MAAM,uCAAuC,EAAE;EACnE,SAAS,EAAE,MAAM,EAAE,eAAe,eAAe,EAAE;CACrD;AACF,CAAC;;;;ACxED,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;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3C;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\nimport { fieldHelperVariants } from '../partials/FieldHelper/fieldHelperVariants';\nimport { fieldLabelVariants } from '../partials/FieldLabel/fieldLabelVariants';\n\nexport const selectVariants = tv({\n extend: fieldHelperVariants,\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 // 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 downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorSeparator: 'bg-default-300',\n indicatorsContainer: 'gap-1 p-1',\n input: 'py-0.5 pl-1',\n label: [fieldLabelVariants.base, 'pointer-events-auto inline-flex'],\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":";;;;;;;;;;;;;AAOA,MAAa,iBAAiB,GAAG;CAC/B,QAAQ;CACR,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;EACF;EACA,gBACE;EACF,SAAS;GAEP;GAEA;GAEA;EACF;EACA,iBAAiB;EACjB,WAAW;EACX,aAAa;EACb,mBACE;EACF,OAAO;EACP,cAAc;EACd,oBAAoB;EACpB,qBAAqB;EACrB,OAAO;EACP,OAAO,CAAC,mBAAmB,MAAM,iCAAiC;EAClE,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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