@uxf/ui 10.10.1 → 11.0.0-beta.17
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/_file-input-base/file-input-base.d.ts +0 -1
- package/_file-input-base/file-input-base.js +7 -9
- package/_select-base/_select-base.d.ts +0 -1
- package/_select-base/_select-base.js +5 -14
- package/alert-bubble/alert-bubble.d.ts +0 -2
- package/alert-bubble/alert-bubble.js +2 -2
- package/avatar-file-input/avatar-file-input.d.ts +2 -10
- package/avatar-file-input/avatar-file-input.js +11 -27
- package/button-list/button-list.d.ts +1 -2
- package/calendar/calendar-day-cell.js +2 -3
- package/checkbox-input/checkbox-input.d.ts +0 -1
- package/checkbox-input/checkbox-input.js +3 -8
- package/combobox/combobox.js +1 -2
- package/create-component-preview-page/ui-components.d.ts +0 -10
- package/create-component-preview-page/ui-components.js +0 -10
- package/create-component-preview-page/ui-readmes.js +44 -48
- package/css/avatar-file-input.css +67 -97
- package/css/calendar.css +6 -1
- package/css/checkbox-input.css +1 -9
- package/date-picker/date-picker.stories.js +1 -17
- package/date-picker-input/date-picker-input.d.ts +3 -5
- package/date-picker-input/date-picker-input.js +7 -9
- package/date-picker-input/date-picker-input.stories.js +1 -2
- package/dropzone/dropzone-input.d.ts +0 -1
- package/dropzone/dropzone-input.js +5 -11
- package/dropzone/dropzone-list.d.ts +0 -1
- package/dropzone/dropzone-list.js +2 -2
- package/file-input/file-input.d.ts +2 -2
- package/file-input/file-input.js +2 -11
- package/message/README.md +1 -25
- package/message/message-content.d.ts +0 -2
- package/message/message-content.js +1 -1
- package/message/message.d.ts +5 -7
- package/message/message.js +1 -1
- package/multi-combobox/_multi-combobox-base.js +4 -26
- package/package.json +4 -4
- package/radio-group/radio-group.d.ts +1 -1
- package/tabs/tabs.d.ts +0 -1
- package/tabs/tabs.js +1 -2
- package/image-gallery/README.md +0 -8
- package/utils/validator/validator-exceptions.d.ts +0 -3
- package/utils/validator/validator-exceptions.js +0 -7
|
@@ -1,146 +1,116 @@
|
|
|
1
1
|
.uxf-avatar-file-input {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
align-items: center;
|
|
3
|
+
display: flex;
|
|
4
|
+
gap: theme("spacing.4");
|
|
5
|
+
|
|
6
|
+
&__input {
|
|
7
|
+
display: none;
|
|
4
8
|
}
|
|
5
9
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
margin-top: theme("spacing.2");
|
|
10
|
+
&--variant-default {
|
|
11
|
+
.uxf-avatar-file-input__label {
|
|
12
|
+
border-radius: theme("borderRadius.full");
|
|
13
|
+
}
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
&
|
|
16
|
+
&__label {
|
|
17
|
+
@apply transition-all duration-75;
|
|
18
|
+
|
|
19
|
+
align-items: center;
|
|
20
|
+
border-style: dashed;
|
|
21
|
+
border-width: theme("borderWidth.2");
|
|
14
22
|
cursor: pointer;
|
|
15
|
-
|
|
23
|
+
display: flex;
|
|
16
24
|
height: theme("height.20");
|
|
17
|
-
|
|
25
|
+
justify-content: center;
|
|
18
26
|
width: theme("width.20");
|
|
19
27
|
|
|
20
|
-
|
|
21
|
-
:
|
|
22
|
-
|
|
23
|
-
}
|
|
28
|
+
:root .light & {
|
|
29
|
+
border-color: theme("colors.lightBorder");
|
|
30
|
+
}
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
:root .dark & {
|
|
33
|
+
border-color: theme("colors.darkBorder");
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&-wrapper {
|
|
37
|
+
align-items: center;
|
|
38
|
+
display: flex;
|
|
39
|
+
gap: theme("spacing.4");
|
|
28
40
|
}
|
|
29
41
|
|
|
30
|
-
|
|
42
|
+
&-icon {
|
|
31
43
|
:root .light & {
|
|
32
|
-
|
|
33
|
-
--border-color: var(--color);
|
|
34
|
-
--color: theme("colors.error.DEFAULT");
|
|
44
|
+
color: theme("colors.lightLow");
|
|
35
45
|
}
|
|
36
46
|
|
|
37
47
|
:root .dark & {
|
|
38
|
-
|
|
39
|
-
--border-color: var(--color);
|
|
40
|
-
--color: theme("colors.error.DEFAULT");
|
|
48
|
+
color: theme("colors.lightBorder");
|
|
41
49
|
}
|
|
42
|
-
}
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
pointer-events: none;
|
|
46
|
-
|
|
47
|
-
.uxf-avatar-file-input__input-empty {
|
|
51
|
+
&.is-invalid {
|
|
48
52
|
:root .light & {
|
|
49
|
-
|
|
50
|
-
--color: theme("colors.lightBorder");
|
|
53
|
+
color: theme("colors.error.DEFAULT");
|
|
51
54
|
}
|
|
52
55
|
|
|
53
56
|
:root .dark & {
|
|
54
|
-
|
|
55
|
-
--color: theme("colors.darkBorder");
|
|
57
|
+
color: theme("colors.error.DEFAULT");
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
.uxf-avatar-file-input__input-avatar {
|
|
60
|
-
opacity: 0.5;
|
|
61
|
-
}
|
|
62
60
|
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
&__input-element {
|
|
66
|
-
@apply sr-only;
|
|
67
61
|
|
|
68
|
-
&:
|
|
62
|
+
&:hover {
|
|
69
63
|
border-width: theme("borderWidth.4");
|
|
64
|
+
}
|
|
70
65
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
--color: theme("colors.primary.DEFAULT");
|
|
66
|
+
&.is-invalid {
|
|
67
|
+
:root .light & {
|
|
68
|
+
border-color: theme("colors.error.DEFAULT");
|
|
75
69
|
}
|
|
76
70
|
|
|
77
71
|
:root .dark & {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
--color: theme("colors.primary.DEFAULT");
|
|
81
|
-
*/
|
|
72
|
+
border-color: theme("colors.error.DEFAULT");
|
|
73
|
+
}
|
|
82
74
|
}
|
|
83
|
-
}
|
|
84
75
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
height: 100%;
|
|
89
|
-
width: 100%;
|
|
90
|
-
}
|
|
76
|
+
&.is-disabled {
|
|
77
|
+
background-color: theme("colors.lightLow/.20");
|
|
78
|
+
cursor: not-allowed;
|
|
91
79
|
|
|
92
|
-
|
|
93
|
-
|
|
80
|
+
&:hover {
|
|
81
|
+
border-width: theme("borderWidth.2");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
94
85
|
|
|
95
|
-
|
|
86
|
+
&__label-text {
|
|
87
|
+
@apply text-sm shadow-sm;
|
|
96
88
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
border-radius: inherit;
|
|
101
|
-
display: flex;
|
|
102
|
-
height: 100%;
|
|
103
|
-
justify-content: center;
|
|
104
|
-
width: 100%;
|
|
89
|
+
border: theme("borderWidth.DEFAULT") solid theme("colors.gray.300");
|
|
90
|
+
padding: theme("spacing[1.5]") theme("spacing.3");
|
|
91
|
+
text-align: center;
|
|
105
92
|
|
|
106
93
|
:root .light & {
|
|
107
|
-
|
|
108
|
-
--border-color: theme("colors.lightBorder");
|
|
94
|
+
color: theme("colors.lightHigh");
|
|
109
95
|
}
|
|
110
96
|
|
|
111
97
|
:root .dark & {
|
|
112
|
-
|
|
113
|
-
--border-color: theme("colors.darkBorder");
|
|
98
|
+
color: theme("colors.lightBorder");
|
|
114
99
|
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
&__input-empty-icon {
|
|
118
|
-
color: var(--color);
|
|
119
|
-
height: theme("width.6");
|
|
120
|
-
width: theme("width.6");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
&__controls-buttons {
|
|
124
|
-
align-items: flex-start;
|
|
125
|
-
display: flex;
|
|
126
|
-
flex-direction: column;
|
|
127
|
-
gap: theme("spacing.2");
|
|
128
|
-
justify-content: center;
|
|
129
|
-
}
|
|
130
100
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
101
|
+
&.is-invalid {
|
|
102
|
+
:root .light & {
|
|
103
|
+
color: theme("colors.error.DEFAULT");
|
|
104
|
+
}
|
|
134
105
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
106
|
+
:root .dark & {
|
|
107
|
+
color: theme("colors.error.DEFAULT");
|
|
108
|
+
}
|
|
138
109
|
}
|
|
139
110
|
}
|
|
140
111
|
|
|
141
|
-
|
|
142
|
-
.
|
|
143
|
-
|
|
144
|
-
}
|
|
112
|
+
&__image {
|
|
113
|
+
height: theme("height.20");
|
|
114
|
+
width: theme("width.20");
|
|
145
115
|
}
|
|
146
116
|
}
|
package/css/calendar.css
CHANGED
|
@@ -115,6 +115,8 @@
|
|
|
115
115
|
:root .light & {
|
|
116
116
|
--bg-color: theme("backgroundColor.lightHigh");
|
|
117
117
|
--color: theme("colors.white");
|
|
118
|
+
|
|
119
|
+
border: 2px solid theme("colors.lightMedium");
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
:root .dark & {
|
|
@@ -128,8 +130,11 @@
|
|
|
128
130
|
&.uxf-calendar__cell--selected {
|
|
129
131
|
.uxf-calendar__cell__inner {
|
|
130
132
|
background-color: theme("backgroundColor.transparent");
|
|
131
|
-
border: 2px solid theme("colors.darkMedium");
|
|
132
133
|
color: theme("colors.white");
|
|
134
|
+
|
|
135
|
+
:root .light & {
|
|
136
|
+
border-color: theme("colors.white");
|
|
137
|
+
}
|
|
133
138
|
}
|
|
134
139
|
}
|
|
135
140
|
|
package/css/checkbox-input.css
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
.uxf-checkbox-input {
|
|
2
|
-
margin-top: 4px;
|
|
3
|
-
|
|
4
2
|
&__wrapper {
|
|
5
|
-
@apply flex justify-between space-x-3;
|
|
3
|
+
@apply flex items-center justify-between space-x-3;
|
|
6
4
|
}
|
|
7
5
|
|
|
8
6
|
&__label {
|
|
@@ -17,12 +15,6 @@
|
|
|
17
15
|
}
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
&__label--subtitle {
|
|
21
|
-
color: theme("colors.error.DEFAULT");
|
|
22
|
-
display: block;
|
|
23
|
-
font-size: theme("fontSize.caption");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
18
|
&.is-disabled,
|
|
27
19
|
&.is-readonly {
|
|
28
20
|
& + .uxf-checkbox-input__label {
|
|
@@ -22,12 +22,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
26
|
exports.Default = void 0;
|
|
30
|
-
const dayjs_1 = __importDefault(require("dayjs"));
|
|
31
27
|
const react_1 = __importStar(require("react"));
|
|
32
28
|
const action_1 = require("../utils/action");
|
|
33
29
|
const date_picker_1 = require("./date-picker");
|
|
@@ -35,24 +31,12 @@ exports.default = {
|
|
|
35
31
|
title: "UI/DatePicker",
|
|
36
32
|
component: date_picker_1.DatePicker,
|
|
37
33
|
};
|
|
38
|
-
const today = (0, dayjs_1.default)();
|
|
39
|
-
const unavailableDates = [
|
|
40
|
-
today.toDate(),
|
|
41
|
-
today.add(5, "days").toDate(),
|
|
42
|
-
today.add(6, "days").toDate(),
|
|
43
|
-
today.add(7, "days").toDate(),
|
|
44
|
-
today.add(11, "days").toDate(),
|
|
45
|
-
today.add(12, "days").toDate(),
|
|
46
|
-
];
|
|
47
34
|
function Default() {
|
|
48
35
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
49
36
|
const onChange = (0, action_1.action)("onChange", setValue);
|
|
50
37
|
const onClose = () => null;
|
|
51
38
|
const testDatePickers = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
-
react_1.default.createElement(
|
|
53
|
-
react_1.default.createElement(date_picker_1.DatePicker, { closePopoverHandler: onClose, onChange: onChange, selectedDate: value }),
|
|
54
|
-
react_1.default.createElement("p", { className: "text-lg" }, "Date picker with unavailable dates"),
|
|
55
|
-
react_1.default.createElement(date_picker_1.DatePicker, { onChange: onChange, selectedDate: value, unavailableDates: unavailableDates })));
|
|
39
|
+
react_1.default.createElement(date_picker_1.DatePicker, { closePopoverHandler: onClose, onChange: onChange, selectedDate: value })));
|
|
56
40
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
57
41
|
react_1.default.createElement("div", { className: "light max-w-[640px] space-y-4 rounded bg-white p-8" }, testDatePickers),
|
|
58
42
|
react_1.default.createElement("div", { className: "dark max-w-[640px] space-y-4 rounded bg-gray-900 p-8 text-white" }, testDatePickers)));
|
|
@@ -4,13 +4,11 @@ export declare const ALLOWED_DATE_FORMAT: string[];
|
|
|
4
4
|
export declare const DISPLAY_DATE_FORMAT = "D. M. YYYY";
|
|
5
5
|
export declare const OUTPUT_DATE_FORMAT = "YYYY-MM-DD";
|
|
6
6
|
export interface DatePickerInputProps extends Omit<InputWithPopoverProps<string | null>, "children" | "placeholder" | "triggerElement"> {
|
|
7
|
-
allowedDateFormats?: string[];
|
|
8
|
-
bottomContent?: ReactNode;
|
|
9
|
-
displayDateFormat?: string;
|
|
10
|
-
maxDate?: string;
|
|
11
|
-
minDate?: string;
|
|
12
7
|
placeholder?: string;
|
|
13
8
|
triggerElement?: ReactNode;
|
|
9
|
+
minDate?: string;
|
|
10
|
+
maxDate?: string;
|
|
14
11
|
unavailableDates?: Date[];
|
|
12
|
+
bottomContent?: ReactNode;
|
|
15
13
|
}
|
|
16
14
|
export declare const DatePickerInput: React.ForwardRefExoticComponent<DatePickerInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -38,10 +38,10 @@ const icon_1 = require("../icon");
|
|
|
38
38
|
exports.ALLOWED_DATE_FORMAT = ["D. M. YYYY", "DD. MM. YYYY", "D.M.YYYY", "DD.MM.YYYY"];
|
|
39
39
|
exports.DISPLAY_DATE_FORMAT = "D. M. YYYY";
|
|
40
40
|
exports.OUTPUT_DATE_FORMAT = "YYYY-MM-DD";
|
|
41
|
-
function getValue(value
|
|
41
|
+
function getValue(value) {
|
|
42
42
|
const parsedValue = (0, dayjs_1.default)(value, exports.OUTPUT_DATE_FORMAT, true);
|
|
43
43
|
if (value && parsedValue.isValid()) {
|
|
44
|
-
return parsedValue.format(
|
|
44
|
+
return parsedValue.format(exports.DISPLAY_DATE_FORMAT);
|
|
45
45
|
}
|
|
46
46
|
return value !== null && value !== void 0 ? value : "";
|
|
47
47
|
}
|
|
@@ -60,28 +60,26 @@ function getBoundaryDate(value) {
|
|
|
60
60
|
return undefined;
|
|
61
61
|
}
|
|
62
62
|
exports.DatePickerInput = (0, react_1.forwardRef)((props, ref) => {
|
|
63
|
-
var _a, _b
|
|
63
|
+
var _a, _b;
|
|
64
64
|
const onChange = props.onChange;
|
|
65
65
|
const className = (0, cx_1.cx)("uxf-date-picker-input", props.className);
|
|
66
|
-
const displayDateFormat = (_a = props.displayDateFormat) !== null && _a !== void 0 ? _a : exports.DISPLAY_DATE_FORMAT;
|
|
67
|
-
const allowedDateFormats = (_b = props.allowedDateFormats) !== null && _b !== void 0 ? _b : exports.ALLOWED_DATE_FORMAT;
|
|
68
66
|
const onInputChange = (0, react_1.useCallback)((value) => {
|
|
69
|
-
const parsedValue = (0, dayjs_1.default)(value,
|
|
67
|
+
const parsedValue = (0, dayjs_1.default)(value, exports.ALLOWED_DATE_FORMAT, true);
|
|
70
68
|
if (value !== "" && parsedValue.isValid()) {
|
|
71
69
|
onChange(parsedValue.format(exports.OUTPUT_DATE_FORMAT));
|
|
72
70
|
}
|
|
73
71
|
else {
|
|
74
72
|
onChange(value === "" ? null : value);
|
|
75
73
|
}
|
|
76
|
-
}, [
|
|
74
|
+
}, [onChange]);
|
|
77
75
|
const onDatePickerChange = (0, react_1.useCallback)((value) => {
|
|
78
76
|
const parsedValue = (0, dayjs_1.default)(value);
|
|
79
77
|
onChange(value ? parsedValue.format(exports.OUTPUT_DATE_FORMAT) : null);
|
|
80
78
|
}, [onChange]);
|
|
81
|
-
const value = getValue(props.value
|
|
79
|
+
const value = getValue(props.value);
|
|
82
80
|
const selectedDate = getSelectedDate(props.value);
|
|
83
81
|
const parsedMinDate = getBoundaryDate(props.minDate);
|
|
84
82
|
const parsedMaxDate = getBoundaryDate(props.maxDate);
|
|
85
|
-
return (react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, className: className, onChange: onInputChange, placeholder: (
|
|
83
|
+
return (react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, className: className, onChange: onInputChange, placeholder: (_a = props.placeholder) !== null && _a !== void 0 ? _a : (0, dayjs_1.default)().format(exports.DISPLAY_DATE_FORMAT), ref: ref, value: value, triggerElement: (_b = props.triggerElement) !== null && _b !== void 0 ? _b : react_1.default.createElement(icon_1.Icon, { name: "calendar", size: 20 }) }, ({ close }) => (react_1.default.createElement(date_picker_1.DatePicker, { minDate: parsedMinDate, maxDate: parsedMaxDate, closePopoverHandler: close, onChange: onDatePickerChange, preventScroll: true, selectedDate: selectedDate, unavailableDates: props.unavailableDates, bottomContent: props.bottomContent }))));
|
|
86
84
|
});
|
|
87
85
|
exports.DatePickerInput.displayName = "UxfUiDatePickerInput";
|
|
@@ -41,8 +41,7 @@ function Default() {
|
|
|
41
41
|
react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-disabled", isDisabled: true, label: "Datum disabled", name: "date-disabled", onChange: onChange, value: date }),
|
|
42
42
|
react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-readonly", isReadOnly: true, label: "Datum readonly", name: "date-readonly", onChange: onChange, value: date }),
|
|
43
43
|
react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-invalid", isClearable: true, isInvalid: true, label: "Datum invalid", name: "date-invalid", onChange: onChange, value: date }),
|
|
44
|
-
react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-invalid", isClearable: true, minDate: "2023-06-06", maxDate: "2023-06-12", label: "Min/max", name: "date-invalid", onChange: onChange, placeholder: "", value: date })
|
|
45
|
-
react_1.default.createElement(date_picker_input_1.DatePickerInput, { allowedDateFormats: ["MM/DD/YYYY", "M/D/YYYY"], displayDateFormat: "MM/DD/YYYY", id: "date-custom-format", isClearable: true, label: "Datum s vlastn\u00EDm form\u00E1tem (US)", name: "date", onChange: onChange, value: date })));
|
|
44
|
+
react_1.default.createElement(date_picker_input_1.DatePickerInput, { id: "date-test-invalid", isClearable: true, minDate: "2023-06-06", maxDate: "2023-06-12", label: "Min/max", name: "date-invalid", onChange: onChange, placeholder: "", value: date })));
|
|
46
45
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
47
46
|
react_1.default.createElement("div", { className: "light max-w-[640px] space-y-4 rounded bg-white p-8" }, testDatePickers),
|
|
48
47
|
react_1.default.createElement("div", { className: "dark max-w-[640px] space-y-4 rounded bg-gray-900 p-8 text-white" }, testDatePickers)));
|
|
@@ -4,7 +4,6 @@ import { IconName } from "../icon/types";
|
|
|
4
4
|
import { Accept, DropzoneFile } from "./types";
|
|
5
5
|
export interface DropzoneInputProps extends FormControlProps<DropzoneFile[] | undefined> {
|
|
6
6
|
accept?: Accept;
|
|
7
|
-
className?: string;
|
|
8
7
|
helperText?: ReactNode;
|
|
9
8
|
icon?: IconName;
|
|
10
9
|
id?: string;
|
|
@@ -51,7 +51,7 @@ function progressHandler(progressEvent, file, onValuesChange, values) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function fileUploadedHandler(uploadedFile, dropzoneFile, onValuesChange, values) {
|
|
54
|
-
if (values
|
|
54
|
+
if (values) {
|
|
55
55
|
onValuesChange(values.map((f) => f.id === dropzoneFile.id ? { ...uploadedFile, progress: 100, originalFile: f.originalFile } : f));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -63,10 +63,9 @@ function fileRejectedHandler(err, dropzoneFile, onValuesChange, values, onUpload
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
66
|
-
var _a
|
|
66
|
+
var _a;
|
|
67
67
|
const refValue = (0, react_1.useRef)();
|
|
68
68
|
refValue.current = props.value;
|
|
69
|
-
const inputRef = (0, react_1.useRef)(null);
|
|
70
69
|
const handleFileDrop = async (acceptedFiles) => {
|
|
71
70
|
const files = acceptedFiles.map((file) => ({
|
|
72
71
|
...fileToFileResponse(file),
|
|
@@ -78,11 +77,6 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
78
77
|
const onChange = (values) => {
|
|
79
78
|
props.onChange(values);
|
|
80
79
|
refValue.current = values;
|
|
81
|
-
// this ensures that the input is cleared after the upload, so there is no problem with uploading the same file again
|
|
82
|
-
const inputNode = inputRef.current;
|
|
83
|
-
if (inputNode) {
|
|
84
|
-
inputNode.value = "";
|
|
85
|
-
}
|
|
86
80
|
};
|
|
87
81
|
for (const file of files) {
|
|
88
82
|
if (!file.originalFile) {
|
|
@@ -113,19 +107,19 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
113
107
|
const labelOnCLick = (e) => {
|
|
114
108
|
e.stopPropagation();
|
|
115
109
|
};
|
|
116
|
-
return (react_1.default.createElement("div", { className:
|
|
110
|
+
return (react_1.default.createElement("div", { className: "uxf-dropzone" },
|
|
117
111
|
react_1.default.createElement("label", { ...getRootProps({
|
|
118
112
|
className: (0, cx_1.cx)("uxf-dropzone__label", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.noClick && "cursor-auto"),
|
|
119
113
|
onClick: labelOnCLick,
|
|
120
114
|
}), ref: (0, composeRefs_1.composeRefs)(ref, rootRef) },
|
|
121
|
-
react_1.default.createElement(icon_1.Icon, { className: "uxf-dropzone__label__icon", name: (
|
|
115
|
+
react_1.default.createElement(icon_1.Icon, { className: "uxf-dropzone__label__icon", name: (_a = props.icon) !== null && _a !== void 0 ? _a : "cloud" }),
|
|
122
116
|
typeof props.label === "string" ? react_1.default.createElement("span", null, props.label) : props.label,
|
|
123
117
|
react_1.default.createElement("input", { ...getInputProps({
|
|
124
118
|
className: "uxf-dropzone__input",
|
|
125
119
|
id: props.id,
|
|
126
120
|
name: props.name,
|
|
127
121
|
type: "file",
|
|
128
|
-
})
|
|
122
|
+
}) })),
|
|
129
123
|
props.helperText && (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID) }, props.helperText))));
|
|
130
124
|
});
|
|
131
125
|
exports.DropzoneInput.displayName = "UxfUiDropzoneInput";
|
|
@@ -2,7 +2,6 @@ import { FormControlProps } from "@uxf/ui/types";
|
|
|
2
2
|
import { FC, ReactNode } from "react";
|
|
3
3
|
import { DropzoneFile } from "./types";
|
|
4
4
|
export interface DropzoneListProps extends FormControlProps<DropzoneFile[] | undefined> {
|
|
5
|
-
className?: string;
|
|
6
5
|
errorText?: string;
|
|
7
6
|
onAbortWarning?: string;
|
|
8
7
|
onRemoveWarning?: string;
|
|
@@ -40,7 +40,7 @@ function formatBytes(bytes, decimals = 2) {
|
|
|
40
40
|
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(dm))} ${sizes[i]}`;
|
|
41
41
|
}
|
|
42
42
|
const DropzoneList = (props) => {
|
|
43
|
-
var _a, _b
|
|
43
|
+
var _a, _b;
|
|
44
44
|
const context = (0, react_1.useContext)(context_1.UiContext);
|
|
45
45
|
const onRemove = (file, isUploading) => () => {
|
|
46
46
|
var _a;
|
|
@@ -58,7 +58,7 @@ const DropzoneList = (props) => {
|
|
|
58
58
|
if (((_a = props.value) === null || _a === void 0 ? void 0 : _a.length) === 0) {
|
|
59
59
|
return null;
|
|
60
60
|
}
|
|
61
|
-
return (react_1.default.createElement("ul", { className:
|
|
61
|
+
return (react_1.default.createElement("ul", { className: "uxf-dropzone-list" }, (_b = props.value) === null || _b === void 0 ? void 0 : _b.map((file) => {
|
|
62
62
|
var _a, _b, _c;
|
|
63
63
|
const isUploading = file.id < 0 && !file.error;
|
|
64
64
|
return ((_b = (_a = props.renderItem) === null || _a === void 0 ? void 0 : _a.call(props, file)) !== null && _b !== void 0 ? _b : (react_1.default.createElement("li", { className: "uxf-dropzone-list__item-wrapper", key: file.id },
|
|
@@ -5,11 +5,11 @@ import { FileInputBaseProps } from "../_file-input-base";
|
|
|
5
5
|
export interface FileInputProps extends FileInputBaseProps, Clearable {
|
|
6
6
|
className?: string;
|
|
7
7
|
helperText?: ReactNode;
|
|
8
|
-
hiddenLabel?: boolean;
|
|
9
8
|
label?: ReactNode;
|
|
9
|
+
hiddenLabel?: boolean;
|
|
10
10
|
placeholder?: string;
|
|
11
|
-
size?: keyof InputGroupSizes;
|
|
12
11
|
uploadButtonLabel?: string;
|
|
12
|
+
size?: keyof InputGroupSizes;
|
|
13
13
|
variant?: keyof InputGroupVariants;
|
|
14
14
|
}
|
|
15
15
|
export declare const FileInput: React.ForwardRefExoticComponent<FileInputProps & React.RefAttributes<HTMLInputElement>>;
|
package/file-input/file-input.js
CHANGED
|
@@ -26,7 +26,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.FileInput = void 0;
|
|
27
27
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
28
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
|
-
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
30
|
const context_1 = require("@uxf/ui/context");
|
|
32
31
|
const input_1 = require("@uxf/ui/input");
|
|
@@ -52,21 +51,13 @@ exports.FileInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
52
51
|
setIsUploading(false);
|
|
53
52
|
return response;
|
|
54
53
|
};
|
|
55
|
-
const onChange = (value, event) => {
|
|
56
|
-
const inputNode = innerRef.current;
|
|
57
|
-
// this ensures that the input is cleared after the upload, so there is no problem with uploading the same file again
|
|
58
|
-
if (!value && inputNode) {
|
|
59
|
-
inputNode.value = "";
|
|
60
|
-
}
|
|
61
|
-
props.onChange(value, event);
|
|
62
|
-
};
|
|
63
54
|
return (react_1.default.createElement(form_component_1.FormComponent, { className: (0, cx_1.cx)(input.focused && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY), errorId: errorId, form: props.form, helperText: props.helperText, inputId: id, isRequired: props.isRequired, label: props.label, hiddenLabel: props.hiddenLabel },
|
|
64
55
|
react_1.default.createElement(react_1.default.Fragment, null,
|
|
65
|
-
react_1.default.createElement(_file_input_base_1._FileInputBase, { accept: props.accept, "aria-describedby": errorId, "aria-invalid": props.isInvalid, className: `uxf-file-input__input ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, form: props.form, id: id, isDisabled: props.isDisabled || isUploading, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired,
|
|
56
|
+
react_1.default.createElement(_file_input_base_1._FileInputBase, { accept: props.accept, "aria-describedby": errorId, "aria-invalid": props.isInvalid, className: `uxf-file-input__input ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, form: props.form, id: id, isDisabled: props.isDisabled || isUploading, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onBlur: input.onBlur, onChange: props.onChange, onFocus: input.onFocus, onUploadError: props.onUploadError, onUploadFile: onUploadFile, ref: ref, value: props.value }),
|
|
66
57
|
react_1.default.createElement("label", { className: (0, cx_1.cx)("uxf-input", "uxf-file-input__label", input.focused && classes_1.CLASSES.IS_FOCUSED, (props.isDisabled || props.isReadOnly) && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, isUploading && classes_1.CLASSES.IS_LOADING, isUploading && "uxf-file-input__label--has-right-addon", `uxf-input--size-${(_b = props.size) !== null && _b !== void 0 ? _b : "default"}`, `uxf-input--variant-${(_c = props.variant) !== null && _c !== void 0 ? _c : "default"}`), htmlFor: id },
|
|
67
58
|
react_1.default.createElement("div", { className: "uxf-input__left-addon uxf-file-input__label__button" }, !isUploading ? ((_d = props.uploadButtonLabel) !== null && _d !== void 0 ? _d : "Vyberte soubor") : (react_1.default.createElement(loader_1.Loader, { className: "uxf-file-input__label__loader", size: "sm" }))),
|
|
68
59
|
react_1.default.createElement("div", { className: "uxf-file-input__label__wrapper" },
|
|
69
60
|
(context === null || context === void 0 ? void 0 : context.domain) && props.value ? (react_1.default.createElement("a", { className: "uxf-file-input__label__wrapper__file-name-link", href: (0, get_file_url_1.getFileUrl)(context.domain, props.value), target: "_blank", rel: "noreferrer noopenner" }, fileName)) : (react_1.default.createElement("span", { className: "uxf-file-input__label__wrapper__file-name" }, fileName)),
|
|
70
|
-
props.value && !props.isDisabled && !props.isReadOnly && props.isClearable && (react_1.default.createElement(input_1.Input.RemoveButton, { onChange: onChange })))))));
|
|
61
|
+
props.value && !props.isDisabled && !props.isReadOnly && props.isClearable && (react_1.default.createElement(input_1.Input.RemoveButton, { onChange: props.onChange })))))));
|
|
71
62
|
});
|
|
72
63
|
exports.FileInput.displayName = "UxfUiFileInput";
|
package/message/README.md
CHANGED
|
@@ -1,25 +1 @@
|
|
|
1
|
-
# Message
|
|
2
|
-
|
|
3
|
-
## CSS dependencies
|
|
4
|
-
|
|
5
|
-
```css
|
|
6
|
-
@import url("@uxf/ui/message/message.css");
|
|
7
|
-
@import url("@uxf/ui/dialog/dialog.css");
|
|
8
|
-
@import url("@uxf/ui/button/button.css");
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Implementation
|
|
12
|
-
|
|
13
|
-
```tsx
|
|
14
|
-
import {AppProps} from "next/app";
|
|
15
|
-
import {getMessageRef, Message} from "@uxf/ui/message";
|
|
16
|
-
|
|
17
|
-
function App(props: AppProps) {
|
|
18
|
-
return (
|
|
19
|
-
<UiContextProvider value={...}>
|
|
20
|
-
{props.children}
|
|
21
|
-
<Message ref={getMessageRef()}/>
|
|
22
|
-
</UiContextProvider>
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
```
|
|
1
|
+
# Message
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
-
import { IconName } from "../icon/types";
|
|
3
2
|
import { MessageColor, MessageVariant } from "./theme";
|
|
4
3
|
export interface ConfirmProps {
|
|
5
4
|
CustomIconComponent?: ReactNode;
|
|
@@ -9,7 +8,6 @@ export interface ConfirmProps {
|
|
|
9
8
|
className?: string;
|
|
10
9
|
color: MessageColor;
|
|
11
10
|
description?: string;
|
|
12
|
-
icon?: IconName;
|
|
13
11
|
onAccept?: () => void;
|
|
14
12
|
onCancel?: () => void;
|
|
15
13
|
onClose: () => void;
|
|
@@ -28,7 +28,7 @@ const MessageContent = (props) => {
|
|
|
28
28
|
const isCentered = props.variant === "centered";
|
|
29
29
|
return (react_1.default.createElement("div", { className: `uxf-message__content ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
|
|
30
30
|
react_1.default.createElement("div", { className: "uxf-message__content-wrapper" },
|
|
31
|
-
props.CustomIconComponent !== null ? (react_1.default.createElement("div", { className: "uxf-message__icon-wrapper" }, (_b = props.CustomIconComponent) !== null && _b !== void 0 ? _b : (react_1.default.createElement(alert_bubble_1.AlertBubble, { className: "uxf-message__alert-bubble", color: props.color,
|
|
31
|
+
props.CustomIconComponent !== null ? (react_1.default.createElement("div", { className: "uxf-message__icon-wrapper" }, (_b = props.CustomIconComponent) !== null && _b !== void 0 ? _b : (react_1.default.createElement(alert_bubble_1.AlertBubble, { className: "uxf-message__alert-bubble", color: props.color, size: isCentered ? "default" : "xs" })))) : null,
|
|
32
32
|
react_1.default.createElement("div", { className: "uxf-message__text-content" },
|
|
33
33
|
react_1.default.createElement("h2", { className: "uxf-message__title" }, props.title),
|
|
34
34
|
react_1.default.createElement("p", { className: "uxf-message__description" }, props.description)),
|
package/message/message.d.ts
CHANGED
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import { IconName } from "../icon/types";
|
|
3
2
|
import { MessageColor, MessageVariant } from "./theme";
|
|
4
3
|
export interface MessageProps {
|
|
5
4
|
CustomIconComponent?: ReactNode;
|
|
6
|
-
acceptLabel?: string;
|
|
7
|
-
cancelLabel: string;
|
|
8
5
|
children?: ReactNode;
|
|
9
6
|
className?: string;
|
|
10
|
-
color: MessageColor;
|
|
11
|
-
description?: string;
|
|
12
|
-
icon?: IconName;
|
|
13
|
-
onAccept?: () => void;
|
|
14
7
|
onCancel?: () => void;
|
|
8
|
+
onAccept?: () => void;
|
|
15
9
|
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
acceptLabel?: string;
|
|
12
|
+
cancelLabel: string;
|
|
16
13
|
variant?: MessageVariant;
|
|
14
|
+
color: MessageColor;
|
|
17
15
|
}
|
|
18
16
|
export interface MessageRef {
|
|
19
17
|
close: () => void;
|
package/message/message.js
CHANGED
|
@@ -42,6 +42,6 @@ exports.Message = (0, react_1.forwardRef)((props, ref) => {
|
|
|
42
42
|
message: innerRef.current.message,
|
|
43
43
|
}), []);
|
|
44
44
|
return content ? (react_1.default.createElement(dialog_1.Dialog, { className: (0, cx_1.cx)("uxf-message", `uxf-message--variant-${(_a = content.variant) !== null && _a !== void 0 ? _a : "simple"}`, `uxf-message--color-${content.color}`, content.className), disableBackdropClose: true, onClose: close, open: !!content },
|
|
45
|
-
react_1.default.createElement(message_content_1.MessageContent, { CustomIconComponent: content.CustomIconComponent, acceptLabel: content.acceptLabel, cancelLabel: content.cancelLabel, color: content.color, description: content.description,
|
|
45
|
+
react_1.default.createElement(message_content_1.MessageContent, { CustomIconComponent: content.CustomIconComponent, acceptLabel: content.acceptLabel, cancelLabel: content.cancelLabel, color: content.color, description: content.description, onAccept: content.onAccept, onCancel: content.onCancel, onClose: close, title: content.title, variant: content.variant }, content.children))) : null;
|
|
46
46
|
});
|
|
47
47
|
exports.Message.displayName = "UxfUiMessage";
|