@ionic/core 8.7.17-dev.11771359170.1fda0949 → 8.7.17-dev.11771865171.14f4c2cf
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ion-datetime.js +5 -5
- package/components/ion-range.js +152 -39
- package/dist/cjs/ion-datetime_3.cjs.entry.js +5 -5
- package/dist/cjs/ion-range.cjs.entry.js +149 -39
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/datetime/datetime.js +5 -12
- package/dist/collection/components/range/range.js +172 -42
- package/dist/docs.json +142 -54
- package/dist/esm/ion-datetime_3.entry.js +5 -5
- package/dist/esm/ion-range.entry.js +149 -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-991a3dd9.entry.js +4 -0
- package/dist/types/components/datetime/datetime.d.ts +0 -7
- package/dist/types/components/range/range-interface.d.ts +1 -0
- package/dist/types/components/range/range.d.ts +33 -4
- package/hydrate/index.js +177 -54
- package/hydrate/index.mjs +177 -54
- package/package.json +1 -1
- package/dist/ionic/p-012212e4.entry.js +0 -4
- package/dist/ionic/p-9dcc3ae4.entry.js +0 -4
package/hydrate/index.js
CHANGED
|
@@ -12880,21 +12880,14 @@ const datetimeMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:colu
|
|
|
12880
12880
|
* layout with `presentation="date-time"` or `"time-date"`.
|
|
12881
12881
|
* @part time-button active - The time picker button when the picker is open.
|
|
12882
12882
|
*
|
|
12883
|
-
* @part calendar-header - The calendar header manages the date navigation controls (month/year picker and prev/next buttons) and the days of the week when using a grid style layout.
|
|
12884
12883
|
* @part month-year-button - The button that opens the month/year picker when
|
|
12885
12884
|
* using a grid style layout.
|
|
12886
|
-
* @part prev-next-buttons - The buttons used to navigate to the next or previous month when using a grid style layout.
|
|
12887
|
-
* @part prev-button - The button used to navigate to the previous month when using a grid style layout.
|
|
12888
|
-
* @part next-button - The button used to navigate to the next month when using a grid style layout.
|
|
12889
|
-
* @part days-of-week - The container for the day-of-the-week header (both weekdays and weekends) when using a grid style layout.
|
|
12890
12885
|
*
|
|
12891
12886
|
* @part calendar-day - The individual buttons that display a day inside of the datetime
|
|
12892
12887
|
* calendar.
|
|
12893
12888
|
* @part calendar-day active - The currently selected calendar day.
|
|
12894
12889
|
* @part calendar-day today - The calendar day that contains the current day.
|
|
12895
12890
|
* @part calendar-day disabled - The calendar day that is disabled.
|
|
12896
|
-
*
|
|
12897
|
-
* @part datetime-header - The datetime header contains the content for the `title` slot and the selected date.
|
|
12898
12891
|
*/
|
|
12899
12892
|
class Datetime {
|
|
12900
12893
|
constructor(hostRef) {
|
|
@@ -14236,11 +14229,11 @@ class Datetime {
|
|
|
14236
14229
|
const nextMonthDisabled = disabled || isNextMonthDisabled(this.workingParts, this.maxParts);
|
|
14237
14230
|
// don't use the inheritAttributes util because it removes dir from the host, and we still need that
|
|
14238
14231
|
const hostDir = this.el.getAttribute('dir') || undefined;
|
|
14239
|
-
return (hAsync("div", { class: "calendar-header"
|
|
14232
|
+
return (hAsync("div", { class: "calendar-header" }, hAsync("div", { class: "calendar-action-buttons" }, hAsync("div", { class: "calendar-month-year" }, hAsync("button", { class: {
|
|
14240
14233
|
'calendar-month-year-toggle': true,
|
|
14241
14234
|
'ion-activatable': true,
|
|
14242
14235
|
'ion-focusable': true,
|
|
14243
|
-
}, part: "month-year-button", disabled: disabled, "aria-label": this.showMonthAndYear ? 'Hide year picker' : 'Show year picker', onClick: () => this.toggleMonthAndYearView() }, hAsync("span", { id: "toggle-wrapper" }, getMonthAndYear(this.locale, this.workingParts), hAsync("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })), mode === 'md' && hAsync("ion-ripple-effect", null))), hAsync("div", { class: "calendar-next-prev" }, hAsync("ion-buttons", null, hAsync("ion-button", { "aria-label": "Previous month", disabled: prevMonthDisabled, onClick: () => this.prevMonth()
|
|
14236
|
+
}, part: "month-year-button", disabled: disabled, "aria-label": this.showMonthAndYear ? 'Hide year picker' : 'Show year picker', onClick: () => this.toggleMonthAndYearView() }, hAsync("span", { id: "toggle-wrapper" }, getMonthAndYear(this.locale, this.workingParts), hAsync("ion-icon", { "aria-hidden": "true", icon: this.showMonthAndYear ? expandedIcon : collapsedIcon, lazy: false, flipRtl: true })), mode === 'md' && hAsync("ion-ripple-effect", null))), hAsync("div", { class: "calendar-next-prev" }, hAsync("ion-buttons", null, hAsync("ion-button", { "aria-label": "Previous month", disabled: prevMonthDisabled, onClick: () => this.prevMonth() }, hAsync("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronBack, lazy: false, flipRtl: true })), hAsync("ion-button", { "aria-label": "Next month", disabled: nextMonthDisabled, onClick: () => this.nextMonth() }, hAsync("ion-icon", { dir: hostDir, "aria-hidden": "true", slot: "icon-only", icon: chevronForward, lazy: false, flipRtl: true }))))), hAsync("div", { class: "calendar-days-of-week", "aria-hidden": "true" }, getDaysOfWeek(this.locale, mode, this.firstDayOfWeek % 7).map((d) => {
|
|
14244
14237
|
return hAsync("div", { class: "day-of-week" }, d);
|
|
14245
14238
|
}))));
|
|
14246
14239
|
}
|
|
@@ -14472,7 +14465,7 @@ class Datetime {
|
|
|
14472
14465
|
if (!hasSlottedTitle && !this.showDefaultTitle) {
|
|
14473
14466
|
return;
|
|
14474
14467
|
}
|
|
14475
|
-
return (hAsync("div", { class: "datetime-header"
|
|
14468
|
+
return (hAsync("div", { class: "datetime-header" }, hAsync("div", { class: "datetime-title" }, hAsync("slot", { name: "title" }, "Select Date")), showExpandedHeader && hAsync("div", { class: "datetime-selected-date" }, this.getHeaderSelectedDateText())));
|
|
14476
14469
|
}
|
|
14477
14470
|
/**
|
|
14478
14471
|
* Render time picker inside of datetime.
|
|
@@ -14552,7 +14545,7 @@ class Datetime {
|
|
|
14552
14545
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
14553
14546
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
14554
14547
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
14555
|
-
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, {
|
|
14556
14549
|
[mode]: true,
|
|
14557
14550
|
['datetime-readonly']: readonly,
|
|
14558
14551
|
['datetime-disabled']: disabled,
|
|
@@ -14562,7 +14555,7 @@ class Datetime {
|
|
|
14562
14555
|
[`datetime-size-${size}`]: true,
|
|
14563
14556
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
14564
14557
|
[`datetime-grid`]: isGridStyle,
|
|
14565
|
-
})) }, hAsync("div", { key: '
|
|
14558
|
+
})) }, hAsync("div", { key: 'e31b5ef76cd6262dafd39f2d21980887880ec32e', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
14566
14559
|
}
|
|
14567
14560
|
get el() { return getElement(this); }
|
|
14568
14561
|
static get watchers() { return {
|
|
@@ -28724,13 +28717,30 @@ const rangeMdCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:
|
|
|
28724
28717
|
* @slot start - Content is placed to the left of the range slider in LTR, and to the right in RTL.
|
|
28725
28718
|
* @slot end - Content is placed to the right of the range slider in LTR, and to the left in RTL.
|
|
28726
28719
|
*
|
|
28720
|
+
* @part label - The label text describing the range.
|
|
28727
28721
|
* @part tick - An inactive tick mark.
|
|
28728
28722
|
* @part tick-active - An active tick mark.
|
|
28729
|
-
* @part pin - The counter that appears above a knob.
|
|
28730
|
-
* @part knob - The handle that is used to drag the range.
|
|
28731
28723
|
* @part bar - The inactive part of the bar.
|
|
28732
28724
|
* @part bar-active - The active part of the bar.
|
|
28733
|
-
* @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 activated - Added to the knob-handle, knob, and pin when the knob is activated (has the `ion-activated` class). Only one set has this part at a time when `dualKnobs` is `true`.
|
|
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 when `dualKnobs` is `true`.
|
|
28743
|
+
* @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`.
|
|
28734
28744
|
*/
|
|
28735
28745
|
class Range {
|
|
28736
28746
|
constructor(hostRef) {
|
|
@@ -28748,6 +28758,7 @@ class Range {
|
|
|
28748
28758
|
this.inheritedAttributes = {};
|
|
28749
28759
|
this.contentEl = null;
|
|
28750
28760
|
this.initialContentScrollY = true;
|
|
28761
|
+
this.focusFromPointer = false;
|
|
28751
28762
|
this.ratioA = 0;
|
|
28752
28763
|
this.ratioB = 0;
|
|
28753
28764
|
/**
|
|
@@ -28857,6 +28868,29 @@ class Range {
|
|
|
28857
28868
|
this.gesture.enable(!this.disabled);
|
|
28858
28869
|
}
|
|
28859
28870
|
};
|
|
28871
|
+
/**
|
|
28872
|
+
* Observes the knob handles for the ion-activated class and syncs
|
|
28873
|
+
* activatedKnob so the activated part is correctly set on the handle,
|
|
28874
|
+
* knob, and pin.
|
|
28875
|
+
*/
|
|
28876
|
+
this.setupActivatedObserver = () => {
|
|
28877
|
+
const knobHandleA = this.el.shadowRoot.querySelector('.range-knob-handle-a');
|
|
28878
|
+
const knobHandleB = this.el.shadowRoot.querySelector('.range-knob-handle-b');
|
|
28879
|
+
const syncActivated = () => {
|
|
28880
|
+
this.activatedKnob = (knobHandleA === null || knobHandleA === void 0 ? void 0 : knobHandleA.classList.contains('ion-activated'))
|
|
28881
|
+
? 'A'
|
|
28882
|
+
: (knobHandleB === null || knobHandleB === void 0 ? void 0 : knobHandleB.classList.contains('ion-activated'))
|
|
28883
|
+
? 'B'
|
|
28884
|
+
: undefined;
|
|
28885
|
+
};
|
|
28886
|
+
this.activatedObserver = new MutationObserver(syncActivated);
|
|
28887
|
+
this.activatedObserver.observe(this.el.shadowRoot, {
|
|
28888
|
+
attributes: true,
|
|
28889
|
+
attributeFilter: ['class'],
|
|
28890
|
+
subtree: true,
|
|
28891
|
+
});
|
|
28892
|
+
syncActivated();
|
|
28893
|
+
};
|
|
28860
28894
|
this.handleKeyboard = (knob, isIncrease) => {
|
|
28861
28895
|
const { ensureValueInBounds } = this;
|
|
28862
28896
|
let step = this.step;
|
|
@@ -28879,6 +28913,7 @@ class Range {
|
|
|
28879
28913
|
this.onBlur = () => {
|
|
28880
28914
|
if (this.hasFocus) {
|
|
28881
28915
|
this.hasFocus = false;
|
|
28916
|
+
this.focusedKnob = undefined;
|
|
28882
28917
|
this.ionBlur.emit();
|
|
28883
28918
|
}
|
|
28884
28919
|
};
|
|
@@ -28889,21 +28924,20 @@ class Range {
|
|
|
28889
28924
|
}
|
|
28890
28925
|
};
|
|
28891
28926
|
this.onKnobFocus = (knob) => {
|
|
28927
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
28928
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
28929
|
+
if (!this.focusFromPointer) {
|
|
28930
|
+
this.focusedKnob = knob;
|
|
28931
|
+
}
|
|
28932
|
+
else {
|
|
28933
|
+
this.focusFromPointer = false;
|
|
28934
|
+
this.focusedKnob = undefined;
|
|
28935
|
+
}
|
|
28936
|
+
// If the knob was not already focused, emit the focus event
|
|
28892
28937
|
if (!this.hasFocus) {
|
|
28893
28938
|
this.hasFocus = true;
|
|
28894
28939
|
this.ionFocus.emit();
|
|
28895
28940
|
}
|
|
28896
|
-
// Manually manage ion-focused class for dual knobs
|
|
28897
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
28898
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
28899
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
28900
|
-
// Remove ion-focused from both knobs first
|
|
28901
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
28902
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
28903
|
-
// Add ion-focused only to the focused knob
|
|
28904
|
-
const focusedKnobEl = knob === 'A' ? knobA : knobB;
|
|
28905
|
-
focusedKnobEl === null || focusedKnobEl === void 0 ? void 0 : focusedKnobEl.classList.add('ion-focused');
|
|
28906
|
-
}
|
|
28907
28941
|
};
|
|
28908
28942
|
this.onKnobBlur = () => {
|
|
28909
28943
|
// Check if focus is moving to another knob within the same range
|
|
@@ -28915,18 +28949,18 @@ class Range {
|
|
|
28915
28949
|
if (!isStillFocusedOnKnob) {
|
|
28916
28950
|
if (this.hasFocus) {
|
|
28917
28951
|
this.hasFocus = false;
|
|
28952
|
+
this.focusedKnob = undefined;
|
|
28918
28953
|
this.ionBlur.emit();
|
|
28919
28954
|
}
|
|
28920
|
-
// Remove ion-focused from both knobs when focus leaves the range
|
|
28921
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
28922
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
28923
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
28924
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
28925
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
28926
|
-
}
|
|
28927
28955
|
}
|
|
28928
28956
|
}, 0);
|
|
28929
28957
|
};
|
|
28958
|
+
this.onKnobMouseEnter = (knob) => {
|
|
28959
|
+
this.hoveredKnob = knob;
|
|
28960
|
+
};
|
|
28961
|
+
this.onKnobMouseLeave = () => {
|
|
28962
|
+
this.hoveredKnob = undefined;
|
|
28963
|
+
};
|
|
28930
28964
|
}
|
|
28931
28965
|
debounceChanged() {
|
|
28932
28966
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -29003,6 +29037,7 @@ class Range {
|
|
|
29003
29037
|
this.originalIonInput = this.ionInput;
|
|
29004
29038
|
this.setupGesture();
|
|
29005
29039
|
this.updateRatio();
|
|
29040
|
+
this.setupActivatedObserver();
|
|
29006
29041
|
this.didLoad = true;
|
|
29007
29042
|
}
|
|
29008
29043
|
connectedCallback() {
|
|
@@ -29028,6 +29063,10 @@ class Range {
|
|
|
29028
29063
|
this.gesture.destroy();
|
|
29029
29064
|
this.gesture = undefined;
|
|
29030
29065
|
}
|
|
29066
|
+
if (this.activatedObserver) {
|
|
29067
|
+
this.activatedObserver.disconnect();
|
|
29068
|
+
this.activatedObserver = undefined;
|
|
29069
|
+
}
|
|
29031
29070
|
}
|
|
29032
29071
|
getValue() {
|
|
29033
29072
|
var _a;
|
|
@@ -29180,7 +29219,6 @@ class Range {
|
|
|
29180
29219
|
ratio = 1 - ratio;
|
|
29181
29220
|
}
|
|
29182
29221
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
29183
|
-
this.setFocus(this.pressedKnob);
|
|
29184
29222
|
}
|
|
29185
29223
|
get valA() {
|
|
29186
29224
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -29207,9 +29245,23 @@ class Range {
|
|
|
29207
29245
|
updateRatio() {
|
|
29208
29246
|
const value = this.getValue();
|
|
29209
29247
|
const { min, max } = this;
|
|
29248
|
+
/**
|
|
29249
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
29250
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
29251
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
29252
|
+
*/
|
|
29210
29253
|
if (this.dualKnobs) {
|
|
29211
|
-
|
|
29212
|
-
|
|
29254
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
29255
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
29256
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
29257
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
29258
|
+
this.ratioA = lowerRatio;
|
|
29259
|
+
this.ratioB = upperRatio;
|
|
29260
|
+
}
|
|
29261
|
+
else {
|
|
29262
|
+
this.ratioA = upperRatio;
|
|
29263
|
+
this.ratioB = lowerRatio;
|
|
29264
|
+
}
|
|
29213
29265
|
}
|
|
29214
29266
|
else {
|
|
29215
29267
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -29226,14 +29278,6 @@ class Range {
|
|
|
29226
29278
|
};
|
|
29227
29279
|
this.noUpdate = false;
|
|
29228
29280
|
}
|
|
29229
|
-
setFocus(knob) {
|
|
29230
|
-
if (this.el.shadowRoot) {
|
|
29231
|
-
const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
|
|
29232
|
-
if (knobEl) {
|
|
29233
|
-
knobEl.focus();
|
|
29234
|
-
}
|
|
29235
|
-
}
|
|
29236
|
-
}
|
|
29237
29281
|
/**
|
|
29238
29282
|
* Returns true if content was passed to the "start" slot
|
|
29239
29283
|
*/
|
|
@@ -29251,7 +29295,7 @@ class Range {
|
|
|
29251
29295
|
}
|
|
29252
29296
|
renderRangeSlider() {
|
|
29253
29297
|
var _a;
|
|
29254
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
29298
|
+
const { min, max, step, handleKeyboard, activatedKnob, focusedKnob, hoveredKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
29255
29299
|
let barStart = `${ratioLower * 100}%`;
|
|
29256
29300
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
29257
29301
|
const rtl = isRTL$1(this.el);
|
|
@@ -29311,7 +29355,9 @@ class Range {
|
|
|
29311
29355
|
ticks.push(tick);
|
|
29312
29356
|
}
|
|
29313
29357
|
}
|
|
29314
|
-
return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
29358
|
+
return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
29359
|
+
this.focusFromPointer = true;
|
|
29360
|
+
},
|
|
29315
29361
|
/**
|
|
29316
29362
|
* Since the gesture has a threshold, the value
|
|
29317
29363
|
* won't change until the user has dragged past
|
|
@@ -29324,6 +29370,7 @@ class Range {
|
|
|
29324
29370
|
* we need to listen for the "pointerUp" event.
|
|
29325
29371
|
*/
|
|
29326
29372
|
onPointerUp: (ev) => {
|
|
29373
|
+
this.focusFromPointer = false;
|
|
29327
29374
|
/**
|
|
29328
29375
|
* If the user drags the knob on the web
|
|
29329
29376
|
* version (does not occur on mobile),
|
|
@@ -29349,6 +29396,11 @@ class Range {
|
|
|
29349
29396
|
'has-ticks': ticks.length > 0,
|
|
29350
29397
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
29351
29398
|
knob: 'A',
|
|
29399
|
+
position: getKnobPosition('A', this.ratioA, this.ratioB, this.dualKnobs),
|
|
29400
|
+
dualKnobs: this.dualKnobs,
|
|
29401
|
+
activated: activatedKnob === 'A',
|
|
29402
|
+
focused: focusedKnob === 'A',
|
|
29403
|
+
hovered: hoveredKnob === 'A',
|
|
29352
29404
|
pressed: pressedKnob === 'A',
|
|
29353
29405
|
value: this.valA,
|
|
29354
29406
|
ratio: this.ratioA,
|
|
@@ -29361,9 +29413,16 @@ class Range {
|
|
|
29361
29413
|
inheritedAttributes,
|
|
29362
29414
|
onKnobFocus: this.onKnobFocus,
|
|
29363
29415
|
onKnobBlur: this.onKnobBlur,
|
|
29416
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29417
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29364
29418
|
}), this.dualKnobs &&
|
|
29365
29419
|
renderKnob(rtl, {
|
|
29366
29420
|
knob: 'B',
|
|
29421
|
+
position: getKnobPosition('B', this.ratioA, this.ratioB, this.dualKnobs),
|
|
29422
|
+
dualKnobs: this.dualKnobs,
|
|
29423
|
+
activated: activatedKnob === 'B',
|
|
29424
|
+
focused: focusedKnob === 'B',
|
|
29425
|
+
hovered: hoveredKnob === 'B',
|
|
29367
29426
|
pressed: pressedKnob === 'B',
|
|
29368
29427
|
value: this.valB,
|
|
29369
29428
|
ratio: this.ratioB,
|
|
@@ -29376,6 +29435,8 @@ class Range {
|
|
|
29376
29435
|
inheritedAttributes,
|
|
29377
29436
|
onKnobFocus: this.onKnobFocus,
|
|
29378
29437
|
onKnobBlur: this.onKnobBlur,
|
|
29438
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29439
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29379
29440
|
})));
|
|
29380
29441
|
}
|
|
29381
29442
|
render() {
|
|
@@ -29394,6 +29455,12 @@ class Range {
|
|
|
29394
29455
|
const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent;
|
|
29395
29456
|
const needsEndAdjustment = inItem && !hasEndContent;
|
|
29396
29457
|
const mode = getIonMode$1(this);
|
|
29458
|
+
/**
|
|
29459
|
+
* Determine the name and position of the pressed knob to apply
|
|
29460
|
+
* Host classes for styling.
|
|
29461
|
+
*/
|
|
29462
|
+
const pressedKnobName = dualKnobs ? pressedKnob === null || pressedKnob === void 0 ? void 0 : pressedKnob.toLowerCase() : undefined;
|
|
29463
|
+
const pressedKnobPosition = dualKnobs && pressedKnob ? getKnobPosition(pressedKnob, this.ratioA, this.ratioB, dualKnobs) : undefined;
|
|
29397
29464
|
/**
|
|
29398
29465
|
* Determine if any knob is at the min or max value to
|
|
29399
29466
|
* apply Host classes for styling.
|
|
@@ -29401,21 +29468,24 @@ class Range {
|
|
|
29401
29468
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
29402
29469
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
29403
29470
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
29404
|
-
return (hAsync(Host, { key: '
|
|
29471
|
+
return (hAsync(Host, { key: '8e439db9836fdefdc779573082c788e3ddb3ef73', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses$1(this.color, {
|
|
29405
29472
|
[mode]: true,
|
|
29406
29473
|
'in-item': inItem,
|
|
29407
29474
|
'range-disabled': disabled,
|
|
29475
|
+
'range-dual-knobs': dualKnobs,
|
|
29408
29476
|
'range-pressed': pressedKnob !== undefined,
|
|
29477
|
+
[`range-pressed-${pressedKnobName}`]: pressedKnob !== undefined && pressedKnobName !== undefined,
|
|
29478
|
+
[`range-pressed-${pressedKnobPosition}`]: pressedKnob !== undefined && pressedKnobPosition !== undefined,
|
|
29409
29479
|
'range-has-pin': pin,
|
|
29410
29480
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
29411
29481
|
'range-item-start-adjustment': needsStartAdjustment,
|
|
29412
29482
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
29413
29483
|
'range-value-min': valueAtMin,
|
|
29414
29484
|
'range-value-max': valueAtMax,
|
|
29415
|
-
}) }, hAsync("label", { key: '
|
|
29485
|
+
}) }, hAsync("label", { key: 'e14c56db4d1eef11a3a0639c4bbed368041fc3eb', class: "range-wrapper", id: "range-label" }, hAsync("div", { key: '16d125b0af19fdfa3663731657a7cca51a7ed442', class: {
|
|
29416
29486
|
'label-text-wrapper': true,
|
|
29417
29487
|
'label-text-wrapper-hidden': !hasLabel,
|
|
29418
|
-
}, part: "label" }, label !== undefined ? hAsync("div", { class: "label-text" }, label) : hAsync("slot", { name: "label" })), hAsync("div", { key: '
|
|
29488
|
+
}, part: "label" }, label !== undefined ? hAsync("div", { class: "label-text" }, label) : hAsync("slot", { name: "label" })), hAsync("div", { key: '545cc52a3e675e9df328dab537a4e44b7f3c59f8', class: "native-wrapper" }, hAsync("slot", { key: 'ac54b45a21c9db231ebe11498d508d05864b56fb', name: "start" }), this.renderRangeSlider(), hAsync("slot", { key: '7182dba53df2ff878d572b30afda64b37082c82e', name: "end" })))));
|
|
29419
29489
|
}
|
|
29420
29490
|
get el() { return getElement(this); }
|
|
29421
29491
|
static get watchers() { return {
|
|
@@ -29453,6 +29523,9 @@ class Range {
|
|
|
29453
29523
|
"labelPlacement": [1, "label-placement"],
|
|
29454
29524
|
"ratioA": [32],
|
|
29455
29525
|
"ratioB": [32],
|
|
29526
|
+
"activatedKnob": [32],
|
|
29527
|
+
"focusedKnob": [32],
|
|
29528
|
+
"hoveredKnob": [32],
|
|
29456
29529
|
"pressedKnob": [32]
|
|
29457
29530
|
},
|
|
29458
29531
|
"$listeners$": undefined,
|
|
@@ -29460,7 +29533,7 @@ class Range {
|
|
|
29460
29533
|
"$attrsToReflect$": [["color", "color"]]
|
|
29461
29534
|
}; }
|
|
29462
29535
|
}
|
|
29463
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
29536
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, activated, focused, hovered, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, onKnobMouseEnter, onKnobMouseLeave, }) => {
|
|
29464
29537
|
const start = rtl ? 'right' : 'left';
|
|
29465
29538
|
const knobStyle = () => {
|
|
29466
29539
|
const style = {};
|
|
@@ -29481,16 +29554,66 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
29481
29554
|
ev.preventDefault();
|
|
29482
29555
|
ev.stopPropagation();
|
|
29483
29556
|
}
|
|
29484
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
29557
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
29485
29558
|
'range-knob-handle': true,
|
|
29486
|
-
'range-knob-a': knob === 'A',
|
|
29487
|
-
'range-knob-b': knob === 'B',
|
|
29559
|
+
'range-knob-handle-a': knob === 'A',
|
|
29560
|
+
'range-knob-handle-b': knob === 'B',
|
|
29488
29561
|
'range-knob-pressed': pressed,
|
|
29489
29562
|
'range-knob-min': value === min,
|
|
29490
29563
|
'range-knob-max': value === max,
|
|
29491
29564
|
'ion-activatable': true,
|
|
29492
29565
|
'ion-focusable': true,
|
|
29493
|
-
|
|
29566
|
+
'ion-focused': focused,
|
|
29567
|
+
}, part: [
|
|
29568
|
+
'knob-handle',
|
|
29569
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
29570
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
29571
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
29572
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
29573
|
+
pressed && 'pressed',
|
|
29574
|
+
focused && 'focused',
|
|
29575
|
+
hovered && 'hover',
|
|
29576
|
+
activated && 'activated',
|
|
29577
|
+
]
|
|
29578
|
+
.filter(Boolean)
|
|
29579
|
+
.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: [
|
|
29580
|
+
'pin',
|
|
29581
|
+
dualKnobs && knob === 'A' && 'pin-a',
|
|
29582
|
+
dualKnobs && knob === 'B' && 'pin-b',
|
|
29583
|
+
dualKnobs && position === 'lower' && 'pin-lower',
|
|
29584
|
+
dualKnobs && position === 'upper' && 'pin-upper',
|
|
29585
|
+
pressed && 'pressed',
|
|
29586
|
+
focused && 'focused',
|
|
29587
|
+
hovered && 'hover',
|
|
29588
|
+
activated && 'activated',
|
|
29589
|
+
]
|
|
29590
|
+
.filter(Boolean)
|
|
29591
|
+
.join(' ') }, pinFormatter(value))), hAsync("div", { class: "range-knob", role: "presentation", part: [
|
|
29592
|
+
'knob',
|
|
29593
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
29594
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
29595
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
29596
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
29597
|
+
pressed && 'pressed',
|
|
29598
|
+
focused && 'focused',
|
|
29599
|
+
hovered && 'hover',
|
|
29600
|
+
activated && 'activated',
|
|
29601
|
+
]
|
|
29602
|
+
.filter(Boolean)
|
|
29603
|
+
.join(' ') })));
|
|
29604
|
+
};
|
|
29605
|
+
/**
|
|
29606
|
+
* Returns whether the given knob is at the lower or upper position based
|
|
29607
|
+
* on current ratios for the given knob.
|
|
29608
|
+
*/
|
|
29609
|
+
const getKnobPosition = (knob, ratioA, ratioB, dualKnobs) => {
|
|
29610
|
+
if (dualKnobs) {
|
|
29611
|
+
if (knob === 'A') {
|
|
29612
|
+
return ratioA <= ratioB ? 'lower' : 'upper';
|
|
29613
|
+
}
|
|
29614
|
+
return ratioB <= ratioA ? 'lower' : 'upper';
|
|
29615
|
+
}
|
|
29616
|
+
return 'lower';
|
|
29494
29617
|
};
|
|
29495
29618
|
const ratioToValue = (ratio, min, max, step) => {
|
|
29496
29619
|
let value = (max - min) * ratio;
|