@kubex/zinc 1.0.4 → 1.0.6

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 (158) hide show
  1. package/dist/custom-elements.json +1278 -191
  2. package/dist/vscode.html-custom-data.json +93 -16
  3. package/dist/web-types.json +235 -25
  4. package/dist/zn.d.ts +1313 -941
  5. package/dist/zn.min.css +1 -1
  6. package/dist/zn.min.js +2049 -931
  7. package/docs/_includes/default.njk +1 -0
  8. package/docs/assets/scripts/docs.js +4 -5
  9. package/docs/assets/scripts/search.js +0 -9
  10. package/docs/assets/styles/docs.css +3 -3
  11. package/docs/data/data-table.json +79 -0
  12. package/docs/data/products-table.json +36 -0
  13. package/docs/eleventy.config.cjs +3 -0
  14. package/docs/pages/components/data-select.md +10 -0
  15. package/docs/pages/components/data-table.md +84 -45
  16. package/docs/pages/components/dialog.md +1 -1
  17. package/docs/pages/components/editor.md +1 -3
  18. package/docs/pages/components/filter-wrapper.md +20 -0
  19. package/docs/pages/components/icon.md +2 -0
  20. package/docs/pages/components/item.md +2 -2
  21. package/docs/pages/components/menu-item.md +12 -3
  22. package/docs/pages/components/panel.md +17 -0
  23. package/docs/pages/components/progress-tile.md +17 -1
  24. package/docs/pages/components/settings-container.md +137 -0
  25. package/docs/pages/components/textarea.md +1 -1
  26. package/package.json +3 -1
  27. package/scss/_root.scss +26 -0
  28. package/scss/boot.scss +27 -1
  29. package/scss/mixins/index.scss +30 -1
  30. package/scss/shared/_base.scss +1 -1
  31. package/scss/shared/_button.scss +1 -1
  32. package/scss/shared/layout.scss +7 -0
  33. package/scss/themes/_dark.scss +5 -5
  34. package/scss/themes/_light.scss +6 -5
  35. package/scss/variables/index.scss +9 -0
  36. package/src/components/alert/alert.component.ts +1 -1
  37. package/src/components/alert/alert.scss +18 -4
  38. package/src/components/bulk-actions/bulk-actions.component.ts +152 -84
  39. package/src/components/bulk-actions/bulk-actions.scss +2 -0
  40. package/src/components/button/button.component.ts +6 -2
  41. package/src/components/button/button.scss +16 -1
  42. package/src/components/button-menu/button-menu.component.ts +23 -15
  43. package/src/components/button-menu/button-menu.scss +4 -4
  44. package/src/components/chart/chart.component.ts +14 -12
  45. package/src/components/checkbox/checkbox.component.ts +5 -1
  46. package/src/components/checkbox/checkbox.scss +1 -1
  47. package/src/components/chip/chip.component.ts +7 -3
  48. package/src/components/chip/chip.scss +9 -1
  49. package/src/components/collapsible/collapsible.component.ts +48 -2
  50. package/src/components/cols/cols.component.ts +7 -3
  51. package/src/components/cols/cols.scss +22 -14
  52. package/src/components/confirm/confirm.component.ts +1 -2
  53. package/src/components/content-block/content-block.component.ts +104 -14
  54. package/src/components/content-block/content-block.scss +8 -0
  55. package/src/components/data-select/data-select.component.ts +1 -1
  56. package/src/components/data-table/data-table.component.ts +394 -430
  57. package/src/components/data-table/data-table.scss +6 -1
  58. package/src/components/datepicker/datepicker.scss +1 -1
  59. package/src/components/dialog/dialog.component.ts +52 -33
  60. package/src/components/dialog/dialog.scss +15 -1
  61. package/src/components/dropdown/dropdown.component.ts +1 -1
  62. package/src/components/editor/editor.component.ts +196 -158
  63. package/src/components/editor/editor.scss +25 -5
  64. package/src/components/editor/modules/ai/index.ts +281 -0
  65. package/src/components/editor/modules/ai/panel/ai-panel.component.ts +102 -0
  66. package/src/components/editor/modules/ai/panel/ai-panel.scss +83 -0
  67. package/src/components/editor/modules/ai/tooltip/ai-tooltip.component.ts +30 -0
  68. package/src/components/editor/modules/ai/tooltip/ai-tooltip.scss +28 -0
  69. package/src/components/editor/modules/{attachment-module.ts → attachment/attachment.ts} +7 -7
  70. package/src/components/editor/modules/context-menu/context-menu-component.ts +115 -0
  71. package/src/components/editor/modules/context-menu/context-menu.scss +49 -0
  72. package/src/components/editor/modules/context-menu/context-menu.ts +296 -0
  73. package/src/components/editor/modules/context-menu/quick-action/index.ts +12 -0
  74. package/src/components/editor/modules/context-menu/quick-action/quick-action.component.ts +18 -0
  75. package/src/components/editor/modules/date-picker/date-picker.ts +77 -0
  76. package/src/components/editor/modules/dialog/dialog.component.ts +115 -0
  77. package/src/components/editor/modules/dialog/dialog.scss +43 -0
  78. package/src/components/editor/modules/dialog/dialog.ts +46 -0
  79. package/src/components/editor/modules/{drag-drop-module.ts → drag-drop/drag-drop.ts} +6 -6
  80. package/src/components/editor/modules/emoji/emoji.ts +106 -0
  81. package/src/components/editor/modules/emoji/headless/headless-emoji.component.ts +122 -0
  82. package/src/components/editor/modules/emoji/headless/headless-emoji.scss +52 -0
  83. package/src/components/editor/modules/emoji/headless/headless-emoji.ts +223 -0
  84. package/src/components/editor/modules/{image-resize-module/image-resize-module.ts → image-resize/image-resize.ts} +5 -5
  85. package/src/components/editor/modules/{time-tracking-module.ts → time-tracking/time-tracking.ts} +5 -5
  86. package/src/components/editor/modules/toolbar/tool/index.ts +12 -0
  87. package/src/components/editor/modules/toolbar/tool/tool.component.ts +30 -0
  88. package/src/components/editor/modules/toolbar/tool/tool.scss +5 -0
  89. package/src/components/editor/modules/toolbar/toolbar.component.ts +738 -0
  90. package/src/components/editor/modules/toolbar/toolbar.scss +98 -0
  91. package/src/components/editor/modules/toolbar/toolbar.ts +328 -0
  92. package/src/components/expanding-action/expanding-action.component.ts +2 -2
  93. package/src/components/expanding-action/expanding-action.scss +2 -2
  94. package/src/components/filter-wrapper/filter-wrapper.component.ts +91 -0
  95. package/src/components/filter-wrapper/filter-wrapper.scss +11 -0
  96. package/src/components/filter-wrapper/filter-wrapper.test.ts +10 -0
  97. package/src/components/filter-wrapper/index.ts +12 -0
  98. package/src/components/header/header.component.ts +1 -1
  99. package/src/components/header/header.scss +8 -1
  100. package/src/components/hover-container/hover-container.scss +39 -36
  101. package/src/components/icon/icon.component.ts +11 -5
  102. package/src/components/icon/icon.scss +15 -2
  103. package/src/components/inline-edit/inline-edit.component.ts +52 -6
  104. package/src/components/inline-edit/inline-edit.scss +15 -2
  105. package/src/components/input/input.scss +1 -1
  106. package/src/components/item/item.component.ts +30 -19
  107. package/src/components/item/item.scss +57 -23
  108. package/src/components/linked-select/linked-select.component.ts +5 -1
  109. package/src/components/menu/menu.component.ts +1 -0
  110. package/src/components/menu/menu.scss +1 -1
  111. package/src/components/menu-item/menu-item.component.ts +22 -4
  112. package/src/components/menu-item/menu-item.scss +54 -7
  113. package/src/components/navbar/navbar.component.ts +7 -1
  114. package/src/components/navbar/navbar.scss +26 -16
  115. package/src/components/option/option.component.ts +4 -1
  116. package/src/components/option/option.scss +9 -0
  117. package/src/components/page-nav/page-nav.component.ts +2 -2
  118. package/src/components/page-nav/page-nav.scss +4 -4
  119. package/src/components/panel/panel.component.ts +20 -9
  120. package/src/components/panel/panel.scss +5 -1
  121. package/src/components/popup/popup.component.ts +16 -2
  122. package/src/components/progress-tile/progress-tile.component.ts +10 -4
  123. package/src/components/progress-tile/progress-tile.scss +7 -4
  124. package/src/components/query-builder/query-builder.component.ts +1 -1
  125. package/src/components/radio/radio.scss +1 -1
  126. package/src/components/scroll-container/scroll-container.component.ts +56 -9
  127. package/src/components/scroll-container/scroll-container.scss +37 -2
  128. package/src/components/select/select.component.ts +3 -0
  129. package/src/components/select/select.scss +1 -1
  130. package/src/components/settings-container/index.ts +12 -0
  131. package/src/components/settings-container/settings-container.component.ts +226 -0
  132. package/src/components/settings-container/settings-container.scss +99 -0
  133. package/src/components/settings-container/settings-container.test.ts +10 -0
  134. package/src/components/skeleton/skeleton.scss +5 -4
  135. package/src/components/sp/sp.component.ts +2 -0
  136. package/src/components/sp/sp.scss +2 -0
  137. package/src/components/split-button/split-button.component.ts +24 -18
  138. package/src/components/split-pane/split-pane.component.ts +5 -5
  139. package/src/components/stat/stat.component.ts +5 -1
  140. package/src/components/stat/stat.scss +24 -1
  141. package/src/components/style/style.component.ts +25 -1
  142. package/src/components/tabs/tabs.component.ts +12 -1
  143. package/src/components/textarea/textarea.component.ts +3 -1
  144. package/src/components/textarea/textarea.scss +21 -2
  145. package/src/components/vertical-stepper/vertical-stepper.scss +1 -1
  146. package/src/internal/form.ts +3 -1
  147. package/src/internal/slot.ts +29 -3
  148. package/src/utilities/on.ts +7 -8
  149. package/src/utilities/query.ts +5 -1
  150. package/src/wc.scss +7 -0
  151. package/src/zinc.ts +5 -0
  152. package/src/components/editor/modules/dialog-module/dialog-module.component.ts +0 -289
  153. package/src/components/editor/modules/dialog-module/dialog-module.scss +0 -115
  154. package/src/components/editor/modules/dialog-module/dialog-module.ts +0 -99
  155. package/src/components/editor/modules/events/zn-show-canned-response-dialog.ts +0 -15
  156. package/src/components/editor/modules/menu-module/menu-module.component.ts +0 -149
  157. package/src/components/editor/modules/menu-module/menu-module.scss +0 -17
  158. package/src/components/editor/modules/menu-module/menu-module.ts +0 -203
