@fuf-stack/uniform 0.10.3 → 0.11.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 (130) hide show
  1. package/dist/CheckboxGroup/index.cjs +4 -3
  2. package/dist/CheckboxGroup/index.cjs.map +1 -1
  3. package/dist/CheckboxGroup/index.d.cts +2 -2
  4. package/dist/CheckboxGroup/index.d.ts +2 -2
  5. package/dist/CheckboxGroup/index.js +3 -2
  6. package/dist/Controller/index.cjs +9 -0
  7. package/dist/Controller/index.cjs.map +1 -0
  8. package/dist/Controller/index.d.cts +4 -0
  9. package/dist/Controller/index.d.ts +4 -0
  10. package/dist/Controller/index.js +9 -0
  11. package/dist/Controller/index.js.map +1 -0
  12. package/dist/FieldArray/index.cjs +3 -3
  13. package/dist/FieldArray/index.cjs.map +1 -1
  14. package/dist/FieldArray/index.js +2 -2
  15. package/dist/Form/index.cjs +3 -3
  16. package/dist/Form/index.cjs.map +1 -1
  17. package/dist/Form/index.js +2 -2
  18. package/dist/Grid/index.cjs.map +1 -1
  19. package/dist/Input/index.cjs +4 -3
  20. package/dist/Input/index.cjs.map +1 -1
  21. package/dist/Input/index.js +3 -2
  22. package/dist/RadioGroup/index.cjs +4 -3
  23. package/dist/RadioGroup/index.cjs.map +1 -1
  24. package/dist/RadioGroup/index.d.cts +3 -2
  25. package/dist/RadioGroup/index.d.ts +3 -2
  26. package/dist/RadioGroup/index.js +3 -2
  27. package/dist/{RadioGroup-D_kiBt0M.d.cts → RadioGroup-DEwUwnRi.d.cts} +50 -9
  28. package/dist/{RadioGroup-D_kiBt0M.d.ts → RadioGroup-DEwUwnRi.d.ts} +50 -9
  29. package/dist/Select/index.cjs +4 -3
  30. package/dist/Select/index.cjs.map +1 -1
  31. package/dist/Select/index.d.cts +2 -2
  32. package/dist/Select/index.d.ts +2 -2
  33. package/dist/Select/index.js +3 -2
  34. package/dist/SubmitButton/index.cjs +3 -3
  35. package/dist/SubmitButton/index.cjs.map +1 -1
  36. package/dist/SubmitButton/index.js +2 -2
  37. package/dist/Switch/index.cjs +4 -3
  38. package/dist/Switch/index.cjs.map +1 -1
  39. package/dist/Switch/index.d.cts +2 -2
  40. package/dist/Switch/index.d.ts +2 -2
  41. package/dist/Switch/index.js +3 -2
  42. package/dist/TextArea/index.cjs +4 -3
  43. package/dist/TextArea/index.cjs.map +1 -1
  44. package/dist/TextArea/index.js +3 -2
  45. package/dist/{chunk-2OVE7FAF.cjs → chunk-4DP5IMTU.cjs} +3 -3
  46. package/dist/chunk-4DP5IMTU.cjs.map +1 -0
  47. package/dist/{chunk-OX2WPUIY.js → chunk-4F2PNEJZ.js} +5 -3
  48. package/dist/chunk-4F2PNEJZ.js.map +1 -0
  49. package/dist/{chunk-AWAGKOHK.js → chunk-4FDD5XNY.js} +5 -3
  50. package/dist/chunk-4FDD5XNY.js.map +1 -0
  51. package/dist/chunk-6GN255GP.cjs.map +1 -1
  52. package/dist/chunk-BBB4FEY6.cjs.map +1 -1
  53. package/dist/{chunk-TCL7YWB6.cjs → chunk-BKX5WAKS.cjs} +7 -5
  54. package/dist/chunk-BKX5WAKS.cjs.map +1 -0
  55. package/dist/{chunk-R3Q52RLG.cjs → chunk-D6NOYVFK.cjs} +7 -5
  56. package/dist/chunk-D6NOYVFK.cjs.map +1 -0
  57. package/dist/{chunk-D3E4GLA2.js → chunk-IK6UDQYZ.js} +3 -3
  58. package/dist/{chunk-D3E4GLA2.js.map → chunk-IK6UDQYZ.js.map} +1 -1
  59. package/dist/{chunk-5S7YSUSV.js → chunk-J4IZIB6S.js} +5 -3
  60. package/dist/chunk-J4IZIB6S.js.map +1 -0
  61. package/dist/{chunk-JM2PZT2K.js → chunk-JFJSEJ4F.js} +3 -3
  62. package/dist/chunk-JFJSEJ4F.js.map +1 -0
  63. package/dist/chunk-JU5RT22Y.cjs.map +1 -1
  64. package/dist/chunk-KOKIM2ND.js +9 -0
  65. package/dist/chunk-KOKIM2ND.js.map +1 -0
  66. package/dist/{chunk-3HCROPXY.cjs → chunk-MFFQUEAY.cjs} +7 -5
  67. package/dist/chunk-MFFQUEAY.cjs.map +1 -0
  68. package/dist/chunk-OHJYXA6R.cjs.map +1 -1
  69. package/dist/{chunk-R4ILETYI.js → chunk-PGQLFSIL.js} +5 -1
  70. package/dist/chunk-PGQLFSIL.js.map +1 -0
  71. package/dist/{chunk-G5H3WD7X.cjs → chunk-QGEY2AVG.cjs} +6 -6
  72. package/dist/chunk-QGEY2AVG.cjs.map +1 -0
  73. package/dist/{chunk-TYJNJH65.js → chunk-R6U3M5P5.js} +5 -3
  74. package/dist/chunk-R6U3M5P5.js.map +1 -0
  75. package/dist/{chunk-OBNBG56H.cjs → chunk-SRAFHMB2.cjs} +7 -5
  76. package/dist/chunk-SRAFHMB2.cjs.map +1 -0
  77. package/dist/{chunk-YQH5YPBW.cjs → chunk-TGB5Q7VB.cjs} +5 -5
  78. package/dist/chunk-TGB5Q7VB.cjs.map +1 -0
  79. package/dist/{chunk-QKF4FL3X.cjs → chunk-TGWUBBKI.cjs} +96 -56
  80. package/dist/chunk-TGWUBBKI.cjs.map +1 -0
  81. package/dist/{chunk-ZZCZS4QM.js → chunk-U4IDHTW5.js} +2 -2
  82. package/dist/chunk-VQWKXSHW.cjs +9 -0
  83. package/dist/chunk-VQWKXSHW.cjs.map +1 -0
  84. package/dist/{chunk-6QXNSRCS.js → chunk-WLYFBQVU.js} +5 -3
  85. package/dist/chunk-WLYFBQVU.js.map +1 -0
  86. package/dist/{chunk-Z7ETEIY7.cjs → chunk-WPWPZNSG.cjs} +7 -3
  87. package/dist/chunk-WPWPZNSG.cjs.map +1 -0
  88. package/dist/{chunk-XJULYTGW.js → chunk-WXFWWEJ3.js} +93 -53
  89. package/dist/chunk-WXFWWEJ3.js.map +1 -0
  90. package/dist/{chunk-F23KFEVZ.cjs → chunk-ZQ75EBWB.cjs} +7 -5
  91. package/dist/chunk-ZQ75EBWB.cjs.map +1 -0
  92. package/dist/helpers/index.cjs.map +1 -1
  93. package/dist/hooks/index.cjs +4 -2
  94. package/dist/hooks/index.cjs.map +1 -1
  95. package/dist/hooks/index.d.cts +5 -4
  96. package/dist/hooks/index.d.ts +5 -4
  97. package/dist/hooks/index.js +3 -1
  98. package/dist/index.cjs +17 -11
  99. package/dist/index.cjs.map +1 -1
  100. package/dist/index.d.cts +6 -5
  101. package/dist/index.d.ts +6 -5
  102. package/dist/index.js +17 -11
  103. package/dist/partials/FieldCopyTestIdButton/index.cjs.map +1 -1
  104. package/dist/partials/FieldValidationError/index.cjs.map +1 -1
  105. package/package.json +17 -11
  106. package/dist/chunk-2OVE7FAF.cjs.map +0 -1
  107. package/dist/chunk-3HCROPXY.cjs.map +0 -1
  108. package/dist/chunk-5S7YSUSV.js.map +0 -1
  109. package/dist/chunk-6QXNSRCS.js.map +0 -1
  110. package/dist/chunk-AWAGKOHK.js.map +0 -1
  111. package/dist/chunk-F23KFEVZ.cjs.map +0 -1
  112. package/dist/chunk-G5H3WD7X.cjs.map +0 -1
  113. package/dist/chunk-JM2PZT2K.js.map +0 -1
  114. package/dist/chunk-OBNBG56H.cjs.map +0 -1
  115. package/dist/chunk-OX2WPUIY.js.map +0 -1
  116. package/dist/chunk-QKF4FL3X.cjs.map +0 -1
  117. package/dist/chunk-R3Q52RLG.cjs.map +0 -1
  118. package/dist/chunk-R4ILETYI.js.map +0 -1
  119. package/dist/chunk-TCL7YWB6.cjs.map +0 -1
  120. package/dist/chunk-TYJNJH65.js.map +0 -1
  121. package/dist/chunk-XJULYTGW.js.map +0 -1
  122. package/dist/chunk-YQH5YPBW.cjs.map +0 -1
  123. package/dist/chunk-Z7ETEIY7.cjs.map +0 -1
  124. package/dist/{CheckboxGroup-o-qWkWe1.d.cts → CheckboxGroup-DYxaS51b.d.cts} +5 -5
  125. package/dist/{CheckboxGroup-o-qWkWe1.d.ts → CheckboxGroup-DYxaS51b.d.ts} +5 -5
  126. package/dist/{Select-BhS4z0Pj.d.cts → Select-Da_AtPOX.d.cts} +15 -15
  127. package/dist/{Select-BhS4z0Pj.d.ts → Select-Da_AtPOX.d.ts} +15 -15
  128. package/dist/{Switch-Fdldj8LV.d.cts → Switch-Coq_VhBW.d.cts} +5 -5
  129. package/dist/{Switch-Fdldj8LV.d.ts → Switch-Coq_VhBW.d.ts} +5 -5
  130. /package/dist/{chunk-ZZCZS4QM.js.map → chunk-U4IDHTW5.js.map} +0 -0
