@cloudscape-design/components 3.0.161 → 3.0.163

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 (150) hide show
  1. package/app-layout/visual-refresh/styles.css.js +60 -60
  2. package/app-layout/visual-refresh/styles.scoped.css +147 -147
  3. package/app-layout/visual-refresh/styles.selectors.js +60 -60
  4. package/button/internal.d.ts +1 -0
  5. package/button/internal.d.ts.map +1 -1
  6. package/button/internal.js +2 -2
  7. package/button/internal.js.map +1 -1
  8. package/code-editor/index.d.ts.map +1 -1
  9. package/code-editor/index.js +5 -8
  10. package/code-editor/index.js.map +1 -1
  11. package/code-editor/pane.d.ts.map +1 -1
  12. package/code-editor/pane.js +4 -4
  13. package/code-editor/pane.js.map +1 -1
  14. package/code-editor/resizable-box/index.d.ts +9 -0
  15. package/code-editor/resizable-box/index.d.ts.map +1 -0
  16. package/code-editor/resizable-box/index.js +44 -0
  17. package/code-editor/resizable-box/index.js.map +1 -0
  18. package/code-editor/resizable-box/styles.css.js +8 -0
  19. package/code-editor/resizable-box/styles.scoped.css +50 -0
  20. package/code-editor/resizable-box/styles.selectors.js +9 -0
  21. package/code-editor/styles.css.js +32 -33
  22. package/code-editor/styles.scoped.css +109 -139
  23. package/code-editor/styles.selectors.js +32 -33
  24. package/flashbar/styles.css.js +33 -33
  25. package/flashbar/styles.scoped.css +115 -115
  26. package/flashbar/styles.selectors.js +33 -33
  27. package/form-field/interfaces.d.ts +10 -0
  28. package/form-field/interfaces.d.ts.map +1 -1
  29. package/form-field/interfaces.js.map +1 -1
  30. package/form-field/internal.d.ts +1 -1
  31. package/form-field/internal.d.ts.map +1 -1
  32. package/form-field/internal.js +5 -4
  33. package/form-field/internal.js.map +1 -1
  34. package/input/internal.d.ts.map +1 -1
  35. package/input/internal.js +16 -4
  36. package/input/internal.js.map +1 -1
  37. package/internal/components/live-region/index.d.ts +1 -1
  38. package/internal/components/live-region/index.d.ts.map +1 -1
  39. package/internal/components/live-region/index.js +29 -6
  40. package/internal/components/live-region/index.js.map +1 -1
  41. package/internal/context/form-field-context.d.ts +6 -2
  42. package/internal/context/form-field-context.d.ts.map +1 -1
  43. package/internal/context/form-field-context.js +7 -1
  44. package/internal/context/form-field-context.js.map +1 -1
  45. package/internal/environment.js +1 -1
  46. package/internal/hooks/use-telemetry/index.d.ts.map +1 -1
  47. package/internal/hooks/use-telemetry/index.js +4 -0
  48. package/internal/hooks/use-telemetry/index.js.map +1 -1
  49. package/internal/manifest.json +1 -1
  50. package/internal/metrics.d.ts +2 -2
  51. package/internal/metrics.d.ts.map +1 -1
  52. package/internal/metrics.js +20 -17
  53. package/internal/metrics.js.map +1 -1
  54. package/internal/types.d.ts +9 -0
  55. package/internal/types.d.ts.map +1 -1
  56. package/internal/types.js +0 -2
  57. package/internal/types.js.map +1 -1
  58. package/internal/vendor/d3-scale.js +8 -8
  59. package/mixed-line-bar-chart/styles.css.js +19 -19
  60. package/mixed-line-bar-chart/styles.scoped.css +26 -26
  61. package/mixed-line-bar-chart/styles.selectors.js +19 -19
  62. package/package.json +30 -34
  63. package/progress-bar/index.d.ts.map +1 -1
  64. package/progress-bar/index.js +14 -3
  65. package/progress-bar/index.js.map +1 -1
  66. package/select/parts/styles.css.js +9 -9
  67. package/select/parts/styles.scoped.css +27 -9
  68. package/select/parts/styles.selectors.js +9 -9
  69. package/side-navigation/internal.d.ts.map +1 -1
  70. package/side-navigation/internal.js +2 -2
  71. package/side-navigation/internal.js.map +1 -1
  72. package/table/body-cell/click-away.d.ts +9 -0
  73. package/table/body-cell/click-away.d.ts.map +1 -0
  74. package/table/body-cell/click-away.js +38 -0
  75. package/table/body-cell/click-away.js.map +1 -0
  76. package/table/body-cell/index.d.ts +10 -19
  77. package/table/body-cell/index.d.ts.map +1 -1
  78. package/table/body-cell/index.js +49 -9
  79. package/table/body-cell/index.js.map +1 -1
  80. package/table/body-cell/inline-editor.d.ts +12 -0
  81. package/table/body-cell/inline-editor.d.ts.map +1 -0
  82. package/table/body-cell/inline-editor.js +88 -0
  83. package/table/body-cell/inline-editor.js.map +1 -0
  84. package/table/body-cell/styles.css.js +18 -12
  85. package/table/body-cell/styles.scoped.css +229 -46
  86. package/table/body-cell/styles.selectors.js +18 -12
  87. package/table/body-cell/td-element.d.ts +21 -0
  88. package/table/body-cell/td-element.d.ts.map +1 -0
  89. package/table/body-cell/td-element.js +11 -0
  90. package/table/body-cell/td-element.js.map +1 -0
  91. package/table/body-cell/use-stable-scroll-position.d.ts +17 -0
  92. package/table/body-cell/use-stable-scroll-position.d.ts.map +1 -0
  93. package/table/body-cell/use-stable-scroll-position.js +48 -0
  94. package/table/body-cell/use-stable-scroll-position.js.map +1 -0
  95. package/table/header-cell/index.d.ts +8 -7
  96. package/table/header-cell/index.d.ts.map +1 -1
  97. package/table/header-cell/index.js +6 -2
  98. package/table/header-cell/index.js.map +1 -1
  99. package/table/header-cell/styles.css.js +19 -18
  100. package/table/header-cell/styles.scoped.css +40 -35
  101. package/table/header-cell/styles.selectors.js +19 -18
  102. package/table/interfaces.d.ts +73 -6
  103. package/table/interfaces.d.ts.map +1 -1
  104. package/table/interfaces.js.map +1 -1
  105. package/table/internal.d.ts.map +1 -1
  106. package/table/internal.js +68 -18
  107. package/table/internal.js.map +1 -1
  108. package/table/thead.d.ts.map +1 -1
  109. package/table/thead.js +1 -1
  110. package/table/thead.js.map +1 -1
  111. package/table/use-table-focus-navigation.d.ts +16 -0
  112. package/table/use-table-focus-navigation.d.ts.map +1 -0
  113. package/table/use-table-focus-navigation.js +131 -0
  114. package/table/use-table-focus-navigation.js.map +1 -0
  115. package/tabs/index.d.ts +1 -1
  116. package/tabs/index.d.ts.map +1 -1
  117. package/tabs/index.js +2 -2
  118. package/tabs/index.js.map +1 -1
  119. package/tabs/interfaces.d.ts +14 -0
  120. package/tabs/interfaces.d.ts.map +1 -1
  121. package/tabs/interfaces.js.map +1 -1
  122. package/tabs/tab-header-bar.d.ts +2 -1
  123. package/tabs/tab-header-bar.d.ts.map +1 -1
  124. package/tabs/tab-header-bar.js +3 -7
  125. package/tabs/tab-header-bar.js.map +1 -1
  126. package/test-utils/dom/table/index.d.ts +4 -0
  127. package/test-utils/dom/table/index.js +21 -5
  128. package/test-utils/dom/table/index.js.map +1 -1
  129. package/test-utils/selectors/table/index.d.ts +4 -0
  130. package/test-utils/selectors/table/index.js +21 -5
  131. package/test-utils/selectors/table/index.js.map +1 -1
  132. package/test-utils/tsconfig.tsbuildinfo +1 -1
  133. package/wizard/internal/analytics.js +3 -3
  134. package/wizard/internal/analytics.js.map +1 -1
  135. package/code-editor/resize-handler.d.ts +0 -3
  136. package/code-editor/resize-handler.d.ts.map +0 -1
  137. package/code-editor/resize-handler.js +0 -7
  138. package/code-editor/resize-handler.js.map +0 -1
  139. package/internal/components/dynamic-aria-live/index.d.ts +0 -28
  140. package/internal/components/dynamic-aria-live/index.d.ts.map +0 -1
  141. package/internal/components/dynamic-aria-live/index.js +0 -38
  142. package/internal/components/dynamic-aria-live/index.js.map +0 -1
  143. package/internal/components/live-region/aria-liva-tag.d.ts +0 -13
  144. package/internal/components/live-region/aria-liva-tag.d.ts.map +0 -1
  145. package/internal/components/live-region/aria-liva-tag.js +0 -18
  146. package/internal/components/live-region/aria-liva-tag.js.map +0 -1
  147. package/internal/components/live-region/utils.d.ts +0 -8
  148. package/internal/components/live-region/utils.d.ts.map +0 -1
  149. package/internal/components/live-region/utils.js +0 -24
  150. package/internal/components/live-region/utils.js.map +0 -1
