@ni/nimble-components 7.8.3 → 8.1.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.
- package/dist/all-components-bundle.js +86 -71
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +2586 -108
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/all-components.d.ts +1 -1
- package/dist/esm/all-components.js +1 -1
- package/dist/esm/all-components.js.map +1 -1
- package/dist/esm/{listbox-option → list-option}/index.d.ts +2 -2
- package/dist/esm/{listbox-option → list-option}/index.js +4 -4
- package/dist/esm/list-option/index.js.map +1 -0
- package/dist/esm/{listbox-option → list-option}/styles.d.ts +0 -0
- package/dist/esm/{listbox-option → list-option}/styles.js +0 -0
- package/dist/esm/list-option/styles.js.map +1 -0
- package/dist/esm/nimble-components/src/all-components.d.ts +1 -1
- package/dist/esm/nimble-components/src/{listbox-option → list-option}/index.d.ts +2 -2
- package/dist/esm/nimble-components/src/{listbox-option → list-option}/styles.d.ts +0 -0
- package/dist/esm/nimble-components/src/select/index.d.ts +0 -1
- package/dist/esm/nimble-components/src/text-field/types.d.ts +2 -1
- package/dist/esm/nimble-components/src/tree-item/index.d.ts +0 -4
- package/dist/esm/nimble-components/src/tree-view/index.d.ts +3 -0
- package/dist/esm/select/index.d.ts +0 -1
- package/dist/esm/select/index.js +0 -5
- package/dist/esm/select/index.js.map +1 -1
- package/dist/esm/text-field/styles.js +34 -9
- package/dist/esm/text-field/styles.js.map +1 -1
- package/dist/esm/text-field/types.d.ts +2 -1
- package/dist/esm/text-field/types.js +1 -0
- package/dist/esm/text-field/types.js.map +1 -1
- package/dist/esm/tree-item/index.d.ts +0 -4
- package/dist/esm/tree-item/index.js +2 -45
- package/dist/esm/tree-item/index.js.map +1 -1
- package/dist/esm/tree-view/index.d.ts +3 -0
- package/dist/esm/tree-view/index.js +38 -1
- package/dist/esm/tree-view/index.js.map +1 -1
- package/package.json +3 -3
- package/dist/esm/listbox-option/index.js.map +0 -1
- package/dist/esm/listbox-option/styles.js.map +0 -1
|
@@ -6718,7 +6718,7 @@
|
|
|
6718
6718
|
*
|
|
6719
6719
|
* @public
|
|
6720
6720
|
*/
|
|
6721
|
-
class ListboxOption
|
|
6721
|
+
class ListboxOption extends FoundationElement {
|
|
6722
6722
|
constructor(text, value, defaultSelected, selected) {
|
|
6723
6723
|
super();
|
|
6724
6724
|
/**
|
|
@@ -6834,22 +6834,22 @@
|
|
|
6834
6834
|
}
|
|
6835
6835
|
__decorate$1([
|
|
6836
6836
|
observable
|
|
6837
|
-
], ListboxOption
|
|
6837
|
+
], ListboxOption.prototype, "checked", void 0);
|
|
6838
6838
|
__decorate$1([
|
|
6839
6839
|
observable
|
|
6840
|
-
], ListboxOption
|
|
6840
|
+
], ListboxOption.prototype, "defaultSelected", void 0);
|
|
6841
6841
|
__decorate$1([
|
|
6842
6842
|
attr({ mode: "boolean" })
|
|
6843
|
-
], ListboxOption
|
|
6843
|
+
], ListboxOption.prototype, "disabled", void 0);
|
|
6844
6844
|
__decorate$1([
|
|
6845
6845
|
attr({ attribute: "selected", mode: "boolean" })
|
|
6846
|
-
], ListboxOption
|
|
6846
|
+
], ListboxOption.prototype, "selectedAttribute", void 0);
|
|
6847
6847
|
__decorate$1([
|
|
6848
6848
|
observable
|
|
6849
|
-
], ListboxOption
|
|
6849
|
+
], ListboxOption.prototype, "selected", void 0);
|
|
6850
6850
|
__decorate$1([
|
|
6851
6851
|
attr({ attribute: "value", mode: "fromView" })
|
|
6852
|
-
], ListboxOption
|
|
6852
|
+
], ListboxOption.prototype, "initialValue", void 0);
|
|
6853
6853
|
/**
|
|
6854
6854
|
* States and properties relating to the ARIA `option` role.
|
|
6855
6855
|
*
|
|
@@ -6870,7 +6870,7 @@
|
|
|
6870
6870
|
observable
|
|
6871
6871
|
], DelegatesARIAListboxOption.prototype, "ariaSetSize", void 0);
|
|
6872
6872
|
applyMixins(DelegatesARIAListboxOption, ARIAGlobalStatesAndProperties);
|
|
6873
|
-
applyMixins(ListboxOption
|
|
6873
|
+
applyMixins(ListboxOption, StartEnd, DelegatesARIAListboxOption);
|
|
6874
6874
|
|
|
6875
6875
|
/**
|
|
6876
6876
|
* A Listbox Custom HTML Element.
|
|
@@ -17102,7 +17102,7 @@
|
|
|
17102
17102
|
/**
|
|
17103
17103
|
* A nimble-styled HTML listbox option
|
|
17104
17104
|
*/
|
|
17105
|
-
class
|
|
17105
|
+
class ListOption extends ListboxOption {
|
|
17106
17106
|
// Workaround for https://github.com/microsoft/fast/issues/5219
|
|
17107
17107
|
get value() {
|
|
17108
17108
|
return super.value;
|
|
@@ -17119,13 +17119,13 @@
|
|
|
17119
17119
|
this.setAttribute('value', this.value);
|
|
17120
17120
|
}
|
|
17121
17121
|
}
|
|
17122
|
-
const
|
|
17123
|
-
baseName: '
|
|
17124
|
-
baseClass: ListboxOption
|
|
17122
|
+
const nimbleListOption = ListOption.compose({
|
|
17123
|
+
baseName: 'list-option',
|
|
17124
|
+
baseClass: ListboxOption,
|
|
17125
17125
|
template: listboxOptionTemplate,
|
|
17126
17126
|
styles: styles$f
|
|
17127
17127
|
});
|
|
17128
|
-
DesignSystem.getOrCreate().withPrefix('nimble').register(
|
|
17128
|
+
DesignSystem.getOrCreate().withPrefix('nimble').register(nimbleListOption());
|
|
17129
17129
|
|
|
17130
17130
|
const styles$e = css `
|
|
17131
17131
|
${display('grid')}
|
|
@@ -17554,11 +17554,6 @@
|
|
|
17554
17554
|
}
|
|
17555
17555
|
super.setPositioning();
|
|
17556
17556
|
}
|
|
17557
|
-
connectedCallback() {
|
|
17558
|
-
super.connectedCallback();
|
|
17559
|
-
// Call setPositioning() after this.forcedPosition is initialized.
|
|
17560
|
-
this.setPositioning();
|
|
17561
|
-
}
|
|
17562
17557
|
// Workaround for https://github.com/microsoft/fast/issues/5773
|
|
17563
17558
|
slottedOptionsChanged(prev, next) {
|
|
17564
17559
|
const value = this.value;
|
|
@@ -18134,6 +18129,7 @@
|
|
|
18134
18129
|
TextFieldAppearance["Underline"] = "underline";
|
|
18135
18130
|
TextFieldAppearance["Outline"] = "outline";
|
|
18136
18131
|
TextFieldAppearance["Block"] = "block";
|
|
18132
|
+
TextFieldAppearance["Frameless"] = "frameless";
|
|
18137
18133
|
})(TextFieldAppearance || (TextFieldAppearance = {}));
|
|
18138
18134
|
|
|
18139
18135
|
const styles$4 = css `
|
|
@@ -18190,11 +18186,8 @@
|
|
|
18190
18186
|
border-bottom-color: ${failColor};
|
|
18191
18187
|
}
|
|
18192
18188
|
|
|
18193
|
-
:host([readonly]
|
|
18194
|
-
border:
|
|
18195
|
-
padding: 0px;
|
|
18196
|
-
padding-bottom: 1px;
|
|
18197
|
-
background-color: transparent;
|
|
18189
|
+
:host([readonly]) .root {
|
|
18190
|
+
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
18198
18191
|
}
|
|
18199
18192
|
|
|
18200
18193
|
:host([disabled]) .root {
|
|
@@ -18208,6 +18201,10 @@
|
|
|
18208
18201
|
border-bottom-color: ${borderHoverColor};
|
|
18209
18202
|
}
|
|
18210
18203
|
|
|
18204
|
+
:host([readonly]) .root:hover {
|
|
18205
|
+
--ni-private-bottom-border-width: 1px;
|
|
18206
|
+
}
|
|
18207
|
+
|
|
18211
18208
|
:host([disabled]) .root:hover {
|
|
18212
18209
|
--ni-private-bottom-border-width: 1px;
|
|
18213
18210
|
}
|
|
@@ -18307,10 +18304,6 @@
|
|
|
18307
18304
|
white-space: nowrap;
|
|
18308
18305
|
}
|
|
18309
18306
|
|
|
18310
|
-
:host(.invalid[readonly]:not([disabled])) .errortext {
|
|
18311
|
-
top: calc(${controlHeight} - ${borderWidth});
|
|
18312
|
-
}
|
|
18313
|
-
|
|
18314
18307
|
:host(.invalid) .error-text:empty {
|
|
18315
18308
|
display: none;
|
|
18316
18309
|
}
|
|
@@ -18334,6 +18327,14 @@
|
|
|
18334
18327
|
padding-left: ${borderWidth};
|
|
18335
18328
|
padding-right: ${borderWidth};
|
|
18336
18329
|
}
|
|
18330
|
+
|
|
18331
|
+
:host([disabled]) .root {
|
|
18332
|
+
border-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
18333
|
+
}
|
|
18334
|
+
|
|
18335
|
+
:host([disabled]) .root:hover {
|
|
18336
|
+
--ni-private-bottom-border-width: 1px;
|
|
18337
|
+
}
|
|
18337
18338
|
`), appearanceBehavior(TextFieldAppearance.Block, css `
|
|
18338
18339
|
.root {
|
|
18339
18340
|
background-color: rgba(${borderRgbPartialColor}, 0.1);
|
|
@@ -18363,6 +18364,11 @@
|
|
|
18363
18364
|
);
|
|
18364
18365
|
}
|
|
18365
18366
|
|
|
18367
|
+
:host([readonly]) .root {
|
|
18368
|
+
background-color: rgba(${borderRgbPartialColor}, 0.07);
|
|
18369
|
+
border-color: transparent;
|
|
18370
|
+
}
|
|
18371
|
+
|
|
18366
18372
|
:host([disabled]) .root {
|
|
18367
18373
|
background-color: rgba(${borderRgbPartialColor}, 0.07);
|
|
18368
18374
|
}
|
|
@@ -18384,6 +18390,21 @@
|
|
|
18384
18390
|
:host(.invalid) .errortext {
|
|
18385
18391
|
top: calc(${controlHeight} - ${borderWidth});
|
|
18386
18392
|
}
|
|
18393
|
+
`), appearanceBehavior(TextFieldAppearance.Frameless, css `
|
|
18394
|
+
.root {
|
|
18395
|
+
--ni-private-bottom-border-width: 0px;
|
|
18396
|
+
padding-top: ${borderWidth};
|
|
18397
|
+
padding-left: ${borderWidth};
|
|
18398
|
+
padding-right: ${borderWidth};
|
|
18399
|
+
}
|
|
18400
|
+
|
|
18401
|
+
:host([readonly]) .root {
|
|
18402
|
+
border-color: transparent;
|
|
18403
|
+
}
|
|
18404
|
+
|
|
18405
|
+
.root:hover {
|
|
18406
|
+
--ni-private-bottom-border-width: 0px;
|
|
18407
|
+
}
|
|
18387
18408
|
`), themeBehavior(css `
|
|
18388
18409
|
${'' /* Light theme */}
|
|
18389
18410
|
.control::-ms-reveal {
|
|
@@ -18871,37 +18892,8 @@
|
|
|
18871
18892
|
*/
|
|
18872
18893
|
class TreeItem extends TreeItem$1 {
|
|
18873
18894
|
constructor() {
|
|
18874
|
-
super();
|
|
18895
|
+
super(...arguments);
|
|
18875
18896
|
this.treeView = null;
|
|
18876
|
-
this.handleClickOverride = (event) => {
|
|
18877
|
-
if (event.composedPath().includes(this.expandCollapseButton)) {
|
|
18878
|
-
// just have base class handle click event for glyph
|
|
18879
|
-
return;
|
|
18880
|
-
}
|
|
18881
|
-
const treeItem = this.getImmediateTreeItem(event.target);
|
|
18882
|
-
if (treeItem?.disabled || treeItem !== this) {
|
|
18883
|
-
// don't allow base TreeItem to emit a 'selected-change' event when a disabled item is clicked
|
|
18884
|
-
event.stopImmediatePropagation();
|
|
18885
|
-
return;
|
|
18886
|
-
}
|
|
18887
|
-
const leavesOnly = this.treeView?.selectionMode === TreeViewSelectionMode.LeavesOnly;
|
|
18888
|
-
const all = this.treeView?.selectionMode === TreeViewSelectionMode.All;
|
|
18889
|
-
const hasChildren = this.hasChildTreeItems();
|
|
18890
|
-
if ((leavesOnly && !hasChildren) || all) {
|
|
18891
|
-
const selectedTreeItem = this.getImmediateTreeItem(this.treeView?.currentSelected);
|
|
18892
|
-
// deselect currently selected item if different than this instance
|
|
18893
|
-
if (selectedTreeItem && this !== this.treeView?.currentSelected) {
|
|
18894
|
-
selectedTreeItem.selected = false;
|
|
18895
|
-
}
|
|
18896
|
-
this.selected = true;
|
|
18897
|
-
}
|
|
18898
|
-
else {
|
|
18899
|
-
// implicit (hasChildren && leavesOnly) || none, so only allow expand/collapse, not select
|
|
18900
|
-
this.expanded = !this.expanded;
|
|
18901
|
-
}
|
|
18902
|
-
// don't allow base class to process click event
|
|
18903
|
-
event.stopImmediatePropagation();
|
|
18904
|
-
};
|
|
18905
18897
|
// This prevents the toggling of selected state when a TreeItem is clicked multiple times,
|
|
18906
18898
|
// which is what the FAST TreeItem allows
|
|
18907
18899
|
this.handleSelectedChange = (event) => {
|
|
@@ -18910,7 +18902,6 @@
|
|
|
18910
18902
|
this.setGroupSelectionOnRootParentTreeItem(this);
|
|
18911
18903
|
}
|
|
18912
18904
|
};
|
|
18913
|
-
this.addEventListener('click', this.handleClickOverride);
|
|
18914
18905
|
}
|
|
18915
18906
|
connectedCallback() {
|
|
18916
18907
|
super.connectedCallback();
|
|
@@ -18922,14 +18913,9 @@
|
|
|
18922
18913
|
}
|
|
18923
18914
|
disconnectedCallback() {
|
|
18924
18915
|
super.disconnectedCallback();
|
|
18925
|
-
this.removeEventListener('click', this.handleClickOverride);
|
|
18926
18916
|
this.removeEventListener('selected-change', this.handleSelectedChange);
|
|
18927
18917
|
this.treeView = null;
|
|
18928
18918
|
}
|
|
18929
|
-
hasChildTreeItems() {
|
|
18930
|
-
const treeItemChild = this.querySelector('[role="treeitem"]');
|
|
18931
|
-
return treeItemChild !== null;
|
|
18932
|
-
}
|
|
18933
18919
|
clearTreeGroupSelection() {
|
|
18934
18920
|
const currentGroupSelection = this.treeView?.querySelectorAll(`[${groupSelectedAttribute}]`);
|
|
18935
18921
|
currentGroupSelection?.forEach(treeItem => treeItem.removeAttribute(groupSelectedAttribute));
|
|
@@ -18944,14 +18930,6 @@
|
|
|
18944
18930
|
currentItem.setAttribute(groupSelectedAttribute, 'true');
|
|
18945
18931
|
}
|
|
18946
18932
|
}
|
|
18947
|
-
getImmediateTreeItem(element) {
|
|
18948
|
-
let foundElement = element;
|
|
18949
|
-
while (foundElement
|
|
18950
|
-
&& !(foundElement?.getAttribute('role') === 'treeitem')) {
|
|
18951
|
-
foundElement = foundElement?.parentElement;
|
|
18952
|
-
}
|
|
18953
|
-
return foundElement;
|
|
18954
|
-
}
|
|
18955
18933
|
/**
|
|
18956
18934
|
* This was copied directly from the FAST TreeItem implementation
|
|
18957
18935
|
* @returns the root tree view
|
|
@@ -18999,6 +18977,43 @@
|
|
|
18999
18977
|
super(...arguments);
|
|
19000
18978
|
this.selectionMode = TreeViewSelectionMode.All;
|
|
19001
18979
|
}
|
|
18980
|
+
handleClick(e) {
|
|
18981
|
+
if (e.defaultPrevented) {
|
|
18982
|
+
// handled, do nothing
|
|
18983
|
+
return false;
|
|
18984
|
+
}
|
|
18985
|
+
if (!(e.target instanceof Element) || !isTreeItemElement(e.target)) {
|
|
18986
|
+
// not a tree item, ignore
|
|
18987
|
+
return true;
|
|
18988
|
+
}
|
|
18989
|
+
const item = e.target;
|
|
18990
|
+
if (item.disabled) {
|
|
18991
|
+
return false;
|
|
18992
|
+
}
|
|
18993
|
+
if (this.canSelect(item)) {
|
|
18994
|
+
item.selected = true;
|
|
18995
|
+
}
|
|
18996
|
+
else if (this.itemHasChildren(item)) {
|
|
18997
|
+
item.expanded = !item.expanded;
|
|
18998
|
+
}
|
|
18999
|
+
return true;
|
|
19000
|
+
}
|
|
19001
|
+
canSelect(item) {
|
|
19002
|
+
switch (this.selectionMode) {
|
|
19003
|
+
case TreeViewSelectionMode.All:
|
|
19004
|
+
return true;
|
|
19005
|
+
case TreeViewSelectionMode.None:
|
|
19006
|
+
return false;
|
|
19007
|
+
case TreeViewSelectionMode.LeavesOnly:
|
|
19008
|
+
return !this.itemHasChildren(item);
|
|
19009
|
+
default:
|
|
19010
|
+
return true;
|
|
19011
|
+
}
|
|
19012
|
+
}
|
|
19013
|
+
itemHasChildren(item) {
|
|
19014
|
+
const treeItemChild = item.querySelector('[role="treeitem"]');
|
|
19015
|
+
return treeItemChild !== null;
|
|
19016
|
+
}
|
|
19002
19017
|
}
|
|
19003
19018
|
__decorate([
|
|
19004
19019
|
attr({ attribute: 'selection-mode' })
|