@cloudscape-design/components 3.0.115 → 3.0.117

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 (113) hide show
  1. package/app-layout/index.d.ts.map +1 -1
  2. package/app-layout/index.js +16 -14
  3. package/app-layout/index.js.map +1 -1
  4. package/area-chart/model/use-chart-model.d.ts.map +1 -1
  5. package/area-chart/model/use-chart-model.js +2 -1
  6. package/area-chart/model/use-chart-model.js.map +1 -1
  7. package/area-chart/model/utils.d.ts +0 -6
  8. package/area-chart/model/utils.d.ts.map +1 -1
  9. package/area-chart/model/utils.js +0 -52
  10. package/area-chart/model/utils.js.map +1 -1
  11. package/button/index.d.ts.map +1 -1
  12. package/button/index.js +2 -2
  13. package/button/index.js.map +1 -1
  14. package/button/interfaces.d.ts +4 -0
  15. package/button/interfaces.d.ts.map +1 -1
  16. package/button/interfaces.js.map +1 -1
  17. package/button/internal.d.ts.map +1 -1
  18. package/button/internal.js +10 -5
  19. package/button/internal.js.map +1 -1
  20. package/button-dropdown/index.d.ts.map +1 -1
  21. package/button-dropdown/index.js +2 -2
  22. package/button-dropdown/index.js.map +1 -1
  23. package/button-dropdown/interfaces.d.ts +4 -0
  24. package/button-dropdown/interfaces.d.ts.map +1 -1
  25. package/button-dropdown/interfaces.js.map +1 -1
  26. package/button-dropdown/internal.d.ts.map +1 -1
  27. package/button-dropdown/internal.js +2 -2
  28. package/button-dropdown/internal.js.map +1 -1
  29. package/cards/index.d.ts.map +1 -1
  30. package/cards/index.js +3 -1
  31. package/cards/index.js.map +1 -1
  32. package/code-editor/index.d.ts.map +1 -1
  33. package/code-editor/index.js +3 -1
  34. package/code-editor/index.js.map +1 -1
  35. package/expandable-section/expandable-section-header.d.ts +12 -4
  36. package/expandable-section/expandable-section-header.d.ts.map +1 -1
  37. package/expandable-section/expandable-section-header.js +51 -11
  38. package/expandable-section/expandable-section-header.js.map +1 -1
  39. package/expandable-section/interfaces.d.ts +21 -3
  40. package/expandable-section/interfaces.d.ts.map +1 -1
  41. package/expandable-section/interfaces.js.map +1 -1
  42. package/expandable-section/internal.d.ts +1 -1
  43. package/expandable-section/internal.d.ts.map +1 -1
  44. package/expandable-section/internal.js +2 -2
  45. package/expandable-section/internal.js.map +1 -1
  46. package/expandable-section/styles.css.js +21 -20
  47. package/expandable-section/styles.scoped.css +56 -39
  48. package/expandable-section/styles.selectors.js +21 -20
  49. package/flashbar/flash.d.ts +3 -3
  50. package/flashbar/flash.d.ts.map +1 -1
  51. package/flashbar/flash.js +31 -15
  52. package/flashbar/flash.js.map +1 -1
  53. package/flashbar/index.d.ts.map +1 -1
  54. package/flashbar/index.js +61 -14
  55. package/flashbar/index.js.map +1 -1
  56. package/flashbar/interfaces.d.ts +16 -0
  57. package/flashbar/interfaces.d.ts.map +1 -1
  58. package/flashbar/interfaces.js.map +1 -1
  59. package/flashbar/styles.css.js +33 -29
  60. package/flashbar/styles.scoped.css +151 -112
  61. package/flashbar/styles.selectors.js +33 -29
  62. package/help-panel/index.d.ts.map +1 -1
  63. package/help-panel/index.js +3 -1
  64. package/help-panel/index.js.map +1 -1
  65. package/internal/components/chart-status-container/index.d.ts +2 -2
  66. package/internal/components/chart-status-container/index.d.ts.map +1 -1
  67. package/internal/components/chart-status-container/index.js +2 -3
  68. package/internal/components/chart-status-container/index.js.map +1 -1
  69. package/internal/components/live-region/index.d.ts +2 -1
  70. package/internal/components/live-region/index.d.ts.map +1 -1
  71. package/internal/components/live-region/index.js +6 -5
  72. package/internal/components/live-region/index.js.map +1 -1
  73. package/internal/environment.js +1 -1
  74. package/internal/manifest.json +1 -1
  75. package/internal/utils/throttle.d.ts +10 -0
  76. package/internal/utils/throttle.d.ts.map +1 -0
  77. package/internal/utils/throttle.js +57 -0
  78. package/internal/utils/throttle.js.map +1 -0
  79. package/package.json +1 -1
  80. package/s3-resource-selector/s3-in-context/index.d.ts.map +1 -1
  81. package/s3-resource-selector/s3-in-context/index.js +3 -1
  82. package/s3-resource-selector/s3-in-context/index.js.map +1 -1
  83. package/side-navigation/internal.js +2 -2
  84. package/side-navigation/internal.js.map +1 -1
  85. package/table/internal.d.ts.map +1 -1
  86. package/table/internal.js +3 -1
  87. package/table/internal.js.map +1 -1
  88. package/tag-editor/index.d.ts.map +1 -1
  89. package/tag-editor/index.js +3 -1
  90. package/tag-editor/index.js.map +1 -1
  91. package/test-utils/dom/flashbar/flash.js +1 -1
  92. package/test-utils/dom/flashbar/flash.js.map +1 -1
  93. package/test-utils/dom/flashbar/index.js +1 -1
  94. package/test-utils/dom/flashbar/index.js.map +1 -1
  95. package/test-utils/selectors/flashbar/flash.js +1 -1
  96. package/test-utils/selectors/flashbar/flash.js.map +1 -1
  97. package/test-utils/selectors/flashbar/index.js +1 -1
  98. package/test-utils/selectors/flashbar/index.js.map +1 -1
  99. package/test-utils/tsconfig.tsbuildinfo +1 -1
  100. package/tutorial-panel/components/tutorial-detail-view/task.js +1 -1
  101. package/tutorial-panel/components/tutorial-detail-view/task.js.map +1 -1
  102. package/tutorial-panel/components/tutorial-list/index.d.ts.map +1 -1
  103. package/tutorial-panel/components/tutorial-list/index.js +3 -1
  104. package/tutorial-panel/components/tutorial-list/index.js.map +1 -1
  105. package/wizard/index.d.ts.map +1 -1
  106. package/wizard/index.js +2 -20
  107. package/wizard/index.js.map +1 -1
  108. package/wizard/styles.css.js +32 -31
  109. package/wizard/styles.scoped.css +70 -58
  110. package/wizard/styles.selectors.js +32 -31
  111. package/wizard/wizard-form.d.ts.map +1 -1
  112. package/wizard/wizard-form.js +15 -3
  113. package/wizard/wizard-form.js.map +1 -1
