@uxf/ui 11.19.0 → 11.20.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/_input-with-popover/input-with-popover.js +2 -2
- package/_select-base/_select-base.js +4 -4
- package/avatar-file-input/avatar-file-input.js +2 -2
- package/button/button.d.ts +1 -1
- package/button/button.js +2 -2
- package/button-list/button-list.js +2 -2
- package/calendar/calendar-day-cell.js +2 -2
- package/checkbox/checkbox.js +2 -2
- package/chip/chip.d.ts +1 -1
- package/chip/chip.js +2 -2
- package/color-radio/color-radio.js +2 -2
- package/css/flash-messages.css +20 -8
- package/dropdown/dropdown.d.ts +1 -1
- package/dropdown/dropdown.js +2 -2
- package/file-input/file-input.js +2 -2
- package/flash-messages/flash-message.d.ts +3 -2
- package/flash-messages/flash-message.js +11 -12
- package/flash-messages/flash-messages.js +22 -3
- package/flash-messages/flash-messages.stories.js +15 -1
- package/image-gallery/use-image.js +2 -2
- package/input/input.d.ts +1 -1
- package/input/input.js +2 -2
- package/list-item/list-item.d.ts +1 -1
- package/list-item/list-item.js +2 -2
- package/multi-combobox/_multi-combobox-base.js +2 -2
- package/multi-select/_multi-select-base.js +2 -2
- package/package.json +4 -3
- package/pagination/pagination.js +2 -2
- package/radio/radio.js +2 -2
- package/raster-image/img-sources.d.ts +17 -0
- package/raster-image/img-sources.js +45 -0
- package/raster-image/raster-image.d.ts +2 -1
- package/raster-image/raster-image.js +3 -2
- package/tabs/tabs.js +2 -2
- package/text-input/text-input.js +2 -2
- package/text-link/text-link.d.ts +1 -1
- package/text-link/text-link.js +2 -2
- package/textarea/textarea.js +4 -4
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports._InputWithPopover = void 0;
|
|
27
27
|
const react_1 = require("@floating-ui/react");
|
|
28
28
|
const react_2 = require("@headlessui/react");
|
|
29
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
29
30
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
30
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
31
31
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
32
32
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
33
33
|
const react_3 = __importStar(require("react"));
|
|
@@ -47,7 +47,7 @@ exports._InputWithPopover = (0, react_3.forwardRef)((props, ref) => {
|
|
|
47
47
|
const generatedId = (0, react_3.useId)();
|
|
48
48
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
49
49
|
const innerRef = (0, react_3.useRef)(null);
|
|
50
|
-
const input = (0,
|
|
50
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
51
51
|
const error = useErrorProps(props.error, id, props.isInvalid);
|
|
52
52
|
const rootClassName = (0, cx_1.cx)("uxf-input-with-popover", ((_b = props.isFocused) !== null && _b !== void 0 ? _b : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
|
|
53
53
|
const floatingPopover = (0, react_1.useFloating)({
|
|
@@ -25,9 +25,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports._SelectBase = void 0;
|
|
27
27
|
const react_1 = require("@floating-ui/react");
|
|
28
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
29
|
+
const use_on_unmount_1 = require("@uxf/core-react/hooks/use-on-unmount");
|
|
28
30
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
30
|
-
const useOnUnmount_1 = require("@uxf/core/hooks/useOnUnmount");
|
|
31
31
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
32
32
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
33
33
|
const use_dropdown_1 = require("@uxf/ui/hooks/use-dropdown");
|
|
@@ -59,7 +59,7 @@ const InputArrow = (props) => {
|
|
|
59
59
|
const Options = (props) => {
|
|
60
60
|
var _a, _b;
|
|
61
61
|
const HUIComponent = props.HUIComponent;
|
|
62
|
-
(0,
|
|
62
|
+
(0, use_on_unmount_1.useOnUnmount)(() => {
|
|
63
63
|
var _a;
|
|
64
64
|
(_a = props.onUnmount) === null || _a === void 0 ? void 0 : _a.call(props);
|
|
65
65
|
});
|
|
@@ -78,7 +78,7 @@ const _SelectBase = (props) => {
|
|
|
78
78
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
79
79
|
const innerRef = (0, react_2.useRef)(null);
|
|
80
80
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
81
|
-
const input = (0,
|
|
81
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
82
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;
|
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.AvatarFileInput = void 0;
|
|
27
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const file_1 = require("@uxf/core/utils/file");
|
|
@@ -40,7 +40,7 @@ exports.AvatarFileInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
40
40
|
const generatedId = (0, react_1.useId)();
|
|
41
41
|
const id = props.id || generatedId;
|
|
42
42
|
const innerRef = (0, react_1.useRef)(null);
|
|
43
|
-
const input = (0,
|
|
43
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
44
44
|
const errorId = props.isInvalid && props.id ? `${props.id}--errormessage` : undefined;
|
|
45
45
|
const stateClassName = (0, cx_1.cx)(((_a = props.isFocused) !== null && _a !== void 0 ? _a : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED);
|
|
46
46
|
const rootClassName = (0, cx_1.cx)(`uxf-avatar-file-input uxf-avatar-file-input--variant-${(_b = props.variant) !== null && _b !== void 0 ? _b : "default"}`, stateClassName, props.className);
|
package/button/button.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseAnchorProps } from "@uxf/core/hooks/
|
|
1
|
+
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import { ButtonColors, ButtonSizes, ButtonVariants } from "@uxf/ui/button/theme";
|
|
3
3
|
import React, { AnchorHTMLAttributes } from "react";
|
|
4
4
|
import { NextLink } from "./next-link";
|
package/button/button.js
CHANGED
|
@@ -24,14 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Button = void 0;
|
|
27
|
-
const
|
|
27
|
+
const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
|
|
28
28
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
exports.Button = (0, react_1.forwardRef)((props, ref) => {
|
|
31
31
|
// eslint-disable-next-line react/destructuring-assignment
|
|
32
32
|
const { as = "a", color, isIconButton, isFullWidth, size, variant, className, ...restProps } = props;
|
|
33
33
|
const Component = as;
|
|
34
|
-
const anchorProps = (0,
|
|
34
|
+
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
35
35
|
...restProps,
|
|
36
36
|
className: (0, cx_1.cx)("uxf-button", `uxf-button--color-${color !== null && color !== void 0 ? color : "default"}`, `uxf-button--size-${size !== null && size !== void 0 ? size : "default"}`, `uxf-button--variant-${variant !== null && variant !== void 0 ? variant : "default"}`, isIconButton && "uxf-button--icon-button", isFullWidth && "uxf-button--full-width", className),
|
|
37
37
|
});
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.ButtonList = void 0;
|
|
27
27
|
const react_1 = require("@floating-ui/react");
|
|
28
28
|
const react_2 = require("@headlessui/react");
|
|
29
|
-
const
|
|
29
|
+
const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
32
32
|
const react_3 = __importStar(require("react"));
|
|
@@ -36,7 +36,7 @@ const icon_1 = require("../icon");
|
|
|
36
36
|
const MenuButton = (0, react_3.forwardRef)((props, ref) => {
|
|
37
37
|
// eslint-disable-next-line react/destructuring-assignment,@typescript-eslint/no-unused-vars
|
|
38
38
|
const { variant, color, isIconButton, isFullWidth, size, icon, label, className, ...restProps } = props;
|
|
39
|
-
const anchorProps = (0,
|
|
39
|
+
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
40
40
|
...restProps,
|
|
41
41
|
className: (0, cx_1.cx)("uxf-button-list__menu-button", className),
|
|
42
42
|
});
|
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.CalendarDayCell = void 0;
|
|
27
|
+
const use_on_mount_1 = require("@uxf/core-react/hooks/use-on-mount");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useOnMount_1 = require("@uxf/core/hooks/useOnMount");
|
|
29
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const use_day_1 = require("@uxf/datepicker/hooks/use-day");
|
|
@@ -50,7 +50,7 @@ exports.CalendarDayCell = (0, react_1.memo)((props) => {
|
|
|
50
50
|
preventScroll: props.datePickerProps.preventScroll,
|
|
51
51
|
unavailableDates: props.datePickerProps.unavailableDates,
|
|
52
52
|
});
|
|
53
|
-
(0,
|
|
53
|
+
(0, use_on_mount_1.useOnMount)(() => {
|
|
54
54
|
const node = innerRef.current;
|
|
55
55
|
if (node && (isToday || isSelected)) {
|
|
56
56
|
node.focus({ preventScroll: props.datePickerProps.preventScroll });
|
package/checkbox/checkbox.js
CHANGED
|
@@ -24,15 +24,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Checkbox = void 0;
|
|
27
|
+
const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useClickableProps_1 = require("@uxf/core/hooks/useClickableProps");
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const icon_1 = require("../icon");
|
|
32
32
|
exports.Checkbox = (0, react_1.forwardRef)((props, ref) => {
|
|
33
33
|
var _a, _b, _c;
|
|
34
34
|
const onChange = () => props.onChange(!props.value);
|
|
35
|
-
const clickableProps = (0,
|
|
35
|
+
const clickableProps = (0, use_clickable_props_1.useClickableProps)({
|
|
36
36
|
"aria-checked": props.value,
|
|
37
37
|
"aria-disabled": props.isDisabled,
|
|
38
38
|
"aria-invalid": props.isInvalid,
|
package/chip/chip.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseAnchorProps } from "@uxf/core/hooks/
|
|
1
|
+
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import { ChipColor, ChipSize, ChipVariant } from "@uxf/ui/chip/theme";
|
|
3
3
|
import React, { AnchorHTMLAttributes, MouseEventHandler } from "react";
|
|
4
4
|
export interface ChipProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "color" | "type">, UseAnchorProps {
|
package/chip/chip.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Chip = void 0;
|
|
27
|
-
const
|
|
27
|
+
const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
|
|
28
28
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const CloseButton = (props) => {
|
|
@@ -43,7 +43,7 @@ exports.Chip = (0, react_1.forwardRef)((props, ref) => {
|
|
|
43
43
|
var _a, _b, _c;
|
|
44
44
|
const { children, className, onClose, suppressFocus, tabIndex, ...restProps } = props;
|
|
45
45
|
const chipClassName = (0, cx_1.cx)("uxf-chip", `uxf-chip--color-${(_a = props.color) !== null && _a !== void 0 ? _a : "default"}`, `uxf-chip--size-${(_b = props.size) !== null && _b !== void 0 ? _b : "default"}`, `uxf-chip--variant-${(_c = props.variant) !== null && _c !== void 0 ? _c : "default"}`, onClose && "has-button", className);
|
|
46
|
-
const anchorProps = (0,
|
|
46
|
+
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
47
47
|
className: (0, cx_1.cx)(chipClassName),
|
|
48
48
|
tabIndex: suppressFocus ? -1 : tabIndex,
|
|
49
49
|
...restProps,
|
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ColorRadio = void 0;
|
|
27
|
+
const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useClickableProps_1 = require("@uxf/core/hooks/useClickableProps");
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
const icon_1 = require("../icon");
|
|
@@ -44,7 +44,7 @@ exports.ColorRadio = (0, react_1.forwardRef)((props, ref) => {
|
|
|
44
44
|
};
|
|
45
45
|
const onChange = props.onChange;
|
|
46
46
|
const onClick = onChange ? () => onChange(props.value) : undefined;
|
|
47
|
-
const clickableProps = (0,
|
|
47
|
+
const clickableProps = (0, use_clickable_props_1.useClickableProps)({
|
|
48
48
|
"aria-checked": props.checked,
|
|
49
49
|
"aria-disabled": props.isDisabled,
|
|
50
50
|
"aria-invalid": props.isInvalid,
|
package/css/flash-messages.css
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
&__dismissable {
|
|
19
19
|
display: flex;
|
|
20
20
|
flex-direction: column-reverse;
|
|
21
|
-
overflow: hidden;
|
|
21
|
+
overflow: hidden scroll;
|
|
22
22
|
padding-right: theme("spacing.3");
|
|
23
23
|
pointer-events: auto;
|
|
24
24
|
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
&:hover {
|
|
40
40
|
padding-top: 0;
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
&.is-collapsed {
|
|
44
|
+
padding-right: theme("spacing.5");
|
|
45
|
+
scrollbar-width: none;
|
|
46
|
+
}
|
|
42
47
|
}
|
|
43
48
|
|
|
44
49
|
&__permanent {
|
|
@@ -70,35 +75,41 @@
|
|
|
70
75
|
margin-top: theme("spacing.4");
|
|
71
76
|
|
|
72
77
|
.uxf-flash-messages__dismissable & {
|
|
73
|
-
|
|
78
|
+
position: relative;
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
81
|
|
|
77
82
|
.uxf-flash-messages__dismissable & {
|
|
78
83
|
&:nth-last-child(n + 5) {
|
|
79
|
-
|
|
84
|
+
opacity: 0;
|
|
85
|
+
pointer-events: none;
|
|
86
|
+
transform: translateY(calc(var(--flash-message-height) * 4));
|
|
87
|
+
visibility: hidden;
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
&:nth-last-child(4) {
|
|
83
91
|
opacity: 0.6;
|
|
84
|
-
transform: scale(0.85);
|
|
92
|
+
transform: translateY(calc(var(--flash-message-height) * 3)) scale(0.85);
|
|
85
93
|
}
|
|
86
94
|
|
|
87
95
|
&:nth-last-child(3) {
|
|
88
96
|
opacity: 0.7;
|
|
89
|
-
transform: scale(0.9);
|
|
97
|
+
transform: translateY(calc(var(--flash-message-height) * 2)) scale(0.9);
|
|
90
98
|
}
|
|
91
99
|
|
|
92
100
|
&:nth-last-child(2) {
|
|
93
101
|
opacity: 0.8;
|
|
94
|
-
transform: scale(0.95);
|
|
102
|
+
transform: translateY(calc(var(--flash-message-height))) scale(0.95);
|
|
95
103
|
}
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
.uxf-flash-messages__dismissable:hover & {
|
|
99
|
-
|
|
107
|
+
--flash-message-height: auto !important;
|
|
108
|
+
|
|
100
109
|
opacity: 1;
|
|
101
|
-
|
|
110
|
+
pointer-events: auto;
|
|
111
|
+
transform: none;
|
|
112
|
+
visibility: visible;
|
|
102
113
|
|
|
103
114
|
&:not(:first-of-type) {
|
|
104
115
|
margin-top: theme("spacing.4");
|
|
@@ -117,6 +128,7 @@
|
|
|
117
128
|
border-radius: theme("borderRadius.lg");
|
|
118
129
|
color: var(--flash-message-color);
|
|
119
130
|
font-size: 0.875rem;
|
|
131
|
+
height: var(--flash-message-height);
|
|
120
132
|
line-height: 1.25rem;
|
|
121
133
|
min-width: 15rem;
|
|
122
134
|
padding: theme("spacing.4") theme("spacing.5");
|
package/dropdown/dropdown.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseAnchorProps } from "@uxf/core/hooks/
|
|
1
|
+
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import React, { AnchorHTMLAttributes, HTMLAttributes } from "react";
|
|
3
3
|
export interface DropdownItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "type">, UseAnchorProps {
|
|
4
4
|
}
|
package/dropdown/dropdown.js
CHANGED
|
@@ -24,13 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Dropdown = void 0;
|
|
27
|
-
const
|
|
27
|
+
const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
|
|
28
28
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const Item = (0, react_1.forwardRef)((props, ref) => {
|
|
31
31
|
// eslint-disable-next-line react/destructuring-assignment
|
|
32
32
|
const { children, className, ...restProps } = props;
|
|
33
|
-
const anchorProps = (0,
|
|
33
|
+
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
34
34
|
className: `uxf-dropdown__item ${className || ""}`,
|
|
35
35
|
role: "menuitem",
|
|
36
36
|
...restProps,
|
package/file-input/file-input.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.FileInput = void 0;
|
|
27
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const context_1 = require("@uxf/ui/context");
|
|
@@ -43,7 +43,7 @@ exports.FileInput = (0, react_1.forwardRef)((props, ref) => {
|
|
|
43
43
|
const generatedId = (0, react_1.useId)();
|
|
44
44
|
const id = props.id || generatedId;
|
|
45
45
|
const innerRef = (0, react_1.useRef)(null);
|
|
46
|
-
const input = (0,
|
|
46
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
47
47
|
const errorId = props.isInvalid && props.id ? `${props.id}--errormessage` : undefined;
|
|
48
48
|
const fileName = props.value ? `${props.value.name}` : props.placeholder || "No file has been selected yet";
|
|
49
49
|
const onUploadFile = async (file) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FlashMessageVariants } from "@uxf/ui/flash-messages/theme";
|
|
2
|
-
import {
|
|
2
|
+
import React, { CSSProperties, MouseEventHandler, ReactNode } from "react";
|
|
3
3
|
export type FlashMessageVariant = keyof FlashMessageVariants;
|
|
4
4
|
export interface Notification {
|
|
5
5
|
autoDismiss?: boolean;
|
|
@@ -12,5 +12,6 @@ export interface Notification {
|
|
|
12
12
|
export interface FlashMessageProps {
|
|
13
13
|
notification: Notification;
|
|
14
14
|
onClose: MouseEventHandler<HTMLDivElement>;
|
|
15
|
+
style?: CSSProperties;
|
|
15
16
|
}
|
|
16
|
-
export declare const FlashMessage:
|
|
17
|
+
export declare const FlashMessage: React.ForwardRefExoticComponent<FlashMessageProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -24,24 +24,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.FlashMessage = void 0;
|
|
27
|
-
const
|
|
27
|
+
const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
|
-
|
|
30
|
-
const FlashMessage = ({ notification, onClose }) => {
|
|
29
|
+
exports.FlashMessage = (0, react_1.forwardRef)((props, ref) => {
|
|
31
30
|
(0, react_1.useEffect)(() => {
|
|
32
|
-
const { autoDismiss, dismissTimeout } = notification;
|
|
31
|
+
const { autoDismiss, dismissTimeout } = props.notification;
|
|
33
32
|
let timer;
|
|
34
33
|
if (autoDismiss) {
|
|
35
|
-
timer = window.setTimeout(onClose, dismissTimeout);
|
|
34
|
+
timer = window.setTimeout(props.onClose, dismissTimeout);
|
|
36
35
|
}
|
|
37
36
|
return () => clearTimeout(timer);
|
|
38
|
-
}, [onClose, notification]);
|
|
39
|
-
const clickableProps = (0,
|
|
40
|
-
className: `uxf-flash-message uxf-flash-message--${notification.variant || "success"}`,
|
|
41
|
-
onClick: onClose,
|
|
37
|
+
}, [props.onClose, props.notification]);
|
|
38
|
+
const clickableProps = (0, use_clickable_props_1.useClickableProps)({
|
|
39
|
+
className: `uxf-flash-message uxf-flash-message--${props.notification.variant || "success"}`,
|
|
40
|
+
onClick: props.onClose,
|
|
42
41
|
role: "listitem alert",
|
|
42
|
+
style: props.style,
|
|
43
43
|
});
|
|
44
|
-
return react_1.default.createElement("div", { ...clickableProps }, notification.message);
|
|
45
|
-
};
|
|
46
|
-
exports.FlashMessage = FlashMessage;
|
|
44
|
+
return (react_1.default.createElement("div", { ...clickableProps, ref: ref }, props.notification.message));
|
|
45
|
+
});
|
|
47
46
|
exports.FlashMessage.displayName = "UxfUiFlashMessage";
|
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.FlashMessages = void 0;
|
|
27
27
|
const react_1 = require("@headlessui/react");
|
|
28
|
+
const useClickableProps_1 = require("@uxf/core/hooks/useClickableProps");
|
|
28
29
|
const react_2 = __importStar(require("react"));
|
|
29
30
|
const flash_message_1 = require("./flash-message");
|
|
30
31
|
exports.FlashMessages = (0, react_2.forwardRef)((props, ref) => {
|
|
@@ -32,7 +33,15 @@ exports.FlashMessages = (0, react_2.forwardRef)((props, ref) => {
|
|
|
32
33
|
const permanentNotificationsRef = (0, react_2.useRef)(null);
|
|
33
34
|
const permanentNotifications = notifications.filter((notification) => !notification.autoDismiss);
|
|
34
35
|
const dismissableNotifications = notifications.filter((notification) => !!notification.autoDismiss);
|
|
36
|
+
const [lastToastHeight, setLastToastHeight] = (0, react_2.useState)(0);
|
|
37
|
+
const lastToastRef = (0, react_2.useRef)(null);
|
|
38
|
+
const [isCollapsed, setIsCollapsed] = (0, react_2.useState)(true);
|
|
35
39
|
const [showDivider, setShowDivider] = (0, react_2.useState)(false);
|
|
40
|
+
(0, react_2.useEffect)(() => {
|
|
41
|
+
if (lastToastRef.current) {
|
|
42
|
+
setLastToastHeight(lastToastRef.current.offsetHeight);
|
|
43
|
+
}
|
|
44
|
+
}, [lastToastHeight, dismissableNotifications]);
|
|
36
45
|
(0, react_2.useEffect)(() => {
|
|
37
46
|
const dividerHandler = () => {
|
|
38
47
|
if (permanentNotificationsRef.current &&
|
|
@@ -73,10 +82,20 @@ exports.FlashMessages = (0, react_2.forwardRef)((props, ref) => {
|
|
|
73
82
|
closeAll: innerRef.current.closeAll,
|
|
74
83
|
open: innerRef.current.open,
|
|
75
84
|
}), []);
|
|
85
|
+
const clickableProps = (0, useClickableProps_1.useClickableProps)({
|
|
86
|
+
className: `uxf-flash-messages__dismissable ${isCollapsed ? "is-collapsed" : ""}`,
|
|
87
|
+
onMouseEnter: () => setIsCollapsed(false),
|
|
88
|
+
onMouseLeave: () => setIsCollapsed(true),
|
|
89
|
+
});
|
|
76
90
|
return notifications.length > 0 ? (react_2.default.createElement("div", { className: "uxf-flash-messages" },
|
|
77
|
-
dismissableNotifications.length > 0 && (react_2.default.createElement("div", {
|
|
78
|
-
react_2.default.createElement("div", null, dismissableNotifications.map((notification) => {
|
|
79
|
-
|
|
91
|
+
dismissableNotifications.length > 0 && (react_2.default.createElement("div", { ...clickableProps },
|
|
92
|
+
react_2.default.createElement("div", null, dismissableNotifications.map((notification, index) => {
|
|
93
|
+
const isLast = index === dismissableNotifications.length - 1;
|
|
94
|
+
return (react_2.default.createElement(react_1.Transition, { key: notification.id, appear: true, show: true, enterFrom: "uxf-flash-message-wrapper--enter-from", enterTo: "uxf-flash-message-wrapper--enter-to", className: "uxf-flash-message-wrapper", ref: isLast ? lastToastRef : null, style: isLast
|
|
95
|
+
? {}
|
|
96
|
+
: {
|
|
97
|
+
"--flash-message-height": `${lastToastHeight}px`,
|
|
98
|
+
} },
|
|
80
99
|
react_2.default.createElement(flash_message_1.FlashMessage, { notification: notification, onClose: () => close(notification) })));
|
|
81
100
|
})))),
|
|
82
101
|
showDivider && react_2.default.createElement("hr", { className: "uxf-flash-messages__divider" }),
|
|
@@ -13,6 +13,12 @@ exports.default = {
|
|
|
13
13
|
title: "UI/FlashMessages",
|
|
14
14
|
component: flash_messages_1.FlashMessages,
|
|
15
15
|
};
|
|
16
|
+
// Random texts for flash message height testing
|
|
17
|
+
const randomTexts = [
|
|
18
|
+
"Lorem ipsum dolor sit amet, consectetur adipisicing elit. Culpa ex fuga neque. Delectus error, esse eum exercitationem iste iure maiores mollitia officia quasi reiciendis saepe voluptates voluptatum? Commodi, nulla, quo!",
|
|
19
|
+
"ulpa ex fuga neque. Delectus error",
|
|
20
|
+
"consectetur adipisicing elit. Culpa ex fuga neque. Delectus error, esse eum exercit",
|
|
21
|
+
];
|
|
16
22
|
function Default() {
|
|
17
23
|
return (react_1.default.createElement("div", { className: "inline-flex flex-col space-y-4" },
|
|
18
24
|
react_1.default.createElement(button_1.Button, { onClick: () => (0, flash_messages_service_1.flashMessage)({
|
|
@@ -57,6 +63,14 @@ function Default() {
|
|
|
57
63
|
message: "Small",
|
|
58
64
|
autoDismiss: false,
|
|
59
65
|
variant: "info",
|
|
60
|
-
}) }, "Small flash message")
|
|
66
|
+
}) }, "Small flash message"),
|
|
67
|
+
react_1.default.createElement(button_1.Button, { onClick: () => {
|
|
68
|
+
const randomNumber = Math.floor(Math.random() * randomTexts.length);
|
|
69
|
+
return (0, flash_messages_service_1.flashMessage)({
|
|
70
|
+
message: (react_1.default.createElement("div", { className: "flex items-center space-x-4" },
|
|
71
|
+
react_1.default.createElement(icon_1.Icon, { name: "check", size: 20 }),
|
|
72
|
+
react_1.default.createElement("span", null, randomTexts[randomNumber]))),
|
|
73
|
+
});
|
|
74
|
+
} }, "Flash message, variant success, random text")));
|
|
61
75
|
}
|
|
62
76
|
exports.Default = Default;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useImage = void 0;
|
|
4
|
-
const
|
|
4
|
+
const use_on_mount_1 = require("@uxf/core-react/hooks/use-on-mount");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const context_1 = require("./context");
|
|
7
7
|
function useImage(props) {
|
|
8
8
|
const { registerImage, unregisterImage, openGallery } = (0, context_1.useImageGalleryContext)();
|
|
9
|
-
(0,
|
|
9
|
+
(0, use_on_mount_1.useOnMount)(() => {
|
|
10
10
|
registerImage(props);
|
|
11
11
|
return () => {
|
|
12
12
|
unregisterImage(props);
|
package/input/input.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useInputFocus } from "@uxf/core/hooks/
|
|
1
|
+
import { useInputFocus } from "@uxf/core-react/hooks/use-input-focus";
|
|
2
2
|
import { InputGroupSizes, InputGroupVariants } from "@uxf/ui/input/theme";
|
|
3
3
|
import React, { CSSProperties, ReactNode, Ref } from "react";
|
|
4
4
|
export interface InputProps {
|
package/input/input.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Input = void 0;
|
|
27
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const react_1 = __importStar(require("react"));
|
|
@@ -46,7 +46,7 @@ exports.Input = (0, react_1.forwardRef)((props, ref) => {
|
|
|
46
46
|
const rightAddon = getChildrenById(children, "UxfUiInputRightAddon");
|
|
47
47
|
const leftElement = getChildrenById(children, "UxfUiInputLeftElement");
|
|
48
48
|
const rightElement = getChildrenById(children, "UxfUiInputRightElement");
|
|
49
|
-
const input = (0,
|
|
49
|
+
const input = (0, use_input_focus_1.useInputFocus)(inputRef, (_a = inputFocus === null || inputFocus === void 0 ? void 0 : inputFocus.onBlur) !== null && _a !== void 0 ? _a : mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.onBlur, (_b = inputFocus === null || inputFocus === void 0 ? void 0 : inputFocus.onFocus) !== null && _b !== void 0 ? _b : mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.onFocus);
|
|
50
50
|
const inputGroupClasses = (0, cx_1.cx)("uxf-input", leftAddon && "uxf-input--has-left-addon", leftElement && "uxf-input--has-left-element", rightElement && "uxf-input--has-right-element", rightAddon && "uxf-input--has-right-addon", isApplicable(isFocused, mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isFocused, inputFocus === null || inputFocus === void 0 ? void 0 : inputFocus.focused, input.focused) && classes_1.CLASSES.IS_FOCUSED, isApplicable(isInvalid, mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isInvalid) && classes_1.CLASSES.IS_INVALID, isApplicable(isDisabled, mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isDisabled) && classes_1.CLASSES.IS_DISABLED, isApplicable(isReadOnly, mainInput === null || mainInput === void 0 ? void 0 : mainInput.props.isReadOnly) && classes_1.CLASSES.IS_READONLY, `uxf-input--size-${size !== null && size !== void 0 ? size : "default"}`, `uxf-input--variant-${variant !== null && variant !== void 0 ? variant : "default"}`, className);
|
|
51
51
|
return (react_1.default.createElement("div", { className: inputGroupClasses, ref: wrapperRef, style: props.style, tabIndex: tabIndex },
|
|
52
52
|
leftAddon,
|
package/list-item/list-item.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseAnchorProps } from "@uxf/core/hooks/
|
|
1
|
+
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import React, { AnchorHTMLAttributes, ReactNode } from "react";
|
|
3
3
|
import { IconName } from "../icon/types";
|
|
4
4
|
export interface ListItemProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, "type">, UseAnchorProps {
|
package/list-item/list-item.js
CHANGED
|
@@ -24,14 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ListItem = void 0;
|
|
27
|
-
const
|
|
27
|
+
const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
|
|
28
28
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const icon_1 = require("../icon");
|
|
31
31
|
exports.ListItem = (0, react_1.forwardRef)((props, ref) => {
|
|
32
32
|
// eslint-disable-next-line react/destructuring-assignment
|
|
33
33
|
const { className, children, endElement, endIcon, ...restProps } = props;
|
|
34
|
-
const anchorProps = (0,
|
|
34
|
+
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
35
35
|
...restProps,
|
|
36
36
|
className: (0, cx_1.cx)("uxf-list-item", className),
|
|
37
37
|
});
|
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports._MultiComboboxBase = void 0;
|
|
27
27
|
const react_1 = require("@floating-ui/react");
|
|
28
28
|
const react_2 = require("@headlessui/react");
|
|
29
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
29
30
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
30
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
31
31
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
32
32
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
33
33
|
const last_1 = require("@uxf/core/utils/last");
|
|
@@ -72,7 +72,7 @@ exports._MultiComboboxBase = (0, react_3.forwardRef)((props, ref) => {
|
|
|
72
72
|
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "caretDown";
|
|
73
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
|
-
const input = (0,
|
|
75
|
+
const input = (0, use_input_focus_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]);
|
|
77
77
|
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 : []); };
|
|
78
78
|
const handleRemove = (valueId) => (e) => {
|
|
@@ -26,8 +26,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports._MultiSelectBase = void 0;
|
|
27
27
|
const react_1 = require("@floating-ui/react");
|
|
28
28
|
const react_2 = require("@headlessui/react");
|
|
29
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
29
30
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
30
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
31
31
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
32
32
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
33
33
|
const icon_1 = require("@uxf/ui//icon");
|
|
@@ -38,7 +38,7 @@ const react_3 = __importStar(require("react"));
|
|
|
38
38
|
exports._MultiSelectBase = (0, react_3.forwardRef)((props, ref) => {
|
|
39
39
|
var _a, _b, _c;
|
|
40
40
|
const innerRef = (0, react_3.useRef)(null);
|
|
41
|
-
const input = (0,
|
|
41
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
42
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";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxf/ui",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.20.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -17,9 +17,10 @@
|
|
|
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.20.0",
|
|
21
|
+
"@uxf/core-react": "11.20.0",
|
|
21
22
|
"@uxf/datepicker": "11.11.3",
|
|
22
|
-
"@uxf/styles": "11.
|
|
23
|
+
"@uxf/styles": "11.20.0",
|
|
23
24
|
"color2k": "2.0.3",
|
|
24
25
|
"dayjs": "1.11.10",
|
|
25
26
|
"jump.js": "1.0.2",
|
package/pagination/pagination.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Pagination = void 0;
|
|
7
|
-
const
|
|
7
|
+
const use_pagination_1 = require("@uxf/core-react/hooks/use-pagination");
|
|
8
8
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
9
9
|
const react_1 = __importDefault(require("react"));
|
|
10
10
|
const icon_1 = require("../icon");
|
|
@@ -13,7 +13,7 @@ const Pagination = (props) => {
|
|
|
13
13
|
const isCurrentPageFirst = props.page === 1;
|
|
14
14
|
const isCurrentPageLast = props.page === props.count;
|
|
15
15
|
const className = (0, cx_1.cx)("uxf-pagination", `uxf-pagination--size-${(_a = props.size) !== null && _a !== void 0 ? _a : "default"}`, props.className);
|
|
16
|
-
const pagination = (0,
|
|
16
|
+
const pagination = (0, use_pagination_1.usePagination)({
|
|
17
17
|
count: props.count,
|
|
18
18
|
page: props.page,
|
|
19
19
|
showFirstButton: true,
|
package/radio/radio.js
CHANGED
|
@@ -24,15 +24,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Radio = void 0;
|
|
27
|
+
const use_clickable_props_1 = require("@uxf/core-react/hooks/use-clickable-props");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useClickableProps_1 = require("@uxf/core/hooks/useClickableProps");
|
|
29
29
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
30
30
|
const react_1 = __importStar(require("react"));
|
|
31
31
|
exports.Radio = (0, react_1.forwardRef)((props, ref) => {
|
|
32
32
|
var _a, _b, _c;
|
|
33
33
|
const onChange = props.onChange;
|
|
34
34
|
const onClick = onChange ? () => onChange(props.value) : undefined;
|
|
35
|
-
const clickableProps = (0,
|
|
35
|
+
const clickableProps = (0, use_clickable_props_1.useClickableProps)({
|
|
36
36
|
"aria-checked": props.checked,
|
|
37
37
|
"aria-disabled": props.isDisabled,
|
|
38
38
|
"aria-invalid": props.isInvalid,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Dimension, GetImgSrcSetOptions, Quality } from "@uxf/core/utils/image";
|
|
2
|
+
import type { ImageSource } from "@uxf/core/utils/resizer";
|
|
3
|
+
import React from "react";
|
|
4
|
+
export type ImageSourcesOptions = Omit<GetImgSrcSetOptions, "quality" | "toFormat"> & {
|
|
5
|
+
isAvifDisabled?: boolean;
|
|
6
|
+
isWebPDisabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export interface ImageSourcesProps {
|
|
9
|
+
breakpointIndex?: number;
|
|
10
|
+
breakpoints?: string[];
|
|
11
|
+
height: Dimension;
|
|
12
|
+
options?: ImageSourcesOptions;
|
|
13
|
+
quality?: Quality;
|
|
14
|
+
src: ImageSource;
|
|
15
|
+
width: Dimension;
|
|
16
|
+
}
|
|
17
|
+
export declare function ImgSources(props: ImageSourcesProps): React.JSX.Element | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
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.ImgSources = void 0;
|
|
7
|
+
const hide_1 = require("@uxf/core-react/components/hide");
|
|
8
|
+
const image_1 = require("@uxf/core/utils/image");
|
|
9
|
+
const react_1 = __importDefault(require("react"));
|
|
10
|
+
function ImgSources(props) {
|
|
11
|
+
var _a, _b, _c, _d, _e;
|
|
12
|
+
if (!props.src) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const imageResponse = (0, image_1.toImageResponse)(props.src);
|
|
16
|
+
if (imageResponse && !imageResponse.uuid) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
const staticImageData = (0, image_1.toStaticImageData)(props.src);
|
|
20
|
+
if (staticImageData && !staticImageData.src) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
let media;
|
|
24
|
+
if (props.breakpoints && props.breakpointIndex) {
|
|
25
|
+
media = `(min-width: ${props.breakpoints[props.breakpointIndex]})`;
|
|
26
|
+
}
|
|
27
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
28
|
+
react_1.default.createElement(hide_1.Hide, { when: Boolean((_a = props.options) === null || _a === void 0 ? void 0 : _a.isAvifDisabled) },
|
|
29
|
+
react_1.default.createElement("source", { media: media, srcSet: (0, image_1.getImgSrcSet)(props.src, props.width, props.height, {
|
|
30
|
+
...((_b = props.options) !== null && _b !== void 0 ? _b : {}),
|
|
31
|
+
quality: (0, image_1.getImgQuality)(props.quality, "avif"),
|
|
32
|
+
toFormat: "avif",
|
|
33
|
+
}), type: "image/avif" })),
|
|
34
|
+
react_1.default.createElement(hide_1.Hide, { when: Boolean((_c = props.options) === null || _c === void 0 ? void 0 : _c.isWebPDisabled) },
|
|
35
|
+
react_1.default.createElement("source", { media: media, srcSet: (0, image_1.getImgSrcSet)(props.src, props.width, props.height, {
|
|
36
|
+
...((_d = props.options) !== null && _d !== void 0 ? _d : {}),
|
|
37
|
+
quality: (0, image_1.getImgQuality)(props.quality, "webp"),
|
|
38
|
+
toFormat: "webp",
|
|
39
|
+
}), type: "image/webp" })),
|
|
40
|
+
react_1.default.createElement("source", { media: media, srcSet: (0, image_1.getImgSrcSet)(props.src, props.width, props.height, {
|
|
41
|
+
...((_e = props.options) !== null && _e !== void 0 ? _e : {}),
|
|
42
|
+
quality: (0, image_1.getImgQuality)(props.quality, "original"),
|
|
43
|
+
}) })));
|
|
44
|
+
}
|
|
45
|
+
exports.ImgSources = ImgSources;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Quality } from "@uxf/core/utils/image";
|
|
2
2
|
import { ImageSource } from "@uxf/core/utils/resizer";
|
|
3
3
|
import { FC, ImgHTMLAttributes, ReactNode } from "react";
|
|
4
|
+
import type { ImageSourcesOptions } from "./img-sources";
|
|
4
5
|
type ImgProps = ImgHTMLAttributes<HTMLImageElement>;
|
|
5
6
|
export type RasterImageProps = {
|
|
6
7
|
alt: string;
|
|
@@ -9,6 +9,7 @@ const image_1 = require("@uxf/core/utils/image");
|
|
|
9
9
|
const resizer_1 = require("@uxf/core/utils/resizer");
|
|
10
10
|
const react_1 = __importDefault(require("react"));
|
|
11
11
|
const context_1 = require("../context");
|
|
12
|
+
const img_sources_1 = require("./img-sources");
|
|
12
13
|
const RasterImage = (props) => {
|
|
13
14
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
15
|
const componentContext = (0, context_1.useComponentContext)("rasterImage");
|
|
@@ -27,11 +28,11 @@ const RasterImage = (props) => {
|
|
|
27
28
|
react_1.default.createElement("img", { alt: props.alt, className: imgClassName, height: props.height, loading: props.loading, src: svgUrl, width: props.width })));
|
|
28
29
|
}
|
|
29
30
|
const breakpoints = ["0em", ...Object.values((_d = props.breakpoints) !== null && _d !== void 0 ? _d : componentContext.breakpoints)];
|
|
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(
|
|
31
|
+
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(img_sources_1.ImgSources, { breakpointIndex: i, breakpoints: breakpoints, height: props.heights && props.heights[i]
|
|
31
32
|
? props.heights[i]
|
|
32
33
|
: props.width && props.height
|
|
33
34
|
? Math.ceil((props.height / props.width) * w)
|
|
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(
|
|
35
|
+
: "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(img_sources_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" })),
|
|
35
36
|
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) })));
|
|
36
37
|
};
|
|
37
38
|
exports.RasterImage = RasterImage;
|
package/tabs/tabs.js
CHANGED
|
@@ -25,8 +25,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Tabs = void 0;
|
|
27
27
|
const react_1 = require("@headlessui/react");
|
|
28
|
+
const use_mouse_drag_to_scroll_1 = require("@uxf/core-react/hooks/use-mouse-drag-to-scroll");
|
|
28
29
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
29
|
-
const useMouseDragToScroll_1 = require("@uxf/core/hooks/useMouseDragToScroll");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const react_2 = __importStar(require("react"));
|
|
32
32
|
const Panel = (props) => (react_2.default.createElement("div", { className: props.className, style: props.style }, props.children));
|
|
@@ -35,7 +35,7 @@ const TabsRoot = (0, react_2.forwardRef)((props, ref) => {
|
|
|
35
35
|
var _a, _b;
|
|
36
36
|
const tabsClassName = (0, cx_1.cx)("uxf-tabs", props.grow && "uxf-tabs--grow", props.className);
|
|
37
37
|
const containerRef = (0, react_2.useRef)(null);
|
|
38
|
-
const dragStyle = (0,
|
|
38
|
+
const dragStyle = (0, use_mouse_drag_to_scroll_1.useMouseDragToScroll)(containerRef);
|
|
39
39
|
const [hasOverflow, setHasOverflow] = (0, react_2.useState)();
|
|
40
40
|
(0, react_2.useEffect)(() => {
|
|
41
41
|
const node = containerRef.current;
|
package/text-input/text-input.js
CHANGED
|
@@ -24,8 +24,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.TextInput = void 0;
|
|
27
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
27
28
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
29
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
30
30
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
31
31
|
const input_1 = require("@uxf/ui/input");
|
|
@@ -34,7 +34,7 @@ const form_component_1 = require("../form-component");
|
|
|
34
34
|
exports.TextInput = (0, react_1.forwardRef)((props, ref) => {
|
|
35
35
|
var _a, _b;
|
|
36
36
|
const innerRef = (0, react_1.useRef)(null);
|
|
37
|
-
const input = (0,
|
|
37
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
38
38
|
const generatedId = (0, react_1.useId)();
|
|
39
39
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
40
40
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
package/text-link/text-link.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UseAnchorProps } from "@uxf/core/hooks/
|
|
1
|
+
import { UseAnchorProps } from "@uxf/core-react/hooks/use-anchor-props";
|
|
2
2
|
import { TextLinkVariants } from "@uxf/ui/text-link/theme";
|
|
3
3
|
import React, { AnchorHTMLAttributes } from "react";
|
|
4
4
|
export type TextLinkVariant = keyof TextLinkVariants;
|
package/text-link/text-link.js
CHANGED
|
@@ -24,13 +24,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.TextLink = void 0;
|
|
27
|
-
const
|
|
27
|
+
const use_anchor_props_1 = require("@uxf/core-react/hooks/use-anchor-props");
|
|
28
28
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
exports.TextLink = (0, react_1.forwardRef)((props, ref) => {
|
|
31
31
|
// eslint-disable-next-line react/destructuring-assignment
|
|
32
32
|
const { className, children, variant, ...restProps } = props;
|
|
33
|
-
const anchorProps = (0,
|
|
33
|
+
const anchorProps = (0, use_anchor_props_1.useAnchorProps)({
|
|
34
34
|
...restProps,
|
|
35
35
|
className: (0, cx_1.cx)("uxf-text-link", `uxf-text-link--variant-${variant !== null && variant !== void 0 ? variant : "default"}`, className),
|
|
36
36
|
});
|
package/textarea/textarea.js
CHANGED
|
@@ -24,9 +24,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Textarea = void 0;
|
|
27
|
+
const use_input_focus_1 = require("@uxf/core-react/hooks/use-input-focus");
|
|
28
|
+
const use_latest_1 = require("@uxf/core-react/hooks/use-latest");
|
|
27
29
|
const classes_1 = require("@uxf/core/constants/classes");
|
|
28
|
-
const useInputFocus_1 = require("@uxf/core/hooks/useInputFocus");
|
|
29
|
-
const useLatest_1 = require("@uxf/core/hooks/useLatest");
|
|
30
30
|
const composeRefs_1 = require("@uxf/core/utils/composeRefs");
|
|
31
31
|
const cx_1 = require("@uxf/core/utils/cx");
|
|
32
32
|
const react_1 = __importStar(require("react"));
|
|
@@ -45,12 +45,12 @@ const EVENTS = ["input", "cut", "paste", "drop"];
|
|
|
45
45
|
exports.Textarea = (0, react_1.forwardRef)((props, ref) => {
|
|
46
46
|
var _a, _b;
|
|
47
47
|
const innerRef = (0, react_1.useRef)(null);
|
|
48
|
-
const input = (0,
|
|
48
|
+
const input = (0, use_input_focus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
49
49
|
const generatedId = (0, react_1.useId)();
|
|
50
50
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
51
51
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
52
52
|
const rootClassName = (0, cx_1.cx)("uxf-textarea", ((_b = props.isFocused) !== null && _b !== void 0 ? _b : input.focused) && classes_1.CLASSES.IS_FOCUSED, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.className);
|
|
53
|
-
const latestRows = (0,
|
|
53
|
+
const latestRows = (0, use_latest_1.useLatest)(props.rows);
|
|
54
54
|
(0, react_1.useEffect)(() => {
|
|
55
55
|
const node = innerRef.current;
|
|
56
56
|
if (!node || props.disableAutoHeight) {
|