q2-tecton-elements 1.54.3 → 1.54.4
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/bundle-report.json +94 -13
- package/dist/cjs/q2-dropdown-item.cjs.entry.js +21 -2
- package/dist/cjs/q2-dropdown-item.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-option-list_2.cjs.entry.js +7 -5
- package/dist/cjs/q2-option-list_2.cjs.entry.js.map +1 -1
- package/dist/cjs/q2-option.cjs.entry.js +15 -1
- package/dist/cjs/q2-option.cjs.entry.js.map +1 -1
- package/dist/collection/components/q2-dropdown/test/q2-dropdown-test.e2e.js +38 -2
- package/dist/collection/components/q2-dropdown/test/q2-dropdown-test.e2e.js.map +1 -1
- package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.js +21 -2
- package/dist/collection/components/q2-dropdown-item/q2-dropdown-item.js.map +1 -1
- package/dist/collection/components/q2-dropdown-item/test/q2-dropdown-item-test.e2e.js +43 -2
- package/dist/collection/components/q2-dropdown-item/test/q2-dropdown-item-test.e2e.js.map +1 -1
- package/dist/collection/components/q2-option/q2-option.js +29 -1
- package/dist/collection/components/q2-option/q2-option.js.map +1 -1
- package/dist/collection/components/q2-option/test/q2-option-test.e2e.js +33 -114
- package/dist/collection/components/q2-option/test/q2-option-test.e2e.js.map +1 -1
- package/dist/collection/components/q2-option-list/q2-option-list.js +7 -5
- package/dist/collection/components/q2-option-list/q2-option-list.js.map +1 -1
- package/dist/collection/utils/mirror-emit.js +19 -0
- package/dist/collection/utils/mirror-emit.js.map +1 -0
- package/dist/components/q2-dropdown-item2.js +21 -2
- package/dist/components/q2-dropdown-item2.js.map +1 -1
- package/dist/components/q2-option-list2.js +7 -5
- package/dist/components/q2-option-list2.js.map +1 -1
- package/dist/components/q2-option2.js +15 -1
- package/dist/components/q2-option2.js.map +1 -1
- package/dist/esm/q2-dropdown-item.entry.js +21 -2
- package/dist/esm/q2-dropdown-item.entry.js.map +1 -1
- package/dist/esm/q2-option-list_2.entry.js +7 -5
- package/dist/esm/q2-option-list_2.entry.js.map +1 -1
- package/dist/esm/q2-option.entry.js +15 -1
- package/dist/esm/q2-option.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-dropdown-item.entry.js +23 -6
- package/dist/q2-tecton-elements/q2-dropdown-item.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js +29 -23
- package/dist/q2-tecton-elements/q2-option-list_2.entry.js.map +1 -1
- package/dist/q2-tecton-elements/q2-option.entry.js +35 -15
- package/dist/q2-tecton-elements/q2-option.entry.js.map +1 -1
- package/dist/types/components/q2-dropdown-item/q2-dropdown-item.d.ts +8 -0
- package/dist/types/components/q2-option/q2-option.d.ts +7 -0
- package/dist/types/components.d.ts +11 -0
- package/dist/types/utils/mirror-emit.d.ts +11 -0
- package/package.json +3 -3
package/dist/bundle-report.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2025-05-
|
|
2
|
+
"timestamp": "2025-05-21T19:30:42",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "node",
|
|
5
5
|
"version": "20.18.1"
|
|
@@ -9,11 +9,11 @@
|
|
|
9
9
|
"fsNamespace": "q2-tecton-elements",
|
|
10
10
|
"components": 56,
|
|
11
11
|
"entries": 56,
|
|
12
|
-
"bundles":
|
|
12
|
+
"bundles": 916,
|
|
13
13
|
"outputs": [
|
|
14
14
|
{
|
|
15
15
|
"name": "dist-collection",
|
|
16
|
-
"files":
|
|
16
|
+
"files": 336,
|
|
17
17
|
"generatedFiles": [
|
|
18
18
|
"./dist/collection/components/click-elsewhere/click-elsewhere.js",
|
|
19
19
|
"./dist/collection/components/click-elsewhere/click-elsewhere.js.map",
|
|
@@ -341,6 +341,8 @@
|
|
|
341
341
|
"./dist/collection/utils/helpers.js.map",
|
|
342
342
|
"./dist/collection/utils/index.js",
|
|
343
343
|
"./dist/collection/utils/index.js.map",
|
|
344
|
+
"./dist/collection/utils/mirror-emit.js",
|
|
345
|
+
"./dist/collection/utils/mirror-emit.js.map",
|
|
344
346
|
"./dist/collection/utils/sanitize-html-string.js",
|
|
345
347
|
"./dist/collection/utils/sanitize-html-string.js.map",
|
|
346
348
|
"./dist/collection/utils/sanitize-regex-string.js",
|
|
@@ -1466,7 +1468,7 @@
|
|
|
1466
1468
|
"index-7a5365e2.js",
|
|
1467
1469
|
"index-504f1a9e.js"
|
|
1468
1470
|
],
|
|
1469
|
-
"originalByteSize":
|
|
1471
|
+
"originalByteSize": 8402
|
|
1470
1472
|
},
|
|
1471
1473
|
{
|
|
1472
1474
|
"key": "q2-item.q2-link.q2-list.entry",
|
|
@@ -1558,7 +1560,7 @@
|
|
|
1558
1560
|
"index-7a5365e2.js",
|
|
1559
1561
|
"index-504f1a9e.js"
|
|
1560
1562
|
],
|
|
1561
|
-
"originalByteSize":
|
|
1563
|
+
"originalByteSize": 7450
|
|
1562
1564
|
},
|
|
1563
1565
|
{
|
|
1564
1566
|
"key": "q2-option-list.q2-popover.entry",
|
|
@@ -1572,7 +1574,7 @@
|
|
|
1572
1574
|
"index-7a5365e2.js",
|
|
1573
1575
|
"index-504f1a9e.js"
|
|
1574
1576
|
],
|
|
1575
|
-
"originalByteSize":
|
|
1577
|
+
"originalByteSize": 42276
|
|
1576
1578
|
},
|
|
1577
1579
|
{
|
|
1578
1580
|
"key": "click-elsewhere.entry",
|
|
@@ -2094,7 +2096,7 @@
|
|
|
2094
2096
|
"index-7a5365e2.js",
|
|
2095
2097
|
"index-504f1a9e.js"
|
|
2096
2098
|
],
|
|
2097
|
-
"originalByteSize":
|
|
2099
|
+
"originalByteSize": 8402
|
|
2098
2100
|
},
|
|
2099
2101
|
{
|
|
2100
2102
|
"key": "q2-item.q2-link.q2-list.entry",
|
|
@@ -2186,7 +2188,7 @@
|
|
|
2186
2188
|
"index-7a5365e2.js",
|
|
2187
2189
|
"index-504f1a9e.js"
|
|
2188
2190
|
],
|
|
2189
|
-
"originalByteSize":
|
|
2191
|
+
"originalByteSize": 7450
|
|
2190
2192
|
},
|
|
2191
2193
|
{
|
|
2192
2194
|
"key": "q2-option-list.q2-popover.entry",
|
|
@@ -2200,7 +2202,7 @@
|
|
|
2200
2202
|
"index-7a5365e2.js",
|
|
2201
2203
|
"index-504f1a9e.js"
|
|
2202
2204
|
],
|
|
2203
|
-
"originalByteSize":
|
|
2205
|
+
"originalByteSize": 42276
|
|
2204
2206
|
},
|
|
2205
2207
|
{
|
|
2206
2208
|
"key": "click-elsewhere.entry",
|
|
@@ -2724,7 +2726,7 @@
|
|
|
2724
2726
|
"index-e7e68b1e.js",
|
|
2725
2727
|
"index-76f63767.js"
|
|
2726
2728
|
],
|
|
2727
|
-
"originalByteSize":
|
|
2729
|
+
"originalByteSize": 8506
|
|
2728
2730
|
},
|
|
2729
2731
|
{
|
|
2730
2732
|
"key": "q2-item.q2-link.q2-list.entry",
|
|
@@ -2816,7 +2818,7 @@
|
|
|
2816
2818
|
"index-e7e68b1e.js",
|
|
2817
2819
|
"index-76f63767.js"
|
|
2818
2820
|
],
|
|
2819
|
-
"originalByteSize":
|
|
2821
|
+
"originalByteSize": 7560
|
|
2820
2822
|
},
|
|
2821
2823
|
{
|
|
2822
2824
|
"key": "q2-option-list.q2-popover.entry",
|
|
@@ -2830,7 +2832,7 @@
|
|
|
2830
2832
|
"index-e7e68b1e.js",
|
|
2831
2833
|
"index-76f63767.js"
|
|
2832
2834
|
],
|
|
2833
|
-
"originalByteSize":
|
|
2835
|
+
"originalByteSize": 42371
|
|
2834
2836
|
},
|
|
2835
2837
|
{
|
|
2836
2838
|
"key": "click-elsewhere.entry",
|
|
@@ -9529,6 +9531,27 @@
|
|
|
9529
9531
|
"bubbles": true,
|
|
9530
9532
|
"cancelable": true,
|
|
9531
9533
|
"composed": true,
|
|
9534
|
+
"docs": {
|
|
9535
|
+
"tags": [
|
|
9536
|
+
{
|
|
9537
|
+
"name": "deprecated"
|
|
9538
|
+
}
|
|
9539
|
+
],
|
|
9540
|
+
"text": "Is emitted when the item is clicked."
|
|
9541
|
+
},
|
|
9542
|
+
"complexType": {
|
|
9543
|
+
"original": "{ type: 'select' | 'remove'; value: string }",
|
|
9544
|
+
"resolved": "{ type: \"select\" | \"remove\"; value: string; }",
|
|
9545
|
+
"references": {}
|
|
9546
|
+
},
|
|
9547
|
+
"internal": false
|
|
9548
|
+
},
|
|
9549
|
+
{
|
|
9550
|
+
"name": "tctClick",
|
|
9551
|
+
"method": "tctClick",
|
|
9552
|
+
"bubbles": true,
|
|
9553
|
+
"cancelable": true,
|
|
9554
|
+
"composed": true,
|
|
9532
9555
|
"docs": {
|
|
9533
9556
|
"tags": [],
|
|
9534
9557
|
"text": "Is emitted when the item is clicked."
|
|
@@ -13490,6 +13513,23 @@
|
|
|
13490
13513
|
"references": {}
|
|
13491
13514
|
},
|
|
13492
13515
|
"internal": false
|
|
13516
|
+
},
|
|
13517
|
+
{
|
|
13518
|
+
"name": "tctClick",
|
|
13519
|
+
"method": "tctClick",
|
|
13520
|
+
"bubbles": true,
|
|
13521
|
+
"cancelable": true,
|
|
13522
|
+
"composed": true,
|
|
13523
|
+
"docs": {
|
|
13524
|
+
"tags": [],
|
|
13525
|
+
"text": "Is emitted when the option is clicked."
|
|
13526
|
+
},
|
|
13527
|
+
"complexType": {
|
|
13528
|
+
"original": "{ type: 'select' | 'remove'; value: string }",
|
|
13529
|
+
"resolved": "{ type: \"select\" | \"remove\"; value: string; }",
|
|
13530
|
+
"references": {}
|
|
13531
|
+
},
|
|
13532
|
+
"internal": false
|
|
13493
13533
|
}
|
|
13494
13534
|
],
|
|
13495
13535
|
"internal": false,
|
|
@@ -38940,6 +38980,27 @@
|
|
|
38940
38980
|
"bubbles": true,
|
|
38941
38981
|
"cancelable": true,
|
|
38942
38982
|
"composed": true,
|
|
38983
|
+
"docs": {
|
|
38984
|
+
"tags": [
|
|
38985
|
+
{
|
|
38986
|
+
"name": "deprecated"
|
|
38987
|
+
}
|
|
38988
|
+
],
|
|
38989
|
+
"text": "Is emitted when the item is clicked."
|
|
38990
|
+
},
|
|
38991
|
+
"complexType": {
|
|
38992
|
+
"original": "{ type: 'select' | 'remove'; value: string }",
|
|
38993
|
+
"resolved": "{ type: \"select\" | \"remove\"; value: string; }",
|
|
38994
|
+
"references": {}
|
|
38995
|
+
},
|
|
38996
|
+
"internal": false
|
|
38997
|
+
},
|
|
38998
|
+
{
|
|
38999
|
+
"name": "tctClick",
|
|
39000
|
+
"method": "tctClick",
|
|
39001
|
+
"bubbles": true,
|
|
39002
|
+
"cancelable": true,
|
|
39003
|
+
"composed": true,
|
|
38943
39004
|
"docs": {
|
|
38944
39005
|
"tags": [],
|
|
38945
39006
|
"text": "Is emitted when the item is clicked."
|
|
@@ -41725,6 +41786,23 @@
|
|
|
41725
41786
|
"references": {}
|
|
41726
41787
|
},
|
|
41727
41788
|
"internal": false
|
|
41789
|
+
},
|
|
41790
|
+
{
|
|
41791
|
+
"name": "tctClick",
|
|
41792
|
+
"method": "tctClick",
|
|
41793
|
+
"bubbles": true,
|
|
41794
|
+
"cancelable": true,
|
|
41795
|
+
"composed": true,
|
|
41796
|
+
"docs": {
|
|
41797
|
+
"tags": [],
|
|
41798
|
+
"text": "Is emitted when the option is clicked."
|
|
41799
|
+
},
|
|
41800
|
+
"complexType": {
|
|
41801
|
+
"original": "{ type: 'select' | 'remove'; value: string }",
|
|
41802
|
+
"resolved": "{ type: \"select\" | \"remove\"; value: string; }",
|
|
41803
|
+
"references": {}
|
|
41804
|
+
},
|
|
41805
|
+
"internal": false
|
|
41728
41806
|
}
|
|
41729
41807
|
],
|
|
41730
41808
|
"watchers": [
|
|
@@ -41800,7 +41878,7 @@
|
|
|
41800
41878
|
"hasVdomClass": true,
|
|
41801
41879
|
"hasVdomFunctional": false,
|
|
41802
41880
|
"hasVdomKey": false,
|
|
41803
|
-
"hasVdomListener":
|
|
41881
|
+
"hasVdomListener": true,
|
|
41804
41882
|
"hasVdomPropOrAttr": true,
|
|
41805
41883
|
"hasVdomRef": false,
|
|
41806
41884
|
"hasVdomRender": true,
|
|
@@ -41815,6 +41893,8 @@
|
|
|
41815
41893
|
"aria-selected",
|
|
41816
41894
|
"aria-hidden",
|
|
41817
41895
|
"display",
|
|
41896
|
+
"onClick",
|
|
41897
|
+
"onKeydown",
|
|
41818
41898
|
"type"
|
|
41819
41899
|
],
|
|
41820
41900
|
"htmlTagNames": [
|
|
@@ -43407,6 +43487,7 @@
|
|
|
43407
43487
|
"./src/utils"
|
|
43408
43488
|
],
|
|
43409
43489
|
"./src/utils/index.tsx": [],
|
|
43490
|
+
"./src/utils/mirror-emit.ts": [],
|
|
43410
43491
|
"./src/utils/sanitize-html-string.ts": [],
|
|
43411
43492
|
"./src/utils/sanitize-regex-string.ts": [],
|
|
43412
43493
|
"./src/utils/test/action-sheet-test.e2e.ts": [
|
|
@@ -5,6 +5,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
const index = require('./index-e7e68b1e.js');
|
|
6
6
|
const index$1 = require('./index-76f63767.js');
|
|
7
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Emits specified events from a given component context with the provided detail.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The type of the event detail. Defaults to the type of `CustomEvent['detail']`.
|
|
12
|
+
* @param context - The component context that contains the event emitters.
|
|
13
|
+
* @param events - An array of event names to be emitted.
|
|
14
|
+
* @param detail - The detail payload to be passed to each emitted event.
|
|
15
|
+
*/
|
|
16
|
+
const mirrorEmit = (context, events, detail) => {
|
|
17
|
+
events.forEach(event => {
|
|
18
|
+
var _a;
|
|
19
|
+
const eventEntry = context[event];
|
|
20
|
+
if (!eventEntry)
|
|
21
|
+
return;
|
|
22
|
+
(_a = eventEntry.emit) === null || _a === void 0 ? void 0 : _a.call(eventEntry, detail);
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
|
|
8
26
|
const q2DropdownItemCss = "*{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 #0066cc)}: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}.dropdown-separator{--comp-default-separator-margin:0 var(--tct-scale-1, var(--app-scale-3x, 15px));margin:var(--tct-dropdown-separator-margin, var(--t-dropdown-separator-margin, var(--comp-default-separator-margin)));border-bottom:1px solid var(--tct-dropdown-item-separator-color, var(--t-dropdown-item-separator-color, var(--tct-gray-11, var(--t-gray-11, var(--tct-gray-l1, var(--app-gray-l1, #cccccc))))))}.dropdown-item-wrapper{display:flex}.dropdown-item-button{--comp-dropdown-item-tween:var(--tct-tween-1, var(--app-tween-1, cubic-bezier(0.4, 0, 0.2, 1)));margin:var(--tct-scale-0, var(--app-scale-0x, 0));padding:var(--tct-scale-0, var(--app-scale-0x, 0));min-height:var(--tct-dropdown-item-min-height, 44px);min-width:44px;border:none;background:transparent;outline:0;transition:var(--tct-dropdown-item-tween, var(--comp-dropdown-item-tween));transition-property:background, color, box-shadow, fill, border-color, border-width}.dropdown-item-button:disabled{opacity:var(--tct-dropdown-item-disabled-opacity, var(--tct-disabled-opacity, var(--app-disabled-opacity, 0.4)));cursor:not-allowed}.dropdown-item{--comp-default-dropdown-item-padding:var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);flex:1;text-align:left;padding:var(--tct-dropdown-item-padding, var(--t-dropdown-item-padding, var(--comp-default-dropdown-item-padding)));background:var(--tct-dropdown-item-background, var(--tct-dropdown-item-bg, var(--t-dropdown-item-bg, var(--tct-white, var(--t-base, var(--app-white, #ffffff))))));color:var(--tct-dropdown-item-font-color, var(--t-dropdown-item-font-color, inherit));overflow:hidden;text-overflow:ellipsis}:host(:not([disabled])) .remove-dropdown-item:hover,:host(:not([disabled])) .remove-dropdown-item:focus,:host(:not([disabled])) .dropdown-item:hover,:host(:not([disabled])) .dropdown-item:focus{background:var(--tct-dropdown-item-hover-background, var(--tct-dropdown-item-selected-bg, var(--t-dropdown-item-selected-bg, var(--tct-gray-14, var(--t-gray-14, var(--tct-gray-l3, var(--app-gray-l3, var(--t-base, #f2f2f2))))))))}:host(:not([disabled])) .dropdown-item:hover,:host(:not([disabled])) .dropdown-item:focus{color:var(--tct-dropdown-item-hover-color, var(--tct-dropdown-item-selected-font-color, var(--t-dropdown-item-selected-font-color, inherit)))}:host(:not([disabled])) .dropdown-item:focus,:host(:not([disabled])) .remove-dropdown-item:focus{box-shadow:var(--tct-dropdown-item-focus-box-shadow, var(--const-inset-double-focus-ring, inset 0 0 0 2px var(--t-base), inset 0 0 0 4px var(--const-focus-color), inset 0 0 0 6px var(--t-base)))}.remove-dropdown-item{flex:0 0 44px}";
|
|
9
27
|
const Q2DropdownItemStyle0 = q2DropdownItemCss;
|
|
10
28
|
|
|
@@ -12,6 +30,7 @@ const Q2DropdownItem = class {
|
|
|
12
30
|
constructor(hostRef) {
|
|
13
31
|
index.registerInstance(this, hostRef);
|
|
14
32
|
this.click = index.createEvent(this, "click", 7);
|
|
33
|
+
this.tctClick = index.createEvent(this, "tctClick", 7);
|
|
15
34
|
this.handleQ2LocValue = () => {
|
|
16
35
|
const locElement = this.hostElement.querySelector('q2-loc');
|
|
17
36
|
if (!locElement)
|
|
@@ -22,7 +41,7 @@ const Q2DropdownItem = class {
|
|
|
22
41
|
};
|
|
23
42
|
this.onItemClick = (event) => {
|
|
24
43
|
event.stopImmediatePropagation();
|
|
25
|
-
this
|
|
44
|
+
mirrorEmit(this, ['click', 'tctClick'], {
|
|
26
45
|
type: 'select',
|
|
27
46
|
value: this.value || '',
|
|
28
47
|
});
|
|
@@ -36,7 +55,7 @@ const Q2DropdownItem = class {
|
|
|
36
55
|
};
|
|
37
56
|
this.onRemoveBtnClick = (event) => {
|
|
38
57
|
event.stopImmediatePropagation();
|
|
39
|
-
this
|
|
58
|
+
mirrorEmit(this, ['click', 'tctClick'], {
|
|
40
59
|
type: 'remove',
|
|
41
60
|
value: this.value || '',
|
|
42
61
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"q2-dropdown-item.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,iBAAiB,GAAG,+sGAA+sG,CAAC;AAC1uG,6BAAe,iBAAiB;;MCenB,cAAc;;;;QA4HvB,qBAAgB,GAAG;YACf,MAAM,UAAU,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;YAC5D,IAAI,CAAC,UAAU;gBAAE,OAAO,EAAE,CAAC;YAE3B,OAAO,UAAU,CAAC,KAAK;kBACjBA,WAAG,CAAC,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC,aAAa,CAAC;kBAC/CA,WAAG,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC;SAC7D,CAAC;QAEF,gBAAW,GAAG,CAAC,KAAiB;YAC5B,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,EAAE;aAC1B,CAAC,CAAC;SACN,CAAC;QAEF,gBAAW,GAAG,CAAC,KAAiB;YAC5B,KAAK,CAAC,eAAe,EAAE,CAAC;SAC3B,CAAC;QAEF,kBAAa,GAAG,CAAC,KAAoB;YACjC,IAAI,KAAK,CAAC,GAAG,KAAK,YAAY;gBAAE,IAAI,CAAC,cAAc,EAAE,CAAC;SACzD,CAAC;QAEF,qBAAgB,GAAG,CAAC,KAAiB;YACjC,KAAK,CAAC,wBAAwB,EAAE,CAAC;YAEjC,IAAI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I,KAAK,EAAC,uBAAuB,EAC7B,IAAI,EAAC,cAAc,IAEnBA,oBACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,eAAe,GAAG,EAAE,CAAC,gBAC1BH,WAAG,CAAC,IAAI,CAAC,UAAU,CAAC,EAChC,KAAK,EAAC,oCAAoC,EAC1C,QAAQ,EAAC,IAAI,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,OAAO,EAAE,IAAI,CAAC,WAAW,aACjB,cAAc,IAEtBG,sBAAOH,WAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAQ,CAC9B,EACR,IAAI,CAAC,SAAS,KACXG,oBACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAChC,KAAK,EAAC,2CAA2C,EACjD,QAAQ,EAAC,IAAI,gBACD,IAAI,CAAC,WAAW,EAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAClC,OAAO,EAAE,IAAI,CAAC,gBAAgB,aACtB,oBAAoB,IAE5BA,qBAAS,IAAI,EAAC,OAAO,GAAG,CACnB,CACZ,CACC,EACR;KACL;IAED,kBAAkB;QACd,QACIA,iBACI,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,WAAW,aACR,uBAAuB,GACjC,EACJ;KACL;IAED,MAAM;QACF,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;SACpC;QAED,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;KAC/B;;;;;;;;;;","names":["loc","handleAriaLabel","overrideFocus","h"],"sources":["src/components/q2-dropdown-item/q2-dropdown-item.scss?tag=q2-dropdown-item&encapsulation=shadow","src/components/q2-dropdown-item/q2-dropdown-item.tsx"],"sourcesContent":["@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n.dropdown-separator {\n --comp-default-separator-margin: 0 #{var-list(--tct-scale-1, --app-scale-3x, 15px)};\n margin: var-list(var-prefixer(dropdown-separator-margin), --comp-default-separator-margin);\n border-bottom: 1px solid\n var-list(\n var-prefixer(dropdown-item-separator-color),\n var-prefixer(gray-11),\n --tct-gray-l1,\n --app-gray-l1,\n #cccccc\n );\n}\n\n.dropdown-item-wrapper {\n display: flex;\n}\n\n.dropdown-item-button {\n --comp-dropdown-item-tween: #{var-list(--tct-tween-1, --app-tween-1, cubic-bezier(0.4, 0, 0.2, 1))};\n margin: var-list(--tct-scale-0, --app-scale-0x, 0);\n padding: var-list(--tct-scale-0, --app-scale-0x, 0);\n min-height: var(--tct-dropdown-item-min-height, 44px);\n min-width: 44px;\n border: none;\n background: transparent;\n outline: 0;\n transition: var-list(--tct-dropdown-item-tween, --comp-dropdown-item-tween);\n transition-property: background, color, box-shadow, fill, border-color, border-width;\n &:disabled {\n opacity: var-list(--tct-dropdown-item-disabled-opacity, --tct-disabled-opacity, --app-disabled-opacity, 0.4);\n cursor: not-allowed;\n }\n}\n\n.dropdown-item {\n --comp-default-dropdown-item-padding: var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);\n flex: 1;\n text-align: left;\n padding: var-list(var-prefixer(dropdown-item-padding), --comp-default-dropdown-item-padding);\n background: var-list(\n --tct-dropdown-item-background,\n var-prefixer(dropdown-item-bg),\n --tct-white,\n --t-base,\n --app-white,\n #ffffff\n );\n color: var-list(var-prefixer(dropdown-item-font-color), inherit);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n:host(:not([disabled])) {\n .remove-dropdown-item:hover,\n .remove-dropdown-item:focus,\n .dropdown-item:hover,\n .dropdown-item:focus {\n background: var-list(\n --tct-dropdown-item-hover-background,\n var-prefixer(dropdown-item-selected-bg),\n var-prefixer(gray-14),\n --tct-gray-l3,\n --app-gray-l3,\n --t-base,\n #f2f2f2\n );\n }\n\n .dropdown-item:hover,\n .dropdown-item:focus {\n color: var-list(--tct-dropdown-item-hover-color, var-prefixer(dropdown-item-selected-font-color), inherit);\n }\n\n .dropdown-item:focus,\n .remove-dropdown-item:focus {\n box-shadow: var-list(\n --tct-dropdown-item-focus-box-shadow,\n --const-inset-double-focus-ring,\n unquote(\n 'inset 0 0 0 2px var(--t-base), inset 0 0 0 4px var(--const-focus-color), inset 0 0 0 6px var(--t-base)'\n )\n );\n }\n}\n\n.remove-dropdown-item {\n flex: 0 0 44px;\n}\n","import {\n Component,\n ComponentInterface,\n Prop,\n State,\n Element,\n Event,\n Listen,\n Watch,\n h,\n EventEmitter,\n} from '@stencil/core';\nimport { loc, handleAriaLabel, overrideFocus } from 'src/utils';\nimport { JSX } from '../../components';\n\n@Component({ tag: 'q2-dropdown-item', shadow: true, styleUrl: 'q2-dropdown-item.scss' })\nexport class Q2DropdownItem implements ComponentInterface {\n // #region Own Properties\n\n dropdownItemBtn: HTMLButtonElement;\n removeBtn: HTMLButtonElement;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n q2LocValue: string;\n\n // #endregion\n // #region Public Property API\n\n /** @deprecated */\n @Prop({ reflect: true, mutable: true })\n ariaLabel: string;\n\n /** Disables interaction with the item and blocks its click event. */\n @Prop({ reflect: true })\n disabled: boolean;\n\n /**\n * The text that appears within the dropdown item.\n *\n * @info\n * This will be used as the `aria-label` for this item.\n * @localizable\n */\n @Prop({ reflect: true, mutable: true })\n label: string;\n\n /**\n * Renders an icon button in the item.\n * Clicking on this button will change the `type` on the item's click event detail to \"remove\".\n */\n @Prop({ reflect: true })\n removable: boolean;\n\n /**\n * Renders a line in the item instead of text.\n * Click events from these items will not have details provided.\n * A `separator` allows for quick visual grouping of items, so interactions should not be bound to these options.\n */\n @Prop({ reflect: true })\n separator: boolean;\n\n /**\n * Used by q2-option-list to indicate the option is active\n * @private\n */\n @Prop({ reflect: true })\n active: boolean;\n\n /** A static reference value for the item. This value is returned in the click event detail. */\n @Prop({ reflect: true })\n value: string;\n\n // #endregion\n // #region Events\n\n /**\n * Is emitted when the item is clicked.\n */\n @Event({ bubbles: true })\n click: EventEmitter<{ type: 'select' | 'remove'; value: string }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n componentWillLoad() {\n handleAriaLabel(this);\n this.q2LocValue = this.handleQ2LocValue();\n }\n\n componentDidLoad() {\n if (this.separator) return;\n overrideFocus(this.hostElement);\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('focus')\n onHostElementFocus(event: FocusEvent) {\n if (event.target === this.hostElement) {\n this.focusItem();\n }\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('ariaLabel')\n ariaLabelObserver() {\n handleAriaLabel(this);\n }\n\n // #endregion\n // #region Local Methods\n\n get innerLabel(): string {\n return this.label || this.hostElement.textContent.trim() || this.q2LocValue;\n }\n\n get removeLabel(): string {\n return loc('tecton.element.dropdownItem.remove', [this.innerLabel || '']);\n }\n\n focusItem() {\n this.dropdownItemBtn.focus();\n }\n\n focusRemoveBtn() {\n this.removeBtn && this.removeBtn.focus();\n }\n\n handleQ2LocValue = (): string => {\n const locElement = this.hostElement.querySelector('q2-loc');\n if (!locElement) return '';\n\n return locElement.value\n ? loc(locElement.value, locElement.substitutions)\n : loc(locElement.innerText, locElement.substitutions);\n };\n\n onItemClick = (event: MouseEvent) => {\n event.stopImmediatePropagation();\n this.click.emit({\n type: 'select',\n value: this.value || '',\n });\n };\n\n onItemFocus = (event: FocusEvent) => {\n event.stopPropagation();\n };\n\n onItemKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowRight') this.focusRemoveBtn();\n };\n\n onRemoveBtnClick = (event: MouseEvent) => {\n event.stopImmediatePropagation();\n\n this.click.emit({\n type: 'remove',\n value: this.value || '',\n });\n };\n\n onRemoveBtnFocus = (event: FocusEvent) => {\n event.stopPropagation();\n };\n\n onRemoveBtnKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') this.focusItem();\n };\n\n // #endregion\n // #region Render Methods\n\n renderItemDOM(): JSX.IntrinsicElements {\n return (\n <div\n class=\"dropdown-item-wrapper\"\n role=\"presentation\"\n >\n <button\n ref={el => (this.dropdownItemBtn = el)}\n aria-label={loc(this.innerLabel)}\n class=\"dropdown-item-button dropdown-item\"\n tabindex=\"-1\"\n disabled={this.disabled}\n role=\"menuitem\"\n onClick={this.onItemClick}\n onKeyDown={this.onItemKeydown}\n onFocus={this.onItemFocus}\n test-id=\"dropdownItem\"\n >\n <slot>{loc(this.innerLabel)}</slot>\n </button>\n {this.removable && (\n <button\n ref={el => (this.removeBtn = el)}\n class=\"dropdown-item-button remove-dropdown-item\"\n tabindex=\"-1\"\n aria-label={this.removeLabel}\n disabled={this.disabled}\n onClick={this.onRemoveBtnClick}\n onKeyDown={this.onRemoveBtnKeydown}\n onFocus={this.onRemoveBtnFocus}\n test-id=\"removeDropdownItem\"\n >\n <q2-icon type=\"close\" />\n </button>\n )}\n </div>\n );\n }\n\n renderSeparatorDOM(): JSX.IntrinsicElements {\n return (\n <div\n class=\"dropdown-separator\"\n role=\"separator\"\n test-id=\"dropdownItemSeparator\"\n />\n );\n }\n\n render() {\n if (this.separator) {\n return this.renderSeparatorDOM();\n }\n\n return this.renderItemDOM();\n }\n\n // #endregion\n}\n"],"version":3}
|
|
1
|
+
{"file":"q2-dropdown-item.entry.cjs.js","mappings":";;;;;;;AAEA;;;;;;;;AAQA,MAAM,UAAU,GAAG,CAA4B,OAA2B,EAAE,MAAqB,EAAE,MAAS;IACxG,MAAM,CAAC,OAAO,CAAC,KAAK;;QAChB,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAoB,CAAC;QACrD,IAAI,CAAC,UAAU;YAAE,OAAO;QACxB,MAAA,UAAU,CAAC,IAAI,2DAAG,MAAM,CAAC,CAAC;KAC7B,CAAC,CAAC;AACP,CAAC;;AChBD,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,QAAQ,EACvB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,SAAS,EAAE,IAAI,CAAC,aAAa,EAC7B,OAAO,EAAE,IAAI,CAAC,WAAW,aACjB,cAAc,IAEtBG,sBAAOH,WAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAQ,CAC9B,EACR,IAAI,CAAC,SAAS,KACXG,oBACI,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,SAAS,GAAG,EAAE,CAAC,EAChC,KAAK,EAAC,2CAA2C,EACjD,QAAQ,EAAC,IAAI,gBACD,IAAI,CAAC,WAAW,EAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAC9B,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAClC,OAAO,EAAE,IAAI,CAAC,gBAAgB,aACtB,oBAAoB,IAE5BA,qBAAS,IAAI,EAAC,OAAO,GAAG,CACnB,CACZ,CACC,EACR;KACL;IAED,kBAAkB;QACd,QACIA,iBACI,KAAK,EAAC,oBAAoB,EAC1B,IAAI,EAAC,WAAW,aACR,uBAAuB,GACjC,EACJ;KACL;IAED,MAAM;QACF,IAAI,IAAI,CAAC,SAAS,EAAE;YAChB,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC;SACpC;QAED,OAAO,IAAI,CAAC,aAAa,EAAE,CAAC;KAC/B;;;;;;;;;;","names":["loc","handleAriaLabel","overrideFocus","h"],"sources":["src/utils/mirror-emit.ts","src/components/q2-dropdown-item/q2-dropdown-item.scss?tag=q2-dropdown-item&encapsulation=shadow","src/components/q2-dropdown-item/q2-dropdown-item.tsx"],"sourcesContent":["import { ComponentInterface, EventEmitter } from '@stencil/core';\n\n/**\n * Emits specified events from a given component context with the provided detail.\n *\n * @template T - The type of the event detail. Defaults to the type of `CustomEvent['detail']`.\n * @param context - The component context that contains the event emitters.\n * @param events - An array of event names to be emitted.\n * @param detail - The detail payload to be passed to each emitted event.\n */\nconst mirrorEmit = <T = CustomEvent['detail']>(context: ComponentInterface, events: Array<string>, detail: T) => {\n events.forEach(event => {\n const eventEntry = context[event] as EventEmitter<T>;\n if (!eventEntry) return;\n eventEntry.emit?.(detail);\n });\n};\n\nexport default mirrorEmit;\n","@import '../../styles/host.scss';\n@import '../../styles/functions';\n\n.dropdown-separator {\n --comp-default-separator-margin: 0 #{var-list(--tct-scale-1, --app-scale-3x, 15px)};\n margin: var-list(var-prefixer(dropdown-separator-margin), --comp-default-separator-margin);\n border-bottom: 1px solid\n var-list(\n var-prefixer(dropdown-item-separator-color),\n var-prefixer(gray-11),\n --tct-gray-l1,\n --app-gray-l1,\n #cccccc\n );\n}\n\n.dropdown-item-wrapper {\n display: flex;\n}\n\n.dropdown-item-button {\n --comp-dropdown-item-tween: #{var-list(--tct-tween-1, --app-tween-1, cubic-bezier(0.4, 0, 0.2, 1))};\n margin: var-list(--tct-scale-0, --app-scale-0x, 0);\n padding: var-list(--tct-scale-0, --app-scale-0x, 0);\n min-height: var(--tct-dropdown-item-min-height, 44px);\n min-width: 44px;\n border: none;\n background: transparent;\n outline: 0;\n transition: var-list(--tct-dropdown-item-tween, --comp-dropdown-item-tween);\n transition-property: background, color, box-shadow, fill, border-color, border-width;\n &:disabled {\n opacity: var-list(--tct-dropdown-item-disabled-opacity, --tct-disabled-opacity, --app-disabled-opacity, 0.4);\n cursor: not-allowed;\n }\n}\n\n.dropdown-item {\n --comp-default-dropdown-item-padding: var(--app-scale-2x, 10px) var(--app-scale-3x, 15px);\n flex: 1;\n text-align: left;\n padding: var-list(var-prefixer(dropdown-item-padding), --comp-default-dropdown-item-padding);\n background: var-list(\n --tct-dropdown-item-background,\n var-prefixer(dropdown-item-bg),\n --tct-white,\n --t-base,\n --app-white,\n #ffffff\n );\n color: var-list(var-prefixer(dropdown-item-font-color), inherit);\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n:host(:not([disabled])) {\n .remove-dropdown-item:hover,\n .remove-dropdown-item:focus,\n .dropdown-item:hover,\n .dropdown-item:focus {\n background: var-list(\n --tct-dropdown-item-hover-background,\n var-prefixer(dropdown-item-selected-bg),\n var-prefixer(gray-14),\n --tct-gray-l3,\n --app-gray-l3,\n --t-base,\n #f2f2f2\n );\n }\n\n .dropdown-item:hover,\n .dropdown-item:focus {\n color: var-list(--tct-dropdown-item-hover-color, var-prefixer(dropdown-item-selected-font-color), inherit);\n }\n\n .dropdown-item:focus,\n .remove-dropdown-item:focus {\n box-shadow: var-list(\n --tct-dropdown-item-focus-box-shadow,\n --const-inset-double-focus-ring,\n unquote(\n 'inset 0 0 0 2px var(--t-base), inset 0 0 0 4px var(--const-focus-color), inset 0 0 0 6px var(--t-base)'\n )\n );\n }\n}\n\n.remove-dropdown-item {\n flex: 0 0 44px;\n}\n","import {\n Component,\n ComponentInterface,\n Prop,\n State,\n Element,\n Event,\n Listen,\n Watch,\n h,\n EventEmitter,\n} from '@stencil/core';\nimport { loc, handleAriaLabel, overrideFocus } from 'src/utils';\nimport mirrorEmit from '@/utils/mirror-emit';\nimport { JSX } from '../../components';\n\n@Component({ tag: 'q2-dropdown-item', shadow: true, styleUrl: 'q2-dropdown-item.scss' })\nexport class Q2DropdownItem implements ComponentInterface {\n // #region Own Properties\n\n dropdownItemBtn: HTMLButtonElement;\n removeBtn: HTMLButtonElement;\n\n // #endregion\n // #region Host HTML Element\n\n @Element()\n hostElement: HTMLElement;\n\n // #endregion\n // #region State Properties\n\n @State()\n q2LocValue: string;\n\n // #endregion\n // #region Public Property API\n\n /** @deprecated */\n @Prop({ reflect: true, mutable: true })\n ariaLabel: string;\n\n /** Disables interaction with the item and blocks its click event. */\n @Prop({ reflect: true })\n disabled: boolean;\n\n /**\n * The text that appears within the dropdown item.\n *\n * @info\n * This will be used as the `aria-label` for this item.\n * @localizable\n */\n @Prop({ reflect: true, mutable: true })\n label: string;\n\n /**\n * Renders an icon button in the item.\n * Clicking on this button will change the `type` on the item's click event detail to \"remove\".\n */\n @Prop({ reflect: true })\n removable: boolean;\n\n /**\n * Renders a line in the item instead of text.\n * Click events from these items will not have details provided.\n * A `separator` allows for quick visual grouping of items, so interactions should not be bound to these options.\n */\n @Prop({ reflect: true })\n separator: boolean;\n\n /**\n * Used by q2-option-list to indicate the option is active\n * @private\n */\n @Prop({ reflect: true })\n active: boolean;\n\n /** A static reference value for the item. This value is returned in the click event detail. */\n @Prop({ reflect: true })\n value: string;\n\n // #endregion\n // #region Events\n\n /**\n * Is emitted when the item is clicked.\n * @deprecated\n */\n @Event()\n click: EventEmitter<{ type: 'select' | 'remove'; value: string }>;\n\n /**\n * Is emitted when the item is clicked.\n */\n @Event()\n tctClick: EventEmitter<{ type: 'select' | 'remove'; value: string }>;\n\n // #endregion\n // #region Component Lifecycle Events\n\n componentWillLoad() {\n handleAriaLabel(this);\n this.q2LocValue = this.handleQ2LocValue();\n }\n\n componentDidLoad() {\n if (this.separator) return;\n overrideFocus(this.hostElement);\n }\n\n // #endregion\n // #region Listeners\n\n @Listen('focus')\n onHostElementFocus(event: FocusEvent) {\n if (event.target === this.hostElement) {\n this.focusItem();\n }\n }\n\n // #endregion\n // #region Watchers\n\n @Watch('ariaLabel')\n ariaLabelObserver() {\n handleAriaLabel(this);\n }\n\n // #endregion\n // #region Local Methods\n\n get innerLabel(): string {\n return this.label || this.hostElement.textContent.trim() || this.q2LocValue;\n }\n\n get removeLabel(): string {\n return loc('tecton.element.dropdownItem.remove', [this.innerLabel || '']);\n }\n\n focusItem() {\n this.dropdownItemBtn.focus();\n }\n\n focusRemoveBtn() {\n this.removeBtn && this.removeBtn.focus();\n }\n\n handleQ2LocValue = (): string => {\n const locElement = this.hostElement.querySelector('q2-loc');\n if (!locElement) return '';\n\n return locElement.value\n ? loc(locElement.value, locElement.substitutions)\n : loc(locElement.innerText, locElement.substitutions);\n };\n\n onItemClick = (event: MouseEvent) => {\n event.stopImmediatePropagation();\n\n mirrorEmit(this, ['click', 'tctClick'], {\n type: 'select',\n value: this.value || '',\n });\n };\n\n onItemFocus = (event: FocusEvent) => {\n event.stopPropagation();\n };\n\n onItemKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowRight') this.focusRemoveBtn();\n };\n\n onRemoveBtnClick = (event: MouseEvent) => {\n event.stopImmediatePropagation();\n\n mirrorEmit(this, ['click', 'tctClick'], {\n type: 'remove',\n value: this.value || '',\n });\n };\n\n onRemoveBtnFocus = (event: FocusEvent) => {\n event.stopPropagation();\n };\n\n onRemoveBtnKeydown = (event: KeyboardEvent) => {\n if (event.key === 'ArrowLeft') this.focusItem();\n };\n\n // #endregion\n // #region Render Methods\n\n renderItemDOM(): JSX.IntrinsicElements {\n return (\n <div\n class=\"dropdown-item-wrapper\"\n role=\"presentation\"\n >\n <button\n ref={el => (this.dropdownItemBtn = el)}\n aria-label={loc(this.innerLabel)}\n class=\"dropdown-item-button dropdown-item\"\n tabindex=\"-1\"\n disabled={this.disabled}\n role=\"menuitem\"\n onClick={this.onItemClick}\n onKeyDown={this.onItemKeydown}\n onFocus={this.onItemFocus}\n test-id=\"dropdownItem\"\n >\n <slot>{loc(this.innerLabel)}</slot>\n </button>\n {this.removable && (\n <button\n ref={el => (this.removeBtn = el)}\n class=\"dropdown-item-button remove-dropdown-item\"\n tabindex=\"-1\"\n aria-label={this.removeLabel}\n disabled={this.disabled}\n onClick={this.onRemoveBtnClick}\n onKeyDown={this.onRemoveBtnKeydown}\n onFocus={this.onRemoveBtnFocus}\n test-id=\"removeDropdownItem\"\n >\n <q2-icon type=\"close\" />\n </button>\n )}\n </div>\n );\n }\n\n renderSeparatorDOM(): JSX.IntrinsicElements {\n return (\n <div\n class=\"dropdown-separator\"\n role=\"separator\"\n test-id=\"dropdownItemSeparator\"\n />\n );\n }\n\n render() {\n if (this.separator) {\n return this.renderSeparatorDOM();\n }\n\n return this.renderItemDOM();\n }\n\n // #endregion\n}\n"],"version":3}
|
|
@@ -134,24 +134,26 @@ const Q2OptionList = class {
|
|
|
134
134
|
this.searchOptions(key, false);
|
|
135
135
|
break;
|
|
136
136
|
}
|
|
137
|
-
event.preventDefault();
|
|
138
137
|
newOption = allOptions.find(element => element.active);
|
|
139
138
|
if (!newOption || newOption.disabled)
|
|
140
139
|
break;
|
|
141
140
|
this.selectOption(newOption);
|
|
142
141
|
if (multiple)
|
|
143
142
|
break;
|
|
144
|
-
this.
|
|
143
|
+
this.hostElement.addEventListener('tctClick', () => {
|
|
144
|
+
this.popoverState.emit({ open: false, action: 'select' });
|
|
145
|
+
}, { once: true });
|
|
145
146
|
break;
|
|
146
147
|
case 'Enter':
|
|
147
|
-
event.preventDefault();
|
|
148
148
|
newOption = allOptions.find(element => element.active);
|
|
149
149
|
if (!newOption || newOption.disabled)
|
|
150
150
|
break;
|
|
151
151
|
this.selectOption(newOption);
|
|
152
152
|
if (multiple)
|
|
153
153
|
break;
|
|
154
|
-
this.
|
|
154
|
+
this.hostElement.addEventListener('tctClick', () => {
|
|
155
|
+
this.popoverState.emit({ open: false, action: 'select' });
|
|
156
|
+
}, { once: true });
|
|
155
157
|
break;
|
|
156
158
|
case 'ArrowUp':
|
|
157
159
|
event.preventDefault();
|
|
@@ -575,7 +577,7 @@ const Q2OptionList = class {
|
|
|
575
577
|
// #endregion
|
|
576
578
|
// #region Render Methods
|
|
577
579
|
render() {
|
|
578
|
-
return (index.h(index.Host, { key: '
|
|
580
|
+
return (index.h(index.Host, { key: '5708785bddc01b545a3b2a94417ad415c6cba32e' }, index.h("div", { key: 'e6f36e235609824dae19e93edc14d8f8504eb860', class: "content", ref: el => (this.contentElement = el), onFocusout: this.focusoutHandler }, index.h("div", { key: 'cbdf42235da01a1fc10efcc0798edeb653fe26ae', class: "options", "aria-label": index$1.loc('tecton.element.optionList.label', [this.label]), "aria-multiselectable": `${!!this.multiple}`, role: this.type || 'listbox', onKeyDown: this.internalKeydownHandler, onClick: this.clickHandler }, index.h("slot", { key: 'cec72b3912c96f09a12c171e4227efd29a9097c9' })))));
|
|
579
581
|
}
|
|
580
582
|
get hostElement() { return index.getElement(this); }
|
|
581
583
|
static get watchers() { return {
|