@ultraviolet/form 6.2.1 → 6.2.2

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 (59) hide show
  1. package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/asyncToGenerator.js +5 -3
  2. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +19 -0
  3. package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/objectSpread2.js +8 -4
  4. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js +22 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.js +17 -0
  6. package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/toPrimitive.js +8 -4
  7. package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +17 -0
  8. package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/typeof.js +5 -3
  9. package/dist/_virtual/_rolldown/runtime.js +2 -1
  10. package/dist/components/CheckboxField/index.js +59 -51
  11. package/dist/components/CheckboxGroupField/index.js +67 -59
  12. package/dist/components/DateInputField/index.js +94 -84
  13. package/dist/components/FileInputField/index.js +64 -60
  14. package/dist/components/Form/defaultErrors.js +25 -21
  15. package/dist/components/Form/index.d.ts +2 -1
  16. package/dist/components/Form/index.d.ts.map +1 -1
  17. package/dist/components/Form/index.js +41 -31
  18. package/dist/components/KeyValueField/index.js +88 -86
  19. package/dist/components/NumberInputField/index.js +66 -57
  20. package/dist/components/RadioField/index.js +65 -57
  21. package/dist/components/RadioGroupField/index.js +50 -42
  22. package/dist/components/SelectInputField/index.js +56 -48
  23. package/dist/components/SelectableCardField/index.js +64 -58
  24. package/dist/components/SelectableCardGroupField/SelectableCardGroupField.js +56 -48
  25. package/dist/components/SelectableCardGroupField/index.js +9 -0
  26. package/dist/components/SelectableCardOptionGroupField/index.js +61 -53
  27. package/dist/components/SliderField/index.js +83 -75
  28. package/dist/components/Submit/index.js +22 -18
  29. package/dist/components/SubmitErrorAlert/index.js +15 -11
  30. package/dist/components/SwitchButtonField/index.js +47 -41
  31. package/dist/components/TagInputField/index.js +54 -45
  32. package/dist/components/TextAreaField/index.js +78 -72
  33. package/dist/components/TextInputField/index.js +67 -61
  34. package/dist/components/TimeInputField/index.js +50 -46
  35. package/dist/components/ToggleField/index.js +63 -55
  36. package/dist/components/ToggleGroupField/index.js +53 -45
  37. package/dist/components/UnitInputField/index.js +61 -53
  38. package/dist/components/VerificationCodeField/index.js +47 -39
  39. package/dist/components/compositions/CodeEditorField/index.js +48 -42
  40. package/dist/components/compositions/CustomerSatisfactionField/index.js +17 -13
  41. package/dist/components/compositions/OfferListField/index.js +54 -48
  42. package/dist/components/compositions/OptionSelectorField/index.js +53 -45
  43. package/dist/components/compositions/PlansField/index.js +25 -21
  44. package/dist/components/compositions/index.js +17 -5
  45. package/dist/components/index.js +59 -0
  46. package/dist/hooks/index.js +9 -0
  47. package/dist/hooks/useOnFieldChange.js +25 -24
  48. package/dist/index.js +14 -1
  49. package/dist/providers/ErrorContext/index.js +28 -24
  50. package/dist/providers/index.js +11 -0
  51. package/dist/utils/validateRegex.js +7 -3
  52. package/dist/validators/isInteger.js +11 -7
  53. package/dist/validators/maxDate.js +7 -3
  54. package/dist/validators/minDate.js +7 -3
  55. package/package.json +6 -6
  56. package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/defineProperty.js +0 -15
  57. package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js +0 -18
  58. package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutPropertiesLoose.js +0 -15
  59. package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/toPropertyKey.js +0 -12
@@ -1,68 +1,76 @@
1
1
  'use client';
