@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.
Files changed (84) hide show
  1. package/dist/calcite/calcite.esm.js +1 -1
  2. package/dist/calcite/p-04bce033.entry.js +5 -0
  3. package/dist/calcite/p-1480eb2d.entry.js +5 -0
  4. package/dist/calcite/p-414ce3c1.system.entry.js +5 -0
  5. package/dist/calcite/p-4d4ba7df.entry.js +5 -0
  6. package/dist/calcite/{p-8b2d4eac.system.entry.js → p-4e95e13d.system.entry.js} +1 -1
  7. package/dist/calcite/p-58208234.system.entry.js +5 -0
  8. package/dist/calcite/{p-9be50494.entry.js → p-77600274.entry.js} +1 -1
  9. package/dist/calcite/p-8e252799.system.js +1 -1
  10. package/dist/calcite/{p-f97e1a2d.entry.js → p-a57aa5d0.entry.js} +1 -1
  11. package/dist/calcite/{p-6c5b849f.system.entry.js → p-ac417011.system.entry.js} +1 -1
  12. package/dist/calcite/p-ad617a5a.entry.js +5 -0
  13. package/dist/calcite/p-ed82600e.system.entry.js +5 -0
  14. package/dist/calcite/p-fa9a1d8f.system.entry.js +5 -0
  15. package/dist/cjs/calcite-button.cjs.entry.js +2 -2
  16. package/dist/cjs/calcite-combobox_3.cjs.entry.js +4 -1
  17. package/dist/cjs/calcite-input-time-picker_2.cjs.entry.js +349 -223
  18. package/dist/cjs/calcite-label.cjs.entry.js +1 -1
  19. package/dist/cjs/calcite-option_3.cjs.entry.js +3 -1
  20. package/dist/cjs/{calcite-radio_2.cjs.entry.js → calcite-radio-button.cjs.entry.js} +2 -43
  21. package/dist/cjs/calcite.cjs.js +1 -1
  22. package/dist/cjs/loader.cjs.js +1 -1
  23. package/dist/collection/collection-manifest.json +5 -7
  24. package/dist/collection/components/calcite-button/calcite-button.js +3 -2
  25. package/dist/collection/components/calcite-combobox/calcite-combobox.js +4 -1
  26. package/dist/collection/components/calcite-input-time-picker/calcite-input-time-picker.js +81 -76
  27. package/dist/collection/components/calcite-label/calcite-label.css +0 -1
  28. package/dist/collection/components/calcite-option/calcite-option.js +3 -1
  29. package/dist/collection/components/calcite-radio-button/calcite-radio-button.css +69 -0
  30. package/dist/collection/components/calcite-radio-button/calcite-radio-button.js +1 -1
  31. package/dist/collection/components/calcite-time-picker/calcite-time-picker.css +56 -91
  32. package/dist/collection/components/calcite-time-picker/calcite-time-picker.js +254 -289
  33. package/dist/collection/components/calcite-time-picker/resources.js +15 -9
  34. package/dist/collection/utils/time.js +144 -36
  35. package/dist/components/calcite-button2.js +2 -2
  36. package/dist/components/calcite-combobox.js +4 -1
  37. package/dist/components/calcite-input-time-picker.js +51 -48
  38. package/dist/components/calcite-label2.js +1 -1
  39. package/dist/components/calcite-option.js +3 -1
  40. package/dist/components/calcite-radio-button.js +3 -9
  41. package/dist/components/calcite-time-picker2.js +320 -187
  42. package/dist/custom-elements/index.d.ts +0 -6
  43. package/dist/custom-elements/index.js +364 -277
  44. package/dist/esm/calcite-button.entry.js +2 -2
  45. package/dist/esm/calcite-combobox_3.entry.js +4 -1
  46. package/dist/esm/calcite-input-time-picker_2.entry.js +349 -223
  47. package/dist/esm/calcite-label.entry.js +1 -1
  48. package/dist/esm/calcite-option_3.entry.js +3 -1
  49. package/dist/esm/{calcite-radio_2.entry.js → calcite-radio-button.entry.js} +4 -44
  50. package/dist/esm/calcite.js +1 -1
  51. package/dist/esm/loader.js +1 -1
  52. package/dist/esm-es5/calcite-button.entry.js +1 -1
  53. package/dist/esm-es5/calcite-combobox_3.entry.js +1 -1
  54. package/dist/esm-es5/calcite-input-time-picker_2.entry.js +2 -2
  55. package/dist/esm-es5/calcite-label.entry.js +1 -1
  56. package/dist/esm-es5/calcite-option_3.entry.js +1 -1
  57. package/dist/esm-es5/calcite-radio-button.entry.js +5 -0
  58. package/dist/esm-es5/calcite.js +1 -1
  59. package/dist/esm-es5/loader.js +1 -1
  60. package/dist/extras/docs-json.json +24 -211
  61. package/dist/types/components/calcite-input-time-picker/calcite-input-time-picker.d.ts +12 -4
  62. package/dist/types/components/calcite-time-picker/calcite-time-picker.d.ts +35 -23
  63. package/dist/types/components/calcite-time-picker/resources.d.ts +14 -8
  64. package/dist/types/components.d.ts +16 -93
  65. package/dist/types/preact.d.ts +0 -2
  66. package/dist/types/utils/time.d.ts +18 -5
  67. package/hydrate/index.js +381 -296
  68. package/package.json +1 -1
  69. package/readme.md +2 -2
  70. package/dist/calcite/p-12a9599d.system.entry.js +0 -5
  71. package/dist/calcite/p-1e4955d7.entry.js +0 -5
  72. package/dist/calcite/p-2b137143.system.entry.js +0 -5
  73. package/dist/calcite/p-35c5e6bd.entry.js +0 -5
  74. package/dist/calcite/p-4af85388.system.entry.js +0 -5
  75. package/dist/calcite/p-9634f89d.entry.js +0 -5
  76. package/dist/calcite/p-a98e5444.system.entry.js +0 -5
  77. package/dist/calcite/p-fccc1605.entry.js +0 -5
  78. package/dist/collection/components/calcite-radio/calcite-radio.css +0 -162
  79. package/dist/collection/components/calcite-radio/calcite-radio.js +0 -169
  80. package/dist/components/calcite-radio.d.ts +0 -11
  81. package/dist/components/calcite-radio.js +0 -10
  82. package/dist/components/calcite-radio2.js +0 -71
  83. package/dist/esm-es5/calcite-radio_2.entry.js +0 -5
  84. package/dist/types/components/calcite-radio/calcite-radio.d.ts +0 -22
