@uxf/form 11.6.1 → 11.8.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/checkbox-input/checkbox-input.js +1 -1
- package/components.d.ts +107 -0
- package/components.js +134 -0
- package/date-picker-input/date-picker-input.stories.js +3 -0
- package/date-range-picker-input/date-range-picker-input.js +1 -1
- package/date-range-picker-input/date-range-picker-input.stories.js +3 -0
- package/datetime-picker-input/datetime-picker-input.js +1 -1
- package/datetime-picker-input/datetime-picker-input.stories.js +3 -0
- package/dropzone/dropzone-list.d.ts +1 -1
- package/dropzone/dropzone-list.js +1 -1
- package/dropzone/dropzone.stories.js +16 -1
- package/multi-combobox/multi-combobox.stories.js +2 -2
- package/multi-select/multi-select.stories.js +3 -3
- package/package.json +2 -2
- package/readmes.d.ts +25 -0
- package/readmes.js +51 -0
|
@@ -32,7 +32,7 @@ function CheckboxInput(props) {
|
|
|
32
32
|
field.onChange(value);
|
|
33
33
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
34
34
|
};
|
|
35
|
-
return (react_1.default.createElement(checkbox_input_1.CheckboxInput, { className: props.className, helperText: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : props.helperText, id: id, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isReadOnly: props.isReadOnly, isRequired: props.isRequired, label: props.label, name: field.name, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, ref: field.ref, size: props.size, value: (_e = field.value) !== null && _e !== void 0 ? _e : (!props.nullable ? false : undefined) }));
|
|
35
|
+
return (react_1.default.createElement(checkbox_input_1.CheckboxInput, { className: props.className, helperText: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : props.helperText, hiddenLabel: props.hiddenLabel, id: id, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isReadOnly: props.isReadOnly, isRequired: props.isRequired, label: props.label, name: field.name, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, ref: field.ref, size: props.size, value: (_e = field.value) !== null && _e !== void 0 ? _e : (!props.nullable ? false : undefined) }));
|
|
36
36
|
}
|
|
37
37
|
exports.CheckboxInput = CheckboxInput;
|
|
38
38
|
CheckboxInput.displayName = "UxfFormCheckboxInput";
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
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 colorRadioGroupStories from "./color-radio-group/color-radio-group.stories";
|
|
5
|
+
import * as comboboxStories from "./combobox/combobox.stories";
|
|
6
|
+
import * as datePickerInputStories from "./date-picker-input/date-picker-input.stories";
|
|
7
|
+
import * as dateRangePickerInputStories from "./date-range-picker-input/date-range-picker-input.stories";
|
|
8
|
+
import * as datetimePickerInputStories from "./datetime-picker-input/datetime-picker-input.stories";
|
|
9
|
+
import * as dropzoneStories from "./dropzone/dropzone.stories";
|
|
10
|
+
import * as fileInputStories from "./file-input/file-input.stories";
|
|
11
|
+
import * as formStories from "./form/form.stories";
|
|
12
|
+
import * as gpsInputStories from "./gps-input/gps-input.stories";
|
|
13
|
+
import * as multiComboboxStories from "./multi-combobox/multi-combobox.stories";
|
|
14
|
+
import * as multiSelectStories from "./multi-select/multi-select.stories";
|
|
15
|
+
import * as numberInputStories from "./number-input/number-input.stories";
|
|
16
|
+
import * as radioGroupStories from "./radio-group/radio-group.stories";
|
|
17
|
+
import * as selectStories from "./select/select.stories";
|
|
18
|
+
import * as textInputStories from "./text-input/text-input.stories";
|
|
19
|
+
import * as textareaStories from "./textarea/textarea.stories";
|
|
20
|
+
import * as timePickerInputStories from "./time-picker-input/time-picker-input.stories";
|
|
21
|
+
import * as toggleStories from "./toggle/toggle.stories";
|
|
22
|
+
export declare const components: {
|
|
23
|
+
readonly "avatar-file-input": {
|
|
24
|
+
readonly title: "AvatarFileInput";
|
|
25
|
+
readonly stories: typeof avatarFileInputStories;
|
|
26
|
+
};
|
|
27
|
+
readonly "checkbox-button": {
|
|
28
|
+
readonly title: "CheckboxButton";
|
|
29
|
+
readonly stories: typeof checkboxButtonStories;
|
|
30
|
+
};
|
|
31
|
+
readonly "checkbox-input": {
|
|
32
|
+
readonly title: "CheckboxInput";
|
|
33
|
+
readonly stories: typeof checkboxInputStories;
|
|
34
|
+
};
|
|
35
|
+
readonly "color-radio-group": {
|
|
36
|
+
readonly title: "ColorRadioGroup";
|
|
37
|
+
readonly stories: typeof colorRadioGroupStories;
|
|
38
|
+
};
|
|
39
|
+
readonly combobox: {
|
|
40
|
+
readonly title: "Combobox";
|
|
41
|
+
readonly stories: typeof comboboxStories;
|
|
42
|
+
};
|
|
43
|
+
readonly "date-picker-input": {
|
|
44
|
+
readonly title: "DatePickerInput";
|
|
45
|
+
readonly stories: typeof datePickerInputStories;
|
|
46
|
+
};
|
|
47
|
+
readonly "date-range-picker-input": {
|
|
48
|
+
readonly title: "DateRangePickerInput";
|
|
49
|
+
readonly stories: typeof dateRangePickerInputStories;
|
|
50
|
+
};
|
|
51
|
+
readonly "datetime-picker-input": {
|
|
52
|
+
readonly title: "DatetimePickerInput";
|
|
53
|
+
readonly stories: typeof datetimePickerInputStories;
|
|
54
|
+
};
|
|
55
|
+
readonly dropzone: {
|
|
56
|
+
readonly title: "Dropzone";
|
|
57
|
+
readonly stories: typeof dropzoneStories;
|
|
58
|
+
};
|
|
59
|
+
readonly "file-input": {
|
|
60
|
+
readonly title: "FileInput";
|
|
61
|
+
readonly stories: typeof fileInputStories;
|
|
62
|
+
};
|
|
63
|
+
readonly form: {
|
|
64
|
+
readonly title: "Form";
|
|
65
|
+
readonly stories: typeof formStories;
|
|
66
|
+
};
|
|
67
|
+
readonly "gps-input": {
|
|
68
|
+
readonly title: "GpsInput";
|
|
69
|
+
readonly stories: typeof gpsInputStories;
|
|
70
|
+
};
|
|
71
|
+
readonly "multi-combobox": {
|
|
72
|
+
readonly title: "MultiCombobox";
|
|
73
|
+
readonly stories: typeof multiComboboxStories;
|
|
74
|
+
};
|
|
75
|
+
readonly "multi-select": {
|
|
76
|
+
readonly title: "MultiSelect";
|
|
77
|
+
readonly stories: typeof multiSelectStories;
|
|
78
|
+
};
|
|
79
|
+
readonly "number-input": {
|
|
80
|
+
readonly title: "NumberInput";
|
|
81
|
+
readonly stories: typeof numberInputStories;
|
|
82
|
+
};
|
|
83
|
+
readonly "radio-group": {
|
|
84
|
+
readonly title: "RadioGroup";
|
|
85
|
+
readonly stories: typeof radioGroupStories;
|
|
86
|
+
};
|
|
87
|
+
readonly select: {
|
|
88
|
+
readonly title: "Select";
|
|
89
|
+
readonly stories: typeof selectStories;
|
|
90
|
+
};
|
|
91
|
+
readonly "text-input": {
|
|
92
|
+
readonly title: "TextInput";
|
|
93
|
+
readonly stories: typeof textInputStories;
|
|
94
|
+
};
|
|
95
|
+
readonly textarea: {
|
|
96
|
+
readonly title: "Textarea";
|
|
97
|
+
readonly stories: typeof textareaStories;
|
|
98
|
+
};
|
|
99
|
+
readonly "time-picker-input": {
|
|
100
|
+
readonly title: "TimePickerInput";
|
|
101
|
+
readonly stories: typeof timePickerInputStories;
|
|
102
|
+
};
|
|
103
|
+
readonly toggle: {
|
|
104
|
+
readonly title: "Toggle";
|
|
105
|
+
readonly stories: typeof toggleStories;
|
|
106
|
+
};
|
|
107
|
+
};
|
package/components.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
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 colorRadioGroupStories = __importStar(require("./color-radio-group/color-radio-group.stories"));
|
|
32
|
+
const comboboxStories = __importStar(require("./combobox/combobox.stories"));
|
|
33
|
+
const datePickerInputStories = __importStar(require("./date-picker-input/date-picker-input.stories"));
|
|
34
|
+
const dateRangePickerInputStories = __importStar(require("./date-range-picker-input/date-range-picker-input.stories"));
|
|
35
|
+
const datetimePickerInputStories = __importStar(require("./datetime-picker-input/datetime-picker-input.stories"));
|
|
36
|
+
const dropzoneStories = __importStar(require("./dropzone/dropzone.stories"));
|
|
37
|
+
const fileInputStories = __importStar(require("./file-input/file-input.stories"));
|
|
38
|
+
const formStories = __importStar(require("./form/form.stories"));
|
|
39
|
+
const gpsInputStories = __importStar(require("./gps-input/gps-input.stories"));
|
|
40
|
+
const multiComboboxStories = __importStar(require("./multi-combobox/multi-combobox.stories"));
|
|
41
|
+
const multiSelectStories = __importStar(require("./multi-select/multi-select.stories"));
|
|
42
|
+
const numberInputStories = __importStar(require("./number-input/number-input.stories"));
|
|
43
|
+
const radioGroupStories = __importStar(require("./radio-group/radio-group.stories"));
|
|
44
|
+
const selectStories = __importStar(require("./select/select.stories"));
|
|
45
|
+
const textInputStories = __importStar(require("./text-input/text-input.stories"));
|
|
46
|
+
const textareaStories = __importStar(require("./textarea/textarea.stories"));
|
|
47
|
+
const timePickerInputStories = __importStar(require("./time-picker-input/time-picker-input.stories"));
|
|
48
|
+
const toggleStories = __importStar(require("./toggle/toggle.stories"));
|
|
49
|
+
exports.components = {
|
|
50
|
+
"avatar-file-input": {
|
|
51
|
+
title: "AvatarFileInput",
|
|
52
|
+
stories: avatarFileInputStories
|
|
53
|
+
},
|
|
54
|
+
"checkbox-button": {
|
|
55
|
+
title: "CheckboxButton",
|
|
56
|
+
stories: checkboxButtonStories
|
|
57
|
+
},
|
|
58
|
+
"checkbox-input": {
|
|
59
|
+
title: "CheckboxInput",
|
|
60
|
+
stories: checkboxInputStories
|
|
61
|
+
},
|
|
62
|
+
"color-radio-group": {
|
|
63
|
+
title: "ColorRadioGroup",
|
|
64
|
+
stories: colorRadioGroupStories
|
|
65
|
+
},
|
|
66
|
+
"combobox": {
|
|
67
|
+
title: "Combobox",
|
|
68
|
+
stories: comboboxStories
|
|
69
|
+
},
|
|
70
|
+
"date-picker-input": {
|
|
71
|
+
title: "DatePickerInput",
|
|
72
|
+
stories: datePickerInputStories
|
|
73
|
+
},
|
|
74
|
+
"date-range-picker-input": {
|
|
75
|
+
title: "DateRangePickerInput",
|
|
76
|
+
stories: dateRangePickerInputStories
|
|
77
|
+
},
|
|
78
|
+
"datetime-picker-input": {
|
|
79
|
+
title: "DatetimePickerInput",
|
|
80
|
+
stories: datetimePickerInputStories
|
|
81
|
+
},
|
|
82
|
+
"dropzone": {
|
|
83
|
+
title: "Dropzone",
|
|
84
|
+
stories: dropzoneStories
|
|
85
|
+
},
|
|
86
|
+
"file-input": {
|
|
87
|
+
title: "FileInput",
|
|
88
|
+
stories: fileInputStories
|
|
89
|
+
},
|
|
90
|
+
"form": {
|
|
91
|
+
title: "Form",
|
|
92
|
+
stories: formStories
|
|
93
|
+
},
|
|
94
|
+
"gps-input": {
|
|
95
|
+
title: "GpsInput",
|
|
96
|
+
stories: gpsInputStories
|
|
97
|
+
},
|
|
98
|
+
"multi-combobox": {
|
|
99
|
+
title: "MultiCombobox",
|
|
100
|
+
stories: multiComboboxStories
|
|
101
|
+
},
|
|
102
|
+
"multi-select": {
|
|
103
|
+
title: "MultiSelect",
|
|
104
|
+
stories: multiSelectStories
|
|
105
|
+
},
|
|
106
|
+
"number-input": {
|
|
107
|
+
title: "NumberInput",
|
|
108
|
+
stories: numberInputStories
|
|
109
|
+
},
|
|
110
|
+
"radio-group": {
|
|
111
|
+
title: "RadioGroup",
|
|
112
|
+
stories: radioGroupStories
|
|
113
|
+
},
|
|
114
|
+
"select": {
|
|
115
|
+
title: "Select",
|
|
116
|
+
stories: selectStories
|
|
117
|
+
},
|
|
118
|
+
"text-input": {
|
|
119
|
+
title: "TextInput",
|
|
120
|
+
stories: textInputStories
|
|
121
|
+
},
|
|
122
|
+
"textarea": {
|
|
123
|
+
title: "Textarea",
|
|
124
|
+
stories: textareaStories
|
|
125
|
+
},
|
|
126
|
+
"time-picker-input": {
|
|
127
|
+
title: "TimePickerInput",
|
|
128
|
+
stories: timePickerInputStories
|
|
129
|
+
},
|
|
130
|
+
"toggle": {
|
|
131
|
+
title: "Toggle",
|
|
132
|
+
stories: toggleStories
|
|
133
|
+
},
|
|
134
|
+
};
|
|
@@ -19,6 +19,9 @@ function Default() {
|
|
|
19
19
|
react_1.default.createElement(date_picker_input_1.DatePickerInput, { control: control, isClearable: true, isRequired: true, label: "Default date picker with default value", name: "withDefaultValue" }),
|
|
20
20
|
react_1.default.createElement(date_picker_input_1.DatePickerInput, { control: control, isClearable: true, isRequired: true, minDate: "2023-06-10", maxDate: "2023-06-20", label: "Date picker with input validation", name: "withMinMaxValidation", placeholder: "" }),
|
|
21
21
|
react_1.default.createElement(date_picker_input_1.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" }),
|
|
22
|
+
react_1.default.createElement(date_picker_input_1.DatePickerInput, { bottomContent: react_1.default.createElement("div", null,
|
|
23
|
+
"Bottom content",
|
|
24
|
+
react_1.default.createElement("p", null, "Here can goes anything")), control: control, isClearable: true, isRequired: true, label: "With bottom content", name: "default" }),
|
|
22
25
|
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
23
26
|
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: {
|
|
24
27
|
withDefaultValue: (0, dayjs_1.default)("2023-10-20T14:32:10.511").format("YYYY-MM-DD"),
|
|
@@ -98,7 +98,7 @@ function DateRangePickerInput(props) {
|
|
|
98
98
|
(parsedTo.isValid() ? parsedTo.format(date_range_picker_input_2.DISPLAY_DATE_FORMAT) : fieldTo)
|
|
99
99
|
: field.value
|
|
100
100
|
: null;
|
|
101
|
-
return (react_1.default.createElement(date_range_picker_input_1.DateRangePickerInput, { autoFocus: props.autoFocus, className: props.className, datesConfig: props.datesConfig, 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: props.id, isClearable: props.isClearable, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isReadOnly: 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, triggerElement: props.triggerElement, unavailableDates: props.unavailableDates, value: value, variant: props.variant }));
|
|
101
|
+
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: (_f = (_e = fieldState.error) === null || _e === void 0 ? void 0 : _e.message) !== null && _f !== void 0 ? _f : props.helperText, hiddenLabel: props.hiddenLabel, id: props.id, isClearable: props.isClearable, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isReadOnly: 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, triggerElement: props.triggerElement, unavailableDates: props.unavailableDates, value: value, variant: props.variant }));
|
|
102
102
|
}
|
|
103
103
|
exports.DateRangePickerInput = DateRangePickerInput;
|
|
104
104
|
DateRangePickerInput.displayName = "UxfFormDateRangePickerInput";
|
|
@@ -16,6 +16,9 @@ function Default() {
|
|
|
16
16
|
const storyFormDatePickers = (control) => (react_1.default.createElement("div", { className: "space-y-4" },
|
|
17
17
|
react_1.default.createElement(date_range_picker_input_1.DateRangePickerInput, { label: "Default date range picker", name: "default", control: control, isClearable: true, isRequired: true }),
|
|
18
18
|
react_1.default.createElement(date_range_picker_input_1.DateRangePickerInput, { label: "Date range picker with two months", name: "twomonths", numberOfMonths: 2, control: control, isClearable: true, isRequired: true }),
|
|
19
|
+
react_1.default.createElement(date_range_picker_input_1.DateRangePickerInput, { bottomContent: react_1.default.createElement("div", null,
|
|
20
|
+
"Bottom content",
|
|
21
|
+
react_1.default.createElement("p", null, "Here can goes anything")), label: "With bottom content", name: "default", control: control, isClearable: true, isRequired: true }),
|
|
19
22
|
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
20
23
|
return (react_1.default.createElement(storybook_form_1.StorybookForm, null, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
21
24
|
react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, storyFormDatePickers(control)),
|
|
@@ -84,7 +84,7 @@ function DatetimePickerInput(props) {
|
|
|
84
84
|
field.onChange(value);
|
|
85
85
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
86
86
|
};
|
|
87
|
-
return (react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { autoFocus: props.autoFocus, className: props.className, form: props.form, helperText: (_g = (_f = fieldState.error) === null || _f === void 0 ? void 0 : _f.message) !== null && _g !== void 0 ? _g : props.helperText, hiddenLabel: props.hiddenLabel, id: id, isClearable: props.isClearable, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isReadOnly: 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, triggerElement: props.triggerElement, unavailableDates: props.unavailableDates, value: field.value, variant: props.variant }));
|
|
87
|
+
return (react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { autoFocus: props.autoFocus, bottomContent: props.bottomContent, className: props.className, form: props.form, helperText: (_g = (_f = fieldState.error) === null || _f === void 0 ? void 0 : _f.message) !== null && _g !== void 0 ? _g : props.helperText, hiddenLabel: props.hiddenLabel, id: id, isClearable: props.isClearable, isDisabled: props.isDisabled, isInvalid: !!fieldState.error, isReadOnly: 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, triggerElement: props.triggerElement, unavailableDates: props.unavailableDates, value: field.value, variant: props.variant }));
|
|
88
88
|
}
|
|
89
89
|
exports.DatetimePickerInput = DatetimePickerInput;
|
|
90
90
|
DatetimePickerInput.displayName = "UxfFormDatePickerInput";
|
|
@@ -18,6 +18,9 @@ function Default() {
|
|
|
18
18
|
react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: control, isClearable: true, isRequired: true, label: "Default datetime picker", name: "default" }),
|
|
19
19
|
react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: control, isClearable: true, isRequired: true, label: "Default datetime picker with default value", name: "withDefaultValue" }),
|
|
20
20
|
react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { control: control, isClearable: true, isRequired: true, minDate: "2023-06-10", maxDate: "2023-06-20", label: "Date time picker with input validation", name: "withMinMaxValidation", placeholder: "" }),
|
|
21
|
+
react_1.default.createElement(datetime_picker_input_1.DatetimePickerInput, { bottomContent: react_1.default.createElement("div", null,
|
|
22
|
+
"Bottom content",
|
|
23
|
+
react_1.default.createElement("p", null, "Here can goes anything")), control: control, isClearable: true, isRequired: true, label: "With bottom content", name: "default" }),
|
|
21
24
|
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
22
25
|
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: {
|
|
23
26
|
withDefaultValue: (0, dayjs_1.default)("2023-10-20T14:32:10.511").toISOString(),
|
|
@@ -4,7 +4,7 @@ import { FormControlProps } from "@uxf/ui/types";
|
|
|
4
4
|
import React from "react";
|
|
5
5
|
import { FieldValues, UseControllerProps } from "react-hook-form";
|
|
6
6
|
type OnChangeHandler = FormControlProps<DropzoneFile[] | undefined>["onChange"];
|
|
7
|
-
export interface DropzoneListProps<FormData extends FieldValues> extends Pick<UseControllerProps<FormData>, "control" | "name">, Pick<UIDropzoneListProps, "className" | "errorText" | "
|
|
7
|
+
export interface DropzoneListProps<FormData extends FieldValues> extends Pick<UseControllerProps<FormData>, "control" | "name">, Pick<UIDropzoneListProps, "className" | "errorText" | "onRemoveConfirm" | "renderItem"> {
|
|
8
8
|
onChange?: OnChangeHandler;
|
|
9
9
|
}
|
|
10
10
|
export declare function DropzoneList<FormData extends FieldValues>(props: DropzoneListProps<FormData>): React.JSX.Element;
|
|
@@ -17,7 +17,7 @@ function DropzoneList(props) {
|
|
|
17
17
|
field.onChange(value);
|
|
18
18
|
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
19
19
|
};
|
|
20
|
-
return (react_1.default.createElement(dropzone_1.Dropzone.List, { className: props.className, errorText: props.errorText,
|
|
20
|
+
return (react_1.default.createElement(dropzone_1.Dropzone.List, { className: props.className, errorText: props.errorText, onChange: onChange, onRemoveConfirm: props.onRemoveConfirm, renderItem: props.renderItem, value: field.value }));
|
|
21
21
|
}
|
|
22
22
|
exports.DropzoneList = DropzoneList;
|
|
23
23
|
DropzoneList.displayName = "UxfFormDropzoneList";
|
|
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Default = void 0;
|
|
7
7
|
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const message_1 = require("@uxf/ui/message");
|
|
8
9
|
const upload_file_mock_1 = require("@uxf/ui/utils/mocks/upload-file.mock");
|
|
9
10
|
const validator_exceptions_1 = require("@uxf/ui/utils/validator/validator-exceptions");
|
|
10
11
|
const react_1 = __importDefault(require("react"));
|
|
@@ -31,6 +32,20 @@ const DUMMY_FILES = [
|
|
|
31
32
|
},
|
|
32
33
|
];
|
|
33
34
|
function Default() {
|
|
35
|
+
const onRemoveConfirm = () => {
|
|
36
|
+
return new Promise((resolve) => {
|
|
37
|
+
message_1.MessageService.openConfirm({
|
|
38
|
+
acceptLabel: "Yes, delete",
|
|
39
|
+
cancelLabel: "Cancel",
|
|
40
|
+
title: "Do you want to delete the file?",
|
|
41
|
+
color: "error",
|
|
42
|
+
variant: "centered",
|
|
43
|
+
onAccept: () => resolve(true),
|
|
44
|
+
onCancel: () => resolve(false),
|
|
45
|
+
CustomIconComponent: null,
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
};
|
|
34
49
|
const onUploadError = async (e) => {
|
|
35
50
|
if (e === validator_exceptions_1.ValidatorExceptions.MaxFileSize) {
|
|
36
51
|
// eslint-disable-next-line no-alert
|
|
@@ -42,7 +57,7 @@ function Default() {
|
|
|
42
57
|
"image/png": [".png"],
|
|
43
58
|
}, control: control, helperText: "Allow multiple files, 1MB max file size, only .png", isRequired: true, label: "Use drag and drop or click to upload", name: "dropzone", onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, maxFileSize: 1024 * 1024 }),
|
|
44
59
|
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit"),
|
|
45
|
-
react_1.default.createElement(index_1.Dropzone.List, { control: control, errorText: "Oops, n\u011Bco se pokazilo", name: "dropzone",
|
|
60
|
+
react_1.default.createElement(index_1.Dropzone.List, { control: control, errorText: "Oops, n\u011Bco se pokazilo", name: "dropzone", onRemoveConfirm: onRemoveConfirm })));
|
|
46
61
|
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: { dropzone: DUMMY_FILES } }, ({ control }) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
47
62
|
react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
48
63
|
react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, storyFormDropzone(control)),
|
|
@@ -14,7 +14,7 @@ exports.default = {
|
|
|
14
14
|
};
|
|
15
15
|
const options = [
|
|
16
16
|
{ id: "one", label: "Option one", color: "red" },
|
|
17
|
-
{ id: "two", label: "Option two", color: "blue", disabled: true },
|
|
17
|
+
{ id: "two", label: "Option two disabled", color: "blue", disabled: true },
|
|
18
18
|
{ id: "three", label: "Option three", color: "green" },
|
|
19
19
|
{ id: "four", label: "Option four disabled", disabled: true },
|
|
20
20
|
{ id: "five", label: "Option five" },
|
|
@@ -37,7 +37,7 @@ function Default() {
|
|
|
37
37
|
],
|
|
38
38
|
"combobox-with-checkboxes": [
|
|
39
39
|
{ id: "one", label: "Option one" },
|
|
40
|
-
{ id: "two", label: "Option two", disabled: true },
|
|
40
|
+
{ id: "two", label: "Option two disabled", disabled: true },
|
|
41
41
|
],
|
|
42
42
|
"select-dropdown-async-default": [
|
|
43
43
|
{ id: "one", label: "Option one" },
|
|
@@ -14,10 +14,10 @@ exports.default = {
|
|
|
14
14
|
};
|
|
15
15
|
const options = [
|
|
16
16
|
{ id: "one", label: "Option one", color: "red" },
|
|
17
|
-
{ id: "two", label: "Option two", color: "blue" },
|
|
17
|
+
{ id: "two", label: "Option two disabled", color: "blue", disabled: true },
|
|
18
18
|
{ id: "three", label: "Option three", color: "green" },
|
|
19
19
|
{ id: "four", label: "Option four" },
|
|
20
|
-
{ id: "five", label: "Option five
|
|
20
|
+
{ id: "five", label: "Option five" },
|
|
21
21
|
{ id: "six", label: "Option six" },
|
|
22
22
|
];
|
|
23
23
|
function Default() {
|
|
@@ -28,7 +28,7 @@ function Default() {
|
|
|
28
28
|
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: {
|
|
29
29
|
"multi-select": [
|
|
30
30
|
{ id: "one", label: "Option one" },
|
|
31
|
-
{ id: "two", label: "Option two" },
|
|
31
|
+
{ id: "two", label: "Option two disabled", disabled: true },
|
|
32
32
|
],
|
|
33
33
|
"multi-select-with-popover": [
|
|
34
34
|
{ id: "one", label: "Option one" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/form",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "UX Fans s.r.o",
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@uxf/ui": "11.
|
|
15
|
+
"@uxf/ui": "11.8.0",
|
|
16
16
|
"coordinate-parser": "1.0.7",
|
|
17
17
|
"dayjs": "1.11.10",
|
|
18
18
|
"react-hook-form": "7.47.0"
|
package/readmes.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/// <reference types="mdx" />
|
|
2
|
+
import avatarFileInputReadme from "./avatar-file-input/README.md";
|
|
3
|
+
export declare const readmes: {
|
|
4
|
+
readonly "avatar-file-input": typeof avatarFileInputReadme;
|
|
5
|
+
readonly "checkbox-button": typeof avatarFileInputReadme;
|
|
6
|
+
readonly "checkbox-input": typeof avatarFileInputReadme;
|
|
7
|
+
readonly "color-radio-group": typeof avatarFileInputReadme;
|
|
8
|
+
readonly combobox: typeof avatarFileInputReadme;
|
|
9
|
+
readonly "date-picker-input": typeof avatarFileInputReadme;
|
|
10
|
+
readonly "date-range-picker-input": typeof avatarFileInputReadme;
|
|
11
|
+
readonly "datetime-picker-input": typeof avatarFileInputReadme;
|
|
12
|
+
readonly dropzone: typeof avatarFileInputReadme;
|
|
13
|
+
readonly "file-input": typeof avatarFileInputReadme;
|
|
14
|
+
readonly form: typeof avatarFileInputReadme;
|
|
15
|
+
readonly "gps-input": typeof avatarFileInputReadme;
|
|
16
|
+
readonly "multi-combobox": typeof avatarFileInputReadme;
|
|
17
|
+
readonly "multi-select": typeof avatarFileInputReadme;
|
|
18
|
+
readonly "number-input": typeof avatarFileInputReadme;
|
|
19
|
+
readonly "radio-group": typeof avatarFileInputReadme;
|
|
20
|
+
readonly select: typeof avatarFileInputReadme;
|
|
21
|
+
readonly "text-input": typeof avatarFileInputReadme;
|
|
22
|
+
readonly textarea: typeof avatarFileInputReadme;
|
|
23
|
+
readonly "time-picker-input": typeof avatarFileInputReadme;
|
|
24
|
+
readonly toggle: typeof avatarFileInputReadme;
|
|
25
|
+
};
|
package/readmes.js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
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.readmes = void 0;
|
|
7
|
+
// generated file
|
|
8
|
+
const README_md_1 = __importDefault(require("./avatar-file-input/README.md"));
|
|
9
|
+
const README_md_2 = __importDefault(require("./checkbox-button/README.md"));
|
|
10
|
+
const README_md_3 = __importDefault(require("./checkbox-input/README.md"));
|
|
11
|
+
const README_md_4 = __importDefault(require("./color-radio-group/README.md"));
|
|
12
|
+
const README_md_5 = __importDefault(require("./combobox/README.md"));
|
|
13
|
+
const README_md_6 = __importDefault(require("./date-picker-input/README.md"));
|
|
14
|
+
const README_md_7 = __importDefault(require("./date-range-picker-input/README.md"));
|
|
15
|
+
const README_md_8 = __importDefault(require("./datetime-picker-input/README.md"));
|
|
16
|
+
const README_md_9 = __importDefault(require("./dropzone/README.md"));
|
|
17
|
+
const README_md_10 = __importDefault(require("./file-input/README.md"));
|
|
18
|
+
const README_md_11 = __importDefault(require("./form/README.md"));
|
|
19
|
+
const README_md_12 = __importDefault(require("./gps-input/README.md"));
|
|
20
|
+
const README_md_13 = __importDefault(require("./multi-combobox/README.md"));
|
|
21
|
+
const README_md_14 = __importDefault(require("./multi-select/README.md"));
|
|
22
|
+
const README_md_15 = __importDefault(require("./number-input/README.md"));
|
|
23
|
+
const README_md_16 = __importDefault(require("./radio-group/README.md"));
|
|
24
|
+
const README_md_17 = __importDefault(require("./select/README.md"));
|
|
25
|
+
const README_md_18 = __importDefault(require("./text-input/README.md"));
|
|
26
|
+
const README_md_19 = __importDefault(require("./textarea/README.md"));
|
|
27
|
+
const README_md_20 = __importDefault(require("./time-picker-input/README.md"));
|
|
28
|
+
const README_md_21 = __importDefault(require("./toggle/README.md"));
|
|
29
|
+
exports.readmes = {
|
|
30
|
+
"avatar-file-input": README_md_1.default,
|
|
31
|
+
"checkbox-button": README_md_2.default,
|
|
32
|
+
"checkbox-input": README_md_3.default,
|
|
33
|
+
"color-radio-group": README_md_4.default,
|
|
34
|
+
"combobox": README_md_5.default,
|
|
35
|
+
"date-picker-input": README_md_6.default,
|
|
36
|
+
"date-range-picker-input": README_md_7.default,
|
|
37
|
+
"datetime-picker-input": README_md_8.default,
|
|
38
|
+
"dropzone": README_md_9.default,
|
|
39
|
+
"file-input": README_md_10.default,
|
|
40
|
+
"form": README_md_11.default,
|
|
41
|
+
"gps-input": README_md_12.default,
|
|
42
|
+
"multi-combobox": README_md_13.default,
|
|
43
|
+
"multi-select": README_md_14.default,
|
|
44
|
+
"number-input": README_md_15.default,
|
|
45
|
+
"radio-group": README_md_16.default,
|
|
46
|
+
"select": README_md_17.default,
|
|
47
|
+
"text-input": README_md_18.default,
|
|
48
|
+
"textarea": README_md_19.default,
|
|
49
|
+
"time-picker-input": README_md_20.default,
|
|
50
|
+
"toggle": README_md_21.default,
|
|
51
|
+
};
|