@kubex/zinc 1.1.160 → 1.1.162

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 (34) hide show
  1. package/dist/custom-elements.json +1086 -892
  2. package/dist/vscode.html-custom-data.json +95 -87
  3. package/dist/web-types.json +192 -181
  4. package/dist/zn.d.ts +32 -9
  5. package/dist/zn.min.css +1 -1
  6. package/dist/zn.min.js +367 -330
  7. package/docs/pages/components/data-table.md +30 -20
  8. package/package.json +1 -1
  9. package/scss/themes/_dark.scss +1 -0
  10. package/scss/themes/_light.scss +1 -0
  11. package/src/components/button/button.component.ts +4 -0
  12. package/src/components/button/button.scss +5 -0
  13. package/src/components/button/button.test.ts +10 -0
  14. package/src/components/checkbox/checkbox.component.ts +10 -6
  15. package/src/components/checkbox/checkbox.scss +4 -8
  16. package/src/components/content-block/content-block.component.ts +2 -3
  17. package/src/components/data-table/data-table.component.ts +171 -76
  18. package/src/components/data-table/data-table.scss +16 -60
  19. package/src/components/dropdown/dropdown.component.ts +6 -3
  20. package/src/components/flow-builder/modules/flow-node/flow-node.test.ts +2 -3
  21. package/src/components/flow-builder/modules/flow-step-group/flow-step-group.test.ts +14 -8
  22. package/src/components/form-actions/form-actions.test.ts +4 -1
  23. package/src/components/form-group/form-group.component.ts +45 -15
  24. package/src/components/navbar/navbar.test.ts +3 -2
  25. package/src/components/page/page.component.ts +1 -1
  26. package/src/components/page/page.test.ts +16 -16
  27. package/src/components/panel/panel.scss +23 -0
  28. package/src/components/popup/popup.component.ts +8 -1
  29. package/src/components/sp/sp.test.ts +2 -2
  30. package/src/components/theme-editor/theme-editor.component.ts +3 -2
  31. package/src/components/theme-editor/theme-editor.test.ts +30 -28
  32. package/src/components/tooltip/tooltip.component.ts +10 -1
  33. package/src/components/tooltip/tooltip.scss +5 -0
  34. package/src/components/translation-group/translation-group.test.ts +0 -2
@@ -156,7 +156,7 @@ Use `hide-pagination` to hide pagination controls even when multiple pages are a
156
156
 
157
157
  ### Row Selection
158
158
 
159
- By default, rows can be selected by clicking. Selected rows are tracked and can be used with bulk actions.
159
+ Rows get a checkbox column and can be selected by clicking once the table has an action to use them: something in the `delete-action`, `modify-action`, `create-action` or `actions` slot. Without one, the table has no checkboxes.
160
160
 
161
161
  ```html:preview
162
162
  <zn-data-table
@@ -176,28 +176,11 @@ By default, rows can be selected by clicking. Selected rows are tracked and can
176
176
  </zn-data-table>
177
177
  ```
178
178
 
179
- ### Hide Checkboxes
180
-
181
- Use `hide-checkboxes` to disable row selection functionality.
182
-
183
- ```html:preview
184
- <zn-data-table
185
- data-uri="/data/data-table.json"
186
- method="GET"
187
- hide-checkboxes
188
- headers='[
189
- {"key":"id","label":"ID"},
190
- {"key":"name","label":"Name"},
191
- {"key":"email","label":"Email"}
192
- ]'>
193
- </zn-data-table>
194
- ```
195
-
196
179
  ### Bulk Actions
197
180
 
198
181
  Add action buttons to the table header for performing operations on selected rows. Use the `delete-action`, `modify-action`, and `create-action` slots.
199
182
 
200
- `delete-action` and `modify-action` sit beside the caption alongside a select-all toggle, and only appear once rows are selected. `create-action` is a primary action rather than a selection one, so it renders at the end of the header's right-hand group, after the search field.
183
+ `delete-action` and `modify-action` appear at the start of the header's right-hand group once rows are selected. `create-action` is a primary action rather than a selection one, so it renders at the end of that group, after the search field.
201
184
 
202
185
  ```html:preview
203
186
  <zn-data-table
@@ -225,6 +208,32 @@ Add action buttons to the table header for performing operations on selected row
225
208
  </zn-data-table>
226
209
  ```
227
210
 