@@ -2,11 +2,77 @@
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 { HTMLElement, createEvent, h, proxyCustomElement } from '@stencil/core/internal/client';
6
6
  import { i as isValidNumber, n as numberKeys, b as isActivationKey } from './number.js';
7
7
  import { d as defineCustomElement$1 } from './calcite-icon2.js';
8
8
 
9
9
  const maxTenthForMinuteAndSecond = 5;
10
+ function createLocaleDateTimeFormatter(locale, includeSeconds = true) {
11
+ try {
12
+ const options = {
13
+ hour: "2-digit",
14
+ minute: "2-digit",
15
+ timeZone: "UTC"
16
+ };
17
+ if (includeSeconds) {
18
+ options.second = "2-digit";
19
+ }
20
+ return new Intl.DateTimeFormat(locale, options);
21
+ }
22
+ catch (e) {
23
+ throw new Error(`Invalid locale supplied while attempting to create a DateTime formatter: ${locale}`);
24
+ }
25
+ }
26
+ function formatTimePart(number) {
27
+ const numberAsString = number.toString();
28
+ return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
29
+ }
30
+ function formatTimeString(value) {
31
+ if (!isValidTime(value)) {
32
+ return null;
33
+ }
34
+ const [hourString, minuteString, secondString] = value.split(":");
35
+ const hour = formatTimePart(parseInt(hourString));
36
+ const minute = formatTimePart(parseInt(minuteString));
37
+ if (secondString) {
38
+ const second = formatTimePart(parseInt(secondString));
39
+ return `${hour}:${minute}:${second}`;
40
+ }
41
+ return `${hour}:${minute}`;
42
+ }
43
+ function getLocaleHourCycle(locale) {
44
+ const formatter = createLocaleDateTimeFormatter(locale);
45
+ const parts = formatter.formatToParts(new Date(Date.UTC(0, 0, 0, 0, 0, 0)));
46
+ return getLocalizedTimePart("meridiem", parts) ? "12" : "24";
47
+ }
48
+ function getLocalizedTimePart(part, parts) {
49
+ var _a, _b, _c, _d;
50
+ if (!part || !parts) {
51
+ return null;
52
+ }
53
+ if (part === "hourSuffix") {
54
+ const hourIndex = parts.indexOf(parts.find(({ type }) => type === "hour"));
55
+ const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
56
+ const hourSuffix = parts[hourIndex + 1];
57
+ return hourSuffix && hourSuffix.type === "literal" && minuteIndex - hourIndex === 2
58
+ ? ((_a = hourSuffix.value) === null || _a === void 0 ? void 0 : _a.trim()) || null
59
+ : null;
60
+ }
61
+ if (part === "minuteSuffix") {
62
+ const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
63
+ const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
64
+ const minuteSuffix = parts[minuteIndex + 1];
65
+ return minuteSuffix && minuteSuffix.type === "literal" && secondIndex - minuteIndex === 2
66
+ ? ((_b = minuteSuffix.value) === null || _b === void 0 ? void 0 : _b.trim()) || null
67
+ : null;
68
+ }
69
+ if (part === "secondSuffix") {
70
+ const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
71
+ const secondSuffix = parts[secondIndex + 1];
72
+ return secondSuffix && secondSuffix.type === "literal" ? ((_c = secondSuffix.value) === null || _c === void 0 ? void 0 : _c.trim()) || null : null;
73
+ }
74
+ return ((_d = parts.find(({ type }) => (part == "meridiem" ? type === "dayPeriod" : type === part))) === null || _d === void 0 ? void 0 : _d.value) || null;
75
+ }
10
76
  function getMeridiem(hour) {
11
77
  if (!isValidNumber(hour)) {
12
78
  return null;
@@ -14,74 +80,122 @@ function getMeridiem(hour) {
14
80
  const hourAsNumber = parseInt(hour);
15
81
  return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
16
82
  }
17
- function getMeridiemHour(hour) {
18
- if (!isValidNumber(hour)) {
19
- return null;
83
+ function isValidTime(value) {
84
+ if (!value || value.startsWith(":") || value.endsWith(":")) {
85
+ return false;
20
86
  }
21
- const hourAsNumber = parseInt(hour);
22
- if (hourAsNumber === 0) {
23
- return "12";
87
+ const splitValue = value.split(":");
88
+ const validLength = splitValue.length > 1 && splitValue.length < 4;
89
+ if (!validLength) {
90
+ return false;
91
+ }
92
+ const [hour, minute, second] = splitValue;
93
+ const hourAsNumber = parseInt(splitValue[0]);
94
+ const minuteAsNumber = parseInt(splitValue[1]);
95
+ const secondAsNumber = parseInt(splitValue[2]);
96
+ const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
97
+ const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
98
+ const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
99
+ if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
100
+ return true;
24
101
  }
25
- return hourAsNumber > 12 ? formatTimePart(hourAsNumber - 12) : hour;
26
102
  }
27
- function parseTimeString(value) {
28
- const timeString = formatTimeString(value);
29
- const [hour, minute, second] = timeString ? timeString.split(":") : [null, null, null];
30
- return {
31
- hour,
32
- minute,
33
- second: second || (hour && minute ? "00" : null)
34
- };
103
+ function isValidTimePart(value, part) {
104
+ if (part === "meridiem") {
105
+ return value === "AM" || value === "PM";
106
+ }
107
+ if (!isValidNumber(value)) {
108
+ return false;
109
+ }
110
+ const valueAsNumber = Number(value);
111
+ return part === "hour" ? valueAsNumber >= 0 && valueAsNumber < 24 : valueAsNumber >= 0 && valueAsNumber < 60;
35
112
  }
36
- function formatTimeString(value) {
37
- if (!value || value.endsWith(":") || value.startsWith(":")) {
113
+ function localizeTimePart(value, part, locale) {
114
+ if (!isValidTimePart(value, part)) {
115
+ return;
116
+ }
117
+ const valueAsNumber = parseInt(value);
118
+ 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));
119
+ if (!date) {
120
+ return;
121
+ }
122
+ const formatter = createLocaleDateTimeFormatter(locale);
123
+ const parts = formatter.formatToParts(date);
124
+ return getLocalizedTimePart(part, parts);
125
+ }
126
+ function localizeTimeString(value, locale = "en", includeSeconds = true) {
127
+ if (!isValidTime(value)) {
38
128
  return null;
39
129
  }
40
- const splitValue = value.split(":");
41
- if (splitValue.length > 1) {
42
- const [hour, minute, second] = splitValue;
43
- const hourAsNumber = parseInt(splitValue[0]);
44
- const minuteAsNumber = parseInt(splitValue[1]);
45
- const secondAsNumber = parseInt(splitValue[2]);
46
- const hourValid = isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
47
- const minuteValid = isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
48
- const secondValid = isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
49
- if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
50
- let newValue = `${formatTimePart(hourAsNumber)}:${formatTimePart(minuteAsNumber)}`;
51
- if (secondValid) {
52
- newValue = `${newValue}:${formatTimePart(secondAsNumber)}`;
53
- }
54
- return newValue;
55
- }
130
+ const { hour, minute, second = "0" } = parseTimeString(value);
131
+ const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
132
+ const formatter = createLocaleDateTimeFormatter(locale, includeSeconds);
133
+ return (formatter === null || formatter === void 0 ? void 0 : formatter.format(dateFromTimeString)) || null;
134
+ }
135
+ function localizeTimeStringToParts(value, locale = "en") {
136
+ if (!isValidTime(value)) {
137
+ return null;
138
+ }
139
+ const { hour, minute, second = "0" } = parseTimeString(value);
140
+ const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
141
+ if (dateFromTimeString) {
142
+ const formatter = createLocaleDateTimeFormatter(locale);
143
+ const parts = formatter.formatToParts(dateFromTimeString);
144
+ return {
145
+ localizedHour: getLocalizedTimePart("hour", parts),
146
+ localizedHourSuffix: getLocalizedTimePart("hourSuffix", parts),
147
+ localizedMinute: getLocalizedTimePart("minute", parts),
148
+ localizedMinuteSuffix: getLocalizedTimePart("minuteSuffix", parts),
149
+ localizedSecond: getLocalizedTimePart("second", parts),
150
+ localizedSecondSuffix: getLocalizedTimePart("secondSuffix", parts),
151
+ localizedMeridiem: getLocalizedTimePart("meridiem", parts)
152
+ };
56
153
  }
57
154
  return null;
58
155
  }
59
- function formatTimePart(number) {
60
- const numberAsString = number.toString();
61
- return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
156
+ function parseTimeString(value) {
157
+ if (isValidTime(value)) {
158
+ const [hour, minute, second] = value.split(":");
159
+ return {
160
+ hour,
161
+ minute,
162
+ second
163
+ };
164
+ }
165
+ return {
166
+ hour: null,
167
+ minute: null,
168
+ second: null
169
+ };
62
170
  }
63
171
 
64
172
  const CSS = {
173
+ button: "button",
65
174
  buttonBottomLeft: "button--bottom-left",
66
175
  buttonBottomRight: "button--bottom-right",
67
- button: "button",
68
- delimiter: "delimiter",
69
- hour: "hour",
70
176
  buttonHourDown: "button--hour-down",
71
177
  buttonHourUp: "button--hour-up",
72
- input: "input",
73
- meridiem: "meridiem",
74
178
  buttonMeridiemDown: "button--meridiem-down",
75
179
  buttonMeridiemUp: "button--meridiem-up",
76
- minute: "minute",
77
180
  buttonMinuteDown: "button--minute-down",
78
181
  buttonMinuteUp: "button--minute-up",
79
- second: "second",
80
182
  buttonSecondDown: "button--second-down",
81
183
  buttonSecondUp: "button--second-up",
82
- timePicker: "time-picker",
83
184
  buttonTopLeft: "button--top-left",
84
- buttonTopRight: "button--top-right"
185
+ buttonTopRight: "button--top-right",
186
+ column: "column",
187
+ delimiter: "delimiter",
188
+ hour: "hour",
189
+ input: "input",
190
+ meridiem: "meridiem",
191
+ minute: "minute",
192
+ second: "second",
193
+ showMeridiem: "show-meridiem",
194
+ showSecond: "show-second",
195
+ "scale-s": "scale-s",
196
+ "scale-m": "scale-m",
197
+ "scale-l": "scale-l",
198
+ timePicker: "time-picker"
85
199
  };
86
200
  const TEXT = {
87
201
  hour: "Hour",
@@ -98,8 +212,11 @@ const TEXT = {
98
212
  secondUp: "Increase second"
99
213
  };
100
214
 
101
- const calciteTimePickerCss = "@-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{color:var(--calcite-ui-text-1);display:inline-block;font-weight:var(--calcite-font-weight-medium);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.time-picker{-webkit-box-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);box-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);-ms-flex-align:center;align-items:center;display:-ms-flexbox;display:flex;border-radius:var(--calcite-border-radius)}span{-ms-flex-align:center;align-items:center;background-color:var(--calcite-ui-foreground-1);display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center}span.button{cursor:pointer}span.button:hover,span.button:focus{background-color:var(--calcite-ui-foreground-2)}span.button:focus{outline:2px solid transparent;outline-offset:2px}span.button:active{background-color:var(--calcite-ui-foreground-3)}span.button.top-left{border-top-left-radius:var(--calcite-border-radius)}span.button.bottom-left{border-bottom-left-radius:var(--calcite-border-radius)}span.button.top-right{border-top-right-radius:var(--calcite-border-radius)}span.button.bottom-right{border-bottom-right-radius:var(--calcite-border-radius)}span.button calcite-icon{color:var(--calcite-ui-text-3)}span.input{font-weight:var(--calcite-font-weight-medium);position:relative}span.input:hover{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2)}span.input:focus,span.input:hover:focus{outline:2px solid transparent;outline-offset:2px;-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}:host([scale=s]){font-size:var(--calcite-font-size--1)}:host([scale=s]) span{height:24px;width:40px}:host([scale=s]) .delimiter{height:72px}:host([scale=s][hour-display-format=\"12\"]) .time-picker{width:124.2px}:host([scale=s][hour-display-format=\"12\"]:not([step=\"60\"])) .time-picker{width:168px}:host([scale=s][hour-display-format=\"24\"]) .time-picker{width:84.2px}:host([scale=s][hour-display-format=\"24\"]:not([step=\"60\"])) .time-picker{width:128.4px}:host([scale=m]){font-size:var(--calcite-font-size-0)}:host([scale=m]) span{height:32px;width:44px}:host([scale=m]) .delimiter{height:96px}:host([scale=m][hour-display-format=\"12\"]) .time-picker{width:136.8px}:host([scale=m][hour-display-format=\"12\"]:not([step=\"60\"])) .time-picker{width:186px}:host([scale=m][hour-display-format=\"24\"]) .time-picker{width:92.8px}:host([scale=m][hour-display-format=\"24\"]:not([step=\"60\"])) .time-picker{width:141.6px}:host([scale=l]){font-size:var(--calcite-font-size-1)}:host([scale=l]) span{height:48px;width:64px}:host([scale=l]) .delimiter{height:144px}:host([scale=l][hour-display-format=\"12\"]) .time-picker{width:198px}:host([scale=l][hour-display-format=\"12\"]:not([step=\"60\"])) .time-picker{width:268px}:host([scale=l][hour-display-format=\"24\"]) .time-picker{width:134px}:host([scale=l][hour-display-format=\"24\"]:not([step=\"60\"])) .time-picker{width:204px}";
215
+ const calciteTimePickerCss = "@-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{display:inline-block}.time-picker{background-color:var(--calcite-ui-foreground-1);display:-ms-flexbox;display:flex;font-weight:var(--calcite-font-weight-medium);-ms-flex-align:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-box-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);box-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);color:var(--calcite-ui-text-1);border-radius:var(--calcite-border-radius)}.time-picker .column{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.time-picker .button{background-color:var(--calcite-ui-foreground-1);cursor:pointer;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.time-picker .button:hover,.time-picker .button:focus{background-color:var(--calcite-ui-foreground-2);outline:2px solid transparent;outline-offset:2px}.time-picker .button:active{background-color:var(--calcite-ui-foreground-3)}.time-picker .button.top-left{border-top-left-radius:var(--calcite-border-radius)}.time-picker .button.bottom-left{border-bottom-left-radius:var(--calcite-border-radius)}.time-picker .button.top-right{border-top-right-radius:var(--calcite-border-radius)}.time-picker .button.bottom-right{border-bottom-right-radius:var(--calcite-border-radius)}.time-picker .button calcite-icon{color:var(--calcite-ui-text-3)}.time-picker .input{background-color:var(--calcite-ui-foreground-1);cursor:pointer;font-weight:var(--calcite-font-weight-medium);display:-ms-inline-flexbox;display:inline-flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center}.time-picker .input:hover{-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2);box-shadow:inset 0 0 0 2px var(--calcite-ui-foreground-2)}.time-picker .input:focus,.time-picker .input:hover:focus{outline:2px solid transparent;outline-offset:2px;-webkit-box-shadow:inset 0 0 0 2px var(--calcite-ui-brand);box-shadow:inset 0 0 0 2px var(--calcite-ui-brand)}.time-picker.scale-s{font-size:var(--calcite-font-size--1)}.time-picker.scale-s .button,.time-picker.scale-s .input{padding-left:0.75rem;padding-right:0.75rem;padding-top:0.25rem;padding-bottom:0.25rem}.time-picker.scale-s:not(.show-meridiem) .delimiter:last-child{-webkit-padding-end:0.75rem;padding-inline-end:0.75rem}.time-picker.scale-m{font-size:var(--calcite-font-size-0)}.time-picker.scale-m .button,.time-picker.scale-m .input{padding-left:1rem;padding-right:1rem;padding-top:0.5rem;padding-bottom:0.5rem}.time-picker.scale-m:not(.show-meridiem) .delimiter:last-child{-webkit-padding-end:1rem;padding-inline-end:1rem}.time-picker.scale-l{font-size:var(--calcite-font-size-1)}.time-picker.scale-l .button,.time-picker.scale-l .input{padding-left:1.25rem;padding-right:1.25rem;padding-top:0.75rem;padding-bottom:0.75rem}.time-picker.scale-l:not(.show-meridiem) .delimiter:last-child{-webkit-padding-end:1.25rem;padding-inline-end:1.25rem}";
102
216
 
217
+ function capitalize(str) {
218
+ return str.charAt(0).toUpperCase() + str.slice(1);
219
+ }
103
220
  let CalciteTimePicker = class extends HTMLElement {
104
221
  constructor() {
105
222
  super();
@@ -113,10 +230,6 @@ let CalciteTimePicker = class extends HTMLElement {
113
230
  // Properties
114
231
  //
115
232
  //--------------------------------------------------------------------------
116
- /** The hour value (24-hour format) */
117
- this.hour = null;
118
- /** Format of the hour value (12-hour or 24-hour) (this will be replaced by locale eventually) */
119
- this.hourDisplayFormat = "12";
120
233
  /** aria-label for the hour input
121
234
  * @default "Hour"
122
235
  */
@@ -165,35 +278,25 @@ let CalciteTimePicker = class extends HTMLElement {
165
278
  * @default "Increase second"
166
279
  */
167
280
  this.intlSecondUp = TEXT.secondUp;
168
- /** The minute value */
169
- this.minute = null;
170
- /** The second value */
171
- this.second = null;
281
+ /**
282
+ * BCP 47 language tag for desired language and country format
283
+ * @internal
284
+ */
285
+ this.locale = document.documentElement.lang || navigator.language || "en";
172
286
  /** The scale (size) of the time picker */
173
287
  this.scale = "m";
174
288
  /** number that specifies the granularity that the value must adhere to */
175
289
  this.step = 60;
176
- this.timeChanged = false;
177
- // --------------------------------------------------------------------------
178
- //
179
- // State
180
- //
181
- // --------------------------------------------------------------------------
182
- /** The am/pm value */
183
- this.meridiem = null;
184
- this.displayHour = this.getDisplayHour();
185
- // --------------------------------------------------------------------------
186
- //
187
- // Private Methods
188
- //
189
- // --------------------------------------------------------------------------
290
+ /** The selected time in UTC */
291
+ this.value = null;
292
+ this.showSecond = this.step < 60;
190
293
  this.decrementHour = () => {
191
294
  const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour) - 1;
192
- this.setTime("hour", newHour);
295
+ this.setValuePart("hour", newHour);
193
296
  };
194
297
  this.decrementMeridiem = () => {
195
298
  const newMeridiem = this.meridiem === "PM" ? "AM" : "PM";
196
- this.setTime("meridiem", newMeridiem);
299
+ this.setValuePart("meridiem", newMeridiem);
197
300
  };
198
301
  this.decrementMinuteOrSecond = (key) => {
199
302
  let newValue;
@@ -204,7 +307,7 @@ let CalciteTimePicker = class extends HTMLElement {
204
307
  else {
205
308
  newValue = 59;
206
309
  }
207
- this.setTime(key, newValue);
310
+ this.setValuePart(key, newValue);
208
311
  };
209
312
  this.decrementMinute = () => {
210
313
  this.decrementMinuteOrSecond("minute");
@@ -226,7 +329,7 @@ let CalciteTimePicker = class extends HTMLElement {
226
329
  const keyAsNumber = parseInt(key);
227
330
  let newHour;
228
331
  if (isValidNumber(this.hour)) {
229
- switch (this.hourDisplayFormat) {
332
+ switch (this.hourCycle) {
230
333
  case "12":
231
334
  newHour =
232
335
  this.hour === "01" && keyAsNumber >= 0 && keyAsNumber <= 2
@@ -249,13 +352,13 @@ let CalciteTimePicker = class extends HTMLElement {
249
352
  else {
250
353
  newHour = keyAsNumber;
251
354
  }
252
- this.setTime("hour", newHour);
355
+ this.setValuePart("hour", newHour);
253
356
  }
254
357
  else {
255
358
  switch (key) {
256
359
  case "Backspace":
257
360
  case "Delete":
258
- this.setTime("hour", null);
361
+ this.setValuePart("hour", null);
259
362
  break;
260
363
  case "ArrowDown":
261
364
  event.preventDefault();
@@ -279,7 +382,7 @@ let CalciteTimePicker = class extends HTMLElement {
279
382
  };
280
383
  this.incrementMeridiem = () => {
281
384
  const newMeridiem = this.meridiem === "AM" ? "PM" : "AM";
282
- this.setTime("meridiem", newMeridiem);
385
+ this.setValuePart("meridiem", newMeridiem);
283
386
  };
284
387
  this.incrementHour = () => {
285
388
  const newHour = isValidNumber(this.hour)
@@ -287,7 +390,7 @@ let CalciteTimePicker = class extends HTMLElement {
287
390
  ? 0
288
391
  : parseInt(this.hour) + 1
289
392
  : 1;
290
- this.setTime("hour", newHour);
393
+ this.setValuePart("hour", newHour);
291
394
  };
292
395
  this.incrementMinuteOrSecond = (key) => {
293
396
  const newValue = isValidNumber(this[key])
@@ -295,7 +398,7 @@ let CalciteTimePicker = class extends HTMLElement {
295
398
  ? 0
296
399
  : parseInt(this[key]) + 1
297
400
  : 0;
298
- this.setTime(key, newValue);
401
+ this.setValuePart(key, newValue);
299
402
  };
300
403
  this.incrementMinute = () => {
301
404
  this.incrementMinuteOrSecond("minute");
@@ -311,14 +414,14 @@ let CalciteTimePicker = class extends HTMLElement {
311
414
  this.meridiemKeyDownHandler = (event) => {
312
415
  switch (event.key) {
313
416
  case "a":
314
- this.setTime("meridiem", "AM");
417
+ this.setValuePart("meridiem", "AM");
315
418
  break;
316
419
  case "p":
317
- this.setTime("meridiem", "PM");
420
+ this.setValuePart("meridiem", "PM");
318
421
  break;
319
422
  case "Backspace":
320
423
  case "Delete":
321
- this.setTime("meridiem", null);
424
+ this.setValuePart("meridiem", null);
322
425
  break;
323
426
  case "ArrowUp":
324
427
  event.preventDefault();
@@ -359,13 +462,13 @@ let CalciteTimePicker = class extends HTMLElement {
359
462
  else {
360
463
  newMinute = keyAsNumber;
361
464
  }
362
- this.setTime("minute", newMinute);
465
+ this.setValuePart("minute", newMinute);
363
466
  }
364
467
  else {
365
468
  switch (key) {
366
469
  case "Backspace":
367
470
  case "Delete":
368
- this.setTime("minute", null);
471
+ this.setValuePart("minute", null);
369
472
  break;
370
473
  case "ArrowDown":
371
474
  event.preventDefault();
@@ -407,13 +510,13 @@ let CalciteTimePicker = class extends HTMLElement {
407
510
  else {
408
511
  newSecond = keyAsNumber;
409
512
  }
410
- this.setTime("second", newSecond);
513
+ this.setValuePart("second", newSecond);
411
514
  }
412
515
  else {
413
516
  switch (key) {
414
517
  case "Backspace":
415
518
  case "Delete":
416
- this.setTime("second", null);
519
+ this.setValuePart("second", null);
417
520
  break;
418
521
  case "ArrowDown":
419
522
  event.preventDefault();
@@ -435,59 +538,96 @@ let CalciteTimePicker = class extends HTMLElement {
435
538
  this.incrementSecond();
436
539
  }
437
540
  };
438
- this.setTime = (key, value, emit = true) => {
439
- switch (key) {
440
- default:
441
- return;
442
- case "hour":
443
- this.hour = typeof value === "number" ? formatTimePart(value) : value;
444
- break;
445
- case "minute":
446
- this.minute = typeof value === "number" ? formatTimePart(value) : value;
447
- break;
448
- case "second":
449
- this.second = typeof value === "number" ? formatTimePart(value) : value;
450
- break;
451
- case "meridiem":
452
- if (isValidNumber(this.hour)) {
453
- const hourAsNumber = parseInt(this.hour);
454
- switch (value) {
455
- case "AM":
456
- if (hourAsNumber >= 12) {
457
- this.hour = formatTimePart(hourAsNumber - 12);
458
- }
459
- break;
460
- case "PM":
461
- if (hourAsNumber < 12) {
462
- this.hour = formatTimePart(hourAsNumber + 12);
463
- }
464
- break;
465
- }
466
- this.meridiem = value;
467
- }
468
- else {
469
- this.meridiem = value;
541
+ this.setHourEl = (el) => (this.hourEl = el);
542
+ this.setMeridiemEl = (el) => (this.meridiemEl = el);
543
+ this.setMinuteEl = (el) => (this.minuteEl = el);
544
+ this.setSecondEl = (el) => (this.secondEl = el);
545
+ this.setValue = (value, emit = true) => {
546
+ if (isValidTime(value)) {
547
+ const { hour, minute, second } = parseTimeString(value);
548
+ const { localizedHour, localizedHourSuffix, localizedMinute, localizedMinuteSuffix, localizedSecond, localizedSecondSuffix, localizedMeridiem } = localizeTimeStringToParts(value, this.locale);
549
+ this.localizedHour = localizedHour;
550
+ this.localizedHourSuffix = localizedHourSuffix;
551
+ this.localizedMinute = localizedMinute;
552
+ this.localizedMinuteSuffix = localizedMinuteSuffix;
553
+ this.localizedSecond = localizedSecond;
554
+ this.localizedSecondSuffix = localizedSecondSuffix;
555
+ this.hour = hour;
556
+ this.minute = minute;
557
+ this.second = second;
558
+ if (localizedMeridiem) {
559
+ this.localizedMeridiem = localizedMeridiem;
560
+ this.meridiem = getMeridiem(this.hour);
561
+ }
562
+ }
563
+ else {
564
+ this.hour = null;
565
+ this.localizedHour = null;
566
+ this.localizedHourSuffix = null;
567
+ this.localizedMeridiem = null;
568
+ this.localizedMinute = null;
569
+ this.localizedMinuteSuffix = null;
570
+ this.localizedSecond = null;
571
+ this.localizedSecondSuffix = null;
572
+ this.meridiem = null;
573
+ this.minute = null;
574
+ this.second = null;
575
+ this.value = null;
576
+ }
577
+ if (emit) {
578
+ this.calciteTimePickerChange.emit();
579
+ }
580
+ };
581
+ this.setValuePart = (key, value, emit = true) => {
582
+ var _a;
583
+ if (key === "meridiem") {
584
+ this.meridiem = value;
585
+ if (isValidNumber(this.hour)) {
586
+ const hourAsNumber = parseInt(this.hour);
587
+ switch (value) {
588
+ case "AM":
589
+ if (hourAsNumber >= 12) {
590
+ this.hour = formatTimePart(hourAsNumber - 12);
591
+ }
592
+ break;
593
+ case "PM":
594
+ if (hourAsNumber < 12) {
595
+ this.hour = formatTimePart(hourAsNumber + 12);
596
+ }
597
+ break;
470
598
  }
471
- break;
599
+ this.localizedHour = localizeTimePart(this.hour, "hour", this.locale);
600
+ }
601
+ }
602
+ else {
603
+ this[key] = typeof value === "number" ? formatTimePart(value) : value;
604
+ this[`localized${capitalize(key)}`] = localizeTimePart(this[key], key, this.locale);
605
+ }
606
+ if (this.hour && this.minute) {
607
+ const showSeconds = this.second && this.showSecond;
608
+ this.value = `${this.hour}:${this.minute}:${showSeconds ? this.second : "00"}`;
609
+ }
610
+ else {
611
+ this.value = null;
472
612
  }
473
- this.timeChanged = true;
613
+ this.localizedMeridiem = this.value
614
+ ? ((_a = localizeTimeStringToParts(this.value, this.locale)) === null || _a === void 0 ? void 0 : _a.localizedMeridiem) || null
615
+ : localizeTimePart(this.meridiem, "meridiem", this.locale);
474
616
  if (emit) {
475
- this.calciteTimePickerChange.emit(this.getTime());
617
+ this.calciteTimePickerChange.emit();
476
618
  }
477
619
  };
478
620
  }
479
- hourChanged(newHour) {
480
- if (this.hourDisplayFormat === "12" && isValidNumber(newHour)) {
481
- this.meridiem = getMeridiem(newHour);
482
- }
621
+ localeWatcher(newLocale) {
622
+ this.hourCycle = getLocaleHourCycle(newLocale);
623
+ this.setValue(this.value, false);
483
624
  }
484
- timeChangeHandler() {
485
- const { hour, minute } = this.getTime();
486
- if (!hour && !minute) {
487
- this.setTime("meridiem", null, false);
488
- }
489
- if (this.timeChanged) {
490
- this.timeChanged = false;
625
+ valueWatcher(newValue) {
626
+ this.setValue(newValue, false);
627
+ }
628
+ hourChanged(newHour) {
629
+ if (this.meridiem && isValidNumber(newHour)) {
630
+ this.setValuePart("meridiem", getMeridiem(newHour));
491
631
  }
492
632
  }
493
633
  //--------------------------------------------------------------------------
@@ -518,7 +658,7 @@ let CalciteTimePicker = class extends HTMLElement {
518
658
  if (this.step !== 60) {
519
659
  this.setFocus("second");
520
660
  }
521
- else if (this.hourDisplayFormat === "12") {
661
+ else if (this.hourCycle === "12") {
522
662
  this.setFocus("meridiem");
523
663
  }
524
664
  break;
@@ -530,7 +670,7 @@ let CalciteTimePicker = class extends HTMLElement {
530
670
  this.setFocus("minute");
531
671
  break;
532
672
  case "ArrowRight":
533
- if (this.hourDisplayFormat === "12") {
673
+ if (this.hourCycle === "12") {
534
674
  this.setFocus("meridiem");
535
675
  }
536
676
  break;
@@ -560,6 +700,11 @@ let CalciteTimePicker = class extends HTMLElement {
560
700
  var _a;
561
701
  (_a = this[`${target || "hour"}El`]) === null || _a === void 0 ? void 0 : _a.focus();
562
702
  }
703
+ // --------------------------------------------------------------------------
704
+ //
705
+ // Private Methods
706
+ //
707
+ // --------------------------------------------------------------------------
563
708
  buttonActivated(event) {
564
709
  const key = event.key;
565
710
  if (key === " ") {
@@ -567,40 +712,14 @@ let CalciteTimePicker = class extends HTMLElement {
567
712
  }
568
713
  return isActivationKey(key);
569
714
  }
570
- getDisplayHour() {
571
- if (!this.hour) {
572
- return "--";
573
- }
574
- if (this.hourDisplayFormat === "12") {
575
- return getMeridiemHour(this.hour);
576
- }
577
- return this.hour;
578
- }
579
- getTime() {
580
- return {
581
- hour: this.hour,
582
- minute: this.minute,
583
- second: this.second
584
- };
585
- }
586
715
  // --------------------------------------------------------------------------
587
716
  //
588
717
  // Lifecycle
589
718
  //
590
719
  // --------------------------------------------------------------------------
591
720
  connectedCallback() {
592
- if (this.hourDisplayFormat === "12") {
593
- this.meridiem = getMeridiem(this.hour);
594
- }
595
- if (isValidNumber(this.hour)) {
596
- this.hour = formatTimePart(parseInt(this.hour));
597
- }
598
- if (isValidNumber(this.minute)) {
599
- this.minute = formatTimePart(parseInt(this.minute));
600
- }
601
- if (isValidNumber(this.second)) {
602
- this.second = formatTimePart(parseInt(this.second));
603
- }
721
+ this.setValue(this.value, false);
722
+ this.hourCycle = getLocaleHourCycle(this.locale);
604
723
  }
605
724
  // --------------------------------------------------------------------------
606
725
  //
@@ -608,64 +727,67 @@ let CalciteTimePicker = class extends HTMLElement {
608
727
  //
609
728
  // --------------------------------------------------------------------------
610
729
  render() {
611
- const iconScale = this.scale === "s" || this.scale === "m" ? "s" : "m";
612
- const includeSeconds = this.step !== 60;
613
730
  const hourIsNumber = isValidNumber(this.hour);
731
+ const iconScale = this.scale === "s" || this.scale === "m" ? "s" : "m";
614
732
  const minuteIsNumber = isValidNumber(this.minute);
615
733
  const secondIsNumber = isValidNumber(this.second);
616
- return (h(Host, null, h("div", { class: CSS.timePicker }, h("div", { role: "group" }, h("span", { "aria-label": this.intlHourUp, class: {
734
+ const showMeridiem = this.hourCycle === "12";
735
+ return (h("div", { class: {
736
+ [CSS.timePicker]: true,
737
+ [CSS.showMeridiem]: showMeridiem,
738
+ [CSS.showSecond]: this.showSecond,
739
+ [CSS[`scale-${this.scale}`]]: true
740
+ } }, h("div", { class: CSS.column, role: "group" }, h("span", { "aria-label": this.intlHourUp, class: {
617
741
  [CSS.button]: true,
618
742
  [CSS.buttonHourUp]: true,
619
743
  [CSS.buttonTopLeft]: true
620
- }, onClick: this.incrementHour, onKeyDown: this.hourUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlHour, "aria-valuemax": "23", "aria-valuemin": "1", "aria-valuenow": hourIsNumber && parseInt(this.hour), "aria-valuetext": this.hour, class: {
744
+ }, onClick: this.incrementHour, onKeyDown: this.hourUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlHour, "aria-valuemax": "23", "aria-valuemin": "1", "aria-valuenow": (hourIsNumber && parseInt(this.hour)) || "0", "aria-valuetext": this.hour, class: {
621
745
  [CSS.input]: true,
622
746
  [CSS.hour]: true
623
- }, onFocus: this.focusHandler, onKeyDown: this.hourKeyDownHandler, ref: (el) => (this.hourEl = el), role: "spinbutton", tabIndex: 0 }, this.getDisplayHour()), h("span", { "aria-label": this.intlHourDown, class: {
747
+ }, onFocus: this.focusHandler, onKeyDown: this.hourKeyDownHandler, ref: this.setHourEl, role: "spinbutton", tabIndex: 0 }, this.localizedHour || "--"), h("span", { "aria-label": this.intlHourDown, class: {
624
748
  [CSS.button]: true,
625
749
  [CSS.buttonHourDown]: true,
626
750
  [CSS.buttonBottomLeft]: true
627
- }, onClick: this.decrementHour, onKeyDown: this.hourDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale }))), h("span", { class: CSS.delimiter }, ":"), h("div", { role: "group" }, h("span", { "aria-label": this.intlMinuteUp, class: {
751
+ }, onClick: this.decrementHour, onKeyDown: this.hourDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale }))), h("span", { class: CSS.delimiter }, this.localizedHourSuffix), h("div", { class: CSS.column, role: "group" }, h("span", { "aria-label": this.intlMinuteUp, class: {
628
752
  [CSS.button]: true,
629
753
  [CSS.buttonMinuteUp]: true
630
- }, onClick: this.incrementMinute, onKeyDown: this.minuteUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlMinute, "aria-valuemax": "12", "aria-valuemin": "1", "aria-valuenow": minuteIsNumber && parseInt(this.minute), "aria-valuetext": this.minute, class: {
754
+ }, onClick: this.incrementMinute, onKeyDown: this.minuteUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlMinute, "aria-valuemax": "12", "aria-valuemin": "1", "aria-valuenow": (minuteIsNumber && parseInt(this.minute)) || "0", "aria-valuetext": this.minute, class: {
631
755
  [CSS.input]: true,
632
756
  [CSS.minute]: true
633
- }, onFocus: this.focusHandler, onKeyDown: this.minuteKeyDownHandler, ref: (el) => (this.minuteEl = el), role: "spinbutton", tabIndex: 0 }, this.minute ? this.minute : "--"), h("span", { "aria-label": this.intlMinuteDown, class: {
757
+ }, onFocus: this.focusHandler, onKeyDown: this.minuteKeyDownHandler, ref: this.setMinuteEl, role: "spinbutton", tabIndex: 0 }, this.localizedMinute || "--"), h("span", { "aria-label": this.intlMinuteDown, class: {
634
758
  [CSS.button]: true,
635
759
  [CSS.buttonMinuteDown]: true
636
- }, onClick: this.decrementMinute, onKeyDown: this.minuteDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale }))), includeSeconds && h("span", { class: CSS.delimiter }, ":"), includeSeconds && (h("div", { role: "group" }, h("span", { "aria-label": this.intlSecondUp, class: {
760
+ }, onClick: this.decrementMinute, onKeyDown: this.minuteDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale }))), this.showSecond && h("span", { class: CSS.delimiter }, this.localizedMinuteSuffix), this.showSecond && (h("div", { class: CSS.column, role: "group" }, h("span", { "aria-label": this.intlSecondUp, class: {
637
761
  [CSS.button]: true,
638
762
  [CSS.buttonSecondUp]: true
639
- }, onClick: this.incrementSecond, onKeyDown: this.secondUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlSecond, "aria-valuemax": "59", "aria-valuemin": "0", "aria-valuenow": secondIsNumber && parseInt(this.second), "aria-valuetext": this.second, class: {
763
+ }, onClick: this.incrementSecond, onKeyDown: this.secondUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlSecond, "aria-valuemax": "59", "aria-valuemin": "0", "aria-valuenow": (secondIsNumber && parseInt(this.second)) || "0", "aria-valuetext": this.second, class: {
640
764
  [CSS.input]: true,
641
765
  [CSS.second]: true
642
- }, onFocus: this.focusHandler, onKeyDown: this.secondKeyDownHandler, ref: (el) => (this.secondEl = el), role: "spinbutton", tabIndex: 0 }, this.second ? this.second : "--"), h("span", { "aria-label": this.intlSecondDown, class: {
766
+ }, onFocus: this.focusHandler, onKeyDown: this.secondKeyDownHandler, ref: this.setSecondEl, role: "spinbutton", tabIndex: 0 }, this.localizedSecond || "--"), h("span", { "aria-label": this.intlSecondDown, class: {
643
767
  [CSS.button]: true,
644
768
  [CSS.buttonSecondDown]: true
645
- }, onClick: this.decrementSecond, onKeyDown: this.secondDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale })))), this.hourDisplayFormat === "12" && (h("div", { role: "group" }, h("span", { "aria-label": this.intlMeridiemUp, class: {
769
+ }, onClick: this.decrementSecond, onKeyDown: this.secondDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale })))), this.localizedSecondSuffix && (h("span", { class: CSS.delimiter }, this.localizedSecondSuffix)), showMeridiem && (h("div", { class: CSS.column, role: "group" }, h("span", { "aria-label": this.intlMeridiemUp, class: {
646
770
  [CSS.button]: true,
647
771
  [CSS.buttonMeridiemUp]: true,
648
772
  [CSS.buttonTopRight]: true
649
- }, onClick: this.incrementMeridiem, onKeyDown: this.meridiemUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlMeridiem, "aria-valuemax": "2", "aria-valuemin": "1", "aria-valuenow": this.meridiem === "AM" ? "1" : this.meridiem === "PM" ? "2" : undefined, "aria-valuetext": this.meridiem, class: {
773
+ }, onClick: this.incrementMeridiem, onKeyDown: this.meridiemUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-up", scale: iconScale })), h("span", { "aria-label": this.intlMeridiem, "aria-valuemax": "2", "aria-valuemin": "1", "aria-valuenow": (this.meridiem === "PM" && "2") || "1", "aria-valuetext": this.meridiem, class: {
650
774
  [CSS.input]: true,
651
775
  [CSS.meridiem]: true
652
- }, onFocus: this.focusHandler, onKeyDown: this.meridiemKeyDownHandler, ref: (el) => (this.meridiemEl = el), role: "spinbutton", tabIndex: 0 }, this.meridiem ? this.meridiem : "--"), h("span", { "aria-label": this.intlMeridiemDown, class: {
776
+ }, onFocus: this.focusHandler, onKeyDown: this.meridiemKeyDownHandler, ref: this.setMeridiemEl, role: "spinbutton", tabIndex: 0 }, this.localizedMeridiem || "--"), h("span", { "aria-label": this.intlMeridiemDown, class: {
653
777
  [CSS.button]: true,
654
778
  [CSS.buttonMeridiemDown]: true,
655
779
  [CSS.buttonBottomRight]: true
656
- }, onClick: this.decrementMeridiem, onKeyDown: this.meridiemDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale })))))));
780
+ }, onClick: this.decrementMeridiem, onKeyDown: this.meridiemDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, h("calcite-icon", { icon: "chevron-down", scale: iconScale }))))));
657
781
  }
658
782
  get el() { return this; }
659
783
  static get watchers() { return {
660
- "hour": ["hourChanged", "timeChangeHandler"],
661
- "minute": ["timeChangeHandler"],
662
- "second": ["timeChangeHandler"]
784
+ "locale": ["localeWatcher"],
785
+ "value": ["valueWatcher"],
786
+ "hour": ["hourChanged"]
663
787
  }; }
664
788
  static get style() { return calciteTimePickerCss; }
665
789
  };
666
790
  CalciteTimePicker = /*@__PURE__*/ proxyCustomElement(CalciteTimePicker, [1, "calcite-time-picker", {
667
- "hour": [1025],
668
- "hourDisplayFormat": [513, "hour-display-format"],
669
791
  "intlHour": [1, "intl-hour"],
670
792
  "intlHourDown": [1, "intl-hour-down"],
671
793
  "intlHourUp": [1, "intl-hour-up"],
@@ -678,12 +800,23 @@ CalciteTimePicker = /*@__PURE__*/ proxyCustomElement(CalciteTimePicker, [1, "cal
678
800
  "intlSecond": [1, "intl-second"],
679
801
  "intlSecondDown": [1, "intl-second-down"],
680
802
  "intlSecondUp": [1, "intl-second-up"],
681
- "minute": [1025],
682
- "second": [1025],
683
- "scale": [513],
684
- "step": [514],
803
+ "locale": [1025, "lang"],
804
+ "scale": [1],
805
+ "step": [2],
806
+ "value": [1025],
807
+ "hour": [32],
808
+ "hourCycle": [32],
809
+ "localizedHour": [32],
810
+ "localizedHourSuffix": [32],
811
+ "localizedMeridiem": [32],
812
+ "localizedMinute": [32],
813
+ "localizedMinuteSuffix": [32],
814
+ "localizedSecond": [32],
815
+ "localizedSecondSuffix": [32],
685
816
  "meridiem": [32],
686
- "displayHour": [32],
817
+ "minute": [32],
818
+ "second": [32],
819
+ "showSecond": [32],
687
820
  "setFocus": [64]
688
821
  }, [[0, "blur", "hostBlurHandler"], [0, "focus", "hostFocusHandler"], [0, "keydown", "keyDownHandler"]]]);
689
822
  function defineCustomElement() {
@@ -706,4 +839,4 @@ function defineCustomElement() {
706
839
  }
707
840
  defineCustomElement();
708
841
 
709
- export { CalciteTimePicker as C, getMeridiem as a, defineCustomElement as d, formatTimeString as f, getMeridiemHour as g, parseTimeString as p };
842
+ export { CalciteTimePicker as C, defineCustomElement as d, formatTimeString as f, isValidTime as i, localizeTimeString as l };