@aquera/nile-elements 0.0.1-beta.6 → 0.0.1-beta.8

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 (41) hide show
  1. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.d.ts +0 -1
  2. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.js +0 -4
  3. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
  4. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.d.ts +6 -0
  5. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.js +23 -1
  6. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-chip/nile-chip.js.map +1 -1
  7. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-select/nile-select.css.js +15 -9
  8. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-select/nile-select.css.js.map +1 -1
  9. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-select/nile-select.d.ts +3 -1
  10. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-select/nile-select.js +49 -22
  11. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/src/nile-select/nile-select.js.map +1 -1
  12. package/.rollup.cache/Users/ravisankar/aquera/nile/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  13. package/dist/nile-auto-complete/nile-auto-complete.cjs.js +1 -1
  14. package/dist/nile-auto-complete/nile-auto-complete.cjs.js.map +1 -1
  15. package/dist/nile-auto-complete/nile-auto-complete.esm.js +2 -3
  16. package/dist/nile-chip/nile-chip.cjs.js +1 -1
  17. package/dist/nile-chip/nile-chip.cjs.js.map +1 -1
  18. package/dist/nile-chip/nile-chip.esm.js +8 -6
  19. package/dist/nile-select/nile-select.cjs.js +1 -1
  20. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  21. package/dist/nile-select/nile-select.css.cjs.js +1 -1
  22. package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
  23. package/dist/nile-select/nile-select.css.esm.js +15 -9
  24. package/dist/nile-select/nile-select.esm.js +13 -8
  25. package/dist/src/nile-auto-complete/nile-auto-complete.d.ts +0 -1
  26. package/dist/src/nile-auto-complete/nile-auto-complete.js +0 -4
  27. package/dist/src/nile-auto-complete/nile-auto-complete.js.map +1 -1
  28. package/dist/src/nile-chip/nile-chip.d.ts +6 -0
  29. package/dist/src/nile-chip/nile-chip.js +23 -1
  30. package/dist/src/nile-chip/nile-chip.js.map +1 -1
  31. package/dist/src/nile-select/nile-select.css.js +15 -9
  32. package/dist/src/nile-select/nile-select.css.js.map +1 -1
  33. package/dist/src/nile-select/nile-select.d.ts +3 -1
  34. package/dist/src/nile-select/nile-select.js +49 -22
  35. package/dist/src/nile-select/nile-select.js.map +1 -1
  36. package/dist/tsconfig.tsbuildinfo +1 -1
  37. package/package.json +1 -1
  38. package/src/nile-auto-complete/nile-auto-complete.ts +0 -5
  39. package/src/nile-chip/nile-chip.ts +18 -1
  40. package/src/nile-select/nile-select.css.ts +15 -9
  41. package/src/nile-select/nile-select.ts +48 -25
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "0.0.1-beta.6",
6
+ "version": "0.0.1-beta.8",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -90,10 +90,6 @@ export class NileAutoComplete extends NileElement {
90
90
  this.dropdownElement?.show();
91
91
  }
92
92
 
93
- private handleBlur() {
94
- this.menuItems = this.allMenuItems;
95
- }
96
-
97
93
  public render(): TemplateResult {
98
94
  return html`
99
95
  <nile-dropdown class="nile-dropdown--input" ?open=${this.isDropdownOpen} noOpenOnCLick>
@@ -102,7 +98,6 @@ export class NileAutoComplete extends NileElement {
102
98
  .value=${this.value}
103
99
  @nile-input=${this.handleSearch}
104
100
  @focus=${this.handleFocus}
105
- @blur=${this.handleBlur}
106
101
  @click=${this.handleClick}
107
102
  slot="trigger"
108
103
  placeholder=${this.placeholder}
@@ -41,6 +41,15 @@ export class NileChip extends NileElement {
41
41
 
42
42
  @query('nile-auto-complete') autoComplete!: any;
43
43
 
44
+ /** Sets the input to a warning state, changing its visual appearance. */
45
+ @property({ type: Boolean }) warning = false;
46
+
47
+ /** Sets the input to an error state, changing its visual appearance. */
48
+ @property({ type: Boolean }) error = false;
49
+
50
+ /** Sets the input to a success state, changing its visual appearance. */
51
+ @property({ type: Boolean }) success = false;
52
+
44
53
  /** The input's label. If you need to display HTML, use the `label` slot instead. */
45
54
  @property() label = '';
46
55
 
@@ -152,7 +161,15 @@ export class NileChip extends NileElement {
152
161
  <slot name="label">${this.label}</slot>
153
162
  </label>
154
163
 
155
- <div class="nile-chip">
164
+ <div
165
+ class=${classMap({
166
+ 'nile-chip': true,
167
+ 'nile-chip--warning': this.warning,
168
+ 'nile-chip--error': this.error,
169
+ 'nile-chip--success': this.success,
170
+
171
+ })}
172
+ >
156
173
  ${this.tags.map(tag => html`
157
174
  <nile-tag class="nile-chip__tags" @nile-remove=${() => this.handleRemove(tag)} removable pill>
158
175
  ${tag}
@@ -96,7 +96,7 @@ export const styles = css`
96
96
  }
97
97
 
98
98
  .select::part(popup) {
99
- z-index: 900;
99
+ z-index: 9999;
100
100
  }
101
101
 
102
102
  .select[data-current-placement^='top']::part(popup) {
@@ -355,7 +355,7 @@ export const styles = css`
355
355
  align-items: center;
356
356
  justify-content: center;
357
357
  font-size: inherit;
358
- color: #aaaaaa;
358
+ color: #005EA6;
359
359
  border: none;
360
360
  background: none;
361
361
  padding: 0;
@@ -395,7 +395,7 @@ export const styles = css`
395
395
  background: #ffffff;
396
396
  border: solid 1px #cccccc;
397
397
  border-radius: 0.25rem;
398
- padding-block: 0.25rem 0;
398
+ padding-block: 0;
399
399
  padding-inline: 0;
400
400
  overflow: auto;
401
401
  overscroll-behavior: none;
@@ -404,10 +404,15 @@ export const styles = css`
404
404
  max-height: var(--auto-size-available-height);
405
405
  }
