@uxf/ui 11.16.0 → 11.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_select-base/_select-base.d.ts +1 -0
- package/_select-base/_select-base.js +1 -1
- package/button-list/button-list.d.ts +1 -0
- package/button-list/button-list.js +1 -1
- package/button-list/button-list.stories.js +8 -1
- package/calendar/utils/get-class-names-from-flags.d.ts +1 -1
- package/calendar/utils/get-class-names-from-flags.js +3 -6
- package/date-range-picker-input/README.md +1 -0
- package/dropzone/dropzone.stories.js +5 -6
- package/file-input/file-input.stories.js +6 -6
- package/hooks/use-dropdown.d.ts +1 -1
- package/hooks/use-dropdown.js +5 -4
- package/multi-combobox/_multi-combobox-base.js +1 -1
- package/multi-combobox/multi-combobox.stories.js +7 -1
- package/multi-combobox/types.d.ts +1 -0
- package/multi-select/_multi-select-base.js +1 -1
- package/multi-select/multi-select.stories.js +7 -1
- package/multi-select/types.d.ts +1 -0
- package/package.json +3 -3
- package/raster-image/raster-image.js +7 -17
- package/select/select.js +1 -1
- package/select/select.stories.js +1 -1
- package/tabs/tabs.d.ts +2 -0
- package/tabs/tabs.js +2 -2
- package/utils/get-dropzone-state.d.ts +7 -0
- package/utils/get-dropzone-state.js +23 -0
|
@@ -19,6 +19,7 @@ export interface SelectBaseProps<Value, Option> extends FormControlProps<Value |
|
|
|
19
19
|
customInputElementDisplayName: string;
|
|
20
20
|
dropdownClassName?: string;
|
|
21
21
|
dropdownMatchesInputWidth?: boolean;
|
|
22
|
+
dropdownMaxHeight?: number;
|
|
22
23
|
dropdownPlacement?: Placement;
|
|
23
24
|
dropdownStrategy?: Strategy;
|
|
24
25
|
emptyMessage: string;
|
|
@@ -79,7 +79,7 @@ const _SelectBase = (props) => {
|
|
|
79
79
|
const innerRef = (0, react_2.useRef)(null);
|
|
80
80
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
81
81
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
82
|
-
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", (_c = props.dropdownMatchesInputWidth) !== null && _c !== void 0 ? _c : true, props.dropdownStrategy);
|
|
82
|
+
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", (_c = props.dropdownMatchesInputWidth) !== null && _c !== void 0 ? _c : true, props.dropdownMaxHeight, props.dropdownStrategy);
|
|
83
83
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, props.forwardRef, dropdown.refs.setReference), [dropdown.refs.setReference, props.forwardRef]);
|
|
84
84
|
const HUIComponent = props.HUIComponent;
|
|
85
85
|
return (react_2.default.createElement(HUIComponent, { as: "div", by: "id", className: (0, cx_1.cx)("uxf-form-component uxf-select-base", 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), "data-name": props.name, disabled: props.isDisabled || props.isReadOnly, onChange: props.onChange, style: props.style, value: props.value }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
@@ -51,7 +51,7 @@ const ButtonList = (props) => {
|
|
|
51
51
|
const restButtons = props.buttons.slice(props.visibleButtonsCount, props.buttons.length);
|
|
52
52
|
const openButtonIcon = ((_a = props.openButton) === null || _a === void 0 ? void 0 : _a.icon) === null ? null : (_c = (_b = props.openButton) === null || _b === void 0 ? void 0 : _b.icon) !== null && _c !== void 0 ? _c : "ellipsis-vertical";
|
|
53
53
|
const openButtonLabel = (_e = (_d = props.openButton) === null || _d === void 0 ? void 0 : _d.label) !== null && _e !== void 0 ? _e : null;
|
|
54
|
-
const dropdown = (0, use_dropdown_1.useDropdown)((_f = props.menuPlacement) !== null && _f !== void 0 ? _f : "bottom-start", false, props.menuStrategy);
|
|
54
|
+
const dropdown = (0, use_dropdown_1.useDropdown)((_f = props.menuPlacement) !== null && _f !== void 0 ? _f : "bottom-start", false, props.menuMaxHeight, props.menuStrategy);
|
|
55
55
|
if ((0, is_empty_1.isEmpty)(props.buttons)) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
@@ -12,11 +12,18 @@ exports.default = {
|
|
|
12
12
|
};
|
|
13
13
|
const Default = () => {
|
|
14
14
|
const component = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
15
|
-
react_1.default.createElement(index_1.ButtonList, { visibleButtonsCount: 0, variant: "outlined", buttons: [
|
|
15
|
+
react_1.default.createElement(index_1.ButtonList, { menuMaxHeight: 350, visibleButtonsCount: 0, variant: "outlined", buttons: [
|
|
16
16
|
{ label: "First item" },
|
|
17
17
|
{ label: "Second item" },
|
|
18
18
|
{ label: "Third item" },
|
|
19
19
|
{ label: "Fourth item", disabled: true },
|
|
20
|
+
{ label: "Fifth item" },
|
|
21
|
+
{ label: "Sixth item" },
|
|
22
|
+
{ label: "Seventh item" },
|
|
23
|
+
{ label: "Eighth item" },
|
|
24
|
+
{ label: "Nineth item" },
|
|
25
|
+
{ label: "Tenth item" },
|
|
26
|
+
{ label: "Eleventh item" },
|
|
20
27
|
] }),
|
|
21
28
|
react_1.default.createElement(index_1.ButtonList, { visibleButtonsCount: 4, variant: "white", buttons: [
|
|
22
29
|
{ label: "First item" },
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Flag } from "@uxf/datepicker/utils/types";
|
|
2
|
-
export declare const getClassNamesFromFlags: (flags: Flag[]) => string
|
|
2
|
+
export declare const getClassNamesFromFlags: (flags: Flag[]) => string;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getClassNamesFromFlags = void 0;
|
|
4
|
-
const getClassNamesFromFlags = (flags) => flags
|
|
5
|
-
...acc,
|
|
6
|
-
|
|
7
|
-
...(curr.isFirst ? [`${curr.flag}--first`] : []),
|
|
8
|
-
...(curr.isLast ? [`${curr.flag}--last`] : []),
|
|
9
|
-
], []);
|
|
4
|
+
const getClassNamesFromFlags = (flags) => flags
|
|
5
|
+
.reduce((acc, curr) => [...acc, curr.flag, ...(curr.isFirst ? [`${curr.flag}--first`] : []), ...(curr.isLast ? [`${curr.flag}--last`] : [])], [])
|
|
6
|
+
.join(" ");
|
|
10
7
|
exports.getClassNamesFromFlags = getClassNamesFromFlags;
|
|
@@ -28,12 +28,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.ComponentStructure = exports.Default = void 0;
|
|
30
30
|
const component_structure_analyzer_1 = __importDefault(require("@uxf/ui/utils/component-structure-analyzer"));
|
|
31
|
-
const upload_file_mock_1 = require("@uxf/ui/utils/mocks/upload-file.mock");
|
|
32
31
|
const react_1 = __importStar(require("react"));
|
|
33
32
|
const get_provider_config_1 = require("../_private-utils/get-provider-config");
|
|
34
33
|
const context_1 = require("../context");
|
|
35
34
|
const message_1 = require("../message");
|
|
36
35
|
const action_1 = require("../utils/action");
|
|
36
|
+
const get_dropzone_state_1 = require("../utils/get-dropzone-state");
|
|
37
|
+
const upload_file_mock_1 = require("../utils/mocks/upload-file.mock");
|
|
37
38
|
const index_1 = require("./index");
|
|
38
39
|
exports.default = {
|
|
39
40
|
title: "UI/Dropzone",
|
|
@@ -42,6 +43,7 @@ exports.default = {
|
|
|
42
43
|
function Default() {
|
|
43
44
|
const [files, setFiles] = (0, react_1.useState)([]);
|
|
44
45
|
const onChange = (0, action_1.action)("onChange", setFiles);
|
|
46
|
+
const { status } = (0, get_dropzone_state_1.getDropzoneState)(files);
|
|
45
47
|
const onRemoveConfirm = () => {
|
|
46
48
|
return new Promise((resolve) => {
|
|
47
49
|
message_1.MessageService.openConfirm({
|
|
@@ -56,8 +58,8 @@ function Default() {
|
|
|
56
58
|
});
|
|
57
59
|
});
|
|
58
60
|
};
|
|
59
|
-
|
|
60
|
-
react_1.default.createElement(index_1.Dropzone, { helperText: "Disabled drag 'n' drop", label: "Use drag and drop or click to upload", noDrag: true, onChange: onChange, onUploadFile: upload_file_mock_1.uploadFile, value: files, name: "dropzone-disabled-drag-and-drop" }),
|
|
61
|
+
return (react_1.default.createElement(context_1.UiContextProvider, { value: (0, get_provider_config_1.getProviderConfig)() },
|
|
62
|
+
react_1.default.createElement(index_1.Dropzone, { isDisabled: status === "UPLOADING", helperText: "Disabled drag 'n' drop", label: "Use drag and drop or click to upload", noDrag: true, onChange: onChange, onUploadFile: upload_file_mock_1.uploadFile, value: files, name: "dropzone-disabled-drag-and-drop" }),
|
|
61
63
|
react_1.default.createElement(index_1.Dropzone, { helperText: "Disabled onClick upload", label: react_1.default.createElement("span", { className: "bg-primary-600 rounded-lg px-4 py-2 font-bold text-white" }, "JSX label"), noClick: true, onChange: onChange, onUploadFile: upload_file_mock_1.uploadFile, value: files, name: "dropzone-disabled-click" }),
|
|
62
64
|
react_1.default.createElement(index_1.Dropzone, { accept: { "image/*": [] }, label: "Only images upload", onChange: onChange, onUploadFile: upload_file_mock_1.uploadFile, value: files, name: "dropzone-only-images" }),
|
|
63
65
|
react_1.default.createElement(index_1.Dropzone, { label: "Single file upload", maxFilesCount: 1, onChange: onChange, onUploadFile: upload_file_mock_1.uploadFile, value: files, name: "dropzone-single-file" }),
|
|
@@ -65,9 +67,6 @@ function Default() {
|
|
|
65
67
|
react_1.default.createElement(index_1.Dropzone.List, { errorText: "Chyba p\u0159i nahr\u00E1v\u00E1n\u00ED souboru", onChange: onChange, onRemoveConfirm: onRemoveConfirm, value: files, name: "dropzone-error-message" }),
|
|
66
68
|
react_1.default.createElement(index_1.Dropzone.List, { onChange: onChange, onRemoveConfirm: onRemoveConfirm, renderItem: (file) => (react_1.default.createElement("li", { key: file.id },
|
|
67
69
|
react_1.default.createElement("pre", null, JSON.stringify(file, null, 4)))), value: files, name: "dropzone-list" })));
|
|
68
|
-
return (react_1.default.createElement(context_1.UiContextProvider, { value: (0, get_provider_config_1.getProviderConfig)() },
|
|
69
|
-
react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
70
|
-
react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyDropzone))));
|
|
71
70
|
}
|
|
72
71
|
exports.Default = Default;
|
|
73
72
|
function ComponentStructure() {
|
|
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Default = void 0;
|
|
27
|
-
const upload_file_mock_1 = require("@uxf/ui/utils/mocks/upload-file.mock");
|
|
28
27
|
const react_1 = __importStar(require("react"));
|
|
29
28
|
const action_1 = require("../utils/action");
|
|
29
|
+
const upload_file_mock_1 = require("../utils/mocks/upload-file.mock");
|
|
30
30
|
const index_1 = require("./index");
|
|
31
31
|
exports.default = {
|
|
32
32
|
title: "UI/FileInput",
|
|
@@ -39,11 +39,11 @@ function Default() {
|
|
|
39
39
|
// eslint-disable-next-line no-console
|
|
40
40
|
console.log("Upload error", err);
|
|
41
41
|
};
|
|
42
|
-
const storyFileInputs = (react_1.default.createElement("div", { className: "space-y-2" },
|
|
43
|
-
react_1.default.createElement(index_1.FileInput, { label: "Default file input", onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, name: "file-input" }),
|
|
44
|
-
react_1.default.createElement(index_1.FileInput, { helperText: "Error file input", id: "error-file-input", isInvalid: true, label: "Error file input", onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, isClearable: true, name: "file-input-error-message" }),
|
|
45
|
-
react_1.default.createElement(index_1.FileInput, { helperText: "Readonly/disabled file input", label: "Readonly/disabled file input", isReadOnly: true, isDisabled: true, onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, name: "file-input-read-only" })));
|
|
46
42
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
47
|
-
react_1.default.createElement("div", { className: "space-y-2 p-20" },
|
|
43
|
+
react_1.default.createElement("div", { className: "space-y-2 p-20" },
|
|
44
|
+
react_1.default.createElement("div", { className: "space-y-2" },
|
|
45
|
+
react_1.default.createElement(index_1.FileInput, { label: "Default file input", onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, name: "file-input" }),
|
|
46
|
+
react_1.default.createElement(index_1.FileInput, { helperText: "Error file input", id: "error-file-input", isInvalid: true, label: "Error file input", onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, isClearable: true, name: "file-input-error-message" }),
|
|
47
|
+
react_1.default.createElement(index_1.FileInput, { helperText: "Readonly/disabled file input", label: "Readonly/disabled file input", isReadOnly: true, isDisabled: true, onChange: onChange, onUploadError: onUploadError, onUploadFile: upload_file_mock_1.uploadFile, value: value, name: "file-input-read-only" })))));
|
|
48
48
|
}
|
|
49
49
|
exports.Default = Default;
|
package/hooks/use-dropdown.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Placement, Strategy } from "@floating-ui/react";
|
|
3
|
-
export declare function useDropdown(placement: Placement, matchWidth?: boolean, strategy?: Strategy): {
|
|
3
|
+
export declare function useDropdown(placement: Placement, matchWidth?: boolean, maxHeight?: number, strategy?: Strategy): {
|
|
4
4
|
placement: Placement;
|
|
5
5
|
strategy: Strategy;
|
|
6
6
|
middlewareData: import("@floating-ui/core").MiddlewareData;
|
package/hooks/use-dropdown.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useDropdown = void 0;
|
|
4
4
|
const react_1 = require("@floating-ui/react");
|
|
5
|
-
|
|
5
|
+
const with_unit_1 = require("@uxf/styles/units/with-unit");
|
|
6
|
+
function useDropdown(placement, matchWidth = false, maxHeight, strategy) {
|
|
6
7
|
return (0, react_1.useFloating)({
|
|
7
8
|
middleware: [
|
|
8
9
|
(0, react_1.flip)(),
|
|
@@ -10,10 +11,10 @@ function useDropdown(placement, matchWidth = false, strategy) {
|
|
|
10
11
|
(0, react_1.size)({
|
|
11
12
|
apply({ availableHeight, availableWidth, elements }) {
|
|
12
13
|
Object.assign(elements.floating.style, {
|
|
13
|
-
maxHeight: Math.min(240, availableHeight)
|
|
14
|
+
maxHeight: (0, with_unit_1.withUnit)(Math.min(maxHeight !== null && maxHeight !== void 0 ? maxHeight : 240, availableHeight), "px"),
|
|
14
15
|
maxWidth: matchWidth
|
|
15
|
-
? Math.min(availableWidth, elements.reference.getBoundingClientRect().width)
|
|
16
|
-
: availableWidth,
|
|
16
|
+
? (0, with_unit_1.withUnit)(Math.min(availableWidth, elements.reference.getBoundingClientRect().width), "px")
|
|
17
|
+
: (0, with_unit_1.withUnit)(availableWidth, "px"),
|
|
17
18
|
});
|
|
18
19
|
},
|
|
19
20
|
}),
|
|
@@ -70,7 +70,7 @@ exports._MultiComboboxBase = (0, react_3.forwardRef)((props, ref) => {
|
|
|
70
70
|
(query === "" || (0, slugify_1.slugify)(item.label).includes((0, slugify_1.slugify)(query)));
|
|
71
71
|
});
|
|
72
72
|
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "caretDown";
|
|
73
|
-
const dropdown = (0, use_dropdown_1.useDropdown)((_d = props.dropdownPlacement) !== null && _d !== void 0 ? _d : "bottom", true, props.dropdownStrategy);
|
|
73
|
+
const dropdown = (0, use_dropdown_1.useDropdown)((_d = props.dropdownPlacement) !== null && _d !== void 0 ? _d : "bottom", true, props.dropdownMaxHeight, props.dropdownStrategy);
|
|
74
74
|
const inputRef = (0, react_3.useRef)(null);
|
|
75
75
|
const input = (0, useInputFocus_1.useInputFocus)(inputRef, props.onBlur, props.onFocus);
|
|
76
76
|
const stableRef = (0, react_3.useMemo)(() => (0, composeRefs_1.composeRefs)(inputRef, ref, dropdown.refs.setReference), [ref, dropdown.refs.setReference]);
|
|
@@ -42,6 +42,12 @@ const options = [
|
|
|
42
42
|
{ id: "four", label: "Option four" },
|
|
43
43
|
{ id: "five", label: "Option five disabled" },
|
|
44
44
|
{ id: "six", label: "Option with diacritics (ěščřžýáíé)" },
|
|
45
|
+
{ id: "seven", label: "Option seven" },
|
|
46
|
+
{ id: "eight", label: "Option eight" },
|
|
47
|
+
{ id: "nine", label: "Option nine" },
|
|
48
|
+
{ id: "ten", label: "Option ten" },
|
|
49
|
+
{ id: "twelve", label: "Option twelve" },
|
|
50
|
+
{ id: "thirteen", label: "Option thirteen" },
|
|
45
51
|
];
|
|
46
52
|
function Default() {
|
|
47
53
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
@@ -51,7 +57,7 @@ function Default() {
|
|
|
51
57
|
setValue(v);
|
|
52
58
|
});
|
|
53
59
|
const storyComboboxes = (react_1.default.createElement("div", { className: "space-y-8" },
|
|
54
|
-
react_1.default.createElement(multi_combobox_1.MultiCombobox, { id: "multi-combobox-1", label: "MultiCombobox", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte pros\u00EDm jednu nebo v\u00EDce mo\u017Enost\u00ED", value: value }),
|
|
60
|
+
react_1.default.createElement(multi_combobox_1.MultiCombobox, { dropdownMaxHeight: 350, id: "multi-combobox-1", label: "MultiCombobox", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte pros\u00EDm jednu nebo v\u00EDce mo\u017Enost\u00ED", value: value }),
|
|
55
61
|
react_1.default.createElement(multi_combobox_1.MultiCombobox, { id: "multi-combobox-2", label: "MultiCombobox with checkboxes", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, withCheckboxes: true }),
|
|
56
62
|
react_1.default.createElement(multi_combobox_1.MultiCombobox, { dropdownPlacement: "top", id: "multi-combobox-3", label: "MultiCombobox with popover", name: "multi-combobox", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, withPopover: true }),
|
|
57
63
|
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 }),
|
|
@@ -16,6 +16,7 @@ export interface MultiComboboxOption<ValueId = MultiComboboxValueId> extends Mul
|
|
|
16
16
|
export interface MultiComboboxProps<ValueId = MultiComboboxValueId, Option = MultiComboboxOption<ValueId>> extends FormControlProps<Option[] | null> {
|
|
17
17
|
allOptionsSelectedMessage?: string;
|
|
18
18
|
className?: string;
|
|
19
|
+
dropdownMaxHeight?: number;
|
|
19
20
|
dropdownPlacement?: Placement;
|
|
20
21
|
dropdownStrategy?: Strategy;
|
|
21
22
|
form?: string;
|
|
@@ -39,7 +39,7 @@ exports._MultiSelectBase = (0, react_3.forwardRef)((props, ref) => {
|
|
|
39
39
|
var _a, _b, _c;
|
|
40
40
|
const innerRef = (0, react_3.useRef)(null);
|
|
41
41
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
42
|
-
const dropdown = (0, use_dropdown_1.useDropdown)((_a = props.dropdownPlacement) !== null && _a !== void 0 ? _a : "bottom", true, props.dropdownStrategy);
|
|
42
|
+
const dropdown = (0, use_dropdown_1.useDropdown)((_a = props.dropdownPlacement) !== null && _a !== void 0 ? _a : "bottom", true, props.dropdownMaxHeight, props.dropdownStrategy);
|
|
43
43
|
const stableRef = (0, react_3.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.refs.setReference), [ref, dropdown.refs.setReference]);
|
|
44
44
|
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "caretDown";
|
|
45
45
|
const selectedOptions = (_c = props.value) !== null && _c !== void 0 ? _c : [];
|
|
@@ -42,6 +42,12 @@ const options = [
|
|
|
42
42
|
{ id: "four", label: "Option four" },
|
|
43
43
|
{ id: "five", label: "Option five disabled", disabled: true },
|
|
44
44
|
{ id: "six", label: "Option with diacritics (ěščřžýáíé)" },
|
|
45
|
+
{ id: "seven", label: "Option seven" },
|
|
46
|
+
{ id: "eight", label: "Option eight" },
|
|
47
|
+
{ id: "nine", label: "Option nine" },
|
|
48
|
+
{ id: "ten", label: "Option ten" },
|
|
49
|
+
{ id: "twelve", label: "Option twelve" },
|
|
50
|
+
{ id: "thirteen", label: "Option thirteen" },
|
|
45
51
|
];
|
|
46
52
|
const Default = () => {
|
|
47
53
|
const [value, setValue] = (0, react_1.useState)(null);
|
|
@@ -51,7 +57,7 @@ const Default = () => {
|
|
|
51
57
|
setValue(v);
|
|
52
58
|
});
|
|
53
59
|
const component = (react_1.default.createElement(react_1.default.Fragment, null,
|
|
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 }),
|
|
60
|
+
react_1.default.createElement(index_1.MultiSelect, { dropdownMaxHeight: 350, 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
61
|
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
62
|
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
63
|
"Option: ",
|
package/multi-select/types.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export type MultiSelectOption<T = MultiSelectValueId> = {
|
|
|
13
13
|
};
|
|
14
14
|
export interface MultiSelectProps<ValueId = MultiSelectValueId, Option = MultiSelectOption<ValueId>> extends FormControlProps<Option[] | null> {
|
|
15
15
|
className?: string;
|
|
16
|
+
dropdownMaxHeight?: number;
|
|
16
17
|
dropdownPlacement?: Placement;
|
|
17
18
|
dropdownStrategy?: Strategy;
|
|
18
19
|
form?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.18.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@floating-ui/react": "0.26.9",
|
|
19
19
|
"@headlessui/react": "1.7.14",
|
|
20
|
-
"@uxf/core": "11.
|
|
20
|
+
"@uxf/core": "11.18.0",
|
|
21
21
|
"@uxf/datepicker": "11.11.3",
|
|
22
|
-
"@uxf/styles": "11.
|
|
22
|
+
"@uxf/styles": "11.18.0",
|
|
23
23
|
"color2k": "2.0.3",
|
|
24
24
|
"dayjs": "1.11.10",
|
|
25
25
|
"jump.js": "1.0.2",
|
|
@@ -12,37 +12,27 @@ const context_1 = require("../context");
|
|
|
12
12
|
const RasterImage = (props) => {
|
|
13
13
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
14
|
const componentContext = (0, context_1.useComponentContext)("rasterImage");
|
|
15
|
-
const className =
|
|
16
|
-
"uxf-raster-image",
|
|
17
|
-
props.mode === "contain" && "uxf-raster-image--contain",
|
|
18
|
-
props.mode === "cover" && "uxf-raster-image--cover",
|
|
19
|
-
props.className,
|
|
20
|
-
];
|
|
15
|
+
const className = (0, cx_1.cx)("uxf-raster-image", props.mode === "contain" && "uxf-raster-image--contain", props.mode === "cover" && "uxf-raster-image--cover", props.className);
|
|
21
16
|
const resizerSrc = (0, resizer_1.resizerImageUrl)(props.src, (_a = props.width) !== null && _a !== void 0 ? _a : "auto", (_b = props.height) !== null && _b !== void 0 ? _b : "auto", {
|
|
22
17
|
...((_c = props.options) !== null && _c !== void 0 ? _c : {}),
|
|
23
18
|
quality: (0, image_1.getImgQuality)(props.quality, "original"),
|
|
24
19
|
});
|
|
25
20
|
if (!resizerSrc) {
|
|
26
|
-
return react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-raster-image--no-image",
|
|
21
|
+
return react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-raster-image--no-image", className) }, props.noImageContent);
|
|
27
22
|
}
|
|
28
|
-
const imgClassName =
|
|
29
|
-
"uxf-raster-image__img",
|
|
30
|
-
props.mode === "contain" && "uxf-raster-image__img--contain",
|
|
31
|
-
props.mode === "cover" && "uxf-raster-image__img--cover",
|
|
32
|
-
props.imgClassName,
|
|
33
|
-
];
|
|
23
|
+
const imgClassName = (0, cx_1.cx)("uxf-raster-image__img", props.mode === "contain" && "uxf-raster-image__img--contain", props.mode === "cover" && "uxf-raster-image__img--cover", props.imgClassName);
|
|
34
24
|
const svgUrl = props.src && (0, image_1.getSvgImgUrl)(props.src);
|
|
35
25
|
if (svgUrl) {
|
|
36
|
-
return (react_1.default.createElement("picture", { className:
|
|
37
|
-
react_1.default.createElement("img", { alt: props.alt, className:
|
|
26
|
+
return (react_1.default.createElement("picture", { className: className },
|
|
27
|
+
react_1.default.createElement("img", { alt: props.alt, className: imgClassName, height: props.height, loading: props.loading, src: svgUrl, width: props.width })));
|
|
38
28
|
}
|
|
39
29
|
const breakpoints = ["0em", ...Object.values((_d = props.breakpoints) !== null && _d !== void 0 ? _d : componentContext.breakpoints)];
|
|
40
|
-
return (react_1.default.createElement("picture", { className:
|
|
30
|
+
return (react_1.default.createElement("picture", { className: className }, (_f = (_e = props.widths) === null || _e === void 0 ? void 0 : _e.map((w, i) => i < breakpoints.length && (react_1.default.createElement(image_1.ImgSources, { breakpointIndex: i, breakpoints: breakpoints, height: props.heights && props.heights[i]
|
|
41
31
|
? props.heights[i]
|
|
42
32
|
: props.width && props.height
|
|
43
33
|
? Math.ceil((props.height / props.width) * w)
|
|
44
34
|
: "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:
|
|
35
|
+
react_1.default.createElement("img", { alt: props.alt, className: 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
36
|
};
|
|
47
37
|
exports.RasterImage = RasterImage;
|
|
48
38
|
exports.RasterImage.displayName = "UxfUiRasterImage";
|
package/select/select.js
CHANGED
|
@@ -12,7 +12,7 @@ const Select = (props) => {
|
|
|
12
12
|
var _a, _b, _c, _d;
|
|
13
13
|
const onChange = (v) => { var _a; return props.onChange((_a = v === null || v === void 0 ? void 0 : v.id) !== null && _a !== void 0 ? _a : null); };
|
|
14
14
|
const selectedOption = (_a = props.options.find((option) => option.id === props.value)) !== null && _a !== void 0 ? _a : null;
|
|
15
|
-
return (react_2.default.createElement(_select_base_1._SelectBase, { HUIComponent: react_1.Listbox, className: `uxf-select ${(_b = props.className) !== null && _b !== void 0 ? _b : ""}`, customInputElementDisplayName: react_1.Listbox.Button.displayName, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, emptyMessage: "", forwardRef: props.forwardRef, helperText: props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: props.id, isClearable: props.isClearable, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, keyExtractor: props.keyExtractor, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: props.name, onBlur: props.onBlur, onChange: onChange, onFocus: props.onFocus, options: props.options, placeholder: props.placeholder, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, value: selectedOption, variant: props.variant },
|
|
15
|
+
return (react_2.default.createElement(_select_base_1._SelectBase, { HUIComponent: react_1.Listbox, className: `uxf-select ${(_b = props.className) !== null && _b !== void 0 ? _b : ""}`, customInputElementDisplayName: react_1.Listbox.Button.displayName, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownMaxHeight: props.dropdownMaxHeight, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, emptyMessage: "", forwardRef: props.forwardRef, helperText: props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: props.id, isClearable: props.isClearable, isDisabled: props.isDisabled, isFocused: props.isFocused, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, keyExtractor: props.keyExtractor, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, name: props.name, onBlur: props.onBlur, onChange: onChange, onFocus: props.onFocus, options: props.options, placeholder: props.placeholder, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, value: selectedOption, variant: props.variant },
|
|
16
16
|
react_2.default.createElement(react_1.Listbox.Button, { className: `uxf-input__element ${!(selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.label) && classes_1.CLASSES.IS_EMPTY}` },
|
|
17
17
|
react_2.default.createElement("span", { className: "uxf-input__element-text" }, selectedOption
|
|
18
18
|
? (_d = (_c = props.renderSelectedOption) === null || _c === void 0 ? void 0 : _c.call(props, selectedOption)) !== null && _d !== void 0 ? _d : selectedOption.label
|
package/select/select.stories.js
CHANGED
|
@@ -51,7 +51,7 @@ function Default() {
|
|
|
51
51
|
setValue(v);
|
|
52
52
|
});
|
|
53
53
|
return (react_1.default.createElement("div", { className: "flex flex-col gap-2" },
|
|
54
|
-
react_1.default.createElement(index_1.Select, { helperText: "Helper text", label: "Default select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, name: "select" }),
|
|
54
|
+
react_1.default.createElement(index_1.Select, { dropdownMaxHeight: 350, helperText: "Helper text", label: "Default select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, name: "select" }),
|
|
55
55
|
react_1.default.createElement(index_1.Select, { helperText: "Helper text", isInvalid: true, label: "Invalid select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, isClearable: true, name: "select-invalid" }),
|
|
56
56
|
react_1.default.createElement(index_1.Select, { helperText: "Helper text", isDisabled: true, label: "Disabled select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, name: "select-disabled" }),
|
|
57
57
|
react_1.default.createElement(index_1.Select, { helperText: "Helper text", isReadOnly: true, label: "Read only select", onChange: onChange, options: options, placeholder: "Vyberte...", value: value, name: "select-read-only" }),
|
package/tabs/tabs.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export interface TabsPanelProps {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
style?: CSSProperties;
|
|
6
6
|
title: ReactNode;
|
|
7
|
+
unmount?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export interface TabsProps {
|
|
9
10
|
className?: string;
|
|
@@ -11,6 +12,7 @@ export interface TabsProps {
|
|
|
11
12
|
defaultIndex?: number;
|
|
12
13
|
grow?: boolean;
|
|
13
14
|
onChange?: (index: number) => void;
|
|
15
|
+
selectedIndex?: number;
|
|
14
16
|
tabListClassName?: string;
|
|
15
17
|
variant?: "default" | "segmented";
|
|
16
18
|
}
|
package/tabs/tabs.js
CHANGED
|
@@ -57,14 +57,14 @@ const TabsRoot = (0, react_2.forwardRef)((props, ref) => {
|
|
|
57
57
|
title: c.props.title,
|
|
58
58
|
disabled: c.props.disabled,
|
|
59
59
|
}));
|
|
60
|
-
return (react_2.default.createElement(react_1.Tab.Group, { as: "div", className: tabsClassName, defaultIndex: props.defaultIndex, onChange: props.onChange, ref: ref },
|
|
60
|
+
return (react_2.default.createElement(react_1.Tab.Group, { as: "div", className: tabsClassName, defaultIndex: props.defaultIndex, onChange: props.onChange, ref: ref, selectedIndex: props.selectedIndex },
|
|
61
61
|
react_2.default.createElement(react_1.Tab.List, { className: (0, cx_1.cx)("uxf-tabs__tab-list__wrapper", `uxf-tabs__tab-list__wrapper--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`, props.tabListClassName) },
|
|
62
62
|
react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-tabs__tab-list", `uxf-tabs__tab-list--${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`), ref: containerRef, style: { justifyContent: hasOverflow ? "flex-start" : undefined, ...dragStyle } }, tabs.map((tab, index) => (react_2.default.createElement(react_1.Tab, { disabled: tab.disabled, className: ({ selected }) => {
|
|
63
63
|
var _a;
|
|
64
64
|
return (0, cx_1.cx)("uxf-tabs__tab", selected && classes_1.CLASSES.IS_ACTIVE, tab.disabled && classes_1.CLASSES.IS_DISABLED, `uxf-tabs__tab--${(_a = props.variant) !== null && _a !== void 0 ? _a : "default"}`);
|
|
65
65
|
}, key: `${tab.title}--${index}` }, tab.title)))),
|
|
66
66
|
props.customTabListContent),
|
|
67
|
-
react_2.default.createElement(react_1.Tab.Panels, { className: "uxf-tabs__panels" }, tabPanels.map((
|
|
67
|
+
react_2.default.createElement(react_1.Tab.Panels, { className: "uxf-tabs__panels" }, tabPanels.map((tabPanel, index) => (react_2.default.createElement(react_1.Tab.Panel, { className: "outline-none", key: `${tabPanel}--${index}`, unmount: tabPanel.props.unmount }, tabPanel))))));
|
|
68
68
|
});
|
|
69
69
|
TabsRoot.displayName = "UxfUiTabs";
|
|
70
70
|
exports.Tabs = Object.assign(TabsRoot, { Panel });
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDropzoneState = void 0;
|
|
4
|
+
function getDropzoneState(files) {
|
|
5
|
+
const errors = files
|
|
6
|
+
.filter((file) => file.error)
|
|
7
|
+
.map((file) => file.error)
|
|
8
|
+
.join("; ");
|
|
9
|
+
const isUploading = Boolean(files.find((file) => file.id < 0));
|
|
10
|
+
if (errors) {
|
|
11
|
+
return {
|
|
12
|
+
errorMessage: errors,
|
|
13
|
+
status: "ERROR",
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
if (isUploading) {
|
|
17
|
+
return {
|
|
18
|
+
status: "UPLOADING",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return { status: "OK" };
|
|
22
|
+
}
|
|
23
|
+
exports.getDropzoneState = getDropzoneState;
|