@@ -1,8 +1,15 @@
1
1
  import {classMap} from "lit/directives/class-map.js";
2
2
  import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
3
3
  import {FormControlController} from "../../internal/form";
4
+ import {litToHTML} from "../../utilities/lit-to-html";
4
5
  import {property, query} from 'lit/decorators.js';
5
6
  import ZincElement from '../../internal/zinc-element';
7
+ import ZnButton from "../button";
8
+ import ZnInput from "../input";
9
+ import ZnOption from "../option";
10
+ import ZnSelect from "../select";
11
+ import type {ZnChangeEvent} from "../../events/zn-change";
12
+ import type {ZnInputEvent} from "../../events/zn-input";
6
13
 
7
14
  import styles from './bulk-actions.scss';
8
15
 
@@ -29,7 +36,10 @@ export interface BulkActionItem {
29
36
  * @status experimental
30
37
  * @since 1.0
31
38
  *
32
- * @dependency zn-example
39
+ * @dependency zn-button
40
+ * @dependency zn-input
41
+ * @dependency zn-option
42
+ * @dependency zn-select
33
43
  *
34
44
  * @event zn-event-name - Emitted as an example.
35
45
  *
@@ -42,9 +52,15 @@ export interface BulkActionItem {
42
52
  */
43
53
  export default class ZnBulkActions extends ZincElement {
44
54
  static styles: CSSResultGroup = unsafeCSS(styles);
55
+ static dependencies = {
56
+ 'zn-button': ZnButton,
57
+ 'zn-input': ZnInput,
58
+ 'zn-option': ZnOption,
59
+ 'zn-select': ZnSelect,
60
+ };
45
61
 
46
62
  @query('.bulk-actions') container: HTMLDivElement;
47
- @query('.add-rule') addRule: HTMLSelectElement;
63
+ @query('.add-rule') addRule: ZnSelect;
48
64
  @query('input#main-input') input: HTMLInputElement;
49
65
 
50
66
  @property() name: string;
@@ -73,12 +89,13 @@ export default class ZnBulkActions extends ZincElement {
73
89
  <div class="${classMap({
74
90
  'bulk-actions': true
75
91
  })}">
76
- <select class="add-rule" @change="${this._addRule}">
77
- <option value="">Select Filter</option>
92
+ <zn-select class="add-rule" placeholder="Select Filter" @zn-change="${this._addRule}">
78
93
  ${this.actions.map((item: BulkActionItem) => html`
79
- <option value="${item.id}">${item.name.charAt(0).toUpperCase() + item.name.slice(1)}</option>`)}
80
- </select>
81
- <input id="main-input" name="${this.name}" value="${this.value}" type="hidden">
94
+ <zn-option value="${item.id}">
95
+ ${item.name.charAt(0).toUpperCase() + item.name.slice(1)}
96
+ </zn-option>`)}
97
+ </zn-select>
98
+ <input id="main-input" name="${this.name}" value="${this.value}" hidden>
82
99
  </div>
83
100
  `;
84
101
  }
