@fuf-stack/uniform 1.27.0 → 2.0.0-next.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.
Files changed (149) hide show
  1. package/README.md +9 -0
  2. package/dist/Checkboxes/index.d.mts +192 -263
  3. package/dist/Checkboxes/index.d.mts.map +1 -1
  4. package/dist/Checkboxes/index.mjs +294 -90
  5. package/dist/Checkboxes/index.mjs.map +1 -1
  6. package/dist/DatePicker/index.d.mts +1282 -500
  7. package/dist/DatePicker/index.d.mts.map +1 -1
  8. package/dist/DatePicker/index.mjs +403 -83
  9. package/dist/DatePicker/index.mjs.map +1 -1
  10. package/dist/FieldArray/index.d.mts +105 -98
  11. package/dist/FieldArray/index.d.mts.map +1 -1
  12. package/dist/FieldArray/index.mjs +344 -195
  13. package/dist/FieldArray/index.mjs.map +1 -1
  14. package/dist/FieldCard/index.d.mts +37 -35
  15. package/dist/FieldCard/index.d.mts.map +1 -1
  16. package/dist/FieldCard/index.mjs +187 -128
  17. package/dist/FieldCard/index.mjs.map +1 -1
  18. package/dist/{FieldCopyTestIdButton-CRJBix9D.mjs → FieldCopyTestIdButton-DV0tkdh2.mjs} +5 -3
  19. package/dist/FieldCopyTestIdButton-DV0tkdh2.mjs.map +1 -0
  20. package/dist/FieldDescription-C4l0HKGL.mjs +36 -0
  21. package/dist/FieldDescription-C4l0HKGL.mjs.map +1 -0
  22. package/dist/FieldLabel-DKzqkuY1.mjs +125 -0
  23. package/dist/FieldLabel-DKzqkuY1.mjs.map +1 -0
  24. package/dist/FieldLayout-BLW5S-Jm.mjs +46 -0
  25. package/dist/FieldLayout-BLW5S-Jm.mjs.map +1 -0
  26. package/dist/FieldValidationError-DgkCL3cC.mjs +77 -0
  27. package/dist/FieldValidationError-DgkCL3cC.mjs.map +1 -0
  28. package/dist/Form/index.d.mts +11 -11
  29. package/dist/Form/index.d.mts.map +1 -1
  30. package/dist/Form/index.mjs +14 -11
  31. package/dist/Form/index.mjs.map +1 -1
  32. package/dist/FormContext-CHctWFAP.mjs +520 -0
  33. package/dist/FormContext-CHctWFAP.mjs.map +1 -0
  34. package/dist/FormContext-CsFiNvuJ.d.mts.map +1 -1
  35. package/dist/Grid/index.mjs +1 -2
  36. package/dist/{Grid-CTs-Rb9G.mjs → Grid-DfcZeuib.mjs} +4 -2
  37. package/dist/Grid-DfcZeuib.mjs.map +1 -0
  38. package/dist/Input/index.d.mts +640 -392
  39. package/dist/Input/index.d.mts.map +1 -1
  40. package/dist/Input/index.mjs +421 -76
  41. package/dist/Input/index.mjs.map +1 -1
  42. package/dist/RadioBoxes/index.d.mts +1583 -120
  43. package/dist/RadioBoxes/index.d.mts.map +1 -1
  44. package/dist/RadioBoxes/index.mjs +159 -114
  45. package/dist/RadioBoxes/index.mjs.map +1 -1
  46. package/dist/RadioTabs/index.d.mts +300 -81
  47. package/dist/RadioTabs/index.d.mts.map +1 -1
  48. package/dist/RadioTabs/index.mjs +277 -86
  49. package/dist/RadioTabs/index.mjs.map +1 -1
  50. package/dist/Radios/index.d.mts +1353 -108
  51. package/dist/Radios/index.d.mts.map +1 -1
  52. package/dist/Radios/index.mjs +105 -54
  53. package/dist/Radios/index.mjs.map +1 -1
  54. package/dist/Select/index.d.mts +558 -3013
  55. package/dist/Select/index.d.mts.map +1 -1
  56. package/dist/Select/index.mjs +319 -177
  57. package/dist/Select/index.mjs.map +1 -1
  58. package/dist/Slider/index.d.mts +414 -1326
  59. package/dist/Slider/index.d.mts.map +1 -1
  60. package/dist/Slider/index.mjs +276 -94
  61. package/dist/Slider/index.mjs.map +1 -1
  62. package/dist/SubmitButton/index.d.mts.map +1 -1
  63. package/dist/SubmitButton/index.mjs +4 -1
  64. package/dist/SubmitButton/index.mjs.map +1 -1
  65. package/dist/Switch/index.d.mts +2 -1248
  66. package/dist/Switch/index.mjs +167 -68
  67. package/dist/Switch/index.mjs.map +1 -1
  68. package/dist/Switch-CvPO8IF9.d.mts +601 -0
  69. package/dist/Switch-CvPO8IF9.d.mts.map +1 -0
  70. package/dist/SwitchBox/index.d.mts +139 -43
  71. package/dist/SwitchBox/index.d.mts.map +1 -1
  72. package/dist/SwitchBox/index.mjs +142 -87
  73. package/dist/SwitchBox/index.mjs.map +1 -1
  74. package/dist/TextArea/index.d.mts +295 -411
  75. package/dist/TextArea/index.d.mts.map +1 -1
  76. package/dist/TextArea/index.mjs +200 -48
  77. package/dist/TextArea/index.mjs.map +1 -1
  78. package/dist/Time/index.d.mts +1170 -601
  79. package/dist/Time/index.d.mts.map +1 -1
  80. package/dist/Time/index.mjs +162 -74
  81. package/dist/Time/index.mjs.map +1 -1
  82. package/dist/helpers/index.d.mts +1 -1
  83. package/dist/helpers/index.mjs +1 -1
  84. package/dist/helpers/index.mjs.map +1 -1
  85. package/dist/hooks/useClientValidation/index.mjs +1 -1
  86. package/dist/hooks/useController/index.d.mts +31 -3
  87. package/dist/hooks/useController/index.d.mts.map +1 -0
  88. package/dist/hooks/useController/index.mjs +1 -2
  89. package/dist/hooks/useFormContext/index.d.mts +65 -3
  90. package/dist/hooks/useFormContext/index.d.mts.map +1 -0
  91. package/dist/hooks/useFormContext/index.mjs +1 -2
  92. package/dist/hooks/useInputValueDebounce/index.d.mts +11 -5
  93. package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
  94. package/dist/hooks/useInputValueDebounce/index.mjs +27 -5
  95. package/dist/hooks/useInputValueDebounce/index.mjs.map +1 -1
  96. package/dist/hooks/useInputValueTransform/index.d.mts +1 -2
  97. package/dist/hooks/useInputValueTransform/index.mjs +1 -2
  98. package/dist/hooks/useWatchFormReset/index.mjs +1 -1
  99. package/dist/hooks/useWatchUserChange/index.d.mts +2 -2
  100. package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
  101. package/dist/hooks/useWatchUserChange/index.mjs +1 -1
  102. package/dist/hooks/useWatchUserChange/index.mjs.map +1 -1
  103. package/dist/{useInputValueTransform-LOaEim7k.d.mts → index-BS8IoBOn.d.mts} +3 -3
  104. package/dist/index-BS8IoBOn.d.mts.map +1 -0
  105. package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -2
  106. package/dist/partials/FieldValidationError/index.d.mts +637 -3
  107. package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
  108. package/dist/partials/FieldValidationError/index.mjs +1 -2
  109. package/dist/radioControlVariants-Cm6WufWo.mjs +188 -0
  110. package/dist/radioControlVariants-Cm6WufWo.mjs.map +1 -0
  111. package/dist/switchVariants-BaQw2DA7.mjs +67 -0
  112. package/dist/switchVariants-BaQw2DA7.mjs.map +1 -0
  113. package/dist/timeVariants-B9HDfNYt.mjs +58 -0
  114. package/dist/timeVariants-B9HDfNYt.mjs.map +1 -0
  115. package/dist/{useController-CK39i6HI.mjs → useController-BCFeZbBZ.mjs} +2 -2
  116. package/dist/{useController-CK39i6HI.mjs.map → useController-BCFeZbBZ.mjs.map} +1 -1
  117. package/dist/{useFormContext-fYWtlnpE.mjs → useFormContext-BPjJjNnM.mjs} +2 -2
  118. package/dist/{useFormContext-fYWtlnpE.mjs.map → useFormContext-BPjJjNnM.mjs.map} +1 -1
  119. package/dist/{useInputValueTransform-DJ5zkqSy.mjs → useInputValueTransform-Mw8YEOXT.mjs} +2 -2
  120. package/dist/{useInputValueTransform-DJ5zkqSy.mjs.map → useInputValueTransform-Mw8YEOXT.mjs.map} +1 -1
  121. package/package.json +17 -29
  122. package/dist/FieldCopyTestIdButton-CRJBix9D.mjs.map +0 -1
  123. package/dist/FieldValidationError-ByRoIxaM.mjs +0 -50
  124. package/dist/FieldValidationError-ByRoIxaM.mjs.map +0 -1
  125. package/dist/FormContext-gHSwOlcy.mjs +0 -278
  126. package/dist/FormContext-gHSwOlcy.mjs.map +0 -1
  127. package/dist/Grid-CTs-Rb9G.mjs.map +0 -1
  128. package/dist/Switch/index.d.mts.map +0 -1
  129. package/dist/hooks/useInput/index.d.mts +0 -2
  130. package/dist/hooks/useInput/index.mjs +0 -7
  131. package/dist/hooks/useInput/index.mjs.map +0 -1
  132. package/dist/hooks/useUniformField/index.d.mts +0 -98
  133. package/dist/hooks/useUniformField/index.d.mts.map +0 -1
  134. package/dist/hooks/useUniformField/index.mjs +0 -137
  135. package/dist/hooks/useUniformField/index.mjs.map +0 -1
  136. package/dist/hooks/useUniformFieldArray/index.d.mts +0 -73
  137. package/dist/hooks/useUniformFieldArray/index.d.mts.map +0 -1
  138. package/dist/hooks/useUniformFieldArray/index.mjs +0 -101
  139. package/dist/hooks/useUniformFieldArray/index.mjs.map +0 -1
  140. package/dist/index-CAdGtKE_.d.mts +0 -1
  141. package/dist/index-CaxrMD1A.d.mts +0 -1
  142. package/dist/index-D5HVU2jP.d.mts +0 -1
  143. package/dist/useController-DcK2YHbw.d.mts +0 -32
  144. package/dist/useController-DcK2YHbw.d.mts.map +0 -1
  145. package/dist/useFormContext-B3QGVVaO.d.mts +0 -66
  146. package/dist/useFormContext-B3QGVVaO.d.mts.map +0 -1
  147. package/dist/useInput-C0aJaAGe.mjs +0 -2
  148. package/dist/useInput-ClpHDPdr.d.mts +0 -2
  149. package/dist/useInputValueTransform-LOaEim7k.d.mts.map +0 -1
