@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.
- package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/asyncToGenerator.js +5 -3
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/defineProperty.js +19 -0
- package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/objectSpread2.js +8 -4
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutProperties.js +22 -0
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/objectWithoutPropertiesLoose.js +17 -0
- package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/toPrimitive.js +8 -4
- package/dist/_virtual/_@oxc-project_runtime@0.115.0/helpers/toPropertyKey.js +17 -0
- package/dist/_virtual/{_@oxc-project_runtime@0.114.0 → _@oxc-project_runtime@0.115.0}/helpers/typeof.js +5 -3
- package/dist/_virtual/_rolldown/runtime.js +2 -1
- package/dist/components/CheckboxField/index.js +59 -51
- package/dist/components/CheckboxGroupField/index.js +67 -59
- package/dist/components/DateInputField/index.js +94 -84
- package/dist/components/FileInputField/index.js +64 -60
- package/dist/components/Form/defaultErrors.js +25 -21
- package/dist/components/Form/index.d.ts +2 -1
- package/dist/components/Form/index.d.ts.map +1 -1
- package/dist/components/Form/index.js +41 -31
- package/dist/components/KeyValueField/index.js +88 -86
- package/dist/components/NumberInputField/index.js +66 -57
- package/dist/components/RadioField/index.js +65 -57
- package/dist/components/RadioGroupField/index.js +50 -42
- package/dist/components/SelectInputField/index.js +56 -48
- package/dist/components/SelectableCardField/index.js +64 -58
- package/dist/components/SelectableCardGroupField/SelectableCardGroupField.js +56 -48
- package/dist/components/SelectableCardGroupField/index.js +9 -0
- package/dist/components/SelectableCardOptionGroupField/index.js +61 -53
- package/dist/components/SliderField/index.js +83 -75
- package/dist/components/Submit/index.js +22 -18
- package/dist/components/SubmitErrorAlert/index.js +15 -11
- package/dist/components/SwitchButtonField/index.js +47 -41
- package/dist/components/TagInputField/index.js +54 -45
- package/dist/components/TextAreaField/index.js +78 -72
- package/dist/components/TextInputField/index.js +67 -61
- package/dist/components/TimeInputField/index.js +50 -46
- package/dist/components/ToggleField/index.js +63 -55
- package/dist/components/ToggleGroupField/index.js +53 -45
- package/dist/components/UnitInputField/index.js +61 -53
- package/dist/components/VerificationCodeField/index.js +47 -39
- package/dist/components/compositions/CodeEditorField/index.js +48 -42
- package/dist/components/compositions/CustomerSatisfactionField/index.js +17 -13
- package/dist/components/compositions/OfferListField/index.js +54 -48
- package/dist/components/compositions/OptionSelectorField/index.js +53 -45
- package/dist/components/compositions/PlansField/index.js +25 -21
- package/dist/components/compositions/index.js +17 -5
- package/dist/components/index.js +59 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/useOnFieldChange.js +25 -24
- package/dist/index.js +14 -1
- package/dist/providers/ErrorContext/index.js +28 -24
- package/dist/providers/index.js +11 -0
- package/dist/utils/validateRegex.js +7 -3
- package/dist/validators/isInteger.js +11 -7
- package/dist/validators/maxDate.js +7 -3
- package/dist/validators/minDate.js +7 -3
- package/package.json +6 -6
- package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/defineProperty.js +0 -15
- package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutProperties.js +0 -18
- package/dist/_virtual/_@oxc-project_runtime@0.114.0/helpers/objectWithoutPropertiesLoose.js +0 -15
- 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.
|
|
4
|
-
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
-
import { _objectSpread2 } from "../../_virtual/_@oxc-project_runtime@0.
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
-
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
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.
|
|
4
|
-
import { _objectSpread2 } from "../../../_virtual/_@oxc-project_runtime@0.
|
|
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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
31
|
+
init_PlansField();
|
|
32
|
+
export { PlansField, init_PlansField };
|