@cloudscape-design/components 3.0.306 → 3.0.308
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.
- package/alert/internal.d.ts.map +1 -1
- package/alert/internal.js +5 -1
- package/alert/internal.js.map +1 -1
- package/breadcrumb-group/item/item.d.ts.map +1 -1
- package/breadcrumb-group/item/item.js +7 -5
- package/breadcrumb-group/item/item.js.map +1 -1
- package/column-layout/interfaces.d.ts +1 -3
- package/column-layout/interfaces.d.ts.map +1 -1
- package/column-layout/interfaces.js.map +1 -1
- package/expandable-section/expandable-section-header.d.ts.map +1 -1
- package/expandable-section/expandable-section-header.js +6 -7
- package/expandable-section/expandable-section-header.js.map +1 -1
- package/expandable-section/styles.css.js +27 -26
- package/expandable-section/styles.scoped.css +51 -47
- package/expandable-section/styles.selectors.js +27 -26
- package/flashbar/flash.d.ts.map +1 -1
- package/flashbar/flash.js +6 -2
- package/flashbar/flash.js.map +1 -1
- package/form-field/internal.d.ts.map +1 -1
- package/form-field/internal.js +8 -10
- package/form-field/internal.js.map +1 -1
- package/header/internal.d.ts.map +1 -1
- package/header/internal.js +2 -1
- package/header/internal.js.map +1 -1
- package/i18n/messages/all.all.d.ts +1 -1
- package/i18n/messages/all.de.d.ts +1 -1
- package/i18n/messages/all.en-GB.d.ts +1 -1
- package/i18n/messages/all.en.d.ts +1 -1
- package/i18n/messages/all.es.d.ts +1 -1
- package/i18n/messages/all.fr.d.ts +1 -1
- package/i18n/messages/all.id.d.ts +1 -1
- package/i18n/messages/all.it.d.ts +1 -1
- package/i18n/messages/all.ja.d.ts +1 -1
- package/i18n/messages/all.ko.d.ts +1 -1
- package/i18n/messages/all.pt-BR.d.ts +1 -1
- package/i18n/messages/all.zh-CN.d.ts +1 -1
- package/i18n/messages/all.zh-TW.d.ts +1 -1
- package/internal/analytics/components/analytics-funnel.d.ts.map +1 -1
- package/internal/analytics/components/analytics-funnel.js +3 -2
- package/internal/analytics/components/analytics-funnel.js.map +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts +1 -1
- package/internal/analytics/hooks/use-funnel.d.ts.map +1 -1
- package/internal/analytics/hooks/use-funnel.js +5 -5
- package/internal/analytics/hooks/use-funnel.js.map +1 -1
- package/internal/analytics/interfaces.d.ts +2 -2
- package/internal/analytics/interfaces.d.ts.map +1 -1
- package/internal/analytics/interfaces.js.map +1 -1
- package/internal/analytics/selectors.d.ts +15 -1
- package/internal/analytics/selectors.d.ts.map +1 -1
- package/internal/analytics/selectors.js +19 -5
- package/internal/analytics/selectors.js.map +1 -1
- package/internal/environment.js +1 -1
- package/internal/i18n/messages/all.all.d.ts +1 -1
- package/internal/i18n/messages/all.de.d.ts +1 -1
- package/internal/i18n/messages/all.en-GB.d.ts +1 -1
- package/internal/i18n/messages/all.en.d.ts +1 -1
- package/internal/i18n/messages/all.es.d.ts +1 -1
- package/internal/i18n/messages/all.fr.d.ts +1 -1
- package/internal/i18n/messages/all.id.d.ts +1 -1
- package/internal/i18n/messages/all.it.d.ts +1 -1
- package/internal/i18n/messages/all.ja.d.ts +1 -1
- package/internal/i18n/messages/all.ko.d.ts +1 -1
- package/internal/i18n/messages/all.pt-BR.d.ts +1 -1
- package/internal/i18n/messages/all.zh-CN.d.ts +1 -1
- package/internal/i18n/messages/all.zh-TW.d.ts +1 -1
- package/internal/manifest.json +1 -1
- package/link/internal.js +4 -4
- package/link/internal.js.map +1 -1
- package/modal/styles.css.js +23 -23
- package/modal/styles.scoped.css +39 -38
- package/modal/styles.selectors.js +23 -23
- package/package.json +1 -1
- package/split-panel/styles.css.js +59 -59
- package/split-panel/styles.scoped.css +83 -81
- package/split-panel/styles.selectors.js +59 -59
- package/test-utils/dom/expandable-section/index.d.ts +1 -0
- package/test-utils/dom/expandable-section/index.js +6 -0
- package/test-utils/dom/expandable-section/index.js.map +1 -1
- package/test-utils/selectors/expandable-section/index.d.ts +1 -0
- package/test-utils/selectors/expandable-section/index.js +6 -0
- package/test-utils/selectors/expandable-section/index.js.map +1 -1
- package/test-utils/tsconfig.tsbuildinfo +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-
|
|
98
|
-
animation: awsui_awsui-motion-fade-
|
|
97
|
+
.awsui_content-enter_gwq0h_ohtdp_97:not(#\9) {
|
|
98
|
+
animation: awsui_awsui-motion-fade-in_gwq0h_ohtdp_1 var(--motion-duration-show-paced-uryptc, 180ms) var(--motion-easing-show-paced-tbgeqx, ease-out);
|
|
99
99
|
}
|
|
100
|
-
@keyframes awsui_awsui-motion-fade-
|
|
100
|
+
@keyframes awsui_awsui-motion-fade-in_gwq0h_ohtdp_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-
|
|
109
|
+
.awsui_content-enter_gwq0h_ohtdp_97:not(#\9) {
|
|
110
110
|
animation: none;
|
|
111
111
|
transition: none;
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
.awsui-motion-disabled .awsui_content-
|
|
114
|
+
.awsui-motion-disabled .awsui_content-enter_gwq0h_ohtdp_97:not(#\9), .awsui-mode-entering .awsui_content-enter_gwq0h_ohtdp_97:not(#\9) {
|
|
115
115
|
animation: none;
|
|
116
116
|
transition: none;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
-
.awsui_trigger-
|
|
119
|
+
.awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9) {
|
|
120
120
|
transition: border-bottom-color var(--motion-duration-show-paced-uryptc, 180ms) var(--motion-easing-show-paced-tbgeqx, ease-out);
|
|
121
121
|
}
|
|
122
122
|
@media (prefers-reduced-motion: reduce) {
|
|
123
|
-
.awsui_trigger-
|
|
123
|
+
.awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9) {
|
|
124
124
|
animation: none;
|
|
125
125
|
transition: none;
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
.awsui-motion-disabled .awsui_trigger-
|
|
128
|
+
.awsui-motion-disabled .awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9), .awsui-mode-entering .awsui_trigger-expanded_gwq0h_ohtdp_119:not(#\9) {
|
|
129
129
|
animation: none;
|
|
130
130
|
transition: none;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
.
|
|
133
|
+
.awsui_icon_gwq0h_ohtdp_133:not(#\9) {
|
|
134
134
|
transition: transform var(--motion-duration-rotate-90-jfxxiy, 135ms) var(--motion-easing-rotate-90-ax5lt7, cubic-bezier(0.165, 0.84, 0.44, 1));
|
|
135
135
|
}
|
|
136
136
|
@media (prefers-reduced-motion: reduce) {
|
|
137
|
-
.
|
|
137
|
+
.awsui_icon_gwq0h_ohtdp_133:not(#\9) {
|
|
138
138
|
animation: none;
|
|
139
139
|
transition: none;
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
.awsui-motion-disabled .
|
|
142
|
+
.awsui-motion-disabled .awsui_icon_gwq0h_ohtdp_133:not(#\9), .awsui-mode-entering .awsui_icon_gwq0h_ohtdp_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
|
-
.
|
|
151
|
+
.awsui_root_gwq0h_ohtdp_151:not(#\9) {
|
|
152
152
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
153
153
|
border-collapse: separate;
|
|
154
154
|
border-spacing: 0;
|
|
@@ -191,23 +191,27 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
191
191
|
display: block;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
.
|
|
194
|
+
.awsui_expand-button_gwq0h_ohtdp_168:not(#\9) {
|
|
195
|
+
/* used in test-utils */
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.awsui_icon_gwq0h_ohtdp_133:not(#\9) {
|
|
195
199
|
transform: rotate(-90deg);
|
|
196
200
|
}
|
|
197
|
-
.
|
|
201
|
+
.awsui_icon_gwq0h_ohtdp_133.awsui_expanded_gwq0h_ohtdp_175:not(#\9) {
|
|
198
202
|
transform: rotate(0deg);
|
|
199
203
|
}
|
|
200
204
|
|
|
201
|
-
.awsui_icon-
|
|
205
|
+
.awsui_icon-container_gwq0h_ohtdp_179:not(#\9) {
|
|
202
206
|
position: relative;
|
|
203
207
|
margin-left: calc((var(--font-body-m-line-height-rfgrp9, 22px) - var(--size-icon-normal-jq6jat, 16px)) / -2);
|
|
204
208
|
margin-right: calc(var(--space-xxs-ja5cp8, 4px) + var(--border-divider-list-width-um3zli, 1px));
|
|
205
209
|
}
|
|
206
|
-
.awsui_icon-container-
|
|
210
|
+
.awsui_icon-container-container_gwq0h_ohtdp_184:not(#\9) {
|
|
207
211
|
margin-right: var(--space-xs-edba2s, 8px);
|
|
208
212
|
}
|
|
209
213
|
|
|
210
|
-
.
|
|
214
|
+
.awsui_wrapper_gwq0h_ohtdp_188:not(#\9) {
|
|
211
215
|
box-sizing: border-box;
|
|
212
216
|
display: flex;
|
|
213
217
|
border: none;
|
|
@@ -215,19 +219,19 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
215
219
|
line-height: var(--font-body-m-line-height-rfgrp9, 22px);
|
|
216
220
|
text-align: left;
|
|
217
221
|
}
|
|
218
|
-
.awsui_wrapper-
|
|
222
|
+
.awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9) {
|
|
219
223
|
padding: var(--space-scaled-xxs-t2t62i, 4px) var(--space-xxs-ja5cp8, 4px);
|
|
220
224
|
}
|
|
221
|
-
.awsui_wrapper-
|
|
225
|
+
.awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9) {
|
|
222
226
|
padding: var(--space-scaled-xxs-t2t62i, 4px) 0;
|
|
223
227
|
}
|
|
224
|
-
.awsui_wrapper-
|
|
228
|
+
.awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9), .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9) {
|
|
225
229
|
border: var(--border-divider-section-width-orq175, 2px) solid transparent;
|
|
226
230
|
}
|
|
227
|
-
.awsui_wrapper-
|
|
231
|
+
.awsui_wrapper-navigation_gwq0h_ohtdp_205:not(#\9) {
|
|
228
232
|
border-left: var(--border-divider-section-width-orq175, 2px) solid transparent;
|
|
229
233
|
}
|
|
230
|
-
.awsui_wrapper-
|
|
234
|
+
.awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9), .awsui_wrapper-navigation_gwq0h_ohtdp_205:not(#\9), .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9) {
|
|
231
235
|
color: var(--color-text-expandable-section-default-fvf8va, #000716);
|
|
232
236
|
font-weight: var(--font-heading-s-weight-5y5giq, 800);
|
|
233
237
|
-webkit-font-smoothing: var(--font-smoothing-webkit-fyh4as, antialiased);
|
|
@@ -235,41 +239,41 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
235
239
|
font-size: var(--font-expandable-heading-size-mkp9vq, 16px);
|
|
236
240
|
letter-spacing: var(--font-heading-s-letter-spacing-j4vcrt, -0.005em);
|
|
237
241
|
}
|
|
238
|
-
.awsui_wrapper-
|
|
242
|
+
.awsui_wrapper-default_gwq0h_ohtdp_196:not(#\9):hover, .awsui_wrapper-navigation_gwq0h_ohtdp_205:not(#\9):hover, .awsui_wrapper-footer_gwq0h_ohtdp_199:not(#\9):hover {
|
|
239
243
|
color: var(--color-text-expandable-section-hover-o9ggrx, #0972d3);
|
|
240
244
|
}
|
|
241
|
-
.awsui_wrapper-
|
|
245
|
+
.awsui_wrapper-container_gwq0h_ohtdp_219:not(#\9) {
|
|
242
246
|
padding: var(--space-container-header-vertical-di96ce, 12px) var(--space-container-horizontal-jxdgil, 20px);
|
|
243
247
|
}
|
|
244
|
-
body[data-awsui-focus-visible=true] .awsui_wrapper-
|
|
248
|
+
body[data-awsui-focus-visible=true] .awsui_wrapper-container_gwq0h_ohtdp_219:not(#\9):focus {
|
|
245
249
|
padding: calc(var(--space-scaled-s-913kwi, 12px) - var(--border-divider-section-width-orq175, 2px)) calc(var(--space-l-f4l5gr, 20px) - var(--border-divider-section-width-orq175, 2px));
|
|
246
250
|
}
|
|
247
|
-
.awsui_wrapper-
|
|
251
|
+
.awsui_wrapper-default_gwq0h_ohtdp_196.awsui_wrapper-expanded_gwq0h_ohtdp_225:not(#\9) {
|
|
248
252
|
border-bottom-color: var(--color-border-divider-default-9o8zql, #e9ebed);
|
|
249
253
|
}
|
|
250
254
|
|
|
251
|
-
.
|
|
255
|
+
.awsui_header_gwq0h_ohtdp_229:not(#\9) {
|
|
252
256
|
display: flex;
|
|
253
257
|
}
|
|
254
|
-
.awsui_header-
|
|
258
|
+
.awsui_header-wrapper_gwq0h_ohtdp_232:not(#\9) {
|
|
255
259
|
font-weight: inherit;
|
|
256
260
|
font-size: inherit;
|
|
257
261
|
letter-spacing: inherit;
|
|
258
262
|
margin: 0;
|
|
259
263
|
padding: 0;
|
|
260
264
|
}
|
|
261
|
-
.awsui_header-
|
|
265
|
+
.awsui_header-button_gwq0h_ohtdp_239:not(#\9) {
|
|
262
266
|
box-sizing: border-box;
|
|
263
267
|
display: flex;
|
|
264
268
|
}
|
|
265
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
269
|
+
body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9):focus {
|
|
266
270
|
position: relative;
|
|
267
271
|
}
|
|
268
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
272
|
+
body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9):focus, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9):focus {
|
|
269
273
|
outline: 2px dotted transparent;
|
|
270
274
|
outline-offset: calc(0px - 1px);
|
|
271
275
|
}
|
|
272
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
276
|
+
body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_ohtdp_239:not(#\9):focus::before, body[data-awsui-focus-visible=true] .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9):focus::before {
|
|
273
277
|
content: " ";
|
|
274
278
|
display: block;
|
|
275
279
|
position: absolute;
|
|
@@ -280,19 +284,19 @@ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_1g95t_235:not(#\9
|
|
|
280
284
|
border-radius: var(--border-radius-control-default-focus-ring-muizvi, 4px);
|
|
281
285
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-4t19h5, #0972d3);
|
|
282
286
|
}
|
|
283
|
-
.
|
|
287
|
+
.awsui_header_gwq0h_ohtdp_229:not(#\9):not(.awsui_with-interactive-elements_gwq0h_ohtdp_261) {
|
|
284
288
|
cursor: pointer;
|
|
285
289
|
}
|
|
286
|
-
.awsui_header-
|
|
290
|
+
.awsui_header-container_gwq0h_ohtdp_243:not(#\9) {
|
|
287
291
|
width: 100%;
|
|
288
292
|
}
|
|
289
|
-
.awsui_header-
|
|
293
|
+
.awsui_header-container_gwq0h_ohtdp_243 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9) {
|
|
290
294
|
margin-top: var(--space-expandable-section-icon-offset-top-qfofw6, 4px);
|
|
291
295
|
}
|
|
292
|
-
.awsui_header-
|
|
296
|
+
.awsui_header-container_gwq0h_ohtdp_243.awsui_with-interactive-elements_gwq0h_ohtdp_261 .awsui_header-container-button_gwq0h_ohtdp_243:not(#\9) {
|
|
293
297
|
cursor: pointer;
|
|
294
298
|
}
|
|
295
|
-
.awsui_header-
|
|
299
|
+
.awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9) {
|
|
296
300
|
display: inline-flex;
|
|
297
301
|
cursor: pointer;
|
|
298
302
|
color: var(--color-text-expandable-section-navigation-icon-default-lzmj1u, #414d5c);
|
|
@@ -303,17 +307,17 @@ body[data-awsui-focus-visible=true] .awsui_header-button_gwq0h_1g95t_235:not(#\9
|
|
|
303
307
|
text-decoration: none;
|
|
304
308
|
flex-direction: column;
|
|
305
309
|
}
|
|
306
|
-
.awsui_header-
|
|
310
|
+
.awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):hover {
|
|
307
311
|
color: var(--color-text-expandable-section-hover-o9ggrx, #0972d3);
|
|
308
312
|
}
|
|
309
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
313
|
+
body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):focus {
|
|
310
314
|
position: relative;
|
|
311
315
|
}
|
|
312
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
316
|
+
body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):focus {
|
|
313
317
|
outline: 2px dotted transparent;
|
|
314
318
|
outline-offset: calc(2px - 1px);
|
|
315
319
|
}
|
|
316
|
-
body[data-awsui-focus-visible=true] .awsui_header-
|
|
320
|
+
body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_ohtdp_273 > .awsui_icon-container_gwq0h_ohtdp_179:not(#\9):focus::before {
|
|
317
321
|
content: " ";
|
|
318
322
|
display: block;
|
|
319
323
|
position: absolute;
|
|
@@ -325,24 +329,24 @@ body[data-awsui-focus-visible=true] .awsui_header-navigation_gwq0h_1g95t_269 > .
|
|
|
325
329
|
box-shadow: 0 0 0 2px var(--color-border-item-focused-4t19h5, #0972d3);
|
|
326
330
|
}
|
|
327
331
|
|
|
328
|
-
.
|
|
332
|
+
.awsui_content_gwq0h_ohtdp_97:not(#\9) {
|
|
329
333
|
display: none;
|
|
330
334
|
}
|
|
331
|
-
.awsui_content-
|
|
335
|
+
.awsui_content-default_gwq0h_ohtdp_309:not(#\9) {
|
|
332
336
|
padding: var(--space-scaled-xs-wbfgrv, 8px) 0;
|
|
333
337
|
}
|
|
334
|
-
.awsui_content-
|
|
338
|
+
.awsui_content-footer_gwq0h_ohtdp_312:not(#\9) {
|
|
335
339
|
padding: var(--space-xs-edba2s, 8px) 0;
|
|
336
340
|
}
|
|
337
|
-
.awsui_content-
|
|
341
|
+
.awsui_content-expanded_gwq0h_ohtdp_315:not(#\9) {
|
|
338
342
|
display: block;
|
|
339
343
|
}
|
|
340
344
|
|
|
341
|
-
.
|
|
345
|
+
.awsui_focusable_gwq0h_ohtdp_319:not(#\9):focus {
|
|
342
346
|
outline: none;
|
|
343
347
|
text-decoration: none;
|
|
344
348
|
}
|
|
345
|
-
body[data-awsui-focus-visible=true] .
|
|
349
|
+
body[data-awsui-focus-visible=true] .awsui_focusable_gwq0h_ohtdp_319:not(#\9):focus {
|
|
346
350
|
outline: 2px dotted transparent;
|
|
347
351
|
border: var(--border-field-width-riro62, 2px) solid var(--color-border-item-focused-4t19h5, #0972d3);
|
|
348
352
|
border-radius: var(--border-radius-control-default-focus-ring-muizvi, 4px);
|
|
@@ -2,31 +2,32 @@
|
|
|
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-
|
|
6
|
-
"awsui-motion-fade-in": "awsui_awsui-motion-fade-
|
|
7
|
-
"trigger-expanded": "awsui_trigger-
|
|
8
|
-
"icon": "
|
|
9
|
-
"root": "
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"icon-container
|
|
13
|
-
"
|
|
14
|
-
"wrapper
|
|
15
|
-
"wrapper-
|
|
16
|
-
"wrapper-
|
|
17
|
-
"wrapper-
|
|
18
|
-
"wrapper-
|
|
19
|
-
"
|
|
20
|
-
"header
|
|
21
|
-
"header-
|
|
22
|
-
"header-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"header-
|
|
26
|
-
"
|
|
27
|
-
"content
|
|
28
|
-
"content-
|
|
29
|
-
"content-
|
|
30
|
-
"
|
|
5
|
+
"content-enter": "awsui_content-enter_gwq0h_ohtdp_97",
|
|
6
|
+
"awsui-motion-fade-in": "awsui_awsui-motion-fade-in_gwq0h_ohtdp_1",
|
|
7
|
+
"trigger-expanded": "awsui_trigger-expanded_gwq0h_ohtdp_119",
|
|
8
|
+
"icon": "awsui_icon_gwq0h_ohtdp_133",
|
|
9
|
+
"root": "awsui_root_gwq0h_ohtdp_151",
|
|
10
|
+
"expand-button": "awsui_expand-button_gwq0h_ohtdp_168",
|
|
11
|
+
"expanded": "awsui_expanded_gwq0h_ohtdp_175",
|
|
12
|
+
"icon-container": "awsui_icon-container_gwq0h_ohtdp_179",
|
|
13
|
+
"icon-container-container": "awsui_icon-container-container_gwq0h_ohtdp_184",
|
|
14
|
+
"wrapper": "awsui_wrapper_gwq0h_ohtdp_188",
|
|
15
|
+
"wrapper-default": "awsui_wrapper-default_gwq0h_ohtdp_196",
|
|
16
|
+
"wrapper-footer": "awsui_wrapper-footer_gwq0h_ohtdp_199",
|
|
17
|
+
"wrapper-navigation": "awsui_wrapper-navigation_gwq0h_ohtdp_205",
|
|
18
|
+
"wrapper-container": "awsui_wrapper-container_gwq0h_ohtdp_219",
|
|
19
|
+
"wrapper-expanded": "awsui_wrapper-expanded_gwq0h_ohtdp_225",
|
|
20
|
+
"header": "awsui_header_gwq0h_ohtdp_229",
|
|
21
|
+
"header-wrapper": "awsui_header-wrapper_gwq0h_ohtdp_232",
|
|
22
|
+
"header-button": "awsui_header-button_gwq0h_ohtdp_239",
|
|
23
|
+
"header-container-button": "awsui_header-container-button_gwq0h_ohtdp_243",
|
|
24
|
+
"with-interactive-elements": "awsui_with-interactive-elements_gwq0h_ohtdp_261",
|
|
25
|
+
"header-container": "awsui_header-container_gwq0h_ohtdp_243",
|
|
26
|
+
"header-navigation": "awsui_header-navigation_gwq0h_ohtdp_273",
|
|
27
|
+
"content": "awsui_content_gwq0h_ohtdp_97",
|
|
28
|
+
"content-default": "awsui_content-default_gwq0h_ohtdp_309",
|
|
29
|
+
"content-footer": "awsui_content-footer_gwq0h_ohtdp_312",
|
|
30
|
+
"content-expanded": "awsui_content-expanded_gwq0h_ohtdp_315",
|
|
31
|
+
"focusable": "awsui_focusable_gwq0h_ohtdp_319"
|
|
31
32
|
};
|
|
32
33
|
|
package/flashbar/flash.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flash.d.ts","sourceRoot":"lib/default/","sources":["flashbar/flash.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"flash.d.ts","sourceRoot":"lib/default/","sources":["flashbar/flash.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAqD1B,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,mFAsGjB,CAAC"}
|
package/flashbar/flash.js
CHANGED
|
@@ -10,6 +10,7 @@ import { throttle } from '../internal/utils/throttle';
|
|
|
10
10
|
import LiveRegion from '../internal/components/live-region';
|
|
11
11
|
import { sendDismissMetric } from './internal/analytics';
|
|
12
12
|
import { FOCUS_THROTTLE_DELAY } from './utils';
|
|
13
|
+
import { DATA_ATTR_ANALYTICS_FLASHBAR } from '../internal/analytics/selectors';
|
|
13
14
|
const ICON_TYPES = {
|
|
14
15
|
success: 'status-positive',
|
|
15
16
|
warning: 'status-warning',
|
|
@@ -45,17 +46,20 @@ export const Flash = React.forwardRef(({ id, header, content, dismissible, dismi
|
|
|
45
46
|
sendDismissMetric(effectiveType);
|
|
46
47
|
onDismiss && onDismiss(event);
|
|
47
48
|
};
|
|
49
|
+
const analyticsAttributes = {
|
|
50
|
+
[DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType,
|
|
51
|
+
};
|
|
48
52
|
return (
|
|
49
53
|
// We're not using "polite" or "assertive" here, just turning default behavior off.
|
|
50
54
|
// eslint-disable-next-line @cloudscape-design/prefer-live-region
|
|
51
|
-
React.createElement("div", { ref: ref, role: ariaRole, "aria-live": ariaRole ? 'off' : undefined, "data-
|
|
55
|
+
React.createElement("div", Object.assign({ ref: ref, role: ariaRole, "aria-live": ariaRole ? 'off' : undefined, "data-itemid": id, className: clsx(styles.flash, styles[`flash-type-${effectiveType}`], className, transitionState && {
|
|
52
56
|
[styles.enter]: transitionState === 'enter',
|
|
53
57
|
[styles.entering]: transitionState === 'entering',
|
|
54
58
|
[styles.entered]: transitionState === 'entered',
|
|
55
59
|
[styles.exit]: transitionState === 'exit',
|
|
56
60
|
[styles.exiting]: transitionState === 'exiting',
|
|
57
61
|
[styles.exited]: transitionState === 'exited',
|
|
58
|
-
}) },
|
|
62
|
+
}) }, analyticsAttributes),
|
|
59
63
|
React.createElement("div", { className: styles['flash-body'] },
|
|
60
64
|
React.createElement("div", { className: styles['flash-focus-container'], tabIndex: -1 },
|
|
61
65
|
React.createElement("div", { className: clsx(styles['flash-icon'], styles['flash-text']), role: "img", "aria-label": statusIconAriaLabel }, icon),
|
package/flashbar/flash.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flash.js","sourceRoot":"lib/default/","sources":["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,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,UAAU,MAAM,oCAAoC,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"flash.js","sourceRoot":"lib/default/","sources":["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,iBAAiB,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAA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MAAM,CAAO,CACtE;QACL,WAAW,IAAI,aAAa,CAAC,YAAY,EAAE,aAAa,CAAC;QACzD,QAAQ,KAAK,QAAQ,IAAI,CACxB,oBAAC,UAAU;YACR,mBAAmB;;YAAG,MAAM;;YAAG,OAAO,CAC5B,CACd,CACG,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 LiveRegion from '../internal/components/live-region';\nimport { ButtonProps } from '../button/interfaces';\n\nimport { sendDismissMetric } from './internal/analytics';\n\nimport { FOCUS_THROTTLE_DELAY } from './utils';\nimport { DATA_ATTR_ANALYTICS_FLASHBAR } from '../internal/analytics/selectors';\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 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 handleDismiss: ButtonProps['onClick'] = event => {\n sendDismissMetric(effectiveType);\n onDismiss && onDismiss(event);\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_ANALYTICS_FLASHBAR]: effectiveType,\n };\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 {...analyticsAttributes}\n >\n <div className={styles['flash-body']}>\n <div className={styles['flash-focus-container']} tabIndex={-1}>\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, handleDismiss)}\n {ariaRole === 'status' && (\n <LiveRegion>\n {statusIconAriaLabel} {header} {content}\n </LiveRegion>\n )}\n </div>\n );\n }\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAazC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["form-field/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAazC,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AAatD,UAAU,mBAAmB;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAAE,mBAAmB,eAiBvF;AAED,wBAAgB,cAAc,CAAC,EAC7B,EAAE,EACF,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,eAMA;AAED,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,SAAS,EACT,OAAe,EACf,KAAK,EACL,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,SAAS,EACT,WAAW,EACX,iBAAwB,EACxB,gBAAwB,EACxB,GAAG,IAAI,EACR,EAAE,sBAAsB,eA4GxB"}
|
package/form-field/internal.js
CHANGED
|
@@ -15,7 +15,7 @@ import { joinStrings } from '../internal/utils/strings';
|
|
|
15
15
|
import { useInternalI18n } from '../internal/i18n/context';
|
|
16
16
|
import { FunnelMetrics } from '../internal/analytics';
|
|
17
17
|
import { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';
|
|
18
|
-
import { getSubStepAllSelector } from '../internal/analytics/selectors';
|
|
18
|
+
import { DATA_ATTR_FIELD_ERROR, DATA_ATTR_FIELD_LABEL, getFieldSlotSeletor, getSubStepAllSelector, } from '../internal/analytics/selectors';
|
|
19
19
|
export function FormFieldError({ id, children, errorIconAriaLabel }) {
|
|
20
20
|
const i18n = useInternalI18n('form-field');
|
|
21
21
|
return (React.createElement("div", { id: id, className: styles.error },
|
|
@@ -28,6 +28,7 @@ export function ConstraintText({ id, hasError, children, }) {
|
|
|
28
28
|
return (React.createElement("div", { id: id, className: clsx(styles.constraint, hasError && styles['constraint-has-error']) }, children));
|
|
29
29
|
}
|
|
30
30
|
export default function InternalFormField(_a) {
|
|
31
|
+
var _b, _c;
|
|
31
32
|
var { controlId, stretch = false, label, info, i18nStrings, children, secondaryControl, description, constraintText, errorText, __hideLabel, __internalRootRef = null, __disableGutters = false } = _a, rest = __rest(_a, ["controlId", "stretch", "label", "info", "i18nStrings", "children", "secondaryControl", "description", "constraintText", "errorText", "__hideLabel", "__internalRootRef", "__disableGutters"]);
|
|
32
33
|
const baseProps = getBaseProps(rest);
|
|
33
34
|
const isRefresh = useVisualRefresh();
|
|
@@ -44,13 +45,10 @@ export default function InternalFormField(_a) {
|
|
|
44
45
|
ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,
|
|
45
46
|
invalid: !!errorText || !!parentInvalid,
|
|
46
47
|
};
|
|
47
|
-
const analyticsAttributes = {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
if (slotIds.error) {
|
|
52
|
-
analyticsAttributes['data-analytics-field-error-selector'] = `[id="${slotIds.error}"]`;
|
|
53
|
-
}
|
|
48
|
+
const analyticsAttributes = {
|
|
49
|
+
[DATA_ATTR_FIELD_LABEL]: (_b = slotIds.label) !== null && _b !== void 0 ? _b : getFieldSlotSeletor(slotIds.label),
|
|
50
|
+
[DATA_ATTR_FIELD_ERROR]: (_c = slotIds.error) !== null && _c !== void 0 ? _c : getFieldSlotSeletor(slotIds.error),
|
|
51
|
+
};
|
|
54
52
|
useEffect(() => {
|
|
55
53
|
if (funnelInteractionId && errorText) {
|
|
56
54
|
FunnelMetrics.funnelSubStepError({
|
|
@@ -59,8 +57,8 @@ export default function InternalFormField(_a) {
|
|
|
59
57
|
subStepNameSelector,
|
|
60
58
|
stepNumber,
|
|
61
59
|
stepNameSelector,
|
|
62
|
-
fieldErrorSelector:
|
|
63
|
-
fieldLabelSelector:
|
|
60
|
+
fieldErrorSelector: getFieldSlotSeletor(slotIds.error),
|
|
61
|
+
fieldLabelSelector: getFieldSlotSeletor(slotIds.label),
|
|
64
62
|
subStepAllSelector: getSubStepAllSelector(),
|
|
65
63
|
});
|
|
66
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC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,IAC1D,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../internal/i18n/context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport { getSubStepAllSelector } from '../internal/analytics/selectors';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n\n return (\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div\n role=\"img\"\n aria-label={i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel)}\n className={styles['error-icon-scale-wrapper']}\n >\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message}>{children}</span>\n </div>\n );\n}\n\nexport function ConstraintText({\n id,\n hasError,\n children,\n}: {\n id?: string;\n hasError: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasError && styles['constraint-has-error'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelInteractionId, stepNumber, stepNameSelector, subStepSelector, subStepNameSelector } =\n useFunnelSubStep();\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n };\n\n const analyticsAttributes: Record<string, string> = {};\n\n if (slotIds.label) {\n analyticsAttributes['data-analytics-field-label-selector'] = `[id=\"${slotIds.label}\"]`;\n }\n\n if (slotIds.error) {\n analyticsAttributes['data-analytics-field-error-selector'] = `[id=\"${slotIds.error}\"]`;\n }\n\n useEffect(() => {\n if (funnelInteractionId && errorText) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n subStepSelector,\n subStepNameSelector,\n stepNumber,\n stepNameSelector,\n fieldErrorSelector: `[id=\"${slotIds.error}\"]`,\n fieldLabelSelector: `[id=\"${slotIds.label}\"]`,\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n {...analyticsAttributes}\n >\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasError={!!errorText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["form-field/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC/F,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OAAO,YAAY,MAAM,kBAAkB,CAAC;AAC5C,OA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AI,CACd,6BAAK,SAAS,EAAE,MAAM,CAAC,WAAW,EAAE,EAAE,EAAE,OAAO,CAAC,WAAW,IACxD,WAAW,CACR,CACP;QAED,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;YAC1E,oBAAC,YAAY,IAAC,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,gBAAgB;gBAC5E,oBAAC,gBAAgB,CAAC,QAAQ,IACxB,KAAK,kBACH,SAAS,EAAE,kBAAkB,IAC1B,6BAA6B,KAGjC,QAAQ,IAAI,6BAAK,SAAS,EAAE,MAAM,CAAC,OAAO,IAAG,QAAQ,CAAO,CACnC;gBAE3B,gBAAgB,IAAI,CACnB,oBAAC,gBAAgB,CAAC,QAAQ,IAAC,KAAK,EAAE,6BAA6B;oBAC7D,6BAAK,SAAS,EAAE,MAAM,CAAC,mBAAmB,CAAC,IAAG,gBAAgB,CAAO,CAC3C,CAC7B,CACY,CACX;QAEL,CAAC,cAAc,IAAI,SAAS,CAAC,IAAI,CAChC,6BAAK,SAAS,EAAE,MAAM,CAAC,KAAK;YACzB,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,KAAK,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IACnF,SAAS,CACK,CAClB;YACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,CAAC,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,SAAS,IAC1D,cAAc,CACA,CAClB,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect } from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { FormFieldContext, useFormFieldContext } from '../internal/context/form-field-context';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\n\nimport InternalGrid from '../grid/internal';\nimport InternalIcon from '../icon/internal';\nimport { getAriaDescribedBy, getGridDefinition, getSlotIds } from './util';\n\nimport styles from './styles.css.js';\nimport { InternalFormFieldProps } from './interfaces';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useInternalI18n } from '../internal/i18n/context';\n\nimport { FunnelMetrics } from '../internal/analytics';\nimport { useFunnelSubStep } from '../internal/analytics/hooks/use-funnel';\nimport {\n DATA_ATTR_FIELD_ERROR,\n DATA_ATTR_FIELD_LABEL,\n getFieldSlotSeletor,\n getSubStepAllSelector,\n} from '../internal/analytics/selectors';\n\ninterface FormFieldErrorProps {\n id?: string;\n children?: React.ReactNode;\n errorIconAriaLabel?: string;\n}\n\nexport function FormFieldError({ id, children, errorIconAriaLabel }: FormFieldErrorProps) {\n const i18n = useInternalI18n('form-field');\n\n return (\n <div id={id} className={styles.error}>\n <div className={styles['error-icon-shake-wrapper']}>\n <div\n role=\"img\"\n aria-label={i18n('i18nStrings.errorIconAriaLabel', errorIconAriaLabel)}\n className={styles['error-icon-scale-wrapper']}\n >\n <InternalIcon name=\"status-warning\" size=\"small\" />\n </div>\n </div>\n <span className={styles.error__message}>{children}</span>\n </div>\n );\n}\n\nexport function ConstraintText({\n id,\n hasError,\n children,\n}: {\n id?: string;\n hasError: boolean;\n children: React.ReactNode;\n}) {\n return (\n <div id={id} className={clsx(styles.constraint, hasError && styles['constraint-has-error'])}>\n {children}\n </div>\n );\n}\n\nexport default function InternalFormField({\n controlId,\n stretch = false,\n label,\n info,\n i18nStrings,\n children,\n secondaryControl,\n description,\n constraintText,\n errorText,\n __hideLabel,\n __internalRootRef = null,\n __disableGutters = false,\n ...rest\n}: InternalFormFieldProps) {\n const baseProps = getBaseProps(rest);\n const isRefresh = useVisualRefresh();\n\n const instanceUniqueId = useUniqueId('formField');\n const generatedControlId = controlId || instanceUniqueId;\n const formFieldId = controlId || generatedControlId;\n\n const { funnelInteractionId, stepNumber, stepNameSelector, subStepSelector, subStepNameSelector } =\n useFunnelSubStep();\n\n const slotIds = getSlotIds(formFieldId, label, description, constraintText, errorText);\n\n const ariaDescribedBy = getAriaDescribedBy(slotIds);\n\n const gridDefinition = getGridDefinition(stretch, !!secondaryControl, isRefresh);\n\n const {\n ariaLabelledby: parentAriaLabelledby,\n ariaDescribedby: parentAriaDescribedby,\n invalid: parentInvalid,\n } = useFormFieldContext({});\n\n const contextValuesWithoutControlId = {\n ariaLabelledby: joinStrings(parentAriaLabelledby, slotIds.label) || undefined,\n ariaDescribedby: joinStrings(parentAriaDescribedby, ariaDescribedBy) || undefined,\n invalid: !!errorText || !!parentInvalid,\n };\n\n const analyticsAttributes = {\n [DATA_ATTR_FIELD_LABEL]: slotIds.label ?? getFieldSlotSeletor(slotIds.label),\n [DATA_ATTR_FIELD_ERROR]: slotIds.error ?? getFieldSlotSeletor(slotIds.error),\n };\n\n useEffect(() => {\n if (funnelInteractionId && errorText) {\n FunnelMetrics.funnelSubStepError({\n funnelInteractionId,\n subStepSelector,\n subStepNameSelector,\n stepNumber,\n stepNameSelector,\n fieldErrorSelector: getFieldSlotSeletor(slotIds.error),\n fieldLabelSelector: getFieldSlotSeletor(slotIds.label),\n subStepAllSelector: getSubStepAllSelector(),\n });\n }\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [funnelInteractionId, errorText]);\n\n return (\n <div\n {...baseProps}\n className={clsx(baseProps.className, styles.root)}\n ref={__internalRootRef}\n {...analyticsAttributes}\n >\n <div className={clsx(__hideLabel && styles['visually-hidden'])}>\n {label && (\n <label className={styles.label} id={slotIds.label} htmlFor={generatedControlId}>\n {label}\n </label>\n )}\n {!__hideLabel && info && <span className={styles.info}>{info}</span>}\n </div>\n\n {description && (\n <div className={styles.description} id={slotIds.description}>\n {description}\n </div>\n )}\n\n <div className={clsx(styles.controls, __hideLabel && styles['label-hidden'])}>\n <InternalGrid gridDefinition={gridDefinition} disableGutters={__disableGutters}>\n <FormFieldContext.Provider\n value={{\n controlId: generatedControlId,\n ...contextValuesWithoutControlId,\n }}\n >\n {children && <div className={styles.control}>{children}</div>}\n </FormFieldContext.Provider>\n\n {secondaryControl && (\n <FormFieldContext.Provider value={contextValuesWithoutControlId}>\n <div className={styles['secondary-control']}>{secondaryControl}</div>\n </FormFieldContext.Provider>\n )}\n </InternalGrid>\n </div>\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={slotIds.error} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {constraintText && (\n <ConstraintText id={slotIds.constraint} hasError={!!errorText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </div>\n );\n}\n"]}
|
package/header/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAMA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAIjD,UAAU,mBAAoB,SAAQ,YAAY,CAAC,WAAW,EAAE,SAAS,CAAC,EAAE,0BAA0B;IACpG,wBAAwB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAwB,EACxB,wBAAwB,EACxB,GAAG,SAAS,EACb,EAAE,mBAAmB,eA0ErB"}
|
package/header/internal.js
CHANGED
|
@@ -8,6 +8,7 @@ import { StickyHeaderContext } from '../container/use-sticky-header';
|
|
|
8
8
|
import { useVisualRefresh } from '../internal/hooks/use-visual-mode';
|
|
9
9
|
import styles from './styles.css.js';
|
|
10
10
|
import { useMobile } from '../internal/hooks/use-mobile';
|
|
11
|
+
import { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';
|
|
11
12
|
export default function InternalHeader(_a) {
|
|
12
13
|
var { variant, headingTagOverride, children, actions, counter, description, info, __internalRootRef = null, __disableActionsWrapping } = _a, restProps = __rest(_a, ["variant", "headingTagOverride", "children", "actions", "counter", "description", "info", "__internalRootRef", "__disableActionsWrapping"]);
|
|
13
14
|
const isMobile = useMobile();
|
|
@@ -22,7 +23,7 @@ export default function InternalHeader(_a) {
|
|
|
22
23
|
React.createElement("div", { className: clsx(styles.main, styles[`main-variant-${variantOverride}`], isRefresh && styles[`main-variant-${variantOverride}-refresh`]) },
|
|
23
24
|
React.createElement("div", { className: clsx(styles.title, styles[`title-variant-${variantOverride}`], isRefresh && styles[`title-variant-${variantOverride}-refresh`]) },
|
|
24
25
|
React.createElement(HeadingTag, { className: clsx(styles.heading, styles[`heading-variant-${variantOverride}`]) },
|
|
25
|
-
React.createElement("span", {
|
|
26
|
+
React.createElement("span", Object.assign({}, { [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME }, { className: clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`]) }), children),
|
|
26
27
|
counter !== undefined && React.createElement("span", { className: styles.counter },
|
|
27
28
|
" ",
|
|
28
29
|
counter)),
|
package/header/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["header/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAMhG,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAWjB;QAXiB,EACrC,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,WAAW,EACX,IAAI,EACJ,iBAAiB,GAAG,IAAI,EACxB,wBAAwB,OAEJ,EADjB,SAAS,cAVyB,2IAWtC,CADa;IAEZ,MAAM,QAAQ,GAAG,SAAS,EAAE,CAAC;IAC7B,MAAM,UAAU,GAAG,kBAAkB,aAAl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C,EAC1C,SAAS,IAAI,MAAM,CAAC,iBAAiB,eAAe,UAAU,CAAC,CAChE;gBAED,oBAAC,UAAU,IAAC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,mBAAmB,eAAe,EAAE,CAAC,CAAC;oBACvF,8CACM,EAAE,CAAC,oBAAoB,CAAC,EAAE,uBAAuB,EAAE,IACvD,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC,wBAAwB,eAAe,EAAE,CAAC,CAAC,KAEzF,QAAQ,CACJ;oBACN,OAAO,KAAK,SAAS,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,OAAO;;wBAAI,OAAO,CAAQ,CACjE;gBACZ,IAAI,IAAI,8BAAM,SAAS,EAAE,MAAM,CAAC,IAAI,IAAG,IAAI,CAAQ,CAChD;YACL,WAAW,IAAI,CACd,2BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,uBAAuB,eAAe,EAAE,CAAC,EAChD,SAAS,IAAI,MAAM,CAAC,uBAAuB,eAAe,UAAU,CAAC,CACtE,IAEA,WAAW,CACV,CACL,CACG;QACL,OAAO,IAAI,CACV,6BACE,SAAS,EAAE,IAAI,CACb,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,mBAAmB,eAAe,EAAE,CAAC,EAC5C,SAAS,IAAI,MAAM,CAAC,mBAAmB,eAAe,UAAU,CAAC,CAClE,IAEA,OAAO,CACJ,CACP,CACG,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport clsx from 'clsx';\nimport React, { useContext } from 'react';\nimport { getBaseProps } from '../internal/base-component';\nimport { StickyHeaderContext } from '../container/use-sticky-header';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { HeaderProps } from './interfaces';\nimport styles from './styles.css.js';\nimport { SomeRequired } from '../internal/types';\nimport { useMobile } from '../internal/hooks/use-mobile';\nimport { DATA_ATTR_FUNNEL_KEY, FUNNEL_KEY_SUBSTEP_NAME } from '../internal/analytics/selectors';\n\ninterface InternalHeaderProps extends SomeRequired<HeaderProps, 'variant'>, InternalBaseComponentProps {\n __disableActionsWrapping?: boolean;\n}\n\nexport default function InternalHeader({\n variant,\n headingTagOverride,\n children,\n actions,\n counter,\n description,\n info,\n __internalRootRef = null,\n __disableActionsWrapping,\n ...restProps\n}: InternalHeaderProps) {\n const isMobile = useMobile();\n const HeadingTag = headingTagOverride ?? (variant === 'awsui-h1-sticky' ? 'h1' : variant);\n const { isStuck } = useContext(StickyHeaderContext);\n const baseProps = getBaseProps(restProps);\n const isRefresh = useVisualRefresh();\n // If is mobile there is no need to have the dynamic variant because it's scrolled out of view\n const dynamicVariant = !isMobile && isStuck ? 'h2' : 'h1';\n const variantOverride = variant === 'awsui-h1-sticky' ? (isRefresh ? dynamicVariant : 'h2') : variant;\n\n return (\n <div\n {...baseProps}\n className={clsx(\n styles.root,\n baseProps.className,\n styles[`root-variant-${variantOverride}`],\n isRefresh && styles[`root-variant-${variantOverride}-refresh`],\n !actions && [styles[`root-no-actions`]],\n description && [styles[`root-has-description`]],\n __disableActionsWrapping && [styles['root-no-wrap']]\n )}\n ref={__internalRootRef}\n >\n <div\n className={clsx(\n styles.main,\n styles[`main-variant-${variantOverride}`],\n isRefresh && styles[`main-variant-${variantOverride}-refresh`]\n )}\n >\n <div\n className={clsx(\n styles.title,\n styles[`title-variant-${variantOverride}`],\n isRefresh && styles[`title-variant-${variantOverride}-refresh`]\n )}\n >\n <HeadingTag className={clsx(styles.heading, styles[`heading-variant-${variantOverride}`])}>\n <span\n {...{ [DATA_ATTR_FUNNEL_KEY]: FUNNEL_KEY_SUBSTEP_NAME }}\n className={clsx(styles['heading-text'], styles[`heading-text-variant-${variantOverride}`])}\n >\n {children}\n </span>\n {counter !== undefined && <span className={styles.counter}> {counter}</span>}\n </HeadingTag>\n {info && <span className={styles.info}>{info}</span>}\n </div>\n {description && (\n <p\n className={clsx(\n styles.description,\n styles[`description-variant-${variantOverride}`],\n isRefresh && styles[`description-variant-${variantOverride}-refresh`]\n )}\n >\n {description}\n </p>\n )}\n </div>\n {actions && (\n <div\n className={clsx(\n styles.actions,\n styles[`actions-variant-${variantOverride}`],\n isRefresh && styles[`actions-variant-${variantOverride}-refresh`]\n )}\n >\n {actions}\n </div>\n )}\n </div>\n );\n}\n"]}
|