Socket
Socket
Sign inDemoInstall

@react-aria/datepicker

Package Overview
Dependencies
Maintainers
2
Versions
536
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-aria/datepicker - npm Package Compare versions

Comparing version 3.0.0-nightly.3180 to 3.0.0-nightly-086ad3115-240911

dist/ar-AE.main.js

919

dist/main.js

@@ -1,908 +0,35 @@

var $IwcIq$reactariafocus = require("@react-aria/focus");
var $IwcIq$reactariautils = require("@react-aria/utils");
var $IwcIq$reactarialabel = require("@react-aria/label");
var $IwcIq$reactariai18n = require("@react-aria/i18n");
var $IwcIq$react = require("react");
var $IwcIq$reactariainteractions = require("@react-aria/interactions");
var $IwcIq$internationalizednumber = require("@internationalized/number");
var $IwcIq$reactariaspinbutton = require("@react-aria/spinbutton");
var $IwcIq$internationalizedmessage = require("@internationalized/message");
var $e90ae7c26a69c6b1$exports = require("./useDatePicker.main.js");
var $5c015c6316d1904d$exports = require("./useDateSegment.main.js");
var $4acc2f407c169e55$exports = require("./useDateField.main.js");
var $20f695b1b69e6b9e$exports = require("./useDateRangePicker.main.js");
var $934ac650a0aceb4b$exports = require("./useDisplayNames.main.js");
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
function $parcel$exportWildcard(dest, source) {
Object.keys(source).forEach(function(key) {
if (key === 'default' || key === '__esModule' || dest.hasOwnProperty(key)) {
return;
}
Object.defineProperty(dest, key, {
enumerable: true,
get: function get() {
return source[key];
}
});
});
$parcel$export(module.exports, "useDatePicker", () => $e90ae7c26a69c6b1$exports.useDatePicker);
$parcel$export(module.exports, "useDateSegment", () => $5c015c6316d1904d$exports.useDateSegment);
$parcel$export(module.exports, "useDateField", () => $4acc2f407c169e55$exports.useDateField);
$parcel$export(module.exports, "useTimeField", () => $4acc2f407c169e55$exports.useTimeField);
$parcel$export(module.exports, "useDateRangePicker", () => $20f695b1b69e6b9e$exports.useDateRangePicker);
$parcel$export(module.exports, "useDisplayNames", () => $934ac650a0aceb4b$exports.useDisplayNames);
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
return dest;
}
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
$parcel$export(module.exports, "useDatePicker", () => $e90ae7c26a69c6b1$export$42df105a73306d51);
$parcel$export(module.exports, "useDateSegment", () => $5c015c6316d1904d$export$1315d136e6f7581);
$parcel$export(module.exports, "useDateField", () => $4acc2f407c169e55$export$5591b0b878c1a989);
$parcel$export(module.exports, "useTimeField", () => $4acc2f407c169e55$export$4c842f6a241dc825);
$parcel$export(module.exports, "useDateRangePicker", () => $20f695b1b69e6b9e$export$12fd5f0e9f4bb192);
var $c7d0e80b992ca68a$exports = {};
var $aa344be62785b256$exports = {};
$aa344be62785b256$exports = JSON.parse("{\"calendar\":\"التقويم\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} إلى {end, date, long}\",\"date\":\"التاريخ\",\"dateRange\":\"نطاق التاريخ\",\"day\":\"يوم\",\"dayPeriod\":\"ص/م\",\"endDate\":\"تاريخ الانتهاء\",\"era\":\"العصر\",\"hour\":\"الساعات\",\"minute\":\"الدقائق\",\"month\":\"الشهر\",\"second\":\"الثواني\",\"startDate\":\"تاريخ البدء\",\"year\":\"السنة\",\"weekday\":\"اليوم\",\"timeZoneName\":\"التوقيت\"}");
var $615986c3475e7c8c$exports = {};
$615986c3475e7c8c$exports = JSON.parse("{\"calendar\":\"Календар\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} до {end, date, long}\",\"date\":\"Дата\",\"dateRange\":\"Времеви интервал\",\"day\":\"ден\",\"dayPeriod\":\"пр.об./сл.об.\",\"endDate\":\"Крайна дата\",\"era\":\"ера\",\"hour\":\"час\",\"minute\":\"минута\",\"month\":\"месец\",\"second\":\"секунда\",\"startDate\":\"Начална дата\",\"year\":\"година\",\"weekday\":\"ден от седмицата\",\"timeZoneName\":\"часова зона\"}");
var $6c6207692f1ab248$exports = {};
$6c6207692f1ab248$exports = JSON.parse("{\"calendar\":\"Kalendář\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} až {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Rozsah dat\",\"day\":\"den\",\"dayPeriod\":\"část dne\",\"endDate\":\"Konečné datum\",\"era\":\"letopočet\",\"hour\":\"hodina\",\"minute\":\"minuta\",\"month\":\"měsíc\",\"second\":\"sekunda\",\"startDate\":\"Počáteční datum\",\"year\":\"rok\",\"weekday\":\"den v týdnu\",\"timeZoneName\":\"časové pásmo\"}");
var $fb37a9d024dd70f8$exports = {};
$fb37a9d024dd70f8$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} til {end, date, long}\",\"date\":\"Dato\",\"dateRange\":\"Datointerval\",\"day\":\"dag\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Slutdato\",\"era\":\"æra\",\"hour\":\"time\",\"minute\":\"minut\",\"month\":\"måned\",\"second\":\"sekund\",\"startDate\":\"Startdato\",\"year\":\"år\",\"weekday\":\"ugedag\",\"timeZoneName\":\"tidszone\"}");
var $d7780bd4790f7ae9$exports = {};
$d7780bd4790f7ae9$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} bis {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumsbereich\",\"day\":\"Tag\",\"dayPeriod\":\"Tageshälfte\",\"endDate\":\"Enddatum\",\"era\":\"Epoche\",\"hour\":\"Stunde\",\"minute\":\"Minute\",\"month\":\"Monat\",\"second\":\"Sekunde\",\"startDate\":\"Anfangsdatum\",\"year\":\"Jahr\",\"weekday\":\"Wochentag\",\"timeZoneName\":\"Zeitzone\"}");
var $9cdf03311f06c4ac$exports = {};
$9cdf03311f06c4ac$exports = JSON.parse("{\"calendar\":\"Ημερολόγιο\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} ως {end, date, long}\",\"date\":\"Ημερομηνία\",\"dateRange\":\"Εύρος ημερομηνιών\",\"day\":\"ημέρα\",\"dayPeriod\":\"π.μ./μ.μ.\",\"endDate\":\"Ημερομηνία λήξης\",\"era\":\"περίοδος\",\"hour\":\"ώρα\",\"minute\":\"λεπτό\",\"month\":\"μήνας\",\"second\":\"δευτερόλεπτο\",\"startDate\":\"Ημερομηνία έναρξης\",\"year\":\"έτος\",\"weekday\":\"καθημερινή\",\"timeZoneName\":\"ζώνη ώρας\"}");
var $f93fc9e164ae811c$exports = {};
$f93fc9e164ae811c$exports = JSON.parse("{\"era\":\"era\",\"year\":\"year\",\"month\":\"month\",\"day\":\"day\",\"hour\":\"hour\",\"minute\":\"minute\",\"second\":\"second\",\"dayPeriod\":\"AM/PM\",\"calendar\":\"Calendar\",\"date\":\"Date\",\"dateRange\":\"Date Range\",\"startDate\":\"Start Date\",\"endDate\":\"End Date\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} to {end, date, long}\",\"weekday\":\"day of the week\",\"timeZoneName\":\"time zone\"}");
var $7426c3264bf5ffea$exports = {};
$7426c3264bf5ffea$exports = JSON.parse("{\"calendar\":\"Calendario\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} a {end, date, long}\",\"date\":\"Fecha\",\"dateRange\":\"Intervalo de fecha\",\"day\":\"día\",\"dayPeriod\":\"a. m./p. m.\",\"endDate\":\"Fecha final\",\"era\":\"era\",\"hour\":\"hora\",\"minute\":\"minuto\",\"month\":\"mes\",\"second\":\"segundo\",\"startDate\":\"Fecha de inicio\",\"year\":\"año\",\"weekday\":\"día de la semana\",\"timeZoneName\":\"zona horaria\"}");
var $1115cc0042de790c$exports = {};
$1115cc0042de790c$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} kuni {end, date, long}\",\"date\":\"Kuupäev\",\"dateRange\":\"Kuupäevavahemik\",\"day\":\"päev\",\"dayPeriod\":\"enne/pärast lõunat\",\"endDate\":\"Lõppkuupäev\",\"era\":\"ajastu\",\"hour\":\"tund\",\"minute\":\"minut\",\"month\":\"kuu\",\"second\":\"sekund\",\"startDate\":\"Alguskuupäev\",\"year\":\"aasta\",\"weekday\":\"nädalapäev\",\"timeZoneName\":\"ajavöönd\"}");
var $4e80389dccb9283f$exports = {};
$4e80389dccb9283f$exports = JSON.parse("{\"calendar\":\"Kalenteri\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long}–{end, date, long}\",\"date\":\"Päivämäärä\",\"dateRange\":\"Päivämääräalue\",\"day\":\"päivä\",\"dayPeriod\":\"vuorokaudenaika\",\"endDate\":\"Päättymispäivä\",\"era\":\"aikakausi\",\"hour\":\"tunti\",\"minute\":\"minuutti\",\"month\":\"kuukausi\",\"second\":\"sekunti\",\"startDate\":\"Alkamispäivä\",\"year\":\"vuosi\",\"weekday\":\"viikonpäivä\",\"timeZoneName\":\"aikavyöhyke\"}");
var $78ad6f738c1f38d1$exports = {};
$78ad6f738c1f38d1$exports = JSON.parse("{\"calendar\":\"Calendrier\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} au {end, date, long}\",\"date\":\"Date\",\"dateRange\":\"Plage de dates\",\"day\":\"jour\",\"dayPeriod\":\"cadran\",\"endDate\":\"Date de fin\",\"era\":\"ère\",\"hour\":\"heure\",\"minute\":\"minute\",\"month\":\"mois\",\"second\":\"seconde\",\"startDate\":\"Date de début\",\"year\":\"année\",\"weekday\":\"jour de la semaine\",\"timeZoneName\":\"fuseau horaire\"}");
var $50fa4716d827cd97$exports = {};
$50fa4716d827cd97$exports = JSON.parse("{\"calendar\":\"לוח שנה\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"מ-{start, date, long} ועד {end, date, long}\",\"date\":\"תאריך\",\"dateRange\":\"טווח תאריכים\",\"day\":\"יום\",\"dayPeriod\":\"לפנה״צ/אחה״צ\",\"endDate\":\"תאריך סיום\",\"era\":\"תקופה\",\"hour\":\"שעה\",\"minute\":\"דקה\",\"month\":\"חודש\",\"second\":\"שנייה\",\"startDate\":\"תאריך התחלה\",\"year\":\"שנה\",\"weekday\":\"יום בשבוע\",\"timeZoneName\":\"אזור זמן\"}");
var $7297908fac4cf6c2$exports = {};
$7297908fac4cf6c2$exports = JSON.parse("{\"calendar\":\"Kalendar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Raspon datuma\",\"day\":\"dan\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Datum završetka\",\"era\":\"era\",\"hour\":\"sat\",\"minute\":\"minuta\",\"month\":\"mjesec\",\"second\":\"sekunda\",\"startDate\":\"Datum početka\",\"year\":\"godina\",\"weekday\":\"dan u tjednu\",\"timeZoneName\":\"vremenska zona\"}");
var $f95c1b06e1d5ba32$exports = {};
$f95c1b06e1d5ba32$exports = JSON.parse("{\"calendar\":\"Naptár\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} – {end, date, long}\",\"date\":\"Dátum\",\"dateRange\":\"Dátumtartomány\",\"day\":\"nap\",\"dayPeriod\":\"napszak\",\"endDate\":\"Befejező dátum\",\"era\":\"éra\",\"hour\":\"óra\",\"minute\":\"perc\",\"month\":\"hónap\",\"second\":\"másodperc\",\"startDate\":\"Kezdő dátum\",\"year\":\"év\",\"weekday\":\"hét napja\",\"timeZoneName\":\"időzóna\"}");
var $437a8dc519258a01$exports = {};
$437a8dc519258a01$exports = JSON.parse("{\"calendar\":\"Calendario\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"Da {start, date, long} a {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Intervallo date\",\"day\":\"giorno\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Data finale\",\"era\":\"era\",\"hour\":\"ora\",\"minute\":\"minuto\",\"month\":\"mese\",\"second\":\"secondo\",\"startDate\":\"Data iniziale\",\"year\":\"anno\",\"weekday\":\"giorno della settimana\",\"timeZoneName\":\"fuso orario\"}");
var $bd0aa2b50092a836$exports = {};
$bd0aa2b50092a836$exports = JSON.parse("{\"calendar\":\"カレンダー\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} ~ {end, date, long}\",\"date\":\"日付\",\"dateRange\":\"日付範囲\",\"day\":\"日\",\"dayPeriod\":\"午前/午後\",\"endDate\":\"終了日\",\"era\":\"時代\",\"hour\":\"時\",\"minute\":\"分\",\"month\":\"月\",\"second\":\"秒\",\"startDate\":\"開始日\",\"year\":\"年\",\"weekday\":\"曜日\",\"timeZoneName\":\"タイムゾーン\"}");
var $bbd8176c2e044bc1$exports = {};
$bbd8176c2e044bc1$exports = JSON.parse("{\"calendar\":\"달력\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} ~ {end, date, long}\",\"date\":\"날짜\",\"dateRange\":\"날짜 범위\",\"day\":\"일\",\"dayPeriod\":\"오전/오후\",\"endDate\":\"종료 날짜\",\"era\":\"연호\",\"hour\":\"시\",\"minute\":\"분\",\"month\":\"월\",\"second\":\"초\",\"startDate\":\"시작 날짜\",\"year\":\"년\",\"weekday\":\"요일\",\"timeZoneName\":\"시간대\"}");
var $1af703df56ff5180$exports = {};
$1af703df56ff5180$exports = JSON.parse("{\"calendar\":\"Kalendorius\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"Nuo {start, date, long} iki {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Datų intervalas\",\"day\":\"diena\",\"dayPeriod\":\"iki pietų / po pietų\",\"endDate\":\"Pabaigos data\",\"era\":\"era\",\"hour\":\"valanda\",\"minute\":\"minutė\",\"month\":\"mėnuo\",\"second\":\"sekundė\",\"startDate\":\"Pradžios data\",\"year\":\"metai\",\"weekday\":\"savaitės diena\",\"timeZoneName\":\"laiko juosta\"}");
var $9705eb4511dea9f8$exports = {};
$9705eb4511dea9f8$exports = JSON.parse("{\"calendar\":\"Kalendārs\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} līdz {end, date, long}\",\"date\":\"Datums\",\"dateRange\":\"Datumu diapazons\",\"day\":\"diena\",\"dayPeriod\":\"priekšpusdienā/pēcpusdienā\",\"endDate\":\"Beigu datums\",\"era\":\"ēra\",\"hour\":\"stundas\",\"minute\":\"minūtes\",\"month\":\"mēnesis\",\"second\":\"sekundes\",\"startDate\":\"Sākuma datums\",\"year\":\"gads\",\"weekday\":\"nedēļas diena\",\"timeZoneName\":\"laika josla\"}");
var $8ef984876a7160bc$exports = {};
$8ef984876a7160bc$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} til {end, date, long}\",\"date\":\"Dato\",\"dateRange\":\"Datoområde\",\"day\":\"dag\",\"dayPeriod\":\"a.m./p.m.\",\"endDate\":\"Sluttdato\",\"era\":\"tidsalder\",\"hour\":\"time\",\"minute\":\"minutt\",\"month\":\"måned\",\"second\":\"sekund\",\"startDate\":\"Startdato\",\"year\":\"år\",\"weekday\":\"ukedag\",\"timeZoneName\":\"tidssone\"}");
var $b6e9809e1ecaa25e$exports = {};
$b6e9809e1ecaa25e$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} t/m {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumbereik\",\"day\":\"dag\",\"dayPeriod\":\"a.m./p.m.\",\"endDate\":\"Einddatum\",\"era\":\"tijdperk\",\"hour\":\"uur\",\"minute\":\"minuut\",\"month\":\"maand\",\"second\":\"seconde\",\"startDate\":\"Startdatum\",\"year\":\"jaar\",\"weekday\":\"dag van de week\",\"timeZoneName\":\"tijdzone\"}");
var $deb2fa609661fe31$exports = {};
$deb2fa609661fe31$exports = JSON.parse("{\"calendar\":\"Kalendarz\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Zakres dat\",\"day\":\"dzień\",\"dayPeriod\":\"rano / po południu / wieczorem\",\"endDate\":\"Data końcowa\",\"era\":\"era\",\"hour\":\"godzina\",\"minute\":\"minuta\",\"month\":\"miesiąc\",\"second\":\"sekunda\",\"startDate\":\"Data początkowa\",\"year\":\"rok\",\"weekday\":\"dzień tygodnia\",\"timeZoneName\":\"strefa czasowa\"}");
var $591c8c054c84fa56$exports = {};
$591c8c054c84fa56$exports = JSON.parse("{\"calendar\":\"Calendário\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} a {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Intervalo de datas\",\"day\":\"dia\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Data final\",\"era\":\"era\",\"hour\":\"hora\",\"minute\":\"minuto\",\"month\":\"mês\",\"second\":\"segundo\",\"startDate\":\"Data inicial\",\"year\":\"ano\",\"weekday\":\"dia da semana\",\"timeZoneName\":\"fuso horário\"}");
var $f1633bd6cbc228e8$exports = {};
$f1633bd6cbc228e8$exports = JSON.parse("{\"calendar\":\"Calendário\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} a {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Intervalo de datas\",\"day\":\"dia\",\"dayPeriod\":\"am/pm\",\"endDate\":\"Data de Término\",\"era\":\"era\",\"hour\":\"hora\",\"minute\":\"minuto\",\"month\":\"mês\",\"second\":\"segundo\",\"startDate\":\"Data de Início\",\"year\":\"ano\",\"weekday\":\"dia da semana\",\"timeZoneName\":\"fuso horário\"}");
var $14e09da03f3d1c5b$exports = {};
$14e09da03f3d1c5b$exports = JSON.parse("{\"calendar\":\"Calendar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} - {end, date, long}\",\"date\":\"Dată\",\"dateRange\":\"Raza datei\",\"day\":\"zi\",\"dayPeriod\":\"a.m/p.m.\",\"endDate\":\"Dată final\",\"era\":\"eră\",\"hour\":\"oră\",\"minute\":\"minut\",\"month\":\"lună\",\"second\":\"secundă\",\"startDate\":\"Dată început\",\"year\":\"an\",\"weekday\":\"ziua din săptămână\",\"timeZoneName\":\"fus orar\"}");
var $63247a3456bc40d1$exports = {};
$63247a3456bc40d1$exports = JSON.parse("{\"calendar\":\"Календарь\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} – {end, date, long}\",\"date\":\"Дата\",\"dateRange\":\"Диапазон дат\",\"day\":\"день\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Дата окончания\",\"era\":\"эра\",\"hour\":\"час\",\"minute\":\"минута\",\"month\":\"месяц\",\"second\":\"секунда\",\"startDate\":\"Дата начала\",\"year\":\"год\",\"weekday\":\"день недели\",\"timeZoneName\":\"часовой пояс\"}");
var $22150dd20c353dd4$exports = {};
$22150dd20c353dd4$exports = JSON.parse("{\"calendar\":\"Kalendár\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Dátum\",\"dateRange\":\"Rozsah dátumov\",\"day\":\"deň\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Dátum ukončenia\",\"era\":\"letopočet\",\"hour\":\"hodina\",\"minute\":\"minúta\",\"month\":\"mesiac\",\"second\":\"sekunda\",\"startDate\":\"Dátum začatia\",\"year\":\"rok\",\"weekday\":\"deň týždňa\",\"timeZoneName\":\"časové pásmo\"}");
var $701eb9a0385c55fd$exports = {};
$701eb9a0385c55fd$exports = JSON.parse("{\"calendar\":\"Koledar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumski obseg\",\"day\":\"dan\",\"dayPeriod\":\"dop/pop\",\"endDate\":\"Datum konca\",\"era\":\"doba\",\"hour\":\"ura\",\"minute\":\"minuta\",\"month\":\"mesec\",\"second\":\"sekunda\",\"startDate\":\"Datum začetka\",\"year\":\"leto\",\"weekday\":\"dan v tednu\",\"timeZoneName\":\"časovni pas\"}");
var $54684a4891ca6dc5$exports = {};
$54684a4891ca6dc5$exports = JSON.parse("{\"calendar\":\"Kalendar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Opseg datuma\",\"day\":\"дан\",\"dayPeriod\":\"пре подне/по подне\",\"endDate\":\"Datum završetka\",\"era\":\"ера\",\"hour\":\"сат\",\"minute\":\"минут\",\"month\":\"месец\",\"second\":\"секунд\",\"startDate\":\"Datum početka\",\"year\":\"година\",\"weekday\":\"дан у недељи\",\"timeZoneName\":\"временска зона\"}");
var $545887f88a5a52db$exports = {};
$545887f88a5a52db$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} till {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumintervall\",\"day\":\"dag\",\"dayPeriod\":\"fm/em\",\"endDate\":\"Slutdatum\",\"era\":\"era\",\"hour\":\"timme\",\"minute\":\"minut\",\"month\":\"månad\",\"second\":\"sekund\",\"startDate\":\"Startdatum\",\"year\":\"år\",\"weekday\":\"veckodag\",\"timeZoneName\":\"tidszon\"}");
var $492d49420dd96ff4$exports = {};
$492d49420dd96ff4$exports = JSON.parse("{\"calendar\":\"Takvim\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} - {end, date, long}\",\"date\":\"Tarih\",\"dateRange\":\"Tarih Aralığı\",\"day\":\"gün\",\"dayPeriod\":\"ÖÖ/ÖS\",\"endDate\":\"Bitiş Tarihi\",\"era\":\"çağ\",\"hour\":\"saat\",\"minute\":\"dakika\",\"month\":\"ay\",\"second\":\"saniye\",\"startDate\":\"Başlangıç Tarihi\",\"year\":\"yıl\",\"weekday\":\"haftanın günü\",\"timeZoneName\":\"saat dilimi\"}");
var $dc85765e85e8f267$exports = {};
$dc85765e85e8f267$exports = JSON.parse("{\"calendar\":\"Календар\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"Від {start, date, long} до {end, date, long}\",\"date\":\"Дата\",\"dateRange\":\"Діапазон дат\",\"day\":\"день\",\"dayPeriod\":\"дп/пп\",\"endDate\":\"Дата завершення\",\"era\":\"ера\",\"hour\":\"година\",\"minute\":\"хвилина\",\"month\":\"місяць\",\"second\":\"секунда\",\"startDate\":\"Дата початку\",\"year\":\"рік\",\"weekday\":\"день тижня\",\"timeZoneName\":\"часовий пояс\"}");
var $2157d63cb80c7c63$exports = {};
$2157d63cb80c7c63$exports = JSON.parse("{\"calendar\":\"日历\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} 至 {end, date, long}\",\"date\":\"日期\",\"dateRange\":\"日期范围\",\"day\":\"日\",\"dayPeriod\":\"上午/下午\",\"endDate\":\"结束日期\",\"era\":\"纪元\",\"hour\":\"小时\",\"minute\":\"分钟\",\"month\":\"月\",\"second\":\"秒\",\"startDate\":\"开始日期\",\"year\":\"年\",\"weekday\":\"工作日\",\"timeZoneName\":\"时区\"}");
var $0335c3ddb5f70cbe$exports = {};
$0335c3ddb5f70cbe$exports = JSON.parse("{\"calendar\":\"日曆\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long}至 {end, date, long}\",\"date\":\"日期\",\"dateRange\":\"日期範圍\",\"day\":\"日\",\"dayPeriod\":\"上午/下午\",\"endDate\":\"結束日期\",\"era\":\"纪元\",\"hour\":\"小时\",\"minute\":\"分钟\",\"month\":\"月\",\"second\":\"秒\",\"startDate\":\"開始日期\",\"year\":\"年\",\"weekday\":\"工作日\",\"timeZoneName\":\"时区\"}");
$c7d0e80b992ca68a$exports = {
"ar-AE": $aa344be62785b256$exports,
"bg-BG": $615986c3475e7c8c$exports,
"cs-CZ": $6c6207692f1ab248$exports,
"da-DK": $fb37a9d024dd70f8$exports,
"de-DE": $d7780bd4790f7ae9$exports,
"el-GR": $9cdf03311f06c4ac$exports,
"en-US": $f93fc9e164ae811c$exports,
"es-ES": $7426c3264bf5ffea$exports,
"et-EE": $1115cc0042de790c$exports,
"fi-FI": $4e80389dccb9283f$exports,
"fr-FR": $78ad6f738c1f38d1$exports,
"he-IL": $50fa4716d827cd97$exports,
"hr-HR": $7297908fac4cf6c2$exports,
"hu-HU": $f95c1b06e1d5ba32$exports,
"it-IT": $437a8dc519258a01$exports,
"ja-JP": $bd0aa2b50092a836$exports,
"ko-KR": $bbd8176c2e044bc1$exports,
"lt-LT": $1af703df56ff5180$exports,
"lv-LV": $9705eb4511dea9f8$exports,
"nb-NO": $8ef984876a7160bc$exports,
"nl-NL": $b6e9809e1ecaa25e$exports,
"pl-PL": $deb2fa609661fe31$exports,
"pt-BR": $591c8c054c84fa56$exports,
"pt-PT": $f1633bd6cbc228e8$exports,
"ro-RO": $14e09da03f3d1c5b$exports,
"ru-RU": $63247a3456bc40d1$exports,
"sk-SK": $22150dd20c353dd4$exports,
"sl-SI": $701eb9a0385c55fd$exports,
"sr-SP": $54684a4891ca6dc5$exports,
"sv-SE": $545887f88a5a52db$exports,
"tr-TR": $492d49420dd96ff4$exports,
"uk-UA": $dc85765e85e8f267$exports,
"zh-CN": $2157d63cb80c7c63$exports,
"zh-TW": $0335c3ddb5f70cbe$exports
};
function $715562ad3b4cced4$export$4a931266a3838b86(state, ref1) {
// Open the popover on alt + arrow down
let onKeyDown = (e)=>{
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
e.preventDefault();
e.stopPropagation();
state.setOpen(true);
}
};
// Focus the first placeholder segment from the end on mouse down/touch up in the field.
let focusLast = ()=>{
var ref;
// Try to find the segment prior to the element that was clicked on.
let target = (ref = window.event) === null || ref === void 0 ? void 0 : ref.target;
let walker = $IwcIq$reactariafocus.getFocusableTreeWalker(ref1.current, {
tabbable: true
});
if (target) {
walker.currentNode = target;
target = walker.previousNode();
}
// If no target found, find the last element from the end.
if (!target) {
let last;
do {
last = walker.lastChild();
if (last) target = last;
}while (last)
}
// Now go backwards until we find an element that is not a placeholder.
while(target === null || target === void 0 ? void 0 : target.getAttribute('aria-placeholder')){
let prev = walker.previousNode();
if (prev && prev.getAttribute('aria-placeholder')) target = prev;
else break;
}
if (target) target.focus();
};
let { pressProps: pressProps } = $IwcIq$reactariainteractions.usePress({
onPressStart (e) {
if (e.pointerType === 'mouse') focusLast();
},
onPress (e) {
if (e.pointerType !== 'mouse') focusLast();
}
});
return $IwcIq$reactariautils.mergeProps(pressProps, {
onKeyDown: onKeyDown
});
}
const $4acc2f407c169e55$export$653eddfc964b0f8a = new WeakMap();
const $4acc2f407c169e55$export$300019f83c56d282 = '__role_' + Date.now();
const $4acc2f407c169e55$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
function $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref) {
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
...props,
labelElementType: 'span'
});
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
onBlurWithin () {
state.confirmPlaceholder();
}
});
let descProps = $IwcIq$reactariautils.useDescription(state.formatValue({
month: 'long'
}));
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
let describedBy = props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
descProps['aria-describedby'],
fieldProps['aria-describedby']
].filter(Boolean).join(' ') || undefined;
let propsFocusManager = props[$4acc2f407c169e55$export$7b3062cd49e80452];
let focusManager = $IwcIq$react.useMemo(()=>propsFocusManager || $IwcIq$reactariafocus.createFocusManager(ref)
, [
propsFocusManager,
ref
]);
// Pass labels and other information to segments.
$4acc2f407c169e55$export$653eddfc964b0f8a.set(state, {
ariaLabel: props['aria-label'],
ariaLabelledBy: [
props['aria-labelledby'],
labelProps.id
].filter(Boolean).join(' ') || undefined,
ariaDescribedBy: describedBy,
focusManager: focusManager
});
let autoFocusRef = $IwcIq$react.useRef(props.autoFocus);
// When used within a date picker or date range picker, the field gets role="presentation"
// rather than role="group". Since the date picker/date range picker already has a role="group"
// with a label and description, and the segments are already labeled by this as well, this
// avoids very verbose duplicate announcements.
let fieldDOMProps;
if (props[$4acc2f407c169e55$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
role: 'presentation'
};
else fieldDOMProps = $IwcIq$reactariautils.mergeProps(fieldProps, {
role: 'group',
'aria-disabled': props.isDisabled || undefined,
'aria-describedby': describedBy
});
$IwcIq$react.useEffect(()=>{
if (autoFocusRef.current) focusManager.focusFirst();
autoFocusRef.current = false;
}, [
focusManager
]);
return {
labelProps: {
...labelProps,
onClick: ()=>{
focusManager.focusFirst();
}
},
fieldProps: $IwcIq$reactariautils.mergeProps(fieldDOMProps, groupProps, focusWithinProps),
descriptionProps: descriptionProps,
errorMessageProps: errorMessageProps
};
}
function $4acc2f407c169e55$export$4c842f6a241dc825(props, state, ref) {
return $4acc2f407c169e55$export$5591b0b878c1a989(props, state, ref);
}
function $e90ae7c26a69c6b1$export$42df105a73306d51(props, state, ref) {
let buttonId = $IwcIq$reactariautils.useId();
let dialogId = $IwcIq$reactariautils.useId();
let formatMessage = $IwcIq$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($c7d0e80b992ca68a$exports)));
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
...props,
labelElementType: 'span'
});
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
let { locale: locale } = $IwcIq$reactariai18n.useLocale();
let descProps = $IwcIq$reactariautils.useDescription(state.formatValue(locale, {
month: 'long'
}));
let ariaDescribedBy = [
descProps['aria-describedby'],
fieldProps['aria-describedby']
].filter(Boolean).join(' ') || undefined;
return {
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, fieldProps, descProps, {
role: 'group',
'aria-disabled': props.isDisabled || null,
'aria-labelledby': labelledBy,
'aria-describedby': ariaDescribedBy
}),
labelProps: {
...labelProps,
onClick: ()=>{
let focusManager = $IwcIq$reactariafocus.createFocusManager(ref);
focusManager.focusFirst();
}
},
fieldProps: {
...fieldProps,
[$4acc2f407c169e55$export$300019f83c56d282]: 'presentation',
'aria-describedby': ariaDescribedBy,
value: state.value,
onChange: state.setValue,
minValue: props.minValue,
maxValue: props.maxValue,
placeholderValue: props.placeholderValue,
hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle,
granularity: props.granularity,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isRequired: props.isRequired,
validationState: state.validationState,
autoFocus: props.autoFocus
},
descriptionProps: descriptionProps,
errorMessageProps: errorMessageProps,
buttonProps: {
...descProps,
id: buttonId,
excludeFromTabOrder: true,
'aria-haspopup': 'dialog',
'aria-label': formatMessage('calendar'),
'aria-labelledby': `${labelledBy} ${buttonId}`,
'aria-describedby': ariaDescribedBy,
onPress: ()=>state.setOpen(true)
},
dialogProps: {
id: dialogId,
'aria-labelledby': `${labelledBy} ${buttonId}`
},
calendarProps: {
autoFocus: true,
value: state.dateValue,
onChange: state.setDateValue,
minValue: props.minValue,
maxValue: props.maxValue,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isDateUnavailable: props.isDateUnavailable,
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue
}
};
}
var $934ac650a0aceb4b$exports = {};
$parcel$export($934ac650a0aceb4b$exports, "useDisplayNames", () => $934ac650a0aceb4b$export$d42c60378c8168f8);
function $934ac650a0aceb4b$export$d42c60378c8168f8() {
let { locale: locale } = $IwcIq$reactariai18n.useLocale();
return $IwcIq$react.useMemo(()=>{
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
try {
// @ts-ignore
return new Intl.DisplayNames(locale, {
type: 'dateTimeField'
});
} catch (err) {
return new $934ac650a0aceb4b$var$DisplayNamesPolyfill(locale);
}
}, [
locale
]);
}
class $934ac650a0aceb4b$var$DisplayNamesPolyfill {
of(field) {
return this.dictionary.getStringForLocale(field, this.locale);
}
constructor(locale){
this.locale = locale;
this.dictionary = new $IwcIq$internationalizedmessage.MessageDictionary((/*@__PURE__*/$parcel$interopDefault($c7d0e80b992ca68a$exports)));
}
}
function $5c015c6316d1904d$export$1315d136e6f7581(segment, state, ref) {
let enteredKeys = $IwcIq$react.useRef('');
let { locale: locale , direction: direction } = $IwcIq$reactariai18n.useLocale();
let displayNames = $934ac650a0aceb4b$export$d42c60378c8168f8();
let { ariaLabel: ariaLabel , ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $4acc2f407c169e55$export$653eddfc964b0f8a.get(state);
let textValue = segment.text;
let options = $IwcIq$react.useMemo(()=>state.dateFormatter.resolvedOptions()
, [
state.dateFormatter
]);
let monthDateFormatter = $IwcIq$reactariai18n.useDateFormatter({
month: 'long',
timeZone: options.timeZone
});
let hourDateFormatter = $IwcIq$reactariai18n.useDateFormatter({
hour: 'numeric',
hour12: options.hour12,
timeZone: options.timeZone
});
if (segment.type === 'month') {
let monthTextValue = monthDateFormatter.format(state.dateValue);
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
} else if (segment.type === 'hour') textValue = hourDateFormatter.format(state.dateValue);
let { spinButtonProps: spinButtonProps } = $IwcIq$reactariaspinbutton.useSpinButton({
value: segment.value,
textValue: textValue,
minValue: segment.minValue,
maxValue: segment.maxValue,
isDisabled: state.isDisabled,
isReadOnly: state.isReadOnly || !segment.isEditable,
isRequired: state.isRequired,
onIncrement: ()=>{
enteredKeys.current = '';
state.increment(segment.type);
},
onDecrement: ()=>{
enteredKeys.current = '';
state.decrement(segment.type);
},
onIncrementPage: ()=>{
enteredKeys.current = '';
state.incrementPage(segment.type);
},
onDecrementPage: ()=>{
enteredKeys.current = '';
state.decrementPage(segment.type);
},
onIncrementToMax: ()=>{
enteredKeys.current = '';
state.setSegment(segment.type, segment.maxValue);
},
onDecrementToMin: ()=>{
enteredKeys.current = '';
state.setSegment(segment.type, segment.minValue);
}
});
let parser = $IwcIq$react.useMemo(()=>new $IwcIq$internationalizednumber.NumberParser(locale, {
maximumFractionDigits: 0
})
, [
locale
]);
let backspace = ()=>{
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly && !segment.isPlaceholder) {
let newValue = segment.text.slice(0, -1);
let parsed = parser.parse(newValue);
if (newValue.length === 0 || parsed === 0) state.clearSegment(segment.type);
else state.setSegment(segment.type, parsed);
enteredKeys.current = newValue;
} else if (segment.type === 'dayPeriod') state.clearSegment(segment.type);
};
let onKeyDown = (e)=>{
// Firefox does not fire selectstart for Ctrl/Cmd + A
// https://bugzilla.mozilla.org/show_bug.cgi?id=1742153
if (e.key === 'a' && ($IwcIq$reactariautils.isMac() ? e.metaKey : e.ctrlKey)) e.preventDefault();
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;
switch(e.key){
case 'ArrowLeft':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') focusManager.focusNext({
tabbable: true
});
else focusManager.focusPrevious({
tabbable: true
});
break;
case 'ArrowRight':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') focusManager.focusPrevious({
tabbable: true
});
else focusManager.focusNext({
tabbable: true
});
break;
case 'Enter':
e.preventDefault();
e.stopPropagation();
if (segment.isPlaceholder && !state.isReadOnly) state.confirmPlaceholder(segment.type);
focusManager.focusNext({
tabbable: true
});
break;
case 'Tab':
break;
case 'Backspace':
case 'Delete':
// Safari on iOS does not fire beforeinput for the backspace key because the cursor is at the start.
e.preventDefault();
e.stopPropagation();
backspace();
break;
}
};
// Safari dayPeriod option doesn't work...
let { startsWith: startsWith } = $IwcIq$reactariai18n.useFilter({
sensitivity: 'base'
});
let amPmFormatter = $IwcIq$reactariai18n.useDateFormatter({
hour: 'numeric',
hour12: true
});
let am = $IwcIq$react.useMemo(()=>{
let date = new Date();
date.setHours(0);
return amPmFormatter.formatToParts(date).find((part)=>part.type === 'dayPeriod'
).value;
}, [
amPmFormatter
]);
let pm = $IwcIq$react.useMemo(()=>{
let date = new Date();
date.setHours(12);
return amPmFormatter.formatToParts(date).find((part)=>part.type === 'dayPeriod'
).value;
}, [
amPmFormatter
]);
let onInput = (key)=>{
if (state.isDisabled || state.isReadOnly) return;
let newValue = enteredKeys.current + key;
switch(segment.type){
case 'dayPeriod':
if (startsWith(am, key)) state.setSegment('dayPeriod', 0);
else if (startsWith(pm, key)) state.setSegment('dayPeriod', 12);
else break;
focusManager.focusNext({
tabbable: true
});
break;
case 'day':
case 'hour':
case 'minute':
case 'second':
case 'month':
case 'year':
{
if (!parser.isValidPartialNumber(newValue)) return;
let numberValue = parser.parse(newValue);
let segmentValue = numberValue;
let allowsZero = segment.minValue === 0;
if (segment.type === 'hour' && state.dateFormatter.resolvedOptions().hour12) {
switch(state.dateFormatter.resolvedOptions().hourCycle){
case 'h11':
if (numberValue > 11) segmentValue = parser.parse(key);
break;
case 'h12':
allowsZero = false;
if (numberValue > 12) segmentValue = parser.parse(key);
break;
}
if (segment.value >= 12 && numberValue > 1) numberValue += 12;
} else if (numberValue > segment.maxValue) segmentValue = parser.parse(key);
if (isNaN(numberValue)) return;
let shouldSetValue = segmentValue !== 0 || allowsZero;
if (shouldSetValue) state.setSegment(segment.type, segmentValue);
if (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length) {
enteredKeys.current = '';
if (shouldSetValue) focusManager.focusNext({
tabbable: true
});
} else enteredKeys.current = newValue;
break;
}
}
};
let onFocus = ()=>{
enteredKeys.current = '';
$IwcIq$reactariautils.scrollIntoView($IwcIq$reactariautils.getScrollParent(ref.current), ref.current);
// Safari requires that a selection is set or it won't fire input events.
// Since usePress disables text selection, this won't happen by default.
ref.current.style.webkitUserSelect = 'text';
let selection = window.getSelection();
selection.collapse(ref.current);
ref.current.style.webkitUserSelect = '';
};
let compositionRef = $IwcIq$react.useRef('');
// @ts-ignore - TODO: possibly old TS version? doesn't fail in my editor...
$IwcIq$reactariautils.useEvent(ref, 'beforeinput', (e)=>{
e.preventDefault();
switch(e.inputType){
case 'deleteContentBackward':
case 'deleteContentForward':
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly) backspace();
break;
case 'insertCompositionText':
// insertCompositionText cannot be canceled.
// Record the current state of the element so we can restore it in the `input` event below.
compositionRef.current = ref.current.textContent;
// Safari gets stuck in a composition state unless we also assign to the value here.
// eslint-disable-next-line no-self-assign
ref.current.textContent = ref.current.textContent;
break;
default:
if (e.data != null) onInput(e.data);
break;
}
});
$IwcIq$reactariautils.useEvent(ref, 'input', (e)=>{
let { inputType: inputType , data: data } = e;
switch(inputType){
case 'insertCompositionText':
// Reset the DOM to how it was in the beforeinput event.
ref.current.textContent = compositionRef.current;
// Android sometimes fires key presses of letters as composition events. Need to handle am/pm keys here too.
// Can also happen e.g. with Pinyin keyboard on iOS.
if (startsWith(am, data) || startsWith(pm, data)) onInput(data);
break;
}
});
// Focus on mouse down/touch up to match native textfield behavior.
// usePress handles canceling text selection.
let { pressProps: pressProps } = $IwcIq$reactariainteractions.usePress({
preventFocusOnPress: true,
onPressStart: (e)=>{
if (e.pointerType === 'mouse') e.target.focus();
},
onPress (e) {
if (e.pointerType !== 'mouse') e.target.focus();
}
});
// For Android: prevent selection on long press.
$IwcIq$reactariautils.useEvent(ref, 'selectstart', (e)=>{
e.preventDefault();
});
// spinbuttons cannot be focused with VoiceOver on iOS.
let touchPropOverrides = $IwcIq$reactariautils.isIOS() || segment.type === 'timeZoneName' ? {
role: 'textbox',
'aria-valuemax': null,
'aria-valuemin': null,
'aria-valuetext': null,
'aria-valuenow': null
} : {
};
// Only apply aria-describedby to the first segment, unless the field is invalid. This avoids it being
// read every time the user navigates to a new segment.
let firstSegment = $IwcIq$react.useMemo(()=>state.segments.find((s)=>s.isEditable
)
, [
state.segments
]);
if (segment !== firstSegment && state.validationState !== 'invalid') ariaDescribedBy = undefined;
let id = $IwcIq$reactariautils.useId();
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
// Prepend the label passed from the field to each segment name.
// This is needed because VoiceOver on iOS does not announce groups.
let name = segment.type === 'literal' ? '' : displayNames.of(segment.type);
let labelProps = $IwcIq$reactariautils.useLabels({
'aria-label': (ariaLabel ? ariaLabel + ' ' : '') + name,
'aria-labelledby': ariaLabelledBy
});
// Literal segments should not be visible to screen readers. We don't really need any of the above,
// but the rules of hooks mean hooks cannot be conditional so we have to put this condition here.
if (segment.type === 'literal') return {
segmentProps: {
'aria-hidden': true
}
};
return {
segmentProps: $IwcIq$reactariautils.mergeProps(spinButtonProps, pressProps, labelProps, {
id: id,
...touchPropOverrides,
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
'aria-describedby': ariaDescribedBy,
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
contentEditable: isEditable,
suppressContentEditableWarning: isEditable,
spellCheck: isEditable ? 'false' : undefined,
autoCapitalize: isEditable ? 'off' : undefined,
autoCorrect: isEditable ? 'off' : undefined,
// Capitalization was changed in React 17...
[parseInt(($parcel$interopDefault($IwcIq$react)).version, 10) >= 17 ? 'enterKeyHint' : 'enterkeyhint']: isEditable ? 'next' : undefined,
inputMode: state.isDisabled || segment.type === 'dayPeriod' || !isEditable ? undefined : 'numeric',
tabIndex: state.isDisabled ? undefined : 0,
onKeyDown: onKeyDown,
onFocus: onFocus,
style: {
caretColor: 'transparent'
}
})
};
}
function $20f695b1b69e6b9e$export$12fd5f0e9f4bb192(props, state, ref) {
var ref1, ref2;
let formatMessage = $IwcIq$reactariai18n.useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($c7d0e80b992ca68a$exports)));
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $IwcIq$reactarialabel.useField({
...props,
labelElementType: 'span'
});
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
let { locale: locale } = $IwcIq$reactariai18n.useLocale();
let description = state.formatValue(locale, {
month: 'long'
});
let descProps = $IwcIq$reactariautils.useDescription(description);
let startFieldProps = {
'aria-label': formatMessage('startDate'),
'aria-labelledby': labelledBy
};
let endFieldProps = {
'aria-label': formatMessage('endDate'),
'aria-labelledby': labelledBy
};
let buttonId = $IwcIq$reactariautils.useId();
let dialogId = $IwcIq$reactariautils.useId();
let groupProps = $715562ad3b4cced4$export$4a931266a3838b86(state, ref);
let { focusWithinProps: focusWithinProps } = $IwcIq$reactariainteractions.useFocusWithin({
onBlurWithin () {
state.confirmPlaceholder();
}
});
let ariaDescribedBy = [
descProps['aria-describedby'],
fieldProps['aria-describedby']
].filter(Boolean).join(' ') || undefined;
let focusManager = $IwcIq$react.useMemo(()=>$IwcIq$reactariafocus.createFocusManager(ref)
, [
ref
]);
let commonFieldProps = {
[$4acc2f407c169e55$export$7b3062cd49e80452]: focusManager,
[$4acc2f407c169e55$export$300019f83c56d282]: 'presentation',
'aria-describedby': ariaDescribedBy,
minValue: props.minValue,
maxValue: props.maxValue,
placeholderValue: props.placeholderValue,
hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle,
granularity: props.granularity,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isRequired: props.isRequired,
validationState: state.validationState
};
return {
groupProps: $IwcIq$reactariautils.mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
role: 'group',
'aria-disabled': props.isDisabled || null,
'aria-describedby': ariaDescribedBy
}),
labelProps: {
...labelProps,
onClick: ()=>{
focusManager.focusFirst();
}
},
buttonProps: {
...descProps,
id: buttonId,
excludeFromTabOrder: true,
'aria-haspopup': 'dialog',
'aria-label': formatMessage('calendar'),
'aria-labelledby': `${labelledBy} ${buttonId}`,
'aria-describedby': ariaDescribedBy,
onPress: ()=>state.setOpen(true)
},
dialogProps: {
id: dialogId,
'aria-labelledby': `${labelledBy} ${buttonId}`
},
startFieldProps: {
...startFieldProps,
...commonFieldProps,
value: (ref1 = state.value) === null || ref1 === void 0 ? void 0 : ref1.start,
onChange: (start)=>state.setDateTime('start', start)
,
autoFocus: props.autoFocus
},
endFieldProps: {
...endFieldProps,
...commonFieldProps,
value: (ref2 = state.value) === null || ref2 === void 0 ? void 0 : ref2.end,
onChange: (end)=>state.setDateTime('end', end)
},
descriptionProps: descriptionProps,
errorMessageProps: errorMessageProps,
calendarProps: {
autoFocus: true,
value: state.dateRange,
onChange: state.setDateRange,
minValue: props.minValue,
maxValue: props.maxValue,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isDateUnavailable: props.isDateUnavailable,
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
}
};
}
$parcel$exportWildcard(module.exports, $934ac650a0aceb4b$exports);
//# sourceMappingURL=main.js.map

