@ionic/core 8.7.17-dev.11770405784.157a3c10 → 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-range.js +152 -39
- package/components/ion-segment-view.js +5 -11
- package/dist/cjs/ion-range.cjs.entry.js +149 -39
- package/dist/cjs/ion-segment-view.cjs.entry.js +5 -10
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/range/range.js +172 -42
- package/dist/collection/components/segment-view/segment-view.ios.css +1 -2
- package/dist/collection/components/segment-view/segment-view.js +3 -28
- package/dist/collection/components/segment-view/segment-view.md.css +1 -2
- package/dist/docs.json +142 -35
- package/dist/esm/ion-range.entry.js +149 -39
- package/dist/esm/ion-segment-view.entry.js +5 -10
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/html.html-data.json +0 -4
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-020af078.entry.js +4 -0
- package/dist/ionic/p-991a3dd9.entry.js +4 -0
- package/dist/types/components/range/range-interface.d.ts +1 -0
- package/dist/types/components/range/range.d.ts +33 -4
- package/dist/types/components/segment-view/segment-view.d.ts +0 -4
- package/dist/types/components.d.ts +0 -10
- package/hydrate/index.js +177 -53
- package/hydrate/index.mjs +177 -53
- package/package.json +1 -1
- package/dist/ionic/p-012212e4.entry.js +0 -4
- package/dist/ionic/p-9a2d390d.entry.js +0 -4
package/hydrate/index.mjs
CHANGED
|
@@ -28715,13 +28715,30 @@ const rangeMdCss = ":host{--knob-handle-size:calc(var(--knob-size) * 2);display:
|
|
|
28715
28715
|
* @slot start - Content is placed to the left of the range slider in LTR, and to the right in RTL.
|
|
28716
28716
|
* @slot end - Content is placed to the right of the range slider in LTR, and to the left in RTL.
|
|
28717
28717
|
*
|
|
28718
|
+
* @part label - The label text describing the range.
|
|
28718
28719
|
* @part tick - An inactive tick mark.
|
|
28719
28720
|
* @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
28721
|
* @part bar - The inactive part of the bar.
|
|
28723
28722
|
* @part bar-active - The active part of the bar.
|
|
28724
|
-
* @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`.
|
|
28725
28742
|
*/
|
|
28726
28743
|
class Range {
|
|
28727
28744
|
constructor(hostRef) {
|
|
@@ -28739,6 +28756,7 @@ class Range {
|
|
|
28739
28756
|
this.inheritedAttributes = {};
|
|
28740
28757
|
this.contentEl = null;
|
|
28741
28758
|
this.initialContentScrollY = true;
|
|
28759
|
+
this.focusFromPointer = false;
|
|
28742
28760
|
this.ratioA = 0;
|
|
28743
28761
|
this.ratioB = 0;
|
|
28744
28762
|
/**
|
|
@@ -28848,6 +28866,29 @@ class Range {
|
|
|
28848
28866
|
this.gesture.enable(!this.disabled);
|
|
28849
28867
|
}
|
|
28850
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
|
+
};
|
|
28851
28892
|
this.handleKeyboard = (knob, isIncrease) => {
|
|
28852
28893
|
const { ensureValueInBounds } = this;
|
|
28853
28894
|
let step = this.step;
|
|
@@ -28870,6 +28911,7 @@ class Range {
|
|
|
28870
28911
|
this.onBlur = () => {
|
|
28871
28912
|
if (this.hasFocus) {
|
|
28872
28913
|
this.hasFocus = false;
|
|
28914
|
+
this.focusedKnob = undefined;
|
|
28873
28915
|
this.ionBlur.emit();
|
|
28874
28916
|
}
|
|
28875
28917
|
};
|
|
@@ -28880,21 +28922,20 @@ class Range {
|
|
|
28880
28922
|
}
|
|
28881
28923
|
};
|
|
28882
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
|
|
28883
28935
|
if (!this.hasFocus) {
|
|
28884
28936
|
this.hasFocus = true;
|
|
28885
28937
|
this.ionFocus.emit();
|
|
28886
28938
|
}
|
|
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
28939
|
};
|
|
28899
28940
|
this.onKnobBlur = () => {
|
|
28900
28941
|
// Check if focus is moving to another knob within the same range
|
|
@@ -28906,18 +28947,18 @@ class Range {
|
|
|
28906
28947
|
if (!isStillFocusedOnKnob) {
|
|
28907
28948
|
if (this.hasFocus) {
|
|
28908
28949
|
this.hasFocus = false;
|
|
28950
|
+
this.focusedKnob = undefined;
|
|
28909
28951
|
this.ionBlur.emit();
|
|
28910
28952
|
}
|
|
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
28953
|
}
|
|
28919
28954
|
}, 0);
|
|
28920
28955
|
};
|
|
28956
|
+
this.onKnobMouseEnter = (knob) => {
|
|
28957
|
+
this.hoveredKnob = knob;
|
|
28958
|
+
};
|
|
28959
|
+
this.onKnobMouseLeave = () => {
|
|
28960
|
+
this.hoveredKnob = undefined;
|
|
28961
|
+
};
|
|
28921
28962
|
}
|
|
28922
28963
|
debounceChanged() {
|
|
28923
28964
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -28994,6 +29035,7 @@ class Range {
|
|
|
28994
29035
|
this.originalIonInput = this.ionInput;
|
|
28995
29036
|
this.setupGesture();
|
|
28996
29037
|
this.updateRatio();
|
|
29038
|
+
this.setupActivatedObserver();
|
|
28997
29039
|
this.didLoad = true;
|
|
28998
29040
|
}
|
|
28999
29041
|
connectedCallback() {
|
|
@@ -29019,6 +29061,10 @@ class Range {
|
|
|
29019
29061
|
this.gesture.destroy();
|
|
29020
29062
|
this.gesture = undefined;
|
|
29021
29063
|
}
|
|
29064
|
+
if (this.activatedObserver) {
|
|
29065
|
+
this.activatedObserver.disconnect();
|
|
29066
|
+
this.activatedObserver = undefined;
|
|
29067
|
+
}
|
|
29022
29068
|
}
|
|
29023
29069
|
getValue() {
|
|
29024
29070
|
var _a;
|
|
@@ -29171,7 +29217,6 @@ class Range {
|
|
|
29171
29217
|
ratio = 1 - ratio;
|
|
29172
29218
|
}
|
|
29173
29219
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
29174
|
-
this.setFocus(this.pressedKnob);
|
|
29175
29220
|
}
|
|
29176
29221
|
get valA() {
|
|
29177
29222
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -29198,9 +29243,23 @@ class Range {
|
|
|
29198
29243
|
updateRatio() {
|
|
29199
29244
|
const value = this.getValue();
|
|
29200
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
|
+
*/
|
|
29201
29251
|
if (this.dualKnobs) {
|
|
29202
|
-
|
|
29203
|
-
|
|
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
|
+
}
|
|
29204
29263
|
}
|
|
29205
29264
|
else {
|
|
29206
29265
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -29217,14 +29276,6 @@ class Range {
|
|
|
29217
29276
|
};
|
|
29218
29277
|
this.noUpdate = false;
|
|
29219
29278
|
}
|
|
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
29279
|
/**
|
|
29229
29280
|
* Returns true if content was passed to the "start" slot
|
|
29230
29281
|
*/
|
|
@@ -29242,7 +29293,7 @@ class Range {
|
|
|
29242
29293
|
}
|
|
29243
29294
|
renderRangeSlider() {
|
|
29244
29295
|
var _a;
|
|
29245
|
-
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;
|
|
29246
29297
|
let barStart = `${ratioLower * 100}%`;
|
|
29247
29298
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
29248
29299
|
const rtl = isRTL$1(this.el);
|
|
@@ -29302,7 +29353,9 @@ class Range {
|
|
|
29302
29353
|
ticks.push(tick);
|
|
29303
29354
|
}
|
|
29304
29355
|
}
|
|
29305
|
-
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
|
+
},
|
|
29306
29359
|
/**
|
|
29307
29360
|
* Since the gesture has a threshold, the value
|
|
29308
29361
|
* won't change until the user has dragged past
|
|
@@ -29315,6 +29368,7 @@ class Range {
|
|
|
29315
29368
|
* we need to listen for the "pointerUp" event.
|
|
29316
29369
|
*/
|
|
29317
29370
|
onPointerUp: (ev) => {
|
|
29371
|
+
this.focusFromPointer = false;
|
|
29318
29372
|
/**
|
|
29319
29373
|
* If the user drags the knob on the web
|
|
29320
29374
|
* version (does not occur on mobile),
|
|
@@ -29340,6 +29394,11 @@ class Range {
|
|
|
29340
29394
|
'has-ticks': ticks.length > 0,
|
|
29341
29395
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
29342
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',
|
|
29343
29402
|
pressed: pressedKnob === 'A',
|
|
29344
29403
|
value: this.valA,
|
|
29345
29404
|
ratio: this.ratioA,
|
|
@@ -29352,9 +29411,16 @@ class Range {
|
|
|
29352
29411
|
inheritedAttributes,
|
|
29353
29412
|
onKnobFocus: this.onKnobFocus,
|
|
29354
29413
|
onKnobBlur: this.onKnobBlur,
|
|
29414
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29415
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29355
29416
|
}), this.dualKnobs &&
|
|
29356
29417
|
renderKnob(rtl, {
|
|
29357
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',
|
|
29358
29424
|
pressed: pressedKnob === 'B',
|
|
29359
29425
|
value: this.valB,
|
|
29360
29426
|
ratio: this.ratioB,
|
|
@@ -29367,6 +29433,8 @@ class Range {
|
|
|
29367
29433
|
inheritedAttributes,
|
|
29368
29434
|
onKnobFocus: this.onKnobFocus,
|
|
29369
29435
|
onKnobBlur: this.onKnobBlur,
|
|
29436
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
29437
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
29370
29438
|
})));
|
|
29371
29439
|
}
|
|
29372
29440
|
render() {
|
|
@@ -29385,6 +29453,12 @@ class Range {
|
|
|
29385
29453
|
const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent;
|
|
29386
29454
|
const needsEndAdjustment = inItem && !hasEndContent;
|
|
29387
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;
|
|
29388
29462
|
/**
|
|
29389
29463
|
* Determine if any knob is at the min or max value to
|
|
29390
29464
|
* apply Host classes for styling.
|
|
@@ -29392,21 +29466,24 @@ class Range {
|
|
|
29392
29466
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
29393
29467
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
29394
29468
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
29395
|
-
return (hAsync(Host, { key: '
|
|
29469
|
+
return (hAsync(Host, { key: '8e439db9836fdefdc779573082c788e3ddb3ef73', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses$1(this.color, {
|
|
29396
29470
|
[mode]: true,
|
|
29397
29471
|
'in-item': inItem,
|
|
29398
29472
|
'range-disabled': disabled,
|
|
29473
|
+
'range-dual-knobs': dualKnobs,
|
|
29399
29474
|
'range-pressed': pressedKnob !== undefined,
|
|
29475
|
+
[`range-pressed-${pressedKnobName}`]: pressedKnob !== undefined && pressedKnobName !== undefined,
|
|
29476
|
+
[`range-pressed-${pressedKnobPosition}`]: pressedKnob !== undefined && pressedKnobPosition !== undefined,
|
|
29400
29477
|
'range-has-pin': pin,
|
|
29401
29478
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
29402
29479
|
'range-item-start-adjustment': needsStartAdjustment,
|
|
29403
29480
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
29404
29481
|
'range-value-min': valueAtMin,
|
|
29405
29482
|
'range-value-max': valueAtMax,
|
|
29406
|
-
}) }, hAsync("label", { key: '
|
|
29483
|
+
}) }, hAsync("label", { key: 'e14c56db4d1eef11a3a0639c4bbed368041fc3eb', class: "range-wrapper", id: "range-label" }, hAsync("div", { key: '16d125b0af19fdfa3663731657a7cca51a7ed442', class: {
|
|
29407
29484
|
'label-text-wrapper': true,
|
|
29408
29485
|
'label-text-wrapper-hidden': !hasLabel,
|
|
29409
|
-
}, 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" })))));
|
|
29410
29487
|
}
|
|
29411
29488
|
get el() { return getElement(this); }
|
|
29412
29489
|
static get watchers() { return {
|
|
@@ -29444,6 +29521,9 @@ class Range {
|
|
|
29444
29521
|
"labelPlacement": [1, "label-placement"],
|
|
29445
29522
|
"ratioA": [32],
|
|
29446
29523
|
"ratioB": [32],
|
|
29524
|
+
"activatedKnob": [32],
|
|
29525
|
+
"focusedKnob": [32],
|
|
29526
|
+
"hoveredKnob": [32],
|
|
29447
29527
|
"pressedKnob": [32]
|
|
29448
29528
|
},
|
|
29449
29529
|
"$listeners$": undefined,
|
|
@@ -29451,7 +29531,7 @@ class Range {
|
|
|
29451
29531
|
"$attrsToReflect$": [["color", "color"]]
|
|
29452
29532
|
}; }
|
|
29453
29533
|
}
|
|
29454
|
-
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, }) => {
|
|
29455
29535
|
const start = rtl ? 'right' : 'left';
|
|
29456
29536
|
const knobStyle = () => {
|
|
29457
29537
|
const style = {};
|
|
@@ -29472,16 +29552,66 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
29472
29552
|
ev.preventDefault();
|
|
29473
29553
|
ev.stopPropagation();
|
|
29474
29554
|
}
|
|
29475
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
29555
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
29476
29556
|
'range-knob-handle': true,
|
|
29477
|
-
'range-knob-a': knob === 'A',
|
|
29478
|
-
'range-knob-b': knob === 'B',
|
|
29557
|
+
'range-knob-handle-a': knob === 'A',
|
|
29558
|
+
'range-knob-handle-b': knob === 'B',
|
|
29479
29559
|
'range-knob-pressed': pressed,
|
|
29480
29560
|
'range-knob-min': value === min,
|
|
29481
29561
|
'range-knob-max': value === max,
|
|
29482
29562
|
'ion-activatable': true,
|
|
29483
29563
|
'ion-focusable': true,
|
|
29484
|
-
|
|
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';
|
|
29485
29615
|
};
|
|
29486
29616
|
const ratioToValue = (ratio, min, max, step) => {
|
|
29487
29617
|
let value = (max - min) * ratio;
|
|
@@ -33482,9 +33612,9 @@ class SegmentContent {
|
|
|
33482
33612
|
}; }
|
|
33483
33613
|
}
|
|
33484
33614
|
|
|
33485
|
-
const segmentViewIosCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled)
|
|
33615
|
+
const segmentViewIosCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";
|
|
33486
33616
|
|
|
33487
|
-
const segmentViewMdCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled)
|
|
33617
|
+
const segmentViewMdCss = ":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}";
|
|
33488
33618
|
|
|
33489
33619
|
class SegmentView {
|
|
33490
33620
|
constructor(hostRef) {
|
|
@@ -33496,10 +33626,6 @@ class SegmentView {
|
|
|
33496
33626
|
* If `true`, the segment view cannot be interacted with.
|
|
33497
33627
|
*/
|
|
33498
33628
|
this.disabled = false;
|
|
33499
|
-
/**
|
|
33500
|
-
* If `true`, users will be able to swipe the segment view to navigate between segment contents.
|
|
33501
|
-
*/
|
|
33502
|
-
this.swipeGesture = true;
|
|
33503
33629
|
}
|
|
33504
33630
|
handleScroll(ev) {
|
|
33505
33631
|
var _a;
|
|
@@ -33587,12 +33713,11 @@ class SegmentView {
|
|
|
33587
33713
|
return Array.from(this.el.querySelectorAll('ion-segment-content'));
|
|
33588
33714
|
}
|
|
33589
33715
|
render() {
|
|
33590
|
-
const { disabled, isManualScroll
|
|
33591
|
-
return (hAsync(Host, { key: '
|
|
33716
|
+
const { disabled, isManualScroll } = this;
|
|
33717
|
+
return (hAsync(Host, { key: 'e180b67bb3143a5f4611fb358c037be6fc782a8f', class: {
|
|
33592
33718
|
'segment-view-disabled': disabled,
|
|
33593
33719
|
'segment-view-scroll-disabled': isManualScroll === false,
|
|
33594
|
-
|
|
33595
|
-
} }, hAsync("slot", { key: '4118c240364467302b8f593e33c37837ea5d06f0' })));
|
|
33720
|
+
} }, hAsync("slot", { key: '41c11d6a7406a10f5c64a2e73abfc072afd8fc73' })));
|
|
33596
33721
|
}
|
|
33597
33722
|
get el() { return getElement(this); }
|
|
33598
33723
|
static get style() { return {
|
|
@@ -33604,7 +33729,6 @@ class SegmentView {
|
|
|
33604
33729
|
"$tagName$": "ion-segment-view",
|
|
33605
33730
|
"$members$": {
|
|
33606
33731
|
"disabled": [4],
|
|
33607
|
-
"swipeGesture": [4, "swipe-gesture"],
|
|
33608
33732
|
"isManualScroll": [32],
|
|
33609
33733
|
"setContent": [64]
|
|
33610
33734
|
},
|
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}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
-
*/
|
|
4
|
-
import{r as s,c as e,h as t,d as o,g as i}from"./p-C8IsBmNU.js";import{i as l}from"./p-C53feagD.js";const n=class{constructor(t){s(this,t),this.ionSegmentViewScroll=e(this,"ionSegmentViewScroll",7),this.scrollEndTimeout=null,this.isTouching=!1,this.disabled=!1,this.swipeGesture=!0}handleScroll(s){var e;const{scrollLeft:t,scrollWidth:o,clientWidth:i}=s.target,n=o-i,a=(l(this.el)?-1:1)*(t/n);this.ionSegmentViewScroll.emit({scrollRatio:a,isManualScroll:null===(e=this.isManualScroll)||void 0===e||e}),this.resetScrollEndTimeout()}handleScrollStart(){this.scrollEndTimeout&&(clearTimeout(this.scrollEndTimeout),this.scrollEndTimeout=null),this.isTouching=!0}handleTouchEnd(){this.isTouching=!1}resetScrollEndTimeout(){this.scrollEndTimeout&&(clearTimeout(this.scrollEndTimeout),this.scrollEndTimeout=null),this.scrollEndTimeout=setTimeout((()=>{this.checkForScrollEnd()}),100)}checkForScrollEnd(){this.isTouching||(this.isManualScroll=void 0)}async setContent(s,e=!0){const t=this.getSegmentContents().findIndex((e=>e.id===s));if(-1===t)return;this.isManualScroll=!1,this.resetScrollEndTimeout();const o=t*this.el.offsetWidth;this.el.scrollTo({top:0,left:(l(this.el)?-1:1)*o,behavior:e?"smooth":"instant"})}getSegmentContents(){return Array.from(this.el.querySelectorAll("ion-segment-content"))}render(){const{disabled:s,isManualScroll:e,swipeGesture:i}=this;return t(o,{key:"565cccce7f0cfc4c71508777cc60292d6f24334f",class:{"segment-view-disabled":s,"segment-view-scroll-disabled":!1===e,"segment-view-swipe-disabled":!1===i}},t("slot",{key:"4118c240364467302b8f593e33c37837ea5d06f0"}))}get el(){return i(this)}};n.style={ios:":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled),:host(.segment-view-swipe-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}",md:":host{display:-ms-flexbox;display:flex;height:100%;overflow-x:scroll;-webkit-scroll-snap-type:x mandatory;-ms-scroll-snap-type:x mandatory;scroll-snap-type:x mandatory;scrollbar-width:none;-ms-overflow-style:none}:host::-webkit-scrollbar{display:none}:host(.segment-view-disabled),:host(.segment-view-swipe-disabled){-ms-touch-action:none;touch-action:none;overflow-x:hidden}:host(.segment-view-scroll-disabled){pointer-events:none}:host(.segment-view-disabled){opacity:0.3}"};export{n as ion_segment_view}
|