@esri/calcite-components 1.0.0-next.422 → 1.0.0-next.425
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-afe59546.entry.js → p-2139226c.entry.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/calcite/p-7b238036.entry.js +5 -0
- package/dist/calcite/p-cedd48fe.system.entry.js +5 -0
- package/dist/calcite/{p-9ad8c7c5.system.entry.js → p-fe3f4e0e.system.entry.js} +1 -1
- package/dist/cjs/calcite-date-picker_4.cjs.entry.js +27 -19
- package/dist/cjs/calcite-graph_2.cjs.entry.js +67 -38
- package/dist/cjs/calcite-tab_4.cjs.entry.js +31 -32
- package/dist/collection/components/date-picker-month-header/date-picker-month-header.js +27 -19
- package/dist/collection/components/slider/slider.js +76 -41
- package/dist/collection/components/tab/tab.js +10 -12
- package/dist/collection/components/tab-nav/tab-nav.js +8 -5
- package/dist/collection/components/tab-title/tab-title.js +13 -12
- package/dist/collection/components/tabs/tabs.js +0 -3
- package/dist/components/calcite-slider.js +67 -38
- package/dist/components/date-picker-month-header.js +27 -19
- package/dist/components/tab-nav.js +8 -5
- package/dist/components/tab-title.js +13 -12
- package/dist/components/tab.js +10 -12
- package/dist/components/tabs.js +0 -3
- package/dist/custom-elements/index.js +125 -89
- package/dist/esm/calcite-date-picker_4.entry.js +27 -19
- package/dist/esm/calcite-graph_2.entry.js +67 -38
- package/dist/esm/calcite-tab_4.entry.js +31 -32
- package/dist/esm-es5/calcite-date-picker_4.entry.js +1 -1
- package/dist/esm-es5/calcite-graph_2.entry.js +1 -1
- package/dist/esm-es5/calcite-tab_4.entry.js +1 -1
- package/dist/extras/docs-json.json +6 -3
- package/dist/types/components/date-picker-month-header/date-picker-month-header.d.ts +3 -1
- package/dist/types/components/slider/slider.d.ts +5 -2
- package/dist/types/components/tab/tab.d.ts +4 -5
- package/dist/types/components/tab-nav/tab-nav.d.ts +15 -19
- package/dist/types/components/tab-title/tab-title.d.ts +9 -18
- package/dist/types/components/tabs/tabs.d.ts +1 -4
- package/dist/types/components.d.ts +2 -2
- package/hydrate/index.js +125 -89
- package/package.json +2 -2
- package/dist/calcite/p-1aeca42a.system.entry.js +0 -5
- package/dist/calcite/p-3915705c.entry.js +0 -5
- package/dist/calcite/p-872e82a6.system.entry.js +0 -5
- package/dist/calcite/p-e22ab8fa.entry.js +0 -5
|
@@ -201,6 +201,9 @@ Graph.style = graphCss;
|
|
|
201
201
|
|
|
202
202
|
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}";
|
|
203
203
|
|
|
204
|
+
function isRange(value) {
|
|
205
|
+
return Array.isArray(value);
|
|
206
|
+
}
|
|
204
207
|
const Slider = class {
|
|
205
208
|
constructor(hostRef) {
|
|
206
209
|
registerInstance(this, hostRef);
|
|
@@ -241,13 +244,12 @@ const Slider = class {
|
|
|
241
244
|
/** Interval to move on up/down keys */
|
|
242
245
|
this.step = 1;
|
|
243
246
|
/** Currently selected number (if single select) */
|
|
244
|
-
this.value =
|
|
247
|
+
this.value = 0;
|
|
245
248
|
/**
|
|
246
249
|
* Specify the scale of the slider, defaults to m
|
|
247
250
|
*/
|
|
248
251
|
this.scale = "m";
|
|
249
252
|
this.guid = `calcite-slider-${guid()}`;
|
|
250
|
-
this.isRange = false;
|
|
251
253
|
this.activeProp = "value";
|
|
252
254
|
this.minMaxValueRange = null;
|
|
253
255
|
this.minValueDragRange = null;
|
|
@@ -257,7 +259,7 @@ const Slider = class {
|
|
|
257
259
|
event.preventDefault();
|
|
258
260
|
if (this.dragProp) {
|
|
259
261
|
const value = this.translate(event.clientX || event.pageX);
|
|
260
|
-
if (this.
|
|
262
|
+
if (isRange(this.value) && this.dragProp === "minMaxValue") {
|
|
261
263
|
if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
|
|
262
264
|
const newMinValue = value - this.minValueDragRange;
|
|
263
265
|
const newMaxValue = value + this.maxValueDragRange;
|
|
@@ -303,12 +305,20 @@ const Slider = class {
|
|
|
303
305
|
histogramWatcher(newHistogram) {
|
|
304
306
|
this.hasHistogram = !!newHistogram;
|
|
305
307
|
}
|
|
308
|
+
valueHandler() {
|
|
309
|
+
this.setMinMaxFromValue();
|
|
310
|
+
}
|
|
311
|
+
minMaxValueHandler() {
|
|
312
|
+
this.setValueFromMinMax();
|
|
313
|
+
}
|
|
306
314
|
//--------------------------------------------------------------------------
|
|
307
315
|
//
|
|
308
316
|
// Lifecycle
|
|
309
317
|
//
|
|
310
318
|
//--------------------------------------------------------------------------
|
|
311
319
|
connectedCallback() {
|
|
320
|
+
this.setMinMaxFromValue();
|
|
321
|
+
this.setValueFromMinMax();
|
|
312
322
|
connectLabel(this);
|
|
313
323
|
connectForm(this);
|
|
314
324
|
}
|
|
@@ -318,11 +328,12 @@ const Slider = class {
|
|
|
318
328
|
this.removeDragListeners();
|
|
319
329
|
}
|
|
320
330
|
componentWillLoad() {
|
|
321
|
-
this.isRange = !!(this.maxValue || this.maxValue === 0);
|
|
322
331
|
this.tickValues = this.generateTickValues();
|
|
323
|
-
|
|
332
|
+
if (!isRange(this.value)) {
|
|
333
|
+
this.value = this.clamp(this.value);
|
|
334
|
+
}
|
|
324
335
|
afterConnectDefaultValueSet(this, this.value);
|
|
325
|
-
if (this.snap) {
|
|
336
|
+
if (this.snap && !isRange(this.value)) {
|
|
326
337
|
this.value = this.getClosestStep(this.value);
|
|
327
338
|
}
|
|
328
339
|
if (this.histogram) {
|
|
@@ -332,9 +343,9 @@ const Slider = class {
|
|
|
332
343
|
componentDidRender() {
|
|
333
344
|
if (this.labelHandles) {
|
|
334
345
|
this.adjustHostObscuredHandleLabel("value");
|
|
335
|
-
if (this.
|
|
346
|
+
if (isRange(this.value)) {
|
|
336
347
|
this.adjustHostObscuredHandleLabel("minValue");
|
|
337
|
-
if (!(this.precise &&
|
|
348
|
+
if (!(this.precise && !this.hasHistogram)) {
|
|
338
349
|
this.hyphenateCollidingRangeHandleLabels();
|
|
339
350
|
}
|
|
340
351
|
}
|
|
@@ -344,50 +355,50 @@ const Slider = class {
|
|
|
344
355
|
}
|
|
345
356
|
render() {
|
|
346
357
|
const id = this.el.id || this.guid;
|
|
358
|
+
const maxProp = isRange(this.value) ? "maxValue" : "value";
|
|
359
|
+
const value = isRange(this.value) ? this.maxValue : this.value;
|
|
347
360
|
const min = this.minValue || this.min;
|
|
348
|
-
const max = this.maxValue || this.value;
|
|
349
|
-
const maxProp = this.isRange ? "maxValue" : "value";
|
|
350
|
-
const value = this[maxProp];
|
|
351
361
|
const useMinValue = this.shouldUseMinValue();
|
|
352
362
|
const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
|
|
353
|
-
const maxInterval = this.getUnitInterval(
|
|
363
|
+
const maxInterval = this.getUnitInterval(value) * 100;
|
|
354
364
|
const mirror = this.shouldMirror();
|
|
355
365
|
const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
|
|
356
366
|
const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
|
|
357
|
-
const
|
|
367
|
+
const valueIsRange = isRange(this.value);
|
|
368
|
+
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: {
|
|
358
369
|
thumb: true,
|
|
359
370
|
"thumb--value": true,
|
|
360
371
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
361
372
|
}, 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" })));
|
|
362
|
-
const labeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
373
|
+
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: {
|
|
363
374
|
thumb: true,
|
|
364
375
|
"thumb--value": true,
|
|
365
376
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
366
377
|
}, 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" })));
|
|
367
|
-
const histogramLabeledHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
378
|
+
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: {
|
|
368
379
|
thumb: true,
|
|
369
380
|
"thumb--value": true,
|
|
370
381
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
371
382
|
}, 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)));
|
|
372
|
-
const preciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
383
|
+
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: {
|
|
373
384
|
thumb: true,
|
|
374
385
|
"thumb--value": true,
|
|
375
386
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
376
387
|
"thumb--precise": true
|
|
377
388
|
}, 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" })));
|
|
378
|
-
const histogramPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
389
|
+
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: {
|
|
379
390
|
thumb: true,
|
|
380
391
|
"thumb--value": true,
|
|
381
392
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
382
393
|
"thumb--precise": true
|
|
383
394
|
}, 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" })));
|
|
384
|
-
const labeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
395
|
+
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: {
|
|
385
396
|
thumb: true,
|
|
386
397
|
"thumb--value": true,
|
|
387
398
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
388
399
|
"thumb--precise": true
|
|
389
400
|
}, 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" })));
|
|
390
|
-
const histogramLabeledPreciseHandle = (h("div", { "aria-disabled": this.disabled, "aria-label":
|
|
401
|
+
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: {
|
|
391
402
|
thumb: true,
|
|
392
403
|
"thumb--value": true,
|
|
393
404
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
@@ -422,14 +433,14 @@ const Slider = class {
|
|
|
422
433
|
}, 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())));
|
|
423
434
|
return (h(Host, { id: id, onTouchStart: this.handleTouchStart }, h("div", { class: {
|
|
424
435
|
["container"]: true,
|
|
425
|
-
["container--range"]:
|
|
436
|
+
["container--range"]: valueIsRange,
|
|
426
437
|
[`scale--${this.scale}`]: true
|
|
427
438
|
} }, this.renderGraph(), h("div", { class: "track", ref: this.storeTrackRef }, h("div", { class: "track__range", onPointerDown: () => this.dragStart("minMaxValue"), style: {
|
|
428
439
|
left: `${mirror ? 100 - maxInterval : minInterval}%`,
|
|
429
440
|
right: `${mirror ? minInterval : 100 - maxInterval}%`
|
|
430
441
|
} }), h("div", { class: "ticks" }, this.tickValues.map((tick) => {
|
|
431
442
|
const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
|
|
432
|
-
let activeTicks = tick >= min && tick <=
|
|
443
|
+
let activeTicks = tick >= min && tick <= value;
|
|
433
444
|
if (useMinValue) {
|
|
434
445
|
activeTicks = tick >= this.minValue && tick <= this.maxValue;
|
|
435
446
|
}
|
|
@@ -440,23 +451,24 @@ const Slider = class {
|
|
|
440
451
|
left: mirror ? "" : tickOffset,
|
|
441
452
|
right: mirror ? tickOffset : ""
|
|
442
453
|
} }, this.renderTickLabel(tick)));
|
|
443
|
-
}))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles &&
|
|
454
|
+
}))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
|
|
444
455
|
!this.precise &&
|
|
445
456
|
this.labelHandles &&
|
|
446
|
-
|
|
447
|
-
minLabeledHandle, this.precise && !this.labelHandles &&
|
|
457
|
+
valueIsRange &&
|
|
458
|
+
minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
|
|
448
459
|
!this.precise &&
|
|
449
460
|
this.labelHandles &&
|
|
450
|
-
|
|
461
|
+
valueIsRange &&
|
|
451
462
|
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 &&
|
|
452
463
|
this.precise &&
|
|
453
464
|
this.labelHandles &&
|
|
454
465
|
histogramLabeledPreciseHandle, h(HiddenFormInputSlot, { component: this })))));
|
|
455
466
|
}
|
|
456
467
|
renderGraph() {
|
|
457
|
-
return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: this.
|
|
468
|
+
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;
|
|
458
469
|
}
|
|
459
470
|
renderTickLabel(tick) {
|
|
471
|
+
const valueIsRange = isRange(this.value);
|
|
460
472
|
const isMinTickLabel = tick === this.min;
|
|
461
473
|
const isMaxTickLabel = tick === this.max;
|
|
462
474
|
const tickLabel = (h("span", { class: {
|
|
@@ -464,26 +476,26 @@ const Slider = class {
|
|
|
464
476
|
"tick__label--min": isMinTickLabel,
|
|
465
477
|
"tick__label--max": isMaxTickLabel
|
|
466
478
|
} }, tick.toLocaleString()));
|
|
467
|
-
if (this.labelTicks && !this.hasHistogram && !
|
|
479
|
+
if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
|
|
468
480
|
return tickLabel;
|
|
469
481
|
}
|
|
470
482
|
if (this.labelTicks &&
|
|
471
483
|
!this.hasHistogram &&
|
|
472
|
-
|
|
484
|
+
valueIsRange &&
|
|
473
485
|
!this.precise &&
|
|
474
486
|
!this.labelHandles) {
|
|
475
487
|
return tickLabel;
|
|
476
488
|
}
|
|
477
489
|
if (this.labelTicks &&
|
|
478
490
|
!this.hasHistogram &&
|
|
479
|
-
|
|
491
|
+
valueIsRange &&
|
|
480
492
|
!this.precise &&
|
|
481
493
|
this.labelHandles) {
|
|
482
494
|
return tickLabel;
|
|
483
495
|
}
|
|
484
496
|
if (this.labelTicks &&
|
|
485
497
|
!this.hasHistogram &&
|
|
486
|
-
|
|
498
|
+
valueIsRange &&
|
|
487
499
|
this.precise &&
|
|
488
500
|
(isMinTickLabel || isMaxTickLabel)) {
|
|
489
501
|
return tickLabel;
|
|
@@ -567,7 +579,7 @@ const Slider = class {
|
|
|
567
579
|
const x = event.clientX || event.pageX;
|
|
568
580
|
const position = this.translate(x);
|
|
569
581
|
let prop = "value";
|
|
570
|
-
if (this.
|
|
582
|
+
if (isRange(this.value)) {
|
|
571
583
|
const inRange = position >= this.minValue && position <= this.maxValue;
|
|
572
584
|
if (inRange && this.lastDragProp === "minMaxValue") {
|
|
573
585
|
prop = "minMaxValue";
|
|
@@ -603,6 +615,19 @@ const Slider = class {
|
|
|
603
615
|
// Private Methods
|
|
604
616
|
//
|
|
605
617
|
//--------------------------------------------------------------------------
|
|
618
|
+
setValueFromMinMax() {
|
|
619
|
+
const { minValue, maxValue } = this;
|
|
620
|
+
if (typeof minValue === "number" && typeof maxValue === "number") {
|
|
621
|
+
this.value = [minValue, maxValue];
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
setMinMaxFromValue() {
|
|
625
|
+
const { value } = this;
|
|
626
|
+
if (isRange(value)) {
|
|
627
|
+
this.minValue = value[0];
|
|
628
|
+
this.maxValue = value[1];
|
|
629
|
+
}
|
|
630
|
+
}
|
|
606
631
|
onLabelClick() {
|
|
607
632
|
this.setFocus();
|
|
608
633
|
}
|
|
@@ -610,7 +635,7 @@ const Slider = class {
|
|
|
610
635
|
return this.mirrored && !this.hasHistogram;
|
|
611
636
|
}
|
|
612
637
|
shouldUseMinValue() {
|
|
613
|
-
if (!this.
|
|
638
|
+
if (!isRange(this.value)) {
|
|
614
639
|
return false;
|
|
615
640
|
}
|
|
616
641
|
return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
|
|
@@ -823,19 +848,20 @@ const Slider = class {
|
|
|
823
848
|
* Hides bounding tick labels that are obscured by either handle.
|
|
824
849
|
*/
|
|
825
850
|
hideObscuredBoundingTickLabels() {
|
|
826
|
-
|
|
851
|
+
const valueIsRange = isRange(this.value);
|
|
852
|
+
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
|
|
827
853
|
return;
|
|
828
854
|
}
|
|
829
|
-
if (!this.hasHistogram && !
|
|
855
|
+
if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
|
|
830
856
|
return;
|
|
831
857
|
}
|
|
832
|
-
if (!this.hasHistogram && !
|
|
858
|
+
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
|
|
833
859
|
return;
|
|
834
860
|
}
|
|
835
|
-
if (!this.hasHistogram && !
|
|
861
|
+
if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
|
|
836
862
|
return;
|
|
837
863
|
}
|
|
838
|
-
if (!this.hasHistogram &&
|
|
864
|
+
if (!this.hasHistogram && valueIsRange && !this.precise) {
|
|
839
865
|
return;
|
|
840
866
|
}
|
|
841
867
|
if (this.hasHistogram && !this.precise && !this.labelHandles) {
|
|
@@ -912,7 +938,10 @@ const Slider = class {
|
|
|
912
938
|
}
|
|
913
939
|
get el() { return getElement(this); }
|
|
914
940
|
static get watchers() { return {
|
|
915
|
-
"histogram": ["histogramWatcher"]
|
|
941
|
+
"histogram": ["histogramWatcher"],
|
|
942
|
+
"value": ["valueHandler"],
|
|
943
|
+
"minValue": ["minMaxValueHandler"],
|
|
944
|
+
"maxValue": ["minMaxValueHandler"]
|
|
916
945
|
}; }
|
|
917
946
|
};
|
|
918
947
|
Slider.style = sliderCss;
|
|
@@ -20,14 +20,6 @@ const Tab = class {
|
|
|
20
20
|
this.active = false;
|
|
21
21
|
/** @internal Parent tabs component scale value */
|
|
22
22
|
this.scale = "m";
|
|
23
|
-
//--------------------------------------------------------------------------
|
|
24
|
-
//
|
|
25
|
-
// Private State/Props
|
|
26
|
-
//
|
|
27
|
-
//--------------------------------------------------------------------------
|
|
28
|
-
/**
|
|
29
|
-
* @internal
|
|
30
|
-
*/
|
|
31
23
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
32
24
|
}
|
|
33
25
|
//--------------------------------------------------------------------------
|
|
@@ -39,12 +31,15 @@ const Tab = class {
|
|
|
39
31
|
const id = this.el.id || this.guid;
|
|
40
32
|
return (h(Host, { "aria-expanded": this.active.toString(), "aria-labelledby": this.labeledBy, id: id, role: "tabpanel" }, h("section", null, h("slot", null))));
|
|
41
33
|
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
36
|
+
}
|
|
42
37
|
componentDidLoad() {
|
|
43
38
|
this.calciteTabRegister.emit();
|
|
44
39
|
}
|
|
45
40
|
componentWillRender() {
|
|
46
41
|
var _a;
|
|
47
|
-
this.scale = (_a = this.
|
|
42
|
+
this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
|
|
48
43
|
}
|
|
49
44
|
disconnectedCallback() {
|
|
50
45
|
var _a;
|
|
@@ -59,10 +54,13 @@ const Tab = class {
|
|
|
59
54
|
//
|
|
60
55
|
//--------------------------------------------------------------------------
|
|
61
56
|
tabChangeHandler(event) {
|
|
57
|
+
const targetTabsEl = event
|
|
58
|
+
.composedPath()
|
|
59
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
62
60
|
// to allow `<calcite-tabs>` to be nested we need to make sure this
|
|
63
|
-
// `calciteTabChange` event was actually fired from a
|
|
64
|
-
//
|
|
65
|
-
if (
|
|
61
|
+
// `calciteTabChange` event was actually fired from a within the same
|
|
62
|
+
// `<calcite-tabs>` that is the a parent of this tab.
|
|
63
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
|
66
64
|
return;
|
|
67
65
|
}
|
|
68
66
|
if (this.tab) {
|
|
@@ -149,6 +147,9 @@ const TabNav = class {
|
|
|
149
147
|
// Lifecycle
|
|
150
148
|
//
|
|
151
149
|
//--------------------------------------------------------------------------
|
|
150
|
+
connectedCallback() {
|
|
151
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
152
|
+
}
|
|
152
153
|
componentWillLoad() {
|
|
153
154
|
const storageKey = `calcite-tab-nav-${this.storageId}`;
|
|
154
155
|
if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
|
|
@@ -160,11 +161,11 @@ const TabNav = class {
|
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
163
|
componentWillRender() {
|
|
163
|
-
|
|
164
|
-
this.layout =
|
|
165
|
-
this.position =
|
|
166
|
-
this.scale =
|
|
167
|
-
this.bordered =
|
|
164
|
+
const { parentTabsEl } = this;
|
|
165
|
+
this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
|
|
166
|
+
this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
|
|
167
|
+
this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
|
|
168
|
+
this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
|
|
168
169
|
// fix issue with active tab-title not lining up with blue indicator
|
|
169
170
|
if (this.selectedTabEl) {
|
|
170
171
|
this.updateOffsetPosition();
|
|
@@ -305,9 +306,6 @@ const TabTitle = class {
|
|
|
305
306
|
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
|
306
307
|
/** determine if there is slotted text for styling purposes */
|
|
307
308
|
this.hasText = false;
|
|
308
|
-
/**
|
|
309
|
-
* @internal
|
|
310
|
-
*/
|
|
311
309
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
312
310
|
}
|
|
313
311
|
activeTabChanged() {
|
|
@@ -376,15 +374,19 @@ const TabTitle = class {
|
|
|
376
374
|
//
|
|
377
375
|
//--------------------------------------------------------------------------
|
|
378
376
|
tabChangeHandler(event) {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
377
|
+
const targetTabsEl = event
|
|
378
|
+
.composedPath()
|
|
379
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
380
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
if (this.tab) {
|
|
384
|
+
this.active = this.tab === event.detail.tab;
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
this.getTabIndex().then((index) => {
|
|
388
|
+
this.active = index === event.detail.tab;
|
|
389
|
+
});
|
|
388
390
|
}
|
|
389
391
|
}
|
|
390
392
|
onClick() {
|
|
@@ -500,14 +502,12 @@ const Tabs = class {
|
|
|
500
502
|
//
|
|
501
503
|
//--------------------------------------------------------------------------
|
|
502
504
|
/**
|
|
503
|
-
* @internal
|
|
504
505
|
*
|
|
505
506
|
* Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
|
|
506
507
|
* attributes.
|
|
507
508
|
*/
|
|
508
509
|
this.titles = [];
|
|
509
510
|
/**
|
|
510
|
-
* @internal
|
|
511
511
|
*
|
|
512
512
|
* Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
|
|
513
513
|
*/
|
|
@@ -569,7 +569,6 @@ const Tabs = class {
|
|
|
569
569
|
//
|
|
570
570
|
//--------------------------------------------------------------------------
|
|
571
571
|
/**
|
|
572
|
-
* @internal
|
|
573
572
|
*
|
|
574
573
|
* Matches up elements from the internal `tabs` and `titles` to automatically
|
|
575
574
|
* update the ARIA attributes and link `<calcite-tab>` and
|