@fuf-stack/uniform 2.0.0-next.1 → 2.0.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/dist/Checkboxes/index.d.mts +57 -37
  2. package/dist/Checkboxes/index.d.mts.map +1 -1
  3. package/dist/Checkboxes/index.mjs +19 -20
  4. package/dist/Checkboxes/index.mjs.map +1 -1
  5. package/dist/DatePicker/index.d.mts +71 -31
  6. package/dist/DatePicker/index.d.mts.map +1 -1
  7. package/dist/DatePicker/index.mjs +31 -29
  8. package/dist/DatePicker/index.mjs.map +1 -1
  9. package/dist/FieldArray/index.d.mts +8 -16
  10. package/dist/FieldArray/index.d.mts.map +1 -1
  11. package/dist/FieldArray/index.mjs +18 -32
  12. package/dist/FieldArray/index.mjs.map +1 -1
  13. package/dist/FieldCard/index.d.mts +0 -4
  14. package/dist/FieldCard/index.d.mts.map +1 -1
  15. package/dist/FieldCard/index.mjs +11 -19
  16. package/dist/FieldCard/index.mjs.map +1 -1
  17. package/dist/{FieldCopyTestIdButton-DV0tkdh2.mjs → FieldCopyTestIdButton-D3_jZYJ1.mjs} +3 -5
  18. package/dist/{FieldCopyTestIdButton-DV0tkdh2.mjs.map → FieldCopyTestIdButton-D3_jZYJ1.mjs.map} +1 -1
  19. package/dist/{FieldDescription-C4l0HKGL.mjs → FieldDescription-X_0s1Lhu.mjs} +5 -6
  20. package/dist/FieldDescription-X_0s1Lhu.mjs.map +1 -0
  21. package/dist/{FieldLabel-DKzqkuY1.mjs → FieldLabel-DrNWJIVh.mjs} +15 -12
  22. package/dist/FieldLabel-DrNWJIVh.mjs.map +1 -0
  23. package/dist/{FieldLayout-BLW5S-Jm.mjs → FieldLayout-DcvQU0zN.mjs} +4 -5
  24. package/dist/{FieldLayout-BLW5S-Jm.mjs.map → FieldLayout-DcvQU0zN.mjs.map} +1 -1
  25. package/dist/FieldReset/index.d.mts +420 -0
  26. package/dist/FieldReset/index.d.mts.map +1 -0
  27. package/dist/FieldReset/index.mjs +258 -0
  28. package/dist/FieldReset/index.mjs.map +1 -0
  29. package/dist/{FieldValidationError-DgkCL3cC.mjs → FieldValidationError-iAayfTEw.mjs} +3 -5
  30. package/dist/{FieldValidationError-DgkCL3cC.mjs.map → FieldValidationError-iAayfTEw.mjs.map} +1 -1
  31. package/dist/Form/index.d.mts +12 -14
  32. package/dist/Form/index.d.mts.map +1 -1
  33. package/dist/Form/index.mjs +7 -10
  34. package/dist/Form/index.mjs.map +1 -1
  35. package/dist/FormContext-BnNJYZOo.d.mts +124 -0
  36. package/dist/FormContext-BnNJYZOo.d.mts.map +1 -0
  37. package/dist/{FormContext-CHctWFAP.mjs → FormContext-PXkVlBdU.mjs} +5 -9
  38. package/dist/{FormContext-CHctWFAP.mjs.map → FormContext-PXkVlBdU.mjs.map} +1 -1
  39. package/dist/Grid/index.d.mts +0 -2
  40. package/dist/Grid/index.d.mts.map +1 -1
  41. package/dist/Grid/index.mjs +1 -1
  42. package/dist/{Grid-DfcZeuib.mjs → Grid-DBL29Kwb.mjs} +3 -5
  43. package/dist/{Grid-DfcZeuib.mjs.map → Grid-DBL29Kwb.mjs.map} +1 -1
  44. package/dist/Input/index.d.mts +167 -115
  45. package/dist/Input/index.d.mts.map +1 -1
  46. package/dist/Input/index.mjs +20 -24
  47. package/dist/Input/index.mjs.map +1 -1
  48. package/dist/RadioBoxes/index.d.mts +226 -2222
  49. package/dist/RadioBoxes/index.d.mts.map +1 -1
  50. package/dist/RadioBoxes/index.mjs +24 -28
  51. package/dist/RadioBoxes/index.mjs.map +1 -1
  52. package/dist/RadioTabs/index.d.mts +121 -66
  53. package/dist/RadioTabs/index.d.mts.map +1 -1
  54. package/dist/RadioTabs/index.mjs +16 -19
  55. package/dist/RadioTabs/index.mjs.map +1 -1
  56. package/dist/Radios/index.d.mts +140 -2056
  57. package/dist/Radios/index.d.mts.map +1 -1
  58. package/dist/Radios/index.mjs +11 -14
  59. package/dist/Radios/index.mjs.map +1 -1
  60. package/dist/Select/index.d.mts +154 -21
  61. package/dist/Select/index.d.mts.map +1 -1
  62. package/dist/Select/index.mjs +65 -49
  63. package/dist/Select/index.mjs.map +1 -1
  64. package/dist/Slider/index.d.mts +143 -77
  65. package/dist/Slider/index.d.mts.map +1 -1
  66. package/dist/Slider/index.mjs +26 -18
  67. package/dist/Slider/index.mjs.map +1 -1
  68. package/dist/SubmitButton/index.d.mts +0 -2
  69. package/dist/SubmitButton/index.d.mts.map +1 -1
  70. package/dist/SubmitButton/index.mjs +2 -4
  71. package/dist/SubmitButton/index.mjs.map +1 -1
  72. package/dist/Switch/index.d.mts +1 -1
  73. package/dist/Switch/index.mjs +16 -18
  74. package/dist/Switch/index.mjs.map +1 -1
  75. package/dist/{Switch-CvPO8IF9.d.mts → Switch-Db2dpGz7.d.mts} +115 -68
  76. package/dist/{Switch-CvPO8IF9.d.mts.map → Switch-Db2dpGz7.d.mts.map} +1 -1
  77. package/dist/SwitchBox/index.d.mts +169 -126
  78. package/dist/SwitchBox/index.d.mts.map +1 -1
  79. package/dist/SwitchBox/index.mjs +18 -18
  80. package/dist/SwitchBox/index.mjs.map +1 -1
  81. package/dist/TextArea/index.d.mts +100 -57
  82. package/dist/TextArea/index.d.mts.map +1 -1
  83. package/dist/TextArea/index.mjs +14 -16
  84. package/dist/TextArea/index.mjs.map +1 -1
  85. package/dist/Time/index.d.mts +44 -28
  86. package/dist/Time/index.d.mts.map +1 -1
  87. package/dist/Time/index.mjs +13 -17
  88. package/dist/Time/index.mjs.map +1 -1
  89. package/dist/helpers/index.d.mts +0 -6
  90. package/dist/helpers/index.d.mts.map +1 -1
  91. package/dist/helpers/index.mjs +3 -6
  92. package/dist/helpers/index.mjs.map +1 -1
  93. package/dist/hooks/useClientValidation/index.d.mts +0 -2
  94. package/dist/hooks/useClientValidation/index.d.mts.map +1 -1
  95. package/dist/hooks/useClientValidation/index.mjs +3 -5
  96. package/dist/hooks/useController/index.d.mts +0 -2
  97. package/dist/hooks/useController/index.d.mts.map +1 -1
  98. package/dist/hooks/useController/index.mjs +2 -3
  99. package/dist/hooks/useFormContext/index.d.mts +31 -52
  100. package/dist/hooks/useFormContext/index.d.mts.map +1 -1
  101. package/dist/hooks/useFormContext/index.mjs +2 -3
  102. package/dist/hooks/useInputValueDebounce/index.d.mts +0 -2
  103. package/dist/hooks/useInputValueDebounce/index.d.mts.map +1 -1
  104. package/dist/hooks/useInputValueDebounce/index.mjs +3 -5
  105. package/dist/hooks/useInputValueTransform/index.d.mts +1 -1
  106. package/dist/hooks/useInputValueTransform/index.mjs +2 -3
  107. package/dist/hooks/useWatchFormReset/index.d.mts +0 -2
  108. package/dist/hooks/useWatchFormReset/index.d.mts.map +1 -1
  109. package/dist/hooks/useWatchFormReset/index.mjs +3 -5
  110. package/dist/hooks/useWatchUserChange/index.d.mts +0 -2
  111. package/dist/hooks/useWatchUserChange/index.d.mts.map +1 -1
  112. package/dist/hooks/useWatchUserChange/index.mjs +3 -5
  113. package/dist/{index-BS8IoBOn.d.mts → index-cevZBrIN.d.mts} +1 -3
  114. package/dist/index-cevZBrIN.d.mts.map +1 -0
  115. package/dist/partials/FieldCopyTestIdButton/index.d.mts +0 -2
  116. package/dist/partials/FieldCopyTestIdButton/index.d.mts.map +1 -1
  117. package/dist/partials/FieldCopyTestIdButton/index.mjs +1 -1
  118. package/dist/partials/FieldValidationError/index.d.mts +11 -13
  119. package/dist/partials/FieldValidationError/index.d.mts.map +1 -1
  120. package/dist/partials/FieldValidationError/index.mjs +1 -1
  121. package/dist/{radioControlVariants-Cm6WufWo.mjs → radioControlVariants-BYRfaD6y.mjs} +24 -25
  122. package/dist/radioControlVariants-BYRfaD6y.mjs.map +1 -0
  123. package/dist/{switchVariants-BaQw2DA7.mjs → switchVariants-D16b2VaT.mjs} +4 -4
  124. package/dist/{switchVariants-BaQw2DA7.mjs.map → switchVariants-D16b2VaT.mjs.map} +1 -1
  125. package/dist/{timeVariants-B9HDfNYt.mjs → timeVariants-CtXyNKmW.mjs} +3 -3
  126. package/dist/{timeVariants-B9HDfNYt.mjs.map → timeVariants-CtXyNKmW.mjs.map} +1 -1
  127. package/dist/{useController-BCFeZbBZ.mjs → useController-JtIeurpw.mjs} +3 -4
  128. package/dist/{useController-BCFeZbBZ.mjs.map → useController-JtIeurpw.mjs.map} +1 -1
  129. package/dist/{useFormContext-BPjJjNnM.mjs → useFormContext-piqnN2L-.mjs} +3 -4
  130. package/dist/useFormContext-piqnN2L-.mjs.map +1 -0
  131. package/dist/{useInputValueTransform-Mw8YEOXT.mjs → useInputValueTransform-CXWWFhy_.mjs} +2 -3
  132. package/dist/{useInputValueTransform-Mw8YEOXT.mjs.map → useInputValueTransform-CXWWFhy_.mjs.map} +1 -1
  133. package/package.json +8 -7
  134. package/dist/FieldDescription-C4l0HKGL.mjs.map +0 -1
  135. package/dist/FieldLabel-DKzqkuY1.mjs.map +0 -1
  136. package/dist/FormContext-CsFiNvuJ.d.mts +0 -19
  137. package/dist/FormContext-CsFiNvuJ.d.mts.map +0 -1
  138. package/dist/index-BS8IoBOn.d.mts.map +0 -1
  139. package/dist/radioControlVariants-Cm6WufWo.mjs.map +0 -1
  140. package/dist/useFormContext-BPjJjNnM.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/RadioBoxes/radioBoxesVariants.ts","../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/subcomponents/radioBoxVariants.ts"],"mappings":";;;qBAMa,sBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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eAAe;KAE9B,YAAY,mBAAmB;UCzC1B;;EAEf,cAAc;;EAEd;;EAEA,OAAO;;EAEP,QAAQ;;EAER;;EAEA;;UAGe,wBAAwB;;EAEvC;;EAEA,YAAY;;EAEZ,cAAc;;EAEd;;EAEA;;EAEA,QAAQ;;EAER;;EAEA,SAAS;;EAET;;EAEA;;;cAII,eAAc,WAAA,QAAA,MAAA,YAAA,qBAMjB,oCAAe,IAAA;qBC/CL,oBAAgB"}