@@ -95,8 +112,9 @@ export default class ZnBulkActions extends ZincElement {
95
112
  this.value = btoa(JSON.stringify(data));
96
113
  }
97
114
 
98
- private _addRule(event: Event | null, value: string = "") {
99
- const id = value ? value : event ? (event.target as HTMLSelectElement).value : '';
115
+ private _addRule(event: Event | null, value: string = "", pos?: number) {
116
+ const target = event?.target as ZnSelect;
117
+ const id = value ? value : target?.value || '';
100
118
  if (id === '') return;
101
119
 
102
120
  const filter = this.actions.find(item => item.id === id);
@@ -109,104 +127,154 @@ export default class ZnBulkActions extends ZincElement {
109
127
  value: ''
110
128
  });
111
129
 
112
- const row = document.createElement('div');
113
- row.classList.add('query-builder__row');
114
- row.id = uniqueId;
115
-
116
- const select = document.createElement('select');
117
- this.actions.forEach(item => {
118
- const option = document.createElement('option');
119
- option.value = item.id;
120
- option.text = item.name.charAt(0).toUpperCase() + item.name.slice(1);
121
- option.selected = item.id === filter.id;
122
- select.appendChild(option);
123
- });
124
- select.addEventListener('change', (e: Event) => this._changeRule(uniqueId, e));
125
- select.classList.add('query-builder__key');
130
+ const keySelect = html`
131
+ <zn-select class="query-builder__key"
132
+ @zn-change="${(e: ZnChangeEvent) => this._changeRule(uniqueId, e)}"
133
+ value="${filter.id}">
134
+ ${this.actions.map((item: BulkActionItem) => html`
135
+ <zn-option value="${item.id}">
136
+ ${item.name.charAt(0).toUpperCase() + item.name.slice(1)}
137
+ </zn-option>
138
+ `)}
139
+ </zn-select>
140
+ `;
126
141
 
127
- row.appendChild(select);
142
+ const input = this._createInput(uniqueId, filter);
143
+
144
+ const remove = html`
145
+ <zn-button class="query-builder__remove"
146
+ icon="delete"
147
+ icon-size="24"
148
+ color="transparent"
149
+ size="square"
150
+ @click="${(e: Event) => this._removeRule(uniqueId, e)}">
151
+ </zn-button>`;
152
+
153
+ const wrapper = html`
154
+ <div class="query-builder__wrapper">
155
+ ${input}
156
+ ${remove}
157
+ </div>
158
+ `;
128
159
 
129
- let input: HTMLSelectElement | HTMLInputElement | HTMLDivElement;
130
- if (filter.options) {
131
- input = document.createElement('select');
132
- const options = Object.keys(filter.options);
133
- options.forEach((item: string) => {
134
- const option = document.createElement('option');
135
- option.value = item;
136
- option.text = filter.options ? (filter.options[item]) : '';
137
- input.appendChild(option);
138
- });
139
- this._updateValue(uniqueId, {target: input});
140
- input.addEventListener('change', (e: Event) => this._updateValue(uniqueId, e));
141
- } else if (filter.type === 'bool' || filter.type === 'boolean') {
142
- input = document.createElement('select');
143
- const option1 = document.createElement('option');
144
- option1.value = '1';
145
- option1.text = 'True';
146
- input.appendChild(option1);
147
- const option2 = document.createElement('option');
148
- option2.value = '0';
149
- option2.text = 'False';
150
- input.appendChild(option2);
151
- input.addEventListener('change', (e: Event) => this._updateValue(uniqueId, e));
152
- } else if (filter.type === 'number') {
153
- input = document.createElement('input');
154
- input.setAttribute('type', 'number');
155
- input.addEventListener('input', (e: Event) => this._updateValue(uniqueId, e));
156
- } else if (filter.type === 'date') {
157
- input = document.createElement('input');
158
- input.setAttribute('type', 'date');
159
- input.addEventListener('input', (e: Event) => this._updateValue(uniqueId, e));
160
+ const rowElement = html`
161
+ <div id="${uniqueId}" class="query-builder__row">
162
+ ${keySelect}
163
+ ${wrapper}
164
+ </div>
165
+ `;
166
+
167
+ const row = litToHTML<HTMLDivElement>(rowElement);
168
+ if (!row) return;
169
+
170
+ if (pos !== undefined) {
171
+ this.container.insertBefore(row, this.container.children[pos]);
160
172
  } else {
161
- input = document.createElement('input');
162
- input.setAttribute('type', 'text');
163
- input.addEventListener('input', (e: Event) => this._updateValue(uniqueId, e));
173
+ this.container.insertBefore(row, this.addRule);
164
174
  }
165
175
 
166
- input.classList.add('query-builder__value');
167
- const wrapper = document.createElement('div');
168
- wrapper.classList.add('query-builder__wrapper');
169
- wrapper.appendChild(input);
170
- row.appendChild(wrapper);
171
-
172
- const remove = document.createElement('zn-button');
173
- remove.setAttribute('icon', 'delete');
174
- remove.setAttribute('icon-size', '24');
175
- remove.setAttribute('color', 'transparent');
176
- remove.setAttribute('size', 'square');
177
- remove.addEventListener('click', (e: Event) => this._removeRule(uniqueId, e));
178
- remove.classList.add('query-builder__remove');
179
- row.appendChild(remove);
180
-
181
- this.container.insertBefore(row, this.addRule);
176
+ // Reset back to default placeholder
182
177
  this.addRule.value = '';
178
+ this.addRule.displayLabel = '';
179
+ if (this.addRule.selectedOptions?.length) {
180
+ this.addRule.selectedOptions[0].selected = false;
181
+ }
182
+
183
183
  this._handleChange();
184
184
  }
185
185
 
186
- private _updateValue(id: string, event: Event | { target: HTMLSelectElement | HTMLInputElement | HTMLDivElement }) {
186
+ private _createInput(uniqueId: string, filter: BulkActionItem): ZnSelect | ZnInput | null {
187
+ if (filter.options) {
188
+ const input = html`
189
+ <zn-select class="query-builder__value"
190
+ @zn-change="${(e: ZnChangeEvent) => this._updateValue(uniqueId, e)}">
191
+ ${Object.keys(filter.options).map(key => html`
192
+ <zn-option value="${key}">
193
+ ${filter.options ? filter.options[key] : ''}
194
+ </zn-option>
195
+ `)}
196
+ </zn-select>`;
197
+ const el = litToHTML<ZnSelect>(input);
198
+ if (el) {
199
+ // initialize with current selection
200
+ this._updateValue(uniqueId, {target: el} as unknown as Event);
201
+ }
202
+ return el;
203
+ }
204
+
205
+ if (filter.type === 'bool' || filter.type === 'boolean') {
206
+ const input = html`
207
+ <zn-select class="query-builder__value"
208
+ @zn-change="${(e: ZnChangeEvent) => this._updateValue(uniqueId, e)}">
209
+ <zn-option value="1">True</zn-option>
210
+ <zn-option value="0">False</zn-option>
211
+ </zn-select>`;
212
+ return litToHTML<ZnSelect>(input);
213
+ }
214
+
215
+ if (filter.type === 'number') {
216
+ const input = html`
217
+ <zn-input type="number"
218
+ class="query-builder__value"
219
+ @zn-input="${(e: ZnInputEvent) => this._updateValue(uniqueId, e)}">
220
+ </zn-input>`;
221
+ return litToHTML<ZnInput>(input);
222
+ }
223
+
224
+ if (filter.type === 'date') {
225
+ const input = html`
226
+ <zn-input type="date"
227
+ class="query-builder__value"
228
+ @zn-input="${(e: ZnInputEvent) => this._updateValue(uniqueId, e)}">
229
+ </zn-input>`;
230
+ return litToHTML<ZnInput>(input);
231
+ }
232
+
233
+ const input = html`
234
+ <zn-input type="text"
235
+ class="query-builder__value"
236
+ @zn-input="${(e: ZnInputEvent) => this._updateValue(uniqueId, e)}">
237
+ </zn-input>`;
238
+ return litToHTML<ZnInput>(input);
239
+ }
240
+
241
+ private _updateValue(id: string, event: Event | { target: ZnSelect | ZnInput | HTMLDivElement }) {
187
242
  const filter = this._selectedRules.get(id);
188
243
  if (!filter) return;
189
244
 
190
- const input = event.target as HTMLSelectElement | HTMLInputElement;
191
- filter.value = input.value;
245
+ const input = event.target as ZnSelect | ZnInput;
246
+ filter.value = input.value as string;
192
247
 
193
248
  this._selectedRules.set(id, filter);
194
249
  this._handleChange();
195
250
  }
196
251
 
197
- private _changeRule(id: string, event: Event) {
252
+ private _getRulePosition(id: string): number {
253
+ const rules = this.container.querySelectorAll('.query-builder__row');
254
+ let position: number = -1;
255
+ rules.forEach((item, index) => {
256
+ if ((item as HTMLDivElement).id === id) {
257
+ position = index;
258
+ }
259
+ });
260
+ return position;
261
+ }
262
+
263
+ private _changeRule(id: string, event: ZnChangeEvent) {
198
264
  // remove the element from the dom
199
- const button = event.target as HTMLSelectElement;
200
- button.parentElement?.remove();
265
+ const pos: number = this._getRulePosition(id);
266
+ const select = event.target as ZnSelect;
267
+ select.popup.active = false;
268
+ select?.parentElement?.remove();
201
269
  // recreate the element based on the selected value;
202
- this._removeRule(id, event);
203
- this._addRule(event);
270
+ this._removeRule(id, event as unknown as Event);
271
+ this._addRule(event as unknown as Event, '', pos);
204
272
  }
205
273
 
206
274
  private _removeRule(id: string, event: Event) {
207
275
  this._selectedRules.delete(id);
208
- const button = event.target as HTMLButtonElement;
209
- button.parentElement?.remove();
276
+ const button = event.target as ZnButton;
277
+ button?.closest('.query-builder__row')?.remove();
210
278
  this._handleChange();
211
279
  }
212
280
 
@@ -40,7 +40,9 @@
40
40
  }
41
41
 
42
42
  &__wrapper {
43
+ display: flex;
43
44
  width: 100%;
45
+ gap: 10px;
44
46
  }
45
47
 
46
48
  &__date {
@@ -59,9 +59,11 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
59
59
  @property({type: Boolean}) grow = false;
60
60
  @property({type: Boolean}) square = false;
61
61
 
62
+
62
63
  @property({attribute: 'dropdown-closer', type: Boolean}) dropdownCloser = false;
63
64
 
64
65
  @property({type: Number}) notification: number;
66
+ @property({attribute: "muted-notifications", type: Boolean}) mutedNotifications = false;
65
67
 
66
68
  @property() verticalAlign: 'start' | 'center' | 'end';
67
69
 
@@ -182,7 +184,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
182
184
  const isLink = this._isLink();
183
185
 
184
186
  const icon = this.icon ? html`
185
- <zn-icon src="${this.icon}" id="xy2" size="${this.iconSize ? this.iconSize : 16}"
187
+ <zn-icon part="icon" src="${this.icon}" id="xy2" size="${this.iconSize ? this.iconSize : 16}"
186
188
  color="${this.iconColor ? this.iconColor : null}"></zn-icon>` : '';
187
189
 
188
190
  const tag = isLink ? literal`a` : literal`button`;
@@ -215,7 +217,9 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
215
217
  'button--icon-right': this.iconPosition === 'right',
216
218
  'button--with-content': this.hasSlotController.test('[default]') || this.content,
217
219
  'button--square': this.square,
218
- 'button--has-notification': this.notification !== undefined && this.notification > 0,
220
+ 'button--has-notification': this.notification !== undefined && this.notification !== 0,
221
+ 'button--muted-notification': this.mutedNotifications || (this.notification !== undefined && this.notification === -2),
222
+ 'button--notification-dot': this.notification !== undefined && this.notification < 0,
219
223
  })}"
