@fuf-stack/uniform 0.9.5 → 0.9.7

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 (92) hide show
  1. package/dist/CheckboxGroup/index.cjs +3 -3
  2. package/dist/CheckboxGroup/index.d.cts +5 -2
  3. package/dist/CheckboxGroup/index.d.ts +5 -2
  4. package/dist/CheckboxGroup/index.js +2 -2
  5. package/dist/CheckboxGroup-o-qWkWe1.d.cts +130 -0
  6. package/dist/CheckboxGroup-o-qWkWe1.d.ts +130 -0
  7. package/dist/FieldArray/index.cjs +3 -3
  8. package/dist/FieldArray/index.js +2 -2
  9. package/dist/{FieldValidationError-BSXedjCA.d.cts → FieldValidationError-DAT12Ess.d.cts} +2 -1
  10. package/dist/{FieldValidationError-BSXedjCA.d.ts → FieldValidationError-DAT12Ess.d.ts} +2 -1
  11. package/dist/Input/index.cjs +3 -3
  12. package/dist/Input/index.js +2 -2
  13. package/dist/RadioGroup/index.cjs +3 -3
  14. package/dist/RadioGroup/index.d.cts +5 -2
  15. package/dist/RadioGroup/index.d.ts +5 -2
  16. package/dist/RadioGroup/index.js +2 -2
  17. package/dist/RadioGroup-D_kiBt0M.d.cts +162 -0
  18. package/dist/RadioGroup-D_kiBt0M.d.ts +162 -0
  19. package/dist/Select/index.cjs +3 -3
  20. package/dist/Select/index.d.cts +3 -3
  21. package/dist/Select/index.d.ts +3 -3
  22. package/dist/Select/index.js +2 -2
  23. package/dist/Select-BhS4z0Pj.d.cts +317 -0
  24. package/dist/Select-BhS4z0Pj.d.ts +317 -0
  25. package/dist/Switch/index.cjs +3 -3
  26. package/dist/Switch/index.d.cts +5 -2
  27. package/dist/Switch/index.d.ts +5 -2
  28. package/dist/Switch/index.js +2 -2
  29. package/dist/Switch-Fdldj8LV.d.cts +126 -0
  30. package/dist/Switch-Fdldj8LV.d.ts +126 -0
  31. package/dist/TextArea/index.cjs +3 -3
  32. package/dist/TextArea/index.js +2 -2
  33. package/dist/{chunk-OCR2UWG2.cjs → chunk-4RTJ5XR2.cjs} +3 -3
  34. package/dist/{chunk-OCR2UWG2.cjs.map → chunk-4RTJ5XR2.cjs.map} +1 -1
  35. package/dist/{chunk-FMQNL3RT.js → chunk-F7GG67YU.js} +2 -2
  36. package/dist/{chunk-W24WP5YE.cjs → chunk-HFMFDBEV.cjs} +46 -14
  37. package/dist/chunk-HFMFDBEV.cjs.map +1 -0
  38. package/dist/{chunk-NHPQEYYN.js → chunk-HOCRJOEU.js} +2 -2
  39. package/dist/{chunk-TNELIBCV.cjs → chunk-JDRMKZ35.cjs} +4 -4
  40. package/dist/{chunk-TNELIBCV.cjs.map → chunk-JDRMKZ35.cjs.map} +1 -1
  41. package/dist/{chunk-4AHVJWTB.js → chunk-JG5VQZ4V.js} +46 -14
  42. package/dist/chunk-JG5VQZ4V.js.map +1 -0
  43. package/dist/{chunk-5UHHZ7KY.cjs → chunk-JRFKYVXY.cjs} +3 -3
  44. package/dist/{chunk-5UHHZ7KY.cjs.map → chunk-JRFKYVXY.cjs.map} +1 -1
  45. package/dist/chunk-LDW7K7LW.js +231 -0
  46. package/dist/chunk-LDW7K7LW.js.map +1 -0
  47. package/dist/{chunk-INTLZONV.cjs → chunk-NQ4JZ7AK.cjs} +37 -15
  48. package/dist/chunk-NQ4JZ7AK.cjs.map +1 -0
  49. package/dist/{chunk-QVBZ5RLN.cjs → chunk-NXTXKBTP.cjs} +104 -113
  50. package/dist/chunk-NXTXKBTP.cjs.map +1 -0
  51. package/dist/{chunk-QTL5FREE.cjs → chunk-OHJYXA6R.cjs} +7 -5
  52. package/dist/chunk-OHJYXA6R.cjs.map +1 -0
  53. package/dist/{chunk-YUAJN6HW.cjs → chunk-PAX2HXPK.cjs} +54 -19
  54. package/dist/chunk-PAX2HXPK.cjs.map +1 -0
  55. package/dist/{chunk-AVKEYJH7.js → chunk-PFX4YRWI.js} +38 -16
  56. package/dist/chunk-PFX4YRWI.js.map +1 -0
  57. package/dist/{chunk-DTSX7YON.js → chunk-SCTH3FAO.js} +2 -2
  58. package/dist/{chunk-ARUVDZFG.js → chunk-VZFPQ6ZZ.js} +54 -19
  59. package/dist/chunk-VZFPQ6ZZ.js.map +1 -0
  60. package/dist/{chunk-DBLODROX.js → chunk-WKM2D7LF.js} +7 -5
  61. package/dist/chunk-WKM2D7LF.js.map +1 -0
  62. package/dist/index.cjs +9 -9
  63. package/dist/index.d.cts +8 -8
  64. package/dist/index.d.ts +8 -8
  65. package/dist/index.js +10 -10
  66. package/dist/partials/FieldValidationError/index.cjs +2 -2
  67. package/dist/partials/FieldValidationError/index.d.cts +2 -2
  68. package/dist/partials/FieldValidationError/index.d.ts +2 -2
  69. package/dist/partials/FieldValidationError/index.js +1 -1
  70. package/package.json +6 -6
  71. package/dist/CheckboxGroup-BYsQ0A0q.d.cts +0 -32
  72. package/dist/CheckboxGroup-BYsQ0A0q.d.ts +0 -32
  73. package/dist/RadioGroup-BU4K9cnS.d.cts +0 -40
  74. package/dist/RadioGroup-BU4K9cnS.d.ts +0 -40
  75. package/dist/Select-C08Oftdr.d.cts +0 -184
  76. package/dist/Select-C08Oftdr.d.ts +0 -184
  77. package/dist/Switch-OkO3GdPy.d.cts +0 -20
  78. package/dist/Switch-OkO3GdPy.d.ts +0 -20
  79. package/dist/chunk-4AHVJWTB.js.map +0 -1
  80. package/dist/chunk-ARUVDZFG.js.map +0 -1
  81. package/dist/chunk-AVKEYJH7.js.map +0 -1
  82. package/dist/chunk-DBLODROX.js.map +0 -1
  83. package/dist/chunk-I5M2A3MN.js +0 -240
  84. package/dist/chunk-I5M2A3MN.js.map +0 -1
  85. package/dist/chunk-INTLZONV.cjs.map +0 -1
  86. package/dist/chunk-QTL5FREE.cjs.map +0 -1
  87. package/dist/chunk-QVBZ5RLN.cjs.map +0 -1
  88. package/dist/chunk-W24WP5YE.cjs.map +0 -1
  89. package/dist/chunk-YUAJN6HW.cjs.map +0 -1
  90. /package/dist/{chunk-FMQNL3RT.js.map → chunk-F7GG67YU.js.map} +0 -0
  91. /package/dist/{chunk-NHPQEYYN.js.map → chunk-HOCRJOEU.js.map} +0 -0
  92. /package/dist/{chunk-DTSX7YON.js.map → chunk-SCTH3FAO.js.map} +0 -0
