@aquera/nile-elements 0.1.35-beta-1.0 → 0.1.35-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.
Files changed (209) hide show
  1. package/README.md +10 -21
  2. package/demo/index.css +4 -7
  3. package/demo/index.html +39 -20
  4. package/demo/variables.css +13 -0
  5. package/demo/variables_v2.css +13 -0
  6. package/dist/{fixture-df8b52d7.esm.js → fixture-2b5b3aba.esm.js} +1 -1
  7. package/dist/{fixture-d5b55278.cjs.js → fixture-7bfb866e.cjs.js} +3 -3
  8. package/dist/fixture-7bfb866e.cjs.js.map +1 -0
  9. package/dist/index.cjs.js +1 -1
  10. package/dist/index.esm.js +1 -1
  11. package/dist/internal/animate.cjs.js +1 -1
  12. package/dist/internal/animate.cjs.js.map +1 -1
  13. package/dist/internal/animate.esm.js +1 -1
  14. package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
  15. package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
  16. package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
  17. package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
  18. package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
  19. package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
  20. package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
  21. package/dist/nile-badge/nile-badge.test.esm.js +1 -1
  22. package/dist/nile-button/nile-button.test.cjs.js +1 -1
  23. package/dist/nile-button/nile-button.test.esm.js +1 -1
  24. package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
  25. package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
  26. package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
  27. package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
  28. package/dist/nile-card/nile-card.test.cjs.js +1 -1
  29. package/dist/nile-card/nile-card.test.esm.js +1 -1
  30. package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
  31. package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
  32. package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
  33. package/dist/nile-chip/nile-chip.test.esm.js +1 -1
  34. package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
  35. package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
  36. package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
  37. package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
  38. package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
  39. package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
  40. package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
  41. package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
  42. package/dist/nile-error-message/nile-error-message.cjs.js +1 -1
  43. package/dist/nile-error-message/nile-error-message.cjs.js.map +1 -1
  44. package/dist/nile-error-message/nile-error-message.css.cjs.js +1 -1
  45. package/dist/nile-error-message/nile-error-message.css.cjs.js.map +1 -1
  46. package/dist/nile-error-message/nile-error-message.css.esm.js +4 -6
  47. package/dist/nile-error-message/nile-error-message.esm.js +4 -4
  48. package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
  49. package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
  50. package/dist/nile-error-notification/nile-error-notification.css.cjs.js +1 -1
  51. package/dist/nile-error-notification/nile-error-notification.css.cjs.js.map +1 -1
  52. package/dist/nile-error-notification/nile-error-notification.css.esm.js +1 -1
  53. package/dist/nile-filter-chip/index.cjs.js +2 -0
  54. package/dist/nile-filter-chip/index.cjs.js.map +1 -0
  55. package/dist/nile-filter-chip/index.esm.js +1 -0
  56. package/dist/nile-filter-chip/nile-filter-chip.cjs.js +2 -0
  57. package/dist/nile-filter-chip/nile-filter-chip.cjs.js.map +1 -0
  58. package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js +2 -0
  59. package/dist/nile-filter-chip/nile-filter-chip.css.cjs.js.map +1 -0
  60. package/dist/nile-filter-chip/nile-filter-chip.css.esm.js +98 -0
  61. package/dist/nile-filter-chip/nile-filter-chip.esm.js +34 -0
  62. package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js +2 -0
  63. package/dist/nile-filter-chip/nile-filter-chip.test.cjs.js.map +1 -0
  64. package/dist/nile-filter-chip/nile-filter-chip.test.esm.js +20 -0
  65. package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
  66. package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
  67. package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
  68. package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
  69. package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
  70. package/dist/nile-hero/nile-hero.test.esm.js +1 -1
  71. package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
  72. package/dist/nile-icon/nile-icon.test.esm.js +1 -1
  73. package/dist/nile-input/nile-input.test.cjs.js +1 -1
  74. package/dist/nile-input/nile-input.test.esm.js +1 -1
  75. package/dist/nile-link/nile-link.test.cjs.js +1 -1
  76. package/dist/nile-link/nile-link.test.esm.js +1 -1
  77. package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
  78. package/dist/nile-loader/nile-loader.test.esm.js +1 -1
  79. package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
  80. package/dist/nile-popover/nile-popover.test.esm.js +1 -1
  81. package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
  82. package/dist/nile-popup/nile-popup.test.esm.js +1 -1
  83. package/dist/nile-progress-bar/nile-progress-bar.css.cjs.js +1 -1
  84. package/dist/nile-progress-bar/nile-progress-bar.css.cjs.js.map +1 -1
  85. package/dist/nile-progress-bar/nile-progress-bar.css.esm.js +0 -1
  86. package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
  87. package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
  88. package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
  89. package/dist/nile-radio/nile-radio.test.esm.js +1 -1
  90. package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
  91. package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
  92. package/dist/nile-select/nile-select.test.cjs.js +1 -1
  93. package/dist/nile-select/nile-select.test.esm.js +1 -1
  94. package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
  95. package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
  96. package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
  97. package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
  98. package/dist/nile-table/nile-table.cjs.js.map +1 -1
  99. package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
  100. package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
  101. package/dist/nile-tooltip/index.cjs.js +1 -1
  102. package/dist/nile-tooltip/index.esm.js +1 -1
  103. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  104. package/dist/nile-tooltip/nile-tooltip.cjs.js.map +1 -1
  105. package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
  106. package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
  107. package/dist/nile-tooltip/nile-tooltip.css.esm.js +45 -78
  108. package/dist/nile-tooltip/nile-tooltip.esm.js +28 -23
  109. package/dist/src/index.d.ts +1 -0
  110. package/dist/src/index.js +1 -0
  111. package/dist/src/index.js.map +1 -1
  112. package/dist/src/nile-badge/__snapshots__/nile-badge.test.snap.js +17 -0
  113. package/dist/src/nile-bob/index.d.ts +1 -0
  114. package/dist/src/nile-bob/index.js +2 -0
  115. package/dist/src/nile-bob/index.js.map +1 -0
  116. package/dist/src/nile-bob/nile-bob.css.d.ts +12 -0
  117. package/dist/src/nile-bob/nile-bob.css.js +17 -0
  118. package/dist/src/nile-bob/nile-bob.css.js.map +1 -0
  119. package/dist/src/nile-bob/nile-bob.d.ts +32 -0
  120. package/dist/src/nile-bob/nile-bob.js +43 -0
  121. package/dist/src/nile-bob/nile-bob.js.map +1 -0
  122. package/dist/src/nile-calendar/__snapshots__/nile-calendar.test.snap.js +275 -0
  123. package/dist/src/nile-card/__snapshots__/nile-card.test.snap.js +34 -0
  124. package/dist/src/nile-checkbox/__snapshots__/nile-checkbox.test.snap.js +31 -0
  125. package/dist/src/nile-error-message/nile-error-message.css.js +4 -6
  126. package/dist/src/nile-error-message/nile-error-message.css.js.map +1 -1
  127. package/dist/src/nile-error-message/nile-error-message.d.ts +0 -4
  128. package/dist/src/nile-error-message/nile-error-message.js +0 -20
  129. package/dist/src/nile-error-message/nile-error-message.js.map +1 -1
  130. package/dist/src/nile-error-notification/nile-error-notification.css.js +1 -1
  131. package/dist/src/nile-error-notification/nile-error-notification.css.js.map +1 -1
  132. package/dist/src/nile-fileupload/index.d.ts +1 -0
  133. package/dist/src/nile-fileupload/index.js +2 -0
  134. package/dist/src/nile-fileupload/index.js.map +1 -0
  135. package/dist/src/nile-fileupload/nile-fileupload.css.d.ts +12 -0
  136. package/dist/src/nile-fileupload/nile-fileupload.css.js +17 -0
  137. package/dist/src/nile-fileupload/nile-fileupload.css.js.map +1 -0
  138. package/dist/src/nile-fileupload/nile-fileupload.d.ts +32 -0
  139. package/dist/src/nile-fileupload/nile-fileupload.js +43 -0
  140. package/dist/src/nile-fileupload/nile-fileupload.js.map +1 -0
  141. package/dist/src/nile-filter-chip/index.d.ts +1 -0
  142. package/dist/src/nile-filter-chip/index.js +2 -0
  143. package/dist/src/nile-filter-chip/index.js.map +1 -0
  144. package/dist/src/nile-filter-chip/nile-filter-chip.css.d.ts +12 -0
  145. package/dist/src/nile-filter-chip/nile-filter-chip.css.js +110 -0
  146. package/dist/src/nile-filter-chip/nile-filter-chip.css.js.map +1 -0
  147. package/dist/src/nile-filter-chip/nile-filter-chip.d.ts +35 -0
  148. package/dist/src/nile-filter-chip/nile-filter-chip.js +128 -0
  149. package/dist/src/nile-filter-chip/nile-filter-chip.js.map +1 -0
  150. package/dist/src/nile-filter-chip/nile-filter-chip.test.d.ts +1 -0
  151. package/dist/src/nile-filter-chip/nile-filter-chip.test.js +80 -0
  152. package/dist/src/nile-filter-chip/nile-filter-chip.test.js.map +1 -0
  153. package/dist/src/nile-hero/__snapshots__/nile-hero.test.snap.js +47 -0
  154. package/dist/src/nile-icon/__snapshots__/nile-icon.test.snap.js +16 -0
  155. package/dist/src/nile-icon/icons/svg/new-calendar.d.ts +5 -0
  156. package/dist/src/nile-icon/icons/svg/new-calendar.js +5 -0
  157. package/dist/src/nile-icon/icons/svg/new-calendar.js.map +1 -0
  158. package/dist/src/nile-input/__snapshots__/nile-input.test.snap.js +75 -0
  159. package/dist/src/nile-popover/__snapshots__/nile-popover.test.snap.js +22 -0
  160. package/dist/src/nile-progress-bar/nile-progress-bar.css.js +0 -1
  161. package/dist/src/nile-progress-bar/nile-progress-bar.css.js.map +1 -1
  162. package/dist/src/nile-revan/index.d.ts +1 -0
  163. package/dist/src/nile-revan/index.js +2 -0
  164. package/dist/src/nile-revan/index.js.map +1 -0
  165. package/dist/src/nile-revan/nile-revan.css.d.ts +12 -0
  166. package/dist/src/nile-revan/nile-revan.css.js +17 -0
  167. package/dist/src/nile-revan/nile-revan.css.js.map +1 -0
  168. package/dist/src/nile-revan/nile-revan.d.ts +32 -0
  169. package/dist/src/nile-revan/nile-revan.js +43 -0
  170. package/dist/src/nile-revan/nile-revan.js.map +1 -0
  171. package/dist/src/nile-table/nile-table.js.map +1 -1
  172. package/dist/src/nile-test/index.d.ts +1 -0
  173. package/dist/src/nile-test/index.js +2 -0
  174. package/dist/src/nile-test/index.js.map +1 -0
  175. package/dist/src/nile-test/nile-test.css.d.ts +12 -0
  176. package/dist/src/nile-test/nile-test.css.js +17 -0
  177. package/dist/src/nile-test/nile-test.css.js.map +1 -0
  178. package/dist/src/nile-test/nile-test.d.ts +34 -0
  179. package/dist/src/nile-test/nile-test.js +179 -0
  180. package/dist/src/nile-test/nile-test.js.map +1 -0
  181. package/dist/src/nile-tooltip/nile-tooltip.css.js +43 -76
  182. package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
  183. package/dist/src/nile-tooltip/nile-tooltip.d.ts +46 -24
  184. package/dist/src/nile-tooltip/nile-tooltip.js +232 -235
  185. package/dist/src/nile-tooltip/nile-tooltip.js.map +1 -1
  186. package/dist/tsconfig.tsbuildinfo +1 -1
  187. package/package.json +4 -3
  188. package/src/index.ts +2 -1
  189. package/src/nile-error-message/nile-error-message.css.ts +4 -6
  190. package/src/nile-error-message/nile-error-message.ts +0 -18
  191. package/src/nile-error-notification/nile-error-notification.css.ts +1 -1
  192. package/src/nile-filter-chip/index.ts +1 -0
  193. package/src/nile-filter-chip/nile-filter-chip.css.ts +115 -0
  194. package/src/nile-filter-chip/nile-filter-chip.test.ts +92 -0
  195. package/src/nile-filter-chip/nile-filter-chip.ts +125 -0
  196. package/src/nile-progress-bar/nile-progress-bar.css.ts +0 -1
  197. package/src/nile-table/nile-table.ts +2 -2
  198. package/src/nile-tooltip/nile-tooltip.css.ts +44 -77
  199. package/src/nile-tooltip/nile-tooltip.ts +230 -268
  200. package/vscode-html-custom-data.json +136 -92
  201. package/dist/fixture-d5b55278.cjs.js.map +0 -1
  202. package/dist/nile-tooltip/nile-tooltip-utils.cjs.js +0 -2
  203. package/dist/nile-tooltip/nile-tooltip-utils.cjs.js.map +0 -1
  204. package/dist/nile-tooltip/nile-tooltip-utils.esm.js +0 -1
  205. package/dist/nile-tooltip/nile-tooltip.test.cjs.js +0 -2
  206. package/dist/nile-tooltip/nile-tooltip.test.cjs.js.map +0 -1
  207. package/dist/nile-tooltip/nile-tooltip.test.esm.js +0 -47
  208. package/src/nile-tooltip/nile-tooltip-utils.ts +0 -271
  209. package/src/nile-tooltip/nile-tooltip.test.ts +0 -168
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.1.35-beta-1.0",
6
+ "version": "0.1.35-beta-1.3",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -85,7 +85,8 @@
85
85
  "./nile-toolbar": "./dist/src/nile-toolbar/index.js",
