@aquera/nile-elements 0.1.52-beta-1.2 → 0.1.52-beta-1.3
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/README.md +0 -4
- package/demo/index.html +53 -150
- package/dist/{fixture-fe6c932e.cjs.js → fixture-324a7ef9.cjs.js} +2 -2
- package/dist/{fixture-fe6c932e.cjs.js.map → fixture-324a7ef9.cjs.js.map} +1 -1
- package/dist/{fixture-e7023246.esm.js → fixture-ba65eb22.esm.js} +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +618 -1364
- package/dist/internal/form.cjs.js +1 -1
- package/dist/internal/form.cjs.js.map +1 -1
- package/dist/internal/form.esm.js +1 -1
- package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
- package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
- package/dist/nile-auto-complete/index.cjs.js +1 -1
- package/dist/nile-auto-complete/index.esm.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js +17 -1
- package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.esm.js +29 -8
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js.map +1 -1
- package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
- package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
- package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.test.esm.js +1 -1
- package/dist/nile-button/nile-button.test.cjs.js +1 -1
- package/dist/nile-button/nile-button.test.esm.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
- package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
- package/dist/nile-calendar/nile-calendar.test.cjs.js.map +1 -1
- package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
- package/dist/nile-card/nile-card.test.cjs.js +1 -1
- package/dist/nile-card/nile-card.test.esm.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
- package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.test.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.test.esm.js +1 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js +5 -5
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
- package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
- package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
- package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js +1 -1
- package/dist/nile-filter-chip/nile-filter-chip.test.esm.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
- package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
- package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
- package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.test.esm.js +1 -1
- package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
- package/dist/nile-icon/nile-icon.test.esm.js +1 -1
- package/dist/nile-input/nile-input.test.cjs.js +1 -1
- package/dist/nile-input/nile-input.test.esm.js +1 -1
- package/dist/nile-link/nile-link.test.cjs.js +1 -1
- package/dist/nile-link/nile-link.test.esm.js +1 -1
- package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
- package/dist/nile-loader/nile-loader.test.esm.js +1 -1
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.css.cjs.js +1 -1
- package/dist/nile-option/nile-option.css.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.css.esm.js +1 -1
- package/dist/nile-option/nile-option.esm.js +2 -2
- package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.test.esm.js +1 -1
- package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
- package/dist/nile-popup/nile-popup.test.esm.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
- package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
- package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
- package/dist/nile-radio/nile-radio.test.esm.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
- package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/index.esm.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.esm.js +2 -2
- package/dist/nile-select/nile-select.test.cjs.js +1 -1
- package/dist/nile-select/nile-select.test.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.test.esm.js +2 -2
- package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
- package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
- package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
- package/dist/src/index.d.ts +0 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/form.js +2 -2
- package/dist/src/internal/form.js.map +1 -1
- package/dist/src/nile-calendar/test.d.ts +0 -0
- package/dist/src/nile-calendar/test.js +2 -0
- package/dist/src/nile-calendar/test.js.map +1 -0
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +1 -0
- package/dist/src/nile-code-editor/nile-code-editor.js +12 -0
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-option/nile-option.css.js +1 -1
- package/dist/src/nile-option/nile-option.css.js.map +1 -1
- package/dist/src/nile-option/nile-option.d.ts +1 -5
- package/dist/src/nile-option/nile-option.js +6 -21
- package/dist/src/nile-option/nile-option.js.map +1 -1
- package/dist/src/nile-select/nile-select.d.ts +2 -11
- package/dist/src/nile-select/nile-select.js +18 -37
- package/dist/src/nile-select/nile-select.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/index.ts +1 -3
- package/src/internal/form.ts +2 -2
- package/src/nile-code-editor/nile-code-editor.ts +15 -0
- package/src/nile-option/nile-option.css.ts +1 -1
- package/src/nile-option/nile-option.ts +3 -17
- package/src/nile-select/nile-select.ts +9 -35
- package/vscode-html-custom-data.json +2 -229
- package/dist/nile-select/virtual-scroll-helper.cjs.js +0 -2
- package/dist/nile-select/virtual-scroll-helper.cjs.js.map +0 -1
- package/dist/nile-select/virtual-scroll-helper.esm.js +0 -38
- package/dist/nile-virtual-select/index.cjs.js +0 -2
- package/dist/nile-virtual-select/index.cjs.js.map +0 -1
- package/dist/nile-virtual-select/index.esm.js +0 -1
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js +0 -2
- package/dist/nile-virtual-select/nile-virtual-select.cjs.js.map +0 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js +0 -2
- package/dist/nile-virtual-select/nile-virtual-select.css.cjs.js.map +0 -1
- package/dist/nile-virtual-select/nile-virtual-select.css.esm.js +0 -467
- package/dist/nile-virtual-select/nile-virtual-select.esm.js +0 -227
- package/dist/nile-virtual-select/nile-virtual-select.test.cjs.js +0 -2
- package/dist/nile-virtual-select/nile-virtual-select.test.cjs.js.map +0 -1
- package/dist/nile-virtual-select/nile-virtual-select.test.esm.js +0 -49
- package/dist/nile-virtual-select/renderer.cjs.js +0 -2
- package/dist/nile-virtual-select/renderer.cjs.js.map +0 -1
- package/dist/nile-virtual-select/renderer.esm.js +0 -18
- package/dist/nile-virtual-select/search-manager.cjs.js +0 -2
- package/dist/nile-virtual-select/search-manager.cjs.js.map +0 -1
- package/dist/nile-virtual-select/search-manager.esm.js +0 -1
- package/dist/nile-virtual-select/selection-manager.cjs.js +0 -2
- package/dist/nile-virtual-select/selection-manager.cjs.js.map +0 -1
- package/dist/nile-virtual-select/selection-manager.esm.js +0 -1
- package/dist/nile-virtual-select/types.cjs.js +0 -2
- package/dist/nile-virtual-select/types.cjs.js.map +0 -1
- package/dist/nile-virtual-select/types.esm.js +0 -1
- package/dist/src/nile-select/virtual-scroll-helper.d.ts +0 -9
- package/dist/src/nile-select/virtual-scroll-helper.js +0 -51
- package/dist/src/nile-select/virtual-scroll-helper.js.map +0 -1
- package/dist/src/nile-virtual-select/index.d.ts +0 -1
- package/dist/src/nile-virtual-select/index.js +0 -2
- package/dist/src/nile-virtual-select/index.js.map +0 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.css.d.ts +0 -12
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js +0 -479
- package/dist/src/nile-virtual-select/nile-virtual-select.css.js.map +0 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.d.ts +0 -263
- package/dist/src/nile-virtual-select/nile-virtual-select.js +0 -1183
- package/dist/src/nile-virtual-select/nile-virtual-select.js.map +0 -1
- package/dist/src/nile-virtual-select/nile-virtual-select.test.d.ts +0 -7
- package/dist/src/nile-virtual-select/nile-virtual-select.test.js +0 -341
- package/dist/src/nile-virtual-select/nile-virtual-select.test.js.map +0 -1
- package/dist/src/nile-virtual-select/renderer.d.ts +0 -11
- package/dist/src/nile-virtual-select/renderer.js +0 -51
- package/dist/src/nile-virtual-select/renderer.js.map +0 -1
- package/dist/src/nile-virtual-select/search-manager.d.ts +0 -12
- package/dist/src/nile-virtual-select/search-manager.js +0 -40
- package/dist/src/nile-virtual-select/search-manager.js.map +0 -1
- package/dist/src/nile-virtual-select/selection-manager.d.ts +0 -12
- package/dist/src/nile-virtual-select/selection-manager.js +0 -64
- package/dist/src/nile-virtual-select/selection-manager.js.map +0 -1
- package/dist/src/nile-virtual-select/types.d.ts +0 -50
- package/dist/src/nile-virtual-select/types.js +0 -8
- package/dist/src/nile-virtual-select/types.js.map +0 -1
- package/dist/virtualize-a4a40d96.esm.js +0 -22
- package/dist/virtualize-b6a2fbe0.cjs.js +0 -18
- package/dist/virtualize-b6a2fbe0.cjs.js.map +0 -1
- package/src/nile-select/virtual-scroll-helper.ts +0 -56
- package/src/nile-virtual-select/index.ts +0 -1
- package/src/nile-virtual-select/nile-virtual-select.css.ts +0 -481
- package/src/nile-virtual-select/nile-virtual-select.test.ts +0 -414
- package/src/nile-virtual-select/nile-virtual-select.ts +0 -1268
- package/src/nile-virtual-select/renderer.ts +0 -73
- package/src/nile-virtual-select/search-manager.ts +0 -50
- package/src/nile-virtual-select/selection-manager.ts +0 -75
- package/src/nile-virtual-select/types.ts +0 -54
@@ -36,6 +36,7 @@ export declare class NileOption extends NileElement {
|
|
36
36
|
private cachedTextLabel;
|
37
37
|
defaultSlot: HTMLSlotElement;
|
38
38
|
current: boolean;
|
39
|
+
selected: boolean;
|
39
40
|
hasHover: boolean;
|
40
41
|
hidden: boolean;
|
41
42
|
isMultipleSelect: boolean;
|
@@ -48,10 +49,6 @@ export declare class NileOption extends NileElement {
|
|
48
49
|
showCheckbox: boolean;
|
49
50
|
/** Draws the option in a disabled state, preventing selection. */
|
50
51
|
disabled: boolean;
|
51
|
-
/** Forces the option to display in multiple select mode with checkboxes. */
|
52
|
-
multiple: boolean;
|
53
|
-
/** Indicates whether the option is selected. */
|
54
|
-
selected: boolean;
|
55
52
|
connectedCallback(): void;
|
56
53
|
protected updated(_changedProperties: PropertyValues): void;
|
57
54
|
private handleDefaultSlotChange;
|
@@ -59,7 +56,6 @@ export declare class NileOption extends NileElement {
|
|
59
56
|
private handleMouseLeave;
|
60
57
|
handleDisabledChange(): void;
|
61
58
|
handleSelectedChange(): void;
|
62
|
-
handleMultipleChange(): void;
|
63
59
|
handleValueChange(): void;
|
64
60
|
/** Returns a plain text label based on the option's content. */
|
65
61
|
getTextLabel(): string;
|
@@ -39,6 +39,7 @@ let NileOption = class NileOption extends NileElement {
|
|
39
39
|
constructor() {
|
40
40
|
super(...arguments);
|
41
41
|
this.current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)
|
42
|
+
this.selected = false; // the option is selected and has aria-selected="true"
|
42
43
|
this.hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging
|
43
44
|
this.hidden = false; // the option is hidden
|
44
45
|
this.isMultipleSelect = false;
|
@@ -51,17 +52,13 @@ let NileOption = class NileOption extends NileElement {
|
|
51
52
|
this.showCheckbox = false;
|
52
53
|
/** Draws the option in a disabled state, preventing selection. */
|
53
54
|
this.disabled = false;
|
54
|
-
/** Forces the option to display in multiple select mode with checkboxes. */
|
55
|
-
this.multiple = false;
|
56
|
-
/** Indicates whether the option is selected. */
|
57
|
-
this.selected = false;
|
58
55
|
}
|
59
56
|
connectedCallback() {
|
60
57
|
super.connectedCallback();
|
61
58
|
this.setAttribute('role', 'option');
|
62
59
|
this.setAttribute('aria-selected', 'false');
|
63
|
-
// Find the closest parent 'nile-select'
|
64
|
-
const parentSelect = this.closest('nile-select')
|
60
|
+
// Find the closest parent 'nile-select' element
|
61
|
+
const parentSelect = this.closest('nile-select');
|
65
62
|
// Check if the parent has the 'multiple' attribute
|
66
63
|
if (parentSelect && parentSelect.hasAttribute('multiple')) {
|
67
64
|
let multipleValue = parentSelect.getAttribute('multiple');
|
@@ -72,9 +69,6 @@ let NileOption = class NileOption extends NileElement {
|
|
72
69
|
this.isMultipleSelect = Boolean(multipleValue);
|
73
70
|
}
|
74
71
|
}
|
75
|
-
if (this.multiple) {
|
76
|
-
this.isMultipleSelect = true;
|
77
|
-
}
|
78
72
|
}
|
79
73
|
updated(_changedProperties) {
|
80
74
|
if (_changedProperties.has('showCheckbox')) {
|
@@ -106,9 +100,6 @@ let NileOption = class NileOption extends NileElement {
|
|
106
100
|
handleSelectedChange() {
|
107
101
|
this.setAttribute('aria-selected', this.selected ? 'true' : 'false');
|
108
102
|
}
|
109
|
-
handleMultipleChange() {
|
110
|
-
this.isMultipleSelect = this.multiple;
|
111
|
-
}
|
112
103
|
handleValueChange() {
|
113
104
|
// Ensure the value is a string. This ensures the next line doesn't error and allows framework users to pass numbers
|
114
105
|
// instead of requiring them to cast the value to a string.
|
@@ -172,6 +163,9 @@ __decorate([
|
|
172
163
|
__decorate([
|
173
164
|
state()
|
174
165
|
], NileOption.prototype, "current", void 0);
|
166
|
+
__decorate([
|
167
|
+
state()
|
168
|
+
], NileOption.prototype, "selected", void 0);
|
175
169
|
__decorate([
|
176
170
|
state()
|
177
171
|
], NileOption.prototype, "hasHover", void 0);
|
@@ -190,21 +184,12 @@ __decorate([
|
|
190
184
|
__decorate([
|
191
185
|
property({ type: Boolean, reflect: true })
|
192
186
|
], NileOption.prototype, "disabled", void 0);
|
193
|
-
__decorate([
|
194
|
-
property({ type: Boolean, reflect: true })
|
195
|
-
], NileOption.prototype, "multiple", void 0);
|
196
|
-
__decorate([
|
197
|
-
property({ type: Boolean, reflect: true })
|
198
|
-
], NileOption.prototype, "selected", void 0);
|
199
187
|
__decorate([
|
200
188
|
watch('disabled')
|
201
189
|
], NileOption.prototype, "handleDisabledChange", null);
|
202
190
|
__decorate([
|
203
191
|
watch('selected')
|
204
192
|
], NileOption.prototype, "handleSelectedChange", null);
|
205
|
-
__decorate([
|
206
|
-
watch('multiple')
|
207
|
-
], NileOption.prototype, "handleMultipleChange", null);
|
208
193
|
__decorate([
|
209
194
|
watch('value')
|
210
195
|
], NileOption.prototype, "handleValueChange", null);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-option.js","sourceRoot":"","sources":["../../../src/nile-option/nile-option.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE1C,OAAO,WAAW,MAAM,0BAA0B,CAAC;AACnD,OAAO,kBAAkB,CAAC;AAE1B;;;;;GAKG;AAEH;;;;;;;;;;;;;;;GAeG;AAGI,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,WAAW;IAApC;;QAOI,YAAO,GAAG,KAAK,CAAC,CAAC,qFAAqF;QACtG,aAAQ,GAAG,KAAK,CAAC,CAAC,yEAAyE;QAC3F,WAAM,GAAG,KAAK,CAAC,CAAC,uBAAuB;QACvC,qBAAgB,GAAG,KAAK,CAAC;QAElC;;;;WAIG;QAC0B,UAAK,GAAG,EAAE,CAAC;QAEX,iBAAY,GAAY,KAAK,CAAC;QAE3D,kEAAkE;QACtB,aAAQ,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CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAGjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAGjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAyD7D;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,OAAO,CAAC;mDAed;AAlHU,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAgKtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, CSSResultArray, TemplateResult } from 'lit';\nimport { styles } from './nile-option.css';\nimport '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { html } from 'lit';\nimport { watch } from '../internal/watch';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport NileElement from '../internal/nile-element';\nimport '../nile-checkbox';\n\n/**\n * Nile icon component.\n *\n * @tag nile-option\n *\n */\n\n/**\n * @summary Options define the selectable items within various form controls such as [select](/components/select).\n * @status stable\n *\n * @dependency nile-icon\n *\n * @slot - The option's label.\n * @slot prefix - Used to prepend an icon or similar element to the menu item.\n * @slot suffix - Used to append an icon or similar element to the menu item.\n *\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart base - The component's base wrapper.\n * @csspart label - The option's label.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart suffix - The container that wraps the suffix.\n */\n\n@customElement('nile-option')\nexport class NileOption extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private cachedTextLabel: string;\n\n @query('.option__label') defaultSlot: HTMLSlotElement;\n\n @state() current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)\n @state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging\n @state() hidden = false; // the option is hidden\n @state() isMultipleSelect = false;\n\n /**\n * The option's value. When selected, the containing form control will receive this value. The value must be unique\n * from other options in the same group. Values may not contain spaces, as spaces are used as delimiters when listing\n * multiple values.\n */\n @property({ reflect: true }) value = '';\n\n @property({ type: Boolean }) showCheckbox: boolean = false;\n\n /** Draws the option in a disabled state, preventing selection. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Forces the option to display in multiple select mode with checkboxes. */\n @property({ type: Boolean, reflect: true }) multiple = false;\n\n /** Indicates whether the option is selected. */\n @property({ type: Boolean, reflect: true }) selected = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'option');\n this.setAttribute('aria-selected', 'false');\n\n // Find the closest parent 'nile-select' or 'nile-virtual-select' element\n const parentSelect = this.closest('nile-select') || this.closest('nile-virtual-select');\n\n // Check if the parent has the 'multiple' attribute\n if (parentSelect && parentSelect.hasAttribute('multiple')) {\n let multipleValue = parentSelect.getAttribute('multiple');\n if (multipleValue !== 'false') {\n if(multipleValue === ''){\n multipleValue = 'true';\n }\n this.isMultipleSelect = Boolean(multipleValue);\n }\n }\n\n if (this.multiple) {\n this.isMultipleSelect = true;\n }\n }\n\n protected updated(_changedProperties: PropertyValues): void {\n if(_changedProperties.has('showCheckbox')) {\n this.isMultipleSelect = this.showCheckbox;\n }\n }\n\n private handleDefaultSlotChange() {\n const textLabel = this.getTextLabel();\n\n // Ignore the first time the label is set\n if (typeof this.cachedTextLabel === 'undefined') {\n this.cachedTextLabel = textLabel;\n return;\n }\n\n // When the label changes, emit a slotchange event so parent controls see it\n if (textLabel !== this.cachedTextLabel) {\n this.cachedTextLabel = textLabel;\n this.emit('slotchange');\n }\n }\n\n private handleMouseEnter() {\n this.hasHover = true;\n }\n\n private handleMouseLeave() {\n this.hasHover = false;\n }\n\n @watch('disabled')\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('selected')\n handleSelectedChange() {\n this.setAttribute('aria-selected', this.selected ? 'true' : 'false');\n }\n\n @watch('multiple')\n handleMultipleChange() {\n this.isMultipleSelect = this.multiple;\n }\n\n @watch('value')\n handleValueChange() {\n // Ensure the value is a string. This ensures the next line doesn't error and allows framework users to pass numbers\n // instead of requiring them to cast the value to a string.\n if (typeof this.value !== 'string') {\n this.value = String(this.value);\n }\n\n // if (this.value.includes(' ')) {\n // console.error(\n // `Option values cannot include a space. All spaces have been replaced with underscores.`,\n // this\n // );\n // this.value = this.value.replace(/ /g, '_');\n // }\n }\n\n /** Returns a plain text label based on the option's content. */\n getTextLabel() {\n // Search for a label element inside the component\n const labelElement = this.querySelector('label');\n\n // If a label element is found, return its text content\n if (labelElement) {\n return labelElement.textContent?.trim() ?? '';\n }\n\n // If no label element is found, return the existing behavior\n return (this.textContent ?? '').trim();\n }\n\n render() {\n return html`\n ${!this.hidden\n ? html` <div\n part=\"base\"\n class=${classMap({\n option: true,\n 'option--single-select': !this.isMultipleSelect,\n 'option--current': this.selected && !this.isMultipleSelect,\n 'option--disabled': this.disabled,\n 'option--selected': this.selected && !this.isMultipleSelect,\n 'option--hover': this.hasHover,\n })}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n >\n\n ${this.isMultipleSelect ? html`<nile-checkbox class=\"option--checkbox\" .checked=${this.selected}></nile-checkbox>` : ''}\n\n <slot part=\"prefix\" name=\"prefix\" class=\"option__prefix\"></slot>\n <slot\n part=\"label\"\n class=\"option__label\"\n @slotchange=${this.handleDefaultSlotChange}\n ></slot>\n <slot part=\"suffix\" name=\"suffix\" class=\"option__suffix\"></slot>\n </div>`\n : ''}\n `;\n }\n}\n\nexport default NileOption;\n\ndeclare global {\n interface HT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C,gBAAgB;0BACrB,IAAI,CAAC,gBAAgB;;;YAGnC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAA,oDAAoD,IAAI,CAAC,QAAQ,mBAAmB,CAAC,CAAC,CAAC,EAAE;;;;;;4BAMrG,IAAI,CAAC,uBAAuB;;;iBAGvC;YACT,CAAC,CAAC,EAAE;KACP,CAAC;IACJ,CAAC;;AAhJM,iBAAM,GAAmB,MAAM,AAAzB,CAA0B;AAId;IAAxB,KAAK,CAAC,gBAAgB,CAAC;+CAA8B;AAE7C;IAAR,KAAK,EAAE;2CAAiB;AAChB;IAAR,KAAK,EAAE;4CAAkB;AACjB;IAAR,KAAK,EAAE;4CAAkB;AACjB;IAAR,KAAK,EAAE;0CAAgB;AACf;IAAR,KAAK,EAAE;oDAA0B;AAOL;IAA5B,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;yCAAY;AAEX;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAA+B;AAGf;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAqD7D;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,UAAU,CAAC;sDAGjB;AAGD;IADC,KAAK,CAAC,OAAO,CAAC;mDAed;AApGU,UAAU;IADtB,aAAa,CAAC,aAAa,CAAC;GAChB,UAAU,CAkJtB;;AAED,eAAe,UAAU,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, CSSResultArray, TemplateResult } from 'lit';\nimport { styles } from './nile-option.css';\nimport '../nile-icon';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { html } from 'lit';\nimport { watch } from '../internal/watch';\nimport type { CSSResultGroup, PropertyValues } from 'lit';\nimport NileElement from '../internal/nile-element';\nimport '../nile-checkbox';\n\n/**\n * Nile icon component.\n *\n * @tag nile-option\n *\n */\n\n/**\n * @summary Options define the selectable items within various form controls such as [select](/components/select).\n * @status stable\n *\n * @dependency nile-icon\n *\n * @slot - The option's label.\n * @slot prefix - Used to prepend an icon or similar element to the menu item.\n * @slot suffix - Used to append an icon or similar element to the menu item.\n *\n * @csspart checked-icon - The checked icon, an `<nile-icon>` element.\n * @csspart base - The component's base wrapper.\n * @csspart label - The option's label.\n * @csspart prefix - The container that wraps the prefix.\n * @csspart suffix - The container that wraps the suffix.\n */\n\n@customElement('nile-option')\nexport class NileOption extends NileElement {\n static styles: CSSResultGroup = styles;\n\n private cachedTextLabel: string;\n\n @query('.option__label') defaultSlot: HTMLSlotElement;\n\n @state() current = false; // the user has keyed into the option, but hasn't selected it yet (shows a highlight)\n @state() selected = false; // the option is selected and has aria-selected=\"true\"\n @state() hasHover = false; // we need this because Safari doesn't honor :hover styles while dragging\n @state() hidden = false; // the option is hidden\n @state() isMultipleSelect = false;\n\n /**\n * The option's value. When selected, the containing form control will receive this value. The value must be unique\n * from other options in the same group. Values may not contain spaces, as spaces are used as delimiters when listing\n * multiple values.\n */\n @property({ reflect: true }) value = '';\n\n @property({ type: Boolean }) showCheckbox: boolean = false;\n\n /** Draws the option in a disabled state, preventing selection. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'option');\n this.setAttribute('aria-selected', 'false');\n\n // Find the closest parent 'nile-select' element\n const parentSelect = this.closest('nile-select');\n\n // Check if the parent has the 'multiple' attribute\n if (parentSelect && parentSelect.hasAttribute('multiple')) {\n let multipleValue = parentSelect.getAttribute('multiple');\n if (multipleValue !== 'false') {\n if(multipleValue === ''){\n multipleValue = 'true';\n }\n this.isMultipleSelect = Boolean(multipleValue);\n }\n }\n }\n\n protected updated(_changedProperties: PropertyValues): void {\n if(_changedProperties.has('showCheckbox')) {\n this.isMultipleSelect = this.showCheckbox;\n }\n }\n\n private handleDefaultSlotChange() {\n const textLabel = this.getTextLabel();\n\n // Ignore the first time the label is set\n if (typeof this.cachedTextLabel === 'undefined') {\n this.cachedTextLabel = textLabel;\n return;\n }\n\n // When the label changes, emit a slotchange event so parent controls see it\n if (textLabel !== this.cachedTextLabel) {\n this.cachedTextLabel = textLabel;\n this.emit('slotchange');\n }\n }\n\n private handleMouseEnter() {\n this.hasHover = true;\n }\n\n private handleMouseLeave() {\n this.hasHover = false;\n }\n\n @watch('disabled')\n handleDisabledChange() {\n this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');\n }\n\n @watch('selected')\n handleSelectedChange() {\n this.setAttribute('aria-selected', this.selected ? 'true' : 'false');\n }\n\n @watch('value')\n handleValueChange() {\n // Ensure the value is a string. This ensures the next line doesn't error and allows framework users to pass numbers\n // instead of requiring them to cast the value to a string.\n if (typeof this.value !== 'string') {\n this.value = String(this.value);\n }\n\n // if (this.value.includes(' ')) {\n // console.error(\n // `Option values cannot include a space. All spaces have been replaced with underscores.`,\n // this\n // );\n // this.value = this.value.replace(/ /g, '_');\n // }\n }\n\n /** Returns a plain text label based on the option's content. */\n getTextLabel() {\n // Search for a label element inside the component\n const labelElement = this.querySelector('label');\n\n // If a label element is found, return its text content\n if (labelElement) {\n return labelElement.textContent?.trim() ?? '';\n }\n\n // If no label element is found, return the existing behavior\n return (this.textContent ?? '').trim();\n }\n\n render() {\n return html`\n ${!this.hidden\n ? html` <div\n part=\"base\"\n class=${classMap({\n option: true,\n 'option--single-select': !this.isMultipleSelect,\n 'option--current': this.selected && !this.isMultipleSelect,\n 'option--disabled': this.disabled,\n 'option--selected': this.selected && !this.isMultipleSelect,\n 'option--hover': this.hasHover,\n })}\n @mouseenter=${this.handleMouseEnter}\n @mouseleave=${this.handleMouseLeave}\n >\n\n ${this.isMultipleSelect ? html`<nile-checkbox class=\"option--checkbox\" .checked=${this.selected}></nile-checkbox>` : ''}\n\n <slot part=\"prefix\" name=\"prefix\" class=\"option__prefix\"></slot>\n <slot\n part=\"label\"\n class=\"option__label\"\n @slotchange=${this.handleDefaultSlotChange}\n ></slot>\n <slot part=\"suffix\" name=\"suffix\" class=\"option__suffix\"></slot>\n </div>`\n : ''}\n `;\n }\n}\n\nexport default NileOption;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-option': NileOption;\n }\n}\n"]}
|
@@ -12,8 +12,6 @@ import type { CSSResultGroup, PropertyValues } from 'lit';
|
|
12
12
|
import type { NileFormControl } from '../internal/nile-element';
|
13
13
|
import type NileOption from '../nile-option/nile-option';
|
14
14
|
import type NilePopup from '../nile-popup/nile-popup';
|
15
|
-
import type { RenderItemConfig } from '../nile-virtual-select/types.js';
|
16
|
-
import '../nile-virtual-select/nile-virtual-select';
|
17
15
|
/**
|
18
16
|
* Nile icon component.
|
19
17
|
*
|
@@ -28,7 +26,6 @@ import '../nile-virtual-select/nile-virtual-select';
|
|
28
26
|
* @dependency nile-icon
|
29
27
|
* @dependency nile-popup
|
30
28
|
* @dependency nile-tag
|
31
|
-
* @dependency nile-virtual-select
|
32
29
|
*
|
33
30
|
* @slot - The listbox options. Must be `<nile-option>` elements. You can use `<nile-divider>` to group items visually.
|
34
31
|
* @slot label - The input's label. Alternatively, you can use the `label` attribute.
|
@@ -67,8 +64,7 @@ import '../nile-virtual-select/nile-virtual-select';
|
|
67
64
|
*/
|
68
65
|
export declare class NileSelect extends NileElement implements NileFormControl {
|
69
66
|
static styles: CSSResultGroup;
|
70
|
-
private formControlController;
|
71
|
-
private virtualScrollHelper;
|
67
|
+
private readonly formControlController;
|
72
68
|
private readonly hasSlotController;
|
73
69
|
private typeToSelectString;
|
74
70
|
private typeToSelectTimeout;
|
@@ -155,15 +151,10 @@ export declare class NileSelect extends NileElement implements NileFormControl {
|
|
155
151
|
oldMaxOptionsVisible: number;
|
156
152
|
showNoResults: boolean;
|
157
153
|
noResultsMessage: string;
|
158
|
-
/** Enhanced configuration for rendering items with support for display text, value, and search text */
|
159
|
-
renderItemConfig?: RenderItemConfig;
|
160
|
-
data: any;
|
161
|
-
enableVirtualScroll: boolean;
|
162
154
|
/** Gets the validity state object */
|
163
155
|
get validity(): ValidityState;
|
164
156
|
/** Gets the validation message */
|
165
157
|
get validationMessage(): string;
|
166
|
-
constructor();
|
167
158
|
connectedCallback(): void;
|
168
159
|
disconnectedCallback(): void;
|
169
160
|
protected updated(_changedProperties: PropertyValues): void;
|
@@ -231,7 +222,7 @@ export declare class NileSelect extends NileElement implements NileFormControl {
|
|
231
222
|
onInputChange(event: Event): void;
|
232
223
|
calculateWidthOfSelectTagsDiv(): number | undefined;
|
233
224
|
calculateTotalWidthOfTags(): void;
|
234
|
-
render():
|
225
|
+
render(): import("lit-html").TemplateResult<1>;
|
235
226
|
nileInput(value: any): void;
|
236
227
|
nileChange(value: any): void;
|
237
228
|
}
|
@@ -24,8 +24,6 @@ import { watch } from '../internal/watch';
|
|
24
24
|
import NileElement from '../internal/nile-element';
|
25
25
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
26
26
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
27
|
-
import '../nile-virtual-select/nile-virtual-select';
|
28
|
-
import { VirtualScrollHelper } from './virtual-scroll-helper';
|
29
27
|
/**
|
30
28
|
* Nile icon component.
|
31
29
|
*
|
@@ -40,7 +38,6 @@ import { VirtualScrollHelper } from './virtual-scroll-helper';
|
|
40
38
|
* @dependency nile-icon
|
41
39
|
* @dependency nile-popup
|
42
40
|
* @dependency nile-tag
|
43
|
-
* @dependency nile-virtual-select
|
44
41
|
*
|
45
42
|
* @slot - The listbox options. Must be `<nile-option>` elements. You can use `<nile-divider>` to group items visually.
|
46
43
|
* @slot label - The input's label. Alternatively, you can use the `label` attribute.
|
@@ -78,16 +75,12 @@ import { VirtualScrollHelper } from './virtual-scroll-helper';
|
|
78
75
|
* @csspart expand-icon - The container that wraps the expand icon.
|
79
76
|
*/
|
80
77
|
let NileSelect = class NileSelect extends NileElement {
|
81
|
-
/** Gets the validity state object */
|
82
|
-
get validity() {
|
83
|
-
return this.valueInput?.validity;
|
84
|
-
}
|
85
|
-
/** Gets the validation message */
|
86
|
-
get validationMessage() {
|
87
|
-
return this.valueInput?.validationMessage;
|
88
|
-
}
|
89
78
|
constructor() {
|
90
|
-
super();
|
79
|
+
super(...arguments);
|
80
|
+
// protected override BUBBLES=false;
|
81
|
+
this.formControlController = new FormControlController(this, {
|
82
|
+
assumeInteractionOn: ['nile-blur', 'nile-input'],
|
83
|
+
});
|
91
84
|
this.hasSlotController = new HasSlotController(this, 'help-text', 'label');
|
92
85
|
this.typeToSelectString = '';
|
93
86
|
this.hasFocus = false;
|
@@ -167,17 +160,17 @@ let NileSelect = class NileSelect extends NileElement {
|
|
167
160
|
this.oldMaxOptionsVisible = 1;
|
168
161
|
this.showNoResults = false;
|
169
162
|
this.noResultsMessage = 'No results found';
|
170
|
-
|
171
|
-
|
163
|
+
}
|
164
|
+
/** Gets the validity state object */
|
165
|
+
get validity() {
|
166
|
+
return this.valueInput?.validity;
|
167
|
+
}
|
168
|
+
/** Gets the validation message */
|
169
|
+
get validationMessage() {
|
170
|
+
return this.valueInput?.validationMessage;
|
172
171
|
}
|
173
172
|
connectedCallback() {
|
174
173
|
super.connectedCallback();
|
175
|
-
if (!this.enableVirtualScroll) {
|
176
|
-
this.formControlController = new FormControlController(this, {
|
177
|
-
assumeInteractionOn: ['nile-blur', 'nile-input'],
|
178
|
-
});
|
179
|
-
}
|
180
|
-
this.virtualScrollHelper = new VirtualScrollHelper(this);
|
181
174
|
this.handleDocumentFocusIn = this.handleDocumentFocusIn.bind(this);
|
182
175
|
this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);
|
183
176
|
this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
|
@@ -594,7 +587,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
594
587
|
}
|
595
588
|
// Update validity
|
596
589
|
this.updateComplete.then(() => {
|
597
|
-
this.formControlController
|
590
|
+
this.formControlController.updateValidity();
|
598
591
|
});
|
599
592
|
this.calculateTotalWidthOfTags();
|
600
593
|
}
|
@@ -636,8 +629,8 @@ let NileSelect = class NileSelect extends NileElement {
|
|
636
629
|
return filteredOptions;
|
637
630
|
}
|
638
631
|
handleInvalid(event) {
|
639
|
-
this.formControlController
|
640
|
-
this.formControlController
|
632
|
+
this.formControlController.setValidity(false);
|
633
|
+
this.formControlController.emitInvalidEvent(event);
|
641
634
|
}
|
642
635
|
handleDisabledChange() {
|
643
636
|
// Close the listbox when the control is disabled
|
@@ -719,7 +712,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
719
712
|
}
|
720
713
|
/** Gets the associated form, if one exists. */
|
721
714
|
getForm() {
|
722
|
-
return this.formControlController
|
715
|
+
return this.formControlController.getForm();
|
723
716
|
}
|
724
717
|
/** Checks for validity and shows the browser's validation message if the control is invalid. */
|
725
718
|
reportValidity() {
|
@@ -728,7 +721,7 @@ let NileSelect = class NileSelect extends NileElement {
|
|
728
721
|
/** Sets a custom validation message. Pass an empty string to restore validity. */
|
729
722
|
setCustomValidity(message) {
|
730
723
|
this.valueInput.setCustomValidity(message);
|
731
|
-
this.formControlController
|
724
|
+
this.formControlController.updateValidity();
|
732
725
|
}
|
733
726
|
/** Sets focus on the control. */
|
734
727
|
focus(options) {
|
@@ -787,9 +780,6 @@ let NileSelect = class NileSelect extends NileElement {
|
|
787
780
|
}, 1);
|
788
781
|
}
|
789
782
|
render() {
|
790
|
-
if (this.enableVirtualScroll) {
|
791
|
-
return this.virtualScrollHelper.renderVirtualizedContent();
|
792
|
-
}
|
793
783
|
const hasLabelSlot = this.hasSlotController.test('label');
|
794
784
|
const hasHelpTextSlot = this.hasSlotController.test('help-text');
|
795
785
|
const hasLabelSuffixSlot = this.hasSlotController.test('label-suffix');
|
@@ -1249,15 +1239,6 @@ __decorate([
|
|
1249
1239
|
__decorate([
|
1250
1240
|
property({ type: String })
|
1251
1241
|
], NileSelect.prototype, "noResultsMessage", void 0);
|
1252
|
-
__decorate([
|
1253
|
-
property({ attribute: false })
|
1254
|
-
], NileSelect.prototype, "renderItemConfig", void 0);
|
1255
|
-
__decorate([
|
1256
|
-
property({ type: Array })
|
1257
|
-
], NileSelect.prototype, "data", void 0);
|
1258
|
-
__decorate([
|
1259
|
-
property({ type: Boolean })
|
1260
|
-
], NileSelect.prototype, "enableVirtualScroll", void 0);
|
1261
1242
|
__decorate([
|
1262
1243
|
watch('disabled', { waitUntilFirstUpdate: true })
|
1263
1244
|
], NileSelect.prototype, "handleDisabledChange", null);
|