@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,90 +1,88 @@
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 { Slider } from "@ultraviolet/ui";
4
- import { useMemo } from "react";
5
7
  import { useController } from "react-hook-form";
6
- import { useErrors } from "../../providers/ErrorContext/index.js";
7
- const SliderField = ({
8
- name,
9
- control,
10
- shouldUnregister,
11
- max,
12
- min,
13
- required,
14
- validate,
15
- onBlur,
16
- onChange,
17
- label,
18
- value,
19
- defaultValue,
20
- options,
21
- "aria-label": ariaLabel,
22
- ...props
23
- }) => {
24
- const { getError } = useErrors();
25
- const {
26
- field,
27
- fieldState: { error }
28
- } = useController({
29
- control,
30
- name,
31
- rules: {
32
- max,
33
- min,
34
- required,
35
- validate
36
- },
37
- shouldUnregister
38
- });
39
- const finalValue = useMemo(() => {
40
- if (options && field.value) {
41
- if (!Array.isArray(field.value)) {
42
- const processedValue = options.map((option) => option.value).indexOf(field.value);
43
- return processedValue;
44
- }
45
- if (Array.isArray(field.value)) {
46
- const processedValue = field.value.map(
47
- (val) => options.map((option) => option.value).indexOf(val)
48
- );
49
- return processedValue;
50
- }
51
- }
52
- return field.value;
53
- }, [field.value, options]);
54
- return /* @__PURE__ */ jsx(
55
- Slider,
56
- {
57
- "aria-label": ariaLabel,
58
- error: getError({ label: label ?? ariaLabel ?? name, max, min }, error),
59
- label,
60
- max,
61
- min,
62
- name: field.name,
63
- onBlur: (event) => {
64
- field.onBlur();
65
- onBlur?.(event);
66
- },
67
- onChange: (newValue) => {
68
- if (options) {
69
- const processedValue = Array.isArray(newValue) ? newValue.map(
70
- (val) => val ? options[val]?.value : options[0]?.value
71
- ) : options[newValue]?.value;
72
- field.onChange(processedValue);
73
- onChange?.(
74
- processedValue
75
- );
76
- } else {
77
- field.onChange(newValue);
78
- onChange?.(newValue);
79
- }
80
- },
81
- options,
82
- required,
83
- value: finalValue,
84
- ...props
85
- }
86
- );
87
- };
88
- export {
89
- SliderField
8
+ import { useMemo } from "react";
9
+ import { jsx } from "react/jsx-runtime";
10
+
11
+ //#region src/components/SliderField/index.tsx
12
+ const _excluded = [
13
+ "name",
14
+ "control",
15
+ "shouldUnregister",
16
+ "max",
17
+ "min",
18
+ "required",
19
+ "validate",
20
+ "onBlur",
21
+ "onChange",
22
+ "label",
23
+ "value",
24
+ "defaultValue",
25
+ "options",
26
+ "aria-label"
27
+ ];
28
+ const SliderField = (_ref) => {
29
+ var _ref2;
30
+ let { name, control, shouldUnregister, max, min, required, validate, onBlur, onChange, label, value, defaultValue, options, "aria-label": ariaLabel } = _ref;
31
+ let props = _objectWithoutProperties(_ref, _excluded);
32
+ const { getError } = useErrors();
33
+ const { field, fieldState: { error } } = useController({
34
+ control,
35
+ name,
36
+ rules: {
37
+ max,
38
+ min,
39
+ required,
40
+ validate
41
+ },
42
+ shouldUnregister
43
+ });
44
+ const finalValue = useMemo(() => {
45
+ if (options && field.value) {
46
+ if (!Array.isArray(field.value)) return options.map((option) => option.value).indexOf(field.value);
47
+ if (Array.isArray(field.value)) return field.value.map((val) => options.map((option) => option.value).indexOf(val));
48
+ }
49
+ return field.value;
50
+ }, [field.value, options]);
51
+ return /* @__PURE__ */ jsx(Slider, _objectSpread2({
52
+ "aria-label": ariaLabel,
53
+ error: getError({
54
+ label: (_ref2 = label !== null && label !== void 0 ? label : ariaLabel) !== null && _ref2 !== void 0 ? _ref2 : name,
55
+ max,
56
+ min
57
+ }, error),
58
+ label,
59
+ max,
60
+ min,
61
+ name: field.name,
62
+ onBlur: (event) => {
63
+ field.onBlur();
64
+ onBlur === null || onBlur === void 0 || onBlur(event);
65
+ },
66
+ onChange: (newValue) => {
67
+ if (options) {
68
+ var _options$newValue;
69
+ const processedValue = Array.isArray(newValue) ? newValue.map((val) => {
70
+ var _options$val;
71
+ var _options$;
72
+ return val ? (_options$val = options[val]) === null || _options$val === void 0 ? void 0 : _options$val.value : (_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.value;
73
+ }) : (_options$newValue = options[newValue]) === null || _options$newValue === void 0 ? void 0 : _options$newValue.value;
74
+ field.onChange(processedValue);
75
+ onChange === null || onChange === void 0 || onChange(processedValue);
76
+ } else {
77
+ field.onChange(newValue);
78
+ onChange === null || onChange === void 0 || onChange(newValue);
79
+ }
80
+ },
81
+ options,
82
+ required,
83
+ value: finalValue
84
+ }, props));
90
85
  };
86
+
87
+ //#endregion
88
+ export { SliderField };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Submit/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtD,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;IAC5C,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,MAAM,GAAI,2FAUpB,WAAW,4CAqBb,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Submit/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtD,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;IAC5C,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;IAClD,SAAS,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,WAAW,CAAC,CAAA;IACtD,OAAO,CAAC,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,CAAA;CACnD,CAAA;AAED,eAAO,MAAM,MAAM,qJA+BlB,CAAA"}
@@ -1,37 +1,26 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { Button } from "@ultraviolet/ui";
4
4
  import { useFormState } from "react-hook-form";
5
- const Submit = ({
6
- children,
7
- className,
8
- disabled = false,
9
- size,
10
- variant = "filled",
11
- sentiment = "primary",
12
- tooltip,
13
- fullWidth,
14
- onClick
15
- }) => {
16
- const { isSubmitting, isValid } = useFormState();
17
- const isDisabled = disabled || isSubmitting || !isValid;
18
- return /* @__PURE__ */ jsx(
19
- Button,
20
- {
21
- className,
22
- disabled: isDisabled,
23
- fullWidth,
24
- isLoading: isSubmitting,
25
- onClick,
26
- sentiment,
27
- size,
28
- tooltip,
29
- type: "submit",
30
- variant,
31
- children
32
- }
33
- );
34
- };
35
- export {
36
- Submit
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/Submit/index.tsx
8
+ const Submit = ({ children, className, disabled = false, size, variant = "filled", sentiment = "primary", tooltip, fullWidth, onClick }) => {
9
+ const { isSubmitting, isValid } = useFormState();
10
+ return /* @__PURE__ */ jsx(Button, {
11
+ className,
12
+ disabled: disabled || isSubmitting || !isValid,
13
+ fullWidth,
14
+ isLoading: isSubmitting,
15
+ onClick,
16
+ sentiment,
17
+ size,
18
+ tooltip,
19
+ type: "submit",
20
+ variant,
21
+ children
22
+ });
37
23
  };
24
+
25
+ //#endregion
26
+ export { Submit };
@@ -1,4 +1,4 @@
1
1
  export declare const SubmitErrorAlert: ({ className }: {
2
- className?: string;
2
+ className?: string | undefined;
3
3
  }) => import("react/jsx-runtime").JSX.Element | null;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SubmitErrorAlert/index.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,GAAI,eAAe;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,mDAQrE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SubmitErrorAlert/index.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB;;oDAQ5B,CAAA"}
@@ -1,11 +1,19 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../_virtual/_rolldown/runtime.js";
3
3
  import { Alert } from "@ultraviolet/ui";
4
4
  import { useFormState } from "react-hook-form";
5
+ import { jsx } from "react/jsx-runtime";
6
+
7
+ //#region src/components/SubmitErrorAlert/index.tsx
5
8
  const SubmitErrorAlert = ({ className }) => {
6
- const { errors } = useFormState();
7
- return errors?.root?.["submit"]?.message ? /* @__PURE__ */ jsx(Alert, { className, sentiment: "danger", children: errors.root["submit"].message }) : null;
8
- };
9
- export {
10
- SubmitErrorAlert
9
+ var _errors$root;
10
+ const { errors } = useFormState();
11
+ return (errors === null || errors === void 0 || (_errors$root = errors.root) === null || _errors$root === void 0 || (_errors$root = _errors$root["submit"]) === null || _errors$root === void 0 ? void 0 : _errors$root.message) ? /* @__PURE__ */ jsx(Alert, {
12
+ className,
13
+ sentiment: "danger",
14
+ children: errors.root["submit"].message
15
+ }) : null;
11
16
  };
17
+
18
+ //#endregion
19
+ export { SubmitErrorAlert };
@@ -5,16 +5,16 @@ import type { BaseFieldProps } from '../../types';
5
5
  type SwitchButtonFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof SwitchButton>, 'value' | 'name' | 'onChange'> & Partial<Pick<ComponentProps<typeof SwitchButton>, 'onChange'>> & {
6
6
  name: FieldPath<TFieldValues>;
7
7
  };
8
- declare const SwitchButtonField: {
9
- <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, size, control, shouldUnregister, onBlur, onChange, onFocus, tooltip, className, ...props }: SwitchButtonFieldProps<TFieldValues, TFieldName>): import("react/jsx-runtime").JSX.Element;
10
- Option: ({ value, children, "data-testid": dataTestId, disabled, tooltip, style, }: {
8
+ declare function SwitchButtonField<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ name, size, control, shouldUnregister, onBlur, onChange, onFocus, tooltip, className, ...props }: SwitchButtonFieldProps<TFieldValues, TFieldName>): import("react/jsx-runtime").JSX.Element;
9
+ declare namespace SwitchButtonField {
10
+ var Option: ({ value, children, 'data-testid': dataTestId, disabled, tooltip, style, }: {
11
11
  value: string;
12
12
  children: import("react").ReactNode;
13
- "data-testid"?: string;
14
- disabled?: boolean;
15
- tooltip?: string;
16
- style?: import("react").CSSProperties;
13
+ 'data-testid'?: string | undefined;
14
+ disabled?: boolean | undefined;
15
+ tooltip?: string | undefined;
16
+ style?: import("react").CSSProperties | undefined;
17
17
  }) => import("react/jsx-runtime").JSX.Element;
18
- };
18
+ }
19
19
  export { SwitchButtonField };
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SwitchButtonField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAa,MAAM,iBAAiB,CAAA;AAExE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,KAAK,sBAAsB,CACzB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC,GACxE,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,OAAO,YAAY,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG;IAC/D,IAAI,EAAE,SAAS,CA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AAU,CAAC;;;;;;;;;;;AAgCnD,OAAO,EAAE,iBAAiB,EAAE,CAAA"}
@@ -1,48 +1,49 @@
1
- "use client";
2
- import { jsx } from "react/jsx-runtime";
1
+ 'use client';
2
+ import { __name } from "../../_virtual/_rolldown/runtime.js";
3
+ import { _objectWithoutProperties } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectWithoutProperties.js";
4
+ import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.113.0/helpers/objectSpread2.js";
3
5
  import { SwitchButton } from "@ultraviolet/ui";
4
6
  import { useController } from "react-hook-form";
5
- const SwitchButtonField = ({
6
- name,
7
- size,
8
- control,
9
- shouldUnregister,
10
- onBlur,
11
- onChange,
12
- onFocus,
13
- tooltip,
14
- className,
15
- ...props
16
- }) => {
17
- const { field } = useController({
18
- control,
19
- name,
20
- shouldUnregister
21
- });
22
- return /* @__PURE__ */ jsx(
23
- SwitchButton,
24
- {
25
- ...props,
26
- className,
27
- name,
28
- onBlur: (event) => {
29
- field.onBlur();
30
- onBlur?.(event);
31
- },
32
- onChange: (event) => {
33
- field.onChange(event);
34
- onChange?.(
35
- event.target
36
- );
37
- },
38
- onFocus,
39
- size,
40
- tooltip,
41
- value: field.value
42
- }
43
- );
7
+ import { jsx } from "react/jsx-runtime";
8
+
9
+ //#region src/components/SwitchButtonField/index.tsx
10
+ const _excluded = [
11
+ "name",
12
+ "size",
13
+ "control",
14
+ "shouldUnregister",
15
+ "onBlur",
16
+ "onChange",
17
+ "onFocus",
18
+ "tooltip",
19
+ "className"
20
+ ];
21
+ const SwitchButtonField = (_ref) => {
22
+ let { name, size, control, shouldUnregister, onBlur, onChange, onFocus, tooltip, className } = _ref;
23
+ let props = _objectWithoutProperties(_ref, _excluded);
24
+ const { field } = useController({
25
+ control,
26
+ name,
27
+ shouldUnregister
28
+ });
29
+ return /* @__PURE__ */ jsx(SwitchButton, _objectSpread2(_objectSpread2({}, props), {}, {
30
+ className,
31
+ name,
32
+ onBlur: (event) => {
33
+ field.onBlur();
34
+ onBlur === null || onBlur === void 0 || onBlur(event);
35
+ },
36
+ onChange: (event) => {
37
+ field.onChange(event);
38
+ onChange === null || onChange === void 0 || onChange(event.target);
39
+ },
40
+ onFocus,
41
+ size,
42
+ tooltip,
43
+ value: field.value
44
+ }));
44
45
  };
45
46
  SwitchButtonField.Option = SwitchButton.Option;
46
- export {
47
- SwitchButtonField
48
- };
47
+
48
+ //#endregion
49
+ export { SwitchButtonField };
@@ -5,5 +5,5 @@ import type { BaseFieldProps } from '../../types';
5
5
  export type TagInputFieldProps<TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues>> = BaseFieldProps<TFieldValues, TFieldName> & Omit<ComponentProps<typeof TagInput>, 'name' | 'onChange' | 'value'> & {
6
6
  regex?: (RegExp | RegExp[])[];
7
7
  };
8
- export declare const TagInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ regex: regexes, control, name, onChange, required, shouldUnregister, label, validate, "aria-label": ariaLabel, ...props }: TagInputFieldProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const TagInputField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ regex: regexes, control, name, onChange, required, shouldUnregister, label, validate, 'aria-label': ariaLabel, ...props }: TagInputFieldProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TagInputField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,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,M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1,58 +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";
6
+ import { validateRegex } from "../../utils/validateRegex.js";
3
7
  import { TagInput } from "@ultraviolet/ui";