@@ -1,4 +1,7 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunkVQWKXSHWcjs = require('./chunk-VQWKXSHW.cjs');
4
+
2
5
 
3
6
  var _chunkJU5RT22Ycjs = require('./chunk-JU5RT22Y.cjs');
4
7
 
@@ -6,16 +9,16 @@ var _chunkJU5RT22Ycjs = require('./chunk-JU5RT22Y.cjs');
6
9
  var _chunkOHJYXA6Rcjs = require('./chunk-OHJYXA6R.cjs');
7
10
 
8
11
 
9
- var _chunkZ7ETEIY7cjs = require('./chunk-Z7ETEIY7.cjs');
12
+ var _chunkWPWPZNSGcjs = require('./chunk-WPWPZNSG.cjs');
10
13
 
11
14
 
12
15
  var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
13
16
 
14
17
  // src/RadioGroup/RadioGroup.tsx
15
- var _reacthookform = require('react-hook-form');
16
18
  var _radio = require('@nextui-org/radio');
17
19
  var _pixelutils = require('@fuf-stack/pixel-utils');
18
20
  var _pixels = require('@fuf-stack/pixels');
21
+ var _Tabs = require('@fuf-stack/pixels/Tabs'); var _Tabs2 = _interopRequireDefault(_Tabs);
19
22
 
20
23
  // src/RadioGroup/Variants/RadioBox.tsx
21
24
 
@@ -104,14 +107,21 @@ var radioGroupVariants = _pixelutils.tv.call(void 0, {
104
107
  itemBase: "",
105
108
  itemBaseActive: "bg-opacity-50",
106
109
  // optional if a button group is used
107
- itemControl: "",
110
+ itemControl: "bg-focus group-data-[invalid=true]:bg-danger",
108
111
  itemDescription: "",
109
112
  itemLabel: "text-sm",
110
113
  itemLabelWrapper: "",
111
- itemWrapper: "",
114
+ itemWrapper: 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid="true"]):not(group-data-[selected="false"])]:border-focus',
115
+ // TODO: get rid of !.
112
116
  // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts
113
- label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger",
114
- wrapper: ""
117
+ label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger",
118
+ wrapper: "",
119
+ // Tabs
120
+ tabList: "",
121
+ tab: "",
122
+ tabContent: "",
123
+ cursor: "",
124
+ panel: ""
115
125
  }
116
126
  });
117
127
  var RadioGroup = ({
@@ -124,14 +134,14 @@ var RadioGroup = ({
124
134
  testId: _testId = void 0,
125
135
  variant = "default"
126
136
  }) => {
127
- const { control, debugMode, getFieldState, getValues } = _chunkZ7ETEIY7cjs.useFormContext.call(void 0, );
137
+ const { control, debugMode, getFieldState, getValues } = _chunkWPWPZNSGcjs.useFormContext.call(void 0, );
128
138
  const { error, invalid, required, testId } = getFieldState(name, _testId);
129
139
  const showTestIdCopyButton = debugMode === "debug-testids";
130
140
  const showLabel = label || showTestIdCopyButton;
131
141
  const variants = radioGroupVariants();
132
142
  const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
133
143
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
134
- _reacthookform.Controller,
144
+ _chunkVQWKXSHWcjs.Controller,
135
145
  {
136
146
  control,
137
147
  disabled,
@@ -144,60 +154,90 @@ var RadioGroup = ({
144
154
  description: classNames.itemDescription,
145
155
  label: classNames.itemLabel,
146
156
  labelWrapper: classNames.itemLabelWrapper,
147
- wrapper: classNames.itemWrapper
157
+ wrapper: classNames.itemWrapper,
158
+ tabList: classNames.tabList,
159
+ tab: classNames.tab,
160
+ tabContent: classNames.tabContent,
161
+ cursor: classNames.cursor,
162
+ panel: classNames.panel
148
163
  };
149
164
  switch (variant) {
150
165
  case "radioBox":
151
- RadioComponents = options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
152
- RadioBox,
153
- {
154
- classNames: itemClassNames,
155
- "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
156
- `${testId}_option_${option.testId || option.value}`
157
- ),
158
- description: option.description,
159
- icon: option.icon,
160
- isDisabled: isDisabled || option.disabled,
161
- onChange,
162
- value: option.value,
163
- children: option.label ? option.label : option.value
164
- },
165
- option.value
166
- ));
166
+ RadioComponents = options.map((option) => {
167
+ if ("value" in option) {
168
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
169
+ RadioBox,
170
+ {
171
+ classNames: itemClassNames,
172
+ "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
173
+ `${testId}_option_${option.testId || option.value}`
174
+ ),
175
+ description: option.description,
176
+ icon: option.icon,
177
+ isDisabled: isDisabled || option.disabled,
178
+ onChange,
179
+ value: option.value,
180
+ children: option.label ? option.label : option.value
181
+ },
182
+ option.value
183
+ );
184
+ }
185
+ return null;
186
+ });
167
187
  break;
168
188
  case "radioButton":
169
- RadioComponents = options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
170
- RadioButton,
189
+ RadioComponents = options.map((option) => {
190
+ if ("value" in option) {
191
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
192
+ RadioButton,
193
+ {
194
+ className: _pixelutils.cn.call(void 0, classNames.itemBase, {
195
+ [classNames.itemBaseActive]: getValues()[name] !== option.value
196
+ }),
197
+ isDisabled: isDisabled || option.disabled,
198
+ testID: _chunkBBB4FEY6cjs.slugify.call(void 0,
199
+ `${testId}_option_${option.testId || option.value}`
200
+ ),
201
+ onChange,
202
+ value: option.value,
203
+ children: option.label ? option.label : option.value
204
+ },
205
+ option.value
206
+ );
207
+ }
208
+ return null;
209
+ });
210
+ break;
211
+ case "tabs":
212
+ RadioComponents = /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
213
+ _Tabs2.default,
171
214
  {
172
- className: _pixelutils.cn.call(void 0, classNames.itemBase, {
173
- [classNames.itemBaseActive]: getValues()[name] !== option.value
174
- }),
175
- isDisabled: isDisabled || option.disabled,
176
- testID: _chunkBBB4FEY6cjs.slugify.call(void 0,
177
- `${testId}_option_${option.testId || option.value}`
178
- ),
179
- onChange,
180
- value: option.value,
181
- children: option.label ? option.label : option.value
182
- },
183
- option.value
184
- ));
215
+ fullWidth: false,
216
+ tabs: options,
217
+ onSelectionChange: onChange
218
+ }
219
+ );
185
220
  break;
