@westpac/ui 0.57.4 → 0.59.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/CHANGELOG.md +12 -0
- package/dist/component-type.json +1 -1
- package/dist/components/compacta/compacta.component.d.ts +1 -1
- package/dist/components/compacta/compacta.component.js +21 -1
- package/dist/components/compacta/compacta.types.d.ts +12 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.component.js +20 -0
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.styles.d.ts +37 -0
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.styles.js +8 -0
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.types.d.ts +5 -0
- package/dist/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.types.js +1 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.component.js +31 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.styles.d.ts +25 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.styles.js +6 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.types.d.ts +4 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.types.js +1 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.component.js +62 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.styles.d.ts +82 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.styles.js +32 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.types.d.ts +8 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.types.js +1 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.component.d.ts +1 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.component.js +93 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.styles.d.ts +64 -0
- package/dist/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.styles.js +26 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.component.js +35 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.styles.d.ts +43 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.styles.js +9 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.types.d.ts +5 -0
- package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.types.js +1 -0
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.component.js +118 -0
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.styles.d.ts +263 -0
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.styles.js +99 -0
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.types.d.ts +15 -0
- package/dist/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.types.js +1 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.component.js +52 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.styles.d.ts +31 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.styles.js +7 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.types.d.ts +6 -0
- package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.types.js +1 -0
- package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.component.d.ts +2 -0
- package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.component.js +74 -0
- package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.styles.d.ts +31 -0
- package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.styles.js +7 -0
- package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.types.d.ts +6 -0
- package/dist/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.types.js +1 -0
- package/dist/components/multi-select/index.d.ts +2 -0
- package/dist/components/multi-select/index.js +1 -0
- package/dist/components/multi-select/multi-select.component.d.ts +7 -0
- package/dist/components/multi-select/multi-select.component.js +95 -0
- package/dist/components/multi-select/multi-select.styles.d.ts +25 -0
- package/dist/components/multi-select/multi-select.styles.js +6 -0
- package/dist/components/multi-select/multi-select.types.d.ts +61 -0
- package/dist/components/multi-select/multi-select.types.js +1 -0
- package/dist/components/multi-select/utils/filter-nodes.d.ts +2 -0
- package/dist/components/multi-select/utils/filter-nodes.js +25 -0
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.component.d.ts +1 -1
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.component.js +4 -2
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.styles.d.ts +16 -1
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.styles.js +7 -1
- package/dist/components/tooltip/components/tooltip-content/tooltip-content.types.d.ts +1 -0
- package/dist/components/tooltip/tooltip.component.d.ts +1 -1
- package/dist/components/tooltip/tooltip.component.js +4 -3
- package/dist/components/tooltip/tooltip.types.d.ts +3 -0
- package/dist/css/westpac-ui.css +366 -0
- package/dist/css/westpac-ui.min.css +366 -0
- package/package.json +4 -1
- package/src/components/compacta/compacta.component.tsx +21 -0
- package/src/components/compacta/compacta.types.ts +10 -0
- package/src/components/index.ts +1 -0
- package/src/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.component.tsx +26 -0
- package/src/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.styles.ts +9 -0
- package/src/components/multi-select/components/multi-select-dropdown/multi-select-dropdown.types.ts +6 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.component.tsx +42 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.styles.ts +7 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-list-box-section/multi-select-list-box-section.types.ts +5 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.component.tsx +66 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.styles.ts +33 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-option/multi-select-option.types.ts +7 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.component.tsx +105 -0
- package/src/components/multi-select/components/multi-select-list-box/components/multi-select-select-all-option/multi-select-select-all-option.styles.ts +22 -0
- package/src/components/multi-select/components/multi-select-list-box/multi-select-list-box.component.tsx +42 -0
- package/src/components/multi-select/components/multi-select-list-box/multi-select-list-box.styles.ts +10 -0
- package/src/components/multi-select/components/multi-select-list-box/multi-select-list-box.types.ts +6 -0
- package/src/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.component.tsx +136 -0
- package/src/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.styles.ts +74 -0
- package/src/components/multi-select/components/multi-select-list-box-trigger/multi-select-list-box-trigger.types.ts +19 -0
- package/src/components/multi-select/components/multi-select-popover/multi-select-popover.component.tsx +64 -0
- package/src/components/multi-select/components/multi-select-popover/multi-select-popover.styles.ts +8 -0
- package/src/components/multi-select/components/multi-select-popover/multi-select-popover.types.ts +8 -0
- package/src/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.component.tsx +81 -0
- package/src/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.styles.ts +8 -0
- package/src/components/multi-select/components/multi-select-searchbar/multi-select-searchbar.types.ts +7 -0
- package/src/components/multi-select/index.ts +2 -0
- package/src/components/multi-select/multi-select.component.tsx +116 -0
- package/src/components/multi-select/multi-select.styles.ts +7 -0
- package/src/components/multi-select/multi-select.types.ts +60 -0
- package/src/components/multi-select/utils/filter-nodes.ts +29 -0
- package/src/components/tooltip/components/tooltip-content/tooltip-content.component.tsx +2 -2
- package/src/components/tooltip/components/tooltip-content/tooltip-content.styles.ts +6 -0
- package/src/components/tooltip/components/tooltip-content/tooltip-content.types.ts +1 -0
- package/src/components/tooltip/tooltip.component.tsx +7 -3
- package/src/components/tooltip/tooltip.types.ts +4 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
4
|
+
ul?: import("tailwind-variants").ClassValue;
|
|
5
|
+
checkbox?: import("tailwind-variants").ClassValue;
|
|
6
|
+
container?: import("tailwind-variants").ClassValue;
|
|
7
|
+
noItemsText?: import("tailwind-variants").ClassValue;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
[x: string]: {
|
|
12
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
13
|
+
ul?: import("tailwind-variants").ClassValue;
|
|
14
|
+
checkbox?: import("tailwind-variants").ClassValue;
|
|
15
|
+
container?: import("tailwind-variants").ClassValue;
|
|
16
|
+
noItemsText?: import("tailwind-variants").ClassValue;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
} | {}, {
|
|
20
|
+
container: string;
|
|
21
|
+
checkbox: string;
|
|
22
|
+
ul: string;
|
|
23
|
+
noItemsText: string;
|
|
24
|
+
}, undefined, TVConfig<V, EV>, {
|
|
25
|
+
[key: string]: {
|
|
26
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
27
|
+
ul?: import("tailwind-variants").ClassValue;
|
|
28
|
+
checkbox?: import("tailwind-variants").ClassValue;
|
|
29
|
+
container?: import("tailwind-variants").ClassValue;
|
|
30
|
+
noItemsText?: import("tailwind-variants").ClassValue;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
} | {}, {
|
|
34
|
+
container: string;
|
|
35
|
+
checkbox: string;
|
|
36
|
+
ul: string;
|
|
37
|
+
noItemsText: string;
|
|
38
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
39
|
+
container: string;
|
|
40
|
+
checkbox: string;
|
|
41
|
+
ul: string;
|
|
42
|
+
noItemsText: string;
|
|
43
|
+
}, undefined, TVConfig<V, EV>, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const styles = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
container: 'max-h-[432px] overflow-auto',
|
|
5
|
+
checkbox: 'flex size-4 items-center justify-center rounded border border-border',
|
|
6
|
+
ul: 'w-full outline-none',
|
|
7
|
+
noItemsText: 'typography-body-9 px-2 py-3 text-text'
|
|
8
|
+
}
|
|
9
|
+
});
|
package/dist/components/multi-select/components/multi-select-list-box/multi-select-list-box.types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { MultiSelectListBoxTriggerProps } from './multi-select-list-box-trigger.types.js';
|
|
2
|
+
export declare function MultiSelectListBoxTrigger<T>({ placeholder, showSingleSectionTitle, selectedKeys, triggerProps, id, }: MultiSelectListBoxTriggerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
|
2
|
+
import { mergeProps, useButton, useFocusRing } from 'react-aria';
|
|
3
|
+
import { Button } from '../../../button/button.component.js';
|
|
4
|
+
import { DropDownIcon, ClearIcon } from '../../../icon/index.js';
|
|
5
|
+
import { Tooltip } from '../../../tooltip/tooltip.component.js';
|
|
6
|
+
import { MultiSelectContext } from '../../multi-select.component.js';
|
|
7
|
+
import { styles as triggerStyles } from './multi-select-list-box-trigger.styles.js';
|
|
8
|
+
export function MultiSelectListBoxTrigger({ placeholder, showSingleSectionTitle, selectedKeys, triggerProps, id }) {
|
|
9
|
+
const { size, overlayState, listState, buttonRef, inputRef } = useContext(MultiSelectContext);
|
|
10
|
+
const selectionMode = listState.selectionManager.selectionMode;
|
|
11
|
+
const { buttonProps } = useButton(triggerProps, buttonRef);
|
|
12
|
+
const { focusProps, isFocusVisible } = useFocusRing();
|
|
13
|
+
const [selectedValues, setSelectedValues] = useState([]);
|
|
14
|
+
const [sectionTitle, setSectionTitle] = useState(undefined);
|
|
15
|
+
const finalButtonProps = mergeProps(focusProps, buttonProps);
|
|
16
|
+
const styles = triggerStyles({
|
|
17
|
+
size,
|
|
18
|
+
isFocusVisible
|
|
19
|
+
});
|
|
20
|
+
const getSectionTitle = useCallback((key)=>{
|
|
21
|
+
const parentKey = key !== null && key !== void 0 ? key : '';
|
|
22
|
+
const item = listState.collection.getItem(parentKey);
|
|
23
|
+
if (!item) return undefined;
|
|
24
|
+
const title = item.props.title;
|
|
25
|
+
return title;
|
|
26
|
+
}, [
|
|
27
|
+
listState.collection
|
|
28
|
+
]);
|
|
29
|
+
const handleTriggerKeyDown = useCallback((e)=>{
|
|
30
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
31
|
+
var _inputRef_current;
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
overlayState.open();
|
|
34
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
35
|
+
}
|
|
36
|
+
}, [
|
|
37
|
+
overlayState
|
|
38
|
+
]);
|
|
39
|
+
useEffect(()=>{
|
|
40
|
+
if (!selectedKeys || typeof selectedKeys === 'string' || selectedKeys instanceof Set && selectedKeys.size === 0) {
|
|
41
|
+
setSelectedValues([]);
|
|
42
|
+
} else {
|
|
43
|
+
const currentMap = new Map(selectedValues.map((item)=>[
|
|
44
|
+
item.key,
|
|
45
|
+
item.value
|
|
46
|
+
]));
|
|
47
|
+
const next = [];
|
|
48
|
+
for (const key of [
|
|
49
|
+
...selectedKeys
|
|
50
|
+
]){
|
|
51
|
+
if (currentMap.has(key)) {
|
|
52
|
+
next.push({
|
|
53
|
+
key,
|
|
54
|
+
value: currentMap.get(key)
|
|
55
|
+
});
|
|
56
|
+
} else {
|
|
57
|
+
var _listState_collection_getItem;
|
|
58
|
+
next.push({
|
|
59
|
+
key,
|
|
60
|
+
value: (_listState_collection_getItem = listState.collection.getItem(key)) === null || _listState_collection_getItem === void 0 ? void 0 : _listState_collection_getItem.textValue
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (selectionMode === 'single' && showSingleSectionTitle) {
|
|
65
|
+
var _listState_collection_getItem1;
|
|
66
|
+
const firstKey = [
|
|
67
|
+
...selectedKeys
|
|
68
|
+
][0];
|
|
69
|
+
const parentKey = (_listState_collection_getItem1 = listState.collection.getItem(firstKey)) === null || _listState_collection_getItem1 === void 0 ? void 0 : _listState_collection_getItem1.parentKey;
|
|
70
|
+
const title = parentKey ? getSectionTitle(parentKey) : undefined;
|
|
71
|
+
setSectionTitle(title);
|
|
72
|
+
}
|
|
73
|
+
setSelectedValues(next);
|
|
74
|
+
}
|
|
75
|
+
}, [
|
|
76
|
+
selectedKeys
|
|
77
|
+
]);
|
|
78
|
+
const valuesString = selectionMode === 'single' && selectedValues.length > 0 && showSingleSectionTitle && sectionTitle ? `${sectionTitle}: ${selectedValues[0].value}` : selectedValues.map((node)=>node.value || '').join(', ');
|
|
79
|
+
return React.createElement(React.Fragment, null, React.createElement(Tooltip, {
|
|
80
|
+
tooltip: valuesString,
|
|
81
|
+
position: "top"
|
|
82
|
+
}, React.createElement("div", {
|
|
83
|
+
className: styles.buttonContainer()
|
|
84
|
+
}, React.createElement("button", {
|
|
85
|
+
className: styles.control(),
|
|
86
|
+
ref: buttonRef,
|
|
87
|
+
...finalButtonProps,
|
|
88
|
+
onKeyDown: handleTriggerKeyDown,
|
|
89
|
+
type: "button",
|
|
90
|
+
role: "combobox",
|
|
91
|
+
"aria-autocomplete": "list",
|
|
92
|
+
tabIndex: undefined,
|
|
93
|
+
"aria-haspopup": "dialog",
|
|
94
|
+
id: id
|
|
95
|
+
}, React.createElement("div", {
|
|
96
|
+
className: styles.selection()
|
|
97
|
+
}, React.createElement("span", {
|
|
98
|
+
className: styles.selectionSpan()
|
|
99
|
+
}, selectedValues.length > 0 ? valuesString : placeholder)), React.createElement("div", {
|
|
100
|
+
className: styles.button()
|
|
101
|
+
}, React.createElement(DropDownIcon, {
|
|
102
|
+
color: "muted",
|
|
103
|
+
size: "medium",
|
|
104
|
+
"aria-hidden": "true"
|
|
105
|
+
}))), selectedValues.length > 0 && React.createElement(Button, {
|
|
106
|
+
className: styles.clearButton(),
|
|
107
|
+
look: "unstyled",
|
|
108
|
+
onClick: ()=>{
|
|
109
|
+
listState.selectionManager.clearSelection();
|
|
110
|
+
}
|
|
111
|
+
}, React.createElement(ClearIcon, {
|
|
112
|
+
className: styles.clearIcon(),
|
|
113
|
+
size: "small",
|
|
114
|
+
color: "muted"
|
|
115
|
+
})))), selectedValues.length > 0 && selectionMode === 'multiple' && React.createElement("p", {
|
|
116
|
+
className: styles.hint()
|
|
117
|
+
}, selectedValues.length, " item", selectedValues.length > 1 && 's', " selected"));
|
|
118
|
+
}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
size: {
|
|
3
|
+
small: {
|
|
4
|
+
control: string;
|
|
5
|
+
button: string;
|
|
6
|
+
clearButton: string;
|
|
7
|
+
};
|
|
8
|
+
medium: {
|
|
9
|
+
control: string;
|
|
10
|
+
button: string;
|
|
11
|
+
clearButton: string;
|
|
12
|
+
};
|
|
13
|
+
large: {
|
|
14
|
+
control: string;
|
|
15
|
+
button: string;
|
|
16
|
+
clearButton: string;
|
|
17
|
+
};
|
|
18
|
+
xlarge: {
|
|
19
|
+
control: string;
|
|
20
|
+
button: string;
|
|
21
|
+
clearButton: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
invalid: {
|
|
25
|
+
true: {
|
|
26
|
+
control: string;
|
|
27
|
+
};
|
|
28
|
+
false: {
|
|
29
|
+
control: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
isFocusVisible: {
|
|
33
|
+
true: {
|
|
34
|
+
control: string;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
width: {
|
|
38
|
+
full: {
|
|
39
|
+
control: string;
|
|
40
|
+
};
|
|
41
|
+
1: {
|
|
42
|
+
control: string;
|
|
43
|
+
};
|
|
44
|
+
2: {
|
|
45
|
+
control: string;
|
|
46
|
+
};
|
|
47
|
+
3: {
|
|
48
|
+
control: string;
|
|
49
|
+
};
|
|
50
|
+
4: {
|
|
51
|
+
control: string;
|
|
52
|
+
};
|
|
53
|
+
5: {
|
|
54
|
+
control: string;
|
|
55
|
+
};
|
|
56
|
+
6: {
|
|
57
|
+
control: string;
|
|
58
|
+
};
|
|
59
|
+
7: {
|
|
60
|
+
control: string;
|
|
61
|
+
};
|
|
62
|
+
8: {
|
|
63
|
+
control: string;
|
|
64
|
+
};
|
|
65
|
+
9: {
|
|
66
|
+
control: string;
|
|
67
|
+
};
|
|
68
|
+
10: {
|
|
69
|
+
control: string;
|
|
70
|
+
};
|
|
71
|
+
20: {
|
|
72
|
+
control: string;
|
|
73
|
+
};
|
|
74
|
+
30: {
|
|
75
|
+
control: string;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
}, {
|
|
79
|
+
buttonContainer: string;
|
|
80
|
+
control: string;
|
|
81
|
+
selection: string;
|
|
82
|
+
selectionSpan: string;
|
|
83
|
+
hint: string;
|
|
84
|
+
button: string;
|
|
85
|
+
clearButton: string;
|
|
86
|
+
clearIcon: string;
|
|
87
|
+
}, undefined, {
|
|
88
|
+
responsiveVariants: string[];
|
|
89
|
+
}, {
|
|
90
|
+
size: {
|
|
91
|
+
small: {
|
|
92
|
+
control: string;
|
|
93
|
+
button: string;
|
|
94
|
+
clearButton: string;
|
|
95
|
+
};
|
|
96
|
+
medium: {
|
|
97
|
+
control: string;
|
|
98
|
+
button: string;
|
|
99
|
+
clearButton: string;
|
|
100
|
+
};
|
|
101
|
+
large: {
|
|
102
|
+
control: string;
|
|
103
|
+
button: string;
|
|
104
|
+
clearButton: string;
|
|
105
|
+
};
|
|
106
|
+
xlarge: {
|
|
107
|
+
control: string;
|
|
108
|
+
button: string;
|
|
109
|
+
clearButton: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
invalid: {
|
|
113
|
+
true: {
|
|
114
|
+
control: string;
|
|
115
|
+
};
|
|
116
|
+
false: {
|
|
117
|
+
control: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
isFocusVisible: {
|
|
121
|
+
true: {
|
|
122
|
+
control: string;
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
width: {
|
|
126
|
+
full: {
|
|
127
|
+
control: string;
|
|
128
|
+
};
|
|
129
|
+
1: {
|
|
130
|
+
control: string;
|
|
131
|
+
};
|
|
132
|
+
2: {
|
|
133
|
+
control: string;
|
|
134
|
+
};
|
|
135
|
+
3: {
|
|
136
|
+
control: string;
|
|
137
|
+
};
|
|
138
|
+
4: {
|
|
139
|
+
control: string;
|
|
140
|
+
};
|
|
141
|
+
5: {
|
|
142
|
+
control: string;
|
|
143
|
+
};
|
|
144
|
+
6: {
|
|
145
|
+
control: string;
|
|
146
|
+
};
|
|
147
|
+
7: {
|
|
148
|
+
control: string;
|
|
149
|
+
};
|
|
150
|
+
8: {
|
|
151
|
+
control: string;
|
|
152
|
+
};
|
|
153
|
+
9: {
|
|
154
|
+
control: string;
|
|
155
|
+
};
|
|
156
|
+
10: {
|
|
157
|
+
control: string;
|
|
158
|
+
};
|
|
159
|
+
20: {
|
|
160
|
+
control: string;
|
|
161
|
+
};
|
|
162
|
+
30: {
|
|
163
|
+
control: string;
|
|
164
|
+
};
|
|
165
|
+
};
|
|
166
|
+
}, {
|
|
167
|
+
buttonContainer: string;
|
|
168
|
+
control: string;
|
|
169
|
+
selection: string;
|
|
170
|
+
selectionSpan: string;
|
|
171
|
+
hint: string;
|
|
172
|
+
button: string;
|
|
173
|
+
clearButton: string;
|
|
174
|
+
clearIcon: string;
|
|
175
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
176
|
+
size: {
|
|
177
|
+
small: {
|
|
178
|
+
control: string;
|
|
179
|
+
button: string;
|
|
180
|
+
clearButton: string;
|
|
181
|
+
};
|
|
182
|
+
medium: {
|
|
183
|
+
control: string;
|
|
184
|
+
button: string;
|
|
185
|
+
clearButton: string;
|
|
186
|
+
};
|
|
187
|
+
large: {
|
|
188
|
+
control: string;
|
|
189
|
+
button: string;
|
|
190
|
+
clearButton: string;
|
|
191
|
+
};
|
|
192
|
+
xlarge: {
|
|
193
|
+
control: string;
|
|
194
|
+
button: string;
|
|
195
|
+
clearButton: string;
|
|
196
|
+
};
|
|
197
|
+
};
|
|
198
|
+
invalid: {
|
|
199
|
+
true: {
|
|
200
|
+
control: string;
|
|
201
|
+
};
|
|
202
|
+
false: {
|
|
203
|
+
control: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
isFocusVisible: {
|
|
207
|
+
true: {
|
|
208
|
+
control: string;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
width: {
|
|
212
|
+
full: {
|
|
213
|
+
control: string;
|
|
214
|
+
};
|
|
215
|
+
1: {
|
|
216
|
+
control: string;
|
|
217
|
+
};
|
|
218
|
+
2: {
|
|
219
|
+
control: string;
|
|
220
|
+
};
|
|
221
|
+
3: {
|
|
222
|
+
control: string;
|
|
223
|
+
};
|
|
224
|
+
4: {
|
|
225
|
+
control: string;
|
|
226
|
+
};
|
|
227
|
+
5: {
|
|
228
|
+
control: string;
|
|
229
|
+
};
|
|
230
|
+
6: {
|
|
231
|
+
control: string;
|
|
232
|
+
};
|
|
233
|
+
7: {
|
|
234
|
+
control: string;
|
|
235
|
+
};
|
|
236
|
+
8: {
|
|
237
|
+
control: string;
|
|
238
|
+
};
|
|
239
|
+
9: {
|
|
240
|
+
control: string;
|
|
241
|
+
};
|
|
242
|
+
10: {
|
|
243
|
+
control: string;
|
|
244
|
+
};
|
|
245
|
+
20: {
|
|
246
|
+
control: string;
|
|
247
|
+
};
|
|
248
|
+
30: {
|
|
249
|
+
control: string;
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
}, {
|
|
253
|
+
buttonContainer: string;
|
|
254
|
+
control: string;
|
|
255
|
+
selection: string;
|
|
256
|
+
selectionSpan: string;
|
|
257
|
+
hint: string;
|
|
258
|
+
button: string;
|
|
259
|
+
clearButton: string;
|
|
260
|
+
clearIcon: string;
|
|
261
|
+
}, undefined, {
|
|
262
|
+
responsiveVariants: string[];
|
|
263
|
+
}, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
export const styles = tv({
|
|
3
|
+
slots: {
|
|
4
|
+
buttonContainer: 'relative w-full',
|
|
5
|
+
control: 'form-control relative box-border inline-flex w-full flex-row overflow-hidden rounded',
|
|
6
|
+
selection: 'flex flex-1 items-center overflow-hidden whitespace-nowrap pr-4.5 text-left',
|
|
7
|
+
selectionSpan: 'w-full overflow-hidden text-ellipsis',
|
|
8
|
+
hint: 'typography-body-10 text-muted',
|
|
9
|
+
button: 'flex cursor-default items-center justify-center rounded-r border-l border-l-borderDark bg-white',
|
|
10
|
+
clearButton: 'absolute inset-y-0 flex !h-auto items-center justify-center',
|
|
11
|
+
clearIcon: '-mt-0.5'
|
|
12
|
+
},
|
|
13
|
+
variants: {
|
|
14
|
+
size: {
|
|
15
|
+
small: {
|
|
16
|
+
control: 'form-control-small min-h-5 group-[.input-group-inset-after]:pr-6 group-[.input-group-inset-before]:pl-6',
|
|
17
|
+
button: '-mb-[0.25rem] -mr-1.5 -mt-0.5 px-0.5',
|
|
18
|
+
clearButton: 'right-6.5'
|
|
19
|
+
},
|
|
20
|
+
medium: {
|
|
21
|
+
control: 'form-control-medium min-h-6 group-[.input-group-inset-after]:pr-7 group-[.input-group-inset-before]:pl-7',
|
|
22
|
+
button: '-my-[0.3125rem] -mr-2 px-1.5',
|
|
23
|
+
clearButton: 'right-8.5'
|
|
24
|
+
},
|
|
25
|
+
large: {
|
|
26
|
+
control: 'form-control-large min-h-7 group-[.input-group-inset-after]:pr-8 group-[.input-group-inset-before]:pl-8',
|
|
27
|
+
button: '-my-[0.5rem] -mr-2.5 px-1.5',
|
|
28
|
+
clearButton: 'right-8.5'
|
|
29
|
+
},
|
|
30
|
+
xlarge: {
|
|
31
|
+
control: 'form-control-xlarge min-h-8 group-[.input-group-inset-after]:pr-9 group-[.input-group-inset-before]:pl-9',
|
|
32
|
+
button: '-mb-[0.625rem] -mr-3 -mt-1.5 px-2',
|
|
33
|
+
clearButton: 'right-9.5'
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
invalid: {
|
|
37
|
+
true: {
|
|
38
|
+
control: 'border-danger'
|
|
39
|
+
},
|
|
40
|
+
false: {
|
|
41
|
+
control: 'border-borderDark'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
isFocusVisible: {
|
|
45
|
+
true: {
|
|
46
|
+
control: 'focus-outline'
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
width: {
|
|
50
|
+
full: {
|
|
51
|
+
control: 'w-full'
|
|
52
|
+
},
|
|
53
|
+
1: {
|
|
54
|
+
control: 'box-content w-[1.81ex]'
|
|
55
|
+
},
|
|
56
|
+
2: {
|
|
57
|
+
control: 'box-content w-[3.62ex]'
|
|
58
|
+
},
|
|
59
|
+
3: {
|
|
60
|
+
control: 'box-content w-[5.43ex]'
|
|
61
|
+
},
|
|
62
|
+
4: {
|
|
63
|
+
control: 'box-content w-[7.24ex]'
|
|
64
|
+
},
|
|
65
|
+
5: {
|
|
66
|
+
control: 'box-content w-[9.05ex]'
|
|
67
|
+
},
|
|
68
|
+
6: {
|
|
69
|
+
control: 'box-content w-[10.86ex]'
|
|
70
|
+
},
|
|
71
|
+
7: {
|
|
72
|
+
control: 'box-content w-[12.67ex]'
|
|
73
|
+
},
|
|
74
|
+
8: {
|
|
75
|
+
control: 'box-content w-[14.48ex]'
|
|
76
|
+
},
|
|
77
|
+
9: {
|
|
78
|
+
control: 'box-content w-[16.29ex]'
|
|
79
|
+
},
|
|
80
|
+
10: {
|
|
81
|
+
control: 'box-content w-[18.1ex]'
|
|
82
|
+
},
|
|
83
|
+
20: {
|
|
84
|
+
control: 'box-content w-[36.2ex]'
|
|
85
|
+
},
|
|
86
|
+
30: {
|
|
87
|
+
control: 'box-content w-[54.3ex]'
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
responsiveVariants: [
|
|
93
|
+
'xsl',
|
|
94
|
+
'sm',
|
|
95
|
+
'md',
|
|
96
|
+
'lg',
|
|
97
|
+
'xl'
|
|
98
|
+
]
|
|
99
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AriaButtonProps } from 'react-aria';
|
|
2
|
+
import { ListProps } from 'react-stately';
|
|
3
|
+
import { VariantProps } from 'tailwind-variants';
|
|
4
|
+
import { MultiSelectProps } from '../../multi-select.types.js';
|
|
5
|
+
import { styles as triggerStyles } from './multi-select-list-box-trigger.styles.js';
|
|
6
|
+
type Variants = VariantProps<typeof triggerStyles>;
|
|
7
|
+
export type MultiSelectSize = Variants['size'];
|
|
8
|
+
export type MultiSelectListBoxTriggerProps<T> = {
|
|
9
|
+
id?: string;
|
|
10
|
+
placeholder: string;
|
|
11
|
+
selectedKeys?: ListProps<T>['selectedKeys'];
|
|
12
|
+
showSingleSectionTitle?: MultiSelectProps<T>['showSingleSectionTitle'];
|
|
13
|
+
triggerProps: AriaButtonProps<'button'>;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React, { useContext } from 'react';
|
|
3
|
+
import { DismissButton, mergeProps, Overlay, usePopover } from 'react-aria';
|
|
4
|
+
import { MultiSelectContext } from '../../multi-select.component.js';
|
|
5
|
+
import { styles as popoverStyles } from './multi-select-popover.styles.js';
|
|
6
|
+
export function MultiSelectPopover({ children, className, ...props }) {
|
|
7
|
+
var _buttonRef_current;
|
|
8
|
+
const { overlayState, overlayProps, popoverRef, buttonRef, placement, portalContainer } = useContext(MultiSelectContext);
|
|
9
|
+
const { popoverProps } = usePopover({
|
|
10
|
+
...props,
|
|
11
|
+
placement,
|
|
12
|
+
popoverRef,
|
|
13
|
+
triggerRef: buttonRef,
|
|
14
|
+
isNonModal: true,
|
|
15
|
+
shouldFlip: true,
|
|
16
|
+
shouldCloseOnInteractOutside: ()=>false,
|
|
17
|
+
offset: 6
|
|
18
|
+
}, overlayState);
|
|
19
|
+
const width = (_buttonRef_current = buttonRef.current) === null || _buttonRef_current === void 0 ? void 0 : _buttonRef_current.getBoundingClientRect().width;
|
|
20
|
+
const styles = popoverStyles();
|
|
21
|
+
return React.createElement(Overlay, {
|
|
22
|
+
disableFocusManagement: true,
|
|
23
|
+
portalContainer: portalContainer
|
|
24
|
+
}, React.createElement("div", {
|
|
25
|
+
...mergeProps(popoverProps, overlayProps),
|
|
26
|
+
ref: popoverRef,
|
|
27
|
+
className: styles.overlay({
|
|
28
|
+
className
|
|
29
|
+
}),
|
|
30
|
+
style: {
|
|
31
|
+
...popoverProps.style,
|
|
32
|
+
width: width ? `${width}px` : undefined
|
|
33
|
+
},
|
|
34
|
+
onBlur: (e)=>{
|
|
35
|
+
const related = e.relatedTarget;
|
|
36
|
+
if (!(popoverRef === null || popoverRef === void 0 ? void 0 : popoverRef.current)) return;
|
|
37
|
+
if (related && popoverRef.current.contains(related)) return;
|
|
38
|
+
if (related && (buttonRef === null || buttonRef === void 0 ? void 0 : buttonRef.current) && buttonRef.current.contains(related)) return;
|
|
39
|
+
overlayState.close();
|
|
40
|
+
},
|
|
41
|
+
onKeyDown: (e)=>{
|
|
42
|
+
if (e.key === 'Tab' || e.key === 'Escape') {
|
|
43
|
+
overlayState.close();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
role: "dialog",
|
|
47
|
+
"aria-modal": "true",
|
|
48
|
+
"aria-label": "Options list with filter"
|
|
49
|
+
}, children, React.createElement(DismissButton, {
|
|
50
|
+
onDismiss: ()=>overlayState.close()
|
|
51
|
+
})));
|
|
52
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const styles: import("tailwind-variants").TVReturnType<{
|
|
2
|
+
[key: string]: {
|
|
3
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
4
|
+
overlay?: import("tailwind-variants").ClassValue;
|
|
5
|
+
underlay?: import("tailwind-variants").ClassValue;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
} | {
|
|
9
|
+
[x: string]: {
|
|
10
|
+
[x: string]: import("tailwind-variants").ClassValue | {
|
|
11
|
+
overlay?: import("tailwind-variants").ClassValue;
|
|
12
|
+
underlay?: import("tailwind-variants").ClassValue;
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
} | {}, {
|
|
16
|
+
underlay: string;
|
|
17
|
+
overlay: string;
|
|
18
|
+
}, undefined, TVConfig<V, EV>, {
|
|
19
|
+
[key: string]: {
|
|
20
|
+
[key: string]: import("tailwind-variants").ClassValue | {
|
|
21
|
+
overlay?: import("tailwind-variants").ClassValue;
|
|
22
|
+
underlay?: import("tailwind-variants").ClassValue;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
} | {}, {
|
|
26
|
+
underlay: string;
|
|
27
|
+
overlay: string;
|
|
28
|
+
}, import("tailwind-variants").TVReturnType<unknown, {
|
|
29
|
+
underlay: string;
|
|
30
|
+
overlay: string;
|
|
31
|
+
}, undefined, TVConfig<V, EV>, unknown, unknown, undefined>>;
|
package/dist/components/multi-select/components/multi-select-popover/multi-select-popover.types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { MultiSelectSearchbarProps } from './multi-select-searchbar.types.js';
|
|
2
|
+
export declare function MultiSelectSearchbar({ filterText, setFilterText, closeBtnRef, }: Pick<MultiSelectSearchbarProps, 'filterText' | 'setFilterText' | 'closeBtnRef'>): import("react/jsx-runtime").JSX.Element;
|