@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
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
@use "../../wc";
|
|
2
|
+
@use "../../form-control";
|
|
3
|
+
|
|
4
|
+
:host {
|
|
5
|
+
display: block;
|
|
6
|
+
line-height: var(--zn-line-height-dense);
|
|
7
|
+
|
|
8
|
+
--zn-priority-list-item-gap: var(--zn-spacing-2x-small);
|
|
9
|
+
--zn-priority-list-item-padding: var(--zn-spacing-small) var(--zn-spacing-medium);
|
|
10
|
+
--zn-priority-list-handle-color: var(--zn-color-neutral-400);
|
|
11
|
+
--zn-priority-list-priority-color: var(--zn-color-neutral-600);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.form-control {
|
|
15
|
+
position: relative;
|
|
16
|
+
border: none;
|
|
17
|
+
padding: 0;
|
|
18
|
+
margin: 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.form-control__label {
|
|
22
|
+
padding: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.priority-list {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
gap: var(--zn-priority-list-item-gap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.priority-list--disabled {
|
|
32
|
+
opacity: 0.5;
|
|
33
|
+
pointer-events: none;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// During an active drag, animate items shifting into new positions
|
|
37
|
+
.priority-list--drag-active {
|
|
38
|
+
.priority-list__item {
|
|
39
|
+
transition: transform 200ms ease, opacity 200ms ease, box-shadow 200ms ease;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.priority-list__item {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
gap: var(--zn-spacing-small);
|
|
47
|
+
padding: var(--zn-priority-list-item-padding);
|
|
48
|
+
background: rgb(var(--zn-panel));
|
|
49
|
+
border: 1px solid rgb(var(--zn-border-color));
|
|
50
|
+
border-radius: var(--zn-border-radius-medium);
|
|
51
|
+
cursor: grab;
|
|
52
|
+
user-select: none;
|
|
53
|
+
-webkit-user-drag: element;
|
|
54
|
+
position: relative;
|
|
55
|
+
|
|
56
|
+
&:hover {
|
|
57
|
+
background: rgb(var(--zn-panel-hover, var(--zn-panel)));
|
|
58
|
+
border-color: rgb(var(--zn-color-primary-500));
|
|
59
|
+
|
|
60
|
+
.priority-list__handle {
|
|
61
|
+
color: rgb(var(--zn-color-primary-500));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&:focus-visible {
|
|
66
|
+
outline: 2px solid rgb(var(--zn-color-primary-500));
|
|
67
|
+
outline-offset: -1px;
|
|
68
|
+
border-color: rgb(var(--zn-color-primary-500));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&:active {
|
|
72
|
+
cursor: grabbing;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// The item currently being dragged — shown as a faded placeholder
|
|
77
|
+
.priority-list__item--dragging {
|
|
78
|
+
opacity: 0.3;
|
|
79
|
+
border-style: dashed;
|
|
80
|
+
border-color: rgb(var(--zn-color-primary-400));
|
|
81
|
+
background: rgb(var(--zn-color-primary-50, var(--zn-panel)));
|
|
82
|
+
box-shadow: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.priority-list__item--disabled {
|
|
86
|
+
cursor: not-allowed;
|
|
87
|
+
opacity: 0.6;
|
|
88
|
+
|
|
89
|
+
&:hover {
|
|
90
|
+
background: rgb(var(--zn-panel));
|
|
91
|
+
border-color: rgb(var(--zn-border-color));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.priority-list__handle {
|
|
96
|
+
display: flex;
|
|
97
|
+
align-items: center;
|
|
98
|
+
justify-content: center;
|
|
99
|
+
flex-shrink: 0;
|
|
100
|
+
color: var(--zn-priority-list-handle-color);
|
|
101
|
+
cursor: grab;
|
|
102
|
+
transition: color 150ms ease;
|
|
103
|
+
|
|
104
|
+
&:active {
|
|
105
|
+
cursor: grabbing;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.priority-list__priority {
|
|
110
|
+
display: flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
flex-shrink: 0;
|
|
114
|
+
min-width: 1.5em;
|
|
115
|
+
font-size: var(--zn-font-size-small);
|
|
116
|
+
font-weight: var(--zn-font-weight-semibold);
|
|
117
|
+
color: var(--zn-priority-list-priority-color);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.priority-list__content {
|
|
121
|
+
flex: 1;
|
|
122
|
+
min-width: 0;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
// Prevent slotted content from capturing its own drag events,
|
|
125
|
+
// which would override the item-level draggable behaviour
|
|
126
|
+
pointer-events: none;
|
|
127
|
+
|
|
128
|
+
::slotted(*) {
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
-webkit-user-drag: none;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.priority-list__actions {
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
gap: var(--zn-spacing-2x-small);
|
|
138
|
+
flex-shrink: 0;
|
|
139
|
+
// Re-enable pointer events so action buttons are clickable
|
|
140
|
+
pointer-events: auto;
|
|
141
|
+
|
|
142
|
+
::slotted(*) {
|
|
143
|
+
pointer-events: auto;
|
|
144
|
+
-webkit-user-drag: none;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Size variants
|
|
149
|
+
:host([size="small"]) {
|
|
150
|
+
.priority-list__item {
|
|
151
|
+
padding: var(--zn-spacing-2x-small) var(--zn-spacing-small);
|
|
152
|
+
font-size: var(--zn-font-size-small);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.priority-list__priority {
|
|
156
|
+
font-size: var(--zn-font-size-x-small);
|
|
157
|
+
min-width: 1.25em;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([size="large"]) {
|
|
162
|
+
.priority-list__item {
|
|
163
|
+
padding: var(--zn-spacing-medium) var(--zn-spacing-large);
|
|
164
|
+
font-size: var(--zn-font-size-medium);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.priority-list__priority {
|
|
168
|
+
font-size: var(--zn-font-size-medium);
|
|
169
|
+
min-width: 1.75em;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// The collector div that holds the default slot is hidden; items get
|
|
174
|
+
// reassigned to named slots once detected.
|
|
175
|
+
.priority-list__collector {
|
|
176
|
+
position: absolute;
|
|
177
|
+
width: 0;
|
|
178
|
+
height: 0;
|
|
179
|
+
overflow: hidden;
|
|
180
|
+
pointer-events: none;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.priority-list__hidden-inputs {
|
|
184
|
+
display: none;
|
|
185
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import '../../../dist/zn.min.js';
|
|
2
|
+
import {expect, fixture, html} from '@open-wc/testing';
|
|
3
|
+
|
|
4
|
+
describe('<zn-priority-list>', () => {
|
|
5
|
+
it('should render a component', async () => {
|
|
6
|
+
const el = await fixture(html`<zn-priority-list></zn-priority-list>`);
|
|
7
|
+
expect(el).to.exist;
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('should initialize order from slotted children', async () => {
|
|
11
|
+
const el = await fixture(html`
|
|
12
|
+
<zn-priority-list>
|
|
13
|
+
<div value="alpha">Alpha</div>
|
|
14
|
+
<div value="beta">Beta</div>
|
|
15
|
+
<div value="gamma">Gamma</div>
|
|
16
|
+
</zn-priority-list>
|
|
17
|
+
`) as any;
|
|
18
|
+
|
|
19
|
+
await el.updateComplete;
|
|
20
|
+
expect(el.value).to.deep.equal(['alpha', 'beta', 'gamma']);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should assign slot names to children based on value attribute', async () => {
|
|
24
|
+
const el = await fixture(html`
|
|
25
|
+
<zn-priority-list>
|
|
26
|
+
<div value="first">First</div>
|
|
27
|
+
<div value="second">Second</div>
|
|
28
|
+
</zn-priority-list>
|
|
29
|
+
`) as any;
|
|
30
|
+
|
|
31
|
+
await el.updateComplete;
|
|
32
|
+
const firstChild = el.querySelector('[value="first"]');
|
|
33
|
+
const secondChild = el.querySelector('[value="second"]');
|
|
34
|
+
expect(firstChild.getAttribute('slot')).to.equal('_item-first');
|
|
35
|
+
expect(secondChild.getAttribute('slot')).to.equal('_item-second');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should render priority numbers starting from priorityStart', async () => {
|
|
39
|
+
const el = await fixture(html`
|
|
40
|
+
<zn-priority-list priority-start="10">
|
|
41
|
+
<div value="a">A</div>
|
|
42
|
+
<div value="b">B</div>
|
|
43
|
+
</zn-priority-list>
|
|
44
|
+
`) as any;
|
|
45
|
+
|
|
46
|
+
await el.updateComplete;
|
|
47
|
+
const priorities = el.shadowRoot.querySelectorAll('.priority-list__priority');
|
|
48
|
+
expect(priorities[0].textContent.trim()).to.equal('10');
|
|
49
|
+
expect(priorities[1].textContent.trim()).to.equal('11');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should return correct priority map', async () => {
|
|
53
|
+
const el = await fixture(html`
|
|
54
|
+
<zn-priority-list>
|
|
55
|
+
<div value="x">X</div>
|
|
56
|
+
<div value="y">Y</div>
|
|
57
|
+
<div value="z">Z</div>
|
|
58
|
+
</zn-priority-list>
|
|
59
|
+
`) as any;
|
|
60
|
+
|
|
61
|
+
await el.updateComplete;
|
|
62
|
+
const map = el.getPriorityMap();
|
|
63
|
+
expect(map).to.deep.equal([
|
|
64
|
+
{key: 'x', priority: 1},
|
|
65
|
+
{key: 'y', priority: 2},
|
|
66
|
+
{key: 'z', priority: 3},
|
|
67
|
+
]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should generate hidden inputs for form submission', async () => {
|
|
71
|
+
const el = await fixture(html`
|
|
72
|
+
<zn-priority-list name="priority">
|
|
73
|
+
<div value="item1">Item 1</div>
|
|
74
|
+
<div value="item2">Item 2</div>
|
|
75
|
+
</zn-priority-list>
|
|
76
|
+
`) as any;
|
|
77
|
+
|
|
78
|
+
await el.updateComplete;
|
|
79
|
+
const hiddenInputs = el.shadowRoot.querySelectorAll('.priority-list__hidden-inputs input[type="hidden"]');
|
|
80
|
+
expect(hiddenInputs.length).to.equal(2);
|
|
81
|
+
expect(hiddenInputs[0].name).to.equal('priority[item1]');
|
|
82
|
+
expect(hiddenInputs[0].value).to.equal('1');
|
|
83
|
+
expect(hiddenInputs[1].name).to.equal('priority[item2]');
|
|
84
|
+
expect(hiddenInputs[1].value).to.equal('2');
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('should have listbox role on the list container', async () => {
|
|
88
|
+
const el = await fixture(html`
|
|
89
|
+
<zn-priority-list label="My List">
|
|
90
|
+
<div value="a">A</div>
|
|
91
|
+
</zn-priority-list>
|
|
92
|
+
`) as any;
|
|
93
|
+
|
|
94
|
+
await el.updateComplete;
|
|
95
|
+
const list = el.shadowRoot.querySelector('.priority-list');
|
|
96
|
+
expect(list.getAttribute('role')).to.equal('listbox');
|
|
97
|
+
expect(list.getAttribute('aria-orientation')).to.equal('vertical');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('should have option role on each item', async () => {
|
|
101
|
+
const el = await fixture(html`
|
|
102
|
+
<zn-priority-list>
|
|
103
|
+
<div value="a">A</div>
|
|
104
|
+
<div value="b">B</div>
|
|
105
|
+
</zn-priority-list>
|
|
106
|
+
`) as any;
|
|
107
|
+
|
|
108
|
+
await el.updateComplete;
|
|
109
|
+
const items = el.shadowRoot.querySelectorAll('.priority-list__item');
|
|
110
|
+
items.forEach((item: Element) => {
|
|
111
|
+
expect(item.getAttribute('role')).to.equal('option');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
it('should render drag handles', async () => {
|
|
116
|
+
const el = await fixture(html`
|
|
117
|
+
<zn-priority-list>
|
|
118
|
+
<div value="a">A</div>
|
|
119
|
+
</zn-priority-list>
|
|
120
|
+
`) as any;
|
|
121
|
+
|
|
122
|
+
await el.updateComplete;
|
|
123
|
+
const handles = el.shadowRoot.querySelectorAll('.priority-list__handle');
|
|
124
|
+
expect(handles.length).to.equal(1);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it('should disable dragging when disabled', async () => {
|
|
128
|
+
const el = await fixture(html`
|
|
129
|
+
<zn-priority-list disabled>
|
|
130
|
+
<div value="a">A</div>
|
|
131
|
+
</zn-priority-list>
|
|
132
|
+
`) as any;
|
|
133
|
+
|
|
134
|
+
await el.updateComplete;
|
|
135
|
+
const item = el.shadowRoot.querySelector('.priority-list__item');
|
|
136
|
+
expect(item.getAttribute('draggable')).to.equal('false');
|
|
137
|
+
expect(item.getAttribute('tabindex')).to.equal('-1');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -5,21 +5,25 @@ import ZincElement from '../../internal/zinc-element';
|
|
|
5
5
|
import styles from './progress-bar.scss';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* @summary
|
|
8
|
+
* @summary Progress bars provide visual feedback about the completion status of a task or process.
|
|
9
9
|
* @documentation https://zinc.style/components/progress-bar
|
|
10
10
|
* @status experimental
|
|
11
11
|
* @since 1.0
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @csspart header - The header container that contains the caption and progress text.
|
|
14
|
+
* @csspart caption - The caption text element.
|
|
15
|
+
* @csspart progress - The progress percentage text element.
|
|
16
|
+
* @csspart bar - The SVG element containing the progress bar.
|
|
17
|
+
* @csspart track - The background track of the progress bar.
|
|
18
|
+
* @csspart fill - The filled portion of the progress bar indicating progress.
|
|
19
|
+
* @csspart footer - The footer container that contains the description.
|
|
20
|
+
* @csspart info - The description text element.
|
|
14
21
|
*
|
|
15
|
-
* @
|
|
16
|
-
*
|
|
17
|
-
* @
|
|
18
|
-
* @
|
|
19
|
-
*
|
|
20
|
-
* @csspart base - The component's base wrapper.
|
|
21
|
-
*
|
|
22
|
-
* @cssproperty --example - An example CSS custom property.
|
|
22
|
+
* @cssproperty --zn-border-color - The color of the progress bar background track.
|
|
23
|
+
* @cssproperty --zn-primary - The color of the progress bar fill.
|
|
24
|
+
* @cssproperty --zn-text-heading - The color of the caption text.
|
|
25
|
+
* @cssproperty --zn-text - The color of the progress percentage and description text.
|
|
26
|
+
* @cssproperty --zn-spacing-x-small - The spacing between header/footer and the progress bar.
|
|
23
27
|
*/
|
|
24
28
|
export default class ZnProgressBar extends ZincElement {
|
|
25
29
|
static styles: CSSResultGroup = unsafeCSS(styles);
|
|
@@ -34,28 +38,30 @@ export default class ZnProgressBar extends ZincElement {
|
|
|
34
38
|
return html`
|
|
35
39
|
${this.caption || this.showProgress
|
|
36
40
|
? html`
|
|
37
|
-
<div class="header">
|
|
38
|
-
<p class="caption">${this.caption}</p>
|
|
41
|
+
<div part="header" class="header">
|
|
42
|
+
<p part="caption" class="caption">${this.caption}</p>
|
|
39
43
|
${this.showProgress
|
|
40
44
|
? html`
|
|
41
|
-
<p class="progress">${this.value}%</p> `
|
|
45
|
+
<p part="progress" class="progress">${this.value}%</p> `
|
|
42
46
|
: ''}
|
|
43
47
|
</div>
|
|
44
48
|
`
|
|
45
49
|
: ''}
|
|
46
|
-
<svg width="100%" height="8">
|
|
50
|
+
<svg part="bar" width="100%" height="8">
|
|
47
51
|
<defs>
|
|
48
52
|
<clipPath id="clip-path">
|
|
49
53
|
<rect width="100%" height="8px" rx="4px"/>
|
|
50
54
|
</clipPath>
|
|
51
55
|
</defs>
|
|
52
56
|
<rect
|
|
57
|
+
part="track"
|
|
53
58
|
fill="rgba(var(--zn-border-color))"
|
|
54
59
|
width="100%"
|
|
55
60
|
height="100%"
|
|
56
61
|
rx="4px"
|
|
57
62
|
/>
|
|
58
63
|
<rect
|
|
64
|
+
part="fill"
|
|
59
65
|
fill='rgb(var(--zn-primary))'
|
|
60
66
|
width="${this.value}%"
|
|
61
67
|
height="100%"
|
|
@@ -65,10 +71,10 @@ export default class ZnProgressBar extends ZincElement {
|
|
|
65
71
|
</svg>
|
|
66
72
|
${this.description
|
|
67
73
|
? html`
|
|
68
|
-
<div class="footer">
|
|
74
|
+
<div part="footer" class="footer">
|
|
69
75
|
${this.description
|
|
70
76
|
? html`
|
|
71
|
-
<p class="info">
|
|
77
|
+
<p part="info" class="info">
|
|
72
78
|
${this.description}
|
|
73
79
|
</p>`
|
|
74
80
|
: ''}
|
|
@@ -100,10 +100,17 @@
|
|
|
100
100
|
border: none;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
/* Focus */
|
|
104
|
+
.radio:not(.radio--checked):not(.radio--disabled) .radio__input:focus-visible ~ .radio__control {
|
|
105
|
+
border-color: rgb(var(--zn-primary));
|
|
106
|
+
outline: var(--zn-focus-ring);
|
|
107
|
+
outline-offset: var(--zn-focus-ring-offset);
|
|
108
|
+
}
|
|
109
|
+
|
|
103
110
|
/* Checked + focus */
|
|
104
|
-
:
|
|
105
|
-
outline:
|
|
106
|
-
outline-offset:
|
|
111
|
+
.radio.radio--checked:not(.radio--disabled) .radio__input:focus-visible ~ .radio__control {
|
|
112
|
+
outline: var(--zn-focus-ring);
|
|
113
|
+
outline-offset: var(--zn-focus-ring-offset);
|
|
107
114
|
}
|
|
108
115
|
|
|
109
116
|
/* Disabled */
|