220
224
  type="${ifDefined(this.type)}"
221
225
  href="${ifDefined(this.href)}"
@@ -17,6 +17,7 @@
17
17
  @include shared.button;
18
18
 
19
19
  --btn-color: var(--zn-primary);
20
+ --notification-color: rgb(var(--zn-color-error));
20
21
 
21
22
  border-width: 1px;
22
23
  border-color: transparent;
@@ -40,6 +41,10 @@
40
41
  }
41
42
  }
42
43
 
44
+ .button.button--muted-notification {
45
+ --notification-color: rgb(var(--zn-color-info));
46
+ }
47
+
43
48
  .button--has-notification {
44
49
  position: relative;
45
50
 
@@ -56,7 +61,17 @@
56
61
  border-radius: 50%;
57
62
  font-size: 10px;
58
63
  color: white;
59
- background-color: rgb(var(--zn-color-error));
64
+ background-color: var(--notification-color);
65
+ }
66
+ }
67
+
68
+ .button--has-notification.button--notification-dot {
69
+ &:after {
70
+ content: '';
71
+ width: 5px;
72
+ height: 5px;
73
+ top: 5px;
74
+ right: 3px;
60
75
  }
61
76
  }
62
77
 
@@ -1,5 +1,6 @@
1
1
  import {classMap} from "lit/directives/class-map.js";
