@kubex/zinc 1.0.25 → 1.0.99
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.
- package/.claude/project.md +556 -0
- package/.github/workflows/js_build_and_deploy.yaml +9 -10
- package/dist/custom-elements.json +13575 -8856
- package/dist/vscode.html-custom-data.json +583 -48
- package/dist/web-types.json +1441 -181
- package/dist/zn.d.ts +1645 -660
- package/dist/zn.min.css +1 -1
- package/dist/zn.min.js +1412 -893
- package/docs/_utilities/code-previews.cjs +10 -1
- package/docs/assets/scripts/docs.js +42 -18
- package/docs/data/data-table.json +229 -66
- package/docs/data/empty.json +6 -0
- package/docs/data/products-table.json +41 -193
- package/docs/pages/components/action-bar.md +121 -6
- package/docs/pages/components/alert.md +118 -15
- package/docs/pages/components/animated-button.md +299 -0
- package/docs/pages/components/audio-select.md +534 -0
- package/docs/pages/components/bulk-actions.md +79 -5
- package/docs/pages/components/button-group.md +235 -27
- package/docs/pages/components/button.md +139 -1
- package/docs/pages/components/chart.md +365 -9
- package/docs/pages/components/checkbox.md +387 -58
- package/docs/pages/components/chip.md +253 -33
- package/docs/pages/components/collapsible.md +393 -46
- package/docs/pages/components/cols.md +152 -30
- package/docs/pages/components/confirm.md +182 -16
- package/docs/pages/components/copy-button.md +169 -6
- package/docs/pages/components/data-select.md +194 -15
- package/docs/pages/components/data-table-filter.md +96 -5
- package/docs/pages/components/data-table-search.md +451 -0
- package/docs/pages/components/data-table-sort.md +66 -5
- package/docs/pages/components/data-table.md +727 -66
- package/docs/pages/components/datepicker.md +402 -7
- package/docs/pages/components/defined-label.md +120 -5
- package/docs/pages/components/dialog.md +339 -59
- package/docs/pages/components/dropdown.md +366 -11
- package/docs/pages/components/editor.md +604 -7
- package/docs/pages/components/empty-state.md +315 -16
- package/docs/pages/components/expanding-action.md +212 -28
- package/docs/pages/components/file.md +421 -12
- package/docs/pages/components/filter-container.md +158 -5
- package/docs/pages/components/filter-wrapper.md +167 -6
- package/docs/pages/components/form-group.md +383 -6
- package/docs/pages/components/hover-container.md +237 -6
- package/docs/pages/components/icon-picker.md +121 -0
- package/docs/pages/components/icon.md +454 -48
- package/docs/pages/components/inline-edit.md +787 -19
- package/docs/pages/components/input-group.md +207 -13
- package/docs/pages/components/input.md +194 -0
- package/docs/pages/components/item.md +18 -0
- package/docs/pages/components/key-container.md +115 -0
- package/docs/pages/components/key.md +101 -0
- package/docs/pages/components/menu.md +512 -6
- package/docs/pages/components/note.md +239 -36
- package/docs/pages/components/opt-group.md +107 -0
- package/docs/pages/components/pagination.md +332 -6
- package/docs/pages/components/pane.md +222 -6
- package/docs/pages/components/panel.md +213 -26
- package/docs/pages/components/popup.md +1354 -6
- package/docs/pages/components/priority-list.md +233 -0
- package/docs/pages/components/progress-bar.md +387 -6
- package/docs/pages/components/radio-group.md +242 -5
- package/docs/pages/components/radio.md +474 -6
- package/docs/pages/components/rating.md +331 -7
- package/docs/pages/components/reveal.md +524 -6
- package/docs/pages/components/scroll-container.md +552 -6
- package/docs/pages/components/select.md +762 -160
- package/docs/pages/components/skeleton.md +473 -30
- package/docs/pages/components/slideout.md +261 -5
- package/docs/pages/components/sp.md +99 -41
- package/docs/pages/components/split-button.md +347 -9
- package/docs/pages/components/split-pane.md +445 -6
- package/docs/pages/components/stat.md +549 -9
- package/docs/pages/components/status-indicator.md +230 -1
- package/docs/pages/components/stepper.md +563 -6
- package/docs/pages/components/tabs.md +439 -13
- package/docs/pages/components/textarea.md +415 -17
- package/docs/pages/components/tile.md +385 -26
- package/docs/pages/components/toggle.md +424 -6
- package/docs/pages/components/tooltip.md +367 -0
- package/docs/pages/components/translation-group.md +210 -0
- package/docs/pages/components/translations.md +319 -19
- package/docs/pages/components/vertical-stepper.md +401 -8
- package/docs/pages/components/well.md +300 -3
- package/docs/pages/getting-started/form-controls.md +162 -0
- package/docs/pages/index.md +116 -15
- package/package.json +5 -6
- package/scss/_global-spacing.scss +4 -0
- package/scss/_root.scss +2 -2
- package/scss/boot.scss +19 -0
- package/scss/shared/layout.scss +5 -0
- package/scss/themes/_light.scss +3 -3
- package/src/components/alert/alert.scss +1 -0
- package/src/components/animated-button/README.md +306 -0
- package/src/components/animated-button/animated-button.component.ts +229 -0
- package/src/components/animated-button/animated-button.scss +228 -0
- package/src/components/animated-button/animated-button.test.ts +143 -0
- package/src/components/animated-button/index.ts +12 -0
- package/src/components/button/button.component.ts +5 -0
- package/src/components/button-group/button-group.component.ts +25 -13
- package/src/components/button-group/button-group.scss +6 -0
- package/src/components/checkbox/checkbox.component.ts +4 -0
- package/src/components/checkbox/checkbox.scss +7 -4
- package/src/components/checkbox-group/checkbox-group.scss +7 -0
- package/src/components/chip/chip.component.ts +7 -2
- package/src/components/chip/chip.scss +16 -2
- package/src/components/collapsible/collapsible.component.ts +27 -20
- package/src/components/cols/cols.component.ts +14 -2
- package/src/components/cols/cols.scss +6 -12
- package/src/components/confirm/confirm.component.ts +7 -0
- package/src/components/copy-button/copy-button.component.ts +12 -11
- package/src/components/data-select/data-select.component.ts +215 -44
- package/src/components/data-select/data-select.scss +66 -6
- package/src/components/data-select/providers/currency-data-provider.ts +20 -6
- package/src/components/data-select/providers/provider.ts +1 -0
- package/src/components/data-select/providers/us-state-data-provider.ts +68 -0
- package/src/components/data-table/data-table.component.ts +81 -22
- package/src/components/data-table-search/data-table-search.component.ts +184 -0
- package/src/components/data-table-search/data-table-search.scss +17 -0
- package/src/components/data-table-search/data-table-search.test.ts +11 -0
- package/src/components/data-table-search/index.ts +12 -0
- package/src/components/datepicker/datepicker.component.ts +347 -13
- package/src/components/dialog/dialog.component.ts +1 -1
- package/src/components/empty-state/empty-state.scss +6 -1
- package/src/components/header/header.scss +3 -3
- package/src/components/icon/icon.component.ts +23 -1
- package/src/components/icon/icon.scss +23 -0
- package/src/components/icon-picker/brand-icons.ts +24 -0
- package/src/components/icon-picker/icon-picker.component.ts +407 -0
- package/src/components/icon-picker/icon-picker.scss +205 -0
- package/src/components/icon-picker/index.ts +12 -0
- package/src/components/icon-picker/line-icons.ts +612 -0
- package/src/components/icon-picker/material-icons.ts +14543 -0
- package/src/components/inline-edit/inline-edit.component.ts +190 -46
- package/src/components/inline-edit/inline-edit.scss +29 -0
- package/src/components/inline-edit/inline-edit.test.ts +314 -1
- package/src/components/input/input.component.ts +324 -5
- package/src/components/input/input.scss +87 -0
- package/src/components/input-group/input-group.component.ts +28 -7
- package/src/components/input-group/input-group.scss +48 -10
- package/src/components/item/item.component.ts +24 -3
- package/src/components/item/item.scss +18 -0
- package/src/components/key/index.ts +12 -0
- package/src/components/key/key.component.ts +47 -0
- package/src/components/key/key.scss +38 -0
- package/src/components/key-container/index.ts +12 -0
- package/src/components/key-container/key-container.component.ts +142 -0
- package/src/components/key-container/key-container.scss +33 -0
- package/src/components/menu-item/menu-item.component.ts +20 -0
- package/src/components/menu-item/menu-item.scss +69 -2
- package/src/components/navbar/navbar.component.ts +103 -11
- package/src/components/navbar/navbar.scss +6 -1
- package/src/components/opt-group/index.ts +12 -0
- package/src/components/opt-group/opt-group.component.ts +74 -0
- package/src/components/opt-group/opt-group.scss +37 -0
- package/src/components/opt-group/opt-group.test.ts +27 -0
- package/src/components/option/option.component.ts +1 -16
- package/src/components/option/option.scss +4 -0
- package/src/components/panel/panel.component.ts +10 -8
- package/src/components/panel/panel.scss +20 -0
- package/src/components/priority-list/index.ts +12 -0
- package/src/components/priority-list/priority-list.component.ts +611 -0
- package/src/components/priority-list/priority-list.scss +185 -0
- package/src/components/priority-list/priority-list.test.ts +139 -0
- package/src/components/progress-bar/progress-bar.component.ts +22 -16
- package/src/components/radio/radio.scss +10 -3
- package/src/components/select/select.component.ts +812 -72
- package/src/components/select/select.scss +108 -2
- package/src/components/select/select.test.ts +147 -2
- package/src/components/settings-container/settings-container.component.ts +44 -19
- package/src/components/settings-container/settings-container.scss +1 -1
- package/src/components/skeleton/skeleton.component.ts +6 -1
- package/src/components/slideout/slideout.scss +8 -3
- package/src/components/sp/sp.component.ts +3 -1
- package/src/components/sp/sp.scss +19 -0
- package/src/components/stepper/stepper.component.ts +16 -10
- package/src/components/textarea/textarea.scss +0 -4
- package/src/components/tile/tile.component.ts +12 -3
- package/src/components/tile/tile.scss +1 -1
- package/src/components/timer/timer.component.ts +15 -2
- package/src/components/toggle/toggle.component.ts +29 -26
- package/src/components/toggle/toggle.scss +13 -1
- package/src/components/translation-group/index.ts +12 -0
- package/src/components/translation-group/translation-group.component.ts +207 -0
- package/src/components/translation-group/translation-group.scss +8 -0
- package/src/components/translations/translations.component.ts +90 -44
- package/src/components/translations/translations.scss +4 -0
- package/src/components/vertical-stepper/vertical-stepper.component.ts +14 -9
- package/src/events/events.ts +12 -7
- package/src/events/zn-language-change.ts +7 -0
- package/src/events/zn-purchase.ts +11 -0
- package/src/events/zn-redirect.ts +7 -0
- package/src/events/zn-reorder.ts +7 -0
- package/src/events/zn-search-change.ts +11 -0
- package/src/events/zn-submit.ts +1 -1
- package/src/form-control.scss +4 -0
- package/src/internal/form-navigation.ts +510 -0
- package/src/internal/form.ts +6 -0
- package/src/zinc.ts +91 -83
|
@@ -2,12 +2,18 @@ import {classMap} from "lit/directives/class-map.js";
|
|
|
2
2
|
import {type CSSResultGroup, html, type PropertyValues, unsafeCSS} from 'lit';
|
|
3
3
|
import {ifDefined} from "lit/directives/if-defined.js";
|
|
4
4
|
import {property} from 'lit/decorators.js';
|
|
5
|
+
import {Store} from "../../internal/storage";
|
|
5
6
|
import ZincElement from '../../internal/zinc-element';
|
|
6
7
|
import ZnDropdown from "../dropdown";
|
|
7
8
|
import type {ZnMenuSelectEvent} from "../../events/zn-menu-select";
|
|
8
9
|
|
|
9
10
|
import styles from './navbar.scss';
|
|
10
11
|
|
|
12
|
+
interface StoredTab {
|
|
13
|
+
uri: string;
|
|
14
|
+
title: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
11
17
|
/**
|
|
12
18
|
* @summary Short summary of the component's intended use.
|
|
13
19
|
* @documentation https://zinc.style/components/navbar
|
|
@@ -44,6 +50,11 @@ export default class ZnNavbar extends ZincElement {
|
|
|
44
50
|
@property({attribute: 'manual-add-items', type: Boolean}) manualAddItems = false;
|
|
45
51
|
@property({type: Boolean}) isolated = false;
|
|
46
52
|
|
|
53
|
+
@property({attribute: 'master-id', reflect: true}) masterId: string;
|
|
54
|
+
@property({attribute: 'store-key', type: String}) storeKey: string = '';
|
|
55
|
+
@property({attribute: 'store-ttl', type: Number, reflect: true}) storeTtl = 0;
|
|
56
|
+
@property({attribute: 'local-storage', type: Boolean, reflect: true}) localStorage: boolean;
|
|
57
|
+
|
|
47
58
|
private _preItems: NodeListOf<Element>;
|
|
48
59
|
private _postItems: NodeListOf<Element>;
|
|
49
60
|
@property()
|
|
@@ -59,6 +70,8 @@ export default class ZnNavbar extends ZincElement {
|
|
|
59
70
|
private _expandableMargin: number = 0;
|
|
60
71
|
private _totalItemWidth: number = 0;
|
|
61
72
|
|
|
73
|
+
protected _store: Store;
|
|
74
|
+
|
|
62
75
|
appendItem(item: Element) {
|
|
63
76
|
this._appended = this._appended || [];
|
|
64
77
|
this._appended.push(item);
|
|
@@ -72,6 +85,16 @@ export default class ZnNavbar extends ZincElement {
|
|
|
72
85
|
|
|
73
86
|
this.resizeObserver = new ResizeObserver(this.handleResize.bind(this));
|
|
74
87
|
this.resizeObserver.observe(this as HTMLElement); // Observe the parent node
|
|
88
|
+
|
|
89
|
+
if (!this.masterId) {
|
|
90
|
+
this.masterId = this.storeKey || Math.floor(Math.random() * 1000000).toString();
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (this.storeKey && this.storeTtl === 0) {
|
|
94
|
+
this.storeTtl = 300;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
this._store = new Store(this.localStorage ? window.localStorage : window.sessionStorage, "znnav:", this.storeTtl);
|
|
75
98
|
}
|
|
76
99
|
|
|
77
100
|
|
|
@@ -92,7 +115,7 @@ export default class ZnNavbar extends ZincElement {
|
|
|
92
115
|
let parent = this.parentElement;
|
|
93
116
|
let availableWidth = this.offsetWidth || parent?.offsetWidth || 0;
|
|
94
117
|
|
|
95
|
-
// Needs to grab the first available width that is
|
|
118
|
+
// Needs to grab the first available width that is 0
|
|
96
119
|
// This is to avoid issues with the parent/navbar not being visible
|
|
97
120
|
while (availableWidth === 0 && parent?.parentElement) {
|
|
98
121
|
parent = parent.parentElement;
|
|
@@ -129,7 +152,7 @@ export default class ZnNavbar extends ZincElement {
|
|
|
129
152
|
this._navItems?.classList.toggle('has-hidden', hasHidden && hideRemaining)
|
|
130
153
|
}
|
|
131
154
|
|
|
132
|
-
public addItem(item: Element): void {
|
|
155
|
+
public addItem(item: Element, persist: boolean = true): void {
|
|
133
156
|
const tabUri = item.getAttribute('tab-uri');
|
|
134
157
|
if (typeof tabUri !== 'string' || this._openedTabs.includes(tabUri)) {
|
|
135
158
|
return;
|
|
@@ -137,8 +160,15 @@ export default class ZnNavbar extends ZincElement {
|
|
|
137
160
|
this._openedTabs.push(tabUri);
|
|
138
161
|
const ul = this.shadowRoot?.querySelector('ul');
|
|
139
162
|
const dropdown = this.shadowRoot?.querySelector('[id="dropdown-item"]');
|
|
140
|
-
|
|
141
|
-
|
|
163
|
+
|
|
164
|
+
if (persist && dropdown) {
|
|
165
|
+
dropdown.querySelector('zn-dropdown')?.hide();
|
|
166
|
+
this._saveTabToStorage({
|
|
167
|
+
uri: tabUri,
|
|
168
|
+
title: (item as HTMLElement).innerText
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
142
172
|
if (dropdown) {
|
|
143
173
|
ul?.insertBefore(item, dropdown);
|
|
144
174
|
} else {
|
|
@@ -159,8 +189,21 @@ export default class ZnNavbar extends ZincElement {
|
|
|
159
189
|
if (this._navItems) {
|
|
160
190
|
const computed = getComputedStyle(this._navItems);
|
|
161
191
|
this._navItemsGap = parseInt(computed.columnGap);
|
|
192
|
+
|
|
193
|
+
this._navItems.addEventListener('click', (e) => {
|
|
194
|
+
const target = (e.target as HTMLElement).closest('li[tab-uri]');
|
|
195
|
+
if (target && this.storeKey) {
|
|
196
|
+
const uri = target.getAttribute('tab-uri');
|
|
197
|
+
if (uri) {
|
|
198
|
+
this._store.set(this.storeKey + ':active', uri);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
});
|
|
162
202
|
}
|
|
163
203
|
|
|
204
|
+
// Load persisted tabs before calculating widths
|
|
205
|
+
this._loadStoredTabs();
|
|
206
|
+
|
|
164
207
|
setTimeout(() => {
|
|
165
208
|
const items = this._navItems?.querySelectorAll('li') || [];
|
|
166
209
|
for (const item of items) {
|
|
@@ -182,7 +225,7 @@ export default class ZnNavbar extends ZincElement {
|
|
|
182
225
|
const li = document.createElement('li');
|
|
183
226
|
li.setAttribute('tab-uri', (e.detail.element as HTMLElement).getAttribute('data-path')!);
|
|
184
227
|
li.innerText = e.detail.value;
|
|
185
|
-
this.addItem(li);
|
|
228
|
+
this.addItem(li, true);
|
|
186
229
|
setTimeout(() => {
|
|
187
230
|
li.click();
|
|
188
231
|
}, 300);
|
|
@@ -192,8 +235,55 @@ export default class ZnNavbar extends ZincElement {
|
|
|
192
235
|
}
|
|
193
236
|
}
|
|
194
237
|
|
|
195
|
-
|
|
196
|
-
|
|
238
|
+
private _loadStoredTabs() {
|
|
239
|
+
if (!this.storeKey || !this._store) return;
|
|
240
|
+
|
|
241
|
+
const storedData = this._store.get(this.storeKey);
|
|
242
|
+
const activeUri = this._store.get(this.storeKey + ':active');
|
|
243
|
+
if (storedData) {
|
|
244
|
+
try {
|
|
245
|
+
const tabs = JSON.parse(storedData) as StoredTab[];
|
|
246
|
+
if (Array.isArray(tabs)) {
|
|
247
|
+
tabs.forEach(tab => {
|
|
248
|
+
if (tab.uri && tab.title) {
|
|
249
|
+
const li = document.createElement('li');
|
|
250
|
+
li.setAttribute('tab-uri', tab.uri);
|
|
251
|
+
li.innerText = tab.title;
|
|
252
|
+
// Pass false to avoid re-saving what was just read
|
|
253
|
+
this.addItem(li, false);
|
|
254
|
+
|
|
255
|
+
if (activeUri && tab.uri === activeUri) {
|
|
256
|
+
setTimeout(() => {
|
|
257
|
+
li.click();
|
|
258
|
+
}, 100);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
} catch (e) {
|
|
264
|
+
console.warn('ZnNavbar: Failed to load stored tabs', e);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
private _saveTabToStorage(newTab: StoredTab) {
|
|
270
|
+
if (!this.storeKey || !this._store) return;
|
|
271
|
+
|
|
272
|
+
try {
|
|
273
|
+
const storedData = this._store.get(this.storeKey);
|
|
274
|
+
let tabs: StoredTab[] = [];
|
|
275
|
+
if (storedData) {
|
|
276
|
+
tabs = JSON.parse(storedData) as StoredTab[];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// Ensure we don't save duplicates
|
|
280
|
+
if (!tabs.some(t => t.uri === newTab.uri)) {
|
|
281
|
+
tabs.push(newTab);
|
|
282
|
+
this._store.set(this.storeKey, JSON.stringify(tabs));
|
|
283
|
+
}
|
|
284
|
+
} catch (e) {
|
|
285
|
+
console.warn('ZnNavbar: Failed to save tab', e);
|
|
286
|
+
}
|
|
197
287
|
}
|
|
198
288
|
|
|
199
289
|
private handleClick = (e: MouseEvent) => {
|
|
@@ -273,10 +363,12 @@ export default class ZnNavbar extends ZincElement {
|
|
|
273
363
|
${this._postItems}
|
|
274
364
|
${this._appended}
|
|
275
365
|
</ul>
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
366
|
+
${this._expanding?.length > 0 ? html`
|
|
367
|
+
<div class="expandables">
|
|
368
|
+
${this._expanding}
|
|
369
|
+
<slot name="expand"></slot>
|
|
370
|
+
</div>
|
|
371
|
+
` : ''}
|
|
280
372
|
</div>`;
|
|
281
373
|
}
|
|
282
374
|
}
|
|
@@ -25,6 +25,11 @@ ul.navbar {
|
|
|
25
25
|
padding-top: 0;
|
|
26
26
|
font-size: var(--zn-font-size-medium);
|
|
27
27
|
white-space: nowrap;
|
|
28
|
+
|
|
29
|
+
a {
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
color: inherit;
|
|
32
|
+
}
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
35
|
|
|
@@ -146,7 +151,7 @@ ul.navbar {
|
|
|
146
151
|
|
|
147
152
|
}
|
|
148
153
|
|
|
149
|
-
.navbar__container--stacked {
|
|
154
|
+
.navbar__container--stacked.navbar__container--icon-bar {
|
|
150
155
|
display: inline;
|
|
151
156
|
}
|
|
152
157
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import {type CSSResultGroup, html, unsafeCSS} from 'lit';
|
|
2
|
+
import {property} from 'lit/decorators.js';
|
|
3
|
+
import {watch} from '../../internal/watch';
|
|
4
|
+
import ZincElement from '../../internal/zinc-element';
|
|
5
|
+
|
|
6
|
+
import styles from './opt-group.scss';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @summary Groups options within a `<zn-select>` under a labeled header, similar to `<optgroup>` in native HTML.
|
|
10
|
+
* @documentation https://zinc.style/components/opt-group
|
|
11
|
+
* @status experimental
|
|
12
|
+
* @since 1.0
|
|
13
|
+
*
|
|
14
|
+
* @slot - The default slot for `<zn-option>` elements.
|
|
15
|
+
*
|
|
16
|
+
* @csspart base - The component's base wrapper.
|
|
17
|
+
* @csspart label - The group label element.
|
|
18
|
+
*/
|
|
19
|
+
export default class ZnOptGroup extends ZincElement {
|
|
20
|
+
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
21
|
+
|
|
22
|
+
/** The label for the opt-group, displayed as a non-selectable header above the grouped options. */
|
|
23
|
+
@property() label = '';
|
|
24
|
+
|
|
25
|
+
/** Disables all options within the group. */
|
|
26
|
+
@property({type: Boolean, reflect: true}) disabled = false;
|
|
27
|
+
|
|
28
|
+
connectedCallback() {
|
|
29
|
+
super.connectedCallback();
|
|
30
|
+
this.setAttribute('role', 'group');
|
|
31
|
+
this.setAttribute('aria-label', this.label);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@watch('label')
|
|
35
|
+
handleLabelChange() {
|
|
36
|
+
this.setAttribute('aria-label', this.label);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@watch('disabled')
|
|
40
|
+
handleDisabledChange() {
|
|
41
|
+
this.propagateDisabled();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** @internal - Updates visibility of the group based on whether any child options are visible. */
|
|
45
|
+
updateVisibility() {
|
|
46
|
+
const options = [...this.querySelectorAll('zn-option')];
|
|
47
|
+
this.hidden = options.length > 0 && options.every(option => option.hidden);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
render() {
|
|
51
|
+
return html`
|
|
52
|
+
<div part="base" class="opt-group">
|
|
53
|
+
<div part="label" class="opt-group__label" aria-hidden="true">
|
|
54
|
+
${this.label}
|
|
55
|
+
</div>
|
|
56
|
+
<div class="opt-group__options" role="none">
|
|
57
|
+
<slot @slotchange=${this.handleSlotChange}></slot>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
`;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private handleSlotChange() {
|
|
64
|
+
if (this.disabled) {
|
|
65
|
+
this.propagateDisabled();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private propagateDisabled() {
|
|
70
|
+
this.querySelectorAll('zn-option').forEach(option => {
|
|
71
|
+
option.disabled = this.disabled;
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use "../../wc";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
:host([hidden]) {
|
|
8
|
+
display: none !important;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.opt-group__label {
|
|
12
|
+
font-family: var(--zn-font-sans);
|
|
13
|
+
font-size: var(--zn-font-size-x-small);
|
|
14
|
+
font-weight: var(--zn-font-weight-semibold);
|
|
15
|
+
line-height: var(--zn-line-height-normal);
|
|
16
|
+
letter-spacing: var(--zn-letter-spacing-normal);
|
|
17
|
+
color: var(--zn-color-neutral-500);
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
padding-block: var(--zn-spacing-2x-small);
|
|
20
|
+
padding-inline: var(--zn-spacing-large);
|
|
21
|
+
user-select: none;
|
|
22
|
+
-webkit-user-select: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:host(:not(:first-of-type)) .opt-group__label {
|
|
26
|
+
border-block-start: solid var(--zn-panel-border-width) var(--zn-panel-border-color);
|
|
27
|
+
margin-block-start: var(--zn-spacing-x-small);
|
|
28
|
+
padding-block-start: var(--zn-spacing-small);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.opt-group__options {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
:host([disabled]) {
|
|
36
|
+
opacity: 0.5;
|
|
37
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import {expect, fixture, html} from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-opt-group>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html`
|
|
7
|
+
<zn-opt-group></zn-opt-group> `);
|
|
8
|
+
|
|
9
|
+
expect(el).to.exist;
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should display a label', async () => {
|
|
13
|
+
const el = await fixture(html`
|
|
14
|
+
<zn-opt-group label="Group Label"></zn-opt-group> `);
|
|
15
|
+
const label = el.shadowRoot!.querySelector('.opt-group__label');
|
|
16
|
+
|
|
17
|
+
expect(label).to.exist;
|
|
18
|
+
expect(label!.textContent!.trim()).to.equal('Group Label');
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should have role="group"', async () => {
|
|
22
|
+
const el = await fixture(html`
|
|
23
|
+
<zn-opt-group label="Test"></zn-opt-group> `);
|
|
24
|
+
|
|
25
|
+
expect(el.getAttribute('role')).to.equal('group');
|
|
26
|
+
});
|
|
27
|
+
});
|
|
@@ -43,8 +43,7 @@ export default class ZnOption extends ZincElement {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* The option's value. When selected, the containing form control will receive this value. The value must be unique
|
|
46
|
-
* from other options in the same group. Values may
|
|
47
|
-
* multiple values.
|
|
46
|
+
* from other options in the same group. Values may contain spaces when using JSON array syntax on the parent select.
|
|
48
47
|
*/
|
|
49
48
|
@property({ reflect: true }) value = '';
|
|
50
49
|
|
|
@@ -93,20 +92,6 @@ export default class ZnOption extends ZincElement {
|
|
|
93
92
|
this.setAttribute('aria-selected', this.selected ? 'true' : 'false');
|
|
94
93
|
}
|
|
95
94
|
|
|
96
|
-
@watch('value')
|
|
97
|
-
handleValueChange() {
|
|
98
|
-
// Ensure the value is a string. This ensures the next line doesn't error and allows framework users to pass numbers
|
|
99
|
-
// instead of requiring them to cast the value to a string.
|
|
100
|
-
if (typeof this.value !== 'string') {
|
|
101
|
-
this.value = String(this.value);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
if (this.value.includes(' ')) {
|
|
105
|
-
console.error(`Option values cannot include a space. All spaces have been replaced with underscores.`, this);
|
|
106
|
-
this.value = this.value.replace(/ /g, '_');
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
95
|
/** Returns a plain text label based on the option's content. */
|
|
111
96
|
getTextLabel() {
|
|
112
97
|
const nodes = this.childNodes;
|
|
@@ -8,18 +8,18 @@ import ZincElement from '../../internal/zinc-element';
|
|
|
8
8
|
import styles from './panel.scss';
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @summary
|
|
11
|
+
* @summary Panels are versatile containers that provide structure for organizing content with optional headers and footers.
|
|
12
12
|
* @documentation https://zinc.style/components/panel
|
|
13
13
|
* @status experimental
|
|
14
14
|
* @since 1.0
|
|
15
15
|
*
|
|
16
|
-
* @slot - The
|
|
17
|
-
* @slot actions -
|
|
18
|
-
* @slot footer -
|
|
16
|
+
* @slot - The panel's main content.
|
|
17
|
+
* @slot actions - Actions displayed in the panel header (buttons, chips, etc).
|
|
18
|
+
* @slot footer - Content displayed in the panel footer.
|
|
19
19
|
*
|
|
20
20
|
* @csspart base - The component's base wrapper.
|
|
21
21
|
*
|
|
22
|
-
* @cssproperty --
|
|
22
|
+
* @cssproperty --zn-panel-basis - The flex-basis of the panel. Can be set using the basis-px attribute.
|
|
23
23
|
*/
|
|
24
24
|
export default class ZnPanel extends ZincElement {
|
|
25
25
|
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
@@ -92,7 +92,7 @@ export default class ZnPanel extends ZincElement {
|
|
|
92
92
|
'panel--has-footer': hasFooterSlot,
|
|
93
93
|
'panel--has-header': hasHeader,
|
|
94
94
|
'panel--cosmic': this.cosmic,
|
|
95
|
-
'panel--shadow': this.shadow
|
|
95
|
+
'panel--shadow': this.shadow,
|
|
96
96
|
})}">
|
|
97
97
|
|
|
98
98
|
<div class="panel__inner">
|
|
@@ -109,8 +109,10 @@ export default class ZnPanel extends ZincElement {
|
|
|
109
109
|
<slot name="actions" slot="actions" class="panel__header__actions"></slot>` : null}
|
|
110
110
|
</zn-header>` : null}
|
|
111
111
|
|
|
112
|
-
<div class="
|
|
113
|
-
<
|
|
112
|
+
<div class="panel__content">
|
|
113
|
+
<div class="panel__body">
|
|
114
|
+
<slot></slot>
|
|
115
|
+
</div>
|
|
114
116
|
</div>
|
|
115
117
|
|
|
116
118
|
${hasFooterSlot ? html`
|
|
@@ -33,13 +33,32 @@
|
|
|
33
33
|
flex-grow: 1;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
&__content {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-grow: 1;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
position: relative;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
|
|
36
44
|
&__header {
|
|
37
45
|
padding: var(--zn-spacing-x-small) var(--zn-spacing-medium);
|
|
38
46
|
|
|
47
|
+
// background-color: rgba(var(--zn-panel-highlight), 0.6);
|
|
48
|
+
// border-bottom: 1px solid rgb(var(--zn-border-color));
|
|
49
|
+
|
|
39
50
|
&::part(base) {
|
|
40
51
|
border-bottom: 0;
|
|
41
52
|
}
|
|
42
53
|
|
|
54
|
+
&::part(header-caption) {
|
|
55
|
+
font-size: var(--zn-font-size-large);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&--inline {
|
|
59
|
+
border-bottom: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
43
62
|
&--underline {
|
|
44
63
|
border-bottom: 1px solid rgb(var(--zn-border-color));
|
|
45
64
|
}
|
|
@@ -144,4 +163,5 @@
|
|
|
144
163
|
&--shadow {
|
|
145
164
|
box-shadow: 0 6px 20px 10px rgba(0, 0, 0, 0.25);
|
|
146
165
|
}
|
|
166
|
+
|
|
147
167
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import ZnPriorityList from './priority-list.component';
|
|
2
|
+
|
|
3
|
+
export * from './priority-list.component';
|
|
4
|
+
export default ZnPriorityList;
|
|
5
|
+
|
|
6
|
+
ZnPriorityList.define('zn-priority-list');
|
|
7
|
+
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'zn-priority-list': ZnPriorityList;
|
|
11
|
+
}
|
|
12
|
+
}
|