@cloudscape-design/components-themeable 3.0.1201 → 3.0.1203

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 (128) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/file-token-group/styles.scss +15 -0
  3. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  4. package/lib/internal/scss/table/body-cell/styles.scss +8 -0
  5. package/lib/internal/scss/table/test-classes/styles.scss +8 -0
  6. package/lib/internal/template/file-token-group/file-token.d.ts +1 -1
  7. package/lib/internal/template/file-token-group/file-token.d.ts.map +1 -1
  8. package/lib/internal/template/file-token-group/file-token.js +7 -5
  9. package/lib/internal/template/file-token-group/file-token.js.map +1 -1
  10. package/lib/internal/template/file-token-group/interfaces.d.ts +2 -2
  11. package/lib/internal/template/file-token-group/interfaces.d.ts.map +1 -1
  12. package/lib/internal/template/file-token-group/interfaces.js.map +1 -1
  13. package/lib/internal/template/file-token-group/internal.js +1 -1
  14. package/lib/internal/template/file-token-group/internal.js.map +1 -1
  15. package/lib/internal/template/file-token-group/styles.css.js +23 -22
  16. package/lib/internal/template/file-token-group/styles.scoped.css +59 -29
  17. package/lib/internal/template/file-token-group/styles.selectors.js +23 -22
  18. package/lib/internal/template/file-upload/interfaces.d.ts +1 -1
  19. package/lib/internal/template/file-upload/interfaces.d.ts.map +1 -1
  20. package/lib/internal/template/file-upload/interfaces.js.map +1 -1
  21. package/lib/internal/template/file-upload/internal.js +1 -1
  22. package/lib/internal/template/file-upload/internal.js.map +1 -1
  23. package/lib/internal/template/i18n/messages/all.all.js +1 -1
  24. package/lib/internal/template/i18n/messages/all.all.json +1 -1
  25. package/lib/internal/template/i18n/messages/all.ar.js +1 -1
  26. package/lib/internal/template/i18n/messages/all.ar.json +1 -1
  27. package/lib/internal/template/i18n/messages/all.de.js +1 -1
  28. package/lib/internal/template/i18n/messages/all.de.json +1 -1
  29. package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
  30. package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
  31. package/lib/internal/template/i18n/messages/all.en.js +1 -1
  32. package/lib/internal/template/i18n/messages/all.en.json +1 -1
  33. package/lib/internal/template/i18n/messages/all.es.js +1 -1
  34. package/lib/internal/template/i18n/messages/all.es.json +1 -1
  35. package/lib/internal/template/i18n/messages/all.fr.js +1 -1
  36. package/lib/internal/template/i18n/messages/all.fr.json +1 -1
  37. package/lib/internal/template/i18n/messages/all.id.js +1 -1
  38. package/lib/internal/template/i18n/messages/all.id.json +1 -1
  39. package/lib/internal/template/i18n/messages/all.it.js +1 -1
  40. package/lib/internal/template/i18n/messages/all.it.json +1 -1
  41. package/lib/internal/template/i18n/messages/all.ja.js +1 -1
  42. package/lib/internal/template/i18n/messages/all.ja.json +1 -1
  43. package/lib/internal/template/i18n/messages/all.ko.js +1 -1
  44. package/lib/internal/template/i18n/messages/all.ko.json +1 -1
  45. package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
  46. package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
  47. package/lib/internal/template/i18n/messages/all.tr.js +1 -1
  48. package/lib/internal/template/i18n/messages/all.tr.json +1 -1
  49. package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
  50. package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
  51. package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
  52. package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
  53. package/lib/internal/template/i18n/messages-types.d.ts +2 -0
  54. package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
  55. package/lib/internal/template/i18n/messages-types.js.map +1 -1
  56. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  57. package/lib/internal/template/internal/environment.js +2 -2
  58. package/lib/internal/template/internal/environment.json +2 -2
  59. package/lib/internal/template/table/body-cell/styles.css.js +48 -47
  60. package/lib/internal/template/table/body-cell/styles.scoped.css +380 -374
  61. package/lib/internal/template/table/body-cell/styles.selectors.js +48 -47
  62. package/lib/internal/template/table/body-cell/td-element.d.ts +1 -0
  63. package/lib/internal/template/table/body-cell/td-element.d.ts.map +1 -1
  64. package/lib/internal/template/table/body-cell/td-element.js +7 -2
  65. package/lib/internal/template/table/body-cell/td-element.js.map +1 -1
  66. package/lib/internal/template/table/expandable-rows/expandable-rows-utils.d.ts +13 -5
  67. package/lib/internal/template/table/expandable-rows/expandable-rows-utils.d.ts.map +1 -1
  68. package/lib/internal/template/table/expandable-rows/expandable-rows-utils.js +19 -8
  69. package/lib/internal/template/table/expandable-rows/expandable-rows-utils.js.map +1 -1
  70. package/lib/internal/template/table/index.d.ts.map +1 -1
  71. package/lib/internal/template/table/index.js +4 -1
  72. package/lib/internal/template/table/index.js.map +1 -1
  73. package/lib/internal/template/table/interfaces.d.ts +75 -17
  74. package/lib/internal/template/table/interfaces.d.ts.map +1 -1
  75. package/lib/internal/template/table/interfaces.js.map +1 -1
  76. package/lib/internal/template/table/internal.d.ts.map +1 -1
  77. package/lib/internal/template/table/internal.js +50 -23
  78. package/lib/internal/template/table/internal.js.map +1 -1
  79. package/lib/internal/template/table/progressive-loading/loader-cell.d.ts +1 -1
  80. package/lib/internal/template/table/progressive-loading/loader-cell.d.ts.map +1 -1
  81. package/lib/internal/template/table/progressive-loading/loader-cell.js +3 -2
  82. package/lib/internal/template/table/progressive-loading/loader-cell.js.map +1 -1
  83. package/lib/internal/template/table/progressive-loading/progressive-loading-utils.d.ts +3 -8
  84. package/lib/internal/template/table/progressive-loading/progressive-loading-utils.d.ts.map +1 -1
  85. package/lib/internal/template/table/progressive-loading/progressive-loading-utils.js +6 -5
  86. package/lib/internal/template/table/progressive-loading/progressive-loading-utils.js.map +1 -1
  87. package/lib/internal/template/table/selection/index.d.ts +1 -1
  88. package/lib/internal/template/table/selection/index.d.ts.map +1 -1
  89. package/lib/internal/template/table/selection/index.js.map +1 -1
  90. package/lib/internal/template/table/selection/interfaces.d.ts +7 -1
  91. package/lib/internal/template/table/selection/interfaces.d.ts.map +1 -1
  92. package/lib/internal/template/table/selection/interfaces.js.map +1 -1
  93. package/lib/internal/template/table/selection/selection-cell.d.ts +2 -2
  94. package/lib/internal/template/table/selection/selection-cell.d.ts.map +1 -1
  95. package/lib/internal/template/table/selection/selection-cell.js.map +1 -1
  96. package/lib/internal/template/table/selection/selection-control.d.ts +2 -2
  97. package/lib/internal/template/table/selection/selection-control.d.ts.map +1 -1
  98. package/lib/internal/template/table/selection/selection-control.js.map +1 -1
  99. package/lib/internal/template/table/selection/use-group-selection.d.ts +12 -0
  100. package/lib/internal/template/table/selection/use-group-selection.d.ts.map +1 -0
  101. package/lib/internal/template/table/selection/use-group-selection.js +103 -0
  102. package/lib/internal/template/table/selection/use-group-selection.js.map +1 -0
  103. package/lib/internal/template/table/selection/use-selection-focus-move.d.ts +2 -2
  104. package/lib/internal/template/table/selection/use-selection-focus-move.d.ts.map +1 -1
  105. package/lib/internal/template/table/selection/use-selection-focus-move.js.map +1 -1
  106. package/lib/internal/template/table/selection/use-selection.d.ts +4 -8
  107. package/lib/internal/template/table/selection/use-selection.d.ts.map +1 -1
  108. package/lib/internal/template/table/selection/use-selection.js +17 -6
  109. package/lib/internal/template/table/selection/use-selection.js.map +1 -1
  110. package/lib/internal/template/table/selection/utils.d.ts +1 -1
  111. package/lib/internal/template/table/selection/utils.d.ts.map +1 -1
  112. package/lib/internal/template/table/selection/utils.js.map +1 -1
  113. package/lib/internal/template/table/test-classes/styles.css.js +6 -0
  114. package/lib/internal/template/table/test-classes/styles.scoped.css +7 -0
  115. package/lib/internal/template/table/test-classes/styles.selectors.js +7 -0
  116. package/lib/internal/template/table/thead.d.ts +4 -4
  117. package/lib/internal/template/table/thead.d.ts.map +1 -1
  118. package/lib/internal/template/table/thead.js.map +1 -1
  119. package/lib/internal/template/table/use-table-focus-navigation.d.ts +2 -2
  120. package/lib/internal/template/table/use-table-focus-navigation.d.ts.map +1 -1
  121. package/lib/internal/template/table/use-table-focus-navigation.js.map +1 -1
  122. package/lib/internal/template/test-utils/dom/table/index.d.ts +7 -0
  123. package/lib/internal/template/test-utils/dom/table/index.js +11 -0
  124. package/lib/internal/template/test-utils/dom/table/index.js.map +1 -1
  125. package/lib/internal/template/test-utils/selectors/table/index.d.ts +7 -0
  126. package/lib/internal/template/test-utils/selectors/table/index.js +11 -0
  127. package/lib/internal/template/test-utils/selectors/table/index.js.map +1 -1
  128. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "62efe831bef16f212a9b1075967f28bbbce29906"