186
221
  default:
187
- RadioComponents = options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
188
- _radio.Radio,
189
- {
190
- classNames: itemClassNames,
191
- "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
192
- `${testId}_option_${option.testId || option.value}`
193
- ),
194
- isDisabled: isDisabled || option.disabled,
195
- onChange,
196
- value: option.value,
197
- children: option.label ? option.label : option.value
198
- },
199
- option.value
200
- ));
222
+ RadioComponents = options.map((option) => {
223
+ if ("value" in option) {
224
+ return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
225
+ _radio.Radio,
226
+ {
227
+ classNames: itemClassNames,
228
+ "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
229
+ `${testId}_option_${option.testId || option.value}`
230
+ ),
231
+ isDisabled: isDisabled || option.disabled,
232
+ onChange,
233
+ value: option.value,
234
+ children: option.label ? option.label : option.value
235
+ },
236
+ option.value
237
+ );
238
+ }
239
+ return null;
240
+ });
201
241
  }
202
242
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
203
243
  _radio.RadioGroup,
@@ -236,4 +276,4 @@ var RadioGroup_default2 = RadioGroup_default;
236
276
 
237
277
 
238
278
  exports.RadioGroup_default = RadioGroup_default; exports.RadioGroup_default2 = RadioGroup_default2;
239
- //# sourceMappingURL=chunk-QKF4FL3X.cjs.map
279
+ //# sourceMappingURL=chunk-TGWUBBKI.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-TGWUBBKI.cjs","../src/RadioGroup/RadioGroup.tsx","../src/RadioGroup/Variants/RadioBox.tsx","../src/RadioGroup/Variants/RadioButton.tsx","../src/RadioGroup/index.ts"],"names":["jsx","cn"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACZA,0CAAoD;AAEpD,oDAA6C;AAC7C,2CAA4B;AAC5B,0FAAiB;ADajB;AACA;AEnBA;AACA,6DAA+B;AAE/B;AAmCQ,+CAAA;AA5BD,IAAM,SAAA,EAAW,CAAC,EAAE,KAAA,EAAO,KAAA,CAAA,EAAW,GAAG,MAAM,CAAA,EAAA,GAAkB;AACtE,EAAA,MAAM;AAAA,IACJ,QAAA;AAAA,IACA,SAAA;AAAA,IACA,WAAA;AAAA,IACA,YAAA;AAAA,IACA,eAAA;AAAA,IACA,aAAA;AAAA,IACA,aAAA;AAAA,IACA,oBAAA;AAAA,IACA,eAAA;AAAA,IACA;AAAA,EACF,EAAA,EAAI,6BAAA,KAAc,CAAA;AAElB,EAAA,uBACE,8BAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MAEE,GAAG,YAAA,CAAa,CAAA;AAAA,MACjB,SAAA,EAAW,4BAAA;AAAA,QACT,0KAAA;AAAA,QACA;AAAA;AAAA,UAEE,sCAAA,EAAwC;AAAA,QAC1C;AAAA,MACF,CAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,6BAAA,8BAAC,EAAA,EAEC,QAAA,kBAAA,6BAAA,OAAC,EAAA,EAAO,GAAG,aAAA,CAAc,EAAA,CAAG,EAAA,CAC9B,CAAA;AAAA,wBAEA,6BAA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BAAA;AASd,cAAA;AAGJ,cAAA;AAAO,YAAA;AAET,YAAA;AAAA,UAAA;AAGA,YAAA;AACE,cAAA;AAAC,cAAA;AAAA,gBAAA;AACY,gBAAA;AACL,gBAAA;AACa,cAAA;AAAA,YAAA;AAGvB,YAAA;AAAA,UAAA;AAEA,YAAA;AACE,cAAA;AACE,gBAAA;AACE,kBAAA;AAAC,kBAAA;AAAA,oBAAA;AACa,oBAAA;AACC,sBAAA;AACsC,oBAAA;AACnD,oBAAA;AACiC,oBAAA;AAEjC,oBAAA;AACc,oBAAA;AAEwB,kBAAA;AAAA,kBAAA;AAJ1B,gBAAA;AAKd,cAAA;AAGJ,cAAA;AAAO,YAAA;AACR,QAAA;AAGL,QAAA;AACE,UAAA;AAAC,UAAA;AAAA,YAAA;AACC,YAAA;AAEc,YAAA;AACC,YAAA;AACF,YAAA;AAC8C,YAAA;AAC3D,YAAA;AACW,YAAA;AACC,YAAA;AAEV,4BAAA;AAGK,cAAA;AAAA,cAAA;AAEwC,YAAA;AAE3C,YAAA;AAGJ,YAAA;AACqC,YAAA;AACrC,YAAA;AACA,YAAA;AACA,YAAA;AAOE,UAAA;AAAA,QAAA;AAEJ,MAAA;AAEJ,IAAA;AAAA,EAAA;AAGN;AAEA;ADeA;AACA;AIzQA;AJ2QA;AACA;AACA;AACA;AACA","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-TGWUBBKI.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { RadioGroup as NextRadioGroup, Radio } from '@nextui-org/radio';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport { ButtonGroup } from '@fuf-stack/pixels';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { Controller } from '../Controller';\nimport { slugify } from '../helpers';\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\nimport { RadioBox } from './Variants/RadioBox';\nimport { RadioButton } from './Variants/RadioButton';\n\nexport const radioGroupVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n buttonGroup:\n 'rounded-xl group-data-[invalid=true]:border group-data-[invalid=true]:border-danger', // optional if a button group is used\n itemBase: '',\n itemBaseActive: 'bg-opacity-50', // optional if a button group is used\n itemControl: 'bg-focus group-data-[invalid=true]:bg-danger',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper:\n 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid=\"true\"]):not(group-data-[selected=\"false\"])]:border-focus', // TODO: get rid of !.\n // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n // Tabs\n tabList: '',\n tab: '',\n tabContent: '',\n cursor: '',\n panel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioGroupVariants>;\ntype ClassName = TVClassName<typeof radioGroupVariants>;\n\nexport interface RadioGroupOption {\n /** Description of the value. Works with variant radioBox. */\n description?: React.ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: React.ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string;\n}\n\nexport interface RadioGroupProps<\n V extends 'default' | 'radioBox' | 'radioButton' | 'tabs',\n> extends VariantProps {\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: V extends 'default' | 'radioBox' | 'radioButton'\n ? RadioGroupOption[]\n : TabProps[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioGroup should look like. */\n variant?: V;\n}\n\n/**\n * RadioGroup component based on [NextUI RadioGroup](https://nextui.org/docs/components/radio-group)\n */\nconst RadioGroup = ({\n className = undefined,\n disabled = false,\n inline = false,\n label = undefined,\n name,\n options,\n testId: _testId = undefined,\n variant = 'default',\n}: RadioGroupProps<\n 'default' | 'radioBox' | 'radioButton' | 'tabs'\n>): ReactElement => {\n const { control, debugMode, getFieldState, getValues } = useFormContext();\n\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = radioGroupVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={name}\n render={({ field: { onChange, disabled: isDisabled, onBlur, ref } }) => {\n let RadioComponents: ReactNode;\n\n const itemClassNames = {\n base: classNames.itemBase,\n control: classNames.itemControl,\n description: classNames.itemDescription,\n label: classNames.itemLabel,\n labelWrapper: classNames.itemLabelWrapper,\n wrapper: classNames.itemWrapper,\n tabList: classNames.tabList,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n cursor: classNames.cursor,\n panel: classNames.panel,\n };\n\n switch (variant) {\n case 'radioBox':\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <RadioBox\n classNames={itemClassNames}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n description={option.description}\n icon={option.icon}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n onChange={onChange}\n value={option.value}\n >\n {option.label ? option.label : option.value}\n </RadioBox>\n );\n }\n return null;\n });\n break;\n case 'radioButton':\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <RadioButton\n className={cn(classNames.itemBase, {\n [classNames.itemBaseActive]:\n getValues()[name] !== option.value,\n })}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n testID={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n onChange={onChange}\n value={option.value}\n // TODO: how to do the classNames properly (make selected option darker with same color)\n >\n {option.label ? option.label : option.value}\n </RadioButton>\n );\n }\n return null;\n });\n break;\n\n case 'tabs':\n RadioComponents = (\n <Tabs\n fullWidth={false}\n tabs={options as TabProps[]}\n onSelectionChange={onChange}\n />\n );\n break;\n default:\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <Radio\n classNames={itemClassNames}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n onChange={onChange}\n value={option.value}\n >\n {option.label ? option.label : option.value}\n </Radio>\n );\n }\n return null;\n });\n }\n\n return (\n <NextRadioGroup\n classNames={classNames}\n // See NextUI styles for group-data condition (data-invalid), e.g.: https://github.com/nextui-org/nextui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label>\n {label}\n {showTestIdCopyButton && (\n <FieldCopyTestIdButton testId={testId} />\n )}\n </label>\n )\n }\n name={name}\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n onChange={onChange}\n ref={ref}\n >\n {variant === 'radioButton' ? (\n <ButtonGroup className={classNames.buttonGroup}>\n {RadioComponents}\n </ButtonGroup>\n ) : (\n RadioComponents\n )}\n </NextRadioGroup>\n );\n }}\n />\n );\n};\n\nexport default RadioGroup;\n","import type { RadioProps as NextRadioProps } from '@nextui-org/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@nextui-org/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface RadioProps extends NextRadioProps {\n /** icon for the option */\n icon?: ReactNode;\n}\n\nexport const RadioBox = ({ icon = undefined, ...props }: RadioProps) => {\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);\n\n return (\n <Component\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(\n '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 {\n // disabled styles\n 'pointer-events-none opacity-disabled': isDisabled,\n },\n )}\n >\n <VisuallyHidden>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <input {...getInputProps()} />\n </VisuallyHidden>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <span {...getWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <span {...getControlProps()} />\n </span>\n {icon}\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getLabelWrapperProps()}\n className={cn(getLabelWrapperProps().className, 'grow')}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {children && <span {...getLabelProps()}>{children}</span>}\n {description && (\n <span className=\"text-small text-foreground opacity-70\">\n {description}\n </span>\n )}\n </div>\n </Component>\n );\n};\n\nexport default RadioBox;\n","import { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface RadioButtonProps {\n /** label of the value. */\n children: React.ReactNode;\n /** CSS class name */\n className?: string;\n /** disables the option */\n isDisabled?: boolean;\n /** HTML data-testid attribute of the option */\n testID?: string;\n /** Callback function. Executed if the option is clicked. */\n onChange: (...event: unknown[]) => void;\n /** value of the option. */\n value: string;\n}\n\nexport const RadioButton = ({\n children,\n className = undefined,\n isDisabled = false,\n onChange,\n testID = undefined,\n value,\n}: RadioButtonProps) => {\n return (\n <Button\n className={cn(className)}\n testId={testID}\n disabled={isDisabled}\n key={`index_${value}`}\n onClick={() => {\n return onChange(value);\n }}\n >\n {children}\n </Button>\n );\n};\n\nexport default RadioButton;\n","import RadioGroup from './RadioGroup';\n\nexport type { RadioGroupProps } from './RadioGroup';\n\nexport { RadioGroup };\n\nexport default RadioGroup;\n"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useFormContext
3
- } from "./chunk-R4ILETYI.js";
3
+ } from "./chunk-PGQLFSIL.js";
4
4
  import {
5
5
  slugify
6
6
  } from "./chunk-V46BHM2U.js";
