xv-webcomponents 1.16.8-qa.0 → 1.17.2-qa.0
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/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{xv-accordion-v2_45.cjs.entry.js → xv-accordion-v2_47.cjs.entry.js} +215 -55
- package/dist/cjs/xv-header-next.cjs.entry.js +1 -1
- package/dist/cjs/xv-mega-menu-next.cjs.entry.js +2 -2
- package/dist/cjs/xv-webcomponents.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/xv-content-switcher/_vars.js +14 -0
- package/dist/collection/components/xv-content-switcher/xv-content-switcher-item/xv-content-switcher-item.css +134 -0
- package/dist/collection/components/xv-content-switcher/xv-content-switcher-item/xv-content-switcher-item.js +118 -0
- package/dist/collection/components/xv-content-switcher/xv-content-switcher.css +275 -0
- package/dist/collection/components/xv-content-switcher/xv-content-switcher.js +310 -0
- package/dist/collection/components/xv-data-table/xv-data-table-cell/xv-data-table-cell.js +1 -1
- package/dist/collection/components/xv-data-table/xv-data-table-collapse/xv-data-table-collapse.js +1 -1
- package/dist/collection/components/xv-data-table/xv-data-table-row/xv-data-table-row.js +2 -2
- package/dist/collection/components/xv-data-table/xv-data-table.js +1 -1
- package/dist/collection/components/xv-datepicker/xv-datepicker.css +4 -4
- package/dist/collection/components/xv-datepicker/xv-datepicker.js +2 -2
- package/dist/collection/components/xv-dropdown/xv-dropdown-item/xv-dropdown-item.js +1 -1
- package/dist/collection/components/xv-dropdown/xv-dropdown.css +2 -2
- package/dist/collection/components/xv-dropdown/xv-dropdown.js +1 -1
- package/dist/collection/components/xv-file-uploader/xv-file-uploader.js +1 -1
- package/dist/collection/components/xv-footer/xv-footer.js +1 -1
- package/dist/collection/components/xv-header/xv-header.js +1 -1
- package/dist/collection/components/xv-header-next/xv-header-next.js +1 -1
- package/dist/collection/components/xv-image-viewer/xv-image-viewer.js +1 -1
- package/dist/collection/components/xv-link/xv-link.js +1 -1
- package/dist/collection/components/xv-mega-menu/xv-mega-menu.js +2 -2
- package/dist/collection/components/xv-mega-menu-next/xv-mega-menu-next.js +2 -2
- package/dist/collection/components/xv-modal/xv-modal.js +1 -1
- package/dist/collection/components/xv-notification/xv-notification.js +1 -1
- package/dist/collection/components/xv-number-input/xv-number-input.css +5 -3
- package/dist/collection/components/xv-number-input/xv-number-input.js +2 -2
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu-item/xv-overflow-menu-item.js +1 -1
- package/dist/collection/components/xv-overflow-menu/xv-overflow-menu.js +2 -2
- package/dist/collection/components/xv-pagination/xv-pagination.js +1 -1
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator-item/xv-progress-indicator-item.js +1 -1
- package/dist/collection/components/xv-progress-indicator/xv-progress-indicator.js +1 -1
- package/dist/collection/components/xv-radio/xv-radio.css +2 -2
- package/dist/collection/components/xv-radio/xv-radio.js +2 -2
- package/dist/collection/components/xv-slider/xv-slider.css +2 -2
- package/dist/collection/components/xv-slider/xv-slider.js +1 -1
- package/dist/collection/components/xv-table/xv-table-cell/xv-table-cell.js +1 -1
- package/dist/collection/components/xv-table/xv-table-expand/xv-table-expand.js +1 -1
- package/dist/collection/components/xv-table/xv-table-row/xv-table-row.js +1 -1
- package/dist/collection/components/xv-table/xv-table.js +1 -1
- package/dist/collection/components/xv-tabs/xv-tab/xv-tab.js +1 -1
- package/dist/collection/components/xv-tag/xv-tag.js +1 -1
- package/dist/collection/components/xv-tag-combobox/xv-tag-combobox.css +2 -2
- package/dist/collection/components/xv-tag-combobox/xv-tag-combobox.js +2 -2
- package/dist/collection/components/xv-text-input/xv-text-input.css +1 -1
- package/dist/collection/components/xv-text-input/xv-text-input.js +2 -2
- package/dist/collection/components/xv-textarea/xv-textarea.css +2 -2
- package/dist/collection/components/xv-textarea/xv-textarea.js +2 -2
- package/dist/collection/components/xv-tile/xv-tile.js +2 -2
- package/dist/collection/components/xv-toggle/xv-toggle.js +1 -1
- package/dist/collection/components/xv-toggle-tip/xv-toggle-tip.js +1 -1
- package/dist/collection/components/xv-tooltip/xv-tooltip.js +2 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{xv-accordion-v2_45.entry.js → xv-accordion-v2_47.entry.js} +214 -56
- package/dist/esm/xv-header-next.entry.js +1 -1
- package/dist/esm/xv-mega-menu-next.entry.js +2 -2
- package/dist/esm/xv-webcomponents.js +1 -1
- package/dist/types/components/xv-content-switcher/_vars.d.ts +13 -0
- package/dist/types/components/xv-content-switcher/xv-content-switcher-item/xv-content-switcher-item.d.ts +32 -0
- package/dist/types/components/xv-content-switcher/xv-content-switcher.d.ts +78 -0
- package/dist/types/components.d.ts +241 -0
- package/dist/xv-webcomponents/{p-1b5a4f4c.entry.js → p-1cb6cc34.entry.js} +1 -1
- package/dist/xv-webcomponents/p-75cad2df.entry.js +8 -0
- package/dist/xv-webcomponents/{p-50f8cd72.entry.js → p-dc64e134.entry.js} +1 -1
- package/dist/xv-webcomponents/xv-webcomponents.esm.js +1 -1
- package/package.json +1 -1
- package/dist/xv-webcomponents/p-367d6df4.entry.js +0 -8
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
.xv-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 1170px;
|
|
4
|
+
margin-inline: auto;
|
|
5
|
+
}
|
|
6
|
+
@media (min-width: 576px) {
|
|
7
|
+
.xv-container {
|
|
8
|
+
max-width: 540px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
@media (min-width: 768px) {
|
|
12
|
+
.xv-container {
|
|
13
|
+
max-width: 720px;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
@media (min-width: 992px) {
|
|
17
|
+
.xv-container {
|
|
18
|
+
max-width: 960px;
|
|
19
|
+
padding-inline: var(--bs-gutter-x, 0.75rem);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
@media (min-width: 1200px) {
|
|
23
|
+
.xv-container {
|
|
24
|
+
max-width: 1140px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
@media (min-width: 1400px) {
|
|
28
|
+
.xv-container {
|
|
29
|
+
max-width: 1320px;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.xv-tooltip[role=tooltip] {
|
|
34
|
+
position: absolute;
|
|
35
|
+
background-color: var(--background-inverse, #333333);
|
|
36
|
+
color: var(--text-on-color);
|
|
37
|
+
padding: var(--spacing-03) var(--spacing-04);
|
|
38
|
+
border-radius: 3px;
|
|
39
|
+
font-size: var(--fz-sm);
|
|
40
|
+
z-index: 999;
|
|
41
|
+
min-width: min(150px, 90vw);
|
|
42
|
+
max-width: min(400px, 90vw);
|
|
43
|
+
}
|
|
44
|
+
.xv-tooltip[role=tooltip]::after {
|
|
45
|
+
content: "";
|
|
46
|
+
position: absolute;
|
|
47
|
+
width: 0;
|
|
48
|
+
height: 0;
|
|
49
|
+
border-style: solid;
|
|
50
|
+
}
|
|
51
|
+
.xv-tooltip[role=tooltip][data-popper-placement=top]::after {
|
|
52
|
+
bottom: -5px;
|
|
53
|
+
left: 50%;
|
|
54
|
+
transform: translateX(-50%);
|
|
55
|
+
border-width: 5px 5px 0 5px;
|
|
56
|
+
border-color: var(--background-inverse, black) transparent transparent transparent;
|
|
57
|
+
}
|
|
58
|
+
.xv-tooltip[role=tooltip][data-popper-placement=top-start]::after {
|
|
59
|
+
bottom: -5px;
|
|
60
|
+
left: 12px;
|
|
61
|
+
border-width: 5px 5px 0 5px;
|
|
62
|
+
border-color: var(--background-inverse, black) transparent transparent transparent;
|
|
63
|
+
}
|
|
64
|
+
.xv-tooltip[role=tooltip][data-popper-placement=top-end]::after {
|
|
65
|
+
bottom: -5px;
|
|
66
|
+
right: 12px;
|
|
67
|
+
border-width: 5px 5px 0 5px;
|
|
68
|
+
border-color: var(--background-inverse, black) transparent transparent transparent;
|
|
69
|
+
}
|
|
70
|
+
.xv-tooltip[role=tooltip][data-popper-placement=bottom]::after {
|
|
71
|
+
top: -5px;
|
|
72
|
+
left: 50%;
|
|
73
|
+
transform: translateX(-50%);
|
|
74
|
+
border-width: 0 5px 5px 5px;
|
|
75
|
+
border-color: transparent transparent var(--background-inverse, black) transparent;
|
|
76
|
+
}
|
|
77
|
+
.xv-tooltip[role=tooltip][data-popper-placement=bottom-start]::after {
|
|
78
|
+
top: -5px;
|
|
79
|
+
left: 12px;
|
|
80
|
+
border-width: 0 5px 5px 5px;
|
|
81
|
+
border-color: transparent transparent var(--background-inverse, black) transparent;
|
|
82
|
+
}
|
|
83
|
+
.xv-tooltip[role=tooltip][data-popper-placement=bottom-end]::after {
|
|
84
|
+
top: -5px;
|
|
85
|
+
right: 12px;
|
|
86
|
+
border-width: 0 5px 5px 5px;
|
|
87
|
+
border-color: transparent transparent var(--background-inverse, black) transparent;
|
|
88
|
+
}
|
|
89
|
+
.xv-tooltip[role=tooltip][data-popper-placement=left]::after {
|
|
90
|
+
top: 50%;
|
|
91
|
+
right: -5px;
|
|
92
|
+
transform: translateY(-50%);
|
|
93
|
+
border-width: 5px 0 5px 5px;
|
|
94
|
+
border-color: transparent transparent transparent var(--background-inverse, black);
|
|
95
|
+
}
|
|
96
|
+
.xv-tooltip[role=tooltip][data-popper-placement=left-start]::after {
|
|
97
|
+
top: 12px;
|
|
98
|
+
right: -5px;
|
|
99
|
+
border-width: 5px 0 5px 5px;
|
|
100
|
+
border-color: transparent transparent transparent var(--background-inverse, black);
|
|
101
|
+
}
|
|
102
|
+
.xv-tooltip[role=tooltip][data-popper-placement=left-end]::after {
|
|
103
|
+
bottom: 12px;
|
|
104
|
+
right: -5px;
|
|
105
|
+
border-width: 5px 0 5px 5px;
|
|
106
|
+
border-color: transparent transparent transparent var(--background-inverse, black);
|
|
107
|
+
}
|
|
108
|
+
.xv-tooltip[role=tooltip][data-popper-placement=right]::after {
|
|
109
|
+
top: 50%;
|
|
110
|
+
left: -5px;
|
|
111
|
+
transform: translateY(-50%);
|
|
112
|
+
border-width: 5px 5px 5px 0;
|
|
113
|
+
border-color: transparent var(--background-inverse, black) transparent transparent;
|
|
114
|
+
}
|
|
115
|
+
.xv-tooltip[role=tooltip][data-popper-placement=right-start]::after {
|
|
116
|
+
top: 12px;
|
|
117
|
+
left: -5px;
|
|
118
|
+
border-width: 5px 5px 5px 0;
|
|
119
|
+
border-color: transparent var(--background-inverse, black) transparent transparent;
|
|
120
|
+
}
|
|
121
|
+
.xv-tooltip[role=tooltip][data-popper-placement=right-end]::after {
|
|
122
|
+
bottom: 12px;
|
|
123
|
+
left: -5px;
|
|
124
|
+
border-width: 5px 5px 5px 0;
|
|
125
|
+
border-color: transparent var(--background-inverse, black) transparent transparent;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:host {
|
|
129
|
+
display: inline-block;
|
|
130
|
+
text-align: left;
|
|
131
|
+
font-family: var(--ff-body, Work Sans), sans-serif;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([block]) {
|
|
135
|
+
display: block;
|
|
136
|
+
}
|
|
137
|
+
:host([block]) .switcher {
|
|
138
|
+
display: grid;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.switcher {
|
|
142
|
+
display: inline-grid;
|
|
143
|
+
grid-auto-flow: column;
|
|
144
|
+
grid-auto-columns: 1fr;
|
|
145
|
+
align-items: stretch;
|
|
146
|
+
border: 1px solid var(--border-inverse, #131313);
|
|
147
|
+
border-radius: 4px;
|
|
148
|
+
overflow: hidden;
|
|
149
|
+
}
|
|
150
|
+
.switcher_item {
|
|
151
|
+
all: unset;
|
|
152
|
+
box-sizing: border-box;
|
|
153
|
+
position: relative;
|
|
154
|
+
min-width: 0;
|
|
155
|
+
display: inline-flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: flex-start;
|
|
158
|
+
gap: var(--spacing-03, 8px);
|
|
159
|
+
cursor: pointer;
|
|
160
|
+
color: var(--text-secondary, #515151);
|
|
161
|
+
background-color: transparent;
|
|
162
|
+
font-family: inherit;
|
|
163
|
+
font-size: var(--fz-md, 14px);
|
|
164
|
+
font-weight: 400;
|
|
165
|
+
line-height: 18px;
|
|
166
|
+
letter-spacing: 0.16px;
|
|
167
|
+
transition: background-color 0.2s ease, color 0.2s ease;
|
|
168
|
+
}
|
|
169
|
+
.switcher_item + .switcher_item::before {
|
|
170
|
+
content: "";
|
|
171
|
+
position: absolute;
|
|
172
|
+
left: 0;
|
|
173
|
+
top: 50%;
|
|
174
|
+
transform: translateY(-50%);
|
|
175
|
+
width: 1px;
|
|
176
|
+
height: 16px;
|
|
177
|
+
background-color: var(--border-subtle-01, #d1d1d1);
|
|
178
|
+
}
|
|
179
|
+
.switcher_item-icon {
|
|
180
|
+
display: inline-flex;
|
|
181
|
+
align-items: center;
|
|
182
|
+
justify-content: center;
|
|
183
|
+
font-size: 20px;
|
|
184
|
+
line-height: 1;
|
|
185
|
+
color: var(--icon-primary, #131313);
|
|
186
|
+
}
|
|
187
|
+
.switcher_item-label {
|
|
188
|
+
min-width: 0;
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
text-overflow: ellipsis;
|
|
191
|
+
white-space: nowrap;
|
|
192
|
+
}
|
|
193
|
+
.switcher_item:hover:not(.selected):not(:disabled) {
|
|
194
|
+
background-color: var(--background-hover, rgba(139, 139, 139, 0.12));
|
|
195
|
+
}
|
|
196
|
+
.switcher_item:focus-visible {
|
|
197
|
+
outline: 2px solid var(--focus, #0f62fe);
|
|
198
|
+
outline-offset: -2px;
|
|
199
|
+
}
|
|
200
|
+
.switcher_item.selected {
|
|
201
|
+
background-color: var(--background-inverse, #333333);
|
|
202
|
+
color: var(--text-inverse, #fff);
|
|
203
|
+
}
|
|
204
|
+
.switcher_item.selected .switcher_item-icon {
|
|
205
|
+
color: var(--icon-on-color, #fff);
|
|
206
|
+
}
|
|
207
|
+
.switcher_item.selected:hover {
|
|
208
|
+
background-color: var(--background-inverse-hover, #515151);
|
|
209
|
+
}
|
|
210
|
+
.switcher_item.selected::before, .switcher_item.selected + .switcher_item::before {
|
|
211
|
+
display: none;
|
|
212
|
+
}
|
|
213
|
+
.switcher_item:disabled {
|
|
214
|
+
cursor: not-allowed;
|
|
215
|
+
color: var(--text-disabled, rgba(19, 19, 19, 0.25));
|
|
216
|
+
}
|
|
217
|
+
.switcher_item:disabled .switcher_item-icon {
|
|
218
|
+
color: var(--icon-disabled, rgba(19, 19, 19, 0.25));
|
|
219
|
+
}
|
|
220
|
+
.switcher_item:disabled.selected {
|
|
221
|
+
background-color: var(--button-disabled, #d1d1d1);
|
|
222
|
+
color: var(--text-disabled, rgba(19, 19, 19, 0.25));
|
|
223
|
+
}
|
|
224
|
+
.switcher_item:disabled.selected .switcher_item-icon {
|
|
225
|
+
color: var(--icon-on-color-disabled, #8b8b8b);
|
|
226
|
+
}
|
|
227
|
+
.switcher_content:focus {
|
|
228
|
+
outline: none;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
:host([disabled]) .switcher {
|
|
232
|
+
border-color: var(--border-disabled, #d1d1d1);
|
|
233
|
+
}
|
|
234
|
+
:host([disabled]) .switcher .switcher_item::before {
|
|
235
|
+
background-color: var(--border-disabled, #d1d1d1);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
::slotted(xv-content-switcher-item-v2) {
|
|
239
|
+
display: none;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
::slotted(xv-content-switcher-item-v2.active) {
|
|
243
|
+
display: block;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
:host([size=sm]) .switcher_item {
|
|
247
|
+
padding: 7px var(--spacing-05, 16px);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
:host(:not([size])) .switcher_item,
|
|
251
|
+
:host([size=md]) .switcher_item {
|
|
252
|
+
padding: 11px var(--spacing-05, 16px);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
:host([size=lg]) .switcher_item {
|
|
256
|
+
padding: 15px var(--spacing-05, 16px);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
:host([icon-only]) .switcher_item {
|
|
260
|
+
justify-content: center;
|
|
261
|
+
gap: 0;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
:host([icon-only][size=sm]) .switcher_item {
|
|
265
|
+
padding: 8px;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
:host([icon-only]:not([size])) .switcher_item,
|
|
269
|
+
:host([icon-only][size=md]) .switcher_item {
|
|
270
|
+
padding: 12px;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
:host([icon-only][size=lg]) .switcher_item {
|
|
274
|
+
padding: 14px;
|
|
275
|
+
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { CONTENT_SWITCHER_NAV_KEYS, CONTENT_SWITCHER_TAGS } from "./_vars";
|
|
3
|
+
import { SIZE_VAR } from "../../types/enum";
|
|
4
|
+
/**
|
|
5
|
+
* xv-content-switcher-v2
|
|
6
|
+
*
|
|
7
|
+
* Carbon-style content switcher: a single-select segmented control that toggles
|
|
8
|
+
* between mutually exclusive sections of content.
|
|
9
|
+
* @see https://carbondesignsystem.com/components/content-switcher/usage/
|
|
10
|
+
*
|
|
11
|
+
* The buttons are derived from the `xv-content-switcher-item-v2` children, so the
|
|
12
|
+
* group can manage shared borders, dividers and rounded corners in one place.
|
|
13
|
+
* Each item may also hold slotted content that is shown only while it is selected.
|
|
14
|
+
*
|
|
15
|
+
* IMPORTANT — slotted panels are only HIDDEN (CSS `display: none`), never unmounted.
|
|
16
|
+
* Slotted content lives in the consumer's light DOM, so the framework instantiates
|
|
17
|
+
* it (and runs lifecycle hooks like Angular's `ngOnInit`, subscriptions, requests)
|
|
18
|
+
* regardless of which item is selected — the switcher cannot prevent that. Use this
|
|
19
|
+
* slotted convenience only for cheap, static markup. For panels with lifecycle or
|
|
20
|
+
* side effects, do NOT slot them: keep the switcher as a pure selection control and
|
|
21
|
+
* render the active panel yourself via a framework conditional (e.g. Angular `@if`
|
|
22
|
+
* on `selectedChange`), so only the selected panel is ever instantiated.
|
|
23
|
+
*
|
|
24
|
+
* @slot - One or more `xv-content-switcher-item-v2` elements.
|
|
25
|
+
*/
|
|
26
|
+
export class XvContentSwitcher {
|
|
27
|
+
constructor() {
|
|
28
|
+
/**
|
|
29
|
+
* Control size. Only `sm`, `md` and `lg` are supported (defaults to `md`).
|
|
30
|
+
*/
|
|
31
|
+
this.size = SIZE_VAR.MD;
|
|
32
|
+
/**
|
|
33
|
+
* Render items as icon-only buttons (the item `label` is used as the accessible name).
|
|
34
|
+
*/
|
|
35
|
+
this.iconOnly = false;
|
|
36
|
+
/**
|
|
37
|
+
* Disable the whole switcher.
|
|
38
|
+
*/
|
|
39
|
+
this.disabled = false;
|
|
40
|
+
/**
|
|
41
|
+
* Stretch the switcher to the full width of its container.
|
|
42
|
+
*/
|
|
43
|
+
this.block = false;
|
|
44
|
+
/**
|
|
45
|
+
* Controlled mode. When `true`, clicking/keyboard navigation does NOT change
|
|
46
|
+
* the selection on its own — it only emits `selectedChange` with the requested
|
|
47
|
+
* value. The consumer fully owns `selected` and decides whether to commit it
|
|
48
|
+
* (e.g. after an async confirmation), so a switch can be vetoed without flicker.
|
|
49
|
+
*/
|
|
50
|
+
this.controlled = false;
|
|
51
|
+
/**
|
|
52
|
+
* Collected `xv-content-switcher-item-v2` children.
|
|
53
|
+
*/
|
|
54
|
+
this.items = [];
|
|
55
|
+
this.collectItems = () => {
|
|
56
|
+
this.items = Array.from(this.el.querySelectorAll(CONTENT_SWITCHER_TAGS.ITEM));
|
|
57
|
+
// Default to the first item when nothing valid is selected yet.
|
|
58
|
+
if (!this.isSelectionValid()) {
|
|
59
|
+
const firstEnabled = this.items.findIndex((item) => !this.isItemDisabled(item));
|
|
60
|
+
if (firstEnabled !== -1)
|
|
61
|
+
this.selected = this.getItemKey(this.items[firstEnabled], firstEnabled);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
this.handleKeyDown = (event, index) => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const { NEXT, PREV, FIRST, LAST } = CONTENT_SWITCHER_NAV_KEYS;
|
|
67
|
+
let nextIndex = null;
|
|
68
|
+
if (NEXT.includes(event.key))
|
|
69
|
+
nextIndex = this.findEnabled(index + 1, 1);
|
|
70
|
+
else if (PREV.includes(event.key))
|
|
71
|
+
nextIndex = this.findEnabled(index - 1, -1);
|
|
72
|
+
else if (FIRST.includes(event.key))
|
|
73
|
+
nextIndex = this.findEnabled(0, 1);
|
|
74
|
+
else if (LAST.includes(event.key))
|
|
75
|
+
nextIndex = this.findEnabled(this.items.length - 1, -1);
|
|
76
|
+
else
|
|
77
|
+
return;
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
if (nextIndex === null)
|
|
80
|
+
return;
|
|
81
|
+
this.select(this.getItemKey(this.items[nextIndex], nextIndex));
|
|
82
|
+
// Move focus to the newly selected button (roving tabindex).
|
|
83
|
+
const buttons = (_a = this.el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('.switcher_item');
|
|
84
|
+
(_b = buttons === null || buttons === void 0 ? void 0 : buttons[nextIndex]) === null || _b === void 0 ? void 0 : _b.focus();
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
componentWillLoad() {
|
|
88
|
+
// `slotchange` handles dynamic updates; collect once up front for the
|
|
89
|
+
// items present at load so the first render already has its buttons.
|
|
90
|
+
this.collectItems();
|
|
91
|
+
}
|
|
92
|
+
componentDidRender() {
|
|
93
|
+
// Mirror the selected state onto the slotted items so their content panels
|
|
94
|
+
// show/hide (see `::slotted(...active)` in the stylesheet).
|
|
95
|
+
this.updateItemsState();
|
|
96
|
+
}
|
|
97
|
+
getItemKey(item, index) {
|
|
98
|
+
const value = item.getAttribute('value');
|
|
99
|
+
return value !== null && value !== '' ? value : index;
|
|
100
|
+
}
|
|
101
|
+
isItemDisabled(item) {
|
|
102
|
+
return this.disabled || item.hasAttribute('disabled');
|
|
103
|
+
}
|
|
104
|
+
isSelected(item, index) {
|
|
105
|
+
return this.selected !== undefined && `${this.getItemKey(item, index)}` === `${this.selected}`;
|
|
106
|
+
}
|
|
107
|
+
isSelectionValid() {
|
|
108
|
+
return this.items.some((item, index) => this.isSelected(item, index));
|
|
109
|
+
}
|
|
110
|
+
select(key) {
|
|
111
|
+
if (this.disabled || `${key}` === `${this.selected}`)
|
|
112
|
+
return;
|
|
113
|
+
// In controlled mode the consumer owns `selected`; only announce the intent.
|
|
114
|
+
if (!this.controlled)
|
|
115
|
+
this.selected = key;
|
|
116
|
+
this.selectedChange.emit(key);
|
|
117
|
+
}
|
|
118
|
+
/** Reflect the `active` class on items so their slotted content shows/hides. */
|
|
119
|
+
updateItemsState() {
|
|
120
|
+
this.items.forEach((item, index) => {
|
|
121
|
+
if (this.isSelected(item, index))
|
|
122
|
+
item.classList.add('active');
|
|
123
|
+
else
|
|
124
|
+
item.classList.remove('active');
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
/** Find the next non-disabled item starting at `from`, walking by `step`. */
|
|
128
|
+
findEnabled(from, step) {
|
|
129
|
+
for (let i = from; i >= 0 && i < this.items.length; i += step) {
|
|
130
|
+
if (!this.isItemDisabled(this.items[i]))
|
|
131
|
+
return i;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
render() {
|
|
136
|
+
return (h(Host, { key: '2f783317e906b04632e2666b27956c3d772f2979' }, h("div", { key: '9f008bfcd3a6e8e075a14b13dbcb406d97db7fff', class: "switcher", role: "tablist", "aria-orientation": "horizontal" }, this.items.map((item, index) => {
|
|
137
|
+
const key = this.getItemKey(item, index);
|
|
138
|
+
const selected = this.isSelected(item, index);
|
|
139
|
+
const itemDisabled = this.isItemDisabled(item);
|
|
140
|
+
const label = item.getAttribute('label') || '';
|
|
141
|
+
const icon = item.getAttribute('icon');
|
|
142
|
+
return (h("button", { type: "button", role: "tab", class: { switcher_item: true, selected }, "aria-selected": selected ? 'true' : 'false', "aria-label": this.iconOnly ? label || undefined : undefined, title: this.iconOnly ? label || undefined : undefined, disabled: itemDisabled, tabIndex: selected ? 0 : -1, onClick: () => this.select(key), onKeyDown: (event) => this.handleKeyDown(event, index) }, icon && h("i", { class: `switcher_item-icon ${icon}`, "aria-hidden": "true" }), !this.iconOnly && label && h("span", { class: "switcher_item-label" }, label)));
|
|
143
|
+
})), h("div", { key: 'ab00606b5b8d464ef1eb564030478191128319ae', class: "switcher_content", role: "tabpanel", tabindex: -1 }, h("slot", { key: '3977d4f17947f12f586fe4bbe0f1f9c81ef1ad18', onSlotchange: this.collectItems }))));
|
|
144
|
+
}
|
|
145
|
+
static get is() { return "xv-content-switcher-v2"; }
|
|
146
|
+
static get encapsulation() { return "shadow"; }
|
|
147
|
+
static get originalStyleUrls() {
|
|
148
|
+
return {
|
|
149
|
+
"$": ["xv-content-switcher.scss"]
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
static get styleUrls() {
|
|
153
|
+
return {
|
|
154
|
+
"$": ["xv-content-switcher.css"]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
static get properties() {
|
|
158
|
+
return {
|
|
159
|
+
"selected": {
|
|
160
|
+
"type": "any",
|
|
161
|
+
"mutable": true,
|
|
162
|
+
"complexType": {
|
|
163
|
+
"original": "number | string",
|
|
164
|
+
"resolved": "number | string",
|
|
165
|
+
"references": {}
|
|
166
|
+
},
|
|
167
|
+
"required": false,
|
|
168
|
+
"optional": true,
|
|
169
|
+
"docs": {
|
|
170
|
+
"tags": [],
|
|
171
|
+
"text": "Currently selected item \u2014 matched against each item's `value` attribute,\nor its zero-based index when it has no `value`."
|
|
172
|
+
},
|
|
173
|
+
"getter": false,
|
|
174
|
+
"setter": false,
|
|
175
|
+
"reflect": true,
|
|
176
|
+
"attribute": "selected"
|
|
177
|
+
},
|
|
178
|
+
"size": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"mutable": false,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "SIZE_VAR_STR",
|
|
183
|
+
"resolved": "\"lg\" | \"md\" | \"sm\" | \"xl\" | \"xs\"",
|
|
184
|
+
"references": {
|
|
185
|
+
"SIZE_VAR_STR": {
|
|
186
|
+
"location": "import",
|
|
187
|
+
"path": "../../types/enum",
|
|
188
|
+
"id": "src/types/enum.ts::SIZE_VAR_STR"
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"required": false,
|
|
193
|
+
"optional": false,
|
|
194
|
+
"docs": {
|
|
195
|
+
"tags": [],
|
|
196
|
+
"text": "Control size. Only `sm`, `md` and `lg` are supported (defaults to `md`)."
|
|
197
|
+
},
|
|
198
|
+
"getter": false,
|
|
199
|
+
"setter": false,
|
|
200
|
+
"reflect": true,
|
|
201
|
+
"attribute": "size",
|
|
202
|
+
"defaultValue": "SIZE_VAR.MD"
|
|
203
|
+
},
|
|
204
|
+
"iconOnly": {
|
|
205
|
+
"type": "boolean",
|
|
206
|
+
"mutable": false,
|
|
207
|
+
"complexType": {
|
|
208
|
+
"original": "boolean",
|
|
209
|
+
"resolved": "boolean",
|
|
210
|
+
"references": {}
|
|
211
|
+
},
|
|
212
|
+
"required": false,
|
|
213
|
+
"optional": false,
|
|
214
|
+
"docs": {
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": "Render items as icon-only buttons (the item `label` is used as the accessible name)."
|
|
217
|
+
},
|
|
218
|
+
"getter": false,
|
|
219
|
+
"setter": false,
|
|
220
|
+
"reflect": true,
|
|
221
|
+
"attribute": "icon-only",
|
|
222
|
+
"defaultValue": "false"
|
|
223
|
+
},
|
|
224
|
+
"disabled": {
|
|
225
|
+
"type": "boolean",
|
|
226
|
+
"mutable": false,
|
|
227
|
+
"complexType": {
|
|
228
|
+
"original": "boolean",
|
|
229
|
+
"resolved": "boolean",
|
|
230
|
+
"references": {}
|
|
231
|
+
},
|
|
232
|
+
"required": false,
|
|
233
|
+
"optional": false,
|
|
234
|
+
"docs": {
|
|
235
|
+
"tags": [],
|
|
236
|
+
"text": "Disable the whole switcher."
|
|
237
|
+
},
|
|
238
|
+
"getter": false,
|
|
239
|
+
"setter": false,
|
|
240
|
+
"reflect": true,
|
|
241
|
+
"attribute": "disabled",
|
|
242
|
+
"defaultValue": "false"
|
|
243
|
+
},
|
|
244
|
+
"block": {
|
|
245
|
+
"type": "boolean",
|
|
246
|
+
"mutable": false,
|
|
247
|
+
"complexType": {
|
|
248
|
+
"original": "boolean",
|
|
249
|
+
"resolved": "boolean",
|
|
250
|
+
"references": {}
|
|
251
|
+
},
|
|
252
|
+
"required": false,
|
|
253
|
+
"optional": false,
|
|
254
|
+
"docs": {
|
|
255
|
+
"tags": [],
|
|
256
|
+
"text": "Stretch the switcher to the full width of its container."
|
|
257
|
+
},
|
|
258
|
+
"getter": false,
|
|
259
|
+
"setter": false,
|
|
260
|
+
"reflect": true,
|
|
261
|
+
"attribute": "block",
|
|
262
|
+
"defaultValue": "false"
|
|
263
|
+
},
|
|
264
|
+
"controlled": {
|
|
265
|
+
"type": "boolean",
|
|
266
|
+
"mutable": false,
|
|
267
|
+
"complexType": {
|
|
268
|
+
"original": "boolean",
|
|
269
|
+
"resolved": "boolean",
|
|
270
|
+
"references": {}
|
|
271
|
+
},
|
|
272
|
+
"required": false,
|
|
273
|
+
"optional": false,
|
|
274
|
+
"docs": {
|
|
275
|
+
"tags": [],
|
|
276
|
+
"text": "Controlled mode. When `true`, clicking/keyboard navigation does NOT change\nthe selection on its own \u2014 it only emits `selectedChange` with the requested\nvalue. The consumer fully owns `selected` and decides whether to commit it\n(e.g. after an async confirmation), so a switch can be vetoed without flicker."
|
|
277
|
+
},
|
|
278
|
+
"getter": false,
|
|
279
|
+
"setter": false,
|
|
280
|
+
"reflect": true,
|
|
281
|
+
"attribute": "controlled",
|
|
282
|
+
"defaultValue": "false"
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
static get states() {
|
|
287
|
+
return {
|
|
288
|
+
"items": {}
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
static get events() {
|
|
292
|
+
return [{
|
|
293
|
+
"method": "selectedChange",
|
|
294
|
+
"name": "selectedChange",
|
|
295
|
+
"bubbles": true,
|
|
296
|
+
"cancelable": true,
|
|
297
|
+
"composed": true,
|
|
298
|
+
"docs": {
|
|
299
|
+
"tags": [],
|
|
300
|
+
"text": "Emitted whenever the selection changes (value, or index when the item has no value).\nIn `controlled` mode this carries the *requested* value before any commit."
|
|
301
|
+
},
|
|
302
|
+
"complexType": {
|
|
303
|
+
"original": "number | string",
|
|
304
|
+
"resolved": "number | string",
|
|
305
|
+
"references": {}
|
|
306
|
+
}
|
|
307
|
+
}];
|
|
308
|
+
}
|
|
309
|
+
static get elementRef() { return "el"; }
|
|
310
|
+
}
|
|
@@ -22,7 +22,7 @@ export class XvDataTableCell {
|
|
|
22
22
|
}
|
|
23
23
|
;
|
|
24
24
|
render() {
|
|
25
|
-
return (h(Host, { key: '
|
|
25
|
+
return (h(Host, { key: '4c47f740484cd42899ed300c2300a4955767e494', role: "cell", style: { width: this.width }, class: {
|
|
26
26
|
multiline: this.multiline !== undefined,
|
|
27
27
|
[`align--${this.align}`]: !!this.align
|
|
28
28
|
} }, !this.multiline || isNaN(this.multiline) ? this.__renderWithTooltip() : (h("div", { class: "line-clamp", style: { ['-webkit-line-clamp']: `${this.multiline}` } }, this.__renderWithTooltip()))));
|
package/dist/collection/components/xv-data-table/xv-data-table-collapse/xv-data-table-collapse.js
CHANGED
|
@@ -15,7 +15,7 @@ export class XvDataTableCollapse {
|
|
|
15
15
|
rows.forEach((row) => row === null || row === void 0 ? void 0 : row.setAttribute('collapsable', ''));
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
18
|
-
return (h(Host, { key: '
|
|
18
|
+
return (h(Host, { key: 'b4b9610e77edd0a4eb5669784a12df6c06d57398', id: this.el.id, part: "xv-collapse", class: this.el.className, collapsed: this.collapsed, expanded: !this.collapsed }, h("slot", { key: 'b6aa331515b8bcd5884f9b72e6fd46515adadf3c' })));
|
|
19
19
|
}
|
|
20
20
|
static get is() { return "xv-data-table-collapse"; }
|
|
21
21
|
static get encapsulation() { return "shadow"; }
|
|
@@ -74,7 +74,7 @@ export class XvDataTableRow {
|
|
|
74
74
|
const isGroup = !!this.collapse || !!this.group;
|
|
75
75
|
const isDraggableRow = this.reorderable && !isHeader && !isFooter && !this.group;
|
|
76
76
|
const showHandleCell = this.reorderable && this.reorderHandleMode === 'icon';
|
|
77
|
-
return (h(Host, { key: '
|
|
77
|
+
return (h(Host, { key: '220e41fb2db763b39ac56de16fa305226fef268b', role: "row", part: "xv-row", class: {
|
|
78
78
|
checked: this.checked,
|
|
79
79
|
hover: this.hover,
|
|
80
80
|
disabled: this.disabled,
|
|
@@ -82,7 +82,7 @@ export class XvDataTableRow {
|
|
|
82
82
|
header: isHeader,
|
|
83
83
|
footer: isFooter,
|
|
84
84
|
'reorder-row': isDraggableRow && this.reorderHandleMode === 'row',
|
|
85
|
-
} }, showHandleCell && (h("xv-data-table-cell", { key: '
|
|
85
|
+
} }, showHandleCell && (h("xv-data-table-cell", { key: 'c9d60451fb1781b94c2df312713173953c77998c', width: "16px", class: "cell-control cell-control--drag" }, isDraggableRow && (h("span", { key: '06f681f0aa1fad4d798aa84ad7123b55f5aaa7c5', class: `cell-control_drag ${XV_ROW_DRAG_HANDLE_CLASS}`, "aria-label": "Drag to reorder" }, h("svg", { key: '5f6bd2e58cd7dca1f1843c4b8868409cb7144023', viewBox: "0 0 8 14", width: "8", height: "14", fill: "currentColor", "aria-hidden": "true" }, h("circle", { key: '87b663ee0b2ac198cb69476814a2c097d6b1d2c9', cx: "2", cy: "2", r: "1.2" }), h("circle", { key: '3917cefb67ebcd2b8c26df7b9d4a2e1ad5023bc0', cx: "6", cy: "2", r: "1.2" }), h("circle", { key: '1f1778da1585511f8d9dd0ca4bcc8558e0610574', cx: "2", cy: "7", r: "1.2" }), h("circle", { key: '3e090df05f5eef959e4237213d2df95cd2c758c6', cx: "6", cy: "7", r: "1.2" }), h("circle", { key: 'f2c3c6e39482536f968fb3dfe2da518035388189', cx: "2", cy: "12", r: "1.2" }), h("circle", { key: 'be761faf2e9741c520e89e84b3c6d5c71d44826e', cx: "6", cy: "12", r: "1.2" })))))), (!!this.variant || this.collapsable) && (h("xv-data-table-cell", { key: '8d028993f15499799658c5c3f34be69b1eee807f', width: !!this.variant ? '16px' : '0', class: "cell-control" }, !!this.collapse && (h("button", { key: '29e7e558765f1c9b034b37f2cee10784662924c4', class: { 'cell-control_collapse': true, open: !this.collapsed }, onClick: this.collapseClick })), this.variant === 'checkbox' && (h("xv-checkbox-v2", { key: '062b73dfe88f5591975a5996e5bfa5b76faec1c0', name: this.name, partial: this.partial, checked: this.checked || this.partial, disabled: this.disabled, readonly: this.readonly, required: this.required, onEventChange: this.checkedChangeHandle, class: "cell-control_checkbox" })))), h("slot", { key: 'c9011f9b8ef09affaf7c707e554fdeff6e28943e', onSlotchange: this.setInitialState })));
|
|
86
86
|
}
|
|
87
87
|
static get is() { return "xv-data-table-row"; }
|
|
88
88
|
static get encapsulation() { return "shadow"; }
|
|
@@ -104,7 +104,7 @@ export class XvDataTable {
|
|
|
104
104
|
this.initSortable();
|
|
105
105
|
}
|
|
106
106
|
render() {
|
|
107
|
-
return (h(Host, { key: '
|
|
107
|
+
return (h(Host, { key: 'aef386c711cc3ae043d1228cac0b87737f9b70f1', class: "xv-data-table" }, h("caption", { key: 'a6577aba4dbbc50f6c953e25b533585b01d188ac' }, h("slot", { key: '02b1c865868d5fae89a558d35f7f7047cfd3ed3e', name: "title" })), h("div", { key: '19466d4e9e89a628d9df5ced1ac73c72d77650d2', class: "bar" }, h("div", { key: 'ec12712ac2b23d1f5ec2efe97cc5f5849e22808d', class: "bar_batch" }, h("slot", { key: '88e51529ecaffbda842b143e59caf60250ea3f66', name: "batch" })), h("div", { key: '3d7faf0d529a73e62a7e6e9ba567b9359c1ad795', class: "bar_toolbar" }, h("slot", { key: '1b4b5d8309eb02c98319be1b5b2c2fb9bf3b4b71', name: "toolbar" }))), h("table", { key: '7a3fc93e97d5e0cdc6a6a913609732e17f28aa01', role: "table" }, this.columnWidths.length > 0 && (h("colgroup", { key: '3ba295f8bfd44c1cc38c20c00131ce9ecb72e531' }, this.columnWidths.map((width = 'auto') => h("col", { style: { width } })))), h("thead", { key: 'a559bfeb5663ffcc0e4498a4efb667c85cb4b38d' }, h("slot", { key: 'aa87d90376a00bff11290ff41798162fae2a56a5', name: "header" })), h("tbody", { key: 'b8c6f100aa44110756317925b63fefbd44592e6b' }, h("slot", { key: 'e80e2461de26f46ccdef560d3bbd4357403a3a2e' })), h("tfoot", { key: '7a456ccbc039cd954417e7eb4880947e6199a8b3' }, h("slot", { key: 'ad358cf3e113802cf297bcd01d02ced5bbcd9cdf', name: "footer" }))), !!this.loading && (h("div", { key: 'f4b8dad2f9dea6da37797a41c3258c08b5d98761', class: "loading" }, h("xv-loader-v2", { key: '49d3273a7b869bb94584e3dac6f4099a404d1697', size: SIZE_VAR.LG })))));
|
|
108
108
|
}
|
|
109
109
|
static get is() { return "xv-data-table"; }
|
|
110
110
|
static get encapsulation() { return "shadow"; }
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
:host .control_label {
|
|
143
143
|
color: var(--text-secondary, #515151);
|
|
144
144
|
font-size: 0.8571428571em;
|
|
145
|
-
font-weight:
|
|
145
|
+
font-weight: 400;
|
|
146
146
|
}
|
|
147
147
|
:host .control_field {
|
|
148
148
|
position: relative;
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
flex: 1 1 0;
|
|
155
155
|
border-radius: 3px;
|
|
156
156
|
color: var(--text-primary, #333);
|
|
157
|
-
font-family: var(--ff-body);
|
|
157
|
+
font-family: var(--ff-body), sans-serif;
|
|
158
158
|
font-size: 1em;
|
|
159
159
|
background-color: transparent;
|
|
160
160
|
font-style: normal;
|
|
@@ -287,7 +287,7 @@
|
|
|
287
287
|
text-transform: capitalize;
|
|
288
288
|
color: var(--text-primary, #333);
|
|
289
289
|
text-align: center;
|
|
290
|
-
font-family: var(--ff-body);
|
|
290
|
+
font-family: var(--ff-body), sans-serif;
|
|
291
291
|
font-size: 1em;
|
|
292
292
|
font-weight: 700;
|
|
293
293
|
letter-spacing: 0.16px;
|
|
@@ -332,7 +332,7 @@
|
|
|
332
332
|
padding: 0;
|
|
333
333
|
box-sizing: border-box;
|
|
334
334
|
color: var(--text-primary, #333);
|
|
335
|
-
font-family: var(--ff-body);
|
|
335
|
+
font-family: var(--ff-body), sans-serif;
|
|
336
336
|
font-size: 1em;
|
|
337
337
|
letter-spacing: 0.16px;
|
|
338
338
|
user-select: none;
|