4
8
  import { useController } from "react-hook-form";
5
- import { validateRegex } from "../../utils/validateRegex.js";
6
- import { useErrors } from "../../providers/ErrorContext/index.js";
7
- const TagInputField = ({
8
- regex: regexes,
9
- control,
10
- name,
11
- onChange,
12
- required,
13
- shouldUnregister = false,
14
- label,
15
- validate,
16
- "aria-label": ariaLabel,
17
- ...props
18
- }) => {
19
- const { getError } = useErrors();
20
- const {
21
- field,
22
- fieldState: { error }
23
- } = useController({
24
- control,
25
- name,
26
- rules: {
27
- required,
28
- shouldUnregister,
29
- validate: {
30
- ...regexes ? {
31
- pattern: (value) => value.every((val) => validateRegex(val, regexes))
32
- } : {},
33
- ...validate
34
- }
35
- }
36
- });
37
- return /* @__PURE__ */ jsx(
38
- TagInput,
39
- {
40
- ...props,
41
- "aria-label": ariaLabel,
42
- error: getError(
43
- { label: label ?? ariaLabel ?? name, regex: regexes },
44
- error
45
- ),
46
- label,
47
- name: field.name,
48
- onChange: (newTags) => {
49
- field.onChange(newTags);
50
- onChange?.(newTags);
51
- },
52
- value: field.value
53
- }
54
- );
55
- };
56
- export {
57
- TagInputField
9
+ import { jsx } from "react/jsx-runtime";
10
+
11
+ //#region src/components/TagInputField/index.tsx
12
+ const _excluded = [
13
+ "regex",
14
+ "control",
15
+ "name",
16
+ "onChange",
17
+ "required",
18
+ "shouldUnregister",
19
+ "label",
20
+ "validate",
21
+ "aria-label"
22
+ ];
23
+ const TagInputField = (_ref) => {
24
+ var _ref2;
25
+ let { regex: regexes, control, name, onChange, required, shouldUnregister = false, label, validate, "aria-label": ariaLabel } = _ref;
26
+ let props = _objectWithoutProperties(_ref, _excluded);
27
+ const { getError } = useErrors();
28
+ const { field, fieldState: { error } } = useController({
29
+ control,
30
+ name,
31
+ rules: {
32
+ required,
33
+ shouldUnregister,
34
+ validate: _objectSpread2(_objectSpread2({}, regexes ? { pattern: (value) => value.every((val) => validateRegex(val, regexes)) } : {}), validate)
35
+ }
36
+ });
37
+ return /* @__PURE__ */ jsx(TagInput, _objectSpread2(_objectSpread2({}, props), {}, {
38
+ "aria-label": ariaLabel,
39
+ error: getError({
40
+ label: (_ref2 = label !== null && label !== void 0 ? label : ariaLabel) !== null && _ref2 !== void 0 ? _ref2 : name,
41
+ regex: regexes
42
+ }, error),
43
+ label,
44
+ name: field.name,
45
+ onChange: (newTags) => {
46
+ field.onChange(newTags);
47
+ onChange === null || onChange === void 0 || onChange(newTags);
48
+ },
49
+ value: field.value
50
+ }));
58
51
  };
52
+
53
+ //#endregion
54
+ export { TagInputField };
@@ -9,5 +9,5 @@ export type TextAreaFieldProps<TFieldValues extends FieldValues, TFieldName exte
9
9
  /**
10
10
  * This component offers a form field based on Ultraviolet UI TextArea component
11
11
  */
12
- export declare const TextAreaField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, label, onChange, minLength, maxLength, name, onBlur, onKeyDown, required, regex: regexes, submitOnEnter, validate, "aria-label": ariaLabel, ...props }: TextAreaFieldProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
12
+ export declare const TextAreaField: <TFieldValues extends FieldValues, TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({ control, label, onChange, minLength, maxLength, name, onBlur, onKeyDown, required, regex: regexes, submitOnEnter, validate, 'aria-label': ariaLabel, ...props }: TextAreaFieldProps<TFieldValues, TFieldName>) => import("react/jsx-runtime").JSX.Element;
13
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextAreaField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAA;AAG9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,MAAM,MAAM,kBAAkB,CAC5B,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,IACxC,cAAc,CAAC,YAAY,EAAE,UAAU,CAAC,GAC1C,IAAI,CACF,cAAc,CAAC,OAAO,QAAQ,CAAC,EAC/B,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,UAAU,CACxC,GAAG;IACF,KAAK,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAA;IAC7B,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB,CAAA;AAEH;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,YAAY,SAAS,WAAW,EAChC,UAAU,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,EACpE,mKAeC,kBAAkB,CAAC,YAAY,EAAE,UAAU,CAAC,4CAuE9C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/TextAreaField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,EAAE,cAAc,EAAiB,MAAM,OAAO,CAAA;AAC1D,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAmB,MAAM,iBAAiB,CAAA;AAG9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAGjD,MA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