@fuf-stack/uniform 1.27.0 → 1.28.1
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/README.md +9 -0
- package/dist/Checkboxes/index.d.mts +11 -13
- package/dist/Checkboxes/index.d.mts.map +1 -1
- package/dist/Checkboxes/index.mjs +2 -4
- package/dist/Checkboxes/index.mjs.map +1 -1
- package/dist/DatePicker/index.d.mts +14 -16
- package/dist/DatePicker/index.d.mts.map +1 -1
- package/dist/DatePicker/index.mjs +3 -6
- package/dist/DatePicker/index.mjs.map +1 -1
- package/dist/FieldArray/index.d.mts +2 -8
- package/dist/FieldArray/index.d.mts.map +1 -1
- package/dist/FieldArray/index.mjs +12 -22
- package/dist/FieldArray/index.mjs.map +1 -1
- package/dist/FieldCard/index.d.mts +0 -2
- package/dist/FieldCard/index.d.mts.map +1 -1
- package/dist/FieldCard/index.mjs +5 -8
- package/dist/FieldCard/index.mjs.map +1 -1
- package/dist/{FieldCopyTestIdButton-CRJBix9D.mjs → FieldCopyTestIdButton-Y9SfvaM9.mjs} +4 -6
- package/dist/{FieldCopyTestIdButton-CRJBix9D.mjs.map → FieldCopyTestIdButton-Y9SfvaM9.mjs.map} +1 -1
- package/dist/{FieldValidationError-ByRoIxaM.mjs → FieldValidationError-BcUV0r1I.mjs} +3 -5
- package/dist/{FieldValidationError-ByRoIxaM.mjs.map → FieldValidationError-BcUV0r1I.mjs.map} +1 -1
- package/dist/Form/index.d.mts +1 -3
- package/dist/Form/index.d.mts.map +1 -1
- package/dist/Form/index.mjs +10 -12
- package/dist/Form/index.mjs.map +1 -1
- package/dist/FormContext-B8G_Xxd6.mjs +512 -0
- package/dist/FormContext-B8G_Xxd6.mjs.map +1 -0
- package/dist/FormContext-BnNJYZOo.d.mts +124 -0
- package/dist/FormContext-BnNJYZOo.d.mts.map +1 -0
- package/dist/Grid/index.d.mts +0 -2
- package/dist/Grid/index.d.mts.map +1 -1
- package/dist/Grid/index.mjs +1 -2
- package/dist/{Grid-CTs-Rb9G.mjs → Grid-Us2JFczS.mjs} +3 -5
- package/dist/{Grid-CTs-Rb9G.mjs.map → Grid-Us2JFczS.mjs.map} +1 -1
- package/dist/Input/index.d.mts +21 -19
- package/dist/Input/index.d.mts.map +1 -1
- package/dist/Input/index.mjs +106 -13
- package/dist/Input/index.mjs.map +1 -1
- package/dist/RadioBoxes/index.d.mts +2 -6
- package/dist/RadioBoxes/index.d.mts.map +1 -1
- package/dist/RadioBoxes/index.mjs +3 -6
- package/dist/RadioBoxes/index.mjs.map +1 -1
- package/dist/RadioTabs/index.d.mts +46 -48
- package/dist/RadioTabs/index.d.mts.map +1 -1
- package/dist/RadioTabs/index.mjs +2 -4
- package/dist/RadioTabs/index.mjs.map +1 -1
- package/dist/Radios/index.d.mts +14 -16
- package/dist/Radios/index.d.mts.map +1 -1
- package/dist/Radios/index.mjs +2 -4
- package/dist/Radios/index.mjs.map +1 -1
- package/dist/Select/index.d.mts +5 -7
- package/dist/Select/index.d.mts.map +1 -1
- package/dist/Select/index.mjs +4 -7
- package/dist/Select/index.mjs.map +1 -1
- package/dist/Slider/index.d.mts +31 -33
- package/dist/Slider/index.d.mts.map +1 -1
- package/dist/Slider/index.mjs +2 -4
- 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 +16 -18
- package/dist/Switch/index.d.mts.map +1 -1
- package/dist/Switch/index.mjs +2 -4
- package/dist/Switch/index.mjs.map +1 -1
- package/dist/SwitchBox/index.d.mts +35 -37
- package/dist/SwitchBox/index.d.mts.map +1 -1
- package/dist/SwitchBox/index.mjs +2 -4
- package/dist/SwitchBox/index.mjs.map +1 -1
- package/dist/TextArea/index.d.mts +0 -2
- package/dist/TextArea/index.d.mts.map +1 -1
- package/dist/TextArea/index.mjs +2 -4
- package/dist/TextArea/index.mjs.map +1 -1
- package/dist/Time/index.d.mts +0 -2
- package/dist/Time/index.d.mts.map +1 -1
- package/dist/Time/index.mjs +3 -6
- 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 +1 -2
- package/dist/hooks/useController/index.mjs +2 -4
- package/dist/hooks/useFormContext/index.d.mts +2 -3
- package/dist/hooks/useFormContext/index.mjs +2 -4
- package/dist/hooks/useInput/index.mjs +2 -4
- package/dist/hooks/useInputValueDebounce/index.d.mts +2 -4
- package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
- package/dist/hooks/useInputValueDebounce/index.mjs +3 -5
- package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
- package/dist/hooks/useInputValueTransform/index.d.mts +1 -1
- package/dist/hooks/useInputValueTransform/index.mjs +2 -4
- package/dist/hooks/useUniformField/index.d.mts +2 -98
- package/dist/hooks/useUniformField/index.mjs +11 -11
- package/dist/hooks/useUniformField/index.mjs.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.d.mts +23 -49
- package/dist/hooks/useUniformFieldArray/index.d.mts.map +1 -1
- package/dist/hooks/useUniformFieldArray/index.mjs +3 -5
- package/dist/hooks/useUniformFieldArray/index.mjs.map +1 -1
- 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 +2 -4
- package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
- package/dist/hooks/useWatchUserChange/index.mjs +3 -5
- package/dist/hooks/useWatchUserChange/index.mjs.map +1 -1
- package/dist/index-DaiTW5Bl.d.mts +99 -0
- package/dist/index-DaiTW5Bl.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 -2
- package/dist/partials/FieldValidationError/index.d.mts +0 -2
- package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
- package/dist/partials/FieldValidationError/index.mjs +1 -2
- package/dist/{useController-CK39i6HI.mjs → useController-CJjMqXU5.mjs} +3 -4
- package/dist/{useController-CK39i6HI.mjs.map → useController-CJjMqXU5.mjs.map} +1 -1
- package/dist/{useController-DcK2YHbw.d.mts → useController-CdFEp-Wa.d.mts} +2 -4
- package/dist/useController-CdFEp-Wa.d.mts.map +1 -0
- package/dist/{useFormContext-fYWtlnpE.mjs → useFormContext-BEjPBdzb.mjs} +3 -4
- package/dist/useFormContext-BEjPBdzb.mjs.map +1 -0
- package/dist/useFormContext-BhPzFXwF.d.mts +45 -0
- package/dist/useFormContext-BhPzFXwF.d.mts.map +1 -0
- package/dist/useInput-NPbS4w_n.mjs +1 -0
- package/dist/{useInputValueTransform-DJ5zkqSy.mjs → useInputValueTransform-D44BLp1Z.mjs} +2 -3
- package/dist/{useInputValueTransform-DJ5zkqSy.mjs.map → useInputValueTransform-D44BLp1Z.mjs.map} +1 -1
- package/dist/{useInputValueTransform-LOaEim7k.d.mts → useInputValueTransform-cevZBrIN.d.mts} +3 -5
- package/dist/useInputValueTransform-cevZBrIN.d.mts.map +1 -0
- package/package.json +10 -10
- package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
- package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
- package/dist/FormContext-gHSwOlcy.mjs +0 -278
- package/dist/FormContext-gHSwOlcy.mjs.map +0 -1
- package/dist/hooks/useUniformField/index.d.mts.map +0 -1
- package/dist/index-CAdGtKE_.d.mts +0 -1
- package/dist/index-D5HVU2jP.d.mts +0 -1
- package/dist/useController-DcK2YHbw.d.mts.map +0 -1
- package/dist/useFormContext-B3QGVVaO.d.mts +0 -66
- package/dist/useFormContext-B3QGVVaO.d.mts.map +0 -1
- package/dist/useFormContext-fYWtlnpE.mjs.map +0 -1
- package/dist/useInput-C0aJaAGe.mjs +0 -2
- package/dist/useInputValueTransform-LOaEim7k.d.mts.map +0 -1
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { BaseSyntheticEvent, ReactNode } from "react";
|
|
2
|
+
import { FieldValues, Path, SubmitHandler } from "react-hook-form";
|
|
3
|
+
import { VetoFormattedError, VetoInstance, VetoTypeAny } from "@fuf-stack/veto";
|
|
4
|
+
type DebugMode = 'debug' | 'debug-testids' | 'off' | 'disabled';
|
|
5
|
+
interface DebugModeSettings {
|
|
6
|
+
/** disable form debug completely */
|
|
7
|
+
disable?: boolean;
|
|
8
|
+
/** custom localStorage key to save debug mode state */
|
|
9
|
+
localStorageKey?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Listener function that gets called when a form reset is triggered */
|
|
12
|
+
type FormResetListener = () => void;
|
|
13
|
+
/**
|
|
14
|
+
* Listener function that gets called when a field changes due to user input
|
|
15
|
+
*/
|
|
16
|
+
type UserChangeListener<TFieldValues extends object = object> = (fieldName: Path<TFieldValues>, value: unknown) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The `UniformContext` provides control over the form's submission behavior and may optionally include
|
|
19
|
+
* a Veto validation schema for form validation.
|
|
20
|
+
*
|
|
21
|
+
* Specifically, this context offers:
|
|
22
|
+
* 1. **Form Submission Control**: The `preventSubmit` function allows components to enable or disable
|
|
23
|
+
* form submissions.
|
|
24
|
+
* 2. **Optional Validation Schema**: The `validation` property may hold a Veto validation schema instance
|
|
25
|
+
* that can be used to validate form fields and handle validation logic.
|
|
26
|
+
* 3. **Client Validation**: The `setClientValidationSchema` function allows setting dynamic client-side
|
|
27
|
+
* validation schemas that complement the base Veto validation.
|
|
28
|
+
* 4. **User Change Tracking**: The `userChange` property provides a pub/sub system for tracking
|
|
29
|
+
* user-initiated field changes (typing, clicking, selecting) - NOT programmatic changes like
|
|
30
|
+
* form.reset() or form.setValue(). Used by the `useWatchUserChange` hook to enable reactive
|
|
31
|
+
* field dependencies.
|
|
32
|
+
* 5. **Form Reset Tracking**: The `formReset` property provides a pub/sub system for tracking
|
|
33
|
+
* programmatic form resets triggered via the wrapped `reset()` from `useFormContext`.
|
|
34
|
+
* Used by hooks like `useWatchFormReset` to run reset-specific normalization logic.
|
|
35
|
+
*
|
|
36
|
+
* This context is useful for components that need to interact with or control the form submission state,
|
|
37
|
+
* or access the validation schema for managing form validation logic.
|
|
38
|
+
*
|
|
39
|
+
* IMPORTANT: Context Singleton Pattern for HMR (Hot Module Replacement)
|
|
40
|
+
* =====================================================================
|
|
41
|
+
*
|
|
42
|
+
* We use a global window variable to ensure only ONE context instance exists across
|
|
43
|
+
* hot module reloads during development. This is critical because:
|
|
44
|
+
*
|
|
45
|
+
* **The Problem:**
|
|
46
|
+
* When using Vite/Storybook with Fast Refresh (HMR), editing this file causes it to
|
|
47
|
+
* be re-evaluated. Each re-evaluation runs `React.createContext()` again, creating a
|
|
48
|
+
* NEW context instance. This leads to "context instance mismatch":
|
|
49
|
+
*
|
|
50
|
+
* 1. FormProvider (provider) loads and uses context instance A
|
|
51
|
+
* 2. File is edited, HMR triggers
|
|
52
|
+
* 3. SubmitButton (consumer) hot-reloads and imports context instance B
|
|
53
|
+
* 4. Provider writes to instance A, Consumer reads from instance B
|
|
54
|
+
* 5. Result: Consumer sees default values (triggerSubmit = () => undefined)
|
|
55
|
+
* 6. Clicking submit does nothing because it calls the empty default function
|
|
56
|
+
*
|
|
57
|
+
* **The Solution:**
|
|
58
|
+
* By storing the context in `window.__UNIFORM_CONTEXT__`, we ensure:
|
|
59
|
+
* - First load: Create context and store in window
|
|
60
|
+
* - Subsequent HMRs: Reuse the same context from window
|
|
61
|
+
* - All components always reference the SAME context instance
|
|
62
|
+
* - Provider and consumers can properly communicate
|
|
63
|
+
*
|
|
64
|
+
* **Why This Is Safe:**
|
|
65
|
+
* - Only affects development (production has no HMR)
|
|
66
|
+
* - Context type never changes (same interface)
|
|
67
|
+
* - React handles cleanup on unmount normally
|
|
68
|
+
* - No memory leaks (context is lightweight)
|
|
69
|
+
*
|
|
70
|
+
* Without this pattern, you'd need to restart the dev server after every edit
|
|
71
|
+
* to FormContext.tsx to ensure all components use the same context instance.
|
|
72
|
+
*/
|
|
73
|
+
interface UniformContextType {
|
|
74
|
+
/** Form debug mode enabled or not */
|
|
75
|
+
debugMode: DebugMode;
|
|
76
|
+
/** settings for form debug mode */
|
|
77
|
+
debugModeSettings?: DebugModeSettings;
|
|
78
|
+
/** Form reset tracking (programmatic reset calls) */
|
|
79
|
+
formReset: {
|
|
80
|
+
/**
|
|
81
|
+
* Subscribe to programmatic form resets.
|
|
82
|
+
* Returns an unsubscribe function.
|
|
83
|
+
*/
|
|
84
|
+
subscribe: (listener: FormResetListener) => () => void;
|
|
85
|
+
/**
|
|
86
|
+
* Notify all subscribers about a programmatic form reset.
|
|
87
|
+
* Called from useFormContext when reset() is invoked.
|
|
88
|
+
*/
|
|
89
|
+
notify: () => void;
|
|
90
|
+
};
|
|
91
|
+
/** Function to update if the form can currently be submitted */
|
|
92
|
+
preventSubmit: (prevent: boolean) => void;
|
|
93
|
+
/** Setter to enable or disable form debug mode */
|
|
94
|
+
setDebugMode: (debugMode: DebugMode) => void;
|
|
95
|
+
/** Function to trigger form submit programmatically */
|
|
96
|
+
triggerSubmit: (e?: BaseSyntheticEvent) => Promise<void> | void;
|
|
97
|
+
/** User change tracking (user input only, not programmatic changes) */
|
|
98
|
+
userChange: {
|
|
99
|
+
/**
|
|
100
|
+
* Subscribe to user field changes.
|
|
101
|
+
* Returns an unsubscribe function.
|
|
102
|
+
*/
|
|
103
|
+
subscribe: (listener: UserChangeListener) => () => void;
|
|
104
|
+
/**
|
|
105
|
+
* Notify all subscribers about a user field change.
|
|
106
|
+
* Called from useController when user interacts with a field.
|
|
107
|
+
*/
|
|
108
|
+
notify: (fieldName: string, value: unknown) => void;
|
|
109
|
+
};
|
|
110
|
+
/** Form validation configuration */
|
|
111
|
+
validation: {
|
|
112
|
+
/** Base validation schema instance (without client validation) */
|
|
113
|
+
baseInstance?: VetoInstance;
|
|
114
|
+
/** Veto validation schema instance for form validation */
|
|
115
|
+
instance?: VetoInstance;
|
|
116
|
+
/** Current validation errors in form */
|
|
117
|
+
errors?: VetoFormattedError;
|
|
118
|
+
/** Function to set client validation schema for a specific key */
|
|
119
|
+
setClientValidationSchema: (key: string, schema: VetoTypeAny | null) => void;
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
declare const UniformContext: React.Context<UniformContextType>;
|
|
123
|
+
export { UniformContext as n, DebugModeSettings as t };
|
|
124
|
+
//# sourceMappingURL=FormContext-BnNJYZOo.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormContext-BnNJYZOo.d.mts","names":[],"sources":["../src/Form/subcomponents/FormContext.tsx"],"mappings":";;;KA8BK;UAEY;;EAEf;;EAEA;;;KAIU;;;;KAKA,mBAAmB,yCAC7B,WAAW,KAAK,eAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UA+DQ;;EAER,WAAW;;EAEX,oBAAoB;;EAEpB;;;;;IAKE,YAAY,UAAU;;;;;IAKtB;;;EAGF,gBAAgB;;EAEhB,eAAe,WAAW;;EAE1B,gBAAgB,IAAI,uBAAuB;;EAE3C;;;;;IAKE,YAAY,UAAU;;;;;IAKtB,SAAS,mBAAmB;;;EAG9B;;IAEE,eAAe;;IAEf,WAAW;;IAEX,SAAS;;IAET,4BACE,aACA,QAAQ;;;cAyDD,gBACa,MAAM,QAAQ"}
|
package/dist/Grid/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
//#region src/Grid/Grid.d.ts
|
|
3
2
|
interface GridProps {
|
|
4
3
|
/** child components */
|
|
5
4
|
children?: ReactNode;
|
|
@@ -12,6 +11,5 @@ interface GridProps {
|
|
|
12
11
|
* Defines the default grid for form components
|
|
13
12
|
*/
|
|
14
13
|
declare const Grid: ({ children, className, testId }: GridProps) => import("react").JSX.Element;
|
|
15
|
-
//#endregion
|
|
16
14
|
export { type GridProps, Grid as default };
|
|
17
15
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Grid/Grid.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Grid/Grid.tsx"],"mappings":";UAIiB;;EAEf,WAAW;;EAEX;;EAEA;;;;;cAMI,SAAQ,UAAA,WAAA,UAIX,8BAAS,IAAA"}
|
package/dist/Grid/index.mjs
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { Grid_default as default };
|
|
1
|
+
export { t as default } from "../Grid-Us2JFczS.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "@fuf-stack/pixel-utils";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/Grid/Grid.tsx
|
|
4
4
|
/**
|
|
5
5
|
* Defines the default grid for form components
|
|
6
6
|
*/
|
|
@@ -11,10 +11,8 @@ const Grid = ({ children = null, className = void 0, testId = void 0 }) => {
|
|
|
11
11
|
children
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
//#region src/Grid/index.ts
|
|
14
|
+
// src/Grid/index.ts
|
|
16
15
|
var Grid_default = Grid;
|
|
17
|
-
//#endregion
|
|
18
16
|
export { Grid_default as t };
|
|
19
17
|
|
|
20
|
-
//# sourceMappingURL=Grid-
|
|
18
|
+
//# sourceMappingURL=Grid-Us2JFczS.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid-
|
|
1
|
+
{"version":3,"file":"Grid-Us2JFczS.mjs","names":[],"sources":["../src/Grid/Grid.tsx","../src/Grid/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nexport interface GridProps {\n /** child components */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\n/**\n * Defines the default grid for form components\n */\nconst Grid = ({\n children = null,\n className = undefined,\n testId = undefined,\n}: GridProps) => {\n return (\n <div className={cn('grid gap-6', className)} data-testid={testId}>\n {children}\n </div>\n );\n};\n\nexport default Grid;\n","import Grid from './Grid';\n\nexport type { GridProps } from './Grid';\n\nexport default Grid;\n"],"mappings":";;;;;;AAgBA,MAAM,QAAQ,EACZ,WAAW,MACX,YAAY,KAAA,GACZ,SAAS,KAAA,QACM;CACf,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,cAAc,SAAS;EAAG,eAAa;EACvD;CACE,CAAA;AAET;;ACtBA,IAAA,eAAe"}
|
package/dist/Input/index.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { t as InputValueTransform } from "../useInputValueTransform-
|
|
1
|
+
import { t as InputValueTransform } from "../useInputValueTransform-cevZBrIN.mjs";
|
|
2
2
|
import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
|
|
3
3
|
import { ReactNode } from "react";
|
|
4
|
-
//#region src/Input/Input.d.ts
|
|
5
4
|
declare const inputVariants: ((props?: ({
|
|
6
5
|
[x: string]: string | number | undefined;
|
|
7
6
|
[x: number]: string | number | undefined;
|
|
@@ -632,41 +631,44 @@ declare const inputVariants: ((props?: ({
|
|
|
632
631
|
type VariantProps = TVProps<typeof inputVariants>;
|
|
633
632
|
type ClassName = TVClassName<typeof inputVariants>;
|
|
634
633
|
interface InputProps extends VariantProps {
|
|
635
|
-
/**
|
|
634
|
+
/** Overrides the accessible name, otherwise derived from the field name when no visible label exists */
|
|
636
635
|
ariaLabel?: string;
|
|
637
|
-
/** CSS
|
|
636
|
+
/** Applies CSS classes to the input slots */
|
|
638
637
|
className?: ClassName;
|
|
639
|
-
/**
|
|
638
|
+
/** Shows a clear button when the input has a value */
|
|
640
639
|
clearable?: boolean;
|
|
641
|
-
/**
|
|
640
|
+
/** Sets the delay in milliseconds before updating form state (default: 300) */
|
|
642
641
|
debounceDelay?: number;
|
|
643
|
-
/**
|
|
642
|
+
/** Disables the input */
|
|
644
643
|
disabled?: boolean;
|
|
645
|
-
/**
|
|
644
|
+
/** Displays content at the end of the input */
|
|
646
645
|
endContent?: ReactNode;
|
|
647
|
-
/**
|
|
646
|
+
/** Hides the visibility toggle for password inputs (default: false) */
|
|
647
|
+
hidePasswordToggle?: boolean;
|
|
648
|
+
/** Sets the field label */
|
|
648
649
|
label?: ReactNode;
|
|
649
|
-
/**
|
|
650
|
+
/** Identifies the field in form state */
|
|
650
651
|
name: string;
|
|
651
|
-
/**
|
|
652
|
+
/** Callback invoked when the input value is cleared */
|
|
652
653
|
onClear?: () => void;
|
|
653
|
-
/**
|
|
654
|
+
/** Sets the placeholder text */
|
|
654
655
|
placeholder?: string;
|
|
655
|
-
/**
|
|
656
|
+
/** Redacts the value from Uniform debug output; password inputs are always redacted */
|
|
657
|
+
sensitive?: boolean;
|
|
658
|
+
/** Sets the input size */
|
|
656
659
|
size?: 'sm' | 'md' | 'lg';
|
|
657
|
-
/** content
|
|
660
|
+
/** Displays content at the start of the input */
|
|
658
661
|
startContent?: ReactNode;
|
|
659
|
-
/** HTML data-testid attribute
|
|
662
|
+
/** Sets the HTML data-testid attribute for e2e tests */
|
|
660
663
|
testId?: string;
|
|
661
|
-
/**
|
|
664
|
+
/** Converts between display and form values */
|
|
662
665
|
transform?: InputValueTransform<string>;
|
|
663
|
-
/** input type */
|
|
666
|
+
/** Sets the input type */
|
|
664
667
|
type?: 'number' | 'password';
|
|
665
668
|
}
|
|
666
669
|
/**
|
|
667
670
|
* Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)
|
|
668
671
|
*/
|
|
669
|
-
declare const Input: ({ className: _className, clearable, debounceDelay, endContent, name, onClear, placeholder, size, startContent, type, ...uniformFieldProps }: InputProps) => import("react").JSX.Element;
|
|
670
|
-
//#endregion
|
|
672
|
+
declare const Input: ({ className: _className, clearable, debounceDelay, endContent, name, onClear, placeholder, hidePasswordToggle, size, startContent, type, ...uniformFieldProps }: InputProps) => import("react").JSX.Element;
|
|
671
673
|
export { type InputProps, Input as default };
|
|
672
674
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Input/Input.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/Input/Input.tsx"],"mappings":";;;cAea,iBAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAarB,eAAe,eAAe;KAC9B,YAAY,mBAAmB;UAEnB,mBAAmB;;EAElC;;EAEA,YAAY;;EAEZ;;EAEA;;EAEA;;EAEA,aAAa;;EAEb;;EAEA,QAAQ;;EAER;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA,eAAe;;EAEf;;EAEA,YAAY;;EAEZ;;;;;cAMI,UAAS,WAAA,YAAA,WAAA,eAAA,YAAA,MAAA,SAAA,aAAA,oBAAA,MAAA,cAAA,SAAA,qBAaZ,+BAAU,IAAA"}
|
package/dist/Input/index.mjs
CHANGED
|
@@ -1,10 +1,94 @@
|
|
|
1
1
|
import { useUniformField } from "../hooks/useUniformField/index.mjs";
|
|
2
|
+
import { useWatchFormReset } from "../hooks/useWatchFormReset/index.mjs";
|
|
2
3
|
import { useInputValueDebounce } from "../hooks/useInputValueDebounce/index.mjs";
|
|
3
|
-
import { tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
4
|
-
import {
|
|
4
|
+
import { cn, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
|
|
5
|
+
import { forwardRef, useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { FaEye, FaEyeSlash, FaXmark } from "react-icons/fa6";
|
|
5
8
|
import { Input } from "@heroui/input";
|
|
6
9
|
import { NumberInput } from "@heroui/number-input";
|
|
7
|
-
|
|
10
|
+
// src/Input/InputPassword.tsx
|
|
11
|
+
/** Keeps password presentation separate from form registration and validation. */
|
|
12
|
+
const InputPassword = forwardRef(({ classNames = void 0, clearable, endContent = void 0, isDisabled = false, name, onClear, onKeyDown = void 0, hidePasswordToggle, testId, value, ...inputProps }, ref) => {
|
|
13
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
14
|
+
const [previousPasswordField, setPreviousPasswordField] = useState({
|
|
15
|
+
name,
|
|
16
|
+
hidePasswordToggle
|
|
17
|
+
});
|
|
18
|
+
if (previousPasswordField.name !== name || previousPasswordField.hidePasswordToggle !== hidePasswordToggle) {
|
|
19
|
+
setPreviousPasswordField({
|
|
20
|
+
name,
|
|
21
|
+
hidePasswordToggle
|
|
22
|
+
});
|
|
23
|
+
setIsPasswordVisible(false);
|
|
24
|
+
}
|
|
25
|
+
useWatchFormReset({ onReset: () => {
|
|
26
|
+
setIsPasswordVisible(false);
|
|
27
|
+
} });
|
|
28
|
+
const clearValue = () => {
|
|
29
|
+
onClear();
|
|
30
|
+
setIsPasswordVisible(false);
|
|
31
|
+
};
|
|
32
|
+
const passwordEndContent = !hidePasswordToggle ? /* @__PURE__ */ jsxs("span", {
|
|
33
|
+
className: "inline-flex shrink-0 items-center gap-2",
|
|
34
|
+
children: [
|
|
35
|
+
endContent,
|
|
36
|
+
clearable && !!value ? /* @__PURE__ */ jsx("button", {
|
|
37
|
+
"aria-label": "clear input",
|
|
38
|
+
className: cn("rounded-sm p-1 text-default-400 outline-none focus-visible:ring-2 focus-visible:ring-focus", classNames?.clearButton),
|
|
39
|
+
disabled: isDisabled,
|
|
40
|
+
onClick: clearValue,
|
|
41
|
+
onMouseDown: (event) => {
|
|
42
|
+
event.preventDefault();
|
|
43
|
+
},
|
|
44
|
+
type: "button",
|
|
45
|
+
children: /* @__PURE__ */ jsx(FaXmark, { "aria-hidden": "true" })
|
|
46
|
+
}) : null,
|
|
47
|
+
/* @__PURE__ */ jsx("button", {
|
|
48
|
+
"aria-controls": testId,
|
|
49
|
+
"aria-label": isPasswordVisible ? "Hide password" : "Show password",
|
|
50
|
+
"aria-pressed": isPasswordVisible,
|
|
51
|
+
className: "rounded-sm p-1 text-default-400 outline-none focus-visible:ring-2 focus-visible:ring-focus",
|
|
52
|
+
"data-testid": `${testId}_password_toggle`,
|
|
53
|
+
disabled: isDisabled,
|
|
54
|
+
onClick: () => {
|
|
55
|
+
setIsPasswordVisible((visible) => {
|
|
56
|
+
return !visible;
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
onMouseDown: (event) => {
|
|
60
|
+
event.preventDefault();
|
|
61
|
+
},
|
|
62
|
+
type: "button",
|
|
63
|
+
children: isPasswordVisible ? /* @__PURE__ */ jsx(FaEyeSlash, { "aria-hidden": "true" }) : /* @__PURE__ */ jsx(FaEye, { "aria-hidden": "true" })
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
}) : endContent;
|
|
67
|
+
const clearableProps = clearable && hidePasswordToggle ? {
|
|
68
|
+
isClearable: true,
|
|
69
|
+
onClear: clearValue
|
|
70
|
+
} : {};
|
|
71
|
+
return /* @__PURE__ */ jsx(Input, {
|
|
72
|
+
...inputProps,
|
|
73
|
+
...clearableProps,
|
|
74
|
+
ref,
|
|
75
|
+
classNames,
|
|
76
|
+
endContent: passwordEndContent,
|
|
77
|
+
isDisabled,
|
|
78
|
+
name,
|
|
79
|
+
onKeyDown: !hidePasswordToggle && clearable ? (event) => {
|
|
80
|
+
onKeyDown?.(event);
|
|
81
|
+
if (!event.defaultPrevented && event.key === "Escape" && value && !isDisabled) {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
clearValue();
|
|
84
|
+
}
|
|
85
|
+
} : onKeyDown,
|
|
86
|
+
type: !hidePasswordToggle && isPasswordVisible ? "text" : "password",
|
|
87
|
+
value
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
InputPassword.displayName = "InputPassword";
|
|
91
|
+
// src/Input/Input.tsx
|
|
8
92
|
const inputVariants = tv({ slots: {
|
|
9
93
|
/** wrapper around the whole input */
|
|
10
94
|
base: "",
|
|
@@ -18,7 +102,7 @@ const inputVariants = tv({ slots: {
|
|
|
18
102
|
/**
|
|
19
103
|
* Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)
|
|
20
104
|
*/
|
|
21
|
-
const Input$1 = ({ className: _className = void 0, clearable = false, debounceDelay = 300, endContent = void 0, name, onClear = void 0, placeholder = " ", size = void 0, startContent = void 0, type = void 0, ...uniformFieldProps }) => {
|
|
105
|
+
const Input$1 = ({ className: _className = void 0, clearable = false, debounceDelay = 300, endContent = void 0, name, onClear = void 0, placeholder = " ", hidePasswordToggle = false, size = void 0, startContent = void 0, type = void 0, ...uniformFieldProps }) => {
|
|
22
106
|
const { ariaLabel, disabled, field: { onChange: fieldOnChange, onBlur: fieldOnBlur, value: fieldValue, ref }, errorMessage, invalid, label, required, testId, resetField } = useUniformField({
|
|
23
107
|
name,
|
|
24
108
|
type,
|
|
@@ -31,12 +115,13 @@ const Input$1 = ({ className: _className = void 0, clearable = false, debounceDe
|
|
|
31
115
|
onChange: fieldOnChange,
|
|
32
116
|
value: fieldValue
|
|
33
117
|
});
|
|
118
|
+
const clearValue = () => {
|
|
119
|
+
resetField(name, { defaultValue: null });
|
|
120
|
+
onClear?.();
|
|
121
|
+
};
|
|
34
122
|
const clearableProps = clearable ? {
|
|
35
123
|
isClearable: true,
|
|
36
|
-
onClear:
|
|
37
|
-
resetField(name, { defaultValue: null });
|
|
38
|
-
if (onClear) onClear();
|
|
39
|
-
}
|
|
124
|
+
onClear: clearValue
|
|
40
125
|
} : {};
|
|
41
126
|
const variants = inputVariants();
|
|
42
127
|
const classNames = variantsToClassNames(variants, _className, "base");
|
|
@@ -66,13 +151,13 @@ const Input$1 = ({ className: _className = void 0, clearable = false, debounceDe
|
|
|
66
151
|
radius: "sm",
|
|
67
152
|
size,
|
|
68
153
|
startContent,
|
|
69
|
-
variant: "bordered"
|
|
70
|
-
...clearableProps
|
|
154
|
+
variant: "bordered"
|
|
71
155
|
};
|
|
72
156
|
if (type === "number") {
|
|
73
157
|
const numberValue = value !== "" && value != null && !Number.isNaN(Number(value)) ? Number(value) : null;
|
|
74
158
|
return /* @__PURE__ */ jsx(NumberInput, {
|
|
75
159
|
...commonProps,
|
|
160
|
+
...clearableProps,
|
|
76
161
|
formatOptions: { useGrouping: false },
|
|
77
162
|
onChange: (e) => {
|
|
78
163
|
if (typeof e === "number") onChange({ target: { value: String(e) } });
|
|
@@ -81,17 +166,25 @@ const Input$1 = ({ className: _className = void 0, clearable = false, debounceDe
|
|
|
81
166
|
value: numberValue
|
|
82
167
|
});
|
|
83
168
|
}
|
|
169
|
+
if (type === "password") return /* @__PURE__ */ jsx(InputPassword, {
|
|
170
|
+
...commonProps,
|
|
171
|
+
clearable,
|
|
172
|
+
hidePasswordToggle,
|
|
173
|
+
onChange,
|
|
174
|
+
onClear: clearValue,
|
|
175
|
+
testId,
|
|
176
|
+
value
|
|
177
|
+
});
|
|
84
178
|
return /* @__PURE__ */ jsx(Input, {
|
|
85
179
|
...commonProps,
|
|
180
|
+
...clearableProps,
|
|
86
181
|
onChange,
|
|
87
182
|
type,
|
|
88
183
|
value
|
|
89
184
|
});
|
|
90
185
|
};
|
|
91
|
-
|
|
92
|
-
//#region src/Input/index.ts
|
|
186
|
+
// src/Input/index.ts
|
|
93
187
|
var Input_default = Input$1;
|
|
94
|
-
//#endregion
|
|
95
188
|
export { Input_default as default };
|
|
96
189
|
|
|
97
190
|
//# sourceMappingURL=index.mjs.map
|
package/dist/Input/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["Input","HeroNumberInput","HeroInput","Input"],"sources":["../../src/Input/Input.tsx","../../src/Input/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { InputProps as HeroInputProps } from '@heroui/input';\nimport type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport { Input as HeroInput } from '@heroui/input';\nimport { NumberInput as HeroNumberInput } from '@heroui/number-input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport { useUniformField } from '../hooks/useUniformField';\n\n// input variants\nexport const inputVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n});\n\ntype VariantProps = TVProps<typeof inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface InputProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** shows clear button when input has value */\n clearable?: boolean;\n /** debounce delay in milliseconds for form state updates (default: 300ms) */\n debounceDelay?: number;\n /** input field is disabled */\n disabled?: boolean;\n /** added content to the end of the input Field. */\n endContent?: ReactNode;\n /** form field label */\n label?: ReactNode;\n /** form field name */\n name: string;\n /** callback that is fired when the value is cleared */\n onClear?: () => void;\n /** form field placeholder */\n placeholder?: string;\n /** size of the input */\n size?: 'sm' | 'md' | 'lg';\n /** content added to the start of the input field */\n startContent?: ReactNode;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** allows disentangled display and form values for a field */\n transform?: InputValueTransform<string>;\n /** input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className: _className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n name,\n onClear = undefined,\n placeholder = ' ',\n size = undefined,\n startContent = undefined,\n type = undefined,\n ...uniformFieldProps\n}: InputProps) => {\n const {\n ariaLabel,\n disabled,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n errorMessage,\n invalid,\n label,\n required,\n testId,\n resetField,\n } = useUniformField({ name, type, ...uniformFieldProps });\n\n // Use hook that provides debounced onChange and enhanced blur handling\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n name,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n // If input is clearable add props for clearing input value\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable\n ? {\n isClearable: true,\n onClear: () => {\n // if field had initial value we do not reset it\n // to that value, but clear it instead\n resetField(name, { defaultValue: null });\n // if onClear cb provided we call it\n if (onClear) {\n onClear();\n }\n },\n }\n : {};\n\n // classNames from slots\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n // Common props for both Input and NumberInput\n const commonProps = {\n ref,\n // Only add aria-label if there's no meaningful placeholder (HeroUI uses placeholder as aria-label)\n 'aria-label':\n !placeholder || placeholder.trim() === '' ? ariaLabel : undefined,\n // disable autocomplete\n autoComplete: 'off',\n classNames: {\n base: classNames.base,\n clearButton: classNames.clearButton,\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n },\n 'data-testid': testId,\n endContent,\n errorMessage,\n id: testId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside' as const,\n name,\n onBlur,\n placeholder,\n radius: 'sm' as const,\n size,\n startContent,\n variant: 'bordered' as const,\n ...clearableProps,\n };\n\n // Render NumberInput for number type\n if (type === 'number') {\n // Parse the string value to number - use null for empty/cleared state to keep component controlled\n const numberValue =\n value !== '' && value != null && !Number.isNaN(Number(value))\n ? Number(value)\n : null;\n\n return (\n <HeroNumberInput\n {...commonProps}\n // Disable thousands separator to avoid parsing issues\n formatOptions={{\n useGrouping: false,\n }}\n // NumberInput onChange receives either an event or a number\n onChange={(e: React.ChangeEvent<HTMLInputElement> | number) => {\n if (typeof e === 'number') {\n // Convert number to synthetic event and pass through debounced onChange\n onChange({\n target: { value: String(e) },\n });\n } else {\n // Pass event through debounced onChange\n onChange(e);\n }\n }}\n // @ts-expect-error - HeroUI NumberInput type is not compatible with null,\n // but it needs to be for empty/cleared state to be controlled\n value={numberValue}\n />\n );\n }\n\n // Render regular Input for text/password\n return (\n <HeroInput {...commonProps} onChange={onChange} type={type} value={value} />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nex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AAC,IACxD,OAAO,KAAK,IACZ;EAEN,OACE,oBAACC,aAAD;GACE,GAAI;GAEJ,eAAe,EACb,aAAa,MACf;GAEA,WAAW,MAAoD;IAC7D,IAAI,OAAO,MAAM,UAEf,SAAS,EACP,QAAQ,EAAE,OAAO,OAAO,CAAC,EAAE,EAC7B,CAAC;SAGD,SAAS,CAAC;GAEd;GAGA,OAAO;EACR,CAAA;CAEL;CAGA,OACE,oBAACC,OAAD;EAAW,GAAI;EAAuB;EAAgB;EAAa;CAAQ,CAAA;AAE/E;;;ACnMA,IAAA,gBAAeC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["HeroInput","Input","HeroNumberInput","HeroInput","Input"],"sources":["../../src/Input/InputPassword.tsx","../../src/Input/Input.tsx","../../src/Input/index.ts"],"sourcesContent":["import type { InputProps as HeroInputProps } from '@heroui/input';\n\nimport { forwardRef, useState } from 'react';\nimport { FaEye, FaEyeSlash, FaXmark } from 'react-icons/fa6';\n\nimport { Input as HeroInput } from '@heroui/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { useWatchFormReset } from '../hooks/useWatchFormReset';\n\ninterface InputPasswordProps extends Omit<\n HeroInputProps,\n 'type' | 'value' | 'name' | 'isClearable' | 'onClear'\n> {\n clearable: boolean;\n hidePasswordToggle: boolean;\n name: string;\n onClear: () => void;\n testId: string;\n value: string;\n}\n\n/** Keeps password presentation separate from form registration and validation. */\nconst InputPassword = forwardRef<HTMLInputElement, InputPasswordProps>(\n (\n {\n classNames = undefined,\n clearable,\n endContent = undefined,\n isDisabled = false,\n name,\n onClear,\n onKeyDown = undefined,\n hidePasswordToggle,\n testId,\n value,\n ...inputProps\n },\n ref,\n ) => {\n const [isPasswordVisible, setIsPasswordVisible] = useState(false);\n\n // Reset visibility before rendering a reused field with new props.\n // Switching away from type=password unmounts this component altogether.\n const [previousPasswordField, setPreviousPasswordField] = useState({\n name,\n hidePasswordToggle,\n });\n if (\n previousPasswordField.name !== name ||\n previousPasswordField.hidePasswordToggle !== hidePasswordToggle\n ) {\n setPreviousPasswordField({ name, hidePasswordToggle });\n setIsPasswordVisible(false);\n }\n useWatchFormReset({\n onReset: () => {\n setIsPasswordVisible(false);\n },\n });\n\n const clearValue = () => {\n onClear();\n setIsPasswordVisible(false);\n };\n\n // HeroUI wraps endContent inside its clear button. Keep clear and reveal as\n // sibling buttons so custom content and the toggle never become nested buttons.\n const passwordEndContent = !hidePasswordToggle ? (\n <span className=\"inline-flex shrink-0 items-center gap-2\">\n {endContent}\n {clearable && !!value ? (\n <button\n aria-label=\"clear input\"\n className={cn(\n 'rounded-sm p-1 text-default-400 outline-none focus-visible:ring-2 focus-visible:ring-focus',\n classNames?.clearButton,\n )}\n disabled={isDisabled}\n onClick={clearValue}\n onMouseDown={(event) => {\n event.preventDefault();\n }}\n type=\"button\"\n >\n <FaXmark aria-hidden=\"true\" />\n </button>\n ) : null}\n <button\n aria-controls={testId}\n aria-label={isPasswordVisible ? 'Hide password' : 'Show password'}\n aria-pressed={isPasswordVisible}\n className=\"rounded-sm p-1 text-default-400 outline-none focus-visible:ring-2 focus-visible:ring-focus\"\n data-testid={`${testId}_password_toggle`}\n disabled={isDisabled}\n onClick={() => {\n setIsPasswordVisible((visible) => {\n return !visible;\n });\n }}\n // Preserve input focus for pointer activation and normal keyboard focus.\n onMouseDown={(event) => {\n event.preventDefault();\n }}\n type=\"button\"\n >\n {isPasswordVisible ? (\n <FaEyeSlash aria-hidden=\"true\" />\n ) : (\n <FaEye aria-hidden=\"true\" />\n )}\n </button>\n </span>\n ) : (\n endContent\n );\n\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable && hidePasswordToggle\n ? { isClearable: true, onClear: clearValue }\n : {};\n\n return (\n <HeroInput\n {...inputProps}\n {...clearableProps}\n ref={ref}\n classNames={classNames}\n endContent={passwordEndContent}\n isDisabled={isDisabled}\n name={name}\n onKeyDown={\n !hidePasswordToggle && clearable\n ? (event) => {\n onKeyDown?.(event);\n if (\n !event.defaultPrevented &&\n event.key === 'Escape' &&\n value &&\n !isDisabled\n ) {\n event.preventDefault();\n clearValue();\n }\n }\n : onKeyDown\n }\n type={!hidePasswordToggle && isPasswordVisible ? 'text' : 'password'}\n value={value}\n />\n );\n },\n);\n\nInputPassword.displayName = 'InputPassword';\n\nexport default InputPassword;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { InputProps as HeroInputProps } from '@heroui/input';\nimport type { ReactNode } from 'react';\nimport type { InputValueTransform } from '../hooks/useInputValueTransform';\n\nimport { Input as HeroInput } from '@heroui/input';\nimport { NumberInput as HeroNumberInput } from '@heroui/number-input';\n\nimport { tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useInputValueDebounce } from '../hooks/useInputValueDebounce';\nimport { useUniformField } from '../hooks/useUniformField';\nimport InputPassword from './InputPassword';\n\n// input variants\nexport const inputVariants = tv({\n slots: {\n /** wrapper around the whole input */\n base: '',\n /** clear button */\n clearButton: '',\n /** actual input element */\n input: '',\n /** inner wrapper (HeroUI inputWrapper slot) */\n inputWrapper: 'bg-content1 group-data-[focus=true]:border-focus',\n },\n});\n\ntype VariantProps = TVProps<typeof inputVariants>;\ntype ClassName = TVClassName<typeof inputVariants>;\n\nexport interface InputProps extends VariantProps {\n /** Overrides the accessible name, otherwise derived from the field name when no visible label exists */\n ariaLabel?: string;\n /** Applies CSS classes to the input slots */\n className?: ClassName;\n /** Shows a clear button when the input has a value */\n clearable?: boolean;\n /** Sets the delay in milliseconds before updating form state (default: 300) */\n debounceDelay?: number;\n /** Disables the input */\n disabled?: boolean;\n /** Displays content at the end of the input */\n endContent?: ReactNode;\n /** Hides the visibility toggle for password inputs (default: false) */\n hidePasswordToggle?: boolean;\n /** Sets the field label */\n label?: ReactNode;\n /** Identifies the field in form state */\n name: string;\n /** Callback invoked when the input value is cleared */\n onClear?: () => void;\n /** Sets the placeholder text */\n placeholder?: string;\n /** Redacts the value from Uniform debug output; password inputs are always redacted */\n sensitive?: boolean;\n /** Sets the input size */\n size?: 'sm' | 'md' | 'lg';\n /** Displays content at the start of the input */\n startContent?: ReactNode;\n /** Sets the HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Converts between display and form values */\n transform?: InputValueTransform<string>;\n /** Sets the input type */\n type?: 'number' | 'password';\n}\n\n/**\n * Input component based on [HeroUI Input](https://www.heroui.com//docs/components/input)\n */\nconst Input = ({\n className: _className = undefined,\n clearable = false,\n debounceDelay = 300,\n endContent = undefined,\n name,\n onClear = undefined,\n placeholder = ' ',\n hidePasswordToggle = false,\n size = undefined,\n startContent = undefined,\n type = undefined,\n ...uniformFieldProps\n}: InputProps) => {\n const {\n ariaLabel,\n disabled,\n field: {\n onChange: fieldOnChange,\n onBlur: fieldOnBlur,\n value: fieldValue,\n ref,\n },\n errorMessage,\n invalid,\n label,\n required,\n testId,\n resetField,\n } = useUniformField({ name, type, ...uniformFieldProps });\n\n // Use hook that provides debounced onChange and enhanced blur handling\n const { onChange, onBlur, value } = useInputValueDebounce({\n debounceDelay,\n name,\n onBlur: fieldOnBlur,\n onChange: fieldOnChange,\n value: fieldValue,\n });\n\n const clearValue = () => {\n // Clear initial values too, rather than restoring the default value.\n resetField(name, { defaultValue: null });\n onClear?.();\n };\n\n const clearableProps: Pick<HeroInputProps, 'isClearable' | 'onClear'> =\n clearable ? { isClearable: true, onClear: clearValue } : {};\n\n const variants = inputVariants();\n const classNames = variantsToClassNames(variants, _className, 'base');\n\n // Common props for both Input and NumberInput\n const commonProps = {\n ref,\n // Only add aria-label if there's no meaningful placeholder (HeroUI uses placeholder as aria-label)\n 'aria-label':\n !placeholder || placeholder.trim() === '' ? ariaLabel : undefined,\n // disable autocomplete\n autoComplete: 'off',\n classNames: {\n base: classNames.base,\n clearButton: classNames.clearButton,\n // set padding to 0 for error message exit animation\n helperWrapper: 'p-0',\n input: classNames.input,\n inputWrapper: classNames.inputWrapper,\n },\n 'data-testid': testId,\n endContent,\n errorMessage,\n id: testId,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n label,\n labelPlacement: 'outside' as const,\n name,\n onBlur,\n placeholder,\n radius: 'sm' as const,\n size,\n startContent,\n variant: 'bordered' as const,\n };\n\n // Render NumberInput for number type\n if (type === 'number') {\n // Parse the string value to number - use null for empty/cleared state to keep component controlled\n const numberValue =\n value !== '' && value != null && !Number.isNaN(Number(value))\n ? Number(value)\n : null;\n\n return (\n <HeroNumberInput\n {...commonProps}\n {...clearableProps}\n // Disable thousands separator to avoid parsing issues\n formatOptions={{\n useGrouping: false,\n }}\n // NumberInput onChange receives either an event or a number\n onChange={(e: React.ChangeEvent<HTMLInputElement> | number) => {\n if (typeof e === 'number') {\n // Convert number to synthetic event and pass through debounced onChange\n onChange({\n target: { value: String(e) },\n });\n } else {\n // Pass event through debounced onChange\n onChange(e);\n }\n }}\n // @ts-expect-error - HeroUI NumberInput type is not compatible with null,\n // but it needs to be for empty/cleared state to be controlled\n value={numberValue}\n />\n );\n }\n\n if (type === 'password') {\n return (\n <InputPassword\n {...commonProps}\n clearable={clearable}\n hidePasswordToggle={hidePasswordToggle}\n onChange={onChange}\n onClear={clearValue}\n testId={testId}\n value={value}\n />\n );\n }\n\n return (\n <HeroInput\n {...commonProps}\n {...clearableProps}\n onChange={onChange}\n type={type}\n value={value}\n />\n );\n};\n\nexport default Input;\n","import Input from './Input';\n\nexport type { InputProps } from './Input';\n\nexport default Input;\n"],"mappings":";;;;;;;;;;;AAwBA,MAAM,gBAAgB,YAElB,EACE,aAAa,KAAA,GACb,WACA,aAAa,KAAA,GACb,aAAa,OACb,MACA,SACA,YAAY,KAAA,GACZ,oBACA,QACA,OACA,GAAG,cAEL,QACG;CACH,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,KAAK;CAIhE,MAAM,CAAC,uBAAuB,4BAA4B,SAAS;EACjE;EACA;CACF,CAAC;CACD,IACE,sBAAsB,SAAS,QAC/B,sBAAsB,uBAAuB,oBAC7C;EACA,yBAAyB;GAAE;GAAM;EAAmB,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ACxD,OAAO,KAAK,IACZ;EAEN,OACE,oBAACC,aAAD;GACE,GAAI;GACJ,GAAI;GAEJ,eAAe,EACb,aAAa,MACf;GAEA,WAAW,MAAoD;IAC7D,IAAI,OAAO,MAAM,UAEf,SAAS,EACP,QAAQ,EAAE,OAAO,OAAO,CAAC,EAAE,EAC7B,CAAC;SAGD,SAAS,CAAC;GAEd;GAGA,OAAO;EACR,CAAA;CAEL;CAEA,IAAI,SAAS,YACX,OACE,oBAAC,eAAD;EACE,GAAI;EACO;EACS;EACV;EACV,SAAS;EACD;EACD;CACR,CAAA;CAIL,OACE,oBAACC,OAAD;EACE,GAAI;EACJ,GAAI;EACM;EACJ;EACC;CACR,CAAA;AAEL;;ACnNA,IAAA,gBAAeC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { TVClassName, TVProps } from "@fuf-stack/pixel-utils";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import "@heroui/radio";
|
|
4
|
-
//#region src/RadioBoxes/RadioBoxes.d.ts
|
|
5
4
|
declare const radioBoxesVariants: ((props?: ({
|
|
6
5
|
[x: string]: string | number | undefined;
|
|
7
6
|
[x: number]: string | number | undefined;
|
|
@@ -1104,10 +1103,10 @@ interface RadioBoxOption {
|
|
|
1104
1103
|
description?: ReactNode;
|
|
1105
1104
|
/** disables the option */
|
|
1106
1105
|
disabled?: boolean;
|
|
1107
|
-
/** option label */
|
|
1108
|
-
label?: ReactNode;
|
|
1109
1106
|
/** option icon */
|
|
1110
1107
|
icon?: ReactNode;
|
|
1108
|
+
/** option label */
|
|
1109
|
+
label?: ReactNode;
|
|
1111
1110
|
/** HTML data-testid attribute of the option */
|
|
1112
1111
|
testId?: string;
|
|
1113
1112
|
/** option value */
|
|
@@ -1135,8 +1134,6 @@ interface RadioBoxesProps extends VariantProps {
|
|
|
1135
1134
|
* RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)
|
|
1136
1135
|
*/
|
|
1137
1136
|
declare const RadioBoxes: ({ className, inline, name, options, ...uniformFieldProps }: RadioBoxesProps) => import("react").JSX.Element;
|
|
1138
|
-
//#endregion
|
|
1139
|
-
//#region src/RadioBoxes/RadioBox.d.ts
|
|
1140
1137
|
export declare const radioBoxVariants: ((props?: ({
|
|
1141
1138
|
isDisabled?: boolean | undefined;
|
|
1142
1139
|
isInvalid?: boolean | undefined;
|
|
@@ -1467,6 +1464,5 @@ export declare const radioBoxVariants: ((props?: ({
|
|
|
1467
1464
|
})))[];
|
|
1468
1465
|
variantKeys: ("isDisabled" | "isInvalid")[];
|
|
1469
1466
|
};
|
|
1470
|
-
//#endregion
|
|
1471
1467
|
export { type RadioBoxOption, type RadioBoxesProps, RadioBoxes as default };
|
|
1472
1468
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/RadioBox.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/RadioBox.tsx"],"mappings":";;;cAaa,sBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
5
|
import { RadioGroup, useRadio } from "@heroui/radio";
|
|
6
6
|
import { VisuallyHidden } from "@react-aria/visually-hidden";
|
|
7
|
-
|
|
7
|
+
// src/RadioBoxes/RadioBox.tsx
|
|
8
8
|
const radioBoxVariants = tv({
|
|
9
9
|
slots: {
|
|
10
10
|
base: "group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-focus",
|
|
@@ -64,8 +64,7 @@ const RadioBox = ({ classNames: _classNames = void 0, icon = void 0, isInvalid =
|
|
|
64
64
|
]
|
|
65
65
|
});
|
|
66
66
|
};
|
|
67
|
-
|
|
68
|
-
//#region src/RadioBoxes/RadioBoxes.tsx
|
|
67
|
+
// src/RadioBoxes/RadioBoxes.tsx
|
|
69
68
|
const radioBoxesVariants = tv({ slots: {
|
|
70
69
|
base: [
|
|
71
70
|
"group",
|
|
@@ -135,10 +134,8 @@ const RadioBoxes = ({ className = void 0, inline = false, name, options, ...unif
|
|
|
135
134
|
})
|
|
136
135
|
});
|
|
137
136
|
};
|
|
138
|
-
|
|
139
|
-
//#region src/RadioBoxes/index.ts
|
|
137
|
+
// src/RadioBoxes/index.ts
|
|
140
138
|
var RadioBoxes_default = RadioBoxes;
|
|
141
|
-
//#endregion
|
|
142
139
|
export { RadioBoxes_default as default, radioBoxVariants };
|
|
143
140
|
|
|
144
141
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["HeroRadioGroup"],"sources":["../../src/RadioBoxes/RadioBox.tsx","../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { RadioProps as HeroRadioProps } from '@heroui/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const radioBoxVariants = tv({\n slots: {\n base: 'group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-focus',\n control: '',\n description: 'text-foreground opacity-70 text-small',\n icon: '',\n label: '',\n labelWrapper: 'grow',\n },\n variants: {\n isDisabled: {\n true: {\n base: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n base: '!border-danger',\n },\n },\n },\n});\n\ntype ClassName = TVClassName<typeof radioBoxVariants>;\n\nexport interface RadioBoxProps extends Omit<HeroRadioProps, 'className'> {\n /** CSS class name */\n className?: ClassName;\n /** icon for the option */\n icon?: ReactNode;\n /** whether the radio is invalid */\n isInvalid?: boolean;\n}\n\nexport const RadioBox = ({\n classNames: _classNames = undefined,\n icon = undefined,\n isInvalid = false,\n ...props\n}: RadioBoxProps) => {\n const {\n children,\n Component,\n description,\n getBaseProps,\n getControlProps,\n getInputProps,\n getLabelProps,\n getLabelWrapperProps,\n getWrapperProps,\n isDisabled,\n } = useRadio(props as HeroRadioProps);\n\n // classNames from slots\n const variants = radioBoxVariants({\n isDisabled,\n isInvalid,\n });\n const classNames = variantsToClassNames(\n variants,\n // @ts-expect-error not sure here, but it works\n _classNames,\n 'base',\n );\n\n return (\n <Component {...getBaseProps()} className={classNames.base}>\n <VisuallyHidden>\n <input {...getInputProps()} />\n </VisuallyHidden>\n {!icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div\n {...getLabelWrapperProps()}\n className={cn(\n getLabelWrapperProps().className,\n classNames.labelWrapper,\n )}\n >\n {children ? (\n <span\n {...getLabelProps()}\n className={cn(getLabelProps().className, classNames.label)}\n >\n {children}\n </span>\n ) : null}\n {description ? (\n <div className={classNames.description}>{description}</div>\n ) : null}\n </div>\n {icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n </Component>\n );\n};\n\nexport default RadioBox;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n//\nimport type { RadioBoxProps } from './RadioBox';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: [\n // Needs group for group-data condition.\n 'group',\n // Match shared field wrapper layout.\n 'flex w-full flex-col',\n // Keep spacing between label/radio boxes consistent.\n 'gap-y-1.5',\n ],\n boxBase: '',\n boxControl: '',\n boxDescription: '',\n boxLabel: '',\n boxLabelWrapper: '',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'mb-2 inline-flex cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioBoxesVariants>;\ntype ClassName = TVClassName<typeof radioBoxesVariants>;\n\nexport interface RadioBoxOption {\n /** Description of the value. Works with variant radioBox. */\n description?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadioBoxesProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioBoxOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst RadioBoxes = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadioBoxesProps) => {\n const {\n ariaLabel,\n errorMessage,\n invalid,\n disabled,\n label,\n field: { onBlur, onChange, ref, value },\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n const boxClassNames: RadioBoxProps['classNames'] = {\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n onValueChange={(newValue) => {\n onChange(convertToOriginalType(newValue));\n }}\n orientation={inline ? 'horizontal' : 'vertical'}\n value={value != null ? String(value) : ''}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId ?? option.value}`,\n { replaceDots: true },\n );\n return (\n <RadioBox\n key={String(option.value)}\n classNames={boxClassNames}\n data-testid={optionTestId}\n description={option.description}\n icon={option.icon}\n isDisabled={!!disabled || option.disabled}\n isInvalid={invalid}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </RadioBox>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default RadioBoxes;\n","import RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps, RadioBoxOption } from './RadioBoxes';\n\nexport { radioBoxVariants } from './RadioBox';\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;AASA,MAAa,mBAAmB,GAAG;CACjC,OAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,OAAO;EACP,cAAc;CAChB;CACA,UAAU;EACR,YAAY,EACV,MAAM,EACJ,MAAM,uCACR,EACF;EACA,WAAW,EACT,MAAM,EACJ,MAAM,iBACR,EACF;CACF;AACF,CAAC;AAaD,MAAa,YAAY,EACvB,YAAY,cAAc,KAAA,GAC1B,OAAO,KAAA,GACP,YAAY,OACZ,GAAG,YACgB;CACnB,MAAM,EACJ,UACA,WACA,aACA,cACA,iBACA,eACA,eACA,sBACA,iBACA,eACE,SAAS,KAAuB;CAGpC,MAAM,WAAW,iBAAiB;EAChC;EACA;CACF,CAAC;CACD,MAAM,aAAa,qBACjB,UAEA,aACA,MACF;CAEA,OACE,qBAAC,WAAD;EAAW,GAAI,aAAa;EAAG,WAAW,WAAW;EAArD,UAAA;GACE,oBAAC,gBAAD,EAAA,UACE,oBAAC,SAAD,EAAO,GAAI,cAAc,EAAI,CAAA,EACf,CAAA;GACf,CAAC,OACA,oBAAC,QAAD;IAAM,GAAI,gBAAgB;IACxB,UAAA,oBAAC,QAAD;KACE,GAAI,gBAAgB;KACpB,WAAW,GAAG,gBAAgB,CAAC,CAAC,WAAW,WAAW,OAAO;IAC9D,CAAA;GACG,CAAA,IACJ;GACH,OAAO,oBAAC,OAAD;IAAK,WAAW,WAAW;IAAO,UAAA;GAAU,CAAA,IAAI;GACxD,qBAAC,OAAD;IACE,GAAI,qBAAqB;IACzB,WAAW,GACT,qBAAqB,CAAC,CAAC,WACvB,WAAW,YACb;IALF,UAAA,CAOG,WACC,oBAAC,QAAD;KACE,GAAI,cAAc;KAClB,WAAW,G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,SAAS,OAAO,OAAO,KAAK,IAAI;EAEtC,UAAA,QAAQ,KAAK,WAAW;GACvB,IAAI,WAAW,QAAQ;IACrB,MAAM,eAAe,QACnB,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,KAAK,CACtB;IACA,OACE,oBAAC,UAAD;KAEE,YAAY;KACZ,eAAa;KACb,aAAa,OAAO;KACpB,MAAM,OAAO;KACb,YAAY,CAAC,CAAC,YAAY,OAAO;KACjC,WAAW;KACX,OAAO,OAAO,OAAO,KAAK;KAEzB,UAAA,OAAO,SAAS,OAAO;IAChB,GAVH,OAAO,OAAO,KAAK,CAUhB;GAEd;GACA,OAAO;EACT,CAAC;CACa,CAAA;AAEpB;;;ACzJA,IAAA,qBAAe"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["HeroRadioGroup"],"sources":["../../src/RadioBoxes/RadioBox.tsx","../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { RadioProps as HeroRadioProps } from '@heroui/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@heroui/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nexport const radioBoxVariants = tv({\n slots: {\n base: 'group inline-flex flex-auto cursor-pointer items-center justify-between gap-4 rounded-lg border-2 border-default p-4 hover:bg-content2 data-[selected=true]:border-focus',\n control: '',\n description: 'text-foreground opacity-70 text-small',\n icon: '',\n label: '',\n labelWrapper: 'grow',\n },\n variants: {\n isDisabled: {\n true: {\n base: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n base: '!border-danger',\n },\n },\n },\n});\n\ntype ClassName = TVClassName<typeof radioBoxVariants>;\n\nexport interface RadioBoxProps extends Omit<HeroRadioProps, 'className'> {\n /** CSS class name */\n className?: ClassName;\n /** icon for the option */\n icon?: ReactNode;\n /** whether the radio is invalid */\n isInvalid?: boolean;\n}\n\nexport const RadioBox = ({\n classNames: _classNames = undefined,\n icon = undefined,\n isInvalid = false,\n ...props\n}: RadioBoxProps) => {\n const {\n children,\n Component,\n description,\n getBaseProps,\n getControlProps,\n getInputProps,\n getLabelProps,\n getLabelWrapperProps,\n getWrapperProps,\n isDisabled,\n } = useRadio(props as HeroRadioProps);\n\n // classNames from slots\n const variants = radioBoxVariants({\n isDisabled,\n isInvalid,\n });\n const classNames = variantsToClassNames(\n variants,\n // @ts-expect-error not sure here, but it works\n _classNames,\n 'base',\n );\n\n return (\n <Component {...getBaseProps()} className={classNames.base}>\n <VisuallyHidden>\n <input {...getInputProps()} />\n </VisuallyHidden>\n {!icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div\n {...getLabelWrapperProps()}\n className={cn(\n getLabelWrapperProps().className,\n classNames.labelWrapper,\n )}\n >\n {children ? (\n <span\n {...getLabelProps()}\n className={cn(getLabelProps().className, classNames.label)}\n >\n {children}\n </span>\n ) : null}\n {description ? (\n <div className={classNames.description}>{description}</div>\n ) : null}\n </div>\n {icon ? (\n <span {...getWrapperProps()}>\n <span\n {...getControlProps()}\n className={cn(getControlProps().className, classNames.control)}\n />\n </span>\n ) : null}\n </Component>\n );\n};\n\nexport default RadioBox;\n","import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n//\nimport type { RadioBoxProps } from './RadioBox';\n\nimport { RadioGroup as HeroRadioGroup } from '@heroui/radio';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { createOptionValueConverter } from '../helpers';\nimport { useUniformField } from '../hooks/useUniformField';\nimport { RadioBox } from './RadioBox';\n\nexport const radioBoxesVariants = tv({\n slots: {\n base: [\n // Needs group for group-data condition.\n 'group',\n // Match shared field wrapper layout.\n 'flex w-full flex-col',\n // Keep spacing between label/radio boxes consistent.\n 'gap-y-1.5',\n ],\n boxBase: '',\n boxControl: '',\n boxDescription: '',\n boxLabel: '',\n boxLabelWrapper: '',\n // see HeroUI styles for group-data condition,\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'mb-2 inline-flex cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioBoxesVariants>;\ntype ClassName = TVClassName<typeof radioBoxesVariants>;\n\nexport interface RadioBoxOption {\n /** Description of the value. Works with variant radioBox. */\n description?: ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option icon */\n icon?: ReactNode;\n /** option label */\n label?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadioBoxesProps extends VariantProps {\n /** Custom aria-label for accessibility. If not provided, falls back to field name when no visible label exists */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Determines if the Buttons are disabled or not. */\n disabled?: boolean;\n /** determines orientation of the Buttons. */\n inline?: boolean;\n /** Label displayed next to the RadioButton. */\n label?: ReactNode;\n /** Name the RadioButtons are registered at in HTML forms (react-hook-form). */\n name: string;\n /** Radio button configuration. */\n options: RadioBoxOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * RadioBoxes component based on [HeroUI RadioGroup](https://www.heroui.com//docs/components/radio-group)\n */\nconst RadioBoxes = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadioBoxesProps) => {\n const {\n ariaLabel,\n errorMessage,\n invalid,\n disabled,\n label,\n field: { onBlur, onChange, ref, value },\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Create converter to preserve number types for option values\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = radioBoxesVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n const boxClassNames: RadioBoxProps['classNames'] = {\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n };\n\n return (\n <HeroRadioGroup\n ref={ref}\n aria-label={ariaLabel}\n classNames={classNames}\n // see HeroUI styles for group-data condition (data-invalid),\n // e.g.: https://github.com/heroui-inc/heroui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={errorMessage}\n isDisabled={disabled}\n isInvalid={invalid}\n isRequired={required}\n label={label ? <legend>{label}</legend> : null}\n name={name}\n onBlur={onBlur}\n onValueChange={(newValue) => {\n onChange(convertToOriginalType(newValue));\n }}\n orientation={inline ? 'horizontal' : 'vertical'}\n value={value != null ? String(value) : ''}\n >\n {options.map((option) => {\n if ('value' in option) {\n const optionTestId = slugify(\n `${testId}_option_${option.testId ?? option.value}`,\n { replaceDots: true },\n );\n return (\n <RadioBox\n key={String(option.value)}\n classNames={boxClassNames}\n data-testid={optionTestId}\n description={option.description}\n icon={option.icon}\n isDisabled={!!disabled || option.disabled}\n isInvalid={invalid}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </RadioBox>\n );\n }\n return null;\n })}\n </HeroRadioGroup>\n );\n};\n\nexport default RadioBoxes;\n","import RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps, RadioBoxOption } from './RadioBoxes';\n\nexport { radioBoxVariants } from './RadioBox';\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;AASA,MAAa,mBAAmB,GAAG;CACjC,OAAO;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,OAAO;EACP,cAAc;CAChB;CACA,UAAU;EACR,YAAY,EACV,MAAM,EACJ,MAAM,uCACR,EACF;EACA,WAAW,EACT,MAAM,EACJ,MAAM,iBACR,EACF;CACF;AACF,CAAC;AAaD,MAAa,YAAY,EACvB,Y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