211
+ ### Actions Menu
212
+
213
+ Elements in the `actions` slot are listed in an ellipsis menu at the start of the header's right-hand group. The menu is disabled until at least one row is checked. Each `zn-button` becomes a menu item using its label, `icon` and `color`, and choosing it clicks the button. A `zn-confirm` takes its label and icon from its `trigger` slot button, and choosing it opens the confirm dialog. An `input[name="keys"]` inside a slotted element is kept filled with the selected row keys, the same as for `delete-action`.
214
+
215
+ ```html:preview
216
+ <zn-data-table
217
+ data-uri="/data/data-table.json"
218
+ method="GET"
219
+ caption="Customers"
220
+ headers='[
221
+ {"key":"id","label":"ID"},
222
+ {"key":"name","label":"Name"},
223
+ {"key":"email","label":"Email"},
224
+ {"key":"status","label":"Status"}
225
+ ]'>
226
+
227
+ <zn-button slot="actions" icon="archive@lu">Archive</zn-button>
228
+
229
+ <zn-confirm slot="actions" type="error" caption="Delete customers" content="Delete the selected customers?">
230
+ <zn-button slot="trigger" icon="trash-2@lu" color="error">Delete</zn-button>
231
+ <form><input type="hidden" name="keys"></form>
232
+ </zn-confirm>
233
+
234
+ </zn-data-table>
235
+ ```
236
+
228
237
  ### Secondary Columns
229
238
 
230
239
  Mark columns as secondary to hide them by default. Users can expand rows to view secondary data.
@@ -862,6 +871,7 @@ Access table methods programmatically to control behavior.
862
871
  {"key":"email","label":"Email"},
863
872
  {"key":"status","label":"Status"}
864
873
  ]'>
874
+ <zn-button slot="delete-action" color="error" icon="delete">Delete Selected</zn-button>
865
875
  </zn-data-table>
866
876
 
867
877
  <br />
@@ -877,7 +887,7 @@ Access table methods programmatically to control behavior.
877
887
  });
878
888
 
879
889
  document.querySelector('#select-all-btn').addEventListener('click', () => {
880
- table.selectAll(new Event('click'));
890
+ table.selectAll();
881
891
  });
882
892
  </script>
883
893
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubex/zinc",
3
- "version": "1.1.160",
3
+ "version": "1.1.162",
4
4
  "description": "A collection of web components for building web applications based off of @shoelace-style/Shoelace",
5
5
  "keywords": [
6
6
  "web components",
@@ -274,6 +274,7 @@
274
274
  --zn-input-border-color-hover: rgb(var(--zn-color-border-active));
275
275
  --zn-input-border-color-focus: var(--zn-color-primary-500);
276
276
  --zn-input-border-color-disabled: hsl(280, 6%, 9%);
277
+ --zn-checkbox-border-color: rgb(var(--zn-color-border-active));
277
278
 
278
279
  /* Focus rings */
279
280
  --zn-focus-ring-color: var(--zn-color-primary-700);
@@ -217,6 +217,7 @@
217
217
  --zn-input-border-color-hover: var(--zn-color-neutral-400);
218
218
  --zn-input-border-color-focus: var(--zn-color-primary-500);
219
219
  --zn-input-border-color-disabled: var(--zn-color-neutral-300);
220
+ --zn-checkbox-border-color: var(--zn-color-neutral-400);
220
221
  --zn-input-border-width: 1px;
221
222
 
222
223
  /* Input Required Content */
@@ -128,6 +128,9 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
128
128
  /** Accessible name for the button. Icon-only buttons fall back to `tooltip`. */
129
129
  @property() label: string;
130
130
 
131
+ /** Toggle state, forwarded to the inner button's `aria-pressed`. */
132
+ @property({attribute: 'aria-pressed'}) pressed: 'true' | 'false' | 'mixed';
133
+
131
134
  // Auto Click Specific
132
135
  @property({type: Boolean, attribute: 'auto-click'}) autoClick = false;
133
136
  @property({type: Number, attribute: 'auto-click-delay'}) autoClickDelay = 2000;
@@ -436,6 +439,7 @@ export default class ZnButton extends ZincElement implements ZincFormControl {
436
439
  rel="${ifDefined(isLink ? this.rel : undefined)}"
437
440
  gaid="${ifDefined(this.gaid)}"
438
441
  aria-label="${ifDefined(ariaLabel)}"
442
+ aria-pressed="${ifDefined(isLink ? undefined : this.pressed)}"
439
443
  data-notification="${ifDefined(notification)}"
440
444
  disabled="${this.disabled || nothing}"
441
445
  style=${styleMap(buttonStyles)}
@@ -487,6 +487,11 @@
487
487
  }
488
488
  }
489
489
 
490
+ // Lift the focused button so later siblings don't paint over its focus ring
491
+ :host([data-zn-button-group__button]:focus-within) {
492
+ z-index: 1;
493
+ }
494
+
490
495
  :host([data-zn-button-group__button--first]:not([data-zn-button-group__button--last])) .button {
491
496
  border-radius: 5px 0 0 5px !important;
492
497
  border-right: 0 !important;
@@ -29,4 +29,14 @@ describe('<zn-button>', () => {
29
29
  expect(el.color).to.equal('default');
30
30
  });
31
31
 
32
+ it('forwards aria-pressed to the inner button', async () => {
33
+ const el = await fixture<ZnButton>(html`<zn-button icon="sun" label="Toggle" aria-pressed="true"></zn-button>`);
34
+ const base = el.shadowRoot!.querySelector('[part~="base"]')!;
35
+ expect(base.getAttribute('aria-pressed')).to.equal('true');
36
+
37
+ el.setAttribute('aria-pressed', 'false');
38
+ await el.updateComplete;
39
+ expect(base.getAttribute('aria-pressed')).to.equal('false');
40
+ });
41
+
32
42
  });
