@cloudscape-design/components 3.0.1314 → 3.0.1316
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/file-token-group/file-token.d.ts.map +1 -1
- package/file-token-group/file-token.js +33 -27
- package/file-token-group/file-token.js.map +1 -1
- package/internal/base-component/styles.scoped.css +22 -9
- package/internal/breakpoints.d.ts +1 -1
- package/internal/breakpoints.d.ts.map +1 -1
- package/internal/breakpoints.js +25 -3
- package/internal/breakpoints.js.map +1 -1
- package/internal/environment.js +2 -2
- package/internal/environment.json +2 -2
- package/internal/generated/styles/tokens.d.ts +6 -0
- package/internal/generated/styles/tokens.js +6 -0
- package/internal/generated/theming/index.cjs +153 -21
- package/internal/generated/theming/index.cjs.d.ts +45 -0
- package/internal/generated/theming/index.d.ts +45 -0
- package/internal/generated/theming/index.js +153 -21
- package/internal/hooks/container-queries/use-container-breakpoints.d.ts.map +1 -1
- package/internal/hooks/container-queries/use-container-breakpoints.js +2 -1
- package/internal/hooks/container-queries/use-container-breakpoints.js.map +1 -1
- package/internal/manifest.json +1 -1
- package/link/internal.js +1 -1
- package/link/internal.js.map +1 -1
- package/link/styles.css.js +21 -21
- package/link/styles.scoped.css +118 -72
- package/link/styles.selectors.js +21 -21
- package/manifest.json +2 -2
- package/package.json +1 -1
- package/prompt-input/index.d.ts.map +1 -1
- package/prompt-input/index.js +3 -1
- package/prompt-input/index.js.map +1 -1
- package/side-navigation/implementation.d.ts +1 -0
- package/side-navigation/implementation.d.ts.map +1 -1
- package/side-navigation/implementation.js +4 -4
- package/side-navigation/implementation.js.map +1 -1
- package/side-navigation/index.d.ts +1 -0
- package/side-navigation/index.d.ts.map +1 -1
- package/side-navigation/index.js +5 -3
- package/side-navigation/index.js.map +1 -1
- package/side-navigation/interfaces.d.ts +20 -1
- package/side-navigation/interfaces.d.ts.map +1 -1
- package/side-navigation/interfaces.js.map +1 -1
- package/side-navigation/parts.d.ts +5 -2
- package/side-navigation/parts.d.ts.map +1 -1
- package/side-navigation/parts.js +147 -37
- package/side-navigation/parts.js.map +1 -1
- package/side-navigation/styles.css.js +46 -30
- package/side-navigation/styles.scoped.css +223 -74
- package/side-navigation/styles.selectors.js +46 -30
- package/side-navigation/test-classes/styles.css.js +2 -1
- package/side-navigation/test-classes/styles.scoped.css +5 -1
- package/side-navigation/test-classes/styles.selectors.js +2 -1
- package/test-utils/dom/top-navigation/index.d.ts +2 -1
- package/test-utils/dom/top-navigation/index.js +4 -0
- package/test-utils/dom/top-navigation/index.js.map +1 -1
- package/test-utils/selectors/top-navigation/index.d.ts +1 -0
- package/test-utils/selectors/top-navigation/index.js +4 -0
- package/test-utils/selectors/top-navigation/index.js.map +1 -1
- package/token/internal.d.ts +19 -1
- package/token/internal.d.ts.map +1 -1
- package/token/internal.js +20 -9
- package/token/internal.js.map +1 -1
- package/top-navigation/index.d.ts +1 -0
- package/top-navigation/index.d.ts.map +1 -1
- package/top-navigation/index.js +2 -2
- package/top-navigation/index.js.map +1 -1
- package/top-navigation/interfaces.d.ts +14 -1
- package/top-navigation/interfaces.d.ts.map +1 -1
- package/top-navigation/interfaces.js.map +1 -1
- package/top-navigation/internal.d.ts +3 -5
- package/top-navigation/internal.d.ts.map +1 -1
- package/top-navigation/internal.js +42 -21
- package/top-navigation/internal.js.map +1 -1
- package/top-navigation/test-classes/styles.css.js +6 -0
- package/top-navigation/test-classes/styles.scoped.css +7 -0
- package/top-navigation/test-classes/styles.selectors.js +7 -0
- package/top-navigation/use-top-navigation.d.ts +5 -0
- package/top-navigation/use-top-navigation.d.ts.map +1 -1
- package/top-navigation/use-top-navigation.js +12 -5
- package/top-navigation/use-top-navigation.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-token.d.ts","sourceRoot":"","sources":["../../../src/file-token-group/file-token.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA2B,MAAM,OAAO,CAAC;AAOhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCA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,EAAE,MAAM,CAAC;CACf;AAED,iBAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,KAAK,GACN,EAAE,cAAc,eAuJhB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -7,7 +7,7 @@ import InternalBox from '../box/internal.js';
|
|
|
7
7
|
import { FormFieldError, FormFieldWarning } from '../form-field/internal';
|
|
8
8
|
import InternalSpaceBetween from '../space-between/internal.js';
|
|
9
9
|
import InternalSpinner from '../spinner/internal.js';
|
|
10
|
-
import
|
|
10
|
+
import InternalToken from '../token/internal.js';
|
|
11
11
|
import Tooltip from '../tooltip/internal.js';
|
|
12
12
|
import * as defaultFormatters from './default-formatters.js';
|
|
13
13
|
import { FileOptionThumbnail } from './thumbnail.js';
|
|
@@ -25,10 +25,7 @@ function InternalFileToken({ file, showFileLastModified, showFileSize, showFileT
|
|
|
25
25
|
const fileNameContainerRef = useRef(null);
|
|
26
26
|
const [showTooltip, setShowTooltip] = useState(false);
|
|
27
27
|
const [isTruncated, setIsTruncated] = useState(false);
|
|
28
|
-
const getDismissLabel = (fileIndex) => {
|
|
29
|
-
var _a;
|
|
30
|
-
return (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, fileIndex, file.name);
|
|
31
|
-
};
|
|
28
|
+
const getDismissLabel = (fileIndex) => { var _a; return (_a = i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.removeFileAriaLabel) === null || _a === void 0 ? void 0 : _a.call(i18nStrings, fileIndex, file.name); };
|
|
32
29
|
function isEllipsisActive() {
|
|
33
30
|
const span = fileNameRef.current;
|
|
34
31
|
const container = fileNameContainerRef.current;
|
|
@@ -39,36 +36,45 @@ function InternalFileToken({ file, showFileLastModified, showFileSize, showFileT
|
|
|
39
36
|
}
|
|
40
37
|
useResizeObserver(() => fileNameContainerRef.current, () => setIsTruncated(isEllipsisActive()));
|
|
41
38
|
const fileIsSingleRow = !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));
|
|
39
|
+
// The full body of the token. Rendered through InternalToken's customContent slot so this
|
|
40
|
+
// component owns the inner layout (thumbnail + metadata column + loading overlay), while
|
|
41
|
+
// InternalToken handles the token-box and the dismiss button.
|
|
42
|
+
const fileContent = (React.createElement(React.Fragment, null,
|
|
43
|
+
loading && (React.createElement("div", { className: clsx(styles['file-loading-overlay'], {
|
|
44
|
+
[styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,
|
|
45
|
+
}) },
|
|
46
|
+
React.createElement(InternalSpinner, { variant: "normal", size: "normal" }))),
|
|
47
|
+
React.createElement(InternalBox, { className: styles['file-option'] },
|
|
48
|
+
showFileThumbnail && isImage && React.createElement(FileOptionThumbnail, { file: file }),
|
|
49
|
+
React.createElement("div", { className: clsx(styles['file-option-metadata'], {
|
|
50
|
+
[styles['with-image']]: showFileThumbnail && isImage,
|
|
51
|
+
[styles['single-row-loading']]: loading && fileIsSingleRow,
|
|
52
|
+
}) },
|
|
53
|
+
React.createElement(InternalSpaceBetween, { direction: "vertical", size: "xxxs" },
|
|
54
|
+
React.createElement("div", { className: styles['file-name-container'], onMouseOver: () => setShowTooltip(true), onMouseOut: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), role: isTruncated ? 'button' : undefined, "aria-expanded": isTruncated ? showTooltip : undefined, tabIndex: isTruncated ? 0 : -1, ref: fileNameContainerRef },
|
|
55
|
+
React.createElement(InternalBox, { fontWeight: "normal", className: clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {
|
|
56
|
+
[testUtilStyles['ellipsis-active']]: isTruncated,
|
|
57
|
+
}) },
|
|
58
|
+
React.createElement("span", { ref: fileNameRef }, file.name))),
|
|
59
|
+
showFileSize && file.size ? (React.createElement(InternalBox, { fontSize: "body-s", color: 'text-body-secondary', className: clsx(styles['file-option-size'], testUtilStyles['file-option-size']) }, formatFileSize(file.size))) : null,
|
|
60
|
+
showFileLastModified && file.lastModified ? (React.createElement(InternalBox, { fontSize: "body-s", color: 'text-body-secondary', className: clsx(styles['file-option-last-modified'], testUtilStyles['file-option-last-modified']) }, formatFileLastModified(new Date(file.lastModified)))) : null)))));
|
|
42
61
|
return (React.createElement("div", { ref: containerRef, className: clsx(styles.token, {
|
|
43
62
|
[styles['token-grid']]: alignment === 'horizontal',
|
|
44
63
|
[styles['token-contains-image']]: groupContainsImage && showFileThumbnail,
|
|
45
|
-
}), role: "group", "aria-label": file.name, "aria-describedby": errorText ? errorId : warningText ? warningId : undefined, "aria-disabled": loading, "data-index": index },
|
|
46
|
-
React.createElement(
|
|
64
|
+
}), role: "group", "aria-label": file.name, "aria-describedby": errorText ? errorId : warningText ? warningId : undefined, "aria-disabled": loading || undefined, "data-index": index },
|
|
65
|
+
React.createElement(InternalToken
|
|
66
|
+
// The outer wrapper above is the accessibility group (role="group" + aria-label). The
|
|
67
|
+
// token itself is presentation-only so screen readers don't see two nested groups.
|
|
68
|
+
, {
|
|
69
|
+
// The outer wrapper above is the accessibility group (role="group" + aria-label). The
|
|
70
|
+
// token itself is presentation-only so screen readers don't see two nested groups.
|
|
71
|
+
role: "presentation", __customContent: fileContent, onDismiss: readOnly ? undefined : onDismiss, dismissLabel: getDismissLabel(index), __tokenBoxClassName: clsx(styles['token-box'], {
|
|
47
72
|
[styles.loading]: loading,
|
|
48
73
|
[styles.error]: errorText,
|
|
49
74
|
[styles.warning]: showWarning,
|
|
50
75
|
[styles.horizontal]: alignment === 'horizontal',
|
|
51
76
|
[styles['read-only']]: readOnly,
|
|
52
|
-
}) },
|
|
53
|
-
loading && (React.createElement("div", { className: clsx(styles['file-loading-overlay'], {
|
|
54
|
-
[styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,
|
|
55
|
-
}) },
|
|
56
|
-
React.createElement(InternalSpinner, { variant: "normal", size: "normal" }))),
|
|
57
|
-
React.createElement(InternalBox, { className: styles['file-option'] },
|
|
58
|
-
showFileThumbnail && isImage && React.createElement(FileOptionThumbnail, { file: file }),
|
|
59
|
-
React.createElement("div", { className: clsx(styles['file-option-metadata'], {
|
|
60
|
-
[styles['with-image']]: showFileThumbnail && isImage,
|
|
61
|
-
[styles['single-row-loading']]: loading && fileIsSingleRow,
|
|
62
|
-
}) },
|
|
63
|
-
React.createElement(InternalSpaceBetween, { direction: "vertical", size: "xxxs" },
|
|
64
|
-
React.createElement("div", { className: styles['file-name-container'], onMouseOver: () => setShowTooltip(true), onMouseOut: () => setShowTooltip(false), onFocus: () => setShowTooltip(true), onBlur: () => setShowTooltip(false), role: isTruncated ? 'button' : undefined, "aria-expanded": isTruncated ? showTooltip : undefined, tabIndex: isTruncated ? 0 : -1, ref: fileNameContainerRef },
|
|
65
|
-
React.createElement(InternalBox, { fontWeight: "normal", className: clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {
|
|
66
|
-
[testUtilStyles['ellipsis-active']]: isTruncated,
|
|
67
|
-
}) },
|
|
68
|
-
React.createElement("span", { ref: fileNameRef }, file.name))),
|
|
69
|
-
showFileSize && file.size ? (React.createElement(InternalBox, { fontSize: "body-s", color: 'text-body-secondary', className: clsx(styles['file-option-size'], testUtilStyles['file-option-size']) }, formatFileSize(file.size))) : null,
|
|
70
|
-
showFileLastModified && file.lastModified ? (React.createElement(InternalBox, { fontSize: "body-s", color: 'text-body-secondary', className: clsx(styles['file-option-last-modified'], testUtilStyles['file-option-last-modified']) }, formatFileLastModified(new Date(file.lastModified)))) : null))),
|
|
71
|
-
onDismiss && !readOnly && React.createElement(DismissButton, { dismissLabel: getDismissLabel(index), onDismiss: onDismiss })),
|
|
77
|
+
}) }),
|
|
72
78
|
errorText && (React.createElement(FormFieldError, { id: errorId, errorIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.errorIconAriaLabel }, errorText)),
|
|
73
79
|
showWarning && (React.createElement(FormFieldWarning, { id: warningId, warningIconAriaLabel: i18nStrings === null || i18nStrings === void 0 ? void 0 : i18nStrings.warningIconAriaLabel }, warningText)),
|
|
74
80
|
showTooltip && isTruncated && (React.createElement(Tooltip, { getTrack: () => containerRef.current, content: React.createElement(InternalBox, { fontWeight: "normal" }, file.name), onEscape: () => setShowTooltip(false) }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-token.js","sourceRoot":"","sources":["../../../src/file-token-group/file-token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,aAAa,MAAM,4BAA4B,CAAC;AAEvD,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AA8B1D,SAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,KAA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AO,EAAE,oBAAC,WAAW,IAAC,UAAU,EAAC,QAAQ,IAAE,IAAI,CAAC,IAAI,CAAe,EACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACrC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal.js';\nimport { FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { BaseComponentProps } from '../internal/base-component/index.js';\nimport InternalSpaceBetween from '../space-between/internal.js';\nimport InternalSpinner from '../spinner/internal.js';\nimport DismissButton from '../token/dismiss-button.js';\nimport { TokenGroupProps } from '../token-group/interfaces.js';\nimport Tooltip from '../tooltip/internal.js';\nimport * as defaultFormatters from './default-formatters.js';\nimport { FileOptionThumbnail } from './thumbnail.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport namespace FileTokenProps {\n export interface I18nStrings {\n removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n}\n\ninterface FileTokenProps extends BaseComponentProps {\n file: File;\n onDismiss: () => void;\n showFileSize?: boolean;\n showFileLastModified?: boolean;\n showFileThumbnail?: boolean;\n errorText?: React.ReactNode;\n warningText?: React.ReactNode;\n loading?: boolean;\n readOnly?: boolean;\n i18nStrings?: FileTokenProps.I18nStrings;\n dismissLabel?: string;\n alignment?: TokenGroupProps.Alignment;\n groupContainsImage?: boolean;\n isImage: boolean;\n index: number;\n}\n\nfunction InternalFileToken({\n file,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n errorText,\n warningText,\n readOnly,\n loading,\n alignment,\n groupContainsImage,\n isImage,\n index,\n}: FileTokenProps) {\n const formatFileSize = i18nStrings?.formatFileSize ?? defaultFormatters.formatFileSize;\n const formatFileLastModified = i18nStrings?.formatFileLastModified ?? defaultFormatters.formatFileLastModified;\n\n const errorId = useUniqueId('error');\n const warningId = useUniqueId('warning');\n\n const showWarning = warningText && !errorText;\n const containerRef = useRef<HTMLDivElement>(null);\n const fileNameRef = useRef<HTMLSpanElement>(null);\n const fileNameContainerRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [isTruncated, setIsTruncated] = useState(false);\n\n const getDismissLabel = (fileIndex: number) => {\n return i18nStrings?.removeFileAriaLabel?.(fileIndex, file.name);\n };\n\n function isEllipsisActive() {\n const span = fileNameRef.current;\n const container = fileNameContainerRef.current;\n\n if (span && container) {\n return span.offsetWidth >= container.offsetWidth;\n }\n return false;\n }\n\n useResizeObserver(\n () => fileNameContainerRef.current,\n () => setIsTruncated(isEllipsisActive())\n );\n\n const fileIsSingleRow =\n !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));\n\n return (\n <div\n ref={containerRef}\n className={clsx(styles.token, {\n [styles['token-grid']]: alignment === 'horizontal',\n [styles['token-contains-image']]: groupContainsImage && showFileThumbnail,\n })}\n role=\"group\"\n aria-label={file.name}\n aria-describedby={errorText ? errorId : warningText ? warningId : undefined}\n aria-disabled={loading}\n data-index={index}\n >\n <div\n className={clsx(styles['token-box'], {\n [styles.loading]: loading,\n [styles.error]: errorText,\n [styles.warning]: showWarning,\n [styles.horizontal]: alignment === 'horizontal',\n [styles['read-only']]: readOnly,\n })}\n >\n {loading && (\n <div\n className={clsx(styles['file-loading-overlay'], {\n [styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpinner variant=\"normal\" size=\"normal\" />\n </div>\n )}\n <InternalBox className={styles['file-option']}>\n {showFileThumbnail && isImage && <FileOptionThumbnail file={file} />}\n\n <div\n className={clsx(styles['file-option-metadata'], {\n [styles['with-image']]: showFileThumbnail && isImage,\n [styles['single-row-loading']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpaceBetween direction=\"vertical\" size=\"xxxs\">\n <div\n className={styles['file-name-container']}\n onMouseOver={() => setShowTooltip(true)}\n onMouseOut={() => setShowTooltip(false)}\n onFocus={() => setShowTooltip(true)}\n onBlur={() => setShowTooltip(false)}\n role={isTruncated ? 'button' : undefined}\n aria-expanded={isTruncated ? showTooltip : undefined}\n tabIndex={isTruncated ? 0 : -1}\n ref={fileNameContainerRef}\n >\n <InternalBox\n fontWeight=\"normal\"\n className={clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {\n [testUtilStyles['ellipsis-active']]: isTruncated,\n })}\n >\n <span ref={fileNameRef}>{file.name}</span>\n </InternalBox>\n </div>\n\n {showFileSize && file.size ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-size'], testUtilStyles['file-option-size'])}\n >\n {formatFileSize(file.size)}\n </InternalBox>\n ) : null}\n\n {showFileLastModified && file.lastModified ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-last-modified'], testUtilStyles['file-option-last-modified'])}\n >\n {formatFileLastModified(new Date(file.lastModified))}\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n </div>\n </InternalBox>\n {onDismiss && !readOnly && <DismissButton dismissLabel={getDismissLabel(index)} onDismiss={onDismiss} />}\n </div>\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={warningId} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {showTooltip && isTruncated && (\n <Tooltip\n getTrack={() => containerRef.current}\n content={<InternalBox fontWeight=\"normal\">{file.name}</InternalBox>}\n onEscape={() => setShowTooltip(false)}\n />\n )}\n </div>\n );\n}\n\nexport default InternalFileToken;\n"]}
|
|
1
|
+
{"version":3,"file":"file-token.js","sourceRoot":"","sources":["../../../src/file-token-group/file-token.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAE/F,OAAO,WAAW,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1E,OAAO,oBAAoB,MAAM,8BAA8B,CAAC;AAChE,OAAO,eAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AAEjD,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAC7C,OAAO,KAAK,iBAAiB,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AA8B1D,SAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,KAAK,GACU;;IACf,MAAM,cAAc,GAAG,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,mCAAI,iBAAiB,CAAC,cAAc,CAAC;IACvF,MAAM,sBAAsB,GAAG,MAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,sBAAsB,mCAAI,iBAAiB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C,OAAO,EAAE,oBAAC,WAAW,IAAC,UAAU,EAAC,QAAQ,IAAE,IAAI,CAAC,IAAI,CAAe,EACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACrC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal.js';\nimport { FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { BaseComponentProps } from '../internal/base-component/index.js';\nimport InternalSpaceBetween from '../space-between/internal.js';\nimport InternalSpinner from '../spinner/internal.js';\nimport InternalToken from '../token/internal.js';\nimport { TokenGroupProps } from '../token-group/interfaces.js';\nimport Tooltip from '../tooltip/internal.js';\nimport * as defaultFormatters from './default-formatters.js';\nimport { FileOptionThumbnail } from './thumbnail.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport namespace FileTokenProps {\n export interface I18nStrings {\n removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n}\n\ninterface FileTokenProps extends BaseComponentProps {\n file: File;\n onDismiss: () => void;\n showFileSize?: boolean;\n showFileLastModified?: boolean;\n showFileThumbnail?: boolean;\n errorText?: React.ReactNode;\n warningText?: React.ReactNode;\n loading?: boolean;\n readOnly?: boolean;\n i18nStrings?: FileTokenProps.I18nStrings;\n dismissLabel?: string;\n alignment?: TokenGroupProps.Alignment;\n groupContainsImage?: boolean;\n isImage: boolean;\n index: number;\n}\n\nfunction InternalFileToken({\n file,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n errorText,\n warningText,\n readOnly,\n loading,\n alignment,\n groupContainsImage,\n isImage,\n index,\n}: FileTokenProps) {\n const formatFileSize = i18nStrings?.formatFileSize ?? defaultFormatters.formatFileSize;\n const formatFileLastModified = i18nStrings?.formatFileLastModified ?? defaultFormatters.formatFileLastModified;\n\n const errorId = useUniqueId('error');\n const warningId = useUniqueId('warning');\n\n const showWarning = warningText && !errorText;\n const containerRef = useRef<HTMLDivElement>(null);\n const fileNameRef = useRef<HTMLSpanElement>(null);\n const fileNameContainerRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [isTruncated, setIsTruncated] = useState(false);\n\n const getDismissLabel = (fileIndex: number) => i18nStrings?.removeFileAriaLabel?.(fileIndex, file.name);\n\n function isEllipsisActive() {\n const span = fileNameRef.current;\n const container = fileNameContainerRef.current;\n\n if (span && container) {\n return span.offsetWidth >= container.offsetWidth;\n }\n return false;\n }\n\n useResizeObserver(\n () => fileNameContainerRef.current,\n () => setIsTruncated(isEllipsisActive())\n );\n\n const fileIsSingleRow =\n !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));\n\n // The full body of the token. Rendered through InternalToken's customContent slot so this\n // component owns the inner layout (thumbnail + metadata column + loading overlay), while\n // InternalToken handles the token-box and the dismiss button.\n const fileContent = (\n <>\n {loading && (\n <div\n className={clsx(styles['file-loading-overlay'], {\n [styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpinner variant=\"normal\" size=\"normal\" />\n </div>\n )}\n <InternalBox className={styles['file-option']}>\n {showFileThumbnail && isImage && <FileOptionThumbnail file={file} />}\n\n <div\n className={clsx(styles['file-option-metadata'], {\n [styles['with-image']]: showFileThumbnail && isImage,\n [styles['single-row-loading']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpaceBetween direction=\"vertical\" size=\"xxxs\">\n <div\n className={styles['file-name-container']}\n onMouseOver={() => setShowTooltip(true)}\n onMouseOut={() => setShowTooltip(false)}\n onFocus={() => setShowTooltip(true)}\n onBlur={() => setShowTooltip(false)}\n role={isTruncated ? 'button' : undefined}\n aria-expanded={isTruncated ? showTooltip : undefined}\n tabIndex={isTruncated ? 0 : -1}\n ref={fileNameContainerRef}\n >\n <InternalBox\n fontWeight=\"normal\"\n className={clsx(styles['file-option-name'], testUtilStyles['file-option-name'], {\n [testUtilStyles['ellipsis-active']]: isTruncated,\n })}\n >\n <span ref={fileNameRef}>{file.name}</span>\n </InternalBox>\n </div>\n\n {showFileSize && file.size ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-size'], testUtilStyles['file-option-size'])}\n >\n {formatFileSize(file.size)}\n </InternalBox>\n ) : null}\n\n {showFileLastModified && file.lastModified ? (\n <InternalBox\n fontSize=\"body-s\"\n color={'text-body-secondary'}\n className={clsx(styles['file-option-last-modified'], testUtilStyles['file-option-last-modified'])}\n >\n {formatFileLastModified(new Date(file.lastModified))}\n </InternalBox>\n ) : null}\n </InternalSpaceBetween>\n </div>\n </InternalBox>\n </>\n );\n\n return (\n <div\n ref={containerRef}\n className={clsx(styles.token, {\n [styles['token-grid']]: alignment === 'horizontal',\n [styles['token-contains-image']]: groupContainsImage && showFileThumbnail,\n })}\n role=\"group\"\n aria-label={file.name}\n aria-describedby={errorText ? errorId : warningText ? warningId : undefined}\n aria-disabled={loading || undefined}\n data-index={index}\n >\n <InternalToken\n // The outer wrapper above is the accessibility group (role=\"group\" + aria-label). The\n // token itself is presentation-only so screen readers don't see two nested groups.\n role=\"presentation\"\n __customContent={fileContent}\n onDismiss={readOnly ? undefined : onDismiss}\n dismissLabel={getDismissLabel(index)}\n __tokenBoxClassName={clsx(styles['token-box'], {\n [styles.loading]: loading,\n [styles.error]: errorText,\n [styles.warning]: showWarning,\n [styles.horizontal]: alignment === 'horizontal',\n [styles['read-only']]: readOnly,\n })}\n />\n {errorText && (\n <FormFieldError id={errorId} errorIconAriaLabel={i18nStrings?.errorIconAriaLabel}>\n {errorText}\n </FormFieldError>\n )}\n {showWarning && (\n <FormFieldWarning id={warningId} warningIconAriaLabel={i18nStrings?.warningIconAriaLabel}>\n {warningText}\n </FormFieldWarning>\n )}\n {showTooltip && isTruncated && (\n <Tooltip\n getTrack={() => containerRef.current}\n content={<InternalBox fontWeight=\"normal\">{file.name}</InternalBox>}\n onEscape={() => setShowTooltip(false)}\n />\n )}\n </div>\n );\n}\n\nexport default InternalFileToken;\n"]}
|
|
@@ -295,9 +295,11 @@
|
|
|
295
295
|
--color-background-input-default-ifz5bb:var(--color-white-p1zlvy);
|
|
296
296
|
--color-background-input-disabled-dihaja:var(--color-neutral-250-vs1is4);
|
|
297
297
|
--color-background-item-selected-9gppru:var(--color-primary-50-1y05xv);
|
|
298
|
+
--color-background-side-navigation-item-active-adfprg:transparent;
|
|
298
299
|
--color-background-layout-main-5ilwcb:var(--color-white-p1zlvy);
|
|
299
300
|
--color-background-drawer-5hs0eh:var(--color-background-layout-panel-content-xto15e);
|
|
300
|
-
--color-background-
|
|
301
|
+
--color-background-backdrop-33f45f:var(--color-grey-opaque-70-p0svy7);
|
|
302
|
+
--color-background-drawer-backdrop-ducxi3:var(--color-background-backdrop-33f45f);
|
|
301
303
|
--color-background-layout-mobile-panel-ed0ava:var(--color-neutral-950-lxybh8);
|
|
302
304
|
--color-background-layout-panel-jv6exs:var(--color-background-container-content-6u8rvp);
|
|
303
305
|
--color-background-layout-panel-content-xto15e:var(--color-background-container-content-6u8rvp);
|
|
@@ -309,7 +311,7 @@
|
|
|
309
311
|
--color-background-layout-toggle-selected-active-zcl8w3:var(--color-primary-600-1lcy1k);
|
|
310
312
|
--color-background-layout-toggle-selected-default-izfana:var(--color-primary-600-1lcy1k);
|
|
311
313
|
--color-background-layout-toggle-selected-hover-7953u1:var(--color-primary-700-n6k121);
|
|
312
|
-
--color-background-modal-overlay-d7uby0:var(--color-
|
|
314
|
+
--color-background-modal-overlay-d7uby0:var(--color-background-backdrop-33f45f);
|
|
313
315
|
--color-background-notification-blue-4vnob8:var(--color-info-600-un21zh);
|
|
314
316
|
--color-background-notification-green-2rkyvu:var(--color-success-600-g7hz2i);
|
|
315
317
|
--color-background-notification-grey-x3vul6:var(--color-neutral-650-miik4f);
|
|
@@ -378,6 +380,7 @@
|
|
|
378
380
|
--color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
|
|
379
381
|
--color-text-button-primary-disabled-q79gms:var(--color-neutral-500-8van0b);
|
|
380
382
|
--color-item-selected-72rnwy:var(--color-primary-600-1lcy1k);
|
|
383
|
+
--color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
|
|
381
384
|
--color-border-calendar-grid-67r4w4:transparent;
|
|
382
385
|
--color-border-calendar-grid-selected-focus-ring-jk1fb0:var(--color-neutral-100-gk3lvf);
|
|
383
386
|
--color-border-cell-shaded-0ipazf:var(--color-neutral-300-08wi6k);
|
|
@@ -767,6 +770,7 @@
|
|
|
767
770
|
--size-table-selection-horizontal-qqiajd:40px;
|
|
768
771
|
--size-vertical-input-p1d7xx:32px;
|
|
769
772
|
--size-vertical-panel-icon-offset-z959cw:15px;
|
|
773
|
+
--size-side-navigation-item-height-lokap3:28px;
|
|
770
774
|
--space-alert-action-left-4s8zo5:var(--space-s-tvghoh);
|
|
771
775
|
--space-alert-horizontal-ul364s:var(--space-flashbar-horizontal-l63501);
|
|
772
776
|
--space-alert-message-right-mrjbnn:var(--space-xxs-hwfkai);
|
|
@@ -837,6 +841,8 @@
|
|
|
837
841
|
--space-table-header-tools-full-page-bottom-9m47g6:4px;
|
|
838
842
|
--space-table-horizontal-suurzj:var(--space-container-horizontal-nqrzyh);
|
|
839
843
|
--space-tree-view-indentation-xh9kis:var(--space-xl-jfy3x4);
|
|
844
|
+
--space-side-navigation-item-gap-5vlwdw:0px;
|
|
845
|
+
--space-side-navigation-item-collapsed-gap-d9lti2:var(--space-xs-ymlm0b);
|
|
840
846
|
--space-tile-gutter-bi2bdv:var(--space-xl-jfy3x4);
|
|
841
847
|
--space-action-card-horizontal-default-su1e86:var(--space-card-horizontal-default-pihe12);
|
|
842
848
|
--space-action-card-horizontal-embedded-pb8pj4:var(--space-card-horizontal-embedded-sasxhu);
|
|
@@ -1196,6 +1202,7 @@
|
|
|
1196
1202
|
.awsui-compact-mode:not(#\9) {
|
|
1197
1203
|
--size-vertical-input-p1d7xx:28px;
|
|
1198
1204
|
--size-vertical-panel-icon-offset-z959cw:13px;
|
|
1205
|
+
--size-side-navigation-item-height-lokap3:24px;
|
|
1199
1206
|
--space-field-vertical-vm99qz:3px;
|
|
1200
1207
|
--space-button-icon-only-horizontal-i85hxi:var(--space-xxs-hwfkai);
|
|
1201
1208
|
--space-card-horizontal-embedded-sasxhu:10px;
|
|
@@ -1481,11 +1488,12 @@
|
|
|
1481
1488
|
--color-background-item-card-ww2wfv:var(--color-background-card-p5vrq0);
|
|
1482
1489
|
--color-background-dropdown-item-selected-f3v6te:var(--color-background-item-selected-9gppru);
|
|
1483
1490
|
--color-background-drawer-5hs0eh:var(--color-background-layout-panel-content-xto15e);
|
|
1484
|
-
--color-background-
|
|
1491
|
+
--color-background-backdrop-33f45f:var(--color-grey-opaque-70-p0svy7);
|
|
1492
|
+
--color-background-drawer-backdrop-ducxi3:var(--color-background-backdrop-33f45f);
|
|
1485
1493
|
--color-background-layout-panel-jv6exs:var(--color-background-container-content-6u8rvp);
|
|
1486
1494
|
--color-background-layout-panel-content-xto15e:var(--color-background-container-content-6u8rvp);
|
|
1487
1495
|
--color-background-layout-toolbar-y0cu80:var(--color-background-layout-panel-content-xto15e);
|
|
1488
|
-
--color-background-modal-overlay-d7uby0:var(--color-
|
|
1496
|
+
--color-background-modal-overlay-d7uby0:var(--color-background-backdrop-33f45f);
|
|
1489
1497
|
--color-background-segment-default-b0r494:var(--color-background-button-normal-default-7f99mv);
|
|
1490
1498
|
--color-background-segment-disabled-m2a5t7:var(--color-background-button-normal-disabled-hl039l);
|
|
1491
1499
|
--color-background-segment-hover-800sl4:var(--color-background-button-normal-hover-53op9s);
|
|
@@ -1510,6 +1518,7 @@
|
|
|
1510
1518
|
--color-border-button-primary-default-45p8u2:var(--color-background-button-primary-default-vdt0fu);
|
|
1511
1519
|
--color-border-button-primary-disabled-b5p1ji:var(--color-background-button-primary-disabled-sgo4zo);
|
|
1512
1520
|
--color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
|
|
1521
|
+
--color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
|
|
1513
1522
|
--color-border-code-editor-pane-item-hover-wvblek:var(--color-border-dropdown-item-hover-aqfuxq);
|
|
1514
1523
|
--color-border-card-3n24fu:var(--color-border-divider-default-nr68jt);
|
|
1515
1524
|
--color-border-card-highlighted-ygosod:var(--color-border-item-selected-wl5ttm);
|
|
@@ -1766,11 +1775,12 @@
|
|
|
1766
1775
|
--color-background-item-card-ww2wfv:var(--color-background-card-p5vrq0);
|
|
1767
1776
|
--color-background-dropdown-item-selected-f3v6te:var(--color-background-item-selected-9gppru);
|
|
1768
1777
|
--color-background-drawer-5hs0eh:var(--color-background-layout-panel-content-xto15e);
|
|
1769
|
-
--color-background-
|
|
1778
|
+
--color-background-backdrop-33f45f:var(--color-grey-opaque-70-p0svy7);
|
|
1779
|
+
--color-background-drawer-backdrop-ducxi3:var(--color-background-backdrop-33f45f);
|
|
1770
1780
|
--color-background-layout-panel-jv6exs:var(--color-background-container-content-6u8rvp);
|
|
1771
1781
|
--color-background-layout-panel-content-xto15e:var(--color-background-container-content-6u8rvp);
|
|
1772
1782
|
--color-background-layout-toolbar-y0cu80:var(--color-background-layout-panel-content-xto15e);
|
|
1773
|
-
--color-background-modal-overlay-d7uby0:var(--color-
|
|
1783
|
+
--color-background-modal-overlay-d7uby0:var(--color-background-backdrop-33f45f);
|
|
1774
1784
|
--color-background-segment-hover-800sl4:var(--color-background-button-normal-hover-53op9s);
|
|
1775
1785
|
--color-background-slider-range-default-3ljdu4:var(--color-background-slider-handle-default-lp5ntg);
|
|
1776
1786
|
--color-background-slider-range-active-vu3lky:var(--color-background-slider-handle-active-50ubqb);
|
|
@@ -1791,6 +1801,7 @@
|
|
|
1791
1801
|
--color-border-button-primary-default-45p8u2:var(--color-background-button-primary-default-vdt0fu);
|
|
1792
1802
|
--color-border-button-primary-disabled-b5p1ji:var(--color-background-button-primary-disabled-sgo4zo);
|
|
1793
1803
|
--color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
|
|
1804
|
+
--color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
|
|
1794
1805
|
--color-border-code-editor-pane-item-hover-wvblek:var(--color-border-dropdown-item-hover-aqfuxq);
|
|
1795
1806
|
--color-border-card-3n24fu:var(--color-border-divider-default-nr68jt);
|
|
1796
1807
|
--color-border-card-highlighted-ygosod:var(--color-border-item-selected-wl5ttm);
|
|
@@ -2207,11 +2218,12 @@
|
|
|
2207
2218
|
--color-background-item-card-ww2wfv:var(--color-background-card-p5vrq0);
|
|
2208
2219
|
--color-background-dropdown-item-selected-f3v6te:var(--color-background-item-selected-9gppru);
|
|
2209
2220
|
--color-background-drawer-5hs0eh:var(--color-background-layout-panel-content-xto15e);
|
|
2210
|
-
--color-background-
|
|
2221
|
+
--color-background-backdrop-33f45f:var(--color-grey-opaque-70-p0svy7);
|
|
2222
|
+
--color-background-drawer-backdrop-ducxi3:var(--color-background-backdrop-33f45f);
|
|
2211
2223
|
--color-background-layout-panel-jv6exs:var(--color-background-container-content-6u8rvp);
|
|
2212
2224
|
--color-background-layout-panel-content-xto15e:var(--color-background-container-content-6u8rvp);
|
|
2213
2225
|
--color-background-layout-toolbar-y0cu80:var(--color-background-layout-panel-content-xto15e);
|
|
2214
|
-
--color-background-modal-overlay-d7uby0:var(--color-
|
|
2226
|
+
--color-background-modal-overlay-d7uby0:var(--color-background-backdrop-33f45f);
|
|
2215
2227
|
--color-background-segment-default-b0r494:var(--color-background-button-normal-default-7f99mv);
|
|
2216
2228
|
--color-background-segment-disabled-m2a5t7:var(--color-background-button-normal-disabled-hl039l);
|
|
2217
2229
|
--color-background-segment-hover-800sl4:var(--color-background-button-normal-hover-53op9s);
|
|
@@ -2236,6 +2248,7 @@
|
|
|
2236
2248
|
--color-border-button-primary-default-45p8u2:var(--color-background-button-primary-default-vdt0fu);
|
|
2237
2249
|
--color-border-button-primary-disabled-b5p1ji:var(--color-background-button-primary-disabled-sgo4zo);
|
|
2238
2250
|
--color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
|
|
2251
|
+
--color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
|
|
2239
2252
|
--color-border-code-editor-pane-item-hover-wvblek:var(--color-border-dropdown-item-hover-aqfuxq);
|
|
2240
2253
|
--color-border-card-3n24fu:var(--color-border-divider-default-nr68jt);
|
|
2241
2254
|
--color-border-card-highlighted-ygosod:var(--color-border-item-selected-wl5ttm);
|
|
@@ -2364,5 +2377,5 @@
|
|
|
2364
2377
|
}
|
|
2365
2378
|
}
|
|
2366
2379
|
:root {
|
|
2367
|
-
--awsui-version-info-
|
|
2380
|
+
--awsui-version-info-b33ca59d: true;
|
|
2368
2381
|
}
|
|
@@ -7,5 +7,5 @@ export declare function matchBreakpointMapping<T>(subset: Partial<Record<Breakpo
|
|
|
7
7
|
/**
|
|
8
8
|
* Get the named breakpoint for a provided width, optionally filtering to a subset of breakpoints.
|
|
9
9
|
*/
|
|
10
|
-
export declare function getMatchingBreakpoint<T extends readonly Breakpoint[]>(width: number, breakpointFilter?: T): T[number] | 'default';
|
|
10
|
+
export declare function getMatchingBreakpoint<T extends readonly Breakpoint[]>(width: number, breakpointFilter?: T, previousBreakpoint?: Breakpoint | null): T[number] | 'default';
|
|
11
11
|
export declare function getBreakpointValue(breakpoint: Breakpoint): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../src/internal/breakpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"breakpoints.d.ts","sourceRoot":"","sources":["../../../src/internal/breakpoints.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;AAY3E,eAAO,MAAM,gBAAgB,QAAsD,CAAC;AAIpF;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,UAAU,GAAG,CAAC,GAAG,IAAI,CAS9G;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,SAAS,UAAU,EAAE,EACnE,KAAK,EAAE,MAAM,EACb,gBAAgB,CAAC,EAAE,CAAC,EACpB,kBAAkB,CAAC,EAAE,UAAU,GAAG,IAAI,GACrC,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CA6BvB;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEjE"}
|
package/internal/breakpoints.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
import { browserScrollbarSize } from './utils/browser-scrollbar-size';
|
|
1
4
|
const BREAKPOINT_MAPPING = [
|
|
2
5
|
['xl', 1840],
|
|
3
6
|
['l', 1320],
|
|
@@ -25,9 +28,28 @@ export function matchBreakpointMapping(subset, actual) {
|
|
|
25
28
|
/**
|
|
26
29
|
* Get the named breakpoint for a provided width, optionally filtering to a subset of breakpoints.
|
|
27
30
|
*/
|
|
28
|
-
export function getMatchingBreakpoint(width, breakpointFilter) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
export function getMatchingBreakpoint(width, breakpointFilter, previousBreakpoint) {
|
|
32
|
+
// When a JS-resolved breakpoint sits within a scrollbar-width of a boundary, switching the layout
|
|
33
|
+
// can grow/shrink the page enough to toggle the viewport scrollbar, which in turn changes the
|
|
34
|
+
// measured width and flips the breakpoint back — an infinite layout loop (see AWSUI-62065).
|
|
35
|
+
const breakpointSwitchOffset = browserScrollbarSize().width;
|
|
36
|
+
const previousBreakpointIndex = previousBreakpoint === undefined || previousBreakpoint === null
|
|
37
|
+
? -1
|
|
38
|
+
: BREAKPOINTS_DESCENDING.indexOf(previousBreakpoint);
|
|
39
|
+
for (let i = 0; i < BREAKPOINT_MAPPING.length; i++) {
|
|
40
|
+
const [breakpoint, breakpointWidth] = BREAKPOINT_MAPPING[i];
|
|
41
|
+
if (breakpointFilter && breakpointFilter.indexOf(breakpoint) === -1) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
// Based on breakpointSwitchOffset, we either shrink or grow the breakpoint value we match against
|
|
45
|
+
// depending on whether the previous breakpoint was above or below the matched one. This enables the
|
|
46
|
+
// "sticky" behavior that makes the user have to resize the element further into a breakpoint boundary
|
|
47
|
+
// to actually switch the breakpoint.
|
|
48
|
+
let stickyBreakpointWidth = breakpointWidth;
|
|
49
|
+
if (previousBreakpointIndex !== -1) {
|
|
50
|
+
stickyBreakpointWidth += previousBreakpointIndex <= i ? -breakpointSwitchOffset : breakpointSwitchOffset;
|
|
51
|
+
}
|
|
52
|
+
if (width > stickyBreakpointWidth) {
|
|
31
53
|
return breakpoint;
|
|
32
54
|
}
|
|
33
55
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breakpoints.js","sourceRoot":"","sources":["../../../src/internal/breakpoints.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"breakpoints.js","sourceRoot":"","sources":["../../../src/internal/breakpoints.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC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kBAAkB,KAAK,IAAI;QAC7D,CAAC,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,sBAAsB,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAEzD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,kBAAkB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACnD,MAAM,CAAC,UAAU,EAAE,eAAe,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAAC;QAC5D,IAAI,gBAAgB,IAAI,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpE,SAAS;QACX,CAAC;QACD,kGAAkG;QAClG,oGAAoG;QACpG,sGAAsG;QACtG,qCAAqC;QACrC,IAAI,qBAAqB,GAAG,eAAe,CAAC;QAC5C,IAAI,uBAAuB,KAAK,CAAC,CAAC,EAAE,CAAC;YACnC,qBAAqB,IAAI,uBAAuB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,sBAAsB,CAAC;QAC3G,CAAC;QACD,IAAI,KAAK,GAAG,qBAAqB,EAAE,CAAC;YAClC,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAsB;IACvD,OAAO,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,UAAU,CAAE,CAAC,CAAC,CAAC,CAAC;AACjE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { browserScrollbarSize } from './utils/browser-scrollbar-size';\n\nexport type Breakpoint = 'default' | 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';\n\nconst BREAKPOINT_MAPPING: [Breakpoint, number][] = [\n ['xl', 1840],\n ['l', 1320],\n ['m', 1120],\n ['s', 912],\n ['xs', 688],\n ['xxs', 465],\n ['default', -1],\n];\n\nexport const mobileBreakpoint = BREAKPOINT_MAPPING.filter(b => b[0] === 'xs')[0][1];\n\nconst BREAKPOINTS_DESCENDING = BREAKPOINT_MAPPING.map(([bp]) => bp);\n\n/**\n * Take a breakpoint mapping and return the breakpoint value that most closely matches the actual breakpoint.\n */\nexport function matchBreakpointMapping<T>(subset: Partial<Record<Breakpoint, T>>, actual: Breakpoint): T | null {\n const qualifyingBreakpoints = BREAKPOINT_MAPPING.slice(BREAKPOINTS_DESCENDING.indexOf(actual));\n for (const [breakpoint] of qualifyingBreakpoints) {\n const breakpointValue = subset[breakpoint];\n if (breakpointValue !== undefined) {\n return breakpointValue;\n }\n }\n return null;\n}\n\n/**\n * Get the named breakpoint for a provided width, optionally filtering to a subset of breakpoints.\n */\nexport function getMatchingBreakpoint<T extends readonly Breakpoint[]>(\n width: number,\n breakpointFilter?: T,\n previousBreakpoint?: Breakpoint | null\n): T[number] | 'default' {\n // When a JS-resolved breakpoint sits within a scrollbar-width of a boundary, switching the layout\n // can grow/shrink the page enough to toggle the viewport scrollbar, which in turn changes the\n // measured width and flips the breakpoint back — an infinite layout loop (see AWSUI-62065).\n const breakpointSwitchOffset = browserScrollbarSize().width;\n\n const previousBreakpointIndex =\n previousBreakpoint === undefined || previousBreakpoint === null\n ? -1\n : BREAKPOINTS_DESCENDING.indexOf(previousBreakpoint);\n\n for (let i = 0; i < BREAKPOINT_MAPPING.length; i++) {\n const [breakpoint, breakpointWidth] = BREAKPOINT_MAPPING[i];\n if (breakpointFilter && breakpointFilter.indexOf(breakpoint) === -1) {\n continue;\n }\n // Based on breakpointSwitchOffset, we either shrink or grow the breakpoint value we match against\n // depending on whether the previous breakpoint was above or below the matched one. This enables the\n // \"sticky\" behavior that makes the user have to resize the element further into a breakpoint boundary\n // to actually switch the breakpoint.\n let stickyBreakpointWidth = breakpointWidth;\n if (previousBreakpointIndex !== -1) {\n stickyBreakpointWidth += previousBreakpointIndex <= i ? -breakpointSwitchOffset : breakpointSwitchOffset;\n }\n if (width > stickyBreakpointWidth) {\n return breakpoint;\n }\n }\n return 'default';\n}\n\nexport function getBreakpointValue(breakpoint: Breakpoint): number {\n return BREAKPOINT_MAPPING.find(bp => bp[0] === breakpoint)![1];\n}\n"]}
|
package/internal/environment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export var PACKAGE_SOURCE = "components";
|
|
2
|
-
export var PACKAGE_VERSION = "3.0.0 (
|
|
3
|
-
export var GIT_SHA = "
|
|
2
|
+
export var PACKAGE_VERSION = "3.0.0 (b33ca59d)";
|
|
3
|
+
export var GIT_SHA = "b33ca59d";
|
|
4
4
|
export var THEME = "open-source-visual-refresh";
|
|
5
5
|
export var SYSTEM = "core";
|
|
6
6
|
export var ALWAYS_VISUAL_REFRESH = true;
|
|
@@ -336,8 +336,10 @@ export const colorBackgroundInlineCode: string;
|
|
|
336
336
|
export const colorBackgroundInputDefault: string;
|
|
337
337
|
export const colorBackgroundInputDisabled: string;
|
|
338
338
|
export const colorBackgroundItemSelected: string;
|
|
339
|
+
export const colorBackgroundSideNavigationItemActive: string;
|
|
339
340
|
export const colorBackgroundLayoutMain: string;
|
|
340
341
|
export const colorBackgroundDrawer: string;
|
|
342
|
+
export const colorBackgroundBackdrop: string;
|
|
341
343
|
export const colorBackgroundDrawerBackdrop: string;
|
|
342
344
|
export const colorBackgroundLayoutMobilePanel: string;
|
|
343
345
|
export const colorBackgroundLayoutPanel: string;
|
|
@@ -419,6 +421,7 @@ export const colorBorderButtonPrimaryDisabled: string;
|
|
|
419
421
|
export const colorBorderButtonPrimaryHover: string;
|
|
420
422
|
export const colorTextButtonPrimaryDisabled: string;
|
|
421
423
|
export const colorItemSelected: string;
|
|
424
|
+
export const colorTextSideNavigationItemActive: string;
|
|
422
425
|
export const colorBorderCalendarGrid: string;
|
|
423
426
|
export const colorBorderCalendarGridSelectedFocusRing: string;
|
|
424
427
|
export const colorBorderCellShaded: string;
|
|
@@ -819,6 +822,7 @@ export const sizeIconNormal: string;
|
|
|
819
822
|
export const sizeTableSelectionHorizontal: string;
|
|
820
823
|
export const sizeVerticalInput: string;
|
|
821
824
|
export const sizeVerticalPanelIconOffset: string;
|
|
825
|
+
export const sizeSideNavigationItemHeight: string;
|
|
822
826
|
export const spaceAlertActionLeft: string;
|
|
823
827
|
export const spaceAlertHorizontal: string;
|
|
824
828
|
export const spaceAlertMessageRight: string;
|
|
@@ -889,6 +893,8 @@ export const spaceTableHeaderToolsBottom: string;
|
|
|
889
893
|
export const spaceTableHeaderToolsFullPageBottom: string;
|
|
890
894
|
export const spaceTableHorizontal: string;
|
|
891
895
|
export const spaceTreeViewIndentation: string;
|
|
896
|
+
export const spaceSideNavigationItemGap: string;
|
|
897
|
+
export const spaceSideNavigationItemCollapsedGap: string;
|
|
892
898
|
export const spaceTileGutter: string;
|
|
893
899
|
export const spaceActionCardHorizontalDefault: string;
|
|
894
900
|
export const spaceActionCardHorizontalEmbedded: string;
|
|
@@ -336,8 +336,10 @@ export var colorBackgroundInlineCode = "var(--color-background-inline-code-un8ud
|
|
|
336
336
|
export var colorBackgroundInputDefault = "var(--color-background-input-default-ifz5bb, #ffffff)";
|
|
337
337
|
export var colorBackgroundInputDisabled = "var(--color-background-input-disabled-dihaja, #ebebf0)";
|
|
338
338
|
export var colorBackgroundItemSelected = "var(--color-background-item-selected-9gppru, #f0fbff)";
|
|
339
|
+
export var colorBackgroundSideNavigationItemActive = "var(--color-background-side-navigation-item-active-adfprg, transparent)";
|
|
339
340
|
export var colorBackgroundLayoutMain = "var(--color-background-layout-main-5ilwcb, #ffffff)";
|
|
340
341
|
export var colorBackgroundDrawer = "var(--color-background-drawer-5hs0eh, #ffffff)";
|
|
342
|
+
export var colorBackgroundBackdrop = "var(--color-background-backdrop-33f45f, rgba(35, 43, 55, 0.7))";
|
|
341
343
|
export var colorBackgroundDrawerBackdrop = "var(--color-background-drawer-backdrop-ducxi3, rgba(35, 43, 55, 0.7))";
|
|
342
344
|
export var colorBackgroundLayoutMobilePanel = "var(--color-background-layout-mobile-panel-ed0ava, #0f141a)";
|
|
343
345
|
export var colorBackgroundLayoutPanel = "var(--color-background-layout-panel-jv6exs, #ffffff)";
|
|
@@ -419,6 +421,7 @@ export var colorBorderButtonPrimaryDisabled = "var(--color-border-button-primary
|
|
|
419
421
|
export var colorBorderButtonPrimaryHover = "var(--color-border-button-primary-hover-rktx0f, #002b66)";
|
|
420
422
|
export var colorTextButtonPrimaryDisabled = "var(--color-text-button-primary-disabled-q79gms, #8c8c94)";
|
|
421
423
|
export var colorItemSelected = "var(--color-item-selected-72rnwy, #006ce0)";
|
|
424
|
+
export var colorTextSideNavigationItemActive = "var(--color-text-side-navigation-item-active-w3c4dj, #006ce0)";
|
|
422
425
|
export var colorBorderCalendarGrid = "var(--color-border-calendar-grid-67r4w4, transparent)";
|
|
423
426
|
export var colorBorderCalendarGridSelectedFocusRing = "var(--color-border-calendar-grid-selected-focus-ring-jk1fb0, #f9f9fa)";
|
|
424
427
|
export var colorBorderCellShaded = "var(--color-border-cell-shaded-0ipazf, #dedee3)";
|
|
@@ -819,6 +822,7 @@ export var sizeIconNormal = "var(--size-icon-normal-levt08, 16px)";
|
|
|
819
822
|
export var sizeTableSelectionHorizontal = "var(--size-table-selection-horizontal-qqiajd, 40px)";
|
|
820
823
|
export var sizeVerticalInput = "var(--size-vertical-input-p1d7xx, 32px)";
|
|
821
824
|
export var sizeVerticalPanelIconOffset = "var(--size-vertical-panel-icon-offset-z959cw, 15px)";
|
|
825
|
+
export var sizeSideNavigationItemHeight = "var(--size-side-navigation-item-height-lokap3, 28px)";
|
|
822
826
|
export var spaceAlertActionLeft = "var(--space-alert-action-left-4s8zo5, 12px)";
|
|
823
827
|
export var spaceAlertHorizontal = "var(--space-alert-horizontal-ul364s, 16px)";
|
|
824
828
|
export var spaceAlertMessageRight = "var(--space-alert-message-right-mrjbnn, 4px)";
|
|
@@ -889,6 +893,8 @@ export var spaceTableHeaderToolsBottom = "var(--space-table-header-tools-bottom-
|
|
|
889
893
|
export var spaceTableHeaderToolsFullPageBottom = "var(--space-table-header-tools-full-page-bottom-9m47g6, 4px)";
|
|
890
894
|
export var spaceTableHorizontal = "var(--space-table-horizontal-suurzj, 20px)";
|
|
891
895
|
export var spaceTreeViewIndentation = "var(--space-tree-view-indentation-xh9kis, 24px)";
|
|
896
|
+
export var spaceSideNavigationItemGap = "var(--space-side-navigation-item-gap-5vlwdw, 0px)";
|
|
897
|
+
export var spaceSideNavigationItemCollapsedGap = "var(--space-side-navigation-item-collapsed-gap-d9lti2, 8px)";
|
|
892
898
|
export var spaceTileGutter = "var(--space-tile-gutter-bi2bdv, 24px)";
|
|
893
899
|
export var spaceActionCardHorizontalDefault = "var(--space-action-card-horizontal-default-su1e86, 20px)";
|
|
894
900
|
export var spaceActionCardHorizontalEmbedded = "var(--space-action-card-horizontal-embedded-pb8pj4, 12px)";
|