@cloudscape-design/components-themeable 3.0.1106 → 3.0.1108

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 (49) hide show
  1. package/lib/internal/manifest.json +1 -1
  2. package/lib/internal/scss/internal/components/expand-toggle-button/styles.scss +6 -2
  3. package/lib/internal/scss/internal/generated/custom-css-properties/index.scss +1 -1
  4. package/lib/internal/scss/internal/styles/utils/styles-reset.scss +1 -0
  5. package/lib/internal/scss/tree-view/tree-item/styles.scss +38 -21
  6. package/lib/internal/template/internal/base-component/styles.scoped.css +1 -1
  7. package/lib/internal/template/internal/components/expand-toggle-button/index.d.ts +3 -1
  8. package/lib/internal/template/internal/components/expand-toggle-button/index.d.ts.map +1 -1
  9. package/lib/internal/template/internal/components/expand-toggle-button/index.js +2 -2
  10. package/lib/internal/template/internal/components/expand-toggle-button/index.js.map +1 -1
  11. package/lib/internal/template/internal/components/expand-toggle-button/styles.css.js +4 -3
  12. package/lib/internal/template/internal/components/expand-toggle-button/styles.scoped.css +13 -13
  13. package/lib/internal/template/internal/components/expand-toggle-button/styles.selectors.js +4 -3
  14. package/lib/internal/template/internal/components/structured-item/index.d.ts +3 -1
  15. package/lib/internal/template/internal/components/structured-item/index.d.ts.map +1 -1
  16. package/lib/internal/template/internal/components/structured-item/index.js +2 -2
  17. package/lib/internal/template/internal/components/structured-item/index.js.map +1 -1
  18. package/lib/internal/template/internal/environment.js +2 -2
  19. package/lib/internal/template/internal/environment.json +2 -2
  20. package/lib/internal/template/tree-view/internal.d.ts.map +1 -1
  21. package/lib/internal/template/tree-view/internal.js +10 -4
  22. package/lib/internal/template/tree-view/internal.js.map +1 -1
  23. package/lib/internal/template/tree-view/keyboard-navigation/index.d.ts +31 -0
  24. package/lib/internal/template/tree-view/keyboard-navigation/index.d.ts.map +1 -0
  25. package/lib/internal/template/tree-view/keyboard-navigation/index.js +224 -0
  26. package/lib/internal/template/tree-view/keyboard-navigation/index.js.map +1 -0
  27. package/lib/internal/template/tree-view/keyboard-navigation/utils.d.ts +7 -0
  28. package/lib/internal/template/tree-view/keyboard-navigation/utils.d.ts.map +1 -0
  29. package/lib/internal/template/tree-view/keyboard-navigation/utils.js +40 -0
  30. package/lib/internal/template/tree-view/keyboard-navigation/utils.js.map +1 -0
  31. package/lib/internal/template/tree-view/styles.css.js +2 -2
  32. package/lib/internal/template/tree-view/styles.scoped.css +3 -2
  33. package/lib/internal/template/tree-view/styles.selectors.js +2 -2
  34. package/lib/internal/template/tree-view/tree-item/focus-target.d.ts +5 -0
  35. package/lib/internal/template/tree-view/tree-item/focus-target.d.ts.map +1 -0
  36. package/lib/internal/template/tree-view/tree-item/focus-target.js +11 -0
  37. package/lib/internal/template/tree-view/tree-item/focus-target.js.map +1 -0
  38. package/lib/internal/template/tree-view/tree-item/index.d.ts +4 -1
  39. package/lib/internal/template/tree-view/tree-item/index.d.ts.map +1 -1
  40. package/lib/internal/template/tree-view/tree-item/index.js +11 -9
  41. package/lib/internal/template/tree-view/tree-item/index.js.map +1 -1
  42. package/lib/internal/template/tree-view/tree-item/styles.css.js +9 -5
  43. package/lib/internal/template/tree-view/tree-item/styles.scoped.css +46 -11
  44. package/lib/internal/template/tree-view/tree-item/styles.selectors.js +9 -5
  45. package/lib/internal/template/tree-view/utils.d.ts +11 -0
  46. package/lib/internal/template/tree-view/utils.d.ts.map +1 -0
  47. package/lib/internal/template/tree-view/utils.js +20 -0
  48. package/lib/internal/template/tree-view/utils.js.map +1 -0
  49. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
1
  {
2
- "commit": "8c8796c091a69ffcf4d87245b60068b47f2b6f1a"
2
+ "commit": "eae5d559b55c956d908bc8e9874860a126ebb32a"
3
3
  }
@@ -40,8 +40,12 @@
40
40
  outline: 0;
41
41
  color: awsui.$color-text-interactive-default;
42
42
 