@@ -45,4 +45,4 @@ export {
45
45
  SubmitButton_default,
46
46
  SubmitButton_default2
47
47
  };
48
- //# sourceMappingURL=chunk-ZZCZS4QM.js.map
48
+ //# sourceMappingURL=chunk-U4IDHTW5.js.map
@@ -0,0 +1,9 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/Controller/index.ts
2
+ var _reacthookform = require('react-hook-form');
3
+ var Controller_default = _reacthookform.Controller;
4
+
5
+
6
+
7
+
8
+ exports.Controller = _reacthookform.Controller; exports.Controller_default = Controller_default;
9
+ //# sourceMappingURL=chunk-VQWKXSHW.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-VQWKXSHW.cjs","../src/Controller/index.ts"],"names":[],"mappings":"AAAA;ACEA,gDAA2B;AAM3B,IAAO,mBAAA,EAAQ,yBAAA;ADLf;AACA;AACE;AACA;AACF,gGAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-VQWKXSHW.cjs","sourcesContent":[null,"/** @see https://react-hook-form.com/docs/usecontroller/controller */\n\nimport { Controller } from 'react-hook-form';\n\nexport type { ControllerProps } from 'react-hook-form';\n\nexport { Controller };\n\nexport default Controller;\n"]}
@@ -1,3 +1,6 @@
1
+ import {
2
+ Controller
3
+ } from "./chunk-KOKIM2ND.js";
1
4
  import {
2
5
  FieldCopyTestIdButton_default
3
6
  } from "./chunk-2CRY7VDQ.js";
@@ -6,10 +9,9 @@ import {
6
9
  } from "./chunk-WKM2D7LF.js";
7
10
  import {
8
11
  useFormContext
9
- } from "./chunk-R4ILETYI.js";
12
+ } from "./chunk-PGQLFSIL.js";
10
13
 
11
14
  // src/TextArea/TextArea.tsx
12
- import { Controller } from "react-hook-form";
13
15
  import { Textarea as NextTextArea } from "@nextui-org/input";
14
16
  import { cn } from "@fuf-stack/pixel-utils";
15
17
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -75,4 +77,4 @@ export {
75
77
  TextArea_default,
76
78
  TextArea_default2
77
79
  };
