@ni/nimble-components 1.0.0-beta.100 → 1.0.0-beta.101

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 (120) hide show
  1. package/README.md +20 -20
  2. package/dist/esm/button/behaviors.d.ts +12 -12
  3. package/dist/esm/button/behaviors.js +13 -13
  4. package/dist/esm/button/index.d.ts +17 -17
  5. package/dist/esm/button/index.js +37 -37
  6. package/dist/esm/button/styles.d.ts +1 -1
  7. package/dist/esm/button/styles.js +178 -178
  8. package/dist/esm/button/types.d.ts +9 -9
  9. package/dist/esm/button/types.js +10 -10
  10. package/dist/esm/checkbox/index.d.ts +2 -2
  11. package/dist/esm/checkbox/index.js +11 -11
  12. package/dist/esm/checkbox/styles.d.ts +1 -1
  13. package/dist/esm/checkbox/styles.js +91 -91
  14. package/dist/esm/drawer/animations.d.ts +14 -14
  15. package/dist/esm/drawer/animations.js +51 -51
  16. package/dist/esm/drawer/index.d.ts +39 -39
  17. package/dist/esm/drawer/index.js +189 -189
  18. package/dist/esm/drawer/styles.d.ts +1 -1
  19. package/dist/esm/drawer/styles.js +114 -114
  20. package/dist/esm/drawer/types.d.ts +10 -10
  21. package/dist/esm/drawer/types.js +12 -12
  22. package/dist/esm/icon-base/index.d.ts +12 -12
  23. package/dist/esm/icon-base/index.js +21 -21
  24. package/dist/esm/icon-base/styles.d.ts +1 -1
  25. package/dist/esm/icon-base/styles.js +37 -37
  26. package/dist/esm/icon-base/template.d.ts +2 -2
  27. package/dist/esm/icon-base/template.js +6 -6
  28. package/dist/esm/icons/access-control.d.ts +7 -7
  29. package/dist/esm/icons/access-control.js +11 -11
  30. package/dist/esm/icons/admin.d.ts +7 -7
  31. package/dist/esm/icons/admin.js +11 -11
  32. package/dist/esm/icons/administration.d.ts +7 -7
  33. package/dist/esm/icons/administration.js +11 -11
  34. package/dist/esm/icons/all-icons.d.ts +13 -13
  35. package/dist/esm/icons/all-icons.js +13 -13
  36. package/dist/esm/icons/check.d.ts +7 -7
  37. package/dist/esm/icons/check.js +11 -11
  38. package/dist/esm/icons/custom-applications.d.ts +7 -7
  39. package/dist/esm/icons/custom-applications.js +11 -11
  40. package/dist/esm/icons/delete.d.ts +7 -7
  41. package/dist/esm/icons/delete.js +11 -11
  42. package/dist/esm/icons/login.d.ts +7 -7
  43. package/dist/esm/icons/login.js +11 -11
  44. package/dist/esm/icons/logout.d.ts +7 -7
  45. package/dist/esm/icons/logout.js +11 -11
  46. package/dist/esm/icons/managed-systems.d.ts +7 -7
  47. package/dist/esm/icons/managed-systems.js +11 -11
  48. package/dist/esm/icons/measurement-data-analysis.d.ts +7 -7
  49. package/dist/esm/icons/measurement-data-analysis.js +11 -11
  50. package/dist/esm/icons/settings.d.ts +7 -7
  51. package/dist/esm/icons/settings.js +11 -11
  52. package/dist/esm/icons/test-insights.d.ts +7 -7
  53. package/dist/esm/icons/test-insights.js +11 -11
  54. package/dist/esm/icons/utilities.d.ts +7 -7
  55. package/dist/esm/icons/utilities.js +11 -11
  56. package/dist/esm/listbox-option/index.d.ts +10 -10
  57. package/dist/esm/listbox-option/index.js +28 -28
  58. package/dist/esm/listbox-option/styles.d.ts +1 -1
  59. package/dist/esm/listbox-option/styles.js +59 -59
  60. package/dist/esm/menu/index.d.ts +5 -5
  61. package/dist/esm/menu/index.js +21 -21
  62. package/dist/esm/menu/styles.d.ts +1 -1
  63. package/dist/esm/menu/styles.js +39 -39
  64. package/dist/esm/menu-item/index.d.ts +15 -15
  65. package/dist/esm/menu-item/index.js +21 -21
  66. package/dist/esm/menu-item/styles.d.ts +1 -1
  67. package/dist/esm/menu-item/styles.js +63 -63
  68. package/dist/esm/number-field/index.d.ts +6 -6
  69. package/dist/esm/number-field/index.js +22 -22
  70. package/dist/esm/number-field/styles.d.ts +1 -1
  71. package/dist/esm/number-field/styles.js +117 -117
  72. package/dist/esm/select/index.d.ts +12 -12
  73. package/dist/esm/select/index.js +45 -45
  74. package/dist/esm/select/styles.d.ts +1 -1
  75. package/dist/esm/select/styles.js +140 -140
  76. package/dist/esm/tab/index.d.ts +2 -2
  77. package/dist/esm/tab/index.js +8 -8
  78. package/dist/esm/tab/styles.d.ts +1 -1
  79. package/dist/esm/tab/styles.js +52 -52
  80. package/dist/esm/tab-panel/index.d.ts +2 -2
  81. package/dist/esm/tab-panel/index.js +8 -8
  82. package/dist/esm/tab-panel/styles.d.ts +1 -1
  83. package/dist/esm/tab-panel/styles.js +14 -14
  84. package/dist/esm/tabs/index.d.ts +2 -2
  85. package/dist/esm/tabs/index.js +8 -8
  86. package/dist/esm/tabs/styles.d.ts +1 -1
  87. package/dist/esm/tabs/styles.js +42 -42
  88. package/dist/esm/tabs-toolbar/index.d.ts +6 -6
  89. package/dist/esm/tabs-toolbar/index.js +14 -14
  90. package/dist/esm/tabs-toolbar/styles.d.ts +1 -1
  91. package/dist/esm/tabs-toolbar/styles.js +22 -22
  92. package/dist/esm/tabs-toolbar/template.d.ts +1 -1
  93. package/dist/esm/tabs-toolbar/template.js +7 -7
  94. package/dist/esm/testing/dom-next-update.d.ts +4 -4
  95. package/dist/esm/testing/dom-next-update.js +5 -5
  96. package/dist/esm/text-field/index.d.ts +6 -6
  97. package/dist/esm/text-field/index.js +13 -13
  98. package/dist/esm/text-field/styles.d.ts +1 -1
  99. package/dist/esm/text-field/styles.js +141 -141
  100. package/dist/esm/theme-provider/design-tokens.d.ts +48 -48
  101. package/dist/esm/theme-provider/design-tokens.js +163 -163
  102. package/dist/esm/theme-provider/index.d.ts +10 -10
  103. package/dist/esm/theme-provider/index.js +42 -42
  104. package/dist/esm/theme-provider/template.d.ts +2 -2
  105. package/dist/esm/theme-provider/template.js +2 -2
  106. package/dist/esm/theme-provider/themes.d.ts +6 -6
  107. package/dist/esm/theme-provider/themes.js +7 -7
  108. package/dist/esm/tree-item/index.d.ts +28 -28
  109. package/dist/esm/tree-item/index.js +115 -115
  110. package/dist/esm/tree-item/styles.d.ts +3 -3
  111. package/dist/esm/tree-item/styles.js +194 -194
  112. package/dist/esm/tree-view/index.d.ts +16 -16
  113. package/dist/esm/tree-view/index.js +33 -33
  114. package/dist/esm/tree-view/styles.d.ts +1 -1
  115. package/dist/esm/tree-view/styles.js +16 -16
  116. package/dist/esm/tree-view/types.d.ts +6 -6
  117. package/dist/esm/tree-view/types.js +7 -7
  118. package/dist/esm/utilities/style/focus.d.ts +11 -11
  119. package/dist/esm/utilities/style/focus.js +13 -13
  120. package/package.json +94 -94
