@cloudscape-design/components 3.0.798 → 3.0.800

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 (131) hide show
  1. package/attribute-editor/additional-info.js +2 -2
  2. package/attribute-editor/additional-info.js.map +1 -1
  3. package/attribute-editor/internal.d.ts.map +1 -1
  4. package/attribute-editor/internal.js +2 -2
  5. package/attribute-editor/internal.js.map +1 -1
  6. package/button/internal.d.ts.map +1 -1
  7. package/button/internal.js +5 -3
  8. package/button/internal.js.map +1 -1
  9. package/button-group/icon-button-item.d.ts.map +1 -1
  10. package/button-group/icon-button-item.js +3 -2
  11. package/button-group/icon-button-item.js.map +1 -1
  12. package/cards/index.js +3 -3
  13. package/cards/index.js.map +1 -1
  14. package/code-editor/index.d.ts.map +1 -1
  15. package/code-editor/index.js +2 -2
  16. package/code-editor/index.js.map +1 -1
  17. package/code-editor/status-bar.js +2 -2
  18. package/code-editor/status-bar.js.map +1 -1
  19. package/date-picker/index.js +2 -2
  20. package/date-picker/index.js.map +1 -1
  21. package/date-range-picker/calendar/header/index.js +2 -2
  22. package/date-range-picker/calendar/header/index.js.map +1 -1
  23. package/date-range-picker/calendar/index.d.ts.map +1 -1
  24. package/date-range-picker/calendar/index.js +2 -2
  25. package/date-range-picker/calendar/index.js.map +1 -1
  26. package/date-range-picker/dropdown.d.ts.map +1 -1
  27. package/date-range-picker/dropdown.js +2 -2
  28. package/date-range-picker/dropdown.js.map +1 -1
  29. package/drawer/implementation.d.ts.map +1 -1
  30. package/drawer/implementation.js +2 -2
  31. package/drawer/implementation.js.map +1 -1
  32. package/flashbar/flash.d.ts.map +1 -1
  33. package/flashbar/flash.js +2 -2
  34. package/flashbar/flash.js.map +1 -1
  35. package/form/internal.js +2 -2
  36. package/form/internal.js.map +1 -1
  37. package/form-field/internal.js +3 -3
  38. package/form-field/internal.js.map +1 -1
  39. package/help-panel/implementation.js +2 -2
  40. package/help-panel/implementation.js.map +1 -1
  41. package/internal/analytics/index.d.ts.map +1 -1
  42. package/internal/analytics/index.js +1 -0
  43. package/internal/analytics/index.js.map +1 -1
  44. package/internal/analytics/interfaces.d.ts +8 -0
  45. package/internal/analytics/interfaces.d.ts.map +1 -1
  46. package/internal/analytics/interfaces.js.map +1 -1
  47. package/internal/components/chart-plot/index.js +2 -2
  48. package/internal/components/chart-plot/index.js.map +1 -1
  49. package/internal/components/chart-status-container/index.d.ts.map +1 -1
  50. package/internal/components/chart-status-container/index.js +3 -1
  51. package/internal/components/chart-status-container/index.js.map +1 -1
  52. package/internal/components/dropdown-footer/index.d.ts.map +1 -1
  53. package/internal/components/dropdown-footer/index.js +2 -2
  54. package/internal/components/dropdown-footer/index.js.map +1 -1
  55. package/internal/components/live-region/controller.d.ts +35 -0
  56. package/internal/components/live-region/controller.d.ts.map +1 -0
  57. package/internal/components/live-region/controller.js +77 -0
  58. package/internal/components/live-region/controller.js.map +1 -0
  59. package/internal/components/live-region/index.d.ts +5 -64
  60. package/internal/components/live-region/index.d.ts.map +1 -1
  61. package/internal/components/live-region/index.js +11 -122
  62. package/internal/components/live-region/index.js.map +1 -1
  63. package/internal/components/live-region/interfaces.d.ts +34 -0
  64. package/internal/components/live-region/interfaces.d.ts.map +1 -0
  65. package/internal/components/live-region/interfaces.js +4 -0
  66. package/internal/components/live-region/interfaces.js.map +1 -0
  67. package/internal/components/live-region/internal.d.ts +31 -0
  68. package/internal/components/live-region/internal.d.ts.map +1 -0
  69. package/internal/components/live-region/internal.js +80 -0
  70. package/internal/components/live-region/internal.js.map +1 -0
  71. package/internal/components/live-region/styles.css.js +2 -2
  72. package/internal/components/live-region/styles.scoped.css +146 -4
  73. package/internal/components/live-region/styles.selectors.js +2 -2
  74. package/internal/context/modal-context.d.ts +7 -6
  75. package/internal/context/modal-context.d.ts.map +1 -1
  76. package/internal/context/modal-context.js +5 -1
  77. package/internal/context/modal-context.js.map +1 -1
  78. package/internal/environment.js +1 -1
  79. package/internal/environment.json +1 -1
  80. package/internal/hooks/use-modal-component-analytics/index.d.ts +3 -0
  81. package/internal/hooks/use-modal-component-analytics/index.d.ts.map +1 -0
  82. package/internal/hooks/use-modal-component-analytics/index.js +35 -0
  83. package/internal/hooks/use-modal-component-analytics/index.js.map +1 -0
  84. package/internal/hooks/use-performance-marks/index.d.ts.map +1 -1
  85. package/internal/hooks/use-performance-marks/index.js.map +1 -1
  86. package/internal/manifest.json +1 -1
  87. package/modal/internal.d.ts.map +1 -1
  88. package/modal/internal.js +40 -2
  89. package/modal/internal.js.map +1 -1
  90. package/package.json +1 -1
  91. package/pie-chart/pie-chart.js +2 -2
  92. package/pie-chart/pie-chart.js.map +1 -1
  93. package/progress-bar/index.js +2 -2
  94. package/progress-bar/index.js.map +1 -1
  95. package/s3-resource-selector/s3-in-context/index.d.ts.map +1 -1
  96. package/s3-resource-selector/s3-in-context/index.js +2 -3
  97. package/s3-resource-selector/s3-in-context/index.js.map +1 -1
  98. package/s3-resource-selector/s3-modal/basic-table.js +2 -2
  99. package/s3-resource-selector/s3-modal/basic-table.js.map +1 -1
  100. package/select/parts/filter.d.ts +1 -1
  101. package/spinner/internal.d.ts.map +1 -1
  102. package/spinner/internal.js +2 -0
  103. package/spinner/internal.js.map +1 -1
  104. package/table/body-cell/disabled-inline-editor.d.ts.map +1 -1
  105. package/table/body-cell/disabled-inline-editor.js +2 -1
  106. package/table/body-cell/disabled-inline-editor.js.map +1 -1
  107. package/table/body-cell/index.d.ts.map +1 -1
  108. package/table/body-cell/index.js +2 -2
  109. package/table/body-cell/index.js.map +1 -1
  110. package/table/body-cell/inline-editor.d.ts.map +1 -1
  111. package/table/body-cell/inline-editor.js +4 -4
  112. package/table/body-cell/inline-editor.js.map +1 -1
  113. package/table/internal.js +2 -2
  114. package/table/internal.js.map +1 -1
  115. package/table/no-data-cell.js +2 -2
  116. package/table/no-data-cell.js.map +1 -1
  117. package/table/progressive-loading/items-loader.js +3 -3
  118. package/table/progressive-loading/items-loader.js.map +1 -1
  119. package/tag-editor/index.js +2 -2
  120. package/tag-editor/index.js.map +1 -1
  121. package/test-utils/dom/internal/live-region.d.ts +4 -0
  122. package/test-utils/dom/internal/live-region.js +11 -0
  123. package/test-utils/dom/internal/live-region.js.map +1 -0
  124. package/test-utils/selectors/internal/live-region.d.ts +4 -0
  125. package/test-utils/selectors/internal/live-region.js +11 -0
  126. package/test-utils/selectors/internal/live-region.js.map +1 -0
  127. package/test-utils/tsconfig.tsbuildinfo +1 -1
  128. package/text-filter/search-results.js +2 -2
  129. package/text-filter/search-results.js.map +1 -1
  130. package/tutorial-panel/components/tutorial-list/index.js +2 -2
  131. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