@@ -1,886 +0,25 @@

import {createFocusManager as $cIPI0$createFocusManager, getFocusableTreeWalker as $cIPI0$getFocusableTreeWalker} from "@react-aria/focus";
import {useId as $cIPI0$useId, useDescription as $cIPI0$useDescription, mergeProps as $cIPI0$mergeProps, isMac as $cIPI0$isMac, scrollIntoView as $cIPI0$scrollIntoView, getScrollParent as $cIPI0$getScrollParent, useEvent as $cIPI0$useEvent, isIOS as $cIPI0$isIOS, useLabels as $cIPI0$useLabels} from "@react-aria/utils";
import {useField as $cIPI0$useField} from "@react-aria/label";
import {useMessageFormatter as $cIPI0$useMessageFormatter, useLocale as $cIPI0$useLocale, useDateFormatter as $cIPI0$useDateFormatter, useFilter as $cIPI0$useFilter} from "@react-aria/i18n";
import $cIPI0$react, {useMemo as $cIPI0$useMemo, useRef as $cIPI0$useRef, useEffect as $cIPI0$useEffect} from "react";
import {useFocusWithin as $cIPI0$useFocusWithin, usePress as $cIPI0$usePress} from "@react-aria/interactions";
import {NumberParser as $cIPI0$NumberParser} from "@internationalized/number";
import {useSpinButton as $cIPI0$useSpinButton} from "@react-aria/spinbutton";
import {MessageDictionary as $cIPI0$MessageDictionary} from "@internationalized/message";
import {useDatePicker as $6057a3d2a53a12fd$export$42df105a73306d51} from "./useDatePicker.module.js";
import {useDateSegment as $32489daedd52963e$export$1315d136e6f7581} from "./useDateSegment.module.js";
import {useDateField as $16f0b7bb276bc17e$export$5591b0b878c1a989, useTimeField as $16f0b7bb276bc17e$export$4c842f6a241dc825} from "./useDateField.module.js";
import {useDateRangePicker as $887cac91b7cc8801$export$12fd5f0e9f4bb192} from "./useDateRangePicker.module.js";
import {useDisplayNames as $3aeceb3a64eb8358$export$d42c60378c8168f8} from "./useDisplayNames.module.js";
function $parcel$interopDefault(a) {
return a && a.__esModule ? a.default : a;
}
function $parcel$export(e, n, v, s) {
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
}
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
var $204383cf4f6b0d06$exports = {};
var $f23889fffbde9058$exports = {};
$f23889fffbde9058$exports = JSON.parse("{\"calendar\":\"التقويم\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} إلى {end, date, long}\",\"date\":\"التاريخ\",\"dateRange\":\"نطاق التاريخ\",\"day\":\"يوم\",\"dayPeriod\":\"ص/م\",\"endDate\":\"تاريخ الانتهاء\",\"era\":\"العصر\",\"hour\":\"الساعات\",\"minute\":\"الدقائق\",\"month\":\"الشهر\",\"second\":\"الثواني\",\"startDate\":\"تاريخ البدء\",\"year\":\"السنة\",\"weekday\":\"اليوم\",\"timeZoneName\":\"التوقيت\"}");
var $09d9badaa8903929$exports = {};
$09d9badaa8903929$exports = JSON.parse("{\"calendar\":\"Календар\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} до {end, date, long}\",\"date\":\"Дата\",\"dateRange\":\"Времеви интервал\",\"day\":\"ден\",\"dayPeriod\":\"пр.об./сл.об.\",\"endDate\":\"Крайна дата\",\"era\":\"ера\",\"hour\":\"час\",\"minute\":\"минута\",\"month\":\"месец\",\"second\":\"секунда\",\"startDate\":\"Начална дата\",\"year\":\"година\",\"weekday\":\"ден от седмицата\",\"timeZoneName\":\"часова зона\"}");
var $151b77e0fd711730$exports = {};
$151b77e0fd711730$exports = JSON.parse("{\"calendar\":\"Kalendář\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} až {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Rozsah dat\",\"day\":\"den\",\"dayPeriod\":\"část dne\",\"endDate\":\"Konečné datum\",\"era\":\"letopočet\",\"hour\":\"hodina\",\"minute\":\"minuta\",\"month\":\"měsíc\",\"second\":\"sekunda\",\"startDate\":\"Počáteční datum\",\"year\":\"rok\",\"weekday\":\"den v týdnu\",\"timeZoneName\":\"časové pásmo\"}");
var $61915aa8630b90a2$exports = {};
$61915aa8630b90a2$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} til {end, date, long}\",\"date\":\"Dato\",\"dateRange\":\"Datointerval\",\"day\":\"dag\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Slutdato\",\"era\":\"æra\",\"hour\":\"time\",\"minute\":\"minut\",\"month\":\"måned\",\"second\":\"sekund\",\"startDate\":\"Startdato\",\"year\":\"år\",\"weekday\":\"ugedag\",\"timeZoneName\":\"tidszone\"}");
var $35cea00159787840$exports = {};
$35cea00159787840$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} bis {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumsbereich\",\"day\":\"Tag\",\"dayPeriod\":\"Tageshälfte\",\"endDate\":\"Enddatum\",\"era\":\"Epoche\",\"hour\":\"Stunde\",\"minute\":\"Minute\",\"month\":\"Monat\",\"second\":\"Sekunde\",\"startDate\":\"Anfangsdatum\",\"year\":\"Jahr\",\"weekday\":\"Wochentag\",\"timeZoneName\":\"Zeitzone\"}");
var $518b4e82b9eacafd$exports = {};
$518b4e82b9eacafd$exports = JSON.parse("{\"calendar\":\"Ημερολόγιο\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} ως {end, date, long}\",\"date\":\"Ημερομηνία\",\"dateRange\":\"Εύρος ημερομηνιών\",\"day\":\"ημέρα\",\"dayPeriod\":\"π.μ./μ.μ.\",\"endDate\":\"Ημερομηνία λήξης\",\"era\":\"περίοδος\",\"hour\":\"ώρα\",\"minute\":\"λεπτό\",\"month\":\"μήνας\",\"second\":\"δευτερόλεπτο\",\"startDate\":\"Ημερομηνία έναρξης\",\"year\":\"έτος\",\"weekday\":\"καθημερινή\",\"timeZoneName\":\"ζώνη ώρας\"}");
var $1c2b297f7e2cf474$exports = {};
$1c2b297f7e2cf474$exports = JSON.parse("{\"era\":\"era\",\"year\":\"year\",\"month\":\"month\",\"day\":\"day\",\"hour\":\"hour\",\"minute\":\"minute\",\"second\":\"second\",\"dayPeriod\":\"AM/PM\",\"calendar\":\"Calendar\",\"date\":\"Date\",\"dateRange\":\"Date Range\",\"startDate\":\"Start Date\",\"endDate\":\"End Date\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} to {end, date, long}\",\"weekday\":\"day of the week\",\"timeZoneName\":\"time zone\"}");
var $07f628a707cf9b18$exports = {};
$07f628a707cf9b18$exports = JSON.parse("{\"calendar\":\"Calendario\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} a {end, date, long}\",\"date\":\"Fecha\",\"dateRange\":\"Intervalo de fecha\",\"day\":\"día\",\"dayPeriod\":\"a. m./p. m.\",\"endDate\":\"Fecha final\",\"era\":\"era\",\"hour\":\"hora\",\"minute\":\"minuto\",\"month\":\"mes\",\"second\":\"segundo\",\"startDate\":\"Fecha de inicio\",\"year\":\"año\",\"weekday\":\"día de la semana\",\"timeZoneName\":\"zona horaria\"}");
var $db553ffe17c7f4db$exports = {};
$db553ffe17c7f4db$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} kuni {end, date, long}\",\"date\":\"Kuupäev\",\"dateRange\":\"Kuupäevavahemik\",\"day\":\"päev\",\"dayPeriod\":\"enne/pärast lõunat\",\"endDate\":\"Lõppkuupäev\",\"era\":\"ajastu\",\"hour\":\"tund\",\"minute\":\"minut\",\"month\":\"kuu\",\"second\":\"sekund\",\"startDate\":\"Alguskuupäev\",\"year\":\"aasta\",\"weekday\":\"nädalapäev\",\"timeZoneName\":\"ajavöönd\"}");
var $4afcfe00cd703f83$exports = {};
$4afcfe00cd703f83$exports = JSON.parse("{\"calendar\":\"Kalenteri\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long}–{end, date, long}\",\"date\":\"Päivämäärä\",\"dateRange\":\"Päivämääräalue\",\"day\":\"päivä\",\"dayPeriod\":\"vuorokaudenaika\",\"endDate\":\"Päättymispäivä\",\"era\":\"aikakausi\",\"hour\":\"tunti\",\"minute\":\"minuutti\",\"month\":\"kuukausi\",\"second\":\"sekunti\",\"startDate\":\"Alkamispäivä\",\"year\":\"vuosi\",\"weekday\":\"viikonpäivä\",\"timeZoneName\":\"aikavyöhyke\"}");
var $1d2645d18d4c5be0$exports = {};
$1d2645d18d4c5be0$exports = JSON.parse("{\"calendar\":\"Calendrier\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} au {end, date, long}\",\"date\":\"Date\",\"dateRange\":\"Plage de dates\",\"day\":\"jour\",\"dayPeriod\":\"cadran\",\"endDate\":\"Date de fin\",\"era\":\"ère\",\"hour\":\"heure\",\"minute\":\"minute\",\"month\":\"mois\",\"second\":\"seconde\",\"startDate\":\"Date de début\",\"year\":\"année\",\"weekday\":\"jour de la semaine\",\"timeZoneName\":\"fuseau horaire\"}");
var $64cb6a9be1f6fa48$exports = {};
$64cb6a9be1f6fa48$exports = JSON.parse("{\"calendar\":\"לוח שנה\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"מ-{start, date, long} ועד {end, date, long}\",\"date\":\"תאריך\",\"dateRange\":\"טווח תאריכים\",\"day\":\"יום\",\"dayPeriod\":\"לפנה״צ/אחה״צ\",\"endDate\":\"תאריך סיום\",\"era\":\"תקופה\",\"hour\":\"שעה\",\"minute\":\"דקה\",\"month\":\"חודש\",\"second\":\"שנייה\",\"startDate\":\"תאריך התחלה\",\"year\":\"שנה\",\"weekday\":\"יום בשבוע\",\"timeZoneName\":\"אזור זמן\"}");
var $2a1ef2e8050be27a$exports = {};
$2a1ef2e8050be27a$exports = JSON.parse("{\"calendar\":\"Kalendar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Raspon datuma\",\"day\":\"dan\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Datum završetka\",\"era\":\"era\",\"hour\":\"sat\",\"minute\":\"minuta\",\"month\":\"mjesec\",\"second\":\"sekunda\",\"startDate\":\"Datum početka\",\"year\":\"godina\",\"weekday\":\"dan u tjednu\",\"timeZoneName\":\"vremenska zona\"}");
var $ad429dca102acd0e$exports = {};
$ad429dca102acd0e$exports = JSON.parse("{\"calendar\":\"Naptár\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} – {end, date, long}\",\"date\":\"Dátum\",\"dateRange\":\"Dátumtartomány\",\"day\":\"nap\",\"dayPeriod\":\"napszak\",\"endDate\":\"Befejező dátum\",\"era\":\"éra\",\"hour\":\"óra\",\"minute\":\"perc\",\"month\":\"hónap\",\"second\":\"másodperc\",\"startDate\":\"Kezdő dátum\",\"year\":\"év\",\"weekday\":\"hét napja\",\"timeZoneName\":\"időzóna\"}");
var $6e68cb5d1cb97bd2$exports = {};
$6e68cb5d1cb97bd2$exports = JSON.parse("{\"calendar\":\"Calendario\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"Da {start, date, long} a {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Intervallo date\",\"day\":\"giorno\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Data finale\",\"era\":\"era\",\"hour\":\"ora\",\"minute\":\"minuto\",\"month\":\"mese\",\"second\":\"secondo\",\"startDate\":\"Data iniziale\",\"year\":\"anno\",\"weekday\":\"giorno della settimana\",\"timeZoneName\":\"fuso orario\"}");
var $a82ee9af063ee069$exports = {};
$a82ee9af063ee069$exports = JSON.parse("{\"calendar\":\"カレンダー\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} ~ {end, date, long}\",\"date\":\"日付\",\"dateRange\":\"日付範囲\",\"day\":\"日\",\"dayPeriod\":\"午前/午後\",\"endDate\":\"終了日\",\"era\":\"時代\",\"hour\":\"時\",\"minute\":\"分\",\"month\":\"月\",\"second\":\"秒\",\"startDate\":\"開始日\",\"year\":\"年\",\"weekday\":\"曜日\",\"timeZoneName\":\"タイムゾーン\"}");
var $67e9091dbf37d4eb$exports = {};
$67e9091dbf37d4eb$exports = JSON.parse("{\"calendar\":\"달력\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} ~ {end, date, long}\",\"date\":\"날짜\",\"dateRange\":\"날짜 범위\",\"day\":\"일\",\"dayPeriod\":\"오전/오후\",\"endDate\":\"종료 날짜\",\"era\":\"연호\",\"hour\":\"시\",\"minute\":\"분\",\"month\":\"월\",\"second\":\"초\",\"startDate\":\"시작 날짜\",\"year\":\"년\",\"weekday\":\"요일\",\"timeZoneName\":\"시간대\"}");
var $75834f9729f653d1$exports = {};
$75834f9729f653d1$exports = JSON.parse("{\"calendar\":\"Kalendorius\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"Nuo {start, date, long} iki {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Datų intervalas\",\"day\":\"diena\",\"dayPeriod\":\"iki pietų / po pietų\",\"endDate\":\"Pabaigos data\",\"era\":\"era\",\"hour\":\"valanda\",\"minute\":\"minutė\",\"month\":\"mėnuo\",\"second\":\"sekundė\",\"startDate\":\"Pradžios data\",\"year\":\"metai\",\"weekday\":\"savaitės diena\",\"timeZoneName\":\"laiko juosta\"}");
var $a2df2c2520b4a7f0$exports = {};
$a2df2c2520b4a7f0$exports = JSON.parse("{\"calendar\":\"Kalendārs\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} līdz {end, date, long}\",\"date\":\"Datums\",\"dateRange\":\"Datumu diapazons\",\"day\":\"diena\",\"dayPeriod\":\"priekšpusdienā/pēcpusdienā\",\"endDate\":\"Beigu datums\",\"era\":\"ēra\",\"hour\":\"stundas\",\"minute\":\"minūtes\",\"month\":\"mēnesis\",\"second\":\"sekundes\",\"startDate\":\"Sākuma datums\",\"year\":\"gads\",\"weekday\":\"nedēļas diena\",\"timeZoneName\":\"laika josla\"}");
var $aedcd71db4933ed5$exports = {};
$aedcd71db4933ed5$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} til {end, date, long}\",\"date\":\"Dato\",\"dateRange\":\"Datoområde\",\"day\":\"dag\",\"dayPeriod\":\"a.m./p.m.\",\"endDate\":\"Sluttdato\",\"era\":\"tidsalder\",\"hour\":\"time\",\"minute\":\"minutt\",\"month\":\"måned\",\"second\":\"sekund\",\"startDate\":\"Startdato\",\"year\":\"år\",\"weekday\":\"ukedag\",\"timeZoneName\":\"tidssone\"}");
var $3b2df9e54353046c$exports = {};
$3b2df9e54353046c$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} t/m {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumbereik\",\"day\":\"dag\",\"dayPeriod\":\"a.m./p.m.\",\"endDate\":\"Einddatum\",\"era\":\"tijdperk\",\"hour\":\"uur\",\"minute\":\"minuut\",\"month\":\"maand\",\"second\":\"seconde\",\"startDate\":\"Startdatum\",\"year\":\"jaar\",\"weekday\":\"dag van de week\",\"timeZoneName\":\"tijdzone\"}");
var $c03fe977fcfafe93$exports = {};
$c03fe977fcfafe93$exports = JSON.parse("{\"calendar\":\"Kalendarz\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Zakres dat\",\"day\":\"dzień\",\"dayPeriod\":\"rano / po południu / wieczorem\",\"endDate\":\"Data końcowa\",\"era\":\"era\",\"hour\":\"godzina\",\"minute\":\"minuta\",\"month\":\"miesiąc\",\"second\":\"sekunda\",\"startDate\":\"Data początkowa\",\"year\":\"rok\",\"weekday\":\"dzień tygodnia\",\"timeZoneName\":\"strefa czasowa\"}");
var $569f006fc292345f$exports = {};
$569f006fc292345f$exports = JSON.parse("{\"calendar\":\"Calendário\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} a {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Intervalo de datas\",\"day\":\"dia\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Data final\",\"era\":\"era\",\"hour\":\"hora\",\"minute\":\"minuto\",\"month\":\"mês\",\"second\":\"segundo\",\"startDate\":\"Data inicial\",\"year\":\"ano\",\"weekday\":\"dia da semana\",\"timeZoneName\":\"fuso horário\"}");
var $7c2494e14452f2dd$exports = {};
$7c2494e14452f2dd$exports = JSON.parse("{\"calendar\":\"Calendário\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} a {end, date, long}\",\"date\":\"Data\",\"dateRange\":\"Intervalo de datas\",\"day\":\"dia\",\"dayPeriod\":\"am/pm\",\"endDate\":\"Data de Término\",\"era\":\"era\",\"hour\":\"hora\",\"minute\":\"minuto\",\"month\":\"mês\",\"second\":\"segundo\",\"startDate\":\"Data de Início\",\"year\":\"ano\",\"weekday\":\"dia da semana\",\"timeZoneName\":\"fuso horário\"}");
var $eb82ef981b5592bf$exports = {};
$eb82ef981b5592bf$exports = JSON.parse("{\"calendar\":\"Calendar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} - {end, date, long}\",\"date\":\"Dată\",\"dateRange\":\"Raza datei\",\"day\":\"zi\",\"dayPeriod\":\"a.m/p.m.\",\"endDate\":\"Dată final\",\"era\":\"eră\",\"hour\":\"oră\",\"minute\":\"minut\",\"month\":\"lună\",\"second\":\"secundă\",\"startDate\":\"Dată început\",\"year\":\"an\",\"weekday\":\"ziua din săptămână\",\"timeZoneName\":\"fus orar\"}");
var $6efa0e119f396950$exports = {};
$6efa0e119f396950$exports = JSON.parse("{\"calendar\":\"Календарь\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} – {end, date, long}\",\"date\":\"Дата\",\"dateRange\":\"Диапазон дат\",\"day\":\"день\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Дата окончания\",\"era\":\"эра\",\"hour\":\"час\",\"minute\":\"минута\",\"month\":\"месяц\",\"second\":\"секунда\",\"startDate\":\"Дата начала\",\"year\":\"год\",\"weekday\":\"день недели\",\"timeZoneName\":\"часовой пояс\"}");
var $7f5e57085d7f5049$exports = {};
$7f5e57085d7f5049$exports = JSON.parse("{\"calendar\":\"Kalendár\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Dátum\",\"dateRange\":\"Rozsah dátumov\",\"day\":\"deň\",\"dayPeriod\":\"AM/PM\",\"endDate\":\"Dátum ukončenia\",\"era\":\"letopočet\",\"hour\":\"hodina\",\"minute\":\"minúta\",\"month\":\"mesiac\",\"second\":\"sekunda\",\"startDate\":\"Dátum začatia\",\"year\":\"rok\",\"weekday\":\"deň týždňa\",\"timeZoneName\":\"časové pásmo\"}");
var $578ee7c11dcdde7a$exports = {};
$578ee7c11dcdde7a$exports = JSON.parse("{\"calendar\":\"Koledar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumski obseg\",\"day\":\"dan\",\"dayPeriod\":\"dop/pop\",\"endDate\":\"Datum konca\",\"era\":\"doba\",\"hour\":\"ura\",\"minute\":\"minuta\",\"month\":\"mesec\",\"second\":\"sekunda\",\"startDate\":\"Datum začetka\",\"year\":\"leto\",\"weekday\":\"dan v tednu\",\"timeZoneName\":\"časovni pas\"}");
var $bbc3fd6cd0bc9d50$exports = {};
$bbc3fd6cd0bc9d50$exports = JSON.parse("{\"calendar\":\"Kalendar\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} do {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Opseg datuma\",\"day\":\"дан\",\"dayPeriod\":\"пре подне/по подне\",\"endDate\":\"Datum završetka\",\"era\":\"ера\",\"hour\":\"сат\",\"minute\":\"минут\",\"month\":\"месец\",\"second\":\"секунд\",\"startDate\":\"Datum početka\",\"year\":\"година\",\"weekday\":\"дан у недељи\",\"timeZoneName\":\"временска зона\"}");
var $0b04512118591d2a$exports = {};
$0b04512118591d2a$exports = JSON.parse("{\"calendar\":\"Kalender\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} till {end, date, long}\",\"date\":\"Datum\",\"dateRange\":\"Datumintervall\",\"day\":\"dag\",\"dayPeriod\":\"fm/em\",\"endDate\":\"Slutdatum\",\"era\":\"era\",\"hour\":\"timme\",\"minute\":\"minut\",\"month\":\"månad\",\"second\":\"sekund\",\"startDate\":\"Startdatum\",\"year\":\"år\",\"weekday\":\"veckodag\",\"timeZoneName\":\"tidszon\"}");
var $3a49d121fe4c9e1d$exports = {};
$3a49d121fe4c9e1d$exports = JSON.parse("{\"calendar\":\"Takvim\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} - {end, date, long}\",\"date\":\"Tarih\",\"dateRange\":\"Tarih Aralığı\",\"day\":\"gün\",\"dayPeriod\":\"ÖÖ/ÖS\",\"endDate\":\"Bitiş Tarihi\",\"era\":\"çağ\",\"hour\":\"saat\",\"minute\":\"dakika\",\"month\":\"ay\",\"second\":\"saniye\",\"startDate\":\"Başlangıç Tarihi\",\"year\":\"yıl\",\"weekday\":\"haftanın günü\",\"timeZoneName\":\"saat dilimi\"}");
var $5ba21dbb8914919d$exports = {};
$5ba21dbb8914919d$exports = JSON.parse("{\"calendar\":\"Календар\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"Від {start, date, long} до {end, date, long}\",\"date\":\"Дата\",\"dateRange\":\"Діапазон дат\",\"day\":\"день\",\"dayPeriod\":\"дп/пп\",\"endDate\":\"Дата завершення\",\"era\":\"ера\",\"hour\":\"година\",\"minute\":\"хвилина\",\"month\":\"місяць\",\"second\":\"секунда\",\"startDate\":\"Дата початку\",\"year\":\"рік\",\"weekday\":\"день тижня\",\"timeZoneName\":\"часовий пояс\"}");
var $51078838e1b16cd7$exports = {};
$51078838e1b16cd7$exports = JSON.parse("{\"calendar\":\"日历\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long} 至 {end, date, long}\",\"date\":\"日期\",\"dateRange\":\"日期范围\",\"day\":\"日\",\"dayPeriod\":\"上午/下午\",\"endDate\":\"结束日期\",\"era\":\"纪元\",\"hour\":\"小时\",\"minute\":\"分钟\",\"month\":\"月\",\"second\":\"秒\",\"startDate\":\"开始日期\",\"year\":\"年\",\"weekday\":\"工作日\",\"timeZoneName\":\"时区\"}");
var $33fab8219207655a$exports = {};
$33fab8219207655a$exports = JSON.parse("{\"calendar\":\"日曆\",\"currentDate\":\"{date, date, full}\",\"currentDateRange\":\"{start, date, long}至 {end, date, long}\",\"date\":\"日期\",\"dateRange\":\"日期範圍\",\"day\":\"日\",\"dayPeriod\":\"上午/下午\",\"endDate\":\"結束日期\",\"era\":\"纪元\",\"hour\":\"小时\",\"minute\":\"分钟\",\"month\":\"月\",\"second\":\"秒\",\"startDate\":\"開始日期\",\"year\":\"年\",\"weekday\":\"工作日\",\"timeZoneName\":\"时区\"}");
$204383cf4f6b0d06$exports = {
"ar-AE": $f23889fffbde9058$exports,
"bg-BG": $09d9badaa8903929$exports,
"cs-CZ": $151b77e0fd711730$exports,
"da-DK": $61915aa8630b90a2$exports,
"de-DE": $35cea00159787840$exports,
"el-GR": $518b4e82b9eacafd$exports,
"en-US": $1c2b297f7e2cf474$exports,
"es-ES": $07f628a707cf9b18$exports,
"et-EE": $db553ffe17c7f4db$exports,
"fi-FI": $4afcfe00cd703f83$exports,
"fr-FR": $1d2645d18d4c5be0$exports,
"he-IL": $64cb6a9be1f6fa48$exports,
"hr-HR": $2a1ef2e8050be27a$exports,
"hu-HU": $ad429dca102acd0e$exports,
"it-IT": $6e68cb5d1cb97bd2$exports,
"ja-JP": $a82ee9af063ee069$exports,
"ko-KR": $67e9091dbf37d4eb$exports,
"lt-LT": $75834f9729f653d1$exports,
"lv-LV": $a2df2c2520b4a7f0$exports,
"nb-NO": $aedcd71db4933ed5$exports,
"nl-NL": $3b2df9e54353046c$exports,
"pl-PL": $c03fe977fcfafe93$exports,
"pt-BR": $569f006fc292345f$exports,
"pt-PT": $7c2494e14452f2dd$exports,
"ro-RO": $eb82ef981b5592bf$exports,
"ru-RU": $6efa0e119f396950$exports,
"sk-SK": $7f5e57085d7f5049$exports,
"sl-SI": $578ee7c11dcdde7a$exports,
"sr-SP": $bbc3fd6cd0bc9d50$exports,
"sv-SE": $0b04512118591d2a$exports,
"tr-TR": $3a49d121fe4c9e1d$exports,
"uk-UA": $5ba21dbb8914919d$exports,
"zh-CN": $51078838e1b16cd7$exports,
"zh-TW": $33fab8219207655a$exports
};
function $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref1) {
// Open the popover on alt + arrow down
let onKeyDown = (e)=>{
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {
e.preventDefault();
e.stopPropagation();
state.setOpen(true);
}
};
// Focus the first placeholder segment from the end on mouse down/touch up in the field.
let focusLast = ()=>{
var ref;
// Try to find the segment prior to the element that was clicked on.
let target = (ref = window.event) === null || ref === void 0 ? void 0 : ref.target;
let walker = $cIPI0$getFocusableTreeWalker(ref1.current, {
tabbable: true
});
if (target) {
walker.currentNode = target;
target = walker.previousNode();
}
// If no target found, find the last element from the end.
if (!target) {
let last;
do {
last = walker.lastChild();
if (last) target = last;
}while (last)
}
// Now go backwards until we find an element that is not a placeholder.
while(target === null || target === void 0 ? void 0 : target.getAttribute('aria-placeholder')){
let prev = walker.previousNode();
if (prev && prev.getAttribute('aria-placeholder')) target = prev;
else break;
}
if (target) target.focus();
};
let { pressProps: pressProps } = $cIPI0$usePress({
onPressStart (e) {
if (e.pointerType === 'mouse') focusLast();
},
onPress (e) {
if (e.pointerType !== 'mouse') focusLast();
}
});
return $cIPI0$mergeProps(pressProps, {
onKeyDown: onKeyDown
});
}
const $16f0b7bb276bc17e$export$653eddfc964b0f8a = new WeakMap();
const $16f0b7bb276bc17e$export$300019f83c56d282 = '__role_' + Date.now();
const $16f0b7bb276bc17e$export$7b3062cd49e80452 = '__focusManager_' + Date.now();
function $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref) {
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
...props,
labelElementType: 'span'
});
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
onBlurWithin () {
state.confirmPlaceholder();
}
});
let descProps = $cIPI0$useDescription(state.formatValue({
month: 'long'
}));
// If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby
// will be passed in that references the value (e.g. entire range). Otherwise, add the field's value description.
let describedBy = props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation' ? fieldProps['aria-describedby'] : [
descProps['aria-describedby'],
fieldProps['aria-describedby']
].filter(Boolean).join(' ') || undefined;
let propsFocusManager = props[$16f0b7bb276bc17e$export$7b3062cd49e80452];
let focusManager = $cIPI0$useMemo(()=>propsFocusManager || $cIPI0$createFocusManager(ref)
, [
propsFocusManager,
ref
]);
// Pass labels and other information to segments.
$16f0b7bb276bc17e$export$653eddfc964b0f8a.set(state, {
ariaLabel: props['aria-label'],
ariaLabelledBy: [
props['aria-labelledby'],
labelProps.id
].filter(Boolean).join(' ') || undefined,
ariaDescribedBy: describedBy,
focusManager: focusManager
});
let autoFocusRef = $cIPI0$useRef(props.autoFocus);
// When used within a date picker or date range picker, the field gets role="presentation"
// rather than role="group". Since the date picker/date range picker already has a role="group"
// with a label and description, and the segments are already labeled by this as well, this
// avoids very verbose duplicate announcements.
let fieldDOMProps;
if (props[$16f0b7bb276bc17e$export$300019f83c56d282] === 'presentation') fieldDOMProps = {
role: 'presentation'
};
else fieldDOMProps = $cIPI0$mergeProps(fieldProps, {
role: 'group',
'aria-disabled': props.isDisabled || undefined,
'aria-describedby': describedBy
});
$cIPI0$useEffect(()=>{
if (autoFocusRef.current) focusManager.focusFirst();
autoFocusRef.current = false;
}, [
focusManager
]);
return {
labelProps: {
...labelProps,
onClick: ()=>{
focusManager.focusFirst();
}
},
fieldProps: $cIPI0$mergeProps(fieldDOMProps, groupProps, focusWithinProps),
descriptionProps: descriptionProps,
errorMessageProps: errorMessageProps
};
}
function $16f0b7bb276bc17e$export$4c842f6a241dc825(props, state, ref) {
return $16f0b7bb276bc17e$export$5591b0b878c1a989(props, state, ref);
}
function $6057a3d2a53a12fd$export$42df105a73306d51(props, state, ref) {
let buttonId = $cIPI0$useId();
let dialogId = $cIPI0$useId();
let formatMessage = $cIPI0$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
...props,
labelElementType: 'span'
});
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
let { locale: locale } = $cIPI0$useLocale();
let descProps = $cIPI0$useDescription(state.formatValue(locale, {
month: 'long'
}));
let ariaDescribedBy = [
descProps['aria-describedby'],
fieldProps['aria-describedby']
].filter(Boolean).join(' ') || undefined;
return {
groupProps: $cIPI0$mergeProps(groupProps, fieldProps, descProps, {
role: 'group',
'aria-disabled': props.isDisabled || null,
'aria-labelledby': labelledBy,
'aria-describedby': ariaDescribedBy
}),
labelProps: {
...labelProps,
onClick: ()=>{
let focusManager = $cIPI0$createFocusManager(ref);
focusManager.focusFirst();
}
},
fieldProps: {
...fieldProps,
[$16f0b7bb276bc17e$export$300019f83c56d282]: 'presentation',
'aria-describedby': ariaDescribedBy,
value: state.value,
onChange: state.setValue,
minValue: props.minValue,
maxValue: props.maxValue,
placeholderValue: props.placeholderValue,
hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle,
granularity: props.granularity,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isRequired: props.isRequired,
validationState: state.validationState,
autoFocus: props.autoFocus
},
descriptionProps: descriptionProps,
errorMessageProps: errorMessageProps,
buttonProps: {
...descProps,
id: buttonId,
excludeFromTabOrder: true,
'aria-haspopup': 'dialog',
'aria-label': formatMessage('calendar'),
'aria-labelledby': `${labelledBy} ${buttonId}`,
'aria-describedby': ariaDescribedBy,
onPress: ()=>state.setOpen(true)
},
dialogProps: {
id: dialogId,
'aria-labelledby': `${labelledBy} ${buttonId}`
},
calendarProps: {
autoFocus: true,
value: state.dateValue,
onChange: state.setDateValue,
minValue: props.minValue,
maxValue: props.maxValue,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isDateUnavailable: props.isDateUnavailable,
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue
}
};
}
var $3aeceb3a64eb8358$exports = {};
$parcel$export($3aeceb3a64eb8358$exports, "useDisplayNames", () => $3aeceb3a64eb8358$export$d42c60378c8168f8);
function $3aeceb3a64eb8358$export$d42c60378c8168f8() {
let { locale: locale } = $cIPI0$useLocale();
return $cIPI0$useMemo(()=>{
// Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField
// type as that was only added in v2. https://github.com/tc39/intl-displaynames-v2
try {
// @ts-ignore
return new Intl.DisplayNames(locale, {
type: 'dateTimeField'
});
} catch (err) {
return new $3aeceb3a64eb8358$var$DisplayNamesPolyfill(locale);
}
}, [
locale
]);
}
class $3aeceb3a64eb8358$var$DisplayNamesPolyfill {
of(field) {
return this.dictionary.getStringForLocale(field, this.locale);
}
constructor(locale){
this.locale = locale;
this.dictionary = new $cIPI0$MessageDictionary((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
}
}
function $32489daedd52963e$export$1315d136e6f7581(segment, state, ref) {
let enteredKeys = $cIPI0$useRef('');
let { locale: locale , direction: direction } = $cIPI0$useLocale();
let displayNames = $3aeceb3a64eb8358$export$d42c60378c8168f8();
let { ariaLabel: ariaLabel , ariaLabelledBy: ariaLabelledBy , ariaDescribedBy: ariaDescribedBy , focusManager: focusManager } = $16f0b7bb276bc17e$export$653eddfc964b0f8a.get(state);
let textValue = segment.text;
let options = $cIPI0$useMemo(()=>state.dateFormatter.resolvedOptions()
, [
state.dateFormatter
]);
let monthDateFormatter = $cIPI0$useDateFormatter({
month: 'long',
timeZone: options.timeZone
});
let hourDateFormatter = $cIPI0$useDateFormatter({
hour: 'numeric',
hour12: options.hour12,
timeZone: options.timeZone
});
if (segment.type === 'month') {
let monthTextValue = monthDateFormatter.format(state.dateValue);
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
} else if (segment.type === 'hour') textValue = hourDateFormatter.format(state.dateValue);
let { spinButtonProps: spinButtonProps } = $cIPI0$useSpinButton({
value: segment.value,
textValue: textValue,
minValue: segment.minValue,
maxValue: segment.maxValue,
isDisabled: state.isDisabled,
isReadOnly: state.isReadOnly || !segment.isEditable,
isRequired: state.isRequired,
onIncrement: ()=>{
enteredKeys.current = '';
state.increment(segment.type);
},
onDecrement: ()=>{
enteredKeys.current = '';
state.decrement(segment.type);
},
onIncrementPage: ()=>{
enteredKeys.current = '';
state.incrementPage(segment.type);
},
onDecrementPage: ()=>{
enteredKeys.current = '';
state.decrementPage(segment.type);
},
onIncrementToMax: ()=>{
enteredKeys.current = '';
state.setSegment(segment.type, segment.maxValue);
},
onDecrementToMin: ()=>{
enteredKeys.current = '';
state.setSegment(segment.type, segment.minValue);
}
});
let parser = $cIPI0$useMemo(()=>new $cIPI0$NumberParser(locale, {
maximumFractionDigits: 0
})
, [
locale
]);
let backspace = ()=>{
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly && !segment.isPlaceholder) {
let newValue = segment.text.slice(0, -1);
let parsed = parser.parse(newValue);
if (newValue.length === 0 || parsed === 0) state.clearSegment(segment.type);
else state.setSegment(segment.type, parsed);
enteredKeys.current = newValue;
} else if (segment.type === 'dayPeriod') state.clearSegment(segment.type);
};
let onKeyDown = (e)=>{
// Firefox does not fire selectstart for Ctrl/Cmd + A
// https://bugzilla.mozilla.org/show_bug.cgi?id=1742153
if (e.key === 'a' && ($cIPI0$isMac() ? e.metaKey : e.ctrlKey)) e.preventDefault();
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey) return;
switch(e.key){
case 'ArrowLeft':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') focusManager.focusNext({
tabbable: true
});
else focusManager.focusPrevious({
tabbable: true
});
break;
case 'ArrowRight':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') focusManager.focusPrevious({
tabbable: true
});
else focusManager.focusNext({
tabbable: true
});
break;
case 'Enter':
e.preventDefault();
e.stopPropagation();
if (segment.isPlaceholder && !state.isReadOnly) state.confirmPlaceholder(segment.type);
focusManager.focusNext({
tabbable: true
});
break;
case 'Tab':
break;
case 'Backspace':
case 'Delete':
// Safari on iOS does not fire beforeinput for the backspace key because the cursor is at the start.
e.preventDefault();
e.stopPropagation();
backspace();
break;
}
};
// Safari dayPeriod option doesn't work...
let { startsWith: startsWith } = $cIPI0$useFilter({
sensitivity: 'base'
});
let amPmFormatter = $cIPI0$useDateFormatter({
hour: 'numeric',
hour12: true
});
let am = $cIPI0$useMemo(()=>{
let date = new Date();
date.setHours(0);
return amPmFormatter.formatToParts(date).find((part)=>part.type === 'dayPeriod'
).value;
}, [
amPmFormatter
]);
let pm = $cIPI0$useMemo(()=>{
let date = new Date();
date.setHours(12);
return amPmFormatter.formatToParts(date).find((part)=>part.type === 'dayPeriod'
).value;
}, [
amPmFormatter
]);
let onInput = (key)=>{
if (state.isDisabled || state.isReadOnly) return;
let newValue = enteredKeys.current + key;
switch(segment.type){
case 'dayPeriod':
if (startsWith(am, key)) state.setSegment('dayPeriod', 0);
else if (startsWith(pm, key)) state.setSegment('dayPeriod', 12);
else break;
focusManager.focusNext({
tabbable: true
});
break;
case 'day':
case 'hour':
case 'minute':
case 'second':
case 'month':
case 'year':
{
if (!parser.isValidPartialNumber(newValue)) return;
let numberValue = parser.parse(newValue);
let segmentValue = numberValue;
let allowsZero = segment.minValue === 0;
if (segment.type === 'hour' && state.dateFormatter.resolvedOptions().hour12) {
switch(state.dateFormatter.resolvedOptions().hourCycle){
case 'h11':
if (numberValue > 11) segmentValue = parser.parse(key);
break;
case 'h12':
allowsZero = false;
if (numberValue > 12) segmentValue = parser.parse(key);
break;
}
if (segment.value >= 12 && numberValue > 1) numberValue += 12;
} else if (numberValue > segment.maxValue) segmentValue = parser.parse(key);
if (isNaN(numberValue)) return;
let shouldSetValue = segmentValue !== 0 || allowsZero;
if (shouldSetValue) state.setSegment(segment.type, segmentValue);
if (Number(numberValue + '0') > segment.maxValue || newValue.length >= String(segment.maxValue).length) {
enteredKeys.current = '';
if (shouldSetValue) focusManager.focusNext({
tabbable: true
});
} else enteredKeys.current = newValue;
break;
}
}
};
let onFocus = ()=>{
enteredKeys.current = '';
$cIPI0$scrollIntoView($cIPI0$getScrollParent(ref.current), ref.current);
// Safari requires that a selection is set or it won't fire input events.
// Since usePress disables text selection, this won't happen by default.
ref.current.style.webkitUserSelect = 'text';
let selection = window.getSelection();
selection.collapse(ref.current);
ref.current.style.webkitUserSelect = '';
};
let compositionRef = $cIPI0$useRef('');
// @ts-ignore - TODO: possibly old TS version? doesn't fail in my editor...
$cIPI0$useEvent(ref, 'beforeinput', (e)=>{
e.preventDefault();
switch(e.inputType){
case 'deleteContentBackward':
case 'deleteContentForward':
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly) backspace();
break;
case 'insertCompositionText':
// insertCompositionText cannot be canceled.
// Record the current state of the element so we can restore it in the `input` event below.
compositionRef.current = ref.current.textContent;
// Safari gets stuck in a composition state unless we also assign to the value here.
// eslint-disable-next-line no-self-assign
ref.current.textContent = ref.current.textContent;
break;
default:
if (e.data != null) onInput(e.data);
break;
}
});
$cIPI0$useEvent(ref, 'input', (e)=>{
let { inputType: inputType , data: data } = e;
switch(inputType){
case 'insertCompositionText':
// Reset the DOM to how it was in the beforeinput event.
ref.current.textContent = compositionRef.current;
// Android sometimes fires key presses of letters as composition events. Need to handle am/pm keys here too.
// Can also happen e.g. with Pinyin keyboard on iOS.
if (startsWith(am, data) || startsWith(pm, data)) onInput(data);
break;
}
});
// Focus on mouse down/touch up to match native textfield behavior.
// usePress handles canceling text selection.
let { pressProps: pressProps } = $cIPI0$usePress({
preventFocusOnPress: true,
onPressStart: (e)=>{
if (e.pointerType === 'mouse') e.target.focus();
},
onPress (e) {
if (e.pointerType !== 'mouse') e.target.focus();
}
});
// For Android: prevent selection on long press.
$cIPI0$useEvent(ref, 'selectstart', (e)=>{
e.preventDefault();
});
// spinbuttons cannot be focused with VoiceOver on iOS.
let touchPropOverrides = $cIPI0$isIOS() || segment.type === 'timeZoneName' ? {
role: 'textbox',
'aria-valuemax': null,
'aria-valuemin': null,
'aria-valuetext': null,
'aria-valuenow': null
} : {
};
// Only apply aria-describedby to the first segment, unless the field is invalid. This avoids it being
// read every time the user navigates to a new segment.
let firstSegment = $cIPI0$useMemo(()=>state.segments.find((s)=>s.isEditable
)
, [
state.segments
]);
if (segment !== firstSegment && state.validationState !== 'invalid') ariaDescribedBy = undefined;
let id = $cIPI0$useId();
let isEditable = !state.isDisabled && !state.isReadOnly && segment.isEditable;
// Prepend the label passed from the field to each segment name.
// This is needed because VoiceOver on iOS does not announce groups.
let name = segment.type === 'literal' ? '' : displayNames.of(segment.type);
let labelProps = $cIPI0$useLabels({
'aria-label': (ariaLabel ? ariaLabel + ' ' : '') + name,
'aria-labelledby': ariaLabelledBy
});
// Literal segments should not be visible to screen readers. We don't really need any of the above,
// but the rules of hooks mean hooks cannot be conditional so we have to put this condition here.
if (segment.type === 'literal') return {
segmentProps: {
'aria-hidden': true
}
};
return {
segmentProps: $cIPI0$mergeProps(spinButtonProps, pressProps, labelProps, {
id: id,
...touchPropOverrides,
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
'aria-describedby': ariaDescribedBy,
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
contentEditable: isEditable,
suppressContentEditableWarning: isEditable,
spellCheck: isEditable ? 'false' : undefined,
autoCapitalize: isEditable ? 'off' : undefined,
autoCorrect: isEditable ? 'off' : undefined,
// Capitalization was changed in React 17...
[parseInt($cIPI0$react.version, 10) >= 17 ? 'enterKeyHint' : 'enterkeyhint']: isEditable ? 'next' : undefined,
inputMode: state.isDisabled || segment.type === 'dayPeriod' || !isEditable ? undefined : 'numeric',
tabIndex: state.isDisabled ? undefined : 0,
onKeyDown: onKeyDown,
onFocus: onFocus,
style: {
caretColor: 'transparent'
}
})
};
}
function $887cac91b7cc8801$export$12fd5f0e9f4bb192(props, state, ref) {
var ref1, ref2;
let formatMessage = $cIPI0$useMessageFormatter((/*@__PURE__*/$parcel$interopDefault($204383cf4f6b0d06$exports)));
let { labelProps: labelProps , fieldProps: fieldProps , descriptionProps: descriptionProps , errorMessageProps: errorMessageProps } = $cIPI0$useField({
...props,
labelElementType: 'span'
});
let labelledBy = fieldProps['aria-labelledby'] || fieldProps.id;
let { locale: locale } = $cIPI0$useLocale();
let description = state.formatValue(locale, {
month: 'long'
});
let descProps = $cIPI0$useDescription(description);
let startFieldProps = {
'aria-label': formatMessage('startDate'),
'aria-labelledby': labelledBy
};
let endFieldProps = {
'aria-label': formatMessage('endDate'),
'aria-labelledby': labelledBy
};
let buttonId = $cIPI0$useId();
let dialogId = $cIPI0$useId();
let groupProps = $3dfb0f96be0d6a08$export$4a931266a3838b86(state, ref);
let { focusWithinProps: focusWithinProps } = $cIPI0$useFocusWithin({
onBlurWithin () {
state.confirmPlaceholder();
}
});
let ariaDescribedBy = [
descProps['aria-describedby'],
fieldProps['aria-describedby']
].filter(Boolean).join(' ') || undefined;
let focusManager = $cIPI0$useMemo(()=>$cIPI0$createFocusManager(ref)
, [
ref
]);
let commonFieldProps = {
[$16f0b7bb276bc17e$export$7b3062cd49e80452]: focusManager,
[$16f0b7bb276bc17e$export$300019f83c56d282]: 'presentation',
'aria-describedby': ariaDescribedBy,
minValue: props.minValue,
maxValue: props.maxValue,
placeholderValue: props.placeholderValue,
hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle,
granularity: props.granularity,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isRequired: props.isRequired,
validationState: state.validationState
};
return {
groupProps: $cIPI0$mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
role: 'group',
'aria-disabled': props.isDisabled || null,
'aria-describedby': ariaDescribedBy
}),
labelProps: {
...labelProps,
onClick: ()=>{
focusManager.focusFirst();
}
},
buttonProps: {
...descProps,
id: buttonId,
excludeFromTabOrder: true,
'aria-haspopup': 'dialog',
'aria-label': formatMessage('calendar'),
'aria-labelledby': `${labelledBy} ${buttonId}`,
'aria-describedby': ariaDescribedBy,
onPress: ()=>state.setOpen(true)
},
dialogProps: {
id: dialogId,
'aria-labelledby': `${labelledBy} ${buttonId}`
},
startFieldProps: {
...startFieldProps,
...commonFieldProps,
value: (ref1 = state.value) === null || ref1 === void 0 ? void 0 : ref1.start,
onChange: (start)=>state.setDateTime('start', start)
,
autoFocus: props.autoFocus
},
endFieldProps: {
...endFieldProps,
...commonFieldProps,
value: (ref2 = state.value) === null || ref2 === void 0 ? void 0 : ref2.end,
onChange: (end)=>state.setDateTime('end', end)
},
descriptionProps: descriptionProps,
errorMessageProps: errorMessageProps,
calendarProps: {
autoFocus: true,
value: state.dateRange,
onChange: state.setDateRange,
minValue: props.minValue,
maxValue: props.maxValue,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isDateUnavailable: props.isDateUnavailable,
allowsNonContiguousRanges: props.allowsNonContiguousRanges,
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
}
};
}
export {$6057a3d2a53a12fd$export$42df105a73306d51 as useDatePicker, $32489daedd52963e$export$1315d136e6f7581 as useDateSegment, $16f0b7bb276bc17e$export$5591b0b878c1a989 as useDateField, $16f0b7bb276bc17e$export$4c842f6a241dc825 as useTimeField, $887cac91b7cc8801$export$12fd5f0e9f4bb192 as useDateRangePicker, $3aeceb3a64eb8358$export$d42c60378c8168f8 as useDisplayNames};
//# sourceMappingURL=module.js.map

