@cloudscape-design/components-themeable 3.0.846 → 3.0.848
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/internal/manifest.json +1 -1
- package/lib/internal/scss/alert/styles.scss +3 -3
- package/lib/internal/scss/anchor-navigation/styles.scss +1 -1
- package/lib/internal/scss/flashbar/collapsible.scss +2 -2
- package/lib/internal/scss/flashbar/styles.scss +1 -1
- package/lib/internal/scss/internal/styles/forms/constants.scss +1 -1
- package/lib/internal/scss/internal/styles/forms/mixins.scss +2 -2
- package/lib/internal/scss/internal/styles/typography/mixins.scss +1 -1
- package/lib/internal/scss/link/constants.scss +2 -2
- package/lib/internal/scss/popover/arrow.scss +1 -5
- package/lib/internal/scss/popover/body.scss +1 -1
- package/lib/internal/scss/popover/container.scss +2 -2
- package/lib/internal/scss/property-filter/filtering-token/styles.scss +2 -2
- package/lib/internal/scss/select/parts/styles.scss +3 -3
- package/lib/internal/scss/token-group/mixins.scss +2 -2
- package/lib/internal/template/alert/styles.css.js +28 -28
- package/lib/internal/template/alert/styles.scoped.css +46 -46
- package/lib/internal/template/alert/styles.selectors.js +28 -28
- package/lib/internal/template/anchor-navigation/styles.css.js +8 -8
- package/lib/internal/template/anchor-navigation/styles.scoped.css +19 -19
- package/lib/internal/template/anchor-navigation/styles.selectors.js +8 -8
- package/lib/internal/template/button/styles.css.js +21 -21
- package/lib/internal/template/button/styles.scoped.css +157 -157
- package/lib/internal/template/button/styles.selectors.js +21 -21
- package/lib/internal/template/button-dropdown/item-element/styles.css.js +13 -13
- package/lib/internal/template/button-dropdown/item-element/styles.scoped.css +22 -22
- package/lib/internal/template/button-dropdown/item-element/styles.selectors.js +13 -13
- package/lib/internal/template/button-dropdown/styles.css.js +17 -17
- package/lib/internal/template/button-dropdown/styles.scoped.css +30 -30
- package/lib/internal/template/button-dropdown/styles.selectors.js +17 -17
- package/lib/internal/template/expandable-section/styles.css.js +34 -34
- package/lib/internal/template/expandable-section/styles.scoped.css +67 -67
- package/lib/internal/template/expandable-section/styles.selectors.js +34 -34
- package/lib/internal/template/file-token-group/file-token.d.ts +2 -2
- package/lib/internal/template/file-token-group/file-token.d.ts.map +1 -1
- package/lib/internal/template/file-token-group/file-token.js +9 -5
- package/lib/internal/template/file-token-group/file-token.js.map +1 -1
- package/lib/internal/template/file-token-group/interfaces.d.ts +2 -2
- package/lib/internal/template/file-token-group/interfaces.d.ts.map +1 -1
- package/lib/internal/template/file-token-group/interfaces.js.map +1 -1
- package/lib/internal/template/file-token-group/internal.d.ts.map +1 -1
- package/lib/internal/template/file-token-group/internal.js +11 -3
- package/lib/internal/template/file-token-group/internal.js.map +1 -1
- package/lib/internal/template/file-token-group/styles.css.js +22 -22
- package/lib/internal/template/file-token-group/styles.scoped.css +31 -31
- package/lib/internal/template/file-token-group/styles.selectors.js +22 -22
- package/lib/internal/template/file-upload/interfaces.d.ts +6 -6
- package/lib/internal/template/file-upload/interfaces.d.ts.map +1 -1
- package/lib/internal/template/file-upload/interfaces.js.map +1 -1
- package/lib/internal/template/file-upload/internal.d.ts.map +1 -1
- package/lib/internal/template/file-upload/internal.js +15 -5
- package/lib/internal/template/file-upload/internal.js.map +1 -1
- package/lib/internal/template/flashbar/styles.css.js +50 -50
- package/lib/internal/template/flashbar/styles.scoped.css +151 -151
- package/lib/internal/template/flashbar/styles.selectors.js +50 -50
- package/lib/internal/template/i18n/messages/all.all.js +1 -1
- package/lib/internal/template/i18n/messages/all.all.json +1 -1
- package/lib/internal/template/i18n/messages/all.ar.js +1 -1
- package/lib/internal/template/i18n/messages/all.ar.json +1 -1
- package/lib/internal/template/i18n/messages/all.de.js +1 -1
- package/lib/internal/template/i18n/messages/all.de.json +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.js +1 -1
- package/lib/internal/template/i18n/messages/all.en-GB.json +1 -1
- package/lib/internal/template/i18n/messages/all.en.js +1 -1
- package/lib/internal/template/i18n/messages/all.en.json +1 -1
- package/lib/internal/template/i18n/messages/all.es.js +1 -1
- package/lib/internal/template/i18n/messages/all.es.json +1 -1
- package/lib/internal/template/i18n/messages/all.fr.js +1 -1
- package/lib/internal/template/i18n/messages/all.fr.json +1 -1
- package/lib/internal/template/i18n/messages/all.id.js +1 -1
- package/lib/internal/template/i18n/messages/all.id.json +1 -1
- package/lib/internal/template/i18n/messages/all.it.js +1 -1
- package/lib/internal/template/i18n/messages/all.it.json +1 -1
- package/lib/internal/template/i18n/messages/all.ja.js +1 -1
- package/lib/internal/template/i18n/messages/all.ja.json +1 -1
- package/lib/internal/template/i18n/messages/all.ko.js +1 -1
- package/lib/internal/template/i18n/messages/all.ko.json +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.js +1 -1
- package/lib/internal/template/i18n/messages/all.pt-BR.json +1 -1
- package/lib/internal/template/i18n/messages/all.tr.js +1 -1
- package/lib/internal/template/i18n/messages/all.tr.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-CN.json +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.js +1 -1
- package/lib/internal/template/i18n/messages/all.zh-TW.json +1 -1
- package/lib/internal/template/i18n/messages-types.d.ts +24 -0
- package/lib/internal/template/i18n/messages-types.d.ts.map +1 -1
- package/lib/internal/template/i18n/messages-types.js.map +1 -1
- package/lib/internal/template/input/styles.css.js +13 -13
- package/lib/internal/template/input/styles.scoped.css +44 -44
- package/lib/internal/template/input/styles.selectors.js +13 -13
- package/lib/internal/template/internal/base-component/styles.scoped.css +7 -3
- package/lib/internal/template/internal/components/button-trigger/styles.css.js +13 -13
- package/lib/internal/template/internal/components/button-trigger/styles.scoped.css +37 -37
- package/lib/internal/template/internal/components/button-trigger/styles.selectors.js +13 -13
- package/lib/internal/template/internal/components/checkbox-icon/styles.css.js +9 -9
- package/lib/internal/template/internal/components/checkbox-icon/styles.scoped.css +10 -10
- package/lib/internal/template/internal/components/checkbox-icon/styles.selectors.js +9 -9
- package/lib/internal/template/internal/components/dropdown/styles.css.js +20 -20
- package/lib/internal/template/internal/components/dropdown/styles.scoped.css +39 -39
- package/lib/internal/template/internal/components/dropdown/styles.selectors.js +20 -20
- package/lib/internal/template/internal/components/menu-dropdown/styles.css.js +7 -7
- package/lib/internal/template/internal/components/menu-dropdown/styles.scoped.css +14 -14
- package/lib/internal/template/internal/components/menu-dropdown/styles.selectors.js +7 -7
- package/lib/internal/template/internal/components/token-list/styles.css.js +10 -10
- package/lib/internal/template/internal/components/token-list/styles.scoped.css +26 -26
- package/lib/internal/template/internal/components/token-list/styles.selectors.js +10 -10
- package/lib/internal/template/internal/environment.js +1 -1
- package/lib/internal/template/internal/environment.json +1 -1
- package/lib/internal/template/internal/generated/styles/tokens.d.ts +4 -2
- package/lib/internal/template/internal/generated/styles/tokens.js +4 -2
- package/lib/internal/template/internal/generated/theming/index.cjs +22 -8
- package/lib/internal/template/internal/generated/theming/index.cjs.d.ts +32 -0
- package/lib/internal/template/internal/generated/theming/index.d.ts +32 -0
- package/lib/internal/template/internal/generated/theming/index.js +22 -8
- package/lib/internal/template/link/styles.css.js +20 -20
- package/lib/internal/template/link/styles.scoped.css +73 -73
- package/lib/internal/template/link/styles.selectors.js +20 -20
- package/lib/internal/template/pagination/styles.css.js +9 -9
- package/lib/internal/template/pagination/styles.scoped.css +27 -27
- package/lib/internal/template/pagination/styles.selectors.js +9 -9
- package/lib/internal/template/popover/styles.css.js +52 -52
- package/lib/internal/template/popover/styles.scoped.css +72 -75
- package/lib/internal/template/popover/styles.selectors.js +52 -52
- package/lib/internal/template/prompt-input/styles.css.js +14 -14
- package/lib/internal/template/prompt-input/styles.scoped.css +56 -56
- package/lib/internal/template/prompt-input/styles.selectors.js +14 -14
- package/lib/internal/template/property-filter/filtering-token/styles.css.js +18 -18
- package/lib/internal/template/property-filter/filtering-token/styles.scoped.css +45 -45
- package/lib/internal/template/property-filter/filtering-token/styles.selectors.js +18 -18
- package/lib/internal/template/property-filter/styles.css.js +39 -39
- package/lib/internal/template/property-filter/styles.scoped.css +42 -42
- package/lib/internal/template/property-filter/styles.selectors.js +39 -39
- package/lib/internal/template/segmented-control/styles.css.js +15 -15
- package/lib/internal/template/segmented-control/styles.scoped.css +38 -38
- package/lib/internal/template/segmented-control/styles.selectors.js +15 -15
- package/lib/internal/template/select/parts/styles.css.js +21 -21
- package/lib/internal/template/select/parts/styles.scoped.css +26 -26
- package/lib/internal/template/select/parts/styles.selectors.js +21 -21
- package/lib/internal/template/test-utils/tsconfig.tsbuildinfo +1 -1
- package/lib/internal/template/textarea/styles.css.js +5 -5
- package/lib/internal/template/textarea/styles.scoped.css +24 -24
- package/lib/internal/template/textarea/styles.selectors.js +5 -5
- package/lib/internal/template/tiles/styles.css.js +30 -30
- package/lib/internal/template/tiles/styles.scoped.css +79 -79
- package/lib/internal/template/tiles/styles.selectors.js +30 -30
- package/lib/internal/template/token-group/styles.css.js +8 -8
- package/lib/internal/template/token-group/styles.scoped.css +18 -18
- package/lib/internal/template/token-group/styles.selectors.js +8 -8
- package/lib/internal/template/top-navigation/styles.css.js +47 -47
- package/lib/internal/template/top-navigation/styles.scoped.css +67 -67
- package/lib/internal/template/top-navigation/styles.selectors.js +47 -47
- package/lib/internal/template/tutorial-panel/components/tutorial-list/styles.css.js +18 -18
- package/lib/internal/template/tutorial-panel/components/tutorial-list/styles.scoped.css +29 -29
- package/lib/internal/template/tutorial-panel/components/tutorial-list/styles.selectors.js +18 -18
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { __rest } from "tslib";
|
|
4
4
|
import React, { useState } from 'react';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { useInternalI18n } from '../i18n/context';
|
|
6
7
|
import { getBaseProps } from '../internal/base-component/index.js';
|
|
7
8
|
import TokenList from '../internal/components/token-list/index.js';
|
|
8
9
|
import { fireNonCancelableEvent } from '../internal/events/index.js';
|
|
@@ -28,13 +29,20 @@ function InternalFileTokenGroup(_a) {
|
|
|
28
29
|
const mergedRef = useMergeRefs(__internalRootRef, tokenListRef);
|
|
29
30
|
const isImage = (file) => file.type.startsWith('image/');
|
|
30
31
|
const groupContainsImage = items.filter(item => isImage(item.file)).length > 0;
|
|
32
|
+
const i18n = useInternalI18n('file-token-group');
|
|
31
33
|
return (React.createElement("div", Object.assign({}, baseProps, { ref: mergedRef, className: clsx(baseProps.className, styles.root, testStyles.root) }),
|
|
32
34
|
React.createElement(TokenList, { alignment: alignment === 'horizontal' ? 'horizontal-grid' : alignment, items: items, renderItem: (file, fileIndex) => (React.createElement(InternalFileToken, { file: file.file, showFileLastModified: showFileLastModified, showFileSize: showFileSize, showFileThumbnail: showFileThumbnail, onDismiss: () => {
|
|
33
35
|
fireNonCancelableEvent(onDismiss, { fileIndex });
|
|
34
36
|
setNextFocusIndex(fileIndex);
|
|
35
|
-
}, errorText: file.errorText, warningText: file.warningText, i18nStrings:
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
}, errorText: file.errorText, warningText: file.warningText, i18nStrings: {
|
|
38
|
+
removeFileAriaLabel: i18n('i18nStrings.removeFileAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel, format => fileIndex => format({ fileIndex: fileIndex + 1 })),
|
|
39
|
+
errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel),
|
|
40
|
+
warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel),
|
|
41
|
+
formatFileSize: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatFileSize,
|
|
42
|
+
formatFileLastModified: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatFileLastModified,
|
|
43
|
+
}, loading: file.loading, readOnly: readOnly, alignment: alignment, groupContainsImage: groupContainsImage, isImage: isImage(file.file), index: fileIndex })), limit: limit, i18nStrings: {
|
|
44
|
+
limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.limitShowFewer),
|
|
45
|
+
limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.limitShowMore),
|
|
38
46
|
} })));
|
|
39
47
|
}
|
|
40
48
|
export default InternalFileTokenGroup;
|
|
@@ -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,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,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,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,EAYF;QAZE,EAC9B,KAAK,EACL,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,KAAK,EACL,QAAQ,EACR,SAAS,GAAG,UAAU,EACtB,iBAAiB,OAEW,EADzB,SAAS,cAXkB,yJAY/B,CADa;IAEZ,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC;IAE1C,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAgB,IAAI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0\n\nimport React, { useState } from 'react';\nimport clsx from 'clsx';\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 { useMergeRefs } from '../internal/hooks/use-merge-refs/index.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,27 +1,27 @@
|
|
|
1
1
|
|
|
2
2
|
import './styles.scoped.css';
|
|
3
3
|
export default {
|
|
4
|
-
"root": "
|
|
5
|
-
"file-loading-overlay": "awsui_file-loading-
|
|
6
|
-
"file-loading-overlay-single-row": "awsui_file-loading-overlay-single-
|
|
7
|
-
"file-option-name": "awsui_file-option-
|
|
8
|
-
"file-option-size": "awsui_file-option-
|
|
9
|
-
"file-option-last-modified": "awsui_file-option-last-
|
|
10
|
-
"file-option": "awsui_file-
|
|
11
|
-
"file-option-thumbnail": "awsui_file-option-
|
|
12
|
-
"file-option-thumbnail-image": "awsui_file-option-thumbnail-
|
|
13
|
-
"file-option-metadata": "awsui_file-option-
|
|
14
|
-
"with-image": "awsui_with-
|
|
15
|
-
"single-row-loading": "awsui_single-row-
|
|
16
|
-
"token": "
|
|
17
|
-
"token-grid": "awsui_token-
|
|
18
|
-
"token-contains-image": "awsui_token-contains-
|
|
19
|
-
"token-box": "awsui_token-
|
|
20
|
-
"horizontal": "
|
|
21
|
-
"error": "
|
|
22
|
-
"dismiss-button": "awsui_dismiss-
|
|
23
|
-
"warning": "
|
|
24
|
-
"read-only": "awsui_read-
|
|
25
|
-
"loading": "
|
|
4
|
+
"root": "awsui_root_39ths_10roo_205",
|
|
5
|
+
"file-loading-overlay": "awsui_file-loading-overlay_39ths_10roo_240",
|
|
6
|
+
"file-loading-overlay-single-row": "awsui_file-loading-overlay-single-row_39ths_10roo_245",
|
|
7
|
+
"file-option-name": "awsui_file-option-name_39ths_10roo_249",
|
|
8
|
+
"file-option-size": "awsui_file-option-size_39ths_10roo_250",
|
|
9
|
+
"file-option-last-modified": "awsui_file-option-last-modified_39ths_10roo_251",
|
|
10
|
+
"file-option": "awsui_file-option_39ths_10roo_249",
|
|
11
|
+
"file-option-thumbnail": "awsui_file-option-thumbnail_39ths_10roo_264",
|
|
12
|
+
"file-option-thumbnail-image": "awsui_file-option-thumbnail-image_39ths_10roo_268",
|
|
13
|
+
"file-option-metadata": "awsui_file-option-metadata_39ths_10roo_281",
|
|
14
|
+
"with-image": "awsui_with-image_39ths_10roo_284",
|
|
15
|
+
"single-row-loading": "awsui_single-row-loading_39ths_10roo_287",
|
|
16
|
+
"token": "awsui_token_39ths_10roo_291",
|
|
17
|
+
"token-grid": "awsui_token-grid_39ths_10roo_298",
|
|
18
|
+
"token-contains-image": "awsui_token-contains-image_39ths_10roo_307",
|
|
19
|
+
"token-box": "awsui_token-box_39ths_10roo_311",
|
|
20
|
+
"horizontal": "awsui_horizontal_39ths_10roo_330",
|
|
21
|
+
"error": "awsui_error_39ths_10roo_338",
|
|
22
|
+
"dismiss-button": "awsui_dismiss-button_39ths_10roo_342",
|
|
23
|
+
"warning": "awsui_warning_39ths_10roo_348",
|
|
24
|
+
"read-only": "awsui_read-only_39ths_10roo_358",
|
|
25
|
+
"loading": "awsui_loading_39ths_10roo_371"
|
|
26
26
|
};
|
|
27
27
|
|
|
@@ -202,7 +202,7 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
202
202
|
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
203
203
|
SPDX-License-Identifier: Apache-2.0
|
|
204
204
|
*/
|
|
205
|
-
.
|
|
205
|
+
.awsui_root_39ths_10roo_205:not(#\9) {
|
|
206
206
|
border-collapse: separate;
|
|
207
207
|
border-spacing: 0;
|
|
208
208
|
box-sizing: border-box;
|
|
@@ -238,35 +238,35 @@ 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-
|
|
241
|
+
.awsui_file-loading-overlay_39ths_10roo_240:not(#\9) {
|
|
242
242
|
position: absolute;
|
|
243
243
|
inset-inline-end: var(--space-static-xs-fwcjew, 8px);
|
|
244
244
|
inset-block-end: var(--space-static-xxs-9qxzo2, 4px);
|
|
245
245
|
}
|
|
246
|
-
.awsui_file-loading-overlay-single-
|
|
246
|
+
.awsui_file-loading-overlay-single-row_39ths_10roo_245:not(#\9) {
|
|
247
247
|
inset-inline-end: var(--space-static-xxl-ybu58c, 32px);
|
|
248
248
|
}
|
|
249
249
|
|
|
250
|
-
.awsui_file-option-
|
|
251
|
-
.awsui_file-option-
|
|
252
|
-
.awsui_file-option-last-
|
|
250
|
+
.awsui_file-option-name_39ths_10roo_249:not(#\9),
|
|
251
|
+
.awsui_file-option-size_39ths_10roo_250:not(#\9),
|
|
252
|
+
.awsui_file-option-last-modified_39ths_10roo_251:not(#\9) {
|
|
253
253
|
text-overflow: ellipsis;
|
|
254
254
|
overflow: hidden;
|
|
255
255
|
white-space: nowrap;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
.awsui_file-
|
|
258
|
+
.awsui_file-option_39ths_10roo_249:not(#\9) {
|
|
259
259
|
inline-size: 100%;
|
|
260
260
|
min-inline-size: 0;
|
|
261
261
|
display: flex;
|
|
262
262
|
gap: var(--space-scaled-xs-t3am3w, 8px);
|
|
263
263
|
}
|
|
264
264
|
|
|
265
|
-
.awsui_file-option-
|
|
265
|
+
.awsui_file-option-thumbnail_39ths_10roo_264:not(#\9) {
|
|
266
266
|
margin-block-start: var(--space-static-xxs-9qxzo2, 4px);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
.awsui_file-option-thumbnail-
|
|
269
|
+
.awsui_file-option-thumbnail-image_39ths_10roo_268:not(#\9) {
|
|
270
270
|
font-size: var(--font-size-body-s-4dzx5q, 12px);
|
|
271
271
|
line-height: var(--line-height-body-s-egzl4q, 16px);
|
|
272
272
|
letter-spacing: var(--letter-spacing-body-s-cbaxyl, normal);
|
|
@@ -279,41 +279,41 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
279
279
|
overflow: hidden;
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
.awsui_file-option-
|
|
282
|
+
.awsui_file-option-metadata_39ths_10roo_281:not(#\9) {
|
|
283
283
|
inline-size: 100%;
|
|
284
284
|
}
|
|
285
|
-
.awsui_file-option-
|
|
285
|
+
.awsui_file-option-metadata_39ths_10roo_281.awsui_with-image_39ths_10roo_284:not(#\9) {
|
|
286
286
|
inline-size: calc(100% - 48px);
|
|
287
287
|
}
|
|
288
|
-
.awsui_file-option-
|
|
288
|
+
.awsui_file-option-metadata_39ths_10roo_281.awsui_single-row-loading_39ths_10roo_287:not(#\9) {
|
|
289
289
|
inline-size: calc(100% - var(--size-icon-normal-19036g, 16px));
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
.
|
|
292
|
+
.awsui_token_39ths_10roo_291:not(#\9) {
|
|
293
293
|
position: relative;
|
|
294
294
|
block-size: 100%;
|
|
295
295
|
display: flex;
|
|
296
296
|
flex-direction: column;
|
|
297
297
|
gap: var(--space-xxs-y2432o, 4px);
|
|
298
298
|
}
|
|
299
|
-
.awsui_token-
|
|
299
|
+
.awsui_token-grid_39ths_10roo_298:not(#\9) {
|
|
300
300
|
display: grid;
|
|
301
301
|
grid-template-rows: max-content auto;
|
|
302
302
|
}
|
|
303
303
|
@media (max-width: 688px) {
|
|
304
|
-
.awsui_token-
|
|
304
|
+
.awsui_token-grid_39ths_10roo_298:not(#\9) {
|
|
305
305
|
display: flex;
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
-
.awsui_token-contains-
|
|
308
|
+
.awsui_token-contains-image_39ths_10roo_307:not(#\9) {
|
|
309
309
|
grid-template-rows: 68px auto;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
-
.awsui_token-
|
|
312
|
+
.awsui_token-box_39ths_10roo_311:not(#\9) {
|
|
313
313
|
position: relative;
|
|
314
314
|
block-size: 100%;
|
|
315
|
-
border-block: var(--border-field-
|
|
316
|
-
border-inline: var(--border-field-
|
|
315
|
+
border-block: var(--border-width-field-9kmoac, 1px) solid var(--color-border-item-selected-aam4fo, #0073bb);
|
|
316
|
+
border-inline: var(--border-width-field-9kmoac, 1px) solid var(--color-border-item-selected-aam4fo, #0073bb);
|
|
317
317
|
padding-block-start: var(--space-scaled-xxs-krq5fq, 4px);
|
|
318
318
|
padding-block-end: var(--space-scaled-xxs-krq5fq, 4px);
|
|
319
319
|
padding-inline-start: var(--space-field-horizontal-cxdor9, 8px);
|
|
@@ -328,48 +328,48 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
|
|
|
328
328
|
color: var(--color-text-body-default-agk00h, #16191f);
|
|
329
329
|
box-sizing: border-box;
|
|
330
330
|
}
|
|
331
|
-
.awsui_token-
|
|
331
|
+
.awsui_token-box_39ths_10roo_311.awsui_horizontal_39ths_10roo_330:not(#\9) {
|
|
332
332
|
max-inline-size: 230px;
|
|
333
333
|
}
|
|
334
334
|
@media (max-width: 688px) {
|
|
335
|
-
.awsui_token-
|
|
335
|
+
.awsui_token-box_39ths_10roo_311.awsui_horizontal_39ths_10roo_330:not(#\9) {
|
|
336
336
|
max-inline-size: 100%;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
.awsui_token-
|
|
339
|
+
.awsui_token-box_39ths_10roo_311.awsui_error_39ths_10roo_338:not(#\9) {
|
|
340
340
|
border-color: var(--color-border-status-error-5n723o, #d13212);
|
|
341
341
|
border-inline-start-width: var(--border-invalid-width-bkxihb, 4px);
|
|
342
342
|
}
|
|
343
|
-
.awsui_token-
|
|
343
|
+
.awsui_token-box_39ths_10roo_311.awsui_error_39ths_10roo_338 > .awsui_dismiss-button_39ths_10roo_342:not(#\9) {
|
|
344
344
|
color: var(--color-text-interactive-default-t1snbz, #545b64);
|
|
345
345
|
}
|
|
346
|
-
.awsui_token-
|
|
346
|
+
.awsui_token-box_39ths_10roo_311.awsui_error_39ths_10roo_338 > .awsui_dismiss-button_39ths_10roo_342:not(#\9):hover {
|
|
347
347
|
color: var(--color-text-interactive-hover-kxltdh, #16191f);
|
|
348
348
|
}
|
|
349
|
-
.awsui_token-
|
|
349
|
+
.awsui_token-box_39ths_10roo_311.awsui_warning_39ths_10roo_348:not(#\9) {
|
|
350
350
|
border-color: var(--color-border-status-warning-wkps52, #906806);
|
|
351
351
|
border-inline-start-width: var(--border-invalid-width-bkxihb, 4px);
|
|
352
352
|
}
|
|
353
|
-
.awsui_token-
|
|
353
|
+
.awsui_token-box_39ths_10roo_311.awsui_warning_39ths_10roo_348 > .awsui_dismiss-button_39ths_10roo_342:not(#\9) {
|
|
354
354
|
color: var(--color-text-interactive-default-t1snbz, #545b64);
|
|
355
355
|
}
|
|
356
|
-
.awsui_token-
|
|
356
|
+
.awsui_token-box_39ths_10roo_311.awsui_warning_39ths_10roo_348 > .awsui_dismiss-button_39ths_10roo_342:not(#\9):hover {
|
|
357
357
|
color: var(--color-text-interactive-hover-kxltdh, #16191f);
|
|
358
358
|
}
|
|
359
|
-
.awsui_token-
|
|
359
|
+
.awsui_token-box_39ths_10roo_311.awsui_read-only_39ths_10roo_358:not(#\9) {
|
|
360
360
|
border-color: var(--color-border-input-disabled-vjmitr, #eaeded);
|
|
361
361
|
background-color: var(--color-background-container-content-myy7cn, #ffffff);
|
|
362
362
|
pointer-events: none;
|
|
363
363
|
}
|
|
364
|
-
.awsui_token-
|
|
364
|
+
.awsui_token-box_39ths_10roo_311.awsui_read-only_39ths_10roo_358 > .awsui_dismiss-button_39ths_10roo_342:not(#\9) {
|
|
365
365
|
color: var(--color-text-button-inline-icon-disabled-pdpnjk, #aab7b8);
|
|
366
366
|
}
|
|
367
|
-
.awsui_token-
|
|
367
|
+
.awsui_token-box_39ths_10roo_311.awsui_read-only_39ths_10roo_358 > .awsui_dismiss-button_39ths_10roo_342:not(#\9):hover {
|
|
368
368
|
/* stylelint-disable-next-line plugin/no-unsupported-browser-features */
|
|
369
369
|
cursor: initial;
|
|
370
370
|
color: var(--color-text-button-inline-icon-disabled-pdpnjk, #aab7b8);
|
|
371
371
|
}
|
|
372
|
-
.awsui_token-
|
|
372
|
+
.awsui_token-box_39ths_10roo_311.awsui_loading_39ths_10roo_371:not(#\9) {
|
|
373
373
|
border-color: var(--color-border-control-disabled-7jgofv, #d5dbdb);
|
|
374
374
|
background-color: var(--color-background-container-content-myy7cn, #ffffff);
|
|
375
375
|
}
|
|
@@ -2,27 +2,27 @@
|
|
|
2
2
|
// es-module interop with Babel and Typescript
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
module.exports.default = {
|
|
5
|
-
"root": "
|
|
6
|
-
"file-loading-overlay": "awsui_file-loading-
|
|
7
|
-
"file-loading-overlay-single-row": "awsui_file-loading-overlay-single-
|
|
8
|
-
"file-option-name": "awsui_file-option-
|
|
9
|
-
"file-option-size": "awsui_file-option-
|
|
10
|
-
"file-option-last-modified": "awsui_file-option-last-
|
|
11
|
-
"file-option": "awsui_file-
|
|
12
|
-
"file-option-thumbnail": "awsui_file-option-
|
|
13
|
-
"file-option-thumbnail-image": "awsui_file-option-thumbnail-
|
|
14
|
-
"file-option-metadata": "awsui_file-option-
|
|
15
|
-
"with-image": "awsui_with-
|
|
16
|
-
"single-row-loading": "awsui_single-row-
|
|
17
|
-
"token": "
|
|
18
|
-
"token-grid": "awsui_token-
|
|
19
|
-
"token-contains-image": "awsui_token-contains-
|
|
20
|
-
"token-box": "awsui_token-
|
|
21
|
-
"horizontal": "
|
|
22
|
-
"error": "
|
|
23
|
-
"dismiss-button": "awsui_dismiss-
|
|
24
|
-
"warning": "
|
|
25
|
-
"read-only": "awsui_read-
|
|
26
|
-
"loading": "
|
|
5
|
+
"root": "awsui_root_39ths_10roo_205",
|
|
6
|
+
"file-loading-overlay": "awsui_file-loading-overlay_39ths_10roo_240",
|
|
7
|
+
"file-loading-overlay-single-row": "awsui_file-loading-overlay-single-row_39ths_10roo_245",
|
|
8
|
+
"file-option-name": "awsui_file-option-name_39ths_10roo_249",
|
|
9
|
+
"file-option-size": "awsui_file-option-size_39ths_10roo_250",
|
|
10
|
+
"file-option-last-modified": "awsui_file-option-last-modified_39ths_10roo_251",
|
|
11
|
+
"file-option": "awsui_file-option_39ths_10roo_249",
|
|
12
|
+
"file-option-thumbnail": "awsui_file-option-thumbnail_39ths_10roo_264",
|
|
13
|
+
"file-option-thumbnail-image": "awsui_file-option-thumbnail-image_39ths_10roo_268",
|
|
14
|
+
"file-option-metadata": "awsui_file-option-metadata_39ths_10roo_281",
|
|
15
|
+
"with-image": "awsui_with-image_39ths_10roo_284",
|
|
16
|
+
"single-row-loading": "awsui_single-row-loading_39ths_10roo_287",
|
|
17
|
+
"token": "awsui_token_39ths_10roo_291",
|
|
18
|
+
"token-grid": "awsui_token-grid_39ths_10roo_298",
|
|
19
|
+
"token-contains-image": "awsui_token-contains-image_39ths_10roo_307",
|
|
20
|
+
"token-box": "awsui_token-box_39ths_10roo_311",
|
|
21
|
+
"horizontal": "awsui_horizontal_39ths_10roo_330",
|
|
22
|
+
"error": "awsui_error_39ths_10roo_338",
|
|
23
|
+
"dismiss-button": "awsui_dismiss-button_39ths_10roo_342",
|
|
24
|
+
"warning": "awsui_warning_39ths_10roo_348",
|
|
25
|
+
"read-only": "awsui_read-only_39ths_10roo_358",
|
|
26
|
+
"loading": "awsui_loading_39ths_10roo_371"
|
|
27
27
|
};
|
|
28
28
|
|
|
@@ -77,7 +77,7 @@ export interface FileUploadProps extends BaseComponentProps, FormFieldCommonVali
|
|
|
77
77
|
* * `formatFileSize` (function): (Optional) A function that takes file size in bytes, and produces a formatted string.
|
|
78
78
|
* * `formatFileLastModified` (function): (Optional) A function that takes the files last modified date, and produces a formatted string.
|
|
79
79
|
*/
|
|
80
|
-
i18nStrings
|
|
80
|
+
i18nStrings?: FileUploadProps.I18nStrings;
|
|
81
81
|
}
|
|
82
82
|
export declare namespace FileUploadProps {
|
|
83
83
|
interface ChangeDetail {
|
|
@@ -89,11 +89,11 @@ export declare namespace FileUploadProps {
|
|
|
89
89
|
}
|
|
90
90
|
type FileTokenAlignment = 'vertical' | 'horizontal';
|
|
91
91
|
interface I18nStrings {
|
|
92
|
-
uploadButtonText
|
|
93
|
-
dropzoneText
|
|
94
|
-
removeFileAriaLabel
|
|
95
|
-
limitShowFewer
|
|
96
|
-
limitShowMore
|
|
92
|
+
uploadButtonText?: (multiple: boolean) => string;
|
|
93
|
+
dropzoneText?: (multiple: boolean) => string;
|
|
94
|
+
removeFileAriaLabel?: (fileIndex: number) => string;
|
|
95
|
+
limitShowFewer?: string;
|
|
96
|
+
limitShowMore?: string;
|
|
97
97
|
errorIconAriaLabel?: string;
|
|
98
98
|
warningIconAriaLabel?: string;
|
|
99
99
|
formatFileSize?: (sizeInBytes: number) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../src/file-upload/interfaces.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,qCAAqC,E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ACf;IAED,UAAiB,aAAa;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,IAAI,CAAC;KACZ;IAED,KAAY,kBAAkB,GAAG,UAAU,GAAG,YAAY,CAAC;IAE3D,UAAiB,WAAW;QAC1B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;QACjD,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;QAC7C,mBAAmB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;QACpD,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/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 { FormFieldCommonValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface FileUploadProps extends BaseComponentProps, FormFieldCommonValidationControlProps {\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 error message.\n */\n errorText?: React.ReactNode;\n /**\n * Text that displays as a validation warning message.\n */\n warningText?: 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 array of file warnings corresponding to the files in the `value`.\n */\n fileWarnings?: ReadonlyArray<null | string>;\n /**\n * Alignment of the file tokens. Defaults to \"vertical\".\n */\n fileTokenAlignment?: FileUploadProps.FileTokenAlignment;\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 * * `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
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../src/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 { FormFieldCommonValidationControlProps } from '../internal/context/form-field-context';\nimport { NonCancelableEventHandler } from '../internal/events';\n\nexport interface FileUploadProps extends BaseComponentProps, FormFieldCommonValidationControlProps {\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 error message.\n */\n errorText?: React.ReactNode;\n /**\n * Text that displays as a validation warning message.\n */\n warningText?: 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 array of file warnings corresponding to the files in the `value`.\n */\n fileWarnings?: ReadonlyArray<null | string>;\n /**\n * Alignment of the file tokens. Defaults to \"vertical\".\n */\n fileTokenAlignment?: FileUploadProps.FileTokenAlignment;\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 * * `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?: 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 type FileTokenAlignment = 'vertical' | 'horizontal';\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 warningIconAriaLabel?: 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAM9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAM9D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAWnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAMlF,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;;AAQ/C,wBAAoD"}
|
|
@@ -11,6 +11,7 @@ import { useFilesDragging } from '../file-dropzone/use-files-dragging';
|
|
|
11
11
|
import InternalFileInput from '../file-input/internal';
|
|
12
12
|
import InternalFileTokenGroup from '../file-token-group/internal';
|
|
13
13
|
import { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';
|
|
14
|
+
import { useInternalI18n } from '../i18n/context';
|
|
14
15
|
import { getBaseProps } from '../internal/base-component';
|
|
15
16
|
import { fireNonCancelableEvent } from '../internal/events';
|
|
16
17
|
import checkControlled from '../internal/hooks/check-controlled';
|
|
@@ -24,7 +25,7 @@ import tokenListStyles from '../internal/components/token-list/styles.css.js';
|
|
|
24
25
|
import styles from './styles.css.js';
|
|
25
26
|
export default React.forwardRef(InternalFileUpload);
|
|
26
27
|
function InternalFileUpload(_a, externalRef) {
|
|
27
|
-
var _b;
|
|
28
|
+
var _b, _c, _d;
|
|
28
29
|
var { accept, ariaRequired, multiple = false, onChange, value, tokenLimit, showFileSize, showFileLastModified, showFileThumbnail, i18nStrings, __internalRootRef = null, constraintText, errorText, warningText, fileErrors, fileWarnings, fileTokenAlignment = 'vertical' } = _a, restProps = __rest(_a, ["accept", "ariaRequired", "multiple", "onChange", "value", "tokenLimit", "showFileSize", "showFileLastModified", "showFileThumbnail", "i18nStrings", "__internalRootRef", "constraintText", "errorText", "warningText", "fileErrors", "fileWarnings", "fileTokenAlignment"]);
|
|
29
30
|
const [nextFocusIndex, setNextFocusIndex] = useState(null);
|
|
30
31
|
const tokenListRef = useListFocusController({
|
|
@@ -37,6 +38,7 @@ function InternalFileUpload(_a, externalRef) {
|
|
|
37
38
|
showMoreSelector: `.${tokenListStyles.toggle}`,
|
|
38
39
|
fallbackSelector: `.${fileInputStyles['file-input']}`,
|
|
39
40
|
});
|
|
41
|
+
const i18n = useInternalI18n('file-upload');
|
|
40
42
|
const baseProps = getBaseProps(restProps);
|
|
41
43
|
const metadata = { showFileSize, showFileLastModified, showFileThumbnail };
|
|
42
44
|
const errorId = useUniqueId('error-');
|
|
@@ -68,15 +70,23 @@ function InternalFileUpload(_a, externalRef) {
|
|
|
68
70
|
const invalid = restProps.invalid || formFieldContext.invalid || hasError;
|
|
69
71
|
return (React.createElement(InternalSpaceBetween, Object.assign({}, baseProps, { size: "xs", className: clsx(baseProps.className, styles.root), __internalRootRef: __internalRootRef, ref: tokenListRef }),
|
|
70
72
|
React.createElement(InternalBox, null,
|
|
71
|
-
areFilesDragging ? (React.createElement(InternalFileDropzone, { onChange: event => handleFilesChange(event.detail.value) }, i18nStrings.dropzoneText(multiple))) : (React.createElement(InternalFileInput, { ref: ref, accept: accept, ariaRequired: ariaRequired, multiple: multiple, onChange: event => handleFilesChange(event.detail.value), value: value, ariaLabelledby: restProps.ariaLabelledby, controlId: restProps.controlId, ariaDescribedby: ariaDescribedBy, invalid: invalid }, i18nStrings.uploadButtonText(multiple))),
|
|
73
|
+
areFilesDragging ? (React.createElement(InternalFileDropzone, { onChange: event => handleFilesChange(event.detail.value) }, i18n('i18nStrings.dropzoneText', (_c = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.dropzoneText) === null || _c === void 0 ? void 0 : _c.call(i18nStrings, multiple), format => format({ multiple: `${multiple}` })))) : (React.createElement(InternalFileInput, { ref: ref, accept: accept, ariaRequired: ariaRequired, multiple: multiple, onChange: event => handleFilesChange(event.detail.value), value: value, ariaLabelledby: restProps.ariaLabelledby, controlId: restProps.controlId, ariaDescribedby: ariaDescribedBy, invalid: invalid }, i18n('i18nStrings.uploadButtonText', (_d = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.uploadButtonText) === null || _d === void 0 ? void 0 : _d.call(i18nStrings, multiple), format => format({ multiple: `${multiple}` })))),
|
|
72
74
|
(constraintText || errorText || warningText) && (React.createElement("div", { className: styles.hints },
|
|
73
|
-
errorText && (React.createElement(FormFieldError, { id: errorId, errorIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel }, errorText)),
|
|
74
|
-
showWarning && (React.createElement(FormFieldWarning, { id: warningId, warningIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel }, warningText)),
|
|
75
|
+
errorText && (React.createElement(FormFieldError, { id: errorId, errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel) }, errorText)),
|
|
76
|
+
showWarning && (React.createElement(FormFieldWarning, { id: warningId, warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel) }, warningText)),
|
|
75
77
|
constraintText && (React.createElement(ConstraintText, { id: constraintTextId, hasValidationText: !!errorText || !!warningText }, constraintText))))),
|
|
76
78
|
value.length > 0 ? (React.createElement(InternalFileTokenGroup, { limit: tokenLimit, alignment: fileTokenAlignment, items: value.map((file, fileIndex) => ({
|
|
77
79
|
file,
|
|
78
80
|
errorText: fileErrors === null || fileErrors === void 0 ? void 0 : fileErrors[fileIndex],
|
|
79
81
|
warningText: fileWarnings === null || fileWarnings === void 0 ? void 0 : fileWarnings[fileIndex],
|
|
80
|
-
})), showFileLastModified: metadata.showFileLastModified, showFileSize: metadata.showFileSize, showFileThumbnail: metadata.showFileThumbnail, i18nStrings:
|
|
82
|
+
})), showFileLastModified: metadata.showFileLastModified, showFileSize: metadata.showFileSize, showFileThumbnail: metadata.showFileThumbnail, i18nStrings: {
|
|
83
|
+
removeFileAriaLabel: i18n('i18nStrings.removeFileAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel, format => fileIndex => format({ fileIndex: fileIndex + 1 })),
|
|
84
|
+
limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.limitShowFewer),
|
|
85
|
+
limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.limitShowMore),
|
|
86
|
+
formatFileSize: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatFileSize,
|
|
87
|
+
formatFileLastModified: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.formatFileLastModified,
|
|
88
|
+
errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel),
|
|
89
|
+
warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel),
|
|
90
|
+
}, onDismiss: event => onFileRemove(event.detail.fileIndex) })) : null));
|
|
81
91
|
}
|
|
82
92
|
//# sourceMappingURL=internal.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EA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C7E,SAAS,CACK,CAClB;gBACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IACrF,WAAW,CACK,CACpB;gBACA,cAAc,IAAI,CACjB,oBAAC,cAAc,IAAC,EAAE,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,WAAW,IAClF,cAAc,CACA,CAClB,CACG,CACP,CACW;QAEb,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAClB,oBAAC,sBAAsB,IACrB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,kBAAkB,EAC7B,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,CAAC;gBACrC,IAAI;gBACJ,SAAS,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,SAAS,CAAC;gBAClC,WAAW,EAAE,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAG,SAAS,CAAC;aACvC,CAAC,CAAC,EACH,oBAAoB,EAAE,QAAQ,CAAC,oBAAoB,EACnD,YAAY,EAAE,QAAQ,CAAC,YAAY,EACnC,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,EAC7C,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GACxD,CACH,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 clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport InternalFileDropzone from '../file-dropzone/internal';\nimport { useFilesDragging } from '../file-dropzone/use-files-dragging';\nimport InternalFileInput from '../file-input/internal';\nimport InternalFileTokenGroup from '../file-token-group/internal';\nimport { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { FileUploadProps } from './interfaces';\n\nimport fileInputStyles from '../file-input/styles.css.js';\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport styles from './styles.css.js';\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 warningText,\n fileErrors,\n fileWarnings,\n fileTokenAlignment = 'vertical',\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\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 fallbackSelector: `.${fileInputStyles['file-input']}`,\n });\n\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const warningId = useUniqueId('warning-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\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.slice(0, 1) : [...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 setNextFocusIndex(removeFileIndex);\n };\n\n const { areFilesDragging } = useFilesDragging();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n showWarning ? warningId : 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 ref={tokenListRef}\n >\n <InternalBox>\n {areFilesDragging ? (\n <InternalFileDropzone onChange={event => handleFilesChange(event.detail.value)}>\n {i18nStrings.dropzoneText(multiple)}\n </InternalFileDropzone>\n ) : (\n <InternalFileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={event => handleFilesChange(event.detail.value)}\n value={value}\n ariaLabelledby={restProps.ariaLabelledby}\n controlId={restProps.controlId}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18nStrings.uploadButtonText(multiple)}\n </InternalFileInput>\n )}\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\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 {constraintText && (\n <ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {value.length > 0 ? (\n <InternalFileTokenGroup\n limit={tokenLimit}\n alignment={fileTokenAlignment}\n items={value.map((file, fileIndex) => ({\n file,\n errorText: fileErrors?.[fileIndex],\n warningText: fileWarnings?.[fileIndex],\n }))}\n showFileLastModified={metadata.showFileLastModified}\n showFileSize={metadata.showFileSize}\n showFileThumbnail={metadata.showFileThumbnail}\n i18nStrings={i18nStrings}\n onDismiss={event => onFileRemove(event.detail.fileIndex)}\n />\n ) : null}\n </InternalSpaceBetween>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/file-upload/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;;AAEtC,OAAO,KAAK,EAAE,EAAgB,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,+CAA+C,CAAC;AAEzE,OAAO,WAAW,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,oBAAoB,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAA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AC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,SAAS,GAAG,CAAC,EAAE,CAAC,CAC5D;gBACD,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;gBAC5E,cAAc,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc;gBAC3C,sBAAsB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB;gBAC3D,kBAAkB,EAAE,IAAI,CAAC,gCAAgC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,CAAC;gBAC3F,oBAAoB,EAAE,IAAI,CAAC,kCAAkC,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,CAAC;aAClG,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,GACxD,CACH,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 clsx from 'clsx';\n\nimport { warnOnce } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal';\nimport { ButtonProps } from '../button/interfaces';\nimport { useFormFieldContext } from '../contexts/form-field';\nimport InternalFileDropzone from '../file-dropzone/internal';\nimport { useFilesDragging } from '../file-dropzone/use-files-dragging';\nimport InternalFileInput from '../file-input/internal';\nimport InternalFileTokenGroup from '../file-token-group/internal';\nimport { ConstraintText, FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { useInternalI18n } from '../i18n/context';\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport checkControlled from '../internal/hooks/check-controlled';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useListFocusController } from '../internal/hooks/use-list-focus-controller';\nimport { useMergeRefs } from '../internal/hooks/use-merge-refs';\nimport { useUniqueId } from '../internal/hooks/use-unique-id';\nimport { joinStrings } from '../internal/utils/strings';\nimport InternalSpaceBetween from '../space-between/internal';\nimport { FileUploadProps } from './interfaces';\n\nimport fileInputStyles from '../file-input/styles.css.js';\nimport tokenListStyles from '../internal/components/token-list/styles.css.js';\nimport styles from './styles.css.js';\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 warningText,\n fileErrors,\n fileWarnings,\n fileTokenAlignment = 'vertical',\n ...restProps\n }: InternalFileUploadProps,\n externalRef: ForwardedRef<ButtonProps.Ref>\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 fallbackSelector: `.${fileInputStyles['file-input']}`,\n });\n\n const i18n = useInternalI18n('file-upload');\n const baseProps = getBaseProps(restProps);\n const metadata = { showFileSize, showFileLastModified, showFileThumbnail };\n\n const errorId = useUniqueId('error-');\n const warningId = useUniqueId('warning-');\n const constraintTextId = useUniqueId('constraint-text-');\n\n const fileInputRef = useRef<ButtonProps.Ref>(null);\n const ref = useMergeRefs(fileInputRef, externalRef);\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.slice(0, 1) : [...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 setNextFocusIndex(removeFileIndex);\n };\n\n const { areFilesDragging } = useFilesDragging();\n\n const showWarning = warningText && !errorText;\n\n if (warningText && errorText) {\n warnOnce('FileUpload', 'Both `errorText` and `warningText` exist. `warningText` will not be shown.');\n }\n\n const formFieldContext = useFormFieldContext(restProps);\n const ariaDescribedBy = joinStrings(\n restProps.ariaDescribedby ?? formFieldContext.ariaDescribedby,\n errorText ? errorId : undefined,\n showWarning ? warningId : 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 ref={tokenListRef}\n >\n <InternalBox>\n {areFilesDragging ? (\n <InternalFileDropzone onChange={event => handleFilesChange(event.detail.value)}>\n {i18n('i18nStrings.dropzoneText', i18nStrings?.dropzoneText?.(multiple), format =>\n format({ multiple: `${multiple}` })\n )}\n </InternalFileDropzone>\n ) : (\n <InternalFileInput\n ref={ref}\n accept={accept}\n ariaRequired={ariaRequired}\n multiple={multiple}\n onChange={event => handleFilesChange(event.detail.value)}\n value={value}\n ariaLabelledby={restProps.ariaLabelledby}\n controlId={restProps.controlId}\n ariaDescribedby={ariaDescribedBy}\n invalid={invalid}\n >\n {i18n('i18nStrings.uploadButtonText', i18nStrings?.uploadButtonText?.(multiple), format =>\n format({ multiple: `${multiple}` })\n )}\n </InternalFileInput>\n )}\n\n {(constraintText || errorText || warningText) && (\n <div className={styles.hints}>\n {errorText && (\n <FormFieldError\n id={errorId}\n errorIconAriaLabel={i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel)}\n >\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning\n id={warningId}\n warningIconAriaLabel={i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel)}\n >\n {warningText}\n </FormFieldWarning>\n )}\n {constraintText && (\n <ConstraintText id={constraintTextId} hasValidationText={!!errorText || !!warningText}>\n {constraintText}\n </ConstraintText>\n )}\n </div>\n )}\n </InternalBox>\n\n {value.length > 0 ? (\n <InternalFileTokenGroup\n limit={tokenLimit}\n alignment={fileTokenAlignment}\n items={value.map((file, fileIndex) => ({\n file,\n errorText: fileErrors?.[fileIndex],\n warningText: fileWarnings?.[fileIndex],\n }))}\n showFileLastModified={metadata.showFileLastModified}\n showFileSize={metadata.showFileSize}\n showFileThumbnail={metadata.showFileThumbnail}\n i18nStrings={{\n removeFileAriaLabel: i18n(\n 'i18nStrings.removeFileAriaLabel',\n i18nStrings?.removeFileAriaLabel,\n format => fileIndex => format({ fileIndex: fileIndex + 1 })\n ),\n limitShowFewer: i18n('i18nStrings.limitShowFewer', i18nStrings?.limitShowFewer),\n limitShowMore: i18n('i18nStrings.limitShowMore', i18nStrings?.limitShowMore),\n formatFileSize: i18nStrings?.formatFileSize,\n formatFileLastModified: i18nStrings?.formatFileLastModified,\n errorIconAriaLabel: i18n('i18nStrings.errorIconAriaLabel', i18nStrings?.errorIconAriaLabel),\n warningIconAriaLabel: i18n('i18nStrings.warningIconAriaLabel', i18nStrings?.warningIconAriaLabel),\n }}\n onDismiss={event => onFileRemove(event.detail.fileIndex)}\n />\n ) : null}\n </InternalSpaceBetween>\n );\n}\n"]}
|