@@ -94,10 +94,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
94
94
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
95
95
  SPDX-License-Identifier: Apache-2.0
96
96
  */
97
- .awsui_content-enter_gwq0h_1k4hj_97:not(#\9) {
98
- animation: awsui_awsui-motion-fade-in_gwq0h_1k4hj_1 var(--motion-duration-show-paced-7wspqf, 180ms) var(--motion-easing-show-paced-wj4ybn, ease-out);
97
+ .awsui_content-enter_gwq0h_mztld_97:not(#\9) {
98
+ animation: awsui_awsui-motion-fade-in_gwq0h_mztld_1 var(--motion-duration-show-paced-7wspqf, 180ms) var(--motion-easing-show-paced-wj4ybn, ease-out);
99
99
  }
100
- @keyframes awsui_awsui-motion-fade-in_gwq0h_1k4hj_1 {
100
+ @keyframes awsui_awsui-motion-fade-in_gwq0h_mztld_1 {
101
101
  from {
102
102
  opacity: 0.2;
103
103
  }
@@ -106,40 +106,40 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
106
106
  }
107
107
  }
108
108
  @media (prefers-reduced-motion: reduce) {
109
- .awsui_content-enter_gwq0h_1k4hj_97:not(#\9) {
109
+ .awsui_content-enter_gwq0h_mztld_97:not(#\9) {
110
110
  animation: none;
111
111
  transition: none;
112
112
  }
113
113
  }
114
- .awsui-motion-disabled .awsui_content-enter_gwq0h_1k4hj_97:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_1k4hj_97:not(#\9) {
114
+ .awsui-motion-disabled .awsui_content-enter_gwq0h_mztld_97:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_mztld_97:not(#\9) {
115
115
  animation: none;
116
116
  transition: none;
117
117
  }
118
118
 
119
- .awsui_trigger-expanded_gwq0h_1k4hj_119:not(#\9) {
119
+ .awsui_trigger-expanded_gwq0h_mztld_119:not(#\9) {
120
120
  transition: border-bottom-color var(--motion-duration-show-paced-7wspqf, 180ms) var(--motion-easing-show-paced-wj4ybn, ease-out);
121
121
  }
122
122
  @media (prefers-reduced-motion: reduce) {
123
- .awsui_trigger-expanded_gwq0h_1k4hj_119:not(#\9) {
123
+ .awsui_trigger-expanded_gwq0h_mztld_119:not(#\9) {
124
124
  animation: none;
125
125
  transition: none;
126
126
  }
127
127
  }
128
- .awsui-motion-disabled .awsui_trigger-expanded_gwq0h_1k4hj_119:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_1k4hj_119:not(#\9) {
128
+ .awsui-motion-disabled .awsui_trigger-expanded_gwq0h_mztld_119:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_mztld_119:not(#\9) {
129
129
  animation: none;
130
130
  transition: none;
131
131
  }
132
132
 
133
- .awsui_icon_gwq0h_1k4hj_133:not(#\9) {
133
+ .awsui_icon_gwq0h_mztld_133:not(#\9) {
134
134
  transition: transform var(--motion-duration-rotate-90-ux18sr, 135ms) var(--motion-easing-rotate-90-eoew89, cubic-bezier(0.165, 0.84, 0.44, 1));
135
135
  }
136
136
  @media (prefers-reduced-motion: reduce) {
137
- .awsui_icon_gwq0h_1k4hj_133:not(#\9) {
137
+ .awsui_icon_gwq0h_mztld_133:not(#\9) {
138
138
  animation: none;
139
139
  transition: none;
140
140
  }
141
141
  }
142
- .awsui-motion-disabled .awsui_icon_gwq0h_1k4hj_133:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_1k4hj_133:not(#\9) {
142
+ .awsui-motion-disabled .awsui_icon_gwq0h_mztld_133:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_mztld_133:not(#\9) {
143
143
  animation: none;
144
144
  transition: none;
145
145
  }
@@ -148,7 +148,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
148
148
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
149
149
  SPDX-License-Identifier: Apache-2.0
150
150
  */
151
- .awsui_root_gwq0h_1k4hj_151:not(#\9) {
151
+ .awsui_root_gwq0h_mztld_151:not(#\9) {
152
152
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
153
153
  border-collapse: separate;
154
154
  border-spacing: 0;
@@ -189,20 +189,20 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
189
189
  display: block;
190
190
  }
191
191
 
192
- .awsui_icon_gwq0h_1k4hj_133:not(#\9) {
192
+ .awsui_icon_gwq0h_mztld_133:not(#\9) {
193
193
  transform: rotate(-90deg);
194
194
  }
195
- .awsui_icon_gwq0h_1k4hj_133.awsui_expanded_gwq0h_1k4hj_169:not(#\9) {
195
+ .awsui_icon_gwq0h_mztld_133.awsui_expanded_gwq0h_mztld_169:not(#\9) {
196
196
  transform: rotate(0deg);
197
197
  }
198
198
 
199
- .awsui_icon-container_gwq0h_1k4hj_173:not(#\9) {
199
+ .awsui_icon-container_gwq0h_mztld_173:not(#\9) {
200
200
  position: relative;
201
201
  margin-left: calc((var(--font-body-m-line-height-i7xxvv, 22px) - var(--size-icon-normal-j1z5fn, 16px)) / -2);
202
202
  margin-right: calc(var(--space-xxs-ynfts5, 4px) + var(--border-divider-list-width-hacikr, 1px));
203
203
  }
204
204
 
205
- .awsui_trigger_gwq0h_1k4hj_119:not(#\9) {
205
+ .awsui_trigger_gwq0h_mztld_119:not(#\9) {
206
206
  cursor: pointer;
207
207
  box-sizing: border-box;
208
208
  display: flex;
@@ -211,48 +211,65 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
211
211
  line-height: var(--font-body-m-line-height-i7xxvv, 22px);
212
212
  text-align: left;
213
213
  }
214
- .awsui_trigger-default_gwq0h_1k4hj_188:not(#\9) {
214
+ .awsui_trigger-default_gwq0h_mztld_188:not(#\9) {
215
215
  padding: var(--space-scaled-xxs-95dhkm, 4px) var(--space-xxs-ynfts5, 4px);
216
216
  }
217
- .awsui_trigger-footer_gwq0h_1k4hj_191:not(#\9) {
217
+ .awsui_trigger-footer_gwq0h_mztld_191:not(#\9) {
218
218
  padding: var(--space-scaled-xxs-95dhkm, 4px) 0;
219
219
  }
220
- .awsui_trigger-default_gwq0h_1k4hj_188:not(#\9), .awsui_trigger-footer_gwq0h_1k4hj_191:not(#\9) {
220
+ .awsui_trigger-default_gwq0h_mztld_188:not(#\9), .awsui_trigger-footer_gwq0h_mztld_191:not(#\9) {
221
221
  border: var(--border-divider-section-width-4wm2it, 2px) solid transparent;
222
222
  }
223
- .awsui_trigger-navigation_gwq0h_1k4hj_197:not(#\9) {
223
+ .awsui_trigger-navigation_gwq0h_mztld_197:not(#\9) {
224
224
  border-left: var(--border-divider-section-width-4wm2it, 2px) solid transparent;
225
225
  }
226
- .awsui_trigger-default_gwq0h_1k4hj_188:not(#\9), .awsui_trigger-navigation_gwq0h_1k4hj_197:not(#\9), .awsui_trigger-footer_gwq0h_1k4hj_191:not(#\9) {
226
+ .awsui_trigger-default_gwq0h_mztld_188:not(#\9), .awsui_trigger-navigation_gwq0h_mztld_197:not(#\9), .awsui_trigger-footer_gwq0h_mztld_191:not(#\9) {
227
227
  color: var(--color-text-expandable-section-default-k03p1p, #000716);
228
228
  font-weight: var(--font-heading-s-weight-k8ys41, 800);
229
229
  font-size: var(--font-expandable-heading-size-m2wptt, 16px);
230
230
  letter-spacing: var(--font-heading-s-letter-spacing-4d69jc, -0.005em);
231
231
  }
232
- .awsui_trigger-default_gwq0h_1k4hj_188:not(#\9):hover, .awsui_trigger-navigation_gwq0h_1k4hj_197:not(#\9):hover, .awsui_trigger-footer_gwq0h_1k4hj_191:not(#\9):hover {
232
+ .awsui_trigger-default_gwq0h_mztld_188:not(#\9):hover, .awsui_trigger-navigation_gwq0h_mztld_197:not(#\9):hover, .awsui_trigger-footer_gwq0h_mztld_191:not(#\9):hover {
233
233
  color: var(--color-text-expandable-section-hover-73g3du, #0972d3);
234
234
  }
235
- .awsui_trigger-container_gwq0h_1k4hj_209:not(#\9) {
235
+ .awsui_trigger-container_gwq0h_mztld_209:not(#\9) {
236
236
  padding: var(--space-container-header-vertical-zsjhel, 12px) var(--space-container-horizontal-ddrezg, 24px);
237
237
  }
238
- .awsui_trigger-container_gwq0h_1k4hj_209[data-awsui-focus-visible=true]:not(#\9):focus {
238
+ .awsui_trigger-container_gwq0h_mztld_209[data-awsui-focus-visible=true]:not(#\9):focus {
239
239
  padding: calc(var(--space-scaled-s-cu1hzn, 12px) - var(--border-divider-section-width-4wm2it, 2px)) calc(var(--space-l-4vl6xu, 20px) - var(--border-divider-section-width-4wm2it, 2px));
240
240
  }
241
- .awsui_trigger-default_gwq0h_1k4hj_188.awsui_trigger-expanded_gwq0h_1k4hj_119:not(#\9) {
241
+ .awsui_trigger-default_gwq0h_mztld_188.awsui_trigger-expanded_gwq0h_mztld_119:not(#\9) {
242
242
  border-bottom-color: var(--color-border-divider-default-7s2wjw, #e9ebed);
243
243
  }
244
244
 
245
- .awsui_header_gwq0h_1k4hj_219:not(#\9) {
245
+ .awsui_header_gwq0h_mztld_219:not(#\9) {
246
246
  display: flex;
247
247
  }
248
- .awsui_header-container_gwq0h_1k4hj_222:not(#\9) {
248
+ .awsui_header-container_gwq0h_mztld_222:not(#\9) {
249
249
  width: 100%;
250
250
  }
251
- .awsui_header-container_gwq0h_1k4hj_222 > .awsui_icon-container_gwq0h_1k4hj_173:not(#\9) {
251
+ .awsui_header-container_gwq0h_mztld_222 > .awsui_icon-container_gwq0h_mztld_173:not(#\9) {
252
252
  margin-top: var(--space-expandable-section-icon-offset-top-svbirl, 4px);
253
253
  margin-right: var(--space-xs-rsr2qu, 8px);
254
254
  }
255
- .awsui_header-navigation_gwq0h_1k4hj_229 > .awsui_icon-container_gwq0h_1k4hj_173:not(#\9) {
255
+ .awsui_header-container_gwq0h_mztld_222[data-awsui-focus-visible=true]:not(#\9):focus-within {
256
+ outline: none;
257
+ text-decoration: none;
258
+ padding: calc(var(--space-scaled-s-cu1hzn, 12px) - var(--border-divider-section-width-4wm2it, 2px)) calc(var(--space-l-4vl6xu, 20px) - var(--border-divider-section-width-4wm2it, 2px));
259
+ outline: 2px dotted transparent;
260
+ border: var(--border-field-width-idlekx, 2px) solid var(--color-border-item-focused-ap3b6s, #0972d3);
261
+ border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
262
+ box-shadow: 0 0 0 var(--border-control-focus-ring-shadow-spread-srzyiu, 0px) var(--color-border-item-focused-ap3b6s, #0972d3);
263
+ }
264
+ .awsui_header-container-button_gwq0h_mztld_238:not(#\9):focus {
265
+ outline: none;
266
+ text-decoration: none;
267
+ }
268
+ .awsui_header-container-button_gwq0h_mztld_238 > .awsui_icon-container_gwq0h_mztld_173:not(#\9) {
269
+ margin-top: var(--space-expandable-section-icon-offset-top-svbirl, 4px);
270
+ margin-right: var(--space-xs-rsr2qu, 8px);
271
+ }
272
+ .awsui_header-navigation_gwq0h_mztld_246 > .awsui_icon-container_gwq0h_mztld_173:not(#\9) {
256
273
  display: inline-flex;
257
274
  cursor: pointer;
258
275
  color: var(--color-text-expandable-section-navigation-icon-default-lb9rm0, #414d5c);
@@ -263,17 +280,17 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
263
280
  text-decoration: none;
264
281
  flex-direction: column;
265
282
  }
266
- .awsui_header-navigation_gwq0h_1k4hj_229 > .awsui_icon-container_gwq0h_1k4hj_173:not(#\9):hover {
283
+ .awsui_header-navigation_gwq0h_mztld_246 > .awsui_icon-container_gwq0h_mztld_173:not(#\9):hover {
267
284
  color: var(--color-text-expandable-section-hover-73g3du, #0972d3);
268
285
  }
269
- .awsui_header-navigation_gwq0h_1k4hj_229 > .awsui_icon-container_gwq0h_1k4hj_173[data-awsui-focus-visible=true]:not(#\9):focus {
286
+ .awsui_header-navigation_gwq0h_mztld_246 > .awsui_icon-container_gwq0h_mztld_173[data-awsui-focus-visible=true]:not(#\9):focus {
270
287
  position: relative;
271
288
  }
272
- .awsui_header-navigation_gwq0h_1k4hj_229 > .awsui_icon-container_gwq0h_1k4hj_173[data-awsui-focus-visible=true]:not(#\9):focus {
289
+ .awsui_header-navigation_gwq0h_mztld_246 > .awsui_icon-container_gwq0h_mztld_173[data-awsui-focus-visible=true]:not(#\9):focus {
273
290
  outline: 2px dotted transparent;
274
291
  outline-offset: calc(2px - 1px);
275
292
  }
276
- .awsui_header-navigation_gwq0h_1k4hj_229 > .awsui_icon-container_gwq0h_1k4hj_173[data-awsui-focus-visible=true]:not(#\9):focus::before {
293
+ .awsui_header-navigation_gwq0h_mztld_246 > .awsui_icon-container_gwq0h_mztld_173[data-awsui-focus-visible=true]:not(#\9):focus::before {
277
294
  content: " ";
278
295
  display: block;
279
296
  position: absolute;
@@ -285,24 +302,24 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
285
302
  box-shadow: 0 0 0 2px var(--color-border-item-focused-ap3b6s, #0972d3);
286
303
  }
287
304
 
288
- .awsui_content_gwq0h_1k4hj_97:not(#\9) {
305
+ .awsui_content_gwq0h_mztld_97:not(#\9) {
289
306
  display: none;
290
307
  }
291
- .awsui_content-default_gwq0h_1k4hj_265:not(#\9) {
308
+ .awsui_content-default_gwq0h_mztld_282:not(#\9) {
292
309
  padding: var(--space-scaled-xs-6859qs, 8px) 0;
293
310
  }
294
- .awsui_content-footer_gwq0h_1k4hj_268:not(#\9) {
311
+ .awsui_content-footer_gwq0h_mztld_285:not(#\9) {
295
312
  padding: var(--space-xs-rsr2qu, 8px) 0;
296
313
  }
297
- .awsui_content-expanded_gwq0h_1k4hj_271:not(#\9) {
314
+ .awsui_content-expanded_gwq0h_mztld_288:not(#\9) {
298
315
  display: block;
299
316
  }
300
317
 
301
- .awsui_focusable_gwq0h_1k4hj_275:not(#\9):focus {
318
+ .awsui_focusable_gwq0h_mztld_292:not(#\9):focus {
302
319
  outline: none;
303
320
  text-decoration: none;
304
321
  }
305
- .awsui_focusable_gwq0h_1k4hj_275[data-awsui-focus-visible=true]:not(#\9):focus {
322
+ .awsui_focusable_gwq0h_mztld_292[data-awsui-focus-visible=true]:not(#\9):focus {
306
323
  outline: 2px dotted transparent;
307
324
  border: var(--border-field-width-idlekx, 2px) solid var(--color-border-item-focused-ap3b6s, #0972d3);
308
325
  border-radius: var(--border-radius-control-default-focus-ring-7661kz, 4px);
@@ -2,25 +2,26 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "content-enter": "awsui_content-enter_gwq0h_1k4hj_97",
6
- "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_1k4hj_1",
7
- "trigger-expanded": "awsui_trigger-expanded_gwq0h_1k4hj_119",
8
- "icon": "awsui_icon_gwq0h_1k4hj_133",
9
- "root": "awsui_root_gwq0h_1k4hj_151",
10
- "expanded": "awsui_expanded_gwq0h_1k4hj_169",
11
- "icon-container": "awsui_icon-container_gwq0h_1k4hj_173",
12
- "trigger": "awsui_trigger_gwq0h_1k4hj_119",
13
- "trigger-default": "awsui_trigger-default_gwq0h_1k4hj_188",
14
- "trigger-footer": "awsui_trigger-footer_gwq0h_1k4hj_191",
15
- "trigger-navigation": "awsui_trigger-navigation_gwq0h_1k4hj_197",
16
- "trigger-container": "awsui_trigger-container_gwq0h_1k4hj_209",
17
- "header": "awsui_header_gwq0h_1k4hj_219",
18
- "header-container": "awsui_header-container_gwq0h_1k4hj_222",
19
- "header-navigation": "awsui_header-navigation_gwq0h_1k4hj_229",
20
- "content": "awsui_content_gwq0h_1k4hj_97",
21
- "content-default": "awsui_content-default_gwq0h_1k4hj_265",
22
- "content-footer": "awsui_content-footer_gwq0h_1k4hj_268",
23
- "content-expanded": "awsui_content-expanded_gwq0h_1k4hj_271",
24
- "focusable": "awsui_focusable_gwq0h_1k4hj_275"
5
+ "content-enter": "awsui_content-enter_gwq0h_mztld_97",
6
+ "awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_mztld_1",
7
+ "trigger-expanded": "awsui_trigger-expanded_gwq0h_mztld_119",
8
+ "icon": "awsui_icon_gwq0h_mztld_133",
9
+ "root": "awsui_root_gwq0h_mztld_151",
10
+ "expanded": "awsui_expanded_gwq0h_mztld_169",
11
+ "icon-container": "awsui_icon-container_gwq0h_mztld_173",
12
+ "trigger": "awsui_trigger_gwq0h_mztld_119",
13
+ "trigger-default": "awsui_trigger-default_gwq0h_mztld_188",
14
+ "trigger-footer": "awsui_trigger-footer_gwq0h_mztld_191",
15
+ "trigger-navigation": "awsui_trigger-navigation_gwq0h_mztld_197",
16
+ "trigger-container": "awsui_trigger-container_gwq0h_mztld_209",
17
+ "header": "awsui_header_gwq0h_mztld_219",
18
+ "header-container": "awsui_header-container_gwq0h_mztld_222",
19
+ "header-container-button": "awsui_header-container-button_gwq0h_mztld_238",
20
+ "header-navigation": "awsui_header-navigation_gwq0h_mztld_246",
21
+ "content": "awsui_content_gwq0h_mztld_97",
22
+ "content-default": "awsui_content-default_gwq0h_mztld_282",
23
+ "content-footer": "awsui_content-footer_gwq0h_mztld_285",
24
+ "content-expanded": "awsui_content-expanded_gwq0h_mztld_288",
25
+ "focusable": "awsui_focusable_gwq0h_mztld_292"
25
26
  };
26
27
 
@@ -1,9 +1,9 @@
1
1
  import { FlashbarProps } from './interfaces';
2
2
  import React from 'react';
3
- interface Flash extends FlashbarProps.MessageDefinition {
3
+ export declare const focusFlashById: import("../internal/utils/throttle").ThrottledFunction<(element: HTMLElement | null, itemId: string) => void>;
4
+ export interface FlashProps extends FlashbarProps.MessageDefinition {
4
5
  className: string;
5
6
  transitionState?: string;
6
7
  }
7
- export declare const Flash: React.ForwardRefExoticComponent<Flash & React.RefAttributes<HTMLDivElement>>;
8
- export {};
8
+ export declare const Flash: React.ForwardRefExoticComponent<FlashProps & React.RefAttributes<HTMLDivElement>>;
9
9
  //# sourceMappingURL=flash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"flash.d.ts","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AA6C1B,UAAU,KAAM,SAAQ,aAAa,CAAC,iBAAiB;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,KAAK,8EA4EjB,CAAC"}
1
+ {"version":3,"file":"flash.d.ts","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAkD1B,eAAO,MAAM,cAAc,mEACf,WAAW,GAAG,IAAI,UAAU,MAAM,UAM7C,CAAC;AAEF,MAAM,WAAW,UAAW,SAAQ,aAAa,CAAC,iBAAiB;IACjE,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,KAAK,mFAgGjB,CAAC"}
package/flashbar/flash.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { __assign } from "tslib";
1
2
  import React from 'react';
2
3
  import InternalSpinner from '../spinner/internal';
3
4
  import InternalIcon from '../icon/internal';
@@ -6,6 +7,10 @@ import styles from './styles.css.js';
6
7
  import { InternalButton } from '../button/internal';
7
8
  import { warnOnce } from '../internal/logging';
8
9
  import { isDevelopment } from '../internal/is-development';
10
+ import { throttle } from '../internal/utils/throttle';
11
+ import useFocusVisible from '../internal/hooks/focus-visible';
12
+ import LiveRegion from '../internal/components/live-region';
13
+ var FOCUS_THROTTLE_DELAY = 2000;
9
14
  var ICON_TYPES = {
10
15
  success: 'status-positive',
11
16
  warning: 'status-warning',
@@ -19,9 +24,15 @@ function dismissButton(dismissLabel, onDismiss) {
19
24
  return (React.createElement("div", { className: styles['dismiss-button-wrapper'] },
20
25
  React.createElement(InternalButton, { onClick: onDismiss, className: styles['dismiss-button'], variant: "flashbar-icon", iconName: "close", formAction: "none", ariaLabel: dismissLabel })));
21
26
  }
27
+ export var focusFlashById = throttle(function (element, itemId) {
28
+ var _a;
29
+ var selector = "[data-itemid=\"".concat(CSS.escape(itemId), "\"] .").concat(styles['flash-focus-container']);
30
+ (_a = element === null || element === void 0 ? void 0 : element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.focus();
31
+ }, FOCUS_THROTTLE_DELAY, { trailing: false });
22
32
  export var Flash = React.forwardRef(function (_a, ref) {
23
33
  var _b;
24
- var header = _a.header, content = _a.content, dismissible = _a.dismissible, dismissLabel = _a.dismissLabel, statusIconAriaLabel = _a.statusIconAriaLabel, loading = _a.loading, action = _a.action, buttonText = _a.buttonText, onButtonClick = _a.onButtonClick, onDismiss = _a.onDismiss, className = _a.className, transitionState = _a.transitionState, _c = _a.type, type = _c === void 0 ? 'info' : _c;
34
+ var id = _a.id, header = _a.header, content = _a.content, dismissible = _a.dismissible, dismissLabel = _a.dismissLabel, statusIconAriaLabel = _a.statusIconAriaLabel, loading = _a.loading, action = _a.action, buttonText = _a.buttonText, onButtonClick = _a.onButtonClick, onDismiss = _a.onDismiss, className = _a.className, transitionState = _a.transitionState, ariaRole = _a.ariaRole, _c = _a.type, type = _c === void 0 ? 'info' : _c;
35
+ var focusVisible = useFocusVisible();
25
36
  if (isDevelopment) {
26
37
  if (buttonText && !onButtonClick) {
27
38
  warnOnce('Flashbar', "You provided a `buttonText` prop without an `onButtonClick` handler. This will render a non-interactive action button.");
@@ -34,21 +45,26 @@ export var Flash = React.forwardRef(function (_a, ref) {
34
45
  var iconType = ICON_TYPES[type];
35
46
  var icon = loading ? React.createElement(InternalSpinner, null) : React.createElement(InternalIcon, { name: iconType });
36
47
  var effectiveType = loading ? 'info' : type;
37
- return (React.createElement("div", { ref: ref, className: clsx(styles.flash, styles["flash-type-".concat(effectiveType)], className, transitionState
38
- ? (_b = {},
39
- _b[styles.enter] = transitionState === 'enter',
40
- _b[styles.entering] = transitionState === 'entering',
41
- _b[styles.entered] = transitionState === 'entered',
42
- _b[styles.exit] = transitionState === 'exit',
43
- _b[styles.exiting] = transitionState === 'exiting',
44
- _b[styles.exited] = transitionState === 'exited',
45
- _b) : '') },
46
- React.createElement("div", { className: clsx(styles['flash-icon'], styles['flash-text']), role: "img", "aria-label": statusIconAriaLabel }, icon),
48
+ var announcement = [statusIconAriaLabel, header, content].filter(Boolean).join(' ');
49
+ return (
50
+ // We're not using "polite" or "assertive" here, just turning default behavior off.
51
+ // eslint-disable-next-line @cloudscape-design/prefer-live-region
52
+ React.createElement("div", { ref: ref, role: ariaRole, "aria-live": ariaRole ? 'off' : undefined, "data-itemid": id, className: clsx(styles.flash, styles["flash-type-".concat(effectiveType)], className, transitionState && (_b = {},
53
+ _b[styles.enter] = transitionState === 'enter',
54
+ _b[styles.entering] = transitionState === 'entering',
55
+ _b[styles.entered] = transitionState === 'entered',
56
+ _b[styles.exit] = transitionState === 'exit',
57
+ _b[styles.exiting] = transitionState === 'exiting',
58
+ _b[styles.exited] = transitionState === 'exited',
59
+ _b)) },
47
60
  React.createElement("div", { className: styles['flash-body'] },
48
- React.createElement("div", { className: clsx(styles['flash-message'], styles['flash-text']) },
49
- React.createElement("div", { className: styles['flash-header'] }, header),
50
- React.createElement("div", { className: styles['flash-content'] }, content)),
61
+ React.createElement("div", __assign({}, focusVisible, { className: styles['flash-focus-container'], tabIndex: ariaRole === 'alert' ? -1 : undefined }),
62
+ React.createElement("div", { className: clsx(styles['flash-icon'], styles['flash-text']), role: "img", "aria-label": statusIconAriaLabel }, icon),
63
+ React.createElement("div", { className: clsx(styles['flash-message'], styles['flash-text']) },
64
+ React.createElement("div", { className: styles['flash-header'] }, header),
65
+ React.createElement("div", { className: styles['flash-content'] }, content))),
51
66
  button && React.createElement("div", { className: styles['action-button-wrapper'] }, button)),
52
- dismissible && dismissButton(dismissLabel, onDismiss)));
67
+ dismissible && dismissButton(dismissLabel, onDismiss),
68
+ ariaRole === 'status' && React.createElement(LiveRegion, null, announcement)));
53
69
  });
54
70
  //# sourceMappingURL=flash.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"flash.js","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,MAAM,qBAAqB,CAAC;AAClD,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,MAAM,MAAM,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zG,IAAI,CACD;QACN,6BAAK,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC;YAClC,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;gBACjE,6BAAK,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAAG,MAAM,CAAO;gBACtD,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAAG,OAAO,CAAO,CACpD;YACL,MAAM,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,MAAM,CAAO,CACtE;QACL,WAAW,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,CAClD,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { FlashbarProps } from './interfaces';\nimport React from 'react';\nimport InternalSpinner from '../spinner/internal';\nimport InternalIcon from '../icon/internal';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { InternalButton } from '../button/internal';\nimport { warnOnce } from '../internal/logging';\nimport { isDevelopment } from '../internal/is-development';\n\nconst ICON_TYPES = {\n success: 'status-positive',\n warning: 'status-warning',\n info: 'status-info',\n error: 'status-negative',\n} as const;\n\nfunction actionButton(\n buttonText: FlashbarProps.MessageDefinition['buttonText'],\n onButtonClick: FlashbarProps.MessageDefinition['onButtonClick']\n) {\n return (\n <InternalButton onClick={onButtonClick} className={styles['action-button']} formAction=\"none\">\n {buttonText}\n </InternalButton>\n );\n}\n\nfunction dismissButton(\n dismissLabel: FlashbarProps.MessageDefinition['dismissLabel'],\n onDismiss: FlashbarProps.MessageDefinition['onDismiss']\n) {\n return (\n <div className={styles['dismiss-button-wrapper']}>\n <InternalButton\n onClick={onDismiss}\n className={styles['dismiss-button']}\n variant=\"flashbar-icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissLabel}\n />\n </div>\n );\n}\n\ninterface Flash extends FlashbarProps.MessageDefinition {\n className: string;\n transitionState?: string;\n}\n\nexport const Flash = React.forwardRef(\n (\n {\n header,\n content,\n dismissible,\n dismissLabel,\n statusIconAriaLabel,\n loading,\n action,\n buttonText,\n onButtonClick,\n onDismiss,\n className,\n transitionState,\n type = 'info',\n }: Flash,\n ref: React.Ref<HTMLDivElement>\n ) => {\n if (isDevelopment) {\n if (buttonText && !onButtonClick) {\n warnOnce(\n 'Flashbar',\n `You provided a \\`buttonText\\` prop without an \\`onButtonClick\\` handler. This will render a non-interactive action button.`\n );\n }\n\n if (dismissible && !onDismiss) {\n warnOnce(\n 'Flashbar',\n `You have set the \\`dismissible\\` prop without an \\`onDismiss\\` handler. This will render a non-interactive dismiss button.`\n );\n }\n }\n\n const button = action || (buttonText && actionButton(buttonText, onButtonClick));\n\n const iconType = ICON_TYPES[type];\n\n const icon = loading ? <InternalSpinner /> : <InternalIcon name={iconType} />;\n\n const effectiveType = loading ? 'info' : type;\n\n return (\n <div\n ref={ref}\n className={clsx(\n styles.flash,\n styles[`flash-type-${effectiveType}`],\n className,\n transitionState\n ? {\n [styles.enter]: transitionState === 'enter',\n [styles.entering]: transitionState === 'entering',\n [styles.entered]: transitionState === 'entered',\n [styles.exit]: transitionState === 'exit',\n [styles.exiting]: transitionState === 'exiting',\n [styles.exited]: transitionState === 'exited',\n }\n : ''\n )}\n >\n <div className={clsx(styles['flash-icon'], styles['flash-text'])} role=\"img\" aria-label={statusIconAriaLabel}>\n {icon}\n </div>\n <div className={styles['flash-body']}>\n <div className={clsx(styles['flash-message'], styles['flash-text'])}>\n <div className={styles['flash-header']}>{header}</div>\n <div className={styles['flash-content']}>{content}</div>\n </div>\n {button && <div className={styles['action-button-wrapper']}>{button}</div>}\n </div>\n {dismissible && dismissButton(dismissLabel, onDismiss)}\n </div>\n );\n }\n);\n"]}
1
+ {"version":3,"file":"flash.js","sourceRoot":"","sources":["../../../src/flashbar/flash.tsx"],"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B,IAE9B,IAAI,CACD;gBACN,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;oBACjE,6BAAK,SAAS,EAAE,MAAM,CAAC,cAAc,CAAC,IAAG,MAAM,CAAO;oBACtD,6BAAK,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,IAAG,OAAO,CAAO,CACpD,CACF;YACL,MAAM,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,IAAG,MAAM,CAAO,CACtE;QACL,WAAW,IAAI,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC;QACrD,QAAQ,KAAK,QAAQ,IAAI,oBAAC,UAAU,QAAE,YAAY,CAAc,CAC7D,CACP,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { FlashbarProps } from './interfaces';\nimport React from 'react';\nimport InternalSpinner from '../spinner/internal';\nimport InternalIcon from '../icon/internal';\nimport clsx from 'clsx';\nimport styles from './styles.css.js';\nimport { InternalButton } from '../button/internal';\nimport { warnOnce } from '../internal/logging';\nimport { isDevelopment } from '../internal/is-development';\nimport { throttle } from '../internal/utils/throttle';\nimport useFocusVisible from '../internal/hooks/focus-visible';\nimport LiveRegion from '../internal/components/live-region';\n\nconst FOCUS_THROTTLE_DELAY = 2000;\n\nconst ICON_TYPES = {\n success: 'status-positive',\n warning: 'status-warning',\n info: 'status-info',\n error: 'status-negative',\n} as const;\n\nfunction actionButton(\n buttonText: FlashbarProps.MessageDefinition['buttonText'],\n onButtonClick: FlashbarProps.MessageDefinition['onButtonClick']\n) {\n return (\n <InternalButton onClick={onButtonClick} className={styles['action-button']} formAction=\"none\">\n {buttonText}\n </InternalButton>\n );\n}\n\nfunction dismissButton(\n dismissLabel: FlashbarProps.MessageDefinition['dismissLabel'],\n onDismiss: FlashbarProps.MessageDefinition['onDismiss']\n) {\n return (\n <div className={styles['dismiss-button-wrapper']}>\n <InternalButton\n onClick={onDismiss}\n className={styles['dismiss-button']}\n variant=\"flashbar-icon\"\n iconName=\"close\"\n formAction=\"none\"\n ariaLabel={dismissLabel}\n />\n </div>\n );\n}\n\nexport const focusFlashById = throttle(\n (element: HTMLElement | null, itemId: string) => {\n const selector = `[data-itemid=\"${CSS.escape(itemId)}\"] .${styles['flash-focus-container']}`;\n element?.querySelector<HTMLElement>(selector)?.focus();\n },\n FOCUS_THROTTLE_DELAY,\n { trailing: false }\n);\n\nexport interface FlashProps extends FlashbarProps.MessageDefinition {\n className: string;\n transitionState?: string;\n}\n\nexport const Flash = React.forwardRef(\n (\n {\n id,\n header,\n content,\n dismissible,\n dismissLabel,\n statusIconAriaLabel,\n loading,\n action,\n buttonText,\n onButtonClick,\n onDismiss,\n className,\n transitionState,\n ariaRole,\n type = 'info',\n }: FlashProps,\n ref: React.Ref<HTMLDivElement>\n ) => {\n const focusVisible = useFocusVisible();\n\n if (isDevelopment) {\n if (buttonText && !onButtonClick) {\n warnOnce(\n 'Flashbar',\n `You provided a \\`buttonText\\` prop without an \\`onButtonClick\\` handler. This will render a non-interactive action button.`\n );\n }\n\n if (dismissible && !onDismiss) {\n warnOnce(\n 'Flashbar',\n `You have set the \\`dismissible\\` prop without an \\`onDismiss\\` handler. This will render a non-interactive dismiss button.`\n );\n }\n }\n\n const button = action || (buttonText && actionButton(buttonText, onButtonClick));\n\n const iconType = ICON_TYPES[type];\n\n const icon = loading ? <InternalSpinner /> : <InternalIcon name={iconType} />;\n\n const effectiveType = loading ? 'info' : type;\n\n const announcement = [statusIconAriaLabel, header, content].filter(Boolean).join(' ');\n\n return (\n // We're not using \"polite\" or \"assertive\" here, just turning default behavior off.\n // eslint-disable-next-line @cloudscape-design/prefer-live-region\n <div\n ref={ref}\n role={ariaRole}\n aria-live={ariaRole ? 'off' : undefined}\n data-itemid={id}\n className={clsx(\n styles.flash,\n styles[`flash-type-${effectiveType}`],\n className,\n transitionState && {\n [styles.enter]: transitionState === 'enter',\n [styles.entering]: transitionState === 'entering',\n [styles.entered]: transitionState === 'entered',\n [styles.exit]: transitionState === 'exit',\n [styles.exiting]: transitionState === 'exiting',\n [styles.exited]: transitionState === 'exited',\n }\n )}\n >\n <div className={styles['flash-body']}>\n <div\n {...focusVisible}\n className={styles['flash-focus-container']}\n tabIndex={ariaRole === 'alert' ? -1 : undefined}\n >\n <div\n className={clsx(styles['flash-icon'], styles['flash-text'])}\n role=\"img\"\n aria-label={statusIconAriaLabel}\n >\n {icon}\n </div>\n <div className={clsx(styles['flash-message'], styles['flash-text'])}>\n <div className={styles['flash-header']}>{header}</div>\n <div className={styles['flash-content']}>{content}</div>\n </div>\n </div>\n {button && <div className={styles['action-button-wrapper']}>{button}</div>}\n </div>\n {dismissible && dismissButton(dismissLabel, onDismiss)}\n {ariaRole === 'status' && <LiveRegion>{announcement}</LiveRegion>}\n </div>\n );\n }\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/flashbar/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAc7C,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,aAAa,eAgKtE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/flashbar/index.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAwB,MAAM,cAAc,CAAC;AAenE,OAAO,EAAE,aAAa,EAAE,CAAC;AAEzB,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,KAAK,EAAE,GAAG,SAAS,EAAE,EAAE,aAAa,eA8MtE"}
package/flashbar/index.js CHANGED
@@ -2,10 +2,10 @@ 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
4
  import clsx from 'clsx';
5
- import React, { useState } from 'react';
5
+ import React, { useEffect, useRef, useState } from 'react';
6
6
  import { applyDisplayName } from '../internal/utils/apply-display-name';
7
7
  import customCssProps from '../internal/generated/custom-css-properties';
8
- import { Flash } from './flash';
8
+ import { Flash, focusFlashById } from './flash';
9
9
  import { getBaseProps } from '../internal/base-component';
10
10
  import InternalIcon from '../icon/internal';
11
11
  import { TIMEOUT_FOR_ENTERING_ANIMATION } from './constant';
@@ -21,25 +21,55 @@ import styles from './styles.css.js';
21
21
  export default function Flashbar(_a) {
22
22
  var items = _a.items, restProps = __rest(_a, ["items"]);
23
23
  var __internalRootRef = useBaseComponent('Flashbar').__internalRootRef;
24
- var _b = useContainerBreakpoints(['xs']), breakpoint = _b[0], ref = _b[1];
25
24
  var baseProps = getBaseProps(restProps);
26
- var mergedRef = useMergeRefs(ref, __internalRootRef);
25
+ var ref = useRef(null);
26
+ var _b = useContainerBreakpoints(['xs']), breakpoint = _b[0], breakpointRef = _b[1];
27
+ var mergedRef = useMergeRefs(ref, breakpointRef, __internalRootRef);
27
28
  var isFocusVisible = useFocusVisible();
28
29
  var isVisualRefresh = useVisualRefresh();
30
+ var _c = useState(items), previousItems = _c[0], setPreviousItems = _c[1];
31
+ var _d = useState(null), nextFocusId = _d[0], setNextFocusId = _d[1];
32
+ // Track new or removed item IDs in state to only trigger focus changes for newly added items.
33
+ // https://reactjs.org/docs/hooks-faq.html#how-do-i-implement-getderivedstatefromprops
34
+ if (items) {
35
+ var newItems = items.filter(function (_a) {
36
+ var id = _a.id;
37
+ return id && !previousItems.some(function (item) { return item.id === id; });
38
+ });
39
+ var removedItems = previousItems.filter(function (_a) {
40
+ var id = _a.id;
41
+ return id && !items.some(function (item) { return item.id === id; });
42
+ });
43
+ if (newItems.length > 0 || removedItems.length > 0) {
44
+ setPreviousItems(items);
45
+ var newFocusItems = newItems.filter(function (_a) {
46
+ var ariaRole = _a.ariaRole;
47
+ return ariaRole === 'alert';
48
+ });
49
+ if (newFocusItems.length > 0) {
50
+ setNextFocusId(newFocusItems[0].id);
51
+ }
52
+ }
53
+ }
54
+ useEffect(function () {
55
+ if (nextFocusId) {
56
+ focusFlashById(ref.current, nextFocusId);
57
+ }
58
+ }, [nextFocusId]);
29
59
  /**
30
60
  * All the flash items should have ids so we can identify which DOM element is being
31
61
  * removed from the DOM to animate it. Motion will be disabled if any of the provided
32
62
  * flash messages does not contain an `id`.
33
63
  */
34
- var motionDisabled = useReducedMotion(ref) || !isVisualRefresh || (items && !items.every(function (item) { return 'id' in item; }));
64
+ var motionDisabled = useReducedMotion(breakpointRef) || !isVisualRefresh || (items && !items.every(function (item) { return 'id' in item; }));
35
65
  /**
36
66
  * The `stackItems` property is a hidden boolean that allows for teams
37
67
  * to beta test the flashbar stacking feature.
38
68
  */
39
- var stackItems = restProps.stackItems;
40
- var ariaLabels = restProps.ariaLabels;
69
+ var stackItems = isStackedFlashbar(restProps);
70
+ var ariaLabels = stackItems ? restProps.ariaLabels : {};
41
71
  var isFlashbarStacked = stackItems && (items === null || items === void 0 ? void 0 : items.length) > 3;
42
- var _c = useState(false), isFlashbarStackExpanded = _c[0], setIsFlashbarStackExpanded = _c[1];
72
+ var _e = useState(false), isFlashbarStackExpanded = _e[0], setIsFlashbarStackExpanded = _e[1];
43
73
  /**
44
74
  * Compute the appropriate aria label for the stacked notifications toggle button
45
75
  * based on the expanded/collapsed state of the stack and the presence of
@@ -73,12 +103,17 @@ export default function Flashbar(_a) {
73
103
  var _a;
74
104
  var _b, _c;
75
105
  return (React.createElement("div", { className: styles.item, style: (_a = {}, _a[customCssProps.flashbarStackIndex] = index, _a), key: index },
76
- index === 0 && renderItem(item, (_b = item.id) !== null && _b !== void 0 ? _b : index),
106
+ index === 0 && (React.createElement("ul", { className: styles['flash-list'] },
107
+ React.createElement("li", { className: styles['flash-list-item'] }, renderItem(item, (_b = item.id) !== null && _b !== void 0 ? _b : index)))),
77
108
  index > 0 && React.createElement("div", { className: clsx(styles.flash, styles["flash-type-".concat((_c = item.type) !== null && _c !== void 0 ? _c : 'info')]) })));
78
109
  }))),
79
- isFlashbarStackExpanded && (React.createElement("div", { className: styles.expanded }, items.map(function (item, index) { var _a; return renderItem(item, (_a = item.id) !== null && _a !== void 0 ? _a : index); }))),
110
+ isFlashbarStackExpanded && (React.createElement("ul", { className: clsx(styles['flash-list'], styles.expanded) }, items.map(function (item, index) {
111
+ var _a, _b;
112
+ return (React.createElement("li", { key: (_a = item.id) !== null && _a !== void 0 ? _a : index, className: styles['flash-list-item'] }, renderItem(item, (_b = item.id) !== null && _b !== void 0 ? _b : index)));
113
+ }))),
80
114
  React.createElement("button", __assign({ "aria-label": getStackButtonAriaLabel(), className: clsx(styles.toggle, isVisualRefresh && styles['visual-refresh']), onClick: function () { return setIsFlashbarStackExpanded(!isFlashbarStackExpanded); } }, isFocusVisible),
81
- React.createElement(InternalIcon, { className: clsx(styles.icon, isFlashbarStackExpanded && styles.expanded), size: "small", name: "angle-down" }))));
115
+ React.createElement("span", { className: clsx(styles.icon, isFlashbarStackExpanded && styles.expanded) },
116
+ React.createElement(InternalIcon, { size: "small", name: "angle-down" })))));
82
117
  }
83
118
  /**
84
119
  * If the flashbar is flat and motion is `enabled` then the adding and removing of items
@@ -88,10 +123,16 @@ export default function Flashbar(_a) {
88
123
  if (isFlashbarStacked || motionDisabled || !items) {
89
124
  return;
90
125
  }
91
- return (React.createElement(TransitionGroup, { component: null }, items &&
126
+ return (
127
+ // This is a proxy for <ul>, so we're not applying a class to another actual component.
128
+ // eslint-disable-next-line react/forbid-component-props
129
+ React.createElement(TransitionGroup, { component: "ul", className: styles['flash-list'] }, items &&
92
130
  items.map(function (item, index) {
93
131
  var _a;
94
- return (React.createElement(Transition, { transitionChangeDelay: { entering: TIMEOUT_FOR_ENTERING_ANIMATION }, key: (_a = item.id) !== null && _a !== void 0 ? _a : index, "in": true }, function (state, transitionRootElement) { var _a; return renderItem(item, (_a = item.id) !== null && _a !== void 0 ? _a : index, transitionRootElement, state); }));
132
+ return (React.createElement(Transition, { transitionChangeDelay: { entering: TIMEOUT_FOR_ENTERING_ANIMATION }, key: (_a = item.id) !== null && _a !== void 0 ? _a : index, "in": true }, function (state, transitionRootElement) {
133
+ var _a;
134
+ return (React.createElement("li", { className: styles['flash-list-item'] }, renderItem(item, (_a = item.id) !== null && _a !== void 0 ? _a : index, transitionRootElement, state)));
135
+ }));
95
136
  })));
96
137
  }
97
138
  /**
@@ -102,7 +143,10 @@ export default function Flashbar(_a) {
102
143
  if (isFlashbarStacked || !motionDisabled || !items) {
103
144
  return;
104
145
  }
105
- return React.createElement(React.Fragment, null, items.map(function (item, index) { var _a; return renderItem(item, (_a = item.id) !== null && _a !== void 0 ? _a : index); }));
146
+ return (React.createElement("ul", { className: styles['flash-list'] }, items.map(function (item, index) {
147
+ var _a, _b;
148
+ return (React.createElement("li", { key: (_a = item.id) !== null && _a !== void 0 ? _a : index, className: styles['flash-list-item'] }, renderItem(item, (_b = item.id) !== null && _b !== void 0 ? _b : index)));
149
+ })));
106
150
  }
107
151
  /**
108
152
  * This is a shared render function for a single flashbar item to be used
@@ -120,5 +164,8 @@ export default function Flashbar(_a) {
120
164
  renderFlatItemsWithTransitions(),
121
165
  renderFlatItemsWithoutTransitions()));
122
166
  }
167
+ function isStackedFlashbar(props) {
168
+ return 'stackItems' in props && !!props.stackItems;
169
+ }
123
170
  applyDisplayName(Flashbar, 'Flashbar');
124
171
  //# sourceMappingURL=index.js.map