@ionic/core 8.7.17-dev.11770405784.157a3c10 → 8.7.17-dev.11771865171.14f4c2cf
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/components/ion-range.js +152 -39
- package/components/ion-segment-view.js +5 -11
- package/dist/cjs/ion-range.cjs.entry.js +149 -39
- package/dist/cjs/ion-segment-view.cjs.entry.js +5 -10
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/range/range.js +172 -42
- package/dist/collection/components/segment-view/segment-view.ios.css +1 -2
- package/dist/collection/components/segment-view/segment-view.js +3 -28
- package/dist/collection/components/segment-view/segment-view.md.css +1 -2
- package/dist/docs.json +142 -35
- package/dist/esm/ion-range.entry.js +149 -39
- package/dist/esm/ion-segment-view.entry.js +5 -10
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/html.html-data.json +0 -4
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-020af078.entry.js +4 -0
- package/dist/ionic/p-991a3dd9.entry.js +4 -0
- package/dist/types/components/range/range-interface.d.ts +1 -0
- package/dist/types/components/range/range.d.ts +33 -4
- package/dist/types/components/segment-view/segment-view.d.ts +0 -4
- package/dist/types/components.d.ts +0 -10
- package/hydrate/index.js +177 -53
- package/hydrate/index.mjs +177 -53
- package/package.json +1 -1
- package/dist/ionic/p-012212e4.entry.js +0 -4
- package/dist/ionic/p-9a2d390d.entry.js +0 -4
|
@@ -11,10 +11,6 @@ export class SegmentView {
|
|
|
11
11
|
* If `true`, the segment view cannot be interacted with.
|
|
12
12
|
*/
|
|
13
13
|
this.disabled = false;
|
|
14
|
-
/**
|
|
15
|
-
* If `true`, users will be able to swipe the segment view to navigate between segment contents.
|
|
16
|
-
*/
|
|
17
|
-
this.swipeGesture = true;
|
|
18
14
|
}
|
|
19
15
|
handleScroll(ev) {
|
|
20
16
|
var _a;
|
|
@@ -102,12 +98,11 @@ export class SegmentView {
|
|
|
102
98
|
return Array.from(this.el.querySelectorAll('ion-segment-content'));
|
|
103
99
|
}
|
|
104
100
|
render() {
|
|
105
|
-
const { disabled, isManualScroll
|
|
106
|
-
return (h(Host, { key: '
|
|
101
|
+
const { disabled, isManualScroll } = this;
|
|
102
|
+
return (h(Host, { key: 'e180b67bb3143a5f4611fb358c037be6fc782a8f', class: {
|
|
107
103
|
'segment-view-disabled': disabled,
|
|
108
104
|
'segment-view-scroll-disabled': isManualScroll === false,
|
|
109
|
-
|
|
110
|
-
} }, h("slot", { key: '4118c240364467302b8f593e33c37837ea5d06f0' })));
|
|
105
|
+
} }, h("slot", { key: '41c11d6a7406a10f5c64a2e73abfc072afd8fc73' })));
|
|
111
106
|
}
|
|
112
107
|
static get is() { return "ion-segment-view"; }
|
|
113
108
|
static get encapsulation() { return "shadow"; }
|
|
@@ -144,26 +139,6 @@ export class SegmentView {
|
|
|
144
139
|
"reflect": false,
|
|
145
140
|
"attribute": "disabled",
|
|
146
141
|
"defaultValue": "false"
|
|
147
|
-
},
|
|
148
|
-
"swipeGesture": {
|
|
149
|
-
"type": "boolean",
|
|
150
|
-
"mutable": false,
|
|
151
|
-
"complexType": {
|
|
152
|
-
"original": "boolean",
|
|
153
|
-
"resolved": "boolean",
|
|
154
|
-
"references": {}
|
|
155
|
-
},
|
|
156
|
-
"required": false,
|
|
157
|
-
"optional": false,
|
|
158
|
-
"docs": {
|
|
159
|
-
"tags": [],
|
|
160
|
-
"text": "If `true`, users will be able to swipe the segment view to navigate between segment contents."
|
|
161
|
-
},
|
|
162
|
-
"getter": false,
|
|
163
|
-
"setter": false,
|
|
164
|
-
"reflect": false,
|
|
165
|
-
"attribute": "swipe-gesture",
|
|
166
|
-
"defaultValue": "true"
|
|
167
142
|
}
|
|
168
143
|
};
|
|
169
144
|
}
|
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-02-
|
|
2
|
+
"timestamp": "2026-02-23T16:48:01",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.38.0",
|
|
@@ -25548,6 +25548,10 @@
|
|
|
25548
25548
|
"name": "slot",
|
|
25549
25549
|
"text": "end - Content is placed to the right of the range slider in LTR, and to the left in RTL."
|
|
25550
25550
|
},
|
|
25551
|
+
{
|
|
25552
|
+
"name": "part",
|
|
25553
|
+
"text": "label - The label text describing the range."
|
|
25554
|
+
},
|
|
25551
25555
|
{
|
|
25552
25556
|
"name": "part",
|
|
25553
25557
|
"text": "tick - An inactive tick mark."
|
|
@@ -25556,25 +25560,89 @@
|
|
|
25556
25560
|
"name": "part",
|
|
25557
25561
|
"text": "tick-active - An active tick mark."
|
|
25558
25562
|
},
|
|
25563
|
+
{
|
|
25564
|
+
"name": "part",
|
|
25565
|
+
"text": "bar - The inactive part of the bar."
|
|
25566
|
+
},
|
|
25567
|
+
{
|
|
25568
|
+
"name": "part",
|
|
25569
|
+
"text": "bar-active - The active part of the bar."
|
|
25570
|
+
},
|
|
25571
|
+
{
|
|
25572
|
+
"name": "part",
|
|
25573
|
+
"text": "knob-handle - The container element that wraps the knob and handles drag interactions."
|
|
25574
|
+
},
|
|
25575
|
+
{
|
|
25576
|
+
"name": "part",
|
|
25577
|
+
"text": "knob-handle-a - The container element for the first knob. Only available when `dualKnobs` is `true`."
|
|
25578
|
+
},
|
|
25579
|
+
{
|
|
25580
|
+
"name": "part",
|
|
25581
|
+
"text": "knob-handle-b - The container element for the second knob. Only available when `dualKnobs` is `true`."
|
|
25582
|
+
},
|
|
25583
|
+
{
|
|
25584
|
+
"name": "part",
|
|
25585
|
+
"text": "knob-handle-lower - The container element for the lower knob. Only available when `dualKnobs` is `true`."
|
|
25586
|
+
},
|
|
25587
|
+
{
|
|
25588
|
+
"name": "part",
|
|
25589
|
+
"text": "knob-handle-upper - The container element for the upper knob. Only available when `dualKnobs` is `true`."
|
|
25590
|
+
},
|
|
25559
25591
|
{
|
|
25560
25592
|
"name": "part",
|
|
25561
25593
|
"text": "pin - The counter that appears above a knob."
|
|
25562
25594
|
},
|
|
25563
25595
|
{
|
|
25564
25596
|
"name": "part",
|
|
25565
|
-
"text": "
|
|
25597
|
+
"text": "pin-a - The counter that appears above the first knob. Only available when `dualKnobs` is `true`."
|
|
25566
25598
|
},
|
|
25567
25599
|
{
|
|
25568
25600
|
"name": "part",
|
|
25569
|
-
"text": "
|
|
25601
|
+
"text": "pin-b - The counter that appears above the second knob. Only available when `dualKnobs` is `true`."
|
|
25570
25602
|
},
|
|
25571
25603
|
{
|
|
25572
25604
|
"name": "part",
|
|
25573
|
-
"text": "
|
|
25605
|
+
"text": "pin-lower - The counter that appears above the lower knob. Only available when `dualKnobs` is `true`."
|
|
25574
25606
|
},
|
|
25575
25607
|
{
|
|
25576
25608
|
"name": "part",
|
|
25577
|
-
"text": "
|
|
25609
|
+
"text": "pin-upper - The counter that appears above the upper knob. Only available when `dualKnobs` is `true`."
|
|
25610
|
+
},
|
|
25611
|
+
{
|
|
25612
|
+
"name": "part",
|
|
25613
|
+
"text": "knob - The visual knob element that appears on the range track."
|
|
25614
|
+
},
|
|
25615
|
+
{
|
|
25616
|
+
"name": "part",
|
|
25617
|
+
"text": "knob-a - The visual knob element for the first knob. Only available when `dualKnobs` is `true`."
|
|
25618
|
+
},
|
|
25619
|
+
{
|
|
25620
|
+
"name": "part",
|
|
25621
|
+
"text": "knob-b - The visual knob element for the second knob. Only available when `dualKnobs` is `true`."
|
|
25622
|
+
},
|
|
25623
|
+
{
|
|
25624
|
+
"name": "part",
|
|
25625
|
+
"text": "knob-lower - The visual knob element for the lower knob. Only available when `dualKnobs` is `true`."
|
|
25626
|
+
},
|
|
25627
|
+
{
|
|
25628
|
+
"name": "part",
|
|
25629
|
+
"text": "knob-upper - The visual knob element for the upper knob. Only available when `dualKnobs` is `true`."
|
|
25630
|
+
},
|
|
25631
|
+
{
|
|
25632
|
+
"name": "part",
|
|
25633
|
+
"text": "activated - Added to the knob-handle, knob, and pin when the knob is activated (has the `ion-activated` class). Only one set has this part at a time when `dualKnobs` is `true`."
|
|
25634
|
+
},
|
|
25635
|
+
{
|
|
25636
|
+
"name": "part",
|
|
25637
|
+
"text": "focused - Added to the knob-handle, knob, and pin that currently has focus. Only one set has this part at a time when `dualKnobs` is `true`."
|
|
25638
|
+
},
|
|
25639
|
+
{
|
|
25640
|
+
"name": "part",
|
|
25641
|
+
"text": "hover - Added to the knob-handle, knob, and pin when the knob has hover. Only one set has this part at a time when `dualKnobs` is `true`."
|
|
25642
|
+
},
|
|
25643
|
+
{
|
|
25644
|
+
"name": "part",
|
|
25645
|
+
"text": "pressed - Added to the knob-handle, knob, and pin that is currently being pressed to drag. Only one set has this part at a time when `dualKnobs` is `true`."
|
|
25578
25646
|
}
|
|
25579
25647
|
],
|
|
25580
25648
|
"usage": {},
|
|
@@ -26386,6 +26454,10 @@
|
|
|
26386
26454
|
}
|
|
26387
26455
|
],
|
|
26388
26456
|
"parts": [
|
|
26457
|
+
{
|
|
26458
|
+
"name": "activated",
|
|
26459
|
+
"docs": "Added to the knob-handle, knob, and pin when the knob is activated (has the `ion-activated` class). Only one set has this part at a time when `dualKnobs` is `true`."
|
|
26460
|
+
},
|
|
26389
26461
|
{
|
|
26390
26462
|
"name": "bar",
|
|
26391
26463
|
"docs": "The inactive part of the bar."
|
|
@@ -26394,9 +26466,53 @@
|
|
|
26394
26466
|
"name": "bar-active",
|
|
26395
26467
|
"docs": "The active part of the bar."
|
|
26396
26468
|
},
|
|
26469
|
+
{
|
|
26470
|
+
"name": "focused",
|
|
26471
|
+
"docs": "Added to the knob-handle, knob, and pin that currently has focus. Only one set has this part at a time when `dualKnobs` is `true`."
|
|
26472
|
+
},
|
|
26473
|
+
{
|
|
26474
|
+
"name": "hover",
|
|
26475
|
+
"docs": "Added to the knob-handle, knob, and pin when the knob has hover. Only one set has this part at a time when `dualKnobs` is `true`."
|
|
26476
|
+
},
|
|
26397
26477
|
{
|
|
26398
26478
|
"name": "knob",
|
|
26399
|
-
"docs": "The
|
|
26479
|
+
"docs": "The visual knob element that appears on the range track."
|
|
26480
|
+
},
|
|
26481
|
+
{
|
|
26482
|
+
"name": "knob-a",
|
|
26483
|
+
"docs": "The visual knob element for the first knob. Only available when `dualKnobs` is `true`."
|
|
26484
|
+
},
|
|
26485
|
+
{
|
|
26486
|
+
"name": "knob-b",
|
|
26487
|
+
"docs": "The visual knob element for the second knob. Only available when `dualKnobs` is `true`."
|
|
26488
|
+
},
|
|
26489
|
+
{
|
|
26490
|
+
"name": "knob-handle",
|
|
26491
|
+
"docs": "The container element that wraps the knob and handles drag interactions."
|
|
26492
|
+
},
|
|
26493
|
+
{
|
|
26494
|
+
"name": "knob-handle-a",
|
|
26495
|
+
"docs": "The container element for the first knob. Only available when `dualKnobs` is `true`."
|
|
26496
|
+
},
|
|
26497
|
+
{
|
|
26498
|
+
"name": "knob-handle-b",
|
|
26499
|
+
"docs": "The container element for the second knob. Only available when `dualKnobs` is `true`."
|
|
26500
|
+
},
|
|
26501
|
+
{
|
|
26502
|
+
"name": "knob-handle-lower",
|
|
26503
|
+
"docs": "The container element for the lower knob. Only available when `dualKnobs` is `true`."
|
|
26504
|
+
},
|
|
26505
|
+
{
|
|
26506
|
+
"name": "knob-handle-upper",
|
|
26507
|
+
"docs": "The container element for the upper knob. Only available when `dualKnobs` is `true`."
|
|
26508
|
+
},
|
|
26509
|
+
{
|
|
26510
|
+
"name": "knob-lower",
|
|
26511
|
+
"docs": "The visual knob element for the lower knob. Only available when `dualKnobs` is `true`."
|
|
26512
|
+
},
|
|
26513
|
+
{
|
|
26514
|
+
"name": "knob-upper",
|
|
26515
|
+
"docs": "The visual knob element for the upper knob. Only available when `dualKnobs` is `true`."
|
|
26400
26516
|
},
|
|
26401
26517
|
{
|
|
26402
26518
|
"name": "label",
|
|
@@ -26406,6 +26522,26 @@
|
|
|
26406
26522
|
"name": "pin",
|
|
26407
26523
|
"docs": "The counter that appears above a knob."
|
|
26408
26524
|
},
|
|
26525
|
+
{
|
|
26526
|
+
"name": "pin-a",
|
|
26527
|
+
"docs": "The counter that appears above the first knob. Only available when `dualKnobs` is `true`."
|
|
26528
|
+
},
|
|
26529
|
+
{
|
|
26530
|
+
"name": "pin-b",
|
|
26531
|
+
"docs": "The counter that appears above the second knob. Only available when `dualKnobs` is `true`."
|
|
26532
|
+
},
|
|
26533
|
+
{
|
|
26534
|
+
"name": "pin-lower",
|
|
26535
|
+
"docs": "The counter that appears above the lower knob. Only available when `dualKnobs` is `true`."
|
|
26536
|
+
},
|
|
26537
|
+
{
|
|
26538
|
+
"name": "pin-upper",
|
|
26539
|
+
"docs": "The counter that appears above the upper knob. Only available when `dualKnobs` is `true`."
|
|
26540
|
+
},
|
|
26541
|
+
{
|
|
26542
|
+
"name": "pressed",
|
|
26543
|
+
"docs": "Added to the knob-handle, knob, and pin that is currently being pressed to drag. Only one set has this part at a time when `dualKnobs` is `true`."
|
|
26544
|
+
},
|
|
26409
26545
|
{
|
|
26410
26546
|
"name": "tick",
|
|
26411
26547
|
"docs": "An inactive tick mark."
|
|
@@ -30495,35 +30631,6 @@
|
|
|
30495
30631
|
"required": false,
|
|
30496
30632
|
"getter": false,
|
|
30497
30633
|
"setter": false
|
|
30498
|
-
},
|
|
30499
|
-
{
|
|
30500
|
-
"name": "swipeGesture",
|
|
30501
|
-
"type": "boolean",
|
|
30502
|
-
"complexType": {
|
|
30503
|
-
"original": "boolean",
|
|
30504
|
-
"resolved": "boolean",
|
|
30505
|
-
"references": {}
|
|
30506
|
-
},
|
|
30507
|
-
"mutable": false,
|
|
30508
|
-
"attr": "swipe-gesture",
|
|
30509
|
-
"reflectToAttr": false,
|
|
30510
|
-
"docs": "If `true`, users will be able to swipe the segment view to navigate between segment contents.",
|
|
30511
|
-
"docsTags": [
|
|
30512
|
-
{
|
|
30513
|
-
"name": "default",
|
|
30514
|
-
"text": "true"
|
|
30515
|
-
}
|
|
30516
|
-
],
|
|
30517
|
-
"default": "true",
|
|
30518
|
-
"values": [
|
|
30519
|
-
{
|
|
30520
|
-
"type": "boolean"
|
|
30521
|
-
}
|
|
30522
|
-
],
|
|
30523
|
-
"optional": false,
|
|
30524
|
-
"required": false,
|
|
30525
|
-
"getter": false,
|
|
30526
|
-
"setter": false
|
|
30527
30634
|
}
|
|
30528
30635
|
],
|
|
30529
30636
|
"methods": [],
|
|
@@ -74,6 +74,7 @@ const Range = class {
|
|
|
74
74
|
this.inheritedAttributes = {};
|
|
75
75
|
this.contentEl = null;
|
|
76
76
|
this.initialContentScrollY = true;
|
|
77
|
+
this.focusFromPointer = false;
|
|
77
78
|
this.ratioA = 0;
|
|
78
79
|
this.ratioB = 0;
|
|
79
80
|
/**
|
|
@@ -183,6 +184,29 @@ const Range = class {
|
|
|
183
184
|
this.gesture.enable(!this.disabled);
|
|
184
185
|
}
|
|
185
186
|
};
|
|
187
|
+
/**
|
|
188
|
+
* Observes the knob handles for the ion-activated class and syncs
|
|
189
|
+
* activatedKnob so the activated part is correctly set on the handle,
|
|
190
|
+
* knob, and pin.
|
|
191
|
+
*/
|
|
192
|
+
this.setupActivatedObserver = () => {
|
|
193
|
+
const knobHandleA = this.el.shadowRoot.querySelector('.range-knob-handle-a');
|
|
194
|
+
const knobHandleB = this.el.shadowRoot.querySelector('.range-knob-handle-b');
|
|
195
|
+
const syncActivated = () => {
|
|
196
|
+
this.activatedKnob = (knobHandleA === null || knobHandleA === void 0 ? void 0 : knobHandleA.classList.contains('ion-activated'))
|
|
197
|
+
? 'A'
|
|
198
|
+
: (knobHandleB === null || knobHandleB === void 0 ? void 0 : knobHandleB.classList.contains('ion-activated'))
|
|
199
|
+
? 'B'
|
|
200
|
+
: undefined;
|
|
201
|
+
};
|
|
202
|
+
this.activatedObserver = new MutationObserver(syncActivated);
|
|
203
|
+
this.activatedObserver.observe(this.el.shadowRoot, {
|
|
204
|
+
attributes: true,
|
|
205
|
+
attributeFilter: ['class'],
|
|
206
|
+
subtree: true,
|
|
207
|
+
});
|
|
208
|
+
syncActivated();
|
|
209
|
+
};
|
|
186
210
|
this.handleKeyboard = (knob, isIncrease) => {
|
|
187
211
|
const { ensureValueInBounds } = this;
|
|
188
212
|
let step = this.step;
|
|
@@ -205,6 +229,7 @@ const Range = class {
|
|
|
205
229
|
this.onBlur = () => {
|
|
206
230
|
if (this.hasFocus) {
|
|
207
231
|
this.hasFocus = false;
|
|
232
|
+
this.focusedKnob = undefined;
|
|
208
233
|
this.ionBlur.emit();
|
|
209
234
|
}
|
|
210
235
|
};
|
|
@@ -215,21 +240,20 @@ const Range = class {
|
|
|
215
240
|
}
|
|
216
241
|
};
|
|
217
242
|
this.onKnobFocus = (knob) => {
|
|
243
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
244
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
245
|
+
if (!this.focusFromPointer) {
|
|
246
|
+
this.focusedKnob = knob;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
this.focusFromPointer = false;
|
|
250
|
+
this.focusedKnob = undefined;
|
|
251
|
+
}
|
|
252
|
+
// If the knob was not already focused, emit the focus event
|
|
218
253
|
if (!this.hasFocus) {
|
|
219
254
|
this.hasFocus = true;
|
|
220
255
|
this.ionFocus.emit();
|
|
221
256
|
}
|
|
222
|
-
// Manually manage ion-focused class for dual knobs
|
|
223
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
224
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
225
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
226
|
-
// Remove ion-focused from both knobs first
|
|
227
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
228
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
229
|
-
// Add ion-focused only to the focused knob
|
|
230
|
-
const focusedKnobEl = knob === 'A' ? knobA : knobB;
|
|
231
|
-
focusedKnobEl === null || focusedKnobEl === void 0 ? void 0 : focusedKnobEl.classList.add('ion-focused');
|
|
232
|
-
}
|
|
233
257
|
};
|
|
234
258
|
this.onKnobBlur = () => {
|
|
235
259
|
// Check if focus is moving to another knob within the same range
|
|
@@ -241,18 +265,18 @@ const Range = class {
|
|
|
241
265
|
if (!isStillFocusedOnKnob) {
|
|
242
266
|
if (this.hasFocus) {
|
|
243
267
|
this.hasFocus = false;
|
|
268
|
+
this.focusedKnob = undefined;
|
|
244
269
|
this.ionBlur.emit();
|
|
245
270
|
}
|
|
246
|
-
// Remove ion-focused from both knobs when focus leaves the range
|
|
247
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
248
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
249
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
250
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
251
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
252
|
-
}
|
|
253
271
|
}
|
|
254
272
|
}, 0);
|
|
255
273
|
};
|
|
274
|
+
this.onKnobMouseEnter = (knob) => {
|
|
275
|
+
this.hoveredKnob = knob;
|
|
276
|
+
};
|
|
277
|
+
this.onKnobMouseLeave = () => {
|
|
278
|
+
this.hoveredKnob = undefined;
|
|
279
|
+
};
|
|
256
280
|
}
|
|
257
281
|
debounceChanged() {
|
|
258
282
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -329,6 +353,7 @@ const Range = class {
|
|
|
329
353
|
this.originalIonInput = this.ionInput;
|
|
330
354
|
this.setupGesture();
|
|
331
355
|
this.updateRatio();
|
|
356
|
+
this.setupActivatedObserver();
|
|
332
357
|
this.didLoad = true;
|
|
333
358
|
}
|
|
334
359
|
connectedCallback() {
|
|
@@ -354,6 +379,10 @@ const Range = class {
|
|
|
354
379
|
this.gesture.destroy();
|
|
355
380
|
this.gesture = undefined;
|
|
356
381
|
}
|
|
382
|
+
if (this.activatedObserver) {
|
|
383
|
+
this.activatedObserver.disconnect();
|
|
384
|
+
this.activatedObserver = undefined;
|
|
385
|
+
}
|
|
357
386
|
}
|
|
358
387
|
getValue() {
|
|
359
388
|
var _a;
|
|
@@ -506,7 +535,6 @@ const Range = class {
|
|
|
506
535
|
ratio = 1 - ratio;
|
|
507
536
|
}
|
|
508
537
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
509
|
-
this.setFocus(this.pressedKnob);
|
|
510
538
|
}
|
|
511
539
|
get valA() {
|
|
512
540
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -533,9 +561,23 @@ const Range = class {
|
|
|
533
561
|
updateRatio() {
|
|
534
562
|
const value = this.getValue();
|
|
535
563
|
const { min, max } = this;
|
|
564
|
+
/**
|
|
565
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
566
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
567
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
568
|
+
*/
|
|
536
569
|
if (this.dualKnobs) {
|
|
537
|
-
|
|
538
|
-
|
|
570
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
571
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
572
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
573
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
574
|
+
this.ratioA = lowerRatio;
|
|
575
|
+
this.ratioB = upperRatio;
|
|
576
|
+
}
|
|
577
|
+
else {
|
|
578
|
+
this.ratioA = upperRatio;
|
|
579
|
+
this.ratioB = lowerRatio;
|
|
580
|
+
}
|
|
539
581
|
}
|
|
540
582
|
else {
|
|
541
583
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -552,14 +594,6 @@ const Range = class {
|
|
|
552
594
|
};
|
|
553
595
|
this.noUpdate = false;
|
|
554
596
|
}
|
|
555
|
-
setFocus(knob) {
|
|
556
|
-
if (this.el.shadowRoot) {
|
|
557
|
-
const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
|
|
558
|
-
if (knobEl) {
|
|
559
|
-
knobEl.focus();
|
|
560
|
-
}
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
597
|
/**
|
|
564
598
|
* Returns true if content was passed to the "start" slot
|
|
565
599
|
*/
|
|
@@ -577,7 +611,7 @@ const Range = class {
|
|
|
577
611
|
}
|
|
578
612
|
renderRangeSlider() {
|
|
579
613
|
var _a;
|
|
580
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
614
|
+
const { min, max, step, handleKeyboard, activatedKnob, focusedKnob, hoveredKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
581
615
|
let barStart = `${ratioLower * 100}%`;
|
|
582
616
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
583
617
|
const rtl = isRTL(this.el);
|
|
@@ -637,7 +671,9 @@ const Range = class {
|
|
|
637
671
|
ticks.push(tick);
|
|
638
672
|
}
|
|
639
673
|
}
|
|
640
|
-
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
674
|
+
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
675
|
+
this.focusFromPointer = true;
|
|
676
|
+
},
|
|
641
677
|
/**
|
|
642
678
|
* Since the gesture has a threshold, the value
|
|
643
679
|
* won't change until the user has dragged past
|
|
@@ -650,6 +686,7 @@ const Range = class {
|
|
|
650
686
|
* we need to listen for the "pointerUp" event.
|
|
651
687
|
*/
|
|
652
688
|
onPointerUp: (ev) => {
|
|
689
|
+
this.focusFromPointer = false;
|
|
653
690
|
/**
|
|
654
691
|
* If the user drags the knob on the web
|
|
655
692
|
* version (does not occur on mobile),
|
|
@@ -675,6 +712,11 @@ const Range = class {
|
|
|
675
712
|
'has-ticks': ticks.length > 0,
|
|
676
713
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
677
714
|
knob: 'A',
|
|
715
|
+
position: getKnobPosition('A', this.ratioA, this.ratioB, this.dualKnobs),
|
|
716
|
+
dualKnobs: this.dualKnobs,
|
|
717
|
+
activated: activatedKnob === 'A',
|
|
718
|
+
focused: focusedKnob === 'A',
|
|
719
|
+
hovered: hoveredKnob === 'A',
|
|
678
720
|
pressed: pressedKnob === 'A',
|
|
679
721
|
value: this.valA,
|
|
680
722
|
ratio: this.ratioA,
|
|
@@ -687,9 +729,16 @@ const Range = class {
|
|
|
687
729
|
inheritedAttributes,
|
|
688
730
|
onKnobFocus: this.onKnobFocus,
|
|
689
731
|
onKnobBlur: this.onKnobBlur,
|
|
732
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
733
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
690
734
|
}), this.dualKnobs &&
|
|
691
735
|
renderKnob(rtl, {
|
|
692
736
|
knob: 'B',
|
|
737
|
+
position: getKnobPosition('B', this.ratioA, this.ratioB, this.dualKnobs),
|
|
738
|
+
dualKnobs: this.dualKnobs,
|
|
739
|
+
activated: activatedKnob === 'B',
|
|
740
|
+
focused: focusedKnob === 'B',
|
|
741
|
+
hovered: hoveredKnob === 'B',
|
|
693
742
|
pressed: pressedKnob === 'B',
|
|
694
743
|
value: this.valB,
|
|
695
744
|
ratio: this.ratioB,
|
|
@@ -702,6 +751,8 @@ const Range = class {
|
|
|
702
751
|
inheritedAttributes,
|
|
703
752
|
onKnobFocus: this.onKnobFocus,
|
|
704
753
|
onKnobBlur: this.onKnobBlur,
|
|
754
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
755
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
705
756
|
})));
|
|
706
757
|
}
|
|
707
758
|
render() {
|
|
@@ -720,6 +771,12 @@ const Range = class {
|
|
|
720
771
|
const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent;
|
|
721
772
|
const needsEndAdjustment = inItem && !hasEndContent;
|
|
722
773
|
const mode = getIonMode(this);
|
|
774
|
+
/**
|
|
775
|
+
* Determine the name and position of the pressed knob to apply
|
|
776
|
+
* Host classes for styling.
|
|
777
|
+
*/
|
|
778
|
+
const pressedKnobName = dualKnobs ? pressedKnob === null || pressedKnob === void 0 ? void 0 : pressedKnob.toLowerCase() : undefined;
|
|
779
|
+
const pressedKnobPosition = dualKnobs && pressedKnob ? getKnobPosition(pressedKnob, this.ratioA, this.ratioB, dualKnobs) : undefined;
|
|
723
780
|
/**
|
|
724
781
|
* Determine if any knob is at the min or max value to
|
|
725
782
|
* apply Host classes for styling.
|
|
@@ -727,21 +784,24 @@ const Range = class {
|
|
|
727
784
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
728
785
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
729
786
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
730
|
-
return (h(Host, { key: '
|
|
787
|
+
return (h(Host, { key: '8e439db9836fdefdc779573082c788e3ddb3ef73', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses(this.color, {
|
|
731
788
|
[mode]: true,
|
|
732
789
|
'in-item': inItem,
|
|
733
790
|
'range-disabled': disabled,
|
|
791
|
+
'range-dual-knobs': dualKnobs,
|
|
734
792
|
'range-pressed': pressedKnob !== undefined,
|
|
793
|
+
[`range-pressed-${pressedKnobName}`]: pressedKnob !== undefined && pressedKnobName !== undefined,
|
|
794
|
+
[`range-pressed-${pressedKnobPosition}`]: pressedKnob !== undefined && pressedKnobPosition !== undefined,
|
|
735
795
|
'range-has-pin': pin,
|
|
736
796
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
737
797
|
'range-item-start-adjustment': needsStartAdjustment,
|
|
738
798
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
739
799
|
'range-value-min': valueAtMin,
|
|
740
800
|
'range-value-max': valueAtMax,
|
|
741
|
-
}) }, h("label", { key: '
|
|
801
|
+
}) }, h("label", { key: 'e14c56db4d1eef11a3a0639c4bbed368041fc3eb', class: "range-wrapper", id: "range-label" }, h("div", { key: '16d125b0af19fdfa3663731657a7cca51a7ed442', class: {
|
|
742
802
|
'label-text-wrapper': true,
|
|
743
803
|
'label-text-wrapper-hidden': !hasLabel,
|
|
744
|
-
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '
|
|
804
|
+
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '545cc52a3e675e9df328dab537a4e44b7f3c59f8', class: "native-wrapper" }, h("slot", { key: 'ac54b45a21c9db231ebe11498d508d05864b56fb', name: "start" }), this.renderRangeSlider(), h("slot", { key: '7182dba53df2ff878d572b30afda64b37082c82e', name: "end" })))));
|
|
745
805
|
}
|
|
746
806
|
get el() { return getElement(this); }
|
|
747
807
|
static get watchers() { return {
|
|
@@ -754,7 +814,7 @@ const Range = class {
|
|
|
754
814
|
"value": ["valueChanged"]
|
|
755
815
|
}; }
|
|
756
816
|
};
|
|
757
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
817
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, activated, focused, hovered, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, onKnobMouseEnter, onKnobMouseLeave, }) => {
|
|
758
818
|
const start = rtl ? 'right' : 'left';
|
|
759
819
|
const knobStyle = () => {
|
|
760
820
|
const style = {};
|
|
@@ -775,16 +835,66 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
775
835
|
ev.preventDefault();
|
|
776
836
|
ev.stopPropagation();
|
|
777
837
|
}
|
|
778
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
838
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
779
839
|
'range-knob-handle': true,
|
|
780
|
-
'range-knob-a': knob === 'A',
|
|
781
|
-
'range-knob-b': knob === 'B',
|
|
840
|
+
'range-knob-handle-a': knob === 'A',
|
|
841
|
+
'range-knob-handle-b': knob === 'B',
|
|
782
842
|
'range-knob-pressed': pressed,
|
|
783
843
|
'range-knob-min': value === min,
|
|
784
844
|
'range-knob-max': value === max,
|
|
785
845
|
'ion-activatable': true,
|
|
786
846
|
'ion-focusable': true,
|
|
787
|
-
|
|
847
|
+
'ion-focused': focused,
|
|
848
|
+
}, part: [
|
|
849
|
+
'knob-handle',
|
|
850
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
851
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
852
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
853
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
854
|
+
pressed && 'pressed',
|
|
855
|
+
focused && 'focused',
|
|
856
|
+
hovered && 'hover',
|
|
857
|
+
activated && 'activated',
|
|
858
|
+
]
|
|
859
|
+
.filter(Boolean)
|
|
860
|
+
.join(' '), style: knobStyle(), role: "slider", tabindex: disabled ? -1 : 0, "aria-label": ariaLabel !== undefined ? ariaLabel : null, "aria-labelledby": ariaLabel === undefined ? 'range-label' : null, "aria-valuemin": min, "aria-valuemax": max, "aria-disabled": disabled ? 'true' : null, "aria-valuenow": value }, pin && (h("div", { class: "range-pin", role: "presentation", part: [
|
|
861
|
+
'pin',
|
|
862
|
+
dualKnobs && knob === 'A' && 'pin-a',
|
|
863
|
+
dualKnobs && knob === 'B' && 'pin-b',
|
|
864
|
+
dualKnobs && position === 'lower' && 'pin-lower',
|
|
865
|
+
dualKnobs && position === 'upper' && 'pin-upper',
|
|
866
|
+
pressed && 'pressed',
|
|
867
|
+
focused && 'focused',
|
|
868
|
+
hovered && 'hover',
|
|
869
|
+
activated && 'activated',
|
|
870
|
+
]
|
|
871
|
+
.filter(Boolean)
|
|
872
|
+
.join(' ') }, pinFormatter(value))), h("div", { class: "range-knob", role: "presentation", part: [
|
|
873
|
+
'knob',
|
|
874
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
875
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
876
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
877
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
878
|
+
pressed && 'pressed',
|
|
879
|
+
focused && 'focused',
|
|
880
|
+
hovered && 'hover',
|
|
881
|
+
activated && 'activated',
|
|
882
|
+
]
|
|
883
|
+
.filter(Boolean)
|
|
884
|
+
.join(' ') })));
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* Returns whether the given knob is at the lower or upper position based
|
|
888
|
+
* on current ratios for the given knob.
|
|
889
|
+
*/
|
|
890
|
+
const getKnobPosition = (knob, ratioA, ratioB, dualKnobs) => {
|
|
891
|
+
if (dualKnobs) {
|
|
892
|
+
if (knob === 'A') {
|
|
893
|
+
return ratioA <= ratioB ? 'lower' : 'upper';
|
|
894
|
+
}
|
|
895
|
+
return ratioB <= ratioA ? 'lower' : 'upper';
|
|
896
|
+
}
|
|
897
|
+
return 'lower';
|
|
788
898
|
};
|
|
789
899
|
const ratioToValue = (ratio, min, max, step) => {
|
|
790
900
|
let value = (max - min) * ratio;
|