@ultraviolet/form 6.0.16 → 6.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/.vite/license.md +3 -0
  2. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/asyncToGenerator.js +32 -0
  3. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/defineProperty.js +15 -0
  4. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js +28 -0
  5. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js +18 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutPropertiesLoose.js +15 -0
  7. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPrimitive.js +17 -0
  8. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/toPropertyKey.js +12 -0
  9. package/dist/_virtual/_@oxc-project_runtime@0.113.0/helpers/typeof.js +14 -0
  10. package/dist/_virtual/_rolldown/runtime.js +9 -0
  11. package/dist/components/CheckboxField/index.d.ts +1 -1
  12. package/dist/components/CheckboxField/index.d.ts.map +1 -1
  13. package/dist/components/CheckboxField/index.js +57 -56
  14. package/dist/components/CheckboxGroupField/index.d.ts.map +1 -1
  15. package/dist/components/CheckboxGroupField/index.js +65 -95
  16. package/dist/components/DateInputField/index.d.ts.map +1 -1
  17. package/dist/components/DateInputField/index.js +92 -91
  18. package/dist/components/FileInputField/index.js +68 -75
  19. package/dist/components/Form/defaultErrors.js +23 -20
  20. package/dist/components/Form/index.d.ts.map +1 -1
  21. package/dist/components/Form/index.js +39 -37
  22. package/dist/components/KeyValueField/index.d.ts.map +1 -1
  23. package/dist/components/KeyValueField/index.js +94 -106
  24. package/dist/components/NumberInputField/index.d.ts +1 -1
  25. package/dist/components/NumberInputField/index.d.ts.map +1 -1
  26. package/dist/components/NumberInputField/index.js +66 -66
  27. package/dist/components/RadioField/index.d.ts +1 -1
  28. package/dist/components/RadioField/index.d.ts.map +1 -1
  29. package/dist/components/RadioField/index.js +65 -66
  30. package/dist/components/RadioGroupField/index.d.ts.map +1 -1
  31. package/dist/components/RadioGroupField/index.js +49 -55
  32. package/dist/components/SelectInputField/index.d.ts +1 -1
  33. package/dist/components/SelectInputField/index.d.ts.map +1 -1
  34. package/dist/components/SelectInputField/index.js +56 -58
  35. package/dist/components/SelectableCardField/index.d.ts +1 -1
  36. package/dist/components/SelectableCardField/index.d.ts.map +1 -1
  37. package/dist/components/SelectableCardField/index.js +63 -74
  38. package/dist/components/SelectableCardGroupField/SelectableCardGroupField.d.ts.map +1 -1
  39. package/dist/components/SelectableCardGroupField/SelectableCardGroupField.js +56 -67
  40. package/dist/components/SelectableCardOptionGroupField/index.js +60 -62
  41. package/dist/components/SliderField/index.d.ts +1 -1
  42. package/dist/components/SliderField/index.d.ts.map +1 -1
  43. package/dist/components/SliderField/index.js +85 -87
  44. package/dist/components/Submit/index.d.ts.map +1 -1
  45. package/dist/components/Submit/index.js +23 -34
  46. package/dist/components/SubmitErrorAlert/index.d.ts +1 -1
  47. package/dist/components/SubmitErrorAlert/index.d.ts.map +1 -1
  48. package/dist/components/SubmitErrorAlert/index.js +15 -7
  49. package/dist/components/SwitchButtonField/index.d.ts +8 -8
  50. package/dist/components/SwitchButtonField/index.d.ts.map +1 -1
  51. package/dist/components/SwitchButtonField/index.js +45 -44
  52. package/dist/components/TagInputField/index.d.ts +1 -1
  53. package/dist/components/TagInputField/index.d.ts.map +1 -1
  54. package/dist/components/TagInputField/index.js +51 -55
  55. package/dist/components/TextAreaField/index.d.ts +1 -1
  56. package/dist/components/TextAreaField/index.d.ts.map +1 -1
  57. package/dist/components/TextAreaField/index.js +82 -89
  58. package/dist/components/TextInputField/index.d.ts +1 -1
  59. package/dist/components/TextInputField/index.d.ts.map +1 -1
  60. package/dist/components/TextInputField/index.js +70 -75
  61. package/dist/components/TimeInputField/index.d.ts +1 -1
  62. package/dist/components/TimeInputField/index.d.ts.map +1 -1
  63. package/dist/components/TimeInputField/index.js +53 -53
  64. package/dist/components/ToggleField/index.d.ts +1 -1
  65. package/dist/components/ToggleField/index.d.ts.map +1 -1
  66. package/dist/components/ToggleField/index.js +62 -72
  67. package/dist/components/ToggleGroupField/index.d.ts.map +1 -1
  68. package/dist/components/ToggleGroupField/index.js +51 -63
  69. package/dist/components/UnitInputField/index.d.ts.map +1 -1
  70. package/dist/components/UnitInputField/index.js +62 -59
  71. package/dist/components/VerificationCodeField/index.d.ts.map +1 -1
  72. package/dist/components/VerificationCodeField/index.js +45 -50
  73. package/dist/components/compositions/OfferListField/index.d.ts +54 -0
  74. package/dist/components/compositions/OfferListField/index.d.ts.map +1 -0
  75. package/dist/components/compositions/OfferListField/index.js +57 -0
  76. package/dist/components/compositions/OptionSelectorField/index.d.ts +1 -1
  77. package/dist/components/compositions/OptionSelectorField/index.d.ts.map +1 -1
  78. package/dist/components/compositions/OptionSelectorField/index.js +52 -53
  79. package/dist/components/compositions/PlansField/index.d.ts +8 -0
  80. package/dist/components/compositions/PlansField/index.d.ts.map +1 -0
  81. package/dist/components/compositions/PlansField/index.js +28 -0
  82. package/dist/components/compositions/index.d.ts +2 -0
  83. package/dist/components/compositions/index.d.ts.map +1 -1
  84. package/dist/components/compositions/index.js +4 -3
  85. package/dist/hooks/useOnFieldChange.d.ts.map +1 -1
  86. package/dist/hooks/useOnFieldChange.js +28 -17
  87. package/dist/index.js +6 -40
  88. package/dist/providers/ErrorContext/index.d.ts.map +1 -1
  89. package/dist/providers/ErrorContext/index.js +25 -31
  90. package/dist/utils/validateRegex.d.ts +1 -1
  91. package/dist/utils/validateRegex.d.ts.map +1 -1
  92. package/dist/utils/validateRegex.js +7 -6
  93. package/dist/validators/index.d.ts +2 -2
  94. package/dist/validators/index.d.ts.map +1 -1
  95. package/dist/validators/isInteger.d.ts +1 -1
  96. package/dist/validators/isInteger.d.ts.map +1 -1
  97. package/dist/validators/isInteger.js +9 -10
  98. package/dist/validators/maxDate.d.ts +1 -1
  99. package/dist/validators/maxDate.d.ts.map +1 -1
  100. package/dist/validators/maxDate.js +6 -3
  101. package/dist/validators/minDate.d.ts +1 -1
  102. package/dist/validators/minDate.d.ts.map +1 -1
  103. package/dist/validators/minDate.js +6 -3
  104. package/package.json +8 -8
  105. package/LICENSE +0 -189