@@ -1,116 +1,116 @@
1
- import { treeItemTemplate as template, TreeItem as FoundationTreeItem, DesignSystem } from '@microsoft/fast-foundation';
2
- import { controlsArrowExpanderUp16X16 } from '@ni/nimble-tokens/dist-icons-esm/nimble-icons-inline';
3
- import { groupSelectedAttribute, SelectionMode } from '../tree-view/types';
4
- import { styles } from './styles';
5
- /**
6
- * A function that returns a nimble-tree-item registration for configuring the component with a DesignSystem.
7
- * Implements {@link @microsoft/fast-foundation#treeItemTemplate}
8
- *
9
- *
10
- * @public
11
- * @remarks
12
- * Generates HTML Element: \<nimble-tree-item\>
13
- *
14
- */
15
- export class TreeItem extends FoundationTreeItem {
16
- constructor() {
17
- super();
18
- this.handleClickOverride = (event) => {
19
- if (event.composedPath().includes(this.expandCollapseButton)) {
20
- // just have base class handle click event for glyph
21
- return;
22
- }
23
- const treeItem = this.getImmediateTreeItem(event.target);
24
- if (treeItem?.disabled || treeItem !== this) {
25
- // don't allow base TreeItem to emit a 'selected-change' event when a disabled item is clicked
26
- event.stopImmediatePropagation();
27
- return;
28
- }
29
- const leavesOnly = this.treeView?.selectionMode === SelectionMode.LeavesOnly;
30
- const hasChildren = this.hasChildTreeItems();
31
- if ((leavesOnly && !hasChildren) || !leavesOnly) {
32
- // if either a leaf tree item, or in a mode that supports select on groups,
33
- // process click as a select
34
- this.setGroupSelectionOnRootParentTreeItem(treeItem);
35
- if (this.selected) {
36
- // if already selected, prevent base-class from issuing selected-change event
37
- event.stopImmediatePropagation();
38
- }
39
- }
40
- else {
41
- // implicit hasChildren && leavesOnly, so only allow expand/collapse, not select
42
- this.expanded = !this.expanded;
43
- this.$emit('expanded-change', this);
44
- // don't allow base class to process click event, as all we want to happen
45
- // here is toggling 'expanded', and to issue the expanded-change event
46
- event.stopImmediatePropagation();
47
- }
48
- };
49
- // This prevents the toggling of selected state when a TreeItem is clicked multiple times,
50
- // which is what the FAST TreeItem allows
51
- this.handleSelectedChange = (event) => {
52
- // only process selection
53
- if (event.target === this) {
54
- this.selected = true;
55
- }
56
- };
57
- this.addEventListener('click', this.handleClickOverride);
58
- }
59
- connectedCallback() {
60
- super.connectedCallback();
61
- this.addEventListener('selected-change', this.handleSelectedChange);
62
- this.treeView = this.getParentTreeView();
63
- if (this.treeView && this.selected) {
64
- this.setGroupSelectionOnRootParentTreeItem(this);
65
- }
66
- }
67
- disconnectedCallback() {
68
- super.disconnectedCallback();
69
- this.removeEventListener('click', this.handleClickOverride);
70
- this.removeEventListener('selected-change', this.handleSelectedChange);
71
- this.treeView = null;
72
- }
73
- hasChildTreeItems() {
74
- const treeItemChild = this.querySelector('[role="treeitem"]');
75
- return treeItemChild !== null;
76
- }
77
- clearTreeGroupSelection() {
78
- const currentGroupSelection = this.treeView?.querySelectorAll(`[${groupSelectedAttribute}]`);
79
- currentGroupSelection?.forEach(treeItem => treeItem.removeAttribute(groupSelectedAttribute));
80
- }
81
- setGroupSelectionOnRootParentTreeItem(treeItem) {
82
- this.clearTreeGroupSelection();
83
- let currentItem = treeItem;
84
- while (currentItem?.parentElement !== this.treeView) {
85
- currentItem = currentItem?.parentElement;
86
- }
87
- if (currentItem) {
88
- currentItem.setAttribute(groupSelectedAttribute, 'true');
89
- }
90
- }
91
- getImmediateTreeItem(element) {
92
- let foundElement = element;
93
- while (foundElement
94
- && !(foundElement?.getAttribute('role') === 'treeitem')) {
95
- foundElement = foundElement?.parentElement;
96
- }
97
- return foundElement;
98
- }
99
- /**
100
- * This was copied directly from the FAST TreeItem implementation
101
- * @returns the root tree view
102
- */
103
- getParentTreeView() {
104
- const parentNode = this.parentElement.closest("[role='tree']");
105
- return parentNode;
106
- }
107
- }
108
- const nimbleTreeItem = TreeItem.compose({
109
- baseName: 'tree-item',
110
- baseClass: FoundationTreeItem,
111
- template,
112
- styles,
113
- expandCollapseGlyph: controlsArrowExpanderUp16X16.data
114
- });
115
- DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTreeItem());
1
+ import { treeItemTemplate as template, TreeItem as FoundationTreeItem, DesignSystem } from '@microsoft/fast-foundation';
2
+ import { controlsArrowExpanderUp16X16 } from '@ni/nimble-tokens/dist-icons-esm/nimble-icons-inline';
3
+ import { groupSelectedAttribute, SelectionMode } from '../tree-view/types';
4
+ import { styles } from './styles';
5
+ /**
6
+ * A function that returns a nimble-tree-item registration for configuring the component with a DesignSystem.
7
+ * Implements {@link @microsoft/fast-foundation#treeItemTemplate}
8
+ *
9
+ *
10
+ * @public
11
+ * @remarks
12
+ * Generates HTML Element: \<nimble-tree-item\>
13
+ *
14
+ */
15
+ export class TreeItem extends FoundationTreeItem {
16
+ constructor() {
17
+ super();
18
+ this.handleClickOverride = (event) => {
19
+ if (event.composedPath().includes(this.expandCollapseButton)) {
20
+ // just have base class handle click event for glyph
21
+ return;
22
+ }
23
+ const treeItem = this.getImmediateTreeItem(event.target);
24
+ if (treeItem?.disabled || treeItem !== this) {
25
+ // don't allow base TreeItem to emit a 'selected-change' event when a disabled item is clicked
26
+ event.stopImmediatePropagation();
27
+ return;
28
+ }
29
+ const leavesOnly = this.treeView?.selectionMode === SelectionMode.LeavesOnly;
30
+ const hasChildren = this.hasChildTreeItems();
31
+ if ((leavesOnly && !hasChildren) || !leavesOnly) {
32
+ // if either a leaf tree item, or in a mode that supports select on groups,
33
+ // process click as a select
34
+ this.setGroupSelectionOnRootParentTreeItem(treeItem);
35
+ if (this.selected) {
36
+ // if already selected, prevent base-class from issuing selected-change event
37
+ event.stopImmediatePropagation();
38
+ }
39
+ }
40
+ else {
41
+ // implicit hasChildren && leavesOnly, so only allow expand/collapse, not select
42
+ this.expanded = !this.expanded;
43
+ this.$emit('expanded-change', this);
44
+ // don't allow base class to process click event, as all we want to happen
45
+ // here is toggling 'expanded', and to issue the expanded-change event
46
+ event.stopImmediatePropagation();
47
+ }
48
+ };
49
+ // This prevents the toggling of selected state when a TreeItem is clicked multiple times,
50
+ // which is what the FAST TreeItem allows
51
+ this.handleSelectedChange = (event) => {
52
+ // only process selection
53
+ if (event.target === this) {
54
+ this.selected = true;
55
+ }
56
+ };
57
+ this.addEventListener('click', this.handleClickOverride);
58
+ }
59
+ connectedCallback() {
60
+ super.connectedCallback();
61
+ this.addEventListener('selected-change', this.handleSelectedChange);
62
+ this.treeView = this.getParentTreeView();
63
+ if (this.treeView && this.selected) {
64
+ this.setGroupSelectionOnRootParentTreeItem(this);
65
+ }
66
+ }
67
+ disconnectedCallback() {
68
+ super.disconnectedCallback();
69
+ this.removeEventListener('click', this.handleClickOverride);
70
+ this.removeEventListener('selected-change', this.handleSelectedChange);
71
+ this.treeView = null;
72
+ }
73
+ hasChildTreeItems() {
74
+ const treeItemChild = this.querySelector('[role="treeitem"]');
75
+ return treeItemChild !== null;
76
+ }
77
+ clearTreeGroupSelection() {
78
+ const currentGroupSelection = this.treeView?.querySelectorAll(`[${groupSelectedAttribute}]`);
79
+ currentGroupSelection?.forEach(treeItem => treeItem.removeAttribute(groupSelectedAttribute));
80
+ }
81
+ setGroupSelectionOnRootParentTreeItem(treeItem) {
82
+ this.clearTreeGroupSelection();
83
+ let currentItem = treeItem;
84
+ while (currentItem?.parentElement !== this.treeView) {
85
+ currentItem = currentItem?.parentElement;
86
+ }
87
+ if (currentItem) {
88
+ currentItem.setAttribute(groupSelectedAttribute, 'true');
89
+ }
90
+ }
91
+ getImmediateTreeItem(element) {
92
+ let foundElement = element;
93
+ while (foundElement
94
+ && !(foundElement?.getAttribute('role') === 'treeitem')) {
95
+ foundElement = foundElement?.parentElement;
96
+ }
97
+ return foundElement;
98
+ }
99
+ /**
100
+ * This was copied directly from the FAST TreeItem implementation
101
+ * @returns the root tree view
102
+ */
103
+ getParentTreeView() {
104
+ const parentNode = this.parentElement.closest("[role='tree']");
105
+ return parentNode;
106
+ }
107
+ }
108
+ const nimbleTreeItem = TreeItem.compose({
109
+ baseName: 'tree-item',
110
+ baseClass: FoundationTreeItem,
111
+ template,
112
+ styles,
113
+ expandCollapseGlyph: controlsArrowExpanderUp16X16.data
114
+ });
115
+ DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleTreeItem());
116
116
  //# sourceMappingURL=index.js.map