@@ -2,10 +2,152 @@
2
2
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  SPDX-License-Identifier: Apache-2.0
4
4
  */
5
- .awsui_root_3bgfn_64bxr_5:not(#\9) {
6
- /* used in test-utils */
5
+ /*
6
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
+ SPDX-License-Identifier: Apache-2.0
8
+ */
9
+ /*
10
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
11
+ SPDX-License-Identifier: Apache-2.0
12
+ */
13
+ /*
14
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
15
+ SPDX-License-Identifier: Apache-2.0
16
+ */
17
+ /*
18
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
19
+ SPDX-License-Identifier: Apache-2.0
20
+ */
21
+ /*
22
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
23
+ SPDX-License-Identifier: Apache-2.0
24
+ */
25
+ /*
26
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
27
+ SPDX-License-Identifier: Apache-2.0
28
+ */
29
+ /*
30
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
31
+ SPDX-License-Identifier: Apache-2.0
32
+ */
33
+ /*
34
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
35
+ SPDX-License-Identifier: Apache-2.0
36
+ */
37
+ /*
38
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
39
+ SPDX-License-Identifier: Apache-2.0
40
+ */
41
+ /*
42
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
43
+ SPDX-License-Identifier: Apache-2.0
44
+ */
45
+ /*
46
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
47
+ SPDX-License-Identifier: Apache-2.0
48
+ */
49
+ /*
50
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
51
+ SPDX-License-Identifier: Apache-2.0
52
+ */
53
+ /*
54
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
55
+ SPDX-License-Identifier: Apache-2.0
56
+ */
57
+ /*
58
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
59
+ SPDX-License-Identifier: Apache-2.0
60
+ */
61
+ /*
62
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
63
+ SPDX-License-Identifier: Apache-2.0
64
+ */
65
+ /*
66
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
67
+ SPDX-License-Identifier: Apache-2.0
68
+ */
69
+ /*
70
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
71
+ SPDX-License-Identifier: Apache-2.0
72
+ */
73
+ /*
74
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
75
+ SPDX-License-Identifier: Apache-2.0
76
+ */
77
+ /*
78
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
79
+ SPDX-License-Identifier: Apache-2.0
80
+ */
81
+ /*
82
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
83
+ SPDX-License-Identifier: Apache-2.0
84
+ */
85
+ /*
86
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
87
+ SPDX-License-Identifier: Apache-2.0
88
+ */
89
+ /*
90
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
91
+ SPDX-License-Identifier: Apache-2.0
92
+ */
93
+ /*
94
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
+ SPDX-License-Identifier: Apache-2.0
96
+ */
97
+ /*
98
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
99
+ SPDX-License-Identifier: Apache-2.0
100
+ */
101
+ /*
102
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
103
+ SPDX-License-Identifier: Apache-2.0
104
+ */
105
+ /*
106
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
107
+ SPDX-License-Identifier: Apache-2.0
108
+ */
109
+ /*
110
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
111
+ SPDX-License-Identifier: Apache-2.0
112
+ */
113
+ /* stylelint-disable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
114
+ /* stylelint-enable @cloudscape-design/no-motion-outside-of-mixin, selector-combinator-disallowed-list, selector-pseudo-class-no-unknown, selector-class-pattern */
115
+ /*
116
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
117
+ SPDX-License-Identifier: Apache-2.0
118
+ */
119
+ /*
120
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
121
+ SPDX-License-Identifier: Apache-2.0
122
+ */
123
+ /*
124
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
125
+ SPDX-License-Identifier: Apache-2.0
126
+ */
127
+ /*
128
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
129
+ SPDX-License-Identifier: Apache-2.0
130
+ */
131
+ /*
132
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
133
+ SPDX-License-Identifier: Apache-2.0
134
+ */
135
+ /*
136
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
137
+ SPDX-License-Identifier: Apache-2.0
138
+ */
139
+ /* Style used for links in slots/components that are text heavy, to help links stand out among
140
+ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F73#description */
141
+ .awsui_root_3bgfn_di2un_141:not(#\9) {
142
+ display: contents;
143
+ }
144
+
145
+ .awsui_root_3bgfn_di2un_141[hidden]:not(#\9) {
146
+ display: none;
7
147
  }
8
148
 
9
- .awsui_source_3bgfn_64bxr_9:not(#\9) {
10
- /* used in test-utils */
149
+ .awsui_announcer_3bgfn_di2un_149:not(#\9) {
150
+ position: absolute !important;
151
+ inset-block-start: -9999px !important;
152
+ inset-inline-start: -9999px !important;
11
153
  }
@@ -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_64bxr_5",
6
- "source": "awsui_source_3bgfn_64bxr_9"
5
+ "root": "awsui_root_3bgfn_di2un_141",
6
+ "announcer": "awsui_announcer_3bgfn_di2un_149"
7
7
  };
8
8
 
@@ -1,8 +1,9 @@
1
- /// <reference types="react" />
2
- export declare const ModalContext: import("react").Context<{
1
+ import { MutableRefObject } from 'react';
2
+ export interface ModalContextProps {
3
3
  isInModal: boolean;
4
- }>;
5
- export declare const useModalContext: () => {
6
- isInModal: boolean;
7
- };
4
+ componentLoadingCount: MutableRefObject<number>;
5
+ emitTimeToContentReadyInModal: (loadCompleteTime: number) => void;
6
+ }
7
+ export declare const ModalContext: import("react").Context<ModalContextProps>;
8
+ export declare const useModalContext: () => ModalContextProps;
8
9
  //# sourceMappingURL=modal-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"modal-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":";AAIA,eAAO,MAAM,YAAY;eAA8B,OAAO;EAAyB,CAAC;AAExF,eAAO,MAAM,eAAe;eAF2B,OAAO;CAK7D,CAAC"}
1
+ {"version":3,"file":"modal-context.d.ts","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,gBAAgB,EAAc,MAAM,OAAO,CAAC;AAEpE,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,qBAAqB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAChD,6BAA6B,EAAE,CAAC,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAC;CACnE;AAED,eAAO,MAAM,YAAY,4CAIvB,CAAC;AAEH,eAAO,MAAM,eAAe,yBAG3B,CAAC"}
@@ -1,7 +1,11 @@
1
1
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import { createContext, useContext } from 'react';
4
- export const ModalContext = createContext({ isInModal: false });
4
+ export const ModalContext = createContext({
5
+ isInModal: false,
6
+ componentLoadingCount: { current: 0 },
7
+ emitTimeToContentReadyInModal: () => { },
8
+ });
5
9
  export const useModalContext = () => {
6
10
  const modalContext = useContext(ModalContext);
7
11
  return modalContext;
@@ -1 +1 @@
1
- {"version":3,"file":"modal-context.js","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAElD,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAyB,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, useContext } from 'react';\n\nexport const ModalContext = createContext<{ isInModal: boolean }>({ isInModal: false });\n\nexport const useModalContext = () => {\n const modalContext = useContext(ModalContext);\n return modalContext;\n};\n"]}
1
+ {"version":3,"file":"modal-context.js","sourceRoot":"","sources":["../../../../src/internal/context/modal-context.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,aAAa,EAAoB,UAAU,EAAE,MAAM,OAAO,CAAC;AAQpE,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAoB;IAC3D,SAAS,EAAE,KAAK;IAChB,qBAAqB,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE;IACrC,6BAA6B,EAAE,GAAG,EAAE,GAAE,CAAC;CACxC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IAC9C,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { createContext, MutableRefObject, useContext } from 'react';\n\nexport interface ModalContextProps {\n isInModal: boolean;\n componentLoadingCount: MutableRefObject<number>;\n emitTimeToContentReadyInModal: (loadCompleteTime: number) => void;\n}\n\nexport const ModalContext = createContext<ModalContextProps>({\n isInModal: false,\n componentLoadingCount: { current: 0 },\n emitTimeToContentReadyInModal: () => {},\n});\n\nexport const useModalContext = () => {\n const modalContext = useContext(ModalContext);\n return modalContext;\n};\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (518db948)";
2
+ export var PACKAGE_VERSION = "3.0.0 (6ac2909a)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (518db948)",
3
+ "PACKAGE_VERSION": "3.0.0 (6ac2909a)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -0,0 +1,3 @@
1
+ export declare const useModalContextLoadingButtonComponent: (isPrimaryButton: boolean, loading: boolean) => void;
2
+ export declare const useModalContextLoadingComponent: () => void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-modal-component-analytics/index.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qCAAqC,oBAAqB,OAAO,WAAW,OAAO,SAe/F,CAAC;AAEF,eAAO,MAAM,+BAA+B,YAa3C,CAAC"}
@@ -0,0 +1,35 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useEffect } from 'react';
4
+ import { useModalContext } from '../../context/modal-context';
5
+ export const useModalContextLoadingButtonComponent = (isPrimaryButton, loading) => {
6
+ const modalContext = useModalContext();
7
+ useEffect(() => {
8
+ if (!isPrimaryButton || !modalContext.isInModal) {
9
+ return;
10
+ }
11
+ if (loading) {
12
+ modalContext.componentLoadingCount.current++;
13
+ return () => {
14
+ modalContext.componentLoadingCount.current--;
15
+ modalContext.emitTimeToContentReadyInModal(performance.now());
16
+ };
17
+ }
18
+ // eslint-disable-next-line react-hooks/exhaustive-deps
19
+ }, [loading]);
20
+ };
21
+ export const useModalContextLoadingComponent = () => {
22
+ const modalContext = useModalContext();
23
+ useEffect(() => {
24
+ if (!modalContext.isInModal) {
25
+ return;
26
+ }
27
+ modalContext.componentLoadingCount.current++;
28
+ return () => {
29
+ modalContext.componentLoadingCount.current--;
30
+ modalContext.emitTimeToContentReadyInModal(performance.now());
31
+ };
32
+ // eslint-disable-next-line react-hooks/exhaustive-deps
33
+ }, []);
34
+ };
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-modal-component-analytics/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAE9D,MAAM,CAAC,MAAM,qCAAqC,GAAG,CAAC,eAAwB,EAAE,OAAgB,EAAE,EAAE;IAClG,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;YAC/C,OAAO;SACR;QACD,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;YAC7C,OAAO,GAAG,EAAE;gBACV,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;gBAC7C,YAAY,CAAC,6BAA6B,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;YAChE,CAAC,CAAC;SACH;QACD,uDAAuD;IACzD,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,GAAG,EAAE;IAClD,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;IACvC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE;YAC3B,OAAO;SACR;QACD,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;QAC7C,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,qBAAqB,CAAC,OAAO,EAAE,CAAC;YAC7C,YAAY,CAAC,6BAA6B,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC;QAChE,CAAC,CAAC;QACF,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC,CAAC","sourcesContent":["// 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';\n\nexport const useModalContextLoadingButtonComponent = (isPrimaryButton: boolean, loading: boolean) => {\n const modalContext = useModalContext();\n useEffect(() => {\n if (!isPrimaryButton || !modalContext.isInModal) {\n return;\n }\n if (loading) {\n modalContext.componentLoadingCount.current++;\n return () => {\n modalContext.componentLoadingCount.current--;\n modalContext.emitTimeToContentReadyInModal(performance.now());\n };\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [loading]);\n};\n\nexport const useModalContextLoadingComponent = () => {\n const modalContext = useModalContext();\n useEffect(() => {\n if (!modalContext.isInModal) {\n return;\n }\n modalContext.componentLoadingCount.current++;\n return () => {\n modalContext.componentLoadingCount.current--;\n modalContext.emitTimeToContentReadyInModal(performance.now());\n };\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n};\n"]}
@@ -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;;EA0DnC"}
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 +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,UAAU,CAAC,CAAC,CAAC;IAExB,OAAO;QACL,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC,OAAO;KAC3C,CAAC;AACJ,CAAC;AAED;;;;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,2BAA2B,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAE/D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAChD,OAAO;SACR;QAED,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,UAAU,KAAK,QAAQ,CAAC;QAE/D,IAAI,CAAC,cAAc,EAAE;YACnB,OAAO;SACR;QAED,MAAM,gBAAgB,GAAG,GAAG,IAAI,UAAU,CAAC;QAE3C,WAAW,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACjC,MAAM,kBACJ,MAAM,EAAE,OAAO,EACf,kBAAkB,EAAE,EAAE,IACnB,UAAU,EAAE,CAChB;SACF,CAAC,CAAC;QACH,uDAAuD;IACzD,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iBAAiB,CAAC,GAAG,EAAE;QACrB,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IAAI,SAAS,EAAE;YAChD,OAAO;SACR;QACD,MAAM,cAAc,GAClB,UAAU,CAAC,OAAO,CAAC,WAAW,GAAG,CAAC;YAClC,UAAU,CAAC,OAAO,CAAC,YAAY,GAAG,CAAC;YACnC,gBAAgB,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\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,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,UAAU,CAAC,CAAC,CAAC;IAExB,OAAO;QACL,CAAC,aAAa,CAAC,EAAE,iBAAiB,CAAC,OAAO;KAC3C,CAAC;AACJ,CAAC;AAED;;;;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,2BAA2B,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IAC/D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,IA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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,3 +1,3 @@
1
1
  {
2
- "commit": "518db948c63a4fce20a36ba1fd2189ebf81f67b2"
2
+ "commit": "6ac2909a5cc68a7a2dd040ac560f5c0392da89d0"
3
3
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAWA,OAAO,EAEL,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,WAAW,EAA8C,MAAM,wCAAwC,CAAC;AAIjH,OAAO,EAAiB,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAKvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,eAqB9D;AAED,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GACxD,0BAA0B,GAAG;IAC3B,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC9D,YAAY,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACvD,oBAAoB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;IACvE,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,aAAa,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEJ,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAM9G"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAYA,OAAO,EAEL,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,iDAAiD,CAAC;AACzD,OAAO,EAAE,WAAW,EAA8C,MAAM,wCAAwC,CAAC;AAIjH,OAAO,EAAiB,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAKvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAMjD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAK1C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,eAqB9D;AAED,KAAK,kBAAkB,GAAG,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,GACxD,0BAA0B,GAAG;IAC3B,aAAa,CAAC,EAAE,WAAW,CAAC;IAC5B,iBAAiB,CAAC,EAAE,sBAAsB,CAAC,iBAAiB,CAAC,CAAC;IAC9D,YAAY,CAAC,EAAE,yBAAyB,CAAC,YAAY,CAAC,CAAC;IACvD,oBAAoB,CAAC,EAAE,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;IACvE,kCAAkC,CAAC,EAAE,OAAO,CAAC;IAC7C,aAAa,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEJ,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,eAAe,EAAE,GAAG,IAAI,EAAE,EAAE,kBAAkB,eAM9G"}
package/modal/internal.js CHANGED
@@ -8,6 +8,7 @@ import { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-tool
8
8
  import { InternalButton } from '../button/internal';
9
9
  import InternalHeader from '../header/internal';
10
10
  import { useInternalI18n } from '../i18n/context';
11
+ import { PerformanceMetrics } from '../internal/analytics';
11
12
  import { FunnelNameSelectorContext, } from '../internal/analytics/context/analytics-context';
12
13
  import { useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
13
14
  import { getBaseProps } from '../internal/base-component';
@@ -65,20 +66,53 @@ function PortaledModal(_a) {
65
66
  const metadataAttribute = __injectAnalyticsComponentMetadata
66
67
  ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })
67
68
  : {};
69
+ const loadStartTime = useRef(0);
70
+ const loadCompleteTime = useRef(0);
71
+ const componentLoadingCount = useRef(0);
72
+ const performanceMetricLogged = useRef(false);
68
73
  // enable body scroll and restore focus if unmounting while visible
69
74
  useEffect(() => {
70
75
  return () => {
71
76
  enableBodyScrolling();
72
77
  };
73
78
  }, []);
74
- // enable / disable body scroll
79
+ const resetModalPerformanceData = () => {
80
+ loadStartTime.current = performance.now();
81
+ loadCompleteTime.current = 0;
82
+ performanceMetricLogged.current = false;
83
+ };
84
+ const emitTimeToContentReadyInModal = (loadCompleteTime) => {
85
+ if (componentLoadingCount.current === 0 &&
86
+ loadStartTime.current &&
87
+ loadStartTime.current !== 0 &&
88
+ !performanceMetricLogged.current) {
89
+ const timeToContentReadyInModal = loadCompleteTime - loadStartTime.current;
90
+ PerformanceMetrics.modalPerformanceData({
91
+ timeToContentReadyInModal,
92
+ instanceIdentifier: instanceUniqueId,
93
+ });
94
+ performanceMetricLogged.current = true;
95
+ }
96
+ };
97
+ const MODAL_READY_TIMEOUT = 100;
98
+ /**
99
+ * This useEffect is triggered when the visible attribute of modal changes.
100
+ * When modal becomes visible, modal performance metrics are reset marking the beginning loading process.
101
+ * To ensure that the modal component ready metric is always emitted, a setTimeout is implemented.
102
+ * This setTimeout automatically emits the component ready metric after a specified duration.
103
+ */
75
104
  useEffect(() => {
76
105
  if (visible) {
77
106
  disableBodyScrolling();
107
+ resetModalPerformanceData();
108
+ setTimeout(() => {
109
+ emitTimeToContentReadyInModal(loadStartTime.current);
110
+ }, MODAL_READY_TIMEOUT);
78
111
  }
79
112
  else {
80
113
  enableBodyScrolling();
81
114
  }
115
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
116
  }, [visible]);
83
117
  // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top
84
118
  useEffect(() => {
@@ -112,7 +146,11 @@ function PortaledModal(_a) {
112
146
  const { subStepRef } = useFunnelSubStep();
113
147
  return (React.createElement(FunnelNameSelectorContext.Provider, { value: `.${styles['header--text']}` },
114
148
  React.createElement(ResetContextsForModal, null,
115
- React.createElement(ModalContext.Provider, { value: { isInModal: true } },
149
+ React.createElement(ModalContext.Provider, { value: {
150
+ isInModal: true,
151
+ componentLoadingCount,
152
+ emitTimeToContentReadyInModal,
153
+ } },
116
154
  React.createElement("div", Object.assign({}, baseProps, __funnelProps, __funnelStepProps, { className: clsx(styles.root, { [styles.hidden]: !visible }, baseProps.className, isRefresh && styles.refresh), role: "dialog", "aria-modal": true, "aria-labelledby": headerId, onMouseDown: onOverlayMouseDown, onClick: onOverlayClick, ref: mergedRef, style: footerHeight ? { scrollPaddingBottom: footerHeight } : undefined, "data-awsui-referrer-id": ((_b = subStepRef.current) === null || _b === void 0 ? void 0 : _b.id) || referrerId }),
117
155
  React.createElement(FocusLock, { disabled: !visible, autoFocus: true, restoreFocus: true, className: styles['focus-lock'] },
118
156
  React.createElement("div", Object.assign({ className: clsx(styles.dialog, styles[size], styles[`breakpoint-${breakpoint}`], isRefresh && styles.refresh), onKeyDown: escKeyHandler }, metadataAttribute),
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,s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,EAAE,IAAI,EAC9B,OAAO,EACL,6CACM,6BAA6B,CAAC;4CAChC,MAAM,EAAE,SAAS;yCACiC,CAAC;4CAErD,oBAAC,cAAc,IACb,SAAS,EAAE,cAAc,EACzB,SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAC,eAAe,EACvB,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAC3B,CACE;wCAGR,8BAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAClD,MAAM,CACF,CACQ,CACb;gCACN,2CACE,GAAG,EAAE,YAAY,IACb,oBAAoB,IACxB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;oCAEnF,QAAQ;oCACT,6BAAK,GAAG,EAAE,iBAAiB,GAAI,CAC3B;gCACL,MAAM,IAAI,CACT,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;oCACvD,6BAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IACxF,MAAM,CACH,CACiB,CAC1B,CACG,CACF,CACI,CACR,CACgB,CACF,CACW,CACtC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport {\n FunnelNameSelectorContext,\n FunnelStepContextValue,\n FunnelSubStepContextValue,\n} from '../internal/analytics/context/analytics-context';\nimport { FunnelProps, useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport Portal from '../internal/components/portal';\nimport { ButtonContext, ButtonContextProps } from '../internal/context/button-context';\nimport { ModalContext } from '../internal/context/modal-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { SomeRequired } from '../internal/types';\nimport {\n GeneratedAnalyticsMetadataModalComponent,\n GeneratedAnalyticsMetadataModalDismiss,\n} from './analytics-metadata/interfaces';\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport function InternalModalAsFunnel(props: InternalModalProps) {\n const { funnelProps, funnelSubmit, funnelNextOrSubmitAttempt } = useFunnel();\n const { funnelStepProps } = useFunnelStep();\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const onButtonClick: ButtonContextProps['onClick'] = ({ variant }) => {\n if (variant === 'primary') {\n funnelNextOrSubmitAttempt();\n funnelSubmit();\n }\n };\n\n return (\n <InternalModal\n __funnelProps={funnelProps}\n __funnelStepProps={funnelStepProps}\n __subStepRef={subStepRef}\n __subStepFunnelProps={funnelSubStepProps}\n onButtonClick={onButtonClick}\n {...props}\n />\n );\n}\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> &\n InternalBaseComponentProps & {\n __funnelProps?: FunnelProps;\n __funnelStepProps?: FunnelStepContextValue['funnelStepProps'];\n __subStepRef?: FunnelSubStepContextValue['subStepRef'];\n __subStepFunnelProps?: FunnelSubStepContextValue['funnelSubStepProps'];\n __injectAnalyticsComponentMetadata?: boolean;\n onButtonClick?: ButtonContextProps['onClick'];\n referrerId?: string;\n };\n\nexport default function InternalModal({ modalRoot, getModalRoot, removeModalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot} getContainer={getModalRoot} removeContainer={removeModalRoot}>\n <PortaledModal {...rest} />\n </Portal>\n );\n}\n\ntype PortaledModalProps = Omit<InternalModalProps, 'modalRoot' | 'getModalRoot' | 'removeModalRoot'>;\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction PortaledModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onButtonClick = () => {},\n onDismiss,\n __internalRootRef = null,\n __injectAnalyticsComponentMetadata,\n __funnelProps,\n __funnelStepProps,\n __subStepRef,\n __subStepFunnelProps,\n referrerId,\n ...rest\n}: PortaledModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataModalComponent = {\n name: 'awsui.Modal',\n label: `.${analyticsSelectors.header} h2`,\n };\n\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n // enable / disable body scroll\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n } else {\n enableBodyScrolling();\n }\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n // Add extra scroll padding to account for the height of the sticky footer,\n // to prevent it from covering focused elements.\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n const { subStepRef } = useFunnelSubStep();\n\n return (\n <FunnelNameSelectorContext.Provider value={`.${styles['header--text']}`}>\n <ResetContextsForModal>\n <ModalContext.Provider value={{ isInModal: true }}>\n <div\n {...baseProps}\n {...__funnelProps}\n {...__funnelStepProps}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n isRefresh && styles.refresh\n )}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n data-awsui-referrer-id={subStepRef.current?.id || referrerId}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n {...metadataAttribute}\n >\n <div className={styles.container}>\n <div className={clsx(styles.header, analyticsSelectors.header)}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <div\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataModalDismiss>)}\n >\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n </div>\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div\n ref={__subStepRef}\n {...__subStepFunnelProps}\n className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}\n >\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <ButtonContext.Provider value={{ onClick: onButtonClick }}>\n <div ref={footerRef} className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>\n {footer}\n </div>\n </ButtonContext.Provider>\n )}\n </div>\n </div>\n </FocusLock>\n </div>\n </ModalContext.Provider>\n </ResetContextsForModal>\n </FunnelNameSelectorContext.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/modal/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,6BAA6B,EAAE,MAAM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SAAS,EAAE,MAAM,CAAC,iBAAiB,CAAC,EACpC,OAAO,EAAC,eAAe,EACvB,QAAQ,EAAC,OAAO,EAChB,UAAU,EAAC,MAAM,EACjB,OAAO,EAAE,kBAAkB,GAC3B,CACE;wCAGR,8BAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAClD,MAAM,CACF,CACQ,CACb;gCACN,2CACE,GAAG,EAAE,YAAY,IACb,oBAAoB,IACxB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,sBAAsB,EAAE,CAAC;oCAEnF,QAAQ;oCACT,6BAAK,GAAG,EAAE,iBAAiB,GAAI,CAC3B;gCACL,MAAM,IAAI,CACT,oBAAC,aAAa,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,aAAa,EAAE;oCACvD,6BAAK,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,MAAM,CAAC,eAAe,CAAC,CAAC,IACxF,MAAM,CACH,CACiB,CAC1B,CACG,CACF,CACI,CACR,CACgB,CACF,CACW,CACtC,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useContainerQuery } from '@cloudscape-design/component-toolkit';\nimport { getAnalyticsMetadataAttribute } from '@cloudscape-design/component-toolkit/internal/analytics-metadata';\n\nimport { InternalButton } from '../button/internal';\nimport InternalHeader from '../header/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { PerformanceMetrics } from '../internal/analytics';\nimport {\n FunnelNameSelectorContext,\n FunnelStepContextValue,\n FunnelSubStepContextValue,\n} from '../internal/analytics/context/analytics-context';\nimport { FunnelProps, useFunnel, useFunnelStep, useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getBaseProps } from '../internal/base-component';\nimport FocusLock from '../internal/components/focus-lock';\nimport Portal from '../internal/components/portal';\nimport { ButtonContext, ButtonContextProps } from '../internal/context/button-context';\nimport { ModalContext } from '../internal/context/modal-context';\nimport ResetContextsForModal from '../internal/context/reset-contexts-for-modal';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { useContainerBreakpoints } from '../internal/hooks/container-queries';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useIntersectionObserver } from '../internal/hooks/use-intersection-observer';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { KeyCode } from '../internal/keycode';\nimport { SomeRequired } from '../internal/types';\nimport {\n GeneratedAnalyticsMetadataModalComponent,\n GeneratedAnalyticsMetadataModalDismiss,\n} from './analytics-metadata/interfaces';\nimport { disableBodyScrolling, enableBodyScrolling } from './body-scroll';\nimport { ModalProps } from './interfaces';\n\nimport analyticsSelectors from './analytics-metadata/styles.css.js';\nimport styles from './styles.css.js';\n\nexport function InternalModalAsFunnel(props: InternalModalProps) {\n const { funnelProps, funnelSubmit, funnelNextOrSubmitAttempt } = useFunnel();\n const { funnelStepProps } = useFunnelStep();\n const { subStepRef, funnelSubStepProps } = useFunnelSubStep();\n const onButtonClick: ButtonContextProps['onClick'] = ({ variant }) => {\n if (variant === 'primary') {\n funnelNextOrSubmitAttempt();\n funnelSubmit();\n }\n };\n\n return (\n <InternalModal\n __funnelProps={funnelProps}\n __funnelStepProps={funnelStepProps}\n __subStepRef={subStepRef}\n __subStepFunnelProps={funnelSubStepProps}\n onButtonClick={onButtonClick}\n {...props}\n />\n );\n}\n\ntype InternalModalProps = SomeRequired<ModalProps, 'size'> &\n InternalBaseComponentProps & {\n __funnelProps?: FunnelProps;\n __funnelStepProps?: FunnelStepContextValue['funnelStepProps'];\n __subStepRef?: FunnelSubStepContextValue['subStepRef'];\n __subStepFunnelProps?: FunnelSubStepContextValue['funnelSubStepProps'];\n __injectAnalyticsComponentMetadata?: boolean;\n onButtonClick?: ButtonContextProps['onClick'];\n referrerId?: string;\n };\n\nexport default function InternalModal({ modalRoot, getModalRoot, removeModalRoot, ...rest }: InternalModalProps) {\n return (\n <Portal container={modalRoot} getContainer={getModalRoot} removeContainer={removeModalRoot}>\n <PortaledModal {...rest} />\n </Portal>\n );\n}\n\ntype PortaledModalProps = Omit<InternalModalProps, 'modalRoot' | 'getModalRoot' | 'removeModalRoot'>;\n\n// Separate component to prevent the Portal from getting in the way of refs, as it needs extra cycles to render the inner components.\n// useContainerQuery needs its targeted element to exist on the first render in order to work properly.\nfunction PortaledModal({\n size,\n visible,\n header,\n children,\n footer,\n disableContentPaddings,\n onButtonClick = () => {},\n onDismiss,\n __internalRootRef = null,\n __injectAnalyticsComponentMetadata,\n __funnelProps,\n __funnelStepProps,\n __subStepRef,\n __subStepFunnelProps,\n referrerId,\n ...rest\n}: PortaledModalProps) {\n const instanceUniqueId = useUniqueId();\n const headerId = `${rest.id || instanceUniqueId}-header`;\n const lastMouseDownElementRef = useRef<HTMLElement | null>(null);\n const [breakpoint, breakpointsRef] = useContainerBreakpoints(['xs']);\n\n const i18n = useInternalI18n('modal');\n const closeAriaLabel = i18n('closeAriaLabel', rest.closeAriaLabel);\n\n const refObject = useRef<HTMLDivElement>(null);\n const mergedRef = useMergeRefs(breakpointsRef, refObject, __internalRootRef);\n\n const isRefresh = useVisualRefresh();\n\n const baseProps = getBaseProps(rest);\n\n const analyticsComponentMetadata: GeneratedAnalyticsMetadataModalComponent = {\n name: 'awsui.Modal',\n label: `.${analyticsSelectors.header} h2`,\n };\n const metadataAttribute = __injectAnalyticsComponentMetadata\n ? getAnalyticsMetadataAttribute({ component: analyticsComponentMetadata })\n : {};\n const loadStartTime = useRef<number>(0);\n const loadCompleteTime = useRef<number>(0);\n const componentLoadingCount = useRef<number>(0);\n const performanceMetricLogged = useRef<boolean>(false);\n\n // enable body scroll and restore focus if unmounting while visible\n useEffect(() => {\n return () => {\n enableBodyScrolling();\n };\n }, []);\n\n const resetModalPerformanceData = () => {\n loadStartTime.current = performance.now();\n loadCompleteTime.current = 0;\n performanceMetricLogged.current = false;\n };\n\n const emitTimeToContentReadyInModal = (loadCompleteTime: number) => {\n if (\n componentLoadingCount.current === 0 &&\n loadStartTime.current &&\n loadStartTime.current !== 0 &&\n !performanceMetricLogged.current\n ) {\n const timeToContentReadyInModal = loadCompleteTime - loadStartTime.current;\n PerformanceMetrics.modalPerformanceData({\n timeToContentReadyInModal,\n instanceIdentifier: instanceUniqueId,\n });\n performanceMetricLogged.current = true;\n }\n };\n\n const MODAL_READY_TIMEOUT = 100;\n /**\n * This useEffect is triggered when the visible attribute of modal changes.\n * When modal becomes visible, modal performance metrics are reset marking the beginning loading process.\n * To ensure that the modal component ready metric is always emitted, a setTimeout is implemented.\n * This setTimeout automatically emits the component ready metric after a specified duration.\n */\n useEffect(() => {\n if (visible) {\n disableBodyScrolling();\n resetModalPerformanceData();\n setTimeout(() => {\n emitTimeToContentReadyInModal(loadStartTime.current);\n }, MODAL_READY_TIMEOUT);\n } else {\n enableBodyScrolling();\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [visible]);\n\n // Because we hide the element with styles (and not actually detach it from DOM), we need to scroll to top\n useEffect(() => {\n if (visible && refObject.current) {\n refObject.current.scrollTop = 0;\n }\n }, [visible]);\n\n const dismiss = (reason: string) => fireNonCancelableEvent(onDismiss, { reason });\n\n const onOverlayMouseDown = (event: React.MouseEvent) => {\n lastMouseDownElementRef.current = event.target as HTMLElement;\n };\n const onOverlayClick = (event: React.MouseEvent) => {\n const overlay = refObject.current;\n const lastClicked = lastMouseDownElementRef.current;\n\n if (event.target === overlay && lastClicked === overlay) {\n dismiss('overlay');\n }\n };\n const onCloseButtonClick = () => dismiss('closeButton');\n const escKeyHandler = (event: React.KeyboardEvent) => {\n if (event.keyCode === KeyCode.escape) {\n dismiss('keyboard');\n }\n };\n\n // We use an empty div element at the end of the content slot as a sentinel\n // to detect when the user has scrolled to the bottom.\n const { ref: stickySentinelRef, isIntersecting: footerStuck } = useIntersectionObserver();\n\n // Add extra scroll padding to account for the height of the sticky footer,\n // to prevent it from covering focused elements.\n const [footerHeight, footerRef] = useContainerQuery(rect => rect.borderBoxHeight);\n const { subStepRef } = useFunnelSubStep();\n\n return (\n <FunnelNameSelectorContext.Provider value={`.${styles['header--text']}`}>\n <ResetContextsForModal>\n <ModalContext.Provider\n value={{\n isInModal: true,\n componentLoadingCount,\n emitTimeToContentReadyInModal,\n }}\n >\n <div\n {...baseProps}\n {...__funnelProps}\n {...__funnelStepProps}\n className={clsx(\n styles.root,\n { [styles.hidden]: !visible },\n baseProps.className,\n isRefresh && styles.refresh\n )}\n role=\"dialog\"\n aria-modal={true}\n aria-labelledby={headerId}\n onMouseDown={onOverlayMouseDown}\n onClick={onOverlayClick}\n ref={mergedRef}\n style={footerHeight ? { scrollPaddingBottom: footerHeight } : undefined}\n data-awsui-referrer-id={subStepRef.current?.id || referrerId}\n >\n <FocusLock disabled={!visible} autoFocus={true} restoreFocus={true} className={styles['focus-lock']}>\n <div\n className={clsx(\n styles.dialog,\n styles[size],\n styles[`breakpoint-${breakpoint}`],\n isRefresh && styles.refresh\n )}\n onKeyDown={escKeyHandler}\n {...metadataAttribute}\n >\n <div className={styles.container}>\n <div className={clsx(styles.header, analyticsSelectors.header)}>\n <InternalHeader\n variant=\"h2\"\n __disableActionsWrapping={true}\n actions={\n <div\n {...getAnalyticsMetadataAttribute({\n action: 'dismiss',\n } as Partial<GeneratedAnalyticsMetadataModalDismiss>)}\n >\n <InternalButton\n ariaLabel={closeAriaLabel}\n className={styles['dismiss-control']}\n variant=\"modal-dismiss\"\n iconName=\"close\"\n formAction=\"none\"\n onClick={onCloseButtonClick}\n />\n </div>\n }\n >\n <span id={headerId} className={styles['header--text']}>\n {header}\n </span>\n </InternalHeader>\n </div>\n <div\n ref={__subStepRef}\n {...__subStepFunnelProps}\n className={clsx(styles.content, { [styles['no-paddings']]: disableContentPaddings })}\n >\n {children}\n <div ref={stickySentinelRef} />\n </div>\n {footer && (\n <ButtonContext.Provider value={{ onClick: onButtonClick }}>\n <div ref={footerRef} className={clsx(styles.footer, footerStuck && styles['footer--stuck'])}>\n {footer}\n </div>\n </ButtonContext.Provider>\n )}\n </div>\n </div>\n </FocusLock>\n </div>\n </ModalContext.Provider>\n </ResetContextsForModal>\n </FunnelNameSelectorContext.Provider>\n );\n}\n"]}
package/package.json CHANGED
@@ -127,7 +127,7 @@
127
127
  "./internal/base-component/index.js",
128
128
  "./internal/base-component/styles.css.js"
129
129
  ],
130
- "version": "3.0.798",
130
+ "version": "3.0.800",
131
131
  "repository": {
132
132
  "type": "git",
133
133
  "url": "https://github.com/cloudscape-design/components.git"
@@ -10,7 +10,7 @@ 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 LiveRegion from '../internal/components/live-region';
13
+ import InternalLiveRegion from '../internal/components/live-region/internal';
14
14
  import { useHeightMeasure } from '../internal/hooks/container-queries/use-height-measure';
15
15
  import { useUniqueId } from '../internal/hooks/use-unique-id';
16
16
  import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
@@ -199,6 +199,6 @@ export default ({ fitHeight, height: explicitHeight, variant, size, width, i18nS
199
199
  popoverData.series.label)), trackRef: popoverData.trackRef, trackKey: popoverData.series.index, dismissButton: pinnedSegment !== null, dismissAriaLabel: i18nStrings.detailPopoverDismissAriaLabel, onDismiss: onPopoverDismiss, container: ((_b = plotRef.current) === null || _b === void 0 ? void 0 : _b.svg) || null, size: detailPopoverSize, onMouseLeave: checkMouseLeave, onBlur: onApplicationBlur },
200
200
  popoverContent,
201
201
  detailPopoverFooterContent && React.createElement(ChartPopoverFooter, null, detailPopoverFooterContent))),
202
- React.createElement(LiveRegion, { source: [popoverContentRef] })));
202
+ React.createElement(InternalLiveRegion, { sources: [popoverContentRef] })));
203
203
  };
204
204
  //# sourceMappingURL=pie-chart.js.map