@esri/calcite-components 1.0.0-next.423 → 1.0.0-next.426
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-8e0dd0af.system.entry.js → p-0217c41b.system.entry.js} +1 -1
- package/dist/calcite/{p-afe59546.entry.js → p-2139226c.entry.js} +1 -1
- package/dist/calcite/p-62afcb36.system.js +1 -1
- package/dist/calcite/p-7b238036.entry.js +5 -0
- package/dist/calcite/p-b96b7c58.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-modal.cjs.entry.js +1 -1
- 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/modal/modal.js +1 -1
- 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-modal.js +1 -1
- 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 +59 -52
- package/dist/esm/calcite-date-picker_4.entry.js +27 -19
- package/dist/esm/calcite-modal.entry.js +1 -1
- 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-modal.entry.js +1 -1
- package/dist/esm-es5/calcite-tab_4.entry.js +1 -1
- package/dist/extras/docs-json.json +1 -1
- package/dist/types/components/date-picker-month-header/date-picker-month-header.d.ts +3 -1
- 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/hydrate/index.js +59 -52
- package/package.json +1 -1
- package/dist/calcite/p-1aeca42a.system.entry.js +0 -5
- package/dist/calcite/p-3915705c.entry.js +0 -5
- package/dist/calcite/p-9e61d89d.entry.js +0 -5
|
@@ -52,6 +52,9 @@ export class TabNav {
|
|
|
52
52
|
// Lifecycle
|
|
53
53
|
//
|
|
54
54
|
//--------------------------------------------------------------------------
|
|
55
|
+
connectedCallback() {
|
|
56
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
57
|
+
}
|
|
55
58
|
componentWillLoad() {
|
|
56
59
|
const storageKey = `calcite-tab-nav-${this.storageId}`;
|
|
57
60
|
if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
|
|
@@ -63,11 +66,11 @@ export class TabNav {
|
|
|
63
66
|
}
|
|
64
67
|
}
|
|
65
68
|
componentWillRender() {
|
|
66
|
-
|
|
67
|
-
this.layout =
|
|
68
|
-
this.position =
|
|
69
|
-
this.scale =
|
|
70
|
-
this.bordered =
|
|
69
|
+
const { parentTabsEl } = this;
|
|
70
|
+
this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
|
|
71
|
+
this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
|
|
72
|
+
this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
|
|
73
|
+
this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
|
|
71
74
|
// fix issue with active tab-title not lining up with blue indicator
|
|
72
75
|
if (this.selectedTabEl) {
|
|
73
76
|
this.updateOffsetPosition();
|
|
@@ -32,9 +32,6 @@ export class TabTitle {
|
|
|
32
32
|
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
|
33
33
|
/** determine if there is slotted text for styling purposes */
|
|
34
34
|
this.hasText = false;
|
|
35
|
-
/**
|
|
36
|
-
* @internal
|
|
37
|
-
*/
|
|
38
35
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
39
36
|
}
|
|
40
37
|
activeTabChanged() {
|
|
@@ -107,15 +104,19 @@ export class TabTitle {
|
|
|
107
104
|
//
|
|
108
105
|
//--------------------------------------------------------------------------
|
|
109
106
|
tabChangeHandler(event) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
107
|
+
const targetTabsEl = event
|
|
108
|
+
.composedPath()
|
|
109
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
110
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (this.tab) {
|
|
114
|
+
this.active = this.tab === event.detail.tab;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
this.getTabIndex().then((index) => {
|
|
118
|
+
this.active = index === event.detail.tab;
|
|
119
|
+
});
|
|
119
120
|
}
|
|
120
121
|
}
|
|
121
122
|
onClick() {
|
|
@@ -42,14 +42,12 @@ export class Tabs {
|
|
|
42
42
|
//
|
|
43
43
|
//--------------------------------------------------------------------------
|
|
44
44
|
/**
|
|
45
|
-
* @internal
|
|
46
45
|
*
|
|
47
46
|
* Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
|
|
48
47
|
* attributes.
|
|
49
48
|
*/
|
|
50
49
|
this.titles = [];
|
|
51
50
|
/**
|
|
52
|
-
* @internal
|
|
53
51
|
*
|
|
54
52
|
* Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
|
|
55
53
|
*/
|
|
@@ -114,7 +112,6 @@ export class Tabs {
|
|
|
114
112
|
//
|
|
115
113
|
//--------------------------------------------------------------------------
|
|
116
114
|
/**
|
|
117
|
-
* @internal
|
|
118
115
|
*
|
|
119
116
|
* Matches up elements from the internal `tabs` and `titles` to automatically
|
|
120
117
|
* update the ARIA attributes and link `<calcite-tab>` and
|
|
@@ -215,7 +215,7 @@ const Modal = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
215
215
|
});
|
|
216
216
|
};
|
|
217
217
|
this.focusFirstElement = () => {
|
|
218
|
-
focusElement(this.closeButtonEl);
|
|
218
|
+
focusElement(this.disableCloseButton ? getFocusableElements(this.el)[0] : this.closeButtonEl);
|
|
219
219
|
};
|
|
220
220
|
this.focusLastElement = () => {
|
|
221
221
|
const focusableElements = getFocusableElements(this.el).filter((el) => !el.getAttribute("data-focus-fence"));
|
|
@@ -24,20 +24,23 @@ const DatePickerMonthHeader = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
24
24
|
* Increment year on UP/DOWN keys
|
|
25
25
|
*/
|
|
26
26
|
this.onYearKey = (e) => {
|
|
27
|
-
const
|
|
27
|
+
const localizedYear = e.target.value;
|
|
28
28
|
switch (e.key) {
|
|
29
29
|
case "ArrowDown":
|
|
30
30
|
e.preventDefault();
|
|
31
|
-
this.setYear(
|
|
31
|
+
this.setYear({ localizedYear, offset: -1 });
|
|
32
32
|
break;
|
|
33
33
|
case "ArrowUp":
|
|
34
34
|
e.preventDefault();
|
|
35
|
-
this.setYear(
|
|
35
|
+
this.setYear({ localizedYear, offset: 1 });
|
|
36
36
|
break;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
this.
|
|
40
|
-
this.setYear(event.target.value);
|
|
39
|
+
this.onYearChange = (event) => {
|
|
40
|
+
this.setYear({ localizedYear: event.target.value });
|
|
41
|
+
};
|
|
42
|
+
this.onYearInput = (event) => {
|
|
43
|
+
this.setYear({ localizedYear: event.target.value, commit: false });
|
|
41
44
|
};
|
|
42
45
|
this.prevMonthClick = (e) => {
|
|
43
46
|
this.handleArrowClick(e, this.prevMonthDate);
|
|
@@ -93,7 +96,7 @@ const DatePickerMonthHeader = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
93
96
|
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: {
|
|
94
97
|
year: true,
|
|
95
98
|
"year--suffix": !!suffix
|
|
96
|
-
}, inputmode: "numeric", maxlength: "4", minlength: "1", onInput: this.
|
|
99
|
+
}, 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 }))));
|
|
97
100
|
}
|
|
98
101
|
setNextPrevMonthDates() {
|
|
99
102
|
if (!this.activeDate) {
|
|
@@ -102,27 +105,32 @@ const DatePickerMonthHeader = /*@__PURE__*/ proxyCustomElement(class extends HTM
|
|
|
102
105
|
this.nextMonthDate = dateFromRange(nextMonth(this.activeDate), this.min, this.max);
|
|
103
106
|
this.prevMonthDate = dateFromRange(prevMonth(this.activeDate), this.min, this.max);
|
|
104
107
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
* set to active if in range
|
|
108
|
-
*/
|
|
109
|
-
setYear(localizedYear, increment = 0) {
|
|
110
|
-
const { min, max, activeDate, localeData, yearInput } = this;
|
|
108
|
+
getInRangeDate({ localizedYear, offset = 0 }) {
|
|
109
|
+
const { min, max, activeDate, localeData } = this;
|
|
111
110
|
const parsedYear = parseNumber(localizedYear, localeData);
|
|
112
111
|
const length = parsedYear.toString().length;
|
|
113
|
-
const year = isNaN(parsedYear) ? false : parsedYear +
|
|
112
|
+
const year = isNaN(parsedYear) ? false : parsedYear + offset;
|
|
114
113
|
const inRange = year && (!min || min.getFullYear() <= year) && (!max || max.getFullYear() >= year);
|
|
115
|
-
// if you've supplied a year and it's in range
|
|
114
|
+
// if you've supplied a year and it's in range
|
|
116
115
|
if (year && inRange && length === localizedYear.length) {
|
|
117
116
|
const nextDate = new Date(activeDate);
|
|
118
117
|
nextDate.setFullYear(year);
|
|
119
|
-
|
|
118
|
+
return dateFromRange(nextDate, min, max);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parse localized year string from input,
|
|
123
|
+
* set to active if in range
|
|
124
|
+
*/
|
|
125
|
+
setYear({ localizedYear, commit = true, offset = 0 }) {
|
|
126
|
+
const { yearInput, activeDate, localeData } = this;
|
|
127
|
+
const inRangeDate = this.getInRangeDate({ localizedYear, offset });
|
|
128
|
+
// if you've supplied a year and it's in range, update active date
|
|
129
|
+
if (inRangeDate) {
|
|
120
130
|
this.calciteDatePickerSelect.emit(inRangeDate);
|
|
121
|
-
yearInput.value = localizeNumber(inRangeDate.getFullYear(), localeData);
|
|
122
131
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
yearInput.value = localizeNumber(activeDate.getFullYear(), localeData);
|
|
132
|
+
if (commit) {
|
|
133
|
+
yearInput.value = localizeNumber((inRangeDate || activeDate).getFullYear(), localeData);
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
136
|
get el() { return this; }
|
|
@@ -56,6 +56,9 @@ const TabNav = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
56
56
|
// Lifecycle
|
|
57
57
|
//
|
|
58
58
|
//--------------------------------------------------------------------------
|
|
59
|
+
connectedCallback() {
|
|
60
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
61
|
+
}
|
|
59
62
|
componentWillLoad() {
|
|
60
63
|
const storageKey = `calcite-tab-nav-${this.storageId}`;
|
|
61
64
|
if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
|
|
@@ -67,11 +70,11 @@ const TabNav = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
67
70
|
}
|
|
68
71
|
}
|
|
69
72
|
componentWillRender() {
|
|
70
|
-
|
|
71
|
-
this.layout =
|
|
72
|
-
this.position =
|
|
73
|
-
this.scale =
|
|
74
|
-
this.bordered =
|
|
73
|
+
const { parentTabsEl } = this;
|
|
74
|
+
this.layout = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.layout;
|
|
75
|
+
this.position = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.position;
|
|
76
|
+
this.scale = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.scale;
|
|
77
|
+
this.bordered = parentTabsEl === null || parentTabsEl === void 0 ? void 0 : parentTabsEl.bordered;
|
|
75
78
|
// fix issue with active tab-title not lining up with blue indicator
|
|
76
79
|
if (this.selectedTabEl) {
|
|
77
80
|
this.updateOffsetPosition();
|
|
@@ -40,9 +40,6 @@ const TabTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
40
40
|
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
|
41
41
|
/** determine if there is slotted text for styling purposes */
|
|
42
42
|
this.hasText = false;
|
|
43
|
-
/**
|
|
44
|
-
* @internal
|
|
45
|
-
*/
|
|
46
43
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
47
44
|
}
|
|
48
45
|
activeTabChanged() {
|
|
@@ -111,15 +108,19 @@ const TabTitle = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
111
108
|
//
|
|
112
109
|
//--------------------------------------------------------------------------
|
|
113
110
|
tabChangeHandler(event) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
111
|
+
const targetTabsEl = event
|
|
112
|
+
.composedPath()
|
|
113
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
114
|
+
if (targetTabsEl !== this.parentTabsEl) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
if (this.tab) {
|
|
118
|
+
this.active = this.tab === event.detail.tab;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
this.getTabIndex().then((index) => {
|
|
122
|
+
this.active = index === event.detail.tab;
|
|
123
|
+
});
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
onClick() {
|
package/dist/components/tab.js
CHANGED
|
@@ -20,14 +20,6 @@ const Tab = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
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 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
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 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
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) {
|
package/dist/components/tabs.js
CHANGED
|
@@ -47,14 +47,12 @@ const Tabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
47
47
|
//
|
|
48
48
|
//--------------------------------------------------------------------------
|
|
49
49
|
/**
|
|
50
|
-
* @internal
|
|
51
50
|
*
|
|
52
51
|
* Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
|
|
53
52
|
* attributes.
|
|
54
53
|
*/
|
|
55
54
|
this.titles = [];
|
|
56
55
|
/**
|
|
57
|
-
* @internal
|
|
58
56
|
*
|
|
59
57
|
* Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
|
|
60
58
|
*/
|
|
@@ -116,7 +114,6 @@ const Tabs = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
116
114
|
//
|
|
117
115
|
//--------------------------------------------------------------------------
|
|
118
116
|
/**
|
|
119
|
-
* @internal
|
|
120
117
|
*
|
|
121
118
|
* Matches up elements from the internal `tabs` and `titles` to automatically
|
|
122
119
|
* update the ARIA attributes and link `<calcite-tab>` and
|
|
@@ -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; }
|
|
@@ -15237,7 +15245,7 @@ const Modal = class extends HTMLElement$1 {
|
|
|
15237
15245
|
});
|
|
15238
15246
|
};
|
|
15239
15247
|
this.focusFirstElement = () => {
|
|
15240
|
-
focusElement(this.closeButtonEl);
|
|
15248
|
+
focusElement(this.disableCloseButton ? getFocusableElements(this.el)[0] : this.closeButtonEl);
|
|
15241
15249
|
};
|
|
15242
15250
|
this.focusLastElement = () => {
|
|
15243
15251
|
const focusableElements = getFocusableElements(this.el).filter((el) => !el.getAttribute("data-focus-fence"));
|
|
@@ -22966,14 +22974,6 @@ const Tab = class extends HTMLElement$1 {
|
|
|
22966
22974
|
this.active = false;
|
|
22967
22975
|
/** @internal Parent tabs component scale value */
|
|
22968
22976
|
this.scale = "m";
|
|
22969
|
-
//--------------------------------------------------------------------------
|
|
22970
|
-
//
|
|
22971
|
-
// Private State/Props
|
|
22972
|
-
//
|
|
22973
|
-
//--------------------------------------------------------------------------
|
|
22974
|
-
/**
|
|
22975
|
-
* @internal
|
|
22976
|
-
*/
|
|
22977
22977
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
22978
22978
|
}
|
|
22979
22979
|
//--------------------------------------------------------------------------
|
|
@@ -22985,12 +22985,15 @@ const Tab = class extends HTMLElement$1 {
|
|
|
22985
22985
|
const id = this.el.id || this.guid;
|
|
22986
22986
|
return (h(Host, { "aria-expanded": this.active.toString(), "aria-labelledby": this.labeledBy, id: id, role: "tabpanel" }, h("section", null, h("slot", null))));
|
|
22987
22987
|
}
|
|
22988
|
+
connectedCallback() {
|
|
22989
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
22990
|
+
}
|
|
22988
22991
|
componentDidLoad() {
|
|
22989
22992
|
this.calciteTabRegister.emit();
|
|
22990
22993
|
}
|
|
22991
22994
|
componentWillRender() {
|
|
22992
22995
|
var _a;
|
|
22993
|
-
this.scale = (_a = this.
|
|
22996
|
+
this.scale = (_a = this.parentTabsEl) === null || _a === void 0 ? void 0 : _a.scale;
|
|
22994
22997
|
}
|
|
22995
22998
|
disconnectedCallback() {
|
|
22996
22999
|
var _a;
|
|
@@ -23005,10 +23008,13 @@ const Tab = class extends HTMLElement$1 {
|
|
|
23005
23008
|
//
|
|
23006
23009
|
//--------------------------------------------------------------------------
|
|
23007
23010
|
tabChangeHandler(event) {
|
|
23011
|
+
const targetTabsEl = event
|
|
23012
|
+
.composedPath()
|
|
23013
|
+
.find((el) => el.tagName === "CALCITE-TABS");
|
|
23008
23014
|
// to allow `<calcite-tabs>` to be nested we need to make sure this
|
|
23009
|
-
// `calciteTabChange` event was actually fired from a
|
|
23010
|
-
//
|
|
23011
|
-
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) {
|
|
23012
23018
|
return;
|
|
23013
23019
|
}
|
|
23014
23020
|
if (this.tab) {
|
|
@@ -23097,6 +23103,9 @@ const TabNav = class extends HTMLElement$1 {
|
|
|
23097
23103
|
// Lifecycle
|
|
23098
23104
|
//
|
|
23099
23105
|
//--------------------------------------------------------------------------
|
|
23106
|
+
connectedCallback() {
|
|
23107
|
+
this.parentTabsEl = this.el.closest("calcite-tabs");
|
|
23108
|
+
}
|
|
23100
23109
|
componentWillLoad() {
|
|
23101
23110
|
const storageKey = `calcite-tab-nav-${this.storageId}`;
|
|
23102
23111
|
if (localStorage && this.storageId && localStorage.getItem(storageKey)) {
|
|
@@ -23108,11 +23117,11 @@ const TabNav = class extends HTMLElement$1 {
|
|
|
23108
23117
|
}
|
|
23109
23118
|
}
|
|
23110
23119
|
componentWillRender() {
|
|
23111
|
-
|
|
23112
|
-
this.layout =
|
|
23113
|
-
this.position =
|
|
23114
|
-
this.scale =
|
|
23115
|
-
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;
|
|
23116
23125
|
// fix issue with active tab-title not lining up with blue indicator
|
|
23117
23126
|
if (this.selectedTabEl) {
|
|
23118
23127
|
this.updateOffsetPosition();
|
|
@@ -23255,9 +23264,6 @@ const TabTitle = class extends HTMLElement$1 {
|
|
|
23255
23264
|
this.mutationObserver = createObserver("mutation", () => this.updateHasText());
|
|
23256
23265
|
/** determine if there is slotted text for styling purposes */
|
|
23257
23266
|
this.hasText = false;
|
|
23258
|
-
/**
|
|
23259
|
-
* @internal
|
|
23260
|
-
*/
|
|
23261
23267
|
this.guid = `calcite-tab-title-${guid()}`;
|
|
23262
23268
|
}
|
|
23263
23269
|
activeTabChanged() {
|
|
@@ -23326,15 +23332,19 @@ const TabTitle = class extends HTMLElement$1 {
|
|
|
23326
23332
|
//
|
|
23327
23333
|
//--------------------------------------------------------------------------
|
|
23328
23334
|
tabChangeHandler(event) {
|
|
23329
|
-
|
|
23330
|
-
|
|
23331
|
-
|
|
23332
|
-
|
|
23333
|
-
|
|
23334
|
-
|
|
23335
|
-
|
|
23336
|
-
|
|
23337
|
-
|
|
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
|
+
});
|
|
23338
23348
|
}
|
|
23339
23349
|
}
|
|
23340
23350
|
onClick() {
|
|
@@ -23452,14 +23462,12 @@ const Tabs = class extends HTMLElement$1 {
|
|
|
23452
23462
|
//
|
|
23453
23463
|
//--------------------------------------------------------------------------
|
|
23454
23464
|
/**
|
|
23455
|
-
* @internal
|
|
23456
23465
|
*
|
|
23457
23466
|
* Stores an array of ids of `<calcite-tab-titles>`s to match up ARIA
|
|
23458
23467
|
* attributes.
|
|
23459
23468
|
*/
|
|
23460
23469
|
this.titles = [];
|
|
23461
23470
|
/**
|
|
23462
|
-
* @internal
|
|
23463
23471
|
*
|
|
23464
23472
|
* Stores an array of ids of `<calcite-tab>`s to match up ARIA attributes.
|
|
23465
23473
|
*/
|
|
@@ -23521,7 +23529,6 @@ const Tabs = class extends HTMLElement$1 {
|
|
|
23521
23529
|
//
|
|
23522
23530
|
//--------------------------------------------------------------------------
|
|
23523
23531
|
/**
|
|
23524
|
-
* @internal
|
|
23525
23532
|
*
|
|
23526
23533
|
* Matches up elements from the internal `tabs` and `titles` to automatically
|
|
23527
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); }
|