q2-tecton-elements 1.21.2 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/installCanvasRenderer-b4d10c92.js +38433 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-badge_2.cjs.entry.js +5 -3
- package/dist/cjs/q2-calendar.cjs.entry.js +75 -55
- package/dist/cjs/q2-carousel.cjs.entry.js +3 -3
- package/dist/cjs/q2-chart-bar.cjs.entry.js +4679 -0
- package/dist/cjs/q2-chart-donut.cjs.entry.js +357 -35592
- package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio.cjs.entry.js +1 -1
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/q2-calendar/index.js +43 -2
- package/dist/collection/components/q2-chart-bar/index.js +466 -0
- package/dist/collection/components/q2-chart-bar/styles.css +85 -0
- package/dist/collection/components/q2-chart-donut/index.js +3 -3
- package/dist/collection/components/q2-checkbox/styles.css +5 -1
- package/dist/collection/components/q2-editable-field/styles.css +1 -1
- package/dist/collection/components/q2-input/formatting/phone.js +2 -2
- package/dist/collection/components/q2-input/index.js +21 -0
- package/dist/collection/components/q2-input/styles.css +2 -2
- package/dist/collection/components/q2-radio/styles.css +1 -1
- package/dist/collection/utils/charting.js +182 -0
- package/dist/components/click-elsewhere.d.ts +11 -0
- package/dist/components/click-elsewhere.js +6 -0
- package/dist/components/index.d.ts +62 -0
- package/dist/components/index.js +42 -0
- package/dist/components/index10.js +84 -0
- package/dist/components/index11.js +383 -0
- package/dist/components/index12.js +125 -0
- package/dist/components/index13.js +602 -0
- package/dist/components/index2.js +100 -0
- package/dist/components/index3.js +90 -0
- package/dist/components/index4.js +62 -0
- package/dist/components/index5.js +146 -0
- package/dist/components/index6.js +145 -0
- package/dist/components/index7.js +2960 -0
- package/dist/components/index8.js +3356 -0
- package/dist/components/index9.js +101 -0
- package/dist/components/installCanvasRenderer.js +38282 -0
- package/dist/components/q2-avatar.d.ts +11 -0
- package/dist/components/q2-avatar.js +6 -0
- package/dist/components/q2-badge.d.ts +11 -0
- package/dist/components/q2-badge.js +6 -0
- package/dist/components/q2-btn.d.ts +11 -0
- package/dist/components/q2-btn.js +6 -0
- package/dist/components/q2-calendar.d.ts +11 -0
- package/dist/components/q2-calendar.js +3755 -0
- package/dist/components/q2-card.d.ts +11 -0
- package/dist/components/q2-card.js +187 -0
- package/dist/components/q2-carousel-pane.d.ts +11 -0
- package/dist/components/q2-carousel-pane.js +97 -0
- package/dist/components/q2-carousel.d.ts +11 -0
- package/dist/components/q2-carousel.js +5379 -0
- package/dist/components/q2-chart-bar.d.ts +11 -0
- package/dist/components/q2-chart-bar.js +4710 -0
- package/dist/components/q2-chart-donut.d.ts +11 -0
- package/dist/components/q2-chart-donut.js +4887 -0
- package/dist/components/q2-checkbox-group.d.ts +11 -0
- package/dist/components/q2-checkbox-group.js +114 -0
- package/dist/components/q2-checkbox.d.ts +11 -0
- package/dist/components/q2-checkbox.js +138 -0
- package/dist/components/q2-dropdown-item.d.ts +11 -0
- package/dist/components/q2-dropdown-item.js +6 -0
- package/dist/components/q2-dropdown.d.ts +11 -0
- package/dist/components/q2-dropdown.js +345 -0
- package/dist/components/q2-editable-field.d.ts +11 -0
- package/dist/components/q2-editable-field.js +220 -0
- package/dist/components/q2-icon.d.ts +11 -0
- package/dist/components/q2-icon.js +6 -0
- package/dist/components/q2-input.d.ts +11 -0
- package/dist/components/q2-input.js +6 -0
- package/dist/components/q2-loading-element.d.ts +11 -0
- package/dist/components/q2-loading-element.js +52 -0
- package/dist/components/q2-loading.d.ts +11 -0
- package/dist/components/q2-loading.js +6 -0
- package/dist/components/q2-loc.d.ts +11 -0
- package/dist/components/q2-loc.js +40 -0
- package/dist/components/q2-message.d.ts +11 -0
- package/dist/components/q2-message.js +6 -0
- package/dist/components/q2-month-picker.d.ts +11 -0
- package/dist/components/q2-month-picker.js +189 -0
- package/dist/components/q2-optgroup.d.ts +11 -0
- package/dist/components/q2-optgroup.js +75 -0
- package/dist/components/q2-option-list.d.ts +11 -0
- package/dist/components/q2-option-list.js +6 -0
- package/dist/components/q2-option.d.ts +11 -0
- package/dist/components/q2-option.js +81 -0
- package/dist/components/q2-pagination.d.ts +11 -0
- package/dist/components/q2-pagination.js +184 -0
- package/dist/components/q2-pill.d.ts +11 -0
- package/dist/components/q2-pill.js +216 -0
- package/dist/components/q2-popover.d.ts +11 -0
- package/dist/components/q2-popover.js +6 -0
- package/dist/components/q2-radio-group.d.ts +11 -0
- package/dist/components/q2-radio-group.js +191 -0
- package/dist/components/q2-radio.d.ts +11 -0
- package/dist/components/q2-radio.js +105 -0
- package/dist/components/q2-section.d.ts +11 -0
- package/dist/components/q2-section.js +218 -0
- package/dist/components/q2-select.d.ts +11 -0
- package/dist/components/q2-select.js +817 -0
- package/dist/components/q2-stepper-pane.d.ts +11 -0
- package/dist/components/q2-stepper-pane.js +92 -0
- package/dist/components/q2-stepper-vertical.d.ts +11 -0
- package/dist/components/q2-stepper-vertical.js +311 -0
- package/dist/components/q2-stepper.d.ts +11 -0
- package/dist/components/q2-stepper.js +252 -0
- package/dist/components/q2-tab-container.d.ts +11 -0
- package/dist/components/q2-tab-container.js +288 -0
- package/dist/components/q2-tab-pane.d.ts +11 -0
- package/dist/components/q2-tab-pane.js +58 -0
- package/dist/components/q2-tag.d.ts +11 -0
- package/dist/components/q2-tag.js +156 -0
- package/dist/components/q2-textarea.d.ts +11 -0
- package/dist/components/q2-textarea.js +265 -0
- package/dist/components/q2-tooltip.d.ts +11 -0
- package/dist/components/q2-tooltip.js +112 -0
- package/dist/components/shapes.js +91 -0
- package/dist/components/tecton-tab-pane.d.ts +11 -0
- package/dist/components/tecton-tab-pane.js +111 -0
- package/dist/esm/installCanvasRenderer-0143b52d.js +38282 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-badge_2.entry.js +5 -3
- package/dist/esm/q2-calendar.entry.js +75 -55
- package/dist/esm/q2-carousel.entry.js +3 -3
- package/dist/esm/q2-chart-bar.entry.js +4675 -0
- package/dist/esm/q2-chart-donut.entry.js +171 -35406
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/q2-tecton-elements/p-1f85cced.js +39 -0
- package/dist/q2-tecton-elements/{p-89608314.entry.js → p-4625184b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9772b15f.entry.js → p-520c40f6.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-6b52a262.entry.js +1 -0
- package/dist/q2-tecton-elements/p-c4640b55.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-7e8f43d1.entry.js → p-cf41970f.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-e4dc9ac0.entry.js +1 -0
- package/dist/q2-tecton-elements/p-f35bf6a3.entry.js +1 -0
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/types/components/q2-calendar/index.d.ts +3 -0
- package/dist/types/components/q2-chart-bar/index.d.ts +40 -0
- package/dist/types/components/q2-chart-donut/index.d.ts +7 -10
- package/dist/types/components/q2-input/index.d.ts +1 -0
- package/dist/types/components.d.ts +50 -3
- package/dist/types/utils/charting.d.ts +14 -0
- package/package.json +6 -3
- package/dist/q2-tecton-elements/p-0766a694.entry.js +0 -1
- package/dist/q2-tecton-elements/p-5f064e1e.entry.js +0 -39
- package/dist/q2-tecton-elements/p-8d25ec52.entry.js +0 -1
- /package/dist/types/workspace/workspace/{tecton-production_release_1.21.x → tecton-production_release_1.22.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { i as icons, d as defineCustomElement$1 } from './index7.js';
|
|
3
|
+
|
|
4
|
+
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.avatar-img{object-fit:cover;height:var(--tct-avatar-img-height, var(--tct-avatar-height, 44px));width:var(--tct-avatar-img-width, var(--tct-avatar-width, 44px));border-radius:var(--tct-avatar-img-br, 50%);background-color:unset}.avatar-img-default{object-fit:cover;height:var(--tct-avatar-img-height, var(--tct-avatar-height, 44px));width:var(--tct-avatar-img-width, var(--tct-avatar-width, 44px));border-radius:var(--tct-avatar-img-br, 50%);background-color:var(--tct-avatar-bg, #9e9e9e)}.avatar-initials{height:var(--tct-avatar-height, 44px);width:var(--tct-avatar-width, 44px);background-color:var(--tct-avatar-bg, var(--t-gray-8, #9e9e9e));border-radius:var(--tct-avatar-br, 50%)}.size-1{--tct-avatar-font-size:var(--tct-avatar-size-1, 60px)}.size-2{--tct-avatar-font-size:var(--tct-avatar-size-2, 50px)}.size-3{--tct-avatar-font-size:var(--tct-avatar-size-3, 40px)}.size-4{--tct-avatar-font-size:var(--tct-avatar-size-4, 30px)}text{fill:var(--tct-avatar-color, #ffffff);font-weight:var(--tct-avatar-font-weight, 200);font-size:var(--tct-avatar-font-size, 40px)}.fallback{height:var(--tct-avatar-fallback-height, var(--tct-avatar-height, 44px));width:var(--tct-avatar-fallback-width, var(--tct-avatar-width, 44px));border-radius:var(--tct-avatar-fallback-br, var(--tct-avatar-img-br, 50%));background-color:var(--tct-avatar-fallback-bg, var(--tct-avatar-bg, #9e9e9e));display:flex;align-items:center;justify-content:center}q2-icon{--t-icon-size:var(--tct-avatar-fallback-icon-size, 65%);--t-icon-fill:var(--tct-avatar-fallback-fill, transparent);--t-icon-stroke-primary:var(--tct-avatar-fallback-stroke-primary, currentcolor);--t-icon-stroke-secondary:var(--tct-avatar-fallback-stroke-secondary, currentcolor);color:var(--tct-avatar-fallback-color, var(--tct-avatar-color, var(--t-base, #ffffff)));width:var(--t-icon-size);height:var(--t-icon-size)}";
|
|
5
|
+
|
|
6
|
+
const Q2Avatar = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.__registerHost();
|
|
10
|
+
this.__attachShadow();
|
|
11
|
+
this.onError = () => {
|
|
12
|
+
this.badSrc = true;
|
|
13
|
+
};
|
|
14
|
+
this.onLoad = () => {
|
|
15
|
+
this.isLoaded = true;
|
|
16
|
+
};
|
|
17
|
+
this.name = undefined;
|
|
18
|
+
this.initials = undefined;
|
|
19
|
+
this.src = undefined;
|
|
20
|
+
this.icon = 'person';
|
|
21
|
+
this.badSrc = false;
|
|
22
|
+
this.isLoaded = false;
|
|
23
|
+
}
|
|
24
|
+
srcDidUpdate() {
|
|
25
|
+
this.badSrc = false;
|
|
26
|
+
}
|
|
27
|
+
get fallbackIcon() {
|
|
28
|
+
return (icons[this.icon] && icons[this.icon].markup()) || icons.error.markup();
|
|
29
|
+
}
|
|
30
|
+
get computedInitials() {
|
|
31
|
+
const { initials, name } = this;
|
|
32
|
+
if (!initials && !name)
|
|
33
|
+
return;
|
|
34
|
+
let result = '';
|
|
35
|
+
if (initials) {
|
|
36
|
+
result = initials.substr(0, 4);
|
|
37
|
+
}
|
|
38
|
+
else if (name) {
|
|
39
|
+
const parts = name.split(' ');
|
|
40
|
+
const firstCharacter = parts[0][0];
|
|
41
|
+
const lastCharacter = parts.length > 1 ? parts[parts.length - 1][0] : undefined;
|
|
42
|
+
result += firstCharacter;
|
|
43
|
+
if (lastCharacter)
|
|
44
|
+
result += lastCharacter;
|
|
45
|
+
}
|
|
46
|
+
result = result === null || result === void 0 ? void 0 : result.toUpperCase();
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
render() {
|
|
50
|
+
const { computedInitials } = this;
|
|
51
|
+
const showImg = this.src && !this.badSrc;
|
|
52
|
+
const isLoaded = this.isLoaded;
|
|
53
|
+
const showInitials = (this.name || this.initials) && (!this.src || this.badSrc);
|
|
54
|
+
const showFallback = !this.name && !this.initials && (!this.src || this.badSrc);
|
|
55
|
+
return (h("div", null, showImg && (h("img", { class: isLoaded ? 'avatar-img' : 'avatar-img-default', "test-id": "userImage", src: this.src, onError: this.onError, onLoad: this.onLoad, alt: this.name || '' })), showInitials && (h("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "xMidYMid meet", "test-id": "userInitials", class: `avatar-initials size-${computedInitials.length}`, "aria-label": this.name, "aria-hidden": !this.name && 'true' }, h("text", { x: "50", y: "50", "dominant-baseline": "central", "text-anchor": "middle", "aria-hidden": "true" }, computedInitials))), showFallback && (h("div", { "test-id": "fallbackIcon", class: "fallback" }, h("q2-icon", { type: this.icon })))));
|
|
56
|
+
}
|
|
57
|
+
get el() { return this; }
|
|
58
|
+
static get watchers() { return {
|
|
59
|
+
"src": ["srcDidUpdate"]
|
|
60
|
+
}; }
|
|
61
|
+
static get style() { return stylesCss; }
|
|
62
|
+
}, [1, "q2-avatar", {
|
|
63
|
+
"name": [513],
|
|
64
|
+
"initials": [513],
|
|
65
|
+
"src": [513],
|
|
66
|
+
"icon": [1],
|
|
67
|
+
"badSrc": [32],
|
|
68
|
+
"isLoaded": [32]
|
|
69
|
+
}]);
|
|
70
|
+
function defineCustomElement() {
|
|
71
|
+
if (typeof customElements === "undefined") {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const components = ["q2-avatar", "q2-icon"];
|
|
75
|
+
components.forEach(tagName => { switch (tagName) {
|
|
76
|
+
case "q2-avatar":
|
|
77
|
+
if (!customElements.get(tagName)) {
|
|
78
|
+
customElements.define(tagName, Q2Avatar);
|
|
79
|
+
}
|
|
80
|
+
break;
|
|
81
|
+
case "q2-icon":
|
|
82
|
+
if (!customElements.get(tagName)) {
|
|
83
|
+
defineCustomElement$1();
|
|
84
|
+
}
|
|
85
|
+
break;
|
|
86
|
+
} });
|
|
87
|
+
}
|
|
88
|
+
defineCustomElement();
|
|
89
|
+
|
|
90
|
+
export { Q2Avatar as Q, defineCustomElement as d };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
|
|
3
|
+
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:inline-block}.badge-wrapper{--comp-badge-background:var(--t-gray8, #61c4ff);--comp-badge-color:var(--t-base, #ffffff);--comp-badge-border-color:var(--t-secondary-l1, #9a9898)}:host([status=info]) .badge-wrapper{--comp-badge-background:var(--const-stoplight-info, #0079C1);--comp-badge-color:var(--const-stoplight-info-text, #ffffff);--comp-badge-border-color:var(--const-stoplight-info-l1, #3a9bd6)}:host([status=alert]) .badge-wrapper{--comp-badge-background:var(--const-stoplight-alert, #C30000);--comp-badge-color:var(--const-stoplight-alert-text, #ffffff);--comp-badge-border-color:var(--const-stoplight-alert-l1, #e42929)}:host([status=warning]) .badge-wrapper{--comp-badge-background:var(--const-stoplight-warning, #F0B400);--comp-badge-color:var(--const-stoplight-warning-text, #423535);--comp-badge-border-color:var(--const-stoplight-warning-l1, #f9ce4c)}:host([status=success]) .badge-wrapper{--comp-badge-background:var(--const-stoplight-success, #57fc45);--comp-badge-color:var(--const-stoplight-success-text, #ffffff);--comp-badge-border-color:var(--const-stoplight-success-l1, #2eaa21)}:host([theme=primary]) .badge-wrapper{--comp-badge-background:var(--t-primary, #0079c2);--comp-badge-color:var(--t-primary-text, #ffffff);--comp-badge-border-color:var(--t-primary-l1, #3a9bd6)}:host([theme=secondary]) .badge-wrapper{--comp-badge-background:var(--t-secondary, #b4c2cd);--comp-badge-color:var(--t-secondary-text, #ffffff);--comp-badge-border-color:var(--t-secondary-l1, #c6d1db)}:host([theme=tertiary]) .badge-wrapper{--comp-badge-background:var(--t-tertiary, #e9f5fc);--comp-badge-color:var(--t-tertiary-text, #000000);--comp-badge-border-color:var(--t-tertiary-l1, #f3f4f5)}.badge{font-size:10px;line-height:16px;height:16px;min-width:16px;text-align:center;padding:0 4px;color:var(--comp-badge-color);background-color:var(--comp-badge-background);border-style:solid;border-color:var(--comp-badge-border-color);border-width:var(--tct-badge-border-width, var(--t-badge-border-width, 1px));border-radius:var(--tct-badge-border-radius, var(--t-badge-border-radius, 8px))}.badge.size-large{font-size:14px;height:22px;min-width:22px;border-radius:var(--tct-badge-border-radius, var(--t-badge-border-radius, 11px));line-height:22px;padding:0 6px;border-color:var(--comp-badge-border-color)}.badge-wrapper{display:flex;align-items:center;justify-content:center}";
|
|
4
|
+
|
|
5
|
+
const Q2Badge = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.value = 0;
|
|
11
|
+
this.maxLength = undefined;
|
|
12
|
+
this.position = undefined;
|
|
13
|
+
this.size = undefined;
|
|
14
|
+
this.theme = undefined;
|
|
15
|
+
this.status = undefined;
|
|
16
|
+
}
|
|
17
|
+
get badgeText() {
|
|
18
|
+
const maxValue = Math.pow(10, this.maxLength || 2) - 1;
|
|
19
|
+
let value = this.value || 0;
|
|
20
|
+
if (isNaN(value) || value <= 0) {
|
|
21
|
+
value = '';
|
|
22
|
+
}
|
|
23
|
+
else if (value <= maxValue) {
|
|
24
|
+
value = Number(value).toLocaleString();
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
value = Number(maxValue).toLocaleString() + '+';
|
|
28
|
+
}
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
render() {
|
|
32
|
+
const badgeClass = ['badge'];
|
|
33
|
+
if (this.size === 'large')
|
|
34
|
+
badgeClass.push('size-large');
|
|
35
|
+
return (h("div", { class: "badge-wrapper" }, h("div", { class: badgeClass.join(' ') }, h("span", { class: "badge-text" }, h("slot", null, this.badgeText)))));
|
|
36
|
+
}
|
|
37
|
+
get hostElement() { return this; }
|
|
38
|
+
static get style() { return stylesCss; }
|
|
39
|
+
}, [1, "q2-badge", {
|
|
40
|
+
"value": [514],
|
|
41
|
+
"maxLength": [514, "max-length"],
|
|
42
|
+
"position": [513],
|
|
43
|
+
"size": [513],
|
|
44
|
+
"theme": [513],
|
|
45
|
+
"status": [513]
|
|
46
|
+
}]);
|
|
47
|
+
function defineCustomElement() {
|
|
48
|
+
if (typeof customElements === "undefined") {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const components = ["q2-badge"];
|
|
52
|
+
components.forEach(tagName => { switch (tagName) {
|
|
53
|
+
case "q2-badge":
|
|
54
|
+
if (!customElements.get(tagName)) {
|
|
55
|
+
customElements.define(tagName, Q2Badge);
|
|
56
|
+
}
|
|
57
|
+
break;
|
|
58
|
+
} });
|
|
59
|
+
}
|
|
60
|
+
defineCustomElement();
|
|
61
|
+
|
|
62
|
+
export { Q2Badge as Q, defineCustomElement as d };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { h as handleAriaLabel, g as handleColor, o as overrideFocus, i as isEventFromElement, l as loc } from './index13.js';
|
|
3
|
+
import { d as defineCustomElement$1 } from './index9.js';
|
|
4
|
+
|
|
5
|
+
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}:host{display:inline-block}:host([hidden]){display:none}:host([block]){display:block;width:100%}:host{--comp-btn-primary-bg:var(--tct-btn-primary-bg, var(--t-btn-primary-bg, #2e2e2e));--comp-btn-primary-font-color:var(--tct-btn-primary-font-color, var(--t-btn-primary-font-color, var(--tct-white, var(--app-white, #ffffff))));--comp-btn-fallback-box-shadow:0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);--comp-btn-fallback-hover-box-shadow:0 5px 10px rgba(0, 0, 0, 0.19), 0 3px 3px rgba(0, 0, 0, 0.23);--comp-btn-neutral-fallback-hover-box-shadow:0 5px 10px rgba(0, 0, 0, 0.24), 0 3px 3px rgba(0, 0, 0, 0.36);--comp-btn-primary-box-shadow:var(--tct-btn-primary-box-shadow, var(--t-btn-primary-box-shadow, var(--comp-btn-fallback-box-shadow)));--comp-btn-primary-hover-box-shadow:var(--tct-btn-primary-hover-box-shadow, var(--t-btn-primary-hover-box-shadow, var(--comp-btn-fallback-hover-box-shadow)));--comp-btn-secondary-bg:var(--tct-btn-secondary-bg, var(--t-button-default-bg, #cccccc));--comp-btn-secondary-font-color:var(--tct-btn-secondary-font-color, var(--t-btn-secondary-font-color, var(--t-button-default-font-color, #2e2e2e)));--comp-btn-secondary-box-shadow:var(--tct-btn-secondary-box-shadow, var(--t-btn-secondary-box-shadow, var(--comp-btn-fallback-box-shadow)));--comp-btn-secondary-hover-box-shadow:var(--tct-btn-secondary-hover-box-shadow, var(--t-btn-secondary-hover-box-shadow, var(--comp-btn-fallback-hover-box-shadow)));--comp-btn-tween:var(--tct-btn-tween, var(--t-btn-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));--comp-btn-neutral-bg:var(--tct-btn-neutral-bg, transparent);--comp-btn-neutral-font-color:var(--tct-btn-neutral-font-color, var(--t-btn-neutral-font-color, var(--t-button-default-font-color, #2e2e2e)));--comp-btn-neutral-box-shadow:var(--tct-btn-neutral-box-shadow, var(--t-btn-neutral-box-shadow, var(--comp-btn-fallback-box-shadow)));--comp-btn-neutral-hover-box-shadow:var(--tct-btn-neutral-hover-box-shadow, var(--t-btn-neutral-hover-box-shadow, var(--comp-btn-neutral-fallback-hover-box-shadow)))}button{margin:var(--tct-scale-0, var(--app-scale-0x, 0));padding:var(--tct-scale-0, var(--app-scale-0x, 0));display:inline-block;width:100%;hyphens:auto;border:0;background:transparent;box-shadow:none;border-radius:0;font-weight:400;color:inherit;cursor:pointer;transition:var(--comp-btn-tween);transition-property:background, color, box-shadow, fill, border-color, border-width;outline:0}button:disabled{opacity:var(--tct-btn-disabled-opacity, var(--t-btn-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))));cursor:not-allowed}:host([size=\"1\"]) button{padding:var(--tct-scale-1, var(--app-scale-1x, 5px))}:host([color]:not([size])) button,:host([intent]:not([size])) button{padding:var(--tct-btn-padding, var(--t-btn-padding, var(--tct-scale-2, var(--app-scale-2x, 10px))))}:host([size=\"2\"]) button{padding:var(--tct-scale-2, var(--app-scale-2x, 10px))}:host([size=\"3\"]) button{padding:var(--tct-scale-3, var(--app-scale-3x, 15px))}:host([size=\"4x\"]) button{padding:var(--tct-scale-4x, var(--app-scale-4x, 20px))}:host([size=\"4\"]) button{padding:var(--tct-scale-6x, var(--app-scale-6x, 30px))}:host([color]) button,:host([intent]) button{border-style:solid;font-size:var(--tct-btn-font-size, var(--t-btn-font-size, inherit))}:host([color=primary]) button,:host([intent=workflow-primary]) button{background:var(--comp-btn-primary-bg);color:var(--comp-btn-primary-font-color);border-color:var(--tct-btn-primary-border-color, var(--t-btn-primary-border-color, transparent));border-width:var(--tct-btn-primary-border-width, var(--t-btn-primary-border-width, 0));border-radius:var(--tct-btn-primary-border-radius, var(--t-btn-primary-border-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));box-shadow:var(--comp-btn-primary-box-shadow);font-weight:var(--tct-btn-primary-font-weight, var(--t-btn-primary-font-weight, 600));text-transform:var(--tct-btn-primary-text-transform, var(--t-btn-primary-text-transform, none));letter-spacing:var(--tct-btn-primary-letter-spacing, var(--t-btn-primary-letter-spacing, normal))}:host([color=primary]) button:enabled:hover,:host([color=primary]) button:enabled:focus,:host([color=primary]) button:enabled:active,:host([intent=workflow-primary]) button:enabled:hover,:host([intent=workflow-primary]) button:enabled:focus,:host([intent=workflow-primary]) button:enabled:active{background:var(--tct-btn-primary-hover-bg, var(--t-btn-primary-hover-bg, var(--tct-gray-5, var(--t-gray-5, var(--tct-gray-d2, var(--app-gray-d2, #404040))))));color:var(--tct-btn-primary-hover-font-color, var(--t-btn-primary-hover-font-color, var(--tct-white, var(--app-white, #ffffff))));border-color:var(--tct-btn-primary-hover-border-color, var(--t-btn-primary-hover-border-color, var(--tct-btn-primary-border-color, var(--t-btn-primary-border-color, transparent))))}:host([color=primary]) button:hover:enabled,:host([color=primary]) button:active:enabled,:host([intent=workflow-primary]) button:hover:enabled,:host([intent=workflow-primary]) button:active:enabled{box-shadow:var(--comp-btn-primary-hover-box-shadow)}:host([color=primary]) button:focus,:host([color=primary]) button:focus:hover:enabled,:host([color=primary]) button:focus:active:enabled,:host([intent=workflow-primary]) button:focus,:host([intent=workflow-primary]) button:focus:hover:enabled,:host([intent=workflow-primary]) button:focus:active:enabled{box-shadow:var(--const-double-focus-ring), var(--comp-btn-primary-hover-box-shadow)}:host([color=primary]) button:disabled,:host([intent=workflow-primary]) button:disabled{background:var(--tct-btn-primary-disabled-bg, var(--t-btn-primary-disabled-bg, var(--comp-btn-primary-bg)));color:var(--tct-btn-primary-disabled-font-color, var(--t-btn-primary-disabled-font-color, var(--comp-btn-primary-font-color)));box-shadow:var(--tct-btn-primary-disabled-box-shadow, var(--t-btn-primary-disabled-box-shadow, var(--comp-btn-primary-box-shadow)))}:host([color=secondary]) button,:host([intent=workflow-secondary]) button{background:var(--comp-btn-secondary-bg);color:var(--comp-btn-secondary-font-color, var(--tct-btn-secondary-font-color, var(--t-btn-secondary-font-color, var(--tct-white, var(--app-white, #ffffff)))));border-color:var(--tct-btn-secondary-border-color, var(--t-btn-secondary-border-color, transparent));border-width:var(--tct-btn-secondary-border-width, var(--t-btn-secondary-border-width, 0));border-radius:var(--tct-btn-secondary-border-radius, var(--t-btn-secondary-border-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));box-shadow:var(--comp-btn-secondary-box-shadow);font-weight:var(--tct-btn-secondary-font-weight, var(--t-btn-secondary-font-weight, 600));text-transform:var(--tct-btn-secondary-text-transform, var(--t-btn-secondary-text-transform, none));letter-spacing:var(--tct-btn-secondary-letter-spacing, var(--t-btn-secondary-letter-spacing, normal))}:host([color=secondary]) button:enabled:hover,:host([color=secondary]) button:enabled:focus,:host([color=secondary]) button:enabled:active,:host([intent=workflow-secondary]) button:enabled:hover,:host([intent=workflow-secondary]) button:enabled:focus,:host([intent=workflow-secondary]) button:enabled:active{background:var(--tct-btn-secondary-hover-bg, var(--t-btn-secondary-hover-bg, var(--tct-gray-5, var(--t-gray-5, var(--tct-gray-d2, var(--app-gray-d2, #404040))))));color:var(--tct-btn-secondary-hover-font-color, var(--t-btn-secondary-hover-font-color, var(--t-button-default-hover-font-color, var(--tct-white, var(--app-white, #ffffff)))));border-color:var(--tct-btn-secondary-hover-border-color, var(--t-btn-secondary-hover-border-color, var(--tct-btn-secondary-border-color, var(--t-btn-secondary-border-color, transparent))))}:host([color=secondary]) button:hover:enabled,:host([color=secondary]) button:active:enabled,:host([intent=workflow-secondary]) button:hover:enabled,:host([intent=workflow-secondary]) button:active:enabled{box-shadow:var(--comp-btn-secondary-hover-box-shadow)}:host([color=secondary]) button:focus,:host([color=secondary]) button:focus:hover:enabled,:host([color=secondary]) button:focus:active:enabled,:host([intent=workflow-secondary]) button:focus,:host([intent=workflow-secondary]) button:focus:hover:enabled,:host([intent=workflow-secondary]) button:focus:active:enabled{box-shadow:var(--const-double-focus-ring), var(--comp-btn-secondary-hover-box-shadow)}:host([color=secondary]) button:disabled,:host([intent=workflow-secondary]) button:disabled{background:var(--tct-btn-secondary-disabled-bg, var(--t-btn-secondary-disabled-bg, var(--comp-btn-secondary-bg)));color:var(--tct-btn-secondary-disabled-font-color, var(--t-btn-secondary-disabled-font-color, var(--comp-btn-secondary-font-color)));box-shadow:var(--tct-btn-secondary-disabled-box-shadow, var(--t-btn-secondary-disabled-box-shadow, var(--comp-btn-secondary-box-shadow)))}:host([intent=neutral]) button{background:var(--comp-btn-neutral-bg, var(--tct-btn-neutral-bg, var(--t-btn-neutral-bg, transparent)));color:var(--comp-btn-neutral-font-color, var(--tct-btn-neutral-font-color, var(--t-btn-neutral-font-color, var(--tct-gray-1, var(--t-gray-1, var(--tct-black, var(--app-black, #0d0d0d)))))));border-color:var(--tct-btn-neutral-border-color, var(--t-btn-neutral-border-color, transparent));border-width:var(--tct-btn-neutral-border-width, var(--t-btn-neutral-border-width, 0));border-radius:var(--tct-btn-neutral-border-radius, var(--t-btn-neutral-border-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));box-shadow:var(--comp-btn-neutral-box-shadow);font-weight:var(--tct-btn-neutral-font-weight, var(--t-btn-neutral-font-weight, 600));text-transform:var(--tct-btn-neutral-text-transform, var(--t-btn-neutral-text-transform, none));letter-spacing:var(--tct-btn-neutral-letter-spacing, var(--t-btn-neutral-letter-spacing, normal))}:host([intent=neutral]) button:enabled:hover,:host([intent=neutral]) button:enabled:focus,:host([intent=neutral]) button:enabled:active{background:var(--tct-btn-neutral-hover-bg, var(--t-btn-neutral-hover-bg, transparent));color:var(--tct-btn-neutral-hover-font-color, var(--t-btn-neutral-hover-font-color, var(--tct-white, var(--app-white, #ffffff))));border-color:var(--tct-btn-neutral-hover-border-color, var(--t-btn-neutral-hover-border-color, var(--tct-btn-neutral-border-color, var(--t-btn-neutral-border-color, transparent))))}:host([intent=neutral]) button:hover:enabled,:host([intent=neutral]) button:active:enabled{box-shadow:var(--comp-btn-neutral-hover-box-shadow)}:host([intent=neutral]) button:focus,:host([intent=neutral]) button:focus:hover:enabled,:host([intent=neutral]) button:focus:active:enabled{box-shadow:var(--const-double-focus-ring), var(--comp-btn-neutral-hover-box-shadow)}:host([intent=neutral]) button:disabled{background:var(--tct-btn-neutral-disabled-bg, var(--t-btn-neutral-disabled-bg, var(--comp-btn-neutral-bg)));color:var(--tct-btn-neutral-disabled-font-color, var(--t-btn-neutral-disabled-font-color, var(--comp-btn-neutral-font-color)));box-shadow:var(--tct-btn-neutral-disabled-box-shadow, var(--comp-btn-neutral-box-shadow))}:host button.icon-only{width:var(--tct-btn-icon-width, var(--t-btn-icon-width, 44px));height:var(--tct-btn-icon-height, var(--t-btn-icon-height, 44px));border-radius:var(--tct-btn-icon-border-radius, var(--t-btn-icon-border-radius, 0))}:host button.icon-only:hover,:host button.icon-only:focus{background-color:var(--tct-btn-icon-hover-bg, var(--t-btn-icon-hover-bg, var(--tct-gray-13, var(--t-gray-13, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))))}:host(:not([intent])[active]) button.icon-only{background-color:var(--tct-btn-icon-active-bg, var(--t-btn-icon-active-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))))}:host(:not([intent])) button.icon-only:hover *,:host(:not([intent])) button.icon-only:focus *,:host(:not([intent])[active]) button.icon-only *{color:var(--tct-btn-icon-hover-color, var(--t-btn-icon-hover-color, var(--tct-link-hover-color, var(--t-link-hover-color, #080808))))}:host([badge]) button{padding:var(--tct-btn-badge-padding, var(--t-btn-badge-padding, 2px 5px));font-size:var(--tct-btn-badge-font-size, var(--t-btn-badge-font-size, var(--tct-btn-font-size, var(--t-btn-font-size, inherit))));border-radius:var(--tct-btn-badge-border-radius, var(--t-btn-badge-border-radius, var(--tct-border-radius-1, var(--app-border-radius-1, 3px))));background-color:var(--tct-btn-badge-bg, var(--t-btn-badge-bg, transparent));color:var(--tct-btn-badge-font-color, var(--t-btn-badge-font-color, inherit))}:host([badge]) button ::slotted(q2-icon){--tct-icon-size:1em}:host([badge]:hover) button:enabled{background-color:var(--tct-btn-badge-hover-bg, var(--t-btn-badge-hover-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))));color:var(--tct-btn-badge-hover-font-color, var(--t-btn-badge-hover-font-color, var(--tct-gray-5, var(--t-gray-5, var(--tct-gray-d2, var(--app-gray-d2, #404040))))))}:host(.selected[badge]) button,:host([active][badge]) button{background-color:var(--tct-btn-badge-active-bg, var(--t-btn-badge-active-bg, var(--comp-btn-primary-bg)));color:var(--tct-btn-badge-active-font-color, var(--t-btn-badge-active-font-color, var(--comp-btn-primary-font-color)))}div{display:flex;align-items:center;justify-content:center;gap:var(--app-scale-1x, 5px)}:host([loading]) .icon-right div{flex-direction:row-reverse}q2-loading{--tct-loading-primary-color:currentColor;--tct-loading-secondary-color:currentColor;--tct-loading-spinner-size:24px}:host([loading]) ::slotted(q2-icon){display:none}:host([loading]) button{pointer-events:none}:host([block]) button,:host([block]) button.icon-only{display:block;width:100%}";
|
|
6
|
+
|
|
7
|
+
const Q2Btn = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.handleSlotChange = () => {
|
|
13
|
+
this.handleIcons();
|
|
14
|
+
};
|
|
15
|
+
this.ariaExpanded = undefined;
|
|
16
|
+
this.ariaHasPopup = undefined;
|
|
17
|
+
this.ariaControls = undefined;
|
|
18
|
+
this.ariaSelected = undefined;
|
|
19
|
+
this.label = undefined;
|
|
20
|
+
this.hideLabel = undefined;
|
|
21
|
+
this.ariaLabel = undefined;
|
|
22
|
+
this.tabIndex = undefined;
|
|
23
|
+
this.intent = undefined;
|
|
24
|
+
this.color = undefined;
|
|
25
|
+
this.disabled = undefined;
|
|
26
|
+
this.type = undefined;
|
|
27
|
+
this.loading = undefined;
|
|
28
|
+
this.badge = undefined;
|
|
29
|
+
this.active = undefined;
|
|
30
|
+
this.fab = undefined;
|
|
31
|
+
this.block = undefined;
|
|
32
|
+
this.iconPosition = undefined;
|
|
33
|
+
}
|
|
34
|
+
////////// LIFECYCLE HOOKS ////////
|
|
35
|
+
componentWillLoad() {
|
|
36
|
+
this.handleIcons();
|
|
37
|
+
handleAriaLabel(this);
|
|
38
|
+
handleColor(this);
|
|
39
|
+
}
|
|
40
|
+
componentDidLoad() {
|
|
41
|
+
overrideFocus(this.hostElement);
|
|
42
|
+
}
|
|
43
|
+
disable(ev) {
|
|
44
|
+
if (this.disabled) {
|
|
45
|
+
ev.stopImmediatePropagation();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
delegateFocus(event) {
|
|
49
|
+
if (!isEventFromElement(event, this.hostElement))
|
|
50
|
+
return;
|
|
51
|
+
this.hostElement.shadowRoot.querySelector('button').focus();
|
|
52
|
+
}
|
|
53
|
+
//////// Method //////////
|
|
54
|
+
////////// OBSERVERS //////////
|
|
55
|
+
ariaLabelObserver() {
|
|
56
|
+
handleAriaLabel(this);
|
|
57
|
+
}
|
|
58
|
+
handleIcons() {
|
|
59
|
+
// Only allow one icon in the button
|
|
60
|
+
const icon = Array.from(this.hostElement.querySelectorAll(':scope > q2-icon')).reduce((acc, element) => {
|
|
61
|
+
if (acc)
|
|
62
|
+
element.remove();
|
|
63
|
+
else
|
|
64
|
+
acc = element;
|
|
65
|
+
return acc;
|
|
66
|
+
}, null);
|
|
67
|
+
const hasIcon = !!icon;
|
|
68
|
+
const hasLoc = !!this.hostElement.querySelector('q2-loc');
|
|
69
|
+
const hasText = !!this.hostElement.textContent.trim();
|
|
70
|
+
const hasIconLeft = (hasLoc || hasText) && hasIcon && this.hostElement.firstElementChild === icon;
|
|
71
|
+
const hasIconRight = (hasLoc || hasText) && hasIcon && this.hostElement.lastElementChild === icon;
|
|
72
|
+
const hasIconOnly = !hasIconLeft && !hasIconRight && hasIcon;
|
|
73
|
+
let iconPosition;
|
|
74
|
+
if (hasIconOnly)
|
|
75
|
+
iconPosition = 'only';
|
|
76
|
+
else if (hasIconLeft)
|
|
77
|
+
iconPosition = 'left';
|
|
78
|
+
else if (hasIconRight)
|
|
79
|
+
iconPosition = 'right';
|
|
80
|
+
this.iconPosition = iconPosition;
|
|
81
|
+
}
|
|
82
|
+
render() {
|
|
83
|
+
const { ariaExpanded, ariaHasPopup, ariaSelected, disabled, type, tabindex } = this.buttonAttributes;
|
|
84
|
+
const { iconPosition, loading, badge, label, hideLabel } = this;
|
|
85
|
+
const renderLoadingSpinner = iconPosition || loading;
|
|
86
|
+
const isLoadingSpinnerInline = !iconPosition || badge;
|
|
87
|
+
return (h("button", { "aria-expanded": ariaExpanded, "aria-haspopup": ariaHasPopup, "aria-label": hideLabel && loc(label), "aria-selected": ariaSelected, disabled: disabled, type: type, tabindex: tabindex, "test-id": "q2BtnInnerButton", class: iconPosition ? `icon-${iconPosition}` : '' }, h("div", null, renderLoadingSpinner && (h("q2-loading", { hidden: !loading, modifiers: isLoadingSpinnerInline ? 'inline' : undefined })), !hideLabel && label ? loc(label) : h("slot", { onSlotchange: this.handleSlotChange }))));
|
|
88
|
+
}
|
|
89
|
+
get buttonAttributes() {
|
|
90
|
+
var _a, _b, _c;
|
|
91
|
+
return {
|
|
92
|
+
ariaExpanded: this.ariaExpanded !== undefined ? `${((_a = this.ariaExpanded) === null || _a === void 0 ? void 0 : _a.toString()) === 'true'}` : undefined,
|
|
93
|
+
ariaHasPopup: this.ariaHasPopup !== undefined ? `${((_b = this.ariaHasPopup) === null || _b === void 0 ? void 0 : _b.toString()) === 'true'}` : undefined,
|
|
94
|
+
ariaLabel: this.label && this.hideLabel ? loc(this.label) : undefined,
|
|
95
|
+
ariaSelected: this.ariaSelected !== undefined ? `${((_c = this.ariaSelected) === null || _c === void 0 ? void 0 : _c.toString()) === 'true'}` : undefined,
|
|
96
|
+
disabled: this.disabled || false,
|
|
97
|
+
type: this.type || 'button',
|
|
98
|
+
tabindex: this.tabIndex || undefined,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
get hostElement() { return this; }
|
|
102
|
+
static get watchers() { return {
|
|
103
|
+
"ariaLabel": ["ariaLabelObserver"]
|
|
104
|
+
}; }
|
|
105
|
+
static get style() { return stylesCss; }
|
|
106
|
+
}, [1, "q2-btn", {
|
|
107
|
+
"ariaExpanded": [1, "aria-expanded"],
|
|
108
|
+
"ariaHasPopup": [1, "aria-has-popup"],
|
|
109
|
+
"ariaControls": [1, "aria-controls"],
|
|
110
|
+
"ariaSelected": [1, "aria-selected"],
|
|
111
|
+
"label": [1537],
|
|
112
|
+
"hideLabel": [1540, "hide-label"],
|
|
113
|
+
"ariaLabel": [1537, "aria-label"],
|
|
114
|
+
"tabIndex": [2, "tab-index"],
|
|
115
|
+
"intent": [513],
|
|
116
|
+
"color": [513],
|
|
117
|
+
"disabled": [516],
|
|
118
|
+
"type": [513],
|
|
119
|
+
"loading": [516],
|
|
120
|
+
"badge": [516],
|
|
121
|
+
"active": [516],
|
|
122
|
+
"fab": [516],
|
|
123
|
+
"block": [516],
|
|
124
|
+
"iconPosition": [32]
|
|
125
|
+
}, [[2, "click", "disable"], [0, "focus", "delegateFocus"]]]);
|
|
126
|
+
function defineCustomElement() {
|
|
127
|
+
if (typeof customElements === "undefined") {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
const components = ["q2-btn", "q2-loading"];
|
|
131
|
+
components.forEach(tagName => { switch (tagName) {
|
|
132
|
+
case "q2-btn":
|
|
133
|
+
if (!customElements.get(tagName)) {
|
|
134
|
+
customElements.define(tagName, Q2Btn);
|
|
135
|
+
}
|
|
136
|
+
break;
|
|
137
|
+
case "q2-loading":
|
|
138
|
+
if (!customElements.get(tagName)) {
|
|
139
|
+
defineCustomElement$1();
|
|
140
|
+
}
|
|
141
|
+
break;
|
|
142
|
+
} });
|
|
143
|
+
}
|
|
144
|
+
defineCustomElement();
|
|
145
|
+
|
|
146
|
+
export { Q2Btn as Q, defineCustomElement as d };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { h as handleAriaLabel, l as loc } from './index13.js';
|
|
3
|
+
import { d as defineCustomElement$3 } from './index5.js';
|
|
4
|
+
import { d as defineCustomElement$2 } from './index7.js';
|
|
5
|
+
import { d as defineCustomElement$1 } from './index9.js';
|
|
6
|
+
|
|
7
|
+
const stylesCss = "*{box-sizing:border-box}*:active{outline:none}*:focus{outline:none;box-shadow:var(--const-double-focus-ring, 0 0 0 2px #ffffff, 0 0 0 4px #33b4ff #06C)}:host{box-shadow:none !important}::-moz-focus-inner{border:none}input,textarea,button{font-family:inherit;font-size:inherit;font-stretch:inherit}:host(.sr),:host(.sr) button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.sr,.sr button{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}.hidden{display:none}:host([hidden]){display:none}.invisible{visibility:hidden}.dropdown-separator{--comp-default-separator-margin:0 var(--tct-scale-1, var(--app-scale-3x, 15px));margin:var(--tct-dropdown-separator-margin, var(--t-dropdown-separator-margin, var(--comp-default-separator-margin)));border-bottom:1px solid var(--tct-dropdown-item-separator-color, var(--t-dropdown-item-separator-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc))))))}.dropdown-item-wrapper{display:flex}.dropdown-item{min-height:44px;flex:1 1 100%;padding:var(--tct-dropdown-item-padding, var(--t-dropdown-item-padding, 2px))}.dropdown-item-content{--comp-default-content-padding:12px var(--app-scale-3x, 15px);padding:var(--tct-dropdown-item-content-padding, var(--t-dropdown-item-content-padding, var(--comp-default-content-padding)));text-align:left;background-color:var(--tct-dropdown-item-bg, var(--t-dropdown-item-bg, var(--tct-white, var(--t-base, var(--app-white, #ffffff)))));color:var(--tct-dropdown-item-font-color, var(--t-dropdown-item-font-color, inherit));transition:background-color var(--tct-dropdown-item-content-tween, var(--t-dropdown-item-content-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));overflow:hidden;text-overflow:ellipsis;flex:1}:host(:not([disabled])) .dropdown-item-content:hover,:host(:not([disabled])) .dropdown-item:focus-within .dropdown-item-content{background-color:var(--tct-dropdown-item-selected-bg, var(--t-dropdown-item-selected-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, var(--t-base, #f2f2f2)))))));color:var(--tct-dropdown-item-selected-font-color, var(--t-dropdown-item-selected-font-color, inherit))}.remove-dropdown-item{flex:0 0 44px;margin:2px}";
|
|
8
|
+
|
|
9
|
+
const Q2DropdownItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super();
|
|
12
|
+
this.__registerHost();
|
|
13
|
+
this.__attachShadow();
|
|
14
|
+
this.onItemClick = (event) => {
|
|
15
|
+
event.stopImmediatePropagation();
|
|
16
|
+
this.hostElement.dispatchEvent(new CustomEvent('click', {
|
|
17
|
+
detail: {
|
|
18
|
+
type: 'select',
|
|
19
|
+
value: this.value || '',
|
|
20
|
+
},
|
|
21
|
+
bubbles: true,
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
this.onItemKeydown = (event) => {
|
|
25
|
+
if (['ArrowRight', 'Right'].includes(event.key)) {
|
|
26
|
+
this.focusRemoveBtn();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
this.onItemFocus = (event) => {
|
|
30
|
+
event.stopPropagation();
|
|
31
|
+
};
|
|
32
|
+
this.onRemoveBtnClick = (event) => {
|
|
33
|
+
event.stopImmediatePropagation();
|
|
34
|
+
this.hostElement.dispatchEvent(new CustomEvent('click', {
|
|
35
|
+
detail: {
|
|
36
|
+
type: 'remove',
|
|
37
|
+
value: this.value || '',
|
|
38
|
+
},
|
|
39
|
+
bubbles: true,
|
|
40
|
+
}));
|
|
41
|
+
};
|
|
42
|
+
this.onRemoveBtnKeydown = (event) => {
|
|
43
|
+
if (['ArrowLeft', 'Left'].includes(event.key)) {
|
|
44
|
+
this.focusItem();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
this.onRemoveBtnFocus = (event) => {
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
};
|
|
50
|
+
this.disabled = undefined;
|
|
51
|
+
this.removable = undefined;
|
|
52
|
+
this.separator = undefined;
|
|
53
|
+
this.label = undefined;
|
|
54
|
+
this.ariaLabel = undefined;
|
|
55
|
+
this.value = undefined;
|
|
56
|
+
}
|
|
57
|
+
/////// LIFECYCLE HOOKS //////
|
|
58
|
+
componentWillLoad() {
|
|
59
|
+
handleAriaLabel(this);
|
|
60
|
+
}
|
|
61
|
+
//////// OBSERVERS //////////
|
|
62
|
+
ariaLabelObserver() {
|
|
63
|
+
handleAriaLabel(this);
|
|
64
|
+
}
|
|
65
|
+
get removeLabel() {
|
|
66
|
+
return loc('tecton.element.dropdownItem.remove', [this.label || '']);
|
|
67
|
+
}
|
|
68
|
+
get dropdownItemBtn() {
|
|
69
|
+
return this.hostElement.shadowRoot.querySelector('.dropdown-item');
|
|
70
|
+
}
|
|
71
|
+
get innerLabel() {
|
|
72
|
+
return this.label || this.hostElement.textContent;
|
|
73
|
+
}
|
|
74
|
+
get removeBtn() {
|
|
75
|
+
return this.hostElement.shadowRoot.querySelector('.remove-dropdown-item');
|
|
76
|
+
}
|
|
77
|
+
///////// Host Element Events //////
|
|
78
|
+
onHostElementFocus() {
|
|
79
|
+
if (event.target === this.hostElement) {
|
|
80
|
+
this.focusItem();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
///////// Actions /////////
|
|
84
|
+
focusItem() {
|
|
85
|
+
this.dropdownItemBtn.dispatchEvent(new FocusEvent('focus', { bubbles: false }));
|
|
86
|
+
}
|
|
87
|
+
focusRemoveBtn() {
|
|
88
|
+
this.removeBtn && this.removeBtn.dispatchEvent(new FocusEvent('focus', { bubbles: false }));
|
|
89
|
+
}
|
|
90
|
+
render() {
|
|
91
|
+
if (!!this.separator) {
|
|
92
|
+
return this.separatorDOM();
|
|
93
|
+
}
|
|
94
|
+
return this.itemDOM();
|
|
95
|
+
}
|
|
96
|
+
separatorDOM() {
|
|
97
|
+
return (h("div", { class: "dropdown-separator", role: "separator", "test-id": "dropdownItemSeparator" }));
|
|
98
|
+
}
|
|
99
|
+
itemDOM() {
|
|
100
|
+
return (h("div", { class: "dropdown-item-wrapper" }, h("q2-btn", { class: "dropdown-item", label: this.innerLabel, "hide-label": true, disabled: !!this.disabled, role: "menuitem", onClick: this.onItemClick, onKeyDown: this.onItemKeydown, onFocus: this.onItemFocus, "test-id": "dropdownItem" }, h("div", { class: "dropdown-item-content" }, h("slot", null))), !!this.removable ? (h("q2-btn", { class: "remove-dropdown-item", label: this.removeLabel, "hide-label": true, disabled: !!this.disabled, role: "menuitem", onClick: this.onRemoveBtnClick, onKeyDown: this.onRemoveBtnKeydown, onFocus: this.onRemoveBtnFocus, "test-id": "removeDropdownItem" }, h("q2-icon", { type: "close" }))) : ('')));
|
|
101
|
+
}
|
|
102
|
+
get hostElement() { return this; }
|
|
103
|
+
static get watchers() { return {
|
|
104
|
+
"ariaLabel": ["ariaLabelObserver"]
|
|
105
|
+
}; }
|
|
106
|
+
static get style() { return stylesCss; }
|
|
107
|
+
}, [1, "q2-dropdown-item", {
|
|
108
|
+
"disabled": [516],
|
|
109
|
+
"removable": [516],
|
|
110
|
+
"separator": [516],
|
|
111
|
+
"label": [513],
|
|
112
|
+
"ariaLabel": [513, "aria-label"],
|
|
113
|
+
"value": [513]
|
|
114
|
+
}, [[0, "focus", "onHostElementFocus"]]]);
|
|
115
|
+
function defineCustomElement() {
|
|
116
|
+
if (typeof customElements === "undefined") {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const components = ["q2-dropdown-item", "q2-btn", "q2-icon", "q2-loading"];
|
|
120
|
+
components.forEach(tagName => { switch (tagName) {
|
|
121
|
+
case "q2-dropdown-item":
|
|
122
|
+
if (!customElements.get(tagName)) {
|
|
123
|
+
customElements.define(tagName, Q2DropdownItem);
|
|
124
|
+
}
|
|
125
|
+
break;
|
|
126
|
+
case "q2-btn":
|
|
127
|
+
if (!customElements.get(tagName)) {
|
|
128
|
+
defineCustomElement$3();
|
|
129
|
+
}
|
|
130
|
+
break;
|
|
131
|
+
case "q2-icon":
|
|
132
|
+
if (!customElements.get(tagName)) {
|
|
133
|
+
defineCustomElement$2();
|
|
134
|
+
}
|
|
135
|
+
break;
|
|
136
|
+
case "q2-loading":
|
|
137
|
+
if (!customElements.get(tagName)) {
|
|
138
|
+
defineCustomElement$1();
|
|
139
|
+
}
|
|
140
|
+
break;
|
|
141
|
+
} });
|
|
142
|
+
}
|
|
143
|
+
defineCustomElement();
|
|
144
|
+
|
|
145
|
+
export { Q2DropdownItem as Q, defineCustomElement as d };
|