@ultraviolet/form 6.2.0 → 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,65 +1,73 @@
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 { UnitInput } 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/UnitInputField/index.tsx
11
- const _excluded = [
12
- "name",
13
- "max",
14
- "min",
15
- "onChange",
16
- "onChangeUnitValue",
17
- "label",
18
- "required",
19
- "shouldUnregister",
20
- "validate",
21
- "control",
22
- "optionName"
23
- ];
24
- const UnitInputField = (_ref) => {
25
- let { name, max = Number.MAX_SAFE_INTEGER, min = 0, onChange, onChangeUnitValue, label = "", required, shouldUnregister = false, validate, control, optionName } = _ref;
26
- let props = _objectWithoutProperties(_ref, _excluded);
27
- const { getError } = useErrors();
28
- const { field: unitField } = useController({
29
- name: optionName !== null && optionName !== void 0 ? optionName : `${name}-unit`,
30
- rules: { required },
31
- shouldUnregister
32
- });
33
- const { field: valueField, fieldState: valueFieldState } = useController({
34
- control,
35
- name,
36
- rules: {
12
+ var _excluded, UnitInputField;
13
+ var init_UnitInputField = __esmMin(() => {
14
+ init_providers();
15
+ init_objectWithoutProperties();
16
+ init_objectSpread2();
17
+ _excluded = [
18
+ "name",
19
+ "max",
20
+ "min",
21
+ "onChange",
22
+ "onChangeUnitValue",
23
+ "label",
24
+ "required",
25
+ "shouldUnregister",
26
+ "validate",
27
+ "control",
28
+ "optionName"
29
+ ];
30
+ UnitInputField = (_ref) => {
31
+ let { name, max = Number.MAX_SAFE_INTEGER, min = 0, onChange, onChangeUnitValue, label = "", required, shouldUnregister = false, validate, control, optionName } = _ref;
32
+ let props = _objectWithoutProperties(_ref, _excluded);
33
+ const { getError } = useErrors();
34
+ const { field: unitField } = useController({
35
+ name: optionName !== null && optionName !== void 0 ? optionName : `${name}-unit`,
36
+ rules: { required },
37
+ shouldUnregister
38
+ });
39
+ const { field: valueField, fieldState: valueFieldState } = useController({
40
+ control,
41
+ name,
42
+ rules: {
43
+ max,
44
+ min,
45
+ required,
46
+ validate
47
+ },
48
+ shouldUnregister
49
+ });
50
+ return /* @__PURE__ */ jsx(UnitInput, _objectSpread2(_objectSpread2({}, props), {}, {
51
+ error: getError({ label }, valueFieldState.error),
52
+ label,
37
53
  max,
38
54
  min,
55
+ name,
56
+ onChange: (event) => {
57
+ valueField.onChange(event);
58
+ onChange === null || onChange === void 0 || onChange(event);
59
+ },
60
+ onChangeUnitValue: (event) => {
61
+ unitField.onChange(event);
62
+ onChangeUnitValue === null || onChangeUnitValue === void 0 || onChangeUnitValue(event);
63
+ },
39
64
  required,
40
- validate
41
- },
42
- shouldUnregister
43
- });
44
- return /* @__PURE__ */ jsx(UnitInput, _objectSpread2(_objectSpread2({}, props), {}, {
45
- error: getError({ label }, valueFieldState.error),
46
- label,
47
- max,
48
- min,
49
- name,
50
- onChange: (event) => {
51
- valueField.onChange(event);
52
- onChange === null || onChange === void 0 || onChange(event);
53
- },
54
- onChangeUnitValue: (event) => {
55
- unitField.onChange(event);
56
- onChangeUnitValue === null || onChangeUnitValue === void 0 || onChangeUnitValue(event);
57
- },
58
- required,
59
- unitValue: unitField.value,
60
- value: valueField.value
61
- }));
62
- };
65
+ unitValue: unitField.value,
66
+ value: valueField.value
67
+ }));
68
+ };
69
+ });
63
70
 
64
71
  //#endregion