@@ -43,7 +43,7 @@ type ColorOption = 'default' | 'primary' | 'secondary' | 'error' | 'info' | 'suc
43
43
  * @csspart control--indeterminate - Matches the control part when the checkbox is indeterminate.
44
44
  * @csspart checked-icon - The checked icon, an `<zn-icon>` element.
45
45
  * @csspart unchecked-icon - The unchecked icon, an `<zn-icon>` element.
46
- * @csspart indeterminate-icon - The indeterminate icon, an `<zn-icon>` element.
46
+ * @csspart indeterminate-icon - The indeterminate icon, an `<svg>` element.
47
47
  * @csspart image-container - The wrapper around the built-in image or image slot.
48
48
  * @csspart image - The built-in image.
49
49
  * @csspart card-title - The title inside a selection card.
@@ -404,11 +404,15 @@ export default class ZnCheckbox extends ZincElement implements ZincFormControl {
404
404
 
405
405
  ${!this.checked && this.indeterminate
406
406
  ? html`
407
- <zn-icon
408
- part="indeterminate-icon"
409
- class="checkbox__indeterminate-icon"
410
- size="16"
411
- src="check_indeterminate_small"></zn-icon>`
407
+ <svg viewBox="0 0 24 24"
408
+ fill="none"
409
+ stroke="currentColor"
410
+ stroke-width="4"
411
+ stroke-linecap="round"
412
+ part="indeterminate-icon"
413
+ class="checkbox__indeterminate-icon">
414
+ <line x1="5" y1="12" x2="19" y2="12"></line>
415
+ </svg>`
412
416
  : ''}
413
417
  </span>
414
418
 
@@ -28,13 +28,13 @@
28
28
  --checkbox-color: var(--zn-color-primary-600);
29
29
  --checkbox-color-hover: var(--zn-color-primary-500);
30
30
  --checkbox-icon-color: var(--zn-color-neutral-0);
31
- --checkbox-border-color: var(--zn-input-border-color);
31
+ --checkbox-border-color: var(--zn-checkbox-border-color, var(--zn-input-border-color));
32
32
  --checkbox-bg-color: var(--zn-input-background-color);
33
33
 
34
34
  &.checkbox--default {
35
35
  --checkbox-color: var(--zn-color-primary-600);
36
36
  --checkbox-color-hover: var(--zn-color-primary-500);
37
- --checkbox-border-color: var(--zn-input-border-color);
37
+ --checkbox-border-color: var(--zn-checkbox-border-color, var(--zn-input-border-color));
38
38
  }
39
39
 
40
40
  &.checkbox--primary {
@@ -131,12 +131,8 @@
131
131
  }
132
132
 
133
133
  .checkbox__indeterminate-icon {
134
- --icon-size: var(--toggle-size);
135
- --icon-color: var(--checkbox-icon-color);
136
-
137
- display: inline-flex;
138
- width: var(--toggle-size);
139
- height: var(--toggle-size);
134
+ height: max(16px, 70%);
135
+ color: var(--checkbox-icon-color);
140
136
  }
141
137
 
142
138
  .svg-icon {
@@ -4,7 +4,6 @@ import {HasSlotController} from "../../internal/slot";
4
4
  import {html, unsafeCSS} from 'lit';
5
5
  import {MutationController} from '@lit-labs/observers/mutation-controller.js';
6
6
  import {property, queryAssignedNodes, queryAsync, state} from 'lit/decorators.js';
7
- import {unsafeHTML} from 'lit-html/directives/unsafe-html.js';
8
7
  import ZincElement from "../../internal/zinc-element";
9
8
  import type {PropertyValues} from 'lit';
10
9
  import type ZnTile from "../tile";
@@ -280,7 +279,7 @@ export default class ContentBlock extends ZincElement {
280
279
  'text-section--text': section.type === 'text',
281
280
  'hidden': section.type === 'reply'
282
281
  })}>
283
- ${section.lines.map((line) => html`${unsafeHTML(line)}<br>`)}
282
+ ${section.lines.map((line) => html`${line}<br>`)}
284
283
  </div>
285
284
  `)}
286
285
  </div>
@@ -375,7 +374,7 @@ export default class ContentBlock extends ZincElement {
375
374
  const textRows: TextRow[] = [];
376
375
 
377
376
  if (textContent) {
378
- const text = textContent.innerText;
377
+ const text = textContent.innerText.replace(/<br\s*\/?>/gi, '\n');
379
378
  const rows = text.split('\n');
380
379
  let previousType: TextRow['type'] | null = null;
381
380
  let forceReply = false;