@uxf/form 11.74.0 → 11.74.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.
- package/_code-generator/form-code-generator.d.ts +16 -0
- package/_code-generator/form-code-generator.js +69 -0
- package/avatar-file-input/avatar-file-input.d.ts +14 -0
- package/avatar-file-input/avatar-file-input.js +42 -0
- package/avatar-file-input/avatar-file-input.stories.d.ts +8 -0
- package/avatar-file-input/avatar-file-input.stories.js +23 -0
- package/avatar-file-input/index.d.ts +1 -0
- package/avatar-file-input/index.js +17 -0
- package/avatar-file-input/translations.d.ts +13 -0
- package/avatar-file-input/translations.js +14 -0
- package/bin/form-code-generator.d.ts +2 -0
- package/bin/form-code-generator.js +55 -0
- package/checkbox-button/checkbox-button.d.ts +14 -0
- package/checkbox-button/checkbox-button.js +42 -0
- package/checkbox-button/checkbox-button.stories.d.ts +8 -0
- package/checkbox-button/checkbox-button.stories.js +24 -0
- package/checkbox-button/index.d.ts +1 -0
- package/checkbox-button/index.js +17 -0
- package/checkbox-button/translations.d.ts +13 -0
- package/checkbox-button/translations.js +14 -0
- package/checkbox-input/checkbox-input.d.ts +14 -0
- package/checkbox-input/checkbox-input.js +42 -0
- package/checkbox-input/checkbox-input.stories.d.ts +8 -0
- package/checkbox-input/checkbox-input.stories.js +24 -0
- package/checkbox-input/index.d.ts +1 -0
- package/checkbox-input/index.js +17 -0
- package/checkbox-input/translations.d.ts +13 -0
- package/checkbox-input/translations.js +14 -0
- package/checkbox-list/checkbox-list.d.ts +19 -0
- package/checkbox-list/checkbox-list.js +40 -0
- package/checkbox-list/checkbox-list.stories.d.ts +2 -0
- package/checkbox-list/checkbox-list.stories.js +22 -0
- package/checkbox-list/index.d.ts +1 -0
- package/checkbox-list/index.js +17 -0
- package/checkbox-list/translations.d.ts +13 -0
- package/checkbox-list/translations.js +14 -0
- package/color-radio-group/color-radio-group.d.ts +13 -0
- package/color-radio-group/color-radio-group.js +42 -0
- package/color-radio-group/color-radio-group.stories.d.ts +8 -0
- package/color-radio-group/color-radio-group.stories.js +62 -0
- package/color-radio-group/index.d.ts +1 -0
- package/color-radio-group/index.js +17 -0
- package/color-radio-group/translations.d.ts +13 -0
- package/color-radio-group/translations.js +14 -0
- package/combobox/combobox.d.ts +13 -0
- package/combobox/combobox.js +48 -0
- package/combobox/combobox.stories.d.ts +8 -0
- package/combobox/combobox.stories.js +30 -0
- package/combobox/index.d.ts +1 -0
- package/combobox/index.js +17 -0
- package/combobox/translations.d.ts +13 -0
- package/combobox/translations.js +14 -0
- package/components.d.ts +127 -0
- package/components.js +154 -0
- package/date-picker-input/date-picker-input.d.ts +15 -0
- package/date-picker-input/date-picker-input.js +102 -0
- package/date-picker-input/date-picker-input.stories.d.ts +8 -0
- package/date-picker-input/date-picker-input.stories.js +31 -0
- package/date-picker-input/index.d.ts +1 -0
- package/date-picker-input/index.js +17 -0
- package/date-picker-input/translations.d.ts +31 -0
- package/date-picker-input/translations.js +32 -0
- package/date-range-picker-input/date-range-picker-input.d.ts +12 -0
- package/date-range-picker-input/date-range-picker-input.js +115 -0
- package/date-range-picker-input/date-range-picker-input.stories.d.ts +8 -0
- package/date-range-picker-input/date-range-picker-input.stories.js +25 -0
- package/date-range-picker-input/index.d.ts +1 -0
- package/date-range-picker-input/index.js +17 -0
- package/date-range-picker-input/translations.d.ts +25 -0
- package/date-range-picker-input/translations.js +26 -0
- package/datetime-picker-input/datetime-picker-input.d.ts +15 -0
- package/datetime-picker-input/datetime-picker-input.js +103 -0
- package/datetime-picker-input/datetime-picker-input.stories.d.ts +2 -0
- package/datetime-picker-input/datetime-picker-input.stories.js +28 -0
- package/datetime-picker-input/index.d.ts +1 -0
- package/datetime-picker-input/index.js +17 -0
- package/datetime-picker-input/translations.d.ts +31 -0
- package/datetime-picker-input/translations.js +32 -0
- package/dropzone/dropzone-input.d.ts +13 -0
- package/dropzone/dropzone-input.js +67 -0
- package/dropzone/dropzone-list.d.ts +11 -0
- package/dropzone/dropzone-list.js +23 -0
- package/dropzone/dropzone.stories.d.ts +2 -0
- package/dropzone/dropzone.stories.js +50 -0
- package/dropzone/index.d.ts +9 -0
- package/dropzone/index.js +6 -0
- package/dropzone/translations.d.ts +31 -0
- package/dropzone/translations.js +32 -0
- package/file-input/file-input.d.ts +14 -0
- package/file-input/file-input.js +42 -0
- package/file-input/file-input.stories.d.ts +8 -0
- package/file-input/file-input.stories.js +31 -0
- package/file-input/index.d.ts +1 -0
- package/file-input/index.js +17 -0
- package/file-input/translations.d.ts +13 -0
- package/file-input/translations.js +14 -0
- package/form/form.d.ts +19 -0
- package/form/form.js +25 -0
- package/form/form.stories.d.ts +8 -0
- package/form/form.stories.js +24 -0
- package/form/index.d.ts +1 -0
- package/form/index.js +17 -0
- package/form-id-context/form-context.d.ts +7 -0
- package/form-id-context/form-context.js +12 -0
- package/form-id-context/form-id-context.d.ts +2 -0
- package/form-id-context/form-id-context.js +7 -0
- package/form-id-context/index.d.ts +1 -0
- package/form-id-context/index.js +17 -0
- package/form-renderer/big-test-schema.d.ts +33 -0
- package/form-renderer/big-test-schema.js +295 -0
- package/form-renderer/field/base-field.d.ts +4 -0
- package/form-renderer/field/base-field.js +72 -0
- package/form-renderer/field/embedded.d.ts +4 -0
- package/form-renderer/field/embedded.js +19 -0
- package/form-renderer/field/one-to-many.d.ts +4 -0
- package/form-renderer/field/one-to-many.js +52 -0
- package/form-renderer/form-renderer.d.ts +16 -0
- package/form-renderer/form-renderer.js +28 -0
- package/form-renderer/form-renderer.stories.d.ts +2 -0
- package/form-renderer/form-renderer.stories.js +23 -0
- package/form-renderer/index.d.ts +2 -0
- package/form-renderer/index.js +18 -0
- package/form-renderer/mapper.d.ts +2 -0
- package/form-renderer/mapper.js +30 -0
- package/form-renderer/translations.d.ts +33 -0
- package/form-renderer/translations.js +34 -0
- package/form-renderer/types.d.ts +39 -0
- package/form-renderer/types.js +2 -0
- package/gps-input/gps-input.d.ts +20 -0
- package/gps-input/gps-input.js +156 -0
- package/gps-input/gps-input.stories.d.ts +8 -0
- package/gps-input/gps-input.stories.js +22 -0
- package/gps-input/index.d.ts +1 -0
- package/gps-input/index.js +17 -0
- package/gps-input/translations.d.ts +31 -0
- package/gps-input/translations.js +32 -0
- package/money-input/index.d.ts +1 -0
- package/money-input/index.js +17 -0
- package/money-input/money-input.d.ts +24 -0
- package/money-input/money-input.js +112 -0
- package/money-input/money-input.stories.d.ts +2 -0
- package/money-input/money-input.stories.js +15 -0
- package/money-input/translations.d.ts +13 -0
- package/money-input/translations.js +14 -0
- package/multi-combobox/index.d.ts +1 -0
- package/multi-combobox/index.js +17 -0
- package/multi-combobox/multi-combobox.d.ts +13 -0
- package/multi-combobox/multi-combobox.js +48 -0
- package/multi-combobox/multi-combobox.stories.d.ts +8 -0
- package/multi-combobox/multi-combobox.stories.js +54 -0
- package/multi-combobox/translations.d.ts +13 -0
- package/multi-combobox/translations.js +14 -0
- package/multi-select/index.d.ts +1 -0
- package/multi-select/index.js +17 -0
- package/multi-select/multi-select.d.ts +13 -0
- package/multi-select/multi-select.js +43 -0
- package/multi-select/multi-select.stories.d.ts +8 -0
- package/multi-select/multi-select.stories.js +47 -0
- package/multi-select/translations.d.ts +13 -0
- package/multi-select/translations.js +14 -0
- package/number-input/index.d.ts +1 -0
- package/number-input/index.js +17 -0
- package/number-input/number-input.d.ts +17 -0
- package/number-input/number-input.js +87 -0
- package/number-input/number-input.stories.d.ts +8 -0
- package/number-input/number-input.stories.js +24 -0
- package/number-input/translations.d.ts +25 -0
- package/number-input/translations.js +26 -0
- package/package.json +3 -3
- package/password-input/index.d.ts +1 -0
- package/password-input/index.js +17 -0
- package/password-input/password-input.d.ts +15 -0
- package/password-input/password-input.js +108 -0
- package/password-input/password-input.stories.d.ts +8 -0
- package/password-input/password-input.stories.js +23 -0
- package/password-input/translations.d.ts +19 -0
- package/password-input/translations.js +20 -0
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.js +17 -0
- package/radio-group/radio-group.d.ts +13 -0
- package/radio-group/radio-group.js +42 -0
- package/radio-group/radio-group.stories.d.ts +8 -0
- package/radio-group/radio-group.stories.js +38 -0
- package/radio-group/translations.d.ts +13 -0
- package/radio-group/translations.js +14 -0
- package/readmes.d.ts +28 -0
- package/readmes.js +59 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +17 -0
- package/select/select.d.ts +13 -0
- package/select/select.js +41 -0
- package/select/select.stories.d.ts +8 -0
- package/select/select.stories.js +44 -0
- package/select/translations.d.ts +13 -0
- package/select/translations.js +14 -0
- package/storybook/form-data-printer.d.ts +6 -0
- package/storybook/form-data-printer.js +12 -0
- package/storybook/storybook-form.d.ts +8 -0
- package/storybook/storybook-form.js +42 -0
- package/text-input/index.d.ts +1 -0
- package/text-input/index.js +17 -0
- package/text-input/text-input.d.ts +33 -0
- package/text-input/text-input.js +75 -0
- package/text-input/text-input.stories.d.ts +8 -0
- package/text-input/text-input.stories.js +26 -0
- package/text-input/translations.d.ts +31 -0
- package/text-input/translations.js +32 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/index.js +17 -0
- package/textarea/textarea.d.ts +13 -0
- package/textarea/textarea.js +62 -0
- package/textarea/textarea.stories.d.ts +8 -0
- package/textarea/textarea.stories.js +22 -0
- package/textarea/translations.d.ts +13 -0
- package/textarea/translations.js +14 -0
- package/time-picker-input/index.d.ts +1 -0
- package/time-picker-input/index.js +17 -0
- package/time-picker-input/time-picker-input.d.ts +14 -0
- package/time-picker-input/time-picker-input.js +84 -0
- package/time-picker-input/time-picker-input.stories.d.ts +8 -0
- package/time-picker-input/time-picker-input.stories.js +25 -0
- package/time-picker-input/translations.d.ts +19 -0
- package/time-picker-input/translations.js +20 -0
- package/toggle/index.d.ts +1 -0
- package/toggle/index.js +17 -0
- package/toggle/toggle.d.ts +14 -0
- package/toggle/toggle.js +40 -0
- package/toggle/toggle.stories.d.ts +8 -0
- package/toggle/toggle.stories.js +23 -0
- package/toggle/translations.d.ts +13 -0
- package/toggle/translations.js +14 -0
- package/types.d.ts +4 -0
- package/types.js +2 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.MoneyInput = MoneyInput;
|
|
27
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
28
|
+
const currencies_1 = require("@uxf/core/money/currencies");
|
|
29
|
+
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
30
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
31
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
32
|
+
const form_context_1 = require("@uxf/form/form-id-context/form-context");
|
|
33
|
+
const text_input_1 = require("@uxf/ui/text-input");
|
|
34
|
+
const react_1 = __importStar(require("react"));
|
|
35
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
36
|
+
const SPECIAL_KEYS = ["Backspace", "Delete", "ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown", "Tab"];
|
|
37
|
+
// Allow keys for copy/paste/select/cut
|
|
38
|
+
const CONTROL_KEYS = ["v", "V", "c", "C", "x", "X", "a", "A"];
|
|
39
|
+
// Allow digits and decimal point (.,)
|
|
40
|
+
const ALLOWED_KEYS = /[0-9+\-.,]/;
|
|
41
|
+
function MoneyInput(props) {
|
|
42
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
43
|
+
const formContext = (0, form_context_1.useFormContext)();
|
|
44
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
45
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
46
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
47
|
+
control: props.control,
|
|
48
|
+
name: props.name,
|
|
49
|
+
rules: {
|
|
50
|
+
required: props.isRequired
|
|
51
|
+
? props.requiredMessage || t("uxf-form-money-input:validation.required")
|
|
52
|
+
: undefined,
|
|
53
|
+
validate: {
|
|
54
|
+
validMinNumber: (value) => {
|
|
55
|
+
if (!value) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (typeof props.min === "number" && !isNaN(props.min) && value.amount < props.min) {
|
|
59
|
+
return props.minMessage
|
|
60
|
+
? props.minMessage(value)
|
|
61
|
+
: `Hodnota musí být větší nebo rovna ${props.min}.`;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
validMaxNumber: (value) => {
|
|
65
|
+
if (!value) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (typeof props.max === "number" && !isNaN(props.max) && value.amount > props.max) {
|
|
69
|
+
return props.maxMessage
|
|
70
|
+
? props.maxMessage(value)
|
|
71
|
+
: `Hodnota musí být menší nebo rovna ${props.max}.`;
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
...(typeof ((_b = props.rules) === null || _b === void 0 ? void 0 : _b.validate) === "function"
|
|
75
|
+
? { custom: props.rules.validate }
|
|
76
|
+
: (_c = props.rules) === null || _c === void 0 ? void 0 : _c.validate),
|
|
77
|
+
},
|
|
78
|
+
...props.rules,
|
|
79
|
+
},
|
|
80
|
+
shouldUnregister: props.shouldUnregister,
|
|
81
|
+
});
|
|
82
|
+
const [lastCurrency, setLastCurrency] = (0, react_1.useState)((_f = (_e = (_d = field.value) === null || _d === void 0 ? void 0 : _d.currency) !== null && _e !== void 0 ? _e : props.defaultCurrency) !== null && _f !== void 0 ? _f : "CZK");
|
|
83
|
+
(0, react_1.useEffect)(() => {
|
|
84
|
+
var _a;
|
|
85
|
+
if ((0, is_not_nil_1.isNotNil)(field.value) && ((_a = field.value) === null || _a === void 0 ? void 0 : _a.currency) !== lastCurrency) {
|
|
86
|
+
setLastCurrency(field.value.currency);
|
|
87
|
+
}
|
|
88
|
+
}, [field.value, lastCurrency]);
|
|
89
|
+
const keyDownHandler = (event) => {
|
|
90
|
+
const key = event.key;
|
|
91
|
+
// Check if the key is allowed
|
|
92
|
+
if (!SPECIAL_KEYS.includes(key) && !ALLOWED_KEYS.test(key)) {
|
|
93
|
+
// Check if Ctrl or Command key is pressed along with control key
|
|
94
|
+
if (!(event.ctrlKey || event.metaKey) || !CONTROL_KEYS.includes(key)) {
|
|
95
|
+
event.preventDefault();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const changeHandler = (value, event) => {
|
|
100
|
+
var _a, _b, _c;
|
|
101
|
+
const newValue = (0, is_nil_1.isNil)(value) || (0, is_empty_1.isEmpty)(value)
|
|
102
|
+
? null
|
|
103
|
+
: {
|
|
104
|
+
amount: value,
|
|
105
|
+
currency: (_b = (_a = field.value) === null || _a === void 0 ? void 0 : _a.currency) !== null && _b !== void 0 ? _b : lastCurrency,
|
|
106
|
+
};
|
|
107
|
+
field.onChange(newValue);
|
|
108
|
+
(_c = props.onChange) === null || _c === void 0 ? void 0 : _c.call(props, newValue, event);
|
|
109
|
+
};
|
|
110
|
+
return (react_1.default.createElement(text_input_1.TextInput, { className: "uxf-money-input uxf-input--no-spin-buttons", helperText: (_g = fieldState.error) === null || _g === void 0 ? void 0 : _g.message, id: id, inputMode: "decimal", isDisabled: formContext.isFormDisabled || props.isDisabled, isInvalid: Boolean(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: field.name, onChange: changeHandler, onKeyDown: keyDownHandler, ref: field.ref, rightAddon: props.rightAddon, rightElement: currencies_1.currencies[(_j = (_h = field.value) === null || _h === void 0 ? void 0 : _h.currency) !== null && _j !== void 0 ? _j : lastCurrency].symbol, step: 2, type: "number", value: (_l = (_k = field.value) === null || _k === void 0 ? void 0 : _k.amount) !== null && _l !== void 0 ? _l : "" }));
|
|
111
|
+
}
|
|
112
|
+
MoneyInput.displayName = "UxfFormMoneyInput";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = Default;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const storybook_form_1 = require("../storybook/storybook-form");
|
|
9
|
+
const money_input_1 = require("./money-input");
|
|
10
|
+
function Default() {
|
|
11
|
+
return (react_1.default.createElement(storybook_form_1.StorybookForm, { className: "space-y-4 p-4", defaultValues: { "default-value": { amount: "100", currency: "USD" } } }, ({ control }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
12
|
+
react_1.default.createElement(money_input_1.MoneyInput, { control: control, label: "Default money input min100 max200", max: 200, min: 100, name: "default" }),
|
|
13
|
+
react_1.default.createElement(money_input_1.MoneyInput, { control: control, defaultCurrency: "EUR", label: "Money input with default currency", name: "default-currency" }),
|
|
14
|
+
react_1.default.createElement(money_input_1.MoneyInput, { control: control, label: "Money input with default value", name: "default-value" })))));
|
|
15
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"uxf-form-money-input": {
|
|
5
|
+
validation: {
|
|
6
|
+
required: {
|
|
7
|
+
cs: "Toto pole je povinné",
|
|
8
|
+
en: "This field is required",
|
|
9
|
+
sk: "Toto pole je povinné",
|
|
10
|
+
de: "Dieses Feld ist erforderlich",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./multi-combobox";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./multi-combobox"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MultiComboboxOption, MultiComboboxProps as UIMultiComboboxProps } from "@uxf/ui/multi-combobox";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FieldValues } from "react-hook-form";
|
|
4
|
+
import { ControlProps } from "../types";
|
|
5
|
+
export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIMultiComboboxProps, "isFocused" | "isInvalid" | "name" | "onChange" | "value"> & {
|
|
6
|
+
onChange?: UIMultiComboboxProps["onChange"];
|
|
7
|
+
requiredMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
export type MultiComboboxValue<Id> = MultiComboboxOption<Id>[] | null;
|
|
10
|
+
export declare function MultiCombobox<FormData extends Record<string, any>>(props: ComboProps<FormData>): React.JSX.Element;
|
|
11
|
+
export declare namespace MultiCombobox {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MultiCombobox = MultiCombobox;
|
|
8
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
9
|
+
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
10
|
+
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
11
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
12
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
13
|
+
const multi_combobox_1 = require("@uxf/ui/multi-combobox");
|
|
14
|
+
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
16
|
+
const form_context_1 = require("../form-id-context/form-context");
|
|
17
|
+
function MultiCombobox(props) {
|
|
18
|
+
var _a, _b, _c, _d;
|
|
19
|
+
const formContext = (0, form_context_1.useFormContext)();
|
|
20
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
21
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
22
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
23
|
+
control: props.control,
|
|
24
|
+
name: props.name,
|
|
25
|
+
rules: {
|
|
26
|
+
required: props.isRequired
|
|
27
|
+
? props.requiredMessage || t("uxf-form-multi-combobox:validation.required")
|
|
28
|
+
: undefined,
|
|
29
|
+
...props.rules,
|
|
30
|
+
},
|
|
31
|
+
shouldUnregister: props.shouldUnregister,
|
|
32
|
+
});
|
|
33
|
+
const onBlur = (event) => {
|
|
34
|
+
var _a;
|
|
35
|
+
field.onBlur();
|
|
36
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
37
|
+
};
|
|
38
|
+
const onChange = (value, event) => {
|
|
39
|
+
var _a;
|
|
40
|
+
field.onChange(value);
|
|
41
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
42
|
+
};
|
|
43
|
+
const isDisabled = ((0, is_nil_1.isNil)(props.loadOptions) && (0, is_empty_1.isEmpty)((_b = props.options) !== null && _b !== void 0 ? _b : empty_array_1.EMPTY_ARRAY)) ||
|
|
44
|
+
formContext.isFormDisabled ||
|
|
45
|
+
props.isDisabled;
|
|
46
|
+
return (react_1.default.createElement(multi_combobox_1.MultiCombobox, { allOptionsSelectedMessage: props.allOptionsSelectedMessage, className: props.className, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownMaxHeight: props.dropdownMaxHeight, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, form: props.form, helperText: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: id, inputArrow: props.inputArrow, isDisabled: isDisabled, isInvalid: (0, is_not_nil_1.isNotNil)(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, loadOptions: props.loadOptions, name: field.name, noOptionsMessage: props.noOptionsMessage, noQueryMessage: props.noQueryMessage, notFoundMessage: props.notFoundMessage, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, options: props.options, placeholder: props.placeholder, ref: field.ref, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, value: field.value, variant: props.variant, withCheckboxes: props.withCheckboxes }));
|
|
47
|
+
}
|
|
48
|
+
MultiCombobox.displayName = "UxfFormMultiCombobox";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = Default;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const storybook_form_1 = require("../storybook/storybook-form");
|
|
10
|
+
const multi_combobox_1 = require("./multi-combobox");
|
|
11
|
+
exports.default = {
|
|
12
|
+
title: "Form/MultiCombobox",
|
|
13
|
+
component: multi_combobox_1.MultiCombobox,
|
|
14
|
+
};
|
|
15
|
+
const options = [
|
|
16
|
+
{ id: "one", label: "Option one", color: "red" },
|
|
17
|
+
{ id: "two", label: "Option two disabled", color: "blue", disabled: true },
|
|
18
|
+
{ id: "three", label: "Option three", color: "green" },
|
|
19
|
+
{ id: "four", label: "Option four disabled", disabled: true },
|
|
20
|
+
{ id: "five", label: "Option five" },
|
|
21
|
+
{ id: "six", label: "Option six" },
|
|
22
|
+
{ id: "seven", label: "Option seven" },
|
|
23
|
+
{ id: "eight", label: "Option eight" },
|
|
24
|
+
{ id: "nine", label: "Option nine" },
|
|
25
|
+
{ id: "ten", label: "Option ten" },
|
|
26
|
+
{ id: "twelve", label: "Option twelve" },
|
|
27
|
+
{ id: "thirteen", label: "Option thirteen" },
|
|
28
|
+
];
|
|
29
|
+
function Default() {
|
|
30
|
+
const storyFormComboboxes = (control) => (react_1.default.createElement("div", { className: "space-y-8" },
|
|
31
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, dropdownMaxHeight: 350, helperText: "Za\u010Dn\u011Bte ps\u00E1t pro vyhled\u00E1v\u00E1n\u00ED...", id: "form-combobox", label: "Combobox form", name: "combobox1", options: options, placeholder: "Vyberte..." }),
|
|
32
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, helperText: "Za\u010Dn\u011Bte ps\u00E1t pro vyhled\u00E1v\u00E1n\u00ED...", id: "form-combobox", label: "Combobox with checkboxes", name: "combobox-with-checkboxes", options: options, placeholder: "Vyberte...", withCheckboxes: true }),
|
|
33
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, helperText: "Za\u010Dn\u011Bte ps\u00E1t pro vyhled\u00E1v\u00E1n\u00ED...", id: "form-combobox", isRequired: true, label: "Combobox form required", name: "combobox-required", options: options, placeholder: "Vyberte..." }),
|
|
34
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, id: "form-combobox", isDisabled: true, label: "Combobox form disabled", name: "combobox-disabled", options: options, placeholder: "Vyberte..." }),
|
|
35
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, dropdownPlacement: "top", id: "form-combobox", label: "Combobox form with dropdown top", name: "select-dropdown-top", options: options, placeholder: "Vyberte..." }),
|
|
36
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, dropdownPlacement: "top", id: "form-combobox", label: "Combobox async", loadOptions: (query) => Promise.resolve(options.filter((option) => !query || option.label.toLowerCase().includes(query.toLowerCase()))), name: "select-dropdown-async", placeholder: "Vyberte..." }),
|
|
37
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { control: control, dropdownPlacement: "top", id: "form-combobox", label: "Combobox async with default values", loadOptions: (query) => Promise.resolve(options.filter((option) => !query || option.label.toLowerCase().includes(query.toLowerCase()))), name: "select-dropdown-async-default", placeholder: "Vyberte..." }),
|
|
38
|
+
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
39
|
+
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: {
|
|
40
|
+
combobox1: [
|
|
41
|
+
{ id: "one", label: "Option one" },
|
|
42
|
+
{ id: "two", label: "Option two" },
|
|
43
|
+
],
|
|
44
|
+
"combobox-with-checkboxes": [
|
|
45
|
+
{ id: "one", label: "Option one" },
|
|
46
|
+
{ id: "two", label: "Option two disabled", disabled: true },
|
|
47
|
+
],
|
|
48
|
+
"select-dropdown-async-default": [
|
|
49
|
+
{ id: "one", label: "Option one" },
|
|
50
|
+
{ id: "two", label: "Option two" },
|
|
51
|
+
],
|
|
52
|
+
} }, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
53
|
+
react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyFormComboboxes(control))))));
|
|
54
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"uxf-form-multi-combobox": {
|
|
5
|
+
validation: {
|
|
6
|
+
required: {
|
|
7
|
+
cs: "Toto pole je povinné",
|
|
8
|
+
en: "This field is required",
|
|
9
|
+
sk: "Toto pole je povinné",
|
|
10
|
+
de: "Dieses Feld ist erforderlich",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./multi-select";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./multi-select"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { MultiSelectOption, MultiSelectProps as UIMultiSelectProps } from "@uxf/ui/multi-select";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FieldValues } from "react-hook-form";
|
|
4
|
+
import { ControlProps } from "../types";
|
|
5
|
+
export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIMultiSelectProps, "isFocused" | "isInvalid" | "name" | "onChange" | "value"> & {
|
|
6
|
+
onChange?: UIMultiSelectProps["onChange"];
|
|
7
|
+
requiredMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
export type MultiSelectValue<Id> = MultiSelectOption<Id>[] | null;
|
|
10
|
+
export declare function MultiSelect<FormData extends Record<string, any>>(props: ComboProps<FormData>): React.JSX.Element;
|
|
11
|
+
export declare namespace MultiSelect {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.MultiSelect = MultiSelect;
|
|
8
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
9
|
+
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
10
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
11
|
+
const multi_select_1 = require("@uxf/ui/multi-select");
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
14
|
+
const form_context_1 = require("../form-id-context/form-context");
|
|
15
|
+
function MultiSelect(props) {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
const formContext = (0, form_context_1.useFormContext)();
|
|
18
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
19
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
20
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
21
|
+
control: props.control,
|
|
22
|
+
name: props.name,
|
|
23
|
+
rules: {
|
|
24
|
+
required: props.isRequired
|
|
25
|
+
? props.requiredMessage || t("uxf-form-multi-select:validation.required")
|
|
26
|
+
: undefined,
|
|
27
|
+
...props.rules,
|
|
28
|
+
},
|
|
29
|
+
shouldUnregister: props.shouldUnregister,
|
|
30
|
+
});
|
|
31
|
+
const onBlur = (event) => {
|
|
32
|
+
var _a;
|
|
33
|
+
field.onBlur();
|
|
34
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
35
|
+
};
|
|
36
|
+
const onChange = (value, event) => {
|
|
37
|
+
var _a;
|
|
38
|
+
field.onChange(value);
|
|
39
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
40
|
+
};
|
|
41
|
+
return (react_1.default.createElement(multi_select_1.MultiSelect, { allOptionsSelectedMessage: props.allOptionsSelectedMessage, className: props.className, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownMaxHeight: props.dropdownMaxHeight, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, form: props.form, helperText: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: id, inputArrow: props.inputArrow, isDisabled: (0, is_empty_1.isEmpty)(props.options) || formContext.isFormDisabled || props.isDisabled, isInvalid: (0, is_not_nil_1.isNotNil)(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: field.name, noOptionsMessage: props.noOptionsMessage, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, options: props.options, placeholder: props.placeholder, ref: field.ref, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, value: field.value, variant: props.variant, withCheckboxes: props.withCheckboxes }));
|
|
42
|
+
}
|
|
43
|
+
MultiSelect.displayName = "UxfFormMultiSelect";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = Default;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const storybook_form_1 = require("../storybook/storybook-form");
|
|
10
|
+
const multi_select_1 = require("./multi-select");
|
|
11
|
+
exports.default = {
|
|
12
|
+
title: "Form/MultiSelect",
|
|
13
|
+
component: multi_select_1.MultiSelect,
|
|
14
|
+
};
|
|
15
|
+
const options = [
|
|
16
|
+
{ id: "one", label: "Option one", color: "red" },
|
|
17
|
+
{ id: "two", label: "Option two disabled", color: "blue", disabled: true },
|
|
18
|
+
{ id: "three", label: "Option three", color: "green" },
|
|
19
|
+
{ id: "four", label: "Option four" },
|
|
20
|
+
{ id: "five", label: "Option five" },
|
|
21
|
+
{ id: "six", label: "Option six" },
|
|
22
|
+
{ id: "seven", label: "Option seven" },
|
|
23
|
+
{ id: "eight", label: "Option eight" },
|
|
24
|
+
{ id: "nine", label: "Option nine" },
|
|
25
|
+
{ id: "ten", label: "Option ten" },
|
|
26
|
+
{ id: "twelve", label: "Option twelve" },
|
|
27
|
+
{ id: "thirteen", label: "Option thirteen" },
|
|
28
|
+
];
|
|
29
|
+
function Default() {
|
|
30
|
+
const storyFormMultiSelect = (control) => (react_1.default.createElement("div", { className: "space-y-8" },
|
|
31
|
+
react_1.default.createElement(multi_select_1.MultiSelect, { control: control, dropdownMaxHeight: 350, helperText: "Vyberte pros\u00EDm jednu nebo v\u00EDce mo\u017Enost\u00ED", id: "form-multi-select", isRequired: true, label: "MultiSelect with disabled option", name: "multi-select-with-disabled", options: options, placeholder: "Vyberte..." }),
|
|
32
|
+
react_1.default.createElement(multi_select_1.MultiSelect, { control: control, id: "form-multi-select", label: "MultiSelect", name: "multi-select", options: options, placeholder: "Vyberte..." }),
|
|
33
|
+
react_1.default.createElement(multi_select_1.MultiSelect, { control: control, id: "form-multi-select-required", label: "MultiSelect required", name: "multi-select-required", options: options, placeholder: "Vyberte..." }),
|
|
34
|
+
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
35
|
+
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: {
|
|
36
|
+
"multi-select-with-disabled": [
|
|
37
|
+
{ id: "one", label: "Option one" },
|
|
38
|
+
{ id: "two", label: "Option two disabled", disabled: true },
|
|
39
|
+
],
|
|
40
|
+
"multi-select": [
|
|
41
|
+
{ id: "one", label: "Option one" },
|
|
42
|
+
{ id: "two", label: "Option two" },
|
|
43
|
+
],
|
|
44
|
+
"multi-select-required": [],
|
|
45
|
+
} }, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
46
|
+
react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyFormMultiSelect(control))))));
|
|
47
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"uxf-form-multi-select": {
|
|
5
|
+
validation: {
|
|
6
|
+
required: {
|
|
7
|
+
cs: "Toto pole je povinné",
|
|
8
|
+
en: "This field is required",
|
|
9
|
+
sk: "Toto pole je povinné",
|
|
10
|
+
de: "Dieses Feld ist erforderlich",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./number-input";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./number-input"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TextInputProps as UITextInputProps } from "@uxf/ui/text-input";
|
|
2
|
+
import { FormControlProps } from "@uxf/ui/types";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { FieldValues } from "react-hook-form";
|
|
5
|
+
import { ControlProps } from "../types";
|
|
6
|
+
export type NumberInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UITextInputProps, "inputMode" | "isFocused" | "isInvalid" | "maxLength" | "minLength" | "name" | "onChange" | "value" | "type"> & {
|
|
7
|
+
decimalPlaces?: number;
|
|
8
|
+
maxMessage?: string;
|
|
9
|
+
minMessage?: string;
|
|
10
|
+
onChange?: FormControlProps<number | null>["onChange"];
|
|
11
|
+
requiredMessage?: string;
|
|
12
|
+
};
|
|
13
|
+
export type NumberInputValue = number | null;
|
|
14
|
+
export declare function NumberInput<FormData extends FieldValues>(props: NumberInputProps<FormData>): React.JSX.Element;
|
|
15
|
+
export declare namespace NumberInput {
|
|
16
|
+
var displayName: string;
|
|
17
|
+
}
|