@cloudscape-design/components 3.0.599 → 3.0.601

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 (114) hide show
  1. package/app-layout/classic.d.ts +5 -1
  2. package/app-layout/classic.d.ts.map +1 -1
  3. package/app-layout/classic.js +1 -1
  4. package/app-layout/classic.js.map +1 -1
  5. package/app-layout/implementation.d.ts +5 -1
  6. package/app-layout/implementation.d.ts.map +1 -1
  7. package/app-layout/implementation.js.map +1 -1
  8. package/app-layout/interfaces.d.ts +2 -0
  9. package/app-layout/interfaces.d.ts.map +1 -1
  10. package/app-layout/interfaces.js.map +1 -1
  11. package/app-layout/internal.d.ts +5 -1
  12. package/app-layout/internal.d.ts.map +1 -1
  13. package/app-layout/visual-refresh/context.d.ts +3 -3
  14. package/app-layout/visual-refresh/context.d.ts.map +1 -1
  15. package/app-layout/visual-refresh/context.js +1 -1
  16. package/app-layout/visual-refresh/context.js.map +1 -1
  17. package/app-layout/visual-refresh/index.d.ts +5 -1
  18. package/app-layout/visual-refresh/index.d.ts.map +1 -1
  19. package/app-layout/visual-refresh/index.js.map +1 -1
  20. package/app-layout/widget.d.ts +2 -2
  21. package/app-layout/widget.d.ts.map +1 -1
  22. package/app-layout/widget.js.map +1 -1
  23. package/button-dropdown/internal.d.ts.map +1 -1
  24. package/button-dropdown/internal.js +2 -1
  25. package/button-dropdown/internal.js.map +1 -1
  26. package/calendar/grid/index.d.ts +1 -1
  27. package/calendar/grid/index.d.ts.map +1 -1
  28. package/calendar/grid/index.js.map +1 -1
  29. package/calendar/grid/use-calendar-grid-keyboard-navigation.d.ts +1 -1
  30. package/calendar/grid/use-calendar-grid-keyboard-navigation.d.ts.map +1 -1
  31. package/calendar/grid/use-calendar-grid-keyboard-navigation.js +16 -28
  32. package/calendar/grid/use-calendar-grid-keyboard-navigation.js.map +1 -1
  33. package/code-editor/index.d.ts.map +1 -1
  34. package/code-editor/index.js +2 -2
  35. package/code-editor/index.js.map +1 -1
  36. package/code-editor/interfaces.d.ts +2 -1
  37. package/code-editor/interfaces.d.ts.map +1 -1
  38. package/code-editor/interfaces.js.map +1 -1
  39. package/code-editor/preferences-modal.d.ts +2 -0
  40. package/code-editor/preferences-modal.d.ts.map +1 -1
  41. package/code-editor/preferences-modal.js +1 -1
  42. package/code-editor/preferences-modal.js.map +1 -1
  43. package/collection-preferences/index.d.ts +1 -1
  44. package/collection-preferences/index.d.ts.map +1 -1
  45. package/collection-preferences/index.js +2 -2
  46. package/collection-preferences/index.js.map +1 -1
  47. package/collection-preferences/interfaces.d.ts +2 -1
  48. package/collection-preferences/interfaces.d.ts.map +1 -1
  49. package/collection-preferences/interfaces.js.map +1 -1
  50. package/date-range-picker/calendar/grids/grid.d.ts +1 -1
  51. package/date-range-picker/calendar/grids/grid.d.ts.map +1 -1
  52. package/date-range-picker/calendar/grids/grid.js +4 -4
  53. package/date-range-picker/calendar/grids/grid.js.map +1 -1
  54. package/date-range-picker/calendar/grids/index.d.ts.map +1 -1
  55. package/date-range-picker/calendar/grids/index.js +14 -28
  56. package/date-range-picker/calendar/grids/index.js.map +1 -1
  57. package/date-range-picker/calendar/grids/styles.css.js +27 -25
  58. package/date-range-picker/calendar/grids/styles.scoped.css +54 -54
  59. package/date-range-picker/calendar/grids/styles.selectors.js +27 -25
  60. package/internal/components/portal/index.d.ts +3 -1
  61. package/internal/components/portal/index.d.ts.map +1 -1
  62. package/internal/components/portal/index.js +36 -9
  63. package/internal/components/portal/index.js.map +1 -1
  64. package/internal/direction.d.ts +9 -0
  65. package/internal/direction.d.ts.map +1 -0
  66. package/internal/direction.js +15 -0
  67. package/internal/direction.js.map +1 -0
  68. package/internal/environment.js +1 -1
  69. package/internal/environment.json +1 -1
  70. package/internal/manifest.json +1 -1
  71. package/internal/utils/handle-key.d.ts +13 -0
  72. package/internal/utils/handle-key.d.ts.map +1 -0
  73. package/internal/utils/handle-key.js +37 -0
  74. package/internal/utils/handle-key.js.map +1 -0
  75. package/modal/interfaces.d.ts +16 -2
  76. package/modal/interfaces.d.ts.map +1 -1
  77. package/modal/interfaces.js.map +1 -1
  78. package/modal/internal.d.ts +1 -1
  79. package/modal/internal.d.ts.map +1 -1
  80. package/modal/internal.js +4 -4
  81. package/modal/internal.js.map +1 -1
  82. package/package.json +1 -1
  83. package/s3-resource-selector/index.d.ts.map +1 -1
  84. package/s3-resource-selector/index.js +3 -1
  85. package/s3-resource-selector/index.js.map +1 -1
  86. package/s3-resource-selector/interfaces.d.ts +2 -1
  87. package/s3-resource-selector/interfaces.d.ts.map +1 -1
  88. package/s3-resource-selector/interfaces.js.map +1 -1
  89. package/s3-resource-selector/s3-modal/index.d.ts +3 -1
  90. package/s3-resource-selector/s3-modal/index.d.ts.map +1 -1
  91. package/s3-resource-selector/s3-modal/index.js +2 -2
  92. package/s3-resource-selector/s3-modal/index.js.map +1 -1
  93. package/segmented-control/internal-segmented-control.d.ts.map +1 -1
  94. package/segmented-control/internal-segmented-control.js +5 -6
  95. package/segmented-control/internal-segmented-control.js.map +1 -1
  96. package/table/body-cell/styles.css.js +43 -42
  97. package/table/body-cell/styles.scoped.css +203 -200
  98. package/table/body-cell/styles.selectors.js +43 -42
  99. package/table/body-cell/td-element.js +1 -1
  100. package/table/body-cell/td-element.js.map +1 -1
  101. package/table/index.d.ts.map +1 -1
  102. package/table/index.js +3 -0
  103. package/table/index.js.map +1 -1
  104. package/table/table-role/grid-navigation.js +8 -8
  105. package/table/table-role/grid-navigation.js.map +1 -1
  106. package/table/table-role/utils.js +1 -1
  107. package/table/table-role/utils.js.map +1 -1
  108. package/tabs/scroll-utils.d.ts +4 -4
  109. package/tabs/scroll-utils.d.ts.map +1 -1
  110. package/tabs/scroll-utils.js +14 -14
  111. package/tabs/scroll-utils.js.map +1 -1
  112. package/tabs/tab-header-bar.d.ts.map +1 -1
  113. package/tabs/tab-header-bar.js +25 -50
  114. package/tabs/tab-header-bar.js.map +1 -1
