@cloudscape-design/components 3.0.249 → 3.0.250

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 (129) hide show
  1. package/app-layout/visual-refresh/app-bar.js +1 -1
  2. package/app-layout/visual-refresh/app-bar.js.map +1 -1
  3. package/autosuggest/internal.d.ts.map +1 -1
  4. package/autosuggest/internal.js +1 -2
  5. package/autosuggest/internal.js.map +1 -1
  6. package/autosuggest/options-list.d.ts +1 -2
  7. package/autosuggest/options-list.d.ts.map +1 -1
  8. package/autosuggest/options-list.js +2 -8
  9. package/autosuggest/options-list.js.map +1 -1
  10. package/button/internal.d.ts +1 -1
  11. package/button/internal.d.ts.map +1 -1
  12. package/button/internal.js +2 -3
  13. package/button/internal.js.map +1 -1
  14. package/button/styles.css.js +19 -20
  15. package/button/styles.scoped.css +136 -298
  16. package/button/styles.selectors.js +19 -20
  17. package/form-field/internal.d.ts +1 -6
  18. package/form-field/internal.d.ts.map +1 -1
  19. package/form-field/internal.js +3 -6
  20. package/form-field/internal.js.map +1 -1
  21. package/index.d.ts +0 -1
  22. package/index.d.ts.map +1 -1
  23. package/index.js +0 -1
  24. package/index.js.map +1 -1
  25. package/internal/base-component/styles.scoped.css +0 -17
  26. package/internal/components/dropdown-footer/index.d.ts +0 -1
  27. package/internal/components/dropdown-footer/index.d.ts.map +1 -1
  28. package/internal/components/dropdown-footer/index.js +2 -2
  29. package/internal/components/dropdown-footer/index.js.map +1 -1
  30. package/internal/components/live-region/index.d.ts +1 -2
  31. package/internal/components/live-region/index.d.ts.map +1 -1
  32. package/internal/components/live-region/index.js +2 -2
  33. package/internal/components/live-region/index.js.map +1 -1
  34. package/internal/components/options-list/index.d.ts +0 -1
  35. package/internal/components/options-list/index.d.ts.map +1 -1
  36. package/internal/components/options-list/index.js +2 -2
  37. package/internal/components/options-list/index.js.map +1 -1
  38. package/internal/environment.js +1 -1
  39. package/internal/generated/theming/index.cjs +0 -95
  40. package/internal/generated/theming/index.js +0 -95
  41. package/internal/manifest.json +1 -1
  42. package/multiselect/internal.d.ts.map +1 -1
  43. package/multiselect/internal.js +3 -4
  44. package/multiselect/internal.js.map +1 -1
  45. package/package.json +1 -2
  46. package/property-filter/index.d.ts.map +1 -1
  47. package/property-filter/index.js +1 -1
  48. package/property-filter/index.js.map +1 -1
  49. package/property-filter/interfaces.d.ts +1 -2
  50. package/property-filter/interfaces.d.ts.map +1 -1
  51. package/property-filter/interfaces.js.map +1 -1
  52. package/property-filter/property-filter-autosuggest.d.ts.map +1 -1
  53. package/property-filter/property-filter-autosuggest.js +2 -4
  54. package/property-filter/property-filter-autosuggest.js.map +1 -1
  55. package/select/internal.d.ts.map +1 -1
  56. package/select/internal.js +3 -4
  57. package/select/internal.js.map +1 -1
  58. package/split-panel/interfaces.d.ts +8 -8
  59. package/split-panel/interfaces.d.ts.map +1 -1
  60. package/split-panel/interfaces.js.map +1 -1
  61. package/split-panel/preferences-modal.d.ts +7 -7
  62. package/split-panel/preferences-modal.d.ts.map +1 -1
  63. package/split-panel/preferences-modal.js.map +1 -1
  64. package/table/body-cell/index.js +1 -1
  65. package/table/body-cell/index.js.map +1 -1
  66. package/test-utils/dom/index.d.ts +0 -3
  67. package/test-utils/dom/index.js +2 -10
  68. package/test-utils/dom/index.js.map +1 -1
  69. package/test-utils/selectors/index.d.ts +0 -3
  70. package/test-utils/selectors/index.js +2 -10
  71. package/test-utils/selectors/index.js.map +1 -1
  72. package/test-utils/tsconfig.tsbuildinfo +1 -1
  73. package/token-group/styles.css.js +5 -7
  74. package/token-group/styles.scoped.css +23 -41
  75. package/token-group/styles.selectors.js +5 -7
  76. package/token-group/token.d.ts +1 -4
  77. package/token-group/token.d.ts.map +1 -1
  78. package/token-group/token.js +4 -13
  79. package/token-group/token.js.map +1 -1
  80. package/file-upload/default-formatters.d.ts +0 -3
  81. package/file-upload/default-formatters.d.ts.map +0 -1
  82. package/file-upload/default-formatters.js +0 -23
  83. package/file-upload/default-formatters.js.map +0 -1
  84. package/file-upload/dropzone/index.d.ts +0 -9
  85. package/file-upload/dropzone/index.d.ts.map +0 -1
  86. package/file-upload/dropzone/index.js +0 -69
  87. package/file-upload/dropzone/index.js.map +0 -1
  88. package/file-upload/dropzone/styles.css.js +0 -7
  89. package/file-upload/dropzone/styles.scoped.css +0 -108
  90. package/file-upload/dropzone/styles.selectors.js +0 -8
  91. package/file-upload/file-input/index.d.ts +0 -14
  92. package/file-upload/file-input/index.d.ts.map +0 -1
  93. package/file-upload/file-input/index.js +0 -55
  94. package/file-upload/file-input/index.js.map +0 -1
  95. package/file-upload/file-input/styles.css.js +0 -8
  96. package/file-upload/file-input/styles.scoped.css +0 -21
  97. package/file-upload/file-input/styles.selectors.js +0 -9
  98. package/file-upload/file-option/index.d.ts +0 -10
  99. package/file-upload/file-option/index.d.ts.map +0 -1
  100. package/file-upload/file-option/index.js +0 -22
  101. package/file-upload/file-option/index.js.map +0 -1
  102. package/file-upload/file-option/styles.css.js +0 -12
  103. package/file-upload/file-option/styles.scoped.css +0 -35
  104. package/file-upload/file-option/styles.selectors.js +0 -13
  105. package/file-upload/file-option/thumbnail.d.ts +0 -7
  106. package/file-upload/file-option/thumbnail.d.ts.map +0 -1
  107. package/file-upload/file-option/thumbnail.js +0 -20
  108. package/file-upload/file-option/thumbnail.js.map +0 -1
  109. package/file-upload/index.d.ts +0 -6
  110. package/file-upload/index.d.ts.map +0 -1
  111. package/file-upload/index.js +0 -17
  112. package/file-upload/index.js.map +0 -1
  113. package/file-upload/interfaces.d.ts +0 -99
  114. package/file-upload/interfaces.d.ts.map +0 -1
  115. package/file-upload/interfaces.js +0 -4
  116. package/file-upload/interfaces.js.map +0 -1
  117. package/file-upload/internal.d.ts +0 -7
  118. package/file-upload/internal.d.ts.map +0 -1
  119. package/file-upload/internal.js +0 -72
  120. package/file-upload/internal.js.map +0 -1
  121. package/file-upload/styles.css.js +0 -7
  122. package/file-upload/styles.scoped.css +0 -16
  123. package/file-upload/styles.selectors.js +0 -8
  124. package/test-utils/dom/file-upload/index.d.ts +0 -29
  125. package/test-utils/dom/file-upload/index.js +0 -66
  126. package/test-utils/dom/file-upload/index.js.map +0 -1
  127. package/test-utils/selectors/file-upload/index.d.ts +0 -29
  128. package/test-utils/selectors/file-upload/index.js +0 -66
  129. package/test-utils/selectors/file-upload/index.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["file-upload/file-option/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,KAAK,iBAAiB,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAQlD,MAAM,UAAU,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAmB;;IACzE,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,cAAc,GAAG,MAAA,WAAW,CAAC,cAAc,mCAAI,iBAAiB,CAAC,cAAc,CAAC;IACtF,MAAM,sBAAsB,GAAG,MAAA,WAAW,CAAC,sBAAsB,mCAAI,iBAAiB,CAAC,sBAAsB,CAAC;IAC9G,OAAO,CACL,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,aAAa,CAAC;QAC1C,QAAQ,CAAC,iBAAiB,IAAI,OAAO,IAAI,oBAAC,mBAAmB,IAAC,IAAI,EAAE,IAAI,GAAI;QAE7E,6BAAK,SAAS,EAAE,MAAM,CAAC,sBAAsB,CAAC;YAC5C,oBAAC,oBAAoB,IAAC,SAAS,EAAC,UAAU,EAAC,IAAI,EAAC,MAAM;gBACpD,oBAAC,WAAW,IAAC,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAAG,IAAI,CAAC,IAAI,CAAe;gBAE5E,QAAQ,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACpC,oBAAC,WAAW,IAAC,QAAQ,EAAC,QAAQ,EAAC,KAAK,EAAC,qBAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,kBAAkB,CAAC,IAC7F,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CACd,CACf,CAAC,CAAC,CAAC,IAAI;gBAEP,QAAQ,CAAC,oBAAoB,IAAI,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CACpD,oBAAC,WAAW,IAAC,QAAQ,EAAC,QAAQ,EAAC,KAAK,EAAC,qBAAqB,EAAC,SAAS,EAAE,MAAM,CAAC,2BAA2B,CAAC,IACtG,sBAAsB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CACxC,CACf,CAAC,CAAC,CAAC,IAAI,CACa,CACnB,CACM,CACf,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\n\nimport { FileMetadata, FileUploadProps } from '../interfaces';\nimport InternalBox from '../../box/internal';\nimport InternalSpaceBetween from '../../space-between/internal';\nimport styles from './styles.css.js';\nimport * as defaultFormatters from '../default-formatters';\nimport { FileOptionThumbnail } from './thumbnail';\n\ninterface FileOptionProps {\n file: File;\n metadata: FileMetadata;\n i18nStrings: FileUploadProps.I18nStrings;\n}\n\nexport function FileOption({ file, metadata, i18nStrings }: FileOptionProps) {\n const isImage = file.type.startsWith('image/');\n const formatFileSize = i18nStrings.formatFileSize ?? defaultFormatters.formatFileSize;\n const formatFileLastModified = i18nStrings.formatFileLastModified ?? defaultFormatters.formatFileLastModified;\n return (\n <InternalBox className={styles['file-option']}>\n {metadata.showFileThumbnail && isImage && <FileOptionThumbnail file={file} />}\n\n <div className={styles['file-option-metadata']}>\n <InternalSpaceBetween direction=\"vertical\" size=\"xxxs\">\n <InternalBox className={styles['file-option-name']}>{file.name}</InternalBox>\n\n {metadata.showFileSize && file.size ? (\n <InternalBox fontSize=\"body-s\" color=\"text-body-secondary\" className={styles['file-option-size']}>\n {formatFileSize(file.size)}\n </InternalBox>\n ) : null}\n\n {metadata.showFileLastModified && file.lastModified ? (\n <InternalBox fontSize=\"body-s\" color=\"text-body-secondary\" className={styles['file-option-last-modified']}>\n {formatFileLastModified(new Date(file.lastModified))}\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n </div>\n </InternalBox>\n );\n}\n"]}