2
2
  import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
3
+ import {deepQuerySelectorAll} from "../../utilities/query";
3
4
  import {property} from 'lit/decorators.js';
4
5
  import {watch} from "../../internal/watch";
5
6
  import ZincElement from '../../internal/zinc-element';
@@ -40,6 +41,8 @@ export default class ZnButtonMenu extends ZincElement {
40
41
 
41
42
  @property({}) size: 'content' | 'x-small' | 'small' | 'medium' | 'large' = 'medium';
42
43
 
44
+ @property({type: Number, attribute: 'icon-size', reflect: true}) iconSize: number = 24;
45
+
43
46
  @property({type: Boolean, attribute: 'no-gap'}) public noGap: boolean;
44
47
 
45
48
  @property({type: Boolean, attribute: 'no-padding'}) public noPadding: boolean;
@@ -174,6 +177,9 @@ export default class ZnButtonMenu extends ZincElement {
174
177
  if (!button.button.hasAttribute('color')) {
175
178
  button.button.setAttribute('color', button.button.hasAttribute('primary') ? 'primary' : button.button.hasAttribute('secondary') ? 'secondary' : 'transparent');
176
179
  }
180
+ if (button.button.hasAttribute('primary') || button.button.hasAttribute('secondary')) {
181
+ button.button.setAttribute('text', "");
182
+ }
177
183
  button.button.setAttribute('size', this.size);
178
184
  }
179
185
  });