@@ -1,66 +1,54 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { useErrors } from "../../providers/ErrorContext/index.js";
4
+ import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js";
5
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
3
6
  import { ToggleGroup } from "@ultraviolet/ui";
4
7
  import { useController } from "react-hook-form";
5
- import { useErrors } from "../../providers/ErrorContext/index.js";
6
- const ToggleGroupFieldComponent = ({
7
- legend = "",
8
- control,
9
- onChange,
10
- error: customError,
11
- name,
12
- required = false,
13
- shouldUnregister = false,
14
- validate,
15
- ...props
16
- }) => {
17
- const { getError } = useErrors();
18
- const {
19
- field,
20
- fieldState: { error }
21
- } = useController({
22
- control,
23
- name,
24
- rules: {
25
- validate: {
26
- ...required ? { required: (value2) => value2.length > 0 } : void 0,
27
- ...validate
28
- }
29
- },
30
- shouldUnregister
31
- });
32
- const value = field.value;
33
- return /* @__PURE__ */ jsx(
34
- ToggleGroup,
35
- {
36
- ...props,
37
- error: customError ?? getError({ label: legend }, error),
38
- legend,
39
- name: field.name,
40
- onChange: (event) => {
41
- if (value.includes(event.currentTarget.value)) {
42
- const newValue = value.filter(
43
- (currentValue) => currentValue !== event.currentTarget.value
44
- );
45
- field.onChange(newValue);
46
- onChange?.(newValue);
47
- } else {
48
- const newValue = [...value, event.currentTarget.value];
49
- field.onChange(newValue);
50
- onChange?.(newValue);
51
- }
52
- },
53
- required,
54
- value
55
- }
56
- );
57
- };
58
- const ToggleGroupField = Object.assign(
59
- ToggleGroupFieldComponent,
60
- {
61
- Toggle: ToggleGroup.Toggle
62
- }
63
- );
64
- export {
65
- ToggleGroupField
8
+ import { jsx } from "react/jsx-runtime";
9
+
10
+ //#region src/components/ToggleGroupField/index.tsx
11
+ const _excluded = [
12
+ "legend",
13
+ "control",
14
+ "onChange",
15
+ "error",
16
+ "name",
17
+ "required",
18
+ "shouldUnregister",
19
+ "validate"
20
+ ];
21
+ const ToggleGroupFieldComponent = (_ref) => {
22
+ let { legend = "", control, onChange, error: customError, name, required = false, shouldUnregister = false, validate } = _ref;
23
+ let props = _objectWithoutProperties(_ref, _excluded);
24
+ const { getError } = useErrors();
25
+ const { field, fieldState: { error } } = useController({
26
+ control,
27
+ name,
28
+ rules: { validate: _objectSpread2(_objectSpread2({}, required ? { required: (value) => value.length > 0 } : void 0), validate) },
29
+ shouldUnregister
30
+ });
31
+ const value = field.value;
32
+ return /* @__PURE__ */ jsx(ToggleGroup, _objectSpread2(_objectSpread2({}, props), {}, {
33
+ error: customError !== null && customError !== void 0 ? customError : getError({ label: legend }, error),
34
+ legend,
35
+ name: field.name,
36
+ onChange: (event) => {
37
+ if (value.includes(event.currentTarget.value)) {
38
+ const newValue = value.filter((currentValue) => currentValue !== event.currentTarget.value);
39
+ field.onChange(newValue);
40
+ onChange === null || onChange === void 0 || onChange(newValue);
41
+ } else {
42
+ const newValue = [...value, event.currentTarget.value];
43
+ field.onChange(newValue);
44
+ onChange === null || onChange === void 0 || onChange(newValue);
45
+ }
46
+ },
47
+ required,
48
+ value
49
+ }));
66
50
  };
51
+ const ToggleGroupField = Object.assign(ToggleGroupFieldComponent, { Toggle: ToggleGroup.Toggle });
52
+
53
+ //#endregion
54
+ export { ToggleGroupField };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/UnitInputField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAA;AAG9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,KAAK,mBAAmB,CACtB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAEH,eAAO,MAAM,cAAc,GACzB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EACpE,6HAaC,mBAAmB,CAAC,YAAY,EAAE,UAAU,CAAC,4CA4C/C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/UnitInputField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAA;AAG9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,KAAK,mBAAmB,CACtB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC,GAAG;IACvE,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,CAAA;AAEH,eAAO,MAAM,cAAc,GACzB,YAAY,sBACZ,UAAU,kRA0DX,CAAA"}
@@ -1,62 +1,65 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { useErrors } from "../../providers/ErrorContext/index.js";
4
+ import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js";
5
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
3
6
  import { UnitInput } from "@ultraviolet/ui";
4
7
  import { useController } from "react-hook-form";
5
- import { useErrors } from "../../providers/ErrorContext/index.js";
6
- const UnitInputField = ({
7
- name,
8
- max = Number.MAX_SAFE_INTEGER,
9
- min = 0,
10
- onChange,
11
- onChangeUnitValue,
12
- label = "",
13
- required,
14
- shouldUnregister = false,
15
- validate,
16
- control,
17
- optionName,
18
- ...props
19
- }) => {
20
- const { getError } = useErrors();
21
- const { field: unitField } = useController({
22
- name: optionName ?? `${name}-unit`,
23
- rules: { required },
24
- shouldUnregister
25
- });
26
- const { field: valueField, fieldState: valueFieldState } = useController({
27
- control,
28
- name,
29
- rules: {
30
- max,
31
- min,
32
- required,
33
- validate
34
- },
35
- shouldUnregister
36
- });
37
- return /* @__PURE__ */ jsx(
38
- UnitInput,
39
- {
40
- ...props,
41
- error: getError({ label }, valueFieldState.error),
42
- label,
43
- max,
44
- min,
45
- name,
46
- onChange: (event) => {
47
- valueField.onChange(event);
48
- onChange?.(event);
49
- },
50
- onChangeUnitValue: (event) => {
51
- unitField.onChange(event);
52
- onChangeUnitValue?.(event);
53
- },
54
- required,
55
- unitValue: unitField.value,
56
- value: valueField.value
57
- }
58
- );
59
- };
60
- export {
61
- UnitInputField
8
+ import { jsx } from "react/jsx-runtime";
9
+
10
+ //#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: {
37
+ max,
38
+ min,
39
+ 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
62
  };
63
+
64
+ //#endregion
65
+ export { UnitInputField };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VerificationCodeField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,KAAK,0BAA0B,CAC7B,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAA;AAExD,eAAO,MAAM,qBAAqB,GAChC,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,0EASC,0BAA0B,CAAC,YAAY,EAAE,KAAK,CAAC,4CAqCjD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/VerificationCodeField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,KAAK,0BAA0B,CAC7B,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,gBAAgB,CAAC,EAAE,OAAO,CAAC,CAAA;AAExD,eAAO,MAAM,qBAAqB,GAChC,YAAY,sBACZ,KAAK,iOA+CN,CAAA"}
@@ -1,53 +1,48 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { useErrors } from "../../providers/ErrorContext/index.js";
4
+ import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js";
5
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
3
6
  import { VerificationCode } from "@ultraviolet/ui";
4
7
  import { useController } from "react-hook-form";
5
- import { useErrors } from "../../providers/ErrorContext/index.js";
6
- const VerificationCodeField = ({
7
- fields,
8
- inputId = "verification-code-input",
9
- label,
10
- name,
11
- onChange,
12
- required,
13
- validate,
14
- ...props
15
- }) => {
16
- const { getError } = useErrors();
17
- const {
18
- field,
19
- fieldState: { error }
20
- } = useController({
21
- name,
22
- rules: {
23
- required,
24
- validate: {
25
- required: (localValue) => {
26
- if (required && localValue.length !== (fields ?? 4)) {
27
- return false;
28
- }
29
- return true;
30
- },
31
- ...validate
32
- }
33
- }
34
- });
35
- return /* @__PURE__ */ jsx(
36
- VerificationCode,
37
- {
38
- ...props,
39
- error: getError({ label: label ?? "verification-code-field" }, error),
40
- fields,
41
- inputId,
42
- label,
43
- onChange: (event) => {
44
- onChange?.(event);
45
- field.onChange(event);
46
- },
47
- required
48
- }
49
- );
50
- };
51
- export {
52
- VerificationCodeField
8
+ import { jsx } from "react/jsx-runtime";
9
+
10
+ //#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
+ }));
53
45
  };
