@kaizen/components 1.64.4 → 1.64.5
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/dist/cjs/Filter/FilterSelect/FilterSelect.cjs +11 -4
- package/dist/cjs/__future__/Select/subcomponents/ListBox/ListBox.cjs +42 -5
- package/dist/cjs/__future__/Select/subcomponents/Overlay/Overlay.cjs +1 -1
- package/dist/esm/Filter/FilterSelect/FilterSelect.mjs +11 -4
- package/dist/esm/__future__/Select/subcomponents/ListBox/ListBox.mjs +44 -6
- package/dist/esm/__future__/Select/subcomponents/Overlay/Overlay.mjs +1 -1
- package/dist/styles.css +101 -101
- package/package.json +3 -3
- package/src/Filter/FilterSelect/FilterSelect.spec.tsx +2 -2
- package/src/Filter/FilterSelect/FilterSelect.tsx +18 -8
- package/src/Filter/FilterSelect/_docs/FilterSelect.stories.tsx +1 -0
- package/src/__future__/Select/Select.spec.tsx +5 -3
- package/src/__future__/Select/_docs/Select.mdx +1 -3
- package/src/__future__/Select/_docs/Select.stories.tsx +33 -16
- package/src/__future__/Select/subcomponents/ListBox/ListBox.tsx +45 -2
- package/src/__future__/Select/subcomponents/Overlay/Overlay.tsx +1 -1
|
@@ -57,6 +57,11 @@ var FilterSelect = function (_a) {
|
|
|
57
57
|
triggerProps = _c.triggerProps,
|
|
58
58
|
menuProps = _c.menuProps;
|
|
59
59
|
var buttonProps = button.useButton(triggerProps, triggerRef).buttonProps;
|
|
60
|
+
// The id is being remapped because the buttonProps id points to nowhere. This should ideally be refactored but will point the aria attributes tot he right components
|
|
61
|
+
var renderTriggerButtonProps = tslib.__assign(tslib.__assign({}, buttonProps), {
|
|
62
|
+
"aria-labelledby": undefined,
|
|
63
|
+
"aria-controls": menuProps.id
|
|
64
|
+
});
|
|
60
65
|
return React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(select$1.HiddenSelect, {
|
|
61
66
|
label: label,
|
|
62
67
|
state: state,
|
|
@@ -70,17 +75,19 @@ var FilterSelect = function (_a) {
|
|
|
70
75
|
selectedValue: ((_a = state.selectedItem) === null || _a === void 0 ? void 0 : _a.textValue) || undefined,
|
|
71
76
|
label: label,
|
|
72
77
|
isOpen: isOpen
|
|
73
|
-
},
|
|
78
|
+
}, renderTriggerButtonProps));
|
|
74
79
|
},
|
|
75
80
|
onMount: setTriggerRef,
|
|
76
81
|
classNameOverride: classNameOverride
|
|
77
|
-
}, React__default.default.createElement(FilterContents.FilterContents, {
|
|
82
|
+
}, React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(FilterContents.FilterContents, {
|
|
78
83
|
classNameOverride: FilterSelect_module.filterContents
|
|
79
84
|
}, React__default.default.createElement(SelectContext.SelectProvider, {
|
|
80
85
|
state: state
|
|
81
86
|
}, React__default.default.createElement(SelectPopoverContents.SelectPopoverContents, {
|
|
82
|
-
menuProps: menuProps
|
|
83
|
-
|
|
87
|
+
menuProps: tslib.__assign(tslib.__assign({}, menuProps), {
|
|
88
|
+
"aria-labelledby": buttonProps.id
|
|
89
|
+
})
|
|
90
|
+
}, children))))));
|
|
84
91
|
};
|
|
85
92
|
FilterSelect.displayName = "FilterSelect";
|
|
86
93
|
FilterSelect.Section = ListBoxSection.ListBoxSection;
|
|
@@ -13,6 +13,19 @@ function _interopDefault(e) {
|
|
|
13
13
|
}
|
|
14
14
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
15
15
|
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
16
|
+
|
|
17
|
+
/** A util to retrieve the key of the correct focusable items based of the focus strategy
|
|
18
|
+
* This is used to determine which element from the collection to focus to on open base on the keyboard event
|
|
19
|
+
* ie: UpArrow will set the focusStrategy to "last"
|
|
20
|
+
*/
|
|
21
|
+
var getOptionKeyFromCollection = function (state) {
|
|
22
|
+
if (state.selectedItem) {
|
|
23
|
+
return state.selectedItem.key;
|
|
24
|
+
} else if (state.focusStrategy === "last") {
|
|
25
|
+
return state.collection.getLastKey();
|
|
26
|
+
}
|
|
27
|
+
return state.collection.getFirstKey();
|
|
28
|
+
};
|
|
16
29
|
var ListBox = function (_a) {
|
|
17
30
|
var children = _a.children,
|
|
18
31
|
menuProps = _a.menuProps,
|
|
@@ -20,13 +33,37 @@ var ListBox = function (_a) {
|
|
|
20
33
|
restProps = tslib.__rest(_a, ["children", "menuProps", "classNameOverride"]);
|
|
21
34
|
var state = SelectContext.useSelectContext().state;
|
|
22
35
|
var ref = React__default.default.useRef(null);
|
|
36
|
+
var _b = React__default.default.useState(false),
|
|
37
|
+
isListboxReady = _b[0],
|
|
38
|
+
setListboxReady = _b[1];
|
|
23
39
|
var listBoxProps = listbox.useListBox(tslib.__assign(tslib.__assign({}, menuProps), {
|
|
24
|
-
disallowEmptySelection: true
|
|
40
|
+
disallowEmptySelection: true,
|
|
41
|
+
// This is to ensure that the listbox use React Aria's auto focus feature for Listbox, which creates a visual bug
|
|
42
|
+
autoFocus: false
|
|
25
43
|
}), state, ref).listBoxProps;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
/**
|
|
45
|
+
* This is a slightly hacky way to ensure the Listbox is aware of its position without using timeout.
|
|
46
|
+
* This solves the page from refocusing to the top of the DOM when it is opened for the first time with keyboard.
|
|
47
|
+
*/
|
|
48
|
+
React.useEffect(function () {
|
|
49
|
+
setListboxReady(true);
|
|
50
|
+
}, []);
|
|
51
|
+
React.useEffect(function () {
|
|
52
|
+
if (isListboxReady) {
|
|
53
|
+
var optionKey = getOptionKeyFromCollection(state);
|
|
54
|
+
var focusToElement = document.querySelector("[data-key=\"".concat(optionKey, "\"]"));
|
|
55
|
+
if (focusToElement) {
|
|
56
|
+
focusToElement.focus();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}, [isListboxReady]);
|
|
60
|
+
return (
|
|
61
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
62
|
+
React__default.default.createElement("ul", tslib.__assign({
|
|
63
|
+
ref: ref,
|
|
64
|
+
className: classnames__default.default(ListBox_module.listBox, classNameOverride)
|
|
65
|
+
}, listBoxProps, restProps), children)
|
|
66
|
+
);
|
|
30
67
|
};
|
|
31
68
|
ListBox.displayName = "ListBox";
|
|
32
69
|
exports.ListBox = ListBox;
|
|
@@ -32,7 +32,7 @@ var Overlay = function (_a) {
|
|
|
32
32
|
ref: overlayRef,
|
|
33
33
|
className: classNameOverride
|
|
34
34
|
}, overlayProps, restProps), React__default.default.createElement(focus.FocusScope, {
|
|
35
|
-
autoFocus:
|
|
35
|
+
autoFocus: false,
|
|
36
36
|
restoreFocus: true
|
|
37
37
|
}, React__default.default.createElement(overlays.DismissButton, {
|
|
38
38
|
onDismiss: state.close
|
|
@@ -50,6 +50,11 @@ const FilterSelect = /*#__PURE__*/function () {
|
|
|
50
50
|
triggerProps = _c.triggerProps,
|
|
51
51
|
menuProps = _c.menuProps;
|
|
52
52
|
var buttonProps = useButton(triggerProps, triggerRef).buttonProps;
|
|
53
|
+
// The id is being remapped because the buttonProps id points to nowhere. This should ideally be refactored but will point the aria attributes tot he right components
|
|
54
|
+
var renderTriggerButtonProps = __assign(__assign({}, buttonProps), {
|
|
55
|
+
"aria-labelledby": undefined,
|
|
56
|
+
"aria-controls": menuProps.id
|
|
57
|
+
});
|
|
53
58
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HiddenSelect, {
|
|
54
59
|
label: label,
|
|
55
60
|
state: state,
|
|
@@ -63,17 +68,19 @@ const FilterSelect = /*#__PURE__*/function () {
|
|
|
63
68
|
selectedValue: ((_a = state.selectedItem) === null || _a === void 0 ? void 0 : _a.textValue) || undefined,
|
|
64
69
|
label: label,
|
|
65
70
|
isOpen: isOpen
|
|
66
|
-
},
|
|
71
|
+
}, renderTriggerButtonProps));
|
|
67
72
|
},
|
|
68
73
|
onMount: setTriggerRef,
|
|
69
74
|
classNameOverride: classNameOverride
|
|
70
|
-
}, /*#__PURE__*/React.createElement(FilterContents, {
|
|
75
|
+
}, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterContents, {
|
|
71
76
|
classNameOverride: styles.filterContents
|
|
72
77
|
}, /*#__PURE__*/React.createElement(SelectProvider, {
|
|
73
78
|
state: state
|
|
74
79
|
}, /*#__PURE__*/React.createElement(SelectPopoverContents, {
|
|
75
|
-
menuProps: menuProps
|
|
76
|
-
|
|
80
|
+
menuProps: __assign(__assign({}, menuProps), {
|
|
81
|
+
"aria-labelledby": buttonProps.id
|
|
82
|
+
})
|
|
83
|
+
}, children))))));
|
|
77
84
|
};
|
|
78
85
|
FilterSelect.displayName = "FilterSelect";
|
|
79
86
|
FilterSelect.Section = ListBoxSection;
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
import { useListBox } from '@react-aria/listbox';
|
|
4
4
|
import classnames from 'classnames';
|
|
5
5
|
import { useSelectContext } from '../../context/SelectContext.mjs';
|
|
6
6
|
import styles from './ListBox.module.scss.mjs';
|
|
7
|
+
|
|
8
|
+
/** A util to retrieve the key of the correct focusable items based of the focus strategy
|
|
9
|
+
* This is used to determine which element from the collection to focus to on open base on the keyboard event
|
|
10
|
+
* ie: UpArrow will set the focusStrategy to "last"
|
|
11
|
+
*/
|
|
12
|
+
var getOptionKeyFromCollection = function (state) {
|
|
13
|
+
if (state.selectedItem) {
|
|
14
|
+
return state.selectedItem.key;
|
|
15
|
+
} else if (state.focusStrategy === "last") {
|
|
16
|
+
return state.collection.getLastKey();
|
|
17
|
+
}
|
|
18
|
+
return state.collection.getFirstKey();
|
|
19
|
+
};
|
|
7
20
|
const ListBox = /*#__PURE__*/function () {
|
|
8
21
|
const ListBox = function (_a) {
|
|
9
22
|
var children = _a.children,
|
|
@@ -12,13 +25,38 @@ const ListBox = /*#__PURE__*/function () {
|
|
|
12
25
|
restProps = __rest(_a, ["children", "menuProps", "classNameOverride"]);
|
|
13
26
|
var state = useSelectContext().state;
|
|
14
27
|
var ref = React.useRef(null);
|
|
28
|
+
var _b = React.useState(false),
|
|
29
|
+
isListboxReady = _b[0],
|
|
30
|
+
setListboxReady = _b[1];
|
|
15
31
|
var listBoxProps = useListBox(__assign(__assign({}, menuProps), {
|
|
16
|
-
disallowEmptySelection: true
|
|
32
|
+
disallowEmptySelection: true,
|
|
33
|
+
// This is to ensure that the listbox use React Aria's auto focus feature for Listbox, which creates a visual bug
|
|
34
|
+
autoFocus: false
|
|
17
35
|
}), state, ref).listBoxProps;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
36
|
+
/**
|
|
37
|
+
* This is a slightly hacky way to ensure the Listbox is aware of its position without using timeout.
|
|
38
|
+
* This solves the page from refocusing to the top of the DOM when it is opened for the first time with keyboard.
|
|
39
|
+
*/
|
|
40
|
+
useEffect(function () {
|
|
41
|
+
setListboxReady(true);
|
|
42
|
+
}, []);
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
if (isListboxReady) {
|
|
45
|
+
var optionKey = getOptionKeyFromCollection(state);
|
|
46
|
+
var focusToElement = document.querySelector("[data-key=\"".concat(optionKey, "\"]"));
|
|
47
|
+
if (focusToElement) {
|
|
48
|
+
focusToElement.focus();
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [isListboxReady]);
|
|
52
|
+
return (
|
|
53
|
+
/*#__PURE__*/
|
|
54
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
55
|
+
React.createElement("ul", __assign({
|
|
56
|
+
ref: ref,
|
|
57
|
+
className: classnames(styles.listBox, classNameOverride)
|
|
58
|
+
}, listBoxProps, restProps), children)
|
|
59
|
+
);
|
|
22
60
|
};
|
|
23
61
|
ListBox.displayName = "ListBox";
|
|
24
62
|
return ListBox;
|
|
@@ -25,7 +25,7 @@ const Overlay = /*#__PURE__*/function () {
|
|
|
25
25
|
ref: overlayRef,
|
|
26
26
|
className: classNameOverride
|
|
27
27
|
}, overlayProps, restProps), /*#__PURE__*/React.createElement(FocusScope, {
|
|
28
|
-
autoFocus:
|
|
28
|
+
autoFocus: false,
|
|
29
29
|
restoreFocus: true
|
|
30
30
|
}, /*#__PURE__*/React.createElement(DismissButton, {
|
|
31
31
|
onDismiss: state.close
|
package/dist/styles.css
CHANGED
|
@@ -1,93 +1,31 @@
|
|
|
1
1
|
@layer tokens, normalize, reset;@layer tokens{:root{--theme-key:heart;--animation-easing-function-ease-in-out:cubic-bezier(0.455,0.03,0.515,0.955);--animation-easing-function-ease-in:cubic-bezier(0.55,0.085,0.68,0.53);--animation-easing-function-ease-out:cubic-bezier(0.25,0.46,0.45,0.94);--animation-easing-function-linear:linear;--animation-easing-function-bounce-in:cubic-bezier(0.485,0.155,0.24,1.245);--animation-easing-function-bounce-out:cubic-bezier(0.485,0.155,0.515,0.845);--animation-easing-function-bounce-in-out:cubic-bezier(0.76,-0.245,0.24,1.245);--animation-duration-instant:0ms;--animation-duration-immediate:100ms;--animation-duration-rapid:200ms;--animation-duration-fast:300ms;--animation-duration-slow:400ms;--animation-duration-deliberate:700ms;--border-solid-border-width:2px;--border-solid-border-radius:7px;--border-solid-border-style:solid;--border-solid-border-color:#e1e2ea;--border-solid-border-color-rgb:225,226,234;--border-dashed-border-width:2px;--border-dashed-border-radius:7px;--border-dashed-border-style:dashed;--border-borderless-border-width:2px;--border-borderless-border-radius:7px;--border-borderless-border-style:solid;--border-borderless-border-color:transparent;--border-borderless-border-color-rgb:0,0,0;--border-focus-ring-border-width:2px;--border-focus-ring-border-radius:10px;--border-focus-ring-border-style:solid;--border-width-1:1px;--color-purple-100:#f4edf8;--color-purple-100-rgb:244,237,248;--color-purple-200:#dfc9ea;--color-purple-200-rgb:223,201,234;--color-purple-300:#c9a5dd;--color-purple-300-rgb:201,165,221;--color-purple-400:#ae67b1;--color-purple-400-rgb:174,103,177;--color-purple-500:#844587;--color-purple-500-rgb:132,69,135;--color-purple-600:#5f3361;--color-purple-600-rgb:95,51,97;--color-purple-700:#4a234d;--color-purple-700-rgb:74,35,77;--color-purple-800:#2f2438;--color-purple-800-rgb:47,36,56;--color-blue-100:#e6f6ff;--color-blue-100-rgb:230,246,255;--color-blue-200:#bde2f5;--color-blue-200-rgb:189,226,245;--color-blue-300:#73c0e8;--color-blue-300-rgb:115,192,232;--color-blue-400:#008bd6;--color-blue-400-rgb:0,139,214;--color-blue-500:#0168b3;--color-blue-500-rgb:1,104,179;--color-blue-600:#004970;--color-blue-600-rgb:0,73,112;--color-blue-700:#003157;--color-blue-700-rgb:0,49,87;--color-green-100:#e8f8f4;--color-green-100-rgb:232,248,244;--color-green-200:#c4ede2;--color-green-200-rgb:196,237,226;--color-green-300:#8fdbc7;--color-green-300-rgb:143,219,199;--color-green-400:#5dcaad;--color-green-400-rgb:93,202,173;--color-green-500:#3f9a86;--color-green-500-rgb:63,154,134;--color-green-600:#2c7d67;--color-green-600-rgb:44,125,103;--color-green-700:#22594a;--color-green-700-rgb:34,89,74;--color-yellow-100:#fff9e4;--color-yellow-100-rgb:255,249,228;--color-yellow-200:#ffeeb3;--color-yellow-200-rgb:255,238,179;--color-yellow-300:#ffe36e;--color-yellow-300-rgb:255,227,110;--color-yellow-400:#ffca4d;--color-yellow-400-rgb:255,202,77;--color-yellow-500:#ffb600;--color-yellow-500-rgb:255,182,0;--color-yellow-600:#c68600;--color-yellow-600-rgb:198,134,0;--color-yellow-700:#876400;--color-yellow-700-rgb:135,100,0;--color-red-100:#fdeaee;--color-red-100-rgb:253,234,238;--color-red-200:#f9c2cb;--color-red-200-rgb:249,194,203;--color-red-300:#f597a8;--color-red-300-rgb:245,151,168;--color-red-400:#e0707d;--color-red-400-rgb:224,112,125;--color-red-500:#c93b55;--color-red-500-rgb:201,59,85;--color-red-600:#a82433;--color-red-600-rgb:168,36,51;--color-red-700:#6c1e20;--color-red-700-rgb:108,30,32;--color-orange-100:#fff0e8;--color-orange-100-rgb:255,240,232;--color-orange-200:#ffd1b9;--color-orange-200-rgb:255,209,185;--color-orange-300:#ffb08a;--color-orange-300-rgb:255,176,138;--color-orange-400:#ff9461;--color-orange-400-rgb:255,148,97;--color-orange-500:#e96c2f;--color-orange-500-rgb:233,108,47;--color-orange-600:#b74302;--color-orange-600-rgb:183,67,2;--color-orange-700:#903c00;--color-orange-700-rgb:144,60,0;--color-gray-100:#f9f9f9;--color-gray-100-rgb:249,249,249;--color-gray-200:#f4f4f5;--color-gray-200-rgb:244,244,245;--color-gray-300:#eaeaec;--color-gray-300-rgb:234,234,236;--color-gray-400:#cdcdd0;--color-gray-400-rgb:205,205,208;--color-gray-500:#878792;--color-gray-500-rgb:135,135,146;--color-gray-600:#524e56;--color-gray-600-rgb:82,78,86;--color-white:#fff;--color-white-rgb:255,255,255;--color-black:#000;--color-black-rgb:0,0,0;--data-viz-favorable:#7dd5bd;--data-viz-favorable-rgb:125,213,189;--data-viz-unfavorable:#e68d97;--data-viz-unfavorable-rgb:230,141,151;--layout-content-max-width:1392px;--layout-content-max-width-with-sidebar:1080px;--layout-content-side-margin:72px;--layout-mobile-actions-drawer-height:60px;--layout-navigation-bar-height:72px;--layout-breakpoints-medium:768px;--layout-breakpoints-large:1080px;--shadow-small-box-shadow:0 1px 3px 0 rgba(0,0,0,.1),0 3px 16px 0 rgba(0,0,0,.06);--shadow-large-box-shadow:0 3px 9px 0 rgba(0,0,0,.1),0 8px 40px 0 rgba(0,0,0,.08);--spacing-0:0;--spacing-1:.0625rem;--spacing-2:.125rem;--spacing-4:.25rem;--spacing-6:.375rem;--spacing-8:.5rem;--spacing-12:.75rem;--spacing-16:1rem;--spacing-20:1.25rem;--spacing-24:1.5rem;--spacing-32:2rem;--spacing-40:2.5rem;--spacing-48:3rem;--spacing-56:3.5rem;--spacing-64:4rem;--spacing-72:4.5rem;--spacing-80:5rem;--spacing-96:6rem;--spacing-112:7rem;--spacing-128:8rem;--spacing-160:10rem;--spacing-200:12.5rem;--spacing-240:15rem;--spacing-280:17.5rem;--spacing-320:20rem;--spacing-xs:0.375rem;--spacing-sm:0.75rem;--spacing-md:1.5rem;--spacing-lg:2.25rem;--spacing-xl:3rem;--spacing-xxl:3.75rem;--spacing-xxxl:4.5rem;--spacing-xxxxl:5.25rem;--spacing-xxxxxl:6rem;--typography-data-large-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-large-font-weight:700;--typography-data-large-font-size:5.25rem;--typography-data-large-line-height:5.25rem;--typography-data-large-letter-spacing:normal;--typography-data-large-units-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-large-units-font-weight:700;--typography-data-large-units-font-size:2.625rem;--typography-data-large-units-line-height:5.25rem;--typography-data-large-units-letter-spacing:normal;--typography-data-medium-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-medium-font-weight:700;--typography-data-medium-font-size:3rem;--typography-data-medium-line-height:5rem;--typography-data-medium-letter-spacing:normal;--typography-data-medium-units-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-medium-units-font-weight:700;--typography-data-medium-units-font-size:1.5rem;--typography-data-medium-units-line-height:5rem;--typography-data-medium-units-letter-spacing:normal;--typography-data-small-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-small-font-weight:700;--typography-data-small-font-size:1.5rem;--typography-data-small-line-height:1.5rem;--typography-data-small-letter-spacing:normal;--typography-data-small-units-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-data-small-units-font-weight:700;--typography-data-small-units-font-size:1.125rem;--typography-data-small-units-line-height:1.5rem;--typography-data-small-units-letter-spacing:normal;--typography-display-0-font-family:"Tiempos Headline",Georgia,serif;--typography-display-0-font-weight:800;--typography-display-0-font-size:4.5rem;--typography-display-0-line-height:5.25rem;--typography-display-0-letter-spacing:0em;--typography-heading-1-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-1-font-weight:700;--typography-heading-1-font-size:2.125rem;--typography-heading-1-line-height:2.625rem;--typography-heading-1-letter-spacing:normal;--typography-heading-2-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-2-font-weight:700;--typography-heading-2-font-size:1.75rem;--typography-heading-2-line-height:2.25rem;--typography-heading-2-letter-spacing:normal;--typography-heading-3-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-3-font-weight:700;--typography-heading-3-font-size:1.375rem;--typography-heading-3-line-height:1.875rem;--typography-heading-3-letter-spacing:normal;--typography-heading-4-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-4-font-weight:600;--typography-heading-4-font-size:1.125rem;--typography-heading-4-line-height:1.5rem;--typography-heading-4-letter-spacing:normal;--typography-heading-5-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-5-font-weight:600;--typography-heading-5-font-size:1rem;--typography-heading-5-line-height:1.5rem;--typography-heading-5-letter-spacing:normal;--typography-heading-6-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-heading-6-font-weight:700;--typography-heading-6-font-size:0.875rem;--typography-heading-6-line-height:1.5rem;--typography-heading-6-letter-spacing:normal;--typography-paragraph-intro-lede-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-intro-lede-font-weight:400;--typography-paragraph-intro-lede-font-size:1.25rem;--typography-paragraph-intro-lede-line-height:1.875rem;--typography-paragraph-intro-lede-letter-spacing:0;--typography-paragraph-intro-lede-max-width:975px;--typography-paragraph-body-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-body-font-weight:400;--typography-paragraph-body-font-size:1rem;--typography-paragraph-body-line-height:1.5rem;--typography-paragraph-body-letter-spacing:normal;--typography-paragraph-body-max-width:780px;--typography-paragraph-small-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-small-font-weight:400;--typography-paragraph-small-font-size:0.875rem;--typography-paragraph-small-line-height:1.125rem;--typography-paragraph-small-letter-spacing:normal;--typography-paragraph-small-max-width:680px;--typography-paragraph-extra-small-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-paragraph-extra-small-font-weight:400;--typography-paragraph-extra-small-font-size:0.75rem;--typography-paragraph-extra-small-line-height:1.125rem;--typography-paragraph-extra-small-letter-spacing:normal;--typography-paragraph-extra-small-max-width:600px;--typography-paragraph-bold-font-weight:600;--typography-button-primary-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-button-primary-font-weight:700;--typography-button-primary-font-size:1.125rem;--typography-button-primary-line-height:1.5rem;--typography-button-primary-letter-spacing:normal;--typography-button-secondary-font-family:"Inter","Noto Sans",Helvetica,Arial,sans-serif;--typography-button-secondary-font-weight:500;--typography-button-secondary-font-size:1rem;--typography-button-secondary-line-height:1.5rem;--typography-button-secondary-letter-spacing:normal}}@layer normalize{html{text-size-adjust:100%;line-height:1.15}body{margin:0}main{display:block}h1{font-size:2em;margin:.67em 0}hr{box-sizing:content-box;height:0;overflow:visible}pre{font-family:monospace;font-size:1em}a{background-color:transparent}abbr[title]{border-bottom:none;text-decoration:underline;text-decoration:underline dotted}b,strong{font-weight:bolder}code,kbd,samp{font-family:monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}img{border-style:none}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;line-height:1.15;margin:0}button,input{overflow:visible}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{appearance:button}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{border-style:none;padding:0}[type=button]:-moz-focusring,[type=reset]:-moz-focusring,[type=submit]:-moz-focusring,button:-moz-focusring{outline:1px dotted ButtonText}fieldset{padding:.35em .75em .625em}legend{box-sizing:border-box;color:inherit;display:table;max-width:100%;padding:0;white-space:normal}progress{vertical-align:baseline}textarea{overflow:auto}[type=checkbox],[type=radio]{box-sizing:border-box;padding:0}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{appearance:textfield;outline-offset:-2px}[type=search]::-webkit-search-decoration{appearance:none}::-webkit-file-upload-button{appearance:button;font:inherit}details{display:block}summary{display:list-item}[hidden],template{display:none}}@layer reset{@font-face{font-family:Tiempos Headline;font-weight:800;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/tiempos/tiempos-headline-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/tiempos/tiempos-headline-bold.woff)}@font-face{font-family:Tiempos Headline;font-weight:500;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/tiempos/tiempos-headline-medium.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/tiempos/tiempos-headline-medium.woff)}@font-face{font-family:Greycliff CF;font-weight:300;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-light.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:400;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-regular.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:500;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-medium.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:600;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-demi-bold.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:700;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-bold.woff) format("woff")}@font-face{font-family:Greycliff CF;font-weight:800;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/greycliff/greycliff-cf-extra-bold.woff) format("woff")}@font-face{font-family:Inter;font-weight:300;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-light.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-light.woff)}@font-face{font-family:Inter;font-weight:400;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-regular.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-regular.woff)}@font-face{font-family:Inter;font-weight:500;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-medium.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-medium.woff)}@font-face{font-family:Inter;font-weight:600;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-demi-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-demi-bold.woff)}@font-face{font-family:Inter;font-weight:700;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-bold.woff)}@font-face{font-family:Inter;font-weight:800;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-extra-bold.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/inter/inter-extra-bold.woff)}@font-face{font-family:IBM Plex Mono;src:url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/ibm-plex-mono/ibm-plex-mono-regular.woff2),url(https://d1e7r7b0lb8p4d.cloudfront.net/fonts/ibm-plex-mono/ibm-plex-mono-regular.woff)}}@layer reset{*,:after,:before{border-color:var(--border-solid-border-color,"currentColor");border-style:solid;border-width:0}}
|
|
2
2
|
/** THIS IS AN AUTOGENERATED FILE **/
|
|
3
3
|
/** THIS IS AN AUTOGENERATED FILE **/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
/** THIS IS AN AUTOGENERATED FILE **/
|
|
8
|
-
.Tooltip-module_tooltip__efL1m {
|
|
9
|
-
max-width: 200px;
|
|
10
|
-
padding: var(--spacing-8, 0.5rem) var(--spacing-12, 0.75rem);
|
|
11
|
-
color: var(--color-white, #ffffff);
|
|
12
|
-
text-align: center;
|
|
13
|
-
font-family: var(--typography-paragraph-extra-small-font-family, "Inter", "Noto Sans", Helvetica, Arial, sans-serif);
|
|
14
|
-
font-size: var(--typography-paragraph-extra-small-font-size, 0.75rem);
|
|
15
|
-
font-weight: var(--typography-paragraph-extra-small-font-weight, 400);
|
|
16
|
-
letter-spacing: var(--typography-paragraph-extra-small-letter-spacing, normal);
|
|
17
|
-
line-height: var(--typography-paragraph-extra-small-line-height, 1.125rem);
|
|
18
|
-
border-radius: var(--border-solid-border-radius, 7px);
|
|
19
|
-
box-shadow: var(--shadow-small-box-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 16px 0 rgba(0, 0, 0, 0.06));
|
|
20
|
-
background-color: var(--color-purple-800, #2f2438);
|
|
21
|
-
text-wrap: pretty;
|
|
22
|
-
/* fixes FF gap */
|
|
23
|
-
transform: translate3d(0, 0, 0);
|
|
24
|
-
}
|
|
25
|
-
.Tooltip-module_tooltip__efL1m.Tooltip-module_reversed__NnCbZ {
|
|
26
|
-
background-color: var(--color-white, #ffffff);
|
|
27
|
-
color: var(--color-purple-800, #2f2438);
|
|
28
|
-
}
|
|
29
|
-
.Tooltip-module_tooltip__efL1m[data-placement=top] {
|
|
30
|
-
--origin: translateY(4px);
|
|
31
|
-
}
|
|
32
|
-
.Tooltip-module_tooltip__efL1m[data-placement=bottom] {
|
|
33
|
-
--origin: translateY(-4px);
|
|
34
|
-
}
|
|
35
|
-
.Tooltip-module_tooltip__efL1m[data-placement=right] {
|
|
36
|
-
--origin: translateX(-4px);
|
|
37
|
-
}
|
|
38
|
-
.Tooltip-module_tooltip__efL1m[data-placement=left] {
|
|
39
|
-
--origin: translateX(4px);
|
|
4
|
+
.OverlayArrow-module_overlayArrow__hoDyK {
|
|
5
|
+
display: flex;
|
|
6
|
+
padding: 8px;
|
|
40
7
|
}
|
|
41
|
-
.
|
|
42
|
-
|
|
8
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=top], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] {
|
|
9
|
+
padding: 0 8px;
|
|
43
10
|
}
|
|
44
|
-
.
|
|
45
|
-
|
|
11
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] {
|
|
12
|
+
padding: 8px 0;
|
|
46
13
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
transform: var(--origin);
|
|
51
|
-
opacity: 0;
|
|
52
|
-
}
|
|
53
|
-
to {
|
|
54
|
-
transform: translateY(0);
|
|
55
|
-
opacity: 1;
|
|
56
|
-
}
|
|
14
|
+
.OverlayArrow-module_overlayArrow__hoDyK path {
|
|
15
|
+
fill: var(--color-purple-800, #2f2438);
|
|
16
|
+
box-shadow: var(--shadow-small-box-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 16px 0 rgba(0, 0, 0, 0.06));
|
|
57
17
|
}
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
font-size: var(--typography-paragraph-body-font-size);
|
|
61
|
-
letter-spacing: var(--typography-paragraph-body-letter-spacing);
|
|
62
|
-
font-weight: var(--typography-paragraph-body-font-weight);
|
|
63
|
-
line-height: var(--typography-paragraph-body-line-height);
|
|
64
|
-
color: rgba(var(--color-purple-800-rgb), 0.7);
|
|
65
|
-
padding: var(--spacing-6) var(--spacing-8);
|
|
66
|
-
border: var(--border-focus-ring-border-width) var(--border-focus-ring-border-style) transparent;
|
|
67
|
-
border-radius: 4px;
|
|
68
|
-
display: flex;
|
|
69
|
-
gap: 0 var(--spacing-8);
|
|
70
|
-
align-items: center;
|
|
71
|
-
margin-inline: var(--spacing-6);
|
|
72
|
-
text-decoration: none;
|
|
73
|
-
cursor: pointer;
|
|
18
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg {
|
|
19
|
+
transform: rotate(90deg);
|
|
74
20
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
flex-shrink: 0;
|
|
78
|
-
display: flex;
|
|
79
|
-
align-items: center;
|
|
21
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg {
|
|
22
|
+
transform: rotate(180deg);
|
|
80
23
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
background-color: var(--color-blue-100);
|
|
84
|
-
color: var(--color-blue-500);
|
|
85
|
-
outline: none;
|
|
86
|
-
border-color: var(--color-blue-500);
|
|
24
|
+
.OverlayArrow-module_overlayArrow__hoDyK[data-placement=left] svg {
|
|
25
|
+
transform: rotate(270deg);
|
|
87
26
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
opacity: 0.3;
|
|
27
|
+
.OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path {
|
|
28
|
+
fill: var(--color-white, #ffffff);
|
|
91
29
|
}
|
|
92
30
|
.Button-module_button__QOSYH {
|
|
93
31
|
--button-min-height-width: var(--spacing-48);
|
|
@@ -177,9 +115,6 @@
|
|
|
177
115
|
--button-icon-size: var(--spacing-16);
|
|
178
116
|
gap: var(--spacing-8);
|
|
179
117
|
}
|
|
180
|
-
.Focusable-module_focusableWrapper__NfuIi {
|
|
181
|
-
display: inline-flex;
|
|
182
|
-
}
|
|
183
118
|
.Menu-module_menu__iHYqh {
|
|
184
119
|
background-color: var(--color-white);
|
|
185
120
|
color: var(--color-purple-800);
|
|
@@ -210,33 +145,98 @@
|
|
|
210
145
|
display: block;
|
|
211
146
|
margin-block: var(--spacing-6);
|
|
212
147
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
148
|
+
.MenuItem-module_item__DPerF {
|
|
149
|
+
font-family: var(--typography-paragraph-body-font-family);
|
|
150
|
+
font-size: var(--typography-paragraph-body-font-size);
|
|
151
|
+
letter-spacing: var(--typography-paragraph-body-letter-spacing);
|
|
152
|
+
font-weight: var(--typography-paragraph-body-font-weight);
|
|
153
|
+
line-height: var(--typography-paragraph-body-line-height);
|
|
154
|
+
color: rgba(var(--color-purple-800-rgb), 0.7);
|
|
155
|
+
padding: var(--spacing-6) var(--spacing-8);
|
|
156
|
+
border: var(--border-focus-ring-border-width) var(--border-focus-ring-border-style) transparent;
|
|
157
|
+
border-radius: 4px;
|
|
216
158
|
display: flex;
|
|
217
|
-
|
|
159
|
+
gap: 0 var(--spacing-8);
|
|
160
|
+
align-items: center;
|
|
161
|
+
margin-inline: var(--spacing-6);
|
|
162
|
+
text-decoration: none;
|
|
163
|
+
cursor: pointer;
|
|
218
164
|
}
|
|
219
|
-
|
|
220
|
-
|
|
165
|
+
|
|
166
|
+
.MenuItem-module_iconWrapper__bRdQN {
|
|
167
|
+
flex-shrink: 0;
|
|
168
|
+
display: flex;
|
|
169
|
+
align-items: center;
|
|
221
170
|
}
|
|
222
|
-
|
|
223
|
-
|
|
171
|
+
|
|
172
|
+
.MenuItem-module_item__DPerF[data-focused] {
|
|
173
|
+
background-color: var(--color-blue-100);
|
|
174
|
+
color: var(--color-blue-500);
|
|
175
|
+
outline: none;
|
|
176
|
+
border-color: var(--color-blue-500);
|
|
224
177
|
}
|
|
225
|
-
|
|
226
|
-
|
|
178
|
+
|
|
179
|
+
.MenuItem-module_item__DPerF[data-disabled] {
|
|
180
|
+
opacity: 0.3;
|
|
181
|
+
}
|
|
182
|
+
.Focusable-module_focusableWrapper__NfuIi {
|
|
183
|
+
display: inline-flex;
|
|
184
|
+
}
|
|
185
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
186
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
187
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
188
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
189
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
190
|
+
/** THIS IS AN AUTOGENERATED FILE **/
|
|
191
|
+
.Tooltip-module_tooltip__efL1m {
|
|
192
|
+
max-width: 200px;
|
|
193
|
+
padding: var(--spacing-8, 0.5rem) var(--spacing-12, 0.75rem);
|
|
194
|
+
color: var(--color-white, #ffffff);
|
|
195
|
+
text-align: center;
|
|
196
|
+
font-family: var(--typography-paragraph-extra-small-font-family, "Inter", "Noto Sans", Helvetica, Arial, sans-serif);
|
|
197
|
+
font-size: var(--typography-paragraph-extra-small-font-size, 0.75rem);
|
|
198
|
+
font-weight: var(--typography-paragraph-extra-small-font-weight, 400);
|
|
199
|
+
letter-spacing: var(--typography-paragraph-extra-small-letter-spacing, normal);
|
|
200
|
+
line-height: var(--typography-paragraph-extra-small-line-height, 1.125rem);
|
|
201
|
+
border-radius: var(--border-solid-border-radius, 7px);
|
|
227
202
|
box-shadow: var(--shadow-small-box-shadow, 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 3px 16px 0 rgba(0, 0, 0, 0.06));
|
|
203
|
+
background-color: var(--color-purple-800, #2f2438);
|
|
204
|
+
text-wrap: pretty;
|
|
205
|
+
/* fixes FF gap */
|
|
206
|
+
transform: translate3d(0, 0, 0);
|
|
228
207
|
}
|
|
229
|
-
.
|
|
230
|
-
|
|
208
|
+
.Tooltip-module_tooltip__efL1m.Tooltip-module_reversed__NnCbZ {
|
|
209
|
+
background-color: var(--color-white, #ffffff);
|
|
210
|
+
color: var(--color-purple-800, #2f2438);
|
|
231
211
|
}
|
|
232
|
-
.
|
|
233
|
-
|
|
212
|
+
.Tooltip-module_tooltip__efL1m[data-placement=top] {
|
|
213
|
+
--origin: translateY(4px);
|
|
234
214
|
}
|
|
235
|
-
.
|
|
236
|
-
|
|
215
|
+
.Tooltip-module_tooltip__efL1m[data-placement=bottom] {
|
|
216
|
+
--origin: translateY(-4px);
|
|
237
217
|
}
|
|
238
|
-
.
|
|
239
|
-
|
|
218
|
+
.Tooltip-module_tooltip__efL1m[data-placement=right] {
|
|
219
|
+
--origin: translateX(-4px);
|
|
220
|
+
}
|
|
221
|
+
.Tooltip-module_tooltip__efL1m[data-placement=left] {
|
|
222
|
+
--origin: translateX(4px);
|
|
223
|
+
}
|
|
224
|
+
.Tooltip-module_tooltip__efL1m[data-entering] {
|
|
225
|
+
animation: Tooltip-module_slide__lFdGA var(--animation-duration-fast, 300ms);
|
|
226
|
+
}
|
|
227
|
+
.Tooltip-module_tooltip__efL1m[data-exiting] {
|
|
228
|
+
animation: Tooltip-module_slide__lFdGA var(--animation-duration-fast, 300ms) reverse var(--animation-easing-function-ease-in, cubic-bezier(0.55, 0.085, 0.68, 0.53));
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
@keyframes Tooltip-module_slide__lFdGA {
|
|
232
|
+
from {
|
|
233
|
+
transform: var(--origin);
|
|
234
|
+
opacity: 0;
|
|
235
|
+
}
|
|
236
|
+
to {
|
|
237
|
+
transform: translateY(0);
|
|
238
|
+
opacity: 1;
|
|
239
|
+
}
|
|
240
240
|
}
|
|
241
241
|
.SVG-module_icon__8J5Ev {
|
|
242
242
|
width: 20px;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "1.64.
|
|
3
|
+
"version": "1.64.5",
|
|
4
4
|
"description": "Kaizen component library",
|
|
5
5
|
"author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
|
|
6
6
|
"homepage": "https://cultureamp.design",
|
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
"svgo": "^3.3.2",
|
|
121
121
|
"tslib": "^2.6.3",
|
|
122
122
|
"tsx": "^4.17.0",
|
|
123
|
-
"@kaizen/
|
|
124
|
-
"@kaizen/
|
|
123
|
+
"@kaizen/design-tokens": "10.6.1",
|
|
124
|
+
"@kaizen/package-bundler": "1.1.5"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
127
|
"@cultureamp/i18n-react-intl": "^2.5.9",
|
|
@@ -48,7 +48,7 @@ describe("<FilterSelect>", () => {
|
|
|
48
48
|
it("shows the options initially when isOpen is true", async () => {
|
|
49
49
|
render(<FilterSelectWrapper isOpen />)
|
|
50
50
|
await waitFor(() => {
|
|
51
|
-
expect(screen.
|
|
51
|
+
expect(screen.getByRole("listbox")).toBeVisible()
|
|
52
52
|
})
|
|
53
53
|
})
|
|
54
54
|
|
|
@@ -107,7 +107,7 @@ describe("<FilterSelect>", () => {
|
|
|
107
107
|
render(<FilterSelectWrapper isOpen />)
|
|
108
108
|
expect(screen.queryByRole("listbox")).toBeVisible()
|
|
109
109
|
await waitFor(() => {
|
|
110
|
-
expect(screen.
|
|
110
|
+
expect(screen.getAllByRole("option")[0]).toHaveFocus()
|
|
111
111
|
})
|
|
112
112
|
})
|
|
113
113
|
|
|
@@ -79,6 +79,12 @@ export const FilterSelect = <Option extends SelectOption = SelectOption>({
|
|
|
79
79
|
|
|
80
80
|
const { buttonProps } = useButton(triggerProps, triggerRef)
|
|
81
81
|
|
|
82
|
+
// The id is being remapped because the buttonProps id points to nowhere. This should ideally be refactored but will point the aria attributes tot he right components
|
|
83
|
+
const renderTriggerButtonProps = {
|
|
84
|
+
...buttonProps,
|
|
85
|
+
"aria-labelledby": undefined,
|
|
86
|
+
"aria-controls": menuProps.id,
|
|
87
|
+
}
|
|
82
88
|
return (
|
|
83
89
|
<>
|
|
84
90
|
<HiddenSelect label={label} state={state} triggerRef={triggerRef} />
|
|
@@ -90,19 +96,23 @@ export const FilterSelect = <Option extends SelectOption = SelectOption>({
|
|
|
90
96
|
selectedValue: state.selectedItem?.textValue || undefined,
|
|
91
97
|
label,
|
|
92
98
|
isOpen,
|
|
93
|
-
...
|
|
99
|
+
...renderTriggerButtonProps,
|
|
94
100
|
})
|
|
95
101
|
}
|
|
96
102
|
onMount={setTriggerRef}
|
|
97
103
|
classNameOverride={classNameOverride}
|
|
98
104
|
>
|
|
99
|
-
|
|
100
|
-
<
|
|
101
|
-
<
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
105
|
+
<>
|
|
106
|
+
<FilterContents classNameOverride={styles.filterContents}>
|
|
107
|
+
<SelectProvider<Option> state={state}>
|
|
108
|
+
<SelectPopoverContents
|
|
109
|
+
menuProps={{ ...menuProps, "aria-labelledby": buttonProps.id }}
|
|
110
|
+
>
|
|
111
|
+
{children}
|
|
112
|
+
</SelectPopoverContents>
|
|
113
|
+
</SelectProvider>
|
|
114
|
+
</FilterContents>
|
|
115
|
+
</>
|
|
106
116
|
</Filter>
|
|
107
117
|
</>
|
|
108
118
|
)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react"
|
|
2
|
+
import { Story } from "@storybook/blocks"
|
|
2
3
|
import { Meta, StoryObj } from "@storybook/react"
|
|
3
4
|
import { fn } from "@storybook/test"
|
|
4
5
|
import { renderTriggerControls } from "~components/Filter/_docs/controls/renderTriggerControls"
|
|
@@ -194,11 +194,13 @@ describe("<Select />", () => {
|
|
|
194
194
|
})
|
|
195
195
|
|
|
196
196
|
describe("Given the menu is opened", () => {
|
|
197
|
-
it("focuses the
|
|
198
|
-
const { getByRole } = render(
|
|
197
|
+
it("focuses on the first item", async () => {
|
|
198
|
+
const { getByRole, getAllByRole } = render(
|
|
199
|
+
<SelectWrapper defaultOpen />
|
|
200
|
+
)
|
|
199
201
|
expect(getByRole("listbox")).toBeVisible()
|
|
200
202
|
await waitFor(() => {
|
|
201
|
-
expect(
|
|
203
|
+
expect(getAllByRole("option")[0]).toHaveFocus()
|
|
202
204
|
})
|
|
203
205
|
})
|
|
204
206
|
it("is closed when hits the escape key", async () => {
|
|
@@ -98,8 +98,6 @@ Set `isFullWidth` to `true` to have the Select span the full width of its contai
|
|
|
98
98
|
|
|
99
99
|
By default, the Select's popover will attach itself to the `body` of the document using React's `createPortal`.
|
|
100
100
|
|
|
101
|
-
You can change the default
|
|
101
|
+
You can change the default behavior by providing a `portalContainerId` to attach this to different element in the DOM. This can help to resolve issues that may arise with `z-index` or having a Select in a modal.
|
|
102
102
|
|
|
103
103
|
<Canvas of={SelectStories.PortalContainer} />
|
|
104
|
-
|
|
105
|
-
There is currently a known issue whereby a selected option will cause the page to scroll to the top of the window on open (click on [default to see example](https://cultureamp.design/?path=/docs/components-select-future--docs#portals)). This can be solved by setting a `portalContainerId` to the closest parent of the Select.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { ContextModal } from "~components/Modal"
|
|
3
4
|
import { Select } from "../Select"
|
|
4
5
|
import { SelectOption } from "../types"
|
|
5
6
|
import {
|
|
@@ -165,25 +166,41 @@ export const FullWidth: Story = {
|
|
|
165
166
|
export const PortalContainer: Story = {
|
|
166
167
|
render: args => {
|
|
167
168
|
const portalContainerId = "id--portal-container"
|
|
169
|
+
|
|
170
|
+
const [isOpen, setIsOpen] = React.useState(false)
|
|
171
|
+
|
|
172
|
+
const handleOpen = (): void => setIsOpen(true)
|
|
173
|
+
const handleClose = (): void => setIsOpen(false)
|
|
168
174
|
return (
|
|
169
175
|
<>
|
|
170
|
-
<div
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
{
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
<Select
|
|
176
|
+
<div className=" h-[500px] mb-24 block bg-gray-100 flex flex-col gap-16 justify-center items-center">
|
|
177
|
+
Page content
|
|
178
|
+
<button
|
|
179
|
+
type="button"
|
|
180
|
+
className="border border-gray-500"
|
|
181
|
+
onClick={handleOpen}
|
|
182
|
+
>
|
|
183
|
+
Open Modal
|
|
184
|
+
</button>
|
|
185
|
+
<ContextModal
|
|
181
186
|
{...args}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
isOpen={isOpen}
|
|
188
|
+
onConfirm={handleClose}
|
|
189
|
+
onDismiss={handleClose}
|
|
190
|
+
title="Select test"
|
|
191
|
+
>
|
|
192
|
+
<div
|
|
193
|
+
className="flex gap-24 bg-gray-200 p-12 h-[500px] relative"
|
|
194
|
+
id={portalContainerId}
|
|
195
|
+
>
|
|
196
|
+
<Select
|
|
197
|
+
{...args}
|
|
198
|
+
label="Select within a modal"
|
|
199
|
+
id="id--select-inner"
|
|
200
|
+
portalContainerId={portalContainerId}
|
|
201
|
+
/>
|
|
202
|
+
</div>
|
|
203
|
+
</ContextModal>
|
|
187
204
|
</div>
|
|
188
205
|
</>
|
|
189
206
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React, { HTMLAttributes } from "react"
|
|
1
|
+
import React, { HTMLAttributes, Key, useEffect } from "react"
|
|
2
2
|
import { AriaListBoxOptions, useListBox } from "@react-aria/listbox"
|
|
3
|
+
import { SelectState } from "@react-stately/select"
|
|
3
4
|
import classnames from "classnames"
|
|
4
5
|
import { OverrideClassName } from "~components/types/OverrideClassName"
|
|
5
6
|
import { useSelectContext } from "../../context"
|
|
@@ -14,6 +15,21 @@ export type SingleListBoxProps<Option extends SelectOption> = OverrideClassName<
|
|
|
14
15
|
menuProps: AriaListBoxOptions<SelectItem<Option>>
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
/** A util to retrieve the key of the correct focusable items based of the focus strategy
|
|
19
|
+
* This is used to determine which element from the collection to focus to on open base on the keyboard event
|
|
20
|
+
* ie: UpArrow will set the focusStrategy to "last"
|
|
21
|
+
*/
|
|
22
|
+
const getOptionKeyFromCollection = (
|
|
23
|
+
state: SelectState<SelectItem<any>>
|
|
24
|
+
): Key | null => {
|
|
25
|
+
if (state.selectedItem) {
|
|
26
|
+
return state.selectedItem.key
|
|
27
|
+
} else if (state.focusStrategy === "last") {
|
|
28
|
+
return state.collection.getLastKey()
|
|
29
|
+
}
|
|
30
|
+
return state.collection.getFirstKey()
|
|
31
|
+
}
|
|
32
|
+
|
|
17
33
|
export const ListBox = <Option extends SelectOption>({
|
|
18
34
|
children,
|
|
19
35
|
menuProps,
|
|
@@ -22,13 +38,40 @@ export const ListBox = <Option extends SelectOption>({
|
|
|
22
38
|
}: SingleListBoxProps<Option>): JSX.Element => {
|
|
23
39
|
const { state } = useSelectContext<Option>()
|
|
24
40
|
const ref = React.useRef<HTMLUListElement>(null)
|
|
41
|
+
const [isListboxReady, setListboxReady] = React.useState(false)
|
|
25
42
|
const { listBoxProps } = useListBox(
|
|
26
|
-
{
|
|
43
|
+
{
|
|
44
|
+
...menuProps,
|
|
45
|
+
disallowEmptySelection: true,
|
|
46
|
+
// This is to ensure that the listbox use React Aria's auto focus feature for Listbox, which creates a visual bug
|
|
47
|
+
autoFocus: false,
|
|
48
|
+
},
|
|
27
49
|
state,
|
|
28
50
|
ref
|
|
29
51
|
)
|
|
30
52
|
|
|
53
|
+
/**
|
|
54
|
+
* This is a slightly hacky way to ensure the Listbox is aware of its position without using timeout.
|
|
55
|
+
* This solves the page from refocusing to the top of the DOM when it is opened for the first time with keyboard.
|
|
56
|
+
*/
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
setListboxReady(true)
|
|
59
|
+
}, [])
|
|
60
|
+
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (isListboxReady) {
|
|
63
|
+
const optionKey = getOptionKeyFromCollection(state)
|
|
64
|
+
const focusToElement = document.querySelector(
|
|
65
|
+
`[data-key="${optionKey}"]`
|
|
66
|
+
) as HTMLElement
|
|
67
|
+
if (focusToElement) {
|
|
68
|
+
focusToElement.focus()
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, [isListboxReady])
|
|
72
|
+
|
|
31
73
|
return (
|
|
74
|
+
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
32
75
|
<ul
|
|
33
76
|
ref={ref}
|
|
34
77
|
className={classnames(styles.listBox, classNameOverride)}
|
|
@@ -36,7 +36,7 @@ export const Overlay = <Option extends SelectOption>({
|
|
|
36
36
|
{...restProps}
|
|
37
37
|
>
|
|
38
38
|
{/* eslint-disable-next-line jsx-a11y/no-autofocus */}
|
|
39
|
-
<FocusScope autoFocus restoreFocus>
|
|
39
|
+
<FocusScope autoFocus={false} restoreFocus>
|
|
40
40
|
<DismissButton onDismiss={state.close} />
|
|
41
41
|
{children}
|
|
42
42
|
<DismissButton onDismiss={state.close} />
|