65
- export { UnitInputField };
72
+ init_UnitInputField();
73
+ export { UnitInputField, init_UnitInputField };
@@ -1,48 +1,56 @@
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 { VerificationCode } 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/VerificationCodeField/index.tsx
11
- const _excluded = [
12
- "fields",
13
- "inputId",
14
- "label",
15
- "name",
16
- "onChange",
17
- "required",
18
- "validate"
19
- ];
20
- const VerificationCodeField = (_ref) => {
21
- let { fields, inputId = "verification-code-input", label, name, onChange, required, validate } = _ref;
22
- let props = _objectWithoutProperties(_ref, _excluded);
23
- const { getError } = useErrors();
24
- const { field, fieldState: { error } } = useController({
25
- name,
26
- rules: {
27
- required,
28
- validate: _objectSpread2({ required: (localValue) => {
29
- if (required && localValue.length !== (fields !== null && fields !== void 0 ? fields : 4)) return false;
30
- return true;
31
- } }, validate)
32
- }
33
- });
34
- return /* @__PURE__ */ jsx(VerificationCode, _objectSpread2(_objectSpread2({}, props), {}, {
35
- error: getError({ label: label !== null && label !== void 0 ? label : "verification-code-field" }, error),
36
- fields,
37
- inputId,
38
- label,
39
- onChange: (event) => {
40
- onChange === null || onChange === void 0 || onChange(event);
41
- field.onChange(event);
42
- },
43
- required
44
- }));
45
- };
12
+ var _excluded, VerificationCodeField;
13
+ var init_VerificationCodeField = __esmMin(() => {
14
+ init_providers();
15
+ init_objectWithoutProperties();
16
+ init_objectSpread2();
17
+ _excluded = [
18
+ "fields",
19
+ "inputId",
20
+ "label",
21
+ "name",
22
+ "onChange",
23
+ "required",
24
+ "validate"
25
+ ];
26
+ VerificationCodeField = (_ref) => {
27
+ let { fields, inputId = "verification-code-input", label, name, onChange, required, validate } = _ref;
28
+ let props = _objectWithoutProperties(_ref, _excluded);
29
+ const { getError } = useErrors();
30
+ const { field, fieldState: { error } } = useController({
31
+ name,
32
+ rules: {
33
+ required,
34
+ validate: _objectSpread2({ required: (localValue) => {
35
+ if (required && localValue.length !== (fields !== null && fields !== void 0 ? fields : 4)) return false;
36
+ return true;
37
+ } }, validate)
38
+ }
39
+ });
40
+ return /* @__PURE__ */ jsx(VerificationCode, _objectSpread2(_objectSpread2({}, props), {}, {
41
+ error: getError({ label: label !== null && label !== void 0 ? label : "verification-code-field" }, error),
42
+ fields,
43
+ inputId,
44
+ label,
45
+ onChange: (event) => {
46
+ onChange === null || onChange === void 0 || onChange(event);
47
+ field.onChange(event);
48
+ },
49
+ required
50
+ }));
51
+ };
52
+ });
46
53
 
47
54
  //#endregion
