@cloudscape-design/components 3.0.136 → 3.0.138

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 (111) hide show
  1. package/area-chart/chart-container.d.ts.map +1 -1
  2. package/area-chart/chart-container.js +2 -1
  3. package/area-chart/chart-container.js.map +1 -1
  4. package/area-chart/model/interactions-store.d.ts.map +1 -1
  5. package/area-chart/model/interactions-store.js +1 -1
  6. package/area-chart/model/interactions-store.js.map +1 -1
  7. package/area-chart/model/use-chart-model.d.ts +1 -2
  8. package/area-chart/model/use-chart-model.d.ts.map +1 -1
  9. package/area-chart/model/use-chart-model.js +46 -10
  10. package/area-chart/model/use-chart-model.js.map +1 -1
  11. package/collection-preferences/index.d.ts +1 -1
  12. package/collection-preferences/index.d.ts.map +1 -1
  13. package/collection-preferences/index.js +10 -5
  14. package/collection-preferences/index.js.map +1 -1
  15. package/collection-preferences/interfaces.d.ts +17 -0
  16. package/collection-preferences/interfaces.d.ts.map +1 -1
  17. package/collection-preferences/interfaces.js.map +1 -1
  18. package/collection-preferences/styles.css.js +20 -19
  19. package/collection-preferences/styles.scoped.css +21 -20
  20. package/collection-preferences/styles.selectors.js +20 -19
  21. package/collection-preferences/utils.d.ts +6 -1
  22. package/collection-preferences/utils.d.ts.map +1 -1
  23. package/collection-preferences/utils.js +10 -1
  24. package/collection-preferences/utils.js.map +1 -1
  25. package/internal/base-component/styles.scoped.css +4 -0
  26. package/internal/components/chart-plot/focus-outline.d.ts +2 -1
  27. package/internal/components/chart-plot/focus-outline.d.ts.map +1 -1
  28. package/internal/components/chart-plot/focus-outline.js +6 -4
  29. package/internal/components/chart-plot/focus-outline.js.map +1 -1
  30. package/internal/components/chart-plot/index.d.ts +2 -1
  31. package/internal/components/chart-plot/index.d.ts.map +1 -1
  32. package/internal/components/chart-plot/index.js.map +1 -1
  33. package/internal/components/chart-plot/interfaces.d.ts +5 -0
  34. package/internal/components/chart-plot/interfaces.d.ts.map +1 -0
  35. package/internal/components/chart-plot/interfaces.js +2 -0
  36. package/internal/components/chart-plot/interfaces.js.map +1 -0
  37. package/internal/components/dynamic-aria-live/index.d.ts +28 -0
  38. package/internal/components/dynamic-aria-live/index.d.ts.map +1 -0
  39. package/internal/components/dynamic-aria-live/index.js +38 -0
  40. package/internal/components/dynamic-aria-live/index.js.map +1 -0
  41. package/internal/components/interfaces.d.ts +5 -0
  42. package/internal/components/interfaces.d.ts.map +1 -0
  43. package/internal/components/interfaces.js +2 -0
  44. package/internal/components/interfaces.js.map +1 -0
  45. package/internal/components/live-region/aria-liva-tag.d.ts +13 -0
  46. package/internal/components/live-region/aria-liva-tag.d.ts.map +1 -0
  47. package/internal/components/live-region/aria-liva-tag.js +18 -0
  48. package/internal/components/live-region/aria-liva-tag.js.map +1 -0
  49. package/internal/components/live-region/index.d.ts +34 -34
  50. package/internal/components/live-region/index.d.ts.map +1 -1
  51. package/internal/components/live-region/index.js +38 -61
  52. package/internal/components/live-region/index.js.map +1 -1
  53. package/internal/components/live-region/utils.d.ts +8 -0
  54. package/internal/components/live-region/utils.d.ts.map +1 -0
  55. package/internal/components/live-region/utils.js +24 -0
  56. package/internal/components/live-region/utils.js.map +1 -0
  57. package/internal/environment.js +1 -1
  58. package/internal/generated/theming/index.cjs +26 -0
  59. package/internal/generated/theming/index.js +26 -0
  60. package/internal/hooks/use-visual-mode/index.d.ts +3 -1
  61. package/internal/hooks/use-visual-mode/index.d.ts.map +1 -1
  62. package/internal/hooks/use-visual-mode/index.js +18 -11
  63. package/internal/hooks/use-visual-mode/index.js.map +1 -1
  64. package/internal/manifest.json +1 -1
  65. package/mixed-line-bar-chart/chart-container.d.ts +1 -2
  66. package/mixed-line-bar-chart/chart-container.d.ts.map +1 -1
  67. package/mixed-line-bar-chart/chart-container.js +55 -41
  68. package/mixed-line-bar-chart/chart-container.js.map +1 -1
  69. package/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts +3 -4
  70. package/mixed-line-bar-chart/hooks/use-mouse-hover.d.ts.map +1 -1
  71. package/mixed-line-bar-chart/hooks/use-mouse-hover.js +22 -18
  72. package/mixed-line-bar-chart/hooks/use-mouse-hover.js.map +1 -1
  73. package/mixed-line-bar-chart/hooks/use-navigation.d.ts +6 -3
  74. package/mixed-line-bar-chart/hooks/use-navigation.d.ts.map +1 -1
  75. package/mixed-line-bar-chart/hooks/use-navigation.js +61 -31
  76. package/mixed-line-bar-chart/hooks/use-navigation.js.map +1 -1
  77. package/mixed-line-bar-chart/interfaces.d.ts +4 -0
  78. package/mixed-line-bar-chart/interfaces.d.ts.map +1 -1
  79. package/mixed-line-bar-chart/interfaces.js.map +1 -1
  80. package/mixed-line-bar-chart/internal.d.ts.map +1 -1
  81. package/mixed-line-bar-chart/internal.js +1 -1
  82. package/mixed-line-bar-chart/internal.js.map +1 -1
  83. package/package.json +1 -1
  84. package/progress-bar/index.d.ts.map +1 -1
  85. package/progress-bar/index.js +4 -1
  86. package/progress-bar/index.js.map +1 -1
  87. package/progress-bar/internal.js +2 -2
  88. package/progress-bar/internal.js.map +1 -1
  89. package/table/body-cell/index.d.ts +3 -1
  90. package/table/body-cell/index.d.ts.map +1 -1
  91. package/table/body-cell/index.js +2 -2
  92. package/table/body-cell/index.js.map +1 -1
  93. package/table/body-cell/styles.css.js +8 -7
  94. package/table/body-cell/styles.scoped.css +21 -18
  95. package/table/body-cell/styles.selectors.js +8 -7
  96. package/table/interfaces.d.ts +4 -0
  97. package/table/interfaces.d.ts.map +1 -1
  98. package/table/interfaces.js.map +1 -1
  99. package/table/internal.d.ts.map +1 -1
  100. package/table/internal.js +4 -3
  101. package/table/internal.js.map +1 -1
  102. package/table/use-sticky-header.d.ts.map +1 -1
  103. package/table/use-sticky-header.js +4 -1
  104. package/table/use-sticky-header.js.map +1 -1
  105. package/test-utils/dom/collection-preferences/index.d.ts +1 -0
  106. package/test-utils/dom/collection-preferences/index.js +3 -0
  107. package/test-utils/dom/collection-preferences/index.js.map +1 -1
  108. package/test-utils/selectors/collection-preferences/index.d.ts +1 -0
  109. package/test-utils/selectors/collection-preferences/index.js +3 -0
  110. package/test-utils/selectors/collection-preferences/index.js.map +1 -1
  111. package/test-utils/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,18 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { __assign, __rest } from "tslib";