@@ -3,7 +3,7 @@
3
3
  var _chunkKMMS4G7Acjs = require('./chunk-KMMS4G7A.cjs');
4
4
 
5
5
 
6
- var _chunkQTL5FREEcjs = require('./chunk-QTL5FREE.cjs');
6
+ var _chunkOHJYXA6Rcjs = require('./chunk-OHJYXA6R.cjs');
7
7
 
8
8
 
9
9
  var _chunkLDCRR7FPcjs = require('./chunk-LDCRR7FP.cjs');
@@ -17,9 +17,9 @@ var _pixelutils = require('@fuf-stack/pixel-utils');
17
17
  var _jsxruntime = require('react/jsx-runtime');
18
18
  var selectVariants = _pixelutils.tv.call(void 0, {
19
19
  slots: {
20
- base: "",
20
+ base: "group",
21
21
  clearIndicator: "rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800",
22
- control: "rounded-lg border-2 border-default-200 !duration-150 transition-background hover:border-default-400 motion-reduce:transition-none",
22
+ control: "rounded-lg border-2 border-default-200 !duration-150 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none",
23
23
  control_focused: "border-primary hover:border-primary",
24
24
  crossIcon: "",
25
25
  downChevron: "",
@@ -29,7 +29,8 @@ var selectVariants = _pixelutils.tv.call(void 0, {
29
29
  indicatorsContainer: "gap-1 p-1",
30
30
  indicatorSeparator: "bg-default-300",
31
31
  input: "py-0.5 pl-1",
32
- label: "!pointer-events-auto relative bottom-2 ml-1 inline",
32
+ // See NextUI styles for group-data condition, e.g.: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/select.ts
33
+ label: 'pointer-events-auto relative bottom-1.5 ml-1 text-small subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-["*"]',
33
34
  loadingIndicator: "",
34
35
  loadingMessage: "",
35
36
  menu: "mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg",
@@ -49,13 +50,6 @@ var selectVariants = _pixelutils.tv.call(void 0, {
49
50
  selectContainer: "",
50
51
  singleValue: "!ml-1 !leading-7",
51
52
  valueContainer: "gap-1 p-1"
52
- },
53
- variants: {
54
- invalid: {
55
- true: {
56
- control: "border-danger hover:border-danger"
57
- }
58
- }
59
53
  }
60
54
  });
61
55
  var InputComponent = (props) => {
@@ -75,7 +69,7 @@ var Select = ({
75
69
  clearable = true,
76
70
  disabled = false,
77
71
  filterOption = void 0,
78
- formatOptionLabel = void 0,
72
+ renderOptionLabel = void 0,
79
73
  inputValue = void 0,
80
74
  label: _label = void 0,
81
75
  loading = false,
@@ -89,14 +83,13 @@ var Select = ({
89
83
  const { control, getFieldState } = _chunkLDCRR7FPcjs.useFormContext.call(void 0, );
90
84
  const { error, invalid, required, testId } = getFieldState(name, _testId);
91
85
  const [isFocused, setIsFocused] = _react.useState.call(void 0, false);
92
- const variants = selectVariants({ invalid });
86
+ const variants = selectVariants();
93
87
  const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
94
88
  const {
95
89
  getBaseProps,
96
90
  getErrorMessageProps,
97
91
  getHelperWrapperProps,
98
92
  getLabelProps,
99
- getMainWrapperProps,
100
93
  getTriggerProps,
101
94
  getValueProps,
102
95
  label
@@ -120,109 +113,107 @@ var Select = ({
120
113
  render: ({
121
114
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
122
115
  field: { onChange, value, ref, onBlur }
123
- }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
116
+ }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
124
117
  "div",
125
118
  {
126
119
  ...getBaseProps(),
127
- className: _pixelutils.cn.call(void 0, classNames.base, "group mt-2"),
120
+ className: _pixelutils.cn.call(void 0, classNames.base),
128
121
  "data-testid": testId,
129
- children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ...getMainWrapperProps(), children: [
130
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "relative", children: [
131
- label && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
132
- "label",
133
- {
134
- htmlFor: `react-select-${name}-input`,
135
- className: _pixelutils.cn.call(void 0, getLabelProps().className, classNames.label),
136
- children: [
137
- label,
138
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default, { testId })
139
- ]
140
- }
141
- ),
142
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
143
- _reactselect2.default,
144
- {
145
- "aria-errormessage": "",
146
- "aria-labelledby": _optionalChain([getTriggerProps, 'call', _7 => _7(), 'access', _8 => _8["aria-labelledby"], 'optionalAccess', _9 => _9.split, 'call', _10 => _10(" "), 'access', _11 => _11[1]]),
147
- "aria-invalid": invalid,
148
- classNames: {
149
- control: () => _pixelutils.cn.call(void 0, classNames.control, {
150
- [classNames.control_focused]: isFocused && !invalid
151
- }),
152
- clearIndicator: () => classNames.clearIndicator,
153
- dropdownIndicator: () => classNames.dropdownIndicator,
154
- groupHeading: () => classNames.groupHeading,
155
- indicatorsContainer: () => classNames.indicatorsContainer,
156
- indicatorSeparator: () => classNames.indicatorSeparator,
157
- input: () => classNames.input,
158
- menu: () => classNames.menu,
159
- menuList: () => classNames.menuList,
160
- menuPortal: () => classNames.menuPortal,
161
- multiValue: () => classNames.multiValue,
162
- multiValueLabel: () => _pixelutils.cn.call(void 0,
163
- classNames.multiValueLabel,
164
- `${getValueProps().className}`
165
- ),
166
- multiValueRemove: () => classNames.multiValueRemove,
167
- noOptionsMessage: () => classNames.noOptionsMessage,
168
- option: ({
169
- isFocused: optionIsFocused,
170
- isSelected: optionIsSelected
171
- }) => _pixelutils.cn.call(void 0, classNames.option, {
172
- [classNames.option_focused]: optionIsFocused,
173
- [classNames.option_selected]: optionIsSelected
174
- }),
175
- placeholder: () => classNames.placeholder,
176
- singleValue: () => _pixelutils.cn.call(void 0, classNames.singleValue, `${getValueProps().className}`),
177
- valueContainer: () => classNames.valueContainer
178
- },
179
- components: {
180
- Input: InputComponent,
181
- Option: OptionComponent,
182
- DropdownIndicator: DropdownIndicatorComponent
183
- },
184
- "data-testid": `${testId}_select`,
185
- filterOption,
186
- formatOptionLabel,
187
- inputValue,
188
- instanceId: name,
189
- isClearable: clearable,
190
- isDisabled: disabled,
191
- isLoading: loading,
192
- isMulti: multiSelect,
193
- name,
194
- menuPosition: "fixed",
195
- menuShouldBlockScroll: true,
196
- options,
197
- placeholder,
198
- onBlur: (_e) => {
199
- setIsFocused(false);
200
- return onBlur();
201
- },
202
- onChange: (option) => {
203
- if (multiSelect) {
204
- const transformedOptions = [];
205
- _optionalChain([option, 'optionalAccess', _12 => _12.forEach, 'call', _13 => _13((o) => {
206
- transformedOptions.push(o.value);
207
- })]);
208
- onChange(transformedOptions);
209
- } else {
210
- onChange(option && option.value);
211
- }
212
- },
213
- onFocus: (_e) => {
214
- setIsFocused(true);
215
- },
216
- onInputChange,
217
- ref,
218
- value: options.find((option) => option.value === value),
219
- unstyled: true
220
- }
221
- )
222
- ] }),
122
+ "data-required": required,
123
+ children: [
124
+ label && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
125
+ "label",
126
+ {
127
+ className: classNames.label,
128
+ "data-slot": "label",
129
+ htmlFor: `react-select-${name}-input`,
130
+ id: getLabelProps().id,
131
+ children: [
132
+ label,
133
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default, { testId })
134
+ ]
135
+ }
136
+ ),
137
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
138
+ _reactselect2.default,
139
+ {
140
+ "aria-errormessage": "",
141
+ "aria-labelledby": _optionalChain([getTriggerProps, 'call', _7 => _7(), 'access', _8 => _8["aria-labelledby"], 'optionalAccess', _9 => _9.split, 'call', _10 => _10(" "), 'access', _11 => _11[1]]),
142
+ "aria-invalid": invalid,
143
+ classNames: {
144
+ control: () => _pixelutils.cn.call(void 0, classNames.control, {
145
+ [classNames.control_focused]: isFocused && !invalid
146
+ }),
147
+ clearIndicator: () => classNames.clearIndicator,
148
+ dropdownIndicator: () => classNames.dropdownIndicator,
149
+ groupHeading: () => classNames.groupHeading,
150
+ indicatorsContainer: () => classNames.indicatorsContainer,
151
+ indicatorSeparator: () => classNames.indicatorSeparator,
152
+ input: () => classNames.input,
153
+ menu: () => classNames.menu,
154
+ menuList: () => classNames.menuList,
155
+ menuPortal: () => classNames.menuPortal,
156
+ multiValue: () => classNames.multiValue,
157
+ multiValueLabel: () => _pixelutils.cn.call(void 0, classNames.multiValueLabel, `${getValueProps().className}`),
158
+ multiValueRemove: () => classNames.multiValueRemove,
159
+ noOptionsMessage: () => classNames.noOptionsMessage,
160
+ option: ({
161
+ isFocused: optionIsFocused,
162
+ isSelected: optionIsSelected
163
+ }) => _pixelutils.cn.call(void 0, classNames.option, {
164
+ [classNames.option_focused]: optionIsFocused,
165
+ [classNames.option_selected]: optionIsSelected
166
+ }),
167
+ placeholder: () => classNames.placeholder,
168
+ singleValue: () => _pixelutils.cn.call(void 0, classNames.singleValue, `${getValueProps().className}`),
169
+ valueContainer: () => classNames.valueContainer
170
+ },
171
+ components: {
172
+ Input: InputComponent,
173
+ Option: OptionComponent,
174
+ DropdownIndicator: DropdownIndicatorComponent
175
+ },
176
+ "data-testid": `${testId}_select`,
177
+ filterOption,
178
+ formatOptionLabel: renderOptionLabel,
179
+ inputValue,
180
+ instanceId: name,
181
+ isClearable: clearable,
182
+ isDisabled: disabled,
183
+ isLoading: loading,
184
+ isMulti: multiSelect,
185
+ name,
186
+ menuPosition: "fixed",
187
+ menuShouldBlockScroll: true,
188
+ options,
189
+ placeholder,
190
+ onBlur: (_e) => {
191
+ setIsFocused(false);
192
+ return onBlur();
193
+ },
194
+ onChange: (option) => {
195
+ if (multiSelect) {
196
+ const transformedOptions = [];
197
+ _optionalChain([option, 'optionalAccess', _12 => _12.forEach, 'call', _13 => _13((o) => {
198
+ transformedOptions.push(o.value);
199
+ })]);
200
+ onChange(transformedOptions);
201
+ } else {
202
+ onChange(option && option.value);
203
+ }
204
+ },
205
+ onFocus: (_e) => {
206
+ setIsFocused(true);
207
+ },
208
+ onInputChange,
209
+ ref,
210
+ value: options.find((option) => option.value === value),
211
+ unstyled: true
212
+ }
213
+ ),
223
214
  error && // eslint-disable-next-line react/jsx-props-no-spreading
224
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...getHelperWrapperProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...getErrorMessageProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQTL5FREEcjs.FieldValidationError_default, { error }) }) })
225
- ] })
215
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...getHelperWrapperProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { ...getErrorMessageProps(), children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkOHJYXA6Rcjs.FieldValidationError_default, { error }) }) })
216
+ ]
226
217
  }