@@ -1,12 +0,0 @@
1
-
2
- import './styles.scoped.css';
3
- export default {
4
- "file-option-name": "awsui_file-option-name_ezgb4_q9xmi_9",
5
- "file-option-size": "awsui_file-option-size_ezgb4_q9xmi_10",
6
- "file-option-last-modified": "awsui_file-option-last-modified_ezgb4_q9xmi_11",
7
- "file-option-thumbnail": "awsui_file-option-thumbnail_ezgb4_q9xmi_12",
8
- "file-option": "awsui_file-option_ezgb4_q9xmi_9",
9
- "file-option-thumbnail-image": "awsui_file-option-thumbnail-image_ezgb4_q9xmi_28",
10
- "file-option-metadata": "awsui_file-option-metadata_ezgb4_q9xmi_33"
11
- };
12
-
@@ -1,35 +0,0 @@
1
- /*
2
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- SPDX-License-Identifier: Apache-2.0
4
- */
5
- /*
6
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
- SPDX-License-Identifier: Apache-2.0
8
- */
9
- .awsui_file-option-name_ezgb4_q9xmi_9:not(#\9),
10
- .awsui_file-option-size_ezgb4_q9xmi_10:not(#\9),
11
- .awsui_file-option-last-modified_ezgb4_q9xmi_11:not(#\9),
12
- .awsui_file-option-thumbnail_ezgb4_q9xmi_12:not(#\9) {
13
- /* used in test-utils */
14
- }
15
-
16
- .awsui_file-option_ezgb4_q9xmi_9:not(#\9) {
17
- width: 100%;
18
- min-width: 0;
19
- display: flex;
20
- gap: var(--space-scaled-xs-6859qs, 8px);
21
- }
22
-
23
- .awsui_file-option-thumbnail_ezgb4_q9xmi_12:not(#\9) {
24
- margin-top: var(--space-static-xxs-jy4jgd, 4px);
25
- max-width: 60px;
26
- }
27
-
28
- .awsui_file-option-thumbnail-image_ezgb4_q9xmi_28:not(#\9) {
29
- width: 100%;
30
- height: auto;
31
- }
32
-
33
- .awsui_file-option-metadata_ezgb4_q9xmi_33:not(#\9) {
34
- width: 100%;
35
- }
@@ -1,13 +0,0 @@
1
-
2
- // es-module interop with Babel and Typescript
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- module.exports.default = {
5
- "file-option-name": "awsui_file-option-name_ezgb4_q9xmi_9",
6
- "file-option-size": "awsui_file-option-size_ezgb4_q9xmi_10",
7
- "file-option-last-modified": "awsui_file-option-last-modified_ezgb4_q9xmi_11",
8
- "file-option-thumbnail": "awsui_file-option-thumbnail_ezgb4_q9xmi_12",
9
- "file-option": "awsui_file-option_ezgb4_q9xmi_9",
10
- "file-option-thumbnail-image": "awsui_file-option-thumbnail-image_ezgb4_q9xmi_28",
11
- "file-option-metadata": "awsui_file-option-metadata_ezgb4_q9xmi_33"
12
- };
13
-
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- interface FileOptionThumbnailProps {
3
- file: File;
4
- }
5
- export declare function FileOptionThumbnail({ file }: FileOptionThumbnailProps): JSX.Element;
6
- export {};
7
- //# sourceMappingURL=thumbnail.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thumbnail.d.ts","sourceRoot":"lib/default/","sources":["file-upload/file-option/thumbnail.tsx"],"names":[],"mappings":";AAMA,UAAU,wBAAwB;IAChC,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE,wBAAwB,eAoBrE"}
@@ -1,20 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import React, { useEffect, useState } from 'react';
4
- import styles from './styles.css.js';
5
- export function FileOptionThumbnail({ file }) {
6
- const [imageSrc, setImageSrc] = useState('');
7
- useEffect(() => {
8
- // The URL.createObjectURL is not available in jsdom.
9
- if (URL.createObjectURL) {
10
- const src = URL.createObjectURL(file);
11
- setImageSrc(src);
12
- return () => {
13
- URL.revokeObjectURL(src);
14
- };
15
- }
16
- }, [file]);
17
- return (React.createElement("div", { className: styles['file-option-thumbnail'], "aria-hidden": true },
18
- React.createElement("img", { className: styles['file-option-thumbnail-image'], alt: file.name, src: imageSrc })));
19
- }
20
- //# sourceMappingURL=thumbnail.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thumbnail.js","sourceRoot":"lib/default/","sources":["file-upload/file-option/thumbnail.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAMrC,MAAM,UAAU,mBAAmB,CAAC,EAAE,IAAI,EAA4B;IACpE,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE7C,SAAS,CAAC,GAAG,EAAE;QACb,qDAAqD;QACrD,IAAI,GAAG,CAAC,eAAe,EAAE;YACvB,MAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;YACtC,WAAW,CAAC,GAAG,CAAC,CAAC;YAEjB,OAAO,GAAG,EAAE;gBACV,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC,CAAC;SACH;IACH,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,CACL,6BAAK,SAAS,EAAE,MAAM,CAAC,uBAAuB,CAAC,iBAAe,IAAI;QAChE,6BAAK,SAAS,EAAE,MAAM,CAAC,6BAA6B,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAI,CACpF,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useEffect, useState } from 'react';\nimport styles from './styles.css.js';\n\ninterface FileOptionThumbnailProps {\n file: File;\n}\n\nexport function FileOptionThumbnail({ file }: FileOptionThumbnailProps) {\n const [imageSrc, setImageSrc] = useState('');\n\n useEffect(() => {\n // The URL.createObjectURL is not available in jsdom.\n if (URL.createObjectURL) {\n const src = URL.createObjectURL(file);\n setImageSrc(src);\n\n return () => {\n URL.revokeObjectURL(src);\n };\n }\n }, [file]);\n\n return (\n <div className={styles['file-option-thumbnail']} aria-hidden={true}>\n <img className={styles['file-option-thumbnail-image']} alt={file.name} src={imageSrc} />\n </div>\n );\n}\n"]}
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import { FileUploadProps } from './interfaces';
3
- export { FileUploadProps };
4
- declare const FileUpload: React.ForwardRefExoticComponent<FileUploadProps & React.RefAttributes<FileUploadProps.Ref>>;
5
- export default FileUpload;
6
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"lib/default/","sources":["file-upload/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAK/C,OAAO,EAAE,eAAe,EAAE,CAAC;AAE3B,QAAA,MAAM,UAAU,6FAmBf,CAAC;AAGF,eAAe,UAAU,CAAC"}
@@ -1,17 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { __rest } from "tslib";
4
- import React from 'react';
5
- import { applyDisplayName } from '../internal/utils/apply-display-name';
6
- import InternalFileUpload from './internal';
7
- import useBaseComponent from '../internal/hooks/use-base-component';
8
- import { getExternalProps } from '../internal/utils/external-props';
9
- const FileUpload = React.forwardRef((_a, ref) => {
10
- var { multiple, showFileSize, showFileLastModified, showFileThumbnail } = _a, restProps = __rest(_a, ["multiple", "showFileSize", "showFileLastModified", "showFileThumbnail"]);
11
- const baseComponentProps = useBaseComponent('FileUpload');
12
- const externalProps = getExternalProps(restProps);
13
- return (React.createElement(InternalFileUpload, Object.assign({ ref: ref, multiple: multiple, showFileSize: showFileSize, showFileLastModified: showFileLastModified, showFileThumbnail: showFileThumbnail }, externalProps, baseComponentProps)));
14
- });
15
- applyDisplayName(FileUpload, 'FileUpload');
16
- export default FileUpload;
17
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"lib/default/","sources":["file-upload/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AAExE,OAAO,kBAAkB,MAAM,YAAY,CAAC;AAC5C,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AAIpE,MAAM,UAAU,GAAG,KAAK,CAAC,UAAU,CACjC,CACE,EAAkG,EAClG,GAAmC,EACnC,EAAE;QAFF,EAAE,QAAQ,EAAE,YAAY,EAAE,oBAAoB,EAAE,iBAAiB,OAAiC,EAA5B,SAAS,cAA/E,yEAAiF,CAAF;IAG/E,MAAM,kBAAkB,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IAC1D,MAAM,aAAa,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO,CACL,oBAAC,kBAAkB,kBACjB,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,YAAY,EAC1B,oBAAoB,EAAE,oBAAoB,EAC1C,iBAAiB,EAAE,iBAAiB,IAChC,aAAa,EACb,kBAAkB,EACtB,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,gBAAgB,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;AAC3C,eAAe,UAAU,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React from 'react';\nimport { applyDisplayName } from '../internal/utils/apply-display-name';\nimport { FileUploadProps } from './interfaces';\nimport InternalFileUpload from './internal';\nimport useBaseComponent from '../internal/hooks/use-base-component';\nimport { getExternalProps } from '../internal/utils/external-props';\n\nexport { FileUploadProps };\n\nconst FileUpload = React.forwardRef(\n (\n { multiple, showFileSize, showFileLastModified, showFileThumbnail, ...restProps }: FileUploadProps,\n ref: React.Ref<FileUploadProps.Ref>\n ) => {\n const baseComponentProps = useBaseComponent('FileUpload');\n const externalProps = getExternalProps(restProps);\n return (\n <InternalFileUpload\n ref={ref}\n multiple={multiple}\n showFileSize={showFileSize}\n showFileLastModified={showFileLastModified}\n showFileThumbnail={showFileThumbnail}\n {...externalProps}\n {...baseComponentProps}\n />\n );\n }\n);\n\napplyDisplayName(FileUpload, 'FileUpload');\nexport default FileUpload;\n"]}
@@ -1,99 +0,0 @@
1
- /// <reference types="react" />
2
- import { BaseComponentProps } from '../internal/base-component';
3
- import { FormFieldValidationControlProps } from '../internal/context/form-field-context';
4
- import { NonCancelableEventHandler } from '../internal/events';
5
- export interface FileUploadProps extends BaseComponentProps, FormFieldValidationControlProps {
6
- /**
7
- * Specifies the native file input `accept` attribute to describe the allow-list of file types.
8
- */
9
- accept?: string;
10
- /**
11
- * Specifies whether to add aria-required to the file upload control.
12
- */
13
- ariaRequired?: boolean;
14
- /**
15
- * Show file size in the token. Use `i18nStrings.formatFileSize` to customize it.
16
- */
17
- showFileSize?: boolean;
18
- /**
19
- * Show file last modified timestamp in the token. Use `i18nStrings.formatFileLastModified` to customize it.
20
- */
21
- showFileLastModified?: boolean;
22
- /**
23
- * Show file thumbnail in the token. Only supported for images.
24
- */
25
- showFileThumbnail?: boolean;
26
- /**
27
- * Specifies the native file input `multiple` attribute to allow users entering more than one file.
28
- */
29
- multiple?: boolean;
30
- /**
31
- * Called when the user selects new file(s), or removes a file.
32
- * The event `detail` contains the current value of the component.
33
- */
34
- onChange?: NonCancelableEventHandler<FileUploadProps.ChangeDetail>;
35
- /**
36
- * Specifies the currently selected file(s).
37
- * If you want to clear the selection, use empty array.
38
- */
39
- value: ReadonlyArray<File>;
40
- /**
41
- * Specifies the maximum number of displayed file tokens. If the property isn't set, all of the tokens are displayed.
42
- */
43
- tokenLimit?: number;
44
- /**
45
- * Constraint text that is displayed below the control. Use this to provide additional information about file size limit, etc.
46
- */
47
- constraintText?: React.ReactNode;
48
- /**
49
- * Text that displays as a validation message.
50
- */
51
- errorText?: React.ReactNode;
52
- /**
53
- * An array of file errors corresponding to the files in the `value`.
54
- */
55
- fileErrors?: ReadonlyArray<null | string>;
56
- /**
57
- * An object containing all the localized strings required by the component:
58
- * * `uploadButtonText` (function): A function to render the text of the file upload button. It takes `multiple` attribute to define plurality.
59
- * * `dropzoneText` (function): A function to render the text shown in the dropzone. It takes `multiple` attribute to define plurality.
60
- * * `removeFileAriaLabel` (function): A function to render the ARIA label for file token remove button.
61
- * * `limitShowFewer` (string): The text of the show more tokens button.
62
- * * `limitShowMore` (string): The text of the show fewer tokens button.
63
- * * `errorIconAriaLabel` (string): The ARIA label to be shown on the error file icon.
64
- * * `formatFileSize` (function): (Optional) A function that takes file size in bytes, and produces a formatted string.
65
- * * `formatFileLastModified` (function): (Optional) A function that takes the files last modified date, and produces a formatted string.
66
- */
67
- i18nStrings: FileUploadProps.I18nStrings;
68
- }
69
- export declare namespace FileUploadProps {
70
- interface ChangeDetail {
71
- value: File[];
72
- }
73
- interface DismissDetail {
74
- index: number;
75
- file: File;
76
- }
77
- interface I18nStrings {
78
- uploadButtonText: (multiple: boolean) => string;
79
- dropzoneText: (multiple: boolean) => string;
80
- removeFileAriaLabel: (fileIndex: number) => string;
81
- limitShowFewer: string;
82
- limitShowMore: string;
83
- errorIconAriaLabel: string;
84
- formatFileSize?: (sizeInBytes: number) => string;
85
- formatFileLastModified?: (date: Date) => string;
86
- }
87
- interface Ref {
88
- /**
89
- * Sets focus on the file upload button.
90
- */
91
- focus(): void;
92
- }
93
- }
94
- export interface FileMetadata {
95
- showFileSize?: boolean;
96
- showFileLastModified?: boolean;
97
- showFileThumbnail?: boolean;
98
- }
99
- //# sourceMappingURL=interfaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.d.ts","sourceRoot":"lib/default/","sources":["file-upload/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,wCAAwC,CAAC;AACzF,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAE/D,MAAM,WAAW,eAAgB,SAAQ,kBAAkB,EAAE,+BAA+B;IAC1F;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,yBAAyB,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC;IACnE;;;OAGG;IACH,KAAK,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACjC;;OAEG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC5B;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAC1C;;;;;;;;;;OAUG;IACH,WAAW,EAAE,eAAe,CAAC,WAAW,CAAC;CAC1C;AAED,yBAAiB,eAAe,CAAC;IAC/B,UAAiB,YAAY;QAC3B,KAAK,EAAE,IAAI,EAAE,CAAC;KACf;IAED,UAAiB,aAAa;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,IAAI,CAAC;KACZ;IAED,UAAiB,WAAW;QAC1B,gBAAgB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;QAChD,YAAY,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;QAC5C,mBAAmB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;QACnD,cAAc,EAAE,MAAM,CAAC;QACvB,aAAa,EAAE,MAAM,CAAC;QACtB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,cAAc,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,MAAM,CAAC;QACjD,sBAAsB,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC;KACjD;IAED,UAAiB,GAAG;QAClB;;WAEG;QACH,KAAK,IAAI,IAAI,CAAC;KACf;CACF;AAED,MAAM,WAAW,YAAY;IAC3B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B"}
@@ -1,4 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- export {};
4
- //# sourceMappingURL=interfaces.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"interfaces.js","sourceRoot":"lib/default/","sources":["file-upload/interfaces.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { BaseComponentProps } from '../internal/base-component';\nimport { FormFieldValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface FileUploadProps extends BaseComponentProps, FormFieldValidationControlProps {\n /**\n * Specifies the native file input `accept` attribute to describe the allow-list of file types.\n */\n accept?: string;\n /**\n * Specifies whether to add aria-required to the file upload control.\n */\n ariaRequired?: boolean;\n /**\n * Show file size in the token. Use `i18nStrings.formatFileSize` to customize it.\n */\n showFileSize?: boolean;\n /**\n * Show file last modified timestamp in the token. Use `i18nStrings.formatFileLastModified` to customize it.\n */\n showFileLastModified?: boolean;\n /**\n * Show file thumbnail in the token. Only supported for images.\n */\n showFileThumbnail?: boolean;\n /**\n * Specifies the native file input `multiple` attribute to allow users entering more than one file.\n */\n multiple?: boolean;\n /**\n * Called when the user selects new file(s), or removes a file.\n * The event `detail` contains the current value of the component.\n */\n onChange?: NonCancelableEventHandler<FileUploadProps.ChangeDetail>;\n /**\n * Specifies the currently selected file(s).\n * If you want to clear the selection, use empty array.\n */\n value: ReadonlyArray<File>;\n /**\n * Specifies the maximum number of displayed file tokens. If the property isn't set, all of the tokens are displayed.\n */\n tokenLimit?: number;\n /**\n * Constraint text that is displayed below the control. Use this to provide additional information about file size limit, etc.\n */\n constraintText?: React.ReactNode;\n /**\n * Text that displays as a validation message.\n */\n errorText?: React.ReactNode;\n /**\n * An array of file errors corresponding to the files in the `value`.\n */\n fileErrors?: ReadonlyArray<null | string>;\n /**\n * An object containing all the localized strings required by the component:\n * * `uploadButtonText` (function): A function to render the text of the file upload button. It takes `multiple` attribute to define plurality.\n * * `dropzoneText` (function): A function to render the text shown in the dropzone. It takes `multiple` attribute to define plurality.\n * * `removeFileAriaLabel` (function): A function to render the ARIA label for file token remove button.\n * * `limitShowFewer` (string): The text of the show more tokens button.\n * * `limitShowMore` (string): The text of the show fewer tokens button.\n * * `errorIconAriaLabel` (string): The ARIA label to be shown on the error 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: FileUploadProps.I18nStrings;\n}\n\nexport namespace FileUploadProps {\n export interface ChangeDetail {\n value: File[];\n }\n\n export interface DismissDetail {\n index: number;\n file: File;\n }\n\n export interface I18nStrings {\n uploadButtonText: (multiple: boolean) => string;\n dropzoneText: (multiple: boolean) => string;\n removeFileAriaLabel: (fileIndex: number) => string;\n limitShowFewer: string;\n limitShowMore: string;\n errorIconAriaLabel: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n\n export interface Ref {\n /**\n * Sets focus on the file upload button.\n */\n focus(): void;\n }\n}\n\nexport interface FileMetadata {\n showFileSize?: boolean;\n showFileLastModified?: boolean;\n showFileThumbnail?: boolean;\n}\n"]}
@@ -1,7 +0,0 @@
1
- import React from 'react';
2
- import { FileUploadProps } from './interfaces';
3
- import { InternalBaseComponentProps } from '../internal/hooks/use-base-component';
4
- import { ButtonProps } from '../button/interfaces';
5
- declare const _default: React.ForwardRefExoticComponent<FileUploadProps & InternalBaseComponentProps & React.RefAttributes<ButtonProps.Ref>>;
6
- export default _default;
7
- //# sourceMappingURL=internal.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"lib/default/","sources":["file-upload/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAGlF,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;;AAqBnD,wBAAoD"}
@@ -1,72 +0,0 @@
1
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { __rest } from "tslib";
4
- import React, { useRef, useState } from 'react';
5
- import { FileOption } from './file-option';
6
- import InternalSpaceBetween from '../space-between/internal';
7
- import styles from './styles.css.js';
8
- import { fireNonCancelableEvent } from '../internal/events';
9
- import { getBaseProps } from '../internal/base-component';
10
- import checkControlled from '../internal/hooks/check-controlled';
11
- import clsx from 'clsx';
12
- import { warnOnce } from '../internal/logging';
13
- import { Dropzone, useDropzoneVisible } from './dropzone';
14
- import FileInput from './file-input';
15
- import TokenList from '../internal/components/token-list';
16
- import { Token } from '../token-group/token';
17
- import { ConstraintText, FormFieldError } from '../form-field/internal';
18
- import { useUniqueId } from '../internal/hooks/use-unique-id';
19
- import { useMergeRefs } from '../internal/hooks/use-merge-refs';
20
- import { joinStrings } from '../internal/utils/strings';
21
- import { useFormFieldContext } from '../contexts/form-field';
22
- import InternalBox from '../box/internal';
23
- export default React.forwardRef(InternalFileUpload);
24
- function InternalFileUpload(_a, externalRef) {
25
- var _b;
26
- var { accept, ariaRequired, multiple = false, onChange, value, tokenLimit, showFileSize, showFileLastModified, showFileThumbnail, i18nStrings, __internalRootRef = null, constraintText, errorText, fileErrors } = _a, restProps = __rest(_a, ["accept", "ariaRequired", "multiple", "onChange", "value", "tokenLimit", "showFileSize", "showFileLastModified", "showFileThumbnail", "i18nStrings", "__internalRootRef", "constraintText", "errorText", "fileErrors"]);
27
- const baseProps = getBaseProps(restProps);
28
- const metadata = { showFileSize, showFileLastModified, showFileThumbnail };
29
- const errorId = useUniqueId('error-');
30
- const constraintTextId = useUniqueId('constraint-text-');
31
- const fileInputRef = useRef(null);
32
- const ref = useMergeRefs(fileInputRef, externalRef);
33
- const [removedFileIndex, setRemovedFileIndex] = useState(null);
34
- checkControlled('FileUpload', 'value', value, 'onChange', onChange);
35
- if (!multiple && value.length > 1) {
36
- warnOnce('FileUpload', 'Value must be an array of size 0 or 1 when `multiple=false`.');
37
- }
38
- const handleFilesChange = (newFiles) => {
39
- const newValue = multiple ? [...value, ...newFiles] : newFiles[0] ? newFiles : [...value];
40
- fireNonCancelableEvent(onChange, { value: newValue });
41
- };
42
- const onFileRemove = (removeFileIndex) => {
43
- var _a;
44
- const newValue = value.filter((_, fileIndex) => fileIndex !== removeFileIndex);
45
- fireNonCancelableEvent(onChange, { value: newValue });
46
- setRemovedFileIndex(removeFileIndex);
47
- if (value.length === 1) {
48
- (_a = fileInputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
49
- }
50
- };
51
- const isDropzoneVisible = useDropzoneVisible();
52
- const formFieldContext = useFormFieldContext(restProps);
53
- const ariaDescribedBy = joinStrings((_b = restProps.ariaDescribedby) !== null && _b !== void 0 ? _b : formFieldContext.ariaDescribedby, errorText ? errorId : undefined, constraintText ? constraintTextId : undefined);
54
- const hasError = Boolean(errorText || (fileErrors === null || fileErrors === void 0 ? void 0 : fileErrors.filter(Boolean).length));
55
- const invalid = restProps.invalid || formFieldContext.invalid || hasError;
56
- return (React.createElement(InternalSpaceBetween, Object.assign({}, baseProps, { size: "xs", className: clsx(baseProps.className, styles.root), __internalRootRef: __internalRootRef }),
57
- React.createElement(InternalBox, null,
58
- isDropzoneVisible ? (React.createElement(Dropzone, { onChange: handleFilesChange }, i18nStrings.dropzoneText(multiple))) : (React.createElement(FileInput, Object.assign({ ref: ref, accept: accept, ariaRequired: ariaRequired, multiple: multiple, onChange: handleFilesChange, value: value }, restProps, { ariaDescribedby: ariaDescribedBy, invalid: invalid }), i18nStrings.uploadButtonText(multiple))),
59
- (constraintText || errorText) && (React.createElement("div", { className: styles.hints },
60
- errorText && (React.createElement(FormFieldError, { id: errorId, errorIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel }, errorText)),
61
- constraintText && (React.createElement(ConstraintText, { id: constraintTextId, hasError: !!errorText }, constraintText))))),
62
- !multiple && value.length > 0 ? (React.createElement(InternalBox, null,
63
- React.createElement(Token, { ariaLabel: value[0].name, dismissLabel: i18nStrings.removeFileAriaLabel(0), onDismiss: () => onFileRemove(0), errorText: fileErrors === null || fileErrors === void 0 ? void 0 : fileErrors[0], errorIconAriaLabel: i18nStrings.errorIconAriaLabel, "data-index": 0 },
64
- React.createElement(FileOption, { file: value[0], metadata: metadata, i18nStrings: i18nStrings })))) : null,
65
- multiple && value.length > 0 ? (React.createElement(InternalBox, null,
66
- React.createElement(TokenList, { alignment: "vertical", items: value, renderItem: (file, fileIndex) => (React.createElement(Token, { ariaLabel: file.name, dismissLabel: i18nStrings.removeFileAriaLabel(fileIndex), onDismiss: () => onFileRemove(fileIndex), errorText: fileErrors === null || fileErrors === void 0 ? void 0 : fileErrors[fileIndex], errorIconAriaLabel: i18nStrings.errorIconAriaLabel, "data-index": fileIndex },
67
- React.createElement(FileOption, { file: file, metadata: metadata, i18nStrings: i18nStrings }))), limit: tokenLimit, i18nStrings: {
68
- limitShowFewer: i18nStrings.limitShowFewer,
69
- limitShowMore: i18nStrings.limitShowMore,
70
- }, removedItemIndex: removedFileIndex }))) : null));
71
- }
72
- //# sourceMappingURL=internal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"lib/default/","sources":["file-upload/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,eAAe,MAAM,oCAAoC,CAAC;AACjE,OAAO,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V,UAAU,CAAG,SAAS,CAAC,EAClC,kBAAkB,EAAE,WAAW,CAAC,kBAAkB,gBACtC,SAAS;oBAErB,oBAAC,UAAU,IAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,GAAI,CAClE,CACT,EACD,KAAK,EAAE,UAAU,EACjB,WAAW,EAAE;oBACX,cAAc,EAAE,WAAW,CAAC,cAAc;oBAC1C,aAAa,EAAE,WAAW,CAAC,aAAa;iBACzC,EACD,gBAAgB,EAAE,gBAAgB,GAClC,CACU,CACf,CAAC,CAAC,CAAC,IAAI,CACa,CACxB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { ForwardedRef, useRef, useState } from 'react';\nimport { FileUploadProps } from './interfaces';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\n\nimport { FileOption } from './file-option';\nimport { ButtonProps } from '../button/interfaces';\nimport InternalSpaceBetween from '../space-between/internal';\nimport styles from './styles.css.js';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { getBaseProps } from '../internal/base-component';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport clsx from 'clsx';\nimport { warnOnce } from '../internal/logging';\nimport { Dropzone, useDropzoneVisible } from './dropzone';\nimport FileInput from './file-input';\nimport TokenList from '../internal/components/token-list';\nimport { Token } from '../token-group/token';\nimport { ConstraintText, FormFieldError } from '../form-field/internal';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { joinStrings } from '../internal/utils/strings';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport InternalBox from '../box/internal';\n\ntype InternalFileUploadProps = FileUploadProps & InternalBaseComponentProps;\n\nexport default React.forwardRef(InternalFileUpload);\n\nfunction InternalFileUpload(\n {\n accept,\n ariaRequired,\n multiple = false,\n onChange,\n value,\n tokenLimit,\n showFileSize,\n showFileLastModified,\n showFileThumbnail,\n i18nStrings,\n __internalRootRef = null,\n constraintText,\n errorText,\n fileErrors,\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\n) {\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\n\n const [removedFileIndex, setRemovedFileIndex] = useState<null | number>(null);\n\n checkControlled('FileUpload', 'value', value, 'onChange', onChange);\n\n if (!multiple && value.length > 1) {\n warnOnce('FileUpload', 'Value must be an array of size 0 or 1 when `multiple=false`.');\n }\n\n const handleFilesChange = (newFiles: File[]) => {\n const newValue = multiple ? [...value, ...newFiles] : newFiles[0] ? newFiles : [...value];\n fireNonCancelableEvent(onChange, { value: newValue });\n };\n\n const onFileRemove = (removeFileIndex: number) => {\n const newValue = value.filter((_, fileIndex) => fileIndex !== removeFileIndex);\n fireNonCancelableEvent(onChange, { value: newValue });\n setRemovedFileIndex(removeFileIndex);\n if (value.length === 1) {\n fileInputRef.current?.focus();\n }\n };\n\n const isDropzoneVisible = useDropzoneVisible();\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n constraintText ? constraintTextId : undefined\n );\n\n const hasError = Boolean(errorText || fileErrors?.filter(Boolean).length);\n const invalid = restProps.invalid || formFieldContext.invalid || hasError;\n\n return (\n <InternalSpaceBetween\n {...baseProps}\n size=\"xs\"\n className={clsx(baseProps.className, styles.root)}\n __internalRootRef={__internalRootRef}\n >\n <InternalBox>\n {isDropzoneVisible ? (\n <Dropzone onChange={handleFilesChange}>{i18nStrings.dropzoneText(multiple)}</Dropzone>\n ) : (\n <FileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={handleFilesChange}\n value={value}\n {...restProps}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18nStrings.uploadButtonText(multiple)}\n </FileInput>\n )}\n\n {(constraintText || errorText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {constraintText && (\n <ConstraintText id={constraintTextId} hasError={!!errorText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {!multiple && value.length > 0 ? (\n <InternalBox>\n <Token\n ariaLabel={value[0].name}\n dismissLabel={i18nStrings.removeFileAriaLabel(0)}\n onDismiss={() => onFileRemove(0)}\n errorText={fileErrors?.[0]}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n data-index={0}\n >\n <FileOption file={value[0]} metadata={metadata} i18nStrings={i18nStrings} />\n </Token>\n </InternalBox>\n ) : null}\n\n {multiple && value.length > 0 ? (\n <InternalBox>\n <TokenList\n alignment=\"vertical\"\n items={value}\n renderItem={(file, fileIndex) => (\n <Token\n ariaLabel={file.name}\n dismissLabel={i18nStrings.removeFileAriaLabel(fileIndex)}\n onDismiss={() => onFileRemove(fileIndex)}\n errorText={fileErrors?.[fileIndex]}\n errorIconAriaLabel={i18nStrings.errorIconAriaLabel}\n data-index={fileIndex}\n >\n <FileOption file={file} metadata={metadata} i18nStrings={i18nStrings} />\n </Token>\n )}\n limit={tokenLimit}\n i18nStrings={{\n limitShowFewer: i18nStrings.limitShowFewer,\n limitShowMore: i18nStrings.limitShowMore,\n }}\n removedItemIndex={removedFileIndex}\n />\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n );\n}\n"]}
@@ -1,7 +0,0 @@
1
-
2
- import './styles.scoped.css';
3
- export default {
4
- "root": "awsui_root_1ubbm_utofa_9",
5
- "hints": "awsui_hints_1ubbm_utofa_10"
6
- };
7
-
@@ -1,16 +0,0 @@
1
- /*
2
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- SPDX-License-Identifier: Apache-2.0
4
- */
5
- /*
6
- Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
7
- SPDX-License-Identifier: Apache-2.0
8
- */
9
- .awsui_root_1ubbm_utofa_9:not(#\9),
10
- .awsui_hints_1ubbm_utofa_10:not(#\9) {
11
- /* used in test-utils */
12
- }
13
-
14
- .awsui_hints_1ubbm_utofa_10:not(#\9) {
15
- margin-top: var(--space-static-xxs-jy4jgd, 4px);
16
- }
@@ -1,8 +0,0 @@
1
-
2
- // es-module interop with Babel and Typescript
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- module.exports.default = {
5
- "root": "awsui_root_1ubbm_utofa_9",
6
- "hints": "awsui_hints_1ubbm_utofa_10"
7
- };
8
-
@@ -1,29 +0,0 @@
1
- import { ComponentWrapper, ElementWrapper } from '@cloudscape-design/test-utils-core/dom';
2
- import ButtonWrapper from '../button';
3
- export default class FileUploadWrapper extends ComponentWrapper<HTMLElement> {
4
- static rootSelector: string;
5
- findUploadButton(): ButtonWrapper;
6
- findNativeInput(): ElementWrapper<HTMLInputElement>;
7
- findFileTokens(): Array<FileTokenWrapper>;
8
- /**
9
- * Returns a file token from for a given index.
10
- *
11
- * @param tokenIndex 1-based index of the file token to return.
12
- */
13
- findFileToken(fileTokenIndex: number): null | FileTokenWrapper;
14
- /**
15
- * Returns the token toggle button.
16
- */
17
- findTokenToggle(): null | ElementWrapper;
18
- findConstraint(): null | ElementWrapper;
19
- findError(): null | ElementWrapper;
20
- }
21
- declare class FileTokenWrapper extends ComponentWrapper {
22
- findFileName(): ElementWrapper;
23
- findFileSize(): null | ElementWrapper;
24
- findFileLastModified(): null | ElementWrapper;
25
- findFileThumbnail(): null | ElementWrapper;
26
- findFileError(): null | ElementWrapper;
27
- findRemoveButton(): ElementWrapper;
28
- }
29
- export {};
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- // SPDX-License-Identifier: Apache-2.0
5
- const dom_1 = require("@cloudscape-design/test-utils-core/dom");
6
- const styles_selectors_js_1 = require("../../../file-upload/styles.selectors.js");
7
- const styles_selectors_js_2 = require("../../../file-upload/file-input/styles.selectors.js");
8
- const styles_selectors_js_3 = require("../../../file-upload/file-option/styles.selectors.js");
9
- const styles_selectors_js_4 = require("../../../token-group/styles.selectors.js");
10
- const styles_selectors_js_5 = require("../../../internal/components/token-list/styles.selectors.js");
11
- const styles_selectors_js_6 = require("../../../form-field/styles.selectors.js");
12
- const button_1 = require("../button");
13
- class FileUploadWrapper extends dom_1.ComponentWrapper {
14
- findUploadButton() {
15
- return this.findComponent(`.${styles_selectors_js_2.default['upload-button']}`, button_1.default);
16
- }
17
- findNativeInput() {
18
- return this.findByClassName(styles_selectors_js_2.default['upload-input']);
19
- }
20
- findFileTokens() {
21
- return this.findAllByClassName(styles_selectors_js_4.default.token).map(tokenElement => new FileTokenWrapper(tokenElement.getElement()));
22
- }
23
- /**
24
- * Returns a file token from for a given index.
25
- *
26
- * @param tokenIndex 1-based index of the file token to return.
27
- */
28
- findFileToken(fileTokenIndex) {
29
- return this.findComponent(`.${styles_selectors_js_4.default.token}[data-index="${fileTokenIndex - 1}"]`, FileTokenWrapper);
30
- }
31
- /**
32
- * Returns the token toggle button.
33
- */
34
- findTokenToggle() {
35
- return this.findByClassName(styles_selectors_js_5.default.toggle);
36
- }
37
- findConstraint() {
38
- return this.find(`.${styles_selectors_js_1.default.hints} .${styles_selectors_js_6.default.constraint}`);
39
- }
40
- findError() {
41
- return this.find(`.${styles_selectors_js_1.default.hints} .${styles_selectors_js_6.default.error} .${styles_selectors_js_6.default.error__message}`);
42
- }
43
- }
44
- exports.default = FileUploadWrapper;
45
- FileUploadWrapper.rootSelector = styles_selectors_js_1.default.root;
46
- class FileTokenWrapper extends dom_1.ComponentWrapper {
47
- findFileName() {
48
- return this.findByClassName(styles_selectors_js_3.default['file-option-name']);
49
- }
50
- findFileSize() {
51
- return this.findByClassName(styles_selectors_js_3.default['file-option-size']);
52
- }
53
- findFileLastModified() {
54
- return this.findByClassName(styles_selectors_js_3.default['file-option-last-modified']);
55
- }
56
- findFileThumbnail() {
57
- return this.findByClassName(styles_selectors_js_3.default['file-option-thumbnail-image']);
58
- }
59
- findFileError() {
60
- return this.find(`.${styles_selectors_js_6.default.error} .${styles_selectors_js_6.default.error__message}`);
61
- }
62
- findRemoveButton() {
63
- return this.findByClassName(styles_selectors_js_4.default['dismiss-button']);
64
- }
65
- }
66
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/test-utils/dom/file-upload/index.ts"],"names":[],"mappings":";;AAAA,qEAAqE;AACrE,sCAAsC;AACtC,gEAA0F;AAC1F,kFAA2E;AAC3E,6FAA2F;AAC3F,8FAA6F;AAC7F,kFAA2E;AAC3E,qGAA6F;AAC7F,iFAAsE;AACtE,sCAAsC;AAEtC,MAAqB,iBAAkB,SAAQ,sBAA6B;IAG1E,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,6BAAwB,CAAC,eAAe,CAAC,EAAE,EAAE,gBAAa,CAAE,CAAC;IAC7F,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,eAAe,CAAC,6BAAwB,CAAC,cAAc,CAAC,CAAE,CAAC;IACzE,CAAC;IAED,cAAc;QACZ,OAAO,IAAI,CAAC,kBAAkB,CAAC,6BAAmB,CAAC,KAAK,CAAC,CAAC,GAAG,CAC3D,YAAY,CAAC,EAAE,CAAC,IAAI,gBAAgB,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC,CAChE,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACH,aAAa,CAAC,cAAsB;QAClC,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,6BAAmB,CAAC,KAAK,gBAA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ementWrapper } from "@cloudscape-design/test-utils-core/selectors";
2
- import ButtonWrapper from '../button';
3
- export default class FileUploadWrapper extends ComponentWrapper {
4
- static rootSelector: string;
5
- findUploadButton(): ButtonWrapper;
6
- findNativeInput(): ElementWrapper;
7
- findFileTokens(): import("@cloudscape-design/test-utils-core/selectors").MultiElementWrapper<FileTokenWrapper>;
8
- /**
9
- * Returns a file token from for a given index.
10
- *
11
- * @param tokenIndex 1-based index of the file token to return.
12
- */
13
- findFileToken(fileTokenIndex: number): FileTokenWrapper;
14
- /**
15
- * Returns the token toggle button.
16
- */
17
- findTokenToggle(): ElementWrapper;
18
- findConstraint(): ElementWrapper;
19
- findError(): ElementWrapper;
20
- }
21
- declare class FileTokenWrapper extends ComponentWrapper {
22
- findFileName(): ElementWrapper;
23
- findFileSize(): ElementWrapper;
24
- findFileLastModified(): ElementWrapper;
25
- findFileThumbnail(): ElementWrapper;
26
- findFileError(): ElementWrapper;
27
- findRemoveButton(): ElementWrapper;
28
- }
29
- export {};
@@ -1,66 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
- // SPDX-License-Identifier: Apache-2.0
5
- const selectors_1 = require("@cloudscape-design/test-utils-core/selectors");
6
- const styles_selectors_js_1 = require("../../../file-upload/styles.selectors.js");
7
- const styles_selectors_js_2 = require("../../../file-upload/file-input/styles.selectors.js");
8
- const styles_selectors_js_3 = require("../../../file-upload/file-option/styles.selectors.js");
9
- const styles_selectors_js_4 = require("../../../token-group/styles.selectors.js");
10
- const styles_selectors_js_5 = require("../../../internal/components/token-list/styles.selectors.js");
11
- const styles_selectors_js_6 = require("../../../form-field/styles.selectors.js");
12
- const button_1 = require("../button");
13
- class FileUploadWrapper extends selectors_1.ComponentWrapper {
14
- findUploadButton() {
15
- return this.findComponent(`.${styles_selectors_js_2.default['upload-button']}`, button_1.default);
16
- }
17
- findNativeInput() {
18
- return this.findByClassName(styles_selectors_js_2.default['upload-input']);
19
- }
20
- findFileTokens() {
21
- return this.findAllByClassName(styles_selectors_js_4.default.token).map(tokenElement => new FileTokenWrapper(tokenElement.getElement()));
22
- }
23
- /**
24
- * Returns a file token from for a given index.
25
- *
26
- * @param tokenIndex 1-based index of the file token to return.
27
- */
28
- findFileToken(fileTokenIndex) {
29
- return this.findComponent(`.${styles_selectors_js_4.default.token}[data-index="${fileTokenIndex - 1}"]`, FileTokenWrapper);
30
- }
31
- /**
32
- * Returns the token toggle button.
33
- */
34
- findTokenToggle() {
35
- return this.findByClassName(styles_selectors_js_5.default.toggle);
36
- }
37
- findConstraint() {
38
- return this.find(`.${styles_selectors_js_1.default.hints} .${styles_selectors_js_6.default.constraint}`);
39
- }
40
- findError() {
41
- return this.find(`.${styles_selectors_js_1.default.hints} .${styles_selectors_js_6.default.error} .${styles_selectors_js_6.default.error__message}`);
42
- }
43
- }
44
- exports.default = FileUploadWrapper;
45
- FileUploadWrapper.rootSelector = styles_selectors_js_1.default.root;
46
- class FileTokenWrapper extends selectors_1.ComponentWrapper {
47
- findFileName() {
48
- return this.findByClassName(styles_selectors_js_3.default['file-option-name']);
49
- }
50
- findFileSize() {
51
- return this.findByClassName(styles_selectors_js_3.default['file-option-size']);
52
- }
53
- findFileLastModified() {
54
- return this.findByClassName(styles_selectors_js_3.default['file-option-last-modified']);
55
- }
56
- findFileThumbnail() {
57
- return this.findByClassName(styles_selectors_js_3.default['file-option-thumbnail-image']);
58
- }
59
- findFileError() {
60
- return this.find(`.${styles_selectors_js_6.default.error} .${styles_selectors_js_6.default.error__message}`);
61
- }
62
- findRemoveButton() {
63
- return this.findByClassName(styles_selectors_js_4.default['dismiss-button']);
64
- }
65
- }
66
- //# sourceMappingURL=index.js.map