@esri/calcite-components 1.0.0-next.422 → 1.0.0-next.423
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/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/p-2692ac43.entry.js +5 -0
- package/dist/calcite/p-58392046.system.entry.js +5 -0
- package/dist/calcite/p-62afcb36.system.js +1 -1
- package/dist/cjs/calcite-graph_2.cjs.entry.js +67 -38
- package/dist/collection/components/slider/slider.js +76 -41
- package/dist/components/calcite-slider.js +67 -38
- package/dist/custom-elements/index.js +67 -38
- package/dist/esm/calcite-graph_2.entry.js +67 -38
- package/dist/esm-es5/calcite-graph_2.entry.js +1 -1
- package/dist/extras/docs-json.json +6 -3
- package/dist/types/components/slider/slider.d.ts +5 -2
- package/dist/types/components.d.ts +2 -2
- package/hydrate/index.js +67 -38
- package/package.json +2 -2
- package/dist/calcite/p-872e82a6.system.entry.js +0 -5
- package/dist/calcite/p-e22ab8fa.entry.js +0 -5
|
@@ -18478,6 +18478,9 @@ const ShellPanel = class extends HTMLElement$1 {
|
|
|
18478
18478
|
|
|
18479
18479
|
const sliderCss = "@charset \"UTF-8\";@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}.scale--s{--calcite-slider-handle-size:10px;--calcite-slider-handle-extension-height:6.5px;--calcite-slider-container-font-size:var(--calcite-font-size--3)}.scale--s .handle__label,.scale--s .tick__label{line-height:.75rem}.scale--m{--calcite-slider-handle-size:14px;--calcite-slider-handle-extension-height:8px;--calcite-slider-container-font-size:var(--calcite-font-size--2)}.scale--m .handle__label,.scale--m .tick__label{line-height:1rem}.scale--l{--calcite-slider-handle-size:16px;--calcite-slider-handle-extension-height:10.5px;--calcite-slider-container-font-size:var(--calcite-font-size--1)}.scale--l .handle__label,.scale--l .tick__label{line-height:1rem}.handle__label,.tick__label{font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-2);font-size:var(--calcite-slider-container-font-size)}:host{display:block}.container{position:relative;display:block;padding:calc(var(--calcite-slider-handle-size) * 0.5);margin:calc(var(--calcite-slider-handle-size) * 0.5) 0;--calcite-slider-full-handle-height:calc(\n var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height)\n )}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) .track__range,:host([disabled]) .tick--active{background-color:var(--calcite-ui-text-3)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}.scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-6px}.scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-8px}.scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-9px}:host([precise]:not([has-histogram])) .container .thumb--value{--calcite-slider-thumb-y-offset:calc(var(--calcite-slider-full-handle-height) * -1)}.thumb-container{position:relative;max-width:100%}.thumb{--calcite-slider-thumb-x-offset:calc(var(--calcite-slider-handle-size) * 0.5);position:absolute;margin:0px;display:-ms-flexbox;display:flex;cursor:pointer;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;border-style:none;background-color:transparent;padding:0px;font-family:inherit;outline:2px solid transparent;outline-offset:2px;-webkit-transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset));transform:translate(var(--calcite-slider-thumb-x-offset), var(--calcite-slider-thumb-y-offset))}.thumb .handle__label.static,.thumb .handle__label.transformed{position:absolute;top:0px;bottom:0px;opacity:0}.thumb .handle__label.hyphen::after{content:\"—\";display:inline-block;width:1em}.thumb .handle__label.hyphen--wrap{display:-ms-flexbox;display:flex}.thumb .handle{-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:9999px;background-color:var(--calcite-ui-foreground-1);outline-offset:0;outline-color:transparent;-webkit-transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;transition:outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out;height:var(--calcite-slider-handle-size);width:var(--calcite-slider-handle-size);-webkit-box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;box-shadow:0 0 0 2px var(--calcite-ui-text-3) inset;-webkit-transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, -webkit-box-shadow var(--calcite-animation-timing) ease;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, -webkit-box-shadow var(--calcite-animation-timing) ease;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease;transition:border var(--calcite-internal-animation-timing-medium) ease, background-color var(--calcite-internal-animation-timing-medium) ease, box-shadow var(--calcite-animation-timing) ease, -webkit-box-shadow var(--calcite-animation-timing) ease}.thumb .handle-extension{width:0.125rem;height:var(--calcite-slider-handle-extension-height);background-color:var(--calcite-ui-text-3)}.thumb:hover .handle{-webkit-box-shadow:0 0 0 3px var(--calcite-ui-brand) inset;box-shadow:0 0 0 3px var(--calcite-ui-brand) inset}.thumb:hover .handle-extension{background-color:var(--calcite-ui-brand)}.thumb:focus .handle{outline:2px solid var(--calcite-ui-brand);outline-offset:2px}.thumb:focus .handle-extension{background-color:var(--calcite-ui-brand)}.thumb.thumb--minValue{-webkit-transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset));transform:translate(calc(var(--calcite-slider-thumb-x-offset) * -1), var(--calcite-slider-thumb-y-offset))}.thumb.thumb--precise{--calcite-slider-thumb-y-offset:-2px}:host([label-handles]) .thumb{--calcite-slider-thumb-x-offset:50%}:host([label-handles]):host(:not([has-histogram])) .scale--s .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-23px}:host([label-handles]):host(:not([has-histogram])) .scale--m .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-30px}:host([label-handles]):host(:not([has-histogram])) .scale--l .thumb:not(.thumb--precise){--calcite-slider-thumb-y-offset:-32px}:host([has-histogram][label-handles]) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--minValue.thumb--precise .handle__label{margin-top:0.5em}:host(:not([has-histogram]):not([precise])) .handle__label,:host([label-handles]:not([has-histogram])) .thumb--value .handle__label{margin-bottom:0.5em}:host([label-handles][precise]):host(:not([has-histogram])) .scale--s .thumb--value{--calcite-slider-thumb-y-offset:-33px}:host([label-handles][precise]):host(:not([has-histogram])) .scale--m .thumb--value{--calcite-slider-thumb-y-offset:-44px}:host([label-handles][precise]):host(:not([has-histogram])) .scale--l .thumb--value{--calcite-slider-thumb-y-offset:-49px}.thumb:focus .handle,.thumb--active .handle{background-color:var(--calcite-ui-brand);-webkit-box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16);box-shadow:0 0 8px 0 rgba(0, 0, 0, 0.16)}.thumb:hover.thumb--precise:after,.thumb:focus.thumb--precise:after,.thumb--active.thumb--precise:after{background-color:var(--calcite-ui-brand)}.track{position:relative;height:0.125rem;border-radius:0px;background-color:var(--calcite-ui-border-2);-webkit-transition:all var(--calcite-internal-animation-timing-medium) ease-in;transition:all var(--calcite-internal-animation-timing-medium) ease-in}.track__range{position:absolute;top:0px;height:0.125rem;background-color:var(--calcite-ui-brand)}.container--range .track__range:hover{cursor:ew-resize}.container--range .track__range:after{position:absolute;width:100%;content:\"\";top:calc(var(--calcite-slider-full-handle-height) * 0.5 * -1);height:calc(var(--calcite-slider-handle-size) + var(--calcite-slider-handle-extension-height))}.tick{position:absolute;height:0.25rem;width:0.125rem;border-width:1px;border-style:solid;background-color:var(--calcite-ui-border-input);border-color:var(--calcite-ui-foreground-1);top:-2px;pointer-events:none;-webkit-margin-start:calc(-1 * 0.125rem);margin-inline-start:calc(-1 * 0.125rem)}.tick--active{background-color:var(--calcite-ui-brand)}.tick__label{pointer-events:none;margin-top:0.875rem;display:-ms-flexbox;display:flex;-ms-flex-pack:center;justify-content:center}.tick__label--min{-webkit-transition:opacity var(--calcite-animation-timing);transition:opacity var(--calcite-animation-timing)}.tick__label--max{-webkit-transition:opacity var(--calcite-internal-animation-timing-fast);transition:opacity var(--calcite-internal-animation-timing-fast)}:host([has-histogram][label-handles]) .tick__label--min,:host([has-histogram][label-handles]) .tick__label--max,:host([has-histogram][precise]) .tick__label--min,:host([has-histogram][precise]) .tick__label--max{font-weight:var(--calcite-font-weight-normal);color:var(--calcite-ui-text-3)}.graph{color:var(--calcite-ui-foreground-3);height:48px}:host([label-ticks][ticks]) .container{padding-bottom:calc(0.875rem + var(--calcite-slider-container-font-size))}:host([has-histogram]):host([precise][label-handles]) .container{padding-bottom:calc(var(--calcite-slider-full-handle-height) + 1em)}:host([has-histogram]):host([label-handles]:not([precise])) .container{padding-bottom:calc(var(--calcite-slider-handle-size) * 0.5 + 1em)}:host([has-histogram]):host([precise]:not([label-handles])) .container{padding-bottom:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container{padding-top:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([precise]:not([label-handles])) .container--range{padding-bottom:var(--calcite-slider-full-handle-height)}:host(:not([has-histogram])):host([label-handles]:not([precise])) .container{padding-top:calc(var(--calcite-slider-full-handle-height) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container{padding-top:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}:host(:not([has-histogram])):host([label-handles][precise]) .container--range{padding-bottom:calc(var(--calcite-slider-full-handle-height) + var(--calcite-slider-container-font-size) + 4px)}::slotted(input[slot=hidden-form-input]){bottom:0 !important;left:0 !important;margin:0 !important;opacity:0 !important;outline:none !important;padding:0 !important;position:absolute !important;right:0 !important;top:0 !important;-webkit-transform:none !important;transform:none !important;-webkit-appearance:none !important;z-index:-1 !important}";
|
|
18480
18480
|
|
|
18481
|
+
function isRange(value) {
|
|
18482
|
+
return Array.isArray(value);
|
|
18483
|
+
}
|
|
18481
18484
|
const Slider = class extends HTMLElement$1 {
|
|
18482
18485
|
constructor() {
|
|
18483
18486
|
super();
|
|
@@ -18520,13 +18523,12 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18520
18523
|
/** Interval to move on up/down keys */
|
|
18521
18524
|
this.step = 1;
|
|
18522
18525
|
/** Currently selected number (if single select) */
|
|
18523
|
-
this.value =
|
|
18526
|
+
this.value = 0;
|
|
18524
18527
|
/**
|
|
18525
18528
|
* Specify the scale of the slider, defaults to m
|
|
18526
18529
|
*/
|
|
18527
18530
|
this.scale = "m";
|
|
18528
18531
|
this.guid = `calcite-slider-${guid()}`;
|
|
18529
|
-
this.isRange = false;
|
|
18530
18532
|
this.activeProp = "value";
|
|
18531
18533
|
this.minMaxValueRange = null;
|
|
18532
18534
|
this.minValueDragRange = null;
|
|
@@ -18536,7 +18538,7 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18536
18538
|
event.preventDefault();
|
|
18537
18539
|
if (this.dragProp) {
|
|
18538
18540
|
const value = this.translate(event.clientX || event.pageX);
|
|
18539
|
-
if (this.
|
|
18541
|
+
if (isRange(this.value) && this.dragProp === "minMaxValue") {
|
|
18540
18542
|
if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
|
|
18541
18543
|
const newMinValue = value - this.minValueDragRange;
|
|
18542
18544
|
const newMaxValue = value + this.maxValueDragRange;
|
|
@@ -18582,12 +18584,20 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18582
18584
|
histogramWatcher(newHistogram) {
|
|
18583
18585
|
this.hasHistogram = !!newHistogram;
|
|
18584
18586
|
}
|
|
18587
|
+
valueHandler() {
|
|
18588
|
+
this.setMinMaxFromValue();
|
|
18589
|
+
}
|
|
18590
|
+
minMaxValueHandler() {
|
|
18591
|
+
this.setValueFromMinMax();
|
|
18592
|
+
}
|
|
18585
18593
|
//--------------------------------------------------------------------------
|
|
18586
18594
|
//
|
|
18587
18595
|
// Lifecycle
|
|
18588
18596
|
//
|
|
18589
18597
|
//--------------------------------------------------------------------------
|
|
18590
18598
|
connectedCallback() {
|
|
18599
|
+
this.setMinMaxFromValue();
|
|
18600
|
+
this.setValueFromMinMax();
|
|
18591
18601
|
connectLabel(this);
|
|
18592
18602
|
connectForm(this);
|
|
18593
18603
|
}
|
|
@@ -18597,11 +18607,12 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18597
18607
|
this.removeDragListeners();
|
|
18598
18608
|
}
|
|
18599
18609
|
componentWillLoad() {
|
|
18600
|
-
this.isRange = !!(this.maxValue || this.maxValue === 0);
|
|
18601
18610
|
this.tickValues = this.generateTickValues();
|
|
18602
|
-
|
|
18611
|
+
if (!isRange(this.value)) {
|
|
18612
|
+
this.value = this.clamp(this.value);
|
|
18613
|
+
}
|
|
18603
18614
|
afterConnectDefaultValueSet(this, this.value);
|
|
18604
|
-
if (this.snap) {
|
|
18615
|
+
if (this.snap && !isRange(this.value)) {
|
|
18605
18616
|
this.value = this.getClosestStep(this.value);
|
|
18606
18617
|
}
|
|
18607
18618
|
if (this.histogram) {
|
|
@@ -18611,9 +18622,9 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18611
18622
|
componentDidRender() {
|
|
18612
18623
|
if (this.labelHandles) {
|
|
18613
18624
|
this.adjustHostObscuredHandleLabel("value");
|
|
18614
|
-
if (this.
|
|
18625
|
+
if (isRange(this.value)) {
|
|
18615
18626
|
this.adjustHostObscuredHandleLabel("minValue");
|
|
18616
|
-
if (!(this.precise &&
|
|
18627
|
+
if (!(this.precise && !this.hasHistogram)) {
|
|
18617
18628
|
this.hyphenateCollidingRangeHandleLabels();
|
|
18618
18629
|
}
|
|
18619
18630
|
}
|
|
@@ -18623,50 +18634,50 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18623
18634
|
}
|
|
18624
18635
|
render() {
|
|
18625
18636
|
const id = this.el.id || this.guid;
|
|
18637
|
+
const maxProp = isRange(this.value) ? "maxValue" : "value";
|
|
18638
|
+
const value = isRange(this.value) ? this.maxValue : this.value;
|
|
18626
18639
|
const min = this.minValue || this.min;
|
|
18627
|
-
const max = this.maxValue || this.value;
|
|
18628
|
-
const maxProp = this.isRange ? "maxValue" : "value";
|
|
18629
|
-
const value = this[maxProp];
|
|
18630
18640
|
const useMinValue = this.shouldUseMinValue();
|
|
18631
18641
|
const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
|
|
18632
|
-
const maxInterval = this.getUnitInterval(
|
|
18642
|
+
const maxInterval = this.getUnitInterval(value) * 100;
|
|
18633
18643
|
const mirror = this.shouldMirror();
|
|
18634
18644
|
const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
|
|
18635
18645
|
const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
|
|
18636
|
-
const
|
|
18646
|
+
const valueIsRange = isRange(this.value);
|
|
18647
|
+
const handle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18637
18648
|
thumb: true,
|
|
18638
18649
|
"thumb--value": true,
|
|
18639
18650
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
18640
18651
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" })));
|
|
18641
|
-
const labeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
18652
|
+
const labeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18642
18653
|
thumb: true,
|
|
18643
18654
|
"thumb--value": true,
|
|
18644
18655
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
18645
18656
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value), h("div", { class: "handle" })));
|
|
18646
|
-
const histogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
18657
|
+
const histogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18647
18658
|
thumb: true,
|
|
18648
18659
|
"thumb--value": true,
|
|
18649
18660
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
18650
18661
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" }), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value)));
|
|
18651
|
-
const preciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
18662
|
+
const preciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18652
18663
|
thumb: true,
|
|
18653
18664
|
"thumb--value": true,
|
|
18654
18665
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
18655
18666
|
"thumb--precise": true
|
|
18656
18667
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle" }), h("div", { class: "handle-extension" })));
|
|
18657
|
-
const histogramPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
18668
|
+
const histogramPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18658
18669
|
thumb: true,
|
|
18659
18670
|
"thumb--value": true,
|
|
18660
18671
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
18661
18672
|
"thumb--precise": true
|
|
18662
18673
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("div", { class: "handle-extension" }), h("div", { class: "handle" })));
|
|
18663
|
-
const labeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
18674
|
+
const labeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18664
18675
|
thumb: true,
|
|
18665
18676
|
"thumb--value": true,
|
|
18666
18677
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
18667
18678
|
"thumb--precise": true
|
|
18668
18679
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = maxProp), onPointerDown: () => this.dragStart(maxProp), ref: (el) => (this.maxHandle = el), role: "slider", style: { right: rightThumbOffset }, tabIndex: 0 }, h("span", { "aria-hidden": "true", class: "handle__label handle__label--value" }, value ? value.toLocaleString() : value), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value static" }, value ? value.toLocaleString() : value), h("span", { "aria-hidden": "true", class: "handle__label handle__label--value transformed" }, value ? value.toLocaleString() : value), h("div", { class: "handle" }), h("div", { class: "handle-extension" })));
|
|
18669
|
-
const histogramLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
18680
|
+
const histogramLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label": valueIsRange ? this.maxLabel : this.minLabel, "aria-orientation": "horizontal", "aria-valuemax": this.max, "aria-valuemin": this.min, "aria-valuenow": value, class: {
|
|
18670
18681
|
thumb: true,
|
|
18671
18682
|
"thumb--value": true,
|
|
18672
18683
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
@@ -18701,14 +18712,14 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18701
18712
|
}, onBlur: () => (this.activeProp = null), onFocus: () => (this.activeProp = "minValue"), onPointerDown: () => this.dragStart("minValue"), ref: (el) => (this.minHandle = el), role: "slider", style: { left: leftThumbOffset }, tabIndex: 0 }, h("div", { class: "handle-extension" }), h("div", { class: "handle" }), h("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue" }, this.minValue && this.minValue.toLocaleString()), h("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue static" }, this.minValue && this.minValue.toLocaleString()), h("span", { "aria-hidden": "true", class: "handle__label handle__label--minValue transformed" }, this.minValue && this.minValue.toLocaleString())));
|
|
18702
18713
|
return (h(Host, { id: id, onTouchStart: this.handleTouchStart }, h("div", { class: {
|
|
18703
18714
|
["container"]: true,
|
|
18704
|
-
["container--range"]:
|
|
18715
|
+
["container--range"]: valueIsRange,
|
|
18705
18716
|
[`scale--${this.scale}`]: true
|
|
18706
18717
|
} }, this.renderGraph(), h("div", { class: "track", ref: this.storeTrackRef }, h("div", { class: "track__range", onPointerDown: () => this.dragStart("minMaxValue"), style: {
|
|
18707
18718
|
left: `${mirror ? 100 - maxInterval : minInterval}%`,
|
|
18708
18719
|
right: `${mirror ? minInterval : 100 - maxInterval}%`
|
|
18709
18720
|
} }), h("div", { class: "ticks" }, this.tickValues.map((tick) => {
|
|
18710
18721
|
const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
|
|
18711
|
-
let activeTicks = tick >= min && tick <=
|
|
18722
|
+
let activeTicks = tick >= min && tick <= value;
|
|
18712
18723
|
if (useMinValue) {
|
|
18713
18724
|
activeTicks = tick >= this.minValue && tick <= this.maxValue;
|
|
18714
18725
|
}
|
|
@@ -18719,23 +18730,24 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18719
18730
|
left: mirror ? "" : tickOffset,
|
|
18720
18731
|
right: mirror ? tickOffset : ""
|
|
18721
18732
|
} }, this.renderTickLabel(tick)));
|
|
18722
|
-
}))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles &&
|
|
18733
|
+
}))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
|
|
18723
18734
|
!this.precise &&
|
|
18724
18735
|
this.labelHandles &&
|
|
18725
|
-
|
|
18726
|
-
minLabeledHandle, this.precise && !this.labelHandles &&
|
|
18736
|
+
valueIsRange &&
|
|
18737
|
+
minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
|
|
18727
18738
|
!this.precise &&
|
|
18728
18739
|
this.labelHandles &&
|
|
18729
|
-
|
|
18740
|
+
valueIsRange &&
|
|
18730
18741
|
minHistogramLabeledHandle, !this.precise && !this.labelHandles && handle, !this.hasHistogram && !this.precise && this.labelHandles && labeledHandle, !this.hasHistogram && this.precise && !this.labelHandles && preciseHandle, this.hasHistogram && this.precise && !this.labelHandles && histogramPreciseHandle, !this.hasHistogram && this.precise && this.labelHandles && labeledPreciseHandle, this.hasHistogram && !this.precise && this.labelHandles && histogramLabeledHandle, this.hasHistogram &&
|
|
18731
18742
|
this.precise &&
|
|
18732
18743
|
this.labelHandles &&
|
|
18733
18744
|
histogramLabeledPreciseHandle, h(HiddenFormInputSlot, { component: this })))));
|
|
18734
18745
|
}
|
|
18735
18746
|
renderGraph() {
|
|
18736
|
-
return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: this.
|
|
18747
|
+
return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: isRange(this.value) ? this.maxValue : this.value, highlightMin: isRange(this.value) ? this.minValue : this.min, max: this.max, min: this.min })) : null;
|
|
18737
18748
|
}
|
|
18738
18749
|
renderTickLabel(tick) {
|
|
18750
|
+
const valueIsRange = isRange(this.value);
|
|
18739
18751
|
const isMinTickLabel = tick === this.min;
|
|
18740
18752
|
const isMaxTickLabel = tick === this.max;
|
|
18741
18753
|
const tickLabel = (h("span", { class: {
|
|
@@ -18743,26 +18755,26 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18743
18755
|
"tick__label--min": isMinTickLabel,
|
|
18744
18756
|
"tick__label--max": isMaxTickLabel
|
|
18745
18757
|
} }, tick.toLocaleString()));
|
|
18746
|
-
if (this.labelTicks && !this.hasHistogram && !
|
|
18758
|
+
if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
|
|
18747
18759
|
return tickLabel;
|
|
18748
18760
|
}
|
|
18749
18761
|
if (this.labelTicks &&
|
|
18750
18762
|
!this.hasHistogram &&
|
|
18751
|
-
|
|
18763
|
+
valueIsRange &&
|
|
18752
18764
|
!this.precise &&
|
|
18753
18765
|
!this.labelHandles) {
|
|
18754
18766
|
return tickLabel;
|
|
18755
18767
|
}
|
|
18756
18768
|
if (this.labelTicks &&
|
|
18757
18769
|
!this.hasHistogram &&
|
|
18758
|
-
|
|
18770
|
+
valueIsRange &&
|
|
18759
18771
|
!this.precise &&
|
|
18760
18772
|
this.labelHandles) {
|
|
18761
18773
|
return tickLabel;
|
|
18762
18774
|
}
|
|
18763
18775
|
if (this.labelTicks &&
|
|
18764
18776
|
!this.hasHistogram &&
|
|
18765
|
-
|
|
18777
|
+
valueIsRange &&
|
|
18766
18778
|
this.precise &&
|
|
18767
18779
|
(isMinTickLabel || isMaxTickLabel)) {
|
|
18768
18780
|
return tickLabel;
|
|
@@ -18846,7 +18858,7 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18846
18858
|
const x = event.clientX || event.pageX;
|
|
18847
18859
|
const position = this.translate(x);
|
|
18848
18860
|
let prop = "value";
|
|
18849
|
-
if (this.
|
|
18861
|
+
if (isRange(this.value)) {
|
|
18850
18862
|
const inRange = position >= this.minValue && position <= this.maxValue;
|
|
18851
18863
|
if (inRange && this.lastDragProp === "minMaxValue") {
|
|
18852
18864
|
prop = "minMaxValue";
|
|
@@ -18882,6 +18894,19 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18882
18894
|
// Private Methods
|
|
18883
18895
|
//
|
|
18884
18896
|
//--------------------------------------------------------------------------
|
|
18897
|
+
setValueFromMinMax() {
|
|
18898
|
+
const { minValue, maxValue } = this;
|
|
18899
|
+
if (typeof minValue === "number" && typeof maxValue === "number") {
|
|
18900
|
+
this.value = [minValue, maxValue];
|
|
18901
|
+
}
|
|
18902
|
+
}
|
|
18903
|
+
setMinMaxFromValue() {
|
|
18904
|
+
const { value } = this;
|
|
18905
|
+
if (isRange(value)) {
|
|
18906
|
+
this.minValue = value[0];
|
|
18907
|
+
this.maxValue = value[1];
|
|
18908
|
+
}
|
|
18909
|
+
}
|
|
18885
18910
|
onLabelClick() {
|
|
18886
18911
|
this.setFocus();
|
|
18887
18912
|
}
|
|
@@ -18889,7 +18914,7 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18889
18914
|
return this.mirrored && !this.hasHistogram;
|
|
18890
18915
|
}
|
|
18891
18916
|
shouldUseMinValue() {
|
|
18892
|
-
if (!this.
|
|
18917
|
+
if (!isRange(this.value)) {
|
|
18893
18918
|
return false;
|
|
18894
18919
|
}
|
|
18895
18920
|
return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
|
|
@@ -19102,19 +19127,20 @@ const Slider = class extends HTMLElement$1 {
|
|
|
19102
19127
|
* Hides bounding tick labels that are obscured by either handle.
|
|
19103
19128
|
*/
|
|
19104
19129
|
hideObscuredBoundingTickLabels() {
|
|
19105
|
-
|
|
19130
|
+
const valueIsRange = isRange(this.value);
|
|
19131
|
+
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
|
|
19106
19132
|
return;
|
|
19107
19133
|
}
|
|
19108
|
-
if (!this.hasHistogram && !
|
|
19134
|
+
if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
|
|
19109
19135
|
return;
|
|
19110
19136
|
}
|
|
19111
|
-
if (!this.hasHistogram && !
|
|
19137
|
+
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
|
|
19112
19138
|
return;
|
|
19113
19139
|
}
|
|
19114
|
-
if (!this.hasHistogram && !
|
|
19140
|
+
if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
|
|
19115
19141
|
return;
|
|
19116
19142
|
}
|
|
19117
|
-
if (!this.hasHistogram &&
|
|
19143
|
+
if (!this.hasHistogram && valueIsRange && !this.precise) {
|
|
19118
19144
|
return;
|
|
19119
19145
|
}
|
|
19120
19146
|
if (this.hasHistogram && !this.precise && !this.labelHandles) {
|
|
@@ -19191,7 +19217,10 @@ const Slider = class extends HTMLElement$1 {
|
|
|
19191
19217
|
}
|
|
19192
19218
|
get el() { return this; }
|
|
19193
19219
|
static get watchers() { return {
|
|
19194
|
-
"histogram": ["histogramWatcher"]
|
|
19220
|
+
"histogram": ["histogramWatcher"],
|
|
19221
|
+
"value": ["valueHandler"],
|
|
19222
|
+
"minValue": ["minMaxValueHandler"],
|
|
19223
|
+
"maxValue": ["minMaxValueHandler"]
|
|
19195
19224
|
}; }
|
|
19196
19225
|
static get style() { return sliderCss; }
|
|
19197
19226
|
};
|