46
+
47
+ //#endregion
48
+ export { VerificationCodeField };
@@ -0,0 +1,54 @@
1
+ import type { BaseFieldProps, FieldPath, FieldValues } from '@ultraviolet/form';
2
+ import { OfferList } from '@ultraviolet/ui/compositions/OfferList';
3
+ import type { ComponentProps, ReactNode } from 'react';
4
+ type OfferListFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof OfferList>, 'selected' | 'onChangeSelect'> & {
5
+ className?: string;
6
+ id?: string;
7
+ name: string;
8
+ label?: string | ReactNode;
9
+ required?: boolean;
10
+ };
11
+ declare function OfferListField<TFieldValues extends FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ expandable, type, columns, control, children, loading, autoCollapse, className, id, name, label, required, value, onChange, shouldUnregister }: OfferListFieldProps<TFieldValues, TName>): import("react/jsx-runtime").JSX.Element;
12
+ declare namespace OfferListField {
13
+ var Row: ({ children, disabled, id, banner, expandablePadding, offerName, expandable: expandableContent, selectDisabled, highlightAnimation, expanded, className, 'data-dragging': dataDragging, 'data-testid': dataTestId, style, badge, }: {
14
+ children: ReactNode;
15
+ id: string;
16
+ expandable?: ReactNode;
17
+ selectDisabled?: string | boolean | undefined;
18
+ disabled?: boolean | undefined;
19
+ sentiment?: "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | undefined;
20
+ expanded?: boolean | undefined;
21
+ className?: string | undefined;
22
+ expandablePadding?: "0" | "0.25" | "0.5" | "1" | "1.5" | "10" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | undefined;
23
+ highlightAnimation?: boolean | undefined;
24
+ 'data-testid'?: string | undefined;
25
+ style?: import("react").CSSProperties | undefined;
26
+ 'data-dragging'?: boolean | undefined;
27
+ onMouseEnter?: import("react").MouseEventHandler<HTMLTableRowElement> | undefined;
28
+ onMouseLeave?: import("react").MouseEventHandler<HTMLTableRowElement> | undefined;
29
+ onClick?: ((id: string) => void) | undefined;
30
+ } & import("react").RefAttributes<HTMLTableRowElement> & {
31
+ banner?: {
32
+ text: ReactNode;
33
+ sentiment?: "danger" | "neutral" | "primary" | "warning" | undefined;
34
+ } | undefined;
35
+ offerName: string;
36
+ badge?: {
37
+ text: string;
38
+ sentiment?: "black" | "danger" | "info" | "neutral" | "primary" | "secondary" | "success" | "warning" | "white" | undefined;
39
+ prominence?: "default" | "strong" | undefined;
40
+ } | undefined;
41
+ style?: import("react").CSSProperties | undefined;
42
+ }) => import("react/jsx-runtime").JSX.Element;
43
+ }
44
+ declare namespace OfferListField {
45
+ var Cell: ({ children, className, 'data-testid': dataTestId, colSpan, style, }: {
46
+ children?: ReactNode;
47
+ className?: string | undefined;
48
+ 'data-testid'?: string | undefined;
49
+ colSpan?: number | undefined;
50
+ style?: import("react").CSSProperties | undefined;
51
+ } & import("react").RefAttributes<HTMLTableCellElement>) => import("react/jsx-runtime").JSX.Element;
52
+ }
53
+ export { OfferListField };
54
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OfferListField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,WAAW,EAGZ,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAA;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItD,KAAK,mBAAmB,CACtB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,SAAS,CAAC,EAAE,UAAU,GAAG,gBAAgB,CAAC,GAAG;IACtE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA;gCAGD,YAAY,SAAS,WAAW,EAChC,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EAC/D,EACA,UAAU,EACV,IAAc,EACd,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,SAAS,EACT,EAAE,EACF,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,gBAAgB,EACjB,EAAE,mBAAmB,CAAC,YAAY,EAAE,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmD3C,OAAO,EAAE,cAAc,EAAE,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { __name } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { useErrors } from "../../../providers/ErrorContext/index.js";
3
+ import { Label, Stack, Text } from "@ultraviolet/ui";
4
+ import { OfferList } from "@ultraviolet/ui/compositions/OfferList";
5
+ import { useController } from "react-hook-form";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+
8
+ //#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;
55
+
56
+ //#endregion
57
+ export { OfferListField };
@@ -3,6 +3,6 @@ import type { ComponentProps } from 'react';
3
3
  import type { FieldPath, FieldValues } from 'react-hook-form';
4
4
  import type { BaseFieldProps } from '../../../types';
5
5
  type OptionSelectorFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof OptionSelector>, 'value'>;
6
- export declare const OptionSelectorField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, required, name, "aria-label": ariaLabel, shouldUnregister, control, validate, onChange, ...props }: OptionSelectorFieldProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const OptionSelectorField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ label, required, name, 'aria-label': ariaLabel, shouldUnregister, control, validate, onChange, ...props }: OptionSelectorFieldProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
7
7
  export {};
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OptionSelectorField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,KAAK,wBAAwB,CAC3B,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,EAAE,OAAO,CAAC,CAAA;AAEtD,eAAO,MAAM,mBAAmB,GAC9B,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EACpE,6GAUC,wBAAwB,CAAC,YAAY,EAAE,UAAU,CAAC,4CAuCpD,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/OptionSelectorField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,KAAK,wBAAwB,CAC3B,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,cAAc,CAAC,EAAE,OAAO,CAAC,CAAA;AAEtD,eAAO,MAAM,mBAAmB,GAC9B,YAAY,sBACZ,UAAU,uQAwDX,CAAA"}
@@ -1,56 +1,55 @@
1
- "use client";
1
+ 'use client';
2
+ import { __name } from "../../../_virtual/_rolldown/runtime.js";
3
+ import { useErrors } from "../../../providers/ErrorContext/index.js";
4
+ import { _objectWithoutProperties } from "../../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js";
5
+ import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
6
+ import { useController } from "react-hook-form";
2
7
  import { jsx } from "react/jsx-runtime";
