@zanichelli/albe-web-components 7.4.0 → 7.4.2
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 +14 -0
- package/dist/cjs/index-e3299e0a.js +10 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/web-components-library.cjs.js +1 -1
- package/dist/cjs/{z-app-header_13.cjs.entry.js → z-app-header_11.cjs.entry.js} +22 -571
- package/dist/cjs/z-breadcrumb.cjs.entry.js +237 -0
- package/dist/cjs/z-popover.cjs.entry.js +328 -0
- package/dist/cjs/z-section-title.cjs.entry.js +1 -1
- package/dist/collection/components/navigation/z-app-header/index.js +1 -1
- package/dist/collection/components/navigation/z-app-header/styles.css +5 -0
- package/dist/collection/components/z-breadcrumb/styles.css +4 -1
- package/dist/collection/components/z-section-title/styles.css +2 -1
- package/dist/esm/index-a2ca4b97.js +10 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-b7bdd1bf.js → utils-825aed23.js} +1 -1
- package/dist/esm/web-components-library.js +1 -1
- package/dist/esm/{z-app-header_13.entry.js → z-app-header_11.entry.js} +24 -571
- package/dist/esm/z-breadcrumb.entry.js +233 -0
- package/dist/esm/z-chip.entry.js +1 -1
- package/dist/esm/z-combobox.entry.js +1 -1
- 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-pocket_3.entry.js +1 -1
- package/dist/esm/z-popover.entry.js +324 -0
- package/dist/esm/z-section-title.entry.js +1 -1
- package/dist/esm/z-select.entry.js +1 -1
- package/dist/esm/z-skip-to-content.entry.js +1 -1
- package/dist/esm/z-slideshow.entry.js +1 -1
- package/dist/esm/z-table-header.entry.js +1 -1
- package/dist/esm/z-toggle-switch.entry.js +1 -1
- package/dist/web-components-library/index.esm.js +1 -1
- package/dist/web-components-library/{p-ac5dda12.entry.js → p-073f24c9.entry.js} +1 -1
- package/dist/web-components-library/{p-d011d1b5.entry.js → p-0b942851.entry.js} +1 -1
- package/dist/web-components-library/{p-1e7ef8ca.entry.js → p-0eb7cb35.entry.js} +1 -1
- package/dist/web-components-library/p-0fd40ac5.entry.js +1 -0
- package/dist/web-components-library/{p-0397366d.js → p-14c2c56c.js} +1 -1
- package/{www/build/p-0235869e.entry.js → dist/web-components-library/p-2e7da553.entry.js} +1 -1
- package/dist/web-components-library/p-39863e41.entry.js +1 -0
- package/dist/web-components-library/p-447a7c51.entry.js +1 -0
- package/dist/web-components-library/{p-bda48953.entry.js → p-5825ef19.entry.js} +1 -1
- package/dist/web-components-library/p-98dcf178.entry.js +1 -0
- package/dist/web-components-library/p-98df8460.entry.js +1 -0
- package/dist/web-components-library/{p-a250409a.entry.js → p-9e400a11.entry.js} +1 -1
- package/dist/web-components-library/{p-485bff7b.entry.js → p-b44030d0.entry.js} +1 -1
- package/dist/web-components-library/p-bc331dde.entry.js +1 -0
- package/dist/web-components-library/{p-c8b36560.entry.js → p-dcad3493.entry.js} +1 -1
- package/dist/web-components-library/{p-c8bdfb84.entry.js → p-fa7a11fd.entry.js} +1 -1
- package/dist/web-components-library/web-components-library.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/index.esm.js +1 -1
- package/www/build/{p-ac5dda12.entry.js → p-073f24c9.entry.js} +1 -1
- package/www/build/{p-d011d1b5.entry.js → p-0b942851.entry.js} +1 -1
- package/www/build/{p-1e7ef8ca.entry.js → p-0eb7cb35.entry.js} +1 -1
- package/www/build/p-0fd40ac5.entry.js +1 -0
- package/www/build/{p-0397366d.js → p-14c2c56c.js} +1 -1
- package/{dist/web-components-library/p-0235869e.entry.js → www/build/p-2e7da553.entry.js} +1 -1
- package/www/build/p-39863e41.entry.js +1 -0
- package/www/build/p-447a7c51.entry.js +1 -0
- package/www/build/{p-bda48953.entry.js → p-5825ef19.entry.js} +1 -1
- package/www/build/p-98dcf178.entry.js +1 -0
- package/www/build/p-98df8460.entry.js +1 -0
- package/www/build/{p-a250409a.entry.js → p-9e400a11.entry.js} +1 -1
- package/www/build/p-a6cbf32c.js +1 -0
- package/www/build/{p-485bff7b.entry.js → p-b44030d0.entry.js} +1 -1
- package/www/build/p-bc331dde.entry.js +1 -0
- package/www/build/{p-c8b36560.entry.js → p-dcad3493.entry.js} +1 -1
- package/www/build/{p-c8bdfb84.entry.js → p-fa7a11fd.entry.js} +1 -1
- package/www/build/web-components-library.esm.js +1 -1
- package/www/index.html +1 -127
- package/dist/web-components-library/p-14ab82cd.entry.js +0 -1
- package/dist/web-components-library/p-515c2acf.entry.js +0 -1
- package/dist/web-components-library/p-685ae50d.entry.js +0 -1
- package/dist/web-components-library/p-a4b91a8f.entry.js +0 -1
- package/www/build/p-14ab82cd.entry.js +0 -1
- package/www/build/p-515c2acf.entry.js +0 -1
- package/www/build/p-685ae50d.entry.js +0 -1
- package/www/build/p-a4b91a8f.entry.js +0 -1
- package/www/build/p-e35c7022.js +0 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a2ca4b97.js';
|
|
2
|
+
import { W as BreadcrumbPathStyle, X as BreadcrumbHomepageVariant, q as Device, P as PopoverPosition, g as KeyboardCode, m as ListDividerType, i as ListSize } from './index-7e4df1be.js';
|
|
3
|
+
import { g as getDevice, a as handleKeyboardSubmit } from './utils-825aed23.js';
|
|
4
|
+
import './breakpoints-9b81eb1b.js';
|
|
5
|
+
|
|
6
|
+
const stylesCss = ":host{font-family:var(--font-family-sans);font-weight:var(--font-rg);--line-clamp-popover:0;--line-clamp-mobile:1}button{padding:0;border:none;margin:0;background-color:transparent}nav{display:flex;height:30px;align-items:center;padding-left:calc(var(--space-unit) / 2);overflow-x:hidden}li{display:flex;align-items:baseline}:host a:focus,:host button:focus{box-shadow:var(--shadow-focus-primary);outline:0}:host a{color:var(--color-link-primary);font-size:var(--font-size-2);text-decoration:none;white-space:nowrap}:host a.homepage-icon{display:list-item}:host a.homepage-text{display:initial;margin-top:calc(var(--space-unit) / 4);margin-right:var(--space-unit)}:host a.missing-path{color:var(--color-text01)}:host a.text-ellipsis{display:-webkit-box !important;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:var(--line-clamp-mobile);text-overflow:ellipsis;white-space:normal}:host ol{display:flex;padding:0;margin:0;list-style-type:none}:host ol>li:not(:first-child,:last-child){margin-right:var(--space-unit)}nav.underlined>ol>li a:not(.missing-path),nav.underlined>ol>li button{text-decoration:underline}nav.semibold>ol>li a:not(.missing-path),nav.semibold>ol>li button{font-weight:var(--font-sb)}:host z-icon{margin-right:var(--space-unit);--z-icon-width:12px;--z-icon-height:12px}:host button.dots{display:inline-block;color:var(--color-link-primary);cursor:pointer}:host .popover-content{max-width:302px;padding:calc(var(--space-unit) / 2) var(--space-unit);text-align:left}:host .popover-content a{font-weight:var(--font-rg);text-decoration:none}:host .hidden-paths-popover{--z-popover-theme--surface:var(--color-surface02);--z-popover-padding:0}:host .full-path-tooltip{--z-popover-theme--surface:var(--color-surface05);--z-popover-theme--text:var(--color-text-inverse);--z-popover-padding:0}:host .tooltip-content{padding:0 var(--space-unit);font-size:var(--font-size-2)}@media (min-width: 768px){:host ol>li+li::before{display:inline-block;width:10px;height:10px;flex:1;margin-right:2px;color:var(--color-disabled03);content:\"\\203A\"}:host a.text-ellipsis{-webkit-line-clamp:var(--line-clamp-popover)}}";
|
|
7
|
+
|
|
8
|
+
const ZBreadcrumb = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.clickOnNode = createEvent(this, "clickOnNode", 7);
|
|
12
|
+
/** [optional] Sets the path style */
|
|
13
|
+
this.pathStyle = BreadcrumbPathStyle.UNDERLINED;
|
|
14
|
+
/** [optional] Variant of first node */
|
|
15
|
+
this.homepageVariant = BreadcrumbHomepageVariant.ICON;
|
|
16
|
+
/** [optional] Sets max number of element to show */
|
|
17
|
+
this.maxNodesToShow = 5;
|
|
18
|
+
/** [optional] Controls the behaviour on <a> tag click/enter */
|
|
19
|
+
this.preventFollowUrl = false;
|
|
20
|
+
/** [optional] Sets max number of row for each path inside the popover. Zero equals unlimited */
|
|
21
|
+
this.overflowMenuItemRows = 0;
|
|
22
|
+
/** [optional] Sets the maximun number of chars per single node */
|
|
23
|
+
this.truncateChar = 30;
|
|
24
|
+
/** Detect whether the length of the nodes shown exceeds the container length */
|
|
25
|
+
this.hasOverflow = false;
|
|
26
|
+
this.popoverEllipsisOpen = false;
|
|
27
|
+
this.collapsedElements = [];
|
|
28
|
+
this.currentIndex = 0;
|
|
29
|
+
this.truncatePosition = null;
|
|
30
|
+
}
|
|
31
|
+
handleResize() {
|
|
32
|
+
this.viewPortWidth = getDevice();
|
|
33
|
+
if (this.viewPortWidth !== Device.MOBILE &&
|
|
34
|
+
this.wrapElement &&
|
|
35
|
+
this.wrapElement.scrollWidth > this.wrapElement.clientWidth) {
|
|
36
|
+
this.hasOverflow = true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
// eslint-disable-next-line lines-between-class-members
|
|
40
|
+
handlePropChange() {
|
|
41
|
+
this.initializeBreadcrumb(this.viewPortWidth === Device.MOBILE);
|
|
42
|
+
}
|
|
43
|
+
handleResizeUp(newValue, oldValue) {
|
|
44
|
+
if (newValue === Device.MOBILE ||
|
|
45
|
+
(oldValue === Device.MOBILE && newValue === Device.TABLET) ||
|
|
46
|
+
(oldValue === Device.MOBILE && newValue === Device.DESKTOP) ||
|
|
47
|
+
(oldValue === Device.MOBILE && newValue === Device.DESKTOP_WIDE) ||
|
|
48
|
+
(oldValue === Device.TABLET && newValue === Device.DESKTOP) ||
|
|
49
|
+
(oldValue === Device.TABLET && newValue === Device.DESKTOP_WIDE) ||
|
|
50
|
+
(oldValue === Device.DESKTOP && newValue === Device.DESKTOP_WIDE)) {
|
|
51
|
+
this.initializeBreadcrumb(this.viewPortWidth === Device.MOBILE);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
componentWillLoad() {
|
|
55
|
+
this.viewPortWidth = getDevice();
|
|
56
|
+
this.initializeBreadcrumb(this.viewPortWidth === Device.MOBILE);
|
|
57
|
+
}
|
|
58
|
+
componentWillRender() {
|
|
59
|
+
if (this.viewPortWidth !== Device.MOBILE && this.hasOverflow) {
|
|
60
|
+
this.checkEllipsisOrOverflowMenu();
|
|
61
|
+
this.hasOverflow = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
componentDidRender() {
|
|
65
|
+
if (this.collapsedElementsRef) {
|
|
66
|
+
this.anchorElements = Array.from(this.hostElement.shadowRoot.querySelectorAll("z-list-group a"));
|
|
67
|
+
}
|
|
68
|
+
if (this.viewPortWidth !== Device.MOBILE && this.wrapElement.scrollWidth > this.wrapElement.clientWidth) {
|
|
69
|
+
this.hasOverflow = true;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
initializeBreadcrumb(isMobile) {
|
|
73
|
+
if (isMobile) {
|
|
74
|
+
this.pathsList = this.getPathsItemsList().filter((item) => !!item.path);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
this.pathsList = this.getPathsItemsList();
|
|
78
|
+
}
|
|
79
|
+
this.totalLenght = this.pathsList.length;
|
|
80
|
+
this.homepageNode = this.pathsList.shift();
|
|
81
|
+
this.pathListCopy = JSON.parse(JSON.stringify(this.pathsList));
|
|
82
|
+
this.collapsedElements = [];
|
|
83
|
+
if (this.totalLenght > this.maxNodesToShow) {
|
|
84
|
+
this.collapsedElements = this.pathsList.splice(0, this.pathsList.length - 2);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
checkEllipsisOrOverflowMenu() {
|
|
88
|
+
if (this.pathListCopy.length > 0) {
|
|
89
|
+
for (let i = 0; i < this.pathsList.length; i++) {
|
|
90
|
+
if (this.pathsList[i].text.length > this.truncateChar) {
|
|
91
|
+
if (this.truncatePosition !== null) {
|
|
92
|
+
if (this.truncatePosition > 0) {
|
|
93
|
+
const arrayToPush = this.pathListCopy.splice(0, this.truncatePosition);
|
|
94
|
+
arrayToPush.forEach((item) => {
|
|
95
|
+
this.collapsedElements.push(item);
|
|
96
|
+
});
|
|
97
|
+
this.pathsList.splice(0, this.truncatePosition);
|
|
98
|
+
this.truncatePosition = 0;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (this.truncatePosition === 0) {
|
|
102
|
+
const arrayToPush = this.pathListCopy.splice(0, this.truncatePosition + 1);
|
|
103
|
+
this.collapsedElements.push(...arrayToPush);
|
|
104
|
+
this.pathsList.splice(0, this.truncatePosition + 1);
|
|
105
|
+
this.truncatePosition = null;
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (i !== this.pathsList.length - 1) {
|
|
110
|
+
const truncatedString = this.truncateWithEllipsis(this.pathsList[i].text, this.truncateChar);
|
|
111
|
+
this.currentEllipsisText = this.pathsList[i].text;
|
|
112
|
+
this.pathsList[i].text = truncatedString;
|
|
113
|
+
this.pathsList[i].hasTooltip = true;
|
|
114
|
+
this.truncatePosition = i;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
truncateWithEllipsis(str, length) {
|
|
122
|
+
const ending = "…";
|
|
123
|
+
if (str.length > length) {
|
|
124
|
+
return str.substring(0, length - 1) + ending;
|
|
125
|
+
}
|
|
126
|
+
return str;
|
|
127
|
+
}
|
|
128
|
+
getPathsItemsList() {
|
|
129
|
+
if (!this.paths) {
|
|
130
|
+
return Array.from(this.hostElement.children).map((item) => {
|
|
131
|
+
return {
|
|
132
|
+
text: item.textContent,
|
|
133
|
+
path: item.href,
|
|
134
|
+
hasTooltip: false,
|
|
135
|
+
};
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
const ret = typeof this.paths === "string" ? JSON.parse(this.paths) : this.paths;
|
|
139
|
+
return ret.map((item) => {
|
|
140
|
+
return Object.assign(Object.assign({}, item), { hasTooltip: false });
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
renderMobileBreadcrumb() {
|
|
144
|
+
const lastPath = this.pathsList[this.pathsList.length - 1];
|
|
145
|
+
return (h("nav", { "aria-label": "Breadcrumb", class: {
|
|
146
|
+
underlined: this.pathStyle === BreadcrumbPathStyle.UNDERLINED,
|
|
147
|
+
semibold: this.pathStyle === BreadcrumbPathStyle.SEMIBOLD,
|
|
148
|
+
} }, h("ol", null, this.renderNode(lastPath, true))));
|
|
149
|
+
}
|
|
150
|
+
renderHomepageNode(item) {
|
|
151
|
+
return (h("li", null, h("a", { class: {
|
|
152
|
+
"homepage-icon": this.homepageVariant === BreadcrumbHomepageVariant.ICON,
|
|
153
|
+
"homepage-text": this.homepageVariant === BreadcrumbHomepageVariant.TEXT,
|
|
154
|
+
}, href: item.path, onClick: (e) => this.handlePreventFollowUrl(e, item) }, this.homepageVariant === BreadcrumbHomepageVariant.ICON ? (h("z-icon", { name: "home", fill: "color-link-primary", height: 16, width: 16 })) : ("Home"))));
|
|
155
|
+
}
|
|
156
|
+
renderNode(item, mobile) {
|
|
157
|
+
return (h("li", null, item.hasTooltip && (h("z-popover", { class: "full-path-tooltip", "bind-to": this.triggerEllipsis, open: this.popoverEllipsisOpen, position: PopoverPosition.BOTTOM, closable: false, showArrow: true }, h("span", { class: "tooltip-content" }, this.currentEllipsisText))), h("a", { class: {
|
|
158
|
+
"missing-path": !item.path,
|
|
159
|
+
"text-ellipsis": mobile,
|
|
160
|
+
}, ref: (val) => (this.triggerEllipsis = val), "aria-current": item.path ? undefined : "page", href: item.path, onClick: (e) => this.handlePreventFollowUrl(e, item), onMouseOver: () => {
|
|
161
|
+
if (item.hasTooltip) {
|
|
162
|
+
this.popoverEllipsisOpen = true;
|
|
163
|
+
}
|
|
164
|
+
}, onMouseLeave: () => {
|
|
165
|
+
if (item.hasTooltip) {
|
|
166
|
+
this.popoverEllipsisOpen = false;
|
|
167
|
+
}
|
|
168
|
+
}, innerHTML: mobile ? `<z-icon fill="color-link-primary" name="chevron-left"></z-icon> ${item.text}` : item.text })));
|
|
169
|
+
}
|
|
170
|
+
renderBreadcrumb() {
|
|
171
|
+
return (h("nav", { ref: (val) => (this.wrapElement = val), "aria-label": "Breadcrumb", class: {
|
|
172
|
+
underlined: this.pathStyle === BreadcrumbPathStyle.UNDERLINED,
|
|
173
|
+
semibold: this.pathStyle === BreadcrumbPathStyle.SEMIBOLD,
|
|
174
|
+
} }, h("ol", null, this.renderHomepageNode(this.homepageNode), this.collapsedElements.length ? this.renderOverflowMenu() : "", this.pathsList.map((item) => this.renderNode(item, false)))));
|
|
175
|
+
}
|
|
176
|
+
togglePopover() {
|
|
177
|
+
if (!this.collapsedElementsRef.open) {
|
|
178
|
+
this.collapsedElementsRef.open = true;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
handlePreventFollowUrl(e, item) {
|
|
182
|
+
if (this.preventFollowUrl) {
|
|
183
|
+
e.preventDefault();
|
|
184
|
+
this.clickOnNode.emit(item.path);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
handleOverflowMenuAccessibility(e) {
|
|
188
|
+
const anchorElementsLenght = this.anchorElements.length;
|
|
189
|
+
if (e.key === KeyboardCode.TAB) {
|
|
190
|
+
e.preventDefault();
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
e.stopPropagation();
|
|
194
|
+
const arrows = [KeyboardCode.ARROW_DOWN, KeyboardCode.ARROW_UP];
|
|
195
|
+
if (arrows.includes(e.key)) {
|
|
196
|
+
e.preventDefault();
|
|
197
|
+
if (e.key === KeyboardCode.ARROW_DOWN) {
|
|
198
|
+
this.currentIndex = anchorElementsLenght === this.currentIndex + 1 ? 0 : this.currentIndex + 1;
|
|
199
|
+
}
|
|
200
|
+
if (e.key === KeyboardCode.ARROW_UP) {
|
|
201
|
+
this.currentIndex = this.currentIndex <= 0 ? anchorElementsLenght - 1 : this.currentIndex - 1;
|
|
202
|
+
}
|
|
203
|
+
this.anchorElements[this.currentIndex].focus();
|
|
204
|
+
}
|
|
205
|
+
if (e.key === KeyboardCode.ESC) {
|
|
206
|
+
this.triggerButton.focus();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
renderOverflowMenu() {
|
|
210
|
+
if (this.collapsedElements.length) {
|
|
211
|
+
return (h("li", null, h("z-popover", { class: "hidden-paths-popover", ref: (val) => (this.collapsedElementsRef = val), "bind-to": this.triggerButton, position: PopoverPosition.BOTTOM_RIGHT, closable: true, showArrow: true }, h("div", { class: "popover-content" }, h("z-list", null, h("z-list-group", { dividerType: ListDividerType.ELEMENT, size: ListSize.SMALL }, this.collapsedElements.map((item) => (h("z-list-element", { clickable: true }, h("a", { class: "text-ellipsis", href: item.path, onClick: (e) => this.handlePreventFollowUrl(e, item), onKeyDown: (e) => this.handleOverflowMenuAccessibility(e) }, item.text)))))))), h("button", { "aria-label": "Mostra pi\u00F9 breadcrumb", "aria-haspopup": "true", ref: (el) => (this.triggerButton = el), class: "dots", onClick: () => {
|
|
212
|
+
this.togglePopover();
|
|
213
|
+
}, onKeyDown: (e) => {
|
|
214
|
+
handleKeyboardSubmit(e, this.togglePopover.bind(this));
|
|
215
|
+
setTimeout(() => {
|
|
216
|
+
this.anchorElements[0].focus();
|
|
217
|
+
}, 100);
|
|
218
|
+
} }, "...")));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
render() {
|
|
222
|
+
return (h(Host, { style: { "--line-clamp": `${this.overflowMenuItemRows}` } }, this.viewPortWidth === Device.MOBILE ? this.renderMobileBreadcrumb() : this.renderBreadcrumb()));
|
|
223
|
+
}
|
|
224
|
+
get hostElement() { return getElement(this); }
|
|
225
|
+
static get watchers() { return {
|
|
226
|
+
"paths": ["handlePropChange"],
|
|
227
|
+
"maxNodesToShow": ["handlePropChange"],
|
|
228
|
+
"viewPortWidth": ["handleResizeUp"]
|
|
229
|
+
}; }
|
|
230
|
+
};
|
|
231
|
+
ZBreadcrumb.style = stylesCss;
|
|
232
|
+
|
|
233
|
+
export { ZBreadcrumb as z_breadcrumb };
|
package/dist/esm/z-chip.entry.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a2ca4b97.js';
|
|
2
2
|
import { y as ZChipType, q as Device } from './index-7e4df1be.js';
|
|
3
|
-
import { g as getDevice } from './utils-
|
|
3
|
+
import { g as getDevice } from './utils-825aed23.js';
|
|
4
4
|
import './breakpoints-9b81eb1b.js';
|
|
5
5
|
|
|
6
6
|
const stylesCss = ".sc-z-chip-h>.z-chip-container.sc-z-chip{display:inline-flex;align-items:center;padding:0 calc(var(--space-unit) * 1.5);border:var(--border-size-small) solid var(--gray400);background-color:var(--bg-white);border-radius:14px;color:var(--text-grey-800);fill:var(--text-grey-800);font-family:var(--dashboard-font);font-size:14px;font-weight:var(--font-sb)}.sc-z-chip-h>.z-chip-container.sc-z-chip:not([aria-disabled]) button.sc-z-chip>z-icon.sc-z-chip:last-child:hover{color:var(--color-hover-primary);fill:var(--color-hover-primary)}.sc-z-chip-h>.z-chip-container.sc-z-chip:hover:not([aria-disabled])>z-icon.sc-z-chip:first-child{fill:var(--color-icon02)}.sc-z-chip-h>.z-chip-container.sc-z-chip>button.sc-z-chip{padding:0;border:none;margin-left:var(--space-unit);background-color:transparent;cursor:pointer}.sc-z-chip-h>.z-chip-container.sc-z-chip>z-icon.icon-sx.sc-z-chip{margin-right:calc(var(--space-unit) / 2)}.sc-z-chip-h>.z-chip-container.sc-z-chip>button.sc-z-chip>z-icon.sc-z-chip:last-child{fill:var(--color-primary01)}.sc-z-chip-h>.z-chip-container[aria-disabled].sc-z-chip,.sc-z-chip-h>.z-chip-container[aria-disabled].sc-z-chip>z-icon.sc-z-chip,.sc-z-chip-h>.z-chip-container[aria-disabled].sc-z-chip>button.sc-z-chip>z-icon.sc-z-chip{color:var(--color-disabled03);fill:var(--color-disabled03)}.sc-z-chip-h>.z-chip-container[aria-disabled].sc-z-chip>button.sc-z-chip>z-icon.sc-z-chip{cursor:auto}.sc-z-chip-h>.z-chip-container[aria-disabled].sc-z-chip{border:var(--border-size-small) solid var(--color-disabled01)}.sc-z-chip-h>.z-chip-container.sc-z-chip>button.sc-z-chip:focus:focus-visible{border-radius:100%;box-shadow:var(--shadow-focus-primary);outline:none}.sc-z-chip-h>button.sc-z-chip:hover:not(:disabled):active:hover>button.sc-z-chip>z-icon.sc-z-chip:last-child{color:var(--color-primary01);fill:var(--color-primary01)}.sc-z-chip-h>div.sc-z-chip{display:inline-flex;min-height:28px;align-items:center;padding:0 calc(var(--space-unit) * 1.5);border:var(--border-size-small) solid var(--bg-grey-200);background-color:var(--bg-white);border-radius:14px;color:var(--text-grey-800);fill:var(--text-grey-800);font-family:var(--dashboard-font);font-size:14px;line-height:28px}.sc-z-chip-h>div.sc-z-chip>z-icon.sc-z-chip{margin-right:calc(var(--space-unit) / 2)}.sc-z-chip-h>.z-chip-container.default.sc-z-chip,.sc-z-chip-h>div.default.sc-z-chip{min-height:44px;border-radius:22px;line-height:44px}.sc-z-chip-h>.z-chip-container.medium.sc-z-chip,.sc-z-chip-h>div.medium.sc-z-chip{min-height:40px;border-radius:22px;line-height:40px}.sc-z-chip-h>.z-chip-container.small.sc-z-chip,.sc-z-chip-h>div.small.sc-z-chip{min-height:36px;border-radius:22px;line-height:36px}@media only screen and (min-width: 1152px){.sc-z-chip-h>.z-chip-container.sc-z-chip{font-size:12px}.sc-z-chip-h>div.sc-z-chip{font-size:12px}.sc-z-chip-h>.z-chip-container.default.sc-z-chip,.sc-z-chip-h>div.default.sc-z-chip{min-height:32px;border-radius:16px;line-height:32px}.sc-z-chip-h>.z-chip-container.medium.sc-z-chip,.sc-z-chip-h>div.medium.sc-z-chip{min-height:28px;border-radius:16px;line-height:28px}.sc-z-chip-h>.z-chip-container.small.sc-z-chip,.sc-z-chip-h>div.small.sc-z-chip{min-height:24px;border-radius:16px;line-height:24px}}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-a2ca4b97.js';
|
|
2
2
|
import { e as ControlSize, I as InputType, K as KeyboardKeyCode, m as ListDividerType } from './index-7e4df1be.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a as handleKeyboardSubmit } from './utils-825aed23.js';
|
|
4
4
|
import './breakpoints-9b81eb1b.js';
|
|
5
5
|
|
|
6
6
|
const stylesCss = ":host{display:block}:host>div.fixed{position:relative}:host>div>.header{position:relative;z-index:10;display:flex;min-height:42px;align-items:center;justify-content:space-between;padding:0 calc(var(--space-unit) * 1.5);border:var(--border-size-small) solid var(--bg-grey-700);margin:0;background-color:var(--bg-white);border-radius:var(--border-radius-small);cursor:pointer}:host([size=\"small\"])>div>.header{min-height:34px;font-size:var(--font-size-2)}:host([size=\"x-small\"])>div>.header{min-height:30px;font-size:var(--font-size-2)}:host([size=\"x-small\"])>div>.header p.body-3{padding:calc(var(--space-unit) * 0.5) 0}:host>div>.header:hover{outline:var(--border-size-medium) solid var(--gray700);outline-offset:-2px}:host>div.open>div.header:focus:focus-visible{box-shadow:none}:host>div>div.header:focus:focus-visible{box-shadow:var(--shadow-focus-primary);outline:none}:host>div>.header>p.body-3{padding:var(--space-unit) 0;margin:0;color:var(--text-grey-800)}:host>div>.header>p.body-3>span{font-weight:var(--font-sb)}:host>div>.header>z-icon{fill:var(--text-grey-800);transform:rotate(360deg);transition:all 200ms linear}:host>div>.header>z-icon.small,:host>div>.header>z-icon.x-small{--z-icon-width:16px;--z-icon-height:16px}:host>div.open>.header{border:var(--border-size-small) solid var(--blue500);border-radius:var(--border-radius-small) var(--border-radius-small) 0 0}:host>div.disabled{pointer-events:none}:host>div.disabled .header{border-color:var(--color-disabled01);fill:var(--color-disabled01)}:host>div.disabled .header>p.body-3{color:var(--text-grey-700)}:host>div.disabled .header>z-icon:last-child{fill:var(--color-disabled01)}:host>div.open>.header>z-icon{fill:var(--text-grey-800);transform:rotate(180deg);transition:all 200ms linear}:host>div.open>div.open-combo-data{position:relative;z-index:12;padding:var(--space-unit) calc(var(--space-unit) * 2);border:var(--border-size-small) solid var(--gray200);border-top:0;background-color:var(--bg-white);border-radius:0}:host>div.open>div.open-combo-data>div{overflow:auto;max-height:235px;padding:0;scrollbar-color:var(--myz-blue) var(--gray200);scrollbar-width:thin}:host>div.open>div.open-combo-data>z-input{width:100%;margin-bottom:calc(var(--space-unit) * 2)}:host>div.open>div.open-combo-data>div>ul{max-height:235px;padding:0 3px;margin:0}::-webkit-scrollbar{width:10px;background:linear-gradient(90deg, var(--bg-white) 2px, var(--bg-grey-200) 4px, var(--bg-white) 8px);border-radius:var(--border-radius)}::-webkit-scrollbar-thumb{width:10px;background-color:var(--myz-blue);border-radius:var(--border-radius)}:host>div.open>z-input{position:relative;z-index:1;width:238px;margin:0 calc(var(--space-unit) * 2);color:var(--myz-blue)}:host>div.open>div.open-combo-data>div.search{overflow:hidden;max-height:auto;margin-top:0;box-shadow:1px 1px 4px 2px rgb(217 222 227 / 50%)}:host>div.open>div.open-combo-data>div.search>ul{overflow:auto;max-height:180px;padding:var(--space-unit) calc(var(--space-unit) * 2);scrollbar-color:var(--myz-blue) var(--bg-grey-200);scrollbar-width:thin}:host>div.open>div.open-combo-data>div.search>div{display:flex;justify-content:center}:host>div.open>div.open-combo-data>div.search>div>a{display:inline-block;height:44px;color:var(--myz-blue);cursor:pointer;font-family:var(--dashboard-font);font-size:14px;font-weight:var(--font-sb);line-height:44px;text-align:center;text-transform:uppercase}:host>div.open>div.open-combo-data>div.check-all-wrapper{padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 0.5);border-bottom:var(--border-size-small) solid var(--gray800);margin-bottom:var(--space-unit);text-align:left}:host([size=\"small\"])>div.open>div.open-combo-data>div.check-all-wrapper{padding:calc(var(--space-unit) * 1.5) calc(var(--space-unit) * 0.5)}:host([size=\"x-small\"])>div.open>div.open-combo-data>div.check-all-wrapper{padding:var(--space-unit) calc(var(--space-unit) * 0.5)}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, H as Host, g as getElement } from './index-a2ca4b97.js';
|
|
2
2
|
import { x as ZFileUploadType, q as Device, D as DividerSize } from './index-7e4df1be.js';
|
|
3
|
-
import { g as getDevice } from './utils-
|
|
3
|
+
import { g as getDevice } from './utils-825aed23.js';
|
|
4
4
|
import './breakpoints-9b81eb1b.js';
|
|
5
5
|
|
|
6
6
|
const stylesCss = ":host{color:var(--color-text01);font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>.container{display:flex;flex-direction:column}:host .modal-wrapper{display:flex;align-items:center;justify-content:center}:host .modal-wrapper>.files-wrapper{display:flex;flex-direction:column;margin:calc(var(--space-unit) * 4);gap:var(--space-unit)}:host .text-container{display:flex;flex-direction:column;margin:auto}:host .text-container .body-1{text-align:center}:host .text-container .upload-link{color:var(--color-link-primary);cursor:pointer}:host .text-container .upload-link-text{margin-bottom:var(--space-unit)}input#file-elem{display:none}#title{display:inline-block;margin-bottom:var(--space-unit)}:host>.container>z-button{display:inline-block;margin-top:calc(var(--space-unit) * 3)}:host>.container>.files-container.hidden{display:none}:host>.container>.files-container>.heading-4-sb{display:inline-block;margin:calc(var(--space-unit) * 3) 0}:host>.container>.files-container>.files-wrapper{display:flex;flex-wrap:wrap;column-gap:calc(var(--space-unit) * 2);row-gap:calc(var(--space-unit) * 2)}:host>.container>.files-container>z-divider{margin-top:calc(var(--space-unit) * 3);margin-bottom:0}@media only screen and (min-width: 768px){:host>.container>z-button{align-self:flex-start}}";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-a2ca4b97.js';
|
|
2
2
|
import { P as PopoverPosition } from './index-7e4df1be.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a as handleKeyboardSubmit } from './utils-825aed23.js';
|
|
4
4
|
import './breakpoints-9b81eb1b.js';
|
|
5
5
|
|
|
6
6
|
const stylesCss = ":host{width:100%;font-family:var(--font-family-sans);font-weight:var(--font-rg)}:host>div{position:relative;display:grid;width:calc(100% + calc(var(--space-unit) * 2));height:402px;box-sizing:border-box;padding:calc(var(--space-unit) * 2) calc(var(--space-unit) * 3);border:var(--border-size-small) solid var(--color-primary01);margin-left:calc(-1 * var(--space-unit));background:var(--color-surface01);border-radius:0;box-shadow:0 2px 4px 0 rgb(66 69 72 / 35%)}:host>div>z-icon{position:absolute;top:var(--space-unit);right:var(--space-unit);cursor:pointer;fill:var(--color-primary01)}:host>div>div.cta-wrapper{display:flex;flex-flow:column nowrap;align-self:end;justify-content:space-between}:host>div>div.content-wrapper{position:relative;overflow:hidden;align-self:stretch}:host>div>div.content-wrapper>section{box-sizing:border-box;padding:var(--space-unit) 0;border-bottom:var(--border-size-small) solid var(--color-surface04);color:var(--color-surface05);font-size:14px;line-height:20px}:host>div>div.content-wrapper>section:last-child{border-bottom:none}:host>div>div.content-wrapper>section.info-wrapper{position:relative;overflow:hidden;box-sizing:border-box}:host>div>div.content-wrapper>section.info-wrapper.hidden::after{position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(180deg, rgb(255 0 0 / 0%), rgb(255 0 0 / 0%) 60%, white);content:\"\";pointer-events:none}:host>div>div.content-wrapper>section>span.license-heading{display:flex;justify-content:space-between}:host>div>div.content-wrapper>section>span.license-heading>span.expired{color:var(--color-secondary02);font-size:12px;font-weight:600}:host>div>div.content-wrapper>section>span.license-heading>span.expiring{color:var(--color-warning01);font-size:12px;font-weight:600}:host>div>div.content-wrapper>z-popover{position:absolute;top:0;left:calc(var(--space-unit) * 4)}";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-a2ca4b97.js';
|
|
2
|
-
import {
|
|
2
|
+
import { a as handleKeyboardSubmit } from './utils-825aed23.js';
|
|
3
3
|
import './index-7e4df1be.js';
|
|
4
4
|
import './breakpoints-9b81eb1b.js';
|
|
5
5
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a2ca4b97.js';
|
|
2
2
|
import { r as PocketStatus } from './index-7e4df1be.js';
|
|
3
|
-
import {
|
|
3
|
+
import { a as handleKeyboardSubmit } from './utils-825aed23.js';
|
|
4
4
|
import { h as hammer } from './hammer-c3266b17.js';
|
|
5
5
|
import './breakpoints-9b81eb1b.js';
|
|
6
6
|
import './_commonjsHelpers-9943807e.js';
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, g as getElement } from './index-a2ca4b97.js';
|
|
2
|
+
import { P as PopoverPosition, g as KeyboardCode } from './index-7e4df1be.js';
|
|
3
|
+
|
|
4
|
+
const stylesCss = ":host{--z-popover-theme--surface:var(--color-surface01);--z-popover-theme--text:var(--color-text01);--z-popover-padding:0;--z-popover-shadow-filter:drop-shadow(0 1px 2px var(--shadow-color-base));position:relative;display:none;min-width:calc(var(--space-unit) * 8);min-height:calc(var(--space-unit) * 4);align-items:center;justify-content:center;padding:var(--z-popover-padding);background:var(--z-popover-theme--surface);border-radius:var(--border-radius-small);color:var(--z-popover-theme--text);fill:currentcolor;filter:var(--z-popover-shadow-filter);font-family:var(--font-family-sans);text-align:center}:host([open][current-position]),:host([open=\"true\"][current-position]){display:flex}:host([center][current-position=\"top\"]),:host([center][current-position=\"bottom\"]){transform:translateX(-50%)}:host([center][current-position=\"right\"]),:host([center][current-position=\"left\"]){transform:translateY(-50%)}:host([current-position^=\"top\"]){margin:0 0 var(--space-unit)}:host([current-position^=\"bottom\"]){margin:var(--space-unit) 0 0}:host([current-position^=\"left\"]){margin:0 var(--space-unit) 0 0}:host([current-position^=\"right\"]){margin:0 0 0 var(--space-unit)}:host([current-position])::before{--arrow-size:6px;--arrow-edge-offset:calc(100% - var(--space-unit) - (var(--arrow-size) / 2));--arrow-center-x-offset:calc(50% - (var(--arrow-size) / 2));--arrow-center-y-offset:calc(100% - (var(--arrow-size) / 2));position:absolute;display:block;width:var(--arrow-size);height:var(--arrow-size);background:var(--z-popover-theme--surface);content:\"\";transform:rotate(45deg)}:host([show-arrow=\"false\"])::before,:host(:not([show-arrow]))::before{display:none}:host([current-position^=\"top\"])::before{top:var(--arrow-center-y-offset)}:host([current-position^=\"bottom\"])::before{bottom:var(--arrow-center-y-offset)}:host([current-position=\"top\"])::before,:host([current-position=\"bottom\"])::before{right:var(--arrow-edge-offset)}:host([current-position=\"right\"])::before,:host([current-position=\"left\"])::before{bottom:var(--arrow-edge-offset)}:host([current-position=\"right\"])::before{right:var(--arrow-center-y-offset)}:host([current-position=\"left\"])::before{left:var(--arrow-center-y-offset)}:host([current-position=\"top_right\"])::before,:host([current-position=\"bottom_right\"])::before{right:var(--arrow-edge-offset)}:host([current-position=\"top_left\"])::before,:host([current-position=\"bottom_left\"])::before{left:var(--arrow-edge-offset)}:host([current-position=\"right_top\"])::before,:host([current-position=\"left_top\"])::before{top:var(--arrow-edge-offset)}:host([current-position=\"right_top\"])::before,:host([current-position=\"right_bottom\"])::before{right:var(--arrow-center-y-offset)}:host([current-position=\"left_top\"])::before,:host([current-position=\"left_bottom\"])::before{left:var(--arrow-center-y-offset)}:host([current-position=\"right_bottom\"])::before,:host([current-position=\"left_bottom\"])::before{bottom:var(--arrow-edge-offset)}:host([center][current-position=\"top\"])::before,:host([center][current-position=\"bottom\"])::before{right:auto;left:var(--arrow-center-x-offset)}:host([center][current-position=\"right\"])::before,:host([center][current-position=\"left\"])::before{top:var(--arrow-center-x-offset);bottom:auto}::slotted(*){overflow:auto;flex:1 auto}";
|
|
5
|
+
|
|
6
|
+
const DOCUMENT_ELEMENT = document.documentElement;
|
|
7
|
+
function getParentElement(element) {
|
|
8
|
+
if (element.parentNode.host) {
|
|
9
|
+
return element.parentNode.host;
|
|
10
|
+
}
|
|
11
|
+
return element.parentNode;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Find the closest scrollable parent of a node.
|
|
15
|
+
*
|
|
16
|
+
* @param {Element} element The node
|
|
17
|
+
*/
|
|
18
|
+
function findScrollableParent(element) {
|
|
19
|
+
let parent = getParentElement(element);
|
|
20
|
+
while (parent && parent !== DOCUMENT_ELEMENT) {
|
|
21
|
+
const { overflow, overflowX, overflowY } = window.getComputedStyle(parent);
|
|
22
|
+
if (overflow === "hidden" || overflowY === "hidden" || overflowX === "hidden") {
|
|
23
|
+
return parent;
|
|
24
|
+
}
|
|
25
|
+
if ((parent.scrollHeight > parent.clientHeight && overflow !== "visible" && overflowY !== "visible") ||
|
|
26
|
+
(parent.scrollWidth > parent.clientWidth && overflow !== "visible" && overflowX !== "visible")) {
|
|
27
|
+
return parent;
|
|
28
|
+
}
|
|
29
|
+
parent = getParentElement(parent);
|
|
30
|
+
}
|
|
31
|
+
return DOCUMENT_ELEMENT;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Calculate computed offset.
|
|
35
|
+
* It includes matrix transformations.
|
|
36
|
+
* @param element The target element.
|
|
37
|
+
* @param targetParentOffset The relative offset parent.
|
|
38
|
+
* @return A client rect object.
|
|
39
|
+
*/
|
|
40
|
+
function computeOffset(element, targetParentOffset) {
|
|
41
|
+
const rect = element.getBoundingClientRect();
|
|
42
|
+
const width = rect.width;
|
|
43
|
+
const height = rect.height;
|
|
44
|
+
let top = 0;
|
|
45
|
+
let left = 0;
|
|
46
|
+
let offsetParent = element;
|
|
47
|
+
while (offsetParent && offsetParent != targetParentOffset) {
|
|
48
|
+
left += offsetParent.offsetLeft;
|
|
49
|
+
// document.body sometimes has offsetTop == 0 but still has an
|
|
50
|
+
// offset because of children margins!
|
|
51
|
+
if (offsetParent === document.body) {
|
|
52
|
+
top += offsetParent.getBoundingClientRect().top + window.scrollY;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
top += offsetParent.offsetTop;
|
|
56
|
+
}
|
|
57
|
+
if (window.DOMMatrix) {
|
|
58
|
+
const style = window.getComputedStyle(offsetParent);
|
|
59
|
+
const transform = style.transform || style.webkitTransform;
|
|
60
|
+
const domMatrix = new DOMMatrix(transform);
|
|
61
|
+
if (domMatrix) {
|
|
62
|
+
left += domMatrix.m41;
|
|
63
|
+
if (offsetParent !== document.body) {
|
|
64
|
+
top += domMatrix.m42;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (!offsetParent.offsetParent) {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
offsetParent = offsetParent.offsetParent;
|
|
72
|
+
}
|
|
73
|
+
let parentWidth;
|
|
74
|
+
let parentHeight;
|
|
75
|
+
if (offsetParent === document.body) {
|
|
76
|
+
parentWidth = window.innerWidth;
|
|
77
|
+
parentHeight = window.innerHeight;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
parentWidth = offsetParent.offsetWidth;
|
|
81
|
+
parentHeight = offsetParent.offsetHeight;
|
|
82
|
+
}
|
|
83
|
+
const right = parentWidth - left - rect.width;
|
|
84
|
+
const bottom = parentHeight - top - rect.height;
|
|
85
|
+
return { top, right, bottom, left, width, height };
|
|
86
|
+
}
|
|
87
|
+
const ZPopover = class {
|
|
88
|
+
constructor(hostRef) {
|
|
89
|
+
registerInstance(this, hostRef);
|
|
90
|
+
this.positionChange = createEvent(this, "positionChange", 7);
|
|
91
|
+
this.openChange = createEvent(this, "openChange", 7);
|
|
92
|
+
/** Popover position. */
|
|
93
|
+
this.position = PopoverPosition.AUTO;
|
|
94
|
+
/**
|
|
95
|
+
* The open state of the popover.
|
|
96
|
+
*/
|
|
97
|
+
this.open = false;
|
|
98
|
+
/**
|
|
99
|
+
* Whether to show popover's arrow.
|
|
100
|
+
*/
|
|
101
|
+
this.showArrow = false;
|
|
102
|
+
/**
|
|
103
|
+
* Whether to center the popup on the main side (according to "position").
|
|
104
|
+
*/
|
|
105
|
+
this.center = false;
|
|
106
|
+
/**
|
|
107
|
+
* If true, the popover can be closed by clicking outside of it or pressing the escape key.
|
|
108
|
+
* Otherwise, it will be closed only programmatically (by setting `open` to `false`).
|
|
109
|
+
*/
|
|
110
|
+
this.closable = true;
|
|
111
|
+
}
|
|
112
|
+
closePopoverWithKeyboard(e) {
|
|
113
|
+
if (this.closable && e.key === KeyboardCode.ESC) {
|
|
114
|
+
this.open = false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Close the popover when clicking outside of its content.
|
|
119
|
+
* Stop event propagation if the click was fired by popover's trigger element,
|
|
120
|
+
* to prevent close and reopen glitches.
|
|
121
|
+
* @param {MouseEvent} e
|
|
122
|
+
*/
|
|
123
|
+
handleOutsideClick(e) {
|
|
124
|
+
if (!this.closable || !this.open) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (!e.composedPath().includes(this.host)) {
|
|
128
|
+
const target = e.target;
|
|
129
|
+
const triggerElemClicked = this.bindTo instanceof HTMLElement ? this.bindTo.contains(target) : target.closest(this.bindTo);
|
|
130
|
+
if (triggerElemClicked) {
|
|
131
|
+
e.stopPropagation();
|
|
132
|
+
}
|
|
133
|
+
this.open = false;
|
|
134
|
+
this.positionChange.emit({ position: this.currentPosition });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
validatePosition(newValue) {
|
|
138
|
+
if (newValue && !Object.values(PopoverPosition).includes(newValue)) {
|
|
139
|
+
this.position = PopoverPosition.AUTO;
|
|
140
|
+
}
|
|
141
|
+
this.currentPosition = this.position;
|
|
142
|
+
this.positionChange.emit({ position: this.currentPosition });
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Setup popover behaviors on opening.
|
|
146
|
+
*/
|
|
147
|
+
onOpen() {
|
|
148
|
+
cancelAnimationFrame(this.animationFrameRequestId);
|
|
149
|
+
if (this.open) {
|
|
150
|
+
const setPosition = () => {
|
|
151
|
+
if (this.open) {
|
|
152
|
+
this.setPosition();
|
|
153
|
+
this.animationFrameRequestId = requestAnimationFrame(setPosition);
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
setPosition();
|
|
157
|
+
}
|
|
158
|
+
else if (this.host.hasAttribute("current-position")) {
|
|
159
|
+
this.host.removeAttribute("current-position");
|
|
160
|
+
this.currentPosition = undefined;
|
|
161
|
+
}
|
|
162
|
+
this.openChange.emit({ open: this.open });
|
|
163
|
+
}
|
|
164
|
+
disconnectedCallback() {
|
|
165
|
+
cancelAnimationFrame(this.animationFrameRequestId);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Set the position of the popover.
|
|
169
|
+
*/
|
|
170
|
+
setPosition() {
|
|
171
|
+
let element;
|
|
172
|
+
if (typeof this.bindTo === "string") {
|
|
173
|
+
element = this.host.ownerDocument.querySelector(this.bindTo);
|
|
174
|
+
}
|
|
175
|
+
else if (this.bindTo) {
|
|
176
|
+
element = this.bindTo;
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
element = this.host.parentElement;
|
|
180
|
+
}
|
|
181
|
+
if (!element) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const scrollContainer = findScrollableParent(element);
|
|
185
|
+
const scrollingBoundingRect = scrollContainer.getBoundingClientRect();
|
|
186
|
+
const offsetContainer = this.host.offsetParent;
|
|
187
|
+
const relativeBoundingRect = offsetContainer
|
|
188
|
+
? computeOffset(offsetContainer, scrollContainer)
|
|
189
|
+
: { top: 0, right: 0, bottom: 0, left: 0 };
|
|
190
|
+
const boundingRect = computeOffset(element, scrollContainer);
|
|
191
|
+
const top = boundingRect.top - scrollContainer.scrollTop;
|
|
192
|
+
const bottom = scrollingBoundingRect.height - (boundingRect.top + boundingRect.height) + scrollContainer.scrollTop;
|
|
193
|
+
const left = boundingRect.left - scrollContainer.scrollLeft;
|
|
194
|
+
const right = scrollingBoundingRect.width - (boundingRect.left + boundingRect.width) + scrollContainer.scrollLeft;
|
|
195
|
+
const overflowBottom = Math.max(0, scrollingBoundingRect.top + scrollingBoundingRect.height - window.innerHeight);
|
|
196
|
+
const overflowRight = Math.max(0, scrollingBoundingRect.left + scrollingBoundingRect.width - window.innerWidth);
|
|
197
|
+
const availableTop = Math.min(top, top + scrollingBoundingRect.top);
|
|
198
|
+
const availableBottom = Math.min(bottom, bottom - overflowBottom);
|
|
199
|
+
const availableLeft = Math.min(left, left + scrollingBoundingRect.left);
|
|
200
|
+
const availableRight = Math.min(right, right - overflowRight);
|
|
201
|
+
const availableHeight = availableTop + availableBottom + boundingRect.height;
|
|
202
|
+
const availableWidth = availableLeft + availableRight + boundingRect.width;
|
|
203
|
+
let position = this.currentPosition;
|
|
204
|
+
const positions = [];
|
|
205
|
+
if (this.position === PopoverPosition.AUTO) {
|
|
206
|
+
/**
|
|
207
|
+
* The `AUTO` position tries to place the popover in the 'safest' area,
|
|
208
|
+
* where there's more space available.
|
|
209
|
+
*/
|
|
210
|
+
if (availableLeft / availableWidth > 0.6) {
|
|
211
|
+
positions.push(PopoverPosition.LEFT);
|
|
212
|
+
}
|
|
213
|
+
else if (availableLeft / availableWidth < 0.4) {
|
|
214
|
+
positions.push(PopoverPosition.RIGHT);
|
|
215
|
+
}
|
|
216
|
+
if (availableTop / availableHeight > 0.9) {
|
|
217
|
+
positions.unshift(PopoverPosition.TOP);
|
|
218
|
+
}
|
|
219
|
+
else if (availableTop / availableHeight > 0.6) {
|
|
220
|
+
positions.push(PopoverPosition.TOP);
|
|
221
|
+
}
|
|
222
|
+
else if (availableTop / availableHeight < 0.1) {
|
|
223
|
+
positions.unshift(PopoverPosition.BOTTOM);
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
positions.push(PopoverPosition.BOTTOM);
|
|
227
|
+
}
|
|
228
|
+
position = positions.join("_");
|
|
229
|
+
}
|
|
230
|
+
const style = this.host.style;
|
|
231
|
+
style.position = "absolute";
|
|
232
|
+
const offsetTop = boundingRect.top - relativeBoundingRect.top;
|
|
233
|
+
const offsetRight = boundingRect.right - relativeBoundingRect.right;
|
|
234
|
+
const offsetBottom = boundingRect.bottom - relativeBoundingRect.bottom;
|
|
235
|
+
const offsetLeft = boundingRect.left - relativeBoundingRect.left;
|
|
236
|
+
const offsetModifier = this.center ? 0.5 : 0;
|
|
237
|
+
const sizeModifier = this.center ? 0.5 : 0;
|
|
238
|
+
if (position === PopoverPosition.TOP || position === PopoverPosition.TOP_RIGHT) {
|
|
239
|
+
style.top = "auto";
|
|
240
|
+
style.right = "auto";
|
|
241
|
+
style.bottom = `${offsetBottom + boundingRect.height}px`;
|
|
242
|
+
style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
|
|
243
|
+
style.maxHeight = `${availableTop}px`;
|
|
244
|
+
if (position === PopoverPosition.TOP_RIGHT) {
|
|
245
|
+
style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
else if (position === PopoverPosition.TOP_LEFT) {
|
|
249
|
+
style.top = "auto";
|
|
250
|
+
style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
|
|
251
|
+
style.bottom = `${offsetBottom + boundingRect.height}px`;
|
|
252
|
+
style.left = "auto";
|
|
253
|
+
style.maxWidth = `${availableLeft}px`;
|
|
254
|
+
style.maxHeight = `${availableTop}px`;
|
|
255
|
+
}
|
|
256
|
+
else if (position === PopoverPosition.BOTTOM || position === PopoverPosition.BOTTOM_RIGHT) {
|
|
257
|
+
style.top = `${offsetTop + boundingRect.height}px`;
|
|
258
|
+
style.right = "auto";
|
|
259
|
+
style.bottom = "auto";
|
|
260
|
+
style.left = `${offsetLeft + boundingRect.width * offsetModifier}px`;
|
|
261
|
+
style.maxHeight = `${availableBottom}px`;
|
|
262
|
+
if (position === PopoverPosition.BOTTOM_RIGHT) {
|
|
263
|
+
style.maxWidth = `${availableRight + boundingRect.width * sizeModifier}px`;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
else if (position === PopoverPosition.BOTTOM_LEFT) {
|
|
267
|
+
style.top = `${offsetTop + boundingRect.height}px`;
|
|
268
|
+
style.right = `${offsetRight + boundingRect.width * offsetModifier}px`;
|
|
269
|
+
style.bottom = "auto";
|
|
270
|
+
style.left = "auto";
|
|
271
|
+
style.maxWidth = `${availableLeft}px`;
|
|
272
|
+
style.maxHeight = `${availableBottom}px`;
|
|
273
|
+
}
|
|
274
|
+
else if (position === PopoverPosition.RIGHT || position === PopoverPosition.RIGHT_BOTTOM) {
|
|
275
|
+
style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
|
|
276
|
+
style.right = "auto";
|
|
277
|
+
style.bottom = "auto";
|
|
278
|
+
style.left = `${offsetLeft + boundingRect.width}px`;
|
|
279
|
+
style.maxWidth = `${availableRight}px`;
|
|
280
|
+
style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
|
|
281
|
+
}
|
|
282
|
+
else if (position === PopoverPosition.RIGHT_TOP) {
|
|
283
|
+
style.top = "auto";
|
|
284
|
+
style.right = "auto";
|
|
285
|
+
style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
|
|
286
|
+
style.left = `${offsetLeft + boundingRect.width}px`;
|
|
287
|
+
style.maxWidth = `${availableRight}px`;
|
|
288
|
+
style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
|
|
289
|
+
}
|
|
290
|
+
else if (position === PopoverPosition.LEFT || position === PopoverPosition.LEFT_BOTTOM) {
|
|
291
|
+
style.top = `${offsetTop + boundingRect.height * offsetModifier}px`;
|
|
292
|
+
style.right = `${offsetRight + boundingRect.width}px`;
|
|
293
|
+
style.bottom = "auto";
|
|
294
|
+
style.left = "auto";
|
|
295
|
+
style.maxWidth = `${availableLeft}px`;
|
|
296
|
+
style.maxHeight = `${availableBottom + boundingRect.height * sizeModifier}px`;
|
|
297
|
+
}
|
|
298
|
+
else if (position === PopoverPosition.LEFT_TOP) {
|
|
299
|
+
style.top = "auto";
|
|
300
|
+
style.right = `${offsetRight + boundingRect.width}px`;
|
|
301
|
+
style.bottom = `${offsetBottom + boundingRect.height * offsetModifier}px`;
|
|
302
|
+
style.left = "auto";
|
|
303
|
+
style.maxWidth = `${availableLeft}px`;
|
|
304
|
+
style.maxHeight = `${availableTop + boundingRect.height * sizeModifier}px`;
|
|
305
|
+
}
|
|
306
|
+
this.currentPosition = position || this.position;
|
|
307
|
+
this.host.setAttribute("current-position", this.currentPosition);
|
|
308
|
+
}
|
|
309
|
+
componentWillLoad() {
|
|
310
|
+
this.validatePosition(this.position);
|
|
311
|
+
this.onOpen();
|
|
312
|
+
}
|
|
313
|
+
render() {
|
|
314
|
+
return h("slot", null);
|
|
315
|
+
}
|
|
316
|
+
get host() { return getElement(this); }
|
|
317
|
+
static get watchers() { return {
|
|
318
|
+
"position": ["validatePosition"],
|
|
319
|
+
"open": ["onOpen"]
|
|
320
|
+
}; }
|
|
321
|
+
};
|
|
322
|
+
ZPopover.style = stylesCss;
|
|
323
|
+
|
|
324
|
+
export { ZPopover as z_popover };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, g as getElement } from './index-a2ca4b97.js';
|
|
2
2
|
import { z as ZSectionTitleDividerPosition, D as DividerSize } from './index-7e4df1be.js';
|
|
3
3
|
|
|
4
|
-
const stylesCss = ":host{--z-section-title--divider-color:var(--red500);display:flex;width:fit-content;flex-direction:column;align-items:flex-start;font-family:var(--font-family-sans)
|
|
4
|
+
const stylesCss = ":host{--z-section-title--divider-color:var(--red500);display:flex;width:fit-content;flex-direction:column;align-items:flex-start;font-family:var(--font-family-sans)}:host,:host ::slotted(*){box-sizing:border-box}::slotted(*){margin:0}::slotted([slot=\"secondary-title\"]){padding-bottom:calc(var(--space-unit) / 2);border-bottom:var(--border-size-large) solid var(--z-section-title--divider-color);font-size:var(--font-size-3);font-weight:var(--font-sb);line-height:1.5rem;text-transform:uppercase}::slotted([slot=\"primary-title\"]){font-size:var(--font-size-6);font-weight:var(--font-sb);line-height:2rem}:host([uppercase]:not([uppercase=\"false\"])) ::slotted([slot=\"primary-title\"]){text-transform:uppercase}@media (min-width: 1152px){::slotted([slot=\"primary-title\"]){font-size:var(--font-size-7);line-height:2.25rem}}";
|
|
5
5
|
|
|
6
6
|
const ZSectionTitle = class {
|
|
7
7
|
constructor(hostRef) {
|