406
406
 
407
- /* Listbox */
408
- .select__search-enabled {
409
- padding-top: 50px;
407
+ .select__options{
408
+ padding-top: 10px;
409
+ }
410
410
 
411
+ .select__options{
412
+ padding: 5px;
413
+ margin: 4px;
414
+ font-size: 14px;
415
+ color: rgb(133, 129, 129);
411
416
  }
412
417
 
413
418
  .select__listbox::slotted(nile-divider) {
@@ -423,11 +428,12 @@ export const styles = css`
423
428
  }
424
429
 
425
430
  .select__search {
426
- position: absolute;
431
+ position: sticky;
427
432
  top: 0px;
428
- height: 15px;
433
+ z-index: 1;
429
434
  width: calc(100% - 16px);
430
435
  padding: 8px;
436
+ background-color: white;
431
437
  }
432
438
 
433
439
  .select__footer {
@@ -441,7 +447,7 @@ export const styles = css`
441
447
  display: flex;
442
448
  flex-direction: row;
443
449
  align-items: flex-start;
444
- padding: 12px;
450
+ padding: 8px;
445
451
  gap: 12px;
446
452
  justify-content: space-between;
447
453
  }
@@ -205,6 +205,10 @@ export class NileSelect extends NileElement implements NileFormControl {
205
205
 
206
206
  @property({ type: Boolean }) showSelected = false;
207
207
 
208
+ @state() showNoResults: boolean;
209
+
210
+ @property({ type: String }) noResultsMessage: string = "No results found";
211
+
208
212
  /** Gets the validity state object */
209
213
  get validity() {
210
214
  return this.valueInput.validity;
@@ -240,12 +244,12 @@ export class NileSelect extends NileElement implements NileFormControl {
240
244
  private handleFocus() {
241
245
  this.hasFocus = true;
242
246
  this.displayInput.setSelectionRange(0, 0);
243
- this.emit('nile-focus');
247
+ this.emit('nile-focus', { value: this.value , name: this.name });
244
248
  }
245
249
 
246
250
  private handleBlur() {
247
251
  this.hasFocus = false;
248
- this.emit('nile-blur');
252
+ this.emit('nile-blur', { value: this.value , name: this.name });
249
253
  }
250
254
 
251
255
  private handleDocumentFocusIn(event: FocusEvent) {
@@ -302,6 +306,7 @@ export class NileSelect extends NileElement implements NileFormControl {
302
306
  });
303
307
  this.value = '';
304
308
  this.selectionChanged();
309
+ this.emit('nile-change', { value: this.value , name: this.name });
305
310
  }
306
311
 
307
312
  private handleDocumentKeyDown(event: KeyboardEvent) {
@@ -347,8 +352,8 @@ export class NileSelect extends NileElement implements NileFormControl {
347
352
 
348
353
  // Emit after updating
349
354
  this.updateComplete.then(() => {
350
- this.emit('nile-input');
351
- this.emit('nile-change');
355
+ this.emit('nile-input', { value: this.value , name: this.name });
356
+ this.emit('nile-change', { value: this.value , name: this.name });
352
357
  });
353
358
 
354
359
  if (!this.multiple) {
@@ -482,9 +487,9 @@ export class NileSelect extends NileElement implements NileFormControl {
482
487
 
483
488
  // Emit after update
484
489
  this.updateComplete.then(() => {
485
- this.emit('nile-clear');
486
- this.emit('nile-input');
487
- this.emit('nile-change');
490
+ this.emit('nile-clear', { value: this.value , name: this.name });
491
+ this.emit('nile-input', { value: this.value , name: this.name });
492
+ this.emit('nile-change', { value: this.value , name: this.name });
488
493
  });
489
494
  }
490
495
  }
@@ -515,8 +520,8 @@ export class NileSelect extends NileElement implements NileFormControl {
515
520
  if (this.value !== oldValue) {
516
521
  // Emit after updating
517
522
  this.updateComplete.then(() => {
518
- this.emit('nile-input');
519
- this.emit('nile-change');
523
+ this.emit('nile-input', { value: this.value , name: this.name });
524
+ this.emit('nile-change', { value: this.value , name: this.name });
520
525
  });
521
526
  }
522
527
 
@@ -556,8 +561,8 @@ export class NileSelect extends NileElement implements NileFormControl {
556
561
 
557
562
  // Emit after updating
558
563
  this.updateComplete.then(() => {
559
- this.emit('nile-input');
560
- this.emit('nile-change');
564
+ this.emit('nile-input', { value: this.value , name: this.name });
565
+ this.emit('nile-change', { value: this.value , name: this.name });
561
566
  });
562
567
  }
563
568
  }
@@ -645,6 +650,7 @@ export class NileSelect extends NileElement implements NileFormControl {
645
650
  this.updateComplete.then(() => {
646
651
  this.formControlController.updateValidity();
647
652
  });
653
+
648
654
  }
649
655
 
650
656
  handleSearchFocus() {
@@ -657,22 +663,33 @@ export class NileSelect extends NileElement implements NileFormControl {
657
663
 
658
664
  handleSearchChange(e: any) {
659
665
  this.searchValue = e.detail.value;
660
- this.filterOptions(this.searchValue);
661
- }
666
+ let filteredOptions = this.filterOptions(this.searchValue);
667
+
668
+ if (filteredOptions.length === 0) {
669
+ // Display 'No results found' message.
670
+ this.showNoResults = true;
671
+ } else {
672
+ this.showNoResults = false;
673
+ } }
662
674
 
663
675
  filterOptions(searchValue: string) {
664
676
  const allOptions = this.getAllOptions();
665
677
  const lowerCaseSearchValue = searchValue.toLowerCase();
666
678
 
679
+ let filteredOptions: NileOption[] = [];
680
+
667
681
  allOptions.forEach(el => {
668
- // Hide the option if its text and value do not include the search value.
669
682
  const lowerCaseLabel = el.getTextLabel().toLowerCase();
670
683
  const lowerCaseValue = (el.value || '').toLowerCase();
671
- el.hidden = !(
672
- lowerCaseLabel.includes(lowerCaseSearchValue) ||
673
- lowerCaseValue.includes(lowerCaseSearchValue)
674
- );
684
+ if (lowerCaseLabel.startsWith(lowerCaseSearchValue) || lowerCaseValue.startsWith(lowerCaseSearchValue)) {
685
+ el.hidden = false;
686
+ filteredOptions.push(el);
687
+ } else {
688
+ el.hidden = true;
689
+ }
675
690
  });
691
+
692
+ return filteredOptions;
676
693
  }
677
694
 
678
695
  private handleInvalid(event: Event) {
@@ -705,7 +722,7 @@ export class NileSelect extends NileElement implements NileFormControl {
705
722
  this.setCurrentOption(this.selectedOptions[0] || this.getFirstOption());
706
723
 
707
724
  // Show
708
- this.emit('nile-show');
725
+ this.emit('nile-show', { value: this.value , name: this.name });
709
726
  this.addOpenListeners();
710
727
 
711
728
  await stopAnimations(this);
@@ -727,10 +744,10 @@ export class NileSelect extends NileElement implements NileFormControl {
727
744
  scrollIntoView(this.currentOption, this.listbox, 'vertical', 'auto');
728
745
  }
729
746
 
730
- this.emit('nile-after-show');
747
+ this.emit('nile-after-show', { value: this.value , name: this.name });
731
748
  } else {
732
749
  // Hide
733
- this.emit('nile-hide');
750
+ this.emit('nile-hide', { value: this.value , name: this.name });
734
751
  this.removeOpenListeners();
735
752
 
736
753
  await stopAnimations(this);
@@ -741,7 +758,7 @@ export class NileSelect extends NileElement implements NileFormControl {
741
758
  this.listbox.hidden = true;
742
759
  this.popup.active = false;
743
760
 
744
- this.emit('nile-after-hide');
761
+ this.emit('nile-after-hide', { value: this.value , name: this.name });
745
762
  }
746
763
  }
747
764
 
@@ -988,9 +1005,7 @@ export class NileSelect extends NileElement implements NileFormControl {
988
1005
  @mouseup=${this.handleOptionClick}
989
1006
  @slotchange=${this.handleDefaultSlotChange}
990
1007
  >
991
- <slot></slot>
992
-
993
- ${this.searchEnabled
1008
+ ${this.searchEnabled
994
1009
  ? html` <div class="select__search">
995
1010
  <nile-input
996
1011
  size="small"
@@ -1005,6 +1020,14 @@ export class NileSelect extends NileElement implements NileFormControl {
1005
1020
  </nile-input>
1006
1021
  </div>`
1007
1022
  : ``}
1023
+ <div class="select__options">
1024
+ ${this.showNoResults
1025
+ ? html` <div class="select__no-results">${this.noResultsMessage} </div>
1026
+ `: ''}
1027
+ <slot></slot>
1028
+ </div>
1029
+
1030
+
1008
1031
  ${this.multiple
1009
1032
  ? html` <div
1010
1033
  class="select__footer"