3
8
  import { OptionSelector } from "@ultraviolet/ui/compositions/OptionSelector";
4
- import { useController } from "react-hook-form";
5
- import { useErrors } from "../../../providers/ErrorContext/index.js";
6
- const OptionSelectorField = ({
7
- label = "",
8
- required,
9
- name,
10
- "aria-label": ariaLabel,
11
- shouldUnregister = false,
12
- control,
13
- validate,
14
- onChange,
15
- ...props
16
- }) => {
17
- const {
18
- field,
19
- fieldState: { error }
20
- } = useController({
21
- control,
22
- name,
23
- rules: {
24
- required,
25
- validate: {
26
- completeSelection: (value) => {
27
- if (value?.first && value.second) {
28
- return true;
29
- }
30
- return false;
31
- },
32
- ...validate
33
- }
34
- },
35
- shouldUnregister
36
- });
37
- const { getError } = useErrors();
38
- return /* @__PURE__ */ jsx(
39
- OptionSelector,
40
- {
41
- "aria-label": ariaLabel,
42
- error: getError({ label: label ?? ariaLabel ?? name }, error),
43
- name: field.name,
44
- onChange: (val) => {
45
- field.onChange(val);
46
- onChange?.(val);
47
- },
48
- required,
49
- value: field.value,
50
- ...props
51
- }
52
- );
53
- };
54
- export {
55
- OptionSelectorField
9
+
10
+ //#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: {
29
+ 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));
56
52
  };
