@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
|
@@ -11445,20 +11445,23 @@ const DatePickerMonthHeader = class extends HTMLElement$1 {
|
|
|
11445
11445
|
* Increment year on UP/DOWN keys
|
|
11446
11446
|
*/
|
|
11447
11447
|
this.onYearKey = (e) => {
|
|
11448
|
-
const
|
|
11448
|
+
const localizedYear = e.target.value;
|
|
11449
11449
|
switch (e.key) {
|
|
11450
11450
|
case "ArrowDown":
|
|
11451
11451
|
e.preventDefault();
|
|
11452
|
-
this.setYear(
|
|
11452
|
+
this.setYear({ localizedYear, offset: -1 });
|
|
11453
11453
|
break;
|
|
11454
11454
|
case "ArrowUp":
|
|
11455
11455
|
e.preventDefault();
|
|
11456
|
-
this.setYear(
|
|
11456
|
+
this.setYear({ localizedYear, offset: 1 });
|
|
11457
11457
|
break;
|
|
11458
11458
|
}
|
|
11459
11459
|
};
|
|
11460
|
-
this.
|
|
11461
|
-
this.setYear(event.target.value);
|
|
11460
|
+
this.onYearChange = (event) => {
|
|
11461
|
+
this.setYear({ localizedYear: event.target.value });
|
|
11462
|
+
};
|
|
11463
|
+
this.onYearInput = (event) => {
|
|
11464
|
+
this.setYear({ localizedYear: event.target.value, commit: false });
|
|
11462
11465
|
};
|
|
11463
11466
|
this.prevMonthClick = (e) => {
|
|
11464
11467
|
this.handleArrowClick(e, this.prevMonthDate);
|
|
@@ -11514,7 +11517,7 @@ const DatePickerMonthHeader = class extends HTMLElement$1 {
|
|
|
11514
11517
|
return (h(Fragment, null, h("a", { "aria-disabled": (this.prevMonthDate.getMonth() === activeMonth).toString(), "aria-label": this.intlPrevMonth, class: "chevron", href: "#", onClick: this.prevMonthClick, onKeyDown: this.prevMonthKeydown, role: "button", tabindex: this.prevMonthDate.getMonth() === activeMonth ? -1 : 0 }, h("calcite-icon", { "flip-rtl": true, icon: "chevron-left", scale: iconScale })), h("div", { class: { text: true, "text--reverse": reverse } }, h(Heading, { class: "month", level: this.headingLevel }, localizedMonth), h("span", { class: "year-wrap" }, h("input", { "aria-label": this.intlYear, class: {
|
|
11515
11518
|
year: true,
|
|
11516
11519
|
"year--suffix": !!suffix
|
|
11517
|
-
}, inputmode: "numeric", maxlength: "4", minlength: "1", onInput: this.
|
|
11520
|
+
}, inputmode: "numeric", maxlength: "4", minlength: "1", onChange: this.onYearChange, onInput: this.onYearInput, onKeyDown: this.onYearKey, pattern: "\\d*", ref: (el) => (this.yearInput = el), type: "text", value: localizedYear }), suffix && (h("span", { class: "suffix" }, h("span", { "aria-hidden": "true", class: "suffix__invisible" }, localizedYear), " " + suffix)))), h("a", { "aria-disabled": (this.nextMonthDate.getMonth() === activeMonth).toString(), "aria-label": this.intlNextMonth, class: "chevron", href: "#", onClick: this.nextMonthClick, onKeyDown: this.nextMonthKeydown, role: "button", tabindex: this.nextMonthDate.getMonth() === activeMonth ? -1 : 0 }, h("calcite-icon", { "flip-rtl": true, icon: "chevron-right", scale: iconScale }))));
|
|
11518
11521
|
}
|
|
11519
11522
|
setNextPrevMonthDates() {
|
|
11520
11523
|
if (!this.activeDate) {
|
|
@@ -11523,27 +11526,32 @@ const DatePickerMonthHeader = class extends HTMLElement$1 {
|
|
|
11523
11526
|
this.nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
|
|
11524
11527
|
this.prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
|
|
11525
11528
|
}
|
|
11526
|
-
|
|
11527
|
-
|
|
11528
|
-
* set to active if in range
|
|
11529
|
-
*/
|
|
11530
|
-
setYear(localizedYear, increment = 0) {
|
|
11531
|
-
const { min, max, activeDate, localeData, yearInput } = this;
|
|
11529
|
+
getInRangeDate({ localizedYear, offset = 0 }) {
|
|
11530
|
+
const { min, max, activeDate, localeData } = this;
|
|
11532
11531
|
const parsedYear = parseNumber(localizedYear, localeData);
|
|
11533
11532
|
const length = parsedYear.toString().length;
|
|
11534
|
-
const year = isNaN(parsedYear) ? false : parsedYear +
|
|
11533
|
+
const year = isNaN(parsedYear) ? false : parsedYear + offset;
|
|
11535
11534
|
const inRange = year && (!min || min.getFullYear() <= year) && (!max || max.getFullYear() >= year);
|
|
11536
|
-
// if you've supplied a year and it's in range
|
|
11535
|
+
// if you've supplied a year and it's in range
|
|
11537
11536
|
if (year && inRange && length === localizedYear.length) {
|
|
11538
11537
|
const nextDate = new Date(activeDate);
|
|
11539
11538
|
nextDate.setFullYear(year);
|
|
11540
|
-
|
|
11539
|
+
return dateFromRange(nextDate, min, max);
|
|
11540
|
+
}
|
|
11541
|
+
}
|
|
11542
|
+
/**
|
|
11543
|
+
* Parse localized year string from input,
|
|
11544
|
+
* set to active if in range
|
|
11545
|
+
*/
|
|
11546
|
+
setYear({ localizedYear, commit = true, offset = 0 }) {
|
|
11547
|
+
const { yearInput, activeDate, localeData } = this;
|
|
11548
|
+
const inRangeDate = this.getInRangeDate({ localizedYear, offset });
|
|
11549
|
+
// if you've supplied a year and it's in range, update active date
|
|
11550
|
+
if (inRangeDate) {
|
|
11541
11551
|
this.calciteDatePickerSelect.emit(inRangeDate);
|
|
11542
|
-
yearInput.value = localizeNumber(inRangeDate.getFullYear(), localeData);
|
|
11543
11552
|
}
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
yearInput.value = localizeNumber(activeDate.getFullYear(), localeData);
|
|
11553
|
+
if (commit) {
|
|
11554
|
+
yearInput.value = localizeNumber((inRangeDate || activeDate).getFullYear(), localeData);
|
|
11547
11555
|
}
|
|
11548
11556
|
}
|
|
11549
11557
|
get el() { return this; }
|
|
@@ -18478,6 +18486,9 @@ const ShellPanel = class extends HTMLElement$1 {
|
|
|
18478
18486
|
|
|
18479
18487
|
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
18488
|
|
|
18489
|
+
function isRange(value) {
|
|
18490
|
+
return Array.isArray(value);
|
|
18491
|
+
}
|
|
18481
18492
|
const Slider = class extends HTMLElement$1 {
|
|
18482
18493
|
constructor() {
|
|
18483
18494
|
super();
|
|
@@ -18520,13 +18531,12 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18520
18531
|
/** Interval to move on up/down keys */
|
|
18521
18532
|
this.step = 1;
|
|
18522
18533
|
/** Currently selected number (if single select) */
|
|
18523
|
-
this.value =
|
|
18534
|
+
this.value = 0;
|
|
18524
18535
|
/**
|
|
18525
18536
|
* Specify the scale of the slider, defaults to m
|
|
18526
18537
|
*/
|
|
18527
18538
|
this.scale = "m";
|
|
18528
18539
|
this.guid = `calcite-slider-${guid()}`;
|
|
18529
|
-
this.isRange = false;
|
|
18530
18540
|
this.activeProp = "value";
|
|
18531
18541
|
this.minMaxValueRange = null;
|
|
18532
18542
|
this.minValueDragRange = null;
|
|
@@ -18536,7 +18546,7 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18536
18546
|
event.preventDefault();
|
|
18537
18547
|
if (this.dragProp) {
|
|
18538
18548
|
const value = this.translate(event.clientX || event.pageX);
|
|
18539
|
-
if (this.
|
|
18549
|
+
if (isRange(this.value) && this.dragProp === "minMaxValue") {
|
|
18540
18550
|
if (this.minValueDragRange && this.maxValueDragRange && this.minMaxValueRange) {
|
|
18541
18551
|
const newMinValue = value - this.minValueDragRange;
|
|
18542
18552
|
const newMaxValue = value + this.maxValueDragRange;
|
|
@@ -18582,12 +18592,20 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18582
18592
|
histogramWatcher(newHistogram) {
|
|
18583
18593
|
this.hasHistogram = !!newHistogram;
|
|
18584
18594
|
}
|
|
18595
|
+
valueHandler() {
|
|
18596
|
+
this.setMinMaxFromValue();
|
|
18597
|
+
}
|
|
18598
|
+
minMaxValueHandler() {
|
|
18599
|
+
this.setValueFromMinMax();
|
|
18600
|
+
}
|
|
18585
18601
|
//--------------------------------------------------------------------------
|
|
18586
18602
|
//
|
|
18587
18603
|
// Lifecycle
|
|
18588
18604
|
//
|
|
18589
18605
|
//--------------------------------------------------------------------------
|
|
18590
18606
|
connectedCallback() {
|
|
18607
|
+
this.setMinMaxFromValue();
|
|
18608
|
+
this.setValueFromMinMax();
|
|
18591
18609
|
connectLabel(this);
|
|
18592
18610
|
connectForm(this);
|
|
18593
18611
|
}
|
|
@@ -18597,11 +18615,12 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18597
18615
|
this.removeDragListeners();
|
|
18598
18616
|
}
|
|
18599
18617
|
componentWillLoad() {
|
|
18600
|
-
this.isRange = !!(this.maxValue || this.maxValue === 0);
|
|
18601
18618
|
this.tickValues = this.generateTickValues();
|
|
18602
|
-
|
|
18619
|
+
if (!isRange(this.value)) {
|
|
18620
|
+
this.value = this.clamp(this.value);
|
|
18621
|
+
}
|
|
18603
18622
|
afterConnectDefaultValueSet(this, this.value);
|
|
18604
|
-
if (this.snap) {
|
|
18623
|
+
if (this.snap && !isRange(this.value)) {
|
|
18605
18624
|
this.value = this.getClosestStep(this.value);
|
|
18606
18625
|
}
|
|
18607
18626
|
if (this.histogram) {
|
|
@@ -18611,9 +18630,9 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18611
18630
|
componentDidRender() {
|
|
18612
18631
|
if (this.labelHandles) {
|
|
18613
18632
|
this.adjustHostObscuredHandleLabel("value");
|
|
18614
|
-
if (this.
|
|
18633
|
+
if (isRange(this.value)) {
|
|
18615
18634
|
this.adjustHostObscuredHandleLabel("minValue");
|
|
18616
|
-
if (!(this.precise &&
|
|
18635
|
+
if (!(this.precise && !this.hasHistogram)) {
|
|
18617
18636
|
this.hyphenateCollidingRangeHandleLabels();
|
|
18618
18637
|
}
|
|
18619
18638
|
}
|
|
@@ -18623,50 +18642,50 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18623
18642
|
}
|
|
18624
18643
|
render() {
|
|
18625
18644
|
const id = this.el.id || this.guid;
|
|
18645
|
+
const maxProp = isRange(this.value) ? "maxValue" : "value";
|
|
18646
|
+
const value = isRange(this.value) ? this.maxValue : this.value;
|
|
18626
18647
|
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
18648
|
const useMinValue = this.shouldUseMinValue();
|
|
18631
18649
|
const minInterval = this.getUnitInterval(useMinValue ? this.minValue : min) * 100;
|
|
18632
|
-
const maxInterval = this.getUnitInterval(
|
|
18650
|
+
const maxInterval = this.getUnitInterval(value) * 100;
|
|
18633
18651
|
const mirror = this.shouldMirror();
|
|
18634
18652
|
const leftThumbOffset = `${mirror ? 100 - minInterval : minInterval}%`;
|
|
18635
18653
|
const rightThumbOffset = `${mirror ? maxInterval : 100 - maxInterval}%`;
|
|
18636
|
-
const
|
|
18654
|
+
const valueIsRange = isRange(this.value);
|
|
18655
|
+
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
18656
|
thumb: true,
|
|
18638
18657
|
"thumb--value": true,
|
|
18639
18658
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
18640
18659
|
}, 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":
|
|
18660
|
+
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
18661
|
thumb: true,
|
|
18643
18662
|
"thumb--value": true,
|
|
18644
18663
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
18645
18664
|
}, 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":
|
|
18665
|
+
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
18666
|
thumb: true,
|
|
18648
18667
|
"thumb--value": true,
|
|
18649
18668
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp
|
|
18650
18669
|
}, 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":
|
|
18670
|
+
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
18671
|
thumb: true,
|
|
18653
18672
|
"thumb--value": true,
|
|
18654
18673
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
18655
18674
|
"thumb--precise": true
|
|
18656
18675
|
}, 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":
|
|
18676
|
+
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
18677
|
thumb: true,
|
|
18659
18678
|
"thumb--value": true,
|
|
18660
18679
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
18661
18680
|
"thumb--precise": true
|
|
18662
18681
|
}, 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":
|
|
18682
|
+
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
18683
|
thumb: true,
|
|
18665
18684
|
"thumb--value": true,
|
|
18666
18685
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
18667
18686
|
"thumb--precise": true
|
|
18668
18687
|
}, 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":
|
|
18688
|
+
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
18689
|
thumb: true,
|
|
18671
18690
|
"thumb--value": true,
|
|
18672
18691
|
"thumb--active": this.lastDragProp !== "minMaxValue" && this.dragProp === maxProp,
|
|
@@ -18701,14 +18720,14 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18701
18720
|
}, 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
18721
|
return (h(Host, { id: id, onTouchStart: this.handleTouchStart }, h("div", { class: {
|
|
18703
18722
|
["container"]: true,
|
|
18704
|
-
["container--range"]:
|
|
18723
|
+
["container--range"]: valueIsRange,
|
|
18705
18724
|
[`scale--${this.scale}`]: true
|
|
18706
18725
|
} }, this.renderGraph(), h("div", { class: "track", ref: this.storeTrackRef }, h("div", { class: "track__range", onPointerDown: () => this.dragStart("minMaxValue"), style: {
|
|
18707
18726
|
left: `${mirror ? 100 - maxInterval : minInterval}%`,
|
|
18708
18727
|
right: `${mirror ? minInterval : 100 - maxInterval}%`
|
|
18709
18728
|
} }), h("div", { class: "ticks" }, this.tickValues.map((tick) => {
|
|
18710
18729
|
const tickOffset = `${this.getUnitInterval(tick) * 100}%`;
|
|
18711
|
-
let activeTicks = tick >= min && tick <=
|
|
18730
|
+
let activeTicks = tick >= min && tick <= value;
|
|
18712
18731
|
if (useMinValue) {
|
|
18713
18732
|
activeTicks = tick >= this.minValue && tick <= this.maxValue;
|
|
18714
18733
|
}
|
|
@@ -18719,23 +18738,24 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18719
18738
|
left: mirror ? "" : tickOffset,
|
|
18720
18739
|
right: mirror ? tickOffset : ""
|
|
18721
18740
|
} }, this.renderTickLabel(tick)));
|
|
18722
|
-
}))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles &&
|
|
18741
|
+
}))), h("div", { class: "thumb-container" }, !this.precise && !this.labelHandles && valueIsRange && minHandle, !this.hasHistogram &&
|
|
18723
18742
|
!this.precise &&
|
|
18724
18743
|
this.labelHandles &&
|
|
18725
|
-
|
|
18726
|
-
minLabeledHandle, this.precise && !this.labelHandles &&
|
|
18744
|
+
valueIsRange &&
|
|
18745
|
+
minLabeledHandle, this.precise && !this.labelHandles && valueIsRange && minPreciseHandle, this.precise && this.labelHandles && valueIsRange && minLabeledPreciseHandle, this.hasHistogram &&
|
|
18727
18746
|
!this.precise &&
|
|
18728
18747
|
this.labelHandles &&
|
|
18729
|
-
|
|
18748
|
+
valueIsRange &&
|
|
18730
18749
|
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
18750
|
this.precise &&
|
|
18732
18751
|
this.labelHandles &&
|
|
18733
18752
|
histogramLabeledPreciseHandle, h(HiddenFormInputSlot, { component: this })))));
|
|
18734
18753
|
}
|
|
18735
18754
|
renderGraph() {
|
|
18736
|
-
return this.histogram ? (h("calcite-graph", { class: "graph", colorStops: this.histogramStops, data: this.histogram, highlightMax: this.
|
|
18755
|
+
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
18756
|
}
|
|
18738
18757
|
renderTickLabel(tick) {
|
|
18758
|
+
const valueIsRange = isRange(this.value);
|
|
18739
18759
|
const isMinTickLabel = tick === this.min;
|
|
18740
18760
|
const isMaxTickLabel = tick === this.max;
|
|
18741
18761
|
const tickLabel = (h("span", { class: {
|
|
@@ -18743,26 +18763,26 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18743
18763
|
"tick__label--min": isMinTickLabel,
|
|
18744
18764
|
"tick__label--max": isMaxTickLabel
|
|
18745
18765
|
} }, tick.toLocaleString()));
|
|
18746
|
-
if (this.labelTicks && !this.hasHistogram && !
|
|
18766
|
+
if (this.labelTicks && !this.hasHistogram && !valueIsRange) {
|
|
18747
18767
|
return tickLabel;
|
|
18748
18768
|
}
|
|
18749
18769
|
if (this.labelTicks &&
|
|
18750
18770
|
!this.hasHistogram &&
|
|
18751
|
-
|
|
18771
|
+
valueIsRange &&
|
|
18752
18772
|
!this.precise &&
|
|
18753
18773
|
!this.labelHandles) {
|
|
18754
18774
|
return tickLabel;
|
|
18755
18775
|
}
|
|
18756
18776
|
if (this.labelTicks &&
|
|
18757
18777
|
!this.hasHistogram &&
|
|
18758
|
-
|
|
18778
|
+
valueIsRange &&
|
|
18759
18779
|
!this.precise &&
|
|
18760
18780
|
this.labelHandles) {
|
|
18761
18781
|
return tickLabel;
|
|
18762
18782
|
}
|
|
18763
18783
|
if (this.labelTicks &&
|
|
18764
18784
|
!this.hasHistogram &&
|
|
18765
|
-
|
|
18785
|
+
valueIsRange &&
|
|
18766
18786
|
this.precise &&
|
|
18767
18787
|
(isMinTickLabel || isMaxTickLabel)) {
|
|
18768
18788
|
return tickLabel;
|
|
@@ -18846,7 +18866,7 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18846
18866
|
const x = event.clientX || event.pageX;
|
|
18847
18867
|
const position = this.translate(x);
|
|
18848
18868
|
let prop = "value";
|
|
18849
|
-
if (this.
|
|
18869
|
+
if (isRange(this.value)) {
|
|
18850
18870
|
const inRange = position >= this.minValue && position <= this.maxValue;
|
|
18851
18871
|
if (inRange && this.lastDragProp === "minMaxValue") {
|
|
18852
18872
|
prop = "minMaxValue";
|
|
@@ -18882,6 +18902,19 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18882
18902
|
// Private Methods
|
|
18883
18903
|
//
|
|
18884
18904
|
//--------------------------------------------------------------------------
|
|
18905
|
+
setValueFromMinMax() {
|
|
18906
|
+
const { minValue, maxValue } = this;
|
|
18907
|
+
if (typeof minValue === "number" && typeof maxValue === "number") {
|
|
18908
|
+
this.value = [minValue, maxValue];
|
|
18909
|
+
}
|
|
18910
|
+
}
|
|
18911
|
+
setMinMaxFromValue() {
|
|
18912
|
+
const { value } = this;
|
|
18913
|
+
if (isRange(value)) {
|
|
18914
|
+
this.minValue = value[0];
|
|
18915
|
+
this.maxValue = value[1];
|
|
18916
|
+
}
|
|
18917
|
+
}
|
|
18885
18918
|
onLabelClick() {
|
|
18886
18919
|
this.setFocus();
|
|
18887
18920
|
}
|
|
@@ -18889,7 +18922,7 @@ const Slider = class extends HTMLElement$1 {
|
|
|
18889
18922
|
return this.mirrored && !this.hasHistogram;
|
|
18890
18923
|
}
|
|
18891
18924
|
shouldUseMinValue() {
|
|
18892
|
-
if (!this.
|
|
18925
|
+
if (!isRange(this.value)) {
|
|
18893
18926
|
return false;
|
|
18894
18927
|
}
|
|
18895
18928
|
return ((this.hasHistogram && this.maxValue === 0) || (!this.hasHistogram && this.minValue === 0));
|
|
@@ -19102,19 +19135,20 @@ const Slider = class extends HTMLElement$1 {
|
|
|
19102
19135
|
* Hides bounding tick labels that are obscured by either handle.
|
|
19103
19136
|
*/
|
|
19104
19137
|
hideObscuredBoundingTickLabels() {
|
|
19105
|
-
|
|
19138
|
+
const valueIsRange = isRange(this.value);
|
|
19139
|
+
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && !this.precise) {
|
|
19106
19140
|
return;
|
|
19107
19141
|
}
|
|
19108
|
-
if (!this.hasHistogram && !
|
|
19142
|
+
if (!this.hasHistogram && !valueIsRange && this.labelHandles && !this.precise) {
|
|
19109
19143
|
return;
|
|
19110
19144
|
}
|
|
19111
|
-
if (!this.hasHistogram && !
|
|
19145
|
+
if (!this.hasHistogram && !valueIsRange && !this.labelHandles && this.precise) {
|
|
19112
19146
|
return;
|
|
19113
19147
|
}
|
|
19114
|
-
if (!this.hasHistogram && !
|
|
19148
|
+
if (!this.hasHistogram && !valueIsRange && this.labelHandles && this.precise) {
|
|
19115
19149
|
return;
|
|
19116
19150
|
}
|
|
19117
|
-
if (!this.hasHistogram &&
|
|
19151
|
+
if (!this.hasHistogram && valueIsRange && !this.precise) {
|
|
19118
19152
|
return;
|
|
19119
19153
|
}
|
|
19120
19154
|
if (this.hasHistogram && !this.precise && !this.labelHandles) {
|
|
@@ -19191,7 +19225,10 @@ const Slider = class extends HTMLElement$1 {
|
|
|
19191
19225
|
}
|
|
19192
19226
|
get el() { return this; }
|
|
19193
19227
|
static get watchers() { return {
|
|
19194
|
-
"histogram": ["histogramWatcher"]
|
|
19228
|
+
"histogram": ["histogramWatcher"],
|
|
19229
|
+
"value": ["valueHandler"],
|
|
19230
|
+
"minValue": ["minMaxValueHandler"],
|
|
19231
|
+
"maxValue": ["minMaxValueHandler"]
|
|
19195
19232
|
}; }
|
|
19196
19233
|
static get style() { return sliderCss; }
|
|
19197
19234
|
};
|
|
@@ -22937,14 +22974,6 @@ const Tab = class extends HTMLElement$1 {
|
|
|
22937
22974
|
this.active = false;
|
|
22938
22975
|
/** @internal Parent tabs component scale value */
|
|
22939
22976
|
this.scale = "m";
|
|
22940
|
-
//--------------------------------------------------------------------------
|
|
22941
|
-
//
|
|
22942
|
-
// Private State/Props
|
|
22943
|
-
//
|
|
22944
|
-
//--------------------------------------------------------------------------
|
|
22945
|
-
/**
|
|
22946
|
-
* @internal
|
|
22947
|
-
*/
|
|
22948
22977
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
22949
22978
|
}
|
|
22950
22979
|
//--------------------------------------------------------------------------
|
|
@@ -22956,12 +22985,15 @@ const Tab = class extends HTMLElement$1 {
|
|
|
22956
22985
|
const id = this.el.id || this.guid;
|
|
22957
22986
|
return (h(Host, { "aria-expanded": this.active.toString(), "aria-labelledby": this.labeledBy, id: id, role: "tabpanel" }, h("section", null, h("slot", null))));
|
|
22958
22987
|
}
|
|
22988
|
+
connectedCallback() {
|
|
22989
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
22990
|
+
}
|
|
22959
22991
|
componentDidLoad() {
|
|
22960
22992
|
this.calciteTabRegister.emit();
|
|
22961
22993
|
}
|
|
22962
22994
|
componentWillRender() {
|
|
22963
22995
|
var _a;
|
|
22964
|
-
this.scale = (_a = this.
|
|
22996
|
+
this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
|
|
22965
22997
|
}
|
|
22966
22998
|
disconnectedCallback() {
|
|
22967
22999
|
var _a;
|
|
@@ -22976,10 +23008,13 @@ const Tab = class extends HTMLElement$1 {
|
|
|
22976
23008
|
//
|
|
22977
23009
|
//--------------------------------------------------------------------------
|
|
22978
23010
|
tabChangeHandler(event) {
|
|
23011
|
+
const targetTabsEl = event
|
|
23012
|
+
.composedPath()
|
|
23013
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
22979
23014
|
// to allow `<calcite-tabs>` to be nested we need to make sure this
|
|
22980
|
-
// `calciteTabChange` event was actually fired from a
|
|
22981
|
-
//
|
|
22982
|
-
if (
|
|
23015
|
+
// `calciteTabChange` event was actually fired from a within the same
|
|
23016
|
+
// `<calcite-tabs>` that is the a parent of this tab.
|
|
23017
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
|
22983
23018
|
return;
|
|
22984
23019
|
}
|
|
22985
23020
|
if (this.tab) {
|
|
@@ -23068,6 +23103,9 @@ const TabNav = class extends HTMLElement$1 {
|
|
|
23068
23103
|
// Lifecycle
|
|
23069
23104
|
//
|
|
23070
23105
|
//--------------------------------------------------------------------------
|
|
23106
|
+
connectedCallback() {
|
|
23107
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
23108
|
+
}
|
|
23071
23109
|
componentWillLoad() {
|
|
23072
23110
|
const storageKey = `calcite-tab-nav-${this.storageId}`;
|
|
23073
23111
|
if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
|
|
@@ -23079,11 +23117,11 @@ const TabNav = class extends HTMLElement$1 {
|
|
|
23079
23117
|
}
|
|
23080
23118
|
}
|
|
23081
23119
|
componentWillRender() {
|
|
23082
|
-
|
|
23083
|
-
this.layout =
|
|
23084
|
-
this.position =
|
|
23085
|
-
this.scale =
|
|
23086
|
-
this.bordered =
|
|
23120
|
+
const { parentTabsEl } = this;
|
|
23121
|
+
this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
|
|
23122
|
+
this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
|
|
23123
|
+
this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
|
|
23124
|
+
this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
|
|
23087
23125
|
// fix issue with active tab-title not lining up with blue indicator
|
|
23088
23126
|
if (this.selectedTabEl) {
|
|
23089
23127
|
this.updateOffsetPosition();
|
|
@@ -23226,9 +23264,6 @@ const TabTitle = class extends HTMLElement$1 {
|
|
|
23226
23264
|
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
|
23227
23265
|
/** determine if there is slotted text for styling purposes */
|
|
23228
23266
|
this.hasText = false;
|
|
23229
|
-
/**
|
|
23230
|
-
* @internal
|
|
23231
|
-
*/
|
|
23232
23267
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
23233
23268
|
}
|
|
23234
23269
|
activeTabChanged() {
|
|
@@ -23297,15 +23332,19 @@ const TabTitle = class extends HTMLElement$1 {
|
|
|
23297
23332
|
//
|
|
23298
23333
|
//--------------------------------------------------------------------------
|
|
23299
23334
|
tabChangeHandler(event) {
|
|
23300
|
-
|
|
23301
|
-
|
|
23302
|
-
|
|
23303
|
-
|
|
23304
|
-
|
|
23305
|
-
|
|
23306
|
-
|
|
23307
|
-
|
|
23308
|
-
|
|
23335
|
+
const targetTabsEl = event
|
|
23336
|
+
.composedPath()
|
|
23337
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
23338
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
|
23339
|
+
return;
|
|
23340
|
+
}
|
|
23341
|
+
if (this.tab) {
|
|
23342
|
+
this.active = this.tab === event.detail.tab;
|
|
23343
|
+
}
|
|
23344
|
+
else {
|
|
23345
|
+
this.getTabIndex().then((index) => {
|
|
23346
|
+
this.active = index === event.detail.tab;
|
|
23347
|
+
});
|
|
23309
23348
|
}
|
|
23310
23349
|
}
|
|
23311
23350
|
onClick() {
|
|
@@ -23423,14 +23462,12 @@ const Tabs = class extends HTMLElement$1 {
|
|
|
23423
23462
|
//
|
|
23424
23463
|
//--------------------------------------------------------------------------
|
|
23425
23464
|
/**
|
|
23426
|
-
* @internal
|
|
23427
23465
|
*
|
|
23428
23466
|
* Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
|
|
23429
23467
|
* attributes.
|
|
23430
23468
|
*/
|
|
23431
23469
|
this.titles = [];
|
|
23432
23470
|
/**
|
|
23433
|
-
* @internal
|
|
23434
23471
|
*
|
|
23435
23472
|
* Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
|
|
23436
23473
|
*/
|
|
@@ -23492,7 +23529,6 @@ const Tabs = class extends HTMLElement$1 {
|
|
|
23492
23529
|
//
|
|
23493
23530
|
//--------------------------------------------------------------------------
|
|
23494
23531
|
/**
|
|
23495
|
-
* @internal
|
|
23496
23532
|
*
|
|
23497
23533
|
* Matches up elements from the internal `tabs` and `titles` to automatically
|
|
23498
23534
|
* update the ARIA attributes and link `<calcite-tab>` and
|
|
@@ -755,20 +755,23 @@ const DatePickerMonthHeader = class {
|
|
|
755
755
|
* Increment year on UP/DOWN keys
|
|
756
756
|
*/
|
|
757
757
|
this.onYearKey = (e) => {
|
|
758
|
-
const
|
|
758
|
+
const localizedYear = e.target.value;
|
|
759
759
|
switch (e.key) {
|
|
760
760
|
case "ArrowDown":
|
|
761
761
|
e.preventDefault();
|
|
762
|
-
this.setYear(
|
|
762
|
+
this.setYear({ localizedYear, offset: -1 });
|
|
763
763
|
break;
|
|
764
764
|
case "ArrowUp":
|
|
765
765
|
e.preventDefault();
|
|
766
|
-
this.setYear(
|
|
766
|
+
this.setYear({ localizedYear, offset: 1 });
|
|
767
767
|
break;
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
|
-
this.
|
|
771
|
-
this.setYear(event.target.value);
|
|
770
|
+
this.onYearChange = (event) => {
|
|
771
|
+
this.setYear({ localizedYear: event.target.value });
|
|
772
|
+
};
|
|
773
|
+
this.onYearInput = (event) => {
|
|
774
|
+
this.setYear({ localizedYear: event.target.value, commit: false });
|
|
772
775
|
};
|
|
773
776
|
this.prevMonthClick = (e) => {
|
|
774
777
|
this.handleArrowClick(e, this.prevMonthDate);
|
|
@@ -824,7 +827,7 @@ const DatePickerMonthHeader = class {
|
|
|
824
827
|
return (h(Fragment, null, h("a", { "aria-disabled": (this.prevMonthDate.getMonth() === activeMonth).toString(), "aria-label": this.intlPrevMonth, class: "chevron", href: "#", onClick: this.prevMonthClick, onKeyDown: this.prevMonthKeydown, role: "button", tabindex: this.prevMonthDate.getMonth() === activeMonth ? -1 : 0 }, h("calcite-icon", { "flip-rtl": true, icon: "chevron-left", scale: iconScale })), h("div", { class: { text: true, "text--reverse": reverse } }, h(Heading, { class: "month", level: this.headingLevel }, localizedMonth), h("span", { class: "year-wrap" }, h("input", { "aria-label": this.intlYear, class: {
|
|
825
828
|
year: true,
|
|
826
829
|
"year--suffix": !!suffix
|
|
827
|
-
}, inputmode: "numeric", maxlength: "4", minlength: "1", onInput: this.
|
|
830
|
+
}, inputmode: "numeric", maxlength: "4", minlength: "1", onChange: this.onYearChange, onInput: this.onYearInput, onKeyDown: this.onYearKey, pattern: "\\d*", ref: (el) => (this.yearInput = el), type: "text", value: localizedYear }), suffix && (h("span", { class: "suffix" }, h("span", { "aria-hidden": "true", class: "suffix__invisible" }, localizedYear), " " + suffix)))), h("a", { "aria-disabled": (this.nextMonthDate.getMonth() === activeMonth).toString(), "aria-label": this.intlNextMonth, class: "chevron", href: "#", onClick: this.nextMonthClick, onKeyDown: this.nextMonthKeydown, role: "button", tabindex: this.nextMonthDate.getMonth() === activeMonth ? -1 : 0 }, h("calcite-icon", { "flip-rtl": true, icon: "chevron-right", scale: iconScale }))));
|
|
828
831
|
}
|
|
829
832
|
setNextPrevMonthDates() {
|
|
830
833
|
if (!this.activeDate) {
|
|
@@ -833,27 +836,32 @@ const DatePickerMonthHeader = class {
|
|
|
833
836
|
this.nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
|
|
834
837
|
this.prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
|
|
835
838
|
}
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
* set to active if in range
|
|
839
|
-
*/
|
|
840
|
-
setYear(localizedYear, increment = 0) {
|
|
841
|
-
const { min, max, activeDate, localeData, yearInput } = this;
|
|
839
|
+
getInRangeDate({ localizedYear, offset = 0 }) {
|
|
840
|
+
const { min, max, activeDate, localeData } = this;
|
|
842
841
|
const parsedYear = parseNumber(localizedYear, localeData);
|
|
843
842
|
const length = parsedYear.toString().length;
|
|
844
|
-
const year = isNaN(parsedYear) ? false : parsedYear +
|
|
843
|
+
const year = isNaN(parsedYear) ? false : parsedYear + offset;
|
|
845
844
|
const inRange = year && (!min || min.getFullYear() <= year) && (!max || max.getFullYear() >= year);
|
|
846
|
-
// if you've supplied a year and it's in range
|
|
845
|
+
// if you've supplied a year and it's in range
|
|
847
846
|
if (year && inRange && length === localizedYear.length) {
|
|
848
847
|
const nextDate = new Date(activeDate);
|
|
849
848
|
nextDate.setFullYear(year);
|
|
850
|
-
|
|
849
|
+
return dateFromRange(nextDate, min, max);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Parse localized year string from input,
|
|
854
|
+
* set to active if in range
|
|
855
|
+
*/
|
|
856
|
+
setYear({ localizedYear, commit = true, offset = 0 }) {
|
|
857
|
+
const { yearInput, activeDate, localeData } = this;
|
|
858
|
+
const inRangeDate = this.getInRangeDate({ localizedYear, offset });
|
|
859
|
+
// if you've supplied a year and it's in range, update active date
|
|
860
|
+
if (inRangeDate) {
|
|
851
861
|
this.calciteDatePickerSelect.emit(inRangeDate);
|
|
852
|
-
yearInput.value = localizeNumber(inRangeDate.getFullYear(), localeData);
|
|
853
862
|
}
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
yearInput.value = localizeNumber(activeDate.getFullYear(), localeData);
|
|
863
|
+
if (commit) {
|
|
864
|
+
yearInput.value = localizeNumber((inRangeDate || activeDate).getFullYear(), localeData);
|
|
857
865
|
}
|
|
858
866
|
}
|
|
859
867
|
get el() { return getElement(this); }
|