q2-tecton-elements 1.23.0-alpha.0 → 1.24.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/action-sheet-4b366e9a.js +84 -0
- package/dist/cjs/charting-d02cba1f.js +3127 -0
- package/dist/cjs/{index-3518c78c.js → index-e00b4210.js} +33 -7
- package/dist/cjs/{installCanvasRenderer-b4d10c92.js → installCanvasRenderer-6c4fbcc9.js} +230 -1130
- package/dist/cjs/installLabelLayout-d6b548fe.js +1048 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/q2-action-sheet.cjs.entry.js +218 -0
- package/dist/cjs/q2-badge_2.cjs.entry.js +1 -1
- package/dist/cjs/q2-btn_2.cjs.entry.js +2 -2
- package/dist/cjs/q2-calendar.cjs.entry.js +1 -1
- package/dist/cjs/q2-card.cjs.entry.js +2 -2
- 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-area.cjs.entry.js +4569 -0
- package/dist/cjs/q2-chart-bar.cjs.entry.js +25 -3133
- package/dist/cjs/q2-chart-donut.cjs.entry.js +9 -8
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +1 -1
- package/dist/cjs/q2-checkbox.cjs.entry.js +2 -2
- 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-loading-element.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 +1 -1
- package/dist/cjs/q2-optgroup_2.cjs.entry.js +93 -0
- package/dist/cjs/q2-option-list_2.cjs.entry.js +230 -88
- package/dist/cjs/q2-pagination.cjs.entry.js +1 -1
- package/dist/cjs/q2-pill.cjs.entry.js +57 -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 +149 -409
- 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 +21 -6
- package/dist/cjs/q2-tecton-elements.cjs.js +1 -1
- package/dist/cjs/q2-textarea.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/q2-action-sheet/index.js +345 -0
- package/dist/collection/components/q2-action-sheet/styles.css +215 -0
- package/dist/collection/components/q2-card/index.js +1 -1
- package/dist/collection/components/q2-chart-area/index.js +622 -0
- package/dist/collection/components/q2-chart-area/styles.css +82 -0
- package/dist/collection/components/q2-chart-bar/index.js +4 -4
- package/dist/collection/components/q2-chart-bar/styles.css +3 -6
- package/dist/collection/components/q2-chart-donut/index.js +1 -1
- package/dist/collection/components/q2-checkbox/index.js +2 -2
- package/dist/collection/components/q2-checkbox/styles.css +1 -0
- package/dist/collection/components/q2-dropdown/index.js +1 -1
- package/dist/collection/components/q2-loading/index.js +1 -1
- package/dist/collection/components/q2-loading/skeleton/q2-loading-element/styles.css +4 -0
- package/dist/collection/components/q2-loading/styles.css +4 -0
- package/dist/collection/components/q2-optgroup/styles.css +2 -2
- package/dist/collection/components/q2-option/index.js +1 -56
- package/dist/collection/components/q2-option/styles.css +7 -0
- package/dist/collection/components/q2-option-list/index.js +290 -102
- package/dist/collection/components/q2-pill/index.js +79 -18
- package/dist/collection/components/q2-pill/styles.css +1 -2
- package/dist/collection/components/q2-popover/index.js +21 -5
- package/dist/collection/components/q2-popover/styles.css +10 -67
- package/dist/collection/components/q2-radio/index.js +2 -2
- package/dist/collection/components/q2-select/index.js +197 -427
- package/dist/collection/components/q2-select/styles.css +5 -11
- package/dist/collection/components/q2-tag/index.js +38 -5
- package/dist/collection/utils/action-sheet.js +79 -0
- package/dist/collection/utils/index.js +31 -7
- package/dist/components/action-sheet.js +81 -0
- package/dist/components/charting.js +3113 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/index10.js +1 -1
- package/dist/components/index11.js +42 -353
- package/dist/components/index12.js +44 -97
- package/dist/components/index13.js +495 -580
- package/dist/components/index14.js +137 -0
- package/dist/components/index15.js +626 -0
- package/dist/components/index5.js +1 -1
- package/dist/components/index6.js +1 -1
- package/dist/components/index7.js +1 -1
- package/dist/components/index8.js +1 -1
- package/dist/components/index9.js +3 -3
- package/dist/components/installCanvasRenderer.js +188 -1123
- package/dist/components/installLabelLayout.js +1042 -0
- package/dist/components/q2-action-sheet.d.ts +11 -0
- package/dist/components/q2-action-sheet.js +282 -0
- package/dist/components/q2-calendar.js +1 -1
- package/dist/components/q2-card.js +2 -2
- package/dist/components/q2-carousel-pane.js +1 -1
- package/dist/components/q2-carousel.js +1 -1
- package/dist/components/q2-chart-area.d.ts +11 -0
- package/dist/components/q2-chart-area.js +4604 -0
- package/dist/components/q2-chart-bar.js +11 -3119
- package/dist/components/q2-chart-donut.js +4 -3
- package/dist/components/q2-checkbox-group.js +1 -1
- package/dist/components/q2-checkbox.js +2 -2
- package/dist/components/q2-dropdown.js +2 -2
- package/dist/components/q2-editable-field.js +1 -1
- package/dist/components/q2-loading-element.js +1 -1
- package/dist/components/q2-loc.js +1 -1
- package/dist/components/q2-month-picker.js +1 -1
- package/dist/components/q2-optgroup.js +1 -70
- package/dist/components/q2-option-list.js +1 -1
- package/dist/components/q2-option.js +1 -76
- package/dist/components/q2-pagination.js +1 -1
- package/dist/components/q2-pill.js +62 -21
- package/dist/components/q2-popover.js +1 -1
- package/dist/components/q2-radio-group.js +1 -1
- package/dist/components/q2-radio.js +3 -3
- package/dist/components/q2-section.js +1 -1
- package/dist/components/q2-select.js +181 -427
- package/dist/components/q2-stepper-pane.js +1 -1
- package/dist/components/q2-stepper-vertical.js +1 -1
- package/dist/components/q2-stepper.js +1 -1
- package/dist/components/q2-tab-container.js +1 -1
- package/dist/components/q2-tag.js +24 -8
- package/dist/components/q2-textarea.js +1 -1
- package/dist/esm/action-sheet-a9597b32.js +81 -0
- package/dist/esm/charting-2a73ba8e.js +3113 -0
- package/dist/esm/{index-9c591682.js → index-ca21e539.js} +32 -8
- package/dist/esm/{installCanvasRenderer-0143b52d.js → installCanvasRenderer-4a470516.js} +188 -1123
- package/dist/esm/installLabelLayout-d660eaad.js +1042 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/q2-action-sheet.entry.js +214 -0
- package/dist/esm/q2-badge_2.entry.js +1 -1
- package/dist/esm/q2-btn_2.entry.js +2 -2
- package/dist/esm/q2-calendar.entry.js +1 -1
- package/dist/esm/q2-card.entry.js +2 -2
- package/dist/esm/q2-carousel-pane.entry.js +1 -1
- package/dist/esm/q2-carousel.entry.js +1 -1
- package/dist/esm/q2-chart-area.entry.js +4565 -0
- package/dist/esm/q2-chart-bar.entry.js +11 -3119
- package/dist/esm/q2-chart-donut.entry.js +4 -3
- package/dist/esm/q2-checkbox-group.entry.js +1 -1
- package/dist/esm/q2-checkbox.entry.js +2 -2
- 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-loading-element.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 +1 -1
- package/dist/esm/q2-optgroup_2.entry.js +88 -0
- package/dist/esm/q2-option-list_2.entry.js +230 -88
- package/dist/esm/q2-pagination.entry.js +1 -1
- package/dist/esm/q2-pill.entry.js +57 -18
- 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 +149 -409
- 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 +21 -6
- package/dist/esm/q2-tecton-elements.js +1 -1
- package/dist/esm/q2-textarea.entry.js +1 -1
- package/dist/q2-tecton-elements/{p-db873db2.entry.js → p-0473f4f7.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-520c40f6.entry.js → p-13a1390b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9ebb283a.entry.js → p-13deb3ed.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-0ba564b1.entry.js → p-1d854203.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-1f71774f.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-18cc4758.entry.js → p-256d3fe6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9281adaa.entry.js → p-282f0f8c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-2d2c5af2.entry.js → p-30969629.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-30cd888b.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-fc134a5d.entry.js → p-37cf9c97.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-fb37e67e.entry.js → p-388349b5.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-458b1987.js +1 -0
- package/dist/q2-tecton-elements/p-52063431.js +39 -0
- package/dist/q2-tecton-elements/p-5589ae0f.entry.js +1 -0
- package/dist/q2-tecton-elements/p-619aed74.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-4625184b.entry.js → p-63b67260.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-e4dc9ac0.entry.js → p-63e363ad.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-cbd1289a.entry.js → p-6736df05.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-72fe10cc.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-c4640b55.entry.js → p-75b817c6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-c3f27fe2.entry.js → p-7a116095.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-7c94119b.entry.js +1 -0
- package/dist/q2-tecton-elements/p-833398d1.js +1 -0
- package/dist/q2-tecton-elements/{p-ce015552.entry.js → p-90572e43.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-91153c61.entry.js +1 -0
- package/dist/q2-tecton-elements/p-9792de8a.entry.js +1 -0
- package/dist/q2-tecton-elements/p-9acfa94e.js +1 -0
- package/dist/q2-tecton-elements/p-a1926e65.js +1 -0
- package/dist/q2-tecton-elements/{p-ffb48ccc.entry.js → p-b3a8cdc5.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-ce3f203c.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-041b3a82.entry.js → p-ce91cd9b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-b8b00394.entry.js → p-cefc9d0b.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-d05beeb7.entry.js +1 -0
- package/dist/q2-tecton-elements/p-dc7c8371.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-16c11d74.entry.js → p-e58581fc.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-f800fd1e.entry.js → p-e886c55b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-6e6b5b80.entry.js → p-f0ec4d2c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-97aa8423.entry.js → p-f94e7043.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-c444a60b.entry.js → p-fcb7d191.entry.js} +1 -1
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/test/helpers.js +3 -2
- package/dist/types/components/q2-action-sheet/index.d.ts +52 -0
- package/dist/types/components/q2-card/index.d.ts +1 -1
- package/dist/types/components/q2-chart-area/index.d.ts +40 -0
- package/dist/types/components/q2-chart-bar/index.d.ts +2 -2
- package/dist/types/components/q2-chart-donut/index.d.ts +1 -1
- package/dist/types/components/q2-checkbox/index.d.ts +4 -1
- package/dist/types/components/q2-option/index.d.ts +0 -3
- package/dist/types/components/q2-option-list/index.d.ts +16 -8
- package/dist/types/components/q2-pill/index.d.ts +10 -1
- package/dist/types/components/q2-popover/index.d.ts +2 -0
- package/dist/types/components/q2-select/index.d.ts +46 -47
- package/dist/types/components/q2-tag/index.d.ts +3 -2
- package/dist/types/components.d.ts +100 -13
- package/dist/types/global.d.ts +10 -1
- package/dist/types/utils/action-sheet.d.ts +12 -0
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/workspace/workspace/{_production_release_1.22.x-alpha → Tecton_tecton-production_master}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +1 -1
- package/package.json +3 -2
- package/dist/cjs/q2-optgroup.cjs.entry.js +0 -56
- package/dist/cjs/q2-option.cjs.entry.js +0 -46
- package/dist/esm/q2-optgroup.entry.js +0 -52
- package/dist/esm/q2-option.entry.js +0 -42
- package/dist/q2-tecton-elements/p-0d8dd75a.entry.js +0 -1
- package/dist/q2-tecton-elements/p-0fad9c5a.entry.js +0 -1
- package/dist/q2-tecton-elements/p-1f85cced.js +0 -39
- package/dist/q2-tecton-elements/p-2c9b1308.entry.js +0 -1
- package/dist/q2-tecton-elements/p-5e374fbd.js +0 -1
- package/dist/q2-tecton-elements/p-6b52a262.entry.js +0 -1
- package/dist/q2-tecton-elements/p-aaf42539.entry.js +0 -1
- package/dist/q2-tecton-elements/p-cf41970f.entry.js +0 -1
- package/dist/q2-tecton-elements/p-de164483.entry.js +0 -1
- package/dist/q2-tecton-elements/p-e6d26f39.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f1d06917.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f35bf6a3.entry.js +0 -1
|
@@ -138,7 +138,7 @@ button {
|
|
|
138
138
|
.q2-select-input {
|
|
139
139
|
margin: 0;
|
|
140
140
|
--tct-input-min-height: var(--tct-select-input-min-height, var(--t-select-input-min-height));
|
|
141
|
-
--tct-input-max-height: var(--tct-select-input-max-height, var(--t-select-input-max-height,
|
|
141
|
+
--tct-input-max-height: var(--tct-select-input-max-height, var(--t-select-input-max-height, none));
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
::slotted([slot=_selected-display]) {
|
|
@@ -171,22 +171,16 @@ button {
|
|
|
171
171
|
width: calc(100% - 68px - var(--tct-scale-3, var(--app-scale-3x, 15px)));
|
|
172
172
|
}
|
|
173
173
|
|
|
174
|
-
.dropdown-open .q2-select-dropdown {
|
|
175
|
-
overflow-y: auto;
|
|
176
|
-
max-height: 300px;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
174
|
.multi-select-header {
|
|
180
175
|
padding: var(--tct-scale-1, var(--app-scale-1x, 5px)) var(--tct-scale-2, var(--app-scale-2x, 10px));
|
|
181
176
|
position: sticky;
|
|
182
177
|
top: 0;
|
|
183
178
|
z-index: 5;
|
|
184
179
|
background: var(--app-white);
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
margin-left: var(--tct-scale-2, var(--app-scale-2x, 10px));
|
|
180
|
+
display: inline-grid;
|
|
181
|
+
grid-template-columns: repeat(3, auto);
|
|
182
|
+
gap: var(--app-scale-2x, 10px);
|
|
183
|
+
align-items: center;
|
|
190
184
|
}
|
|
191
185
|
|
|
192
186
|
.q2-element-dropdown.dropup {
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import { isEventFromElement, loc, overrideFocus } from 'src/utils';
|
|
3
|
+
import { shouldShowActionSheet, showActionSheetList } from 'src/utils/action-sheet';
|
|
3
4
|
export class Q2Tag {
|
|
4
5
|
constructor() {
|
|
6
|
+
var _a;
|
|
5
7
|
this.activateFirstOption = false;
|
|
6
8
|
/// Getters ///
|
|
7
9
|
/// Helpers
|
|
@@ -24,14 +26,26 @@ export class Q2Tag {
|
|
|
24
26
|
const { value } = event.detail;
|
|
25
27
|
this.click.emit({ value });
|
|
26
28
|
};
|
|
27
|
-
this.handleClick = (event) => {
|
|
29
|
+
this.handleClick = async (event) => {
|
|
28
30
|
event.stopPropagation();
|
|
29
31
|
this.activateFirstOption = false;
|
|
30
|
-
this
|
|
32
|
+
if (shouldShowActionSheet(this)) {
|
|
33
|
+
const { value } = await showActionSheetList(this, event);
|
|
34
|
+
this.click.emit({ value });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.popoverElement.toggle();
|
|
38
|
+
}
|
|
31
39
|
};
|
|
32
|
-
this.handleKeydown = (event) => {
|
|
40
|
+
this.handleKeydown = async (event) => {
|
|
33
41
|
this.activateFirstOption = true;
|
|
34
|
-
this
|
|
42
|
+
if (shouldShowActionSheet(this, event)) {
|
|
43
|
+
const { value } = await showActionSheetList(this, event);
|
|
44
|
+
this.click.emit({ value });
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
this.optionList.handleExternalKeydown(event);
|
|
48
|
+
}
|
|
35
49
|
};
|
|
36
50
|
this.handleButtonFocusout = (event) => {
|
|
37
51
|
var _a;
|
|
@@ -44,6 +58,7 @@ export class Q2Tag {
|
|
|
44
58
|
this.dropdownBtn.focus();
|
|
45
59
|
this.dropdownBtn.click();
|
|
46
60
|
};
|
|
61
|
+
this.hoist = !!((_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.useActionSheets);
|
|
47
62
|
this.open = undefined;
|
|
48
63
|
this.role = 'listitem';
|
|
49
64
|
this.label = undefined;
|
|
@@ -91,7 +106,7 @@ export class Q2Tag {
|
|
|
91
106
|
const wrapperClassNames = ['tag-wrapper'];
|
|
92
107
|
if (hasOptions)
|
|
93
108
|
wrapperClassNames.push('has-options');
|
|
94
|
-
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))))));
|
|
109
|
+
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, align: "right" }, 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))))));
|
|
95
110
|
}
|
|
96
111
|
static get is() { return "q2-tag"; }
|
|
97
112
|
static get encapsulation() { return "shadow"; }
|
|
@@ -107,6 +122,24 @@ export class Q2Tag {
|
|
|
107
122
|
}
|
|
108
123
|
static get properties() {
|
|
109
124
|
return {
|
|
125
|
+
"hoist": {
|
|
126
|
+
"type": "boolean",
|
|
127
|
+
"mutable": false,
|
|
128
|
+
"complexType": {
|
|
129
|
+
"original": "boolean",
|
|
130
|
+
"resolved": "boolean",
|
|
131
|
+
"references": {}
|
|
132
|
+
},
|
|
133
|
+
"required": false,
|
|
134
|
+
"optional": false,
|
|
135
|
+
"docs": {
|
|
136
|
+
"tags": [],
|
|
137
|
+
"text": ""
|
|
138
|
+
},
|
|
139
|
+
"attribute": "hoist",
|
|
140
|
+
"reflect": false,
|
|
141
|
+
"defaultValue": "!!window.Tecton?.useActionSheets"
|
|
142
|
+
},
|
|
110
143
|
"open": {
|
|
111
144
|
"type": "boolean",
|
|
112
145
|
"mutable": true,
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const shouldShowActionSheet = (component, event) => {
|
|
2
|
+
var _a;
|
|
3
|
+
const isDialogSupported = 'open' in document.createElement('dialog');
|
|
4
|
+
if (!isDialogSupported)
|
|
5
|
+
return false;
|
|
6
|
+
const canShowActionSheet = !!((_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.showActionSheet);
|
|
7
|
+
if (!canShowActionSheet)
|
|
8
|
+
return false;
|
|
9
|
+
const keysThatTriggerOpen = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp', 'Home', 'End'];
|
|
10
|
+
if (event) {
|
|
11
|
+
const eventIsKeyboardEvent = event instanceof KeyboardEvent;
|
|
12
|
+
const eventIsMouseEvent = event instanceof MouseEvent;
|
|
13
|
+
const keyboardEventShouldTriggerOpen = eventIsKeyboardEvent && keysThatTriggerOpen.includes(event.key);
|
|
14
|
+
const mouseEventShouldTriggerOpen = eventIsMouseEvent && event.type === 'click';
|
|
15
|
+
const eventShouldTriggerOpen = mouseEventShouldTriggerOpen || keyboardEventShouldTriggerOpen;
|
|
16
|
+
if (!eventShouldTriggerOpen)
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (component.hoist)
|
|
20
|
+
return true;
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
const parseOptions = (options) => {
|
|
24
|
+
const defaultOption = {
|
|
25
|
+
disabled: false,
|
|
26
|
+
display: '',
|
|
27
|
+
hidden: false,
|
|
28
|
+
multiline: false,
|
|
29
|
+
value: '',
|
|
30
|
+
innerHTML: '',
|
|
31
|
+
};
|
|
32
|
+
const optionPropsToGet = Object.keys(defaultOption);
|
|
33
|
+
const defaultOptgroup = {
|
|
34
|
+
disabled: false,
|
|
35
|
+
label: '',
|
|
36
|
+
options: [],
|
|
37
|
+
};
|
|
38
|
+
const optgroupPropsToGet = Object.keys(defaultOptgroup);
|
|
39
|
+
return options.map(option => {
|
|
40
|
+
if (option.tagName === 'Q2-OPTGROUP') {
|
|
41
|
+
const optgroup = option;
|
|
42
|
+
return optgroupPropsToGet.reduce((acc, prop) => {
|
|
43
|
+
if (prop === 'options') {
|
|
44
|
+
const options = Array.from(option.children).filter(child => child.tagName === 'Q2-OPTION' || child.tagName === 'Q2-OPTGROUP');
|
|
45
|
+
acc[prop] = parseOptions(options);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
acc[prop] = optgroup[prop];
|
|
49
|
+
}
|
|
50
|
+
return acc;
|
|
51
|
+
}, Object.assign({}, defaultOptgroup));
|
|
52
|
+
}
|
|
53
|
+
else if (option.tagName === 'Q2-OPTION') {
|
|
54
|
+
return optionPropsToGet.reduce((acc, prop) => {
|
|
55
|
+
acc[prop] = option[prop];
|
|
56
|
+
return acc;
|
|
57
|
+
}, Object.assign({}, defaultOption));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
export const buildListData = async (component, event) => {
|
|
62
|
+
return {
|
|
63
|
+
appearance: 'list',
|
|
64
|
+
title: component.label || '',
|
|
65
|
+
description: '',
|
|
66
|
+
event,
|
|
67
|
+
listProps: {
|
|
68
|
+
multiple: !!component.optionList.multiple,
|
|
69
|
+
selectedOptions: component.optionList.selectedOptions || [],
|
|
70
|
+
noSelect: !!component.optionList.noSelect,
|
|
71
|
+
},
|
|
72
|
+
options: parseOptions(await component.optionList.getContents()),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
export const showActionSheetList = async (component, event) => {
|
|
76
|
+
var _a;
|
|
77
|
+
const listData = await buildListData(component, event);
|
|
78
|
+
return (_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.showActionSheet(listData);
|
|
79
|
+
};
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import { h } from '@stencil/core';
|
|
2
2
|
import smoothScroll from 'smoothscroll-polyfill';
|
|
3
|
+
export function isHostLosingFocus(event, hostElement) {
|
|
4
|
+
const type = event.type;
|
|
5
|
+
const focusInTypes = ['focusin', 'focus'];
|
|
6
|
+
const isFocusIn = focusInTypes.includes(type);
|
|
7
|
+
// on focusin: `target` is element losing focus, `relatedTarget` is element gaining focus
|
|
8
|
+
// on focusout: `target` is element gaining focus, `relatedTarget` is element losing focus
|
|
9
|
+
const elementGainingFocus = isFocusIn ? event.target : event.relatedTarget;
|
|
10
|
+
const isElementNestedInHostElement = (element) => {
|
|
11
|
+
if (element === hostElement)
|
|
12
|
+
return true;
|
|
13
|
+
if (element.parentElement) {
|
|
14
|
+
return isElementNestedInHostElement(element.parentElement);
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
};
|
|
18
|
+
if (!(elementGainingFocus instanceof HTMLElement))
|
|
19
|
+
return false;
|
|
20
|
+
return !isElementNestedInHostElement(elementGainingFocus);
|
|
21
|
+
}
|
|
3
22
|
export function isRelatedTargetWithinHost(event, element) {
|
|
4
23
|
return event.relatedTarget !== element && !element.contains(event.relatedTarget);
|
|
5
24
|
}
|
|
@@ -31,11 +50,13 @@ let guid = 1000;
|
|
|
31
50
|
export function createGuid() {
|
|
32
51
|
return guid++;
|
|
33
52
|
}
|
|
34
|
-
export function nextPaint(fn
|
|
35
|
-
|
|
36
|
-
fn
|
|
37
|
-
|
|
38
|
-
|
|
53
|
+
export function nextPaint(fn) {
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
requestAnimationFrame(fn);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
export function waitForNextPaint() {
|
|
59
|
+
return new Promise(resolve => nextPaint(resolve));
|
|
39
60
|
}
|
|
40
61
|
export function capitalize(value) {
|
|
41
62
|
return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;
|
|
@@ -51,7 +72,7 @@ export function loc(key, subs) {
|
|
|
51
72
|
var _a, _b, _c;
|
|
52
73
|
if (!key)
|
|
53
74
|
return '';
|
|
54
|
-
if (((_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.
|
|
75
|
+
if (((_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.noStrings) === true) {
|
|
55
76
|
return key;
|
|
56
77
|
}
|
|
57
78
|
return (_c = (_b = window === null || window === void 0 ? void 0 : window.TectonElements) === null || _b === void 0 ? void 0 : _b.loc(key, subs)) !== null && _c !== void 0 ? _c : key;
|
|
@@ -100,6 +121,7 @@ export function setMessageHeight(target) {
|
|
|
100
121
|
});
|
|
101
122
|
}
|
|
102
123
|
export function setPopProperties(target) {
|
|
124
|
+
var _a, _b, _c, _d;
|
|
103
125
|
const { dropdownContainer, popDirection } = target;
|
|
104
126
|
if (dropdownContainer) {
|
|
105
127
|
dropdownContainer.style.maxHeight = null;
|
|
@@ -114,7 +136,9 @@ export function setPopProperties(target) {
|
|
|
114
136
|
const dropdownHeight = dropdownContainer.getBoundingClientRect().height;
|
|
115
137
|
dropdownContainer.classList.remove('sizable');
|
|
116
138
|
const { top: topOffset, height } = controlElement.getBoundingClientRect();
|
|
117
|
-
const
|
|
139
|
+
const scrollY = ((_b = (_a = window.Tecton) === null || _a === void 0 ? void 0 : _a.platformDimensions) === null || _b === void 0 ? void 0 : _b.scrollY) || 0;
|
|
140
|
+
const innerHeight = ((_d = (_c = window.Tecton) === null || _c === void 0 ? void 0 : _c.platformDimensions) === null || _d === void 0 ? void 0 : _d.innerHeight) || window.innerHeight;
|
|
141
|
+
const bottomOffset = scrollY + innerHeight - topOffset - height;
|
|
118
142
|
const canShowFullSizeBelow = bottomOffset > dropdownHeight;
|
|
119
143
|
const canShowFullSizeAbove = dropdownHeight <= topOffset;
|
|
120
144
|
// Prefer full size above or below
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
const shouldShowActionSheet = (component, event) => {
|
|
2
|
+
var _a;
|
|
3
|
+
const isDialogSupported = 'open' in document.createElement('dialog');
|
|
4
|
+
if (!isDialogSupported)
|
|
5
|
+
return false;
|
|
6
|
+
const canShowActionSheet = !!((_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.showActionSheet);
|
|
7
|
+
if (!canShowActionSheet)
|
|
8
|
+
return false;
|
|
9
|
+
const keysThatTriggerOpen = ['ArrowDown', 'ArrowUp', 'PageDown', 'PageUp', 'Home', 'End'];
|
|
10
|
+
if (event) {
|
|
11
|
+
const eventIsKeyboardEvent = event instanceof KeyboardEvent;
|
|
12
|
+
const eventIsMouseEvent = event instanceof MouseEvent;
|
|
13
|
+
const keyboardEventShouldTriggerOpen = eventIsKeyboardEvent && keysThatTriggerOpen.includes(event.key);
|
|
14
|
+
const mouseEventShouldTriggerOpen = eventIsMouseEvent && event.type === 'click';
|
|
15
|
+
const eventShouldTriggerOpen = mouseEventShouldTriggerOpen || keyboardEventShouldTriggerOpen;
|
|
16
|
+
if (!eventShouldTriggerOpen)
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
if (component.hoist)
|
|
20
|
+
return true;
|
|
21
|
+
return false;
|
|
22
|
+
};
|
|
23
|
+
const parseOptions = (options) => {
|
|
24
|
+
const defaultOption = {
|
|
25
|
+
disabled: false,
|
|
26
|
+
display: '',
|
|
27
|
+
hidden: false,
|
|
28
|
+
multiline: false,
|
|
29
|
+
value: '',
|
|
30
|
+
innerHTML: '',
|
|
31
|
+
};
|
|
32
|
+
const optionPropsToGet = Object.keys(defaultOption);
|
|
33
|
+
const defaultOptgroup = {
|
|
34
|
+
disabled: false,
|
|
35
|
+
label: '',
|
|
36
|
+
options: [],
|
|
37
|
+
};
|
|
38
|
+
const optgroupPropsToGet = Object.keys(defaultOptgroup);
|
|
39
|
+
return options.map(option => {
|
|
40
|
+
if (option.tagName === 'Q2-OPTGROUP') {
|
|
41
|
+
const optgroup = option;
|
|
42
|
+
return optgroupPropsToGet.reduce((acc, prop) => {
|
|
43
|
+
if (prop === 'options') {
|
|
44
|
+
const options = Array.from(option.children).filter(child => child.tagName === 'Q2-OPTION' || child.tagName === 'Q2-OPTGROUP');
|
|
45
|
+
acc[prop] = parseOptions(options);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
acc[prop] = optgroup[prop];
|
|
49
|
+
}
|
|
50
|
+
return acc;
|
|
51
|
+
}, Object.assign({}, defaultOptgroup));
|
|
52
|
+
}
|
|
53
|
+
else if (option.tagName === 'Q2-OPTION') {
|
|
54
|
+
return optionPropsToGet.reduce((acc, prop) => {
|
|
55
|
+
acc[prop] = option[prop];
|
|
56
|
+
return acc;
|
|
57
|
+
}, Object.assign({}, defaultOption));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
};
|
|
61
|
+
const buildListData = async (component, event) => {
|
|
62
|
+
return {
|
|
63
|
+
appearance: 'list',
|
|
64
|
+
title: component.label || '',
|
|
65
|
+
description: '',
|
|
66
|
+
event,
|
|
67
|
+
listProps: {
|
|
68
|
+
multiple: !!component.optionList.multiple,
|
|
69
|
+
selectedOptions: component.optionList.selectedOptions || [],
|
|
70
|
+
noSelect: !!component.optionList.noSelect,
|
|
71
|
+
},
|
|
72
|
+
options: parseOptions(await component.optionList.getContents()),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
const showActionSheetList = async (component, event) => {
|
|
76
|
+
var _a;
|
|
77
|
+
const listData = await buildListData(component, event);
|
|
78
|
+
return (_a = window.TectonElements) === null || _a === void 0 ? void 0 : _a.showActionSheet(listData);
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export { showActionSheetList as a, shouldShowActionSheet as s };
|