@uxf/form 11.72.0 → 11.74.0
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/README.md +3 -1
- package/package.json +4 -2
- package/translations/translations.d.ts +389 -0
- package/translations/translations.js +55 -0
- package/_code-generator/form-code-generator.d.ts +0 -16
- package/_code-generator/form-code-generator.js +0 -69
- package/avatar-file-input/avatar-file-input.d.ts +0 -14
- package/avatar-file-input/avatar-file-input.js +0 -38
- package/avatar-file-input/avatar-file-input.stories.d.ts +0 -8
- package/avatar-file-input/avatar-file-input.stories.js +0 -23
- package/avatar-file-input/index.d.ts +0 -1
- package/avatar-file-input/index.js +0 -17
- package/bin/form-code-generator.d.ts +0 -2
- package/bin/form-code-generator.js +0 -55
- package/checkbox-button/checkbox-button.d.ts +0 -14
- package/checkbox-button/checkbox-button.js +0 -38
- package/checkbox-button/checkbox-button.stories.d.ts +0 -8
- package/checkbox-button/checkbox-button.stories.js +0 -24
- package/checkbox-button/index.d.ts +0 -1
- package/checkbox-button/index.js +0 -17
- package/checkbox-input/checkbox-input.d.ts +0 -14
- package/checkbox-input/checkbox-input.js +0 -38
- package/checkbox-input/checkbox-input.stories.d.ts +0 -8
- package/checkbox-input/checkbox-input.stories.js +0 -24
- package/checkbox-input/index.d.ts +0 -1
- package/checkbox-input/index.js +0 -17
- package/checkbox-list/checkbox-list.d.ts +0 -19
- package/checkbox-list/checkbox-list.js +0 -36
- package/checkbox-list/checkbox-list.stories.d.ts +0 -2
- package/checkbox-list/checkbox-list.stories.js +0 -22
- package/checkbox-list/index.d.ts +0 -1
- package/checkbox-list/index.js +0 -17
- package/color-radio-group/color-radio-group.d.ts +0 -13
- package/color-radio-group/color-radio-group.js +0 -38
- package/color-radio-group/color-radio-group.stories.d.ts +0 -8
- package/color-radio-group/color-radio-group.stories.js +0 -62
- package/color-radio-group/index.d.ts +0 -1
- package/color-radio-group/index.js +0 -17
- package/combobox/combobox.d.ts +0 -13
- package/combobox/combobox.js +0 -44
- package/combobox/combobox.stories.d.ts +0 -8
- package/combobox/combobox.stories.js +0 -30
- package/combobox/index.d.ts +0 -1
- package/combobox/index.js +0 -17
- package/components.d.ts +0 -127
- package/components.js +0 -154
- package/date-picker-input/date-picker-input.d.ts +0 -15
- package/date-picker-input/date-picker-input.js +0 -89
- package/date-picker-input/date-picker-input.stories.d.ts +0 -8
- package/date-picker-input/date-picker-input.stories.js +0 -31
- package/date-picker-input/index.d.ts +0 -1
- package/date-picker-input/index.js +0 -17
- package/date-range-picker-input/date-range-picker-input.d.ts +0 -12
- package/date-range-picker-input/date-range-picker-input.js +0 -106
- package/date-range-picker-input/date-range-picker-input.stories.d.ts +0 -8
- package/date-range-picker-input/date-range-picker-input.stories.js +0 -25
- package/date-range-picker-input/index.d.ts +0 -1
- package/date-range-picker-input/index.js +0 -17
- package/datetime-picker-input/datetime-picker-input.d.ts +0 -15
- package/datetime-picker-input/datetime-picker-input.js +0 -90
- package/datetime-picker-input/datetime-picker-input.stories.d.ts +0 -2
- package/datetime-picker-input/datetime-picker-input.stories.js +0 -28
- package/datetime-picker-input/index.d.ts +0 -1
- package/datetime-picker-input/index.js +0 -17
- package/dropzone/dropzone-input.d.ts +0 -13
- package/dropzone/dropzone-input.js +0 -59
- package/dropzone/dropzone-list.d.ts +0 -11
- package/dropzone/dropzone-list.js +0 -23
- package/dropzone/dropzone.stories.d.ts +0 -2
- package/dropzone/dropzone.stories.js +0 -50
- package/dropzone/index.d.ts +0 -9
- package/dropzone/index.js +0 -6
- package/file-input/file-input.d.ts +0 -14
- package/file-input/file-input.js +0 -38
- package/file-input/file-input.stories.d.ts +0 -8
- package/file-input/file-input.stories.js +0 -31
- package/file-input/index.d.ts +0 -1
- package/file-input/index.js +0 -17
- package/form/form.d.ts +0 -19
- package/form/form.js +0 -25
- package/form/form.stories.d.ts +0 -8
- package/form/form.stories.js +0 -24
- package/form/index.d.ts +0 -1
- package/form/index.js +0 -17
- package/form-id-context/form-context.d.ts +0 -7
- package/form-id-context/form-context.js +0 -12
- package/form-id-context/form-id-context.d.ts +0 -2
- package/form-id-context/form-id-context.js +0 -7
- package/form-id-context/index.d.ts +0 -1
- package/form-id-context/index.js +0 -17
- package/form-renderer/big-test-schema.d.ts +0 -33
- package/form-renderer/big-test-schema.js +0 -295
- package/form-renderer/field/base-field.d.ts +0 -4
- package/form-renderer/field/base-field.js +0 -70
- package/form-renderer/field/embedded.d.ts +0 -4
- package/form-renderer/field/embedded.js +0 -19
- package/form-renderer/field/one-to-many.d.ts +0 -4
- package/form-renderer/field/one-to-many.js +0 -50
- package/form-renderer/form-renderer.d.ts +0 -16
- package/form-renderer/form-renderer.js +0 -26
- package/form-renderer/form-renderer.stories.d.ts +0 -2
- package/form-renderer/form-renderer.stories.js +0 -23
- package/form-renderer/index.d.ts +0 -2
- package/form-renderer/index.js +0 -18
- package/form-renderer/mapper.d.ts +0 -2
- package/form-renderer/mapper.js +0 -30
- package/form-renderer/types.d.ts +0 -39
- package/form-renderer/types.js +0 -2
- package/gps-input/gps-input.d.ts +0 -20
- package/gps-input/gps-input.js +0 -154
- package/gps-input/gps-input.stories.d.ts +0 -8
- package/gps-input/gps-input.stories.js +0 -22
- package/gps-input/index.d.ts +0 -1
- package/gps-input/index.js +0 -17
- package/money-input/index.d.ts +0 -1
- package/money-input/index.js +0 -17
- package/money-input/money-input.d.ts +0 -24
- package/money-input/money-input.js +0 -108
- package/money-input/money-input.stories.d.ts +0 -2
- package/money-input/money-input.stories.js +0 -15
- package/multi-combobox/index.d.ts +0 -1
- package/multi-combobox/index.js +0 -17
- package/multi-combobox/multi-combobox.d.ts +0 -13
- package/multi-combobox/multi-combobox.js +0 -44
- package/multi-combobox/multi-combobox.stories.d.ts +0 -8
- package/multi-combobox/multi-combobox.stories.js +0 -54
- package/multi-select/index.d.ts +0 -1
- package/multi-select/index.js +0 -17
- package/multi-select/multi-select.d.ts +0 -13
- package/multi-select/multi-select.js +0 -39
- package/multi-select/multi-select.stories.d.ts +0 -8
- package/multi-select/multi-select.stories.js +0 -47
- package/number-input/index.d.ts +0 -1
- package/number-input/index.js +0 -17
- package/number-input/number-input.d.ts +0 -17
- package/number-input/number-input.js +0 -72
- package/number-input/number-input.stories.d.ts +0 -8
- package/number-input/number-input.stories.js +0 -24
- package/password-input/index.d.ts +0 -1
- package/password-input/index.js +0 -17
- package/password-input/password-input.d.ts +0 -15
- package/password-input/password-input.js +0 -93
- package/password-input/password-input.stories.d.ts +0 -8
- package/password-input/password-input.stories.js +0 -23
- package/radio-group/index.d.ts +0 -1
- package/radio-group/index.js +0 -17
- package/radio-group/radio-group.d.ts +0 -13
- package/radio-group/radio-group.js +0 -38
- package/radio-group/radio-group.stories.d.ts +0 -8
- package/radio-group/radio-group.stories.js +0 -38
- package/readmes.d.ts +0 -28
- package/readmes.js +0 -59
- package/select/index.d.ts +0 -1
- package/select/index.js +0 -17
- package/select/select.d.ts +0 -13
- package/select/select.js +0 -39
- package/select/select.stories.d.ts +0 -8
- package/select/select.stories.js +0 -44
- package/storybook/form-data-printer.d.ts +0 -6
- package/storybook/form-data-printer.js +0 -12
- package/storybook/storybook-form.d.ts +0 -8
- package/storybook/storybook-form.js +0 -42
- package/text-input/index.d.ts +0 -1
- package/text-input/index.js +0 -17
- package/text-input/text-input.d.ts +0 -33
- package/text-input/text-input.js +0 -57
- package/text-input/text-input.stories.d.ts +0 -8
- package/text-input/text-input.stories.js +0 -26
- package/textarea/index.d.ts +0 -1
- package/textarea/index.js +0 -17
- package/textarea/textarea.d.ts +0 -13
- package/textarea/textarea.js +0 -58
- package/textarea/textarea.stories.d.ts +0 -8
- package/textarea/textarea.stories.js +0 -22
- package/time-picker-input/index.d.ts +0 -1
- package/time-picker-input/index.js +0 -17
- package/time-picker-input/time-picker-input.d.ts +0 -14
- package/time-picker-input/time-picker-input.js +0 -77
- package/time-picker-input/time-picker-input.stories.d.ts +0 -8
- package/time-picker-input/time-picker-input.stories.js +0 -25
- package/toggle/index.d.ts +0 -1
- package/toggle/index.js +0 -17
- package/toggle/toggle.d.ts +0 -14
- package/toggle/toggle.js +0 -38
- package/toggle/toggle.stories.d.ts +0 -8
- package/toggle/toggle.stories.js +0 -23
- package/types.d.ts +0 -4
- package/types.js +0 -2
|
@@ -1,30 +0,0 @@
|
|
|
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 combobox_1 = require("./combobox");
|
|
11
|
-
exports.default = {
|
|
12
|
-
title: "Form/Combobox",
|
|
13
|
-
component: combobox_1.Combobox,
|
|
14
|
-
};
|
|
15
|
-
const options = [
|
|
16
|
-
{ id: "one", label: "Option one" },
|
|
17
|
-
{ id: "two", label: "Option two" },
|
|
18
|
-
{ id: "three", label: "Option three" },
|
|
19
|
-
];
|
|
20
|
-
function Default() {
|
|
21
|
-
const storyFormComboboxes = (control) => (react_1.default.createElement("div", { className: "space-y-8" },
|
|
22
|
-
react_1.default.createElement(combobox_1.Combobox, { control: control, helperText: "Za\u010Dn\u011Bte ps\u00E1t pro vyhled\u00E1v\u00E1n\u00ED...", id: "form-combobox", label: "Combobox form", name: "firstname", options: options, placeholder: "Placeholder" }),
|
|
23
|
-
react_1.default.createElement(combobox_1.Combobox, { 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: "Placeholder" }),
|
|
24
|
-
react_1.default.createElement(combobox_1.Combobox, { control: control, id: "form-combobox", isDisabled: true, label: "Combobox form disabled", name: "combobox-disabled", options: options, placeholder: "Placeholder" }),
|
|
25
|
-
react_1.default.createElement(combobox_1.Combobox, { control: control, dropdownPlacement: "top", id: "form-combobox", label: "Combobox form with dropdown top", name: "select-dropdown-top", options: options, placeholder: "Placeholder" }),
|
|
26
|
-
react_1.default.createElement(combobox_1.Combobox, { control: control, dropdownPlacement: "top", id: "form-combobox", isClearable: true, label: "Combobox async", loadOptions: (query) => Promise.resolve(options.filter((option) => !query || option.label.toLowerCase().includes(query.toLowerCase()))), name: "select-dropdown-async", placeholder: "Placeholder" }),
|
|
27
|
-
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
28
|
-
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: { "select-dropdown-async": { id: "one", label: "Option one" } } }, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
29
|
-
react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyFormComboboxes(control))))));
|
|
30
|
-
}
|
package/combobox/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./combobox";
|
package/combobox/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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("./combobox"), exports);
|
package/components.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import * as avatarFileInputStories from "./avatar-file-input/avatar-file-input.stories";
|
|
2
|
-
import * as checkboxButtonStories from "./checkbox-button/checkbox-button.stories";
|
|
3
|
-
import * as checkboxInputStories from "./checkbox-input/checkbox-input.stories";
|
|
4
|
-
import * as checkboxListStories from "./checkbox-list/checkbox-list.stories";
|
|
5
|
-
import * as colorRadioGroupStories from "./color-radio-group/color-radio-group.stories";
|
|
6
|
-
import * as comboboxStories from "./combobox/combobox.stories";
|
|
7
|
-
import * as datePickerInputStories from "./date-picker-input/date-picker-input.stories";
|
|
8
|
-
import * as dateRangePickerInputStories from "./date-range-picker-input/date-range-picker-input.stories";
|
|
9
|
-
import * as datetimePickerInputStories from "./datetime-picker-input/datetime-picker-input.stories";
|
|
10
|
-
import * as dropzoneStories from "./dropzone/dropzone.stories";
|
|
11
|
-
import * as fileInputStories from "./file-input/file-input.stories";
|
|
12
|
-
import * as formStories from "./form/form.stories";
|
|
13
|
-
import * as formRendererStories from "./form-renderer/form-renderer.stories";
|
|
14
|
-
import * as gpsInputStories from "./gps-input/gps-input.stories";
|
|
15
|
-
import * as moneyInputStories from "./money-input/money-input.stories";
|
|
16
|
-
import * as multiComboboxStories from "./multi-combobox/multi-combobox.stories";
|
|
17
|
-
import * as multiSelectStories from "./multi-select/multi-select.stories";
|
|
18
|
-
import * as numberInputStories from "./number-input/number-input.stories";
|
|
19
|
-
import * as passwordInputStories from "./password-input/password-input.stories";
|
|
20
|
-
import * as radioGroupStories from "./radio-group/radio-group.stories";
|
|
21
|
-
import * as selectStories from "./select/select.stories";
|
|
22
|
-
import * as textInputStories from "./text-input/text-input.stories";
|
|
23
|
-
import * as textareaStories from "./textarea/textarea.stories";
|
|
24
|
-
import * as timePickerInputStories from "./time-picker-input/time-picker-input.stories";
|
|
25
|
-
import * as toggleStories from "./toggle/toggle.stories";
|
|
26
|
-
export declare const components: {
|
|
27
|
-
readonly "avatar-file-input": {
|
|
28
|
-
readonly title: "AvatarFileInput";
|
|
29
|
-
readonly stories: typeof avatarFileInputStories;
|
|
30
|
-
};
|
|
31
|
-
readonly "checkbox-button": {
|
|
32
|
-
readonly title: "CheckboxButton";
|
|
33
|
-
readonly stories: typeof checkboxButtonStories;
|
|
34
|
-
};
|
|
35
|
-
readonly "checkbox-input": {
|
|
36
|
-
readonly title: "CheckboxInput";
|
|
37
|
-
readonly stories: typeof checkboxInputStories;
|
|
38
|
-
};
|
|
39
|
-
readonly "checkbox-list": {
|
|
40
|
-
readonly title: "CheckboxList";
|
|
41
|
-
readonly stories: typeof checkboxListStories;
|
|
42
|
-
};
|
|
43
|
-
readonly "color-radio-group": {
|
|
44
|
-
readonly title: "ColorRadioGroup";
|
|
45
|
-
readonly stories: typeof colorRadioGroupStories;
|
|
46
|
-
};
|
|
47
|
-
readonly combobox: {
|
|
48
|
-
readonly title: "Combobox";
|
|
49
|
-
readonly stories: typeof comboboxStories;
|
|
50
|
-
};
|
|
51
|
-
readonly "date-picker-input": {
|
|
52
|
-
readonly title: "DatePickerInput";
|
|
53
|
-
readonly stories: typeof datePickerInputStories;
|
|
54
|
-
};
|
|
55
|
-
readonly "date-range-picker-input": {
|
|
56
|
-
readonly title: "DateRangePickerInput";
|
|
57
|
-
readonly stories: typeof dateRangePickerInputStories;
|
|
58
|
-
};
|
|
59
|
-
readonly "datetime-picker-input": {
|
|
60
|
-
readonly title: "DatetimePickerInput";
|
|
61
|
-
readonly stories: typeof datetimePickerInputStories;
|
|
62
|
-
};
|
|
63
|
-
readonly dropzone: {
|
|
64
|
-
readonly title: "Dropzone";
|
|
65
|
-
readonly stories: typeof dropzoneStories;
|
|
66
|
-
};
|
|
67
|
-
readonly "file-input": {
|
|
68
|
-
readonly title: "FileInput";
|
|
69
|
-
readonly stories: typeof fileInputStories;
|
|
70
|
-
};
|
|
71
|
-
readonly form: {
|
|
72
|
-
readonly title: "Form";
|
|
73
|
-
readonly stories: typeof formStories;
|
|
74
|
-
};
|
|
75
|
-
readonly "form-renderer": {
|
|
76
|
-
readonly title: "FormRenderer";
|
|
77
|
-
readonly stories: typeof formRendererStories;
|
|
78
|
-
};
|
|
79
|
-
readonly "gps-input": {
|
|
80
|
-
readonly title: "GpsInput";
|
|
81
|
-
readonly stories: typeof gpsInputStories;
|
|
82
|
-
};
|
|
83
|
-
readonly "money-input": {
|
|
84
|
-
readonly title: "MoneyInput";
|
|
85
|
-
readonly stories: typeof moneyInputStories;
|
|
86
|
-
};
|
|
87
|
-
readonly "multi-combobox": {
|
|
88
|
-
readonly title: "MultiCombobox";
|
|
89
|
-
readonly stories: typeof multiComboboxStories;
|
|
90
|
-
};
|
|
91
|
-
readonly "multi-select": {
|
|
92
|
-
readonly title: "MultiSelect";
|
|
93
|
-
readonly stories: typeof multiSelectStories;
|
|
94
|
-
};
|
|
95
|
-
readonly "number-input": {
|
|
96
|
-
readonly title: "NumberInput";
|
|
97
|
-
readonly stories: typeof numberInputStories;
|
|
98
|
-
};
|
|
99
|
-
readonly "password-input": {
|
|
100
|
-
readonly title: "PasswordInput";
|
|
101
|
-
readonly stories: typeof passwordInputStories;
|
|
102
|
-
};
|
|
103
|
-
readonly "radio-group": {
|
|
104
|
-
readonly title: "RadioGroup";
|
|
105
|
-
readonly stories: typeof radioGroupStories;
|
|
106
|
-
};
|
|
107
|
-
readonly select: {
|
|
108
|
-
readonly title: "Select";
|
|
109
|
-
readonly stories: typeof selectStories;
|
|
110
|
-
};
|
|
111
|
-
readonly "text-input": {
|
|
112
|
-
readonly title: "TextInput";
|
|
113
|
-
readonly stories: typeof textInputStories;
|
|
114
|
-
};
|
|
115
|
-
readonly textarea: {
|
|
116
|
-
readonly title: "Textarea";
|
|
117
|
-
readonly stories: typeof textareaStories;
|
|
118
|
-
};
|
|
119
|
-
readonly "time-picker-input": {
|
|
120
|
-
readonly title: "TimePickerInput";
|
|
121
|
-
readonly stories: typeof timePickerInputStories;
|
|
122
|
-
};
|
|
123
|
-
readonly toggle: {
|
|
124
|
-
readonly title: "Toggle";
|
|
125
|
-
readonly stories: typeof toggleStories;
|
|
126
|
-
};
|
|
127
|
-
};
|
package/components.js
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
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.components = void 0;
|
|
27
|
-
// generated file
|
|
28
|
-
const avatarFileInputStories = __importStar(require("./avatar-file-input/avatar-file-input.stories"));
|
|
29
|
-
const checkboxButtonStories = __importStar(require("./checkbox-button/checkbox-button.stories"));
|
|
30
|
-
const checkboxInputStories = __importStar(require("./checkbox-input/checkbox-input.stories"));
|
|
31
|
-
const checkboxListStories = __importStar(require("./checkbox-list/checkbox-list.stories"));
|
|
32
|
-
const colorRadioGroupStories = __importStar(require("./color-radio-group/color-radio-group.stories"));
|
|
33
|
-
const comboboxStories = __importStar(require("./combobox/combobox.stories"));
|
|
34
|
-
const datePickerInputStories = __importStar(require("./date-picker-input/date-picker-input.stories"));
|
|
35
|
-
const dateRangePickerInputStories = __importStar(require("./date-range-picker-input/date-range-picker-input.stories"));
|
|
36
|
-
const datetimePickerInputStories = __importStar(require("./datetime-picker-input/datetime-picker-input.stories"));
|
|
37
|
-
const dropzoneStories = __importStar(require("./dropzone/dropzone.stories"));
|
|
38
|
-
const fileInputStories = __importStar(require("./file-input/file-input.stories"));
|
|
39
|
-
const formStories = __importStar(require("./form/form.stories"));
|
|
40
|
-
const formRendererStories = __importStar(require("./form-renderer/form-renderer.stories"));
|
|
41
|
-
const gpsInputStories = __importStar(require("./gps-input/gps-input.stories"));
|
|
42
|
-
const moneyInputStories = __importStar(require("./money-input/money-input.stories"));
|
|
43
|
-
const multiComboboxStories = __importStar(require("./multi-combobox/multi-combobox.stories"));
|
|
44
|
-
const multiSelectStories = __importStar(require("./multi-select/multi-select.stories"));
|
|
45
|
-
const numberInputStories = __importStar(require("./number-input/number-input.stories"));
|
|
46
|
-
const passwordInputStories = __importStar(require("./password-input/password-input.stories"));
|
|
47
|
-
const radioGroupStories = __importStar(require("./radio-group/radio-group.stories"));
|
|
48
|
-
const selectStories = __importStar(require("./select/select.stories"));
|
|
49
|
-
const textInputStories = __importStar(require("./text-input/text-input.stories"));
|
|
50
|
-
const textareaStories = __importStar(require("./textarea/textarea.stories"));
|
|
51
|
-
const timePickerInputStories = __importStar(require("./time-picker-input/time-picker-input.stories"));
|
|
52
|
-
const toggleStories = __importStar(require("./toggle/toggle.stories"));
|
|
53
|
-
exports.components = {
|
|
54
|
-
"avatar-file-input": {
|
|
55
|
-
title: "AvatarFileInput",
|
|
56
|
-
stories: avatarFileInputStories
|
|
57
|
-
},
|
|
58
|
-
"checkbox-button": {
|
|
59
|
-
title: "CheckboxButton",
|
|
60
|
-
stories: checkboxButtonStories
|
|
61
|
-
},
|
|
62
|
-
"checkbox-input": {
|
|
63
|
-
title: "CheckboxInput",
|
|
64
|
-
stories: checkboxInputStories
|
|
65
|
-
},
|
|
66
|
-
"checkbox-list": {
|
|
67
|
-
title: "CheckboxList",
|
|
68
|
-
stories: checkboxListStories
|
|
69
|
-
},
|
|
70
|
-
"color-radio-group": {
|
|
71
|
-
title: "ColorRadioGroup",
|
|
72
|
-
stories: colorRadioGroupStories
|
|
73
|
-
},
|
|
74
|
-
"combobox": {
|
|
75
|
-
title: "Combobox",
|
|
76
|
-
stories: comboboxStories
|
|
77
|
-
},
|
|
78
|
-
"date-picker-input": {
|
|
79
|
-
title: "DatePickerInput",
|
|
80
|
-
stories: datePickerInputStories
|
|
81
|
-
},
|
|
82
|
-
"date-range-picker-input": {
|
|
83
|
-
title: "DateRangePickerInput",
|
|
84
|
-
stories: dateRangePickerInputStories
|
|
85
|
-
},
|
|
86
|
-
"datetime-picker-input": {
|
|
87
|
-
title: "DatetimePickerInput",
|
|
88
|
-
stories: datetimePickerInputStories
|
|
89
|
-
},
|
|
90
|
-
"dropzone": {
|
|
91
|
-
title: "Dropzone",
|
|
92
|
-
stories: dropzoneStories
|
|
93
|
-
},
|
|
94
|
-
"file-input": {
|
|
95
|
-
title: "FileInput",
|
|
96
|
-
stories: fileInputStories
|
|
97
|
-
},
|
|
98
|
-
"form": {
|
|
99
|
-
title: "Form",
|
|
100
|
-
stories: formStories
|
|
101
|
-
},
|
|
102
|
-
"form-renderer": {
|
|
103
|
-
title: "FormRenderer",
|
|
104
|
-
stories: formRendererStories
|
|
105
|
-
},
|
|
106
|
-
"gps-input": {
|
|
107
|
-
title: "GpsInput",
|
|
108
|
-
stories: gpsInputStories
|
|
109
|
-
},
|
|
110
|
-
"money-input": {
|
|
111
|
-
title: "MoneyInput",
|
|
112
|
-
stories: moneyInputStories
|
|
113
|
-
},
|
|
114
|
-
"multi-combobox": {
|
|
115
|
-
title: "MultiCombobox",
|
|
116
|
-
stories: multiComboboxStories
|
|
117
|
-
},
|
|
118
|
-
"multi-select": {
|
|
119
|
-
title: "MultiSelect",
|
|
120
|
-
stories: multiSelectStories
|
|
121
|
-
},
|
|
122
|
-
"number-input": {
|
|
123
|
-
title: "NumberInput",
|
|
124
|
-
stories: numberInputStories
|
|
125
|
-
},
|
|
126
|
-
"password-input": {
|
|
127
|
-
title: "PasswordInput",
|
|
128
|
-
stories: passwordInputStories
|
|
129
|
-
},
|
|
130
|
-
"radio-group": {
|
|
131
|
-
title: "RadioGroup",
|
|
132
|
-
stories: radioGroupStories
|
|
133
|
-
},
|
|
134
|
-
"select": {
|
|
135
|
-
title: "Select",
|
|
136
|
-
stories: selectStories
|
|
137
|
-
},
|
|
138
|
-
"text-input": {
|
|
139
|
-
title: "TextInput",
|
|
140
|
-
stories: textInputStories
|
|
141
|
-
},
|
|
142
|
-
"textarea": {
|
|
143
|
-
title: "Textarea",
|
|
144
|
-
stories: textareaStories
|
|
145
|
-
},
|
|
146
|
-
"time-picker-input": {
|
|
147
|
-
title: "TimePickerInput",
|
|
148
|
-
stories: timePickerInputStories
|
|
149
|
-
},
|
|
150
|
-
"toggle": {
|
|
151
|
-
title: "Toggle",
|
|
152
|
-
stories: toggleStories
|
|
153
|
-
},
|
|
154
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { DatePickerInputProps as UIDatePickerInputProps } from "@uxf/ui/date-picker-input";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { FieldValues } from "react-hook-form";
|
|
4
|
-
import { ControlProps } from "../types";
|
|
5
|
-
export type DatePickerInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIDatePickerInputProps, "isFocused" | "isInvalid" | "max" | "min" | "name" | "onChange" | "pattern" | "step" | "value"> & {
|
|
6
|
-
onChange?: UIDatePickerInputProps["onChange"];
|
|
7
|
-
requiredMessage?: string;
|
|
8
|
-
minDate?: string;
|
|
9
|
-
maxDate?: string;
|
|
10
|
-
};
|
|
11
|
-
export type DatePickerInputValue = string | null;
|
|
12
|
-
export declare function DatePickerInput<FormData extends FieldValues>(props: DatePickerInputProps<FormData>): React.JSX.Element;
|
|
13
|
-
export declare namespace DatePickerInput {
|
|
14
|
-
var displayName: string;
|
|
15
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.DatePickerInput = DatePickerInput;
|
|
31
|
-
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
32
|
-
const date_picker_input_1 = require("@uxf/ui/date-picker-input");
|
|
33
|
-
const dayjs_1 = __importStar(require("dayjs"));
|
|
34
|
-
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
35
|
-
const react_1 = __importDefault(require("react"));
|
|
36
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
37
|
-
const form_context_1 = require("../form-id-context/form-context");
|
|
38
|
-
(0, dayjs_1.extend)(customParseFormat_1.default);
|
|
39
|
-
function DatePickerInput(props) {
|
|
40
|
-
var _a, _b, _c, _d, _e, _f;
|
|
41
|
-
const formContext = (0, form_context_1.useFormContext)();
|
|
42
|
-
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
43
|
-
const displayDateFormat = (_b = props.displayDateFormat) !== null && _b !== void 0 ? _b : date_picker_input_1.DISPLAY_DATE_FORMAT;
|
|
44
|
-
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
45
|
-
control: props.control,
|
|
46
|
-
name: props.name,
|
|
47
|
-
rules: {
|
|
48
|
-
required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
|
|
49
|
-
...props.rules,
|
|
50
|
-
validate: {
|
|
51
|
-
validDate: (value) => {
|
|
52
|
-
if (!value) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (!(0, dayjs_1.default)(value, date_picker_input_1.OUTPUT_DATE_FORMAT, true).isValid()) {
|
|
56
|
-
return `Datum musí být ve formátu ${displayDateFormat}.`;
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
validDateRange: (value) => {
|
|
60
|
-
if (!value) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (props.minDate && (0, dayjs_1.default)(value, date_picker_input_1.OUTPUT_DATE_FORMAT, true).isBefore(props.minDate)) {
|
|
64
|
-
return `Minimální datum, který je možné zadat, je: ${(0, dayjs_1.default)(props.minDate).format(displayDateFormat)}`;
|
|
65
|
-
}
|
|
66
|
-
if (props.maxDate && (0, dayjs_1.default)(value, date_picker_input_1.OUTPUT_DATE_FORMAT, true).isAfter(props.maxDate)) {
|
|
67
|
-
return `Maximální datum, který je možné zadat, je: ${(0, dayjs_1.default)(props.maxDate).format(displayDateFormat)}`;
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
...(typeof ((_c = props.rules) === null || _c === void 0 ? void 0 : _c.validate) === "function"
|
|
71
|
-
? { custom: props.rules.validate }
|
|
72
|
-
: (_d = props.rules) === null || _d === void 0 ? void 0 : _d.validate),
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
shouldUnregister: props.shouldUnregister,
|
|
76
|
-
});
|
|
77
|
-
const onBlur = (event) => {
|
|
78
|
-
var _a;
|
|
79
|
-
field.onBlur();
|
|
80
|
-
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
81
|
-
};
|
|
82
|
-
const onChange = (value, event) => {
|
|
83
|
-
var _a;
|
|
84
|
-
field.onChange(value);
|
|
85
|
-
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
86
|
-
};
|
|
87
|
-
return (react_1.default.createElement(date_picker_input_1.DatePickerInput, { allowedDateFormats: props.allowedDateFormats, autoFocus: props.autoFocus, bottomContent: props.bottomContent, className: props.className, datesConfig: props.datesConfig, displayDateFormat: props.displayDateFormat, form: props.form, helperText: (_f = (_e = fieldState.error) === null || _e === void 0 ? void 0 : _e.message) !== null && _f !== void 0 ? _f : props.helperText, hiddenLabel: props.hiddenLabel, id: id, isClearable: props.isClearable, isDisabled: 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, maxDate: props.maxDate, minDate: props.minDate, name: field.name, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, placeholder: props.placeholder, popoverPlacement: props.popoverPlacement, popoverStrategy: props.popoverStrategy, ref: field.ref, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, triggerElement: props.triggerElement, unavailableDates: props.unavailableDates, value: field.value, variant: props.variant }));
|
|
88
|
-
}
|
|
89
|
-
DatePickerInput.displayName = "UxfFormDatePickerInput";
|
|
@@ -1,31 +0,0 @@
|
|
|
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 date_picker_input_1 = require("@uxf/ui/date-picker-input");
|
|
9
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
10
|
-
const react_1 = __importDefault(require("react"));
|
|
11
|
-
const storybook_form_1 = require("../storybook/storybook-form");
|
|
12
|
-
const date_picker_input_2 = require("./date-picker-input");
|
|
13
|
-
exports.default = {
|
|
14
|
-
title: "Form/DatePickerInput",
|
|
15
|
-
component: date_picker_input_2.DatePickerInput,
|
|
16
|
-
};
|
|
17
|
-
function Default() {
|
|
18
|
-
const storyFormDatePickers = (control) => (react_1.default.createElement("div", { className: "space-y-4" },
|
|
19
|
-
react_1.default.createElement(date_picker_input_2.DatePickerInput, { control: control, isClearable: true, isRequired: true, label: "Default date picker", name: "default" }),
|
|
20
|
-
react_1.default.createElement(date_picker_input_2.DatePickerInput, { control: control, isClearable: true, isRequired: true, label: "Default date picker with default value", name: "withDefaultValue" }),
|
|
21
|
-
react_1.default.createElement(date_picker_input_2.DatePickerInput, { control: control, isClearable: true, isRequired: true, label: "Date picker with input min/max validation - only next 7 days", maxDate: (0, dayjs_1.default)().add(6, "days").format(date_picker_input_1.OUTPUT_DATE_FORMAT), minDate: (0, dayjs_1.default)().format(date_picker_input_1.OUTPUT_DATE_FORMAT), name: "withMinMaxValidation" }),
|
|
22
|
-
react_1.default.createElement(date_picker_input_2.DatePickerInput, { allowedDateFormats: ["MM/DD/YYYY", "M/D/YYYY"], control: control, displayDateFormat: "MM/DD/YYYY", id: "date-custom-format", isClearable: true, label: "Datum s vlastn\u00EDm form\u00E1tem (US)", name: "date" }),
|
|
23
|
-
react_1.default.createElement(date_picker_input_2.DatePickerInput, { bottomContent: react_1.default.createElement("div", null,
|
|
24
|
-
"Bottom content",
|
|
25
|
-
react_1.default.createElement("p", null, "Here can goes anything")), control: control, isClearable: true, isRequired: true, label: "With bottom content", name: "default" }),
|
|
26
|
-
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
27
|
-
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: {
|
|
28
|
-
withDefaultValue: (0, dayjs_1.default)("2023-10-20T14:32:10.511").format("YYYY-MM-DD"),
|
|
29
|
-
} }, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
30
|
-
react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, storyFormDatePickers(control))))));
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./date-picker-input";
|
|
@@ -1,17 +0,0 @@
|
|
|
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("./date-picker-input"), exports);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { DateRangePickerInputProps as UIDateRangePickerInputProps } from "@uxf/ui/date-range-picker-input";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { FieldValues } from "react-hook-form";
|
|
4
|
-
import { ControlProps } from "../types";
|
|
5
|
-
export type DateRangePickerInputProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIDateRangePickerInputProps, "isFocused" | "isInvalid" | "max" | "min" | "name" | "onChange" | "pattern" | "step" | "value"> & {
|
|
6
|
-
onChange?: UIDateRangePickerInputProps["onChange"];
|
|
7
|
-
requiredMessage?: string;
|
|
8
|
-
};
|
|
9
|
-
export declare function DateRangePickerInput<FormData extends FieldValues>(props: DateRangePickerInputProps<FormData>): React.JSX.Element;
|
|
10
|
-
export declare namespace DateRangePickerInput {
|
|
11
|
-
var displayName: string;
|
|
12
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
-
}
|
|
9
|
-
Object.defineProperty(o, k2, desc);
|
|
10
|
-
}) : (function(o, m, k, k2) {
|
|
11
|
-
if (k2 === undefined) k2 = k;
|
|
12
|
-
o[k2] = m[k];
|
|
13
|
-
}));
|
|
14
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
-
}) : function(o, v) {
|
|
17
|
-
o["default"] = v;
|
|
18
|
-
});
|
|
19
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
-
if (mod && mod.__esModule) return mod;
|
|
21
|
-
var result = {};
|
|
22
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
-
__setModuleDefault(result, mod);
|
|
24
|
-
return result;
|
|
25
|
-
};
|
|
26
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.DateRangePickerInput = DateRangePickerInput;
|
|
31
|
-
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
32
|
-
const date_range_picker_input_1 = require("@uxf/ui/date-range-picker-input");
|
|
33
|
-
const date_range_picker_input_2 = require("@uxf/ui/date-range-picker-input/date-range-picker-input");
|
|
34
|
-
const dayjs_1 = __importStar(require("dayjs"));
|
|
35
|
-
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
36
|
-
const react_1 = __importDefault(require("react"));
|
|
37
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
38
|
-
const form_context_1 = require("../form-id-context/form-context");
|
|
39
|
-
(0, dayjs_1.extend)(customParseFormat_1.default);
|
|
40
|
-
const OUTPUT_DATE_FORMAT = "YYYY-MM-DD";
|
|
41
|
-
function DateRangePickerInput(props) {
|
|
42
|
-
var _a, _b, _c, _d;
|
|
43
|
-
const formContext = (0, form_context_1.useFormContext)();
|
|
44
|
-
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
45
|
-
control: props.control,
|
|
46
|
-
name: props.name,
|
|
47
|
-
rules: {
|
|
48
|
-
required: props.isRequired ? props.requiredMessage || "Toto pole je povinné" : undefined,
|
|
49
|
-
...props.rules,
|
|
50
|
-
validate: {
|
|
51
|
-
validDate: (value) => {
|
|
52
|
-
if (!value) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const { from, to } = (0, date_range_picker_input_2.splitValueToRange)(value);
|
|
56
|
-
const fromIsValid = (0, dayjs_1.default)(from, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true).isValid();
|
|
57
|
-
const toIsValid = (0, dayjs_1.default)(to, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true).isValid();
|
|
58
|
-
if (!fromIsValid || !toIsValid) {
|
|
59
|
-
return "Rozsah musí být ve formátu D. M. YYYY. - D. M. YYYY.";
|
|
60
|
-
}
|
|
61
|
-
if ((0, dayjs_1.default)(from).isAfter((0, dayjs_1.default)(to), "day")) {
|
|
62
|
-
return "Koncové datum nemůže předcházet počátečnímu datu.";
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
...(typeof ((_a = props.rules) === null || _a === void 0 ? void 0 : _a.validate) === "function"
|
|
66
|
-
? { custom: props.rules.validate }
|
|
67
|
-
: (_b = props.rules) === null || _b === void 0 ? void 0 : _b.validate),
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
shouldUnregister: props.shouldUnregister,
|
|
71
|
-
});
|
|
72
|
-
const onBlur = (event) => {
|
|
73
|
-
var _a;
|
|
74
|
-
field.onBlur();
|
|
75
|
-
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
76
|
-
};
|
|
77
|
-
const onChange = (value, event) => {
|
|
78
|
-
var _a;
|
|
79
|
-
if (value) {
|
|
80
|
-
const { from, to } = (0, date_range_picker_input_2.splitValueToRange)(value);
|
|
81
|
-
const fromIsValid = (0, dayjs_1.default)(from, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true).isValid();
|
|
82
|
-
const toIsValid = (0, dayjs_1.default)(to, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true).isValid();
|
|
83
|
-
if (fromIsValid || toIsValid) {
|
|
84
|
-
field.onChange((fromIsValid ? (0, dayjs_1.default)(from, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true).format(OUTPUT_DATE_FORMAT) : from) +
|
|
85
|
-
date_range_picker_input_2.SEPARATOR +
|
|
86
|
-
(toIsValid ? (0, dayjs_1.default)(to, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true).format(OUTPUT_DATE_FORMAT) : to));
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
field.onChange(value);
|
|
91
|
-
}
|
|
92
|
-
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
93
|
-
};
|
|
94
|
-
const { from: fieldFrom, to: fieldTo } = (0, date_range_picker_input_2.splitValueToRange)(field.value);
|
|
95
|
-
const parsedFrom = (0, dayjs_1.default)(fieldFrom, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true);
|
|
96
|
-
const parsedTo = (0, dayjs_1.default)(fieldTo, date_range_picker_input_2.ALLOWED_DATE_FORMAT, true);
|
|
97
|
-
const value = field.value
|
|
98
|
-
? parsedFrom.isValid() || parsedTo.isValid()
|
|
99
|
-
? (parsedFrom.isValid() ? parsedFrom.format(date_range_picker_input_2.DISPLAY_DATE_FORMAT) : fieldFrom) +
|
|
100
|
-
date_range_picker_input_2.SEPARATOR +
|
|
101
|
-
(parsedTo.isValid() ? parsedTo.format(date_range_picker_input_2.DISPLAY_DATE_FORMAT) : fieldTo)
|
|
102
|
-
: field.value
|
|
103
|
-
: null;
|
|
104
|
-
return (react_1.default.createElement(date_range_picker_input_1.DateRangePickerInput, { autoFocus: props.autoFocus, bottomContent: props.bottomContent, className: props.className, datesConfig: props.datesConfig, 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, id: props.id, isClearable: props.isClearable, isDisabled: 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, numberOfMonths: props.numberOfMonths, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, placeholder: props.placeholder, popoverPlacement: props.popoverPlacement, popoverStrategy: props.popoverStrategy, ref: field.ref, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, triggerElement: props.triggerElement, unavailableDates: props.unavailableDates, value: value, variant: props.variant }));
|
|
105
|
-
}
|
|
106
|
-
DateRangePickerInput.displayName = "UxfFormDateRangePickerInput";
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { DateRangePickerInput } from "./date-range-picker-input";
|
|
3
|
-
declare const _default: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: typeof DateRangePickerInput;
|
|
6
|
-
};
|
|
7
|
-
export default _default;
|
|
8
|
-
export declare function Default(): React.JSX.Element;
|