igniteui-webcomponents 3.1.0 → 3.2.0

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 (132) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +6 -1
  3. package/components/button/button-base.d.ts +5 -0
  4. package/components/button/button-base.js +4 -0
  5. package/components/button/button-base.js.map +1 -1
  6. package/components/button/icon-button.js +10 -8
  7. package/components/button/icon-button.js.map +1 -1
  8. package/components/button/themes/button/light/button.base.css.js +1 -1
  9. package/components/button/themes/button/light/button.base.css.js.map +1 -1
  10. package/components/button/themes/button/light/button.material.css.js +1 -1
  11. package/components/button/themes/button/light/button.material.css.js.map +1 -1
  12. package/components/button/themes/icon-button/light/icon-button.base.css.js +1 -1
  13. package/components/button/themes/icon-button/light/icon-button.base.css.js.map +1 -1
  14. package/components/button/themes/icon-button/light/icon-button.bootstrap.css.js +1 -1
  15. package/components/button/themes/icon-button/light/icon-button.bootstrap.css.js.map +1 -1
  16. package/components/button/themes/icon-button/light/icon-button.fluent.css.js +1 -1
  17. package/components/button/themes/icon-button/light/icon-button.fluent.css.js.map +1 -1
  18. package/components/button/themes/icon-button/light/icon-button.indigo.css.js +1 -1
  19. package/components/button/themes/icon-button/light/icon-button.indigo.css.js.map +1 -1
  20. package/components/button/themes/icon-button/light/icon-button.material.css.js +1 -1
  21. package/components/button/themes/icon-button/light/icon-button.material.css.js.map +1 -1
  22. package/components/calendar/common/calendar-base.js +16 -12
  23. package/components/calendar/common/calendar-base.js.map +1 -1
  24. package/components/checkbox/themes/light/switch.base.css.js +1 -1
  25. package/components/checkbox/themes/light/switch.base.css.js.map +1 -1
  26. package/components/common/definitions/defineAllComponents.js +8 -0
  27. package/components/common/definitions/defineAllComponents.js.map +1 -1
  28. package/components/expansion-panel/expansion-panel.d.ts +72 -0
  29. package/components/expansion-panel/expansion-panel.js +167 -0
  30. package/components/expansion-panel/expansion-panel.js.map +1 -0
  31. package/components/expansion-panel/themes/light/expansion-panel.base.css.d.ts +1 -0
  32. package/components/expansion-panel/themes/light/expansion-panel.base.css.js +3 -0
  33. package/components/expansion-panel/themes/light/expansion-panel.base.css.js.map +1 -0
  34. package/components/expansion-panel/themes/light/expansion-panel.bootstrap.css.d.ts +1 -0
  35. package/components/expansion-panel/themes/light/expansion-panel.bootstrap.css.js +3 -0
  36. package/components/expansion-panel/themes/light/expansion-panel.bootstrap.css.js.map +1 -0
  37. package/components/expansion-panel/themes/light/expansion-panel.fluent.css.d.ts +1 -0
  38. package/components/expansion-panel/themes/light/expansion-panel.fluent.css.js +3 -0
  39. package/components/expansion-panel/themes/light/expansion-panel.fluent.css.js.map +1 -0
  40. package/components/expansion-panel/themes/light/expansion-panel.indigo.css.d.ts +1 -0
  41. package/components/expansion-panel/themes/light/expansion-panel.indigo.css.js +3 -0
  42. package/components/expansion-panel/themes/light/expansion-panel.indigo.css.js.map +1 -0
  43. package/components/form/form.js +10 -2
  44. package/components/form/form.js.map +1 -1
  45. package/components/icon/icon.registry.js +3 -0
  46. package/components/icon/icon.registry.js.map +1 -1
  47. package/components/input/themes/light/input.base.css.js +1 -1
  48. package/components/input/themes/light/input.base.css.js.map +1 -1
  49. package/components/list/themes/light/list.base.css.js +1 -1
  50. package/components/list/themes/light/list.base.css.js.map +1 -1
  51. package/components/mask-input/mask-input.d.ts +102 -0
  52. package/components/mask-input/mask-input.js +260 -0
  53. package/components/mask-input/mask-input.js.map +1 -0
  54. package/components/mask-input/mask-parser.d.ts +30 -0
  55. package/components/mask-input/mask-parser.js +167 -0
  56. package/components/mask-input/mask-parser.js.map +1 -0
  57. package/components/nav-drawer/nav-drawer-item.d.ts +1 -0
  58. package/components/nav-drawer/nav-drawer-item.js +5 -2
  59. package/components/nav-drawer/nav-drawer-item.js.map +1 -1
  60. package/components/nav-drawer/styles/indigo/nav-drawer-item.indigo.css.js +1 -1
  61. package/components/nav-drawer/styles/indigo/nav-drawer-item.indigo.css.js.map +1 -1
  62. package/components/nav-drawer/styles/nav-drawer-item.base.css.js +1 -1
  63. package/components/nav-drawer/styles/nav-drawer-item.base.css.js.map +1 -1
  64. package/components/nav-drawer/styles/nav-drawer.base.css.js +1 -1
  65. package/components/nav-drawer/styles/nav-drawer.base.css.js.map +1 -1
  66. package/components/navbar/navbar.js +2 -1
  67. package/components/navbar/navbar.js.map +1 -1
  68. package/components/navbar/themes/light/navbar.base.css.js +1 -1
  69. package/components/navbar/themes/light/navbar.base.css.js.map +1 -1
  70. package/components/navbar/themes/light/navbar.bootstrap.css.js +1 -1
  71. package/components/navbar/themes/light/navbar.bootstrap.css.js.map +1 -1
  72. package/components/navbar/themes/light/navbar.fluent.css.d.ts +1 -0
  73. package/components/navbar/themes/light/navbar.fluent.css.js +3 -0
  74. package/components/navbar/themes/light/navbar.fluent.css.js.map +1 -0
  75. package/components/rating/rating.base.css.js +1 -1
  76. package/components/rating/rating.base.css.js.map +1 -1
  77. package/components/rating/rating.fluent.css.js +1 -1
  78. package/components/rating/rating.fluent.css.js.map +1 -1
  79. package/components/rating/rating.js +1 -1
  80. package/components/rating/rating.js.map +1 -1
  81. package/components/toggle/toggle.directive.js +5 -4
  82. package/components/toggle/toggle.directive.js.map +1 -1
  83. package/components/tree/themes/dark/tree-item.bootstrap.css.d.ts +1 -0
  84. package/components/tree/themes/dark/tree-item.bootstrap.css.js +3 -0
  85. package/components/tree/themes/dark/tree-item.bootstrap.css.js.map +1 -0
  86. package/components/tree/themes/dark/tree-item.fluent.css.d.ts +1 -0
  87. package/components/tree/themes/dark/tree-item.fluent.css.js +3 -0
  88. package/components/tree/themes/dark/tree-item.fluent.css.js.map +1 -0
  89. package/components/tree/themes/dark/tree-item.indigo.css.d.ts +1 -0
  90. package/components/tree/themes/dark/tree-item.indigo.css.js +3 -0
  91. package/components/tree/themes/dark/tree-item.indigo.css.js.map +1 -0
  92. package/components/tree/themes/light/tree-item.base.css.d.ts +1 -0
  93. package/components/tree/themes/light/tree-item.base.css.js +3 -0
  94. package/components/tree/themes/light/tree-item.base.css.js.map +1 -0
  95. package/components/tree/themes/light/tree-item.bootstrap.css.d.ts +1 -0
  96. package/components/tree/themes/light/tree-item.bootstrap.css.js +3 -0
  97. package/components/tree/themes/light/tree-item.bootstrap.css.js.map +1 -0
  98. package/components/tree/themes/light/tree-item.fluent.css.d.ts +1 -0
  99. package/components/tree/themes/light/tree-item.fluent.css.js +3 -0
  100. package/components/tree/themes/light/tree-item.fluent.css.js.map +1 -0
  101. package/components/tree/themes/light/tree-item.indigo.css.d.ts +1 -0
  102. package/components/tree/themes/light/tree-item.indigo.css.js +3 -0
  103. package/components/tree/themes/light/tree-item.indigo.css.js.map +1 -0
  104. package/components/tree/themes/light/tree.base.css.d.ts +1 -0
  105. package/components/tree/themes/light/tree.base.css.js +3 -0
  106. package/components/tree/themes/light/tree.base.css.js.map +1 -0
  107. package/components/tree/tree-item.d.ts +116 -0
  108. package/components/tree/tree-item.js +447 -0
  109. package/components/tree/tree-item.js.map +1 -0
  110. package/components/tree/tree.common.d.ts +17 -0
  111. package/components/tree/tree.common.js +2 -0
  112. package/components/tree/tree.common.js.map +1 -0
  113. package/components/tree/tree.d.ts +71 -0
  114. package/components/tree/tree.js +139 -0
  115. package/components/tree/tree.js.map +1 -0
  116. package/components/tree/tree.navigation.d.ts +41 -0
  117. package/components/tree/tree.navigation.js +260 -0
  118. package/components/tree/tree.navigation.js.map +1 -0
  119. package/components/tree/tree.selection.d.ts +55 -0
  120. package/components/tree/tree.selection.js +265 -0
  121. package/components/tree/tree.selection.js.map +1 -0
  122. package/custom-elements.json +632 -2
  123. package/index.d.ts +4 -0
  124. package/index.js +4 -0
  125. package/index.js.map +1 -1
  126. package/package.json +2 -2
  127. package/themes/dark/bootstrap.css +1 -1
  128. package/themes/dark/fluent.css +1 -1
  129. package/themes/dark/indigo.css +1 -1
  130. package/themes/light/bootstrap.css +1 -1
  131. package/themes/light/fluent.css +1 -1
  132. package/vscode-html-custom-data.json +313 -45
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-item.fluent.css.js","sourceRoot":"","sources":["../../../../../src/components/tree/themes/light/tree-item.fluent.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,q2BAAq2B,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`[part~=active]{background:var(--active-background, hsla(var(--igc-gray-200), var(--igc-gray-a)));color:var(--active-color, var(--igc-gray-200-contrast))}[part~=selected]{background:var(--selected-background, hsla(var(--igc-gray-200), var(--igc-gray-a)));color:var(--selected-color, var(--igc-gray-200-contrast))}[part~=selected][part~=focused][part~=active],[part~=selected][part~=focused],[part~=selected][part~=active]{background:var(--active-selected-background, hsla(var(--igc-gray-300), var(--igc-gray-a)));color:var(--active-selected-color, var(--igc-gray-300-contrast))}[part~=select]{-webkit-margin-end:.5rem;margin-inline-end:.5rem}[part~=focused]{-webkit-box-shadow:inset 0 0 0 1px var(--focused-border-color, hsla(var(--igc-gray-800), var(--igc-gray-a)));box-shadow:inset 0 0 0 1px var(--focused-border-color, hsla(var(--igc-gray-800), var(--igc-gray-a)))}`;\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,3 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `[part~=active]{background:var(--active-background, hsla(var(--igc-surface-500), var(--igc-surface-a)));color:var(--active-color, hsla(var(--igc-primary-500), var(--igc-primary-a)))}[part~=active]:hover{color:var(--active-color, hsla(var(--igc-primary-500), var(--igc-primary-a)))}[part~=selected]{background:var(--selected-background, hsla(var(--igc-primary-500), var(--igc-primary-a)));color:var(--selected-color, var(--igc-primary-600-contrast))}[part~=selected][part~=focused][part~=active],[part~=selected][part~=focused],[part~=selected][part~=active]{background:var(--active-selected-background, hsla(var(--igc-primary-400), var(--igc-primary-a)));color:var(--active-selected-color, var(--igc-primary-400-contrast))}[part~=select]{-webkit-margin-end:.5rem;margin-inline-end:.5rem}[part~=focused]{-webkit-box-shadow:inset 0 0 0 1px var(--focused-border-color, hsla(var(--igc-primary-300), var(--igc-primary-a)));box-shadow:inset 0 0 0 1px var(--focused-border-color, hsla(var(--igc-primary-300), var(--igc-primary-a)))}`;
3
+ //# sourceMappingURL=tree-item.indigo.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-item.indigo.css.js","sourceRoot":"","sources":["../../../../../src/components/tree/themes/light/tree-item.indigo.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,kgCAAkgC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`[part~=active]{background:var(--active-background, hsla(var(--igc-surface-500), var(--igc-surface-a)));color:var(--active-color, hsla(var(--igc-primary-500), var(--igc-primary-a)))}[part~=active]:hover{color:var(--active-color, hsla(var(--igc-primary-500), var(--igc-primary-a)))}[part~=selected]{background:var(--selected-background, hsla(var(--igc-primary-500), var(--igc-primary-a)));color:var(--selected-color, var(--igc-primary-600-contrast))}[part~=selected][part~=focused][part~=active],[part~=selected][part~=focused],[part~=selected][part~=active]{background:var(--active-selected-background, hsla(var(--igc-primary-400), var(--igc-primary-a)));color:var(--active-selected-color, var(--igc-primary-400-contrast))}[part~=select]{-webkit-margin-end:.5rem;margin-inline-end:.5rem}[part~=focused]{-webkit-box-shadow:inset 0 0 0 1px var(--focused-border-color, hsla(var(--igc-primary-300), var(--igc-primary-a)));box-shadow:inset 0 0 0 1px var(--focused-border-color, hsla(var(--igc-primary-300), var(--igc-primary-a)))}`;\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("lit").CSSResult;
@@ -0,0 +1,3 @@
1
+ import { css } from 'lit';
2
+ export const styles = css `:host{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-width:var(--scrolbar-size, 0.875rem);scrollbar-color:var(--igc-scrollbar-thumb-color, hsla(var(--igc-gray-400), var(--igc-gray-a))) var(--igc-scrollbar-track-color, hsla(var(--igc-gray-200), var(--igc-gray-a)))}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host ::-webkit-scrollbar{width:var(--scrolbar-size, 0.875rem);height:var(--scrolbar-size, 0.875rem);background:var(--igc-scrollbar-track-color, hsla(var(--igc-gray-200), var(--igc-gray-a)))}:host ::-webkit-scrollbar-thumb{background:var(--igc-scrollbar-thumb-color, hsla(var(--igc-gray-400), var(--igc-gray-a)))}[hidden]{display:none !important}:host{display:block;height:100%;overflow:auto;font-family:var(--igc-font-family)}`;
3
+ //# sourceMappingURL=tree.base.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree.base.css.js","sourceRoot":"","sources":["../../../../../src/components/tree/themes/light/tree.base.css.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA,izBAAizB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`:host{position:relative;-webkit-box-sizing:border-box;box-sizing:border-box;scrollbar-width:var(--scrolbar-size, 0.875rem);scrollbar-color:var(--igc-scrollbar-thumb-color, hsla(var(--igc-gray-400), var(--igc-gray-a))) var(--igc-scrollbar-track-color, hsla(var(--igc-gray-200), var(--igc-gray-a)))}:host *,:host *::before,:host *::after{-webkit-box-sizing:border-box;box-sizing:border-box}:host ::-webkit-scrollbar{width:var(--scrolbar-size, 0.875rem);height:var(--scrolbar-size, 0.875rem);background:var(--igc-scrollbar-track-color, hsla(var(--igc-gray-200), var(--igc-gray-a)))}:host ::-webkit-scrollbar-thumb{background:var(--igc-scrollbar-thumb-color, hsla(var(--igc-gray-400), var(--igc-gray-a)))}[hidden]{display:none !important}:host{display:block;height:100%;overflow:auto;font-family:var(--igc-font-family)}`;\n"]}
@@ -0,0 +1,116 @@
1
+ import { LitElement } from 'lit';
2
+ import type IgcTreeComponent from './tree.js';
3
+ /**
4
+ * The tree-item component represents a child item of the tree component or another tree item.
5
+ *
6
+ * @element igc-tree-item
7
+ *
8
+ * @slot - Renders nested tree-item component.
9
+ * @slot label - Renders the tree item container.
10
+ * @slot indicator - Renders the expand indicator container.
11
+ * @slot loading - Renders the tree item loading indicator container.
12
+ * @slot indentation - Renders the container (by default the space) before the tree item.
13
+ *
14
+ * @csspart wrapper - The wrapper for the tree item.
15
+ * @csspart selected - Indicates selected state. Applies to `wrapper`.
16
+ * @csspart focused - Indicates focused state. Applies to `wrapper`.
17
+ * @csspart active - Indicates an active state. Applies to `wrapper`.
18
+ * @csspart indicator - The expand indicator of the tree item.
19
+ * @csspart label - The tree item content.
20
+ * @csspart text - The tree item displayed text.
21
+ * @csspart select - The checkbox of the tree item when selection is enabled.
22
+ */
23
+ export default class IgcTreeItemComponent extends LitElement {
24
+ /** @private */
25
+ static readonly tagName = "igc-tree-item";
26
+ /** @private */
27
+ static styles: import("lit").CSSResult;
28
+ private tabbableEl?;
29
+ private focusedProgrammatically;
30
+ /** A reference to the tree the item is a part of. */
31
+ tree?: IgcTreeComponent;
32
+ /** The parent item of the current tree item (if any) */
33
+ parent: IgcTreeItemComponent | null;
34
+ /** @private */
35
+ init: boolean;
36
+ private contentList;
37
+ /** @private */
38
+ wrapper: HTMLElement;
39
+ private isFocused;
40
+ /** @private */
41
+ hasChildren: boolean;
42
+ /** The depth of the item, relative to the root. */
43
+ level: number;
44
+ /** @private */
45
+ indeterminate: boolean;
46
+ /** The tree item label. */
47
+ label: string;
48
+ /** The tree item expansion state. */
49
+ expanded: boolean;
50
+ /** Marks the item as the tree's active item. */
51
+ active: boolean;
52
+ /** Get/Set whether the tree item is disabled. Disabled items are ignored for user interactions. */
53
+ disabled: boolean;
54
+ /** The tree item selection state. */
55
+ selected: boolean;
56
+ /** To be used for load-on-demand scenarios in order to specify whether the item is loading data. */
57
+ loading: boolean;
58
+ /**
59
+ * The value entry that the tree item is visualizing. Required for searching through items.
60
+ * @type any
61
+ */
62
+ value: any;
63
+ protected bothChange(): void;
64
+ protected expandedChange(oldValue: boolean): void;
65
+ protected activeChange(): void;
66
+ protected disabledChange(): void;
67
+ protected selectedChange(): void;
68
+ connectedCallback(): void;
69
+ disconnectedCallback(): void;
70
+ private get selectionService();
71
+ private get navService();
72
+ private get parts();
73
+ private get directChildren();
74
+ private get allChildren();
75
+ /** The full path to the tree item, starting from the top-most ancestor. */
76
+ get path(): IgcTreeItemComponent[];
77
+ private pointerDown;
78
+ private expandIndicatorClick;
79
+ private selectorClick;
80
+ private onFocus;
81
+ private onBlur;
82
+ private onFocusIn;
83
+ private onFocusOut;
84
+ private labelChange;
85
+ private handleChange;
86
+ /**
87
+ * Returns a collection of child items.
88
+ * If the parameter value is true returns all tree item's direct children,
89
+ * otherwise - only the direct children.
90
+ */
91
+ getChildren(options?: {
92
+ flatten: boolean;
93
+ }): IgcTreeItemComponent[];
94
+ /**
95
+ * @private
96
+ * Expands the tree item.
97
+ */
98
+ expandWithEvent(): void;
99
+ /**
100
+ * @private
101
+ * Collapses the tree item.
102
+ */
103
+ collapseWithEvent(): void;
104
+ /** Toggles tree item expansion state. */
105
+ toggle(): void;
106
+ /** Expands the tree item. */
107
+ expand(): void;
108
+ /** Collapses the tree item. */
109
+ collapse(): void;
110
+ protected render(): import("lit-html").TemplateResult<1>;
111
+ }
112
+ declare global {
113
+ interface HTMLElementTagNameMap {
114
+ 'igc-tree-item': IgcTreeItemComponent;
115
+ }
116
+ }
@@ -0,0 +1,447 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { property, query, queryAssignedElements, state, } from 'lit/decorators.js';
8
+ import { html, LitElement } from 'lit';
9
+ import { partNameMap } from '../common/util.js';
10
+ import { styles } from './themes/light/tree-item.base.css.js';
11
+ import { styles as bootstrap } from './themes/light/tree-item.bootstrap.css.js';
12
+ import { styles as fluent } from './themes/light/tree-item.fluent.css.js';
13
+ import { styles as indigo } from './themes/light/tree-item.indigo.css.js';
14
+ import { watch } from '../common/decorators/watch.js';
15
+ import { themes } from '../../theming/theming-decorator.js';
16
+ const sizeMultiplier = {
17
+ small: 1 / 2,
18
+ medium: 2 / 3,
19
+ large: 1,
20
+ };
21
+ let IgcTreeItemComponent = class IgcTreeItemComponent extends LitElement {
22
+ constructor() {
23
+ super(...arguments);
24
+ this.focusedProgrammatically = false;
25
+ this.parent = null;
26
+ this.init = false;
27
+ this.isFocused = false;
28
+ this.hasChildren = false;
29
+ this.level = 0;
30
+ this.indeterminate = false;
31
+ this.label = '';
32
+ this.expanded = false;
33
+ this.active = false;
34
+ this.disabled = false;
35
+ this.selected = false;
36
+ this.loading = false;
37
+ this.value = undefined;
38
+ }
39
+ bothChange() {
40
+ if (this.hasChildren) {
41
+ this.setAttribute('aria-expanded', this.expanded.toString());
42
+ }
43
+ else {
44
+ this.removeAttribute('aria-expanded');
45
+ }
46
+ }
47
+ expandedChange(oldValue) {
48
+ var _a;
49
+ (_a = this.navService) === null || _a === void 0 ? void 0 : _a.update_visible_cache(this, this.expanded);
50
+ if (!oldValue) {
51
+ return;
52
+ }
53
+ Promise.resolve().then(() => {
54
+ var _a, _b, _c, _d;
55
+ if (((_a = this.navService) === null || _a === void 0 ? void 0 : _a.focusedItem) !== this && !this.isFocused) {
56
+ (_d = (_c = (_b = this.navService) === null || _b === void 0 ? void 0 : _b.focusedItem) === null || _c === void 0 ? void 0 : _c.wrapper) === null || _d === void 0 ? void 0 : _d.scrollIntoView({
57
+ behavior: 'smooth',
58
+ block: 'nearest',
59
+ inline: 'nearest',
60
+ });
61
+ }
62
+ });
63
+ }
64
+ activeChange() {
65
+ var _a, _b;
66
+ if ((this.active && ((_a = this.navService) === null || _a === void 0 ? void 0 : _a.activeItem) === this) || !this.active) {
67
+ return;
68
+ }
69
+ if (this.navService) {
70
+ this.navService.setActiveItem(this, false);
71
+ }
72
+ (_b = this.tree) === null || _b === void 0 ? void 0 : _b.expandToItem(this);
73
+ Promise.resolve().then(() => {
74
+ var _a;
75
+ (_a = this.wrapper) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
76
+ behavior: 'smooth',
77
+ block: 'nearest',
78
+ inline: 'nearest',
79
+ });
80
+ });
81
+ }
82
+ disabledChange() {
83
+ var _a;
84
+ (_a = this.navService) === null || _a === void 0 ? void 0 : _a.update_disabled_cache(this);
85
+ }
86
+ selectedChange() {
87
+ var _a, _b, _c, _d;
88
+ if (this.selected && !((_a = this.selectionService) === null || _a === void 0 ? void 0 : _a.isItemSelected(this))) {
89
+ (_b = this.selectionService) === null || _b === void 0 ? void 0 : _b.selectItemsWithNoEvent([this]);
90
+ }
91
+ if (!this.selected && ((_c = this.selectionService) === null || _c === void 0 ? void 0 : _c.isItemSelected(this))) {
92
+ (_d = this.selectionService) === null || _d === void 0 ? void 0 : _d.deselectItemsWithNoEvent([this]);
93
+ }
94
+ }
95
+ connectedCallback() {
96
+ var _a, _b;
97
+ super.connectedCallback();
98
+ this.tree = this.closest('igc-tree');
99
+ this.parent =
100
+ ((_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.tagName.toLowerCase()) === 'igc-tree-item'
101
+ ? this.parentElement
102
+ : null;
103
+ this.level = this.parent ? this.parent.level + 1 : 0;
104
+ this.setAttribute('role', 'treeitem');
105
+ this.addEventListener('blur', this.onBlur);
106
+ this.addEventListener('focus', this.onFocus);
107
+ this.addEventListener('pointerdown', this.pointerDown);
108
+ this.activeChange();
109
+ if (this.init) {
110
+ this.selectedChange();
111
+ }
112
+ else {
113
+ (_b = this.selectionService) === null || _b === void 0 ? void 0 : _b.retriggerItemState(this);
114
+ }
115
+ this.init = false;
116
+ }
117
+ disconnectedCallback() {
118
+ var _a, _b;
119
+ super.disconnectedCallback();
120
+ (_a = this.selectionService) === null || _a === void 0 ? void 0 : _a.ensureStateOnItemDelete(this);
121
+ (_b = this.navService) === null || _b === void 0 ? void 0 : _b.delete_item(this);
122
+ }
123
+ get selectionService() {
124
+ var _a;
125
+ return (_a = this.tree) === null || _a === void 0 ? void 0 : _a.selectionService;
126
+ }
127
+ get navService() {
128
+ var _a;
129
+ return (_a = this.tree) === null || _a === void 0 ? void 0 : _a.navService;
130
+ }
131
+ get parts() {
132
+ return {
133
+ selected: this.selected,
134
+ focused: this.isFocused,
135
+ active: this.active,
136
+ };
137
+ }
138
+ get directChildren() {
139
+ return Array.from(this.children).filter((x) => x.tagName.toLowerCase() === 'igc-tree-item');
140
+ }
141
+ get allChildren() {
142
+ return Array.from(this.querySelectorAll(`igc-tree-item`));
143
+ }
144
+ get path() {
145
+ var _a;
146
+ return ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.path) ? [...this.parent.path, this] : [this];
147
+ }
148
+ pointerDown(event) {
149
+ var _a;
150
+ event.stopPropagation();
151
+ if (this.disabled) {
152
+ return;
153
+ }
154
+ this.tabIndex = 0;
155
+ (_a = this.navService) === null || _a === void 0 ? void 0 : _a.setFocusedAndActiveItem(this, true, false);
156
+ }
157
+ expandIndicatorClick() {
158
+ if (this.disabled) {
159
+ return;
160
+ }
161
+ if (this.expanded) {
162
+ this.collapseWithEvent();
163
+ }
164
+ else {
165
+ this.expandWithEvent();
166
+ }
167
+ }
168
+ selectorClick(event) {
169
+ var _a, _b, _c;
170
+ event.preventDefault();
171
+ if (event.shiftKey) {
172
+ (_a = this.selectionService) === null || _a === void 0 ? void 0 : _a.selectMultipleItems(this);
173
+ return;
174
+ }
175
+ if (this.selected) {
176
+ (_b = this.selectionService) === null || _b === void 0 ? void 0 : _b.deselectItem(this);
177
+ }
178
+ else {
179
+ (_c = this.selectionService) === null || _c === void 0 ? void 0 : _c.selectItem(this);
180
+ }
181
+ }
182
+ onFocus() {
183
+ var _a, _b, _c;
184
+ if (this.disabled) {
185
+ return;
186
+ }
187
+ if (((_a = this.navService) === null || _a === void 0 ? void 0 : _a.focusedItem) !== this) {
188
+ (_b = this.navService) === null || _b === void 0 ? void 0 : _b.focusItem(this, false);
189
+ (_c = this.wrapper) === null || _c === void 0 ? void 0 : _c.scrollIntoView({
190
+ behavior: 'smooth',
191
+ block: 'nearest',
192
+ inline: 'nearest',
193
+ });
194
+ }
195
+ if (this.tabbableEl && this.tabbableEl.length) {
196
+ this.tabbableEl.forEach((element) => {
197
+ element.tabIndex = 0;
198
+ });
199
+ this.focusedProgrammatically = true;
200
+ this.tabbableEl[0].focus();
201
+ return;
202
+ }
203
+ this.isFocused = true;
204
+ }
205
+ onBlur() {
206
+ this.isFocused = false;
207
+ }
208
+ onFocusIn(ev) {
209
+ var _a;
210
+ ev === null || ev === void 0 ? void 0 : ev.stopPropagation();
211
+ if (!this.disabled) {
212
+ if (!this.focusedProgrammatically) {
213
+ (_a = this.tabbableEl) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
214
+ element.tabIndex = 0;
215
+ });
216
+ }
217
+ this.removeAttribute('tabIndex');
218
+ this.isFocused = true;
219
+ this.focusedProgrammatically = false;
220
+ }
221
+ }
222
+ onFocusOut(ev) {
223
+ var _a, _b;
224
+ ev === null || ev === void 0 ? void 0 : ev.stopPropagation();
225
+ this.isFocused = false;
226
+ (_a = this.tabbableEl) === null || _a === void 0 ? void 0 : _a.forEach((element) => {
227
+ element.tabIndex = -1;
228
+ });
229
+ if (((_b = this.navService) === null || _b === void 0 ? void 0 : _b.focusedItem) === this) {
230
+ this.setAttribute('tabindex', '0');
231
+ }
232
+ }
233
+ labelChange() {
234
+ const firstElement = this.contentList[0];
235
+ const tabbableSelector = 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex="-1"])';
236
+ this.tabbableEl = [
237
+ ...firstElement.querySelectorAll(tabbableSelector),
238
+ ];
239
+ if (firstElement.matches(tabbableSelector)) {
240
+ this.tabbableEl.splice(0, 0, firstElement);
241
+ }
242
+ if (this.tabbableEl && this.tabbableEl.length) {
243
+ this.setAttribute('role', 'none');
244
+ this.tabbableEl[0].setAttribute('role', 'treeitem');
245
+ this.tabbableEl.forEach((element) => {
246
+ element.tabIndex = -1;
247
+ });
248
+ }
249
+ else {
250
+ this.setAttribute('role', 'treeitem');
251
+ }
252
+ }
253
+ handleChange() {
254
+ var _a;
255
+ this.hasChildren = !!this.directChildren.length;
256
+ (_a = this.navService) === null || _a === void 0 ? void 0 : _a.update_visible_cache(this, this.expanded, false);
257
+ }
258
+ getChildren(options = { flatten: false }) {
259
+ if (options.flatten) {
260
+ return this.allChildren;
261
+ }
262
+ else {
263
+ return this.directChildren;
264
+ }
265
+ }
266
+ expandWithEvent() {
267
+ var _a, _b, _c;
268
+ if (this.expanded) {
269
+ return;
270
+ }
271
+ const args = {
272
+ detail: this,
273
+ cancelable: true,
274
+ };
275
+ const allowed = (_a = this.tree) === null || _a === void 0 ? void 0 : _a.emitEvent('igcItemExpanding', args);
276
+ if (!allowed) {
277
+ return;
278
+ }
279
+ if ((_b = this.tree) === null || _b === void 0 ? void 0 : _b.singleBranchExpand) {
280
+ const pathSet = new Set(this.path.splice(0, this.path.length - 1));
281
+ this.tree.items.forEach((item) => {
282
+ if (!pathSet.has(item)) {
283
+ item.collapseWithEvent();
284
+ }
285
+ });
286
+ }
287
+ this.expanded = true;
288
+ (_c = this.tree) === null || _c === void 0 ? void 0 : _c.emitEvent('igcItemExpanded', { detail: this });
289
+ }
290
+ collapseWithEvent() {
291
+ var _a, _b;
292
+ if (!this.expanded) {
293
+ return;
294
+ }
295
+ const args = {
296
+ detail: this,
297
+ cancelable: true,
298
+ };
299
+ const allowed = (_a = this.tree) === null || _a === void 0 ? void 0 : _a.emitEvent('igcItemCollapsing', args);
300
+ if (!allowed) {
301
+ return;
302
+ }
303
+ this.expanded = false;
304
+ (_b = this.tree) === null || _b === void 0 ? void 0 : _b.emitEvent('igcItemCollapsed', { detail: this });
305
+ }
306
+ toggle() {
307
+ this.expanded = !this.expanded;
308
+ }
309
+ expand() {
310
+ this.expanded = true;
311
+ }
312
+ collapse() {
313
+ this.expanded = false;
314
+ }
315
+ render() {
316
+ var _a, _b, _c;
317
+ const size = this.level * (this.tree ? sizeMultiplier[this.tree.size] : 1);
318
+ return html `
319
+ <div
320
+ id="wrapper"
321
+ part="wrapper ${(_a = this.tree) === null || _a === void 0 ? void 0 : _a.size} ${partNameMap(this.parts)}"
322
+ >
323
+ <div
324
+ style="width: calc(${size} * var(--igc-tree-indentation-size))"
325
+ part="indentation"
326
+ aria-hidden="true"
327
+ >
328
+ <slot name="indentation"></slot>
329
+ </div>
330
+ <div part="indicator" aria-hidden="true">
331
+ ${this.loading
332
+ ? html `
333
+ <slot name="loading">
334
+ <igc-circular-progress indeterminate></igc-circular-progress>
335
+ </slot>
336
+ `
337
+ : html `
338
+ <slot name="indicator" @click=${this.expandIndicatorClick}>
339
+ ${this.hasChildren
340
+ ? html `
341
+ <igc-icon
342
+ name=${this.expanded
343
+ ? 'keyboard_arrow_down'
344
+ : ((_b = this.tree) === null || _b === void 0 ? void 0 : _b.dir) === 'rtl'
345
+ ? 'navigate_before'
346
+ : 'keyboard_arrow_right'}
347
+ collection="internal"
348
+ >
349
+ </igc-icon>
350
+ `
351
+ : ''}
352
+ </slot>
353
+ `}
354
+ </div>
355
+ ${((_c = this.tree) === null || _c === void 0 ? void 0 : _c.selection) !== 'none'
356
+ ? html `
357
+ <div part="select" aria-hidden="true">
358
+ <igc-checkbox
359
+ @click=${this.selectorClick}
360
+ .checked=${this.selected}
361
+ .indeterminate=${this.indeterminate}
362
+ .disabled=${this.disabled}
363
+ tabindex="-1"
364
+ >
365
+ </igc-checkbox>
366
+ </div>
367
+ `
368
+ : ''}
369
+ <div part="label">
370
+ <slot
371
+ name="label"
372
+ @slotchange=${this.labelChange}
373
+ @focusin=${this.onFocusIn}
374
+ @focusout=${this.onFocusOut}
375
+ >
376
+ <span part="text">${this.label}</span>
377
+ </slot>
378
+ </div>
379
+ </div>
380
+ <div role="group">
381
+ <slot @slotchange=${this.handleChange} ?hidden=${!this.expanded}></slot>
382
+ </div>
383
+ `;
384
+ }
385
+ };
386
+ IgcTreeItemComponent.tagName = 'igc-tree-item';
387
+ IgcTreeItemComponent.styles = styles;
388
+ __decorate([
389
+ queryAssignedElements({ slot: 'label', flatten: true })
390
+ ], IgcTreeItemComponent.prototype, "contentList", void 0);
391
+ __decorate([
392
+ query('#wrapper')
393
+ ], IgcTreeItemComponent.prototype, "wrapper", void 0);
394
+ __decorate([
395
+ state()
396
+ ], IgcTreeItemComponent.prototype, "isFocused", void 0);
397
+ __decorate([
398
+ state()
399
+ ], IgcTreeItemComponent.prototype, "hasChildren", void 0);
400
+ __decorate([
401
+ state()
402
+ ], IgcTreeItemComponent.prototype, "level", void 0);
403
+ __decorate([
404
+ state()
405
+ ], IgcTreeItemComponent.prototype, "indeterminate", void 0);
406
+ __decorate([
407
+ property()
408
+ ], IgcTreeItemComponent.prototype, "label", void 0);
409
+ __decorate([
410
+ property({ reflect: true, type: Boolean })
411
+ ], IgcTreeItemComponent.prototype, "expanded", void 0);
412
+ __decorate([
413
+ property({ reflect: true, type: Boolean })
414
+ ], IgcTreeItemComponent.prototype, "active", void 0);
415
+ __decorate([
416
+ property({ reflect: true, type: Boolean })
417
+ ], IgcTreeItemComponent.prototype, "disabled", void 0);
418
+ __decorate([
419
+ property({ reflect: true, type: Boolean })
420
+ ], IgcTreeItemComponent.prototype, "selected", void 0);
421
+ __decorate([
422
+ property({ reflect: true, type: Boolean })
423
+ ], IgcTreeItemComponent.prototype, "loading", void 0);
424
+ __decorate([
425
+ property({ attribute: true })
426
+ ], IgcTreeItemComponent.prototype, "value", void 0);
427
+ __decorate([
428
+ watch('expanded', { waitUntilFirstUpdate: true }),
429
+ watch('hasChildren', { waitUntilFirstUpdate: true })
430
+ ], IgcTreeItemComponent.prototype, "bothChange", null);
431
+ __decorate([
432
+ watch('expanded')
433
+ ], IgcTreeItemComponent.prototype, "expandedChange", null);
434
+ __decorate([
435
+ watch('active', { waitUntilFirstUpdate: true })
436
+ ], IgcTreeItemComponent.prototype, "activeChange", null);
437
+ __decorate([
438
+ watch('disabled')
439
+ ], IgcTreeItemComponent.prototype, "disabledChange", null);
440
+ __decorate([
441
+ watch('selected', { waitUntilFirstUpdate: true })
442
+ ], IgcTreeItemComponent.prototype, "selectedChange", null);
443
+ IgcTreeItemComponent = __decorate([
444
+ themes({ bootstrap, fluent, indigo })
445
+ ], IgcTreeItemComponent);
446
+ export default IgcTreeItemComponent;
447
+ //# sourceMappingURL=tree-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tree-item.js","sourceRoot":"","sources":["../../../src/components/tree/tree-item.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,QAAQ,EACR,KAAK,EACL,qBAAqB,EACrB,KAAK,GACN,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAC9D,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,2CAA2C,CAAC;AAChF,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAC1E,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,wCAAwC,CAAC;AAE1E,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AAGtD,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAE5D,MAAM,cAAc,GAAiD;IACnE,KAAK,EAAE,CAAC,GAAG,CAAC;IACZ,MAAM,EAAE,CAAC,GAAG,CAAC;IACb,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,oBAAoB,EAAE,IAAI,EAAE,CAAC;0DAQjD;AApIkB,oBAAoB;IADxC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;GACjB,oBAAoB,CAqdxC;eArdoB,oBAAoB","sourcesContent":["import {\n property,\n query,\n queryAssignedElements,\n state,\n} from 'lit/decorators.js';\nimport { html, LitElement } from 'lit';\nimport { partNameMap } from '../common/util.js';\nimport { styles } from './themes/light/tree-item.base.css.js';\nimport { styles as bootstrap } from './themes/light/tree-item.bootstrap.css.js';\nimport { styles as fluent } from './themes/light/tree-item.fluent.css.js';\nimport { styles as indigo } from './themes/light/tree-item.indigo.css.js';\nimport type IgcTreeComponent from './tree.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { IgcTreeSelectionService } from './tree.selection.js';\nimport { IgcTreeNavigationService } from './tree.navigation.js';\nimport { themes } from '../../theming/theming-decorator.js';\n\nconst sizeMultiplier: Record<'small' | 'medium' | 'large', number> = {\n small: 1 / 2,\n medium: 2 / 3,\n large: 1,\n};\n\n/**\n * The tree-item component represents a child item of the tree component or another tree item.\n *\n * @element igc-tree-item\n *\n * @slot - Renders nested tree-item component.\n * @slot label - Renders the tree item container.\n * @slot indicator - Renders the expand indicator container.\n * @slot loading - Renders the tree item loading indicator container.\n * @slot indentation - Renders the container (by default the space) before the tree item.\n *\n * @csspart wrapper - The wrapper for the tree item.\n * @csspart selected - Indicates selected state. Applies to `wrapper`.\n * @csspart focused - Indicates focused state. Applies to `wrapper`.\n * @csspart active - Indicates an active state. Applies to `wrapper`.\n * @csspart indicator - The expand indicator of the tree item.\n * @csspart label - The tree item content.\n * @csspart text - The tree item displayed text.\n * @csspart select - The checkbox of the tree item when selection is enabled.\n */\n@themes({ bootstrap, fluent, indigo })\nexport default class IgcTreeItemComponent extends LitElement {\n /** @private */\n public static readonly tagName = 'igc-tree-item';\n /** @private */\n public static override styles = styles;\n\n private tabbableEl?: HTMLElement[];\n private focusedProgrammatically = false;\n\n /** A reference to the tree the item is a part of. */\n public tree?: IgcTreeComponent;\n /** The parent item of the current tree item (if any) */\n public parent: IgcTreeItemComponent | null = null;\n\n /** @private */\n public init = false;\n\n @queryAssignedElements({ slot: 'label', flatten: true })\n private contentList!: Array<HTMLElement>;\n\n /** @private */\n @query('#wrapper')\n public wrapper!: HTMLElement;\n\n @state()\n private isFocused = false;\n\n /** @private */\n @state()\n public hasChildren = false;\n\n /** The depth of the item, relative to the root. */\n @state()\n public level = 0;\n\n /** @private */\n @state()\n public indeterminate = false;\n\n /** The tree item label. */\n @property()\n public label = '';\n\n /** The tree item expansion state. */\n @property({ reflect: true, type: Boolean })\n public expanded = false;\n\n /** Marks the item as the tree's active item. */\n @property({ reflect: true, type: Boolean })\n public active = false;\n\n /** Get/Set whether the tree item is disabled. Disabled items are ignored for user interactions. */\n @property({ reflect: true, type: Boolean })\n public disabled = false;\n\n /** The tree item selection state. */\n @property({ reflect: true, type: Boolean })\n public selected = false;\n\n /** To be used for load-on-demand scenarios in order to specify whether the item is loading data. */\n @property({ reflect: true, type: Boolean })\n public loading = false;\n\n /**\n * The value entry that the tree item is visualizing. Required for searching through items.\n * @type any\n */\n @property({ attribute: true })\n public value: any = undefined;\n\n @watch('expanded', { waitUntilFirstUpdate: true })\n @watch('hasChildren', { waitUntilFirstUpdate: true })\n protected bothChange(): void {\n if (this.hasChildren) {\n this.setAttribute('aria-expanded', this.expanded.toString());\n } else {\n this.removeAttribute('aria-expanded');\n }\n }\n\n @watch('expanded')\n protected expandedChange(oldValue: boolean): void {\n // always update the visible cache\n this.navService?.update_visible_cache(this, this.expanded);\n if (!oldValue) {\n return;\n }\n // await for load on demand children\n Promise.resolve().then(() => {\n if (this.navService?.focusedItem !== this && !this.isFocused) {\n this.navService?.focusedItem?.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n });\n }\n\n @watch('active', { waitUntilFirstUpdate: true })\n protected activeChange(): void {\n if ((this.active && this.navService?.activeItem === this) || !this.active) {\n return;\n }\n if (this.navService) {\n this.navService.setActiveItem(this, false);\n }\n // Expand and scroll to the newly active item\n this.tree?.expandToItem(this);\n // Await for expanding\n Promise.resolve().then(() => {\n this.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n });\n }\n\n @watch('disabled')\n protected disabledChange(): void {\n this.navService?.update_disabled_cache(this);\n }\n\n @watch('selected', { waitUntilFirstUpdate: true })\n protected selectedChange(): void {\n if (this.selected && !this.selectionService?.isItemSelected(this)) {\n this.selectionService?.selectItemsWithNoEvent([this]);\n }\n if (!this.selected && this.selectionService?.isItemSelected(this)) {\n this.selectionService?.deselectItemsWithNoEvent([this]);\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.tree = this.closest('igc-tree') as IgcTreeComponent;\n this.parent =\n this.parentElement?.tagName.toLowerCase() === 'igc-tree-item'\n ? (this.parentElement as IgcTreeItemComponent)\n : null;\n this.level = this.parent ? this.parent.level + 1 : 0;\n this.setAttribute('role', 'treeitem');\n this.addEventListener('blur', this.onBlur);\n this.addEventListener('focus', this.onFocus);\n this.addEventListener('pointerdown', this.pointerDown);\n this.activeChange();\n // if the item is not added/moved runtime\n if (this.init) {\n this.selectedChange();\n } else {\n // retriger the item selection state in order to update the collections within the selectionService\n // and to handle correctly the itemParents recursively to the top-most ancestor\n this.selectionService?.retriggerItemState(this);\n }\n this.init = false;\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n this.selectionService?.ensureStateOnItemDelete(this);\n this.navService?.delete_item(this);\n }\n\n private get selectionService(): IgcTreeSelectionService | undefined {\n return this.tree?.selectionService;\n }\n\n private get navService(): IgcTreeNavigationService | undefined {\n return this.tree?.navService;\n }\n\n private get parts() {\n return {\n selected: this.selected,\n focused: this.isFocused,\n active: this.active,\n };\n }\n\n private get directChildren(): Array<IgcTreeItemComponent> {\n return Array.from(this.children).filter(\n (x) => x.tagName.toLowerCase() === 'igc-tree-item'\n ) as IgcTreeItemComponent[];\n }\n\n private get allChildren(): Array<IgcTreeItemComponent> {\n return Array.from(this.querySelectorAll(`igc-tree-item`));\n }\n\n /** The full path to the tree item, starting from the top-most ancestor. */\n public get path(): IgcTreeItemComponent[] {\n return this.parent?.path ? [...this.parent.path, this] : [this];\n }\n\n private pointerDown(event: MouseEvent): void {\n event.stopPropagation();\n if (this.disabled) {\n return;\n }\n this.tabIndex = 0;\n this.navService?.setFocusedAndActiveItem(this, true, false);\n }\n\n private expandIndicatorClick(): void {\n if (this.disabled) {\n return;\n }\n if (this.expanded) {\n this.collapseWithEvent();\n } else {\n this.expandWithEvent();\n }\n }\n\n private selectorClick(event: MouseEvent): void {\n event.preventDefault();\n if (event.shiftKey) {\n this.selectionService?.selectMultipleItems(this);\n return;\n }\n if (this.selected) {\n this.selectionService?.deselectItem(this);\n } else {\n this.selectionService?.selectItem(this);\n }\n }\n\n private onFocus(): void {\n if (this.disabled) {\n return;\n }\n if (this.navService?.focusedItem !== this) {\n this.navService?.focusItem(this, false);\n this.wrapper?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n if (this.tabbableEl && this.tabbableEl.length) {\n // set tabIndex = 0 to all tabbable elements\n // focus the first one\n this.tabbableEl.forEach((element: HTMLElement) => {\n element.tabIndex = 0;\n });\n this.focusedProgrammatically = true;\n this.tabbableEl[0].focus();\n return;\n }\n this.isFocused = true;\n }\n\n private onBlur(): void {\n this.isFocused = false;\n }\n\n private onFocusIn(ev: Event): void {\n ev?.stopPropagation();\n if (!this.disabled) {\n // clicking directly over tabbable element when the item is not focused\n if (!this.focusedProgrammatically) {\n this.tabbableEl?.forEach((element: HTMLElement) => {\n element.tabIndex = 0;\n });\n }\n this.removeAttribute('tabIndex');\n this.isFocused = true;\n this.focusedProgrammatically = false;\n }\n }\n\n private onFocusOut(ev: Event): void {\n ev?.stopPropagation();\n this.isFocused = false;\n this.tabbableEl?.forEach((element: HTMLElement) => {\n element.tabIndex = -1;\n });\n\n if (this.navService?.focusedItem === this) {\n // called twice when clicking on already focused item with link (pointerDown handler)\n this.setAttribute('tabindex', '0');\n }\n }\n\n private labelChange(): void {\n const firstElement = this.contentList[0];\n const tabbableSelector =\n 'a[href], button, input, textarea, select, details, [tabindex]:not([tabindex=\"-1\"])';\n\n this.tabbableEl = [\n ...firstElement.querySelectorAll<HTMLElement>(tabbableSelector),\n ];\n if (firstElement.matches(tabbableSelector)) {\n this.tabbableEl.splice(0, 0, firstElement);\n }\n\n if (this.tabbableEl && this.tabbableEl.length) {\n this.setAttribute('role', 'none');\n this.tabbableEl[0].setAttribute('role', 'treeitem');\n\n this.tabbableEl.forEach((element: HTMLElement) => {\n element.tabIndex = -1;\n });\n } else {\n this.setAttribute('role', 'treeitem');\n }\n }\n\n private handleChange(): void {\n this.hasChildren = !!this.directChildren.length;\n // there is no need to update nested children beacuse they're state is already up to date\n this.navService?.update_visible_cache(this, this.expanded, false);\n }\n\n /**\n * Returns a collection of child items.\n * If the parameter value is true returns all tree item's direct children,\n * otherwise - only the direct children.\n */\n public getChildren(\n options: { flatten: boolean } = { flatten: false }\n ): IgcTreeItemComponent[] {\n if (options.flatten) {\n return this.allChildren;\n } else {\n return this.directChildren;\n }\n }\n\n /**\n * @private\n * Expands the tree item.\n */\n public expandWithEvent(): void {\n if (this.expanded) {\n return;\n }\n const args = {\n detail: this,\n cancelable: true,\n };\n\n const allowed = this.tree?.emitEvent('igcItemExpanding', args);\n\n if (!allowed) {\n return;\n }\n\n if (this.tree?.singleBranchExpand) {\n const pathSet = new Set(this.path.splice(0, this.path.length - 1));\n this.tree.items.forEach((item: IgcTreeItemComponent) => {\n if (!pathSet.has(item)) {\n item.collapseWithEvent();\n }\n });\n }\n\n this.expanded = true;\n this.tree?.emitEvent('igcItemExpanded', { detail: this });\n }\n\n /**\n * @private\n * Collapses the tree item.\n */\n public collapseWithEvent(): void {\n if (!this.expanded) {\n return;\n }\n const args = {\n detail: this,\n cancelable: true,\n };\n\n const allowed = this.tree?.emitEvent('igcItemCollapsing', args);\n\n if (!allowed) {\n return;\n }\n this.expanded = false;\n this.tree?.emitEvent('igcItemCollapsed', { detail: this });\n }\n\n /** Toggles tree item expansion state. */\n public toggle(): void {\n this.expanded = !this.expanded;\n }\n\n /** Expands the tree item. */\n public expand(): void {\n this.expanded = true;\n }\n\n /** Collapses the tree item. */\n public collapse(): void {\n this.expanded = false;\n }\n\n protected override render() {\n const size = this.level * (this.tree ? sizeMultiplier[this.tree!.size] : 1);\n\n return html`\n <div\n id=\"wrapper\"\n part=\"wrapper ${this.tree?.size} ${partNameMap(this.parts)}\"\n >\n <div\n style=\"width: calc(${size} * var(--igc-tree-indentation-size))\"\n part=\"indentation\"\n aria-hidden=\"true\"\n >\n <slot name=\"indentation\"></slot>\n </div>\n <div part=\"indicator\" aria-hidden=\"true\">\n ${this.loading\n ? html`\n <slot name=\"loading\">\n <igc-circular-progress indeterminate></igc-circular-progress>\n </slot>\n `\n : html`\n <slot name=\"indicator\" @click=${this.expandIndicatorClick}>\n ${this.hasChildren\n ? html`\n <igc-icon\n name=${this.expanded\n ? 'keyboard_arrow_down'\n : this.tree?.dir === 'rtl'\n ? 'navigate_before'\n : 'keyboard_arrow_right'}\n collection=\"internal\"\n >\n </igc-icon>\n `\n : ''}\n </slot>\n `}\n </div>\n ${this.tree?.selection !== 'none'\n ? html`\n <div part=\"select\" aria-hidden=\"true\">\n <igc-checkbox\n @click=${this.selectorClick}\n .checked=${this.selected}\n .indeterminate=${this.indeterminate}\n .disabled=${this.disabled}\n tabindex=\"-1\"\n >\n </igc-checkbox>\n </div>\n `\n : ''}\n <div part=\"label\">\n <slot\n name=\"label\"\n @slotchange=${this.labelChange}\n @focusin=${this.onFocusIn}\n @focusout=${this.onFocusOut}\n >\n <span part=\"text\">${this.label}</span>\n </slot>\n </div>\n </div>\n <div role=\"group\">\n <slot @slotchange=${this.handleChange} ?hidden=${!this.expanded}></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tree-item': IgcTreeItemComponent;\n }\n}\n"]}