@@ -256,8 +262,9 @@ export default class ZnButtonMenu extends ZincElement {
256
262
  }
257
263
  }
258
264
 
259
- // check if there are an zn-confirms attached
260
- const confirms: NodeListOf<ZnConfirm> = this.querySelectorAll('zn-confirm');
265
+ // check if there are any zn-confirms attached
266
+ // @ts-ignore
267
+ const confirms: NodeListOf<ZnConfirm> = deepQuerySelectorAll('zn-confirm', this, '');
261
268
  confirms.forEach(confirm => {
262
269
  confirm.updateTriggers(); // update the triggers for the confirm dialog
263
270
  })
@@ -272,7 +279,7 @@ export default class ZnButtonMenu extends ZincElement {
272
279
  })}>
273
280
  <div class="button-menu__container"></div>
274
281
  <zn-dropdown placement="bottom-end">
275
- <zn-button slot="trigger" icon="more_vert" icon-size="24" color="transparent" size="${this.size}"></zn-button>
282
+ <zn-button slot="trigger" icon="more_vert" icon-size="${this.iconSize}" color="transparent" size="${this.size}"></zn-button>
276
283
  <zn-menu></zn-menu>
277
284
  </zn-dropdown>
278
285
  <slot></slot>
@@ -331,21 +338,22 @@ export default class ZnButtonMenu extends ZincElement {
331
338
  }
