q2-tecton-elements 1.17.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-afc50fbb.js → index-eccd5617.js} +8 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-badge_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-btn_2.cjs.entry.js +3 -2
- package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
- package/dist/cjs/q2-card.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-carousel.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-donut.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +1 -1
- package/dist/cjs/q2-dropdown.cjs.entry.js +1 -1
- package/dist/cjs/q2-editable-field.cjs.entry.js +1 -1
- package/dist/cjs/q2-icon.cjs.entry.js +1 -1
- package/dist/cjs/q2-loc.cjs.entry.js +1 -1
- package/dist/cjs/q2-message.cjs.entry.js +1 -1
- package/dist/cjs/q2-month-picker.cjs.entry.js +147 -0
- package/dist/cjs/q2-optgroup.cjs.entry.js +1 -1
- package/dist/cjs/{q2-option-list.cjs.entry.js → q2-option-list_2.cjs.entry.js} +102 -19
- package/dist/cjs/q2-pagination.cjs.entry.js +8 -2
- package/dist/cjs/q2-pill.cjs.entry.js +20 -18
- package/dist/cjs/q2-radio-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-radio.cjs.entry.js +1 -1
- package/dist/cjs/q2-section.cjs.entry.js +1 -1
- package/dist/cjs/q2-select.cjs.entry.js +3 -5
- package/dist/cjs/q2-stepper-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +1 -1
- package/dist/cjs/q2-stepper.cjs.entry.js +1 -1
- package/dist/cjs/q2-tab-container.cjs.entry.js +1 -1
- package/dist/cjs/q2-tag.cjs.entry.js +17 -15
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
- package/dist/cjs/q2-tooltip.cjs.entry.js +63 -13
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/q2-btn/index.js +19 -1
- package/dist/collection/components/q2-btn/styles.css +1 -0
- package/dist/collection/components/q2-calendar/q2-month-picker.css +130 -0
- package/dist/collection/components/q2-calendar/q2-month-picker.js +246 -0
- package/dist/collection/components/q2-option-list/index.js +7 -52
- package/dist/collection/components/q2-option-list/styles.css +1 -49
- package/dist/collection/components/q2-pagination/index.js +9 -3
- package/dist/collection/components/q2-pill/index.js +27 -24
- package/dist/collection/components/q2-pill/styles.css +11 -6
- package/dist/collection/components/q2-popover/index.js +245 -0
- package/dist/collection/components/q2-popover/styles.css +205 -0
- package/dist/collection/components/q2-select/index.js +2 -4
- package/dist/collection/components/q2-tag/index.js +21 -18
- package/dist/collection/components/q2-tag/styles.css +1 -5
- package/dist/collection/components/q2-tooltip/index.js +102 -13
- package/dist/collection/components/q2-tooltip/styles.css +62 -82
- package/dist/collection/utils/index.js +7 -0
- package/dist/esm/{index-2ca8c93c.js → index-eac6b89e.js} +8 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-badge_2.entry.js +1 -1
- package/dist/esm/q2-btn_2.entry.js +3 -2
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-card.entry.js +1 -1
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-donut.entry.js +1 -1
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +1 -1
- package/dist/esm/q2-dropdown.entry.js +1 -1
- package/dist/esm/q2-editable-field.entry.js +1 -1
- package/dist/esm/q2-icon.entry.js +1 -1
- package/dist/esm/q2-loc.entry.js +1 -1
- package/dist/esm/q2-message.entry.js +1 -1
- package/dist/esm/q2-month-picker.entry.js +143 -0
- package/dist/esm/q2-optgroup.entry.js +1 -1
- package/dist/esm/{q2-option-list.entry.js → q2-option-list_2.entry.js} +102 -20
- package/dist/esm/q2-pagination.entry.js +8 -2
- package/dist/esm/q2-pill.entry.js +21 -19
- package/dist/esm/q2-radio-group.entry.js +1 -1
- package/dist/esm/q2-radio.entry.js +1 -1
- package/dist/esm/q2-section.entry.js +1 -1
- package/dist/esm/q2-select.entry.js +3 -5
- package/dist/esm/q2-stepper-pane.entry.js +1 -1
- package/dist/esm/q2-stepper-vertical.entry.js +1 -1
- package/dist/esm/q2-stepper.entry.js +1 -1
- package/dist/esm/q2-tab-container.entry.js +1 -1
- package/dist/esm/q2-tag.entry.js +18 -16
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +1 -1
- package/dist/esm/q2-tooltip.entry.js +63 -13
- package/dist/q2-tecton-elements/{p-d781e2d9.entry.js → p-02c1b7fd.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-2faed36b.entry.js → p-04c743f2.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-5acb7ec6.entry.js → p-07dc509c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-d8d9e8eb.entry.js → p-12caa479.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-d3e4cc5d.entry.js → p-160dd1c2.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-31070ab8.entry.js → p-1a3de749.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-0d849ed4.entry.js → p-2061c3fd.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-64605d17.entry.js → p-2e54f9a0.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-a45c6b65.entry.js → p-375569ff.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-3766cc6c.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-732dafd0.entry.js → p-3eda2714.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-cde0cdff.entry.js → p-421af42d.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-44bdaf52.entry.js → p-4fd405f5.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-509c8924.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-445e7c45.entry.js → p-55dc3dc1.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-5fffb28a.entry.js +1 -0
- package/dist/q2-tecton-elements/p-612e9974.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-815c8a7d.entry.js → p-796c2bb5.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-41fcf343.js → p-80014da0.js} +1 -1
- package/dist/q2-tecton-elements/{p-8543a0e1.entry.js → p-86887866.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-9204c34d.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-b4b8f85c.entry.js → p-a0fa416d.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-bd83e8e2.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-fbf23146.entry.js → p-be0f2539.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-c05b0b55.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-318758d4.entry.js → p-c608e3c9.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-824a1d7c.entry.js → p-d826d7ad.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-06865cf5.entry.js → p-d9e9340c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-4da9b6b6.entry.js → p-e5757895.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-e68c9ef0.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-30f81b22.entry.js → p-eb33bda4.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-661c2092.entry.js → p-f319549d.entry.js} +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/types/components/q2-btn/index.d.ts +1 -0
- package/dist/types/components/q2-calendar/q2-month-picker.d.ts +24 -0
- package/dist/types/components/q2-option-list/index.d.ts +1 -4
- package/dist/types/components/q2-pill/index.d.ts +7 -3
- package/dist/types/components/q2-popover/index.d.ts +26 -0
- package/dist/types/components/q2-tag/index.d.ts +5 -2
- package/dist/types/components/q2-tooltip/index.d.ts +12 -0
- package/dist/types/components.d.ts +53 -4
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/workspace/workspace/{tecton-production_release_1.17.x → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +0 -0
- package/package.json +2 -2
- package/dist/q2-tecton-elements/p-30a4fdfb.entry.js +0 -1
- package/dist/q2-tecton-elements/p-41c22a16.entry.js +0 -1
- package/dist/q2-tecton-elements/p-654fcd6b.entry.js +0 -1
- package/dist/q2-tecton-elements/p-916fd90b.entry.js +0 -1
- package/dist/q2-tecton-elements/p-94b3c534.entry.js +0 -1
- package/dist/q2-tecton-elements/p-a659d112.entry.js +0 -1
- package/dist/q2-tecton-elements/p-b595b415.entry.js +0 -1
- package/dist/test/elements/q2-tag-test.js +0 -151
- package/dist/types/workspace/workspace/tecton-production_release_1.17.x/packages/q2-tecton-elements/.stencil/test/elements/q2-tag-test.d.ts +0 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { Component, Prop, h, Element, Watch, Method, Listen, Event, } from '@stencil/core';
|
|
2
|
+
export class Q2Popover {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.privateDirection = 'down';
|
|
5
|
+
}
|
|
6
|
+
/// Lifecycle hooks ///
|
|
7
|
+
componentDidLoad() {
|
|
8
|
+
if (this.open)
|
|
9
|
+
this.determinePopDirection();
|
|
10
|
+
}
|
|
11
|
+
componentWillRender() {
|
|
12
|
+
if (this.containerElement && this.containerElement && this.open)
|
|
13
|
+
this.determinePopDirection();
|
|
14
|
+
}
|
|
15
|
+
/// Methods ///
|
|
16
|
+
async toggle() {
|
|
17
|
+
this.open = !this.open;
|
|
18
|
+
}
|
|
19
|
+
/// Watchers ///
|
|
20
|
+
openChanged(open) {
|
|
21
|
+
this.popoverStateChanged.emit({ open });
|
|
22
|
+
}
|
|
23
|
+
/// Listeners ///
|
|
24
|
+
popoverStateHandler(event) {
|
|
25
|
+
const { detail: { open }, } = event;
|
|
26
|
+
if (open === this.open)
|
|
27
|
+
return;
|
|
28
|
+
this.open = open;
|
|
29
|
+
event.stopPropagation();
|
|
30
|
+
}
|
|
31
|
+
/// Helpers ///
|
|
32
|
+
determinePopDirection() {
|
|
33
|
+
var _a;
|
|
34
|
+
const { containerElement, contentElement, direction, controlElement } = this;
|
|
35
|
+
if (containerElement)
|
|
36
|
+
containerElement.style.maxHeight = null;
|
|
37
|
+
if (direction) {
|
|
38
|
+
return (this.privateDirection = direction);
|
|
39
|
+
}
|
|
40
|
+
const contentHeight = contentElement.clientHeight;
|
|
41
|
+
const { top: topOffset, height } = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect()) !== null && _a !== void 0 ? _a : {
|
|
42
|
+
top: 0,
|
|
43
|
+
height: 0,
|
|
44
|
+
};
|
|
45
|
+
const bottomOffset = window.innerHeight - topOffset - height;
|
|
46
|
+
const canShowFullSizeBelow = bottomOffset > contentHeight;
|
|
47
|
+
const canShowFullSizeAbove = contentHeight <= topOffset;
|
|
48
|
+
// Prefer full size above or below
|
|
49
|
+
if (canShowFullSizeBelow) {
|
|
50
|
+
return (this.privateDirection = 'down');
|
|
51
|
+
}
|
|
52
|
+
else if (canShowFullSizeAbove || !this.minHeight) {
|
|
53
|
+
this.determinePopOffset();
|
|
54
|
+
return (this.privateDirection = 'up');
|
|
55
|
+
}
|
|
56
|
+
// If full size will not fit and minHeight is set, then make as tall as possible
|
|
57
|
+
const { minHeight = 150 } = this;
|
|
58
|
+
const displayBuffer = 5;
|
|
59
|
+
const canShowSmallBelow = bottomOffset >= minHeight + displayBuffer;
|
|
60
|
+
if (canShowSmallBelow) {
|
|
61
|
+
const maxBelowHeight = Math.max(bottomOffset - displayBuffer, minHeight);
|
|
62
|
+
containerElement.style.setProperty('--comp-pop-max-height', `${maxBelowHeight}px`);
|
|
63
|
+
return (this.privateDirection = 'down');
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const maxAboveHeight = Math.max(topOffset, minHeight);
|
|
67
|
+
containerElement.style.setProperty('--comp-pop-max-height', `${maxAboveHeight}px`);
|
|
68
|
+
this.determinePopOffset();
|
|
69
|
+
return (this.privateDirection = 'up');
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
determinePopOffset() {
|
|
73
|
+
var _a;
|
|
74
|
+
const { controlElement, containerElement } = this;
|
|
75
|
+
const dropdownHeight = (_a = controlElement === null || controlElement === void 0 ? void 0 : controlElement.getBoundingClientRect().height) !== null && _a !== void 0 ? _a : 0;
|
|
76
|
+
containerElement.style.setProperty('--comp-pop-offset', `${dropdownHeight}px`);
|
|
77
|
+
}
|
|
78
|
+
/// DOM ///
|
|
79
|
+
render() {
|
|
80
|
+
const containerClasses = ['container', this.privateDirection];
|
|
81
|
+
return (h("div", { ref: el => (this.containerElement = el), class: containerClasses.join(' '), role: "menu" },
|
|
82
|
+
h("div", { ref: el => (this.contentElement = el), class: "content" },
|
|
83
|
+
h("slot", null))));
|
|
84
|
+
}
|
|
85
|
+
static get is() { return "q2-popover"; }
|
|
86
|
+
static get encapsulation() { return "shadow"; }
|
|
87
|
+
static get originalStyleUrls() { return {
|
|
88
|
+
"$": ["styles.scss"]
|
|
89
|
+
}; }
|
|
90
|
+
static get styleUrls() { return {
|
|
91
|
+
"$": ["styles.css"]
|
|
92
|
+
}; }
|
|
93
|
+
static get properties() { return {
|
|
94
|
+
"direction": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"mutable": false,
|
|
97
|
+
"complexType": {
|
|
98
|
+
"original": "'up' | 'down'",
|
|
99
|
+
"resolved": "\"down\" | \"up\"",
|
|
100
|
+
"references": {}
|
|
101
|
+
},
|
|
102
|
+
"required": false,
|
|
103
|
+
"optional": false,
|
|
104
|
+
"docs": {
|
|
105
|
+
"tags": [],
|
|
106
|
+
"text": ""
|
|
107
|
+
},
|
|
108
|
+
"attribute": "direction",
|
|
109
|
+
"reflect": true
|
|
110
|
+
},
|
|
111
|
+
"align": {
|
|
112
|
+
"type": "string",
|
|
113
|
+
"mutable": false,
|
|
114
|
+
"complexType": {
|
|
115
|
+
"original": "'left' | 'right'",
|
|
116
|
+
"resolved": "\"left\" | \"right\"",
|
|
117
|
+
"references": {}
|
|
118
|
+
},
|
|
119
|
+
"required": false,
|
|
120
|
+
"optional": false,
|
|
121
|
+
"docs": {
|
|
122
|
+
"tags": [],
|
|
123
|
+
"text": ""
|
|
124
|
+
},
|
|
125
|
+
"attribute": "align",
|
|
126
|
+
"reflect": true
|
|
127
|
+
},
|
|
128
|
+
"open": {
|
|
129
|
+
"type": "boolean",
|
|
130
|
+
"mutable": true,
|
|
131
|
+
"complexType": {
|
|
132
|
+
"original": "boolean",
|
|
133
|
+
"resolved": "boolean",
|
|
134
|
+
"references": {}
|
|
135
|
+
},
|
|
136
|
+
"required": false,
|
|
137
|
+
"optional": false,
|
|
138
|
+
"docs": {
|
|
139
|
+
"tags": [],
|
|
140
|
+
"text": ""
|
|
141
|
+
},
|
|
142
|
+
"attribute": "open",
|
|
143
|
+
"reflect": true
|
|
144
|
+
},
|
|
145
|
+
"block": {
|
|
146
|
+
"type": "boolean",
|
|
147
|
+
"mutable": false,
|
|
148
|
+
"complexType": {
|
|
149
|
+
"original": "boolean",
|
|
150
|
+
"resolved": "boolean",
|
|
151
|
+
"references": {}
|
|
152
|
+
},
|
|
153
|
+
"required": false,
|
|
154
|
+
"optional": false,
|
|
155
|
+
"docs": {
|
|
156
|
+
"tags": [],
|
|
157
|
+
"text": ""
|
|
158
|
+
},
|
|
159
|
+
"attribute": "block",
|
|
160
|
+
"reflect": true
|
|
161
|
+
},
|
|
162
|
+
"minHeight": {
|
|
163
|
+
"type": "number",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "number",
|
|
167
|
+
"resolved": "number",
|
|
168
|
+
"references": {}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": ""
|
|
175
|
+
},
|
|
176
|
+
"attribute": "min-height",
|
|
177
|
+
"reflect": false
|
|
178
|
+
},
|
|
179
|
+
"controlElement": {
|
|
180
|
+
"type": "unknown",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "HTMLElement",
|
|
184
|
+
"resolved": "HTMLElement",
|
|
185
|
+
"references": {
|
|
186
|
+
"HTMLElement": {
|
|
187
|
+
"location": "global"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": false,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": ""
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}; }
|
|
199
|
+
static get events() { return [{
|
|
200
|
+
"method": "popoverStateChanged",
|
|
201
|
+
"name": "popoverStateChanged",
|
|
202
|
+
"bubbles": true,
|
|
203
|
+
"cancelable": true,
|
|
204
|
+
"composed": true,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [],
|
|
207
|
+
"text": ""
|
|
208
|
+
},
|
|
209
|
+
"complexType": {
|
|
210
|
+
"original": "{ open: boolean }",
|
|
211
|
+
"resolved": "{ open: boolean; }",
|
|
212
|
+
"references": {}
|
|
213
|
+
}
|
|
214
|
+
}]; }
|
|
215
|
+
static get methods() { return {
|
|
216
|
+
"toggle": {
|
|
217
|
+
"complexType": {
|
|
218
|
+
"signature": "() => Promise<void>",
|
|
219
|
+
"parameters": [],
|
|
220
|
+
"references": {
|
|
221
|
+
"Promise": {
|
|
222
|
+
"location": "global"
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"return": "Promise<void>"
|
|
226
|
+
},
|
|
227
|
+
"docs": {
|
|
228
|
+
"text": "",
|
|
229
|
+
"tags": []
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}; }
|
|
233
|
+
static get elementRef() { return "hostElement"; }
|
|
234
|
+
static get watchers() { return [{
|
|
235
|
+
"propName": "open",
|
|
236
|
+
"methodName": "openChanged"
|
|
237
|
+
}]; }
|
|
238
|
+
static get listeners() { return [{
|
|
239
|
+
"name": "popoverState",
|
|
240
|
+
"method": "popoverStateHandler",
|
|
241
|
+
"target": undefined,
|
|
242
|
+
"capture": false,
|
|
243
|
+
"passive": false
|
|
244
|
+
}]; }
|
|
245
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
* {
|
|
2
|
+
box-sizing: border-box;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
*:active {
|
|
6
|
+
outline: none;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
*:focus {
|
|
10
|
+
outline: none;
|
|
11
|
+
box-shadow: var(--const-global-focus, 0 0 0 2px #33b4ff);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
:host {
|
|
15
|
+
box-shadow: none !important;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
::-moz-focus-inner {
|
|
19
|
+
border: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
input,
|
|
23
|
+
textarea,
|
|
24
|
+
button {
|
|
25
|
+
font-family: inherit;
|
|
26
|
+
font-size: inherit;
|
|
27
|
+
font-stretch: inherit;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
:host(.sr),
|
|
31
|
+
:host(.sr) button {
|
|
32
|
+
border: 0;
|
|
33
|
+
clip: rect(0 0 0 0);
|
|
34
|
+
height: 1px;
|
|
35
|
+
margin: -1px;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
padding: 0;
|
|
38
|
+
position: absolute;
|
|
39
|
+
width: 1px;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sr,
|
|
44
|
+
.sr button {
|
|
45
|
+
border: 0;
|
|
46
|
+
clip: rect(0 0 0 0);
|
|
47
|
+
height: 1px;
|
|
48
|
+
margin: -1px;
|
|
49
|
+
overflow: hidden;
|
|
50
|
+
padding: 0;
|
|
51
|
+
position: absolute;
|
|
52
|
+
width: 1px;
|
|
53
|
+
white-space: nowrap;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.hidden {
|
|
57
|
+
display: none;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
:host([hidden]) {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.invisible {
|
|
65
|
+
visibility: hidden;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
* {
|
|
69
|
+
box-sizing: border-box;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
*:active {
|
|
73
|
+
outline: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
*:focus {
|
|
77
|
+
outline: none;
|
|
78
|
+
box-shadow: var(--const-global-focus, 0 0 0 2px #33b4ff);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
:host {
|
|
82
|
+
box-shadow: none !important;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
::-moz-focus-inner {
|
|
86
|
+
border: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
input,
|
|
90
|
+
textarea,
|
|
91
|
+
button {
|
|
92
|
+
font-family: inherit;
|
|
93
|
+
font-size: inherit;
|
|
94
|
+
font-stretch: inherit;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host(.sr),
|
|
98
|
+
:host(.sr) button {
|
|
99
|
+
border: 0;
|
|
100
|
+
clip: rect(0 0 0 0);
|
|
101
|
+
height: 1px;
|
|
102
|
+
margin: -1px;
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
padding: 0;
|
|
105
|
+
position: absolute;
|
|
106
|
+
width: 1px;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.sr,
|
|
111
|
+
.sr button {
|
|
112
|
+
border: 0;
|
|
113
|
+
clip: rect(0 0 0 0);
|
|
114
|
+
height: 1px;
|
|
115
|
+
margin: -1px;
|
|
116
|
+
overflow: hidden;
|
|
117
|
+
padding: 0;
|
|
118
|
+
position: absolute;
|
|
119
|
+
width: 1px;
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.hidden {
|
|
124
|
+
display: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
:host([hidden]) {
|
|
128
|
+
display: none;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.invisible {
|
|
132
|
+
visibility: hidden;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
:host {
|
|
136
|
+
display: inline-flex;
|
|
137
|
+
width: 100%;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.container {
|
|
141
|
+
display: block;
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
opacity: 0;
|
|
144
|
+
height: 0;
|
|
145
|
+
position: absolute;
|
|
146
|
+
visibility: hidden;
|
|
147
|
+
background-color: var(--tct-popover-background-color, var(--t-popover-background-color, var(--app-white, #ffffff)));
|
|
148
|
+
color: var(--tct-popover-text-color, var(--t-popover-text-color, var(--t-text, #4d4d4d)));
|
|
149
|
+
z-index: var(--tct-popover-z-index, var(--t-popover-z-index, 100));
|
|
150
|
+
width: max-content;
|
|
151
|
+
min-width: var(--tct-popover-min-width, var(--t-popover-min-width, 135px));
|
|
152
|
+
box-shadow: var(--tct-popover-box-shadow, var(--t-popover-box-shadow, var(--app-shadow-1, 0 2px 4px rgba(0, 0, 0, 0.3))));
|
|
153
|
+
text-align: start;
|
|
154
|
+
left: 0;
|
|
155
|
+
transition: opacity var(--app-tween-1, 0.2s ease);
|
|
156
|
+
border-radius: var(--tct-popover-border-radius, var(--t-popover-border-radius, 0));
|
|
157
|
+
max-height: var(--comp-pop-max-height);
|
|
158
|
+
--comp-scrollbar-size: var(--tct-scrollbar-size, var(--t-scrollbar-size, var(--app-scale-1x, 5px)));
|
|
159
|
+
--comp-scrollbar-border-radius: var(--tct-scrollbar-border-radius, var(--t-scrollbar-border-radius, var(--app-border-radius-1, 3px)));
|
|
160
|
+
--comp-scrollbar-color: var(--tct-scrollbar-color, var(--t-scrollbar-color, var(--t-a11y-gray-color, #747474)));
|
|
161
|
+
scrollbar-width: thin;
|
|
162
|
+
scrollbar-color: var(--comp-scrollbar-color) transparent;
|
|
163
|
+
}
|
|
164
|
+
.container::-webkit-scrollbar {
|
|
165
|
+
width: var(--comp-scrollbar-size);
|
|
166
|
+
height: var(--comp-scrollbar-size);
|
|
167
|
+
margin: 5px;
|
|
168
|
+
}
|
|
169
|
+
.container::-webkit-scrollbar-thumb {
|
|
170
|
+
background: var(--comp-scrollbar-color);
|
|
171
|
+
border-radius: var(--comp-scrollbar-border-radius);
|
|
172
|
+
}
|
|
173
|
+
.container::-webkit-scrollbar-track {
|
|
174
|
+
background: transparent;
|
|
175
|
+
border-radius: var(--comp-scrollbar-border-radius);
|
|
176
|
+
}
|
|
177
|
+
:host([block]) .container {
|
|
178
|
+
left: unset;
|
|
179
|
+
right: unset;
|
|
180
|
+
width: 100%;
|
|
181
|
+
}
|
|
182
|
+
:host([align=right]) .container {
|
|
183
|
+
right: 0;
|
|
184
|
+
text-align: end;
|
|
185
|
+
left: unset;
|
|
186
|
+
}
|
|
187
|
+
:host([open]) .container {
|
|
188
|
+
display: block;
|
|
189
|
+
height: auto;
|
|
190
|
+
overflow: auto;
|
|
191
|
+
opacity: 1;
|
|
192
|
+
visibility: visible;
|
|
193
|
+
}
|
|
194
|
+
.container.up {
|
|
195
|
+
bottom: var(--comp-pop-offset);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
click-elsewhere {
|
|
199
|
+
position: relative;
|
|
200
|
+
display: block;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.content {
|
|
204
|
+
height: auto;
|
|
205
|
+
}
|
|
@@ -185,7 +185,7 @@ export class Q2Select {
|
|
|
185
185
|
/* tslint:enable:cyclomatic-complexity */
|
|
186
186
|
this.inputKeydownHandler = (event) => {
|
|
187
187
|
event.stopPropagation();
|
|
188
|
-
const { key
|
|
188
|
+
const { key } = event;
|
|
189
189
|
const { optionElements, searchable } = this;
|
|
190
190
|
switch (key) {
|
|
191
191
|
case 'ArrowDown':
|
|
@@ -213,14 +213,12 @@ export class Q2Select {
|
|
|
213
213
|
this.closeDropdown();
|
|
214
214
|
break;
|
|
215
215
|
default:
|
|
216
|
-
if (
|
|
216
|
+
if (!key.match(/^[A-Za-z0-9]$/))
|
|
217
217
|
break;
|
|
218
218
|
if (searchable) {
|
|
219
219
|
this.openDropdownWithoutActiveElement();
|
|
220
220
|
break;
|
|
221
221
|
}
|
|
222
|
-
if (!key.match(/^[A-Za-z0-9]$/))
|
|
223
|
-
break;
|
|
224
222
|
// search in non-searchable select: alpha-numeric only
|
|
225
223
|
this.searchAndFocus(key);
|
|
226
224
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, State, Prop, h, Listen, Element,
|
|
1
|
+
import { Component, State, Prop, h, Listen, Element, Event } from '@stencil/core';
|
|
2
2
|
import { isEventFromElement, loc, overrideFocus } from 'src/utils';
|
|
3
3
|
export class Q2Tag {
|
|
4
4
|
constructor() {
|
|
@@ -10,6 +10,13 @@ export class Q2Tag {
|
|
|
10
10
|
this.hasOptions = hasOptions;
|
|
11
11
|
};
|
|
12
12
|
/// Event Handlers ///
|
|
13
|
+
this.onClickElsewhere = (event) => {
|
|
14
|
+
const target = event.target;
|
|
15
|
+
if (target.localName === 'click-elsewhere') {
|
|
16
|
+
event.stopPropagation();
|
|
17
|
+
this.popoverElement.open = false;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
13
20
|
this.handleChange = event => {
|
|
14
21
|
event.stopPropagation();
|
|
15
22
|
if (!this.hasOptions)
|
|
@@ -19,7 +26,7 @@ export class Q2Tag {
|
|
|
19
26
|
};
|
|
20
27
|
this.handleClick = (event) => {
|
|
21
28
|
event.stopPropagation();
|
|
22
|
-
this.
|
|
29
|
+
this.popoverElement.toggle();
|
|
23
30
|
};
|
|
24
31
|
this.handleKeydown = (event) => {
|
|
25
32
|
this.optionList.handleExternalKeydown(event);
|
|
@@ -31,14 +38,6 @@ export class Q2Tag {
|
|
|
31
38
|
return;
|
|
32
39
|
this.open = false;
|
|
33
40
|
};
|
|
34
|
-
this.handleOptionListFocusout = (event) => {
|
|
35
|
-
const relatedTarget = event.relatedTarget;
|
|
36
|
-
if (relatedTarget && !(event.relatedTarget instanceof HTMLElement))
|
|
37
|
-
return;
|
|
38
|
-
if (relatedTarget && relatedTarget.closest('.btn-wrapper'))
|
|
39
|
-
return;
|
|
40
|
-
this.open = false;
|
|
41
|
-
};
|
|
42
41
|
this.handleWrapperClick = () => {
|
|
43
42
|
this.dropdownBtn.focus();
|
|
44
43
|
this.dropdownBtn.click();
|
|
@@ -65,9 +64,12 @@ export class Q2Tag {
|
|
|
65
64
|
return;
|
|
66
65
|
this.dropdownBtn.focus();
|
|
67
66
|
}
|
|
68
|
-
|
|
69
|
-
this.open
|
|
70
|
-
|
|
67
|
+
popoverStateHandler({ detail: { open } }) {
|
|
68
|
+
if (this.open !== open)
|
|
69
|
+
this.open = open;
|
|
70
|
+
if (open)
|
|
71
|
+
this.optionList.focus();
|
|
72
|
+
else
|
|
71
73
|
this.dropdownBtn.focus();
|
|
72
74
|
}
|
|
73
75
|
/// DOM ///
|
|
@@ -76,14 +78,15 @@ export class Q2Tag {
|
|
|
76
78
|
const wrapperClassNames = ['tag-wrapper'];
|
|
77
79
|
if (hasOptions)
|
|
78
80
|
wrapperClassNames.push('has-options');
|
|
79
|
-
return (h(
|
|
81
|
+
return (h("click-elsewhere", { onChange: this.onClickElsewhere },
|
|
80
82
|
h("div", { class: wrapperClassNames.join(' '), onClick: e => e.stopPropagation() },
|
|
81
83
|
h("div", { class: "tag" }, this.label),
|
|
82
84
|
this.hasOptions && (h("div", { class: "btn-wrapper", onClick: this.handleWrapperClick },
|
|
83
85
|
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') },
|
|
84
86
|
h("q2-icon", { type: "options" }))))),
|
|
85
|
-
this.hasOptions && (h("q2-
|
|
86
|
-
h("
|
|
87
|
+
this.hasOptions && (h("q2-popover", { ref: el => (this.popoverElement = el), controlElement: this.dropdownBtn, open: this.open },
|
|
88
|
+
h("q2-option-list", { id: "option-list", ref: el => (this.optionList = el), onChange: this.handleChange, align: "right", type: "menu", "no-select": true },
|
|
89
|
+
h("slot", null))))));
|
|
87
90
|
}
|
|
88
91
|
static get is() { return "q2-tag"; }
|
|
89
92
|
static get encapsulation() { return "shadow"; }
|
|
@@ -191,8 +194,8 @@ export class Q2Tag {
|
|
|
191
194
|
"capture": false,
|
|
192
195
|
"passive": false
|
|
193
196
|
}, {
|
|
194
|
-
"name": "
|
|
195
|
-
"method": "
|
|
197
|
+
"name": "popoverStateChanged",
|
|
198
|
+
"method": "popoverStateHandler",
|
|
196
199
|
"target": undefined,
|
|
197
200
|
"capture": false,
|
|
198
201
|
"passive": false
|
|
@@ -68,6 +68,7 @@ button {
|
|
|
68
68
|
:host {
|
|
69
69
|
display: inline-block;
|
|
70
70
|
position: relative;
|
|
71
|
+
line-height: 0;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
:host(:not(:last-child)) {
|
|
@@ -132,9 +133,4 @@ button {
|
|
|
132
133
|
justify-content: center;
|
|
133
134
|
padding: 0;
|
|
134
135
|
--tct-icon-size: 18px;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
q2-option-list {
|
|
138
|
-
position: absolute;
|
|
139
|
-
right: 0;
|
|
140
136
|
}
|