2
- import { __name } from "../../_virtual/_rolldown/runtime.js";
3
- import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js";
4
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectSpread2.js";
2
+ import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { _objectWithoutProperties, init_objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js";
4
+ import { _objectSpread2, init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js";
5
5
  import { useErrors } from "../../providers/ErrorContext/index.js";
6
+ import { init_providers } from "../../providers/index.js";
6
7
  import { Radio } from "@ultraviolet/ui";
7
8
  import { useController } from "react-hook-form";
8
9
  import { jsx } from "react/jsx-runtime";
9
10
  import { useMemo } from "react";
10
11
 
11
12
  //#region src/components/RadioField/index.tsx
12
- const _excluded = [
13
- "control",
14
- "disabled",
15
- "name",
16
- "onBlur",
17
- "label",
18
- "onChange",
19
- "onFocus",
20
- "required",
21
- "value",
22
- "shouldUnregister",
23
- "validate",
24
- "aria-label"
25
- ];
26
- const RadioField = (_ref) => {
27
- let { control, disabled, name, onBlur, label = "", onChange, onFocus, required, value, shouldUnregister = false, validate, "aria-label": ariaLabel } = _ref;
28
- let props = _objectWithoutProperties(_ref, _excluded);
29
- const { getError } = useErrors();
30
- const { field, fieldState: { error } } = useController({
31
- control,
32
- name,
33
- rules: {
13
+ var _excluded, RadioField;
14
+ var init_RadioField = __esmMin(() => {
15
+ init_providers();
16
+ init_objectWithoutProperties();
17
+ init_objectSpread2();
18
+ _excluded = [
19
+ "control",
20
+ "disabled",
21
+ "name",
22
+ "onBlur",
23
+ "label",
24
+ "onChange",
25
+ "onFocus",
26
+ "required",
27
+ "value",
28
+ "shouldUnregister",
29
+ "validate",
30
+ "aria-label"
31
+ ];
32
+ RadioField = (_ref) => {
33
+ let { control, disabled, name, onBlur, label = "", onChange, onFocus, required, value, shouldUnregister = false, validate, "aria-label": ariaLabel } = _ref;
34
+ let props = _objectWithoutProperties(_ref, _excluded);
35
+ const { getError } = useErrors();
36
+ const { field, fieldState: { error } } = useController({
37
+ control,
38
+ name,
39
+ rules: {
40
+ required,
41
+ validate
42
+ },
43
+ shouldUnregister
44
+ });
45
+ const errorLabel = useMemo(() => {
46
+ if (label && typeof label === "string") return label;
47
+ if (ariaLabel) return ariaLabel;
48
+ return name;
49
+ }, [
50
+ label,
51
+ name,
52
+ ariaLabel
53
+ ]);
54
+ return /* @__PURE__ */ jsx(Radio, _objectSpread2(_objectSpread2({}, props), {}, {
55
+ checked: field.value === value,
56
+ disabled,
57
+ error: getError({ label: errorLabel }, error),
58
+ name: field.name,
59
+ onBlur: (event) => {
60
+ field.onBlur();
61
+ onBlur === null || onBlur === void 0 || onBlur(event);
62
+ },
63
+ onChange: () => {
64
+ field.onChange(value);
65
+ onChange === null || onChange === void 0 || onChange(value);
66
+ },
67
+ onFocus,
34
68
  required,
35
- validate
36
- },
37
- shouldUnregister
38
- });
39
- const errorLabel = useMemo(() => {
40
- if (label && typeof label === "string") return label;
41
- if (ariaLabel) return ariaLabel;
42
- return name;
43
- }, [
44
- label,
45
- name,
46
- ariaLabel
47
- ]);
48
- return /* @__PURE__ */ jsx(Radio, _objectSpread2(_objectSpread2({}, props), {}, {
49
- checked: field.value === value,
50
- disabled,
51
- error: getError({ label: errorLabel }, error),
52
- name: field.name,
53
- onBlur: (event) => {
54
- field.onBlur();
55
- onBlur === null || onBlur === void 0 || onBlur(event);
56
- },
57
- onChange: () => {
58
- field.onChange(value);
59
- onChange === null || onChange === void 0 || onChange(value);
60
- },
61
- onFocus,
62
- required,
63
- value: value !== null && value !== void 0 ? value : ""
64
- }, label ? { label } : { "aria-label": ariaLabel }));
65
- };
69
+ value: value !== null && value !== void 0 ? value : ""
70
+ }, label ? { label } : { "aria-label": ariaLabel }));
71
+ };
72
+ });
66
73
 
67
74
  //#endregion
68
- export { RadioField };
75
+ init_RadioField();
76
+ export { RadioField, init_RadioField };
@@ -1,52 +1,60 @@
1
1
  'use client';
2
- import { __name } from "../../_virtual/_rolldown/runtime.js";
3
- import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js";
4
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectSpread2.js";
2
+ import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { _objectWithoutProperties, init_objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js";
4
+ import { _objectSpread2, init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js";
5
5
  import { useErrors } from "../../providers/ErrorContext/index.js";
6
+ import { init_providers } from "../../providers/index.js";
6
7
  import { RadioGroup } from "@ultraviolet/ui";
7
8
  import { useController } from "react-hook-form";
8
9
  import { jsx } from "react/jsx-runtime";
9
10
 
10
11
  //#region src/components/RadioGroupField/index.tsx
11
- const _excluded = [
12
- "control",
13
- "name",
14
- "onChange",
15
- "required",
16
- "children",
17
- "error",
18
- "shouldUnregister",
19
- "validate",
20
- "legend"
21
- ];
22
- const RadioGroupFieldComponent = (_ref) => {
23
- var _getError;
24
- let { control, name, onChange, required, children, error: customError, shouldUnregister = false, validate, legend = "" } = _ref;
25
- let props = _objectWithoutProperties(_ref, _excluded);
26
- const { getError } = useErrors();
27
- const { field, fieldState: { error } } = useController({
28
- control,
29
- name,
30
- rules: {
12
+ var _excluded, RadioGroupFieldComponent, RadioGroupField;
13
+ var init_RadioGroupField = __esmMin(() => {
14
+ init_providers();
15
+ init_objectWithoutProperties();
16
+ init_objectSpread2();
17
+ _excluded = [
18
+ "control",
19
+ "name",
20
+ "onChange",
21
+ "required",
22
+ "children",
23
+ "error",
24
+ "shouldUnregister",
25
+ "validate",
26
+ "legend"
27
+ ];
28
+ RadioGroupFieldComponent = (_ref) => {
29
+ var _getError;
30
+ let { control, name, onChange, required, children, error: customError, shouldUnregister = false, validate, legend = "" } = _ref;
31
+ let props = _objectWithoutProperties(_ref, _excluded);
32
+ const { getError } = useErrors();
33
+ const { field, fieldState: { error } } = useController({
34
+ control,
35
+ name,
36
+ rules: {
37
+ required,
38
+ validate
39
+ },
40
+ shouldUnregister
41
+ });
42
+ return /* @__PURE__ */ jsx(RadioGroup, _objectSpread2(_objectSpread2({}, props), {}, {
43
+ error: (_getError = getError({ label: legend }, error)) !== null && _getError !== void 0 ? _getError : customError,
44
+ legend,
45
+ name: field.name,
46
+ onChange: (event) => {
47
+ field.onChange(event);
48
+ onChange === null || onChange === void 0 || onChange(event.target.value);
49
+ },
31
50
  required,
32
- validate
33
- },
34
- shouldUnregister
35
- });
36
- return /* @__PURE__ */ jsx(RadioGroup, _objectSpread2(_objectSpread2({}, props), {}, {
37
- error: (_getError = getError({ label: legend }, error)) !== null && _getError !== void 0 ? _getError : customError,
38
- legend,
39
- name: field.name,
40
- onChange: (event) => {
41
- field.onChange(event);
42
- onChange === null || onChange === void 0 || onChange(event.target.value);
43
- },
44
- required,
45
- value: field.value,
46
- children
47
- }));
48
- };
49
- const RadioGroupField = Object.assign(RadioGroupFieldComponent, { Radio: RadioGroup.Radio });
51
+ value: field.value,
52
+ children
53
+ }));
54
+ };
55
+ RadioGroupField = Object.assign(RadioGroupFieldComponent, { Radio: RadioGroup.Radio });
56
+ });
50
57
 
51
58
  //#endregion
52
- export { RadioGroupField };
59
+ init_RadioGroupField();
60
+ export { RadioGroupField, init_RadioGroupField };
@@ -1,59 +1,67 @@
1
1
  'use client';
2
- import { __name } from "../../_virtual/_rolldown/runtime.js";
3
- import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js";
4
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectSpread2.js";
2
+ import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { _objectWithoutProperties, init_objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js";
4
+ import { _objectSpread2, init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js";
5
5
  import { useErrors } from "../../providers/ErrorContext/index.js";
6
+ import { init_providers } from "../../providers/index.js";
6
7
  import { SelectInput } from "@ultraviolet/ui";
7
8
  import { useController } from "react-hook-form";
8
9
  import { jsx } from "react/jsx-runtime";
9
10
  import { useCallback } from "react";
10
11
 
11
12
  //#region src/components/SelectInputField/index.tsx
12
- const _excluded = [
13
- "label",
14
- "onBlur",
15
- "required",
16
- "name",
17
- "aria-label",
18
- "shouldUnregister",
19
- "control",
20
- "validate",
21
- "onChange",
22
- "multiselect"
23
- ];
24
- const SelectInputField = (_ref) => {
25
- var _ref2;
26
- let { label = "", onBlur, required, name, "aria-label": ariaLabel, shouldUnregister = false, control, validate, onChange, multiselect } = _ref;
27
- let props = _objectWithoutProperties(_ref, _excluded);
28
- const { field, fieldState: { error } } = useController({
29
- control,
30
- name,
31
- rules: {
13
+ var _excluded, SelectInputField;
14
+ var init_SelectInputField = __esmMin(() => {
15
+ init_providers();
16
+ init_objectWithoutProperties();
17
+ init_objectSpread2();
18
+ _excluded = [
19
+ "label",
20
+ "onBlur",
21
+ "required",
22
+ "name",
23
+ "aria-label",
24
+ "shouldUnregister",
25
+ "control",
26
+ "validate",
27
+ "onChange",
28
+ "multiselect"
29
+ ];
30
+ SelectInputField = (_ref) => {
31
+ var _ref2;
32
+ let { label = "", onBlur, required, name, "aria-label": ariaLabel, shouldUnregister = false, control, validate, onChange, multiselect } = _ref;
33
+ let props = _objectWithoutProperties(_ref, _excluded);
34
+ const { field, fieldState: { error } } = useController({
35
+ control,
36
+ name,
37
+ rules: {
38
+ required,
39
+ validate
40
+ },
41
+ shouldUnregister
42
+ });
43
+ const { getError } = useErrors();
44
+ const handleChange = useCallback((value) => {
45
+ onChange === null || onChange === void 0 || onChange(value);
46
+ field.onChange(value);
47
+ }, [onChange, field]);
48
+ return /* @__PURE__ */ jsx(SelectInput, _objectSpread2({
49
+ "aria-label": ariaLabel,
50
+ error: getError({ label: (_ref2 = label !== null && label !== void 0 ? label : ariaLabel) !== null && _ref2 !== void 0 ? _ref2 : name }, error),
51
+ label,
52
+ multiselect,
53
+ name: field.name,
54
+ onBlur: (event) => {
55
+ field.onBlur();
56
+ onBlur === null || onBlur === void 0 || onBlur(event);
57
+ },
58
+ onChange: handleChange,
32
59
  required,
33
- validate
34
- },
35
- shouldUnregister
36
- });
37
- const { getError } = useErrors();
38
- const handleChange = useCallback((value) => {
39
- onChange === null || onChange === void 0 || onChange(value);
40
- field.onChange(value);
41
- }, [onChange, field]);
42
- return /* @__PURE__ */ jsx(SelectInput, _objectSpread2({
43
- "aria-label": ariaLabel,
44
- error: getError({ label: (_ref2 = label !== null && label !== void 0 ? label : ariaLabel) !== null && _ref2 !== void 0 ? _ref2 : name }, error),
45
- label,
46
- multiselect,
47
- name: field.name,
48
- onBlur: (event) => {
49
- field.onBlur();
50
- onBlur === null || onBlur === void 0 || onBlur(event);
51
- },
52
- onChange: handleChange,
53
- required,
54
- value: field.value
55
- }, props));
56
- };
60
+ value: field.value
61
+ }, props));
62
+ };
63
+ });
57
64
 
58
65
  //#endregion
59
- export { SelectInputField };
66
+ init_SelectInputField();
67
+ export { SelectInputField, init_SelectInputField };
@@ -1,66 +1,72 @@
1
1
  'use client';
2
- import { __name } from "../../_virtual/_rolldown/runtime.js";
3
- import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js";
4
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectSpread2.js";
2
+ import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { _objectWithoutProperties, init_objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js";
4
+ import { _objectSpread2, init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js";
5
5
  import { SelectableCard } from "@ultraviolet/ui";
6
6
  import { useController } from "react-hook-form";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
 
9
9
  //#region src/components/SelectableCardField/index.tsx
10
- const _excluded = [
11
- "name",
12
- "control",
13
- "value",
14
- "onChange",
15
- "type",
16
- "onFocus",
17
- "onBlur",
18
- "required",
19
- "label",
20
- "shouldUnregister",
21
- "validate",
22
- "productIcon",
23
- "illustration",
24
- "aria-label"
25
- ];
26
- const SelectableCardField = (_ref) => {
27
- var _field$value;
28
- let { name, control, value, onChange, type, onFocus, onBlur, required, label, shouldUnregister = false, validate, productIcon, illustration, "aria-label": ariaLabel } = _ref;
29
- let props = _objectWithoutProperties(_ref, _excluded);
30
- const { field, fieldState: { error } } = useController({
31
- control,
32
- name,
33
- rules: {
34
- required,
35
- validate
36
- },
37
- shouldUnregister
38
- });
39
- const isChecked = (type === "checkbox" || type === "toggle") && Array.isArray(field.value) && value ? ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : []).includes(value) : field.value === value;
40
- return /* @__PURE__ */ jsx(SelectableCard, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, props), productIcon ? { productIcon } : { illustration }), label ? { label } : { "aria-label": ariaLabel }), {}, {
41
- checked: isChecked,
42
- isError: !!error,
43
- name: field.name,
44
- onBlur: (event) => {
45
- field.onBlur();
46
- onBlur === null || onBlur === void 0 || onBlur(event);
47
- },
48
- onChange: (event) => {
49
- if (type === "checkbox" || type === "toggle") {
50
- var _field$value2;
51
- const fieldValue = (_field$value2 = field.value) !== null && _field$value2 !== void 0 ? _field$value2 : [];
52
- if (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.includes(event.currentTarget.value)) field.onChange(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.filter((currentValue) => currentValue !== event.currentTarget.value));
53
- else field.onChange([...fieldValue, event.currentTarget.value]);
54
- } else field.onChange(event);
55
- onChange === null || onChange === void 0 || onChange(event.currentTarget.value);
56
- },
57
- onFocus: (event) => {
58
- onFocus === null || onFocus === void 0 || onFocus(event);
59
- },
60
- type,
61
- value: value !== null && value !== void 0 ? value : ""
62
- }));
63
- };
10
+ var _excluded, SelectableCardField;
11
+ var init_SelectableCardField = __esmMin(() => {
12
+ init_objectWithoutProperties();
13
+ init_objectSpread2();
14
+ _excluded = [
15
+ "name",
16
+ "control",
17
+ "value",
18
+ "onChange",
19
+ "type",
20
+ "onFocus",
21
+ "onBlur",
22
+ "required",
23
+ "label",
24
+ "shouldUnregister",
25
+ "validate",
26
+ "productIcon",
27
+ "illustration",
28
+ "aria-label"
29
+ ];
30
+ SelectableCardField = (_ref) => {
31
+ var _field$value;
32
+ let { name, control, value, onChange, type, onFocus, onBlur, required, label, shouldUnregister = false, validate, productIcon, illustration, "aria-label": ariaLabel } = _ref;
33
+ let props = _objectWithoutProperties(_ref, _excluded);
34
+ const { field, fieldState: { error } } = useController({
35
+ control,
36
+ name,
37
+ rules: {
38
+ required,
39
+ validate
40
+ },
41
+ shouldUnregister
42
+ });
43
+ const isChecked = (type === "checkbox" || type === "toggle") && Array.isArray(field.value) && value ? ((_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : []).includes(value) : field.value === value;
44
+ return /* @__PURE__ */ jsx(SelectableCard, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, props), productIcon ? { productIcon } : { illustration }), label ? { label } : { "aria-label": ariaLabel }), {}, {
45
+ checked: isChecked,
46
+ isError: !!error,
47
+ name: field.name,
48
+ onBlur: (event) => {
49
+ field.onBlur();
50
+ onBlur === null || onBlur === void 0 || onBlur(event);
51
+ },
52
+ onChange: (event) => {
53
+ if (type === "checkbox" || type === "toggle") {
54
+ var _field$value2;
55
+ const fieldValue = (_field$value2 = field.value) !== null && _field$value2 !== void 0 ? _field$value2 : [];
56
+ if (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.includes(event.currentTarget.value)) field.onChange(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.filter((currentValue) => currentValue !== event.currentTarget.value));
57
+ else field.onChange([...fieldValue, event.currentTarget.value]);
58
+ } else field.onChange(event);
59
+ onChange === null || onChange === void 0 || onChange(event.currentTarget.value);
60
+ },
61
+ onFocus: (event) => {
62
+ onFocus === null || onFocus === void 0 || onFocus(event);
63
+ },
64
+ type,
65
+ value: value !== null && value !== void 0 ? value : ""
66
+ }));
67
+ };
68
+ });
64
69
 
