@aquera/nile-elements 0.0.3-4 → 0.0.3-5

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 (42) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.css.js +11 -1
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.css.js.map +1 -1
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.js +2 -2
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-option/nile-option.js.map +1 -1
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.css.js +19 -6
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.css.js.map +1 -1
  7. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.d.ts +1 -0
  8. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js +34 -15
  9. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-select/nile-select.js.map +1 -1
  10. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  11. package/dist/index.cjs.js +1 -1
  12. package/dist/index.esm.js +1 -1
  13. package/dist/index.iife.js +152 -129
  14. package/dist/nile-option/nile-option.cjs.js +1 -1
  15. package/dist/nile-option/nile-option.cjs.js.map +1 -1
  16. package/dist/nile-option/nile-option.css.cjs.js +1 -1
  17. package/dist/nile-option/nile-option.css.cjs.js.map +1 -1
  18. package/dist/nile-option/nile-option.css.esm.js +11 -1
  19. package/dist/nile-option/nile-option.esm.js +2 -2
  20. package/dist/nile-select/index.cjs.js +1 -1
  21. package/dist/nile-select/index.esm.js +1 -1
  22. package/dist/nile-select/nile-select.cjs.js +1 -1
  23. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  24. package/dist/nile-select/nile-select.css.cjs.js +1 -1
  25. package/dist/nile-select/nile-select.css.cjs.js.map +1 -1
  26. package/dist/nile-select/nile-select.css.esm.js +19 -6
  27. package/dist/nile-select/nile-select.esm.js +15 -14
  28. package/dist/src/nile-option/nile-option.css.js +11 -1
  29. package/dist/src/nile-option/nile-option.css.js.map +1 -1
  30. package/dist/src/nile-option/nile-option.js +2 -2
  31. package/dist/src/nile-option/nile-option.js.map +1 -1
  32. package/dist/src/nile-select/nile-select.css.js +19 -6
  33. package/dist/src/nile-select/nile-select.css.js.map +1 -1
  34. package/dist/src/nile-select/nile-select.d.ts +1 -0
  35. package/dist/src/nile-select/nile-select.js +34 -15
  36. package/dist/src/nile-select/nile-select.js.map +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/package.json +1 -1
  39. package/src/nile-option/nile-option.css.ts +11 -1
  40. package/src/nile-option/nile-option.ts +2 -2
  41. package/src/nile-select/nile-select.css.ts +19 -6
  42. package/src/nile-select/nile-select.ts +38 -15
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.3-4",
6
+ "version": "0.0.3-5",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -29,11 +29,15 @@ export const styles = css`
29
29
  line-height: 1.8;
30
30
  letter-spacing: normal;
31
31
  color: hsl(240 5.3% 26.1%);
32
- padding: 0.5rem 1rem 0.5rem 0.5rem;
32
+ padding: 6px 0;
33
33
  transition: 150ms fill;
34
34
  cursor: pointer;
35
35
  }
36
36
 
37
+ .option--single-select {
38
+ padding: 9px 12px;
39
+ }
40
+
37
41
  .option--hover:not(.option--current):not(.option--disabled) {
38
42
  background-color: rgba(0, 94, 166, 0.1);
39
43
  color: hsl(0, 0%, 0%);
@@ -86,6 +90,12 @@ export const styles = css`
86
90
  margin-inline-start: 0.5rem;
87
91
  }
88
92
 