@@ -1,19 +1,37 @@
1
- import { useUniformField } from "../hooks/useUniformField/index.mjs";
2
- import { cn, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
3
- import { useRef } from "react";
1
+ import { n as useUniformField, t as FieldLabel } from "../FieldLabel-DKzqkuY1.mjs";
2
+ import { n as getFieldControlProps, t as FieldDescription } from "../FieldDescription-C4l0HKGL.mjs";
3
+ import { t as switchVariants } from "../switchVariants-BaQw2DA7.mjs";
4
4
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
- import { VisuallyHidden } from "@react-aria/visually-hidden";
6
- import { useSwitch } from "@heroui/switch";
7
- //#region src/SwitchBox/SwitchBox.tsx
5
+ import { tv } from "@fuf-stack/pixel-utils";
6
+ import { useStyling } from "@fuf-stack/pixels/StylingProvider";
7
+ import { useFocusRing } from "react-aria/useFocusRing";
8
+ import { useObjectRef } from "react-aria/useObjectRef";
9
+ import { useHover } from "react-aria/useHover";
10
+ import { mergeProps } from "react-aria/mergeProps";
11
+ import { useSwitch } from "react-aria/useSwitch";
12
+ import { VisuallyHidden } from "react-aria/VisuallyHidden";
13
+ import { useToggleState } from "react-stately/useToggleState";
14
+ //#region src/SwitchBox/switchBoxVariants.ts
8
15
  const switchBoxVariants = tv({
9
16
  slots: {
10
- box: "group inline-flex w-full cursor-pointer items-center justify-between rounded-lg border-2 border-default hover:bg-content2 data-[selected=true]:border-focus",
17
+ /** Selectable box containing the toggle and text */
18
+ box: ["group inline-flex w-full cursor-pointer items-center justify-between rounded-lg border-2 border-default", "hover:bg-content2 data-[selected=true]:border-focus"],
19
+ /** Supporting text for the field */
11
20
  description: "text-foreground opacity-70",
21
+ /** Container for validation messages */
22
+ errorMessage: "text-danger text-tiny",
23
+ /** Container below the switch for validation messages */
24
+ helperWrapper: "relative ml-0 block p-0",
25
+ /** Decorative icon beside the option text */
12
26
  icon: "",
13
- label: "font-medium text-foreground group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]",
14
- wrapper: "",
27
+ /** Visible field label */
28
+ label: "font-medium text-foreground",
29
+ /** Movable indicator showing the current value */
15
30
  thumb: "",
16
- thumbIcon: ""
31
+ /** Content inside the toggle thumb */
32
+ thumbIcon: "",
33
+ /** Container arranging the selectable content */
34
+ wrapper: ""
17
35
  },
18
36
  variants: {
19
37
  isDisabled: { true: { box: "pointer-events-none opacity-disabled" } },
@@ -22,90 +40,112 @@ const switchBoxVariants = tv({
22
40
  label: "!text-danger"
23
41
  } },
24
42
  size: {
25
- sm: {
26
- box: "gap-2 p-3",
27
- description: "text-xs",
28
- label: "text-xs"
43
+ lg: {
44
+ box: "gap-4 p-5",
45
+ description: "text-small",
46
+ label: "text-base"
29
47
  },
30
48
  md: {
31
49
  box: "gap-4 p-4",
32
50
  description: "text-small",
33
51
  label: "text-sm"
34
52
  },
35
- lg: {
36
- box: "gap-4 p-5",
37
- description: "text-small",
38
- label: "text-base"
53
+ sm: {
54
+ box: "gap-2 p-3",
55
+ description: "text-xs",
56
+ label: "text-xs"
39
57
  }
40
58
  }
41
59
  },
42
60
  defaultVariants: { size: "md" }
43
61
  });
62
+ //#endregion
63
+ //#region src/SwitchBox/subcomponents/SwitchBoxTrack.tsx
64
+ /** Visual toggle track and thumb, including the selection-aware icon callback */
65
+ const SwitchBoxTrack = ({ className: trackClassNames, selected, thumbIcon }) => {
66
+ return /* @__PURE__ */ jsx("span", {
67
+ "aria-hidden": true,
68
+ className: trackClassNames.wrapper,
69
+ "data-slot": "wrapper",
70
+ children: /* @__PURE__ */ jsx("span", {
71
+ className: trackClassNames.thumb,
72
+ "data-slot": "thumb",
73
+ children: typeof thumbIcon === "function" ? thumbIcon({
74
+ isSelected: selected,
75
+ className: trackClassNames.thumbIcon,
76
+ width: "1em",
77
+ height: "1em",
78
+ "data-checked": String(selected)
79
+ }) : thumbIcon
80
+ })
81
+ });
82
+ };
83
+ //#endregion
84
+ //#region src/SwitchBox/subcomponents/SwitchBoxControl.tsx
44
85
  /**
45
- * SwitchBox component - A card-like box with a switch control
86
+ * Selectable switch box with label, description and validation messages
87
+ *
88
+ * @see https://react-aria.adobe.com/useSwitch
46
89
  */
47
- const SwitchBox = ({ className = void 0, description = void 0, icon = void 0, name, size = void 0, thumbIcon = void 0, ...uniformFieldProps }) => {
48
- const { defaultValue, disabled, errorMessage, field, getErrorMessageProps, getHelperWrapperProps, invalid, label, onBlur, onChange, ref, required, testId } = useUniformField({
49
- name,
50
- ...uniformFieldProps
90
+ const SwitchBoxControl = ({ field, className, size, thumbIcon, icon }) => {
91
+ const { description, disabled, errorMessage, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, required, testId, value } = field;
92
+ const controlProps = getFieldControlProps(field);
93
+ const styling = useStyling();
94
+ const controlRef = useObjectRef(inputRef);
95
+ const state = useToggleState({
96
+ isSelected: !!value,
97
+ onChange: onValueChange
51
98
  });
52
- const visualSwitchRef = useRef(null);
53
- const { Component, slots, isSelected, getBaseProps, getInputProps, getWrapperProps } = useSwitch({
54
- defaultSelected: !!defaultValue,
99
+ const { inputProps, labelProps, isPressed } = useSwitch({
100
+ ...controlProps,
101
+ children: label,
55
102
  isDisabled: disabled,
56
- isSelected: !!field.value,
57
- name: `${name}_switch`,
58
- onValueChange: onChange,
59
- size,
60
- thumbIcon
61
- });
62
- const variants = switchBoxVariants({
103
+ isInvalid: invalid,
104
+ isRequired: required,
105
+ name,
106
+ onBlur,
107
+ validationBehavior: "aria"
108
+ }, state, controlRef);
109
+ const { focusProps, isFocused, isFocusVisible } = useFocusRing();
110
+ const { hoverProps, isHovered } = useHover({ isDisabled: disabled });
111
+ const variants = styling.resolve(switchBoxVariants, {
63
112
  isDisabled: disabled,
64
113
  isInvalid: invalid,
65
114
  size
66
115
  });
67
- const classNames = variantsToClassNames(variants, className, "box");
68
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(Component, {
69
- ...getBaseProps(),
116
+ const classNames = styling.variantsToClassNames(variants, className, "box");
117
+ const trackVariants = styling.resolve(switchVariants, { size });
118
+ const trackClassNames = styling.variantsToClassNames(trackVariants, {
119
+ wrapper: classNames.wrapper,
120
+ thumb: classNames.thumb,
121
+ thumbIcon: classNames.thumbIcon
122
+ });
123
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("label", {
124
+ ...mergeProps(labelProps, hoverProps),
70
125
  className: classNames.box,
126
+ "data-component": "switch-box",
127
+ "data-focus": isFocused || void 0,
128
+ "data-focus-visible": isFocusVisible || void 0,
129
+ "data-hover": isHovered || void 0,
71
130
  "data-invalid": invalid,
131
+ "data-pressed": isPressed || void 0,
72
132
  "data-required": required,
133
+ "data-selected": state.isSelected || void 0,
73
134
  "data-testid": testId,
135
+ htmlFor: ids.control,
74
136
  children: [
75
- /* @__PURE__ */ jsxs(VisuallyHidden, { children: [/* @__PURE__ */ jsx("input", {
76
- ref,
77
- "aria-label": typeof label === "string" ? label : name,
78
- checked: !!field.value,
79
- name,
80
- onChange: (e) => {
81
- onChange(e.target.checked);
82
- },
83
- onFocus: () => {
84
- visualSwitchRef.current?.focus();
85
- },
86
- tabIndex: -1,
87
- type: "checkbox"
88
- }), /* @__PURE__ */ jsx("input", {
89
- ref: visualSwitchRef,
90
- ...getInputProps(),
91
- onBlur: (e) => {
92
- getInputProps().onBlur?.(e);
93
- onBlur();
94
- }
95
- })] }),
96
- !icon ? /* @__PURE__ */ jsx("span", {
97
- ...getWrapperProps(),
98
- className: cn(getWrapperProps().className, classNames.wrapper),
99
- children: /* @__PURE__ */ jsx("span", {
100
- className: cn(slots.thumb({ class: classNames.thumb })),
101
- children: thumbIcon && typeof thumbIcon === "function" ? thumbIcon({
102
- isSelected: !!isSelected,
103
- className: slots.thumbIcon({ class: classNames.thumbIcon }),
104
- width: "1em",
105
- height: "1em",
106
- "data-checked": isSelected ? "true" : "false"
107
- }) : thumbIcon
137
+ /* @__PURE__ */ jsx(VisuallyHidden, {
138
+ elementType: "span",
139
+ children: /* @__PURE__ */ jsx("input", {
140
+ ...mergeProps(inputProps, focusProps, controlProps),
141
+ ref: controlRef,
142
+ "data-slot": "input"
108
143
  })
144
+ }),
145
+ !icon ? /* @__PURE__ */ jsx(SwitchBoxTrack, {
146
+ className: trackClassNames,
147
+ selected: state.isSelected,
148
+ thumbIcon
109
149
  }) : null,
110
150
  icon ? /* @__PURE__ */ jsx("div", {
111
151
  className: classNames.icon,
@@ -113,39 +153,54 @@ const SwitchBox = ({ className = void 0, description = void 0, icon = void 0, na
113
153
  }) : null,
114
154
  /* @__PURE__ */ jsxs("div", {
115
155
  className: "grow",
116
- children: [label ? /* @__PURE__ */ jsx("div", {
156
+ children: [label ? /* @__PURE__ */ jsx(FieldLabel, {
157
+ as: "div",
117
158
  className: classNames.label,
159
+ id: ids.label,
160
+ required,
118
161
  children: label
119
- }) : null, description ? /* @__PURE__ */ jsx("div", {
162
+ }) : null, description ? /* @__PURE__ */ jsx(FieldDescription, {
120
163
  className: classNames.description,
164
+ "data-slot": void 0,
165
+ id: ids.description,
121
166
  children: description
122
167
  }) : null]
123
168
  }),
124
- icon ? /* @__PURE__ */ jsx("span", {
125
- ...getWrapperProps(),
126
- className: cn(getWrapperProps().className, classNames.wrapper),
127
- children: /* @__PURE__ */ jsx("span", {
128
- className: cn(slots.thumb({ class: classNames.thumb })),
129
- children: thumbIcon && typeof thumbIcon === "function" ? thumbIcon({
130
- isSelected: !!isSelected,
131
- className: slots.thumbIcon({ class: classNames.thumbIcon }),
132
- width: "1em",
133
- height: "1em",
134
- "data-checked": isSelected ? "true" : "false"
135
- }) : thumbIcon
136
- })
169
+ icon ? /* @__PURE__ */ jsx(SwitchBoxTrack, {
170
+ className: trackClassNames,
171
+ selected: state.isSelected,
172
+ thumbIcon
137
173
  }) : null
138
174
  ]
139
175
  }), invalid ? /* @__PURE__ */ jsx("div", {
140
- ...getHelperWrapperProps(),
141
- className: cn(getHelperWrapperProps()?.className, "ml-0 block"),
176
+ className: classNames.helperWrapper,
177
+ "data-slot": "helper-wrapper",
142
178
  children: /* @__PURE__ */ jsx("div", {
143
- ...getErrorMessageProps(),
179
+ className: classNames.errorMessage,
180
+ "data-slot": "error-message",
181
+ id: ids.error,
144
182
  children: errorMessage
145
183
  })
146
184
  }) : null] });
147
185
  };
148
186
  //#endregion
187
+ //#region src/SwitchBox/SwitchBox.tsx
188
+ /** Form toggle field with a switch inside a selectable card */
189
+ const SwitchBox = ({ className = void 0, description = void 0, icon = void 0, name, size = void 0, thumbIcon = void 0, ...uniformFieldProps }) => {
190
+ const { field } = useUniformField({
191
+ ...uniformFieldProps,
192
+ description,
193
+ name
194
+ });
195
+ return /* @__PURE__ */ jsx(SwitchBoxControl, {
196
+ className,
197
+ field,
198
+ icon,
199
+ size,
200
+ thumbIcon
201
+ });
202
+ };
203
+ //#endregion
149
204
  //#region src/SwitchBox/index.ts
150
205
  var SwitchBox_default = SwitchBox;
151
206
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/SwitchBox/SwitchBox.tsx","../../src/SwitchBox/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\nimport type { SwitchProps as HeroSwitchProps } from '@heroui/switch';\nimport type { ReactNode } from 'react';\n\nimport { useRef } from 'react';\n\nimport { useSwitch } from '@heroui/switch';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useUniformField } from '../hooks/useUniformField';\n\nexport const switchBoxVariants = tv({\n slots: {\n box: 'group inline-flex w-full cursor-pointer items-center justify-between rounded-lg border-2 border-default hover:bg-content2 data-[selected=true]:border-focus',\n description: 'text-foreground opacity-70',\n icon: '',\n label:\n 'font-medium text-foreground group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n wrapper: '',\n thumb: '',\n thumbIcon: '',\n },\n variants: {\n isDisabled: {\n true: {\n box: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n box: '!border-danger',\n label: '!text-danger',\n },\n },\n size: {\n sm: {\n box: 'gap-2 p-3',\n description: 'text-xs',\n label: 'text-xs',\n },\n md: {\n box: 'gap-4 p-4',\n description: 'text-small',\n label: 'text-sm',\n },\n lg: {\n box: 'gap-4 p-5',\n description: 'text-small',\n label: 'text-base',\n },\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\ntype ClassName = TVClassName<typeof switchBoxVariants>;\n\nexport interface SwitchBoxProps {\n /** CSS class name */\n className?: ClassName;\n /** Description text displayed below the label */\n description?: ReactNode;\n /** whether the switch should be disabled */\n disabled?: boolean;\n /** Icon to be displayed in the box */\n icon?: ReactNode;\n /** component displayed as the label */\n label?: ReactNode;\n /** name the field is registered under */\n name: string;\n /** whether the field is required */\n required?: boolean;\n /* Size of the switch */\n size?: 'sm' | 'md' | 'lg';\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Icon to be displayed inside the thumb */\n thumbIcon?: HeroSwitchProps['thumbIcon'];\n}\n\n/**\n * SwitchBox component - A card-like box with a switch control\n */\nconst SwitchBox = ({\n className = undefined,\n description = undefined,\n icon = undefined,\n name,\n size = undefined,\n thumbIcon = undefined,\n ...uniformFieldProps\n}: SwitchBoxProps) => {\n const {\n defaultValue,\n disabled,\n errorMessage,\n field,\n getErrorMessageProps,\n getHelperWrapperProps,\n invalid,\n label,\n onBlur,\n onChange,\n ref,\n required,\n testId,\n } = useUniformField({\n name,\n ...uniformFieldProps,\n });\n\n // Ref for the visual switch to forward focus\n const visualSwitchRef = useRef<HTMLInputElement>(null);\n\n // Use the useSwitch hook to get access to all the necessary props\n const {\n Component,\n slots,\n isSelected,\n getBaseProps,\n getInputProps,\n getWrapperProps,\n } = useSwitch({\n defaultSelected: !!defaultValue,\n isDisabled: disabled,\n isSelected: !!field.value,\n name: `${name}_switch`,\n onValueChange: onChange,\n size,\n thumbIcon,\n });\n\n // classNames from slots\n const variants = switchBoxVariants({\n isDisabled: disabled,\n isInvalid: invalid,\n size,\n });\n const classNames = variantsToClassNames(variants, className, 'box');\n\n return (\n <>\n <Component\n {...getBaseProps()}\n className={classNames.box}\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n >\n <VisuallyHidden>\n <input\n ref={ref}\n aria-label={typeof label === 'string' ? label : name}\n checked={!!field.value}\n name={name}\n onChange={(e) => {\n onChange(e.target.checked);\n }}\n onFocus={() => {\n // When RHF focuses this hidden input (e.g., on validation error),\n // forward focus to the visual switch to show focus ring\n visualSwitchRef.current?.focus();\n }}\n tabIndex={-1}\n type=\"checkbox\"\n />\n {/* Visual switch input for focus ring */}\n <input\n ref={visualSwitchRef}\n {...getInputProps()}\n onBlur={(e) => {\n // Call HeroUI's internal onBlur to clear focus state and remove focus ring\n getInputProps().onBlur?.(e);\n // Then call RHF's onBlur to mark field as touched\n onBlur();\n }}\n />\n </VisuallyHidden>\n {!icon ? (\n <span\n {...getWrapperProps()}\n className={cn(getWrapperProps().className, classNames.wrapper)}\n >\n <span className={cn(slots.thumb({ class: classNames.thumb }))}>\n {thumbIcon && typeof thumbIcon === 'function'\n ? thumbIcon({\n isSelected: !!isSelected,\n className: slots.thumbIcon({ class: classNames.thumbIcon }),\n width: '1em',\n height: '1em',\n 'data-checked': isSelected ? 'true' : 'false',\n })\n : thumbIcon}\n </span>\n </span>\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n <div className=\"grow\">\n {label ? <div className={classNames.label}>{label}</div> : null}\n {description ? (\n <div className={classNames.description}>{description}</div>\n ) : null}\n </div>\n {icon ? (\n <span\n {...getWrapperProps()}\n className={cn(getWrapperProps().className, classNames.wrapper)}\n >\n <span className={cn(slots.thumb({ class: classNames.thumb }))}>\n {thumbIcon && typeof thumbIcon === 'function'\n ? thumbIcon({\n isSelected: !!isSelected,\n className: slots.thumbIcon({ class: classNames.thumbIcon }),\n width: '1em',\n height: '1em',\n 'data-checked': isSelected ? 'true' : 'false',\n })\n : thumbIcon}\n </span>\n </span>\n ) : null}\n </Component>\n {invalid ? (\n <div\n {...getHelperWrapperProps()}\n className={cn(\n getHelperWrapperProps()?.className,\n // force helper to be visible (for some reason it's hidden by default) and remove margin\n 'ml-0 block',\n )}\n >\n <div {...getErrorMessageProps()}>{errorMessage}</div>\n </div>\n ) : null}\n </>\n );\n};\n\nexport default SwitchBox;\n","import SwitchBox from './SwitchBox';\n\nexport type { SwitchBoxProps } from './SwitchBox';\n\nexport { switchBoxVariants } from './SwitchBox';\n\nexport default SwitchBox;\n"],"mappings":";;;;;;;AAaA,MAAa,oBAAoB,GAAG;CAClC,OAAO;EACL,KAAK;EACL,aAAa;EACb,MAAM;EACN,OACE;EACF,SAAS;EACT,OAAO;EACP,WAAW;CACb;CACA,UAAU;EACR,YAAY,EACV,MAAM,EACJ,KAAK,uCACP,EACF;EACA,WAAW,EACT,MAAM;GACJ,KAAK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AD;EACE,GAAI,sBAAsB;EAC1B,WAAW,GACT,sBAAsB,CAAC,EAAE,WAEzB,YACF;EAEA,UAAA,oBAAC,OAAD;GAAK,GAAI,qBAAqB;GAAI,UAAA;EAAkB,CAAA;CACjD,CAAA,IACH,IACJ,EAAA,CAAA;AAEN;;;AC1OA,IAAA,oBAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/SwitchBox/switchBoxVariants.ts","../../src/SwitchBox/subcomponents/SwitchBoxTrack.tsx","../../src/SwitchBox/subcomponents/SwitchBoxControl.tsx","../../src/SwitchBox/SwitchBox.tsx","../../src/SwitchBox/index.ts"],"sourcesContent":["import type { TVClassName } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nexport const switchBoxVariants = tv({\n slots: {\n /** Selectable box containing the toggle and text */\n box: [\n // box layout and surface\n 'group inline-flex w-full cursor-pointer items-center justify-between rounded-lg border-2 border-default',\n // hover and selection feedback\n 'hover:bg-content2 data-[selected=true]:border-focus',\n ],\n /** Supporting text for the field */\n description: 'text-foreground opacity-70',\n /** Container for validation messages */\n errorMessage: 'text-danger text-tiny',\n /** Container below the switch for validation messages */\n helperWrapper: 'relative ml-0 block p-0',\n /** Decorative icon beside the option text */\n icon: '',\n /** Visible field label */\n label: 'font-medium text-foreground',\n /** Movable indicator showing the current value */\n thumb: '',\n /** Content inside the toggle thumb */\n thumbIcon: '',\n /** Container arranging the selectable content */\n wrapper: '',\n },\n variants: {\n isDisabled: {\n true: {\n box: 'pointer-events-none opacity-disabled',\n },\n },\n isInvalid: {\n true: {\n box: '!border-danger',\n label: '!text-danger',\n },\n },\n size: {\n lg: {\n box: 'gap-4 p-5',\n description: 'text-small',\n label: 'text-base',\n },\n md: {\n box: 'gap-4 p-4',\n description: 'text-small',\n label: 'text-sm',\n },\n sm: {\n box: 'gap-2 p-3',\n description: 'text-xs',\n label: 'text-xs',\n },\n },\n },\n defaultVariants: {\n size: 'md',\n },\n});\n\nexport type ClassName = TVClassName<typeof switchBoxVariants>;\n","import type { SwitchBoxProps } from '../SwitchBox';\n\ninterface SwitchBoxTrackProps extends Pick<SwitchBoxProps, 'thumbIcon'> {\n /** CSS class name */\n className: Record<'thumb' | 'thumbIcon' | 'wrapper', string>;\n /** Current toggle state supplied to the icon callback */\n selected: boolean;\n}\n\n/** Visual toggle track and thumb, including the selection-aware icon callback */\nconst SwitchBoxTrack = ({\n className: trackClassNames,\n selected,\n thumbIcon,\n}: SwitchBoxTrackProps) => {\n return (\n <span aria-hidden className={trackClassNames.wrapper} data-slot=\"wrapper\">\n <span className={trackClassNames.thumb} data-slot=\"thumb\">\n {typeof thumbIcon === 'function'\n ? thumbIcon({\n isSelected: selected,\n className: trackClassNames.thumbIcon,\n width: '1em',\n height: '1em',\n 'data-checked': String(selected),\n })\n : thumbIcon}\n </span>\n </span>\n );\n};\n\nexport default SwitchBoxTrack;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { SwitchBoxProps } from '../SwitchBox';\n\nimport { mergeProps } from 'react-aria/mergeProps';\nimport { useFocusRing } from 'react-aria/useFocusRing';\nimport { useHover } from 'react-aria/useHover';\nimport { useObjectRef } from 'react-aria/useObjectRef';\nimport { useSwitch } from 'react-aria/useSwitch';\nimport { VisuallyHidden } from 'react-aria/VisuallyHidden';\nimport { useToggleState } from 'react-stately/useToggleState';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldDescription from '../../partials/FieldDescription/FieldDescription';\nimport FieldLabel from '../../partials/FieldLabel/FieldLabel';\nimport { switchVariants } from '../../Switch/switchVariants';\nimport { switchBoxVariants } from '../switchBoxVariants';\nimport SwitchBoxTrack from './SwitchBoxTrack';\n\ninterface SwitchBoxControlProps extends Pick<\n SwitchBoxProps,\n 'className' | 'icon' | 'size' | 'thumbIcon'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, boolean>;\n}\n\n/**\n * Selectable switch box with label, description and validation messages\n *\n * @see https://react-aria.adobe.com/useSwitch\n */\nconst SwitchBoxControl = ({\n field,\n className,\n size,\n thumbIcon,\n icon,\n}: SwitchBoxControlProps) => {\n const {\n description,\n disabled,\n errorMessage,\n ids,\n ref: inputRef,\n invalid,\n label,\n name,\n onBlur,\n onChange: onValueChange,\n required,\n testId,\n value,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const styling = useStyling();\n const controlRef = useObjectRef<HTMLInputElement>(inputRef);\n const state = useToggleState({\n isSelected: !!value,\n onChange: onValueChange,\n });\n const { inputProps, labelProps, isPressed } = useSwitch(\n {\n ...controlProps,\n children: label,\n isDisabled: disabled,\n isInvalid: invalid,\n isRequired: required,\n name,\n onBlur,\n validationBehavior: 'aria',\n },\n state,\n controlRef,\n );\n const { focusProps, isFocused, isFocusVisible } = useFocusRing();\n const { hoverProps, isHovered } = useHover({ isDisabled: disabled });\n\n // classNames from slots\n const variants = styling.resolve(switchBoxVariants, {\n isDisabled: disabled,\n isInvalid: invalid,\n size,\n });\n const classNames = styling.variantsToClassNames(variants, className, 'box');\n\n const trackVariants = styling.resolve(switchVariants, { size });\n const trackClassNames = styling.variantsToClassNames(trackVariants, {\n wrapper: classNames.wrapper,\n thumb: classNames.thumb,\n thumbIcon: classNames.thumbIcon,\n });\n\n return (\n <>\n <label\n {...mergeProps(labelProps, hoverProps)}\n className={classNames.box}\n data-component=\"switch-box\"\n data-focus={isFocused || undefined}\n data-focus-visible={isFocusVisible || undefined}\n data-hover={isHovered || undefined}\n data-invalid={invalid}\n data-pressed={isPressed || undefined}\n data-required={required}\n data-selected={state.isSelected || undefined}\n data-testid={testId}\n htmlFor={ids.control}\n >\n {/* native toggle for keyboard and assistive technology */}\n <VisuallyHidden elementType=\"span\">\n <input\n {...mergeProps(inputProps, focusProps, controlProps)}\n ref={controlRef}\n data-slot=\"input\"\n />\n </VisuallyHidden>\n {!icon ? (\n <SwitchBoxTrack\n className={trackClassNames}\n selected={state.isSelected}\n thumbIcon={thumbIcon}\n />\n ) : null}\n {icon ? <div className={classNames.icon}>{icon}</div> : null}\n\n {/* label and supporting text */}\n <div className=\"grow\">\n {label ? (\n <FieldLabel\n as=\"div\"\n className={classNames.label}\n id={ids.label}\n required={required}\n >\n {label}\n </FieldLabel>\n ) : null}\n {description ? (\n <FieldDescription\n className={classNames.description}\n data-slot={undefined}\n id={ids.description}\n >\n {description}\n </FieldDescription>\n ) : null}\n </div>\n {icon ? (\n <SwitchBoxTrack\n className={trackClassNames}\n selected={state.isSelected}\n thumbIcon={thumbIcon}\n />\n ) : null}\n </label>\n\n {/* validation messages below the box */}\n {invalid ? (\n <div className={classNames.helperWrapper} data-slot=\"helper-wrapper\">\n <div\n className={classNames.errorMessage}\n data-slot=\"error-message\"\n id={ids.error}\n >\n {errorMessage}\n </div>\n </div>\n ) : null}\n </>\n );\n};\n\nexport default SwitchBoxControl;\n","import type { ReactNode } from 'react';\nimport type { SwitchProps } from '../Switch/Switch';\nimport type { ClassName } from './switchBoxVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport SwitchBoxControl from './subcomponents/SwitchBoxControl';\n\nexport { switchBoxVariants } from './switchBoxVariants';\n\nexport interface SwitchBoxProps {\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Icon to be displayed in the box */\n icon?: ReactNode;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** whether the field is required */\n required?: boolean;\n /* Size of the switch */\n size?: 'sm' | 'md' | 'lg';\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** Content or render callback inside the toggle thumb */\n thumbIcon?: SwitchProps['thumbIcon'];\n}\n\n/** Form toggle field with a switch inside a selectable card */\nconst SwitchBox = ({\n className = undefined,\n description = undefined,\n icon = undefined,\n name,\n size = undefined,\n thumbIcon = undefined,\n ...uniformFieldProps\n}: SwitchBoxProps) => {\n const { field } = useUniformField({\n ...uniformFieldProps,\n description,\n name,\n });\n\n return (\n <SwitchBoxControl\n className={className}\n field={field}\n icon={icon}\n size={size}\n thumbIcon={thumbIcon}\n />\n );\n};\n\nexport default SwitchBox;\n","import SwitchBox from './SwitchBox';\n\nexport type { SwitchBoxProps } from './SwitchBox';\n\nexport { switchBoxVariants } from './SwitchBox';\n\nexport default SwitchBox;\n"],"mappings":";;;;;;;;;;;;;;AAIA,MAAa,oBAAoB,GAAG;CAClC,OAAO;;EAEL,KAAK,CAEH,2GAEA,qDACF;;EAEA,aAAa;;EAEb,cAAc;;EAEd,eAAe;;EAEf,MAAM;;EAEN,OAAO;;EAEP,OAAO;;EAEP,WAAW;;EAEX,SAAS;CACX;CACA,UAAU;EACR,YAAY,EACV,MAAM,EACJ,KAAK,uCACP,EACF;EACA,WAAW,EACT,MAAM;GACJ,KAAK;GACL,OAAO;EACT,EACF;EACA,MAAM;GACJ,IAAI;IACF,KAAK;IACL,aAAa;IACb,OAAO;GACT;GACA,IAAI;IACF,KAAK;IACL,aAAa;IACb,OAAO;GACT;GACA,IAAI;IACF,KAAK;IACL,aAAa;IACb,OAAO;GACT;EACF;CACF;CACA,iBAAiB,EACf,MAAM,KACR;AACF,CAAC;;;;ACrDD,MAAM,kBAAkB,EACtB,WAAW,iBACX,UACA,gBACyB;CACzB,OACE,oBAAC,QAAD;EAAM,eAAA;EAAY,WAAW,gBAAgB;EAAS,aAAU;EAC9D,UAAA,oBAAC,QAAD;GAAM,WAAW,gBAAgB;GAAO,aAAU;GAC/C,UAAA,OAAO,cAAc,aAClB,UAAU;IACR,YAAY;IACZ,WAAW,gBAAgB;IAC3B,OAAO;IACP,QAAQ;IACR,gBAAgB,OAAO,QAAQ;GACjC,CAAC,IACD;EACA,CAAA;CACF,CAAA;AAEV;;;;;;;;ACGA,MAAM,oBAAoB,EACxB,OACA,WACA,MACA,WACA,WAC2B;CAC3B,MAAM,EACJ,aACA,UACA,cACA,KACA,KAAK,UACL,SACA,OAC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