@@ -1,3 +1,3 @@
1
- import { ElementStyles } from '@microsoft/fast-element';
2
- import { ElementDefinitionContext, TreeItemOptions } from '@microsoft/fast-foundation';
3
- export declare const styles: (context: ElementDefinitionContext, definition: TreeItemOptions) => ElementStyles;
1
+ import { ElementStyles } from '@microsoft/fast-element';
2
+ import { ElementDefinitionContext, TreeItemOptions } from '@microsoft/fast-foundation';
3
+ export declare const styles: (context: ElementDefinitionContext, definition: TreeItemOptions) => ElementStyles;
@@ -1,195 +1,195 @@
1
- import { DirectionalStyleSheetBehavior } from '@microsoft/fast-components';
2
- import { css } from '@microsoft/fast-element';
3
- import { display, TreeItem } from '@microsoft/fast-foundation';
4
- import { focusVisible } from '../utilities/style/focus';
5
- import { contentFontColor, fontFamily, borderColorHover, fillColorSelected, contentFontSize, fillColorHover, fillColorSelectedHover, borderWidth, iconSize } from '../theme-provider/design-tokens';
6
- import { groupSelectedAttribute } from '../tree-view/types';
7
- export const styles = (context) => css `
8
- ${display('block')}
9
-
10
- :host {
11
- contain: content;
12
- position: relative;
13
- outline: none;
14
- color: ${contentFontColor};
15
- cursor: pointer;
16
- font-family: ${fontFamily};
17
- --tree-item-nested-width: 0;
18
- }
19
-
20
- ${ /* this controls the side border */''}
21
- :host([${groupSelectedAttribute}])::after {
22
- background: ${borderColorHover};
23
- border-radius: 0px;
24
- content: '';
25
- display: block;
26
- position: absolute;
27
- top: 0px;
28
- width: calc(${borderWidth} * 2);
29
- height: calc(${iconSize} * 2);
30
- }
31
-
32
- .positioning-region {
33
- display: flex;
34
- position: relative;
35
- box-sizing: border-box;
36
- height: calc(${iconSize} * 2);
37
- }
38
-
39
- .positioning-region:hover {
40
- background: ${fillColorHover};
41
- }
42
-
43
- :host(${focusVisible}) .positioning-region {
44
- box-shadow: 0px 0px 0px ${borderWidth} ${borderColorHover} inset;
45
- outline: ${borderWidth} solid ${borderColorHover};
46
- outline-offset: -2px;
47
- }
48
-
49
- :host([selected]) .positioning-region {
50
- background: ${fillColorSelected};
51
- }
52
-
53
- :host([selected]) .positioning-region:hover {
54
- background: ${fillColorSelectedHover};
55
- }
56
-
57
- .positioning-region::before {
58
- content: '';
59
- display: block;
60
- width: var(--tree-item-nested-width);
61
- flex-shrink: 0;
62
- }
63
-
64
- .content-region {
65
- display: inline-flex;
66
- align-items: center;
67
- white-space: nowrap;
68
- width: 100%;
69
- padding-left: 10px;
70
- font-size: ${contentFontSize};
71
- user-select: none;
72
- }
73
-
74
- :host(${focusVisible}) .content-region {
75
- outline: none;
76
- }
77
-
78
- :host(.nested) .content-region {
79
- position: relative;
80
- margin-inline-start: ${iconSize};
81
- }
82
-
83
- :host([disabled]) .content-region {
84
- opacity: 0.5;
85
- cursor: not-allowed;
86
- }
87
-
88
- .expand-collapse-button {
89
- background: none;
90
- border: none;
91
- outline: none;
92
- width: ${iconSize};
93
- height: ${iconSize};
94
- padding: 0px;
95
- justify-content: center;
96
- align-items: center;
97
- cursor: pointer;
98
- margin-left: 10px;
99
- }
100
-
101
- :host(.nested) .expand-collapse-button {
102
- position: absolute;
103
- }
104
-
105
- .expand-collapse-button svg {
106
- width: ${iconSize};
107
- height: ${iconSize};
108
- transition: transform 0.2s ease-in;
109
- pointer-events: none;
110
- fill: currentcolor;
111
- }
112
-
113
- ${
114
- /* this rule keeps children without an icon text aligned with parents */ ''}
115
- span[part="start"] {
116
- width: ${iconSize};
117
- }
118
-
119
- ${
120
- /* the start class is applied when the corresponding slots is filled */ ''}
121
- .start {
122
- display: flex;
123
- fill: currentcolor;
124
- margin-inline-start: ${iconSize};
125
- margin-inline-end: ${iconSize};
126
- }
127
-
128
- slot[name='start']::slotted(*) {
129
- width: ${iconSize};
130
- height: ${iconSize};
131
- }
132
-
133
- ::slotted(${context.tagFor(TreeItem)}) {
134
- --tree-item-nested-width: 1em;
135
- --expand-collapse-button-nested-width: calc(${iconSize} * -1);
136
- }
137
-
138
- ${
139
- /* the end class is applied when the corresponding slots is filled */ ''}
140
- .end {
141
- display: flex;
142
- fill: currentcolor;
143
- margin-inline-start: ${iconSize};
144
- }
145
-
146
- .items {
147
- display: none;
148
- ${
149
- /*
150
- * this controls the nested indentation (by affecting .positioning-region::before)
151
- * it must minimally contain arithmetic with an em and a px value
152
- * make it larger or shorter by changing the px value
153
- */ ''}
154
- font-size: calc(1em + (${iconSize} * 2));
155
- }
156
-
157
- :host([expanded]) .items {
158
- display: block;
159
- }
160
- `
161
- // prettier-ignore
162
- .withBehaviors(new DirectionalStyleSheetBehavior(css `
163
- ${ /* ltr styles */''}
164
- :host(.nested) .expand-collapse-button {
165
- left: var(
166
- --expand-collapse-button-nested-width,
167
- calc(${iconSize} * -1)
168
- );
169
- }
170
-
171
- .expand-collapse-button svg {
172
- transform: rotate(90deg);
173
- }
174
-
175
- :host([expanded]) .expand-collapse-button svg {
176
- transform: rotate(180deg);
177
- }
178
- `, css `
179
- ${ /* rtl styles */''}
180
- :host(.nested) .expand-collapse-button {
181
- right: var(
182
- --expand-collapse-button-nested-width,
183
- calc(${iconSize} * -1)
184
- );
185
- }
186
-
187
- .expand-collapse-button svg {
188
- transform: rotate(180deg);
189
- }
190
-
191
- :host([expanded]) .expand-collapse-button svg {
192
- transform: rotate(135deg);
193
- }
194
- `));
1
+ import { DirectionalStyleSheetBehavior } from '@microsoft/fast-components';
2
+ import { css } from '@microsoft/fast-element';
3
+ import { display, TreeItem } from '@microsoft/fast-foundation';
4
+ import { focusVisible } from '../utilities/style/focus';
5
+ import { contentFontColor, fontFamily, borderColorHover, fillColorSelected, contentFontSize, fillColorHover, fillColorSelectedHover, borderWidth, iconSize } from '../theme-provider/design-tokens';
6
+ import { groupSelectedAttribute } from '../tree-view/types';
7
+ export const styles = (context) => css `
8
+ ${display('block')}
9
+
10
+ :host {
11
+ contain: content;
12
+ position: relative;
13
+ outline: none;
14
+ color: ${contentFontColor};
15
+ cursor: pointer;
16
+ font-family: ${fontFamily};
17
+ --tree-item-nested-width: 0;
18
+ }
19
+
20
+ ${ /* this controls the side border */''}
21
+ :host([${groupSelectedAttribute}])::after {
22
+ background: ${borderColorHover};
23
+ border-radius: 0px;
24
+ content: '';
25
+ display: block;
26
+ position: absolute;
27
+ top: 0px;
28
+ width: calc(${borderWidth} * 2);
29
+ height: calc(${iconSize} * 2);
30
+ }
31
+
32
+ .positioning-region {
33
+ display: flex;
34
+ position: relative;
35
+ box-sizing: border-box;
36
+ height: calc(${iconSize} * 2);
37
+ }
38
+
39
+ .positioning-region:hover {
40
+ background: ${fillColorHover};
41
+ }
42
+
43
+ :host(${focusVisible}) .positioning-region {
44
+ box-shadow: 0px 0px 0px ${borderWidth} ${borderColorHover} inset;
45
+ outline: ${borderWidth} solid ${borderColorHover};
46
+ outline-offset: -2px;
47
+ }
48
+
49
+ :host([selected]) .positioning-region {
50
+ background: ${fillColorSelected};
51
+ }
52
+
53
+ :host([selected]) .positioning-region:hover {
54
+ background: ${fillColorSelectedHover};
55
+ }
56
+
57
+ .positioning-region::before {
58
+ content: '';
59
+ display: block;
60
+ width: var(--tree-item-nested-width);
61
+ flex-shrink: 0;
62
+ }
63
+
64
+ .content-region {
65
+ display: inline-flex;
66
+ align-items: center;
67
+ white-space: nowrap;
68
+ width: 100%;
69
+ padding-left: 10px;
70
+ font-size: ${contentFontSize};
71
+ user-select: none;
72
+ }
73
+
74
+ :host(${focusVisible}) .content-region {
75
+ outline: none;
76
+ }
77
+
78
+ :host(.nested) .content-region {
79
+ position: relative;
80
+ margin-inline-start: ${iconSize};
81
+ }
82
+
83
+ :host([disabled]) .content-region {
84
+ opacity: 0.5;
85
+ cursor: not-allowed;
86
+ }
87
+
88
+ .expand-collapse-button {
89
+ background: none;
90
+ border: none;
91
+ outline: none;
92
+ width: ${iconSize};
93
+ height: ${iconSize};
94
+ padding: 0px;
95
+ justify-content: center;
96
+ align-items: center;
97
+ cursor: pointer;
98
+ margin-left: 10px;
99
+ }
100
+
101
+ :host(.nested) .expand-collapse-button {
102
+ position: absolute;
103
+ }
104
+
105
+ .expand-collapse-button svg {
106
+ width: ${iconSize};
107
+ height: ${iconSize};
108
+ transition: transform 0.2s ease-in;
109
+ pointer-events: none;
110
+ fill: currentcolor;
111
+ }
112
+
113
+ ${
114
+ /* this rule keeps children without an icon text aligned with parents */ ''}
115
+ span[part="start"] {
116
+ width: ${iconSize};
117
+ }
118
+
119
+ ${
120
+ /* the start class is applied when the corresponding slots is filled */ ''}
121
+ .start {
122
+ display: flex;
123
+ fill: currentcolor;
124
+ margin-inline-start: ${iconSize};
125
+ margin-inline-end: ${iconSize};
126
+ }
127
+
128
+ slot[name='start']::slotted(*) {
129
+ width: ${iconSize};
130
+ height: ${iconSize};
131
+ }
132
+
133
+ ::slotted(${context.tagFor(TreeItem)}) {
134
+ --tree-item-nested-width: 1em;
135
+ --expand-collapse-button-nested-width: calc(${iconSize} * -1);
136
+ }
137
+
138
+ ${
139
+ /* the end class is applied when the corresponding slots is filled */ ''}
140
+ .end {
141
+ display: flex;
142
+ fill: currentcolor;
143
+ margin-inline-start: ${iconSize};
144
+ }
145
+
146
+ .items {
147
+ display: none;
148
+ ${
149
+ /*
150
+ * this controls the nested indentation (by affecting .positioning-region::before)
151
+ * it must minimally contain arithmetic with an em and a px value
152
+ * make it larger or shorter by changing the px value
153
+ */ ''}
154
+ font-size: calc(1em + (${iconSize} * 2));
155
+ }
156
+
157
+ :host([expanded]) .items {
158
+ display: block;
159
+ }
160
+ `
161
+ // prettier-ignore
162
+ .withBehaviors(new DirectionalStyleSheetBehavior(css `
163
+ ${ /* ltr styles */''}
164
+ :host(.nested) .expand-collapse-button {
165
+ left: var(
166
+ --expand-collapse-button-nested-width,
167
+ calc(${iconSize} * -1)
168
+ );
169
+ }
170
+
171
+ .expand-collapse-button svg {
172
+ transform: rotate(90deg);
173
+ }
174
+
175
+ :host([expanded]) .expand-collapse-button svg {
176
+ transform: rotate(180deg);
177
+ }
178
+ `, css `
179
+ ${ /* rtl styles */''}
180
+ :host(.nested) .expand-collapse-button {
181
+ right: var(
182
+ --expand-collapse-button-nested-width,
183
+ calc(${iconSize} * -1)
184
+ );
185
+ }
186
+
187
+ .expand-collapse-button svg {
188
+ transform: rotate(180deg);
189
+ }
190
+
191
+ :host([expanded]) .expand-collapse-button svg {
192
+ transform: rotate(135deg);
193
+ }
194
+ `));
195
195
  //# sourceMappingURL=styles.js.map
