@ionic/core 8.7.17-dev.11769628168.11eca7cd → 8.7.17-dev.11770147425.1bfcd5e5
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 +97 -39
- package/dist/cjs/ion-datetime_3.cjs.entry.js +10 -9
- package/dist/cjs/ion-range.cjs.entry.js +95 -39
- 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 +116 -42
- package/dist/docs.json +142 -6
- package/dist/esm/ion-datetime_3.entry.js +10 -9
- package/dist/esm/ion-range.entry.js +95 -39
- 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-b0c2f1f1.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 +24 -4
- package/hydrate/index.js +127 -51
- package/hydrate/index.mjs +127 -51
- package/package.json +1 -1
- package/dist/ionic/p-012212e4.entry.js +0 -4
- package/dist/ionic/p-c19af093.entry.js +0 -4
|
@@ -1397,7 +1397,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1397
1397
|
const todayString = workingParts.day !== null
|
|
1398
1398
|
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1399
1399
|
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1400
|
-
return (h("ion-picker-column", { "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
1400
|
+
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) => {
|
|
1401
1401
|
const { value } = ev.detail;
|
|
1402
1402
|
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
|
1403
1403
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
|
@@ -1472,7 +1472,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1472
1472
|
const { disabled, workingParts } = this;
|
|
1473
1473
|
const activePart = this.getActivePartsWithFallback();
|
|
1474
1474
|
const pickerColumnValue = (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined;
|
|
1475
|
-
return (h("ion-picker-column", { "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
1475
|
+
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) => {
|
|
1476
1476
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
|
1477
1477
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
|
|
1478
1478
|
ev.stopPropagation();
|
|
@@ -1484,7 +1484,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1484
1484
|
}
|
|
1485
1485
|
const { disabled, workingParts } = this;
|
|
1486
1486
|
const activePart = this.getActivePartsWithFallback();
|
|
1487
|
-
return (h("ion-picker-column", { "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
|
|
1487
|
+
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) => {
|
|
1488
1488
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
|
1489
1489
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
|
|
1490
1490
|
ev.stopPropagation();
|
|
@@ -1496,7 +1496,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1496
1496
|
}
|
|
1497
1497
|
const { disabled, workingParts } = this;
|
|
1498
1498
|
const activePart = this.getActivePartsWithFallback();
|
|
1499
|
-
return (h("ion-picker-column", { "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
|
|
1499
|
+
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) => {
|
|
1500
1500
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
|
|
1501
1501
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
|
|
1502
1502
|
ev.stopPropagation();
|
|
@@ -1529,7 +1529,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1529
1529
|
if (hoursData.length === 0)
|
|
1530
1530
|
return [];
|
|
1531
1531
|
const activePart = this.getActivePartsWithFallback();
|
|
1532
|
-
return (h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
1532
|
+
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) => {
|
|
1533
1533
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1534
1534
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
|
|
1535
1535
|
ev.stopPropagation();
|
|
@@ -1540,7 +1540,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1540
1540
|
if (minutesData.length === 0)
|
|
1541
1541
|
return [];
|
|
1542
1542
|
const activePart = this.getActivePartsWithFallback();
|
|
1543
|
-
return (h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
1543
|
+
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) => {
|
|
1544
1544
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1545
1545
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
|
|
1546
1546
|
ev.stopPropagation();
|
|
@@ -1553,7 +1553,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1553
1553
|
}
|
|
1554
1554
|
const activePart = this.getActivePartsWithFallback();
|
|
1555
1555
|
const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
|
|
1556
|
-
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) => {
|
|
1556
|
+
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) => {
|
|
1557
1557
|
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1558
1558
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1559
1559
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
|
|
@@ -1895,7 +1895,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1895
1895
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1896
1896
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1897
1897
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
1898
|
-
return (h(Host, { key: '
|
|
1898
|
+
return (h(Host, { key: '19e20c9b6b5f9467e91a2567b6dc7d9d38b56cc3', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses(color, {
|
|
1899
1899
|
[mode]: true,
|
|
1900
1900
|
['datetime-readonly']: readonly,
|
|
1901
1901
|
['datetime-disabled']: disabled,
|
|
@@ -1905,7 +1905,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1905
1905
|
[`datetime-size-${size}`]: true,
|
|
1906
1906
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1907
1907
|
[`datetime-grid`]: isGridStyle,
|
|
1908
|
-
})) }, h("div", { key: '
|
|
1908
|
+
})) }, h("div", { key: 'e31b5ef76cd6262dafd39f2d21980887880ec32e', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1909
1909
|
}
|
|
1910
1910
|
get el() { return this; }
|
|
1911
1911
|
static get watchers() { return {
|
|
@@ -1981,6 +1981,7 @@ const Datetime = /*@__PURE__*/ proxyCustomElement(class Datetime extends HTMLEle
|
|
|
1981
1981
|
let datetimeIds = 0;
|
|
1982
1982
|
const CANCEL_ROLE = 'datetime-cancel';
|
|
1983
1983
|
const CONFIRM_ROLE = 'datetime-confirm';
|
|
1984
|
+
const WHEEL_PART = 'wheel';
|
|
1984
1985
|
const WHEEL_ITEM_PART = 'wheel-item';
|
|
1985
1986
|
const WHEEL_ITEM_ACTIVE_PART = `active`;
|
|
1986
1987
|
function defineCustomElement$1() {
|
package/components/ion-range.js
CHANGED
|
@@ -79,6 +79,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
79
79
|
this.inheritedAttributes = {};
|
|
80
80
|
this.contentEl = null;
|
|
81
81
|
this.initialContentScrollY = true;
|
|
82
|
+
this.focusFromPointer = false;
|
|
82
83
|
this.ratioA = 0;
|
|
83
84
|
this.ratioB = 0;
|
|
84
85
|
/**
|
|
@@ -210,6 +211,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
210
211
|
this.onBlur = () => {
|
|
211
212
|
if (this.hasFocus) {
|
|
212
213
|
this.hasFocus = false;
|
|
214
|
+
this.focusedKnob = undefined;
|
|
213
215
|
this.ionBlur.emit();
|
|
214
216
|
}
|
|
215
217
|
};
|
|
@@ -220,21 +222,20 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
220
222
|
}
|
|
221
223
|
};
|
|
222
224
|
this.onKnobFocus = (knob) => {
|
|
225
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
226
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
227
|
+
if (!this.focusFromPointer) {
|
|
228
|
+
this.focusedKnob = knob;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
this.focusFromPointer = false;
|
|
232
|
+
this.focusedKnob = undefined;
|
|
233
|
+
}
|
|
234
|
+
// If the knob was not already focused, emit the focus event
|
|
223
235
|
if (!this.hasFocus) {
|
|
224
236
|
this.hasFocus = true;
|
|
225
237
|
this.ionFocus.emit();
|
|
226
238
|
}
|
|
227
|
-
// Manually manage ion-focused class for dual knobs
|
|
228
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
229
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
230
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
231
|
-
// Remove ion-focused from both knobs first
|
|
232
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
233
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
234
|
-
// Add ion-focused only to the focused knob
|
|
235
|
-
const focusedKnobEl = knob === 'A' ? knobA : knobB;
|
|
236
|
-
focusedKnobEl === null || focusedKnobEl === void 0 ? void 0 : focusedKnobEl.classList.add('ion-focused');
|
|
237
|
-
}
|
|
238
239
|
};
|
|
239
240
|
this.onKnobBlur = () => {
|
|
240
241
|
// Check if focus is moving to another knob within the same range
|
|
@@ -246,18 +247,18 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
246
247
|
if (!isStillFocusedOnKnob) {
|
|
247
248
|
if (this.hasFocus) {
|
|
248
249
|
this.hasFocus = false;
|
|
250
|
+
this.focusedKnob = undefined;
|
|
249
251
|
this.ionBlur.emit();
|
|
250
252
|
}
|
|
251
|
-
// Remove ion-focused from both knobs when focus leaves the range
|
|
252
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
253
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
254
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
255
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
256
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
257
|
-
}
|
|
258
253
|
}
|
|
259
254
|
}, 0);
|
|
260
255
|
};
|
|
256
|
+
this.onKnobMouseEnter = (knob) => {
|
|
257
|
+
this.hoveredKnob = knob;
|
|
258
|
+
};
|
|
259
|
+
this.onKnobMouseLeave = () => {
|
|
260
|
+
this.hoveredKnob = undefined;
|
|
261
|
+
};
|
|
261
262
|
}
|
|
262
263
|
debounceChanged() {
|
|
263
264
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -511,7 +512,6 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
511
512
|
ratio = 1 - ratio;
|
|
512
513
|
}
|
|
513
514
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
514
|
-
this.setFocus(this.pressedKnob);
|
|
515
515
|
}
|
|
516
516
|
get valA() {
|
|
517
517
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -538,9 +538,23 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
538
538
|
updateRatio() {
|
|
539
539
|
const value = this.getValue();
|
|
540
540
|
const { min, max } = this;
|
|
541
|
+
/**
|
|
542
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
543
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
544
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
545
|
+
*/
|
|
541
546
|
if (this.dualKnobs) {
|
|
542
|
-
|
|
543
|
-
|
|
547
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
548
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
549
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
550
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
551
|
+
this.ratioA = lowerRatio;
|
|
552
|
+
this.ratioB = upperRatio;
|
|
553
|
+
}
|
|
554
|
+
else {
|
|
555
|
+
this.ratioA = upperRatio;
|
|
556
|
+
this.ratioB = lowerRatio;
|
|
557
|
+
}
|
|
544
558
|
}
|
|
545
559
|
else {
|
|
546
560
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -557,14 +571,6 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
557
571
|
};
|
|
558
572
|
this.noUpdate = false;
|
|
559
573
|
}
|
|
560
|
-
setFocus(knob) {
|
|
561
|
-
if (this.el.shadowRoot) {
|
|
562
|
-
const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
|
|
563
|
-
if (knobEl) {
|
|
564
|
-
knobEl.focus();
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
574
|
/**
|
|
569
575
|
* Returns true if content was passed to the "start" slot
|
|
570
576
|
*/
|
|
@@ -582,7 +588,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
582
588
|
}
|
|
583
589
|
renderRangeSlider() {
|
|
584
590
|
var _a;
|
|
585
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
591
|
+
const { min, max, step, handleKeyboard, focusedKnob, hoveredKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
586
592
|
let barStart = `${ratioLower * 100}%`;
|
|
587
593
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
588
594
|
const rtl = isRTL(this.el);
|
|
@@ -642,7 +648,9 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
642
648
|
ticks.push(tick);
|
|
643
649
|
}
|
|
644
650
|
}
|
|
645
|
-
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
651
|
+
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
652
|
+
this.focusFromPointer = true;
|
|
653
|
+
},
|
|
646
654
|
/**
|
|
647
655
|
* Since the gesture has a threshold, the value
|
|
648
656
|
* won't change until the user has dragged past
|
|
@@ -655,6 +663,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
655
663
|
* we need to listen for the "pointerUp" event.
|
|
656
664
|
*/
|
|
657
665
|
onPointerUp: (ev) => {
|
|
666
|
+
this.focusFromPointer = false;
|
|
658
667
|
/**
|
|
659
668
|
* If the user drags the knob on the web
|
|
660
669
|
* version (does not occur on mobile),
|
|
@@ -680,6 +689,10 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
680
689
|
'has-ticks': ticks.length > 0,
|
|
681
690
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
682
691
|
knob: 'A',
|
|
692
|
+
position: this.dualKnobs ? (this.ratioA <= this.ratioB ? 'lower' : 'upper') : 'lower',
|
|
693
|
+
dualKnobs: this.dualKnobs,
|
|
694
|
+
focused: focusedKnob === 'A',
|
|
695
|
+
hovered: hoveredKnob === 'A',
|
|
683
696
|
pressed: pressedKnob === 'A',
|
|
684
697
|
value: this.valA,
|
|
685
698
|
ratio: this.ratioA,
|
|
@@ -692,9 +705,15 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
692
705
|
inheritedAttributes,
|
|
693
706
|
onKnobFocus: this.onKnobFocus,
|
|
694
707
|
onKnobBlur: this.onKnobBlur,
|
|
708
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
709
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
695
710
|
}), this.dualKnobs &&
|
|
696
711
|
renderKnob(rtl, {
|
|
697
712
|
knob: 'B',
|
|
713
|
+
position: this.ratioB <= this.ratioA ? 'lower' : 'upper',
|
|
714
|
+
dualKnobs: this.dualKnobs,
|
|
715
|
+
focused: focusedKnob === 'B',
|
|
716
|
+
hovered: hoveredKnob === 'B',
|
|
698
717
|
pressed: pressedKnob === 'B',
|
|
699
718
|
value: this.valB,
|
|
700
719
|
ratio: this.ratioB,
|
|
@@ -707,6 +726,8 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
707
726
|
inheritedAttributes,
|
|
708
727
|
onKnobFocus: this.onKnobFocus,
|
|
709
728
|
onKnobBlur: this.onKnobBlur,
|
|
729
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
730
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
710
731
|
})));
|
|
711
732
|
}
|
|
712
733
|
render() {
|
|
@@ -732,10 +753,11 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
732
753
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
733
754
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
734
755
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
735
|
-
return (h(Host, { key: '
|
|
756
|
+
return (h(Host, { key: '4a393e229cf599f3377b606acaebe5f090d41f6e', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses(this.color, {
|
|
736
757
|
[mode]: true,
|
|
737
758
|
'in-item': inItem,
|
|
738
759
|
'range-disabled': disabled,
|
|
760
|
+
'range-dual-knobs': dualKnobs,
|
|
739
761
|
'range-pressed': pressedKnob !== undefined,
|
|
740
762
|
'range-has-pin': pin,
|
|
741
763
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
@@ -743,10 +765,10 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
743
765
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
744
766
|
'range-value-min': valueAtMin,
|
|
745
767
|
'range-value-max': valueAtMax,
|
|
746
|
-
}) }, h("label", { key: '
|
|
768
|
+
}) }, h("label", { key: 'd7f45882aa7f11bbac1cb783caa0053151efcc70', class: "range-wrapper", id: "range-label" }, h("div", { key: '537d3b1e7f9fed0c8380678551e31325b1ef1f85', class: {
|
|
747
769
|
'label-text-wrapper': true,
|
|
748
770
|
'label-text-wrapper-hidden': !hasLabel,
|
|
749
|
-
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '
|
|
771
|
+
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: 'cb50f07a3704d04af3554211ffad35f7d9fcc450', class: "native-wrapper" }, h("slot", { key: '09004eaa72688ca0f0536bd5f5d7160a23d16406', name: "start" }), this.renderRangeSlider(), h("slot", { key: 'a94da21d2ea7ed2feafcc0651c72da21d6de1e57', name: "end" })))));
|
|
750
772
|
}
|
|
751
773
|
get el() { return this; }
|
|
752
774
|
static get watchers() { return {
|
|
@@ -781,6 +803,8 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
781
803
|
"labelPlacement": [1, "label-placement"],
|
|
782
804
|
"ratioA": [32],
|
|
783
805
|
"ratioB": [32],
|
|
806
|
+
"focusedKnob": [32],
|
|
807
|
+
"hoveredKnob": [32],
|
|
784
808
|
"pressedKnob": [32]
|
|
785
809
|
}, undefined, {
|
|
786
810
|
"debounce": ["debounceChanged"],
|
|
@@ -791,7 +815,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
791
815
|
"disabled": ["disabledChanged"],
|
|
792
816
|
"value": ["valueChanged"]
|
|
793
817
|
}]);
|
|
794
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
818
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, pressed, focused, hovered, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, onKnobMouseEnter, onKnobMouseLeave, }) => {
|
|
795
819
|
const start = rtl ? 'right' : 'left';
|
|
796
820
|
const knobStyle = () => {
|
|
797
821
|
const style = {};
|
|
@@ -812,16 +836,50 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
812
836
|
ev.preventDefault();
|
|
813
837
|
ev.stopPropagation();
|
|
814
838
|
}
|
|
815
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
839
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
816
840
|
'range-knob-handle': true,
|
|
817
|
-
'range-knob-a': knob === 'A',
|
|
818
|
-
'range-knob-b': knob === 'B',
|
|
841
|
+
'range-knob-handle-a': knob === 'A',
|
|
842
|
+
'range-knob-handle-b': knob === 'B',
|
|
819
843
|
'range-knob-pressed': pressed,
|
|
820
844
|
'range-knob-min': value === min,
|
|
821
845
|
'range-knob-max': value === max,
|
|
822
846
|
'ion-activatable': true,
|
|
823
847
|
'ion-focusable': true,
|
|
824
|
-
|
|
848
|
+
'ion-focused': focused,
|
|
849
|
+
}, part: [
|
|
850
|
+
'knob-handle',
|
|
851
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
852
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
853
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
854
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
855
|
+
pressed && 'pressed',
|
|
856
|
+
focused && 'focused',
|
|
857
|
+
hovered && 'hover',
|
|
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
|
+
]
|
|
870
|
+
.filter(Boolean)
|
|
871
|
+
.join(' ') }, pinFormatter(value))), h("div", { class: "range-knob", role: "presentation", part: [
|
|
872
|
+
'knob',
|
|
873
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
874
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
875
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
876
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
877
|
+
pressed && 'pressed',
|
|
878
|
+
focused && 'focused',
|
|
879
|
+
hovered && 'hover',
|
|
880
|
+
]
|
|
881
|
+
.filter(Boolean)
|
|
882
|
+
.join(' ') })));
|
|
825
883
|
};
|
|
826
884
|
const ratioToValue = (ratio, min, max, step) => {
|
|
827
885
|
let value = (max - min) * ratio;
|
|
@@ -1393,7 +1393,7 @@ const Datetime = class {
|
|
|
1393
1393
|
const todayString = workingParts.day !== null
|
|
1394
1394
|
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
1395
1395
|
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
1396
|
-
return (index.h("ion-picker-column", { "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
1396
|
+
return (index.h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
1397
1397
|
const { value } = ev.detail;
|
|
1398
1398
|
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
|
1399
1399
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
|
@@ -1468,7 +1468,7 @@ const Datetime = class {
|
|
|
1468
1468
|
const { disabled, workingParts } = this;
|
|
1469
1469
|
const activePart = this.getActivePartsWithFallback();
|
|
1470
1470
|
const pickerColumnValue = (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined;
|
|
1471
|
-
return (index.h("ion-picker-column", { "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
1471
|
+
return (index.h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
1472
1472
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
|
1473
1473
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
|
|
1474
1474
|
ev.stopPropagation();
|
|
@@ -1480,7 +1480,7 @@ const Datetime = class {
|
|
|
1480
1480
|
}
|
|
1481
1481
|
const { disabled, workingParts } = this;
|
|
1482
1482
|
const activePart = this.getActivePartsWithFallback();
|
|
1483
|
-
return (index.h("ion-picker-column", { "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
|
|
1483
|
+
return (index.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) => {
|
|
1484
1484
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
|
1485
1485
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
|
|
1486
1486
|
ev.stopPropagation();
|
|
@@ -1492,7 +1492,7 @@ const Datetime = class {
|
|
|
1492
1492
|
}
|
|
1493
1493
|
const { disabled, workingParts } = this;
|
|
1494
1494
|
const activePart = this.getActivePartsWithFallback();
|
|
1495
|
-
return (index.h("ion-picker-column", { "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
|
|
1495
|
+
return (index.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) => {
|
|
1496
1496
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
|
|
1497
1497
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
|
|
1498
1498
|
ev.stopPropagation();
|
|
@@ -1525,7 +1525,7 @@ const Datetime = class {
|
|
|
1525
1525
|
if (hoursData.length === 0)
|
|
1526
1526
|
return [];
|
|
1527
1527
|
const activePart = this.getActivePartsWithFallback();
|
|
1528
|
-
return (index.h("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
1528
|
+
return (index.h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
1529
1529
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
1530
1530
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
|
|
1531
1531
|
ev.stopPropagation();
|
|
@@ -1536,7 +1536,7 @@ const Datetime = class {
|
|
|
1536
1536
|
if (minutesData.length === 0)
|
|
1537
1537
|
return [];
|
|
1538
1538
|
const activePart = this.getActivePartsWithFallback();
|
|
1539
|
-
return (index.h("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
1539
|
+
return (index.h("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
1540
1540
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
1541
1541
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
|
|
1542
1542
|
ev.stopPropagation();
|
|
@@ -1549,7 +1549,7 @@ const Datetime = class {
|
|
|
1549
1549
|
}
|
|
1550
1550
|
const activePart = this.getActivePartsWithFallback();
|
|
1551
1551
|
const isDayPeriodRTL = data.isLocaleDayPeriodRTL(this.locale);
|
|
1552
|
-
return (index.h("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
1552
|
+
return (index.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) => {
|
|
1553
1553
|
const hour = data.calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
1554
1554
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
1555
1555
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
|
|
@@ -1891,7 +1891,7 @@ const Datetime = class {
|
|
|
1891
1891
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
1892
1892
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
1893
1893
|
helpers.renderHiddenInput(true, el, name, data.formatValue(value), disabled);
|
|
1894
|
-
return (index.h(index.Host, { key: '
|
|
1894
|
+
return (index.h(index.Host, { key: '19e20c9b6b5f9467e91a2567b6dc7d9d38b56cc3', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, theme.createColorClasses(color, {
|
|
1895
1895
|
[mode]: true,
|
|
1896
1896
|
['datetime-readonly']: readonly,
|
|
1897
1897
|
['datetime-disabled']: disabled,
|
|
@@ -1901,7 +1901,7 @@ const Datetime = class {
|
|
|
1901
1901
|
[`datetime-size-${size}`]: true,
|
|
1902
1902
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
1903
1903
|
[`datetime-grid`]: isGridStyle,
|
|
1904
|
-
})) }, index.h("div", { key: '
|
|
1904
|
+
})) }, index.h("div", { key: 'e31b5ef76cd6262dafd39f2d21980887880ec32e', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
1905
1905
|
}
|
|
1906
1906
|
get el() { return index.getElement(this); }
|
|
1907
1907
|
static get watchers() { return {
|
|
@@ -1921,6 +1921,7 @@ const Datetime = class {
|
|
|
1921
1921
|
let datetimeIds = 0;
|
|
1922
1922
|
const CANCEL_ROLE = 'datetime-cancel';
|
|
1923
1923
|
const CONFIRM_ROLE = 'datetime-confirm';
|
|
1924
|
+
const WHEEL_PART = 'wheel';
|
|
1924
1925
|
const WHEEL_ITEM_PART = 'wheel-item';
|
|
1925
1926
|
const WHEEL_ITEM_ACTIVE_PART = `active`;
|
|
1926
1927
|
Datetime.style = {
|