@cloudscape-design/components 3.0.801 → 3.0.802

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 (154) hide show
  1. package/attribute-editor/additional-info.js +1 -1
  2. package/attribute-editor/additional-info.js.map +1 -1
  3. package/attribute-editor/internal.js +1 -1
  4. package/attribute-editor/internal.js.map +1 -1
  5. package/button/internal.d.ts.map +1 -1
  6. package/button/internal.js +1 -1
  7. package/button/internal.js.map +1 -1
  8. package/button-group/icon-button-item.d.ts.map +1 -1
  9. package/button-group/icon-button-item.js +1 -1
  10. package/button-group/icon-button-item.js.map +1 -1
  11. package/cards/index.js +1 -1
  12. package/cards/index.js.map +1 -1
  13. package/code-editor/index.js +1 -1
  14. package/code-editor/index.js.map +1 -1
  15. package/code-editor/status-bar.js +1 -1
  16. package/code-editor/status-bar.js.map +1 -1
  17. package/date-picker/index.js +1 -1
  18. package/date-picker/index.js.map +1 -1
  19. package/date-range-picker/calendar/header/index.d.ts.map +1 -1
  20. package/date-range-picker/calendar/header/index.js +2 -2
  21. package/date-range-picker/calendar/header/index.js.map +1 -1
  22. package/date-range-picker/calendar/index.js +1 -1
  23. package/date-range-picker/calendar/index.js.map +1 -1
  24. package/date-range-picker/dropdown.js +1 -1
  25. package/date-range-picker/dropdown.js.map +1 -1
  26. package/drawer/implementation.d.ts.map +1 -1
  27. package/drawer/implementation.js +1 -1
  28. package/drawer/implementation.js.map +1 -1
  29. package/flashbar/flash.js +1 -1
  30. package/flashbar/flash.js.map +1 -1
  31. package/form/internal.d.ts.map +1 -1
  32. package/form/internal.js +1 -1
  33. package/form/internal.js.map +1 -1
  34. package/form-field/internal.js +1 -1
  35. package/form-field/internal.js.map +1 -1
  36. package/help-panel/implementation.d.ts.map +1 -1
  37. package/help-panel/implementation.js +1 -1
  38. package/help-panel/implementation.js.map +1 -1
  39. package/index.d.ts +1 -0
  40. package/index.d.ts.map +1 -1
  41. package/index.js +1 -0
  42. package/index.js.map +1 -1
  43. package/internal/analytics/index.d.ts.map +1 -1
  44. package/internal/analytics/index.js +1 -0
  45. package/internal/analytics/index.js.map +1 -1
  46. package/internal/analytics/interfaces.d.ts +12 -1
  47. package/internal/analytics/interfaces.d.ts.map +1 -1
  48. package/internal/analytics/interfaces.js.map +1 -1
  49. package/internal/components/chart-plot/index.d.ts.map +1 -1
  50. package/internal/components/chart-plot/index.js +1 -1
  51. package/internal/components/chart-plot/index.js.map +1 -1
  52. package/internal/components/chart-status-container/index.d.ts.map +1 -1
  53. package/internal/components/chart-status-container/index.js +1 -1
  54. package/internal/components/chart-status-container/index.js.map +1 -1
  55. package/internal/components/dropdown-footer/index.js +1 -1
  56. package/internal/components/dropdown-footer/index.js.map +1 -1
  57. package/internal/environment.js +1 -1
  58. package/internal/environment.json +1 -1
  59. package/internal/hooks/use-dom-attribute/index.d.ts +5 -0
  60. package/internal/hooks/use-dom-attribute/index.d.ts.map +1 -0
  61. package/internal/hooks/use-dom-attribute/index.js +19 -0
  62. package/internal/hooks/use-dom-attribute/index.js.map +1 -0
  63. package/internal/hooks/use-performance-marks/index.d.ts +1 -1
  64. package/internal/hooks/use-performance-marks/index.d.ts.map +1 -1
  65. package/internal/hooks/use-performance-marks/index.js +3 -18
  66. package/internal/hooks/use-performance-marks/index.js.map +1 -1
  67. package/internal/hooks/use-table-interaction-metrics/index.d.ts +8 -1
  68. package/internal/hooks/use-table-interaction-metrics/index.d.ts.map +1 -1
  69. package/internal/hooks/use-table-interaction-metrics/index.js +24 -6
  70. package/internal/hooks/use-table-interaction-metrics/index.js.map +1 -1
  71. package/internal/manifest.json +1 -1
  72. package/live-region/controller.d.ts.map +1 -0
  73. package/{internal/components/live-region → live-region}/controller.js +2 -2
  74. package/live-region/controller.js.map +1 -0
  75. package/live-region/index.d.ts.map +1 -0
  76. package/{internal/components/live-region → live-region}/index.js +3 -5
  77. package/live-region/index.js.map +1 -0
  78. package/{internal/components/live-region → live-region}/interfaces.d.ts +5 -11
  79. package/live-region/interfaces.d.ts.map +1 -0
  80. package/live-region/interfaces.js.map +1 -0
  81. package/{internal/components/live-region → live-region}/internal.d.ts +1 -1
  82. package/live-region/internal.d.ts.map +1 -0
  83. package/{internal/components/live-region → live-region}/internal.js +11 -11
  84. package/live-region/internal.js.map +1 -0
  85. package/live-region/styles.css.js +7 -0
  86. package/{internal/components/live-region → live-region}/styles.scoped.css +3 -3
  87. package/{internal/components/live-region → live-region}/styles.selectors.js +2 -2
  88. package/live-region/test-classes/styles.css.js +7 -0
  89. package/live-region/test-classes/styles.scoped.css +11 -0
  90. package/live-region/test-classes/styles.selectors.js +8 -0
  91. package/package.json +2 -1
  92. package/pie-chart/pie-chart.d.ts.map +1 -1
  93. package/pie-chart/pie-chart.js +1 -1
  94. package/pie-chart/pie-chart.js.map +1 -1
  95. package/progress-bar/index.js +1 -1
  96. package/progress-bar/index.js.map +1 -1
  97. package/s3-resource-selector/s3-in-context/index.js +2 -2
  98. package/s3-resource-selector/s3-in-context/index.js.map +1 -1
  99. package/s3-resource-selector/s3-modal/basic-table.d.ts.map +1 -1
  100. package/s3-resource-selector/s3-modal/basic-table.js +1 -1
  101. package/s3-resource-selector/s3-modal/basic-table.js.map +1 -1
  102. package/select/parts/filter.d.ts +1 -1
  103. package/table/body-cell/disabled-inline-editor.js +1 -1
  104. package/table/body-cell/disabled-inline-editor.js.map +1 -1
  105. package/table/body-cell/index.d.ts.map +1 -1
  106. package/table/body-cell/index.js +2 -2
  107. package/table/body-cell/index.js.map +1 -1
  108. package/table/body-cell/inline-editor.d.ts.map +1 -1
  109. package/table/body-cell/inline-editor.js +4 -4
  110. package/table/body-cell/inline-editor.js.map +1 -1
  111. package/table/internal.d.ts.map +1 -1
  112. package/table/internal.js +26 -14
  113. package/table/internal.js.map +1 -1
  114. package/table/no-data-cell.js +1 -1
  115. package/table/no-data-cell.js.map +1 -1
  116. package/table/progressive-loading/items-loader.js +1 -1
  117. package/table/progressive-loading/items-loader.js.map +1 -1
  118. package/tag-editor/index.js +1 -1
  119. package/tag-editor/index.js.map +1 -1
  120. package/test-utils/dom/index.d.ts +3 -0
  121. package/test-utils/dom/index.js +10 -2
  122. package/test-utils/dom/index.js.map +1 -1
  123. package/test-utils/dom/{internal/live-region.js → live-region/index.js} +2 -2
  124. package/test-utils/dom/live-region/index.js.map +1 -0
  125. package/test-utils/selectors/index.d.ts +3 -0
  126. package/test-utils/selectors/index.js +10 -2
  127. package/test-utils/selectors/index.js.map +1 -1
  128. package/test-utils/selectors/{internal/live-region.js → live-region/index.js} +2 -2
  129. package/test-utils/selectors/live-region/index.js.map +1 -0
  130. package/test-utils/tsconfig.tsbuildinfo +1 -1
  131. package/text-filter/search-results.js +1 -1
  132. package/text-filter/search-results.js.map +1 -1
  133. package/tutorial-panel/components/tutorial-list/index.js +1 -1
  134. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
  135. package/internal/components/live-region/controller.d.ts.map +0 -1
  136. package/internal/components/live-region/controller.js.map +0 -1
  137. package/internal/components/live-region/index.d.ts.map +0 -1
  138. package/internal/components/live-region/index.js.map +0 -1
  139. package/internal/components/live-region/interfaces.d.ts.map +0 -1
  140. package/internal/components/live-region/interfaces.js.map +0 -1
  141. package/internal/components/live-region/internal.d.ts.map +0 -1
  142. package/internal/components/live-region/internal.js.map +0 -1
  143. package/internal/components/live-region/styles.css.js +0 -7
  144. package/internal/hooks/use-component-analytics/index.d.ts +0 -8
  145. package/internal/hooks/use-component-analytics/index.d.ts.map +0 -1
  146. package/internal/hooks/use-component-analytics/index.js +0 -28
  147. package/internal/hooks/use-component-analytics/index.js.map +0 -1
  148. package/test-utils/dom/internal/live-region.js.map +0 -1
  149. package/test-utils/selectors/internal/live-region.js.map +0 -1
  150. /package/{internal/components/live-region → live-region}/controller.d.ts +0 -0
  151. /package/{internal/components/live-region → live-region}/index.d.ts +0 -0
  152. /package/{internal/components/live-region → live-region}/interfaces.js +0 -0
  153. /package/test-utils/dom/{internal/live-region.d.ts → live-region/index.d.ts} +0 -0
  154. /package/test-utils/selectors/{internal/live-region.d.ts → live-region/index.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":";AA4BA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACvE,YAAY,EAAE,KAAK,CAAC,cAAc;;EAyDnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":";AAUA;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,EACxC,UAAU,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,SAAS,CAAC,EACvE,YAAY,EAAE,KAAK,CAAC,cAAc;;EA0DnC"}
@@ -1,25 +1,10 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
- import { useEffect, useRef } from 'react';
3
+ import { useEffect } from 'react';
4
4
  import { useModalContext } from '../../context/modal-context';
5
+ import { useDOMAttribute } from '../use-dom-attribute';
5
6
  import { useEffectOnUpdate } from '../use-effect-on-update';
6
7
  import { useRandomId } from '../use-unique-id';
7
- /*
8
- This hook allows setting an HTML attribute after the first render, without rerendering the component.
9
- */
10
- function usePerformanceMarkAttribute(elementRef, value) {
11
- const attributeName = 'data-analytics-performance-mark';
12
- const attributeValueRef = useRef();
13
- useEffect(() => {
14
- var _a;
15
- // With this effect, we apply the attribute only on the client, to avoid hydration errors.
16
- attributeValueRef.current = value;
17
- (_a = elementRef.current) === null || _a === void 0 ? void 0 : _a.setAttribute(attributeName, value);
18
- }, [value, elementRef]);
19
- return {
20
- [attributeName]: attributeValueRef.current,
21
- };
22
- }
23
8
  /**
24
9
  * This function returns an object that needs to be spread onto the same
25
10
  * element as the `elementRef`, so that the data attribute is applied
@@ -28,7 +13,7 @@ function usePerformanceMarkAttribute(elementRef, value) {
28
13
  export function usePerformanceMarks(name, enabled, elementRef, getDetails, dependencies) {
29
14
  const id = useRandomId();
30
15
  const { isInModal } = useModalContext();
31
- const attributes = usePerformanceMarkAttribute(elementRef, id);
16
+ const attributes = useDOMAttribute(elementRef, 'data-analytics-performance-mark', id);
32
17
  useEffect(() => {
33
18
  if (!enabled || !elementRef.current || isInModal) {
34
19
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;EAEE;AACF,SAAS,2BAA2B,CAAC,UAAwC,EAAE,KAAa;IAC1F,MAAM,aAAa,GAAG,iCAAiC,CAAC;IAExD,MAAM,iBAAiB,GAAG,MAAM,EAAsB,CAAC;IAEvD,SAAS,CAAC,GAAG,EAAE;;QACb,0FAA0F;QAC1F,iBAAiB,CAAC,OAAO,GAAG,KAAK,CAAC;QAClC,MAAA,UAAU,CAAC,OAAO,0CAAE,YAAY,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IACzD,CAAC,EAAE,CAAC,KAAK,EAAE,U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CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,MAAM,eAAe,GAAG,GAAG,IAAI,SAAS,CAAC;QAEzC,WAAW,CAAC,IAAI,CAAC,eAAe,EAAE;YAChC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,YAAY,CAAC,CAAC;IAEjB,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from 'react';\n\nimport { useModalContext } from '../../context/modal-context';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\nimport { useRandomId } from '../use-unique-id';\n\n/*\nThis hook allows setting an HTML attribute after the first render, without rerendering the component.\n*/\nfunction usePerformanceMarkAttribute(elementRef: React.RefObject<HTMLElement>, value: string) {\n const attributeName = 'data-analytics-performance-mark';\n\n const attributeValueRef = useRef<string | undefined>();\n\n useEffect(() => {\n // With this effect, we apply the attribute only on the client, to avoid hydration errors.\n attributeValueRef.current = value;\n elementRef.current?.setAttribute(attributeName, value);\n }, [value, elementRef]);\n\n return {\n [attributeName]: attributeValueRef.current,\n };\n}\n\n/**\n * This function returns an object that needs to be spread onto the same\n * element as the `elementRef`, so that the data attribute is applied\n * correctly.\n */\nexport function usePerformanceMarks(\n name: string,\n enabled: boolean,\n elementRef: React.RefObject<HTMLElement>,\n getDetails: () => Record<string, string | boolean | number | undefined>,\n dependencies: React.DependencyList\n) {\n const id = useRandomId();\n const { isInModal } = useModalContext();\n const attributes = usePerformanceMarkAttribute(elementRef, id);\n useEffect(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const renderedMarkName = `${name}Rendered`;\n\n performance.mark(renderedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffectOnUpdate(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const updatedMarkName = `${name}Updated`;\n\n performance.mark(updatedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return attributes;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-performance-marks/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,OAAgB,EAChB,UAAwC,EACxC,UAAuE,EACvE,YAAkC;IAElC,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,CAAC;IACxC,MAAM,UAAU,GAAG,eAAe,CAAC,UAAU,EAAE,iCAAiC,EAAE,EAAE,CAAC,CAAC;IAEtF,SAAS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ourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect } from 'react';\n\nimport { useModalContext } from '../../context/modal-context';\nimport { useDOMAttribute } from '../use-dom-attribute';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\nimport { useRandomId } from '../use-unique-id';\n\n/**\n * This function returns an object that needs to be spread onto the same\n * element as the `elementRef`, so that the data attribute is applied\n * correctly.\n */\nexport function usePerformanceMarks(\n name: string,\n enabled: boolean,\n elementRef: React.RefObject<HTMLElement>,\n getDetails: () => Record<string, string | boolean | number | undefined>,\n dependencies: React.DependencyList\n) {\n const id = useRandomId();\n const { isInModal } = useModalContext();\n const attributes = useDOMAttribute(elementRef, 'data-analytics-performance-mark', id);\n\n useEffect(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const renderedMarkName = `${name}Rendered`;\n\n performance.mark(renderedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffectOnUpdate(() => {\n if (!enabled || !elementRef.current || isInModal) {\n return;\n }\n const elementVisible =\n elementRef.current.offsetWidth > 0 &&\n elementRef.current.offsetHeight > 0 &&\n getComputedStyle(elementRef.current).visibility !== 'hidden';\n\n if (!elementVisible) {\n return;\n }\n\n const updatedMarkName = `${name}Updated`;\n\n performance.mark(updatedMarkName, {\n detail: {\n source: 'awsui',\n instanceIdentifier: id,\n ...getDetails(),\n },\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencies);\n\n return attributes;\n}\n"]}
@@ -1,11 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { JSONObject } from '../../analytics/interfaces';
1
3
  export interface UseTableInteractionMetricsProps {
4
+ elementRef: React.RefObject<HTMLElement>;
2
5
  instanceIdentifier: string | undefined;
3
6
  loading: boolean | undefined;
4
7
  itemCount: number;
5
8
  getComponentIdentifier: () => string | undefined;
9
+ getComponentConfiguration: () => JSONObject;
6
10
  interactionMetadata: () => string;
7
11
  }
8
- export declare function useTableInteractionMetrics({ itemCount, instanceIdentifier, getComponentIdentifier, loading, interactionMetadata, }: UseTableInteractionMetricsProps): {
12
+ export declare function useTableInteractionMetrics({ elementRef, itemCount, instanceIdentifier, getComponentIdentifier, getComponentConfiguration, loading, interactionMetadata, }: UseTableInteractionMetricsProps): {
13
+ tableInteractionAttributes: {
14
+ [x: string]: string | undefined;
15
+ };
9
16
  setLastUserAction: (name: string) => undefined;
10
17
  };
11
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-table-interaction-metrics/index.ts"],"names":[],"mappings":"AAcA,MAAM,WAAW,+BAA+B;IAC9C,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACjD,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC;AAED,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,OAAe,EACf,mBAAmB,GACpB,EAAE,+BAA+B;8BAoCJ,MAAM;EAEnC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-table-interaction-metrics/index.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAWxD,MAAM,WAAW,+BAA+B;IAC9C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACzC,kBAAkB,EAAE,MAAM,GAAG,SAAS,CAAC;IACvC,OAAO,EAAE,OAAO,GAAG,SAAS,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IACjD,yBAAyB,EAAE,MAAM,UAAU,CAAC;IAC5C,mBAAmB,EAAE,MAAM,MAAM,CAAC;CACnC;AAED,wBAAgB,0BAA0B,CAAC,EACzC,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,OAAe,EACf,mBAAmB,GACpB,EAAE,+BAA+B;;;;8BA2DJ,MAAM;EAEnC"}
@@ -1,19 +1,30 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { useEffect, useRef } from 'react';
4
- import { PerformanceMetrics } from '../../analytics';
4
+ import { ComponentMetrics, PerformanceMetrics } from '../../analytics';
5
+ import { useDOMAttribute } from '../use-dom-attribute';
5
6
  import { useEffectOnUpdate } from '../use-effect-on-update';
7
+ import { useRandomId } from '../use-unique-id';
6
8
  /*
7
9
  If the last user interaction is more than this time ago, it is not considered
8
10
  to be the cause of the current loading state.
9
11
  */
10
12
  const USER_ACTION_TIME_LIMIT = 1000;
11
- export function useTableInteractionMetrics({ itemCount, instanceIdentifier, getComponentIdentifier, loading = false, interactionMetadata, }) {
13
+ export function useTableInteractionMetrics({ elementRef, itemCount, instanceIdentifier, getComponentIdentifier, getComponentConfiguration, loading = false, interactionMetadata, }) {
14
+ const taskInteractionId = useRandomId();
15
+ const tableInteractionAttributes = useDOMAttribute(elementRef, 'data-analytics-task-interaction-id', taskInteractionId);
12
16
  const lastUserAction = useRef(null);
13
17
  const capturedUserAction = useRef(null);
14
18
  const loadingStartTime = useRef(null);
15
- const metadata = useRef({ itemCount, getComponentIdentifier, interactionMetadata });
16
- metadata.current = { itemCount, getComponentIdentifier, interactionMetadata };
19
+ const metadata = useRef({ itemCount, getComponentIdentifier, getComponentConfiguration, interactionMetadata });
20
+ metadata.current = { itemCount, getComponentIdentifier, getComponentConfiguration, interactionMetadata };
21
+ useEffect(() => {
22
+ ComponentMetrics.componentMounted({
23
+ taskInteractionId,
24
+ componentName: 'table',
25
+ componentConfiguration: metadata.current.getComponentConfiguration(),
26
+ });
27
+ }, [taskInteractionId]);
17
28
  useEffect(() => {
18
29
  if (loading) {
19
30
  loadingStartTime.current = performance.now();
@@ -26,7 +37,7 @@ export function useTableInteractionMetrics({ itemCount, instanceIdentifier, getC
26
37
  }
27
38
  }, [loading]);
28
39
  useEffectOnUpdate(() => {
29
- var _a;
40
+ var _a, _b;
30
41
  if (!loading && loadingStartTime.current !== null) {
31
42
  const loadingDuration = performance.now() - loadingStartTime.current;
32
43
  loadingStartTime.current = null;
@@ -38,9 +49,16 @@ export function useTableInteractionMetrics({ itemCount, instanceIdentifier, getC
38
49
  instanceIdentifier,
39
50
  noOfResourcesInTable: metadata.current.itemCount,
40
51
  });
52
+ ComponentMetrics.componentUpdated({
53
+ taskInteractionId,
54
+ componentName: 'table',
55
+ actionType: (_b = capturedUserAction.current) !== null && _b !== void 0 ? _b : '',
56
+ componentConfiguration: metadata.current.getComponentConfiguration(),
57
+ });
41
58
  }
42
- }, [instanceIdentifier, loading]);
59
+ }, [instanceIdentifier, loading, taskInteractionId]);
43
60
  return {
61
+ tableInteractionAttributes,
44
62
  setLastUserAction: (name) => void (lastUserAction.current = { name, time: performance.now() }),
45
63
  };
46
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-table-interaction-metrics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC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BAAkB,CAAC,OAAO,mCAAI,EAAE;gBAC5C,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;gBAC5C,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EAAE;gBAC3D,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,sBAAsB,EAAE;gBAC9D,kBAAkB;gBAClB,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS;aACjD,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC;IAElC,OAAO;QACL,iBAAiB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC;KACvG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from 'react';\n\nimport { PerformanceMetrics } from '../../analytics';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\n\n/*\nIf the last user interaction is more than this time ago, it is not considered\nto be the cause of the current loading state.\n*/\nconst USER_ACTION_TIME_LIMIT = 1_000;\n\nexport interface UseTableInteractionMetricsProps {\n instanceIdentifier: string | undefined;\n loading: boolean | undefined;\n itemCount: number;\n getComponentIdentifier: () => string | undefined;\n interactionMetadata: () => string;\n}\n\nexport function useTableInteractionMetrics({\n itemCount,\n instanceIdentifier,\n getComponentIdentifier,\n loading = false,\n interactionMetadata,\n}: UseTableInteractionMetricsProps) {\n const lastUserAction = useRef<{ name: string; time: number } | null>(null);\n const capturedUserAction = useRef<string | null>(null);\n const loadingStartTime = useRef<number | null>(null);\n\n const metadata = useRef({ itemCount, getComponentIdentifier, interactionMetadata });\n metadata.current = { itemCount, getComponentIdentifier, interactionMetadata };\n useEffect(() => {\n if (loading) {\n loadingStartTime.current = performance.now();\n\n if (lastUserAction.current && lastUserAction.current.time > performance.now() - USER_ACTION_TIME_LIMIT) {\n capturedUserAction.current = lastUserAction.current.name;\n } else {\n capturedUserAction.current = null;\n }\n }\n }, [loading]);\n\n useEffectOnUpdate(() => {\n if (!loading && loadingStartTime.current !== null) {\n const loadingDuration = performance.now() - loadingStartTime.current;\n loadingStartTime.current = null;\n\n PerformanceMetrics.tableInteraction({\n userAction: capturedUserAction.current ?? '',\n interactionTime: Math.round(loadingDuration),\n interactionMetadata: metadata.current.interactionMetadata(),\n componentIdentifier: metadata.current.getComponentIdentifier(),\n instanceIdentifier,\n noOfResourcesInTable: metadata.current.itemCount,\n });\n }\n }, [instanceIdentifier, loading]);\n\n return {\n setLastUserAction: (name: string) => void (lastUserAction.current = { name, time: performance.now() }),\n };\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-table-interaction-metrics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;EAGE;AACF,MAAM,sBAAsB,GAAG,IAAK,CAAC;AAYrC,MAAM,UAAU,0BAA0B,CAAC,EACzC,UAAU,EACV,SAAS,EACT,kBAAkB,EAClB,sBAAsB,EACtB,yBAAyB,EACzB,OAAO,GAAG,KAAK,EACf,mBAAmB,GACa;IAChC,MAAM,iBAAiB,GAAG,WAAW,EAAE,CAAC;IACxC,MAAM,0BAA0B,GAAG,eAAe,CAChD,UAAU,EACV,oCAAoC,EACpC,iBAAiB,C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BAAgB,CAAC,OAAO,GAAG,IAAI,CAAC;YAEhC,kBAAkB,CAAC,gBAAgB,CAAC;gBAClC,UAAU,EAAE,MAAA,kBAAkB,CAAC,OAAO,mCAAI,EAAE;gBAC5C,eAAe,EAAE,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC;gBAC5C,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,mBAAmB,EAAE;gBAC3D,mBAAmB,EAAE,QAAQ,CAAC,OAAO,CAAC,sBAAsB,EAAE;gBAC9D,kBAAkB;gBAClB,oBAAoB,EAAE,QAAQ,CAAC,OAAO,CAAC,SAAS;aACjD,CAAC,CAAC;YAEH,gBAAgB,CAAC,gBAAgB,CAAC;gBAChC,iBAAiB;gBACjB,aAAa,EAAE,OAAO;gBACtB,UAAU,EAAE,MAAA,kBAAkB,CAAC,OAAO,mCAAI,EAAE;gBAC5C,sBAAsB,EAAE,QAAQ,CAAC,OAAO,CAAC,yBAAyB,EAAE;aACrE,CAAC,CAAC;SACJ;IACH,CAAC,EAAE,CAAC,kBAAkB,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAErD,OAAO;QACL,0BAA0B;QAC1B,iBAAiB,EAAE,CAAC,IAAY,EAAE,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC;KACvG,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { useEffect, useRef } from 'react';\n\nimport { ComponentMetrics, PerformanceMetrics } from '../../analytics';\nimport { JSONObject } from '../../analytics/interfaces';\nimport { useDOMAttribute } from '../use-dom-attribute';\nimport { useEffectOnUpdate } from '../use-effect-on-update';\nimport { useRandomId } from '../use-unique-id';\n\n/*\nIf the last user interaction is more than this time ago, it is not considered\nto be the cause of the current loading state.\n*/\nconst USER_ACTION_TIME_LIMIT = 1_000;\n\nexport interface UseTableInteractionMetricsProps {\n elementRef: React.RefObject<HTMLElement>;\n instanceIdentifier: string | undefined;\n loading: boolean | undefined;\n itemCount: number;\n getComponentIdentifier: () => string | undefined;\n getComponentConfiguration: () => JSONObject;\n interactionMetadata: () => string;\n}\n\nexport function useTableInteractionMetrics({\n elementRef,\n itemCount,\n instanceIdentifier,\n getComponentIdentifier,\n getComponentConfiguration,\n loading = false,\n interactionMetadata,\n}: UseTableInteractionMetricsProps) {\n const taskInteractionId = useRandomId();\n const tableInteractionAttributes = useDOMAttribute(\n elementRef,\n 'data-analytics-task-interaction-id',\n taskInteractionId\n );\n const lastUserAction = useRef<{ name: string; time: number } | null>(null);\n const capturedUserAction = useRef<string | null>(null);\n const loadingStartTime = useRef<number | null>(null);\n\n const metadata = useRef({ itemCount, getComponentIdentifier, getComponentConfiguration, interactionMetadata });\n metadata.current = { itemCount, getComponentIdentifier, getComponentConfiguration, interactionMetadata };\n\n useEffect(() => {\n ComponentMetrics.componentMounted({\n taskInteractionId,\n componentName: 'table',\n componentConfiguration: metadata.current.getComponentConfiguration(),\n });\n }, [taskInteractionId]);\n\n useEffect(() => {\n if (loading) {\n loadingStartTime.current = performance.now();\n\n if (lastUserAction.current && lastUserAction.current.time > performance.now() - USER_ACTION_TIME_LIMIT) {\n capturedUserAction.current = lastUserAction.current.name;\n } else {\n capturedUserAction.current = null;\n }\n }\n }, [loading]);\n\n useEffectOnUpdate(() => {\n if (!loading && loadingStartTime.current !== null) {\n const loadingDuration = performance.now() - loadingStartTime.current;\n loadingStartTime.current = null;\n\n PerformanceMetrics.tableInteraction({\n userAction: capturedUserAction.current ?? '',\n interactionTime: Math.round(loadingDuration),\n interactionMetadata: metadata.current.interactionMetadata(),\n componentIdentifier: metadata.current.getComponentIdentifier(),\n instanceIdentifier,\n noOfResourcesInTable: metadata.current.itemCount,\n });\n\n ComponentMetrics.componentUpdated({\n taskInteractionId,\n componentName: 'table',\n actionType: capturedUserAction.current ?? '',\n componentConfiguration: metadata.current.getComponentConfiguration(),\n });\n }\n }, [instanceIdentifier, loading, taskInteractionId]);\n\n return {\n tableInteractionAttributes,\n setLastUserAction: (name: string) => void (lastUserAction.current = { name, time: performance.now() }),\n };\n}\n"]}
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "fd869236ee7f8d6e5ac981aa2998be6aa5e119de"
2
+ "commit": "da076669637ff47afb03c7a2f3770e59ffe3ebab"
3
3
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../../../src/live-region/controller.ts"],"names":[],"mappings":"AAMA;;;;;;;GAOG;AACH,qBAAa,oBAAoB;aAeb,UAAU,EAAE,QAAQ,GAAG,WAAW;aAClC,KAAK;IAfvB;;;;OAIG;IACH,OAAc,YAAY,SAAK;IAE/B,OAAO,CAAC,QAAQ,CAAc;IAC9B,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,iBAAiB,CAAqB;IAC9C,OAAO,CAAC,oBAAoB,CAAS;IACrC,OAAO,CAAC,iBAAiB,CAAM;gBAGb,UAAU,EAAE,QAAQ,GAAG,WAAW,EAClC,KAAK,SAAoC;IAS3D;;OAEG;IACH,OAAO;IAQP,QAAQ,CAAC,EAAE,OAAO,EAAE,eAAuB,EAAE,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAE;IAkB9G,OAAO,CAAC,cAAc;CAqBvB"}
@@ -1,6 +1,7 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import styles from './styles.css.js';
4
+ import testUtilStyles from './test-classes/styles.css.js';
4
5
  /**
5
6
  * The controller that manages a single live region container. It has a timer
6
7
  * to make sure announcements are throttled correctly. It can also make sure
@@ -16,10 +17,9 @@ export class LiveRegionController {
16
17
  this._addedTerminalPeriod = false;
17
18
  this._nextAnnouncement = '';
18
19
  this._element = document.createElement('div');
19
- this._element.className = styles.announcer;
20
+ this._element.className = `${styles.announcer} ${testUtilStyles.announcer}`;
20
21
  this._element.setAttribute('aria-live', this.politeness);
21
22
  this._element.setAttribute('aria-atomic', 'true');
22
- this._element.setAttribute('data-awsui-live-announcer', 'true');
23
23
  document.body.appendChild(this._element);
24
24
  }
25
25
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../src/live-region/controller.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAE1D;;;;;;;GAOG;AACH,MAAM,OAAO,oBAAoB;IAc/B,YACkB,UAAkC,EAClC,QAAQ,oBAAoB,CAAC,YAAY;QADzC,eAAU,GAAV,UAAU,CAAwB;QAClC,UAAK,GAAL,KAAK,CAAoC;QALnD,yBAAoB,GAAG,KAAK,CAAC;QAC7B,sBAAiB,GAAG,EAAE,CAAC;QAM7B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,SAAS,GAAG,GAAG,MAAM,CAAC,SAAS,IAAI,cAAc,CAAC,SAAS,EAAE,CAAC;QAC5E,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzD,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAClD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,OAAO;;QACL,MAAA,IAAI,CAAC,QAAQ,0CAAE,MAAM,EAAE,CAAC;QACxB,IAAI,IAAI,CAAC,UAAU,KAAK,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CAAC,iBAAiB,GAAG,IAAI,CAAC,iBAAiB,CAAC;QAEhD,6CAA6C;QAC7C,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;;AAzED;;;;GAIG;AACW,iCAAY,GAAG,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\n/**\n * The controller that manages a single live region container. It has a timer\n * to make sure announcements are throttled correctly. It can also make sure\n * that a message is announced again even if it matches the previous content\n * of the live region.\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Live_Regions\n */\nexport class LiveRegionController {\n /**\n * The default delay for announcements when no delay is explicitly provided.\n * During internal unit testing, you can import this and explicitly set it to\n * 0 to make the live region update the DOM without waiting for a timer.\n */\n public static defaultDelay = 2;\n\n private _element: HTMLElement;\n private _timeoutId: number | undefined;\n private _lastAnnouncement: string | undefined;\n private _addedTerminalPeriod = false;\n private _nextAnnouncement = '';\n\n constructor(\n public readonly politeness: 'polite' | 'assertive',\n public readonly delay = LiveRegionController.defaultDelay\n ) {\n this._element = document.createElement('div');\n this._element.className = `${styles.announcer} ${testUtilStyles.announcer}`;\n this._element.setAttribute('aria-live', this.politeness);\n this._element.setAttribute('aria-atomic', 'true');\n document.body.appendChild(this._element);\n }\n\n /**\n * Reset the state of the controller and clear any active announcements.\n */\n destroy() {\n this._element?.remove();\n if (this._timeoutId !== undefined) {\n clearTimeout(this._timeoutId);\n this._timeoutId = undefined;\n }\n }\n\n announce({ message, forceReannounce = false }: { message?: string; delay?: number; forceReannounce?: boolean }) {\n if (!message) {\n return;\n }\n\n this._nextAnnouncement = message.trim();\n\n if (this.delay === 0 || forceReannounce) {\n // If the delay is 0, just skip the timeout shenanigans and update the\n // element synchronously. Great for tests.\n return this._updateElement(forceReannounce);\n }\n\n if (this._timeoutId === undefined) {\n this._timeoutId = setTimeout(() => this._updateElement(false), this.delay * 1000);\n }\n }\n\n private _updateElement(forceReannounce: boolean) {\n if (this._nextAnnouncement !== this._lastAnnouncement) {\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 this._element.textContent = this._nextAnnouncement;\n this._addedTerminalPeriod = false;\n } else if (forceReannounce) {\n // A (generally) safe way of forcing re-announcements is toggling the\n // terminal period. If we only keep adding periods, it's going to be\n // eventually interpreted as an ellipsis.\n this._element.textContent = this._nextAnnouncement + (this._addedTerminalPeriod ? '' : '.');\n this._addedTerminalPeriod = !this._addedTerminalPeriod;\n }\n\n // Track the announced text for deduplication.\n this._lastAnnouncement = this._nextAnnouncement;\n\n // Reset the state for the next announcement.\n this._timeoutId = undefined;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/live-region/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,iBAAS,UAAU,CAAC,EAAE,SAAiB,EAAE,MAAc,EAAE,OAAe,EAAE,GAAG,SAAS,EAAE,EAAE,eAAe,eAYxG;AAID,eAAe,UAAU,CAAC"}
@@ -2,14 +2,12 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { __rest } from "tslib";
4
4
  import React from 'react';
5
- // import useBaseComponent from '../../hooks/use-base-component';
6
- import { applyDisplayName } from '../../utils/apply-display-name';
5
+ import useBaseComponent from '../internal/hooks/use-base-component';
6
+ import { applyDisplayName } from '../internal/utils/apply-display-name';
7
7
  import InternalLiveRegion from './internal';
8
8
  function LiveRegion(_a) {
9
9
  var { assertive = false, hidden = false, tagName = 'div' } = _a, restProps = __rest(_a, ["assertive", "hidden", "tagName"]);
10
- // TODO: Switch this out when moving this component out of internal
11
- // const baseComponentProps = useBaseComponent('LiveRegion');
12
- const baseComponentProps = { __internalRootRef: React.useRef() };
10
+ const baseComponentProps = useBaseComponent('LiveRegion', { props: { assertive, hidden } });
13
11
  return (React.createElement(InternalLiveRegion, Object.assign({ assertive: assertive, hidden: hidden, tagName: tagName }, baseComponentProps, restProps)));
14
12
  }
15
13
  applyDisplayName(LiveRegion, 'LiveRegion');
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,kBAAkB,MAAM,YAAY,CAAC;AAI5C,SAAS,UAAU,CAAC,EAAqF;QAArF,EAAE,SAAS,GAAG,KAAK,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,OAAiC,EAA5B,SAAS,cAAlE,kCAAoE,CAAF;IACpF,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;IAE5F,OAAO,CACL,oBAAC,kBAAkB,kBACjB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,IACZ,kBAAkB,EAClB,SAAS,EACb,CACH,CAAC;AACJ,CAAC;AAED,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAE3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { LiveRegionProps } from './interfaces';\nimport InternalLiveRegion from './internal';\n\nexport { LiveRegionProps };\n\nfunction LiveRegion({ assertive = false, hidden = false, tagName = 'div', ...restProps }: LiveRegionProps) {\n const baseComponentProps = useBaseComponent('LiveRegion', { props: { assertive, hidden } });\n\n return (\n <InternalLiveRegion\n assertive={assertive}\n hidden={hidden}\n tagName={tagName}\n {...baseComponentProps}\n {...restProps}\n />\n );\n}\n\napplyDisplayName(LiveRegion, 'LiveRegion');\n\nexport default LiveRegion;\n"]}
@@ -1,13 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { BaseComponentProps } from '../../base-component';
2
+ import { BaseComponentProps } from '../internal/base-component';
3
3
  export interface LiveRegionProps extends BaseComponentProps {
4
- /**
5
- * The string for the aria-live announcement text. When this content
6
- * changes, the text will be re-announced to assistive technologies. If this
7
- * property is provided, it will be used for the live announcement instead of
8
- * the `children` slot.
9
- */
10
- message?: string;
11
4
  /**
12
5
  * Whether the announcements should be made using assertive aria-live.
13
6
  * Assertive announcements interrupt the user's action, so they should only
@@ -19,12 +12,13 @@ export interface LiveRegionProps extends BaseComponentProps {
19
12
  */
20
13
  tagName?: LiveRegionProps.TagName;
21
14
  /**
22
- * Defines whether to visually hide the contents of the `children` slot.
15
+ * Determines whether to visually hide the contents of the `children` slot.
23
16
  */
24
17
  hidden?: boolean;
25
18
  /**
26
- * Use the rendered content as the source for the announcement text.
27
- * Prefer `message` if announcement text can be provided as a string.
19
+ * Use the rendered content as the source for the announcement text. When the
20
+ * text content inside this slot changes, it will be re-announced to
21
+ * assistive technologies.
28
22
  */
29
23
  children?: React.ReactNode;
30
24
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/live-region/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,WAAW,eAAgB,SAAQ,kBAAkB;IACzD;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC,OAAO,CAAC;IAElC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,yBAAiB,eAAe,CAAC;IAC/B,KAAY,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;CACtC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/live-region/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\n\nexport interface LiveRegionProps extends BaseComponentProps {\n /**\n * Whether the announcements should be made using assertive aria-live.\n * Assertive announcements interrupt the user's action, so they should only\n * be used when absolutely necessary.\n */\n assertive?: boolean;\n\n /**\n * The tag name to use for the wrapper around the `children` slot.\n */\n tagName?: LiveRegionProps.TagName;\n\n /**\n * Determines whether to visually hide the contents of the `children` slot.\n */\n hidden?: boolean;\n\n /**\n * Use the rendered content as the source for the announcement text. When the\n * text content inside this slot changes, it will be re-announced to\n * assistive technologies.\n */\n children?: React.ReactNode;\n}\n\nexport namespace LiveRegionProps {\n export type TagName = 'span' | 'div';\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { InternalBaseComponentProps } from '../../hooks/use-base-component';
2
+ import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
3
3
  import { LiveRegionProps } from './interfaces';
4
4
  export interface InternalLiveRegionProps extends InternalBaseComponentProps, LiveRegionProps {
5
5
  /**
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/live-region/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiD,MAAM,OAAO,CAAC;AAItE,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/C,MAAM,WAAW,uBAAwB,SAAQ,0BAA0B,EAAE,eAAe;IAC1F;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;;OAIG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,CAAC;CAC5E;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,UAAU,IAAI,IAAI,CAAC;CACpB;;AAED,wBAyEG"}
@@ -3,12 +3,13 @@
3
3
  import { __rest } from "tslib";
4
4
  import React, { useEffect, useImperativeHandle, useRef } from 'react';
5
5
  import clsx from 'clsx';
6
- import { getBaseProps } from '../../base-component';
7
- import { useMergeRefs } from '../../hooks/use-merge-refs';
6
+ import { getBaseProps } from '../internal/base-component';
7
+ import { useMergeRefs } from '../internal/hooks/use-merge-refs';
8
8
  import { LiveRegionController } from './controller';
9
9
  import styles from './styles.css.js';
10
+ import testUtilStyles from './test-classes/styles.css.js';
10
11
  export default React.forwardRef(function InternalLiveRegion(_a, ref) {
11
- var { assertive = false, hidden = false, tagName: TagName = 'div', delay, sources, message, children, __internalRootRef, className } = _a, restProps = __rest(_a, ["assertive", "hidden", "tagName", "delay", "sources", "message", "children", "__internalRootRef", "className"]);
12
+ var { assertive = false, hidden = false, tagName: TagName = 'div', delay, sources, children, __internalRootRef, className } = _a, restProps = __rest(_a, ["assertive", "hidden", "tagName", "delay", "sources", "children", "__internalRootRef", "className"]);
12
13
  const baseProps = getBaseProps(restProps);
13
14
  const childrenRef = useRef(null);
14
15
  const mergedRef = useMergeRefs(childrenRef, __internalRootRef);
@@ -35,13 +36,12 @@ export default React.forwardRef(function InternalLiveRegion(_a, ref) {
35
36
  };
36
37
  }, [assertive]);
37
38
  const getContent = () => {
38
- return sources
39
- ? getSourceContent(sources)
40
- : message
41
- ? message
42
- : childrenRef.current
43
- ? extractTextContent(childrenRef.current)
44
- : undefined;
39
+ if (sources) {
40
+ return getSourceContent(sources);
41
+ }
42
+ if (childrenRef.current) {
43
+ return extractTextContent(childrenRef.current);
44
+ }
45
45
  };
46
46
  // Call the controller on every render. The controller will deduplicate the
47
47
  // message against the previous announcement internally.
@@ -55,7 +55,7 @@ export default React.forwardRef(function InternalLiveRegion(_a, ref) {
55
55
  (_a = liveRegionControllerRef.current) === null || _a === void 0 ? void 0 : _a.announce({ message: getContent(), delay, forceReannounce: true });
56
56
  },
57
57
  }));
58
- return (React.createElement(TagName, Object.assign({ ref: mergedRef }, baseProps, { className: clsx(styles.root, className), hidden: hidden }), children));
58
+ return (React.createElement(TagName, Object.assign({ ref: mergedRef }, baseProps, { className: clsx(styles.root, testUtilStyles.root, className), hidden: hidden }), children));
59
59
  });
60
60
  function extractTextContent(node) {
61
61
  // We use the text content of the node as the announcement text.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/live-region/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AA8B1D,eAAe,KAAK,CAAC,UAAU,CAAC,SAAS,kBAAkB,CACzD,EAU0B,EAC1B,GAAqC;QAXrC,EACE,SAAS,GAAG,KAAK,EACjB,MAAM,GAAG,KAAK,EACd,OAAO,EAAE,OAAO,GAAG,KAAK,EACxB,KAAK,EACL,OAAO,EACP,QAAQ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. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { LiveRegionController } from './controller';\nimport { LiveRegionProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport interface InternalLiveRegionProps extends InternalBaseComponentProps, LiveRegionProps {\n /**\n * The delay between each announcement from this live region. You should\n * leave this set to the default unless this live region is commonly\n * interrupted by other actions (like text entry in text filtering).\n */\n delay?: number;\n\n /**\n * Use a list of strings and/or refs to existing elements for building the\n * announcement text. If this property is set, `children` and `message` will\n * be ignored.\n */\n sources?: ReadonlyArray<string | React.RefObject<HTMLElement> | undefined>;\n}\n\nexport interface InternalLiveRegionRef {\n /**\n * Force the live region to announce the message, even if it's the same as\n * the previously announced message.\n *\n * This is useful when making status updates after a change (e.g. filtering)\n * where the new message might be the same as the old one, but the announcement\n * also serves to tell screen reader users that the action was performed.\n */\n reannounce(): void;\n}\n\nexport default React.forwardRef(function InternalLiveRegion(\n {\n assertive = false,\n hidden = false,\n tagName: TagName = 'div',\n delay,\n sources,\n children,\n __internalRootRef,\n className,\n ...restProps\n }: InternalLiveRegionProps,\n ref: React.Ref<InternalLiveRegionRef>\n) {\n const baseProps = getBaseProps(restProps);\n const childrenRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n const mergedRef = useMergeRefs(childrenRef, __internalRootRef);\n\n useEffect(() => {\n // We have to do this because `inert` isn't properly supported until\n // React 19 and this seems much more maintainable than version detection.\n // `inert` is better than `hidden` because it also blocks pointer and\n // focus events as well as hiding the contents from screen readers.\n // https://github.com/facebook/react/issues/17157\n if (childrenRef.current) {\n childrenRef.current.inert = hidden;\n }\n }, [hidden]);\n\n // Initialize the live region controller inside an effect. We have to do this\n // because the controller depends on DOM elements, which aren't available on the\n // server.\n const liveRegionControllerRef = useRef<LiveRegionController | undefined>();\n useEffect(() => {\n const liveRegionController = new LiveRegionController(assertive ? 'assertive' : 'polite');\n liveRegionControllerRef.current = liveRegionController;\n return () => {\n liveRegionController.destroy();\n liveRegionControllerRef.current = undefined;\n };\n }, [assertive]);\n\n const getContent = () => {\n if (sources) {\n return getSourceContent(sources);\n }\n if (childrenRef.current) {\n return extractTextContent(childrenRef.current);\n }\n };\n\n // Call the controller on every render. The controller will deduplicate the\n // message against the previous announcement internally.\n useEffect(() => {\n liveRegionControllerRef.current?.announce({ message: getContent(), delay });\n });\n\n useImperativeHandle(ref, () => ({\n reannounce() {\n liveRegionControllerRef.current?.announce({ message: getContent(), delay, forceReannounce: true });\n },\n }));\n\n return (\n <TagName\n ref={mergedRef}\n {...baseProps}\n className={clsx(styles.root, testUtilStyles.root, className)}\n hidden={hidden}\n >\n {children}\n </TagName>\n );\n});\n\nfunction extractTextContent(node: HTMLElement): string {\n // We use the text content of the node as the announcement text.\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.\n return (node.textContent || '').replace(/\\s+/g, ' ').trim();\n}\n\nfunction getSourceContent(source: ReadonlyArray<string | React.RefObject<HTMLElement> | undefined>): string {\n return source\n .map(item => {\n if (!item || typeof item === 'string') {\n return item;\n }\n if (item.current) {\n return extractTextContent(item.current);\n }\n })\n .filter(Boolean)\n .join(' ');\n}\n"]}
@@ -0,0 +1,7 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "root": "awsui_root_1iee7_di2un_141",
5
+ "announcer": "awsui_announcer_1iee7_di2un_149"
6
+ };
7
+
@@ -138,15 +138,15 @@
138
138
  */
139
139
  /* Style used for links in slots/components that are text heavy, to help links stand out among
140
140
  surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
141
- .awsui_root_3bgfn_di2un_141:not(#\9) {
141
+ .awsui_root_1iee7_di2un_141:not(#\9) {
142
142
  display: contents;
143
143
  }
144
144
 
145
- .awsui_root_3bgfn_di2un_141[hidden]:not(#\9) {
145
+ .awsui_root_1iee7_di2un_141[hidden]:not(#\9) {
146
146
  display: none;
147
147
  }
148
148
 
149
- .awsui_announcer_3bgfn_di2un_149:not(#\9) {
149
+ .awsui_announcer_1iee7_di2un_149:not(#\9) {
150
150
  position: absolute !important;
151
151
  inset-block-start: -9999px !important;
152
152
  inset-inline-start: -9999px !important;
@@ -2,7 +2,7 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_3bgfn_di2un_141",
6
- "announcer": "awsui_announcer_3bgfn_di2un_149"
5
+ "root": "awsui_root_1iee7_di2un_141",
6
+ "announcer": "awsui_announcer_1iee7_di2un_149"
7
7
  };
8
8
 
@@ -0,0 +1,7 @@
1
+
2
+ import './styles.scoped.css';
3
+ export default {
4
+ "root": "awsui_root_1pc7b_1k8pp_5",
5
+ "announcer": "awsui_announcer_1pc7b_1k8pp_9"
6
+ };
7
+
@@ -0,0 +1,11 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+ .awsui_root_1pc7b_1k8pp_5:not(#\9) {
6
+ /* used in test-utils or tests */
7
+ }
8
+
9
+ .awsui_announcer_1pc7b_1k8pp_9:not(#\9) {
10
+ /* used in test-utils or tests */
11
+ }
@@ -0,0 +1,8 @@
1
+
2
+ // es-module interop with Babel and Typescript
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ module.exports.default = {
5
+ "root": "awsui_root_1pc7b_1k8pp_5",
6
+ "announcer": "awsui_announcer_1pc7b_1k8pp_9"
7
+ };
8
+
package/package.json CHANGED
@@ -53,6 +53,7 @@
53
53
  "./key-value-pairs": "./key-value-pairs/index.js",
54
54
  "./line-chart": "./line-chart/index.js",
55
55
  "./link": "./link/index.js",
56
+ "./live-region": "./live-region/index.js",
56
57
  "./mixed-line-bar-chart": "./mixed-line-bar-chart/index.js",
57
58
  "./modal": "./modal/index.js",
58
59
  "./multiselect": "./multiselect/index.js",
@@ -127,7 +128,7 @@
127
128
  "./internal/base-component/index.js",
128
129
  "./internal/base-component/styles.css.js"
129
130
  ],
130
- "version": "3.0.801",
131
+ "version": "3.0.802",
131
132
  "repository": {
132
133
  "type": "git",
133
134
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1 +1 @@
1
- {"version":3,"file":"pie-chart.d.ts","sourceRoot":"","sources":["../../../src/pie-chart/pie-chart.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAEjF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAgBvC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAOzD,MAAM,WAAW,kBAAkB,CAAC,CAAC;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CACpB;AAED,UAAU,qBAAqB,CAAC,CAAC,SAAS,aAAa,CAAC,KAAK,CAC3D,SAAQ,YAAY,CAClB,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,mBAAmB,GAAG,YAAY,CAAC,EAC1D,SAAS,GAAG,MAAM,GAAG,aAAa,GAAG,YAAY,GAAG,kBAAkB,CACvE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IAEf,kBAAkB,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7B,iBAAiB,EAAE,CAAC,OAAO,EAAE,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC;IAE/C,aAAa,EAAE,CAAC,GAAG,IA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AC,CAAC,EAAE,CAAC;IAC9C,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC;IACT,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,EAAE,UAAU,CAAC;CACpB;;AAED,wBAuVE"}
@@ -10,12 +10,12 @@ import ChartPopover from '../internal/components/chart-popover';
10
10
  import ChartPopoverFooter from '../internal/components/chart-popover-footer';
11
11
  import SeriesDetails from '../internal/components/chart-series-details';
12
12
  import SeriesMarker from '../internal/components/chart-series-marker';
13
- import InternalLiveRegion from '../internal/components/live-region/internal';
14
13
  import { useHeightMeasure } from '../internal/hooks/container-queries/use-height-measure';
15
14
  import { useUniqueId } from '../internal/hooks/use-unique-id';
16
15
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
17
16
  import { KeyCode } from '../internal/keycode';
18
17
  import { nodeBelongs } from '../internal/utils/node-belongs';
18
+ import InternalLiveRegion from '../live-region/internal';
19
19
  import Labels from './labels';
20
20
  import Segments from './segments';
21
21
  import { defaultDetails, getDimensionsBySize } from './utils';