@zanichelli/albe-web-components 9.3.0-rc1 → 10.0.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/CHANGELOG.md +17 -0
- package/dist/cjs/index-e3299e0a.js +16 -20
- 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 +1056 -0
- package/dist/cjs/z-book-card.cjs.entry.js +5 -1
- package/dist/cjs/z-breadcrumb.cjs.entry.js +1 -1
- package/dist/cjs/z-date-picker.cjs.entry.js +477 -0
- package/dist/cjs/z-dragdrop-area_2.cjs.entry.js +1016 -0
- package/dist/cjs/z-navigation-tab-link.cjs.entry.js +4 -4
- package/dist/cjs/z-navigation-tab.cjs.entry.js +4 -4
- package/dist/cjs/z-navigation-tabs.cjs.entry.js +36 -44
- package/dist/cjs/z-panel-elem.cjs.entry.js +6 -2
- package/dist/cjs/z-select.cjs.entry.js +333 -0
- package/dist/cjs/z-skip-to-content.cjs.entry.js +10 -2
- package/dist/collection/collection-manifest.json +1 -4
- package/dist/collection/components/modal/z-modal/styles.css +2 -6
- package/dist/collection/components/navigation/tabs/navigation-tab.css +2 -1
- package/dist/collection/components/navigation/tabs/z-navigation-tab/index.js +19 -8
- package/dist/collection/components/navigation/tabs/z-navigation-tab-link/index.js +19 -8
- package/dist/collection/components/navigation/tabs/z-navigation-tabs/index.js +35 -43
- package/dist/collection/components/navigation/tabs/z-navigation-tabs/index.stories.js +11 -0
- package/dist/collection/components/navigation/tabs/z-navigation-tabs/styles.css +2 -2
- package/dist/collection/components/panel/z-panel-elem/index.js +6 -2
- package/dist/collection/components/panel/z-panel-elem/styles.css +9 -2
- package/dist/collection/components/z-book-card/index.js +23 -1
- package/dist/collection/components/z-breadcrumb/index.js +1 -1
- package/dist/collection/components/z-skip-to-content/index.js +9 -1
- package/dist/collection/components/z-skip-to-content/styles.css +18 -17
- package/dist/esm/{index-8528dee0.js → index-1b2e3e53.js} +1 -1
- package/dist/esm/index-a2ca4b97.js +16 -20
- package/dist/esm/{index-5b83b0b1.js → index-d3dfe710.js} +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-6c83dfcb.js → utils-4d2d99d9.js} +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/z-app-header_11.entry.js +1042 -0
- package/dist/esm/z-book-card.entry.js +6 -2
- package/dist/esm/z-breadcrumb.entry.js +2 -2
- package/dist/esm/z-chip.entry.js +1 -1
- package/dist/esm/z-combobox.entry.js +1 -1
- package/dist/esm/z-date-picker.entry.js +473 -0
- package/dist/esm/z-dragdrop-area_2.entry.js +1011 -0
- package/dist/esm/z-file-upload.entry.js +1 -1
- package/dist/esm/z-myz-card-info.entry.js +1 -1
- package/dist/esm/z-myz-list-item.entry.js +1 -1
- package/dist/esm/z-navigation-tab-link.entry.js +5 -5
- package/dist/esm/z-navigation-tab.entry.js +5 -5
- package/dist/esm/z-navigation-tabs.entry.js +36 -44
- package/dist/esm/z-panel-elem.entry.js +6 -2
- package/dist/esm/z-pocket_3.entry.js +1 -1
- package/dist/esm/z-select.entry.js +329 -0
- package/dist/esm/z-skip-to-content.entry.js +11 -3
- package/dist/esm/z-slideshow.entry.js +1 -1
- package/dist/esm/z-table-deprecated.entry.js +2 -2
- package/dist/esm/z-table-header.entry.js +2 -2
- package/dist/esm/z-table.entry.js +2 -2
- package/dist/esm/z-toggle-switch.entry.js +1 -1
- package/dist/esm/z-tr.entry.js +2 -2
- package/dist/types/components/navigation/tabs/z-navigation-tab/index.d.ts +11 -5
- package/dist/types/components/navigation/tabs/z-navigation-tab-link/index.d.ts +11 -7
- package/dist/types/components/navigation/tabs/z-navigation-tabs/index.d.ts +4 -4
- package/dist/types/components/z-book-card/index.d.ts +4 -0
- package/dist/types/components.d.ts +28 -120
- package/dist/types/{components/navigation → deprecated}/z-link/index.d.ts +1 -1
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/p-06d2f371.entry.js +1 -0
- package/dist/web-components-library/p-09be4e46.entry.js +1 -0
- package/dist/web-components-library/p-113762ff.entry.js +1 -0
- package/dist/web-components-library/p-1976afea.entry.js +1 -0
- package/dist/web-components-library/{p-7eb6d043.entry.js → p-1cbd8a5f.entry.js} +1 -1
- package/dist/web-components-library/{p-c99acff4.entry.js → p-2d0ac109.entry.js} +1 -1
- package/dist/web-components-library/p-2d600a28.entry.js +1 -0
- package/dist/web-components-library/{p-dca0db1b.entry.js → p-2f013f10.entry.js} +1 -1
- package/dist/web-components-library/p-36487afc.entry.js +1 -0
- package/dist/web-components-library/{p-13ac8bd3.entry.js → p-37e8194f.entry.js} +1 -1
- package/dist/web-components-library/p-386bdb7f.entry.js +1 -0
- package/dist/web-components-library/p-3e61bad0.entry.js +1 -0
- package/dist/web-components-library/{p-327b7b79.js → p-65dd23d7.js} +1 -1
- package/dist/web-components-library/{p-b3093245.entry.js → p-69bde29c.entry.js} +1 -1
- package/dist/web-components-library/p-6b6453ba.entry.js +1 -0
- package/dist/web-components-library/{p-aa8b0c95.entry.js → p-8b2bf3b4.entry.js} +1 -1
- package/dist/web-components-library/p-9829f5bd.entry.js +16 -0
- package/dist/web-components-library/{p-432a2f5b.entry.js → p-a6a09ce6.entry.js} +1 -1
- package/{www/build/p-7f43e400.entry.js → dist/web-components-library/p-c1f20cec.entry.js} +1 -1
- package/dist/web-components-library/p-c97d133c.entry.js +1 -0
- package/dist/web-components-library/{p-c8bd65d9.entry.js → p-cb07de86.entry.js} +1 -1
- package/dist/web-components-library/{p-eb9fa72b.js → p-d7668580.js} +1 -1
- package/dist/web-components-library/p-dd17b462.entry.js +1 -0
- package/dist/web-components-library/{p-91447194.js → p-dd3e0b4e.js} +1 -1
- package/dist/web-components-library/p-f5b5f897.entry.js +1 -0
- package/dist/web-components-library/p-fef8f2e1.entry.js +1 -0
- package/dist/web-components-library/web-components-library.css +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +2 -2
- package/react/components.d.ts +0 -3
- package/react/components.js +2 -5
- package/react/components.js.map +1 -1
- package/www/build/index.esm.js +1 -1
- package/www/build/p-06d2f371.entry.js +1 -0
- package/www/build/p-09be4e46.entry.js +1 -0
- package/www/build/p-113762ff.entry.js +1 -0
- package/www/build/p-1976afea.entry.js +1 -0
- package/www/build/{p-7eb6d043.entry.js → p-1cbd8a5f.entry.js} +1 -1
- package/www/build/{p-c99acff4.entry.js → p-2d0ac109.entry.js} +1 -1
- package/www/build/p-2d600a28.entry.js +1 -0
- package/www/build/{p-dca0db1b.entry.js → p-2f013f10.entry.js} +1 -1
- package/www/build/p-36487afc.entry.js +1 -0
- package/www/build/{p-13ac8bd3.entry.js → p-37e8194f.entry.js} +1 -1
- package/www/build/p-386bdb7f.entry.js +1 -0
- package/www/build/p-3e61bad0.entry.js +1 -0
- package/www/build/{p-327b7b79.js → p-65dd23d7.js} +1 -1
- package/www/build/{p-b3093245.entry.js → p-69bde29c.entry.js} +1 -1
- package/www/build/p-6b6453ba.entry.js +1 -0
- package/www/build/{p-aa8b0c95.entry.js → p-8b2bf3b4.entry.js} +1 -1
- package/www/build/p-9829f5bd.entry.js +16 -0
- package/www/build/{p-432a2f5b.entry.js → p-a6a09ce6.entry.js} +1 -1
- package/www/build/p-ac088d9a.css +2 -0
- package/{dist/web-components-library/p-7f43e400.entry.js → www/build/p-c1f20cec.entry.js} +1 -1
- package/www/build/p-c97d133c.entry.js +1 -0
- package/www/build/{p-c8bd65d9.entry.js → p-cb07de86.entry.js} +1 -1
- package/www/build/{p-eb9fa72b.js → p-d7668580.js} +1 -1
- package/www/build/p-d8829c48.js +1 -0
- package/www/build/p-dd17b462.entry.js +1 -0
- package/www/build/{p-91447194.js → p-dd3e0b4e.js} +1 -1
- package/www/build/p-f5b5f897.entry.js +1 -0
- package/www/build/p-fef8f2e1.entry.js +1 -0
- package/www/build/web-components-library.css +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -59
- package/dist/cjs/z-app-header_14.cjs.entry.js +0 -2828
- package/dist/cjs/z-body.cjs.entry.js +0 -18
- package/dist/cjs/z-dragdrop-area.cjs.entry.js +0 -37
- package/dist/cjs/z-heading.cjs.entry.js +0 -18
- package/dist/cjs/z-typography.cjs.entry.js +0 -30
- package/dist/collection/deprecated/typography/z-body/index.js +0 -68
- package/dist/collection/deprecated/typography/z-heading/index.js +0 -68
- package/dist/collection/deprecated/typography/z-typography/index.js +0 -91
- package/dist/collection/deprecated/typography/z-typography/styles.css +0 -65
- package/dist/esm/z-app-header_14.entry.js +0 -2811
- package/dist/esm/z-body.entry.js +0 -14
- package/dist/esm/z-dragdrop-area.entry.js +0 -33
- package/dist/esm/z-heading.entry.js +0 -14
- package/dist/esm/z-typography.entry.js +0 -26
- package/dist/types/deprecated/typography/z-body/index.d.ts +0 -9
- package/dist/types/deprecated/typography/z-heading/index.d.ts +0 -9
- package/dist/types/deprecated/typography/z-typography/index.d.ts +0 -11
- package/dist/web-components-library/p-052c06ac.entry.js +0 -1
- package/dist/web-components-library/p-3ee4aa12.entry.js +0 -1
- package/dist/web-components-library/p-438f017e.entry.js +0 -1
- package/dist/web-components-library/p-4423b00c.entry.js +0 -1
- package/dist/web-components-library/p-466c3c0b.entry.js +0 -1
- package/dist/web-components-library/p-52b084fb.entry.js +0 -1
- package/dist/web-components-library/p-5ac6109d.entry.js +0 -1
- package/dist/web-components-library/p-625d603e.entry.js +0 -1
- package/dist/web-components-library/p-76c2c26d.entry.js +0 -1
- package/dist/web-components-library/p-b2420056.entry.js +0 -1
- package/dist/web-components-library/p-bbeb69ae.entry.js +0 -1
- package/dist/web-components-library/p-c1de287b.entry.js +0 -1
- package/dist/web-components-library/p-d147e995.entry.js +0 -1
- package/dist/web-components-library/p-e78ce8ec.entry.js +0 -1
- package/dist/web-components-library/p-f01f4e9b.entry.js +0 -16
- package/www/build/p-052c06ac.entry.js +0 -1
- package/www/build/p-39b528a6.js +0 -129
- package/www/build/p-3ee4aa12.entry.js +0 -1
- package/www/build/p-438f017e.entry.js +0 -1
- package/www/build/p-4423b00c.entry.js +0 -1
- package/www/build/p-466c3c0b.entry.js +0 -1
- package/www/build/p-52b084fb.entry.js +0 -1
- package/www/build/p-5a0a4f69.css +0 -1653
- package/www/build/p-5ac6109d.entry.js +0 -1
- package/www/build/p-625d603e.entry.js +0 -1
- package/www/build/p-76c2c26d.entry.js +0 -1
- package/www/build/p-b2420056.entry.js +0 -1
- package/www/build/p-bbeb69ae.entry.js +0 -1
- package/www/build/p-c1de287b.entry.js +0 -1
- package/www/build/p-d147e995.entry.js +0 -1
- package/www/build/p-e78ce8ec.entry.js +0 -1
- package/www/build/p-f01f4e9b.entry.js +0 -16
- /package/dist/collection/{components/navigation → deprecated}/z-link/index.js +0 -0
- /package/dist/collection/{components/navigation → deprecated}/z-link/styles.css +0 -0
|
@@ -6,7 +6,7 @@ const index = require('./index-e3299e0a.js');
|
|
|
6
6
|
const index$1 = require('./index-e8ce94a1.js');
|
|
7
7
|
const icons = require('./icons-7da210ed.js');
|
|
8
8
|
|
|
9
|
-
const navigationTabCss = "z-navigation-tab>button,z-navigation-tab-link>a{position:relative;z-index:0;display:inline-flex;width:auto;align-items:center;justify-content:center;padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);border:none;margin:0;background-color:unset;border-radius:var(--border-no-radius);color:var(--color-primary01);cursor:pointer;fill:currentcolor;font-family:var(--font-family-sans);font-size:inherit;letter-spacing:inherit;line-height:inherit;outline:none;text-align:center;white-space:nowrap}z-navigation-tab-link>a{text-decoration:none}z-navigation-tab *,z-navigation-tab-link *,z-navigation-tab *::before,z-navigation-tab *::after,z-navigation-tab-link *::before,z-navigation-tab-link *::after{box-sizing:border-box}z-navigation-tab>*:focus:focus-visible,z-navigation-tab-link>*:focus:focus-visible{box-shadow:inset var(--
|
|
9
|
+
const navigationTabCss = "z-navigation-tab>button,z-navigation-tab-link>a{position:relative;z-index:0;display:inline-flex;width:auto;align-items:center;justify-content:center;padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);border:none;margin:0;background-color:unset;border-radius:var(--border-no-radius);color:var(--color-primary01);cursor:pointer;fill:currentcolor;font-family:var(--font-family-sans);font-size:inherit;letter-spacing:inherit;line-height:inherit;outline:none;text-align:center;white-space:nowrap}z-navigation-tab-link>a{text-decoration:none}z-navigation-tab *,z-navigation-tab-link *,z-navigation-tab *::before,z-navigation-tab *::after,z-navigation-tab-link *::before,z-navigation-tab-link *::after{box-sizing:border-box}z-navigation-tab>*:focus:focus-visible,z-navigation-tab-link>*:focus:focus-visible{z-index:1;box-shadow:inset 0 0 4px 3px var(--color-highlight)}z-navigation-tab:not([disabled]):hover>*,z-navigation-tab[selected]>*,z-navigation-tab-link:not([disabled]):hover>*,z-navigation-tab-link[selected]>*{color:var(--color-hover-secondary);fill:currentcolor}z-navigation-tab:not([disabled]):hover>*::after,z-navigation-tab[selected]>*::after,z-navigation-tab-link:not([disabled]):hover>*::after,z-navigation-tab-link[selected]>*::after{position:absolute;background-color:var(--color-hover-secondary);content:\"\"}z-navigation-tab[orientation=\"horizontal\"]:not([disabled]):hover>*::after,z-navigation-tab[orientation=\"horizontal\"][selected]>*::after,z-navigation-tab-link[orientation=\"horizontal\"]:not([disabled]):hover>*::after,z-navigation-tab-link[orientation=\"horizontal\"][selected]>*::after{bottom:0;left:0;width:100%;height:var(--border-size-large)}z-navigation-tab z-icon,z-navigation-tab-link z-icon{--z-icon-width:calc(var(--space-unit) * 2);--z-icon-height:calc(var(--space-unit) * 2);display:flex;margin:0}z-navigation-tab[orientation=\"horizontal\"] z-icon,z-navigation-tab-link[orientation=\"horizontal\"] z-icon{margin-right:var(--space-unit)}z-navigation-tab:not([disabled]):hover>*{background-color:var(--color-background)}z-navigation-tab[disabled]>*{color:var(--gray500);cursor:not-allowed;fill:currentcolor;pointer-events:all}z-navigation-tab[size=\"small\"]>*,z-navigation-tab-link[size=\"small\"]>*{font-size:var(--font-size-2);letter-spacing:0.16px;line-height:1.4}z-navigation-tab[size=\"small\"][orientation=\"horizontal\"]>*,z-navigation-tab-link[size=\"small\"][orientation=\"horizontal\"]>*{padding:var(--space-unit) calc(var(--space-unit) * 2)}z-navigation-tab[size=\"small\"][orientation=\"horizontal\"]:not([disabled]):hover>*::after,z-navigation-tab[size=\"small\"][orientation=\"horizontal\"][selected]>*::after,z-navigation-tab-link[size=\"small\"][orientation=\"horizontal\"]:hover>*::after,z-navigation-tab-link[size=\"small\"][orientation=\"horizontal\"][selected]>*::after{height:var(--border-size-medium)}z-navigation-tab[size=\"small\"]:not([orientation=\"vertical\"]) z-icon,z-navigation-tab-link[size=\"small\"]:not([orientation=\"vertical\"]) z-icon{--z-icon-width:14px;--z-icon-height:14px}z-navigation-tab[orientation=\"vertical\"]>*,z-navigation-tab-link[orientation=\"vertical\"]>*{padding:calc(var(--space-unit) * 3) calc(var(--space-unit) * 2)}z-navigation-tab[orientation=\"vertical\"]:hover:not([disabled])>*::after,z-navigation-tab[orientation=\"vertical\"][selected]>*::after,z-navigation-tab-link[orientation=\"vertical\"]:hover>*::after,z-navigation-tab-link[orientation=\"vertical\"][selected]>*::after{top:0;right:0;width:var(--border-size-large);height:100%}";
|
|
10
10
|
|
|
11
11
|
const ZNavigationTabLink = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -33,9 +33,9 @@ const ZNavigationTabLink = class {
|
|
|
33
33
|
* Scroll into view to center the tab.
|
|
34
34
|
*/
|
|
35
35
|
scrollToTab({ target: button }) {
|
|
36
|
-
const scrollOptions = this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL
|
|
36
|
+
const scrollOptions = (this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL
|
|
37
37
|
? { block: "nearest", inline: "center" }
|
|
38
|
-
: { block: "center", inline: "nearest" };
|
|
38
|
+
: { block: "center", inline: "nearest" });
|
|
39
39
|
button.scrollIntoView(Object.assign({ behavior: "smooth" }, scrollOptions));
|
|
40
40
|
}
|
|
41
41
|
onClick() {
|
|
@@ -60,7 +60,7 @@ const ZNavigationTabLink = class {
|
|
|
60
60
|
return index.h("z-icon", { name: icon });
|
|
61
61
|
}
|
|
62
62
|
render() {
|
|
63
|
-
return (index.h(
|
|
63
|
+
return (index.h(index.Host, { role: "tab", id: this.tabId, "aria-selected": this.selected ? "true" : "false", "aria-controls": this.ariaControls }, index.h("a", { tabIndex: this.selected ? 0 : -1, onFocus: this.scrollToTab.bind(this), href: !this.disabled && this.href, title: this.htmlTitle, target: this.target }, this.icon && this.renderIcon(), this.orientation === "horizontal" && this.label)));
|
|
64
64
|
}
|
|
65
65
|
static get watchers() { return {
|
|
66
66
|
"selected": ["onSelected"]
|
|
@@ -6,7 +6,7 @@ const index = require('./index-e3299e0a.js');
|
|
|
6
6
|
const index$1 = require('./index-e8ce94a1.js');
|
|
7
7
|
const icons = require('./icons-7da210ed.js');
|
|
8
8
|
|
|
9
|
-
const navigationTabCss = "z-navigation-tab>button,z-navigation-tab-link>a{position:relative;z-index:0;display:inline-flex;width:auto;align-items:center;justify-content:center;padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);border:none;margin:0;background-color:unset;border-radius:var(--border-no-radius);color:var(--color-primary01);cursor:pointer;fill:currentcolor;font-family:var(--font-family-sans);font-size:inherit;letter-spacing:inherit;line-height:inherit;outline:none;text-align:center;white-space:nowrap}z-navigation-tab-link>a{text-decoration:none}z-navigation-tab *,z-navigation-tab-link *,z-navigation-tab *::before,z-navigation-tab *::after,z-navigation-tab-link *::before,z-navigation-tab-link *::after{box-sizing:border-box}z-navigation-tab>*:focus:focus-visible,z-navigation-tab-link>*:focus:focus-visible{box-shadow:inset var(--
|
|
9
|
+
const navigationTabCss = "z-navigation-tab>button,z-navigation-tab-link>a{position:relative;z-index:0;display:inline-flex;width:auto;align-items:center;justify-content:center;padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 5);border:none;margin:0;background-color:unset;border-radius:var(--border-no-radius);color:var(--color-primary01);cursor:pointer;fill:currentcolor;font-family:var(--font-family-sans);font-size:inherit;letter-spacing:inherit;line-height:inherit;outline:none;text-align:center;white-space:nowrap}z-navigation-tab-link>a{text-decoration:none}z-navigation-tab *,z-navigation-tab-link *,z-navigation-tab *::before,z-navigation-tab *::after,z-navigation-tab-link *::before,z-navigation-tab-link *::after{box-sizing:border-box}z-navigation-tab>*:focus:focus-visible,z-navigation-tab-link>*:focus:focus-visible{z-index:1;box-shadow:inset 0 0 4px 3px var(--color-highlight)}z-navigation-tab:not([disabled]):hover>*,z-navigation-tab[selected]>*,z-navigation-tab-link:not([disabled]):hover>*,z-navigation-tab-link[selected]>*{color:var(--color-hover-secondary);fill:currentcolor}z-navigation-tab:not([disabled]):hover>*::after,z-navigation-tab[selected]>*::after,z-navigation-tab-link:not([disabled]):hover>*::after,z-navigation-tab-link[selected]>*::after{position:absolute;background-color:var(--color-hover-secondary);content:\"\"}z-navigation-tab[orientation=\"horizontal\"]:not([disabled]):hover>*::after,z-navigation-tab[orientation=\"horizontal\"][selected]>*::after,z-navigation-tab-link[orientation=\"horizontal\"]:not([disabled]):hover>*::after,z-navigation-tab-link[orientation=\"horizontal\"][selected]>*::after{bottom:0;left:0;width:100%;height:var(--border-size-large)}z-navigation-tab z-icon,z-navigation-tab-link z-icon{--z-icon-width:calc(var(--space-unit) * 2);--z-icon-height:calc(var(--space-unit) * 2);display:flex;margin:0}z-navigation-tab[orientation=\"horizontal\"] z-icon,z-navigation-tab-link[orientation=\"horizontal\"] z-icon{margin-right:var(--space-unit)}z-navigation-tab:not([disabled]):hover>*{background-color:var(--color-background)}z-navigation-tab[disabled]>*{color:var(--gray500);cursor:not-allowed;fill:currentcolor;pointer-events:all}z-navigation-tab[size=\"small\"]>*,z-navigation-tab-link[size=\"small\"]>*{font-size:var(--font-size-2);letter-spacing:0.16px;line-height:1.4}z-navigation-tab[size=\"small\"][orientation=\"horizontal\"]>*,z-navigation-tab-link[size=\"small\"][orientation=\"horizontal\"]>*{padding:var(--space-unit) calc(var(--space-unit) * 2)}z-navigation-tab[size=\"small\"][orientation=\"horizontal\"]:not([disabled]):hover>*::after,z-navigation-tab[size=\"small\"][orientation=\"horizontal\"][selected]>*::after,z-navigation-tab-link[size=\"small\"][orientation=\"horizontal\"]:hover>*::after,z-navigation-tab-link[size=\"small\"][orientation=\"horizontal\"][selected]>*::after{height:var(--border-size-medium)}z-navigation-tab[size=\"small\"]:not([orientation=\"vertical\"]) z-icon,z-navigation-tab-link[size=\"small\"]:not([orientation=\"vertical\"]) z-icon{--z-icon-width:14px;--z-icon-height:14px}z-navigation-tab[orientation=\"vertical\"]>*,z-navigation-tab-link[orientation=\"vertical\"]>*{padding:calc(var(--space-unit) * 3) calc(var(--space-unit) * 2)}z-navigation-tab[orientation=\"vertical\"]:hover:not([disabled])>*::after,z-navigation-tab[orientation=\"vertical\"][selected]>*::after,z-navigation-tab-link[orientation=\"vertical\"]:hover>*::after,z-navigation-tab-link[orientation=\"vertical\"][selected]>*::after{top:0;right:0;width:var(--border-size-large);height:100%}";
|
|
10
10
|
|
|
11
11
|
const ZNavigationTab = class {
|
|
12
12
|
constructor(hostRef) {
|
|
@@ -33,9 +33,9 @@ const ZNavigationTab = class {
|
|
|
33
33
|
* Scroll into view to center the tab.
|
|
34
34
|
*/
|
|
35
35
|
scrollToTab({ target: button }) {
|
|
36
|
-
const scrollOptions = this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL
|
|
36
|
+
const scrollOptions = (this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL
|
|
37
37
|
? { block: "nearest", inline: "center" }
|
|
38
|
-
: { block: "center", inline: "nearest" };
|
|
38
|
+
: { block: "center", inline: "nearest" });
|
|
39
39
|
button.scrollIntoView(Object.assign({ behavior: "smooth" }, scrollOptions));
|
|
40
40
|
}
|
|
41
41
|
onClick() {
|
|
@@ -62,7 +62,7 @@ const ZNavigationTab = class {
|
|
|
62
62
|
return index.h("z-icon", { name: icon });
|
|
63
63
|
}
|
|
64
64
|
render() {
|
|
65
|
-
return (index.h(
|
|
65
|
+
return (index.h(index.Host, { role: "tab", id: this.tabId, "aria-selected": this.selected ? "true" : "false", "aria-controls": this.ariaControls }, index.h("button", { tabIndex: this.selected ? 0 : -1, onFocus: this.scrollToTab.bind(this), disabled: this.disabled, title: this.htmlTitle }, this.icon && this.renderIcon(), this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL && this.label)));
|
|
66
66
|
}
|
|
67
67
|
static get watchers() { return {
|
|
68
68
|
"selected": ["onSelected"]
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-e3299e0a.js');
|
|
6
6
|
const index$1 = require('./index-e8ce94a1.js');
|
|
7
7
|
|
|
8
|
-
const stylesCss = ":host{position:relative;z-index:0;display:flex;overflow:hidden;flex-direction:row;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host,:host *,::slotted(*){box-sizing:border-box}::-webkit-scrollbar{display:none}.navigation-button{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;padding:0;border:none;margin:0;background:var(--color-white);border-radius:var(--border-no-radius);box-shadow:0 0 4px 1px
|
|
8
|
+
const stylesCss = ":host{position:relative;z-index:0;display:flex;overflow:hidden;flex-direction:row;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host,:host *,::slotted(*){box-sizing:border-box}::-webkit-scrollbar{display:none}.navigation-button{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;padding:0;border:none;margin:0;background:var(--color-white);border-radius:var(--border-no-radius);box-shadow:0 0 4px 1px (--shadow-color-base);cursor:pointer;fill:var(--color-primary01);outline:none}.navigation-button:focus:focus-visible{box-shadow:inset 0 0 4px 3px var(--color-highlight);fill:var(--color-primary01)}.navigation-button:disabled{display:none}nav{display:flex;overflow:auto;align-items:center;justify-content:flex-start;scroll-behavior:smooth;scrollbar-width:none}:host([orientation=\"horizontal\"]) nav{width:100%}:host([orientation=\"horizontal\"]) .navigation-button{top:0;width:calc(var(--space-unit) * 4);height:100%}:host([orientation=\"horizontal\"]) .navigation-button:first-child{left:0}:host([orientation=\"horizontal\"]) .navigation-button:last-child{right:0}:host([orientation=\"vertical\"]){width:fit-content;flex-direction:column}:host([orientation=\"vertical\"]) nav{height:100%;flex-direction:column;align-items:stretch}:host([orientation=\"vertical\"]) .navigation-button{left:0;width:100%;height:calc(var(--space-unit) * 4)}:host([orientation=\"vertical\"]) .navigation-button:first-child{top:0}:host([orientation=\"vertical\"]) .navigation-button:last-child{bottom:0}:host([size=\"small\"][orientation=\"vertical\"]) .navigation-button{height:calc(var(--space-unit) * 4)}";
|
|
9
9
|
|
|
10
10
|
const ZNavigationTabs = class {
|
|
11
11
|
constructor(hostRef) {
|
|
@@ -31,22 +31,23 @@ const ZNavigationTabs = class {
|
|
|
31
31
|
get dimension() {
|
|
32
32
|
return this.orientation == index$1.NavigationTabsOrientation.HORIZONTAL ? "Width" : "Height";
|
|
33
33
|
}
|
|
34
|
+
get tabs() {
|
|
35
|
+
return Array.from(this.host.children);
|
|
36
|
+
}
|
|
34
37
|
/**
|
|
35
38
|
* Set the `size` prop to all `z-navigation-tab` children.
|
|
36
39
|
*/
|
|
37
40
|
setChildrenSize() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
child.setAttribute("size", this.size);
|
|
41
|
+
this.tabs.forEach((tab) => {
|
|
42
|
+
tab.size = this.size;
|
|
41
43
|
});
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* Set the `orientation` prop to all `z-navigation-tab` children.
|
|
45
47
|
*/
|
|
46
48
|
setChildrenOrientation() {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
child.setAttribute("orientation", this.orientation);
|
|
49
|
+
this.tabs.forEach((tab) => {
|
|
50
|
+
tab.orientation = this.orientation;
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
/**
|
|
@@ -77,11 +78,10 @@ const ZNavigationTabs = class {
|
|
|
77
78
|
* @param {CustomEvent} event `selected` event triggered by a child tab
|
|
78
79
|
*/
|
|
79
80
|
onTabSelected(event) {
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
child.removeAttribute("selected");
|
|
81
|
+
const selectedTab = event.target;
|
|
82
|
+
this.tabs.forEach((tab, i) => {
|
|
83
|
+
if (tab !== selectedTab) {
|
|
84
|
+
tab.selected = undefined;
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
87
|
this.tabFocus = i;
|
|
@@ -107,30 +107,31 @@ const ZNavigationTabs = class {
|
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
109
|
/**
|
|
110
|
-
*
|
|
110
|
+
* Move focus through tabs using keyboard arrows.
|
|
111
|
+
* When `TAB` is pressed, focus the currently selected tab, if any.
|
|
111
112
|
*/
|
|
112
113
|
navigateThroughTabs(e) {
|
|
113
|
-
const
|
|
114
|
+
const tabs = this.tabs;
|
|
114
115
|
if (e.key === index$1.KeyboardCode.TAB) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (child.hasAttribute("selected") &&
|
|
118
|
-
((_b = (_a = e.target) === null || _a === void 0 ? void 0 : _a.offsetParent) === null || _b === void 0 ? void 0 : _b.nodeName) === "Z-NAVIGATION-TABS") {
|
|
116
|
+
tabs.forEach((tab, i) => {
|
|
117
|
+
if (tab.selected && tabs.some((tab) => tab === e.target)) {
|
|
119
118
|
this.tabFocus = i;
|
|
120
119
|
}
|
|
121
120
|
});
|
|
121
|
+
tabs[this.tabFocus].children[0].tabIndex = 0;
|
|
122
|
+
tabs[this.tabFocus].children[0].focus();
|
|
122
123
|
return;
|
|
123
124
|
}
|
|
124
125
|
if (!this.isArrowNavigation(e)) {
|
|
125
126
|
return true;
|
|
126
127
|
}
|
|
127
128
|
e.preventDefault();
|
|
128
|
-
|
|
129
|
+
tabs[this.tabFocus].children[0].tabIndex = -1;
|
|
129
130
|
// Move forward
|
|
130
131
|
if ((e.key === index$1.NavigationTabsKeyboardEvents.RIGHT && this.orientation == index$1.NavigationTabsOrientation.HORIZONTAL) ||
|
|
131
132
|
(e.key === index$1.NavigationTabsKeyboardEvents.DOWN && this.orientation == index$1.NavigationTabsOrientation.VERTICAL)) {
|
|
132
133
|
this.tabFocus++;
|
|
133
|
-
if (this.tabFocus >=
|
|
134
|
+
if (this.tabFocus >= tabs.length) {
|
|
134
135
|
this.tabFocus = 0;
|
|
135
136
|
}
|
|
136
137
|
// Move backward
|
|
@@ -139,50 +140,41 @@ const ZNavigationTabs = class {
|
|
|
139
140
|
(e.key === index$1.NavigationTabsKeyboardEvents.UP && this.orientation == index$1.NavigationTabsOrientation.VERTICAL)) {
|
|
140
141
|
this.tabFocus--;
|
|
141
142
|
if (this.tabFocus < 0) {
|
|
142
|
-
this.tabFocus =
|
|
143
|
+
this.tabFocus = tabs.length - 1;
|
|
143
144
|
}
|
|
144
145
|
}
|
|
145
|
-
//ignore disabled tabs
|
|
146
|
-
if (
|
|
146
|
+
// ignore disabled tabs
|
|
147
|
+
if (tabs[this.tabFocus].disabled) {
|
|
147
148
|
this.navigateThroughTabs(e);
|
|
148
149
|
}
|
|
149
150
|
else {
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
tabs[this.tabFocus].children[0].tabIndex = 0;
|
|
152
|
+
tabs[this.tabFocus].children[0].focus();
|
|
152
153
|
}
|
|
153
154
|
}
|
|
154
155
|
/**
|
|
155
|
-
*
|
|
156
|
+
* Check if a keyboard event was triggered by an arrow key.
|
|
156
157
|
*/
|
|
157
158
|
isArrowNavigation(e) {
|
|
158
|
-
return
|
|
159
|
-
}
|
|
160
|
-
setTabindex() {
|
|
161
|
-
var _a;
|
|
162
|
-
const children = Array.from(this.host.children);
|
|
163
|
-
if (children.length > 0) {
|
|
164
|
-
children.forEach((child, i) => {
|
|
165
|
-
var _a;
|
|
166
|
-
child.hasAttribute("aria-selected") && (this.tabFocus = i);
|
|
167
|
-
(_a = child.querySelector('[role="tab"]')) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "-1");
|
|
168
|
-
});
|
|
169
|
-
(_a = children[this.tabFocus].querySelector('[role="tab"]')) === null || _a === void 0 ? void 0 : _a.setAttribute("tabindex", "0");
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
componentWillLoad() {
|
|
173
|
-
this.tabFocus = 0;
|
|
159
|
+
return Object.values(index$1.NavigationTabsKeyboardEvents).includes(e.key);
|
|
174
160
|
}
|
|
175
161
|
componentDidRender() {
|
|
176
162
|
this.setChildrenSize();
|
|
177
163
|
this.setChildrenOrientation();
|
|
178
164
|
this.checkScrollVisible();
|
|
179
|
-
this.
|
|
165
|
+
if (!this.tabFocus) {
|
|
166
|
+
this.tabFocus = 0;
|
|
167
|
+
const tabChild = this.tabs[this.tabFocus].children[0];
|
|
168
|
+
if (tabChild) {
|
|
169
|
+
tabChild.tabIndex = 0;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
180
172
|
}
|
|
181
173
|
render() {
|
|
182
174
|
return (index.h(index.Host, { class: {
|
|
183
175
|
"interactive-2": this.size === index$1.NavigationTabsSize.SMALL,
|
|
184
176
|
"interactive-1": this.size !== index$1.NavigationTabsSize.SMALL,
|
|
185
|
-
}, scrollable: this.canNavigate }, this.canNavigate && (index.h("button", { class: "navigation-button", onClick: this.navigateBackwards.bind(this), tabindex: "-1", disabled: !this.canNavigatePrev }, index.h("z-icon", { name: this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL ? "chevron-left" : "chevron-up", width: 16, height: 16 }))), index.h("nav", { role: "tablist", "aria-label": this.ariaLabel, ref: (el) => (this.tabsNav = el !== null && el !== void 0 ? el : this.tabsNav), onScroll: this.checkScrollEnabled.bind(this) }, index.h("slot", null)), this.canNavigate && (index.h("button", { class: "navigation-button", onClick: this.navigateForward.bind(this), onKeyDown: (e) => {
|
|
177
|
+
}, scrollable: this.canNavigate }, this.canNavigate && (index.h("button", { class: "navigation-button", onClick: this.navigateBackwards.bind(this), tabindex: "-1", disabled: !this.canNavigatePrev }, index.h("z-icon", { name: this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL ? "chevron-left" : "chevron-up", width: 16, height: 16 }))), index.h("nav", { role: "tablist", "aria-label": this.ariaLabel, ref: (el) => (this.tabsNav = el !== null && el !== void 0 ? el : this.tabsNav), onScroll: this.checkScrollEnabled.bind(this), "aria-orientation": this.orientation }, index.h("slot", null)), this.canNavigate && (index.h("button", { class: "navigation-button", onClick: this.navigateForward.bind(this), onKeyDown: (e) => {
|
|
186
178
|
this.navigateThroughTabs(e);
|
|
187
179
|
}, tabindex: "-1", disabled: !this.canNavigateNext }, index.h("z-icon", { name: this.orientation === index$1.NavigationTabsOrientation.HORIZONTAL ? "chevron-right" : "chevron-down", width: 16, height: 16 })))));
|
|
188
180
|
}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e3299e0a.js');
|
|
6
6
|
|
|
7
|
-
const stylesCss = "
|
|
7
|
+
const stylesCss = ".sc-z-panel-elem-h{width:inherit;font-family:var(--dashboard-font);font-weight:var(--font-rg)}.panel-elem-container.sc-z-panel-elem{width:100%}.panel-elem-icon.sc-z-panel-elem{margin:auto calc(var(--space-unit) * 3)}.panel-elem-icon.sc-z-panel-elem img.sc-z-panel-elem{display:block;max-width:96px;height:32px;margin:auto;object-fit:contain}.panel-elem-link.sc-z-panel-elem{display:flex;align-items:center;justify-content:center;margin:var(--space-unit) auto 0;border-radius:var(--border-no-radius);font-size:12px}.panel-elem-link.sc-z-panel-elem>a.z-link.sc-z-panel-elem{padding:calc(var(--space-unit) * 0.5) 0;font-weight:var(--font-sb)}.panel-elem-desc.sc-z-panel-elem{padding-top:var(--space-unit);margin:0;letter-spacing:0.16px;text-align:center}a.sc-z-panel-elem>z-icon.sc-z-panel-elem{margin-right:var(--space-unit)}";
|
|
8
8
|
|
|
9
9
|
const ZPanelElem = class {
|
|
10
10
|
constructor(hostRef) {
|
|
@@ -22,7 +22,11 @@ const ZPanelElem = class {
|
|
|
22
22
|
}
|
|
23
23
|
render() {
|
|
24
24
|
const elemId = this.elemid ? this.elemid : "";
|
|
25
|
-
return (index.h("div", { class: "panel-elem-container" }, (this.imgurl || this.imgalt) && (index.h("div", { "aria-hidden": "true", class: "panel-elem-icon" }, this.renderIcon())), index.h("div", { class: "panel-elem-link" }, index.h("
|
|
25
|
+
return (index.h("div", { class: "panel-elem-container" }, (this.imgurl || this.imgalt) && (index.h("div", { "aria-hidden": "true", class: "panel-elem-icon" }, this.renderIcon())), index.h("div", { class: "panel-elem-link" }, index.h("a", { class: {
|
|
26
|
+
"z-link": true,
|
|
27
|
+
"z-link-disabled": this.isdisabled,
|
|
28
|
+
"z-link-icon": true,
|
|
29
|
+
}, id: elemId + "link_id", href: this.url, target: this.target }, index.h("z-icon", { class: "z-link-icon-left", height: 14, width: 14, name: this.linkicon }), this.linklabel)), this.descrSlotName && (index.h("div", { class: "panel-elem-desc" }, index.h("slot", { name: this.descrSlotName })))));
|
|
26
30
|
}
|
|
27
31
|
};
|
|
28
32
|
ZPanelElem.style = stylesCss;
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-e3299e0a.js');
|
|
6
|
+
const index$1 = require('./index-e8ce94a1.js');
|
|
7
|
+
const utils = require('./utils-4ac02425.js');
|
|
8
|
+
require('./breakpoints-ebe1a437.js');
|
|
9
|
+
|
|
10
|
+
const stylesCss = ".sc-z-select-h{display:inline-block;width:inherit;color:var(--color-text02);font-family:var(--font-family-sans);font-size:var(--font-size-3);font-weight:var(--font-rg)}[size=\"small\"].sc-z-select-h,[size=\"x-small\"].sc-z-select-h{font-size:var(--font-size-2)}.select-wrapper.sc-z-select>z-input.sc-z-select{width:100%}.select-wrapper.sc-z-select>div.sc-z-select{position:relative}.select-wrapper.sc-z-select>div.closed.sc-z-select{overflow:hidden;height:0}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select{position:absolute;width:100%;box-sizing:border-box;padding:calc(var(--space-unit) * 0.5) var(--space-unit);border:var(--border-size-small) solid var(--gray200);border-top:none;background:var(--color-surface01);outline:none}.select-wrapper.sc-z-select .closed.sc-z-select .ul-scroll-wrapper.sc-z-select{z-index:10}.select-wrapper.sc-z-select .open.sc-z-select .ul-scroll-wrapper.sc-z-select{z-index:20}.select-wrapper.sc-z-select .ul-scroll-wrapper.fixed.sc-z-select{position:static}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select{position:relative;overflow:auto;max-height:240px;padding:calc(var(--space-unit) * 0.5);outline:none;scrollbar-color:var(--color-primary01) transparent}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar{width:10px;background:linear-gradient(to right, transparent 0 3px, var(--gray200) 3px 7px, transparent 7px 10px);border-radius:var(--border-radius)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar-track{background-color:transparent}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar-thumb{width:10px;background-color:var(--color-primary01);border-radius:var(--border-radius)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select>z-list.sc-z-select::-webkit-scrollbar-thumb:hover{background-color:var(--color-hover-primary)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-content.sc-z-select{display:block;padding:calc(var(--space-unit) * 0.5) calc(var(--space-unit) * 1.5)}[size=\"x-small\"].sc-z-select-h .select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-content.sc-z-select{padding:0 calc(var(--space-unit) * 1.5)}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select z-list.sc-z-select z-list-element.sc-z-select .list-element-content.selected.sc-z-select{font-weight:bold}.select-wrapper.sc-z-select .ul-scroll-wrapper.sc-z-select .no-results.sc-z-select z-icon.sc-z-select{margin-right:var(--space-unit)}.z-list-group-title.sc-z-select{color:var(--gray800)}.reset-item.sc-z-select{color:var(--color-primary01);fill:var(--color-primary01)}.reset-item-content.sc-z-select{display:flex;align-items:center}.reset-item.reset-item-margin.sc-z-select .reset-item-content.sc-z-select{margin-left:calc(var(--space-unit))}.reset-item.sc-z-select .reset-item-content.sc-z-select>z-icon.sc-z-select{margin-right:var(--space-unit)}.reset-item.hide.sc-z-select{display:none}";
|
|
11
|
+
|
|
12
|
+
const ZSelect = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.optionSelect = index.createEvent(this, "optionSelect", 7);
|
|
16
|
+
this.resetSelect = index.createEvent(this, "resetSelect", 7);
|
|
17
|
+
/** the id of the input element */
|
|
18
|
+
this.htmlid = `id-${utils.randomId()}`;
|
|
19
|
+
/** the input aria-label */
|
|
20
|
+
this.ariaLabel = "";
|
|
21
|
+
/** the input is disabled */
|
|
22
|
+
this.disabled = false;
|
|
23
|
+
/** the input is readonly */
|
|
24
|
+
this.readonly = false;
|
|
25
|
+
/** input helper message (optional) - if set to `false` message won't be displayed */
|
|
26
|
+
this.message = true;
|
|
27
|
+
/** the input has autocomplete option */
|
|
28
|
+
this.autocomplete = false;
|
|
29
|
+
/** no result text message */
|
|
30
|
+
this.noresultslabel = "Nessun risultato";
|
|
31
|
+
/** When fixed, it occupies space and pushes down next elements. */
|
|
32
|
+
this.isfixed = false;
|
|
33
|
+
/** Available sizes: `big`, `small` and `x-small`. Defaults to `big`. */
|
|
34
|
+
this.size = index$1.ControlSize.BIG;
|
|
35
|
+
this.isOpen = false;
|
|
36
|
+
this.selectedItem = null;
|
|
37
|
+
this.itemsList = [];
|
|
38
|
+
this.toggleSelectUl = this.toggleSelectUl.bind(this);
|
|
39
|
+
this.selectItem = this.selectItem.bind(this);
|
|
40
|
+
this.handleSelectFocus = this.handleSelectFocus.bind(this);
|
|
41
|
+
}
|
|
42
|
+
watchItems() {
|
|
43
|
+
this.itemsList = this.getInitialItemsArray();
|
|
44
|
+
this.selectedItem = this.itemsList.find((item) => item.selected);
|
|
45
|
+
}
|
|
46
|
+
/** get the input selected options */
|
|
47
|
+
async getSelectedItem() {
|
|
48
|
+
return this.selectedItem;
|
|
49
|
+
}
|
|
50
|
+
/** get the input value */
|
|
51
|
+
async getValue() {
|
|
52
|
+
return this.getSelectedValue();
|
|
53
|
+
}
|
|
54
|
+
/** set the input value */
|
|
55
|
+
async setValue(value) {
|
|
56
|
+
let values = [];
|
|
57
|
+
if (typeof value === "string") {
|
|
58
|
+
values.push(value);
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
values = value;
|
|
62
|
+
}
|
|
63
|
+
this.selectedItem = this.itemsList.find((item) => values.includes(item.id));
|
|
64
|
+
}
|
|
65
|
+
emitOptionSelect() {
|
|
66
|
+
this.optionSelect.emit({
|
|
67
|
+
id: this.htmlid,
|
|
68
|
+
selected: this.getSelectedValue(),
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
emitResetSelect() {
|
|
72
|
+
this.resetSelect.emit({
|
|
73
|
+
id: this.htmlid,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
componentWillLoad() {
|
|
77
|
+
this.watchItems();
|
|
78
|
+
}
|
|
79
|
+
componentWillRender() {
|
|
80
|
+
this.filterItems(this.searchString);
|
|
81
|
+
}
|
|
82
|
+
getInitialItemsArray() {
|
|
83
|
+
return typeof this.items === "string" ? JSON.parse(this.items) : this.items;
|
|
84
|
+
}
|
|
85
|
+
mapSelectedItemToItemsArray() {
|
|
86
|
+
const initialItemsList = this.getInitialItemsArray();
|
|
87
|
+
return initialItemsList.map((item) => {
|
|
88
|
+
var _a;
|
|
89
|
+
item.selected = item.id === ((_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id);
|
|
90
|
+
return item;
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
getSelectedValue() {
|
|
94
|
+
var _a;
|
|
95
|
+
return (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id;
|
|
96
|
+
}
|
|
97
|
+
filterItems(searchString) {
|
|
98
|
+
const prevList = this.mapSelectedItemToItemsArray();
|
|
99
|
+
if (!(searchString === null || searchString === void 0 ? void 0 : searchString.length)) {
|
|
100
|
+
this.itemsList = prevList;
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.itemsList = prevList
|
|
104
|
+
.filter((item) => {
|
|
105
|
+
return item.name.toUpperCase().includes(searchString.toUpperCase());
|
|
106
|
+
})
|
|
107
|
+
.map((item) => {
|
|
108
|
+
const start = item.name.toUpperCase().indexOf(searchString.toUpperCase());
|
|
109
|
+
const end = start + searchString.length;
|
|
110
|
+
const newName = item.name.substring(0, start) +
|
|
111
|
+
`<strong>${item.name.substring(start, end)}</strong>` +
|
|
112
|
+
item.name.substring(end, item.name.length);
|
|
113
|
+
item.name = newName;
|
|
114
|
+
return item;
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
hasAutocomplete() {
|
|
119
|
+
return utils.boolean(this.autocomplete) === true;
|
|
120
|
+
}
|
|
121
|
+
handleInputChange(e) {
|
|
122
|
+
this.searchString = e.detail.value;
|
|
123
|
+
if (!this.isOpen) {
|
|
124
|
+
this.toggleSelectUl();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
selectItem(item, selected) {
|
|
128
|
+
if (item && item.disabled) {
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
this.itemsList = this.mapSelectedItemToItemsArray();
|
|
132
|
+
this.itemsList = this.itemsList.map((i) => {
|
|
133
|
+
i.selected = false;
|
|
134
|
+
if (i.id === (item === null || item === void 0 ? void 0 : item.id)) {
|
|
135
|
+
i.selected = selected;
|
|
136
|
+
}
|
|
137
|
+
return i;
|
|
138
|
+
});
|
|
139
|
+
this.selectedItem = this.itemsList.find((item) => item.selected);
|
|
140
|
+
this.emitOptionSelect();
|
|
141
|
+
if (this.searchString) {
|
|
142
|
+
this.searchString = null;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
arrowsSelectNav(e, key) {
|
|
146
|
+
const showResetIcon = this.resetItem && !!this.selectedItem;
|
|
147
|
+
const arrows = [index$1.KeyboardCode.ARROW_DOWN, index$1.KeyboardCode.ARROW_UP];
|
|
148
|
+
if (!arrows.includes(e.key)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
e.preventDefault();
|
|
152
|
+
e.stopPropagation();
|
|
153
|
+
if (!this.isOpen) {
|
|
154
|
+
this.toggleSelectUl();
|
|
155
|
+
}
|
|
156
|
+
let index;
|
|
157
|
+
if (this.resetItem) {
|
|
158
|
+
if (e.key === index$1.KeyboardCode.ARROW_DOWN) {
|
|
159
|
+
index = key + 1 === this.itemsList.length + 1 ? +!showResetIcon : key + 1;
|
|
160
|
+
}
|
|
161
|
+
else if (e.key === index$1.KeyboardCode.ARROW_UP) {
|
|
162
|
+
index = key <= +!showResetIcon ? this.itemsList.length : key - 1;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
if (!this.resetItem) {
|
|
166
|
+
if (e.key === index$1.KeyboardCode.ARROW_DOWN) {
|
|
167
|
+
index = key + 1 === this.itemsList.length ? 0 : key + 1;
|
|
168
|
+
}
|
|
169
|
+
else if (e.key === index$1.KeyboardCode.ARROW_UP) {
|
|
170
|
+
index = key <= 0 ? this.itemsList.length - 1 : key - 1;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
this.focusSelectItem(index);
|
|
174
|
+
}
|
|
175
|
+
focusSelectItem(index) {
|
|
176
|
+
const focusElem = this.element.querySelector(`#${this.htmlid}_${index}`);
|
|
177
|
+
if (focusElem) {
|
|
178
|
+
focusElem.focus();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
toggleSelectUl(selfFocusOnClose = false) {
|
|
182
|
+
if (this.disabled || this.readonly) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
if (!this.isOpen) {
|
|
186
|
+
document.addEventListener("click", this.handleSelectFocus);
|
|
187
|
+
document.addEventListener("keyup", this.handleSelectFocus);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
document.removeEventListener("click", this.handleSelectFocus);
|
|
191
|
+
document.removeEventListener("keyup", this.handleSelectFocus);
|
|
192
|
+
if (selfFocusOnClose) {
|
|
193
|
+
this.element.querySelector(`#${this.htmlid}_input`).focus();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
this.isOpen = !this.isOpen;
|
|
197
|
+
}
|
|
198
|
+
handleInputClick(e) {
|
|
199
|
+
const cp = e.composedPath();
|
|
200
|
+
const clearIcon = cp.find((item) => item.classList && item.classList.contains("reset-icon"));
|
|
201
|
+
if (clearIcon) {
|
|
202
|
+
e.stopPropagation();
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
this.toggleSelectUl();
|
|
206
|
+
}
|
|
207
|
+
handleSelectFocus(e) {
|
|
208
|
+
if (e instanceof KeyboardEvent && e.key === index$1.KeyboardCode.ESC) {
|
|
209
|
+
e.stopPropagation();
|
|
210
|
+
return this.toggleSelectUl(true);
|
|
211
|
+
}
|
|
212
|
+
if (e instanceof KeyboardEvent && e.key !== index$1.KeyboardCode.TAB && e.key !== index$1.KeyboardCode.ENTER) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const tree = utils.getElementTree(utils.getClickedElement());
|
|
216
|
+
const parent = tree.find((elem) => {
|
|
217
|
+
return elem.nodeName.toLowerCase() === "z-input" && elem.id === `${this.htmlid}_input`;
|
|
218
|
+
});
|
|
219
|
+
if (!parent) {
|
|
220
|
+
this.toggleSelectUl(e instanceof MouseEvent ? true : false);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
scrollToLetter(letter) {
|
|
224
|
+
const foundItem = this.itemsList.find((item) => item.name.charAt(0) === letter);
|
|
225
|
+
if (foundItem) {
|
|
226
|
+
this.focusSelectItem(this.itemsList.indexOf(foundItem));
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
renderInput() {
|
|
230
|
+
return (index.h("z-input", { class: {
|
|
231
|
+
"active-select": this.isOpen,
|
|
232
|
+
"cursor-select": !this.autocomplete,
|
|
233
|
+
}, id: `${this.htmlid}_input`, htmlid: `${this.htmlid}_input`, placeholder: this.placeholder, value: !this.isOpen && this.selectedItem ? this.selectedItem.name.replace(/<[^>]+>/g, "") : null, label: this.label, "aria-label": this.ariaLabel, icon: this.isOpen ? "caret-up" : "caret-down", hasclearicon: this.hasAutocomplete(), message: false, disabled: this.disabled, readonly: this.readonly || (!this.hasAutocomplete() && this.isOpen), status: this.isOpen ? undefined : this.status, autocomplete: "off", size: this.size, onClick: (e) => {
|
|
234
|
+
this.handleInputClick(e);
|
|
235
|
+
}, onKeyUp: (e) => {
|
|
236
|
+
if (e.keyCode !== 13) {
|
|
237
|
+
e.preventDefault();
|
|
238
|
+
}
|
|
239
|
+
utils.handleKeyboardSubmit(e, this.toggleSelectUl);
|
|
240
|
+
}, onKeyDown: (e) => {
|
|
241
|
+
return this.arrowsSelectNav(e, this.selectedItem ? this.itemsList.indexOf(this.selectedItem) : this.resetItem ? 0 : -1);
|
|
242
|
+
}, onInputChange: (e) => {
|
|
243
|
+
this.handleInputChange(e);
|
|
244
|
+
}, onKeyPress: (e) => {
|
|
245
|
+
if (!this.hasAutocomplete()) {
|
|
246
|
+
e.preventDefault();
|
|
247
|
+
this.scrollToLetter(String.fromCharCode(e.keyCode));
|
|
248
|
+
}
|
|
249
|
+
} }));
|
|
250
|
+
}
|
|
251
|
+
renderSelectUl() {
|
|
252
|
+
var _a;
|
|
253
|
+
return (index.h("div", { class: this.isOpen ? "open" : "closed", tabindex: "-1" }, index.h("div", { class: {
|
|
254
|
+
"ul-scroll-wrapper": true,
|
|
255
|
+
"fixed": this.isfixed,
|
|
256
|
+
}, tabindex: "-1" }, index.h("z-list", { role: "listbox", tabindex: this.disabled || this.readonly || !this.isOpen ? -1 : 0, id: this.htmlid, "aria-activedescendant": (_a = this.selectedItem) === null || _a === void 0 ? void 0 : _a.id, "aria-multiselectable": false, size: this.listSizeType(), class: {
|
|
257
|
+
disabled: this.disabled,
|
|
258
|
+
readonly: this.readonly,
|
|
259
|
+
filled: !!this.selectedItem,
|
|
260
|
+
[`input-${this.status}`]: !this.isOpen && !!this.status,
|
|
261
|
+
} }, this.resetItem && this.renderResetItem(), this.renderSelectUlItems()))));
|
|
262
|
+
}
|
|
263
|
+
renderResetItem() {
|
|
264
|
+
return (index.h("z-list-element", { class: {
|
|
265
|
+
"hide": !this.selectedItem || !this.resetItem,
|
|
266
|
+
"reset-item": true,
|
|
267
|
+
"reset-item-margin": !this.hasGroupItems,
|
|
268
|
+
}, clickable: true, disabled: false, dividerType: index$1.ListDividerType.ELEMENT, role: "option", tabindex: "0", "aria-selected": "false", id: `${this.htmlid}_${this.resetItem ? "0" : "none"}`, size: this.listSizeType(), onClickItem: () => {
|
|
269
|
+
this.selectedItem = null;
|
|
270
|
+
this.searchString = null;
|
|
271
|
+
this.emitResetSelect();
|
|
272
|
+
}, onKeyDown: (e) => this.arrowsSelectNav(e, 0) }, index.h("div", { class: "reset-item-content" }, index.h("z-icon", { name: "multiply-circled" }), index.h("span", null, this.resetItem))));
|
|
273
|
+
}
|
|
274
|
+
renderItem(item, key, lastItem) {
|
|
275
|
+
return (index.h("z-list-element", { clickable: !item.disabled, disabled: item.disabled, dividerType: lastItem ? index$1.ListDividerType.HEADER : index$1.ListDividerType.ELEMENT, role: "option", tabindex: item.disabled || !this.isOpen ? -1 : 0, "aria-selected": !!item.selected, id: `${this.htmlid}_${key}`, size: this.listSizeType(), onClickItem: () => this.selectItem(item, true), onKeyDown: (e) => this.arrowsSelectNav(e, key) }, index.h("span", { class: {
|
|
276
|
+
"selected": !!item.selected,
|
|
277
|
+
"list-element-content": true,
|
|
278
|
+
}, innerHTML: item.name })));
|
|
279
|
+
}
|
|
280
|
+
listSizeType() {
|
|
281
|
+
if (this.size === index$1.ControlSize.SMALL || this.size === index$1.ControlSize.X_SMALL) {
|
|
282
|
+
return index$1.ListSize.SMALL;
|
|
283
|
+
}
|
|
284
|
+
return index$1.ListSize.MEDIUM;
|
|
285
|
+
}
|
|
286
|
+
renderSelectUlItems() {
|
|
287
|
+
if (!this.itemsList.length) {
|
|
288
|
+
return this.renderNoSearchResults();
|
|
289
|
+
}
|
|
290
|
+
if (this.hasGroupItems) {
|
|
291
|
+
return this.renderSelectGroupItems();
|
|
292
|
+
}
|
|
293
|
+
return this.itemsList.map((item, key, array) => {
|
|
294
|
+
const lastItem = array.length === key + 1;
|
|
295
|
+
const itemKey = this.resetItem ? key + 1 : key;
|
|
296
|
+
return this.renderItem(item, itemKey, lastItem);
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
renderSelectGroupItems() {
|
|
300
|
+
const newData = this.itemsList.reduce((group, item, index, array) => {
|
|
301
|
+
var _a;
|
|
302
|
+
const { category } = item;
|
|
303
|
+
const lastItem = array.length === index + 1;
|
|
304
|
+
const itemKey = this.resetItem ? index + 1 : index;
|
|
305
|
+
const zListItem = this.renderItem(item, itemKey, lastItem);
|
|
306
|
+
group[category] = (_a = group[category]) !== null && _a !== void 0 ? _a : [];
|
|
307
|
+
group[category].push(zListItem);
|
|
308
|
+
return group;
|
|
309
|
+
}, {});
|
|
310
|
+
return Object.entries(newData).map(([key, value]) => {
|
|
311
|
+
return (index.h("z-list-group", { "divider-type": index$1.ListDividerType.ELEMENT }, index.h("span", { class: "body-3-sb z-list-group-title", slot: "header-title" }, key), value.map((item) => item)));
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
renderNoSearchResults() {
|
|
315
|
+
return (index.h("z-list-element", { color: "blue500", class: "no-results", size: this.listSizeType() }, index.h("z-icon", { name: "multiply-circle", fill: "blue500" }), this.noresultslabel));
|
|
316
|
+
}
|
|
317
|
+
renderMessage() {
|
|
318
|
+
if (utils.boolean(this.message) === false) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
return (index.h("z-input-message", { message: utils.boolean(this.message) === true ? undefined : this.message, status: this.status, class: this.size }));
|
|
322
|
+
}
|
|
323
|
+
render() {
|
|
324
|
+
return (index.h("div", { class: "select-wrapper" }, this.renderInput(), this.renderSelectUl(), this.renderMessage()));
|
|
325
|
+
}
|
|
326
|
+
get element() { return index.getElement(this); }
|
|
327
|
+
static get watchers() { return {
|
|
328
|
+
"items": ["watchItems"]
|
|
329
|
+
}; }
|
|
330
|
+
};
|
|
331
|
+
ZSelect.style = stylesCss;
|
|
332
|
+
|
|
333
|
+
exports.z_select = ZSelect;
|