@kaizen/components 1.64.5 → 1.64.6
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/Brand/Brand.cjs +7 -5
- package/dist/cjs/Filter/FilterSelect/FilterSelect.cjs +4 -11
- package/dist/cjs/__future__/Select/subcomponents/ListBox/ListBox.cjs +5 -42
- package/dist/cjs/__future__/Select/subcomponents/Overlay/Overlay.cjs +1 -1
- package/dist/esm/Brand/Brand.mjs +6 -5
- package/dist/esm/Filter/FilterSelect/FilterSelect.mjs +4 -11
- package/dist/esm/__future__/Select/subcomponents/ListBox/ListBox.mjs +6 -44
- package/dist/esm/__future__/Select/subcomponents/Overlay/Overlay.mjs +1 -1
- package/dist/styles.css +33 -34
- package/package.json +3 -3
- package/src/Brand/Brand.tsx +5 -3
- package/src/Filter/FilterSelect/FilterSelect.spec.tsx +2 -2
- package/src/Filter/FilterSelect/FilterSelect.tsx +8 -18
- package/src/Filter/FilterSelect/_docs/FilterSelect.stories.tsx +0 -1
- package/src/Workflow/subcomponents/Header/components/Branding/Branding.module.css +3 -4
- package/src/__future__/Select/Select.spec.tsx +3 -5
- package/src/__future__/Select/_docs/Select.mdx +3 -1
- package/src/__future__/Select/_docs/Select.stories.tsx +16 -33
- package/src/__future__/Select/subcomponents/ListBox/ListBox.tsx +2 -45
- package/src/__future__/Select/subcomponents/Overlay/Overlay.tsx +1 -1
package/dist/cjs/Brand/Brand.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
|
+
var classnames = require('classnames');
|
|
5
6
|
var hostedAssets = require('../utils/hostedAssets.cjs');
|
|
6
7
|
var BrandCollectiveIntelligence = require('./BrandCollectiveIntelligence/BrandCollectiveIntelligence.cjs');
|
|
7
8
|
var Brand_module = require('./Brand.module.scss.cjs');
|
|
@@ -11,6 +12,7 @@ function _interopDefault(e) {
|
|
|
11
12
|
};
|
|
12
13
|
}
|
|
13
14
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
15
|
+
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
|
|
14
16
|
var isSVG = function (variant, restProps) {
|
|
15
17
|
return variant === "collective-intelligence";
|
|
16
18
|
};
|
|
@@ -42,11 +44,10 @@ var Brand = function (_a) {
|
|
|
42
44
|
}
|
|
43
45
|
var alt = restProps.alt,
|
|
44
46
|
classNameOverride = restProps.classNameOverride,
|
|
45
|
-
|
|
47
|
+
style = restProps.style,
|
|
48
|
+
otherProps = tslib.__rest(restProps, ["alt", "classNameOverride", "style"]);
|
|
46
49
|
var brandTheme = reversed ? "-reversed" : "-default";
|
|
47
|
-
return React__default.default.createElement("picture", tslib.__assign({
|
|
48
|
-
className: classNameOverride
|
|
49
|
-
}, otherProps), React__default.default.createElement("source", {
|
|
50
|
+
return React__default.default.createElement("picture", tslib.__assign({}, otherProps), React__default.default.createElement("source", {
|
|
50
51
|
srcSet: hostedAssets.assetUrl("brand/".concat(variant, "-reversed.svg")),
|
|
51
52
|
media: "(forced-colors: active) and (prefers-color-scheme: dark)"
|
|
52
53
|
}), React__default.default.createElement("source", {
|
|
@@ -55,7 +56,8 @@ var Brand = function (_a) {
|
|
|
55
56
|
}), React__default.default.createElement("img", {
|
|
56
57
|
src: hostedAssets.assetUrl("brand/".concat(variant).concat(brandTheme, ".svg")),
|
|
57
58
|
alt: alt,
|
|
58
|
-
className: Brand_module.img
|
|
59
|
+
className: classnames__default.default(Brand_module.img, classNameOverride),
|
|
60
|
+
style: style
|
|
59
61
|
}));
|
|
60
62
|
};
|
|
61
63
|
Brand.displayName = "Brand";
|
|
@@ -57,11 +57,6 @@ 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
|
-
});
|
|
65
60
|
return React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(select$1.HiddenSelect, {
|
|
66
61
|
label: label,
|
|
67
62
|
state: state,
|
|
@@ -75,19 +70,17 @@ var FilterSelect = function (_a) {
|
|
|
75
70
|
selectedValue: ((_a = state.selectedItem) === null || _a === void 0 ? void 0 : _a.textValue) || undefined,
|
|
76
71
|
label: label,
|
|
77
72
|
isOpen: isOpen
|
|
78
|
-
},
|
|
73
|
+
}, buttonProps));
|
|
79
74
|
},
|
|
80
75
|
onMount: setTriggerRef,
|
|
81
76
|
classNameOverride: classNameOverride
|
|
82
|
-
}, React__default.default.createElement(
|
|
77
|
+
}, React__default.default.createElement(FilterContents.FilterContents, {
|
|
83
78
|
classNameOverride: FilterSelect_module.filterContents
|
|
84
79
|
}, React__default.default.createElement(SelectContext.SelectProvider, {
|
|
85
80
|
state: state
|
|
86
81
|
}, React__default.default.createElement(SelectPopoverContents.SelectPopoverContents, {
|
|
87
|
-
menuProps:
|
|
88
|
-
|
|
89
|
-
})
|
|
90
|
-
}, children))))));
|
|
82
|
+
menuProps: menuProps
|
|
83
|
+
}, children)))));
|
|
91
84
|
};
|
|
92
85
|
FilterSelect.displayName = "FilterSelect";
|
|
93
86
|
FilterSelect.Section = ListBoxSection.ListBoxSection;
|
|
@@ -13,19 +13,6 @@ 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
|
-
};
|
|
29
16
|
var ListBox = function (_a) {
|
|
30
17
|
var children = _a.children,
|
|
31
18
|
menuProps = _a.menuProps,
|
|
@@ -33,37 +20,13 @@ var ListBox = function (_a) {
|
|
|
33
20
|
restProps = tslib.__rest(_a, ["children", "menuProps", "classNameOverride"]);
|
|
34
21
|
var state = SelectContext.useSelectContext().state;
|
|
35
22
|
var ref = React__default.default.useRef(null);
|
|
36
|
-
var _b = React__default.default.useState(false),
|
|
37
|
-
isListboxReady = _b[0],
|
|
38
|
-
setListboxReady = _b[1];
|
|
39
23
|
var listBoxProps = listbox.useListBox(tslib.__assign(tslib.__assign({}, menuProps), {
|
|
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
|
|
24
|
+
disallowEmptySelection: true
|
|
43
25
|
}), state, ref).listBoxProps;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
-
);
|
|
26
|
+
return React__default.default.createElement("ul", tslib.__assign({
|
|
27
|
+
ref: ref,
|
|
28
|
+
className: classnames__default.default(ListBox_module.listBox, classNameOverride)
|
|
29
|
+
}, listBoxProps, restProps), children);
|
|
67
30
|
};
|
|
68
31
|
ListBox.displayName = "ListBox";
|
|
69
32
|
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: true,
|
|
36
36
|
restoreFocus: true
|
|
37
37
|
}, React__default.default.createElement(overlays.DismissButton, {
|
|
38
38
|
onDismiss: state.close
|
package/dist/esm/Brand/Brand.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import classnames from 'classnames';
|
|
3
4
|
import { assetUrl } from '../utils/hostedAssets.mjs';
|
|
4
5
|
import { BrandCollectiveIntelligence } from './BrandCollectiveIntelligence/BrandCollectiveIntelligence.mjs';
|
|
5
6
|
import styles from './Brand.module.scss.mjs';
|
|
@@ -35,11 +36,10 @@ const Brand = /*#__PURE__*/function () {
|
|
|
35
36
|
}
|
|
36
37
|
var alt = restProps.alt,
|
|
37
38
|
classNameOverride = restProps.classNameOverride,
|
|
38
|
-
|
|
39
|
+
style = restProps.style,
|
|
40
|
+
otherProps = __rest(restProps, ["alt", "classNameOverride", "style"]);
|
|
39
41
|
var brandTheme = reversed ? "-reversed" : "-default";
|
|
40
|
-
return /*#__PURE__*/React.createElement("picture", __assign({
|
|
41
|
-
className: classNameOverride
|
|
42
|
-
}, otherProps), /*#__PURE__*/React.createElement("source", {
|
|
42
|
+
return /*#__PURE__*/React.createElement("picture", __assign({}, otherProps), /*#__PURE__*/React.createElement("source", {
|
|
43
43
|
srcSet: assetUrl("brand/".concat(variant, "-reversed.svg")),
|
|
44
44
|
media: "(forced-colors: active) and (prefers-color-scheme: dark)"
|
|
45
45
|
}), /*#__PURE__*/React.createElement("source", {
|
|
@@ -48,7 +48,8 @@ const Brand = /*#__PURE__*/function () {
|
|
|
48
48
|
}), /*#__PURE__*/React.createElement("img", {
|
|
49
49
|
src: assetUrl("brand/".concat(variant).concat(brandTheme, ".svg")),
|
|
50
50
|
alt: alt,
|
|
51
|
-
className: styles.img
|
|
51
|
+
className: classnames(styles.img, classNameOverride),
|
|
52
|
+
style: style
|
|
52
53
|
}));
|
|
53
54
|
};
|
|
54
55
|
Brand.displayName = "Brand";
|
|
@@ -50,11 +50,6 @@ 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
|
-
});
|
|
58
53
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(HiddenSelect, {
|
|
59
54
|
label: label,
|
|
60
55
|
state: state,
|
|
@@ -68,19 +63,17 @@ const FilterSelect = /*#__PURE__*/function () {
|
|
|
68
63
|
selectedValue: ((_a = state.selectedItem) === null || _a === void 0 ? void 0 : _a.textValue) || undefined,
|
|
69
64
|
label: label,
|
|
70
65
|
isOpen: isOpen
|
|
71
|
-
},
|
|
66
|
+
}, buttonProps));
|
|
72
67
|
},
|
|
73
68
|
onMount: setTriggerRef,
|
|
74
69
|
classNameOverride: classNameOverride
|
|
75
|
-
}, /*#__PURE__*/React.createElement(
|
|
70
|
+
}, /*#__PURE__*/React.createElement(FilterContents, {
|
|
76
71
|
classNameOverride: styles.filterContents
|
|
77
72
|
}, /*#__PURE__*/React.createElement(SelectProvider, {
|
|
78
73
|
state: state
|
|
79
74
|
}, /*#__PURE__*/React.createElement(SelectPopoverContents, {
|
|
80
|
-
menuProps:
|
|
81
|
-
|
|
82
|
-
})
|
|
83
|
-
}, children))))));
|
|
75
|
+
menuProps: menuProps
|
|
76
|
+
}, children)))));
|
|
84
77
|
};
|
|
85
78
|
FilterSelect.displayName = "FilterSelect";
|
|
86
79
|
FilterSelect.Section = ListBoxSection;
|
|
@@ -1,22 +1,9 @@
|
|
|
1
1
|
import { __rest, __assign } from 'tslib';
|
|
2
|
-
import React
|
|
2
|
+
import React 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
|
-
};
|
|
20
7
|
const ListBox = /*#__PURE__*/function () {
|
|
21
8
|
const ListBox = function (_a) {
|
|
22
9
|
var children = _a.children,
|
|
@@ -25,38 +12,13 @@ const ListBox = /*#__PURE__*/function () {
|
|
|
25
12
|
restProps = __rest(_a, ["children", "menuProps", "classNameOverride"]);
|
|
26
13
|
var state = useSelectContext().state;
|
|
27
14
|
var ref = React.useRef(null);
|
|
28
|
-
var _b = React.useState(false),
|
|
29
|
-
isListboxReady = _b[0],
|
|
30
|
-
setListboxReady = _b[1];
|
|
31
15
|
var listBoxProps = useListBox(__assign(__assign({}, menuProps), {
|
|
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
|
|
16
|
+
disallowEmptySelection: true
|
|
35
17
|
}), state, ref).listBoxProps;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
);
|
|
18
|
+
return /*#__PURE__*/React.createElement("ul", __assign({
|
|
19
|
+
ref: ref,
|
|
20
|
+
className: classnames(styles.listBox, classNameOverride)
|
|
21
|
+
}, listBoxProps, restProps), children);
|
|
60
22
|
};
|
|
61
23
|
ListBox.displayName = "ListBox";
|
|
62
24
|
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: true,
|
|
29
29
|
restoreFocus: true
|
|
30
30
|
}, /*#__PURE__*/React.createElement(DismissButton, {
|
|
31
31
|
onDismiss: state.close
|
package/dist/styles.css
CHANGED
|
@@ -27,6 +27,36 @@
|
|
|
27
27
|
.OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path {
|
|
28
28
|
fill: var(--color-white, #ffffff);
|
|
29
29
|
}
|
|
30
|
+
.Menu-module_menu__iHYqh {
|
|
31
|
+
background-color: var(--color-white);
|
|
32
|
+
color: var(--color-purple-800);
|
|
33
|
+
width: 248px;
|
|
34
|
+
max-height: 22rem;
|
|
35
|
+
overflow: auto;
|
|
36
|
+
padding-block: var(--spacing-6);
|
|
37
|
+
outline: none;
|
|
38
|
+
border-radius: var(--border-solid-border-radius);
|
|
39
|
+
box-shadow: var(--shadow-large-box-shadow);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.Menu-module_menu__iHYqh .react-aria-Header {
|
|
43
|
+
font-family: var(--typography-heading-6-font-family);
|
|
44
|
+
font-size: var(--typography-heading-6-font-size);
|
|
45
|
+
letter-spacing: var(--typography-heading-6-letter-spacing);
|
|
46
|
+
font-weight: var(--typography-heading-6-font-weight);
|
|
47
|
+
line-height: var(--typography-heading-6-line-height);
|
|
48
|
+
padding: var(--spacing-6) 10px;
|
|
49
|
+
margin-inline: var(--spacing-6);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.Menu-module_menu__iHYqh section:not(:last-of-type)::after {
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 1px;
|
|
55
|
+
background-color: var(--border-solid-border-color);
|
|
56
|
+
content: "";
|
|
57
|
+
display: block;
|
|
58
|
+
margin-block: var(--spacing-6);
|
|
59
|
+
}
|
|
30
60
|
.Button-module_button__QOSYH {
|
|
31
61
|
--button-min-height-width: var(--spacing-48);
|
|
32
62
|
--button-padding-x: calc(
|
|
@@ -115,36 +145,6 @@
|
|
|
115
145
|
--button-icon-size: var(--spacing-16);
|
|
116
146
|
gap: var(--spacing-8);
|
|
117
147
|
}
|
|
118
|
-
.Menu-module_menu__iHYqh {
|
|
119
|
-
background-color: var(--color-white);
|
|
120
|
-
color: var(--color-purple-800);
|
|
121
|
-
width: 248px;
|
|
122
|
-
max-height: 22rem;
|
|
123
|
-
overflow: auto;
|
|
124
|
-
padding-block: var(--spacing-6);
|
|
125
|
-
outline: none;
|
|
126
|
-
border-radius: var(--border-solid-border-radius);
|
|
127
|
-
box-shadow: var(--shadow-large-box-shadow);
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.Menu-module_menu__iHYqh .react-aria-Header {
|
|
131
|
-
font-family: var(--typography-heading-6-font-family);
|
|
132
|
-
font-size: var(--typography-heading-6-font-size);
|
|
133
|
-
letter-spacing: var(--typography-heading-6-letter-spacing);
|
|
134
|
-
font-weight: var(--typography-heading-6-font-weight);
|
|
135
|
-
line-height: var(--typography-heading-6-line-height);
|
|
136
|
-
padding: var(--spacing-6) 10px;
|
|
137
|
-
margin-inline: var(--spacing-6);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
.Menu-module_menu__iHYqh section:not(:last-of-type)::after {
|
|
141
|
-
width: 100%;
|
|
142
|
-
height: 1px;
|
|
143
|
-
background-color: var(--border-solid-border-color);
|
|
144
|
-
content: "";
|
|
145
|
-
display: block;
|
|
146
|
-
margin-block: var(--spacing-6);
|
|
147
|
-
}
|
|
148
148
|
.MenuItem-module_item__DPerF {
|
|
149
149
|
font-family: var(--typography-paragraph-body-font-family);
|
|
150
150
|
font-size: var(--typography-paragraph-body-font-size);
|
|
@@ -12384,19 +12384,18 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
|
|
|
12384
12384
|
}
|
|
12385
12385
|
|
|
12386
12386
|
.Branding-module_branding__g3OoE {
|
|
12387
|
-
justify-content: center;
|
|
12388
12387
|
grid-area: branding;
|
|
12389
12388
|
display: flex;
|
|
12390
|
-
|
|
12389
|
+
justify-content: center;
|
|
12391
12390
|
padding-top: var(--spacing-4);
|
|
12392
12391
|
|
|
12393
|
-
@media (width >=
|
|
12392
|
+
@media (width >=768px) {
|
|
12394
12393
|
justify-content: unset;
|
|
12395
12394
|
}
|
|
12396
12395
|
}
|
|
12397
12396
|
|
|
12398
12397
|
.Branding-module_logo__yLHfs {
|
|
12399
|
-
|
|
12398
|
+
width: 7.5rem;
|
|
12400
12399
|
}
|
|
12401
12400
|
|
|
12402
12401
|
.Root-module_root__-1P72 {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaizen/components",
|
|
3
|
-
"version": "1.64.
|
|
3
|
+
"version": "1.64.6",
|
|
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/package-bundler": "1.1.5",
|
|
124
|
+
"@kaizen/design-tokens": "10.6.1"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
127
|
"@cultureamp/i18n-react-intl": "^2.5.9",
|
package/src/Brand/Brand.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { HTMLAttributes, SVGAttributes } from "react"
|
|
2
|
+
import classnames from "classnames"
|
|
2
3
|
import { OverrideClassName } from "~components/types/OverrideClassName"
|
|
3
4
|
import { assetUrl } from "~components/utils/hostedAssets"
|
|
4
5
|
import { BrandCollectiveIntelligence } from "./BrandCollectiveIntelligence"
|
|
@@ -58,11 +59,11 @@ export const Brand = ({
|
|
|
58
59
|
)
|
|
59
60
|
}
|
|
60
61
|
|
|
61
|
-
const { alt, classNameOverride, ...otherProps } = restProps
|
|
62
|
+
const { alt, classNameOverride, style, ...otherProps } = restProps
|
|
62
63
|
const brandTheme = reversed ? "-reversed" : "-default"
|
|
63
64
|
|
|
64
65
|
return (
|
|
65
|
-
<picture
|
|
66
|
+
<picture {...otherProps}>
|
|
66
67
|
<source
|
|
67
68
|
srcSet={assetUrl(`brand/${variant}-reversed.svg`)}
|
|
68
69
|
media="(forced-colors: active) and (prefers-color-scheme: dark)"
|
|
@@ -74,7 +75,8 @@ export const Brand = ({
|
|
|
74
75
|
<img
|
|
75
76
|
src={assetUrl(`brand/${variant}${brandTheme}.svg`)}
|
|
76
77
|
alt={alt}
|
|
77
|
-
className={styles.img}
|
|
78
|
+
className={classnames(styles.img, classNameOverride)}
|
|
79
|
+
style={style}
|
|
78
80
|
/>
|
|
79
81
|
</picture>
|
|
80
82
|
)
|
|
@@ -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.queryByRole("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.queryByRole("listbox")).toHaveFocus()
|
|
111
111
|
})
|
|
112
112
|
})
|
|
113
113
|
|
|
@@ -79,12 +79,6 @@ 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
|
-
}
|
|
88
82
|
return (
|
|
89
83
|
<>
|
|
90
84
|
<HiddenSelect label={label} state={state} triggerRef={triggerRef} />
|
|
@@ -96,23 +90,19 @@ export const FilterSelect = <Option extends SelectOption = SelectOption>({
|
|
|
96
90
|
selectedValue: state.selectedItem?.textValue || undefined,
|
|
97
91
|
label,
|
|
98
92
|
isOpen,
|
|
99
|
-
...
|
|
93
|
+
...buttonProps,
|
|
100
94
|
})
|
|
101
95
|
}
|
|
102
96
|
onMount={setTriggerRef}
|
|
103
97
|
classNameOverride={classNameOverride}
|
|
104
98
|
>
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
<
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
</SelectPopoverContents>
|
|
113
|
-
</SelectProvider>
|
|
114
|
-
</FilterContents>
|
|
115
|
-
</>
|
|
99
|
+
<FilterContents classNameOverride={styles.filterContents}>
|
|
100
|
+
<SelectProvider<Option> state={state}>
|
|
101
|
+
<SelectPopoverContents menuProps={menuProps}>
|
|
102
|
+
{children}
|
|
103
|
+
</SelectPopoverContents>
|
|
104
|
+
</SelectProvider>
|
|
105
|
+
</FilterContents>
|
|
116
106
|
</Filter>
|
|
117
107
|
</>
|
|
118
108
|
)
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React, { useState } from "react"
|
|
2
|
-
import { Story } from "@storybook/blocks"
|
|
3
2
|
import { Meta, StoryObj } from "@storybook/react"
|
|
4
3
|
import { fn } from "@storybook/test"
|
|
5
4
|
import { renderTriggerControls } from "~components/Filter/_docs/controls/renderTriggerControls"
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
.branding {
|
|
2
|
-
justify-content: center;
|
|
3
2
|
grid-area: branding;
|
|
4
3
|
display: flex;
|
|
5
|
-
|
|
4
|
+
justify-content: center;
|
|
6
5
|
padding-top: var(--spacing-4);
|
|
7
6
|
|
|
8
|
-
@media (width >=
|
|
7
|
+
@media (width >=768px) {
|
|
9
8
|
justify-content: unset;
|
|
10
9
|
}
|
|
11
10
|
}
|
|
12
11
|
|
|
13
12
|
.logo {
|
|
14
|
-
|
|
13
|
+
width: 7.5rem;
|
|
15
14
|
}
|
|
@@ -194,13 +194,11 @@ describe("<Select />", () => {
|
|
|
194
194
|
})
|
|
195
195
|
|
|
196
196
|
describe("Given the menu is opened", () => {
|
|
197
|
-
it("focuses
|
|
198
|
-
const { getByRole
|
|
199
|
-
<SelectWrapper defaultOpen />
|
|
200
|
-
)
|
|
197
|
+
it("focuses the listbox initially", async () => {
|
|
198
|
+
const { getByRole } = render(<SelectWrapper defaultOpen />)
|
|
201
199
|
expect(getByRole("listbox")).toBeVisible()
|
|
202
200
|
await waitFor(() => {
|
|
203
|
-
expect(
|
|
201
|
+
expect(getByRole("listbox")).toHaveFocus()
|
|
204
202
|
})
|
|
205
203
|
})
|
|
206
204
|
it("is closed when hits the escape key", async () => {
|
|
@@ -98,6 +98,8 @@ 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 behaviour 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,6 +1,5 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
import { Meta, StoryObj } from "@storybook/react"
|
|
3
|
-
import { ContextModal } from "~components/Modal"
|
|
4
3
|
import { Select } from "../Select"
|
|
5
4
|
import { SelectOption } from "../types"
|
|
6
5
|
import {
|
|
@@ -166,41 +165,25 @@ export const FullWidth: Story = {
|
|
|
166
165
|
export const PortalContainer: Story = {
|
|
167
166
|
render: args => {
|
|
168
167
|
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)
|
|
174
168
|
return (
|
|
175
169
|
<>
|
|
176
|
-
<div
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
170
|
+
<div
|
|
171
|
+
id={portalContainerId}
|
|
172
|
+
className="flex gap-24 bg-gray-200 p-12 overflow-hidden h-[200px] relative"
|
|
173
|
+
>
|
|
174
|
+
<Select
|
|
175
|
+
{...args}
|
|
176
|
+
label="Default"
|
|
177
|
+
selectedKey="batch-brew"
|
|
178
|
+
id="id--select-default"
|
|
179
|
+
/>
|
|
180
|
+
<Select
|
|
186
181
|
{...args}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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>
|
|
182
|
+
label="Inner portal"
|
|
183
|
+
selectedKey="batch-brew"
|
|
184
|
+
id="id--select-inner"
|
|
185
|
+
portalContainerId={portalContainerId}
|
|
186
|
+
/>
|
|
204
187
|
</div>
|
|
205
188
|
</>
|
|
206
189
|
)
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import React, { HTMLAttributes
|
|
1
|
+
import React, { HTMLAttributes } from "react"
|
|
2
2
|
import { AriaListBoxOptions, useListBox } from "@react-aria/listbox"
|
|
3
|
-
import { SelectState } from "@react-stately/select"
|
|
4
3
|
import classnames from "classnames"
|
|
5
4
|
import { OverrideClassName } from "~components/types/OverrideClassName"
|
|
6
5
|
import { useSelectContext } from "../../context"
|
|
@@ -15,21 +14,6 @@ export type SingleListBoxProps<Option extends SelectOption> = OverrideClassName<
|
|
|
15
14
|
menuProps: AriaListBoxOptions<SelectItem<Option>>
|
|
16
15
|
}
|
|
17
16
|
|
|
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
|
-
|
|
33
17
|
export const ListBox = <Option extends SelectOption>({
|
|
34
18
|
children,
|
|
35
19
|
menuProps,
|
|
@@ -38,40 +22,13 @@ export const ListBox = <Option extends SelectOption>({
|
|
|
38
22
|
}: SingleListBoxProps<Option>): JSX.Element => {
|
|
39
23
|
const { state } = useSelectContext<Option>()
|
|
40
24
|
const ref = React.useRef<HTMLUListElement>(null)
|
|
41
|
-
const [isListboxReady, setListboxReady] = React.useState(false)
|
|
42
25
|
const { listBoxProps } = useListBox(
|
|
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
|
-
},
|
|
26
|
+
{ ...menuProps, disallowEmptySelection: true },
|
|
49
27
|
state,
|
|
50
28
|
ref
|
|
51
29
|
)
|
|
52
30
|
|
|
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
|
-
|
|
73
31
|
return (
|
|
74
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
75
32
|
<ul
|
|
76
33
|
ref={ref}
|
|
77
34
|
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
|
|
39
|
+
<FocusScope autoFocus restoreFocus>
|
|
40
40
|
<DismissButton onDismiss={state.close} />
|
|
41
41
|
{children}
|
|
42
42
|
<DismissButton onDismiss={state.close} />
|