@cloudscape-design/components 3.0.441 → 3.0.443

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/anchor-navigation/use-scroll-spy.js +1 -1
  2. package/anchor-navigation/use-scroll-spy.js.map +1 -1
  3. package/flashbar/flash.d.ts.map +1 -1
  4. package/flashbar/flash.js +7 -9
  5. package/flashbar/flash.js.map +1 -1
  6. package/form/index.d.ts.map +1 -1
  7. package/form/index.js +4 -4
  8. package/form/index.js.map +1 -1
  9. package/i18n/messages/all.all.js +27 -13
  10. package/i18n/messages/all.all.json +27 -13
  11. package/i18n/messages/all.de.js +3 -1
  12. package/i18n/messages/all.de.json +3 -1
  13. package/i18n/messages/all.en-GB.js +1 -1
  14. package/i18n/messages/all.en-GB.json +1 -1
  15. package/i18n/messages/all.en.js +1 -1
  16. package/i18n/messages/all.en.json +1 -1
  17. package/i18n/messages/all.es.js +3 -1
  18. package/i18n/messages/all.es.json +3 -1
  19. package/i18n/messages/all.fr.js +3 -1
  20. package/i18n/messages/all.fr.json +3 -1
  21. package/i18n/messages/all.id.js +1 -1
  22. package/i18n/messages/all.id.json +1 -1
  23. package/i18n/messages/all.it.js +3 -1
  24. package/i18n/messages/all.it.json +3 -1
  25. package/i18n/messages/all.ja.js +3 -1
  26. package/i18n/messages/all.ja.json +3 -1
  27. package/i18n/messages/all.ko.js +1 -1
  28. package/i18n/messages/all.ko.json +1 -1
  29. package/i18n/messages/all.pt-BR.js +3 -1
  30. package/i18n/messages/all.pt-BR.json +3 -1
  31. package/i18n/messages/all.tr.js +3 -1
  32. package/i18n/messages/all.tr.json +3 -1
  33. package/i18n/messages/all.zh-CN.js +1 -1
  34. package/i18n/messages/all.zh-CN.json +1 -1
  35. package/i18n/messages/all.zh-TW.js +1 -1
  36. package/i18n/messages/all.zh-TW.json +1 -1
  37. package/internal/components/live-region/index.d.ts +20 -2
  38. package/internal/components/live-region/index.d.ts.map +1 -1
  39. package/internal/components/live-region/index.js +37 -5
  40. package/internal/components/live-region/index.js.map +1 -1
  41. package/internal/components/screenreader-only/index.d.ts +1 -1
  42. package/internal/components/screenreader-only/index.d.ts.map +1 -1
  43. package/internal/components/screenreader-only/index.js.map +1 -1
  44. package/internal/environment.js +1 -1
  45. package/internal/environment.json +1 -1
  46. package/internal/manifest.json +1 -1
  47. package/package.json +1 -1
  48. package/table/column-widths-utils.d.ts +0 -1
  49. package/table/column-widths-utils.d.ts.map +1 -1
  50. package/table/column-widths-utils.js +0 -18
  51. package/table/column-widths-utils.js.map +1 -1
  52. package/table/internal.d.ts.map +1 -1
  53. package/table/internal.js +4 -5
  54. package/table/internal.js.map +1 -1
  55. package/table/sticky-columns/use-sticky-columns.js +1 -1
  56. package/table/sticky-columns/use-sticky-columns.js.map +1 -1
  57. package/table/thead.d.ts +1 -0
  58. package/table/thead.d.ts.map +1 -1
  59. package/table/thead.js +18 -3
  60. package/table/thead.js.map +1 -1
  61. package/table/use-column-widths.d.ts +3 -5
  62. package/table/use-column-widths.d.ts.map +1 -1
  63. package/table/use-column-widths.js +11 -57
  64. package/table/use-column-widths.js.map +1 -1
  65. package/table/use-sticky-header.d.ts.map +1 -1
  66. package/table/use-sticky-header.js +13 -0
  67. package/table/use-sticky-header.js.map +1 -1
@@ -449,7 +449,7 @@
449
449
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "ID Versi" }],
450
450
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "Terakhir diubah" }],
451
451
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "Ukuran" }],
452
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "Jalur harus dimulai dengan s3://" }],
452
+ "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "Jalur harus dimulai dengan s3:// agar valid." }],
453
453
  "i18nStrings.validationBucketLowerCase": [
454
454
  { "type": 0, "value": "Nama bucket harus diawali dengan karakter huruf kecil atau angka." }
455
455
  ],
@@ -449,7 +449,9 @@ export default {
449
449
  'i18nStrings.columnVersionID': [{ type: 0, value: 'ID Versione' }],
450
450
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: 'Ultima modifica' }],
451
451
  'i18nStrings.columnVersionSize': [{ type: 0, value: 'Dimensione' }],
452
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: 'Il percorso deve iniziare con s3://' }],
452
+ 'i18nStrings.validationPathMustBegin': [
453
+ { type: 0, value: 'Il percorso deve iniziare con s3:// per essere valido.' },
454
+ ],
453
455
  'i18nStrings.validationBucketLowerCase': [
454
456
  { type: 0, value: 'Il nome del bucket deve iniziare con un carattere minuscolo o un numero.' },
455
457
  ],
@@ -453,7 +453,9 @@
453
453
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "ID Versione" }],
454
454
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "Ultima modifica" }],
455
455
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "Dimensione" }],
456
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "Il percorso deve iniziare con s3://" }],
456
+ "i18nStrings.validationPathMustBegin": [
457
+ { "type": 0, "value": "Il percorso deve iniziare con s3:// per essere valido." }
458
+ ],
457
459
  "i18nStrings.validationBucketLowerCase": [
458
460
  { "type": 0, "value": "Il nome del bucket deve iniziare con un carattere minuscolo o un numero." }
459
461
  ],
@@ -458,7 +458,9 @@ export default {
458
458
  'i18nStrings.columnVersionID': [{ type: 0, value: 'バージョン ID' }],
459
459
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: '最終更新日' }],
460
460
  'i18nStrings.columnVersionSize': [{ type: 0, value: 'サイズ' }],
