@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/components/ion-range.js
CHANGED
|
@@ -79,6 +79,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
79
79
|
this.inheritedAttributes = {};
|
|
80
80
|
this.contentEl = null;
|
|
81
81
|
this.initialContentScrollY = true;
|
|
82
|
+
this.focusFromPointer = false;
|
|
82
83
|
this.ratioA = 0;
|
|
83
84
|
this.ratioB = 0;
|
|
84
85
|
/**
|
|
@@ -188,6 +189,29 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
188
189
|
this.gesture.enable(!this.disabled);
|
|
189
190
|
}
|
|
190
191
|
};
|
|
192
|
+
/**
|
|
193
|
+
* Observes the knob handles for the ion-activated class and syncs
|
|
194
|
+
* activatedKnob so the activated part is correctly set on the handle,
|
|
195
|
+
* knob, and pin.
|
|
196
|
+
*/
|
|
197
|
+
this.setupActivatedObserver = () => {
|
|
198
|
+
const knobHandleA = this.el.shadowRoot.querySelector('.range-knob-handle-a');
|
|
199
|
+
const knobHandleB = this.el.shadowRoot.querySelector('.range-knob-handle-b');
|
|
200
|
+
const syncActivated = () => {
|
|
201
|
+
this.activatedKnob = (knobHandleA === null || knobHandleA === void 0 ? void 0 : knobHandleA.classList.contains('ion-activated'))
|
|
202
|
+
? 'A'
|
|
203
|
+
: (knobHandleB === null || knobHandleB === void 0 ? void 0 : knobHandleB.classList.contains('ion-activated'))
|
|
204
|
+
? 'B'
|
|
205
|
+
: undefined;
|
|
206
|
+
};
|
|
207
|
+
this.activatedObserver = new MutationObserver(syncActivated);
|
|
208
|
+
this.activatedObserver.observe(this.el.shadowRoot, {
|
|
209
|
+
attributes: true,
|
|
210
|
+
attributeFilter: ['class'],
|
|
211
|
+
subtree: true,
|
|
212
|
+
});
|
|
213
|
+
syncActivated();
|
|
214
|
+
};
|
|
191
215
|
this.handleKeyboard = (knob, isIncrease) => {
|
|
192
216
|
const { ensureValueInBounds } = this;
|
|
193
217
|
let step = this.step;
|
|
@@ -210,6 +234,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
210
234
|
this.onBlur = () => {
|
|
211
235
|
if (this.hasFocus) {
|
|
212
236
|
this.hasFocus = false;
|
|
237
|
+
this.focusedKnob = undefined;
|
|
213
238
|
this.ionBlur.emit();
|
|
214
239
|
}
|
|
215
240
|
};
|
|
@@ -220,21 +245,20 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
220
245
|
}
|
|
221
246
|
};
|
|
222
247
|
this.onKnobFocus = (knob) => {
|
|
248
|
+
// Clicking focuses the range which is needed for the keyboard,
|
|
249
|
+
// but we only want to add the ion-focused class when focused via Tab.
|
|
250
|
+
if (!this.focusFromPointer) {
|
|
251
|
+
this.focusedKnob = knob;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
this.focusFromPointer = false;
|
|
255
|
+
this.focusedKnob = undefined;
|
|
256
|
+
}
|
|
257
|
+
// If the knob was not already focused, emit the focus event
|
|
223
258
|
if (!this.hasFocus) {
|
|
224
259
|
this.hasFocus = true;
|
|
225
260
|
this.ionFocus.emit();
|
|
226
261
|
}
|
|
227
|
-
// Manually manage ion-focused class for dual knobs
|
|
228
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
229
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
230
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
231
|
-
// Remove ion-focused from both knobs first
|
|
232
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
233
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
234
|
-
// Add ion-focused only to the focused knob
|
|
235
|
-
const focusedKnobEl = knob === 'A' ? knobA : knobB;
|
|
236
|
-
focusedKnobEl === null || focusedKnobEl === void 0 ? void 0 : focusedKnobEl.classList.add('ion-focused');
|
|
237
|
-
}
|
|
238
262
|
};
|
|
239
263
|
this.onKnobBlur = () => {
|
|
240
264
|
// Check if focus is moving to another knob within the same range
|
|
@@ -246,18 +270,18 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
246
270
|
if (!isStillFocusedOnKnob) {
|
|
247
271
|
if (this.hasFocus) {
|
|
248
272
|
this.hasFocus = false;
|
|
273
|
+
this.focusedKnob = undefined;
|
|
249
274
|
this.ionBlur.emit();
|
|
250
275
|
}
|
|
251
|
-
// Remove ion-focused from both knobs when focus leaves the range
|
|
252
|
-
if (this.dualKnobs && this.el.shadowRoot) {
|
|
253
|
-
const knobA = this.el.shadowRoot.querySelector('.range-knob-a');
|
|
254
|
-
const knobB = this.el.shadowRoot.querySelector('.range-knob-b');
|
|
255
|
-
knobA === null || knobA === void 0 ? void 0 : knobA.classList.remove('ion-focused');
|
|
256
|
-
knobB === null || knobB === void 0 ? void 0 : knobB.classList.remove('ion-focused');
|
|
257
|
-
}
|
|
258
276
|
}
|
|
259
277
|
}, 0);
|
|
260
278
|
};
|
|
279
|
+
this.onKnobMouseEnter = (knob) => {
|
|
280
|
+
this.hoveredKnob = knob;
|
|
281
|
+
};
|
|
282
|
+
this.onKnobMouseLeave = () => {
|
|
283
|
+
this.hoveredKnob = undefined;
|
|
284
|
+
};
|
|
261
285
|
}
|
|
262
286
|
debounceChanged() {
|
|
263
287
|
const { ionInput, debounce, originalIonInput } = this;
|
|
@@ -334,6 +358,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
334
358
|
this.originalIonInput = this.ionInput;
|
|
335
359
|
this.setupGesture();
|
|
336
360
|
this.updateRatio();
|
|
361
|
+
this.setupActivatedObserver();
|
|
337
362
|
this.didLoad = true;
|
|
338
363
|
}
|
|
339
364
|
connectedCallback() {
|
|
@@ -359,6 +384,10 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
359
384
|
this.gesture.destroy();
|
|
360
385
|
this.gesture = undefined;
|
|
361
386
|
}
|
|
387
|
+
if (this.activatedObserver) {
|
|
388
|
+
this.activatedObserver.disconnect();
|
|
389
|
+
this.activatedObserver = undefined;
|
|
390
|
+
}
|
|
362
391
|
}
|
|
363
392
|
getValue() {
|
|
364
393
|
var _a;
|
|
@@ -511,7 +540,6 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
511
540
|
ratio = 1 - ratio;
|
|
512
541
|
}
|
|
513
542
|
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
514
|
-
this.setFocus(this.pressedKnob);
|
|
515
543
|
}
|
|
516
544
|
get valA() {
|
|
517
545
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
@@ -538,9 +566,23 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
538
566
|
updateRatio() {
|
|
539
567
|
const value = this.getValue();
|
|
540
568
|
const { min, max } = this;
|
|
569
|
+
/**
|
|
570
|
+
* For dual knobs, value gives lower/upper but not which is A vs B.
|
|
571
|
+
* Assign (lowerRatio, upperRatio) to (ratioA, ratioB) in the way that
|
|
572
|
+
* minimizes change from the current ratios so the knobs don't swap.
|
|
573
|
+
*/
|
|
541
574
|
if (this.dualKnobs) {
|
|
542
|
-
|
|
543
|
-
|
|
575
|
+
const lowerRatio = valueToRatio(value.lower, min, max);
|
|
576
|
+
const upperRatio = valueToRatio(value.upper, min, max);
|
|
577
|
+
if (Math.abs(this.ratioA - lowerRatio) + Math.abs(this.ratioB - upperRatio) <=
|
|
578
|
+
Math.abs(this.ratioA - upperRatio) + Math.abs(this.ratioB - lowerRatio)) {
|
|
579
|
+
this.ratioA = lowerRatio;
|
|
580
|
+
this.ratioB = upperRatio;
|
|
581
|
+
}
|
|
582
|
+
else {
|
|
583
|
+
this.ratioA = upperRatio;
|
|
584
|
+
this.ratioB = lowerRatio;
|
|
585
|
+
}
|
|
544
586
|
}
|
|
545
587
|
else {
|
|
546
588
|
this.ratioA = valueToRatio(value, min, max);
|
|
@@ -557,14 +599,6 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
557
599
|
};
|
|
558
600
|
this.noUpdate = false;
|
|
559
601
|
}
|
|
560
|
-
setFocus(knob) {
|
|
561
|
-
if (this.el.shadowRoot) {
|
|
562
|
-
const knobEl = this.el.shadowRoot.querySelector(knob === 'A' ? '.range-knob-a' : '.range-knob-b');
|
|
563
|
-
if (knobEl) {
|
|
564
|
-
knobEl.focus();
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
602
|
/**
|
|
569
603
|
* Returns true if content was passed to the "start" slot
|
|
570
604
|
*/
|
|
@@ -582,7 +616,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
582
616
|
}
|
|
583
617
|
renderRangeSlider() {
|
|
584
618
|
var _a;
|
|
585
|
-
const { min, max, step, handleKeyboard, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
619
|
+
const { min, max, step, handleKeyboard, activatedKnob, focusedKnob, hoveredKnob, pressedKnob, disabled, pin, ratioLower, ratioUpper, pinFormatter, inheritedAttributes, } = this;
|
|
586
620
|
let barStart = `${ratioLower * 100}%`;
|
|
587
621
|
let barEnd = `${100 - ratioUpper * 100}%`;
|
|
588
622
|
const rtl = isRTL(this.el);
|
|
@@ -642,7 +676,9 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
642
676
|
ticks.push(tick);
|
|
643
677
|
}
|
|
644
678
|
}
|
|
645
|
-
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
679
|
+
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl), onPointerDown: () => {
|
|
680
|
+
this.focusFromPointer = true;
|
|
681
|
+
},
|
|
646
682
|
/**
|
|
647
683
|
* Since the gesture has a threshold, the value
|
|
648
684
|
* won't change until the user has dragged past
|
|
@@ -655,6 +691,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
655
691
|
* we need to listen for the "pointerUp" event.
|
|
656
692
|
*/
|
|
657
693
|
onPointerUp: (ev) => {
|
|
694
|
+
this.focusFromPointer = false;
|
|
658
695
|
/**
|
|
659
696
|
* If the user drags the knob on the web
|
|
660
697
|
* version (does not occur on mobile),
|
|
@@ -680,6 +717,11 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
680
717
|
'has-ticks': ticks.length > 0,
|
|
681
718
|
}, role: "presentation", style: barStyle, part: "bar-active" })), renderKnob(rtl, {
|
|
682
719
|
knob: 'A',
|
|
720
|
+
position: getKnobPosition('A', this.ratioA, this.ratioB, this.dualKnobs),
|
|
721
|
+
dualKnobs: this.dualKnobs,
|
|
722
|
+
activated: activatedKnob === 'A',
|
|
723
|
+
focused: focusedKnob === 'A',
|
|
724
|
+
hovered: hoveredKnob === 'A',
|
|
683
725
|
pressed: pressedKnob === 'A',
|
|
684
726
|
value: this.valA,
|
|
685
727
|
ratio: this.ratioA,
|
|
@@ -692,9 +734,16 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
692
734
|
inheritedAttributes,
|
|
693
735
|
onKnobFocus: this.onKnobFocus,
|
|
694
736
|
onKnobBlur: this.onKnobBlur,
|
|
737
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
738
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
695
739
|
}), this.dualKnobs &&
|
|
696
740
|
renderKnob(rtl, {
|
|
697
741
|
knob: 'B',
|
|
742
|
+
position: getKnobPosition('B', this.ratioA, this.ratioB, this.dualKnobs),
|
|
743
|
+
dualKnobs: this.dualKnobs,
|
|
744
|
+
activated: activatedKnob === 'B',
|
|
745
|
+
focused: focusedKnob === 'B',
|
|
746
|
+
hovered: hoveredKnob === 'B',
|
|
698
747
|
pressed: pressedKnob === 'B',
|
|
699
748
|
value: this.valB,
|
|
700
749
|
ratio: this.ratioB,
|
|
@@ -707,6 +756,8 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
707
756
|
inheritedAttributes,
|
|
708
757
|
onKnobFocus: this.onKnobFocus,
|
|
709
758
|
onKnobBlur: this.onKnobBlur,
|
|
759
|
+
onKnobMouseEnter: this.onKnobMouseEnter,
|
|
760
|
+
onKnobMouseLeave: this.onKnobMouseLeave,
|
|
710
761
|
})));
|
|
711
762
|
}
|
|
712
763
|
render() {
|
|
@@ -725,6 +776,12 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
725
776
|
const hasEndContent = (hasLabel && labelPlacement === 'end') || this.hasEndSlotContent;
|
|
726
777
|
const needsEndAdjustment = inItem && !hasEndContent;
|
|
727
778
|
const mode = getIonMode(this);
|
|
779
|
+
/**
|
|
780
|
+
* Determine the name and position of the pressed knob to apply
|
|
781
|
+
* Host classes for styling.
|
|
782
|
+
*/
|
|
783
|
+
const pressedKnobName = dualKnobs ? pressedKnob === null || pressedKnob === void 0 ? void 0 : pressedKnob.toLowerCase() : undefined;
|
|
784
|
+
const pressedKnobPosition = dualKnobs && pressedKnob ? getKnobPosition(pressedKnob, this.ratioA, this.ratioB, dualKnobs) : undefined;
|
|
728
785
|
/**
|
|
729
786
|
* Determine if any knob is at the min or max value to
|
|
730
787
|
* apply Host classes for styling.
|
|
@@ -732,21 +789,24 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
732
789
|
const valueAtMin = dualKnobs ? this.valA === min || this.valB === min : this.valA === min;
|
|
733
790
|
const valueAtMax = dualKnobs ? this.valA === max || this.valB === max : this.valA === max;
|
|
734
791
|
renderHiddenInput(true, el, this.name, JSON.stringify(this.getValue()), disabled);
|
|
735
|
-
return (h(Host, { key: '
|
|
792
|
+
return (h(Host, { key: '8e439db9836fdefdc779573082c788e3ddb3ef73', onFocusin: this.onFocus, onFocusout: this.onBlur, id: rangeId, class: createColorClasses(this.color, {
|
|
736
793
|
[mode]: true,
|
|
737
794
|
'in-item': inItem,
|
|
738
795
|
'range-disabled': disabled,
|
|
796
|
+
'range-dual-knobs': dualKnobs,
|
|
739
797
|
'range-pressed': pressedKnob !== undefined,
|
|
798
|
+
[`range-pressed-${pressedKnobName}`]: pressedKnob !== undefined && pressedKnobName !== undefined,
|
|
799
|
+
[`range-pressed-${pressedKnobPosition}`]: pressedKnob !== undefined && pressedKnobPosition !== undefined,
|
|
740
800
|
'range-has-pin': pin,
|
|
741
801
|
[`range-label-placement-${labelPlacement}`]: true,
|
|
742
802
|
'range-item-start-adjustment': needsStartAdjustment,
|
|
743
803
|
'range-item-end-adjustment': needsEndAdjustment,
|
|
744
804
|
'range-value-min': valueAtMin,
|
|
745
805
|
'range-value-max': valueAtMax,
|
|
746
|
-
}) }, h("label", { key: '
|
|
806
|
+
}) }, h("label", { key: 'e14c56db4d1eef11a3a0639c4bbed368041fc3eb', class: "range-wrapper", id: "range-label" }, h("div", { key: '16d125b0af19fdfa3663731657a7cca51a7ed442', class: {
|
|
747
807
|
'label-text-wrapper': true,
|
|
748
808
|
'label-text-wrapper-hidden': !hasLabel,
|
|
749
|
-
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '
|
|
809
|
+
}, part: "label" }, label !== undefined ? h("div", { class: "label-text" }, label) : h("slot", { name: "label" })), h("div", { key: '545cc52a3e675e9df328dab537a4e44b7f3c59f8', class: "native-wrapper" }, h("slot", { key: 'ac54b45a21c9db231ebe11498d508d05864b56fb', name: "start" }), this.renderRangeSlider(), h("slot", { key: '7182dba53df2ff878d572b30afda64b37082c82e', name: "end" })))));
|
|
750
810
|
}
|
|
751
811
|
get el() { return this; }
|
|
752
812
|
static get watchers() { return {
|
|
@@ -781,6 +841,9 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
781
841
|
"labelPlacement": [1, "label-placement"],
|
|
782
842
|
"ratioA": [32],
|
|
783
843
|
"ratioB": [32],
|
|
844
|
+
"activatedKnob": [32],
|
|
845
|
+
"focusedKnob": [32],
|
|
846
|
+
"hoveredKnob": [32],
|
|
784
847
|
"pressedKnob": [32]
|
|
785
848
|
}, undefined, {
|
|
786
849
|
"debounce": ["debounceChanged"],
|
|
@@ -791,7 +854,7 @@ const Range = /*@__PURE__*/ proxyCustomElement(class Range extends HTMLElement {
|
|
|
791
854
|
"disabled": ["disabledChanged"],
|
|
792
855
|
"value": ["valueChanged"]
|
|
793
856
|
}]);
|
|
794
|
-
const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, }) => {
|
|
857
|
+
const renderKnob = (rtl, { knob, position, dualKnobs, value, ratio, min, max, disabled, activated, focused, hovered, pressed, pin, handleKeyboard, pinFormatter, inheritedAttributes, onKnobFocus, onKnobBlur, onKnobMouseEnter, onKnobMouseLeave, }) => {
|
|
795
858
|
const start = rtl ? 'right' : 'left';
|
|
796
859
|
const knobStyle = () => {
|
|
797
860
|
const style = {};
|
|
@@ -812,16 +875,66 @@ const renderKnob = (rtl, { knob, value, ratio, min, max, disabled, pressed, pin,
|
|
|
812
875
|
ev.preventDefault();
|
|
813
876
|
ev.stopPropagation();
|
|
814
877
|
}
|
|
815
|
-
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, class: {
|
|
878
|
+
}, onFocus: () => onKnobFocus(knob), onBlur: onKnobBlur, onMouseEnter: () => onKnobMouseEnter(knob), onMouseLeave: onKnobMouseLeave, class: {
|
|
816
879
|
'range-knob-handle': true,
|
|
817
|
-
'range-knob-a': knob === 'A',
|
|
818
|
-
'range-knob-b': knob === 'B',
|
|
880
|
+
'range-knob-handle-a': knob === 'A',
|
|
881
|
+
'range-knob-handle-b': knob === 'B',
|
|
819
882
|
'range-knob-pressed': pressed,
|
|
820
883
|
'range-knob-min': value === min,
|
|
821
884
|
'range-knob-max': value === max,
|
|
822
885
|
'ion-activatable': true,
|
|
823
886
|
'ion-focusable': true,
|
|
824
|
-
|
|
887
|
+
'ion-focused': focused,
|
|
888
|
+
}, part: [
|
|
889
|
+
'knob-handle',
|
|
890
|
+
dualKnobs && knob === 'A' && 'knob-handle-a',
|
|
891
|
+
dualKnobs && knob === 'B' && 'knob-handle-b',
|
|
892
|
+
dualKnobs && position === 'lower' && 'knob-handle-lower',
|
|
893
|
+
dualKnobs && position === 'upper' && 'knob-handle-upper',
|
|
894
|
+
pressed && 'pressed',
|
|
895
|
+
focused && 'focused',
|
|
896
|
+
hovered && 'hover',
|
|
897
|
+
activated && 'activated',
|
|
898
|
+
]
|
|
899
|
+
.filter(Boolean)
|
|
900
|
+
.join(' '), style: knobStyle(), role: "slider", tabindex: disabled ? -1 : 0, "aria-label": ariaLabel !== undefined ? ariaLabel : null, "aria-labelledby": ariaLabel === undefined ? 'range-label' : null, "aria-valuemin": min, "aria-valuemax": max, "aria-disabled": disabled ? 'true' : null, "aria-valuenow": value }, pin && (h("div", { class: "range-pin", role: "presentation", part: [
|
|
901
|
+
'pin',
|
|
902
|
+
dualKnobs && knob === 'A' && 'pin-a',
|
|
903
|
+
dualKnobs && knob === 'B' && 'pin-b',
|
|
904
|
+
dualKnobs && position === 'lower' && 'pin-lower',
|
|
905
|
+
dualKnobs && position === 'upper' && 'pin-upper',
|
|
906
|
+
pressed && 'pressed',
|
|
907
|
+
focused && 'focused',
|
|
908
|
+
hovered && 'hover',
|
|
909
|
+
activated && 'activated',
|
|
910
|
+
]
|
|
911
|
+
.filter(Boolean)
|
|
912
|
+
.join(' ') }, pinFormatter(value))), h("div", { class: "range-knob", role: "presentation", part: [
|
|
913
|
+
'knob',
|
|
914
|
+
dualKnobs && knob === 'A' && 'knob-a',
|
|
915
|
+
dualKnobs && knob === 'B' && 'knob-b',
|
|
916
|
+
dualKnobs && position === 'lower' && 'knob-lower',
|
|
917
|
+
dualKnobs && position === 'upper' && 'knob-upper',
|
|
918
|
+
pressed && 'pressed',
|
|
919
|
+
focused && 'focused',
|
|
920
|
+
hovered && 'hover',
|
|
921
|
+
activated && 'activated',
|
|
922
|
+
]
|
|
923
|
+
.filter(Boolean)
|
|
924
|
+
.join(' ') })));
|
|
925
|
+
};
|
|
926
|
+
/**
|
|
927
|
+
* Returns whether the given knob is at the lower or upper position based
|
|
928
|
+
* on current ratios for the given knob.
|
|
929
|
+
*/
|
|
930
|
+
const getKnobPosition = (knob, ratioA, ratioB, dualKnobs) => {
|
|
931
|
+
if (dualKnobs) {
|
|
932
|
+
if (knob === 'A') {
|
|
933
|
+
return ratioA <= ratioB ? 'lower' : 'upper';
|
|
934
|
+
}
|
|
935
|
+
return ratioB <= ratioA ? 'lower' : 'upper';
|
|
936
|
+
}
|
|
937
|
+
return 'lower';
|
|
825
938
|
};
|
|
826
939
|
const ratioToValue = (ratio, min, max, step) => {
|
|
827
940
|
let value = (max - min) * ratio;
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
|
|
5
5
|
import { i as isRTL } from './dir.js';
|
|
6
6
|
|
|
7
|
-
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)
|
|
7
|
+
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}";
|
|
8
8
|
|
|
9
|
-
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)
|
|
9
|
+
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}";
|
|
10
10
|
|
|
11
11
|
const SegmentView = /*@__PURE__*/ proxyCustomElement(class SegmentView extends HTMLElement {
|
|
12
12
|
constructor(registerHost) {
|
|
@@ -22,10 +22,6 @@ const SegmentView = /*@__PURE__*/ proxyCustomElement(class SegmentView extends H
|
|
|
22
22
|
* If `true`, the segment view cannot be interacted with.
|
|
23
23
|
*/
|
|
24
24
|
this.disabled = false;
|
|
25
|
-
/**
|
|
26
|
-
* If `true`, users will be able to swipe the segment view to navigate between segment contents.
|
|
27
|
-
*/
|
|
28
|
-
this.swipeGesture = true;
|
|
29
25
|
}
|
|
30
26
|
handleScroll(ev) {
|
|
31
27
|
var _a;
|
|
@@ -113,12 +109,11 @@ const SegmentView = /*@__PURE__*/ proxyCustomElement(class SegmentView extends H
|
|
|
113
109
|
return Array.from(this.el.querySelectorAll('ion-segment-content'));
|
|
114
110
|
}
|
|
115
111
|
render() {
|
|
116
|
-
const { disabled, isManualScroll
|
|
117
|
-
return (h(Host, { key: '
|
|
112
|
+
const { disabled, isManualScroll } = this;
|
|
113
|
+
return (h(Host, { key: 'e180b67bb3143a5f4611fb358c037be6fc782a8f', class: {
|
|
118
114
|
'segment-view-disabled': disabled,
|
|
119
115
|
'segment-view-scroll-disabled': isManualScroll === false,
|
|
120
|
-
|
|
121
|
-
} }, h("slot", { key: '4118c240364467302b8f593e33c37837ea5d06f0' })));
|
|
116
|
+
} }, h("slot", { key: '41c11d6a7406a10f5c64a2e73abfc072afd8fc73' })));
|
|
122
117
|
}
|
|
123
118
|
get el() { return this; }
|
|
124
119
|
static get style() { return {
|
|
@@ -127,7 +122,6 @@ const SegmentView = /*@__PURE__*/ proxyCustomElement(class SegmentView extends H
|
|
|
127
122
|
}; }
|
|
128
123
|
}, [289, "ion-segment-view", {
|
|
129
124
|
"disabled": [4],
|
|
130
|
-
"swipeGesture": [4, "swipe-gesture"],
|
|
131
125
|
"isManualScroll": [32],
|
|
132
126
|
"setContent": [64]
|
|
133
127
|
}, [[1, "scroll", "handleScroll"], [1, "touchstart", "handleScrollStart"], [1, "touchend", "handleTouchEnd"]]]);
|