@uxf/ui 10.0.0-beta.4 → 10.0.0-beta.41
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.js +9 -1
- package/_select-base/_select-base.d.ts +1 -1
- package/_select-base/_select-base.js +4 -3
- package/calendar/calendar-day-cell.d.ts +3 -0
- package/calendar/calendar-day-cell.js +14 -14
- package/{date-picker/date-picker-navigation.d.ts → calendar/calendar-navigation.d.ts} +2 -3
- package/{date-picker/date-picker-navigation.js → calendar/calendar-navigation.js} +6 -6
- package/calendar/calendar-provider.js +1 -1
- package/calendar/calendar.d.ts +5 -0
- package/calendar/calendar.js +5 -8
- package/calendar/index.d.ts +4 -1
- package/calendar/index.js +5 -15
- package/chip/chip.d.ts +5 -7
- package/chip/chip.js +22 -7
- package/chip/chip.spec.d.ts +1 -0
- package/chip/chip.spec.js +9 -0
- package/chip/chip.stories.d.ts +1 -1
- package/chip/chip.stories.js +37 -28
- package/chip/index.d.ts +3 -1
- package/chip/index.js +3 -15
- package/chip/theme.d.ts +3 -0
- package/css/calendar.css +116 -51
- package/css/chip.css +217 -318
- package/css/date-picker.css +10 -2
- package/css/date-range-picker.css +21 -0
- package/css/flash-messages.css +133 -9
- package/css/image-gallery.css +13 -9
- package/css/textarea.css +66 -74
- package/css/time-picker.css +11 -15
- package/date-picker/date-picker-decade.js +6 -6
- package/date-picker/date-picker-month.js +6 -6
- package/date-picker/date-picker-year.js +2 -2
- package/date-picker/date-picker.d.ts +1 -0
- package/date-picker/date-picker.js +1 -0
- package/date-picker-input/date-picker-input.js +3 -1
- package/date-range-picker/date-range-picker-content.d.ts +2 -0
- package/date-range-picker/date-range-picker-content.js +55 -0
- package/date-range-picker/date-range-picker-decade.d.ts +6 -0
- package/date-range-picker/date-range-picker-decade.js +72 -0
- package/date-range-picker/date-range-picker-month.d.ts +8 -0
- package/date-range-picker/date-range-picker-month.js +69 -0
- package/date-range-picker/date-range-picker-year.d.ts +7 -0
- package/date-range-picker/date-range-picker-year.js +80 -0
- package/date-range-picker/date-range-picker.d.ts +9 -0
- package/date-range-picker/date-range-picker.js +50 -0
- package/date-range-picker/date-range-picker.spec.d.ts +1 -0
- package/date-range-picker/date-range-picker.spec.js +9 -0
- package/date-range-picker/date-range-picker.stories.d.ts +7 -0
- package/date-range-picker/date-range-picker.stories.js +43 -0
- package/date-range-picker/index.d.ts +3 -0
- package/date-range-picker/index.js +5 -0
- package/date-range-picker/types.d.ts +5 -0
- package/date-range-picker-input/date-range-picker-input.d.ts +15 -0
- package/date-range-picker-input/date-range-picker-input.js +62 -0
- package/date-range-picker-input/date-range-picker-input.spec.d.ts +1 -0
- package/date-range-picker-input/date-range-picker-input.spec.js +9 -0
- package/date-range-picker-input/date-range-picker-input.stories.d.ts +10 -0
- package/date-range-picker-input/date-range-picker-input.stories.js +53 -0
- package/date-range-picker-input/index.d.ts +2 -0
- package/date-range-picker-input/index.js +5 -0
- package/datetime-picker/datetime-picker.js +2 -2
- package/datetime-picker-input/datetime-picker-input.js +3 -1
- package/dropzone/dropzone-input.js +10 -6
- package/flash-messages/flash-message.js +1 -1
- package/flash-messages/flash-messages.js +44 -10
- package/flash-messages/flash-messages.stories.js +12 -0
- package/image-gallery/components/close-button.d.ts +2 -1
- package/image-gallery/components/close-button.js +2 -3
- package/image-gallery/components/gallery.d.ts +6 -3
- package/image-gallery/components/gallery.js +15 -7
- package/image-gallery/components/next-button.d.ts +7 -0
- package/image-gallery/components/next-button.js +14 -0
- package/image-gallery/components/prev-button.d.ts +7 -0
- package/image-gallery/components/prev-button.js +14 -0
- package/image-gallery/image-gallery.d.ts +6 -1
- package/image-gallery/image-gallery.js +1 -1
- package/image-gallery/image-gallery.stories.js +5 -1
- package/multi-combobox/_multi-combobox-base.js +2 -1
- package/multi-combobox/types.d.ts +3 -0
- package/multi-select/_multi-select-base.js +2 -1
- package/multi-select/types.d.ts +3 -2
- package/package.json +12 -9
- package/radio-group/index.d.ts +1 -1
- package/radio-group/radio-group.d.ts +3 -3
- package/radio-group/radio-group.js +2 -2
- package/radio-group/radio-group.stories.js +4 -4
- package/raster-image/raster-image.js +1 -1
- package/textarea/textarea.js +5 -5
- package/time-picker/time-picker-hour.js +3 -3
- package/time-picker/time-picker-hours.js +1 -1
- package/time-picker/time-picker-minute.js +3 -3
- package/time-picker/time-picker-minutes.js +1 -1
- package/time-picker/time-picker.d.ts +1 -0
- package/time-picker/time-picker.js +3 -2
- package/time-picker-input/time-picker-input.js +3 -1
- package/tw-tokens/tw-z-index.d.ts +1 -0
- package/tw-tokens/tw-z-index.js +1 -0
- package/utils/mocks/uploadFIle.mock.js +1 -1
- package/utils/storybook-config.d.ts +1 -1
- package/utils/tailwind-config.js +1 -0
- package/image-gallery/components/arrow-button.d.ts +0 -7
- package/image-gallery/components/arrow-button.js +0 -14
- package/select/theme.d.ts +0 -5
- /package/{select/theme.js → date-range-picker/types.js} +0 -0
|
@@ -81,13 +81,13 @@ const DatetimePicker = (props) => {
|
|
|
81
81
|
}, [onChange, tmpDate]);
|
|
82
82
|
const selectedDate = getSelectedDate(props.value);
|
|
83
83
|
const selectedTime = getSelectedTime(props.value);
|
|
84
|
-
return (react_1.default.createElement("div", { className: "uxf-tabs uxf-tabs--
|
|
84
|
+
return (react_1.default.createElement("div", { className: "uxf-tabs uxf-tabs--grow" },
|
|
85
85
|
react_1.default.createElement("div", { className: "uxf-tabs__tab-list__wrapper uxf-tabs__tab-list__wrapper--segmented uxf-datetime-picker__tabs" },
|
|
86
86
|
react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-tabs__tab-list", `uxf-tabs__tab-list--segmented`) },
|
|
87
87
|
react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-tabs__tab uxf-tabs__tab--segmented uxf-datetime-picker__tab", selectedTab === "date" && classes_1.CLASSES.IS_ACTIVE), onClick: () => setSelectedTab("date") }, "Datum"),
|
|
88
88
|
react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-tabs__tab uxf-tabs__tab--segmented uxf-datetime-picker__tab", selectedTab === "time" && classes_1.CLASSES.IS_ACTIVE), onClick: () => setSelectedTab("time") }, "\u010Cas"))),
|
|
89
89
|
react_1.default.createElement("div", { className: "uxf-tabs__panels" },
|
|
90
|
-
selectedTab === "date" && (react_1.default.createElement(date_picker_1.DatePicker, { maxDate: props.maxDate, minDate: props.minDate, onChange: onDatePickerChange, selectedDate: selectedDate })),
|
|
90
|
+
selectedTab === "date" && (react_1.default.createElement(date_picker_1.DatePicker, { maxDate: props.maxDate, minDate: props.minDate, onChange: onDatePickerChange, preventScroll: true, selectedDate: selectedDate })),
|
|
91
91
|
selectedTab === "time" && react_1.default.createElement(time_picker_1.TimePicker, { onChange: onTimePickerChange, selectedTime: selectedTime }))));
|
|
92
92
|
};
|
|
93
93
|
exports.DatetimePicker = DatetimePicker;
|
|
@@ -33,6 +33,7 @@ const _input_with_popover_1 = require("../_input-with-popover");
|
|
|
33
33
|
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
34
34
|
const icon_1 = require("../icon");
|
|
35
35
|
const datetime_picker_1 = require("../datetime-picker");
|
|
36
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
36
37
|
(0, dayjs_1.extend)(customParseFormat_1.default);
|
|
37
38
|
exports.ALLOWED_DATETIME_FORMAT = [
|
|
38
39
|
"D. M. YYYY H:mm",
|
|
@@ -63,6 +64,7 @@ function getBoundaryDate(value) {
|
|
|
63
64
|
exports.DatetimePickerInput = (0, react_1.forwardRef)((props, ref) => {
|
|
64
65
|
var _a, _b;
|
|
65
66
|
const onChange = props.onChange;
|
|
67
|
+
const className = (0, cx_1.cx)("uxf-date-time-picker-input", props.className);
|
|
66
68
|
const onInputChange = (0, react_1.useCallback)((value) => {
|
|
67
69
|
const parsedValue = (0, dayjs_1.default)(value, exports.ALLOWED_DATETIME_FORMAT, true);
|
|
68
70
|
if (value !== "" && parsedValue.isValid()) {
|
|
@@ -76,6 +78,6 @@ exports.DatetimePickerInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
76
78
|
const parsedMinDate = getBoundaryDate(props.minDate);
|
|
77
79
|
const parsedMaxDate = getBoundaryDate(props.maxDate);
|
|
78
80
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
79
|
-
react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, onChange: onInputChange, placeholder: (_a = props.placeholder) !== null && _a !== void 0 ? _a : (0, dayjs_1.default)().format(exports.DISPLAY_DATETIME_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(datetime_picker_1.DatetimePicker, { minDate: parsedMinDate, maxDate: parsedMaxDate, closePopoverHandler: close, onChange: onChange, value: props.value })))));
|
|
81
|
+
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_DATETIME_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(datetime_picker_1.DatetimePicker, { minDate: parsedMinDate, maxDate: parsedMaxDate, closePopoverHandler: close, onChange: onChange, value: props.value })))));
|
|
80
82
|
});
|
|
81
83
|
exports.DatetimePickerInput.displayName = "UxfUiDatePickerInput";
|
|
@@ -39,7 +39,7 @@ function fileToFileResponse(file) {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
function progressHandler(progressEvent, file, onValuesChange, values) {
|
|
42
|
-
if (
|
|
42
|
+
if (values) {
|
|
43
43
|
onValuesChange(values.map((f) => f.id === file.id
|
|
44
44
|
? {
|
|
45
45
|
...f,
|
|
@@ -51,14 +51,14 @@ function progressHandler(progressEvent, file, onValuesChange, values) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
function fileUploadedHandler(uploadedFile, dropzoneFile, onValuesChange, values) {
|
|
54
|
-
if (
|
|
54
|
+
if (values) {
|
|
55
55
|
onValuesChange(values.map((f) => f.id === dropzoneFile.id ? { ...uploadedFile, progress: 100, originalFile: f.originalFile } : f));
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
function fileRejectedHandler(err, dropzoneFile, onValuesChange, values, onUploadError) {
|
|
59
59
|
onUploadError === null || onUploadError === void 0 ? void 0 : onUploadError(err);
|
|
60
60
|
dropzoneFile.error = err;
|
|
61
|
-
if (
|
|
61
|
+
if (values) {
|
|
62
62
|
onValuesChange(values.map((f) => (f.id === dropzoneFile.id ? { ...f, error: err } : f)));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
@@ -74,6 +74,10 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
74
74
|
progress: 0,
|
|
75
75
|
}));
|
|
76
76
|
props.onChange(props.value ? [...props.value, ...files] : files);
|
|
77
|
+
const onChange = (values) => {
|
|
78
|
+
props.onChange(values);
|
|
79
|
+
refValue.current = values;
|
|
80
|
+
};
|
|
77
81
|
for (const file of files) {
|
|
78
82
|
if (!file.originalFile) {
|
|
79
83
|
file.error = "File not found";
|
|
@@ -82,10 +86,10 @@ exports.DropzoneInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
82
86
|
props
|
|
83
87
|
.onUploadFile(file.originalFile, {
|
|
84
88
|
abortController: file.abortController,
|
|
85
|
-
onUploadProgress: (e) => progressHandler(e, file,
|
|
89
|
+
onUploadProgress: (e) => progressHandler(e, file, onChange, refValue.current),
|
|
86
90
|
})
|
|
87
|
-
.then((res) => fileUploadedHandler(res, file,
|
|
88
|
-
.catch((err) => fileRejectedHandler(err, file,
|
|
91
|
+
.then((res) => fileUploadedHandler(res, file, onChange, refValue.current))
|
|
92
|
+
.catch((err) => fileRejectedHandler(err, file, onChange, refValue.current, props.onUploadError));
|
|
89
93
|
}
|
|
90
94
|
};
|
|
91
95
|
const { getRootProps, getInputProps, rootRef } = (0, react_dropzone_1.useDropzone)({
|
|
@@ -29,7 +29,7 @@ const react_1 = __importStar(require("react"));
|
|
|
29
29
|
// eslint-disable-next-line react/destructuring-assignment
|
|
30
30
|
const FlashMessage = ({ notification, onClose }) => {
|
|
31
31
|
(0, react_1.useEffect)(() => {
|
|
32
|
-
const { autoDismiss
|
|
32
|
+
const { autoDismiss, dismissTimeout } = notification;
|
|
33
33
|
let timer;
|
|
34
34
|
if (autoDismiss) {
|
|
35
35
|
timer = window.setTimeout(onClose, dismissTimeout);
|
|
@@ -26,16 +26,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.FlashMessages = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
28
|
const flash_message_1 = require("./flash-message");
|
|
29
|
+
const react_2 = require("@headlessui/react");
|
|
29
30
|
exports.FlashMessages = (0, react_1.forwardRef)((props, ref) => {
|
|
30
31
|
const [notifications, setNotifications] = (0, react_1.useState)([]);
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
const permanentNotificationsRef = (0, react_1.useRef)(null);
|
|
33
|
+
const permanentNotifications = notifications.filter((notification) => !notification.autoDismiss);
|
|
34
|
+
const dismissableNotifications = notifications.filter((notification) => !!notification.autoDismiss);
|
|
35
|
+
const [showDivider, setShowDivider] = (0, react_1.useState)(false);
|
|
36
|
+
(0, react_1.useEffect)(() => {
|
|
37
|
+
const dividerHandler = () => {
|
|
38
|
+
if (permanentNotificationsRef.current &&
|
|
39
|
+
permanentNotificationsRef.current.scrollHeight > permanentNotificationsRef.current.clientHeight &&
|
|
40
|
+
dismissableNotifications.length > 0) {
|
|
41
|
+
setShowDivider(true);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
setShowDivider(false);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
dividerHandler();
|
|
48
|
+
window.addEventListener("resize", dividerHandler);
|
|
49
|
+
return () => window.removeEventListener("resize", dividerHandler);
|
|
50
|
+
}, [dismissableNotifications.length, notifications]);
|
|
51
|
+
const open = (0, react_1.useCallback)((notification) => setNotifications((prev) => {
|
|
52
|
+
var _a;
|
|
53
|
+
return [
|
|
54
|
+
...prev,
|
|
55
|
+
{
|
|
56
|
+
...notification,
|
|
57
|
+
variant: notification.variant || "success",
|
|
58
|
+
autoDismiss: (_a = notification.autoDismiss) !== null && _a !== void 0 ? _a : true,
|
|
59
|
+
dismissTimeout: notification.dismissTimeout || 5000,
|
|
60
|
+
id: notification.id || Math.round(Math.random() * 1000),
|
|
61
|
+
},
|
|
62
|
+
];
|
|
63
|
+
}), []);
|
|
39
64
|
const close = (0, react_1.useCallback)((notification) => setNotifications((prev) => prev.filter((n) => n !== notification)), []);
|
|
40
65
|
const closeAll = (0, react_1.useCallback)(() => setNotifications([]), []);
|
|
41
66
|
const innerRef = (0, react_1.useRef)({
|
|
@@ -48,8 +73,17 @@ exports.FlashMessages = (0, react_1.forwardRef)((props, ref) => {
|
|
|
48
73
|
closeAll: innerRef.current.closeAll,
|
|
49
74
|
open: innerRef.current.open,
|
|
50
75
|
}), []);
|
|
51
|
-
const onClose = (0, react_1.useCallback)((notification) => () => setNotifications((prev) => prev.filter((n) => n !== notification)), []);
|
|
52
76
|
return notifications.length > 0 ? (react_1.default.createElement("div", { className: "uxf-flash-messages" },
|
|
53
|
-
react_1.default.createElement("div", { className: "uxf-flash-
|
|
77
|
+
dismissableNotifications.length > 0 && (react_1.default.createElement("div", { className: "uxf-flash-messages__dismissable" },
|
|
78
|
+
react_1.default.createElement("div", null, dismissableNotifications.map((notification) => {
|
|
79
|
+
return (react_1.default.createElement(react_2.Transition, { key: notification.id, appear: true, show: true, enterFrom: "uxf-flash-message-wrapper--enter-from", enterTo: "uxf-flash-message-wrapper--enter-to", className: "uxf-flash-message-wrapper" },
|
|
80
|
+
react_1.default.createElement(flash_message_1.FlashMessage, { notification: notification, onClose: () => close(notification) })));
|
|
81
|
+
})))),
|
|
82
|
+
showDivider && react_1.default.createElement("hr", { className: "uxf-flash-messages__divider" }),
|
|
83
|
+
permanentNotifications.length > 0 && (react_1.default.createElement("div", { ref: permanentNotificationsRef, className: "uxf-flash-messages__permanent" },
|
|
84
|
+
react_1.default.createElement("div", null, permanentNotifications.map((notification) => {
|
|
85
|
+
return (react_1.default.createElement(react_2.Transition, { key: notification.id, appear: true, show: true, enterFrom: "uxf-flash-message-wrapper--enter-from", enterTo: "uxf-flash-message-wrapper--enter-to", className: "uxf-flash-message-wrapper" },
|
|
86
|
+
react_1.default.createElement(flash_message_1.FlashMessage, { notification: notification, onClose: () => close(notification) })));
|
|
87
|
+
})))))) : null;
|
|
54
88
|
});
|
|
55
89
|
exports.FlashMessages.displayName = "UxfUiFlashMessages";
|
|
@@ -20,6 +20,18 @@ function Default() {
|
|
|
20
20
|
react_1.default.createElement(icon_1.Icon, { name: "check", size: 20 }),
|
|
21
21
|
react_1.default.createElement("span", null, "Everything is alright."))),
|
|
22
22
|
}) }, "Click to fire Flash message, variant success"),
|
|
23
|
+
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
24
|
+
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
25
|
+
react_1.default.createElement(icon_1.Icon, { name: "check", size: 20 }),
|
|
26
|
+
react_1.default.createElement("span", null, "Everything is alright."))),
|
|
27
|
+
variant: "error",
|
|
28
|
+
}) }, "Click to fire Flash message, variant error"),
|
|
29
|
+
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
30
|
+
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
31
|
+
react_1.default.createElement(icon_1.Icon, { name: "check", size: 20 }),
|
|
32
|
+
react_1.default.createElement("span", null, "Everything is alright."))),
|
|
33
|
+
variant: "info",
|
|
34
|
+
}) }, "Click to fire Flash message, variant info"),
|
|
23
35
|
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
24
36
|
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
25
37
|
react_1.default.createElement(icon_1.Icon, { name: "xmarkLarge", size: 20 }),
|
|
@@ -7,10 +7,9 @@ exports.CloseButton = void 0;
|
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const icon_1 = require("../../icon");
|
|
9
9
|
const CloseButton = (props) => {
|
|
10
|
-
var _a;
|
|
10
|
+
var _a, _b;
|
|
11
11
|
return (react_1.default.createElement("button", { className: "uxf-image-gallery__close-button", onClick: () => props.onClick() },
|
|
12
|
-
react_1.default.createElement("span", { className: "uxf-image-gallery__close-button-text" }, (_a = props.text) !== null && _a !== void 0 ? _a : "Zavřít"),
|
|
13
|
-
react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__close-button-icon", name: "xmarkLarge" })));
|
|
12
|
+
react_1.default.createElement("span", { className: "uxf-image-gallery__close-button-text" }, (_a = props.text) !== null && _a !== void 0 ? _a : "Zavřít"), (_b = props.buttonElement) !== null && _b !== void 0 ? _b : react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__close-button-icon", name: "xmarkLarge" })));
|
|
14
13
|
};
|
|
15
14
|
exports.CloseButton = CloseButton;
|
|
16
15
|
exports.CloseButton.displayName = "UxfUiCloseButton";
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
1
|
+
import { FC, ReactElement } from "react";
|
|
2
2
|
import { ImageGalleryImageProps } from "../types";
|
|
3
|
-
interface GalleryProps {
|
|
3
|
+
export interface GalleryProps {
|
|
4
4
|
closeButtonTitle?: string;
|
|
5
|
+
disableBackdropClose?: boolean;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
onNext: () => void;
|
|
7
8
|
onPrevious: () => void;
|
|
8
9
|
imageIndex: number;
|
|
9
10
|
images: ImageGalleryImageProps[];
|
|
11
|
+
prevButtonElement?: ReactElement;
|
|
12
|
+
nextButtonElement?: ReactElement;
|
|
13
|
+
closeButtonElement?: ReactElement;
|
|
10
14
|
}
|
|
11
15
|
export declare const Gallery: FC<GalleryProps>;
|
|
12
|
-
export {};
|
|
@@ -29,7 +29,9 @@ const resizer_1 = require("@uxf/core/utils/resizer");
|
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const close_button_1 = require("./close-button");
|
|
31
31
|
const dot_1 = require("./dot");
|
|
32
|
-
const
|
|
32
|
+
const prev_button_1 = require("./prev-button");
|
|
33
|
+
const react_swipeable_1 = require("react-swipeable");
|
|
34
|
+
const next_button_1 = require("./next-button");
|
|
33
35
|
const Gallery = (props) => {
|
|
34
36
|
var _a;
|
|
35
37
|
(0, react_1.useEffect)(() => {
|
|
@@ -56,15 +58,21 @@ const Gallery = (props) => {
|
|
|
56
58
|
}, []);
|
|
57
59
|
const imageSrc = props.images[props.imageIndex].src;
|
|
58
60
|
const customContent = props.images[props.imageIndex].customContent;
|
|
59
|
-
|
|
61
|
+
const handlers = (0, react_swipeable_1.useSwipeable)({
|
|
62
|
+
onSwipedLeft: () => props.onNext(),
|
|
63
|
+
onSwipedRight: () => props.onPrevious(),
|
|
64
|
+
swipeDuration: 500,
|
|
65
|
+
});
|
|
66
|
+
return (react_1.default.createElement("div", { className: "uxf-image-gallery", role: "dialog", "aria-modal": true },
|
|
67
|
+
react_1.default.createElement("div", { "aria-hidden": true, className: "uxf-image-gallery__backdrop", onClick: !props.disableBackdropClose ? props.onClose : undefined }),
|
|
60
68
|
react_1.default.createElement("div", { className: "uxf-image-gallery__close-button-wrapper" },
|
|
61
|
-
react_1.default.createElement(close_button_1.CloseButton, { onClick: props.onClose, text: props.closeButtonTitle })),
|
|
62
|
-
react_1.default.createElement("div", { className: "uxf-image-
|
|
69
|
+
react_1.default.createElement(close_button_1.CloseButton, { buttonElement: props.closeButtonElement, onClick: props.onClose, text: props.closeButtonTitle })),
|
|
70
|
+
props.images.length > 1 && (react_1.default.createElement("div", { className: "uxf-image-gallery__buttons" },
|
|
71
|
+
react_1.default.createElement(prev_button_1.PrevButton, { buttonElement: props.prevButtonElement, onClick: props.onPrevious }),
|
|
72
|
+
react_1.default.createElement(next_button_1.NextButton, { buttonElement: props.nextButtonElement, onClick: props.onNext }))),
|
|
73
|
+
react_1.default.createElement("div", { className: "uxf-image-gallery__content", ...handlers },
|
|
63
74
|
react_1.default.createElement("div", { className: "uxf-image-gallery__inner" },
|
|
64
75
|
react_1.default.createElement("img", { alt: "", className: "uxf-image-gallery__image", src: typeof imageSrc === "string" ? imageSrc : (_a = (0, resizer_1.resizerImageUrl)(imageSrc)) !== null && _a !== void 0 ? _a : "" }),
|
|
65
|
-
props.images.length > 1 && (react_1.default.createElement("div", { className: "uxf-image-gallery__buttons" },
|
|
66
|
-
react_1.default.createElement(arrow_button_1.ArrowButton, { onClick: props.onPrevious, type: "prev" }),
|
|
67
|
-
react_1.default.createElement(arrow_button_1.ArrowButton, { onClick: props.onNext, type: "next" }))),
|
|
68
76
|
react_1.default.createElement("div", { className: "uxf-image-gallery__custom-content" }, customContent))),
|
|
69
77
|
props.images.length > 1 && (react_1.default.createElement("div", { className: "uxf-image-gallery__dots" }, props.images.map((image, index) => (react_1.default.createElement(dot_1.Dot, { key: (0, image_1.getImgUniqueIdentifier)(image.src) || index, active: index === props.imageIndex })))))));
|
|
70
78
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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.NextButton = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const icon_1 = require("../../icon");
|
|
9
|
+
const NextButton = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("button", { className: "uxf-image-gallery__button uxf-image-gallery__button--next", onClick: props.onClick }, (_a = props.buttonElement) !== null && _a !== void 0 ? _a : react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__button-icon", name: "chevronRight" })));
|
|
12
|
+
};
|
|
13
|
+
exports.NextButton = NextButton;
|
|
14
|
+
exports.NextButton.displayName = "UxfUiNextButton";
|
|
@@ -0,0 +1,14 @@
|
|
|
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.PrevButton = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const icon_1 = require("../../icon");
|
|
9
|
+
const PrevButton = (props) => {
|
|
10
|
+
var _a;
|
|
11
|
+
return (react_1.default.createElement("button", { className: "uxf-image-gallery__button uxf-image-gallery__button--prev", onClick: props.onClick }, (_a = props.buttonElement) !== null && _a !== void 0 ? _a : react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__button-icon", name: "chevronLeft" })));
|
|
12
|
+
};
|
|
13
|
+
exports.PrevButton = PrevButton;
|
|
14
|
+
exports.PrevButton.displayName = "UxfUiPrevButton";
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
import { FC, ReactNode } from "react";
|
|
1
|
+
import { FC, ReactElement, ReactNode } from "react";
|
|
2
|
+
import { GalleryProps } from "./components/gallery";
|
|
2
3
|
export interface ImageGalleryProps {
|
|
3
4
|
children: ReactNode;
|
|
4
5
|
closeButtonTitle?: string;
|
|
6
|
+
disableBackdropClose?: GalleryProps["disableBackdropClose"];
|
|
7
|
+
prevButtonElement?: ReactElement;
|
|
8
|
+
nextButtonElement?: ReactElement;
|
|
9
|
+
closeButtonElement?: ReactElement;
|
|
5
10
|
}
|
|
6
11
|
export declare const ImageGallery: FC<ImageGalleryProps>;
|
|
@@ -48,7 +48,7 @@ const ImageGallery = (props) => {
|
|
|
48
48
|
const contextValue = { registerImage, unregisterImage, openGallery };
|
|
49
49
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
50
50
|
react_1.default.createElement(context_1.ImageGalleryProvider, { value: contextValue }, props.children),
|
|
51
|
-
typeof moduloImageIndex === "number" && (react_1.default.createElement(gallery_1.Gallery, { closeButtonTitle: props.closeButtonTitle, onClose: () => setImageIndex(null), onNext: onNext, onPrevious: onPrevious, imageIndex: moduloImageIndex, images: images }))));
|
|
51
|
+
typeof moduloImageIndex === "number" && (react_1.default.createElement(gallery_1.Gallery, { closeButtonTitle: props.closeButtonTitle, disableBackdropClose: props.disableBackdropClose, onClose: () => setImageIndex(null), onNext: onNext, onPrevious: onPrevious, imageIndex: moduloImageIndex, images: images, nextButtonElement: props.nextButtonElement, prevButtonElement: props.prevButtonElement, closeButtonElement: props.closeButtonElement }))));
|
|
52
52
|
};
|
|
53
53
|
exports.ImageGallery = ImageGallery;
|
|
54
54
|
exports.ImageGallery.displayName = "UxfUiImageGallery";
|
|
@@ -7,6 +7,7 @@ exports.Default = void 0;
|
|
|
7
7
|
const image_1 = require("@uxf/core/utils/image");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const index_1 = require("./index");
|
|
10
|
+
const icon_1 = require("../icon");
|
|
10
11
|
exports.default = {
|
|
11
12
|
title: "Lab/ImageGallery",
|
|
12
13
|
component: index_1.ImageGallery,
|
|
@@ -31,8 +32,11 @@ const images = [
|
|
|
31
32
|
title: "Obr. 5",
|
|
32
33
|
},
|
|
33
34
|
];
|
|
35
|
+
const nextButtonElement = react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__button-icon", name: "chevronRight" });
|
|
36
|
+
const prevButtonElement = react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__button-icon", name: "chevronLeft" });
|
|
37
|
+
const closeButtonElement = react_1.default.createElement(icon_1.Icon, { className: "uxf-image-gallery__button-icon", name: "xmarkLarge" });
|
|
34
38
|
function Default() {
|
|
35
|
-
return (react_1.default.createElement(index_1.ImageGallery,
|
|
39
|
+
return (react_1.default.createElement(index_1.ImageGallery, { prevButtonElement: prevButtonElement, nextButtonElement: nextButtonElement, closeButtonElement: closeButtonElement },
|
|
36
40
|
react_1.default.createElement("div", { className: "flex-direction flex gap-2" }, images.map((image, index) => (react_1.default.createElement(index_1.ImageGallery.Image, { key: (0, image_1.getImgUniqueIdentifier)(image.src) || index, src: image.src, className: "h-56 w-56 cursor-pointer object-cover transition-transform hover:scale-105", customContent: image.title }))))));
|
|
37
41
|
}
|
|
38
42
|
exports.Default = Default;
|
|
@@ -91,13 +91,14 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
91
91
|
: (_g = props.notFoundMessage) !== null && _g !== void 0 ? _g : "Nic nenalezeno";
|
|
92
92
|
const withoutPopover = !props.withPopover;
|
|
93
93
|
return (react_2.default.createElement(react_1.Combobox, { as: "div", by: "id", className: (0, cx_1.cx)(withoutPopover && "uxf-form-component", "uxf-multi-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), disabled: props.isDisabled || props.isReadOnly, multiple: true, onChange: handleComboboxValueChange, value: selectedOptions }, (renderProps) => {
|
|
94
|
+
var _a, _b;
|
|
94
95
|
const inputElement = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
95
96
|
react_2.default.createElement(react_1.Combobox.Button, { "aria-invalid": props.isInvalid, "aria-describedby": props.errorId, as: "div", className: (0, cx_1.cx)("uxf-multi-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && `${classes_1.CLASSES.IS_OPEN}--bottom`, dropdown.placement === "top" && `${classes_1.CLASSES.IS_OPEN}--top`, renderProps.open && classes_1.CLASSES.IS_OPEN), onBlur: input.onBlur, onFocus: input.onFocus, ref: stableRef },
|
|
96
97
|
selectedOptions.map((item) => (react_2.default.createElement(chip_1.Chip, { className: "uxf-multi-combobox__input-chip", color: item.color, key: item.id, onClose: handleRemove(item.id), size: "large", suppressFocus: true }, item.label))),
|
|
97
98
|
react_2.default.createElement(react_1.Combobox.Input, { autoComplete: "off", className: "uxf-multi-combobox__input", onChange: handleInputChange, onKeyDown: handleInputKeyDown, placeholder: props.placeholder, type: "text", value: query }),
|
|
98
99
|
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select-base__arrow-icon", (props.withPopover ? props.isPopoverOpen : renderProps.open) && classes_1.CLASSES.IS_OPEN), name: iconName })),
|
|
99
100
|
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
100
|
-
react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.refs.setFloating, static: true, style: dropdown.floatingStyles }, filteredData.length > 0 ? (filteredData.map((option) => {
|
|
101
|
+
react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", `uxf-dropdown--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-dropdown--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`, dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.refs.setFloating, static: true, style: dropdown.floatingStyles }, filteredData.length > 0 ? (filteredData.map((option) => {
|
|
101
102
|
var _a, _b, _c, _d;
|
|
102
103
|
const label = (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.label;
|
|
103
104
|
return (react_2.default.createElement(react_1.Combobox.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item", optionState.active && withoutPopover && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: (_d = (_c = props.keyExtractor) === null || _c === void 0 ? void 0 : _c.call(props, option)) !== null && _d !== void 0 ? _d : option.id, value: option }, (optionState) => (react_2.default.createElement(react_2.default.Fragment, null, props.withCheckboxes ? (react_2.default.createElement(checkbox_input_1.CheckboxInput, { isDisabled: optionState.disabled, isFocused: optionState.active, label: label, onChange: handleCheckboxChange(option.id), value: optionState.selected })) : (label)))));
|
|
@@ -3,6 +3,7 @@ import { ReactNode } from "react";
|
|
|
3
3
|
import { ChipColor } from "../chip";
|
|
4
4
|
import { IconsSet } from "../icon/theme";
|
|
5
5
|
import { FormControlProps } from "../types";
|
|
6
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
6
7
|
export type MultiComboboxValueId = number | string;
|
|
7
8
|
export type MultiComboboxValue<ValueId = MultiComboboxValueId> = {
|
|
8
9
|
id: ValueId;
|
|
@@ -30,6 +31,8 @@ export interface MultiComboboxProps<ValueId = MultiComboboxValueId, Option = Mul
|
|
|
30
31
|
options?: Option[];
|
|
31
32
|
placeholder?: string;
|
|
32
33
|
renderOption?: (option: Option) => ReactNode;
|
|
34
|
+
size?: keyof InputGroupSizes;
|
|
35
|
+
variant?: keyof InputGroupVariants;
|
|
33
36
|
withCheckboxes?: boolean;
|
|
34
37
|
withPopover?: boolean;
|
|
35
38
|
}
|
|
@@ -55,6 +55,7 @@ exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
55
55
|
};
|
|
56
56
|
const withoutPopover = !props.withPopover;
|
|
57
57
|
return (react_2.default.createElement(react_1.Listbox, { as: "div", className: (0, cx_1.cx)(withoutPopover && "uxf-form-component", "uxf-multi-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), disabled: props.isDisabled || props.isReadOnly, multiple: true, onChange: handleSelectValueChange, value: selectedOptions }, (renderProps) => {
|
|
58
|
+
var _a, _b;
|
|
58
59
|
const inputElement = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
59
60
|
react_2.default.createElement(react_1.Listbox.Button, { "aria-invalid": props.isInvalid, "aria-describedby": props.errorId, as: "div", className: (0, cx_1.cx)("uxf-multi-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && `${classes_1.CLASSES.IS_OPEN}--bottom`, dropdown.placement === "top" && `${classes_1.CLASSES.IS_OPEN}--top`, renderProps.open && classes_1.CLASSES.IS_OPEN), onBlur: input.onBlur, onFocus: input.onFocus, tabIndex: props.isDisabled || props.isReadOnly ? undefined : 0, ref: stableRef },
|
|
60
61
|
react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-multi-select__input", selectedOptions.length === 0 && "uxf-multi-select__input--is-empty") }, selectedOptions.length === 0
|
|
@@ -62,7 +63,7 @@ exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
62
63
|
: selectedOptions.map((item) => (react_2.default.createElement(chip_1.Chip, { className: "uxf-multi-combobox__input-chip", color: item.color, key: item.id, onClose: handleRemove(item.id), size: "large", suppressFocus: true }, item.label)))),
|
|
63
64
|
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select-base__arrow-icon", renderProps.open && classes_1.CLASSES.IS_OPEN), name: iconName })),
|
|
64
65
|
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
65
|
-
react_2.default.createElement(react_1.Listbox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.refs.setFloating, static: true, style: dropdown.floatingStyles }, filteredOptions.map((option) => {
|
|
66
|
+
react_2.default.createElement(react_1.Listbox.Options, { className: (0, cx_1.cx)("uxf-dropdown", `uxf-dropdown--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, `uxf-dropdown--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`, dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.refs.setFloating, static: true, style: dropdown.floatingStyles }, filteredOptions.map((option) => {
|
|
66
67
|
var _a;
|
|
67
68
|
const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option);
|
|
68
69
|
return (react_2.default.createElement(react_1.Listbox.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item uxf-multi-select__dropdown-item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: optionKey !== null && optionKey !== void 0 ? optionKey : option.id, value: option }, optionKey !== null && optionKey !== void 0 ? optionKey : option.label));
|
package/multi-select/types.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { Placement, Strategy } from "@floating-ui/react";
|
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import { ChipColor } from "../chip";
|
|
4
4
|
import { IconsSet } from "../icon/theme";
|
|
5
|
-
import { SelectSizes } from "../select/theme";
|
|
6
5
|
import { FormControlProps } from "../types";
|
|
6
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
7
7
|
export type MultiSelectValueId = number | string;
|
|
8
8
|
export type MultiSelectOption<T = MultiSelectValueId> = {
|
|
9
9
|
color?: ChipColor;
|
|
@@ -25,7 +25,8 @@ export interface MultiSelectProps<ValueId = MultiSelectValueId, Option = MultiSe
|
|
|
25
25
|
options: Option[];
|
|
26
26
|
placeholder?: string;
|
|
27
27
|
renderOption?: (option: Option) => ReactNode;
|
|
28
|
-
size?: keyof
|
|
28
|
+
size?: keyof InputGroupSizes;
|
|
29
|
+
variant?: keyof InputGroupVariants;
|
|
29
30
|
withPopover?: boolean;
|
|
30
31
|
}
|
|
31
32
|
export type MultiSelectTypeRef = HTMLDivElement;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "10.0.0-beta.
|
|
3
|
+
"version": "10.0.0-beta.41",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,16 +15,19 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@floating-ui/react": "0.24.2",
|
|
17
17
|
"@headlessui/react": "1.7.14",
|
|
18
|
-
"@uxf/core": "
|
|
19
|
-
"@uxf/datepicker": "
|
|
20
|
-
"@uxf/styles": "
|
|
21
|
-
"color2k": "
|
|
18
|
+
"@uxf/core": "10.0.0-beta.37",
|
|
19
|
+
"@uxf/datepicker": "10.0.0-beta.41",
|
|
20
|
+
"@uxf/styles": "10.0.0-beta.37",
|
|
21
|
+
"color2k": "2.0.2",
|
|
22
22
|
"dayjs": "^1.11.7",
|
|
23
|
-
"jump.js": "
|
|
24
|
-
"react-dropzone": "14.2.3"
|
|
23
|
+
"jump.js": "1.0.2",
|
|
24
|
+
"react-dropzone": "14.2.3",
|
|
25
|
+
"react-swipeable": "7.0.1"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@types/jump.js": "
|
|
28
|
-
"@
|
|
28
|
+
"@types/jump.js": "1.0.4",
|
|
29
|
+
"@types/react": "18.2.6",
|
|
30
|
+
"@types/react-dom": "18.2.6",
|
|
31
|
+
"@uxf/icons-generator": "10.0.0-beta.19"
|
|
29
32
|
}
|
|
30
33
|
}
|
package/radio-group/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export type { RadioGroupOption,
|
|
1
|
+
export type { RadioGroupOption, RadioGroupOptionValueId, RadioGroupProps } from "./radio-group";
|
|
2
2
|
export type { RadioGroupVariant } from "./theme";
|
|
3
3
|
export { RadioGroup } from "./radio-group";
|
|
@@ -2,13 +2,13 @@ import React, { CSSProperties, ReactNode } from "react";
|
|
|
2
2
|
import { RadioSize } from "../radio";
|
|
3
3
|
import { FormControlProps } from "../types";
|
|
4
4
|
import { RadioGroupVariant } from "./theme";
|
|
5
|
-
export type
|
|
5
|
+
export type RadioGroupOptionValueId = string | number;
|
|
6
6
|
export interface RadioGroupOption {
|
|
7
7
|
disabled?: boolean;
|
|
8
|
+
id: RadioGroupOptionValueId;
|
|
8
9
|
label: string;
|
|
9
|
-
value: RadioGroupOptionValue;
|
|
10
10
|
}
|
|
11
|
-
export interface RadioGroupProps extends FormControlProps<
|
|
11
|
+
export interface RadioGroupProps extends FormControlProps<RadioGroupOptionValueId | null> {
|
|
12
12
|
className?: string;
|
|
13
13
|
helperText?: ReactNode;
|
|
14
14
|
forceColumn?: boolean;
|
|
@@ -43,9 +43,9 @@ exports.RadioGroup = (0, react_2.forwardRef)((props, ref) => {
|
|
|
43
43
|
react_2.default.createElement("div", { className: "uxf-form-component__label" },
|
|
44
44
|
react_2.default.createElement(react_1.RadioGroup.Label, { as: label_1.Label, className: "uxf-radio-group__label", isHidden: props.hiddenLabel, ref: ref }, props.label)),
|
|
45
45
|
react_2.default.createElement("div", { className: "uxf-form-component__input" },
|
|
46
|
-
react_2.default.createElement("div", { className: "uxf-radio-group__options-wrapper" }, props.options.map((option) => (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), disabled: option.disabled, key: option.
|
|
46
|
+
react_2.default.createElement("div", { className: "uxf-radio-group__options-wrapper" }, props.options.map((option) => (react_2.default.createElement(react_1.RadioGroup.Option, { className: (0, cx_1.cx)("uxf-radio-group__option", props.isDisabled && classes_1.CLASSES.IS_DISABLED), disabled: option.disabled, key: option.id.toString(), value: option.id }, (o) => (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-radio-group__option-wrapper", o.checked && classes_1.CLASSES.IS_SELECTED) },
|
|
47
47
|
react_2.default.createElement("span", { className: "uxf-radio-group__option-label" }, option.label),
|
|
48
|
-
react_2.default.createElement(radio_1.Radio, { checked: o.checked, isDisabled: props.isDisabled || o.disabled, isInvalid: props.isInvalid, ref: o.checked ? innerRef : undefined, size: radioSize, value: option.
|
|
48
|
+
react_2.default.createElement(radio_1.Radio, { checked: o.checked, isDisabled: props.isDisabled || o.disabled, isInvalid: props.isInvalid, ref: o.checked ? innerRef : undefined, size: radioSize, value: option.id }))))))),
|
|
49
49
|
props.helperText && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: errorId }, props.helperText)))));
|
|
50
50
|
});
|
|
51
51
|
exports.RadioGroup.displayName = "UxfUiRadioGroup";
|
|
@@ -33,20 +33,20 @@ exports.default = {
|
|
|
33
33
|
};
|
|
34
34
|
const options = [
|
|
35
35
|
{
|
|
36
|
-
|
|
36
|
+
id: "1",
|
|
37
37
|
label: "Radio one",
|
|
38
38
|
},
|
|
39
39
|
{
|
|
40
|
-
|
|
40
|
+
id: "2",
|
|
41
41
|
label: "Radio two",
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
|
-
|
|
44
|
+
id: "3",
|
|
45
45
|
label: "Radio three-sixty",
|
|
46
46
|
},
|
|
47
47
|
];
|
|
48
48
|
function Default() {
|
|
49
|
-
const [value, setValue] = (0, react_1.useState)(options[0].
|
|
49
|
+
const [value, setValue] = (0, react_1.useState)(options[0].id);
|
|
50
50
|
const onChange = (0, action_1.action)("onChange", setValue);
|
|
51
51
|
const testRadioGroups = (react_1.default.createElement("div", { className: "space-y-10" },
|
|
52
52
|
react_1.default.createElement(index_1.RadioGroup, { id: "radiogroup", label: "Light Radio group", onChange: onChange, options: options, value: value }),
|
|
@@ -42,7 +42,7 @@ const RasterImage = (props) => {
|
|
|
42
42
|
: props.width && props.height
|
|
43
43
|
? Math.ceil((props.height / props.width) * w)
|
|
44
44
|
: "auto", key: `${w}-${i}`, options: props.options, quality: props.quality, src: props.src, width: w }))).reverse()) !== null && _f !== void 0 ? _f : (react_1.default.createElement(image_1.ImgSources, { height: (_g = props.height) !== null && _g !== void 0 ? _g : "auto", options: props.options, quality: props.quality, src: props.src, width: (_h = props.width) !== null && _h !== void 0 ? _h : "auto" })),
|
|
45
|
-
react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)(imgClassName), height: props.height, loading: props.loading, src: resizerSrc, width: props.width })));
|
|
45
|
+
react_1.default.createElement("img", { alt: props.alt, className: (0, cx_1.cx)(imgClassName), height: (0, image_1.getImgElementHeight)(props.src, props.width, props.height), loading: props.loading, src: resizerSrc, width: (0, image_1.getImgElementWidth)(props.src, props.width, props.height) })));
|
|
46
46
|
};
|
|
47
47
|
exports.RasterImage = RasterImage;
|
|
48
48
|
exports.RasterImage.displayName = "UxfUiRasterImage";
|
package/textarea/textarea.js
CHANGED
|
@@ -33,11 +33,11 @@ const react_1 = __importStar(require("react"));
|
|
|
33
33
|
const form_component_1 = require("../form-component");
|
|
34
34
|
function autoHeightHandler(element, rows = 4) {
|
|
35
35
|
element.style.height = "auto";
|
|
36
|
-
if (rows
|
|
36
|
+
if (rows >= 1) {
|
|
37
37
|
const contentHeight = element.scrollHeight;
|
|
38
|
-
const lineHeight =
|
|
39
|
-
const fontSize =
|
|
40
|
-
const targetHeight = rows * fontSize * (lineHeight / fontSize);
|
|
38
|
+
const lineHeight = parseFloat(window.getComputedStyle(element).getPropertyValue("line-height"));
|
|
39
|
+
const fontSize = parseFloat(window.getComputedStyle(element).getPropertyValue("font-size"));
|
|
40
|
+
const targetHeight = parseInt((rows * fontSize * (lineHeight / fontSize)).toFixed(3), 10);
|
|
41
41
|
element.style.height = Math.max(targetHeight, contentHeight) + "px";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -68,6 +68,6 @@ exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
|
68
68
|
const onWrapperClick = () => { var _a; return (_a = innerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); };
|
|
69
69
|
return (react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: errorId, form: props.form, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
70
70
|
react_1.default.createElement("div", { className: "uxf-textarea__wrapper", onClick: onWrapperClick },
|
|
71
|
-
react_1.default.createElement("textarea", { "aria-describedby": errorId, "aria-invalid": props.isInvalid, autoComplete: props.autoComplete, className: "uxf-textarea__element", disabled: props.isDisabled, form: props.form, id: id, maxLength: props.maxLength, minLength: props.minLength, name: props.name, onBlur: input.onBlur, onChange: (event) => props.onChange(event.target.value, event), onFocus: input.onFocus, placeholder: props.placeholder, readOnly: props.isReadOnly, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), required: props.isRequired, value: props.value }))));
|
|
71
|
+
react_1.default.createElement("textarea", { "aria-describedby": errorId, "aria-invalid": props.isInvalid, autoComplete: props.autoComplete, className: "uxf-textarea__element", disabled: props.isDisabled, form: props.form, id: id, maxLength: props.maxLength, minLength: props.minLength, name: props.name, onBlur: input.onBlur, onChange: (event) => props.onChange(event.target.value, event), onFocus: input.onFocus, placeholder: props.placeholder, readOnly: props.isReadOnly, rows: props.rows, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), required: props.isRequired, value: props.value }))));
|
|
72
72
|
});
|
|
73
73
|
exports.Textarea.displayName = "UxfUiTextarea";
|