78
- //# sourceMappingURL=chunk-6QXNSRCS.js.map
80
+ //# sourceMappingURL=chunk-WLYFBQVU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/TextArea/TextArea.tsx","../src/TextArea/index.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nimport { Textarea as NextTextArea } from '@nextui-org/input';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\nimport { Controller } from '../Controller';\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport interface TextAreaProps {\n /** Child components. The content of the textarea. */\n children?: ReactNode;\n /** CSS class name */\n className?: string;\n /** Determines if the TextArea is disabled or not. */\n disabled?: boolean;\n /** Label displayed above the TextArea. */\n label?: ReactNode;\n /** Name the TextArea is registered at in HTML forms (react-hook-form). */\n name: string;\n /** placeholder for the textArea content. */\n placeholder?: string;\n /** Id to grab element in internal tests. */\n testId?: string;\n}\n\n/**\n * TextArea component based on [NextUI TextArea](https://nextui.org/docs/components/textarea)\n */\nconst TextArea = ({\n children = null,\n className = undefined,\n disabled = false,\n label = undefined,\n name,\n placeholder = ' ',\n testId: _testId = undefined,\n}: TextAreaProps) => {\n const { control, debugMode, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n return (\n <Controller\n control={control}\n name={name}\n disabled={disabled}\n render={({\n field: { disabled: isDisabled, onChange, onBlur, value, ref },\n }) => {\n return (\n <NextTextArea\n className={cn(className)}\n classNames={{\n inputWrapper: 'group-data-[focus=true]:border-focus',\n }}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isRequired={required}\n isInvalid={invalid}\n label={\n showLabel && (\n <>\n {label}\n {showTestIdCopyButton && (\n <FieldCopyTestIdButton testId={testId} />\n )}\n </>\n )\n }\n labelPlacement=\"outside\"\n placeholder={placeholder}\n name={name}\n value={value}\n onChange={onChange}\n onBlur={onBlur}\n ref={ref}\n variant=\"bordered\"\n >\n {children}\n </NextTextArea>\n );\n }}\n />\n );\n};\n\nexport default TextArea;\n","import TextArea from './TextArea';\n\nexport type { TextAreaProps } from './TextArea';\n\nexport { TextArea };\n\nexport default TextArea;\n"],"mappings":";;;;;;;;;;;;;;AAEA,SAAS,YAAY,oBAAoB;AAEzC,SAAS,UAAU;AAyDgB,SAMnB,UANmB,KAMnB,YANmB;AA9BnC,IAAM,WAAW,CAAC;AAAA,EAChB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,QAAQ;AAAA,EACR;AAAA,EACA,cAAc;AAAA,EACd,QAAQ,UAAU;AACpB,MAAqB;AACnB,QAAM,EAAE,SAAS,WAAW,cAAc,IAAI,eAAe;AAC7D,QAAM,EAAE,OAAO,SAAS,UAAU,OAAO,IAAI,cAAc,MAAM,OAAO;AAExE,QAAM,uBAAuB,cAAc;AAC3C,QAAM,YAAY,SAAS;AAE3B,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,QAAQ,CAAC;AAAA,QACP,OAAO,EAAE,UAAU,YAAY,UAAU,QAAQ,OAAO,IAAI;AAAA,MAC9D,MAAM;AACJ,eACE;AAAA,UAAC;AAAA;AAAA,YACC,WAAW,GAAG,SAAS;AAAA,YACvB,YAAY;AAAA,cACV,cAAc;AAAA,YAChB;AAAA,YACA,eAAa;AAAA,YACb,cAAc,SAAS,oBAAC,gCAAqB,OAAc;AAAA,YAC3D;AAAA,YACA,YAAY;AAAA,YACZ,WAAW;AAAA,YACX,OACE,aACE,iCACG;AAAA;AAAA,cACA,wBACC,oBAAC,iCAAsB,QAAgB;AAAA,eAE3C;AAAA,YAGJ,gBAAe;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA,SAAQ;AAAA,YAEP;AAAA;AAAA,QACH;AAAA,MAEJ;AAAA;AAAA,EACF;AAEJ;AAEA,IAAO,mBAAQ;;;ACtFf,IAAOA,oBAAQ;","names":["TextArea_default"]}
@@ -2,9 +2,12 @@
2
2
 
3
3
  var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
4
4
 
5
+ // src/hooks/useFieldArray/useFieldArray.ts
6
+ var _reacthookform = require('react-hook-form');
7
+
5
8
  // src/hooks/useFormContext/useFormContext.ts
6
9
  var _react = require('react'); var _react2 = _interopRequireDefault(_react);
7
- var _reacthookform = require('react-hook-form');
10
+
8
11
 
9
12
  // src/Form/subcomponents/FormContext.tsx
10
13
 
