@tylertech/forge 3.12.1 → 3.13.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 (53) hide show
  1. package/custom-elements.json +1788 -231
  2. package/dist/lib.js +12 -12
  3. package/dist/lib.js.map +4 -4
  4. package/dist/vscode.css-custom-data.json +2 -1
  5. package/dist/vscode.html-custom-data.json +85 -1
  6. package/esm/autocomplete/autocomplete-constants.d.ts +1 -0
  7. package/esm/autocomplete/autocomplete-constants.js +1 -0
  8. package/esm/autocomplete/autocomplete-core.d.ts +6 -0
  9. package/esm/autocomplete/autocomplete-core.js +49 -12
  10. package/esm/autocomplete/autocomplete.d.ts +7 -0
  11. package/esm/autocomplete/autocomplete.js +7 -0
  12. package/esm/calendar/calendar-core.d.ts +2 -0
  13. package/esm/calendar/calendar-core.js +20 -14
  14. package/esm/core/utils/index.d.ts +1 -0
  15. package/esm/core/utils/index.js +1 -0
  16. package/esm/core/utils/key-action.d.ts +102 -0
  17. package/esm/core/utils/key-action.js +109 -0
  18. package/esm/expansion-panel/expansion-panel-adapter.d.ts +9 -0
  19. package/esm/expansion-panel/expansion-panel-adapter.js +31 -3
  20. package/esm/expansion-panel/expansion-panel-constants.d.ts +2 -0
  21. package/esm/expansion-panel/expansion-panel-constants.js +2 -1
  22. package/esm/expansion-panel/expansion-panel-core.d.ts +7 -0
  23. package/esm/expansion-panel/expansion-panel-core.js +30 -0
  24. package/esm/expansion-panel/expansion-panel.d.ts +11 -3
  25. package/esm/expansion-panel/expansion-panel.js +16 -3
  26. package/esm/paginator/paginator-adapter.d.ts +1 -0
  27. package/esm/paginator/paginator-adapter.js +15 -4
  28. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  29. package/esm/tree/index.d.ts +7 -0
  30. package/esm/tree/index.js +7 -0
  31. package/esm/tree/tree/index.d.ts +7 -0
  32. package/esm/tree/tree/index.js +11 -0
  33. package/esm/tree/tree/tree-selection-controller.d.ts +104 -0
  34. package/esm/tree/tree/tree-selection-controller.js +375 -0
  35. package/esm/tree/tree/tree.d.ts +141 -0
  36. package/esm/tree/tree/tree.js +488 -0
  37. package/esm/tree/tree-item/index.d.ts +7 -0
  38. package/esm/tree/tree-item/index.js +11 -0
  39. package/esm/tree/tree-item/tree-item.d.ts +112 -0
  40. package/esm/tree/tree-item/tree-item.js +378 -0
  41. package/esm/tree/tree-utils.d.ts +154 -0
  42. package/esm/tree/tree-utils.js +315 -0
  43. package/package.json +2 -1
  44. package/sass/core/styles/tokens/tree/tree/_tokens.scss +24 -0
  45. package/sass/core/styles/tokens/tree/tree-item/_tokens.scss +39 -0
  46. package/sass/tree/tree/_core.scss +31 -0
  47. package/sass/tree/tree/_token-utils.scss +30 -0
  48. package/sass/tree/tree/index.scss +6 -0
  49. package/sass/tree/tree/tree.scss +44 -0
  50. package/sass/tree/tree-item/_core.scss +121 -0
  51. package/sass/tree/tree-item/_token-utils.scss +30 -0
  52. package/sass/tree/tree-item/index.scss +6 -0
  53. package/sass/tree/tree-item/tree-item.scss +199 -0