4
+ /* eslint-disable @cloudscape-design/prefer-live-region */
5
+ import clsx from 'clsx';
6
+ import React, { memo } from 'react';
7
+ import ScreenreaderOnly from '../screenreader-only/index.js';
8
+ import styles from './styles.css.js';
9
+ export default memo(AriaLiveTag);
10
+ function AriaLiveTag(_a) {
11
+ var _b = _a.assertive, assertive = _b === void 0 ? false : _b, _c = _a.visible, visible = _c === void 0 ? false : _c, targetRef = _a.targetRef, sourceRef = _a.sourceRef, children = _a.children, restProps = __rest(_a, ["assertive", "visible", "targetRef", "sourceRef", "children"]);
12
+ return (React.createElement(React.Fragment, null,
13
+ visible && React.createElement("span", { ref: sourceRef }, children),
14
+ React.createElement(ScreenreaderOnly, __assign({}, restProps, { className: clsx(styles.root, restProps.className) }),
15
+ !visible && (React.createElement("span", { ref: sourceRef, "aria-hidden": "true" }, children)),
16
+ React.createElement("span", { ref: targetRef, "aria-atomic": "true", "aria-live": assertive ? 'assertive' : 'polite' }))));
17
+ }
18
+ //# sourceMappingURL=aria-liva-tag.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aria-liva-tag.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/aria-liva-tag.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,gBAA2C,MAAM,+BAA+B,CAAC;AACxF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAUrC,eAAe,IAAI,CAAC,WAAW,CAAC,CAAC;AAEjC,SAAS,WAAW,CAAC,EAOF;IANjB,IAAA,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EACf,SAAS,eAAA,EACT,SAAS,eAAA,EACT,QAAQ,cAAA,EACL,SAAS,cANO,8DAOpB,CADa;IAEZ,OAAO,CACL;QACG,OAAO,IAAI,8BAAM,GAAG,EAAE,SAAS,IAAG,QAAQ,CAAQ;QAEnD,oBAAC,gBAAgB,eAAK,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC;YAC/E,CAAC,OAAO,IAAI,CACX,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,IACrC,QAAQ,CACJ,CACR;YAED,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,eAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAS,CAC9E,CAClB,CACJ,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only/index.js';\nimport styles from './styles.css.js';\n\nexport interface AriaLiveTagProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n visible?: boolean;\n children: React.ReactNode;\n targetRef: React.RefObject<HTMLSpanElement>;\n sourceRef: React.RefObject<HTMLSpanElement>;\n}\n\nexport default memo(AriaLiveTag);\n\nfunction AriaLiveTag({\n assertive = false,\n visible = false,\n targetRef,\n sourceRef,\n children,\n ...restProps\n}: AriaLiveTagProps) {\n return (\n <>\n {visible && <span ref={sourceRef}>{children}</span>}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && (\n <span ref={sourceRef} aria-hidden=\"true\">\n {children}\n </span>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ScreenreaderOnlyProps } from '../screenreader-only/index.js';
2
+ import { ScreenreaderOnlyProps } from '../screenreader-only';
3
3
  export interface LiveRegionProps extends ScreenreaderOnlyProps {
4
4
  assertive?: boolean;
5
5
  delay?: number;
@@ -7,39 +7,39 @@ export interface LiveRegionProps extends ScreenreaderOnlyProps {
7
7
  children: React.ReactNode;
8
8
  }
9
9
  /**
10
- The live region is hidden in the layout, but visible for screen readers.
11
- It's purpose it to announce changes e.g. when custom navigation logic is used.
12
-
13
- The way live region works differently in different browsers and screen readers and
14
- it is recommended to manually test every new implementation.
15
-
16
- If you notice there are different words being merged together,
17
- check if there are text nodes not being wrapped in elements, like:
18
- <LiveRegion>
19
- {title}
20
- <span><Details /></span>
21
- </LiveRegion>
22
-
23
- To fix, wrap "title" in an element:
24
- <LiveRegion>
25
- <span>{title}</span>
26
- <span><Details /></span>
27
- </LiveRegion>
28
-
29
- Or create a single text node if possible:
30
- <LiveRegion>
31
- {`${title} ${details}`}
32
- </LiveRegion>
33
-
34
- The live region is always atomic, because non-atomic regions can be treated by screen readers
35
- differently and produce unexpected results. To imitate non-atomic announcements simply use
36
- multiple live regions:
37
- <>
38
- <LiveRegion>{title}</LiveRegion>
39
- <LiveRegion><Details /></LiveRegion>
40
- </>
41
- */
10
+ * The live region is hidden in the layout, but visible for screen readers.
11
+ * It's purpose it to announce changes e.g. when custom navigation logic is used.
12
+ *
13
+ * The way live region works differently in different browsers and screen readers and
14
+ * it is recommended to manually test every new implementation.
15
+ *
16
+ * If you notice there are different words being merged together,
17
+ * check if there are text nodes not being wrapped in elements, like:
18
+ * <LiveRegion>
19
+ * {title}
20
+ * <span><Details /></span>
21
+ * </LiveRegion>
22
+ *
23
+ * To fix, wrap "title" in an element:
24
+ * <LiveRegion>
25
+ * <span>{title}</span>
26
+ * <span><Details /></span>
27
+ * </LiveRegion>
28
+ *
29
+ * Or create a single text node if possible:
30
+ * <LiveRegion>
31
+ * {`${title} ${details}`}
32
+ * </LiveRegion>
33
+ *
34
+ * The live region is always atomic, because non-atomic regions can be treated by screen readers
35
+ * differently and produce unexpected results. To imitate non-atomic announcements simply use
36
+ * multiple live regions:
37
+ * <>
38
+ * <LiveRegion>{title}</LiveRegion>
39
+ * <LiveRegion><Details /></LiveRegion>
40
+ * </>
41
+ */
42
42
  declare const _default: React.MemoExoticComponent<typeof LiveRegion>;
43
43
  export default _default;
44
- declare function LiveRegion({ assertive, delay, visible, children, ...restProps }: LiveRegionProps): JSX.Element;
44
+ declare function LiveRegion({ delay, children, ...restProps }: LiveRegionProps): JSX.Element;
45
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAyB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAGxF,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCE;;AACF,wBAAgC;AAEhC,iBAAS,UAAU,CAAC,EAAE,SAAiB,EAAE,KAAU,EAAE,OAAe,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,eAAe,eA0D9G"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAI7D,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;AACH,wBAAgC;AAEhC,iBAAS,UAAU,CAAC,EAAE,KAAU,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,EAAE,eAAe,eAmC1E"}
@@ -2,46 +2,45 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { __assign, __rest } from "tslib";
4
4
  /* eslint-disable @cloudscape-design/prefer-live-region */