@@ -146,5 +149,6 @@ var useFormContext = () => {
146
149
 
147
150
 
148
151
 
149
- exports.FormContext_default = FormContext_default; exports.recursiveFieldKeySearch = recursiveFieldKeySearch; exports.useFormContext = useFormContext;
150
- //# sourceMappingURL=chunk-Z7ETEIY7.cjs.map
152
+
153
+ exports.useFieldArray = _reacthookform.useFieldArray; exports.FormContext_default = FormContext_default; exports.recursiveFieldKeySearch = recursiveFieldKeySearch; exports.useFormContext = useFormContext;
154
+ //# sourceMappingURL=chunk-WPWPZNSG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-WPWPZNSG.cjs","../src/hooks/useFieldArray/useFieldArray.ts","../src/hooks/useFormContext/useFormContext.ts","../src/Form/subcomponents/FormContext.tsx"],"names":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J,OAAO,KAAA,IAAS,SAAA,EAAW,IAAA,CAAK,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAA,CAAE,KAAA,CAAM,GAAG,EAAA,EAAI,IAAA;AAGvE,IAAA,MAAM,SAAA,kBACH,cAAA,+BAAgB,aAAA,GACf,uBAAA,CAAwB,cAAA,CAAe,UAAA,CAAW,MAAA,EAAQ,SAAS,EAAA,GACrE,KAAA;AAGF,IAAA,MAAM,EAAE,KAAA,EAAO,GAAG,KAAK,EAAA,EAAI,iBAAA,CAAkB,IAAA,EAAM,SAAS,CAAA;AAE5D,IAAA,OAAO;AAAA,MACL,GAAG,IAAA;AAAA,MACH,KAAA;AAAA;AAAA,MACA,QAAA;AAAA,MACA,MAAA,EAAQ,uCAAA,OAAQ,GAAU,IAAI;AAAA,IAChC,CAAA;AAAA,EACF,CAAA;AAEA,EAAA,OAAO;AAAA,IACL,GAAG,YAAA;AAAA,IACH,GAAG,cAAA;AAAA,IACH,aAAA;AAAA,IACA;AAAA,EACF,CAAA;AACF,CAAA;AFwBA;AACA;AACE;AACA;AACA;AACA;AACF,4MAAC","file":"/home/runner/work/pixels/pixels/packages/uniform/dist/chunk-WPWPZNSG.cjs","sourcesContent":[null,"/* eslint-disable import/prefer-default-export */\n\n/** @see https://react-hook-form.com/docs/usefieldarray */\nexport { useFieldArray } from 'react-hook-form';\n","import type { VetoSchema } from '@fuf-stack/veto';\nimport type { FieldError } from 'react-hook-form';\n\nimport { useContext } from 'react';\nimport { useFormContext as useHookFormContext } from 'react-hook-form';\n\nimport { UniformContext } from '../../Form/subcomponents/FormContext';\nimport { slugify } from '../../helpers';\n\n/** Checks whether the field is an optional type by recursively checking inner types */\nconst recursiveSearchInnerType = (schema: VetoSchema): boolean => {\n let currentSchema = schema;\n\n // Loop through inner types to find the root type\n while (currentSchema?._def?.innerType) {\n currentSchema = currentSchema._def.innerType;\n if (currentSchema?._def?.typeName === 'ZodOptional') {\n // Stop recursion if optional is found\n return false;\n }\n }\n // If no optional was found, assume it's required\n return true;\n};\n\n/** Recursive search to check whether a field is required or optional */\nexport const recursiveFieldKeySearch = (\n schema: VetoSchema,\n path: string[],\n): boolean | null => {\n const [current, ...rest] = path;\n\n let currentSchema = schema;\n\n // Handle ZodOptional schema: unwrap and continue searching\n if (schema?._def?.typeName === 'ZodOptional') {\n // @ts-expect-error not sure here\n currentSchema = schema.unwrap();\n }\n\n // Handle ZodEffects (transformations or validation effects)\n if (schema?._def?.typeName === 'ZodEffects') {\n // Unwrap and continue\n return recursiveFieldKeySearch(schema._def.schema, path);\n }\n\n // Handle ZodIntersection (intersection types)\n if (currentSchema?._def?.typeName === 'ZodIntersection') {\n return (\n (currentSchema._def.left?.schema\n ? recursiveFieldKeySearch(currentSchema._def.left.schema, path)\n : recursiveFieldKeySearch(currentSchema._def.left, path)) ||\n (currentSchema._def.right?.schema\n ? recursiveFieldKeySearch(currentSchema._def.right.schema, path)\n : recursiveFieldKeySearch(currentSchema._def.right, path))\n );\n }\n\n // Get the shape of an object or elements of an array schema\n // @ts-expect-error not sure here\n const shape = currentSchema?.shape ?? currentSchema?.element?.shape;\n\n if (shape && shape[current]) {\n if (rest.length === 0) {\n // At the end of the path, check if the field is optional\n return (\n shape[current]?._def?.typeName !== 'ZodOptional' &&\n recursiveSearchInnerType(shape[current])\n );\n }\n return recursiveFieldKeySearch(shape[current], rest);\n }\n // Return null if field not found\n return null;\n};\n\n/**\n * Custom hook that extends react-hook-form's useFormContext to add validation and state management.\n */\nexport const useFormContext = () => {\n const {\n formState,\n // https://react-hook-form.com/docs/useform/getfieldstate\n // for getFieldState a subscription to formState properties is needed!\n getFieldState: getFieldStateOrig,\n ...otherMethods\n } = useHookFormContext();\n\n const uniformContext = useContext(UniformContext);\n\n /**\n * Updated getFieldState method which returns:\n * - Whether the field is required by checking the validation schema\n * - Existing field state information (errors, etc.)\n */\n const getFieldState = (name: string, testId?: string) => {\n const fieldPath =\n typeof name === 'string' ? name.replace(/\\[\\d+\\]/g, '').split('.') : name;\n\n // Check if the field is required using the validation schema\n const required =\n (uniformContext?.validation &&\n recursiveFieldKeySearch(uniformContext.validation.schema, fieldPath)) ||\n false;\n\n // Get the original field state (errors, etc.) from react-hook-form\n const { error, ...rest } = getFieldStateOrig(name, formState);\n\n return {\n ...rest,\n error: error as FieldError[] | undefined, // Ensure correct type for error\n required,\n testId: slugify(testId || name),\n };\n };\n\n return {\n ...otherMethods,\n ...uniformContext,\n getFieldState,\n formState,\n };\n};\n","import type { VetoInstance } from '@fuf-stack/veto';\nimport type { ReactNode } from 'react';\nimport type { FieldValues, SubmitHandler } from 'react-hook-form';\n\nimport React, { useMemo, useState } from 'react';\nimport { FormProvider as HookFormProvider, useForm } from 'react-hook-form';\n\nimport { useLocalStorage } from '@fuf-stack/pixels';\n\n/**\n * recursively removes all fields that are null or undefined before\n * the form data is passed to the veto validation function\n */\nexport const removeNullishFields = (obj: Record<string, unknown>) => {\n return JSON.parse(\n JSON.stringify(obj, (_key, value) => {\n return value === null ? undefined : value;\n }),\n );\n};\n\ntype DebugMode = 'debug' | 'debug-testids' | 'off' | 'disabled';\n\nexport type DebugModeSettings = {\n /** disable form debug completely */\n disable?: boolean;\n /** custom localStorage key to save debug mode state */\n localStorageKey?: string;\n};\n\nconst DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT = 'uniform:debug-mode';\n\n/**\n * The `UniformContext` provides control over the form's submission behavior and may optionally include\n * a Veto validation schema for form validation.\n *\n * Specifically, this context offers:\n * 1. **Form Submission Control**: The `preventSubmit` function allows components to enable or disable\n * form submissions.\n * 2. **Optional Validation Schema**: The `validation` property may hold a Veto validation schema instance\n * that can be used to validate form fields and handle validation logic.\n *\n * This context is useful for components that need to interact with or control the form submission state,\n * or access the validation schema for managing form validation logic.\n */\nexport const UniformContext = React.createContext<{\n /** Form debug mode enabled or not */\n debugMode: DebugMode;\n /** settings for from debug mode */\n debugModeSettings?: DebugModeSettings;\n /** Function to update if the form can currently be submitted */\n preventSubmit: (prevent: boolean) => void;\n /** Setter to enable or disable form debug mode */\n setDebugMode: (debugMode: DebugMode) => void;\n /** Optional Veto validation schema instance for form validation */\n validation?: VetoInstance;\n}>({\n debugMode: 'off',\n preventSubmit: () => undefined,\n setDebugMode: () => undefined,\n validation: undefined,\n});\n\n// Define props for the FormProvider component, extending HookForm's props\ninterface FormProviderProps {\n /** children form render function */\n children: (childProps: {\n handleSubmit: (e?: React.BaseSyntheticEvent) => Promise<void>;\n }) => ReactNode;\n /** settings for from debug mode */\n debugModeSettings?: DebugModeSettings;\n /** initial form values */\n initialValues?: FieldValues;\n /** form submit handler */\n onSubmit: SubmitHandler<FieldValues>;\n /** Veto validation schema instance */\n validation?: VetoInstance;\n /** when the validation should be triggered */\n validationTrigger: 'onChange' | 'onBlur' | 'onSubmit' | 'onTouched' | 'all';\n}\n\n/**\n * FormProvider component provides:\n * - The veto validation schema context\n * - Submit handler creation and submission control with preventSubmit\n * - Form Debug Mode state\n * - React Hook Form context\n */\nconst FormProvider: React.FC<FormProviderProps> = ({\n children,\n debugModeSettings = undefined,\n initialValues = undefined,\n onSubmit,\n validation = undefined,\n validationTrigger,\n}) => {\n // Control if the form can currently be submitted\n const [preventSubmit, setPreventSubmit] = useState(false);\n\n // Form Debug mode state is handled in the form context\n const [debugMode, setDebugMode] = useLocalStorage<DebugMode>(\n debugModeSettings?.localStorageKey || DEBUG_MODE_LOCAL_STORAGE_KEY_DEFAULT,\n 'off',\n );\n\n // Memoize the context value to prevent re-renders\n const contextValue = useMemo(\n () => ({\n // set debugMode to disabled when debugModeSettings.disable is true\n // otherwise use current debug mode from localStorage\n debugMode: debugModeSettings?.disable ? 'disabled' : debugMode,\n preventSubmit: (prevent: boolean) => {\n setPreventSubmit(prevent);\n },\n setDebugMode,\n validation,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [debugMode, debugModeSettings?.disable],\n );\n\n // Initialize react hook form\n const methods = useForm({\n defaultValues: initialValues,\n // add validation config when validation schema provided\n ...(validation\n ? {\n // set rhf mode\n // see: https://react-hook-form.com/docs/useform#mode\n mode: validationTrigger,\n resolver: async (values) => {\n const { data, errors, ...rest } = await validation.validateAsync(\n removeNullishFields(values),\n );\n // https://github.com/react-hook-form/resolvers/blob/master/zod/src/zod.ts\n return { values: data || {}, errors: errors || {}, ...rest };\n },\n }\n : {}),\n });\n\n // Create submit handler\n // eslint-disable-next-line consistent-return\n const handleSubmit = async (e?: React.BaseSyntheticEvent) => {\n // only prevent submit when form state is valid, because otherwise\n // submit will only trigger validation and add errors / focus invalid fields\n if (methods.formState.isValid && preventSubmit) {\n console.warn(\n '[FormProvider] form submit was prevented because preventSubmit is true...',\n );\n e?.preventDefault();\n return Promise.resolve();\n }\n await methods.handleSubmit(onSubmit)(e);\n };\n\n return (\n <UniformContext.Provider value={contextValue}>\n {/* Spread all hook form props into HookFormProvider */}\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <HookFormProvider {...methods}>\n {children({ handleSubmit })}\n </HookFormProvider>\n </UniformContext.Provider>\n );\n};\n\nexport default FormProvider;\n"]}
@@ -1,3 +1,6 @@
1
+ import {
2
+ Controller
3
+ } from "./chunk-KOKIM2ND.js";
1
4
  import {
2
5
  FieldCopyTestIdButton_default
3
6
  } from "./chunk-2CRY7VDQ.js";
@@ -6,16 +9,16 @@ import {
6
9
  } from "./chunk-WKM2D7LF.js";
7
10
  import {
8
11
  useFormContext
9
- } from "./chunk-R4ILETYI.js";
12
+ } from "./chunk-PGQLFSIL.js";
10
13
  import {
11
14
  slugify
12
15
  } from "./chunk-V46BHM2U.js";