2
+ "commit": "d33207b96046399a121d8f5e03ad62118f0ba147"
3
3
  }
@@ -34,6 +34,21 @@
34
34
  }
35
35
  }
36
36
 
37
+ .file-name-container {
38
+ all: unset;
39
+ display: block;
40
+ inline-size: 100%;
41
+ min-inline-size: 0;
42
+ cursor: default;
43
+ text-align: start;
44
+
45
+ &:focus-visible {
46
+ @include focus-visible.when-visible {
47
+ @include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
48
+ }
49
+ }
50
+ }
51
+
37
52
  .file-option-name,
38
53
  .file-option-size,
39
54
  .file-option-last-modified {
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "62efe831";
3
+ $awsui-commit-hash: "d33207b9";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-4hh3rt;
6
6
  $minContentWidth: --awsui-min-content-width-4hh3rt;
@@ -153,6 +153,14 @@ $cell-negative-space-vertical: 2px;
153
153
  text-overflow: ellipsis;
154
154
  }
155
155
  }
156
+
157
+ &-counter {
158
+ display: inline;
159
+ color: awsui.$color-text-body-secondary;
160
+ font-size: awsui.$font-size-body-s;
161
+ vertical-align: bottom;
162
+ }
163
+
156
164
  &:first-child {
157
165
  border-inline-start: $border-placeholder;
158
166
  @include cell-padding-inline-start($cell-edge-horizontal-padding);
@@ -0,0 +1,8 @@
1
+ /*
2
+ Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+ */
5
+
6
+ .body-cell-counter {
7
+ /* used in test-utils */
8
+ }
@@ -3,7 +3,7 @@ import { BaseComponentProps } from '../internal/base-component/index.js';
3
3
  import { TokenGroupProps } from '../token-group/interfaces.js';
4
4
  export declare namespace FileTokenProps {
5
5
  interface I18nStrings {
6
- removeFileAriaLabel?: (fileIndex: number) => string;
6
+ removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;
7
7
  errorIconAriaLabel?: string;
8
8
  warningIconAriaLabel?: string;
9
9
  formatFileSize?: (sizeInBytes: number) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"file-token.d.ts","sourceRoot":"","sources":["../../../src/file-token-group/file-token.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAOhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAIzE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAQ/D,yBAAiB,cAAc,CAAC;IAC9B,UAAiB,WAAW;QAC1B,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;QACpD,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;QACjD,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;KACjD;CACF;AAED,UAAU,cAAe,SAAQ,kBAAkB;IACjD,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,KA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AC;IACX,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iBAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,KAAK,GACN,EAAE,cAAc,eA6IhB;AAED,eAAe,iBAAiB,CAAC"}
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React, { useRef, useState } from 'react';
4
4
  import clsx from 'clsx';
5
- import { useUniqueId } from '@cloudscape-design/component-toolkit/internal';
5
+ import { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';
6
6
  import InternalBox from '../box/internal.js';
7
7
  import { FormFieldError, FormFieldWarning } from '../form-field/internal';
8
8
  import InternalSpaceBetween from '../space-between/internal.js';
@@ -24,9 +24,10 @@ function InternalFileToken({ file, showFileLastModified, showFileSize, showFileT
24
24
  const fileNameRef = useRef(null);
25
25
  const fileNameContainerRef = useRef(null);
26
26
  const [showTooltip, setShowTooltip] = useState(false);
27
+ const [isTruncated, setIsTruncated] = useState(false);
27
28
  const getDismissLabel = (fileIndex) => {
28
29
  var _a;
29
- return (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, fileIndex);
30
+ return (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, fileIndex, file.name);
30
31
  };
31
32
  function isEllipsisActive() {
32
33
  const span = fileNameRef.current;
@@ -36,6 +37,7 @@ function InternalFileToken({ file, showFileLastModified, showFileSize, showFileT
36
37
  }
37
38
  return false;
38
39
  }
40
+ useResizeObserver(() => fileNameContainerRef.current, () => setIsTruncated(isEllipsisActive()));
39
41
  const fileIsSingleRow = !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));
40
42
  return (React.createElement("div", { ref: containerRef, className: clsx(styles.token, {
41
43
  [styles['token-grid']]: alignment === 'horizontal',
@@ -59,9 +61,9 @@ function InternalFileToken({ file, showFileLastModified, showFileSize, showFileT
59
61
  [styles['single-row-loading']]: loading && fileIsSingleRow,
60
62
  }) },
61
63
  React.createElement(InternalSpaceBetween, { direction: "vertical", size: "xxxs" },
62
- React.createElement("div", { onMouseOver: () => setShowTooltip(true), onMouseOut: () => setShowTooltip(false), ref: fileNameContainerRef },
64
+ React.createElement("div", { className: styles['file-name-container'], onMouseOver: () => setShowTooltip(true), onMouseOut: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), role: isTruncated ? 'button' : undefined, "aria-expanded": isTruncated ? showTooltip : undefined, tabIndex: isTruncated ? 0 : -1, ref: fileNameContainerRef },
63
65
  React.createElement(InternalBox, { fontWeight: "normal", className: clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {
64
- [testUtilStyles['ellipsis-active']]: isEllipsisActive(),
66
+ [testUtilStyles['ellipsis-active']]: isTruncated,
65
67
  }) },
66
68
  React.createElement("span", { ref: fileNameRef }, file.name))),
67
69
  showFileSize && file.size ? (React.createElement(InternalBox, { fontSize: "body-s", color: 'text-body-secondary', className: clsx(styles['file-option-size'], testUtilStyles['file-option-size']) }, formatFileSize(file.size))) : null,
@@ -69,7 +71,7 @@ function InternalFileToken({ file, showFileLastModified, showFileSize, showFileT
69
71
  onDismiss && !readOnly && React.createElement(DismissButton, { dismissLabel: getDismissLabel(index), onDismiss: onDismiss })),
70
72
  errorText && (React.createElement(FormFieldError, { id: errorId, errorIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel }, errorText)),
71
73
  showWarning && (React.createElement(FormFieldWarning, { id: warningId, warningIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel }, warningText)),
72
- showTooltip && isEllipsisActive() && (React.createElement(Tooltip, { getTrack: () => containerRef.current, content: React.createElement(InternalBox, { fontWeight: "normal" }, file.name), onEscape: () => setShowTooltip(false) }))));
74
+ showTooltip && isTruncated && (React.createElement(Tooltip, { getTrack: () => containerRef.current, content: React.createElement(InternalBox, { fontWeight: "normal" }, file.name), onEscape: () => setShowTooltip(false) }))));
73
75
  }
74
76
  export default InternalFileToken;
75
77
  //# sourceMappingURL=file-token.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"file-token.js","sourceRoot":"","sources":["../../../src/file-token-group/file-token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE5E,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,oBAAo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QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACrC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal.js';\nimport { FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { BaseComponentProps } from '../internal/base-component/index.js';\nimport InternalSpaceBetween from '../space-between/internal.js';\nimport InternalSpinner from '../spinner/internal.js';\nimport DismissButton from '../token/dismiss-button.js';\nimport { TokenGroupProps } from '../token-group/interfaces.js';\nimport Tooltip from '../tooltip/internal.js';\nimport * as defaultFormatters from './default-formatters.js';\nimport { FileOptionThumbnail } from './thumbnail.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport namespace FileTokenProps {\n export interface I18nStrings {\n removeFileAriaLabel?: (fileIndex: number) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n}\n\ninterface FileTokenProps extends BaseComponentProps {\n file: File;\n onDismiss: () => void;\n showFileSize?: boolean;\n showFileLastModified?: boolean;\n showFileThumbnail?: boolean;\n errorText?: React.ReactNode;\n warningText?: React.ReactNode;\n loading?: boolean;\n readOnly?: boolean;\n i18nStrings?: FileTokenProps.I18nStrings;\n dismissLabel?: string;\n alignment?: TokenGroupProps.Alignment;\n groupContainsImage?: boolean;\n isImage: boolean;\n index: number;\n}\n\nfunction InternalFileToken({\n file,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n errorText,\n warningText,\n readOnly,\n loading,\n alignment,\n groupContainsImage,\n isImage,\n index,\n}: FileTokenProps) {\n const formatFileSize = i18nStrings?.formatFileSize ?? defaultFormatters.formatFileSize;\n const formatFileLastModified = i18nStrings?.formatFileLastModified ?? defaultFormatters.formatFileLastModified;\n\n const errorId = useUniqueId('error');\n const warningId = useUniqueId('warning');\n\n const showWarning = warningText && !errorText;\n const containerRef = useRef<HTMLDivElement>(null);\n const fileNameRef = useRef<HTMLSpanElement>(null);\n const fileNameContainerRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n\n const getDismissLabel = (fileIndex: number) => {\n return i18nStrings?.removeFileAriaLabel?.(fileIndex);\n };\n\n function isEllipsisActive() {\n const span = fileNameRef.current;\n const container = fileNameContainerRef.current;\n\n if (span && container) {\n return span.offsetWidth >= container.offsetWidth;\n }\n return false;\n }\n\n const fileIsSingleRow =\n !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));\n\n return (\n <div\n ref={containerRef}\n className={clsx(styles.token, {\n [styles['token-grid']]: alignment === 'horizontal',\n [styles['token-contains-image']]: groupContainsImage && showFileThumbnail,\n })}\n role=\"group\"\n aria-label={file.name}\n aria-describedby={errorText ? errorId : warningText ? warningId : undefined}\n aria-disabled={loading}\n data-index={index}\n >\n <div\n className={clsx(styles['token-box'], {\n [styles.loading]: loading,\n [styles.error]: errorText,\n [styles.warning]: showWarning,\n [styles.horizontal]: alignment === 'horizontal',\n [styles['read-only']]: readOnly,\n })}\n >\n {loading && (\n <div\n className={clsx(styles['file-loading-overlay'], {\n [styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpinner variant=\"disabled\" size=\"normal\" />\n </div>\n )}\n <InternalBox className={styles['file-option']}>\n {showFileThumbnail && isImage && <FileOptionThumbnail file={file} />}\n\n <div\n className={clsx(styles['file-option-metadata'], {\n [styles['with-image']]: showFileThumbnail && isImage,\n [styles['single-row-loading']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpaceBetween direction=\"vertical\" size=\"xxxs\">\n <div\n onMouseOver={() => setShowTooltip(true)}\n onMouseOut={() => setShowTooltip(false)}\n ref={fileNameContainerRef}\n >\n <InternalBox\n fontWeight=\"normal\"\n className={clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {\n [testUtilStyles['ellipsis-active']]: isEllipsisActive(),\n })}\n >\n <span ref={fileNameRef}>{file.name}</span>\n </InternalBox>\n </div>\n\n {showFileSize && file.size ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-size'], testUtilStyles['file-option-size'])}\n >\n {formatFileSize(file.size)}\n </InternalBox>\n ) : null}\n\n {showFileLastModified && file.lastModified ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-last-modified'], testUtilStyles['file-option-last-modified'])}\n >\n {formatFileLastModified(new Date(file.lastModified))}\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n </div>\n </InternalBox>\n {onDismiss && !readOnly && <DismissButton dismissLabel={getDismissLabel(index)} onDismiss={onDismiss} />}\n </div>\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={warningId} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {showTooltip && isEllipsisActive() && (\n <Tooltip\n getTrack={() => containerRef.current}\n content={<InternalBox fontWeight=\"normal\">{file.name}</InternalBox>}\n onEscape={() => setShowTooltip(false)}\n />\n )}\n </div>\n );\n}\n\nexport default InternalFileToken;\n"]}
1
+ {"version":3,"file":"file-token.js","sourceRoot":"","sources":["../../../src/file-token-group/file-token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,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,2BAA2B,CAAC,CAAC,IAEhG,sBAAsB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CACxC,CACf,CAAC,CAAC,CAAC,IAAI,CACa,CACnB,CACM;YACb,SAAS,IAAI,CAAC,QAAQ,IAAI,oBAAC,aAAa,IAAC,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,GAAI,CACpG;QACL,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IAC7E,SAAS,CACK,CAClB;QACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IACrF,WAAW,CACK,CACpB;QACA,WAAW,IAAI,WAAW,IAAI,CAC7B,oBAAC,OAAO,IACN,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EACpC,OAAO,EAAE,oBAAC,WAAW,IAAC,UAAU,EAAC,QAAQ,IAAE,IAAI,CAAC,IAAI,CAAe,EACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACrC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal.js';\nimport { FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { BaseComponentProps } from '../internal/base-component/index.js';\nimport InternalSpaceBetween from '../space-between/internal.js';\nimport InternalSpinner from '../spinner/internal.js';\nimport DismissButton from '../token/dismiss-button.js';\nimport { TokenGroupProps } from '../token-group/interfaces.js';\nimport Tooltip from '../tooltip/internal.js';\nimport * as defaultFormatters from './default-formatters.js';\nimport { FileOptionThumbnail } from './thumbnail.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport namespace FileTokenProps {\n export interface I18nStrings {\n removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n}\n\ninterface FileTokenProps extends BaseComponentProps {\n file: File;\n onDismiss: () => void;\n showFileSize?: boolean;\n showFileLastModified?: boolean;\n showFileThumbnail?: boolean;\n errorText?: React.ReactNode;\n warningText?: React.ReactNode;\n loading?: boolean;\n readOnly?: boolean;\n i18nStrings?: FileTokenProps.I18nStrings;\n dismissLabel?: string;\n alignment?: TokenGroupProps.Alignment;\n groupContainsImage?: boolean;\n isImage: boolean;\n index: number;\n}\n\nfunction InternalFileToken({\n file,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n errorText,\n warningText,\n readOnly,\n loading,\n alignment,\n groupContainsImage,\n isImage,\n index,\n}: FileTokenProps) {\n const formatFileSize = i18nStrings?.formatFileSize ?? defaultFormatters.formatFileSize;\n const formatFileLastModified = i18nStrings?.formatFileLastModified ?? defaultFormatters.formatFileLastModified;\n\n const errorId = useUniqueId('error');\n const warningId = useUniqueId('warning');\n\n const showWarning = warningText && !errorText;\n const containerRef = useRef<HTMLDivElement>(null);\n const fileNameRef = useRef<HTMLSpanElement>(null);\n const fileNameContainerRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [isTruncated, setIsTruncated] = useState(false);\n\n const getDismissLabel = (fileIndex: number) => {\n return i18nStrings?.removeFileAriaLabel?.(fileIndex, file.name);\n };\n\n function isEllipsisActive() {\n const span = fileNameRef.current;\n const container = fileNameContainerRef.current;\n\n if (span && container) {\n return span.offsetWidth >= container.offsetWidth;\n }\n return false;\n }\n\n useResizeObserver(\n () => fileNameContainerRef.current,\n () => setIsTruncated(isEllipsisActive())\n );\n\n const fileIsSingleRow =\n !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));\n\n return (\n <div\n ref={containerRef}\n className={clsx(styles.token, {\n [styles['token-grid']]: alignment === 'horizontal',\n [styles['token-contains-image']]: groupContainsImage && showFileThumbnail,\n })}\n role=\"group\"\n aria-label={file.name}\n aria-describedby={errorText ? errorId : warningText ? warningId : undefined}\n aria-disabled={loading}\n data-index={index}\n >\n <div\n className={clsx(styles['token-box'], {\n [styles.loading]: loading,\n [styles.error]: errorText,\n [styles.warning]: showWarning,\n [styles.horizontal]: alignment === 'horizontal',\n [styles['read-only']]: readOnly,\n })}\n >\n {loading && (\n <div\n className={clsx(styles['file-loading-overlay'], {\n [styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpinner variant=\"disabled\" size=\"normal\" />\n </div>\n )}\n <InternalBox className={styles['file-option']}>\n {showFileThumbnail && isImage && <FileOptionThumbnail file={file} />}\n\n <div\n className={clsx(styles['file-option-metadata'], {\n [styles['with-image']]: showFileThumbnail && isImage,\n [styles['single-row-loading']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpaceBetween direction=\"vertical\" size=\"xxxs\">\n <div\n className={styles['file-name-container']}\n onMouseOver={() => setShowTooltip(true)}\n onMouseOut={() => setShowTooltip(false)}\n onFocus={() => setShowTooltip(true)}\n onBlur={() => setShowTooltip(false)}\n role={isTruncated ? 'button' : undefined}\n aria-expanded={isTruncated ? showTooltip : undefined}\n tabIndex={isTruncated ? 0 : -1}\n ref={fileNameContainerRef}\n >\n <InternalBox\n fontWeight=\"normal\"\n className={clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {\n [testUtilStyles['ellipsis-active']]: isTruncated,\n })}\n >\n <span ref={fileNameRef}>{file.name}</span>\n </InternalBox>\n </div>\n\n {showFileSize && file.size ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-size'], testUtilStyles['file-option-size'])}\n >\n {formatFileSize(file.size)}\n </InternalBox>\n ) : null}\n\n {showFileLastModified && file.lastModified ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-last-modified'], testUtilStyles['file-option-last-modified'])}\n >\n {formatFileLastModified(new Date(file.lastModified))}\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n </div>\n </InternalBox>\n {onDismiss && !readOnly && <DismissButton dismissLabel={getDismissLabel(index)} onDismiss={onDismiss} />}\n </div>\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={warningId} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {showTooltip && isTruncated && (\n <Tooltip\n getTrack={() => containerRef.current}\n content={<InternalBox fontWeight=\"normal\">{file.name}</InternalBox>}\n onEscape={() => setShowTooltip(false)}\n />\n )}\n </div>\n );\n}\n\nexport default InternalFileToken;\n"]}
@@ -53,7 +53,7 @@ export interface FileTokenGroupProps extends BaseComponentProps {
53
53
  readOnly?: boolean;
54
54
  /**
55
55
  * An object containing all the localized strings required by the component:
56
- * * `removeFileAriaLabel` (function): A function to render the ARIA label for file token remove button.
56
+ * * `removeFileAriaLabel` (function): A function to render the ARIA label for file token remove button. Receives file index and file name.
57
57
  * * `errorIconAriaLabel` (string): The ARIA label to be shown on the error file icon.
58
58
  * * `warningIconAriaLabel` (string): The ARIA label to be shown on the warning file icon.
59
59
  * * `formatFileSize` (function): (Optional) A function that takes file size in bytes, and produces a formatted string.
@@ -68,7 +68,7 @@ export declare namespace FileTokenGroupProps {
68
68
  interface I18nStrings {
69
69
  limitShowFewer?: string;
70
70
  limitShowMore?: string;
71
- removeFileAriaLabel?: (fileIndex: number) => string;
71
+ removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;
72
72
  errorIconAriaLabel?: string;
73
73
  warningIconAriaLabel?: string;
74
74
  formatFileSize?: (sizeInBytes: number) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/file-token-group/interfaces.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,mBAAoB,SAAQ,kBAAkB;IAC7D;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,SAAS,EAAE,yBAAyB,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAC;IAExE;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,mBAAmB,CAAC,SAAS,CAAC;IAE1C;;;;;;;;OAQG;IACH,KAAK,EAAE,aAAa,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAC/C;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC;CAC/C;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,aAAa;QAC5B,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,WAAW;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MA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,EAAE,MAAM,CAAC;IACjC;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,mBAAmB,CAAC,WAAW,CAAC;CAC/C;AAED,yBAAiB,mBAAmB,CAAC;IACnC,UAAiB,aAAa;QAC5B,SAAS,EAAE,MAAM,CAAC;KACnB;IAED,UAAiB,WAAW;QAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QAEvB,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;QACtE,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;QAC9B,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;QACjD,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;KACjD;IAED,KAAY,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;IAElD,UAAiB,IAAI;QACnB,IAAI,EAAE,IAAI,CAAC;QACX,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;KAC7B;CACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/file-token-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface FileTokenGroupProps extends BaseComponentProps {\n /**\n * Show file size in the token. Use `i18nStrings.formatFileSize` to customize it.\n */\n showFileSize?: boolean;\n\n /**\n * Show file last modified timestamp in the token. Use `i18nStrings.formatFileLastModified` to customize it.\n */\n showFileLastModified?: boolean;\n\n /**\n * Show file thumbnail in the token. Only supported for images.\n */\n showFileThumbnail?: boolean;\n /**\n * Called when the user clicks on the dismiss button. The token won't be automatically removed.\n * Make sure that you add a listener to this event to update your application state.\n */\n onDismiss: NonCancelableEventHandler<FileTokenGroupProps.DismissDetail>;\n\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n limit?: number;\n /**\n * Specifies the direction in which tokens are aligned (`horizontal | vertical`).\n */\n alignment?: FileTokenGroupProps.Alignment;\n\n /**\n *\n * An array of objects representing token items. Each token has the following properties:\n *\n * - `file` (string) - File value.\n * - `loading` (boolean) - (Optional) Determine whether the token is loading.\n * - `errorText` (string) - (Optional) Text that displays as a validation error message.\n * - `warningText` (string) - (Optional) - Text that displays as a validation warning message.\n */\n items: ReadonlyArray<FileTokenGroupProps.Item>;\n /**\n * Adds an `aria-label` to the \"Show fewer\" button.\n * Use to assign unique labels when there are multiple file token groups with the same `limitShowFewer` label on one page.\n */\n limitShowFewerAriaLabel?: string;\n /**\n * Adds an `aria-label` to the \"Show more\" button.\n * Use to assign unique labels when there are multiple file token groups with the same `limitShowMore` label on one page.\n */\n limitShowMoreAriaLabel?: string;\n /**\n * Specifies if the control is read-only, which prevents the\n * user from modifying the value. A read-only control is still focusable.\n */\n readOnly?: boolean;\n /**\n * An object containing all the localized strings required by the component:\n * * `removeFileAriaLabel` (function): A function to render the ARIA label for file token remove button.\n * * `errorIconAriaLabel` (string): The ARIA label to be shown on the error file icon.\n * * `warningIconAriaLabel` (string): The ARIA label to be shown on the warning file icon.\n * * `formatFileSize` (function): (Optional) A function that takes file size in bytes, and produces a formatted string.\n * * `formatFileLastModified` (function): (Optional) A function that takes the files last modified date, and produces a formatted string.\n */\n i18nStrings?: FileTokenGroupProps.I18nStrings;\n}\n\nexport namespace FileTokenGroupProps {\n export interface DismissDetail {\n fileIndex: number;\n }\n\n export interface I18nStrings {\n limitShowFewer?: string;\n limitShowMore?: string;\n\n removeFileAriaLabel?: (fileIndex: number) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n\n export type Alignment = 'horizontal' | 'vertical';\n\n export interface Item {\n file: File;\n loading?: boolean;\n errorText?: null | string;\n warningText?: null | string;\n }\n}\n"]}
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/file-token-group/interfaces.ts"],"names":[],"mappings":"","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { BaseComponentProps } from '../internal/base-component';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface FileTokenGroupProps extends BaseComponentProps {\n /**\n * Show file size in the token. Use `i18nStrings.formatFileSize` to customize it.\n */\n showFileSize?: boolean;\n\n /**\n * Show file last modified timestamp in the token. Use `i18nStrings.formatFileLastModified` to customize it.\n */\n showFileLastModified?: boolean;\n\n /**\n * Show file thumbnail in the token. Only supported for images.\n */\n showFileThumbnail?: boolean;\n /**\n * Called when the user clicks on the dismiss button. The token won't be automatically removed.\n * Make sure that you add a listener to this event to update your application state.\n */\n onDismiss: NonCancelableEventHandler<FileTokenGroupProps.DismissDetail>;\n\n /**\n * Specifies the maximum number of displayed tokens. If the property isn't set, all of the tokens are displayed.\n */\n limit?: number;\n /**\n * Specifies the direction in which tokens are aligned (`horizontal | vertical`).\n */\n alignment?: FileTokenGroupProps.Alignment;\n\n /**\n *\n * An array of objects representing token items. Each token has the following properties:\n *\n * - `file` (string) - File value.\n * - `loading` (boolean) - (Optional) Determine whether the token is loading.\n * - `errorText` (string) - (Optional) Text that displays as a validation error message.\n * - `warningText` (string) - (Optional) - Text that displays as a validation warning message.\n */\n items: ReadonlyArray<FileTokenGroupProps.Item>;\n /**\n * Adds an `aria-label` to the \"Show fewer\" button.\n * Use to assign unique labels when there are multiple file token groups with the same `limitShowFewer` label on one page.\n */\n limitShowFewerAriaLabel?: string;\n /**\n * Adds an `aria-label` to the \"Show more\" button.\n * Use to assign unique labels when there are multiple file token groups with the same `limitShowMore` label on one page.\n */\n limitShowMoreAriaLabel?: string;\n /**\n * Specifies if the control is read-only, which prevents the\n * user from modifying the value. A read-only control is still focusable.\n */\n readOnly?: boolean;\n /**\n * An object containing all the localized strings required by the component:\n * * `removeFileAriaLabel` (function): A function to render the ARIA label for file token remove button. Receives file index and file name.\n * * `errorIconAriaLabel` (string): The ARIA label to be shown on the error file icon.\n * * `warningIconAriaLabel` (string): The ARIA label to be shown on the warning file icon.\n * * `formatFileSize` (function): (Optional) A function that takes file size in bytes, and produces a formatted string.\n * * `formatFileLastModified` (function): (Optional) A function that takes the files last modified date, and produces a formatted string.\n */\n i18nStrings?: FileTokenGroupProps.I18nStrings;\n}\n\nexport namespace FileTokenGroupProps {\n export interface DismissDetail {\n fileIndex: number;\n }\n\n export interface I18nStrings {\n limitShowFewer?: string;\n limitShowMore?: string;\n\n removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n\n export type Alignment = 'horizontal' | 'vertical';\n\n export interface Item {\n file: File;\n loading?: boolean;\n errorText?: null | string;\n warningText?: null | string;\n }\n}\n"]}
@@ -33,7 +33,7 @@ function InternalFileTokenGroup({ items, showFileLastModified, showFileSize, sho
33
33
  fireNonCancelableEvent(onDismiss, { fileIndex });
34
34
  setNextFocusIndex(fileIndex);
35
35
  }, errorText: file.errorText, warningText: file.warningText, i18nStrings: {
36
- removeFileAriaLabel: i18n('i18nStrings.removeFileAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel, format => fileIndex => format({ fileIndex: fileIndex + 1 })),
36
+ removeFileAriaLabel: i18n('i18nStrings.removeFileAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel, format => (fileIndex, fileName) => format({ fileIndex: fileIndex + 1, fileName })),
37
37
  errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel),
38
38
  warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel),
39
39
  formatFileSize: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatFileSize,
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-token-group/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,SAAS,MAAM,4CAA4C,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,iBAAiB,MAAM,iBAAiB,CAAC;AAGhD,OAAO,eAAe,MAAM,iDAAiD,CAAC;AAC9E,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,UAAU,MAAM,8BAA8B,CAAC;AAItD,SAAS,sBAAsB,CAAC,EAC9B,KAAK,EACL,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,UAAU,EACt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,cAAc,CAAC;gBAC/E,aAAa,EAAE,IAAI,CAAC,2BAA2B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,aAAa,CAAC;aAC7E,GACD,CACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport TokenList from '../internal/components/token-list/index.js';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller.js';\nimport InternalFileToken from './file-token.js';\nimport { FileTokenGroupProps } from './interfaces.js';\n\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\ntype InternalFileTokenGroupProps = FileTokenGroupProps & InternalBaseComponentProps;\n\nfunction InternalFileTokenGroup({\n items,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n limit,\n readOnly,\n alignment = 'vertical',\n __internalRootRef,\n ...restProps\n}: InternalFileTokenGroupProps) {\n const baseProps = getBaseProps(restProps);\n\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: target => {\n target.focus();\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n });\n\n const mergedRef = useMergeRefs(__internalRootRef, tokenListRef);\n\n const isImage = (file: File) => file.type.startsWith('image/');\n const groupContainsImage = items.filter(item => isImage(item.file)).length > 0;\n\n const i18n = useInternalI18n('file-token-group');\n\n return (\n <div {...baseProps} ref={mergedRef} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n <TokenList\n alignment={alignment === 'horizontal' ? 'horizontal-grid' : alignment}\n items={items}\n renderItem={(file, fileIndex) => (\n <InternalFileToken\n file={file.file}\n showFileLastModified={showFileLastModified}\n showFileSize={showFileSize}\n showFileThumbnail={showFileThumbnail}\n onDismiss={() => {\n fireNonCancelableEvent(onDismiss, { fileIndex });\n setNextFocusIndex(fileIndex);\n }}\n errorText={file.errorText}\n warningText={file.warningText}\n i18nStrings={{\n removeFileAriaLabel: i18n(\n 'i18nStrings.removeFileAriaLabel',\n i18nStrings?.removeFileAriaLabel,\n format => fileIndex => format({ fileIndex: fileIndex + 1 })\n ),\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n formatFileSize: i18nStrings?.formatFileSize,\n formatFileLastModified: i18nStrings?.formatFileLastModified,\n }}\n loading={file.loading}\n readOnly={readOnly}\n alignment={alignment}\n groupContainsImage={groupContainsImage}\n isImage={isImage(file.file)}\n index={fileIndex}\n />\n )}\n limit={limit}\n i18nStrings={{\n limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings?.limitShowFewer),\n limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings?.limitShowMore),\n }}\n />\n </div>\n );\n}\n\nexport default InternalFileTokenGroup;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-token-group/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAE7E,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;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AAC,kCAAkC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,CAAC;oBACjG,cAAc,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc;oBAC3C,sBAAsB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB;iBAC5D,EACD,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAC3B,KAAK,EAAE,SAAS,GAChB,CACH,EACD,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE;gBACX,cAAc,EAAE,IAAI,CAAC,4BAA4B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAC;gBAC/E,aAAa,EAAE,IAAI,CAAC,2BAA2B,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,aAAa,CAAC;aAC7E,GACD,CACE,CACP,CAAC;AACJ,CAAC;AAED,eAAe,sBAAsB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component/index.js';\nimport TokenList from '../internal/components/token-list/index.js';\nimport { fireNonCancelableEvent } from '../internal/events/index.js';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component/index.js';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller.js';\nimport InternalFileToken from './file-token.js';\nimport { FileTokenGroupProps } from './interfaces.js';\n\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport styles from './styles.css.js';\nimport testStyles from './test-classes/styles.css.js';\n\ntype InternalFileTokenGroupProps = FileTokenGroupProps & InternalBaseComponentProps;\n\nfunction InternalFileTokenGroup({\n items,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n limit,\n readOnly,\n alignment = 'vertical',\n __internalRootRef,\n ...restProps\n}: InternalFileTokenGroupProps) {\n const baseProps = getBaseProps(restProps);\n\n const [nextFocusIndex, setNextFocusIndex] = useState<null | number>(null);\n const tokenListRef = useListFocusController({\n nextFocusIndex,\n onFocusMoved: target => {\n target.focus();\n setNextFocusIndex(null);\n },\n listItemSelector: `.${tokenListStyles['list-item']}`,\n showMoreSelector: `.${tokenListStyles.toggle}`,\n });\n\n const mergedRef = useMergeRefs(__internalRootRef, tokenListRef);\n\n const isImage = (file: File) => file.type.startsWith('image/');\n const groupContainsImage = items.filter(item => isImage(item.file)).length > 0;\n\n const i18n = useInternalI18n('file-token-group');\n\n return (\n <div {...baseProps} ref={mergedRef} className={clsx(baseProps.className, styles.root, testStyles.root)}>\n <TokenList\n alignment={alignment === 'horizontal' ? 'horizontal-grid' : alignment}\n items={items}\n renderItem={(file, fileIndex) => (\n <InternalFileToken\n file={file.file}\n showFileLastModified={showFileLastModified}\n showFileSize={showFileSize}\n showFileThumbnail={showFileThumbnail}\n onDismiss={() => {\n fireNonCancelableEvent(onDismiss, { fileIndex });\n setNextFocusIndex(fileIndex);\n }}\n errorText={file.errorText}\n warningText={file.warningText}\n i18nStrings={{\n removeFileAriaLabel: i18n(\n 'i18nStrings.removeFileAriaLabel',\n i18nStrings?.removeFileAriaLabel,\n format => (fileIndex, fileName) => format({ fileIndex: fileIndex + 1, fileName })\n ),\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n formatFileSize: i18nStrings?.formatFileSize,\n formatFileLastModified: i18nStrings?.formatFileLastModified,\n }}\n loading={file.loading}\n readOnly={readOnly}\n alignment={alignment}\n groupContainsImage={groupContainsImage}\n isImage={isImage(file.file)}\n index={fileIndex}\n />\n )}\n limit={limit}\n i18nStrings={{\n limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings?.limitShowFewer),\n limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings?.limitShowMore),\n }}\n />\n </div>\n );\n}\n\nexport default InternalFileTokenGroup;\n"]}
@@ -1,27 +1,28 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "root": "awsui_root_39ths_3sqdw_209",
5
- "file-loading-overlay": "awsui_file-loading-overlay_39ths_3sqdw_241",
6
- "file-loading-overlay-single-row": "awsui_file-loading-overlay-single-row_39ths_3sqdw_246",
7
- "file-option-name": "awsui_file-option-name_39ths_3sqdw_250",
8
- "file-option-size": "awsui_file-option-size_39ths_3sqdw_251",
9
- "file-option-last-modified": "awsui_file-option-last-modified_39ths_3sqdw_252",
10
- "file-option": "awsui_file-option_39ths_3sqdw_250",
11
- "file-option-thumbnail": "awsui_file-option-thumbnail_39ths_3sqdw_265",
12
- "file-option-thumbnail-image": "awsui_file-option-thumbnail-image_39ths_3sqdw_269",
13
- "file-option-metadata": "awsui_file-option-metadata_39ths_3sqdw_282",
14
- "with-image": "awsui_with-image_39ths_3sqdw_285",
15
- "single-row-loading": "awsui_single-row-loading_39ths_3sqdw_288",
16
- "token": "awsui_token_39ths_3sqdw_292",
17
- "token-grid": "awsui_token-grid_39ths_3sqdw_299",
18
- "token-contains-image": "awsui_token-contains-image_39ths_3sqdw_308",
19
- "token-box": "awsui_token-box_39ths_3sqdw_312",
20
- "horizontal": "awsui_horizontal_39ths_3sqdw_331",
21
- "error": "awsui_error_39ths_3sqdw_339",
22
- "dismiss-button": "awsui_dismiss-button_39ths_3sqdw_343",
23
- "warning": "awsui_warning_39ths_3sqdw_349",
24
- "read-only": "awsui_read-only_39ths_3sqdw_359",
25
- "loading": "awsui_loading_39ths_3sqdw_372"
4
+ "root": "awsui_root_39ths_1q3ei_209",
5
+ "file-loading-overlay": "awsui_file-loading-overlay_39ths_1q3ei_241",
6
+ "file-loading-overlay-single-row": "awsui_file-loading-overlay-single-row_39ths_1q3ei_246",
7
+ "file-name-container": "awsui_file-name-container_39ths_1q3ei_250",
8
+ "file-option-name": "awsui_file-option-name_39ths_1q3ei_280",
9
+ "file-option-size": "awsui_file-option-size_39ths_1q3ei_281",
10
+ "file-option-last-modified": "awsui_file-option-last-modified_39ths_1q3ei_282",
11
+ "file-option": "awsui_file-option_39ths_1q3ei_280",
12
+ "file-option-thumbnail": "awsui_file-option-thumbnail_39ths_1q3ei_295",
13
+ "file-option-thumbnail-image": "awsui_file-option-thumbnail-image_39ths_1q3ei_299",
14
+ "file-option-metadata": "awsui_file-option-metadata_39ths_1q3ei_312",
15
+ "with-image": "awsui_with-image_39ths_1q3ei_315",
16
+ "single-row-loading": "awsui_single-row-loading_39ths_1q3ei_318",
17
+ "token": "awsui_token_39ths_1q3ei_322",
18
+ "token-grid": "awsui_token-grid_39ths_1q3ei_329",
19
+ "token-contains-image": "awsui_token-contains-image_39ths_1q3ei_338",
20
+ "token-box": "awsui_token-box_39ths_1q3ei_342",
21
+ "horizontal": "awsui_horizontal_39ths_1q3ei_361",
22
+ "error": "awsui_error_39ths_1q3ei_369",
23
+ "dismiss-button": "awsui_dismiss-button_39ths_1q3ei_373",
24
+ "warning": "awsui_warning_39ths_1q3ei_379",
25
+ "read-only": "awsui_read-only_39ths_1q3ei_389",
26
+ "loading": "awsui_loading_39ths_1q3ei_402"
26
27
  };
27
28
 
@@ -206,7 +206,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
206
206
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
207
207
  SPDX-License-Identifier: Apache-2.0
208
208
  */
209
- .awsui_root_39ths_3sqdw_209:not(#\9) {
209
+ .awsui_root_39ths_1q3ei_209:not(#\9) {
210
210
  border-collapse: separate;
211
211
  border-spacing: 0;
212
212
  box-sizing: border-box;
@@ -238,35 +238,65 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
238
238
  -moz-osx-font-smoothing: auto;
239
239
  }
240
240
 
241
- .awsui_file-loading-overlay_39ths_3sqdw_241:not(#\9) {
241
+ .awsui_file-loading-overlay_39ths_1q3ei_241:not(#\9) {
242
242
  position: absolute;
243
243
  inset-inline-end: var(--space-static-xs-4gq40t, 8px);
244
244
  inset-block-end: var(--space-static-xxs-0cgyf1, 4px);
245
245
  }
246
- .awsui_file-loading-overlay-single-row_39ths_3sqdw_246:not(#\9) {
246
+ .awsui_file-loading-overlay-single-row_39ths_1q3ei_246:not(#\9) {
247
247
  inset-inline-end: var(--space-static-xxl-lfov4w, 32px);
248
248
  }
249
249
 
250
- .awsui_file-option-name_39ths_3sqdw_250:not(#\9),
251
- .awsui_file-option-size_39ths_3sqdw_251:not(#\9),
252
- .awsui_file-option-last-modified_39ths_3sqdw_252:not(#\9) {
250
+ .awsui_file-name-container_39ths_1q3ei_250:not(#\9) {
251
+ all: unset;
252
+ display: block;
253
+ inline-size: 100%;
254
+ min-inline-size: 0;
255
+ cursor: default;
256
+ text-align: start;
257
+ }
258
+ body[data-awsui-focus-visible=true] .awsui_file-name-container_39ths_1q3ei_250:not(#\9):focus-visible:focus {
259
+ position: relative;
260
+ }
261
+ body[data-awsui-focus-visible=true] .awsui_file-name-container_39ths_1q3ei_250:not(#\9):focus-visible:focus {
262
+ outline: 2px dotted transparent;
263
+ outline-offset: calc(var(--space-button-focus-outline-gutter-vsdlzg, 3px) - 1px);
264
+ }
265
+ body[data-awsui-focus-visible=true] .awsui_file-name-container_39ths_1q3ei_250:not(#\9):focus-visible:focus::before {
266
+ content: " ";
267
+ display: block;
268
+ position: absolute;
269
+ inset-inline-start: calc(-1 * var(--space-button-focus-outline-gutter-vsdlzg, 3px));
270
+ inset-block-start: calc(-1 * var(--space-button-focus-outline-gutter-vsdlzg, 3px));
271
+ inline-size: calc(100% + var(--space-button-focus-outline-gutter-vsdlzg, 3px) + var(--space-button-focus-outline-gutter-vsdlzg, 3px));
272
+ block-size: calc(100% + var(--space-button-focus-outline-gutter-vsdlzg, 3px) + var(--space-button-focus-outline-gutter-vsdlzg, 3px));
273
+ border-start-start-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
274
+ border-start-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
275
+ border-end-start-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
276
+ border-end-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
277
+ box-shadow: 0 0 0 2px var(--color-border-item-focused-r5f6xl, #0073bb);
278
+ }
279
+
280
+ .awsui_file-option-name_39ths_1q3ei_280:not(#\9),
281
+ .awsui_file-option-size_39ths_1q3ei_281:not(#\9),
282
+ .awsui_file-option-last-modified_39ths_1q3ei_282:not(#\9) {
253
283
  text-overflow: ellipsis;
254
284
  overflow: hidden;
255
285
  white-space: nowrap;
256
286
  }
257
287
 
258
- .awsui_file-option_39ths_3sqdw_250:not(#\9) {
288
+ .awsui_file-option_39ths_1q3ei_280:not(#\9) {
259
289
  inline-size: 100%;
260
290
  min-inline-size: 0;
261
291
  display: flex;
262
292
  gap: var(--space-scaled-xs-sppte9, 8px);
263
293
  }
264
294
 
265
- .awsui_file-option-thumbnail_39ths_3sqdw_265:not(#\9) {
295
+ .awsui_file-option-thumbnail_39ths_1q3ei_295:not(#\9) {
266
296
  margin-block-start: var(--space-static-xxs-0cgyf1, 4px);
267
297
  }
268
298
 
269
- .awsui_file-option-thumbnail-image_39ths_3sqdw_269:not(#\9) {
299
+ .awsui_file-option-thumbnail-image_39ths_1q3ei_299:not(#\9) {
270
300
  font-size: var(--font-size-body-s-psgqn2, 12px);
271
301
  line-height: var(--line-height-body-s-otgtsr, 16px);
272
302
  letter-spacing: var(--letter-spacing-body-s-egrcsd, normal);
@@ -279,37 +309,37 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
279
309
  overflow: hidden;
280
310
  }
281
311
 
282
- .awsui_file-option-metadata_39ths_3sqdw_282:not(#\9) {
312
+ .awsui_file-option-metadata_39ths_1q3ei_312:not(#\9) {
283
313
  inline-size: 100%;
284
314
  }
285
- .awsui_file-option-metadata_39ths_3sqdw_282.awsui_with-image_39ths_3sqdw_285:not(#\9) {
315
+ .awsui_file-option-metadata_39ths_1q3ei_312.awsui_with-image_39ths_1q3ei_315:not(#\9) {
286
316
  inline-size: calc(100% - 48px);
287
317
  }
288
- .awsui_file-option-metadata_39ths_3sqdw_282.awsui_single-row-loading_39ths_3sqdw_288:not(#\9) {
318
+ .awsui_file-option-metadata_39ths_1q3ei_312.awsui_single-row-loading_39ths_1q3ei_318:not(#\9) {
289
319
  inline-size: calc(100% - var(--size-icon-normal-2f5zkr, 16px));
290
320
  }
291
321
 
292
- .awsui_token_39ths_3sqdw_292:not(#\9) {
322
+ .awsui_token_39ths_1q3ei_322:not(#\9) {
293
323
  position: relative;
294
324
  block-size: 100%;
295
325
  display: flex;
296
326
  flex-direction: column;
297
327
  gap: var(--space-xxs-jnczic, 4px);
298
328
  }
299
- .awsui_token-grid_39ths_3sqdw_299:not(#\9) {
329
+ .awsui_token-grid_39ths_1q3ei_329:not(#\9) {
300
330
  display: grid;
301
331
  grid-template-rows: max-content auto;
302
332
  }
303
333
  @media (max-width: 688px) {
304
- .awsui_token-grid_39ths_3sqdw_299:not(#\9) {
334
+ .awsui_token-grid_39ths_1q3ei_329:not(#\9) {
305
335
  display: flex;
306
336
  }
307
337
  }
308
- .awsui_token-contains-image_39ths_3sqdw_308:not(#\9) {
338
+ .awsui_token-contains-image_39ths_1q3ei_338:not(#\9) {
309
339
  grid-template-rows: 68px auto;
310
340
  }
311
341
 
312
- .awsui_token-box_39ths_3sqdw_312:not(#\9) {
342
+ .awsui_token-box_39ths_1q3ei_342:not(#\9) {
313
343
  position: relative;
314
344
  block-size: 100%;
315
345
  border-block: var(--border-width-token-cwl2sl, 1px) solid var(--color-border-item-selected-vq6ddf, #0073bb);
@@ -328,48 +358,48 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
328
358
  color: var(--color-text-body-default-5qid0u, #16191f);
329
359
  box-sizing: border-box;
330
360
  }
331
- .awsui_token-box_39ths_3sqdw_312.awsui_horizontal_39ths_3sqdw_331:not(#\9) {
361
+ .awsui_token-box_39ths_1q3ei_342.awsui_horizontal_39ths_1q3ei_361:not(#\9) {
332
362
  max-inline-size: 230px;
333
363
  }
334
364
  @media (max-width: 688px) {
335
- .awsui_token-box_39ths_3sqdw_312.awsui_horizontal_39ths_3sqdw_331:not(#\9) {
365
+ .awsui_token-box_39ths_1q3ei_342.awsui_horizontal_39ths_1q3ei_361:not(#\9) {
336
366
  max-inline-size: 100%;
337
367
  }
338
368
  }
339
- .awsui_token-box_39ths_3sqdw_312.awsui_error_39ths_3sqdw_339:not(#\9) {
369
+ .awsui_token-box_39ths_1q3ei_342.awsui_error_39ths_1q3ei_369:not(#\9) {
340
370
  border-color: var(--color-border-status-error-jybbdz, #d13212);
341
371
  border-inline-start-width: var(--border-invalid-width-z5cnpo, 4px);
342
372
  }
343
- .awsui_token-box_39ths_3sqdw_312.awsui_error_39ths_3sqdw_339 > .awsui_dismiss-button_39ths_3sqdw_343:not(#\9) {
373
+ .awsui_token-box_39ths_1q3ei_342.awsui_error_39ths_1q3ei_369 > .awsui_dismiss-button_39ths_1q3ei_373:not(#\9) {
344
374
  color: var(--color-text-interactive-default-qwoe3g, #545b64);
345
375
  }
346
- .awsui_token-box_39ths_3sqdw_312.awsui_error_39ths_3sqdw_339 > .awsui_dismiss-button_39ths_3sqdw_343:not(#\9):hover {
376
+ .awsui_token-box_39ths_1q3ei_342.awsui_error_39ths_1q3ei_369 > .awsui_dismiss-button_39ths_1q3ei_373:not(#\9):hover {
347
377
  color: var(--color-text-interactive-hover-bu4gls, #16191f);
348
378
  }
349
- .awsui_token-box_39ths_3sqdw_312.awsui_warning_39ths_3sqdw_349:not(#\9) {
379
+ .awsui_token-box_39ths_1q3ei_342.awsui_warning_39ths_1q3ei_379:not(#\9) {
350
380
  border-color: var(--color-border-status-warning-qmz1c4, #906806);
351
381
  border-inline-start-width: var(--border-invalid-width-z5cnpo, 4px);
352
382
  }
353
- .awsui_token-box_39ths_3sqdw_312.awsui_warning_39ths_3sqdw_349 > .awsui_dismiss-button_39ths_3sqdw_343:not(#\9) {
383
+ .awsui_token-box_39ths_1q3ei_342.awsui_warning_39ths_1q3ei_379 > .awsui_dismiss-button_39ths_1q3ei_373:not(#\9) {
354
384
  color: var(--color-text-interactive-default-qwoe3g, #545b64);
355
385
  }
356
- .awsui_token-box_39ths_3sqdw_312.awsui_warning_39ths_3sqdw_349 > .awsui_dismiss-button_39ths_3sqdw_343:not(#\9):hover {
386
+ .awsui_token-box_39ths_1q3ei_342.awsui_warning_39ths_1q3ei_379 > .awsui_dismiss-button_39ths_1q3ei_373:not(#\9):hover {
357
387
  color: var(--color-text-interactive-hover-bu4gls, #16191f);
358
388
  }
359
- .awsui_token-box_39ths_3sqdw_312.awsui_read-only_39ths_3sqdw_359:not(#\9) {
389
+ .awsui_token-box_39ths_1q3ei_342.awsui_read-only_39ths_1q3ei_389:not(#\9) {
360
390
  border-color: var(--color-border-input-disabled-tz38ro, #eaeded);
361
391
  background-color: var(--color-background-container-content-aemn43, #ffffff);
362
392
  pointer-events: none;
363
393
  }
364
- .awsui_token-box_39ths_3sqdw_312.awsui_read-only_39ths_3sqdw_359 > .awsui_dismiss-button_39ths_3sqdw_343:not(#\9) {
394
+ .awsui_token-box_39ths_1q3ei_342.awsui_read-only_39ths_1q3ei_389 > .awsui_dismiss-button_39ths_1q3ei_373:not(#\9) {
365
395
  color: var(--color-text-button-inline-icon-disabled-o6nywg, #aab7b8);
366
396
  }
367
- .awsui_token-box_39ths_3sqdw_312.awsui_read-only_39ths_3sqdw_359 > .awsui_dismiss-button_39ths_3sqdw_343:not(#\9):hover {
397
+ .awsui_token-box_39ths_1q3ei_342.awsui_read-only_39ths_1q3ei_389 > .awsui_dismiss-button_39ths_1q3ei_373:not(#\9):hover {
368
398
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
369
399
  cursor: initial;
370
400
  color: var(--color-text-button-inline-icon-disabled-o6nywg, #aab7b8);
371
401
  }
372
- .awsui_token-box_39ths_3sqdw_312.awsui_loading_39ths_3sqdw_372:not(#\9) {
402
+ .awsui_token-box_39ths_1q3ei_342.awsui_loading_39ths_1q3ei_402:not(#\9) {
373
403
  border-color: var(--color-border-control-disabled-c9dn39, #d5dbdb);
374
404
  background-color: var(--color-background-container-content-aemn43, #ffffff);
375
405
  }
@@ -2,27 +2,28 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "root": "awsui_root_39ths_3sqdw_209",
6
- "file-loading-overlay": "awsui_file-loading-overlay_39ths_3sqdw_241",
7
- "file-loading-overlay-single-row": "awsui_file-loading-overlay-single-row_39ths_3sqdw_246",
8
- "file-option-name": "awsui_file-option-name_39ths_3sqdw_250",
9
- "file-option-size": "awsui_file-option-size_39ths_3sqdw_251",
10
- "file-option-last-modified": "awsui_file-option-last-modified_39ths_3sqdw_252",
11
- "file-option": "awsui_file-option_39ths_3sqdw_250",
12
- "file-option-thumbnail": "awsui_file-option-thumbnail_39ths_3sqdw_265",
13
- "file-option-thumbnail-image": "awsui_file-option-thumbnail-image_39ths_3sqdw_269",
14
- "file-option-metadata": "awsui_file-option-metadata_39ths_3sqdw_282",
15
- "with-image": "awsui_with-image_39ths_3sqdw_285",
16
- "single-row-loading": "awsui_single-row-loading_39ths_3sqdw_288",
17
- "token": "awsui_token_39ths_3sqdw_292",
18
- "token-grid": "awsui_token-grid_39ths_3sqdw_299",
19
- "token-contains-image": "awsui_token-contains-image_39ths_3sqdw_308",
20
- "token-box": "awsui_token-box_39ths_3sqdw_312",
21
- "horizontal": "awsui_horizontal_39ths_3sqdw_331",
22
- "error": "awsui_error_39ths_3sqdw_339",
23
- "dismiss-button": "awsui_dismiss-button_39ths_3sqdw_343",
24
- "warning": "awsui_warning_39ths_3sqdw_349",
25
- "read-only": "awsui_read-only_39ths_3sqdw_359",
26
- "loading": "awsui_loading_39ths_3sqdw_372"
5
+ "root": "awsui_root_39ths_1q3ei_209",
6
+ "file-loading-overlay": "awsui_file-loading-overlay_39ths_1q3ei_241",
7
+ "file-loading-overlay-single-row": "awsui_file-loading-overlay-single-row_39ths_1q3ei_246",
8
+ "file-name-container": "awsui_file-name-container_39ths_1q3ei_250",
9
+ "file-option-name": "awsui_file-option-name_39ths_1q3ei_280",
10
+ "file-option-size": "awsui_file-option-size_39ths_1q3ei_281",
11
+ "file-option-last-modified": "awsui_file-option-last-modified_39ths_1q3ei_282",
12
+ "file-option": "awsui_file-option_39ths_1q3ei_280",
13
+ "file-option-thumbnail": "awsui_file-option-thumbnail_39ths_1q3ei_295",
14
+ "file-option-thumbnail-image": "awsui_file-option-thumbnail-image_39ths_1q3ei_299",
15
+ "file-option-metadata": "awsui_file-option-metadata_39ths_1q3ei_312",
16
+ "with-image": "awsui_with-image_39ths_1q3ei_315",
17
+ "single-row-loading": "awsui_single-row-loading_39ths_1q3ei_318",
18
+ "token": "awsui_token_39ths_1q3ei_322",
19
+ "token-grid": "awsui_token-grid_39ths_1q3ei_329",
20
+ "token-contains-image": "awsui_token-contains-image_39ths_1q3ei_338",
21
+ "token-box": "awsui_token-box_39ths_1q3ei_342",
22
+ "horizontal": "awsui_horizontal_39ths_1q3ei_361",
23
+ "error": "awsui_error_39ths_1q3ei_369",
24
+ "dismiss-button": "awsui_dismiss-button_39ths_1q3ei_373",
25
+ "warning": "awsui_warning_39ths_1q3ei_379",
26
+ "read-only": "awsui_read-only_39ths_1q3ei_389",
27
+ "loading": "awsui_loading_39ths_1q3ei_402"
27
28
  };
28
29
 
@@ -90,7 +90,7 @@ export declare namespace FileUploadProps {
90
90
  interface I18nStrings {
91
91
  uploadButtonText?: (multiple: boolean) => string;
92
92
  dropzoneText?: (multiple: boolean) => string;
93
- removeFileAriaLabel?: (fileIndex: number) => string;
93
+ removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;
94
94
  limitShowFewer?: string;
95
95
  limitShowMore?: string;
96
96
  errorIconAriaLabel?: string;