@kaizen/components 1.64.5 → 1.64.7

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.
@@ -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
- otherProps = tslib.__rest(restProps, ["alt", "classNameOverride"]);
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
- }, renderTriggerButtonProps));
73
+ }, buttonProps));
79
74
  },
80
75
  onMount: setTriggerRef,
81
76
  classNameOverride: classNameOverride
82
- }, React__default.default.createElement(React__default.default.Fragment, null, React__default.default.createElement(FilterContents.FilterContents, {
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: tslib.__assign(tslib.__assign({}, menuProps), {
88
- "aria-labelledby": buttonProps.id
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
- * 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
- );
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: false,
35
+ autoFocus: true,
36
36
  restoreFocus: true
37
37
  }, React__default.default.createElement(overlays.DismissButton, {
38
38
  onDismiss: state.close
@@ -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
- otherProps = __rest(restProps, ["alt", "classNameOverride"]);
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
- }, renderTriggerButtonProps));
66
+ }, buttonProps));
72
67
  },
73
68
  onMount: setTriggerRef,
74
69
  classNameOverride: classNameOverride
75
- }, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(FilterContents, {
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: __assign(__assign({}, menuProps), {
81
- "aria-labelledby": buttonProps.id
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, { useEffect } from '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
- * 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
- );
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: false,
28
+ autoFocus: true,
29
29
  restoreFocus: true
30
30
  }, /*#__PURE__*/React.createElement(DismissButton, {
31
31
  onDismiss: state.close
package/dist/styles.css CHANGED
@@ -1,31 +1,37 @@
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
- /** THIS IS AN AUTOGENERATED FILE **/
3
- /** THIS IS AN AUTOGENERATED FILE **/
4
- .OverlayArrow-module_overlayArrow__hoDyK {
2
+ .MenuItem-module_item__DPerF {
3
+ font-family: var(--typography-paragraph-body-font-family);
4
+ font-size: var(--typography-paragraph-body-font-size);
5
+ letter-spacing: var(--typography-paragraph-body-letter-spacing);
6
+ font-weight: var(--typography-paragraph-body-font-weight);
7
+ line-height: var(--typography-paragraph-body-line-height);
8
+ color: rgba(var(--color-purple-800-rgb), 0.7);
9
+ padding: var(--spacing-6) var(--spacing-8);
10
+ border: var(--border-focus-ring-border-width) var(--border-focus-ring-border-style) transparent;
11
+ border-radius: 4px;
5
12
  display: flex;
6
- padding: 8px;
7
- }
8
- .OverlayArrow-module_overlayArrow__hoDyK[data-placement=top], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] {
9
- padding: 0 8px;
10
- }
11
- .OverlayArrow-module_overlayArrow__hoDyK[data-placement=left], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] {
12
- padding: 8px 0;
13
- }
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));
17
- }
18
- .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg {
19
- transform: rotate(90deg);
13
+ gap: 0 var(--spacing-8);
14
+ align-items: center;
15
+ margin-inline: var(--spacing-6);
16
+ text-decoration: none;
17
+ cursor: pointer;
20
18
  }
21
- .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg {
22
- transform: rotate(180deg);
19
+
20
+ .MenuItem-module_iconWrapper__bRdQN {
21
+ flex-shrink: 0;
22
+ display: flex;
23
+ align-items: center;
23
24
  }
24
- .OverlayArrow-module_overlayArrow__hoDyK[data-placement=left] svg {
25
- transform: rotate(270deg);
25
+
26
+ .MenuItem-module_item__DPerF[data-focused] {
27
+ background-color: var(--color-blue-100);
28
+ color: var(--color-blue-500);
29
+ outline: none;
30
+ border-color: var(--color-blue-500);
26
31
  }
27
- .OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path {
28
- fill: var(--color-white, #ffffff);
32
+
33
+ .MenuItem-module_item__DPerF[data-disabled] {
34
+ opacity: 0.3;
29
35
  }
30
36
  .Button-module_button__QOSYH {
31
37
  --button-min-height-width: var(--spacing-48);
@@ -145,40 +151,6 @@
145
151
  display: block;
146
152
  margin-block: var(--spacing-6);
147
153
  }
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;
158
- display: flex;
159
- gap: 0 var(--spacing-8);
160
- align-items: center;
161
- margin-inline: var(--spacing-6);
162
- text-decoration: none;
163
- cursor: pointer;
164
- }
165
-
166
- .MenuItem-module_iconWrapper__bRdQN {
167
- flex-shrink: 0;
168
- display: flex;
169
- align-items: center;
170
- }
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);
177
- }
178
-
179
- .MenuItem-module_item__DPerF[data-disabled] {
180
- opacity: 0.3;
181
- }
182
154
  .Focusable-module_focusableWrapper__NfuIi {
183
155
  display: inline-flex;
184
156
  }
@@ -238,6 +210,34 @@
238
210
  opacity: 1;
239
211
  }