13
16
 
14
17
  // src/RadioGroup/RadioGroup.tsx
15
- import { Controller } from "react-hook-form";
16
18
  import { RadioGroup as NextRadioGroup, Radio } from "@nextui-org/radio";
17
19
  import { cn as cn3, tv, variantsToClassNames } from "@fuf-stack/pixel-utils";
18
20
  import { ButtonGroup } from "@fuf-stack/pixels";
21
+ import Tabs from "@fuf-stack/pixels/Tabs";
19
22
 
20
23
  // src/RadioGroup/Variants/RadioBox.tsx
21
24
  import { useRadio } from "@nextui-org/radio";
@@ -104,14 +107,21 @@ var radioGroupVariants = tv({
104
107
  itemBase: "",
105
108
  itemBaseActive: "bg-opacity-50",
106
109
  // optional if a button group is used
107
- itemControl: "",
110
+ itemControl: "bg-focus group-data-[invalid=true]:bg-danger",
108
111
  itemDescription: "",
109
112
  itemLabel: "text-sm",
110
113
  itemLabelWrapper: "",
111
- itemWrapper: "",
114
+ itemWrapper: 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid="true"]):not(group-data-[selected="false"])]:border-focus',
115
+ // TODO: get rid of !.
112
116
  // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts
113
- label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:!text-danger",
114
- wrapper: ""
117
+ label: "text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger",
118
+ wrapper: "",
119
+ // Tabs
120
+ tabList: "",
121
+ tab: "",
122
+ tabContent: "",
123
+ cursor: "",
124
+ panel: ""
115
125
  }
116
126
  });
