@chekinapp/ui 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +506 -377
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -34
- package/dist/index.d.ts +34 -34
- package/dist/index.js +508 -379
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -5461,7 +5461,6 @@ var translation_default = {
|
|
|
5461
5461
|
close_other_application_that_may_be_using_your_camera: "\u0417\u0430\u0442\u0432\u0430\u0440\u044F\u043D\u0435 \u043D\u0430 \u0434\u0440\u0443\u0433\u0438 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F, \u043A\u043E\u0438\u0442\u043E \u043C\u043E\u0436\u0435 \u0434\u0430 \u0438\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u0442 \u043A\u0430\u043C\u0435\u0440\u0430\u0442\u0430",
|
|
5462
5462
|
if_you_use_external_camera_disconnect_and_reconnect: "\u0410\u043A\u043E \u0438\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u0442\u0435 \u0432\u044A\u043D\u0448\u043D\u0430 \u043A\u0430\u043C\u0435\u0440\u0430, \u0438\u0437\u043A\u043B\u044E\u0447\u0435\u0442\u0435 \u044F \u0438 \u044F \u0441\u0432\u044A\u0440\u0436\u0435\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E",
|
|
5463
5463
|
close_the_browser_re_open_it: "\u0417\u0430\u0442\u0432\u043E\u0440\u0435\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u044A\u0440\u0430 \u0438 \u0433\u043E \u043E\u0442\u0432\u043E\u0440\u0435\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E",
|
|
5464
|
-
camera_permissions_denied: "\u041A\u0430\u043C\u0435\u0440\u0430\u0442\u0430 \u043D\u0435 \u0441\u0435 \u043E\u0442\u0432\u0430\u0440\u044F? \u0423\u0432\u0435\u0440\u0435\u0442\u0435 \u0441\u0435, \u0447\u0435 \u0441\u0442\u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043B\u0438 \u043D\u0430 \u0431\u0440\u0430\u0443\u0437\u044A\u0440\u0430 \u0434\u0430 \u0438\u0437\u043F\u043E\u043B\u0437\u0432\u0430 \u043A\u0430\u043C\u0435\u0440\u0430\u0442\u0430.",
|
|
5465
5464
|
camera_errors: {
|
|
5466
5465
|
experiencing_camera_issues: "\u0418\u043C\u0430\u0442\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0438 \u0441 \u043A\u0430\u043C\u0435\u0440\u0430\u0442\u0430?",
|
|
5467
5466
|
chekin_cant_use_your_camera: "Chekin \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0438\u0437\u043F\u043E\u043B\u0437\u0432\u0430 \u0432\u0430\u0448\u0430\u0442\u0430 \u043A\u0430\u043C\u0435\u0440\u0430",
|
|
@@ -5485,7 +5484,8 @@ var translation_default = {
|
|
|
5485
5484
|
hide_password: "\u0421\u043A\u0440\u0438\u0432\u0430\u043D\u0435 \u043D\u0430 \u043F\u0430\u0440\u043E\u043B\u0430\u0442\u0430",
|
|
5486
5485
|
increment: "\u0423\u0432\u0435\u043B\u0438\u0447\u0430\u0432\u0430\u043D\u0435 \u043D\u0430",
|
|
5487
5486
|
decrement: "\u041D\u0430\u043C\u0430\u043B\u0435\u043D\u0438\u0435",
|
|
5488
|
-
create_option: '\u0421\u044A\u0437\u0434\u0430\u0432\u0430\u043D\u0435 \u043D\u0430 "{{input}}"'
|
|
5487
|
+
create_option: '\u0421\u044A\u0437\u0434\u0430\u0432\u0430\u043D\u0435 \u043D\u0430 "{{input}}"',
|
|
5488
|
+
year_out_of_range: "\u0413\u043E\u0434\u0438\u043D\u0430\u0442\u0430 \u0442\u0440\u044F\u0431\u0432\u0430 \u0434\u0430 \u0435 \u043C\u0435\u0436\u0434\u0443 {{min}} \u0438 {{max}}"
|
|
5489
5489
|
};
|
|
5490
5490
|
|
|
5491
5491
|
// src/locales/ca/translation.json
|
|
@@ -5593,7 +5593,6 @@ var translation_default3 = {
|
|
|
5593
5593
|
close_other_application_that_may_be_using_your_camera: "Zav\u0159en\xED dal\u0161\xEDch aplikac\xED, kter\xE9 mohou pou\u017E\xEDvat fotoapar\xE1t",
|
|
5594
5594
|
if_you_use_external_camera_disconnect_and_reconnect: "Pokud pou\u017E\xEDv\xE1te extern\xED kameru, odpojte ji a znovu p\u0159ipojte.",
|
|
5595
5595
|
close_the_browser_re_open_it: "Zav\u0159ete prohl\xED\u017Ee\u010D a znovu jej otev\u0159ete",
|
|
5596
|
-
camera_permissions_denied: "Fotoapar\xE1t se neotev\u0159e? Ujist\u011Bte se, \u017Ee jste prohl\xED\u017Ee\u010Di povolili pou\u017E\xEDvat kameru.",
|
|
5597
5596
|
camera_errors: {
|
|
5598
5597
|
experiencing_camera_issues: "M\xE1te probl\xE9my s fotoapar\xE1tem?",
|
|
5599
5598
|
chekin_cant_use_your_camera: "Chekin nem\u016F\u017Ee pou\u017E\xEDvat v\xE1\u0161 fotoapar\xE1t",
|
|
@@ -5617,7 +5616,8 @@ var translation_default3 = {
|
|
|
5617
5616
|
hide_password: "Skr\xFDt heslo",
|
|
5618
5617
|
increment: "P\u0159\xEDr\u016Fstek",
|
|
5619
5618
|
decrement: "Sn\xED\u017Een\xED",
|
|
5620
|
-
create_option: 'Vytvo\u0159it "{{input}}"'
|
|
5619
|
+
create_option: 'Vytvo\u0159it "{{input}}"',
|
|
5620
|
+
year_out_of_range: "Rok mus\xED b\xFDt mezi {{min}} a {{max}}."
|
|
5621
5621
|
};
|
|
5622
5622
|
|
|
5623
5623
|
// src/locales/de/translation.json
|
|
@@ -5722,7 +5722,6 @@ var translation_default4 = {
|
|
|
5722
5722
|
close_other_application_that_may_be_using_your_camera: "Schlie\xDFen Sie andere Anwendungen, die m\xF6glicherweise Ihre Kamera verwenden",
|
|
5723
5723
|
if_you_use_external_camera_disconnect_and_reconnect: "Wenn Sie eine externe Kamera verwenden, trennen Sie sie ab und schlie\xDFen Sie sie wieder an.",
|
|
5724
5724
|
close_the_browser_re_open_it: "Schlie\xDFen Sie den Browser und \xF6ffnen Sie ihn erneut",
|
|
5725
|
-
camera_permissions_denied: "Die Kamera l\xE4sst sich nicht \xF6ffnen? Stellen Sie sicher, dass Sie dem Browser die Verwendung der Kamera erlauben.",
|
|
5726
5725
|
camera_errors: {
|
|
5727
5726
|
experiencing_camera_issues: "Haben Sie Probleme mit der Kamera?",
|
|
5728
5727
|
chekin_cant_use_your_camera: "Chekin kann deine Kamera nicht benutzen",
|
|
@@ -5746,7 +5745,8 @@ var translation_default4 = {
|
|
|
5746
5745
|
hide_password: "Passwort verstecken",
|
|
5747
5746
|
increment: "Inkrement",
|
|
5748
5747
|
decrement: "Verkleinern",
|
|
5749
|
-
create_option: 'Erstellen Sie "{{input}}".'
|
|
5748
|
+
create_option: 'Erstellen Sie "{{input}}".',
|
|
5749
|
+
year_out_of_range: "Das Jahr muss zwischen {{min}} und {{max}} liegen"
|
|
5750
5750
|
};
|
|
5751
5751
|
|
|
5752
5752
|
// src/locales/el/translation.json
|
|
@@ -5851,7 +5851,6 @@ var translation_default5 = {
|
|
|
5851
5851
|
close_other_application_that_may_be_using_your_camera: "\u039A\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03AC\u03BB\u03BB\u03B5\u03C2 \u03B5\u03C6\u03B1\u03C1\u03BC\u03BF\u03B3\u03AD\u03C2 \u03C0\u03BF\u03C5 \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF \u03BD\u03B1 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03BF\u03CD\u03BD \u03C4\u03B7\u03BD \u03BA\u03AC\u03BC\u03B5\u03C1\u03AC \u03C3\u03B1\u03C2",
|
|
5852
5852
|
if_you_use_external_camera_disconnect_and_reconnect: "\u0395\u03AC\u03BD \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03B5\u03AF\u03C4\u03B5 \u03B5\u03BE\u03C9\u03C4\u03B5\u03C1\u03B9\u03BA\u03AE \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1, \u03B1\u03C0\u03BF\u03C3\u03C5\u03BD\u03B4\u03AD\u03C3\u03C4\u03B5 \u03BA\u03B1\u03B9 \u03B5\u03C0\u03B1\u03BD\u03B1\u03C3\u03C5\u03BD\u03B4\u03AD\u03C3\u03C4\u03B5 \u03C4\u03B7\u03BD.",
|
|
5853
5853
|
close_the_browser_re_open_it: "\u039A\u03BB\u03B5\u03AF\u03C3\u03C4\u03B5 \u03C4\u03BF \u03C0\u03C1\u03CC\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AE\u03B3\u03B7\u03C3\u03B7\u03C2 \u03BA\u03B1\u03B9 \u03B1\u03BD\u03BF\u03AF\u03BE\u03C4\u03B5 \u03C4\u03BF \u03BE\u03B1\u03BD\u03AC",
|
|
5854
|
-
camera_permissions_denied: "\u0397 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1 \u03B4\u03B5\u03BD \u03B1\u03BD\u03BF\u03AF\u03B3\u03B5\u03B9; \u0392\u03B5\u03B2\u03B1\u03B9\u03C9\u03B8\u03B5\u03AF\u03C4\u03B5 \u03CC\u03C4\u03B9 \u03B5\u03C0\u03B9\u03C4\u03C1\u03AD\u03C0\u03B5\u03C4\u03B5 \u03C3\u03C4\u03BF \u03C0\u03C1\u03CC\u03B3\u03C1\u03B1\u03BC\u03BC\u03B1 \u03C0\u03B5\u03C1\u03B9\u03AE\u03B3\u03B7\u03C3\u03B7\u03C2 \u03C4\u03B7\u03BD \u03AC\u03B4\u03B5\u03B9\u03B1 \u03C7\u03C1\u03AE\u03C3\u03B7\u03C2 \u03C4\u03B7\u03C2 \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1\u03C2.",
|
|
5855
5854
|
camera_errors: {
|
|
5856
5855
|
experiencing_camera_issues: "\u0391\u03BD\u03C4\u03B9\u03BC\u03B5\u03C4\u03C9\u03C0\u03AF\u03B6\u03B5\u03C4\u03B5 \u03C0\u03C1\u03BF\u03B2\u03BB\u03AE\u03BC\u03B1\u03C4\u03B1 \u03BC\u03B5 \u03C4\u03B7\u03BD \u03BA\u03AC\u03BC\u03B5\u03C1\u03B1;",
|
|
5857
5856
|
chekin_cant_use_your_camera: "\u039F \u03A4\u03C3\u03AD\u03BA\u03B9\u03BD \u03B4\u03B5\u03BD \u03BC\u03C0\u03BF\u03C1\u03B5\u03AF \u03BD\u03B1 \u03C7\u03C1\u03B7\u03C3\u03B9\u03BC\u03BF\u03C0\u03BF\u03B9\u03AE\u03C3\u03B5\u03B9 \u03C4\u03B7\u03BD \u03BA\u03AC\u03BC\u03B5\u03C1\u03AC \u03C3\u03B1\u03C2",
|
|
@@ -5875,7 +5874,8 @@ var translation_default5 = {
|
|
|
5875
5874
|
hide_password: "\u0391\u03C0\u03CC\u03BA\u03C1\u03C5\u03C8\u03B7 \u03BA\u03C9\u03B4\u03B9\u03BA\u03BF\u03CD \u03C0\u03C1\u03CC\u03C3\u03B2\u03B1\u03C3\u03B7\u03C2",
|
|
5876
5875
|
increment: "\u0391\u03CD\u03BE\u03B7\u03C3\u03B7",
|
|
5877
5876
|
decrement: "\u039C\u03B5\u03AF\u03C9\u03C3\u03B7",
|
|
5878
|
-
create_option: '\u0394\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AE\u03C3\u03C4\u03B5 \u03C4\u03BF "{{input}}__"'
|
|
5877
|
+
create_option: '\u0394\u03B7\u03BC\u03B9\u03BF\u03C5\u03C1\u03B3\u03AE\u03C3\u03C4\u03B5 \u03C4\u03BF "{{input}}__"',
|
|
5878
|
+
year_out_of_range: "\u03A4\u03BF \u03AD\u03C4\u03BF\u03C2 \u03C0\u03C1\u03AD\u03C0\u03B5\u03B9 \u03BD\u03B1 \u03B5\u03AF\u03BD\u03B1\u03B9 \u03BC\u03B5\u03C4\u03B1\u03BE\u03CD {{min}} \u03BA\u03B1\u03B9 {{max}}"
|
|
5879
5879
|
};
|
|
5880
5880
|
|
|
5881
5881
|
// src/locales/en/translation.json
|
|
@@ -5974,13 +5974,13 @@ var translation_default6 = {
|
|
|
5974
5974
|
date_range_min_days_error_other: "Range must be at least {{count}} days",
|
|
5975
5975
|
past_dates: "Date cannot be before {{minDate}}",
|
|
5976
5976
|
future_dates: "Date cannot be after {{maxDate}}",
|
|
5977
|
+
year_out_of_range: "Year must be between {{min}} and {{max}}",
|
|
5977
5978
|
signature_placeholder_text: "Sign inside this box.<br/> Use your finger.<br/> Tap to start.",
|
|
5978
5979
|
open_devices_camera: "Open device's camera",
|
|
5979
5980
|
place_document_inside_frame: "Place your document inside the frame",
|
|
5980
5981
|
close_other_application_that_may_be_using_your_camera: "Close other applications that may be using your camera",
|
|
5981
5982
|
if_you_use_external_camera_disconnect_and_reconnect: "If you use an external camera, disconnect and reconnect it",
|
|
5982
5983
|
close_the_browser_re_open_it: "Close the browser and reopen it",
|
|
5983
|
-
camera_permissions_denied: "The camera doesn't open? Make sure to allow the browser permission to use the camera.",
|
|
5984
5984
|
camera_errors: {
|
|
5985
5985
|
experiencing_camera_issues: "Experiencing camera issues?",
|
|
5986
5986
|
chekin_cant_use_your_camera: "Chekin can't use your camera",
|
|
@@ -6109,7 +6109,6 @@ var translation_default7 = {
|
|
|
6109
6109
|
close_other_application_that_may_be_using_your_camera: "Cierra otras aplicaciones que puedan estar utilizando tu c\xE1mara",
|
|
6110
6110
|
if_you_use_external_camera_disconnect_and_reconnect: "Si utilizas una c\xE1mara externa, descon\xE9ctala y vuelve a conectarla",
|
|
6111
6111
|
close_the_browser_re_open_it: "Cierre el navegador y vuelva a abrirlo",
|
|
6112
|
-
camera_permissions_denied: "\xBFLa c\xE1mara no se abre? Aseg\xFArate de dar permiso al navegador para usar la c\xE1mara.",
|
|
6113
6112
|
camera_errors: {
|
|
6114
6113
|
experiencing_camera_issues: "\xBFTienes problemas con la c\xE1mara?",
|
|
6115
6114
|
chekin_cant_use_your_camera: "Chekin no puede usar tu c\xE1mara",
|
|
@@ -6133,7 +6132,8 @@ var translation_default7 = {
|
|
|
6133
6132
|
hide_password: "Ocultar contrase\xF1a",
|
|
6134
6133
|
increment: "Incremento",
|
|
6135
6134
|
decrement: "Disminuci\xF3n",
|
|
6136
|
-
create_option: 'Crear "{{input}}"'
|
|
6135
|
+
create_option: 'Crear "{{input}}"',
|
|
6136
|
+
year_out_of_range: "El a\xF1o debe estar comprendido entre {{min}} y {{max}}."
|
|
6137
6137
|
};
|
|
6138
6138
|
|
|
6139
6139
|
// src/locales/et/translation.json
|
|
@@ -6238,7 +6238,6 @@ var translation_default8 = {
|
|
|
6238
6238
|
close_other_application_that_may_be_using_your_camera: "Sulgege muud rakendused, mis v\xF5ivad kasutada teie kaamerat",
|
|
6239
6239
|
if_you_use_external_camera_disconnect_and_reconnect: "Kui kasutate v\xE4list kaamerat, \xFChendage see lahti ja \xFChendage uuesti.",
|
|
6240
6240
|
close_the_browser_re_open_it: "Sulgege brauser ja avage see uuesti",
|
|
6241
|
-
camera_permissions_denied: "Kaamera ei avane? Veenduge, et lubate brauserile kaamera kasutamise loa.",
|
|
6242
6241
|
camera_errors: {
|
|
6243
6242
|
experiencing_camera_issues: "Kas teil on probleeme kaameraga?",
|
|
6244
6243
|
chekin_cant_use_your_camera: "Chekin ei saa oma kaamerat kasutada",
|
|
@@ -6262,7 +6261,8 @@ var translation_default8 = {
|
|
|
6262
6261
|
hide_password: "Peida parool",
|
|
6263
6262
|
increment: "Inkrement",
|
|
6264
6263
|
decrement: "V\xE4hendamine",
|
|
6265
|
-
create_option: 'Loo "{{input}}".'
|
|
6264
|
+
create_option: 'Loo "{{input}}".',
|
|
6265
|
+
year_out_of_range: "Aasta peab olema {{min}} ja {{max}} vahel."
|
|
6266
6266
|
};
|
|
6267
6267
|
|
|
6268
6268
|
// src/locales/fr/translation.json
|
|
@@ -6367,7 +6367,6 @@ var translation_default9 = {
|
|
|
6367
6367
|
close_other_application_that_may_be_using_your_camera: "Fermez les autres applications qui peuvent utiliser votre appareil photo",
|
|
6368
6368
|
if_you_use_external_camera_disconnect_and_reconnect: "Si vous utilisez un appareil photo externe, d\xE9connectez-le et reconnectez-le",
|
|
6369
6369
|
close_the_browser_re_open_it: "Fermer le navigateur et le rouvrir",
|
|
6370
|
-
camera_permissions_denied: "L'appareil photo ne s'ouvre pas ? Veillez \xE0 autoriser le navigateur \xE0 utiliser l'appareil photo.",
|
|
6371
6370
|
camera_errors: {
|
|
6372
6371
|
experiencing_camera_issues: "Vous avez des probl\xE8mes avec l'appareil photo ?",
|
|
6373
6372
|
chekin_cant_use_your_camera: "Chekin ne peut pas utiliser votre appareil photo",
|
|
@@ -6391,7 +6390,8 @@ var translation_default9 = {
|
|
|
6391
6390
|
hide_password: "Cacher le mot de passe",
|
|
6392
6391
|
increment: "Incr\xE9ment",
|
|
6393
6392
|
decrement: "D\xE9croissance",
|
|
6394
|
-
create_option: 'Cr\xE9er "{{input}}"'
|
|
6393
|
+
create_option: 'Cr\xE9er "{{input}}"',
|
|
6394
|
+
year_out_of_range: "L'ann\xE9e doit \xEAtre comprise entre {{min}} et {{max}}."
|
|
6395
6395
|
};
|
|
6396
6396
|
|
|
6397
6397
|
// src/locales/hu/translation.json
|
|
@@ -6496,7 +6496,6 @@ var translation_default10 = {
|
|
|
6496
6496
|
close_other_application_that_may_be_using_your_camera: "Z\xE1rjon be m\xE1s alkalmaz\xE1sokat, amelyek esetleg a kamer\xE1t haszn\xE1lj\xE1k",
|
|
6497
6497
|
if_you_use_external_camera_disconnect_and_reconnect: "Ha k\xFCls\u0151 kamer\xE1t haszn\xE1l, v\xE1lassza ki \xE9s csatlakoztassa \xFAjra.",
|
|
6498
6498
|
close_the_browser_re_open_it: "Z\xE1rja be a b\xF6ng\xE9sz\u0151t, majd nyissa meg \xFAjra",
|
|
6499
|
-
camera_permissions_denied: "A kamera nem ny\xEDlik ki? Gy\u0151z\u0151dj\xF6n meg r\xF3la, hogy enged\xE9lyezi a b\xF6ng\xE9sz\u0151 sz\xE1m\xE1ra a kamera haszn\xE1lat\xE1t.",
|
|
6500
6499
|
camera_errors: {
|
|
6501
6500
|
experiencing_camera_issues: "Kameraprobl\xE9m\xE1k?",
|
|
6502
6501
|
chekin_cant_use_your_camera: "Chekin nem tudja haszn\xE1lni a kamer\xE1t",
|
|
@@ -6520,7 +6519,8 @@ var translation_default10 = {
|
|
|
6520
6519
|
hide_password: "Jelsz\xF3 elrejt\xE9se",
|
|
6521
6520
|
increment: "Inkrement\xE1l\xE1s",
|
|
6522
6521
|
decrement: "Cs\xF6kkent\xE9s",
|
|
6523
|
-
create_option: 'Hozzon l\xE9tre "{{input}}__"'
|
|
6522
|
+
create_option: 'Hozzon l\xE9tre "{{input}}__"',
|
|
6523
|
+
year_out_of_range: "Az \xE9vnek {{min}} \xE9s {{max}} k\xF6z\xF6tt kell lennie."
|
|
6524
6524
|
};
|
|
6525
6525
|
|
|
6526
6526
|
// src/locales/it/translation.json
|
|
@@ -6625,7 +6625,6 @@ var translation_default11 = {
|
|
|
6625
6625
|
close_other_application_that_may_be_using_your_camera: "Chiudere altre applicazioni che potrebbero utilizzare la fotocamera",
|
|
6626
6626
|
if_you_use_external_camera_disconnect_and_reconnect: "Se si utilizza una telecamera esterna, scollegarla e ricollegarla.",
|
|
6627
6627
|
close_the_browser_re_open_it: "Chiudere il browser e riaprirlo",
|
|
6628
|
-
camera_permissions_denied: "La fotocamera non si apre? Assicurarsi di autorizzare il browser a utilizzare la fotocamera.",
|
|
6629
6628
|
camera_errors: {
|
|
6630
6629
|
experiencing_camera_issues: "Problemi con la fotocamera?",
|
|
6631
6630
|
chekin_cant_use_your_camera: "Chekin non pu\xF2 usare la macchina fotografica",
|
|
@@ -6649,7 +6648,8 @@ var translation_default11 = {
|
|
|
6649
6648
|
hide_password: "Nascondere la password",
|
|
6650
6649
|
increment: "Incremento",
|
|
6651
6650
|
decrement: "Decremento",
|
|
6652
|
-
create_option: 'Creare "{{input}}"'
|
|
6651
|
+
create_option: 'Creare "{{input}}"',
|
|
6652
|
+
year_out_of_range: "L'anno deve essere compreso tra {{min}} e {{max}}"
|
|
6653
6653
|
};
|
|
6654
6654
|
|
|
6655
6655
|
// src/locales/ko/translation.json
|
|
@@ -6754,7 +6754,6 @@ var translation_default12 = {
|
|
|
6754
6754
|
close_other_application_that_may_be_using_your_camera: "\uCE74\uBA54\uB77C\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC788\uB294 \uB2E4\uB978 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\uC744 \uB2EB\uC2B5\uB2C8\uB2E4.",
|
|
6755
6755
|
if_you_use_external_camera_disconnect_and_reconnect: "\uC678\uBD80 \uCE74\uBA54\uB77C\uB97C \uC0AC\uC6A9\uD558\uB294 \uACBD\uC6B0 \uC5F0\uACB0\uC744 \uB04A\uC5C8\uB2E4\uAC00 \uB2E4\uC2DC \uC5F0\uACB0\uD558\uC138\uC694.",
|
|
6756
6756
|
close_the_browser_re_open_it: "\uBE0C\uB77C\uC6B0\uC800\uB97C \uB2EB\uC558\uB2E4\uAC00 \uB2E4\uC2DC \uC5F4\uAE30",
|
|
6757
|
-
camera_permissions_denied: "\uCE74\uBA54\uB77C\uAC00 \uC5F4\uB9AC\uC9C0 \uC54A\uB098\uC694? \uBE0C\uB77C\uC6B0\uC800\uC5D0\uC11C \uCE74\uBA54\uB77C \uC0AC\uC6A9 \uAD8C\uD55C\uC744 \uD5C8\uC6A9\uD588\uB294\uC9C0 \uD655\uC778\uD558\uC138\uC694.",
|
|
6758
6757
|
camera_errors: {
|
|
6759
6758
|
experiencing_camera_issues: "\uCE74\uBA54\uB77C \uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uB098\uC694?",
|
|
6760
6759
|
chekin_cant_use_your_camera: "Chekin\uC774 \uCE74\uBA54\uB77C\uB97C \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -6778,7 +6777,8 @@ var translation_default12 = {
|
|
|
6778
6777
|
hide_password: "\uBE44\uBC00\uBC88\uD638 \uC228\uAE30\uAE30",
|
|
6779
6778
|
increment: "\uC99D\uBD84",
|
|
6780
6779
|
decrement: "\uAC10\uC18C",
|
|
6781
|
-
create_option: '"{{input}}" \uB9CC\uB4E4\uAE30'
|
|
6780
|
+
create_option: '"{{input}}" \uB9CC\uB4E4\uAE30',
|
|
6781
|
+
year_out_of_range: "\uC5F0\uB3C4\uB294 {{min}}\uC5D0\uC11C {{max}} \uC0AC\uC774\uC5EC\uC57C \uD569\uB2C8\uB2E4."
|
|
6782
6782
|
};
|
|
6783
6783
|
|
|
6784
6784
|
// src/locales/nl/translation.json
|
|
@@ -6883,7 +6883,6 @@ var translation_default13 = {
|
|
|
6883
6883
|
close_other_application_that_may_be_using_your_camera: "Sluit andere toepassingen die mogelijk gebruikmaken van uw camera",
|
|
6884
6884
|
if_you_use_external_camera_disconnect_and_reconnect: "Als u een externe camera gebruikt, koppelt u deze los en sluit u deze weer aan.",
|
|
6885
6885
|
close_the_browser_re_open_it: "Sluit de browser en open deze opnieuw",
|
|
6886
|
-
camera_permissions_denied: "De camera opent niet? Zorg ervoor dat de browser toestemming geeft om de camera te gebruiken.",
|
|
6887
6886
|
camera_errors: {
|
|
6888
6887
|
experiencing_camera_issues: "Problemen met de camera?",
|
|
6889
6888
|
chekin_cant_use_your_camera: "Chekin kan je camera niet gebruiken",
|
|
@@ -6907,7 +6906,8 @@ var translation_default13 = {
|
|
|
6907
6906
|
hide_password: "Wachtwoord verbergen",
|
|
6908
6907
|
increment: "Verhoging",
|
|
6909
6908
|
decrement: "Afname",
|
|
6910
|
-
create_option: 'Maak "{{input}}" aan.'
|
|
6909
|
+
create_option: 'Maak "{{input}}" aan.',
|
|
6910
|
+
year_out_of_range: "Het jaar moet liggen tussen {{min}} en {{max}}"
|
|
6911
6911
|
};
|
|
6912
6912
|
|
|
6913
6913
|
// src/locales/pl/translation.json
|
|
@@ -7012,7 +7012,6 @@ var translation_default14 = {
|
|
|
7012
7012
|
close_other_application_that_may_be_using_your_camera: "Zamknij inne aplikacje, kt\xF3re mog\u0105 korzysta\u0107 z kamery",
|
|
7013
7013
|
if_you_use_external_camera_disconnect_and_reconnect: "Je\u015Bli u\u017Cywasz kamery zewn\u0119trznej, od\u0142\u0105cz j\u0105 i pod\u0142\u0105cz ponownie",
|
|
7014
7014
|
close_the_browser_re_open_it: "Zamknij przegl\u0105dark\u0119 i otw\xF3rz j\u0105 ponownie",
|
|
7015
|
-
camera_permissions_denied: "Kamera nie otwiera si\u0119? Upewnij si\u0119, \u017Ce zezwolono przegl\u0105darce na korzystanie z kamery.",
|
|
7016
7015
|
camera_errors: {
|
|
7017
7016
|
experiencing_camera_issues: "Problemy z kamer\u0105?",
|
|
7018
7017
|
chekin_cant_use_your_camera: "Chekin nie mo\u017Ce u\u017Cywa\u0107 kamery",
|
|
@@ -7036,7 +7035,8 @@ var translation_default14 = {
|
|
|
7036
7035
|
hide_password: "Ukryj has\u0142o",
|
|
7037
7036
|
increment: "Przyrost",
|
|
7038
7037
|
decrement: "Spadek",
|
|
7039
|
-
create_option: 'Utw\xF3rz "{{input}}"'
|
|
7038
|
+
create_option: 'Utw\xF3rz "{{input}}"',
|
|
7039
|
+
year_out_of_range: "Rok musi zawiera\u0107 si\u0119 w przedziale od {{min}} do {{max}}."
|
|
7040
7040
|
};
|
|
7041
7041
|
|
|
7042
7042
|
// src/locales/pt/translation.json
|
|
@@ -7141,7 +7141,6 @@ var translation_default15 = {
|
|
|
7141
7141
|
close_other_application_that_may_be_using_your_camera: "Fechar outras aplica\xE7\xF5es que possam estar a utilizar a sua c\xE2mara",
|
|
7142
7142
|
if_you_use_external_camera_disconnect_and_reconnect: "Se utilizar uma c\xE2mara externa, desligue-a e volte a lig\xE1-la",
|
|
7143
7143
|
close_the_browser_re_open_it: "Fechar o browser e voltar a abri-lo",
|
|
7144
|
-
camera_permissions_denied: "A c\xE2mara n\xE3o abre? Certifique-se de que d\xE1 permiss\xE3o ao browser para utilizar a c\xE2mara.",
|
|
7145
7144
|
camera_errors: {
|
|
7146
7145
|
experiencing_camera_issues: "Est\xE1 a ter problemas com a c\xE2mara?",
|
|
7147
7146
|
chekin_cant_use_your_camera: "Chekin n\xE3o pode usar a sua c\xE2mara",
|
|
@@ -7165,7 +7164,8 @@ var translation_default15 = {
|
|
|
7165
7164
|
hide_password: "Ocultar palavra-passe",
|
|
7166
7165
|
increment: "Incremento",
|
|
7167
7166
|
decrement: "Diminui\xE7\xE3o",
|
|
7168
|
-
create_option: 'Criar "{{input}}"'
|
|
7167
|
+
create_option: 'Criar "{{input}}"',
|
|
7168
|
+
year_out_of_range: "O ano deve estar compreendido entre {{min}} e {{max}}"
|
|
7169
7169
|
};
|
|
7170
7170
|
|
|
7171
7171
|
// src/locales/ro/translation.json
|
|
@@ -7270,7 +7270,6 @@ var translation_default16 = {
|
|
|
7270
7270
|
close_other_application_that_may_be_using_your_camera: "\xCEnchide\u021Bi alte aplica\u021Bii care pot utiliza camera dvs.",
|
|
7271
7271
|
if_you_use_external_camera_disconnect_and_reconnect: "Dac\u0103 utiliza\u021Bi o camer\u0103 extern\u0103, deconecta\u021Bi-o \u0219i reconecta\u021Bi-o",
|
|
7272
7272
|
close_the_browser_re_open_it: "\xCEnchide\u021Bi browserul \u0219i redeschide\u021Bi-l",
|
|
7273
|
-
camera_permissions_denied: "Camera nu se deschide? Asigura\u021Bi-v\u0103 c\u0103 acorda\u021Bi browserului permisiunea de a utiliza camera.",
|
|
7274
7273
|
camera_errors: {
|
|
7275
7274
|
experiencing_camera_issues: "Ave\u021Bi probleme cu camera foto?",
|
|
7276
7275
|
chekin_cant_use_your_camera: "Chekin nu-\u021Bi poate folosi camera",
|
|
@@ -7294,7 +7293,8 @@ var translation_default16 = {
|
|
|
7294
7293
|
hide_password: "Ascunde\u021Bi parola",
|
|
7295
7294
|
increment: "Increment",
|
|
7296
7295
|
decrement: "Diminuare",
|
|
7297
|
-
create_option: 'Crea\u021Bi "{{input}}"'
|
|
7296
|
+
create_option: 'Crea\u021Bi "{{input}}"',
|
|
7297
|
+
year_out_of_range: "Anul trebuie s\u0103 fie \xEEntre {{min}} \u0219i {{max}}"
|
|
7298
7298
|
};
|
|
7299
7299
|
|
|
7300
7300
|
// src/locales/ru/translation.json
|
|
@@ -7399,7 +7399,6 @@ var translation_default17 = {
|
|
|
7399
7399
|
close_other_application_that_may_be_using_your_camera: "\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0434\u0440\u0443\u0433\u0438\u0435 \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F, \u043A\u043E\u0442\u043E\u0440\u044B\u0435 \u043C\u043E\u0433\u0443\u0442 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u0432\u0430\u0448\u0443 \u043A\u0430\u043C\u0435\u0440\u0443",
|
|
7400
7400
|
if_you_use_external_camera_disconnect_and_reconnect: "\u0415\u0441\u043B\u0438 \u0432\u044B \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442\u0435 \u0432\u043D\u0435\u0448\u043D\u044E\u044E \u043A\u0430\u043C\u0435\u0440\u0443, \u043E\u0442\u0441\u043E\u0435\u0434\u0438\u043D\u0438\u0442\u0435 \u0438 \u0441\u043D\u043E\u0432\u0430 \u043F\u043E\u0434\u0441\u043E\u0435\u0434\u0438\u043D\u0438\u0442\u0435 \u0435\u0435",
|
|
7401
7401
|
close_the_browser_re_open_it: "\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u043E\u0442\u043A\u0440\u043E\u0439\u0442\u0435 \u0435\u0433\u043E \u0441\u043D\u043E\u0432\u0430",
|
|
7402
|
-
camera_permissions_denied: "\u041A\u0430\u043C\u0435\u0440\u0430 \u043D\u0435 \u043E\u0442\u043A\u0440\u044B\u0432\u0430\u0435\u0442\u0441\u044F? \u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044C, \u0447\u0442\u043E \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u043B\u0438 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0443 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C \u043A\u0430\u043C\u0435\u0440\u0443.",
|
|
7403
7402
|
camera_errors: {
|
|
7404
7403
|
experiencing_camera_issues: "\u0418\u0441\u043F\u044B\u0442\u044B\u0432\u0430\u0435\u0442\u0435 \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u044B \u0441 \u043A\u0430\u043C\u0435\u0440\u043E\u0439?",
|
|
7405
7404
|
chekin_cant_use_your_camera: "\u0427\u0435\u043A\u0438\u043D \u043D\u0435 \u043C\u043E\u0436\u0435\u0442 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u044C\u0441\u044F \u0432\u0430\u0448\u0435\u0439 \u043A\u0430\u043C\u0435\u0440\u043E\u0439",
|
|
@@ -7423,7 +7422,8 @@ var translation_default17 = {
|
|
|
7423
7422
|
hide_password: "\u0421\u043A\u0440\u044B\u0442\u044C \u043F\u0430\u0440\u043E\u043B\u044C",
|
|
7424
7423
|
increment: "\u0418\u043D\u043A\u0440\u0435\u043C\u0435\u043D\u0442",
|
|
7425
7424
|
decrement: "\u0423\u043C\u0435\u043D\u044C\u0448\u0435\u043D\u0438\u0435",
|
|
7426
|
-
create_option: '\u0421\u043E\u0437\u0434\u0430\u0439\u0442\u0435 "{{input}}"'
|
|
7425
|
+
create_option: '\u0421\u043E\u0437\u0434\u0430\u0439\u0442\u0435 "{{input}}"',
|
|
7426
|
+
year_out_of_range: "\u0413\u043E\u0434 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043C\u0435\u0436\u0434\u0443 {{min}} \u0438 {{max}}"
|
|
7427
7427
|
};
|
|
7428
7428
|
|
|
7429
7429
|
// src/locales/uk/translation.json
|
|
@@ -7528,7 +7528,6 @@ var translation_default18 = {
|
|
|
7528
7528
|
close_other_application_that_may_be_using_your_camera: "\u0417\u0430\u043A\u0440\u0438\u0439\u0442\u0435 \u0456\u043D\u0448\u0456 \u043F\u0440\u043E\u0433\u0440\u0430\u043C\u0438, \u044F\u043A\u0456 \u043C\u043E\u0436\u0443\u0442\u044C \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0432\u0430\u0442\u0438 \u043A\u0430\u043C\u0435\u0440\u0443",
|
|
7529
7529
|
if_you_use_external_camera_disconnect_and_reconnect: "\u042F\u043A\u0449\u043E \u0432\u0438 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u043E\u0432\u0443\u0454\u0442\u0435 \u0437\u043E\u0432\u043D\u0456\u0448\u043D\u044E \u043A\u0430\u043C\u0435\u0440\u0443, \u0432\u0456\u0434'\u0454\u0434\u043D\u0430\u0439\u0442\u0435 \u0442\u0430 \u0437\u043D\u043E\u0432\u0443 \u043F\u0456\u0434'\u0454\u0434\u043D\u0430\u0439\u0442\u0435 \u0457\u0457",
|
|
7530
7530
|
close_the_browser_re_open_it: "\u0417\u0430\u043A\u0440\u0438\u0439\u0442\u0435 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0456 \u0432\u0456\u0434\u043A\u0440\u0438\u0439\u0442\u0435 \u0439\u043E\u0433\u043E \u0437\u043D\u043E\u0432\u0443",
|
|
7531
|
-
camera_permissions_denied: "\u041A\u0430\u043C\u0435\u0440\u0430 \u043D\u0435 \u0432\u0456\u0434\u043A\u0440\u0438\u0432\u0430\u0454\u0442\u044C\u0441\u044F? \u041F\u0435\u0440\u0435\u043A\u043E\u043D\u0430\u0439\u0442\u0435\u0441\u044F, \u0449\u043E \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u043C\u0430\u0454 \u0434\u043E\u0437\u0432\u0456\u043B \u043D\u0430 \u0432\u0438\u043A\u043E\u0440\u0438\u0441\u0442\u0430\u043D\u043D\u044F \u043A\u0430\u043C\u0435\u0440\u0438.",
|
|
7532
7531
|
camera_errors: {
|
|
7533
7532
|
experiencing_camera_issues: "\u0412\u0438\u043D\u0438\u043A\u0430\u044E\u0442\u044C \u043F\u0440\u043E\u0431\u043B\u0435\u043C\u0438 \u0437 \u043A\u0430\u043C\u0435\u0440\u043E\u044E?",
|
|
7534
7533
|
chekin_cant_use_your_camera: "\u0427\u0435\u043A\u0456\u043D \u043D\u0435 \u043C\u043E\u0436\u0435 \u043A\u043E\u0440\u0438\u0441\u0442\u0443\u0432\u0430\u0442\u0438\u0441\u044F \u0442\u0432\u043E\u0454\u044E \u043A\u0430\u043C\u0435\u0440\u043E\u044E",
|
|
@@ -7552,7 +7551,8 @@ var translation_default18 = {
|
|
|
7552
7551
|
hide_password: "\u041F\u0440\u0438\u0445\u043E\u0432\u0430\u0442\u0438 \u043F\u0430\u0440\u043E\u043B\u044C",
|
|
7553
7552
|
increment: "\u041F\u0440\u0438\u0440\u0456\u0441\u0442",
|
|
7554
7553
|
decrement: "\u0414\u0435\u043A\u0440\u0435\u0442",
|
|
7555
|
-
create_option: '\u0421\u0442\u0432\u043E\u0440\u0456\u0442\u044C "{{input}}"'
|
|
7554
|
+
create_option: '\u0421\u0442\u0432\u043E\u0440\u0456\u0442\u044C "{{input}}"',
|
|
7555
|
+
year_out_of_range: "\u0420\u0456\u043A \u043F\u043E\u0432\u0438\u043D\u0435\u043D \u0431\u0443\u0442\u0438 \u043C\u0456\u0436 {{min}} \u0442\u0430 {{max}}."
|
|
7556
7556
|
};
|
|
7557
7557
|
|
|
7558
7558
|
// src/i18n/resources.ts
|
|
@@ -17129,7 +17129,7 @@ var Textarea = React61.forwardRef(function Textarea2({
|
|
|
17129
17129
|
});
|
|
17130
17130
|
|
|
17131
17131
|
// src/fields/datepicker/Datepicker.tsx
|
|
17132
|
-
import * as
|
|
17132
|
+
import * as React64 from "react";
|
|
17133
17133
|
import { ChevronDown as ChevronDown4 } from "lucide-react";
|
|
17134
17134
|
import { useTranslation as useTranslation38 } from "react-i18next";
|
|
17135
17135
|
|
|
@@ -17777,6 +17777,142 @@ function AirbnbDatePickerContent({
|
|
|
17777
17777
|
) });
|
|
17778
17778
|
}
|
|
17779
17779
|
|
|
17780
|
+
// src/fields/datepicker/useMonthCombobox.ts
|
|
17781
|
+
import * as React63 from "react";
|
|
17782
|
+
function useMonthCombobox({
|
|
17783
|
+
monthLabels,
|
|
17784
|
+
monthIndex,
|
|
17785
|
+
isFieldFocused,
|
|
17786
|
+
disabled,
|
|
17787
|
+
onSelect,
|
|
17788
|
+
onCommit,
|
|
17789
|
+
onClear
|
|
17790
|
+
}) {
|
|
17791
|
+
const [isOpen, setIsOpen] = React63.useState(false);
|
|
17792
|
+
const [inputValue, setInputValue] = React63.useState("");
|
|
17793
|
+
const [highlightIndex, setHighlightIndex] = React63.useState(-1);
|
|
17794
|
+
const labelFor = React63.useCallback(
|
|
17795
|
+
(index) => index !== null ? monthLabels[index] ?? "" : "",
|
|
17796
|
+
[monthLabels]
|
|
17797
|
+
);
|
|
17798
|
+
React63.useEffect(() => {
|
|
17799
|
+
if (isFieldFocused) return;
|
|
17800
|
+
setInputValue(labelFor(monthIndex));
|
|
17801
|
+
}, [monthIndex, labelFor, isFieldFocused]);
|
|
17802
|
+
const filteredMonths = React63.useMemo(() => {
|
|
17803
|
+
const all = monthLabels.map((label, index) => ({ label, index }));
|
|
17804
|
+
const query = inputValue.trim().toLowerCase();
|
|
17805
|
+
if (!query || inputValue === labelFor(monthIndex)) return all;
|
|
17806
|
+
return all.filter((option) => option.label.toLowerCase().includes(query));
|
|
17807
|
+
}, [inputValue, monthIndex, monthLabels, labelFor]);
|
|
17808
|
+
React63.useEffect(() => {
|
|
17809
|
+
if (!isOpen) {
|
|
17810
|
+
setHighlightIndex(-1);
|
|
17811
|
+
return;
|
|
17812
|
+
}
|
|
17813
|
+
if (monthIndex !== null) {
|
|
17814
|
+
const index = filteredMonths.findIndex((option) => option.index === monthIndex);
|
|
17815
|
+
if (index >= 0) {
|
|
17816
|
+
setHighlightIndex(index);
|
|
17817
|
+
return;
|
|
17818
|
+
}
|
|
17819
|
+
}
|
|
17820
|
+
setHighlightIndex(filteredMonths.length > 0 ? 0 : -1);
|
|
17821
|
+
}, [isOpen, filteredMonths.length]);
|
|
17822
|
+
const selectMonth = React63.useCallback(
|
|
17823
|
+
(index) => {
|
|
17824
|
+
setInputValue(labelFor(index));
|
|
17825
|
+
setIsOpen(false);
|
|
17826
|
+
onSelect(index);
|
|
17827
|
+
},
|
|
17828
|
+
[labelFor, onSelect]
|
|
17829
|
+
);
|
|
17830
|
+
const commitInput = React63.useCallback(() => {
|
|
17831
|
+
const query = inputValue.trim().toLowerCase();
|
|
17832
|
+
if (!query) {
|
|
17833
|
+
if (monthIndex !== null) onClear();
|
|
17834
|
+
setInputValue("");
|
|
17835
|
+
return;
|
|
17836
|
+
}
|
|
17837
|
+
const exactMatch = monthLabels.findIndex((label) => label.toLowerCase() === query);
|
|
17838
|
+
if (exactMatch >= 0) {
|
|
17839
|
+
if (exactMatch !== monthIndex) onCommit(exactMatch);
|
|
17840
|
+
setInputValue(labelFor(exactMatch));
|
|
17841
|
+
return;
|
|
17842
|
+
}
|
|
17843
|
+
setInputValue(labelFor(monthIndex));
|
|
17844
|
+
}, [inputValue, monthIndex, monthLabels, labelFor, onClear, onCommit]);
|
|
17845
|
+
const handleInputChange = React63.useCallback(
|
|
17846
|
+
(event) => {
|
|
17847
|
+
setInputValue(event.target.value);
|
|
17848
|
+
setIsOpen(true);
|
|
17849
|
+
setHighlightIndex(0);
|
|
17850
|
+
},
|
|
17851
|
+
[]
|
|
17852
|
+
);
|
|
17853
|
+
const handleInputKeyDown = React63.useCallback(
|
|
17854
|
+
(event) => {
|
|
17855
|
+
if (disabled) return;
|
|
17856
|
+
if (event.key === "ArrowDown") {
|
|
17857
|
+
event.preventDefault();
|
|
17858
|
+
setIsOpen(true);
|
|
17859
|
+
setHighlightIndex(
|
|
17860
|
+
(prev) => filteredMonths.length === 0 ? -1 : Math.min(prev + 1, filteredMonths.length - 1)
|
|
17861
|
+
);
|
|
17862
|
+
return;
|
|
17863
|
+
}
|
|
17864
|
+
if (event.key === "ArrowUp") {
|
|
17865
|
+
event.preventDefault();
|
|
17866
|
+
setIsOpen(true);
|
|
17867
|
+
setHighlightIndex((prev) => Math.max(prev - 1, 0));
|
|
17868
|
+
return;
|
|
17869
|
+
}
|
|
17870
|
+
if (event.key === "Enter") {
|
|
17871
|
+
if (!isOpen) return;
|
|
17872
|
+
event.preventDefault();
|
|
17873
|
+
const target = filteredMonths[highlightIndex];
|
|
17874
|
+
if (target) {
|
|
17875
|
+
selectMonth(target.index);
|
|
17876
|
+
} else {
|
|
17877
|
+
commitInput();
|
|
17878
|
+
}
|
|
17879
|
+
return;
|
|
17880
|
+
}
|
|
17881
|
+
if (event.key === "Escape") {
|
|
17882
|
+
event.preventDefault();
|
|
17883
|
+
setIsOpen(false);
|
|
17884
|
+
setInputValue(labelFor(monthIndex));
|
|
17885
|
+
return;
|
|
17886
|
+
}
|
|
17887
|
+
if (event.key === "Tab") {
|
|
17888
|
+
setIsOpen(false);
|
|
17889
|
+
}
|
|
17890
|
+
},
|
|
17891
|
+
[
|
|
17892
|
+
commitInput,
|
|
17893
|
+
disabled,
|
|
17894
|
+
filteredMonths,
|
|
17895
|
+
highlightIndex,
|
|
17896
|
+
isOpen,
|
|
17897
|
+
labelFor,
|
|
17898
|
+
monthIndex,
|
|
17899
|
+
selectMonth
|
|
17900
|
+
]
|
|
17901
|
+
);
|
|
17902
|
+
return {
|
|
17903
|
+
isOpen,
|
|
17904
|
+
setIsOpen,
|
|
17905
|
+
inputValue,
|
|
17906
|
+
highlightIndex,
|
|
17907
|
+
setHighlightIndex,
|
|
17908
|
+
filteredMonths,
|
|
17909
|
+
selectMonth,
|
|
17910
|
+
commitInput,
|
|
17911
|
+
handleInputChange,
|
|
17912
|
+
handleInputKeyDown
|
|
17913
|
+
};
|
|
17914
|
+
}
|
|
17915
|
+
|
|
17780
17916
|
// src/fields/datepicker/Datepicker.tsx
|
|
17781
17917
|
import { jsx as jsx172, jsxs as jsxs108 } from "react/jsx-runtime";
|
|
17782
17918
|
var MONTHS_IN_YEAR2 = 12;
|
|
@@ -17788,13 +17924,33 @@ function getMonthLabels2(locale) {
|
|
|
17788
17924
|
);
|
|
17789
17925
|
}
|
|
17790
17926
|
var DAY_PATTERN = /^([1-9]|[12]\d|3[01])$/;
|
|
17791
|
-
var PARTIAL_DAY_PATTERN = /^[0-9]
|
|
17927
|
+
var PARTIAL_DAY_PATTERN = /^([0-9]|0[1-9]|[12]\d|3[01])?$/;
|
|
17792
17928
|
var PARTIAL_YEAR_PATTERN = /^[0-9]{0,4}$/;
|
|
17793
|
-
var
|
|
17929
|
+
var COMPLETE_YEAR_PATTERN = /^\d{4}$/;
|
|
17930
|
+
var MIN_YEAR_OFFSET = 120;
|
|
17931
|
+
var MAX_YEAR_OFFSET = 50;
|
|
17932
|
+
function getYearBounds() {
|
|
17933
|
+
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
17934
|
+
return {
|
|
17935
|
+
minYear: currentYear - MIN_YEAR_OFFSET,
|
|
17936
|
+
maxYear: currentYear + MAX_YEAR_OFFSET
|
|
17937
|
+
};
|
|
17938
|
+
}
|
|
17794
17939
|
function isValidCalendarDate(year, monthIndex, day) {
|
|
17795
17940
|
const date = new Date(year, monthIndex, day);
|
|
17796
17941
|
return date.getFullYear() === year && date.getMonth() === monthIndex && date.getDate() === day;
|
|
17797
17942
|
}
|
|
17943
|
+
function getDaysInMonth2(monthIndex, year) {
|
|
17944
|
+
const yearNum = COMPLETE_YEAR_PATTERN.test(year) ? parseInt(year, 10) : 2024;
|
|
17945
|
+
return new Date(yearNum, monthIndex + 1, 0).getDate();
|
|
17946
|
+
}
|
|
17947
|
+
function clampDayToMonth(day, monthIndex, year) {
|
|
17948
|
+
if (!day || monthIndex === null) return day;
|
|
17949
|
+
const dayNum = parseInt(day, 10);
|
|
17950
|
+
if (Number.isNaN(dayNum)) return day;
|
|
17951
|
+
const max = getDaysInMonth2(monthIndex, year);
|
|
17952
|
+
return dayNum > max ? String(max) : day;
|
|
17953
|
+
}
|
|
17798
17954
|
function partsFromDate(date) {
|
|
17799
17955
|
if (!date) return { day: "", monthIndex: null, year: "" };
|
|
17800
17956
|
return {
|
|
@@ -17803,15 +17959,23 @@ function partsFromDate(date) {
|
|
|
17803
17959
|
year: String(date.getFullYear())
|
|
17804
17960
|
};
|
|
17805
17961
|
}
|
|
17806
|
-
function
|
|
17962
|
+
function datepickerDatesEqual(a, b) {
|
|
17963
|
+
if (a === null || b === null) return a === b;
|
|
17964
|
+
return a.getTime() === b.getTime();
|
|
17965
|
+
}
|
|
17966
|
+
function isYearInRange(yearNum, minYear, maxYear) {
|
|
17967
|
+
return yearNum >= minYear && yearNum <= maxYear;
|
|
17968
|
+
}
|
|
17969
|
+
function dateFromParts(day, monthIndex, year, minYear, maxYear) {
|
|
17807
17970
|
if (!day || monthIndex === null || !year) return null;
|
|
17808
|
-
if (!DAY_PATTERN.test(day) || !
|
|
17971
|
+
if (!DAY_PATTERN.test(day) || !COMPLETE_YEAR_PATTERN.test(year)) return null;
|
|
17809
17972
|
const dayNum = parseInt(day, 10);
|
|
17810
17973
|
const yearNum = parseInt(year, 10);
|
|
17974
|
+
if (!isYearInRange(yearNum, minYear, maxYear)) return null;
|
|
17811
17975
|
if (!isValidCalendarDate(yearNum, monthIndex, dayNum)) return null;
|
|
17812
17976
|
return new Date(yearNum, monthIndex, dayNum);
|
|
17813
17977
|
}
|
|
17814
|
-
var Datepicker =
|
|
17978
|
+
var Datepicker = React64.forwardRef(
|
|
17815
17979
|
function Datepicker2({
|
|
17816
17980
|
label,
|
|
17817
17981
|
value,
|
|
@@ -17844,133 +18008,154 @@ var Datepicker = React63.forwardRef(
|
|
|
17844
18008
|
maxDate,
|
|
17845
18009
|
formatValue
|
|
17846
18010
|
}, ref) {
|
|
17847
|
-
const containerRef =
|
|
17848
|
-
const dayInputRef =
|
|
17849
|
-
const monthInputRef =
|
|
17850
|
-
const
|
|
17851
|
-
const
|
|
17852
|
-
const
|
|
17853
|
-
const wheelBaseId = React63.useId();
|
|
17854
|
-
const reactId = React63.useId();
|
|
18011
|
+
const containerRef = React64.useRef(null);
|
|
18012
|
+
const dayInputRef = React64.useRef(null);
|
|
18013
|
+
const monthInputRef = React64.useRef(null);
|
|
18014
|
+
const yearInputRef = React64.useRef(null);
|
|
18015
|
+
const mobileTriggerRef = React64.useRef(null);
|
|
18016
|
+
const reactId = React64.useId();
|
|
17855
18017
|
const baseId = name ?? `dash-datepicker-${reactId}`;
|
|
17856
18018
|
const dayId = `${baseId}-day`;
|
|
17857
18019
|
const monthId = `${baseId}-month`;
|
|
17858
18020
|
const yearId = `${baseId}-year`;
|
|
17859
18021
|
const labelId = `${baseId}-label`;
|
|
17860
18022
|
const errorId = `${baseId}-error`;
|
|
18023
|
+
const wheelBaseId = `${baseId}-wheel`;
|
|
17861
18024
|
const { t, i18n } = useTranslation38();
|
|
17862
18025
|
const resolvedLocale = locale ?? i18n.resolvedLanguage ?? i18n.language ?? "en-US";
|
|
17863
|
-
const resolvedMonthLabels =
|
|
18026
|
+
const resolvedMonthLabels = React64.useMemo(
|
|
17864
18027
|
() => monthLabels ?? getMonthLabels2(resolvedLocale),
|
|
17865
18028
|
[resolvedLocale, monthLabels]
|
|
17866
18029
|
);
|
|
17867
18030
|
const resolvedMonthPlaceholder = monthPlaceholder ?? t("month");
|
|
17868
18031
|
const resolvedDoneLabel = doneLabel ?? t("done");
|
|
17869
18032
|
const isControlled = value !== void 0;
|
|
17870
|
-
const initialParts =
|
|
18033
|
+
const initialParts = React64.useMemo(
|
|
17871
18034
|
() => partsFromDate(value ?? defaultValue ?? null),
|
|
17872
18035
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
17873
18036
|
[]
|
|
17874
18037
|
);
|
|
17875
|
-
const [day, setDay] =
|
|
17876
|
-
const [monthIndex, setMonthIndex] =
|
|
18038
|
+
const [day, setDay] = React64.useState(initialParts.day);
|
|
18039
|
+
const [monthIndex, setMonthIndex] = React64.useState(
|
|
17877
18040
|
initialParts.monthIndex
|
|
17878
18041
|
);
|
|
17879
|
-
const [year, setYear] =
|
|
17880
|
-
const [
|
|
17881
|
-
const [
|
|
17882
|
-
const [focusedField, setFocusedField] = React63.useState(null);
|
|
17883
|
-
const [monthInputValue, setMonthInputValue] = React63.useState("");
|
|
17884
|
-
const [monthHighlightIndex, setMonthHighlightIndex] = React63.useState(-1);
|
|
18042
|
+
const [year, setYear] = React64.useState(initialParts.year);
|
|
18043
|
+
const [isWheelOpen, setIsWheelOpen] = React64.useState(false);
|
|
18044
|
+
const [focusedField, setFocusedField] = React64.useState(null);
|
|
17885
18045
|
const isMobile3 = useIsMobile();
|
|
17886
|
-
const emitChangeRef =
|
|
18046
|
+
const emitChangeRef = React64.useRef(() => {
|
|
17887
18047
|
});
|
|
17888
|
-
const
|
|
17889
|
-
const
|
|
17890
|
-
const
|
|
18048
|
+
const lastEmittedRef = React64.useRef(value ?? null);
|
|
18049
|
+
const dayStateRef = React64.useRef(day);
|
|
18050
|
+
const yearStateRef = React64.useRef(year);
|
|
18051
|
+
const monthIndexRef = React64.useRef(monthIndex);
|
|
17891
18052
|
dayStateRef.current = day;
|
|
17892
18053
|
yearStateRef.current = year;
|
|
17893
18054
|
monthIndexRef.current = monthIndex;
|
|
17894
|
-
|
|
18055
|
+
React64.useImperativeHandle(
|
|
17895
18056
|
ref,
|
|
17896
18057
|
() => ({
|
|
17897
18058
|
getDayValue: () => dayStateRef.current,
|
|
17898
18059
|
getYearValue: () => yearStateRef.current,
|
|
17899
18060
|
setDayValue: (next) => {
|
|
17900
18061
|
if (!PARTIAL_DAY_PATTERN.test(next)) return;
|
|
18062
|
+
const month = monthIndexRef.current;
|
|
18063
|
+
if (month !== null && next && parseInt(next, 10) > getDaysInMonth2(month, yearStateRef.current)) {
|
|
18064
|
+
return;
|
|
18065
|
+
}
|
|
17901
18066
|
setDay(next);
|
|
17902
|
-
emitChangeRef.current(next,
|
|
18067
|
+
emitChangeRef.current(next, month, yearStateRef.current);
|
|
17903
18068
|
},
|
|
17904
18069
|
setYearValue: (next) => {
|
|
17905
18070
|
if (!PARTIAL_YEAR_PATTERN.test(next)) return;
|
|
18071
|
+
const clampedDay = clampDayToMonth(
|
|
18072
|
+
dayStateRef.current,
|
|
18073
|
+
monthIndexRef.current,
|
|
18074
|
+
next
|
|
18075
|
+
);
|
|
18076
|
+
if (clampedDay !== dayStateRef.current) setDay(clampedDay);
|
|
17906
18077
|
setYear(next);
|
|
17907
|
-
emitChangeRef.current(
|
|
18078
|
+
emitChangeRef.current(clampedDay, monthIndexRef.current, next);
|
|
17908
18079
|
}
|
|
17909
18080
|
}),
|
|
17910
18081
|
[]
|
|
17911
18082
|
);
|
|
17912
|
-
|
|
18083
|
+
React64.useEffect(() => {
|
|
17913
18084
|
if (!isControlled) return;
|
|
17914
|
-
const
|
|
18085
|
+
const incoming = value ?? null;
|
|
18086
|
+
if (datepickerDatesEqual(incoming, lastEmittedRef.current)) return;
|
|
18087
|
+
lastEmittedRef.current = incoming;
|
|
18088
|
+
const next = partsFromDate(incoming);
|
|
17915
18089
|
setDay(next.day);
|
|
17916
18090
|
setMonthIndex(next.monthIndex);
|
|
17917
18091
|
setYear(next.year);
|
|
17918
18092
|
}, [isControlled, value]);
|
|
17919
|
-
|
|
17920
|
-
|
|
17921
|
-
|
|
17922
|
-
|
|
17923
|
-
)
|
|
17924
|
-
|
|
17925
|
-
const filteredMonths = React63.useMemo(() => {
|
|
17926
|
-
const all = resolvedMonthLabels.map((label2, index) => ({ label: label2, index }));
|
|
17927
|
-
const query = monthInputValue.trim().toLowerCase();
|
|
17928
|
-
const currentLabel = monthIndex !== null ? resolvedMonthLabels[monthIndex] ?? "" : "";
|
|
17929
|
-
if (!query || monthInputValue === currentLabel) return all;
|
|
17930
|
-
return all.filter((opt) => opt.label.toLowerCase().includes(query));
|
|
17931
|
-
}, [monthInputValue, monthIndex, resolvedMonthLabels]);
|
|
17932
|
-
React63.useEffect(() => {
|
|
17933
|
-
if (!isMonthOpen) {
|
|
17934
|
-
setMonthHighlightIndex(-1);
|
|
17935
|
-
return;
|
|
17936
|
-
}
|
|
17937
|
-
if (monthIndex !== null) {
|
|
17938
|
-
const currentLabel = resolvedMonthLabels[monthIndex];
|
|
17939
|
-
const index = filteredMonths.findIndex((o) => o.label === currentLabel);
|
|
17940
|
-
if (index >= 0) {
|
|
17941
|
-
setMonthHighlightIndex(index);
|
|
17942
|
-
return;
|
|
17943
|
-
}
|
|
18093
|
+
const { minYear, maxYear } = React64.useMemo(() => getYearBounds(), []);
|
|
18094
|
+
const yearError = React64.useMemo(() => {
|
|
18095
|
+
if (year.length < 4) return null;
|
|
18096
|
+
const yearNum = parseInt(year, 10);
|
|
18097
|
+
if (!isYearInRange(yearNum, minYear, maxYear)) {
|
|
18098
|
+
return t("year_out_of_range", { min: minYear, max: maxYear });
|
|
17944
18099
|
}
|
|
17945
|
-
|
|
17946
|
-
}, [
|
|
17947
|
-
const
|
|
17948
|
-
const isEmpty = !
|
|
18100
|
+
return null;
|
|
18101
|
+
}, [year, minYear, maxYear, t]);
|
|
18102
|
+
const resolvedError = error || yearError || void 0;
|
|
18103
|
+
const isEmpty = !day && monthIndex === null && !year;
|
|
17949
18104
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
17950
|
-
const
|
|
17951
|
-
const isInvalid = Boolean(invalid || error);
|
|
18105
|
+
const isInvalid = Boolean(invalid || resolvedError);
|
|
17952
18106
|
const wrapperWidth = toCssSize(width);
|
|
17953
|
-
const
|
|
17954
|
-
|
|
17955
|
-
|
|
18107
|
+
const errorDescribedBy = resolvedError && !hideErrorMessage ? errorId : void 0;
|
|
18108
|
+
const currentDate = React64.useMemo(
|
|
18109
|
+
() => dateFromParts(day, monthIndex, year, minYear, maxYear),
|
|
18110
|
+
[day, monthIndex, year, minYear, maxYear]
|
|
17956
18111
|
);
|
|
17957
|
-
|
|
17958
|
-
elementRef: containerRef,
|
|
17959
|
-
onOutsideClick: () => setIsMonthOpen(false),
|
|
17960
|
-
isDisabled: !isMonthOpen || isMobile3
|
|
17961
|
-
});
|
|
17962
|
-
const emitChange = React63.useCallback(
|
|
18112
|
+
const emitChange = React64.useCallback(
|
|
17963
18113
|
(nextDay, nextMonth, nextYear) => {
|
|
17964
|
-
|
|
17965
|
-
|
|
17966
|
-
onChange(date, name);
|
|
18114
|
+
const date = dateFromParts(nextDay, nextMonth, nextYear, minYear, maxYear);
|
|
18115
|
+
lastEmittedRef.current = date;
|
|
18116
|
+
onChange?.(date, name);
|
|
17967
18117
|
},
|
|
17968
|
-
[name, onChange]
|
|
18118
|
+
[name, onChange, minYear, maxYear]
|
|
17969
18119
|
);
|
|
17970
18120
|
emitChangeRef.current = emitChange;
|
|
18121
|
+
const commitMonth = React64.useCallback(
|
|
18122
|
+
(index) => {
|
|
18123
|
+
const clampedDay = clampDayToMonth(day, index, year);
|
|
18124
|
+
if (clampedDay !== day) setDay(clampedDay);
|
|
18125
|
+
setMonthIndex(index);
|
|
18126
|
+
emitChange(clampedDay, index, year);
|
|
18127
|
+
},
|
|
18128
|
+
[day, emitChange, year]
|
|
18129
|
+
);
|
|
18130
|
+
const handleMonthSelect = React64.useCallback(
|
|
18131
|
+
(index) => {
|
|
18132
|
+
commitMonth(index);
|
|
18133
|
+
yearInputRef.current?.focus();
|
|
18134
|
+
},
|
|
18135
|
+
[commitMonth]
|
|
18136
|
+
);
|
|
18137
|
+
const handleMonthClear = React64.useCallback(() => commitMonth(null), [commitMonth]);
|
|
18138
|
+
const monthCombobox = useMonthCombobox({
|
|
18139
|
+
monthLabels: resolvedMonthLabels,
|
|
18140
|
+
monthIndex,
|
|
18141
|
+
isFieldFocused: focusedField === "month",
|
|
18142
|
+
disabled: isBlocked,
|
|
18143
|
+
onSelect: handleMonthSelect,
|
|
18144
|
+
onCommit: commitMonth,
|
|
18145
|
+
onClear: handleMonthClear
|
|
18146
|
+
});
|
|
18147
|
+
const isFocused = focusedField !== null || monthCombobox.isOpen || isWheelOpen;
|
|
18148
|
+
useOutsideClick({
|
|
18149
|
+
elementRef: containerRef,
|
|
18150
|
+
onOutsideClick: () => monthCombobox.setIsOpen(false),
|
|
18151
|
+
isDisabled: !monthCombobox.isOpen || isMobile3
|
|
18152
|
+
});
|
|
17971
18153
|
const handleDayChange = (event) => {
|
|
17972
18154
|
const next = event.target.value;
|
|
17973
18155
|
if (!PARTIAL_DAY_PATTERN.test(next)) return;
|
|
18156
|
+
if (monthIndex !== null && next && parseInt(next, 10) > getDaysInMonth2(monthIndex, year)) {
|
|
18157
|
+
return;
|
|
18158
|
+
}
|
|
17974
18159
|
setDay(next);
|
|
17975
18160
|
emitChange(next, monthIndex, year);
|
|
17976
18161
|
if (next.length === 2 && DAY_PATTERN.test(next)) {
|
|
@@ -17980,90 +18165,20 @@ var Datepicker = React63.forwardRef(
|
|
|
17980
18165
|
const handleYearChange = (event) => {
|
|
17981
18166
|
const next = event.target.value;
|
|
17982
18167
|
if (!PARTIAL_YEAR_PATTERN.test(next)) return;
|
|
18168
|
+
const clampedDay = clampDayToMonth(day, monthIndex, next);
|
|
18169
|
+
if (clampedDay !== day) setDay(clampedDay);
|
|
17983
18170
|
setYear(next);
|
|
17984
|
-
emitChange(
|
|
17985
|
-
};
|
|
17986
|
-
const handleMonthSelect = (index) => {
|
|
17987
|
-
setMonthIndex(index);
|
|
17988
|
-
setMonthInputValue(resolvedMonthLabels[index] ?? "");
|
|
17989
|
-
setIsMonthOpen(false);
|
|
17990
|
-
emitChange(day, index, year);
|
|
17991
|
-
yearInputRef.current?.focus();
|
|
17992
|
-
};
|
|
17993
|
-
const handleMonthInputChange = (event) => {
|
|
17994
|
-
setMonthInputValue(event.target.value);
|
|
17995
|
-
setIsMonthOpen(true);
|
|
17996
|
-
setMonthHighlightIndex(0);
|
|
17997
|
-
};
|
|
17998
|
-
const commitMonthInput = React63.useCallback(() => {
|
|
17999
|
-
const query = monthInputValue.trim().toLowerCase();
|
|
18000
|
-
if (!query) {
|
|
18001
|
-
if (monthIndex !== null) {
|
|
18002
|
-
setMonthIndex(null);
|
|
18003
|
-
emitChange(day, null, year);
|
|
18004
|
-
}
|
|
18005
|
-
setMonthInputValue("");
|
|
18006
|
-
return;
|
|
18007
|
-
}
|
|
18008
|
-
const exactMatch = resolvedMonthLabels.findIndex(
|
|
18009
|
-
(label2) => label2.toLowerCase() === query
|
|
18010
|
-
);
|
|
18011
|
-
if (exactMatch >= 0) {
|
|
18012
|
-
if (exactMatch !== monthIndex) {
|
|
18013
|
-
setMonthIndex(exactMatch);
|
|
18014
|
-
emitChange(day, exactMatch, year);
|
|
18015
|
-
}
|
|
18016
|
-
setMonthInputValue(resolvedMonthLabels[exactMatch]);
|
|
18017
|
-
return;
|
|
18018
|
-
}
|
|
18019
|
-
setMonthInputValue(monthIndex !== null ? resolvedMonthLabels[monthIndex] : "");
|
|
18020
|
-
}, [day, emitChange, monthIndex, monthInputValue, resolvedMonthLabels, year]);
|
|
18021
|
-
const handleMonthInputKeyDown = (event) => {
|
|
18022
|
-
if (isBlocked) return;
|
|
18023
|
-
if (event.key === "ArrowDown") {
|
|
18024
|
-
event.preventDefault();
|
|
18025
|
-
setIsMonthOpen(true);
|
|
18026
|
-
setMonthHighlightIndex(
|
|
18027
|
-
(prev) => filteredMonths.length === 0 ? -1 : Math.min(prev + 1, filteredMonths.length - 1)
|
|
18028
|
-
);
|
|
18029
|
-
return;
|
|
18030
|
-
}
|
|
18031
|
-
if (event.key === "ArrowUp") {
|
|
18032
|
-
event.preventDefault();
|
|
18033
|
-
setIsMonthOpen(true);
|
|
18034
|
-
setMonthHighlightIndex((prev) => Math.max(prev - 1, 0));
|
|
18035
|
-
return;
|
|
18036
|
-
}
|
|
18037
|
-
if (event.key === "Enter") {
|
|
18038
|
-
if (!isMonthOpen) return;
|
|
18039
|
-
event.preventDefault();
|
|
18040
|
-
const target = filteredMonths[monthHighlightIndex];
|
|
18041
|
-
if (target) {
|
|
18042
|
-
handleMonthSelect(target.index);
|
|
18043
|
-
} else {
|
|
18044
|
-
commitMonthInput();
|
|
18045
|
-
}
|
|
18046
|
-
return;
|
|
18047
|
-
}
|
|
18048
|
-
if (event.key === "Escape") {
|
|
18049
|
-
event.preventDefault();
|
|
18050
|
-
setIsMonthOpen(false);
|
|
18051
|
-
setMonthInputValue(monthIndex !== null ? resolvedMonthLabels[monthIndex] : "");
|
|
18052
|
-
return;
|
|
18053
|
-
}
|
|
18054
|
-
if (event.key === "Tab") {
|
|
18055
|
-
setIsMonthOpen(false);
|
|
18056
|
-
}
|
|
18171
|
+
emitChange(clampedDay, monthIndex, next);
|
|
18057
18172
|
};
|
|
18058
|
-
const focusDayInput =
|
|
18173
|
+
const focusDayInput = React64.useCallback(() => {
|
|
18059
18174
|
if (isBlocked || readOnly) return;
|
|
18060
18175
|
dayInputRef.current?.focus();
|
|
18061
18176
|
}, [isBlocked, readOnly]);
|
|
18062
|
-
const openWheel =
|
|
18177
|
+
const openWheel = React64.useCallback(() => {
|
|
18063
18178
|
if (isBlocked || readOnly) return;
|
|
18064
18179
|
setIsWheelOpen(true);
|
|
18065
18180
|
}, [isBlocked, readOnly]);
|
|
18066
|
-
const closeWheel =
|
|
18181
|
+
const closeWheel = React64.useCallback(() => {
|
|
18067
18182
|
setIsWheelOpen(false);
|
|
18068
18183
|
mobileTriggerRef.current?.focus();
|
|
18069
18184
|
}, []);
|
|
@@ -18075,33 +18190,33 @@ var Datepicker = React63.forwardRef(
|
|
|
18075
18190
|
minDate,
|
|
18076
18191
|
maxDate
|
|
18077
18192
|
});
|
|
18078
|
-
const handleWheelDone =
|
|
18193
|
+
const handleWheelDone = React64.useCallback(() => {
|
|
18079
18194
|
const next = wheel.draftDate;
|
|
18080
18195
|
setDay(String(next.getDate()));
|
|
18081
18196
|
setMonthIndex(next.getMonth());
|
|
18082
18197
|
setYear(String(next.getFullYear()));
|
|
18198
|
+
lastEmittedRef.current = next;
|
|
18083
18199
|
onChange?.(next, name);
|
|
18084
18200
|
setIsWheelOpen(false);
|
|
18085
18201
|
mobileTriggerRef.current?.focus();
|
|
18086
18202
|
}, [name, onChange, wheel.draftDate]);
|
|
18087
|
-
const defaultFormatValue =
|
|
18203
|
+
const defaultFormatValue = React64.useCallback(
|
|
18088
18204
|
(date) => `${date.getDate()} ${resolvedMonthLabels[date.getMonth()]} ${date.getFullYear()}`,
|
|
18089
18205
|
[resolvedMonthLabels]
|
|
18090
18206
|
);
|
|
18091
18207
|
const triggerText = currentDate ? (formatValue ?? defaultFormatValue)(currentDate) : void 0;
|
|
18092
18208
|
const monthListboxId = `${monthId}-listbox`;
|
|
18093
18209
|
const getMonthOptionId = (index) => `${monthId}-option-${index}`;
|
|
18094
|
-
const monthPanelContent = filteredMonths.length === 0 ? /* @__PURE__ */ jsx172("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ jsx172(
|
|
18210
|
+
const monthPanelContent = monthCombobox.filteredMonths.length === 0 ? /* @__PURE__ */ jsx172("div", { className: "px-4 py-3 text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: t("no_options") }) : /* @__PURE__ */ jsx172(
|
|
18095
18211
|
"ul",
|
|
18096
18212
|
{
|
|
18097
|
-
ref: monthListRef,
|
|
18098
18213
|
id: monthListboxId,
|
|
18099
18214
|
role: "listbox",
|
|
18100
18215
|
"aria-labelledby": labelId,
|
|
18101
18216
|
className: "m-0 max-h-[260px] list-none overflow-y-auto p-1",
|
|
18102
|
-
children: filteredMonths.map((option, position) => {
|
|
18217
|
+
children: monthCombobox.filteredMonths.map((option, position) => {
|
|
18103
18218
|
const isSelected = option.index === monthIndex;
|
|
18104
|
-
const isHighlighted = position ===
|
|
18219
|
+
const isHighlighted = position === monthCombobox.highlightIndex;
|
|
18105
18220
|
return /* @__PURE__ */ jsx172("li", { role: "presentation", children: /* @__PURE__ */ jsx172(
|
|
18106
18221
|
"button",
|
|
18107
18222
|
{
|
|
@@ -18111,8 +18226,8 @@ var Datepicker = React63.forwardRef(
|
|
|
18111
18226
|
"aria-selected": isSelected,
|
|
18112
18227
|
tabIndex: -1,
|
|
18113
18228
|
onMouseDown: (event) => event.preventDefault(),
|
|
18114
|
-
onMouseMove: () =>
|
|
18115
|
-
onClick: () =>
|
|
18229
|
+
onMouseMove: () => monthCombobox.setHighlightIndex(position),
|
|
18230
|
+
onClick: () => monthCombobox.selectMonth(option.index),
|
|
18116
18231
|
className: cn(
|
|
18117
18232
|
"flex w-full items-center justify-start rounded-md border-0 bg-transparent px-3 py-[10px] text-left text-[16px] font-medium text-[var(--chekin-color-brand-navy)] outline-none transition-colors",
|
|
18118
18233
|
isHighlighted && "bg-[var(--chekin-color-surface-pressed)] text-[var(--chekin-color-brand-blue)]",
|
|
@@ -18152,6 +18267,7 @@ var Datepicker = React63.forwardRef(
|
|
|
18152
18267
|
"aria-expanded": isWheelOpen,
|
|
18153
18268
|
"aria-labelledby": labelId,
|
|
18154
18269
|
"aria-invalid": isInvalid,
|
|
18270
|
+
"aria-describedby": errorDescribedBy,
|
|
18155
18271
|
"aria-busy": loading,
|
|
18156
18272
|
disabled: isBlocked || readOnly,
|
|
18157
18273
|
onClick: openWheel,
|
|
@@ -18196,6 +18312,7 @@ var Datepicker = React63.forwardRef(
|
|
|
18196
18312
|
disabled: isBlocked,
|
|
18197
18313
|
readOnly,
|
|
18198
18314
|
"aria-invalid": isInvalid,
|
|
18315
|
+
"aria-describedby": errorDescribedBy,
|
|
18199
18316
|
"aria-labelledby": labelId,
|
|
18200
18317
|
onChange: handleDayChange,
|
|
18201
18318
|
onFocus: (event) => {
|
|
@@ -18221,36 +18338,39 @@ var Datepicker = React63.forwardRef(
|
|
|
18221
18338
|
role: "combobox",
|
|
18222
18339
|
autoComplete: "off",
|
|
18223
18340
|
"aria-haspopup": "listbox",
|
|
18224
|
-
"aria-expanded":
|
|
18341
|
+
"aria-expanded": monthCombobox.isOpen,
|
|
18225
18342
|
"aria-controls": monthListboxId,
|
|
18226
18343
|
"aria-autocomplete": "list",
|
|
18227
|
-
"aria-activedescendant":
|
|
18344
|
+
"aria-activedescendant": monthCombobox.highlightIndex >= 0 && monthCombobox.filteredMonths[monthCombobox.highlightIndex] ? getMonthOptionId(
|
|
18345
|
+
monthCombobox.filteredMonths[monthCombobox.highlightIndex].index
|
|
18346
|
+
) : void 0,
|
|
18228
18347
|
"aria-labelledby": labelId,
|
|
18229
18348
|
"aria-invalid": isInvalid,
|
|
18349
|
+
"aria-describedby": errorDescribedBy,
|
|
18230
18350
|
name: name ? `${name}-month` : void 0,
|
|
18231
|
-
value:
|
|
18351
|
+
value: monthCombobox.inputValue,
|
|
18232
18352
|
placeholder: resolvedMonthPlaceholder,
|
|
18233
18353
|
disabled: isBlocked,
|
|
18234
18354
|
readOnly,
|
|
18235
|
-
onChange:
|
|
18355
|
+
onChange: monthCombobox.handleInputChange,
|
|
18236
18356
|
onFocus: (event) => {
|
|
18237
18357
|
onFocus?.(event);
|
|
18238
18358
|
onFieldFocus?.("month");
|
|
18239
18359
|
setFocusedField("month");
|
|
18240
18360
|
if (!isBlocked && !readOnly) {
|
|
18241
|
-
|
|
18361
|
+
monthCombobox.setIsOpen(true);
|
|
18242
18362
|
monthInputRef.current?.select();
|
|
18243
18363
|
}
|
|
18244
18364
|
},
|
|
18245
18365
|
onBlur: () => {
|
|
18246
18366
|
onFieldBlur?.("month");
|
|
18247
18367
|
setFocusedField(null);
|
|
18248
|
-
|
|
18368
|
+
monthCombobox.commitInput();
|
|
18249
18369
|
},
|
|
18250
18370
|
onClick: () => {
|
|
18251
|
-
if (!isBlocked && !readOnly)
|
|
18371
|
+
if (!isBlocked && !readOnly) monthCombobox.setIsOpen(true);
|
|
18252
18372
|
},
|
|
18253
|
-
onKeyDown:
|
|
18373
|
+
onKeyDown: monthCombobox.handleInputKeyDown,
|
|
18254
18374
|
className: cn(
|
|
18255
18375
|
"m-0 box-border h-full w-full min-w-0 border-0 bg-transparent text-center text-[16px] font-medium leading-5 outline-none placeholder:text-[length:var(--field-placeholder-font-size)] placeholder:font-[var(--field-placeholder-font-weight)] placeholder:text-[var(--chekin-color-gray-1)]",
|
|
18256
18376
|
monthIndex !== null ? "text-[var(--chekin-color-brand-navy)]" : "text-[var(--chekin-color-gray-1)]",
|
|
@@ -18265,12 +18385,12 @@ var Datepicker = React63.forwardRef(
|
|
|
18265
18385
|
onMouseDown: (event) => {
|
|
18266
18386
|
event.preventDefault();
|
|
18267
18387
|
if (isBlocked || readOnly) return;
|
|
18268
|
-
|
|
18388
|
+
monthCombobox.setIsOpen((prev) => !prev);
|
|
18269
18389
|
monthInputRef.current?.focus();
|
|
18270
18390
|
},
|
|
18271
18391
|
className: cn(
|
|
18272
18392
|
"shrink-0 cursor-pointer text-[var(--chekin-color-gray-2)] transition-transform duration-200",
|
|
18273
|
-
|
|
18393
|
+
monthCombobox.isOpen && "rotate-180 text-[var(--chekin-color-brand-blue)]"
|
|
18274
18394
|
)
|
|
18275
18395
|
}
|
|
18276
18396
|
)
|
|
@@ -18289,6 +18409,7 @@ var Datepicker = React63.forwardRef(
|
|
|
18289
18409
|
disabled: isBlocked,
|
|
18290
18410
|
readOnly,
|
|
18291
18411
|
"aria-invalid": isInvalid,
|
|
18412
|
+
"aria-describedby": errorDescribedBy,
|
|
18292
18413
|
"aria-labelledby": labelId,
|
|
18293
18414
|
onChange: handleYearChange,
|
|
18294
18415
|
onFocus: (event) => {
|
|
@@ -18333,7 +18454,7 @@ var Datepicker = React63.forwardRef(
|
|
|
18333
18454
|
onClick: isMobile3 ? openWheel : showCoverage ? focusDayInput : void 0
|
|
18334
18455
|
}
|
|
18335
18456
|
),
|
|
18336
|
-
|
|
18457
|
+
monthCombobox.isOpen && !isMobile3 && /* @__PURE__ */ jsx172("div", { className: "absolute left-0 right-0 top-full z-30 mx-auto mt-1 w-full max-w-[260px] overflow-hidden rounded-md bg-white shadow-[0_30px_30px_0_rgba(33,72,255,0.2)] sm:left-1/2 sm:right-auto sm:-translate-x-1/2", children: monthPanelContent })
|
|
18337
18458
|
] }),
|
|
18338
18459
|
isMobile3 && /* @__PURE__ */ jsx172(
|
|
18339
18460
|
AirbnbDatePickerContent,
|
|
@@ -18363,13 +18484,13 @@ var Datepicker = React63.forwardRef(
|
|
|
18363
18484
|
onOptionSelect: wheel.handleOptionSelect
|
|
18364
18485
|
}
|
|
18365
18486
|
),
|
|
18366
|
-
!
|
|
18367
|
-
!
|
|
18368
|
-
|
|
18487
|
+
!resolvedError && optional && /* @__PURE__ */ jsx172("span", { className: "mt-[1px] block text-left text-[14px] font-medium text-[var(--chekin-color-gray-1)]", children: typeof optional === "string" ? optional : t("optional") }),
|
|
18488
|
+
!resolvedError && helperText && /* @__PURE__ */ jsx172("span", { className: "mt-[1px] block text-[12px] font-normal text-[var(--chekin-color-gray-1)]", children: helperText }),
|
|
18489
|
+
resolvedError && !hideErrorMessage && /* @__PURE__ */ jsx172(
|
|
18369
18490
|
FieldErrorMessage,
|
|
18370
18491
|
{
|
|
18371
18492
|
id: errorId,
|
|
18372
|
-
message:
|
|
18493
|
+
message: resolvedError,
|
|
18373
18494
|
className: "mt-[1px] text-[14px]"
|
|
18374
18495
|
}
|
|
18375
18496
|
)
|
|
@@ -18380,7 +18501,7 @@ var Datepicker = React63.forwardRef(
|
|
|
18380
18501
|
);
|
|
18381
18502
|
|
|
18382
18503
|
// src/fields/date-range-picker/DateRangePicker.tsx
|
|
18383
|
-
import * as
|
|
18504
|
+
import * as React68 from "react";
|
|
18384
18505
|
import { useTranslation as useTranslation39 } from "react-i18next";
|
|
18385
18506
|
|
|
18386
18507
|
// src/fields/date-range-picker/isDayBlocked.ts
|
|
@@ -18459,7 +18580,7 @@ var createDisabledMatchers = ({
|
|
|
18459
18580
|
};
|
|
18460
18581
|
|
|
18461
18582
|
// src/fields/date-range-picker/hooks/useRangeValue.ts
|
|
18462
|
-
import * as
|
|
18583
|
+
import * as React65 from "react";
|
|
18463
18584
|
var getRangeKey = (range) => `${range?.from?.getTime() ?? ""}-${range?.to?.getTime() ?? ""}`;
|
|
18464
18585
|
function useRangeValue({
|
|
18465
18586
|
value: externalValue,
|
|
@@ -18468,10 +18589,10 @@ function useRangeValue({
|
|
|
18468
18589
|
name
|
|
18469
18590
|
}) {
|
|
18470
18591
|
const isControlled = externalValue !== void 0;
|
|
18471
|
-
const [draft, setDraft] =
|
|
18592
|
+
const [draft, setDraft] = React65.useState(
|
|
18472
18593
|
isControlled ? externalValue : defaultValue
|
|
18473
18594
|
);
|
|
18474
|
-
const lastExternalKeyRef =
|
|
18595
|
+
const lastExternalKeyRef = React65.useRef(getRangeKey(externalValue));
|
|
18475
18596
|
if (isControlled) {
|
|
18476
18597
|
const externalKey = getRangeKey(externalValue);
|
|
18477
18598
|
if (externalKey !== lastExternalKeyRef.current) {
|
|
@@ -18479,7 +18600,7 @@ function useRangeValue({
|
|
|
18479
18600
|
setDraft(externalValue);
|
|
18480
18601
|
}
|
|
18481
18602
|
}
|
|
18482
|
-
const commit =
|
|
18603
|
+
const commit = React65.useCallback(
|
|
18483
18604
|
(next) => {
|
|
18484
18605
|
setDraft(next);
|
|
18485
18606
|
if (next === void 0) {
|
|
@@ -18494,7 +18615,7 @@ function useRangeValue({
|
|
|
18494
18615
|
}
|
|
18495
18616
|
|
|
18496
18617
|
// src/fields/date-range-picker/hooks/useRangeTextInputs.ts
|
|
18497
|
-
import * as
|
|
18618
|
+
import * as React66 from "react";
|
|
18498
18619
|
|
|
18499
18620
|
// src/fields/date-range-picker/utils/inputFormat.ts
|
|
18500
18621
|
function parseDateInputFormat(format2) {
|
|
@@ -18584,18 +18705,18 @@ function useRangeTextInputs({
|
|
|
18584
18705
|
onFromComplete,
|
|
18585
18706
|
onToComplete
|
|
18586
18707
|
}) {
|
|
18587
|
-
const tokens =
|
|
18708
|
+
const tokens = React66.useMemo(
|
|
18588
18709
|
() => parseDateInputFormat(displayFormat),
|
|
18589
18710
|
[displayFormat]
|
|
18590
18711
|
);
|
|
18591
|
-
const maxDigits =
|
|
18592
|
-
const [fromText, setFromText] =
|
|
18593
|
-
const [toText, setToText] =
|
|
18594
|
-
|
|
18712
|
+
const maxDigits = React66.useMemo(() => getMaxDigits(tokens), [tokens]);
|
|
18713
|
+
const [fromText, setFromText] = React66.useState(value?.from ? format2(value.from) : "");
|
|
18714
|
+
const [toText, setToText] = React66.useState(value?.to ? format2(value.to) : "");
|
|
18715
|
+
React66.useEffect(() => {
|
|
18595
18716
|
setFromText(value?.from ? format2(value.from) : "");
|
|
18596
18717
|
setToText(value?.to ? format2(value.to) : "");
|
|
18597
18718
|
}, [format2, value?.from, value?.to]);
|
|
18598
|
-
const handleFromChange =
|
|
18719
|
+
const handleFromChange = React66.useCallback(
|
|
18599
18720
|
(raw) => {
|
|
18600
18721
|
const formatted = autoFormatDateInput(raw, tokens);
|
|
18601
18722
|
const wasComplete = countDigits(fromText) === maxDigits;
|
|
@@ -18607,7 +18728,7 @@ function useRangeTextInputs({
|
|
|
18607
18728
|
},
|
|
18608
18729
|
[fromText, maxDigits, onFromComplete, parse3, tokens]
|
|
18609
18730
|
);
|
|
18610
|
-
const handleToChange =
|
|
18731
|
+
const handleToChange = React66.useCallback(
|
|
18611
18732
|
(raw) => {
|
|
18612
18733
|
const formatted = autoFormatDateInput(raw, tokens);
|
|
18613
18734
|
const wasComplete = countDigits(toText) === maxDigits;
|
|
@@ -18619,7 +18740,7 @@ function useRangeTextInputs({
|
|
|
18619
18740
|
},
|
|
18620
18741
|
[maxDigits, onToComplete, parse3, toText, tokens]
|
|
18621
18742
|
);
|
|
18622
|
-
const handleFromBlur =
|
|
18743
|
+
const handleFromBlur = React66.useCallback(() => {
|
|
18623
18744
|
if (!fromText) {
|
|
18624
18745
|
const next = { from: void 0, to: value?.to };
|
|
18625
18746
|
onCommit(next);
|
|
@@ -18636,7 +18757,7 @@ function useRangeTextInputs({
|
|
|
18636
18757
|
setFromText(value?.from ? format2(value.from) : "");
|
|
18637
18758
|
return void 0;
|
|
18638
18759
|
}, [format2, fromText, onBlur, onCommit, parse3, value]);
|
|
18639
|
-
const handleToBlur =
|
|
18760
|
+
const handleToBlur = React66.useCallback(() => {
|
|
18640
18761
|
if (!toText) {
|
|
18641
18762
|
const next = { from: value?.from, to: void 0 };
|
|
18642
18763
|
onCommit(next);
|
|
@@ -18665,21 +18786,21 @@ function useRangeTextInputs({
|
|
|
18665
18786
|
}
|
|
18666
18787
|
|
|
18667
18788
|
// src/fields/date-range-picker/hooks/useRangeMonthSync.ts
|
|
18668
|
-
import * as
|
|
18789
|
+
import * as React67 from "react";
|
|
18669
18790
|
function useRangeMonthSync(value) {
|
|
18670
|
-
const isPreloadedRef =
|
|
18671
|
-
const [month, setMonth] =
|
|
18672
|
-
|
|
18791
|
+
const isPreloadedRef = React67.useRef(false);
|
|
18792
|
+
const [month, setMonth] = React67.useState(value?.from ?? /* @__PURE__ */ new Date());
|
|
18793
|
+
React67.useEffect(() => {
|
|
18673
18794
|
if (value?.from && !isPreloadedRef.current) {
|
|
18674
18795
|
setMonth(value.from);
|
|
18675
18796
|
isPreloadedRef.current = true;
|
|
18676
18797
|
}
|
|
18677
18798
|
}, [value?.from]);
|
|
18678
|
-
const syncMonthToValue =
|
|
18799
|
+
const syncMonthToValue = React67.useCallback((next) => {
|
|
18679
18800
|
isPreloadedRef.current = true;
|
|
18680
18801
|
if (next?.from) setMonth(next.from);
|
|
18681
18802
|
}, []);
|
|
18682
|
-
const resetPreload =
|
|
18803
|
+
const resetPreload = React67.useCallback(() => {
|
|
18683
18804
|
isPreloadedRef.current = false;
|
|
18684
18805
|
}, []);
|
|
18685
18806
|
return { month, setMonth, syncMonthToValue, resetPreload };
|
|
@@ -18947,7 +19068,7 @@ function DateRangePopover({
|
|
|
18947
19068
|
|
|
18948
19069
|
// src/fields/date-range-picker/DateRangePicker.tsx
|
|
18949
19070
|
import { jsx as jsx176, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
18950
|
-
var DateRangePicker =
|
|
19071
|
+
var DateRangePicker = React68.forwardRef(function DateRangePicker2({
|
|
18951
19072
|
label,
|
|
18952
19073
|
value: externalValue,
|
|
18953
19074
|
defaultValue,
|
|
@@ -18982,20 +19103,20 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
18982
19103
|
components: customComponents,
|
|
18983
19104
|
...dayPickerProps
|
|
18984
19105
|
}, ref) {
|
|
18985
|
-
const containerRef =
|
|
18986
|
-
const fromInputRef =
|
|
18987
|
-
const toInputRef =
|
|
18988
|
-
const reactId =
|
|
19106
|
+
const containerRef = React68.useRef(null);
|
|
19107
|
+
const fromInputRef = React68.useRef(null);
|
|
19108
|
+
const toInputRef = React68.useRef(null);
|
|
19109
|
+
const reactId = React68.useId();
|
|
18989
19110
|
const baseId = name ?? `dash-daterange-${reactId}`;
|
|
18990
19111
|
const fromId = `${baseId}-from`;
|
|
18991
19112
|
const toId = `${baseId}-to`;
|
|
18992
19113
|
const labelId = `${baseId}-label`;
|
|
18993
19114
|
const errorId = `${baseId}-error`;
|
|
18994
|
-
const normalizedValue =
|
|
19115
|
+
const normalizedValue = React68.useMemo(() => {
|
|
18995
19116
|
if (externalValue === void 0) return void 0;
|
|
18996
19117
|
return { from: toDate(externalValue?.from), to: toDate(externalValue?.to) };
|
|
18997
19118
|
}, [externalValue]);
|
|
18998
|
-
const normalizedDefaultValue =
|
|
19119
|
+
const normalizedDefaultValue = React68.useMemo(() => {
|
|
18999
19120
|
if (defaultValue === void 0) return void 0;
|
|
19000
19121
|
return { from: toDate(defaultValue?.from), to: toDate(defaultValue?.to) };
|
|
19001
19122
|
}, [defaultValue]);
|
|
@@ -19005,16 +19126,16 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19005
19126
|
onChange,
|
|
19006
19127
|
name
|
|
19007
19128
|
});
|
|
19008
|
-
const normalizedMinDate =
|
|
19009
|
-
const normalizedMaxDate =
|
|
19010
|
-
const formatter =
|
|
19011
|
-
const parser =
|
|
19012
|
-
const closeCalendarRef =
|
|
19129
|
+
const normalizedMinDate = React68.useMemo(() => toDate(minDate), [minDate]);
|
|
19130
|
+
const normalizedMaxDate = React68.useMemo(() => toDate(maxDate), [maxDate]);
|
|
19131
|
+
const formatter = React68.useMemo(() => formatDate(displayFormat), [displayFormat]);
|
|
19132
|
+
const parser = React68.useMemo(() => parseDate(displayFormat), [displayFormat]);
|
|
19133
|
+
const closeCalendarRef = React68.useRef(() => {
|
|
19013
19134
|
});
|
|
19014
|
-
const handleFromComplete =
|
|
19135
|
+
const handleFromComplete = React68.useCallback(() => {
|
|
19015
19136
|
toInputRef.current?.focus();
|
|
19016
19137
|
}, []);
|
|
19017
|
-
const handleToComplete =
|
|
19138
|
+
const handleToComplete = React68.useCallback(() => {
|
|
19018
19139
|
toInputRef.current?.blur();
|
|
19019
19140
|
closeCalendarRef.current();
|
|
19020
19141
|
}, []);
|
|
@@ -19038,9 +19159,9 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19038
19159
|
onToComplete: handleToComplete
|
|
19039
19160
|
});
|
|
19040
19161
|
const { month, setMonth, syncMonthToValue } = useRangeMonthSync(value);
|
|
19041
|
-
const [isOpen, setIsOpen] =
|
|
19042
|
-
const [focusedInput, setFocusedInput] =
|
|
19043
|
-
const [autoFocus, setAutoFocus] =
|
|
19162
|
+
const [isOpen, setIsOpen] = React68.useState(false);
|
|
19163
|
+
const [focusedInput, setFocusedInput] = React68.useState(null);
|
|
19164
|
+
const [autoFocus, setAutoFocus] = React68.useState(false);
|
|
19044
19165
|
const isMobile3 = useIsMobile();
|
|
19045
19166
|
const { t } = useTranslation39();
|
|
19046
19167
|
const drawerTitle = label ?? t("select_dates");
|
|
@@ -19051,14 +19172,14 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19051
19172
|
const isFocused = focusedInput !== null || isOpen;
|
|
19052
19173
|
const wrapperWidth = toCssSize(width);
|
|
19053
19174
|
const monthsToShow = numberOfMonths ?? (isMobile3 ? 1 : 2);
|
|
19054
|
-
const closeCalendar =
|
|
19175
|
+
const closeCalendar = React68.useCallback(() => {
|
|
19055
19176
|
setIsOpen(false);
|
|
19056
19177
|
setFocusedInput(null);
|
|
19057
19178
|
setAutoFocus(false);
|
|
19058
19179
|
if (value?.from) setMonth(value.from);
|
|
19059
19180
|
}, [setMonth, value?.from]);
|
|
19060
19181
|
closeCalendarRef.current = closeCalendar;
|
|
19061
|
-
const openCalendar =
|
|
19182
|
+
const openCalendar = React68.useCallback(() => {
|
|
19062
19183
|
if (isBlocked || readOnly) return;
|
|
19063
19184
|
setIsOpen(true);
|
|
19064
19185
|
}, [isBlocked, readOnly]);
|
|
@@ -19067,7 +19188,7 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19067
19188
|
onOutsideClick: closeCalendar,
|
|
19068
19189
|
isDisabled: !isOpen || isMobile3
|
|
19069
19190
|
});
|
|
19070
|
-
const handlePickerChange =
|
|
19191
|
+
const handlePickerChange = React68.useCallback(
|
|
19071
19192
|
(range, pickedDate) => {
|
|
19072
19193
|
const { next, shouldClose } = resolveRangeSelection({
|
|
19073
19194
|
previous: value,
|
|
@@ -19088,7 +19209,7 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19088
19209
|
setToText("");
|
|
19089
19210
|
setMonth(/* @__PURE__ */ new Date());
|
|
19090
19211
|
};
|
|
19091
|
-
const disabledMatchers =
|
|
19212
|
+
const disabledMatchers = React68.useMemo(
|
|
19092
19213
|
() => createDisabledMatchers({
|
|
19093
19214
|
minDate: normalizedMinDate,
|
|
19094
19215
|
maxDate: normalizedMaxDate,
|
|
@@ -19107,7 +19228,7 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19107
19228
|
openCalendar();
|
|
19108
19229
|
if (autoFocusOnOpen) setAutoFocus(true);
|
|
19109
19230
|
};
|
|
19110
|
-
|
|
19231
|
+
React68.useImperativeHandle(
|
|
19111
19232
|
ref,
|
|
19112
19233
|
() => ({
|
|
19113
19234
|
setDateRange: (range) => {
|
|
@@ -19288,7 +19409,7 @@ var DateRangePicker = React67.forwardRef(function DateRangePicker2({
|
|
|
19288
19409
|
});
|
|
19289
19410
|
|
|
19290
19411
|
// src/fields/date-range-picker/useValidateDates.ts
|
|
19291
|
-
import * as
|
|
19412
|
+
import * as React69 from "react";
|
|
19292
19413
|
import { useTranslation as useTranslation40 } from "react-i18next";
|
|
19293
19414
|
import { differenceInDays as differenceInDays2, isAfter as isAfter2, isBefore as isBefore3 } from "date-fns";
|
|
19294
19415
|
import {
|
|
@@ -19314,11 +19435,11 @@ function useValidateDates({
|
|
|
19314
19435
|
const { t } = useTranslation40();
|
|
19315
19436
|
const handleError = useEvent(onError);
|
|
19316
19437
|
const handleSuccess = useEvent(onSuccess);
|
|
19317
|
-
const errorFormatter =
|
|
19438
|
+
const errorFormatter = React69.useMemo(
|
|
19318
19439
|
() => formatDate(displayFormat ?? DEFAULT_DISPLAY_FORMAT),
|
|
19319
19440
|
[displayFormat]
|
|
19320
19441
|
);
|
|
19321
|
-
const validateDates =
|
|
19442
|
+
const validateDates = React69.useCallback(
|
|
19322
19443
|
(dates) => {
|
|
19323
19444
|
const startDate = dates?.from;
|
|
19324
19445
|
const endDate = dates?.to;
|
|
@@ -19368,7 +19489,7 @@ function useValidateDates({
|
|
|
19368
19489
|
}
|
|
19369
19490
|
|
|
19370
19491
|
// src/fields/time-picker/TimePicker.tsx
|
|
19371
|
-
import * as
|
|
19492
|
+
import * as React70 from "react";
|
|
19372
19493
|
import { addDays, addHours, addMinutes, format, parse as parse2 } from "date-fns";
|
|
19373
19494
|
import { jsx as jsx177 } from "react/jsx-runtime";
|
|
19374
19495
|
var SHORT_TIME_FORMAT = "HH:mm";
|
|
@@ -19412,8 +19533,8 @@ var FORMAT_SETTINGS = {
|
|
|
19412
19533
|
},
|
|
19413
19534
|
hours: { interval_unit: "H", interval: 1, min_time: "00:00", max_time: "23:00" }
|
|
19414
19535
|
};
|
|
19415
|
-
var TimePicker =
|
|
19416
|
-
const resolvedOptions =
|
|
19536
|
+
var TimePicker = React70.forwardRef(function TimePicker2({ format: formatName = "time", timeSettings, options, ...selectProps }, ref) {
|
|
19537
|
+
const resolvedOptions = React70.useMemo(() => {
|
|
19417
19538
|
if (options) return options;
|
|
19418
19539
|
const settings = timeSettings ?? FORMAT_SETTINGS[formatName];
|
|
19419
19540
|
return buildOptions(settings);
|
|
@@ -19422,14 +19543,14 @@ var TimePicker = React69.forwardRef(function TimePicker2({ format: formatName =
|
|
|
19422
19543
|
});
|
|
19423
19544
|
|
|
19424
19545
|
// src/fields/file-input/FileInput.tsx
|
|
19425
|
-
import * as
|
|
19546
|
+
import * as React71 from "react";
|
|
19426
19547
|
import { Download, Paperclip, SquareX as SquareX5 } from "lucide-react";
|
|
19427
19548
|
import { useTranslation as useTranslation41 } from "react-i18next";
|
|
19428
19549
|
import { jsx as jsx178, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
19429
19550
|
function defaultDownload(url) {
|
|
19430
19551
|
window.open(url, "_blank", "noopener,noreferrer");
|
|
19431
19552
|
}
|
|
19432
|
-
var FileInput =
|
|
19553
|
+
var FileInput = React71.forwardRef(function FileInput2({
|
|
19433
19554
|
label,
|
|
19434
19555
|
value,
|
|
19435
19556
|
onChange,
|
|
@@ -19452,12 +19573,12 @@ var FileInput = React70.forwardRef(function FileInput2({
|
|
|
19452
19573
|
width,
|
|
19453
19574
|
downloadLabel
|
|
19454
19575
|
}, ref) {
|
|
19455
|
-
const internalRef =
|
|
19576
|
+
const internalRef = React71.useRef(null);
|
|
19456
19577
|
const inputRef = useCombinedRef(ref, internalRef);
|
|
19457
19578
|
const { t } = useTranslation41();
|
|
19458
19579
|
const resolvedLabel = label ?? t("upload_file");
|
|
19459
19580
|
const resolvedDownloadLabel = downloadLabel ?? t("download_attachment");
|
|
19460
|
-
const reactId =
|
|
19581
|
+
const reactId = React71.useId();
|
|
19461
19582
|
const inputId = `${name || "dash-file"}-${reactId}`;
|
|
19462
19583
|
const labelId = `${inputId}-label`;
|
|
19463
19584
|
const errorId = `${inputId}-error`;
|
|
@@ -19602,10 +19723,10 @@ var FileInput = React70.forwardRef(function FileInput2({
|
|
|
19602
19723
|
});
|
|
19603
19724
|
|
|
19604
19725
|
// src/fields/select-icons-box/SelectIconsBox.tsx
|
|
19605
|
-
import * as
|
|
19726
|
+
import * as React72 from "react";
|
|
19606
19727
|
import { jsx as jsx179, jsxs as jsxs113 } from "react/jsx-runtime";
|
|
19607
19728
|
var FOCUSABLE_TRIGGER_SELECTOR2 = 'input:not([type="hidden"]):not([disabled]):not([readonly]), button:not([disabled])';
|
|
19608
|
-
var SelectIconsBox =
|
|
19729
|
+
var SelectIconsBox = React72.forwardRef(
|
|
19609
19730
|
function SelectIconsBox2({
|
|
19610
19731
|
children,
|
|
19611
19732
|
icons,
|
|
@@ -19621,10 +19742,10 @@ var SelectIconsBox = React71.forwardRef(
|
|
|
19621
19742
|
className,
|
|
19622
19743
|
boxClassName
|
|
19623
19744
|
}, ref) {
|
|
19624
|
-
const containerRef =
|
|
19745
|
+
const containerRef = React72.useRef(null);
|
|
19625
19746
|
const combinedContainerRef = useCombinedRef(containerRef, ref);
|
|
19626
19747
|
const isControlled = controlledOpen !== void 0;
|
|
19627
|
-
const [internalOpen, setInternalOpen] =
|
|
19748
|
+
const [internalOpen, setInternalOpen] = React72.useState(defaultOpen);
|
|
19628
19749
|
const isOpen = isControlled ? controlledOpen : internalOpen;
|
|
19629
19750
|
const setOpen = (next) => {
|
|
19630
19751
|
if (!isControlled) setInternalOpen(next);
|
|
@@ -19817,15 +19938,15 @@ var LegacyTextarea = forwardRef73(
|
|
|
19817
19938
|
LegacyTextarea.displayName = "LegacyTextarea";
|
|
19818
19939
|
|
|
19819
19940
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
19820
|
-
import * as
|
|
19941
|
+
import * as React74 from "react";
|
|
19821
19942
|
import { Calendar as Calendar2 } from "lucide-react";
|
|
19822
19943
|
|
|
19823
19944
|
// src/airbnb-fields/field-trigger/FieldTrigger.tsx
|
|
19824
|
-
import * as
|
|
19945
|
+
import * as React73 from "react";
|
|
19825
19946
|
import { Loader2 as Loader24 } from "lucide-react";
|
|
19826
19947
|
import { useTranslation as useTranslation42 } from "react-i18next";
|
|
19827
19948
|
import { Fragment as Fragment17, jsx as jsx182, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
19828
|
-
var AirbnbFieldTrigger =
|
|
19949
|
+
var AirbnbFieldTrigger = React73.forwardRef(
|
|
19829
19950
|
({
|
|
19830
19951
|
as = "button",
|
|
19831
19952
|
id,
|
|
@@ -19993,7 +20114,7 @@ AirbnbFieldTrigger.displayName = "AirbnbFieldTrigger";
|
|
|
19993
20114
|
// src/airbnb-fields/datepicker/DatePicker.tsx
|
|
19994
20115
|
import { jsx as jsx183, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
19995
20116
|
var DEFAULT_MIN_DATE = new Date(1920, 0, 1);
|
|
19996
|
-
var AirbnbDatePicker =
|
|
20117
|
+
var AirbnbDatePicker = React74.forwardRef(
|
|
19997
20118
|
({
|
|
19998
20119
|
label,
|
|
19999
20120
|
topLabel,
|
|
@@ -20018,24 +20139,24 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
20018
20139
|
formatValue = formatDateValue
|
|
20019
20140
|
}, ref) => {
|
|
20020
20141
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
20021
|
-
const [isOpen, setIsOpen] =
|
|
20022
|
-
const triggerId =
|
|
20023
|
-
const pickerId =
|
|
20024
|
-
const labelId =
|
|
20025
|
-
const valueId =
|
|
20026
|
-
const helperTextId =
|
|
20027
|
-
const errorId =
|
|
20028
|
-
const internalRef =
|
|
20142
|
+
const [isOpen, setIsOpen] = React74.useState(false);
|
|
20143
|
+
const triggerId = React74.useId();
|
|
20144
|
+
const pickerId = React74.useId();
|
|
20145
|
+
const labelId = React74.useId();
|
|
20146
|
+
const valueId = React74.useId();
|
|
20147
|
+
const helperTextId = React74.useId();
|
|
20148
|
+
const errorId = React74.useId();
|
|
20149
|
+
const internalRef = React74.useRef(null);
|
|
20029
20150
|
const combinedRef = useCombinedRef(ref, internalRef);
|
|
20030
|
-
const monthLabels =
|
|
20031
|
-
const resolvedMinDate =
|
|
20032
|
-
const resolvedMaxDate =
|
|
20033
|
-
const normalizedValue =
|
|
20034
|
-
const normalizedDefaultValue =
|
|
20151
|
+
const monthLabels = React74.useMemo(() => getMonthLabels(locale), [locale]);
|
|
20152
|
+
const resolvedMinDate = React74.useMemo(() => minDate ?? DEFAULT_MIN_DATE, [minDate]);
|
|
20153
|
+
const resolvedMaxDate = React74.useMemo(() => maxDate ?? /* @__PURE__ */ new Date(), [maxDate]);
|
|
20154
|
+
const normalizedValue = React74.useMemo(() => normalizeDateValue(value), [value]);
|
|
20155
|
+
const normalizedDefaultValue = React74.useMemo(
|
|
20035
20156
|
() => normalizeDateValue(defaultValue),
|
|
20036
20157
|
[defaultValue]
|
|
20037
20158
|
);
|
|
20038
|
-
const resolvedValue =
|
|
20159
|
+
const resolvedValue = React74.useMemo(
|
|
20039
20160
|
() => normalizedValue ? clampDate(normalizedValue, resolvedMinDate, resolvedMaxDate) : null,
|
|
20040
20161
|
[normalizedValue, resolvedMaxDate, resolvedMinDate]
|
|
20041
20162
|
);
|
|
@@ -20066,7 +20187,7 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
20066
20187
|
minDate: resolvedMinDate,
|
|
20067
20188
|
maxDate: resolvedMaxDate
|
|
20068
20189
|
});
|
|
20069
|
-
const handleOpenChange =
|
|
20190
|
+
const handleOpenChange = React74.useCallback(
|
|
20070
20191
|
(nextOpen) => {
|
|
20071
20192
|
if (isBlocked && nextOpen) return;
|
|
20072
20193
|
setIsOpen(nextOpen);
|
|
@@ -20076,7 +20197,7 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
20076
20197
|
},
|
|
20077
20198
|
[isBlocked]
|
|
20078
20199
|
);
|
|
20079
|
-
const handleDone =
|
|
20200
|
+
const handleDone = React74.useCallback(() => {
|
|
20080
20201
|
if (isBlocked) return;
|
|
20081
20202
|
onChange(clampDate(draftDate, resolvedMinDate, resolvedMaxDate));
|
|
20082
20203
|
handleOpenChange(false);
|
|
@@ -20088,11 +20209,11 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
20088
20209
|
resolvedMaxDate,
|
|
20089
20210
|
resolvedMinDate
|
|
20090
20211
|
]);
|
|
20091
|
-
const handleTriggerClick =
|
|
20212
|
+
const handleTriggerClick = React74.useCallback(() => {
|
|
20092
20213
|
if (isBlocked) return;
|
|
20093
20214
|
setIsOpen(true);
|
|
20094
20215
|
}, [isBlocked]);
|
|
20095
|
-
const handleTriggerKeyDown =
|
|
20216
|
+
const handleTriggerKeyDown = React74.useCallback(
|
|
20096
20217
|
(event) => {
|
|
20097
20218
|
if (isBlocked) return;
|
|
20098
20219
|
if (event.key === "ArrowDown" || event.key === "ArrowUp" || event.key === "Enter" || event.key === " ") {
|
|
@@ -20102,7 +20223,7 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
20102
20223
|
},
|
|
20103
20224
|
[isBlocked]
|
|
20104
20225
|
);
|
|
20105
|
-
|
|
20226
|
+
React74.useEffect(() => {
|
|
20106
20227
|
if (isBlocked) {
|
|
20107
20228
|
setIsOpen(false);
|
|
20108
20229
|
}
|
|
@@ -20185,12 +20306,12 @@ var AirbnbDatePicker = React73.forwardRef(
|
|
|
20185
20306
|
AirbnbDatePicker.displayName = "AirbnbDatePicker";
|
|
20186
20307
|
|
|
20187
20308
|
// src/airbnb-fields/input/Input.tsx
|
|
20188
|
-
import * as
|
|
20309
|
+
import * as React75 from "react";
|
|
20189
20310
|
import { Eye as Eye2 } from "lucide-react";
|
|
20190
20311
|
import { useTranslation as useTranslation43 } from "react-i18next";
|
|
20191
20312
|
import { jsx as jsx184, jsxs as jsxs118 } from "react/jsx-runtime";
|
|
20192
20313
|
var getInputValue = (value) => value != null ? String(value) : "";
|
|
20193
|
-
var AirbnbInput =
|
|
20314
|
+
var AirbnbInput = React75.forwardRef(
|
|
20194
20315
|
({
|
|
20195
20316
|
label,
|
|
20196
20317
|
topLabel,
|
|
@@ -20219,16 +20340,16 @@ var AirbnbInput = React74.forwardRef(
|
|
|
20219
20340
|
...props
|
|
20220
20341
|
}, ref) => {
|
|
20221
20342
|
const { t } = useTranslation43();
|
|
20222
|
-
const generatedId =
|
|
20223
|
-
const inputRef =
|
|
20343
|
+
const generatedId = React75.useId();
|
|
20344
|
+
const inputRef = React75.useRef(null);
|
|
20224
20345
|
const inputId = id ?? generatedId;
|
|
20225
20346
|
const fieldId = `${inputId}-field`;
|
|
20226
20347
|
const labelId = `${inputId}-label`;
|
|
20227
20348
|
const errorId = `${inputId}-error`;
|
|
20228
20349
|
const accessibleLabel = placeholder ?? label;
|
|
20229
|
-
const [isFocused, setIsFocused] =
|
|
20230
|
-
const [isPasswordRevealed, setIsPasswordRevealed] =
|
|
20231
|
-
const [currentValue, setCurrentValue] =
|
|
20350
|
+
const [isFocused, setIsFocused] = React75.useState(false);
|
|
20351
|
+
const [isPasswordRevealed, setIsPasswordRevealed] = React75.useState(false);
|
|
20352
|
+
const [currentValue, setCurrentValue] = React75.useState(
|
|
20232
20353
|
() => value != null ? getInputValue(value) : getInputValue(defaultValue)
|
|
20233
20354
|
);
|
|
20234
20355
|
const resolvedValue = value != null ? getInputValue(value) : currentValue;
|
|
@@ -20241,16 +20362,16 @@ var AirbnbInput = React74.forwardRef(
|
|
|
20241
20362
|
const triggerError = error ?? invalid;
|
|
20242
20363
|
const hasLabelMeta = Boolean(optional) || Boolean(tooltip);
|
|
20243
20364
|
const isBlocked = Boolean(disabled) || Boolean(loading);
|
|
20244
|
-
|
|
20365
|
+
React75.useLayoutEffect(() => {
|
|
20245
20366
|
const nextValue = value != null ? getInputValue(value) : getInputValue(inputRef.current?.value);
|
|
20246
20367
|
setCurrentValue((prevValue) => prevValue === nextValue ? prevValue : nextValue);
|
|
20247
20368
|
}, [value]);
|
|
20248
|
-
|
|
20369
|
+
React75.useEffect(() => {
|
|
20249
20370
|
if (!isPasswordInput) {
|
|
20250
20371
|
setIsPasswordRevealed(false);
|
|
20251
20372
|
}
|
|
20252
20373
|
}, [isPasswordInput]);
|
|
20253
|
-
const setRefs =
|
|
20374
|
+
const setRefs = React75.useCallback(
|
|
20254
20375
|
(node) => {
|
|
20255
20376
|
inputRef.current = node;
|
|
20256
20377
|
if (node && value == null) {
|
|
@@ -20283,6 +20404,12 @@ var AirbnbInput = React74.forwardRef(
|
|
|
20283
20404
|
const togglePasswordReveal = () => {
|
|
20284
20405
|
setIsPasswordRevealed((isRevealed) => !isRevealed);
|
|
20285
20406
|
};
|
|
20407
|
+
const focusInput = () => {
|
|
20408
|
+
if (isBlocked) {
|
|
20409
|
+
return;
|
|
20410
|
+
}
|
|
20411
|
+
inputRef.current?.focus();
|
|
20412
|
+
};
|
|
20286
20413
|
return /* @__PURE__ */ jsx184("div", { className: cn("w-full max-w-[var(--max-field-width)]", wrapperClassName), children: /* @__PURE__ */ jsxs118(
|
|
20287
20414
|
AirbnbFieldTrigger,
|
|
20288
20415
|
{
|
|
@@ -20300,6 +20427,7 @@ var AirbnbInput = React74.forwardRef(
|
|
|
20300
20427
|
loading,
|
|
20301
20428
|
optional,
|
|
20302
20429
|
tooltip,
|
|
20430
|
+
onClick: focusInput,
|
|
20303
20431
|
describedBy: error && renderErrorMessage ? errorId : void 0,
|
|
20304
20432
|
className: cn(
|
|
20305
20433
|
"px-4 focus-within:ring-2 focus-within:ring-[var(--chekin-airbnb-ink)] focus-within:ring-offset-2",
|
|
@@ -20370,11 +20498,11 @@ var AirbnbInput = React74.forwardRef(
|
|
|
20370
20498
|
AirbnbInput.displayName = "AirbnbInput";
|
|
20371
20499
|
|
|
20372
20500
|
// src/airbnb-fields/phone-field/PhoneField.tsx
|
|
20373
|
-
import * as
|
|
20501
|
+
import * as React81 from "react";
|
|
20374
20502
|
import { ChevronDown as ChevronDown6 } from "lucide-react";
|
|
20375
20503
|
|
|
20376
20504
|
// src/airbnb-fields/select/Select.tsx
|
|
20377
|
-
import * as
|
|
20505
|
+
import * as React80 from "react";
|
|
20378
20506
|
|
|
20379
20507
|
// src/airbnb-fields/select/SelectDesktopMenu.tsx
|
|
20380
20508
|
import { jsx as jsx185, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
@@ -20719,10 +20847,10 @@ function AirbnbSelectMobileContent({
|
|
|
20719
20847
|
}
|
|
20720
20848
|
|
|
20721
20849
|
// src/airbnb-fields/select/SelectTrigger.tsx
|
|
20722
|
-
import * as
|
|
20850
|
+
import * as React76 from "react";
|
|
20723
20851
|
import { ChevronDown as ChevronDown5 } from "lucide-react";
|
|
20724
20852
|
import { jsx as jsx189 } from "react/jsx-runtime";
|
|
20725
|
-
var AirbnbSelectTrigger =
|
|
20853
|
+
var AirbnbSelectTrigger = React76.forwardRef(
|
|
20726
20854
|
({
|
|
20727
20855
|
id,
|
|
20728
20856
|
open,
|
|
@@ -20777,6 +20905,7 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
20777
20905
|
trailingAdornment: /* @__PURE__ */ jsx189(
|
|
20778
20906
|
ChevronDown5,
|
|
20779
20907
|
{
|
|
20908
|
+
strokeWidth: "1.5",
|
|
20780
20909
|
className: open ? "h-6 w-6 rotate-180 text-[var(--chekin-airbnb-ink)] transition-transform" : "h-6 w-6 text-[var(--chekin-airbnb-ink)] transition-transform"
|
|
20781
20910
|
}
|
|
20782
20911
|
)
|
|
@@ -20787,7 +20916,7 @@ var AirbnbSelectTrigger = React75.forwardRef(
|
|
|
20787
20916
|
AirbnbSelectTrigger.displayName = "AirbnbSelectTrigger";
|
|
20788
20917
|
|
|
20789
20918
|
// src/airbnb-fields/select/useDesktopSelect.ts
|
|
20790
|
-
import * as
|
|
20919
|
+
import * as React77 from "react";
|
|
20791
20920
|
function useDesktopSelect({
|
|
20792
20921
|
isMobile: isMobile3,
|
|
20793
20922
|
isOpen,
|
|
@@ -20796,12 +20925,12 @@ function useDesktopSelect({
|
|
|
20796
20925
|
disabled,
|
|
20797
20926
|
onChange
|
|
20798
20927
|
}) {
|
|
20799
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
20800
|
-
const triggerRef =
|
|
20801
|
-
const listRef =
|
|
20802
|
-
const optionRefs =
|
|
20928
|
+
const [highlightedIndex, setHighlightedIndex] = React77.useState(-1);
|
|
20929
|
+
const triggerRef = React77.useRef(null);
|
|
20930
|
+
const listRef = React77.useRef(null);
|
|
20931
|
+
const optionRefs = React77.useRef([]);
|
|
20803
20932
|
const selectedIndex = getOptionIndex2(options, value);
|
|
20804
|
-
|
|
20933
|
+
React77.useEffect(() => {
|
|
20805
20934
|
if (!isOpen || isMobile3) return;
|
|
20806
20935
|
setHighlightedIndex((currentIndex) => {
|
|
20807
20936
|
if (currentIndex >= 0) {
|
|
@@ -20816,34 +20945,34 @@ function useDesktopSelect({
|
|
|
20816
20945
|
window.cancelAnimationFrame(frameId);
|
|
20817
20946
|
};
|
|
20818
20947
|
}, [isMobile3, isOpen, options, selectedIndex]);
|
|
20819
|
-
|
|
20948
|
+
React77.useEffect(() => {
|
|
20820
20949
|
if (!isOpen || isMobile3 || highlightedIndex < 0) return;
|
|
20821
20950
|
optionRefs.current[highlightedIndex]?.scrollIntoView({
|
|
20822
20951
|
block: "nearest"
|
|
20823
20952
|
});
|
|
20824
20953
|
}, [highlightedIndex, isMobile3, isOpen]);
|
|
20825
|
-
|
|
20954
|
+
React77.useEffect(() => {
|
|
20826
20955
|
if (isOpen) return;
|
|
20827
20956
|
setHighlightedIndex(-1);
|
|
20828
20957
|
}, [isOpen]);
|
|
20829
|
-
const focusTrigger =
|
|
20958
|
+
const focusTrigger = React77.useCallback(() => {
|
|
20830
20959
|
triggerRef.current?.focus();
|
|
20831
20960
|
}, []);
|
|
20832
|
-
const handleSelect =
|
|
20961
|
+
const handleSelect = React77.useCallback(
|
|
20833
20962
|
(option) => {
|
|
20834
20963
|
if (option.isDisabled || disabled) return;
|
|
20835
20964
|
onChange?.(option);
|
|
20836
20965
|
},
|
|
20837
20966
|
[disabled, onChange]
|
|
20838
20967
|
);
|
|
20839
|
-
const openMenu =
|
|
20968
|
+
const openMenu = React77.useCallback(
|
|
20840
20969
|
(targetIndex) => {
|
|
20841
20970
|
const fallbackIndex = selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
20842
20971
|
setHighlightedIndex(targetIndex ?? fallbackIndex);
|
|
20843
20972
|
},
|
|
20844
20973
|
[options, selectedIndex]
|
|
20845
20974
|
);
|
|
20846
|
-
const handleTriggerKeyDown =
|
|
20975
|
+
const handleTriggerKeyDown = React77.useCallback(
|
|
20847
20976
|
(event, onOpen) => {
|
|
20848
20977
|
if (disabled) return;
|
|
20849
20978
|
if (event.key === "ArrowDown") {
|
|
@@ -20868,7 +20997,7 @@ function useDesktopSelect({
|
|
|
20868
20997
|
},
|
|
20869
20998
|
[disabled, openMenu, options, selectedIndex]
|
|
20870
20999
|
);
|
|
20871
|
-
const handleMenuKeyDown =
|
|
21000
|
+
const handleMenuKeyDown = React77.useCallback(
|
|
20872
21001
|
(event, onClose) => {
|
|
20873
21002
|
if (event.key === "Escape") {
|
|
20874
21003
|
event.preventDefault();
|
|
@@ -20918,7 +21047,7 @@ function useDesktopSelect({
|
|
|
20918
21047
|
},
|
|
20919
21048
|
[focusTrigger, highlightedIndex, onChange, options]
|
|
20920
21049
|
);
|
|
20921
|
-
const setOptionRef =
|
|
21050
|
+
const setOptionRef = React77.useCallback(
|
|
20922
21051
|
(index, node) => {
|
|
20923
21052
|
optionRefs.current[index] = node;
|
|
20924
21053
|
},
|
|
@@ -20938,23 +21067,23 @@ function useDesktopSelect({
|
|
|
20938
21067
|
}
|
|
20939
21068
|
|
|
20940
21069
|
// src/airbnb-fields/select/useMobileSelectWheel.ts
|
|
20941
|
-
import * as
|
|
21070
|
+
import * as React78 from "react";
|
|
20942
21071
|
function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, disabled }) {
|
|
20943
|
-
const [pendingValue, setPendingValue] =
|
|
21072
|
+
const [pendingValue, setPendingValue] = React78.useState(
|
|
20944
21073
|
value ?? null
|
|
20945
21074
|
);
|
|
20946
|
-
const [mobileScrollTop, setMobileScrollTop] =
|
|
20947
|
-
const mobileListRef =
|
|
20948
|
-
const scrollSettleTimeoutRef =
|
|
20949
|
-
const scrollAnimationFrameRef =
|
|
20950
|
-
const getTargetIndex =
|
|
21075
|
+
const [mobileScrollTop, setMobileScrollTop] = React78.useState(0);
|
|
21076
|
+
const mobileListRef = React78.useRef(null);
|
|
21077
|
+
const scrollSettleTimeoutRef = React78.useRef(null);
|
|
21078
|
+
const scrollAnimationFrameRef = React78.useRef(null);
|
|
21079
|
+
const getTargetIndex = React78.useCallback(
|
|
20951
21080
|
(targetValue) => {
|
|
20952
21081
|
const selectedIndex = getOptionIndex2(options, targetValue);
|
|
20953
21082
|
return selectedIndex >= 0 ? selectedIndex : getFirstEnabledOptionIndex2(options);
|
|
20954
21083
|
},
|
|
20955
21084
|
[options]
|
|
20956
21085
|
);
|
|
20957
|
-
const syncScrollPosition =
|
|
21086
|
+
const syncScrollPosition = React78.useCallback(
|
|
20958
21087
|
(targetValue, behavior = "instant") => {
|
|
20959
21088
|
const targetIndex = getTargetIndex(targetValue);
|
|
20960
21089
|
if (targetIndex < 0) return;
|
|
@@ -20973,27 +21102,27 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
20973
21102
|
},
|
|
20974
21103
|
[getTargetIndex, options]
|
|
20975
21104
|
);
|
|
20976
|
-
const clearScrollSettleTimeout =
|
|
21105
|
+
const clearScrollSettleTimeout = React78.useCallback(() => {
|
|
20977
21106
|
if (scrollSettleTimeoutRef.current === null) return;
|
|
20978
21107
|
window.clearTimeout(scrollSettleTimeoutRef.current);
|
|
20979
21108
|
scrollSettleTimeoutRef.current = null;
|
|
20980
21109
|
}, []);
|
|
20981
|
-
const clearScrollAnimationFrame =
|
|
21110
|
+
const clearScrollAnimationFrame = React78.useCallback(() => {
|
|
20982
21111
|
if (scrollAnimationFrameRef.current === null) return;
|
|
20983
21112
|
window.cancelAnimationFrame(scrollAnimationFrameRef.current);
|
|
20984
21113
|
scrollAnimationFrameRef.current = null;
|
|
20985
21114
|
}, []);
|
|
20986
|
-
|
|
21115
|
+
React78.useEffect(
|
|
20987
21116
|
() => () => {
|
|
20988
21117
|
clearScrollSettleTimeout();
|
|
20989
21118
|
clearScrollAnimationFrame();
|
|
20990
21119
|
},
|
|
20991
21120
|
[clearScrollAnimationFrame, clearScrollSettleTimeout]
|
|
20992
21121
|
);
|
|
20993
|
-
|
|
21122
|
+
React78.useEffect(() => {
|
|
20994
21123
|
setPendingValue(value ?? null);
|
|
20995
21124
|
}, [value]);
|
|
20996
|
-
|
|
21125
|
+
React78.useLayoutEffect(() => {
|
|
20997
21126
|
if (!isMobile3 || !isOpen) return;
|
|
20998
21127
|
const frameId = window.requestAnimationFrame(() => {
|
|
20999
21128
|
syncScrollPosition(value ?? null, "instant");
|
|
@@ -21002,7 +21131,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21002
21131
|
window.cancelAnimationFrame(frameId);
|
|
21003
21132
|
};
|
|
21004
21133
|
}, [isMobile3, isOpen, syncScrollPosition, value]);
|
|
21005
|
-
const settleScroll =
|
|
21134
|
+
const settleScroll = React78.useCallback(() => {
|
|
21006
21135
|
if (!mobileListRef.current) return;
|
|
21007
21136
|
const nextIndex = Math.round(mobileListRef.current.scrollTop / MOBILE_OPTION_HEIGHT);
|
|
21008
21137
|
const nextOption = options[nextIndex];
|
|
@@ -21014,13 +21143,13 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21014
21143
|
}
|
|
21015
21144
|
setPendingValue(nextOption);
|
|
21016
21145
|
}, [options, pendingValue]);
|
|
21017
|
-
const scheduleScrollSettle =
|
|
21146
|
+
const scheduleScrollSettle = React78.useCallback(() => {
|
|
21018
21147
|
clearScrollSettleTimeout();
|
|
21019
21148
|
scrollSettleTimeoutRef.current = window.setTimeout(() => {
|
|
21020
21149
|
settleScroll();
|
|
21021
21150
|
}, MOBILE_SCROLL_SETTLE_DELAY);
|
|
21022
21151
|
}, [clearScrollSettleTimeout, settleScroll]);
|
|
21023
|
-
const handleScroll =
|
|
21152
|
+
const handleScroll = React78.useCallback(() => {
|
|
21024
21153
|
if (!mobileListRef.current) return;
|
|
21025
21154
|
const nextScrollTop = mobileListRef.current.scrollTop;
|
|
21026
21155
|
clearScrollAnimationFrame();
|
|
@@ -21030,7 +21159,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21030
21159
|
});
|
|
21031
21160
|
scheduleScrollSettle();
|
|
21032
21161
|
}, [clearScrollAnimationFrame, scheduleScrollSettle]);
|
|
21033
|
-
const focusOptionByIndex =
|
|
21162
|
+
const focusOptionByIndex = React78.useCallback(
|
|
21034
21163
|
(index, behavior = "instant", updatePendingImmediately = behavior === "instant") => {
|
|
21035
21164
|
if (!mobileListRef.current || index < 0 || index >= options.length) return;
|
|
21036
21165
|
const option = options[index];
|
|
@@ -21048,7 +21177,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21048
21177
|
},
|
|
21049
21178
|
[options, scheduleScrollSettle]
|
|
21050
21179
|
);
|
|
21051
|
-
const handleOptionClick =
|
|
21180
|
+
const handleOptionClick = React78.useCallback(
|
|
21052
21181
|
(option) => {
|
|
21053
21182
|
if (!mobileListRef.current || disabled || option.isDisabled) return;
|
|
21054
21183
|
const optionIndex = getOptionIndex2(options, option);
|
|
@@ -21057,7 +21186,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21057
21186
|
},
|
|
21058
21187
|
[disabled, focusOptionByIndex, options]
|
|
21059
21188
|
);
|
|
21060
|
-
const moveByStep =
|
|
21189
|
+
const moveByStep = React78.useCallback(
|
|
21061
21190
|
(step) => {
|
|
21062
21191
|
const currentIndex = getOptionIndex2(options, pendingValue);
|
|
21063
21192
|
const fallbackIndex = step === 1 ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
@@ -21069,7 +21198,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21069
21198
|
},
|
|
21070
21199
|
[focusOptionByIndex, options, pendingValue]
|
|
21071
21200
|
);
|
|
21072
|
-
const moveToBoundary =
|
|
21201
|
+
const moveToBoundary = React78.useCallback(
|
|
21073
21202
|
(boundary) => {
|
|
21074
21203
|
const targetIndex = boundary === "start" ? getFirstEnabledOptionIndex2(options) : getLastEnabledOptionIndex2(options);
|
|
21075
21204
|
if (targetIndex >= 0) {
|
|
@@ -21078,7 +21207,7 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21078
21207
|
},
|
|
21079
21208
|
[focusOptionByIndex, options]
|
|
21080
21209
|
);
|
|
21081
|
-
const syncPendingValue =
|
|
21210
|
+
const syncPendingValue = React78.useCallback(
|
|
21082
21211
|
(nextValue) => {
|
|
21083
21212
|
const normalizedValue = nextValue ?? null;
|
|
21084
21213
|
const matchedIndex = getOptionIndex2(options, normalizedValue);
|
|
@@ -21106,9 +21235,9 @@ function useMobileSelectWheel({ isMobile: isMobile3, isOpen, options, value, dis
|
|
|
21106
21235
|
}
|
|
21107
21236
|
|
|
21108
21237
|
// src/airbnb-fields/select/useSelectIds.ts
|
|
21109
|
-
import * as
|
|
21238
|
+
import * as React79 from "react";
|
|
21110
21239
|
function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
21111
|
-
const reactId =
|
|
21240
|
+
const reactId = React79.useId().replace(/:/g, "");
|
|
21112
21241
|
const baseId = name ? `select-${name}` : `select-${reactId}`;
|
|
21113
21242
|
const triggerId = `${baseId}-trigger`;
|
|
21114
21243
|
const labelId = `${baseId}-label`;
|
|
@@ -21118,7 +21247,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
21118
21247
|
const listboxId = `${baseId}-listbox`;
|
|
21119
21248
|
const describedErrorId = error && !hideErrorMessage ? errorId : void 0;
|
|
21120
21249
|
const describedBy = [!hasValue ? helperTextId : null, describedErrorId].filter(Boolean).join(" ") || void 0;
|
|
21121
|
-
const getOptionId2 =
|
|
21250
|
+
const getOptionId2 = React79.useCallback(
|
|
21122
21251
|
(index) => `${baseId}-option-${index}`,
|
|
21123
21252
|
[baseId]
|
|
21124
21253
|
);
|
|
@@ -21137,7 +21266,7 @@ function useSelectIds2({ name, hasValue, error, hideErrorMessage }) {
|
|
|
21137
21266
|
|
|
21138
21267
|
// src/airbnb-fields/select/Select.tsx
|
|
21139
21268
|
import { jsx as jsx190, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
21140
|
-
var AirbnbSelect =
|
|
21269
|
+
var AirbnbSelect = React80.forwardRef(function AirbnbSelect2({
|
|
21141
21270
|
options = [],
|
|
21142
21271
|
value,
|
|
21143
21272
|
onChange,
|
|
@@ -21164,8 +21293,8 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
21164
21293
|
filterOption
|
|
21165
21294
|
}, ref) {
|
|
21166
21295
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
21167
|
-
const [isOpen, setIsOpen] =
|
|
21168
|
-
const containerRef =
|
|
21296
|
+
const [isOpen, setIsOpen] = React80.useState(false);
|
|
21297
|
+
const containerRef = React80.useRef(null);
|
|
21169
21298
|
const filteredOptions = filterOption ? options.filter(filterOption) : options;
|
|
21170
21299
|
const hasValue = Boolean(value);
|
|
21171
21300
|
const helperText = placeholder ?? label;
|
|
@@ -21227,12 +21356,12 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
21227
21356
|
onOutsideClick: () => setIsOpen(false),
|
|
21228
21357
|
isDisabled: !isOpen || isMobile3
|
|
21229
21358
|
});
|
|
21230
|
-
|
|
21359
|
+
React80.useEffect(() => {
|
|
21231
21360
|
if (isBlocked) {
|
|
21232
21361
|
setIsOpen(false);
|
|
21233
21362
|
}
|
|
21234
21363
|
}, [isBlocked]);
|
|
21235
|
-
|
|
21364
|
+
React80.useEffect(
|
|
21236
21365
|
function setCorrectOptionIfThereIsOnlyValue() {
|
|
21237
21366
|
if (value?.value === void 0 || value.value === null || value.label !== "") {
|
|
21238
21367
|
return;
|
|
@@ -21244,7 +21373,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
21244
21373
|
},
|
|
21245
21374
|
[onChange, filteredOptions, value]
|
|
21246
21375
|
);
|
|
21247
|
-
const handleMobileOpenChange =
|
|
21376
|
+
const handleMobileOpenChange = React80.useCallback(
|
|
21248
21377
|
(nextOpen) => {
|
|
21249
21378
|
if (isBlocked && nextOpen) return;
|
|
21250
21379
|
setIsOpen(nextOpen);
|
|
@@ -21255,7 +21384,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
21255
21384
|
},
|
|
21256
21385
|
[focusTrigger, isBlocked, syncPendingValue, value]
|
|
21257
21386
|
);
|
|
21258
|
-
const handleMobileDone =
|
|
21387
|
+
const handleMobileDone = React80.useCallback(() => {
|
|
21259
21388
|
if (isBlocked) return;
|
|
21260
21389
|
const finalOption = pendingValue;
|
|
21261
21390
|
if (finalOption && finalOption.value !== value?.value) {
|
|
@@ -21264,7 +21393,7 @@ var AirbnbSelect = React79.forwardRef(function AirbnbSelect2({
|
|
|
21264
21393
|
setIsOpen(false);
|
|
21265
21394
|
focusTrigger();
|
|
21266
21395
|
}, [focusTrigger, isBlocked, onChange, pendingValue, value]);
|
|
21267
|
-
const handleTriggerClick =
|
|
21396
|
+
const handleTriggerClick = React80.useCallback(() => {
|
|
21268
21397
|
if (isBlocked) return;
|
|
21269
21398
|
setIsOpen((prev) => {
|
|
21270
21399
|
const nextOpen = !prev;
|
|
@@ -21436,7 +21565,7 @@ function formatPhoneCodeOptionLabel2(option) {
|
|
|
21436
21565
|
const value = String(option.value);
|
|
21437
21566
|
return label.includes(value) ? label : `${label} (${value})`;
|
|
21438
21567
|
}
|
|
21439
|
-
var AirbnbPhoneField =
|
|
21568
|
+
var AirbnbPhoneField = React81.forwardRef(
|
|
21440
21569
|
({
|
|
21441
21570
|
label,
|
|
21442
21571
|
topLabel,
|
|
@@ -21460,9 +21589,9 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
21460
21589
|
codePlaceholder = "+00",
|
|
21461
21590
|
defaultCode
|
|
21462
21591
|
}, ref) => {
|
|
21463
|
-
const inputId =
|
|
21592
|
+
const inputId = React81.useId();
|
|
21464
21593
|
const effectiveCode = value?.code || defaultCode || "";
|
|
21465
|
-
const codeOptions =
|
|
21594
|
+
const codeOptions = React81.useMemo(
|
|
21466
21595
|
() => options.map((option) => ({
|
|
21467
21596
|
value: option.value,
|
|
21468
21597
|
label: formatPhoneCodeOptionLabel2(option),
|
|
@@ -21470,7 +21599,7 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
21470
21599
|
})),
|
|
21471
21600
|
[options]
|
|
21472
21601
|
);
|
|
21473
|
-
const selectedCodeOption =
|
|
21602
|
+
const selectedCodeOption = React81.useMemo(
|
|
21474
21603
|
() => codeOptions.find((option) => option.value === effectiveCode) ?? null,
|
|
21475
21604
|
[codeOptions, effectiveCode]
|
|
21476
21605
|
);
|
|
@@ -21606,10 +21735,10 @@ var AirbnbPhoneField = React80.forwardRef(
|
|
|
21606
21735
|
AirbnbPhoneField.displayName = "AirbnbPhoneField";
|
|
21607
21736
|
|
|
21608
21737
|
// src/airbnb-fields/searchable-select/SearchableSelect.tsx
|
|
21609
|
-
import * as
|
|
21738
|
+
import * as React82 from "react";
|
|
21610
21739
|
import { ChevronDown as ChevronDown7, Search as Search5 } from "lucide-react";
|
|
21611
21740
|
import { useVirtualizer as useVirtualizer3 } from "@tanstack/react-virtual";
|
|
21612
|
-
import { useCallback as
|
|
21741
|
+
import { useCallback as useCallback58 } from "react";
|
|
21613
21742
|
import { jsx as jsx192, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
21614
21743
|
var ROW_HEIGHT = 48;
|
|
21615
21744
|
var DESKTOP_LIST_HEIGHT = 280;
|
|
@@ -21650,13 +21779,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21650
21779
|
loadingMessage
|
|
21651
21780
|
}, ref) => {
|
|
21652
21781
|
const { isMatch: isMobile3 } = useScreenResize(DEVICE.mobileXL);
|
|
21653
|
-
const reactId =
|
|
21654
|
-
const [open, setOpen] =
|
|
21655
|
-
const [internalSearchValue, setInternalSearchValue] =
|
|
21656
|
-
const [highlightedIndex, setHighlightedIndex] =
|
|
21657
|
-
const containerRef =
|
|
21658
|
-
const triggerRef =
|
|
21659
|
-
const inputRef =
|
|
21782
|
+
const reactId = React82.useId();
|
|
21783
|
+
const [open, setOpen] = React82.useState(false);
|
|
21784
|
+
const [internalSearchValue, setInternalSearchValue] = React82.useState("");
|
|
21785
|
+
const [highlightedIndex, setHighlightedIndex] = React82.useState(-1);
|
|
21786
|
+
const containerRef = React82.useRef(null);
|
|
21787
|
+
const triggerRef = React82.useRef(null);
|
|
21788
|
+
const inputRef = React82.useRef(null);
|
|
21660
21789
|
const listboxId = `${reactId}-listbox`;
|
|
21661
21790
|
const labelId = `${reactId}-label`;
|
|
21662
21791
|
const valueId = `${reactId}-value`;
|
|
@@ -21665,13 +21794,13 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21665
21794
|
const searchInputId = `${reactId}-search`;
|
|
21666
21795
|
const effectiveSearchValue = searchValue ?? internalSearchValue;
|
|
21667
21796
|
const shouldFilterLocally = !onSearchChange && filterOption !== null;
|
|
21668
|
-
const visibleOptions =
|
|
21797
|
+
const visibleOptions = React82.useMemo(() => {
|
|
21669
21798
|
if (!shouldFilterLocally || !effectiveSearchValue) {
|
|
21670
21799
|
return options;
|
|
21671
21800
|
}
|
|
21672
21801
|
return options.filter((option) => filterOption(option, effectiveSearchValue));
|
|
21673
21802
|
}, [effectiveSearchValue, filterOption, options, shouldFilterLocally]);
|
|
21674
|
-
const selectedIndex =
|
|
21803
|
+
const selectedIndex = React82.useMemo(
|
|
21675
21804
|
() => visibleOptions.findIndex((option) => option.value === value?.value),
|
|
21676
21805
|
[value?.value, visibleOptions]
|
|
21677
21806
|
);
|
|
@@ -21687,7 +21816,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21687
21816
|
isDisabled: !open || isMobile3
|
|
21688
21817
|
});
|
|
21689
21818
|
const handleOnOpenChange = useEvent(onOpenChange);
|
|
21690
|
-
const setSelectOpen =
|
|
21819
|
+
const setSelectOpen = useCallback58(
|
|
21691
21820
|
(nextOpen, options2) => {
|
|
21692
21821
|
setOpen(nextOpen);
|
|
21693
21822
|
handleOnOpenChange?.(nextOpen);
|
|
@@ -21697,7 +21826,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21697
21826
|
},
|
|
21698
21827
|
[handleOnOpenChange]
|
|
21699
21828
|
);
|
|
21700
|
-
|
|
21829
|
+
React82.useEffect(() => {
|
|
21701
21830
|
if (isBlocked) {
|
|
21702
21831
|
setSelectOpen(false);
|
|
21703
21832
|
return;
|
|
@@ -21710,7 +21839,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21710
21839
|
window.cancelAnimationFrame(frameId);
|
|
21711
21840
|
};
|
|
21712
21841
|
}, [isBlocked, open, setSelectOpen]);
|
|
21713
|
-
|
|
21842
|
+
React82.useEffect(() => {
|
|
21714
21843
|
if (!open) {
|
|
21715
21844
|
setHighlightedIndex(-1);
|
|
21716
21845
|
return;
|
|
@@ -21805,7 +21934,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21805
21934
|
onOptionHover: setHighlightedIndex
|
|
21806
21935
|
}
|
|
21807
21936
|
);
|
|
21808
|
-
|
|
21937
|
+
React82.useImperativeHandle(ref, () => triggerRef.current, []);
|
|
21809
21938
|
return /* @__PURE__ */ jsxs124("div", { ref: containerRef, className: cn("relative w-full max-w-[425px]", className), children: [
|
|
21810
21939
|
name && /* @__PURE__ */ jsx192("input", { type: "hidden", name, value: value ? String(value.value) : "" }),
|
|
21811
21940
|
/* @__PURE__ */ jsx192(
|
|
@@ -21883,7 +22012,7 @@ var AirbnbSearchableSelectInternal = ({
|
|
|
21883
22012
|
) : null
|
|
21884
22013
|
] });
|
|
21885
22014
|
};
|
|
21886
|
-
var AirbnbSearchableSelect =
|
|
22015
|
+
var AirbnbSearchableSelect = React82.forwardRef(
|
|
21887
22016
|
AirbnbSearchableSelectInternal
|
|
21888
22017
|
);
|
|
21889
22018
|
function AirbnbSearchableSelectContent({
|
|
@@ -21910,9 +22039,9 @@ function AirbnbSearchableSelectContent({
|
|
|
21910
22039
|
onOptionClick,
|
|
21911
22040
|
onOptionHover
|
|
21912
22041
|
}) {
|
|
21913
|
-
const listRef =
|
|
21914
|
-
const lastLoadMoreOptionsLengthRef =
|
|
21915
|
-
const previousHighlightedIndexRef =
|
|
22042
|
+
const listRef = React82.useRef(null);
|
|
22043
|
+
const lastLoadMoreOptionsLengthRef = React82.useRef(null);
|
|
22044
|
+
const previousHighlightedIndexRef = React82.useRef(highlightedIndex);
|
|
21916
22045
|
const rowCount = options.length + (loading && options.length > 0 ? 1 : 0);
|
|
21917
22046
|
const virtualizer = useVirtualizer3({
|
|
21918
22047
|
count: rowCount,
|
|
@@ -21923,7 +22052,7 @@ function AirbnbSearchableSelectContent({
|
|
|
21923
22052
|
const virtualItems = virtualizer.getVirtualItems();
|
|
21924
22053
|
const emptyMessage = noOptionsMessage?.() ?? "No matches found";
|
|
21925
22054
|
const loadingText = loadingMessage?.() ?? "Loading...";
|
|
21926
|
-
|
|
22055
|
+
React82.useEffect(() => {
|
|
21927
22056
|
const lastItem = virtualItems[virtualItems.length - 1];
|
|
21928
22057
|
const shouldLoadMore = !!lastItem && hasNextPage && !loading && lastItem.index >= options.length - LOAD_MORE_THRESHOLD;
|
|
21929
22058
|
if (shouldLoadMore && lastLoadMoreOptionsLengthRef.current !== options.length) {
|
|
@@ -21931,7 +22060,7 @@ function AirbnbSearchableSelectContent({
|
|
|
21931
22060
|
onLoadMore?.();
|
|
21932
22061
|
}
|
|
21933
22062
|
}, [hasNextPage, loading, onLoadMore, options.length, virtualItems]);
|
|
21934
|
-
|
|
22063
|
+
React82.useEffect(() => {
|
|
21935
22064
|
const hasHighlightedIndexChanged = previousHighlightedIndexRef.current !== highlightedIndex;
|
|
21936
22065
|
previousHighlightedIndexRef.current = highlightedIndex;
|
|
21937
22066
|
if (highlightedIndex >= 0 && hasHighlightedIndexChanged) {
|
|
@@ -22049,11 +22178,11 @@ function getNextEnabledIndex(options, startIndex, step) {
|
|
|
22049
22178
|
}
|
|
22050
22179
|
|
|
22051
22180
|
// src/airbnb-fields/search-input/SearchInput.tsx
|
|
22052
|
-
import * as
|
|
22181
|
+
import * as React83 from "react";
|
|
22053
22182
|
import { useTranslation as useTranslation44 } from "react-i18next";
|
|
22054
22183
|
import { Search as Search6, X as X11 } from "lucide-react";
|
|
22055
22184
|
import { jsx as jsx193, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
22056
|
-
var AirbnbSearchInput =
|
|
22185
|
+
var AirbnbSearchInput = React83.forwardRef(({ onReset, placeholder, wrapperClassName, ...props }, ref) => {
|
|
22057
22186
|
const { t } = useTranslation44();
|
|
22058
22187
|
const placeholderText = placeholder || t("search_property") + "...";
|
|
22059
22188
|
return /* @__PURE__ */ jsxs125("div", { className: cn("input-wrapper relative", wrapperClassName), children: [
|
|
@@ -22091,11 +22220,11 @@ var AirbnbSearchInput = React82.forwardRef(({ onReset, placeholder, wrapperClass
|
|
|
22091
22220
|
AirbnbSearchInput.displayName = "AirbnbSearchInput";
|
|
22092
22221
|
|
|
22093
22222
|
// src/airbnb-fields/switch/Switch.tsx
|
|
22094
|
-
import * as
|
|
22223
|
+
import * as React84 from "react";
|
|
22095
22224
|
import * as SwitchPrimitives2 from "@radix-ui/react-switch";
|
|
22096
22225
|
import { Check as Check8 } from "lucide-react";
|
|
22097
22226
|
import { Fragment as Fragment18, jsx as jsx194, jsxs as jsxs126 } from "react/jsx-runtime";
|
|
22098
|
-
var AirbnbSwitch =
|
|
22227
|
+
var AirbnbSwitch = React84.forwardRef(
|
|
22099
22228
|
({
|
|
22100
22229
|
className,
|
|
22101
22230
|
value,
|
|
@@ -22109,7 +22238,7 @@ var AirbnbSwitch = React83.forwardRef(
|
|
|
22109
22238
|
wrapperClassName,
|
|
22110
22239
|
...props
|
|
22111
22240
|
}, ref) => {
|
|
22112
|
-
const generatedId =
|
|
22241
|
+
const generatedId = React84.useId();
|
|
22113
22242
|
const fieldId = id || generatedId;
|
|
22114
22243
|
const switchElement = /* @__PURE__ */ jsx194(
|
|
22115
22244
|
SwitchPrimitives2.Root,
|