@uxf/ui 10.0.0-beta.8 → 10.0.0-beta.80
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 +15 -1
- package/_file-input-base/index.d.ts +1 -1
- package/_input-with-popover/input-with-popover.d.ts +4 -3
- package/_input-with-popover/input-with-popover.js +26 -26
- package/_select-base/_select-base.d.ts +2 -2
- package/_select-base/_select-base.js +4 -3
- package/_select-base/index.d.ts +1 -1
- 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/README.md +8 -0
- package/avatar/avatar.stories.js +1 -1
- package/avatar/index.d.ts +1 -1
- package/avatar-file-input/README.md +1 -0
- package/avatar-file-input/avatar-file-input.d.ts +3 -0
- package/avatar-file-input/avatar-file-input.js +12 -6
- package/avatar-file-input/avatar-file-input.stories.js +5 -5
- package/avatar-file-input/index.d.ts +1 -1
- package/avatar-file-input/theme.d.ts +5 -0
- package/avatar-file-input/theme.js +2 -0
- package/badge/README.md +1 -0
- package/badge/badge.d.ts +1 -1
- package/badge/badge.stories.js +1 -1
- package/badge/index.d.ts +1 -1
- package/button/README.md +68 -0
- package/button/button.stories.js +0 -1
- package/button/index.d.ts +1 -1
- package/button/theme.d.ts +1 -0
- package/button-group/README.md +1 -0
- package/button-group/button-group.js +1 -1
- package/button-group/button-group.stories.js +1 -1
- package/button-group/index.d.ts +1 -1
- package/button-list/README.md +1 -0
- package/button-list/button-list.d.ts +1 -1
- package/button-list/button-list.js +22 -22
- package/button-list/index.d.ts +1 -1
- package/calendar/README.md +1 -0
- package/calendar/calendar-day-cell.d.ts +4 -1
- package/calendar/calendar-day-cell.js +18 -18
- 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 +2 -2
- package/calendar/calendar.d.ts +5 -0
- package/calendar/calendar.js +6 -9
- package/calendar/calendar.stories.js +1 -1
- package/calendar/index.d.ts +4 -1
- package/calendar/index.js +5 -15
- package/checkbox/README.md +1 -0
- package/checkbox/checkbox.stories.js +1 -1
- package/checkbox/index.d.ts +1 -1
- package/checkbox-button/README.md +1 -0
- package/checkbox-button/checkbox-button.js +2 -2
- package/checkbox-button/checkbox-button.stories.js +1 -1
- package/checkbox-button/index.d.ts +1 -1
- package/checkbox-input/README.md +1 -0
- package/checkbox-input/checkbox-input.d.ts +1 -1
- package/checkbox-input/checkbox-input.stories.js +1 -1
- package/checkbox-input/index.d.ts +1 -1
- package/chip/README.md +1 -0
- package/chip/chip.d.ts +1 -1
- package/chip/chip.js +7 -5
- package/chip/chip.stories.js +37 -28
- package/chip/index.d.ts +2 -2
- package/color-radio/README.md +8 -0
- package/color-radio/color-radio.js +1 -1
- package/color-radio/index.d.ts +1 -1
- package/color-radio-group/README.md +9 -0
- package/color-radio-group/color-radio-group.js +3 -3
- package/color-radio-group/color-radio-group.stories.js +1 -1
- package/color-radio-group/index.d.ts +1 -1
- package/combobox/README.md +12 -0
- package/combobox/combobox.d.ts +1 -1
- package/combobox/combobox.stories.d.ts +2 -1
- package/combobox/combobox.stories.js +7 -3
- package/combobox/index.d.ts +1 -1
- 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/content/types.d.ts +1 -1
- package/context/provider.js +1 -1
- package/css/alert-bubble.css +100 -0
- package/css/avatar-file-input.css +54 -20
- package/css/avatar.css +4 -4
- package/css/badge.css +5 -5
- package/css/button-group.css +1 -1
- package/css/button-list.css +2 -2
- package/css/button.css +78 -32
- package/css/calendar.css +115 -51
- package/css/checkbox-button.css +10 -10
- 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 +11 -3
- package/css/dropzone.css +6 -6
- 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 +8 -8
- package/css/input-with-popover.css +1 -1
- package/css/input.css +10 -10
- 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 +12 -12
- 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 +16 -16
- package/css/text-link.css +4 -4
- package/css/textarea.css +68 -76
- package/css/time-picker.css +12 -16
- package/css/toggle.css +3 -3
- package/css/tooltip.css +2 -2
- package/date-picker/README.md +9 -0
- package/date-picker/date-picker-content.d.ts +5 -2
- package/date-picker/date-picker-content.js +4 -3
- package/date-picker/date-picker-decade.js +10 -10
- 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 +4 -1
- package/date-picker/date-picker.js +4 -2
- package/date-picker/index.d.ts +1 -1
- package/date-picker-input/README.md +11 -0
- package/date-picker-input/date-picker-input.d.ts +2 -0
- package/date-picker-input/date-picker-input.js +5 -3
- package/date-picker-input/date-picker-input.stories.js +1 -1
- package/date-picker-input/index.d.ts +1 -1
- package/date-picker-input/index.js +3 -3
- package/date-range-picker/README.md +1 -0
- package/date-range-picker/date-range-picker-content.d.ts +5 -0
- package/date-range-picker/date-range-picker-content.js +56 -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 +11 -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/README.md +1 -0
- package/date-range-picker-input/date-range-picker-input.d.ts +17 -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/README.md +13 -0
- package/datetime-picker/datetime-picker.d.ts +3 -1
- package/datetime-picker/datetime-picker.js +5 -5
- package/datetime-picker/index.d.ts +1 -1
- package/datetime-picker/index.js +2 -2
- package/datetime-picker-input/README.md +1 -0
- package/datetime-picker-input/datetime-picker-input.d.ts +2 -0
- package/datetime-picker-input/datetime-picker-input.js +5 -3
- package/datetime-picker-input/datetime-picker-input.stories.js +1 -1
- package/datetime-picker-input/index.d.ts +1 -1
- package/datetime-picker-input/index.js +2 -2
- 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/dropdown/README.md +1 -0
- package/dropdown/dropdown.stories.js +2 -2
- package/dropdown/index.d.ts +1 -1
- package/dropzone/README.md +8 -0
- package/dropzone/dropzone-input.js +10 -6
- package/dropzone/dropzone.stories.js +7 -7
- package/error-message/README.md +7 -0
- package/error-message/error-message.stories.js +1 -1
- package/file-input/README.md +11 -0
- package/file-input/file-input.d.ts +3 -0
- package/file-input/file-input.js +10 -22
- package/file-input/file-input.stories.js +5 -5
- package/file-input/index.d.ts +1 -1
- package/flash-messages/README.md +23 -0
- package/flash-messages/flash-message.d.ts +1 -1
- package/flash-messages/flash-message.js +1 -1
- package/flash-messages/flash-messages.js +52 -18
- package/flash-messages/flash-messages.stories.js +12 -0
- package/flash-messages/index.d.ts +2 -2
- package/flash-messages/index.js +4 -4
- package/form-component/README.md +7 -0
- package/form-component/index.d.ts +1 -1
- package/hooks/use-dropdown.d.ts +16 -8
- package/icon/README.md +11 -0
- package/icon/icon.stories.js +1 -1
- package/icon/index.d.ts +1 -1
- 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 +6 -5
- 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 +2 -2
- package/image-gallery/image-gallery.stories.js +5 -1
- package/image-gallery/image.d.ts +1 -1
- package/image-gallery/image.js +1 -1
- package/image-gallery/use-image.js +1 -1
- package/input/README.md +8 -0
- package/input/input-element.d.ts +1 -0
- package/input/input-element.js +1 -1
- package/input/input.d.ts +2 -2
- package/input/input.js +3 -3
- package/input/input.stories.js +3 -3
- package/label/README.md +7 -0
- package/label/index.d.ts +1 -1
- package/label/label.stories.js +1 -1
- package/layout/index.d.ts +1 -1
- package/layout/layout.js +28 -28
- package/list-item/README.md +7 -0
- package/list-item/index.d.ts +1 -1
- package/list-item/list-item.stories.js +1 -1
- package/loader/README.md +7 -0
- package/loader/index.d.ts +1 -1
- package/message/README.md +1 -0
- 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/README.md +24 -0
- package/modal/index.d.ts +3 -2
- 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/README.md +10 -0
- package/multi-combobox/_multi-combobox-base.js +28 -22
- package/multi-combobox/multi-combobox.js +1 -1
- package/multi-combobox/multi-combobox.stories.js +7 -4
- package/multi-combobox/types.d.ts +5 -1
- package/multi-select/README.md +11 -0
- package/multi-select/_multi-select-base.js +21 -21
- package/multi-select/index.d.ts +1 -1
- package/multi-select/multi-select.js +1 -1
- package/multi-select/multi-select.stories.js +6 -3
- package/multi-select/types.d.ts +1 -1
- package/package.json +17 -10
- package/pagination/README.md +31 -0
- package/pagination/index.d.ts +1 -1
- package/pagination/pagination.d.ts +1 -1
- package/pagination/pagination.js +2 -2
- package/pagination/pagination.stories.d.ts +0 -3
- package/pagination/pagination.stories.js +14 -30
- package/paper/README.md +7 -0
- package/paper/index.d.ts +1 -1
- package/paper/paper.stories.js +1 -1
- package/radio/README.md +7 -0
- package/radio/index.d.ts +1 -1
- package/radio/radio.stories.js +1 -1
- package/radio-group/README.md +8 -0
- package/radio-group/index.d.ts +2 -2
- package/radio-group/radio-group.d.ts +3 -3
- package/radio-group/radio-group.js +2 -2
- package/radio-group/radio-group.stories.js +5 -5
- package/raster-image/README.md +7 -0
- package/raster-image/index.d.ts +1 -1
- package/raster-image/raster-image.js +1 -1
- package/scripts/generate-tw-tokens.js +40 -32
- package/select/README.md +11 -0
- package/select/index.d.ts +1 -1
- package/select/select.d.ts +1 -1
- package/select/select.js +1 -1
- package/select/select.stories.d.ts +2 -1
- package/select/select.stories.js +9 -3
- package/tabs/README.md +7 -0
- package/tabs/index.d.ts +1 -1
- package/text-input/README.md +10 -0
- package/text-input/index.d.ts +1 -1
- package/text-input/text-input.d.ts +1 -0
- package/text-input/text-input.js +2 -2
- package/text-link/README.md +19 -0
- package/text-link/index.d.ts +1 -1
- package/text-link/text-link.d.ts +1 -1
- package/textarea/README.md +9 -0
- package/textarea/index.d.ts +1 -1
- package/textarea/textarea.js +5 -5
- package/textarea/textarea.stories.js +1 -1
- package/time-picker/README.md +8 -0
- package/time-picker/index.d.ts +1 -1
- package/time-picker/time-picker-hour.js +6 -6
- package/time-picker/time-picker-hours.js +2 -2
- package/time-picker/time-picker-minute.js +6 -6
- package/time-picker/time-picker-minutes.js +2 -2
- package/time-picker/time-picker.d.ts +2 -1
- package/time-picker/time-picker.js +7 -6
- package/time-picker-input/README.md +9 -0
- package/time-picker-input/index.d.ts +1 -1
- package/time-picker-input/index.js +3 -3
- package/time-picker-input/time-picker-input.js +6 -4
- package/time-picker-input/time-picker-input.stories.js +1 -1
- package/toggle/README.md +7 -0
- package/toggle/index.d.ts +1 -1
- package/toggle/toggle.js +8 -8
- package/toggle/toggle.stories.js +1 -1
- package/tooltip/README.md +7 -0
- package/tooltip/index.d.ts +2 -2
- package/tooltip/tooltip.js +27 -25
- package/tooltip/tooltip.stories.js +1 -1
- package/tooltip/use-tooltip.d.ts +19 -11
- package/tooltip/use-tooltip.js +15 -15
- package/tw-tokens/tw-colors.d.ts +283 -282
- package/tw-tokens/tw-colors.js +283 -282
- package/tw-tokens/tw-line-height.d.ts +8 -8
- package/tw-tokens/tw-line-height.js +8 -8
- package/tw-tokens/tw-spacing.d.ts +34 -34
- package/tw-tokens/tw-spacing.js +34 -34
- package/tw-tokens/tw-z-index.d.ts +7 -7
- package/tw-tokens/tw-z-index.js +7 -7
- package/types/index.d.ts +1 -1
- package/types/index.js +1 -1
- package/typography/README.md +7 -0
- package/utils/action.d.ts +2 -1
- package/utils/action.js +2 -2
- package/utils/icons-config.js +13 -3
- package/utils/mocks/{uploadFIle.mock.js → upload-file.mock.js} +1 -1
- package/utils/snap-test.js +1 -1
- package/utils/storybook-config.d.ts +12 -2
- package/utils/storybook-config.js +9 -1
- package/utils/tailwind-config.js +10 -1
- 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
- /package/utils/mocks/{uploadFIle.mock.d.ts → upload-file.mock.d.ts} +0 -0
|
@@ -0,0 +1,41 @@
|
|
|
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.MessageContent = void 0;
|
|
7
|
+
const react_1 = __importDefault(require("react"));
|
|
8
|
+
const alert_bubble_1 = require("../alert-bubble");
|
|
9
|
+
const button_1 = require("../button");
|
|
10
|
+
const BUTTON_COLOR = {
|
|
11
|
+
default: "default",
|
|
12
|
+
error: "error",
|
|
13
|
+
warning: "warning",
|
|
14
|
+
success: "success",
|
|
15
|
+
};
|
|
16
|
+
const MessageContent = (props) => {
|
|
17
|
+
var _a, _b, _c;
|
|
18
|
+
const onAcceptClick = () => {
|
|
19
|
+
var _a;
|
|
20
|
+
props.onClose();
|
|
21
|
+
(_a = props.onAccept) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
22
|
+
};
|
|
23
|
+
const onCancelClick = () => {
|
|
24
|
+
var _a;
|
|
25
|
+
props.onClose();
|
|
26
|
+
(_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
27
|
+
};
|
|
28
|
+
const isCentered = props.variant === "centered";
|
|
29
|
+
return (react_1.default.createElement("div", { className: `uxf-message__content ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}` },
|
|
30
|
+
react_1.default.createElement("div", { className: "uxf-message__content-wrapper" },
|
|
31
|
+
props.CustomIconComponent !== null ? (react_1.default.createElement("div", { className: "uxf-message__icon-wrapper" }, (_b = props.CustomIconComponent) !== null && _b !== void 0 ? _b : (react_1.default.createElement(alert_bubble_1.AlertBubble, { className: "uxf-message__alert-bubble", color: props.color, size: isCentered ? "default" : "xs" })))) : null,
|
|
32
|
+
react_1.default.createElement("div", { className: "uxf-message__text-content" },
|
|
33
|
+
react_1.default.createElement("h2", { className: "uxf-message__title" }, props.title),
|
|
34
|
+
react_1.default.createElement("p", { className: "uxf-message__description" }, props.description)),
|
|
35
|
+
props.children),
|
|
36
|
+
react_1.default.createElement("div", { className: "uxf-message__buttons-wrapper" },
|
|
37
|
+
react_1.default.createElement(button_1.Button, { className: "uxf-message__cancel-button", variant: "white", isFullWidth: isCentered, onClick: onCancelClick }, props.cancelLabel),
|
|
38
|
+
props.onAccept ? (react_1.default.createElement(button_1.Button, { className: "uxf-message__accept-button", color: BUTTON_COLOR[props.color], isFullWidth: isCentered, onClick: onAcceptClick }, (_c = props.acceptLabel) !== null && _c !== void 0 ? _c : "Ok")) : null)));
|
|
39
|
+
};
|
|
40
|
+
exports.MessageContent = MessageContent;
|
|
41
|
+
exports.MessageContent.displayName = "UxfUiConfirmContent";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { MessageProps, MessageRef } from "./message";
|
|
3
|
+
declare function getMessageRef(): import("react").RefObject<MessageRef>;
|
|
4
|
+
declare function openAlert(confirm: Omit<MessageProps, "onAccept" | "acceptLabel">): void;
|
|
5
|
+
declare function openConfirm(confirm: Omit<MessageProps, "onAccept" | "acceptLabel"> & Required<Pick<MessageProps, "onAccept" | "acceptLabel">>): void;
|
|
6
|
+
declare function close(): void;
|
|
7
|
+
export declare const MessageService: {
|
|
8
|
+
getMessageRef: typeof getMessageRef;
|
|
9
|
+
openAlert: typeof openAlert;
|
|
10
|
+
openConfirm: typeof openConfirm;
|
|
11
|
+
close: typeof close;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageService = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const messageRef = (0, react_1.createRef)();
|
|
6
|
+
function getMessageRef() {
|
|
7
|
+
return messageRef;
|
|
8
|
+
}
|
|
9
|
+
function openAlert(confirm) {
|
|
10
|
+
if (messageRef.current) {
|
|
11
|
+
messageRef.current.message(confirm);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function openConfirm(confirm) {
|
|
15
|
+
if (messageRef.current) {
|
|
16
|
+
messageRef.current.message(confirm);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function close() {
|
|
20
|
+
if (messageRef.current) {
|
|
21
|
+
messageRef.current.close();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.MessageService = {
|
|
25
|
+
getMessageRef,
|
|
26
|
+
openAlert,
|
|
27
|
+
openConfirm,
|
|
28
|
+
close,
|
|
29
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { MessageColor, MessageVariant } from "./theme";
|
|
3
|
+
export interface MessageProps {
|
|
4
|
+
CustomIconComponent?: ReactNode;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
className?: string;
|
|
7
|
+
onCancel?: () => void;
|
|
8
|
+
onAccept?: () => void;
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
acceptLabel?: string;
|
|
12
|
+
cancelLabel: string;
|
|
13
|
+
variant?: MessageVariant;
|
|
14
|
+
color: MessageColor;
|
|
15
|
+
}
|
|
16
|
+
export interface MessageRef {
|
|
17
|
+
close: () => void;
|
|
18
|
+
message: (message: MessageProps) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const Message: React.ForwardRefExoticComponent<React.RefAttributes<MessageRef>>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Message = void 0;
|
|
27
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
28
|
+
const react_1 = __importStar(require("react"));
|
|
29
|
+
const dialog_1 = require("../dialog");
|
|
30
|
+
const message_content_1 = require("./message-content");
|
|
31
|
+
exports.Message = (0, react_1.forwardRef)((props, ref) => {
|
|
32
|
+
var _a;
|
|
33
|
+
const [content, setContent] = (0, react_1.useState)();
|
|
34
|
+
const message = (0, react_1.useCallback)((newConfirm) => setContent(newConfirm), []);
|
|
35
|
+
const close = (0, react_1.useCallback)(() => setContent(null), []);
|
|
36
|
+
const innerRef = (0, react_1.useRef)({
|
|
37
|
+
close,
|
|
38
|
+
message,
|
|
39
|
+
});
|
|
40
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
41
|
+
close: innerRef.current.close,
|
|
42
|
+
message: innerRef.current.message,
|
|
43
|
+
}), []);
|
|
44
|
+
return content ? (react_1.default.createElement(dialog_1.Dialog, { className: (0, cx_1.cx)("uxf-message", `uxf-message--variant-${(_a = content.variant) !== null && _a !== void 0 ? _a : "simple"}`, `uxf-message--color-${content.color}`, content.className), disableBackdropClose: true, onClose: close, open: !!content },
|
|
45
|
+
react_1.default.createElement(message_content_1.MessageContent, { CustomIconComponent: content.CustomIconComponent, acceptLabel: content.acceptLabel, cancelLabel: content.cancelLabel, color: content.color, description: content.description, onAccept: content.onAccept, onCancel: content.onCancel, onClose: close, title: content.title, variant: content.variant }, content.children))) : null;
|
|
46
|
+
});
|
|
47
|
+
exports.Message.displayName = "UxfUiMessage";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const snap_test_1 = require("../utils/snap-test");
|
|
8
|
+
const message_stories_1 = require("./message.stories");
|
|
9
|
+
(0, snap_test_1.snapTest)("render stories", react_1.default.createElement(message_stories_1.Default, null));
|
|
@@ -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 storybook_config_1 = require("../utils/storybook-config");
|
|
10
|
+
const message_1 = require("./message");
|
|
11
|
+
const message_service_1 = require("./message-service");
|
|
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/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Modal
|
|
2
|
+
|
|
3
|
+
## CSS dependencies
|
|
4
|
+
|
|
5
|
+
```css
|
|
6
|
+
@import url("@uxf/ui/dialog/dialog.css");
|
|
7
|
+
@import url("@uxf/ui/modal/modal.css");
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Implementation
|
|
11
|
+
|
|
12
|
+
```tsx
|
|
13
|
+
import {AppProps} from "next/app";
|
|
14
|
+
import {getModalRef, Modal} from "@uxf/ui/modal";
|
|
15
|
+
|
|
16
|
+
function App(props: AppProps) {
|
|
17
|
+
return (
|
|
18
|
+
<UiContextProvider value={...}>
|
|
19
|
+
{props.children}
|
|
20
|
+
<Modal ref={getModalRef()}/>
|
|
21
|
+
</UiContextProvider>
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
```
|
package/modal/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { closeModal, getModalRef, openModal } from "./modal-service";
|
|
2
|
-
export type { ModalProps, ModalRef } from "./modal";
|
|
3
1
|
export { Modal } from "./modal";
|
|
2
|
+
export type { ModalProps, ModalRef } from "./modal";
|
|
3
|
+
export { closeModal, getModalRef, openModal } from "./modal-service";
|
|
4
|
+
export type { ModalWidth } from "./theme";
|
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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# MultiCombobox
|
|
2
|
+
|
|
3
|
+
## CSS dependencies
|
|
4
|
+
|
|
5
|
+
```css
|
|
6
|
+
@import url("@uxf/ui/multi-combobox/multi-combobox.css");
|
|
7
|
+
@import url("@uxf/ui/icon/icon.css");
|
|
8
|
+
@import url("@uxf/ui/dropdown/dropdown.css");
|
|
9
|
+
@import url("@uxf/ui/form-component/form-component.css");
|
|
10
|
+
```
|
|
@@ -24,7 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports._MultiComboboxBase = void 0;
|
|
27
|
-
const react_1 = require("@
|
|
27
|
+
const react_1 = require("@floating-ui/react");
|
|
28
|
+
const react_2 = require("@headlessui/react");
|
|
28
29
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
30
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
30
31
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
@@ -34,14 +35,14 @@ const chip_1 = require("@uxf/ui/chip");
|
|
|
34
35
|
const use_async_loading_1 = require("@uxf/ui/hooks/use-async-loading");
|
|
35
36
|
const use_dropdown_1 = require("@uxf/ui/hooks/use-dropdown");
|
|
36
37
|
const icon_1 = require("@uxf/ui/icon");
|
|
38
|
+
const input_1 = require("@uxf/ui/input");
|
|
37
39
|
const label_1 = require("@uxf/ui/label");
|
|
38
|
-
const
|
|
40
|
+
const react_3 = __importStar(require("react"));
|
|
39
41
|
const checkbox_input_1 = require("../checkbox-input");
|
|
40
|
-
|
|
41
|
-
exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
42
|
+
exports._MultiComboboxBase = (0, react_3.forwardRef)((props, ref) => {
|
|
42
43
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
44
|
const isAsync = !!props.loadOptions;
|
|
44
|
-
const [query, setQuery] = (0,
|
|
45
|
+
const [query, setQuery] = (0, react_3.useState)("");
|
|
45
46
|
const options = (0, use_async_loading_1.useAsyncLoading)(query, (_a = props.options) !== null && _a !== void 0 ? _a : [], props.loadOptions);
|
|
46
47
|
const selectedOptions = (_b = props.value) !== null && _b !== void 0 ? _b : [];
|
|
47
48
|
const filteredData = isAsync
|
|
@@ -53,9 +54,9 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
53
54
|
});
|
|
54
55
|
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "caretDown";
|
|
55
56
|
const dropdown = (0, use_dropdown_1.useDropdown)((_d = props.dropdownPlacement) !== null && _d !== void 0 ? _d : "bottom", true, props.dropdownStrategy);
|
|
56
|
-
const inputRef = (0,
|
|
57
|
+
const inputRef = (0, react_3.useRef)(null);
|
|
57
58
|
const input = (0, useInputFocus_1.useInputFocus)(inputRef, props.onBlur, props.onFocus);
|
|
58
|
-
const stableRef = (0,
|
|
59
|
+
const stableRef = (0, react_3.useMemo)(() => (0, composeRefs_1.composeRefs)(inputRef, ref, dropdown.refs.setReference), [ref, dropdown.refs.setReference]);
|
|
59
60
|
const onRemove = (valueId) => { var _a, _b; return props.onChange((_b = (_a = props.value) === null || _a === void 0 ? void 0 : _a.filter((v) => v.id !== valueId)) !== null && _b !== void 0 ? _b : []); };
|
|
60
61
|
const handleRemove = (valueId) => (e) => {
|
|
61
62
|
e.preventDefault();
|
|
@@ -90,24 +91,29 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
90
91
|
? (_f = props.allOptionsSelectedMessage) !== null && _f !== void 0 ? _f : "Všechny možnosti jsou již vybrány"
|
|
91
92
|
: (_g = props.notFoundMessage) !== null && _g !== void 0 ? _g : "Nic nenalezeno";
|
|
92
93
|
const withoutPopover = !props.withPopover;
|
|
93
|
-
return (
|
|
94
|
+
return (react_3.default.createElement(react_2.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
95
|
var _a, _b;
|
|
95
|
-
const inputElement = (
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
const inputElement = (react_3.default.createElement(react_3.default.Fragment, null,
|
|
97
|
+
react_3.default.createElement(react_2.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 },
|
|
98
|
+
props.leftAddon && react_3.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
99
|
+
props.leftElement && react_3.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
100
|
+
react_3.default.createElement("div", { className: "uxf-multi-combobox__selected-options" },
|
|
101
|
+
selectedOptions.map((item) => (react_3.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_3.default.createElement(react_2.Combobox.Input, { autoComplete: "off", className: "uxf-multi-combobox__input", onChange: handleInputChange, onKeyDown: handleInputKeyDown, placeholder: props.placeholder, type: "text", value: query })),
|
|
103
|
+
props.rightAddon && react_3.default.createElement(input_1.Input.RightAddon, null, props.rightAddon),
|
|
104
|
+
props.rightElement && react_3.default.createElement(input_1.Input.RightElement, null, props.rightElement),
|
|
105
|
+
react_3.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 })),
|
|
106
|
+
renderProps.open && (react_3.default.createElement(react_1.FloatingPortal, null,
|
|
107
|
+
react_3.default.createElement(react_2.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 (
|
|
105
|
-
})) : (
|
|
106
|
-
props.helperText && withoutPopover && (
|
|
107
|
-
return (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
return (react_3.default.createElement(react_2.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_3.default.createElement(react_3.default.Fragment, null, props.withCheckboxes ? (react_3.default.createElement(checkbox_input_1.CheckboxInput, { isDisabled: optionState.disabled, isFocused: optionState.active, label: label, onChange: handleCheckboxChange(option.id), value: optionState.selected })) : (label)))));
|
|
111
|
+
})) : (react_3.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, emptyMessage))))),
|
|
112
|
+
props.helperText && withoutPopover && (react_3.default.createElement("div", { className: (0, cx_1.cx)("uxf-helper-text", props.isInvalid && classes_1.CLASSES.IS_INVALID), id: props.errorId }, props.helperText))));
|
|
113
|
+
return (react_3.default.createElement(react_3.default.Fragment, null, withoutPopover ? (react_3.default.createElement(react_3.default.Fragment, null,
|
|
114
|
+
react_3.default.createElement("div", { className: "uxf-form-component__label" },
|
|
115
|
+
react_3.default.createElement(react_2.Combobox.Label, { as: label_1.Label, isHidden: props.hiddenLabel, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label)),
|
|
116
|
+
react_3.default.createElement("div", { className: "uxf-form-component__input" }, inputElement))) : (inputElement)));
|
|
111
117
|
}));
|
|
112
118
|
});
|
|
113
119
|
exports._MultiComboboxBase.displayName = "UxfUiMultiComboboxBase";
|
|
@@ -27,9 +27,9 @@ exports.MultiCombobox = void 0;
|
|
|
27
27
|
const react_1 = require("@headlessui/react");
|
|
28
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
|
-
const form_component_1 = require("../form-component");
|
|
31
30
|
const icon_1 = require("@uxf/ui/icon");
|
|
32
31
|
const react_2 = __importStar(require("react"));
|
|
32
|
+
const form_component_1 = require("../form-component");
|
|
33
33
|
const _multi_combobox_base_1 = require("./_multi-combobox-base");
|
|
34
34
|
exports.MultiCombobox = (0, react_2.forwardRef)((props, ref) => {
|
|
35
35
|
var _a, _b, _c;
|
|
@@ -28,19 +28,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.ComponentStructure = exports.Async = exports.Default = void 0;
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
|
+
const action_1 = require("../utils/action");
|
|
31
32
|
const component_structure_analyzer_1 = __importDefault(require("../utils/component-structure-analyzer"));
|
|
32
33
|
const multi_combobox_1 = require("./multi-combobox");
|
|
33
|
-
const action_1 = require("../utils/action");
|
|
34
34
|
exports.default = {
|
|
35
35
|
title: "UI/MultiCombobox",
|
|
36
36
|
component: multi_combobox_1.MultiCombobox,
|
|
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)));
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Placement, Strategy } from "@floating-ui/react";
|
|
2
|
+
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
2
3
|
import { ReactNode } from "react";
|
|
3
4
|
import { ChipColor } from "../chip";
|
|
4
5
|
import { IconsSet } from "../icon/theme";
|
|
5
6
|
import { FormControlProps } from "../types";
|
|
6
|
-
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
7
7
|
export type MultiComboboxValueId = number | string;
|
|
8
8
|
export type MultiComboboxValue<ValueId = MultiComboboxValueId> = {
|
|
9
9
|
id: ValueId;
|
|
@@ -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;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# MultiSelect
|
|
2
|
+
|
|
3
|
+
## CSS dependencies
|
|
4
|
+
|
|
5
|
+
```css
|
|
6
|
+
@import url("@uxf/ui/multi-combobox/multi-combobox.css");
|
|
7
|
+
@import url("@uxf/ui/multi-select/multi-select.css");
|
|
8
|
+
@import url("@uxf/ui/icon/icon.css");
|
|
9
|
+
@import url("@uxf/ui/dropdown/dropdown.css");
|
|
10
|
+
@import url("@uxf/ui/form-component/form-component.css");
|
|
11
|
+
```
|