86
86
  "./nile-inline-edit": "./dist/src/nile-inline-edit/index.js",
87
87
  "./nile-tour": "./dist/src/nile-tour/index.js",
88
- "./nile-table": "./dist/src/nile-table/index.js"
88
+ "./nile-table": "./dist/src/nile-table/index.js",
89
+ "./nile-filter-chip": "./dist/src/nile-filter-chip/index.js"
89
90
  },
90
91
  "scripts": {
91
92
  "analyze": "cem analyze --litelement",
@@ -189,4 +190,4 @@
189
190
  "prettier --write"
190
191
  ]
191
192
  }
192
- }
193
+ }
package/src/index.ts CHANGED
@@ -75,4 +75,5 @@ export { NileTitle } from './nile-title';
75
75
  export { NileSectionMessage } from './nile-section-message';
76
76
  export { NileToolbar } from './nile-toolbar';
77
77
  export { NileInlineEdit } from './nile-inline-edit';
78
- export { NileTable } from './nile-table';
78
+ export { NileTable } from './nile-table';
79
+ export { NileFilterChip } from './nile-filter-chip';
@@ -16,11 +16,11 @@ export const styles = css`
16
16
 
17
17
  .nile-error-message {
18
18
  width: 100%;
19
+ word-break: break-all;
19
20
  font-size: var(--nile-font-size-small);
20
21
  letter-spacing: 0.2px;
21
22
  font-weight: var(--nile-font-weight-regular);
22
23
  line-height: var(--nile-font-size-small);
23
- max-width: var(--nile-error-max-width, 535px);
24
24
  }
25
25
 
26
26
  .nile-error-message__error {
@@ -32,8 +32,6 @@ export const styles = css`
32
32
  color: var(--nile-colors-dark-500);