227
218
  )
228
219
  }
@@ -237,4 +228,4 @@ var Select_default2 = Select_default;
237
228
 
238
229
 
239
230
  exports.Select_default = Select_default; exports.Select_default2 = Select_default2;
240
- //# sourceMappingURL=chunk-QVBZ5RLN.cjs.map
231
+ //# sourceMappingURL=chunk-NXTXKBTP.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-NXTXKBTP.cjs","../src/Select/Select.tsx","../src/Select/index.ts"],"names":["Select_default"],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACE;AACF,wDAA6B;AAC7B;AACA;ACPA,8BAAyB;AACzB,gDAA2B;AAC3B,qGAAwC;AAExC,4CAA0B;AAE1B,oDAA6C;AAiGpC,+CAAA;AA3FF,IAAM,eA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AA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AAIA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACA,gBAAA;AACE,kBAAA;AACA,kBAAA;AACF,gBAAA;AACA,gBAAA;AACE,kBAAA;AACE,oBAAA;AAEA,oCAAA;AACE,sBAAA;AAA+B,oBAAA;AAEjC,oBAAA;AACF,kBAAA;AAEE,oBAAA;AACF,kBAAA;AACF,gBAAA;AACA,gBAAA;AACE,kBAAA;AACF,gBAAA;AACA,gBAAA;AACA,gBAAA;AAEA,gBAAA;AACA,gBAAA;AAAQ,cAAA;AACV,YAAA;AACC,YAAA;AAEC,4BAAA;AAKA,UAAA;AAAA,QAAA;AAEJ,MAAA;AAAA,IAAA;AAEJ,EAAA;AAEJ;AAEO;ADxFW;AACA;AEzNXA;AF2NW;AACA;AACA;AACA;AACA","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-NXTXKBTP.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { Props } from 'react-select';\n\nimport { useState } from 'react';\nimport { Controller } from 'react-hook-form';\nimport ReactSelect, { components } from 'react-select';\n\nimport { useSelect } from '@nextui-org/select';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\nimport { useFormContext } from '../hooks';\nimport { FieldCopyTestIdButton } from '../partials/FieldCopyTestIdButton';\nimport { FieldValidationError } from '../partials/FieldValidationError';\n\nexport const selectVariants = tv({\n slots: {\n base: 'group',\n clearIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-foreground-800',\n control:\n 'rounded-lg border-2 border-default-200 !duration-150 transition-background hover:border-default-400 group-data-[invalid=true]:border-danger group-data-[invalid=true]:hover:border-danger motion-reduce:transition-none',\n control_focused: 'border-primary hover:border-primary',\n crossIcon: '',\n downChevron: '',\n dropdownIndicator:\n 'rounded-md p-1 text-foreground-500 hover:cursor-pointer hover:bg-default-200 hover:text-black',\n group: '',\n groupHeading: 'mb-1 ml-3 mt-2 text-sm text-foreground-500',\n indicatorsContainer: 'gap-1 p-1',\n indicatorSeparator: 'bg-default-300',\n input: 'py-0.5 pl-1',\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 'pointer-events-auto relative bottom-1.5 ml-1 text-small subpixel-antialiased group-data-[invalid=true]:!text-danger group-data-[required=true]:after:ml-0.5 group-data-[required=true]:after:text-danger group-data-[required=true]:after:content-[\"*\"]',\n loadingIndicator: '',\n loadingMessage: '',\n menu: 'mt-2 rounded-xl border border-default-200 bg-content1 p-1 shadow-lg',\n menuList: '',\n // ensure menu has same z-index as modal so it is visible when rendered in modal\n // see: https://github.com/nextui-org/nextui/blob/main/packages/core/theme/src/components/modal.ts (see z-50)\n menuPortal: '!z-50',\n multiValue: 'items-center gap-1.5 rounded bg-default-100 py-0.5 pl-2 pr-1',\n multiValueContainer: '',\n multiValueLabel: 'py-0.5 leading-6',\n multiValueRemove:\n 'rounded text-default-500 hover:cursor-pointer hover:border-default-300 hover:text-default-800',\n noOptionsMessage: 'rounded-sm p-2 text-foreground-500',\n option_focused: 'bg-default-100 active:bg-default-200',\n option_selected: 'bg-default-300',\n option: 'rounded px-3 py-2 hover:cursor-pointer',\n placeholder: 'py-0.5 pl-1 text-foreground-500',\n selectContainer: '',\n singleValue: '!ml-1 !leading-7',\n valueContainer: 'gap-1 p-1',\n },\n});\n\ntype SelectOption = {\n /** option label */\n label?: React.ReactNode;\n /** option value */\n value: string;\n};\n\ntype VariantProps = TVProps<typeof selectVariants>;\ntype ClassName = TVClassName<typeof selectVariants>;\n\nexport interface SelectProps extends VariantProps {\n /** CSS class name */\n className?: ClassName; // string;\n /** Determine if the */\n clearable?: boolean;\n /** Set the select to disabled state. */\n disabled?: boolean;\n /** Filter Select Options */\n filterOption?:\n | undefined\n | ((option?: SelectOption, inputValue?: string) => boolean);\n /** Format the label of the option */\n renderOptionLabel?: undefined | Props['formatOptionLabel'];\n /** The value of the search input */\n inputValue?: string;\n /** Label that should be associated with the select. */\n label?: React.ReactNode;\n /** Set the select to a loading state. */\n loading?: boolean;\n /** switch between single and multi select mode. */\n multiSelect?: boolean;\n /** The name for the Select component, used by react-hook-form */\n name: string;\n /** Placeholder that is displayed when nothing is selected */\n placeholder?: string;\n /** The options for the Select component */\n options: SelectOption[];\n /** Handle change events on the input */\n onInputChange?: Props['onInputChange'];\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n}\n\nconst InputComponent: typeof components.Input = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_input`;\n // eslint-disable-next-line react/jsx-props-no-spreading\n return <components.Input data-testid={testId} {...props} />;\n};\n\nconst OptionComponent: typeof components.Option = (props) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types, react/destructuring-assignment\n const testId = `${props.selectProps['data-testid']}_option_${props?.data?.testId ?? props?.data?.value}`;\n return (\n <div data-testid={testId}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.Option {...props} />\n </div>\n );\n};\n\nconst DropdownIndicatorComponent: typeof components.DropdownIndicator = (\n props,\n) => {\n // @ts-expect-error data-testid is not a default prop\n // eslint-disable-next-line react/prop-types\n const testId = props?.selectProps['data-testid'] as string;\n return (\n <div data-testid={`${testId}_dropdown`}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <components.DropdownIndicator {...props} />\n </div>\n );\n};\n\n/** Select component based on [NextUI Select](https://nextui.org/docs/components/select) and [React-Select](https://react-select.com/home) */\nconst Select = ({\n className = undefined,\n clearable = true,\n disabled = false,\n filterOption = undefined,\n renderOptionLabel = undefined,\n inputValue = undefined,\n label: _label = undefined,\n loading = false,\n multiSelect = false,\n name,\n onInputChange = undefined,\n options,\n placeholder = undefined,\n testId: _testId = undefined,\n}: SelectProps) => {\n const { control, getFieldState } = useFormContext();\n const { error, invalid, required, testId } = getFieldState(name, _testId);\n\n const [isFocused, setIsFocused] = useState(false);\n\n const variants = selectVariants();\n const classNames = variantsToClassNames(variants, className, 'base');\n\n const {\n getBaseProps,\n getErrorMessageProps,\n getHelperWrapperProps,\n getLabelProps,\n getTriggerProps,\n getValueProps,\n label,\n } = useSelect({\n children: [],\n classNames,\n errorMessage: JSON.stringify(error),\n isDisabled: disabled,\n isInvalid: invalid,\n isLoading: loading,\n isRequired: required,\n label: _label,\n labelPlacement: 'outside',\n placeholder: ' ',\n });\n\n return (\n <Controller\n control={control}\n name={name}\n render={({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n field: { onChange, value, ref, onBlur },\n }) => (\n <div\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...getBaseProps()}\n className={cn(classNames.base)}\n data-testid={testId}\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-required={required}\n >\n {label && (\n <label\n className={classNames.label}\n data-slot=\"label\"\n htmlFor={`react-select-${name}-input`}\n id={getLabelProps().id}\n >\n {label}\n <FieldCopyTestIdButton testId={testId} />\n </label>\n )}\n <ReactSelect\n aria-errormessage=\"\"\n aria-labelledby={\n getTriggerProps()['aria-labelledby']?.split(' ')[1]\n }\n aria-invalid={invalid}\n classNames={{\n control: () =>\n cn(classNames.control, {\n [classNames.control_focused]: isFocused && !invalid,\n }),\n clearIndicator: () => classNames.clearIndicator,\n dropdownIndicator: () => classNames.dropdownIndicator,\n groupHeading: () => classNames.groupHeading,\n indicatorsContainer: () => classNames.indicatorsContainer,\n indicatorSeparator: () => classNames.indicatorSeparator,\n input: () => classNames.input,\n menu: () => classNames.menu,\n menuList: () => classNames.menuList,\n menuPortal: () => classNames.menuPortal,\n multiValue: () => classNames.multiValue,\n multiValueLabel: () =>\n cn(classNames.multiValueLabel, `${getValueProps().className}`),\n multiValueRemove: () => classNames.multiValueRemove,\n noOptionsMessage: () => classNames.noOptionsMessage,\n option: ({\n isFocused: optionIsFocused,\n isSelected: optionIsSelected,\n }) =>\n cn(classNames.option, {\n [classNames.option_focused]: optionIsFocused,\n [classNames.option_selected]: optionIsSelected,\n }),\n placeholder: () => classNames.placeholder,\n singleValue: () =>\n cn(classNames.singleValue, `${getValueProps().className}`),\n valueContainer: () => classNames.valueContainer,\n }}\n components={{\n Input: InputComponent,\n Option: OptionComponent,\n DropdownIndicator: DropdownIndicatorComponent,\n }}\n // Does not affect the testId of the select, but is needed to pass it to sub-components\n data-testid={`${testId}_select`}\n filterOption={filterOption}\n formatOptionLabel={renderOptionLabel}\n inputValue={inputValue}\n instanceId={name}\n isClearable={clearable}\n isDisabled={disabled}\n isLoading={loading}\n isMulti={multiSelect}\n name={name}\n // set menuPosition to fixed so that menu can be rendered\n // inside Card / Modal components, menuShouldBlockScroll\n // prevents container scroll when menu is open\n menuPosition=\"fixed\"\n menuShouldBlockScroll\n options={options}\n placeholder={placeholder}\n onBlur={(_e) => {\n setIsFocused(false);\n return onBlur();\n }}\n onChange={(option) => {\n if (multiSelect) {\n const transformedOptions: string[] = [];\n // @ts-expect-error in this case option is an array.\n option?.forEach((o: { value: string }) => {\n transformedOptions.push(o.value);\n });\n onChange(transformedOptions);\n } else {\n // @ts-expect-error in this case option is of type SelectOption and has the property value.\n onChange(option && option.value);\n }\n }}\n onFocus={(_e) => {\n setIsFocused(true);\n }}\n onInputChange={onInputChange}\n ref={ref}\n // set complete option as value by current field value\n value={options.find((option) => option.value === value)}\n unstyled\n />\n {error && (\n // eslint-disable-next-line react/jsx-props-no-spreading\n <div {...getHelperWrapperProps()}>\n {/* eslint-disable-next-line react/jsx-props-no-spreading */}\n <div {...getErrorMessageProps()}>\n <FieldValidationError error={error} />\n </div>\n </div>\n )}\n </div>\n )}\n />\n );\n};\n\nexport default Select;\n","import Select from './Select';\n\nexport type { SelectProps } from './Select';\n\nexport { Select };\n\nexport default Select;\n"]}
@@ -5,20 +5,21 @@ var _chunkBBB4FEY6cjs = require('./chunk-BBB4FEY6.cjs');
5
5
  // src/partials/FieldValidationError/FieldValidationError.tsx
