@cloudscape-design/components 3.0.1000 → 3.0.1001
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/app-layout/visual-refresh-toolbar/drawer/styles.css.js +17 -17
- package/app-layout/visual-refresh-toolbar/drawer/styles.scoped.css +35 -36
- package/app-layout/visual-refresh-toolbar/drawer/styles.selectors.js +17 -17
- package/app-layout/visual-refresh-toolbar/toolbar/index.js +1 -1
- package/app-layout/visual-refresh-toolbar/toolbar/index.js.map +1 -1
- package/internal/base-component/styles.scoped.css +3 -0
- package/internal/environment.d.ts +1 -0
- package/internal/environment.js +2 -1
- package/internal/environment.json +2 -1
- package/internal/hooks/use-base-component/index.d.ts.map +1 -1
- package/internal/hooks/use-base-component/index.js +2 -0
- package/internal/hooks/use-base-component/index.js.map +1 -1
- package/internal/hooks/use-base-component/styles-check.d.ts +3 -0
- package/internal/hooks/use-base-component/styles-check.d.ts.map +1 -0
- package/internal/hooks/use-base-component/styles-check.js +46 -0
- package/internal/hooks/use-base-component/styles-check.js.map +1 -0
- package/internal/manifest.json +1 -1
- package/internal/metrics.d.ts.map +1 -1
- package/internal/metrics.js +2 -2
- package/internal/metrics.js.map +1 -1
- package/package.json +1 -1
- package/prompt-input/internal.d.ts.map +1 -1
- package/prompt-input/internal.js +3 -3
- package/prompt-input/internal.js.map +1 -1
- package/segmented-control/interfaces.d.ts +2 -1
- package/segmented-control/interfaces.d.ts.map +1 -1
- package/segmented-control/interfaces.js.map +1 -1
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"drawer": "
|
|
5
|
-
"with-expanded-motion": "awsui_with-expanded-
|
|
6
|
-
"legacy": "
|
|
7
|
-
"last-opened": "awsui_last-
|
|
8
|
-
"drawer-global": "awsui_drawer-
|
|
9
|
-
"drawer-expanded": "awsui_drawer-
|
|
10
|
-
"drawer-hidden": "awsui_drawer-
|
|
11
|
-
"has-next-siblings": "awsui_has-next-
|
|
12
|
-
"global-drawer-wrapper": "awsui_global-drawer-
|
|
13
|
-
"drawer-content-container": "awsui_drawer-content-
|
|
14
|
-
"drawer-gap": "awsui_drawer-
|
|
15
|
-
"drawer-close-button": "awsui_drawer-close-
|
|
16
|
-
"drawer-expanded-mode-button": "awsui_drawer-expanded-mode-
|
|
17
|
-
"drawer-content": "awsui_drawer-
|
|
18
|
-
"drawer-content-hidden": "awsui_drawer-content-
|
|
19
|
-
"drawer-slider": "awsui_drawer-
|
|
20
|
-
"drawer-actions": "awsui_drawer-
|
|
4
|
+
"drawer": "awsui_drawer_12i0j_12u2z_189",
|
|
5
|
+
"with-expanded-motion": "awsui_with-expanded-motion_12i0j_12u2z_203",
|
|
6
|
+
"legacy": "awsui_legacy_12i0j_12u2z_217",
|
|
7
|
+
"last-opened": "awsui_last-opened_12i0j_12u2z_225",
|
|
8
|
+
"drawer-global": "awsui_drawer-global_12i0j_12u2z_229",
|
|
9
|
+
"drawer-expanded": "awsui_drawer-expanded_12i0j_12u2z_238",
|
|
10
|
+
"drawer-hidden": "awsui_drawer-hidden_12i0j_12u2z_242",
|
|
11
|
+
"has-next-siblings": "awsui_has-next-siblings_12i0j_12u2z_252",
|
|
12
|
+
"global-drawer-wrapper": "awsui_global-drawer-wrapper_12i0j_12u2z_252",
|
|
13
|
+
"drawer-content-container": "awsui_drawer-content-container_12i0j_12u2z_266",
|
|
14
|
+
"drawer-gap": "awsui_drawer-gap_12i0j_12u2z_269",
|
|
15
|
+
"drawer-close-button": "awsui_drawer-close-button_12i0j_12u2z_287",
|
|
16
|
+
"drawer-expanded-mode-button": "awsui_drawer-expanded-mode-button_12i0j_12u2z_293",
|
|
17
|
+
"drawer-content": "awsui_drawer-content_12i0j_12u2z_266",
|
|
18
|
+
"drawer-content-hidden": "awsui_drawer-content-hidden_12i0j_12u2z_305",
|
|
19
|
+
"drawer-slider": "awsui_drawer-slider_12i0j_12u2z_308",
|
|
20
|
+
"drawer-actions": "awsui_drawer-actions_12i0j_12u2z_358"
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -186,7 +186,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
186
186
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
187
187
|
SPDX-License-Identifier: Apache-2.0
|
|
188
188
|
*/
|
|
189
|
-
.
|
|
189
|
+
.awsui_drawer_12i0j_12u2z_189:not(#\9) {
|
|
190
190
|
position: sticky;
|
|
191
191
|
z-index: 830;
|
|
192
192
|
background-color: var(--color-background-container-content-6u8rvp, #ffffff);
|
|
@@ -200,56 +200,56 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
200
200
|
pointer-events: auto;
|
|
201
201
|
word-wrap: break-word;
|
|
202
202
|
}
|
|
203
|
-
.
|
|
203
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_with-expanded-motion_12i0j_12u2z_203:not(#\9) {
|
|
204
204
|
transition: inline-size var(--motion-duration-refresh-only-slow-ugjy90, 250ms) var(--motion-easing-refresh-only-a-ccyqaz, cubic-bezier(0, 0, 0, 1)), min-inline-size var(--motion-duration-refresh-only-slow-ugjy90, 250ms) var(--motion-easing-refresh-only-a-ccyqaz, cubic-bezier(0, 0, 0, 1));
|
|
205
205
|
}
|
|
206
206
|
@media (prefers-reduced-motion: reduce) {
|
|
207
|
-
.
|
|
207
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_with-expanded-motion_12i0j_12u2z_203:not(#\9) {
|
|
208
208
|
animation: none;
|
|
209
209
|
transition: none;
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
|
-
.awsui-motion-disabled .
|
|
212
|
+
.awsui-motion-disabled .awsui_drawer_12i0j_12u2z_189.awsui_with-expanded-motion_12i0j_12u2z_203:not(#\9), .awsui-mode-entering .awsui_drawer_12i0j_12u2z_189.awsui_with-expanded-motion_12i0j_12u2z_203:not(#\9) {
|
|
213
213
|
animation: none;
|
|
214
214
|
transition: none;
|
|
215
215
|
}
|
|
216
216
|
@media (min-width: 689px) {
|
|
217
|
-
.
|
|
217
|
+
.awsui_drawer_12i0j_12u2z_189:not(#\9):not(.awsui_legacy_12i0j_12u2z_217) {
|
|
218
218
|
border-inline-start: var(--border-divider-section-width-uwo8my, 1px) solid var(--color-border-layout-ayg8vb, #c6c6cd);
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
@media (max-width: 688px) {
|
|
222
|
-
.
|
|
222
|
+
.awsui_drawer_12i0j_12u2z_189:not(#\9) {
|
|
223
223
|
inline-size: 100%;
|
|
224
224
|
}
|
|
225
|
-
.
|
|
225
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_last-opened_12i0j_12u2z_225:not(#\9) {
|
|
226
226
|
z-index: 1001;
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
|
-
.
|
|
229
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-global_12i0j_12u2z_229:not(#\9) {
|
|
230
230
|
display: block;
|
|
231
231
|
}
|
|
232
232
|
@media (min-width: 689px) {
|
|
233
|
-
.
|
|
233
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-global_12i0j_12u2z_229:not(#\9) {
|
|
234
234
|
inline-size: var(--awsui-drawer-size-kcc2gu);
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
@media (max-width: 688px) {
|
|
238
|
-
.
|
|
238
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-global_12i0j_12u2z_229:not(#\9):not(.awsui_last-opened_12i0j_12u2z_225):not(.awsui_drawer-expanded_12i0j_12u2z_238) {
|
|
239
239
|
display: none;
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
.
|
|
242
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-hidden_12i0j_12u2z_242:not(#\9) {
|
|
243
243
|
display: none;
|
|
244
244
|
}
|
|
245
|
-
.
|
|
245
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-expanded_12i0j_12u2z_238:not(#\9) {
|
|
246
246
|
inline-size: 100%;
|
|
247
247
|
}
|
|
248
248
|
@media (min-width: 689px) {
|
|
249
|
-
.
|
|
249
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-expanded_12i0j_12u2z_238:not(#\9) {
|
|
250
250
|
border-inline-start: none;
|
|
251
251
|
}
|
|
252
|
-
.
|
|
252
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-expanded_12i0j_12u2z_238.awsui_has-next-siblings_12i0j_12u2z_252 > .awsui_global-drawer-wrapper_12i0j_12u2z_252:not(#\9):after {
|
|
253
253
|
content: "";
|
|
254
254
|
position: absolute;
|
|
255
255
|
block-size: 100%;
|
|
@@ -259,14 +259,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
259
259
|
border-inline-start: var(--border-divider-section-width-uwo8my, 1px) solid var(--color-border-layout-ayg8vb, #c6c6cd);
|
|
260
260
|
box-sizing: border-box;
|
|
261
261
|
}
|
|
262
|
-
.
|
|
262
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-expanded_12i0j_12u2z_238 > .awsui_global-drawer-wrapper_12i0j_12u2z_252:not(#\9) {
|
|
263
263
|
inline-size: 100%;
|
|
264
264
|
grid-template-columns: 8px 1fr;
|
|
265
265
|
}
|
|
266
|
-
.
|
|
266
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-expanded_12i0j_12u2z_238 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266:not(#\9) {
|
|
267
267
|
grid-column: 2;
|
|
268
268
|
}
|
|
269
|
-
.
|
|
269
|
+
.awsui_drawer_12i0j_12u2z_189.awsui_drawer-expanded_12i0j_12u2z_238 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-gap_12i0j_12u2z_269:not(#\9) {
|
|
270
270
|
grid-column: 1;
|
|
271
271
|
grid-row: 1;
|
|
272
272
|
block-size: 100%;
|
|
@@ -275,7 +275,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
275
275
|
border-inline-end: var(--border-divider-section-width-uwo8my, 1px) solid var(--color-border-layout-ayg8vb, #c6c6cd);
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
|
-
.
|
|
278
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_drawer-content-container_12i0j_12u2z_266:not(#\9) {
|
|
279
279
|
grid-column: 1/span 2;
|
|
280
280
|
grid-row: 1;
|
|
281
281
|
display: grid;
|
|
@@ -284,13 +284,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
284
284
|
overflow-y: auto;
|
|
285
285
|
min-inline-size: var(--awsui-drawer-size-kcc2gu);
|
|
286
286
|
}
|
|
287
|
-
.
|
|
287
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-close-button_12i0j_12u2z_287:not(#\9) {
|
|
288
288
|
grid-column: 3;
|
|
289
289
|
grid-row: 2;
|
|
290
290
|
z-index: 1;
|
|
291
291
|
align-self: start;
|
|
292
292
|
}
|
|
293
|
-
.
|
|
293
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-expanded-mode-button_12i0j_12u2z_293:not(#\9) {
|
|
294
294
|
grid-column: 2;
|
|
295
295
|
grid-row: 2;
|
|
296
296
|
z-index: 1;
|
|
@@ -298,33 +298,32 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
298
298
|
display: flex;
|
|
299
299
|
justify-content: flex-end;
|
|
300
300
|
}
|
|
301
|
-
.
|
|
301
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-content_12i0j_12u2z_266:not(#\9) {
|
|
302
302
|
grid-column: 1/span 4;
|
|
303
303
|
grid-row: 1/span 2;
|
|
304
304
|
}
|
|
305
|
-
.
|
|
305
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-content_12i0j_12u2z_266.awsui_drawer-content-hidden_12i0j_12u2z_305:not(#\9) {
|
|
306
306
|
display: none;
|
|
307
307
|
}
|
|
308
|
-
.
|
|
308
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_drawer-slider_12i0j_12u2z_308:not(#\9) {
|
|
309
309
|
grid-column: 1;
|
|
310
310
|
grid-row: 1;
|
|
311
311
|
block-size: 100%;
|
|
312
312
|
display: flex;
|
|
313
313
|
align-items: center;
|
|
314
314
|
}
|
|
315
|
-
.
|
|
315
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252:not(#\9) {
|
|
316
316
|
display: grid;
|
|
317
317
|
min-inline-size: var(--awsui-drawer-size-kcc2gu);
|
|
318
318
|
grid-template-columns: 8px var(--space-m-dsumyt, 16px) 1fr;
|
|
319
319
|
overflow: hidden;
|
|
320
320
|
}
|
|
321
321
|
@media (max-width: 688px) {
|
|
322
|
-
.
|
|
322
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252:not(#\9) {
|
|
323
323
|
grid-template-columns: 1fr;
|
|
324
|
-
grid-column: 1/span 2;
|
|
325
324
|
}
|
|
326
325
|
}
|
|
327
|
-
.
|
|
326
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-gap_12i0j_12u2z_269:not(#\9) {
|
|
328
327
|
grid-column: 1;
|
|
329
328
|
grid-row: 1;
|
|
330
329
|
block-size: 100%;
|
|
@@ -333,13 +332,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
333
332
|
border-inline-end: var(--border-divider-section-width-uwo8my, 1px) solid var(--color-border-layout-ayg8vb, #c6c6cd);
|
|
334
333
|
box-sizing: border-box;
|
|
335
334
|
}
|
|
336
|
-
.
|
|
335
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-slider_12i0j_12u2z_308:not(#\9) {
|
|
337
336
|
grid-column: 2;
|
|
338
337
|
grid-row: 1;
|
|
339
338
|
display: flex;
|
|
340
339
|
align-items: center;
|
|
341
340
|
}
|
|
342
|
-
.
|
|
341
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266:not(#\9) {
|
|
343
342
|
grid-row: 1;
|
|
344
343
|
display: grid;
|
|
345
344
|
grid-template-columns: var(--space-m-dsumyt, 16px) 1fr auto var(--space-m-dsumyt, 16px);
|
|
@@ -347,16 +346,16 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
347
346
|
overflow-y: auto;
|
|
348
347
|
}
|
|
349
348
|
@media (min-width: 689px) {
|
|
350
|
-
.
|
|
349
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266:not(#\9) {
|
|
351
350
|
grid-column: 2/span 2;
|
|
352
351
|
}
|
|
353
352
|
}
|
|
354
353
|
@media (max-width: 688px) {
|
|
355
|
-
.
|
|
354
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266:not(#\9) {
|
|
356
355
|
grid-column: 1/span 2;
|
|
357
356
|
}
|
|
358
357
|
}
|
|
359
|
-
.
|
|
358
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-actions_12i0j_12u2z_358:not(#\9) {
|
|
360
359
|
position: absolute;
|
|
361
360
|
display: flex;
|
|
362
361
|
inset-block-start: 0;
|
|
@@ -364,13 +363,13 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
364
363
|
padding-inline-end: var(--space-m-dsumyt, 16px);
|
|
365
364
|
padding-block-start: 14px;
|
|
366
365
|
}
|
|
367
|
-
.
|
|
366
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-close-button_12i0j_12u2z_287:not(#\9) {
|
|
368
367
|
grid-column: 3;
|
|
369
368
|
grid-row: 2;
|
|
370
369
|
z-index: 1;
|
|
371
370
|
align-self: start;
|
|
372
371
|
}
|
|
373
|
-
.
|
|
372
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-expanded-mode-button_12i0j_12u2z_293:not(#\9) {
|
|
374
373
|
grid-column: 2;
|
|
375
374
|
grid-row: 2;
|
|
376
375
|
z-index: 1;
|
|
@@ -378,10 +377,10 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
378
377
|
display: flex;
|
|
379
378
|
justify-content: flex-end;
|
|
380
379
|
}
|
|
381
|
-
.
|
|
380
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-content_12i0j_12u2z_266:not(#\9) {
|
|
382
381
|
grid-column: 1/span 4;
|
|
383
382
|
grid-row: 1/span 2;
|
|
384
383
|
}
|
|
385
|
-
.
|
|
384
|
+
.awsui_drawer_12i0j_12u2z_189 > .awsui_global-drawer-wrapper_12i0j_12u2z_252 > .awsui_drawer-content-container_12i0j_12u2z_266 > .awsui_drawer-content_12i0j_12u2z_266.awsui_drawer-content-hidden_12i0j_12u2z_305:not(#\9) {
|
|
386
385
|
display: none;
|
|
387
386
|
}
|
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"drawer": "
|
|
6
|
-
"with-expanded-motion": "awsui_with-expanded-
|
|
7
|
-
"legacy": "
|
|
8
|
-
"last-opened": "awsui_last-
|
|
9
|
-
"drawer-global": "awsui_drawer-
|
|
10
|
-
"drawer-expanded": "awsui_drawer-
|
|
11
|
-
"drawer-hidden": "awsui_drawer-
|
|
12
|
-
"has-next-siblings": "awsui_has-next-
|
|
13
|
-
"global-drawer-wrapper": "awsui_global-drawer-
|
|
14
|
-
"drawer-content-container": "awsui_drawer-content-
|
|
15
|
-
"drawer-gap": "awsui_drawer-
|
|
16
|
-
"drawer-close-button": "awsui_drawer-close-
|
|
17
|
-
"drawer-expanded-mode-button": "awsui_drawer-expanded-mode-
|
|
18
|
-
"drawer-content": "awsui_drawer-
|
|
19
|
-
"drawer-content-hidden": "awsui_drawer-content-
|
|
20
|
-
"drawer-slider": "awsui_drawer-
|
|
21
|
-
"drawer-actions": "awsui_drawer-
|
|
5
|
+
"drawer": "awsui_drawer_12i0j_12u2z_189",
|
|
6
|
+
"with-expanded-motion": "awsui_with-expanded-motion_12i0j_12u2z_203",
|
|
7
|
+
"legacy": "awsui_legacy_12i0j_12u2z_217",
|
|
8
|
+
"last-opened": "awsui_last-opened_12i0j_12u2z_225",
|
|
9
|
+
"drawer-global": "awsui_drawer-global_12i0j_12u2z_229",
|
|
10
|
+
"drawer-expanded": "awsui_drawer-expanded_12i0j_12u2z_238",
|
|
11
|
+
"drawer-hidden": "awsui_drawer-hidden_12i0j_12u2z_242",
|
|
12
|
+
"has-next-siblings": "awsui_has-next-siblings_12i0j_12u2z_252",
|
|
13
|
+
"global-drawer-wrapper": "awsui_global-drawer-wrapper_12i0j_12u2z_252",
|
|
14
|
+
"drawer-content-container": "awsui_drawer-content-container_12i0j_12u2z_266",
|
|
15
|
+
"drawer-gap": "awsui_drawer-gap_12i0j_12u2z_269",
|
|
16
|
+
"drawer-close-button": "awsui_drawer-close-button_12i0j_12u2z_287",
|
|
17
|
+
"drawer-expanded-mode-button": "awsui_drawer-expanded-mode-button_12i0j_12u2z_293",
|
|
18
|
+
"drawer-content": "awsui_drawer-content_12i0j_12u2z_266",
|
|
19
|
+
"drawer-content-hidden": "awsui_drawer-content-hidden_12i0j_12u2z_305",
|
|
20
|
+
"drawer-slider": "awsui_drawer-slider_12i0j_12u2z_308",
|
|
21
|
+
"drawer-actions": "awsui_drawer-actions_12i0j_12u2z_358"
|
|
22
22
|
};
|
|
23
23
|
|
|
@@ -76,7 +76,7 @@ toolbarProps = {}, }) {
|
|
|
76
76
|
} },
|
|
77
77
|
React.createElement("div", { className: styles['toolbar-container'] },
|
|
78
78
|
hasNavigation && (React.createElement("nav", Object.assign({}, navLandmarkAttributes, { className: clsx(styles['universal-toolbar-nav']) }),
|
|
79
|
-
React.createElement(TriggerButton, { ariaLabel: (_a = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationToggle) !== null && _a !== void 0 ? _a : undefined, ariaExpanded:
|
|
79
|
+
React.createElement(TriggerButton, { ariaLabel: (_a = ariaLabels === null || ariaLabels === void 0 ? void 0 : ariaLabels.navigationToggle) !== null && _a !== void 0 ? _a : undefined, ariaExpanded: !drawerExpandedMode && navigationOpen, iconName: "menu", className: testutilStyles['navigation-toggle'], onClick: () => {
|
|
80
80
|
if (setExpandedDrawerId) {
|
|
81
81
|
setExpandedDrawerId(null);
|
|
82
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AAC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B,CAAC,CAAC;gBACvD,oBAAC,cAAc,IACb,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,IAAI,EACtC,OAAO,EAAE,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mCAAI,EAAE,EACtD,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EAAE,CAAA,qBAAqB,aAArB,qBAAqB,uBAArB,qBAAqB,CAAE,SAAS,EAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,EAC3F,kBAAkB,EAAE,kBAAkB,EACtC,kBAAkB,EAAE,kBAAkB,EACtC,QAAQ,EAAE,oBAAoB,EAC9B,yBAAyB,EAAE,yBAAyB,EACpD,aAAa,EAAE,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mCAAI,EAAE,EAClE,sBAAsB,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,EAAE,EACpD,2BAA2B,EAAE,2BAA2B,EACxD,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAoB,GACzC,CACE,CACP,CACG,CACM,CACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAAG,yBAAyB,CACvE,8BAA8B,EAC9B,eAAe,CAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { createWidgetizedComponent } from '../../../internal/widgets';\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-drawers';\nimport { Focusable, FocusControlMultipleStates } from '../../utils/use-focus-control';\nimport { AppLayoutInternals } from '../interfaces';\nimport { BreadcrumbsSlot } from '../skeleton/breadcrumbs';\nimport { ToolbarSkeleton } from '../skeleton/slot-skeletons';\nimport { ToolbarSlot } from '../skeleton/slot-wrappers';\nimport { DrawerTriggers, SplitPanelToggleProps } from './drawer-triggers';\nimport TriggerButton from './trigger-button';\n\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { SplitPanelToggleProps };\n\nexport interface ToolbarProps {\n ariaLabels?: AppLayoutProps.Labels;\n // navigation\n hasNavigation?: boolean;\n navigationOpen?: boolean;\n onNavigationToggle?: (open: boolean) => void;\n navigationFocusRef?: React.Ref<Focusable>;\n\n // breadcrumbs\n hasBreadcrumbsPortal?: boolean;\n\n // split panel\n hasSplitPanel?: boolean;\n splitPanelToggleProps?: SplitPanelToggleProps;\n splitPanelFocusRef?: React.Ref<Focusable>;\n onSplitPanelToggle?: () => void;\n\n // drawers\n activeDrawerId?: string | null;\n drawers?: ReadonlyArray<AppLayoutProps.Drawer>;\n drawersFocusRef?: React.Ref<Focusable>;\n globalDrawersFocusControl?: FocusControlMultipleStates;\n onActiveDrawerChange?: (drawerId: string | null, params: OnChangeParams) => void;\n globalDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n activeGlobalDrawersIds?: ReadonlyArray<string>;\n onActiveGlobalDrawersChange?: ((drawerId: string, params: OnChangeParams) => void) | undefined;\n\n expandedDrawerId?: string | null;\n setExpandedDrawerId?: (value: string | null) => void;\n}\n\nexport interface AppLayoutToolbarImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n toolbarProps: ToolbarProps;\n}\n\nexport function AppLayoutToolbarImplementation({\n appLayoutInternals,\n // the value could be undefined if this component is loaded as a widget by a different app layout version\n // not testable in a single-version setup\n toolbarProps = {},\n}: AppLayoutToolbarImplementationProps) {\n const {\n breadcrumbs,\n discoveredBreadcrumbs,\n verticalOffsets,\n isMobile,\n toolbarState,\n setToolbarState,\n setToolbarHeight,\n } = appLayoutInternals;\n const {\n ariaLabels,\n activeDrawerId,\n drawers,\n drawersFocusRef,\n onActiveDrawerChange,\n globalDrawersFocusControl,\n globalDrawers,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange,\n hasNavigation,\n navigationOpen,\n navigationFocusRef,\n onNavigationToggle,\n hasSplitPanel,\n splitPanelFocusRef,\n splitPanelToggleProps,\n onSplitPanelToggle,\n expandedDrawerId,\n setExpandedDrawerId,\n } = toolbarProps;\n // TODO: expose configuration property\n const pinnedToolbar = true;\n const drawerExpandedMode = !!expandedDrawerId;\n const ref = useRef<HTMLElement>(null);\n useResizeObserver(ref, entry => setToolbarHeight(entry.borderBoxHeight));\n useEffect(() => {\n return () => {\n setToolbarHeight(0);\n };\n // unmount effect only\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n let lastScrollY = window.scrollY;\n\n /* istanbul ignore next not testable in JSDOM */\n const updateScrollDirection = () => {\n if (pinnedToolbar) {\n setToolbarState('show');\n return;\n }\n const scrollY = window.scrollY;\n // 80 is an arbitrary number to have a pause before the toolbar scrolls out of view at the top of the page\n const direction = scrollY > lastScrollY && scrollY > 80 ? 'hide' : 'show';\n // 2 as a buffer to avoid mistaking minor accidental mouse moves as scroll\n if (direction !== toolbarState && (scrollY - lastScrollY > 2 || scrollY - lastScrollY < -2)) {\n setToolbarState(direction);\n }\n lastScrollY = scrollY > 0 ? scrollY : 0;\n };\n\n window.addEventListener('scroll', updateScrollDirection);\n return () => {\n window.removeEventListener('scroll', updateScrollDirection);\n };\n }, [pinnedToolbar, setToolbarState, toolbarState]);\n\n const anyPanelOpenInMobile = !!isMobile && (!!activeDrawerId || (!!navigationOpen && !!hasNavigation));\n useEffect(() => {\n if (anyPanelOpenInMobile) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n return () => {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n }, [anyPanelOpenInMobile]);\n\n const toolbarHidden = toolbarState === 'hide' && !pinnedToolbar;\n const navLandmarkAttributes = navigationOpen\n ? { role: 'presentation' }\n : { role: 'navigation', 'aria-label': ariaLabels?.navigation };\n\n return (\n <ToolbarSlot\n ref={ref}\n className={clsx(styles['universal-toolbar'], testutilStyles.toolbar, {\n [testutilStyles['mobile-bar']]: isMobile,\n [styles['toolbar-hidden']]: toolbarHidden,\n })}\n style={{\n insetBlockStart: toolbarHidden ? '-60px' : verticalOffsets.toolbar,\n }}\n >\n <div className={styles['toolbar-container']}>\n {hasNavigation && (\n <nav {...navLandmarkAttributes} className={clsx(styles['universal-toolbar-nav'])}>\n <TriggerButton\n ariaLabel={ariaLabels?.navigationToggle ?? undefined}\n ariaExpanded={false}\n iconName=\"menu\"\n className={testutilStyles['navigation-toggle']}\n onClick={() => {\n if (setExpandedDrawerId) {\n setExpandedDrawerId(null);\n }\n if (navigationOpen && expandedDrawerId) {\n return;\n }\n onNavigationToggle?.(!navigationOpen);\n }}\n ref={navigationFocusRef}\n selected={!drawerExpandedMode && navigationOpen}\n disabled={anyPanelOpenInMobile}\n />\n </nav>\n )}\n {(breadcrumbs || discoveredBreadcrumbs) && (\n <div className={clsx(styles['universal-toolbar-breadcrumbs'], testutilStyles.breadcrumbs)}>\n <BreadcrumbsSlot\n ownBreadcrumbs={appLayoutInternals.breadcrumbs}\n discoveredBreadcrumbs={appLayoutInternals.discoveredBreadcrumbs}\n />\n </div>\n )}\n {(drawers?.length || globalDrawers?.length || (hasSplitPanel && splitPanelToggleProps?.displayed)) && (\n <div className={clsx(styles['universal-toolbar-drawers'])}>\n <DrawerTriggers\n ariaLabels={ariaLabels}\n activeDrawerId={activeDrawerId ?? null}\n drawers={drawers?.filter(item => !!item.trigger) ?? []}\n drawersFocusRef={drawersFocusRef}\n onActiveDrawerChange={onActiveDrawerChange}\n splitPanelToggleProps={splitPanelToggleProps?.displayed ? splitPanelToggleProps : undefined}\n splitPanelFocusRef={splitPanelFocusRef}\n onSplitPanelToggle={onSplitPanelToggle}\n disabled={anyPanelOpenInMobile}\n globalDrawersFocusControl={globalDrawersFocusControl}\n globalDrawers={globalDrawers?.filter(item => !!item.trigger) ?? []}\n activeGlobalDrawersIds={activeGlobalDrawersIds ?? []}\n onActiveGlobalDrawersChange={onActiveGlobalDrawersChange}\n expandedDrawerId={expandedDrawerId}\n setExpandedDrawerId={setExpandedDrawerId!}\n />\n </div>\n )}\n </div>\n </ToolbarSlot>\n );\n}\n\nexport const createWidgetizedAppLayoutToolbar = createWidgetizedComponent(\n AppLayoutToolbarImplementation,\n ToolbarSkeleton\n);\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/app-layout/visual-refresh-toolbar/toolbar/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAKtE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAyB,MAAM,mBAAmB,CAAC;AAC1E,OAAO,aAAa,MAAM,kBAAkB,CAAC;AAE7C,OAAO,cAAc,MAAM,kCAAkC,CAAC;AAC9D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAwCrC,MAAM,UAAU,8BAA8B,CAAC,EAC7C,kBAAkB;AAClB,yGAAyG;AACzG,yCAAyC;AACzC,YAAY,GAAG,EAAE,GACmB;;IACpC,MA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AE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,mCAAI,EAAE,EAClE,sBAAsB,EAAE,sBAAsB,aAAtB,sBAAsB,cAAtB,sBAAsB,GAAI,EAAE,EACpD,2BAA2B,EAAE,2BAA2B,EACxD,gBAAgB,EAAE,gBAAgB,EAClC,mBAAmB,EAAE,mBAAoB,GACzC,CACE,CACP,CACG,CACM,CACf,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gCAAgC,GAAG,yBAAyB,CACvE,8BAA8B,EAC9B,eAAe,CAChB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver } from '@cloudscape-design/component-toolkit/internal';\n\nimport { createWidgetizedComponent } from '../../../internal/widgets';\nimport { AppLayoutProps } from '../../interfaces';\nimport { OnChangeParams } from '../../utils/use-drawers';\nimport { Focusable, FocusControlMultipleStates } from '../../utils/use-focus-control';\nimport { AppLayoutInternals } from '../interfaces';\nimport { BreadcrumbsSlot } from '../skeleton/breadcrumbs';\nimport { ToolbarSkeleton } from '../skeleton/slot-skeletons';\nimport { ToolbarSlot } from '../skeleton/slot-wrappers';\nimport { DrawerTriggers, SplitPanelToggleProps } from './drawer-triggers';\nimport TriggerButton from './trigger-button';\n\nimport testutilStyles from '../../test-classes/styles.css.js';\nimport styles from './styles.css.js';\n\nexport { SplitPanelToggleProps };\n\nexport interface ToolbarProps {\n ariaLabels?: AppLayoutProps.Labels;\n // navigation\n hasNavigation?: boolean;\n navigationOpen?: boolean;\n onNavigationToggle?: (open: boolean) => void;\n navigationFocusRef?: React.Ref<Focusable>;\n\n // breadcrumbs\n hasBreadcrumbsPortal?: boolean;\n\n // split panel\n hasSplitPanel?: boolean;\n splitPanelToggleProps?: SplitPanelToggleProps;\n splitPanelFocusRef?: React.Ref<Focusable>;\n onSplitPanelToggle?: () => void;\n\n // drawers\n activeDrawerId?: string | null;\n drawers?: ReadonlyArray<AppLayoutProps.Drawer>;\n drawersFocusRef?: React.Ref<Focusable>;\n globalDrawersFocusControl?: FocusControlMultipleStates;\n onActiveDrawerChange?: (drawerId: string | null, params: OnChangeParams) => void;\n globalDrawers?: ReadonlyArray<AppLayoutProps.Drawer> | undefined;\n activeGlobalDrawersIds?: ReadonlyArray<string>;\n onActiveGlobalDrawersChange?: ((drawerId: string, params: OnChangeParams) => void) | undefined;\n\n expandedDrawerId?: string | null;\n setExpandedDrawerId?: (value: string | null) => void;\n}\n\nexport interface AppLayoutToolbarImplementationProps {\n appLayoutInternals: AppLayoutInternals;\n toolbarProps: ToolbarProps;\n}\n\nexport function AppLayoutToolbarImplementation({\n appLayoutInternals,\n // the value could be undefined if this component is loaded as a widget by a different app layout version\n // not testable in a single-version setup\n toolbarProps = {},\n}: AppLayoutToolbarImplementationProps) {\n const {\n breadcrumbs,\n discoveredBreadcrumbs,\n verticalOffsets,\n isMobile,\n toolbarState,\n setToolbarState,\n setToolbarHeight,\n } = appLayoutInternals;\n const {\n ariaLabels,\n activeDrawerId,\n drawers,\n drawersFocusRef,\n onActiveDrawerChange,\n globalDrawersFocusControl,\n globalDrawers,\n activeGlobalDrawersIds,\n onActiveGlobalDrawersChange,\n hasNavigation,\n navigationOpen,\n navigationFocusRef,\n onNavigationToggle,\n hasSplitPanel,\n splitPanelFocusRef,\n splitPanelToggleProps,\n onSplitPanelToggle,\n expandedDrawerId,\n setExpandedDrawerId,\n } = toolbarProps;\n // TODO: expose configuration property\n const pinnedToolbar = true;\n const drawerExpandedMode = !!expandedDrawerId;\n const ref = useRef<HTMLElement>(null);\n useResizeObserver(ref, entry => setToolbarHeight(entry.borderBoxHeight));\n useEffect(() => {\n return () => {\n setToolbarHeight(0);\n };\n // unmount effect only\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n useEffect(() => {\n let lastScrollY = window.scrollY;\n\n /* istanbul ignore next not testable in JSDOM */\n const updateScrollDirection = () => {\n if (pinnedToolbar) {\n setToolbarState('show');\n return;\n }\n const scrollY = window.scrollY;\n // 80 is an arbitrary number to have a pause before the toolbar scrolls out of view at the top of the page\n const direction = scrollY > lastScrollY && scrollY > 80 ? 'hide' : 'show';\n // 2 as a buffer to avoid mistaking minor accidental mouse moves as scroll\n if (direction !== toolbarState && (scrollY - lastScrollY > 2 || scrollY - lastScrollY < -2)) {\n setToolbarState(direction);\n }\n lastScrollY = scrollY > 0 ? scrollY : 0;\n };\n\n window.addEventListener('scroll', updateScrollDirection);\n return () => {\n window.removeEventListener('scroll', updateScrollDirection);\n };\n }, [pinnedToolbar, setToolbarState, toolbarState]);\n\n const anyPanelOpenInMobile = !!isMobile && (!!activeDrawerId || (!!navigationOpen && !!hasNavigation));\n useEffect(() => {\n if (anyPanelOpenInMobile) {\n document.body.classList.add(styles['block-body-scroll']);\n } else {\n document.body.classList.remove(styles['block-body-scroll']);\n }\n return () => {\n document.body.classList.remove(styles['block-body-scroll']);\n };\n }, [anyPanelOpenInMobile]);\n\n const toolbarHidden = toolbarState === 'hide' && !pinnedToolbar;\n const navLandmarkAttributes = navigationOpen\n ? { role: 'presentation' }\n : { role: 'navigation', 'aria-label': ariaLabels?.navigation };\n\n return (\n <ToolbarSlot\n ref={ref}\n className={clsx(styles['universal-toolbar'], testutilStyles.toolbar, {\n [testutilStyles['mobile-bar']]: isMobile,\n [styles['toolbar-hidden']]: toolbarHidden,\n })}\n style={{\n insetBlockStart: toolbarHidden ? '-60px' : verticalOffsets.toolbar,\n }}\n >\n <div className={styles['toolbar-container']}>\n {hasNavigation && (\n <nav {...navLandmarkAttributes} className={clsx(styles['universal-toolbar-nav'])}>\n <TriggerButton\n ariaLabel={ariaLabels?.navigationToggle ?? undefined}\n ariaExpanded={!drawerExpandedMode && navigationOpen}\n iconName=\"menu\"\n className={testutilStyles['navigation-toggle']}\n onClick={() => {\n if (setExpandedDrawerId) {\n setExpandedDrawerId(null);\n }\n if (navigationOpen && expandedDrawerId) {\n return;\n }\n onNavigationToggle?.(!navigationOpen);\n }}\n ref={navigationFocusRef}\n selected={!drawerExpandedMode && navigationOpen}\n disabled={anyPanelOpenInMobile}\n />\n </nav>\n )}\n {(breadcrumbs || discoveredBreadcrumbs) && (\n <div className={clsx(styles['universal-toolbar-breadcrumbs'], testutilStyles.breadcrumbs)}>\n <BreadcrumbsSlot\n ownBreadcrumbs={appLayoutInternals.breadcrumbs}\n discoveredBreadcrumbs={appLayoutInternals.discoveredBreadcrumbs}\n />\n </div>\n )}\n {(drawers?.length || globalDrawers?.length || (hasSplitPanel && splitPanelToggleProps?.displayed)) && (\n <div className={clsx(styles['universal-toolbar-drawers'])}>\n <DrawerTriggers\n ariaLabels={ariaLabels}\n activeDrawerId={activeDrawerId ?? null}\n drawers={drawers?.filter(item => !!item.trigger) ?? []}\n drawersFocusRef={drawersFocusRef}\n onActiveDrawerChange={onActiveDrawerChange}\n splitPanelToggleProps={splitPanelToggleProps?.displayed ? splitPanelToggleProps : undefined}\n splitPanelFocusRef={splitPanelFocusRef}\n onSplitPanelToggle={onSplitPanelToggle}\n disabled={anyPanelOpenInMobile}\n globalDrawersFocusControl={globalDrawersFocusControl}\n globalDrawers={globalDrawers?.filter(item => !!item.trigger) ?? []}\n activeGlobalDrawersIds={activeGlobalDrawersIds ?? []}\n onActiveGlobalDrawersChange={onActiveGlobalDrawersChange}\n expandedDrawerId={expandedDrawerId}\n setExpandedDrawerId={setExpandedDrawerId!}\n />\n </div>\n )}\n </div>\n </ToolbarSlot>\n );\n}\n\nexport const createWidgetizedAppLayoutToolbar = createWidgetizedComponent(\n AppLayoutToolbarImplementation,\n ToolbarSkeleton\n);\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (f06998b8)";
|
|
3
|
+
export var GIT_SHA = "f06998b8";
|
|
3
4
|
export var THEME = "open-source-visual-refresh";
|
|
4
5
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EACL,sBAAsB,EAIvB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAM/D,MAAM,WAAW,0BAA0B,CAAC,CAAC,GAAG,GAAG;IACjD,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;CACvD;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,GAAG,GAAG,EAC9C,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,sBAAsB,EAC/B,iBAAiB,CAAC,EAAE,iBAAiB;;EAatC"}
|
|
@@ -2,6 +2,7 @@ import { useComponentMetadata, useComponentMetrics, useFocusVisible, } from '@cl
|
|
|
2
2
|
import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';
|
|
3
3
|
import { getVisualTheme } from '../../utils/get-visual-theme';
|
|
4
4
|
import { useVisualRefresh } from '../use-visual-mode';
|
|
5
|
+
import { useMissingStylesCheck } from './styles-check';
|
|
5
6
|
/**
|
|
6
7
|
* This hook is used for components which are exported to customers. The returned __internalRootRef needs to be
|
|
7
8
|
* attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this
|
|
@@ -12,6 +13,7 @@ export default function useBaseComponent(componentName, config, analyticsMetadat
|
|
|
12
13
|
const theme = getVisualTheme(THEME, isVisualRefresh);
|
|
13
14
|
useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);
|
|
14
15
|
useFocusVisible();
|
|
16
|
+
useMissingStylesCheck();
|
|
15
17
|
const elementRef = useComponentMetadata(componentName, { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme }, analyticsMetadata);
|
|
16
18
|
return { __internalRootRef: elementRef };
|
|
17
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,oBAAoB,EACpB,mBAAmB,EACnB,eAAe,GAChB,MAAM,+CAA+C,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAMvD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CACtC,aAAqB,EACrB,MAA+B,EAC/B,iBAAqC;IAErC,MAAM,eAAe,GAAG,gBAAgB,EAAE,CAAC;IAC3C,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,EAAE,eAAe,CAAC,CAAC;IACrD,mBAAmB,CAAC,aAAa,EAAE,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC;IACtH,eAAe,EAAE,CAAC;IAClB,qBAAqB,EAAE,CAAC;IACxB,MAAM,UAAU,GAAG,oBAAoB,CACrC,aAAa,EACb,EAAE,WAAW,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,EAChE,iBAAwB,CACzB,CAAC;IACF,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { MutableRefObject } from 'react';\n\nimport {\n ComponentConfiguration,\n useComponentMetadata,\n useComponentMetrics,\n useFocusVisible,\n} from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../analytics/interfaces';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from '../../environment';\nimport { getVisualTheme } from '../../utils/get-visual-theme';\nimport { useVisualRefresh } from '../use-visual-mode';\nimport { useMissingStylesCheck } from './styles-check';\n\nexport interface InternalBaseComponentProps<T = any> {\n __internalRootRef?: MutableRefObject<T | null> | null;\n}\n\n/**\n * This hook is used for components which are exported to customers. The returned __internalRootRef needs to be\n * attached to the (internal) component's root DOM node. The hook takes care of attaching the metadata to this\n * root DOM node and emits the telemetry for this component.\n */\nexport default function useBaseComponent<T = any>(\n componentName: string,\n config?: ComponentConfiguration,\n analyticsMetadata?: AnalyticsMetadata\n) {\n const isVisualRefresh = useVisualRefresh();\n const theme = getVisualTheme(THEME, isVisualRefresh);\n useComponentMetrics(componentName, { packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme }, config);\n useFocusVisible();\n useMissingStylesCheck();\n const elementRef = useComponentMetadata<T>(\n componentName,\n { packageName: PACKAGE_SOURCE, version: PACKAGE_VERSION, theme },\n analyticsMetadata as any\n );\n return { __internalRootRef: elementRef };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-check.d.ts","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/styles-check.ts"],"names":[],"mappings":"AAOA,wBAAgB,kBAAkB,SAMjC;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,IAAI,4BAsB3C;AAUD,wBAAgB,qBAAqB,SAIpC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { GIT_SHA, PACKAGE_VERSION, THEME } from '../../environment';
|
|
5
|
+
import { metrics } from '../../metrics';
|
|
6
|
+
export function checkMissingStyles() {
|
|
7
|
+
const result = getComputedStyle(document.body).getPropertyValue(`--awsui-version-info-${GIT_SHA}`);
|
|
8
|
+
if (!result) {
|
|
9
|
+
console.error(`Missing AWS-UI CSS for theme "${THEME}", version "${PACKAGE_VERSION}", and git sha "${GIT_SHA}".`);
|
|
10
|
+
metrics.sendOpsMetricObject('awsui-missing-css-asset', {});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function idleWithDelay(cb) {
|
|
14
|
+
// if idle callbacks not supported, we simply do not collect the metric
|
|
15
|
+
if (typeof requestIdleCallback !== 'function') {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
let aborted = false;
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
if (aborted) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
requestIdleCallback(() => {
|
|
24
|
+
if (aborted) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
cb();
|
|
28
|
+
});
|
|
29
|
+
}, 1000);
|
|
30
|
+
return () => {
|
|
31
|
+
aborted = true;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
let checked = false;
|
|
35
|
+
const checkMissingStylesOnce = () => {
|
|
36
|
+
if (!checked) {
|
|
37
|
+
checkMissingStyles();
|
|
38
|
+
checked = true;
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export function useMissingStylesCheck() {
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
return idleWithDelay(() => checkMissingStylesOnce());
|
|
44
|
+
}, []);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=styles-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles-check.js","sourceRoot":"","sources":["../../../../../src/internal/hooks/use-base-component/styles-check.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,MAAM,UAAU,kBAAkB;IAChC,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,wBAAwB,OAAO,EAAE,CAAC,CAAC;IACnG,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,CAAC,KAAK,CAAC,iCAAiC,KAAK,eAAe,eAAe,mBAAmB,OAAO,IAAI,CAAC,CAAC;QAClH,OAAO,CAAC,mBAAmB,CAAC,yBAAyB,EAAE,EAAE,CAAC,CAAC;KAC5D;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,EAAc;IAC1C,uEAAuE;IACvE,IAAI,OAAO,mBAAmB,KAAK,UAAU,EAAE;QAC7C,OAAO;KACR;IACD,IAAI,OAAO,GAAG,KAAK,CAAC;IAEpB,UAAU,CAAC,GAAG,EAAE;QACd,IAAI,OAAO,EAAE;YACX,OAAO;SACR;QACD,mBAAmB,CAAC,GAAG,EAAE;YACvB,IAAI,OAAO,EAAE;gBACX,OAAO;aACR;YACD,EAAE,EAAE,CAAC;QACP,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,IAAI,CAAC,CAAC;IAET,OAAO,GAAG,EAAE;QACV,OAAO,GAAG,IAAI,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC;AAED,IAAI,OAAO,GAAG,KAAK,CAAC;AACpB,MAAM,sBAAsB,GAAG,GAAG,EAAE;IAClC,IAAI,CAAC,OAAO,EAAE;QACZ,kBAAkB,EAAE,CAAC;QACrB,OAAO,GAAG,IAAI,CAAC;KAChB;AACH,CAAC,CAAC;AAEF,MAAM,UAAU,qBAAqB;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,OAAO,aAAa,CAAC,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC,CAAC;IACvD,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { useEffect } from 'react';\n\nimport { GIT_SHA, PACKAGE_VERSION, THEME } from '../../environment';\nimport { metrics } from '../../metrics';\n\nexport function checkMissingStyles() {\n const result = getComputedStyle(document.body).getPropertyValue(`--awsui-version-info-${GIT_SHA}`);\n if (!result) {\n console.error(`Missing AWS-UI CSS for theme \"${THEME}\", version \"${PACKAGE_VERSION}\", and git sha \"${GIT_SHA}\".`);\n metrics.sendOpsMetricObject('awsui-missing-css-asset', {});\n }\n}\n\nexport function idleWithDelay(cb: () => void) {\n // if idle callbacks not supported, we simply do not collect the metric\n if (typeof requestIdleCallback !== 'function') {\n return;\n }\n let aborted = false;\n\n setTimeout(() => {\n if (aborted) {\n return;\n }\n requestIdleCallback(() => {\n if (aborted) {\n return;\n }\n cb();\n });\n }, 1000);\n\n return () => {\n aborted = true;\n };\n}\n\nlet checked = false;\nconst checkMissingStylesOnce = () => {\n if (!checked) {\n checkMissingStyles();\n checked = true;\n }\n};\n\nexport function useMissingStylesCheck() {\n useEffect(() => {\n return idleWithDelay(() => checkMissingStylesOnce());\n }, []);\n}\n"]}
|
package/internal/manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAIxE,eAAO,MAAM,OAAO,SAAgG,CAAC"}
|
package/internal/metrics.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { Metrics } from '@cloudscape-design/component-toolkit/internal';
|
|
4
|
-
import { PACKAGE_SOURCE, PACKAGE_VERSION } from './environment';
|
|
5
|
-
export const metrics = new Metrics(PACKAGE_SOURCE, PACKAGE_VERSION);
|
|
4
|
+
import { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from './environment';
|
|
5
|
+
export const metrics = new Metrics({ packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme: THEME });
|
|
6
6
|
//# sourceMappingURL=metrics.js.map
|
package/internal/metrics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"metrics.js","sourceRoot":"","sources":["../../../src/internal/metrics.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,+CAA+C,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC,EAAE,aAAa,EAAE,cAAc,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Metrics } from '@cloudscape-design/component-toolkit/internal';\n\nimport { PACKAGE_SOURCE, PACKAGE_VERSION, THEME } from './environment';\n\nexport const metrics = new Metrics({ packageSource: PACKAGE_SOURCE, packageVersion: PACKAGE_VERSION, theme: THEME });\n"]}
|
package/package.json
CHANGED
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"./internal/base-component/index.js",
|
|
150
150
|
"./internal/base-component/styles.css.js"
|
|
151
151
|
],
|
|
152
|
-
"version": "3.0.
|
|
152
|
+
"version": "3.0.1001",
|
|
153
153
|
"repository": {
|
|
154
154
|
"type": "git",
|
|
155
155
|
"url": "https://github.com/cloudscape-design/components.git"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmE,MAAM,OAAO,CAAC;AAWxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAKhD,UAAU,wBACR,SAAQ,YAAY,CAAC,gBAAgB,EAAE,SAAS,GAAG,SAAS,CAAC,EAC3D,0BAA0B;CAAG;AAEjC,QAAA,MAAM,mBAAmB,uGAkNxB,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/prompt-input/internal.js
CHANGED
|
@@ -39,9 +39,9 @@ const InternalPromptInput = React.forwardRef((_a, ref) => {
|
|
|
39
39
|
}), [textareaRef]);
|
|
40
40
|
const handleKeyDown = (event) => {
|
|
41
41
|
fireKeyboardEvent(onKeyDown, event);
|
|
42
|
-
if (event.key === 'Enter' && !event.shiftKey) {
|
|
43
|
-
if (
|
|
44
|
-
event.
|
|
42
|
+
if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
43
|
+
if (event.currentTarget.form && !event.isDefaultPrevented()) {
|
|
44
|
+
event.currentTarget.form.requestSubmit();
|
|
45
45
|
}
|
|
46
46
|
event.preventDefault();
|
|
47
47
|
fireNonCancelableEvent(onAction, { value });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,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its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SomeRequired } from '../internal/types';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n const DEFAULT_MAX_ROWS = 3;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey) {\n if ('form' in event.target && event.target.form !== null && !event.isDefaultPrevented()) {\n (event.target.form as HTMLFormElement).requestSubmit();\n }\n\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n textareaRef.current.style.height = 'auto';\n\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n\n if (maxRows === -1) {\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `max(${scrollHeight}, ${minTextareaHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n <div className={styles.buffer} onClick={() => textareaRef.current?.focus()} />\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/prompt-input/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAO,WAAW,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxF,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,OAAO,cAAc,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC/E,OAAO,KAAK,MAAM,MAAM,qCAAqC,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAIrE,OAAO,MAAM,MAAM,iBAAiB,CAAC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I;YAC5D,eAAe,IAAI,CAAC,gBAAgB,IAAI,MAAM,CAC3C;QACL,gBAAgB,IAAI,CACnB,6BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,EAAE,cAAc,CAAC,mBAAmB,CAAC,EAAE;gBAChF,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,+BAA+B;gBAC3D,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;aAC1B,CAAC;YAED,gBAAgB;YACjB,6BAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,WAAC,OAAA,MAAA,WAAW,CAAC,OAAO,0CAAE,KAAK,EAAE,CAAA,EAAA,GAAI;YAC7E,eAAe,IAAI,MAAM,CACtB,CACP,CACG,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,mBAAmB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { Ref, useCallback, useEffect, useImperativeHandle, useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useDensityMode } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalButton from '../button/internal';\nimport { convertAutoComplete } from '../input/utils';\nimport { getBaseProps } from '../internal/base-component';\nimport { useFormFieldContext } from '../internal/context/form-field-context';\nimport { fireKeyboardEvent, fireNonCancelableEvent } from '../internal/events';\nimport * as tokens from '../internal/generated/styles/tokens';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useVisualRefresh } from '../internal/hooks/use-visual-mode';\nimport { SomeRequired } from '../internal/types';\nimport { PromptInputProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testutilStyles from './test-classes/styles.css.js';\n\ninterface InternalPromptInputProps\n extends SomeRequired<PromptInputProps, 'maxRows' | 'minRows'>,\n InternalBaseComponentProps {}\n\nconst InternalPromptInput = React.forwardRef(\n (\n {\n value,\n actionButtonAriaLabel,\n actionButtonIconName,\n actionButtonIconUrl,\n actionButtonIconSvg,\n actionButtonIconAlt,\n ariaLabel,\n autoComplete,\n autoFocus,\n disableActionButton,\n disableBrowserAutocorrect,\n disabled,\n maxRows,\n minRows,\n name,\n onAction,\n onBlur,\n onChange,\n onFocus,\n onKeyDown,\n onKeyUp,\n placeholder,\n readOnly,\n spellcheck,\n secondaryActions,\n secondaryContent,\n disableSecondaryActionsPaddings,\n disableSecondaryContentPaddings,\n __internalRootRef = null,\n ...rest\n }: InternalPromptInputProps,\n ref: Ref<PromptInputProps.Ref>\n ) => {\n const { ariaLabelledby, ariaDescribedby, controlId, invalid, warning } = useFormFieldContext(rest);\n\n const baseProps = getBaseProps(rest);\n\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n\n const isRefresh = useVisualRefresh();\n const isCompactMode = useDensityMode(textareaRef) === 'compact';\n\n const PADDING = isRefresh ? tokens.spaceXxs : tokens.spaceXxxs;\n const LINE_HEIGHT = tokens.lineHeightBodyM;\n const DEFAULT_MAX_ROWS = 3;\n\n useImperativeHandle(\n ref,\n () => ({\n focus(...args: Parameters<HTMLElement['focus']>) {\n textareaRef.current?.focus(...args);\n },\n select() {\n textareaRef.current?.select();\n },\n setSelectionRange(...args: Parameters<HTMLTextAreaElement['setSelectionRange']>) {\n textareaRef.current?.setSelectionRange(...args);\n },\n }),\n [textareaRef]\n );\n\n const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n fireKeyboardEvent(onKeyDown, event);\n\n if (event.key === 'Enter' && !event.shiftKey && !event.nativeEvent.isComposing) {\n if (event.currentTarget.form && !event.isDefaultPrevented()) {\n event.currentTarget.form.requestSubmit();\n }\n event.preventDefault();\n fireNonCancelableEvent(onAction, { value });\n }\n };\n\n const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n fireNonCancelableEvent(onChange, { value: event.target.value });\n adjustTextareaHeight();\n };\n\n const hasActionButton = actionButtonIconName || actionButtonIconSvg || actionButtonIconUrl;\n\n const adjustTextareaHeight = useCallback(() => {\n if (textareaRef.current) {\n // this is required so the scrollHeight becomes dynamic, otherwise it will be locked at the highest value for the size it reached e.g. 500px\n textareaRef.current.style.height = 'auto';\n\n const minTextareaHeight = `calc(${LINE_HEIGHT} + ${tokens.spaceScaledXxs} * 2)`; // the min height of Textarea with 1 row\n\n if (maxRows === -1) {\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `max(${scrollHeight}, ${minTextareaHeight})`;\n } else {\n const maxRowsHeight = `calc(${maxRows <= 0 ? DEFAULT_MAX_ROWS : maxRows} * (${LINE_HEIGHT} + ${PADDING} / 2) + ${PADDING})`;\n const scrollHeight = `calc(${textareaRef.current.scrollHeight}px)`;\n textareaRef.current.style.height = `min(max(${scrollHeight}, ${minTextareaHeight}), ${maxRowsHeight})`;\n }\n }\n }, [maxRows, LINE_HEIGHT, PADDING]);\n\n useEffect(() => {\n const handleResize = () => {\n adjustTextareaHeight();\n };\n\n window.addEventListener('resize', handleResize);\n\n return () => {\n window.removeEventListener('resize', handleResize);\n };\n }, [adjustTextareaHeight]);\n\n useEffect(() => {\n adjustTextareaHeight();\n }, [value, adjustTextareaHeight, maxRows, isCompactMode]);\n\n const attributes: React.TextareaHTMLAttributes<HTMLTextAreaElement> = {\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledby,\n 'aria-describedby': ariaDescribedby,\n 'aria-invalid': invalid ? 'true' : undefined,\n name,\n placeholder,\n autoFocus,\n className: clsx(styles.textarea, testutilStyles.textarea, {\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n }),\n autoComplete: convertAutoComplete(autoComplete),\n spellCheck: spellcheck,\n disabled,\n readOnly: readOnly ? true : undefined,\n rows: minRows,\n onKeyDown: handleKeyDown,\n onKeyUp: onKeyUp && (event => fireKeyboardEvent(onKeyUp, event)),\n // We set a default value on the component in order to force it into the controlled mode.\n value: value || '',\n onChange: handleChange,\n onBlur: onBlur && (() => fireNonCancelableEvent(onBlur)),\n onFocus: onFocus && (() => fireNonCancelableEvent(onFocus)),\n };\n\n if (disableBrowserAutocorrect) {\n attributes.autoCorrect = 'off';\n attributes.autoCapitalize = 'off';\n }\n\n const action = (\n <div className={styles.button}>\n <InternalButton\n className={clsx(styles['action-button'], testutilStyles['action-button'])}\n ariaLabel={actionButtonAriaLabel}\n disabled={disabled || readOnly || disableActionButton}\n __focusable={readOnly}\n iconName={actionButtonIconName}\n iconUrl={actionButtonIconUrl}\n iconSvg={actionButtonIconSvg}\n iconAlt={actionButtonIconAlt}\n onClick={() => fireNonCancelableEvent(onAction, { value })}\n variant=\"icon\"\n />\n </div>\n );\n\n return (\n <div\n {...baseProps}\n aria-label={ariaLabel}\n className={clsx(styles.root, testutilStyles.root, baseProps.className, {\n [styles['textarea-readonly']]: readOnly,\n [styles['textarea-invalid']]: invalid,\n [styles['textarea-warning']]: warning && !invalid,\n [styles.disabled]: disabled,\n })}\n ref={__internalRootRef}\n role=\"region\"\n >\n {secondaryContent && (\n <div\n className={clsx(styles['secondary-content'], testutilStyles['secondary-content'], {\n [styles['with-paddings']]: !disableSecondaryContentPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryContent}\n </div>\n )}\n <div className={styles['textarea-wrapper']}>\n <textarea ref={textareaRef} id={controlId} {...attributes} />\n {hasActionButton && !secondaryActions && action}\n </div>\n {secondaryActions && (\n <div\n className={clsx(styles['secondary-actions'], testutilStyles['secondary-actions'], {\n [styles['with-paddings']]: !disableSecondaryActionsPaddings,\n [styles.invalid]: invalid,\n [styles.warning]: warning,\n })}\n >\n {secondaryActions}\n <div className={styles.buffer} onClick={() => textareaRef.current?.focus()} />\n {hasActionButton && action}\n </div>\n )}\n </div>\n );\n }\n);\n\nexport default InternalPromptInput;\n"]}
|
|
@@ -8,7 +8,8 @@ export interface SegmentedControlProps extends BaseComponentProps {
|
|
|
8
8
|
*/
|
|
9
9
|
selectedId: string | null;
|
|
10
10
|
/**
|
|
11
|
-
* An array of objects representing options.
|
|
11
|
+
* An array of objects representing options. Only up to 6 options are supported.
|
|
12
|
+
* Each segment has the following properties:
|
|
12
13
|
*
|
|
13
14
|
* - `id` (string) - The ID of the segment.
|
|
14
15
|
* - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,qBAAsB,SAAQ,kBAAkB;IAC/D;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAEtD;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;CAC1E;AAED,yBAAiB,qBAAqB,CAAC;IACrC,UAAiB,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC;QAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;KACf;IAED,UAAiB,YAAY;QAC3B,UAAU,EAAE,MAAM,CAAC;KACpB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/segmented-control/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { IconProps } from '../icon/interfaces';\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface SegmentedControlProps extends BaseComponentProps {\n /**\n * ID of the selected option. If you want to clear the selection, use `null`.\n */\n selectedId: string | null;\n\n /**\n * An array of objects representing options. Only up to 6 options are supported.\n * Each segment has the following properties:\n *\n * - `id` (string) - The ID of the segment.\n * - `disabled` [boolean] - (Optional) Determines whether the segment is disabled, which prevents the user from selecting it.\n * - `disabledReason` (string) - (Optional) Displays tooltip near the segment when disabled. Use to provide additional context.\n * - `iconName` (string) - (Optional) Specifies the name of the icon, used with the [icon component](/components/icon/).\n * - `iconAlt` (string) - (Optional) Specifies alternate text for the icon when using `iconUrl`, or `iconName` without `text`.\n * This is required when you use an icon without `text`.\n * - `iconUrl` (string) - (Optional) Specifies the URL of a custom icon.\n * - `iconSvg` (ReactNode) - (Optional) Custom SVG icon. Equivalent to the `svg` slot of the [icon component](/components/icon/).\n * - `text` (string) - (Optional) Specifies the text of the segment.\n */\n options?: ReadonlyArray<SegmentedControlProps.Option>;\n\n /**\n * Defines the label of the entire segmented control. In the standard view (that is, all individual segments are visible),\n * this label is used as `aria-label` on the group of segments. In a narrow container, where this component is displayed as a select component,\n * the label is visible and attached to the select component, unless `ariaLabelledBy` is defined. Don't use `label` and `ariaLabelledBy` at the same time.\n */\n label?: string;\n\n /**\n * Adds aria-labelledby to the component. Create a visually hidden element with an ID and set this property to that ID. If you don't want the label to be visible in narrow containers, use this property instead of `label`.\n */\n ariaLabelledby?: string;\n\n /**\n * Called when the user selects a different segment.\n */\n onChange?: NonCancelableEventHandler<SegmentedControlProps.ChangeDetail>;\n}\n\nexport namespace SegmentedControlProps {\n export interface Option {\n id: string;\n disabled?: boolean;\n disabledReason?: string;\n iconName?: IconProps.Name;\n iconAlt?: string;\n iconUrl?: string;\n iconSvg?: React.ReactNode;\n text?: string;\n }\n\n export interface ChangeDetail {\n selectedId: string;\n }\n}\n"]}
|