33
33
  margin-top:6px;
34
34
  line-height: 16px;
35
- max-height: var(--nile-error-max-height, 48px);
36
- overflow-x: auto;
37
35
  }
38
36
 
39
37
  .nile-error-message__icon {
@@ -56,7 +54,7 @@ export const styles = css`
56
54
  border: 1px solid var(--nile-colors-red-500);
57
55
  border-left: 6px solid var(--nile-colors-red-500);
58
56
  border-radius: 4px;
59
- margin-top: 8px;
57
+ margin-top: 12px;
60
58
  padding: 12px;
61
59
  background: var(--nile-colors-neutral-100);
62
60
  }
@@ -83,10 +81,10 @@ export const styles = css`
83
81
  }
84
82
 
85
83
  .nile-error-message__response-expanded.expanded {
86
- max-height: var(--nile-error-max-dialog-height, 48px);
84
+ max-height: 100px;
87
85
  transition: max-height 0.3s ease-in-out;
88
86
  visibility: visible;
89
- padding: 8px;
87
+ padding: 12px;
90
88
  }
91
89
  `;
92
90
 
@@ -32,12 +32,6 @@ export class NileErrorMessage extends LitElement {
32
32
  @property({ type: Boolean })
33
33
  isExpanded: boolean = false;
34
34
 
35
- @property({ type: String }) maxWidth: string;
36
-
37
- @property({ type: String }) maxHeight: string;
38
-
39
- @property({ type: String }) maxDialogHeight: string;
40
-
41
35
  // The maximum length before truncation.
42
36
  private readonly MAX_LENGTH: number = 100;
43
37
 
@@ -52,18 +46,6 @@ export class NileErrorMessage extends LitElement {
52
46
  return this.errorResponse;
53
47
  }
54
48
 
55
- updated(changedProperties: Map<string, any>) {
56
- if (changedProperties.has('maxWidth')) {
57
- this.style.setProperty('--nile-error-max-width', this.maxWidth);
58
- }
59
- if (changedProperties.has('maxHeight')) {
60
- this.style.setProperty('--nile-error-max-height', this.maxHeight);
61
- }
62
- if (changedProperties.has('maxDialogHeight')) {
63
- this.style.setProperty('--nile-error-max-dialog-height', this.maxDialogHeight);
64
- }
65
- }
66
-
67
49
  /**
68
50
  * Toggle the expanded state of the error response.
69
51
  */
@@ -12,7 +12,7 @@ import { css } from 'lit';
12
12
  */
13
13
  export const styles = css`