@@ -1,18 +0,23 @@

import { AriaDatePickerProps, AriaTimeFieldProps, DateValue, TimeValue, AriaDateRangePickerProps } from "@react-types/datepicker";
import { DateFieldState, DatePickerState, DateSegment, DateRangePickerState } from "@react-stately/datepicker";
import { HTMLAttributes, RefObject } from "react";
import { AriaDateFieldProps, AriaTimeFieldProps, DateValue, TimeValue, AriaDatePickerProps, AriaDateRangePickerProps } from "@react-types/datepicker";
import { DateFieldState, TimeFieldState, DatePickerState, DateSegment, DateRangePickerState } from "@react-stately/datepicker";
import { DOMAttributes, GroupDOMAttributes, RefObject, ValidationResult } from "@react-types/shared";
import React, { InputHTMLAttributes } from "react";
import { AriaButtonProps } from "@react-types/button";
import { AriaDialogProps } from "@react-types/dialog";
import { CalendarProps, RangeCalendarProps } from "@react-types/calendar";
interface DateFieldProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue'> {
export interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'> {
/** A ref for the hidden input element for HTML form submission. */
inputRef?: RefObject<HTMLInputElement | null>;
}
interface DateFieldAria {
export interface DateFieldAria extends ValidationResult {
/** Props for the field's visible label element, if any. */
labelProps: HTMLAttributes<HTMLElement>;
labelProps: DOMAttributes;
/** Props for the field grouping element. */
fieldProps: HTMLAttributes<HTMLElement>;
fieldProps: GroupDOMAttributes;
/** Props for the hidden input element for HTML form submission. */
inputProps: InputHTMLAttributes<HTMLInputElement>;
/** Props for the description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>;
descriptionProps: DOMAttributes;
/** Props for the error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>;
errorMessageProps: DOMAttributes;
}

@@ -24,3 +29,7 @@ /**

*/
export function useDateField<T extends DateValue>(props: DateFieldProps<T>, state: DateFieldState, ref: RefObject<HTMLElement>): DateFieldAria;
export function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element | null>): DateFieldAria;
interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {
/** A ref for the hidden input element for HTML form submission. */
inputRef?: RefObject<HTMLInputElement | null>;
}
/**

@@ -31,8 +40,8 @@ * Provides the behavior and accessibility implementation for a time field component.

*/
export function useTimeField<T extends TimeValue>(props: AriaTimeFieldProps<T>, state: DateFieldState, ref: RefObject<HTMLElement>): DateFieldAria;
interface DatePickerAria {
export function useTimeField<T extends TimeValue>(props: AriaTimeFieldOptions<T>, state: TimeFieldState, ref: RefObject<Element | null>): DateFieldAria;
export interface DatePickerAria extends ValidationResult {
/** Props for the date picker's visible label element, if any. */
labelProps: HTMLAttributes<HTMLElement>;
labelProps: DOMAttributes;
/** Props for the grouping element containing the date field and button. */
groupProps: HTMLAttributes<HTMLElement>;
groupProps: GroupDOMAttributes;
/** Props for the date field. */

@@ -43,5 +52,5 @@ fieldProps: AriaDatePickerProps<DateValue>;

/** Props for the description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>;
descriptionProps: DOMAttributes;
/** Props for the error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>;
errorMessageProps: DOMAttributes;
/** Props for the popover dialog. */

@@ -56,11 +65,12 @@ dialogProps: AriaDialogProps;

*/
export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>, state: DatePickerState, ref: RefObject<HTMLElement>): DatePickerAria;
type Field = 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'timeZoneName' | 'weekday';
export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>, state: DatePickerState, ref: RefObject<Element | null>): DatePickerAria;
type Field = Intl.DateTimeFormatPartTypes;
interface DisplayNames {
of(field: Field): string;
}
/** @private */
export function useDisplayNames(): DisplayNames;
interface DateSegmentAria {
export interface DateSegmentAria {
/** Props for the segment element. */
segmentProps: HTMLAttributes<HTMLDivElement>;
segmentProps: React.HTMLAttributes<HTMLDivElement>;
}

@@ -72,8 +82,8 @@ /**

*/
export function useDateSegment(segment: DateSegment, state: DateFieldState, ref: RefObject<HTMLElement>): DateSegmentAria;
interface DateRangePickerAria {
export function useDateSegment(segment: DateSegment, state: DateFieldState, ref: RefObject<HTMLElement | null>): DateSegmentAria;
export interface DateRangePickerAria extends ValidationResult {
/** Props for the date range picker's visible label element, if any. */
labelProps: HTMLAttributes<HTMLElement>;
labelProps: DOMAttributes;
/** Props for the grouping element containing the date fields and button. */
groupProps: HTMLAttributes<HTMLElement>;
groupProps: GroupDOMAttributes;
/** Props for the start date field. */

@@ -86,5 +96,5 @@ startFieldProps: AriaDatePickerProps<DateValue>;

/** Props for the description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>;
descriptionProps: DOMAttributes;
/** Props for the error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>;
errorMessageProps: DOMAttributes;
/** Props for the popover dialog. */

@@ -100,4 +110,6 @@ dialogProps: AriaDialogProps;

*/
export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<HTMLElement>): DateRangePickerAria;
export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<Element | null>): DateRangePickerAria;
export type { AriaDateFieldProps, AriaDatePickerProps, AriaDateRangePickerProps, DateRange, DateValue, TimeValue } from '@react-types/datepicker';
export type { AriaTimeFieldProps } from '@react-types/datepicker';
//# sourceMappingURL=types.d.ts.map
{
"name": "@react-aria/datepicker",
"version": "3.0.0-nightly.3180+0bba35ae3",
"version": "3.0.0-nightly-086ad3115-240911",
"description": "Spectrum UI components in React",

@@ -8,2 +8,7 @@ "license": "Apache-2.0",

"module": "dist/module.js",
"exports": {
"types": "./dist/types.d.ts",
"import": "./dist/import.mjs",
"require": "./dist/main.js"
},
"types": "dist/types.d.ts",

@@ -21,21 +26,24 @@ "source": "src/index.ts",

"dependencies": {
"@babel/runtime": "^7.6.2",
"@internationalized/message": "3.0.6-nightly.3180+0bba35ae3",
"@internationalized/number": "3.0.6-nightly.3180+0bba35ae3",
"@react-aria/focus": "3.0.0-nightly.1481+0bba35ae3",
"@react-aria/i18n": "3.0.0-nightly.1481+0bba35ae3",
"@react-aria/interactions": "3.0.0-nightly.1481+0bba35ae3",
"@react-aria/label": "3.0.0-nightly.1481+0bba35ae3",
"@react-aria/spinbutton": "3.0.0-nightly.1481+0bba35ae3",
"@react-aria/utils": "3.0.0-nightly.1481+0bba35ae3",
"@react-stately/datepicker": "3.0.0-nightly.3180+0bba35ae3",
"@react-types/button": "3.4.5-nightly.3180+0bba35ae3",
"@react-types/calendar": "3.0.0-nightly.3180+0bba35ae3",
"@react-types/datepicker": "3.0.0-nightly.3180+0bba35ae3",
"@react-types/dialog": "3.3.5-nightly.3180+0bba35ae3",
"@react-types/shared": "3.0.0-nightly.1481+0bba35ae3"
"@internationalized/date": "^3.0.0-nightly-086ad3115-240911",
"@internationalized/number": "^3.0.0-nightly-086ad3115-240911",
"@internationalized/string": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/focus": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/form": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/i18n": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/interactions": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/label": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/spinbutton": "^3.0.0-nightly-086ad3115-240911",
"@react-aria/utils": "^3.0.0-nightly-086ad3115-240911",
"@react-stately/datepicker": "^3.0.0-nightly-086ad3115-240911",
"@react-stately/form": "^3.0.0-nightly-086ad3115-240911",
"@react-types/button": "^3.0.0-nightly-086ad3115-240911",
"@react-types/calendar": "^3.0.0-nightly-086ad3115-240911",
"@react-types/datepicker": "^3.0.0-nightly-086ad3115-240911",
"@react-types/dialog": "^3.0.0-nightly-086ad3115-240911",
"@react-types/shared": "^3.0.0-nightly-086ad3115-240911",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1",
"react-dom": "^16.8.0 || ^17.0.0-rc.1"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0",
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
},

@@ -45,3 +53,3 @@ "publishConfig": {

},
"gitHead": "0bba35ae36b5d220570385215860d3ca3b549656"
}
"stableVersion": "3.11.2"
}

@@ -17,2 +17,9 @@ /*

export {useDateRangePicker} from './useDateRangePicker';
export * from './useDisplayNames';
export {useDisplayNames} from './useDisplayNames';
export type {AriaDateFieldProps, AriaDatePickerProps, AriaDateRangePickerProps, DateRange, DateValue, TimeValue} from '@react-types/datepicker';
export type {AriaDateFieldOptions, DateFieldAria} from './useDateField';
export type {DatePickerAria} from './useDatePicker';
export type {DateRangePickerAria} from './useDateRangePicker';
export type {DateSegmentAria} from './useDateSegment';
export type {AriaTimeFieldProps} from '@react-types/datepicker';

@@ -13,23 +13,33 @@ /*

import {AriaDatePickerProps, AriaTimeFieldProps, DateValue, TimeValue} from '@react-types/datepicker';
import {AriaDateFieldProps as AriaDateFieldPropsBase, AriaTimeFieldProps, DateValue, TimeValue} from '@react-types/datepicker';
import {createFocusManager, FocusManager} from '@react-aria/focus';
import {DateFieldState} from '@react-stately/datepicker';
import {HTMLAttributes, RefObject, useEffect, useMemo, useRef} from 'react';
import {mergeProps, useDescription} from '@react-aria/utils';
import {DateFieldState, TimeFieldState} from '@react-stately/datepicker';
import {DOMAttributes, GroupDOMAttributes, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';
import {filterDOMProps, mergeProps, useDescription, useFormReset} from '@react-aria/utils';
import {InputHTMLAttributes, useEffect, useMemo, useRef} from 'react';
// @ts-ignore
import intlMessages from '../intl/*.json';
import {useDatePickerGroup} from './useDatePickerGroup';
import {useField} from '@react-aria/label';
import {useFocusWithin} from '@react-aria/interactions';
import {useFormValidation} from '@react-aria/form';
import {useLocalizedStringFormatter} from '@react-aria/i18n';
// Allows this hook to also be used with TimeField
interface DateFieldProps<T extends DateValue> extends Omit<AriaDatePickerProps<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue'> {}
export interface AriaDateFieldOptions<T extends DateValue> extends Omit<AriaDateFieldPropsBase<T>, 'value' | 'defaultValue' | 'onChange' | 'minValue' | 'maxValue' | 'placeholderValue' | 'validate'> {
/** A ref for the hidden input element for HTML form submission. */
inputRef?: RefObject<HTMLInputElement | null>
}
interface DateFieldAria {
export interface DateFieldAria extends ValidationResult {
/** Props for the field's visible label element, if any. */
labelProps: HTMLAttributes<HTMLElement>,
labelProps: DOMAttributes,
/** Props for the field grouping element. */
fieldProps: HTMLAttributes<HTMLElement>,
fieldProps: GroupDOMAttributes,
/** Props for the hidden input element for HTML form submission. */
inputProps: InputHTMLAttributes<HTMLInputElement>,
/** Props for the description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>,
descriptionProps: DOMAttributes,
/** Props for the error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>
errorMessageProps: DOMAttributes
}

@@ -57,17 +67,33 @@

*/
export function useDateField<T extends DateValue>(props: DateFieldProps<T>, state: DateFieldState, ref: RefObject<HTMLElement>): DateFieldAria {
export function useDateField<T extends DateValue>(props: AriaDateFieldOptions<T>, state: DateFieldState, ref: RefObject<Element | null>): DateFieldAria {
let {isInvalid, validationErrors, validationDetails} = state.displayValidation;
let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({
...props,
labelElementType: 'span'
labelElementType: 'span',
isInvalid,
errorMessage: props.errorMessage || validationErrors
});
let groupProps = useDatePickerGroup(state, ref);
let valueOnFocus = useRef<DateValue | null>(null);
let {focusWithinProps} = useFocusWithin({
onBlurWithin() {
...props,
onFocusWithin(e) {
valueOnFocus.current = state.value;
props.onFocus?.(e);
},
onBlurWithin: (e) => {
state.confirmPlaceholder();
}
if (state.value !== valueOnFocus.current) {
state.commitValidation();
}
props.onBlur?.(e);
},
onFocusWithinChange: props.onFocusChange
});
let descProps = useDescription(state.formatValue({month: 'long'}));
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');
let message = state.maxGranularity === 'hour' ? 'selectedTimeDescription' : 'selectedDateDescription';
let field = state.maxGranularity === 'hour' ? 'time' : 'date';
let description = state.value ? stringFormatter.format(message, {[field]: state.formatValue({month: 'long'})}) : '';
let descProps = useDescription(description);

@@ -81,2 +107,3 @@ // If within a date picker or date range picker, the date field will have role="presentation" and an aria-describedby

let focusManager = useMemo(() => propsFocusManager || createFocusManager(ref), [propsFocusManager, ref]);
let groupProps = useDatePickerGroup(state, ref, props[roleSymbol] === 'presentation');

@@ -86,3 +113,3 @@ // Pass labels and other information to segments.

ariaLabel: props['aria-label'],
ariaLabelledBy: [props['aria-labelledby'], labelProps.id].filter(Boolean).join(' ') || undefined,
ariaLabelledBy: [labelProps.id, props['aria-labelledby']].filter(Boolean).join(' ') || undefined,
ariaDescribedBy: describedBy,

@@ -98,3 +125,3 @@ focusManager

// avoids very verbose duplicate announcements.
let fieldDOMProps: HTMLAttributes<HTMLElement>;
let fieldDOMProps: GroupDOMAttributes;
if (props[roleSymbol] === 'presentation') {

@@ -106,3 +133,3 @@ fieldDOMProps = {

fieldDOMProps = mergeProps(fieldProps, {
role: 'group',
role: 'group' as const,
'aria-disabled': props.isDisabled || undefined,

@@ -120,2 +147,28 @@ 'aria-describedby': describedBy

useFormReset(props.inputRef, state.value, state.setValue);
useFormValidation({
...props,
focus() {
focusManager.focusFirst();
}
}, state, props.inputRef);
let inputProps: InputHTMLAttributes<HTMLInputElement> = {
type: 'hidden',
name: props.name,
value: state.value?.toString() || '',
disabled: props.isDisabled
};
if (props.validationBehavior === 'native') {
// Use a hidden <input type="text"> rather than <input type="hidden">
// so that an empty value blocks HTML form submission when the field is required.
inputProps.type = 'text';
inputProps.hidden = true;
inputProps.required = props.isRequired;
// Ignore react warning.
inputProps.onChange = () => {};
}
let domProps = filterDOMProps(props);
return {

@@ -128,8 +181,28 @@ labelProps: {

},
fieldProps: mergeProps(fieldDOMProps, groupProps, focusWithinProps),
fieldProps: mergeProps(domProps, fieldDOMProps, groupProps, focusWithinProps, {
onKeyDown(e: KeyboardEvent) {
if (props.onKeyDown) {
props.onKeyDown(e);
}
},
onKeyUp(e: KeyboardEvent) {
if (props.onKeyUp) {
props.onKeyUp(e);
}
}
}),
inputProps,
descriptionProps,
errorMessageProps
errorMessageProps,
isInvalid,
validationErrors,
validationDetails
};
}
export interface AriaTimeFieldOptions<T extends TimeValue> extends AriaTimeFieldProps<T> {
/** A ref for the hidden input element for HTML form submission. */
inputRef?: RefObject<HTMLInputElement | null>
}
/**

@@ -140,4 +213,6 @@ * Provides the behavior and accessibility implementation for a time field component.

*/
export function useTimeField<T extends TimeValue>(props: AriaTimeFieldProps<T>, state: DateFieldState, ref: RefObject<HTMLElement>): DateFieldAria {
return useDateField(props, state, ref);
export function useTimeField<T extends TimeValue>(props: AriaTimeFieldOptions<T>, state: TimeFieldState, ref: RefObject<Element | null>): DateFieldAria {
let res = useDateField(props, state, ref);
res.inputProps.value = state.timeValue?.toString() || '';
return res;
}

@@ -19,16 +19,19 @@ /*

import {DatePickerState} from '@react-stately/datepicker';
import {HTMLAttributes, RefObject} from 'react';
import {DOMAttributes, GroupDOMAttributes, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';
import {filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';
// @ts-ignore
import intlMessages from '../intl/*.json';
import {mergeProps, useDescription, useId} from '@react-aria/utils';
import {privateValidationStateProp} from '@react-stately/form';
import {roleSymbol} from './useDateField';
import {useDatePickerGroup} from './useDatePickerGroup';
import {useField} from '@react-aria/label';
import {useLocale, useMessageFormatter} from '@react-aria/i18n';
import {useFocusWithin} from '@react-aria/interactions';
import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
import {useMemo} from 'react';
interface DatePickerAria {
export interface DatePickerAria extends ValidationResult {
/** Props for the date picker's visible label element, if any. */
labelProps: HTMLAttributes<HTMLElement>,
labelProps: DOMAttributes,
/** Props for the grouping element containing the date field and button. */
groupProps: HTMLAttributes<HTMLElement>,
groupProps: GroupDOMAttributes,
/** Props for the date field. */

@@ -39,5 +42,5 @@ fieldProps: AriaDatePickerProps<DateValue>,

/** Props for the description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>,
descriptionProps: DOMAttributes,
/** Props for the error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>,
errorMessageProps: DOMAttributes,
/** Props for the popover dialog. */

@@ -53,10 +56,14 @@ dialogProps: AriaDialogProps,

*/
export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>, state: DatePickerState, ref: RefObject<HTMLElement>): DatePickerAria {
export function useDatePicker<T extends DateValue>(props: AriaDatePickerProps<T>, state: DatePickerState, ref: RefObject<Element | null>): DatePickerAria {
let buttonId = useId();
let dialogId = useId();
let formatMessage = useMessageFormatter(intlMessages);
let fieldId = useId();
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');
let {isInvalid, validationErrors, validationDetails} = state.displayValidation;
let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({
...props,
labelElementType: 'span'
labelElementType: 'span',
isInvalid,
errorMessage: props.errorMessage || validationErrors
});

@@ -69,11 +76,41 @@

let {locale} = useLocale();
let descProps = useDescription(state.formatValue(locale, {month: 'long'}));
let date = state.formatValue(locale, {month: 'long'});
let description = date ? stringFormatter.format('selectedDateDescription', {date}) : '';
let descProps = useDescription(description);
let ariaDescribedBy = [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;
let domProps = filterDOMProps(props);
let focusManager = useMemo(() => createFocusManager(ref), [ref]);
let {focusWithinProps} = useFocusWithin({
...props,
isDisabled: state.isOpen,
onBlurWithin: props.onBlur,
onFocusWithin: props.onFocus,
onFocusWithinChange: props.onFocusChange
});
return {
groupProps: mergeProps(groupProps, fieldProps, descProps, {
role: 'group',
groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
role: 'group' as const,
'aria-disabled': props.isDisabled || null,
'aria-labelledby': labelledBy,
'aria-describedby': ariaDescribedBy
'aria-describedby': ariaDescribedBy,
onKeyDown(e: KeyboardEvent) {
if (state.isOpen) {
return;
}
if (props.onKeyDown) {
props.onKeyDown(e);
}
},
onKeyUp(e: KeyboardEvent) {
if (state.isOpen) {
return;
}
if (props.onKeyUp) {
props.onKeyUp(e);
}
}
}),

@@ -83,3 +120,2 @@ labelProps: {

onClick: () => {
let focusManager = createFocusManager(ref);
focusManager.focusFirst();

@@ -90,2 +126,3 @@ }

...fieldProps,
id: fieldId,
[roleSymbol]: 'presentation',

@@ -95,7 +132,6 @@ 'aria-describedby': ariaDescribedBy,

onChange: state.setValue,
minValue: props.minValue,
maxValue: props.maxValue,
placeholderValue: props.placeholderValue,
hideTimeZone: props.hideTimeZone,
hourCycle: props.hourCycle,
shouldForceLeadingZeros: props.shouldForceLeadingZeros,
granularity: props.granularity,

@@ -105,4 +141,7 @@ isDisabled: props.isDisabled,

isRequired: props.isRequired,
validationState: state.validationState,
autoFocus: props.autoFocus
validationBehavior: props.validationBehavior,
// DatePicker owns the validation state for the date field.
[privateValidationStateProp]: state,
autoFocus: props.autoFocus,
name: props.name
},

@@ -114,7 +153,8 @@ descriptionProps,

id: buttonId,
excludeFromTabOrder: true,
'aria-haspopup': 'dialog',
'aria-label': formatMessage('calendar'),
'aria-labelledby': `${labelledBy} ${buttonId}`,
'aria-label': stringFormatter.format('calendar'),
'aria-labelledby': `${buttonId} ${labelledBy}`,
'aria-describedby': ariaDescribedBy,
'aria-expanded': state.isOpen,
isDisabled: props.isDisabled || props.isReadOnly,
onPress: () => state.setOpen(true)

@@ -124,3 +164,3 @@ },

id: dialogId,
'aria-labelledby': `${labelledBy} ${buttonId}`
'aria-labelledby': `${buttonId} ${labelledBy}`
},

@@ -136,5 +176,10 @@ calendarProps: {

isDateUnavailable: props.isDateUnavailable,
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue
}
defaultFocusedValue: state.dateValue ? undefined : props.placeholderValue,
isInvalid: state.isInvalid,
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : (props.errorMessage || state.displayValidation.validationErrors.join(' '))
},
isInvalid,
validationErrors,
validationDetails
};
}

@@ -0,11 +1,19 @@

import {createFocusManager, getFocusableTreeWalker} from '@react-aria/focus';
import {DateFieldState, DatePickerState, DateRangePickerState} from '@react-stately/datepicker';
import {getFocusableTreeWalker} from '@react-aria/focus';
import {KeyboardEvent} from '@react-types/shared';
import {FocusableElement, KeyboardEvent, RefObject} from '@react-types/shared';
import {mergeProps} from '@react-aria/utils';
import {RefObject} from 'react';
import {useLocale} from '@react-aria/i18n';
import {useMemo} from 'react';
import {usePress} from '@react-aria/interactions';
export function useDatePickerGroup(state: DatePickerState | DateRangePickerState | DateFieldState, ref: RefObject<HTMLElement>) {
export function useDatePickerGroup(state: DatePickerState | DateRangePickerState | DateFieldState, ref: RefObject<Element | null>, disableArrowNavigation?: boolean) {
let {direction} = useLocale();
let focusManager = useMemo(() => createFocusManager(ref), [ref]);
// Open the popover on alt + arrow down
let onKeyDown = (e: KeyboardEvent) => {
if (!e.currentTarget.contains(e.target)) {
return;
}
if (e.altKey && (e.key === 'ArrowDown' || e.key === 'ArrowUp') && 'setOpen' in state) {

@@ -16,2 +24,27 @@ e.preventDefault();

}
if (disableArrowNavigation) {
return;
}
switch (e.key) {
case 'ArrowLeft':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') {
focusManager.focusNext();
} else {
focusManager.focusPrevious();
}
break;
case 'ArrowRight':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') {
focusManager.focusPrevious();
} else {
focusManager.focusNext();
}
break;
}
};

@@ -22,7 +55,7 @@

// Try to find the segment prior to the element that was clicked on.
let target = window.event?.target as HTMLElement;
let target = window.event?.target as FocusableElement;
let walker = getFocusableTreeWalker(ref.current, {tabbable: true});
if (target) {
walker.currentNode = target;
target = walker.previousNode() as HTMLElement;
target = walker.previousNode() as FocusableElement;
}

@@ -32,5 +65,5 @@

if (!target) {
let last: HTMLElement;
let last: FocusableElement;
do {
last = walker.lastChild() as HTMLElement;
last = walker.lastChild() as FocusableElement;
if (last) {

@@ -43,5 +76,5 @@ target = last;

// Now go backwards until we find an element that is not a placeholder.
while (target?.getAttribute('aria-placeholder')) {
let prev = walker.previousNode() as HTMLElement;
if (prev && prev.getAttribute('aria-placeholder')) {
while (target?.hasAttribute('data-placeholder')) {
let prev = walker.previousNode() as FocusableElement;
if (prev && prev.hasAttribute('data-placeholder')) {
target = prev;

@@ -59,2 +92,4 @@ } else {

let {pressProps} = usePress({
preventFocusOnPress: true,
allowTextSelectionOnPress: true,
onPressStart(e) {

@@ -61,0 +96,0 @@ if (e.pointerType === 'mouse') {

@@ -18,7 +18,8 @@ /*

import {DateRangePickerState} from '@react-stately/datepicker';
import {DEFAULT_VALIDATION_RESULT, mergeValidation, privateValidationStateProp} from '@react-stately/form';
import {DOMAttributes, GroupDOMAttributes, KeyboardEvent, RefObject, ValidationResult} from '@react-types/shared';
import {filterDOMProps, mergeProps, useDescription, useId} from '@react-aria/utils';
import {focusManagerSymbol, roleSymbol} from './useDateField';
import {HTMLAttributes, RefObject, useMemo} from 'react';
// @ts-ignore
import intlMessages from '../intl/*.json';
import {mergeProps, useDescription, useId} from '@react-aria/utils';
import {RangeCalendarProps} from '@react-types/calendar';

@@ -28,9 +29,10 @@ import {useDatePickerGroup} from './useDatePickerGroup';

import {useFocusWithin} from '@react-aria/interactions';
import {useLocale, useMessageFormatter} from '@react-aria/i18n';
import {useLocale, useLocalizedStringFormatter} from '@react-aria/i18n';
import {useMemo, useRef} from 'react';
interface DateRangePickerAria {
export interface DateRangePickerAria extends ValidationResult {
/** Props for the date range picker's visible label element, if any. */
labelProps: HTMLAttributes<HTMLElement>,
labelProps: DOMAttributes,
/** Props for the grouping element containing the date fields and button. */
groupProps: HTMLAttributes<HTMLElement>,
groupProps: GroupDOMAttributes,
/** Props for the start date field. */

@@ -43,5 +45,5 @@ startFieldProps: AriaDatePickerProps<DateValue>,

/** Props for the description element, if any. */
descriptionProps: HTMLAttributes<HTMLElement>,
descriptionProps: DOMAttributes,
/** Props for the error message element, if any. */
errorMessageProps: HTMLAttributes<HTMLElement>,
errorMessageProps: DOMAttributes,
/** Props for the popover dialog. */

@@ -58,7 +60,10 @@ dialogProps: AriaDialogProps,

*/
export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<HTMLElement>): DateRangePickerAria {
let formatMessage = useMessageFormatter(intlMessages);
export function useDateRangePicker<T extends DateValue>(props: AriaDateRangePickerProps<T>, state: DateRangePickerState, ref: RefObject<Element | null>): DateRangePickerAria {
let stringFormatter = useLocalizedStringFormatter(intlMessages, '@react-aria/datepicker');
let {isInvalid, validationErrors, validationDetails} = state.displayValidation;
let {labelProps, fieldProps, descriptionProps, errorMessageProps} = useField({
...props,
labelElementType: 'span'
labelElementType: 'span',
isInvalid,
errorMessage: props.errorMessage || validationErrors
});

@@ -69,7 +74,8 @@

let {locale} = useLocale();
let description = state.formatValue(locale, {month: 'long'});
let range = state.formatValue(locale, {month: 'long'});
let description = range ? stringFormatter.format('selectedRangeDescription', {startDate: range.start, endDate: range.end}) : '';
let descProps = useDescription(description);
let startFieldProps = {
'aria-label': formatMessage('startDate'),
'aria-label': stringFormatter.format('startDate'),
'aria-labelledby': labelledBy

@@ -79,3 +85,3 @@ };

let endFieldProps = {
'aria-label': formatMessage('endDate'),
'aria-label': stringFormatter.format('endDate'),
'aria-labelledby': labelledBy

@@ -88,10 +94,9 @@ };

let groupProps = useDatePickerGroup(state, ref);
let {focusWithinProps} = useFocusWithin({
onBlurWithin() {
state.confirmPlaceholder();
}
});
let ariaDescribedBy = [descProps['aria-describedby'], fieldProps['aria-describedby']].filter(Boolean).join(' ') || undefined;
let focusManager = useMemo(() => createFocusManager(ref), [ref]);
let focusManager = useMemo(() => createFocusManager(ref, {
// Exclude the button from the focus manager.
accept: element => element.id !== buttonId
}), [ref, buttonId]);
let commonFieldProps = {

@@ -101,4 +106,2 @@ [focusManagerSymbol]: focusManager,

'aria-describedby': ariaDescribedBy,
minValue: props.minValue,
maxValue: props.maxValue,
placeholderValue: props.placeholderValue,

@@ -108,13 +111,45 @@ hideTimeZone: props.hideTimeZone,

granularity: props.granularity,
shouldForceLeadingZeros: props.shouldForceLeadingZeros,
isDisabled: props.isDisabled,
isReadOnly: props.isReadOnly,
isRequired: props.isRequired,
validationState: state.validationState
validationBehavior: props.validationBehavior
};
let domProps = filterDOMProps(props);
let {focusWithinProps} = useFocusWithin({
...props,
isDisabled: state.isOpen,
onBlurWithin: props.onBlur,
onFocusWithin: props.onFocus,
onFocusWithinChange: props.onFocusChange
});
let startFieldValidation = useRef(DEFAULT_VALIDATION_RESULT);
let endFieldValidation = useRef(DEFAULT_VALIDATION_RESULT);
return {
groupProps: mergeProps(groupProps, fieldProps, descProps, focusWithinProps, {
role: 'group',
groupProps: mergeProps(domProps, groupProps, fieldProps, descProps, focusWithinProps, {
role: 'group' as const,
'aria-disabled': props.isDisabled || null,
'aria-describedby': ariaDescribedBy
'aria-describedby': ariaDescribedBy,
onKeyDown(e: KeyboardEvent) {
if (state.isOpen) {
return;
}
if (props.onKeyDown) {
props.onKeyDown(e);
}
},
onKeyUp(e: KeyboardEvent) {
if (state.isOpen) {
return;
}
if (props.onKeyUp) {
props.onKeyUp(e);
}
}
}),

@@ -130,7 +165,8 @@ labelProps: {

id: buttonId,
excludeFromTabOrder: true,
'aria-haspopup': 'dialog',
'aria-label': formatMessage('calendar'),
'aria-labelledby': `${labelledBy} ${buttonId}`,
'aria-label': stringFormatter.format('calendar'),
'aria-labelledby': `${buttonId} ${labelledBy}`,
'aria-describedby': ariaDescribedBy,
'aria-expanded': state.isOpen,
isDisabled: props.isDisabled || props.isReadOnly,
onPress: () => state.setOpen(true)

@@ -140,3 +176,3 @@ },

id: dialogId,
'aria-labelledby': `${labelledBy} ${buttonId}`
'aria-labelledby': `${buttonId} ${labelledBy}`
},

@@ -148,3 +184,14 @@ startFieldProps: {

onChange: start => state.setDateTime('start', start),
autoFocus: props.autoFocus
autoFocus: props.autoFocus,
name: props.startName,
[privateValidationStateProp]: {
realtimeValidation: state.realtimeValidation,
displayValidation: state.displayValidation,
updateValidation(e) {
startFieldValidation.current = e;
state.updateValidation(mergeValidation(e, endFieldValidation.current));
},
resetValidation: state.resetValidation,
commitValidation: state.commitValidation
}
},

@@ -155,3 +202,14 @@ endFieldProps: {

value: state.value?.end,
onChange: end => state.setDateTime('end', end)
onChange: end => state.setDateTime('end', end),
name: props.endName,
[privateValidationStateProp]: {
realtimeValidation: state.realtimeValidation,
displayValidation: state.displayValidation,
updateValidation(e) {
endFieldValidation.current = e;
state.updateValidation(mergeValidation(startFieldValidation.current, e));
},
resetValidation: state.resetValidation,
commitValidation: state.commitValidation
}
},

@@ -170,5 +228,10 @@ descriptionProps,

allowsNonContiguousRanges: props.allowsNonContiguousRanges,
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue
}
defaultFocusedValue: state.dateRange ? undefined : props.placeholderValue,
isInvalid: state.isInvalid,
errorMessage: typeof props.errorMessage === 'function' ? props.errorMessage(state.displayValidation) : (props.errorMessage || state.displayValidation.validationErrors.join(' '))
},
isInvalid,
validationErrors,
validationDetails
};
}

@@ -13,15 +13,16 @@ /*

import {CalendarDate, toCalendar} from '@internationalized/date';
import {DateFieldState, DateSegment} from '@react-stately/datepicker';
import {getScrollParent, isIOS, isMac, mergeProps, scrollIntoView, useEvent, useId, useLabels} from '@react-aria/utils';
import {getScrollParent, isIOS, isMac, mergeProps, scrollIntoViewport, useEvent, useId, useLabels, useLayoutEffect} from '@react-aria/utils';
import {hookData} from './useDateField';
import {NumberParser} from '@internationalized/number';
import React, {HTMLAttributes, RefObject, useMemo, useRef} from 'react';
import React, {useMemo, useRef} from 'react';
import {RefObject} from '@react-types/shared';
import {useDateFormatter, useFilter, useLocale} from '@react-aria/i18n';
import {useDisplayNames} from './useDisplayNames';
import {usePress} from '@react-aria/interactions';
import {useSpinButton} from '@react-aria/spinbutton';
interface DateSegmentAria {
export interface DateSegmentAria {
/** Props for the segment element. */
segmentProps: HTMLAttributes<HTMLDivElement>
segmentProps: React.HTMLAttributes<HTMLDivElement>
}

@@ -34,9 +35,9 @@

*/
export function useDateSegment(segment: DateSegment, state: DateFieldState, ref: RefObject<HTMLElement>): DateSegmentAria {
export function useDateSegment(segment: DateSegment, state: DateFieldState, ref: RefObject<HTMLElement | null>): DateSegmentAria {
let enteredKeys = useRef('');
let {locale, direction} = useLocale();
let {locale} = useLocale();
let displayNames = useDisplayNames();
let {ariaLabel, ariaLabelledBy, ariaDescribedBy, focusManager} = hookData.get(state);
let textValue = segment.text;
let textValue = segment.isPlaceholder ? '' : segment.text;
let options = useMemo(() => state.dateFormatter.resolvedOptions(), [state.dateFormatter]);

@@ -50,6 +51,6 @@ let monthDateFormatter = useDateFormatter({month: 'long', timeZone: options.timeZone});

if (segment.type === 'month') {
if (segment.type === 'month' && !segment.isPlaceholder) {
let monthTextValue = monthDateFormatter.format(state.dateValue);
textValue = monthTextValue !== textValue ? `${textValue} – ${monthTextValue}` : monthTextValue;
} else if (segment.type === 'hour') {
} else if (segment.type === 'hour' && !segment.isPlaceholder) {
textValue = hourDateFormatter.format(state.dateValue);

@@ -59,2 +60,5 @@ }

let {spinButtonProps} = useSpinButton({
// The ARIA spec says aria-valuenow is optional if there's no value, but aXe seems to require it.
// This doesn't seem to have any negative effects with real AT since we also use aria-valuetext.
// https://github.com/dequelabs/axe-core/issues/3505
value: segment.value,

@@ -96,5 +100,9 @@ textValue,

let backspace = () => {
if (segment.text === segment.placeholder) {
focusManager.focusPrevious();
}
if (parser.isValidPartialNumber(segment.text) && !state.isReadOnly && !segment.isPlaceholder) {
let newValue = segment.text.slice(0, -1);
let parsed = parser.parse(newValue);
newValue = parsed === 0 ? '' : newValue;
if (newValue.length === 0 || parsed === 0) {

@@ -123,30 +131,2 @@ state.clearSegment(segment.type);

switch (e.key) {
case 'ArrowLeft':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') {
focusManager.focusNext({tabbable: true});
} else {
focusManager.focusPrevious({tabbable: true});
}
break;
case 'ArrowRight':
e.preventDefault();
e.stopPropagation();
if (direction === 'rtl') {
focusManager.focusPrevious({tabbable: true});
} else {
focusManager.focusNext({tabbable: true});
}
break;
case 'Enter':
e.preventDefault();
e.stopPropagation();
if (segment.isPlaceholder && !state.isReadOnly) {
state.confirmPlaceholder(segment.type);
}
focusManager.focusNext({tabbable: true});
break;
case 'Tab':
break;
case 'Backspace':

@@ -178,2 +158,30 @@ case 'Delete': {

// Get a list of formatted era names so users can type the first character to choose one.
let eraFormatter = useDateFormatter({year: 'numeric', era: 'narrow', timeZone: 'UTC'});
let eras = useMemo(() => {
if (segment.type !== 'era') {
return [];
}
let date = toCalendar(new CalendarDate(1, 1, 1), state.calendar);
let eras = state.calendar.getEras().map(era => {
let eraDate = date.set({year: 1, month: 1, day: 1, era}).toDate('UTC');
let parts = eraFormatter.formatToParts(eraDate);
let formatted = parts.find(p => p.type === 'era').value;
return {era, formatted};
});
// Remove the common prefix from formatted values. This is so that in calendars with eras like
// ERA0 and ERA1 (e.g. Ethiopic), users can press "0" and "1" to select an era. In other cases,
// the first letter is used.
let prefixLength = commonPrefixLength(eras.map(era => era.formatted));
if (prefixLength) {
for (let era of eras) {
era.formatted = era.formatted.slice(prefixLength);
}
}
return eras;
}, [eraFormatter, state.calendar, segment.type]);
let onInput = (key: string) => {

@@ -195,4 +203,12 @@ if (state.isDisabled || state.isReadOnly) {

}
focusManager.focusNext({tabbable: true});
focusManager.focusNext();
break;
case 'era': {
let matched = eras.find(e => startsWith(e.formatted, key));
if (matched) {
state.setSegment('era', matched.era);
focusManager.focusNext();
}
break;
}
case 'day':

@@ -245,3 +261,3 @@ case 'hour':

if (shouldSetValue) {
focusManager.focusNext({tabbable: true});
focusManager.focusNext();
}

@@ -258,12 +274,20 @@ } else {

enteredKeys.current = '';
scrollIntoView(getScrollParent(ref.current) as HTMLElement, ref.current);
scrollIntoViewport(ref.current, {containingElement: getScrollParent(ref.current)});
// Safari requires that a selection is set or it won't fire input events.
// Since usePress disables text selection, this won't happen by default.
ref.current.style.webkitUserSelect = 'text';
// Collapse selection to start or Chrome won't fire input events.
let selection = window.getSelection();
selection.collapse(ref.current);
ref.current.style.webkitUserSelect = '';
};
let documentRef = useRef(typeof document !== 'undefined' ? document : null);
useEvent(documentRef, 'selectionchange', () => {
// Enforce that the selection is collapsed when inside a date segment.
// Otherwise, when tapping on a segment in Android Chrome and then entering text,
// composition events will be fired that break the DOM structure and crash the page.
let selection = window.getSelection();
if (ref.current.contains(selection.anchorNode)) {
selection.collapse(ref.current);
}
});
let compositionRef = useRef('');

@@ -314,23 +338,15 @@ // @ts-ignore - TODO: possibly old TS version? doesn't fail in my editor...

// Focus on mouse down/touch up to match native textfield behavior.
// usePress handles canceling text selection.
let {pressProps} = usePress({
preventFocusOnPress: true,
onPressStart: (e) => {
if (e.pointerType === 'mouse') {
e.target.focus();
useLayoutEffect(() => {
let element = ref.current;
return () => {
// If the focused segment is removed, focus the previous one, or the next one if there was no previous one.
if (document.activeElement === element) {
let prev = focusManager.focusPrevious();
if (!prev) {
focusManager.focusNext();
}
}
},
onPress(e) {
if (e.pointerType !== 'mouse') {
e.target.focus();
}
}
});
};
}, [ref, focusManager]);
// For Android: prevent selection on long press.
useEvent(ref, 'selectstart', e => {
e.preventDefault();
});
// spinbuttons cannot be focused with VoiceOver on iOS.

@@ -348,3 +364,3 @@ let touchPropOverrides = isIOS() || segment.type === 'timeZoneName' ? {

let firstSegment = useMemo(() => state.segments.find(s => s.isEditable), [state.segments]);
if (segment !== firstSegment && state.validationState !== 'invalid') {
if (segment !== firstSegment && !state.isInvalid) {
ariaDescribedBy = undefined;

@@ -360,3 +376,3 @@ }

let labelProps = useLabels({
'aria-label': (ariaLabel ? ariaLabel + ' ' : '') + name,
'aria-label': `${name}${ariaLabel ? `, ${ariaLabel}` : ''}${ariaLabelledBy ? ', ' : ''}`,
'aria-labelledby': ariaLabelledBy

@@ -376,17 +392,16 @@ });

return {
segmentProps: mergeProps(spinButtonProps, pressProps, labelProps, {
segmentProps: mergeProps(spinButtonProps, labelProps, {
id,
...touchPropOverrides,
'aria-invalid': state.validationState === 'invalid' ? 'true' : undefined,
'aria-invalid': state.isInvalid ? 'true' : undefined,
'aria-describedby': ariaDescribedBy,
'aria-placeholder': segment.isPlaceholder ? segment.text : undefined,
'aria-readonly': state.isReadOnly || !segment.isEditable ? 'true' : undefined,
'data-placeholder': segment.isPlaceholder || undefined,
contentEditable: isEditable,
suppressContentEditableWarning: isEditable,
spellCheck: isEditable ? 'false' : undefined,
autoCapitalize: isEditable ? 'off' : undefined,
autoCorrect: isEditable ? 'off' : undefined,
// Capitalization was changed in React 17...
[parseInt(React.version, 10) >= 17 ? 'enterKeyHint' : 'enterkeyhint']: isEditable ? 'next' : undefined,
inputMode: state.isDisabled || segment.type === 'dayPeriod' || !isEditable ? undefined : 'numeric',
inputMode: state.isDisabled || segment.type === 'dayPeriod' || segment.type === 'era' || !isEditable ? undefined : 'numeric',
tabIndex: state.isDisabled ? undefined : 0,

@@ -397,2 +412,9 @@ onKeyDown,

caretColor: 'transparent'
},
// Prevent pointer events from reaching useDatePickerGroup, and allow native browser behavior to focus the segment.
onPointerDown(e) {
e.stopPropagation();
},
onMouseDown(e) {
e.stopPropagation();
}

@@ -402,1 +424,14 @@ })

}
function commonPrefixLength(strings: string[]): number {
// Sort the strings, and compare the characters in the first and last to find the common prefix.
strings.sort();
let first = strings[0];
let last = strings[strings.length - 1];
for (let i = 0; i < first.length; i++) {
if (first[i] !== last[i]) {
return i;
}
}
return 0;
}

@@ -15,7 +15,7 @@ /*

import intlMessages from '../intl/*.json';
import {MessageDictionary} from '@internationalized/message';
import {useLocale} from '@react-aria/i18n';
import {LocalizedStringDictionary} from '@internationalized/string';
import {useLocale, useLocalizedStringDictionary} from '@react-aria/i18n';
import {useMemo} from 'react';
type Field = 'era' | 'year' | 'month' | 'day' | 'hour' | 'minute' | 'second' | 'dayPeriod' | 'timeZoneName' | 'weekday';
type Field = Intl.DateTimeFormatPartTypes;
interface DisplayNames {

@@ -25,4 +25,6 @@ of(field: Field): string

/** @private */
export function useDisplayNames(): DisplayNames {
let {locale} = useLocale();
let dictionary = useLocalizedStringDictionary(intlMessages, '@react-aria/datepicker');
return useMemo(() => {

@@ -35,5 +37,5 @@ // Try to use Intl.DisplayNames if possible. It may be supported in browsers, but not support the dateTimeField

} catch (err) {
return new DisplayNamesPolyfill(locale);
return new DisplayNamesPolyfill(locale, dictionary);
}
}, [locale]);
}, [locale, dictionary]);
}

@@ -43,7 +45,7 @@

private locale: string;
private dictionary: MessageDictionary;
private dictionary: LocalizedStringDictionary<Field, string>;
constructor(locale: string) {
constructor(locale: string, dictionary: LocalizedStringDictionary<Field, string>) {
this.locale = locale;
this.dictionary = new MessageDictionary(intlMessages);
this.dictionary = dictionary;
}

@@ -50,0 +52,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc