@uxf/ui 1.0.0-beta.171 → 1.0.0-beta.173
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 +5 -4
- package/_select-base/_select-base.d.ts +3 -3
- package/_select-base/_select-base.js +22 -5
- package/css/dropdown.css +2 -0
- package/css/input-with-popover.css +14 -5
- package/css/input.css +32 -11
- package/css/multi-combobox.css +11 -3
- package/css/select-base.css +15 -38
- package/multi-combobox/_multi-combobox-base.js +3 -3
- package/multi-combobox/multi-combobox.js +2 -2
- package/multi-select/_multi-select-base.js +3 -3
- package/multi-select/multi-select.js +2 -2
- package/package.json +2 -2
|
@@ -49,7 +49,7 @@ exports._InputWithPopover = (0, react_1.forwardRef)((props, ref) => {
|
|
|
49
49
|
const innerRef = (0, react_1.useRef)(null);
|
|
50
50
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
51
51
|
const error = useErrorProps(props.error, id, props.isInvalid);
|
|
52
|
-
const rootClassName = (0, cx_1.cx)("uxf-
|
|
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_2.useFloating)({
|
|
54
54
|
placement: (_c = props.popoverPlacement) !== null && _c !== void 0 ? _c : "bottom",
|
|
55
55
|
middleware: [
|
|
@@ -72,17 +72,18 @@ exports._InputWithPopover = (0, react_1.forwardRef)((props, ref) => {
|
|
|
72
72
|
const isInteractive = !props.isDisabled && !props.isReadOnly;
|
|
73
73
|
const showRemoveButton = !!(props.value && isInteractive && props.isClearable);
|
|
74
74
|
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 },
|
|
75
|
-
react_1.default.createElement(react_3.Popover, {
|
|
75
|
+
react_1.default.createElement(react_3.Popover, { as: react_1.Fragment }, (renderProps) => (react_1.default.createElement(react_1.default.Fragment, null,
|
|
76
76
|
react_1.default.createElement(input_1.Input, { inputFocus: input, size: props.size, variant: props.variant, wrapperRef: floatingPopover.refs.setReference },
|
|
77
77
|
props.leftAddon && react_1.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
78
78
|
props.leftElement && react_1.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
79
79
|
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 }),
|
|
80
80
|
react_1.default.createElement(input_1.Input.RightElement, null,
|
|
81
81
|
showRemoveButton && react_1.default.createElement(input_1.Input.RemoveButton, { onChange: () => props.onChange("") }),
|
|
82
|
-
react_1.default.createElement(react_3.Popover.Button, { className: "uxf-
|
|
82
|
+
react_1.default.createElement(react_3.Popover.Button, { className: "uxf-input-with-popover__trigger-element" }, props.triggerElement),
|
|
83
83
|
props.rightElement),
|
|
84
84
|
props.rightAddon && react_1.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
|
|
85
85
|
isInteractive && renderProps.open && (react_1.default.createElement(react_2.FloatingPortal, null,
|
|
86
|
-
react_1.default.createElement(react_3.Popover.Panel, { className: (0, cx_1.cx)("uxf-
|
|
86
|
+
react_1.default.createElement(react_3.Popover.Panel, { className: (0, cx_1.cx)("uxf-input-with-popover__panel", floatingPopover.placement === "bottom" &&
|
|
87
|
+
"uxf-input-with-popover__panel--bottom", floatingPopover.placement === "top" && "uxf-input-with-popover__panel--top"), ref: floatingPopover.refs.setFloating, static: true, style: floatingPopover.floatingStyles }, props.children))))))));
|
|
87
88
|
});
|
|
88
89
|
exports._InputWithPopover.displayName = "UxfUiInputWithPopover";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Placement, Strategy } from "@floating-ui/react";
|
|
2
|
-
import type { Combobox, Listbox } from "@headlessui/react";
|
|
2
|
+
import type { Combobox as HUICombobox, Listbox as HUIListbox } from "@headlessui/react";
|
|
3
3
|
import { IconsSet } from "@uxf/ui/icon/theme";
|
|
4
4
|
import { Clearable, FormControlProps } from "@uxf/ui/types";
|
|
5
5
|
import React, { ReactElement, ReactNode, Ref } from "react";
|
|
@@ -38,11 +38,11 @@ export interface SelectBaseProps<Value, Option> extends FormControlProps<Value |
|
|
|
38
38
|
forwardRef?: Ref<SelectBaseTypeRef> | undefined;
|
|
39
39
|
}
|
|
40
40
|
type Props<ValueId = SelectBaseValue, Value = ValueId, Option = SelectBaseOption<ValueId>> = SelectBaseProps<Value, Option> & ({
|
|
41
|
-
HUIComponent: typeof
|
|
41
|
+
HUIComponent: typeof HUICombobox;
|
|
42
42
|
onChange?(value: Value | null): void;
|
|
43
43
|
value: Value | null;
|
|
44
44
|
} | {
|
|
45
|
-
HUIComponent: typeof
|
|
45
|
+
HUIComponent: typeof HUIListbox;
|
|
46
46
|
onChange?(value: Value | null): void;
|
|
47
47
|
value: ValueId | null;
|
|
48
48
|
});
|
|
@@ -34,6 +34,22 @@ const icon_1 = require("@uxf/ui/icon");
|
|
|
34
34
|
const input_1 = require("@uxf/ui/input");
|
|
35
35
|
const label_1 = require("@uxf/ui/label");
|
|
36
36
|
const react_2 = __importStar(require("react"));
|
|
37
|
+
function isHUICombobox(HUIComponent) {
|
|
38
|
+
return typeof HUIComponent.Input !== "undefined";
|
|
39
|
+
}
|
|
40
|
+
const InputWrapper = (props) => {
|
|
41
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
42
|
+
const { HUIComponent, children, ...restProps } = props;
|
|
43
|
+
if (isHUICombobox(HUIComponent)) {
|
|
44
|
+
return react_2.default.createElement(input_1.Input, { ...restProps }, children);
|
|
45
|
+
}
|
|
46
|
+
return (react_2.default.createElement(HUIComponent.Button, { as: input_1.Input, ...restProps }, children));
|
|
47
|
+
};
|
|
48
|
+
const InputArrow = (props) => {
|
|
49
|
+
var _a;
|
|
50
|
+
const iconName = (_a = props.iconName) !== null && _a !== void 0 ? _a : "caretDown";
|
|
51
|
+
return react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select-base__arrow-icon", props.open && classes_1.CLASSES.IS_OPEN), name: iconName });
|
|
52
|
+
};
|
|
37
53
|
const Options = (props) => {
|
|
38
54
|
const Component = props.component;
|
|
39
55
|
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, static: true, style: props.style }, props.options && props.options.length > 0 ? (props.options.map((option) => {
|
|
@@ -44,7 +60,7 @@ const Options = (props) => {
|
|
|
44
60
|
};
|
|
45
61
|
Options.displayName = "UxfUiSelectBaseOptions";
|
|
46
62
|
const _SelectBase = (props) => {
|
|
47
|
-
var _a, _b
|
|
63
|
+
var _a, _b;
|
|
48
64
|
const generatedId = (0, react_2.useId)();
|
|
49
65
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
50
66
|
const innerRef = (0, react_2.useRef)(null);
|
|
@@ -52,13 +68,13 @@ const _SelectBase = (props) => {
|
|
|
52
68
|
const input = (0, useInputFocus_1.useInputFocus)(innerRef, props.onBlur, props.onFocus);
|
|
53
69
|
const dropdown = (0, use_dropdown_1.useDropdown)((_b = props.dropdownPlacement) !== null && _b !== void 0 ? _b : "bottom", true, props.dropdownStrategy);
|
|
54
70
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, props.forwardRef, dropdown.refs.setReference), [dropdown.refs.setReference, props.forwardRef]);
|
|
55
|
-
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "chevronDown";
|
|
56
71
|
const Component = props.HUIComponent;
|
|
57
|
-
|
|
72
|
+
// const ComponentInput = typeof Component.Input.displayName === "undefined" ? Component.Button : Input;
|
|
73
|
+
return (react_2.default.createElement(Component, { as: "div", className: (0, cx_1.cx)("uxf-form-component uxf-select-base", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), disabled: props.isDisabled || props.isReadOnly, onChange: props.onChange, value: props.value }, (renderProps) => (react_2.default.createElement(react_2.default.Fragment, null,
|
|
58
74
|
react_2.default.createElement("div", { className: "uxf-form-component__label" },
|
|
59
75
|
react_2.default.createElement(Component.Label, { as: label_1.Label, isHidden: props.hiddenLabel, onClick: props.isDisabled || props.isReadOnly ? undefined : input.focus }, props.label)),
|
|
60
76
|
react_2.default.createElement("div", { className: "uxf-form-component__input" },
|
|
61
|
-
react_2.default.createElement(
|
|
77
|
+
react_2.default.createElement(InputWrapper, { HUIComponent: Component, "aria-invalid": props.isInvalid, "aria-describedby": errorId, className: (0, cx_1.cx)("uxf-select-base__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, size: props.size, variant: props.variant, wrapperRef: stableRef },
|
|
62
78
|
props.leftAddon && react_2.default.createElement(input_1.Input.LeftAddon, null, props.leftAddon),
|
|
63
79
|
props.leftElement && react_2.default.createElement(input_1.Input.LeftElement, null, props.leftElement),
|
|
64
80
|
props.children,
|
|
@@ -68,7 +84,8 @@ const _SelectBase = (props) => {
|
|
|
68
84
|
!props.isDisabled &&
|
|
69
85
|
!props.isReadOnly &&
|
|
70
86
|
props.isClearable && react_2.default.createElement(input_1.Input.RemoveButton, { onChange: props.onChange }),
|
|
71
|
-
react_2.default.createElement(
|
|
87
|
+
isHUICombobox(Component) ? (react_2.default.createElement(Component.Button, null,
|
|
88
|
+
react_2.default.createElement(InputArrow, { iconName: props.iconName, open: renderProps.open }))) : (react_2.default.createElement(InputArrow, { iconName: props.iconName, open: renderProps.open }))),
|
|
72
89
|
props.rightAddon && react_2.default.createElement(input_1.Input.RightAddon, null, props.rightAddon)),
|
|
73
90
|
renderProps.open && (react_2.default.createElement(react_1.FloatingPortal, null,
|
|
74
91
|
react_2.default.createElement(Options, { component: Component, emptyMessage: props.emptyMessage, forwardRef: dropdown.refs.setFloating, keyExtractor: props.keyExtractor, options: props.options, placement: dropdown.placement, renderOption: props.renderOption, style: dropdown.floatingStyles }))),
|
package/css/dropdown.css
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
.uxf-
|
|
2
|
-
&
|
|
3
|
-
@apply z-dropdown max-w-md
|
|
4
|
-
|
|
1
|
+
.uxf-input-with-popover {
|
|
2
|
+
&__panel {
|
|
3
|
+
@apply z-dropdown max-w-md rounded-md p-3 shadow-lg ring-1 ring-black ring-opacity-5;
|
|
4
|
+
|
|
5
|
+
overflow-y: auto;
|
|
6
|
+
|
|
7
|
+
&:focus {
|
|
8
|
+
outline: none;
|
|
9
|
+
}
|
|
5
10
|
|
|
6
11
|
:root .light & {
|
|
7
12
|
@apply bg-white text-gray-800;
|
|
@@ -21,6 +26,10 @@
|
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
&__trigger-element {
|
|
24
|
-
@apply
|
|
29
|
+
@apply w-5 h-5 rounded-sm;
|
|
30
|
+
|
|
31
|
+
align-items: center;
|
|
32
|
+
display: inline-flex;
|
|
33
|
+
justify-content: center;
|
|
25
34
|
}
|
|
26
35
|
}
|
package/css/input.css
CHANGED
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
&__element {
|
|
13
|
-
@apply
|
|
13
|
+
@apply bg-transparent placeholder:font-light;
|
|
14
|
+
|
|
15
|
+
appearance: none;
|
|
16
|
+
outline: none;
|
|
14
17
|
|
|
15
18
|
:root .light & {
|
|
16
19
|
@apply placeholder:text-gray-400;
|
|
@@ -25,6 +28,17 @@
|
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
|
|
31
|
+
&__left-element,
|
|
32
|
+
&__right-element {
|
|
33
|
+
:root .light & {
|
|
34
|
+
@apply text-lightLow;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
:root .dark & {
|
|
38
|
+
@apply text-darkLow;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
28
42
|
&__left-element {
|
|
29
43
|
@apply mr-2;
|
|
30
44
|
}
|
|
@@ -59,7 +73,7 @@
|
|
|
59
73
|
}
|
|
60
74
|
|
|
61
75
|
&__wrapper {
|
|
62
|
-
@apply rounded-md border px-
|
|
76
|
+
@apply rounded-md border px-3;
|
|
63
77
|
|
|
64
78
|
:root .light & {
|
|
65
79
|
@apply border-gray-200;
|
|
@@ -71,10 +85,19 @@
|
|
|
71
85
|
}
|
|
72
86
|
|
|
73
87
|
&__remove-button {
|
|
74
|
-
@apply
|
|
88
|
+
@apply rounded-sm;
|
|
89
|
+
|
|
90
|
+
align-items: center;
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
flex-shrink: 0;
|
|
93
|
+
justify-content: center;
|
|
75
94
|
|
|
76
95
|
&-inner {
|
|
77
|
-
@apply
|
|
96
|
+
@apply w-3.5 h-3.5 rounded-full;
|
|
97
|
+
|
|
98
|
+
align-items: center;
|
|
99
|
+
display: flex;
|
|
100
|
+
justify-content: center;
|
|
78
101
|
|
|
79
102
|
:root .light & {
|
|
80
103
|
@apply bg-gray-300;
|
|
@@ -86,7 +109,7 @@
|
|
|
86
109
|
}
|
|
87
110
|
|
|
88
111
|
&-icon {
|
|
89
|
-
@apply w-2
|
|
112
|
+
@apply w-2 h-2;
|
|
90
113
|
|
|
91
114
|
:root .light & {
|
|
92
115
|
@apply text-white;
|
|
@@ -149,7 +172,7 @@
|
|
|
149
172
|
}
|
|
150
173
|
|
|
151
174
|
&.is-disabled {
|
|
152
|
-
|
|
175
|
+
cursor: not-allowed;
|
|
153
176
|
|
|
154
177
|
:root .light & {
|
|
155
178
|
@apply bg-gray-100;
|
|
@@ -160,15 +183,15 @@
|
|
|
160
183
|
}
|
|
161
184
|
|
|
162
185
|
.uxf-input__element {
|
|
163
|
-
|
|
186
|
+
cursor: not-allowed;
|
|
164
187
|
}
|
|
165
188
|
}
|
|
166
189
|
|
|
167
190
|
&.is-readonly {
|
|
168
|
-
|
|
191
|
+
cursor: text;
|
|
169
192
|
|
|
170
193
|
.uxf-input__element {
|
|
171
|
-
|
|
194
|
+
cursor: text;
|
|
172
195
|
}
|
|
173
196
|
|
|
174
197
|
.uxf-input__wrapper {
|
|
@@ -225,8 +248,6 @@
|
|
|
225
248
|
&,
|
|
226
249
|
&:hover,
|
|
227
250
|
&:focus {
|
|
228
|
-
-webkit-appearance: none;
|
|
229
|
-
-moz-appearance: none;
|
|
230
251
|
appearance: none;
|
|
231
252
|
margin: 1px;
|
|
232
253
|
transition: background-color 5000s ease-in-out 0s !important;
|
package/css/multi-combobox.css
CHANGED
|
@@ -4,16 +4,24 @@
|
|
|
4
4
|
&__button {
|
|
5
5
|
min-height: theme("inputSize.default");
|
|
6
6
|
|
|
7
|
-
@apply relative flex flex-row w-full cursor-default flex-wrap items-center rounded-lg pl-
|
|
7
|
+
@apply relative flex flex-row w-full cursor-default flex-wrap items-center rounded-lg pl-3 pr-8 pb-[7px]
|
|
8
8
|
text-left outline-none before:absolute before:inset-0 before:pointer-events-none before:border
|
|
9
|
-
before:rounded-lg;
|
|
9
|
+
before:rounded-lg shadow-sm;
|
|
10
10
|
|
|
11
11
|
&--with-popover {
|
|
12
12
|
@apply cursor-text pb-0;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
.uxf-icon {
|
|
16
|
-
@apply absolute top-
|
|
16
|
+
@apply absolute top-1/2 -translate-y-1/2 right-3;
|
|
17
|
+
|
|
18
|
+
:root .light & {
|
|
19
|
+
@apply text-lightLow;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
:root .dark & {
|
|
23
|
+
@apply text-darkLow;
|
|
24
|
+
}
|
|
17
25
|
}
|
|
18
26
|
|
|
19
27
|
:root .light & {
|
package/css/select-base.css
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
.uxf-
|
|
1
|
+
.uxf-select-base {
|
|
2
2
|
&__button-text {
|
|
3
|
-
@apply
|
|
3
|
+
@apply truncate;
|
|
4
|
+
|
|
5
|
+
align-items: center;
|
|
6
|
+
cursor: default;
|
|
7
|
+
display: inline-flex;
|
|
8
|
+
flex-grow: 1;
|
|
9
|
+
height: 100%;
|
|
10
|
+
min-width: 0;
|
|
4
11
|
}
|
|
5
12
|
|
|
6
13
|
.uxf-input__element {
|
|
7
|
-
|
|
14
|
+
align-items: center;
|
|
15
|
+
display: flex;
|
|
16
|
+
min-width: 0;
|
|
8
17
|
|
|
9
18
|
&.is-empty {
|
|
10
19
|
@apply font-light;
|
|
@@ -29,45 +38,13 @@
|
|
|
29
38
|
}
|
|
30
39
|
}
|
|
31
40
|
|
|
32
|
-
&
|
|
33
|
-
@apply
|
|
41
|
+
&__arrow-icon {
|
|
42
|
+
@apply w-3 h-5;
|
|
34
43
|
|
|
35
|
-
:
|
|
36
|
-
@apply text-lightMedium;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:root .dark & {
|
|
40
|
-
@apply text-darkMedium;
|
|
41
|
-
}
|
|
44
|
+
z-index: 1;
|
|
42
45
|
|
|
43
46
|
&.is-open {
|
|
44
47
|
@apply -scale-y-100;
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
|
-
|
|
48
|
-
input:-webkit-autofill {
|
|
49
|
-
&,
|
|
50
|
-
&:hover,
|
|
51
|
-
&:focus {
|
|
52
|
-
-webkit-appearance: none;
|
|
53
|
-
-moz-appearance: none;
|
|
54
|
-
appearance: none;
|
|
55
|
-
margin: 1px;
|
|
56
|
-
transition: background-color 5000s ease-in-out 0s !important;
|
|
57
|
-
|
|
58
|
-
:root .dark & {
|
|
59
|
-
-webkit-text-fill-color: theme("colors.gray.300");
|
|
60
|
-
-webkit-box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
|
|
61
|
-
box-shadow: inset 0 0 0 1000px theme("colors.gray.800");
|
|
62
|
-
background-color: theme("colors.gray.800");
|
|
63
|
-
caret-color: white;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:root .light & {
|
|
67
|
-
-webkit-box-shadow: inset 0 0 0 1000px theme("colors.white");
|
|
68
|
-
box-shadow: inset 0 0 0 1000px theme("colors.white");
|
|
69
|
-
background-color: theme("colors.white");
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
50
|
}
|
|
@@ -51,7 +51,7 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
51
51
|
return (!((_a = props.value) === null || _a === void 0 ? void 0 : _a.some((v) => v.id === item.id)) || props.withCheckboxes) &&
|
|
52
52
|
(query === "" || (0, slugify_1.slugify)(item.label).includes((0, slugify_1.slugify)(query)));
|
|
53
53
|
});
|
|
54
|
-
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "
|
|
54
|
+
const iconName = (_c = props.iconName) !== null && _c !== void 0 ? _c : "caretDown";
|
|
55
55
|
const dropdown = (0, use_dropdown_1.useDropdown)((_d = props.dropdownPlacement) !== null && _d !== void 0 ? _d : "bottom", true, props.dropdownStrategy);
|
|
56
56
|
const inputRef = (0, react_2.useRef)(null);
|
|
57
57
|
const input = (0, useInputFocus_1.useInputFocus)(inputRef, props.onBlur, props.onFocus);
|
|
@@ -92,10 +92,10 @@ exports._MultiComboboxBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
92
92
|
const withoutPopover = !props.withPopover;
|
|
93
93
|
return (react_2.default.createElement(react_1.Combobox, { as: "div", by: "id", className: (0, cx_1.cx)(withoutPopover && "uxf-form-component", "uxf-multi-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), disabled: props.isDisabled || props.isReadOnly, multiple: true, onChange: handleComboboxValueChange, value: selectedOptions }, (renderProps) => {
|
|
94
94
|
const inputElement = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
95
|
-
react_2.default.createElement(react_1.Combobox.Button, { "aria-invalid": props.isInvalid, "aria-describedby": props.errorId, as: "div", className: (0, cx_1.cx)("uxf-multi-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" &&
|
|
95
|
+
react_2.default.createElement(react_1.Combobox.Button, { "aria-invalid": props.isInvalid, "aria-describedby": props.errorId, as: "div", className: (0, cx_1.cx)("uxf-multi-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && `${classes_1.CLASSES.IS_OPEN}--bottom`, dropdown.placement === "top" && `${classes_1.CLASSES.IS_OPEN}--top`, renderProps.open && classes_1.CLASSES.IS_OPEN), onBlur: input.onBlur, onFocus: input.onFocus, ref: stableRef },
|
|
96
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))),
|
|
97
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 }),
|
|
98
|
-
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-
|
|
98
|
+
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select-base__arrow-icon", (props.withPopover ? props.isPopoverOpen : renderProps.open) && classes_1.CLASSES.IS_OPEN), name: iconName })),
|
|
99
99
|
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
100
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"), ref: dropdown.refs.setFloating, static: true, style: dropdown.floatingStyles }, filteredData.length > 0 ? (filteredData.map((option) => {
|
|
101
101
|
var _a, _b, _c, _d;
|
|
@@ -37,7 +37,7 @@ exports.MultiCombobox = (0, react_2.forwardRef)((props, ref) => {
|
|
|
37
37
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
38
38
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
39
39
|
const fakeInputId = `${id}--fake-input`;
|
|
40
|
-
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "
|
|
40
|
+
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "caretDown";
|
|
41
41
|
const selectedOptions = (_c = props.value) !== null && _c !== void 0 ? _c : [];
|
|
42
42
|
const fakeInputRef = (0, react_2.useRef)(null);
|
|
43
43
|
const handlePopoverButtonKeyPress = (e) => {
|
|
@@ -60,7 +60,7 @@ exports.MultiCombobox = (0, react_2.forwardRef)((props, ref) => {
|
|
|
60
60
|
"uxf-multi-combobox__input-placeholder--with-popover") }, selectedOptions.length > 0
|
|
61
61
|
? selectedOptions.map((e) => e.label).join(", ")
|
|
62
62
|
: props.placeholder),
|
|
63
|
-
react_2.default.createElement(icon_1.Icon, { className: "uxf-
|
|
63
|
+
react_2.default.createElement(icon_1.Icon, { className: "uxf-select-base__arrow-icon", name: iconName })),
|
|
64
64
|
react_2.default.createElement(react_1.Popover.Panel, { className: "uxf-multi-combobox__popover-panel", focus: popoverRenderProps.open, unmount: false },
|
|
65
65
|
react_2.default.createElement(_multi_combobox_base_1._MultiComboboxBase, { ...props, errorId: errorId, isPopoverOpen: popoverRenderProps.open, ref: ref, withPopover: true })))))));
|
|
66
66
|
});
|
|
@@ -41,7 +41,7 @@ exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
41
41
|
const input = (0, useInputFocus_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.dropdownStrategy);
|
|
43
43
|
const stableRef = (0, react_2.useMemo)(() => (0, composeRefs_1.composeRefs)(innerRef, ref, dropdown.refs.setReference), [ref, dropdown.refs.setReference]);
|
|
44
|
-
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "
|
|
44
|
+
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "caretDown";
|
|
45
45
|
const selectedOptions = (_c = props.value) !== null && _c !== void 0 ? _c : [];
|
|
46
46
|
const filteredOptions = props.options.filter((option) => !selectedOptions.map((i) => i.id).includes(option.id));
|
|
47
47
|
const handleSelectValueChange = (v) => {
|
|
@@ -56,11 +56,11 @@ exports._MultiSelectBase = (0, react_2.forwardRef)((props, ref) => {
|
|
|
56
56
|
const withoutPopover = !props.withPopover;
|
|
57
57
|
return (react_2.default.createElement(react_1.Listbox, { as: "div", className: (0, cx_1.cx)(withoutPopover && "uxf-form-component", "uxf-multi-combobox", props.isInvalid && classes_1.CLASSES.IS_INVALID, props.isRequired && classes_1.CLASSES.IS_REQUIRED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isDisabled && classes_1.CLASSES.IS_DISABLED, props.className), disabled: props.isDisabled || props.isReadOnly, multiple: true, onChange: handleSelectValueChange, value: selectedOptions }, (renderProps) => {
|
|
58
58
|
const inputElement = (react_2.default.createElement(react_2.default.Fragment, null,
|
|
59
|
-
react_2.default.createElement(react_1.Listbox.Button, { as: "div", className: (0, cx_1.cx)("uxf-multi-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" &&
|
|
59
|
+
react_2.default.createElement(react_1.Listbox.Button, { "aria-invalid": props.isInvalid, "aria-describedby": props.errorId, as: "div", className: (0, cx_1.cx)("uxf-multi-combobox__button", (renderProps.open || input.focused) && classes_1.CLASSES.IS_FOCUSED, renderProps.disabled && classes_1.CLASSES.IS_DISABLED, props.isReadOnly && classes_1.CLASSES.IS_READONLY, props.isInvalid && classes_1.CLASSES.IS_INVALID, dropdown.placement === "bottom" && `${classes_1.CLASSES.IS_OPEN}--bottom`, dropdown.placement === "top" && `${classes_1.CLASSES.IS_OPEN}--top`, renderProps.open && classes_1.CLASSES.IS_OPEN), onBlur: input.onBlur, onFocus: input.onFocus, tabIndex: props.isDisabled || props.isReadOnly ? undefined : 0, ref: stableRef },
|
|
60
60
|
react_2.default.createElement("div", { className: (0, cx_1.cx)("uxf-multi-select__input", selectedOptions.length === 0 && "uxf-multi-select__input--is-empty") }, selectedOptions.length === 0
|
|
61
61
|
? props.placeholder
|
|
62
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)))),
|
|
63
|
-
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-
|
|
63
|
+
react_2.default.createElement(icon_1.Icon, { className: (0, cx_1.cx)("uxf-select-base__arrow-icon", renderProps.open && classes_1.CLASSES.IS_OPEN), name: iconName })),
|
|
64
64
|
renderProps.open && (react_2.default.createElement(react_3.FloatingPortal, null,
|
|
65
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.setFloating, static: true, style: dropdown.floatingStyles }, filteredOptions.map((option) => {
|
|
66
66
|
var _a;
|
|
@@ -36,7 +36,7 @@ exports.MultiSelect = (0, react_2.forwardRef)((props, ref) => {
|
|
|
36
36
|
const generatedId = (0, react_2.useId)();
|
|
37
37
|
const id = (_a = props.id) !== null && _a !== void 0 ? _a : generatedId;
|
|
38
38
|
const errorId = props.isInvalid ? `${id}--error-message` : undefined;
|
|
39
|
-
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "
|
|
39
|
+
const iconName = (_b = props.iconName) !== null && _b !== void 0 ? _b : "caretDown";
|
|
40
40
|
const selectedOptions = (_c = props.value) !== null && _c !== void 0 ? _c : [];
|
|
41
41
|
if (!props.withPopover) {
|
|
42
42
|
return react_2.default.createElement(_multi_select_base_1._MultiSelectBase, { ...props, errorId: errorId, id: id, ref: ref });
|
|
@@ -48,7 +48,7 @@ exports.MultiSelect = (0, react_2.forwardRef)((props, ref) => {
|
|
|
48
48
|
"uxf-multi-combobox__input-placeholder--with-popover") }, selectedOptions.length > 0
|
|
49
49
|
? selectedOptions.map((e) => e.label).join(", ")
|
|
50
50
|
: props.placeholder),
|
|
51
|
-
react_2.default.createElement(icon_1.Icon, { className: "uxf-
|
|
51
|
+
react_2.default.createElement(icon_1.Icon, { className: "uxf-select-base__arrow-icon", name: iconName })),
|
|
52
52
|
react_2.default.createElement(react_1.Popover.Panel, { className: "uxf-multi-combobox__popover-panel", focus: popoverRenderProps.open, unmount: false },
|
|
53
53
|
react_2.default.createElement(_multi_select_base_1._MultiSelectBase, { ...props, errorId: errorId, isPopoverOpen: popoverRenderProps.open, ref: ref, withPopover: true })))))));
|
|
54
54
|
});
|
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.173",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@floating-ui/react": "0.24.2",
|
|
17
|
-
"@headlessui/react": "1.7.
|
|
17
|
+
"@headlessui/react": "1.7.14",
|
|
18
18
|
"@uxf/core": "4.5.1",
|
|
19
19
|
"@uxf/datepicker": "1.2.1",
|
|
20
20
|
"@uxf/styles": "2.1.2",
|