332
339
 
333
340
  public removeAllButtons() {
334
- // remove all buttons that have the zn-button-menu__added class
335
- const buttons = this.querySelectorAll('.zn-button-menu__added');
336
- buttons.forEach((button: ZnButton) => {
337
- button.remove();
338
- });
341
+ const buttons = this.shadowRoot?.querySelectorAll('zn-button.zn-button-menu__added');
342
+ if (buttons) {
343
+ buttons.forEach((button: ZnButton) => {
344
+ button.remove();
345
+ });
346
+ }
339
347
 
340
- // remove all zn-menu-item elements
341
- const menuItems = this.shadowRoot?.querySelectorAll('zn-menu-item');
342
- menuItems?.forEach((menuItem: ZnMenuItem) => {
343
- menuItem.remove();
344
- });
348
+ const menuItems = this.shadowRoot?.querySelectorAll('zn-menu-item.zn-button-menu__added');
349
+ if (menuItems) {
350
+ menuItems?.forEach((menuItem: ZnMenuItem) => {
351
+ menuItem.remove();
352
+ });
353
+ }
345
354
 
346
- // reset the original buttons list
347
- this._originalButtons = [];
348
355
  this._buttons = [];
356
+ this._originalButtons = this._originalButtons.filter(b => !b.button.classList.contains('zn-button-menu__added'));
349
357
 
350
358
  // Recalculate the visible buttons
351
359
  this.calculateVisibleButtons();
@@ -3,7 +3,7 @@
3
3
  :host {
4
4
  display: block;
5
5
  max-width: 100%;
6
- --menu-gap: var(--zn-spacing-x-small);
6
+ --menu-gap: var(--zn-spacing-2x-small);
7
7
  }
8
8
 
9
9
  .button-menu--no-gap {
@@ -17,7 +17,7 @@
17
17
  padding: var(--zn-spacing-small) 0;
18
18
  margin: 0;
19
19
 
20
- min-width: 35px;
20
+ min-width: 34px;
21
21
  max-width: var(--zn-max-width);
22
22
 
23
23
  gap: var(--menu-gap);
@@ -31,11 +31,11 @@
31
31
  flex-direction: row;
32
32
  gap: var(--menu-gap);
33
33
  margin: 0;
34
- max-width: calc(100% - 35px);
34
+ max-width: calc(100% - 34px);
35
35
  }
36
36
 
37
37
  zn-button {
38
- min-width: 35px;
38
+ min-width: 34px;
39
39
  flex-shrink: 0;
40
40
  }
41
41
  }
@@ -1,5 +1,5 @@
1
- import { type CSSResultGroup, html, type PropertyValues, unsafeCSS } from 'lit';
2
- import { property } from 'lit/decorators.js';
1
+ import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
2
+ import {property} from 'lit/decorators.js';
3
3
  import ApexCharts from "apexcharts";
4
4
  import ZincElement from '../../internal/zinc-element';
5
5
 