@@ -0,0 +1,378 @@
1
+ /**
2
+ * @license
3
+ * Copyright Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ var _a;
7
+ import { __decorate } from "tslib";
8
+ import { consume } from '@lit/context';
9
+ import { tylIconCheckBox, tylIconCheckBoxOutlineBlank, tylIconIndeterminateCheckBox } from '@tylertech/tyler-icons';
10
+ import { LitElement, html, nothing, unsafeCSS } from 'lit';
11
+ import { customElement, property, queryAssignedNodes, state } from 'lit/decorators.js';
12
+ import { classMap } from 'lit/directives/class-map.js';
13
+ import { styleMap } from 'lit/directives/style-map.js';
14
+ import { setDefaultAria } from '../../core/utils/a11y-utils';
15
+ import { toggleState } from '../../core/utils/utils';
16
+ import { IconRegistry } from '../../icon';
17
+ import { TREE_CONTEXT } from '../tree';
18
+ import { getLevel, indeterminate } from '../tree-utils';
19
+ import '../../icon';
20
+ import '../../open-icon';
21
+ const styles = ':host{display:block;outline:0}.forge-tree-item{--_tree-item-selected-background:var(--forge-tree-item-selected-background, var(--forge-theme-primary-container-low, #e8eaf6));--_tree-item-min-block-size:var(--forge-tree-item-min-block-size, var(--forge-spacing-xlarge, 32px));--_tree-item-shape:var(--forge-tree-item-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_tree-item-expand-icon-inline-size:var(--forge-tree-item-expand-icon-inline-size, var(--forge-spacing-large, 24px));--_tree-item-padding-inline:var(--forge-tree-item-padding-inline, var(--forge-spacing-xxsmall, 4px));--_tree-item-padding-inline-start:var(--forge-tree-item-padding-inline-start, var(--_tree-item-padding-inline));--_tree-item-padding-inline-end:var(--forge-tree-item-padding-inline-end, var(--_tree-item-padding-inline));--_tree-item-gap:var(--forge-tree-item-gap, var(--forge-spacing-xxxsmall, 2px));--_tree-item-header-inline-gap:var(--forge-tree-item-header-inline-gap, var(--forge-spacing-xsmall, 8px));--_tree-item-indent-size:var(--forge-tree-item-indent-size, var(--forge-spacing-medium, 16px));--_tree-item-indent-line-style:var(--forge-tree-item-indent-line-style, solid);--_tree-item-indent-line-width:var(--forge-tree-item-indent-line-width, var(--forge-border-thin, 1px));--_tree-item-indent-line-color:var(--forge-tree-item-indent-line-color, var(--forge-theme-outline, #e0e0e0));--_tree-item-indent-line-offset:var(--forge-tree-item-indent-line-offset, 11.5px);--_tree-item-disabled-opacity:var(--forge-tree-item-disabled-opacity, 0.38)}.forge-tree-item{--_tree-item-checkbox-color:var(--forge-tree-item-checkbox-color, var(--forge-theme-text-low))}.forge-tree-item .header{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:var(--forge-typography-body2-font-family, var(--forge-typography-font-family, \"Roboto\", sans-serif));font-size:var(--forge-typography-body2-font-size, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-font-size-scale, 1)));font-weight:var(--forge-typography-body2-font-weight,400);line-height:var(--forge-typography-body2-line-height, calc(var(--forge-typography-font-size, 1rem) * var(--forge-typography-body-line-height-scale, 1.375)));letter-spacing:var(--forge-typography-body2-letter-spacing, .015625em);text-transform:var(--forge-typography-body2-text-transform,inherit);text-decoration:var(--forge-typography-body2-text-decoration,inherit);display:flex;align-items:center;gap:var(--_tree-item-header-inline-gap);position:relative;border-radius:var(--_tree-item-shape);min-block-size:var(--_tree-item-min-block-size);padding-inline-start:calc(var(--_tree-item-indent-size) * var(--_tree-item-level) + var(--_tree-item-padding-inline-start));padding-inline-end:var(--_tree-item-padding-inline-end)}.forge-tree-item .leaf-spacer{inline-size:var(--_tree-item-expand-icon-inline-size)}.forge-tree-item .content{overflow:hidden;margin-inline-end:auto;white-space:nowrap;text-overflow:ellipsis}.forge-tree-item .expand-icon{display:flex;align-items:center;justify-content:center;position:relative;border-radius:var(--_tree-item-shape);inline-size:var(--_tree-item-expand-icon-inline-size);min-block-size:var(--_tree-item-min-block-size)}.forge-tree-item .expand-icon.has-custom-collapse-icon slot[name=expand-icon]{display:none}.forge-tree-item .expand-icon.has-custom-collapse-icon slot[name=collapse-icon]{display:contents}.forge-tree-item .checkbox{--forge-icon-color:var(--_tree-item-checkbox-color);display:var(--_tree-item-check-display)}.forge-tree-item .children{display:flex;flex-direction:column;gap:var(--_tree-item-gap);position:relative;margin-block-start:var(--_tree-item-gap)}.forge-tree-item .children::after{display:var(--_tree-item-indent-line-display);position:absolute;left:calc(var(--_tree-item-indent-size) * var(--_tree-item-level) + var(--_tree-item-indent-line-offset) + var(--_tree-item-padding-inline-start));block-size:100%;inline-size:var(--_tree-item-indent-line-width);border-inline-start-style:var(--_tree-item-indent-line-style);border-inline-start-width:var(--_tree-item-indent-line-width);border-inline-start-color:var(--_tree-item-indent-line-color);pointer-events:none;content:\"\"}.forge-tree-item .children-footer,.forge-tree-item .children-header{position:relative;padding-inline-start:calc(var(--_tree-item-indent-size) * (var(--_tree-item-level) + 1) + var(--_tree-item-padding-inline-start) + var(--_tree-item-expand-icon-inline-size) + var(--_tree-item-header-inline-gap) * 2);padding-inline-end:calc(var(--_tree-item-padding-inline-end) + var(--_tree-item-header-inline-gap))}.forge-tree-item.interactive .header{cursor:pointer}.forge-tree-item.indeterminate{--_tree-item-checkbox-color:var(--forge-tree-item-checkbox-color, var(--forge-theme-tertiary))}.forge-tree-item.disabled .checkbox,.forge-tree-item.disabled .content,.forge-tree-item.disabled .end,.forge-tree-item.disabled .start{opacity:var(--_tree-item-disabled-opacity)}.forge-tree-item.disabled:not(.open-disabled) .expand-icon{cursor:pointer}.forge-tree-item.open-disabled .expand-icon{opacity:var(--_tree-item-disabled-opacity)}:host(:state(leaf)) .children{display:none}:host(:not(:state(open))) .expand-icon slot[name=expand-icon]{display:contents}:host(:not(:state(open))) .expand-icon slot[name=collapse-icon]{display:none}:host(:not(:state(open))) .children{display:none}:host(:state(selected)) .header{--_tree-item-checkbox-color:var(--forge-tree-item-checkbox-color, var(--forge-theme-tertiary));background:var(--_tree-item-selected-background)}:host(:state(selected)) forge-state-layer{--forge-state-layer-color:var(--forge-theme-primary)}:host(:state(indeterminate)) .header{--_tree-item-checkbox-color:var(--forge-tree-item-checkbox-color, var(--forge-theme-tertiary))}:host(:state(indeterminate)) forge-state-layer{--forge-state-layer-color:var(--forge-theme-primary)}forge-focus-indicator{--forge-focus-indicator-shape:var(--_tree-item-shape);z-index:1}.expand-icon forge-circular-progress{--forge-circular-progress-indicator-color:currentColor;--forge-circular-progress-size:16px;--forge-circular-progress-track-width:16}';
22
+ /**
23
+ * @tag forge-tree-item
24
+ *
25
+ * @dependency forge-circular-progress
26
+ * @dependency forge-icon
27
+ * @dependency forge-open-icon
28
+ *
29
+ * @event {CustomEvent<unknown>} forge-tree-item-select - Dispatched when the user selects a tree item.
30
+ * @event {CustomEvent<void>} forge-tree-item-open - Dispatched when the user opens a tree item.
31
+ * @event {CustomEvent<void>} forge-tree-item-close - Dispatched when the user closes a tree item.
32
+ */
33
+ let TreeItemComponent = class TreeItemComponent extends LitElement {
34
+ /**
35
+ * The depth of the tree item within the tree's hierarchy.
36
+ */
37
+ get level() {
38
+ return this._level;
39
+ }
40
+ /**
41
+ * Whether the tree item has no child items.
42
+ */
43
+ get leaf() {
44
+ return !this._children.length && !this.lazy;
45
+ }
46
+ /**
47
+ * Whether the selected value is indeterminate.
48
+ */
49
+ get indeterminate() {
50
+ return this[indeterminate];
51
+ }
52
+ constructor() {
53
+ super();
54
+ /**
55
+ * Whether the tree item is selected.
56
+ * @default false
57
+ * @attribute
58
+ */
59
+ this.selected = false;
60
+ /**
61
+ * Whether the tree item is expanded.
62
+ * @default false
63
+ * @attribute
64
+ */
65
+ this.open = false;
66
+ /**
67
+ * Whether the tree item supports lazy loading.
68
+ * @default false
69
+ * @attribute
70
+ */
71
+ this.lazy = false;
72
+ /**
73
+ * Whether the tree item is disabled.
74
+ * @default false
75
+ * @attribute
76
+ */
77
+ this.disabled = false;
78
+ /**
79
+ * Whether opening the tree item is disabled.
80
+ * @default false
81
+ * @attribute
82
+ */
83
+ this.openDisabled = false;
84
+ /**
85
+ * Whether the selected value is indeterminate. This is a symbol property to avoid being set from
86
+ * outside the library.
87
+ * @ignore
88
+ * @default false
89
+ */
90
+ this[_a] = false;
91
+ this._level = 0;
92
+ this._leaf = true;
93
+ this._loading = false;
94
+ this._hasSlottedExpandIcon = false;
95
+ this._hasSlottedCollapseIcon = false;
96
+ this._checkboxIcon = 'check_box_outline_blank';
97
+ // This is used to avoid dispatching a deselected update event when the tree item is first rendered.
98
+ this._hasBeenSelected = false;
99
+ this._internals = this.attachInternals();
100
+ IconRegistry.define([tylIconCheckBox, tylIconCheckBoxOutlineBlank, tylIconIndeterminateCheckBox]);
101
+ }
102
+ connectedCallback() {
103
+ super.connectedCallback();
104
+ setDefaultAria(this, this._internals, { role: 'treeitem' });
105
+ this.tabIndex = -1;
106
+ this._level = getLevel(this);
107
+ this._slotInParent();
108
+ this._detectChildren();
109
+ this._dispatchUpdate('added');
110
+ }
111
+ disconnectedCallback() {
112
+ super.disconnectedCallback();
113
+ this._dispatchUpdate('removed');
114
+ }
115
+ willUpdate(changedProperties) {
116
+ changedProperties.forEach((_, prop) => {
117
+ switch (prop) {
118
+ case 'selected':
119
+ this._setSelected();
120
+ this._checkboxIcon = this.indeterminate ? 'indeterminate_check_box' : this.selected ? 'check_box' : 'check_box_outline_blank';
121
+ break;
122
+ case indeterminate:
123
+ toggleState(this._internals, 'indeterminate', this.indeterminate);
124
+ this._checkboxIcon = this.indeterminate ? 'indeterminate_check_box' : this.selected ? 'check_box' : 'check_box_outline_blank';
125
+ break;
126
+ case 'open':
127
+ this._setOpen();
128
+ break;
129
+ case 'lazy':
130
+ this._loading = this.lazy;
131
+ this._detectChildren();
132
+ this._setOpen();
133
+ break;
134
+ case 'loading':
135
+ this._setLoading();
136
+ break;
137
+ case 'disabled':
138
+ this._setDisabled();
139
+ break;
140
+ case 'openDisabled':
141
+ this._setOpenDisabled();
142
+ break;
143
+ }
144
+ });
145
+ // Keep track of changed properties within the tree's context object.
146
+ const contextKey = '_treeContext';
147
+ const modeChanged = changedProperties.has(contextKey) && changedProperties.get(contextKey)?.mode !== this._treeContext?.mode;
148
+ const rootDisabledChanged = changedProperties.has(contextKey) && changedProperties.get(contextKey)?.disabled !== this._treeContext?.disabled;
149
+ const rootExpandIconChanged = changedProperties.has(contextKey) && changedProperties.get(contextKey)?.expandIcon !== this._treeContext?.expandIcon;
150
+ const rootCollapseIconChanged = changedProperties.has(contextKey) && changedProperties.get(contextKey)?.collapseIcon !== this._treeContext?.collapseIcon;
151
+ if (modeChanged) {
152
+ this._setDisabled();
153
+ this._setMode();
154
+ this._setOpen();
155
+ }
156
+ if (rootExpandIconChanged) {
157
+ this._setIconFromContext('expand');
158
+ }
159
+ if (rootCollapseIconChanged) {
160
+ this._setIconFromContext('collapse');
161
+ }
162
+ if (rootDisabledChanged) {
163
+ this._setDisabled();
164
+ }
165
+ }
166
+ render() {
167
+ // An item can individually disabled or inherit the disabled state from the tree.
168
+ const disabled = this.disabled || !!this._treeContext?.disabled;
169
+ // An item is interactive if a click anywhere in the header can select or open it. Interactive
170
+ // items show a pointer cursor.
171
+ const interactive = !this._treeContext
172
+ ? false
173
+ : this._treeContext.mode === 'off'
174
+ ? !this._leaf && !this.openDisabled
175
+ : this._treeContext.mode === 'leaf'
176
+ ? (this._leaf && !disabled) || (!this._leaf && !this.openDisabled)
177
+ : !disabled;
178
+ // The header state layer is removed when the item is not interactive.
179
+ const hideHeaderStateLayer = !interactive;
180
+ return html `
181
+ <div
182
+ part="root"
183
+ class=${classMap({ 'forge-tree-item': true, interactive, disabled, 'open-disabled': this.openDisabled })}
184
+ style=${styleMap({ '--_tree-item-level': this.level })}>
185
+ <div part="header" class="header">
186
+ ${!this._leaf ? this._expandIconTemplate() : html `<span class="leaf-spacer"></span>`}
187
+ ${this._treeContext?.mode === 'multiple'
188
+ ? html `<forge-icon id="checkbox" class="checkbox" part="checkbox" .name="${this._checkboxIcon}"></forge-icon>`
189
+ : nothing}
190
+ <div class="start">
191
+ <slot name="start"></slot>
192
+ </div>
193
+ <div class="content" part="content">
194
+ <slot></slot>
195
+ </div>
196
+ <div class="end">
197
+ <slot name="end"></slot>
198
+ </div>
199
+ ${hideHeaderStateLayer ? nothing : html `<forge-state-layer></forge-state-layer>`}
200
+ <forge-focus-indicator target=":host" focus-mode="focus" inward></forge-focus-indicator>
201
+ </div>
202
+ <div role="group" class="children" part="children">
203
+ <div class="children-header" part="children-header">
204
+ <slot name="children-header"></slot>
205
+ </div>
206
+ <slot name="children" @slotchange="${this._detectChildren}"></slot>
207
+ <div class="children-footer" part="children-footer">
208
+ <slot name="children-footer"></slot>
209
+ </div>
210
+ </div>
211
+ </div>
212
+ `;
213
+ }
214
+ _expandIconTemplate() {
215
+ // When an item is not interactive the expand icon may still be enabled and should show its
216
+ // own state layer.
217
+ const showStateLayer = this._treeContext &&
218
+ this._treeContext.mode !== 'leaf' &&
219
+ this._treeContext.mode !== 'off' &&
220
+ (this.disabled || this._treeContext.disabled) &&
221
+ !this.openDisabled;
222
+ if (this._loading) {
223
+ return html `
224
+ <span part="expand-icon" class="expand-icon" aria-hidden="true">
225
+ <forge-circular-progress class="loading" part="loading-indicator"></forge-circular-progress>
226
+ </span>
227
+ `;
228
+ }
229
+ // The default expand icon is shown when no custom expand or collapse icons are provided.
230
+ const showDefaultIcon = !this._hasSlottedExpandIcon && !this._hasSlottedCollapseIcon;
231
+ return html `
232
+ <span
233
+ part="expand-icon"
234
+ class=${classMap({
235
+ 'expand-icon': true,
236
+ 'has-custom-expand-icon': this._hasSlottedExpandIcon,
237
+ 'has-custom-collapse-icon': this._hasSlottedCollapseIcon
238
+ })}
239
+ aria-hidden="true"
240
+ @slotchange="${this._detectSlottedExpandOrCollapseIcon}">
241
+ ${showDefaultIcon
242
+ ? html `<forge-open-icon class="default-expand-icon" orientation="horizontal" rotation="half" .open="${this.open}"></forge-open-icon>`
243
+ : nothing}
244
+ <slot name="expand-icon">
245
+ <slot name="context-expand-icon"></slot>
246
+ </slot>
247
+ <slot name="collapse-icon">
248
+ <slot name="context-collapse-icon"></slot>
249
+ </slot>
250
+ ${showStateLayer ? html `<forge-state-layer></forge-state-layer>` : nothing}
251
+ </span>
252
+ `;
253
+ }
254
+ _slotInParent() {
255
+ const parent = this.parentElement;
256
+ if (parent?.tagName.toLowerCase() === 'forge-tree-item') {
257
+ this.slot = 'children';
258
+ }
259
+ }
260
+ _detectChildren() {
261
+ this._leaf = this.leaf;
262
+ this._setOpen();
263
+ toggleState(this._internals, 'leaf', this._leaf);
264
+ }
265
+ _detectSlottedExpandOrCollapseIcon(evt) {
266
+ const slot = evt.target;
267
+ const assignedElements = slot.assignedElements();
268
+ if (slot.name === 'expand-icon' || slot.name === 'context-expand-icon') {
269
+ this._hasSlottedExpandIcon = !!assignedElements.length;
270
+ }
271
+ else if (slot.name === 'collapse-icon' || slot.name === 'context-collapse-icon') {
272
+ this._hasSlottedCollapseIcon = !!assignedElements.length;
273
+ }
274
+ }
275
+ _setIconFromContext(icon) {
276
+ if (!this._treeContext) {
277
+ return;
278
+ }
279
+ // Remove any old icons in this slot
280
+ const oldIcons = Array.from(this.children).filter(el => el.slot === `context-${icon}-icon`);
281
+ oldIcons.forEach(i => i.remove());
282
+ // Add the new icon if it exists
283
+ const newIcon = this._treeContext[`${icon}Icon`];
284
+ if (newIcon) {
285
+ this.append(newIcon.cloneNode(true));
286
+ }
287
+ }
288
+ _setDisabled() {
289
+ const disabled = this.disabled || !!this._treeContext?.disabled;
290
+ setDefaultAria(this, this._internals, { ariaDisabled: disabled ? 'true' : 'false' });
291
+ toggleState(this._internals, 'disabled', disabled);
292
+ }
293
+ _setLoading() {
294
+ setDefaultAria(this, this._internals, { ariaBusy: this._loading ? 'true' : 'false' });
295
+ }
296
+ _setMode() {
297
+ setDefaultAria(this, this._internals, {
298
+ ariaSelected: !this._treeContext || this._treeContext.mode === 'off' ? null : this.selected ? 'true' : 'false'
299
+ });
300
+ }
301
+ _setOpen() {
302
+ setDefaultAria(this, this._internals, {
303
+ ariaExpanded: this.leaf || this.openDisabled ? null : this.open ? 'true' : 'false'
304
+ });
305
+ toggleState(this._internals, 'open', !this.leaf && this.open);
306
+ if (this.open) {
307
+ this._dispatchUpdate('opened');
308
+ }
309
+ }
310
+ _setOpenDisabled() {
311
+ setDefaultAria(this, this._internals, { ariaExpanded: this.leaf || this.openDisabled ? null : this.open ? 'true' : 'false' });
312
+ }
313
+ _setSelected() {
314
+ if (!this._hasBeenSelected && this.selected) {
315
+ this._hasBeenSelected = true;
316
+ }
317
+ setDefaultAria(this, this._internals, { ariaSelected: !this._treeContext || this._treeContext.mode === 'off' ? null : this.selected ? 'true' : 'false' });
318
+ toggleState(this._internals, 'selected', this.selected);
319
+ if (this._hasBeenSelected) {
320
+ this._dispatchUpdate(this.selected ? 'selected' : 'deselected');
321
+ }
322
+ }
323
+ _dispatchUpdate(reason) {
324
+ this.dispatchEvent(new CustomEvent('forge-tree-item-update', { bubbles: true, detail: { reason } }));
325
+ }
326
+ };
327
+ _a = indeterminate;
328
+ TreeItemComponent.styles = unsafeCSS(styles);
329
+ __decorate([
330
+ property()
331
+ ], TreeItemComponent.prototype, "value", void 0);
332
+ __decorate([
333
+ property({ type: Boolean })
334
+ ], TreeItemComponent.prototype, "selected", void 0);
335
+ __decorate([
336
+ property({ type: Boolean })
337
+ ], TreeItemComponent.prototype, "open", void 0);
338
+ __decorate([
339
+ property({ type: Boolean })
340
+ ], TreeItemComponent.prototype, "lazy", void 0);
341
+ __decorate([
342
+ property({ type: Boolean })
343
+ ], TreeItemComponent.prototype, "disabled", void 0);
344
+ __decorate([
345
+ property({ type: Boolean, attribute: 'open-disabled' })
346
+ ], TreeItemComponent.prototype, "openDisabled", void 0);
347
+ __decorate([
348
+ property({ attribute: false })
349
+ ], TreeItemComponent.prototype, _a, void 0);
350
+ __decorate([
351
+ state(),
352
+ consume({ context: TREE_CONTEXT, subscribe: true })
353
+ ], TreeItemComponent.prototype, "_treeContext", void 0);
354
+ __decorate([
355
+ state()
356
+ ], TreeItemComponent.prototype, "_level", void 0);
357
+ __decorate([
358
+ state()
359
+ ], TreeItemComponent.prototype, "_leaf", void 0);
360
+ __decorate([
361
+ state()
362
+ ], TreeItemComponent.prototype, "_loading", void 0);
363
+ __decorate([
364
+ state()
365
+ ], TreeItemComponent.prototype, "_hasSlottedExpandIcon", void 0);
366
+ __decorate([
367
+ state()
368
+ ], TreeItemComponent.prototype, "_hasSlottedCollapseIcon", void 0);
369
+ __decorate([
370
+ state()
371
+ ], TreeItemComponent.prototype, "_checkboxIcon", void 0);
372
+ __decorate([
373
+ queryAssignedNodes({ slot: 'children', flatten: true })
374
+ ], TreeItemComponent.prototype, "_children", void 0);
375
+ TreeItemComponent = __decorate([
376
+ customElement('forge-tree-item')
377
+ ], TreeItemComponent);
378
+ export { TreeItemComponent };
@@ -0,0 +1,154 @@
1
+ /**
2
+ * @license
3
+ * Copyright Tyler Technologies, Inc.
4
+ * License: Apache-2.0
5
+ */
6
+ import { TreeItemComponent } from './tree-item/tree-item';
7
+ import { TreeComponent } from './tree/tree';
8
+ export interface ITreeItemSnapshot {
9
+ el: TreeItemComponent;
10
+ indeterminate: boolean;
11
+ open: boolean;
12
+ selected: boolean;
13
+ }
14
+ /**
15
+ * A symbol property to represent the indeterminate state of a tree item.
16
+ */
17
+ export declare const indeterminate: unique symbol;
18
+ /**
19
+ * Checks if the given element is a tree component.
20
+ *
21
+ * @param el - The element to check.
22
+ * @returns True if the element is a tree component, false otherwise.
23
+ */
24
+ export declare function isTree(el: Element): el is TreeComponent;
25
+ /**
26
+ * Checks if an element is a tree item component.
27
+ *
28
+ * @param el - The element to check.
29
+ * @returns True if the element is a tree item component, false otherwise.
30
+ */
31
+ export declare function isTreeItem(el: Element): el is TreeItemComponent;
32
+ /**
33
+ * Returns whether an event originates from within a tree item.
34
+ *
35
+ * @param evt An event dispatched from a tree item.
36
+ * @returns Whether the event includes a tree item.
37
+ */
38
+ export declare function getTreeItemFromEvent(evt: Event): TreeItemComponent | null;
39
+ /**
40
+ * Gets all tree item components in an event path.
41
+ *
42
+ * @param evt An event dispatched from a tree item.
43
+ * @returns The dispatching tree item and all tree item ancestors.
44
+ */
45
+ export declare function getTreeItemsInEventPath(evt: Event): TreeItemComponent[];
46
+ /**
47
+ * Returns whether an event includes a tree item header.
48
+ *
49
+ * @param evt An event dispatched from a tree item.
50
+ * @returns Whether the event includes a header element within a tree item.
51
+ */
52
+ export declare function eventPathIncludesTreeItemHeader(evt: Event): boolean;
53
+ /**
54
+ * Returns whether an event includes a tree item expand icon.
55
+ *
56
+ * @param evt An event dispatched from a tree item.
57
+ * @returns Whether the event includes an expand icon element within a tree item.
58
+ */
59
+ export declare function eventPathIncludesTreeItemExpandIcon(evt: Event): boolean;
60
+ /**
61
+ * Gets the target tree item component from an event.
62
+ *
63
+ * @param evt An event dispatched from the target item.
64
+ * @returns The tree item component or null if not found.
65
+ */
66
+ export declare function getTreeItemTarget(evt: Event): TreeItemComponent | null;
67
+ /**
68
+ * Returns the level of the given tree item component.
69
+ * The level represents the depth of the item in the tree hierarchy.
70
+ *
71
+ * @param el - The tree item component.
72
+ * @returns The level of the tree item component.
73
+ */
74
+ export declare function getLevel(el: TreeItemComponent): number;
75
+ /**
76
+ * Returns the parent tree component of the given tree item component.
77
+ *
78
+ * @param el - The tree item component.
79
+ * @returns The parent tree component or null if not found.
80
+ */
81
+ export declare function getParentTree(el: TreeItemComponent): TreeComponent | null;
82
+ /**
83
+ * Retrieves the parent item of a given tree item component.
84
+ *
85
+ * @param el - The tree item component for which to find the parent item.
86
+ * @returns The parent item of the given tree item component, or `null` if the parent item is not found.
87
+ */
88
+ export declare function getParentItem(el: TreeItemComponent): TreeItemComponent | null;
89
+ /**
90
+ * Retrieves the child items of a tree component or tree item component.
91
+ *
92
+ * @param el The tree component or tree item component.
93
+ * @param flatten - If `true`, the function will return all child items recursively.
94
+ * @returns An array of child tree item components.
95
+ */
96
+ export declare function getChildItems(el: TreeComponent | TreeItemComponent, flatten?: boolean): TreeItemComponent[];
97
+ /**
98
+ * Returns the first child item of a tree component or tree item component.
99
+ *
100
+ * @param el - The tree component or tree item component.
101
+ * @returns The first child item if found, or `null` if no child item exists.
102
+ */
103
+ export declare function getFirstChildItem(el: TreeComponent | TreeItemComponent): TreeItemComponent | null;
104
+ /**
105
+ * Returns the last child item of a tree component or tree item component.
106
+ *
107
+ * @param el - The tree component or tree item component.
108
+ * @returns The last child item, or `null` if there are no child items.
109
+ */
110
+ export declare function getLastChildItem(el: TreeComponent | TreeItemComponent): TreeItemComponent | null;
111
+ /**
112
+ * Retrieves the sibling items of a given tree item.
113
+ *
114
+ * @param el - The tree item for which to retrieve the sibling items.
115
+ * @param includeSelf - Optional parameter to include the given tree item itself in the result.
116
+ * @returns An array of sibling tree items.
117
+ */
118
+ export declare function getSiblingItems(el: TreeItemComponent, includeSelf?: boolean): TreeItemComponent[];
119
+ /**
120
+ * Retrieves the next tree item component in the tree hierarchy.
121
+ *
122
+ * @param el - The current tree item component.
123
+ * @returns The next tree item component, or `null` if there is no next item.
124
+ */
125
+ export declare function getNextItem(el: TreeItemComponent, includeChildren?: boolean): TreeItemComponent | null;
126
+ /**
127
+ * Retrieves the previous sibling tree item component of the given element.
128
+ * If there are no previous sibling items, it returns the parent item.
129
+ *
130
+ * @param el - The current tree item component.
131
+ * @returns The previous sibling tree item component or the parent item if there are no previous siblings.
132
+ */
133
+ export declare function getPreviousItem(el: TreeItemComponent): TreeItemComponent | null;
134
+ /**
135
+ * Searches for an item in a tree based on a query string, starting from the position of a given item and wrapping around the
136
+ * beginning of the tree if necessary.
137
+ *
138
+ * @param from The starting item to search from.
139
+ * @param query The query string to search for.
140
+ * @returns The matching item if found, otherwise null.
141
+ */
142
+ export declare function searchItems(from: TreeItemComponent, query: string): TreeItemComponent | null;
143
+ /**
144
+ * Checks if an item in a tree is indeterminate.
145
+ *
146
+ * @param el - The tree item component to check.
147
+ * @returns True if any child items are indeterminate or if the selected states of the child items are not all the same, false otherwise.
148
+ */
149
+ export declare function isIndeterminate(el: TreeItemComponent): boolean;
150
+ /**
151
+ * Closes all descendant items of a tree or tree item component.
152
+ * @param el The tree or tree item component to close the descendants of.
153
+ */
154
+ export declare function closeDescendants(el: TreeComponent | TreeItemComponent): void;