@zanichelli/albe-web-components 10.0.8 → 11.0.1
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/CHANGELOG.md +2789 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/z-app-header_11.cjs.entry.js +3 -3
- package/dist/cjs/z-navigation-tab-link.cjs.entry.js +5 -2
- package/dist/cjs/z-navigation-tab.cjs.entry.js +1 -1
- package/dist/cjs/z-navigation-tabs.cjs.entry.js +108 -96
- package/dist/cjs/z-popover.cjs.entry.js +2 -2
- package/dist/cjs/z-range-picker.cjs.entry.js +22 -4
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/components/date-picker/z-range-picker/index.js +98 -4
- package/dist/collection/components/inputs/z-searchbar/styles.css +1 -1
- package/dist/collection/components/navigation/z-app-header/index.js +3 -2
- package/dist/collection/components/navigation/z-app-header/styles.css +9 -1
- package/dist/collection/components/navigation/z-navigation-tabs/index.js +335 -0
- package/dist/collection/components/navigation/z-navigation-tabs/index.stories.js +12 -0
- package/dist/collection/components/navigation/z-navigation-tabs/styles.css +212 -0
- package/dist/collection/components/z-popover/index.js +2 -2
- package/dist/collection/{components/navigation/tabs → deprecated}/navigation-tab.css +5 -4
- package/dist/collection/deprecated/z-link/index.js +1 -0
- package/dist/collection/{components/navigation/tabs → deprecated}/z-navigation-tab/index.js +8 -5
- package/dist/collection/{components/navigation/tabs → deprecated}/z-navigation-tab-link/index.js +7 -3
- package/dist/esm/loader.js +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header_11.entry.js +3 -3
- package/dist/esm/z-navigation-tab-link.entry.js +5 -2
- package/dist/esm/z-navigation-tab.entry.js +1 -1
- package/dist/esm/z-navigation-tabs.entry.js +110 -98
- package/dist/esm/z-popover.entry.js +2 -2
- package/dist/esm/z-range-picker.entry.js +22 -4
- package/dist/types/components/date-picker/z-range-picker/index.d.ts +10 -0
- package/dist/types/components/navigation/z-app-header/index.d.ts +2 -1
- package/dist/types/components/navigation/{tabs/z-navigation-tabs → z-navigation-tabs}/index.d.ts +43 -31
- package/dist/types/components.d.ts +52 -2
- package/dist/types/deprecated/z-link/index.d.ts +1 -0
- package/dist/types/{components/navigation/tabs → deprecated}/z-navigation-tab/index.d.ts +2 -1
- package/dist/types/{components/navigation/tabs → deprecated}/z-navigation-tab-link/index.d.ts +2 -1
- package/dist/web-components-library/p-0b1c8f55.entry.js +1 -0
- package/dist/web-components-library/p-31a19318.entry.js +1 -0
- package/dist/web-components-library/p-498ed5c1.entry.js +1 -0
- package/dist/web-components-library/p-6c452dbc.entry.js +1 -0
- package/dist/web-components-library/p-9f2bfd3b.entry.js +1 -0
- package/dist/web-components-library/{p-5c8c249e.entry.js → p-a69d9a1c.entry.js} +1 -1
- package/dist/web-components-library/web-components-library.css +3 -2
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/src-react/index.ts +1 -0
- package/www/build/p-08a3464e.js +129 -0
- package/www/build/p-0b1c8f55.entry.js +1 -0
- package/www/build/p-31a19318.entry.js +1 -0
- package/www/build/p-498ed5c1.entry.js +1 -0
- package/www/build/p-6c452dbc.entry.js +1 -0
- package/www/build/p-9f2bfd3b.entry.js +1 -0
- package/www/build/{p-5c8c249e.entry.js → p-a69d9a1c.entry.js} +1 -1
- package/www/build/{p-f7695a31.css → p-f47dfea6.css} +208 -34
- package/www/build/web-components-library.css +3 -2
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/collection/components/navigation/tabs/z-navigation-tabs/index.js +0 -291
- package/dist/collection/components/navigation/tabs/z-navigation-tabs/index.stories.js +0 -11
- package/dist/collection/components/navigation/tabs/z-navigation-tabs/styles.css +0 -102
- package/dist/web-components-library/p-0d2c1891.entry.js +0 -1
- package/dist/web-components-library/p-200823b4.entry.js +0 -1
- package/dist/web-components-library/p-c5634f85.entry.js +0 -1
- package/dist/web-components-library/p-d5026b5b.entry.js +0 -1
- package/dist/web-components-library/p-fa7b1ee3.entry.js +0 -1
- package/www/build/p-0d2c1891.entry.js +0 -1
- package/www/build/p-200823b4.entry.js +0 -1
- package/www/build/p-51b30a96.js +0 -129
- package/www/build/p-c5634f85.entry.js +0 -1
- package/www/build/p-d5026b5b.entry.js +0 -1
- package/www/build/p-fa7b1ee3.entry.js +0 -1
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
import { h, Host } from "@stencil/core";
|
|
2
|
+
import { NavigationTabsSize, NavigationTabsOrientation, NavigationTabsKeyboardEvents, KeyboardCode, } from "../../../beans";
|
|
3
|
+
/**
|
|
4
|
+
* Navigation tabs component.
|
|
5
|
+
* To select a specific tab programmatically, set the `aria-selected` attribute to `true` on the desired tab.
|
|
6
|
+
* @slot - Main slot. Use `<button>` or `<a>` tags as children.
|
|
7
|
+
* @cssprop --z-navigation-tabs-nav-buttons-bg - Navigation buttons background color.
|
|
8
|
+
* @cssprop --z-navigation-tabs-nav-buttons-fg - Navigation buttons foreground color.
|
|
9
|
+
*/
|
|
10
|
+
export class ZNavigationTabs {
|
|
11
|
+
constructor() {
|
|
12
|
+
/**
|
|
13
|
+
* Navigation tabs orientation.
|
|
14
|
+
*/
|
|
15
|
+
this.orientation = NavigationTabsOrientation.HORIZONTAL;
|
|
16
|
+
/**
|
|
17
|
+
* Navigation tabs size.
|
|
18
|
+
*/
|
|
19
|
+
this.size = NavigationTabsSize.BIG;
|
|
20
|
+
/**
|
|
21
|
+
* Index of the selected tab.
|
|
22
|
+
*/
|
|
23
|
+
this.selectedTab = undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Index of the last tab that held focus.
|
|
26
|
+
*/
|
|
27
|
+
this.focusedTab = 0;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Getter for the direction to check based on current orientation.
|
|
31
|
+
*/
|
|
32
|
+
get direction() {
|
|
33
|
+
return this.orientation == NavigationTabsOrientation.HORIZONTAL ? "Left" : "Top";
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Getter for the dimension to check based on current orientation.
|
|
37
|
+
*/
|
|
38
|
+
get dimension() {
|
|
39
|
+
return this.orientation == NavigationTabsOrientation.HORIZONTAL ? "Width" : "Height";
|
|
40
|
+
}
|
|
41
|
+
get tabs() {
|
|
42
|
+
return Array.from(this.nav.children);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Scroll into view to center the tab.
|
|
46
|
+
*/
|
|
47
|
+
scrollToTab(tabElement) {
|
|
48
|
+
const scrollOptions = (this.orientation === NavigationTabsOrientation.HORIZONTAL
|
|
49
|
+
? { block: "nearest", inline: "center" }
|
|
50
|
+
: { block: "center", inline: "nearest" });
|
|
51
|
+
tabElement.scrollIntoView(Object.assign({ behavior: "smooth" }, scrollOptions));
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Scroll the navigation bar half of its size backward.
|
|
55
|
+
*/
|
|
56
|
+
navigateBackwards() {
|
|
57
|
+
this.nav.scrollBy({
|
|
58
|
+
[this.direction.toLowerCase()]: 0 - this.nav[`client${this.dimension}`] / 2,
|
|
59
|
+
behavior: "smooth",
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Scroll the navigation bar half of its size forward.
|
|
64
|
+
*/
|
|
65
|
+
navigateForward() {
|
|
66
|
+
this.nav.scrollBy({
|
|
67
|
+
[this.direction.toLowerCase()]: this.nav[`scroll${this.direction}`] + this.nav[`client${this.dimension}`] / 2,
|
|
68
|
+
behavior: "smooth",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Check if a keyboard event was triggered by an arrow key.
|
|
73
|
+
*/
|
|
74
|
+
isArrowNavigation(e) {
|
|
75
|
+
return Object.values(NavigationTabsKeyboardEvents).includes(e.key);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Check if navigation buttons can be enabled for each direction.
|
|
79
|
+
*/
|
|
80
|
+
checkScrollEnabled() {
|
|
81
|
+
if (!this.nav) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
this.canNavigateNext =
|
|
85
|
+
this.nav[`scroll${this.direction}`] + this.nav[`client${this.dimension}`] < this.nav[`scroll${this.dimension}`];
|
|
86
|
+
this.canNavigatePrev = this.nav[`scroll${this.direction}`] > 0;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* When the selected tab changes, update the `aria-selected` attribute on each tab and scroll to the selected tab.
|
|
90
|
+
*/
|
|
91
|
+
onTabSelected() {
|
|
92
|
+
this.tabs.forEach((tab, i) => {
|
|
93
|
+
const zicon = tab.querySelector("z-icon");
|
|
94
|
+
const strokeIcon = zicon === null || zicon === void 0 ? void 0 : zicon.getAttribute("name").replace("-filled", "");
|
|
95
|
+
if (i !== this.selectedTab) {
|
|
96
|
+
tab.setAttribute("aria-selected", "false");
|
|
97
|
+
tab.tabIndex = -1;
|
|
98
|
+
zicon === null || zicon === void 0 ? void 0 : zicon.setAttribute("name", strokeIcon);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
zicon === null || zicon === void 0 ? void 0 : zicon.setAttribute("name", `${strokeIcon}-filled`);
|
|
102
|
+
tab.tabIndex = 0;
|
|
103
|
+
tab.setAttribute("aria-selected", "true");
|
|
104
|
+
});
|
|
105
|
+
this.scrollToTab(this.tabs[this.selectedTab]);
|
|
106
|
+
this.selected.emit(this.selectedTab);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Check if the navigation buttons are needed on window resize.
|
|
110
|
+
*/
|
|
111
|
+
checkScrollVisible() {
|
|
112
|
+
if (!this.nav) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
this.canNavigate = this.nav[`scroll${this.dimension}`] > this.nav[`client${this.dimension}`];
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Handle click on the tabs.
|
|
119
|
+
* @param event `click` event triggered by a child tab
|
|
120
|
+
*/
|
|
121
|
+
handleTabClick(event) {
|
|
122
|
+
const clickedTab = event.target.closest("[role='tab']");
|
|
123
|
+
if (!this.tabs.some((child) => child.contains(clickedTab))) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
this.selectedTab = this.tabs.indexOf(clickedTab);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Move focus through tabs when an arrow key is pressed.
|
|
130
|
+
* When `TAB` is pressed, focus the currently selected tab if any.
|
|
131
|
+
*/
|
|
132
|
+
navigateThroughTabs(event) {
|
|
133
|
+
if (!this.tabs.some((tab) => tab.contains(event.target))) {
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
if (event.key === KeyboardCode.TAB) {
|
|
137
|
+
this.focusedTab = this.selectedTab || 0;
|
|
138
|
+
this.tabs[this.focusedTab].focus({ preventScroll: true });
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (!this.isArrowNavigation(event)) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
event.preventDefault();
|
|
145
|
+
this.tabs[this.focusedTab].tabIndex = -1;
|
|
146
|
+
if ((event.key === NavigationTabsKeyboardEvents.RIGHT && this.orientation == NavigationTabsOrientation.HORIZONTAL) ||
|
|
147
|
+
(event.key === NavigationTabsKeyboardEvents.DOWN && this.orientation == NavigationTabsOrientation.VERTICAL)) {
|
|
148
|
+
// Move forward
|
|
149
|
+
this.focusedTab++;
|
|
150
|
+
if (this.focusedTab >= this.tabs.length) {
|
|
151
|
+
this.focusedTab = 0;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
else if ((event.key === NavigationTabsKeyboardEvents.LEFT && this.orientation == NavigationTabsOrientation.HORIZONTAL) ||
|
|
155
|
+
(event.key === NavigationTabsKeyboardEvents.UP && this.orientation == NavigationTabsOrientation.VERTICAL)) {
|
|
156
|
+
// Move backward
|
|
157
|
+
this.focusedTab--;
|
|
158
|
+
if (this.focusedTab < 0) {
|
|
159
|
+
this.focusedTab = this.tabs.length - 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
// Ignore disabled tabs
|
|
163
|
+
if (this.tabs[this.focusedTab].hasAttribute("disabled") &&
|
|
164
|
+
this.tabs[this.focusedTab].getAttribute("disabled") !== "false") {
|
|
165
|
+
return this.navigateThroughTabs(event);
|
|
166
|
+
}
|
|
167
|
+
this.tabs[this.focusedTab].tabIndex = 0;
|
|
168
|
+
this.tabs[this.focusedTab].focus();
|
|
169
|
+
this.scrollToTab(this.tabs[this.focusedTab]);
|
|
170
|
+
}
|
|
171
|
+
componentDidRender() {
|
|
172
|
+
this.checkScrollVisible();
|
|
173
|
+
}
|
|
174
|
+
componentDidLoad() {
|
|
175
|
+
// Set role and tabindex to each slotted tab
|
|
176
|
+
this.tabs.forEach((tab) => {
|
|
177
|
+
tab.setAttribute("role", "tab");
|
|
178
|
+
tab.tabIndex = -1;
|
|
179
|
+
});
|
|
180
|
+
this.tabs[0].tabIndex = 0;
|
|
181
|
+
if (this.selectedTab !== undefined) {
|
|
182
|
+
this.onTabSelected();
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
render() {
|
|
186
|
+
return (h(Host, { class: {
|
|
187
|
+
"interactive-2": this.size === NavigationTabsSize.SMALL,
|
|
188
|
+
"interactive-1": this.size !== NavigationTabsSize.SMALL,
|
|
189
|
+
}, scrollable: this.canNavigate }, this.canNavigate && (h("button", { class: "navigation-button", onClick: this.navigateBackwards.bind(this), tabIndex: -1, disabled: !this.canNavigatePrev, "aria-label": "Mostra elementi precedenti" }, h("z-icon", { name: this.orientation === NavigationTabsOrientation.HORIZONTAL ? "chevron-left" : "chevron-up", width: 16, height: 16 }))), h("nav", { role: "tablist", "aria-label": this.ariaLabel, ref: (el) => (this.nav = el !== null && el !== void 0 ? el : this.nav), onScroll: this.checkScrollEnabled.bind(this), "aria-orientation": this.orientation }, h("slot", null)), this.canNavigate && (h("button", { class: "navigation-button", onClick: this.navigateForward.bind(this), onKeyDown: (e) => {
|
|
190
|
+
this.navigateThroughTabs(e);
|
|
191
|
+
}, tabindex: "-1", disabled: !this.canNavigateNext, "aria-label": "Mostra elementi successivi" }, h("z-icon", { name: this.orientation === NavigationTabsOrientation.HORIZONTAL ? "chevron-right" : "chevron-down", width: 16, height: 16 })))));
|
|
192
|
+
}
|
|
193
|
+
static get is() { return "z-navigation-tabs"; }
|
|
194
|
+
static get originalStyleUrls() {
|
|
195
|
+
return {
|
|
196
|
+
"$": ["styles.css"]
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
static get styleUrls() {
|
|
200
|
+
return {
|
|
201
|
+
"$": ["styles.css"]
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
static get properties() {
|
|
205
|
+
return {
|
|
206
|
+
"ariaLabel": {
|
|
207
|
+
"type": "string",
|
|
208
|
+
"mutable": false,
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "string",
|
|
211
|
+
"resolved": "string",
|
|
212
|
+
"references": {}
|
|
213
|
+
},
|
|
214
|
+
"required": false,
|
|
215
|
+
"optional": true,
|
|
216
|
+
"docs": {
|
|
217
|
+
"tags": [],
|
|
218
|
+
"text": "Set `aria-label` attribute to the internal `<nav>` element with `tablist` role."
|
|
219
|
+
},
|
|
220
|
+
"attribute": "aria-label",
|
|
221
|
+
"reflect": false
|
|
222
|
+
},
|
|
223
|
+
"orientation": {
|
|
224
|
+
"type": "string",
|
|
225
|
+
"mutable": false,
|
|
226
|
+
"complexType": {
|
|
227
|
+
"original": "NavigationTabsOrientation",
|
|
228
|
+
"resolved": "NavigationTabsOrientation.HORIZONTAL | NavigationTabsOrientation.VERTICAL",
|
|
229
|
+
"references": {}
|
|
230
|
+
},
|
|
231
|
+
"required": false,
|
|
232
|
+
"optional": true,
|
|
233
|
+
"docs": {
|
|
234
|
+
"tags": [],
|
|
235
|
+
"text": "Navigation tabs orientation."
|
|
236
|
+
},
|
|
237
|
+
"attribute": "orientation",
|
|
238
|
+
"reflect": true,
|
|
239
|
+
"defaultValue": "NavigationTabsOrientation.HORIZONTAL"
|
|
240
|
+
},
|
|
241
|
+
"size": {
|
|
242
|
+
"type": "string",
|
|
243
|
+
"mutable": false,
|
|
244
|
+
"complexType": {
|
|
245
|
+
"original": "NavigationTabsSize",
|
|
246
|
+
"resolved": "NavigationTabsSize.BIG | NavigationTabsSize.SMALL",
|
|
247
|
+
"references": {}
|
|
248
|
+
},
|
|
249
|
+
"required": false,
|
|
250
|
+
"optional": true,
|
|
251
|
+
"docs": {
|
|
252
|
+
"tags": [],
|
|
253
|
+
"text": "Navigation tabs size."
|
|
254
|
+
},
|
|
255
|
+
"attribute": "size",
|
|
256
|
+
"reflect": true,
|
|
257
|
+
"defaultValue": "NavigationTabsSize.BIG"
|
|
258
|
+
},
|
|
259
|
+
"selectedTab": {
|
|
260
|
+
"type": "number",
|
|
261
|
+
"mutable": true,
|
|
262
|
+
"complexType": {
|
|
263
|
+
"original": "number",
|
|
264
|
+
"resolved": "number",
|
|
265
|
+
"references": {}
|
|
266
|
+
},
|
|
267
|
+
"required": false,
|
|
268
|
+
"optional": false,
|
|
269
|
+
"docs": {
|
|
270
|
+
"tags": [],
|
|
271
|
+
"text": "Index of the selected tab."
|
|
272
|
+
},
|
|
273
|
+
"attribute": "selected-tab",
|
|
274
|
+
"reflect": false,
|
|
275
|
+
"defaultValue": "undefined"
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
static get states() {
|
|
280
|
+
return {
|
|
281
|
+
"canNavigate": {},
|
|
282
|
+
"canNavigatePrev": {},
|
|
283
|
+
"canNavigateNext": {}
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
static get events() {
|
|
287
|
+
return [{
|
|
288
|
+
"method": "selected",
|
|
289
|
+
"name": "selected",
|
|
290
|
+
"bubbles": true,
|
|
291
|
+
"cancelable": true,
|
|
292
|
+
"composed": true,
|
|
293
|
+
"docs": {
|
|
294
|
+
"tags": [],
|
|
295
|
+
"text": "Emitted when the selected tab changes."
|
|
296
|
+
},
|
|
297
|
+
"complexType": {
|
|
298
|
+
"original": "number",
|
|
299
|
+
"resolved": "number",
|
|
300
|
+
"references": {}
|
|
301
|
+
}
|
|
302
|
+
}];
|
|
303
|
+
}
|
|
304
|
+
static get elementRef() { return "host"; }
|
|
305
|
+
static get watchers() {
|
|
306
|
+
return [{
|
|
307
|
+
"propName": "canNavigate",
|
|
308
|
+
"methodName": "checkScrollEnabled"
|
|
309
|
+
}, {
|
|
310
|
+
"propName": "selectedTab",
|
|
311
|
+
"methodName": "onTabSelected"
|
|
312
|
+
}];
|
|
313
|
+
}
|
|
314
|
+
static get listeners() {
|
|
315
|
+
return [{
|
|
316
|
+
"name": "resize",
|
|
317
|
+
"method": "checkScrollVisible",
|
|
318
|
+
"target": "window",
|
|
319
|
+
"capture": false,
|
|
320
|
+
"passive": true
|
|
321
|
+
}, {
|
|
322
|
+
"name": "click",
|
|
323
|
+
"method": "handleTabClick",
|
|
324
|
+
"target": undefined,
|
|
325
|
+
"capture": false,
|
|
326
|
+
"passive": false
|
|
327
|
+
}, {
|
|
328
|
+
"name": "keydown",
|
|
329
|
+
"method": "navigateThroughTabs",
|
|
330
|
+
"target": undefined,
|
|
331
|
+
"capture": false,
|
|
332
|
+
"passive": false
|
|
333
|
+
}];
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
2
|
+
const tabs = document.querySelector("z-navigation-tabs");
|
|
3
|
+
tabs?.addEventListener("selected", ({detail: selectedTab}) => {
|
|
4
|
+
const controlledPanel = tabs.querySelectorAll('[role="tab"]')?.[selectedTab]?.getAttribute("aria-controls");
|
|
5
|
+
const panels = Array.from(document.querySelectorAll('[role="tabpanel"]'));
|
|
6
|
+
panels.forEach((panel) => (panel.hidden = true));
|
|
7
|
+
const panelToActivate = panels.find((panel) => panel.id === controlledPanel);
|
|
8
|
+
if (panelToActivate) {
|
|
9
|
+
panelToActivate.hidden = false;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
});
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
z-navigation-tabs {
|
|
2
|
+
--z-navigation-tabs-nav-buttons-bg: ;
|
|
3
|
+
--z-navigation-tabs-nav-buttons-fg: ;
|
|
4
|
+
|
|
5
|
+
position: relative;
|
|
6
|
+
z-index: 0;
|
|
7
|
+
display: flex;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
flex-direction: row;
|
|
10
|
+
font-family: var(--font-family-sans);
|
|
11
|
+
font-weight: var(--font-rg);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
z-navigation-tabs,
|
|
15
|
+
z-navigation-tabs * {
|
|
16
|
+
box-sizing: border-box;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
z-navigation-tabs > nav::-webkit-scrollbar {
|
|
20
|
+
display: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.navigation-button {
|
|
24
|
+
position: absolute;
|
|
25
|
+
z-index: 1;
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
padding: 0;
|
|
30
|
+
border: none;
|
|
31
|
+
margin: 0;
|
|
32
|
+
background-color: var(--z-navigation-tabs-nav-buttons-bg, var(--color-surface01));
|
|
33
|
+
border-radius: var(--border-no-radius);
|
|
34
|
+
box-shadow: 0 0 4px 1px var(--shadow-color-base);
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
fill: var(--z-navigation-tabs-nav-buttons-fg, var(--color-primary01));
|
|
37
|
+
outline: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
z-navigation-tabs .navigation-button:disabled {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
z-navigation-tabs > nav {
|
|
45
|
+
z-index: 0;
|
|
46
|
+
display: flex;
|
|
47
|
+
overflow: auto;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: flex-start;
|
|
50
|
+
scroll-behavior: smooth;
|
|
51
|
+
|
|
52
|
+
/* hide scrollbar in Firefox */
|
|
53
|
+
scrollbar-width: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
z-navigation-tabs[orientation="horizontal"] > nav {
|
|
57
|
+
width: 100%;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
z-navigation-tabs[orientation="horizontal"] .navigation-button {
|
|
61
|
+
top: 0;
|
|
62
|
+
width: calc(var(--space-unit) * 4);
|
|
63
|
+
height: 100%;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
z-navigation-tabs[orientation="horizontal"] .navigation-button:first-child {
|
|
67
|
+
left: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
z-navigation-tabs[orientation="horizontal"] .navigation-button:last-child {
|
|
71
|
+
right: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/* Orientation vertical */
|
|
75
|
+
z-navigation-tabs[orientation="vertical"] {
|
|
76
|
+
width: fit-content;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
z-navigation-tabs[orientation="vertical"] > nav {
|
|
81
|
+
height: 100%;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
align-items: stretch;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
z-navigation-tabs[orientation="vertical"] .navigation-button {
|
|
87
|
+
left: 0;
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: calc(var(--space-unit) * 4);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
z-navigation-tabs[orientation="vertical"] .navigation-button:first-child {
|
|
93
|
+
top: 0;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
z-navigation-tabs[orientation="vertical"] .navigation-button:last-child {
|
|
97
|
+
bottom: 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
z-navigation-tabs[size="small"][orientation="vertical"] .navigation-button {
|
|
101
|
+
height: calc(var(--space-unit) * 4);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Style for the tabs */
|
|
105
|
+
|
|
106
|
+
z-navigation-tabs > nav > * {
|
|
107
|
+
position: relative;
|
|
108
|
+
z-index: 0;
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
width: auto;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
padding: calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);
|
|
114
|
+
border: none;
|
|
115
|
+
margin: 0;
|
|
116
|
+
background-color: unset;
|
|
117
|
+
border-radius: var(--border-no-radius);
|
|
118
|
+
color: var(--color-primary01);
|
|
119
|
+
cursor: pointer;
|
|
120
|
+
fill: currentcolor;
|
|
121
|
+
font-family: var(--font-family-sans);
|
|
122
|
+
font-size: inherit;
|
|
123
|
+
gap: var(--space-unit);
|
|
124
|
+
letter-spacing: inherit;
|
|
125
|
+
line-height: inherit;
|
|
126
|
+
outline: none;
|
|
127
|
+
text-align: center;
|
|
128
|
+
white-space: nowrap;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
z-navigation-tabs > nav > a {
|
|
132
|
+
text-decoration: none;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
z-navigation-tabs > nav > *:focus:focus-visible {
|
|
136
|
+
z-index: 1;
|
|
137
|
+
box-shadow: inset 0 0 4px 3px var(--color-highlight);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
z-navigation-tabs > nav > :not([disabled]):hover {
|
|
141
|
+
background-color: var(--color-surface02);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
z-navigation-tabs > nav > button[disabled] {
|
|
145
|
+
color: var(--color-disabled03);
|
|
146
|
+
cursor: not-allowed;
|
|
147
|
+
fill: currentcolor;
|
|
148
|
+
pointer-events: all;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
z-navigation-tabs > nav > :not([disabled]):hover,
|
|
152
|
+
nav > [aria-selected="true"] {
|
|
153
|
+
color: var(--color-hover-secondary);
|
|
154
|
+
fill: currentcolor;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
z-navigation-tabs > nav > :not([disabled]):hover::after,
|
|
158
|
+
nav > [aria-selected="true"]::after {
|
|
159
|
+
position: absolute;
|
|
160
|
+
background-color: var(--color-hover-secondary);
|
|
161
|
+
content: "";
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
z-navigation-tabs[orientation="horizontal"] > nav > :not([disabled]):hover::after,
|
|
165
|
+
z-navigation-tabs[orientation="horizontal"] > nav > [aria-selected="true"]::after {
|
|
166
|
+
bottom: 0;
|
|
167
|
+
left: 0;
|
|
168
|
+
width: 100%;
|
|
169
|
+
height: var(--border-size-large);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
z-navigation-tabs > nav > * z-icon {
|
|
173
|
+
--z-icon-width: calc(var(--space-unit) * 2);
|
|
174
|
+
--z-icon-height: calc(var(--space-unit) * 2);
|
|
175
|
+
|
|
176
|
+
display: flex;
|
|
177
|
+
margin: 0;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/* `small` size (only available for horizontal orientation) */
|
|
181
|
+
|
|
182
|
+
z-navigation-tabs[size="small"][orientation="horizontal"] > nav > * {
|
|
183
|
+
padding: var(--space-unit) calc(var(--space-unit) * 2);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
z-navigation-tabs[size="small"][orientation="horizontal"] > nav > :not([disabled]):hover::after,
|
|
187
|
+
z-navigation-tabs[size="small"][orientation="horizontal"] > nav > [aria-selected="true"]::after {
|
|
188
|
+
height: var(--border-size-medium);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
z-navigation-tabs[size="small"]:not([orientation="vertical"]) > nav > * z-icon {
|
|
192
|
+
--z-icon-width: 14px;
|
|
193
|
+
--z-icon-height: 14px;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/* Orientation Vertical */
|
|
197
|
+
|
|
198
|
+
z-navigation-tabs[orientation="vertical"] > nav > * {
|
|
199
|
+
padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 2);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
z-navigation-tabs[orientation="vertical"] > nav > * > :not(z-icon) {
|
|
203
|
+
display: none;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
z-navigation-tabs[orientation="vertical"] > nav > :not([disabled]):hover::after,
|
|
207
|
+
z-navigation-tabs[orientation="vertical"] > nav > [aria-selected="true"]::after {
|
|
208
|
+
top: 0;
|
|
209
|
+
right: 0;
|
|
210
|
+
width: var(--border-size-large);
|
|
211
|
+
height: 100%;
|
|
212
|
+
}
|
|
@@ -128,7 +128,7 @@ export class ZPopover {
|
|
|
128
128
|
}
|
|
129
129
|
if (!e.composedPath().includes(this.host)) {
|
|
130
130
|
const target = e.target;
|
|
131
|
-
const triggerElemClicked = this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);
|
|
131
|
+
const triggerElemClicked = this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(CSS.escape(this.bindTo));
|
|
132
132
|
if (triggerElemClicked) {
|
|
133
133
|
e.stopPropagation();
|
|
134
134
|
}
|
|
@@ -172,7 +172,7 @@ export class ZPopover {
|
|
|
172
172
|
setPosition() {
|
|
173
173
|
let element;
|
|
174
174
|
if (typeof this.bindTo === "string") {
|
|
175
|
-
element = this.host.ownerDocument.querySelector(this.bindTo);
|
|
175
|
+
element = this.host.ownerDocument.querySelector(CSS.escape(this.bindTo));
|
|
176
176
|
}
|
|
177
177
|
else if (this.bindTo) {
|
|
178
178
|
element = this.bindTo;
|
|
@@ -87,7 +87,8 @@ z-navigation-tab:not([disabled]):hover > * {
|
|
|
87
87
|
background-color: var(--color-background);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
z-navigation-tab[disabled] >
|
|
90
|
+
z-navigation-tab[disabled] > *,
|
|
91
|
+
z-navigation-tab-link[disabled] > * {
|
|
91
92
|
color: var(--gray500);
|
|
92
93
|
cursor: not-allowed;
|
|
93
94
|
fill: currentcolor;
|
|
@@ -109,7 +110,7 @@ z-navigation-tab-link[size="small"][orientation="horizontal"] > * {
|
|
|
109
110
|
|
|
110
111
|
z-navigation-tab[size="small"][orientation="horizontal"]:not([disabled]):hover > *::after,
|
|
111
112
|
z-navigation-tab[size="small"][orientation="horizontal"][selected] > *::after,
|
|
112
|
-
z-navigation-tab-link[size="small"][orientation="horizontal"]:hover > *::after,
|
|
113
|
+
z-navigation-tab-link[size="small"][orientation="horizontal"]:not([disabled]):hover > *::after,
|
|
113
114
|
z-navigation-tab-link[size="small"][orientation="horizontal"][selected] > *::after {
|
|
114
115
|
height: var(--border-size-medium);
|
|
115
116
|
}
|
|
@@ -126,9 +127,9 @@ z-navigation-tab-link[orientation="vertical"] > * {
|
|
|
126
127
|
padding: calc(var(--space-unit) * 3) calc(var(--space-unit) * 2);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
|
-
z-navigation-tab[orientation="vertical"]:
|
|
130
|
+
z-navigation-tab[orientation="vertical"]:not([disabled]):hover > *::after,
|
|
130
131
|
z-navigation-tab[orientation="vertical"][selected] > *::after,
|
|
131
|
-
z-navigation-tab-link[orientation="vertical"]:hover > *::after,
|
|
132
|
+
z-navigation-tab-link[orientation="vertical"]:not([disabled]):hover > *::after,
|
|
132
133
|
z-navigation-tab-link[orientation="vertical"][selected] > *::after {
|
|
133
134
|
top: 0;
|
|
134
135
|
right: 0;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { NavigationTabsOrientation, NavigationTabsSize } from "
|
|
3
|
-
import { ICONS } from "
|
|
2
|
+
import { NavigationTabsOrientation, NavigationTabsSize } from "../../beans";
|
|
3
|
+
import { ICONS } from "../../components/icons/icons";
|
|
4
4
|
/**
|
|
5
5
|
* Single tab component to use inside `z-navigation-tabs`. It renders a button.
|
|
6
6
|
* This component uses the `tab` role:
|
|
@@ -161,7 +161,7 @@ export class ZNavigationTab {
|
|
|
161
161
|
"references": {
|
|
162
162
|
"NavigationTabsOrientation": {
|
|
163
163
|
"location": "import",
|
|
164
|
-
"path": "
|
|
164
|
+
"path": "../../beans"
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
},
|
|
@@ -184,7 +184,7 @@ export class ZNavigationTab {
|
|
|
184
184
|
"references": {
|
|
185
185
|
"NavigationTabsSize": {
|
|
186
186
|
"location": "import",
|
|
187
|
-
"path": "
|
|
187
|
+
"path": "../../beans"
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
},
|
|
@@ -209,7 +209,10 @@ export class ZNavigationTab {
|
|
|
209
209
|
"required": false,
|
|
210
210
|
"optional": false,
|
|
211
211
|
"docs": {
|
|
212
|
-
"tags": [
|
|
212
|
+
"tags": [{
|
|
213
|
+
"name": "deprecated",
|
|
214
|
+
"text": "Use a native `<button>` instead."
|
|
215
|
+
}],
|
|
213
216
|
"text": "Name of the icon to use.\nThe `filled` version will be automatically used (if found) when the tab is `selected`."
|
|
214
217
|
},
|
|
215
218
|
"attribute": "icon",
|
package/dist/collection/{components/navigation/tabs → deprecated}/z-navigation-tab-link/index.js
RENAMED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { NavigationTabsOrientation, NavigationTabsSize } from "
|
|
3
|
-
import { ICONS } from "
|
|
2
|
+
import { NavigationTabsOrientation, NavigationTabsSize } from "../../beans";
|
|
3
|
+
import { ICONS } from "../../components/icons/icons";
|
|
4
4
|
/**
|
|
5
5
|
* Single tab component to use inside `z-navigation-tabs`. It renders an anchor element.
|
|
6
6
|
* This component uses the `tab` role:
|
|
7
7
|
* @link https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/tab_role
|
|
8
|
+
* @deprecated Use a native `<a>` instead.
|
|
8
9
|
*/
|
|
9
10
|
export class ZNavigationTabLink {
|
|
10
11
|
constructor() {
|
|
@@ -35,6 +36,9 @@ export class ZNavigationTabLink {
|
|
|
35
36
|
button.scrollIntoView(Object.assign({ behavior: "smooth" }, scrollOptions));
|
|
36
37
|
}
|
|
37
38
|
onClick() {
|
|
39
|
+
if (this.disabled) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
38
42
|
this.selected = true;
|
|
39
43
|
}
|
|
40
44
|
onSelected() {
|
|
@@ -56,7 +60,7 @@ export class ZNavigationTabLink {
|
|
|
56
60
|
return h("z-icon", { name: icon });
|
|
57
61
|
}
|
|
58
62
|
render() {
|
|
59
|
-
return (h(Host, { role: "tab", id: this.tabId, "aria-selected": this.selected ? "true" : "false", "aria-controls": this.ariaControls }, h("a", { tabIndex: this.selected ? 0 : -1, onFocus: this.scrollToTab.bind(this), href:
|
|
63
|
+
return (h(Host, { role: "tab", id: this.tabId, "aria-selected": this.selected ? "true" : "false", "aria-controls": this.ariaControls }, h("a", { tabIndex: this.selected ? 0 : -1, onFocus: this.scrollToTab.bind(this), href: this.disabled ? null : this.href, title: this.htmlTitle, target: this.target }, this.icon && this.renderIcon(), this.orientation === "horizontal" && this.label)));
|
|
60
64
|
}
|
|
61
65
|
static get is() { return "z-navigation-tab-link"; }
|
|
62
66
|
static get originalStyleUrls() {
|