43
- @include focus-visible.when-visible {
44
- @include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
43
+ // focus highlight for tree-view is different and handled in tree-item/styles
44
+ // so we disable this one
45
+ &:not(.disable-focus-highlight) {
46
+ @include focus-visible.when-visible {
47
+ @include styles.focus-highlight(awsui.$space-button-focus-outline-gutter);
48
+ }
45
49
  }
46
50
 
47
51
  &:hover {
@@ -1,6 +1,6 @@
1
1
 
2
2
  // Build environment
3
- $awsui-commit-hash: "8c8796c0";
3
+ $awsui-commit-hash: "eae5d559";
4
4
  // Manually managed CSS-variables
5
5
  $maxContentWidth: --awsui-max-content-width-y15yd5;
6
6
  $minContentWidth: --awsui-min-content-width-y15yd5;
@@ -39,6 +39,7 @@
39
39
  }
40
40
 
41
41
  @mixin styles-reset-ul {
42
+ list-style: none;
42
43
  margin-block: 0;
43
44
  margin-inline: 0;
44
45
 
@@ -4,42 +4,59 @@
4
4
  */
5
5
  @use '../../internal/styles/tokens' as awsui;
6
6
  @use '../../internal/styles' as styles;
7
+ @use '@cloudscape-design/component-toolkit/internal/focus-visible' as focus-visible;
7
8
 
8
9
  $item-toggle-column-width: 28px;
9
10
 
10
11
  .treeitem-group {
11
12
  @include styles.styles-reset-ul;
13
+
14
+ position: relative;
12
15
  }
13
16
 
14
17
  .treeitem {
15
18
  @include styles.styles-reset-ul;
16
19
 
17
- align-items: baseline;
20
+ position: relative;
18
21
 
19
- display: grid;
20
- grid-template-columns: $item-toggle-column-width 1fr;
21
- grid-template-rows: auto auto auto;
22
+ &.offset {
23
+ margin-inline-start: $item-toggle-column-width;
24
+ }
22
25
 
23
- > .expand-toggle-wrapper {
24
- grid-column: 1;
25
- grid-row: 1;
26
- margin-inline-end: awsui.$space-scaled-xxs;
26
+ > .treeitem-content-wrapper {
27
+ display: grid;
28
+ grid-template-columns: $item-toggle-column-width 1fr;
29
+ align-items: baseline;
27
30
 
28
- > .toggle {
29
- justify-self: center;
30
- position: relative;
31
- inset-block-start: 2px;
31
+ // When toggle is focused, show focus outline around the entire tree item
32
+ // stylelint-disable-next-line selector-combinator-disallowed-list
33
+ body[data-awsui-focus-visible='true'] &:has(.tree-item-focus-target:focus) {
34
+ @include styles.focus-highlight(0px);
32
35
  }
33
- }
34
36
 
35
- > .structured-item-wrapper {
36
- grid-column: 2;
37
- grid-row: 1 / span 2;
38
- padding-block: awsui.$space-scaled-xxs;
39
- }
37
+ > .expand-toggle-wrapper {
38
+ grid-column: 1;
39
+ grid-row: 1;
40
+ padding-inline-end: awsui.$space-scaled-xxs;
41
+
42
+ > .toggle {
43
+ justify-self: center;
44
+ position: relative;
45
+ inset-block-start: 2px;
46
+ }
47
+ }
48
+
49
+ > .structured-item-wrapper {
50
+ grid-column: 2;
51
+ grid-row: 1 / span 2;
52
+ padding-block: awsui.$space-scaled-xxs;
40
53
 
41
- > .treeitem-group {
42
- grid-column: 2;
43
- grid-row: 3;
54
+ position: relative;
55
+ }
44
56
  }
45
57
  }
58
+
59
+ .tree-item-structured-item,
60
+ .tree-item-focus-target {
61
+ /* used in keyboard navigation */
62
+ }
@@ -3901,5 +3901,5 @@
3901
3901
  }
3902
3902
  }
3903
3903
  :root {
3904
- --awsui-version-info-8c8796c0: true;
3904
+ --awsui-version-info-eae5d559: true;
3905
3905
  }
@@ -1,9 +1,11 @@
1
1
  import React from 'react';
2
- export declare function ExpandToggleButton({ isExpanded, onExpandableItemToggle, expandButtonLabel, collapseButtonLabel, customIcon, }: {
2
+ export declare function ExpandToggleButton({ isExpanded, onExpandableItemToggle, expandButtonLabel, collapseButtonLabel, customIcon, className, disableFocusHighlight, }: {
3
3
  isExpanded?: boolean;
4
4
  onExpandableItemToggle?: () => void;
5
5
  expandButtonLabel?: string;
6
6
  collapseButtonLabel?: string;
7
7
  customIcon?: React.ReactNode;
8
+ className?: string;
9
+ disableFocusHighlight?: boolean;
8
10
  }): JSX.Element;
9
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/expand-toggle-button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAStC,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,GACX,EAAE;IACD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B,eAsBA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/expand-toggle-button/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAStC,wBAAgB,kBAAkB,CAAC,EACjC,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,qBAAqB,GACtB,EAAE;IACD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IACpC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,eAuBA"}
@@ -5,9 +5,9 @@ import clsx from 'clsx';
5
5
  import { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';
6
6
  import InternalIcon from '../../../icon/internal';
7
7
  import styles from './styles.css.js';
8
- export function ExpandToggleButton({ isExpanded, onExpandableItemToggle, expandButtonLabel, collapseButtonLabel, customIcon, }) {
8
+ export function ExpandToggleButton({ isExpanded, onExpandableItemToggle, expandButtonLabel, collapseButtonLabel, customIcon, className, disableFocusHighlight, }) {
9
9
  const buttonRef = useRef(null);
10
10
  const { tabIndex } = useSingleTabStopNavigation(buttonRef);
11
- return (React.createElement("button", { type: "button", ref: buttonRef, tabIndex: tabIndex, "aria-label": isExpanded ? collapseButtonLabel : expandButtonLabel, "aria-expanded": isExpanded, className: styles['expand-toggle'], onClick: onExpandableItemToggle }, customIcon !== null && customIcon !== void 0 ? customIcon : (React.createElement(InternalIcon, { size: "small", name: "caret-down-filled", className: clsx(styles['expand-toggle-icon'], isExpanded && styles['expand-toggle-icon-expanded']) }))));
11
+ return (React.createElement("button", { type: "button", ref: buttonRef, tabIndex: tabIndex, "aria-label": isExpanded ? collapseButtonLabel : expandButtonLabel, "aria-expanded": isExpanded, className: clsx(styles['expand-toggle'], disableFocusHighlight && styles['disable-focus-highlight'], className), onClick: onExpandableItemToggle }, customIcon !== null && customIcon !== void 0 ? customIcon : (React.createElement(InternalIcon, { size: "small", name: "caret-down-filled", className: clsx(styles['expand-toggle-icon'], isExpanded && styles['expand-toggle-icon-expanded']) }))));
12
12
  }
13
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/expand-toggle-button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAE3F,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAElD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,UAAU,kBAAkB,CAAC,EACjC,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,GAOX;IACC,MAAM,SAAS,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAClD,MAAM,EAAE,QAAQ,EAAE,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAC3D,OAAO,CACL,gCACE,IAAI,EAAC,QAAQ,EACb,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,QAAQ,gBACN,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,mBACjD,UAAU,EACzB,SAAS,EAAE,MAAM,CAAC,eAAe,CAAC,EAClC,OAAO,EAAE,sBAAsB,IAE9B,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CACb,oBAAC,YAAY,IACX,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,mBAAmB,EACxB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,UAAU,IAAI,MAAM,CAAC,6BAA6B,CAAC,CAAC,GAClG,CACH,CACM,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalIcon from '../../../icon/internal';\n\nimport styles from './styles.css.js';\n\nexport function ExpandToggleButton({\n isExpanded,\n onExpandableItemToggle,\n expandButtonLabel,\n collapseButtonLabel,\n customIcon,\n}: {\n isExpanded?: boolean;\n onExpandableItemToggle?: () => void;\n expandButtonLabel?: string;\n collapseButtonLabel?: string;\n customIcon?: React.ReactNode;\n}) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const { tabIndex } = useSingleTabStopNavigation(buttonRef);\n return (\n <button\n type=\"button\"\n ref={buttonRef}\n tabIndex={tabIndex}\n aria-label={isExpanded ? collapseButtonLabel : expandButtonLabel}\n aria-expanded={isExpanded}\n className={styles['expand-toggle']}\n onClick={onExpandableItemToggle}\n >\n {customIcon ?? (\n <InternalIcon\n size=\"small\"\n name=\"caret-down-filled\"\n className={clsx(styles['expand-toggle-icon'], isExpanded && styles['expand-toggle-icon-expanded'])}\n />\n )}\n </button>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/expand-toggle-button/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AAEtC,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAE3F,OAAO,YAAY,MAAM,wBAAwB,CAAC;AAElD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AAErC,MAAM,UAAU,kBAAkB,CAAC,EACjC,UAAU,EACV,sBAAsB,EACtB,iBAAiB,EACjB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,qBAAqB,GAStB;IACC,MAAM,SAAS,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAClD,MAAM,EAAE,QAAQ,EAAE,GAAG,0BAA0B,CAAC,SAAS,CAAC,CAAC;IAE3D,OAAO,CACL,gCACE,IAAI,EAAC,QAAQ,EACb,GAAG,EAAE,SAAS,EACd,QAAQ,EAAE,QAAQ,gBACN,UAAU,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,iBAAiB,mBACjD,UAAU,EACzB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,qBAAqB,IAAI,MAAM,CAAC,yBAAyB,CAAC,EAAE,SAAS,CAAC,EAC/G,OAAO,EAAE,sBAAsB,IAE9B,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,CACb,oBAAC,YAAY,IACX,IAAI,EAAC,OAAO,EACZ,IAAI,EAAC,mBAAmB,EACxB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,EAAE,UAAU,IAAI,MAAM,CAAC,6BAA6B,CAAC,CAAC,GAClG,CACH,CACM,CACV,CAAC;AACJ,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport React, { useRef } from 'react';\nimport clsx from 'clsx';\n\nimport { useSingleTabStopNavigation } from '@cloudscape-design/component-toolkit/internal';\n\nimport InternalIcon from '../../../icon/internal';\n\nimport styles from './styles.css.js';\n\nexport function ExpandToggleButton({\n isExpanded,\n onExpandableItemToggle,\n expandButtonLabel,\n collapseButtonLabel,\n customIcon,\n className,\n disableFocusHighlight,\n}: {\n isExpanded?: boolean;\n onExpandableItemToggle?: () => void;\n expandButtonLabel?: string;\n collapseButtonLabel?: string;\n customIcon?: React.ReactNode;\n className?: string;\n disableFocusHighlight?: boolean;\n}) {\n const buttonRef = useRef<HTMLButtonElement>(null);\n const { tabIndex } = useSingleTabStopNavigation(buttonRef);\n\n return (\n <button\n type=\"button\"\n ref={buttonRef}\n tabIndex={tabIndex}\n aria-label={isExpanded ? collapseButtonLabel : expandButtonLabel}\n aria-expanded={isExpanded}\n className={clsx(styles['expand-toggle'], disableFocusHighlight && styles['disable-focus-highlight'], className)}\n onClick={onExpandableItemToggle}\n >\n {customIcon ?? (\n <InternalIcon\n size=\"small\"\n name=\"caret-down-filled\"\n className={clsx(styles['expand-toggle-icon'], isExpanded && styles['expand-toggle-icon-expanded'])}\n />\n )}\n </button>\n );\n}\n"]}
@@ -1,8 +1,9 @@
1
1
 
2
2
  import './styles.scoped.css';
3
3
  export default {
4
- "expand-toggle-icon": "awsui_expand-toggle-icon_1xe88_sgtpp_153",
5
- "expand-toggle-icon-expanded": "awsui_expand-toggle-icon-expanded_1xe88_sgtpp_174",
6
- "expand-toggle": "awsui_expand-toggle_1xe88_sgtpp_153"
4
+ "expand-toggle-icon": "awsui_expand-toggle-icon_1xe88_1vxpr_153",
5
+ "expand-toggle-icon-expanded": "awsui_expand-toggle-icon-expanded_1xe88_1vxpr_174",
6
+ "expand-toggle": "awsui_expand-toggle_1xe88_1vxpr_153",
7
+ "disable-focus-highlight": "awsui_disable-focus-highlight_1xe88_1vxpr_225"
7
8
  };
8
9
 
@@ -150,36 +150,36 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
150
150
  Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
151
151
  SPDX-License-Identifier: Apache-2.0
152
152
  */
153
- .awsui_expand-toggle-icon_1xe88_sgtpp_153:not(#\9) {
153
+ .awsui_expand-toggle-icon_1xe88_1vxpr_153:not(#\9) {
154
154
  transition: transform var(--motion-duration-rotate-90-f1ulnu, 135ms) var(--motion-easing-rotate-90-jekue3, cubic-bezier(0.165, 0.84, 0.44, 1));
155
155
  }
156
156
  @media (prefers-reduced-motion: reduce) {
157
- .awsui_expand-toggle-icon_1xe88_sgtpp_153:not(#\9) {
157
+ .awsui_expand-toggle-icon_1xe88_1vxpr_153:not(#\9) {
158
158
  animation: none;
159
159
  transition: none;
160
160
  }
161
161
  }
162
- .awsui-motion-disabled .awsui_expand-toggle-icon_1xe88_sgtpp_153:not(#\9), .awsui-mode-entering .awsui_expand-toggle-icon_1xe88_sgtpp_153:not(#\9) {
162
+ .awsui-motion-disabled .awsui_expand-toggle-icon_1xe88_1vxpr_153:not(#\9), .awsui-mode-entering .awsui_expand-toggle-icon_1xe88_1vxpr_153:not(#\9) {
163
163
  animation: none;
164
164
  transition: none;
165
165
  }
166
166
 
167
- .awsui_expand-toggle-icon_1xe88_sgtpp_153:not(#\9) {
167
+ .awsui_expand-toggle-icon_1xe88_1vxpr_153:not(#\9) {
168
168
  transform: rotate(-90deg);
169
169
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
170
170
  }
171
- .awsui_expand-toggle-icon_1xe88_sgtpp_153:not(#\9):dir(rtl) {
171
+ .awsui_expand-toggle-icon_1xe88_1vxpr_153:not(#\9):dir(rtl) {
172
172
  transform: rotate(90deg);
173
173
  }
174
- .awsui_expand-toggle-icon-expanded_1xe88_sgtpp_174:not(#\9) {
174
+ .awsui_expand-toggle-icon-expanded_1xe88_1vxpr_174:not(#\9) {
175
175
  transform: rotate(0deg);
176
176
  /* stylelint-disable-next-line plugin/no-unsupported-browser-features */
177
177
  }
178
- .awsui_expand-toggle-icon-expanded_1xe88_sgtpp_174:not(#\9):dir(rtl) {
178
+ .awsui_expand-toggle-icon-expanded_1xe88_1vxpr_174:not(#\9):dir(rtl) {
179
179
  transform: rotate(0deg);
180
180
  }
181
181
 
182
- .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9) {
182
+ .awsui_expand-toggle_1xe88_1vxpr_153:not(#\9) {
183
183
  border-collapse: separate;
184
184
  border-spacing: 0;
185
185
  box-sizing: border-box;
@@ -222,14 +222,14 @@ surrounding text. (WCAG F73) https://www.w3.org/WAI/WCAG21/Techniques/failures/F
222
222
  outline: 0;
223
223
  color: var(--color-text-interactive-default-qwoe3g, #545b64);
224
224
  }
225
- body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9):focus {
225
+ body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_1vxpr_153:not(#\9):not(.awsui_disable-focus-highlight_1xe88_1vxpr_225):focus {
226
226
  position: relative;
227
227
  }
228
- body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9):focus {
228
+ body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_1vxpr_153:not(#\9):not(.awsui_disable-focus-highlight_1xe88_1vxpr_225):focus {
229
229
  outline: 2px dotted transparent;
230
230
  outline-offset: calc(var(--space-button-focus-outline-gutter-vsdlzg, 3px) - 1px);
231
231
  }
232
- body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9):focus::before {
232
+ body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_1vxpr_153:not(#\9):not(.awsui_disable-focus-highlight_1xe88_1vxpr_225):focus::before {
233
233
  content: " ";
234
234
  display: block;
235
235
  position: absolute;
@@ -243,9 +243,9 @@ body[data-awsui-focus-visible=true] .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9
243
243
  border-end-end-radius: var(--border-radius-control-default-focus-ring-9xsko1, 2px);
244
244
  box-shadow: 0 0 0 2px var(--color-border-item-focused-r5f6xl, #0073bb);
245
245
  }
246
- .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9):hover {
246
+ .awsui_expand-toggle_1xe88_1vxpr_153:not(#\9):hover {
247
247
  color: var(--color-text-interactive-hover-bu4gls, #16191f);
248
248
  }
249
- .awsui_expand-toggle_1xe88_sgtpp_153:not(#\9):active {
249
+ .awsui_expand-toggle_1xe88_1vxpr_153:not(#\9):active {
250
250
  color: var(--color-text-interactive-active-c44vdq, #16191f);
251
251
  }
@@ -2,8 +2,9 @@
2
2
  // es-module interop with Babel and Typescript
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  module.exports.default = {
5
- "expand-toggle-icon": "awsui_expand-toggle-icon_1xe88_sgtpp_153",
6
- "expand-toggle-icon-expanded": "awsui_expand-toggle-icon-expanded_1xe88_sgtpp_174",
7
- "expand-toggle": "awsui_expand-toggle_1xe88_sgtpp_153"
5
+ "expand-toggle-icon": "awsui_expand-toggle-icon_1xe88_1vxpr_153",
6
+ "expand-toggle-icon-expanded": "awsui_expand-toggle-icon-expanded_1xe88_1vxpr_174",
7
+ "expand-toggle": "awsui_expand-toggle_1xe88_1vxpr_153",
8
+ "disable-focus-highlight": "awsui_disable-focus-highlight_1xe88_1vxpr_225"
8
9
  };
9
10
 
@@ -1,5 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { StructuredItemProps } from './interfaces';
3
3
  export { StructuredItemProps };
4
- export default function InternalStructuredItem({ content, icon, actions, secondaryContent, disablePaddings, wrapActions, }: StructuredItemProps): JSX.Element;
4
+ export default function InternalStructuredItem({ content, icon, actions, secondaryContent, disablePaddings, wrapActions, className, }: StructuredItemProps & {
5
+ className?: string;
6
+ }): JSX.Element;
5
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/structured-item/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,OAAO,EACP,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,WAAkB,GACnB,EAAE,mBAAmB,eAarB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/internal/components/structured-item/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAKnD,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAE/B,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,OAAO,EACP,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,WAAkB,EAClB,SAAS,GACV,EAAE,mBAAmB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,eAa9C"}
@@ -4,8 +4,8 @@ import React from 'react';
4
4
  import clsx from 'clsx';
5
5
  import styles from './styles.css.js';
6
6
  import testClasses from './test-classes/styles.css.js';
7
- export default function InternalStructuredItem({ content, icon, actions, secondaryContent, disablePaddings, wrapActions = true, }) {
8
- return (React.createElement("div", { className: clsx(styles.root, testClasses.root, disablePaddings && styles['disable-paddings']) },
7
+ export default function InternalStructuredItem({ content, icon, actions, secondaryContent, disablePaddings, wrapActions = true, className, }) {
8
+ return (React.createElement("div", { className: clsx(styles.root, testClasses.root, disablePaddings && styles['disable-paddings'], className) },
9
9
  icon && React.createElement("div", { className: clsx(styles.icon, testClasses.icon) }, icon),
10
10
  React.createElement("div", { className: clsx(styles.main) },
11
11
  React.createElement("div", { className: clsx(styles['content-wrap'], wrapActions && styles['wrap-actions']) },
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/structured-item/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAIvD,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,OAAO,EACP,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,WAAW,GAAG,IAAI,GACE;IACpB,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,eAAe,IAAI,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC/F,IAAI,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,IAAG,IAAI,CAAO;QAC1E,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAC/B,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;gBACjF,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,IAAG,OAAO,CAAO;gBACzE,OAAO,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,IAAG,OAAO,CAAO,CAClF;YACL,gBAAgB,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,IAAG,gBAAgB,CAAO,CACxG,CACF,CACP,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';\nimport clsx from 'clsx';\n\nimport { StructuredItemProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testClasses from './test-classes/styles.css.js';\n\nexport { StructuredItemProps };\n\nexport default function InternalStructuredItem({\n content,\n icon,\n actions,\n secondaryContent,\n disablePaddings,\n wrapActions = true,\n}: StructuredItemProps) {\n return (\n <div className={clsx(styles.root, testClasses.root, disablePaddings && styles['disable-paddings'])}>\n {icon && <div className={clsx(styles.icon, testClasses.icon)}>{icon}</div>}\n <div className={clsx(styles.main)}>\n <div className={clsx(styles['content-wrap'], wrapActions && styles['wrap-actions'])}>\n <div className={clsx(styles.content, testClasses.content)}>{content}</div>\n {actions && <div className={clsx(styles.actions, testClasses.actions)}>{actions}</div>}\n </div>\n {secondaryContent && <div className={clsx(styles.secondary, testClasses.secondary)}>{secondaryContent}</div>}\n </div>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/internal/components/structured-item/index.tsx"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,WAAW,MAAM,8BAA8B,CAAC;AAIvD,MAAM,CAAC,OAAO,UAAU,sBAAsB,CAAC,EAC7C,OAAO,EACP,IAAI,EACJ,OAAO,EACP,gBAAgB,EAChB,eAAe,EACf,WAAW,GAAG,IAAI,EAClB,SAAS,GACoC;IAC7C,OAAO,CACL,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,eAAe,IAAI,MAAM,CAAC,kBAAkB,CAAC,EAAE,SAAS,CAAC;QAC1G,IAAI,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,IAAG,IAAI,CAAO;QAC1E,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;YAC/B,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,EAAE,WAAW,IAAI,MAAM,CAAC,cAAc,CAAC,CAAC;gBACjF,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,IAAG,OAAO,CAAO;gBACzE,OAAO,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,IAAG,OAAO,CAAO,CAClF;YACL,gBAAgB,IAAI,6BAAK,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,CAAC,SAAS,CAAC,IAAG,gBAAgB,CAAO,CACxG,CACF,CACP,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';\nimport clsx from 'clsx';\n\nimport { StructuredItemProps } from './interfaces';\n\nimport styles from './styles.css.js';\nimport testClasses from './test-classes/styles.css.js';\n\nexport { StructuredItemProps };\n\nexport default function InternalStructuredItem({\n content,\n icon,\n actions,\n secondaryContent,\n disablePaddings,\n wrapActions = true,\n className,\n}: StructuredItemProps & { className?: string }) {\n return (\n <div className={clsx(styles.root, testClasses.root, disablePaddings && styles['disable-paddings'], className)}>\n {icon && <div className={clsx(styles.icon, testClasses.icon)}>{icon}</div>}\n <div className={clsx(styles.main)}>\n <div className={clsx(styles['content-wrap'], wrapActions && styles['wrap-actions'])}>\n <div className={clsx(styles.content, testClasses.content)}>{content}</div>\n {actions && <div className={clsx(styles.actions, testClasses.actions)}>{actions}</div>}\n </div>\n {secondaryContent && <div className={clsx(styles.secondary, testClasses.secondary)}>{secondaryContent}</div>}\n </div>\n </div>\n );\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  export var PACKAGE_SOURCE = "components";
2
- export var PACKAGE_VERSION = "3.0.0 (8c8796c0)";
3
- export var GIT_SHA = "8c8796c0";
2
+ export var PACKAGE_VERSION = "3.0.0 (eae5d559)";
3
+ export var GIT_SHA = "eae5d559";
4
4
  export var THEME = "open-source-visual-refresh";
5
5
  export var SYSTEM = "console";
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 (8c8796c0)",
4
- "GIT_SHA": "8c8796c0",
3
+ "PACKAGE_VERSION": "3.0.0 (eae5d559)",
4
+ "GIT_SHA": "eae5d559",
5
5
  "THEME": "default",
6
6
  "SYSTEM": "core",
7
7
  "ALWAYS_VISUAL_REFRESH": false
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tree-view/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAM7C,KAAK,qBAAqB,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC;AAE9E,QAAA,MAAM,gBAAgB,kQA6DrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../src/tree-view/internal.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAQ7C,KAAK,qBAAqB,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,GAAG,0BAA0B,CAAC;AAE9E,QAAA,MAAM,gBAAgB,kQAqErB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -1,12 +1,14 @@
1
1
  import { __rest } from "tslib";
2
2
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
3
  // SPDX-License-Identifier: Apache-2.0
4
- import React from 'react';
4
+ import React, { useRef } from 'react';
5
5
  import clsx from 'clsx';
6
6
  import { getBaseProps } from '../internal/base-component';
7
7
  import { fireNonCancelableEvent } from '../internal/events';
8
8
  import { useControllable } from '../internal/hooks/use-controllable';
9
+ import { KeyboardNavigationProvider } from './keyboard-navigation';
9
10
  import InternalTreeItem from './tree-item';
11
+ import { getAllVisibleItemsIndices } from './utils';
10
12
  import styles from './styles.css.js';
11
13
  import testUtilStyles from './test-classes/styles.css.js';
12
14
  const InternalTreeView = (_a) => {
@@ -17,6 +19,8 @@ const InternalTreeView = (_a) => {
17
19
  controlledProp: 'expandedItems',
18
20
  changeHandler: 'onItemToggle',
19
21
  });
22
+ const treeViewRefObject = useRef(null);
23
+ const allVisibleItemsIndices = getAllVisibleItemsIndices({ items, expandedItems, getItemId, getItemChildren });
20
24
  const onToggle = ({ id, item, expanded }) => {
21
25
  if (expanded) {
22
26
  setExpandedItems([...(expandedItems || []), id]);
@@ -27,9 +31,11 @@ const InternalTreeView = (_a) => {
27
31
  fireNonCancelableEvent(onItemToggle, { id, item, expanded });
28
32
  };
29
33
  return (React.createElement("div", Object.assign({}, baseProps, { ref: __internalRootRef, className: clsx(baseProps.className, styles.root, testUtilStyles.root) }),
30
- React.createElement("ul", { className: clsx(styles.tree, testUtilStyles.tree), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby }, items.map((item, index) => {
31
- return (React.createElement(InternalTreeItem, { key: index, item: item, level: 1, index: index, expandedItems: expandedItems, i18nStrings: i18nStrings, onItemToggle: onToggle, renderItem: renderItem, getItemId: getItemId, getItemChildren: getItemChildren, renderItemToggleIcon: renderItemToggleIcon }));
32
- }))));
34
+ React.createElement(KeyboardNavigationProvider, { getTreeView: () => treeViewRefObject.current },
35
+ React.createElement("ul", { role: "tree", ref: treeViewRefObject, className: clsx(styles.tree, testUtilStyles.tree), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, "aria-describedby": ariaDescribedby }, items.map((item, index) => {
36
+ const itemId = getItemId(item, index);
37
+ return (React.createElement(InternalTreeItem, { key: itemId, item: item, level: 1, index: index, expandedItems: expandedItems, i18nStrings: i18nStrings, onItemToggle: onToggle, renderItem: renderItem, getItemId: getItemId, getItemChildren: getItemChildren, renderItemToggleIcon: renderItemToggleIcon, allVisibleItemsIndices: allVisibleItemsIndices }));
38
+ })))));
33
39
  };
34
40
  export default InternalTreeView;
35
41
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tree-view/internal.tsx"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,sCAAsC;AACtC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AAErE,OAAO,gBAAgB,MAAM,aAAa,CAAC;AAE3C,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,cAAc,MAAM,8BAA8B,CAAC;AAI1D,MAAM,gBAAgB,GAAG,CAAK,EAcH,EAAE,EAAE;QAdD,EAC5B,aAAa,EAAE,uBAAuB,EACtC,KAAK,EACL,UAAU,EACV,SAAS,EACT,eAAe,EACf,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,cAAc,EACd,eAAe,EACf,WAAW,EACX,iBAAiB,OAEQ,EADtB,IAAI,cAbqB,sMAc7B,CADQ;IAEP,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAErC,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,eAAe,CAAC,uBAAuB,EAAE,YAAY,EAAE,EAAE,EAAE;QACnG,aAAa,EAAE,UAAU;QACzB,cAAc,EAAE,eAAe;QAC/B,aAAa,EAAE,cAAc;KAC9B,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAqC,EAAE,EAAE;QAC7E,IAAI,QAAQ,EAAE;YACZ,gBAAgB,CAAC,CAAC,GAAG,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;SAClD;aAAM;YACL,gBAAgB,CAAC,CAAC,aAAa,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC,CAAC;SACjF;QACD,sBAAsB,CAAC,YAAY,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC;IAEF,OAAO,CACL,6CAAS,SAAS,IAAE,GAAG,EAAE,iBAAiB,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC;QAEhH,4BACE,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,cAAc,CAAC,IAAI,CAAC,gBACrC,SAAS,qBACJ,cAAc,sBACb,eAAe,IAEhC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACzB,OAAO,CACL,oBAAC,gBAAgB,IACf,GAAG,EAAE,KAAK,EACV,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,KAAK,EACZ,aAAa,EAAE,aAAa,EAC5B,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,QAAQ,EACtB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,SAAS,EACpB,eAAe,EAAE,eAAe,EAChC,oBAAoB,EAAE,oBAAoB,GAC1C,CACH,CAAC;QACJ,CAAC,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport React from 'react';\nimport clsx from 'clsx';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { TreeViewProps } from './interfaces';\nimport InternalTreeItem from './tree-item';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ntype InternalTreeViewProps<T> = TreeViewProps<T> & InternalBaseComponentProps;\n\nconst InternalTreeView = <T,>({\n expandedItems: controlledExpandedItems,\n items,\n renderItem,\n getItemId,\n getItemChildren,\n onItemToggle,\n renderItemToggleIcon,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: InternalTreeViewProps<T>) => {\n const baseProps = getBaseProps(rest);\n\n const [expandedItems, setExpandedItems] = useControllable(controlledExpandedItems, onItemToggle, [], {\n componentName: 'TreeView',\n controlledProp: 'expandedItems',\n changeHandler: 'onItemToggle',\n });\n\n const onToggle = ({ id, item, expanded }: TreeViewProps.ItemToggleDetail<T>) => {\n if (expanded) {\n setExpandedItems([...(expandedItems || []), id]);\n } else {\n setExpandedItems((expandedItems || []).filter(expandedId => expandedId !== id));\n }\n fireNonCancelableEvent(onItemToggle, { id, item, expanded });\n };\n\n return (\n <div {...baseProps} ref={__internalRootRef} className={clsx(baseProps.className, styles.root, testUtilStyles.root)}>\n {/* Role `tree` isn't used in the initial release per discussion with A11Y team. It requires focus management to be implemented so they will be added as a follow up together. */}\n <ul\n className={clsx(styles.tree, testUtilStyles.tree)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n >\n {items.map((item, index) => {\n return (\n <InternalTreeItem\n key={index}\n item={item}\n level={1}\n index={index}\n expandedItems={expandedItems}\n i18nStrings={i18nStrings}\n onItemToggle={onToggle}\n renderItem={renderItem}\n getItemId={getItemId}\n getItemChildren={getItemChildren}\n renderItemToggleIcon={renderItemToggleIcon}\n />\n );\n })}\n </ul>\n </div>\n );\n};\n\nexport default InternalTreeView;\n"]}
1
+ {"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/tree-view/internal.tsx"],"names":[],"mappings":"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","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';\n\nimport { getBaseProps } from '../internal/base-component';\nimport { fireNonCancelableEvent } from '../internal/events';\nimport { InternalBaseComponentProps } from '../internal/hooks/use-base-component';\nimport { useControllable } from '../internal/hooks/use-controllable';\nimport { TreeViewProps } from './interfaces';\nimport { KeyboardNavigationProvider } from './keyboard-navigation';\nimport InternalTreeItem from './tree-item';\nimport { getAllVisibleItemsIndices } from './utils';\n\nimport styles from './styles.css.js';\nimport testUtilStyles from './test-classes/styles.css.js';\n\ntype InternalTreeViewProps<T> = TreeViewProps<T> & InternalBaseComponentProps;\n\nconst InternalTreeView = <T,>({\n expandedItems: controlledExpandedItems,\n items,\n renderItem,\n getItemId,\n getItemChildren,\n onItemToggle,\n renderItemToggleIcon,\n ariaLabel,\n ariaLabelledby,\n ariaDescribedby,\n i18nStrings,\n __internalRootRef,\n ...rest\n}: InternalTreeViewProps<T>) => {\n const baseProps = getBaseProps(rest);\n\n const [expandedItems, setExpandedItems] = useControllable(controlledExpandedItems, onItemToggle, [], {\n componentName: 'TreeView',\n controlledProp: 'expandedItems',\n changeHandler: 'onItemToggle',\n });\n const treeViewRefObject = useRef(null);\n\n const allVisibleItemsIndices = getAllVisibleItemsIndices({ items, expandedItems, getItemId, getItemChildren });\n\n const onToggle = ({ id, item, expanded }: TreeViewProps.ItemToggleDetail<T>) => {\n if (expanded) {\n setExpandedItems([...(expandedItems || []), id]);\n } else {\n setExpandedItems((expandedItems || []).filter(expandedId => expandedId !== id));\n }\n fireNonCancelableEvent(onItemToggle, { id, item, expanded });\n };\n\n return (\n <div {...baseProps} ref={__internalRootRef} className={clsx(baseProps.className, styles.root, testUtilStyles.root)}>\n <KeyboardNavigationProvider getTreeView={() => treeViewRefObject.current}>\n <ul\n role=\"tree\"\n ref={treeViewRefObject}\n className={clsx(styles.tree, testUtilStyles.tree)}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledby}\n aria-describedby={ariaDescribedby}\n >\n {items.map((item, index) => {\n const itemId = getItemId(item, index);\n return (\n <InternalTreeItem<T>\n key={itemId}\n item={item}\n level={1}\n index={index}\n expandedItems={expandedItems}\n i18nStrings={i18nStrings}\n onItemToggle={onToggle}\n renderItem={renderItem}\n getItemId={getItemId}\n getItemChildren={getItemChildren}\n renderItemToggleIcon={renderItemToggleIcon}\n allVisibleItemsIndices={allVisibleItemsIndices}\n />\n );\n })}\n </ul>\n </KeyboardNavigationProvider>\n </div>\n );\n};\n\nexport default InternalTreeView;\n"]}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { SingleTabStopNavigationAPI } from '@cloudscape-design/component-toolkit/internal';
3
+ export declare function KeyboardNavigationProvider({ getTreeView, children, }: {
4
+ getTreeView: () => null | HTMLUListElement;
5
+ children: React.ReactNode;
6
+ }): JSX.Element;
7
+ export declare class KeyboardNavigationProcessor {
8
+ private _treeView;
9
+ private _navigationAPI;
10
+ private focusedTreeItem;
11
+ constructor(navigationAPI: {
12
+ current: null | SingleTabStopNavigationAPI;
13
+ });
14
+ init(treeView: HTMLUListElement): void;
15
+ cleanup: () => void;
16
+ refresh(): void;
17
+ onUnregisterActive: () => void;
18
+ getNextFocusTarget: () => HTMLElement | null;
19
+ private get treeView();
20
+ private getFocusablesFrom;
21
+ private isRegistered;
22
+ private updateFocusedTreeItem;
23
+ private onFocusin;
24
+ private onKeydown;
25
+ private getNextFocusableTreeItem;
26
+ private moveFocusInsideTreeItem;
27
+ private moveFocusBetweenTreeItems;
28
+ private moveFocusToTheLastElementInsideTreeItem;
29
+ private getNextFocusableTreeItemContent;
30
+ }
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/tree-view/keyboard-navigation/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiB,MAAM,OAAO,CAAC;AAItC,OAAO,EACL,0BAA0B,EAE3B,MAAM,+CAA+C,CAAC;AAiBvD,wBAAgB,0BAA0B,CAAC,EACzC,WAAW,EACX,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,MAAM,IAAI,GAAG,gBAAgB,CAAC;IAC3C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,eA+BA;AASD,qBAAa,2BAA2B;IAEtC,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,cAAc,CAAiD;IAGvE,OAAO,CAAC,eAAe,CAAgC;gBAE3C,aAAa,EAAE;QAAE,OAAO,EAAE,IAAI,GAAG,0BAA0B,CAAA;KAAE;IAIlE,IAAI,CAAC,QAAQ,EAAE,gBAAgB;IAY/B,OAAO,aAEZ;IAEK,OAAO;IAWP,kBAAkB,aAYvB;IAEK,kBAAkB,2BAkBvB;IAEF,OAAO,KAAK,QAAQ,GAEnB;IAED,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,qBAAqB;IAoB7B,OAAO,CAAC,SAAS,CAWf;IAEF,OAAO,CAAC,SAAS,CA0Cf;IAEF,OAAO,CAAC,wBAAwB;IAQhC,OAAO,CAAC,uBAAuB;IAU/B,OAAO,CAAC,yBAAyB;IAUjC,OAAO,CAAC,uCAAuC;IAiB/C,OAAO,CAAC,+BAA+B;CA0BxC"}