240
212
  }
213
+ /** THIS IS AN AUTOGENERATED FILE **/
214
+ /** THIS IS AN AUTOGENERATED FILE **/
215
+ .OverlayArrow-module_overlayArrow__hoDyK {
216
+ display: flex;
217
+ padding: 8px;
218
+ }
219
+ .OverlayArrow-module_overlayArrow__hoDyK[data-placement=top], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] {
220
+ padding: 0 8px;
221
+ }
222
+ .OverlayArrow-module_overlayArrow__hoDyK[data-placement=left], .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] {
223
+ padding: 8px 0;
224
+ }
225
+ .OverlayArrow-module_overlayArrow__hoDyK path {
226
+ fill: var(--color-purple-800, #2f2438);
227
+ 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));
228
+ }
229
+ .OverlayArrow-module_overlayArrow__hoDyK[data-placement=right] svg {
230
+ transform: rotate(90deg);
231
+ }
232
+ .OverlayArrow-module_overlayArrow__hoDyK[data-placement=bottom] svg {
233
+ transform: rotate(180deg);
234
+ }
235
+ .OverlayArrow-module_overlayArrow__hoDyK[data-placement=left] svg {
236
+ transform: rotate(270deg);
237
+ }
238
+ .OverlayArrow-module_overlayArrow__hoDyK.OverlayArrow-module_reversed__-WGcR path {
239
+ fill: var(--color-white, #ffffff);
240
+ }
241
241
  .SVG-module_icon__8J5Ev {
242
242
  width: 20px;
243
243
  height: 20px;
@@ -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
- flex-grow: 1;
12389
+ justify-content: center;
12391
12390
  padding-top: var(--spacing-4);
12392
12391
 
12393
- @media (width >= 768px) {
12392
+ @media (width >=768px) {
12394
12393
  justify-content: unset;
12395
12394
  }
12396
12395
  }
12397
12396
 
12398
12397
  .Branding-module_logo__yLHfs {
12399
- flex-basis: 7.5rem;
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.5",
3
+ "version": "1.64.7",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "type": "module",
37
37
  "dependencies": {
38
- "@floating-ui/react-dom": "^2.1.1",
38
+ "@floating-ui/react-dom": "^2.1.2",
39
39
  "@headlessui/react": "<=1.5.0",
40
40
  "@internationalized/date": "^3.5.5",
41
41
  "@popperjs/core": "^2.11.8",
@@ -56,7 +56,7 @@
56
56
  "@react-stately/select": "^3.6.6",
57
57
  "@react-types/shared": "^3.24.1",
58
58
  "classnames": "^2.5.1",
59
- "date-fns": "^3.6.0",
59
+ "date-fns": "^4.1.0",
60
60
  "lodash.debounce": "^4.0.8",
61
61
  "nanobus": "^4.5.0",
62
62
  "prosemirror-commands": "^1.6.0",
@@ -67,31 +67,31 @@
67
67
  "prosemirror-schema-basic": "^1.2.3",
68
68
  "prosemirror-schema-list": "^1.4.1",
69
69
  "prosemirror-state": "^1.4.3",
70
- "prosemirror-transform": "^1.9.0",
70
+ "prosemirror-transform": "^1.10.0",
71
71
  "prosemirror-utils": "^1.2.2",
72
- "prosemirror-view": "^1.33.9",
72
+ "prosemirror-view": "^1.34.3",
73
73
  "react-animate-height": "^3.2.3",
74
74
  "react-aria": "^3.34.1",
75
75
  "react-aria-components": "^1.3.1",
76
76
  "react-day-picker": "8.10.1",
77
- "react-focus-lock": "^2.12.1",
77
+ "react-focus-lock": "^2.13.2",
78
78
  "react-focus-on": "^3.9.3",
79
79
  "react-media": "^1.10.0",
80
80
  "react-popper": "^2.3.0",
81
- "react-select": "^5.8.0",
81
+ "react-select": "^5.8.1",
82
82
  "react-textfit": "^1.1.1",
83
83
  "resize-observer-polyfill": "^1.5.1",
84
84
  "tsx": "^4.17.0",
85
- "use-debounce": "^10.0.2",
85
+ "use-debounce": "^10.0.3",
86
86
  "uuid": "^10.0.0"
87
87
  },
88
88
  "dependenciesComments": {
89
89
  "react-day-picker": "Version locked until a11y gets fixed (https://github.com/gpbl/react-day-picker/pull/1708)"
90
90
  },
91
91
  "devDependencies": {
92
- "@cultureamp/frontend-apis": "^9.8.2",
93
- "@cultureamp/i18n-react-intl": "^2.6.1",
94
- "@tanstack/react-query": "^5.51.23",
92
+ "@cultureamp/frontend-apis": "^9.9.0",
93
+ "@cultureamp/i18n-react-intl": "^2.6.3",
94
+ "@tanstack/react-query": "^5.56.2",
95
95
  "@testing-library/dom": "^10.4.0",
96
96
  "@types/jest-axe": "^3.5.9",
97
97
  "@types/lodash.debounce": "^4.0.9",
@@ -104,7 +104,7 @@
104
104
  "jest-axe": "^9.0.0",
105
105
  "lodash.isempty": "^4.4.0",
106
106
  "normalize.css": "^8.0.1",
107
- "postcss": "^8.4.41",
107
+ "postcss": "^8.4.47",
108
108
  "postcss-cli": "^11.0.0",
109
109
  "postcss-import": "^16.1.0",
110
110
  "postcss-preset-env": "^10.0.2",
@@ -113,15 +113,15 @@
113
113
  "react": "^18.3.1",
114
114
  "react-dom": "^18.3.1",
115
115
  "react-highlight": "^0.15.0",
116
- "react-intl": "^6.6.8",
117
- "rollup": "^4.20.0",
116
+ "react-intl": "^6.7.0",
117
+ "rollup": "^4.22.5",
118
118
  "sass": "^1.77.8",
119
119
  "serialize-query-params": "^2.0.2",
120
120
  "svgo": "^3.3.2",
121
- "tslib": "^2.6.3",
121
+ "tslib": "^2.7.0",
122
122
  "tsx": "^4.17.0",
123
- "@kaizen/design-tokens": "10.6.1",
124
- "@kaizen/package-bundler": "1.1.5"
123
+ "@kaizen/design-tokens": "10.6.2",
124
+ "@kaizen/package-bundler": "1.1.6"
125
125
  },
126
126
  "peerDependencies": {
127
127
  "@cultureamp/i18n-react-intl": "^2.5.9",
@@ -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 className={classNameOverride} {...otherProps}>
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.getByRole("listbox")).toBeVisible()
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.getAllByRole("option")[0]).toHaveFocus()
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
- ...renderTriggerButtonProps,
93
+ ...buttonProps,
100
94
  })
101
95
  }
102
96
  onMount={setTriggerRef}
103
97
  classNameOverride={classNameOverride}
104
98
  >
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
- </>
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
- flex-grow: 1;
4
+ justify-content: center;
6
5
  padding-top: var(--spacing-4);
7
6
 
8
- @media (width >= 768px) {
7
+ @media (width >=768px) {
9
8
  justify-content: unset;
10
9
  }
11
10
  }
12
11
 
13
12
  .logo {
14
- flex-basis: 7.5rem;
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 on the first item", async () => {
198
- const { getByRole, getAllByRole } = render(
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(getAllByRole("option")[0]).toHaveFocus()
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 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.
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 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
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
- 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>
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, Key, useEffect } from "react"
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={false} restoreFocus>
39
+ <FocusScope autoFocus restoreFocus>
40
40
  <DismissButton onDismiss={state.close} />
41
41
  {children}
42
42
  <DismissButton onDismiss={state.close} />