@@ -2,6 +2,7 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
  import React, { useRef } from 'react';
4
4
  import clsx from 'clsx';
5
+ import handleKey from '../internal/utils/handle-key';
5
6
  import { KeyCode } from '../internal/keycode';
6
7
  import { fireNonCancelableEvent } from '../internal/events';
7
8
  import { Segment } from './segment';
@@ -19,12 +20,10 @@ export default function InternalSegmentedControl({ selectedId, options, label, a
19
20
  return;
20
21
  }
21
22
  let nextIndex = activeIndex;
22
- if (event.keyCode === KeyCode.right) {
23
- nextIndex = activeIndex + 1 === enabledSegments.length ? 0 : activeIndex + 1;
24
- }
25
- else if (event.keyCode === KeyCode.left) {
26
- nextIndex = activeIndex === 0 ? enabledSegments.length - 1 : activeIndex - 1;
27
- }
23
+ handleKey(event, {
24
+ onInlineStart: () => (nextIndex = activeIndex === 0 ? enabledSegments.length - 1 : activeIndex - 1),
25
+ onInlineEnd: () => (nextIndex = activeIndex + 1 === enabledSegments.length ? 0 : activeIndex + 1),
26
+ });
28
27
  const nextSegmentId = enabledSegments[nextIndex].id;
29
28
  (_a = segmentByIdRef.current[nextSegmentId]) === null || _a === void 0 ? void 0 : _a.focus();
30
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"internal-segmented-control.js","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,GACc;IACtB,MAAM,c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E,GAAG,EAAE;oBACZ,IAAI,UAAU,KAAK,MAAM,CAAC,EAAE,EAAE;wBAC5B,sBAAsB,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC;qBAC7D;gBACH,CAAC,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,mBAAmB,CAAC,GAC7D,CACH,CAAC;QACJ,CAAC,CAAC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SegmentedControlProps } from './interfaces';\nimport { Segment } from './segment';\nimport styles from './styles.css.js';\n\nexport default function InternalSegmentedControl({\n selectedId,\n options,\n label,\n ariaLabelledby,\n onChange,\n}: SegmentedControlProps) {\n const segmentByIdRef = useRef<{ [id: string]: HTMLButtonElement }>({});\n const selectedOptions = (options || []).filter(option => {\n return option.id === selectedId;\n });\n const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;\n const enabledSegments = (options || []).filter(option => !option.disabled);\n\n const moveHighlight = (event: React.KeyboardEvent<HTMLButtonElement>, activeIndex: number) => {\n if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {\n return;\n }\n let nextIndex = activeIndex;\n if (event.keyCode === KeyCode.right) {\n nextIndex = activeIndex + 1 === enabledSegments.length ? 0 : activeIndex + 1;\n } else if (event.keyCode === KeyCode.left) {\n nextIndex = activeIndex === 0 ? enabledSegments.length - 1 : activeIndex - 1;\n }\n const nextSegmentId = enabledSegments[nextIndex].id;\n segmentByIdRef.current[nextSegmentId]?.focus();\n };\n\n return (\n <div\n className={clsx(styles['segment-part'], styles[`segment-count-${options?.length}`])}\n aria-label={label}\n aria-labelledby={ariaLabelledby}\n role=\"toolbar\"\n >\n {options &&\n options.map((option: SegmentedControlProps.Option, index) => {\n const isActive = selectedId === option.id;\n const enabledSegmentIndex = enabledSegments.indexOf(option);\n let tabIndex = isActive ? 0 : -1;\n if (currentSelectedOption === null && enabledSegmentIndex === 0) {\n tabIndex = 0;\n }\n return (\n <Segment\n key={index}\n id={option.id}\n disabled={!!option.disabled}\n iconName={option.iconName}\n iconAlt={option.iconAlt}\n iconUrl={option.iconUrl}\n iconSvg={option.iconSvg}\n text={option.text}\n isActive={isActive}\n tabIndex={tabIndex}\n ref={node => {\n if (node) {\n segmentByIdRef.current[option.id] = node;\n } else {\n delete segmentByIdRef.current[option.id];\n }\n }}\n onClick={() => {\n if (selectedId !== option.id) {\n fireNonCancelableEvent(onChange, { selectedId: option.id });\n }\n }}\n onKeyDown={event => moveHighlight(event, enabledSegmentIndex)}\n />\n );\n })}\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"internal-segmented-control.js","sourceRoot":"","sources":["../../../src/segmented-control/internal-segmented-control.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,SAAS,MAAM,8BAA8B,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,EAC/C,UAAU,EACV,OAAO,EACP,KAAK,EACL,cAAc,EACd,QAAQ,GACc;IACtB,MAAM,cAAc,GAAG,MAAM,CAAsC,EAAE,CAAC,CAAC;IACvE,MAAM,eAAe,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,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,EAAE,EAAE,CAAC,CAAC;qBAC7D;gBACH,CAAC,EACD,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,mBAAmB,CAAC,GAC7D,CACH,CAAC;QACJ,CAAC,CAAC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\nimport handleKey from '../internal/utils/handle-key';\nimport { KeyCode } from '../internal/keycode';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { SegmentedControlProps } from './interfaces';\nimport { Segment } from './segment';\nimport styles from './styles.css.js';\n\nexport default function InternalSegmentedControl({\n selectedId,\n options,\n label,\n ariaLabelledby,\n onChange,\n}: SegmentedControlProps) {\n const segmentByIdRef = useRef<{ [id: string]: HTMLButtonElement }>({});\n const selectedOptions = (options || []).filter(option => {\n return option.id === selectedId;\n });\n const currentSelectedOption = selectedOptions.length ? selectedOptions[0] : null;\n const enabledSegments = (options || []).filter(option => !option.disabled);\n\n const moveHighlight = (event: React.KeyboardEvent<HTMLButtonElement>, activeIndex: number) => {\n if (event.keyCode !== KeyCode.right && event.keyCode !== KeyCode.left) {\n return;\n }\n\n let nextIndex = activeIndex;\n\n handleKey(event, {\n onInlineStart: () => (nextIndex = activeIndex === 0 ? enabledSegments.length - 1 : activeIndex - 1),\n onInlineEnd: () => (nextIndex = activeIndex + 1 === enabledSegments.length ? 0 : activeIndex + 1),\n });\n\n const nextSegmentId = enabledSegments[nextIndex].id;\n segmentByIdRef.current[nextSegmentId]?.focus();\n };\n\n return (\n <div\n className={clsx(styles['segment-part'], styles[`segment-count-${options?.length}`])}\n aria-label={label}\n aria-labelledby={ariaLabelledby}\n role=\"toolbar\"\n >\n {options &&\n options.map((option: SegmentedControlProps.Option, index) => {\n const isActive = selectedId === option.id;\n const enabledSegmentIndex = enabledSegments.indexOf(option);\n let tabIndex = isActive ? 0 : -1;\n if (currentSelectedOption === null && enabledSegmentIndex === 0) {\n tabIndex = 0;\n }\n return (\n <Segment\n key={index}\n id={option.id}\n disabled={!!option.disabled}\n iconName={option.iconName}\n iconAlt={option.iconAlt}\n iconUrl={option.iconUrl}\n iconSvg={option.iconSvg}\n text={option.text}\n isActive={isActive}\n tabIndex={tabIndex}\n ref={node => {\n if (node) {\n segmentByIdRef.current[option.id] = node;\n } else {\n delete segmentByIdRef.current[option.id];\n }\n }}\n onClick={() => {\n if (selectedId !== option.id) {\n fireNonCancelableEvent(onChange, { selectedId: option.id });\n }\n }}\n onKeyDown={event => moveHighlight(event, enabledSegmentIndex)}\n />\n );\n })}\n </div>\n );\n}\n"]}
@@ -1,47 +1,48 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "expandable-toggle-wrapper": "awsui_expandable-toggle-wrapper_c6tup_v6hb3_99",
5
- "body-cell": "awsui_body-cell_c6tup_v6hb3_107",
6
- "body-cell-expandable-level-1": "awsui_body-cell-expandable-level-1_c6tup_v6hb3_121",
7
- "body-cell-expandable-level-2": "awsui_body-cell-expandable-level-2_c6tup_v6hb3_124",
8
- "body-cell-expandable-level-3": "awsui_body-cell-expandable-level-3_c6tup_v6hb3_127",
9
- "body-cell-expandable-level-4": "awsui_body-cell-expandable-level-4_c6tup_v6hb3_130",
10
- "body-cell-expandable-level-5": "awsui_body-cell-expandable-level-5_c6tup_v6hb3_133",
11
- "body-cell-expandable-level-6": "awsui_body-cell-expandable-level-6_c6tup_v6hb3_136",
12
- "body-cell-expandable-level-7": "awsui_body-cell-expandable-level-7_c6tup_v6hb3_139",
13
- "body-cell-expandable-level-8": "awsui_body-cell-expandable-level-8_c6tup_v6hb3_142",
14
- "body-cell-expandable-level-9": "awsui_body-cell-expandable-level-9_c6tup_v6hb3_145",
15
- "body-cell-expandable-level-next": "awsui_body-cell-expandable-level-next_c6tup_v6hb3_148",
16
- "sticky-cell": "awsui_sticky-cell_c6tup_v6hb3_172",
17
- "body-cell-wrap": "awsui_body-cell-wrap_c6tup_v6hb3_175",
18
- "is-visual-refresh": "awsui_is-visual-refresh_c6tup_v6hb3_187",
19
- "has-striped-rows": "awsui_has-striped-rows_c6tup_v6hb3_199",
20
- "body-cell-edit-active": "awsui_body-cell-edit-active_c6tup_v6hb3_232",
21
- "body-cell-interactive": "awsui_body-cell-interactive_c6tup_v6hb3_232",
22
- "body-cell-editable": "awsui_body-cell-editable_c6tup_v6hb3_232",
23
- "has-striped-rows-sticky-cell-pad-left": "awsui_has-striped-rows-sticky-cell-pad-left_c6tup_v6hb3_298",
24
- "has-selection": "awsui_has-selection_c6tup_v6hb3_331",
25
- "body-cell-first-row": "awsui_body-cell-first-row_c6tup_v6hb3_367",
26
- "body-cell-last-row": "awsui_body-cell-last-row_c6tup_v6hb3_370",
27
- "body-cell-selected": "awsui_body-cell-selected_c6tup_v6hb3_370",
28
- "has-footer": "awsui_has-footer_c6tup_v6hb3_370",
29
- "body-cell-shaded": "awsui_body-cell-shaded_c6tup_v6hb3_380",
30
- "sticky-cell-pad-left": "awsui_sticky-cell-pad-left_c6tup_v6hb3_414",
31
- "sticky-cell-last-right": "awsui_sticky-cell-last-right_c6tup_v6hb3_461",
32
- "sticky-cell-last-left": "awsui_sticky-cell-last-left_c6tup_v6hb3_465",
33
- "body-cell-next-selected": "awsui_body-cell-next-selected_c6tup_v6hb3_488",
34
- "body-cell-prev-selected": "awsui_body-cell-prev-selected_c6tup_v6hb3_492",
35
- "body-cell-editor-wrapper": "awsui_body-cell-editor-wrapper_c6tup_v6hb3_516",
36
- "body-cell-success": "awsui_body-cell-success_c6tup_v6hb3_523",
37
- "body-cell-editor": "awsui_body-cell-editor_c6tup_v6hb3_516",
38
- "body-cell-editor-disabled": "awsui_body-cell-editor-disabled_c6tup_v6hb3_550",
39
- "body-cell-editor-form": "awsui_body-cell-editor-form_c6tup_v6hb3_559",
40
- "body-cell-editor-row": "awsui_body-cell-editor-row_c6tup_v6hb3_569",
41
- "body-cell-editor-controls": "awsui_body-cell-editor-controls_c6tup_v6hb3_579",
42
- "body-cell-expandable": "awsui_body-cell-expandable_c6tup_v6hb3_121",
43
- "expandable-cell-content": "awsui_expandable-cell-content_c6tup_v6hb3_603",
44
- "body-cell-edit-disabled-popover": "awsui_body-cell-edit-disabled-popover_c6tup_v6hb3_651",
45
- "body-cell-has-success": "awsui_body-cell-has-success_c6tup_v6hb3_655"
4
+ "expandable-toggle-wrapper": "awsui_expandable-toggle-wrapper_c6tup_1ls9v_99",
5
+ "body-cell": "awsui_body-cell_c6tup_1ls9v_107",
6
+ "body-cell-content": "awsui_body-cell-content_c6tup_1ls9v_121",
7
+ "body-cell-wrap": "awsui_body-cell-wrap_c6tup_1ls9v_124",
8
+ "is-visual-refresh": "awsui_is-visual-refresh_c6tup_1ls9v_136",
9
+ "has-striped-rows": "awsui_has-striped-rows_c6tup_1ls9v_148",
10
+ "body-cell-expandable-level-1": "awsui_body-cell-expandable-level-1_c6tup_1ls9v_151",
11
+ "body-cell-expandable-level-2": "awsui_body-cell-expandable-level-2_c6tup_1ls9v_154",
12
+ "body-cell-expandable-level-3": "awsui_body-cell-expandable-level-3_c6tup_1ls9v_157",
13
+ "body-cell-expandable-level-4": "awsui_body-cell-expandable-level-4_c6tup_1ls9v_160",
14
+ "body-cell-expandable-level-5": "awsui_body-cell-expandable-level-5_c6tup_1ls9v_163",
15
+ "body-cell-expandable-level-6": "awsui_body-cell-expandable-level-6_c6tup_1ls9v_166",
16
+ "body-cell-expandable-level-7": "awsui_body-cell-expandable-level-7_c6tup_1ls9v_169",
17
+ "body-cell-expandable-level-8": "awsui_body-cell-expandable-level-8_c6tup_1ls9v_172",
18
+ "body-cell-expandable-level-9": "awsui_body-cell-expandable-level-9_c6tup_1ls9v_175",
19
+ "body-cell-expandable-level-next": "awsui_body-cell-expandable-level-next_c6tup_1ls9v_178",
20
+ "body-cell-edit-active": "awsui_body-cell-edit-active_c6tup_1ls9v_181",
21
+ "body-cell-interactive": "awsui_body-cell-interactive_c6tup_1ls9v_181",
22
+ "body-cell-editable": "awsui_body-cell-editable_c6tup_1ls9v_181",
23
+ "has-striped-rows-sticky-cell-pad-left": "awsui_has-striped-rows-sticky-cell-pad-left_c6tup_1ls9v_247",
24
+ "has-selection": "awsui_has-selection_c6tup_1ls9v_280",
25
+ "body-cell-first-row": "awsui_body-cell-first-row_c6tup_1ls9v_316",
26
+ "body-cell-last-row": "awsui_body-cell-last-row_c6tup_1ls9v_319",
27
+ "body-cell-selected": "awsui_body-cell-selected_c6tup_1ls9v_319",
28
+ "has-footer": "awsui_has-footer_c6tup_1ls9v_319",
29
+ "body-cell-shaded": "awsui_body-cell-shaded_c6tup_1ls9v_329",
30
+ "sticky-cell": "awsui_sticky-cell_c6tup_1ls9v_355",
31
+ "sticky-cell-pad-left": "awsui_sticky-cell-pad-left_c6tup_1ls9v_363",
32
+ "sticky-cell-last-right": "awsui_sticky-cell-last-right_c6tup_1ls9v_410",
33
+ "sticky-cell-last-left": "awsui_sticky-cell-last-left_c6tup_1ls9v_414",
34
+ "body-cell-next-selected": "awsui_body-cell-next-selected_c6tup_1ls9v_437",
35
+ "body-cell-prev-selected": "awsui_body-cell-prev-selected_c6tup_1ls9v_441",
36
+ "body-cell-editor-wrapper": "awsui_body-cell-editor-wrapper_c6tup_1ls9v_465",
37
+ "body-cell-success": "awsui_body-cell-success_c6tup_1ls9v_472",
38
+ "body-cell-editor": "awsui_body-cell-editor_c6tup_1ls9v_465",
39
+ "body-cell-editor-disabled": "awsui_body-cell-editor-disabled_c6tup_1ls9v_499",
40
+ "body-cell-editor-form": "awsui_body-cell-editor-form_c6tup_1ls9v_508",
41
+ "body-cell-editor-row": "awsui_body-cell-editor-row_c6tup_1ls9v_518",
42
+ "body-cell-editor-controls": "awsui_body-cell-editor-controls_c6tup_1ls9v_528",
43
+ "body-cell-expandable": "awsui_body-cell-expandable_c6tup_1ls9v_151",
44
+ "expandable-cell-content": "awsui_expandable-cell-content_c6tup_1ls9v_552",
45
+ "body-cell-edit-disabled-popover": "awsui_body-cell-edit-disabled-popover_c6tup_1ls9v_600",
46
+ "body-cell-has-success": "awsui_body-cell-has-success_c6tup_1ls9v_604"
46
47
  };
47
48