@esri/calcite-components 1.0.0-next.317 → 1.0.0-next.320
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/assets/calcite-icon/centerAlign16.json +1 -0
- package/dist/calcite/assets/calcite-icon/centerAlign24.json +1 -0
- package/dist/calcite/assets/calcite-icon/centerAlign32.json +1 -0
- package/dist/calcite/assets/calcite-icon/convert16.json +1 -0
- package/dist/calcite/assets/calcite-icon/convert24.json +1 -0
- package/dist/calcite/assets/calcite-icon/convert32.json +1 -0
- package/dist/calcite/assets/calcite-icon/formDropdown16.json +1 -0
- package/dist/calcite/assets/calcite-icon/formDropdown24.json +1 -0
- package/dist/calcite/assets/calcite-icon/formDropdown32.json +1 -0
- package/dist/calcite/assets/calcite-icon/language16.json +1 -0
- package/dist/calcite/assets/calcite-icon/language24.json +1 -0
- package/dist/calcite/assets/calcite-icon/language32.json +1 -0
- package/dist/calcite/assets/calcite-icon/languageTranslate16.json +1 -0
- package/dist/calcite/assets/calcite-icon/languageTranslate24.json +1 -0
- package/dist/calcite/assets/calcite-icon/languageTranslate32.json +1 -0
- package/dist/calcite/assets/calcite-icon/leftAlign16.json +1 -0
- package/dist/calcite/assets/calcite-icon/leftAlign24.json +1 -0
- package/dist/calcite/assets/calcite-icon/leftAlign32.json +1 -0
- package/dist/calcite/assets/calcite-icon/terminal16.json +1 -0
- package/dist/calcite/assets/calcite-icon/terminal24.json +1 -0
- package/dist/calcite/assets/calcite-icon/terminal32.json +1 -0
- package/dist/calcite/assets/calcite-icon/touch16.json +1 -0
- package/dist/calcite/assets/calcite-icon/touch24.json +1 -0
- package/dist/calcite/assets/calcite-icon/touch32.json +1 -0
- package/dist/calcite/calcite.esm.js +1 -1
- package/dist/calcite/p-1480eb2d.entry.js +5 -0
- package/dist/calcite/p-2cd9d307.entry.js +5 -0
- package/dist/calcite/p-6e050609.entry.js +5 -0
- package/dist/calcite/p-8e252799.system.js +1 -1
- package/dist/calcite/p-96bbc815.system.entry.js +5 -0
- package/dist/calcite/p-cb55c32c.system.entry.js +5 -0
- package/dist/calcite/p-e817ded0.entry.js +5 -0
- package/dist/calcite/{p-44a07313.system.entry.js → p-f7b5dd98.system.entry.js} +1 -1
- package/dist/calcite/p-fa9a1d8f.system.entry.js +5 -0
- package/dist/cjs/calcite-action-bar.cjs.entry.js +24 -0
- package/dist/cjs/calcite-color-picker_3.cjs.entry.js +3 -3
- package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +349 -223
- package/dist/cjs/calcite-panel.cjs.entry.js +3 -3
- package/dist/cjs/calcite.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/calcite-action-bar/calcite-action-bar.js +3 -0
- package/dist/collection/components/calcite-filter/calcite-filter.js +1 -1
- package/dist/collection/components/calcite-icon/assets/calcite-icon/centerAlign16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/centerAlign24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/centerAlign32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/convert16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/convert24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/convert32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/formDropdown16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/formDropdown24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/formDropdown32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/language16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/language24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/language32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/languageTranslate16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/languageTranslate24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/languageTranslate32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/leftAlign16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/leftAlign24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/leftAlign32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/terminal16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/terminal24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/terminal32.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/touch16.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/touch24.json +1 -0
- package/dist/collection/components/calcite-icon/assets/calcite-icon/touch32.json +1 -0
- package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +81 -76
- package/dist/collection/components/calcite-panel/calcite-panel.js +3 -3
- package/dist/collection/components/calcite-time-picker/calcite-time-picker.css +56 -91
- package/dist/collection/components/calcite-time-picker/calcite-time-picker.js +254 -289
- package/dist/collection/components/calcite-time-picker/resources.js +15 -9
- package/dist/collection/utils/conditionalSlot.js +26 -0
- package/dist/collection/utils/time.js +144 -36
- package/dist/components/calcite-action-bar.js +25 -1
- package/dist/components/calcite-color-picker-swatch2.js +3 -3
- package/dist/components/calcite-input-time-picker.js +51 -48
- package/dist/components/calcite-panel.js +3 -3
- package/dist/components/calcite-time-picker2.js +320 -187
- package/dist/custom-elements/index.js +381 -231
- package/dist/esm/calcite-action-bar.entry.js +25 -1
- package/dist/esm/calcite-color-picker_3.entry.js +3 -3
- package/dist/esm/calcite-input-time-picker_2.entry.js +349 -223
- package/dist/esm/calcite-panel.entry.js +3 -3
- package/dist/esm/calcite.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/calcite-action-bar.entry.js +1 -1
- package/dist/esm-es5/calcite-color-picker_3.entry.js +1 -1
- package/dist/esm-es5/calcite-input-time-picker_2.entry.js +2 -2
- package/dist/esm-es5/calcite-panel.entry.js +1 -1
- package/dist/esm-es5/calcite.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/extras/docs-json.json +23 -101
- package/dist/types/components/calcite-action-bar/calcite-action-bar.d.ts +2 -1
- package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +12 -4
- package/dist/types/components/calcite-panel/calcite-panel.d.ts +1 -1
- package/dist/types/components/calcite-time-picker/calcite-time-picker.d.ts +35 -23
- package/dist/types/components/calcite-time-picker/resources.d.ts +14 -8
- package/dist/types/components.d.ts +17 -41
- package/dist/types/utils/conditionalSlot.d.ts +17 -0
- package/dist/types/utils/time.d.ts +18 -5
- package/hydrate/index.js +399 -239
- package/package.json +11 -11
- package/readme.md +2 -2
- package/dist/calcite/p-12a9599d.system.entry.js +0 -5
- package/dist/calcite/p-88784777.system.entry.js +0 -5
- package/dist/calcite/p-9634f89d.entry.js +0 -5
- package/dist/calcite/p-b37b7b9e.system.entry.js +0 -5
- package/dist/calcite/p-e1da1646.entry.js +0 -5
- package/dist/calcite/p-e78e743b.entry.js +0 -5
- package/dist/calcite/p-f333e31b.entry.js +0 -5
|
@@ -3,26 +3,32 @@
|
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
5
|
export const CSS = {
|
|
6
|
+
button: "button",
|
|
6
7
|
buttonBottomLeft: "button--bottom-left",
|
|
7
8
|
buttonBottomRight: "button--bottom-right",
|
|
8
|
-
button: "button",
|
|
9
|
-
delimiter: "delimiter",
|
|
10
|
-
hour: "hour",
|
|
11
9
|
buttonHourDown: "button--hour-down",
|
|
12
10
|
buttonHourUp: "button--hour-up",
|
|
13
|
-
input: "input",
|
|
14
|
-
meridiem: "meridiem",
|
|
15
11
|
buttonMeridiemDown: "button--meridiem-down",
|
|
16
12
|
buttonMeridiemUp: "button--meridiem-up",
|
|
17
|
-
minute: "minute",
|
|
18
13
|
buttonMinuteDown: "button--minute-down",
|
|
19
14
|
buttonMinuteUp: "button--minute-up",
|
|
20
|
-
second: "second",
|
|
21
15
|
buttonSecondDown: "button--second-down",
|
|
22
16
|
buttonSecondUp: "button--second-up",
|
|
23
|
-
timePicker: "time-picker",
|
|
24
17
|
buttonTopLeft: "button--top-left",
|
|
25
|
-
buttonTopRight: "button--top-right"
|
|
18
|
+
buttonTopRight: "button--top-right",
|
|
19
|
+
column: "column",
|
|
20
|
+
delimiter: "delimiter",
|
|
21
|
+
hour: "hour",
|
|
22
|
+
input: "input",
|
|
23
|
+
meridiem: "meridiem",
|
|
24
|
+
minute: "minute",
|
|
25
|
+
second: "second",
|
|
26
|
+
showMeridiem: "show-meridiem",
|
|
27
|
+
showSecond: "show-second",
|
|
28
|
+
"scale-s": "scale-s",
|
|
29
|
+
"scale-m": "scale-m",
|
|
30
|
+
"scale-l": "scale-l",
|
|
31
|
+
timePicker: "time-picker"
|
|
26
32
|
};
|
|
27
33
|
export const TEXT = {
|
|
28
34
|
hour: "Hour",
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
|
+
*/
|
|
5
|
+
import { forceUpdate } from "@stencil/core";
|
|
6
|
+
const slotChangedMap = new WeakMap();
|
|
7
|
+
function onSlotChange() {
|
|
8
|
+
forceUpdate(this);
|
|
9
|
+
}
|
|
10
|
+
const eventType = "slotchange";
|
|
11
|
+
/**
|
|
12
|
+
* Helper to set up a conditional slot component on connectedCallback.
|
|
13
|
+
*/
|
|
14
|
+
export function connectConditionalSlotComponent(component) {
|
|
15
|
+
const boundSlotChange = onSlotChange.bind(component);
|
|
16
|
+
component.el.shadowRoot.addEventListener(eventType, boundSlotChange);
|
|
17
|
+
slotChangedMap.set(component, boundSlotChange);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Helper to tear down a conditional slot component on disconnectedCallback.
|
|
21
|
+
*/
|
|
22
|
+
export function disconnectConditionalSlotComponent(component) {
|
|
23
|
+
const boundSlotChange = slotChangedMap.get(component);
|
|
24
|
+
component.el.shadowRoot.removeEventListener(eventType, boundSlotChange);
|
|
25
|
+
slotChangedMap.delete(component);
|
|
26
|
+
}
|
|
@@ -4,6 +4,72 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { isValidNumber } from "./number";
|
|
6
6
|
export const maxTenthForMinuteAndSecond = 5;
|
|
7
|
+
function createLocaleDateTimeFormatter(locale, includeSeconds = true) {
|
|
8
|
+
try {
|
|
9
|
+
const options = {
|
|
10
|
+
hour: "2-digit",
|
|
11
|
+
minute: "2-digit",
|
|
12
|
+
timeZone: "UTC"
|
|
13
|
+
};
|
|
14
|
+
if (includeSeconds) {
|
|
15
|
+
options.second = "2-digit";
|
|
16
|
+
}
|
|
17
|
+
return new Intl.DateTimeFormat(locale, options);
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
throw new Error(`Invalid locale supplied while attempting to create a DateTime formatter: ${locale}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export function formatTimePart(number) {
|
|
24
|
+
const numberAsString = number.toString();
|
|
25
|
+
return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
|
|
26
|
+
}
|
|
27
|
+
export function formatTimeString(value) {
|
|
28
|
+
if (!isValidTime(value)) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const [hourString, minuteString, secondString] = value.split(":");
|
|
32
|
+
const hour = formatTimePart(parseInt(hourString));
|
|
33
|
+
const minute = formatTimePart(parseInt(minuteString));
|
|
34
|
+
if (secondString) {
|
|
35
|
+
const second = formatTimePart(parseInt(secondString));
|
|
36
|
+
return `${hour}:${minute}:${second}`;
|
|
37
|
+
}
|
|
38
|
+
return `${hour}:${minute}`;
|
|
39
|
+
}
|
|
40
|
+
export function getLocaleHourCycle(locale) {
|
|
41
|
+
const formatter = createLocaleDateTimeFormatter(locale);
|
|
42
|
+
const parts = formatter.formatToParts(new Date(Date.UTC(0, 0, 0, 0, 0, 0)));
|
|
43
|
+
return getLocalizedTimePart("meridiem", parts) ? "12" : "24";
|
|
44
|
+
}
|
|
45
|
+
function getLocalizedTimePart(part, parts) {
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
if (!part || !parts) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
if (part === "hourSuffix") {
|
|
51
|
+
const hourIndex = parts.indexOf(parts.find(({ type }) => type === "hour"));
|
|
52
|
+
const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
|
|
53
|
+
const hourSuffix = parts[hourIndex + 1];
|
|
54
|
+
return hourSuffix && hourSuffix.type === "literal" && minuteIndex - hourIndex === 2
|
|
55
|
+
? ((_a = hourSuffix.value) === null || _a === void 0 ? void 0 : _a.trim()) || null
|
|
56
|
+
: null;
|
|
57
|
+
}
|
|
58
|
+
if (part === "minuteSuffix") {
|
|
59
|
+
const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
|
|
60
|
+
const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
|
|
61
|
+
const minuteSuffix = parts[minuteIndex + 1];
|
|
62
|
+
return minuteSuffix && minuteSuffix.type === "literal" && secondIndex - minuteIndex === 2
|
|
63
|
+
? ((_b = minuteSuffix.value) === null || _b === void 0 ? void 0 : _b.trim()) || null
|
|
64
|
+
: null;
|
|
65
|
+
}
|
|
66
|
+
if (part === "secondSuffix") {
|
|
67
|
+
const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
|
|
68
|
+
const secondSuffix = parts[secondIndex + 1];
|
|
69
|
+
return secondSuffix && secondSuffix.type === "literal" ? ((_c = secondSuffix.value) === null || _c === void 0 ? void 0 : _c.trim()) || null : null;
|
|
70
|
+
}
|
|
71
|
+
return ((_d = parts.find(({ type }) => (part == "meridiem" ? type === "dayPeriod" : type === part))) === null || _d === void 0 ? void 0 : _d.value) || null;
|
|
72
|
+
}
|
|
7
73
|
export function getMeridiem(hour) {
|
|
8
74
|
if (!isValidNumber(hour)) {
|
|
9
75
|
return null;
|
|
@@ -11,49 +77,91 @@ export function getMeridiem(hour) {
|
|
|
11
77
|
const hourAsNumber = parseInt(hour);
|
|
12
78
|
return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
|
|
13
79
|
}
|
|
14
|
-
export function
|
|
15
|
-
if (!
|
|
16
|
-
return
|
|
80
|
+
export function isValidTime(value) {
|
|
81
|
+
if (!value || value.startsWith(":") || value.endsWith(":")) {
|
|
82
|
+
return false;
|
|
17
83
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
84
|
+
const splitValue = value.split(":");
|
|
85
|
+
const validLength = splitValue.length > 1 && splitValue.length < 4;
|
|
86
|
+
if (!validLength) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const [hour, minute, second] = splitValue;
|
|
90
|
+
const hourAsNumber = parseInt(splitValue[0]);
|
|
91
|
+
const minuteAsNumber = parseInt(splitValue[1]);
|
|
92
|
+
const secondAsNumber = parseInt(splitValue[2]);
|
|
93
|
+
const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
|
|
94
|
+
const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
|
|
95
|
+
const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
|
|
96
|
+
if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
|
|
97
|
+
return true;
|
|
21
98
|
}
|
|
22
|
-
return hourAsNumber > 12 ? formatTimePart(hourAsNumber - 12) : hour;
|
|
23
99
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
100
|
+
function isValidTimePart(value, part) {
|
|
101
|
+
if (part === "meridiem") {
|
|
102
|
+
return value === "AM" || value === "PM";
|
|
103
|
+
}
|
|
104
|
+
if (!isValidNumber(value)) {
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
const valueAsNumber = Number(value);
|
|
108
|
+
return part === "hour" ? valueAsNumber >= 0 && valueAsNumber < 24 : valueAsNumber >= 0 && valueAsNumber < 60;
|
|
32
109
|
}
|
|
33
|
-
export function
|
|
34
|
-
if (!value
|
|
110
|
+
export function localizeTimePart(value, part, locale) {
|
|
111
|
+
if (!isValidTimePart(value, part)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const valueAsNumber = parseInt(value);
|
|
115
|
+
const date = new Date(Date.UTC(0, 0, 0, part === "hour" ? valueAsNumber : part === "meridiem" ? (value === "AM" ? 0 : 12) : 0, part === "minute" ? valueAsNumber : 0, part === "second" ? valueAsNumber : 0));
|
|
116
|
+
if (!date) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const formatter = createLocaleDateTimeFormatter(locale);
|
|
120
|
+
const parts = formatter.formatToParts(date);
|
|
121
|
+
return getLocalizedTimePart(part, parts);
|
|
122
|
+
}
|
|
123
|
+
export function localizeTimeString(value, locale = "en", includeSeconds = true) {
|
|
124
|
+
if (!isValidTime(value)) {
|
|
35
125
|
return null;
|
|
36
126
|
}
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
127
|
+
const { hour, minute, second = "0" } = parseTimeString(value);
|
|
128
|
+
const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
|
|
129
|
+
const formatter = createLocaleDateTimeFormatter(locale, includeSeconds);
|
|
130
|
+
return (formatter === null || formatter === void 0 ? void 0 : formatter.format(dateFromTimeString)) || null;
|
|
131
|
+
}
|
|
132
|
+
export function localizeTimeStringToParts(value, locale = "en") {
|
|
133
|
+
if (!isValidTime(value)) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const { hour, minute, second = "0" } = parseTimeString(value);
|
|
137
|
+
const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
|
|
138
|
+
if (dateFromTimeString) {
|
|
139
|
+
const formatter = createLocaleDateTimeFormatter(locale);
|
|
140
|
+
const parts = formatter.formatToParts(dateFromTimeString);
|
|
141
|
+
return {
|
|
142
|
+
localizedHour: getLocalizedTimePart("hour", parts),
|
|
143
|
+
localizedHourSuffix: getLocalizedTimePart("hourSuffix", parts),
|
|
144
|
+
localizedMinute: getLocalizedTimePart("minute", parts),
|
|
145
|
+
localizedMinuteSuffix: getLocalizedTimePart("minuteSuffix", parts),
|
|
146
|
+
localizedSecond: getLocalizedTimePart("second", parts),
|
|
147
|
+
localizedSecondSuffix: getLocalizedTimePart("secondSuffix", parts),
|
|
148
|
+
localizedMeridiem: getLocalizedTimePart("meridiem", parts)
|
|
149
|
+
};
|
|
53
150
|
}
|
|
54
151
|
return null;
|
|
55
152
|
}
|
|
56
|
-
export function
|
|
57
|
-
|
|
58
|
-
|
|
153
|
+
export function parseTimeString(value) {
|
|
154
|
+
if (isValidTime(value)) {
|
|
155
|
+
const [hour, minute, second] = value.split(":");
|
|
156
|
+
return {
|
|
157
|
+
hour,
|
|
158
|
+
minute,
|
|
159
|
+
second
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
hour: null,
|
|
164
|
+
minute: null,
|
|
165
|
+
second: null
|
|
166
|
+
};
|
|
59
167
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
* See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
|
|
4
4
|
*/
|
|
5
|
-
import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
|
5
|
+
import { forceUpdate, HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
|
6
6
|
import { t as toggleChildActionText, C as CalciteExpandToggle, o as overflowActionsDebounceInMs, q as queryActions, a as overflowActions, g as getOverflowCount } from './CalciteExpandToggle.js';
|
|
7
7
|
import { f as focusElement, b as getSlotted } from './dom.js';
|
|
8
8
|
import { c as createObserver } from './observers.js';
|
|
@@ -27,6 +27,28 @@ const TEXT = {
|
|
|
27
27
|
collapse: "Collapse"
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const slotChangedMap = new WeakMap();
|
|
31
|
+
function onSlotChange() {
|
|
32
|
+
forceUpdate(this);
|
|
33
|
+
}
|
|
34
|
+
const eventType = "slotchange";
|
|
35
|
+
/**
|
|
36
|
+
* Helper to set up a conditional slot component on connectedCallback.
|
|
37
|
+
*/
|
|
38
|
+
function connectConditionalSlotComponent(component) {
|
|
39
|
+
const boundSlotChange = onSlotChange.bind(component);
|
|
40
|
+
component.el.shadowRoot.addEventListener(eventType, boundSlotChange);
|
|
41
|
+
slotChangedMap.set(component, boundSlotChange);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Helper to tear down a conditional slot component on disconnectedCallback.
|
|
45
|
+
*/
|
|
46
|
+
function disconnectConditionalSlotComponent(component) {
|
|
47
|
+
const boundSlotChange = slotChangedMap.get(component);
|
|
48
|
+
component.el.shadowRoot.removeEventListener(eventType, boundSlotChange);
|
|
49
|
+
slotChangedMap.delete(component);
|
|
50
|
+
}
|
|
51
|
+
|
|
30
52
|
const calciteActionBarCss = "@-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:300ms}.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}:host{-webkit-box-sizing:border-box;box-sizing:border-box;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2);font-size:var(--calcite-font-size--1)}:host *{-webkit-box-sizing:border-box;box-sizing:border-box}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{-ms-flex-item-align:stretch;align-self:stretch;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-direction:column;flex-direction:column;pointer-events:auto;max-width:15vw}:host([overflow-actions-disabled]){overflow-y:auto}:host([expanded]){max-width:20vw}::slotted(calcite-action-group){border-width:0;border-bottom-width:1px;border-style:solid;border-color:var(--calcite-ui-border-2)}::slotted(calcite-action-group:last-child){border-bottom-width:0}.action-group--bottom{padding-bottom:0;-ms-flex-positive:1;flex-grow:1;-ms-flex-pack:end;justify-content:flex-end}";
|
|
31
53
|
|
|
32
54
|
let CalciteActionBar$1 = class extends HTMLElement {
|
|
@@ -152,11 +174,13 @@ let CalciteActionBar$1 = class extends HTMLElement {
|
|
|
152
174
|
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.observe(el);
|
|
153
175
|
}
|
|
154
176
|
this.conditionallyOverflowActions();
|
|
177
|
+
connectConditionalSlotComponent(this);
|
|
155
178
|
}
|
|
156
179
|
disconnectedCallback() {
|
|
157
180
|
var _a, _b;
|
|
158
181
|
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
159
182
|
(_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
183
|
+
disconnectConditionalSlotComponent(this);
|
|
160
184
|
}
|
|
161
185
|
// --------------------------------------------------------------------------
|
|
162
186
|
//
|
|
@@ -264,7 +264,7 @@ cs.get.rgb = function (string) {
|
|
|
264
264
|
|
|
265
265
|
var abbr = /^#([a-f0-9]{3,4})$/i;
|
|
266
266
|
var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
|
|
267
|
-
var rgba = /^rgba?\(\s*([+-]?\d+)\s
|
|
267
|
+
var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
268
268
|
var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
|
|
269
269
|
var keyword = /^(\w+)$/;
|
|
270
270
|
|
|
@@ -351,7 +351,7 @@ cs.get.hsl = function (string) {
|
|
|
351
351
|
return null;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?[\d
|
|
354
|
+
var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
355
355
|
var match = string.match(hsl);
|
|
356
356
|
|
|
357
357
|
if (match) {
|
|
@@ -372,7 +372,7 @@ cs.get.hwb = function (string) {
|
|
|
372
372
|
return null;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d
|
|
375
|
+
var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
|
|
376
376
|
var match = string.match(hwb);
|
|
377
377
|
|
|
378
378
|
if (match) {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { HTMLElement, createEvent, h, Host, proxyCustomElement } from '@stencil/core/internal/client';
|
|
6
6
|
import { g as guid } from './guid.js';
|
|
7
|
-
import {
|
|
7
|
+
import { l as localizeTimeString, f as formatTimeString, i as isValidTime, d as defineCustomElement$2 } from './calcite-time-picker2.js';
|
|
8
8
|
import { c as connectLabel, d as disconnectLabel, g as getLabelText } from './label.js';
|
|
9
9
|
import { c as connectForm, d as disconnectForm, H as HiddenFormInputSlot } from './form.js';
|
|
10
10
|
import { d as defineCustomElement$8 } from './calcite-action2.js';
|
|
@@ -31,8 +31,11 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
31
31
|
this.active = false;
|
|
32
32
|
/** The disabled state of the time input */
|
|
33
33
|
this.disabled = false;
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* BCP 47 language tag for desired language and country format
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
this.locale = document.documentElement.lang || navigator.language || "en";
|
|
36
39
|
/**
|
|
37
40
|
* When true, makes the component required for form-submission.
|
|
38
41
|
*
|
|
@@ -56,56 +59,60 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
56
59
|
//--------------------------------------------------------------------------
|
|
57
60
|
this.calciteInputBlurHandler = () => {
|
|
58
61
|
this.active = false;
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
62
|
+
const shouldIncludeSeconds = this.shouldIncludeSeconds();
|
|
63
|
+
const localizedInputValue = localizeTimeString(this.calciteInputEl.value, this.locale, shouldIncludeSeconds);
|
|
64
|
+
this.setInputValue(localizedInputValue || localizeTimeString(this.value, this.locale, shouldIncludeSeconds));
|
|
63
65
|
};
|
|
64
66
|
this.calciteInputFocusHandler = () => {
|
|
65
67
|
this.active = true;
|
|
66
68
|
};
|
|
67
69
|
this.calciteInputInputHandler = (event) => {
|
|
68
|
-
|
|
70
|
+
const target = event.target;
|
|
71
|
+
this.setValue({ value: target.value });
|
|
72
|
+
};
|
|
73
|
+
this.timePickerChangeHandler = (event) => {
|
|
74
|
+
event.stopPropagation();
|
|
75
|
+
const target = event.target;
|
|
76
|
+
const value = target.value;
|
|
77
|
+
this.setValue({ value, origin: "time-picker" });
|
|
69
78
|
};
|
|
70
79
|
this.setCalciteInputEl = (el) => {
|
|
71
80
|
this.calciteInputEl = el;
|
|
72
81
|
};
|
|
82
|
+
this.setCalciteTimePickerEl = (el) => {
|
|
83
|
+
this.calciteTimePickerEl = el;
|
|
84
|
+
};
|
|
73
85
|
this.setInputValue = (newInputValue) => {
|
|
74
86
|
if (!this.calciteInputEl) {
|
|
75
87
|
return;
|
|
76
88
|
}
|
|
77
|
-
|
|
78
|
-
const { hour, minute, second } = parseTimeString(newInputValue);
|
|
79
|
-
this.calciteInputEl.value = newInputValue
|
|
80
|
-
? `${getMeridiemHour(hour)}:${minute}${this.step !== 60 ? ":" + second : ""} ${getMeridiem(hour)}`
|
|
81
|
-
: null;
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
this.calciteInputEl.value = newInputValue;
|
|
85
|
-
}
|
|
89
|
+
this.calciteInputEl.value = newInputValue;
|
|
86
90
|
};
|
|
87
91
|
this.setValue = ({ value, origin = "input" }) => {
|
|
88
92
|
const previousValue = this.value;
|
|
89
|
-
const
|
|
93
|
+
const newValue = formatTimeString(value);
|
|
94
|
+
const newLocalizedValue = localizeTimeString(newValue, this.locale, this.shouldIncludeSeconds());
|
|
90
95
|
this.internalValueChange = origin !== "external" && origin !== "loading";
|
|
91
96
|
const shouldEmit = origin !== "loading" &&
|
|
92
97
|
origin !== "external" &&
|
|
93
98
|
((value !== this.previousValidValue && !value) ||
|
|
94
|
-
!!(!this.previousValidValue &&
|
|
95
|
-
(
|
|
99
|
+
!!(!this.previousValidValue && newValue) ||
|
|
100
|
+
(newValue !== this.previousValidValue && newValue));
|
|
96
101
|
if (value) {
|
|
97
102
|
if (shouldEmit) {
|
|
98
|
-
this.previousValidValue =
|
|
103
|
+
this.previousValidValue = newValue;
|
|
99
104
|
}
|
|
100
|
-
if (
|
|
101
|
-
this.value =
|
|
105
|
+
if (newValue && newValue !== this.value) {
|
|
106
|
+
this.value = newValue;
|
|
102
107
|
}
|
|
108
|
+
this.localizedValue = newLocalizedValue;
|
|
103
109
|
}
|
|
104
110
|
else {
|
|
105
111
|
this.value = value;
|
|
112
|
+
this.localizedValue = null;
|
|
106
113
|
}
|
|
107
114
|
if (origin === "time-picker" || origin === "external") {
|
|
108
|
-
this.setInputValue(
|
|
115
|
+
this.setInputValue(newLocalizedValue);
|
|
109
116
|
}
|
|
110
117
|
if (shouldEmit) {
|
|
111
118
|
const changeEvent = this.calciteInputTimePickerChange.emit();
|
|
@@ -116,17 +123,26 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
116
123
|
this.previousValidValue = previousValue;
|
|
117
124
|
}
|
|
118
125
|
else {
|
|
119
|
-
this.previousValidValue =
|
|
126
|
+
this.previousValidValue = newValue;
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
129
|
};
|
|
123
130
|
}
|
|
131
|
+
localeWatcher(newLocale) {
|
|
132
|
+
this.setInputValue(localizeTimeString(this.value, newLocale, this.shouldIncludeSeconds()));
|
|
133
|
+
}
|
|
124
134
|
valueWatcher(newValue) {
|
|
125
135
|
if (!this.internalValueChange) {
|
|
126
136
|
this.setValue({ value: newValue, origin: "external" });
|
|
127
137
|
}
|
|
128
138
|
this.internalValueChange = false;
|
|
129
139
|
}
|
|
140
|
+
clickHandler(event) {
|
|
141
|
+
if (event.composedPath().includes(this.calciteTimePickerEl)) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
this.setFocus();
|
|
145
|
+
}
|
|
130
146
|
keyUpHandler(event) {
|
|
131
147
|
if (event.key === "Escape" && this.active) {
|
|
132
148
|
this.active = false;
|
|
@@ -137,21 +153,6 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
137
153
|
event.stopPropagation();
|
|
138
154
|
this.active = false;
|
|
139
155
|
}
|
|
140
|
-
timePickerChangeHandler(event) {
|
|
141
|
-
event.preventDefault();
|
|
142
|
-
event.stopPropagation();
|
|
143
|
-
if (event.detail) {
|
|
144
|
-
const { hour, minute, second } = event.detail;
|
|
145
|
-
let value;
|
|
146
|
-
if (hour && minute) {
|
|
147
|
-
value = second && this.step !== 60 ? `${hour}:${minute}:${second}` : `${hour}:${minute}`;
|
|
148
|
-
}
|
|
149
|
-
else {
|
|
150
|
-
value = "";
|
|
151
|
-
}
|
|
152
|
-
this.setValue({ value, origin: "time-picker" });
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
156
|
timePickerFocusHandler(event) {
|
|
156
157
|
event.preventDefault();
|
|
157
158
|
event.stopPropagation();
|
|
@@ -174,6 +175,9 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
174
175
|
onLabelClick() {
|
|
175
176
|
this.setFocus();
|
|
176
177
|
}
|
|
178
|
+
shouldIncludeSeconds() {
|
|
179
|
+
return this.step < 60;
|
|
180
|
+
}
|
|
177
181
|
//--------------------------------------------------------------------------
|
|
178
182
|
//
|
|
179
183
|
// Lifecycle
|
|
@@ -181,15 +185,13 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
181
185
|
//--------------------------------------------------------------------------
|
|
182
186
|
connectedCallback() {
|
|
183
187
|
if (this.value) {
|
|
184
|
-
this.setValue({ value: this.value, origin: "loading" });
|
|
188
|
+
this.setValue({ value: isValidTime(this.value) ? this.value : undefined, origin: "loading" });
|
|
185
189
|
}
|
|
186
190
|
connectLabel(this);
|
|
187
191
|
connectForm(this);
|
|
188
192
|
}
|
|
189
193
|
componentDidLoad() {
|
|
190
|
-
|
|
191
|
-
this.setInputValue(this.value);
|
|
192
|
-
}
|
|
194
|
+
this.setInputValue(this.localizedValue);
|
|
193
195
|
}
|
|
194
196
|
disconnectedCallback() {
|
|
195
197
|
disconnectLabel(this);
|
|
@@ -201,12 +203,12 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
201
203
|
//
|
|
202
204
|
// --------------------------------------------------------------------------
|
|
203
205
|
render() {
|
|
204
|
-
const { hour, minute, second } = parseTimeString(this.value);
|
|
205
206
|
const popoverId = `${this.referenceElementId}-popover`;
|
|
206
|
-
return (h(Host, null, h("div", { "aria-controls": popoverId, "aria-haspopup": "dialog", "aria-label": this.name, "aria-owns": popoverId, id: this.referenceElementId, role: "combobox" }, h("calcite-input", { disabled: this.disabled, icon: "clock", label: getLabelText(this), onCalciteInputBlur: this.calciteInputBlurHandler, onCalciteInputFocus: this.calciteInputFocusHandler, onCalciteInputInput: this.calciteInputInputHandler, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })), h("calcite-popover", { id: popoverId, label: "Time Picker", open: this.active || false, referenceElement: this.referenceElementId }, h("calcite-time-picker", {
|
|
207
|
+
return (h(Host, null, h("div", { "aria-controls": popoverId, "aria-haspopup": "dialog", "aria-label": this.name, "aria-owns": popoverId, id: this.referenceElementId, role: "combobox" }, h("calcite-input", { disabled: this.disabled, icon: "clock", label: getLabelText(this), onCalciteInputBlur: this.calciteInputBlurHandler, onCalciteInputFocus: this.calciteInputFocusHandler, onCalciteInputInput: this.calciteInputInputHandler, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })), h("calcite-popover", { id: popoverId, label: "Time Picker", open: this.active || false, referenceElement: this.referenceElementId }, h("calcite-time-picker", { intlHour: this.intlHour, intlHourDown: this.intlHourDown, intlHourUp: this.intlHourUp, intlMeridiem: this.intlMeridiem, intlMeridiemDown: this.intlMeridiemDown, intlMeridiemUp: this.intlMeridiemUp, intlMinute: this.intlMinute, intlMinuteDown: this.intlMinuteDown, intlMinuteUp: this.intlMinuteUp, intlSecond: this.intlSecond, intlSecondDown: this.intlSecondDown, intlSecondUp: this.intlSecondUp, lang: this.locale, onCalciteTimePickerChange: this.timePickerChangeHandler, ref: this.setCalciteTimePickerEl, scale: this.scale, step: this.step, value: this.value })), h(HiddenFormInputSlot, { component: this })));
|
|
207
208
|
}
|
|
208
209
|
get el() { return this; }
|
|
209
210
|
static get watchers() { return {
|
|
211
|
+
"locale": ["localeWatcher"],
|
|
210
212
|
"value": ["valueWatcher"]
|
|
211
213
|
}; }
|
|
212
214
|
static get style() { return calciteInputTimePickerCss; }
|
|
@@ -214,7 +216,6 @@ let CalciteInputTimePicker$1 = class extends HTMLElement {
|
|
|
214
216
|
CalciteInputTimePicker$1 = /*@__PURE__*/ proxyCustomElement(CalciteInputTimePicker$1, [1, "calcite-input-time-picker", {
|
|
215
217
|
"active": [1540],
|
|
216
218
|
"disabled": [516],
|
|
217
|
-
"hourDisplayFormat": [1, "hour-display-format"],
|
|
218
219
|
"intlHour": [1, "intl-hour"],
|
|
219
220
|
"intlHourDown": [1, "intl-hour-down"],
|
|
220
221
|
"intlHourUp": [1, "intl-hour-up"],
|
|
@@ -227,13 +228,15 @@ CalciteInputTimePicker$1 = /*@__PURE__*/ proxyCustomElement(CalciteInputTimePick
|
|
|
227
228
|
"intlSecond": [1, "intl-second"],
|
|
228
229
|
"intlSecondDown": [1, "intl-second-down"],
|
|
229
230
|
"intlSecondUp": [1, "intl-second-up"],
|
|
231
|
+
"locale": [1025, "lang"],
|
|
230
232
|
"name": [1],
|
|
231
233
|
"required": [516],
|
|
232
234
|
"scale": [513],
|
|
233
235
|
"step": [2],
|
|
234
236
|
"value": [1025],
|
|
237
|
+
"localizedValue": [32],
|
|
235
238
|
"setFocus": [64]
|
|
236
|
-
}, [[0, "
|
|
239
|
+
}, [[0, "click", "clickHandler"], [0, "keyup", "keyUpHandler"], [0, "calciteTimePickerBlur", "timePickerBlurHandler"], [0, "calciteTimePickerFocus", "timePickerFocusHandler"]]]);
|
|
237
240
|
function defineCustomElement$1() {
|
|
238
241
|
if (typeof customElements === "undefined") {
|
|
239
242
|
return;
|
|
@@ -109,7 +109,7 @@ let CalcitePanel$1 = class extends HTMLElement {
|
|
|
109
109
|
this.setBackRef = (node) => {
|
|
110
110
|
this.backButtonEl = node;
|
|
111
111
|
};
|
|
112
|
-
this.
|
|
112
|
+
this.panelKeyDownHandler = (event) => {
|
|
113
113
|
if (event.key === "Escape") {
|
|
114
114
|
this.dismiss();
|
|
115
115
|
}
|
|
@@ -226,12 +226,12 @@ let CalcitePanel$1 = class extends HTMLElement {
|
|
|
226
226
|
return (h("div", { class: CSS.fabContainer }, h("slot", { name: SLOTS.fab })));
|
|
227
227
|
}
|
|
228
228
|
render() {
|
|
229
|
-
const { dismissed, disabled, dismissible, el, loading,
|
|
229
|
+
const { dismissed, disabled, dismissible, el, loading, panelKeyDownHandler } = this;
|
|
230
230
|
const rtl = getElementDir(el) === "rtl";
|
|
231
231
|
const panelNode = (h("article", { "aria-busy": loading.toString(), class: {
|
|
232
232
|
[CSS.container]: true,
|
|
233
233
|
[CSS_UTILITY.rtl]: rtl
|
|
234
|
-
}, hidden: dismissible && dismissed,
|
|
234
|
+
}, hidden: dismissible && dismissed, onKeyDown: panelKeyDownHandler, ref: this.setContainerRef, tabIndex: dismissible ? 0 : -1 }, this.renderHeaderNode(), this.renderContent(), this.renderFooterSlottedContent() || this.renderFooterActions()));
|
|
235
235
|
return (h(Fragment, null, loading || disabled ? h("calcite-scrim", { loading: loading }) : null, panelNode));
|
|
236
236
|
}
|
|
237
237
|
get el() { return this; }
|