461
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: 'パスの先頭は s3:// である必要があります' }],
461
+ 'i18nStrings.validationPathMustBegin': [
462
+ { type: 0, value: 'パスが有効であるためには、s3:// で始まる必要があります。' },
463
+ ],
462
464
  'i18nStrings.validationBucketLowerCase': [
463
465
  { type: 0, value: 'バケット名の先頭は小文字または数字である必要があります。' },
464
466
  ],
@@ -462,7 +462,9 @@
462
462
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "バージョン ID" }],
463
463
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "最終更新日" }],
464
464
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "サイズ" }],
465
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "パスの先頭は s3:// である必要があります" }],
465
+ "i18nStrings.validationPathMustBegin": [
466
+ { "type": 0, "value": "パスが有効であるためには、s3:// で始まる必要があります。" }
467
+ ],
466
468
  "i18nStrings.validationBucketLowerCase": [
467
469
  { "type": 0, "value": "バケット名の先頭は小文字または数字である必要があります。" }
468
470
  ],
@@ -439,7 +439,7 @@ export default {
439
439
  'i18nStrings.columnVersionID': [{ type: 0, value: '버전 ID' }],
440
440
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: '최종 수정 날짜' }],
441
441
  'i18nStrings.columnVersionSize': [{ type: 0, value: '크기' }],
442
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: '경로는 s3://로 시작해야 합니다.' }],
442
+ 'i18nStrings.validationPathMustBegin': [{ type: 0, value: '유효한 경로는 s3://로 시작해야 합니다.' }],
443
443
  'i18nStrings.validationBucketLowerCase': [{ type: 0, value: '버킷 이름은 소문자나 숫자로 시작해야 합니다.' }],
444
444
  'i18nStrings.validationBucketMustNotContain': [{ type: 0, value: '버킷 이름에 대문자를 포함할 수 없습니다.' }],
445
445
  'i18nStrings.validationBucketLength': [{ type: 0, value: '버킷 이름은 3~63자여야 합니다.' }],
@@ -443,7 +443,7 @@
443
443
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "버전 ID" }],
444
444
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "최종 수정 날짜" }],
445
445
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "크기" }],
446
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "경로는 s3://로 시작해야 합니다." }],
446
+ "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "유효한 경로는 s3://로 시작해야 합니다." }],
447
447
  "i18nStrings.validationBucketLowerCase": [
448
448
  { "type": 0, "value": "버킷 이름은 소문자나 숫자로 시작해야 합니다." }
449
449
  ],
@@ -456,7 +456,9 @@ export default {
456
456
  'i18nStrings.columnVersionID': [{ type: 0, value: 'ID da versão' }],
457
457
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: 'Última modificação' }],
458
458
  'i18nStrings.columnVersionSize': [{ type: 0, value: 'Tamanho' }],
459
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: 'O caminho precisa começar com s3://' }],
459
+ 'i18nStrings.validationPathMustBegin': [
460
+ { type: 0, value: 'O caminho deve começar com s3:// para ser válido.' },
461
+ ],
460
462
  'i18nStrings.validationBucketLowerCase': [
461
463
  { type: 0, value: 'O nome do bucket deve começar com um caractere minúsculo ou com um número.' },
462
464
  ],
@@ -457,7 +457,9 @@
457
457
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "ID da versão" }],
458
458
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "Última modificação" }],
459
459
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "Tamanho" }],
460
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "O caminho precisa começar com s3://" }],
460
+ "i18nStrings.validationPathMustBegin": [
461
+ { "type": 0, "value": "O caminho deve começar com s3:// para ser válido." }
462
+ ],
461
463
  "i18nStrings.validationBucketLowerCase": [
462
464
  { "type": 0, "value": "O nome do bucket deve começar com um caractere minúsculo ou com um número." }
463
465
  ],
@@ -449,7 +449,9 @@ export default {
449
449
  'i18nStrings.columnVersionID': [{ type: 0, value: 'Sürüm kimliği' }],
450
450
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: 'Son değiştirme' }],
451
451
  'i18nStrings.columnVersionSize': [{ type: 0, value: 'Boyut' }],
452
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: 'Yol s3:// ile başlamalıdır' }],
452
+ 'i18nStrings.validationPathMustBegin': [
453
+ { type: 0, value: 'Yolun geçerli olması için s3:// ile başlaması gerekir.' },
454
+ ],
453
455
  'i18nStrings.validationBucketLowerCase': [
454
456
  { type: 0, value: 'Bucket adı, küçük harfli bir karakter veya sayı ile başlamalıdır.' },
455
457
  ],
@@ -457,7 +457,9 @@
457
457
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "Sürüm kimliği" }],
458
458
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "Son değiştirme" }],
459
459
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "Boyut" }],
460
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "Yol s3:// ile başlamalıdır" }],
460
+ "i18nStrings.validationPathMustBegin": [
461
+ { "type": 0, "value": "Yolun geçerli olması için s3:// ile başlaması gerekir." }
462
+ ],
461
463
  "i18nStrings.validationBucketLowerCase": [
462
464
  { "type": 0, "value": "Bucket adı, küçük harfli bir karakter veya sayı ile başlamalıdır." }
463
465
  ],
@@ -446,7 +446,7 @@ export default {
446
446
  'i18nStrings.columnVersionID': [{ type: 0, value: '版本 ID' }],
447
447
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: '上次修改时间' }],
448
448
  'i18nStrings.columnVersionSize': [{ type: 0, value: '大小' }],
449
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: '路径必须以 s3:// 开头' }],
449
+ 'i18nStrings.validationPathMustBegin': [{ type: 0, value: '路径必须以 s3:// 开头才有效。' }],
450
450
  'i18nStrings.validationBucketLowerCase': [{ type: 0, value: '存储桶名称必须以小写字符或数字开头。' }],
451
451
  'i18nStrings.validationBucketMustNotContain': [{ type: 0, value: '存储桶名称不得包含大写字符。' }],
452
452
  'i18nStrings.validationBucketLength': [{ type: 0, value: '存储桶名称必须介于 3 到 63 个字符之间。' }],
@@ -448,7 +448,7 @@
448
448
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "版本 ID" }],
449
449
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "上次修改时间" }],
450
450
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "大小" }],
451
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "路径必须以 s3:// 开头" }],
451
+ "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "路径必须以 s3:// 开头才有效。" }],
452
452
  "i18nStrings.validationBucketLowerCase": [{ "type": 0, "value": "存储桶名称必须以小写字符或数字开头。" }],