@@ -1,13 +1,13 @@
1
+ import { n as useUniformField } from "../FieldLabel-DrNWJIVh.mjs";
1
2
  import { createOptionValueConverter } from "../helpers/index.mjs";
2
- import { n as useUniformField } from "../FieldLabel-DKzqkuY1.mjs";
3
- import { n as getFieldControlProps } from "../FieldDescription-C4l0HKGL.mjs";
4
- import { t as FieldLayout } from "../FieldLayout-BLW5S-Jm.mjs";
5
- import { i as RadioGroupField, n as RadioControl, r as radioGroupFieldVariants, t as radioControlVariants } from "../radioControlVariants-Cm6WufWo.mjs";
3
+ import { n as getFieldControlProps } from "../FieldDescription-X_0s1Lhu.mjs";
4
+ import { t as FieldLayout } from "../FieldLayout-DcvQU0zN.mjs";
5
+ import { i as RadioGroupField, n as RadioControl, r as radioGroupFieldVariants, t as radioControlVariants } from "../radioControlVariants-BYRfaD6y.mjs";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { slugify, tv } from "@fuf-stack/pixel-utils";
8
8
  import { useStyling } from "@fuf-stack/pixels/StylingProvider";
9
9
  import { Label } from "react-aria-components";
10
- //#region src/RadioBoxes/radioBoxesVariants.ts
10
+ // src/RadioBoxes/radioBoxesVariants.ts
11
11
  const radioBoxesVariants = tv({
12
12
  extend: radioGroupFieldVariants,
13
13
  slots: {
@@ -33,10 +33,10 @@ const radioBoxesVariants = tv({
33
33
  label: "mb-2 inline-flex cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger",
34
34
  /** Container arranging the selectable content */
35
35
  wrapper: "flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row"
36
- }
36
+ },
37
+ variants: { readOnly: { true: { boxBase: "hover:bg-transparent" } } }
37
38
  });
38
- //#endregion
39
- //#region src/RadioBoxes/subcomponents/radioBoxVariants.ts
39
+ // src/RadioBoxes/subcomponents/radioBoxVariants.ts
40
40
  const radioBoxVariants = tv({
41
41
  slots: {
42
42
  /** Container for the field control and supporting text */
@@ -61,8 +61,8 @@ const radioBoxVariants = tv({
61
61
  wrapper: radioControlVariants.slots.wrapper
62
62
  },
63
63
  variants: {
64
- isDisabled: { true: { base: "pointer-events-none opacity-disabled" } },
65
- isInvalid: { true: {
64
+ disabled: { true: { base: "cursor-not-allowed opacity-disabled **:cursor-not-allowed hover:bg-transparent" } },
65
+ invalid: { true: {
66
66
  base: "!border-danger",
67
67
  control: radioControlVariants.variants.invalid.true.control,
68
68
  label: radioControlVariants.variants.invalid.true.label,
@@ -70,44 +70,42 @@ const radioBoxVariants = tv({
70
70
  } }
71
71
  }
72
72
  });
73
- //#endregion
74
- //#region src/RadioBoxes/subcomponents/RadioBox.tsx
73
+ // src/RadioBoxes/subcomponents/RadioBox.tsx
75
74
  /**
76
75
  * Selectable radio box with an icon, supporting text and selection indicator
77
76
  *
78
77
  * @see https://react-aria.adobe.com/RadioGroup
79
78
  */
80
- const RadioBox = ({ className = void 0, classNames: _classNames = void 0, icon = void 0, isInvalid = false, isDisabled = false, description = void 0, children = void 0, value, ...props }) => {
79
+ const RadioBox = ({ className = void 0, classNames: _classNames = void 0, icon = void 0, invalid = false, disabled = false, description = void 0, children = void 0, value, ...props }) => {
81
80
  const styling = useStyling();
82
81
  const variants = styling.resolve(radioBoxVariants, {
83
- isDisabled,
84
- isInvalid
82
+ disabled,
83
+ invalid
85
84
  });
86
85
  const classNames = styling.variantsToClassNames(variants, _classNames ?? className, "base");
87
86
  return /* @__PURE__ */ jsx(RadioControl, {
88
87
  className: classNames,
89
88
  description,
90
- disabled: isDisabled,
89
+ disabled,
91
90
  icon,
92
- invalid: isInvalid,
91
+ invalid,
93
92
  testId: props["data-testid"],
94
93
  value,
95
94
  children
96
95
  });
97
96
  };
98
- //#endregion
99
- //#region src/RadioBoxes/subcomponents/RadioBoxesControl.tsx
97
+ // src/RadioBoxes/subcomponents/RadioBoxesControl.tsx
100
98
  /**
101
99
  * Radio boxes with shared group layout and focus routing
102
100
  *
103
101
  * @see https://react-aria.adobe.com/RadioGroup
104
102
  */
105
103
  const RadioBoxesControl = ({ field, className, inline = false, options }) => {
106
- const { description, disabled, errorMessage, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, required, testId, value } = field;
104
+ const { description, disabled, errorMessage, ids, ref: inputRef, invalid, label, name, onBlur, onChange: onValueChange, readOnly, required, testId, value } = field;
107
105
  const controlProps = getFieldControlProps(field);
108
106
  const styling = useStyling();
109
107
  const { convertToOriginalType } = createOptionValueConverter(options);
110
- const variants = styling.resolve(radioBoxesVariants);
108
+ const variants = styling.resolve(radioBoxesVariants, { readOnly });
111
109
  const classNames = styling.variantsToClassNames(variants, className, "base");
112
110
  const handleChange = (nextValue) => {
113
111
  onValueChange(convertToOriginalType(nextValue));
@@ -124,6 +122,7 @@ const RadioBoxesControl = ({ field, className, inline = false, options }) => {
124
122
  name,
125
123
  onBlur,
126
124
  onChange: handleChange,
125
+ readOnly,
127
126
  required,
128
127
  testId,
129
128
  value
@@ -153,9 +152,9 @@ const RadioBoxesControl = ({ field, className, inline = false, options }) => {
153
152
  },
154
153
  "data-testid": optionTestId,
155
154
  description: option.description,
155
+ disabled: !!disabled || option.disabled,
156
156
  icon: option.icon,
157
- isDisabled: !!disabled || option.disabled,
158
- isInvalid: invalid,
157
+ invalid,
159
158
  value: String(option.value),
160
159
  children: option.label ?? option.value
161
160
  }, String(option.value));
@@ -165,8 +164,7 @@ const RadioBoxesControl = ({ field, className, inline = false, options }) => {
165
164
  })
166
165
  });
167
166
  };
168
- //#endregion
169
- //#region src/RadioBoxes/RadioBoxes.tsx
167
+ // src/RadioBoxes/RadioBoxes.tsx
170
168
  /** Form selection field for one option displayed as a box */
171
169
  const RadioBoxes = ({ className = void 0, inline = false, name, options, ...uniformFieldProps }) => {
172
170
  const { field } = useUniformField({
@@ -180,10 +178,8 @@ const RadioBoxes = ({ className = void 0, inline = false, name, options, ...unif
180
178
  options
181
179
  });
182
180
  };
183
- //#endregion
184
- //#region src/RadioBoxes/index.ts
181
+ // src/RadioBoxes/index.ts
185
182
  var RadioBoxes_default = RadioBoxes;
186
- //#endregion
187
183
  export { RadioBoxes_default as default, radioBoxVariants, radioBoxesVariants };
188
184
 
189
185
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/RadioBoxes/radioBoxesVariants.ts","../../src/RadioBoxes/subcomponents/radioBoxVariants.ts","../../src/RadioBoxes/subcomponents/RadioBox.tsx","../../src/RadioBoxes/subcomponents/RadioBoxesControl.tsx","../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport radioGroupFieldVariants from '../partials/RadioGroupField/radioGroupFieldVariants';\n\nexport const radioBoxesVariants = tv({\n extend: radioGroupFieldVariants,\n slots: {\n /** Container for the field control and supporting text */\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 /** Clickable option box */\n boxBase: '',\n /** Indicator marking the selected box */\n boxControl: '',\n /** Supporting text inside an option box */\n boxDescription: '',\n /** Primary option text */\n boxLabel: '',\n /** Container grouping option text */\n boxLabelWrapper: '',\n /** Container for validation messages */\n errorMessage: 'text-danger text-tiny',\n /** Visible field label */\n label:\n 'mb-2 inline-flex cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n /** Container arranging the selectable content */\n wrapper:\n 'flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row',\n },\n});\n\nexport type VariantProps = TVProps<typeof radioBoxesVariants>;\n\nexport type ClassName = TVClassName<typeof radioBoxesVariants>;\n","import type { TVClassName } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport radioControlVariants from '../../Radios/subcomponents/radioControlVariants';\n\nexport const radioBoxVariants = tv({\n slots: {\n /** Container for the field control and supporting text */\n base: [\n // option box layout\n 'group inline-flex flex-auto cursor-pointer items-center justify-between gap-4',\n // box border and padding\n 'rounded-lg border-2 border-default p-4',\n // hover and selection feedback\n 'hover:bg-content2 data-[selected=true]:border-focus',\n ],\n /** Dot marking the selected option */\n control: radioControlVariants.slots.control,\n /** Supporting text for the field */\n description: 'text-foreground opacity-70 text-small',\n /** Option state boundary without an additional layout box */\n field: radioControlVariants.slots.field,\n /** Decorative icon beside the option text */\n icon: '',\n /** Visible field label */\n label: radioControlVariants.slots.label,\n /** Container grouping the option label and description */\n labelWrapper: [radioControlVariants.slots.labelWrapper, 'grow'],\n /** Circular outline around the selection indicator */\n wrapper: radioControlVariants.slots.wrapper,\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 control: radioControlVariants.variants.invalid.true.control,\n label: radioControlVariants.variants.invalid.true.label,\n wrapper: radioControlVariants.variants.invalid.true.wrapper,\n },\n },\n },\n});\n\nexport type ClassName = TVClassName<typeof radioBoxVariants>;\n","import type { ReactNode } from 'react';\nimport type { ClassName } from './radioBoxVariants';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport RadioControl from '../../Radios/subcomponents/RadioControl';\nimport { radioBoxVariants } from './radioBoxVariants';\n\nexport interface RadioBoxProps {\n /** Option label. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Legacy alias for className */\n classNames?: ClassName;\n /** HTML test ID for the option. */\n 'data-testid'?: string;\n /** Help text associated with the field */\n description?: ReactNode;\n /** icon for the option */\n icon?: ReactNode;\n /** Whether the option is disabled. */\n isDisabled?: boolean;\n /** whether the radio is invalid */\n isInvalid?: boolean;\n /** String value managed by the containing radio group. */\n value: string;\n}\n\n/**\n * Selectable radio box with an icon, supporting text and selection indicator\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nexport const RadioBox = ({\n className = undefined,\n classNames: _classNames = undefined,\n icon = undefined,\n isInvalid = false,\n isDisabled = false,\n description = undefined,\n children = undefined,\n value,\n ...props\n}: RadioBoxProps) => {\n const styling = useStyling();\n\n // classNames from slots\n const variants = styling.resolve(radioBoxVariants, { isDisabled, isInvalid });\n const classNames = styling.variantsToClassNames(\n variants,\n _classNames ?? className,\n 'base',\n );\n\n return (\n <RadioControl\n className={classNames}\n description={description}\n disabled={isDisabled}\n icon={icon}\n invalid={isInvalid}\n testId={props['data-testid']}\n value={value}\n >\n {children}\n </RadioControl>\n );\n};\n\nexport default RadioBox;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { RadioBoxesProps } from '../RadioBoxes';\n\nimport { Label } from 'react-aria-components';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { createOptionValueConverter } from '../../helpers';\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport RadioGroupField from '../../partials/RadioGroupField/RadioGroupField';\nimport { radioBoxesVariants } from '../radioBoxesVariants';\nimport { RadioBox } from './RadioBox';\n\ninterface RadioBoxesControlProps extends Pick<\n RadioBoxesProps,\n 'className' | 'inline' | 'options'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string | number | boolean>;\n}\n\n/**\n * Radio boxes with shared group layout and focus routing\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioBoxesControl = ({\n field,\n className,\n inline = false,\n options,\n}: RadioBoxesControlProps) => {\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\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = styling.resolve(radioBoxesVariants);\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n // restore the selected option's original value type\n const handleChange = (nextValue: string) => {\n onValueChange(convertToOriginalType(nextValue));\n };\n\n return (\n <FieldLayout\n baseAs={RadioGroupField}\n baseProps={{\n controlProps,\n dataComponent: 'radio-boxes',\n disabled,\n inline,\n inputRef,\n invalid,\n name,\n onBlur,\n onChange: handleChange,\n required,\n testId,\n value,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n labelAs={Label}\n required={required}\n >\n <div\n className={classNames.wrapper}\n data-orientation={inline ? 'horizontal' : 'vertical'}\n data-slot=\"wrapper\"\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 className={{\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n }}\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 </div>\n </FieldLayout>\n );\n};\n\nexport default RadioBoxesControl;\n","import type { ReactNode } from 'react';\nimport type { ClassName, VariantProps } from './radioBoxesVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport RadioBoxesControl from './subcomponents/RadioBoxesControl';\n\nexport { radioBoxesVariants } from './radioBoxesVariants';\n\nexport interface RadioBoxOption {\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** option icon */\n icon?: ReactNode;\n /** Field label */\n label?: ReactNode;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadioBoxesProps extends VariantProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Arranges options horizontally */\n inline?: boolean;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** Available options */\n options: RadioBoxOption[];\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\n/** Form selection field for one option displayed as a box */\nconst RadioBoxes = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadioBoxesProps) => {\n const { field } = useUniformField({ ...uniformFieldProps, name });\n\n return (\n <RadioBoxesControl\n className={className}\n field={field}\n inline={inline}\n options={options}\n />\n );\n};\n\nexport default RadioBoxes;\n","import RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps, RadioBoxOption } from './RadioBoxes';\n\nexport { radioBoxesVariants } from './radioBoxesVariants';\n\nexport { radioBoxVariants } from './subcomponents/radioBoxVariants';\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;;;;AAMA,MAAa,qBAAqB,GAAG;CACnC,QAAQ;CACR,OAAO;;EAEL,MAAM;GAEJ;GAEA;GAEA;EACF;;EAEA,SAAS;;EAET,YAAY;;EAEZ,gBAAgB;;EAEhB,UAAU;;EAEV,iBAAiB;;EAEjB,cAAc;;EAEd,OACE;;EAEF,SACE;CACJ;AACF,CAAC;;;AC/BD,MAAa,mBAAmB,GAAG;CACjC,OAAO;;EAEL,MAAM;GAEJ;GAEA;GAEA;EACF;;EAEA,SAAS,qBAAqB,MAAM;;EAEpC,aAAa;;EAEb,OAAO,qBAAqB,MAAM;;EAElC,MAAM;;EAEN,OAAO,qBAAqB,MAAM;;EA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GACA;GACA;GACA;GACA,UAAU;GACV;GACA;GACA;EACF;EACA,WAAW;EACE;EACC;EACT;EACI;EACF;EACP,SAAS;EACC;EAEV,UAAA,oBAAC,OAAD;GACE,WAAW,WAAW;GACtB,oBAAkB,SAAS,eAAe;GAC1C,aAAU;GAET,UAAA,QAAQ,KAAK,WAAW;IACvB,IAAI,WAAW,QAAQ;KACrB,MAAM,eAAe,QACnB,GAAG,OAAO,UAAU,OAAO,UAAU,OAAO,SAC5C,EAAE,aAAa,KAAK,CACtB;KACA,OACE,oBAAC,UAAD;MAEE,WAAW;OACT,MAAM,WAAW;OACjB,SAAS,WAAW;OACpB,aAAa,WAAW;OACxB,OAAO,WAAW;OAClB,cAAc,WAAW;MAC3B;MACA,eAAa;MACb,aAAa,OAAO;MACpB,MAAM,OAAO;MACb,YAAY,CAAC,CAAC,YAAY,OAAO;MACjC,WAAW;MACX,OAAO,OAAO,OAAO,KAAK;MAEzB,UAAA,OAAO,SAAS,OAAO;KAChB,GAhBH,OAAO,OAAO,KAAK,CAgBhB;IAEd;IACA,OAAO;GACT,CAAC;EACE,CAAA;CACM,CAAA;AAEjB;;;;ACpFA,MAAM,cAAc,EAClB,YAAY,KAAA,GACZ,SAAS,OACT,MACA,SACA,GAAG,wBACkB;CACrB,MAAM,EAAE,UAAU,gBAAgB;EAAE,GAAG;EAAmB;CAAK,CAAC;CAEhE,OACE,oBAAC,mBAAD;EACa;EACJ;EACC;EACC;CACV,CAAA;AAEL;;;ACtDA,IAAA,qBAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/RadioBoxes/radioBoxesVariants.ts","../../src/RadioBoxes/subcomponents/radioBoxVariants.ts","../../src/RadioBoxes/subcomponents/RadioBox.tsx","../../src/RadioBoxes/subcomponents/RadioBoxesControl.tsx","../../src/RadioBoxes/RadioBoxes.tsx","../../src/RadioBoxes/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport radioGroupFieldVariants from '../partials/RadioGroupField/radioGroupFieldVariants';\n\nexport const radioBoxesVariants = tv({\n extend: radioGroupFieldVariants,\n slots: {\n /** Container for the field control and supporting text */\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 /** Clickable option box */\n boxBase: '',\n /** Indicator marking the selected box */\n boxControl: '',\n /** Supporting text inside an option box */\n boxDescription: '',\n /** Primary option text */\n boxLabel: '',\n /** Container grouping option text */\n boxLabelWrapper: '',\n /** Container for validation messages */\n errorMessage: 'text-danger text-tiny',\n /** Visible field label */\n label:\n 'mb-2 inline-flex cursor-default text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n /** Container arranging the selectable content */\n wrapper:\n 'flex flex-col flex-wrap gap-2 data-[orientation=horizontal]:flex-row',\n },\n variants: {\n readOnly: {\n true: {\n // drop hover feedback so read-only boxes do not look clickable\n boxBase: 'hover:bg-transparent',\n },\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof radioBoxesVariants>;\n\nexport type ClassName = TVClassName<typeof radioBoxesVariants>;\n","import type { TVClassName } from '@fuf-stack/pixel-utils';\n\nimport { tv } from '@fuf-stack/pixel-utils';\n\nimport radioControlVariants from '../../Radios/subcomponents/radioControlVariants';\n\nexport const radioBoxVariants = tv({\n slots: {\n /** Container for the field control and supporting text */\n base: [\n // option box layout\n 'group inline-flex flex-auto cursor-pointer items-center justify-between gap-4',\n // box border and padding\n 'rounded-lg border-2 border-default p-4',\n // hover and selection feedback\n 'hover:bg-content2 data-[selected=true]:border-focus',\n ],\n /** Dot marking the selected option */\n control: radioControlVariants.slots.control,\n /** Supporting text for the field */\n description: 'text-foreground opacity-70 text-small',\n /** Option state boundary without an additional layout box */\n field: radioControlVariants.slots.field,\n /** Decorative icon beside the option text */\n icon: '',\n /** Visible field label */\n label: radioControlVariants.slots.label,\n /** Container grouping the option label and description */\n labelWrapper: [radioControlVariants.slots.labelWrapper, 'grow'],\n /** Circular outline around the selection indicator */\n wrapper: radioControlVariants.slots.wrapper,\n },\n variants: {\n disabled: {\n true: {\n // keep pointer events so the disabled cursor shows, the input blocks changes\n base: 'cursor-not-allowed opacity-disabled **:cursor-not-allowed hover:bg-transparent',\n },\n },\n invalid: {\n true: {\n base: '!border-danger',\n control: radioControlVariants.variants.invalid.true.control,\n label: radioControlVariants.variants.invalid.true.label,\n wrapper: radioControlVariants.variants.invalid.true.wrapper,\n },\n },\n },\n});\n\nexport type ClassName = TVClassName<typeof radioBoxVariants>;\n","import type { ReactNode } from 'react';\nimport type { ClassName } from './radioBoxVariants';\n\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport RadioControl from '../../Radios/subcomponents/RadioControl';\nimport { radioBoxVariants } from './radioBoxVariants';\n\nexport interface RadioBoxProps {\n /** Option label. */\n children?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Legacy alias for className */\n classNames?: ClassName;\n /** HTML test ID for the option. */\n 'data-testid'?: string;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the option */\n disabled?: boolean;\n /** icon for the option */\n icon?: ReactNode;\n /** Marks the option as invalid */\n invalid?: boolean;\n /** String value managed by the containing radio group. */\n value: string;\n}\n\n/**\n * Selectable radio box with an icon, supporting text and selection indicator\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nexport const RadioBox = ({\n className = undefined,\n classNames: _classNames = undefined,\n icon = undefined,\n invalid = false,\n disabled = false,\n description = undefined,\n children = undefined,\n value,\n ...props\n}: RadioBoxProps) => {\n const styling = useStyling();\n\n // classNames from slots\n const variants = styling.resolve(radioBoxVariants, { disabled, invalid });\n const classNames = styling.variantsToClassNames(\n variants,\n _classNames ?? className,\n 'base',\n );\n\n return (\n <RadioControl\n className={classNames}\n description={description}\n disabled={disabled}\n icon={icon}\n invalid={invalid}\n testId={props['data-testid']}\n value={value}\n >\n {children}\n </RadioControl>\n );\n};\n\nexport default RadioBox;\n","import type { UniformField } from '../../hooks/useUniformField/types';\nimport type { RadioBoxesProps } from '../RadioBoxes';\n\nimport { Label } from 'react-aria-components';\n\nimport { slugify } from '@fuf-stack/pixel-utils';\nimport { useStyling } from '@fuf-stack/pixels/StylingProvider';\n\nimport { createOptionValueConverter } from '../../helpers';\nimport { getFieldControlProps } from '../../helpers/fieldProps/fieldProps';\nimport FieldLayout from '../../partials/FieldLayout/FieldLayout';\nimport RadioGroupField from '../../partials/RadioGroupField/RadioGroupField';\nimport { radioBoxesVariants } from '../radioBoxesVariants';\nimport { RadioBox } from './RadioBox';\n\ninterface RadioBoxesControlProps extends Pick<\n RadioBoxesProps,\n 'className' | 'inline' | 'options'\n> {\n /** Bound field values, interactions and metadata */\n field: UniformField<unknown, string | number | boolean>;\n}\n\n/**\n * Radio boxes with shared group layout and focus routing\n *\n * @see https://react-aria.adobe.com/RadioGroup\n */\nconst RadioBoxesControl = ({\n field,\n className,\n inline = false,\n options,\n}: RadioBoxesControlProps) => {\n const {\n description,\n disabled,\n errorMessage,\n ids,\n ref: inputRef,\n invalid,\n label,\n name,\n onBlur,\n onChange: onValueChange,\n readOnly,\n required,\n testId,\n value,\n } = field;\n\n // associate the editable control with its label and messages\n const controlProps = getFieldControlProps(field);\n\n const styling = useStyling();\n\n const { convertToOriginalType } = createOptionValueConverter(options);\n\n // classNames from slots\n const variants = styling.resolve(radioBoxesVariants, { readOnly });\n const classNames = styling.variantsToClassNames(variants, className, 'base');\n\n // restore the selected option's original value type\n const handleChange = (nextValue: string) => {\n onValueChange(convertToOriginalType(nextValue));\n };\n\n return (\n <FieldLayout\n baseAs={RadioGroupField}\n baseProps={{\n controlProps,\n dataComponent: 'radio-boxes',\n disabled,\n inline,\n inputRef,\n invalid,\n name,\n onBlur,\n onChange: handleChange,\n readOnly,\n required,\n testId,\n value,\n }}\n className={classNames}\n description={description}\n errorMessage={errorMessage}\n ids={ids}\n invalid={invalid}\n label={label}\n labelAs={Label}\n required={required}\n >\n <div\n className={classNames.wrapper}\n data-orientation={inline ? 'horizontal' : 'vertical'}\n data-slot=\"wrapper\"\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 className={{\n base: classNames.boxBase,\n control: classNames.boxControl,\n description: classNames.boxDescription,\n label: classNames.boxLabel,\n labelWrapper: classNames.boxLabelWrapper,\n }}\n data-testid={optionTestId}\n description={option.description}\n disabled={!!disabled || option.disabled}\n icon={option.icon}\n invalid={invalid}\n value={String(option.value)}\n >\n {option.label ?? option.value}\n </RadioBox>\n );\n }\n return null;\n })}\n </div>\n </FieldLayout>\n );\n};\n\nexport default RadioBoxesControl;\n","import type { ReactNode } from 'react';\nimport type { ClassName, VariantProps } from './radioBoxesVariants';\n\nimport useUniformField from '../hooks/useUniformField/useUniformField';\nimport RadioBoxesControl from './subcomponents/RadioBoxesControl';\n\nexport { radioBoxesVariants } from './radioBoxesVariants';\n\nexport interface RadioBoxOption {\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** option icon */\n icon?: ReactNode;\n /** Field label */\n label?: ReactNode;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n /** option value */\n value: string | number;\n}\n\nexport interface RadioBoxesProps extends VariantProps {\n /** Custom accessible name */\n ariaLabel?: string;\n /** CSS class name */\n className?: ClassName;\n /** Help text associated with the field */\n description?: ReactNode;\n /** Disables the field */\n disabled?: boolean;\n /** Arranges options horizontally */\n inline?: boolean;\n /** Field label */\n label?: ReactNode;\n /** Field name */\n name: string;\n /** Available options */\n options: RadioBoxOption[];\n /** Prevents changes while keeping the selection in validation and submission */\n readOnly?: boolean;\n /** HTML data-testid attribute for e2e tests */\n testId?: string;\n}\n\n/** Form selection field for one option displayed as a box */\nconst RadioBoxes = ({\n className = undefined,\n inline = false,\n name,\n options,\n ...uniformFieldProps\n}: RadioBoxesProps) => {\n const { field } = useUniformField({ ...uniformFieldProps, name });\n\n return (\n <RadioBoxesControl\n className={className}\n field={field}\n inline={inline}\n options={options}\n />\n );\n};\n\nexport default RadioBoxes;\n","import RadioBoxes from './RadioBoxes';\n\nexport type { RadioBoxesProps, RadioBoxOption } from './RadioBoxes';\n\nexport { radioBoxesVariants } from './radioBoxesVariants';\n\nexport { radioBoxVariants } from './subcomponents/radioBoxVariants';\n\nexport default RadioBoxes;\n"],"mappings":";;;;;;;;;;AAMA,MAAa,qBAAqB,GAAG;CACnC,QAAQ;CACR,OAAO;;EAEL,MAAM;GAEJ;GAEA;GAEA;EACF;;EAEA,SAAS;;EAET,YAAY;;EAEZ,gBAAgB;;EAEhB,UAAU;;EAEV,iBAAiB;;EAEjB,cAAc;;EAEd,OACE;;EAEF,SACE;CACJ;CACA,UAAU,EACR,UAAU,EACR,MAAM,EAEJ,SAAS,uBACX,EACF,EACF;AACF,CAAC;;ACvCD,MAAa,mBAAmB,GAAG;CACjC,OAAO;;EAEL,MAAM;GAEJ;GAEA;GAEA;EACF;;EAEA,SAAS,qBAAqB,MAAM;;EAEpC,aAAa;;EAEb,OAAO,qBAAqB,MAAM;;EAElC,MAAM;;EAEN,OAAO,qBAAqB,MAAM;;EAElC,cAAc,CAAC,qBAAqB,MAAM,cAAc,MAAM;;EAE9D,SAAS,qBAAqB,MAAM;CACtC;CACA,UAAU;EACR,UAAU,EACR,MAAM,EAEJ,MAAM,iFACR,EACF;EACA,SAAS,EACP,MAAM;GACJ,MAAM;GACN,SAAS,qBAAqB,SAAS,QAAQ,KAAK;GACpD,OAAO,qBAAqB,SAAS,QAAQ,KAAK;GAClD,SAAS,qBAAqB,SAAS,QAAQ,KAAK;EACtD,EACF;CACF;AACF,CAAC;;;;;;;ACdD,MAAa,YAAY,EACvB,YAAY,KAAA,GACZ,YAAY,cAAc,KAAA,GAC1B,OAAO,KAAA,GACP,UAAU,OACV,WAAW,OACX,cAAc,KAAA,GACd,WAAW,K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