@uxf/ui 10.0.0-beta.7 → 10.0.0-beta.74
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/alert-bubble/alert-bubble.d.ts +8 -0
- package/alert-bubble/alert-bubble.js +22 -0
- package/alert-bubble/alert-bubble.spec.d.ts +1 -0
- package/alert-bubble/alert-bubble.spec.js +9 -0
- package/alert-bubble/alert-bubble.stories.d.ts +7 -0
- package/alert-bubble/alert-bubble.stories.js +50 -0
- package/alert-bubble/index.d.ts +3 -0
- package/alert-bubble/index.js +5 -0
- package/alert-bubble/theme.d.ts +16 -0
- package/alert-bubble/theme.js +2 -0
- package/avatar-file-input/avatar-file-input.d.ts +3 -0
- package/avatar-file-input/avatar-file-input.js +10 -4
- package/avatar-file-input/avatar-file-input.stories.js +2 -2
- package/avatar-file-input/theme.d.ts +5 -0
- package/avatar-file-input/theme.js +2 -0
- package/button/theme.d.ts +1 -0
- 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.js +6 -4
- package/chip/chip.stories.js +37 -28
- package/combobox/combobox.d.ts +1 -1
- package/combobox/combobox.stories.d.ts +2 -1
- package/combobox/combobox.stories.js +6 -2
- package/config/icons-config.d.ts +1 -1
- package/config/icons-config.js +1 -1
- package/config/icons.d.ts +13 -3
- package/config/icons.js +3 -1
- package/css/alert-bubble.css +100 -0
- package/css/avatar-file-input.css +54 -20
- package/css/avatar.css +3 -3
- package/css/badge.css +5 -5
- package/css/button-group.css +1 -1
- package/css/button-list.css +2 -2
- package/css/button.css +72 -26
- package/css/calendar.css +115 -51
- package/css/checkbox-button.css +8 -8
- package/css/checkbox.css +9 -9
- package/css/chip.css +217 -318
- package/css/color-radio-group.css +1 -1
- package/css/color-radio.css +3 -3
- package/css/component-structure-analyzer.css +12 -12
- package/css/date-picker.css +10 -3
- package/css/date-range-picker.css +21 -0
- package/css/datetime-picker.css +2 -2
- package/css/dialog.css +55 -0
- package/css/dropdown.css +10 -2
- package/css/dropzone.css +7 -7
- package/css/error-message.css +1 -1
- package/css/file-input.css +2 -2
- package/css/flash-messages.css +133 -9
- package/css/icon.css +1 -1
- package/css/image-gallery.css +7 -7
- package/css/input-with-popover.css +1 -1
- package/css/input.css +8 -8
- package/css/layout.css +4 -4
- package/css/list-item.css +2 -2
- package/css/message.css +92 -0
- package/css/modal.css +10 -54
- package/css/multi-combobox.css +10 -10
- package/css/pagination.css +14 -14
- package/css/paper.css +1 -1
- package/css/radio-group.css +3 -3
- package/css/radio.css +7 -7
- package/css/raster-image.css +1 -1
- package/css/select-base.css +1 -1
- package/css/tabs.css +13 -13
- package/css/text-link.css +4 -4
- package/css/textarea.css +68 -76
- package/css/time-picker.css +12 -16
- package/css/toggle.css +1 -1
- package/css/tooltip.css +2 -2
- 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 +2 -0
- package/date-picker/date-picker.js +2 -0
- package/date-picker-input/date-picker-input.d.ts +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 +10 -0
- package/date-range-picker/date-range-picker.js +51 -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/types.js +2 -0
- package/date-range-picker-input/date-range-picker-input.d.ts +16 -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.d.ts +1 -0
- package/datetime-picker/datetime-picker.js +2 -2
- package/datetime-picker-input/datetime-picker-input.d.ts +1 -0
- package/datetime-picker-input/datetime-picker-input.js +3 -1
- package/dialog/dialog.d.ts +9 -0
- package/{modal/modal-dialog.js → dialog/dialog.js} +8 -9
- package/dialog/dialog.spec.d.ts +1 -0
- package/dialog/dialog.spec.js +9 -0
- package/dialog/dialog.stories.d.ts +7 -0
- package/dialog/dialog.stories.js +47 -0
- package/dialog/index.d.ts +2 -0
- package/dialog/index.js +5 -0
- package/dropzone/dropzone-input.js +10 -6
- package/file-input/file-input.d.ts +3 -0
- package/file-input/file-input.js +5 -5
- 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 +4 -1
- package/image-gallery/components/gallery.js +5 -4
- 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 +4 -1
- package/image-gallery/image-gallery.js +1 -1
- package/image-gallery/image-gallery.stories.js +5 -1
- package/message/index.d.ts +3 -0
- package/message/index.js +7 -0
- package/message/message-content.d.ts +17 -0
- package/message/message-content.js +41 -0
- package/message/message-service.d.ts +13 -0
- package/message/message-service.js +29 -0
- package/message/message.d.ts +20 -0
- package/message/message.js +47 -0
- package/message/message.spec.d.ts +1 -0
- package/message/message.spec.js +9 -0
- package/message/message.stories.d.ts +7 -0
- package/message/message.stories.js +82 -0
- package/message/theme.d.ts +12 -0
- package/message/theme.js +2 -0
- package/modal/index.d.ts +2 -1
- package/modal/index.js +3 -3
- package/modal/modal.d.ts +5 -4
- package/modal/modal.js +9 -9
- package/modal/modal.stories.js +12 -0
- package/modal/theme.d.ts +3 -0
- package/multi-combobox/_multi-combobox-base.js +9 -3
- package/multi-combobox/multi-combobox.stories.js +6 -3
- package/multi-combobox/types.d.ts +4 -0
- package/multi-select/_multi-select-base.js +2 -2
- package/multi-select/multi-select.stories.js +5 -2
- package/package.json +10 -8
- 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/select/select.d.ts +1 -1
- package/select/select.stories.d.ts +2 -1
- package/select/select.stories.js +8 -2
- 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/tooltip/tooltip.js +20 -18
- package/utils/icons-config.js +13 -3
- package/utils/mocks/uploadFIle.mock.js +1 -1
- package/utils/storybook-config.d.ts +11 -1
- package/utils/storybook-config.js +9 -1
- package/utils/tailwind-config.js +8 -0
- package/image-gallery/components/arrow-button.d.ts +0 -7
- package/image-gallery/components/arrow-button.js +0 -14
- package/modal/modal-dialog.d.ts +0 -11
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = void 0;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const message_1 = require("./message");
|
|
10
|
+
const message_service_1 = require("./message-service");
|
|
11
|
+
const storybook_config_1 = require("../utils/storybook-config");
|
|
12
|
+
exports.default = {
|
|
13
|
+
title: "UI/Message",
|
|
14
|
+
component: message_1.Message,
|
|
15
|
+
};
|
|
16
|
+
const getConfirmForSize = (variant, colors) => {
|
|
17
|
+
const confirmTypes = colors.map((color) => (react_1.default.createElement("div", { className: "space-y-2", key: color },
|
|
18
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: () => message_service_1.MessageService.openConfirm({
|
|
19
|
+
acceptLabel: "Potvrdit",
|
|
20
|
+
cancelLabel: "Zrušit",
|
|
21
|
+
title: "Title",
|
|
22
|
+
description: "Description",
|
|
23
|
+
/* eslint-disable no-console */
|
|
24
|
+
onAccept: () => console.log("accepted"),
|
|
25
|
+
onCancel: () => console.log("canceled"),
|
|
26
|
+
color,
|
|
27
|
+
variant,
|
|
28
|
+
}) },
|
|
29
|
+
"Click to open ",
|
|
30
|
+
variant,
|
|
31
|
+
" ",
|
|
32
|
+
color,
|
|
33
|
+
" confirm"),
|
|
34
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: () => message_service_1.MessageService.openAlert({
|
|
35
|
+
cancelLabel: "Rozumím",
|
|
36
|
+
title: "Title",
|
|
37
|
+
description: "Description",
|
|
38
|
+
/* eslint-disable no-console */
|
|
39
|
+
onCancel: () => console.log("canceled"),
|
|
40
|
+
color,
|
|
41
|
+
variant,
|
|
42
|
+
}) },
|
|
43
|
+
"Click to open ",
|
|
44
|
+
variant,
|
|
45
|
+
" ",
|
|
46
|
+
color,
|
|
47
|
+
" alert"),
|
|
48
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: () => message_service_1.MessageService.openConfirm({
|
|
49
|
+
CustomIconComponent: null,
|
|
50
|
+
acceptLabel: "Potvrdit",
|
|
51
|
+
cancelLabel: "Zrušit",
|
|
52
|
+
title: "Title",
|
|
53
|
+
description: "Description",
|
|
54
|
+
/* eslint-disable no-console */
|
|
55
|
+
onAccept: () => console.log("accepted"),
|
|
56
|
+
onCancel: () => console.log("canceled"),
|
|
57
|
+
color,
|
|
58
|
+
variant,
|
|
59
|
+
}) },
|
|
60
|
+
"Click to open ",
|
|
61
|
+
variant,
|
|
62
|
+
" ",
|
|
63
|
+
color,
|
|
64
|
+
" confirm no icon"))));
|
|
65
|
+
return (react_1.default.createElement("div", { className: "grid gap-4" },
|
|
66
|
+
react_1.default.createElement("div", { className: "flex w-full flex-col gap-2" }, confirmTypes)));
|
|
67
|
+
};
|
|
68
|
+
function Default() {
|
|
69
|
+
const config = (0, storybook_config_1.useStorybookConfig)("Button");
|
|
70
|
+
return (react_1.default.createElement("div", { className: "flex justify-center lg:flex-row" },
|
|
71
|
+
react_1.default.createElement("div", { className: "light space-y-4 rounded bg-white p-10" },
|
|
72
|
+
react_1.default.createElement("div", { className: "uxf-typo-h5" }, "default"),
|
|
73
|
+
react_1.default.createElement("div", { className: "flex flex-col space-y-4 px-5" }, getConfirmForSize("centered", config.colors)),
|
|
74
|
+
react_1.default.createElement("div", { className: "uxf-typo-h5" }, "simple"),
|
|
75
|
+
react_1.default.createElement("div", { className: "flex flex-col space-y-4 px-5" }, getConfirmForSize("simple", config.colors))),
|
|
76
|
+
react_1.default.createElement("div", { className: "dark space-y-4 rounded bg-gray-900 p-10 text-white" },
|
|
77
|
+
react_1.default.createElement("div", { className: "uxf-typo-h5" }, "default"),
|
|
78
|
+
react_1.default.createElement("div", { className: "dark flex flex-col space-y-4 px-5" }, getConfirmForSize("centered", config.colors)),
|
|
79
|
+
react_1.default.createElement("div", { className: "uxf-typo-h5" }, "simple"),
|
|
80
|
+
react_1.default.createElement("div", { className: "flex flex-col space-y-4 px-5" }, getConfirmForSize("simple", config.colors)))));
|
|
81
|
+
}
|
|
82
|
+
exports.Default = Default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface MessageColors {
|
|
2
|
+
default: true;
|
|
3
|
+
success: true;
|
|
4
|
+
error: true;
|
|
5
|
+
warning: true;
|
|
6
|
+
}
|
|
7
|
+
export type MessageColor = keyof MessageColors;
|
|
8
|
+
export interface MessageVariants {
|
|
9
|
+
simple: true;
|
|
10
|
+
centered: true;
|
|
11
|
+
}
|
|
12
|
+
export type MessageVariant = keyof MessageVariants;
|
package/message/theme.js
ADDED
package/modal/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { closeModal, getModalRef, openModal } from "./modal-service";
|
|
2
1
|
export type { ModalProps, ModalRef } from "./modal";
|
|
2
|
+
export type { ModalWidth } from "./theme";
|
|
3
3
|
export { Modal } from "./modal";
|
|
4
|
+
export { closeModal, getModalRef, openModal } from "./modal-service";
|
package/modal/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.openModal = exports.getModalRef = exports.closeModal = exports.Modal = void 0;
|
|
4
|
+
var modal_1 = require("./modal");
|
|
5
|
+
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return modal_1.Modal; } });
|
|
4
6
|
var modal_service_1 = require("./modal-service");
|
|
5
7
|
Object.defineProperty(exports, "closeModal", { enumerable: true, get: function () { return modal_service_1.closeModal; } });
|
|
6
8
|
Object.defineProperty(exports, "getModalRef", { enumerable: true, get: function () { return modal_service_1.getModalRef; } });
|
|
7
9
|
Object.defineProperty(exports, "openModal", { enumerable: true, get: function () { return modal_service_1.openModal; } });
|
|
8
|
-
var modal_1 = require("./modal");
|
|
9
|
-
Object.defineProperty(exports, "Modal", { enumerable: true, get: function () { return modal_1.Modal; } });
|
package/modal/modal.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DialogProps } from "../dialog";
|
|
3
|
+
import { ModalWidth } from "./theme";
|
|
3
4
|
export interface ModalProps {
|
|
4
5
|
children: ReactNode;
|
|
5
|
-
className?:
|
|
6
|
-
disableBackdropClose?:
|
|
6
|
+
className?: DialogProps["className"];
|
|
7
|
+
disableBackdropClose?: DialogProps["disableBackdropClose"];
|
|
7
8
|
onClose?: () => void;
|
|
8
|
-
width?:
|
|
9
|
+
width?: ModalWidth;
|
|
9
10
|
}
|
|
10
11
|
export interface ModalRef {
|
|
11
12
|
close: () => void;
|
package/modal/modal.js
CHANGED
|
@@ -25,11 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Modal = void 0;
|
|
27
27
|
const react_1 = __importStar(require("react"));
|
|
28
|
-
const
|
|
28
|
+
const dialog_1 = require("../dialog");
|
|
29
29
|
exports.Modal = (0, react_1.forwardRef)((props, ref) => {
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
30
|
+
var _a, _b;
|
|
31
|
+
const [content, setContent] = (0, react_1.useState)();
|
|
32
|
+
const open = (0, react_1.useCallback)((newModal) => setContent(newModal), []);
|
|
33
|
+
const close = (0, react_1.useCallback)(() => setContent(null), []);
|
|
33
34
|
const innerRef = (0, react_1.useRef)({
|
|
34
35
|
close,
|
|
35
36
|
open,
|
|
@@ -39,13 +40,12 @@ exports.Modal = (0, react_1.forwardRef)((props, ref) => {
|
|
|
39
40
|
open: innerRef.current.open,
|
|
40
41
|
}), []);
|
|
41
42
|
const onClose = (0, react_1.useCallback)(() => {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
43
|
+
setContent((prev) => {
|
|
44
|
+
var _a;
|
|
45
|
+
(_a = prev === null || prev === void 0 ? void 0 : prev.onClose) === null || _a === void 0 ? void 0 : _a.call(prev);
|
|
46
46
|
return null;
|
|
47
47
|
});
|
|
48
48
|
}, []);
|
|
49
|
-
return
|
|
49
|
+
return content ? (react_1.default.createElement(dialog_1.Dialog, { className: `uxf-modal uxf-modal--width-${(_a = content.width) !== null && _a !== void 0 ? _a : "default"} ${(_b = content.className) !== null && _b !== void 0 ? _b : ""}`, disableBackdropClose: content.disableBackdropClose, onClose: onClose, open: !!content }, content.children)) : null;
|
|
50
50
|
});
|
|
51
51
|
exports.Modal.displayName = "UxfUiModal";
|
package/modal/modal.stories.js
CHANGED
|
@@ -19,6 +19,12 @@ function Default() {
|
|
|
19
19
|
react_1.default.createElement("p", { className: "mb-3 text-lg font-bold" }, "Modal - default size"),
|
|
20
20
|
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: modal_service_1.closeModal }, "Close modal"))),
|
|
21
21
|
}) }, "Click to open modal - default"),
|
|
22
|
+
react_1.default.createElement(button_1.Button, { onClick: () => (0, modal_service_1.openModal)({
|
|
23
|
+
children: (react_1.default.createElement("div", { className: "p-4" },
|
|
24
|
+
react_1.default.createElement("p", { className: "mb-3 text-lg font-bold" }, "Modal - xs size"),
|
|
25
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: modal_service_1.closeModal }, "Close modal"))),
|
|
26
|
+
width: "xs",
|
|
27
|
+
}) }, "Click to open modal - xs"),
|
|
22
28
|
react_1.default.createElement(button_1.Button, { onClick: () => (0, modal_service_1.openModal)({
|
|
23
29
|
children: (react_1.default.createElement("div", { className: "p-4" },
|
|
24
30
|
react_1.default.createElement("p", { className: "mb-3 text-lg font-bold" }, "Modal - sm size"),
|
|
@@ -31,6 +37,12 @@ function Default() {
|
|
|
31
37
|
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: modal_service_1.closeModal }, "Close modal"))),
|
|
32
38
|
width: "lg",
|
|
33
39
|
}) }, "Click to open modal - lg"),
|
|
40
|
+
react_1.default.createElement(button_1.Button, { onClick: () => (0, modal_service_1.openModal)({
|
|
41
|
+
children: (react_1.default.createElement("div", { className: "p-4" },
|
|
42
|
+
react_1.default.createElement("p", { className: "mb-3 text-lg font-bold" }, "Modal - xl size"),
|
|
43
|
+
react_1.default.createElement(button_1.Button, { isFullWidth: true, onClick: modal_service_1.closeModal }, "Close modal"))),
|
|
44
|
+
width: "xl",
|
|
45
|
+
}) }, "Click to open modal - xl"),
|
|
34
46
|
react_1.default.createElement(button_1.Button, { onClick: () => (0, modal_service_1.openModal)({
|
|
35
47
|
children: (react_1.default.createElement("div", { className: "p-4" },
|
|
36
48
|
react_1.default.createElement("p", { className: "mb-3 text-lg font-bold" }, "Modal - dark"),
|
package/modal/theme.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ const label_1 = require("@uxf/ui/label");
|
|
|
38
38
|
const react_2 = __importStar(require("react"));
|
|
39
39
|
const checkbox_input_1 = require("../checkbox-input");
|
|
40
40
|
const react_3 = require("@floating-ui/react");
|
|
41
|
+
const input_1 = require("@uxf/ui/input");
|
|
41
42
|
exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
42
43
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
44
|
const isAsync = !!props.loadOptions;
|
|
@@ -94,14 +95,19 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
94
95
|
var _a, _b;
|
|
95
96
|
const inputElement = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
96
97
|
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 },
|
|
97
|
-
|
|
98
|
-
react_2.default.createElement(
|
|
98
|
+
props.leftAddon && react_2.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
99
|
+
props.leftElement && react_2.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
100
|
+
react_2.default.createElement("div", { className: "uxf-multi-combobox__selected-options" },
|
|
101
|
+
selectedOptions.map((item) => (react_2.default.createElement(chip_1.Chip, { className: "uxf-multi-combobox__input-chip", color: item.color, key: item.id, onClose: item.disabled ? undefined : handleRemove(item.id), size: "large", suppressFocus: true }, item.label))),
|
|
102
|
+
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 })),
|
|
103
|
+
props.rightAddon && react_2.default.createElement(input_1.Input.RightAddon, null, props.rightAddon),
|
|
104
|
+
props.rightElement && react_2.default.createElement(input_1.Input.RightElement, null, props.rightElement),
|
|
99
105
|
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 })),
|
|
100
106
|
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
101
107
|
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) => {
|
|
102
108
|
var _a, _b, _c, _d;
|
|
103
109
|
const label = (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.label;
|
|
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)))));
|
|
110
|
+
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), disabled: option.disabled, 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)))));
|
|
105
111
|
})) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, emptyMessage))))),
|
|
106
112
|
props.helperText && withoutPopover && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: props.errorId }, props.helperText))));
|
|
107
113
|
return (react_2.default.createElement(react_2.default.Fragment, null, withoutPopover ? (react_2.default.createElement(react_2.default.Fragment, null,
|
|
@@ -37,10 +37,10 @@ exports.default = {
|
|
|
37
37
|
};
|
|
38
38
|
const options = [
|
|
39
39
|
{ id: "one", label: "Option red", color: "red" },
|
|
40
|
-
{ id: "two", label: "Option blue", color: "blue" },
|
|
40
|
+
{ id: "two", label: "Option blue", color: "blue", disabled: true },
|
|
41
41
|
{ id: "three", label: "Option green", color: "green" },
|
|
42
42
|
{ id: "four", label: "Option four" },
|
|
43
|
-
{ id: "five", label: "Option five" },
|
|
43
|
+
{ id: "five", label: "Option five disabled" },
|
|
44
44
|
{ id: "six", label: "Option with diacritics (ěščřžýáíé)" },
|
|
45
45
|
];
|
|
46
46
|
function Default() {
|
|
@@ -57,7 +57,10 @@ function Default() {
|
|
|
57
57
|
react_1.default.createElement(multi_combobox_1.MultiCombobox, { id: "multi-combobox-4", label: "MultiCombobox with popup and checkboxes", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, withCheckboxes: true, withPopover: true }),
|
|
58
58
|
react_1.default.createElement(multi_combobox_1.MultiCombobox, { helperText: "Start typing to see options...", id: "multi-combobox-5", label: "MultiCombobox with helper text", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value }),
|
|
59
59
|
react_1.default.createElement(multi_combobox_1.MultiCombobox, { helperText: "Error message", id: "multi-combobox-6", isInvalid: true, isRequired: true, label: "MultiCombobox invalid", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value }),
|
|
60
|
-
react_1.default.createElement(multi_combobox_1.MultiCombobox, { dropdownPlacement: "top", id: "multi-combobox-7", label: "MultiCombobox with dropdown top", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value })
|
|
60
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { dropdownPlacement: "top", id: "multi-combobox-7", label: "MultiCombobox with dropdown top", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value }),
|
|
61
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { id: "multi-combobox-8", label: "MultiCombobox with renderOption", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, renderOption: (option) => react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
|
+
"Option: ",
|
|
63
|
+
option.label) })));
|
|
61
64
|
return (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
62
65
|
react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, storyComboboxes),
|
|
63
66
|
react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20 lg:w-1/2" }, storyComboboxes)));
|
|
@@ -25,12 +25,16 @@ export interface MultiComboboxProps<ValueId = MultiComboboxValueId, Option = Mul
|
|
|
25
25
|
id?: string;
|
|
26
26
|
keyExtractor?: (option: Option) => string | number;
|
|
27
27
|
label: string;
|
|
28
|
+
leftAddon?: ReactNode;
|
|
29
|
+
leftElement?: ReactNode;
|
|
28
30
|
loadOptions?: (query: string) => Promise<Option[]>;
|
|
29
31
|
noQueryMessage?: string;
|
|
30
32
|
notFoundMessage?: string;
|
|
31
33
|
options?: Option[];
|
|
32
34
|
placeholder?: string;
|
|
33
35
|
renderOption?: (option: Option) => ReactNode;
|
|
36
|
+
rightAddon?: ReactNode;
|
|
37
|
+
rightElement?: ReactNode;
|
|
34
38
|
size?: keyof InputGroupSizes;
|
|
35
39
|
variant?: keyof InputGroupVariants;
|
|
36
40
|
withCheckboxes?: boolean;
|
|
@@ -64,9 +64,9 @@ exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
64
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 })),
|
|
65
65
|
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
66
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) => {
|
|
67
|
-
var _a;
|
|
67
|
+
var _a, _b, _c;
|
|
68
68
|
const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option);
|
|
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 },
|
|
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, disabled: option.disabled }, (_c = (_b = props.renderOption) === null || _b === void 0 ? void 0 : _b.call(props, option)) !== null && _c !== void 0 ? _c : option.label));
|
|
70
70
|
})))),
|
|
71
71
|
props.helperText && withoutPopover && (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: props.errorId }, props.helperText))));
|
|
72
72
|
return (react_2.default.createElement(react_2.default.Fragment, null, withoutPopover ? (react_2.default.createElement(react_2.default.Fragment, null,
|
|
@@ -40,7 +40,7 @@ const options = [
|
|
|
40
40
|
{ id: "two", label: "Option blue", color: "blue" },
|
|
41
41
|
{ id: "three", label: "Option green", color: "green" },
|
|
42
42
|
{ id: "four", label: "Option four" },
|
|
43
|
-
{ id: "five", label: "Option five" },
|
|
43
|
+
{ id: "five", label: "Option five disabled", disabled: true },
|
|
44
44
|
{ id: "six", label: "Option with diacritics (ěščřžýáíé)" },
|
|
45
45
|
];
|
|
46
46
|
const Default = () => {
|
|
@@ -52,7 +52,10 @@ const Default = () => {
|
|
|
52
52
|
});
|
|
53
53
|
const component = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
54
54
|
react_1.default.createElement(index_1.MultiSelect, { id: "multi-select-1", label: "MultiSelect", name: "multi-select", onChange: onChange, options: options, placeholder: "Vyberte pros\u00EDm jednu nebo v\u00EDce mo\u017Enost\u00ED", value: value }),
|
|
55
|
-
react_1.default.createElement(index_1.MultiSelect, { id: "multi-select-2", label: "MultiSelect with popover", name: "multi-select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, withPopover: true })
|
|
55
|
+
react_1.default.createElement(index_1.MultiSelect, { id: "multi-select-2", label: "MultiSelect with popover", name: "multi-select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, withPopover: true }),
|
|
56
|
+
react_1.default.createElement(index_1.MultiSelect, { id: "multi-select-3", label: "MultiSelect with renderOption", name: "multi-select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, renderOption: (option) => react_1.default.createElement(react_1.default.Fragment, null,
|
|
57
|
+
"Option: ",
|
|
58
|
+
option.label) })));
|
|
56
59
|
return (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
57
60
|
react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, component),
|
|
58
61
|
react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20 lg:w-1/2" }, component)));
|
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.74",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -15,17 +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": "
|
|
23
|
+
"jump.js": "1.0.2",
|
|
24
24
|
"react-dropzone": "14.2.3",
|
|
25
25
|
"react-swipeable": "7.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@types/jump.js": "
|
|
29
|
-
"@
|
|
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"
|
|
30
32
|
}
|
|
31
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/select/select.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface SelectProps<ValueId = SelectValue, Option = SelectOption<ValueI
|
|
|
13
13
|
noQueryMessage?: string;
|
|
14
14
|
notFoundMessage?: string;
|
|
15
15
|
options: Option[];
|
|
16
|
-
renderOption?: (option: Option) => ReactNode;
|
|
16
|
+
renderOption?: (option: Option, isSelected: boolean) => ReactNode;
|
|
17
17
|
renderSelectedOption?: (option: Option) => ReactNode;
|
|
18
18
|
}
|
|
19
19
|
export declare const Select: {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { SelectOption } from "./index";
|
|
2
3
|
declare const _default: {
|
|
3
4
|
title: string;
|
|
4
5
|
component: {
|
|
5
|
-
<ValueId = import("../_select-base").SelectBaseValueId, Option =
|
|
6
|
+
<ValueId = import("../_select-base").SelectBaseValueId, Option = SelectOption<ValueId>, Value = Option>(props: import("./select").SelectProps<ValueId, Option, ValueId>): React.JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
8
9
|
};
|
package/select/select.stories.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.default = {
|
|
|
37
37
|
};
|
|
38
38
|
const options = [
|
|
39
39
|
{ id: "one", label: "Option one" },
|
|
40
|
-
{ id: "two", label: "Option two" },
|
|
40
|
+
{ id: "two", label: "Option two disabled", disabled: true },
|
|
41
41
|
{ id: "three", label: "Option three" },
|
|
42
42
|
{ id: "four", label: "Option four" },
|
|
43
43
|
{ id: "five", label: "Option five" },
|
|
@@ -64,7 +64,13 @@ function Default() {
|
|
|
64
64
|
react_1.default.createElement(index_1.Select, { helperText: "Helper text of Select with hidden label", hiddenLabel: true, label: "Hidden label", onChange: onChange, options: options, placeholder: "Vyberte...", value: value }),
|
|
65
65
|
react_1.default.createElement(index_1.Select, { label: "Size sm", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, size: "small" }),
|
|
66
66
|
react_1.default.createElement(index_1.Select, { label: "Size default", onChange: onChange, options: options, placeholder: "Vyberte...", value: value }),
|
|
67
|
-
react_1.default.createElement(index_1.Select, { label: "Size lg", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, size: "large" })
|
|
67
|
+
react_1.default.createElement(index_1.Select, { label: "Size lg", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, size: "large" }),
|
|
68
|
+
react_1.default.createElement(index_1.Select, { label: "RenderOption & RenderSelectedOption", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, renderOption: (option, isSelected) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
69
|
+
"Option: ",
|
|
70
|
+
option.label,
|
|
71
|
+
isSelected && " (selected)")), renderSelectedOption: (option) => react_1.default.createElement(react_1.default.Fragment, null,
|
|
72
|
+
"Selected: ",
|
|
73
|
+
option.label) })));
|
|
68
74
|
return (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
69
75
|
react_1.default.createElement("div", { className: "light space-y-2 p-20 lg:w-1/2" }, storySelects),
|
|
70
76
|
react_1.default.createElement("div", { className: "dark space-y-2 bg-gray-900 p-20 lg:w-1/2" }, storySelects)));
|
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";
|
|
@@ -29,11 +29,10 @@ const time_picker_context_1 = require("@uxf/datepicker/contexts/time-picker-cont
|
|
|
29
29
|
const use_hour_1 = require("@uxf/datepicker/hooks/use-hour");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
-
const button_1 = require("../button");
|
|
33
32
|
const TimePickerHour = (props) => {
|
|
34
33
|
const hourRef = (0, react_1.useRef)(null);
|
|
35
34
|
// eslint-disable-next-line react/destructuring-assignment
|
|
36
|
-
const { focusedHour, isHourFocused, isHourSelected, onHourSelect, onHourFocus } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
35
|
+
const { focusedHour, isHourFocused, isHourSelected, onHourSelect, onHourFocus, preventScroll } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
37
36
|
const { onClick, onKeyDown, tabIndex, isSelected } = (0, use_hour_1.useHour)({
|
|
38
37
|
hour: props.hour,
|
|
39
38
|
hourRef,
|
|
@@ -42,8 +41,9 @@ const TimePickerHour = (props) => {
|
|
|
42
41
|
isHourSelected,
|
|
43
42
|
onHourSelect,
|
|
44
43
|
onHourFocus,
|
|
44
|
+
preventScroll,
|
|
45
45
|
});
|
|
46
|
-
return (react_1.default.createElement(
|
|
46
|
+
return (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-calendar__cell uxf-calendar__cell-hour", isSelected && classes_1.CLASSES.IS_SELECTED), onClick: onClick, onKeyDown: onKeyDown, ref: hourRef, tabIndex: tabIndex }, props.label));
|
|
47
47
|
};
|
|
48
48
|
exports.TimePickerHour = TimePickerHour;
|
|
49
49
|
exports.TimePickerHour.displayName = "UxfUiTimePickerHour";
|
|
@@ -9,7 +9,7 @@ const time_picker_hour_1 = require("./time-picker-hour");
|
|
|
9
9
|
const use_hours_1 = require("@uxf/datepicker/hooks/use-hours");
|
|
10
10
|
const TimePickerHours = () => {
|
|
11
11
|
const { hours } = (0, use_hours_1.useHours)({});
|
|
12
|
-
return (react_1.default.createElement("div", { className: "uxf-time-picker__hours" }, hours.map((hour) => (react_1.default.createElement(time_picker_hour_1.TimePickerHour, { hour: hour.value, label: hour.label, key: hour.value })))));
|
|
12
|
+
return (react_1.default.createElement("div", { className: "uxf-time-picker__hours uxf-calendar__hours" }, hours.map((hour) => (react_1.default.createElement(time_picker_hour_1.TimePickerHour, { hour: hour.value, label: hour.label, key: hour.value })))));
|
|
13
13
|
};
|
|
14
14
|
exports.TimePickerHours = TimePickerHours;
|
|
15
15
|
exports.TimePickerHours.displayName = "UxfUiTimePickerHours";
|
|
@@ -29,11 +29,10 @@ const time_picker_context_1 = require("@uxf/datepicker/contexts/time-picker-cont
|
|
|
29
29
|
const use_minute_1 = require("@uxf/datepicker/hooks/use-minute");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
-
const button_1 = require("../button");
|
|
33
32
|
const TimePickerMinute = (props) => {
|
|
34
33
|
const minuteRef = (0, react_1.useRef)(null);
|
|
35
34
|
// eslint-disable-next-line react/destructuring-assignment
|
|
36
|
-
const { focusedMinute, isMinuteFocused, isMinuteSelected, onMinuteSelect, onMinuteFocus } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
35
|
+
const { focusedMinute, isMinuteFocused, isMinuteSelected, onMinuteSelect, onMinuteFocus, preventScroll } = (0, react_1.useContext)(time_picker_context_1.TimePickerContext);
|
|
37
36
|
const { isSelected, onClick, onKeyDown, tabIndex } = (0, use_minute_1.useMinute)({
|
|
38
37
|
minute: props.minute,
|
|
39
38
|
minuteRef,
|
|
@@ -42,8 +41,9 @@ const TimePickerMinute = (props) => {
|
|
|
42
41
|
isMinuteSelected,
|
|
43
42
|
onMinuteFocus,
|
|
44
43
|
onMinuteSelect,
|
|
44
|
+
preventScroll,
|
|
45
45
|
});
|
|
46
|
-
return (react_1.default.createElement(
|
|
46
|
+
return (react_1.default.createElement("button", { className: (0, cx_1.cx)("uxf-calendar__cell uxf-calendar__cell-minute", isSelected && classes_1.CLASSES.IS_SELECTED), onClick: onClick, onKeyDown: onKeyDown, ref: minuteRef, tabIndex: tabIndex }, props.label));
|
|
47
47
|
};
|
|
48
48
|
exports.TimePickerMinute = TimePickerMinute;
|
|
49
49
|
exports.TimePickerMinute.displayName = "UxfUiTimePickerMinute";
|
|
@@ -9,7 +9,7 @@ const time_picker_minute_1 = require("./time-picker-minute");
|
|
|
9
9
|
const use_minutes_1 = require("@uxf/datepicker/hooks/use-minutes");
|
|
10
10
|
const TimePickerMinutes = () => {
|
|
11
11
|
const { minutes } = (0, use_minutes_1.useMinutes)({});
|
|
12
|
-
return (react_1.default.createElement("div", { className: "uxf-time-picker__minutes" }, minutes.map((minute) => (react_1.default.createElement(time_picker_minute_1.TimePickerMinute, { minute: minute.value, label: minute.label, key: minute.value })))));
|
|
12
|
+
return (react_1.default.createElement("div", { className: "uxf-time-picker__minutes uxf-calendar__minutes" }, minutes.map((minute) => (react_1.default.createElement(time_picker_minute_1.TimePickerMinute, { minute: minute.value, label: minute.label, key: minute.value })))));
|
|
13
13
|
};
|
|
14
14
|
exports.TimePickerMinutes = TimePickerMinutes;
|
|
15
15
|
exports.TimePickerMinutes.displayName = "UxfUiTimePickerMinutes";
|
|
@@ -3,6 +3,7 @@ import { OnTimeChangeType, TimeType } from "@uxf/datepicker/hooks/use-time-picke
|
|
|
3
3
|
export interface TimePickerProps {
|
|
4
4
|
closePopoverHandler?: () => void;
|
|
5
5
|
onChange: (data: OnTimeChangeType) => void;
|
|
6
|
+
preventScroll?: boolean;
|
|
6
7
|
selectedTime: TimeType | null;
|
|
7
8
|
}
|
|
8
9
|
export declare const TimePicker: FC<TimePickerProps>;
|