@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/Input/inputVariants.ts","../../src/Input/Input.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Input/inputVariants.ts","../../src/Input/Input.tsx"],"mappings":";;;;qBAKa,iBAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4Gd,YAAY,mBAAmB;UCvG1B;;EAEf;;EAEA,YAAY;;EAEZ;;EAEA;;EAEA,cAAc;;EAEd;;EAEA,aAAa;;EAEb;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,eAAe;;EAEf;;EAEA,YAAY;;EAEZ;;;cAII,UAAS,WAAA,WAAA,eAAA,YAAA,cAAA,MAAA,MAAA,oBAAA,MAAA,SAAA,gBAAA,gBAaZ,+BAAU,IAAA"}
|
package/dist/Input/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { n as useUniformField } from "../FieldLabel-DKzqkuY1.mjs";
|
|
2
|
-
import { n as getFieldControlProps, r as getFieldDataAttributes } from "../FieldDescription-C4l0HKGL.mjs";
|
|
3
|
-
import { t as FieldLayout } from "../FieldLayout-BLW5S-Jm.mjs";
|
|
4
1
|
import { useInputValueDebounce } from "../hooks/useInputValueDebounce/index.mjs";
|
|
2
|
+
import { n as useUniformField } from "../FieldLabel-DrNWJIVh.mjs";
|
|
3
|
+
import { t as FieldLayout } from "../FieldLayout-DcvQU0zN.mjs";
|
|
4
|
+
import { n as getFieldControlProps, r as getFieldDataAttributes } from "../FieldDescription-X_0s1Lhu.mjs";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { tv } from "@fuf-stack/pixel-utils";
|
|
@@ -10,7 +10,7 @@ import { useStyling } from "@fuf-stack/pixels/StylingProvider";
|
|
|
10
10
|
import { Button, Group, Input, NumberField, TextField } from "react-aria-components";
|
|
11
11
|
import { useFocusRing } from "react-aria/useFocusRing";
|
|
12
12
|
import { useObjectRef } from "react-aria/useObjectRef";
|
|
13
|
-
|
|
13
|
+
// src/Input/inputVariants.ts
|
|
14
14
|
/** Default styles for all public Input slots */
|
|
15
15
|
const inputVariants = tv({
|
|
16
16
|
slots: {
|
|
@@ -77,6 +77,7 @@ const inputVariants = tv({
|
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
disabled: { true: { base: "pointer-events-none opacity-disabled" } },
|
|
80
|
+
readOnly: { true: { base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed" } },
|
|
80
81
|
invalid: { true: {
|
|
81
82
|
input: "text-danger",
|
|
82
83
|
inputWrapper: "border-danger group-data-[focus=true]:border-danger data-[hovered=true]:border-danger group-data-[focus=true]:data-[hovered=true]:border-danger",
|
|
@@ -84,8 +85,7 @@ const inputVariants = tv({
|
|
|
84
85
|
} }
|
|
85
86
|
}
|
|
86
87
|
});
|
|
87
|
-
|
|
88
|
-
//#region src/Input/subcomponents/InputField.tsx
|
|
88
|
+
// src/Input/subcomponents/InputField.tsx
|
|
89
89
|
/**
|
|
90
90
|
* React Aria field root for text, password and number inputs.
|
|
91
91
|
*
|
|
@@ -97,7 +97,7 @@ const inputVariants = tv({
|
|
|
97
97
|
* @see https://react-aria.adobe.com/NumberField
|
|
98
98
|
*/
|
|
99
99
|
const InputField = ({ field, type, children, className = void 0, focused, hasValue, isFocusVisible }) => {
|
|
100
|
-
const { disabled, invalid, name, onBlur, onChange: onValueChange, required, value } = field;
|
|
100
|
+
const { disabled, invalid, name, onBlur, onChange: onValueChange, readOnly, required, value } = field;
|
|
101
101
|
const controlProps = getFieldControlProps(field);
|
|
102
102
|
const dataAttributes = getFieldDataAttributes(field);
|
|
103
103
|
const rootProps = {
|
|
@@ -111,6 +111,7 @@ const InputField = ({ field, type, children, className = void 0, focused, hasVal
|
|
|
111
111
|
"data-slot": "base",
|
|
112
112
|
isDisabled: disabled,
|
|
113
113
|
isInvalid: invalid,
|
|
114
|
+
isReadOnly: readOnly,
|
|
114
115
|
isRequired: required,
|
|
115
116
|
name,
|
|
116
117
|
onBlur,
|
|
@@ -137,8 +138,7 @@ const InputField = ({ field, type, children, className = void 0, focused, hasVal
|
|
|
137
138
|
children
|
|
138
139
|
});
|
|
139
140
|
};
|
|
140
|
-
|
|
141
|
-
//#region src/Input/subcomponents/InputClearButton.tsx
|
|
141
|
+
// src/Input/subcomponents/InputClearButton.tsx
|
|
142
142
|
/**
|
|
143
143
|
* React Aria Button that invokes the supplied clear action without taking focus.
|
|
144
144
|
*
|
|
@@ -169,8 +169,7 @@ const InputClearButton = ({ children = void 0, className, disabled = void 0, onC
|
|
|
169
169
|
})
|
|
170
170
|
});
|
|
171
171
|
};
|
|
172
|
-
|
|
173
|
-
//#region src/Input/subcomponents/InputPasswordToggle.tsx
|
|
172
|
+
// src/Input/subcomponents/InputPasswordToggle.tsx
|
|
174
173
|
/**
|
|
175
174
|
* Password visibility action preserving input focus on pointer activation
|
|
176
175
|
*
|
|
@@ -191,8 +190,7 @@ const InputPasswordToggle = ({ className, controlId, disabled = false, onToggle,
|
|
|
191
190
|
children: visible ? /* @__PURE__ */ jsx(FaEyeSlash, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(FaEye, { "aria-hidden": "true" })
|
|
192
191
|
});
|
|
193
192
|
};
|
|
194
|
-
|
|
195
|
-
//#region src/Input/subcomponents/InputStepper.tsx
|
|
193
|
+
// src/Input/subcomponents/InputStepper.tsx
|
|
196
194
|
/** Decorative direction indicator for the number stepper buttons. */
|
|
197
195
|
const Chevron = ({ up = false }) => {
|
|
198
196
|
return /* @__PURE__ */ jsx("svg", {
|
|
@@ -234,8 +232,7 @@ const InputStepper = ({ className }) => {
|
|
|
234
232
|
})]
|
|
235
233
|
});
|
|
236
234
|
};
|
|
237
|
-
|
|
238
|
-
//#region src/Input/subcomponents/InputWrapper.tsx
|
|
235
|
+
// src/Input/subcomponents/InputWrapper.tsx
|
|
239
236
|
/**
|
|
240
237
|
* Bordered input surface built from React Aria Group and Input
|
|
241
238
|
*
|
|
@@ -309,8 +306,7 @@ const InputWrapper = ({ field, clearable = false, endContent, hidePasswordToggle
|
|
|
309
306
|
})
|
|
310
307
|
});
|
|
311
308
|
};
|
|
312
|
-
|
|
313
|
-
//#region src/Input/subcomponents/InputControl.tsx
|
|
309
|
+
// src/Input/subcomponents/InputControl.tsx
|
|
314
310
|
/**
|
|
315
311
|
* Composes the Input presentation without registering a form field.
|
|
316
312
|
*
|
|
@@ -339,15 +335,17 @@ const InputControl = (props) => {
|
|
|
339
335
|
});
|
|
340
336
|
const { size, type, clearable, className, hidePasswordToggle, onClear, onReset } = props;
|
|
341
337
|
const displayType = type === "password" && !hidePasswordToggle && passwordVisible ? "text" : type;
|
|
342
|
-
const { value, disabled, invalid, label, required, ids, description, errorMessage } = field;
|
|
338
|
+
const { value, disabled, invalid, label, readOnly, required, ids, description, errorMessage } = field;
|
|
343
339
|
const hasValue = value !== "" && value != null;
|
|
340
|
+
const isClearable = clearable && !readOnly;
|
|
344
341
|
const variants = styling.resolve(inputVariants, {
|
|
345
|
-
clearable,
|
|
342
|
+
clearable: isClearable,
|
|
346
343
|
disabled,
|
|
347
344
|
filled: hasValue,
|
|
348
345
|
invalid,
|
|
349
346
|
number: type === "number",
|
|
350
347
|
password: type === "password",
|
|
348
|
+
readOnly,
|
|
351
349
|
size
|
|
352
350
|
});
|
|
353
351
|
const classNames = styling.variantsToClassNames(variants, className, "base");
|
|
@@ -384,6 +382,7 @@ const InputControl = (props) => {
|
|
|
384
382
|
children: /* @__PURE__ */ jsx(InputWrapper, {
|
|
385
383
|
...props,
|
|
386
384
|
className: classNames,
|
|
385
|
+
clearable: isClearable,
|
|
387
386
|
focusProps,
|
|
388
387
|
focused,
|
|
389
388
|
hasValue,
|
|
@@ -395,8 +394,7 @@ const InputControl = (props) => {
|
|
|
395
394
|
})
|
|
396
395
|
});
|
|
397
396
|
};
|
|
398
|
-
|
|
399
|
-
//#region src/Input/Input.tsx
|
|
397
|
+
// src/Input/Input.tsx
|
|
400
398
|
/** Form input field for text, passwords or numbers */
|
|
401
399
|
const Input$1 = ({ className = void 0, clearable = false, debounceDelay = 300, endContent = void 0, startContent = void 0, size = "md", type = void 0, hidePasswordToggle = false, name, onClear = void 0, placeholder = " ", ...uniformProps }) => {
|
|
402
400
|
const { field, formReset } = useUniformField({
|
|
@@ -433,10 +431,8 @@ const Input$1 = ({ className = void 0, clearable = false, debounceDelay = 300, e
|
|
|
433
431
|
type
|
|
434
432
|
}, `${name}-${type}-${hidePasswordToggle}`);
|
|
435
433
|
};
|
|
436
|
-
|
|
437
|
-
//#region src/Input/index.ts
|
|
434
|
+
// src/Input/index.ts
|
|
438
435
|
var Input_default = Input$1;
|
|
439
|
-
//#endregion
|
|
440
436
|
export { Input_default as default, inputVariants };
|
|
441
437
|
|
|
442
438
|
//# sourceMappingURL=index.mjs.map
|
package/dist/Input/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["AriaInput","Input","Input"],"sources":["../../src/Input/inputVariants.ts","../../src/Input/subcomponents/InputField.tsx","../../src/Input/subcomponents/InputClearButton.tsx","../../src/Input/subcomponents/InputPasswordToggle.tsx","../../src/Input/subcomponents/InputStepper.tsx","../../src/Input/subcomponents/InputWrapper.tsx","../../src/Input/subcomponents/InputControl.tsx","../../src/Input/Input.tsx","../../src/Input/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\n/** Default styles for all public Input slots */\nexport const inputVariants = tv({\n slots: {\n /** Container grouping the label, control and hints */\n base: 'group relative flex w-full flex-col',\n /** Button for clearing the current value */\n clearButton: [\n // clear button placement and appearance\n 'absolute end-3 z-10 -m-2 cursor-pointer rounded-full p-2 text-large opacity-70 outline-none',\n // hover and keyboard focus\n 'hover:opacity-100 focus-visible:outline-2 focus-visible:outline-focus',\n ],\n /** Supporting text below the input */\n description: 'text-tiny text-foreground-500',\n /** Container for validation messages */\n errorMessage: 'text-tiny text-danger',\n /** Container for help text and validation messages */\n helperWrapper: 'relative flex flex-col p-0',\n /** Row containing the input, addons and actions */\n innerWrapper: 'inline-flex h-full w-full items-center gap-0',\n /** Native input for text or numeric entry */\n input: [\n // editable text and transparent surface\n 'w-full min-w-0 bg-transparent bg-clip-text text-small font-normal text-inherit outline-none',\n // placeholder and autofill\n 'placeholder:text-foreground-500 autofill:bg-transparent',\n // spacing around surrounding content\n 'data-[has-end-content=true]:pe-1.5 data-[has-start-content=true]:ps-1.5',\n // browser-specific input appearance\n 'dark:autofill:[-webkit-text-fill-color:var(--pixel-color-foreground)] [&::-ms-reveal]:hidden',\n ],\n /** Bordered container around the editable area */\n inputWrapper: [\n // input frame and layout\n 'relative inline-flex h-10 min-h-10 w-full cursor-text items-center shadow-xs',\n // bordered surface and text\n 'rounded-small border-medium border-default-200 bg-content1 px-3 text-foreground',\n // interaction transitions\n 'transition-colors',\n // hover, disabled and validation states\n 'group-data-[disabled=true]:pointer-events-none group-data-[focus=true]:border-focus group-data-[invalid=true]:border-danger data-[hovered=true]:border-default-400 group-data-[focus=true]:data-[hovered=true]:border-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Label above the input */\n label:\n 'block cursor-default pb-1 text-small text-foreground group-data-[invalid=true]:text-danger',\n /** Button for revealing or masking a password */\n passwordToggle:\n 'shrink-0 rounded-sm p-1 text-default-400 outline-none focus-visible:ring-2 focus-visible:ring-focus',\n /** Container grouping increment and decrement buttons */\n stepper: 'flex h-full flex-col justify-center ps-1',\n /** Buttons for increasing or decreasing the numeric value */\n stepperButton: [\n // stepper button dimensions and appearance\n 'flex h-3 w-3 items-center justify-center text-default-foreground outline-none',\n // hover and keyboard focus\n 'hover:opacity-hover focus-visible:outline-2 focus-visible:outline-focus',\n ],\n },\n variants: {\n filled: {\n true: {\n base: 'is-filled',\n input: 'is-filled',\n inputWrapper: 'is-filled',\n },\n },\n number: { true: { clearButton: 'relative' } },\n password: {\n true: { clearButton: 'relative end-auto m-0 p-1', innerWrapper: 'gap-2' },\n },\n clearable: { true: { input: 'pe-6' } },\n size: {\n lg: {\n input: 'text-medium',\n inputWrapper: 'h-12 min-h-12',\n label: 'text-medium',\n },\n md: {},\n sm: {\n clearButton: 'text-medium',\n input: 'text-small',\n inputWrapper: 'h-8 min-h-8 px-2',\n label: 'text-tiny',\n },\n },\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\n invalid: {\n true: {\n input: 'text-danger',\n inputWrapper:\n 'border-danger group-data-[focus=true]:border-danger data-[hovered=true]:border-danger group-data-[focus=true]:data-[hovered=true]:border-danger',\n label: 'text-danger',\n },\n },\n },\n});\n\n/** Variant options for the input styling slots */\nexport type VariantProps = TVProps<typeof inputVariants>;\n\n/** Class name overrides for the public Input styling slots. */\nexport type ClassName = TVClassName<typeof inputVariants>;\n\n/** Resolved class names for every Input styling slot. */\nexport type InputClassNames = Record<\n keyof ReturnType<typeof inputVariants>,\n string\n>;\n\nexport default inputVariants;\n","import type { ReactNode } from 'react';\nimport type { InputControlProps } from './InputControl';\n\nimport { NumberField, TextField } from 'react-aria-components';\n\nimport {\n getFieldControlProps,\n getFieldDataAttributes,\n} from '../../helpers/fieldProps/fieldProps';\n\ntype InputFieldProps = Pick<InputControlProps, 'field'> & {\n /** Selects the native display type without changing form registration */\n type?: 'text' | 'number' | 'password';\n /** Renders content inside the field */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Shows focus styling while focus is within the control */\n focused: boolean;\n /** Marks the input as filled when the display value is nonempty */\n hasValue: boolean;\n /** Shows the keyboard focus indicator */\n isFocusVisible: boolean;\n};\n\n/**\n * React Aria field root for text, password and number inputs.\n *\n * Provides TextField or NumberField context to the editable content and actions,\n * forwards validation/accessibility state, and adapts numeric values to the\n * binding's string display values. Preserves Uniform's root styling selectors.\n *\n * @see https://react-aria.adobe.com/TextField\n * @see https://react-aria.adobe.com/NumberField\n */\nconst InputField = ({\n field,\n type,\n children,\n className = undefined,\n focused,\n hasValue,\n isFocusVisible,\n}: InputFieldProps) => {\n const {\n disabled,\n invalid,\n name,\n onBlur,\n onChange: onValueChange,\n required,\n value,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const dataAttributes = getFieldDataAttributes(field);\n\n // shared root props for the text and number field engines\n const rootProps = {\n ...controlProps,\n ...dataAttributes,\n className,\n 'data-component': 'input',\n 'data-filled': hasValue || undefined,\n 'data-focus': focused || undefined,\n 'data-focus-visible': isFocusVisible || undefined,\n 'data-slot': 'base',\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n name,\n onBlur,\n validationBehavior: 'aria' as const,\n };\n\n // keep numeric edits as strings at the binding boundary\n const handleNumberChange = (next: number) => {\n onValueChange(Number.isNaN(next) ? '' : String(next));\n };\n\n // NumberField represents an empty value as NaN\n if (type === 'number') {\n const numericValue = value !== '' && value != null ? Number(value) : NaN;\n\n return (\n <NumberField\n {...rootProps}\n formatOptions={{ useGrouping: false }}\n onChange={handleNumberChange}\n value={numericValue}\n >\n {children}\n </NumberField>\n );\n }\n\n return (\n <TextField\n {...rootProps}\n onChange={onValueChange}\n type={type ?? 'text'}\n value={String(value ?? '')}\n >\n {children}\n </TextField>\n );\n};\n\nexport default InputField;\n","import type { ReactNode } from 'react';\n\nimport { Button } from 'react-aria-components';\n\ninterface InputClearButtonProps {\n /** Replaces the default clear icon */\n children?: ReactNode;\n /** CSS class name */\n className: string;\n /** Disables the clear button when the input is disabled */\n disabled?: boolean;\n /** Callback when the clear button is activated */\n onClear: () => void;\n}\n\n/**\n * React Aria Button that invokes the supplied clear action without taking focus.\n *\n * Uses slot=null to opt out of NumberField's increment/decrement button context.\n * Renders custom end content when supplied, otherwise the default clear icon.\n *\n * @see https://react-aria.adobe.com/Button\n * @see https://react-aria.adobe.com/NumberField\n */\nconst InputClearButton = ({\n children = undefined,\n className,\n disabled = undefined,\n onClear,\n}: InputClearButtonProps) => {\n return (\n <Button\n aria-label=\"clear input\"\n className={className}\n data-slot=\"clear-button\"\n isDisabled={disabled}\n onPress={onClear}\n preventFocusOnPress\n slot={null}\n >\n {children ?? (\n <svg aria-hidden height=\"1em\" viewBox=\"0 0 24 24\" width=\"1em\">\n <path\n d=\"M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z\"\n fill=\"currentColor\"\n />\n </svg>\n )}\n </Button>\n );\n};\n\nexport default InputClearButton;\n","import { Button } from 'react-aria-components';\nimport { FaEye, FaEyeSlash } from 'react-icons/fa6';\n\ninterface InputPasswordToggleProps {\n /** CSS class name */\n className: string;\n /** Identifies the input controlled by the visibility action */\n controlId: string;\n /** Disables password visibility changes */\n disabled?: boolean;\n /** Callback invoked when visibility is toggled */\n onToggle: () => void;\n /** Identifies the toggle in tests */\n testId: string;\n /** Shows the password as plain text */\n visible: boolean;\n}\n\n/**\n * Password visibility action preserving input focus on pointer activation\n *\n * @see https://react-aria.adobe.com/Button\n */\nconst InputPasswordToggle = ({\n className,\n controlId,\n disabled = false,\n onToggle,\n testId,\n visible,\n}: InputPasswordToggleProps) => {\n return (\n <Button\n aria-controls={controlId}\n aria-label={visible ? 'Hide password' : 'Show password'}\n aria-pressed={visible}\n className={className}\n data-testid={`${testId}_password_toggle`}\n isDisabled={disabled}\n onPress={onToggle}\n preventFocusOnPress\n slot={null}\n type=\"button\"\n >\n {visible ? (\n <FaEyeSlash aria-hidden=\"true\" />\n ) : (\n <FaEye aria-hidden=\"true\" />\n )}\n </Button>\n );\n};\n\nexport default InputPasswordToggle;\n","import type { InputClassNames } from '../inputVariants';\n\nimport { Button } from 'react-aria-components';\n\ninterface ChevronProps {\n /** Points the chevron upward for the increment action */\n up?: boolean;\n}\n\n/** Decorative direction indicator for the number stepper buttons. */\nconst Chevron = ({ up = false }: ChevronProps) => {\n return (\n <svg\n aria-hidden\n fill=\"none\"\n height=\"1em\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={up ? 'm18 15-6-6-6 6' : 'm6 9 6 6 6-6'} />\n </svg>\n );\n};\n\ninterface InputStepperProps {\n /** CSS class name */\n className: InputClassNames;\n}\n\n/**\n * Increment and decrement React Aria Buttons for the surrounding NumberField.\n *\n * Named slots connect each button to NumberField's value and disabled state.\n * Keeps the controls outside the tab order so keyboard editing stays in the input.\n *\n * @see https://react-aria.adobe.com/NumberField\n * @see https://react-aria.adobe.com/Button\n */\nconst InputStepper = ({ className }: InputStepperProps) => {\n return (\n <div className={className.stepper} data-slot=\"stepper-wrapper\">\n <Button\n className={className.stepperButton}\n data-slot=\"increase-button\"\n slot=\"increment\"\n >\n <Chevron up />\n </Button>\n <Button\n className={className.stepperButton}\n data-slot=\"decrease-button\"\n slot=\"decrement\"\n >\n <Chevron />\n </Button>\n </div>\n );\n};\n\nexport default InputStepper;\n","import type { ChangeEvent, KeyboardEvent, MouseEvent, Ref } from 'react';\nimport type { FocusRingAria } from 'react-aria/useFocusRing';\nimport type { InputClassNames } from '../inputVariants';\nimport type { InputControlProps } from './InputControl';\n\nimport { Input as AriaInput, Group } from 'react-aria-components';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport InputClearButton from './InputClearButton';\nimport InputPasswordToggle from './InputPasswordToggle';\nimport InputStepper from './InputStepper';\n\ntype InputWrapperProps = Pick<\n InputControlProps,\n | 'field'\n | 'clearable'\n | 'endContent'\n | 'hidePasswordToggle'\n | 'placeholder'\n | 'startContent'\n | 'type'\n> & {\n /** Ref to the editable input */\n inputRef: Ref<HTMLInputElement>;\n /** CSS class name */\n className: InputClassNames;\n /** Shows focus styling while focus is within the control */\n focused: boolean;\n /** Connects the wrapper to the focus ring handlers */\n focusProps: Pick<FocusRingAria['focusProps'], 'onBlur' | 'onFocus'>;\n /** Marks the input as filled when the display value is nonempty */\n hasValue: boolean;\n /** Callback when the clear button or Escape key clears the input */\n onClear: () => void;\n /** Callback invoked to reveal or mask the password */\n onTogglePassword: () => void;\n /** Shows the password without changing the registered field type */\n passwordVisible: boolean;\n /** Callback invoked to focus the input after a wrapper click */\n onFocusControl: () => void;\n};\n\n/**\n * Bordered input surface built from React Aria Group and Input\n *\n * Arranges addons, clear actions and number steppers around the native input,\n * forwards its ref and accessibility attributes, and reports wrapper interactions.\n * The surrounding InputField supplies the TextField or NumberField context.\n *\n * @see https://react-aria.adobe.com/Group\n * @see https://react-aria.adobe.com/TextField (Input composition)\n * @see https://react-aria.adobe.com/NumberField (Input and stepper composition)\n */\nconst InputWrapper = ({\n field,\n clearable = false,\n endContent,\n hidePasswordToggle,\n inputRef,\n onClear,\n onFocusControl,\n onTogglePassword,\n passwordVisible,\n placeholder,\n startContent,\n type,\n className,\n focused,\n focusProps,\n hasValue,\n}: InputWrapperProps) => {\n const { disabled, onChange: onValueChange, testId } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n // focus the input when its wrapper padding is clicked\n const handleWrapperClick = (event: MouseEvent<HTMLElement>) => {\n if (!disabled && event.currentTarget === event.target) {\n onFocusControl();\n }\n };\n\n // forward the raw number text to the value handler\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onValueChange(event.target.value);\n };\n\n // clear a populated input when Escape is pressed\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && clearable && hasValue && !disabled) {\n event.preventDefault();\n onClear();\n }\n };\n\n return (\n <Group\n {...focusProps}\n className={className.inputWrapper}\n data-focus={focused || undefined}\n data-slot=\"input-wrapper\"\n isDisabled={disabled}\n onClick={handleWrapperClick}\n >\n <div className={className.innerWrapper} data-slot=\"inner-wrapper\">\n {startContent}\n <AriaInput\n {...controlProps}\n ref={inputRef}\n autoComplete=\"off\"\n className={className.input}\n data-filled={hasValue || undefined}\n data-has-end-content={\n !!endContent || (clearable && hasValue) || undefined\n }\n data-has-start-content={!!startContent || undefined}\n data-slot=\"input\"\n data-testid={testId}\n onChange={type === 'number' ? handleChange : undefined}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n />\n {type === 'password' ? endContent : null}\n {clearable && hasValue ? (\n <InputClearButton\n className={className.clearButton}\n disabled={disabled}\n onClear={onClear}\n >\n {type !== 'number' && type !== 'password' && endContent\n ? endContent\n : undefined}\n </InputClearButton>\n ) : null}\n {type !== 'password' && (!clearable || type === 'number')\n ? endContent\n : null}\n {type === 'password' && !hidePasswordToggle ? (\n <InputPasswordToggle\n className={className.passwordToggle}\n controlId={field.ids.control}\n disabled={disabled}\n onToggle={onTogglePassword}\n testId={testId}\n visible={passwordVisible}\n />\n ) : null}\n {type === 'number' ? <InputStepper className={className} /> : null}\n </div>\n </Group>\n );\n};\n\nexport default InputWrapper;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { InputProps } from '../Input';\n\nimport { useEffect, useState } from 'react';\nimport { useFocusRing } from 'react-aria/useFocusRing';\nimport { useObjectRef } from 'react-aria/useObjectRef';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport { inputVariants } from '../inputVariants';\nimport InputField from './InputField';\nimport InputWrapper from './InputWrapper';\n\n/** Presentation receives values and callbacks; it never registers a form field. */\nexport interface InputControlProps extends Pick<\n InputProps,\n | 'className'\n | 'clearable'\n | 'endContent'\n | 'hidePasswordToggle'\n | 'onClear'\n | 'placeholder'\n | 'size'\n | 'startContent'\n | 'type'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string>;\n /** Callback that clears pending edits and resets the bound value */\n onReset: () => void;\n /** Subscribes to reset notifications without accessing form context */\n subscribeReset?: (listener: () => void) => () => void;\n}\n\n/**\n * Composes the Input presentation without registering a form field.\n *\n * Owns the editable ref, focus restoration and interaction styling.\n * Connects InputField's Aria field root, FieldLayout and the editable content.\n * Values, validation state and callbacks are supplied by the Input binding.\n *\n * @see https://react-aria.adobe.com/useFocusRing\n * @see https://react-aria.adobe.com/TextField\n * @see https://react-aria.adobe.com/NumberField\n */\nconst InputControl = (props: InputControlProps) => {\n const { field, subscribeReset } = props;\n\n const styling = useStyling();\n const [passwordVisible, setPasswordVisible] = useState(false);\n\n // reset notifications keep presentation independent of form context\n useEffect(() => {\n const handleReset = () => {\n setPasswordVisible(false);\n };\n\n return subscribeReset?.(handleReset);\n }, [subscribeReset]);\n\n const controlRef = useObjectRef<HTMLInputElement>(field.ref);\n const {\n focusProps,\n isFocused: focused,\n isFocusVisible,\n } = useFocusRing({\n isTextInput: true,\n within: true,\n });\n\n const {\n size,\n type,\n clearable,\n className,\n hidePasswordToggle,\n onClear,\n onReset,\n } = props;\n\n const displayType =\n type === 'password' && !hidePasswordToggle && passwordVisible\n ? 'text'\n : type;\n\n const {\n value,\n disabled,\n invalid,\n label,\n required,\n ids,\n description,\n errorMessage,\n } = field;\n\n // treat empty and nullish values as cleared, preserve numeric zero\n const hasValue = value !== '' && value != null;\n\n // classNames from slots\n const variants = styling.resolve(inputVariants, {\n clearable,\n disabled,\n filled: hasValue,\n invalid,\n number: type === 'number',\n password: type === 'password',\n size,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n // focus the editable input\n const handleFocus = () => {\n controlRef.current?.focus();\n };\n\n // change only the display, the binding keeps its declared password type\n const handleTogglePassword = () => {\n setPasswordVisible((visible) => {\n return !visible;\n });\n };\n\n // clear the value, notify the consumer and restore input focus\n const handleClear = () => {\n setPasswordVisible(false);\n onReset();\n onClear?.();\n handleFocus();\n };\n\n return (\n <FieldLayout\n // provide the text or number field engine\n baseAs={InputField}\n baseProps={{\n field,\n focused,\n hasValue,\n isFocusVisible,\n type: displayType,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n required={required}\n >\n <InputWrapper\n {...props}\n className={classNames}\n focusProps={focusProps}\n focused={focused}\n hasValue={hasValue}\n inputRef={controlRef}\n onClear={handleClear}\n onFocusControl={handleFocus}\n onTogglePassword={handleTogglePassword}\n passwordVisible={passwordVisible}\n />\n </FieldLayout>\n );\n};\n\nexport default InputControl;\n","import type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\nimport type { ClassName } from './inputVariants';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport InputControl from './subcomponents/InputControl';\n\nexport { default as inputVariants } from './inputVariants';\n\nexport interface InputProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Shows a clear button when the input has a value */\n clearable?: boolean;\n /** Delay in milliseconds before updating form state (default: 300) */\n debounceDelay?: number;\n /** Help text associated with the input */\n description?: ReactNode;\n /** Disables the input */\n disabled?: boolean;\n /** Content at the end of the input */\n endContent?: ReactNode;\n /** Hides the password visibility toggle (default: false) */\n hidePasswordToggle?: boolean;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** Callback when the input value is cleared */\n onClear?: () => void;\n /** Placeholder text */\n placeholder?: string;\n /** Redacts diagnostic values, password fields are always redacted */\n sensitive?: boolean;\n /** Input size */\n size?: 'sm' | 'md' | 'lg';\n /** Content at the start of the input */\n startContent?: ReactNode;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Conversion between display and form values */\n transform?: InputValueTransform<string>;\n /** Input type */\n type?: 'number' | 'password';\n}\n\n/** Form input field for text, passwords or numbers */\nconst Input = ({\n className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n startContent = undefined,\n size = 'md',\n type = undefined,\n hidePasswordToggle = false,\n name,\n onClear = undefined,\n placeholder = ' ',\n ...uniformProps\n}: InputProps) => {\n const { field, formReset } = useUniformField({\n ...uniformProps,\n name,\n placeholder,\n type,\n });\n\n // debounce form updates, flush pending edits on blur\n const { value, onChange, onBlur, clear } = useInputValueDebounce({\n debounceDelay,\n emptyValue: '',\n name,\n onBlur: field.onBlur,\n onChange: field.onChange,\n value: field.value,\n });\n\n return (\n <InputControl\n key={`${name}-${type}-${hidePasswordToggle}`}\n hidePasswordToggle={hidePasswordToggle}\n className={className}\n clearable={clearable}\n endContent={endContent}\n field={{ ...field, onBlur, onChange, value }}\n onClear={onClear}\n onReset={clear}\n placeholder={placeholder}\n size={size}\n startContent={startContent}\n subscribeReset={formReset.subscribe}\n type={type}\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { inputVariants } from './inputVariants';\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;;;AAKA,MAAa,gBAAgB,GAAG;CAC9B,OAAO;;EAEL,MAAM;;EAEN,aAAa,CAEX,+FAEA,uEACF;;EAEA,aAAa;;EAEb,cAAc;;EAEd,eAAe;;EAEf,cAAc;;EAEd,OAAO;GAEL;GAEA;GAEA;GAEA;EACF;;EAEA,cAAc;GAEZ;GAEA;GAEA;GAEA;GAEA;EACF;;EAEA,OACE;;EAEF,gBACE;;EAEF,SAAS;;EAET,eAAe,CAEb,iFAEA,yEACF;CACF;CACA,UAAU;EACR,QAAQ,EACN,MAAM;GACJ,MAAM;GACN,OAAO;GACP,cAAc;EAChB,EACF;EACA,QAAQ,EA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Q;EACR,WAAW;GACT;GACA;GACA;GACA;GACA,MAAM;EACR;EACA,WAAW;EACE;EACC;EACT;EACI;EACF;EACG;EAEV,UAAA,oBAAC,cAAD;GACE,GAAI;GACJ,WAAW;GACC;GACH;GACC;GACV,UAAU;GACV,SAAS;GACT,gBAAgB;GAChB,kBAAkB;GACD;EAClB,CAAA;CACU,CAAA;AAEjB;;;;ACnHA,MAAMC,WAAS,EACb,YAAY,KAAA,GACZ,YAAY,OACZ,gBAAgB,KAChB,aAAa,KAAA,GACb,eAAe,KAAA,GACf,OAAO,MACP,OAAO,KAAA,GACP,qBAAqB,OACrB,MACA,UAAU,KAAA,GACV,cAAc,KACd,GAAG,mBACa;CAChB,MAAM,EAAE,OAAO,cAAc,gBAAgB;EAC3C,GAAG;EACH;EACA;EACA;CACF,CAAC;CAGD,MAAM,EAAE,OAAO,UAAU,QAAQ,UAAU,sBAAsB;EAC/D;EACA,YAAY;EACZ;EACA,QAAQ,MAAM;EACd,UAAU,MAAM;EAChB,OAAO,MAAM;CACf,CAAC;CAED,OACE,oBAAC,cAAD;EAEsB;EACT;EACA;EACC;EACZ,OAAO;GAAE,GAAG;GAAO;GAAQ;GAAU;EAAM;EAClC;EACT,SAAS;EACI;EACP;EACQ;EACd,gBAAgB,UAAU;EACpB;CACP,GAbM,GAAG,KAAK,GAAG,KAAK,GAAG,oBAazB;AAEL;;;AC5FA,IAAA,gBAAeC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["AriaInput","Input","Input"],"sources":["../../src/Input/inputVariants.ts","../../src/Input/subcomponents/InputField.tsx","../../src/Input/subcomponents/InputClearButton.tsx","../../src/Input/subcomponents/InputPasswordToggle.tsx","../../src/Input/subcomponents/InputStepper.tsx","../../src/Input/subcomponents/InputWrapper.tsx","../../src/Input/subcomponents/InputControl.tsx","../../src/Input/Input.tsx","../../src/Input/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\n/** Default styles for all public Input slots */\nexport const inputVariants = tv({\n slots: {\n /** Container grouping the label, control and hints */\n base: 'group relative flex w-full flex-col',\n /** Button for clearing the current value */\n clearButton: [\n // clear button placement and appearance\n 'absolute end-3 z-10 -m-2 cursor-pointer rounded-full p-2 text-large opacity-70 outline-none',\n // hover and keyboard focus\n 'hover:opacity-100 focus-visible:outline-2 focus-visible:outline-focus',\n ],\n /** Supporting text below the input */\n description: 'text-tiny text-foreground-500',\n /** Container for validation messages */\n errorMessage: 'text-tiny text-danger',\n /** Container for help text and validation messages */\n helperWrapper: 'relative flex flex-col p-0',\n /** Row containing the input, addons and actions */\n innerWrapper: 'inline-flex h-full w-full items-center gap-0',\n /** Native input for text or numeric entry */\n input: [\n // editable text and transparent surface\n 'w-full min-w-0 bg-transparent bg-clip-text text-small font-normal text-inherit outline-none',\n // placeholder and autofill\n 'placeholder:text-foreground-500 autofill:bg-transparent',\n // spacing around surrounding content\n 'data-[has-end-content=true]:pe-1.5 data-[has-start-content=true]:ps-1.5',\n // browser-specific input appearance\n 'dark:autofill:[-webkit-text-fill-color:var(--pixel-color-foreground)] [&::-ms-reveal]:hidden',\n ],\n /** Bordered container around the editable area */\n inputWrapper: [\n // input frame and layout\n 'relative inline-flex h-10 min-h-10 w-full cursor-text items-center shadow-xs',\n // bordered surface and text\n 'rounded-small border-medium border-default-200 bg-content1 px-3 text-foreground',\n // interaction transitions\n 'transition-colors',\n // hover, disabled and validation states\n 'group-data-[disabled=true]:pointer-events-none group-data-[focus=true]:border-focus group-data-[invalid=true]:border-danger data-[hovered=true]:border-default-400 group-data-[focus=true]:data-[hovered=true]:border-default-foreground',\n // reduced motion\n 'motion-reduce:transition-none',\n ],\n /** Label above the input */\n label:\n 'block cursor-default pb-1 text-small text-foreground group-data-[invalid=true]:text-danger',\n /** Button for revealing or masking a password */\n passwordToggle:\n 'shrink-0 rounded-sm p-1 text-default-400 outline-none focus-visible:ring-2 focus-visible:ring-focus',\n /** Container grouping increment and decrement buttons */\n stepper: 'flex h-full flex-col justify-center ps-1',\n /** Buttons for increasing or decreasing the numeric value */\n stepperButton: [\n // stepper button dimensions and appearance\n 'flex h-3 w-3 items-center justify-center text-default-foreground outline-none',\n // hover and keyboard focus\n 'hover:opacity-hover focus-visible:outline-2 focus-visible:outline-focus',\n ],\n },\n variants: {\n filled: {\n true: {\n base: 'is-filled',\n input: 'is-filled',\n inputWrapper: 'is-filled',\n },\n },\n number: { true: { clearButton: 'relative' } },\n password: {\n true: { clearButton: 'relative end-auto m-0 p-1', innerWrapper: 'gap-2' },\n },\n clearable: { true: { input: 'pe-6' } },\n size: {\n lg: {\n input: 'text-medium',\n inputWrapper: 'h-12 min-h-12',\n label: 'text-medium',\n },\n md: {},\n sm: {\n clearButton: 'text-medium',\n input: 'text-small',\n inputWrapper: 'h-8 min-h-8 px-2',\n label: 'text-tiny',\n },\n },\n disabled: { true: { base: 'pointer-events-none opacity-disabled' } },\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 },\n },\n invalid: {\n true: {\n input: 'text-danger',\n inputWrapper:\n 'border-danger group-data-[focus=true]:border-danger data-[hovered=true]:border-danger group-data-[focus=true]:data-[hovered=true]:border-danger',\n label: 'text-danger',\n },\n },\n },\n});\n\n/** Variant options for the input styling slots */\nexport type VariantProps = TVProps<typeof inputVariants>;\n\n/** Class name overrides for the public Input styling slots. */\nexport type ClassName = TVClassName<typeof inputVariants>;\n\n/** Resolved class names for every Input styling slot. */\nexport type InputClassNames = Record<\n keyof ReturnType<typeof inputVariants>,\n string\n>;\n\nexport default inputVariants;\n","import type { ReactNode } from 'react';\nimport type { InputControlProps } from './InputControl';\n\nimport { NumberField, TextField } from 'react-aria-components';\n\nimport {\n getFieldControlProps,\n getFieldDataAttributes,\n} from '../../helpers/fieldProps/fieldProps';\n\ntype InputFieldProps = Pick<InputControlProps, 'field'> & {\n /** Selects the native display type without changing form registration */\n type?: 'text' | 'number' | 'password';\n /** Renders content inside the field */\n children: ReactNode;\n /** CSS class name */\n className?: string;\n /** Shows focus styling while focus is within the control */\n focused: boolean;\n /** Marks the input as filled when the display value is nonempty */\n hasValue: boolean;\n /** Shows the keyboard focus indicator */\n isFocusVisible: boolean;\n};\n\n/**\n * React Aria field root for text, password and number inputs.\n *\n * Provides TextField or NumberField context to the editable content and actions,\n * forwards validation/accessibility state, and adapts numeric values to the\n * binding's string display values. Preserves Uniform's root styling selectors.\n *\n * @see https://react-aria.adobe.com/TextField\n * @see https://react-aria.adobe.com/NumberField\n */\nconst InputField = ({\n field,\n type,\n children,\n className = undefined,\n focused,\n hasValue,\n isFocusVisible,\n}: InputFieldProps) => {\n const {\n disabled,\n invalid,\n name,\n onBlur,\n onChange: onValueChange,\n readOnly,\n required,\n value,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const dataAttributes = getFieldDataAttributes(field);\n\n // shared root props for the text and number field engines\n const rootProps = {\n ...controlProps,\n ...dataAttributes,\n className,\n 'data-component': 'input',\n 'data-filled': hasValue || undefined,\n 'data-focus': focused || undefined,\n 'data-focus-visible': isFocusVisible || undefined,\n 'data-slot': 'base',\n isDisabled: disabled,\n isInvalid: invalid,\n isReadOnly: readOnly,\n isRequired: required,\n name,\n onBlur,\n validationBehavior: 'aria' as const,\n };\n\n // keep numeric edits as strings at the binding boundary\n const handleNumberChange = (next: number) => {\n onValueChange(Number.isNaN(next) ? '' : String(next));\n };\n\n // NumberField represents an empty value as NaN\n if (type === 'number') {\n const numericValue = value !== '' && value != null ? Number(value) : NaN;\n\n return (\n <NumberField\n {...rootProps}\n formatOptions={{ useGrouping: false }}\n onChange={handleNumberChange}\n value={numericValue}\n >\n {children}\n </NumberField>\n );\n }\n\n return (\n <TextField\n {...rootProps}\n onChange={onValueChange}\n type={type ?? 'text'}\n value={String(value ?? '')}\n >\n {children}\n </TextField>\n );\n};\n\nexport default InputField;\n","import type { ReactNode } from 'react';\n\nimport { Button } from 'react-aria-components';\n\ninterface InputClearButtonProps {\n /** Replaces the default clear icon */\n children?: ReactNode;\n /** CSS class name */\n className: string;\n /** Disables the clear button when the input is disabled */\n disabled?: boolean;\n /** Callback when the clear button is activated */\n onClear: () => void;\n}\n\n/**\n * React Aria Button that invokes the supplied clear action without taking focus.\n *\n * Uses slot=null to opt out of NumberField's increment/decrement button context.\n * Renders custom end content when supplied, otherwise the default clear icon.\n *\n * @see https://react-aria.adobe.com/Button\n * @see https://react-aria.adobe.com/NumberField\n */\nconst InputClearButton = ({\n children = undefined,\n className,\n disabled = undefined,\n onClear,\n}: InputClearButtonProps) => {\n return (\n <Button\n aria-label=\"clear input\"\n className={className}\n data-slot=\"clear-button\"\n isDisabled={disabled}\n onPress={onClear}\n preventFocusOnPress\n slot={null}\n >\n {children ?? (\n <svg aria-hidden height=\"1em\" viewBox=\"0 0 24 24\" width=\"1em\">\n <path\n d=\"M12 2a10 10 0 1010 10A10.016 10.016 0 0012 2zm3.36 12.3a.754.754 0 010 1.06.748.748 0 01-1.06 0l-2.3-2.3-2.3 2.3a.748.748 0 01-1.06 0 .754.754 0 010-1.06l2.3-2.3-2.3-2.3A.75.75 0 019.7 8.64l2.3 2.3 2.3-2.3a.75.75 0 011.06 1.06l-2.3 2.3z\"\n fill=\"currentColor\"\n />\n </svg>\n )}\n </Button>\n );\n};\n\nexport default InputClearButton;\n","import { Button } from 'react-aria-components';\nimport { FaEye, FaEyeSlash } from 'react-icons/fa6';\n\ninterface InputPasswordToggleProps {\n /** CSS class name */\n className: string;\n /** Identifies the input controlled by the visibility action */\n controlId: string;\n /** Disables password visibility changes */\n disabled?: boolean;\n /** Callback invoked when visibility is toggled */\n onToggle: () => void;\n /** Identifies the toggle in tests */\n testId: string;\n /** Shows the password as plain text */\n visible: boolean;\n}\n\n/**\n * Password visibility action preserving input focus on pointer activation\n *\n * @see https://react-aria.adobe.com/Button\n */\nconst InputPasswordToggle = ({\n className,\n controlId,\n disabled = false,\n onToggle,\n testId,\n visible,\n}: InputPasswordToggleProps) => {\n return (\n <Button\n aria-controls={controlId}\n aria-label={visible ? 'Hide password' : 'Show password'}\n aria-pressed={visible}\n className={className}\n data-testid={`${testId}_password_toggle`}\n isDisabled={disabled}\n onPress={onToggle}\n preventFocusOnPress\n slot={null}\n type=\"button\"\n >\n {visible ? (\n <FaEyeSlash aria-hidden=\"true\" />\n ) : (\n <FaEye aria-hidden=\"true\" />\n )}\n </Button>\n );\n};\n\nexport default InputPasswordToggle;\n","import type { InputClassNames } from '../inputVariants';\n\nimport { Button } from 'react-aria-components';\n\ninterface ChevronProps {\n /** Points the chevron upward for the increment action */\n up?: boolean;\n}\n\n/** Decorative direction indicator for the number stepper buttons. */\nconst Chevron = ({ up = false }: ChevronProps) => {\n return (\n <svg\n aria-hidden\n fill=\"none\"\n height=\"1em\"\n stroke=\"currentColor\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeWidth=\"1.5\"\n viewBox=\"0 0 24 24\"\n width=\"1em\"\n >\n <path d={up ? 'm18 15-6-6-6 6' : 'm6 9 6 6 6-6'} />\n </svg>\n );\n};\n\ninterface InputStepperProps {\n /** CSS class name */\n className: InputClassNames;\n}\n\n/**\n * Increment and decrement React Aria Buttons for the surrounding NumberField.\n *\n * Named slots connect each button to NumberField's value and disabled state.\n * Keeps the controls outside the tab order so keyboard editing stays in the input.\n *\n * @see https://react-aria.adobe.com/NumberField\n * @see https://react-aria.adobe.com/Button\n */\nconst InputStepper = ({ className }: InputStepperProps) => {\n return (\n <div className={className.stepper} data-slot=\"stepper-wrapper\">\n <Button\n className={className.stepperButton}\n data-slot=\"increase-button\"\n slot=\"increment\"\n >\n <Chevron up />\n </Button>\n <Button\n className={className.stepperButton}\n data-slot=\"decrease-button\"\n slot=\"decrement\"\n >\n <Chevron />\n </Button>\n </div>\n );\n};\n\nexport default InputStepper;\n","import type { ChangeEvent, KeyboardEvent, MouseEvent, Ref } from 'react';\nimport type { FocusRingAria } from 'react-aria/useFocusRing';\nimport type { InputClassNames } from '../inputVariants';\nimport type { InputControlProps } from './InputControl';\n\nimport { Input as AriaInput, Group } from 'react-aria-components';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport InputClearButton from './InputClearButton';\nimport InputPasswordToggle from './InputPasswordToggle';\nimport InputStepper from './InputStepper';\n\ntype InputWrapperProps = Pick<\n InputControlProps,\n | 'field'\n | 'clearable'\n | 'endContent'\n | 'hidePasswordToggle'\n | 'placeholder'\n | 'startContent'\n | 'type'\n> & {\n /** Ref to the editable input */\n inputRef: Ref<HTMLInputElement>;\n /** CSS class name */\n className: InputClassNames;\n /** Shows focus styling while focus is within the control */\n focused: boolean;\n /** Connects the wrapper to the focus ring handlers */\n focusProps: Pick<FocusRingAria['focusProps'], 'onBlur' | 'onFocus'>;\n /** Marks the input as filled when the display value is nonempty */\n hasValue: boolean;\n /** Callback when the clear button or Escape key clears the input */\n onClear: () => void;\n /** Callback invoked to reveal or mask the password */\n onTogglePassword: () => void;\n /** Shows the password without changing the registered field type */\n passwordVisible: boolean;\n /** Callback invoked to focus the input after a wrapper click */\n onFocusControl: () => void;\n};\n\n/**\n * Bordered input surface built from React Aria Group and Input\n *\n * Arranges addons, clear actions and number steppers around the native input,\n * forwards its ref and accessibility attributes, and reports wrapper interactions.\n * The surrounding InputField supplies the TextField or NumberField context.\n *\n * @see https://react-aria.adobe.com/Group\n * @see https://react-aria.adobe.com/TextField (Input composition)\n * @see https://react-aria.adobe.com/NumberField (Input and stepper composition)\n */\nconst InputWrapper = ({\n field,\n clearable = false,\n endContent,\n hidePasswordToggle,\n inputRef,\n onClear,\n onFocusControl,\n onTogglePassword,\n passwordVisible,\n placeholder,\n startContent,\n type,\n className,\n focused,\n focusProps,\n hasValue,\n}: InputWrapperProps) => {\n const { disabled, onChange: onValueChange, testId } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n // focus the input when its wrapper padding is clicked\n const handleWrapperClick = (event: MouseEvent<HTMLElement>) => {\n if (!disabled && event.currentTarget === event.target) {\n onFocusControl();\n }\n };\n\n // forward the raw number text to the value handler\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onValueChange(event.target.value);\n };\n\n // clear a populated input when Escape is pressed\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n if (event.key === 'Escape' && clearable && hasValue && !disabled) {\n event.preventDefault();\n onClear();\n }\n };\n\n return (\n <Group\n {...focusProps}\n className={className.inputWrapper}\n data-focus={focused || undefined}\n data-slot=\"input-wrapper\"\n isDisabled={disabled}\n onClick={handleWrapperClick}\n >\n <div className={className.innerWrapper} data-slot=\"inner-wrapper\">\n {startContent}\n <AriaInput\n {...controlProps}\n ref={inputRef}\n autoComplete=\"off\"\n className={className.input}\n data-filled={hasValue || undefined}\n data-has-end-content={\n !!endContent || (clearable && hasValue) || undefined\n }\n data-has-start-content={!!startContent || undefined}\n data-slot=\"input\"\n data-testid={testId}\n onChange={type === 'number' ? handleChange : undefined}\n onKeyDown={handleKeyDown}\n placeholder={placeholder}\n />\n {type === 'password' ? endContent : null}\n {clearable && hasValue ? (\n <InputClearButton\n className={className.clearButton}\n disabled={disabled}\n onClear={onClear}\n >\n {type !== 'number' && type !== 'password' && endContent\n ? endContent\n : undefined}\n </InputClearButton>\n ) : null}\n {type !== 'password' && (!clearable || type === 'number')\n ? endContent\n : null}\n {type === 'password' && !hidePasswordToggle ? (\n <InputPasswordToggle\n className={className.passwordToggle}\n controlId={field.ids.control}\n disabled={disabled}\n onToggle={onTogglePassword}\n testId={testId}\n visible={passwordVisible}\n />\n ) : null}\n {type === 'number' ? <InputStepper className={className} /> : null}\n </div>\n </Group>\n );\n};\n\nexport default InputWrapper;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { InputProps } from '../Input';\n\nimport { useEffect, useState } from 'react';\nimport { useFocusRing } from 'react-aria/useFocusRing';\nimport { useObjectRef } from 'react-aria/useObjectRef';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport { inputVariants } from '../inputVariants';\nimport InputField from './InputField';\nimport InputWrapper from './InputWrapper';\n\n/** Presentation receives values and callbacks; it never registers a form field. */\nexport interface InputControlProps extends Pick<\n InputProps,\n | 'className'\n | 'clearable'\n | 'endContent'\n | 'hidePasswordToggle'\n | 'onClear'\n | 'placeholder'\n | 'size'\n | 'startContent'\n | 'type'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string>;\n /** Callback that clears pending edits and resets the bound value */\n onReset: () => void;\n /** Subscribes to reset notifications without accessing form context */\n subscribeReset?: (listener: () => void) => () => void;\n}\n\n/**\n * Composes the Input presentation without registering a form field.\n *\n * Owns the editable ref, focus restoration and interaction styling.\n * Connects InputField's Aria field root, FieldLayout and the editable content.\n * Values, validation state and callbacks are supplied by the Input binding.\n *\n * @see https://react-aria.adobe.com/useFocusRing\n * @see https://react-aria.adobe.com/TextField\n * @see https://react-aria.adobe.com/NumberField\n */\nconst InputControl = (props: InputControlProps) => {\n const { field, subscribeReset } = props;\n\n const styling = useStyling();\n const [passwordVisible, setPasswordVisible] = useState(false);\n\n // reset notifications keep presentation independent of form context\n useEffect(() => {\n const handleReset = () => {\n setPasswordVisible(false);\n };\n\n return subscribeReset?.(handleReset);\n }, [subscribeReset]);\n\n const controlRef = useObjectRef<HTMLInputElement>(field.ref);\n const {\n focusProps,\n isFocused: focused,\n isFocusVisible,\n } = useFocusRing({\n isTextInput: true,\n within: true,\n });\n\n const {\n size,\n type,\n clearable,\n className,\n hidePasswordToggle,\n onClear,\n onReset,\n } = props;\n\n const displayType =\n type === 'password' && !hidePasswordToggle && passwordVisible\n ? 'text'\n : type;\n\n const {\n value,\n disabled,\n invalid,\n label,\n readOnly,\n required,\n ids,\n description,\n errorMessage,\n } = field;\n\n // treat empty and nullish values as cleared, preserve numeric zero\n const hasValue = value !== '' && value != null;\n\n // read-only values are never cleared\n const isClearable = clearable && !readOnly;\n\n // classNames from slots\n const variants = styling.resolve(inputVariants, {\n clearable: isClearable,\n disabled,\n filled: hasValue,\n invalid,\n number: type === 'number',\n password: type === 'password',\n readOnly,\n size,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n // focus the editable input\n const handleFocus = () => {\n controlRef.current?.focus();\n };\n\n // change only the display, the binding keeps its declared password type\n const handleTogglePassword = () => {\n setPasswordVisible((visible) => {\n return !visible;\n });\n };\n\n // clear the value, notify the consumer and restore input focus\n const handleClear = () => {\n setPasswordVisible(false);\n onReset();\n onClear?.();\n handleFocus();\n };\n\n return (\n <FieldLayout\n // provide the text or number field engine\n baseAs={InputField}\n baseProps={{\n field,\n focused,\n hasValue,\n isFocusVisible,\n type: displayType,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n required={required}\n >\n <InputWrapper\n {...props}\n className={classNames}\n clearable={isClearable}\n focusProps={focusProps}\n focused={focused}\n hasValue={hasValue}\n inputRef={controlRef}\n onClear={handleClear}\n onFocusControl={handleFocus}\n onTogglePassword={handleTogglePassword}\n passwordVisible={passwordVisible}\n />\n </FieldLayout>\n );\n};\n\nexport default InputControl;\n","import type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\nimport type { ClassName } from './inputVariants';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport InputControl from './subcomponents/InputControl';\n\nexport { default as inputVariants } from './inputVariants';\n\nexport interface InputProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Shows a clear button when the input has a value */\n clearable?: boolean;\n /** Delay in milliseconds before updating form state (default: 300) */\n debounceDelay?: number;\n /** Help text associated with the input */\n description?: ReactNode;\n /** Disables the input */\n disabled?: boolean;\n /** Content at the end of the input */\n endContent?: ReactNode;\n /** Hides the password visibility toggle (default: false) */\n hidePasswordToggle?: boolean;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** Callback when the input value is cleared */\n onClear?: () => void;\n /** Placeholder text */\n placeholder?: string;\n /** Prevents changes, the value can still be focused, copied and is submitted */\n readOnly?: boolean;\n /** Redacts diagnostic values, password fields are always redacted */\n sensitive?: boolean;\n /** Input size */\n size?: 'sm' | 'md' | 'lg';\n /** Content at the start of the input */\n startContent?: ReactNode;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Conversion between display and form values */\n transform?: InputValueTransform<string>;\n /** Input type */\n type?: 'number' | 'password';\n}\n\n/** Form input field for text, passwords or numbers */\nconst Input = ({\n className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n startContent = undefined,\n size = 'md',\n type = undefined,\n hidePasswordToggle = false,\n name,\n onClear = undefined,\n placeholder = ' ',\n ...uniformProps\n}: InputProps) => {\n const { field, formReset } = useUniformField({\n ...uniformProps,\n name,\n placeholder,\n type,\n });\n\n // debounce form updates, flush pending edits on blur\n const { value, onChange, onBlur, clear } = useInputValueDebounce({\n debounceDelay,\n emptyValue: '',\n name,\n onBlur: field.onBlur,\n onChange: field.onChange,\n value: field.value,\n });\n\n return (\n <InputControl\n key={`${name}-${type}-${hidePasswordToggle}`}\n hidePasswordToggle={hidePasswordToggle}\n className={className}\n clearable={clearable}\n endContent={endContent}\n field={{ ...field, onBlur, onChange, value }}\n onClear={onClear}\n onReset={clear}\n placeholder={placeholder}\n size={size}\n startContent={startContent}\n subscribeReset={formReset.subscribe}\n type={type}\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport { inputVariants } from './inputVariants';\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;;;;AAKA,MAAa,gBAAgB,GAAG;CAC9B,OAAO;;EAEL,MAAM;;EAEN,aAAa,CAEX,+FAEA,uEACF;;EAEA,aAAa;;EAEb,cAAc;;EAEd,eAAe;;EAEf,cAAc;;EAEd,OAAO;GAEL;GAEA;GAEA;GAEA;EAC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