@@ -1,16 +1,16 @@
1
- import { TreeView as FoundationTreeView } from '@microsoft/fast-foundation';
2
- import { SelectionMode } from './types';
3
- /**
4
- * A function that returns a nimble-tree-view registration for configuring the component with a DesignSystem.
5
- * Implements {@link @microsoft/fast-foundation#treeViewTemplate}
6
- *
7
- *
8
- * @public
9
- * @remarks
10
- * Generates HTML Element: \<nimble-tree-view\>
11
- *
12
- */
13
- export declare class TreeView extends FoundationTreeView {
14
- selectionMode: SelectionMode;
15
- connectedCallback(): void;
16
- }
1
+ import { TreeView as FoundationTreeView } from '@microsoft/fast-foundation';
2
+ import { SelectionMode } from './types';
3
+ /**
4
+ * A function that returns a nimble-tree-view registration for configuring the component with a DesignSystem.
5
+ * Implements {@link @microsoft/fast-foundation#treeViewTemplate}
6
+ *
7
+ *
8
+ * @public
9
+ * @remarks
10
+ * Generates HTML Element: \<nimble-tree-view\>
11
+ *
12
+ */
13
+ export declare class TreeView extends FoundationTreeView {
14
+ selectionMode: SelectionMode;
15
+ connectedCallback(): void;
16
+ }