@cloudscape-design/components-themeable 3.0.1326 → 3.0.1327

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 (106) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/action-card/styles.scss +4 -2
  3. package/lib/internal/scss/box/styles.scss +1 -0
  4. package/lib/internal/scss/box/visual-accent.scss +117 -0
  5. package/lib/internal/scss/button-dropdown/styles.scss +6 -0
  6. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  7. package/lib/internal/template/action-card/interfaces.d.ts +40 -1
  8. package/lib/internal/template/action-card/interfaces.d.ts.map +1 -1
  9. package/lib/internal/template/action-card/interfaces.js.map +1 -1
  10. package/lib/internal/template/action-card/internal.d.ts.map +1 -1
  11. package/lib/internal/template/action-card/internal.js +32 -9
  12. package/lib/internal/template/action-card/internal.js.map +1 -1
  13. package/lib/internal/template/action-card/styles.css.js +17 -17
  14. package/lib/internal/template/action-card/styles.scoped.css +96 -92
  15. package/lib/internal/template/action-card/styles.selectors.js +17 -17
  16. package/lib/internal/template/box/interfaces.d.ts +59 -0
  17. package/lib/internal/template/box/interfaces.d.ts.map +1 -1
  18. package/lib/internal/template/box/interfaces.js.map +1 -1
  19. package/lib/internal/template/box/internal.d.ts +1 -1
  20. package/lib/internal/template/box/internal.d.ts.map +1 -1
  21. package/lib/internal/template/box/internal.js +4 -2
  22. package/lib/internal/template/box/internal.js.map +1 -1
  23. package/lib/internal/template/box/styles.css.js +224 -193
  24. package/lib/internal/template/box/styles.scoped.css +424 -238
  25. package/lib/internal/template/box/styles.selectors.js +224 -193
  26. package/lib/internal/template/button-dropdown/category-elements/category-element.d.ts +1 -1
  27. package/lib/internal/template/button-dropdown/category-elements/category-element.d.ts.map +1 -1
  28. package/lib/internal/template/button-dropdown/category-elements/category-element.js +3 -3
  29. package/lib/internal/template/button-dropdown/category-elements/category-element.js.map +1 -1
  30. package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.d.ts +1 -1
  31. package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.d.ts.map +1 -1
  32. package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js +22 -12
  33. package/lib/internal/template/button-dropdown/category-elements/expandable-category-element.js.map +1 -1
  34. package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.d.ts +1 -1
  35. package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.d.ts.map +1 -1
  36. package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.js +12 -10
  37. package/lib/internal/template/button-dropdown/category-elements/mobile-expandable-category-element.js.map +1 -1
  38. package/lib/internal/template/button-dropdown/filter.d.ts +8 -0
  39. package/lib/internal/template/button-dropdown/filter.d.ts.map +1 -0
  40. package/lib/internal/template/button-dropdown/filter.js +18 -0
  41. package/lib/internal/template/button-dropdown/filter.js.map +1 -0
  42. package/lib/internal/template/button-dropdown/index.d.ts.map +1 -1
  43. package/lib/internal/template/button-dropdown/index.js +3 -3
  44. package/lib/internal/template/button-dropdown/index.js.map +1 -1
  45. package/lib/internal/template/button-dropdown/interfaces.d.ts +41 -0
  46. package/lib/internal/template/button-dropdown/interfaces.d.ts.map +1 -1
  47. package/lib/internal/template/button-dropdown/interfaces.js.map +1 -1
  48. package/lib/internal/template/button-dropdown/internal-interfaces.d.ts +12 -0
  49. package/lib/internal/template/button-dropdown/internal-interfaces.d.ts.map +1 -1
  50. package/lib/internal/template/button-dropdown/internal-interfaces.js.map +1 -1
  51. package/lib/internal/template/button-dropdown/internal.d.ts.map +1 -1
  52. package/lib/internal/template/button-dropdown/internal.js +46 -7
  53. package/lib/internal/template/button-dropdown/internal.js.map +1 -1
  54. package/lib/internal/template/button-dropdown/item-element/index.d.ts +1 -1
  55. package/lib/internal/template/button-dropdown/item-element/index.d.ts.map +1 -1
  56. package/lib/internal/template/button-dropdown/item-element/index.js +35 -16
  57. package/lib/internal/template/button-dropdown/item-element/index.js.map +1 -1
  58. package/lib/internal/template/button-dropdown/items-list.d.ts +1 -1
  59. package/lib/internal/template/button-dropdown/items-list.d.ts.map +1 -1
  60. package/lib/internal/template/button-dropdown/items-list.js +4 -4
  61. package/lib/internal/template/button-dropdown/items-list.js.map +1 -1
  62. package/lib/internal/template/button-dropdown/styles.css.js +23 -22
  63. package/lib/internal/template/button-dropdown/styles.scoped.css +38 -32
  64. package/lib/internal/template/button-dropdown/styles.selectors.js +23 -22
  65. package/lib/internal/template/button-dropdown/tooltip.d.ts +2 -1
  66. package/lib/internal/template/button-dropdown/tooltip.d.ts.map +1 -1
  67. package/lib/internal/template/button-dropdown/tooltip.js +22 -14
  68. package/lib/internal/template/button-dropdown/tooltip.js.map +1 -1
  69. package/lib/internal/template/button-dropdown/utils/filter-items.d.ts +4 -0
  70. package/lib/internal/template/button-dropdown/utils/filter-items.d.ts.map +1 -0
  71. package/lib/internal/template/button-dropdown/utils/filter-items.js +55 -0
  72. package/lib/internal/template/button-dropdown/utils/filter-items.js.map +1 -0
  73. package/lib/internal/template/button-dropdown/utils/use-button-dropdown.d.ts +7 -1
  74. package/lib/internal/template/button-dropdown/utils/use-button-dropdown.d.ts.map +1 -1
  75. package/lib/internal/template/button-dropdown/utils/use-button-dropdown.js +77 -13
  76. package/lib/internal/template/button-dropdown/utils/use-button-dropdown.js.map +1 -1
  77. package/lib/internal/template/error-boundary/internal.d.ts.map +1 -1
  78. package/lib/internal/template/error-boundary/internal.js +1 -0
  79. package/lib/internal/template/error-boundary/internal.js.map +1 -1
  80. package/lib/internal/template/internal/base-component/index.js +3 -3
  81. package/lib/internal/template/internal/base-component/index.js.map +1 -1
  82. package/lib/internal/template/internal/base-component/styles.scoped.css +17 -1
  83. package/lib/internal/template/internal/environment.js +2 -2
  84. package/lib/internal/template/internal/environment.json +2 -2
  85. package/lib/internal/template/internal/generated/styles/tokens.d.ts +132 -0
  86. package/lib/internal/template/internal/generated/styles/tokens.js +132 -0
  87. package/lib/internal/template/internal/generated/theming/index.cjs +1884 -0
  88. package/lib/internal/template/internal/generated/theming/index.js +1884 -0
  89. package/lib/internal/template/item-card/internal.js +1 -1
  90. package/lib/internal/template/item-card/internal.js.map +1 -1
  91. package/lib/internal/template/multiselect/embedded.d.ts +2 -2
  92. package/lib/internal/template/multiselect/internal.d.ts +1 -1
  93. package/lib/internal/template/select/parts/filter.d.ts +1 -1
  94. package/lib/internal/template/table/index.d.ts.map +1 -1
  95. package/lib/internal/template/table/index.js +5 -3
  96. package/lib/internal/template/table/index.js.map +1 -1
  97. package/lib/internal/template/test-utils/dom/action-card/index.d.ts +4 -2
  98. package/lib/internal/template/test-utils/dom/action-card/index.js +5 -3
  99. package/lib/internal/template/test-utils/dom/action-card/index.js.map +1 -1
  100. package/lib/internal/template/test-utils/dom/button-dropdown/index.d.ts +16 -0
  101. package/lib/internal/template/test-utils/dom/button-dropdown/index.js +24 -0
  102. package/lib/internal/template/test-utils/dom/button-dropdown/index.js.map +1 -1
  103. package/lib/internal/template/test-utils/selectors/button-dropdown/index.d.ts +16 -0
  104. package/lib/internal/template/test-utils/selectors/button-dropdown/index.js +24 -0
  105. package/lib/internal/template/test-utils/selectors/button-dropdown/index.js.map +1 -1
  106. package/package.json +1 -1