6
6
  var _jsxruntime = require('react/jsx-runtime');
7
7
  var FieldValidationError = ({
8
+ className = void 0,
8
9
  error,
9
10
  testId = void 0
10
11
  }) => {
11
12
  if (!error) {
12
13
  return null;
13
14
  }
14
- let tmp_errors = [];
15
+ let tmpErrors = [];
15
16
  if (typeof error === "object" && !(error instanceof Array)) {
16
- const error_object = error;
17
+ const errorObject = error;
17
18
  Object.keys(error).forEach((key) => {
18
- tmp_errors = [...tmp_errors, ...error_object[key]];
19
+ tmpErrors = [...tmpErrors, ...errorObject[key]];
19
20
  });
20
21
  }
21
- const errorArray = JSON.stringify(tmp_errors) !== "[]" ? tmp_errors : error;
22
+ const errorArray = JSON.stringify(tmpErrors) !== "[]" ? tmpErrors : error;
22
23
  const errorStrings = errorArray.map((e) => e.message);
23
24
  const ariaString = `Error: ${errorStrings.join("\n")}`;
24
25
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -26,6 +27,7 @@ var FieldValidationError = ({
26
27
  {
27
28
  "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0, testId || errorStrings.join()),
28
29
  "aria-label": ariaString,
30
+ className,
29
31
  children: errorStrings.map((errorString, i) => (
30
32
  // eslint-disable-next-line react/no-array-index-key
31
33
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "li", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { children: errorString }) }, `error_${i}`)
@@ -42,4 +44,4 @@ var FieldValidationError_default2 = FieldValidationError_default;
42
44
 
43
45
 
44
46
  exports.FieldValidationError_default = FieldValidationError_default; exports.FieldValidationError_default2 = FieldValidationError_default2;
45
- //# sourceMappingURL=chunk-QTL5FREE.cjs.map
47
+ //# sourceMappingURL=chunk-OHJYXA6R.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-OHJYXA6R.cjs","../src/partials/FieldValidationError/FieldValidationError.tsx","../src/partials/FieldValidationError/index.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACyCU,+CAAA;AAhCV,IAAM,qBAAA,EAAuB,CAAC;AAAA,EAC5B,UAAA,EAAY,KAAA,CAAA;AAAA,EACZ,KAAA;AAAA,EACA,OAAA,EAAS,KAAA;AACX,CAAA,EAAA,GAAiC;AAC/B,EAAA,GAAA,CAAI,CAAC,KAAA,EAAO;AACV,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI,UAAA,EAA0B,CAAC,CAAA;AAE/B,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,SAAA,GAAY,CAAA,CAAE,MAAA,WAAiB,KAAA,CAAA,EAAQ;AAC1D,IAAA,MAAM,YAAA,EAAc,KAAA;AACpB,IAAA,MAAA,CAAO,IAAA,CAAK,KAAK,CAAA,CAAE,OAAA,CAAQ,CAAC,GAAA,EAAA,GAAQ;AAClC,MAAA,UAAA,EAAY,CAAC,GAAG,SAAA,EAAW,GAAG,WAAA,CAAY,GAAG,CAAC,CAAA;AAAA,IAChD,CAAC,CAAA;AAAA,EACH;AAEA,EAAA,MAAM,WAAA,EACJ,IAAA,CAAK,SAAA,CAAU,SAAS,EAAA,IAAM,KAAA,EAAO,UAAA,EAAa,KAAA;AACpD,EAAA,MAAM,aAAA,EAAyB,UAAA,CAAW,GAAA,CAAI,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,OAAO,CAAA;AAC9D,EAAA,MAAM,WAAA,EAAa,CAAA,OAAA,EAAU,YAAA,CAAa,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAGlD,EAAA;AAAC,IAAA;AAAA,IAAA;AAC6C,MAAA;AAChC,MAAA;AACZ,MAAA;AAEwC,MAAA;AAAA;AAGpC,wBAAA;AAEH,MAAA;AAAA,IAAA;AACH,EAAA;AAEJ;AAEe;ADdwC;AACA;AEjCxC;AFmCwC;AACA;AACA;AACA;AACA","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-OHJYXA6R.cjs","sourcesContent":[null,"import type { FieldError } from 'react-hook-form';\n\nimport { slugify } from '../../helpers';\n\nexport interface FieldValidationErrorProps {\n className?: string;\n error: FieldError[] | Record<string, FieldError[]>;\n testId?: string;\n}\n\n/**\n * Renders a validation error of a field\n */\nconst FieldValidationError = ({\n className = undefined,\n error,\n testId = undefined,\n}: FieldValidationErrorProps) => {\n if (!error) {\n return null;\n }\n\n let tmpErrors: FieldError[] = [];\n\n if (typeof error === 'object' && !(error instanceof Array)) {\n const errorObject = error as Record<string, FieldError[]>;\n Object.keys(error).forEach((key) => {\n tmpErrors = [...tmpErrors, ...errorObject[key]];\n });\n }\n\n const errorArray: FieldError[] =\n JSON.stringify(tmpErrors) !== '[]' ? tmpErrors : (error as FieldError[]);\n const errorStrings: string[] = errorArray.map((e) => e.message) as string[];\n const ariaString = `Error: ${errorStrings.join('\\n')}`;\n\n return (\n <ul\n data-testid={slugify(testId || errorStrings.join())}\n aria-label={ariaString} // TODO: ist das richtig @Hannes?\n className={className}\n >\n {errorStrings.map((errorString: string, i: number) => (\n // eslint-disable-next-line react/no-array-index-key\n <li key={`error_${i}`}>\n <div>{errorString}</div>\n </li>\n ))}\n </ul>\n );\n};\n\nexport default FieldValidationError;\n","import FieldValidationError from './FieldValidationError';\n\nexport type { FieldValidationErrorProps } from './FieldValidationError';\n\nexport { FieldValidationError };\n\nexport default FieldValidationError;\n"]}
@@ -3,7 +3,7 @@
3
3
  var _chunkKMMS4G7Acjs = require('./chunk-KMMS4G7A.cjs');
4
4
 
5
5
 
6
- var _chunkQTL5FREEcjs = require('./chunk-QTL5FREE.cjs');
6
+ var _chunkOHJYXA6Rcjs = require('./chunk-OHJYXA6R.cjs');
7
7
 
8
8
 
9
9
  var _chunkLDCRR7FPcjs = require('./chunk-LDCRR7FP.cjs');
@@ -71,16 +71,18 @@ var RadioBox = ({ icon = void 0, ...props }) => {
71
71
  var _pixels = require('@fuf-stack/pixels');
72
72
 
73
73
  var RadioButton = ({
74
+ children,
74
75
  className = void 0,
75
- value,
76
76
  isDisabled = false,
77
77
  onChange,
78
- children
78
+ testID = void 0,
79
+ value
79
80
  }) => {
80
81
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
81
82
  _pixels.Button,
82
83
  {
83
84
  className: _pixelutils.cn.call(void 0, className),
85
+ testId: testID,
84
86
  disabled: isDisabled,
85
87
  onClick: () => {
86
88
  return onChange(value);
@@ -93,6 +95,25 @@ var RadioButton = ({
93
95
 
94
96
  // src/RadioGroup/RadioGroup.tsx
95
97
 
98
+ var radioGroupVariants = _pixelutils.tv.call(void 0, {
99
+ slots: {
100
+ base: "group",
101
+ // Needs group for group-data condition
102
+ buttonGroup: "rounded-xl group-data-[invalid=true]:border group-data-[invalid=true]:border-danger",
103
+ // optional if a button group is used
104
+ itemBase: "",
105
+ itemBaseActive: "bg-opacity-50",
106
+ // optional if a button group is used
107
+ itemControl: "",
108
+ itemDescription: "",
109
+ itemLabel: "text-sm",
110
+ itemLabelWrapper: "",
111
+ itemWrapper: "",
112
+ // 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: ""
115
+ }
116
+ });
96
117
  var RadioGroup = ({
97
118
  className = void 0,
98
119
  disabled = false,
@@ -105,6 +126,8 @@ var RadioGroup = ({
105
126
  }) => {
106
127
  const { control, getFieldState, getValues } = _chunkLDCRR7FPcjs.useFormContext.call(void 0, );
107
128
  const { error, invalid, required, testId } = getFieldState(name, _testId);
129
+ const variants = radioGroupVariants();
130
+ const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
108
131
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
109
132
  _reacthookform.Controller,
110
133
  {
@@ -113,19 +136,28 @@ var RadioGroup = ({
113
136
  name,
114
137
  render: ({ field: { onChange, disabled: isDisabled, onBlur, ref } }) => {
115
138
  let RadioComponents;
139
+ const itemClassNames = {
140
+ base: classNames.itemBase,
141
+ control: classNames.itemControl,
142
+ description: classNames.itemDescription,
143
+ label: classNames.itemLabel,
144
+ labelWrapper: classNames.itemLabelWrapper,
145
+ wrapper: classNames.itemWrapper
146
+ };
116
147
  switch (variant) {
117
148
  case "radioBox":
118
149
  RadioComponents = options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
119
150
  RadioBox,
120
151
  {
152
+ classNames: itemClassNames,
121
153
  "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
122
154
  `${testId}_option_${option.testId || option.value}`
123
155
  ),
124
- isDisabled: isDisabled || option.disabled,
125
- value: option.value,
126
- onChange,
127
156
  description: option.description,
128
157
  icon: option.icon,
158
+ isDisabled: isDisabled || option.disabled,
159
+ onChange,
160
+ value: option.value,
129
161
  children: option.label ? option.label : option.value
130
162
  },
131
163
  option.value
@@ -135,15 +167,15 @@ var RadioGroup = ({
135
167
  RadioComponents = options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
136
168
  RadioButton,
137
169
  {
138
- "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
170
+ className: _pixelutils.cn.call(void 0, classNames.itemBase, {
171
+ [classNames.itemBaseActive]: getValues()[name] !== option.value
172
+ }),
173
+ isDisabled: isDisabled || option.disabled,
174
+ testID: _chunkBBB4FEY6cjs.slugify.call(void 0,
139
175
  `${testId}_option_${option.testId || option.value}`
140
176
  ),
141
- isDisabled: isDisabled || option.disabled,
142
- value: option.value,
143
177
  onChange,
144
- className: _pixelutils.cn.call(void 0,
145
- `${getValues()[name] !== option.value ? "bg-opacity-50" : ""}`
146
- ),
178
+ value: option.value,
147
179
  children: option.label ? option.label : option.value
148
180
  },
149
181
  option.value
@@ -153,12 +185,13 @@ var RadioGroup = ({
153
185
  RadioComponents = options.map((option) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
154
186
  _radio.Radio,
155
187
  {
188
+ classNames: itemClassNames,
156
189
  "data-testid": _chunkBBB4FEY6cjs.slugify.call(void 0,
157
190
  `${testId}_option_${option.testId || option.value}`
158
191
  ),
159
192
  isDisabled: isDisabled || option.disabled,
160
- value: option.value,
161
193
  onChange,
194
+ value: option.value,
162
195
  children: option.label ? option.label : option.value
163
196
  },
164
197
  option.value
@@ -167,25 +200,27 @@ var RadioGroup = ({
167
200
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
168
201
  _radio.RadioGroup,
169
202
  {
170
- className,
203
+ classNames,
204
+ "data-invalid": invalid,
205
+ "data-required": required,
171
206
  "data-testid": testId,
172
- errorMessage: error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkQTL5FREEcjs.FieldValidationError_default, { error }),
207
+ errorMessage: error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkOHJYXA6Rcjs.FieldValidationError_default, { error }),
173
208
  isDisabled,
174
209
  isInvalid: invalid,
175
210
  isRequired: required,
176
211
  label: label && // eslint-disable-next-line jsx-a11y/label-has-associated-control
177
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { className: `${invalid ? "text-danger" : ""}`, children: [
212
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "label", { children: [
178
213
  label,
179
214
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkKMMS4G7Acjs.FieldCopyTestIdButton_default, { testId })
180
215
  ] }),
216
+ name,
181
217
  orientation: inline ? "horizontal" : "vertical",
182
218
  onBlur,
183
219
  onChange,
184
- name,
185
220
  ref,
186
221
  children: variant === "radioButton" ? (
187
222
  // TODO: NextButtonGroup uses ref to modify Button style, but we wrap it, so it does not work at the moment.
188
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _button.ButtonGroup, { children: RadioComponents })
223
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _button.ButtonGroup, { className: classNames.buttonGroup, children: RadioComponents })
189
224
  ) : RadioComponents
190
225
  }
191
226
  );
@@ -202,4 +237,4 @@ var RadioGroup_default2 = RadioGroup_default;
202
237
 
203
238
 
204
239
  exports.RadioGroup_default = RadioGroup_default; exports.RadioGroup_default2 = RadioGroup_default2;
205
- //# sourceMappingURL=chunk-YUAJN6HW.cjs.map
240
+ //# sourceMappingURL=chunk-PAX2HXPK.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-PAX2HXPK.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;AACA;ACVA,gDAA2B;AAE3B,4CAA+C;AAC/C,0CAAoD;AAEpD,oDAA6C;ADU7C;AACA;AEhBA;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,4KAAA;AAAA,QACA;AAAA;AAAA,UAE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AAA,UAAA;AAEA,YAAA;AACE,cAAA;AAAC,cAAA;AAAA,gBAAA;AACa,gBAAA;AACC,kBAAA;AACsC,gBAAA;AACnD,gBAAA;AACiC,gBAAA;AAEjC,gBAAA;AACc,gBAAA;AAEwB,cAAA;AAAA,cAAA;AAJ1B,YAAA;AAMf,QAAA;AAGL,QAAA;AACE,UAAA;AAAC,UAAA;AAAA,YAAA;AAEC,YAAA;AAEc,YAAA;AACC,YAAA;AACF,YAAA;AAC8C,YAAA;AAC3D,YAAA;AACW,YAAA;AACC,YAAA;AAEV,4BAAA;AAGK,cAAA;AAAA,8BAAA;AACsC,YAAA;AACzC,YAAA;AAGJ,YAAA;AACqC,YAAA;AACrC,YAAA;AACA,YAAA;AACA,YAAA;AAEa;AAAA,8BAAA;AAIX,YAAA;AAEA,UAAA;AAAA,QAAA;AAEJ,MAAA;AAEJ,IAAA;AAAA,EAAA;AAGN;AAEA;ADuBA;AACA;AIlOA;AJoOA;AACA;AACA;AACA;AACA","file":"/home/runner/work/uniform/uniform/packages/uniform/dist/chunk-PAX2HXPK.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactElement, ReactNode } from 'react';\n\nimport { Controller } from 'react-hook-form';\n\nimport { ButtonGroup as NextButtonGroup } from '@nextui-org/button';\nimport { RadioGroup as NextRadioGroup, Radio } from '@nextui-org/radio';\n\nimport { cn, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\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: '',\n itemDescription: '',\n itemLabel: 'text-sm',\n itemLabelWrapper: '',\n itemWrapper: '',\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 },\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 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: RadioGroupOption[];\n /** Id to grab element in internal tests. */\n testId?: string;\n /** How the RadioGroup should look like. */\n variant?: 'default' | 'radioBox' | 'radioButton';\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): ReactElement => {\n const { control, getFieldState, getValues } = useFormContext();\n\n const { error, invalid, required, testId } = getFieldState(name, _testId);\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 };\n\n switch (variant) {\n case 'radioBox':\n RadioComponents = options.map((option) => (\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 break;\n case 'radioButton':\n RadioComponents = options.map((option) => (\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 break;\n default:\n RadioComponents = options.map((option) => (\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\n return (\n <NextRadioGroup\n // className={className}\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 label && (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label>\n {label}\n <FieldCopyTestIdButton testId={testId} />\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 // TODO: NextButtonGroup uses ref to modify Button style, but we wrap it, so it does not work at the moment.\n <NextButtonGroup className={classNames.buttonGroup}>\n {RadioComponents}\n </NextButtonGroup>\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-primary',\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"]}