q2-tecton-elements 1.13.0-alpha.0 → 1.13.2
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/click-elsewhere.cjs.entry.js +5 -7
- package/dist/cjs/{icons-4595ee47.js → icons-08ffe5c9.js} +394 -384
- package/dist/cjs/{index-c2e53804.js → index-7febb200.js} +112 -65
- package/dist/cjs/{index-a55d3c34.js → index-dd823ee6.js} +27 -14
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/q2-avatar.cjs.entry.js +2 -2
- package/dist/cjs/q2-badge.cjs.entry.js +43 -0
- package/dist/cjs/q2-btn_2.cjs.entry.js +13 -13
- package/dist/cjs/q2-calendar.cjs.entry.js +54 -59
- package/dist/cjs/q2-card.cjs.entry.js +127 -0
- package/dist/cjs/q2-carousel-pane.cjs.entry.js +5 -5
- package/dist/cjs/q2-carousel.cjs.entry.js +318 -106
- package/dist/cjs/q2-checkbox-group.cjs.entry.js +6 -3
- package/dist/cjs/q2-checkbox.cjs.entry.js +19 -11
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +7 -7
- package/dist/cjs/q2-dropdown.cjs.entry.js +8 -17
- package/dist/cjs/q2-editable-field.cjs.entry.js +5 -8
- package/dist/cjs/q2-icon.cjs.entry.js +3 -3
- package/dist/cjs/q2-input.cjs.entry.js +439 -437
- package/dist/cjs/q2-loading-element.cjs.entry.js +3 -3
- package/dist/cjs/q2-loc.cjs.entry.js +2 -2
- package/dist/cjs/q2-message.cjs.entry.js +5 -5
- package/dist/cjs/q2-optgroup.cjs.entry.js +3 -3
- package/dist/cjs/q2-option-list.cjs.entry.js +359 -0
- package/dist/cjs/q2-option.cjs.entry.js +3 -11
- package/dist/cjs/q2-pagination.cjs.entry.js +116 -0
- package/dist/cjs/q2-pill.cjs.entry.js +137 -0
- package/dist/cjs/q2-radio-group.cjs.entry.js +43 -18
- package/dist/cjs/q2-radio.cjs.entry.js +21 -4
- package/dist/cjs/q2-section.cjs.entry.js +5 -7
- package/dist/cjs/q2-select.cjs.entry.js +36 -31
- package/dist/cjs/q2-stepper-pane.cjs.entry.js +42 -4
- package/dist/cjs/q2-stepper-vertical.cjs.entry.js +278 -0
- package/dist/cjs/q2-stepper.cjs.entry.js +10 -12
- package/dist/cjs/q2-tab-container.cjs.entry.js +12 -8
- package/dist/cjs/q2-tab-pane.cjs.entry.js +1 -1
- package/dist/cjs/q2-tag.cjs.entry.js +94 -0
- package/dist/cjs/q2-tecton-elements.cjs.js +3 -3
- package/dist/cjs/q2-textarea.cjs.entry.js +8 -8
- package/dist/cjs/{shapes-086c0365.js → shapes-305746b5.js} +9 -16
- package/dist/cjs/tecton-tab-pane.cjs.entry.js +2 -5
- package/dist/collection/collection-manifest.json +10 -3
- package/dist/collection/components/click-elsewhere/index.js +4 -6
- package/dist/collection/components/q2-badge/index.js +148 -0
- package/dist/collection/components/q2-badge/styles.css +134 -0
- package/dist/collection/components/q2-btn/index.js +14 -14
- package/dist/collection/components/q2-btn/styles.css +1 -1
- package/dist/collection/components/q2-calendar/helpers.js +22 -20
- package/dist/collection/components/q2-calendar/index.js +45 -37
- package/dist/collection/components/q2-calendar/validation.js +4 -2
- package/dist/collection/components/q2-card/index.js +347 -0
- package/dist/collection/components/q2-card/styles.css +177 -0
- package/dist/collection/components/q2-carousel/index.js +11 -16
- package/dist/collection/components/q2-carousel/styles.css +3 -3
- package/dist/collection/components/q2-carousel-pane/index.js +2 -2
- package/dist/collection/components/q2-carousel-pane/styles.css +8 -3
- package/dist/collection/components/q2-checkbox/index.js +36 -11
- package/dist/collection/components/q2-checkbox/styles.css +1 -0
- package/dist/collection/components/q2-checkbox-group/index.js +22 -1
- package/dist/collection/components/q2-dropdown/index.js +6 -15
- package/dist/collection/components/q2-dropdown-item/index.js +5 -5
- package/dist/collection/components/q2-editable-field/index.js +3 -6
- package/dist/collection/components/q2-icon/icons.js +393 -383
- package/dist/collection/components/q2-input/formatting/credit-card.js +15 -13
- package/dist/collection/components/q2-input/formatting/currency.js +162 -162
- package/dist/collection/components/q2-input/formatting/date.js +1 -1
- package/dist/collection/components/q2-input/formatting/generic.js +7 -8
- package/dist/collection/components/q2-input/formatting/number.js +6 -9
- package/dist/collection/components/q2-input/formatting/numeric.js +5 -5
- package/dist/collection/components/q2-input/formatting/phone.js +215 -215
- package/dist/collection/components/q2-input/formatting/postal.js +1 -1
- package/dist/collection/components/q2-input/index.js +81 -25
- package/dist/collection/components/q2-input/styles.css +19 -14
- package/dist/collection/components/q2-loading/index.js +4 -4
- package/dist/collection/components/q2-loading/skeleton/q2-loading-element/index.js +1 -1
- package/dist/collection/components/q2-loading/skeleton/shapes.js +8 -15
- package/dist/collection/components/q2-message/index.js +3 -3
- package/dist/collection/components/q2-optgroup/index.js +1 -1
- package/dist/collection/components/q2-option/index.js +19 -25
- package/dist/collection/components/q2-option/styles.css +5 -0
- package/dist/collection/components/q2-option-list/index.js +648 -0
- package/dist/collection/components/q2-option-list/styles.css +128 -0
- package/dist/collection/components/q2-pagination/index.js +275 -0
- package/dist/collection/components/q2-pagination/styles.css +120 -0
- package/dist/collection/components/q2-pill/index.js +324 -0
- package/dist/collection/components/q2-pill/styles.css +229 -0
- package/dist/collection/components/q2-radio/index.js +38 -1
- package/dist/collection/components/q2-radio-group/index.js +66 -24
- package/dist/collection/components/q2-section/index.js +5 -7
- package/dist/collection/components/q2-select/index.js +53 -30
- package/dist/collection/components/q2-stepper/index.js +8 -10
- package/dist/collection/components/q2-stepper/styles.css +5 -5
- package/dist/collection/components/q2-stepper-pane/index.js +133 -5
- package/dist/collection/components/q2-stepper-vertical/index.js +346 -0
- package/dist/collection/components/q2-stepper-vertical/styles.css +273 -0
- package/dist/collection/components/q2-tab-container/index.js +11 -7
- package/dist/collection/components/q2-tag/index.js +200 -0
- package/dist/collection/components/q2-tag/styles.css +141 -0
- package/dist/collection/components/q2-textarea/index.js +6 -6
- package/dist/collection/components/tecton-tab-pane/index.js +3 -10
- package/dist/collection/utils/index.js +25 -13
- package/dist/esm/click-elsewhere.entry.js +5 -7
- package/dist/esm/{icons-3ee662ea.js → icons-b1e11526.js} +394 -384
- package/dist/esm/{index-ec6660af.js → index-0ff8de52.js} +27 -15
- package/dist/esm/{index-be8376c0.js → index-dbfb3ecc.js} +112 -65
- package/dist/esm/loader.js +3 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/q2-avatar.entry.js +2 -2
- package/dist/esm/q2-badge.entry.js +39 -0
- package/dist/esm/q2-btn_2.entry.js +13 -13
- package/dist/esm/q2-calendar.entry.js +54 -59
- package/dist/esm/q2-card.entry.js +123 -0
- package/dist/esm/q2-carousel-pane.entry.js +5 -5
- package/dist/esm/q2-carousel.entry.js +318 -106
- package/dist/esm/q2-checkbox-group.entry.js +6 -3
- package/dist/esm/q2-checkbox.entry.js +19 -11
- package/dist/esm/q2-dropdown-item.entry.js +7 -7
- package/dist/esm/q2-dropdown.entry.js +8 -17
- package/dist/esm/q2-editable-field.entry.js +5 -8
- package/dist/esm/q2-icon.entry.js +3 -3
- package/dist/esm/q2-input.entry.js +439 -437
- package/dist/esm/q2-loading-element.entry.js +3 -3
- package/dist/esm/q2-loc.entry.js +2 -2
- package/dist/esm/q2-message.entry.js +5 -5
- package/dist/esm/q2-optgroup.entry.js +3 -3
- package/dist/esm/q2-option-list.entry.js +355 -0
- package/dist/esm/q2-option.entry.js +3 -11
- package/dist/esm/q2-pagination.entry.js +112 -0
- package/dist/esm/q2-pill.entry.js +133 -0
- package/dist/esm/q2-radio-group.entry.js +43 -18
- package/dist/esm/q2-radio.entry.js +21 -4
- package/dist/esm/q2-section.entry.js +5 -7
- package/dist/esm/q2-select.entry.js +36 -31
- package/dist/esm/q2-stepper-pane.entry.js +42 -4
- package/dist/esm/q2-stepper-vertical.entry.js +274 -0
- package/dist/esm/q2-stepper.entry.js +10 -12
- package/dist/esm/q2-tab-container.entry.js +12 -8
- package/dist/esm/q2-tab-pane.entry.js +1 -1
- package/dist/esm/q2-tag.entry.js +90 -0
- package/dist/esm/q2-tecton-elements.js +3 -3
- package/dist/esm/q2-textarea.entry.js +8 -8
- package/dist/esm/{shapes-81c11dfe.js → shapes-cff4e1f0.js} +9 -16
- package/dist/esm/tecton-tab-pane.entry.js +2 -5
- package/dist/loader/index.d.ts +0 -1
- package/dist/q2-tecton-elements/{p-75e87cca.entry.js → p-00e8f782.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-01ae8461.entry.js +1 -0
- package/dist/q2-tecton-elements/p-0900bec1.entry.js +1 -0
- package/dist/q2-tecton-elements/p-10264ecb.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-fbf7c5e6.entry.js → p-1305ec5f.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-148391d6.entry.js +1 -0
- package/dist/q2-tecton-elements/p-1dfaee64.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-32ad664c.entry.js → p-221abbf6.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-c90a6016.js → p-255b2b4c.js} +1 -1
- package/dist/q2-tecton-elements/p-27736b6b.entry.js +1 -0
- package/dist/q2-tecton-elements/p-2846ab94.entry.js +1 -0
- package/dist/q2-tecton-elements/p-2bc1de01.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-8ea2c4f7.entry.js → p-2c15414c.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-2caa89fd.js +1 -0
- package/dist/q2-tecton-elements/p-327cca41.entry.js +1 -0
- package/dist/q2-tecton-elements/p-3a420dbf.entry.js +1 -0
- package/dist/q2-tecton-elements/p-3abcb09d.entry.js +1 -0
- package/dist/q2-tecton-elements/p-3fe98e3e.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-bb2e110a.entry.js → p-430a979b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-7e6fc65d.entry.js → p-45eb7739.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-750bcd33.entry.js → p-49b2abc4.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9b50c3c3.entry.js → p-4ab30466.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-5bbf2bfe.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-ac859fcc.entry.js → p-6fec9235.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-824aebd9.js +1 -0
- package/dist/q2-tecton-elements/p-a4ae89cc.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-50967020.entry.js → p-a5562aaa.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-ae130f70.entry.js +1 -0
- package/dist/q2-tecton-elements/p-b2302cd3.entry.js +1 -0
- package/dist/q2-tecton-elements/p-c20cbb2d.entry.js +1 -0
- package/dist/q2-tecton-elements/p-ca7a3380.entry.js +1 -0
- package/dist/q2-tecton-elements/{p-a6f8d09a.entry.js → p-d33e152c.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-9024859f.entry.js → p-d5218cd6.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-d52b435e.entry.js +1 -0
- package/dist/q2-tecton-elements/p-dd02cf8d.js +1 -0
- package/dist/q2-tecton-elements/{p-07a5d703.entry.js → p-e0e7ae8b.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-7e030e92.entry.js → p-ede12fc1.entry.js} +1 -1
- package/dist/q2-tecton-elements/{p-df182f61.entry.js → p-fdfbe75b.entry.js} +1 -1
- package/dist/q2-tecton-elements/p-ffbded54.entry.js +1 -0
- package/dist/q2-tecton-elements/q2-tecton-elements.esm.js +1 -1
- package/dist/test/elements/q2-tag-test.js +151 -0
- package/dist/test/helpers.js +20 -9
- package/dist/types/components/q2-badge/index.d.ts +13 -0
- package/dist/types/components/q2-btn/index.d.ts +3 -3
- package/dist/types/components/q2-calendar/helpers.d.ts +1 -0
- package/dist/types/components/q2-calendar/index.d.ts +2 -1
- package/dist/types/components/q2-calendar/validation.d.ts +1 -1
- package/dist/types/components/q2-card/index.d.ts +35 -0
- package/dist/types/components/q2-checkbox/index.d.ts +3 -1
- package/dist/types/components/q2-checkbox-group/index.d.ts +1 -0
- package/dist/types/components/q2-dropdown/index.d.ts +1 -1
- package/dist/types/components/q2-editable-field/index.d.ts +1 -1
- package/dist/types/components/q2-input/formatting/credit-card.d.ts +1 -3
- package/dist/types/components/q2-input/index.d.ts +5 -2
- package/dist/types/components/q2-option/index.d.ts +2 -3
- package/dist/types/components/q2-option-list/index.d.ts +62 -0
- package/dist/types/components/q2-pagination/index.d.ts +30 -0
- package/dist/types/components/q2-pill/index.d.ts +39 -0
- package/dist/types/components/q2-radio/index.d.ts +4 -1
- package/dist/types/components/q2-radio-group/index.d.ts +5 -1
- package/dist/types/components/q2-select/index.d.ts +2 -1
- package/dist/types/components/q2-stepper/index.d.ts +1 -1
- package/dist/types/components/q2-stepper-pane/index.d.ts +16 -1
- package/dist/types/components/q2-stepper-vertical/index.d.ts +52 -0
- package/dist/types/components/q2-tab-container/index.d.ts +1 -1
- package/dist/types/components/q2-tag/index.d.ts +28 -0
- package/dist/types/components/tecton-tab-pane/index.d.ts +2 -2
- package/dist/types/components.d.ts +235 -11
- package/dist/types/global.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +6 -4
- package/dist/types/util.d.ts +2 -10
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/workspace/workspace/tecton-production_release_1.13.x/packages/q2-tecton-elements/.stencil/test/elements/q2-tag-test.d.ts +1 -0
- package/dist/types/workspace/workspace/{_production_release_1.11.0-alpha → tecton-production_release_1.13.x}/packages/q2-tecton-elements/.stencil/test/helpers.d.ts +6 -3
- package/package.json +13 -13
- package/dist/q2-tecton-elements/p-06fff43d.entry.js +0 -1
- package/dist/q2-tecton-elements/p-080839ed.js +0 -1
- package/dist/q2-tecton-elements/p-29a37091.entry.js +0 -1
- package/dist/q2-tecton-elements/p-37aba2a4.js +0 -1
- package/dist/q2-tecton-elements/p-4cd00f1a.js +0 -1
- package/dist/q2-tecton-elements/p-6702eb4d.entry.js +0 -1
- package/dist/q2-tecton-elements/p-768e3a5d.entry.js +0 -1
- package/dist/q2-tecton-elements/p-843b1ee9.entry.js +0 -1
- package/dist/q2-tecton-elements/p-943c7745.entry.js +0 -1
- package/dist/q2-tecton-elements/p-95a73559.entry.js +0 -1
- package/dist/q2-tecton-elements/p-9a977ee6.entry.js +0 -1
- package/dist/q2-tecton-elements/p-b281c349.entry.js +0 -1
- package/dist/q2-tecton-elements/p-c5e55b9f.entry.js +0 -1
- package/dist/q2-tecton-elements/p-ccbe9158.entry.js +0 -1
- package/dist/q2-tecton-elements/p-db6f90ac.entry.js +0 -1
- package/dist/q2-tecton-elements/p-fa6eea5c.entry.js +0 -1
|
@@ -1,15 +1,50 @@
|
|
|
1
|
-
import { Component, Prop, h, Element } from '@stencil/core';
|
|
2
|
-
import { createGuid, loc } from 'src/utils';
|
|
1
|
+
import { Component, Prop, h, Element, Fragment, Event, Watch, Listen, State, } from '@stencil/core';
|
|
2
|
+
import { createGuid, loc, nextPaint } from 'src/utils';
|
|
3
3
|
export class Q2StepperPane {
|
|
4
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
this.isChildActive = false;
|
|
6
|
+
}
|
|
7
|
+
/// LifeCycle Hooks ///
|
|
5
8
|
connectedCallback() {
|
|
6
9
|
if (!this.hostElement.id)
|
|
7
10
|
this.hostElement.id = `step-${createGuid()}`;
|
|
8
11
|
}
|
|
12
|
+
componentWillLoad() {
|
|
13
|
+
this.checkForActiveChildren();
|
|
14
|
+
}
|
|
15
|
+
/// Watchers and Listeners ///
|
|
16
|
+
statusChanged(status) {
|
|
17
|
+
this.statusChange.emit({
|
|
18
|
+
status,
|
|
19
|
+
isActive: !!this.isActive,
|
|
20
|
+
id: this.hostElement.id,
|
|
21
|
+
host: this.hostElement,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
isActiveChanged(isActive) {
|
|
25
|
+
this.activeChange.emit({
|
|
26
|
+
status: this.status || '',
|
|
27
|
+
isActive,
|
|
28
|
+
id: this.hostElement.id,
|
|
29
|
+
host: this.hostElement,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
checkForActiveChildren() {
|
|
33
|
+
if (!this.showWithChildren)
|
|
34
|
+
return;
|
|
35
|
+
nextPaint(() => {
|
|
36
|
+
setTimeout(() => {
|
|
37
|
+
this.isChildActive = !!this.hostElement.querySelector("[slot='children'] > q2-stepper-pane[is-active]");
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/// DOM ///
|
|
9
42
|
render() {
|
|
10
43
|
const { label, description, isActive } = this;
|
|
11
|
-
return (h(
|
|
12
|
-
h("
|
|
44
|
+
return (h(Fragment, null,
|
|
45
|
+
h("div", { role: "tabpanel", "aria-label": label && loc(label), "aria-description": description && loc(description), tabindex: "0", hidden: !isActive && !(this.isChildActive && this.showWithChildren) },
|
|
46
|
+
h("slot", null)),
|
|
47
|
+
h("slot", { name: "children" })));
|
|
13
48
|
}
|
|
14
49
|
static get is() { return "q2-stepper-pane"; }
|
|
15
50
|
static get encapsulation() { return "shadow"; }
|
|
@@ -70,7 +105,100 @@ export class Q2StepperPane {
|
|
|
70
105
|
},
|
|
71
106
|
"attribute": "is-active",
|
|
72
107
|
"reflect": true
|
|
108
|
+
},
|
|
109
|
+
"showWithChildren": {
|
|
110
|
+
"type": "boolean",
|
|
111
|
+
"mutable": false,
|
|
112
|
+
"complexType": {
|
|
113
|
+
"original": "boolean",
|
|
114
|
+
"resolved": "boolean",
|
|
115
|
+
"references": {}
|
|
116
|
+
},
|
|
117
|
+
"required": false,
|
|
118
|
+
"optional": false,
|
|
119
|
+
"docs": {
|
|
120
|
+
"tags": [],
|
|
121
|
+
"text": ""
|
|
122
|
+
},
|
|
123
|
+
"attribute": "show-with-children",
|
|
124
|
+
"reflect": true
|
|
125
|
+
},
|
|
126
|
+
"status": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"mutable": false,
|
|
129
|
+
"complexType": {
|
|
130
|
+
"original": "'complete' | 'error' | 'locked'",
|
|
131
|
+
"resolved": "\"complete\" | \"error\" | \"locked\"",
|
|
132
|
+
"references": {}
|
|
133
|
+
},
|
|
134
|
+
"required": false,
|
|
135
|
+
"optional": false,
|
|
136
|
+
"docs": {
|
|
137
|
+
"tags": [],
|
|
138
|
+
"text": ""
|
|
139
|
+
},
|
|
140
|
+
"attribute": "status",
|
|
141
|
+
"reflect": true
|
|
73
142
|
}
|
|
74
143
|
}; }
|
|
144
|
+
static get states() { return {
|
|
145
|
+
"isChildActive": {}
|
|
146
|
+
}; }
|
|
147
|
+
static get events() { return [{
|
|
148
|
+
"method": "statusChange",
|
|
149
|
+
"name": "statusChange",
|
|
150
|
+
"bubbles": true,
|
|
151
|
+
"cancelable": true,
|
|
152
|
+
"composed": true,
|
|
153
|
+
"docs": {
|
|
154
|
+
"tags": [],
|
|
155
|
+
"text": ""
|
|
156
|
+
},
|
|
157
|
+
"complexType": {
|
|
158
|
+
"original": "IStepperPaneEvent",
|
|
159
|
+
"resolved": "IStepperPaneEvent",
|
|
160
|
+
"references": {
|
|
161
|
+
"IStepperPaneEvent": {
|
|
162
|
+
"location": "local"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}, {
|
|
167
|
+
"method": "activeChange",
|
|
168
|
+
"name": "activeChange",
|
|
169
|
+
"bubbles": true,
|
|
170
|
+
"cancelable": true,
|
|
171
|
+
"composed": true,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": ""
|
|
175
|
+
},
|
|
176
|
+
"complexType": {
|
|
177
|
+
"original": "IStepperPaneEvent",
|
|
178
|
+
"resolved": "IStepperPaneEvent",
|
|
179
|
+
"references": {
|
|
180
|
+
"IStepperPaneEvent": {
|
|
181
|
+
"location": "local"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}]; }
|
|
75
186
|
static get elementRef() { return "hostElement"; }
|
|
187
|
+
static get watchers() { return [{
|
|
188
|
+
"propName": "status",
|
|
189
|
+
"methodName": "statusChanged"
|
|
190
|
+
}, {
|
|
191
|
+
"propName": "isActive",
|
|
192
|
+
"methodName": "isActiveChanged"
|
|
193
|
+
}, {
|
|
194
|
+
"propName": "showWithChildren",
|
|
195
|
+
"methodName": "checkForActiveChildren"
|
|
196
|
+
}]; }
|
|
197
|
+
static get listeners() { return [{
|
|
198
|
+
"name": "activeChange",
|
|
199
|
+
"method": "checkForActiveChildren",
|
|
200
|
+
"target": undefined,
|
|
201
|
+
"capture": false,
|
|
202
|
+
"passive": false
|
|
203
|
+
}]; }
|
|
76
204
|
}
|
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
import { Component, Prop, h, Element, State, Watch, Listen, Event, Fragment, } from '@stencil/core';
|
|
2
|
+
import { loc, overrideFocus, isEventFromElement, createGuid } from 'src/utils';
|
|
3
|
+
export class Q2AdvancedStepper {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.structuredPanes = [];
|
|
6
|
+
this.scheduledAfterRender = [];
|
|
7
|
+
this.determinePaneChanges = (mutations) => {
|
|
8
|
+
mutations.forEach(mutation => {
|
|
9
|
+
var _a, _b;
|
|
10
|
+
if (mutation.type !== 'childList')
|
|
11
|
+
return;
|
|
12
|
+
if (!mutation.addedNodes.length && !mutation.removedNodes.length)
|
|
13
|
+
return;
|
|
14
|
+
if (((_a = mutation.addedNodes[0]) === null || _a === void 0 ? void 0 : _a.nodeType) !== Node.ELEMENT_NODE &&
|
|
15
|
+
((_b = mutation.removedNodes[0]) === null || _b === void 0 ? void 0 : _b.nodeType) !== Node.ELEMENT_NODE)
|
|
16
|
+
return;
|
|
17
|
+
this.buildPaneList();
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
this.buildPaneList = () => {
|
|
21
|
+
const { allRootPanes } = this;
|
|
22
|
+
if (!allRootPanes.length)
|
|
23
|
+
return;
|
|
24
|
+
this.structuredPanes = Array.from(allRootPanes).reduce((accum, pane) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const children = Array.from((_b = (_a = pane.querySelector('[slot=children]')) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [])
|
|
27
|
+
.filter(({ tagName }) => tagName === 'Q2-STEPPER-PANE')
|
|
28
|
+
.map(this.extractDetails);
|
|
29
|
+
accum.push(Object.assign(Object.assign({}, this.extractDetails(pane)), { children }));
|
|
30
|
+
return accum;
|
|
31
|
+
}, []);
|
|
32
|
+
};
|
|
33
|
+
/// Event Handlers ///
|
|
34
|
+
this.onStepClick = (event, stepId) => {
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
const { currentStepId } = this;
|
|
37
|
+
if (stepId === currentStepId)
|
|
38
|
+
return;
|
|
39
|
+
const selectedStep = this.allPanes.find(pane => pane.id === stepId);
|
|
40
|
+
this.change.emit({
|
|
41
|
+
selectedStep,
|
|
42
|
+
selectedStepId: stepId,
|
|
43
|
+
currentStepId,
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
this.onStepKeyDown = (event, stepId) => {
|
|
47
|
+
const { key } = event;
|
|
48
|
+
let selectedStepId;
|
|
49
|
+
switch (key) {
|
|
50
|
+
case 'ArrowUp':
|
|
51
|
+
case 'ArrowLeft':
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
selectedStepId = this.getStepId(stepId, 'prev');
|
|
54
|
+
break;
|
|
55
|
+
case 'ArrowDown':
|
|
56
|
+
case 'ArrowRight':
|
|
57
|
+
event.preventDefault();
|
|
58
|
+
selectedStepId = this.getStepId(stepId, 'next');
|
|
59
|
+
break;
|
|
60
|
+
case 'Home':
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
selectedStepId = this.getStepId(stepId, 'first');
|
|
63
|
+
break;
|
|
64
|
+
case 'End':
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
selectedStepId = this.getStepId(stepId, 'last');
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
if (!selectedStepId)
|
|
70
|
+
return;
|
|
71
|
+
this.focusStepBtn(selectedStepId, true);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/// LifeCycle Hooks ///
|
|
75
|
+
componentWillLoad() {
|
|
76
|
+
this.setDefaultPane();
|
|
77
|
+
this.buildPaneList();
|
|
78
|
+
const observer = new MutationObserver(this.determinePaneChanges);
|
|
79
|
+
const observerOptions = {
|
|
80
|
+
childList: true,
|
|
81
|
+
};
|
|
82
|
+
observer.observe(this.hostElement, observerOptions);
|
|
83
|
+
this.allRootPanes.forEach(pane => {
|
|
84
|
+
const childrenSlot = pane.querySelector('[slot=children]');
|
|
85
|
+
if (childrenSlot)
|
|
86
|
+
observer.observe(childrenSlot, observerOptions);
|
|
87
|
+
});
|
|
88
|
+
this.mutationObserver = observer;
|
|
89
|
+
}
|
|
90
|
+
componentDidLoad() {
|
|
91
|
+
overrideFocus(this.hostElement);
|
|
92
|
+
setTimeout(() => this.showStep(this.currentStepId), 0);
|
|
93
|
+
}
|
|
94
|
+
componentWillUpdate() {
|
|
95
|
+
this.expandedStepChildrenList = null;
|
|
96
|
+
}
|
|
97
|
+
componentDidRender() {
|
|
98
|
+
this.scheduledAfterRender.forEach(fn => fn());
|
|
99
|
+
this.scheduledAfterRender = [];
|
|
100
|
+
this.openCurrentStepChildren();
|
|
101
|
+
}
|
|
102
|
+
disconnectedCallback() {
|
|
103
|
+
this.mutationObserver.disconnect();
|
|
104
|
+
this.mutationObserver = null;
|
|
105
|
+
}
|
|
106
|
+
/// Getters ///
|
|
107
|
+
get allRootPanes() {
|
|
108
|
+
return Array.from(this.hostElement.querySelectorAll(':scope > q2-stepper-pane'));
|
|
109
|
+
}
|
|
110
|
+
get allPanes() {
|
|
111
|
+
return Array.from(this.hostElement.querySelectorAll('q2-stepper-pane'));
|
|
112
|
+
}
|
|
113
|
+
/// Helpers ///
|
|
114
|
+
setDefaultPane() {
|
|
115
|
+
if (this.currentStepId)
|
|
116
|
+
return;
|
|
117
|
+
const firstEnabledStep = this.hostElement.querySelector('q2-stepper-pane');
|
|
118
|
+
if (!firstEnabledStep)
|
|
119
|
+
return;
|
|
120
|
+
if (!firstEnabledStep.id)
|
|
121
|
+
firstEnabledStep.id = `step-${createGuid()}`;
|
|
122
|
+
this.currentStepId = firstEnabledStep.id;
|
|
123
|
+
}
|
|
124
|
+
getStepId(currentStepId, goTo) {
|
|
125
|
+
const allEnabledStepBtns = Array.from(this.hostElement.shadowRoot.querySelectorAll('ul:not([aria-hidden="true"]) > li > button:not([aria-disabled="true"])'));
|
|
126
|
+
const currentStepIndex = allEnabledStepBtns.findIndex(btn => btn.getAttribute('aria-controls') === currentStepId);
|
|
127
|
+
let nextStepIndex;
|
|
128
|
+
switch (goTo) {
|
|
129
|
+
case 'prev':
|
|
130
|
+
nextStepIndex = Math.max(currentStepIndex - 1, 0);
|
|
131
|
+
break;
|
|
132
|
+
case 'next':
|
|
133
|
+
nextStepIndex = Math.min(currentStepIndex + 1, allEnabledStepBtns.length - 1);
|
|
134
|
+
break;
|
|
135
|
+
case 'first':
|
|
136
|
+
nextStepIndex = 0;
|
|
137
|
+
break;
|
|
138
|
+
case 'last':
|
|
139
|
+
nextStepIndex = allEnabledStepBtns.length - 1;
|
|
140
|
+
break;
|
|
141
|
+
}
|
|
142
|
+
return allEnabledStepBtns[nextStepIndex].getAttribute('aria-controls');
|
|
143
|
+
}
|
|
144
|
+
showStep(stepId) {
|
|
145
|
+
this.scheduledAfterRender.push(this.resizeIframe);
|
|
146
|
+
this.showStepPane(stepId);
|
|
147
|
+
this.focusStepBtn(stepId);
|
|
148
|
+
}
|
|
149
|
+
extractDetails(pane) {
|
|
150
|
+
const { label, description, status } = pane;
|
|
151
|
+
if (!pane.id)
|
|
152
|
+
pane.id = `step-${createGuid()}`;
|
|
153
|
+
return {
|
|
154
|
+
id: pane.id,
|
|
155
|
+
label,
|
|
156
|
+
description,
|
|
157
|
+
status,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
resizeIframe() {
|
|
161
|
+
var _a, _b;
|
|
162
|
+
return (_b = (_a = window === null || window === void 0 ? void 0 : window.TectonElements) === null || _a === void 0 ? void 0 : _a.resizeIframe) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
163
|
+
}
|
|
164
|
+
openCurrentStepChildren() {
|
|
165
|
+
const { expandedStepChildrenList } = this;
|
|
166
|
+
const allSpacers = this.hostElement.shadowRoot.querySelectorAll('.spacer');
|
|
167
|
+
allSpacers.forEach(spacer => {
|
|
168
|
+
if (expandedStepChildrenList && spacer.contains(expandedStepChildrenList)) {
|
|
169
|
+
spacer.style.height = `${expandedStepChildrenList.clientHeight}px`;
|
|
170
|
+
if (spacer.classList.contains('is-open'))
|
|
171
|
+
return;
|
|
172
|
+
spacer.classList.add('is-opening');
|
|
173
|
+
spacer.addEventListener('transitionend', () => {
|
|
174
|
+
spacer.classList.remove('is-opening');
|
|
175
|
+
spacer.classList.add('is-open');
|
|
176
|
+
}, { once: true });
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
spacer.removeAttribute('style');
|
|
180
|
+
spacer.classList.remove('is-open', 'is-opening');
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
showStepPane(stepId) {
|
|
185
|
+
this.allPanes.forEach(pane => {
|
|
186
|
+
if (pane.isActive || pane.id === stepId) {
|
|
187
|
+
pane.isActive = stepId === pane.id;
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
focusStepBtn(stepId, forceFocus) {
|
|
192
|
+
const stepBtn = this.hostElement.shadowRoot.querySelector(`button[aria-controls="${stepId}"]`);
|
|
193
|
+
const isComponentActive = document.activeElement === this.hostElement;
|
|
194
|
+
if (!stepBtn)
|
|
195
|
+
return;
|
|
196
|
+
if (isComponentActive || forceFocus) {
|
|
197
|
+
stepBtn.focus();
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/// Listeners ///
|
|
201
|
+
defaultChangeHandler(event) {
|
|
202
|
+
const { hostElement } = this;
|
|
203
|
+
if (event.target === hostElement && !hostElement.getAttribute('onchange') && !!event.detail) {
|
|
204
|
+
this.currentStepId = event.detail.selectedStepId;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
delegateFocus(event) {
|
|
208
|
+
if (!isEventFromElement(event, this.hostElement))
|
|
209
|
+
return;
|
|
210
|
+
this.focusStepBtn(this.currentStepId, true);
|
|
211
|
+
}
|
|
212
|
+
statusChangeHandler() {
|
|
213
|
+
this.buildPaneList();
|
|
214
|
+
}
|
|
215
|
+
/// Watchers ///
|
|
216
|
+
currentStepChanged(stepId) {
|
|
217
|
+
this.showStep(stepId);
|
|
218
|
+
}
|
|
219
|
+
/// DOM ///
|
|
220
|
+
renderStepBtn(pane, index) {
|
|
221
|
+
const { currentStepId, structuredPanes } = this;
|
|
222
|
+
const isLastStep = index === structuredPanes.length - 1;
|
|
223
|
+
const { id, label, description, status } = pane;
|
|
224
|
+
const stepNumber = index + 1;
|
|
225
|
+
const isCurrentStep = id === currentStepId;
|
|
226
|
+
const labelId = label && `label-${id}`;
|
|
227
|
+
const isLocked = status === 'locked';
|
|
228
|
+
const stepLabel = label && loc(label);
|
|
229
|
+
const descriptionId = label && description && `description-${id}`;
|
|
230
|
+
const btnLabel = !label && loc('tecton.element.advancedStepper.number', [`${stepNumber}`, `${structuredPanes.length}`]);
|
|
231
|
+
let statusIcon;
|
|
232
|
+
if (status === 'complete')
|
|
233
|
+
statusIcon = 'success';
|
|
234
|
+
else if (status === 'error')
|
|
235
|
+
statusIcon = 'warning';
|
|
236
|
+
const stepClasses = ['step-btn'];
|
|
237
|
+
if (status)
|
|
238
|
+
stepClasses.push(`status-${status}`);
|
|
239
|
+
const childIds = pane.children.map(child => child.id);
|
|
240
|
+
const isExpanded = isCurrentStep || childIds.includes(currentStepId);
|
|
241
|
+
return (h("li", { role: "presentation" },
|
|
242
|
+
h("button", { class: stepClasses.join(' '), type: "button", "aria-labelledby": labelId, "aria-describedBy": descriptionId, "aria-label": btnLabel, "aria-selected": `${isCurrentStep}`, "aria-expanded": !!pane.children.length ? `${isExpanded}` : null, "aria-controls": id, "aria-disabled": isLocked ? 'true' : null, role: "tab", tabIndex: isCurrentStep ? 0 : -1, onKeyDown: ev => !isLocked && this.onStepKeyDown(ev, id), onClick: ev => !isLocked && this.onStepClick(ev, id) },
|
|
243
|
+
statusIcon ? (h("div", { class: "step-icon" },
|
|
244
|
+
h("q2-icon", { type: statusIcon }))) : (h("div", { class: "step-bubble" }, stepNumber)),
|
|
245
|
+
label && (h("div", null,
|
|
246
|
+
h("div", { class: "step-label", id: labelId }, stepLabel),
|
|
247
|
+
description && (h("div", { class: "step-description", id: descriptionId }, loc(description)))))),
|
|
248
|
+
((isLastStep && !!pane.children.length) || !isLastStep) && (h("div", { class: "spacer" }, !!pane.children.length && (h("ul", { ref: el => isExpanded && (this.expandedStepChildrenList = el), "aria-hidden": `${!isExpanded}` }, pane.children.map((child, index, children) => this.renderChildStepBtn(child, index, children.length, stepLabel))))))));
|
|
249
|
+
}
|
|
250
|
+
renderChildStepBtn(pane, index, children, parentLabel) {
|
|
251
|
+
const { currentStepId } = this;
|
|
252
|
+
const { id, label, status } = pane;
|
|
253
|
+
const stepNumber = index + 1;
|
|
254
|
+
const labelId = label && `label-${id}`;
|
|
255
|
+
const isCurrentStep = id === currentStepId;
|
|
256
|
+
const isLocked = status === 'locked';
|
|
257
|
+
const btnLabel = !label && loc('tecton.element.advancedStepper.childNumber', [`${stepNumber}`, `${children}`, parentLabel]);
|
|
258
|
+
let statusIcon;
|
|
259
|
+
if (status === 'error')
|
|
260
|
+
statusIcon = 'warning';
|
|
261
|
+
const stepClasses = ['step-child-btn'];
|
|
262
|
+
if (status)
|
|
263
|
+
stepClasses.push(`status-${status}`);
|
|
264
|
+
return (h("li", { role: "presentation" },
|
|
265
|
+
h("button", { class: stepClasses.join(' '), type: "button", "aria-labelledby": labelId, "aria-label": btnLabel, "aria-selected": `${isCurrentStep}`, "aria-controls": id, "aria-disabled": isLocked ? 'true' : null, role: "tab", tabIndex: isCurrentStep ? 0 : -1, onKeyDown: ev => !isLocked && this.onStepKeyDown(ev, id), onClick: ev => !isLocked && this.onStepClick(ev, id) },
|
|
266
|
+
statusIcon && (h("div", { class: "step-child-icon" },
|
|
267
|
+
h("q2-icon", { type: statusIcon }))),
|
|
268
|
+
label && (h("div", { class: "step-child-label", id: labelId }, loc(label))))));
|
|
269
|
+
}
|
|
270
|
+
render() {
|
|
271
|
+
return (h(Fragment, null,
|
|
272
|
+
h("ul", { role: "tablist" }, this.structuredPanes.map((pane, index) => this.renderStepBtn(pane, index))),
|
|
273
|
+
h("div", null,
|
|
274
|
+
h("slot", null))));
|
|
275
|
+
}
|
|
276
|
+
static get is() { return "q2-stepper-vertical"; }
|
|
277
|
+
static get encapsulation() { return "shadow"; }
|
|
278
|
+
static get originalStyleUrls() { return {
|
|
279
|
+
"$": ["styles.scss"]
|
|
280
|
+
}; }
|
|
281
|
+
static get styleUrls() { return {
|
|
282
|
+
"$": ["styles.css"]
|
|
283
|
+
}; }
|
|
284
|
+
static get properties() { return {
|
|
285
|
+
"currentStepId": {
|
|
286
|
+
"type": "string",
|
|
287
|
+
"mutable": true,
|
|
288
|
+
"complexType": {
|
|
289
|
+
"original": "string",
|
|
290
|
+
"resolved": "string",
|
|
291
|
+
"references": {}
|
|
292
|
+
},
|
|
293
|
+
"required": false,
|
|
294
|
+
"optional": false,
|
|
295
|
+
"docs": {
|
|
296
|
+
"tags": [],
|
|
297
|
+
"text": ""
|
|
298
|
+
},
|
|
299
|
+
"attribute": "current-step-id",
|
|
300
|
+
"reflect": true
|
|
301
|
+
}
|
|
302
|
+
}; }
|
|
303
|
+
static get states() { return {
|
|
304
|
+
"structuredPanes": {}
|
|
305
|
+
}; }
|
|
306
|
+
static get events() { return [{
|
|
307
|
+
"method": "change",
|
|
308
|
+
"name": "change",
|
|
309
|
+
"bubbles": true,
|
|
310
|
+
"cancelable": true,
|
|
311
|
+
"composed": true,
|
|
312
|
+
"docs": {
|
|
313
|
+
"tags": [],
|
|
314
|
+
"text": ""
|
|
315
|
+
},
|
|
316
|
+
"complexType": {
|
|
317
|
+
"original": "any",
|
|
318
|
+
"resolved": "any",
|
|
319
|
+
"references": {}
|
|
320
|
+
}
|
|
321
|
+
}]; }
|
|
322
|
+
static get elementRef() { return "hostElement"; }
|
|
323
|
+
static get watchers() { return [{
|
|
324
|
+
"propName": "currentStepId",
|
|
325
|
+
"methodName": "currentStepChanged"
|
|
326
|
+
}]; }
|
|
327
|
+
static get listeners() { return [{
|
|
328
|
+
"name": "change",
|
|
329
|
+
"method": "defaultChangeHandler",
|
|
330
|
+
"target": undefined,
|
|
331
|
+
"capture": false,
|
|
332
|
+
"passive": false
|
|
333
|
+
}, {
|
|
334
|
+
"name": "focus",
|
|
335
|
+
"method": "delegateFocus",
|
|
336
|
+
"target": undefined,
|
|
337
|
+
"capture": false,
|
|
338
|
+
"passive": false
|
|
339
|
+
}, {
|
|
340
|
+
"name": "statusChange",
|
|
341
|
+
"method": "statusChangeHandler",
|
|
342
|
+
"target": undefined,
|
|
343
|
+
"capture": false,
|
|
344
|
+
"passive": false
|
|
345
|
+
}]; }
|
|
346
|
+
}
|