@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.mjs
CHANGED
|
@@ -12878,21 +12878,14 @@ const datetimeMdCss = ":host{display:-ms-flexbox;display:flex;-ms-flex-flow:colu
|
|
|
12878
12878
|
* layout with `presentation="date-time"` or `"time-date"`.
|
|
12879
12879
|
* @part time-button active - The time picker button when the picker is open.
|
|
12880
12880
|
*
|
|
12881
|
-
* @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.
|
|
12882
12881
|
* @part month-year-button - The button that opens the month/year picker when
|
|
12883
12882
|
* using a grid style layout.
|
|
12884
|
-
* @part prev-next-buttons - The buttons used to navigate to the next or previous month when using a grid style layout.
|
|
12885
|
-
* @part prev-button - The button used to navigate to the previous month when using a grid style layout.
|
|
12886
|
-
* @part next-button - The button used to navigate to the next month when using a grid style layout.
|
|
12887
|
-
* @part days-of-week - The container for the day-of-the-week header (both weekdays and weekends) when using a grid style layout.
|
|
12888
12883
|
*
|
|
12889
12884
|
* @part calendar-day - The individual buttons that display a day inside of the datetime
|
|
12890
12885
|
* calendar.
|
|
12891
12886
|
* @part calendar-day active - The currently selected calendar day.
|
|
12892
12887
|
* @part calendar-day today - The calendar day that contains the current day.
|
|
12893
12888
|
* @part calendar-day disabled - The calendar day that is disabled.
|
|
12894
|
-
*
|
|
12895
|
-
* @part datetime-header - The datetime header contains the content for the `title` slot and the selected date.
|
|
12896
12889
|
*/
|
|
12897
12890
|
class Datetime {
|
|
12898
12891
|
constructor(hostRef) {
|
|
@@ -14234,11 +14227,11 @@ class Datetime {
|
|
|
14234
14227
|
const nextMonthDisabled = disabled || isNextMonthDisabled(this.workingParts, this.maxParts);
|
|
14235
14228
|
// don't use the inheritAttributes util because it removes dir from the host, and we still need that
|
|
14236
14229
|
const hostDir = this.el.getAttribute('dir') || undefined;
|
|
14237
|
-
return (hAsync("div", { class: "calendar-header"
|
|
14230
|
+
return (hAsync("div", { class: "calendar-header" }, hAsync("div", { class: "calendar-action-buttons" }, hAsync("div", { class: "calendar-month-year" }, hAsync("button", { class: {
|
|
14238
14231
|
'calendar-month-year-toggle': true,
|
|
14239
14232
|
'ion-activatable': true,
|
|
14240
14233
|
'ion-focusable': true,
|
|
14241
|
-
}, 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()
|
|
14234
|
+
}, 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) => {
|
|
14242
14235
|
return hAsync("div", { class: "day-of-week" }, d);
|
|
14243
14236
|
}))));
|
|
14244
14237
|
}
|
|
@@ -14470,7 +14463,7 @@ class Datetime {
|
|
|
14470
14463
|
if (!hasSlottedTitle && !this.showDefaultTitle) {
|
|
14471
14464
|
return;
|
|
14472
14465
|
}
|
|
14473
|
-
return (hAsync("div", { class: "datetime-header"
|
|
14466
|
+
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())));
|
|
14474
14467
|
}
|
|
14475
14468
|
/**
|
|
14476
14469
|
* Render time picker inside of datetime.
|
|
@@ -14550,7 +14543,7 @@ class Datetime {
|
|
|
14550
14543
|
const hasDatePresentation = presentation === 'date' || presentation === 'date-time' || presentation === 'time-date';
|
|
14551
14544
|
const hasWheelVariant = hasDatePresentation && preferWheel;
|
|
14552
14545
|
renderHiddenInput(true, el, name, formatValue(value), disabled);
|
|
14553
|
-
return (hAsync(Host, { key: '
|
|
14546
|
+
return (hAsync(Host, { key: '19e20c9b6b5f9467e91a2567b6dc7d9d38b56cc3', "aria-disabled": disabled ? 'true' : null, onFocus: this.onFocus, onBlur: this.onBlur, class: Object.assign({}, createColorClasses$1(color, {
|
|
14554
14547
|
[mode]: true,
|
|
14555
14548
|
['datetime-readonly']: readonly,
|
|
14556
14549
|
['datetime-disabled']: disabled,
|
|
@@ -14560,7 +14553,7 @@ class Datetime {
|
|
|
14560
14553
|
[`datetime-size-${size}`]: true,
|
|
14561
14554
|
[`datetime-prefer-wheel`]: hasWheelVariant,
|
|
14562
14555
|
[`datetime-grid`]: isGridStyle,
|
|
14563
|
-
})) }, hAsync("div", { key: '
|
|
14556
|
+
})) }, hAsync("div", { key: 'e31b5ef76cd6262dafd39f2d21980887880ec32e', class: "intersection-tracker", ref: (el) => (this.intersectionTrackerRef = el) }), this.renderDatetime(mode)));
|
|
14564
14557
|
}
|
|
14565
14558
|
get el() { return getElement(this); }
|
|
14566
14559
|
static get watchers() { return {
|
|
@@ -28722,13 +28715,30 @@ const rangeMdCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:
|
|
|
28722
28715
|
* @slot start - Content is placed to the left of the range slider in LTR, and to the right in RTL.
|
|
28723
28716
|
* @slot end - Content is placed to the right of the range slider in LTR, and to the left in RTL.
|
|
28724
28717
|
*
|
|
28718
|
+
* @part label - The label text describing the range.
|
|
28725
28719
|
* @part tick - An inactive tick mark.
|
|
28726
28720
|
* @part tick-active - An active tick mark.
|
|
28727
|
-
* @part pin - The counter that appears above a knob.
|
|
28728
|
-
* @part knob - The handle that is used to drag the range.
|
|
28729
28721
|
* @part bar - The inactive part of the bar.
|
|
28730
28722
|
* @part bar-active - The active part of the bar.
|
|
28731
|
-
* @part
|
|
28723
|
+
* @part knob-handle - The container element that wraps the knob and handles drag interactions.
|
|
28724
|
+
* @part knob-handle-a - The container element for the first knob. Only available when `dualKnobs` is `true`.
|
|
28725
|
+
* @part knob-handle-b - The container element for the second knob. Only available when `dualKnobs` is `true`.
|
|
28726
|
+
* @part knob-handle-lower - The container element for the lower knob. Only available when `dualKnobs` is `true`.
|
|
28727
|
+
* @part knob-handle-upper - The container element for the upper knob. Only available when `dualKnobs` is `true`.
|
|
28728
|
+
* @part pin - The counter that appears above a knob.
|
|
28729
|
+
* @part pin-a - The counter that appears above the first knob. Only available when `dualKnobs` is `true`.
|
|
28730
|
+
* @part pin-b - The counter that appears above the second knob. Only available when `dualKnobs` is `true`.
|
|
28731
|
+
* @part pin-lower - The counter that appears above the lower knob. Only available when `dualKnobs` is `true`.
|
|
28732
|
+
* @part pin-upper - The counter that appears above the upper knob. Only available when `dualKnobs` is `true`.
|
|
28733
|
+
* @part knob - The visual knob element that appears on the range track.
|
|
28734
|
+
* @part knob-a - The visual knob element for the first knob. Only available when `dualKnobs` is `true`.
|
|
28735
|
+
* @part knob-b - The visual knob element for the second knob. Only available when `dualKnobs` is `true`.
|
|
28736
|
+
* @part knob-lower - The visual knob element for the lower knob. Only available when `dualKnobs` is `true`.
|
|
28737
|
+
* @part knob-upper - The visual knob element for the upper knob. Only available when `dualKnobs` is `true`.
|
|
28738
|
+
* @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`.
|
|
28739
|
+
* @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`.
|
|
28740
|
+
* @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`.
|
|
28741
|
+
* @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`.
|
|
28732
28742
|
*/
|
|
28733
28743
|
class Range {
|
|
28734
28744
|
constructor(hostRef) {
|
|
@@ -28746,6 +28756,7 @@ class Range {
|
|
|
28746
28756
|
this.inheritedAttributes = {};
|
|
28747
28757
|
this.contentEl = null;
|
|
28748
28758
|
this.initialContentScrollY = true;
|
|
28759
|
+
this.focusFromPointer = false;
|
|
28749
28760
|
this.ratioA = 0;
|
|
28750
28761
|
this.ratioB = 0;
|
|
28751
28762
|
/**
|
|
@@ -28855,6 +28866,29 @@ class Range {
|
|
|
28855
28866
|
this.gesture.enable(!this.disabled);
|
|
28856
28867
|
}
|
|
28857
28868
|
};
|
|
28869
|
+
/**
|
|
28870
|
+
* Observes the knob handles for the ion-activated class and syncs
|
|
28871
|
+
* activatedKnob so the activated part is correctly set on the handle,
|
|
28872
|
+
* knob, and pin.
|
|
28873
|
+
*/
|
|
28874
|
+
this.setupActivatedObserver = () => {
|
|
28875
|
+
const knobHandleA = this.el.shadowRoot.querySelector('.range-knob-handle-a');
|
|
28876
|
+
const knobHandleB = this.el.shadowRoot.querySelector('.range-knob-handle-b');
|
|
28877
|
+
const syncActivated = () => {
|
|
28878
|
+
this.activatedKnob = (knobHandleA === null || knobHandleA === void 0 ? void 0 : knobHandleA.classList.contains('ion-activated'))
|
|
28879
|
+
? 'A'
|
|
28880
|
+
: (knobHandleB === null || knobHandleB === void 0 ? void 0 : knobHandleB.classList.contains('ion-activated'))
|
|
28881
|
+
? 'B'
|
|
28882
|
+
: undefined;
|
|
28883
|
+
};
|
|
28884
|
+
this.activatedObserver = new MutationObserver(syncActivated);
|
|
28885
|
+
this.activatedObserver.observe(this.el.shadowRoot, {
|
|
28886
|
+
attributes: true,
|
|
28887
|
+
attributeFilter: ['class'],
|
|
28888
|
+
subtree: true,
|
|
28889
|
+
});
|
|
28890
|
+
syncActivated();
|
|
28891
|
+
};
|
|
28858
28892
|
this.handleKeyboard = (knob, isIncrease) => {
|
|
28859
28893
|
const { ensureValueInBounds } = this;
|
|
28860
28894
|
let step = this.step;
|
|
@@ -28877,6 +28911,7 @@ class Range {
|
|
|
28877
28911
|
this.onBlur = () => {
|
|
28878
28912
|
if (this.hasFocus) {
|
|
28879
28913
|
this.hasFocus = false;
|
|
28914
|
+
this.focusedKnob = undefined;
|
|
28880
28915
|
this.ionBlur.emit();
|
|
28881
28916
|
}
|
|
28882
28917
|
};
|
|
@@ -28887,21 +28922,20 @@ class Range {
|
|
|
28887
28922
|
}
|
|
28888
28923
|
};
|
|
28889
28924
|
this.onKnobFocus = (knob) => {
|
|
28925
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
28926
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
28927
|
+
if (!this.focusFromPointer) {
|
|
28928
|
+
this.focusedKnob = knob;
|
|
28929
|
+
}
|
|
28930
|
+
else {
|
|
28931
|
+
this.focusFromPointer = false;
|
|
28932
|
+
this.focusedKnob = undefined;
|
|
28933
|
+
}
|
|
28934
|
+
// If the knob was not already focused, emit the focus event
|
|
28890
28935
|
if (!this.hasFocus) {
|
|
28891
28936
|
this.hasFocus = true;
|
|
28892
28937
|
this.ionFocus.emit();
|
|
28893
28938
|
}
|
|
28894
|
-
// Manually manage ion-focused class for dual knobs
|
|
28895
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
28896
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
28897
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
28898
|
-
// Remove ion-focused from both knobs first
|
|
28899
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
28900
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
28901
|
-
// Add ion-focused only to the focused knob
|
|
28902
|
-
const focusedKnobEl = knob === 'A' ? knobA : knobB;
|
|
28903
|
-
focusedKnobEl === null || focusedKnobEl === void 0 ? void 0 : focusedKnobEl.classList.add('ion-focused');
|
|
28904
|
-
}
|
|
28905
28939
|
};
|
|
28906
28940
|
this.onKnobBlur = () => {
|
|
28907
28941
|
// Check if focus is moving to another knob within the same range
|
|
@@ -28913,18 +28947,18 @@ class Range {
|
|
|
28913
28947
|
if (!isStillFocusedOnKnob) {
|
|
28914
28948
|
if (this.hasFocus) {
|
|
28915
28949
|
this.hasFocus = false;
|
|
28950
|
+
this.focusedKnob = undefined;
|
|
28916
28951
|
this.ionBlur.emit();
|
|
28917
28952
|
}
|
|
28918
|
-
// Remove ion-focused from both knobs when focus leaves the range
|
|
28919
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
28920
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
28921
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
28922
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
28923
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
28924
|
-
}
|
|
28925
28953
|
}
|
|
28926
28954
|
}, 0);
|
|
28927
28955
|
};
|
|
28956
|
+
this.onKnobMouseEnter = (knob) => {
|
|
28957
|
+
this.hoveredKnob = knob;
|
|
28958
|
+
};
|
|
28959
|
+
this.onKnobMouseLeave = () => {
|
|
28960
|
+
this.hoveredKnob = undefined;
|
|
28961
|
+
};
|
|
28928
28962
|
}
|
|
28929
28963
|
debounceChanged() {
|
|
28930
28964
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -29001,6 +29035,7 @@ class Range {
|
|
|
29001
29035
|
this.originalIonInput = this.ionInput;
|
|
29002
29036
|
this.setupGesture();
|
|
29003
29037
|
this.updateRatio();
|
|
29038
|
+
this.setupActivatedObserver();
|
|
29004
29039
|
this.didLoad = true;
|
|
29005
29040
|
}
|
|
29006
29041
|
connectedCallback() {
|
|
@@ -29026,6 +29061,10 @@ class Range {
|
|
|
29026
29061
|
this.gesture.destroy();
|
|
29027
29062
|
this.gesture = undefined;
|
|
29028
29063
|
}
|
|
29064
|
+
if (this.activatedObserver) {
|
|
29065
|
+
this.activatedObserver.disconnect();
|
|
29066
|
+
this.activatedObserver = undefined;
|
|
29067
|
+
}
|
|
29029
29068
|
}
|
|
29030
29069
|
getValue() {
|
|
29031
29070
|
var _a;
|
|
@@ -29178,7 +29217,6 @@ class Range {
|
|
|
29178
29217
|
ratio = 1 - ratio;
|
|
29179
29218
|
}
|
|
29180
29219
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
29181
|
-
this.setFocus(this.pressedKnob);
|
|
29182
29220
|
}
|
|
29183
29221
|
get valA() {
|
|
29184
29222
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -29205,9 +29243,23 @@ class Range {
|
|
|
29205
29243
|
updateRatio() {
|
|
29206
29244
|
const value = this.getValue();
|
|
29207
29245
|
const { min, max } = this;
|
|
29246
|
+
/**
|
|
29247
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
29248
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
29249
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
29250
|
+
*/
|
|
29208
29251
|
if (this.dualKnobs) {
|
|
29209
|
-
|
|
29210
|
-
|
|
29252
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
29253
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
29254
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
29255
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
29256
|
+
this.ratioA = lowerRatio;
|
|
29257
|
+
this.ratioB = upperRatio;
|
|
29258
|
+
}
|
|
29259
|
+
else {
|
|
29260
|
+
this.ratioA = upperRatio;
|
|
29261
|
+
this.ratioB = lowerRatio;
|
|
29262
|
+
}
|
|
29211
29263
|
}
|
|
29212
29264
|
else {
|
|
29213
29265
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -29224,14 +29276,6 @@ class Range {
|
|
|
29224
29276
|
};
|
|
29225
29277
|
this.noUpdate = false;
|
|
29226
29278
|
}
|
|
29227
|
-
setFocus(knob) {
|
|
29228
|
-
if (this.el.shadowRoot) {
|
|
29229
|
-
const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
|
|
29230
|
-
if (knobEl) {
|
|
29231
|
-
knobEl.focus();
|
|
29232
|
-
}
|
|
29233
|
-
}
|
|
29234
|
-
}
|
|
29235
29279
|
/**
|
|
29236
29280
|
* Returns true if content was passed to the "start" slot
|
|
29237
29281
|
*/
|
|
@@ -29249,7 +29293,7 @@ class Range {
|
|
|
29249
29293
|
}
|
|
29250
29294
|
renderRangeSlider() {
|
|
29251
29295
|
var _a;
|
|
29252
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
29296
|
+
const { min, max, step, handleKeyboard, activatedKnob, focusedKnob, hoveredKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
29253
29297
|
let barStart = `${ratioLower * 100}%`;
|
|
29254
29298
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
29255
29299
|
const rtl = isRTL$1(this.el);
|
|
@@ -29309,7 +29353,9 @@ class Range {
|
|
|
29309
29353
|
ticks.push(tick);
|
|
29310
29354
|
}
|
|
29311
29355
|
}
|
|
29312
|
-
return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
29356
|
+
return (hAsync("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
29357
|
+
this.focusFromPointer = true;
|
|
29358
|
+
},
|
|
29313
29359
|
/**
|
|
29314
29360
|
* Since the gesture has a threshold, the value
|
|
29315
29361
|
* won't change until the user has dragged past
|
|
@@ -29322,6 +29368,7 @@ class Range {
|
|
|
29322
29368
|
* we need to listen for the "pointerUp" event.
|
|
29323
29369
|
*/
|
|
29324
29370
|
onPointerUp: (ev) => {
|
|
29371
|
+
this.focusFromPointer = false;
|
|
29325
29372
|
/**
|
|
29326
29373
|
* If the user drags the knob on the web
|
|
29327
29374
|
* version (does not occur on mobile),
|
|
@@ -29347,6 +29394,11 @@ class Range {
|
|
|
29347
29394
|
'has-ticks': ticks.length > 0,
|
|
29348
29395
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
29349
29396
|
knob: 'A',
|
|
29397
|
+
position: getKnobPosition('A', this.ratioA, this.ratioB, this.dualKnobs),
|
|
29398
|
+
dualKnobs: this.dualKnobs,
|
|
29399
|
+
activated: activatedKnob === 'A',
|
|
29400
|
+
focused: focusedKnob === 'A',
|
|
29401
|
+
hovered: hoveredKnob === 'A',
|
|
29350
29402
|
pressed: pressedKnob === 'A',
|
|
29351
29403
|
value: this.valA,
|
|
29352
29404
|
ratio: this.ratioA,
|
|
@@ -29359,9 +29411,16 @@ class Range {
|
|
|
29359
29411
|
inheritedAttributes,
|
|
29360
29412
|
onKnobFocus: this.onKnobFocus,
|
|
29361
29413
|
onKnobBlur: this.onKnobBlur,
|
|
29414
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29415
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29362
29416
|
}), this.dualKnobs &&
|
|
29363
29417
|
renderKnob(rtl, {
|
|
29364
29418
|
knob: 'B',
|
|
29419
|
+
position: getKnobPosition('B', this.ratioA, this.ratioB, this.dualKnobs),
|
|
29420
|
+
dualKnobs: this.dualKnobs,
|
|
29421
|
+
activated: activatedKnob === 'B',
|
|
29422
|
+
focused: focusedKnob === 'B',
|
|
29423
|
+
hovered: hoveredKnob === 'B',
|
|
29365
29424
|
pressed: pressedKnob === 'B',
|
|
29366
29425
|
value: this.valB,
|
|
29367
29426
|
ratio: this.ratioB,
|
|
@@ -29374,6 +29433,8 @@ class Range {
|
|
|
29374
29433
|
inheritedAttributes,
|
|
29375
29434
|
onKnobFocus: this.onKnobFocus,
|
|
29376
29435
|
onKnobBlur: this.onKnobBlur,
|
|
29436
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29437
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29377
29438
|
})));
|
|
29378
29439
|
}
|
|
29379
29440
|
render() {
|
|
@@ -29392,6 +29453,12 @@ class Range {
|
|
|
29392
29453
|
const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent;
|
|
29393
29454
|
const needsEndAdjustment = inItem && !hasEndContent;
|
|
29394
29455
|
const mode = getIonMode$1(this);
|
|
29456
|
+
/**
|
|
29457
|
+
* Determine the name and position of the pressed knob to apply
|
|
29458
|
+
* Host classes for styling.
|
|
29459
|
+
*/
|
|
29460
|
+
const pressedKnobName = dualKnobs ? pressedKnob === null || pressedKnob === void 0 ? void 0 : pressedKnob.toLowerCase() : undefined;
|
|
29461
|
+
const pressedKnobPosition = dualKnobs && pressedKnob ? getKnobPosition(pressedKnob, this.ratioA, this.ratioB, dualKnobs) : undefined;
|
|
29395
29462
|
/**
|
|
29396
29463
|
* Determine if any knob is at the min or max value to
|
|
29397
29464
|
* apply Host classes for styling.
|
|
@@ -29399,21 +29466,24 @@ class Range {
|
|
|
29399
29466
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
29400
29467
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
29401
29468
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
29402
|
-
return (hAsync(Host, { key: '
|
|
29469
|
+
return (hAsync(Host, { key: '8e439db9836fdefdc779573082c788e3ddb3ef73', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses$1(this.color, {
|
|
29403
29470
|
[mode]: true,
|
|
29404
29471
|
'in-item': inItem,
|
|
29405
29472
|
'range-disabled': disabled,
|
|
29473
|
+
'range-dual-knobs': dualKnobs,
|
|
29406
29474
|
'range-pressed': pressedKnob !== undefined,
|
|
29475
|
+
[`range-pressed-${pressedKnobName}`]: pressedKnob !== undefined && pressedKnobName !== undefined,
|
|
29476
|
+
[`range-pressed-${pressedKnobPosition}`]: pressedKnob !== undefined && pressedKnobPosition !== undefined,
|
|
29407
29477
|
'range-has-pin': pin,
|
|
29408
29478
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
29409
29479
|
'range-item-start-adjustment': needsStartAdjustment,
|
|
29410
29480
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
29411
29481
|
'range-value-min': valueAtMin,
|
|
29412
29482
|
'range-value-max': valueAtMax,
|
|
29413
|
-
}) }, hAsync("label", { key: '
|
|
29483
|
+
}) }, hAsync("label", { key: 'e14c56db4d1eef11a3a0639c4bbed368041fc3eb', class: "range-wrapper", id: "range-label" }, hAsync("div", { key: '16d125b0af19fdfa3663731657a7cca51a7ed442', class: {
|
|
29414
29484
|
'label-text-wrapper': true,
|
|
29415
29485
|
'label-text-wrapper-hidden': !hasLabel,
|
|
29416
|
-
}, part: "label" }, label !== undefined ? hAsync("div", { class: "label-text" }, label) : hAsync("slot", { name: "label" })), hAsync("div", { key: '
|
|
29486
|
+
}, 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" })))));
|
|
29417
29487
|
}
|
|
29418
29488
|
get el() { return getElement(this); }
|
|
29419
29489
|
static get watchers() { return {
|
|
@@ -29451,6 +29521,9 @@ class Range {
|
|
|
29451
29521
|
"labelPlacement": [1, "label-placement"],
|
|
29452
29522
|
"ratioA": [32],
|
|
29453
29523
|
"ratioB": [32],
|
|
29524
|
+
"activatedKnob": [32],
|
|
29525
|
+
"focusedKnob": [32],
|
|
29526
|
+
"hoveredKnob": [32],
|
|
29454
29527
|
"pressedKnob": [32]
|
|
29455
29528
|
},
|
|
29456
29529
|
"$listeners$": undefined,
|
|
@@ -29458,7 +29531,7 @@ class Range {
|
|
|
29458
29531
|
"$attrsToReflect$": [["color", "color"]]
|
|
29459
29532
|
}; }
|
|
29460
29533
|
}
|
|
29461
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
29534
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, activated, focused, hovered, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, onKnobMouseEnter, onKnobMouseLeave, }) => {
|
|
29462
29535
|
const start = rtl ? 'right' : 'left';
|
|
29463
29536
|
const knobStyle = () => {
|
|
29464
29537
|
const style = {};
|
|
@@ -29479,16 +29552,66 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
29479
29552
|
ev.preventDefault();
|
|
29480
29553
|
ev.stopPropagation();
|
|
29481
29554
|
}
|
|
29482
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
29555
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
29483
29556
|
'range-knob-handle': true,
|
|
29484
|
-
'range-knob-a': knob === 'A',
|
|
29485
|
-
'range-knob-b': knob === 'B',
|
|
29557
|
+
'range-knob-handle-a': knob === 'A',
|
|
29558
|
+
'range-knob-handle-b': knob === 'B',
|
|
29486
29559
|
'range-knob-pressed': pressed,
|
|
29487
29560
|
'range-knob-min': value === min,
|
|
29488
29561
|
'range-knob-max': value === max,
|
|
29489
29562
|
'ion-activatable': true,
|
|
29490
29563
|
'ion-focusable': true,
|
|
29491
|
-
|
|
29564
|
+
'ion-focused': focused,
|
|
29565
|
+
}, part: [
|
|
29566
|
+
'knob-handle',
|
|
29567
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
29568
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
29569
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
29570
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
29571
|
+
pressed && 'pressed',
|
|
29572
|
+
focused && 'focused',
|
|
29573
|
+
hovered && 'hover',
|
|
29574
|
+
activated && 'activated',
|
|
29575
|
+
]
|
|
29576
|
+
.filter(Boolean)
|
|
29577
|
+
.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: [
|
|
29578
|
+
'pin',
|
|
29579
|
+
dualKnobs && knob === 'A' && 'pin-a',
|
|
29580
|
+
dualKnobs && knob === 'B' && 'pin-b',
|
|
29581
|
+
dualKnobs && position === 'lower' && 'pin-lower',
|
|
29582
|
+
dualKnobs && position === 'upper' && 'pin-upper',
|
|
29583
|
+
pressed && 'pressed',
|
|
29584
|
+
focused && 'focused',
|
|
29585
|
+
hovered && 'hover',
|
|
29586
|
+
activated && 'activated',
|
|
29587
|
+
]
|
|
29588
|
+
.filter(Boolean)
|
|
29589
|
+
.join(' ') }, pinFormatter(value))), hAsync("div", { class: "range-knob", role: "presentation", part: [
|
|
29590
|
+
'knob',
|
|
29591
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
29592
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
29593
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
29594
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
29595
|
+
pressed && 'pressed',
|
|
29596
|
+
focused && 'focused',
|
|
29597
|
+
hovered && 'hover',
|
|
29598
|
+
activated && 'activated',
|
|
29599
|
+
]
|
|
29600
|
+
.filter(Boolean)
|
|
29601
|
+
.join(' ') })));
|
|
29602
|
+
};
|
|
29603
|
+
/**
|
|
29604
|
+
* Returns whether the given knob is at the lower or upper position based
|
|
29605
|
+
* on current ratios for the given knob.
|
|
29606
|
+
*/
|
|
29607
|
+
const getKnobPosition = (knob, ratioA, ratioB, dualKnobs) => {
|
|
29608
|
+
if (dualKnobs) {
|
|
29609
|
+
if (knob === 'A') {
|
|
29610
|
+
return ratioA <= ratioB ? 'lower' : 'upper';
|
|
29611
|
+
}
|
|
29612
|
+
return ratioB <= ratioA ? 'lower' : 'upper';
|
|
29613
|
+
}
|
|
29614
|
+
return 'lower';
|
|
29492
29615
|
};
|
|
29493
29616
|
const ratioToValue = (ratio, min, max, step) => {
|
|
29494
29617
|
let value = (max - min) * ratio;
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
-
*/
|
|
4
|
-
import{r as e,c as t,f as a,h as n,d as r,g as i}from"./p-C8IsBmNU.js";import{f as o,d as s,r as l}from"./p-CwgG81ZD.js";import{j as h,e as d,d as b,i as g,a as c}from"./p-CTfR9YZG.js";import{i as p}from"./p-C53feagD.js";import{h as m,c as u}from"./p-DiVJyqlX.js";import{b as k}from"./p-BFvmZNyx.js";const x=class{constructor(a){e(this,a),this.ionChange=t(this,"ionChange",7),this.ionInput=t(this,"ionInput",7),this.ionFocus=t(this,"ionFocus",7),this.ionBlur=t(this,"ionBlur",7),this.ionKnobMoveStart=t(this,"ionKnobMoveStart",7),this.ionKnobMoveEnd=t(this,"ionKnobMoveEnd",7),this.rangeId="ion-r-"+y++,this.didLoad=!1,this.noUpdate=!1,this.hasFocus=!1,this.inheritedAttributes={},this.contentEl=null,this.initialContentScrollY=!0,this.ratioA=0,this.ratioB=0,this.name=this.rangeId,this.dualKnobs=!1,this.min=0,this.max=100,this.pin=!1,this.pinFormatter=e=>Math.round(e),this.snaps=!1,this.step=1,this.ticks=!0,this.disabled=!1,this.value=0,this.compareValues=(e,t)=>"object"==typeof e&&"object"==typeof t?e.lower!==t.lower||e.upper!==t.upper:e!==t,this.clampBounds=e=>d(this.min,e,this.max),this.ensureValueInBounds=e=>this.dualKnobs?{lower:this.clampBounds(e.lower),upper:this.clampBounds(e.upper)}:this.clampBounds(e),this.labelPlacement="start",this.setupGesture=async()=>{const e=this.rangeSlider;e&&(this.gesture=(await import("./p-Cl0B-RWe.js")).createGesture({el:e,gestureName:"range",gesturePriority:100,threshold:10,onStart:()=>this.onStart(),onMove:e=>this.onMove(e),onEnd:e=>this.onEnd(e)}),this.gesture.enable(!this.disabled))},this.handleKeyboard=(e,t)=>{const{ensureValueInBounds:a}=this;let n=this.step;n=n>0?n:1,n/=this.max-this.min,t||(n*=-1),"A"===e?this.ratioA=d(0,this.ratioA+n,1):this.ratioB=d(0,this.ratioB+n,1),this.ionKnobMoveStart.emit({value:a(this.value)}),this.updateValue(),this.emitValueChange(),this.ionKnobMoveEnd.emit({value:a(this.value)})},this.onBlur=()=>{this.hasFocus&&(this.hasFocus=!1,this.ionBlur.emit())},this.onFocus=()=>{this.hasFocus||(this.hasFocus=!0,this.ionFocus.emit())},this.onKnobFocus=e=>{if(this.hasFocus||(this.hasFocus=!0,this.ionFocus.emit()),this.dualKnobs&&this.el.shadowRoot){const t=this.el.shadowRoot.querySelector(".range-knob-a"),a=this.el.shadowRoot.querySelector(".range-knob-b");null==t||t.classList.remove("ion-focused"),null==a||a.classList.remove("ion-focused");const n="A"===e?t:a;null==n||n.classList.add("ion-focused")}},this.onKnobBlur=()=>{setTimeout((()=>{var e;const t=null===(e=this.el.shadowRoot)||void 0===e?void 0:e.activeElement;if((!t||!t.classList.contains("range-knob-handle"))&&(this.hasFocus&&(this.hasFocus=!1,this.ionBlur.emit()),this.dualKnobs&&this.el.shadowRoot)){const e=this.el.shadowRoot.querySelector(".range-knob-a"),t=this.el.shadowRoot.querySelector(".range-knob-b");null==e||e.classList.remove("ion-focused"),null==t||t.classList.remove("ion-focused")}}),0)}}debounceChanged(){const{ionInput:e,debounce:t,originalIonInput:a}=this;this.ionInput=void 0===t?null!=a?a:e:b(e,t)}minChanged(e){h(e)||(this.min=0),this.noUpdate||this.updateRatio()}maxChanged(e){h(e)||(this.max=100),this.noUpdate||this.updateRatio()}stepChanged(e){h(e)||(this.step=1)}activeBarStartChanged(){const{activeBarStart:e}=this;void 0!==e&&(e>this.max?(a(`[ion-range] - The value of activeBarStart (${e}) is greater than the max (${this.max}). Valid values are greater than or equal to the min value and less than or equal to the max value.`,this.el),this.activeBarStart=this.max):e<this.min&&(a(`[ion-range] - The value of activeBarStart (${e}) is less than the min (${this.min}). Valid values are greater than or equal to the min value and less than or equal to the max value.`,this.el),this.activeBarStart=this.min))}disabledChanged(){this.gesture&&this.gesture.enable(!this.disabled)}valueChanged(e,t){this.compareValues(e,t)&&this.ionInput.emit({value:this.value}),this.noUpdate||this.updateRatio()}componentWillLoad(){this.el.hasAttribute("id")&&(this.rangeId=this.el.getAttribute("id")),this.inheritedAttributes=g(this.el),this.min=h(this.min)?this.min:0,this.max=h(this.max)?this.max:100,this.step=h(this.step)?this.step:1}componentDidLoad(){this.originalIonInput=this.ionInput,this.setupGesture(),this.updateRatio(),this.didLoad=!0}connectedCallback(){var e;this.updateRatio(),this.debounceChanged(),this.disabledChanged(),this.activeBarStartChanged(),this.didLoad&&this.setupGesture();const t=o(this.el);this.contentEl=null!==(e=null==t?void 0:t.querySelector(".ion-content-scroll-host"))&&void 0!==e?e:t}disconnectedCallback(){this.gesture&&(this.gesture.destroy(),this.gesture=void 0)}getValue(){var e;const t=null!==(e=this.value)&&void 0!==e?e:0;return this.dualKnobs?"object"==typeof t?t:{lower:0,upper:t}:"object"==typeof t?t.upper:t}emitValueChange(){this.value=this.ensureValueInBounds(this.value),this.ionChange.emit({value:this.value})}onStart(){this.ionKnobMoveStart.emit({value:this.ensureValueInBounds(this.value)})}onMove(e){const{contentEl:t,pressedKnob:a}=this,n=e.currentX;t&&void 0===this.pressedKnob&&(this.initialContentScrollY=s(t)),void 0===a&&this.setPressedKnob(n),this.update(n)}onEnd(e){var t;const{contentEl:a,initialContentScrollY:n}=this,r=null!==(t=e.currentX)&&void 0!==t?t:e.clientX;void 0===this.pressedKnob&&this.setPressedKnob(r),a&&void 0!==this.pressedKnob&&l(a,n),this.update(r),this.pressedKnob=void 0,this.emitValueChange(),this.ionKnobMoveEnd.emit({value:this.ensureValueInBounds(this.value)})}update(e){const t=this.rect;let a=d(0,(e-t.left)/t.width,1);p(this.el)&&(a=1-a),this.snaps&&(a=w(v(a,this.min,this.max,this.step),this.min,this.max)),"A"===this.pressedKnob?this.ratioA=a:this.ratioB=a,this.updateValue()}setPressedKnob(e){const t=this.rect=this.rangeSlider.getBoundingClientRect();let a=d(0,(e-t.left)/t.width,1);p(this.el)&&(a=1-a),this.pressedKnob=!this.dualKnobs||Math.abs(this.ratioA-a)<Math.abs(this.ratioB-a)?"A":"B",this.setFocus(this.pressedKnob)}get valA(){return v(this.ratioA,this.min,this.max,this.step)}get valB(){return v(this.ratioB,this.min,this.max,this.step)}get ratioLower(){if(this.dualKnobs)return Math.min(this.ratioA,this.ratioB);const{activeBarStart:e}=this;return null==e?0:w(e,this.min,this.max)}get ratioUpper(){return this.dualKnobs?Math.max(this.ratioA,this.ratioB):this.ratioA}updateRatio(){const e=this.getValue(),{min:t,max:a}=this;this.dualKnobs?(this.ratioA=w(e.lower,t,a),this.ratioB=w(e.upper,t,a)):this.ratioA=w(e,t,a)}updateValue(){this.noUpdate=!0;const{valA:e,valB:t}=this;this.value=this.dualKnobs?{lower:Math.min(e,t),upper:Math.max(e,t)}:e,this.noUpdate=!1}setFocus(e){if(this.el.shadowRoot){const t=this.el.shadowRoot.querySelector("A"===e?".range-knob-a":".range-knob-b");t&&t.focus()}}get hasStartSlotContent(){return null!==this.el.querySelector('[slot="start"]')}get hasEndSlotContent(){return null!==this.el.querySelector('[slot="end"]')}get hasLabel(){return void 0!==this.label||null!==this.el.querySelector('[slot="label"]')}renderRangeSlider(){var e;const{min:t,max:a,step:r,handleKeyboard:i,pressedKnob:o,disabled:s,pin:l,ratioLower:h,ratioUpper:d,pinFormatter:b,inheritedAttributes:g}=this;let c=100*h+"%",m=100-100*d+"%";const u=p(this.el),k=u?"right":"left",x=u?"left":"right",v=e=>({[k]:e[k]});!1===this.dualKnobs&&(this.valA<(null!==(e=this.activeBarStart)&&void 0!==e?e:this.min)?(c=100*d+"%",m=100-100*h+"%"):(c=100*h+"%",m=100-100*d+"%"));const y={[k]:c,[x]:m},z=[];if(this.snaps&&this.ticks)for(let e=t;e<=a;e+=r){const n=w(e,t,a),r=Math.min(h,d),i=Math.max(h,d),o={ratio:n,active:n>=r&&n<=i};o[k]=100*n+"%",z.push(o)}return n("div",{class:"range-slider",ref:e=>this.rangeSlider=e,onPointerUp:e=>{void 0===this.pressedKnob&&(this.onStart(),this.onEnd(e))}},z.map((e=>n("div",{style:v(e),role:"presentation",class:{"range-tick":!0,"range-tick-active":e.active},part:e.active?"tick-active":"tick"}))),n("div",{class:"range-bar-container"},n("div",{class:"range-bar",role:"presentation",part:"bar"}),n("div",{class:{"range-bar":!0,"range-bar-active":!0,"has-ticks":z.length>0},role:"presentation",style:y,part:"bar-active"})),f(u,{knob:"A",pressed:"A"===o,value:this.valA,ratio:this.ratioA,pin:l,pinFormatter:b,disabled:s,handleKeyboard:i,min:t,max:a,inheritedAttributes:g,onKnobFocus:this.onKnobFocus,onKnobBlur:this.onKnobBlur}),this.dualKnobs&&f(u,{knob:"B",pressed:"B"===o,value:this.valB,ratio:this.ratioB,pin:l,pinFormatter:b,disabled:s,handleKeyboard:i,min:t,max:a,inheritedAttributes:g,onKnobFocus:this.onKnobFocus,onKnobBlur:this.onKnobBlur}))}render(){const{disabled:e,el:t,hasLabel:a,rangeId:i,pin:o,pressedKnob:s,labelPlacement:l,label:h,dualKnobs:d,min:b,max:g}=this,p=m("ion-item",t),x=p&&!(a&&("start"===l||"fixed"===l)||this.hasStartSlotContent),f=p&&!(a&&"end"===l||this.hasEndSlotContent),v=k(this),w=d?this.valA===b||this.valB===b:this.valA===b,y=d?this.valA===g||this.valB===g:this.valA===g;return c(!0,t,this.name,JSON.stringify(this.getValue()),e),n(r,{key:"ed646a42d51b8fe22012198c354cbcf5a389c108",onFocusin:this.onFocus,onFocusout:this.onBlur,id:i,class:u(this.color,{[v]:!0,"in-item":p,"range-disabled":e,"range-pressed":void 0!==s,"range-has-pin":o,[`range-label-placement-${l}`]:!0,"range-item-start-adjustment":x,"range-item-end-adjustment":f,"range-value-min":w,"range-value-max":y})},n("label",{key:"3083e4f2a624e3b268396acb4415f7c6ac44d851",class:"range-wrapper",id:"range-label"},n("div",{key:"47b92f94d2a0381dd7c5cd3dda54ed2942096715",class:{"label-text-wrapper":!0,"label-text-wrapper-hidden":!a},part:"label"},void 0!==h?n("div",{class:"label-text"},h):n("slot",{name:"label"})),n("div",{key:"5341da8d19eb29091df680978a0e20cc8f2eec65",class:"native-wrapper"},n("slot",{key:"09f1437078032676695442d8c827a16faa7dffe2",name:"start"}),this.renderRangeSlider(),n("slot",{key:"02b7781970ea4d44f10b5f4627a2ca36eca45f85",name:"end"}))))}get el(){return i(this)}static get watchers(){return{debounce:["debounceChanged"],min:["minChanged"],max:["maxChanged"],step:["stepChanged"],activeBarStart:["activeBarStartChanged"],disabled:["disabledChanged"],value:["valueChanged"]}}},f=(e,{knob:t,value:a,ratio:r,min:i,max:o,disabled:s,pressed:l,pin:h,handleKeyboard:d,pinFormatter:b,inheritedAttributes:g,onKnobFocus:c,onKnobBlur:p})=>{const m=e?"right":"left",u=g["aria-label"];return n("div",{onKeyDown:e=>{const a=e.key;"ArrowLeft"===a||"ArrowDown"===a?(d(t,!1),e.preventDefault(),e.stopPropagation()):"ArrowRight"!==a&&"ArrowUp"!==a||(d(t,!0),e.preventDefault(),e.stopPropagation())},onFocus:()=>c(t),onBlur:p,class:{"range-knob-handle":!0,"range-knob-a":"A"===t,"range-knob-b":"B"===t,"range-knob-pressed":l,"range-knob-min":a===i,"range-knob-max":a===o,"ion-activatable":!0,"ion-focusable":!0},style:(()=>{const e={};return e[m]=100*r+"%",e})(),role:"slider",tabindex:s?-1:0,"aria-label":void 0!==u?u:null,"aria-labelledby":void 0===u?"range-label":null,"aria-valuemin":i,"aria-valuemax":o,"aria-disabled":s?"true":null,"aria-valuenow":a},h&&n("div",{class:"range-pin",role:"presentation",part:"pin"},b(a)),n("div",{class:"range-knob",role:"presentation",part:"knob"}))},v=(e,t,a,n)=>{let r=(a-t)*e;return n>0&&(r=Math.round(r/n)*n+t),function(e,...t){if(!h(e))return 0;const a=Math.max(...t.map((e=>function(e){return h(e)?e%1==0?0:e.toString().split(".")[1].length:0}(e))));return Number(e.toFixed(a))}(d(t,r,a),t,a,n)},w=(e,t,a)=>d(0,(e-t)/(a-t),1);let y=0;x.style={ios:":host{--knob-handle-size:calc(var(--knob-size) * 2);display:-ms-flexbox;display:flex;position:relative;-ms-flex:3;flex:3;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){-ms-flex:initial;flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;-ms-flex:1;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:-webkit-grab;cursor:grab;-ms-touch-action:pan-y;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:-webkit-grabbing;cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box}.range-knob-handle{top:calc((var(--height) - var(--knob-handle-size)) / 2);-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-pack:center;justify-content:center;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}.range-knob-handle{inset-inline-start:0}:host-context([dir=rtl]) .range-knob-handle{left:unset}[dir=rtl] .range-knob-handle{left:unset}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset}}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar-container{border-radius:var(--bar-border-radius);top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height)}.range-bar-container{inset-inline-start:0}:host-context([dir=rtl]) .range-bar-container{left:unset}[dir=rtl] .range-bar-container{left:unset}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset}}.range-bar{border-radius:var(--bar-border-radius);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}.range-knob{border-radius:var(--knob-border-radius);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);-webkit-box-shadow:var(--knob-box-shadow);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset}[dir=rtl] .range-knob{left:unset}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset}}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host([slot=start]),:host([slot=end]){width:auto}:host(.in-item) ::slotted(ion-label){-ms-flex-item-align:center;align-self:center}.range-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit}::slotted([slot=label]){max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}:host(.range-label-placement-start) .range-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.range-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-end) .range-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.range-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.range-label-placement-stacked) .range-wrapper{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch}:host(.range-label-placement-stacked) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host-context([dir=rtl]):host(.range-label-placement-stacked) .label-text-wrapper,:host-context([dir=rtl]).range-label-placement-stacked .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.range-label-placement-stacked:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.in-item.range-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.range-label-placement-stacked) .native-wrapper{margin-bottom:0px}:host{--knob-border-radius:50%;--knob-background:#ffffff;--knob-box-shadow:0px 0.5px 4px rgba(0, 0, 0, 0.12), 0px 6px 13px rgba(0, 0, 0, 0.12);--knob-size:26px;--bar-height:4px;--bar-background:var(--ion-color-step-900, var(--ion-background-color-step-900, #e6e6e6));--bar-background-active:var(--ion-color-primary, #0054e9);--bar-border-radius:2px;--height:42px}:host(.range-item-start-adjustment){-webkit-padding-start:24px;padding-inline-start:24px}:host(.range-item-end-adjustment){-webkit-padding-end:24px;padding-inline-end:24px}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-tick-active{background:var(--ion-color-base)}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}::slotted([slot=end]){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-has-pin:not(.range-label-placement-stacked)){padding-top:calc(8px + 0.75rem)}:host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper{margin-bottom:calc(8px + 0.75rem)}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-bar-active.has-ticks{border-radius:0;-webkit-margin-start:-2px;margin-inline-start:-2px;-webkit-margin-end:-2px;margin-inline-end:-2px}.range-tick{-webkit-margin-start:-2px;margin-inline-start:-2px;border-radius:0;position:absolute;top:17px;width:4px;height:8px;background:var(--ion-color-step-900, var(--ion-background-color-step-900, #e6e6e6));pointer-events:none}.range-tick-active{background:var(--bar-background-active)}.range-pin{-webkit-transform:translate3d(0, 100%, 0) scale(0.01);transform:translate3d(0, 100%, 0) scale(0.01);-webkit-padding-start:8px;padding-inline-start:8px;-webkit-padding-end:8px;padding-inline-end:8px;padding-top:8px;padding-bottom:8px;min-width:28px;-webkit-transition:-webkit-transform 120ms ease;transition:-webkit-transform 120ms ease;transition:transform 120ms ease;transition:transform 120ms ease, -webkit-transform 120ms ease;background:transparent;color:var(--ion-text-color, #000);font-size:0.75rem;text-align:center}.range-knob-pressed .range-pin,.range-knob-handle.ion-focused .range-pin{-webkit-transform:translate3d(0, calc(-100% + 11px), 0) scale(1);transform:translate3d(0, calc(-100% + 11px), 0) scale(1)}:host(.range-disabled){opacity:0.3}",md:':host{--knob-handle-size:calc(var(--knob-size) * 2);display:-ms-flexbox;display:flex;position:relative;-ms-flex:3;flex:3;-ms-flex-align:center;align-items:center;font-family:var(--ion-font-family, inherit);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.range-disabled){pointer-events:none}::slotted(ion-label){-ms-flex:initial;flex:initial}::slotted(ion-icon[slot]){font-size:24px}.range-slider{position:relative;-ms-flex:1;flex:1;width:100%;height:var(--height);contain:size layout style;cursor:-webkit-grab;cursor:grab;-ms-touch-action:pan-y;touch-action:pan-y}:host(.range-pressed) .range-slider{cursor:-webkit-grabbing;cursor:grabbing}.range-pin{position:absolute;background:var(--ion-color-base);color:var(--ion-color-contrast);text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box}.range-knob-handle{top:calc((var(--height) - var(--knob-handle-size)) / 2);-webkit-margin-start:calc(0px - var(--knob-handle-size) / 2);margin-inline-start:calc(0px - var(--knob-handle-size) / 2);display:-ms-flexbox;display:flex;position:absolute;-ms-flex-pack:center;justify-content:center;width:var(--knob-handle-size);height:var(--knob-handle-size);text-align:center}.range-knob-handle{inset-inline-start:0}:host-context([dir=rtl]) .range-knob-handle{left:unset}[dir=rtl] .range-knob-handle{left:unset}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset}}.range-knob-handle:active,.range-knob-handle:focus{outline:none}.range-bar-container{border-radius:var(--bar-border-radius);top:calc((var(--height) - var(--bar-height)) / 2);position:absolute;width:100%;height:var(--bar-height)}.range-bar-container{inset-inline-start:0}:host-context([dir=rtl]) .range-bar-container{left:unset}[dir=rtl] .range-bar-container{left:unset}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset}}.range-bar{border-radius:var(--bar-border-radius);position:absolute;width:100%;height:var(--bar-height);background:var(--bar-background);pointer-events:none}.range-knob{border-radius:var(--knob-border-radius);top:calc(50% - var(--knob-size) / 2);position:absolute;width:var(--knob-size);height:var(--knob-size);background:var(--knob-background);-webkit-box-shadow:var(--knob-box-shadow);box-shadow:var(--knob-box-shadow);z-index:2;pointer-events:none}.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset}[dir=rtl] .range-knob{left:unset}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset}}:host(.range-pressed) .range-bar-active{will-change:left, right}:host(.in-item){width:100%}:host([slot=start]),:host([slot=end]){width:auto}:host(.in-item) ::slotted(ion-label){-ms-flex-item-align:center;align-self:center}.range-wrapper{display:-ms-flexbox;display:flex;position:relative;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit}::slotted([slot=label]){max-width:200px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.label-text-wrapper-hidden{display:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center}:host(.range-label-placement-start) .range-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.range-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-end) .range-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.range-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:0;margin-bottom:0}:host(.range-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.range-label-placement-stacked) .range-wrapper{-ms-flex-direction:column;flex-direction:column;-ms-flex-align:stretch;align-items:stretch}:host(.range-label-placement-stacked) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top;-webkit-transform:scale(0.75);transform:scale(0.75);margin-left:0;margin-right:0;margin-bottom:16px;max-width:calc(100% / 0.75)}:host-context([dir=rtl]):host(.range-label-placement-stacked) .label-text-wrapper,:host-context([dir=rtl]).range-label-placement-stacked .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.range-label-placement-stacked:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.in-item.range-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.range-label-placement-stacked) .native-wrapper{margin-bottom:0px}:host{--knob-border-radius:50%;--knob-background:var(--bar-background-active);--knob-box-shadow:none;--knob-size:18px;--bar-height:2px;--bar-background:rgba(var(--ion-color-primary-rgb, 0, 84, 233), 0.26);--bar-background-active:var(--ion-color-primary, #0054e9);--bar-border-radius:0;--height:42px;--pin-background:var(--ion-color-primary, #0054e9);--pin-color:var(--ion-color-primary-contrast, #fff)}::slotted(:not(ion-icon)[slot=start]),::slotted(:not(ion-icon)[slot=end]),.native-wrapper{font-size:0.75rem}:host(.range-item-start-adjustment){-webkit-padding-start:18px;padding-inline-start:18px}:host(.range-item-end-adjustment){-webkit-padding-end:18px;padding-inline-end:18px}:host(.ion-color) .range-bar{background:rgba(var(--ion-color-base-rgb), 0.26)}:host(.ion-color) .range-bar-active,:host(.ion-color) .range-knob,:host(.ion-color) .range-knob::before,:host(.ion-color) .range-pin,:host(.ion-color) .range-pin::before,:host(.ion-color) .range-tick{background:var(--ion-color-base);color:var(--ion-color-contrast)}::slotted([slot=start]){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:14px;margin-inline-end:14px;margin-top:0;margin-bottom:0}::slotted([slot=end]){-webkit-margin-start:14px;margin-inline-start:14px;-webkit-margin-end:0;margin-inline-end:0;margin-top:0;margin-bottom:0}:host(.range-has-pin:not(.range-label-placement-stacked)){padding-top:1.75rem}:host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper{margin-bottom:1.75rem}.range-bar-active{bottom:0;width:auto;background:var(--bar-background-active)}.range-knob{-webkit-transform:scale(0.67);transform:scale(0.67);-webkit-transition-duration:120ms;transition-duration:120ms;-webkit-transition-property:background-color, border, -webkit-transform;transition-property:background-color, border, -webkit-transform;transition-property:transform, background-color, border;transition-property:transform, background-color, border, -webkit-transform;-webkit-transition-timing-function:ease;transition-timing-function:ease;z-index:2}.range-knob::before{border-radius:50%;position:absolute;width:var(--knob-size);height:var(--knob-size);-webkit-transform:scale(1);transform:scale(1);-webkit-transition:0.267s cubic-bezier(0, 0, 0.58, 1);transition:0.267s cubic-bezier(0, 0, 0.58, 1);background:var(--knob-background);content:"";opacity:0.13;pointer-events:none}.range-knob::before{inset-inline-start:0}.range-tick{position:absolute;top:calc((var(--height) - var(--bar-height)) / 2);width:var(--bar-height);height:var(--bar-height);background:var(--bar-background-active);z-index:1;pointer-events:none}.range-tick-active{background:transparent}.range-pin{padding-left:0;padding-right:0;padding-top:8px;padding-bottom:8px;border-radius:50%;-webkit-transform:translate3d(0, 0, 0) scale(0.01);transform:translate3d(0, 0, 0) scale(0.01);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;width:1.75rem;height:1.75rem;-webkit-transition:background 120ms ease, -webkit-transform 120ms ease;transition:background 120ms ease, -webkit-transform 120ms ease;transition:transform 120ms ease, background 120ms ease;transition:transform 120ms ease, background 120ms ease, -webkit-transform 120ms ease;background:var(--pin-background);color:var(--pin-color)}.range-pin::before{bottom:-1px;-webkit-margin-start:-13px;margin-inline-start:-13px;border-radius:50% 50% 50% 0;position:absolute;width:26px;height:26px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transition:background 120ms ease;transition:background 120ms ease;background:var(--pin-background);content:"";z-index:-1}.range-pin::before{inset-inline-start:50%}:host-context([dir=rtl]) .range-pin::before{left:unset}[dir=rtl] .range-pin::before{left:unset}@supports selector(:dir(rtl)){.range-pin::before:dir(rtl){left:unset}}.range-knob-pressed .range-pin,.range-knob-handle.ion-focused .range-pin{-webkit-transform:translate3d(0, calc(-100% + 4px), 0) scale(1);transform:translate3d(0, calc(-100% + 4px), 0) scale(1)}@media (any-hover: hover){.range-knob-handle:hover .range-knob:before{-webkit-transform:scale(2);transform:scale(2);opacity:0.13}}.range-knob-handle.ion-activated .range-knob:before,.range-knob-handle.ion-focused .range-knob:before,.range-knob-handle.range-knob-pressed .range-knob:before{-webkit-transform:scale(2);transform:scale(2)}.range-knob-handle.ion-focused .range-knob::before{opacity:0.13}.range-knob-handle.ion-activated .range-knob::before,.range-knob-handle.range-knob-pressed .range-knob::before{opacity:0.25}:host(:not(.range-has-pin)) .range-knob-pressed .range-knob,:host(:not(.range-has-pin)) .range-knob-handle.ion-focused .range-knob{-webkit-transform:scale(1);transform:scale(1)}:host(.range-disabled) .range-bar-active,:host(.range-disabled) .range-bar,:host(.range-disabled) .range-tick{background-color:var(--ion-color-step-250, var(--ion-background-color-step-250, #bfbfbf))}:host(.range-disabled) .range-knob{-webkit-transform:scale(0.55);transform:scale(0.55);outline:5px solid #fff;background-color:var(--ion-color-step-250, var(--ion-background-color-step-250, #bfbfbf))}:host(.range-disabled) .label-text-wrapper,:host(.range-disabled) ::slotted([slot=start]),:host(.range-disabled) ::slotted([slot=end]){opacity:0.38}'};export{x as ion_range}
|