@ionic/core 8.7.17-dev.11769628168.11eca7cd → 8.7.17-dev.11769813102.16c5bfac
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-datetime.js +10 -9
- package/components/ion-range.js +81 -39
- package/dist/cjs/ion-datetime_3.cjs.entry.js +10 -9
- package/dist/cjs/ion-range.cjs.entry.js +79 -38
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/datetime/datetime.js +11 -9
- package/dist/collection/components/range/range.js +99 -42
- package/dist/docs.json +134 -6
- package/dist/esm/ion-datetime_3.entry.js +10 -9
- package/dist/esm/ion-range.entry.js +79 -38
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-29721c43.entry.js +4 -0
- package/dist/ionic/p-73ecefff.entry.js +4 -0
- package/dist/types/components/datetime/datetime.d.ts +1 -0
- package/dist/types/components/range/range-interface.d.ts +1 -0
- package/dist/types/components/range/range.d.ts +20 -4
- package/hydrate/index.js +110 -51
- package/hydrate/index.mjs +110 -51
- package/package.json +1 -1
- package/dist/ionic/p-012212e4.entry.js +0 -4
- package/dist/ionic/p-c19af093.entry.js +0 -4
package/dist/docs.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2026-01-
|
|
2
|
+
"timestamp": "2026-01-30T22:46:49",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.38.0",
|
|
@@ -8401,6 +8401,10 @@
|
|
|
8401
8401
|
"name": "slot",
|
|
8402
8402
|
"text": "time-label - The label for the time selector in the datetime."
|
|
8403
8403
|
},
|
|
8404
|
+
{
|
|
8405
|
+
"name": "part",
|
|
8406
|
+
"text": "wheel - The wheel container when using a wheel style layout, or in the month/year picker when using a grid style layout."
|
|
8407
|
+
},
|
|
8404
8408
|
{
|
|
8405
8409
|
"name": "part",
|
|
8406
8410
|
"text": "wheel-item - The individual items when using a wheel style layout, or in the\nmonth/year picker when using a grid style layout."
|
|
@@ -9793,6 +9797,10 @@
|
|
|
9793
9797
|
"name": "time-button active",
|
|
9794
9798
|
"docs": "The time picker button when the picker is open."
|
|
9795
9799
|
},
|
|
9800
|
+
{
|
|
9801
|
+
"name": "wheel",
|
|
9802
|
+
"docs": "The wheel container when using a wheel style layout, or in the month/year picker when using a grid style layout."
|
|
9803
|
+
},
|
|
9796
9804
|
{
|
|
9797
9805
|
"name": "wheel-item",
|
|
9798
9806
|
"docs": "The individual items when using a wheel style layout, or in the\nmonth/year picker when using a grid style layout."
|
|
@@ -25540,6 +25548,10 @@
|
|
|
25540
25548
|
"name": "slot",
|
|
25541
25549
|
"text": "end - Content is placed to the right of the range slider in LTR, and to the left in RTL."
|
|
25542
25550
|
},
|
|
25551
|
+
{
|
|
25552
|
+
"name": "part",
|
|
25553
|
+
"text": "label - The label text describing the range."
|
|
25554
|
+
},
|
|
25543
25555
|
{
|
|
25544
25556
|
"name": "part",
|
|
25545
25557
|
"text": "tick - An inactive tick mark."
|
|
@@ -25548,25 +25560,81 @@
|
|
|
25548
25560
|
"name": "part",
|
|
25549
25561
|
"text": "tick-active - An active tick mark."
|
|
25550
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
|
+
},
|
|
25551
25591
|
{
|
|
25552
25592
|
"name": "part",
|
|
25553
25593
|
"text": "pin - The counter that appears above a knob."
|
|
25554
25594
|
},
|
|
25555
25595
|
{
|
|
25556
25596
|
"name": "part",
|
|
25557
|
-
"text": "
|
|
25597
|
+
"text": "pin-a - The counter that appears above the first knob. Only available when `dualKnobs` is `true`."
|
|
25558
25598
|
},
|
|
25559
25599
|
{
|
|
25560
25600
|
"name": "part",
|
|
25561
|
-
"text": "
|
|
25601
|
+
"text": "pin-b - The counter that appears above the second knob. Only available when `dualKnobs` is `true`."
|
|
25562
25602
|
},
|
|
25563
25603
|
{
|
|
25564
25604
|
"name": "part",
|
|
25565
|
-
"text": "
|
|
25605
|
+
"text": "pin-lower - The counter that appears above the lower knob. Only available when `dualKnobs` is `true`."
|
|
25566
25606
|
},
|
|
25567
25607
|
{
|
|
25568
25608
|
"name": "part",
|
|
25569
|
-
"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": "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."
|
|
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."
|
|
25570
25638
|
}
|
|
25571
25639
|
],
|
|
25572
25640
|
"usage": {},
|
|
@@ -26386,9 +26454,49 @@
|
|
|
26386
26454
|
"name": "bar-active",
|
|
26387
26455
|
"docs": "The active part of the bar."
|
|
26388
26456
|
},
|
|
26457
|
+
{
|
|
26458
|
+
"name": "focused",
|
|
26459
|
+
"docs": "Added to the knob-handle, knob, and pin that currently has focus. Only one set has this part at a time."
|
|
26460
|
+
},
|
|
26389
26461
|
{
|
|
26390
26462
|
"name": "knob",
|
|
26391
|
-
"docs": "The
|
|
26463
|
+
"docs": "The visual knob element that appears on the range track."
|
|
26464
|
+
},
|
|
26465
|
+
{
|
|
26466
|
+
"name": "knob-a",
|
|
26467
|
+
"docs": "The visual knob element for the first knob. Only available when `dualKnobs` is `true`."
|
|
26468
|
+
},
|
|
26469
|
+
{
|
|
26470
|
+
"name": "knob-b",
|
|
26471
|
+
"docs": "The visual knob element for the second knob. Only available when `dualKnobs` is `true`."
|
|
26472
|
+
},
|
|
26473
|
+
{
|
|
26474
|
+
"name": "knob-handle",
|
|
26475
|
+
"docs": "The container element that wraps the knob and handles drag interactions."
|
|
26476
|
+
},
|
|
26477
|
+
{
|
|
26478
|
+
"name": "knob-handle-a",
|
|
26479
|
+
"docs": "The container element for the first knob. Only available when `dualKnobs` is `true`."
|
|
26480
|
+
},
|
|
26481
|
+
{
|
|
26482
|
+
"name": "knob-handle-b",
|
|
26483
|
+
"docs": "The container element for the second knob. Only available when `dualKnobs` is `true`."
|
|
26484
|
+
},
|
|
26485
|
+
{
|
|
26486
|
+
"name": "knob-handle-lower",
|
|
26487
|
+
"docs": "The container element for the lower knob. Only available when `dualKnobs` is `true`."
|
|
26488
|
+
},
|
|
26489
|
+
{
|
|
26490
|
+
"name": "knob-handle-upper",
|
|
26491
|
+
"docs": "The container element for the upper knob. Only available when `dualKnobs` is `true`."
|
|
26492
|
+
},
|
|
26493
|
+
{
|
|
26494
|
+
"name": "knob-lower",
|
|
26495
|
+
"docs": "The visual knob element for the lower knob. Only available when `dualKnobs` is `true`."
|
|
26496
|
+
},
|
|
26497
|
+
{
|
|
26498
|
+
"name": "knob-upper",
|
|
26499
|
+
"docs": "The visual knob element for the upper knob. Only available when `dualKnobs` is `true`."
|
|
26392
26500
|
},
|
|
26393
26501
|
{
|
|
26394
26502
|
"name": "label",
|
|
@@ -26398,6 +26506,26 @@
|
|
|
26398
26506
|
"name": "pin",
|
|
26399
26507
|
"docs": "The counter that appears above a knob."
|
|
26400
26508
|
},
|
|
26509
|
+
{
|
|
26510
|
+
"name": "pin-a",
|
|
26511
|
+
"docs": "The counter that appears above the first knob. Only available when `dualKnobs` is `true`."
|
|
26512
|
+
},
|
|
26513
|
+
{
|
|
26514
|
+
"name": "pin-b",
|
|
26515
|
+
"docs": "The counter that appears above the second knob. Only available when `dualKnobs` is `true`."
|
|
26516
|
+
},
|
|
26517
|
+
{
|
|
26518
|
+
"name": "pin-lower",
|
|
26519
|
+
"docs": "The counter that appears above the lower knob. Only available when `dualKnobs` is `true`."
|
|
26520
|
+
},
|
|
26521
|
+
{
|
|
26522
|
+
"name": "pin-upper",
|
|
26523
|
+
"docs": "The counter that appears above the upper knob. Only available when `dualKnobs` is `true`."
|
|
26524
|
+
},
|
|
26525
|
+
{
|
|
26526
|
+
"name": "pressed",
|
|
26527
|
+
"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."
|
|
26528
|
+
},
|
|
26401
26529
|
{
|
|
26402
26530
|
"name": "tick",
|
|
26403
26531
|
"docs": "An inactive tick mark."
|
|
@@ -1391,7 +1391,7 @@ const Datetime = class {
|
|
|
1391
1391
|
const todayString = workingParts.day !== null
|
|
1392
1392
|
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1393
1393
|
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1394
|
-
return (h("ion-picker-column", { "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
1394
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
1395
1395
|
const { value } = ev.detail;
|
|
1396
1396
|
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
|
1397
1397
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
|
@@ -1466,7 +1466,7 @@ const Datetime = class {
|
|
|
1466
1466
|
const { disabled, workingParts } = this;
|
|
1467
1467
|
const activePart = this.getActivePartsWithFallback();
|
|
1468
1468
|
const pickerColumnValue = (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined;
|
|
1469
|
-
return (h("ion-picker-column", { "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
1469
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
1470
1470
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
|
1471
1471
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
|
|
1472
1472
|
ev.stopPropagation();
|
|
@@ -1478,7 +1478,7 @@ const Datetime = class {
|
|
|
1478
1478
|
}
|
|
1479
1479
|
const { disabled, workingParts } = this;
|
|
1480
1480
|
const activePart = this.getActivePartsWithFallback();
|
|
1481
|
-
return (h("ion-picker-column", { "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
|
|
1481
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
|
|
1482
1482
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
|
1483
1483
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
|
|
1484
1484
|
ev.stopPropagation();
|
|
@@ -1490,7 +1490,7 @@ const Datetime = class {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
const { disabled, workingParts } = this;
|
|
1492
1492
|
const activePart = this.getActivePartsWithFallback();
|
|
1493
|
-
return (h("ion-picker-column", { "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
|
|
1493
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
|
|
1494
1494
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
|
|
1495
1495
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
|
|
1496
1496
|
ev.stopPropagation();
|
|
@@ -1523,7 +1523,7 @@ const Datetime = class {
|
|
|
1523
1523
|
if (hoursData.length === 0)
|
|
1524
1524
|
return [];
|
|
1525
1525
|
const activePart = this.getActivePartsWithFallback();
|
|
1526
|
-
return (h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
1526
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
1527
1527
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1528
1528
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
|
|
1529
1529
|
ev.stopPropagation();
|
|
@@ -1534,7 +1534,7 @@ const Datetime = class {
|
|
|
1534
1534
|
if (minutesData.length === 0)
|
|
1535
1535
|
return [];
|
|
1536
1536
|
const activePart = this.getActivePartsWithFallback();
|
|
1537
|
-
return (h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
1537
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
1538
1538
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1539
1539
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
|
|
1540
1540
|
ev.stopPropagation();
|
|
@@ -1547,7 +1547,7 @@ const Datetime = class {
|
|
|
1547
1547
|
}
|
|
1548
1548
|
const activePart = this.getActivePartsWithFallback();
|
|
1549
1549
|
const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
|
|
1550
|
-
return (h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
1550
|
+
return (h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
1551
1551
|
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1552
1552
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1553
1553
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
|
|
@@ -1889,7 +1889,7 @@ const Datetime = class {
|
|
|
1889
1889
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1890
1890
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1891
1891
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1892
|
-
return (h(Host, { key: '
|
|
1892
|
+
return (h(Host, { key: '19e20c9b6b5f9467e91a2567b6dc7d9d38b56cc3', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1893
1893
|
[mode]: true,
|
|
1894
1894
|
['datetime-readonly']: readonly,
|
|
1895
1895
|
['datetime-disabled']: disabled,
|
|
@@ -1899,7 +1899,7 @@ const Datetime = class {
|
|
|
1899
1899
|
[`datetime-size-${size}`]: true,
|
|
1900
1900
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1901
1901
|
[`datetime-grid`]: isGridStyle,
|
|
1902
|
-
})) }, h("div", { key: '
|
|
1902
|
+
})) }, h("div", { key: 'e31b5ef76cd6262dafd39f2d21980887880ec32e', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1903
1903
|
}
|
|
1904
1904
|
get el() { return getElement(this); }
|
|
1905
1905
|
static get watchers() { return {
|
|
@@ -1919,6 +1919,7 @@ const Datetime = class {
|
|
|
1919
1919
|
let datetimeIds = 0;
|
|
1920
1920
|
const CANCEL_ROLE = 'datetime-cancel';
|
|
1921
1921
|
const CONFIRM_ROLE = 'datetime-confirm';
|
|
1922
|
+
const WHEEL_PART = 'wheel';
|
|
1922
1923
|
const WHEEL_ITEM_PART = 'wheel-item';
|
|
1923
1924
|
const WHEEL_ITEM_ACTIVE_PART = `active`;
|
|
1924
1925
|
Datetime.style = {
|
|
@@ -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
|
/**
|
|
@@ -205,6 +206,7 @@ const Range = class {
|
|
|
205
206
|
this.onBlur = () => {
|
|
206
207
|
if (this.hasFocus) {
|
|
207
208
|
this.hasFocus = false;
|
|
209
|
+
this.focusedKnob = undefined;
|
|
208
210
|
this.ionBlur.emit();
|
|
209
211
|
}
|
|
210
212
|
};
|
|
@@ -215,21 +217,20 @@ const Range = class {
|
|
|
215
217
|
}
|
|
216
218
|
};
|
|
217
219
|
this.onKnobFocus = (knob) => {
|
|
220
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
221
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
222
|
+
if (!this.focusFromPointer) {
|
|
223
|
+
this.focusedKnob = knob;
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
this.focusFromPointer = false;
|
|
227
|
+
this.focusedKnob = undefined;
|
|
228
|
+
}
|
|
229
|
+
// If the knob was not already focused, emit the focus event
|
|
218
230
|
if (!this.hasFocus) {
|
|
219
231
|
this.hasFocus = true;
|
|
220
232
|
this.ionFocus.emit();
|
|
221
233
|
}
|
|
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
234
|
};
|
|
234
235
|
this.onKnobBlur = () => {
|
|
235
236
|
// Check if focus is moving to another knob within the same range
|
|
@@ -241,15 +242,9 @@ const Range = class {
|
|
|
241
242
|
if (!isStillFocusedOnKnob) {
|
|
242
243
|
if (this.hasFocus) {
|
|
243
244
|
this.hasFocus = false;
|
|
245
|
+
this.focusedKnob = undefined;
|
|
244
246
|
this.ionBlur.emit();
|
|
245
247
|
}
|
|
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
248
|
}
|
|
254
249
|
}, 0);
|
|
255
250
|
};
|
|
@@ -506,7 +501,6 @@ const Range = class {
|
|
|
506
501
|
ratio = 1 - ratio;
|
|
507
502
|
}
|
|
508
503
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
509
|
-
this.setFocus(this.pressedKnob);
|
|
510
504
|
}
|
|
511
505
|
get valA() {
|
|
512
506
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -533,9 +527,23 @@ const Range = class {
|
|
|
533
527
|
updateRatio() {
|
|
534
528
|
const value = this.getValue();
|
|
535
529
|
const { min, max } = this;
|
|
530
|
+
/**
|
|
531
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
532
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
533
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
534
|
+
*/
|
|
536
535
|
if (this.dualKnobs) {
|
|
537
|
-
|
|
538
|
-
|
|
536
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
537
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
538
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
539
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
540
|
+
this.ratioA = lowerRatio;
|
|
541
|
+
this.ratioB = upperRatio;
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
this.ratioA = upperRatio;
|
|
545
|
+
this.ratioB = lowerRatio;
|
|
546
|
+
}
|
|
539
547
|
}
|
|
540
548
|
else {
|
|
541
549
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -552,14 +560,6 @@ const Range = class {
|
|
|
552
560
|
};
|
|
553
561
|
this.noUpdate = false;
|
|
554
562
|
}
|
|
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
563
|
/**
|
|
564
564
|
* Returns true if content was passed to the "start" slot
|
|
565
565
|
*/
|
|
@@ -577,7 +577,7 @@ const Range = class {
|
|
|
577
577
|
}
|
|
578
578
|
renderRangeSlider() {
|
|
579
579
|
var _a;
|
|
580
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
580
|
+
const { min, max, step, handleKeyboard, focusedKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
581
581
|
let barStart = `${ratioLower * 100}%`;
|
|
582
582
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
583
583
|
const rtl = isRTL(this.el);
|
|
@@ -637,7 +637,9 @@ const Range = class {
|
|
|
637
637
|
ticks.push(tick);
|
|
638
638
|
}
|
|
639
639
|
}
|
|
640
|
-
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
640
|
+
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
641
|
+
this.focusFromPointer = true;
|
|
642
|
+
},
|
|
641
643
|
/**
|
|
642
644
|
* Since the gesture has a threshold, the value
|
|
643
645
|
* won't change until the user has dragged past
|
|
@@ -650,6 +652,7 @@ const Range = class {
|
|
|
650
652
|
* we need to listen for the "pointerUp" event.
|
|
651
653
|
*/
|
|
652
654
|
onPointerUp: (ev) => {
|
|
655
|
+
this.focusFromPointer = false;
|
|
653
656
|
/**
|
|
654
657
|
* If the user drags the knob on the web
|
|
655
658
|
* version (does not occur on mobile),
|
|
@@ -675,7 +678,10 @@ const Range = class {
|
|
|
675
678
|
'has-ticks': ticks.length > 0,
|
|
676
679
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
677
680
|
knob: 'A',
|
|
681
|
+
position: this.dualKnobs ? (this.ratioA <= this.ratioB ? 'lower' : 'upper') : 'lower',
|
|
682
|
+
dualKnobs: this.dualKnobs,
|
|
678
683
|
pressed: pressedKnob === 'A',
|
|
684
|
+
focused: focusedKnob === 'A',
|
|
679
685
|
value: this.valA,
|
|
680
686
|
ratio: this.ratioA,
|
|
681
687
|
pin,
|
|
@@ -690,7 +696,10 @@ const Range = class {
|
|
|
690
696
|
}), this.dualKnobs &&
|
|
691
697
|
renderKnob(rtl, {
|
|
692
698
|
knob: 'B',
|
|
699
|
+
position: this.ratioB <= this.ratioA ? 'lower' : 'upper',
|
|
700
|
+
dualKnobs: this.dualKnobs,
|
|
693
701
|
pressed: pressedKnob === 'B',
|
|
702
|
+
focused: focusedKnob === 'B',
|
|
694
703
|
value: this.valB,
|
|
695
704
|
ratio: this.ratioB,
|
|
696
705
|
pin,
|
|
@@ -727,10 +736,11 @@ const Range = class {
|
|
|
727
736
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
728
737
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
729
738
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
730
|
-
return (h(Host, { key: '
|
|
739
|
+
return (h(Host, { key: '6f3ac66d528c499f840afd31fa3958f2749c9ff5', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses(this.color, {
|
|
731
740
|
[mode]: true,
|
|
732
741
|
'in-item': inItem,
|
|
733
742
|
'range-disabled': disabled,
|
|
743
|
+
'range-dual-knobs': dualKnobs,
|
|
734
744
|
'range-pressed': pressedKnob !== undefined,
|
|
735
745
|
'range-has-pin': pin,
|
|
736
746
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
@@ -738,10 +748,10 @@ const Range = class {
|
|
|
738
748
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
739
749
|
'range-value-min': valueAtMin,
|
|
740
750
|
'range-value-max': valueAtMax,
|
|
741
|
-
}) }, h("label", { key: '
|
|
751
|
+
}) }, h("label", { key: 'a33e928dc37228bd4e1c4d3f804a7bb49d484088', class: "range-wrapper", id: "range-label" }, h("div", { key: '5d4b885fd1a87621734244701838f86d5145b914', class: {
|
|
742
752
|
'label-text-wrapper': true,
|
|
743
753
|
'label-text-wrapper-hidden': !hasLabel,
|
|
744
|
-
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '
|
|
754
|
+
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '335a10bdb191a179c426ecba3541adada6d6aeb8', class: "native-wrapper" }, h("slot", { key: '57dc846d33d0e1b1f4f18fc8553dc7fa2cca70bf', name: "start" }), this.renderRangeSlider(), h("slot", { key: '57f85044b4f507015d905a73dca9d13a224560b1', name: "end" })))));
|
|
745
755
|
}
|
|
746
756
|
get el() { return getElement(this); }
|
|
747
757
|
static get watchers() { return {
|
|
@@ -754,7 +764,7 @@ const Range = class {
|
|
|
754
764
|
"value": ["valueChanged"]
|
|
755
765
|
}; }
|
|
756
766
|
};
|
|
757
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
767
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, pressed, focused, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
758
768
|
const start = rtl ? 'right' : 'left';
|
|
759
769
|
const knobStyle = () => {
|
|
760
770
|
const style = {};
|
|
@@ -777,14 +787,45 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
777
787
|
}
|
|
778
788
|
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
779
789
|
'range-knob-handle': true,
|
|
780
|
-
'range-knob-a': knob === 'A',
|
|
781
|
-
'range-knob-b': knob === 'B',
|
|
790
|
+
'range-knob-handle-a': knob === 'A',
|
|
791
|
+
'range-knob-handle-b': knob === 'B',
|
|
782
792
|
'range-knob-pressed': pressed,
|
|
783
793
|
'range-knob-min': value === min,
|
|
784
794
|
'range-knob-max': value === max,
|
|
785
795
|
'ion-activatable': true,
|
|
786
796
|
'ion-focusable': true,
|
|
787
|
-
|
|
797
|
+
'ion-focused': focused,
|
|
798
|
+
}, part: [
|
|
799
|
+
'knob-handle',
|
|
800
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
801
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
802
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
803
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
804
|
+
pressed && 'pressed',
|
|
805
|
+
focused && 'focused',
|
|
806
|
+
]
|
|
807
|
+
.filter(Boolean)
|
|
808
|
+
.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: [
|
|
809
|
+
'pin',
|
|
810
|
+
dualKnobs && knob === 'A' && 'pin-a',
|
|
811
|
+
dualKnobs && knob === 'B' && 'pin-b',
|
|
812
|
+
dualKnobs && position === 'lower' && 'pin-lower',
|
|
813
|
+
dualKnobs && position === 'upper' && 'pin-upper',
|
|
814
|
+
pressed && 'pressed',
|
|
815
|
+
focused && 'focused',
|
|
816
|
+
]
|
|
817
|
+
.filter(Boolean)
|
|
818
|
+
.join(' ') }, pinFormatter(value))), h("div", { class: "range-knob", role: "presentation", part: [
|
|
819
|
+
'knob',
|
|
820
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
821
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
822
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
823
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
824
|
+
pressed && 'pressed',
|
|
825
|
+
focused && 'focused',
|
|
826
|
+
]
|
|
827
|
+
.filter(Boolean)
|
|
828
|
+
.join(' ') })));
|
|
788
829
|
};
|
|
789
830
|
const ratioToValue = (ratio, min, max, step) => {
|
|
790
831
|
let value = (max - min) * ratio;
|