53
+
54
+ //#endregion
55
+ export { OptionSelectorField };
@@ -0,0 +1,8 @@
1
+ import { Plans } from '@ultraviolet/ui/compositions/Plans';
2
+ import type { ComponentProps } from 'react';
3
+ import type { FieldPath, FieldValues } from 'react-hook-form';
4
+ import type { BaseFieldProps } from '../../../types';
5
+ type PlanFieldsProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = Pick<ComponentProps<typeof Plans>, 'features' | 'plans' | 'hideLabels' | 'onChange' | 'highlight'> & Pick<BaseFieldProps<TFieldValues, TFieldName>, 'name' | 'control' | 'required'>;
6
+ export declare const PlansField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, control, features, plans, hideLabels, highlight, onChange, required, }: PlanFieldsProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/compositions/PlansField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oCAAoC,CAAA;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAE7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAEpD,KAAK,eAAe,CAClB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAClE,IAAI,CACN,cAAc,CAAC,OAAO,KAAK,CAAC,EAC5B,UAAU,GAAG,OAAO,GAAG,YAAY,GAAG,UAAU,GAAG,WAAW,CAC/D,GACC,IAAI,CACF,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,EACxC,MAAM,GAAG,SAAS,GAAG,UAAU,CAChC,CAAA;AAEH,eAAO,MAAM,UAAU,GACrB,YAAY,sBACZ,UAAU,iOAmCX,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { __name } from "../../../_virtual/_rolldown/runtime.js";
2
+ import { useController } from "react-hook-form";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { Plans } from "@ultraviolet/ui/compositions/Plans";
5
+
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
+ };
26
+
27
+ //#endregion
28
+ export { PlansField };