@kaizen/components 1.70.5 → 1.70.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.
Files changed (43) hide show
  1. package/dist/cjs/Filter/Filter/subcomponents/FilterContents/FilterContents.cjs +1 -1
  2. package/dist/cjs/Filter/Filter/subcomponents/FilterContents/FilterContents.module.css.cjs +6 -0
  3. package/dist/cjs/Filter/Filter/subcomponents/FilterPopover/FilterPopover.cjs +1 -1
  4. package/dist/cjs/Filter/Filter/subcomponents/FilterPopover/FilterPopover.module.css.cjs +6 -0
  5. package/dist/cjs/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.cjs +1 -1
  6. package/dist/cjs/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.module.css.cjs +7 -0
  7. package/dist/cjs/Filter/FilterSelect/FilterSelect.cjs +1 -1
  8. package/dist/cjs/Filter/FilterSelect/FilterSelect.module.css.cjs +6 -0
  9. package/dist/cjs/KaizenProvider/KaizenProvider.cjs +2 -6
  10. package/dist/cjs/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.cjs +19 -17
  11. package/dist/esm/Filter/Filter/subcomponents/FilterContents/FilterContents.mjs +1 -1
  12. package/dist/esm/Filter/Filter/subcomponents/FilterContents/FilterContents.module.css.mjs +4 -0
  13. package/dist/esm/Filter/Filter/subcomponents/FilterPopover/FilterPopover.mjs +1 -1
  14. package/dist/esm/Filter/Filter/subcomponents/FilterPopover/FilterPopover.module.css.mjs +4 -0
  15. package/dist/esm/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.mjs +1 -1
  16. package/dist/esm/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.module.css.mjs +5 -0
  17. package/dist/esm/Filter/FilterSelect/FilterSelect.mjs +1 -1
  18. package/dist/esm/Filter/FilterSelect/FilterSelect.module.css.mjs +4 -0
  19. package/dist/esm/KaizenProvider/KaizenProvider.mjs +2 -6
  20. package/dist/esm/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.mjs +20 -18
  21. package/dist/styles.css +17 -17
  22. package/package.json +3 -3
  23. package/src/Filter/Filter/subcomponents/FilterContents/FilterContents.module.css +3 -0
  24. package/src/Filter/Filter/subcomponents/FilterContents/FilterContents.tsx +1 -1
  25. package/src/Filter/Filter/subcomponents/FilterPopover/FilterPopover.module.css +7 -0
  26. package/src/Filter/Filter/subcomponents/FilterPopover/FilterPopover.tsx +1 -1
  27. package/src/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.tsx +1 -1
  28. package/src/Filter/FilterSelect/FilterSelect.module.css +8 -0
  29. package/src/Filter/FilterSelect/FilterSelect.tsx +1 -1
  30. package/src/KaizenProvider/KaizenProvider.tsx +2 -4
  31. package/src/Notification/ToastNotification/ToastNotificationsList/ToastNotificationsList.tsx +24 -25
  32. package/dist/cjs/Filter/Filter/subcomponents/FilterContents/FilterContents.module.scss.cjs +0 -6
  33. package/dist/cjs/Filter/Filter/subcomponents/FilterPopover/FilterPopover.module.scss.cjs +0 -6
  34. package/dist/cjs/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.module.scss.cjs +0 -7
  35. package/dist/cjs/Filter/FilterSelect/FilterSelect.module.scss.cjs +0 -6
  36. package/dist/esm/Filter/Filter/subcomponents/FilterContents/FilterContents.module.scss.mjs +0 -4
  37. package/dist/esm/Filter/Filter/subcomponents/FilterPopover/FilterPopover.module.scss.mjs +0 -4
  38. package/dist/esm/Filter/FilterBar/subcomponents/ClearAllButton/ClearAllButton.module.scss.mjs +0 -5
  39. package/dist/esm/Filter/FilterSelect/FilterSelect.module.scss.mjs +0 -4
  40. package/src/Filter/Filter/subcomponents/FilterContents/FilterContents.module.scss +0 -5
  41. package/src/Filter/Filter/subcomponents/FilterPopover/FilterPopover.module.scss +0 -11
  42. package/src/Filter/FilterSelect/FilterSelect.module.scss +0 -10
  43. /package/src/Filter/FilterBar/subcomponents/ClearAllButton/{ClearAllButton.module.scss → ClearAllButton.module.css} +0 -0
