@esri/calcite-components 1.0.0-next.319 → 1.0.0-next.322
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-04bce033.entry.js +5 -0
- package/dist/calcite/p-1480eb2d.entry.js +5 -0
- package/dist/calcite/p-414ce3c1.system.entry.js +5 -0
- package/dist/calcite/p-4d4ba7df.entry.js +5 -0
- package/dist/calcite/{p-8b2d4eac.system.entry.js → p-4e95e13d.system.entry.js} +1 -1
- package/dist/calcite/p-58208234.system.entry.js +5 -0
- package/dist/calcite/{p-9be50494.entry.js → p-77600274.entry.js} +1 -1
- package/dist/calcite/p-8e252799.system.js +1 -1
- package/dist/calcite/{p-f97e1a2d.entry.js → p-a57aa5d0.entry.js} +1 -1
- package/dist/calcite/{p-6c5b849f.system.entry.js → p-ac417011.system.entry.js} +1 -1
- package/dist/calcite/p-ad617a5a.entry.js +5 -0
- package/dist/calcite/p-ed82600e.system.entry.js +5 -0
- package/dist/calcite/p-fa9a1d8f.system.entry.js +5 -0
- package/dist/cjs/calcite-button.cjs.entry.js +2 -2
- package/dist/cjs/calcite-combobox_3.cjs.entry.js +4 -1
- package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +349 -223
- package/dist/cjs/calcite-label.cjs.entry.js +1 -1
- package/dist/cjs/calcite-option_3.cjs.entry.js +3 -1
- package/dist/cjs/{calcite-radio_2.cjs.entry.js → calcite-radio-button.cjs.entry.js} +2 -43
- package/dist/cjs/calcite.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +5 -7
- package/dist/collection/components/calcite-button/calcite-button.js +3 -2
- package/dist/collection/components/calcite-combobox/calcite-combobox.js +4 -1
- package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +81 -76
- package/dist/collection/components/calcite-label/calcite-label.css +0 -1
- package/dist/collection/components/calcite-option/calcite-option.js +3 -1
- package/dist/collection/components/calcite-radio-button/calcite-radio-button.css +69 -0
- package/dist/collection/components/calcite-radio-button/calcite-radio-button.js +1 -1
- 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/time.js +144 -36
- package/dist/components/calcite-button2.js +2 -2
- package/dist/components/calcite-combobox.js +4 -1
- package/dist/components/calcite-input-time-picker.js +51 -48
- package/dist/components/calcite-label2.js +1 -1
- package/dist/components/calcite-option.js +3 -1
- package/dist/components/calcite-radio-button.js +3 -9
- package/dist/components/calcite-time-picker2.js +320 -187
- package/dist/custom-elements/index.d.ts +0 -6
- package/dist/custom-elements/index.js +364 -277
- package/dist/esm/calcite-button.entry.js +2 -2
- package/dist/esm/calcite-combobox_3.entry.js +4 -1
- package/dist/esm/calcite-input-time-picker_2.entry.js +349 -223
- package/dist/esm/calcite-label.entry.js +1 -1
- package/dist/esm/calcite-option_3.entry.js +3 -1
- package/dist/esm/{calcite-radio_2.entry.js → calcite-radio-button.entry.js} +4 -44
- package/dist/esm/calcite.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm-es5/calcite-button.entry.js +1 -1
- package/dist/esm-es5/calcite-combobox_3.entry.js +1 -1
- package/dist/esm-es5/calcite-input-time-picker_2.entry.js +2 -2
- package/dist/esm-es5/calcite-label.entry.js +1 -1
- package/dist/esm-es5/calcite-option_3.entry.js +1 -1
- package/dist/esm-es5/calcite-radio-button.entry.js +5 -0
- package/dist/esm-es5/calcite.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/extras/docs-json.json +24 -211
- package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +12 -4
- 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 +16 -93
- package/dist/types/preact.d.ts +0 -2
- package/dist/types/utils/time.d.ts +18 -5
- package/hydrate/index.js +381 -296
- package/package.json +1 -1
- package/readme.md +2 -2
- package/dist/calcite/p-12a9599d.system.entry.js +0 -5
- package/dist/calcite/p-1e4955d7.entry.js +0 -5
- package/dist/calcite/p-2b137143.system.entry.js +0 -5
- package/dist/calcite/p-35c5e6bd.entry.js +0 -5
- package/dist/calcite/p-4af85388.system.entry.js +0 -5
- package/dist/calcite/p-9634f89d.entry.js +0 -5
- package/dist/calcite/p-a98e5444.system.entry.js +0 -5
- package/dist/calcite/p-fccc1605.entry.js +0 -5
- package/dist/collection/components/calcite-radio/calcite-radio.css +0 -162
- package/dist/collection/components/calcite-radio/calcite-radio.js +0 -169
- package/dist/components/calcite-radio.d.ts +0 -11
- package/dist/components/calcite-radio.js +0 -10
- package/dist/components/calcite-radio2.js +0 -71
- package/dist/esm-es5/calcite-radio_2.entry.js +0 -5
- package/dist/types/components/calcite-radio/calcite-radio.d.ts +0 -22
|
@@ -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",
|
|
@@ -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
|
}
|
|
@@ -149,11 +149,11 @@ let CalciteButton = class extends HTMLElement$1 {
|
|
|
149
149
|
render() {
|
|
150
150
|
const dir = getElementDir(this.el);
|
|
151
151
|
const Tag = this.childElType;
|
|
152
|
-
const
|
|
152
|
+
const loaderNode = this.hasLoader ? (h("div", { class: CSS.buttonLoader }, h("calcite-loader", { active: true, class: this.loading ? CSS.loadingIn : CSS.loadingOut, inline: true, label: this.intlLoading, scale: "m" }))) : null;
|
|
153
153
|
const iconStartEl = (h("calcite-icon", { class: { [CSS.icon]: true, [CSS.iconStart]: true }, flipRtl: this.iconFlipRtl === "start" || this.iconFlipRtl === "both", icon: this.iconStart, scale: "s" }));
|
|
154
154
|
const iconEndEl = (h("calcite-icon", { class: { [CSS.icon]: true, [CSS.iconEnd]: true }, flipRtl: this.iconFlipRtl === "end" || this.iconFlipRtl === "both", icon: this.iconEnd, scale: "s" }));
|
|
155
155
|
const contentEl = (h("span", { class: CSS.content }, h("slot", null)));
|
|
156
|
-
return (h(Tag, { "aria-label": getLabelText(this), class: { [CSS_UTILITY.rtl]: dir === "rtl", [CSS.contentSlotted]: this.hasContent }, disabled: this.disabled || this.loading, href: this.childElType === "a" && this.href, name: this.childElType === "button" && this.name, onClick: this.handleClick, ref: (el) => (this.childEl = el), rel: this.childElType === "a" && this.rel, tabIndex: this.disabled || this.loading ? -1 : null, target: this.childElType === "a" && this.target, type: this.childElType === "button" && this.type },
|
|
156
|
+
return (h(Tag, { "aria-label": getLabelText(this), class: { [CSS_UTILITY.rtl]: dir === "rtl", [CSS.contentSlotted]: this.hasContent }, disabled: this.disabled || this.loading, href: this.childElType === "a" && this.href, name: this.childElType === "button" && this.name, onClick: this.handleClick, ref: (el) => (this.childEl = el), rel: this.childElType === "a" && this.rel, tabIndex: this.disabled || this.loading ? -1 : null, target: this.childElType === "a" && this.target, type: this.childElType === "button" && this.type }, loaderNode, this.iconStart ? iconStartEl : null, this.hasContent ? contentEl : null, this.iconEnd ? iconEndEl : null));
|
|
157
157
|
}
|
|
158
158
|
//--------------------------------------------------------------------------
|
|
159
159
|
//
|
|
@@ -335,7 +335,9 @@ let CalciteCombobox$1 = class extends HTMLElement {
|
|
|
335
335
|
};
|
|
336
336
|
this.setInactiveIfNotContained = (event) => {
|
|
337
337
|
const composedPath = event.composedPath();
|
|
338
|
-
if (!this.active
|
|
338
|
+
if ((!this.active && !this.open) ||
|
|
339
|
+
composedPath.includes(this.el) ||
|
|
340
|
+
composedPath.includes(this.referenceEl)) {
|
|
339
341
|
return;
|
|
340
342
|
}
|
|
341
343
|
if (this.allowCustomValues && this.text) {
|
|
@@ -350,6 +352,7 @@ let CalciteCombobox$1 = class extends HTMLElement {
|
|
|
350
352
|
this.updateActiveItemIndex(-1);
|
|
351
353
|
}
|
|
352
354
|
this.active = false;
|
|
355
|
+
this.open = false;
|
|
353
356
|
};
|
|
354
357
|
this.setMenuEl = (el) => {
|
|
355
358
|
this.menuEl = el;
|
|
@@ -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;
|
|
@@ -9,7 +9,7 @@ const CSS = {
|
|
|
9
9
|
container: "container"
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
const calciteLabelCss = "@-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}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host([alignment=start]),:host([alignment=end]) .calcite--rtl{text-align:left}:host([alignment=end]),:host([alignment=start]) .calcite--rtl{text-align:right}:host([alignment=center]){text-align:center}:host([scale=s]) .container{font-size:var(--calcite-font-size--2);line-height:1rem;margin-bottom:0.5rem}:host([scale=m]) .container{font-size:var(--calcite-font-size--1);line-height:1rem;margin-bottom:0.75rem}:host([scale=l]) .container{font-size:var(--calcite-font-size-0);line-height:1.25rem;margin-bottom:1rem}:host .container{color:var(--calcite-ui-text-1);
|
|
12
|
+
const calciteLabelCss = "@-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}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host([alignment=start]),:host([alignment=end]) .calcite--rtl{text-align:left}:host([alignment=end]),:host([alignment=start]) .calcite--rtl{text-align:right}:host([alignment=center]){text-align:center}:host([scale=s]) .container{font-size:var(--calcite-font-size--2);line-height:1rem;margin-bottom:0.5rem}:host([scale=m]) .container{font-size:var(--calcite-font-size--1);line-height:1rem;margin-bottom:0.75rem}:host([scale=l]) .container{font-size:var(--calcite-font-size-0);line-height:1.25rem;margin-bottom:1rem}:host .container{color:var(--calcite-ui-text-1);width:100%;margin-top:0;margin-right:0;margin-left:0;line-height:1.375}:host([layout=default]) .container{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;grid-gap:0.25rem;gap:0.25rem}:host([layout=inline]) .container,:host([layout=inline-space-between]) .container{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;grid-gap:0.5rem;gap:0.5rem}:host([layout=inline][scale=l]) .container{grid-gap:0.75rem;gap:0.75rem}:host([layout=inline-space-between]) .container{-ms-flex-pack:justify;justify-content:space-between}:host([disabled])>.container{pointer-events:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) ::slotted(*){pointer-events:none}:host([disabled]) ::slotted(*[disabled]),:host([disabled]) ::slotted(*[disabled] *){--bg-opacity:1}:host([disabled]) ::slotted(calcite-input-message:not([active])){--bg-opacity:0}:host([disable-spacing]) .container{grid-gap:0;gap:0;margin:0}";
|
|
13
13
|
|
|
14
14
|
let CalciteLabel = class extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
@@ -58,8 +58,10 @@ let CalciteOption$1 = class extends HTMLElement {
|
|
|
58
58
|
var _a;
|
|
59
59
|
this.ensureTextContentDependentProps();
|
|
60
60
|
(_a = this.mutationObserver) === null || _a === void 0 ? void 0 : _a.observe(this.el, {
|
|
61
|
+
attributeFilter: ["label", "value"],
|
|
62
|
+
characterData: true,
|
|
61
63
|
childList: true,
|
|
62
|
-
|
|
64
|
+
subtree: true
|
|
63
65
|
});
|
|
64
66
|
}
|
|
65
67
|
disconnectedCallback() {
|
|
@@ -8,13 +8,12 @@ import { c as getElementStyleDir, f as focusElement } from './dom.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 { g as getRoundRobinIndex } from './array.js';
|
|
11
|
-
import { d as defineCustomElement$2 } from './calcite-radio2.js';
|
|
12
11
|
|
|
13
12
|
const CSS = {
|
|
14
13
|
container: "container"
|
|
15
14
|
};
|
|
16
15
|
|
|
17
|
-
const calciteRadioButtonCss = "@-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}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{cursor:pointer;display:block}:host .container{position:relative;outline:2px solid transparent;outline-offset:2px}:host([disabled]){cursor:pointer}::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}";
|
|
16
|
+
const calciteRadioButtonCss = "@-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}:root{--calcite-popper-transition:150ms ease-in-out}:host([hidden]){display:none}:host{cursor:pointer;display:block}:host .container{position:relative;outline:2px solid transparent;outline-offset:2px}:host .radio{background-color:var(--calcite-ui-foreground-1);border-radius:9999px;cursor:pointer;-webkit-transition-property:all;transition-property:all;-webkit-transition-duration:150ms;transition-duration:150ms;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input)}:host([hovered]) .radio,:host(:not([checked])[focused]) .radio{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}:host([disabled]){cursor:pointer}:host([disabled]) .radio{cursor:default;opacity:var(--calcite-ui-opacity-disabled)}:host([hovered][disabled]) .radio{-webkit-box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input);box-shadow:inset 0 0 0 1px var(--calcite-ui-border-input)}:host([scale=s]){--calcite-radio-size:var(--calcite-font-size--2)}:host([scale=m]){--calcite-radio-size:var(--calcite-font-size--1)}:host([scale=l]){--calcite-radio-size:var(--calcite-font-size-0)}.radio{height:var(--calcite-radio-size);max-width:var(--calcite-radio-size);min-width:var(--calcite-radio-size)}:host([scale=s][checked]) .radio,:host([hovered][scale=s][checked][disabled]) .radio{-webkit-box-shadow:inset 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 4px var(--calcite-ui-brand)}:host([scale=s][focused][checked]) .radio{-webkit-box-shadow:inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 4px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}:host([scale=m][checked]) .radio,:host([hovered][scale=m][checked][disabled]) .radio{-webkit-box-shadow:inset 0 0 0 5px var(--calcite-ui-brand);box-shadow:inset 0 0 0 5px var(--calcite-ui-brand)}:host([scale=m][focused][checked]) .radio{-webkit-box-shadow:inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 5px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}:host([scale=l][checked]) .radio,:host([hovered][scale=l][checked][disabled]) .radio{-webkit-box-shadow:inset 0 0 0 6px var(--calcite-ui-brand);box-shadow:inset 0 0 0 6px var(--calcite-ui-brand)}:host([scale=l][focused][checked]) .radio{-webkit-box-shadow:inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand);box-shadow:inset 0 0 0 6px var(--calcite-ui-brand), 0 0 0 2px var(--calcite-ui-foreground-1), 0 0 0 4px var(--calcite-ui-brand)}::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}";
|
|
18
17
|
|
|
19
18
|
let CalciteRadioButton$1 = class extends HTMLElement {
|
|
20
19
|
constructor() {
|
|
@@ -246,7 +245,7 @@ let CalciteRadioButton$1 = class extends HTMLElement {
|
|
|
246
245
|
//
|
|
247
246
|
// --------------------------------------------------------------------------
|
|
248
247
|
render() {
|
|
249
|
-
return (h(Host, { onClick: this.clickHandler, onKeyDown: this.handleKeyDown }, h("div", { "aria-checked": this.checked.toString(), "aria-label": getLabelText(this), class: CSS.container, onBlur: this.onContainerBlur, onFocus: this.onContainerFocus, ref: this.setContainerEl, role: "radio", tabIndex: this.checked || this.isDefaultSelectable() ? 0 : -1 }, h("
|
|
248
|
+
return (h(Host, { onClick: this.clickHandler, onKeyDown: this.handleKeyDown }, h("div", { "aria-checked": this.checked.toString(), "aria-label": getLabelText(this), class: CSS.container, onBlur: this.onContainerBlur, onFocus: this.onContainerFocus, ref: this.setContainerEl, role: "radio", tabIndex: this.checked || this.isDefaultSelectable() ? 0 : -1 }, h("div", { class: "radio" })), h(HiddenFormInputSlot, { component: this })));
|
|
250
249
|
}
|
|
251
250
|
get el() { return this; }
|
|
252
251
|
static get watchers() { return {
|
|
@@ -274,18 +273,13 @@ function defineCustomElement$1() {
|
|
|
274
273
|
if (typeof customElements === "undefined") {
|
|
275
274
|
return;
|
|
276
275
|
}
|
|
277
|
-
const components = ["calcite-radio-button"
|
|
276
|
+
const components = ["calcite-radio-button"];
|
|
278
277
|
components.forEach(tagName => { switch (tagName) {
|
|
279
278
|
case "calcite-radio-button":
|
|
280
279
|
if (!customElements.get(tagName)) {
|
|
281
280
|
customElements.define(tagName, CalciteRadioButton$1);
|
|
282
281
|
}
|
|
283
282
|
break;
|
|
284
|
-
case "calcite-radio":
|
|
285
|
-
if (!customElements.get(tagName)) {
|
|
286
|
-
defineCustomElement$2();
|
|
287
|
-
}
|
|
288
|
-
break;
|
|
289
283
|
} });
|
|
290
284
|
}
|
|
291
285
|
defineCustomElement$1();
|