14
14
  :host {
15
- --indication-color: var(--nile-colors-red-700);
15
+ --indication-color: var(--nile-colors-red-500);
16
16
  }
17
17
 
18
18
  .nile-error-notification {
@@ -0,0 +1 @@
1
+ export { NileFilterChip } from './nile-filter-chip';
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {css} from 'lit';
9
+
10
+ /**
11
+ * FilterChip CSS
12
+ */
13
+
14
+ export const styles = css`
15
+
16
+
17
+ .filter-chips {
18
+ display: flex;
19
+ align-items: center;
20
+ }
21
+
22
+
23
+ .chip {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ padding: 4px 8px;
27
+ border: 1px solid var(--nile-filter-chip-chip-border-color-stroke);
28
+ border-radius: 4px;
29
+ font-size: 14px;
30
+ background-color: var(--nile-filter-chip-background-default);
31
+ color: var(--nile-filter-chip-text-default);
32
+ transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
33
+ cursor: pointer;
34
+ gap: 6px;
35
+ /* margin-right: 6px; */
36
+ }
37
+
38
+ .chip:hover {
39
+ background-color: var(--nile-filter-chip-hover-background);
40
+ }
41
+
42
+ .chip:active {
43
+ background-color: var(--nile-filter-chip-active-background);
44
+ border-color: var(--nile-filter-chip-active-border-color-stroke);
45
+ }
46
+
47
+ .icon {
48
+ color: var(--nile-filter-chip-icon-color-default);
49
+ display: flex;
50
+ align-items: center;
51
+ justify-content: center;
52
+ vertical-align: middle;
53
+ position: relative;
54
+ top: 12px;
55
+ }
56
+
57
+ .label {
58
+ font-weight: 500;
59
+ color: var(--nile-filter-chip-label-color-default);
60
+ }
61
+
62
+ nile-badge::part(base) {
63
+ width: auto;
64
+ height: 14px;
65
+ border-radius: 100px;
66
+ padding: 6px;
67
+ gap: 10px;
68
+ font-size: 8px;
69
+ display: inline-flex;
70
+ align-items: center;
71
+ justify-content: center;
72
+ line-height: 1;
73
+ }
74
+
75
+ .chip-container {
76
+ display: flex;
77
+ justify-content: space-between;
78
+ align-items: center;
79
+ width: 100%;
80
+ }
81
+
82
+ .clear-all-container {
83
+ margin-left: 18px;
84
+ white-space: nowrap;
85
+ cursor: pointer;
86
+ }
87
+
88
+
89
+ .value {
90
+ color: var(--nile-filter-chip-values-color-default);
91
+ overflow: hidden;
92
+ text-overflow: ellipsis;
93
+ white-space: nowrap;
94
+ max-width: 140px;
95
+ }
96
+
97
+ .close-icon {
98
+ color: var(--nile-filter-chip-close-icon-color-default);
99
+ cursor: pointer;
100
+ display: flex;
101
+ align-items: center;
102
+ padding: 2px;
103
+ border-radius: 50%;
104
+ transition: background-color 0.2s;
105
+ }
106
+
107
+ .close-icon:hover {
108
+ background-color: var(--nile-filter-chip-close-icon-hover-background);
109
+ color: var(--nile-filter-chip-close-icon-hover-color);
110
+ }
111
+ `;
112
+
113
+ export default [styles];
114
+
115
+
@@ -0,0 +1,92 @@
1
+ import { fixture, expect, html, oneEvent } from '@open-wc/testing';
2
+ import './nile-filter-chip';
3
+ import { NileFilterChip } from './nile-filter-chip';
4
+
5
+ describe('<nile-filter-chip>', () => {
6
+ afterEach(() => {
7
+ (NileFilterChip as any).activeChips = [];
8
+ });
9
+
10
+ it('registers and unregisters itself in activeChips', async () => {
11
+ const el = await fixture<NileFilterChip>(html`
12
+ <nile-filter-chip label="L" text="T"></nile-filter-chip>
13
+ `);
14
+ expect((NileFilterChip as any).activeChips).to.include(el);
15
+ el.remove();
16
+ await el.updateComplete;
17
+ expect((NileFilterChip as any).activeChips).to.not.include(el);
18
+ });
19
+
20
+ it('renders fallback label and text', async () => {
21
+ const el = await fixture<NileFilterChip>(html`
22
+ <nile-filter-chip label="MyLabel" text="MyText"></nile-filter-chip>
23
+ `);
24
+ const label = el.shadowRoot!.querySelector('.label')! as HTMLElement;
25
+ const value = el.shadowRoot!.querySelector('.value')! as HTMLElement;
26
+ expect(label.textContent).to.equal('MyLabel:');
27
+ expect(value.textContent!.trim()).to.equal('MyText');
28
+ });
29
+
30
+ it('renders slotted label and value over fallback', async () => {
31
+ const el = await fixture<NileFilterChip>(html`
32
+ <nile-filter-chip>
33
+ <span slot="label">SLOT-LBL</span>
34
+ <span slot="value">SLOT-VAL</span>
35
+ </nile-filter-chip>
36
+ `);
37
+ const slottedLabel = el.querySelector('[slot="label"]')! as HTMLElement;
38
+ const slottedValue = el.querySelector('[slot="value"]')! as HTMLElement;
39
+ expect(slottedLabel.textContent).to.equal('SLOT-LBL');
40
+ expect(slottedValue.textContent).to.equal('SLOT-VAL');
41
+ });
42
+
43
+ it('renders an icon when the `icon` property is set', async () => {
44
+ const el = await fixture<NileFilterChip>(html`
45
+ <nile-filter-chip icon="★" label="L" text="T"></nile-filter-chip>
46
+ `);
47
+ const iconSpan = el.shadowRoot!.querySelector('.icon')! as HTMLElement;
48
+ expect(iconSpan).to.exist;
49
+ expect(iconSpan.textContent).to.equal('★');
50
+ });
51
+
52
+ it('does not render a badge when viewMoreCount is zero', async () => {
53
+ const el = await fixture<NileFilterChip>(html`
54
+ <nile-filter-chip viewMoreCount="0" label="L" text="T"></nile-filter-chip>
55
+ `);
56
+ expect(el.shadowRoot!.querySelector('nile-badge')).to.be.null;
57
+ });
58
+
59
+ it('renders a +badge when viewMoreCount > 0', async () => {
60
+ const el = await fixture<NileFilterChip>(html`
61
+ <nile-filter-chip viewMoreCount="5" label="L" text="T"></nile-filter-chip>
62
+ `);
63
+ const badge = el.shadowRoot!.querySelector('nile-badge')! as HTMLElement;
64
+ expect(badge).to.exist;
65
+ expect(badge.textContent).to.contain('+5');
66
+ });
67
+
68
+
69
+
70
+ it('dispatches `nile-click` on chip click', async () => {
71
+ const el = await fixture<NileFilterChip>(html`
72
+ <nile-filter-chip label="L" text="T"></nile-filter-chip>
73
+ `);
74
+ const chip = el.shadowRoot!.querySelector('.chip')! as HTMLElement;
75
+ setTimeout(() => chip.click());
76
+ const ev = await oneEvent(el, 'nile-click');
77
+ expect(ev.detail).to.deep.equal({ text: 'T', viewMoreCount: 0 });
78
+ });
79
+
80
+ it('dispatches `nile-close` on close icon click and removes itself', async () => {
81
+ const el = await fixture<NileFilterChip>(html`
82
+ <nile-filter-chip closable viewMoreCount="2" text="TT"></nile-filter-chip>
83
+ `);
84
+ const closeIcon = el.shadowRoot!.querySelector('.close-icon')! as HTMLElement;
85
+ setTimeout(() => closeIcon.click());
86
+ const ev = await oneEvent(el, 'nile-close');
87
+ expect(ev.detail).to.deep.equal({ text: 'TT', viewMoreCount: 2 });
88
+ expect(document.body.contains(el)).to.be.false;
89
+ });
90
+
91
+
92
+ });
@@ -0,0 +1,125 @@
1
+ import { LitElement, html, css, CSSResultArray, TemplateResult } from 'lit';
2
+ import { customElement, property } from 'lit/decorators.js';
3
+ import NileElement from '../internal/nile-element';
4
+ import { styles } from './nile-filter-chip.css';
5
+
6
+ /**
7
+ * Nile filter-chip component.
8
+ *
9
+ * @tag nile-filter-chip
10
+ */
11
+ @customElement('nile-filter-chip')
12
+ export class NileFilterChip extends NileElement {
13
+ @property({ type: String }) label = '';
14
+ @property({ type: String }) text = '';
15
+ @property({ type: Number }) viewMoreCount: number = 0;
16
+ @property({ type: Boolean }) editable = false;
17
+ @property({ type: Boolean }) closable = false;
18
+ @property({ type: String }) icon = '';
19
+ @property({ type: String }) removeIcon = '';
20
+
21
+ private static activeChips: NileFilterChip[] = [];
22
+
23
+ public static get styles(): CSSResultArray {
24
+ return [styles];
25
+ }
26
+
27
+ connectedCallback() {
28
+ super.connectedCallback();
29
+ this.registerChip();
30
+ }
31
+
32
+ disconnectedCallback() {
33
+ super.disconnectedCallback();
34
+ this.unregisterChip();
35
+ }
36
+
37
+ private registerChip() {
38
+ NileFilterChip.activeChips.push(this);
39
+ }
40
+
41
+ private unregisterChip() {
42
+ NileFilterChip.activeChips = NileFilterChip.activeChips.filter(
43
+ (chip) => chip !== this
44
+ );
45
+ }
46
+
47
+ private handleClose(event: Event) {
48
+ event.stopPropagation();
49
+ this.dispatchEvent(
50
+ new CustomEvent('nile-close', { detail: { text: this.text, viewMoreCount: this.viewMoreCount } })
51
+ );
52
+ this.remove();
53
+ }
54
+
55
+ private handleClick() {
56
+ this.dispatchEvent(
57
+ new CustomEvent('nile-click', { detail: { text: this.text, viewMoreCount: this.viewMoreCount } })
58
+ );
59
+ }
60
+
61
+ private getLabelSlot(): TemplateResult {
62
+ return html`
63
+ <slot name="label">
64
+ <span class="label">${this.label}:</span>
65
+ </slot>
66
+ `;
67
+ }
68
+
69
+ private getValueSlot(): TemplateResult {
70
+ return html`
71
+ <slot name="value">
72
+ <span class="value">${this.text}</span>
73
+ </slot>
74
+ `;
75
+ }
76
+
77
+ private getviewMoreCountSlot(): TemplateResult {
78
+ return html`
79
+ <slot name="suffix">
80
+ ${this.viewMoreCount
81
+ ? html`
82
+ <nile-badge variant="primary" pilltype="pill-color">
83
+ +${this.viewMoreCount}
84
+ </nile-badge>
85
+ `
86
+ : html``}
87
+ </slot>
88
+ `;
89
+ }
90
+
91
+ private getCloseIconSlot(): TemplateResult {
92
+ return html`
93
+ ${this.closable
94
+ ? html`
95
+ <span class="close-icon" @click="${this.handleClose}">
96
+ <nile-icon name="${this.removeIcon || 'close'}" size="12"></nile-icon>
97
+ </span>
98
+ `
99
+ : html``}
100
+ `;
101
+ }
102
+
103
+ public render(): TemplateResult {
104
+ return html`
105
+ <div class="chip" @click="${this.handleClick}">
106
+ <slot name="icon">
107
+ ${this.icon ? html`<span class="icon">${this.icon}</span>` : html``}
108
+ </slot>
109
+ ${this.getLabelSlot()}
110
+ <slot name="content"></slot>
111
+ ${this.getValueSlot()}
112
+ ${this.getviewMoreCountSlot()}
113
+ ${this.getCloseIconSlot()}
114
+ </div>
115
+ `;
116
+ }
117
+ }
118
+
119
+ export default NileFilterChip;
120
+
121
+ declare global {
122
+ interface HTMLElementTagNameMap {
123
+ 'nile-filter-chip': NileFilterChip;
124
+ }
125
+ }
@@ -15,7 +15,6 @@ export default css`
15
15
  display: flex;
16
16
  height: 6px;
17
17
  justify-content: space-between;
18
- display: inline-block;
19
18
  }
20
19
 
21
20
  .nile-progress-bar__progress-bar li {
@@ -74,7 +74,7 @@ export class NileTable extends NileElement {
74
74
  handleBodyCssUpdate(){
75
75
  if (this.rows.length<2) return;
76
76
  const tableBodies = this.rows;
77
- const firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base');
77
+ const firstEl=tableBodies[0].shadowRoot?.querySelector<HTMLDivElement>('div.base')
78
78
  if(firstEl) {
79
79
  firstEl.style.borderTopRightRadius="var(--nile-radius-radius-xl)";
80
80
  firstEl.style.borderTopLeftRadius = 'var(--nile-radius-radius-xl)';
@@ -84,7 +84,7 @@ export class NileTable extends NileElement {
84
84
  }
85
85
  tableBodies.forEach((tb,i)=>{
86
86
  if(i>0 && i<tableBodies.length-1){
87
- const el=tb.shadowRoot?.querySelector<HTMLDivElement>('div.base');
87
+ const el=tb.shadowRoot?.querySelector<HTMLDivElement>('div.base')
88
88
  if(el) {
89
89
  el.style.borderTopRightRadius="0px";
90
90
  el.style.borderTopLeftRadius = "0px";
@@ -11,93 +11,60 @@ import { css } from 'lit';
11
11
  * Tooltip CSS
12
12
  */
13
13
  export const styles = css`
14
+ :host {
15
+ --max-width: 20rem;
16
+ --hide-delay: 0ms;
17
+ --show-delay: 150ms;
14
18
 
15
-
16
- :host {
17
- position: relative;
18
- display: inline-block;
19
- }
20
- .tooltip {
21
- position: fixed;
22
- z-index: 1000;
23
- background-color: var(--nile-tooltip-color-background, #333);
24
- color: var(--nile-colors-white-base, #fff);
25
- padding: 6px 10px;
26
- border-radius: 4px;
27
- font-size: var(--nile-tooltip-font-size-sm, 14px);
28
- line-height: var(--nile-tooltip-line-height-sm, 1.5);
29
- opacity: 0;
30
- transition: opacity 0.2s, transform 0.2s;
31
- pointer-events: none;
32
- white-space: normal;
33
- visibility: hidden;
34
- overflow: visible;
35
-
36
- }
37
- :host([open]) .tooltip {
38
- opacity: 1;
39
- visibility: visible;
40
- pointer-events: auto;
41
- }
42
- .tooltip-content {
43
- overflow: auto;
44
- max-width: 250px;
45
- max-height: 116px;
46
- }
47
- .tooltip-caret {
48
- position: absolute;
49
- width: calc(2 * var(--caret-size, 6px));
50
- height: calc(2 * var(--caret-size, 6px));
51
- background-color: inherit;
52
- transform: rotate(45deg);
53
- z-index: -1;
54
- }
55
- .trigger-container {
56
- display: inline-block;
57
- }
58
-
59
-
60
- :host([open]) .tooltip {
61
- visibility: visible;
62
- pointer-events: auto;
63
- animation: fadeIn 150ms forwards;
64
- }
65
-
66
-
67
- .tooltip.hide {
68
- animation: fadeOut 100ms forwards;
69
- }
70
-
71
-
72
- @keyframes fadeIn {
73
- from {
74
- opacity: 0;
75
- transform: translateY(5px);
19
+ display: contents;
76
20
  }
77
- to {
78
- opacity: 1;
79
- transform: translateY(0);
80
- }
81
- }
82
21
 
83
-
84
- @keyframes fadeOut {
85
- from {
86
- opacity: 1;
87
- transform: translateY(0);
22
+ .tooltip {
23
+ --arrow-size: 6px;
24
+ --arrow-color: var(--nile-tooltip-color-background);
88
25
  }
89
- to {
90
- opacity: 0;
91
- transform: translateY(5px);
26
+
27
+ .tooltip::part(popup) {
28
+ pointer-events: none;
29
+ z-index: 1000;
92
30
  }
93
- }
94
31
 
32
+ .tooltip[placement^='top']::part(popup) {
33
+ transform-origin: bottom;
34
+ }
95
35
 
36
+ .tooltip[placement^='bottom']::part(popup) {
37
+ transform-origin: top;
38
+ }
96
39
 
40
+ .tooltip[placement^='left']::part(popup) {
41
+ transform-origin: right;
42
+ }
97
43
 
44
+ .tooltip[placement^='right']::part(popup) {
45
+ transform-origin: left;
46
+ }
98
47
 
48
+ .tooltip__body {
49
+ display: block;
50
+ width: max-content;
51
+ max-width: var(--max-width);
52
+ border-radius: 4px;
53
+ background-color: var(--nile-tooltip-color-background);
54
+ font-size: var(--nile-tooltip-font-size-sm);
55
+ font-weight: var(--nile-tooltip-font-weight-sm);
56
+ line-height: var(--nile-tooltip-line-height-sm);
57
+ padding: var(--nile-tooltip-padding-y) var(--nile-tooltip-padding-x);
58
+ color: var(--nile-colors-white-base);
59
+ pointer-events: none;
60
+ word-break: break-word;
61
+ }
99
62
 
100
-
63
+ .tooltip__body--large {
64
+ font-size: var(--nile-tooltip-font-size-lg);
65
+ line-height: var(--nile-tooltip-line-height-lg);
66
+ font-weight: var(--nile-tooltip-font-weight-lg);
67
+ }
101
68
  `;
102
69
 
103
- export default [styles];
70
+ export default [styles];