@@ -1,8 +1,15 @@
1
1
  import { __assign } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import { THEME, PACKAGE_VERSION } from './environment';
4
+ import { PACKAGE_VERSION } from './environment';
5
5
  var oneTimeMetrics = {};
6
+ // In case we need to override the theme for VR
7
+ var theme = '';
8
+ function setTheme(newTheme) {
9
+ theme = newTheme;
10
+ }
11
+ // react is the only framework we're using
12
+ var framework = 'react';
6
13
  var buildMetricHash = function (_a) {
7
14
  var source = _a.source, action = _a.action;
8
15
  return ["src".concat(source), "action".concat(action)].join('_');
@@ -23,7 +30,7 @@ var buildMetricDetail = function (_a) {
23
30
  var detailObject = {
24
31
  o: metricOrigin,
25
32
  s: source,
26
- t: THEME,
33
+ t: theme,
27
34
  a: action,
28
35
  f: framework,
29
36
  v: formatMajorVersionForMetricDetail(version)
@@ -32,7 +39,7 @@ var buildMetricDetail = function (_a) {
32
39
  };
33
40
  var buildMetricName = function (_a) {
34
41
  var source = _a.source, version = _a.version;
35
- return ['awsui', source, "".concat(formatVersionForMetricName(THEME, version))].join('_');
42
+ return ['awsui', source, "".concat(formatVersionForMetricName(theme, version))].join('_');
36
43
  };
37
44
  var findPanorama = function (currentWindow) {
38
45
  try {
@@ -66,20 +73,20 @@ var findAWSC = function (currentWindow) {
66
73
  return undefined;
67
74
  }
68
75
  };
69
- // react is the default framework we're logging, for angular we need to set it explicitly
70
- var framework = 'react';
71
- function setFramework(fwk) {
72
- framework = fwk;
73
- }
74
76
  export var Metrics = {
75
- initMetrics: function (fwk) {
76
- setFramework(fwk);
77
+ initMetrics: function (theme) {
78
+ setTheme(theme);
77
79
  },
78
80
  /**
79
81
  * Calls Console Platform's client logging JS API with provided metric name, value, and detail.
80
82
  * Does nothing if Console Platform client logging JS is not present in page.
81
83
  */
82
84
  sendMetric: function (metricName, value, detail) {
85
+ if (!theme) {
86
+ // Metrics need to be initialized first (initMetrics)
87
+ console.error('Metrics need to be initalized first.');
88
+ return;
89
+ }
83
90
  if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {
84
91
  console.error("Invalid metric name: ".concat(metricName));
85
92
  return;
@@ -97,16 +104,12 @@ export var Metrics = {
97
104
  * Calls Console Platform's client v2 logging JS API with provided metric name and detail.
98
105
  * Does nothing if Console Platform client logging JS is not present in page.
99
106
  */
100
- sendPanoramaMetric: function (metricName, metric) {
101
- if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {
102
- console.error("Invalid metric name: ".concat(metricName));
103
- return;
104
- }
107
+ sendPanoramaMetric: function (metric) {
105
108
  if (typeof metric.eventDetail === 'object') {
106
109
  metric.eventDetail = JSON.stringify(metric.eventDetail);
107
110
  }
108
111
  if (metric.eventDetail && metric.eventDetail.length > 200) {
109
- console.error("Detail for metric ".concat(metricName, " is too long: ").concat(metric.eventDetail));
112
+ console.error("Detail for metric is too long: ".concat(metric.eventDetail));
110
113
  return;
111
114
  }
112
115
  if (typeof metric.eventValue === 'object') {
@@ -114,7 +117,7 @@ export var Metrics = {
114
117
  }
115
118
  var panorama = findPanorama(window);
116
119
  if (typeof panorama === 'function') {
117
- panorama(metricName, __assign(__assign({}, metric), { timestamp: Date.now() }));
120
+ panorama('trackCustomEvent', __assign(__assign({}, metric), { timestamp: Date.now() }));
118
121
  }
119
122
  },
120
123
  sendMetricObject: function (metric, value) {
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0BvD,IAAM,cAAc,GAA4B,EAAE,CAAC;AAEnD,IAAM,eAAe,GAAG,UAAC,EAAkC;QAAhC,MAAM,YAAA,EAAE,MAAM,YAAA;IACvC,OAAO,CAAC,aAAM,MAAM,CAAE,EAAE,gBAAS,MAAM,CAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,IAAM,eAAe,GAAG,UAAC,aAAqB;IAC5C,IAAM,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC7D,OAAO,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC,CAAC;AAEF,IAAM,iCAAiC,GAAG,UAAC,OAAe;I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C7B;IACH,CAAC;IACD,iCAAiC,mCAAA;IACjC,0BAA0B,4BAAA;CAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { THEME, PACKAGE_VERSION } from './environment';\n\nexport interface MetricsLogItem {\n source: string;\n action: string;\n version: string;\n}\n\nexport interface MetricsV2EventItem {\n eventType?: string;\n eventContext?: string;\n eventDetail?: string | Record<string, string | number | boolean>;\n eventValue?: string | Record<string, string | number | boolean>;\n}\n\ninterface AWSC {\n Clog: any;\n}\n\ninterface MetricsWindow extends Window {\n AWSC?: AWSC;\n panorama?: any;\n}\n\ndeclare const AWSUI_METRIC_ORIGIN: string | undefined;\n\nconst oneTimeMetrics: Record<string, boolean> = {};\n\nconst buildMetricHash = ({ source, action }: MetricsLogItem): string => {\n return [`src${source}`, `action${action}`].join('_');\n};\n\nconst getMajorVersion = (versionString: string): string => {\n const majorVersionMatch = versionString.match(/^(\\d+\\.\\d+)/);\n return majorVersionMatch ? majorVersionMatch[1] : '';\n};\n\nconst formatMajorVersionForMetricDetail = (version: string) => {\n return version.replace(/\\s/g, '');\n};\n\nconst formatVersionForMetricName = (theme: string, version: string) => {\n return `${theme.charAt(0)}${getMajorVersion(version).replace('.', '')}`;\n};\n\nconst buildMetricDetail = ({ source, action, version }: MetricsLogItem): string => {\n const metricOrigin = typeof AWSUI_METRIC_ORIGIN !== 'undefined' ? AWSUI_METRIC_ORIGIN : 'main';\n const detailObject = {\n o: metricOrigin,\n s: source,\n t: THEME,\n a: action,\n f: framework,\n v: formatMajorVersionForMetricDetail(version),\n };\n return JSON.stringify(detailObject);\n};\n\nconst buildMetricName = ({ source, version }: MetricsLogItem): string => {\n return ['awsui', source, `${formatVersionForMetricName(THEME, version)}`].join('_');\n};\n\nconst findPanorama = (currentWindow?: MetricsWindow): any | undefined => {\n try {\n if (typeof currentWindow?.panorama === 'function') {\n return currentWindow?.panorama;\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findPanorama(currentWindow.parent);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n};\n\nconst findAWSC = (currentWindow?: MetricsWindow): AWSC | undefined => {\n try {\n if (typeof currentWindow?.AWSC === 'object') {\n return currentWindow?.AWSC;\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findAWSC(currentWindow.parent);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n};\n\n// react is the default framework we're logging, for angular we need to set it explicitly\nlet framework = 'react';\nfunction setFramework(fwk: string) {\n framework = fwk;\n}\n\nexport const Metrics = {\n initMetrics(fwk: string) {\n setFramework(fwk);\n },\n\n /**\n * Calls Console Platform's client logging JS API with provided metric name, value, and detail.\n * Does nothing if Console Platform client logging JS is not present in page.\n */\n sendMetric(metricName: string, value: number, detail?: string): void {\n if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {\n console.error(`Invalid metric name: ${metricName}`);\n return;\n }\n if (detail && detail.length > 200) {\n console.error(`Detail for metric ${metricName} is too long: ${detail}`);\n return;\n }\n const AWSC = findAWSC(window);\n if (typeof AWSC === 'object' && typeof AWSC.Clog === 'object' && typeof AWSC.Clog.log === 'function') {\n AWSC.Clog.log(metricName, value, detail);\n }\n },\n\n /**\n * Calls Console Platform's client v2 logging JS API with provided metric name and detail.\n * Does nothing if Console Platform client logging JS is not present in page.\n */\n sendPanoramaMetric(metricName: string, metric: MetricsV2EventItem): void {\n if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {\n console.error(`Invalid metric name: ${metricName}`);\n return;\n }\n if (typeof metric.eventDetail === 'object') {\n metric.eventDetail = JSON.stringify(metric.eventDetail);\n }\n if (metric.eventDetail && metric.eventDetail.length > 200) {\n console.error(`Detail for metric ${metricName} is too long: ${metric.eventDetail}`);\n return;\n }\n if (typeof metric.eventValue === 'object') {\n metric.eventValue = JSON.stringify(metric.eventValue);\n }\n const panorama = findPanorama(window);\n if (typeof panorama === 'function') {\n panorama(metricName, {\n ...metric,\n timestamp: Date.now(),\n });\n }\n },\n\n sendMetricObject(metric: MetricsLogItem, value: number): void {\n this.sendMetric(buildMetricName(metric), value, buildMetricDetail(metric));\n },\n\n sendMetricObjectOnce(metric: MetricsLogItem, value: number): void {\n const metricHash = buildMetricHash(metric);\n if (!oneTimeMetrics[metricHash]) {\n this.sendMetricObject(metric, value);\n oneTimeMetrics[metricHash] = true;\n }\n },\n\n /*\n * Calls Console Platform's client logging only the first time the provided metricName is used.\n * Subsequent calls with the same metricName are ignored.\n */\n sendMetricOnce(metricName: string, value: number, detail?: string): void {\n if (!oneTimeMetrics[metricName]) {\n this.sendMetric(metricName, value, detail);\n oneTimeMetrics[metricName] = true;\n }\n },\n\n /*\n * Reports a metric value 1 to Console Platform's client logging service to indicate that the\n * component was loaded. The component load event will only be reported as used to client logging\n * service once per page view.\n */\n logComponentLoaded() {\n this.sendMetricObjectOnce(\n {\n source: 'components',\n action: 'loaded',\n version: PACKAGE_VERSION,\n },\n 1\n );\n },\n\n /*\n * Reports a metric value 1 to Console Platform's client logging service to indicate that the\n * component was used in the page. A component will only be reported as used to client logging\n * service once per page view.\n */\n logComponentUsed(componentName: string) {\n this.sendMetricObjectOnce(\n {\n source: componentName,\n action: 'used',\n version: PACKAGE_VERSION,\n },\n 1\n );\n },\n};\n\nexport const MetricsTestHelper = {\n resetOneTimeMetricsCache: () => {\n for (const prop in oneTimeMetrics) {\n delete oneTimeMetrics[prop];\n }\n },\n formatMajorVersionForMetricDetail,\n formatVersionForMetricName,\n};\n"]}
1
+ {"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0BhD,IAAM,cAAc,GAA4B,EAAE,C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AM,EAAE,YAAY;YACpB,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE,eAAe;SACzB,EACD,CAAC,CACF,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,gBAAgB,YAAC,aAAqB;QACpC,IAAI,CAAC,oBAAoB,CACvB;YACE,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,eAAe;SACzB,EACD,CAAC,CACF,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,IAAM,iBAAiB,GAAG;IAC/B,wBAAwB,EAAE;QACxB,KAAK,IAAM,IAAI,IAAI,cAAc,EAAE;YACjC,OAAO,cAAc,CAAC,IAAI,CAAC,CAAC;SAC7B;IACH,CAAC;IACD,iCAAiC,mCAAA;IACjC,0BAA0B,4BAAA;CAC3B,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { PACKAGE_VERSION } from './environment';\n\nexport interface MetricsLogItem {\n source: string;\n action: string;\n version: string;\n}\n\nexport interface MetricsV2EventItem {\n eventType?: string;\n eventContext?: string;\n eventDetail?: string | Record<string, string | number | boolean>;\n eventValue?: string | Record<string, string | number | boolean>;\n}\n\ninterface AWSC {\n Clog: any;\n}\n\ninterface MetricsWindow extends Window {\n AWSC?: AWSC;\n panorama?: any;\n}\n\ndeclare const AWSUI_METRIC_ORIGIN: string | undefined;\n\nconst oneTimeMetrics: Record<string, boolean> = {};\n\n// In case we need to override the theme for VR\nlet theme = '';\nfunction setTheme(newTheme: string) {\n theme = newTheme;\n}\n\n// react is the only framework we're using\nconst framework = 'react';\n\nconst buildMetricHash = ({ source, action }: MetricsLogItem): string => {\n return [`src${source}`, `action${action}`].join('_');\n};\n\nconst getMajorVersion = (versionString: string): string => {\n const majorVersionMatch = versionString.match(/^(\\d+\\.\\d+)/);\n return majorVersionMatch ? majorVersionMatch[1] : '';\n};\n\nconst formatMajorVersionForMetricDetail = (version: string) => {\n return version.replace(/\\s/g, '');\n};\n\nconst formatVersionForMetricName = (theme: string, version: string) => {\n return `${theme.charAt(0)}${getMajorVersion(version).replace('.', '')}`;\n};\n\nconst buildMetricDetail = ({ source, action, version }: MetricsLogItem): string => {\n const metricOrigin = typeof AWSUI_METRIC_ORIGIN !== 'undefined' ? AWSUI_METRIC_ORIGIN : 'main';\n const detailObject = {\n o: metricOrigin,\n s: source,\n t: theme,\n a: action,\n f: framework,\n v: formatMajorVersionForMetricDetail(version),\n };\n return JSON.stringify(detailObject);\n};\n\nconst buildMetricName = ({ source, version }: MetricsLogItem): string => {\n return ['awsui', source, `${formatVersionForMetricName(theme, version)}`].join('_');\n};\n\nconst findPanorama = (currentWindow?: MetricsWindow): any | undefined => {\n try {\n if (typeof currentWindow?.panorama === 'function') {\n return currentWindow?.panorama;\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findPanorama(currentWindow.parent);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n};\n\nconst findAWSC = (currentWindow?: MetricsWindow): AWSC | undefined => {\n try {\n if (typeof currentWindow?.AWSC === 'object') {\n return currentWindow?.AWSC;\n }\n\n if (!currentWindow || currentWindow.parent === currentWindow) {\n // When the window has no more parents, it references itself\n return undefined;\n }\n\n return findAWSC(currentWindow.parent);\n } catch (ex) {\n // Most likely a cross-origin access error\n return undefined;\n }\n};\n\nexport const Metrics = {\n initMetrics(theme: string) {\n setTheme(theme);\n },\n\n /**\n * Calls Console Platform's client logging JS API with provided metric name, value, and detail.\n * Does nothing if Console Platform client logging JS is not present in page.\n */\n sendMetric(metricName: string, value: number, detail?: string): void {\n if (!theme) {\n // Metrics need to be initialized first (initMetrics)\n console.error('Metrics need to be initalized first.');\n return;\n }\n\n if (!metricName || !/^[a-zA-Z0-9_-]{1,32}$/.test(metricName)) {\n console.error(`Invalid metric name: ${metricName}`);\n return;\n }\n if (detail && detail.length > 200) {\n console.error(`Detail for metric ${metricName} is too long: ${detail}`);\n return;\n }\n const AWSC = findAWSC(window);\n if (typeof AWSC === 'object' && typeof AWSC.Clog === 'object' && typeof AWSC.Clog.log === 'function') {\n AWSC.Clog.log(metricName, value, detail);\n }\n },\n\n /**\n * Calls Console Platform's client v2 logging JS API with provided metric name and detail.\n * Does nothing if Console Platform client logging JS is not present in page.\n */\n sendPanoramaMetric(metric: MetricsV2EventItem): void {\n if (typeof metric.eventDetail === 'object') {\n metric.eventDetail = JSON.stringify(metric.eventDetail);\n }\n if (metric.eventDetail && metric.eventDetail.length > 200) {\n console.error(`Detail for metric is too long: ${metric.eventDetail}`);\n return;\n }\n if (typeof metric.eventValue === 'object') {\n metric.eventValue = JSON.stringify(metric.eventValue);\n }\n const panorama = findPanorama(window);\n if (typeof panorama === 'function') {\n panorama('trackCustomEvent', {\n ...metric,\n timestamp: Date.now(),\n });\n }\n },\n\n sendMetricObject(metric: MetricsLogItem, value: number): void {\n this.sendMetric(buildMetricName(metric), value, buildMetricDetail(metric));\n },\n\n sendMetricObjectOnce(metric: MetricsLogItem, value: number): void {\n const metricHash = buildMetricHash(metric);\n if (!oneTimeMetrics[metricHash]) {\n this.sendMetricObject(metric, value);\n oneTimeMetrics[metricHash] = true;\n }\n },\n\n /*\n * Calls Console Platform's client logging only the first time the provided metricName is used.\n * Subsequent calls with the same metricName are ignored.\n */\n sendMetricOnce(metricName: string, value: number, detail?: string): void {\n if (!oneTimeMetrics[metricName]) {\n this.sendMetric(metricName, value, detail);\n oneTimeMetrics[metricName] = true;\n }\n },\n\n /*\n * Reports a metric value 1 to Console Platform's client logging service to indicate that the\n * component was loaded. The component load event will only be reported as used to client logging\n * service once per page view.\n */\n logComponentLoaded() {\n this.sendMetricObjectOnce(\n {\n source: 'components',\n action: 'loaded',\n version: PACKAGE_VERSION,\n },\n 1\n );\n },\n\n /*\n * Reports a metric value 1 to Console Platform's client logging service to indicate that the\n * component was used in the page. A component will only be reported as used to client logging\n * service once per page view.\n */\n logComponentUsed(componentName: string) {\n this.sendMetricObjectOnce(\n {\n source: componentName,\n action: 'used',\n version: PACKAGE_VERSION,\n },\n 1\n );\n },\n};\n\nexport const MetricsTestHelper = {\n resetOneTimeMetricsCache: () => {\n for (const prop in oneTimeMetrics) {\n delete oneTimeMetrics[prop];\n }\n },\n formatMajorVersionForMetricDetail,\n formatVersionForMetricName,\n};\n"]}
@@ -14,4 +14,13 @@
14
14
  export type SomeRequired<Type, Keys extends keyof Type> = Type & {
15
15
  [Key in Keys]-?: Type[Key];
16
16
  };
17
+ /**
18
+ * Utility type that makes a union of given type and undefined.
19
+ * @example
20
+ * ```
21
+ * type OptionalString = Optional<string>
22
+ * type OptionalStringOrNumber = Optional<string | number>
23
+ * ```
24
+ */
25
+ export type Optional<Type> = Type | undefined;
17
26
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,IAAI,GAAG;KAC9D,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;CAC3B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,EAAE,IAAI,SAAS,MAAM,IAAI,IAAI,IAAI,GAAG;KAC9D,GAAG,IAAI,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;CAC3B,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,QAAQ,CAAC,IAAI,IAAI,IAAI,GAAG,SAAS,CAAC"}
package/internal/types.js CHANGED
@@ -1,4 +1,2 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
1
  export {};
4
2
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/internal/types.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\n/**\n * Makes specified properties required.\n *\n * @example\n * ```\n * import { AlertProps } from '~components/alert/interfaces'\n *\n * type InternalAlertProps = SomeRequired<AlertProps, 'type'>\n *\n * function Alert(props: AlertProps) { ... }\n * function InternalAlert(props: InternalAlertProps) { ... }\n * ```\n */\nexport type SomeRequired<Type, Keys extends keyof Type> = Type & {\n [Key in Keys]-?: Type[Key];\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/internal/types.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Makes specified properties required.\n *\n * @example\n * ```\n * import { AlertProps } from '~components/alert/interfaces'\n *\n * type InternalAlertProps = SomeRequired<AlertProps, 'type'>\n *\n * function Alert(props: AlertProps) { ... }\n * function InternalAlert(props: InternalAlertProps) { ... }\n * ```\n */\nexport type SomeRequired<Type, Keys extends keyof Type> = Type & {\n [Key in Keys]-?: Type[Key];\n};\n\n/**\n * Utility type that makes a union of given type and undefined.\n * @example\n * ```\n * type OptionalString = Optional<string>\n * type OptionalStringOrNumber = Optional<string | number>\n * ```\n */\nexport type Optional<Type> = Type | undefined;\n"]}
@@ -4,7 +4,7 @@
4
4
  * License: ISC
5
5
  * Private: false
6
6
  * Description: Array manipulation, ordering, searching, summarizing, etc.
7
- * Repository: git+https://github.com/d3/d3-array.git
7
+ * Repository: https://github.com/d3/d3-array.git
8
8
  * Homepage: https://d3js.org/d3-array/
9
9
  * Author: Mike Bostock (http://bost.ocks.org/mike)
10
10
  * License Copyright:
@@ -32,7 +32,7 @@
32
32
  * License: ISC
33
33
  * Private: false
34
34
  * Description: Map and Set with automatic key interning
35
- * Repository: git+https://github.com/mbostock/internmap.git
35
+ * Repository: https://github.com/mbostock/internmap.git
36
36
  * Homepage: https://github.com/mbostock/internmap/
37
37
  * Author: Mike Bostock (https://bost.ocks.org/mike)
38
38
  * License Copyright:
@@ -60,7 +60,7 @@
60
60
  * License: ISC
61
61
  * Private: false
62
62
  * Description: Encodings that map abstract data to visual representation.
63
- * Repository: git+https://github.com/d3/d3-scale.git
63
+ * Repository: https://github.com/d3/d3-scale.git
64
64
  * Homepage: https://d3js.org/d3-scale/
65
65
  * Author: Mike Bostock (https://bost.ocks.org/mike)
66
66
  * License Copyright:
@@ -88,7 +88,7 @@
88
88
  * License: ISC
89
89
  * Private: false
90
90
  * Description: Color spaces! RGB, HSL, Cubehelix, Lab and HCL (Lch).
91
- * Repository: git+https://github.com/d3/d3-color.git
91
+ * Repository: https://github.com/d3/d3-color.git
92
92
  * Homepage: https://d3js.org/d3-color/
93
93
  * Author: Mike Bostock (http://bost.ocks.org/mike)
94
94
  * License Copyright:
@@ -116,7 +116,7 @@
116
116
  * License: ISC
117
117
  * Private: false
118
118
  * Description: Interpolate numbers, colors, strings, arrays, objects, whatever!
119
- * Repository: git+https://github.com/d3/d3-interpolate.git
119
+ * Repository: https://github.com/d3/d3-interpolate.git
120
120
  * Homepage: https://d3js.org/d3-interpolate/
121
121
  * Author: Mike Bostock (http://bost.ocks.org/mike)
122
122
  * License Copyright:
@@ -144,7 +144,7 @@
144
144
  * License: ISC
145
145
  * Private: false
146
146
  * Description: Format numbers for human consumption.
147
- * Repository: git+https://github.com/d3/d3-format.git
147
+ * Repository: https://github.com/d3/d3-format.git
148
148
  * Homepage: https://d3js.org/d3-format/
149
149
  * Author: Mike Bostock (http://bost.ocks.org/mike)
150
150
  * License Copyright:
@@ -172,7 +172,7 @@
172
172
  * License: ISC
173
173
  * Private: false
174
174
  * Description: A calculator for humanity’s peculiar conventions of time.
175
- * Repository: git+https://github.com/d3/d3-time.git
175
+ * Repository: https://github.com/d3/d3-time.git
176
176
  * Homepage: https://d3js.org/d3-time/
177
177
  * Author: Mike Bostock (http://bost.ocks.org/mike)
178
178
  * License Copyright:
@@ -200,7 +200,7 @@
200
200
  * License: ISC
201
201
  * Private: false
202
202
  * Description: A JavaScript time formatter and parser inspired by strftime and strptime.
203
- * Repository: git+https://github.com/d3/d3-time-format.git
203
+ * Repository: https://github.com/d3/d3-time-format.git
204
204
  * Homepage: https://d3js.org/d3-time-format/
205
205
  * Author: Mike Bostock (http://bost.ocks.org/mike)
206
206
  * License Copyright:
@@ -1,24 +1,24 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "series": "awsui_series_1yz9c_13bfe_93",
5
- "series--bar": "awsui_series--bar_1yz9c_13bfe_94",
6
- "series__rect": "awsui_series__rect_1yz9c_13bfe_94",
7
- "exiting": "awsui_exiting_1yz9c_13bfe_111",
8
- "awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1",
9
- "root": "awsui_root_1yz9c_13bfe_137",
10
- "filter-container": "awsui_filter-container_1yz9c_13bfe_150",
11
- "has-default-filter": "awsui_has-default-filter_1yz9c_13bfe_154",
12
- "chart-container": "awsui_chart-container_1yz9c_13bfe_158",
13
- "chart-container__vertical": "awsui_chart-container__vertical_1yz9c_13bfe_164",
14
- "chart-container__horizontal": "awsui_chart-container__horizontal_1yz9c_13bfe_170",
15
- "content": "awsui_content_1yz9c_13bfe_174",
16
- "content--reserve-filter": "awsui_content--reserve-filter_1yz9c_13bfe_181",
17
- "content--reserve-legend": "awsui_content--reserve-legend_1yz9c_13bfe_185",
18
- "series--highlighted": "awsui_series--highlighted_1yz9c_13bfe_198",
19
- "series__bar--highlighted": "awsui_series__bar--highlighted_1yz9c_13bfe_199",
20
- "series--dimmed": "awsui_series--dimmed_1yz9c_13bfe_203",
21
- "series--threshold": "awsui_series--threshold_1yz9c_13bfe_212",
22
- "bar-group": "awsui_bar-group_1yz9c_13bfe_217"
4
+ "series": "awsui_series_1yz9c_1y8is_93",
5
+ "series--bar": "awsui_series--bar_1yz9c_1y8is_94",
6
+ "series__rect": "awsui_series__rect_1yz9c_1y8is_94",
7
+ "exiting": "awsui_exiting_1yz9c_1y8is_111",
8
+ "awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-0_1yz9c_1y8is_1",
9
+ "root": "awsui_root_1yz9c_1y8is_137",
10
+ "filter-container": "awsui_filter-container_1yz9c_1y8is_150",
11
+ "has-default-filter": "awsui_has-default-filter_1yz9c_1y8is_154",
12
+ "chart-container": "awsui_chart-container_1yz9c_1y8is_158",
13
+ "chart-container__vertical": "awsui_chart-container__vertical_1yz9c_1y8is_164",
14
+ "chart-container__horizontal": "awsui_chart-container__horizontal_1yz9c_1y8is_170",
15
+ "content": "awsui_content_1yz9c_1y8is_174",
16
+ "content--reserve-filter": "awsui_content--reserve-filter_1yz9c_1y8is_181",
17
+ "content--reserve-legend": "awsui_content--reserve-legend_1yz9c_1y8is_185",
18
+ "series--highlighted": "awsui_series--highlighted_1yz9c_1y8is_198",
19
+ "series__bar--highlighted": "awsui_series__bar--highlighted_1yz9c_1y8is_199",
20
+ "series--dimmed": "awsui_series--dimmed_1yz9c_1y8is_203",
21
+ "series--threshold": "awsui_series--threshold_1yz9c_1y8is_212",
22
+ "bar-group": "awsui_bar-group_1yz9c_1y8is_217"
23
23
  };
24
24
 
@@ -90,26 +90,26 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
90
90
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
91
  SPDX-License-Identifier: Apache-2.0
92
92
  */
93
- .awsui_series_1yz9c_13bfe_93:not(#\9),
94
- .awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9) {
93
+ .awsui_series_1yz9c_1y8is_93:not(#\9),
94
+ .awsui_series--bar_1yz9c_1y8is_94 > .awsui_series__rect_1yz9c_1y8is_94:not(#\9) {
95
95
  transition: opacity var(--motion-duration-transition-quick-x85tae, 90ms) var(--motion-easing-transition-quick-lukbd8, linear);
96
96
  }
97
97
  @media (prefers-reduced-motion: reduce) {
98
- .awsui_series_1yz9c_13bfe_93:not(#\9),
99
- .awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9) {
98
+ .awsui_series_1yz9c_1y8is_93:not(#\9),
99
+ .awsui_series--bar_1yz9c_1y8is_94 > .awsui_series__rect_1yz9c_1y8is_94:not(#\9) {
100
100
  animation: none;
101
101
  transition: none;
102
102
  }
103
103
  }
104
- .awsui-motion-disabled .awsui_series_1yz9c_13bfe_93:not(#\9), .awsui-mode-entering .awsui_series_1yz9c_13bfe_93:not(#\9), .awsui-motion-disabled .awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9), .awsui-mode-entering .awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9) {
104
+ .awsui-motion-disabled .awsui_series_1yz9c_1y8is_93:not(#\9), .awsui-mode-entering .awsui_series_1yz9c_1y8is_93:not(#\9), .awsui-motion-disabled .awsui_series--bar_1yz9c_1y8is_94 > .awsui_series__rect_1yz9c_1y8is_94:not(#\9), .awsui-mode-entering .awsui_series--bar_1yz9c_1y8is_94 > .awsui_series__rect_1yz9c_1y8is_94:not(#\9) {
105
105
  animation: none;
106
106
  transition: none;
107
107
  }
108
108
 
109
- .awsui_exiting_1yz9c_13bfe_111:not(#\9) {
110
- animation: awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1 var(--motion-duration-refresh-only-fast-addxjd, 115ms) var(--motion-easing-refresh-only-b-nspng9, cubic-bezier(1, 0, 0.83, 1));
109
+ .awsui_exiting_1yz9c_1y8is_111:not(#\9) {
110
+ animation: awsui_awsui-motion-fade-out-0_1yz9c_1y8is_1 var(--motion-duration-refresh-only-fast-addxjd, 115ms) var(--motion-easing-refresh-only-b-nspng9, cubic-bezier(1, 0, 0.83, 1));
111
111
  }
112
- @keyframes awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1 {
112
+ @keyframes awsui_awsui-motion-fade-out-0_1yz9c_1y8is_1 {
113
113
  from {
114
114
  opacity: 1;
115
115
  }
@@ -118,12 +118,12 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
118
118
  }
119
119
  }
120
120
  @media (prefers-reduced-motion: reduce) {
121
- .awsui_exiting_1yz9c_13bfe_111:not(#\9) {
121
+ .awsui_exiting_1yz9c_1y8is_111:not(#\9) {
122
122
  animation: none;
123
123
  transition: none;
124
124
  }
125
125
  }
126
- .awsui-motion-disabled .awsui_exiting_1yz9c_13bfe_111:not(#\9), .awsui-mode-entering .awsui_exiting_1yz9c_13bfe_111:not(#\9) {
126
+ .awsui-motion-disabled .awsui_exiting_1yz9c_1y8is_111:not(#\9), .awsui-mode-entering .awsui_exiting_1yz9c_1y8is_111:not(#\9) {
127
127
  animation: none;
128
128
  transition: none;
129
129
  }
@@ -132,7 +132,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
132
132
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
133
133
  SPDX-License-Identifier: Apache-2.0
134
134
  */
135
- .awsui_root_1yz9c_13bfe_137:not(#\9) {
135
+ .awsui_root_1yz9c_1y8is_137:not(#\9) {
136
136
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
137
137
  border-collapse: separate;
138
138
  border-spacing: 0;
@@ -171,46 +171,46 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
171
171
  display: block;
172
172
  }
173
173
 
174
- .awsui_filter-container_1yz9c_13bfe_150:not(#\9) {
174
+ .awsui_filter-container_1yz9c_1y8is_150:not(#\9) {
175
175
  /* used in test-utils */
176
176
  }
177
177
 
178
- .awsui_has-default-filter_1yz9c_13bfe_154 > :not(#\9):first-child {
178
+ .awsui_has-default-filter_1yz9c_1y8is_154 > :not(#\9):first-child {
179
179
  flex: 280px 0 1;
180
180
  }
181
181
 
182
- .awsui_chart-container_1yz9c_13bfe_158:not(#\9) {
182
+ .awsui_chart-container_1yz9c_1y8is_158:not(#\9) {
183
183
  display: flex;
184
184
  width: 100%;
185
185
  flex-direction: column;
186
186
  }
187
187
 
188
- .awsui_chart-container__vertical_1yz9c_13bfe_164:not(#\9) {
188
+ .awsui_chart-container__vertical_1yz9c_1y8is_164:not(#\9) {
189
189
  display: flex;
190
190
  flex-direction: column;
191
191
  width: 100%;
192
192
  }
193
193
 
194
- .awsui_chart-container__horizontal_1yz9c_13bfe_170:not(#\9) {
194
+ .awsui_chart-container__horizontal_1yz9c_1y8is_170:not(#\9) {
195
195
  display: flex;
196
196
  }
197
197
 
198
- .awsui_content_1yz9c_13bfe_174:not(#\9) {
198
+ .awsui_content_1yz9c_1y8is_174:not(#\9) {
199
199
  display: flex;
200
200
  position: relative;
201
201
  justify-content: center;
202
202
  align-items: center;
203
203
  }
204
204
 
205
- .awsui_content--reserve-filter_1yz9c_13bfe_181:not(#\9) {
205
+ .awsui_content--reserve-filter_1yz9c_1y8is_181:not(#\9) {
206
206
  margin-top: calc(2 * var(--font-body-m-line-height-i7xxvv, 22px));
207
207
  }
208
208
 
209
- .awsui_content--reserve-legend_1yz9c_13bfe_185:not(#\9) {
209
+ .awsui_content--reserve-legend_1yz9c_1y8is_185:not(#\9) {
210
210
  margin-bottom: calc(2 * var(--font-body-m-line-height-i7xxvv, 22px));
211
211
  }
212
212
 
213
- .awsui_series_1yz9c_13bfe_93:not(#\9) {
213
+ .awsui_series_1yz9c_1y8is_93:not(#\9) {
214
214
  display: block;
215
215
  stroke-width: var(--border-line-chart-width-nj0hc5, 2px);
216
216
  fill: none;
@@ -219,25 +219,25 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
219
219
  pointer-events: none;
220
220
  }
221
221
 
222
- .awsui_series--highlighted_1yz9c_13bfe_198:not(#\9),
223
- .awsui_series__bar--highlighted_1yz9c_13bfe_199:not(#\9) {
222
+ .awsui_series--highlighted_1yz9c_1y8is_198:not(#\9),
223
+ .awsui_series__bar--highlighted_1yz9c_1y8is_199:not(#\9) {
224
224
  /* used in dom query */
225
225
  }
226
226
 
227
- .awsui_series--dimmed_1yz9c_13bfe_203:not(#\9) {
227
+ .awsui_series--dimmed_1yz9c_1y8is_203:not(#\9) {
228
228
  opacity: 0.3;
229
229
  }
230
230
 
231
- .awsui_series--bar_1yz9c_13bfe_94 > .awsui_series__rect_1yz9c_13bfe_94:not(#\9) {
231
+ .awsui_series--bar_1yz9c_1y8is_94 > .awsui_series__rect_1yz9c_1y8is_94:not(#\9) {
232
232
  stroke: var(--color-background-container-content-i8i4a0, #ffffff);
233
233
  stroke-width: 2px;
234
234
  }
235
235
 
236
- .awsui_series--threshold_1yz9c_13bfe_212:not(#\9) {
236
+ .awsui_series--threshold_1yz9c_1y8is_212:not(#\9) {
237
237
  stroke-dasharray: var(--border-line-chart-dash-array-4wa4ab, 3 5);
238
238
  stroke-width: var(--border-line-chart-width-nj0hc5, 2px);
239
239
  }
240
240
 
241
- .awsui_bar-group_1yz9c_13bfe_217:not(#\9) {
241
+ .awsui_bar-group_1yz9c_1y8is_217:not(#\9) {
242
242
  /* used in dom query */
243
243
  }
@@ -2,24 +2,24 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "series": "awsui_series_1yz9c_13bfe_93",
6
- "series--bar": "awsui_series--bar_1yz9c_13bfe_94",
7
- "series__rect": "awsui_series__rect_1yz9c_13bfe_94",
8
- "exiting": "awsui_exiting_1yz9c_13bfe_111",
9
- "awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-0_1yz9c_13bfe_1",
10
- "root": "awsui_root_1yz9c_13bfe_137",
11
- "filter-container": "awsui_filter-container_1yz9c_13bfe_150",
12
- "has-default-filter": "awsui_has-default-filter_1yz9c_13bfe_154",
13
- "chart-container": "awsui_chart-container_1yz9c_13bfe_158",
14
- "chart-container__vertical": "awsui_chart-container__vertical_1yz9c_13bfe_164",
15
- "chart-container__horizontal": "awsui_chart-container__horizontal_1yz9c_13bfe_170",
16
- "content": "awsui_content_1yz9c_13bfe_174",
17
- "content--reserve-filter": "awsui_content--reserve-filter_1yz9c_13bfe_181",
18
- "content--reserve-legend": "awsui_content--reserve-legend_1yz9c_13bfe_185",
19
- "series--highlighted": "awsui_series--highlighted_1yz9c_13bfe_198",
20
- "series__bar--highlighted": "awsui_series__bar--highlighted_1yz9c_13bfe_199",
21
- "series--dimmed": "awsui_series--dimmed_1yz9c_13bfe_203",
22
- "series--threshold": "awsui_series--threshold_1yz9c_13bfe_212",
23
- "bar-group": "awsui_bar-group_1yz9c_13bfe_217"
5
+ "series": "awsui_series_1yz9c_1y8is_93",
6
+ "series--bar": "awsui_series--bar_1yz9c_1y8is_94",
7
+ "series__rect": "awsui_series__rect_1yz9c_1y8is_94",
8
+ "exiting": "awsui_exiting_1yz9c_1y8is_111",
9
+ "awsui-motion-fade-out-0": "awsui_awsui-motion-fade-out-0_1yz9c_1y8is_1",
10
+ "root": "awsui_root_1yz9c_1y8is_137",
11
+ "filter-container": "awsui_filter-container_1yz9c_1y8is_150",
12
+ "has-default-filter": "awsui_has-default-filter_1yz9c_1y8is_154",
13
+ "chart-container": "awsui_chart-container_1yz9c_1y8is_158",
14
+ "chart-container__vertical": "awsui_chart-container__vertical_1yz9c_1y8is_164",
15
+ "chart-container__horizontal": "awsui_chart-container__horizontal_1yz9c_1y8is_170",
16
+ "content": "awsui_content_1yz9c_1y8is_174",
17
+ "content--reserve-filter": "awsui_content--reserve-filter_1yz9c_1y8is_181",
18
+ "content--reserve-legend": "awsui_content--reserve-legend_1yz9c_1y8is_185",
19
+ "series--highlighted": "awsui_series--highlighted_1yz9c_1y8is_198",
20
+ "series__bar--highlighted": "awsui_series__bar--highlighted_1yz9c_1y8is_199",
21
+ "series--dimmed": "awsui_series--dimmed_1yz9c_1y8is_203",
22
+ "series--threshold": "awsui_series--threshold_1yz9c_1y8is_212",
23
+ "bar-group": "awsui_bar-group_1yz9c_1y8is_217"
24
24
  };
25
25
 
package/package.json CHANGED
@@ -1,26 +1,6 @@
1
1
  {
2
- "bugs": {
3
- "url": "https://github.com/cloudscape-design/components/issues"
4
- },
5
- "dependencies": {
6
- "@cloudscape-design/collection-hooks": "^1.0.0",
7
- "@cloudscape-design/test-utils-core": "^1.0.0",
8
- "@cloudscape-design/theming-runtime": "^1.0.0",
9
- "@juggle/resize-observer": "^3.3.1",
10
- "ace-builds": "^1.4.13",
11
- "balanced-match": "^1.0.2",
12
- "clsx": "^1.1.0",
13
- "d3-shape": "^1.3.7",
14
- "date-fns": "^2.25.0",
15
- "mnth": "^2.0.0",
16
- "react-focus-lock": "~2.8.1",
17
- "react-keyed-flatten-children": "^1.3.0",
18
- "react-resizable": "^1.11.1",
19
- "react-transition-group": "^4.4.2",
20
- "react-virtual": "^2.8.2",
21
- "tslib": "^2.4.0",
22
- "weekstart": "^1.1.0"
23
- },
2
+ "name": "@cloudscape-design/components",
3
+ "main": "./index.js",
24
4
  "exports": {
25
5
  ".": "./index.js",
26
6
  "./package.json": "./package.json",
@@ -96,22 +76,38 @@
96
76
  "./wizard": "./wizard/index.js",
97
77
  "./top-navigation/1.0-beta": "./top-navigation/1.0-beta/index.js"
98
78
  },
99
- "homepage": "https://cloudscape.design",
100
- "main": "./index.js",
101
- "name": "@cloudscape-design/components",
102
- "peerDependencies": {
103
- "react": "^16.8 || ^17 || ^18",
104
- "react-dom": "^16.8 || ^17 || ^18"
105
- },
106
- "repository": {
107
- "type": "git",
108
- "url": "git+https://github.com/cloudscape-design/components.git"
109
- },
110
79
  "sideEffects": [
111
80
  "*.css",
112
81
  "./internal/base-component/index.js",
113
82
  "./internal/base-component/styles.css.js"
114
83
  ],
115
- "version": "3.0.161",
84
+ "version": "3.0.163",
85
+ "repository": {
86
+ "type": "git",
87
+ "url": "https://github.com/cloudscape-design/components.git"
88
+ },
89
+ "homepage": "https://cloudscape.design",
90
+ "dependencies": {
91
+ "@cloudscape-design/collection-hooks": "^1.0.0",
92
+ "@cloudscape-design/test-utils-core": "^1.0.0",
93
+ "@cloudscape-design/theming-runtime": "^1.0.0",
94
+ "@juggle/resize-observer": "^3.3.1",
95
+ "ace-builds": "^1.4.13",
96
+ "balanced-match": "^1.0.2",
97
+ "clsx": "^1.1.0",
98
+ "d3-shape": "^1.3.7",
99
+ "date-fns": "^2.25.0",
100
+ "mnth": "^2.0.0",
101
+ "react-focus-lock": "~2.8.1",
102
+ "react-keyed-flatten-children": "^1.3.0",
103
+ "react-transition-group": "^4.4.2",
104
+ "react-virtual": "^2.8.2",
105
+ "tslib": "^2.4.0",
106
+ "weekstart": "^1.1.0"
107
+ },
108
+ "peerDependencies": {
109
+ "react": "^16.8 || ^17 || ^18",
110
+ "react-dom": "^16.8 || ^17 || ^18"
111
+ },
116
112
  "license": "Apache-2.0"
117
113
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAQhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAS,EACT,MAAsB,EACtB,OAAsB,EACtB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,GAAG,IAAI,EACR,EAAE,gBAAgB,eAiDlB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/progress-bar/index.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAWhD,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,KAAS,EACT,MAAsB,EACtB,OAAsB,EACtB,gBAAgB,EAChB,KAAK,EACL,WAAW,EACX,cAAc,EACd,UAAU,EACV,mBAAmB,EACnB,GAAG,IAAI,EACR,EAAE,gBAAgB,eA4DlB"}
@@ -1,7 +1,7 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React from 'react';
4
+ import React, { useEffect, useMemo, useState } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import styles from './styles.css.js';
7
7
  import { getBaseProps } from '../internal/base-component';
@@ -11,7 +11,9 @@ import { useUniqueId } from '../internal/hooks/use-unique-id';
11
11
  import { Progress, ResultState, SmallText } from './internal';
12
12
  import { applyDisplayName } from '../internal/utils/apply-display-name';
13
13
  import useBaseComponent from '../internal/hooks/use-base-component';
14
- import DynamicAriaLive from '../internal/components/dynamic-aria-live';
14
+ import { throttle } from '../internal/utils/throttle';
15
+ import LiveRegion from '../internal/components/live-region';
16
+ var ASSERTION_FREQUENCY = 5000; // interval in ms between progress announcements
15
17
  export default function ProgressBar(_a) {
16
18
  var _b = _a.value, value = _b === void 0 ? 0 : _b, _c = _a.status, status = _c === void 0 ? 'in-progress' : _c, _d = _a.variant, variant = _d === void 0 ? 'standalone' : _d, resultButtonText = _a.resultButtonText, label = _a.label, description = _a.description, additionalInfo = _a.additionalInfo, resultText = _a.resultText, onResultButtonClick = _a.onResultButtonClick, rest = __rest(_a, ["value", "status", "variant", "resultButtonText", "label", "description", "additionalInfo", "resultText", "onResultButtonClick"]);
17
19
  var __internalRootRef = useBaseComponent('ProgressBar').__internalRootRef;
@@ -20,6 +22,15 @@ export default function ProgressBar(_a) {
20
22
  var labelId = "".concat(generatedName, "-label");
21
23
  var isInFlash = variant === 'flash';
22
24
  var isInProgressState = status === 'in-progress';
25
+ var _e = useState(''), assertion = _e[0], setAssertion = _e[1];
26
+ var throttledAssertion = useMemo(function () {
27
+ return throttle(function (value) {
28
+ setAssertion("".concat(label !== null && label !== void 0 ? label : '', ": ").concat(value, "%"));
29
+ }, ASSERTION_FREQUENCY);
30
+ }, [label]);
31
+ useEffect(function () {
32
+ throttledAssertion(value);
33
+ }, [throttledAssertion, value]);
23
34
  if (isInFlash && resultButtonText) {
24
35
  warnOnce('ProgressBar', 'The `resultButtonText` is ignored if you set `variant="flash"`, and the result button is not displayed. Use the `buttonText` property and the `onButtonClick` event listener of the flashbar item in which the progress bar component is embedded.');
25
36
  }
@@ -29,7 +40,7 @@ export default function ProgressBar(_a) {
29
40
  description && React.createElement(SmallText, { color: isInFlash ? 'inherit' : undefined }, description),
30
41
  React.createElement("div", null, isInProgressState ? (React.createElement(React.Fragment, null,
31
42
  React.createElement(Progress, { value: value, labelId: labelId, isInFlash: isInFlash }),
32
- React.createElement(DynamicAriaLive, null, "".concat(label !== null && label !== void 0 ? label : '', ": ").concat(value, "%")))) : (React.createElement(ResultState, { resultText: resultText, isInFlash: isInFlash, resultButtonText: resultButtonText, status: status, onClick: function () {
43
+ React.createElement(LiveRegion, { delay: 0 }, assertion))) : (React.createElement(ResultState, { resultText: resultText, isInFlash: isInFlash, resultButtonText: resultButtonText, status: status, onClick: function () {
33
44
  fireNonCancelableEvent(onResultButtonClick);
34
45
  } })))),
35
46
  additionalInfo && React.createElement(SmallText, { color: isInFlash ? 'inherit' : undefined }, additionalInfo)));