117
127
  var RadioGroup = ({
@@ -144,60 +154,90 @@ var RadioGroup = ({
144
154
  description: classNames.itemDescription,
145
155
  label: classNames.itemLabel,
146
156
  labelWrapper: classNames.itemLabelWrapper,
147
- wrapper: classNames.itemWrapper
157
+ wrapper: classNames.itemWrapper,
158
+ tabList: classNames.tabList,
159
+ tab: classNames.tab,
160
+ tabContent: classNames.tabContent,
161
+ cursor: classNames.cursor,
162
+ panel: classNames.panel
148
163
  };
149
164
  switch (variant) {
150
165
  case "radioBox":
151
- RadioComponents = options.map((option) => /* @__PURE__ */ jsx3(
152
- RadioBox,
153
- {
154
- classNames: itemClassNames,
155
- "data-testid": slugify(
156
- `${testId}_option_${option.testId || option.value}`
157
- ),
158
- description: option.description,
159
- icon: option.icon,
160
- isDisabled: isDisabled || option.disabled,
161
- onChange,
162
- value: option.value,
163
- children: option.label ? option.label : option.value
164
- },
165
- option.value
166
- ));
166
+ RadioComponents = options.map((option) => {
167
+ if ("value" in option) {
168
+ return /* @__PURE__ */ jsx3(
169
+ RadioBox,
170
+ {
171
+ classNames: itemClassNames,
172
+ "data-testid": slugify(
173
+ `${testId}_option_${option.testId || option.value}`
174
+ ),
175
+ description: option.description,
176
+ icon: option.icon,
177
+ isDisabled: isDisabled || option.disabled,
178
+ onChange,
179
+ value: option.value,
180
+ children: option.label ? option.label : option.value
181
+ },
182
+ option.value
183
+ );
184
+ }
185
+ return null;
186
+ });
167
187
  break;
168
188
  case "radioButton":
169
- RadioComponents = options.map((option) => /* @__PURE__ */ jsx3(
170
- RadioButton,
189
+ RadioComponents = options.map((option) => {
190
+ if ("value" in option) {
191
+ return /* @__PURE__ */ jsx3(
192
+ RadioButton,
193
+ {
194
+ className: cn3(classNames.itemBase, {
195
+ [classNames.itemBaseActive]: getValues()[name] !== option.value
196
+ }),
197
+ isDisabled: isDisabled || option.disabled,
198
+ testID: slugify(
199
+ `${testId}_option_${option.testId || option.value}`
200
+ ),
201
+ onChange,
202
+ value: option.value,
203
+ children: option.label ? option.label : option.value
204
+ },
205
+ option.value
206
+ );
207
+ }
208
+ return null;
209
+ });
210
+ break;
211
+ case "tabs":
212
+ RadioComponents = /* @__PURE__ */ jsx3(
213
+ Tabs,
171
214
  {
172
- className: cn3(classNames.itemBase, {
173
- [classNames.itemBaseActive]: getValues()[name] !== option.value
174
- }),
175
- isDisabled: isDisabled || option.disabled,
176
- testID: slugify(
177
- `${testId}_option_${option.testId || option.value}`
178
- ),
179
- onChange,
180
- value: option.value,
181
- children: option.label ? option.label : option.value
182
- },
183
- option.value
184
- ));
215
+ fullWidth: false,
216
+ tabs: options,
217
+ onSelectionChange: onChange
218
+ }
219
+ );
185
220
  break;
186
221
  default:
187
- RadioComponents = options.map((option) => /* @__PURE__ */ jsx3(
188
- Radio,
189
- {
190
- classNames: itemClassNames,
191
- "data-testid": slugify(
192
- `${testId}_option_${option.testId || option.value}`
193
- ),
194
- isDisabled: isDisabled || option.disabled,
195
- onChange,
196
- value: option.value,
197
- children: option.label ? option.label : option.value
198
- },
199
- option.value
200
- ));
222
+ RadioComponents = options.map((option) => {
223
+ if ("value" in option) {
224
+ return /* @__PURE__ */ jsx3(
225
+ Radio,
226
+ {
227
+ classNames: itemClassNames,
228
+ "data-testid": slugify(
229
+ `${testId}_option_${option.testId || option.value}`
230
+ ),
231
+ isDisabled: isDisabled || option.disabled,
232
+ onChange,
233
+ value: option.value,
234
+ children: option.label ? option.label : option.value
235
+ },
236
+ option.value
237
+ );
238
+ }
239
+ return null;
240
+ });
201
241
  }
202
242
  return /* @__PURE__ */ jsx3(
203
243
  NextRadioGroup,
@@ -236,4 +276,4 @@ export {
236
276
  RadioGroup_default,
237
277
  RadioGroup_default2
238
278
  };
239
- //# sourceMappingURL=chunk-XJULYTGW.js.map
279
+ //# sourceMappingURL=chunk-WXFWWEJ3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/RadioGroup/RadioGroup.tsx","../src/RadioGroup/Variants/RadioBox.tsx","../src/RadioGroup/Variants/RadioButton.tsx","../src/RadioGroup/index.ts"],"sourcesContent":["import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { TabProps } from '@fuf-stack/pixels/Tabs';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { RadioGroup as NextRadioGroup, Radio } from '@nextui-org/radio';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\nimport { ButtonGroup } from '@fuf-stack/pixels';\nimport Tabs from '@fuf-stack/pixels/Tabs';\n\nimport { Controller } from '../Controller';\nimport { slugify } from '../helpers';\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\nimport { RadioBox } from './Variants/RadioBox';\nimport { RadioButton } from './Variants/RadioButton';\n\nexport const radioGroupVariants = tv({\n slots: {\n base: 'group', // Needs group for group-data condition\n buttonGroup:\n 'rounded-xl group-data-[invalid=true]:border group-data-[invalid=true]:border-danger', // optional if a button group is used\n itemBase: '',\n itemBaseActive: 'bg-opacity-50', // optional if a button group is used\n itemControl: 'bg-focus group-data-[invalid=true]:bg-danger',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper:\n 'group-data-[invalid=true]:!border-danger [&:not(group-data-[invalid=\"true\"]):not(group-data-[selected=\"false\"])]:border-focus', // TODO: get rid of !.\n // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts\n label:\n 'text-sm text-foreground subpixel-antialiased group-data-[invalid=true]:text-danger',\n wrapper: '',\n // Tabs\n tabList: '',\n tab: '',\n tabContent: '',\n cursor: '',\n panel: '',\n },\n});\n\ntype VariantProps = TVProps<typeof radioGroupVariants>;\ntype ClassName = TVClassName<typeof radioGroupVariants>;\n\nexport interface RadioGroupOption {\n /** Description of the value. Works with variant radioBox. */\n description?: React.ReactNode;\n /** disables the option */\n disabled?: boolean;\n /** option label */\n label?: React.ReactNode;\n /** option icon */\n icon?: ReactNode;\n /** HTML data-testid attribute of the option */\n testId?: string;\n /** option value */\n value: string;\n}\n\nexport interface RadioGroupProps<\n V extends 'default' | 'radioBox' | 'radioButton' | 'tabs',\n> extends VariantProps {\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: V extends 'default' | 'radioBox' | 'radioButton'\n ? RadioGroupOption[]\n : TabProps[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioGroup should look like. */\n variant?: V;\n}\n\n/**\n * RadioGroup component based on [NextUI RadioGroup](https://nextui.org/docs/components/radio-group)\n */\nconst RadioGroup = ({\n className = undefined,\n disabled = false,\n inline = false,\n label = undefined,\n name,\n options,\n testId: _testId = undefined,\n variant = 'default',\n}: RadioGroupProps<\n 'default' | 'radioBox' | 'radioButton' | 'tabs'\n>): ReactElement => {\n const { control, debugMode, getFieldState, getValues } = useFormContext();\n\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const showTestIdCopyButton = debugMode === 'debug-testids';\n const showLabel = label || showTestIdCopyButton;\n\n const variants = radioGroupVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <Controller\n control={control}\n disabled={disabled}\n name={name}\n render={({ field: { onChange, disabled: isDisabled, onBlur, ref } }) => {\n let RadioComponents: ReactNode;\n\n const itemClassNames = {\n base: classNames.itemBase,\n control: classNames.itemControl,\n description: classNames.itemDescription,\n label: classNames.itemLabel,\n labelWrapper: classNames.itemLabelWrapper,\n wrapper: classNames.itemWrapper,\n tabList: classNames.tabList,\n tab: classNames.tab,\n tabContent: classNames.tabContent,\n cursor: classNames.cursor,\n panel: classNames.panel,\n };\n\n switch (variant) {\n case 'radioBox':\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <RadioBox\n classNames={itemClassNames}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n description={option.description}\n icon={option.icon}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n onChange={onChange}\n value={option.value}\n >\n {option.label ? option.label : option.value}\n </RadioBox>\n );\n }\n return null;\n });\n break;\n case 'radioButton':\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <RadioButton\n className={cn(classNames.itemBase, {\n [classNames.itemBaseActive]:\n getValues()[name] !== option.value,\n })}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n testID={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n onChange={onChange}\n value={option.value}\n // TODO: how to do the classNames properly (make selected option darker with same color)\n >\n {option.label ? option.label : option.value}\n </RadioButton>\n );\n }\n return null;\n });\n break;\n\n case 'tabs':\n RadioComponents = (\n <Tabs\n fullWidth={false}\n tabs={options as TabProps[]}\n onSelectionChange={onChange}\n />\n );\n break;\n default:\n RadioComponents = options.map((option) => {\n if ('value' in option) {\n return (\n <Radio\n classNames={itemClassNames}\n data-testid={slugify(\n `${testId}_option_${option.testId || option.value}`,\n )}\n isDisabled={isDisabled || option.disabled}\n key={option.value}\n onChange={onChange}\n value={option.value}\n >\n {option.label ? option.label : option.value}\n </Radio>\n );\n }\n return null;\n });\n }\n\n return (\n <NextRadioGroup\n classNames={classNames}\n // See NextUI styles for group-data condition (data-invalid), e.g.: https://github.com/nextui-org/nextui/blob/main/packages/components/select/src/use-select.ts\n data-invalid={invalid}\n data-required={required}\n data-testid={testId}\n errorMessage={error && <FieldValidationError error={error} />}\n isDisabled={isDisabled}\n isInvalid={invalid}\n isRequired={required}\n label={\n showLabel && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label>\n {label}\n {showTestIdCopyButton && (\n <FieldCopyTestIdButton testId={testId} />\n )}\n </label>\n )\n }\n name={name}\n orientation={inline ? 'horizontal' : 'vertical'}\n onBlur={onBlur}\n onChange={onChange}\n ref={ref}\n >\n {variant === 'radioButton' ? (\n <ButtonGroup className={classNames.buttonGroup}>\n {RadioComponents}\n </ButtonGroup>\n ) : (\n RadioComponents\n )}\n </NextRadioGroup>\n );\n }}\n />\n );\n};\n\nexport default RadioGroup;\n","import type { RadioProps as NextRadioProps } from '@nextui-org/radio';\nimport type { ReactNode } from 'react';\n\nimport { useRadio } from '@nextui-org/radio';\nimport { VisuallyHidden } from '@react-aria/visually-hidden';\n\nimport { cn } from '@fuf-stack/pixel-utils';\n\ninterface RadioProps extends NextRadioProps {\n /** icon for the option */\n icon?: ReactNode;\n}\n\nexport const RadioBox = ({ icon = undefined, ...props }: RadioProps) => {\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);\n\n return (\n <Component\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(\n '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 {\n // disabled styles\n 'pointer-events-none opacity-disabled': isDisabled,\n },\n )}\n >\n <VisuallyHidden>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <input {...getInputProps()} />\n </VisuallyHidden>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <span {...getWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <span {...getControlProps()} />\n </span>\n {icon}\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getLabelWrapperProps()}\n className={cn(getLabelWrapperProps().className, 'grow')}\n >\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n {children && <span {...getLabelProps()}>{children}</span>}\n {description && (\n <span className=\"text-small text-foreground opacity-70\">\n {description}\n </span>\n )}\n </div>\n </Component>\n );\n};\n\nexport default RadioBox;\n","import { cn } from '@fuf-stack/pixel-utils';\nimport { Button } from '@fuf-stack/pixels';\n\ninterface RadioButtonProps {\n /** label of the value. */\n children: React.ReactNode;\n /** CSS class name */\n className?: string;\n /** disables the option */\n isDisabled?: boolean;\n /** HTML data-testid attribute of the option */\n testID?: string;\n /** Callback function. Executed if the option is clicked. */\n onChange: (...event: unknown[]) => void;\n /** value of the option. */\n value: string;\n}\n\nexport const RadioButton = ({\n children,\n className = undefined,\n isDisabled = false,\n onChange,\n testID = undefined,\n value,\n}: RadioButtonProps) => {\n return (\n <Button\n className={cn(className)}\n testId={testID}\n disabled={isDisabled}\n key={`index_${value}`}\n onClick={() => {\n return onChange(value);\n }}\n >\n {children}\n </Button>\n );\n};\n\nexport default RadioButton;\n","import RadioGroup from './RadioGroup';\n\nexport type { RadioGroupProps } from './RadioGroup';\n\nexport { RadioGroup };\n\nexport default RadioGroup;\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA,SAAS,cAAc,gBAAgB,aAAa;AAEpD,SAA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