453
453
  "i18nStrings.validationBucketMustNotContain": [{ "type": 0, "value": "存储桶名称不得包含大写字符。" }],
454
454
  "i18nStrings.validationBucketLength": [{ "type": 0, "value": "存储桶名称必须介于 3 到 63 个字符之间。" }],
@@ -446,7 +446,7 @@ export default {
446
446
  'i18nStrings.columnVersionID': [{ type: 0, value: '版本 ID' }],
447
447
  'i18nStrings.columnVersionLastModified': [{ type: 0, value: '上次修改' }],
448
448
  'i18nStrings.columnVersionSize': [{ type: 0, value: '尺寸' }],
449
- 'i18nStrings.validationPathMustBegin': [{ type: 0, value: '路徑必須以 s3:// 開頭' }],
449
+ 'i18nStrings.validationPathMustBegin': [{ type: 0, value: '路徑必須以 s3:// 開頭才有效。' }],
450
450
  'i18nStrings.validationBucketLowerCase': [{ type: 0, value: '儲存貯體名稱必須以小寫字元或數字開頭。' }],
451
451
  'i18nStrings.validationBucketMustNotContain': [{ type: 0, value: '儲存貯體名稱不得包含大寫字元。' }],
452
452
  'i18nStrings.validationBucketLength': [{ type: 0, value: '儲存貯體名稱必須介於 3 到 63 個字元之間。' }],
@@ -448,7 +448,7 @@
448
448
  "i18nStrings.columnVersionID": [{ "type": 0, "value": "版本 ID" }],
449
449
  "i18nStrings.columnVersionLastModified": [{ "type": 0, "value": "上次修改" }],
450
450
  "i18nStrings.columnVersionSize": [{ "type": 0, "value": "尺寸" }],
451
- "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "路徑必須以 s3:// 開頭" }],
451
+ "i18nStrings.validationPathMustBegin": [{ "type": 0, "value": "路徑必須以 s3:// 開頭才有效。" }],
452
452
  "i18nStrings.validationBucketLowerCase": [{ "type": 0, "value": "儲存貯體名稱必須以小寫字元或數字開頭。" }],
453
453
  "i18nStrings.validationBucketMustNotContain": [{ "type": 0, "value": "儲存貯體名稱不得包含大寫字元。" }],
454
454
  "i18nStrings.validationBucketLength": [{ "type": 0, "value": "儲存貯體名稱必須介於 3 到 63 個字元之間。" }],
@@ -5,8 +5,15 @@ export interface LiveRegionProps extends ScreenreaderOnlyProps {
5
5
  delay?: number;
6
6
  visible?: boolean;
7
7
  tagName?: 'span' | 'div';
8
- children: React.ReactNode;
9
8
  id?: string;
9
+ /**
10
+ * Use a list of strings and/or existing DOM elements for building the
11
+ * announcement text. This avoids rendering separate content just for this
12
+ * LiveRegion.
13
+ *
14
+ * If this property is set, the `children` will be ignored.
15
+ */
16
+ source?: Array<string | React.RefObject<HTMLElement> | undefined>;
10
17
  }
11
18
  /**
12
19
  * The live region is hidden in the layout, but visible for screen readers.
@@ -17,31 +24,42 @@ export interface LiveRegionProps extends ScreenreaderOnlyProps {
17
24
  *
18
25
  * If you notice there are different words being merged together,
19
26
  * check if there are text nodes not being wrapped in elements, like:
27
+ * ```
20
28
  * <LiveRegion>
21
29
  * {title}
22
30
  * <span><Details /></span>
23
31
  * </LiveRegion>
32
+ * ```
24
33
  *
25
34
  * To fix, wrap "title" in an element:
35
+ * ```
26
36
  * <LiveRegion>
27
37
  * <span>{title}</span>
28
38
  * <span><Details /></span>
29
39
  * </LiveRegion>
40
+ * ```
30
41
  *
31
42
  * Or create a single text node if possible:
43
+ * ```
32
44
  * <LiveRegion>
33
45
  * {`${title} ${details}`}
34
46
  * </LiveRegion>
47
+ * ```
35
48
  *
36
49
  * The live region is always atomic, because non-atomic regions can be treated by screen readers
37
50
  * differently and produce unexpected results. To imitate non-atomic announcements simply use
38
51
  * multiple live regions:
52
+ * ```
39
53
  * <>
40
54
  * <LiveRegion>{title}</LiveRegion>
41
55
  * <LiveRegion><Details /></LiveRegion>
42
56
  * </>
57
+ * ```
58
+ *
59
+ * If you place interactive content inside the LiveRegion, the content will still be
60
+ * interactive (e.g. as a tab stop). Consider using the `source` property instead.
43
61
  */
44
62
  declare const _default: React.MemoExoticComponent<typeof LiveRegion>;
45
63
  export default _default;
46
- declare function LiveRegion({ assertive, delay, visible, tagName: TagName, children, id, ...restProps }: LiveRegionProps): JSX.Element;
64
+ declare function LiveRegion({ assertive, delay, visible, tagName: TagName, children, id, source, ...restProps }: LiveRegionProps): JSX.Element;
47
65
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/live-region/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAyB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;AACH,wBAAgC;AAEhC,iBAAS,UAAU,CAAC,EAClB,SAAiB,EACjB,KAAU,EACV,OAAe,EACf,OAAO,EAAE,OAAgB,EACzB,QAAQ,EACR,EAAE,EACF,GAAG,SAAS,EACb,EAAE,eAAe,eA8DjB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/live-region/index.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAyB,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAG/E,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,CAAC;CACnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;;AACH,wBAAgC;AAEhC,iBAAS,UAAU,CAAC,EAClB,SAAiB,EACjB,KAAU,EACV,OAAe,EACf,OAAO,EAAE,OAAgB,EACzB,QAAQ,EACR,EAAE,EACF,MAAM,EACN,GAAG,SAAS,EACb,EAAE,eAAe,eAqFjB"}
@@ -15,33 +15,44 @@ import styles from './styles.css.js';
15
15
  *
16
16
  * If you notice there are different words being merged together,
17
17
  * check if there are text nodes not being wrapped in elements, like:
18
+ * ```
18
19
  * <LiveRegion>
19
20
  * {title}
20
21
  * <span><Details /></span>
21
22
  * </LiveRegion>
23
+ * ```
22
24
  *
23
25
  * To fix, wrap "title" in an element:
26
+ * ```
24
27
  * <LiveRegion>
25
28
  * <span>{title}</span>
26
29
  * <span><Details /></span>
27
30
  * </LiveRegion>
31
+ * ```
28
32
  *
29
33
  * Or create a single text node if possible:
34
+ * ```
30
35
  * <LiveRegion>
31
36
  * {`${title} ${details}`}
32
37
  * </LiveRegion>
38
+ * ```
33
39
  *
34
40
  * The live region is always atomic, because non-atomic regions can be treated by screen readers
35
41
  * differently and produce unexpected results. To imitate non-atomic announcements simply use
36
42
  * multiple live regions:
43
+ * ```
37
44
  * <>
38
45
  * <LiveRegion>{title}</LiveRegion>
39
46
  * <LiveRegion><Details /></LiveRegion>
40
47
  * </>
48
+ * ```
49
+ *
50
+ * If you place interactive content inside the LiveRegion, the content will still be
51
+ * interactive (e.g. as a tab stop). Consider using the `source` property instead.
41
52
  */
42
53
  export default memo(LiveRegion);
43
54
  function LiveRegion(_a) {
44
- var { assertive = false, delay = 10, visible = false, tagName: TagName = 'span', children, id } = _a, restProps = __rest(_a, ["assertive", "delay", "visible", "tagName", "children", "id"]);
55
+ var { assertive = false, delay = 10, visible = false, tagName: TagName = 'span', children, id, source } = _a, restProps = __rest(_a, ["assertive", "delay", "visible", "tagName", "children", "id", "source"]);
45
56
  const sourceRef = useRef(null);
46
57
  const targetRef = useRef(null);
47
58
  /*
@@ -56,9 +67,30 @@ function LiveRegion(_a) {
56
67
  does not impact the performance. If it does, prefer using a string as children prop.
57
68
  */
58
69
  useEffect(() => {
70
+ function getSourceContent() {
71
+ if (source) {
72
+ return source
73
+ .map(item => {
74
+ if (!item) {
75
+ return undefined;
76
+ }
77
+ if (typeof item === 'string') {
78
+ return item;
79
+ }
80
+ if (item.current) {
81
+ return extractInnerText(item.current);
82
+ }
83
+ })
84
+ .filter(Boolean)
85
+ .join(' ');
86
+ }
87
+ if (sourceRef.current) {
88
+ return extractInnerText(sourceRef.current);
89
+ }
90
+ }
59
91
  function updateLiveRegion() {
60
- if (targetRef.current && sourceRef.current) {
61
- const sourceContent = extractInnerText(sourceRef.current);
92
+ const sourceContent = getSourceContent();
93
+ if (targetRef.current && sourceContent) {
62
94
  const targetContent = extractInnerText(targetRef.current);
63
95
  if (targetContent !== sourceContent) {
64
96
  // The aria-atomic does not work properly in Voice Over, causing
@@ -82,9 +114,9 @@ function LiveRegion(_a) {
82
114
  };
83
115
  });
84
116
  return (React.createElement(React.Fragment, null,
85
- visible && (React.createElement(TagName, { ref: sourceRef, id: id }, children)),
117
+ visible && !source && (React.createElement(TagName, { ref: sourceRef, id: id }, children)),
86
118
  React.createElement(ScreenreaderOnly, Object.assign({}, restProps, { className: clsx(styles.root, restProps.className) }),
87
- !visible && (React.createElement(TagName, { ref: sourceRef, "aria-hidden": "true" }, children)),
119
+ !visible && !source && (React.createElement(TagName, { ref: sourceRef, "aria-hidden": "true" }, children)),
88
120
  React.createElement("span", { ref: targetRef, "aria-atomic": "true", "aria-live": assertive ? 'assertive' : 'polite' }))));
89
121
  }
90
122
  // This only extracts text content from the node including all its children which is enough for now.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,gBAA2C,MAAM,sBAAsB,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAWrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EAQF;QARE,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,KAAK,EACf,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,QAAQ,EACR,EAAE,OAEc,EADb,SAAS,cAPM,8DAQnB,CADa;IAEZ,MAAM,SAAS,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IAEjE;;;;;;;;;;MAUE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,gBAAgB;YACvB,IAAI,SAAS,CAAC,OAAO,IAAI,SAAS,CAAC,OAAO,EAAE;gBAC1C,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC1D,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC1D,IAAI,aAAa,KAAK,aAAa,EAAE;oBACnC,gEAAgE;oBAChE,2DAA2D;oBAC3D,sDAAsD;oBACtD,SAAS,CAAC,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;iBAC7C;aACF;QACH,CAAC;QAED,IAAI,SAAwB,CAAC;QAC7B,IAAI,KAAK,EAAE;YACT,SAAS,GAAG,UAAU,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SACjD;aAAM;YACL,gBAAgB,EAAE,CAAC;SACpB;QAED,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,EAAE;gBACb,YAAY,CAAC,SAAS,CAAC,CAAC;aACzB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL;QACG,OAAO,IAAI,CACV,oBAAC,OAAO,IAAC,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,IAC5B,QAAQ,CACD,CACX;QAED,oBAAC,gBAAgB,oBAAK,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC;YAC/E,CAAC,OAAO,IAAI,CACX,oBAAC,OAAO,IAAC,GAAG,EAAE,SAAS,iBAAc,MAAM,IACxC,QAAQ,CACD,CACX;YAED,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,eAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAS,CAC9E,CAClB,CACJ,CAAC;AACJ,CAAC;AAED,oGAAoG;AACpG,oGAAoG;AACpG,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo, useEffect, useRef } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only';\nimport styles from './styles.css.js';\n\nexport interface LiveRegionProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n visible?: boolean;\n tagName?: 'span' | 'div';\n children: React.ReactNode;\n id?: string;\n}\n\n/**\n * The live region is hidden in the layout, but visible for screen readers.\n * It's purpose it to announce changes e.g. when custom navigation logic is used.\n *\n * The way live region works differently in different browsers and screen readers and\n * it is recommended to manually test every new implementation.\n *\n * If you notice there are different words being merged together,\n * check if there are text nodes not being wrapped in elements, like:\n * <LiveRegion>\n * {title}\n * <span><Details /></span>\n * </LiveRegion>\n *\n * To fix, wrap \"title\" in an element:\n * <LiveRegion>\n * <span>{title}</span>\n * <span><Details /></span>\n * </LiveRegion>\n *\n * Or create a single text node if possible:\n * <LiveRegion>\n * {`${title} ${details}`}\n * </LiveRegion>\n *\n * The live region is always atomic, because non-atomic regions can be treated by screen readers\n * differently and produce unexpected results. To imitate non-atomic announcements simply use\n * multiple live regions:\n * <>\n * <LiveRegion>{title}</LiveRegion>\n * <LiveRegion><Details /></LiveRegion>\n * </>\n */\nexport default memo(LiveRegion);\n\nfunction LiveRegion({\n assertive = false,\n delay = 10,\n visible = false,\n tagName: TagName = 'span',\n children,\n id,\n ...restProps\n}: LiveRegionProps) {\n const sourceRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n const targetRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n\n /*\n When React state changes, React often produces too many DOM updates, causing NVDA to\n issue many announcements for the same logical event (See https://github.com/nvaccess/nvda/issues/7996).\n\n The code below imitates a debouncing, scheduling a callback every time new React state\n update is detected. When a callback resolves, it copies content from a muted element\n to the live region, which is recognized by screen readers as an update.\n\n If the use case requires no announcement to be ignored, use delay = 0, but ensure it\n does not impact the performance. If it does, prefer using a string as children prop.\n */\n useEffect(() => {\n function updateLiveRegion() {\n if (targetRef.current && sourceRef.current) {\n const sourceContent = extractInnerText(sourceRef.current);\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n }\n\n let timeoutId: null | number;\n if (delay) {\n timeoutId = setTimeout(updateLiveRegion, delay);\n } else {\n updateLiveRegion();\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n });\n\n return (\n <>\n {visible && (\n <TagName ref={sourceRef} id={id}>\n {children}\n </TagName>\n )}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && (\n <TagName ref={sourceRef} aria-hidden=\"true\">\n {children}\n </TagName>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/live-region/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,0DAA0D;AAE1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,gBAA2C,MAAM,sBAAsB,CAAC;AAC/E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAkBrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAe,IAAI,CAAC,UAAU,CAAC,CAAC;AAEhC,SAAS,UAAU,CAAC,EASF;QATE,EAClB,SAAS,GAAG,KAAK,EACjB,KAAK,GAAG,EAAE,EACV,OAAO,GAAG,KAAK,EACf,OAAO,EAAE,OAAO,GAAG,MAAM,EACzB,QAAQ,EACR,EAAE,EACF,MAAM,OAEU,EADb,SAAS,cARM,wEASnB,CADa;IAEZ,MAAM,SAAS,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,MAAM,CAAmC,IAAI,CAAC,CAAC;IAEjE;;;;;;;;;;MAUE;IACF,SAAS,CAAC,GAAG,EAAE;QACb,SAAS,gBAAgB;YACvB,IAAI,MAAM,EAAE;gBACV,OAAO,MAAM;qBACV,GAAG,CAAC,IAAI,CAAC,EAAE;oBACV,IAAI,CAAC,IAAI,EAAE;wBACT,OAAO,SAAS,CAAC;qBAClB;oBACD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;wBAC5B,OAAO,IAAI,CAAC;qBACb;oBACD,IAAI,IAAI,CAAC,OAAO,EAAE;wBAChB,OAAO,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;qBACvC;gBACH,CAAC,CAAC;qBACD,MAAM,CAAC,OAAO,CAAC;qBACf,IAAI,CAAC,GAAG,CAAC,CAAC;aACd;YAED,IAAI,SAAS,CAAC,OAAO,EAAE;gBACrB,OAAO,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;aAC5C;QACH,CAAC;QACD,SAAS,gBAAgB;YACvB,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;YAEzC,IAAI,SAAS,CAAC,OAAO,IAAI,aAAa,EAAE;gBACtC,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;gBAC1D,IAAI,aAAa,KAAK,aAAa,EAAE;oBACnC,gEAAgE;oBAChE,2DAA2D;oBAC3D,sDAAsD;oBACtD,SAAS,CAAC,OAAO,CAAC,SAAS,GAAG,aAAa,CAAC;iBAC7C;aACF;QACH,CAAC;QAED,IAAI,SAAwB,CAAC;QAC7B,IAAI,KAAK,EAAE;YACT,SAAS,GAAG,UAAU,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC;SACjD;aAAM;YACL,gBAAgB,EAAE,CAAC;SACpB;QAED,OAAO,GAAG,EAAE;YACV,IAAI,SAAS,EAAE;gBACb,YAAY,CAAC,SAAS,CAAC,CAAC;aACzB;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,CACL;QACG,OAAO,IAAI,CAAC,MAAM,IAAI,CACrB,oBAAC,OAAO,IAAC,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,IAC5B,QAAQ,CACD,CACX;QAED,oBAAC,gBAAgB,oBAAK,SAAS,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC;YAC/E,CAAC,OAAO,IAAI,CAAC,MAAM,IAAI,CACtB,oBAAC,OAAO,IAAC,GAAG,EAAE,SAAS,iBAAc,MAAM,IACxC,QAAQ,CACD,CACX;YAED,8BAAM,GAAG,EAAE,SAAS,iBAAc,MAAM,eAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAS,CAC9E,CAClB,CACJ,CAAC;AACJ,CAAC;AAED,oGAAoG;AACpG,oGAAoG;AACpG,0FAA0F;AAC1F,SAAS,gBAAgB,CAAC,IAAiB;IACzC,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC5D,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @cloudscape-design/prefer-live-region */\n\nimport clsx from 'clsx';\nimport React, { memo, useEffect, useRef } from 'react';\nimport ScreenreaderOnly, { ScreenreaderOnlyProps } from '../screenreader-only';\nimport styles from './styles.css.js';\n\nexport interface LiveRegionProps extends ScreenreaderOnlyProps {\n assertive?: boolean;\n delay?: number;\n visible?: boolean;\n tagName?: 'span' | 'div';\n id?: string;\n /**\n * Use a list of strings and/or existing DOM elements for building the\n * announcement text. This avoids rendering separate content just for this\n * LiveRegion.\n *\n * If this property is set, the `children` will be ignored.\n */\n source?: Array<string | React.RefObject<HTMLElement> | undefined>;\n}\n\n/**\n * The live region is hidden in the layout, but visible for screen readers.\n * It's purpose it to announce changes e.g. when custom navigation logic is used.\n *\n * The way live region works differently in different browsers and screen readers and\n * it is recommended to manually test every new implementation.\n *\n * If you notice there are different words being merged together,\n * check if there are text nodes not being wrapped in elements, like:\n * ```\n * <LiveRegion>\n * {title}\n * <span><Details /></span>\n * </LiveRegion>\n * ```\n *\n * To fix, wrap \"title\" in an element:\n * ```\n * <LiveRegion>\n * <span>{title}</span>\n * <span><Details /></span>\n * </LiveRegion>\n * ```\n *\n * Or create a single text node if possible:\n * ```\n * <LiveRegion>\n * {`${title} ${details}`}\n * </LiveRegion>\n * ```\n *\n * The live region is always atomic, because non-atomic regions can be treated by screen readers\n * differently and produce unexpected results. To imitate non-atomic announcements simply use\n * multiple live regions:\n * ```\n * <>\n * <LiveRegion>{title}</LiveRegion>\n * <LiveRegion><Details /></LiveRegion>\n * </>\n * ```\n *\n * If you place interactive content inside the LiveRegion, the content will still be\n * interactive (e.g. as a tab stop). Consider using the `source` property instead.\n */\nexport default memo(LiveRegion);\n\nfunction LiveRegion({\n assertive = false,\n delay = 10,\n visible = false,\n tagName: TagName = 'span',\n children,\n id,\n source,\n ...restProps\n}: LiveRegionProps) {\n const sourceRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n const targetRef = useRef<HTMLSpanElement & HTMLDivElement>(null);\n\n /*\n When React state changes, React often produces too many DOM updates, causing NVDA to\n issue many announcements for the same logical event (See https://github.com/nvaccess/nvda/issues/7996).\n\n The code below imitates a debouncing, scheduling a callback every time new React state\n update is detected. When a callback resolves, it copies content from a muted element\n to the live region, which is recognized by screen readers as an update.\n\n If the use case requires no announcement to be ignored, use delay = 0, but ensure it\n does not impact the performance. If it does, prefer using a string as children prop.\n */\n useEffect(() => {\n function getSourceContent() {\n if (source) {\n return source\n .map(item => {\n if (!item) {\n return undefined;\n }\n if (typeof item === 'string') {\n return item;\n }\n if (item.current) {\n return extractInnerText(item.current);\n }\n })\n .filter(Boolean)\n .join(' ');\n }\n\n if (sourceRef.current) {\n return extractInnerText(sourceRef.current);\n }\n }\n function updateLiveRegion() {\n const sourceContent = getSourceContent();\n\n if (targetRef.current && sourceContent) {\n const targetContent = extractInnerText(targetRef.current);\n if (targetContent !== sourceContent) {\n // The aria-atomic does not work properly in Voice Over, causing\n // certain parts of the content to be ignored. To fix that,\n // we assign the source text content as a single node.\n targetRef.current.innerText = sourceContent;\n }\n }\n }\n\n let timeoutId: null | number;\n if (delay) {\n timeoutId = setTimeout(updateLiveRegion, delay);\n } else {\n updateLiveRegion();\n }\n\n return () => {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n };\n });\n\n return (\n <>\n {visible && !source && (\n <TagName ref={sourceRef} id={id}>\n {children}\n </TagName>\n )}\n\n <ScreenreaderOnly {...restProps} className={clsx(styles.root, restProps.className)}>\n {!visible && !source && (\n <TagName ref={sourceRef} aria-hidden=\"true\">\n {children}\n </TagName>\n )}\n\n <span ref={targetRef} aria-atomic=\"true\" aria-live={assertive ? 'assertive' : 'polite'}></span>\n </ScreenreaderOnly>\n </>\n );\n}\n\n// This only extracts text content from the node including all its children which is enough for now.\n// To make it more powerful, it is possible to create a more sophisticated extractor with respect to\n// ARIA properties to ignore aria-hidden nodes and read ARIA labels from the live content.\nfunction extractInnerText(node: HTMLElement) {\n return (node.innerText || '').replace(/\\s+/g, ' ').trim();\n}\n"]}
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  export interface ScreenreaderOnlyProps {
3
3
  id?: string;
4
4
  className?: string;
5
- children: React.ReactNode;
5
+ children?: React.ReactNode;
6
6
  }
7
7
  /**
8
8
  * Makes content now shown on a screen but still announced by screen-reader users.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/screenreader-only/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAEpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["internal/components/screenreader-only/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,WAAW,qBAAqB;IACpC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAEpE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/screenreader-only/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,8CAAU,KAAK,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from 'clsx';\nimport React from 'react';\nimport styles from './styles.css.js';\n\nexport interface ScreenreaderOnlyProps {\n id?: string;\n className?: string;\n children: React.ReactNode;\n}\n\n/**\n * Makes content now shown on a screen but still announced by screen-reader users.\n * The component is suitable when the aria-label cannot be used, e.g. to avoid elemnts being announced as \"blank\".\n *\n * To exclude screenreader-only content use `:not(.${screenreaderOnlyStyles.root})` selector, for example:\n *\n * ```\n * import screenreaderOnlyStyles from '~internal/components/screenreader-only/styles.css.js'\n *\n * let visibleContent = wrapper.find(`${styles.label}`).find(`:not(.${screenreaderOnlyStyles.root})`).getElement().textContent\n *\n * let screenreaderContent = wrapper.find(`${styles.label}`).find(`.${screenreaderOnlyStyles.root}`).getElement().textContent\n * ```\n */\nexport default function ScreenreaderOnly(props: ScreenreaderOnlyProps) {\n return <span {...props} className={clsx(styles.root, props.className)} />;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["internal/components/screenreader-only/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAQrC;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAA4B;IACnE,OAAO,8CAAU,KAAK,IAAE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC;AAC5E,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport clsx from 'clsx';\nimport React from 'react';\nimport styles from './styles.css.js';\n\nexport interface ScreenreaderOnlyProps {\n id?: string;\n className?: string;\n children?: React.ReactNode;\n}\n\n/**\n * Makes content now shown on a screen but still announced by screen-reader users.\n * The component is suitable when the aria-label cannot be used, e.g. to avoid elemnts being announced as \"blank\".\n *\n * To exclude screenreader-only content use `:not(.${screenreaderOnlyStyles.root})` selector, for example:\n *\n * ```\n * import screenreaderOnlyStyles from '~internal/components/screenreader-only/styles.css.js'\n *\n * let visibleContent = wrapper.find(`${styles.label}`).find(`:not(.${screenreaderOnlyStyles.root})`).getElement().textContent\n *\n * let screenreaderContent = wrapper.find(`${styles.label}`).find(`.${screenreaderOnlyStyles.root}`).getElement().textContent\n * ```\n */\nexport default function ScreenreaderOnly(props: ScreenreaderOnlyProps) {\n return <span {...props} className={clsx(styles.root, props.className)} />;\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (40b9e815)";
2
+ export var PACKAGE_VERSION = "3.0.0 (be8a0396)";
3
3
  export var THEME = "open-source-visual-refresh";
4
4
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (40b9e815)",
3
+ "PACKAGE_VERSION": "3.0.0 (be8a0396)",
4
4
  "THEME": "default",
5
5
  "ALWAYS_VISUAL_REFRESH": false
6
6
  }
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "40b9e81540697f609a9901db3c0d5ad98a5710ae"
2
+ "commit": "be8a0396919c2f0cc51c918ff929d0508c4958f0"
3
3
  }
package/package.json CHANGED
@@ -113,7 +113,7 @@
113
113
  "./internal/base-component/index.js",
114
114
  "./internal/base-component/styles.css.js"
115
115
  ],
116
- "version": "3.0.441",
116
+ "version": "3.0.443",
117
117
  "repository": {
118
118
  "type": "git",
119
119
  "url": "https://github.com/cloudscape-design/components.git"
@@ -1,4 +1,3 @@
1
1
  import { TableProps } from './interfaces';
2
2
  export declare function checkColumnWidths(columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<any>>): void;
3
- export declare function setElementWidths(element: undefined | HTMLElement, styles: React.CSSProperties): void;
4
3
  //# sourceMappingURL=column-widths-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"column-widths-utils.d.ts","sourceRoot":"lib/default/","sources":["table/column-widths-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAKnG;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,GAAG,WAAW,EAAE,MAAM,EAAE,KAAK,CAAC,aAAa,QAiB7F"}
1
+ {"version":3,"file":"column-widths-utils.d.ts","sourceRoot":"lib/default/","sources":["table/column-widths-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,wBAAgB,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,QAKnG"}
@@ -7,24 +7,6 @@ export function checkColumnWidths(columnDefinitions) {
7
7
  checkProperty(column, 'width');
8
8
  }
9
9
  }
10
- export function setElementWidths(element, styles) {
11
- function setProperty(property) {
12
- const value = styles[property];
13
- let widthCssValue = '';
14
- if (typeof value === 'number') {
15
- widthCssValue = value + 'px';
16
- }
17
- if (typeof value === 'string') {
18
- widthCssValue = value;
19
- }
20
- if (element && element.style[property] !== widthCssValue) {
21
- element.style[property] = widthCssValue;
22
- }
23
- }
24
- setProperty('width');
25
- setProperty('minWidth');
26
- setProperty('maxWidth');
27
- }
28
10
  function checkProperty(column, name) {
29
11
  const value = column[name];
30
12
  if (typeof value !== 'number' && typeof value !== 'undefined') {
@@ -1 +1 @@
1
- {"version":3,"file":"column-widths-utils.js","sourceRoot":"lib/default/","sources":["table/column-widths-utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,MAAM,UAAU,iBAAiB,CAAC,iBAAkE;IAClG,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE;QACtC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAClC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC;AACH,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,OAAgC,EAAE,MAA2B;IAC5F,SAAS,WAAW,CAAC,QAA2C;QAC9D,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC/B,IAAI,aAAa,GAAG,EAAE,CAAC;QACvB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,aAAa,GAAG,KAAK,GAAG,IAAI,CAAC;SAC9B;QACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,aAAa,GAAG,KAAK,CAAC;SACvB;QACD,IAAI,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,aAAa,EAAE;YACxD,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,aAAa,CAAC;SACzC;IACH,CAAC;IACD,WAAW,CAAC,OAAO,CAAC,CAAC;IACrB,WAAW,CAAC,UAAU,CAAC,CAAC;IACxB,WAAW,CAAC,UAAU,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,aAAa,CAAC,MAAwC,EAAE,IAA0B;IACzF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAC7D,QAAQ,CACN,OAAO,EACP,qCAAqC,IAAI,iCAAiC,KAAK,uCAAuC,CACvH,CAAC;KACH;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { TableProps } from './interfaces';\n\nexport function checkColumnWidths(columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<any>>) {\n for (const column of columnDefinitions) {\n checkProperty(column, 'minWidth');\n checkProperty(column, 'width');\n }\n}\n\nexport function setElementWidths(element: undefined | HTMLElement, styles: React.CSSProperties) {\n function setProperty(property: 'width' | 'minWidth' | 'maxWidth') {\n const value = styles[property];\n let widthCssValue = '';\n if (typeof value === 'number') {\n widthCssValue = value + 'px';\n }\n if (typeof value === 'string') {\n widthCssValue = value;\n }\n if (element && element.style[property] !== widthCssValue) {\n element.style[property] = widthCssValue;\n }\n }\n setProperty('width');\n setProperty('minWidth');\n setProperty('maxWidth');\n}\n\nfunction checkProperty(column: TableProps.ColumnDefinition<any>, name: 'width' | 'minWidth') {\n const value = column[name];\n if (typeof value !== 'number' && typeof value !== 'undefined') {\n warnOnce(\n 'Table',\n `resizableColumns feature requires ${name} property to be a number, got ${value}. The component may work incorrectly.`\n );\n }\n}\n"]}
1
+ {"version":3,"file":"column-widths-utils.js","sourceRoot":"lib/default/","sources":["table/column-widths-utils.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAGzE,MAAM,UAAU,iBAAiB,CAAC,iBAAkE;IAClG,KAAK,MAAM,MAAM,IAAI,iBAAiB,EAAE;QACtC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;QAClC,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAChC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,MAAwC,EAAE,IAA0B;IACzF,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE;QAC7D,QAAQ,CACN,OAAO,EACP,qCAAqC,IAAI,iCAAiC,KAAK,uCAAuC,CACvH,CAAC;KACH;AACH,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\nimport { TableProps } from './interfaces';\n\nexport function checkColumnWidths(columnDefinitions: ReadonlyArray<TableProps.ColumnDefinition<any>>) {\n for (const column of columnDefinitions) {\n checkProperty(column, 'minWidth');\n checkProperty(column, 'width');\n }\n}\n\nfunction checkProperty(column: TableProps.ColumnDefinition<any>, name: 'width' | 'minWidth') {\n const value = column[name];\n if (typeof value !== 'number' && typeof value !== 'undefined') {\n warnOnce(\n 'Table',\n `resizableColumns feature requires ${name} property to be a number, got ${value}. The component may work incorrectly.`\n );\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["table/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,cAAc,CAAC;AA+C/D,eAAO,MAAM,sBAAsB,qBAWX,CAAC;AAEzB,QAAA,MAAM,aAAa,qBAqbK,CAAC;AAEzB,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["table/internal.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAc,MAAM,cAAc,CAAC;AA+C/D,eAAO,MAAM,sBAAsB,qBAWX,CAAC;AAEzB,QAAA,MAAM,aAAa,qBAgbK,CAAC;AAEzB,eAAe,aAAa,CAAC"}
package/table/internal.js CHANGED
@@ -52,8 +52,7 @@ const InternalTable = React.forwardRef((_a, ref) => {
52
52
  stickyHeader = stickyHeader && supportsStickyPosition();
53
53
  const isMobile = useMobile();
54
54
  const [containerWidth, wrapperMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);
55
- const wrapperMeasureRefObject = useRef(null);
56
- const wrapperMeasureMergedRef = useMergeRefs(wrapperMeasureRef, wrapperMeasureRefObject);
55
+ const wrapperRefObject = useRef(null);
57
56
  const [tableWidth, tableMeasureRef] = useContainerQuery(rect => rect.contentBoxWidth);
58
57
  const tableRefObject = useRef(null);
59
58
  const secondaryWrapperRef = React.useRef(null);
@@ -68,7 +67,6 @@ const InternalTable = React.forwardRef((_a, ref) => {
68
67
  cancelEdit,
69
68
  });
70
69
  }, [cancelEdit]);
71
- const wrapperRefObject = useRef(null);
72
70
  const handleScroll = useScrollSync([wrapperRefObject, scrollbarRef, secondaryWrapperRef]);
73
71
  const { moveFocusDown, moveFocusUp, moveFocus } = useSelectionFocusMove(selectionType, items.length);
74
72
  const { onRowClickHandler, onRowContextMenuHandler } = useRowEvents({ onRowClick, onRowContextMenu });
@@ -130,6 +128,7 @@ const InternalTable = React.forwardRef((_a, ref) => {
130
128
  const hasEditableCells = !!columnDefinitions.find(col => col.editConfig);
131
129
  const tableRole = hasEditableCells ? 'grid-default' : 'table';
132
130
  const theadProps = {
131
+ containerWidth,
133
132
  selectionType,
134
133
  getSelectAllProps,
135
134
  columnDefinitions: visibleColumnDefinitions,
@@ -171,7 +170,7 @@ const InternalTable = React.forwardRef((_a, ref) => {
171
170
  const toolsHeaderHeight = (_f = (_e = toolsHeaderWrapper === null || toolsHeaderWrapper === void 0 ? void 0 : toolsHeaderWrapper.current) === null || _e === void 0 ? void 0 : _e.getBoundingClientRect().height) !== null && _f !== void 0 ? _f : 0;
172
171
  const totalColumnsCount = selectionType ? visibleColumnDefinitions.length + 1 : visibleColumnDefinitions.length;
173
172
  return (React.createElement(LinkDefaultVariantContext.Provider, { value: { defaultVariant: 'primary' } },
174
- React.createElement(ColumnWidthsProvider, { visibleColumns: visibleColumnWidthsWithSelection, resizableColumns: resizableColumns, containerRef: wrapperMeasureRefObject },
173
+ React.createElement(ColumnWidthsProvider, { visibleColumns: visibleColumnWidthsWithSelection, resizableColumns: resizableColumns },
175
174
  React.createElement(InternalContainer, Object.assign({}, baseProps, { __internalRootRef: __internalRootRef, className: clsx(baseProps.className, styles.root), __funnelSubStepProps: __funnelSubStepProps, header: React.createElement(React.Fragment, null,
176
175
  hasHeader && (React.createElement("div", { ref: overlapElement, className: clsx(hasDynamicHeight && [styles['dark-header'], 'awsui-context-content-header']) },
177
176
  React.createElement("div", { ref: toolsHeaderWrapper, className: clsx(styles['header-controls'], styles[`variant-${computedVariant}`]) },
@@ -185,7 +184,7 @@ const InternalTable = React.forwardRef((_a, ref) => {
185
184
  [styles['has-footer']]: hasFooter,
186
185
  [styles['has-header']]: hasHeader,
187
186
  }), style: stickyState.style.wrapper, onScroll: handleScroll }, wrapperProps),
188
- React.createElement("div", { className: styles['wrapper-content-measure'], ref: wrapperMeasureMergedRef }),
187
+ React.createElement("div", { className: styles['wrapper-content-measure'], ref: wrapperMeasureRef }),
189
188
  !!renderAriaLive && !!firstIndex && (React.createElement(LiveRegion, null,
190
189
  React.createElement("span", null, renderAriaLive({ totalItemsCount, firstIndex, lastIndex: firstIndex + items.length - 1 })))),
191
190
  React.createElement("table", Object.assign({ ref: tableRef, className: clsx(styles.table, resizableColumns && styles['table-layout-fixed'], contentDensity === 'compact' && getVisualContextClassname('compact-table')) }, getTableRoleProps({