@cloudscape-design/components 3.0.1314 → 3.0.1315

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/file-token-group/file-token.d.ts.map +1 -1
  2. package/file-token-group/file-token.js +33 -27
  3. package/file-token-group/file-token.js.map +1 -1
  4. package/internal/base-component/styles.scoped.css +10 -1
  5. package/internal/breakpoints.d.ts +1 -1
  6. package/internal/breakpoints.d.ts.map +1 -1
  7. package/internal/breakpoints.js +25 -3
  8. package/internal/breakpoints.js.map +1 -1
  9. package/internal/environment.js +2 -2
  10. package/internal/environment.json +2 -2
  11. package/internal/generated/styles/tokens.d.ts +5 -0
  12. package/internal/generated/styles/tokens.js +5 -0
  13. package/internal/generated/theming/index.cjs +99 -0
  14. package/internal/generated/theming/index.cjs.d.ts +36 -0
  15. package/internal/generated/theming/index.d.ts +36 -0
  16. package/internal/generated/theming/index.js +99 -0
  17. package/internal/hooks/container-queries/use-container-breakpoints.d.ts.map +1 -1
  18. package/internal/hooks/container-queries/use-container-breakpoints.js +2 -1
  19. package/internal/hooks/container-queries/use-container-breakpoints.js.map +1 -1
  20. package/internal/manifest.json +1 -1
  21. package/link/internal.js +1 -1
  22. package/link/internal.js.map +1 -1
  23. package/link/styles.css.js +21 -21
  24. package/link/styles.scoped.css +118 -72
  25. package/link/styles.selectors.js +21 -21
  26. package/manifest.json +2 -2
  27. package/package.json +1 -1
  28. package/prompt-input/index.d.ts.map +1 -1
  29. package/prompt-input/index.js +3 -1
  30. package/prompt-input/index.js.map +1 -1
  31. package/side-navigation/implementation.d.ts +1 -0
  32. package/side-navigation/implementation.d.ts.map +1 -1
  33. package/side-navigation/implementation.js +4 -4
  34. package/side-navigation/implementation.js.map +1 -1
  35. package/side-navigation/index.d.ts +1 -0
  36. package/side-navigation/index.d.ts.map +1 -1
  37. package/side-navigation/index.js +5 -3
  38. package/side-navigation/index.js.map +1 -1
  39. package/side-navigation/interfaces.d.ts +20 -1
  40. package/side-navigation/interfaces.d.ts.map +1 -1
  41. package/side-navigation/interfaces.js.map +1 -1
  42. package/side-navigation/parts.d.ts +5 -2
  43. package/side-navigation/parts.d.ts.map +1 -1
  44. package/side-navigation/parts.js +147 -37
  45. package/side-navigation/parts.js.map +1 -1
  46. package/side-navigation/styles.css.js +46 -30
  47. package/side-navigation/styles.scoped.css +223 -74
  48. package/side-navigation/styles.selectors.js +46 -30
  49. package/side-navigation/test-classes/styles.css.js +2 -1
  50. package/side-navigation/test-classes/styles.scoped.css +5 -1
  51. package/side-navigation/test-classes/styles.selectors.js +2 -1
  52. package/test-utils/dom/top-navigation/index.d.ts +2 -1
  53. package/test-utils/dom/top-navigation/index.js +4 -0
  54. package/test-utils/dom/top-navigation/index.js.map +1 -1
  55. package/test-utils/selectors/top-navigation/index.d.ts +1 -0
  56. package/test-utils/selectors/top-navigation/index.js +4 -0
  57. package/test-utils/selectors/top-navigation/index.js.map +1 -1
  58. package/token/internal.d.ts +19 -1
  59. package/token/internal.d.ts.map +1 -1
  60. package/token/internal.js +20 -9
  61. package/token/internal.js.map +1 -1
  62. package/top-navigation/index.d.ts +1 -0
  63. package/top-navigation/index.d.ts.map +1 -1
  64. package/top-navigation/index.js +2 -2
  65. package/top-navigation/index.js.map +1 -1
  66. package/top-navigation/interfaces.d.ts +14 -1
  67. package/top-navigation/interfaces.d.ts.map +1 -1
  68. package/top-navigation/interfaces.js.map +1 -1
  69. package/top-navigation/internal.d.ts +3 -5
  70. package/top-navigation/internal.d.ts.map +1 -1
  71. package/top-navigation/internal.js +42 -21
  72. package/top-navigation/internal.js.map +1 -1
  73. package/top-navigation/test-classes/styles.css.js +6 -0
  74. package/top-navigation/test-classes/styles.scoped.css +7 -0
  75. package/top-navigation/test-classes/styles.selectors.js +7 -0
  76. package/top-navigation/use-top-navigation.d.ts +5 -0
  77. package/top-navigation/use-top-navigation.d.ts.map +1 -1
  78. package/top-navigation/use-top-navigation.js +12 -5
  79. package/top-navigation/use-top-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AAC;IACnB,WAAW,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC;IACzC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC;IACtC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iBAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,WAAW,EACX,SAAS,EACT,SAAS,EACT,WAAW,EACX,QAAQ,EACR,OAAO,EACP,SAAS,EACT,kBAAkB,EAClB,OAAO,EACP,KAAK,GACN,EAAE,cAAc,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 DismissButton from '../token/dismiss-button.js';
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("div", { className: clsx(styles['token-box'], {
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,q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CAAC,CAC3C,oBAAC,WAAW,IACV,QAAQ,EAAC,QAAQ,EACjB,KAAK,EAAE,qBAAqB,EAC5B,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,2BAA2B,CAAC,EAAE,cAAc,CAAC,2BAA2B,CAAC,CAAC,IAEhG,sBAAsB,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CACxC,CACf,CAAC,CAAC,CAAC,IAAI,CACa,CACnB,CACM;YACb,SAAS,IAAI,CAAC,QAAQ,IAAI,oBAAC,aAAa,IAAC,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,SAAS,GAAI,CACpG;QACL,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IAC7E,SAAS,CACK,CAClB;QACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IACrF,WAAW,CACK,CACpB;QACA,WAAW,IAAI,WAAW,IAAI,CAC7B,oBAAC,OAAO,IACN,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EACpC,OAAO,EAAE,oBAAC,WAAW,IAAC,UAAU,EAAC,QAAQ,IAAE,IAAI,CAAC,IAAI,CAAe,EACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACrC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal.js';\nimport { FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { BaseComponentProps } from '../internal/base-component/index.js';\nimport InternalSpaceBetween from '../space-between/internal.js';\nimport InternalSpinner from '../spinner/internal.js';\nimport DismissButton from '../token/dismiss-button.js';\nimport { TokenGroupProps } from '../token-group/interfaces.js';\nimport Tooltip from '../tooltip/internal.js';\nimport * as defaultFormatters from './default-formatters.js';\nimport { FileOptionThumbnail } from './thumbnail.js';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\nexport namespace FileTokenProps {\n export interface I18nStrings {\n removeFileAriaLabel?: (fileIndex: number, fileName: string) => string;\n errorIconAriaLabel?: string;\n warningIconAriaLabel?: string;\n formatFileSize?: (sizeInBytes: number) => string;\n formatFileLastModified?: (date: Date) => string;\n }\n}\n\ninterface FileTokenProps extends BaseComponentProps {\n file: File;\n onDismiss: () => void;\n showFileSize?: boolean;\n showFileLastModified?: boolean;\n showFileThumbnail?: boolean;\n errorText?: React.ReactNode;\n warningText?: React.ReactNode;\n loading?: boolean;\n readOnly?: boolean;\n i18nStrings?: FileTokenProps.I18nStrings;\n dismissLabel?: string;\n alignment?: TokenGroupProps.Alignment;\n groupContainsImage?: boolean;\n isImage: boolean;\n index: number;\n}\n\nfunction InternalFileToken({\n file,\n showFileLastModified,\n showFileSize,\n showFileThumbnail,\n i18nStrings,\n onDismiss,\n errorText,\n warningText,\n readOnly,\n loading,\n alignment,\n groupContainsImage,\n isImage,\n index,\n}: FileTokenProps) {\n const formatFileSize = i18nStrings?.formatFileSize ?? defaultFormatters.formatFileSize;\n const formatFileLastModified = i18nStrings?.formatFileLastModified ?? defaultFormatters.formatFileLastModified;\n\n const errorId = useUniqueId('error');\n const warningId = useUniqueId('warning');\n\n const showWarning = warningText && !errorText;\n const containerRef = useRef<HTMLDivElement>(null);\n const fileNameRef = useRef<HTMLSpanElement>(null);\n const fileNameContainerRef = useRef<HTMLDivElement>(null);\n const [showTooltip, setShowTooltip] = useState(false);\n const [isTruncated, setIsTruncated] = useState(false);\n\n const getDismissLabel = (fileIndex: number) => {\n return i18nStrings?.removeFileAriaLabel?.(fileIndex, file.name);\n };\n\n function isEllipsisActive() {\n const span = fileNameRef.current;\n const container = fileNameContainerRef.current;\n\n if (span && container) {\n return span.offsetWidth >= container.offsetWidth;\n }\n return false;\n }\n\n useResizeObserver(\n () => fileNameContainerRef.current,\n () => setIsTruncated(isEllipsisActive())\n );\n\n const fileIsSingleRow =\n !showFileLastModified && !showFileSize && (!groupContainsImage || (groupContainsImage && !showFileThumbnail));\n\n return (\n <div\n ref={containerRef}\n className={clsx(styles.token, {\n [styles['token-grid']]: alignment === 'horizontal',\n [styles['token-contains-image']]: groupContainsImage && showFileThumbnail,\n })}\n role=\"group\"\n aria-label={file.name}\n aria-describedby={errorText ? errorId : warningText ? warningId : undefined}\n aria-disabled={loading}\n data-index={index}\n >\n <div\n className={clsx(styles['token-box'], {\n [styles.loading]: loading,\n [styles.error]: errorText,\n [styles.warning]: showWarning,\n [styles.horizontal]: alignment === 'horizontal',\n [styles['read-only']]: readOnly,\n })}\n >\n {loading && (\n <div\n className={clsx(styles['file-loading-overlay'], {\n [styles['file-loading-overlay-single-row']]: loading && fileIsSingleRow,\n })}\n >\n <InternalSpinner variant=\"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,WAA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AS,CAAC,CAAC,CAAC,SAAS,EAC3C,YAAY,EAAE,eAAe,CAAC,KAAK,CAAC,EACpC,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;gBAC7C,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;gBACzB,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,SAAS;gBACzB,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,WAAW;gBAC7B,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,SAAS,KAAK,YAAY;gBAC/C,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,QAAQ;aAChC,CAAC,GACF;QACD,SAAS,IAAI,CACZ,oBAAC,cAAc,IAAC,EAAE,EAAE,OAAO,EAAE,kBAAkB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,kBAAkB,IAC7E,SAAS,CACK,CAClB;QACA,WAAW,IAAI,CACd,oBAAC,gBAAgB,IAAC,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,oBAAoB,IACrF,WAAW,CACK,CACpB;QACA,WAAW,IAAI,WAAW,IAAI,CAC7B,oBAAC,OAAO,IACN,QAAQ,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,OAAO,EACpC,OAAO,EAAE,oBAAC,WAAW,IAAC,UAAU,EAAC,QAAQ,IAAE,IAAI,CAAC,IAAI,CAAe,EACnE,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,GACrC,CACH,CACG,CACP,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef, useState } from 'react';\nimport clsx from 'clsx';\n\nimport { useResizeObserver, useUniqueId } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalBox from '../box/internal.js';\nimport { FormFieldError, FormFieldWarning } from '../form-field/internal';\nimport { BaseComponentProps } from '../internal/base-component/index.js';\nimport InternalSpaceBetween from '../space-between/internal.js';\nimport InternalSpinner from '../spinner/internal.js';\nimport 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,6 +295,7 @@
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
301
  --color-background-drawer-backdrop-ducxi3:var(--color-grey-opaque-70-p0svy7);
@@ -378,6 +379,7 @@
378
379
  --color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
379
380
  --color-text-button-primary-disabled-q79gms:var(--color-neutral-500-8van0b);
380
381
  --color-item-selected-72rnwy:var(--color-primary-600-1lcy1k);
382
+ --color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
381
383
  --color-border-calendar-grid-67r4w4:transparent;
382
384
  --color-border-calendar-grid-selected-focus-ring-jk1fb0:var(--color-neutral-100-gk3lvf);
383
385
  --color-border-cell-shaded-0ipazf:var(--color-neutral-300-08wi6k);
@@ -767,6 +769,7 @@
767
769
  --size-table-selection-horizontal-qqiajd:40px;
768
770
  --size-vertical-input-p1d7xx:32px;
769
771
  --size-vertical-panel-icon-offset-z959cw:15px;
772
+ --size-side-navigation-item-height-lokap3:28px;
770
773
  --space-alert-action-left-4s8zo5:var(--space-s-tvghoh);
771
774
  --space-alert-horizontal-ul364s:var(--space-flashbar-horizontal-l63501);
772
775
  --space-alert-message-right-mrjbnn:var(--space-xxs-hwfkai);
@@ -837,6 +840,8 @@
837
840
  --space-table-header-tools-full-page-bottom-9m47g6:4px;
838
841
  --space-table-horizontal-suurzj:var(--space-container-horizontal-nqrzyh);
839
842
  --space-tree-view-indentation-xh9kis:var(--space-xl-jfy3x4);
843
+ --space-side-navigation-item-gap-5vlwdw:0px;
844
+ --space-side-navigation-item-collapsed-gap-d9lti2:var(--space-xs-ymlm0b);
840
845
  --space-tile-gutter-bi2bdv:var(--space-xl-jfy3x4);
841
846
  --space-action-card-horizontal-default-su1e86:var(--space-card-horizontal-default-pihe12);
842
847
  --space-action-card-horizontal-embedded-pb8pj4:var(--space-card-horizontal-embedded-sasxhu);
@@ -1196,6 +1201,7 @@
1196
1201
  .awsui-compact-mode:not(#\9) {
1197
1202
  --size-vertical-input-p1d7xx:28px;
1198
1203
  --size-vertical-panel-icon-offset-z959cw:13px;
1204
+ --size-side-navigation-item-height-lokap3:24px;
1199
1205
  --space-field-vertical-vm99qz:3px;
1200
1206
  --space-button-icon-only-horizontal-i85hxi:var(--space-xxs-hwfkai);
1201
1207
  --space-card-horizontal-embedded-sasxhu:10px;
@@ -1510,6 +1516,7 @@
1510
1516
  --color-border-button-primary-default-45p8u2:var(--color-background-button-primary-default-vdt0fu);
1511
1517
  --color-border-button-primary-disabled-b5p1ji:var(--color-background-button-primary-disabled-sgo4zo);
1512
1518
  --color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
1519
+ --color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
1513
1520
  --color-border-code-editor-pane-item-hover-wvblek:var(--color-border-dropdown-item-hover-aqfuxq);
1514
1521
  --color-border-card-3n24fu:var(--color-border-divider-default-nr68jt);
1515
1522
  --color-border-card-highlighted-ygosod:var(--color-border-item-selected-wl5ttm);
@@ -1791,6 +1798,7 @@
1791
1798
  --color-border-button-primary-default-45p8u2:var(--color-background-button-primary-default-vdt0fu);
1792
1799
  --color-border-button-primary-disabled-b5p1ji:var(--color-background-button-primary-disabled-sgo4zo);
1793
1800
  --color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
1801
+ --color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
1794
1802
  --color-border-code-editor-pane-item-hover-wvblek:var(--color-border-dropdown-item-hover-aqfuxq);
1795
1803
  --color-border-card-3n24fu:var(--color-border-divider-default-nr68jt);
1796
1804
  --color-border-card-highlighted-ygosod:var(--color-border-item-selected-wl5ttm);
@@ -2236,6 +2244,7 @@
2236
2244
  --color-border-button-primary-default-45p8u2:var(--color-background-button-primary-default-vdt0fu);
2237
2245
  --color-border-button-primary-disabled-b5p1ji:var(--color-background-button-primary-disabled-sgo4zo);
2238
2246
  --color-border-button-primary-hover-rktx0f:var(--color-background-button-primary-hover-mo85i6);
2247
+ --color-text-side-navigation-item-active-w3c4dj:var(--color-text-accent-n1kmht);
2239
2248
  --color-border-code-editor-pane-item-hover-wvblek:var(--color-border-dropdown-item-hover-aqfuxq);
2240
2249
  --color-border-card-3n24fu:var(--color-border-divider-default-nr68jt);
2241
2250
  --color-border-card-highlighted-ygosod:var(--color-border-item-selected-wl5ttm);
@@ -2364,5 +2373,5 @@
2364
2373
  }
2365
2374
  }
2366
2375
  :root {
2367
- --awsui-version-info-528ed620: true;
2376
+ --awsui-version-info-d326da3c: true;
2368
2377
  }
@@ -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":"AAEA,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,GACnB,CAAC,CAAC,MAAM,CAAC,GAAG,SAAS,CAOvB;AAED,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEjE"}
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"}
@@ -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
- for (const [breakpoint, breakpointWidth] of BREAKPOINT_MAPPING) {
30
- if (width > breakpointWidth && (!breakpointFilter || breakpointFilter.indexOf(breakpoint) !== -1)) {
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":"AAIA,MAAM,kBAAkB,GAA2B;IACjD,CAAC,IAAI,EAAE,IAAI,CAAC;IACZ,CAAC,GAAG,EAAE,IAAI,CAAC;IACX,CAAC,GAAG,EAAE,IAAI,CAAC;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,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\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): T[number] | 'default' {\n for (const [breakpoint, breakpointWidth] of BREAKPOINT_MAPPING) {\n if (width > breakpointWidth && (!breakpointFilter || breakpointFilter.indexOf(breakpoint) !== -1)) {\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"]}
1
+ {"version":3,"file":"breakpoints.js","sourceR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9F,4FAA4F;IAC5F,MAAM,sBAAsB,GAAG,oBAAoB,EAAE,CAAC,KAAK,CAAC;IAE5D,MAAM,uBAAuB,GAC3B,kBAAkB,KAAK,SAAS,IAAI,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"]}
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (528ed620)";
3
- export var GIT_SHA = "528ed620";
2
+ export var PACKAGE_VERSION = "3.0.0 (d326da3c)";
3
+ export var GIT_SHA = "d326da3c";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "core";
6
6
  export var ALWAYS_VISUAL_REFRESH = true;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "PACKAGE_SOURCE": "components",
3
- "PACKAGE_VERSION": "3.0.0 (528ed620)",
4
- "GIT_SHA": "528ed620",
3
+ "PACKAGE_VERSION": "3.0.0 (d326da3c)",
4
+ "GIT_SHA": "d326da3c",
5
5
  "THEME": "open-source-visual-refresh",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": true,
@@ -336,6 +336,7 @@ 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;
341
342
  export const colorBackgroundDrawerBackdrop: string;
@@ -419,6 +420,7 @@ export const colorBorderButtonPrimaryDisabled: string;
419
420
  export const colorBorderButtonPrimaryHover: string;
420
421
  export const colorTextButtonPrimaryDisabled: string;
421
422
  export const colorItemSelected: string;
423
+ export const colorTextSideNavigationItemActive: string;
422
424
  export const colorBorderCalendarGrid: string;
423
425
  export const colorBorderCalendarGridSelectedFocusRing: string;
424
426
  export const colorBorderCellShaded: string;
@@ -819,6 +821,7 @@ export const sizeIconNormal: string;
819
821
  export const sizeTableSelectionHorizontal: string;
820
822
  export const sizeVerticalInput: string;
821
823
  export const sizeVerticalPanelIconOffset: string;
824
+ export const sizeSideNavigationItemHeight: string;
822
825
  export const spaceAlertActionLeft: string;
823
826
  export const spaceAlertHorizontal: string;
824
827
  export const spaceAlertMessageRight: string;
@@ -889,6 +892,8 @@ export const spaceTableHeaderToolsBottom: string;
889
892
  export const spaceTableHeaderToolsFullPageBottom: string;
890
893
  export const spaceTableHorizontal: string;
891
894
  export const spaceTreeViewIndentation: string;
895
+ export const spaceSideNavigationItemGap: string;
896
+ export const spaceSideNavigationItemCollapsedGap: string;
892
897
  export const spaceTileGutter: string;
893
898
  export const spaceActionCardHorizontalDefault: string;
894
899
  export const spaceActionCardHorizontalEmbedded: string;
@@ -336,6 +336,7 @@ 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)";
341
342
  export var colorBackgroundDrawerBackdrop = "var(--color-background-drawer-backdrop-ducxi3, rgba(35, 43, 55, 0.7))";
@@ -419,6 +420,7 @@ export var colorBorderButtonPrimaryDisabled = "var(--color-border-button-primary
419
420
  export var colorBorderButtonPrimaryHover = "var(--color-border-button-primary-hover-rktx0f, #002b66)";
420
421
  export var colorTextButtonPrimaryDisabled = "var(--color-text-button-primary-disabled-q79gms, #8c8c94)";
421
422
  export var colorItemSelected = "var(--color-item-selected-72rnwy, #006ce0)";
423
+ export var colorTextSideNavigationItemActive = "var(--color-text-side-navigation-item-active-w3c4dj, #006ce0)";
422
424
  export var colorBorderCalendarGrid = "var(--color-border-calendar-grid-67r4w4, transparent)";
423
425
  export var colorBorderCalendarGridSelectedFocusRing = "var(--color-border-calendar-grid-selected-focus-ring-jk1fb0, #f9f9fa)";
424
426
  export var colorBorderCellShaded = "var(--color-border-cell-shaded-0ipazf, #dedee3)";
@@ -819,6 +821,7 @@ export var sizeIconNormal = "var(--size-icon-normal-levt08, 16px)";
819
821
  export var sizeTableSelectionHorizontal = "var(--size-table-selection-horizontal-qqiajd, 40px)";
820
822
  export var sizeVerticalInput = "var(--size-vertical-input-p1d7xx, 32px)";
821
823
  export var sizeVerticalPanelIconOffset = "var(--size-vertical-panel-icon-offset-z959cw, 15px)";
824
+ export var sizeSideNavigationItemHeight = "var(--size-side-navigation-item-height-lokap3, 28px)";
822
825
  export var spaceAlertActionLeft = "var(--space-alert-action-left-4s8zo5, 12px)";
823
826
  export var spaceAlertHorizontal = "var(--space-alert-horizontal-ul364s, 16px)";
824
827
  export var spaceAlertMessageRight = "var(--space-alert-message-right-mrjbnn, 4px)";
@@ -889,6 +892,8 @@ export var spaceTableHeaderToolsBottom = "var(--space-table-header-tools-bottom-
889
892
  export var spaceTableHeaderToolsFullPageBottom = "var(--space-table-header-tools-full-page-bottom-9m47g6, 4px)";
890
893
  export var spaceTableHorizontal = "var(--space-table-horizontal-suurzj, 20px)";
891
894
  export var spaceTreeViewIndentation = "var(--space-tree-view-indentation-xh9kis, 24px)";
895
+ export var spaceSideNavigationItemGap = "var(--space-side-navigation-item-gap-5vlwdw, 0px)";
896
+ export var spaceSideNavigationItemCollapsedGap = "var(--space-side-navigation-item-collapsed-gap-d9lti2, 8px)";
892
897
  export var spaceTileGutter = "var(--space-tile-gutter-bi2bdv, 24px)";
893
898
  export var spaceActionCardHorizontalDefault = "var(--space-action-card-horizontal-default-su1e86, 20px)";
894
899
  export var spaceActionCardHorizontalEmbedded = "var(--space-action-card-horizontal-embedded-pb8pj4, 12px)";