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,156 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { o as overrideFocus, i as isEventFromElement, l as loc } from './index13.js';
|
|
3
|
+
import { d as defineCustomElement$5 } from './index2.js';
|
|
4
|
+
import { d as defineCustomElement$4 } from './index7.js';
|
|
5
|
+
import { d as defineCustomElement$3 } from './index11.js';
|
|
6
|
+
import { d as defineCustomElement$2 } from './index12.js';
|
|
7
|
+
|
|
8
|
+
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;position:relative;line-height:0}:host(:not(:last-child)){margin-inline-end:var(--tct-tag-margin, var(--t-tag-margin, var(--app-scale-2x, 10px)))}.tag-wrapper{--comp-tag-btn-size:var(--tct-tag-btn-size, var(--t-tag-btn-size, var(--app-scale-6x, 30px)));--comp-tag-background:var(--tct-tag-background, var(--t-tag-background, var(--t-gray-13, #e6e6e6)));--comp-tag-color:var(--tct-tag-color, var(--t-tag-color, var(--t-gray-3, #262626)));position:relative}:host([theme=primary]) .tag-wrapper{--comp-tag-background:var(--t-primary-l5, #61c4ff);--comp-tag-color:var(--t-primary-text, #ffffff)}:host([theme=secondary]) .tag-wrapper{--comp-tag-background:var(--t-secondary-l5, #d9e1e6);--comp-tag-color:var(--t-secondary-text, #000000)}:host([theme=tertiary]) .tag-wrapper{--comp-tag-background:var(--t-tertiary-l5, #f4fafe);--comp-tag-color:var(--t-tertiary-text, #000000)}.tag{height:var(--tct-tag-height, var(--t-tag-height, var(--app-scale-6x, 30px)));line-height:var(--tct-tag-height, var(--t-tag-height, var(--app-scale-6x, 30px)));padding-inline:var(--tct-tag-padding-inline, var(--t-tag-padding-inline, var(--app-scale-3x, 15px)));background:var(--comp-tag-background);color:var(--comp-tag-color);border-radius:var(--tct-tag-border-radius, var(--t-tag-border-radius, var(--app-border-radius-1, 3px)))}.has-options .tag{padding-right:var(--comp-tag-btn-size)}.btn-wrapper{--comp-tag-clickable-size:var(--tct-tag-clickable-size, var(--t-tag-clickable-size, 44px));--comp-tag-btn-offset:calc(calc(calc(var(--comp-tag-clickable-size) - var(--comp-tag-btn-size)) / 2) * -1);height:var(--comp-tag-clickable-size);width:var(--comp-tag-clickable-size);display:flex;align-items:center;justify-content:center;position:absolute;right:var(--comp-tag-btn-offset);top:var(--comp-tag-btn-offset);cursor:pointer}button{width:var(--comp-tag-btn-size);height:var(--comp-tag-btn-size);stroke:var(--comp-tag-color);--tct-icon-stroke-primary:var(--comp-tag-color);cursor:pointer;border:0;background:transparent;display:flex;align-items:center;justify-content:center;padding:0;--tct-icon-size:18px}";
|
|
9
|
+
|
|
10
|
+
const Q2Tag$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super();
|
|
13
|
+
this.__registerHost();
|
|
14
|
+
this.__attachShadow();
|
|
15
|
+
this.click = createEvent(this, "click", 7);
|
|
16
|
+
this.activateFirstOption = false;
|
|
17
|
+
/// Getters ///
|
|
18
|
+
/// Helpers
|
|
19
|
+
this.determineHasOptions = () => {
|
|
20
|
+
const hasOptions = !!this.hostElement.querySelectorAll('q2-option').length;
|
|
21
|
+
this.hasOptions = hasOptions;
|
|
22
|
+
};
|
|
23
|
+
/// Event Handlers ///
|
|
24
|
+
this.onClickElsewhere = (event) => {
|
|
25
|
+
const target = event.target;
|
|
26
|
+
if (target.localName === 'click-elsewhere') {
|
|
27
|
+
event.stopPropagation();
|
|
28
|
+
this.popoverElement.open = false;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
this.handleChange = event => {
|
|
32
|
+
event.stopPropagation();
|
|
33
|
+
if (!this.hasOptions)
|
|
34
|
+
return;
|
|
35
|
+
const { value } = event.detail;
|
|
36
|
+
this.click.emit({ value });
|
|
37
|
+
};
|
|
38
|
+
this.handleClick = (event) => {
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
this.activateFirstOption = false;
|
|
41
|
+
this.popoverElement.toggle();
|
|
42
|
+
};
|
|
43
|
+
this.handleKeydown = (event) => {
|
|
44
|
+
this.activateFirstOption = true;
|
|
45
|
+
this.optionList.handleExternalKeydown(event);
|
|
46
|
+
};
|
|
47
|
+
this.handleButtonFocusout = (event) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const relatedTarget = event.relatedTarget;
|
|
50
|
+
if ((_a = (relatedTarget === null || relatedTarget === void 0 ? void 0 : relatedTarget.tagName) === 'Q2-OPTION') !== null && _a !== void 0 ? _a : false)
|
|
51
|
+
return;
|
|
52
|
+
this.open = false;
|
|
53
|
+
};
|
|
54
|
+
this.handleWrapperClick = () => {
|
|
55
|
+
this.dropdownBtn.focus();
|
|
56
|
+
this.dropdownBtn.click();
|
|
57
|
+
};
|
|
58
|
+
this.open = undefined;
|
|
59
|
+
this.role = 'listitem';
|
|
60
|
+
this.label = undefined;
|
|
61
|
+
this.theme = undefined;
|
|
62
|
+
this.popoverMinHeight = 150;
|
|
63
|
+
this.popoverDirection = undefined;
|
|
64
|
+
this.hasOptions = undefined;
|
|
65
|
+
}
|
|
66
|
+
/// LifeCycle Hooks ///
|
|
67
|
+
componentWillLoad() {
|
|
68
|
+
const observer = new MutationObserver(this.determineHasOptions);
|
|
69
|
+
observer.observe(this.hostElement, { childList: true, attributes: true });
|
|
70
|
+
this.mutationObserver = observer;
|
|
71
|
+
}
|
|
72
|
+
componentDidLoad() {
|
|
73
|
+
overrideFocus(this.hostElement);
|
|
74
|
+
}
|
|
75
|
+
disconnectedCallback() {
|
|
76
|
+
this.mutationObserver.disconnect();
|
|
77
|
+
this.mutationObserver = null;
|
|
78
|
+
}
|
|
79
|
+
/// Listeners ///
|
|
80
|
+
delegateFocus(event) {
|
|
81
|
+
if (!isEventFromElement(event, this.hostElement))
|
|
82
|
+
return;
|
|
83
|
+
if (!this.hasOptions)
|
|
84
|
+
return;
|
|
85
|
+
this.dropdownBtn.focus();
|
|
86
|
+
}
|
|
87
|
+
popoverStateHandler({ detail: { open } }) {
|
|
88
|
+
if (this.open !== open)
|
|
89
|
+
this.open = open;
|
|
90
|
+
if (open && this.activateFirstOption) {
|
|
91
|
+
this.optionList.focus();
|
|
92
|
+
this.activateFirstOption = false;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
this.optionList.setActiveElement(null);
|
|
96
|
+
this.dropdownBtn.focus();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/// DOM ///
|
|
100
|
+
render() {
|
|
101
|
+
const { hasOptions, open } = this;
|
|
102
|
+
const wrapperClassNames = ['tag-wrapper'];
|
|
103
|
+
if (hasOptions)
|
|
104
|
+
wrapperClassNames.push('has-options');
|
|
105
|
+
return (h("click-elsewhere", { onChange: this.onClickElsewhere }, h("div", { class: wrapperClassNames.join(' '), onClick: e => e.stopPropagation() }, h("div", { class: "tag" }, this.label), this.hasOptions && (h("div", { class: "btn-wrapper", onClick: this.handleWrapperClick }, h("button", { ref: el => (this.dropdownBtn = el), "test-id": "btn-control", onClick: this.handleClick, onKeyDown: this.handleKeydown, onFocusout: this.handleButtonFocusout, "aria-controls": "option-list", "aria-haspopup": "true", "aria-expanded": open ? 'true' : 'false', "aria-label": loc('tecton.element.tag.viewOptions') }, h("q2-icon", { type: "options" }))))), this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.dropdownBtn, open: this.open, minHeight: this.popoverMinHeight, direction: this.popoverDirection }, h("q2-option-list", { id: "option-list", ref: el => (this.optionList = el), onChange: this.handleChange, align: "right", type: "menu", "no-select": true }, h("slot", null))))));
|
|
106
|
+
}
|
|
107
|
+
get hostElement() { return this; }
|
|
108
|
+
static get style() { return stylesCss; }
|
|
109
|
+
}, [1, "q2-tag", {
|
|
110
|
+
"open": [1540],
|
|
111
|
+
"role": [513],
|
|
112
|
+
"label": [513],
|
|
113
|
+
"theme": [513],
|
|
114
|
+
"popoverMinHeight": [2, "popover-min-height"],
|
|
115
|
+
"popoverDirection": [1, "popover-direction"],
|
|
116
|
+
"hasOptions": [32]
|
|
117
|
+
}, [[0, "focus", "delegateFocus"], [0, "popoverStateChanged", "popoverStateHandler"]]]);
|
|
118
|
+
function defineCustomElement$1() {
|
|
119
|
+
if (typeof customElements === "undefined") {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const components = ["q2-tag", "click-elsewhere", "q2-icon", "q2-option-list", "q2-popover"];
|
|
123
|
+
components.forEach(tagName => { switch (tagName) {
|
|
124
|
+
case "q2-tag":
|
|
125
|
+
if (!customElements.get(tagName)) {
|
|
126
|
+
customElements.define(tagName, Q2Tag$1);
|
|
127
|
+
}
|
|
128
|
+
break;
|
|
129
|
+
case "click-elsewhere":
|
|
130
|
+
if (!customElements.get(tagName)) {
|
|
131
|
+
defineCustomElement$5();
|
|
132
|
+
}
|
|
133
|
+
break;
|
|
134
|
+
case "q2-icon":
|
|
135
|
+
if (!customElements.get(tagName)) {
|
|
136
|
+
defineCustomElement$4();
|
|
137
|
+
}
|
|
138
|
+
break;
|
|
139
|
+
case "q2-option-list":
|
|
140
|
+
if (!customElements.get(tagName)) {
|
|
141
|
+
defineCustomElement$3();
|
|
142
|
+
}
|
|
143
|
+
break;
|
|
144
|
+
case "q2-popover":
|
|
145
|
+
if (!customElements.get(tagName)) {
|
|
146
|
+
defineCustomElement$2();
|
|
147
|
+
}
|
|
148
|
+
break;
|
|
149
|
+
} });
|
|
150
|
+
}
|
|
151
|
+
defineCustomElement$1();
|
|
152
|
+
|
|
153
|
+
const Q2Tag = Q2Tag$1;
|
|
154
|
+
const defineCustomElement = defineCustomElement$1;
|
|
155
|
+
|
|
156
|
+
export { Q2Tag, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface Q2Textarea extends Components.Q2Textarea, HTMLElement {}
|
|
4
|
+
export const Q2Textarea: {
|
|
5
|
+
prototype: Q2Textarea;
|
|
6
|
+
new (): Q2Textarea;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
+
import { c as createGuid, e as setMessageHeight, o as overrideFocus, i as isEventFromElement, f as labelDOM, m as messagesDOM, l as loc } from './index13.js';
|
|
3
|
+
import { d as defineCustomElement$2 } from './index7.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:block;margin-top:var(--tct-textarea-margin-top, var(--t-textarea-margin-top, var(--app-scale-6x, 30px)));margin-bottom:var(--tct-textarea-margin-bottom, var(--t-textarea-margin-bottom, var(--app-scale-6x, 30px)));font-size:var(--tct-textarea-font-size, var(--t-textarea-font-size, var(--app-font-size, inherit)))}:host([hidden]){display:none}label{display:block;padding-left:var(--tct-textarea-label-padding-left, var(--t-textarea-label-padding-left, 0));padding-right:var(--tct-textarea-label-padding-right, var(--t-textarea-label-padding-right, 0));margin-top:var(--tct-textarea-label-margin-top, var(--t-textarea-label-margin-top, 0));margin-bottom:var(--tct-textarea-label-margin-bottom, var(--t-textarea-label-margin-bottom, var(--tct-scale-1x, var(--app-scale-1x, 5px))));color:var(--tct-textarea-label-font-color, var(--t-textarea-label-font-color, inherit));font-size:var(--tct-textarea-label-font-size, var(--t-textarea-label-font-size, inherit));font-weight:var(--tct-textarea-label-font-weight, var(--t-textarea-label-font-weight, 600));text-transform:var(--tct-textarea-label-text-transform, var(--t-textarea-label-text-transform, none));letter-spacing:var(--tct-textarea-label-letter-spacing, var(--t-textarea-label-letter-spacing, normal));transition:color var(--tct-textarea-tween, var(--t-textarea-tween, var(--tct-tween-2, var(--app-tween-2, 0.4s ease))))}.optional-tag{margin-left:var(--tct-textarea-label-optional-margin-left, var(--t-textarea-label-optional-margin-left, var(--tct-scale-1x, var(--app-scale-1x, 5px))));color:var(--tct-textarea-label-optional-font-color, var(--t-textarea-label-optional-font-color, var(--t-textA, var(--t-a11y-gray-color, rgba(77, 77, 77, 0.77)))));font-size:var(--tct-textarea-label-optional-font-size, var(--t-textarea-label-optional-font-size, 12px));font-weight:var(--tct-textarea-label-optional-font-weight, var(--t-textarea-label-optional-font-weight, 400))}.input-container{min-height:var(--tct-textarea-min-height, var(--t-textarea-min-height, var(--comp-textarea-min-height)));height:100%;--comp-default-border-radius:var(--tct-border-radius-1, var(--app-border-radius-1, 3px));--comp-textarea-border-top-left-radius:var(--tct-textarea-border-top-left-radius, var(--t-textarea-border-top-left-radius, var(--comp-default-border-radius)));--comp-textarea-border-top-right-radius:var(--tct-textarea-border-top-right-radius, var(--t-textarea-border-top-right-radius, var(--comp-default-border-radius)));--comp-textarea-border-bottom-right-radius:var(--tct-textarea-border-bottom-right-radius, var(--t-textarea-border-bottom-right-radius, var(--comp-default-border-radius)));--comp-textarea-border-bottom-left-radius:var(--tct-textarea-border-bottom-left-radius, var(--t-textarea-border-bottom-left-radius, var(--comp-default-border-radius)));--comp-textarea-border-radius:var(--comp-textarea-border-top-left-radius)\n var(--comp-textarea-border-top-right-radius) var(--comp-textarea-border-bottom-right-radius)\n var(--comp-textarea-border-bottom-left-radius);--comp-textarea-border-width:var(--tct-textarea-border-top-width, var(--t-textarea-border-top-width, 1px)) var(--tct-textarea-border-right-width, var(--t-textarea-border-right-width, 1px)) var(--tct-textarea-border-bottom-width, var(--t-textarea-border-bottom-width, 1px)) var(--tct-textarea-border-left-width, var(--t-textarea-border-left-width, 1px));--comp-textarea-focus-border-width:var(--tct-textarea-focus-border-top-width, var(--t-textarea-focus-border-top-width, 1px)) var(--tct-textarea-focus-border-right-width, var(--t-textarea-focus-border-right-width, 1px)) var(--tct-textarea-focus-border-bottom-width, var(--t-textarea-focus-border-bottom-width, 1px)) var(--tct-textarea-focus-border-left-width, var(--t-textarea-focus-border-left-width, 1px));--comp-textarea-icon-clearance:34px}:host([disabled]) .input-container{cursor:not-allowed;opacity:var(--tct-textarea-disabled-opacity, var(--t-textarea-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4))))}.content-container{--comp-textarea-min-height:44px;--comp-textarea-min-width:150px;position:relative;display:inline-block;min-height:var(--tct-textarea-min-height, var(--t-textarea-min-height, var(--comp-textarea-min-height)));min-width:var(--tct-textarea-min-width, var(--t-textarea-min-width, var(--comp-textarea-min-width)))}:host(:not([cols])) .content-container{width:100%}textarea{resize:none;height:100%;-webkit-appearance:none;appearance:none;display:block;box-sizing:border-box;min-height:var(--tct-textarea-min-height, var(--t-textarea-min-height, var(--comp-textarea-min-height)));padding:var(--tct-textarea-vertical-padding, var(--t-textarea-vertical-padding, var(--tct-scale-2x, var(--app-scale-2x, 10px)))) var(--tct-textarea-horizontal-padding, var(--t-textarea-horizontal-padding, var(--tct-scale-2x, var(--app-scale-2x, 10px))));background-color:var(--tct-textarea-bg, var(--t-textarea-bg, var(--tct-input-bg, var(--t-input-bg, var(--t-gray-14, #fcfcfd)))));color:var(--tct-textarea-font-color, var(--t-textarea-font-color, var(--t-input-font-color, inherit)));border-width:var(--comp-textarea-border-width);border-style:solid;border-color:var(--tct-textarea-border-color, var(--t-textarea-border-color, var(--tct-input-border-color, var(--t-input-border-color, var(--t-a11y-gray-color-AA, #949494)))));border-radius:var(--comp-textarea-border-radius);box-shadow:var(--tct-textarea-box-shadow, var(--t-textarea-box-shadow, none));scrollbar-width:thin;scrollbar-color:var(--t-a11y-gray-color) transparent;--comp-textarea-tween:var(--tct-textarea-tween, var(--t-textarea-tween, var(--tct-tween-2, var(--app-tween-2, 0.4s ease))));transition:border-width var(--comp-textarea-tween), border-color var(--comp-textarea-tween), box-shadow var(--comp-textarea-tween)}textarea::-webkit-scrollbar{width:var(--app-scale-1x);height:var(--app-scale-1x);margin:var(--app-scale-1x)}textarea::-webkit-scrollbar-thumb{background:var(--t-a11y-gray-color);border-radius:2px}textarea::-webkit-scrollbar-track{background:transparent}textarea:not([cols]){width:100%}textarea:focus{border-width:var(--comp-textarea-focus-border-width, 1px);border-color:var(--tct-textarea-focus-border-color, var(--t-textarea-focus-border-color, var(--tct-input-focus-border-color, var(--t-input-focus-border-color, var(--t-a11y-active-gray-color-AA, #404040)))));box-shadow:var(--const-double-focus-ring), var(--tct-textarea-focus-box-shadow, var(--t-textarea-focus-box-shadow, 0 0 transparent))}textarea::placeholder{color:var(--tct-textarea-placeholder-font-color, var(--t-textarea-placeholder-font-color, var(--t-input-placeholder-font-color, var(--tct-gray-7, var(--app-gray-7, var(--tct-gray-d1, var(--app-gray-d1, #666666)))))))}textarea[disabled]{cursor:not-allowed}.has-error textarea{padding-right:var(--comp-textarea-icon-clearance)}.has-error textarea:not(:focus){border-color:var(--tct-textarea-error-border-color, var(--t-textarea-error-border-color, var(--const-stoplight-alert, #c30000)))}q2-icon{margin-top:calc(var(--tct-textarea-border-top-width, var(--t-textarea-border-top-width, 1px)) / 2);margin-bottom:calc(var(--tct-textarea-border-bottom-width, var(--t-textarea-border-bottom-width, 1px)) / 2);pointer-events:none;position:absolute;top:var(--tct-textarea-vertical-padding, var(--t-textarea-vertical-padding, var(--tct-scale-2x, var(--app-scale-2x, 10px))));color:var(--tct-textarea-icon-stroke-primary, var(--t-textarea-icon-stroke-primary, var(--app-gray-9, var(--tct-gray, var(--app-gray, #999999)))));right:0;margin-right:var(--tct-scale-2x, var(--app-scale-2x, 10px));--tct-icon-stroke-primary:var(--tct-textarea-icon-stroke-primary, var(--t-textarea-icon-stroke-primary, var(--tct-gray-9, var(--t-gray-9, var(--tct-gray, var(--app-gray, #999999))))));--t-icon-stroke-primary:var(--tct-textarea-icon-stroke-primary, var(--t-textarea-icon-stroke-primary, var(--tct-gray-9, var(--t-gray-9, var(--tct-gray, var(--app-gray, #999999))))))}.icon-error{color:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000));--tct-icon-stroke-primary:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000));--t-icon-stroke-primary:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000))}.messages-container{height:0px;overflow:hidden;background-color:var(--tct-message-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2)))));box-shadow:var(--tct-textarea-message-box-shadow, var(--t-textarea-message-box-shadow, var(--tct-box-shadow-1, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3)))));transition:height var(--tct-textarea-messages-tween, var(--t-textarea-messages-tween, var(--tct-tween-1, var(--app-tween-1, 0.2s ease))));margin-top:2px;z-index:1;position:absolute;width:100%;color:var(--tct-textarea-messages-font-color, var(--t-textarea-messages-font-color, inherit))}.has-error label{color:var(--tct-textarea-error-label-font-color, var(--t-textarea-error-label-font-color, var(--tct-textarea-label-font-color, inherit)))}.max-length{color:var(--tct-textarea-max-length-color, var(--t-textarea-max-length-color, var(--t-textA, rgba(77, 77, 77, 0.77))));font-size:var(--tct-textarea-max-length-font-size, var(--t-textarea-max-length-font-size, var(--tct-font-size-small, var(--app-font-size-small, 12px))));position:absolute;right:0}.btn-resize{--tct-textarea-resize-icon-padding:calc(\n calc(\n var(--tct-textarea-resize-btn-width, var(--t-textarea-resize-btn-width, var(--tct-btn-icon-width, 44px))) - var(--tct-textarea-resize-icon-size, var(--t-textarea-resize-icon-size, 12px))\n ) / 2\n );width:var(--tct-textarea-resize-btn-width, var(--t-textarea-resize-btn-width, var(--tct-btn-icon-width, 44px)));height:var(--tct-textarea-resize-btn-height, var(--t-textarea-resize-btn-height, var(--tct-btn-icon-height, 44px)));background:var(--tct-textarea-resize-btn-background, var(--t-textarea-resize-btn-background, transparent));stroke:var(--tct-textarea-resize-color, var(--t-textarea-resize-color, var(--t-textA, rgba(77, 77, 77, 0.77))));border:0;position:absolute;right:calc(var(--tct-textarea-resize-icon-padding, var(--t-textarea-resize-icon-padding)) * -1 + 2px);bottom:calc(var(--tct-textarea-resize-icon-padding, var(--t-textarea-resize-icon-padding)) * -1 + 2px);display:block;padding:var(--tct-textarea-resize-icon-padding, var(--t-textarea-resize-icon-padding));font-size:0}.btn-resize:focus{outline:none;box-shadow:none}:host([resize=both]) .btn-resize{cursor:se-resize}:host([resize=vertical]) .btn-resize{cursor:s-resize}:host([resize=horizontal]) .btn-resize{cursor:e-resize}";
|
|
6
|
+
|
|
7
|
+
const Q2Textarea$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super();
|
|
10
|
+
this.__registerHost();
|
|
11
|
+
this.__attachShadow();
|
|
12
|
+
this.input = createEvent(this, "input", 7);
|
|
13
|
+
this.change = createEvent(this, "change", 7);
|
|
14
|
+
this.scheduledAfterRender = [];
|
|
15
|
+
this.guid = createGuid();
|
|
16
|
+
this.checkRows = () => {
|
|
17
|
+
const { contentContainer, rows, textareaField, resize } = this;
|
|
18
|
+
if (!rows || ['none', 'horizontal'].includes(resize))
|
|
19
|
+
return;
|
|
20
|
+
contentContainer.style.height = `${contentContainer.offsetHeight}px`;
|
|
21
|
+
textareaField.removeAttribute('rows');
|
|
22
|
+
};
|
|
23
|
+
this.checkCols = () => {
|
|
24
|
+
const { contentContainer, cols, textareaField, resize } = this;
|
|
25
|
+
if (!cols || ['none', 'vertical'].includes(resize))
|
|
26
|
+
return;
|
|
27
|
+
contentContainer.style.width = `${contentContainer.offsetWidth}px`;
|
|
28
|
+
textareaField.removeAttribute('cols');
|
|
29
|
+
};
|
|
30
|
+
///// ACTIONS ////////
|
|
31
|
+
this.onTextareaFocus = () => {
|
|
32
|
+
this.hasFocus = true;
|
|
33
|
+
this.valueOnFocus = this.value;
|
|
34
|
+
setMessageHeight(this);
|
|
35
|
+
};
|
|
36
|
+
this.onTextareaBlur = () => {
|
|
37
|
+
const { valueOnFocus, textareaField: { value }, } = this;
|
|
38
|
+
this.hasFocus = false;
|
|
39
|
+
setMessageHeight(this);
|
|
40
|
+
if (valueOnFocus !== value)
|
|
41
|
+
this.change.emit({ value });
|
|
42
|
+
};
|
|
43
|
+
this.onTextareaInput = (event) => {
|
|
44
|
+
event.stopPropagation();
|
|
45
|
+
const value = event.target.value;
|
|
46
|
+
this.input.emit({ value });
|
|
47
|
+
};
|
|
48
|
+
this.onTextareaChange = (event) => {
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
const value = event.target.value;
|
|
51
|
+
this.change.emit({ value });
|
|
52
|
+
};
|
|
53
|
+
this.onMouseDown = (event) => {
|
|
54
|
+
const { contentContainer } = this;
|
|
55
|
+
this.downParams = {
|
|
56
|
+
width: contentContainer.offsetWidth,
|
|
57
|
+
height: contentContainer.offsetHeight,
|
|
58
|
+
x: event.clientX,
|
|
59
|
+
y: event.clientY,
|
|
60
|
+
};
|
|
61
|
+
document.addEventListener('mousemove', this.onMouseMove);
|
|
62
|
+
document.addEventListener('mouseup', this.onMouseUp);
|
|
63
|
+
};
|
|
64
|
+
this.onMouseMove = (event) => {
|
|
65
|
+
this.setHeight(event);
|
|
66
|
+
this.setWidth(event);
|
|
67
|
+
};
|
|
68
|
+
this.onTouchStart = (event) => {
|
|
69
|
+
if (event.touches.length !== 1)
|
|
70
|
+
return;
|
|
71
|
+
event.preventDefault();
|
|
72
|
+
const { contentContainer } = this;
|
|
73
|
+
const firstTouch = event.touches[0];
|
|
74
|
+
this.downParams = {
|
|
75
|
+
width: contentContainer.offsetWidth,
|
|
76
|
+
height: contentContainer.offsetHeight,
|
|
77
|
+
x: firstTouch.pageX,
|
|
78
|
+
y: firstTouch.pageY,
|
|
79
|
+
};
|
|
80
|
+
document.addEventListener('touchmove', this.onTouchMove);
|
|
81
|
+
document.addEventListener('touchend', this.onTouchMove);
|
|
82
|
+
};
|
|
83
|
+
this.onTouchMove = (event) => {
|
|
84
|
+
this.setHeight(event);
|
|
85
|
+
this.setWidth(event);
|
|
86
|
+
};
|
|
87
|
+
this.onMouseUp = () => {
|
|
88
|
+
document.removeEventListener('mousemove', this.onMouseMove);
|
|
89
|
+
this.downParams = null;
|
|
90
|
+
};
|
|
91
|
+
this.value = undefined;
|
|
92
|
+
this.label = undefined;
|
|
93
|
+
this.hideLabel = undefined;
|
|
94
|
+
this.hideMessages = undefined;
|
|
95
|
+
this.optional = undefined;
|
|
96
|
+
this.placeholder = undefined;
|
|
97
|
+
this.disabled = undefined;
|
|
98
|
+
this.readonly = undefined;
|
|
99
|
+
this.spellcheck = undefined;
|
|
100
|
+
this.maxlength = undefined;
|
|
101
|
+
this.rows = undefined;
|
|
102
|
+
this.cols = undefined;
|
|
103
|
+
this.resize = 'vertical';
|
|
104
|
+
this.errors = undefined;
|
|
105
|
+
this.hints = undefined;
|
|
106
|
+
this.hasFocus = undefined;
|
|
107
|
+
this.downParams = undefined;
|
|
108
|
+
}
|
|
109
|
+
/////// LIFECYCLE HOOKS ////////
|
|
110
|
+
componentWillLoad() {
|
|
111
|
+
if (isNaN(this.maxlength)) {
|
|
112
|
+
this.maxlength = undefined;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
componentDidRender() {
|
|
116
|
+
this.scheduledAfterRender.push(this.checkRows, this.checkCols);
|
|
117
|
+
this.scheduledAfterRender.forEach(fn => fn());
|
|
118
|
+
this.scheduledAfterRender = [];
|
|
119
|
+
}
|
|
120
|
+
componentDidLoad() {
|
|
121
|
+
overrideFocus(this.hostElement);
|
|
122
|
+
}
|
|
123
|
+
get hasError() {
|
|
124
|
+
return Array.isArray(this.errors) && this.errors.length > 0;
|
|
125
|
+
}
|
|
126
|
+
get messages() {
|
|
127
|
+
return ((this.errors && this.errors.length > 0 && this.errors) ||
|
|
128
|
+
(this.hints && this.hints.length > 0 && this.hints) ||
|
|
129
|
+
[]);
|
|
130
|
+
}
|
|
131
|
+
get showMessages() {
|
|
132
|
+
return this.messages.length > 0 && !this.hideMessages;
|
|
133
|
+
}
|
|
134
|
+
get inputId() {
|
|
135
|
+
return `input-guid-${this.guid}`;
|
|
136
|
+
}
|
|
137
|
+
get inputDescribedBy() {
|
|
138
|
+
return this.showMessages ? `${this.inputId}-description` : undefined;
|
|
139
|
+
}
|
|
140
|
+
get wrapperClasses() {
|
|
141
|
+
const errorClass = this.hasError ? ' has-error' : '';
|
|
142
|
+
const valueClass = !!this.value ? ' has-value' : '';
|
|
143
|
+
const focusClass = this.hasFocus ? ' has-focus' : '';
|
|
144
|
+
return `field-container${errorClass}${valueClass}${focusClass}`;
|
|
145
|
+
}
|
|
146
|
+
get showResize() {
|
|
147
|
+
const { resize } = this;
|
|
148
|
+
return resize && resize !== 'none';
|
|
149
|
+
}
|
|
150
|
+
//////// OBSERVERS //////////
|
|
151
|
+
valueObserver() {
|
|
152
|
+
const { maxlength, value = '' } = this;
|
|
153
|
+
if (!maxlength)
|
|
154
|
+
return;
|
|
155
|
+
const truncatedValue = value.substr(0, maxlength);
|
|
156
|
+
if (truncatedValue === value)
|
|
157
|
+
return;
|
|
158
|
+
this.change.emit({ value: truncatedValue });
|
|
159
|
+
}
|
|
160
|
+
rowsObserver() {
|
|
161
|
+
this.contentContainer.style.height = null;
|
|
162
|
+
}
|
|
163
|
+
colsObserver() {
|
|
164
|
+
this.contentContainer.style.width = null;
|
|
165
|
+
}
|
|
166
|
+
hintsObserver() {
|
|
167
|
+
this.hasFocus && this.scheduledAfterRender.push(() => setMessageHeight(this));
|
|
168
|
+
}
|
|
169
|
+
errorsObserver() {
|
|
170
|
+
this.hasFocus && this.scheduledAfterRender.push(() => setMessageHeight(this));
|
|
171
|
+
}
|
|
172
|
+
///////// HOST ELEMENT EVENTS //////
|
|
173
|
+
onHostElementFocus(event) {
|
|
174
|
+
if (!isEventFromElement(event, this.hostElement))
|
|
175
|
+
return;
|
|
176
|
+
this.textareaField.focus();
|
|
177
|
+
}
|
|
178
|
+
onHostElementChange(event) {
|
|
179
|
+
if (event.target === this.hostElement && !this.hostElement.onchange) {
|
|
180
|
+
this.value = event.detail.value;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
setWidth(event) {
|
|
184
|
+
var _a, _b;
|
|
185
|
+
const { contentContainer, resize, downParams: { width, x }, } = this;
|
|
186
|
+
const resizeX = ['both', 'horizontal'].includes(resize);
|
|
187
|
+
if (!resizeX)
|
|
188
|
+
return;
|
|
189
|
+
const eventX = event instanceof MouseEvent ? event.clientX : (_b = (_a = event.touches[0]) === null || _a === void 0 ? void 0 : _a.pageX) !== null && _b !== void 0 ? _b : 0;
|
|
190
|
+
const newWidth = width - (x - eventX);
|
|
191
|
+
contentContainer.style.width = `${newWidth}px`;
|
|
192
|
+
}
|
|
193
|
+
setHeight(event) {
|
|
194
|
+
var _a, _b;
|
|
195
|
+
const { contentContainer, resize, downParams: { height, y }, } = this;
|
|
196
|
+
const resizeY = ['both', 'vertical'].includes(resize);
|
|
197
|
+
if (!resizeY)
|
|
198
|
+
return;
|
|
199
|
+
const eventY = event instanceof MouseEvent ? event.clientY : (_b = (_a = event.touches[0]) === null || _a === void 0 ? void 0 : _a.pageY) !== null && _b !== void 0 ? _b : 0;
|
|
200
|
+
const newHeight = height - (y - eventY);
|
|
201
|
+
contentContainer.style.height = `${newHeight}px`;
|
|
202
|
+
}
|
|
203
|
+
/////// VIEW METHODS ///////
|
|
204
|
+
render() {
|
|
205
|
+
return (h("div", { class: this.wrapperClasses }, labelDOM(this), h("div", { class: "content-container", ref: el => (this.contentContainer = el) }, this.inputDOM(), this.maxlength ? this.maxLengthDOM() : '', messagesDOM(this))));
|
|
206
|
+
}
|
|
207
|
+
maxLengthDOM() {
|
|
208
|
+
var _a;
|
|
209
|
+
return (h("div", { class: "max-length", "aria-hidden": "true" }, ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) || 0, "/", this.maxlength));
|
|
210
|
+
}
|
|
211
|
+
inputDOM() {
|
|
212
|
+
return (h("div", { class: "input-container" }, h("textarea", { id: this.inputId, placeholder: (this.placeholder && loc(this.placeholder)) || undefined, "test-id": "inputField", maxLength: this.maxlength, "aria-describedby": this.inputDescribedBy, "aria-invalid": `${this.hasError}`, "aria-required": `${!this.optional}`, "aria-label": this.hideLabel && this.label, spellcheck: this.spellcheck, rows: this.rows || 3, cols: this.cols, value: this.value, ref: el => (this.textareaField = el), readonly: !!this.readonly, disabled: !!this.disabled, maxlength: this.maxlength, onInput: this.onTextareaInput, onChange: this.onTextareaChange, onFocus: this.onTextareaFocus, onBlur: this.onTextareaBlur }), this.hasError ? (h("q2-icon", { type: "error", class: "icon-error" })) : (''), this.showResize && (h("button", { onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart, class: "btn-resize", "aria-label": loc('tecton.element.input.resize'), tabIndex: -1 }, h("svg", { "aria-hidden": "true", viewBox: "0 0 12 12", xmlns: "http://www.w3.org/2000/svg" }, h("path", { d: "M8.5 11.5l3-3m-7 3l7-7m-11 7l11-11", fill: "none", "stroke-stroke-linecap": "square" }))))));
|
|
213
|
+
}
|
|
214
|
+
get hostElement() { return this; }
|
|
215
|
+
static get watchers() { return {
|
|
216
|
+
"value": ["valueObserver"],
|
|
217
|
+
"rows": ["rowsObserver"],
|
|
218
|
+
"cols": ["colsObserver"],
|
|
219
|
+
"hints": ["hintsObserver"],
|
|
220
|
+
"errors": ["errorsObserver"]
|
|
221
|
+
}; }
|
|
222
|
+
static get style() { return stylesCss; }
|
|
223
|
+
}, [1, "q2-textarea", {
|
|
224
|
+
"value": [1025],
|
|
225
|
+
"label": [513],
|
|
226
|
+
"hideLabel": [516, "hide-label"],
|
|
227
|
+
"hideMessages": [516, "hide-messages"],
|
|
228
|
+
"optional": [516],
|
|
229
|
+
"placeholder": [513],
|
|
230
|
+
"disabled": [516],
|
|
231
|
+
"readonly": [516],
|
|
232
|
+
"spellcheck": [516],
|
|
233
|
+
"maxlength": [1538],
|
|
234
|
+
"rows": [514],
|
|
235
|
+
"cols": [514],
|
|
236
|
+
"resize": [513],
|
|
237
|
+
"errors": [16],
|
|
238
|
+
"hints": [16],
|
|
239
|
+
"hasFocus": [32],
|
|
240
|
+
"downParams": [32]
|
|
241
|
+
}, [[0, "focus", "onHostElementFocus"], [0, "change", "onHostElementChange"]]]);
|
|
242
|
+
function defineCustomElement$1() {
|
|
243
|
+
if (typeof customElements === "undefined") {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const components = ["q2-textarea", "q2-icon"];
|
|
247
|
+
components.forEach(tagName => { switch (tagName) {
|
|
248
|
+
case "q2-textarea":
|
|
249
|
+
if (!customElements.get(tagName)) {
|
|
250
|
+
customElements.define(tagName, Q2Textarea$1);
|
|
251
|
+
}
|
|
252
|
+
break;
|
|
253
|
+
case "q2-icon":
|
|
254
|
+
if (!customElements.get(tagName)) {
|
|
255
|
+
defineCustomElement$2();
|
|
256
|
+
}
|
|
257
|
+
break;
|
|
258
|
+
} });
|
|
259
|
+
}
|
|
260
|
+
defineCustomElement$1();
|
|
261
|
+
|
|
262
|
+
const Q2Textarea = Q2Textarea$1;
|
|
263
|
+
const defineCustomElement = defineCustomElement$1;
|
|
264
|
+
|
|
265
|
+
export { Q2Textarea, defineCustomElement };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface Q2Tooltip extends Components.Q2Tooltip, HTMLElement {}
|
|
4
|
+
export const Q2Tooltip: {
|
|
5
|
+
prototype: Q2Tooltip;
|
|
6
|
+
new (): Q2Tooltip;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { proxyCustomElement, HTMLElement, h, Fragment } 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}:host([block]){display:block}.tooltip{--comp-background:var(--tct-tooltip-background-color, var(--t-tooltip-background-color, var(--t-top-a3, rgba(13, 13, 13, 0.85))));--comp-offset-default:calc(var(--app-scale-1x, 5px) * -1);--comp-offset:var(--tct-tooltip-offset, var(--t-tooltip-offset, var(--comp-offset-default)));--comp-position:var(--tct-tooltip-position, var(--t-tooltip-position, var(--app-scale-1x, 5px)));--comp-body-offset-default:calc(var(--app-scale-3x, 15px) * -1);--comp-body-offset:var(--tct-tooltip-body-offset, var(--t-tooltip-body-offset, var(--comp-body-offset-default)));--comp-duration:var(--tct-tooltip-transition-duration, var(--t-tooltip-transition-duration, var(--app-duration-1, 0.2s)));--comp-visible-duration:var(--tct-tooltip-transition-visible-duration, var(--t-tooltip-transition-visible-duration, 2s));--comp-delay:var(--tct-tooltip-transition-delay, var(--t-tooltip-transition-delay, 0s));display:inline-block;position:relative}.tooltip:hover{--comp-delay:var(--tct-tooltip-transition-delay, var(--t-tooltip-transition-delay, 1s))}.tooltip:before{position:absolute;z-index:2;width:0;height:0;color:var(--comp-background);pointer-events:none;content:\"\";border:var(--tct-tooltip-arrow-size, var(--t-tooltip-arrow-size, var(--app-scale-1x, 5px))) solid transparent}.tooltip:after{--comp-padding:var(--app-scale-1x, 5px) 8px;position:absolute;z-index:1;padding:var(--tct-tooltip-padding, var(--t-tooltip-padding, var(--comp-padding)));font-weight:var(--tct-tooltip-font-weight, var(--t-tooltip-font-weight, 600));font-size:var(--tct-tooltip-font-size, var(--t-tooltip-font-size, var(--app-font-size-small, 12px)));line-height:1.5;color:var(--tct-tooltip-color, var(--t-tooltip-color, var(--app-white, #ffffff)));text-align:center;text-decoration:none;text-shadow:none;text-transform:none;letter-spacing:normal;word-wrap:break-word;white-space:pre;pointer-events:none;content:attr(aria-label);background:var(--comp-background);border-radius:var(--tct-tooltip-border-radius, var(--t-tooltip-border-radius, var(--app-border-radius-1, 3px)))}.tooltip:before,.tooltip:after{display:inline-block;visibility:hidden;opacity:0;transition:all var(--comp-duration) ease-in-out var(--comp-delay)}:host([block]) .tooltip{display:block}.tooltip:hover:before,.tooltip:hover:after,.tooltip.has-keyboard-focus:focus-within:before,.tooltip.has-keyboard-focus:focus-within:after,:host([persistent]) .tooltip:before,:host([persistent]) .tooltip:after{text-decoration:none;visibility:visible;opacity:1}@keyframes tooltippedFade{from{opacity:0}to{opacity:1}}.tooltip.has-generic-focus:focus-within:before,.tooltip.has-generic-focus:focus-within:after{visibility:visible;opacity:0;transition:none;animation-timing-function:ease-in-out;animation-fill-mode:forwards;animation-name:tooltippedFade, tooltippedFade;animation-direction:normal, reverse;animation-duration:var(--comp-duration);animation-delay:0ms, calc(var(--comp-visible-duration) + var(--comp-duration))}.tooltip.has-generic-focus-out:before,.tooltip.has-generic-focus-out:after{visibility:visible;opacity:0;transition:none;animation-timing-function:ease-in-out;animation-fill-mode:forwards;animation-name:tooltippedFade;animation-direction:reverse;animation-duration:var(--comp-duration)}:host([multiline]) .tooltip:after{width:max-content;max-width:var(--tct-tooltip-max-width, var(--t-tooltip-max-width, 200px));word-break:break-word;word-wrap:normal;white-space:pre-line;border-collapse:separate;text-align:left}:host([position=s]) :host([multiline]) .tooltip:after,:host([position=n]) :host([multiline]) .tooltip:after{right:auto;left:50%;transform:translateX(-50%)}:host([position=w]) :host([multiline]) .tooltip:after,:host([position=e]) :host([multiline]) .tooltip:after{right:100%}:host([multiline]) .tooltip:hover:after,:host([multiline]) .tooltip:active:after,:host([multiline]) .tooltip:focus:after{display:table-cell}:host([multiline]) .tooltip:focus-within:after{display:table-cell}:host([position=s]) .tooltip:after,:host([position=se]) .tooltip:after,:host([position=sw]) .tooltip:after{top:100%;right:50%;margin-top:var(--comp-position)}:host([position=s]) .tooltip:before,:host([position=se]) .tooltip:before,:host([position=sw]) .tooltip:before{top:auto;right:50%;bottom:var(--comp-offset);margin-right:var(--comp-offset);border-bottom-color:var(--comp-background)}:host([position=n]) .tooltip:after,:host([position=ne]) .tooltip:after,:host([position=nw]) .tooltip:after{right:50%;bottom:100%;margin-bottom:var(--comp-position)}:host([position=n]) .tooltip:before,:host([position=ne]) .tooltip:before,:host([position=nw]) .tooltip:before{top:var(--comp-offset);right:50%;bottom:auto;margin-right:var(--comp-offset);border-top-color:var(--comp-background)}:host([position=se]) .tooltip:after,:host([position=ne]) .tooltip:after{right:auto;left:50%;margin-left:var(--comp-body-offset)}:host([position=sw]) .tooltip:after{margin-right:var(--comp-body-offset)}:host([position=nw]) .tooltip:after{margin-right:var(--comp-body-offset)}:host([position=s]) .tooltip:after,:host([position=n]) .tooltip:after{transform:translateX(50%)}:host([position=w]) .tooltip:after{right:100%;bottom:50%;margin-right:var(--comp-position);transform:translateY(50%)}:host([position=w]) .tooltip:before{top:50%;bottom:50%;left:var(--comp-offset);margin-top:var(--comp-offset);border-left-color:var(--comp-background)}:host([position=e]) .tooltip:after{bottom:50%;left:100%;margin-left:var(--comp-position);transform:translateY(50%)}:host([position=e]) .tooltip:before{top:50%;right:var(--comp-offset);bottom:50%;margin-top:var(--comp-offset);border-right-color:var(--comp-background)}";
|
|
4
|
+
|
|
5
|
+
const Q2Tooltip$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super();
|
|
8
|
+
this.__registerHost();
|
|
9
|
+
this.__attachShadow();
|
|
10
|
+
this.animationEndCount = 0;
|
|
11
|
+
this.label = undefined;
|
|
12
|
+
this.block = undefined;
|
|
13
|
+
this.multiline = undefined;
|
|
14
|
+
this.persistent = undefined;
|
|
15
|
+
this.immediate = undefined;
|
|
16
|
+
this.position = 'n';
|
|
17
|
+
this.focusClass = undefined;
|
|
18
|
+
}
|
|
19
|
+
/// Getters ///
|
|
20
|
+
get shouldBeVisible() {
|
|
21
|
+
if (this.persistent)
|
|
22
|
+
return true;
|
|
23
|
+
return this.hostElement.matches(':hover, :focus-within');
|
|
24
|
+
}
|
|
25
|
+
/// Helpers //
|
|
26
|
+
checkFocusClass() {
|
|
27
|
+
if (!this.shouldBeVisible)
|
|
28
|
+
return;
|
|
29
|
+
const isKeyboardFocus = !!this.findFocusVisibleElement(document.activeElement);
|
|
30
|
+
this.focusClass = isKeyboardFocus ? 'has-keyboard-focus' : 'has-generic-focus';
|
|
31
|
+
if (isKeyboardFocus)
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
hideTooltip() {
|
|
35
|
+
if (this.focusClass === 'has-generic-focus')
|
|
36
|
+
this.focusClass = 'has-generic-focus-out';
|
|
37
|
+
else
|
|
38
|
+
this.focusClass = null;
|
|
39
|
+
}
|
|
40
|
+
animationEndHandler() {
|
|
41
|
+
this.animationEndCount = this.animationEndCount + 1;
|
|
42
|
+
const { focusClass, animationEndCount } = this;
|
|
43
|
+
// animationEnd is fired once for :before and once for :after pseudo elements
|
|
44
|
+
// there are multiple animations defined for .has-generic-focus
|
|
45
|
+
// so we need to wait for all of them to finish before we can remove the class
|
|
46
|
+
if (focusClass === 'has-generic-focus-out' || (focusClass === 'has-generic-focus' && animationEndCount === 4)) {
|
|
47
|
+
this.focusClass = null;
|
|
48
|
+
this.animationEndCount = 0;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
findFocusVisibleElement(element) {
|
|
52
|
+
if (!element)
|
|
53
|
+
return;
|
|
54
|
+
if (element.shadowRoot)
|
|
55
|
+
element = this.findFocusVisibleElement(element.shadowRoot.activeElement);
|
|
56
|
+
return (element === null || element === void 0 ? void 0 : element.matches(':focus-visible')) ? element : null;
|
|
57
|
+
}
|
|
58
|
+
/// Listeners ///
|
|
59
|
+
keyUpHandler(event) {
|
|
60
|
+
switch (event.key) {
|
|
61
|
+
case 'Esc':
|
|
62
|
+
case 'Escape':
|
|
63
|
+
this.hideTooltip();
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
focusHandler() {
|
|
68
|
+
this.checkFocusClass();
|
|
69
|
+
}
|
|
70
|
+
focusOutHandler() {
|
|
71
|
+
if (this.shouldBeVisible)
|
|
72
|
+
return;
|
|
73
|
+
if (this.focusClass === 'has-generic-focus')
|
|
74
|
+
this.focusClass = 'has-generic-focus-out';
|
|
75
|
+
}
|
|
76
|
+
render() {
|
|
77
|
+
const { focusClass } = this;
|
|
78
|
+
const classes = ['tooltip'];
|
|
79
|
+
if (focusClass)
|
|
80
|
+
classes.push(focusClass);
|
|
81
|
+
return this.label ? (h(Fragment, null, h("div", { ref: el => (this.tooltipElement = el), class: classes.join(' '), "aria-label": this.label, onAnimationEnd: () => this.animationEndHandler(), role: "tooltip" }, h("slot", null)))) : (h("slot", null));
|
|
82
|
+
}
|
|
83
|
+
get hostElement() { return this; }
|
|
84
|
+
static get style() { return stylesCss; }
|
|
85
|
+
}, [1, "q2-tooltip", {
|
|
86
|
+
"label": [513],
|
|
87
|
+
"block": [516],
|
|
88
|
+
"multiline": [516],
|
|
89
|
+
"persistent": [516],
|
|
90
|
+
"immediate": [516],
|
|
91
|
+
"position": [513],
|
|
92
|
+
"focusClass": [32]
|
|
93
|
+
}, [[0, "keyup", "keyUpHandler"], [2, "focus", "focusHandler"], [0, "focusout", "focusOutHandler"]]]);
|
|
94
|
+
function defineCustomElement$1() {
|
|
95
|
+
if (typeof customElements === "undefined") {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const components = ["q2-tooltip"];
|
|
99
|
+
components.forEach(tagName => { switch (tagName) {
|
|
100
|
+
case "q2-tooltip":
|
|
101
|
+
if (!customElements.get(tagName)) {
|
|
102
|
+
customElements.define(tagName, Q2Tooltip$1);
|
|
103
|
+
}
|
|
104
|
+
break;
|
|
105
|
+
} });
|
|
106
|
+
}
|
|
107
|
+
defineCustomElement$1();
|
|
108
|
+
|
|
109
|
+
const Q2Tooltip = Q2Tooltip$1;
|
|
110
|
+
const defineCustomElement = defineCustomElement$1;
|
|
111
|
+
|
|
112
|
+
export { Q2Tooltip, defineCustomElement };
|