12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055 |
- /*!
- * All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- * See https://github.com/Esri/calcite-components/blob/master/LICENSE.md for details.
- * v1.0.0-beta.82
- */
- 'use strict';
- Object.defineProperty(exports, '__esModule', { value: true });
- const index = require('./index-5c65e149.js');
- const guid = require('./guid-8b6d6cb4.js');
- const number = require('./number-364babbc.js');
- const label = require('./label-165fc611.js');
- const form = require('./form-11926121.js');
- const interactive = require('./interactive-e294111f.js');
- require('./dom-9ac0341c.js');
- const maxTenthForMinuteAndSecond = 5;
- function createLocaleDateTimeFormatter(locale, includeSeconds = true) {
- try {
- const options = {
- hour: "2-digit",
- minute: "2-digit",
- timeZone: "UTC"
- };
- if (includeSeconds) {
- options.second = "2-digit";
- }
- return new Intl.DateTimeFormat(locale, options);
- }
- catch (e) {
- throw new Error(`Invalid locale supplied while attempting to create a DateTime formatter: ${locale}`);
- }
- }
- function formatTimePart(number) {
- const numberAsString = number.toString();
- return number >= 0 && number <= 9 ? numberAsString.padStart(2, "0") : numberAsString;
- }
- function formatTimeString(value) {
- if (!isValidTime(value)) {
- return null;
- }
- const [hourString, minuteString, secondString] = value.split(":");
- const hour = formatTimePart(parseInt(hourString));
- const minute = formatTimePart(parseInt(minuteString));
- if (secondString) {
- const second = formatTimePart(parseInt(secondString));
- return `${hour}:${minute}:${second}`;
- }
- return `${hour}:${minute}`;
- }
- function getLocaleHourCycle(locale) {
- const formatter = createLocaleDateTimeFormatter(locale);
- const parts = formatter.formatToParts(new Date(Date.UTC(0, 0, 0, 0, 0, 0)));
- return getLocalizedTimePart("meridiem", parts) ? "12" : "24";
- }
- function getLocalizedTimePart(part, parts) {
- var _a, _b, _c, _d;
- if (!part || !parts) {
- return null;
- }
- if (part === "hourSuffix") {
- const hourIndex = parts.indexOf(parts.find(({ type }) => type === "hour"));
- const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
- const hourSuffix = parts[hourIndex + 1];
- return hourSuffix && hourSuffix.type === "literal" && minuteIndex - hourIndex === 2
- ? ((_a = hourSuffix.value) === null || _a === void 0 ? void 0 : _a.trim()) || null
- : null;
- }
- if (part === "minuteSuffix") {
- const minuteIndex = parts.indexOf(parts.find(({ type }) => type === "minute"));
- const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
- const minuteSuffix = parts[minuteIndex + 1];
- return minuteSuffix && minuteSuffix.type === "literal" && secondIndex - minuteIndex === 2
- ? ((_b = minuteSuffix.value) === null || _b === void 0 ? void 0 : _b.trim()) || null
- : null;
- }
- if (part === "secondSuffix") {
- const secondIndex = parts.indexOf(parts.find(({ type }) => type === "second"));
- const secondSuffix = parts[secondIndex + 1];
- return secondSuffix && secondSuffix.type === "literal" ? ((_c = secondSuffix.value) === null || _c === void 0 ? void 0 : _c.trim()) || null : null;
- }
- return ((_d = parts.find(({ type }) => (part == "meridiem" ? type === "dayPeriod" : type === part))) === null || _d === void 0 ? void 0 : _d.value) || null;
- }
- function getMeridiem(hour) {
- if (!number.isValidNumber(hour)) {
- return null;
- }
- const hourAsNumber = parseInt(hour);
- return hourAsNumber >= 0 && hourAsNumber <= 11 ? "AM" : "PM";
- }
- function isValidTime(value) {
- if (!value || value.startsWith(":") || value.endsWith(":")) {
- return false;
- }
- const splitValue = value.split(":");
- const validLength = splitValue.length > 1 && splitValue.length < 4;
- if (!validLength) {
- return false;
- }
- const [hour, minute, second] = splitValue;
- const hourAsNumber = parseInt(splitValue[0]);
- const minuteAsNumber = parseInt(splitValue[1]);
- const secondAsNumber = parseInt(splitValue[2]);
- const hourValid = number.isValidNumber(hour) && hourAsNumber >= 0 && hourAsNumber < 24;
- const minuteValid = number.isValidNumber(minute) && minuteAsNumber >= 0 && minuteAsNumber < 60;
- const secondValid = number.isValidNumber(second) && secondAsNumber >= 0 && secondAsNumber < 60;
- if ((hourValid && minuteValid && !second) || (hourValid && minuteValid && secondValid)) {
- return true;
- }
- }
- function isValidTimePart(value, part) {
- if (part === "meridiem") {
- return value === "AM" || value === "PM";
- }
- if (!number.isValidNumber(value)) {
- return false;
- }
- const valueAsNumber = Number(value);
- return part === "hour" ? valueAsNumber >= 0 && valueAsNumber < 24 : valueAsNumber >= 0 && valueAsNumber < 60;
- }
- function localizeTimePart(value, part, locale) {
- if (!isValidTimePart(value, part)) {
- return;
- }
- const valueAsNumber = parseInt(value);
- 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));
- if (!date) {
- return;
- }
- const formatter = createLocaleDateTimeFormatter(locale);
- const parts = formatter.formatToParts(date);
- return getLocalizedTimePart(part, parts);
- }
- function localizeTimeString(value, locale = "en", includeSeconds = true) {
- if (!isValidTime(value)) {
- return null;
- }
- const { hour, minute, second = "0" } = parseTimeString(value);
- const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
- const formatter = createLocaleDateTimeFormatter(locale, includeSeconds);
- return (formatter === null || formatter === void 0 ? void 0 : formatter.format(dateFromTimeString)) || null;
- }
- function localizeTimeStringToParts(value, locale = "en") {
- if (!isValidTime(value)) {
- return null;
- }
- const { hour, minute, second = "0" } = parseTimeString(value);
- const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
- if (dateFromTimeString) {
- const formatter = createLocaleDateTimeFormatter(locale);
- const parts = formatter.formatToParts(dateFromTimeString);
- return {
- localizedHour: getLocalizedTimePart("hour", parts),
- localizedHourSuffix: getLocalizedTimePart("hourSuffix", parts),
- localizedMinute: getLocalizedTimePart("minute", parts),
- localizedMinuteSuffix: getLocalizedTimePart("minuteSuffix", parts),
- localizedSecond: getLocalizedTimePart("second", parts),
- localizedSecondSuffix: getLocalizedTimePart("secondSuffix", parts),
- localizedMeridiem: getLocalizedTimePart("meridiem", parts)
- };
- }
- return null;
- }
- function getTimeParts(value, locale = "en") {
- if (!isValidTime(value)) {
- return null;
- }
- const { hour, minute, second = "0" } = parseTimeString(value);
- const dateFromTimeString = new Date(Date.UTC(0, 0, 0, parseInt(hour), parseInt(minute), parseInt(second)));
- if (dateFromTimeString) {
- const formatter = createLocaleDateTimeFormatter(locale);
- const parts = formatter.formatToParts(dateFromTimeString);
- return parts;
- }
- return null;
- }
- function parseTimeString(value) {
- if (isValidTime(value)) {
- const [hour, minute, second] = value.split(":");
- return {
- hour,
- minute,
- second
- };
- }
- return {
- hour: null,
- minute: null,
- second: null
- };
- }
- const inputTimePickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host([disabled]){pointer-events:none;cursor:default;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;opacity:var(--calcite-ui-opacity-disabled)}:host([disabled]) ::slotted([calcite-hydrated][disabled]),:host([disabled]) [calcite-hydrated][disabled]{opacity:1}::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}";
- const InputTimePicker = class {
- constructor(hostRef) {
- index.registerInstance(this, hostRef);
- this.calciteInputTimePickerChange = index.createEvent(this, "calciteInputTimePickerChange", 7);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** The active state of the time input */
- this.active = false;
- /** The disabled state of the time input */
- this.disabled = false;
- /**
- * BCP 47 language tag for desired language and country format
- * @internal
- */
- this.locale = document.documentElement.lang || navigator.language || "en";
- /**
- * When true, makes the component required for form-submission.
- *
- * @internal
- */
- this.required = false;
- /** The scale (size) of the time input */
- this.scale = "m";
- /**
- * Determines where the popover will be positioned relative to the input.
- * @see [PopperPlacement](https://github.com/Esri/calcite-components/blob/master/src/utils/popper.ts#L25)
- */
- this.placement = "auto";
- /** number (seconds) that specifies the granularity that the value must adhere to */
- this.step = 60;
- /** The selected time in UTC (always 24-hour format) */
- this.value = null;
- /** whether the value of the input was changed as a result of user typing or not */
- this.internalValueChange = false;
- this.previousValidValue = null;
- this.referenceElementId = `input-time-picker-${guid.guid()}`;
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- this.calciteInputBlurHandler = () => {
- this.active = false;
- const shouldIncludeSeconds = this.shouldIncludeSeconds();
- const localizedInputValue = localizeTimeString(this.calciteInputEl.value, this.locale, shouldIncludeSeconds);
- this.setInputValue(localizedInputValue || localizeTimeString(this.value, this.locale, shouldIncludeSeconds));
- };
- this.calciteInputFocusHandler = () => {
- this.active = true;
- };
- this.calciteInputInputHandler = (event) => {
- const target = event.target;
- this.setValue({ value: target.value });
- };
- this.timePickerChangeHandler = (event) => {
- event.stopPropagation();
- const target = event.target;
- const value = target.value;
- this.setValue({ value, origin: "time-picker" });
- };
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- this.keyDownHandler = (event) => {
- if (event.key === "Enter" && !event.defaultPrevented) {
- form.submitForm(this);
- }
- };
- this.setCalcitePopoverEl = (el) => {
- this.popoverEl = el;
- };
- this.setCalciteInputEl = (el) => {
- this.calciteInputEl = el;
- };
- this.setCalciteTimePickerEl = (el) => {
- this.calciteTimePickerEl = el;
- };
- this.setInputValue = (newInputValue) => {
- if (!this.calciteInputEl) {
- return;
- }
- this.calciteInputEl.value = newInputValue;
- };
- this.setValue = ({ value, origin = "input" }) => {
- const previousValue = this.value;
- const newValue = formatTimeString(value);
- const newLocalizedValue = localizeTimeString(newValue, this.locale, this.shouldIncludeSeconds());
- this.internalValueChange = origin !== "external" && origin !== "loading";
- const shouldEmit = origin !== "loading" &&
- origin !== "external" &&
- ((value !== this.previousValidValue && !value) ||
- !!(!this.previousValidValue && newValue) ||
- (newValue !== this.previousValidValue && newValue));
- if (value) {
- if (shouldEmit) {
- this.previousValidValue = newValue;
- }
- if (newValue && newValue !== this.value) {
- this.value = newValue;
- }
- this.localizedValue = newLocalizedValue;
- }
- else {
- this.value = value;
- this.localizedValue = null;
- }
- if (origin === "time-picker" || origin === "external") {
- this.setInputValue(newLocalizedValue);
- }
- if (shouldEmit) {
- const changeEvent = this.calciteInputTimePickerChange.emit();
- if (changeEvent.defaultPrevented) {
- this.internalValueChange = false;
- this.value = previousValue;
- this.setInputValue(previousValue);
- this.previousValidValue = previousValue;
- }
- else {
- this.previousValidValue = newValue;
- }
- }
- };
- }
- activeHandler() {
- if (this.disabled) {
- this.active = false;
- return;
- }
- this.reposition();
- }
- handleDisabledChange(value) {
- if (!value) {
- this.active = false;
- }
- }
- localeWatcher(newLocale) {
- this.setInputValue(localizeTimeString(this.value, newLocale, this.shouldIncludeSeconds()));
- }
- valueWatcher(newValue) {
- if (!this.internalValueChange) {
- this.setValue({ value: newValue, origin: "external" });
- }
- this.internalValueChange = false;
- }
- clickHandler(event) {
- if (event.composedPath().includes(this.calciteTimePickerEl)) {
- return;
- }
- this.setFocus();
- }
- keyUpHandler(event) {
- if (event.key === "Escape" && this.active) {
- this.active = false;
- }
- }
- timePickerBlurHandler(event) {
- event.preventDefault();
- event.stopPropagation();
- this.active = false;
- }
- timePickerFocusHandler(event) {
- event.preventDefault();
- event.stopPropagation();
- this.active = true;
- }
- // --------------------------------------------------------------------------
- //
- // Public Methods
- //
- // --------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus() {
- this.calciteInputEl.setFocus();
- }
- /** Updates the position of the component. */
- async reposition() {
- var _a;
- (_a = this.popoverEl) === null || _a === void 0 ? void 0 : _a.reposition();
- }
- onLabelClick() {
- this.setFocus();
- }
- shouldIncludeSeconds() {
- return this.step < 60;
- }
- //--------------------------------------------------------------------------
- //
- // Lifecycle
- //
- //--------------------------------------------------------------------------
- connectedCallback() {
- if (this.value) {
- this.setValue({ value: isValidTime(this.value) ? this.value : undefined, origin: "loading" });
- }
- label.connectLabel(this);
- form.connectForm(this);
- }
- componentDidLoad() {
- this.setInputValue(this.localizedValue);
- }
- disconnectedCallback() {
- label.disconnectLabel(this);
- form.disconnectForm(this);
- }
- componentDidRender() {
- interactive.updateHostInteraction(this);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const popoverId = `${this.referenceElementId}-popover`;
- return (index.h(index.Host, { onKeyDown: this.keyDownHandler }, index.h("div", { "aria-controls": popoverId, "aria-haspopup": "dialog", "aria-label": this.name, "aria-owns": popoverId, id: this.referenceElementId, role: "combobox" }, index.h("calcite-input", { disabled: this.disabled, icon: "clock", label: label.getLabelText(this), onCalciteInputBlur: this.calciteInputBlurHandler, onCalciteInputFocus: this.calciteInputFocusHandler, onCalciteInputInput: this.calciteInputInputHandler, ref: this.setCalciteInputEl, scale: this.scale, step: this.step })), index.h("calcite-popover", { id: popoverId, label: "Time Picker", open: this.active, placement: this.placement, ref: this.setCalcitePopoverEl, referenceElement: this.referenceElementId }, index.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 })), index.h(form.HiddenFormInputSlot, { component: this })));
- }
- get el() { return index.getElement(this); }
- static get watchers() { return {
- "active": ["activeHandler"],
- "disabled": ["handleDisabledChange"],
- "locale": ["localeWatcher"],
- "value": ["valueWatcher"]
- }; }
- };
- InputTimePicker.style = inputTimePickerCss;
- const CSS = {
- button: "button",
- buttonBottomLeft: "button--bottom-left",
- buttonBottomRight: "button--bottom-right",
- buttonHourDown: "button--hour-down",
- buttonHourUp: "button--hour-up",
- buttonMeridiemDown: "button--meridiem-down",
- buttonMeridiemUp: "button--meridiem-up",
- buttonMinuteDown: "button--minute-down",
- buttonMinuteUp: "button--minute-up",
- buttonSecondDown: "button--second-down",
- buttonSecondUp: "button--second-up",
- buttonTopLeft: "button--top-left",
- buttonTopRight: "button--top-right",
- column: "column",
- delimiter: "delimiter",
- hour: "hour",
- input: "input",
- meridiem: "meridiem",
- minute: "minute",
- second: "second",
- showMeridiem: "show-meridiem",
- showSecond: "show-second",
- "scale-s": "scale-s",
- "scale-m": "scale-m",
- "scale-l": "scale-l",
- timePicker: "time-picker",
- meridiemStart: "meridiem--start"
- };
- const TEXT = {
- hour: "Hour",
- hourDown: "Decrease hour",
- hourUp: "Increase hour",
- meridiem: "AM/PM",
- meridiemDown: "Decrease AM/PM",
- meridiemUp: "Increase AM/PM",
- minute: "Minute",
- minuteDown: "Decrease minute",
- minuteUp: "Increase minute",
- second: "Second",
- secondDown: "Decrease second",
- secondUp: "Increase second"
- };
- const timePickerCss = "@-webkit-keyframes in{0%{opacity:0}100%{opacity:1}}@keyframes in{0%{opacity:0}100%{opacity:1}}@-webkit-keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-down{0%{opacity:0;-webkit-transform:translate3D(0, -5px, 0);transform:translate3D(0, -5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@keyframes in-up{0%{opacity:0;-webkit-transform:translate3D(0, 5px, 0);transform:translate3D(0, 5px, 0)}100%{opacity:1;-webkit-transform:translate3D(0, 0, 0);transform:translate3D(0, 0, 0)}}@-webkit-keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}@keyframes in-scale{0%{opacity:0;-webkit-transform:scale3D(0.95, 0.95, 1);transform:scale3D(0.95, 0.95, 1)}100%{opacity:1;-webkit-transform:scale3D(1, 1, 1);transform:scale3D(1, 1, 1)}}:root{--calcite-animation-timing:calc(150ms * var(--calcite-internal-duration-factor));--calcite-internal-duration-factor:var(--calcite-duration-factor, 1);--calcite-internal-animation-timing-fast:calc(100ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-medium:calc(200ms * var(--calcite-internal-duration-factor));--calcite-internal-animation-timing-slow:calc(300ms * var(--calcite-internal-duration-factor))}.calcite-animate{opacity:0;-webkit-animation-fill-mode:both;animation-fill-mode:both;-webkit-animation-duration:var(--calcite-animation-timing);animation-duration:var(--calcite-animation-timing)}.calcite-animate__in{-webkit-animation-name:in;animation-name:in}.calcite-animate__in-down{-webkit-animation-name:in-down;animation-name:in-down}.calcite-animate__in-up{-webkit-animation-name:in-up;animation-name:in-up}.calcite-animate__in-scale{-webkit-animation-name:in-scale;animation-name:in-scale}:root{--calcite-popper-transition:var(--calcite-animation-timing)}:host([hidden]){display:none}:host{display:inline-block}.time-picker{display:-ms-flexbox;display:flex;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium);color:var(--calcite-ui-text-1);--tw-shadow:0 6px 20px -4px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.08);--tw-shadow-colored:0 6px 20px -4px var(--tw-shadow-color), 0 4px 12px -2px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-radius:var(--calcite-border-radius)}.time-picker .column{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column}.time-picker .meridiem--start{-ms-flex-order:-1;order:-1}.time-picker .button{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--calcite-ui-foreground-1)}.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{display:-ms-inline-flexbox;display:inline-flex;cursor:pointer;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;background-color:var(--calcite-ui-foreground-1);font-weight:var(--calcite-font-weight-medium)}.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}";
- function capitalize(str) {
- return str.charAt(0).toUpperCase() + str.slice(1);
- }
- const TimePicker = class {
- constructor(hostRef) {
- index.registerInstance(this, hostRef);
- this.calciteTimePickerBlur = index.createEvent(this, "calciteTimePickerBlur", 7);
- this.calciteTimePickerChange = index.createEvent(this, "calciteTimePickerChange", 7);
- this.calciteTimePickerFocus = index.createEvent(this, "calciteTimePickerFocus", 7);
- //--------------------------------------------------------------------------
- //
- // Properties
- //
- //--------------------------------------------------------------------------
- /** aria-label for the hour input
- * @default "Hour"
- */
- this.intlHour = TEXT.hour;
- /** aria-label for the hour down button
- * @default "Decrease hour"
- */
- this.intlHourDown = TEXT.hourDown;
- /** aria-label for the hour up button
- * @default "Increase hour"
- */
- this.intlHourUp = TEXT.hourUp;
- /** aria-label for the meridiem (am/pm) input
- * @default "AM/PM"
- */
- this.intlMeridiem = TEXT.meridiem;
- /** aria-label for the meridiem (am/pm) down button
- * @default "Decrease AM/PM"
- */
- this.intlMeridiemDown = TEXT.meridiemDown;
- /** aria-label for the meridiem (am/pm) up button
- * @default "Increase AM/PM"
- */
- this.intlMeridiemUp = TEXT.meridiemUp;
- /** aria-label for the minute input
- * @default "Minute"
- */
- this.intlMinute = TEXT.minute;
- /** aria-label for the minute down button
- * @default "Decrease minute"
- */
- this.intlMinuteDown = TEXT.minuteDown;
- /** aria-label for the minute up button
- * @default "Increase minute"
- */
- this.intlMinuteUp = TEXT.minuteUp;
- /** aria-label for the second input
- * @default "Second"
- */
- this.intlSecond = TEXT.second;
- /** aria-label for the second down button
- * @default "Decrease second"
- */
- this.intlSecondDown = TEXT.secondDown;
- /** aria-label for the second up button
- * @default "Increase second"
- */
- this.intlSecondUp = TEXT.secondUp;
- /**
- * BCP 47 language tag for desired language and country format
- * @internal
- */
- this.locale = document.documentElement.lang || navigator.language || "en";
- /** The scale (size) of the time picker */
- this.scale = "m";
- /** number (seconds) that specifies the granularity that the value must adhere to */
- this.step = 60;
- /** The selected time in UTC (always 24-hour format) */
- this.value = null;
- this.showSecond = this.step < 60;
- this.decrementHour = () => {
- const newHour = !this.hour ? 0 : this.hour === "00" ? 23 : parseInt(this.hour) - 1;
- this.setValuePart("hour", newHour);
- };
- this.decrementMeridiem = () => {
- const newMeridiem = this.meridiem === "PM" ? "AM" : "PM";
- this.setValuePart("meridiem", newMeridiem);
- };
- this.decrementMinuteOrSecond = (key) => {
- let newValue;
- if (number.isValidNumber(this[key])) {
- const valueAsNumber = parseInt(this[key]);
- newValue = valueAsNumber === 0 ? 59 : valueAsNumber - 1;
- }
- else {
- newValue = 59;
- }
- this.setValuePart(key, newValue);
- };
- this.decrementMinute = () => {
- this.decrementMinuteOrSecond("minute");
- };
- this.decrementSecond = () => {
- this.decrementMinuteOrSecond("second");
- };
- this.focusHandler = (event) => {
- this.activeEl = event.currentTarget;
- };
- this.hourDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementHour();
- }
- };
- this.hourKeyDownHandler = (event) => {
- const key = event.key;
- if (number.numberKeys.includes(key)) {
- const keyAsNumber = parseInt(key);
- let newHour;
- if (number.isValidNumber(this.hour)) {
- switch (this.hourCycle) {
- case "12":
- newHour =
- this.hour === "01" && keyAsNumber >= 0 && keyAsNumber <= 2
- ? `1${keyAsNumber}`
- : keyAsNumber;
- break;
- case "24":
- if (this.hour === "01") {
- newHour = `1${keyAsNumber}`;
- }
- else if (this.hour === "02" && keyAsNumber >= 0 && keyAsNumber <= 3) {
- newHour = `2${keyAsNumber}`;
- }
- else {
- newHour = keyAsNumber;
- }
- break;
- }
- }
- else {
- newHour = keyAsNumber;
- }
- this.setValuePart("hour", newHour);
- }
- else {
- switch (key) {
- case "Backspace":
- case "Delete":
- this.setValuePart("hour", null);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementHour();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementHour();
- break;
- case " ":
- case "Spacebar":
- event.preventDefault();
- break;
- }
- }
- };
- this.hourUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementHour();
- }
- };
- this.incrementMeridiem = () => {
- const newMeridiem = this.meridiem === "AM" ? "PM" : "AM";
- this.setValuePart("meridiem", newMeridiem);
- };
- this.incrementHour = () => {
- const newHour = number.isValidNumber(this.hour)
- ? this.hour === "23"
- ? 0
- : parseInt(this.hour) + 1
- : 1;
- this.setValuePart("hour", newHour);
- };
- this.incrementMinuteOrSecond = (key) => {
- const newValue = number.isValidNumber(this[key])
- ? this[key] === "59"
- ? 0
- : parseInt(this[key]) + 1
- : 0;
- this.setValuePart(key, newValue);
- };
- this.incrementMinute = () => {
- this.incrementMinuteOrSecond("minute");
- };
- this.incrementSecond = () => {
- this.incrementMinuteOrSecond("second");
- };
- this.meridiemDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementMeridiem();
- }
- };
- this.meridiemKeyDownHandler = (event) => {
- switch (event.key) {
- case "a":
- this.setValuePart("meridiem", "AM");
- break;
- case "p":
- this.setValuePart("meridiem", "PM");
- break;
- case "Backspace":
- case "Delete":
- this.setValuePart("meridiem", null);
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementMeridiem();
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementMeridiem();
- break;
- case " ":
- case "Spacebar":
- event.preventDefault();
- break;
- }
- };
- this.meridiemUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementMeridiem();
- }
- };
- this.minuteDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementMinute();
- }
- };
- this.minuteKeyDownHandler = (event) => {
- const key = event.key;
- if (number.numberKeys.includes(key)) {
- const keyAsNumber = parseInt(key);
- let newMinute;
- if (number.isValidNumber(this.minute) && this.minute.startsWith("0")) {
- const minuteAsNumber = parseInt(this.minute);
- newMinute =
- minuteAsNumber > maxTenthForMinuteAndSecond
- ? keyAsNumber
- : `${minuteAsNumber}${keyAsNumber}`;
- }
- else {
- newMinute = keyAsNumber;
- }
- this.setValuePart("minute", newMinute);
- }
- else {
- switch (key) {
- case "Backspace":
- case "Delete":
- this.setValuePart("minute", null);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementMinute();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementMinute();
- break;
- case " ":
- case "Spacebar":
- event.preventDefault();
- break;
- }
- }
- };
- this.minuteUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementMinute();
- }
- };
- this.secondDownButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.decrementSecond();
- }
- };
- this.secondKeyDownHandler = (event) => {
- const key = event.key;
- if (number.numberKeys.includes(key)) {
- const keyAsNumber = parseInt(key);
- let newSecond;
- if (number.isValidNumber(this.second) && this.second.startsWith("0")) {
- const secondAsNumber = parseInt(this.second);
- newSecond =
- secondAsNumber > maxTenthForMinuteAndSecond
- ? keyAsNumber
- : `${secondAsNumber}${keyAsNumber}`;
- }
- else {
- newSecond = keyAsNumber;
- }
- this.setValuePart("second", newSecond);
- }
- else {
- switch (key) {
- case "Backspace":
- case "Delete":
- this.setValuePart("second", null);
- break;
- case "ArrowDown":
- event.preventDefault();
- this.decrementSecond();
- break;
- case "ArrowUp":
- event.preventDefault();
- this.incrementSecond();
- break;
- case " ":
- case "Spacebar":
- event.preventDefault();
- break;
- }
- }
- };
- this.secondUpButtonKeyDownHandler = (event) => {
- if (this.buttonActivated(event)) {
- this.incrementSecond();
- }
- };
- this.setHourEl = (el) => (this.hourEl = el);
- this.setMeridiemEl = (el) => (this.meridiemEl = el);
- this.setMinuteEl = (el) => (this.minuteEl = el);
- this.setSecondEl = (el) => (this.secondEl = el);
- this.setValue = (value, emit = true) => {
- if (isValidTime(value)) {
- const { hour, minute, second } = parseTimeString(value);
- const { localizedHour, localizedHourSuffix, localizedMinute, localizedMinuteSuffix, localizedSecond, localizedSecondSuffix, localizedMeridiem } = localizeTimeStringToParts(value, this.locale);
- this.localizedHour = localizedHour;
- this.localizedHourSuffix = localizedHourSuffix;
- this.localizedMinute = localizedMinute;
- this.localizedMinuteSuffix = localizedMinuteSuffix;
- this.localizedSecond = localizedSecond;
- this.localizedSecondSuffix = localizedSecondSuffix;
- this.hour = hour;
- this.minute = minute;
- this.second = second;
- if (localizedMeridiem) {
- this.localizedMeridiem = localizedMeridiem;
- this.meridiem = getMeridiem(this.hour);
- const formatParts = getTimeParts(value, this.locale);
- this.meridiemOrder = this.getMeridiemOrder(formatParts);
- }
- }
- else {
- this.hour = null;
- this.localizedHour = null;
- this.localizedHourSuffix = null;
- this.localizedMeridiem = null;
- this.localizedMinute = null;
- this.localizedMinuteSuffix = null;
- this.localizedSecond = null;
- this.localizedSecondSuffix = null;
- this.meridiem = null;
- this.minute = null;
- this.second = null;
- this.value = null;
- }
- if (emit) {
- this.calciteTimePickerChange.emit();
- }
- };
- this.setValuePart = (key, value, emit = true) => {
- var _a;
- if (key === "meridiem") {
- this.meridiem = value;
- if (number.isValidNumber(this.hour)) {
- const hourAsNumber = parseInt(this.hour);
- switch (value) {
- case "AM":
- if (hourAsNumber >= 12) {
- this.hour = formatTimePart(hourAsNumber - 12);
- }
- break;
- case "PM":
- if (hourAsNumber < 12) {
- this.hour = formatTimePart(hourAsNumber + 12);
- }
- break;
- }
- this.localizedHour = localizeTimePart(this.hour, "hour", this.locale);
- }
- }
- else {
- this[key] = typeof value === "number" ? formatTimePart(value) : value;
- this[`localized${capitalize(key)}`] = localizeTimePart(this[key], key, this.locale);
- }
- if (this.hour && this.minute) {
- const showSeconds = this.second && this.showSecond;
- this.value = `${this.hour}:${this.minute}:${showSeconds ? this.second : "00"}`;
- }
- else {
- this.value = null;
- }
- this.localizedMeridiem = this.value
- ? ((_a = localizeTimeStringToParts(this.value, this.locale)) === null || _a === void 0 ? void 0 : _a.localizedMeridiem) || null
- : localizeTimePart(this.meridiem, "meridiem", this.locale);
- if (emit) {
- this.calciteTimePickerChange.emit();
- }
- };
- }
- localeWatcher(newLocale) {
- this.hourCycle = getLocaleHourCycle(newLocale);
- this.setValue(this.value, false);
- }
- valueWatcher(newValue) {
- this.setValue(newValue, false);
- }
- //--------------------------------------------------------------------------
- //
- // Event Listeners
- //
- //--------------------------------------------------------------------------
- hostBlurHandler() {
- this.calciteTimePickerBlur.emit();
- }
- hostFocusHandler() {
- this.calciteTimePickerFocus.emit();
- }
- keyDownHandler(event) {
- const key = event.key;
- switch (this.activeEl) {
- case this.hourEl:
- if (key === "ArrowRight") {
- this.setFocus("minute");
- }
- break;
- case this.minuteEl:
- switch (key) {
- case "ArrowLeft":
- this.setFocus("hour");
- break;
- case "ArrowRight":
- if (this.step !== 60) {
- this.setFocus("second");
- }
- else if (this.hourCycle === "12") {
- this.setFocus("meridiem");
- }
- break;
- }
- break;
- case this.secondEl:
- switch (key) {
- case "ArrowLeft":
- this.setFocus("minute");
- break;
- case "ArrowRight":
- if (this.hourCycle === "12") {
- this.setFocus("meridiem");
- }
- break;
- }
- break;
- case this.meridiemEl:
- switch (key) {
- case "ArrowLeft":
- if (this.step !== 60) {
- this.setFocus("second");
- }
- else {
- this.setFocus("minute");
- }
- break;
- }
- break;
- }
- }
- //--------------------------------------------------------------------------
- //
- // Public Methods
- //
- //--------------------------------------------------------------------------
- /** Sets focus on the component. */
- async setFocus(target) {
- var _a;
- (_a = this[`${target || "hour"}El`]) === null || _a === void 0 ? void 0 : _a.focus();
- }
- // --------------------------------------------------------------------------
- //
- // Private Methods
- //
- // --------------------------------------------------------------------------
- buttonActivated(event) {
- const key = event.key;
- if (key === " ") {
- event.preventDefault();
- }
- return number.isActivationKey(key);
- }
- getMeridiemOrder(formatParts) {
- const isRTLKind = this.locale === "ar" || this.locale === "he";
- if (formatParts && !isRTLKind) {
- const index = formatParts.findIndex((parts) => {
- return parts.value === this.localizedMeridiem;
- });
- return index;
- }
- return 0;
- }
- // --------------------------------------------------------------------------
- //
- // Lifecycle
- //
- // --------------------------------------------------------------------------
- connectedCallback() {
- this.setValue(this.value, false);
- this.hourCycle = getLocaleHourCycle(this.locale);
- }
- // --------------------------------------------------------------------------
- //
- // Render Methods
- //
- // --------------------------------------------------------------------------
- render() {
- const hourIsNumber = number.isValidNumber(this.hour);
- const iconScale = this.scale === "s" || this.scale === "m" ? "s" : "m";
- const minuteIsNumber = number.isValidNumber(this.minute);
- const secondIsNumber = number.isValidNumber(this.second);
- const showMeridiem = this.hourCycle === "12";
- return (index.h("div", { class: {
- [CSS.timePicker]: true,
- [CSS.showMeridiem]: showMeridiem,
- [CSS.showSecond]: this.showSecond,
- [CSS[`scale-${this.scale}`]]: true
- }, dir: "ltr" }, index.h("div", { class: CSS.column, role: "group" }, index.h("span", { "aria-label": this.intlHourUp, class: {
- [CSS.button]: true,
- [CSS.buttonHourUp]: true,
- [CSS.buttonTopLeft]: true
- }, onClick: this.incrementHour, onKeyDown: this.hourUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-up", scale: iconScale })), index.h("span", { "aria-label": this.intlHour, "aria-valuemax": "23", "aria-valuemin": "1", "aria-valuenow": (hourIsNumber && parseInt(this.hour)) || "0", "aria-valuetext": this.hour, class: {
- [CSS.input]: true,
- [CSS.hour]: true
- }, onFocus: this.focusHandler, onKeyDown: this.hourKeyDownHandler, ref: this.setHourEl, role: "spinbutton", tabIndex: 0 }, this.localizedHour || "--"), index.h("span", { "aria-label": this.intlHourDown, class: {
- [CSS.button]: true,
- [CSS.buttonHourDown]: true,
- [CSS.buttonBottomLeft]: true
- }, onClick: this.decrementHour, onKeyDown: this.hourDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-down", scale: iconScale }))), index.h("span", { class: CSS.delimiter }, this.localizedHourSuffix), index.h("div", { class: CSS.column, role: "group" }, index.h("span", { "aria-label": this.intlMinuteUp, class: {
- [CSS.button]: true,
- [CSS.buttonMinuteUp]: true
- }, onClick: this.incrementMinute, onKeyDown: this.minuteUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-up", scale: iconScale })), index.h("span", { "aria-label": this.intlMinute, "aria-valuemax": "12", "aria-valuemin": "1", "aria-valuenow": (minuteIsNumber && parseInt(this.minute)) || "0", "aria-valuetext": this.minute, class: {
- [CSS.input]: true,
- [CSS.minute]: true
- }, onFocus: this.focusHandler, onKeyDown: this.minuteKeyDownHandler, ref: this.setMinuteEl, role: "spinbutton", tabIndex: 0 }, this.localizedMinute || "--"), index.h("span", { "aria-label": this.intlMinuteDown, class: {
- [CSS.button]: true,
- [CSS.buttonMinuteDown]: true
- }, onClick: this.decrementMinute, onKeyDown: this.minuteDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-down", scale: iconScale }))), this.showSecond && index.h("span", { class: CSS.delimiter }, this.localizedMinuteSuffix), this.showSecond && (index.h("div", { class: CSS.column, role: "group" }, index.h("span", { "aria-label": this.intlSecondUp, class: {
- [CSS.button]: true,
- [CSS.buttonSecondUp]: true
- }, onClick: this.incrementSecond, onKeyDown: this.secondUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-up", scale: iconScale })), index.h("span", { "aria-label": this.intlSecond, "aria-valuemax": "59", "aria-valuemin": "0", "aria-valuenow": (secondIsNumber && parseInt(this.second)) || "0", "aria-valuetext": this.second, class: {
- [CSS.input]: true,
- [CSS.second]: true
- }, onFocus: this.focusHandler, onKeyDown: this.secondKeyDownHandler, ref: this.setSecondEl, role: "spinbutton", tabIndex: 0 }, this.localizedSecond || "--"), index.h("span", { "aria-label": this.intlSecondDown, class: {
- [CSS.button]: true,
- [CSS.buttonSecondDown]: true
- }, onClick: this.decrementSecond, onKeyDown: this.secondDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-down", scale: iconScale })))), this.localizedSecondSuffix && (index.h("span", { class: CSS.delimiter }, this.localizedSecondSuffix)), showMeridiem && (index.h("div", { class: {
- [CSS.column]: true,
- [CSS.meridiemStart]: this.meridiemOrder === 0
- }, role: "group" }, index.h("span", { "aria-label": this.intlMeridiemUp, class: {
- [CSS.button]: true,
- [CSS.buttonMeridiemUp]: true,
- [CSS.buttonTopRight]: true
- }, onClick: this.incrementMeridiem, onKeyDown: this.meridiemUpButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-up", scale: iconScale })), index.h("span", { "aria-label": this.intlMeridiem, "aria-valuemax": "2", "aria-valuemin": "1", "aria-valuenow": (this.meridiem === "PM" && "2") || "1", "aria-valuetext": this.meridiem, class: {
- [CSS.input]: true,
- [CSS.meridiem]: true
- }, onFocus: this.focusHandler, onKeyDown: this.meridiemKeyDownHandler, ref: this.setMeridiemEl, role: "spinbutton", tabIndex: 0 }, this.localizedMeridiem || "--"), index.h("span", { "aria-label": this.intlMeridiemDown, class: {
- [CSS.button]: true,
- [CSS.buttonMeridiemDown]: true,
- [CSS.buttonBottomRight]: true
- }, onClick: this.decrementMeridiem, onKeyDown: this.meridiemDownButtonKeyDownHandler, role: "button", tabIndex: -1 }, index.h("calcite-icon", { icon: "chevron-down", scale: iconScale }))))));
- }
- get el() { return index.getElement(this); }
- static get watchers() { return {
- "locale": ["localeWatcher"],
- "value": ["valueWatcher"]
- }; }
- };
- TimePicker.style = timePickerCss;
- exports.calcite_input_time_picker = InputTimePicker;
- exports.calcite_time_picker = TimePicker;
|