@@ -26,21 +26,22 @@ export default class ZnChart extends ZincElement {
26
26
  static styles: CSSResultGroup = unsafeCSS(styles);
27
27
 
28
28
  @property() type: 'area' | 'bar' | 'line' = 'bar';
29
- @property({ type: Array }) data: any[] = [];
30
- @property({ type: Array }) categories: string | string[] = '';
29
+ @property({type: Array}) data: any[] = [];
30
+ @property({type: Array}) categories: string | string[] = '';
31
31
 
32
32
  @property() xAxis: string;
33
- @property({ type: Number, attribute: 'd-size' }) datapointSize: number = 1;
33
+ @property({type: Number, attribute: 'd-size'}) datapointSize: number = 1;
34
+ @property({type: Boolean}) stacked = false;
34
35
 
35
36
  // Live
36
- @property({ type: Boolean }) live = false;
37
- @property({ attribute: 'data-url' }) dataUrl = '';
38
- @property({ attribute: 'live-interval', type: Number }) liveInterval = 1000;
39
- @property({ type: Number, reflect: true }) height = 300;
37
+ @property({type: Boolean}) live = false;
38
+ @property({attribute: 'data-url'}) dataUrl = '';
39
+ @property({attribute: 'live-interval', type: Number}) liveInterval = 1000;
40
+ @property({type: Number, reflect: true}) height = 300;
40
41
 
41
- @property({ attribute: 'enable-animations', type: Boolean }) enableAnimations = false;
42
+ @property({attribute: 'enable-animations', type: Boolean}) enableAnimations = false;
42
43
 
43
- @property({ attribute: 'y-axis-append' }) yAxisAppend: string;
44
+ @property({attribute: 'y-axis-append'}) yAxisAppend: string;
44
45
 
45
46
  private chart: ApexCharts;
46
47
 
@@ -54,10 +55,11 @@ export default class ZnChart extends ZincElement {
54
55
  animations: this.enableAnimations,
55
56
  chart: {
56
57
  type: this.type,
57
- toolbar: { show: false },
58
+ toolbar: {show: false},
58
59
  foreColor: theme == 'dark' ? "rgb(149, 163, 184)" : "rgb(123, 112, 151)",
59
60
  height: this.height + 'px',
60
61
  fontFamily: '"Inter", sans',
62
+ stacked: this.stacked,
61
63
  zoom: {
62
64
  enabled: false
63
65
  },
@@ -7,9 +7,9 @@ import {ifDefined} from "lit/directives/if-defined.js";
7
7
  import {live} from "lit/directives/live.js";
8
8
  import {property, query, state} from 'lit/decorators.js';
9
9
  import {watch} from '../../internal/watch';
10
+ import type {ZincFormControl} from '../../internal/zinc-element';
10
11
  import ZincElement from '../../internal/zinc-element';
11
12
  import ZnIcon from "../icon";
12
- import type {ZincFormControl} from '../../internal/zinc-element';
13
13
 
14
14
  import styles from './checkbox.scss';
15
15
 
@@ -110,6 +110,10 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
110
110
  return this.input?.validity;
111
111
  }
112
112
 
113
+ get isChecked() {
114
+ return this.checked;
115
+ }
116
+
113
117
  /** Gets the validation message */
114
118
  get validationMessage() {
115
119
  return this.input.validationMessage;
@@ -57,7 +57,7 @@
57
57
  justify-content: center;
58
58
  width: var(--toggle-size);
59
59
  height: var(--toggle-size);
60
- box-shadow: var(--zn-shadow-medium);
60
+ box-shadow: var(--zn-shadow-x-small);
61
61
  border: solid var(--zn-input-border-width) var(--zn-input-border-color);
62
62
  border-radius: 2px;
63
63
  background-color: var(--zn-input-background-color);
@@ -40,9 +40,13 @@ export default class ZnChip extends ZincElement {
40
40
  private readonly hasSlotController = new HasSlotController(this, '[default]', 'action');
41
41
 
42
42
  render() {
43
+ const hasContent = this.hasSlotController.test('[default]')
43
44
  return html`
44
- <div class=${classMap({
45
+ <div class="${classMap({
45
46
  'chip': true,
47
+ 'chip--with-content': hasContent,
48
+ 'chip--no-content': !hasContent,
49
+ 'chip--with-icon': this.icon,
46
50
  'chip--flush': this.flush,
47
51
  'chip--flush-x': this.flushX,
48
52
  'chip--flush-y': this.flushY,
@@ -57,10 +61,10 @@ export default class ZnChip extends ZincElement {
57
61
  'chip--small': this.size === 'small',
58
62
  'chip--medium': this.size === 'medium',
59
63
  'chip--large': this.size === 'large',
60
- })}>
64
+ })}">
61
65
  ${this.icon ? html`
62
66
  <zn-icon src="${this.icon}" size="18"></zn-icon>` : ''}
63
- ${this.hasSlotController.test('[default]') ? html`
67
+ ${hasContent ? html`
64
68
  <slot></slot>` : ''}
65
69
  ${this.hasSlotController.test('action') ? html`
66
70
  <slot name="action" class="chip__action"></slot>` : ''}
@@ -7,7 +7,7 @@
7
7
  .chip {
8
8
  display: inline-flex;
9
9
  border-radius: 7px;
10
- padding: var(--zn-spacing-2x-small) var(--zn-spacing-x-small);
10
+ padding: var(--zn-spacing-3x-small) var(--zn-spacing-x-small);
11
11
  text-align: center;
12
12
  font-size: 12px;
13
13
  gap: 4px;
@@ -99,3 +99,11 @@
99
99
  font-size: var(--zn-font-size-large);
100
100
  padding: var(--zn-spacing-x-small) var(--zn-spacing-x-large);
101
101
  }
102
+
103
+ .chip--no-content {
104
+ padding: var(--zn-spacing-3x-small) var(--zn-spacing-2x-small);
105
+ }
106
+
107
+ .chip--with-icon {
108
+ padding-left: var(--zn-spacing-2x-small);
109
+ }