93
+ .option--checkbox{
94
+ pointer-events: none;
95
+ margin-left: 12px;
96
+ margin-right: 12px;
97
+ }
98
+
89
99
  @media (forced-colors: active) {
90
100
  :host(:hover:not([aria-disabled='true'])) .option {
91
101
  outline: dashed 1px SelectedItem;
@@ -151,7 +151,7 @@ export class NileOption extends NileElement {
151
151
  part="base"
152
152
  class=${classMap({
153
153
  option: true,
154
- // 'option--current': this.current,
154
+ 'option--single-select': !this.isMultipleSelect,
155
155
  'option--current': this.selected && !this.isMultipleSelect,
156
156
  'option--disabled': this.disabled,
157
157
  'option--selected': this.selected && !this.isMultipleSelect,
@@ -161,7 +161,7 @@ export class NileOption extends NileElement {
161
161
  @mouseleave=${this.handleMouseLeave}
162
162
  >
163
163
 
164
- ${this.isMultipleSelect ? html`<nile-checkbox style="pointer-events: none;" .checked=${this.selected}></nile-checkbox>` : ''}
164
+ ${this.isMultipleSelect ? html`<nile-checkbox class="option--checkbox" .checked=${this.selected}></nile-checkbox>` : ''}
165
165
 
166
166
  <slot part="prefix" name="prefix" class="option__prefix"></slot>
167
167
  <slot
@@ -179,11 +179,14 @@ export const styles = css`
179
179
  }
180
180
 
181
181
  .select__tags-count {
182
- position: absolute;
183
- right: 0;
184
- border: 1px solid rgb(169, 218, 218);
185
- border-radius: 0.25rem;
186
- margin-right: 30px;
182
+ color: #005ea6;
183
+ font-family: Colfax-regular;
184
+ font-size: 14px;
185
+ font-style: normal;
186
+ font-weight: 400;
187
+ line-height: 14px;
188
+ letter-spacing: 0.2px;
189
+ margin: 6px;
187
190
  }
188
191
 
189
192
  .select__tags-count-clearable {
@@ -398,10 +401,20 @@ export const styles = css`
398
401
  display: flex;
399
402
  flex-direction: row;
400
403
  align-items: flex-start;
401
- padding: 8px 8px 16px;
404
+ padding: 8px 12px 16px;
402
405
  gap: 12px;
403
406
  justify-content: space-between;
404
407
  }
408
+
409
+ .tag__prefix[slot='prefix'] {
410
+ height: 14px;
411
+ display: inline-block;
412
+ overflow: hidden;
413
+ }
414
+
415
+ .tag__prefix[slot='prefix'] img {
416
+ max-height: 100%;
417
+ }
405
418
  `;
406
419
 
407
420
  export default [styles];
@@ -36,6 +36,7 @@ import type { CSSResultGroup } from 'lit';
36
36
  import type { NileFormControl } from '../internal/nile-element';
37
37
  import type NileOption from '../nile-option/nile-option';
38
38
  import type NilePopup from '../nile-popup/nile-popup';
39
+ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
39
40
 
40
41
  type NileRemoveEvent = CustomEvent<Record<PropertyKey, never>>;
41
42
 
@@ -139,7 +140,7 @@ export class NileSelect extends NileElement implements NileFormControl {
139
140
  @property() size: 'small' | 'medium' | 'large' = 'medium';
140
141
 
141
142
  /** Placeholder text to show as a hint when the select is empty. */
142
- @property() placeholder = '';
143
+ @property() placeholder = 'Select...';
143
144
 
144
145
  /** Placeholder text to show as a hint when the select is empty. */
145
146
  @state() searchValue = '';
@@ -583,6 +584,25 @@ export class NileSelect extends NileElement implements NileFormControl {
583
584
  return [...this.querySelectorAll<NileOption>('nile-option')];
584
585
  }
585
586
 
587
+ private getOptionPrefix(option: NileOption): string {
588
+ const prefixSlot = option.shadowRoot?.querySelector('slot[name="prefix"]') as HTMLSlotElement;
589
+ if (!prefixSlot) return '';
590
+
591
+ const assignedNodes = prefixSlot.assignedNodes();
592
+ const htmlStrings: string[] = [];
593
+
594
+ assignedNodes.forEach(node => {
595
+ if (node instanceof HTMLElement) {
596
+ htmlStrings.push(node.outerHTML);
597
+ } else if (node.nodeType === Node.TEXT_NODE) {
598
+ // Text node
599
+ htmlStrings.push(node.textContent || '');
600
+ }
601
+ });
602
+
603
+ return htmlStrings.join('');
604
+ }
605
+
586
606
  // Gets the first <nile-option> element
587
607
  private getFirstOption() {
588
608
  return this.querySelector<NileOption>('nile-option');
@@ -939,30 +959,33 @@ export class NileSelect extends NileElement implements NileFormControl {
939
959
  <nile-tag
940
960
  part="tag"
941
961
  exportparts="
942
- base:tag__base,
943
- content:tag__content,
944
- remove-button:tag__remove-button,
945
- remove-button__base:tag__remove-button__base
946
- "
962
+ base:tag__base,
963
+ content:tag__content,
964
+ remove-button:tag__remove-button,
965
+ remove-button__base:tag__remove-button__base
966
+ "
947
967
  ?pill=${this.pill}
948
968
  size=${this.size}
949
969
  removable
950
970
  @nile-remove=${(event: NileRemoveEvent) =>
951
971
  this.handleTagRemove(event, option)}
952
972
  >
973
+ ${this.getOptionPrefix(option)
974
+ ? html`<span class="tag__prefix" slot="prefix"
975
+ >${unsafeHTML(
976
+ this.getOptionPrefix(option)
977
+ )}</span
978
+ >`
979
+ : ''}
953
980
  ${option.getTextLabel()}
954
981
  </nile-tag>
955
982
  `;
956
983
  } else if (index === this.maxOptionsVisible) {
957
984
  return html`
958
- <nile-tag
959
- class="select__tags-count ${hasClearIcon
960
- ? `select__tags-count-clearable`
961
- : ``} "
962
- size=${this.size}
963
- >
964
- +${this.selectedOptions.length - index}
965
- </nile-tag>
985
+
986
+
987
+ <span class="select__tags-count">+${this.selectedOptions.length - index} More </span>
988
+
966
989
  `;
967
990
  } else {
968
991
  return null;
@@ -1066,7 +1089,7 @@ export class NileSelect extends NileElement implements NileFormControl {
1066
1089
  ?disabled="${this.selectedOptions.length === 0}"
1067
1090
  ?checked="${this.showSelected}"
1068
1091
  >
1069
- Show Selected</nile-checkbox
1092
+ &nbsp; Show Selected</nile-checkbox
1070
1093
  >
1071
1094
  </span>
1072
1095
  <span class="select__clear" @click="${this.unSlectAll}"