@kubex/zinc 1.0.9 → 1.0.10

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 (28) hide show
  1. package/dist/custom-elements.json +282 -83
  2. package/dist/vscode.html-custom-data.json +25 -13
  3. package/dist/web-types.json +84 -27
  4. package/dist/zn.d.ts +36 -2
  5. package/dist/zn.min.js +260 -243
  6. package/docs/pages/components/dropdown.md +6 -1
  7. package/docs/pages/components/table.md +1 -1
  8. package/package.json +1 -1
  9. package/src/components/button-menu/button-menu.component.ts +1 -0
  10. package/src/components/editor/editor.component.ts +110 -55
  11. package/src/components/editor/modules/context-menu/context-menu-component.ts +1 -0
  12. package/src/components/editor/modules/context-menu/context-menu.scss +1 -1
  13. package/src/components/editor/modules/context-menu/context-menu.ts +58 -26
  14. package/src/components/editor/modules/context-menu/quick-action/quick-action.component.ts +1 -0
  15. package/src/components/editor/modules/toolbar/toolbar.component.ts +61 -33
  16. package/src/components/editor/modules/toolbar/toolbar.ts +19 -4
  17. package/src/components/header/header.scss +1 -0
  18. package/src/components/menu/menu.component.ts +2 -1
  19. package/src/components/menu-item/menu-item.component.ts +4 -0
  20. package/src/components/note/note.component.ts +2 -25
  21. package/src/components/note/note.scss +0 -7
  22. package/src/components/order-table/order-table.scss +16 -10
  23. package/src/components/panel/panel.component.ts +4 -2
  24. package/src/components/panel/panel.scss +4 -0
  25. package/src/components/popup/popup.component.ts +11 -21
  26. package/src/components/settings-container/settings-container.component.ts +21 -15
  27. package/src/components/settings-container/settings-container.scss +5 -4
  28. package/src/components/tooltip/tooltip.component.ts +7 -7