48
- export { VerificationCodeField };
55
+ init_VerificationCodeField();
56
+ export { VerificationCodeField, init_VerificationCodeField };
@@ -1,50 +1,56 @@
1
- import { __name } from "../../../_virtual/_rolldown/runtime.js";
2
- import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js";
3
- import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.114.0/helpers/objectSpread2.js";
1
+ import { __esmMin, __name } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { _objectWithoutProperties, init_objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js";
3
+ import { _objectSpread2, init_objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.115.0/helpers/objectSpread2.js";
4
4
  import { Stack } from "@ultraviolet/ui";
5
5
  import { CodeEditor } from "@ultraviolet/ui/compositions/CodeEditor";
6
6
  import { useController } from "react-hook-form";
7
7
  import { jsx } from "react/jsx-runtime";
8
8
 
9
9
  //#region src/components/compositions/CodeEditorField/index.tsx
10
- const _excluded = [
11
- "name",
12
- "onChange",
13
- "aria-label",
14
- "data-testid",
15
- "required",
16
- "validate",
17
- "onBlur"
18
- ];
19
- const CodeEditorField = (_ref) => {
20
- let { name, onChange, "aria-label": ariaLabel, "data-testid": dataTestId, required = false, validate, onBlur } = _ref;
21
- let props = _objectWithoutProperties(_ref, _excluded);
22
- const { field, fieldState: { error } } = useController({
23
- name,
24
- rules: {
25
- required,
26
- validate
27
- }
28
- });
29
- return /* @__PURE__ */ jsx(Stack, {
30
- gap: 1,
31
- children: /* @__PURE__ */ jsx(CodeEditor, _objectSpread2({
32
- "aria-label": ariaLabel,
33
- "data-testid": dataTestId,
34
- error: error === null || error === void 0 ? void 0 : error.message,
35
- onBlur: () => {
36
- field.onBlur();
37
- onBlur === null || onBlur === void 0 || onBlur(field.value);
38
- },
39
- onChange: (value) => {
40
- field.onChange(value);
41
- onChange === null || onChange === void 0 || onChange(value);
42
- },
43
- required,
44
- value: field.value
45
- }, props))
46
- });
47
- };
10
+ var _excluded, CodeEditorField;
11
+ var init_CodeEditorField = __esmMin(() => {
12
+ init_objectWithoutProperties();
13
+ init_objectSpread2();
14
+ _excluded = [
15
+ "name",
16
+ "onChange",
17
+ "aria-label",
18
+ "data-testid",
19
+ "required",
20
+ "validate",
21
+ "onBlur"
22
+ ];
23
+ CodeEditorField = (_ref) => {
24
+ let { name, onChange, "aria-label": ariaLabel, "data-testid": dataTestId, required = false, validate, onBlur } = _ref;
25
+ let props = _objectWithoutProperties(_ref, _excluded);
26
+ const { field, fieldState: { error } } = useController({
27
+ name,
28
+ rules: {
29
+ required,
30
+ validate
31
+ }
32
+ });
33
+ return /* @__PURE__ */ jsx(Stack, {
34
+ gap: 1,
35
+ children: /* @__PURE__ */ jsx(CodeEditor, _objectSpread2({
36
+ "aria-label": ariaLabel,
37
+ "data-testid": dataTestId,
38
+ error: error === null || error === void 0 ? void 0 : error.message,
39
+ onBlur: () => {
40
+ field.onBlur();
41
+ onBlur === null || onBlur === void 0 || onBlur(field.value);
42
+ },
43
+ onChange: (value) => {
44
+ field.onChange(value);
45
+ onChange === null || onChange === void 0 || onChange(value);
46
+ },
47
+ required,
48
+ value: field.value
49
+ }, props))
50
+ });
51
+ };
52
+ });
48
53
 
49
54
  //#endregion
50
- export { CodeEditorField };
55
+ init_CodeEditorField();
56
+ export { CodeEditorField, init_CodeEditorField };
@@ -1,20 +1,24 @@
1
- import { __name } from "../../../_virtual/_rolldown/runtime.js";
1
+ import { __esmMin, __name } from "../../../_virtual/_rolldown/runtime.js";
2
2
  import { useController } from "react-hook-form";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { CustomerSatisfaction } from "@ultraviolet/ui/compositions/CustomerSatisfaction";
5
5
 
6
6
  //#region src/components/compositions/CustomerSatisfactionField/index.tsx
7
- const CustomerSatisfactionField = ({ name, required }) => {
8
- var _field$value;
9
- const { field } = useController({
10
- name,
11
- rules: { required }
12
- });
13
- return /* @__PURE__ */ jsx(CustomerSatisfaction, {
14
- onChange: field.onChange,
15
- value: (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : 1
16
- });
17
- };
7
+ var CustomerSatisfactionField;
8
+ var init_CustomerSatisfactionField = __esmMin(() => {
9
+ CustomerSatisfactionField = ({ name, required }) => {
10
+ var _field$value;
11
+ const { field } = useController({
12
+ name,
13
+ rules: { required }
14
+ });
15
+ return /* @__PURE__ */ jsx(CustomerSatisfaction, {
16
+ onChange: field.onChange,
17
+ value: (_field$value = field.value) !== null && _field$value !== void 0 ? _field$value : 1
18
+ });
19
+ };
20
+ });
18
21
 
19
22
  //#endregion
20
- export { CustomerSatisfactionField };
23
+ init_CustomerSatisfactionField();
24
+ export { CustomerSatisfactionField, init_CustomerSatisfactionField };
@@ -1,57 +1,63 @@
1
- import { __name } from "../../../_virtual/_rolldown/runtime.js";
1
+ import { __esmMin, __name } from "../../../_virtual/_rolldown/runtime.js";
2
2
  import { useErrors } from "../../../providers/ErrorContext/index.js";
3
+ import { init_providers } from "../../../providers/index.js";
3
4
  import { Label, Stack, Text } from "@ultraviolet/ui";
4
5
  import { useController } from "react-hook-form";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { OfferList } from "@ultraviolet/ui/compositions/OfferList";
7
8
 
8
9
  //#region src/components/compositions/OfferListField/index.tsx
9
- const OfferListField = ({ expandable, type = "radio", columns, control, children, loading, autoCollapse, className, id, name, label, required, value, onChange, shouldUnregister }) => {
10
- const { getError } = useErrors();
11
- const { field, fieldState: { error } } = useController({
12
- control,
13
- defaultValue: value,
14
- name,
15
- rules: { required },
16
- shouldUnregister
17
- });
18
- return /* @__PURE__ */ jsxs(Stack, {
19
- className,
20
- gap: 1,
21
- id,
22
- children: [
23
- label ? /* @__PURE__ */ jsx(Label, {
24
- required,
25
- children: label
26
- }) : null,
27
- /* @__PURE__ */ jsx(OfferList, {
28
- autoCollapse,
29
- columns,
30
- expandable,
31
- loading,
32
- onChangeSelect: (val) => {
33
- field.onChange(val);
34
- onChange === null || onChange === void 0 || onChange(val);
35
- },
36
- selected: field.value,
37
- type,
38
- children
39
- }),
40
- error ? /* @__PURE__ */ jsx(Text, {
41
- as: "p",
42
- prominence: "default",
43
- sentiment: "danger",
44
- variant: "caption",
45
- children: getError({
46
- label: label !== null && label !== void 0 ? label : name,
47
- value: field.value
48
- }, error)
49
- }) : null
50
- ]
51
- });
52
- };
53
- OfferListField.Row = OfferList.Row;
54
- OfferListField.Cell = OfferList.Cell;
10
+ var OfferListField;
11
+ var init_OfferListField = __esmMin(() => {
12
+ init_providers();
13
+ OfferListField = ({ expandable, type = "radio", columns, control, children, loading, autoCollapse, className, id, name, label, required, value, onChange, shouldUnregister }) => {
14
+ const { getError } = useErrors();
15
+ const { field, fieldState: { error } } = useController({
16
+ control,
17
+ defaultValue: value,
18
+ name,
19
+ rules: { required },
20
+ shouldUnregister
21
+ });
22
+ return /* @__PURE__ */ jsxs(Stack, {
23
+ className,
24
+ gap: 1,
25
+ id,
26
+ children: [
27
+ label ? /* @__PURE__ */ jsx(Label, {
28
+ required,
29
+ children: label
30
+ }) : null,
31
+ /* @__PURE__ */ jsx(OfferList, {
32
+ autoCollapse,
33
+ columns,
34
+ expandable,
35
+ loading,
36
+ onChangeSelect: (val) => {
37
+ field.onChange(val);
38
+ onChange === null || onChange === void 0 || onChange(val);
39
+ },
40
+ selected: field.value,
41
+ type,
42
+ children
43
+ }),
44
+ error ? /* @__PURE__ */ jsx(Text, {
45
+ as: "p",
46
+ prominence: "default",
47
+ sentiment: "danger",
48
+ variant: "caption",
49
+ children: getError({
50
+ label: label !== null && label !== void 0 ? label : name,
51
+ value: field.value
52
+ }, error)
53
+ }) : null
54
+ ]
55
+ });
56
+ };
57
+ OfferListField.Row = OfferList.Row;
58
+ OfferListField.Cell = OfferList.Cell;
59
+ });
55
60
 
56
61
  //#endregion
57
- export { OfferListField };
62
+ init_OfferListField();
63
+ export { OfferListField, init_OfferListField };
@@ -1,55 +1,63 @@
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 { useController } from "react-hook-form";
7
8
  import { jsx } from "react/jsx-runtime";
8
9
  import { OptionSelector } from "@ultraviolet/ui/compositions/OptionSelector";
9
10
 
10
11
  //#region src/components/compositions/OptionSelectorField/index.tsx
11
- const _excluded = [
12
- "label",
13
- "required",
14
- "name",
15
- "aria-label",
16
- "shouldUnregister",
17
- "control",
18
- "validate",
19
- "onChange"
20
- ];
21
- const OptionSelectorField = (_ref) => {
22
- var _ref2;
23
- let { label = "", required, name, "aria-label": ariaLabel, shouldUnregister = false, control, validate, onChange } = _ref;
24
- let props = _objectWithoutProperties(_ref, _excluded);
25
- const { field, fieldState: { error } } = useController({
26
- control,
27
- name,
28
- rules: {
12
+ var _excluded, OptionSelectorField;
13
+ var init_OptionSelectorField = __esmMin(() => {
14
+ init_providers();
15
+ init_objectWithoutProperties();
16
+ init_objectSpread2();
17
+ _excluded = [
18
+ "label",
19
+ "required",
20
+ "name",
21
+ "aria-label",
22
+ "shouldUnregister",
23
+ "control",
24
+ "validate",
25
+ "onChange"
26
+ ];
27
+ OptionSelectorField = (_ref) => {
28
+ var _ref2;
29
+ let { label = "", required, name, "aria-label": ariaLabel, shouldUnregister = false, control, validate, onChange } = _ref;
30
+ let props = _objectWithoutProperties(_ref, _excluded);
31
+ const { field, fieldState: { error } } = useController({
32
+ control,
33
+ name,
34
+ rules: {
35
+ required,
36
+ validate: _objectSpread2({ completeSelection: (value) => {
37
+ if ((value === null || value === void 0 ? void 0 : value.first) && value.second) return true;
38
+ return false;
39
+ } }, validate)
40
+ },
41
+ shouldUnregister
42
+ });
43
+ const { getError } = useErrors();
44
+ return /* @__PURE__ */ jsx(OptionSelector, _objectSpread2({
45
+ "aria-label": ariaLabel,
46
+ error: getError({ label: (_ref2 = label !== null && label !== void 0 ? label : ariaLabel) !== null && _ref2 !== void 0 ? _ref2 : name }, error),
47
+ name: field.name,
48
+ onChange: (val) => {
49
+ field.onChange({
50
+ first: val.first,
51
+ second: val.second
52
+ });
53
+ onChange === null || onChange === void 0 || onChange(val);
54
+ },
29
55
  required,
30
- validate: _objectSpread2({ completeSelection: (value) => {
31
- if ((value === null || value === void 0 ? void 0 : value.first) && value.second) return true;
32
- return false;
33
- } }, validate)
34
- },
35
- shouldUnregister
36
- });
37
- const { getError } = useErrors();
38
- return /* @__PURE__ */ jsx(OptionSelector, _objectSpread2({
39
- "aria-label": ariaLabel,
40
- error: getError({ label: (_ref2 = label !== null && label !== void 0 ? label : ariaLabel) !== null && _ref2 !== void 0 ? _ref2 : name }, error),
41
- name: field.name,
42
- onChange: (val) => {
43
- field.onChange({
44
- first: val.first,
45
- second: val.second
46
- });
47
- onChange === null || onChange === void 0 || onChange(val);
48
- },
49
- required,
50
- value: field.value
51
- }, props));
52
- };
56
+ value: field.value
57
+ }, props));
58
+ };
59
+ });
53
60
 
54
61
  //#endregion
55
- export { OptionSelectorField };
62
+ init_OptionSelectorField();
63
+ export { OptionSelectorField, init_OptionSelectorField };
@@ -1,28 +1,32 @@
1
- import { __name } from "../../../_virtual/_rolldown/runtime.js";
1
+ import { __esmMin, __name } from "../../../_virtual/_rolldown/runtime.js";
2
2
  import { useController } from "react-hook-form";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { Plans } from "@ultraviolet/ui/compositions/Plans";
5
5
 
6
6
  //#region src/components/compositions/PlansField/index.tsx
7
- const PlansField = ({ name, control, features, plans, hideLabels, highlight, onChange, required }) => {
8
- const { field } = useController({
9
- control,
10
- name,
11
- rules: { required }
12
- });
13
- return /* @__PURE__ */ jsx(Plans, {
14
- features,
15
- fieldName: field.name,
16
- hideLabels,
17
- highlight,
18
- onChange: (value) => {
19
- field.onChange(value);
20
- if (onChange) onChange(value);
21
- },
22
- plans,
23
- value: field.value
24
- });
25
- };
7
+ var PlansField;
8
+ var init_PlansField = __esmMin(() => {
9
+ PlansField = ({ name, control, features, plans, hideLabels, highlight, onChange, required }) => {
10
+ const { field } = useController({
11
+ control,
12
+ name,
13
+ rules: { required }
14
+ });
15
+ return /* @__PURE__ */ jsx(Plans, {
16
+ features,
17
+ fieldName: field.name,
18
+ hideLabels,
19
+ highlight,
20
+ onChange: (value) => {
21
+ field.onChange(value);
22
+ if (onChange) onChange(value);
23
+ },
24
+ plans,
25
+ value: field.value
26
+ });
27
+ };
28
+ });
26
29
 
27
30
  //#endregion
28
- export { PlansField };
31
+ init_PlansField();
32
+ export { PlansField, init_PlansField };