5
- import clsx from 'clsx';
6
5
  import React, { memo, useEffect, useRef } from 'react';
7
- import ScreenreaderOnly from '../screenreader-only/index.js';
8
- import styles from './styles.css.js';
6
+ import { updateLiveRegion } from './utils';
7
+ import AriaLiveTag from './aria-liva-tag';
9
8
  /**
10
- The live region is hidden in the layout, but visible for screen readers.
11
- It's purpose it to announce changes e.g. when custom navigation logic is used.
12
-
13
- The way live region works differently in different browsers and screen readers and
14
- it is recommended to manually test every new implementation.
15
-
16
- If you notice there are different words being merged together,
17
- check if there are text nodes not being wrapped in elements, like:
18
- <LiveRegion>
19
- {title}
20
- <span><Details /></span>
21
- </LiveRegion>
22
-
23
- To fix, wrap "title" in an element:
24
- <LiveRegion>
25
- <span>{title}</span>
26
- <span><Details /></span>
27
- </LiveRegion>
28
-
29
- Or create a single text node if possible:
30
- <LiveRegion>
31
- {`${title} ${details}`}
32
- </LiveRegion>
33
-
34
- The live region is always atomic, because non-atomic regions can be treated by screen readers
35
- differently and produce unexpected results. To imitate non-atomic announcements simply use
36
- multiple live regions:
37
- <>
38
- <LiveRegion>{title}</LiveRegion>
39
- <LiveRegion><Details /></LiveRegion>
40
- </>
41
- */
9
+ * The live region is hidden in the layout, but visible for screen readers.
10
+ * It's purpose it to announce changes e.g. when custom navigation logic is used.
11
+ *
12
+ * The way live region works differently in different browsers and screen readers and
13
+ * it is recommended to manually test every new implementation.
14
+ *
15
+ * If you notice there are different words being merged together,
16
+ * check if there are text nodes not being wrapped in elements, like:
17
+ * <LiveRegion>
18
+ * {title}
19
+ * <span><Details /></span>
20
+ * </LiveRegion>
21
+ *
22
+ * To fix, wrap "title" in an element:
23
+ * <LiveRegion>
24
+ * <span>{title}</span>
25
+ * <span><Details /></span>
26
+ * </LiveRegion>
27
+ *
28
+ * Or create a single text node if possible:
29
+ * <LiveRegion>
30
+ * {`${title} ${details}`}
31
+ * </LiveRegion>
32
+ *
33
+ * The live region is always atomic, because non-atomic regions can be treated by screen readers
34
+ * differently and produce unexpected results. To imitate non-atomic announcements simply use
35
+ * multiple live regions:
36
+ * <>
37
+ * <LiveRegion>{title}</LiveRegion>
38
+ * <LiveRegion><Details /></LiveRegion>
39
+ * </>
40
+ */
42
41
  export default memo(LiveRegion);
