@ionic/core 7.7.4 → 7.7.5-nightly.20240307
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/checkbox.js +1 -1
- package/components/ion-range.js +126 -21
- package/dist/cjs/ion-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/ion-range.cjs.entry.js +126 -21
- package/dist/collection/components/checkbox/checkbox.js +1 -1
- package/dist/collection/components/checkbox/test/checkbox.spec.js +12 -0
- package/dist/collection/components/range/range.js +126 -21
- package/dist/collection/components/range/test/range-events.e2e.js +27 -0
- package/dist/docs.json +1 -1
- package/dist/esm/ion-checkbox.entry.js +1 -1
- package/dist/esm/ion-range.entry.js +126 -21
- package/dist/esm-es5/ion-checkbox.entry.js +1 -1
- package/dist/esm-es5/ion-range.entry.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-134d4936.system.js +1 -1
- package/dist/ionic/{p-8a46dbfe.system.entry.js → p-4573d495.system.entry.js} +1 -1
- package/dist/ionic/p-c79b0afa.entry.js +4 -0
- package/dist/ionic/{p-e23090ae.system.entry.js → p-c85693ad.system.entry.js} +1 -1
- package/dist/ionic/p-f553e0c0.entry.js +4 -0
- package/dist/types/components/range/range.d.ts +29 -0
- package/hydrate/index.js +127 -22
- package/package.json +1 -1
- package/dist/ionic/p-38a75a00.entry.js +0 -4
- package/dist/ionic/p-c977af5e.entry.js +0 -4
|
@@ -98,8 +98,14 @@ const Range = class {
|
|
|
98
98
|
el: rangeSlider,
|
|
99
99
|
gestureName: 'range',
|
|
100
100
|
gesturePriority: 100,
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
/**
|
|
102
|
+
* Provide a threshold since the drag movement
|
|
103
|
+
* might be a user scrolling the view.
|
|
104
|
+
* If this is true, then the range
|
|
105
|
+
* should not move.
|
|
106
|
+
*/
|
|
107
|
+
threshold: 10,
|
|
108
|
+
onStart: () => this.onStart(),
|
|
103
109
|
onMove: (ev) => this.onMove(ev),
|
|
104
110
|
onEnd: (ev) => this.onEnd(ev),
|
|
105
111
|
});
|
|
@@ -282,33 +288,93 @@ const Range = class {
|
|
|
282
288
|
this.value = this.ensureValueInBounds(this.value);
|
|
283
289
|
this.ionChange.emit({ value: this.value });
|
|
284
290
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
291
|
+
/**
|
|
292
|
+
* The value should be updated on touch end or
|
|
293
|
+
* when the component is being dragged.
|
|
294
|
+
* This follows the native behavior of mobile devices.
|
|
295
|
+
*
|
|
296
|
+
* For example: When the user lifts their finger from the
|
|
297
|
+
* screen after tapping the bar or dragging the bar or knob.
|
|
298
|
+
*/
|
|
299
|
+
onStart() {
|
|
300
|
+
this.ionKnobMoveStart.emit({ value: this.ensureValueInBounds(this.value) });
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* The value should be updated while dragging the
|
|
304
|
+
* bar or knob.
|
|
305
|
+
*
|
|
306
|
+
* While the user is dragging, the view
|
|
307
|
+
* should not scroll. This is to prevent the user from
|
|
308
|
+
* feeling disoriented while dragging.
|
|
309
|
+
*
|
|
310
|
+
* The user can scroll on the view if the knob or
|
|
311
|
+
* bar is not being dragged.
|
|
312
|
+
*
|
|
313
|
+
* @param detail The details of the gesture event.
|
|
314
|
+
*/
|
|
315
|
+
onMove(detail) {
|
|
316
|
+
const { contentEl, pressedKnob } = this;
|
|
317
|
+
const currentX = detail.currentX;
|
|
318
|
+
/**
|
|
319
|
+
* Since the user is dragging on the bar or knob, the view should not scroll.
|
|
320
|
+
*
|
|
321
|
+
* This only needs to be done once.
|
|
322
|
+
*/
|
|
323
|
+
if (contentEl && this.initialContentScrollY === undefined) {
|
|
288
324
|
this.initialContentScrollY = disableContentScrollY(contentEl);
|
|
289
325
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
326
|
+
/**
|
|
327
|
+
* The `pressedKnob` can be undefined if the user just
|
|
328
|
+
* started dragging the knob.
|
|
329
|
+
*
|
|
330
|
+
* This is necessary to determine which knob the user is dragging,
|
|
331
|
+
* especially when it's a dual knob.
|
|
332
|
+
* Plus, it determines when to apply certain styles.
|
|
333
|
+
*
|
|
334
|
+
* This only needs to be done once since the knob won't change
|
|
335
|
+
* while the user is dragging.
|
|
336
|
+
*/
|
|
337
|
+
if (pressedKnob === undefined) {
|
|
338
|
+
this.setPressedKnob(currentX);
|
|
296
339
|
}
|
|
297
|
-
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
298
|
-
this.setFocus(this.pressedKnob);
|
|
299
|
-
// update the active knob's position
|
|
300
340
|
this.update(currentX);
|
|
301
|
-
this.ionKnobMoveStart.emit({ value: this.ensureValueInBounds(this.value) });
|
|
302
|
-
}
|
|
303
|
-
onMove(detail) {
|
|
304
|
-
this.update(detail.currentX);
|
|
305
341
|
}
|
|
342
|
+
/**
|
|
343
|
+
* The value should be updated on touch end:
|
|
344
|
+
* - When the user lifts their finger from the screen after
|
|
345
|
+
* tapping the bar.
|
|
346
|
+
*
|
|
347
|
+
* @param detail The details of the gesture or mouse event.
|
|
348
|
+
*/
|
|
306
349
|
onEnd(detail) {
|
|
307
350
|
const { contentEl, initialContentScrollY } = this;
|
|
308
|
-
|
|
351
|
+
const currentX = detail.currentX || detail.clientX;
|
|
352
|
+
/**
|
|
353
|
+
* The `pressedKnob` can be undefined if the user never
|
|
354
|
+
* dragged the knob. They just tapped on the bar.
|
|
355
|
+
*
|
|
356
|
+
* This is necessary to determine which knob the user is changing,
|
|
357
|
+
* especially when it's a dual knob.
|
|
358
|
+
* Plus, it determines when to apply certain styles.
|
|
359
|
+
*/
|
|
360
|
+
if (this.pressedKnob === undefined) {
|
|
361
|
+
this.setPressedKnob(currentX);
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* The user is no longer dragging the bar or
|
|
365
|
+
* knob (if they were dragging it).
|
|
366
|
+
*
|
|
367
|
+
* The user can now scroll on the view in the next gesture event.
|
|
368
|
+
*/
|
|
369
|
+
if (contentEl && initialContentScrollY !== undefined) {
|
|
309
370
|
resetContentScrollY(contentEl, initialContentScrollY);
|
|
310
371
|
}
|
|
311
|
-
|
|
372
|
+
// update the active knob's position
|
|
373
|
+
this.update(currentX);
|
|
374
|
+
/**
|
|
375
|
+
* Reset the pressed knob to undefined since the user
|
|
376
|
+
* may start dragging a different knob in the next gesture event.
|
|
377
|
+
*/
|
|
312
378
|
this.pressedKnob = undefined;
|
|
313
379
|
this.emitValueChange();
|
|
314
380
|
this.ionKnobMoveEnd.emit({ value: this.ensureValueInBounds(this.value) });
|
|
@@ -335,6 +401,16 @@ const Range = class {
|
|
|
335
401
|
// Update input value
|
|
336
402
|
this.updateValue();
|
|
337
403
|
}
|
|
404
|
+
setPressedKnob(currentX) {
|
|
405
|
+
const rect = (this.rect = this.rangeSlider.getBoundingClientRect());
|
|
406
|
+
// figure out which knob they started closer to
|
|
407
|
+
let ratio = clamp(0, (currentX - rect.left) / rect.width, 1);
|
|
408
|
+
if (isRTL(this.el)) {
|
|
409
|
+
ratio = 1 - ratio;
|
|
410
|
+
}
|
|
411
|
+
this.pressedKnob = !this.dualKnobs || Math.abs(this.ratioA - ratio) < Math.abs(this.ratioB - ratio) ? 'A' : 'B';
|
|
412
|
+
this.setFocus(this.pressedKnob);
|
|
413
|
+
}
|
|
338
414
|
get valA() {
|
|
339
415
|
return ratioToValue(this.ratioA, this.min, this.max, this.step);
|
|
340
416
|
}
|
|
@@ -537,7 +613,36 @@ Developers can dismiss this warning by removing their usage of the "legacy" prop
|
|
|
537
613
|
if (!this.legacyFormController.hasLegacyControl() && this.hasLabel) {
|
|
538
614
|
labelledBy = 'range-label';
|
|
539
615
|
}
|
|
540
|
-
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl)
|
|
616
|
+
return (h("div", { class: "range-slider", ref: (rangeEl) => (this.rangeSlider = rangeEl),
|
|
617
|
+
/**
|
|
618
|
+
* Since the gesture has a threshold, the value
|
|
619
|
+
* won't change until the user has dragged past
|
|
620
|
+
* the threshold. This is to prevent the range
|
|
621
|
+
* from moving when the user is scrolling.
|
|
622
|
+
*
|
|
623
|
+
* This results in the value not being updated
|
|
624
|
+
* and the event emitters not being triggered
|
|
625
|
+
* if the user taps on the range. This is why
|
|
626
|
+
* we need to listen for the "pointerUp" event.
|
|
627
|
+
*/
|
|
628
|
+
onPointerUp: (ev) => {
|
|
629
|
+
/**
|
|
630
|
+
* If the user drags the knob on the web
|
|
631
|
+
* version (does not occur on mobile),
|
|
632
|
+
* the "pointerUp" event will be triggered
|
|
633
|
+
* along with the gesture's events.
|
|
634
|
+
* This leads to duplicate events.
|
|
635
|
+
*
|
|
636
|
+
* By checking if the pressedKnob is undefined,
|
|
637
|
+
* we can determine if the "pointerUp" event was
|
|
638
|
+
* triggered by a tap or a drag. If it was
|
|
639
|
+
* dragged, the pressedKnob will be defined.
|
|
640
|
+
*/
|
|
641
|
+
if (this.pressedKnob === undefined) {
|
|
642
|
+
this.onStart();
|
|
643
|
+
this.onEnd(ev);
|
|
644
|
+
}
|
|
645
|
+
} }, ticks.map((tick) => (h("div", { style: tickStyle(tick), role: "presentation", class: {
|
|
541
646
|
'range-tick': true,
|
|
542
647
|
'range-tick-active': tick.active,
|
|
543
648
|
}, part: tick.active ? 'tick-active' : 'tick' }))), h("div", { class: "range-bar-container" }, h("div", { class: "range-bar", role: "presentation", part: "bar" }), h("div", { class: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
3
|
*/
|
|
4
|
-
import{r as registerInstance,d as createEvent,h,H as Host,f as getElement}from"./index-9b6d6df3.js";import{c as createLegacyFormController}from"./form-controller-21dd62b1.js";import{i as inheritAriaAttributes,d as renderHiddenInput,e as getAriaLabel}from"./helpers-be245865.js";import{p as printIonWarning}from"./index-9b0d46f4.js";import{c as createColorClasses,h as hostContext}from"./theme-01f3f29c.js";import{b as getIonMode}from"./ionic-global-c976d684.js";var checkboxIosCss=":host{--checkbox-background-checked:var(--ion-color-primary, #3880ff);--border-color-checked:var(--ion-color-primary, #3880ff);--checkmark-color:var(--ion-color-primary-contrast, #fff);--checkmark-width:1;--transition:none;display:inline-block;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){width:100%;height:100%}:host([slot=start]:not(.legacy-checkbox)),:host([slot=end]:not(.legacy-checkbox)){width:auto}:host(.legacy-checkbox){width:var(--size);height:var(--size)}:host(.ion-color){--checkbox-background-checked:var(--ion-color-base);--border-color-checked:var(--ion-color-base);--checkmark-color:var(--ion-color-contrast)}:host(.legacy-checkbox) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}@supports (inset-inline-start: 0){:host(.legacy-checkbox) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-checkbox) label{left:0}:host-context([dir=rtl]):host(.legacy-checkbox) label,:host-context([dir=rtl]).legacy-checkbox label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-checkbox:dir(rtl)) label{left:unset;right:unset;right:0}}}:host(.legacy-checkbox) label::-moz-focus-inner{border:0}.checkbox-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-checkbox)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.checkbox-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.checkbox-icon{border-radius:var(--border-radius);position:relative;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--checkbox-background);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.legacy-checkbox) .checkbox-icon{display:block;width:100%;height:100%}:host(:not(.legacy-checkbox)) .checkbox-icon{width:var(--size);height:var(--size)}.checkbox-icon path{fill:none;stroke:var(--checkmark-color);stroke-width:var(--checkmark-width);opacity:0}:host(.checkbox-justify-space-between) .checkbox-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.checkbox-justify-start) .checkbox-wrapper{-ms-flex-pack:start;justify-content:start}:host(.checkbox-justify-end) .checkbox-wrapper{-ms-flex-pack:end;justify-content:end}:host(.checkbox-alignment-start) .checkbox-wrapper{-ms-flex-align:start;align-items:start}:host(.checkbox-alignment-center) .checkbox-wrapper{-ms-flex-align:center;align-items:center}:host(.checkbox-label-placement-start) .checkbox-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.checkbox-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-end) .checkbox-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.checkbox-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.checkbox-label-placement-stacked) .checkbox-wrapper{-ms-flex-direction:column;flex-direction:column}:host(.checkbox-label-placement-stacked) .label-text-wrapper{-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(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.checkbox-checked) .checkbox-icon,:host(.checkbox-indeterminate) .checkbox-icon{border-color:var(--border-color-checked);background:var(--checkbox-background-checked)}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{opacity:1}:host(.checkbox-disabled){pointer-events:none}:host{--border-radius:50%;--border-width:0.0625rem;--border-style:solid;--border-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.23);--checkbox-background:var(--ion-item-background, var(--ion-background-color, #fff));--size:min(1.625rem, 65.988px)}:host(.checkbox-disabled){opacity:0.3}:host(.in-item.legacy-checkbox){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:9px;display:block;position:static}:host(.in-item.legacy-checkbox[slot=start]){-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:8px;margin-bottom:8px}";var IonCheckboxIosStyle0=checkboxIosCss;var checkboxMdCss=":host{--checkbox-background-checked:var(--ion-color-primary, #3880ff);--border-color-checked:var(--ion-color-primary, #3880ff);--checkmark-color:var(--ion-color-primary-contrast, #fff);--checkmark-width:1;--transition:none;display:inline-block;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){width:100%;height:100%}:host([slot=start]:not(.legacy-checkbox)),:host([slot=end]:not(.legacy-checkbox)){width:auto}:host(.legacy-checkbox){width:var(--size);height:var(--size)}:host(.ion-color){--checkbox-background-checked:var(--ion-color-base);--border-color-checked:var(--ion-color-base);--checkmark-color:var(--ion-color-contrast)}:host(.legacy-checkbox) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}@supports (inset-inline-start: 0){:host(.legacy-checkbox) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-checkbox) label{left:0}:host-context([dir=rtl]):host(.legacy-checkbox) label,:host-context([dir=rtl]).legacy-checkbox label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-checkbox:dir(rtl)) label{left:unset;right:unset;right:0}}}:host(.legacy-checkbox) label::-moz-focus-inner{border:0}.checkbox-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-checkbox)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.checkbox-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.checkbox-icon{border-radius:var(--border-radius);position:relative;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--checkbox-background);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.legacy-checkbox) .checkbox-icon{display:block;width:100%;height:100%}:host(:not(.legacy-checkbox)) .checkbox-icon{width:var(--size);height:var(--size)}.checkbox-icon path{fill:none;stroke:var(--checkmark-color);stroke-width:var(--checkmark-width);opacity:0}:host(.checkbox-justify-space-between) .checkbox-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.checkbox-justify-start) .checkbox-wrapper{-ms-flex-pack:start;justify-content:start}:host(.checkbox-justify-end) .checkbox-wrapper{-ms-flex-pack:end;justify-content:end}:host(.checkbox-alignment-start) .checkbox-wrapper{-ms-flex-align:start;align-items:start}:host(.checkbox-alignment-center) .checkbox-wrapper{-ms-flex-align:center;align-items:center}:host(.checkbox-label-placement-start) .checkbox-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.checkbox-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-end) .checkbox-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.checkbox-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.checkbox-label-placement-stacked) .checkbox-wrapper{-ms-flex-direction:column;flex-direction:column}:host(.checkbox-label-placement-stacked) .label-text-wrapper{-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(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.checkbox-checked) .checkbox-icon,:host(.checkbox-indeterminate) .checkbox-icon{border-color:var(--border-color-checked);background:var(--checkbox-background-checked)}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{opacity:1}:host(.checkbox-disabled){pointer-events:none}:host{--border-radius:calc(var(--size) * .125);--border-width:2px;--border-style:solid;--border-color:rgb(var(--ion-text-color-rgb, 0, 0, 0), 0.6);--checkmark-width:3;--checkbox-background:var(--ion-item-background, var(--ion-background-color, #fff));--transition:background 180ms cubic-bezier(0.4, 0, 0.2, 1);--size:18px}.checkbox-icon path{stroke-dasharray:30;stroke-dashoffset:30}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{stroke-dashoffset:0;-webkit-transition:stroke-dashoffset 90ms linear 90ms;transition:stroke-dashoffset 90ms linear 90ms}:host(.legacy-checkbox.checkbox-disabled),:host(.checkbox-disabled) .label-text-wrapper{opacity:0.38}:host(.checkbox-disabled) .native-wrapper{opacity:0.63}:host(.in-item.legacy-checkbox){margin-left:0;margin-right:0;margin-top:18px;margin-bottom:18px;display:block;position:static}:host(.in-item.legacy-checkbox[slot=start]){-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:36px;margin-inline-end:36px;margin-top:18px;margin-bottom:18px}";var IonCheckboxMdStyle0=checkboxMdCss;var Checkbox=function(){function e(e){var t=this;registerInstance(this,e);this.ionChange=createEvent(this,"ionChange",7);this.ionFocus=createEvent(this,"ionFocus",7);this.ionBlur=createEvent(this,"ionBlur",7);this.ionStyle=createEvent(this,"ionStyle",7);this.inputId="ion-cb-".concat(checkboxIds++);this.inheritedAttributes={};this.hasLoggedDeprecationWarning=false;this.setChecked=function(e){var r=t.checked=e;t.ionChange.emit({checked:r,value:t.value})};this.toggleChecked=function(e){e.preventDefault();t.setFocus();t.setChecked(!t.checked);t.indeterminate=false};this.onFocus=function(){t.ionFocus.emit()};this.onBlur=function(){t.ionBlur.emit()};this.onClick=function(e){if(t.disabled){return}t.toggleChecked(e)};this.color=undefined;this.name=this.inputId;this.checked=false;this.indeterminate=false;this.disabled=false;this.value="on";this.labelPlacement="start";this.justify="space-between";this.alignment="center";this.legacy=undefined}e.prototype.connectedCallback=function(){this.legacyFormController=createLegacyFormController(this.el)};e.prototype.componentWillLoad=function(){this.emitStyle();if(!this.legacyFormController.hasLegacyControl()){this.inheritedAttributes=Object.assign({},inheritAriaAttributes(this.el))}};e.prototype.styleChanged=function(){this.emitStyle()};e.prototype.emitStyle=function(){var e={"interactive-disabled":this.disabled,legacy:!!this.legacy};if(this.legacyFormController.hasLegacyControl()){e["checkbox-checked"]=this.checked}this.ionStyle.emit(e)};e.prototype.setFocus=function(){if(this.focusEl){this.focusEl.focus()}};e.prototype.render=function(){var e=this.legacyFormController;return e.hasLegacyControl()?this.renderLegacyCheckbox():this.renderCheckbox()};e.prototype.renderCheckbox=function(){var e;var t=this;var r=this,o=r.color,i=r.checked,a=r.disabled,c=r.el,n=r.getSVGPath,l=r.indeterminate,s=r.inheritedAttributes,b=r.inputId,p=r.justify,x=r.labelPlacement,d=r.name,k=r.value,m=r.alignment;var g=getIonMode(this);var f=n(g,l);renderHiddenInput(true,c,d,i?k:"",a);return h(Host,{class:createColorClasses(o,(e={},e[g]=true,e["in-item"]=hostContext("ion-item",c),e["checkbox-checked"]=i,e["checkbox-disabled"]=a,e["checkbox-indeterminate"]=l,e.interactive=true,e["checkbox-justify-".concat(p)]=true,e["checkbox-alignment-".concat(m)]=true,e["checkbox-label-placement-".concat(x)]=true,e)),onClick:this.onClick},h("label",{class:"checkbox-wrapper"},h("input",Object.assign({type:"checkbox",checked:i?true:undefined,disabled:a,id:b,onChange:this.toggleChecked,onFocus:function(){return t.onFocus()},onBlur:function(){return t.onBlur()},ref:function(e){return t.focusEl=e}},s)),h("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":c.textContent===""},part:"label"},h("slot",null)),h("div",{class:"native-wrapper"},h("svg",{class:"checkbox-icon",viewBox:"0 0 24 24",part:"container"},f))))};e.prototype.renderLegacyCheckbox=function(){var e;var t=this;if(!this.hasLoggedDeprecationWarning){printIonWarning('ion-checkbox now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.\n\nExample: <ion-checkbox>Label</ion-checkbox>\nExample with aria-label: <ion-checkbox aria-label="Label"></ion-checkbox>\n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.',this.el);if(this.legacy){printIonWarning('ion-checkbox is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new checkbox syntax.',this.el)}this.hasLoggedDeprecationWarning=true}var r=this,o=r.color,i=r.checked,a=r.disabled,c=r.el,n=r.getSVGPath,l=r.indeterminate,s=r.inputId,b=r.name,p=r.value;var x=getIonMode(this);var d=getAriaLabel(c,s),k=d.label,m=d.labelId,g=d.labelText;var f=n(x,l);renderHiddenInput(true,c,b,i?p:"",a);return h(Host,{"aria-labelledby":k?m:null,"aria-checked":"".concat(i),"aria-hidden":a?"true":null,role:"checkbox",class:createColorClasses(o,(e={},e[x]=true,e["in-item"]=hostContext("ion-item",c),e["checkbox-checked"]=i,e["checkbox-disabled"]=a,e["checkbox-indeterminate"]=l,e["legacy-checkbox"]=true,e.interactive=true,e)),onClick:this.onClick},h("svg",{class:"checkbox-icon",viewBox:"0 0 24 24",part:"container"},f),h("label",{htmlFor:s},g),h("input",{type:"checkbox","aria-checked":"".concat(i),disabled:a,id:s,onChange:this.toggleChecked,onFocus:function(){return t.onFocus()},onBlur:function(){return t.onBlur()},ref:function(e){return t.focusEl=e}}))};e.prototype.getSVGPath=function(e,t){var r=t?h("path",{d:"M6 12L18 12",part:"mark"}):h("path",{d:"M5.9,12.5l3.8,3.8l8.8-8.8",part:"mark"});if(e==="md"){r=t?h("path",{d:"M2 12H22",part:"mark"}):h("path",{d:"M1.73,12.91 8.1,19.28 22.79,4.59",part:"mark"})}return r};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checked:["styleChanged"],disabled:["styleChanged"]}},enumerable:false,configurable:true});return e}();var checkboxIds=0;Checkbox.style={ios:IonCheckboxIosStyle0,md:IonCheckboxMdStyle0};export{Checkbox as ion_checkbox};
|
|
4
|
+
import{r as registerInstance,d as createEvent,h,H as Host,f as getElement}from"./index-9b6d6df3.js";import{c as createLegacyFormController}from"./form-controller-21dd62b1.js";import{i as inheritAriaAttributes,d as renderHiddenInput,e as getAriaLabel}from"./helpers-be245865.js";import{p as printIonWarning}from"./index-9b0d46f4.js";import{c as createColorClasses,h as hostContext}from"./theme-01f3f29c.js";import{b as getIonMode}from"./ionic-global-c976d684.js";var checkboxIosCss=":host{--checkbox-background-checked:var(--ion-color-primary, #3880ff);--border-color-checked:var(--ion-color-primary, #3880ff);--checkmark-color:var(--ion-color-primary-contrast, #fff);--checkmark-width:1;--transition:none;display:inline-block;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){width:100%;height:100%}:host([slot=start]:not(.legacy-checkbox)),:host([slot=end]:not(.legacy-checkbox)){width:auto}:host(.legacy-checkbox){width:var(--size);height:var(--size)}:host(.ion-color){--checkbox-background-checked:var(--ion-color-base);--border-color-checked:var(--ion-color-base);--checkmark-color:var(--ion-color-contrast)}:host(.legacy-checkbox) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}@supports (inset-inline-start: 0){:host(.legacy-checkbox) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-checkbox) label{left:0}:host-context([dir=rtl]):host(.legacy-checkbox) label,:host-context([dir=rtl]).legacy-checkbox label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-checkbox:dir(rtl)) label{left:unset;right:unset;right:0}}}:host(.legacy-checkbox) label::-moz-focus-inner{border:0}.checkbox-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-checkbox)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.checkbox-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.checkbox-icon{border-radius:var(--border-radius);position:relative;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--checkbox-background);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.legacy-checkbox) .checkbox-icon{display:block;width:100%;height:100%}:host(:not(.legacy-checkbox)) .checkbox-icon{width:var(--size);height:var(--size)}.checkbox-icon path{fill:none;stroke:var(--checkmark-color);stroke-width:var(--checkmark-width);opacity:0}:host(.checkbox-justify-space-between) .checkbox-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.checkbox-justify-start) .checkbox-wrapper{-ms-flex-pack:start;justify-content:start}:host(.checkbox-justify-end) .checkbox-wrapper{-ms-flex-pack:end;justify-content:end}:host(.checkbox-alignment-start) .checkbox-wrapper{-ms-flex-align:start;align-items:start}:host(.checkbox-alignment-center) .checkbox-wrapper{-ms-flex-align:center;align-items:center}:host(.checkbox-label-placement-start) .checkbox-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.checkbox-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-end) .checkbox-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.checkbox-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.checkbox-label-placement-stacked) .checkbox-wrapper{-ms-flex-direction:column;flex-direction:column}:host(.checkbox-label-placement-stacked) .label-text-wrapper{-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(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.checkbox-checked) .checkbox-icon,:host(.checkbox-indeterminate) .checkbox-icon{border-color:var(--border-color-checked);background:var(--checkbox-background-checked)}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{opacity:1}:host(.checkbox-disabled){pointer-events:none}:host{--border-radius:50%;--border-width:0.0625rem;--border-style:solid;--border-color:rgba(var(--ion-text-color-rgb, 0, 0, 0), 0.23);--checkbox-background:var(--ion-item-background, var(--ion-background-color, #fff));--size:min(1.625rem, 65.988px)}:host(.checkbox-disabled){opacity:0.3}:host(.in-item.legacy-checkbox){-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:8px;margin-inline-end:8px;margin-top:10px;margin-bottom:9px;display:block;position:static}:host(.in-item.legacy-checkbox[slot=start]){-webkit-margin-start:2px;margin-inline-start:2px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:8px;margin-bottom:8px}";var IonCheckboxIosStyle0=checkboxIosCss;var checkboxMdCss=":host{--checkbox-background-checked:var(--ion-color-primary, #3880ff);--border-color-checked:var(--ion-color-primary, #3880ff);--checkmark-color:var(--ion-color-primary-contrast, #fff);--checkmark-width:1;--transition:none;display:inline-block;position:relative;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:2}:host(.in-item){width:100%;height:100%}:host([slot=start]:not(.legacy-checkbox)),:host([slot=end]:not(.legacy-checkbox)){width:auto}:host(.legacy-checkbox){width:var(--size);height:var(--size)}:host(.ion-color){--checkbox-background-checked:var(--ion-color-base);--border-color-checked:var(--ion-color-base);--checkmark-color:var(--ion-color-contrast)}:host(.legacy-checkbox) label{top:0;margin-left:0;margin-right:0;margin-top:0;margin-bottom:0;position:absolute;width:100%;height:100%;border:0;background:transparent;cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;outline:none;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;opacity:0}@supports (inset-inline-start: 0){:host(.legacy-checkbox) label{inset-inline-start:0}}@supports not (inset-inline-start: 0){:host(.legacy-checkbox) label{left:0}:host-context([dir=rtl]):host(.legacy-checkbox) label,:host-context([dir=rtl]).legacy-checkbox label{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){:host(.legacy-checkbox:dir(rtl)) label{left:unset;right:unset;right:0}}}:host(.legacy-checkbox) label::-moz-focus-inner{border:0}.checkbox-wrapper{display:-ms-flexbox;display:flex;-ms-flex-positive:1;flex-grow:1;-ms-flex-align:center;align-items:center;height:inherit;cursor:inherit}.label-text-wrapper{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}:host(.in-item:not(.legacy-checkbox)) .label-text-wrapper{margin-top:10px;margin-bottom:10px}:host(.in-item.checkbox-label-placement-stacked) .label-text-wrapper{margin-top:10px;margin-bottom:16px}:host(.in-item.checkbox-label-placement-stacked) .native-wrapper{margin-bottom:10px}.label-text-wrapper-hidden{display:none}input{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;margin:0;padding:0;border:0;outline:0;clip:rect(0 0 0 0);opacity:0;overflow:hidden;-webkit-appearance:none;-moz-appearance:none}.native-wrapper{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.checkbox-icon{border-radius:var(--border-radius);position:relative;-webkit-transition:var(--transition);transition:var(--transition);border-width:var(--border-width);border-style:var(--border-style);border-color:var(--border-color);background:var(--checkbox-background);-webkit-box-sizing:border-box;box-sizing:border-box}:host(.legacy-checkbox) .checkbox-icon{display:block;width:100%;height:100%}:host(:not(.legacy-checkbox)) .checkbox-icon{width:var(--size);height:var(--size)}.checkbox-icon path{fill:none;stroke:var(--checkmark-color);stroke-width:var(--checkmark-width);opacity:0}:host(.checkbox-justify-space-between) .checkbox-wrapper{-ms-flex-pack:justify;justify-content:space-between}:host(.checkbox-justify-start) .checkbox-wrapper{-ms-flex-pack:start;justify-content:start}:host(.checkbox-justify-end) .checkbox-wrapper{-ms-flex-pack:end;justify-content:end}:host(.checkbox-alignment-start) .checkbox-wrapper{-ms-flex-align:start;align-items:start}:host(.checkbox-alignment-center) .checkbox-wrapper{-ms-flex-align:center;align-items:center}:host(.checkbox-label-placement-start) .checkbox-wrapper{-ms-flex-direction:row;flex-direction:row}:host(.checkbox-label-placement-start) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-end) .checkbox-wrapper{-ms-flex-direction:row-reverse;flex-direction:row-reverse}:host(.checkbox-label-placement-end) .label-text-wrapper{-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:0;margin-inline-end:0}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-webkit-margin-start:0;margin-inline-start:0;-webkit-margin-end:16px;margin-inline-end:16px}:host(.checkbox-label-placement-fixed) .label-text-wrapper{-ms-flex:0 0 100px;flex:0 0 100px;width:100px;min-width:100px;max-width:200px}:host(.checkbox-label-placement-stacked) .checkbox-wrapper{-ms-flex-direction:column;flex-direction:column}:host(.checkbox-label-placement-stacked) .label-text-wrapper{-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(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper{-webkit-transform-origin:left top;transform-origin:left top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-start .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-start:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:right top;transform-origin:right top}}:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper{-webkit-transform-origin:center top;transform-origin:center top}:host-context([dir=rtl]):host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper,:host-context([dir=rtl]).checkbox-label-placement-stacked.checkbox-alignment-center .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}@supports selector(:dir(rtl)){:host(.checkbox-label-placement-stacked.checkbox-alignment-center:dir(rtl)) .label-text-wrapper{-webkit-transform-origin:calc(100% - center) top;transform-origin:calc(100% - center) top}}:host(.checkbox-checked) .checkbox-icon,:host(.checkbox-indeterminate) .checkbox-icon{border-color:var(--border-color-checked);background:var(--checkbox-background-checked)}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{opacity:1}:host(.checkbox-disabled){pointer-events:none}:host{--border-radius:calc(var(--size) * .125);--border-width:2px;--border-style:solid;--border-color:rgb(var(--ion-text-color-rgb, 0, 0, 0), 0.6);--checkmark-width:3;--checkbox-background:var(--ion-item-background, var(--ion-background-color, #fff));--transition:background 180ms cubic-bezier(0.4, 0, 0.2, 1);--size:18px}.checkbox-icon path{stroke-dasharray:30;stroke-dashoffset:30}:host(.checkbox-checked) .checkbox-icon path,:host(.checkbox-indeterminate) .checkbox-icon path{stroke-dashoffset:0;-webkit-transition:stroke-dashoffset 90ms linear 90ms;transition:stroke-dashoffset 90ms linear 90ms}:host(.legacy-checkbox.checkbox-disabled),:host(.checkbox-disabled) .label-text-wrapper{opacity:0.38}:host(.checkbox-disabled) .native-wrapper{opacity:0.63}:host(.in-item.legacy-checkbox){margin-left:0;margin-right:0;margin-top:18px;margin-bottom:18px;display:block;position:static}:host(.in-item.legacy-checkbox[slot=start]){-webkit-margin-start:4px;margin-inline-start:4px;-webkit-margin-end:36px;margin-inline-end:36px;margin-top:18px;margin-bottom:18px}";var IonCheckboxMdStyle0=checkboxMdCss;var Checkbox=function(){function e(e){var t=this;registerInstance(this,e);this.ionChange=createEvent(this,"ionChange",7);this.ionFocus=createEvent(this,"ionFocus",7);this.ionBlur=createEvent(this,"ionBlur",7);this.ionStyle=createEvent(this,"ionStyle",7);this.inputId="ion-cb-".concat(checkboxIds++);this.inheritedAttributes={};this.hasLoggedDeprecationWarning=false;this.setChecked=function(e){var r=t.checked=e;t.ionChange.emit({checked:r,value:t.value})};this.toggleChecked=function(e){e.preventDefault();t.setFocus();t.setChecked(!t.checked);t.indeterminate=false};this.onFocus=function(){t.ionFocus.emit()};this.onBlur=function(){t.ionBlur.emit()};this.onClick=function(e){if(t.disabled){return}t.toggleChecked(e)};this.color=undefined;this.name=this.inputId;this.checked=false;this.indeterminate=false;this.disabled=false;this.value="on";this.labelPlacement="start";this.justify="space-between";this.alignment="center";this.legacy=undefined}e.prototype.connectedCallback=function(){this.legacyFormController=createLegacyFormController(this.el)};e.prototype.componentWillLoad=function(){this.emitStyle();if(!this.legacyFormController.hasLegacyControl()){this.inheritedAttributes=Object.assign({},inheritAriaAttributes(this.el))}};e.prototype.styleChanged=function(){this.emitStyle()};e.prototype.emitStyle=function(){var e={"interactive-disabled":this.disabled,legacy:!!this.legacy};if(this.legacyFormController.hasLegacyControl()){e["checkbox-checked"]=this.checked}this.ionStyle.emit(e)};e.prototype.setFocus=function(){if(this.focusEl){this.focusEl.focus()}};e.prototype.render=function(){var e=this.legacyFormController;return e.hasLegacyControl()?this.renderLegacyCheckbox():this.renderCheckbox()};e.prototype.renderCheckbox=function(){var e;var t=this;var r=this,o=r.color,i=r.checked,a=r.disabled,c=r.el,n=r.getSVGPath,l=r.indeterminate,s=r.inheritedAttributes,b=r.inputId,p=r.justify,x=r.labelPlacement,d=r.name,k=r.value,m=r.alignment;var g=getIonMode(this);var f=n(g,l);renderHiddenInput(true,c,d,i?k:"",a);return h(Host,{"aria-checked":l?"mixed":"".concat(i),class:createColorClasses(o,(e={},e[g]=true,e["in-item"]=hostContext("ion-item",c),e["checkbox-checked"]=i,e["checkbox-disabled"]=a,e["checkbox-indeterminate"]=l,e.interactive=true,e["checkbox-justify-".concat(p)]=true,e["checkbox-alignment-".concat(m)]=true,e["checkbox-label-placement-".concat(x)]=true,e)),onClick:this.onClick},h("label",{class:"checkbox-wrapper"},h("input",Object.assign({type:"checkbox",checked:i?true:undefined,disabled:a,id:b,onChange:this.toggleChecked,onFocus:function(){return t.onFocus()},onBlur:function(){return t.onBlur()},ref:function(e){return t.focusEl=e}},s)),h("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":c.textContent===""},part:"label"},h("slot",null)),h("div",{class:"native-wrapper"},h("svg",{class:"checkbox-icon",viewBox:"0 0 24 24",part:"container"},f))))};e.prototype.renderLegacyCheckbox=function(){var e;var t=this;if(!this.hasLoggedDeprecationWarning){printIonWarning('ion-checkbox now requires providing a label with either the default slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.\n\nExample: <ion-checkbox>Label</ion-checkbox>\nExample with aria-label: <ion-checkbox aria-label="Label"></ion-checkbox>\n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.',this.el);if(this.legacy){printIonWarning('ion-checkbox is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new checkbox syntax.',this.el)}this.hasLoggedDeprecationWarning=true}var r=this,o=r.color,i=r.checked,a=r.disabled,c=r.el,n=r.getSVGPath,l=r.indeterminate,s=r.inputId,b=r.name,p=r.value;var x=getIonMode(this);var d=getAriaLabel(c,s),k=d.label,m=d.labelId,g=d.labelText;var f=n(x,l);renderHiddenInput(true,c,b,i?p:"",a);return h(Host,{"aria-labelledby":k?m:null,"aria-checked":"".concat(i),"aria-hidden":a?"true":null,role:"checkbox",class:createColorClasses(o,(e={},e[x]=true,e["in-item"]=hostContext("ion-item",c),e["checkbox-checked"]=i,e["checkbox-disabled"]=a,e["checkbox-indeterminate"]=l,e["legacy-checkbox"]=true,e.interactive=true,e)),onClick:this.onClick},h("svg",{class:"checkbox-icon",viewBox:"0 0 24 24",part:"container"},f),h("label",{htmlFor:s},g),h("input",{type:"checkbox","aria-checked":"".concat(i),disabled:a,id:s,onChange:this.toggleChecked,onFocus:function(){return t.onFocus()},onBlur:function(){return t.onBlur()},ref:function(e){return t.focusEl=e}}))};e.prototype.getSVGPath=function(e,t){var r=t?h("path",{d:"M6 12L18 12",part:"mark"}):h("path",{d:"M5.9,12.5l3.8,3.8l8.8-8.8",part:"mark"});if(e==="md"){r=t?h("path",{d:"M2 12H22",part:"mark"}):h("path",{d:"M1.73,12.91 8.1,19.28 22.79,4.59",part:"mark"})}return r};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{checked:["styleChanged"],disabled:["styleChanged"]}},enumerable:false,configurable:true});return e}();var checkboxIds=0;Checkbox.style={ios:IonCheckboxIosStyle0,md:IonCheckboxMdStyle0};export{Checkbox as ion_checkbox};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import{__awaiter,__generator}from"tslib";
|
|
2
2
|
/*!
|
|
3
3
|
* (C) Ionic http://ionicframework.com - MIT License
|
|
4
|
-
*/import{r as registerInstance,d as createEvent,h,H as Host,f as getElement}from"./index-9b6d6df3.js";import{f as findClosestIonContent,d as disableContentScrollY,r as resetContentScrollY}from"./index-f3946ac1.js";import{c as createLegacyFormController}from"./form-controller-21dd62b1.js";import{l as clamp,j as debounceEvent,i as inheritAriaAttributes,d as renderHiddenInput,e as getAriaLabel}from"./helpers-be245865.js";import{p as printIonWarning}from"./index-9b0d46f4.js";import{i as isRTL}from"./dir-babeabeb.js";import{c as createColorClasses,h as hostContext}from"./theme-01f3f29c.js";import{b as getIonMode}from"./ionic-global-c976d684.js";function getDecimalPlaces(e){if(e%1===0)return 0;return e.toString().split(".")[1].length}function roundToMaxDecimalPlaces(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}var n=Math.max.apply(Math,t.map((function(e){return getDecimalPlaces(e)})));return Number(e.toFixed(n))}var rangeIosCss=":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}@supports (inset-inline-start: 0){.range-knob-handle{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-knob-handle{left:0}:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}[dir=rtl] .range-knob-handle{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset;right:unset;right: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)}@supports (inset-inline-start: 0){.range-bar-container{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-bar-container{left:0}:host-context([dir=rtl]) .range-bar-container{left:unset;right:unset;right:0}[dir=rtl] .range-bar-container{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset;right:unset;right: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}@supports (inset-inline-start: 0){.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}}@supports not (inset-inline-start: 0){.range-knob{left:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset;right:unset;right: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, #e6e6e6);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:2px;--height:42px}:host(.legacy-range){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:8px}: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, #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}";var IonRangeIosStyle0=rangeIosCss;var rangeMdCss=':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}@supports (inset-inline-start: 0){.range-knob-handle{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-knob-handle{left:0}:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}[dir=rtl] .range-knob-handle{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset;right:unset;right: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)}@supports (inset-inline-start: 0){.range-bar-container{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-bar-container{left:0}:host-context([dir=rtl]) .range-bar-container{left:unset;right:unset;right:0}[dir=rtl] .range-bar-container{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset;right:unset;right: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}@supports (inset-inline-start: 0){.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}}@supports not (inset-inline-start: 0){.range-knob{left:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset;right:unset;right: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, 56, 128, 255), 0.26);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:0;--height:42px;--pin-background:var(--ion-color-primary, #3880ff);--pin-color:var(--ion-color-primary-contrast, #fff)}:host(.legacy-range) ::slotted([slot=label]){font-size:initial}:host(:not(.legacy-range)) ::slotted(:not(ion-icon)[slot=start]),:host(:not(.legacy-range)) ::slotted(:not(ion-icon)[slot=end]),:host(:not(.legacy-range)) .native-wrapper{font-size:0.75rem}:host(.legacy-range){-webkit-padding-start:14px;padding-inline-start:14px;-webkit-padding-end:14px;padding-inline-end:14px;padding-top:8px;padding-bottom:8px;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}@supports (inset-inline-start: 0){.range-knob::before{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-knob::before{left:0}:host-context([dir=rtl]) .range-knob::before{left:unset;right:unset;right:0}[dir=rtl] .range-knob::before{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-knob::before:dir(rtl){left:unset;right:unset;right: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}@supports (inset-inline-start: 0){.range-pin::before{inset-inline-start:50%}}@supports not (inset-inline-start: 0){.range-pin::before{left:50%}:host-context([dir=rtl]) .range-pin::before{left:unset;right:unset;right:50%}[dir=rtl] .range-pin::before{left:unset;right:unset;right:50%}@supports selector(:dir(rtl)){.range-pin::before:dir(rtl){left:unset;right:unset;right: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, #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, #bfbfbf)}:host(.range-disabled) .label-text-wrapper,:host(.range-disabled) ::slotted([slot=start]),:host(.range-disabled) ::slotted([slot=end]){opacity:0.38}';var IonRangeMdStyle0=rangeMdCss;var Range=function(){function e(e){var t=this;registerInstance(this,e);this.ionChange=createEvent(this,"ionChange",7);this.ionInput=createEvent(this,"ionInput",7);this.ionStyle=createEvent(this,"ionStyle",7);this.ionFocus=createEvent(this,"ionFocus",7);this.ionBlur=createEvent(this,"ionBlur",7);this.ionKnobMoveStart=createEvent(this,"ionKnobMoveStart",7);this.ionKnobMoveEnd=createEvent(this,"ionKnobMoveEnd",7);this.rangeId="ion-r-".concat(rangeIds++);this.didLoad=false;this.noUpdate=false;this.hasFocus=false;this.inheritedAttributes={};this.contentEl=null;this.initialContentScrollY=true;this.hasLoggedDeprecationWarning=false;this.clampBounds=function(e){return clamp(t.min,e,t.max)};this.ensureValueInBounds=function(e){if(t.dualKnobs){return{lower:t.clampBounds(e.lower),upper:t.clampBounds(e.upper)}}else{return t.clampBounds(e)}};this.setupGesture=function(){return __awaiter(t,void 0,void 0,(function(){var e,t;var r=this;return __generator(this,(function(n){switch(n.label){case 0:e=this.rangeSlider;if(!e)return[3,2];t=this;return[4,import("./index-2cf77112.js")];case 1:t.gesture=n.sent().createGesture({el:e,gestureName:"range",gesturePriority:100,threshold:0,onStart:function(e){return r.onStart(e)},onMove:function(e){return r.onMove(e)},onEnd:function(e){return r.onEnd(e)}});this.gesture.enable(!this.disabled);n.label=2;case 2:return[2]}}))}))};this.handleKeyboard=function(e,r){var n=t.ensureValueInBounds;var a=t.step;a=a>0?a:1;a=a/(t.max-t.min);if(!r){a*=-1}if(e==="A"){t.ratioA=clamp(0,t.ratioA+a,1)}else{t.ratioB=clamp(0,t.ratioB+a,1)}t.ionKnobMoveStart.emit({value:n(t.value)});t.updateValue();t.emitValueChange();t.ionKnobMoveEnd.emit({value:n(t.value)})};this.onBlur=function(){if(t.hasFocus){t.hasFocus=false;t.ionBlur.emit();t.emitStyle()}};this.onFocus=function(){if(!t.hasFocus){t.hasFocus=true;t.ionFocus.emit();t.emitStyle()}};this.ratioA=0;this.ratioB=0;this.pressedKnob=undefined;this.color=undefined;this.debounce=undefined;this.name=this.rangeId;this.label=undefined;this.dualKnobs=false;this.min=0;this.max=100;this.pin=false;this.pinFormatter=function(e){return Math.round(e)};this.snaps=false;this.step=1;this.ticks=true;this.activeBarStart=undefined;this.disabled=false;this.value=0;this.labelPlacement="start";this.legacy=undefined}e.prototype.debounceChanged=function(){var e=this,t=e.ionInput,r=e.debounce,n=e.originalIonInput;this.ionInput=r===undefined?n!==null&&n!==void 0?n:t:debounceEvent(t,r)};e.prototype.minChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.maxChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.activeBarStartChanged=function(){var e=this.activeBarStart;if(e!==undefined){if(e>this.max){printIonWarning("Range: The value of activeBarStart (".concat(e,") is greater than the max (").concat(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}else if(e<this.min){printIonWarning("Range: The value of activeBarStart (".concat(e,") is less than the min (").concat(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}}};e.prototype.disabledChanged=function(){if(this.gesture){this.gesture.enable(!this.disabled)}this.emitStyle()};e.prototype.valueChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.componentWillLoad=function(){if(this.el.hasAttribute("id")){this.rangeId=this.el.getAttribute("id")}this.inheritedAttributes=inheritAriaAttributes(this.el)};e.prototype.componentDidLoad=function(){this.originalIonInput=this.ionInput;this.setupGesture();this.updateRatio();this.didLoad=true};e.prototype.connectedCallback=function(){var e=this.el;this.legacyFormController=createLegacyFormController(e);this.updateRatio();this.debounceChanged();this.disabledChanged();this.activeBarStartChanged();if(this.didLoad){this.setupGesture()}this.contentEl=findClosestIonContent(this.el)};e.prototype.disconnectedCallback=function(){if(this.gesture){this.gesture.destroy();this.gesture=undefined}};e.prototype.getValue=function(){var e;var t=(e=this.value)!==null&&e!==void 0?e:0;if(this.dualKnobs){if(typeof t==="object"){return t}return{lower:0,upper:t}}else{if(typeof t==="object"){return t.upper}return t}};e.prototype.emitStyle=function(){if(this.legacyFormController.hasLegacyControl()){this.ionStyle.emit({interactive:true,"interactive-disabled":this.disabled,legacy:!!this.legacy})}};e.prototype.emitValueChange=function(){this.value=this.ensureValueInBounds(this.value);this.ionChange.emit({value:this.value})};e.prototype.onStart=function(e){var t=this.contentEl;if(t){this.initialContentScrollY=disableContentScrollY(t)}var r=this.rect=this.rangeSlider.getBoundingClientRect();var n=e.currentX;var a=clamp(0,(n-r.left)/r.width,1);if(isRTL(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);this.update(n);this.ionKnobMoveStart.emit({value:this.ensureValueInBounds(this.value)})};e.prototype.onMove=function(e){this.update(e.currentX)};e.prototype.onEnd=function(e){var t=this,r=t.contentEl,n=t.initialContentScrollY;if(r){resetContentScrollY(r,n)}this.update(e.currentX);this.pressedKnob=undefined;this.emitValueChange();this.ionKnobMoveEnd.emit({value:this.ensureValueInBounds(this.value)})};e.prototype.update=function(e){var t=this.rect;var r=clamp(0,(e-t.left)/t.width,1);if(isRTL(this.el)){r=1-r}if(this.snaps){r=valueToRatio(ratioToValue(r,this.min,this.max,this.step),this.min,this.max)}if(this.pressedKnob==="A"){this.ratioA=r}else{this.ratioB=r}this.updateValue()};Object.defineProperty(e.prototype,"valA",{get:function(){return ratioToValue(this.ratioA,this.min,this.max,this.step)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"valB",{get:function(){return ratioToValue(this.ratioB,this.min,this.max,this.step)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ratioLower",{get:function(){if(this.dualKnobs){return Math.min(this.ratioA,this.ratioB)}var e=this.activeBarStart;if(e==null){return 0}return valueToRatio(e,this.min,this.max)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ratioUpper",{get:function(){if(this.dualKnobs){return Math.max(this.ratioA,this.ratioB)}return this.ratioA},enumerable:false,configurable:true});e.prototype.updateRatio=function(){var e=this.getValue();var t=this,r=t.min,n=t.max;if(this.dualKnobs){this.ratioA=valueToRatio(e.lower,r,n);this.ratioB=valueToRatio(e.upper,r,n)}else{this.ratioA=valueToRatio(e,r,n)}};e.prototype.updateValue=function(){this.noUpdate=true;var e=this,t=e.valA,r=e.valB;this.value=!this.dualKnobs?t:{lower:Math.min(t,r),upper:Math.max(t,r)};this.ionInput.emit({value:this.value});this.noUpdate=false};e.prototype.setFocus=function(e){if(this.el.shadowRoot){var t=this.el.shadowRoot.querySelector(e==="A"?".range-knob-a":".range-knob-b");if(t){t.focus()}}};e.prototype.renderLegacyRange=function(){var e;if(!this.hasLoggedDeprecationWarning){printIonWarning('ion-range now requires providing a label with either the label slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.\n\nExample: <ion-range><div slot="label">Volume</div></ion-range>\nExample with aria-label: <ion-range aria-label="Volume"></ion-range>\n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.',this.el);if(this.legacy){printIonWarning('ion-range is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\n\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new range syntax.',this.el)}this.hasLoggedDeprecationWarning=true}var t=this,r=t.el,n=t.pressedKnob,a=t.disabled,i=t.pin,o=t.rangeId;var s=getIonMode(this);renderHiddenInput(true,r,this.name,JSON.stringify(this.getValue()),a);return h(Host,{onFocusin:this.onFocus,onFocusout:this.onBlur,id:o,class:createColorClasses(this.color,(e={},e[s]=true,e["in-item"]=hostContext("ion-item",r),e["range-disabled"]=a,e["range-pressed"]=n!==undefined,e["range-has-pin"]=i,e["legacy-range"]=true,e))},h("slot",{name:"start"}),this.renderRangeSlider(),h("slot",{name:"end"}))};Object.defineProperty(e.prototype,"hasStartSlotContent",{get:function(){return this.el.querySelector('[slot="start"]')!==null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hasEndSlotContent",{get:function(){return this.el.querySelector('[slot="end"]')!==null},enumerable:false,configurable:true});e.prototype.renderRange=function(){var e;var t=this,r=t.disabled,n=t.el,a=t.hasLabel,i=t.rangeId,o=t.pin,s=t.pressedKnob,l=t.labelPlacement,d=t.label;var g=hostContext("ion-item",n);var b=a&&(l==="start"||l==="fixed")||this.hasStartSlotContent;var c=g&&!b;var p=a&&l==="end"||this.hasEndSlotContent;var u=g&&!p;var f=getIonMode(this);renderHiddenInput(true,n,this.name,JSON.stringify(this.getValue()),r);return h(Host,{onFocusin:this.onFocus,onFocusout:this.onBlur,id:i,class:createColorClasses(this.color,(e={},e[f]=true,e["in-item"]=g,e["range-disabled"]=r,e["range-pressed"]=s!==undefined,e["range-has-pin"]=o,e["range-label-placement-".concat(l)]=true,e["range-item-start-adjustment"]=c,e["range-item-end-adjustment"]=u,e))},h("label",{class:"range-wrapper",id:"range-label"},h("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":!a},part:"label"},d!==undefined?h("div",{class:"label-text"},d):h("slot",{name:"label"})),h("div",{class:"native-wrapper"},h("slot",{name:"start"}),this.renderRangeSlider(),h("slot",{name:"end"}))))};Object.defineProperty(e.prototype,"hasLabel",{get:function(){return this.label!==undefined||this.el.querySelector('[slot="label"]')!==null},enumerable:false,configurable:true});e.prototype.renderRangeSlider=function(){var e;var t=this;var r;var n=this,a=n.min,i=n.max,o=n.step,s=n.el,l=n.handleKeyboard,d=n.pressedKnob,g=n.disabled,b=n.pin,c=n.ratioLower,p=n.ratioUpper,u=n.inheritedAttributes,f=n.rangeId,m=n.pinFormatter;var k=getAriaLabel(s,f).labelText;if(k===undefined||k===null){k=u["aria-label"]}var x="".concat(c*100,"%");var v="".concat(100-p*100,"%");var w=isRTL(this.el);var y=w?"right":"left";var z=w?"left":"right";var C=function(e){var t;return t={},t[y]=e[y],t};if(this.dualKnobs===false){if(this.valA<((r=this.activeBarStart)!==null&&r!==void 0?r:this.min)){x="".concat(p*100,"%");v="".concat(100-c*100,"%")}else{x="".concat(c*100,"%");v="".concat(100-p*100,"%")}}var j=(e={},e[y]=x,e[z]=v,e);var I=[];if(this.snaps&&this.ticks){for(var M=a;M<=i;M+=o){var T=valueToRatio(M,a,i);var R=Math.min(c,p);var S=Math.max(c,p);var A={ratio:T,active:T>=R&&T<=S};A[y]="".concat(T*100,"%");I.push(A)}}var E;if(!this.legacyFormController.hasLegacyControl()&&this.hasLabel){E="range-label"}return h("div",{class:"range-slider",ref:function(e){return t.rangeSlider=e}},I.map((function(e){return h("div",{style:C(e),role:"presentation",class:{"range-tick":true,"range-tick-active":e.active},part:e.active?"tick-active":"tick"})})),h("div",{class:"range-bar-container"},h("div",{class:"range-bar",role:"presentation",part:"bar"}),h("div",{class:{"range-bar":true,"range-bar-active":true,"has-ticks":I.length>0},role:"presentation",style:j,part:"bar-active"})),renderKnob(w,{knob:"A",pressed:d==="A",value:this.valA,ratio:this.ratioA,pin:b,pinFormatter:m,disabled:g,handleKeyboard:l,min:a,max:i,labelText:k,labelledBy:E}),this.dualKnobs&&renderKnob(w,{knob:"B",pressed:d==="B",value:this.valB,ratio:this.ratioB,pin:b,pinFormatter:m,disabled:g,handleKeyboard:l,min:a,max:i,labelText:k,labelledBy:E}))};e.prototype.render=function(){var e=this.legacyFormController;return e.hasLegacyControl()?this.renderLegacyRange():this.renderRange()};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{debounce:["debounceChanged"],min:["minChanged"],max:["maxChanged"],activeBarStart:["activeBarStartChanged"],disabled:["disabledChanged"],value:["valueChanged"]}},enumerable:false,configurable:true});return e}();var renderKnob=function(e,t){var r=t.knob,n=t.value,a=t.ratio,i=t.min,o=t.max,s=t.disabled,l=t.pressed,d=t.pin,g=t.handleKeyboard,b=t.labelText,c=t.labelledBy,p=t.pinFormatter;var u=e?"right":"left";var f=function(){var e={};e[u]="".concat(a*100,"%");return e};return h("div",{onKeyDown:function(e){var t=e.key;if(t==="ArrowLeft"||t==="ArrowDown"){g(r,false);e.preventDefault();e.stopPropagation()}else if(t==="ArrowRight"||t==="ArrowUp"){g(r,true);e.preventDefault();e.stopPropagation()}},class:{"range-knob-handle":true,"range-knob-a":r==="A","range-knob-b":r==="B","range-knob-pressed":l,"range-knob-min":n===i,"range-knob-max":n===o,"ion-activatable":true,"ion-focusable":true},style:f(),role:"slider",tabindex:s?-1:0,"aria-label":c===undefined?b:null,"aria-labelledby":c!==undefined?c:null,"aria-valuemin":i,"aria-valuemax":o,"aria-disabled":s?"true":null,"aria-valuenow":n},d&&h("div",{class:"range-pin",role:"presentation",part:"pin"},p(n)),h("div",{class:"range-knob",role:"presentation",part:"knob"}))};var ratioToValue=function(e,t,r,n){var a=(r-t)*e;if(n>0){a=Math.round(a/n)*n+t}var i=clamp(t,a,r);return roundToMaxDecimalPlaces(i,t,r,n)};var valueToRatio=function(e,t,r){return clamp(0,(e-t)/(r-t),1)};var rangeIds=0;Range.style={ios:IonRangeIosStyle0,md:IonRangeMdStyle0};export{Range as ion_range};
|
|
4
|
+
*/import{r as registerInstance,d as createEvent,h,H as Host,f as getElement}from"./index-9b6d6df3.js";import{f as findClosestIonContent,d as disableContentScrollY,r as resetContentScrollY}from"./index-f3946ac1.js";import{c as createLegacyFormController}from"./form-controller-21dd62b1.js";import{l as clamp,j as debounceEvent,i as inheritAriaAttributes,d as renderHiddenInput,e as getAriaLabel}from"./helpers-be245865.js";import{p as printIonWarning}from"./index-9b0d46f4.js";import{i as isRTL}from"./dir-babeabeb.js";import{c as createColorClasses,h as hostContext}from"./theme-01f3f29c.js";import{b as getIonMode}from"./ionic-global-c976d684.js";function getDecimalPlaces(e){if(e%1===0)return 0;return e.toString().split(".")[1].length}function roundToMaxDecimalPlaces(e){var t=[];for(var r=1;r<arguments.length;r++){t[r-1]=arguments[r]}var n=Math.max.apply(Math,t.map((function(e){return getDecimalPlaces(e)})));return Number(e.toFixed(n))}var rangeIosCss=":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}@supports (inset-inline-start: 0){.range-knob-handle{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-knob-handle{left:0}:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}[dir=rtl] .range-knob-handle{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset;right:unset;right: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)}@supports (inset-inline-start: 0){.range-bar-container{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-bar-container{left:0}:host-context([dir=rtl]) .range-bar-container{left:unset;right:unset;right:0}[dir=rtl] .range-bar-container{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset;right:unset;right: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}@supports (inset-inline-start: 0){.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}}@supports not (inset-inline-start: 0){.range-knob{left:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset;right:unset;right: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, #e6e6e6);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:2px;--height:42px}:host(.legacy-range){-webkit-padding-start:16px;padding-inline-start:16px;-webkit-padding-end:16px;padding-inline-end:16px;padding-top:8px;padding-bottom:8px}: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, #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}";var IonRangeIosStyle0=rangeIosCss;var rangeMdCss=':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}@supports (inset-inline-start: 0){.range-knob-handle{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-knob-handle{left:0}:host-context([dir=rtl]) .range-knob-handle{left:unset;right:unset;right:0}[dir=rtl] .range-knob-handle{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-knob-handle:dir(rtl){left:unset;right:unset;right: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)}@supports (inset-inline-start: 0){.range-bar-container{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-bar-container{left:0}:host-context([dir=rtl]) .range-bar-container{left:unset;right:unset;right:0}[dir=rtl] .range-bar-container{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-bar-container:dir(rtl){left:unset;right:unset;right: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}@supports (inset-inline-start: 0){.range-knob{inset-inline-start:calc(50% - var(--knob-size) / 2)}}@supports not (inset-inline-start: 0){.range-knob{left:calc(50% - var(--knob-size) / 2)}:host-context([dir=rtl]) .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}[dir=rtl] .range-knob{left:unset;right:unset;right:calc(50% - var(--knob-size) / 2)}@supports selector(:dir(rtl)){.range-knob:dir(rtl){left:unset;right:unset;right: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, 56, 128, 255), 0.26);--bar-background-active:var(--ion-color-primary, #3880ff);--bar-border-radius:0;--height:42px;--pin-background:var(--ion-color-primary, #3880ff);--pin-color:var(--ion-color-primary-contrast, #fff)}:host(.legacy-range) ::slotted([slot=label]){font-size:initial}:host(:not(.legacy-range)) ::slotted(:not(ion-icon)[slot=start]),:host(:not(.legacy-range)) ::slotted(:not(ion-icon)[slot=end]),:host(:not(.legacy-range)) .native-wrapper{font-size:0.75rem}:host(.legacy-range){-webkit-padding-start:14px;padding-inline-start:14px;-webkit-padding-end:14px;padding-inline-end:14px;padding-top:8px;padding-bottom:8px;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}@supports (inset-inline-start: 0){.range-knob::before{inset-inline-start:0}}@supports not (inset-inline-start: 0){.range-knob::before{left:0}:host-context([dir=rtl]) .range-knob::before{left:unset;right:unset;right:0}[dir=rtl] .range-knob::before{left:unset;right:unset;right:0}@supports selector(:dir(rtl)){.range-knob::before:dir(rtl){left:unset;right:unset;right: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}@supports (inset-inline-start: 0){.range-pin::before{inset-inline-start:50%}}@supports not (inset-inline-start: 0){.range-pin::before{left:50%}:host-context([dir=rtl]) .range-pin::before{left:unset;right:unset;right:50%}[dir=rtl] .range-pin::before{left:unset;right:unset;right:50%}@supports selector(:dir(rtl)){.range-pin::before:dir(rtl){left:unset;right:unset;right: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, #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, #bfbfbf)}:host(.range-disabled) .label-text-wrapper,:host(.range-disabled) ::slotted([slot=start]),:host(.range-disabled) ::slotted([slot=end]){opacity:0.38}';var IonRangeMdStyle0=rangeMdCss;var Range=function(){function e(e){var t=this;registerInstance(this,e);this.ionChange=createEvent(this,"ionChange",7);this.ionInput=createEvent(this,"ionInput",7);this.ionStyle=createEvent(this,"ionStyle",7);this.ionFocus=createEvent(this,"ionFocus",7);this.ionBlur=createEvent(this,"ionBlur",7);this.ionKnobMoveStart=createEvent(this,"ionKnobMoveStart",7);this.ionKnobMoveEnd=createEvent(this,"ionKnobMoveEnd",7);this.rangeId="ion-r-".concat(rangeIds++);this.didLoad=false;this.noUpdate=false;this.hasFocus=false;this.inheritedAttributes={};this.contentEl=null;this.initialContentScrollY=true;this.hasLoggedDeprecationWarning=false;this.clampBounds=function(e){return clamp(t.min,e,t.max)};this.ensureValueInBounds=function(e){if(t.dualKnobs){return{lower:t.clampBounds(e.lower),upper:t.clampBounds(e.upper)}}else{return t.clampBounds(e)}};this.setupGesture=function(){return __awaiter(t,void 0,void 0,(function(){var e,t;var r=this;return __generator(this,(function(n){switch(n.label){case 0:e=this.rangeSlider;if(!e)return[3,2];t=this;return[4,import("./index-2cf77112.js")];case 1:t.gesture=n.sent().createGesture({el:e,gestureName:"range",gesturePriority:100,threshold:10,onStart:function(){return r.onStart()},onMove:function(e){return r.onMove(e)},onEnd:function(e){return r.onEnd(e)}});this.gesture.enable(!this.disabled);n.label=2;case 2:return[2]}}))}))};this.handleKeyboard=function(e,r){var n=t.ensureValueInBounds;var a=t.step;a=a>0?a:1;a=a/(t.max-t.min);if(!r){a*=-1}if(e==="A"){t.ratioA=clamp(0,t.ratioA+a,1)}else{t.ratioB=clamp(0,t.ratioB+a,1)}t.ionKnobMoveStart.emit({value:n(t.value)});t.updateValue();t.emitValueChange();t.ionKnobMoveEnd.emit({value:n(t.value)})};this.onBlur=function(){if(t.hasFocus){t.hasFocus=false;t.ionBlur.emit();t.emitStyle()}};this.onFocus=function(){if(!t.hasFocus){t.hasFocus=true;t.ionFocus.emit();t.emitStyle()}};this.ratioA=0;this.ratioB=0;this.pressedKnob=undefined;this.color=undefined;this.debounce=undefined;this.name=this.rangeId;this.label=undefined;this.dualKnobs=false;this.min=0;this.max=100;this.pin=false;this.pinFormatter=function(e){return Math.round(e)};this.snaps=false;this.step=1;this.ticks=true;this.activeBarStart=undefined;this.disabled=false;this.value=0;this.labelPlacement="start";this.legacy=undefined}e.prototype.debounceChanged=function(){var e=this,t=e.ionInput,r=e.debounce,n=e.originalIonInput;this.ionInput=r===undefined?n!==null&&n!==void 0?n:t:debounceEvent(t,r)};e.prototype.minChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.maxChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.activeBarStartChanged=function(){var e=this.activeBarStart;if(e!==undefined){if(e>this.max){printIonWarning("Range: The value of activeBarStart (".concat(e,") is greater than the max (").concat(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}else if(e<this.min){printIonWarning("Range: The value of activeBarStart (".concat(e,") is less than the min (").concat(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}}};e.prototype.disabledChanged=function(){if(this.gesture){this.gesture.enable(!this.disabled)}this.emitStyle()};e.prototype.valueChanged=function(){if(!this.noUpdate){this.updateRatio()}};e.prototype.componentWillLoad=function(){if(this.el.hasAttribute("id")){this.rangeId=this.el.getAttribute("id")}this.inheritedAttributes=inheritAriaAttributes(this.el)};e.prototype.componentDidLoad=function(){this.originalIonInput=this.ionInput;this.setupGesture();this.updateRatio();this.didLoad=true};e.prototype.connectedCallback=function(){var e=this.el;this.legacyFormController=createLegacyFormController(e);this.updateRatio();this.debounceChanged();this.disabledChanged();this.activeBarStartChanged();if(this.didLoad){this.setupGesture()}this.contentEl=findClosestIonContent(this.el)};e.prototype.disconnectedCallback=function(){if(this.gesture){this.gesture.destroy();this.gesture=undefined}};e.prototype.getValue=function(){var e;var t=(e=this.value)!==null&&e!==void 0?e:0;if(this.dualKnobs){if(typeof t==="object"){return t}return{lower:0,upper:t}}else{if(typeof t==="object"){return t.upper}return t}};e.prototype.emitStyle=function(){if(this.legacyFormController.hasLegacyControl()){this.ionStyle.emit({interactive:true,"interactive-disabled":this.disabled,legacy:!!this.legacy})}};e.prototype.emitValueChange=function(){this.value=this.ensureValueInBounds(this.value);this.ionChange.emit({value:this.value})};e.prototype.onStart=function(){this.ionKnobMoveStart.emit({value:this.ensureValueInBounds(this.value)})};e.prototype.onMove=function(e){var t=this,r=t.contentEl,n=t.pressedKnob;var a=e.currentX;if(r&&this.initialContentScrollY===undefined){this.initialContentScrollY=disableContentScrollY(r)}if(n===undefined){this.setPressedKnob(a)}this.update(a)};e.prototype.onEnd=function(e){var t=this,r=t.contentEl,n=t.initialContentScrollY;var a=e.currentX||e.clientX;if(this.pressedKnob===undefined){this.setPressedKnob(a)}if(r&&n!==undefined){resetContentScrollY(r,n)}this.update(a);this.pressedKnob=undefined;this.emitValueChange();this.ionKnobMoveEnd.emit({value:this.ensureValueInBounds(this.value)})};e.prototype.update=function(e){var t=this.rect;var r=clamp(0,(e-t.left)/t.width,1);if(isRTL(this.el)){r=1-r}if(this.snaps){r=valueToRatio(ratioToValue(r,this.min,this.max,this.step),this.min,this.max)}if(this.pressedKnob==="A"){this.ratioA=r}else{this.ratioB=r}this.updateValue()};e.prototype.setPressedKnob=function(e){var t=this.rect=this.rangeSlider.getBoundingClientRect();var r=clamp(0,(e-t.left)/t.width,1);if(isRTL(this.el)){r=1-r}this.pressedKnob=!this.dualKnobs||Math.abs(this.ratioA-r)<Math.abs(this.ratioB-r)?"A":"B";this.setFocus(this.pressedKnob)};Object.defineProperty(e.prototype,"valA",{get:function(){return ratioToValue(this.ratioA,this.min,this.max,this.step)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"valB",{get:function(){return ratioToValue(this.ratioB,this.min,this.max,this.step)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ratioLower",{get:function(){if(this.dualKnobs){return Math.min(this.ratioA,this.ratioB)}var e=this.activeBarStart;if(e==null){return 0}return valueToRatio(e,this.min,this.max)},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"ratioUpper",{get:function(){if(this.dualKnobs){return Math.max(this.ratioA,this.ratioB)}return this.ratioA},enumerable:false,configurable:true});e.prototype.updateRatio=function(){var e=this.getValue();var t=this,r=t.min,n=t.max;if(this.dualKnobs){this.ratioA=valueToRatio(e.lower,r,n);this.ratioB=valueToRatio(e.upper,r,n)}else{this.ratioA=valueToRatio(e,r,n)}};e.prototype.updateValue=function(){this.noUpdate=true;var e=this,t=e.valA,r=e.valB;this.value=!this.dualKnobs?t:{lower:Math.min(t,r),upper:Math.max(t,r)};this.ionInput.emit({value:this.value});this.noUpdate=false};e.prototype.setFocus=function(e){if(this.el.shadowRoot){var t=this.el.shadowRoot.querySelector(e==="A"?".range-knob-a":".range-knob-b");if(t){t.focus()}}};e.prototype.renderLegacyRange=function(){var e;if(!this.hasLoggedDeprecationWarning){printIonWarning('ion-range now requires providing a label with either the label slot or the "aria-label" attribute. To migrate, remove any usage of "ion-label" and pass the label text to either the component or the "aria-label" attribute.\n\nExample: <ion-range><div slot="label">Volume</div></ion-range>\nExample with aria-label: <ion-range aria-label="Volume"></ion-range>\n\nDevelopers can use the "legacy" property to continue using the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.',this.el);if(this.legacy){printIonWarning('ion-range is being used with the "legacy" property enabled which will forcibly enable the legacy form markup. This property will be removed in an upcoming major release of Ionic where this form control will use the modern form markup.\n\nDevelopers can dismiss this warning by removing their usage of the "legacy" property and using the new range syntax.',this.el)}this.hasLoggedDeprecationWarning=true}var t=this,r=t.el,n=t.pressedKnob,a=t.disabled,i=t.pin,o=t.rangeId;var s=getIonMode(this);renderHiddenInput(true,r,this.name,JSON.stringify(this.getValue()),a);return h(Host,{onFocusin:this.onFocus,onFocusout:this.onBlur,id:o,class:createColorClasses(this.color,(e={},e[s]=true,e["in-item"]=hostContext("ion-item",r),e["range-disabled"]=a,e["range-pressed"]=n!==undefined,e["range-has-pin"]=i,e["legacy-range"]=true,e))},h("slot",{name:"start"}),this.renderRangeSlider(),h("slot",{name:"end"}))};Object.defineProperty(e.prototype,"hasStartSlotContent",{get:function(){return this.el.querySelector('[slot="start"]')!==null},enumerable:false,configurable:true});Object.defineProperty(e.prototype,"hasEndSlotContent",{get:function(){return this.el.querySelector('[slot="end"]')!==null},enumerable:false,configurable:true});e.prototype.renderRange=function(){var e;var t=this,r=t.disabled,n=t.el,a=t.hasLabel,i=t.rangeId,o=t.pin,s=t.pressedKnob,l=t.labelPlacement,d=t.label;var g=hostContext("ion-item",n);var b=a&&(l==="start"||l==="fixed")||this.hasStartSlotContent;var c=g&&!b;var p=a&&l==="end"||this.hasEndSlotContent;var u=g&&!p;var f=getIonMode(this);renderHiddenInput(true,n,this.name,JSON.stringify(this.getValue()),r);return h(Host,{onFocusin:this.onFocus,onFocusout:this.onBlur,id:i,class:createColorClasses(this.color,(e={},e[f]=true,e["in-item"]=g,e["range-disabled"]=r,e["range-pressed"]=s!==undefined,e["range-has-pin"]=o,e["range-label-placement-".concat(l)]=true,e["range-item-start-adjustment"]=c,e["range-item-end-adjustment"]=u,e))},h("label",{class:"range-wrapper",id:"range-label"},h("div",{class:{"label-text-wrapper":true,"label-text-wrapper-hidden":!a},part:"label"},d!==undefined?h("div",{class:"label-text"},d):h("slot",{name:"label"})),h("div",{class:"native-wrapper"},h("slot",{name:"start"}),this.renderRangeSlider(),h("slot",{name:"end"}))))};Object.defineProperty(e.prototype,"hasLabel",{get:function(){return this.label!==undefined||this.el.querySelector('[slot="label"]')!==null},enumerable:false,configurable:true});e.prototype.renderRangeSlider=function(){var e;var t=this;var r;var n=this,a=n.min,i=n.max,o=n.step,s=n.el,l=n.handleKeyboard,d=n.pressedKnob,g=n.disabled,b=n.pin,c=n.ratioLower,p=n.ratioUpper,u=n.inheritedAttributes,f=n.rangeId,m=n.pinFormatter;var k=getAriaLabel(s,f).labelText;if(k===undefined||k===null){k=u["aria-label"]}var v="".concat(c*100,"%");var x="".concat(100-p*100,"%");var w=isRTL(this.el);var y=w?"right":"left";var z=w?"left":"right";var C=function(e){var t;return t={},t[y]=e[y],t};if(this.dualKnobs===false){if(this.valA<((r=this.activeBarStart)!==null&&r!==void 0?r:this.min)){v="".concat(p*100,"%");x="".concat(100-c*100,"%")}else{v="".concat(c*100,"%");x="".concat(100-p*100,"%")}}var j=(e={},e[y]=v,e[z]=x,e);var I=[];if(this.snaps&&this.ticks){for(var M=a;M<=i;M+=o){var T=valueToRatio(M,a,i);var R=Math.min(c,p);var S=Math.max(c,p);var A={ratio:T,active:T>=R&&T<=S};A[y]="".concat(T*100,"%");I.push(A)}}var E;if(!this.legacyFormController.hasLegacyControl()&&this.hasLabel){E="range-label"}return h("div",{class:"range-slider",ref:function(e){return t.rangeSlider=e},onPointerUp:function(e){if(t.pressedKnob===undefined){t.onStart();t.onEnd(e)}}},I.map((function(e){return h("div",{style:C(e),role:"presentation",class:{"range-tick":true,"range-tick-active":e.active},part:e.active?"tick-active":"tick"})})),h("div",{class:"range-bar-container"},h("div",{class:"range-bar",role:"presentation",part:"bar"}),h("div",{class:{"range-bar":true,"range-bar-active":true,"has-ticks":I.length>0},role:"presentation",style:j,part:"bar-active"})),renderKnob(w,{knob:"A",pressed:d==="A",value:this.valA,ratio:this.ratioA,pin:b,pinFormatter:m,disabled:g,handleKeyboard:l,min:a,max:i,labelText:k,labelledBy:E}),this.dualKnobs&&renderKnob(w,{knob:"B",pressed:d==="B",value:this.valB,ratio:this.ratioB,pin:b,pinFormatter:m,disabled:g,handleKeyboard:l,min:a,max:i,labelText:k,labelledBy:E}))};e.prototype.render=function(){var e=this.legacyFormController;return e.hasLegacyControl()?this.renderLegacyRange():this.renderRange()};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});Object.defineProperty(e,"watchers",{get:function(){return{debounce:["debounceChanged"],min:["minChanged"],max:["maxChanged"],activeBarStart:["activeBarStartChanged"],disabled:["disabledChanged"],value:["valueChanged"]}},enumerable:false,configurable:true});return e}();var renderKnob=function(e,t){var r=t.knob,n=t.value,a=t.ratio,i=t.min,o=t.max,s=t.disabled,l=t.pressed,d=t.pin,g=t.handleKeyboard,b=t.labelText,c=t.labelledBy,p=t.pinFormatter;var u=e?"right":"left";var f=function(){var e={};e[u]="".concat(a*100,"%");return e};return h("div",{onKeyDown:function(e){var t=e.key;if(t==="ArrowLeft"||t==="ArrowDown"){g(r,false);e.preventDefault();e.stopPropagation()}else if(t==="ArrowRight"||t==="ArrowUp"){g(r,true);e.preventDefault();e.stopPropagation()}},class:{"range-knob-handle":true,"range-knob-a":r==="A","range-knob-b":r==="B","range-knob-pressed":l,"range-knob-min":n===i,"range-knob-max":n===o,"ion-activatable":true,"ion-focusable":true},style:f(),role:"slider",tabindex:s?-1:0,"aria-label":c===undefined?b:null,"aria-labelledby":c!==undefined?c:null,"aria-valuemin":i,"aria-valuemax":o,"aria-disabled":s?"true":null,"aria-valuenow":n},d&&h("div",{class:"range-pin",role:"presentation",part:"pin"},p(n)),h("div",{class:"range-knob",role:"presentation",part:"knob"}))};var ratioToValue=function(e,t,r,n){var a=(r-t)*e;if(n>0){a=Math.round(a/n)*n+t}var i=clamp(t,a,r);return roundToMaxDecimalPlaces(i,t,r,n)};var valueToRatio=function(e,t,r){return clamp(0,(e-t)/(r-t),1)};var rangeIds=0;Range.style={ios:IonRangeIosStyle0,md:IonRangeMdStyle0};export{Range as ion_range};
|