@uxf/ui 1.0.0-beta.155 → 1.0.0-beta.157
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/_input-with-popover/input-with-popover.d.ts +1 -0
- package/_input-with-popover/input-with-popover.js +6 -7
- package/_select-base/_select-base.js +22 -20
- package/button-list/button-list.js +2 -2
- package/css/flash-messages.css +2 -2
- package/css/input-with-popover.css +4 -3
- package/css/input.css +5 -5
- package/date-picker-input/date-picker-input.d.ts +5 -2
- package/date-picker-input/date-picker-input.js +17 -3
- package/hooks/use-dropdown.d.ts +6 -9
- package/input/input-left-addon.js +1 -4
- package/input/input-left-element.js +1 -4
- package/input/input-right-addon.js +1 -4
- package/input/input-right-element.js +1 -4
- package/multi-combobox/_multi-combobox-base.js +8 -6
- package/multi-select/_multi-select-base.js +8 -6
- package/package.json +2 -2
- package/select/select.js +8 -31
- package/time-picker-input/time-picker-input.d.ts +9 -3
- package/time-picker-input/time-picker-input.js +25 -7
- package/tooltip/tooltip.js +6 -6
- package/tooltip/use-tooltip.d.ts +6 -9
|
@@ -19,5 +19,6 @@ export interface InputWithPopoverProps<ValueType = string> extends FormControlPr
|
|
|
19
19
|
placeholder?: string;
|
|
20
20
|
rightAddon?: ReactNode;
|
|
21
21
|
rightElement?: ReactNode;
|
|
22
|
+
triggerElement: ReactNode;
|
|
22
23
|
}
|
|
23
24
|
export declare const _InputWithPopover: React.ForwardRefExoticComponent<InputWithPopoverProps<string> & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -72,21 +72,20 @@ exports._InputWithPopover = (0, react_1.forwardRef)((props, ref) => {
|
|
|
72
72
|
elementResize: typeof ResizeObserver !== "undefined",
|
|
73
73
|
}),
|
|
74
74
|
});
|
|
75
|
-
const stableRef = (0, react_1.useMemo)(() => (0, composeRefs_1.composeRefs)(ref, floatingPopover.reference), [ref, floatingPopover.reference]);
|
|
76
|
-
const onChange = () => props.onChange;
|
|
77
75
|
const isInteractive = !props.isDisabled && !props.isReadOnly;
|
|
78
76
|
const showRemoveButton = !!(props.value && isInteractive && props.isClearable);
|
|
79
77
|
return (react_1.default.createElement(form_component_1.FormComponent, { className: rootClassName, errorId: error.errorId, form: props.form, helperText: props.helperText, hiddenLabel: props.hiddenLabel, inputId: id, isRequired: props.isRequired, label: props.label },
|
|
80
78
|
react_1.default.createElement(react_3.Popover, { className: "uxf-iwp__popover" },
|
|
81
|
-
react_1.default.createElement(
|
|
79
|
+
react_1.default.createElement(input_1.Input, { inputFocus: input, size: props.size, variant: props.variant, wrapperRef: floatingPopover.refs.reference },
|
|
82
80
|
props.leftAddon && react_1.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
83
81
|
props.leftElement && react_1.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
84
|
-
react_1.default.createElement(input_1.Input.Element, { "aria-describedby": error.ariaDescribedby, "aria-errormessage": error.ariaErrormessage, "aria-invalid": error.ariaInvalid, "aria-live": "polite", autoComplete: "off", form: props.form, id: id,
|
|
85
|
-
|
|
82
|
+
react_1.default.createElement(input_1.Input.Element, { "aria-describedby": error.ariaDescribedby, "aria-errormessage": error.ariaErrormessage, "aria-invalid": error.ariaInvalid, "aria-live": "polite", autoComplete: "off", form: props.form, id: id, isDisabled: props.isDisabled, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly, isRequired: props.isRequired, name: props.name, onChange: props.onChange, placeholder: props.placeholder, ref: (0, composeRefs_1.composeRefs)(innerRef, ref), type: "text", value: props.value }),
|
|
83
|
+
react_1.default.createElement(input_1.Input.RightElement, null,
|
|
86
84
|
showRemoveButton && react_1.default.createElement(input_1.Input.RemoveButton, { onChange: props.onChange }),
|
|
87
|
-
props.
|
|
85
|
+
react_1.default.createElement(react_3.Popover.Button, { className: "uxf-iwp__trigger-element" }, props.triggerElement),
|
|
86
|
+
props.rightElement),
|
|
88
87
|
props.rightAddon && react_1.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
|
|
89
88
|
isInteractive && (react_1.default.createElement(react_3.Transition, { as: react_1.Fragment, enter: "uxf-iwp__popover-panel--enter", enterFrom: "uxf-iwp__popover-panel--enter-from", enterTo: "uxf-iwp__popover-panel--enter-to", leave: "uxf-iwp__popover-panel--leave", leaveFrom: "uxf-iwp__popover-panel--leave-from", leaveTo: "uxf-iwp__popover-panel--leave-to" },
|
|
90
|
-
react_1.default.createElement(react_3.Popover.Panel, { className: "uxf-iwp__popover-panel", ref: floatingPopover.floating, static: true }, props.children))))));
|
|
89
|
+
react_1.default.createElement(react_3.Popover.Panel, { className: "uxf-iwp__popover-panel", ref: floatingPopover.refs.floating, static: true }, props.children))))));
|
|
91
90
|
});
|
|
92
91
|
exports._InputWithPopover.displayName = "UxfUiInputWithPopover";
|
|
@@ -24,6 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports._SelectBase = void 0;
|
|
27
|
+
const react_1 = require("@floating-ui/react");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
29
|
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
30
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
@@ -32,43 +33,44 @@ const use_dropdown_1 = require("@uxf/ui/hooks/use-dropdown");
|
|
|
32
33
|
const icon_1 = require("@uxf/ui/icon");
|
|
33
34
|
const input_1 = require("@uxf/ui/input");
|
|
34
35
|
const label_1 = require("@uxf/ui/label");
|
|
35
|
-
const
|
|
36
|
+
const react_2 = __importStar(require("react"));
|
|
36
37
|
const Options = (props) => {
|
|
37
38
|
const Component = props.component;
|
|
38
|
-
return (
|
|
39
|
+
return (react_2.default.createElement(Component.Options, { className: (0, cx_1.cx)("uxf-dropdown", props.placement === "bottom" && "uxf-dropdown--bottom", props.placement === "top" && "uxf-dropdown--top"), ref: props.forwardRef }, props.options && props.options.length > 0 ? (props.options.map((option) => {
|
|
39
40
|
var _a, _b, _c, _d;
|
|
40
41
|
const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option);
|
|
41
|
-
return (
|
|
42
|
-
})) : (
|
|
42
|
+
return (react_2.default.createElement(Component.Option, { className: (optionState) => (0, cx_1.cx)("uxf-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 }, (_d = (_c = (_b = props.renderOption) === null || _b === void 0 ? void 0 : _b.call(props, option)) !== null && _c !== void 0 ? _c : optionKey) !== null && _d !== void 0 ? _d : option.label));
|
|
43
|
+
})) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, props.emptyMessage))));
|
|
43
44
|
};
|
|
44
45
|
Options.displayName = "UxfUiSelectBaseOptions";
|
|
45
46
|
const _SelectBase = (props) => {
|
|
46
47
|
var _a, _b, _c;
|
|
47
|
-
const generatedId = (0,
|
|
48
|
+
const generatedId = (0, react_2.useId)();
|
|
48
49
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
49
|
-
const innerRef = (0,
|
|
50
|
+
const innerRef = (0, react_2.useRef)(null);
|
|
50
51
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
51
52
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
52
53
|
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", true);
|
|
53
|
-
const stableRef = (0,
|
|
54
|
+
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, props.forwardRef, dropdown.refs.reference), [dropdown.refs.reference, props.forwardRef]);
|
|
54
55
|
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "chevronDown";
|
|
55
56
|
const Component = props.HUIComponent;
|
|
56
|
-
return (
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
return (react_2.default.createElement(Component, { as: "div", className: (0, cx_1.cx)("uxf-form-component uxf-sb", 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, onChange: props.onChange, value: props.value }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
58
|
+
react_2.default.createElement("div", { className: "uxf-form-component__label" },
|
|
59
|
+
react_2.default.createElement(Component.Label, { as: label_1.Label, isHidden: props.hiddenLabel, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label)),
|
|
60
|
+
react_2.default.createElement("div", { className: "uxf-form-component__input" },
|
|
61
|
+
react_2.default.createElement(Component.Button, { "aria-invalid": props.isInvalid, "aria-describedby": errorId, as: input_1.Input, className: (0, cx_1.cx)("uxf-sb__button", 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), customInputElementDisplayName: props.customInputElementDisplayName, inputFocus: input, isDisabled: props.isDisabled, isFocused: renderProps.open, isInvalid: props.isInvalid, isReadOnly: props.isReadOnly,
|
|
61
62
|
// ref={composeRefs(innerRef, props.forwardRef) as any as RefObject<HTMLButtonElement>}
|
|
62
63
|
size: props.size, variant: props.variant, wrapperRef: stableRef },
|
|
63
|
-
props.leftAddon &&
|
|
64
|
-
props.leftElement &&
|
|
64
|
+
props.leftAddon && react_2.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
65
|
+
props.leftElement && react_2.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
65
66
|
props.children,
|
|
66
|
-
|
|
67
|
-
props.value && !props.isDisabled && !props.isReadOnly && props.isClearable && (
|
|
68
|
-
|
|
69
|
-
props.rightAddon &&
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
react_2.default.createElement(input_1.Input.RightElement, null,
|
|
68
|
+
props.value && !props.isDisabled && !props.isReadOnly && props.isClearable && (react_2.default.createElement(input_1.Input.RemoveButton, { onChange: props.onChange })),
|
|
69
|
+
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-sb__button-icon z-[1]", renderProps.open && classes_1.CLASSES.IS_OPEN), name: iconName })),
|
|
70
|
+
props.rightAddon && react_2.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
|
|
71
|
+
renderProps.open && (react_2.default.createElement(react_1.FloatingPortal, null,
|
|
72
|
+
react_2.default.createElement(Options, { component: Component, emptyMessage: props.emptyMessage, forwardRef: dropdown.refs.floating, keyExtractor: props.keyExtractor, options: props.options, placement: dropdown.placement, renderOption: props.renderOption }))),
|
|
73
|
+
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)))))));
|
|
72
74
|
};
|
|
73
75
|
exports._SelectBase = _SelectBase;
|
|
74
76
|
exports._SelectBase.displayName = "UxfUiSelectBase";
|
|
@@ -41,11 +41,11 @@ const ButtonList = (props) => {
|
|
|
41
41
|
restButtons.length > 0 && (react_1.default.createElement(react_2.Menu, { as: "div", className: "uxf-button-list__menu" }, ({ open }) => {
|
|
42
42
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
43
43
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
44
|
-
react_1.default.createElement(react_2.Menu.Button, { as: button_1.Button, ...props.openButton, color: (_b = (_a = props.openButton) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : props.color, size: (_d = (_c = props.openButton) === null || _c === void 0 ? void 0 : _c.size) !== null && _d !== void 0 ? _d : props.size, variant: (_f = (_e = props.openButton) === null || _e === void 0 ? void 0 : _e.variant) !== null && _f !== void 0 ? _f : props.variant, className: (0, cx_1.cx)((_g = props.openButton) === null || _g === void 0 ? void 0 : _g.className, "uxf-button-list__open-button"), isIconButton: !!openButtonIcon && !openButtonLabel, ref: dropdown.reference },
|
|
44
|
+
react_1.default.createElement(react_2.Menu.Button, { as: button_1.Button, ...props.openButton, color: (_b = (_a = props.openButton) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : props.color, size: (_d = (_c = props.openButton) === null || _c === void 0 ? void 0 : _c.size) !== null && _d !== void 0 ? _d : props.size, variant: (_f = (_e = props.openButton) === null || _e === void 0 ? void 0 : _e.variant) !== null && _f !== void 0 ? _f : props.variant, className: (0, cx_1.cx)((_g = props.openButton) === null || _g === void 0 ? void 0 : _g.className, "uxf-button-list__open-button"), isIconButton: !!openButtonIcon && !openButtonLabel, ref: dropdown.refs.reference },
|
|
45
45
|
openButtonIcon && (react_1.default.createElement(icon_1.Icon, { name: openButtonIcon, className: "uxf-button-list__open-button-icon" })),
|
|
46
46
|
openButtonLabel && (react_1.default.createElement("span", { className: "uxf-button-list__open-button-label" }, openButtonLabel))),
|
|
47
47
|
open && (react_1.default.createElement(react_3.FloatingPortal, null,
|
|
48
|
-
react_1.default.createElement(react_2.Menu.Items, { className: "uxf-button-list__menu-items", ref: dropdown.floating }, restButtons.map((button, index) => {
|
|
48
|
+
react_1.default.createElement(react_2.Menu.Items, { className: "uxf-button-list__menu-items", ref: dropdown.refs.floating }, restButtons.map((button, index) => {
|
|
49
49
|
var _a, _b, _c;
|
|
50
50
|
return (react_1.default.createElement(react_2.Menu.Item, { key: index },
|
|
51
51
|
react_1.default.createElement(MenuButton, { ...button, color: (_a = button.color) !== null && _a !== void 0 ? _a : props.color, size: (_b = button.size) !== null && _b !== void 0 ? _b : props.size, variant: (_c = button.variant) !== null && _c !== void 0 ? _c : props.variant })));
|
package/css/flash-messages.css
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
.uxf-flash-messages {
|
|
2
|
-
@apply pointer-events-none fixed inset-0 z-
|
|
2
|
+
@apply pointer-events-none fixed inset-0 z-flashMessage flex items-end p-6;
|
|
3
3
|
|
|
4
4
|
&__list-wrapper {
|
|
5
|
-
@apply flex w-full max-w-sm flex-col items-center space-y-4 sm:items-end;
|
|
5
|
+
@apply flex w-full max-w-sm flex-col items-center space-y-4 sm:items-end ml-auto;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
.uxf-iwp {
|
|
2
|
-
-webkit-user-select: none;
|
|
3
|
-
user-select: none;
|
|
4
|
-
|
|
5
2
|
&__popover {
|
|
6
3
|
@apply relative;
|
|
7
4
|
}
|
|
@@ -41,4 +38,8 @@
|
|
|
41
38
|
@apply origin-top scale-0 opacity-0;
|
|
42
39
|
}
|
|
43
40
|
}
|
|
41
|
+
|
|
42
|
+
&__trigger-element {
|
|
43
|
+
@apply inline-flex items-center justify-center w-5 h-5 rounded-sm;
|
|
44
|
+
}
|
|
44
45
|
}
|
package/css/input.css
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
&__right-element {
|
|
33
|
-
@apply ml-2;
|
|
33
|
+
@apply ml-2 space-x-2;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
&__left-addon,
|
|
@@ -71,10 +71,10 @@
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
&__remove-button {
|
|
74
|
-
@apply inline-flex items-center justify-center w-
|
|
74
|
+
@apply inline-flex items-center justify-center w-5 h-5 rounded-sm;
|
|
75
75
|
|
|
76
76
|
&-inner {
|
|
77
|
-
@apply flex items-center justify-center w-4 h-4 rounded-
|
|
77
|
+
@apply flex items-center justify-center w-4 h-4 rounded-full;
|
|
78
78
|
|
|
79
79
|
:root .light & {
|
|
80
80
|
@apply bg-gray-300;
|
|
@@ -211,11 +211,11 @@
|
|
|
211
211
|
|
|
212
212
|
.uxf-input__element {
|
|
213
213
|
:root .light & {
|
|
214
|
-
@apply border-gray-200 text-error;
|
|
214
|
+
@apply border-gray-200 text-error placeholder-error-300;
|
|
215
215
|
}
|
|
216
216
|
|
|
217
217
|
:root .dark & {
|
|
218
|
-
@apply border-gray-700 text-error;
|
|
218
|
+
@apply border-gray-700 text-error placeholder-error-700;
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
2
|
import { InputWithPopoverProps } from "../_input-with-popover";
|
|
3
|
-
export
|
|
3
|
+
export declare const ALLOWED_DATE_FORMAT: string[];
|
|
4
|
+
export declare const DISPLAY_DATE_FORMAT = "D. M. YYYY";
|
|
5
|
+
export interface DatePickerInputProps extends Omit<InputWithPopoverProps<string | null>, "children" | "placeholder" | "triggerElement"> {
|
|
4
6
|
placeholder?: string;
|
|
7
|
+
triggerElement?: ReactNode;
|
|
5
8
|
}
|
|
6
9
|
export declare const DatePickerInput: React.ForwardRefExoticComponent<DatePickerInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -26,10 +26,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.DatePickerInput = void 0;
|
|
30
|
-
const dayjs_1 =
|
|
29
|
+
exports.DatePickerInput = exports.DISPLAY_DATE_FORMAT = exports.ALLOWED_DATE_FORMAT = void 0;
|
|
30
|
+
const dayjs_1 = __importStar(require("dayjs"));
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
32
32
|
const date_picker_provider_1 = require("./date-picker-provider");
|
|
33
33
|
const _input_with_popover_1 = require("../_input-with-popover");
|
|
34
|
-
|
|
34
|
+
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
35
|
+
const icon_1 = require("../icon");
|
|
36
|
+
(0, dayjs_1.extend)(customParseFormat_1.default);
|
|
37
|
+
exports.ALLOWED_DATE_FORMAT = ["D. M. YYYY", "DD. MM. YYYY", "D.M.YYYY", "DD.MM.YYYY"];
|
|
38
|
+
exports.DISPLAY_DATE_FORMAT = "D. M. YYYY";
|
|
39
|
+
exports.DatePickerInput = (0, react_1.forwardRef)((props, ref) => {
|
|
40
|
+
var _a, _b;
|
|
41
|
+
const onChange = props.onChange;
|
|
42
|
+
const onDatePickerChange = (0, react_1.useCallback)((value) => {
|
|
43
|
+
onChange((0, dayjs_1.default)(value).format("l"));
|
|
44
|
+
}, [onChange]);
|
|
45
|
+
const parsedDate = (0, dayjs_1.default)(props.value, exports.ALLOWED_DATE_FORMAT, true);
|
|
46
|
+
const selectedDate = props.value && parsedDate.isValid() ? parsedDate.toDate() : null;
|
|
47
|
+
return (react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, placeholder: props.placeholder || "Vyberte datum...", ref: ref, value: (_a = props.value) !== null && _a !== void 0 ? _a : "", triggerElement: (_b = props.triggerElement) !== null && _b !== void 0 ? _b : react_1.default.createElement(icon_1.Icon, { name: "calendar", size: 20 }) }, ({ close }) => (react_1.default.createElement(date_picker_provider_1.DatePickerProvider, { closePopoverHandler: close, onChange: onDatePickerChange, selectedDate: selectedDate }))));
|
|
48
|
+
});
|
|
35
49
|
exports.DatePickerInput.displayName = "UxfUiDatePickerInput";
|
package/hooks/use-dropdown.d.ts
CHANGED
|
@@ -4,22 +4,18 @@ export declare function useDropdown(placement: Placement, matchWidth?: boolean):
|
|
|
4
4
|
placement: Placement;
|
|
5
5
|
strategy: import("@floating-ui/react").Strategy;
|
|
6
6
|
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
7
|
-
x: number
|
|
8
|
-
y: number
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
9
|
update: () => void;
|
|
10
|
-
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
11
|
-
floating: (node: HTMLElement | null) => void;
|
|
12
|
-
positionReference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
13
10
|
context: {
|
|
14
|
-
x: number
|
|
15
|
-
y: number
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
16
13
|
placement: Placement;
|
|
17
14
|
strategy: import("@floating-ui/react").Strategy;
|
|
18
15
|
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
19
16
|
update: () => void;
|
|
20
|
-
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
21
|
-
floating: (node: HTMLElement | null) => void;
|
|
22
17
|
isPositioned: boolean;
|
|
18
|
+
floatingStyles: import("react").CSSProperties;
|
|
23
19
|
open: boolean;
|
|
24
20
|
onOpenChange: (open: boolean) => void;
|
|
25
21
|
events: import("@floating-ui/react").FloatingEvents;
|
|
@@ -32,4 +28,5 @@ export declare function useDropdown(placement: Placement, matchWidth?: boolean):
|
|
|
32
28
|
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
33
29
|
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
34
30
|
isPositioned: boolean;
|
|
31
|
+
floatingStyles: import("react").CSSProperties;
|
|
35
32
|
};
|
|
@@ -8,10 +8,7 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const InputLeftAddon = (props) => {
|
|
10
10
|
const isText = typeof props.children === "string";
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
14
|
-
react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-input__left-addon", isText && "uxf-input__left-addon--text"), onClick: onClick }, props.children));
|
|
11
|
+
return react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-input__left-addon", isText && "uxf-input__left-addon--text") }, props.children);
|
|
15
12
|
};
|
|
16
13
|
exports.InputLeftAddon = InputLeftAddon;
|
|
17
14
|
exports.InputLeftAddon.displayName = "UxfUiInputLeftAddon";
|
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.InputLeftElement = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const InputLeftElement = (props) => {
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
12
|
-
react_1.default.createElement("div", { className: "uxf-input__left-element", onClick: onClick }, props.children));
|
|
9
|
+
return react_1.default.createElement("div", { className: "uxf-input__left-element" }, props.children);
|
|
13
10
|
};
|
|
14
11
|
exports.InputLeftElement = InputLeftElement;
|
|
15
12
|
exports.InputLeftElement.displayName = "UxfUiInputLeftElement";
|
|
@@ -8,10 +8,7 @@ const cx_1 = require("@uxf/core/utils/cx");
|
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
9
|
const InputRightAddon = (props) => {
|
|
10
10
|
const isText = typeof props.children === "string";
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
14
|
-
react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-input__right-addon", isText && "uxf-input__right-addon--text"), onClick: onClick }, props.children));
|
|
11
|
+
return (react_1.default.createElement("div", { className: (0, cx_1.cx)("uxf-input__right-addon", isText && "uxf-input__right-addon--text") }, props.children));
|
|
15
12
|
};
|
|
16
13
|
exports.InputRightAddon = InputRightAddon;
|
|
17
14
|
exports.InputRightAddon.displayName = "UxfUiInputRightAddon";
|
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.InputRightElement = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const InputRightElement = (props) => {
|
|
9
|
-
|
|
10
|
-
return (
|
|
11
|
-
// eslint-disable-next-line jsx-a11y/click-events-have-key-events,jsx-a11y/no-static-element-interactions
|
|
12
|
-
react_1.default.createElement("div", { className: "uxf-input__right-element", onClick: onClick }, props.children));
|
|
9
|
+
return react_1.default.createElement("div", { className: "uxf-input__right-element" }, props.children);
|
|
13
10
|
};
|
|
14
11
|
exports.InputRightElement = InputRightElement;
|
|
15
12
|
exports.InputRightElement.displayName = "UxfUiInputRightElement";
|
|
@@ -37,6 +37,7 @@ const icon_1 = require("@uxf/ui/icon");
|
|
|
37
37
|
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
|
+
const react_3 = require("@floating-ui/react");
|
|
40
41
|
exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
41
42
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
42
43
|
const isAsync = !!props.loadOptions;
|
|
@@ -54,7 +55,7 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
54
55
|
const dropdown = (0, use_dropdown_1.useDropdown)((_d = props.dropdownPlacement) !== null && _d !== void 0 ? _d : "bottom", true);
|
|
55
56
|
const inputRef = (0, react_2.useRef)(null);
|
|
56
57
|
const input = (0, useInputFocus_1.useInputFocus)(inputRef, props.onBlur, props.onFocus);
|
|
57
|
-
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(inputRef, ref, dropdown.reference), [ref, dropdown.reference]);
|
|
58
|
+
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(inputRef, ref, dropdown.refs.reference), [ref, dropdown.refs.reference]);
|
|
58
59
|
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 : []); };
|
|
59
60
|
const handleRemove = (valueId) => (e) => {
|
|
60
61
|
e.preventDefault();
|
|
@@ -95,11 +96,12 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
95
96
|
selectedOptions.map((item) => (react_2.default.createElement(chip_1.Chip, { className: "uxf-multi-combobox__input-chip", color: item.color, key: item.id, onClose: handleRemove(item.id), size: "large", suppressFocus: true }, item.label))),
|
|
96
97
|
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 }),
|
|
97
98
|
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select__button-icon", (props.withPopover ? props.isPopoverOpen : renderProps.open) && "is-open"), name: iconName })),
|
|
98
|
-
react_2.default.createElement(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
99
|
+
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
100
|
+
react_2.default.createElement(react_1.Combobox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), static: props.withPopover, ref: dropdown.refs.floating }, filteredData.length > 0 ? (filteredData.map((option) => {
|
|
101
|
+
var _a, _b, _c, _d;
|
|
102
|
+
const label = (_b = (_a = props.renderOption) === null || _a === void 0 ? void 0 : _a.call(props, option)) !== null && _b !== void 0 ? _b : option.label;
|
|
103
|
+
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)))));
|
|
104
|
+
})) : (react_2.default.createElement("div", { className: "uxf-dropdown__empty-wrapper" }, emptyMessage))))),
|
|
103
105
|
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))));
|
|
104
106
|
return (react_2.default.createElement(react_2.default.Fragment, null, withoutPopover ? (react_2.default.createElement(react_2.default.Fragment, null,
|
|
105
107
|
react_2.default.createElement("div", { className: "uxf-form-component__label" },
|
|
@@ -34,12 +34,13 @@ const chip_1 = require("@uxf/ui/chip");
|
|
|
34
34
|
const use_dropdown_1 = require("@uxf/ui/hooks/use-dropdown");
|
|
35
35
|
const label_1 = require("@uxf/ui/label");
|
|
36
36
|
const react_2 = __importStar(require("react"));
|
|
37
|
+
const react_3 = require("@floating-ui/react");
|
|
37
38
|
exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
38
39
|
var _a, _b, _c;
|
|
39
40
|
const innerRef = (0, react_2.useRef)(null);
|
|
40
41
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
41
42
|
const dropdown = (0, use_dropdown_1.useDropdown)((_a = props.dropdownPlacement) !== null && _a !== void 0 ? _a : "bottom", true);
|
|
42
|
-
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.reference), [ref, dropdown.reference]);
|
|
43
|
+
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.refs.reference), [ref, dropdown.refs.reference]);
|
|
43
44
|
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "chevronDown";
|
|
44
45
|
const selectedOptions = (_c = props.value) !== null && _c !== void 0 ? _c : [];
|
|
45
46
|
const filteredOptions = props.options.filter((option) => !selectedOptions.map((i) => i.id).includes(option.id));
|
|
@@ -60,11 +61,12 @@ exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
60
61
|
? props.placeholder
|
|
61
62
|
: selectedOptions.map((item) => (react_2.default.createElement(chip_1.Chip, { className: "uxf-multi-combobox__input-chip", color: item.color, key: item.id, onClose: handleRemove(item.id), size: "large", suppressFocus: true }, item.label)))),
|
|
62
63
|
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select__button-icon", renderProps.open && "is-open"), name: iconName })),
|
|
63
|
-
react_2.default.createElement(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
65
|
+
react_2.default.createElement(react_1.Listbox.Options, { className: (0, cx_1.cx)("uxf-dropdown", dropdown.placement === "bottom" && "uxf-dropdown--bottom", dropdown.placement === "top" && "uxf-dropdown--top"), ref: dropdown.refs.floating, static: props.withPopover }, filteredOptions.map((option) => {
|
|
66
|
+
var _a;
|
|
67
|
+
const optionKey = (_a = props.keyExtractor) === null || _a === void 0 ? void 0 : _a.call(props, option);
|
|
68
|
+
return (react_2.default.createElement(react_1.Listbox.Option, { className: (optionState) => (0, cx_1.cx)("uxf-dropdown__item uxf-multi-select__dropdown-item", optionState.active && classes_1.CLASSES.IS_ACTIVE, optionState.disabled && classes_1.CLASSES.IS_DISABLED, optionState.selected && classes_1.CLASSES.IS_SELECTED), key: optionKey !== null && optionKey !== void 0 ? optionKey : option.id, value: option }, optionKey !== null && optionKey !== void 0 ? optionKey : option.label));
|
|
69
|
+
})))),
|
|
68
70
|
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))));
|
|
69
71
|
return (react_2.default.createElement(react_2.default.Fragment, null, withoutPopover ? (react_2.default.createElement(react_2.default.Fragment, null,
|
|
70
72
|
react_2.default.createElement("div", { className: "uxf-form-component__label" },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.157",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"author": "UX Fans s.r.o",
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@floating-ui/react": "^0.
|
|
16
|
+
"@floating-ui/react": "^0.24.1",
|
|
17
17
|
"@headlessui/react": "^1.7.14",
|
|
18
18
|
"@uxf/core": "^4.5.1",
|
|
19
19
|
"@uxf/datepicker": "^1.2.0",
|
package/select/select.js
CHANGED
|
@@ -1,45 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
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;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
4
|
};
|
|
25
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
6
|
exports.Select = void 0;
|
|
27
7
|
const react_1 = require("@headlessui/react");
|
|
28
|
-
const
|
|
29
|
-
const react_2 = __importStar(require("react"));
|
|
8
|
+
const react_2 = __importDefault(require("react"));
|
|
30
9
|
const _select_base_1 = require("../_select-base");
|
|
31
10
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
32
|
-
const SelectedOption = (0, react_2.forwardRef)((props, ref) => (react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-input__element", props.isEmpty && classes_1.CLASSES.IS_EMPTY), ref: ref },
|
|
33
|
-
react_2.default.createElement("span", { className: "uxf-input__element-text" }, props.children))));
|
|
34
|
-
SelectedOption.displayName = "UxfUiSelectSelectedOption";
|
|
35
11
|
const Select = (props) => {
|
|
36
12
|
var _a, _b, _c;
|
|
37
13
|
const selectedOption = props.options.find((option) => option.id === props.value);
|
|
38
14
|
const onChange = (v) => props.onChange(v === null || v === void 0 ? void 0 : v.id);
|
|
39
|
-
return (react_2.default.createElement(_select_base_1._SelectBase, { HUIComponent: react_1.Listbox, className: `uxf-select ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, customInputElementDisplayName:
|
|
40
|
-
react_2.default.createElement(
|
|
41
|
-
|
|
42
|
-
|
|
15
|
+
return (react_2.default.createElement(_select_base_1._SelectBase, { HUIComponent: react_1.Listbox, className: `uxf-select ${(_a = props.className) !== null && _a !== void 0 ? _a : ""}`, customInputElementDisplayName: react_1.Listbox.Button.displayName, dropdownPlacement: props.dropdownPlacement, 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, value: props.value, variant: props.variant },
|
|
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
|
+
react_2.default.createElement("span", { className: "uxf-input__element-text" }, selectedOption
|
|
18
|
+
? (_c = (_b = props.renderSelectedOption) === null || _b === void 0 ? void 0 : _b.call(props, selectedOption)) !== null && _c !== void 0 ? _c : selectedOption.label
|
|
19
|
+
: props.placeholder))));
|
|
43
20
|
};
|
|
44
21
|
exports.Select = Select;
|
|
45
22
|
exports.Select.displayName = "UxfUiSelect";
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from "react";
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
3
2
|
import { InputWithPopoverProps } from "../_input-with-popover";
|
|
4
|
-
export
|
|
3
|
+
export declare const ALLOWED_TIME_FORMAT: string[];
|
|
4
|
+
export declare const DISPLAY_TIME_FORMAT = "H:mm";
|
|
5
|
+
export declare function stringToTimeType(value: string): {
|
|
6
|
+
hour: number;
|
|
7
|
+
minute: number;
|
|
8
|
+
};
|
|
9
|
+
export interface TimePickerInputProps extends Omit<InputWithPopoverProps<string | null>, "children" | "placeholder" | "triggerElement"> {
|
|
5
10
|
placeholder?: string;
|
|
11
|
+
triggerElement?: ReactNode;
|
|
6
12
|
}
|
|
7
13
|
export declare const TimePickerInput: React.ForwardRefExoticComponent<TimePickerInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -22,16 +22,34 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.TimePickerInput = void 0;
|
|
29
|
+
exports.TimePickerInput = exports.stringToTimeType = exports.DISPLAY_TIME_FORMAT = exports.ALLOWED_TIME_FORMAT = void 0;
|
|
27
30
|
const react_1 = __importStar(require("react"));
|
|
28
31
|
const time_picker_1 = require("./time-picker");
|
|
29
32
|
const _input_with_popover_1 = require("../_input-with-popover");
|
|
30
|
-
|
|
31
|
-
|
|
33
|
+
const dayjs_1 = __importStar(require("dayjs"));
|
|
34
|
+
const customParseFormat_1 = __importDefault(require("dayjs/plugin/customParseFormat"));
|
|
35
|
+
const icon_1 = require("../icon");
|
|
36
|
+
(0, dayjs_1.extend)(customParseFormat_1.default);
|
|
37
|
+
exports.ALLOWED_TIME_FORMAT = ["HH:mm", "H:mm"];
|
|
38
|
+
exports.DISPLAY_TIME_FORMAT = "H:mm";
|
|
39
|
+
function stringToTimeType(value) {
|
|
40
|
+
const parseTime = (0, dayjs_1.default)(value, exports.ALLOWED_TIME_FORMAT, true);
|
|
41
|
+
return {
|
|
42
|
+
hour: parseTime.hour(),
|
|
43
|
+
minute: parseTime.minute(),
|
|
44
|
+
};
|
|
32
45
|
}
|
|
33
|
-
exports.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
46
|
+
exports.stringToTimeType = stringToTimeType;
|
|
47
|
+
exports.TimePickerInput = (0, react_1.forwardRef)((props, ref) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
const onChange = props.onChange;
|
|
50
|
+
const onTimePickerChange = (0, react_1.useCallback)((value) => onChange(value ? (0, dayjs_1.default)().hour(value.hour).minute(value.minute).second(0).format("H:mm") : null), [onChange]);
|
|
51
|
+
const parsedTime = (0, dayjs_1.default)(props.value, exports.ALLOWED_TIME_FORMAT, true);
|
|
52
|
+
const selectedTime = props.value && parsedTime.isValid() ? stringToTimeType(props.value) : null;
|
|
53
|
+
return (react_1.default.createElement(_input_with_popover_1._InputWithPopover, { ...props, placeholder: props.placeholder || "Vyberte čas...", ref: ref, value: (_a = props.value) !== null && _a !== void 0 ? _a : "", triggerElement: (_b = props.triggerElement) !== null && _b !== void 0 ? _b : react_1.default.createElement(icon_1.Icon, { name: "clock", size: 20 }) }, ({ close }) => (react_1.default.createElement(time_picker_1.TimePicker, { closePopoverHandler: close, onChange: onTimePickerChange, selectedTime: selectedTime }))));
|
|
54
|
+
});
|
|
37
55
|
exports.TimePickerInput.displayName = "UxfUiTimePickerInput";
|
package/tooltip/tooltip.js
CHANGED
|
@@ -35,13 +35,13 @@ const STATIC_SIDES = {
|
|
|
35
35
|
left: "right",
|
|
36
36
|
};
|
|
37
37
|
exports.Tooltip = (0, react_1.forwardRef)(({ children, className, content, style, ...options }, ref) => {
|
|
38
|
-
var _a, _b
|
|
38
|
+
var _a, _b;
|
|
39
39
|
const arrowRef = (0, react_1.useRef)(null);
|
|
40
40
|
const tooltip = (0, use_tooltip_1.useTooltip)({ arrowRef, ...options });
|
|
41
41
|
const arrowX = (_a = tooltip.middlewareData.arrow) === null || _a === void 0 ? void 0 : _a.x;
|
|
42
42
|
const arrowY = (_b = tooltip.middlewareData.arrow) === null || _b === void 0 ? void 0 : _b.y;
|
|
43
43
|
const staticSide = STATIC_SIDES[tooltip.placement.split("-")[0]];
|
|
44
|
-
const stableRef = (0, react_1.useMemo)(() => (0, composeRefs_1.composeRefs)(ref, tooltip.reference, children.ref), [ref, tooltip.reference, children]);
|
|
44
|
+
const stableRef = (0, react_1.useMemo)(() => (0, composeRefs_1.composeRefs)(ref, tooltip.refs.reference, children.ref), [ref, tooltip.refs.reference, children]);
|
|
45
45
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
46
46
|
(0, react_1.cloneElement)(children, tooltip.getReferenceProps({
|
|
47
47
|
ref: stableRef,
|
|
@@ -49,12 +49,12 @@ exports.Tooltip = (0, react_1.forwardRef)(({ children, className, content, style
|
|
|
49
49
|
"data-state": tooltip.open ? "open" : "closed",
|
|
50
50
|
})),
|
|
51
51
|
tooltip.open && (react_1.default.createElement("div", { ...tooltip.getFloatingProps({
|
|
52
|
-
ref: tooltip.floating,
|
|
52
|
+
ref: tooltip.refs.floating,
|
|
53
53
|
style: {
|
|
54
54
|
position: tooltip.strategy,
|
|
55
|
-
top:
|
|
56
|
-
left:
|
|
57
|
-
visibility: tooltip.x
|
|
55
|
+
top: tooltip.y,
|
|
56
|
+
left: tooltip.x,
|
|
57
|
+
visibility: !tooltip.x ? "hidden" : "visible",
|
|
58
58
|
...style,
|
|
59
59
|
},
|
|
60
60
|
className: (0, cx_1.cx)("uxf-tooltip", className),
|
package/tooltip/use-tooltip.d.ts
CHANGED
|
@@ -10,22 +10,18 @@ export declare function useTooltip(options: TooltipOptions): {
|
|
|
10
10
|
placement: Placement;
|
|
11
11
|
strategy: import("@floating-ui/react").Strategy;
|
|
12
12
|
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
13
|
-
x: number
|
|
14
|
-
y: number
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
15
|
update: () => void;
|
|
16
|
-
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
17
|
-
floating: (node: HTMLElement | null) => void;
|
|
18
|
-
positionReference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
19
16
|
context: {
|
|
20
|
-
x: number
|
|
21
|
-
y: number
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
22
19
|
placement: Placement;
|
|
23
20
|
strategy: import("@floating-ui/react").Strategy;
|
|
24
21
|
middlewareData: import("@floating-ui/react").MiddlewareData;
|
|
25
22
|
update: () => void;
|
|
26
|
-
reference: (node: import("@floating-ui/react").ReferenceType | null) => void;
|
|
27
|
-
floating: (node: HTMLElement | null) => void;
|
|
28
23
|
isPositioned: boolean;
|
|
24
|
+
floatingStyles: import("react").CSSProperties;
|
|
29
25
|
open: boolean;
|
|
30
26
|
onOpenChange: (open: boolean) => void;
|
|
31
27
|
events: import("@floating-ui/react").FloatingEvents;
|
|
@@ -38,6 +34,7 @@ export declare function useTooltip(options: TooltipOptions): {
|
|
|
38
34
|
refs: import("@floating-ui/react").ExtendedRefs<import("@floating-ui/react").ReferenceType>;
|
|
39
35
|
elements: import("@floating-ui/react").ExtendedElements<import("@floating-ui/react").ReferenceType>;
|
|
40
36
|
isPositioned: boolean;
|
|
37
|
+
floatingStyles: import("react").CSSProperties;
|
|
41
38
|
getReferenceProps: (userProps?: import("react").HTMLProps<Element> | undefined) => Record<string, unknown>;
|
|
42
39
|
getFloatingProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|
|
43
40
|
getItemProps: (userProps?: import("react").HTMLProps<HTMLElement> | undefined) => Record<string, unknown>;
|