@@ -76,6 +76,8 @@ export default class ZnMenuItem extends ZincElement {
76
76
 
77
77
  @property({attribute: 'gaid'}) gaid: string;
78
78
 
79
+ @property({type: Boolean, reflect: true}) confirm = false;
80
+
79
81
  private readonly localize = new LocalizeController(this);
80
82
  private readonly hasSlotController = new HasSlotController(this, 'submenu');
81
83
  private submenuController: SubmenuController = new SubmenuController(this, this.hasSlotController, this.localize);
@@ -118,6 +120,8 @@ export default class ZnMenuItem extends ZincElement {
118
120
  if (!this.isSubmenu()) {
119
121
  const composedPath = event.composedPath();
120
122
  const closestMenu: Element | null = composedPath.find((el: Element) => el?.getAttribute?.('role') === 'menu') as Element;
123
+ if (this.confirm) return;
124
+
121
125
  (closestMenu?.closest('zn-dropdown') as ZnDropdown | null)?.hide();
122
126
  this.emit('zn-menu-select', {detail: {value: this.value, element: this}});
123
127
  }
@@ -38,49 +38,26 @@ export default class ZnNote extends ZincElement {
38
38
  // Internal state: whether the body is currently expanded
39
39
  @state() private expanded = false;
40
40
 
41
- // Internal state: whether the content actually overflows the clamp
42
- @state() private _isOverflowing = false;
43
-
44
41
  private _toggleExpand = () => {
45
42
  this.expanded = !this.expanded;
46
- // re-evaluate overflow after toggle (in case of dynamic content)
47
43
  this.updateComplete.then(() => this._measureOverflow());
48
44
  }
49
45
 
50
46
  private _measureOverflow() {
51
- // Only relevant when collapseAtLines is set and not expanded
52
47
  const container = this.shadowRoot?.querySelector('.note__body-container') as HTMLElement | null;
53
- if (!container) {
54
- this._isOverflowing = false;
55
- return;
56
- }
57
-
58
- if (this.collapseAtLines <= 0) {
59
- this._isOverflowing = false;
48
+ if (!container || this.collapseAtLines <= 0) {
60
49
  return;
61
50
  }
62
51
 
63
- // Temporarily ensure clamped styles are applied to measure
64
52
  container.style.setProperty('--note-collapse-lines', String(this.collapseAtLines));
65
53
  container.classList.toggle('note__body--clamped', !this.expanded);
66
-
67
- // element starts hidden, cannot measure
68
- if (container.clientHeight === 0) {
69
- this._isOverflowing = false;
70
- return;
71
- }
72
-
73
- // Measure overflow
74
- this._isOverflowing = container.scrollHeight > container.clientHeight + 1; // +1 for rounding errors
75
54
  }
76
55
 
77
56
  protected firstUpdated() {
78
- // Initial measurement of overflow
79
57
  this._measureOverflow();
80
58
  }
81
59
 
82
60
  protected updated() {
83
- // Re-measure on any update to catch slot/content changes
84
61
  this._measureOverflow();
85
62
  }
86
63
 
@@ -110,7 +87,7 @@ export default class ZnNote extends ZincElement {
110
87
  })}" style="--note-collapse-lines: ${this.collapseAtLines}">
111
88
  <slot class="note__body"></slot>
112
89
  </div>
113
- ${this.collapseAtLines > 0 && this._isOverflowing ? html`
90
+ ${this.collapseAtLines > 0 ? html`
114
91
  <div class="note__toggle">
115
92
  <zn-button color="transparent"
116
93
  size="content"
@@ -51,13 +51,6 @@ $colors: (
51
51
  display: block;
52
52
  }
53
53
 
54
- &__body--clamped {
55
- display: -webkit-box;
56
- -webkit-box-orient: vertical;
57
- -webkit-line-clamp: var(--note-collapse-lines, 0);
58
- overflow: hidden;
59
- }
60
-
61
54
  &__toggle {
62
55
  margin-top: var(--zn-spacing-2x-small);
63
56
  }
@@ -2,13 +2,16 @@
2
2
 
3
3
 
4
4
  .table {
5
- display: table;
5
+ display: flex;
6
+ flex-direction: column;
6
7
  width: 100%;
7
8
  }
8
9
 
9
10
 
10
11
  .header {
11
- display: table-header-group;
12
+ display: flex;
13
+ align-items: center;
14
+ width: 100%;
12
15
  }
13
16
 
14
17
  .header-item, .row-item {
@@ -32,11 +35,17 @@
32
35
  }
33
36
 
34
37
  @include wc.container-query(md) {
35
- display: table-cell;
38
+ flex: 1;
36
39
  border-bottom: 1px solid rgb(var(--zn-border-color));
37
40
 
38
41
  &:first-child {
39
- width: 50%;
42
+ width: 35%;
43
+ flex-basis: 35%;
44
+ align-items: flex-start;
45
+
46
+ &.row-caption {
47
+ text-align: left;
48
+ }
40
49
  }
41
50
 
42
51
  &:last-child {
@@ -66,6 +75,7 @@
66
75
  font-size: 14px;
67
76
  font-weight: 600;
68
77
  color: rgb(var(--zn-text-heading));
78
+ white-space: nowrap;
69
79
  }
70
80
 
71
81
  .row-caption .content {
@@ -78,10 +88,8 @@
78
88
 
79
89
  .rows {
80
90
  width: 100%;
81
-
82
- @include wc.container-query(md) {
83
- display: table-row-group;
84
- }
91
+ display: flex;
92
+ flex-direction: column;
85
93
  }
86
94
 
87
95
  .row {
@@ -91,7 +99,6 @@
91
99
  width: 100%;
92
100
 
93
101
  @include wc.container-query(md) {
94
- display: table-row;
95
102
  border-bottom: none;
96
103
  }
97
104
  }
@@ -111,7 +118,6 @@
111
118
  width: 100%;
112
119
 
113
120
  @include wc.container-query(md) {
114
- display: table-row;
115
121
  border-bottom: none;
116
122
  }
117
123
  }
@@ -38,6 +38,7 @@ export default class ZnPanel extends ZincElement {
38
38
  @property({attribute: 'flush-y', type: Boolean}) flushY: boolean;
39
39
  @property({attribute: 'flush-footer', type: Boolean}) flushFooter: boolean;
40
40
  @property({type: Boolean}) transparent: boolean;
41
+ @property({type: Boolean}) shadow: boolean;
41
42
 
42
43
  protected firstUpdated(_changedProperties: PropertyValues) {
43
44
  super.firstUpdated(_changedProperties);
@@ -79,7 +80,7 @@ export default class ZnPanel extends ZincElement {
79
80
  const hasHeader = this.caption || hasActionSlot;
80
81
 
81
82
  return html`
82
- <div part="base" class="${classMap({
83
+ <div class="${classMap({
83
84
  panel: true,
84
85
  'panel--flush': this.flush || this.tabbed,
85
86
  'panel--flush-x': this.flushX,
@@ -90,7 +91,8 @@ export default class ZnPanel extends ZincElement {
90
91
  'panel--has-actions': hasActionSlot,
91
92
  'panel--has-footer': hasFooterSlot,
92
93
  'panel--has-header': hasHeader,
93
- 'panel--cosmic': this.cosmic
94
+ 'panel--cosmic': this.cosmic,
95
+ 'panel--shadow': this.shadow
94
96
  })}">
95
97
 
96
98
  <div class="panel__inner">
@@ -140,4 +140,8 @@
140
140
  &--cosmic {
141
141
  @include wc.cosmic-border();
142
142
  }
143
+
144
+ &--shadow {
145
+ box-shadow: 0 6px 20px 10px rgba(0, 0, 0, 0.25);
146
+ }
143
147
  }
@@ -1,22 +1,11 @@
1
- import {
2
- arrow,
3
- autoUpdate,
4
- computePosition,
5
- flip,
6
- offset,
7
- platform,
8
- shift,
9
- size
10
- } from '@floating-ui/dom';
1
+ import {arrow, autoUpdate, computePosition, flip, offset, platform, shift, size} from '@floating-ui/dom';
11
2
  import {classMap} from 'lit/directives/class-map.js';
12
3
  import {html, unsafeCSS} from 'lit';
13
4
  import {offsetParent} from 'composed-offset-position';
14
5
  import {property, query} from 'lit/decorators.js';
15
6
  import ZincElement from '../../internal/zinc-element';
16
7
  import type {CSSResultGroup} from 'lit';
17
- import type {
18
- MiddlewareData
19
- } from '@floating-ui/dom';
8
+ import type {MiddlewareData} from '@floating-ui/dom';
20
9
 
21
10
  import styles from './popup.scss';
22
11
 
@@ -210,7 +199,9 @@ export default class ZnPopup extends ZincElement {
210
199
 
211
200
  // Start the positioner after the first update
212
201
  await this.updateComplete;
213
- this.start();
202
+ if (this.active) {
203
+ this.start();
204
+ }
214
205
  }
215
206
 
216
207
  disconnectedCallback() {
@@ -260,7 +251,7 @@ export default class ZnPopup extends ZincElement {
260
251
  }
261
252
 
262
253
  // If the anchor is valid, start it up
263
- if (this.anchorEl) {
254
+ if (this.anchorEl && this.active) {
264
255
  this.start();
265
256
  }
266
257
  }
@@ -270,7 +261,6 @@ export default class ZnPopup extends ZincElement {
270
261
  if (!this.anchorEl) {
271
262
  return;
272
263
  }
273
-
274
264
  this.cleanup = autoUpdate(this.anchorEl, this.popup, () => {
275
265
  this.reposition();
276
266
  });
@@ -527,26 +517,26 @@ export default class ZnPopup extends ZincElement {
527
517
 
528
518
  render() {
529
519
  return html`
530
- <slot class="anchor" name="anchor" @slotchange=${this.handleAnchorChange}></slot>
520
+ <slot class="anchor" name="anchor" @slotchange="${this.handleAnchorChange}"></slot>
531
521
 
532
522
  <span
533
523
  part="hover-bridge"
534
- class=${classMap({
524
+ class="${classMap({
535
525
  'popup-hover-bridge': true,
536
526
  'popup-hover-bridge--visible': this.hoverBridge && this.active
537
- })}
527
+ })}"
538
528
  ></span>
539
529
 
540
530
  <div
541
531
  id="popup"
542
532
  part="popup"
543
533
  popover
544
- class=${classMap({
534
+ class="${classMap({
545
535
  popup: true,
546
536
  'popup--active': this.active,
547
537
  'popup--fixed': this.strategy === 'fixed',
548
538
  'popup--has-arrow': this.arrow
549
- })}
539
+ })}"
550
540
  >
551
541
  <slot></slot>
552
542
  ${this.arrow ? html`
@@ -202,25 +202,31 @@ export default class ZnSettingsContainer extends ZincElement {
202
202
  </div>
203
203
  <zn-dropdown placement="${placement}" class="${classMap({
204
204
  'setting-container__dropdown': true,
205
- 'setting-container__dropdown--top-end': this.position === 'top-end',
206
- 'setting-container__dropdown--top-start': this.position === 'top-start',
207
- 'setting-container__dropdown--bottom-end': this.position === 'bottom-end',
208
- 'setting-container__dropdown--bottom-start': this.position === 'bottom-start',
205
+ [`setting-container__dropdown--${this.position}`]: true,
209
206
  })}">
210
207
  <zn-icon class="setting-container__toggle-button" slot="trigger" size="24" src="settings" round></zn-icon>
211
- <div class="settings-container__dropdown-content">
212
- <slot name="filter" style="display: none;" @slotchange="${this.handleFiltersSlotChange}"></slot>
213
- ${this.filters.map(filter => html`
214
- <zn-checkbox class="settings-container__dropdown-item"
215
- data-attribute="${filter.attribute}"
216
- ?checked="${filter.checked}"
217
- @zn-change="${this.updateFilter}">
218
- ${filter.label}
219
- </zn-checkbox>
220
- `)}
221
- </div>
208
+ ${this.getDropdownContent()}
222
209
  </zn-dropdown>
223
210
  </div>
224
211
  `;
225
212
  }
213
+
214
+ private getDropdownContent() {
215
+ const hasDropdownContent = this.querySelector('[slot="dropdown-content"]');
216
+ if (hasDropdownContent) {
217
+ return html`
218
+ <slot name="dropdown-content"></slot>`;
219
+ }
220
+ return html`
221
+ <div class="settings-container__dropdown-content">
222
+ <slot name="filter" style="display: none;" @slotchange="${this.handleFiltersSlotChange}"></slot>
223
+ ${this.filters.map(filter => html`
224
+ <zn-checkbox class="settings-container__dropdown-item"
225
+ data-attribute="${filter.attribute}"
226
+ .checked=${filter.checked}
227
+ @zn-change=${this.updateFilter}>
228
+ ${filter.label}
229
+ </zn-checkbox>`)}
230
+ </div>`;
231
+ }
226
232
  }
