q2-tecton-elements 1.23.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/{index-0648c2ec.js → index-e00b4210.js} +28 -5
- 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 +1 -1
- 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-area.cjs.entry.js +1 -1
- package/dist/cjs/q2-chart-bar.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 +1 -1
- package/dist/cjs/q2-optgroup_2.cjs.entry.js +93 -0
- package/dist/cjs/q2-option-list_2.cjs.entry.js +226 -86
- 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 +148 -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 +1 -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-checkbox/index.js +2 -2
- 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-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 +17 -3
- 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 +179 -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 +26 -5
- package/dist/components/action-sheet.js +81 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index10.js +1 -1
- package/dist/components/index11.js +42 -353
- package/dist/components/index12.js +44 -99
- package/dist/components/index13.js +495 -583
- 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 +2 -2
- 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 +1 -1
- package/dist/components/q2-carousel-pane.js +1 -1
- package/dist/components/q2-carousel.js +1 -1
- package/dist/components/q2-chart-area.js +1 -1
- package/dist/components/q2-chart-bar.js +1 -1
- package/dist/components/q2-chart-donut.js +1 -1
- package/dist/components/q2-checkbox-group.js +1 -1
- package/dist/components/q2-checkbox.js +1 -1
- package/dist/components/q2-dropdown.js +2 -2
- package/dist/components/q2-editable-field.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 +179 -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/{index-501fd22e.js → index-ca21e539.js} +27 -6
- 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 +1 -1
- 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-area.entry.js +1 -1
- package/dist/esm/q2-chart-bar.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 +1 -1
- package/dist/esm/q2-optgroup_2.entry.js +88 -0
- package/dist/esm/q2-option-list_2.entry.js +226 -86
- 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 +148 -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-3e9a30c4.entry.js → p-0473f4f7.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-5b1aba1a.entry.js → p-13a1390b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-ebd7efa5.entry.js → p-13deb3ed.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-45d61789.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-6b7e1ebd.entry.js → p-256d3fe6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-8dea9a0c.entry.js → p-282f0f8c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-3603fcdc.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-3fd5d010.entry.js → p-37cf9c97.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-53be87c8.entry.js → p-388349b5.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-5589ae0f.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-604b22a8.entry.js → p-619aed74.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-d68b5eb3.entry.js → p-63b67260.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-ba73ee1f.entry.js → p-63e363ad.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-d7b27803.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-68ef0786.entry.js → p-75b817c6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-a2add94e.entry.js → p-7a116095.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-d88e4383.entry.js → p-7c94119b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-24f4571d.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-70b01387.entry.js → p-9792de8a.entry.js} +1 -1
- 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-d27b2caa.entry.js → p-b3a8cdc5.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9b101e22.entry.js → p-ce3f203c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-bf41e71b.entry.js → p-ce91cd9b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-18629cbf.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-6be86940.entry.js → p-dc7c8371.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-acc77332.entry.js → p-e58581fc.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-38a33baa.entry.js → p-e886c55b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-7aa80653.entry.js → p-f94e7043.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-78fac0fa.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-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 +45 -47
- package/dist/types/components/q2-tag/index.d.ts +3 -2
- package/dist/types/components.d.ts +42 -13
- package/dist/types/global.d.ts +9 -2
- package/dist/types/utils/action-sheet.d.ts +12 -0
- package/dist/types/utils/index.d.ts +3 -1
- package/dist/types/workspace/workspace/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-2c20fc43.entry.js +0 -1
- package/dist/q2-tecton-elements/p-3813f51d.entry.js +0 -1
- package/dist/q2-tecton-elements/p-a510290a.js +0 -1
- package/dist/q2-tecton-elements/p-ba76ecfd.entry.js +0 -1
- package/dist/q2-tecton-elements/p-bbdae095.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f1d06917.entry.js +0 -1
- package/dist/q2-tecton-elements/p-f6e868c1.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)}`;
|
|
@@ -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 };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* Q2TectonElements custom elements */
|
|
2
2
|
export { ClickElsewhere as ClickElsewhere } from '../types/components/click-elsewhere/index';
|
|
3
|
+
export { Q2ActionSheet as Q2ActionSheet } from '../types/components/q2-action-sheet/index';
|
|
3
4
|
export { Q2Avatar as Q2Avatar } from '../types/components/q2-avatar/index';
|
|
4
5
|
export { Q2Badge as Q2Badge } from '../types/components/q2-badge/index';
|
|
5
6
|
export { Q2Btn as Q2Btn } from '../types/components/q2-btn/index';
|
package/dist/components/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
2
2
|
export { ClickElsewhere, defineCustomElement as defineCustomElementClickElsewhere } from './click-elsewhere.js';
|
|
3
|
+
export { Q2ActionSheet, defineCustomElement as defineCustomElementQ2ActionSheet } from './q2-action-sheet.js';
|
|
3
4
|
export { Q2Avatar, defineCustomElement as defineCustomElementQ2Avatar } from './q2-avatar.js';
|
|
4
5
|
export { Q2Badge, defineCustomElement as defineCustomElementQ2Badge } from './q2-badge.js';
|
|
5
6
|
export { Q2Btn, defineCustomElement as defineCustomElementQ2Btn } from './q2-btn.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { k as isFirefox, o as overrideFocus, n as nextPaint, i as isEventFromElement } from './index15.js';
|
|
3
3
|
import { d as defineCustomElement$1 } from './index7.js';
|
|
4
4
|
|
|
5
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}:host([hidden]){display:none}.message{border-left-width:var(--tct-message-bar-width, var(--t-message-bar-width, var(--app-scale-1x, 5px)));border-left-style:solid;--comp-line-height:var(--tct-message-line-height, var(--t-message-line-height, var(--app-line-height, 1.428571429em)));display:grid;gap:var(--tct-scale-1, var(--app-scale-1x, 5px));align-items:flex-start;background:var(--tct-message-bg, var(--t-message-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, #f2f2f2))))));color:var(--tct-message-font-color, var(--t-message-font-color, inherit));box-shadow:var(--tct-message-box-shadow, var(--t-message-box-shadow, inherit));border-radius:var(--tct-message-border-radius, var(--t-message-border-radius, inherit))}.message:focus{box-shadow:var(--const-global-focus)}.message-icon{--comp-top-offset:calc(calc(var(--comp-line-height) - var(--comp-icon-size)) / 2);--tct-icon-size:var(--comp-icon-size);top:var(--comp-top-offset);margin-bottom:calc(var(--comp-top-offset) * -1)}.message-content{flex:1;line-height:var(--comp-line-height)}::slotted(ul){padding-left:var(--tct-scale-l3, var(--app-scale-3x, 15px))}:host(:not([appearance])),:host([appearance=standard]){margin:var(--tct-scale-l3, var(--app-scale-3x, 15px)) 0}:host(:not([appearance])) .message,:host([appearance=standard]) .message{--comp-icon-size:var(--tct-message-icon-size, var(--t-message-icon-size, 24px));--comp-padding:var(--tct-message-padding, var(--t-message-padding, var(--app-scale-3x, 15px)));grid-template-columns:var(--comp-icon-size) 1fr;padding:var(--comp-padding);padding-left:calc(var(--comp-padding) - var(--tct-scale-2, var(--app-scale-2x, 10px)));padding-bottom:calc(var(--comp-padding) - var(--tct-scale-1, var(--app-scale-1x, 5px)))}:host(:not([appearance])) ::slotted(ul),:host([appearance=standard]) ::slotted(ul){margin:var(--tct-scale-l3, var(--app-scale-3x, 15px)) 0}:host([appearance=minimal]){margin:0}:host([appearance=minimal]) .message{padding:var(--tct-message-minimal-padding, var(--t-message-minimal-padding, var(--app-scale-2x, 10px)));grid-template-columns:1fr}:host([appearance=minimal]) ::slotted(ul){margin:var(--tct-scale-1, var(--app-scale-1x, 5px)) 0}:host(:not([type])) .message,:host([type=info]) .message{border-left-color:var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1))}:host(:not([type])) .message-icon,:host([type=info]) .message-icon{--tct-icon-stroke-primary:var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1));--tct-icon-stroke-secondary:var(--tct-stoplight-info, var(--const-stoplight-info, #0079c1))}:host([type=success]) .message{border-left-color:var(--tct-stoplight-success, var(--const-stoplight-success, #0e8a00))}:host([type=success]) .message-icon{--tct-icon-stroke-primary:var(--tct-stoplight-success, var(--const-stoplight-success, #0e8a00));--tct-icon-stroke-secondary:var(--tct-stoplight-success, var(--const-stoplight-success, #0e8a00))}:host([type=warning]) .message{border-left-color:var(--tct-stoplight-warning, var(--const-stoplight-warning, #f0b400))}:host([type=warning]) .message-icon{--tct-icon-stroke-primary:var(--tct-stoplight-warning, var(--const-stoplight-warning, #f0b400));--tct-icon-stroke-secondary:var(--tct-stoplight-warning, var(--const-stoplight-warning, #f0b400))}:host([type=error]) .message,:host([type=danger]) .message{border-left-color:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000))}:host([type=error]) .message-icon,:host([type=danger]) .message-icon{--tct-icon-stroke-primary:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000));--tct-icon-stroke-secondary:var(--tct-stoplight-error, var(--const-stoplight-alert, #c30000))}";
|