65
70
  //#endregion
66
- export { SelectableCardField };
71
+ init_SelectableCardField();
72
+ export { SelectableCardField, init_SelectableCardField };
@@ -1,59 +1,67 @@
1
1
  'use client';
2
- import { __name } from "../../_virtual/_rolldown/runtime.js";
3
- import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js";
4
- import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectSpread2.js";
2
+ import { __esmMin, __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { _objectWithoutProperties, init_objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js";
4
+ import { _objectSpread2, init_objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js";
5
5
  import { useErrors } from "../../providers/ErrorContext/index.js";
6
+ import { init_providers } from "../../providers/index.js";
6
7
  import { SelectableCardGroup } from "@ultraviolet/ui";
7
8
  import { useController } from "react-hook-form";
8
9
  import { jsx } from "react/jsx-runtime";
9
10
 
10
11
  //#region src/components/SelectableCardGroupField/SelectableCardGroupField.tsx
11
- const _excluded = [
12
- "legend",
13
- "control",
14
- "name",
15
- "onChange",
16
- "required",
17
- "error",
18
- "columns",
19
- "type",
20
- "shouldUnregister",
21
- "validate"
22
- ];
23
- const SelectableCardGroupFieldComponent = (_ref) => {
24
- var _getError;
25
- let { legend = "", control, name, onChange, required = false, error: customError, columns = 1, type = "radio", shouldUnregister = false, validate } = _ref;
26
- let props = _objectWithoutProperties(_ref, _excluded);
27
- const { getError } = useErrors();
28
- const { field, fieldState: { error } } = useController({
29
- control,
30
- name,
31
- rules: {
12
+ var _excluded, SelectableCardGroupFieldComponent, SelectableCardGroupField;
13
+ var init_SelectableCardGroupField = __esmMin(() => {
14
+ init_providers();
15
+ init_objectWithoutProperties();
16
+ init_objectSpread2();
17
+ _excluded = [
18
+ "legend",
19
+ "control",
20
+ "name",
21
+ "onChange",
22
+ "required",
23
+ "error",
24
+ "columns",
25
+ "type",
26
+ "shouldUnregister",
27
+ "validate"
28
+ ];
29
+ SelectableCardGroupFieldComponent = (_ref) => {
30
+ var _getError;
31
+ let { legend = "", control, name, onChange, required = false, error: customError, columns = 1, type = "radio", shouldUnregister = false, validate } = _ref;
32
+ let props = _objectWithoutProperties(_ref, _excluded);
33
+ const { getError } = useErrors();
34
+ const { field, fieldState: { error } } = useController({
35
+ control,
36
+ name,
37
+ rules: {
38
+ required,
39
+ validate
40
+ },
41
+ shouldUnregister
42
+ });
43
+ return /* @__PURE__ */ jsx(SelectableCardGroup, _objectSpread2(_objectSpread2({}, props), {}, {
44
+ columns,
45
+ error: (_getError = getError({ label: legend }, error)) !== null && _getError !== void 0 ? _getError : customError,
46
+ legend,
47
+ name,
48
+ onChange: (event) => {
49
+ if (type === "checkbox") {
50
+ var _field$value;
51
+ const fieldValue = (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : [];
52
+ if (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.includes(event.currentTarget.value)) field.onChange(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.filter((currentValue) => currentValue !== event.currentTarget.value));
53
+ else field.onChange([...fieldValue, event.currentTarget.value]);
54
+ } else field.onChange(event);
55
+ onChange === null || onChange === void 0 || onChange(event.currentTarget.value);
56
+ },
32
57
  required,
33
- validate
34
- },
35
- shouldUnregister
36
- });
37
- return /* @__PURE__ */ jsx(SelectableCardGroup, _objectSpread2(_objectSpread2({}, props), {}, {
38
- columns,
39
- error: (_getError = getError({ label: legend }, error)) !== null && _getError !== void 0 ? _getError : customError,
40
- legend,
41
- name,
42
- onChange: (event) => {
43
- if (type === "checkbox") {
44
- var _field$value;
45
- const fieldValue = (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : [];
46
- if (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.includes(event.currentTarget.value)) field.onChange(fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.filter((currentValue) => currentValue !== event.currentTarget.value));
47
- else field.onChange([...fieldValue, event.currentTarget.value]);
48
- } else field.onChange(event);
49
- onChange === null || onChange === void 0 || onChange(event.currentTarget.value);
50
- },
51
- required,
52
- type,
53
- value: field.value
54
- }));
55
- };
56
- const SelectableCardGroupField = Object.assign(SelectableCardGroupFieldComponent, { Card: SelectableCardGroup.Card });
58
+ type,
59
+ value: field.value
60
+ }));
61
+ };
62
+ SelectableCardGroupField = Object.assign(SelectableCardGroupFieldComponent, { Card: SelectableCardGroup.Card });
63
+ });
57
64
 
58
65
  //#endregion
66
+ init_SelectableCardGroupField();
59
67
  export { SelectableCardGroupField };
@@ -0,0 +1,9 @@
1
+ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
2
+ import { SelectableCardGroupField } from "./SelectableCardGroupField.js";
3
+
4
+ //#region src/components/SelectableCardGroupField/index.ts
5
+ var init_SelectableCardGroupField = __esmMin(() => {});
6
+
7
+ //#endregion
8
+ init_SelectableCardGroupField();
9
+ export { init_SelectableCardGroupField };