@@ -1,23 +1,56 @@
1
+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ import { useEffect, useMemo, useRef, useState } from 'react';
1
4
  import { useOpenState } from '../../internal/components/options-list/utils/use-open-state';
2
5
  import { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';
3
6
  import { KeyCode } from '../../internal/keycode';
7
+ import { filterItems } from './filter-items';
4
8
  import useHighlightedMenu from './use-highlighted-menu';
5
9
  import { getItemTarget, isCheckboxItem, isItemGroup, isLinkItem } from './utils';
6
- export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFocus, hasExpandableGroups, isInRestrictedView = false, expandToViewport = false, }) {
10
+ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFocus, hasExpandableGroups, isInRestrictedView = false, expandToViewport = false, hasFiltering, }) {
11
+ const [filteringValue, setFilteringValue] = useState('');
12
+ const filteredItems = useMemo(() => (hasFiltering && filteringValue ? filterItems(items, filteringValue) : items), [hasFiltering, filteringValue, items]);
13
+ const showExpandableGroups = hasExpandableGroups && !filteringValue;
7
14
  const { targetItem, isHighlighted, isKeyboardHighlight, isExpanded, highlightItem, moveHighlight, expandGroup, collapseGroup, reset, setIsUsingMouse, } = useHighlightedMenu({
8
- items,
9
- hasExpandableGroups,
15
+ items: filteredItems,
16
+ hasExpandableGroups: showExpandableGroups,
10
17
  isInRestrictedView,
11
18
  });
12
- const { isOpen, closeDropdown, ...openStateProps } = useOpenState({ onClose: reset });
19
+ // If the filtering input changes, the options list also changes,
20
+ // so the highlight isn't valid anymore.
21
+ const prevFilteringValue = useRef(filteringValue);
22
+ useEffect(() => {
23
+ if (prevFilteringValue.current !== filteringValue) {
24
+ prevFilteringValue.current = filteringValue;
25
+ reset();
26
+ }
27
+ }, [filteringValue, reset]);
28
+ const { isOpen, closeDropdown: closeDropdownState, ...openStateProps } = useOpenState({ onClose: reset });
29
+ const closeDropdown = () => {
30
+ setFilteringValue('');
31
+ closeDropdownState();
32
+ };
13
33
  const toggleDropdown = (options = {}) => {
14
34
  var _a;
15
35
  const moveHighlightOnOpen = (_a = options.moveHighlightOnOpen) !== null && _a !== void 0 ? _a : true;
16
- if (!isOpen && moveHighlightOnOpen) {
36
+ if (!isOpen && moveHighlightOnOpen && !hasFiltering) {
17
37
  moveHighlight(1);
18
38
  }
39
+ if (isOpen) {
40
+ setFilteringValue('');
41
+ }
19
42
  openStateProps.toggleDropdown();
20
43
  };
44
+ const onDropdownFocusLeave = () => {
45
+ if (hasFiltering && isOpen) {
46
+ if (expandToViewport) {
47
+ // When expanded to viewport the focus can't move naturally to the next element.
48
+ // Returning the focus to the trigger instead.
49
+ onReturnFocus();
50
+ }
51
+ closeDropdown();
52
+ }
53
+ };
21
54
  const onGroupToggle = item => (!isExpanded(item) ? expandGroup(item) : collapseGroup());
22
55
  const onItemActivate = (item, event) => {
23
56
  const isCheckbox = isCheckboxItem(item);
@@ -76,7 +109,9 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
76
109
  case KeyCode.down: {
77
110
  if (!isOpen) {
78
111
  toggleDropdown();
79
- moveHighlight(1, true);
112
+ if (!hasFiltering) {
113
+ moveHighlight(1, true);
114
+ }
80
115
  }
81
116
  else {
82
117
  moveHighlight(1);
@@ -87,7 +122,9 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
87
122
  case KeyCode.up: {
88
123
  if (!isOpen) {
89
124
  toggleDropdown();
90
- moveHighlight(-1, true);
125
+ if (!hasFiltering) {
126
+ moveHighlight(-1, true);
127
+ }
91
128
  }
92
129
  else {
93
130
  moveHighlight(-1);
@@ -96,11 +133,20 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
96
133
  break;
97
134
  }
98
135
  case KeyCode.space: {
99
- // Prevent scrolling the list of items and highlighting the trigger
100
- event.preventDefault();
136
+ // Prevent scrolling the list of items and highlighting the trigger when filtering
137
+ // isn't active. Hitting space when filtering is active should just type a space
138
+ // character into the input, or activate the clear button.
139
+ if (!hasFiltering && !isOpen) {
140
+ event.preventDefault();
141
+ }
101
142
  break;
102
143
  }
103
144
  case KeyCode.enter: {
145
+ // While filtering, pressing Enter without a highlighted item should not select
146
+ // any item or close the dropdown.
147
+ if (isOpen && hasFiltering && !targetItem) {
148
+ break;
149
+ }
104
150
  if (!(targetItem === null || targetItem === void 0 ? void 0 : targetItem.disabled)) {
105
151
  activate(event, true);
106
152
  }
@@ -108,6 +154,11 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
108
154
  }
109
155
  case KeyCode.left:
110
156
  case KeyCode.right: {
157
+ // When filtering is enabled and there's text in the filter input, left/right
158
+ // arrow keys should move the caret between the characters.
159
+ if (hasFiltering && filteringValue) {
160
+ break;
161
+ }
111
162
  if (targetItem && !targetItem.disabled && isItemGroup(targetItem) && !isExpanded(targetItem)) {
112
163
  expandGroup();
113
164
  }
@@ -127,6 +178,13 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
127
178
  break;
128
179
  }
129
180
  case KeyCode.tab: {
181
+ // In filtering mode the dropdown contains multiple focusable elements (the filter
182
+ // input and its clear button). Tabbing between them must not close the dropdown, so
183
+ // closing on Tab is handled by onDropdownFocusLeave instead, which only fires once
184
+ // focus actually leaves the dropdown.
185
+ if (hasFiltering) {
186
+ break;
187
+ }
130
188
  // When expanded to viewport the focus can't move naturally to the next element.
131
189
  // Returning the focus to the trigger instead.
132
190
  if (expandToViewport) {
@@ -138,10 +196,11 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
138
196
  }
139
197
  };
140
198
  const onKeyUp = (event) => {
141
- // We need to handle activating items with Space separately because there is a bug
142
- // in Firefox where changing the focus during a Space keydown event it will trigger
143
- // unexpected click events on the new element: https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
144
- if (event.keyCode === KeyCode.space && !(targetItem === null || targetItem === void 0 ? void 0 : targetItem.disabled)) {
199
+ // When using a roving tabindex (filtering disabled), we need to handle activating items
200
+ // with Space separately because there is a bug in Firefox where changing the focus during
201
+ // a Space keydown event it will trigger unexpected click events on the new element.
202
+ // See https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
203
+ if (event.keyCode === KeyCode.space && !(targetItem === null || targetItem === void 0 ? void 0 : targetItem.disabled) && !hasFiltering) {
145
204
  activate(event);
146
205
  }
147
206
  };
@@ -156,9 +215,14 @@ export function useButtonDropdown({ items, onItemClick, onItemFollow, onReturnFo
156
215
  onKeyUp,
157
216
  onItemActivate,
158
217
  onGroupToggle,
218
+ onDropdownFocusLeave,
159
219
  toggleDropdown,
160
220
  closeDropdown,
161
221
  setIsUsingMouse,
222
+ filteringValue,
223
+ setFilteringValue,
224
+ filteredItems,
225
+ showExpandableGroups,
162
226
  };
163
227
  }
164
228
  //# sourceMappingURL=use-button-dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-button-dropdown.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/use-button-dropdown.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAqBjF,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GAAG,KAAK,EAC1B,gBAAgB,GAAG,KAAK,GACC;IACzB,MAAM,EACJ,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,UAAU,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,KAAK,EACL,eAAe,GAChB,GAAG,kBAAkB,CAAC;QACrB,KAAK;QACL,mBAAmB;QACnB,kBAAkB;KACnB,CAAC,CAAC;IAEH,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,cAAc,EAAE,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,MAAM,cAAc,GAAG,CAAC,UAA6C,EAAE,EAAE,EAAE;;QACzE,MAAM,mBAAmB,GAAG,MAAA,OAAO,CAAC,mBAAmB,mCAAI,IAAI,CAAC;QAChE,IAAI,CAAC,MAAM,IAAI,mBAAmB,EAAE,CAAC;YACnC,aAAa,CAAC,CAAC,CAAC,CAAC;QACnB,CAAC;QACD,cAAc,CAAC,cAAc,EAAE,CAAC;IAClC,CAAC,CAAC;IAEF,MAAM,aAAa,GAAgB,I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,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBACjB,gFAAgF;gBAChF,8CAA8C;gBAC9C,IAAI,gBAAgB,EAAE,CAAC;oBACrB,aAAa,EAAE,CAAC;gBAClB,CAAC;gBACD,aAAa,EAAE,CAAC;gBAChB,MAAM;YACR,CAAC;QACH,CAAC;IACH,CAAC,CAAC;IACF,MAAM,OAAO,GAAG,CAAC,KAA0B,EAAE,EAAE;QAC7C,kFAAkF;QAClF,mFAAmF;QACnF,mGAAmG;QACnG,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAA,EAAE,CAAC;YAC7D,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,UAAU;QACV,aAAa;QACb,mBAAmB;QACnB,UAAU;QACV,aAAa;QACb,SAAS;QACT,OAAO;QACP,cAAc;QACd,aAAa;QACb,cAAc;QACd,aAAa;QACb,eAAe;KAChB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\n\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { KeyCode } from '../../internal/keycode';\nimport { CancelableEventHandler } from '../../types/events';\nimport { ButtonDropdownProps, ButtonDropdownSettings, GroupToggle, HighlightProps, ItemActivate } from '../interfaces';\nimport useHighlightedMenu from './use-highlighted-menu';\nimport { getItemTarget, isCheckboxItem, isItemGroup, isLinkItem } from './utils';\n\ninterface UseButtonDropdownOptions extends ButtonDropdownSettings {\n items: ButtonDropdownProps.Items;\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n onReturnFocus: () => void;\n expandToViewport?: boolean;\n}\n\ninterface UseButtonDropdownApi extends HighlightProps {\n isOpen: boolean;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onKeyUp: (event: React.KeyboardEvent) => void;\n onItemActivate: ItemActivate;\n onGroupToggle: GroupToggle;\n toggleDropdown: (options?: { moveHighlightOnOpen?: boolean }) => void;\n closeDropdown: () => void;\n setIsUsingMouse: (isUsingMouse: boolean) => void;\n}\n\nexport function useButtonDropdown({\n items,\n onItemClick,\n onItemFollow,\n onReturnFocus,\n hasExpandableGroups,\n isInRestrictedView = false,\n expandToViewport = false,\n}: UseButtonDropdownOptions): UseButtonDropdownApi {\n const {\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n moveHighlight,\n expandGroup,\n collapseGroup,\n reset,\n setIsUsingMouse,\n } = useHighlightedMenu({\n items,\n hasExpandableGroups,\n isInRestrictedView,\n });\n\n const { isOpen, closeDropdown, ...openStateProps } = useOpenState({ onClose: reset });\n const toggleDropdown = (options: { moveHighlightOnOpen?: boolean } = {}) => {\n const moveHighlightOnOpen = options.moveHighlightOnOpen ?? true;\n if (!isOpen && moveHighlightOnOpen) {\n moveHighlight(1);\n }\n openStateProps.toggleDropdown();\n };\n\n const onGroupToggle: GroupToggle = item => (!isExpanded(item) ? expandGroup(item) : collapseGroup());\n\n const onItemActivate: ItemActivate = (item, event) => {\n const isCheckbox = isCheckboxItem(item);\n const isLink = isLinkItem(item);\n const details = {\n id: item.id || 'undefined',\n href: isLink ? item.href : undefined,\n external: isLink ? item.external : undefined,\n target: isLink ? getItemTarget(item) : undefined,\n checked: isCheckbox ? !item.checked : undefined,\n };\n onReturnFocus();\n if (onItemFollow && isLink && isPlainLeftClick(event)) {\n fireCancelableEvent(onItemFollow, details, event);\n }\n if (onItemClick) {\n fireCancelableEvent(onItemClick, details, event);\n }\n closeDropdown();\n };\n\n const openAndSelectFirst = (event: React.KeyboardEvent) => {\n toggleDropdown();\n event.preventDefault();\n };\n\n const actOnParentDropdown = (event: React.KeyboardEvent) => {\n // if there is no highlighted item we act on the trigger by opening or closing dropdown\n if (!targetItem) {\n if (isOpen && !isInRestrictedView) {\n toggleDropdown();\n } else {\n openAndSelectFirst(event);\n }\n } else {\n if (isItemGroup(targetItem)) {\n onGroupToggle(targetItem, event);\n } else {\n onItemActivate(targetItem, event);\n }\n }\n };\n\n const activate = (event: React.KeyboardEvent, isEnter?: boolean) => {\n setIsUsingMouse(false);\n\n // if item is a link we rely on default behavior of an anchor, no need to prevent\n if (targetItem && isLinkItem(targetItem) && isEnter) {\n return;\n }\n\n event.preventDefault();\n actOnParentDropdown(event);\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n setIsUsingMouse(false);\n switch (event.keyCode) {\n case KeyCode.down: {\n if (!isOpen) {\n toggleDropdown();\n moveHighlight(1, true);\n } else {\n moveHighlight(1);\n }\n event.preventDefault();\n break;\n }\n case KeyCode.up: {\n if (!isOpen) {\n toggleDropdown();\n moveHighlight(-1, true);\n } else {\n moveHighlight(-1);\n }\n event.preventDefault();\n break;\n }\n case KeyCode.space: {\n // Prevent scrolling the list of items and highlighting the trigger\n event.preventDefault();\n break;\n }\n case KeyCode.enter: {\n if (!targetItem?.disabled) {\n activate(event, true);\n }\n break;\n }\n case KeyCode.left:\n case KeyCode.right: {\n if (targetItem && !targetItem.disabled && isItemGroup(targetItem) && !isExpanded(targetItem)) {\n expandGroup();\n } else if (hasExpandableGroups) {\n collapseGroup();\n }\n\n event.preventDefault();\n break;\n }\n case KeyCode.escape: {\n onReturnFocus();\n closeDropdown();\n event.preventDefault();\n if (isOpen) {\n event.stopPropagation();\n }\n break;\n }\n case KeyCode.tab: {\n // When expanded to viewport the focus can't move naturally to the next element.\n // Returning the focus to the trigger instead.\n if (expandToViewport) {\n onReturnFocus();\n }\n closeDropdown();\n break;\n }\n }\n };\n const onKeyUp = (event: React.KeyboardEvent) => {\n // We need to handle activating items with Space separately because there is a bug\n // in Firefox where changing the focus during a Space keydown event it will trigger\n // unexpected click events on the new element: https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n if (event.keyCode === KeyCode.space && !targetItem?.disabled) {\n activate(event);\n }\n };\n\n return {\n isOpen,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n onKeyDown,\n onKeyUp,\n onItemActivate,\n onGroupToggle,\n toggleDropdown,\n closeDropdown,\n setIsUsingMouse,\n };\n}\n"]}
1
+ {"version":3,"file":"use-button-dropdown.js","sourceRoot":"","sources":["../../../../src/button-dropdown/utils/use-button-dropdown.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAc,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpE,OAAO,EAAE,YAAY,EAAE,MAAM,6DAA6D,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAGjD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AA2BjF,MAAM,UAAU,iBAAiB,CAAC,EAChC,KAAK,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GAAG,KAAK,EAC1B,gBAAgB,GAAG,KAAK,EACxB,YAAY,GACa;IACzB,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEzD,MAAM,aAAa,GAAG,OAAO,CAC3B,GAAG,EAAE,CAAC,CAAC,YAAY,IAAI,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC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,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,KAAK,IAAI,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,QAAQ,CAAA,IAAI,CAAC,YAAY,EAAE,CAAC;YAC9E,QAAQ,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO;QACL,MAAM;QACN,UAAU;QACV,aAAa;QACb,mBAAmB;QACnB,UAAU;QACV,aAAa;QACb,SAAS;QACT,OAAO;QACP,cAAc;QACd,aAAa;QACb,oBAAoB;QACpB,cAAc;QACd,aAAa;QACb,eAAe;QACf,cAAc;QACd,iBAAiB;QACjB,aAAa;QACb,oBAAoB;KACrB,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useEffect, useMemo, useRef, useState } from 'react';\n\nimport { useOpenState } from '../../internal/components/options-list/utils/use-open-state';\nimport { fireCancelableEvent, isPlainLeftClick } from '../../internal/events';\nimport { KeyCode } from '../../internal/keycode';\nimport { CancelableEventHandler } from '../../types/events';\nimport { ButtonDropdownProps, ButtonDropdownSettings, GroupToggle, HighlightProps, ItemActivate } from '../interfaces';\nimport { filterItems } from './filter-items';\nimport useHighlightedMenu from './use-highlighted-menu';\nimport { getItemTarget, isCheckboxItem, isItemGroup, isLinkItem } from './utils';\n\ninterface UseButtonDropdownOptions extends ButtonDropdownSettings {\n items: ButtonDropdownProps.Items;\n onItemClick?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n onItemFollow?: CancelableEventHandler<ButtonDropdownProps.ItemClickDetails>;\n onReturnFocus: () => void;\n expandToViewport?: boolean;\n hasFiltering: boolean;\n}\n\ninterface UseButtonDropdownApi extends HighlightProps {\n isOpen: boolean;\n onKeyDown: (event: React.KeyboardEvent) => void;\n onKeyUp: (event: React.KeyboardEvent) => void;\n onItemActivate: ItemActivate;\n onGroupToggle: GroupToggle;\n onDropdownFocusLeave: () => void;\n toggleDropdown: (options?: { moveHighlightOnOpen?: boolean }) => void;\n closeDropdown: () => void;\n setIsUsingMouse: (isUsingMouse: boolean) => void;\n filteringValue: string;\n setFilteringValue: (value: string) => void;\n filteredItems: ButtonDropdownProps.Items;\n showExpandableGroups: boolean;\n}\n\nexport function useButtonDropdown({\n items,\n onItemClick,\n onItemFollow,\n onReturnFocus,\n hasExpandableGroups,\n isInRestrictedView = false,\n expandToViewport = false,\n hasFiltering,\n}: UseButtonDropdownOptions): UseButtonDropdownApi {\n const [filteringValue, setFilteringValue] = useState('');\n\n const filteredItems = useMemo(\n () => (hasFiltering && filteringValue ? filterItems(items, filteringValue) : items),\n [hasFiltering, filteringValue, items]\n );\n\n const showExpandableGroups = hasExpandableGroups && !filteringValue;\n\n const {\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n moveHighlight,\n expandGroup,\n collapseGroup,\n reset,\n setIsUsingMouse,\n } = useHighlightedMenu({\n items: filteredItems,\n hasExpandableGroups: showExpandableGroups,\n isInRestrictedView,\n });\n\n // If the filtering input changes, the options list also changes,\n // so the highlight isn't valid anymore.\n const prevFilteringValue = useRef(filteringValue);\n useEffect(() => {\n if (prevFilteringValue.current !== filteringValue) {\n prevFilteringValue.current = filteringValue;\n reset();\n }\n }, [filteringValue, reset]);\n\n const { isOpen, closeDropdown: closeDropdownState, ...openStateProps } = useOpenState({ onClose: reset });\n\n const closeDropdown = () => {\n setFilteringValue('');\n closeDropdownState();\n };\n\n const toggleDropdown = (options: { moveHighlightOnOpen?: boolean } = {}) => {\n const moveHighlightOnOpen = options.moveHighlightOnOpen ?? true;\n if (!isOpen && moveHighlightOnOpen && !hasFiltering) {\n moveHighlight(1);\n }\n if (isOpen) {\n setFilteringValue('');\n }\n openStateProps.toggleDropdown();\n };\n\n const onDropdownFocusLeave = () => {\n if (hasFiltering && isOpen) {\n if (expandToViewport) {\n // When expanded to viewport the focus can't move naturally to the next element.\n // Returning the focus to the trigger instead.\n onReturnFocus();\n }\n closeDropdown();\n }\n };\n\n const onGroupToggle: GroupToggle = item => (!isExpanded(item) ? expandGroup(item) : collapseGroup());\n\n const onItemActivate: ItemActivate = (item, event) => {\n const isCheckbox = isCheckboxItem(item);\n const isLink = isLinkItem(item);\n const details = {\n id: item.id || 'undefined',\n href: isLink ? item.href : undefined,\n external: isLink ? item.external : undefined,\n target: isLink ? getItemTarget(item) : undefined,\n checked: isCheckbox ? !item.checked : undefined,\n };\n onReturnFocus();\n if (onItemFollow && isLink && isPlainLeftClick(event)) {\n fireCancelableEvent(onItemFollow, details, event);\n }\n if (onItemClick) {\n fireCancelableEvent(onItemClick, details, event);\n }\n closeDropdown();\n };\n\n const openAndSelectFirst = (event: React.KeyboardEvent) => {\n toggleDropdown();\n event.preventDefault();\n };\n\n const actOnParentDropdown = (event: React.KeyboardEvent) => {\n // if there is no highlighted item we act on the trigger by opening or closing dropdown\n if (!targetItem) {\n if (isOpen && !isInRestrictedView) {\n toggleDropdown();\n } else {\n openAndSelectFirst(event);\n }\n } else {\n if (isItemGroup(targetItem)) {\n onGroupToggle(targetItem, event);\n } else {\n onItemActivate(targetItem, event);\n }\n }\n };\n\n const activate = (event: React.KeyboardEvent, isEnter?: boolean) => {\n setIsUsingMouse(false);\n\n // if item is a link we rely on default behavior of an anchor, no need to prevent\n if (targetItem && isLinkItem(targetItem) && isEnter) {\n return;\n }\n\n event.preventDefault();\n actOnParentDropdown(event);\n };\n\n const onKeyDown = (event: React.KeyboardEvent) => {\n setIsUsingMouse(false);\n switch (event.keyCode) {\n case KeyCode.down: {\n if (!isOpen) {\n toggleDropdown();\n if (!hasFiltering) {\n moveHighlight(1, true);\n }\n } else {\n moveHighlight(1);\n }\n event.preventDefault();\n break;\n }\n case KeyCode.up: {\n if (!isOpen) {\n toggleDropdown();\n if (!hasFiltering) {\n moveHighlight(-1, true);\n }\n } else {\n moveHighlight(-1);\n }\n event.preventDefault();\n break;\n }\n case KeyCode.space: {\n // Prevent scrolling the list of items and highlighting the trigger when filtering\n // isn't active. Hitting space when filtering is active should just type a space\n // character into the input, or activate the clear button.\n if (!hasFiltering && !isOpen) {\n event.preventDefault();\n }\n break;\n }\n case KeyCode.enter: {\n // While filtering, pressing Enter without a highlighted item should not select\n // any item or close the dropdown.\n if (isOpen && hasFiltering && !targetItem) {\n break;\n }\n if (!targetItem?.disabled) {\n activate(event, true);\n }\n break;\n }\n case KeyCode.left:\n case KeyCode.right: {\n // When filtering is enabled and there's text in the filter input, left/right\n // arrow keys should move the caret between the characters.\n if (hasFiltering && filteringValue) {\n break;\n }\n if (targetItem && !targetItem.disabled && isItemGroup(targetItem) && !isExpanded(targetItem)) {\n expandGroup();\n } else if (hasExpandableGroups) {\n collapseGroup();\n }\n\n event.preventDefault();\n break;\n }\n case KeyCode.escape: {\n onReturnFocus();\n closeDropdown();\n event.preventDefault();\n if (isOpen) {\n event.stopPropagation();\n }\n break;\n }\n case KeyCode.tab: {\n // In filtering mode the dropdown contains multiple focusable elements (the filter\n // input and its clear button). Tabbing between them must not close the dropdown, so\n // closing on Tab is handled by onDropdownFocusLeave instead, which only fires once\n // focus actually leaves the dropdown.\n if (hasFiltering) {\n break;\n }\n // When expanded to viewport the focus can't move naturally to the next element.\n // Returning the focus to the trigger instead.\n if (expandToViewport) {\n onReturnFocus();\n }\n closeDropdown();\n break;\n }\n }\n };\n const onKeyUp = (event: React.KeyboardEvent) => {\n // When using a roving tabindex (filtering disabled), we need to handle activating items\n // with Space separately because there is a bug in Firefox where changing the focus during\n // a Space keydown event it will trigger unexpected click events on the new element.\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=1220143\n if (event.keyCode === KeyCode.space && !targetItem?.disabled && !hasFiltering) {\n activate(event);\n }\n };\n\n return {\n isOpen,\n targetItem,\n isHighlighted,\n isKeyboardHighlight,\n isExpanded,\n highlightItem,\n onKeyDown,\n onKeyUp,\n onItemActivate,\n onGroupToggle,\n onDropdownFocusLeave,\n toggleDropdown,\n closeDropdown,\n setIsUsingMouse,\n filteringValue,\n setFilteringValue,\n filteredItems,\n showExpandableGroups,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/internal.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKjH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,SAAS,CAAC,EAAE;YAAE,UAAU,CAAC,IAAI,IAAI,CAAC;YAAC,gBAAgB,CAAC,IAAI,IAAI,CAAA;SAAE,CAAC;KAChE;CACF;AAaD,UAAU,0BACR,SAAQ,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,cAAc,CAAC,EACzE,0BAA0B;CAAG;AAEjC,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,0BAA0B,eA8B5B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,cAAsB,EAAE,QAAQ,EAAE,EAAE,yBAAyB,eAa5G;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,OAAO,EACP,cAAsB,EACtB,QAAQ,EACR,cAA4B,EAC5B,aAAa,GACd,EAAE,kCAAkC,eAuBpC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/error-boundary/internal.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,kCAAkC,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAKjH,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,WAAW;QACnB,SAAS,CAAC,EAAE;YAAE,UAAU,CAAC,IAAI,IAAI,CAAC;YAAC,gBAAgB,CAAC,IAAI,IAAI,CAAA;SAAE,CAAC;KAChE;CACF;AAaD,UAAU,0BACR,SAAQ,YAAY,CAAC,kBAAkB,EAAE,gBAAgB,GAAG,cAAc,CAAC,EACzE,0BAA0B;CAAG;AAEjC,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,GAAG,KAAK,EACT,EAAE,0BAA0B,eA8B5B;AAED,wBAAgB,oBAAoB,CAAC,EAAE,OAAO,EAAE,cAAsB,EAAE,QAAQ,EAAE,EAAE,yBAAyB,eAa5G;AAED,wBAAgB,6BAA6B,CAAC,EAC5C,OAAO,EACP,cAAsB,EACtB,QAAQ,EACR,cAA4B,EAC5B,aAAa,GACd,EAAE,kCAAkC,eAwBpC"}
@@ -46,6 +46,7 @@ export function AppLayoutBuiltInErrorBoundary({ wrapper, suppressNested = false,
46
46
  errorMessage: (_c = (_b = error === null || error === void 0 ? void 0 : error.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : '',
47
47
  appLayoutPart: appLayoutPart !== null && appLayoutPart !== void 0 ? appLayoutPart : '',
48
48
  });
49
+ console.log(`[AwsUiAppLayoutError] appLayoutPart=${appLayoutPart !== null && appLayoutPart !== void 0 ? appLayoutPart : ''}`, error === null || error === void 0 ? void 0 : error.error);
49
50
  } },
50
51
  React.createElement(ErrorBoundariesContext.Provider, { value: { ...context, suppressed: nextSuppressed, renderFallback } }, children)));
51
52
  }
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/error-boundary/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EA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AI,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;YAClD,MAAM,QAAQ,GAAG,oBAAC,qBAAqB,OAAK,IAAI,CAAC,KAAK,GAAI,CAAC;YAC3D,OAAO,MAAA,MAAA,MAAA,IAAI,CAAC,KAAK,EAAC,OAAO,mDAAG,QAAQ,CAAC,mCAAI,QAAQ,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Component, createContext, useContext, useState } from 'react';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { metrics } from '../internal/metrics';\nimport { SomeRequired } from '../internal/types';\nimport { ErrorBoundaryFallback } from './fallback';\nimport { AppLayoutBuiltInErrorBoundaryProps, BuiltInErrorBoundaryProps, ErrorBoundaryProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\n// Helper methods attached to the component's root node for e2e testing.\ndeclare global {\n interface HTMLElement {\n __awsui__?: { forceError?(): void; clearForcedError?(): void };\n }\n}\n\nconst RootSuppressed = Symbol();\n\nconst ErrorBoundariesContext = createContext<\n Pick<ErrorBoundaryProps, 'renderFallback' | 'i18nStrings' | 'onError' | 'errorBoundaryId'> & {\n suppressed: boolean | typeof RootSuppressed;\n }\n>({\n onError: () => {},\n suppressed: RootSuppressed,\n});\n\ninterface InternalErrorBoundaryProps\n extends SomeRequired<ErrorBoundaryProps, 'suppressNested' | 'suppressible'>,\n InternalBaseComponentProps {}\n\nexport function InternalErrorBoundary({\n children,\n suppressNested,\n suppressible,\n __internalRootRef,\n ...props\n}: InternalErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true && suppressible;\n const nextSuppressed = suppressNested || thisSuppressed;\n\n const [forcedError, setForcedError] = useState(false);\n const setElement = (node: null | HTMLDivElement) => {\n if (node) {\n if (!node.__awsui__) {\n node.__awsui__ = {};\n }\n node.__awsui__.forceError = () => setForcedError(true);\n node.__awsui__.clearForcedError = () => setForcedError(false);\n }\n };\n const mergedRef = useMergeRefs(setElement, __internalRootRef);\n\n return (\n <div ref={mergedRef} className={styles['error-boundary']} data-awsui-boundary-id={props.errorBoundaryId}>\n {!thisSuppressed ? (\n <ErrorBoundaryImpl {...props} forcedError={forcedError}>\n <ErrorBoundariesContext.Provider value={{ ...props, suppressed: nextSuppressed }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n ) : (\n <>{children}</>\n )}\n </div>\n );\n}\n\nexport function BuiltInErrorBoundary({ wrapper, suppressNested = false, children }: BuiltInErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true || context.suppressed === RootSuppressed;\n const nextSuppressed = suppressNested || thisSuppressed;\n return !thisSuppressed ? (\n <ErrorBoundaryImpl {...context} wrapper={wrapper}>\n <ErrorBoundariesContext.Provider value={{ ...context, suppressed: nextSuppressed }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n ) : (\n <>{children}</>\n );\n}\n\nexport function AppLayoutBuiltInErrorBoundary({\n wrapper,\n suppressNested = false,\n children,\n renderFallback = () => <></>,\n appLayoutPart,\n}: AppLayoutBuiltInErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true || context.suppressed === RootSuppressed;\n const nextSuppressed = suppressNested || thisSuppressed;\n return (\n <ErrorBoundaryImpl\n {...context}\n wrapper={wrapper}\n renderFallback={renderFallback}\n className={styles['app-layout-part-fallback']}\n onError={error => {\n context?.onError?.(error);\n metrics.sendOpsMetricObject('awsui-app-layout-error-boundary-fired', {\n errorMessage: error?.error?.message ?? '',\n appLayoutPart: appLayoutPart ?? '',\n });\n }}\n >\n <ErrorBoundariesContext.Provider value={{ ...context, suppressed: nextSuppressed, renderFallback }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n );\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n}\n\ninterface ErrorBoundaryImplProps extends ErrorBoundaryProps {\n wrapper?: (content: React.ReactNode) => React.ReactNode;\n forcedError?: boolean;\n}\n\nclass ErrorBoundaryImpl extends Component<ErrorBoundaryImplProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryImplProps) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n this.props.onError?.({ error, errorInfo, errorBoundaryId: this.props.errorBoundaryId });\n }\n\n render() {\n if (this.state.hasError || this.props.forcedError) {\n const fallback = <ErrorBoundaryFallback {...this.props} />;\n return this.props.wrapper?.(fallback) ?? fallback;\n }\n return this.props.children;\n }\n}\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/error-boundary/internal.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAC;AAG7E,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAGnD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AASrC,MAAM,cAAc,GAAG,MAAM,EAAE,CAAC;AAEhC,MAAM,sBAAsB,GAAG,aAAa,CAI1C;IACA,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;IACjB,UAAU,EAAE,cAAc;CAC3B,CAAC,CAAC;AAMH,MAAM,UAAU,qBAAqB,CAAC,EACpC,QAAQ,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AAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { Component, createContext, useContext, useState } from 'react';\n\nimport { useMergeRefs } from '@cloudscape-design/component-toolkit/internal';\n\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { metrics } from '../internal/metrics';\nimport { SomeRequired } from '../internal/types';\nimport { ErrorBoundaryFallback } from './fallback';\nimport { AppLayoutBuiltInErrorBoundaryProps, BuiltInErrorBoundaryProps, ErrorBoundaryProps } from './interfaces';\n\nimport styles from './styles.css.js';\n\n// Helper methods attached to the component's root node for e2e testing.\ndeclare global {\n interface HTMLElement {\n __awsui__?: { forceError?(): void; clearForcedError?(): void };\n }\n}\n\nconst RootSuppressed = Symbol();\n\nconst ErrorBoundariesContext = createContext<\n Pick<ErrorBoundaryProps, 'renderFallback' | 'i18nStrings' | 'onError' | 'errorBoundaryId'> & {\n suppressed: boolean | typeof RootSuppressed;\n }\n>({\n onError: () => {},\n suppressed: RootSuppressed,\n});\n\ninterface InternalErrorBoundaryProps\n extends SomeRequired<ErrorBoundaryProps, 'suppressNested' | 'suppressible'>,\n InternalBaseComponentProps {}\n\nexport function InternalErrorBoundary({\n children,\n suppressNested,\n suppressible,\n __internalRootRef,\n ...props\n}: InternalErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true && suppressible;\n const nextSuppressed = suppressNested || thisSuppressed;\n\n const [forcedError, setForcedError] = useState(false);\n const setElement = (node: null | HTMLDivElement) => {\n if (node) {\n if (!node.__awsui__) {\n node.__awsui__ = {};\n }\n node.__awsui__.forceError = () => setForcedError(true);\n node.__awsui__.clearForcedError = () => setForcedError(false);\n }\n };\n const mergedRef = useMergeRefs(setElement, __internalRootRef);\n\n return (\n <div ref={mergedRef} className={styles['error-boundary']} data-awsui-boundary-id={props.errorBoundaryId}>\n {!thisSuppressed ? (\n <ErrorBoundaryImpl {...props} forcedError={forcedError}>\n <ErrorBoundariesContext.Provider value={{ ...props, suppressed: nextSuppressed }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n ) : (\n <>{children}</>\n )}\n </div>\n );\n}\n\nexport function BuiltInErrorBoundary({ wrapper, suppressNested = false, children }: BuiltInErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true || context.suppressed === RootSuppressed;\n const nextSuppressed = suppressNested || thisSuppressed;\n return !thisSuppressed ? (\n <ErrorBoundaryImpl {...context} wrapper={wrapper}>\n <ErrorBoundariesContext.Provider value={{ ...context, suppressed: nextSuppressed }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n ) : (\n <>{children}</>\n );\n}\n\nexport function AppLayoutBuiltInErrorBoundary({\n wrapper,\n suppressNested = false,\n children,\n renderFallback = () => <></>,\n appLayoutPart,\n}: AppLayoutBuiltInErrorBoundaryProps) {\n const context = useContext(ErrorBoundariesContext);\n const thisSuppressed = context.suppressed === true || context.suppressed === RootSuppressed;\n const nextSuppressed = suppressNested || thisSuppressed;\n return (\n <ErrorBoundaryImpl\n {...context}\n wrapper={wrapper}\n renderFallback={renderFallback}\n className={styles['app-layout-part-fallback']}\n onError={error => {\n context?.onError?.(error);\n metrics.sendOpsMetricObject('awsui-app-layout-error-boundary-fired', {\n errorMessage: error?.error?.message ?? '',\n appLayoutPart: appLayoutPart ?? '',\n });\n console.log(`[AwsUiAppLayoutError] appLayoutPart=${appLayoutPart ?? ''}`, error?.error);\n }}\n >\n <ErrorBoundariesContext.Provider value={{ ...context, suppressed: nextSuppressed, renderFallback }}>\n {children}\n </ErrorBoundariesContext.Provider>\n </ErrorBoundaryImpl>\n );\n}\n\ninterface ErrorBoundaryState {\n hasError: boolean;\n}\n\ninterface ErrorBoundaryImplProps extends ErrorBoundaryProps {\n wrapper?: (content: React.ReactNode) => React.ReactNode;\n forcedError?: boolean;\n}\n\nclass ErrorBoundaryImpl extends Component<ErrorBoundaryImplProps, ErrorBoundaryState> {\n constructor(props: ErrorBoundaryImplProps) {\n super(props);\n this.state = { hasError: false };\n }\n\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void {\n this.props.onError?.({ error, errorInfo, errorBoundaryId: this.props.errorBoundaryId });\n }\n\n render() {\n if (this.state.hasError || this.props.forcedError) {\n const fallback = <ErrorBoundaryFallback {...this.props} />;\n return this.props.wrapper?.(fallback) ?? fallback;\n }\n return this.props.children;\n }\n}\n"]}
@@ -7,11 +7,11 @@ import './styles.css.js';
7
7
  initAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);
8
8
  export function getBaseProps(props) {
9
9
  const baseProps = {};
10
- Object.keys(props).forEach(prop => {
11
- if (prop === 'id' || prop === 'className' || prop.match(/^data-/)) {
10
+ for (const prop in props) {
11
+ if (prop === 'id' || prop === 'className' || prop.startsWith('data-')) {
12
12
  baseProps[prop] = props[prop];
13
13
  }
14
- });
14
+ }
15
15
  return baseProps;
16
16
  }
17
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/base-component/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIlF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,gEAAgE;AAChE,OAAO,iBAAiB,CAAC;AAEzB,iBAAiB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAEnD,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,MAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAChC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAClE,SAAS,CAAC,IAAI,CAAC,GAAI,KAA6B,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,SAA+B,CAAC;AACzC,CAAC;AAOD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAS;IAET,OAAO,EAAE,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,EAAE,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,mBAAmB,EAAE,CAAC;AACxE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { initAwsUiVersions } from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../types/analytics';\nimport { BaseComponentProps } from '../../types/base-component';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from '../environment';\n\n// these styles needed to be imported for every public component\nimport './styles.css.js';\n\ninitAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nexport function getBaseProps(props: BaseComponentProps) {\n const baseProps: Record<string, any> = {};\n Object.keys(props).forEach(prop => {\n if (prop === 'id' || prop === 'className' || prop.match(/^data-/)) {\n baseProps[prop] = (props as Record<string, any>)[prop];\n }\n });\n return baseProps as BaseComponentProps;\n}\n\nexport interface BasePropsWithAnalyticsMetadata {\n analyticsMetadata?: AnalyticsMetadata;\n __analyticsMetadata?: AnalyticsMetadata;\n}\n\n/**\n * Helper function to merge beta analytics metadata with the public analytics metadata api.\n * Beta analytics metadata will override the public values to allow for safe migration.\n */\nexport function getAnalyticsMetadataProps<T extends BasePropsWithAnalyticsMetadata>(\n props?: T\n): NonNullable<T['analyticsMetadata'] & T['__analyticsMetadata']> {\n return { ...props?.analyticsMetadata, ...props?.__analyticsMetadata };\n}\n\n// Backward-compatibility re-export for consumers importing this public type from the internal path.\nexport { BaseComponentProps } from '../../types/base-component';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/internal/base-component/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAIlF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjE,gEAAgE;AAChE,OAAO,iBAAiB,CAAC;AAEzB,iBAAiB,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;AAEnD,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,MAAM,SAAS,GAAwB,EAAE,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KAAK,WAAW,IAAI,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACtE,SAAS,CAAC,IAAI,CAAC,GAAI,KAA6B,CAAC,IAAI,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,SAA+B,CAAC;AACzC,CAAC;AAOD;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CACvC,KAAS;IAET,OAAO,EAAE,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,EAAE,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,mBAAmB,EAAE,CAAC;AACxE,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { initAwsUiVersions } from '@cloudscape-design/component-toolkit/internal';\n\nimport { AnalyticsMetadata } from '../../types/analytics';\nimport { BaseComponentProps } from '../../types/base-component';\nimport { PACKAGE_SOURCE, PACKAGE_VERSION } from '../environment';\n\n// these styles needed to be imported for every public component\nimport './styles.css.js';\n\ninitAwsUiVersions(PACKAGE_SOURCE, PACKAGE_VERSION);\n\nexport function getBaseProps(props: BaseComponentProps) {\n const baseProps: Record<string, any> = {};\n for (const prop in props) {\n if (prop === 'id' || prop === 'className' || prop.startsWith('data-')) {\n baseProps[prop] = (props as Record<string, any>)[prop];\n }\n }\n return baseProps as BaseComponentProps;\n}\n\nexport interface BasePropsWithAnalyticsMetadata {\n analyticsMetadata?: AnalyticsMetadata;\n __analyticsMetadata?: AnalyticsMetadata;\n}\n\n/**\n * Helper function to merge beta analytics metadata with the public analytics metadata api.\n * Beta analytics metadata will override the public values to allow for safe migration.\n */\nexport function getAnalyticsMetadataProps<T extends BasePropsWithAnalyticsMetadata>(\n props?: T\n): NonNullable<T['analyticsMetadata'] & T['__analyticsMetadata']> {\n return { ...props?.analyticsMetadata, ...props?.__analyticsMetadata };\n}\n\n// Backward-compatibility re-export for consumers importing this public type from the internal path.\nexport { BaseComponentProps } from '../../types/base-component';\n"]}
@@ -18,6 +18,7 @@
18
18
  --color-primary-700-xkgxe3:#0a4a74;
19
19
  --color-primary-800-umo0y4:#003b8f;
20
20
  --color-primary-900-fp8i41:#002b66;
21
+ --color-primary-950-3iog37:#00204d;
21
22
  --color-primary-1000-gaqvjz:#12293b;
22
23
  --color-neutral-50-vcz3bf:#fcfcfd;
23
24
  --color-neutral-100-wbgy1o:#fafafa;
@@ -40,23 +41,38 @@
40
41
  --color-neutral-950-qehfms:#16191f;
41
42
  --color-neutral-1000-hyci1n:#06080a;
42
43
  --color-error-50-io178d:#fdf3f1;
44
+ --color-error-100-ku7qz3:#ffe0e0;
43
45
  --color-error-400-9vxaa6:#ff5d64;
44
46
  --color-error-600-l0qq56:#d13212;
47
+ --color-error-800-pnqs8l:#990000;
45
48
  --color-error-900-9a8dkh:#700000;
49
+ --color-error-950-rfwmbt:#520000;
46
50
  --color-error-1000-n60rq7:#270a11;
47
51
  --color-success-50-imllf9:#f2f8f0;
52
+ --color-success-100-6utfco:#d9ffd6;
53
+ --color-success-400-w8bcwp:#00e500;
48
54
  --color-success-500-ozgyf5:#6aaf35;
49
55
  --color-success-600-ma9qew:#1d8102;
56
+ --color-success-800-71dk4o:#005c26;
57
+ --color-success-950-wsrrh4:#003311;
50
58
  --color-success-1000-qm50d9:#172211;
51
59
  --color-warning-50-sgekuj:#fffef0;
60
+ --color-warning-100-z9f3fh:#fffbbd;
52
61
  --color-warning-400-fgqmlt:#ffe347;
53
62
  --color-warning-500-g16re6:#fbd332;
63
+ --color-warning-600-4m0ogn:#f2b100;
64
+ --color-warning-800-ak0eph:#9e6900;
54
65
  --color-warning-900-6pnziu:#906806;
66
+ --color-warning-950-zq8qyv:#573a00;
55
67
  --color-warning-1000-1ifqwp:#191100;
56
68
  --color-info-50-vuas2o:#f1faff;
69
+ --color-info-100-em93ir:#d1f1ff;
57
70
  --color-info-300-lmblcc:#44b9d6;
58
71
  --color-info-400-bfbwcz:#00a1c9;
59
72
  --color-info-600-ieuf7e:#0073bb;
73
+ --color-info-700-agborf:#004a9e;
74
+ --color-info-800-l8p7mk:#003b8f;
75
+ --color-info-950-76e1op:#00204d;
60
76
  --color-info-1000-og0pob:#12293b;
61
77
  --color-purple-400-v76rym:#bf80ff;
62
78
  --color-purple-700-e3ppuj:#7300e5;
@@ -3944,5 +3960,5 @@
3944
3960
  }
3945
3961
  }
3946
3962
  :root {
3947
- --awsui-version-info-83708957: true;
3963
+ --awsui-version-info-3f01803d: true;
3948
3964
  }
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (83708957)";
3
- export var GIT_SHA = "83708957";
2
+ export var PACKAGE_VERSION = "3.0.0 (3f01803d)";
3
+ export var GIT_SHA = "3f01803d";
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 (83708957)",
4
- "GIT_SHA": "83708957",
3
+ "PACKAGE_VERSION": "3.0.0 (3f01803d)",
4
+ "GIT_SHA": "3f01803d",
5
5
  "THEME": "default",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": false,
@@ -8,6 +8,7 @@ export const colorPrimary600: string;
8
8
  export const colorPrimary700: string;
9
9
  export const colorPrimary800: string;
10
10
  export const colorPrimary900: string;
11
+ export const colorPrimary950: string;
11
12
  export const colorPrimary1000: string;
12
13
  export const colorNeutral50: string;
13
14
  export const colorNeutral100: string;
@@ -30,23 +31,38 @@ export const colorNeutral900: string;
30
31
  export const colorNeutral950: string;
31
32
  export const colorNeutral1000: string;
32
33
  export const colorError50: string;
34
+ export const colorError100: string;
33
35
  export const colorError400: string;
34
36
  export const colorError600: string;
37
+ export const colorError800: string;
35
38
  export const colorError900: string;
39
+ export const colorError950: string;
36
40
  export const colorError1000: string;
37
41
  export const colorSuccess50: string;
42
+ export const colorSuccess100: string;
43
+ export const colorSuccess400: string;
38
44
  export const colorSuccess500: string;
39
45
  export const colorSuccess600: string;
46
+ export const colorSuccess800: string;
47
+ export const colorSuccess950: string;
40
48
  export const colorSuccess1000: string;
41
49
  export const colorWarning50: string;
50
+ export const colorWarning100: string;
42
51
  export const colorWarning400: string;
43
52
  export const colorWarning500: string;
53
+ export const colorWarning600: string;
54
+ export const colorWarning800: string;
44
55
  export const colorWarning900: string;
56
+ export const colorWarning950: string;
45
57
  export const colorWarning1000: string;
46
58
  export const colorInfo50: string;
59
+ export const colorInfo100: string;
47
60
  export const colorInfo300: string;
48
61
  export const colorInfo400: string;
49
62
  export const colorInfo600: string;
63
+ export const colorInfo700: string;
64
+ export const colorInfo800: string;
65
+ export const colorInfo950: string;
50
66
  export const colorInfo1000: string;
51
67
  export const colorGrey50: string;
52
68
  export const colorGrey100: string;
@@ -95,6 +111,86 @@ export const colorPurple400: string;
95
111
  export const colorPurple700: string;
96
112
  export const colorAmber400: string;
97
113
  export const colorAmber500: string;
114
+ export const colorRed950: string;
115
+ export const colorOrange50: string;
116
+ export const colorOrange100: string;
117
+ export const colorOrange400: string;
118
+ export const colorOrange700: string;
119
+ export const colorOrange800: string;
120
+ export const colorOrange950: string;
121
+ export const colorYellow600: string;
122
+ export const colorYellow950: string;
123
+ export const colorLime50: string;
124
+ export const colorLime100: string;
125
+ export const colorLime400: string;
126
+ export const colorLime700: string;
127
+ export const colorLime800: string;
128
+ export const colorLime950: string;
129
+ export const colorGreen400: string;
130
+ export const colorGreen950: string;
131
+ export const colorMint50: string;
132
+ export const colorMint100: string;
133
+ export const colorMint400: string;
134
+ export const colorMint700: string;
135
+ export const colorMint800: string;
136
+ export const colorMint950: string;
137
+ export const colorIndigo50: string;
138
+ export const colorIndigo400: string;
139
+ export const colorIndigo600: string;
140
+ export const colorIndigo950: string;
141
+ export const colorPurple50: string;
142
+ export const colorPurple100: string;
143
+ export const colorPurple600: string;
144
+ export const colorPurple800: string;
145
+ export const colorPurple950: string;
146
+ export const colorTeal50: string;
147
+ export const colorTeal100: string;
148
+ export const colorTeal400: string;
149
+ export const colorTeal700: string;
150
+ export const colorTeal800: string;
151
+ export const colorTeal950: string;
152
+ export const colorCyan50: string;
153
+ export const colorCyan100: string;
154
+ export const colorCyan400: string;
155
+ export const colorCyan700: string;
156
+ export const colorCyan800: string;
157
+ export const colorCyan950: string;
158
+ export const colorBlue950: string;
159
+ export const colorViolet50: string;
160
+ export const colorViolet100: string;
161
+ export const colorViolet400: string;
162
+ export const colorViolet700: string;
163
+ export const colorViolet800: string;
164
+ export const colorViolet950: string;
165
+ export const colorFuchsia50: string;
166
+ export const colorFuchsia100: string;
167
+ export const colorFuchsia400: string;
168
+ export const colorFuchsia700: string;
169
+ export const colorFuchsia800: string;
170
+ export const colorFuchsia950: string;
171
+ export const colorMagenta50: string;
172
+ export const colorMagenta100: string;
173
+ export const colorMagenta400: string;
174
+ export const colorMagenta700: string;
175
+ export const colorMagenta800: string;
176
+ export const colorMagenta950: string;
177
+ export const colorPink50: string;
178
+ export const colorPink100: string;
179
+ export const colorPink400: string;
180
+ export const colorPink700: string;
181
+ export const colorPink800: string;
182
+ export const colorPink950: string;
183
+ export const colorRose50: string;
184
+ export const colorRose100: string;
185
+ export const colorRose400: string;
186
+ export const colorRose700: string;
187
+ export const colorRose800: string;
188
+ export const colorRose950: string;
189
+ export const colorAmber50: string;
190
+ export const colorAmber100: string;
191
+ export const colorAmber700: string;
192
+ export const colorAmber800: string;
193
+ export const colorAmber950: string;
98
194
  export const colorAwsSquidInk: string;
99
195
  export const colorTransparent: string;
100
196
  export const colorBlack: string;
@@ -643,6 +739,42 @@ export const colorTextBadgeGreen: string;
643
739
  export const colorTextBadgeBlue: string;
644
740
  export const colorTextBadgeRed: string;
645
741
  export const colorBackgroundCodeView: string;
742
+ export const colorBackgroundAccentRed: string;
743
+ export const colorBackgroundAccentYellow: string;
744
+ export const colorBackgroundAccentIndigo: string;
745
+ export const colorBackgroundAccentGreen: string;
746
+ export const colorBackgroundAccentOrange: string;
747
+ export const colorBackgroundAccentPurple: string;
748
+ export const colorBackgroundAccentMint: string;
749
+ export const colorBackgroundAccentLime: string;
750
+ export const colorBackgroundAccentGrey: string;
751
+ export const colorBackgroundAccentTeal: string;
752
+ export const colorBackgroundAccentCyan: string;
753
+ export const colorBackgroundAccentBlue: string;
754
+ export const colorBackgroundAccentViolet: string;
755
+ export const colorBackgroundAccentFuchsia: string;
756
+ export const colorBackgroundAccentMagenta: string;
757
+ export const colorBackgroundAccentPink: string;
758
+ export const colorBackgroundAccentRose: string;
759
+ export const colorBackgroundAccentAmber: string;
760
+ export const colorTextAccentRed: string;
761
+ export const colorTextAccentYellow: string;
762
+ export const colorTextAccentIndigo: string;
763
+ export const colorTextAccentGreen: string;
764
+ export const colorTextAccentOrange: string;
765
+ export const colorTextAccentPurple: string;
766
+ export const colorTextAccentMint: string;
767
+ export const colorTextAccentLime: string;
768
+ export const colorTextAccentGrey: string;
769
+ export const colorTextAccentTeal: string;
770
+ export const colorTextAccentCyan: string;
771
+ export const colorTextAccentBlue: string;
772
+ export const colorTextAccentViolet: string;
773
+ export const colorTextAccentFuchsia: string;
774
+ export const colorTextAccentMagenta: string;
775
+ export const colorTextAccentPink: string;
776
+ export const colorTextAccentRose: string;
777
+ export const colorTextAccentAmber: string;
646
778
  export const fontBoxValueLargeWeight: string;
647
779
  export const fontButtonLetterSpacing: string;
648
780
  export const fontChartDetailSize: string;