@@ -3,7 +3,7 @@
3
3
  var tslib = require('tslib');
4
4
  var React = require('react');
5
5
  var classnames = require('classnames');
6
- var FilterContents_module = require('./FilterContents.module.scss.cjs');
6
+ var FilterContents_module = require('./FilterContents.module.css.cjs');
7
7
  function _interopDefault(e) {
8
8
  return e && e.__esModule ? e : {
9
9
  default: e
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "filterContents": "FilterContents-module_filterContents__LEVFe"
5
+ };
6
+ module.exports = styles;
@@ -4,7 +4,7 @@ var tslib = require('tslib');
4
4
  var React = require('react');
5
5
  var classnames = require('classnames');
6
6
  var reactPopper = require('react-popper');
7
- var FilterPopover_module = require('./FilterPopover.module.scss.cjs');
7
+ var FilterPopover_module = require('./FilterPopover.module.css.cjs');
8
8
  function _interopDefault(e) {
9
9
  return e && e.__esModule ? e : {
10
10
  default: e
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "filterPopover": "FilterPopover-module_filterPopover__ZAkra"
5
+ };
6
+ module.exports = styles;
@@ -6,7 +6,7 @@ var classnames = require('classnames');
6
6
  var Button = require('../../../../Button/Button/Button.cjs');
7
7
  require('../../../../Button/IconButton/IconButton.cjs');
8
8
  var FilterBarContext = require('../../context/FilterBarContext.cjs');
9
- var ClearAllButton_module = require('./ClearAllButton.module.scss.cjs');
9
+ var ClearAllButton_module = require('./ClearAllButton.module.css.cjs');
10
10
  function _interopDefault(e) {
11
11
  return e && e.__esModule ? e : {
12
12
  default: e
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "clearAllButton": "ClearAllButton-module_clearAllButton__dl4nS",
5
+ "hidden": "ClearAllButton-module_hidden__guVNI"
6
+ };
7
+ module.exports = styles;
@@ -19,7 +19,7 @@ var SelectPopoverContents = require('../../__rc__/Select/subcomponents/SelectPop
19
19
  require('../../__rc__/Select/subcomponents/SelectToggle/SelectToggle.cjs');
20
20
  var getDisabledKeysFromItems = require('../../__rc__/Select/utils/getDisabledKeysFromItems.cjs');
21
21
  var transformSelectItemToCollectionElement = require('../../__rc__/Select/utils/transformSelectItemToCollectionElement.cjs');
22
- var FilterSelect_module = require('./FilterSelect.module.scss.cjs');
22
+ var FilterSelect_module = require('./FilterSelect.module.css.cjs');
23
23
  function _interopDefault(e) {
24
24
  return e && e.__esModule ? e : {
25
25
  default: e
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ var styles = {
4
+ "filterContents": "FilterSelect-module_filterContents__--oQN"
5
+ };
6
+ module.exports = styles;
@@ -21,20 +21,16 @@ var KaizenProvider = function (_a) {
21
21
  var _c = React.useState(false),
22
22
  documentIsAvailable = _c[0],
23
23
  setDocumentIsAvailable = _c[1];
24
- var _d = React.useState(),
25
- notificationsList = _d[0],
26
- setNotificationsList = _d[1];
27
24
  React.useEffect(function () {
28
25
  // SSR does not have a document, which is required for ToastNotificationsList.
29
26
  // Await document render before rendering the component.
30
27
  if (document !== undefined) {
31
- setNotificationsList(React__default.default.createElement(ToastNotificationsList.ToastNotificationsList, null));
32
28
  setDocumentIsAvailable(true);
33
29
  }
34
- }, [documentIsAvailable]);
30
+ }, []);
35
31
  return React__default.default.createElement(OptionalIntlProvider.OptionalIntlProvider, {
36
32
  locale: locale
37
- }, React__default.default.createElement(ToastNotificationContext.ToastNotificationProvider, null, notificationsList, children), React__default.default.createElement(FontDefinitions.FontDefinitions, null));
33
+ }, React__default.default.createElement(ToastNotificationContext.ToastNotificationProvider, null, documentIsAvailable && React__default.default.createElement(ToastNotificationsList.ToastNotificationsList, null), children), React__default.default.createElement(FontDefinitions.FontDefinitions, null));
38
34
  };
39
35
  KaizenProvider.displayName = 'KaizenProvider';
40
36
  exports.KaizenProvider = KaizenProvider;
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var ReactDOM = require('react-dom');
5
4
  var ToastNotificationContext = require('../context/ToastNotificationContext.cjs');
6
5
  var ToastNotificationsMap = require('./subcomponents/ToastNotificationsMap/ToastNotificationsMap.cjs');
7
6
  var ToastNotificationsList_module = require('./ToastNotificationsList.module.scss.cjs');
@@ -11,28 +10,31 @@ function _interopDefault(e) {
11
10
  };
12
11
  }
13
12
  var React__default = /*#__PURE__*/_interopDefault(React);
13
+ var toastNotificationListId = 'toast-notifications-list';
14
14
  var ToastNotificationsList = function () {
15
15
  var _a = ToastNotificationContext.useToastNotificationContext(),
16
16
  notifications = _a.notifications,
17
17
  removeToastNotification = _a.removeToastNotification;
18
- var containers = document.querySelectorAll('[data-testid="toast-notifications-list"');
19
- if (containers) {
20
- // Remove any duplicate instances
21
- // (eg. Storybook docs page has multiple stories each with their own context)
22
- containers.forEach(function (c, i) {
23
- if (i === 0) return;
24
- c.remove();
25
- });
26
- }
27
- return ReactDOM.createPortal(React__default.default.createElement("div", {
28
- "data-testid": "toast-notifications-list",
29
- role: "status",
30
- className: ToastNotificationsList_module.toastNotificationsList
31
- }, React__default.default.createElement(ToastNotificationsMap.ToastNotificationsMap, {
18
+ var _b = React.useState(null),
19
+ toastContainer = _b[0],
20
+ setToastContainer = _b[1];
21
+ React.useEffect(function () {
22
+ // this is to ensure that the container is created only once. Regardless of how many KaizenProvider is set up, they will also reuse the same container.
23
+ var container = document.querySelector("[id=\"".concat(toastNotificationListId, "\"]"));
24
+ if (!container) {
25
+ container = document.createElement('div');
26
+ container.setAttribute('id', toastNotificationListId);
27
+ container.setAttribute('role', 'status');
28
+ container.className = ToastNotificationsList_module.toastNotificationsList;
29
+ document.body.appendChild(container);
30
+ }
31
+ setToastContainer(container);
32
+ }, []);
33
+ return toastContainer ? React__default.default.createElement(ToastNotificationsMap.ToastNotificationsMap, {
32
34
  notifications: notifications,
33
35
  onHide: removeToastNotification,
34
- container: containers[0]
35
- })), document.body);
36
+ container: toastContainer
37
+ }) : React__default.default.createElement(React__default.default.Fragment, null);
36
38
  };
37
39
  ToastNotificationsList.displayName = 'ToastNotificationsList';
38
40
  exports.ToastNotificationsList = ToastNotificationsList;
@@ -1,7 +1,7 @@
1
1
  import { __rest, __assign } from 'tslib';
2
2
  import React from 'react';
3
3
  import classnames from 'classnames';
4
- import styles from './FilterContents.module.scss.mjs';
4
+ import styles from './FilterContents.module.css.mjs';
5
5
  const FilterContents = /*#__PURE__*/function () {
6
6
  const FilterContents = function (_a) {
7
7
  var children = _a.children,
@@ -0,0 +1,4 @@
1
+ var styles = {
2
+ "filterContents": "FilterContents-module_filterContents__LEVFe"
3
+ };
4
+ export { styles as default };
@@ -2,7 +2,7 @@ import { __rest, __assign } from 'tslib';
2
2
  import React, { useState } from 'react';
3
3
  import classnames from 'classnames';
4
4
  import { usePopper } from 'react-popper';
5
- import styles from './FilterPopover.module.scss.mjs';
5
+ import styles from './FilterPopover.module.css.mjs';
6
6
  const FilterPopover = /*#__PURE__*/function () {
7
7
  const FilterPopover = function (_a) {
8
8
  var children = _a.children,
@@ -0,0 +1,4 @@
1
+ var styles = {
2
+ "filterPopover": "FilterPopover-module_filterPopover__ZAkra"
3
+ };
4
+ export { styles as default };
@@ -4,7 +4,7 @@ import classnames from 'classnames';
4
4
  import { Button } from '../../../../Button/Button/Button.mjs';
5
5
  import '../../../../Button/IconButton/IconButton.mjs';
6
6
  import { useFilterBarContext } from '../../context/FilterBarContext.mjs';
7
- import styles from './ClearAllButton.module.scss.mjs';
7
+ import styles from './ClearAllButton.module.css.mjs';
8
8
  const ClearAllButton = /*#__PURE__*/function () {
9
9
  const ClearAllButton = function () {
10
10
  var _a;
@@ -0,0 +1,5 @@
1
+ var styles = {
2
+ "clearAllButton": "ClearAllButton-module_clearAllButton__dl4nS",
3
+ "hidden": "ClearAllButton-module_hidden__guVNI"
4
+ };
5
+ export { styles as default };
@@ -17,7 +17,7 @@ import { SelectPopoverContents } from '../../__rc__/Select/subcomponents/SelectP
17
17
  import '../../__rc__/Select/subcomponents/SelectToggle/SelectToggle.mjs';
18
18
  import { getDisabledKeysFromItems } from '../../__rc__/Select/utils/getDisabledKeysFromItems.mjs';
19
19
  import { transformSelectItemToCollectionElement } from '../../__rc__/Select/utils/transformSelectItemToCollectionElement.mjs';
20
- import styles from './FilterSelect.module.scss.mjs';
20
+ import styles from './FilterSelect.module.css.mjs';
21
21
  const FilterSelect = /*#__PURE__*/function () {
22
22
  const FilterSelect = function (_a) {
23
23
  var isOpen = _a.isOpen,
@@ -0,0 +1,4 @@
1
+ var styles = {
2
+ "filterContents": "FilterSelect-module_filterContents__--oQN"
3
+ };
4
+ export { styles as default };
@@ -14,20 +14,16 @@ const KaizenProvider = /*#__PURE__*/function () {
14
14
  var _c = useState(false),
15
15
  documentIsAvailable = _c[0],
16
16
  setDocumentIsAvailable = _c[1];
17
- var _d = useState(),
18
- notificationsList = _d[0],
19
- setNotificationsList = _d[1];
20
17
  useEffect(function () {
21
18
  // SSR does not have a document, which is required for ToastNotificationsList.
22
19
  // Await document render before rendering the component.
23
20
  if (document !== undefined) {
24
- setNotificationsList( /*#__PURE__*/React.createElement(ToastNotificationsList, null));
25
21
  setDocumentIsAvailable(true);
26
22
  }
27
- }, [documentIsAvailable]);
23
+ }, []);
28
24
  return /*#__PURE__*/React.createElement(OptionalIntlProvider, {
29
25
  locale: locale
30
- }, /*#__PURE__*/React.createElement(ToastNotificationProvider, null, notificationsList, children), /*#__PURE__*/React.createElement(FontDefinitions, null));
26
+ }, /*#__PURE__*/React.createElement(ToastNotificationProvider, null, documentIsAvailable && /*#__PURE__*/React.createElement(ToastNotificationsList, null), children), /*#__PURE__*/React.createElement(FontDefinitions, null));
31
27
  };
32
28
  KaizenProvider.displayName = 'KaizenProvider';
33
29
  return KaizenProvider;
@@ -1,31 +1,33 @@
1
- import React from 'react';
2
- import { createPortal } from 'react-dom';
1
+ import React, { useState, useEffect } from 'react';
3
2
  import { useToastNotificationContext } from '../context/ToastNotificationContext.mjs';
4
3
  import { ToastNotificationsMap } from './subcomponents/ToastNotificationsMap/ToastNotificationsMap.mjs';
5
4
  import styles from './ToastNotificationsList.module.scss.mjs';
5
+ var toastNotificationListId = 'toast-notifications-list';
6
6
  const ToastNotificationsList = /*#__PURE__*/function () {
7
7
  const ToastNotificationsList = function () {
8
8
  var _a = useToastNotificationContext(),
9
9
  notifications = _a.notifications,
10
10
  removeToastNotification = _a.removeToastNotification;
11
- var containers = document.querySelectorAll('[data-testid="toast-notifications-list"');
12
- if (containers) {
13
- // Remove any duplicate instances
14
- // (eg. Storybook docs page has multiple stories each with their own context)
15
- containers.forEach(function (c, i) {
16
- if (i === 0) return;
17
- c.remove();
18
- });
19
- }
20
- return /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement("div", {
21
- "data-testid": "toast-notifications-list",
22
- role: "status",
23
- className: styles.toastNotificationsList
24
- }, /*#__PURE__*/React.createElement(ToastNotificationsMap, {
11
+ var _b = useState(null),
12
+ toastContainer = _b[0],
13
+ setToastContainer = _b[1];
14
+ useEffect(function () {
15
+ // this is to ensure that the container is created only once. Regardless of how many KaizenProvider is set up, they will also reuse the same container.
16
+ var container = document.querySelector("[id=\"".concat(toastNotificationListId, "\"]"));
17
+ if (!container) {
18
+ container = document.createElement('div');
19
+ container.setAttribute('id', toastNotificationListId);
20
+ container.setAttribute('role', 'status');
21
+ container.className = styles.toastNotificationsList;
22
+ document.body.appendChild(container);
23
+ }
24
+ setToastContainer(container);
25
+ }, []);
26
+ return toastContainer ? ( /*#__PURE__*/React.createElement(ToastNotificationsMap, {
25
27
  notifications: notifications,
26
28
  onHide: removeToastNotification,
27
- container: containers[0]
28
- })), document.body);
29
+ container: toastContainer
30
+ })) : ( /*#__PURE__*/React.createElement(React.Fragment, null));
29
31
  };
30
32
  ToastNotificationsList.displayName = 'ToastNotificationsList';
31
33
  return ToastNotificationsList;
package/dist/styles.css CHANGED
@@ -3565,26 +3565,24 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
3565
3565
  display: inline;
3566
3566
  margin-bottom: 0;
3567
3567
  }
3568
- /** THIS IS AN AUTOGENERATED FILE **/
3569
- /** THIS IS AN AUTOGENERATED FILE **/
3570
- /** THIS IS AN AUTOGENERATED FILE **/
3571
- .FilterPopover-module_filterPopover__eVkH6 {
3572
- background-color: var(--color-white, #ffffff);
3568
+ .FilterPopover-module_filterPopover__ZAkra {
3569
+ background-color: var(--color-white);
3573
3570
  z-index: 1010;
3574
- box-shadow: var(--shadow-large-box-shadow, 0 3px 9px 0 rgba(0, 0, 0, 0.1), 0 8px 40px 0 rgba(0, 0, 0, 0.08));
3575
- border-radius: var(--border-borderless-border-radius, 7px);
3571
+ box-shadow: var(--shadow-large-box-shadow);
3572
+ border-radius: var(--border-borderless-border-radius);
3576
3573
  display: inline-flex;
3577
3574
  }
3575
+
3578
3576
  @media (width < 768px) {
3579
3577
  .Filter-module_filter__u3IkC {
3580
3578
  flex-basis: 100%;
3581
3579
  }
3582
3580
  }
3583
3581
 
3584
- /** THIS IS AN AUTOGENERATED FILE **/
3585
- .FilterContents-module_filterContents__tQWu8 {
3586
- padding: var(--spacing-md, 1.5rem);
3582
+ .FilterContents-module_filterContents__LEVFe {
3583
+ padding: var(--spacing-24);
3587
3584
  }
3585
+
3588
3586
  .DateInputField-module_disabled__gfago {
3589
3587
  opacity: 0.3;
3590
3588
  }
@@ -4160,14 +4158,15 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
4160
4158
  text-overflow: ellipsis;
4161
4159
  padding-inline-end: var(--spacing-12);
4162
4160
  }
4163
- /** THIS IS AN AUTOGENERATED FILE **/
4164
- .FilterSelect-module_filterContents__p7Kgc {
4161
+ /* This a temporary fix to increase specificity, until we figure out why this CSS is being compiled later than the padding in the FilterContents sub-component */
4162
+ .FilterSelect-module_filterContents__--oQN.FilterSelect-module_filterContents__--oQN {
4165
4163
  box-sizing: border-box;
4166
- min-width: 12.25rem;
4167
- max-width: 25rem;
4164
+ min-width: 12.25rem; /* 196px */
4165
+ max-width: 25rem; /* 400px */
4168
4166
  overflow: auto;
4169
- padding: unset;
4167
+ padding: unset; /* Padding is added by <SelectPopoverContents> */
4170
4168
  }
4169
+
4171
4170
  /** THIS IS AN AUTOGENERATED FILE **/
4172
4171
  /** THIS IS AN AUTOGENERATED FILE **/
4173
4172
  /** THIS IS AN AUTOGENERATED FILE **/
@@ -4304,13 +4303,14 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
4304
4303
  display: block;
4305
4304
  margin: 5px 0;
4306
4305
  }
4307
- .ClearAllButton-module_clearAllButton__XNkm2 {
4306
+ .ClearAllButton-module_clearAllButton__dl4nS {
4308
4307
  white-space: nowrap;
4309
4308
  }
4310
4309
 
4311
- .ClearAllButton-module_hidden__-L2eA {
4310
+ .ClearAllButton-module_hidden__guVNI {
4312
4311
  visibility: hidden;
4313
4312
  }
4313
+
4314
4314
  .FilterBar-module_filterBar__JEVKL {
4315
4315
  display: flex;
4316
4316
  padding: var(--spacing-8);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.70.5",
3
+ "version": "1.70.7",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -117,8 +117,8 @@
117
117
  "svgo": "^3.3.2",
118
118
  "tslib": "^2.8.1",
119
119
  "tsx": "^4.19.2",
120
- "@kaizen/design-tokens": "10.8.6",
121
- "@kaizen/package-bundler": "2.0.3"
120
+ "@kaizen/package-bundler": "2.0.3",
121
+ "@kaizen/design-tokens": "10.8.6"
122
122
  },
123
123
  "devDependenciesComments": {
124
124
  "sass": "Prevent deprecation warnings introduced in 1.80 as we plan to move away from sass",
@@ -0,0 +1,3 @@
1
+ .filterContents {
2
+ padding: var(--spacing-24);
3
+ }
@@ -1,7 +1,7 @@
1
1
  import React, { type HTMLAttributes } from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { type OverrideClassName } from '~components/types/OverrideClassName'
4
- import styles from './FilterContents.module.scss'
4
+ import styles from './FilterContents.module.css'
5
5
 
6
6
  export type FilterContentsProps = {
7
7
  children: React.ReactNode
@@ -0,0 +1,7 @@
1
+ .filterPopover {
2
+ background-color: var(--color-white);
3
+ z-index: 1010;
4
+ box-shadow: var(--shadow-large-box-shadow);
5
+ border-radius: var(--border-borderless-border-radius);
6
+ display: inline-flex;
7
+ }
@@ -3,7 +3,7 @@ import { type Options } from '@popperjs/core'
3
3
  import classnames from 'classnames'
4
4
  import { usePopper } from 'react-popper'
5
5
  import { type OverrideClassName } from '~components/types/OverrideClassName'
6
- import styles from './FilterPopover.module.scss'
6
+ import styles from './FilterPopover.module.css'
7
7
 
8
8
  export type FilterPopoverProps = {
9
9
  children: React.ReactNode
@@ -3,7 +3,7 @@ import { useIntl } from '@cultureamp/i18n-react-intl'
3
3
  import classnames from 'classnames'
4
4
  import { Button } from '~components/Button'
5
5
  import { useFilterBarContext } from '../../context/FilterBarContext'
6
- import styles from './ClearAllButton.module.scss'
6
+ import styles from './ClearAllButton.module.css'
7
7
 
8
8
  export const ClearAllButton = (): JSX.Element => {
9
9
  const { formatMessage } = useIntl()
@@ -0,0 +1,8 @@
1
+ /* This a temporary fix to increase specificity, until we figure out why this CSS is being compiled later than the padding in the FilterContents sub-component */
2
+ .filterContents.filterContents {
3
+ box-sizing: border-box;
4
+ min-width: 12.25rem; /* 196px */
5
+ max-width: 25rem; /* 400px */
6
+ overflow: auto;
7
+ padding: unset; /* Padding is added by <SelectPopoverContents> */
8
+ }
@@ -17,7 +17,7 @@ import { getDisabledKeysFromItems } from '~components/__rc__/Select/utils/getDis
17
17
  import { transformSelectItemToCollectionElement } from '~components/__rc__/Select/utils/transformSelectItemToCollectionElement'
18
18
  import { type OverrideClassName } from '~components/types/OverrideClassName'
19
19
  import { type SelectItem, type SelectOption } from './types'
20
- import styles from './FilterSelect.module.scss'
20
+ import styles from './FilterSelect.module.css'
21
21
 
22
22
  type OmittedAriaSelectProps =
23
23
  | 'label'
@@ -11,21 +11,19 @@ export type KaizenProviderProps = {
11
11
 
12
12
  export const KaizenProvider = ({ children, locale = 'en' }: KaizenProviderProps): JSX.Element => {
13
13
  const [documentIsAvailable, setDocumentIsAvailable] = useState<boolean>(false)
14
- const [notificationsList, setNotificationsList] = useState<JSX.Element>()
15
14
 
16
15
  useEffect(() => {
17
16
  // SSR does not have a document, which is required for ToastNotificationsList.
18
17
  // Await document render before rendering the component.
19
18
  if (document !== undefined) {
20
- setNotificationsList(<ToastNotificationsList />)
21
19
  setDocumentIsAvailable(true)
22
20
  }
23
- }, [documentIsAvailable])
21
+ }, [])
24
22
 
25
23
  return (
26
24
  <OptionalIntlProvider locale={locale}>
27
25
  <ToastNotificationProvider>
28
- {notificationsList}
26
+ {documentIsAvailable && <ToastNotificationsList />}
29
27
  {children}
30
28
  </ToastNotificationProvider>
31
29
  <FontDefinitions />
@@ -1,36 +1,35 @@
1
- import React from 'react'
2
- import { createPortal } from 'react-dom'
1
+ import React, { useEffect, useState } from 'react'
3
2
  import { useToastNotificationContext } from '../context/ToastNotificationContext'
4
3
  import { ToastNotificationsMap } from './subcomponents/ToastNotificationsMap'
5
4
  import styles from './ToastNotificationsList.module.scss'
6
5
 
6
+ const toastNotificationListId = 'toast-notifications-list'
7
+
7
8
  export const ToastNotificationsList = (): JSX.Element => {
8
9
  const { notifications, removeToastNotification } = useToastNotificationContext()
10
+ const [toastContainer, setToastContainer] = useState<Element | null>(null)
9
11
 
10
- const containers = document.querySelectorAll('[data-testid="toast-notifications-list"')
11
-
12
- if (containers) {
13
- // Remove any duplicate instances
14
- // (eg. Storybook docs page has multiple stories each with their own context)
15
- containers.forEach((c, i) => {
16
- if (i === 0) return
17
- c.remove()
18
- })
19
- }
12
+ useEffect(() => {
13
+ // this is to ensure that the container is created only once. Regardless of how many KaizenProvider is set up, they will also reuse the same container.
14
+ let container = document.querySelector(`[id="${toastNotificationListId}"]`)
15
+ if (!container) {
16
+ container = document.createElement('div')
17
+ container.setAttribute('id', toastNotificationListId)
18
+ container.setAttribute('role', 'status')
19
+ container.className = styles.toastNotificationsList
20
+ document.body.appendChild(container)
21
+ }
22
+ setToastContainer(container)
23
+ }, [])
20
24
 
21
- return createPortal(
22
- <div
23
- data-testid="toast-notifications-list"
24
- role="status"
25
- className={styles.toastNotificationsList}
26
- >
27
- <ToastNotificationsMap
28
- notifications={notifications}
29
- onHide={removeToastNotification}
30
- container={containers[0]}
31
- />
32
- </div>,
33
- document.body,
25
+ return toastContainer ? (
26
+ <ToastNotificationsMap
27
+ notifications={notifications}
28
+ onHide={removeToastNotification}
29
+ container={toastContainer}
30
+ />
31
+ ) : (
32
+ <></>
34
33
  )
35
34
  }
36
35
 
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "filterContents": "FilterContents-module_filterContents__tQWu8"
5
- };
6
- module.exports = styles;
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "filterPopover": "FilterPopover-module_filterPopover__eVkH6"
5
- };
6
- module.exports = styles;
@@ -1,7 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "clearAllButton": "ClearAllButton-module_clearAllButton__XNkm2",
5
- "hidden": "ClearAllButton-module_hidden__-L2eA"
6
- };
7
- module.exports = styles;
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {
4
- "filterContents": "FilterSelect-module_filterContents__p7Kgc"
5
- };
6
- module.exports = styles;
@@ -1,4 +0,0 @@
1
- var styles = {
2
- "filterContents": "FilterContents-module_filterContents__tQWu8"
3
- };
4
- export { styles as default };
@@ -1,4 +0,0 @@
1
- var styles = {
2
- "filterPopover": "FilterPopover-module_filterPopover__eVkH6"
3
- };
4
- export { styles as default };
@@ -1,5 +0,0 @@
1
- var styles = {
2
- "clearAllButton": "ClearAllButton-module_clearAllButton__XNkm2",
3
- "hidden": "ClearAllButton-module_hidden__-L2eA"
4
- };
5
- export { styles as default };
@@ -1,4 +0,0 @@
1
- var styles = {
2
- "filterContents": "FilterSelect-module_filterContents__p7Kgc"
3
- };
4
- export { styles as default };
@@ -1,5 +0,0 @@
1
- @import '~@kaizen/design-tokens/sass/spacing';
2
-
3
- .filterContents {
4
- padding: $spacing-md;
5
- }
@@ -1,11 +0,0 @@
1
- @import '~@kaizen/design-tokens/sass/border';
2
- @import '~@kaizen/design-tokens/sass/color';
3
- @import '~@kaizen/design-tokens/sass/shadow';
4
-
5
- .filterPopover {
6
- background-color: $color-white;
7
- z-index: 1010;
8
- box-shadow: $shadow-large-box-shadow;
9
- border-radius: $border-borderless-border-radius;
10
- display: inline-flex;
11
- }
@@ -1,10 +0,0 @@
1
- @import '~@kaizen/design-tokens/sass/spacing';
2
-
3
- .filterContents {
4
- box-sizing: border-box;
5
- min-width: 12.25rem; // 196px
6
- max-width: 25rem; // 400px
7
- overflow: auto;
8
- // Padding is added by <SelectPopoverContents>
9
- padding: unset;
10
- }