@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/Slider/sliderVariants.ts","../../src/Slider/Slider.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Slider/sliderVariants.ts","../../src/Slider/Slider.tsx"],"mappings":";;;qBAIa,kBAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwGf,YAAY,mBAAmB;UCnG1B;;EAEf;;EAEA,YAAY;;EAEZ,cAAc;;EAEd;;EAEA,aAAa;;EAEb;;EAEA;;;;;EAKA;;;;;EAKA;;EAEA;;EAEA;;;;;EAKA;;EAEA;;EAEA,eAAe;;;;;EAKf;;EAEA;;EAEA,YAAY;;;cAIR,WAAU,WAAA,YAAA,YAAA,UAAA,UAAA,MAAA,WAAA,MAAA,cAAA,SAAA,qBAYb,gCAAW,IAAA"}
|
package/dist/Slider/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { n as useUniformField, t as FieldLabel } from "../FieldLabel-DrNWJIVh.mjs";
|
|
1
2
|
import { isValueEmpty } from "../helpers/index.mjs";
|
|
2
|
-
import { n as
|
|
3
|
-
import {
|
|
4
|
-
import { useMemo } from "react";
|
|
3
|
+
import { n as getFieldControlProps, t as FieldDescription } from "../FieldDescription-X_0s1Lhu.mjs";
|
|
4
|
+
import { useEffect, useMemo } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { tv } from "@fuf-stack/pixel-utils";
|
|
7
7
|
import { useStyling } from "@fuf-stack/pixels/StylingProvider";
|
|
8
8
|
import { Label, Slider, SliderFill, SliderOutput, SliderThumb, SliderTrack } from "react-aria-components";
|
|
9
9
|
import { useHover } from "react-aria/useHover";
|
|
10
|
-
|
|
10
|
+
// src/Slider/sliderVariants.ts
|
|
11
11
|
const sliderVariants = tv({
|
|
12
12
|
slots: {
|
|
13
13
|
base: [
|
|
@@ -69,6 +69,10 @@ const sliderVariants = tv({
|
|
|
69
69
|
thumb: "cursor-default",
|
|
70
70
|
visualBase: "opacity-disabled"
|
|
71
71
|
} },
|
|
72
|
+
readOnly: { true: {
|
|
73
|
+
base: "cursor-not-allowed **:cursor-not-allowed",
|
|
74
|
+
visualBase: "opacity-disabled"
|
|
75
|
+
} },
|
|
72
76
|
invalid: { true: {
|
|
73
77
|
filler: "bg-danger",
|
|
74
78
|
thumb: "bg-danger",
|
|
@@ -81,8 +85,7 @@ const sliderVariants = tv({
|
|
|
81
85
|
size: "sm"
|
|
82
86
|
}]
|
|
83
87
|
});
|
|
84
|
-
|
|
85
|
-
//#region src/Slider/subcomponents/SliderTrackControl.tsx
|
|
88
|
+
// src/Slider/subcomponents/SliderTrackControl.tsx
|
|
86
89
|
/**
|
|
87
90
|
* Slider track with fill, step markers and the editable thumb
|
|
88
91
|
*
|
|
@@ -155,15 +158,14 @@ const SliderTrackControl = ({ className: classNames, endContent, fillOffset, inp
|
|
|
155
158
|
]
|
|
156
159
|
});
|
|
157
160
|
};
|
|
158
|
-
|
|
159
|
-
//#region src/Slider/subcomponents/SliderControl.tsx
|
|
161
|
+
// src/Slider/subcomponents/SliderControl.tsx
|
|
160
162
|
/**
|
|
161
163
|
* Slider presentation with label, value output and thumb focus routing
|
|
162
164
|
*
|
|
163
165
|
* @see https://react-aria.adobe.com/Slider
|
|
164
166
|
*/
|
|
165
167
|
const SliderControl = ({ field, className, endContent, fillOffset, maxValue = 100, minValue = 0, getCurrentValue, showSteps, size, startContent, step = 1 }) => {
|
|
166
|
-
const { value: displayValue, description, disabled, errorMessage, ids, ref: inputRef, invalid, label = void 0, name, onBlur, onChange: onValueChange, required, testId } = field;
|
|
168
|
+
const { value: displayValue, description, disabled, errorMessage, ids, ref: inputRef, invalid, label = void 0, name, onBlur, onChange: onValueChange, readOnly, required, testId } = field;
|
|
167
169
|
const controlProps = getFieldControlProps(field);
|
|
168
170
|
const styling = useStyling();
|
|
169
171
|
const { hoverProps, isHovered } = useHover({ isDisabled: disabled });
|
|
@@ -179,18 +181,26 @@ const SliderControl = ({ field, className, endContent, fillOffset, maxValue = 10
|
|
|
179
181
|
}
|
|
180
182
|
};
|
|
181
183
|
}, [inputRef]);
|
|
184
|
+
useEffect(() => {
|
|
185
|
+
if (readOnly) controlRef.current?.setAttribute("aria-readonly", "true");
|
|
186
|
+
else controlRef.current?.removeAttribute("aria-readonly");
|
|
187
|
+
}, [controlRef, readOnly]);
|
|
182
188
|
const associations = controlProps;
|
|
183
189
|
const describedBy = [associations["aria-describedby"], required ? `${ids.control}-required` : void 0].filter(Boolean).join(" ") || void 0;
|
|
184
190
|
const rawValue = displayValue != null ? Number(displayValue) : minValue;
|
|
185
191
|
const value = Math.min(maxValue, Math.max(minValue, rawValue));
|
|
186
192
|
const variants = styling.resolve(sliderVariants, {
|
|
187
|
-
size,
|
|
188
193
|
disabled,
|
|
189
|
-
invalid
|
|
194
|
+
invalid,
|
|
195
|
+
readOnly,
|
|
196
|
+
size
|
|
190
197
|
});
|
|
191
198
|
const classNames = styling.variantsToClassNames(variants, className, "base");
|
|
199
|
+
const handleValueChange = (nextValue) => {
|
|
200
|
+
if (!readOnly) onValueChange(nextValue);
|
|
201
|
+
};
|
|
192
202
|
const handleValueCommit = (nextValue) => {
|
|
193
|
-
if (isValueEmpty(getCurrentValue())) onValueChange(nextValue);
|
|
203
|
+
if (!readOnly && isValueEmpty(getCurrentValue())) onValueChange(nextValue);
|
|
194
204
|
};
|
|
195
205
|
const handleFocus = (event) => {
|
|
196
206
|
if (event.target === event.currentTarget && !disabled) controlRef.current?.focus();
|
|
@@ -199,6 +209,7 @@ const SliderControl = ({ field, className, endContent, fillOffset, maxValue = 10
|
|
|
199
209
|
className: classNames.base,
|
|
200
210
|
"data-component": "slider",
|
|
201
211
|
"data-invalid": invalid,
|
|
212
|
+
"data-readonly": readOnly || void 0,
|
|
202
213
|
"data-required": required,
|
|
203
214
|
"data-testid": testId,
|
|
204
215
|
onFocus: handleFocus,
|
|
@@ -221,7 +232,7 @@ const SliderControl = ({ field, className, endContent, fillOffset, maxValue = 10
|
|
|
221
232
|
isDisabled: disabled,
|
|
222
233
|
maxValue,
|
|
223
234
|
minValue,
|
|
224
|
-
onChange:
|
|
235
|
+
onChange: handleValueChange,
|
|
225
236
|
onChangeEnd: handleValueCommit,
|
|
226
237
|
step,
|
|
227
238
|
value,
|
|
@@ -270,8 +281,7 @@ const SliderControl = ({ field, className, endContent, fillOffset, maxValue = 10
|
|
|
270
281
|
]
|
|
271
282
|
});
|
|
272
283
|
};
|
|
273
|
-
|
|
274
|
-
//#region src/Slider/Slider.tsx
|
|
284
|
+
// src/Slider/Slider.tsx
|
|
275
285
|
/** Form input field for choosing a numeric value along a track */
|
|
276
286
|
const Slider$1 = ({ className = void 0, endContent = void 0, fillOffset = void 0, maxValue = 100, minValue = 0, name, showSteps = false, size = "md", startContent = void 0, step = 1, ...uniformFieldProps }) => {
|
|
277
287
|
const { field, getValues } = useUniformField({
|
|
@@ -295,10 +305,8 @@ const Slider$1 = ({ className = void 0, endContent = void 0, fillOffset = void 0
|
|
|
295
305
|
step
|
|
296
306
|
});
|
|
297
307
|
};
|
|
298
|
-
|
|
299
|
-
//#region src/Slider/index.ts
|
|
308
|
+
// src/Slider/index.ts
|
|
300
309
|
var Slider_default = Slider$1;
|
|
301
|
-
//#endregion
|
|
302
310
|
export { Slider_default as default, sliderVariants };
|
|
303
311
|
|
|
304
312
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["AriaSlider","Slider","Slider"],"sources":["../../src/Slider/sliderVariants.ts","../../src/Slider/subcomponents/SliderTrackControl.tsx","../../src/Slider/subcomponents/SliderControl.tsx","../../src/Slider/Slider.tsx","../../src/Slider/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const sliderVariants = tv({\n slots: {\n base: [\n // Enables group-data selectors used by slider slots.\n 'group',\n // Match shared field wrapper layout.\n 'flex w-full flex-col',\n // Keep spacing between label/track consistent.\n 'gap-y-1.5',\n ],\n description: 'text-foreground-500 text-tiny',\n endContent: '',\n errorMessage: ['ml-1 mt-1', 'm-0 text-danger text-tiny'],\n filler: ['', 'absolute h-full bg-primary'],\n helperWrapper: 'relative ml-0 block p-0',\n // Field-level invalid styling is supplied by the owning group.\n label:\n 'cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger',\n labelWrapper: ['mb-1', 'flex w-full items-center justify-between'],\n mark: '',\n startContent: '',\n step: [\n '',\n // marker positioning\n 'absolute top-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2',\n // marker surface\n 'rounded-full bg-default-300/50',\n // selected range and RTL positioning\n 'data-[in-range=true]:bg-background/50 rtl:translate-x-1/2',\n ],\n // Mouse submission can focus an invalid thumb without keyboard focus-visible.\n thumb: [\n 'group-data-[invalid=true]:data-[focused=true]:outline-2',\n 'group-data-[invalid=true]:data-[focused=true]:outline-focus',\n 'group-data-[invalid=true]:data-[focused=true]:outline-offset-2',\n // thumb layout and surface\n 'outline-solid top-1/2 flex h-6 w-6 cursor-grab items-center justify-center rounded-full border-0 bg-primary shadow-small outline-transparent ring-transparent',\n // expanded pointer target\n \"before:absolute before:h-11 before:w-11 before:rounded-full before:content-['']\",\n // inner thumb surface\n \"after:h-5 after:w-5 after:rounded-full after:bg-background after:shadow-small after:transition-all after:content-['']\",\n // focus and drag stacking\n 'data-[focus-visible=true]:z-10 data-[focused=true]:z-10 data-[dragging=true]:cursor-grabbing',\n // keyboard focus outline\n 'data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus',\n // pressed thumb and reduced motion\n 'data-[dragging=true]:after:scale-80 motion-reduce:after:transition-none',\n ],\n track: [\n '',\n // track geometry and surface\n 'relative my-1.5 flex h-3 w-full rounded-full border-x-[12px] border-x-transparent bg-default-300/50',\n // fill colors at the track ends\n 'data-[fill-end=true]:border-e-primary data-[fill-start=true]:border-s-primary',\n ],\n trackWrapper: ['', 'relative flex items-center gap-2'],\n value: ['', 'text-small'],\n visualBase: 'flex w-full flex-col gap-1',\n },\n variants: {\n size: {\n lg: {\n step: 'h-2 w-2',\n thumb: 'h-7 w-7 shadow-none',\n track: 'my-1 h-7 border-x-[14px]',\n value: 'text-medium',\n },\n md: {},\n sm: {\n step: 'data-[in-range=false]:bg-default-200 data-[in-range=true]:bg-primary',\n thumb: 'h-5 w-5 after:h-4 after:w-4',\n track: 'my-2 h-1 border-x-[10px]',\n },\n },\n disabled: {\n true: { thumb: 'cursor-default', visualBase: 'opacity-disabled' },\n },\n invalid: {\n true: {\n filler: 'bg-danger',\n thumb: 'bg-danger',\n track:\n 'data-[fill-end=true]:border-e-danger data-[fill-start=true]:border-s-danger',\n },\n },\n },\n compoundVariants: [\n {\n class: { step: 'data-[in-range=true]:bg-danger' },\n invalid: true,\n size: 'sm',\n },\n ],\n});\n\nexport type VariantProps = TVProps<typeof sliderVariants>;\n\nexport type ClassName = TVClassName<typeof sliderVariants>;\n\nexport type SliderClassNames = Record<\n keyof ReturnType<typeof sliderVariants>,\n string\n>;\n","import type { RefObject } from 'react';\nimport type { SliderProps } from '../Slider';\nimport type { SliderClassNames } from '../sliderVariants';\n\nimport { SliderFill, SliderThumb, SliderTrack } from 'react-aria-components';\n\ninterface SliderTrackControlProps extends Pick<\n SliderProps,\n 'endContent' | 'fillOffset' | 'name' | 'showSteps' | 'startContent'\n> {\n /** CSS class name */\n className: SliderClassNames;\n /** Ref forwarded to the native range input */\n inputRef: RefObject<HTMLInputElement | null>;\n /** Shows validation failure */\n invalid: boolean;\n /** Largest displayed value */\n maxValue: number;\n /** Smallest displayed value */\n minValue: number;\n /** Callback when the thumb loses focus */\n onBlur: () => void;\n /** Distance between selectable values */\n step: number;\n}\n\n/**\n * Slider track with fill, step markers and the editable thumb\n *\n * @see https://react-aria.adobe.com/Slider\n */\nconst SliderTrackControl = ({\n className: classNames,\n endContent,\n fillOffset,\n inputRef,\n invalid,\n maxValue,\n minValue,\n name,\n onBlur,\n showSteps,\n startContent,\n step,\n}: SliderTrackControlProps) => {\n const stepCount = showSteps\n ? Math.max(0, Math.floor((maxValue - minValue) / (step > 0 ? step : 1)) + 1)\n : 0;\n\n const offset = fillOffset ?? minValue;\n const offsetPercent =\n maxValue === minValue\n ? 0\n : (Math.min(maxValue, Math.max(minValue, offset)) - minValue) /\n (maxValue - minValue);\n\n return (\n <div className={classNames.trackWrapper} data-slot=\"track-wrapper\">\n {startContent ? (\n <div className={classNames.startContent} data-slot=\"startContent\">\n {startContent}\n </div>\n ) : null}\n <SliderTrack\n className={classNames.track}\n data-slot=\"track\"\n render={(props, { state }) => {\n const percent = state.getThumbPercent(0);\n const start = Math.min(offsetPercent, percent);\n const end = Math.max(offsetPercent, percent);\n\n return (\n <div\n {...props}\n data-fill-end={\n fillOffset === undefined ? end - start === 1 : end === 1\n }\n data-fill-start={\n fillOffset === undefined ? end - start > 0 : start === 0\n }\n data-thumb-hidden=\"false\"\n data-vertical=\"false\"\n >\n {props.children}\n </div>\n );\n }}\n >\n {({ state }) => {\n const percent = state.getThumbPercent(0);\n const start = Math.min(offsetPercent, percent);\n const end = Math.max(offsetPercent, percent);\n\n return (\n <>\n <SliderFill\n className={classNames.filler}\n data-slot=\"filler\"\n offset={fillOffset}\n />\n {Array.from({ length: stepCount }, (_, index) => {\n const point = state.getValuePercent(minValue + index * step);\n\n return (\n <span\n key={index}\n aria-hidden\n className={classNames.step}\n data-in-range={point >= start && point <= end}\n data-slot=\"step\"\n style={{ insetInlineStart: `${point * 100}%` }}\n />\n );\n })}\n <SliderThumb\n className={classNames.thumb}\n data-slot=\"thumb\"\n inputRef={inputRef}\n isInvalid={invalid}\n name={name}\n onBlur={onBlur}\n />\n </>\n );\n }}\n </SliderTrack>\n {endContent ? (\n <div className={classNames.endContent} data-slot=\"endContent\">\n {endContent}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default SliderTrackControl;\n","import type { FocusEvent } from 'react';\nimport type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SliderProps } from '../Slider';\n\nimport { useMemo } from 'react';\nimport {\n Slider as AriaSlider,\n Label,\n SliderOutput,\n} from 'react-aria-components';\nimport { useHover } from 'react-aria/useHover';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { isValueEmpty } from '../../helpers';\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldDescription from '../../partials/FieldDescription/FieldDescription';\nimport FieldLabel from '../../partials/FieldLabel/FieldLabel';\nimport { sliderVariants } from '../sliderVariants';\nimport SliderTrackControl from './SliderTrackControl';\n\ninterface SliderControlProps extends Omit<\n SliderProps,\n keyof UniformField | 'transform'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, number>;\n /** Reads the stored value at interaction completion */\n getCurrentValue: () => unknown;\n}\n\n/**\n * Slider presentation with label, value output and thumb focus routing\n *\n * @see https://react-aria.adobe.com/Slider\n */\nconst SliderControl = ({\n field,\n className,\n endContent,\n fillOffset,\n maxValue = 100,\n minValue = 0,\n getCurrentValue,\n showSteps,\n size,\n startContent,\n step = 1,\n}: SliderControlProps) => {\n const {\n value: displayValue,\n description,\n disabled,\n errorMessage,\n ids,\n ref: inputRef,\n invalid,\n label = undefined,\n name,\n onBlur,\n onChange: onValueChange,\n required,\n testId,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const styling = useStyling();\n const { hoverProps, isHovered } = useHover({ isDisabled: disabled });\n\n // forward the thumb ref while keeping it available for wrapper focus\n const controlRef = useMemo(() => {\n let current: HTMLInputElement | null = null;\n\n return {\n get current() {\n return current;\n },\n set current(node: HTMLInputElement | null) {\n current = node;\n inputRef(node);\n },\n };\n }, [inputRef]);\n\n const associations = controlProps;\n const describedBy =\n [\n associations['aria-describedby'],\n required ? `${ids.control}-required` : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const rawValue = displayValue != null ? Number(displayValue) : minValue;\n const value = Math.min(maxValue, Math.max(minValue, rawValue));\n\n // classNames from slots\n const variants = styling.resolve(sliderVariants, { size, disabled, invalid });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n // an empty field may finish at the displayed minimum without emitting a change\n const handleValueCommit = (nextValue: number) => {\n if (isValueEmpty(getCurrentValue())) {\n onValueChange(nextValue);\n }\n };\n\n // route wrapper focus to the editable thumb\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && !disabled) {\n controlRef.current?.focus();\n }\n };\n\n return (\n <div\n className={classNames.base}\n data-component=\"slider\"\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n onFocus={handleFocus}\n tabIndex={disabled ? undefined : -1}\n >\n {required ? (\n <span className=\"sr-only\" id={`${ids.control}-required`}>\n Required selection.\n </span>\n ) : null}\n <AriaSlider<number>\n aria-invalid={associations['aria-invalid']}\n aria-label={associations['aria-label']}\n id={associations.id}\n {...hoverProps}\n aria-describedby={describedBy}\n className={classNames.visualBase}\n data-hover={isHovered}\n data-slot=\"base\"\n isDisabled={disabled}\n maxValue={maxValue}\n minValue={minValue}\n onChange={onValueChange}\n onChangeEnd={handleValueCommit}\n step={step}\n value={value}\n >\n {/* label and current value */}\n {label ? (\n <div className={classNames.labelWrapper} data-slot=\"labelWrapper\">\n {label ? (\n <FieldLabel\n as={Label}\n className={classNames.label}\n id={ids.label}\n required={required}\n >\n {label}\n </FieldLabel>\n ) : null}\n <SliderOutput className={classNames.value} data-slot=\"value\" />\n </div>\n ) : null}\n\n {/* slider track and surrounding content */}\n <SliderTrackControl\n className={classNames}\n endContent={endContent}\n fillOffset={fillOffset}\n inputRef={controlRef}\n invalid={invalid}\n maxValue={maxValue}\n minValue={minValue}\n name={name}\n onBlur={onBlur}\n showSteps={showSteps}\n startContent={startContent}\n step={step}\n />\n </AriaSlider>\n\n {/* help text and validation messages */}\n {description || invalid ? (\n <div className={classNames.helperWrapper} data-slot=\"helper-wrapper\">\n <FieldDescription\n className={classNames.description}\n id={ids.description}\n >\n {description}\n </FieldDescription>\n {invalid ? (\n <div\n className={classNames.errorMessage}\n data-slot=\"error-message\"\n id={ids.error}\n >\n {errorMessage}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default SliderControl;\n","import type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\nimport type { ClassName } from './sliderVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SliderControl from './subcomponents/SliderControl';\n\nexport { sliderVariants } from './sliderVariants';\n\nexport interface SliderProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Content to display at the end of the slider */\n endContent?: ReactNode;\n /** The offset from where the fill should start */\n fillOffset?: number;\n /** Field label */\n label?: string;\n /**\n * The maximum value of the slider\n * @default 100\n */\n maxValue?: number;\n /**\n * The minimum value of the slider\n * @default 0\n */\n minValue?: number;\n /** Field name */\n name: string;\n /**\n * Whether to show step dots on the slider\n * @default false\n */\n showSteps?: boolean;\n /** Control size */\n size?: 'sm' | 'md' | 'lg';\n /** Content to display at the start of the slider */\n startContent?: ReactNode;\n /**\n * The step value of the slider\n * @default 1\n */\n step?: number;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Transform between stored form values and numeric slider values. Range and step use display units. */\n transform?: InputValueTransform<number>;\n}\n\n/** Form input field for choosing a numeric value along a track */\nconst Slider = ({\n className = undefined,\n endContent = undefined,\n fillOffset = undefined,\n maxValue = 100,\n minValue = 0,\n name,\n showSteps = false,\n size = 'md',\n startContent = undefined,\n step = 1,\n ...uniformFieldProps\n}: SliderProps) => {\n const { field, getValues } = useUniformField({\n ...uniformFieldProps,\n name,\n });\n\n const getCurrentValue = (): unknown => {\n return getValues(name);\n };\n\n return (\n <SliderControl\n className={className}\n endContent={endContent}\n field={field}\n fillOffset={fillOffset}\n getCurrentValue={getCurrentValue}\n maxValue={maxValue}\n minValue={minValue}\n showSteps={showSteps}\n size={size}\n startContent={startContent}\n step={step}\n />\n );\n};\n\nexport default Slider;\n","import Slider from './Slider';\n\nexport type { SliderProps } from './Slider';\n\nexport { sliderVariants } from './Slider';\n\nexport default Slider;\n"],"mappings":";;;;;;;;;;AAIA,MAAa,iBAAiB,GAAG;CAC/B,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;EACF;EACA,aAAa;EACb,YAAY;EACZ,cAAc,CAAC,aAAa,2BAA2B;EACvD,QAAQ,CAAC,IAAI,4BAA4B;EACzC,eAAe;EAEf,OACE;EACF,cAAc,CAAC,QAAQ,0CAA0C;EACjE,MAAM;EACN,cAAc;EACd,MAAM;GACJ;GAEA;GAEA;GAEA;EACF;EAEA,OAAO;GACL;GACA;GACA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;EACF;EACA,OAAO;GACL;GAEA;GAEA;EACF;EACA,cAAc,CAAC,IAAI,kCAAkC;EACrD,OAAO,CAAC,IAAI,YAAY;EACxB,YAAY;CACd;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IACF,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;GACT;GACA,IAAI,CAAC;GACL,IAAI;IACF,MAAM;IACN,OAAO;IACP,OAAO;GACT;EACF;EACA,UAAU,EACR,MAAM;GAAE,OAAO;GAAkB,YAAY;EAAmB,EAClE;EACA,SAAS,EACP,MAAM;GACJ,QAAQ;GACR,OAAO;GACP,OACE;EACJ,EACF;CACF;CACA,kBAAkB,CAChB;EACE,OAAO,EAAE,MAAM,iCAAiC;EAChD,SAAS;EACT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,WAAW;KACtB,IAAI,IAAI;KAEP,UAAA;IACe,CAAA,GACjB,UACC,oBAAC,OAAD;KACE,WAAW,WAAW;KACtB,aAAU;KACV,IAAI,IAAI;KAEP,UAAA;IACE,CAAA,IACH,IACD;GACH,CAAA,IAAA;EACD;;AAET;;;;ACnJA,MAAMC,YAAU,EACd,YAAY,KAAA,GACZ,aAAa,KAAA,GACb,aAAa,KAAA,GACb,WAAW,KACX,WAAW,GACX,MACA,YAAY,OACZ,OAAO,MACP,eAAe,KAAA,GACf,OAAO,GACP,GAAG,wBACc;CACjB,MAAM,EAAE,OAAO,cAAc,gBAAgB;EAC3C,GAAG;EACH;CACF,CAAC;CAED,MAAM,wBAAiC;EACrC,OAAO,UAAU,IAAI;CACvB;CAEA,OACE,oBAAC,eAAD;EACa;EACC;EACL;EACK;EACK;EACP;EACA;EACC;EACL;EACQ;EACR;CACP,CAAA;AAEL;;;ACxFA,IAAA,iBAAeC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["AriaSlider","Slider","Slider"],"sources":["../../src/Slider/sliderVariants.ts","../../src/Slider/subcomponents/SliderTrackControl.tsx","../../src/Slider/subcomponents/SliderControl.tsx","../../src/Slider/Slider.tsx","../../src/Slider/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const sliderVariants = tv({\n slots: {\n base: [\n // Enables group-data selectors used by slider slots.\n 'group',\n // Match shared field wrapper layout.\n 'flex w-full flex-col',\n // Keep spacing between label/track consistent.\n 'gap-y-1.5',\n ],\n description: 'text-foreground-500 text-tiny',\n endContent: '',\n errorMessage: ['ml-1 mt-1', 'm-0 text-danger text-tiny'],\n filler: ['', 'absolute h-full bg-primary'],\n helperWrapper: 'relative ml-0 block p-0',\n // Field-level invalid styling is supplied by the owning group.\n label:\n 'cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger',\n labelWrapper: ['mb-1', 'flex w-full items-center justify-between'],\n mark: '',\n startContent: '',\n step: [\n '',\n // marker positioning\n 'absolute top-1/2 h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2',\n // marker surface\n 'rounded-full bg-default-300/50',\n // selected range and RTL positioning\n 'data-[in-range=true]:bg-background/50 rtl:translate-x-1/2',\n ],\n // Mouse submission can focus an invalid thumb without keyboard focus-visible.\n thumb: [\n 'group-data-[invalid=true]:data-[focused=true]:outline-2',\n 'group-data-[invalid=true]:data-[focused=true]:outline-focus',\n 'group-data-[invalid=true]:data-[focused=true]:outline-offset-2',\n // thumb layout and surface\n 'outline-solid top-1/2 flex h-6 w-6 cursor-grab items-center justify-center rounded-full border-0 bg-primary shadow-small outline-transparent ring-transparent',\n // expanded pointer target\n \"before:absolute before:h-11 before:w-11 before:rounded-full before:content-['']\",\n // inner thumb surface\n \"after:h-5 after:w-5 after:rounded-full after:bg-background after:shadow-small after:transition-all after:content-['']\",\n // focus and drag stacking\n 'data-[focus-visible=true]:z-10 data-[focused=true]:z-10 data-[dragging=true]:cursor-grabbing',\n // keyboard focus outline\n 'data-[focus-visible=true]:outline-2 data-[focus-visible=true]:outline-offset-2 data-[focus-visible=true]:outline-focus',\n // pressed thumb and reduced motion\n 'data-[dragging=true]:after:scale-80 motion-reduce:after:transition-none',\n ],\n track: [\n '',\n // track geometry and surface\n 'relative my-1.5 flex h-3 w-full rounded-full border-x-[12px] border-x-transparent bg-default-300/50',\n // fill colors at the track ends\n 'data-[fill-end=true]:border-e-primary data-[fill-start=true]:border-s-primary',\n ],\n trackWrapper: ['', 'relative flex items-center gap-2'],\n value: ['', 'text-small'],\n visualBase: 'flex w-full flex-col gap-1',\n },\n variants: {\n size: {\n lg: {\n step: 'h-2 w-2',\n thumb: 'h-7 w-7 shadow-none',\n track: 'my-1 h-7 border-x-[14px]',\n value: 'text-medium',\n },\n md: {},\n sm: {\n step: 'data-[in-range=false]:bg-default-200 data-[in-range=true]:bg-primary',\n thumb: 'h-5 w-5 after:h-4 after:w-4',\n track: 'my-2 h-1 border-x-[10px]',\n },\n },\n disabled: {\n true: { thumb: 'cursor-default', visualBase: 'opacity-disabled' },\n },\n readOnly: {\n true: {\n // inner controls set their own cursors, override every descendant\n base: 'cursor-not-allowed **:cursor-not-allowed',\n visualBase: 'opacity-disabled',\n },\n },\n invalid: {\n true: {\n filler: 'bg-danger',\n thumb: 'bg-danger',\n track:\n 'data-[fill-end=true]:border-e-danger data-[fill-start=true]:border-s-danger',\n },\n },\n },\n compoundVariants: [\n {\n class: { step: 'data-[in-range=true]:bg-danger' },\n invalid: true,\n size: 'sm',\n },\n ],\n});\n\nexport type VariantProps = TVProps<typeof sliderVariants>;\n\nexport type ClassName = TVClassName<typeof sliderVariants>;\n\nexport type SliderClassNames = Record<\n keyof ReturnType<typeof sliderVariants>,\n string\n>;\n","import type { RefObject } from 'react';\nimport type { SliderProps } from '../Slider';\nimport type { SliderClassNames } from '../sliderVariants';\n\nimport { SliderFill, SliderThumb, SliderTrack } from 'react-aria-components';\n\ninterface SliderTrackControlProps extends Pick<\n SliderProps,\n 'endContent' | 'fillOffset' | 'name' | 'showSteps' | 'startContent'\n> {\n /** CSS class name */\n className: SliderClassNames;\n /** Ref forwarded to the native range input */\n inputRef: RefObject<HTMLInputElement | null>;\n /** Shows validation failure */\n invalid: boolean;\n /** Largest displayed value */\n maxValue: number;\n /** Smallest displayed value */\n minValue: number;\n /** Callback when the thumb loses focus */\n onBlur: () => void;\n /** Distance between selectable values */\n step: number;\n}\n\n/**\n * Slider track with fill, step markers and the editable thumb\n *\n * @see https://react-aria.adobe.com/Slider\n */\nconst SliderTrackControl = ({\n className: classNames,\n endContent,\n fillOffset,\n inputRef,\n invalid,\n maxValue,\n minValue,\n name,\n onBlur,\n showSteps,\n startContent,\n step,\n}: SliderTrackControlProps) => {\n const stepCount = showSteps\n ? Math.max(0, Math.floor((maxValue - minValue) / (step > 0 ? step : 1)) + 1)\n : 0;\n\n const offset = fillOffset ?? minValue;\n const offsetPercent =\n maxValue === minValue\n ? 0\n : (Math.min(maxValue, Math.max(minValue, offset)) - minValue) /\n (maxValue - minValue);\n\n return (\n <div className={classNames.trackWrapper} data-slot=\"track-wrapper\">\n {startContent ? (\n <div className={classNames.startContent} data-slot=\"startContent\">\n {startContent}\n </div>\n ) : null}\n <SliderTrack\n className={classNames.track}\n data-slot=\"track\"\n render={(props, { state }) => {\n const percent = state.getThumbPercent(0);\n const start = Math.min(offsetPercent, percent);\n const end = Math.max(offsetPercent, percent);\n\n return (\n <div\n {...props}\n data-fill-end={\n fillOffset === undefined ? end - start === 1 : end === 1\n }\n data-fill-start={\n fillOffset === undefined ? end - start > 0 : start === 0\n }\n data-thumb-hidden=\"false\"\n data-vertical=\"false\"\n >\n {props.children}\n </div>\n );\n }}\n >\n {({ state }) => {\n const percent = state.getThumbPercent(0);\n const start = Math.min(offsetPercent, percent);\n const end = Math.max(offsetPercent, percent);\n\n return (\n <>\n <SliderFill\n className={classNames.filler}\n data-slot=\"filler\"\n offset={fillOffset}\n />\n {Array.from({ length: stepCount }, (_, index) => {\n const point = state.getValuePercent(minValue + index * step);\n\n return (\n <span\n key={index}\n aria-hidden\n className={classNames.step}\n data-in-range={point >= start && point <= end}\n data-slot=\"step\"\n style={{ insetInlineStart: `${point * 100}%` }}\n />\n );\n })}\n <SliderThumb\n className={classNames.thumb}\n data-slot=\"thumb\"\n inputRef={inputRef}\n isInvalid={invalid}\n name={name}\n onBlur={onBlur}\n />\n </>\n );\n }}\n </SliderTrack>\n {endContent ? (\n <div className={classNames.endContent} data-slot=\"endContent\">\n {endContent}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default SliderTrackControl;\n","import type { FocusEvent } from 'react';\nimport type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SliderProps } from '../Slider';\n\nimport { useEffect, useMemo } from 'react';\nimport {\n Slider as AriaSlider,\n Label,\n SliderOutput,\n} from 'react-aria-components';\nimport { useHover } from 'react-aria/useHover';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { isValueEmpty } from '../../helpers';\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldDescription from '../../partials/FieldDescription/FieldDescription';\nimport FieldLabel from '../../partials/FieldLabel/FieldLabel';\nimport { sliderVariants } from '../sliderVariants';\nimport SliderTrackControl from './SliderTrackControl';\n\ninterface SliderControlProps extends Omit<\n SliderProps,\n keyof UniformField | 'transform'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, number>;\n /** Reads the stored value at interaction completion */\n getCurrentValue: () => unknown;\n}\n\n/**\n * Slider presentation with label, value output and thumb focus routing\n *\n * @see https://react-aria.adobe.com/Slider\n */\nconst SliderControl = ({\n field,\n className,\n endContent,\n fillOffset,\n maxValue = 100,\n minValue = 0,\n getCurrentValue,\n showSteps,\n size,\n startContent,\n step = 1,\n}: SliderControlProps) => {\n const {\n value: displayValue,\n description,\n disabled,\n errorMessage,\n ids,\n ref: inputRef,\n invalid,\n label = undefined,\n name,\n onBlur,\n onChange: onValueChange,\n readOnly,\n required,\n testId,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const styling = useStyling();\n const { hoverProps, isHovered } = useHover({ isDisabled: disabled });\n\n // forward the thumb ref while keeping it available for wrapper focus\n const controlRef = useMemo(() => {\n let current: HTMLInputElement | null = null;\n\n return {\n get current() {\n return current;\n },\n set current(node: HTMLInputElement | null) {\n current = node;\n inputRef(node);\n },\n };\n }, [inputRef]);\n\n // React Aria's thumb input has no read-only prop, mark it directly so screen\n // readers announce the state when keyboard focus reaches the thumb\n useEffect(() => {\n if (readOnly) {\n controlRef.current?.setAttribute('aria-readonly', 'true');\n } else {\n controlRef.current?.removeAttribute('aria-readonly');\n }\n }, [controlRef, readOnly]);\n\n const associations = controlProps;\n const describedBy =\n [\n associations['aria-describedby'],\n required ? `${ids.control}-required` : undefined,\n ]\n .filter(Boolean)\n .join(' ') || undefined;\n\n const rawValue = displayValue != null ? Number(displayValue) : minValue;\n const value = Math.min(maxValue, Math.max(minValue, rawValue));\n\n // classNames from slots\n const variants = styling.resolve(sliderVariants, {\n disabled,\n invalid,\n readOnly,\n size,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n // Slider has no read-only mode, read-only values ignore changes so the\n // controlled thumb keeps the stored value\n const handleValueChange = (nextValue: number) => {\n if (!readOnly) {\n onValueChange(nextValue);\n }\n };\n\n // an empty field may finish at the displayed minimum without emitting a change\n const handleValueCommit = (nextValue: number) => {\n if (!readOnly && isValueEmpty(getCurrentValue())) {\n onValueChange(nextValue);\n }\n };\n\n // route wrapper focus to the editable thumb\n const handleFocus = (event: FocusEvent<HTMLDivElement>) => {\n if (event.target === event.currentTarget && !disabled) {\n controlRef.current?.focus();\n }\n };\n\n return (\n <div\n className={classNames.base}\n data-component=\"slider\"\n data-invalid={invalid}\n data-readonly={readOnly || undefined}\n data-required={required}\n data-testid={testId}\n onFocus={handleFocus}\n tabIndex={disabled ? undefined : -1}\n >\n {required ? (\n <span className=\"sr-only\" id={`${ids.control}-required`}>\n Required selection.\n </span>\n ) : null}\n <AriaSlider<number>\n aria-invalid={associations['aria-invalid']}\n aria-label={associations['aria-label']}\n id={associations.id}\n {...hoverProps}\n aria-describedby={describedBy}\n className={classNames.visualBase}\n data-hover={isHovered}\n data-slot=\"base\"\n isDisabled={disabled}\n maxValue={maxValue}\n minValue={minValue}\n onChange={handleValueChange}\n onChangeEnd={handleValueCommit}\n step={step}\n value={value}\n >\n {/* label and current value */}\n {label ? (\n <div className={classNames.labelWrapper} data-slot=\"labelWrapper\">\n {label ? (\n <FieldLabel\n as={Label}\n className={classNames.label}\n id={ids.label}\n required={required}\n >\n {label}\n </FieldLabel>\n ) : null}\n <SliderOutput className={classNames.value} data-slot=\"value\" />\n </div>\n ) : null}\n\n {/* slider track and surrounding content */}\n <SliderTrackControl\n className={classNames}\n endContent={endContent}\n fillOffset={fillOffset}\n inputRef={controlRef}\n invalid={invalid}\n maxValue={maxValue}\n minValue={minValue}\n name={name}\n onBlur={onBlur}\n showSteps={showSteps}\n startContent={startContent}\n step={step}\n />\n </AriaSlider>\n\n {/* help text and validation messages */}\n {description || invalid ? (\n <div className={classNames.helperWrapper} data-slot=\"helper-wrapper\">\n <FieldDescription\n className={classNames.description}\n id={ids.description}\n >\n {description}\n </FieldDescription>\n {invalid ? (\n <div\n className={classNames.errorMessage}\n data-slot=\"error-message\"\n id={ids.error}\n >\n {errorMessage}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default SliderControl;\n","import type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\nimport type { ClassName } from './sliderVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SliderControl from './subcomponents/SliderControl';\n\nexport { sliderVariants } from './sliderVariants';\n\nexport interface SliderProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Content to display at the end of the slider */\n endContent?: ReactNode;\n /** The offset from where the fill should start */\n fillOffset?: number;\n /** Field label */\n label?: string;\n /**\n * The maximum value of the slider\n * @default 100\n */\n maxValue?: number;\n /**\n * The minimum value of the slider\n * @default 0\n */\n minValue?: number;\n /** Field name */\n name: string;\n /** Prevents changes while keeping the value in validation and submission */\n readOnly?: boolean;\n /**\n * Whether to show step dots on the slider\n * @default false\n */\n showSteps?: boolean;\n /** Control size */\n size?: 'sm' | 'md' | 'lg';\n /** Content to display at the start of the slider */\n startContent?: ReactNode;\n /**\n * The step value of the slider\n * @default 1\n */\n step?: number;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Transform between stored form values and numeric slider values. Range and step use display units. */\n transform?: InputValueTransform<number>;\n}\n\n/** Form input field for choosing a numeric value along a track */\nconst Slider = ({\n className = undefined,\n endContent = undefined,\n fillOffset = undefined,\n maxValue = 100,\n minValue = 0,\n name,\n showSteps = false,\n size = 'md',\n startContent = undefined,\n step = 1,\n ...uniformFieldProps\n}: SliderProps) => {\n const { field, getValues } = useUniformField({\n ...uniformFieldProps,\n name,\n });\n\n const getCurrentValue = (): unknown => {\n return getValues(name);\n };\n\n return (\n <SliderControl\n className={className}\n endContent={endContent}\n field={field}\n fillOffset={fillOffset}\n getCurrentValue={getCurrentValue}\n maxValue={maxValue}\n minValue={minValue}\n showSteps={showSteps}\n size={size}\n startContent={startContent}\n step={step}\n />\n );\n};\n\nexport default Slider;\n","import Slider from './Slider';\n\nexport type { SliderProps } from './Slider';\n\nexport { sliderVariants } from './Slider';\n\nexport default Slider;\n"],"mappings":";;;;;;;;;;AAIA,MAAa,iBAAiB,GAAG;CAC/B,OAAO;EACL,MAAM;GAEJ;GAEA;GAEA;EACF;EACA,aAAa;EACb,YAAY;EACZ,cAAc,CAAC,aAAa,2BAA2B;EACvD,QAAQ,CAAC,IAAI,4BAA4B;EACzC,eAAe;EAEf,OACE;EACF,cAAc,CAAC,QAAQ,0CAA0C;EACjE,MAAM;EACN,cAAc;EACd,MAAM;GACJ;GAEA;GAEA;GAEA;EACF;EAEA,OAAO;GACL;GACA;GACA;GAEA;GAEA;GAEA;GAEA;GAEA;GAEA;EACF;EACA,OAAO;GACL;GAEA;GAEA;EACF;EACA,cAAc,CAAC,IAAI,kCAAkC;EACrD,OAAO,CAAC,IAAI,YAAY;EACxB,YAAY;CACd;CACA,UAAU;EACR,MAAM;GACJ,IAAI;IACF,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;GACT;GACA,IAAI,CAAC;GACL,IAAI;IACF,MAAM;IACN,OAAO;IACP,OAAO;GACT;EACF;EACA,UAAU,EACR,MAAM;GAAE,OAAO;GAAkB,YAAY;EAAmB,EAClE;EACA,UAAU,EACR,MAAM;GAEJ,MAAM;GACN,YAAY;EACd,EACF;EACA,SAAS,EACP,MAAM;GACJ,QAAQ;GACR,OAAO;GACP,OACE;EACJ,EACF;CACF;CACA,kBAAkB,CAChB;EACE,OAA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C,cAAD;MAAc,WAAW,WAAW;MAAO,aAAU;KAAS,CAAA,CAC3D;IACH,CAAA,IAAA,MAGJ,oBAAC,oBAAD;KACE,WAAW;KACC;KACA;KACZ,UAAU;KACD;KACC;KACA;KACJ;KACE;KACG;KACG;KACR;IACP,CAAA,CACS;;GAGX,eAAe,UACd,qBAAC,OAAD;IAAK,WAAW,WAAW;IAAe,aAAU;IAApD,UAAA,CACE,oBAAC,kBAAD;KACE,WAAW,WAAW;KACtB,IAAI,IAAI;KAEP,UAAA;IACe,CAAA,GACjB,UACC,oBAAC,OAAD;KACE,WAAW,WAAW;KACtB,aAAU;KACV,IAAI,IAAI;KAEP,UAAA;IACE,CAAA,IACH,IACD;GACH,CAAA,IAAA;EACD;;AAET;;;AC1KA,MAAMC,YAAU,EACd,YAAY,KAAA,GACZ,aAAa,KAAA,GACb,aAAa,KAAA,GACb,WAAW,KACX,WAAW,GACX,MACA,YAAY,OACZ,OAAO,MACP,eAAe,KAAA,GACf,OAAO,GACP,GAAG,wBACc;CACjB,MAAM,EAAE,OAAO,cAAc,gBAAgB;EAC3C,GAAG;EACH;CACF,CAAC;CAED,MAAM,wBAAiC;EACrC,OAAO,UAAU,IAAI;CACvB;CAEA,OACE,oBAAC,eAAD;EACa;EACC;EACL;EACK;EACK;EACP;EACA;EACC;EACL;EACQ;EACR;CACP,CAAA;AAEL;;AC1FA,IAAA,iBAAeC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { ButtonProps } from "@fuf-stack/pixels";
|
|
3
|
-
//#region src/SubmitButton/SubmitButton.d.ts
|
|
4
3
|
interface SubmitButtonProps {
|
|
5
4
|
/** sets HTML aria-label attribute */
|
|
6
5
|
ariaLabel?: string;
|
|
@@ -39,6 +38,5 @@ interface SubmitButtonProps {
|
|
|
39
38
|
* features `isSubmitting` and `triggerSubmit` and how to re-add them safely.
|
|
40
39
|
*/
|
|
41
40
|
declare const SubmitButton: ({ ariaLabel, children, className, color, icon, loading, remoteFormId, size, testId }: SubmitButtonProps) => import("react").JSX.Element;
|
|
42
|
-
//#endregion
|
|
43
41
|
export { type SubmitButtonProps, SubmitButton as default };
|
|
44
42
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/SubmitButton/SubmitButton.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/SubmitButton/SubmitButton.tsx"],"mappings":";;UAOiB;;EAEf;;EAEA,WAAW;;EAEX;;EAEA,QAAQ;;EAER,OAAO;;EAEP;;;;EAIA;;EAEA,OAAO;;EAEP;;;;;;;;;;;;;;;;;cAkBI,iBAAgB,WAAA,UAAA,WAAA,OAAA,MAAA,SAAA,cAAA,MAAA,UAUnB,sCAAiB,IAAA"}
|
|
@@ -2,7 +2,7 @@ import { Button } from "@fuf-stack/pixels";
|
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { slugify } from "@fuf-stack/pixel-utils";
|
|
4
4
|
import { useStyling } from "@fuf-stack/pixels/StylingProvider";
|
|
5
|
-
|
|
5
|
+
// src/SubmitButton/SubmitButton.tsx
|
|
6
6
|
/**
|
|
7
7
|
* Submit button for a uniform `Form`.
|
|
8
8
|
*
|
|
@@ -34,10 +34,8 @@ const SubmitButton = ({ ariaLabel = "Submit form", children = "Submit", classNam
|
|
|
34
34
|
children
|
|
35
35
|
});
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
//#region src/SubmitButton/index.ts
|
|
37
|
+
// src/SubmitButton/index.ts
|
|
39
38
|
var SubmitButton_default = SubmitButton;
|
|
40
|
-
//#endregion
|
|
41
39
|
export { SubmitButton_default as default };
|
|
42
40
|
|
|
43
41
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/SubmitButton/SubmitButton.tsx","../../src/SubmitButton/index.ts"],"sourcesContent":["import type { ButtonProps } from '@fuf-stack/pixels';\nimport type { ReactNode } from 'react';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nexport interface SubmitButtonProps {\n /** sets HTML aria-label attribute */\n ariaLabel?: string;\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** color of the submit button */\n color?: ButtonProps['color'];\n /** icon of the submit button */\n icon?: ButtonProps['icon'];\n /** If set loading animation is shown */\n loading?: boolean;\n /** id of the form this button should submit when it is rendered OUTSIDE that\n * form (e.g. a modal footer). Associates the button with the form via the\n * native HTML `form` attribute — set the same id on `<Form remoteFormId>`. */\n remoteFormId?: string;\n /** size of the submit button */\n size?: ButtonProps['size'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Submit button for a uniform `Form`.\n *\n * It is a plain native submit button (`type=\"submit\"`) and reads no form\n * context, so it works both inside a `<Form>` and standalone. Submission is\n * handled entirely by the browser:\n * - click submits the associated form,\n * - pressing Enter in a form field triggers native implicit form submission.\n *\n * When rendered OUTSIDE the form it belongs to, pass `remoteFormId` (matching the\n * form's `remoteFormId`) to associate them via the native HTML `form` attribute.\n *\n * See SUBMITBUTTON_CONTEXT.md for the (intentionally dropped) context-based\n * features `isSubmitting` and `triggerSubmit` and how to re-add them safely.\n */\nconst SubmitButton = ({\n ariaLabel = 'Submit form',\n children = 'Submit',\n className = undefined,\n color = 'success',\n icon = undefined,\n loading = false,\n remoteFormId = undefined,\n size = 'md',\n testId = 'form_submit_button',\n}: SubmitButtonProps) => {\n const { cn } = useStyling();\n return (\n <Button\n ariaLabel={ariaLabel}\n className={cn(className)}\n color={color}\n dataComponent=\"submit-button\"\n // associate with a form rendered elsewhere via the native `form` attribute\n // (see remoteFormId prop) so the button can submit a form it is not a DOM\n // descendant of\n form={remoteFormId}\n icon={icon}\n loading={loading}\n size={size}\n testId={slugify(testId, { replaceDots: true })}\n // type=\"submit\" makes the button a submit control of its form. Required for\n // the browser's native \"implicit form submission\" (pressing Enter in a form\n // field submits the form and thereby runs its validation).\n type=\"submit\"\n >\n {children}\n </Button>\n );\n};\n\nexport default SubmitButton;\n","import SubmitButton from './SubmitButton';\n\nexport type { SubmitButtonProps } from './SubmitButton';\n\nexport default SubmitButton;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,gBAAgB,EACpB,YAAY,eACZ,WAAW,UACX,YAAY,KAAA,GACZ,QAAQ,WACR,OAAO,KAAA,GACP,UAAU,OACV,eAAe,KAAA,GACf,OAAO,MACP,SAAS,2BACc;CACvB,MAAM,EAAE,OAAO,WAAW;CAC1B,OACE,oBAAC,QAAD;EACa;EACX,WAAW,GAAG,SAAS;EAChB;EACP,eAAc;EAId,MAAM;EACA;EACG;EACH;EACN,QAAQ,QAAQ,QAAQ,EAAE,aAAa,KAAK,CAAC;EAI7C,MAAK;EAEJ;CACK,CAAA;AAEZ
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/SubmitButton/SubmitButton.tsx","../../src/SubmitButton/index.ts"],"sourcesContent":["import type { ButtonProps } from '@fuf-stack/pixels';\nimport type { ReactNode } from 'react';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nexport interface SubmitButtonProps {\n /** sets HTML aria-label attribute */\n ariaLabel?: string;\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** color of the submit button */\n color?: ButtonProps['color'];\n /** icon of the submit button */\n icon?: ButtonProps['icon'];\n /** If set loading animation is shown */\n loading?: boolean;\n /** id of the form this button should submit when it is rendered OUTSIDE that\n * form (e.g. a modal footer). Associates the button with the form via the\n * native HTML `form` attribute — set the same id on `<Form remoteFormId>`. */\n remoteFormId?: string;\n /** size of the submit button */\n size?: ButtonProps['size'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Submit button for a uniform `Form`.\n *\n * It is a plain native submit button (`type=\"submit\"`) and reads no form\n * context, so it works both inside a `<Form>` and standalone. Submission is\n * handled entirely by the browser:\n * - click submits the associated form,\n * - pressing Enter in a form field triggers native implicit form submission.\n *\n * When rendered OUTSIDE the form it belongs to, pass `remoteFormId` (matching the\n * form's `remoteFormId`) to associate them via the native HTML `form` attribute.\n *\n * See SUBMITBUTTON_CONTEXT.md for the (intentionally dropped) context-based\n * features `isSubmitting` and `triggerSubmit` and how to re-add them safely.\n */\nconst SubmitButton = ({\n ariaLabel = 'Submit form',\n children = 'Submit',\n className = undefined,\n color = 'success',\n icon = undefined,\n loading = false,\n remoteFormId = undefined,\n size = 'md',\n testId = 'form_submit_button',\n}: SubmitButtonProps) => {\n const { cn } = useStyling();\n return (\n <Button\n ariaLabel={ariaLabel}\n className={cn(className)}\n color={color}\n dataComponent=\"submit-button\"\n // associate with a form rendered elsewhere via the native `form` attribute\n // (see remoteFormId prop) so the button can submit a form it is not a DOM\n // descendant of\n form={remoteFormId}\n icon={icon}\n loading={loading}\n size={size}\n testId={slugify(testId, { replaceDots: true })}\n // type=\"submit\" makes the button a submit control of its form. Required for\n // the browser's native \"implicit form submission\" (pressing Enter in a form\n // field submits the form and thereby runs its validation).\n type=\"submit\"\n >\n {children}\n </Button>\n );\n};\n\nexport default SubmitButton;\n","import SubmitButton from './SubmitButton';\n\nexport type { SubmitButtonProps } from './SubmitButton';\n\nexport default SubmitButton;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6CA,MAAM,gBAAgB,EACpB,YAAY,eACZ,WAAW,UACX,YAAY,KAAA,GACZ,QAAQ,WACR,OAAO,KAAA,GACP,UAAU,OACV,eAAe,KAAA,GACf,OAAO,MACP,SAAS,2BACc;CACvB,MAAM,EAAE,OAAO,WAAW;CAC1B,OACE,oBAAC,QAAD;EACa;EACX,WAAW,GAAG,SAAS;EAChB;EACP,eAAc;EAId,MAAM;EACA;EACG;EACH;EACN,QAAQ,QAAQ,QAAQ,EAAE,aAAa,KAAK,CAAC;EAI7C,MAAK;EAEJ;CACK,CAAA;AAEZ;;AC3EA,IAAA,uBAAe"}
|
package/dist/Switch/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as SwitchProps, r as switchVariants, t as Switch } from "../Switch-
|
|
1
|
+
import { n as SwitchProps, r as switchVariants, t as Switch } from "../Switch-Db2dpGz7.mjs";
|
|
2
2
|
export { type SwitchProps, Switch as default, switchVariants };
|
package/dist/Switch/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as useUniformField, t as FieldLabel } from "../FieldLabel-
|
|
2
|
-
import { n as getFieldControlProps, t as FieldDescription } from "../FieldDescription-
|
|
3
|
-
import { t as switchVariants } from "../switchVariants-
|
|
1
|
+
import { n as useUniformField, t as FieldLabel } from "../FieldLabel-DrNWJIVh.mjs";
|
|
2
|
+
import { n as getFieldControlProps, t as FieldDescription } from "../FieldDescription-X_0s1Lhu.mjs";
|
|
3
|
+
import { t as switchVariants } from "../switchVariants-D16b2VaT.mjs";
|
|
4
4
|
import { cloneElement, isValidElement } from "react";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useStyling } from "@fuf-stack/pixels/StylingProvider";
|
|
@@ -11,7 +11,7 @@ import { mergeProps } from "react-aria/mergeProps";
|
|
|
11
11
|
import { useSwitch } from "react-aria/useSwitch";
|
|
12
12
|
import { VisuallyHidden } from "react-aria/VisuallyHidden";
|
|
13
13
|
import { useToggleState } from "react-stately/useToggleState";
|
|
14
|
-
|
|
14
|
+
// src/Switch/subcomponents/SwitchIcon.tsx
|
|
15
15
|
/** Applies switch icon dimensions and slot styling to an element */
|
|
16
16
|
const SwitchIcon = ({ children, className }) => {
|
|
17
17
|
return /* @__PURE__ */ jsx(Fragment, { children: isValidElement(children) ? cloneElement(children, {
|
|
@@ -20,8 +20,7 @@ const SwitchIcon = ({ children, className }) => {
|
|
|
20
20
|
className
|
|
21
21
|
}) : children });
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
//#region src/Switch/subcomponents/SwitchThumb.tsx
|
|
23
|
+
// src/Switch/subcomponents/SwitchThumb.tsx
|
|
25
24
|
/** Thumb icon content, including the consumer's selection-aware render callback */
|
|
26
25
|
const SwitchThumb = ({ className, selected, thumbIcon = void 0 }) => {
|
|
27
26
|
return /* @__PURE__ */ jsx(Fragment, { children: typeof thumbIcon === "function" ? thumbIcon({
|
|
@@ -35,8 +34,7 @@ const SwitchThumb = ({ className, selected, thumbIcon = void 0 }) => {
|
|
|
35
34
|
children: thumbIcon
|
|
36
35
|
}) });
|
|
37
36
|
};
|
|
38
|
-
|
|
39
|
-
//#region src/Switch/subcomponents/SwitchTrack.tsx
|
|
37
|
+
// src/Switch/subcomponents/SwitchTrack.tsx
|
|
40
38
|
/** Visual switch track, thumb and optional leading and trailing icons */
|
|
41
39
|
const SwitchTrack = ({ className: classNames, endContent, selected, startContent, thumbIcon }) => {
|
|
42
40
|
return /* @__PURE__ */ jsxs("span", {
|
|
@@ -64,19 +62,19 @@ const SwitchTrack = ({ className: classNames, endContent, selected, startContent
|
|
|
64
62
|
]
|
|
65
63
|
});
|
|
66
64
|
};
|
|
67
|
-
|
|
68
|
-
//#region src/Switch/subcomponents/SwitchControl.tsx
|
|
65
|
+
// src/Switch/subcomponents/SwitchControl.tsx
|
|
69
66
|
/**
|
|
70
67
|
* Switch presentation with native input, focus and thumb content
|
|
71
68
|
*
|
|
72
69
|
* @see https://react-aria.adobe.com/useSwitch
|
|
73
70
|
*/
|
|
74
71
|
const SwitchControl = ({ field, className, size, thumbIcon, endContent, startContent }) => {
|
|
75
|
-
const { description, disabled, errorMessage, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, required, testId, value } = field;
|
|
72
|
+
const { description, disabled, errorMessage, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, readOnly, required, testId, value } = field;
|
|
76
73
|
const controlProps = getFieldControlProps(field);
|
|
77
74
|
const styling = useStyling();
|
|
78
75
|
const controlRef = useObjectRef(inputRef);
|
|
79
76
|
const state = useToggleState({
|
|
77
|
+
isReadOnly: readOnly,
|
|
80
78
|
isSelected: !!value,
|
|
81
79
|
onChange: onValueChange
|
|
82
80
|
});
|
|
@@ -85,6 +83,7 @@ const SwitchControl = ({ field, className, size, thumbIcon, endContent, startCon
|
|
|
85
83
|
children: label,
|
|
86
84
|
isDisabled: disabled,
|
|
87
85
|
isInvalid: invalid,
|
|
86
|
+
isReadOnly: readOnly,
|
|
88
87
|
isRequired: required,
|
|
89
88
|
name,
|
|
90
89
|
onBlur,
|
|
@@ -93,8 +92,9 @@ const SwitchControl = ({ field, className, size, thumbIcon, endContent, startCon
|
|
|
93
92
|
const { focusProps, isFocused, isFocusVisible } = useFocusRing();
|
|
94
93
|
const { hoverProps, isHovered } = useHover({ isDisabled: disabled });
|
|
95
94
|
const variants = styling.resolve(switchVariants, {
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
disabled,
|
|
96
|
+
readOnly,
|
|
97
|
+
size
|
|
98
98
|
});
|
|
99
99
|
const classNames = styling.variantsToClassNames(variants, className, "outerWrapper");
|
|
100
100
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -110,6 +110,7 @@ const SwitchControl = ({ field, className, size, thumbIcon, endContent, startCon
|
|
|
110
110
|
"data-hover": isHovered || void 0,
|
|
111
111
|
"data-invalid": invalid,
|
|
112
112
|
"data-pressed": isPressed || void 0,
|
|
113
|
+
"data-readonly": readOnly || void 0,
|
|
113
114
|
"data-required": required,
|
|
114
115
|
"data-selected": state.isSelected || void 0,
|
|
115
116
|
"data-slot": "base",
|
|
@@ -155,8 +156,7 @@ const SwitchControl = ({ field, className, size, thumbIcon, endContent, startCon
|
|
|
155
156
|
}) : null]
|
|
156
157
|
});
|
|
157
158
|
};
|
|
158
|
-
|
|
159
|
-
//#region src/Switch/Switch.tsx
|
|
159
|
+
// src/Switch/Switch.tsx
|
|
160
160
|
/** Form toggle field for a boolean value */
|
|
161
161
|
const Switch = ({ className = void 0, endContent = void 0, name, size = "md", startContent = void 0, thumbIcon = void 0, ...uniformProps }) => {
|
|
162
162
|
const { field } = useUniformField({
|
|
@@ -172,10 +172,8 @@ const Switch = ({ className = void 0, endContent = void 0, name, size = "md", st
|
|
|
172
172
|
thumbIcon
|
|
173
173
|
});
|
|
174
174
|
};
|
|
175
|
-
|
|
176
|
-
//#region src/Switch/index.ts
|
|
175
|
+
// src/Switch/index.ts
|
|
177
176
|
var Switch_default = Switch;
|
|
178
|
-
//#endregion
|
|
179
177
|
export { Switch_default as default, switchVariants };
|
|
180
178
|
|
|
181
179
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/Switch/subcomponents/SwitchIcon.tsx","../../src/Switch/subcomponents/SwitchThumb.tsx","../../src/Switch/subcomponents/SwitchTrack.tsx","../../src/Switch/subcomponents/SwitchControl.tsx","../../src/Switch/Switch.tsx","../../src/Switch/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cloneElement, isValidElement } from 'react';\n\ninterface SwitchIconProps {\n /** Icon content */\n children: ReactNode;\n /** CSS class name */\n className: string;\n}\n\n/** Applies switch icon dimensions and slot styling to an element */\nconst SwitchIcon = ({ children, className }: SwitchIconProps) => {\n return (\n <>\n {isValidElement<{ className?: string; width?: string; height?: string }>(\n children,\n )\n ? cloneElement(children, { width: '1em', height: '1em', className })\n : children}\n </>\n );\n};\n\nexport default SwitchIcon;\n","import type { ReactNode } from 'react';\n\nimport SwitchIcon from './SwitchIcon';\n\nexport interface SwitchThumbIconProps {\n /** CSS class name */\n className: string;\n /** Selected state as a string */\n 'data-checked': string;\n /** Icon height */\n height: string;\n /** Current toggle state */\n isSelected: boolean;\n /** Icon width */\n width: string;\n}\n\ninterface SwitchThumbProps {\n /** CSS class name */\n className: string;\n /** Current toggle state supplied to the icon callback */\n selected: boolean;\n /** Content or render callback inside the toggle thumb */\n thumbIcon?: ReactNode | ((props: SwitchThumbIconProps) => ReactNode);\n}\n\n/** Thumb icon content, including the consumer's selection-aware render callback */\nconst SwitchThumb = ({\n className,\n selected,\n thumbIcon = undefined,\n}: SwitchThumbProps) => {\n return (\n <>\n {typeof thumbIcon === 'function' ? (\n thumbIcon({\n width: '1em',\n height: '1em',\n className,\n 'data-checked': String(selected),\n isSelected: selected,\n })\n ) : (\n <SwitchIcon className={className}>{thumbIcon}</SwitchIcon>\n )}\n </>\n );\n};\n\nexport default SwitchThumb;\n","import type { SwitchProps } from '../Switch';\n\nimport SwitchIcon from './SwitchIcon';\nimport SwitchThumb from './SwitchThumb';\n\ninterface SwitchTrackProps extends Pick<\n SwitchProps,\n 'endContent' | 'startContent' | 'thumbIcon'\n> {\n /** CSS class name */\n className: Record<\n 'endContent' | 'startContent' | 'thumb' | 'thumbIcon' | 'wrapper',\n string\n >;\n /** Current toggle state supplied to the thumb */\n selected: boolean;\n}\n\n/** Visual switch track, thumb and optional leading and trailing icons */\nconst SwitchTrack = ({\n className: classNames,\n endContent,\n selected,\n startContent,\n thumbIcon,\n}: SwitchTrackProps) => {\n return (\n <span aria-hidden className={classNames.wrapper} data-slot=\"wrapper\">\n {startContent ? (\n <SwitchIcon className={classNames.startContent}>\n {startContent}\n </SwitchIcon>\n ) : null}\n <span className={classNames.thumb} data-slot=\"thumb\">\n <SwitchThumb\n className={classNames.thumbIcon}\n selected={selected}\n thumbIcon={thumbIcon}\n />\n </span>\n {endContent ? (\n <SwitchIcon className={classNames.endContent}>{endContent}</SwitchIcon>\n ) : null}\n </span>\n );\n};\n\nexport default SwitchTrack;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SwitchProps } from '../Switch';\n\nimport { mergeProps } from 'react-aria/mergeProps';\nimport { useFocusRing } from 'react-aria/useFocusRing';\nimport { useHover } from 'react-aria/useHover';\nimport { useObjectRef } from 'react-aria/useObjectRef';\nimport { useSwitch } from 'react-aria/useSwitch';\nimport { VisuallyHidden } from 'react-aria/VisuallyHidden';\nimport { useToggleState } from 'react-stately/useToggleState';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldDescription from '../../partials/FieldDescription/FieldDescription';\nimport FieldLabel from '../../partials/FieldLabel/FieldLabel';\nimport { switchVariants } from '../switchVariants';\nimport SwitchTrack from './SwitchTrack';\n\ninterface SwitchControlProps extends Pick<\n SwitchProps,\n 'className' | 'endContent' | 'size' | 'startContent' | 'thumbIcon'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, boolean>;\n}\n\n/**\n * Switch presentation with native input, focus and thumb content\n *\n * @see https://react-aria.adobe.com/useSwitch\n */\nconst SwitchControl = ({\n field,\n className,\n size,\n thumbIcon,\n endContent,\n startContent,\n}: SwitchControlProps) => {\n const {\n description,\n disabled,\n errorMessage,\n ids,\n ref: inputRef,\n invalid,\n label,\n name,\n onBlur,\n onChange: onValueChange,\n required,\n testId,\n value,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const styling = useStyling();\n const controlRef = useObjectRef<HTMLInputElement>(inputRef);\n const state = useToggleState({\n isSelected: !!value,\n onChange: onValueChange,\n });\n const { inputProps, labelProps, isPressed } = useSwitch(\n {\n ...controlProps,\n children: label,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n name,\n onBlur,\n validationBehavior: 'aria',\n },\n state,\n controlRef,\n );\n const { focusProps, isFocused, isFocusVisible } = useFocusRing();\n const { hoverProps, isHovered } = useHover({ isDisabled: disabled });\n\n // classNames from slots\n const variants = styling.resolve(switchVariants, { size, disabled });\n const classNames = styling.variantsToClassNames(\n variants,\n className,\n 'outerWrapper',\n );\n\n return (\n <div\n className={classNames.outerWrapper}\n data-component=\"switch\"\n data-slot=\"outer-wrapper\"\n >\n <label\n {...mergeProps(labelProps, hoverProps)}\n className={classNames.base}\n data-disabled={disabled ? true : undefined}\n data-focus={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-hover={isHovered || undefined}\n data-invalid={invalid}\n data-pressed={isPressed || undefined}\n data-required={required}\n data-selected={state.isSelected || undefined}\n data-slot=\"base\"\n data-testid={testId}\n htmlFor={ids.control}\n >\n {/* native toggle for keyboard and assistive technology */}\n <VisuallyHidden elementType=\"span\">\n <input\n {...mergeProps(inputProps, focusProps, controlProps)}\n ref={controlRef}\n data-slot=\"input\"\n />\n </VisuallyHidden>\n\n {/* toggle track and thumb */}\n <SwitchTrack\n className={classNames}\n endContent={endContent}\n selected={state.isSelected}\n startContent={startContent}\n thumbIcon={thumbIcon}\n />\n {label ? (\n <FieldLabel\n as=\"span\"\n className={classNames.label}\n id={ids.label}\n required={required}\n >\n {label}\n </FieldLabel>\n ) : null}\n </label>\n\n {/* help text and validation messages */}\n {description || invalid ? (\n <div className={classNames.helperWrapper} data-slot=\"helper-wrapper\">\n <FieldDescription\n className={classNames.description}\n id={ids.description}\n >\n {description}\n </FieldDescription>\n {invalid ? (\n <div\n className={classNames.errorMessage}\n data-slot=\"error-message\"\n id={ids.error}\n >\n {errorMessage}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default SwitchControl;\n","import type { ReactNode } from 'react';\nimport type { SwitchThumbIconProps } from './subcomponents/SwitchThumb';\nimport type { ClassName } from './switchVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SwitchControl from './subcomponents/SwitchControl';\n\nexport type { SwitchThumbIconProps } from './subcomponents/SwitchThumb';\n\nexport { switchVariants } from './switchVariants';\n\nexport interface SwitchProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Icon to be displayed at the end of the switch (when enabled) */\n endContent?: ReactNode;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** Control size */\n size?: 'sm' | 'md' | 'lg';\n /** Icon to be displayed at the start of the switch (when disabled) */\n startContent?: ReactNode;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Content or render callback inside the toggle thumb */\n thumbIcon?: ReactNode | ((props: SwitchThumbIconProps) => ReactNode);\n}\n\n/** Form toggle field for a boolean value */\nconst Switch = ({\n className = undefined,\n endContent = undefined,\n name,\n size = 'md',\n startContent = undefined,\n thumbIcon = undefined,\n ...uniformProps\n}: SwitchProps) => {\n const { field } = useUniformField({\n ...uniformProps,\n name,\n });\n\n return (\n <SwitchControl\n className={className}\n endContent={endContent}\n field={field}\n size={size}\n startContent={startContent}\n thumbIcon={thumbIcon}\n />\n );\n};\n\nexport default Switch;\n","import Switch from './Switch';\n\nexport type { SwitchProps } from './Switch';\n\nexport { switchVariants } from './Switch';\n\nexport default Switch;\n"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,cAAc,EAAE,UAAU,gBAAiC;CAC/D,OACE,oBAAA,UAAA,EAAA,UACG,eACC,QACF,IACI,aAAa,UAAU;EAAE,OAAO;EAAO,QAAQ;EAAO;CAAU,CAAC,IACjE,SACJ,CAAA;AAEN;;;;ACKA,MAAM,eAAe,EACnB,WACA,UACA,YAAY,KAAA,QACU;CACtB,OACE,oBAAA,UAAA,EAAA,UACG,OAAO,cAAc,aACpB,UAAU;EACR,OAAO;EACP,QAAQ;EACR;EACA,gBAAgB,OAAO,QAAQ;EAC/B,YAAY;CACd,CAAC,IAED,oBAAC,YAAD;EAAuB;EAAY,UAAA;CAAsB,CAAA,EAE3D,CAAA;AAEN;;;;AC5BA,MAAM,eAAe,EACnB,WAAW,YACX,YACA,UACA,cACA,gBACsB;CACtB,OACE,qBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,WAAW;EAAS,aAAU;EAA3D,UAAA;GACG,eACC,oBAAC,YAAD;IAAY,WAAW,WAAW;IAC/B,UAAA;GACS,CA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,KAAA;GACnC,aAAU;GACV,eAAa;GACb,SAAS,IAAI;GAbf,UAAA;IAgBE,oBAAC,gBAAD;KAAgB,aAAY;KAC1B,UAAA,oBAAC,SAAD;MACE,GAAI,WAAW,YAAY,YAAY,YAAY;MACnD,KAAK;MACL,aAAU;KACX,CAAA;IACa,CAAA;IAGhB,oBAAC,aAAD;KACE,WAAW;KACC;KACZ,UAAU,MAAM;KACF;KACH;IACZ,CAAA;IACA,QACC,oBAAC,YAAD;KACE,IAAG;KACH,WAAW,WAAW;KACtB,IAAI,IAAI;KACE;KAET,UAAA;IACS,CAAA,IACV;GACC;EAGN,CAAA,GAAA,eAAe,UACd,qBAAC,OAAD;GAAK,WAAW,WAAW;GAAe,aAAU;GAApD,UAAA,CACE,oBAAC,kBAAD;IACE,WAAW,WAAW;IACtB,IAAI,IAAI;IAEP,UAAA;GACe,CAAA,GACjB,UACC,oBAAC,OAAD;IACE,WAAW,WAAW;IACtB,aAAU;IACV,IAAI,IAAI;IAEP,UAAA;GACE,CAAA,IACH,IACD;EACH,CAAA,IAAA,IACD;;AAET;;;;AC7HA,MAAM,UAAU,EACd,YAAY,KAAA,GACZ,aAAa,KAAA,GACb,MACA,OAAO,MACP,eAAe,KAAA,GACf,YAAY,KAAA,GACZ,GAAG,mBACc;CACjB,MAAM,EAAE,UAAU,gBAAgB;EAChC,GAAG;EACH;CACF,CAAC;CAED,OACE,oBAAC,eAAD;EACa;EACC;EACL;EACD;EACQ;EACH;CACZ,CAAA;AAEL;;;ACvDA,IAAA,iBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/Switch/subcomponents/SwitchIcon.tsx","../../src/Switch/subcomponents/SwitchThumb.tsx","../../src/Switch/subcomponents/SwitchTrack.tsx","../../src/Switch/subcomponents/SwitchControl.tsx","../../src/Switch/Switch.tsx","../../src/Switch/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cloneElement, isValidElement } from 'react';\n\ninterface SwitchIconProps {\n /** Icon content */\n children: ReactNode;\n /** CSS class name */\n className: string;\n}\n\n/** Applies switch icon dimensions and slot styling to an element */\nconst SwitchIcon = ({ children, className }: SwitchIconProps) => {\n return (\n <>\n {isValidElement<{ className?: string; width?: string; height?: string }>(\n children,\n )\n ? cloneElement(children, { width: '1em', height: '1em', className })\n : children}\n </>\n );\n};\n\nexport default SwitchIcon;\n","import type { ReactNode } from 'react';\n\nimport SwitchIcon from './SwitchIcon';\n\nexport interface SwitchThumbIconProps {\n /** CSS class name */\n className: string;\n /** Selected state as a string */\n 'data-checked': string;\n /** Icon height */\n height: string;\n /** Current toggle state */\n isSelected: boolean;\n /** Icon width */\n width: string;\n}\n\ninterface SwitchThumbProps {\n /** CSS class name */\n className: string;\n /** Current toggle state supplied to the icon callback */\n selected: boolean;\n /** Content or render callback inside the toggle thumb */\n thumbIcon?: ReactNode | ((props: SwitchThumbIconProps) => ReactNode);\n}\n\n/** Thumb icon content, including the consumer's selection-aware render callback */\nconst SwitchThumb = ({\n className,\n selected,\n thumbIcon = undefined,\n}: SwitchThumbProps) => {\n return (\n <>\n {typeof thumbIcon === 'function' ? (\n thumbIcon({\n width: '1em',\n height: '1em',\n className,\n 'data-checked': String(selected),\n isSelected: selected,\n })\n ) : (\n <SwitchIcon className={className}>{thumbIcon}</SwitchIcon>\n )}\n </>\n );\n};\n\nexport default SwitchThumb;\n","import type { SwitchProps } from '../Switch';\n\nimport SwitchIcon from './SwitchIcon';\nimport SwitchThumb from './SwitchThumb';\n\ninterface SwitchTrackProps extends Pick<\n SwitchProps,\n 'endContent' | 'startContent' | 'thumbIcon'\n> {\n /** CSS class name */\n className: Record<\n 'endContent' | 'startContent' | 'thumb' | 'thumbIcon' | 'wrapper',\n string\n >;\n /** Current toggle state supplied to the thumb */\n selected: boolean;\n}\n\n/** Visual switch track, thumb and optional leading and trailing icons */\nconst SwitchTrack = ({\n className: classNames,\n endContent,\n selected,\n startContent,\n thumbIcon,\n}: SwitchTrackProps) => {\n return (\n <span aria-hidden className={classNames.wrapper} data-slot=\"wrapper\">\n {startContent ? (\n <SwitchIcon className={classNames.startContent}>\n {startContent}\n </SwitchIcon>\n ) : null}\n <span className={classNames.thumb} data-slot=\"thumb\">\n <SwitchThumb\n className={classNames.thumbIcon}\n selected={selected}\n thumbIcon={thumbIcon}\n />\n </span>\n {endContent ? (\n <SwitchIcon className={classNames.endContent}>{endContent}</SwitchIcon>\n ) : null}\n </span>\n );\n};\n\nexport default SwitchTrack;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SwitchProps } from '../Switch';\n\nimport { mergeProps } from 'react-aria/mergeProps';\nimport { useFocusRing } from 'react-aria/useFocusRing';\nimport { useHover } from 'react-aria/useHover';\nimport { useObjectRef } from 'react-aria/useObjectRef';\nimport { useSwitch } from 'react-aria/useSwitch';\nimport { VisuallyHidden } from 'react-aria/VisuallyHidden';\nimport { useToggleState } from 'react-stately/useToggleState';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldDescription from '../../partials/FieldDescription/FieldDescription';\nimport FieldLabel from '../../partials/FieldLabel/FieldLabel';\nimport { switchVariants } from '../switchVariants';\nimport SwitchTrack from './SwitchTrack';\n\ninterface SwitchControlProps extends Pick<\n SwitchProps,\n 'className' | 'endContent' | 'size' | 'startContent' | 'thumbIcon'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, boolean>;\n}\n\n/**\n * Switch presentation with native input, focus and thumb content\n *\n * @see https://react-aria.adobe.com/useSwitch\n */\nconst SwitchControl = ({\n field,\n className,\n size,\n thumbIcon,\n endContent,\n startContent,\n}: SwitchControlProps) => {\n const {\n description,\n disabled,\n errorMessage,\n ids,\n ref: inputRef,\n invalid,\n label,\n name,\n onBlur,\n onChange: onValueChange,\n readOnly,\n required,\n testId,\n value,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const styling = useStyling();\n const controlRef = useObjectRef<HTMLInputElement>(inputRef);\n const state = useToggleState({\n isReadOnly: readOnly,\n isSelected: !!value,\n onChange: onValueChange,\n });\n const { inputProps, labelProps, isPressed } = useSwitch(\n {\n ...controlProps,\n children: label,\n isDisabled: disabled,\n isInvalid: invalid,\n isReadOnly: readOnly,\n isRequired: required,\n name,\n onBlur,\n validationBehavior: 'aria',\n },\n state,\n controlRef,\n );\n const { focusProps, isFocused, isFocusVisible } = useFocusRing();\n const { hoverProps, isHovered } = useHover({ isDisabled: disabled });\n\n // classNames from slots\n const variants = styling.resolve(switchVariants, {\n disabled,\n readOnly,\n size,\n });\n const classNames = styling.variantsToClassNames(\n variants,\n className,\n 'outerWrapper',\n );\n\n return (\n <div\n className={classNames.outerWrapper}\n data-component=\"switch\"\n data-slot=\"outer-wrapper\"\n >\n <label\n {...mergeProps(labelProps, hoverProps)}\n className={classNames.base}\n data-disabled={disabled ? true : undefined}\n data-focus={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-hover={isHovered || undefined}\n data-invalid={invalid}\n data-pressed={isPressed || undefined}\n data-readonly={readOnly || undefined}\n data-required={required}\n data-selected={state.isSelected || undefined}\n data-slot=\"base\"\n data-testid={testId}\n htmlFor={ids.control}\n >\n {/* native toggle for keyboard and assistive technology */}\n <VisuallyHidden elementType=\"span\">\n <input\n {...mergeProps(inputProps, focusProps, controlProps)}\n ref={controlRef}\n data-slot=\"input\"\n />\n </VisuallyHidden>\n\n {/* toggle track and thumb */}\n <SwitchTrack\n className={classNames}\n endContent={endContent}\n selected={state.isSelected}\n startContent={startContent}\n thumbIcon={thumbIcon}\n />\n {label ? (\n <FieldLabel\n as=\"span\"\n className={classNames.label}\n id={ids.label}\n required={required}\n >\n {label}\n </FieldLabel>\n ) : null}\n </label>\n\n {/* help text and validation messages */}\n {description || invalid ? (\n <div className={classNames.helperWrapper} data-slot=\"helper-wrapper\">\n <FieldDescription\n className={classNames.description}\n id={ids.description}\n >\n {description}\n </FieldDescription>\n {invalid ? (\n <div\n className={classNames.errorMessage}\n data-slot=\"error-message\"\n id={ids.error}\n >\n {errorMessage}\n </div>\n ) : null}\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default SwitchControl;\n","import type { ReactNode } from 'react';\nimport type { SwitchThumbIconProps } from './subcomponents/SwitchThumb';\nimport type { ClassName } from './switchVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SwitchControl from './subcomponents/SwitchControl';\n\nexport type { SwitchThumbIconProps } from './subcomponents/SwitchThumb';\n\nexport { switchVariants } from './switchVariants';\n\nexport interface SwitchProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Icon to be displayed at the end of the switch (when enabled) */\n endContent?: ReactNode;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** Prevents toggling while keeping the value in validation and submission */\n readOnly?: boolean;\n /** Control size */\n size?: 'sm' | 'md' | 'lg';\n /** Icon to be displayed at the start of the switch (when disabled) */\n startContent?: ReactNode;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Content or render callback inside the toggle thumb */\n thumbIcon?: ReactNode | ((props: SwitchThumbIconProps) => ReactNode);\n}\n\n/** Form toggle field for a boolean value */\nconst Switch = ({\n className = undefined,\n endContent = undefined,\n name,\n size = 'md',\n startContent = undefined,\n thumbIcon = undefined,\n ...uniformProps\n}: SwitchProps) => {\n const { field } = useUniformField({\n ...uniformProps,\n name,\n });\n\n return (\n <SwitchControl\n className={className}\n endContent={endContent}\n field={field}\n size={size}\n startContent={startContent}\n thumbIcon={thumbIcon}\n />\n );\n};\n\nexport default Switch;\n","import Switch from './Switch';\n\nexport type { SwitchProps } from './Switch';\n\nexport { switchVariants } from './Switch';\n\nexport default Switch;\n"],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,cAAc,EAAE,UAAU,gBAAiC;CAC/D,OACE,oBAAA,UAAA,EAA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