@@ -31,7 +31,6 @@
31
31
  padding: 4px;
32
32
  background: rgba(var(--zn-panel, 0.8));
33
33
  box-shadow: var(--zn-shadow-small);
34
- transition: bottom 0.2s ease;
35
34
  opacity: 0.7;
36
35
  transition-duration: 0.3s;
37
36
  transition-property: opacity;
@@ -70,13 +69,15 @@
70
69
  opacity: 1;
71
70
  }
72
71
 
72
+ .setting-container__toggle-button::part(icon) {
73
+ rotate: 0deg;
74
+ transition: rotate 0.9s ease-in-out, color 0.9s ease-in-out;
75
+ }
76
+
73
77
  .setting-container__dropdown[open] .setting-container__toggle-button::part(icon), .setting-container__toggle-button:hover::part(icon) {
74
78
  color: rgb(var(--zn-primary));
75
79
  cursor: pointer;
76
- transition-duration: 0.9s;
77
- transition-property: rotate, color;
78
80
  rotate: 380deg;
79
- transition-timing-function: ease-in-out;
80
81
  }
81
82
 
82
83
  zn-button {
@@ -191,14 +191,14 @@ export default class ZnTooltip extends ZincElement {
191
191
  <zn-popup
192
192
  part="base"
193
193
  exportparts="popup:base__popup,arrow:base__arrow"
194
- class=${classMap({
194
+ class="${classMap({
195
195
  tooltip: true,
196
196
  'tooltip--open': this.open
197
- })}
198
- placement=${this.placement}
199
- distance=${this.distance}
200
- skidding=${this.skidding}
201
- strategy=${this.hoist ? 'fixed' : 'absolute'}
197
+ })}"
198
+ placement="${this.placement}"
199
+ distance="${this.distance}"
200
+ skidding="${this.skidding}"
201
+ strategy="${this.hoist ? 'fixed' : 'absolute'}"
202
202
  flip
203
203
  shift
204
204
  arrow
@@ -206,7 +206,7 @@ export default class ZnTooltip extends ZincElement {
206
206
  <slot slot="anchor"></slot>
207
207
  <div part="body" id="tooltip" class="tooltip__body"
208
208
  role="tooltip"
209
- aria-live=${this.open ? 'polite' : 'off'}
209
+ aria-live="${this.open ? 'polite' : 'off'}"
210
210
  aria-label="tooltip">
211
211
  <slot name="content">${this.content}</slot>
212
212
  </div>