@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
package/hydrate/index.js
CHANGED
|
@@ -12871,6 +12871,7 @@ const datetimeMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:colu
|
|
|
12871
12871
|
* @slot buttons - The buttons in the datetime.
|
|
12872
12872
|
* @slot time-label - The label for the time selector in the datetime.
|
|
12873
12873
|
*
|
|
12874
|
+
* @part wheel - The wheel container when using a wheel style layout, or in the month/year picker when using a grid style layout.
|
|
12874
12875
|
* @part wheel-item - The individual items when using a wheel style layout, or in the
|
|
12875
12876
|
* month/year picker when using a grid style layout.
|
|
12876
12877
|
* @part wheel-item active - The currently selected wheel-item.
|
|
@@ -14046,7 +14047,7 @@ class Datetime {
|
|
|
14046
14047
|
const todayString = workingParts.day !== null
|
|
14047
14048
|
? `${workingParts.year}-${workingParts.month}-${workingParts.day}`
|
|
14048
14049
|
: `${defaultParts.year}-${defaultParts.month}-${defaultParts.day}`;
|
|
14049
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
14050
|
+
return (hAsync("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a date", class: "date-column", color: this.color, disabled: disabled, value: todayString, onIonChange: (ev) => {
|
|
14050
14051
|
const { value } = ev.detail;
|
|
14051
14052
|
const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`);
|
|
14052
14053
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), findPart));
|
|
@@ -14121,7 +14122,7 @@ class Datetime {
|
|
|
14121
14122
|
const { disabled, workingParts } = this;
|
|
14122
14123
|
const activePart = this.getActivePartsWithFallback();
|
|
14123
14124
|
const pickerColumnValue = (_a = (workingParts.day !== null ? workingParts.day : this.defaultParts.day)) !== null && _a !== void 0 ? _a : undefined;
|
|
14124
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
14125
|
+
return (hAsync("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a day", class: "day-column", color: this.color, disabled: disabled, value: pickerColumnValue, onIonChange: (ev) => {
|
|
14125
14126
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { day: ev.detail.value }));
|
|
14126
14127
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { day: ev.detail.value }));
|
|
14127
14128
|
ev.stopPropagation();
|
|
@@ -14133,7 +14134,7 @@ class Datetime {
|
|
|
14133
14134
|
}
|
|
14134
14135
|
const { disabled, workingParts } = this;
|
|
14135
14136
|
const activePart = this.getActivePartsWithFallback();
|
|
14136
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
|
|
14137
|
+
return (hAsync("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a month", class: "month-column", color: this.color, disabled: disabled, value: workingParts.month, onIonChange: (ev) => {
|
|
14137
14138
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { month: ev.detail.value }));
|
|
14138
14139
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { month: ev.detail.value }));
|
|
14139
14140
|
ev.stopPropagation();
|
|
@@ -14145,7 +14146,7 @@ class Datetime {
|
|
|
14145
14146
|
}
|
|
14146
14147
|
const { disabled, workingParts } = this;
|
|
14147
14148
|
const activePart = this.getActivePartsWithFallback();
|
|
14148
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
|
|
14149
|
+
return (hAsync("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a year", class: "year-column", color: this.color, disabled: disabled, value: workingParts.year, onIonChange: (ev) => {
|
|
14149
14150
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { year: ev.detail.value }));
|
|
14150
14151
|
this.setActiveParts(Object.assign(Object.assign({}, activePart), { year: ev.detail.value }));
|
|
14151
14152
|
ev.stopPropagation();
|
|
@@ -14178,7 +14179,7 @@ class Datetime {
|
|
|
14178
14179
|
if (hoursData.length === 0)
|
|
14179
14180
|
return [];
|
|
14180
14181
|
const activePart = this.getActivePartsWithFallback();
|
|
14181
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
14182
|
+
return (hAsync("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select an hour", color: this.color, disabled: disabled, value: activePart.hour, numericInput: true, onIonChange: (ev) => {
|
|
14182
14183
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { hour: ev.detail.value }));
|
|
14183
14184
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { hour: ev.detail.value }));
|
|
14184
14185
|
ev.stopPropagation();
|
|
@@ -14189,7 +14190,7 @@ class Datetime {
|
|
|
14189
14190
|
if (minutesData.length === 0)
|
|
14190
14191
|
return [];
|
|
14191
14192
|
const activePart = this.getActivePartsWithFallback();
|
|
14192
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
14193
|
+
return (hAsync("ion-picker-column", { part: WHEEL_PART, "aria-label": "Select a minute", color: this.color, disabled: disabled, value: activePart.minute, numericInput: true, onIonChange: (ev) => {
|
|
14193
14194
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { minute: ev.detail.value }));
|
|
14194
14195
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { minute: ev.detail.value }));
|
|
14195
14196
|
ev.stopPropagation();
|
|
@@ -14202,7 +14203,7 @@ class Datetime {
|
|
|
14202
14203
|
}
|
|
14203
14204
|
const activePart = this.getActivePartsWithFallback();
|
|
14204
14205
|
const isDayPeriodRTL = isLocaleDayPeriodRTL(this.locale);
|
|
14205
|
-
return (hAsync("ion-picker-column", { "aria-label": "Select a day period", style: isDayPeriodRTL ? { order: '-1' } : {}, color: this.color, disabled: disabled, value: activePart.ampm, onIonChange: (ev) => {
|
|
14206
|
+
return (hAsync("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) => {
|
|
14206
14207
|
const hour = calculateHourFromAMPM(workingParts, ev.detail.value);
|
|
14207
14208
|
this.setWorkingParts(Object.assign(Object.assign({}, workingParts), { ampm: ev.detail.value, hour }));
|
|
14208
14209
|
this.setActiveParts(Object.assign(Object.assign({}, this.getActivePartsWithFallback()), { ampm: ev.detail.value, hour }));
|
|
@@ -14544,7 +14545,7 @@ class Datetime {
|
|
|
14544
14545
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
14545
14546
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
14546
14547
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
14547
|
-
return (hAsync(Host, { key: '
|
|
14548
|
+
return (hAsync(Host, { key: '19e20c9b6b5f9467e91a2567b6dc7d9d38b56cc3', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses$1(color, {
|
|
14548
14549
|
[mode]: true,
|
|
14549
14550
|
['datetime-readonly']: readonly,
|
|
14550
14551
|
['datetime-disabled']: disabled,
|
|
@@ -14554,7 +14555,7 @@ class Datetime {
|
|
|
14554
14555
|
[`datetime-size-${size}`]: true,
|
|
14555
14556
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
14556
14557
|
[`datetime-grid`]: isGridStyle,
|
|
14557
|
-
})) }, hAsync("div", { key: '
|
|
14558
|
+
})) }, hAsync("div", { key: 'e31b5ef76cd6262dafd39f2d21980887880ec32e', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
14558
14559
|
}
|
|
14559
14560
|
get el() { return getElement(this); }
|
|
14560
14561
|
static get watchers() { return {
|
|
@@ -14626,6 +14627,7 @@ class Datetime {
|
|
|
14626
14627
|
let datetimeIds = 0;
|
|
14627
14628
|
const CANCEL_ROLE = 'datetime-cancel';
|
|
14628
14629
|
const CONFIRM_ROLE = 'datetime-confirm';
|
|
14630
|
+
const WHEEL_PART = 'wheel';
|
|
14629
14631
|
const WHEEL_ITEM_PART = 'wheel-item';
|
|
14630
14632
|
const WHEEL_ITEM_ACTIVE_PART = `active`;
|
|
14631
14633
|
|
|
@@ -28715,13 +28717,29 @@ const rangeMdCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:
|
|
|
28715
28717
|
* @slot start - Content is placed to the left of the range slider in LTR, and to the right in RTL.
|
|
28716
28718
|
* @slot end - Content is placed to the right of the range slider in LTR, and to the left in RTL.
|
|
28717
28719
|
*
|
|
28720
|
+
* @part label - The label text describing the range.
|
|
28718
28721
|
* @part tick - An inactive tick mark.
|
|
28719
28722
|
* @part tick-active - An active tick mark.
|
|
28720
|
-
* @part pin - The counter that appears above a knob.
|
|
28721
|
-
* @part knob - The handle that is used to drag the range.
|
|
28722
28723
|
* @part bar - The inactive part of the bar.
|
|
28723
28724
|
* @part bar-active - The active part of the bar.
|
|
28724
|
-
* @part
|
|
28725
|
+
* @part knob-handle - The container element that wraps the knob and handles drag interactions.
|
|
28726
|
+
* @part knob-handle-a - The container element for the first knob. Only available when `dualKnobs` is `true`.
|
|
28727
|
+
* @part knob-handle-b - The container element for the second knob. Only available when `dualKnobs` is `true`.
|
|
28728
|
+
* @part knob-handle-lower - The container element for the lower knob. Only available when `dualKnobs` is `true`.
|
|
28729
|
+
* @part knob-handle-upper - The container element for the upper knob. Only available when `dualKnobs` is `true`.
|
|
28730
|
+
* @part pin - The counter that appears above a knob.
|
|
28731
|
+
* @part pin-a - The counter that appears above the first knob. Only available when `dualKnobs` is `true`.
|
|
28732
|
+
* @part pin-b - The counter that appears above the second knob. Only available when `dualKnobs` is `true`.
|
|
28733
|
+
* @part pin-lower - The counter that appears above the lower knob. Only available when `dualKnobs` is `true`.
|
|
28734
|
+
* @part pin-upper - The counter that appears above the upper knob. Only available when `dualKnobs` is `true`.
|
|
28735
|
+
* @part knob - The visual knob element that appears on the range track.
|
|
28736
|
+
* @part knob-a - The visual knob element for the first knob. Only available when `dualKnobs` is `true`.
|
|
28737
|
+
* @part knob-b - The visual knob element for the second knob. Only available when `dualKnobs` is `true`.
|
|
28738
|
+
* @part knob-lower - The visual knob element for the lower knob. Only available when `dualKnobs` is `true`.
|
|
28739
|
+
* @part knob-upper - The visual knob element for the upper knob. Only available when `dualKnobs` is `true`.
|
|
28740
|
+
* @part 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`.
|
|
28741
|
+
* @part 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`.
|
|
28742
|
+
* @part hover - Added to the knob-handle, knob, and pin when the knob has hover. Only one set has this part at a time.
|
|
28725
28743
|
*/
|
|
28726
28744
|
class Range {
|
|
28727
28745
|
constructor(hostRef) {
|
|
@@ -28739,6 +28757,7 @@ class Range {
|
|
|
28739
28757
|
this.inheritedAttributes = {};
|
|
28740
28758
|
this.contentEl = null;
|
|
28741
28759
|
this.initialContentScrollY = true;
|
|
28760
|
+
this.focusFromPointer = false;
|
|
28742
28761
|
this.ratioA = 0;
|
|
28743
28762
|
this.ratioB = 0;
|
|
28744
28763
|
/**
|
|
@@ -28870,6 +28889,7 @@ class Range {
|
|
|
28870
28889
|
this.onBlur = () => {
|
|
28871
28890
|
if (this.hasFocus) {
|
|
28872
28891
|
this.hasFocus = false;
|
|
28892
|
+
this.focusedKnob = undefined;
|
|
28873
28893
|
this.ionBlur.emit();
|
|
28874
28894
|
}
|
|
28875
28895
|
};
|
|
@@ -28880,21 +28900,20 @@ class Range {
|
|
|
28880
28900
|
}
|
|
28881
28901
|
};
|
|
28882
28902
|
this.onKnobFocus = (knob) => {
|
|
28903
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
28904
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
28905
|
+
if (!this.focusFromPointer) {
|
|
28906
|
+
this.focusedKnob = knob;
|
|
28907
|
+
}
|
|
28908
|
+
else {
|
|
28909
|
+
this.focusFromPointer = false;
|
|
28910
|
+
this.focusedKnob = undefined;
|
|
28911
|
+
}
|
|
28912
|
+
// If the knob was not already focused, emit the focus event
|
|
28883
28913
|
if (!this.hasFocus) {
|
|
28884
28914
|
this.hasFocus = true;
|
|
28885
28915
|
this.ionFocus.emit();
|
|
28886
28916
|
}
|
|
28887
|
-
// Manually manage ion-focused class for dual knobs
|
|
28888
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
28889
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
28890
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
28891
|
-
// Remove ion-focused from both knobs first
|
|
28892
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
28893
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
28894
|
-
// Add ion-focused only to the focused knob
|
|
28895
|
-
const focusedKnobEl = knob === 'A' ? knobA : knobB;
|
|
28896
|
-
focusedKnobEl === null || focusedKnobEl === void 0 ? void 0 : focusedKnobEl.classList.add('ion-focused');
|
|
28897
|
-
}
|
|
28898
28917
|
};
|
|
28899
28918
|
this.onKnobBlur = () => {
|
|
28900
28919
|
// Check if focus is moving to another knob within the same range
|
|
@@ -28906,18 +28925,18 @@ class Range {
|
|
|
28906
28925
|
if (!isStillFocusedOnKnob) {
|
|
28907
28926
|
if (this.hasFocus) {
|
|
28908
28927
|
this.hasFocus = false;
|
|
28928
|
+
this.focusedKnob = undefined;
|
|
28909
28929
|
this.ionBlur.emit();
|
|
28910
28930
|
}
|
|
28911
|
-
// Remove ion-focused from both knobs when focus leaves the range
|
|
28912
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
28913
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
28914
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
28915
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
28916
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
28917
|
-
}
|
|
28918
28931
|
}
|
|
28919
28932
|
}, 0);
|
|
28920
28933
|
};
|
|
28934
|
+
this.onKnobMouseEnter = (knob) => {
|
|
28935
|
+
this.hoveredKnob = knob;
|
|
28936
|
+
};
|
|
28937
|
+
this.onKnobMouseLeave = () => {
|
|
28938
|
+
this.hoveredKnob = undefined;
|
|
28939
|
+
};
|
|
28921
28940
|
}
|
|
28922
28941
|
debounceChanged() {
|
|
28923
28942
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -29171,7 +29190,6 @@ class Range {
|
|
|
29171
29190
|
ratio = 1 - ratio;
|
|
29172
29191
|
}
|
|
29173
29192
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
29174
|
-
this.setFocus(this.pressedKnob);
|
|
29175
29193
|
}
|
|
29176
29194
|
get valA() {
|
|
29177
29195
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -29198,9 +29216,23 @@ class Range {
|
|
|
29198
29216
|
updateRatio() {
|
|
29199
29217
|
const value = this.getValue();
|
|
29200
29218
|
const { min, max } = this;
|
|
29219
|
+
/**
|
|
29220
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
29221
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
29222
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
29223
|
+
*/
|
|
29201
29224
|
if (this.dualKnobs) {
|
|
29202
|
-
|
|
29203
|
-
|
|
29225
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
29226
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
29227
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
29228
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
29229
|
+
this.ratioA = lowerRatio;
|
|
29230
|
+
this.ratioB = upperRatio;
|
|
29231
|
+
}
|
|
29232
|
+
else {
|
|
29233
|
+
this.ratioA = upperRatio;
|
|
29234
|
+
this.ratioB = lowerRatio;
|
|
29235
|
+
}
|
|
29204
29236
|
}
|
|
29205
29237
|
else {
|
|
29206
29238
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -29217,14 +29249,6 @@ class Range {
|
|
|
29217
29249
|
};
|
|
29218
29250
|
this.noUpdate = false;
|
|
29219
29251
|
}
|
|
29220
|
-
setFocus(knob) {
|
|
29221
|
-
if (this.el.shadowRoot) {
|
|
29222
|
-
const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
|
|
29223
|
-
if (knobEl) {
|
|
29224
|
-
knobEl.focus();
|
|
29225
|
-
}
|
|
29226
|
-
}
|
|
29227
|
-
}
|
|
29228
29252
|
/**
|
|
29229
29253
|
* Returns true if content was passed to the "start" slot
|
|
29230
29254
|
*/
|
|
@@ -29242,7 +29266,7 @@ class Range {
|
|
|
29242
29266
|
}
|
|
29243
29267
|
renderRangeSlider() {
|
|
29244
29268
|
var _a;
|
|
29245
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
29269
|
+
const { min, max, step, handleKeyboard, focusedKnob, hoveredKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
29246
29270
|
let barStart = `${ratioLower * 100}%`;
|
|
29247
29271
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
29248
29272
|
const rtl = isRTL$1(this.el);
|
|
@@ -29302,7 +29326,9 @@ class Range {
|
|
|
29302
29326
|
ticks.push(tick);
|
|
29303
29327
|
}
|
|
29304
29328
|
}
|
|
29305
|
-
return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
29329
|
+
return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
29330
|
+
this.focusFromPointer = true;
|
|
29331
|
+
},
|
|
29306
29332
|
/**
|
|
29307
29333
|
* Since the gesture has a threshold, the value
|
|
29308
29334
|
* won't change until the user has dragged past
|
|
@@ -29315,6 +29341,7 @@ class Range {
|
|
|
29315
29341
|
* we need to listen for the "pointerUp" event.
|
|
29316
29342
|
*/
|
|
29317
29343
|
onPointerUp: (ev) => {
|
|
29344
|
+
this.focusFromPointer = false;
|
|
29318
29345
|
/**
|
|
29319
29346
|
* If the user drags the knob on the web
|
|
29320
29347
|
* version (does not occur on mobile),
|
|
@@ -29340,6 +29367,10 @@ class Range {
|
|
|
29340
29367
|
'has-ticks': ticks.length > 0,
|
|
29341
29368
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
29342
29369
|
knob: 'A',
|
|
29370
|
+
position: this.dualKnobs ? (this.ratioA <= this.ratioB ? 'lower' : 'upper') : 'lower',
|
|
29371
|
+
dualKnobs: this.dualKnobs,
|
|
29372
|
+
focused: focusedKnob === 'A',
|
|
29373
|
+
hovered: hoveredKnob === 'A',
|
|
29343
29374
|
pressed: pressedKnob === 'A',
|
|
29344
29375
|
value: this.valA,
|
|
29345
29376
|
ratio: this.ratioA,
|
|
@@ -29352,9 +29383,15 @@ class Range {
|
|
|
29352
29383
|
inheritedAttributes,
|
|
29353
29384
|
onKnobFocus: this.onKnobFocus,
|
|
29354
29385
|
onKnobBlur: this.onKnobBlur,
|
|
29386
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29387
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29355
29388
|
}), this.dualKnobs &&
|
|
29356
29389
|
renderKnob(rtl, {
|
|
29357
29390
|
knob: 'B',
|
|
29391
|
+
position: this.ratioB <= this.ratioA ? 'lower' : 'upper',
|
|
29392
|
+
dualKnobs: this.dualKnobs,
|
|
29393
|
+
focused: focusedKnob === 'B',
|
|
29394
|
+
hovered: hoveredKnob === 'B',
|
|
29358
29395
|
pressed: pressedKnob === 'B',
|
|
29359
29396
|
value: this.valB,
|
|
29360
29397
|
ratio: this.ratioB,
|
|
@@ -29367,6 +29404,8 @@ class Range {
|
|
|
29367
29404
|
inheritedAttributes,
|
|
29368
29405
|
onKnobFocus: this.onKnobFocus,
|
|
29369
29406
|
onKnobBlur: this.onKnobBlur,
|
|
29407
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29408
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29370
29409
|
})));
|
|
29371
29410
|
}
|
|
29372
29411
|
render() {
|
|
@@ -29392,10 +29431,11 @@ class Range {
|
|
|
29392
29431
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
29393
29432
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
29394
29433
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
29395
|
-
return (hAsync(Host, { key: '
|
|
29434
|
+
return (hAsync(Host, { key: '4a393e229cf599f3377b606acaebe5f090d41f6e', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses$1(this.color, {
|
|
29396
29435
|
[mode]: true,
|
|
29397
29436
|
'in-item': inItem,
|
|
29398
29437
|
'range-disabled': disabled,
|
|
29438
|
+
'range-dual-knobs': dualKnobs,
|
|
29399
29439
|
'range-pressed': pressedKnob !== undefined,
|
|
29400
29440
|
'range-has-pin': pin,
|
|
29401
29441
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
@@ -29403,10 +29443,10 @@ class Range {
|
|
|
29403
29443
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
29404
29444
|
'range-value-min': valueAtMin,
|
|
29405
29445
|
'range-value-max': valueAtMax,
|
|
29406
|
-
}) }, hAsync("label", { key: '
|
|
29446
|
+
}) }, hAsync("label", { key: 'd7f45882aa7f11bbac1cb783caa0053151efcc70', class: "range-wrapper", id: "range-label" }, hAsync("div", { key: '537d3b1e7f9fed0c8380678551e31325b1ef1f85', class: {
|
|
29407
29447
|
'label-text-wrapper': true,
|
|
29408
29448
|
'label-text-wrapper-hidden': !hasLabel,
|
|
29409
|
-
}, part: "label" }, label !== undefined ? hAsync("div", { class: "label-text" }, label) : hAsync("slot", { name: "label" })), hAsync("div", { key: '
|
|
29449
|
+
}, part: "label" }, label !== undefined ? hAsync("div", { class: "label-text" }, label) : hAsync("slot", { name: "label" })), hAsync("div", { key: 'cb50f07a3704d04af3554211ffad35f7d9fcc450', class: "native-wrapper" }, hAsync("slot", { key: '09004eaa72688ca0f0536bd5f5d7160a23d16406', name: "start" }), this.renderRangeSlider(), hAsync("slot", { key: 'a94da21d2ea7ed2feafcc0651c72da21d6de1e57', name: "end" })))));
|
|
29410
29450
|
}
|
|
29411
29451
|
get el() { return getElement(this); }
|
|
29412
29452
|
static get watchers() { return {
|
|
@@ -29444,6 +29484,8 @@ class Range {
|
|
|
29444
29484
|
"labelPlacement": [1, "label-placement"],
|
|
29445
29485
|
"ratioA": [32],
|
|
29446
29486
|
"ratioB": [32],
|
|
29487
|
+
"focusedKnob": [32],
|
|
29488
|
+
"hoveredKnob": [32],
|
|
29447
29489
|
"pressedKnob": [32]
|
|
29448
29490
|
},
|
|
29449
29491
|
"$listeners$": undefined,
|
|
@@ -29451,7 +29493,7 @@ class Range {
|
|
|
29451
29493
|
"$attrsToReflect$": [["color", "color"]]
|
|
29452
29494
|
}; }
|
|
29453
29495
|
}
|
|
29454
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
29496
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, pressed, focused, hovered, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, onKnobMouseEnter, onKnobMouseLeave, }) => {
|
|
29455
29497
|
const start = rtl ? 'right' : 'left';
|
|
29456
29498
|
const knobStyle = () => {
|
|
29457
29499
|
const style = {};
|
|
@@ -29472,16 +29514,50 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
29472
29514
|
ev.preventDefault();
|
|
29473
29515
|
ev.stopPropagation();
|
|
29474
29516
|
}
|
|
29475
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
29517
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
29476
29518
|
'range-knob-handle': true,
|
|
29477
|
-
'range-knob-a': knob === 'A',
|
|
29478
|
-
'range-knob-b': knob === 'B',
|
|
29519
|
+
'range-knob-handle-a': knob === 'A',
|
|
29520
|
+
'range-knob-handle-b': knob === 'B',
|
|
29479
29521
|
'range-knob-pressed': pressed,
|
|
29480
29522
|
'range-knob-min': value === min,
|
|
29481
29523
|
'range-knob-max': value === max,
|
|
29482
29524
|
'ion-activatable': true,
|
|
29483
29525
|
'ion-focusable': true,
|
|
29484
|
-
|
|
29526
|
+
'ion-focused': focused,
|
|
29527
|
+
}, part: [
|
|
29528
|
+
'knob-handle',
|
|
29529
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
29530
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
29531
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
29532
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
29533
|
+
pressed && 'pressed',
|
|
29534
|
+
focused && 'focused',
|
|
29535
|
+
hovered && 'hover',
|
|
29536
|
+
]
|
|
29537
|
+
.filter(Boolean)
|
|
29538
|
+
.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 && (hAsync("div", { class: "range-pin", role: "presentation", part: [
|
|
29539
|
+
'pin',
|
|
29540
|
+
dualKnobs && knob === 'A' && 'pin-a',
|
|
29541
|
+
dualKnobs && knob === 'B' && 'pin-b',
|
|
29542
|
+
dualKnobs && position === 'lower' && 'pin-lower',
|
|
29543
|
+
dualKnobs && position === 'upper' && 'pin-upper',
|
|
29544
|
+
pressed && 'pressed',
|
|
29545
|
+
focused && 'focused',
|
|
29546
|
+
hovered && 'hover',
|
|
29547
|
+
]
|
|
29548
|
+
.filter(Boolean)
|
|
29549
|
+
.join(' ') }, pinFormatter(value))), hAsync("div", { class: "range-knob", role: "presentation", part: [
|
|
29550
|
+
'knob',
|
|
29551
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
29552
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
29553
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
29554
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
29555
|
+
pressed && 'pressed',
|
|
29556
|
+
focused && 'focused',
|
|
29557
|
+
hovered && 'hover',
|
|
29558
|
+
]
|
|
29559
|
+
.filter(Boolean)
|
|
29560
|
+
.join(' ') })));
|
|
29485
29561
|
};
|
|
29486
29562
|
const ratioToValue = (ratio, min, max, step) => {
|
|
29487
29563
|
let value = (max - min) * ratio;
|