43
42
  function LiveRegion(_a) {
44
- var _b = _a.assertive, assertive = _b === void 0 ? false : _b, _c = _a.delay, delay = _c === void 0 ? 10 : _c, _d = _a.visible, visible = _d === void 0 ? false : _d, children = _a.children, restProps = __rest(_a, ["assertive", "delay", "visible", "children"]);
43
+ var _b = _a.delay, delay = _b === void 0 ? 10 : _b, children = _a.children, restProps = __rest(_a, ["delay", "children"]);
45
44
  var sourceRef = useRef(null);
46
45
  var targetRef = useRef(null);
47
46
  /*
@@ -56,24 +55,12 @@ function LiveRegion(_a) {
56
55
  does not impact the performance. If it does, prefer using a string as children prop.
57
56
  */
58
57
  useEffect(function () {
59
- function updateLiveRegion() {
60
- if (targetRef.current && sourceRef.current) {
61
- var sourceContent = extractInnerText(sourceRef.current);
62
- var targetContent = extractInnerText(targetRef.current);
63
- if (targetContent !== sourceContent) {
64
- // The aria-atomic does not work properly in Voice Over, causing
65
- // certain parts of the content to be ignored. To fix that,
66
- // we assign the source text content as a single node.
67
- targetRef.current.innerText = sourceContent;
68
- }
69
- }
70
- }
71
58
  var timeoutId;
72
59
  if (delay) {
73
- timeoutId = setTimeout(updateLiveRegion, delay);
60
+ timeoutId = setTimeout(function () { return updateLiveRegion(targetRef, sourceRef); }, delay);
74
61
  }
75
62
  else {
76
- updateLiveRegion();
63
+ updateLiveRegion(targetRef, sourceRef);
77
64
  }
78
65
  return function () {
79
66
  if (timeoutId) {
@@ -81,16 +68,6 @@ function LiveRegion(_a) {
81
68
  }
82
69
  };
83
70
  });
84
- return (React.createElement(React.Fragment, null,
85
- visible && React.createElement("span", { ref: sourceRef }, children),
86
- React.createElement(ScreenreaderOnly, __assign({}, restProps, { className: clsx(styles.root, restProps.className) }),
87
- !visible && (React.createElement("span", { ref: sourceRef, "aria-hidden": "true" }, children)),
88
- React.createElement("span", { ref: targetRef, "aria-atomic": "true", "aria-live": assertive ? 'assertive' : 'polite' }))));
89
- }
90
- // This only extracts text content from the node including all its children which is enough for now.
91
- // To make it more powerful, it is possible to create a more sophisticated extractor with respect to
92
- // ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.
93
- function extractInnerText(node) {
94
- return (node.innerText || '').replace(/\s+/g, ' ').trim();
71
+ return (React.createElement(AriaLiveTag, __assign({ targetRef: targetRef, sourceRef: sourceRef }, restProps), children));
95
72
  }
96
73
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,gBAA2C,MAAM,+BAA+B,CAAC;AACxF,OAAO,MAAM,MAAM,iBAAiB,CAAC;AASrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgCE;AACF,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EAA2F;IAAzF,IAAA,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EAAE,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,eAAe,EAAf,OAAO,mBAAG,KAAK,KAAA,EAAE,QAAQ,cAAA,EAAK,SAAS,cAAxE,6CAA0E,CAAF;IAC1F,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAChD,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAEhD;;;;;;;;;;MAUE;IACF,SAAS,CAAC;QACR,SAAS,gBAAgB;YACvB,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;gBAC1C,IAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC1D,IAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC1D,IAAI,aAAa,KAAK,aAAa,EAAE;oBACnC,gEAAgE;oBAChE,2DAA2D;oBAC3D,sDAAsD;oBACtD,SAAS,CAAC,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;iBAC7C;aACF;QACH,CAAC;QAED,IAAI,SAAwB,CAAC;QAC7B,IAAI,KAAK,EAAE;YACT,SAAS,GAAG,UAAU,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SACjD;aAAM;YACL,gBAAgB,EAAE,CAAC;SACpB;QAED,OAAO;YACL,IAAI,SAAS,EAAE;gBACb,YAAY,CAAC,SAAS,CAAC,CAAC;aACzB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL;QACG,OAAO,IAAI,8BAAM,GAAG,EAAE,SAAS,IAAG,QAAQ,CAAQ;QAEnD,oBAAC,gBAAgB,eAAK,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC;YAC/E,CAAC,OAAO,IAAI,CACX,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,IACrC,QAAQ,CACJ,CACR;YAED,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,eAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAS,CAC9E,CAClB,CACJ,CAAC;AACJ,CAAC;AAED,oGAAoG;AACpG,oGAAoG;AACpG,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo, useEffect, useRef } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only/index.js';\nimport styles from './styles.css.js';\n\nexport interface LiveRegionProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n visible?: boolean;\n children: React.ReactNode;\n}\n\n/**\n The live region is hidden in the layout, but visible for screen readers.\n It's purpose it to announce changes e.g. when custom navigation logic is used.\n\n The way live region works differently in different browsers and screen readers and\n it is recommended to manually test every new implementation.\n\n If you notice there are different words being merged together,\n check if there are text nodes not being wrapped in elements, like:\n <LiveRegion>\n {title}\n <span><Details /></span>\n </LiveRegion>\n\n To fix, wrap \"title\" in an element:\n <LiveRegion>\n <span>{title}</span>\n <span><Details /></span>\n </LiveRegion>\n\n Or create a single text node if possible:\n <LiveRegion>\n {`${title} ${details}`}\n </LiveRegion>\n\n The live region is always atomic, because non-atomic regions can be treated by screen readers\n differently and produce unexpected results. To imitate non-atomic announcements simply use\n multiple live regions:\n <>\n <LiveRegion>{title}</LiveRegion>\n <LiveRegion><Details /></LiveRegion>\n </>\n*/\nexport default memo(LiveRegion);\n\nfunction LiveRegion({ assertive = false, delay = 10, visible = false, children, ...restProps }: LiveRegionProps) {\n const sourceRef = useRef<HTMLSpanElement>(null);\n const targetRef = useRef<HTMLSpanElement>(null);\n\n /*\n When React state changes, React often produces too many DOM updates, causing NVDA to\n issue many announcements for the same logical event (See https://github.com/nvaccess/nvda/issues/7996).\n\n The code below imitates a debouncing, scheduling a callback every time new React state\n update is detected. When a callback resolves, it copies content from a muted element\n to the live region, which is recognized by screen readers as an update.\n\n If the use case requires no announcement to be ignored, use delay = 0, but ensure it\n does not impact the performance. If it does, prefer using a string as children prop.\n */\n useEffect(() => {\n function updateLiveRegion() {\n if (targetRef.current && sourceRef.current) {\n const sourceContent = extractInnerText(sourceRef.current);\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n }\n\n let timeoutId: null | number;\n if (delay) {\n timeoutId = setTimeout(updateLiveRegion, delay);\n } else {\n updateLiveRegion();\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n });\n\n return (\n <>\n {visible && <span ref={sourceRef}>{children}</span>}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && (\n <span ref={sourceRef} aria-hidden=\"true\">\n {children}\n </span>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAS1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EAAuD;IAArD,IAAA,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA,EAAE,QAAQ,cAAA,EAAK,SAAS,cAApC,qBAAsC,CAAF;IACtD,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAChD,IAAM,SAAS,GAAG,MAAM,CAAkB,IAAI,CAAC,CAAC;IAEhD;;;;;;;;;;MAUE;IACF,SAAS,CAAC;QACR,IAAI,SAAwB,CAAC;QAC7B,IAAI,KAAK,EAAE;YACT,SAAS,GAAG,UAAU,CAAC,cAAM,OAAA,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,EAAtC,CAAsC,EAAE,KAAK,CAAC,CAAC;SAC7E;aAAM;YACL,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;SACxC;QAED,OAAO;YACL,IAAI,SAAS,EAAE;gBACb,YAAY,CAAC,SAAS,CAAC,CAAC;aACzB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,WAAW,aAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,IAAM,SAAS,GACnE,QAAQ,CACG,CACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport React, { memo, useEffect, useRef } from 'react';\nimport { ScreenreaderOnlyProps } from '../screenreader-only';\nimport { updateLiveRegion } from './utils';\nimport AriaLiveTag from './aria-liva-tag';\n\nexport interface LiveRegionProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n visible?: boolean;\n children: React.ReactNode;\n}\n\n/**\n * The live region is hidden in the layout, but visible for screen readers.\n * It's purpose it to announce changes e.g. when custom navigation logic is used.\n *\n * The way live region works differently in different browsers and screen readers and\n * it is recommended to manually test every new implementation.\n *\n * If you notice there are different words being merged together,\n * check if there are text nodes not being wrapped in elements, like:\n * <LiveRegion>\n * {title}\n * <span><Details /></span>\n * </LiveRegion>\n *\n * To fix, wrap \"title\" in an element:\n * <LiveRegion>\n * <span>{title}</span>\n * <span><Details /></span>\n * </LiveRegion>\n *\n * Or create a single text node if possible:\n * <LiveRegion>\n * {`${title} ${details}`}\n * </LiveRegion>\n *\n * The live region is always atomic, because non-atomic regions can be treated by screen readers\n * differently and produce unexpected results. To imitate non-atomic announcements simply use\n * multiple live regions:\n * <>\n * <LiveRegion>{title}</LiveRegion>\n * <LiveRegion><Details /></LiveRegion>\n * </>\n */\nexport default memo(LiveRegion);\n\nfunction LiveRegion({ delay = 10, children, ...restProps }: LiveRegionProps) {\n const sourceRef = useRef<HTMLSpanElement>(null);\n const targetRef = useRef<HTMLSpanElement>(null);\n\n /*\n When React state changes, React often produces too many DOM updates, causing NVDA to\n issue many announcements for the same logical event (See https://github.com/nvaccess/nvda/issues/7996).\n\n The code below imitates a debouncing, scheduling a callback every time new React state\n update is detected. When a callback resolves, it copies content from a muted element\n to the live region, which is recognized by screen readers as an update.\n\n If the use case requires no announcement to be ignored, use delay = 0, but ensure it\n does not impact the performance. If it does, prefer using a string as children prop.\n */\n useEffect(() => {\n let timeoutId: null | number;\n if (delay) {\n timeoutId = setTimeout(() => updateLiveRegion(targetRef, sourceRef), delay);\n } else {\n updateLiveRegion(targetRef, sourceRef);\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n });\n\n return (\n <AriaLiveTag targetRef={targetRef} sourceRef={sourceRef} {...restProps}>\n {children}\n </AriaLiveTag>\n );\n}\n"]}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ /**
3
+ * Updates text of the target node if it's differ from source node.
4
+ * @param targetRef - Ref to the element with aria-live
5
+ * @param sourceRef - Ref to the element to be announced
6
+ */
7
+ export declare function updateLiveRegion(targetRef: React.RefObject<HTMLSpanElement>, sourceRef: React.RefObject<HTMLSpanElement>): void;
8
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,EAC3C,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,eAAe,CAAC,QAY5C"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Updates text of the target node if it's differ from source node.
3
+ * @param targetRef - Ref to the element with aria-live
4
+ * @param sourceRef - Ref to the element to be announced
5
+ */
6
+ export function updateLiveRegion(targetRef, sourceRef) {
7
+ if (targetRef.current && sourceRef.current) {
8
+ var sourceContent = extractInnerText(sourceRef.current);
9
+ var targetContent = extractInnerText(targetRef.current);
10
+ if (targetContent !== sourceContent) {
11
+ // The aria-atomic does not work properly in Voice Over, causing
12
+ // certain parts of the content to be ignored. To fix that,
13
+ // we assign the source text content as a single node.
14
+ targetRef.current.innerText = sourceContent;
15
+ }
16
+ }
17
+ }
18
+ // This only extracts text content from the node including all its children which is enough for now.
19
+ // To make it more powerful, it is possible to create a more sophisticated extractor with respect to
20
+ // ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.
21
+ function extractInnerText(node) {
22
+ return (node.innerText || '').replace(/\s+/g, ' ').trim();
23
+ }
24
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/internal/components/live-region/utils.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,SAA2C,EAC3C,SAA2C;IAE3C,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;QAC1C,IAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,aAAa,KAAK,aAAa,EAAE;YACnC,gEAAgE;YAChE,2DAA2D;YAC3D,sDAAsD;YACtD,SAAS,CAAC,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;SAC7C;KACF;AACH,CAAC;AAED,oGAAoG;AACpG,oGAAoG;AACpG,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\n/**\n * Updates text of the target node if it's differ from source node.\n * @param targetRef - Ref to the element with aria-live\n * @param sourceRef - Ref to the element to be announced\n */\nexport function updateLiveRegion(\n targetRef: React.RefObject<HTMLSpanElement>,\n sourceRef: React.RefObject<HTMLSpanElement>\n) {\n if (targetRef.current && sourceRef.current) {\n const sourceContent = extractInnerText(sourceRef.current);\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
@@ -1,5 +1,5 @@
1
1
 
2
- export var PACKAGE_VERSION = '3.0.0 (308d769)';
2
+ export var PACKAGE_VERSION = '3.0.0 (6a2e638)';
3
3
  export var THEME = 'open-source-visual-refresh';
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
5
5
 
@@ -57,6 +57,7 @@ module.exports.preset = {
57
57
  "colorGreen700": "#1a520f",
58
58
  "colorGreen900": "#001a02",
59
59
  "colorGrey100": "#fbfbfb",
60
+ "colorGrey125": "#f8f8f8",
60
61
  "colorGrey150": "#f4f4f4",
61
62
  "colorGrey200": "#e9ebed",
62
63
  "colorGrey300": "#d1d5db",
@@ -778,6 +779,10 @@ module.exports.preset = {
778
779
  "light": "{colorGrey150}",
779
780
  "dark": "{colorGrey650}"
780
781
  },
782
+ "colorBackgroundCellShaded": {
783
+ "light": "{colorGrey125}",
784
+ "dark": "{colorGrey700}"
785
+ },
781
786
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
782
787
  "light": "{colorGrey550}",
783
788
  "dark": "{colorGrey500}"
@@ -2302,6 +2307,10 @@ module.exports.preset = {
2302
2307
  "light": "{colorGrey650}",
2303
2308
  "dark": "{colorGrey650}"
2304
2309
  },
2310
+ "colorBackgroundCellShaded": {
2311
+ "light": "{colorGrey700}",
2312
+ "dark": "{colorGrey700}"
2313
+ },
2305
2314
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
2306
2315
  "light": "{colorGrey500}",
2307
2316
  "dark": "{colorGrey500}"
@@ -3208,6 +3217,10 @@ module.exports.preset = {
3208
3217
  "light": "{colorGrey650}",
3209
3218
  "dark": "{colorGrey650}"
3210
3219
  },
3220
+ "colorBackgroundCellShaded": {
3221
+ "light": "{colorGrey700}",
3222
+ "dark": "{colorGrey700}"
3223
+ },
3211
3224
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
3212
3225
  "light": "{colorGrey500}",
3213
3226
  "dark": "{colorGrey500}"
@@ -4062,6 +4075,10 @@ module.exports.preset = {
4062
4075
  "light": "{colorGrey150}",
4063
4076
  "dark": "{colorGrey650}"
4064
4077
  },
4078
+ "colorBackgroundCellShaded": {
4079
+ "light": "{colorGrey125}",
4080
+ "dark": "{colorGrey700}"
4081
+ },
4065
4082
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
4066
4083
  "light": "{colorGrey550}",
4067
4084
  "dark": "{colorGrey500}"
@@ -4916,6 +4933,10 @@ module.exports.preset = {
4916
4933
  "light": "{colorGrey150}",
4917
4934
  "dark": "{colorGrey650}"
4918
4935
  },
4936
+ "colorBackgroundCellShaded": {
4937
+ "light": "{colorGrey125}",
4938
+ "dark": "{colorGrey700}"
4939
+ },
4919
4940
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
4920
4941
  "light": "{colorGrey550}",
4921
4942
  "dark": "{colorGrey500}"
@@ -5862,6 +5883,7 @@ module.exports.preset = {
5862
5883
  "colorBackgroundButtonPrimaryDisabled": "color",
5863
5884
  "colorBackgroundButtonPrimaryHover": "color",
5864
5885
  "colorBackgroundCalendarToday": "color",
5886
+ "colorBackgroundCellShaded": "color",
5865
5887
  "colorBackgroundCodeEditorGutterActiveLineDefault": "color",
5866
5888
  "colorBackgroundCodeEditorGutterActiveLineError": "color",
5867
5889
  "colorBackgroundCodeEditorGutterDefault": "color",
@@ -6667,6 +6689,7 @@ module.exports.preset = {
6667
6689
  "colorGreen700": "color-green-700",
6668
6690
  "colorGreen900": "color-green-900",
6669
6691
  "colorGrey100": "color-grey-100",
6692
+ "colorGrey125": "color-grey-125",
6670
6693
  "colorGrey150": "color-grey-150",
6671
6694
  "colorGrey200": "color-grey-200",
6672
6695
  "colorGrey300": "color-grey-300",
@@ -6866,6 +6889,7 @@ module.exports.preset = {
6866
6889
  "colorBackgroundButtonPrimaryDisabled": "color-background-button-primary-disabled",
6867
6890
  "colorBackgroundButtonPrimaryHover": "color-background-button-primary-hover",
6868
6891
  "colorBackgroundCalendarToday": "color-background-calendar-today",
6892
+ "colorBackgroundCellShaded": "color-background-cell-shaded",
6869
6893
  "colorBackgroundCodeEditorGutterActiveLineDefault": "color-background-code-editor-gutter-active-line-default",
6870
6894
  "colorBackgroundCodeEditorGutterActiveLineError": "color-background-code-editor-gutter-active-line-error",
6871
6895
  "colorBackgroundCodeEditorGutterDefault": "color-background-code-editor-gutter-default",
@@ -7311,6 +7335,7 @@ module.exports.preset = {
7311
7335
  "colorGreen700": "--color-green-700-mxknm4",
7312
7336
  "colorGreen900": "--color-green-900-mcc3zx",
7313
7337
  "colorGrey100": "--color-grey-100-yub70k",
7338
+ "colorGrey125": "--color-grey-125-cl5sjj",
7314
7339
  "colorGrey150": "--color-grey-150-4ycuod",
7315
7340
  "colorGrey200": "--color-grey-200-llwxhx",
7316
7341
  "colorGrey300": "--color-grey-300-gjxrd6",
@@ -7510,6 +7535,7 @@ module.exports.preset = {
7510
7535
  "colorBackgroundButtonPrimaryDisabled": "--color-background-button-primary-disabled-eon7km",
7511
7536
  "colorBackgroundButtonPrimaryHover": "--color-background-button-primary-hover-qu1zio",
7512
7537
  "colorBackgroundCalendarToday": "--color-background-calendar-today-762czq",
7538
+ "colorBackgroundCellShaded": "--color-background-cell-shaded-26ubfj",
7513
7539
  "colorBackgroundCodeEditorGutterActiveLineDefault": "--color-background-code-editor-gutter-active-line-default-p2p8kl",
7514
7540
  "colorBackgroundCodeEditorGutterActiveLineError": "--color-background-code-editor-gutter-active-line-error-lfh0u4",
7515
7541
  "colorBackgroundCodeEditorGutterDefault": "--color-background-code-editor-gutter-default-l5k65m",
@@ -57,6 +57,7 @@ export var preset = {
57
57
  "colorGreen700": "#1a520f",
58
58
  "colorGreen900": "#001a02",
59
59
  "colorGrey100": "#fbfbfb",
60
+ "colorGrey125": "#f8f8f8",
60
61
  "colorGrey150": "#f4f4f4",
61
62
  "colorGrey200": "#e9ebed",
62
63
  "colorGrey300": "#d1d5db",
@@ -778,6 +779,10 @@ export var preset = {
778
779
  "light": "{colorGrey150}",
779
780
  "dark": "{colorGrey650}"
780
781
  },
782
+ "colorBackgroundCellShaded": {
783
+ "light": "{colorGrey125}",
784
+ "dark": "{colorGrey700}"
785
+ },
781
786
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
782
787
  "light": "{colorGrey550}",
783
788
  "dark": "{colorGrey500}"
@@ -2302,6 +2307,10 @@ export var preset = {
2302
2307
  "light": "{colorGrey650}",
2303
2308
  "dark": "{colorGrey650}"
2304
2309
  },
2310
+ "colorBackgroundCellShaded": {
2311
+ "light": "{colorGrey700}",
2312
+ "dark": "{colorGrey700}"
2313
+ },
2305
2314
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
2306
2315
  "light": "{colorGrey500}",
2307
2316
  "dark": "{colorGrey500}"
@@ -3208,6 +3217,10 @@ export var preset = {
3208
3217
  "light": "{colorGrey650}",
3209
3218
  "dark": "{colorGrey650}"
3210
3219
  },
3220
+ "colorBackgroundCellShaded": {
3221
+ "light": "{colorGrey700}",
3222
+ "dark": "{colorGrey700}"
3223
+ },
3211
3224
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
3212
3225
  "light": "{colorGrey500}",
3213
3226
  "dark": "{colorGrey500}"
@@ -4062,6 +4075,10 @@ export var preset = {
4062
4075
  "light": "{colorGrey150}",
4063
4076
  "dark": "{colorGrey650}"
4064
4077
  },
4078
+ "colorBackgroundCellShaded": {
4079
+ "light": "{colorGrey125}",
4080
+ "dark": "{colorGrey700}"
4081
+ },
4065
4082
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
4066
4083
  "light": "{colorGrey550}",
4067
4084
  "dark": "{colorGrey500}"
@@ -4916,6 +4933,10 @@ export var preset = {
4916
4933
  "light": "{colorGrey150}",
4917
4934
  "dark": "{colorGrey650}"
4918
4935
  },
4936
+ "colorBackgroundCellShaded": {
4937
+ "light": "{colorGrey125}",
4938
+ "dark": "{colorGrey700}"
4939
+ },
4919
4940
  "colorBackgroundCodeEditorGutterActiveLineDefault": {
4920
4941
  "light": "{colorGrey550}",
4921
4942
  "dark": "{colorGrey500}"
@@ -5862,6 +5883,7 @@ export var preset = {
5862
5883
  "colorBackgroundButtonPrimaryDisabled": "color",
5863
5884
  "colorBackgroundButtonPrimaryHover": "color",
5864
5885
  "colorBackgroundCalendarToday": "color",
5886
+ "colorBackgroundCellShaded": "color",
5865
5887
  "colorBackgroundCodeEditorGutterActiveLineDefault": "color",
5866
5888
  "colorBackgroundCodeEditorGutterActiveLineError": "color",
5867
5889
  "colorBackgroundCodeEditorGutterDefault": "color",
@@ -6667,6 +6689,7 @@ export var preset = {
6667
6689
  "colorGreen700": "color-green-700",
6668
6690
  "colorGreen900": "color-green-900",
6669
6691
  "colorGrey100": "color-grey-100",
6692
+ "colorGrey125": "color-grey-125",
6670
6693
  "colorGrey150": "color-grey-150",
6671
6694
  "colorGrey200": "color-grey-200",
6672
6695
  "colorGrey300": "color-grey-300",
@@ -6866,6 +6889,7 @@ export var preset = {
6866
6889
  "colorBackgroundButtonPrimaryDisabled": "color-background-button-primary-disabled",
6867
6890
  "colorBackgroundButtonPrimaryHover": "color-background-button-primary-hover",
6868
6891
  "colorBackgroundCalendarToday": "color-background-calendar-today",
6892
+ "colorBackgroundCellShaded": "color-background-cell-shaded",
6869
6893
  "colorBackgroundCodeEditorGutterActiveLineDefault": "color-background-code-editor-gutter-active-line-default",
6870
6894
  "colorBackgroundCodeEditorGutterActiveLineError": "color-background-code-editor-gutter-active-line-error",
6871
6895
  "colorBackgroundCodeEditorGutterDefault": "color-background-code-editor-gutter-default",
@@ -7311,6 +7335,7 @@ export var preset = {
7311
7335
  "colorGreen700": "--color-green-700-mxknm4",
7312
7336
  "colorGreen900": "--color-green-900-mcc3zx",
7313
7337
  "colorGrey100": "--color-grey-100-yub70k",
7338
+ "colorGrey125": "--color-grey-125-cl5sjj",
7314
7339
  "colorGrey150": "--color-grey-150-4ycuod",
7315
7340
  "colorGrey200": "--color-grey-200-llwxhx",
7316
7341
  "colorGrey300": "--color-grey-300-gjxrd6",
@@ -7510,6 +7535,7 @@ export var preset = {
7510
7535
  "colorBackgroundButtonPrimaryDisabled": "--color-background-button-primary-disabled-eon7km",
7511
7536
  "colorBackgroundButtonPrimaryHover": "--color-background-button-primary-hover-qu1zio",
7512
7537
  "colorBackgroundCalendarToday": "--color-background-calendar-today-762czq",
7538
+ "colorBackgroundCellShaded": "--color-background-cell-shaded-26ubfj",
7513
7539
  "colorBackgroundCodeEditorGutterActiveLineDefault": "--color-background-code-editor-gutter-active-line-default-p2p8kl",
7514
7540
  "colorBackgroundCodeEditorGutterActiveLineError": "--color-background-code-editor-gutter-active-line-error-lfh0u4",
7515
7541
  "colorBackgroundCodeEditorGutterDefault": "--color-background-code-editor-gutter-default-l5k65m",
@@ -1,6 +1,8 @@
1
1
  import React from 'react';
2
2
  export declare function useCurrentMode(elementRef: React.RefObject<HTMLElement>): "dark" | "light";
3
3
  export declare function useDensityMode(elementRef: React.RefObject<HTMLElement>): "compact" | "comfortable";
4
- export declare function useVisualRefresh(): boolean;
4
+ export declare const useVisualRefresh: () => boolean;
5
+ export declare function clearVisualRefreshState(): void;
6
+ export declare function useVisualRefreshDynamic(): boolean;
5
7
  export declare function useReducedMotion(elementRef: React.RefObject<HTMLElement>): boolean;
6
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,oBAUtE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,6BAUtE;AAKD,wBAAgB,gBAAgB,YAa/B;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,WAMxE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAQxC,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,oBAUtE;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,6BAUtE;AAED,eAAO,MAAM,gBAAgB,eAA+D,CAAC;AAM7F,wBAAgB,uBAAuB,SAEtC;AAMD,wBAAgB,uBAAuB,YAetC;AAED,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,WAMxE"}
@@ -5,6 +5,8 @@ import { ALWAYS_VISUAL_REFRESH } from '../../environment';
5
5
  import { isMotionDisabled } from '../../motion';
6
6
  import { findUpUntil } from '../../utils/dom';
7
7
  import { useMutationObserver } from '../use-mutation-observer';
8
+ import { isDevelopment } from '../../is-development';
9
+ import { warnOnce } from '../../logging';
8
10
  export function useCurrentMode(elementRef) {
9
11
  var _a = useState('light'), value = _a[0], setValue = _a[1];
10
12
  useMutationObserver(elementRef, function (node) {
@@ -21,20 +23,25 @@ export function useDensityMode(elementRef) {
21
23
  });
22
24
  return value;
23
25
  }
26
+ export var useVisualRefresh = ALWAYS_VISUAL_REFRESH ? function () { return true; } : useVisualRefreshDynamic;
24
27
  // We expect VR is to be set only once and before the application is rendered.
25
28
  var visualRefreshState = undefined;
26
- export function useVisualRefresh() {
27
- var _a, _b;
29
+ // for testing
30
+ export function clearVisualRefreshState() {
31
+ visualRefreshState = undefined;
32
+ }
33
+ function detectVisualRefresh() {
34
+ return typeof document !== 'undefined' && !!document.querySelector('.awsui-visual-refresh');
35
+ }
36
+ export function useVisualRefreshDynamic() {
28
37
  if (visualRefreshState === undefined) {
29
- var supportsCSSVariables = typeof window !== 'undefined' && ((_b = (_a = window.CSS) === null || _a === void 0 ? void 0 : _a.supports) === null || _b === void 0 ? void 0 : _b.call(_a, 'color', 'var(--test-var)'));
30
- if (ALWAYS_VISUAL_REFRESH) {
31
- visualRefreshState = true;
32
- }
33
- else if (!supportsCSSVariables) {
34
- visualRefreshState = false;
35
- }
36
- else {
37
- visualRefreshState = !!document.querySelector('.awsui-visual-refresh');
38
+ visualRefreshState = detectVisualRefresh();
39
+ }
40
+ if (isDevelopment) {
41
+ var newVisualRefreshState = detectVisualRefresh();
42
+ if (newVisualRefreshState !== visualRefreshState) {
43
+ warnOnce('Visual Refresh', 'Dynamic visual refresh change detected. This is not supported. ' +
44
+ 'Make sure `awsui-visual-refresh` is attached to the `<body>` element before initial React render');
38
45
  }
39
46
  }
40
47
  return visualRefreshState;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,MAAM,UAAU,cAAc,CAAC,UAAwC;IAC/D,IAAA,KAAoB,QAAQ,CAAmB,OAAO,CAAC,EAAtD,KAAK,QAAA,EAAE,QAAQ,QAAuC,CAAC;IAC9D,mBAAmB,CAAC,UAAU,EAAE,UAAA,IAAI;QAClC,IAAM,cAAc,GAAG,WAAW,CAChC,IAAI,EACJ,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,yBAAyB,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAhG,CAAgG,CACzG,CAAC;QACF,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAwC;IAC/D,IAAA,KAAoB,QAAQ,CAA4B,aAAa,CAAC,EAArE,KAAK,QAAA,EAAE,QAAQ,QAAsD,CAAC;IAC7E,mBAAmB,CAAC,UAAU,EAAE,UAAA,IAAI;QAClC,IAAM,iBAAiB,GAAG,WAAW,CACnC,IAAI,EACJ,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,4BAA4B,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAtG,CAAsG,CAC/G,CAAC;QACF,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,8EAA8E;AAC9E,IAAI,kBAAkB,GAAwB,SAAS,CAAC;AAExD,MAAM,UAAU,gBAAgB;;IAC9B,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACpC,IAAM,oBAAoB,GAAG,OAAO,MAAM,KAAK,WAAW,KAAI,MAAA,MAAA,MAAM,CAAC,GAAG,0CAAE,QAAQ,mDAAG,OAAO,EAAE,iBAAiB,CAAC,CAAA,CAAC;QAEjH,IAAI,qBAAqB,EAAE;YACzB,kBAAkB,GAAG,IAAI,CAAC;SAC3B;aAAM,IAAI,CAAC,oBAAoB,EAAE;YAChC,kBAAkB,GAAG,KAAK,CAAC;SAC5B;aAAM;YACL,kBAAkB,GAAG,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;SACxE;KACF;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAAwC;IACjE,IAAA,KAAoB,QAAQ,CAAC,KAAK,CAAC,EAAlC,KAAK,QAAA,EAAE,QAAQ,QAAmB,CAAC;IAC1C,mBAAmB,CAAC,UAAU,EAAE,UAAA,IAAI;QAClC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport { ALWAYS_VISUAL_REFRESH } from '../../environment';\nimport { isMotionDisabled } from '../../motion';\nimport { findUpUntil } from '../../utils/dom';\nimport { useMutationObserver } from '../use-mutation-observer';\n\nexport function useCurrentMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'light' | 'dark'>('light');\n useMutationObserver(elementRef, node => {\n const darkModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-dark-mode') || node.classList.contains('awsui-dark-mode')\n );\n setValue(darkModeParent ? 'dark' : 'light');\n });\n return value;\n}\n\nexport function useDensityMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'comfortable' | 'compact'>('comfortable');\n useMutationObserver(elementRef, node => {\n const compactModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-compact-mode') || node.classList.contains('awsui-compact-mode')\n );\n setValue(compactModeParent ? 'compact' : 'comfortable');\n });\n return value;\n}\n\n// We expect VR is to be set only once and before the application is rendered.\nlet visualRefreshState: undefined | boolean = undefined;\n\nexport function useVisualRefresh() {\n if (visualRefreshState === undefined) {\n const supportsCSSVariables = typeof window !== 'undefined' && window.CSS?.supports?.('color', 'var(--test-var)');\n\n if (ALWAYS_VISUAL_REFRESH) {\n visualRefreshState = true;\n } else if (!supportsCSSVariables) {\n visualRefreshState = false;\n } else {\n visualRefreshState = !!document.querySelector('.awsui-visual-refresh');\n }\n }\n return visualRefreshState;\n}\n\nexport function useReducedMotion(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState(false);\n useMutationObserver(elementRef, node => {\n setValue(isMotionDisabled(node));\n });\n return value;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-visual-mode/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,UAAU,cAAc,CAAC,UAAwC;IAC/D,IAAA,KAAoB,QAAQ,CAAmB,OAAO,CAAC,EAAtD,KAAK,QAAA,EAAE,QAAQ,QAAuC,CAAC;IAC9D,mBAAmB,CAAC,UAAU,EAAE,UAAA,IAAI;QAClC,IAAM,cAAc,GAAG,WAAW,CAChC,IAAI,EACJ,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,yBAAyB,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAhG,CAAgG,CACzG,CAAC;QACF,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,UAAwC;IAC/D,IAAA,KAAoB,QAAQ,CAA4B,aAAa,CAAC,EAArE,KAAK,QAAA,EAAE,QAAQ,QAAsD,CAAC;IAC7E,mBAAmB,CAAC,UAAU,EAAE,UAAA,IAAI;QAClC,IAAM,iBAAiB,GAAG,WAAW,CACnC,IAAI,EACJ,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,4BAA4B,CAAC,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAtG,CAAsG,CAC/G,CAAC;QACF,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,IAAM,gBAAgB,GAAG,qBAAqB,CAAC,CAAC,CAAC,cAAM,OAAA,IAAI,EAAJ,CAAI,CAAC,CAAC,CAAC,uBAAuB,CAAC;AAE7F,8EAA8E;AAC9E,IAAI,kBAAkB,GAAwB,SAAS,CAAC;AAExD,cAAc;AACd,MAAM,UAAU,uBAAuB;IACrC,kBAAkB,GAAG,SAAS,CAAC;AACjC,CAAC;AAED,SAAS,mBAAmB;IAC1B,OAAO,OAAO,QAAQ,KAAK,WAAW,IAAI,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;AAC9F,CAAC;AAED,MAAM,UAAU,uBAAuB;IACrC,IAAI,kBAAkB,KAAK,SAAS,EAAE;QACpC,kBAAkB,GAAG,mBAAmB,EAAE,CAAC;KAC5C;IACD,IAAI,aAAa,EAAE;QACjB,IAAM,qBAAqB,GAAG,mBAAmB,EAAE,CAAC;QACpD,IAAI,qBAAqB,KAAK,kBAAkB,EAAE;YAChD,QAAQ,CACN,gBAAgB,EAChB,iEAAiE;gBAC/D,kGAAkG,CACrG,CAAC;SACH;KACF;IACD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,UAAwC;IACjE,IAAA,KAAoB,QAAQ,CAAC,KAAK,CAAC,EAAlC,KAAK,QAAA,EAAE,QAAQ,QAAmB,CAAC;IAC1C,mBAAmB,CAAC,UAAU,EAAE,UAAA,IAAI;QAClC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useState } from 'react';\nimport { ALWAYS_VISUAL_REFRESH } from '../../environment';\nimport { isMotionDisabled } from '../../motion';\nimport { findUpUntil } from '../../utils/dom';\nimport { useMutationObserver } from '../use-mutation-observer';\nimport { isDevelopment } from '../../is-development';\nimport { warnOnce } from '../../logging';\n\nexport function useCurrentMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'light' | 'dark'>('light');\n useMutationObserver(elementRef, node => {\n const darkModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-dark-mode') || node.classList.contains('awsui-dark-mode')\n );\n setValue(darkModeParent ? 'dark' : 'light');\n });\n return value;\n}\n\nexport function useDensityMode(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState<'comfortable' | 'compact'>('comfortable');\n useMutationObserver(elementRef, node => {\n const compactModeParent = findUpUntil(\n node,\n node => node.classList.contains('awsui-polaris-compact-mode') || node.classList.contains('awsui-compact-mode')\n );\n setValue(compactModeParent ? 'compact' : 'comfortable');\n });\n return value;\n}\n\nexport const useVisualRefresh = ALWAYS_VISUAL_REFRESH ? () => true : useVisualRefreshDynamic;\n\n// We expect VR is to be set only once and before the application is rendered.\nlet visualRefreshState: undefined | boolean = undefined;\n\n// for testing\nexport function clearVisualRefreshState() {\n visualRefreshState = undefined;\n}\n\nfunction detectVisualRefresh() {\n return typeof document !== 'undefined' && !!document.querySelector('.awsui-visual-refresh');\n}\n\nexport function useVisualRefreshDynamic() {\n if (visualRefreshState === undefined) {\n visualRefreshState = detectVisualRefresh();\n }\n if (isDevelopment) {\n const newVisualRefreshState = detectVisualRefresh();\n if (newVisualRefreshState !== visualRefreshState) {\n warnOnce(\n 'Visual Refresh',\n 'Dynamic visual refresh change detected. This is not supported. ' +\n 'Make sure `awsui-visual-refresh` is attached to the `<body>` element before initial React render'\n );\n }\n }\n return visualRefreshState;\n}\n\nexport function useReducedMotion(elementRef: React.RefObject<HTMLElement>) {\n const [value, setValue] = useState(false);\n useMutationObserver(elementRef, node => {\n setValue(isMotionDisabled(node));\n });\n return value;\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "308d7696b2b568577d722a9eb0a04fcf6c883369"
2
+ "commit": "6a2e6386b2fbe18f2c4b45a235799e136798c40b"
3
3
  }