@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260926063530 → 0.8.1-dev.20260929055955

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.
@@ -18,7 +18,7 @@ import {
18
18
  SelectWithSearchInput_default,
19
19
  Select_default,
20
20
  TimeInput_default
21
- } from "./chunk-LDS5ZLVG.mjs";
21
+ } from "./chunk-JT7G3DNR.mjs";
22
22
  import {
23
23
  Hyperlink,
24
24
  Icon_default,
@@ -351,12 +351,328 @@ var PercentageInput = (props) => {
351
351
  };
352
352
  var PercentageInput_default = PercentageInput;
353
353
 
354
+ // src/components/utilities/CountryCodes.tsx
355
+ var COUNTRY_CODES = [
356
+ { name: "Afghanistan", iso2: "AF", dialCode: "+93" },
357
+ { name: "\xC5land Islands", iso2: "AX", dialCode: "+358" },
358
+ { name: "Albania", iso2: "AL", dialCode: "+355" },
359
+ { name: "Algeria", iso2: "DZ", dialCode: "+213" },
360
+ { name: "American Samoa", iso2: "AS", dialCode: "+1684" },
361
+ { name: "Andorra", iso2: "AD", dialCode: "+376" },
362
+ { name: "Angola", iso2: "AO", dialCode: "+244" },
363
+ { name: "Anguilla", iso2: "AI", dialCode: "+1264" },
364
+ { name: "Antigua and Barbuda", iso2: "AG", dialCode: "+1268" },
365
+ { name: "Argentina", iso2: "AR", dialCode: "+54" },
366
+ { name: "Armenia", iso2: "AM", dialCode: "+374" },
367
+ { name: "Aruba", iso2: "AW", dialCode: "+297" },
368
+ { name: "Australia", iso2: "AU", dialCode: "+61" },
369
+ { name: "Austria", iso2: "AT", dialCode: "+43" },
370
+ { name: "Azerbaijan", iso2: "AZ", dialCode: "+994" },
371
+ { name: "Bahamas", iso2: "BS", dialCode: "+1242" },
372
+ { name: "Bahrain", iso2: "BH", dialCode: "+973" },
373
+ { name: "Bangladesh", iso2: "BD", dialCode: "+880" },
374
+ { name: "Barbados", iso2: "BB", dialCode: "+1246" },
375
+ { name: "Belarus", iso2: "BY", dialCode: "+375" },
376
+ { name: "Belgium", iso2: "BE", dialCode: "+32" },
377
+ { name: "Belize", iso2: "BZ", dialCode: "+501" },
378
+ { name: "Benin", iso2: "BJ", dialCode: "+229" },
379
+ { name: "Bermuda", iso2: "BM", dialCode: "+1441" },
380
+ { name: "Bhutan", iso2: "BT", dialCode: "+975" },
381
+ { name: "Bolivia", iso2: "BO", dialCode: "+591" },
382
+ { name: "Bosnia and Herzegovina", iso2: "BA", dialCode: "+387" },
383
+ { name: "Botswana", iso2: "BW", dialCode: "+267" },
384
+ { name: "Brazil", iso2: "BR", dialCode: "+55" },
385
+ { name: "British Indian Ocean Territory", iso2: "IO", dialCode: "+246" },
386
+ { name: "British Virgin Islands", iso2: "VG", dialCode: "+1284" },
387
+ { name: "Brunei", iso2: "BN", dialCode: "+673" },
388
+ { name: "Bulgaria", iso2: "BG", dialCode: "+359" },
389
+ { name: "Burkina Faso", iso2: "BF", dialCode: "+226" },
390
+ { name: "Burundi", iso2: "BI", dialCode: "+257" },
391
+ { name: "Cambodia", iso2: "KH", dialCode: "+855" },
392
+ { name: "Cameroon", iso2: "CM", dialCode: "+237" },
393
+ { name: "Canada", iso2: "CA", dialCode: "+1" },
394
+ { name: "Cape Verde", iso2: "CV", dialCode: "+238" },
395
+ { name: "Caribbean Netherlands", iso2: "BQ", dialCode: "+599" },
396
+ { name: "Cayman Islands", iso2: "KY", dialCode: "+1345" },
397
+ { name: "Central African Republic", iso2: "CF", dialCode: "+236" },
398
+ { name: "Chad", iso2: "TD", dialCode: "+235" },
399
+ { name: "Chile", iso2: "CL", dialCode: "+56" },
400
+ { name: "China", iso2: "CN", dialCode: "+86" },
401
+ { name: "Christmas Island", iso2: "CX", dialCode: "+61" },
402
+ { name: "Cocos (Keeling) Islands", iso2: "CC", dialCode: "+61" },
403
+ { name: "Colombia", iso2: "CO", dialCode: "+57" },
404
+ { name: "Comoros", iso2: "KM", dialCode: "+269" },
405
+ { name: "Congo", iso2: "CG", dialCode: "+242" },
406
+ { name: "Congo (DRC)", iso2: "CD", dialCode: "+243" },
407
+ { name: "Cook Islands", iso2: "CK", dialCode: "+682" },
408
+ { name: "Costa Rica", iso2: "CR", dialCode: "+506" },
409
+ { name: "C\xF4te d'Ivoire", iso2: "CI", dialCode: "+225" },
410
+ { name: "Croatia", iso2: "HR", dialCode: "+385" },
411
+ { name: "Cuba", iso2: "CU", dialCode: "+53" },
412
+ { name: "Cura\xE7ao", iso2: "CW", dialCode: "+599" },
413
+ { name: "Cyprus", iso2: "CY", dialCode: "+357" },
414
+ { name: "Czech Republic", iso2: "CZ", dialCode: "+420" },
415
+ { name: "Denmark", iso2: "DK", dialCode: "+45" },
416
+ { name: "Djibouti", iso2: "DJ", dialCode: "+253" },
417
+ { name: "Dominica", iso2: "DM", dialCode: "+1767" },
418
+ { name: "Dominican Republic", iso2: "DO", dialCode: "+1" },
419
+ { name: "Ecuador", iso2: "EC", dialCode: "+593" },
420
+ { name: "Egypt", iso2: "EG", dialCode: "+20" },
421
+ { name: "El Salvador", iso2: "SV", dialCode: "+503" },
422
+ { name: "Equatorial Guinea", iso2: "GQ", dialCode: "+240" },
423
+ { name: "Eritrea", iso2: "ER", dialCode: "+291" },
424
+ { name: "Estonia", iso2: "EE", dialCode: "+372" },
425
+ { name: "Eswatini", iso2: "SZ", dialCode: "+268" },
426
+ { name: "Ethiopia", iso2: "ET", dialCode: "+251" },
427
+ { name: "Falkland Islands", iso2: "FK", dialCode: "+500" },
428
+ { name: "Faroe Islands", iso2: "FO", dialCode: "+298" },
429
+ { name: "Fiji", iso2: "FJ", dialCode: "+679" },
430
+ { name: "Finland", iso2: "FI", dialCode: "+358" },
431
+ { name: "France", iso2: "FR", dialCode: "+33" },
432
+ { name: "French Guiana", iso2: "GF", dialCode: "+594" },
433
+ { name: "French Polynesia", iso2: "PF", dialCode: "+689" },
434
+ { name: "Gabon", iso2: "GA", dialCode: "+241" },
435
+ { name: "Gambia", iso2: "GM", dialCode: "+220" },
436
+ { name: "Georgia", iso2: "GE", dialCode: "+995" },
437
+ { name: "Germany", iso2: "DE", dialCode: "+49" },
438
+ { name: "Ghana", iso2: "GH", dialCode: "+233" },
439
+ { name: "Gibraltar", iso2: "GI", dialCode: "+350" },
440
+ { name: "Greece", iso2: "GR", dialCode: "+30" },
441
+ { name: "Greenland", iso2: "GL", dialCode: "+299" },
442
+ { name: "Grenada", iso2: "GD", dialCode: "+1473" },
443
+ { name: "Guadeloupe", iso2: "GP", dialCode: "+590" },
444
+ { name: "Guam", iso2: "GU", dialCode: "+1671" },
445
+ { name: "Guatemala", iso2: "GT", dialCode: "+502" },
446
+ { name: "Guernsey", iso2: "GG", dialCode: "+44" },
447
+ { name: "Guinea", iso2: "GN", dialCode: "+224" },
448
+ { name: "Guinea-Bissau", iso2: "GW", dialCode: "+245" },
449
+ { name: "Guyana", iso2: "GY", dialCode: "+592" },
450
+ { name: "Haiti", iso2: "HT", dialCode: "+509" },
451
+ { name: "Honduras", iso2: "HN", dialCode: "+504" },
452
+ { name: "Hong Kong", iso2: "HK", dialCode: "+852" },
453
+ { name: "Hungary", iso2: "HU", dialCode: "+36" },
454
+ { name: "Iceland", iso2: "IS", dialCode: "+354" },
455
+ { name: "India", iso2: "IN", dialCode: "+91" },
456
+ { name: "Indonesia", iso2: "ID", dialCode: "+62" },
457
+ { name: "Iran", iso2: "IR", dialCode: "+98" },
458
+ { name: "Iraq", iso2: "IQ", dialCode: "+964" },
459
+ { name: "Ireland", iso2: "IE", dialCode: "+353" },
460
+ { name: "Isle of Man", iso2: "IM", dialCode: "+44" },
461
+ { name: "Israel", iso2: "IL", dialCode: "+972" },
462
+ { name: "Italy", iso2: "IT", dialCode: "+39" },
463
+ { name: "Jamaica", iso2: "JM", dialCode: "+1876" },
464
+ { name: "Japan", iso2: "JP", dialCode: "+81" },
465
+ { name: "Jersey", iso2: "JE", dialCode: "+44" },
466
+ { name: "Jordan", iso2: "JO", dialCode: "+962" },
467
+ { name: "Kazakhstan", iso2: "KZ", dialCode: "+7" },
468
+ { name: "Kenya", iso2: "KE", dialCode: "+254" },
469
+ { name: "Kiribati", iso2: "KI", dialCode: "+686" },
470
+ { name: "Kosovo", iso2: "XK", dialCode: "+383" },
471
+ { name: "Kuwait", iso2: "KW", dialCode: "+965" },
472
+ { name: "Kyrgyzstan", iso2: "KG", dialCode: "+996" },
473
+ { name: "Laos", iso2: "LA", dialCode: "+856" },
474
+ { name: "Latvia", iso2: "LV", dialCode: "+371" },
475
+ { name: "Lebanon", iso2: "LB", dialCode: "+961" },
476
+ { name: "Lesotho", iso2: "LS", dialCode: "+266" },
477
+ { name: "Liberia", iso2: "LR", dialCode: "+231" },
478
+ { name: "Libya", iso2: "LY", dialCode: "+218" },
479
+ { name: "Liechtenstein", iso2: "LI", dialCode: "+423" },
480
+ { name: "Lithuania", iso2: "LT", dialCode: "+370" },
481
+ { name: "Luxembourg", iso2: "LU", dialCode: "+352" },
482
+ { name: "Macau", iso2: "MO", dialCode: "+853" },
483
+ { name: "Madagascar", iso2: "MG", dialCode: "+261" },
484
+ { name: "Malawi", iso2: "MW", dialCode: "+265" },
485
+ { name: "Malaysia", iso2: "MY", dialCode: "+60" },
486
+ { name: "Maldives", iso2: "MV", dialCode: "+960" },
487
+ { name: "Mali", iso2: "ML", dialCode: "+223" },
488
+ { name: "Malta", iso2: "MT", dialCode: "+356" },
489
+ { name: "Marshall Islands", iso2: "MH", dialCode: "+692" },
490
+ { name: "Martinique", iso2: "MQ", dialCode: "+596" },
491
+ { name: "Mauritania", iso2: "MR", dialCode: "+222" },
492
+ { name: "Mauritius", iso2: "MU", dialCode: "+230" },
493
+ { name: "Mayotte", iso2: "YT", dialCode: "+262" },
494
+ { name: "Mexico", iso2: "MX", dialCode: "+52" },
495
+ { name: "Micronesia", iso2: "FM", dialCode: "+691" },
496
+ { name: "Moldova", iso2: "MD", dialCode: "+373" },
497
+ { name: "Monaco", iso2: "MC", dialCode: "+377" },
498
+ { name: "Mongolia", iso2: "MN", dialCode: "+976" },
499
+ { name: "Montenegro", iso2: "ME", dialCode: "+382" },
500
+ { name: "Montserrat", iso2: "MS", dialCode: "+1664" },
501
+ { name: "Morocco", iso2: "MA", dialCode: "+212" },
502
+ { name: "Mozambique", iso2: "MZ", dialCode: "+258" },
503
+ { name: "Myanmar", iso2: "MM", dialCode: "+95" },
504
+ { name: "Namibia", iso2: "NA", dialCode: "+264" },
505
+ { name: "Nauru", iso2: "NR", dialCode: "+674" },
506
+ { name: "Nepal", iso2: "NP", dialCode: "+977" },
507
+ { name: "Netherlands", iso2: "NL", dialCode: "+31" },
508
+ { name: "New Caledonia", iso2: "NC", dialCode: "+687" },
509
+ { name: "New Zealand", iso2: "NZ", dialCode: "+64" },
510
+ { name: "Nicaragua", iso2: "NI", dialCode: "+505" },
511
+ { name: "Niger", iso2: "NE", dialCode: "+227" },
512
+ { name: "Nigeria", iso2: "NG", dialCode: "+234" },
513
+ { name: "Niue", iso2: "NU", dialCode: "+683" },
514
+ { name: "Norfolk Island", iso2: "NF", dialCode: "+672" },
515
+ { name: "North Korea", iso2: "KP", dialCode: "+850" },
516
+ { name: "North Macedonia", iso2: "MK", dialCode: "+389" },
517
+ { name: "Northern Mariana Islands", iso2: "MP", dialCode: "+1670" },
518
+ { name: "Norway", iso2: "NO", dialCode: "+47" },
519
+ { name: "Oman", iso2: "OM", dialCode: "+968" },
520
+ { name: "Pakistan", iso2: "PK", dialCode: "+92" },
521
+ { name: "Palau", iso2: "PW", dialCode: "+680" },
522
+ { name: "Palestine", iso2: "PS", dialCode: "+970" },
523
+ { name: "Panama", iso2: "PA", dialCode: "+507" },
524
+ { name: "Papua New Guinea", iso2: "PG", dialCode: "+675" },
525
+ { name: "Paraguay", iso2: "PY", dialCode: "+595" },
526
+ { name: "Peru", iso2: "PE", dialCode: "+51" },
527
+ { name: "Philippines", iso2: "PH", dialCode: "+63" },
528
+ { name: "Poland", iso2: "PL", dialCode: "+48" },
529
+ { name: "Portugal", iso2: "PT", dialCode: "+351" },
530
+ { name: "Puerto Rico", iso2: "PR", dialCode: "+1" },
531
+ { name: "Qatar", iso2: "QA", dialCode: "+974" },
532
+ { name: "R\xE9union", iso2: "RE", dialCode: "+262" },
533
+ { name: "Romania", iso2: "RO", dialCode: "+40" },
534
+ { name: "Russia", iso2: "RU", dialCode: "+7" },
535
+ { name: "Rwanda", iso2: "RW", dialCode: "+250" },
536
+ { name: "Saint Barth\xE9lemy", iso2: "BL", dialCode: "+590" },
537
+ { name: "Saint Helena", iso2: "SH", dialCode: "+290" },
538
+ { name: "Saint Kitts and Nevis", iso2: "KN", dialCode: "+1869" },
539
+ { name: "Saint Lucia", iso2: "LC", dialCode: "+1758" },
540
+ { name: "Saint Martin", iso2: "MF", dialCode: "+590" },
541
+ { name: "Saint Pierre and Miquelon", iso2: "PM", dialCode: "+508" },
542
+ { name: "Saint Vincent and the Grenadines", iso2: "VC", dialCode: "+1784" },
543
+ { name: "Samoa", iso2: "WS", dialCode: "+685" },
544
+ { name: "San Marino", iso2: "SM", dialCode: "+378" },
545
+ { name: "S\xE3o Tom\xE9 and Pr\xEDncipe", iso2: "ST", dialCode: "+239" },
546
+ { name: "Saudi Arabia", iso2: "SA", dialCode: "+966" },
547
+ { name: "Senegal", iso2: "SN", dialCode: "+221" },
548
+ { name: "Serbia", iso2: "RS", dialCode: "+381" },
549
+ { name: "Seychelles", iso2: "SC", dialCode: "+248" },
550
+ { name: "Sierra Leone", iso2: "SL", dialCode: "+232" },
551
+ { name: "Singapore", iso2: "SG", dialCode: "+65" },
552
+ { name: "Sint Maarten", iso2: "SX", dialCode: "+1721" },
553
+ { name: "Slovakia", iso2: "SK", dialCode: "+421" },
554
+ { name: "Slovenia", iso2: "SI", dialCode: "+386" },
555
+ { name: "Solomon Islands", iso2: "SB", dialCode: "+677" },
556
+ { name: "Somalia", iso2: "SO", dialCode: "+252" },
557
+ { name: "South Africa", iso2: "ZA", dialCode: "+27" },
558
+ { name: "South Korea", iso2: "KR", dialCode: "+82" },
559
+ { name: "South Sudan", iso2: "SS", dialCode: "+211" },
560
+ { name: "Spain", iso2: "ES", dialCode: "+34" },
561
+ { name: "Sri Lanka", iso2: "LK", dialCode: "+94" },
562
+ { name: "Sudan", iso2: "SD", dialCode: "+249" },
563
+ { name: "Suriname", iso2: "SR", dialCode: "+597" },
564
+ { name: "Svalbard and Jan Mayen", iso2: "SJ", dialCode: "+47" },
565
+ { name: "Sweden", iso2: "SE", dialCode: "+46" },
566
+ { name: "Switzerland", iso2: "CH", dialCode: "+41" },
567
+ { name: "Syria", iso2: "SY", dialCode: "+963" },
568
+ { name: "Taiwan", iso2: "TW", dialCode: "+886" },
569
+ { name: "Tajikistan", iso2: "TJ", dialCode: "+992" },
570
+ { name: "Tanzania", iso2: "TZ", dialCode: "+255" },
571
+ { name: "Thailand", iso2: "TH", dialCode: "+66" },
572
+ { name: "Timor-Leste", iso2: "TL", dialCode: "+670" },
573
+ { name: "Togo", iso2: "TG", dialCode: "+228" },
574
+ { name: "Tokelau", iso2: "TK", dialCode: "+690" },
575
+ { name: "Tonga", iso2: "TO", dialCode: "+676" },
576
+ { name: "Trinidad and Tobago", iso2: "TT", dialCode: "+1868" },
577
+ { name: "Tunisia", iso2: "TN", dialCode: "+216" },
578
+ { name: "Turkey", iso2: "TR", dialCode: "+90" },
579
+ { name: "Turkmenistan", iso2: "TM", dialCode: "+993" },
580
+ { name: "Turks and Caicos Islands", iso2: "TC", dialCode: "+1649" },
581
+ { name: "Tuvalu", iso2: "TV", dialCode: "+688" },
582
+ { name: "Uganda", iso2: "UG", dialCode: "+256" },
583
+ { name: "Ukraine", iso2: "UA", dialCode: "+380" },
584
+ { name: "United Arab Emirates", iso2: "AE", dialCode: "+971" },
585
+ { name: "United Kingdom", iso2: "GB", dialCode: "+44" },
586
+ { name: "United States", iso2: "US", dialCode: "+1" },
587
+ { name: "U.S. Virgin Islands", iso2: "VI", dialCode: "+1340" },
588
+ { name: "Uruguay", iso2: "UY", dialCode: "+598" },
589
+ { name: "Uzbekistan", iso2: "UZ", dialCode: "+998" },
590
+ { name: "Vanuatu", iso2: "VU", dialCode: "+678" },
591
+ { name: "Vatican City", iso2: "VA", dialCode: "+39" },
592
+ { name: "Venezuela", iso2: "VE", dialCode: "+58" },
593
+ { name: "Vietnam", iso2: "VN", dialCode: "+84" },
594
+ { name: "Wallis and Futuna", iso2: "WF", dialCode: "+681" },
595
+ { name: "Western Sahara", iso2: "EH", dialCode: "+212" },
596
+ { name: "Yemen", iso2: "YE", dialCode: "+967" },
597
+ { name: "Zambia", iso2: "ZM", dialCode: "+260" },
598
+ { name: "Zimbabwe", iso2: "ZW", dialCode: "+263" }
599
+ ];
600
+ var PRIMARY_COUNTRY_BY_DIAL_CODE = {
601
+ "+1": "US",
602
+ "+7": "RU",
603
+ "+39": "IT",
604
+ "+44": "GB",
605
+ "+47": "NO",
606
+ "+61": "AU",
607
+ "+212": "MA",
608
+ "+262": "RE",
609
+ "+358": "FI",
610
+ "+590": "GP",
611
+ "+599": "CW"
612
+ };
613
+ var findCountryByDialCode = (dialCode) => {
614
+ const primaryIso2 = PRIMARY_COUNTRY_BY_DIAL_CODE[dialCode];
615
+ return primaryIso2 && COUNTRY_CODES.find((c) => c.iso2 === primaryIso2) || COUNTRY_CODES.find((c) => c.dialCode === dialCode);
616
+ };
617
+ var findCountryByIso2 = (iso2) => {
618
+ if (!iso2) return void 0;
619
+ const normalized = iso2.trim().toUpperCase();
620
+ return COUNTRY_CODES.find((c) => c.iso2 === normalized);
621
+ };
622
+ var getDialCodeByCountryCode = (iso2) => findCountryByIso2(iso2)?.dialCode;
623
+ var resolveCountry = (codeOrDialCode) => {
624
+ const value = codeOrDialCode?.trim();
625
+ if (!value) return void 0;
626
+ return value.startsWith("+") ? findCountryByDialCode(value) : findCountryByIso2(value);
627
+ };
628
+ var getCountryFlag = (iso2) => iso2.toUpperCase().replace(/./g, (char) => String.fromCodePoint(127397 + char.charCodeAt(0)));
629
+ var splitPhoneNumber = (value) => {
630
+ const trimmed = (value ?? "").trim();
631
+ if (!trimmed.startsWith("+")) {
632
+ return { number: trimmed };
633
+ }
634
+ const [head, ...rest] = trimmed.split(/\s+/);
635
+ const digits = trimmed.replace(/[^\d+]/g, "");
636
+ const prefixMatch = [...COUNTRY_CODES].sort((a, b) => b.dialCode.length - a.dialCode.length).find((c) => digits.startsWith(c.dialCode));
637
+ const country = (rest.length > 0 ? findCountryByDialCode(head) : void 0) ?? (prefixMatch ? findCountryByDialCode(prefixMatch.dialCode) : void 0);
638
+ if (!country) {
639
+ return { number: trimmed };
640
+ }
641
+ const number = rest.length > 0 && head === country.dialCode ? rest.join(" ") : digits.slice(country.dialCode.length);
642
+ return { country, number };
643
+ };
644
+
354
645
  // src/components/controls/edit/PhoneInput.tsx
355
- import React6 from "react";
646
+ import React6, { useEffect as useEffect2, useMemo, useRef, useState as useState2 } from "react";
356
647
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
648
+ var DEFAULT_DIAL_CODE = "+91";
357
649
  var PhoneInput = (props) => {
358
- const textChangeHandler = (event) => {
359
- const text = event.target.value;
650
+ const hasFixedPrefix = props.prefix !== void 0 && props.prefix !== null;
651
+ let value = "";
652
+ if (props.value !== void 0 && props.value !== null) {
653
+ value = props.value;
654
+ }
655
+ const parsed = useMemo(
656
+ () => hasFixedPrefix ? { number: value } : splitPhoneNumber(String(value)),
657
+ [hasFixedPrefix, value]
658
+ );
659
+ const defaultCountry = resolveCountry(props?.attributes?.defaultCountryCode) ?? findCountryByDialCode(DEFAULT_DIAL_CODE);
660
+ const hasUserPickedCountry = useRef(false);
661
+ const [selectedIso2, setSelectedIso2] = useState2(
662
+ parsed.country?.iso2 ?? defaultCountry.iso2
663
+ );
664
+ const selectedCountry = COUNTRY_CODES.find((c) => c.iso2 === selectedIso2) ?? defaultCountry;
665
+ useEffect2(() => {
666
+ if (parsed.country && parsed.country.dialCode !== selectedCountry.dialCode) {
667
+ setSelectedIso2(parsed.country.iso2);
668
+ }
669
+ }, [parsed.country, selectedCountry.dialCode]);
670
+ useEffect2(() => {
671
+ if (!parsed.country && !parsed.number && !hasUserPickedCountry.current) {
672
+ setSelectedIso2(defaultCountry.iso2);
673
+ }
674
+ }, [defaultCountry.iso2, parsed.country, parsed.number]);
675
+ const emit = (text) => {
360
676
  if (props.callback !== void 0) {
361
677
  props.callback(
362
678
  {
@@ -368,31 +684,69 @@ var PhoneInput = (props) => {
368
684
  );
369
685
  }
370
686
  };
371
- let value = "";
372
- if (props.value !== void 0 && props.value !== null) {
373
- value = props.value;
374
- }
687
+ const combine = (dialCode, number) => number ? `${dialCode} ${number}` : "";
688
+ const textChangeHandler = (event) => {
689
+ const text = event.target.value;
690
+ if (hasFixedPrefix) {
691
+ emit(text);
692
+ return;
693
+ }
694
+ emit(combine(selectedCountry.dialCode, text.replace(/\D/g, "")));
695
+ };
696
+ const countryChangeHandler = (event) => {
697
+ const country = COUNTRY_CODES.find((c) => c.iso2 === event.target.value);
698
+ if (!country) return;
699
+ hasUserPickedCountry.current = true;
700
+ setSelectedIso2(country.iso2);
701
+ if (parsed.number) {
702
+ emit(combine(country.dialCode, parsed.number));
703
+ }
704
+ };
705
+ const isReadOnly = props?.attributes?.readOnly;
375
706
  return /* @__PURE__ */ jsx6(React6.Fragment, { children: /* @__PURE__ */ jsxs6("label", { className: "block mb-1", children: [
376
707
  /* @__PURE__ */ jsx6("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
377
708
  " ",
378
709
  props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ jsx6("span", { className: "bg-error-weak", children: "*" }),
379
710
  /* @__PURE__ */ jsxs6("div", { className: "flex items-center rounded border ", children: [
380
- /* @__PURE__ */ jsx6("span", { className: "px-3", children: props.prefix }),
711
+ hasFixedPrefix ? /* @__PURE__ */ jsx6("span", { className: "px-3", children: props.prefix }) : /* @__PURE__ */ jsxs6("span", { className: "relative flex items-center gap-1 self-stretch px-3 border-r whitespace-nowrap", children: [
712
+ /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: getCountryFlag(selectedCountry.iso2) }),
713
+ /* @__PURE__ */ jsx6("span", { children: selectedCountry.dialCode }),
714
+ /* @__PURE__ */ jsx6("svg", { "aria-hidden": "true", className: "w-3 h-3 opacity-60", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ jsx6("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) }),
715
+ /* @__PURE__ */ jsx6(
716
+ "select",
717
+ {
718
+ "aria-label": "Country code",
719
+ value: selectedCountry.iso2,
720
+ onChange: countryChangeHandler,
721
+ disabled: isReadOnly,
722
+ className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer disabled:cursor-not-allowed",
723
+ children: COUNTRY_CODES.map((country) => /* @__PURE__ */ jsxs6("option", { value: country.iso2, children: [
724
+ getCountryFlag(country.iso2),
725
+ " ",
726
+ country.name,
727
+ " (",
728
+ country.dialCode,
729
+ ")"
730
+ ] }, country.iso2))
731
+ }
732
+ )
733
+ ] }),
381
734
  /* @__PURE__ */ jsx6(
382
735
  "input",
383
736
  {
384
- type: "text",
737
+ type: hasFixedPrefix ? "text" : "tel",
738
+ inputMode: hasFixedPrefix ? void 0 : "numeric",
385
739
  name: props.name,
386
740
  id: props.name,
387
- value,
741
+ value: parsed.number,
388
742
  onChange: textChangeHandler,
389
743
  required: props?.attributes?.required,
390
744
  placeholder: props?.attributes?.placeholder,
391
745
  maxLength: props?.attributes?.maxLength,
392
746
  pattern: props?.attributes?.pattern,
393
- disabled: props?.attributes?.readOnly,
747
+ disabled: isReadOnly,
394
748
  minLength: props?.attributes?.minLength,
395
- className: "py-1.5 block w-full outline-none border-0 mr-0.5"
749
+ className: `py-1.5 block w-full outline-none border-0 mr-0.5 ${hasFixedPrefix ? "" : "pl-3"}`
396
750
  }
397
751
  )
398
752
  ] }),
@@ -641,7 +995,7 @@ var DateTimeInput = (props) => {
641
995
  var DateTimeInput_default = DateTimeInput;
642
996
 
643
997
  // src/components/controls/edit/ColorInput.tsx
644
- import React11, { useEffect as useEffect2 } from "react";
998
+ import React11, { useEffect as useEffect3 } from "react";
645
999
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
646
1000
  var DEFAULT_COLOR = "#3b82f6";
647
1001
  var isValidHex = (val) => typeof val === "string" && /^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6}|[0-9A-Fa-f]{8})$/.test(val.trim());
@@ -656,7 +1010,7 @@ var ColorInput = (props) => {
656
1010
  const [color, setColor] = React11.useState(
657
1011
  () => normalizeColor(props.value)
658
1012
  );
659
- useEffect2(() => {
1013
+ useEffect3(() => {
660
1014
  const hasValue = props.value !== void 0 && props.value !== null && props.value !== "";
661
1015
  if (!hasValue && props.callback && !isReadOnly) {
662
1016
  props.callback({
@@ -667,7 +1021,7 @@ var ColorInput = (props) => {
667
1021
  });
668
1022
  }
669
1023
  }, [isReadOnly]);
670
- useEffect2(() => {
1024
+ useEffect3(() => {
671
1025
  if (props.value !== void 0 && props.value !== null && props.value !== "") {
672
1026
  if (typeof props.value === "string") {
673
1027
  setColor(normalizeColor(props.value));
@@ -735,16 +1089,16 @@ var ColorInput = (props) => {
735
1089
  var ColorInput_default = ColorInput;
736
1090
 
737
1091
  // src/components/controls/edit/SelectWithSearchInput.tsx
738
- import React12, { useEffect as useEffect3, useRef, useState as useState2 } from "react";
1092
+ import React12, { useEffect as useEffect4, useRef as useRef2, useState as useState3 } from "react";
739
1093
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
740
1094
  var SelectWithSearchInput = (props) => {
741
- const [isOpen, setIsOpen] = useState2(false);
742
- const [searchTerm, setSearchTerm] = useState2("");
743
- const [highlightedIndex, setHighlightedIndex] = useState2(-1);
744
- const [selectedItem, setSelectedItem] = useState2(
1095
+ const [isOpen, setIsOpen] = useState3(false);
1096
+ const [searchTerm, setSearchTerm] = useState3("");
1097
+ const [highlightedIndex, setHighlightedIndex] = useState3(-1);
1098
+ const [selectedItem, setSelectedItem] = useState3(
745
1099
  null
746
1100
  );
747
- const [list, setList] = useState2([]);
1101
+ const [list, setList] = useState3([]);
748
1102
  const loadData = React12.useCallback(async () => {
749
1103
  if (props.dataset) {
750
1104
  setList(props.dataset);
@@ -770,10 +1124,10 @@ var SelectWithSearchInput = (props) => {
770
1124
  props.dataSourceDependsOn,
771
1125
  props.dependentValue
772
1126
  ]);
773
- useEffect3(() => {
1127
+ useEffect4(() => {
774
1128
  loadData();
775
1129
  }, [loadData]);
776
- useEffect3(() => {
1130
+ useEffect4(() => {
777
1131
  if (props.value && list.length && props.dataKeyFieldName && props.dataTextFieldName) {
778
1132
  const selected = list.find(
779
1133
  (x) => String(x[props.dataKeyFieldName]) === String(props.value)
@@ -820,8 +1174,8 @@ var SelectWithSearchInput = (props) => {
820
1174
  handleSelect(e, filteredItems[highlightedIndex]);
821
1175
  }
822
1176
  };
823
- const dropdownRef = useRef(null);
824
- useEffect3(() => {
1177
+ const dropdownRef = useRef2(null);
1178
+ useEffect4(() => {
825
1179
  if (highlightedIndex >= 0 && dropdownRef.current) {
826
1180
  const highlightedItem = dropdownRef.current.children[highlightedIndex];
827
1181
  highlightedItem?.scrollIntoView({
@@ -1026,7 +1380,7 @@ var TimeInput = (props) => {
1026
1380
  var TimeInput_default = TimeInput;
1027
1381
 
1028
1382
  // src/components/controls/edit/DateInput.tsx
1029
- import { useMemo } from "react";
1383
+ import { useMemo as useMemo2 } from "react";
1030
1384
 
1031
1385
  // src/components/utilities/DateTimeUtility.tsx
1032
1386
  var DateTimeUtility = class {
@@ -1107,7 +1461,7 @@ var DateTimeUtility_default = DateTimeUtility;
1107
1461
  // src/components/controls/edit/DateInput.tsx
1108
1462
  import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
1109
1463
  var DateInput = (props) => {
1110
- const value = useMemo(() => {
1464
+ const value = useMemo2(() => {
1111
1465
  if (props.value === void 0 || props.value === null || props.value === "") {
1112
1466
  return "";
1113
1467
  }
@@ -1163,11 +1517,11 @@ var DateInput = (props) => {
1163
1517
  var DateInput_default = DateInput;
1164
1518
 
1165
1519
  // src/components/controls/edit/RadioInput.tsx
1166
- import { useEffect as useEffect4, useState as useState3 } from "react";
1520
+ import { useEffect as useEffect5, useState as useState4 } from "react";
1167
1521
  import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
1168
1522
  var RadioInput = (props) => {
1169
- const [list, setList] = useState3([]);
1170
- useEffect4(() => {
1523
+ const [list, setList] = useState4([]);
1524
+ useEffect5(() => {
1171
1525
  async function loadData() {
1172
1526
  if (props.dataset) {
1173
1527
  setList(props.dataset);
@@ -1257,6 +1611,13 @@ export {
1257
1611
  MoneyInput_default,
1258
1612
  Select_default,
1259
1613
  PercentageInput_default,
1614
+ COUNTRY_CODES,
1615
+ findCountryByDialCode,
1616
+ findCountryByIso2,
1617
+ getDialCodeByCountryCode,
1618
+ resolveCountry,
1619
+ getCountryFlag,
1620
+ splitPhoneNumber,
1260
1621
  PhoneInput_default,
1261
1622
  NumberInput_default,
1262
1623
  CheckboxInput_default,
package/dist/index.d.mts CHANGED
@@ -174,6 +174,7 @@ interface InputControlProps {
174
174
  helpText?: string;
175
175
  autoFocus?: boolean;
176
176
  heading?: string;
177
+ defaultCountryCode?: string;
177
178
  };
178
179
  }
179
180
 
@@ -260,6 +261,35 @@ declare const PercentageInput: React__default.FC<InputControlProps>;
260
261
 
261
262
  declare const PhoneInput: React__default.FC<InputControlProps>;
262
263
 
264
+ interface CountryCode {
265
+ name: string;
266
+ iso2: string;
267
+ dialCode: string;
268
+ }
269
+ declare const COUNTRY_CODES: CountryCode[];
270
+ /** Returns the country for a dial code, preferring the primary country for shared codes. */
271
+ declare const findCountryByDialCode: (dialCode: string) => CountryCode | undefined;
272
+ /** Returns the country for an ISO 3166-1 alpha-2 code such as "IN" (as returned by the Geo API). */
273
+ declare const findCountryByIso2: (iso2?: string | null) => CountryCode | undefined;
274
+ /** Maps an ISO alpha-2 country code to its dial code: "IN" → "+91". */
275
+ declare const getDialCodeByCountryCode: (iso2?: string | null) => string | undefined;
276
+ /**
277
+ * Resolves either a dial code ("+91") or an ISO alpha-2 country code ("IN") to a country,
278
+ * so callers can pass the Geo API's countryCode straight through.
279
+ */
280
+ declare const resolveCountry: (codeOrDialCode?: string | null) => CountryCode | undefined;
281
+ /** Converts an ISO 3166-1 alpha-2 code into its flag emoji. */
282
+ declare const getCountryFlag: (iso2: string) => string;
283
+ /**
284
+ * Splits a stored phone value like "+91 9534822376" into its country and number.
285
+ * Picks the longest matching dial code, so "+1684..." resolves to American Samoa, not "+1".
286
+ * Values without a leading "+" are treated as a bare number.
287
+ */
288
+ declare const splitPhoneNumber: (value: string) => {
289
+ country?: CountryCode;
290
+ number: string;
291
+ };
292
+
263
293
  declare const NumberInput: React__default.FC<InputControlProps>;
264
294
 
265
295
  declare const CheckboxInput: React__default.FC<InputControlProps>;
@@ -479,4 +509,4 @@ interface DataFormRendererProps {
479
509
  }
480
510
  declare const DataFormRenderer: ({ formDefinition, dataItem, params, tabs, apiBaseUrl, session, widgetProps, onSave, onDelete, onCancelAdd, isAddPage, entityId, }: DataFormRendererProps) => React.JSX.Element | null;
481
511
 
482
- export { type ActionResponse$1 as ActionResponse, Button, CheckboxInput, ColorInput, DataFormRenderer, DataList, DataListRenderer, DateInput, DateTimeInput, EmailInput, EnterAnimationHydrator, InputControl, type InputControlProps, InputControlType, LineTextInput, MoneyInput, MultilineTextInput, NavigationTabsV2, NumberInput, OtpInput, PageBodyRenderer, PercentageInput, PhoneInput, RadioInput, Select, StyleTypes, TimeInput, Toast, ToastService, ViewControl, type ViewControlProps, ViewControlTypes };
512
+ export { type ActionResponse$1 as ActionResponse, Button, COUNTRY_CODES, CheckboxInput, ColorInput, type CountryCode, DataFormRenderer, DataList, DataListRenderer, DateInput, DateTimeInput, EmailInput, EnterAnimationHydrator, InputControl, type InputControlProps, InputControlType, LineTextInput, MoneyInput, MultilineTextInput, NavigationTabsV2, NumberInput, OtpInput, PageBodyRenderer, PercentageInput, PhoneInput, RadioInput, Select, StyleTypes, TimeInput, Toast, ToastService, ViewControl, type ViewControlProps, ViewControlTypes, findCountryByDialCode, findCountryByIso2, getCountryFlag, getDialCodeByCountryCode, resolveCountry, splitPhoneNumber };
package/dist/index.d.ts CHANGED
@@ -174,6 +174,7 @@ interface InputControlProps {
174
174
  helpText?: string;
175
175
  autoFocus?: boolean;
176
176
  heading?: string;
177
+ defaultCountryCode?: string;
177
178
  };
178
179
  }
179
180
 
@@ -260,6 +261,35 @@ declare const PercentageInput: React__default.FC<InputControlProps>;
260
261
 
261
262
  declare const PhoneInput: React__default.FC<InputControlProps>;
262
263
 
264
+ interface CountryCode {
265
+ name: string;
266
+ iso2: string;
267
+ dialCode: string;
268
+ }
269
+ declare const COUNTRY_CODES: CountryCode[];
270
+ /** Returns the country for a dial code, preferring the primary country for shared codes. */
271
+ declare const findCountryByDialCode: (dialCode: string) => CountryCode | undefined;
272
+ /** Returns the country for an ISO 3166-1 alpha-2 code such as "IN" (as returned by the Geo API). */
273
+ declare const findCountryByIso2: (iso2?: string | null) => CountryCode | undefined;
274
+ /** Maps an ISO alpha-2 country code to its dial code: "IN" → "+91". */
275
+ declare const getDialCodeByCountryCode: (iso2?: string | null) => string | undefined;
276
+ /**
277
+ * Resolves either a dial code ("+91") or an ISO alpha-2 country code ("IN") to a country,
278
+ * so callers can pass the Geo API's countryCode straight through.
279
+ */
280
+ declare const resolveCountry: (codeOrDialCode?: string | null) => CountryCode | undefined;
281
+ /** Converts an ISO 3166-1 alpha-2 code into its flag emoji. */
282
+ declare const getCountryFlag: (iso2: string) => string;
283
+ /**
284
+ * Splits a stored phone value like "+91 9534822376" into its country and number.
285
+ * Picks the longest matching dial code, so "+1684..." resolves to American Samoa, not "+1".
286
+ * Values without a leading "+" are treated as a bare number.
287
+ */
288
+ declare const splitPhoneNumber: (value: string) => {
289
+ country?: CountryCode;
290
+ number: string;
291
+ };
292
+
263
293
  declare const NumberInput: React__default.FC<InputControlProps>;
264
294
 
265
295
  declare const CheckboxInput: React__default.FC<InputControlProps>;
@@ -479,4 +509,4 @@ interface DataFormRendererProps {
479
509
  }
480
510
  declare const DataFormRenderer: ({ formDefinition, dataItem, params, tabs, apiBaseUrl, session, widgetProps, onSave, onDelete, onCancelAdd, isAddPage, entityId, }: DataFormRendererProps) => React.JSX.Element | null;
481
511
 
482
- export { type ActionResponse$1 as ActionResponse, Button, CheckboxInput, ColorInput, DataFormRenderer, DataList, DataListRenderer, DateInput, DateTimeInput, EmailInput, EnterAnimationHydrator, InputControl, type InputControlProps, InputControlType, LineTextInput, MoneyInput, MultilineTextInput, NavigationTabsV2, NumberInput, OtpInput, PageBodyRenderer, PercentageInput, PhoneInput, RadioInput, Select, StyleTypes, TimeInput, Toast, ToastService, ViewControl, type ViewControlProps, ViewControlTypes };
512
+ export { type ActionResponse$1 as ActionResponse, Button, COUNTRY_CODES, CheckboxInput, ColorInput, type CountryCode, DataFormRenderer, DataList, DataListRenderer, DateInput, DateTimeInput, EmailInput, EnterAnimationHydrator, InputControl, type InputControlProps, InputControlType, LineTextInput, MoneyInput, MultilineTextInput, NavigationTabsV2, NumberInput, OtpInput, PageBodyRenderer, PercentageInput, PhoneInput, RadioInput, Select, StyleTypes, TimeInput, Toast, ToastService, ViewControl, type ViewControlProps, ViewControlTypes, findCountryByDialCode, findCountryByIso2, getCountryFlag, getDialCodeByCountryCode, resolveCountry, splitPhoneNumber };
package/dist/index.js CHANGED
@@ -2586,16 +2586,339 @@ var init_PercentageInput = __esm({
2586
2586
  }
2587
2587
  });
2588
2588
 
2589
+ // src/components/utilities/CountryCodes.tsx
2590
+ var COUNTRY_CODES, PRIMARY_COUNTRY_BY_DIAL_CODE, findCountryByDialCode, findCountryByIso2, getDialCodeByCountryCode, resolveCountry, getCountryFlag, splitPhoneNumber;
2591
+ var init_CountryCodes = __esm({
2592
+ "src/components/utilities/CountryCodes.tsx"() {
2593
+ "use strict";
2594
+ COUNTRY_CODES = [
2595
+ { name: "Afghanistan", iso2: "AF", dialCode: "+93" },
2596
+ { name: "\xC5land Islands", iso2: "AX", dialCode: "+358" },
2597
+ { name: "Albania", iso2: "AL", dialCode: "+355" },
2598
+ { name: "Algeria", iso2: "DZ", dialCode: "+213" },
2599
+ { name: "American Samoa", iso2: "AS", dialCode: "+1684" },
2600
+ { name: "Andorra", iso2: "AD", dialCode: "+376" },
2601
+ { name: "Angola", iso2: "AO", dialCode: "+244" },
2602
+ { name: "Anguilla", iso2: "AI", dialCode: "+1264" },
2603
+ { name: "Antigua and Barbuda", iso2: "AG", dialCode: "+1268" },
2604
+ { name: "Argentina", iso2: "AR", dialCode: "+54" },
2605
+ { name: "Armenia", iso2: "AM", dialCode: "+374" },
2606
+ { name: "Aruba", iso2: "AW", dialCode: "+297" },
2607
+ { name: "Australia", iso2: "AU", dialCode: "+61" },
2608
+ { name: "Austria", iso2: "AT", dialCode: "+43" },
2609
+ { name: "Azerbaijan", iso2: "AZ", dialCode: "+994" },
2610
+ { name: "Bahamas", iso2: "BS", dialCode: "+1242" },
2611
+ { name: "Bahrain", iso2: "BH", dialCode: "+973" },
2612
+ { name: "Bangladesh", iso2: "BD", dialCode: "+880" },
2613
+ { name: "Barbados", iso2: "BB", dialCode: "+1246" },
2614
+ { name: "Belarus", iso2: "BY", dialCode: "+375" },
2615
+ { name: "Belgium", iso2: "BE", dialCode: "+32" },
2616
+ { name: "Belize", iso2: "BZ", dialCode: "+501" },
2617
+ { name: "Benin", iso2: "BJ", dialCode: "+229" },
2618
+ { name: "Bermuda", iso2: "BM", dialCode: "+1441" },
2619
+ { name: "Bhutan", iso2: "BT", dialCode: "+975" },
2620
+ { name: "Bolivia", iso2: "BO", dialCode: "+591" },
2621
+ { name: "Bosnia and Herzegovina", iso2: "BA", dialCode: "+387" },
2622
+ { name: "Botswana", iso2: "BW", dialCode: "+267" },
2623
+ { name: "Brazil", iso2: "BR", dialCode: "+55" },
2624
+ { name: "British Indian Ocean Territory", iso2: "IO", dialCode: "+246" },
2625
+ { name: "British Virgin Islands", iso2: "VG", dialCode: "+1284" },
2626
+ { name: "Brunei", iso2: "BN", dialCode: "+673" },
2627
+ { name: "Bulgaria", iso2: "BG", dialCode: "+359" },
2628
+ { name: "Burkina Faso", iso2: "BF", dialCode: "+226" },
2629
+ { name: "Burundi", iso2: "BI", dialCode: "+257" },
2630
+ { name: "Cambodia", iso2: "KH", dialCode: "+855" },
2631
+ { name: "Cameroon", iso2: "CM", dialCode: "+237" },
2632
+ { name: "Canada", iso2: "CA", dialCode: "+1" },
2633
+ { name: "Cape Verde", iso2: "CV", dialCode: "+238" },
2634
+ { name: "Caribbean Netherlands", iso2: "BQ", dialCode: "+599" },
2635
+ { name: "Cayman Islands", iso2: "KY", dialCode: "+1345" },
2636
+ { name: "Central African Republic", iso2: "CF", dialCode: "+236" },
2637
+ { name: "Chad", iso2: "TD", dialCode: "+235" },
2638
+ { name: "Chile", iso2: "CL", dialCode: "+56" },
2639
+ { name: "China", iso2: "CN", dialCode: "+86" },
2640
+ { name: "Christmas Island", iso2: "CX", dialCode: "+61" },
2641
+ { name: "Cocos (Keeling) Islands", iso2: "CC", dialCode: "+61" },
2642
+ { name: "Colombia", iso2: "CO", dialCode: "+57" },
2643
+ { name: "Comoros", iso2: "KM", dialCode: "+269" },
2644
+ { name: "Congo", iso2: "CG", dialCode: "+242" },
2645
+ { name: "Congo (DRC)", iso2: "CD", dialCode: "+243" },
2646
+ { name: "Cook Islands", iso2: "CK", dialCode: "+682" },
2647
+ { name: "Costa Rica", iso2: "CR", dialCode: "+506" },
2648
+ { name: "C\xF4te d'Ivoire", iso2: "CI", dialCode: "+225" },
2649
+ { name: "Croatia", iso2: "HR", dialCode: "+385" },
2650
+ { name: "Cuba", iso2: "CU", dialCode: "+53" },
2651
+ { name: "Cura\xE7ao", iso2: "CW", dialCode: "+599" },
2652
+ { name: "Cyprus", iso2: "CY", dialCode: "+357" },
2653
+ { name: "Czech Republic", iso2: "CZ", dialCode: "+420" },
2654
+ { name: "Denmark", iso2: "DK", dialCode: "+45" },
2655
+ { name: "Djibouti", iso2: "DJ", dialCode: "+253" },
2656
+ { name: "Dominica", iso2: "DM", dialCode: "+1767" },
2657
+ { name: "Dominican Republic", iso2: "DO", dialCode: "+1" },
2658
+ { name: "Ecuador", iso2: "EC", dialCode: "+593" },
2659
+ { name: "Egypt", iso2: "EG", dialCode: "+20" },
2660
+ { name: "El Salvador", iso2: "SV", dialCode: "+503" },
2661
+ { name: "Equatorial Guinea", iso2: "GQ", dialCode: "+240" },
2662
+ { name: "Eritrea", iso2: "ER", dialCode: "+291" },
2663
+ { name: "Estonia", iso2: "EE", dialCode: "+372" },
2664
+ { name: "Eswatini", iso2: "SZ", dialCode: "+268" },
2665
+ { name: "Ethiopia", iso2: "ET", dialCode: "+251" },
2666
+ { name: "Falkland Islands", iso2: "FK", dialCode: "+500" },
2667
+ { name: "Faroe Islands", iso2: "FO", dialCode: "+298" },
2668
+ { name: "Fiji", iso2: "FJ", dialCode: "+679" },
2669
+ { name: "Finland", iso2: "FI", dialCode: "+358" },
2670
+ { name: "France", iso2: "FR", dialCode: "+33" },
2671
+ { name: "French Guiana", iso2: "GF", dialCode: "+594" },
2672
+ { name: "French Polynesia", iso2: "PF", dialCode: "+689" },
2673
+ { name: "Gabon", iso2: "GA", dialCode: "+241" },
2674
+ { name: "Gambia", iso2: "GM", dialCode: "+220" },
2675
+ { name: "Georgia", iso2: "GE", dialCode: "+995" },
2676
+ { name: "Germany", iso2: "DE", dialCode: "+49" },
2677
+ { name: "Ghana", iso2: "GH", dialCode: "+233" },
2678
+ { name: "Gibraltar", iso2: "GI", dialCode: "+350" },
2679
+ { name: "Greece", iso2: "GR", dialCode: "+30" },
2680
+ { name: "Greenland", iso2: "GL", dialCode: "+299" },
2681
+ { name: "Grenada", iso2: "GD", dialCode: "+1473" },
2682
+ { name: "Guadeloupe", iso2: "GP", dialCode: "+590" },
2683
+ { name: "Guam", iso2: "GU", dialCode: "+1671" },
2684
+ { name: "Guatemala", iso2: "GT", dialCode: "+502" },
2685
+ { name: "Guernsey", iso2: "GG", dialCode: "+44" },
2686
+ { name: "Guinea", iso2: "GN", dialCode: "+224" },
2687
+ { name: "Guinea-Bissau", iso2: "GW", dialCode: "+245" },
2688
+ { name: "Guyana", iso2: "GY", dialCode: "+592" },
2689
+ { name: "Haiti", iso2: "HT", dialCode: "+509" },
2690
+ { name: "Honduras", iso2: "HN", dialCode: "+504" },
2691
+ { name: "Hong Kong", iso2: "HK", dialCode: "+852" },
2692
+ { name: "Hungary", iso2: "HU", dialCode: "+36" },
2693
+ { name: "Iceland", iso2: "IS", dialCode: "+354" },
2694
+ { name: "India", iso2: "IN", dialCode: "+91" },
2695
+ { name: "Indonesia", iso2: "ID", dialCode: "+62" },
2696
+ { name: "Iran", iso2: "IR", dialCode: "+98" },
2697
+ { name: "Iraq", iso2: "IQ", dialCode: "+964" },
2698
+ { name: "Ireland", iso2: "IE", dialCode: "+353" },
2699
+ { name: "Isle of Man", iso2: "IM", dialCode: "+44" },
2700
+ { name: "Israel", iso2: "IL", dialCode: "+972" },
2701
+ { name: "Italy", iso2: "IT", dialCode: "+39" },
2702
+ { name: "Jamaica", iso2: "JM", dialCode: "+1876" },
2703
+ { name: "Japan", iso2: "JP", dialCode: "+81" },
2704
+ { name: "Jersey", iso2: "JE", dialCode: "+44" },
2705
+ { name: "Jordan", iso2: "JO", dialCode: "+962" },
2706
+ { name: "Kazakhstan", iso2: "KZ", dialCode: "+7" },
2707
+ { name: "Kenya", iso2: "KE", dialCode: "+254" },
2708
+ { name: "Kiribati", iso2: "KI", dialCode: "+686" },
2709
+ { name: "Kosovo", iso2: "XK", dialCode: "+383" },
2710
+ { name: "Kuwait", iso2: "KW", dialCode: "+965" },
2711
+ { name: "Kyrgyzstan", iso2: "KG", dialCode: "+996" },
2712
+ { name: "Laos", iso2: "LA", dialCode: "+856" },
2713
+ { name: "Latvia", iso2: "LV", dialCode: "+371" },
2714
+ { name: "Lebanon", iso2: "LB", dialCode: "+961" },
2715
+ { name: "Lesotho", iso2: "LS", dialCode: "+266" },
2716
+ { name: "Liberia", iso2: "LR", dialCode: "+231" },
2717
+ { name: "Libya", iso2: "LY", dialCode: "+218" },
2718
+ { name: "Liechtenstein", iso2: "LI", dialCode: "+423" },
2719
+ { name: "Lithuania", iso2: "LT", dialCode: "+370" },
2720
+ { name: "Luxembourg", iso2: "LU", dialCode: "+352" },
2721
+ { name: "Macau", iso2: "MO", dialCode: "+853" },
2722
+ { name: "Madagascar", iso2: "MG", dialCode: "+261" },
2723
+ { name: "Malawi", iso2: "MW", dialCode: "+265" },
2724
+ { name: "Malaysia", iso2: "MY", dialCode: "+60" },
2725
+ { name: "Maldives", iso2: "MV", dialCode: "+960" },
2726
+ { name: "Mali", iso2: "ML", dialCode: "+223" },
2727
+ { name: "Malta", iso2: "MT", dialCode: "+356" },
2728
+ { name: "Marshall Islands", iso2: "MH", dialCode: "+692" },
2729
+ { name: "Martinique", iso2: "MQ", dialCode: "+596" },
2730
+ { name: "Mauritania", iso2: "MR", dialCode: "+222" },
2731
+ { name: "Mauritius", iso2: "MU", dialCode: "+230" },
2732
+ { name: "Mayotte", iso2: "YT", dialCode: "+262" },
2733
+ { name: "Mexico", iso2: "MX", dialCode: "+52" },
2734
+ { name: "Micronesia", iso2: "FM", dialCode: "+691" },
2735
+ { name: "Moldova", iso2: "MD", dialCode: "+373" },
2736
+ { name: "Monaco", iso2: "MC", dialCode: "+377" },
2737
+ { name: "Mongolia", iso2: "MN", dialCode: "+976" },
2738
+ { name: "Montenegro", iso2: "ME", dialCode: "+382" },
2739
+ { name: "Montserrat", iso2: "MS", dialCode: "+1664" },
2740
+ { name: "Morocco", iso2: "MA", dialCode: "+212" },
2741
+ { name: "Mozambique", iso2: "MZ", dialCode: "+258" },
2742
+ { name: "Myanmar", iso2: "MM", dialCode: "+95" },
2743
+ { name: "Namibia", iso2: "NA", dialCode: "+264" },
2744
+ { name: "Nauru", iso2: "NR", dialCode: "+674" },
2745
+ { name: "Nepal", iso2: "NP", dialCode: "+977" },
2746
+ { name: "Netherlands", iso2: "NL", dialCode: "+31" },
2747
+ { name: "New Caledonia", iso2: "NC", dialCode: "+687" },
2748
+ { name: "New Zealand", iso2: "NZ", dialCode: "+64" },
2749
+ { name: "Nicaragua", iso2: "NI", dialCode: "+505" },
2750
+ { name: "Niger", iso2: "NE", dialCode: "+227" },
2751
+ { name: "Nigeria", iso2: "NG", dialCode: "+234" },
2752
+ { name: "Niue", iso2: "NU", dialCode: "+683" },
2753
+ { name: "Norfolk Island", iso2: "NF", dialCode: "+672" },
2754
+ { name: "North Korea", iso2: "KP", dialCode: "+850" },
2755
+ { name: "North Macedonia", iso2: "MK", dialCode: "+389" },
2756
+ { name: "Northern Mariana Islands", iso2: "MP", dialCode: "+1670" },
2757
+ { name: "Norway", iso2: "NO", dialCode: "+47" },
2758
+ { name: "Oman", iso2: "OM", dialCode: "+968" },
2759
+ { name: "Pakistan", iso2: "PK", dialCode: "+92" },
2760
+ { name: "Palau", iso2: "PW", dialCode: "+680" },
2761
+ { name: "Palestine", iso2: "PS", dialCode: "+970" },
2762
+ { name: "Panama", iso2: "PA", dialCode: "+507" },
2763
+ { name: "Papua New Guinea", iso2: "PG", dialCode: "+675" },
2764
+ { name: "Paraguay", iso2: "PY", dialCode: "+595" },
2765
+ { name: "Peru", iso2: "PE", dialCode: "+51" },
2766
+ { name: "Philippines", iso2: "PH", dialCode: "+63" },
2767
+ { name: "Poland", iso2: "PL", dialCode: "+48" },
2768
+ { name: "Portugal", iso2: "PT", dialCode: "+351" },
2769
+ { name: "Puerto Rico", iso2: "PR", dialCode: "+1" },
2770
+ { name: "Qatar", iso2: "QA", dialCode: "+974" },
2771
+ { name: "R\xE9union", iso2: "RE", dialCode: "+262" },
2772
+ { name: "Romania", iso2: "RO", dialCode: "+40" },
2773
+ { name: "Russia", iso2: "RU", dialCode: "+7" },
2774
+ { name: "Rwanda", iso2: "RW", dialCode: "+250" },
2775
+ { name: "Saint Barth\xE9lemy", iso2: "BL", dialCode: "+590" },
2776
+ { name: "Saint Helena", iso2: "SH", dialCode: "+290" },
2777
+ { name: "Saint Kitts and Nevis", iso2: "KN", dialCode: "+1869" },
2778
+ { name: "Saint Lucia", iso2: "LC", dialCode: "+1758" },
2779
+ { name: "Saint Martin", iso2: "MF", dialCode: "+590" },
2780
+ { name: "Saint Pierre and Miquelon", iso2: "PM", dialCode: "+508" },
2781
+ { name: "Saint Vincent and the Grenadines", iso2: "VC", dialCode: "+1784" },
2782
+ { name: "Samoa", iso2: "WS", dialCode: "+685" },
2783
+ { name: "San Marino", iso2: "SM", dialCode: "+378" },
2784
+ { name: "S\xE3o Tom\xE9 and Pr\xEDncipe", iso2: "ST", dialCode: "+239" },
2785
+ { name: "Saudi Arabia", iso2: "SA", dialCode: "+966" },
2786
+ { name: "Senegal", iso2: "SN", dialCode: "+221" },
2787
+ { name: "Serbia", iso2: "RS", dialCode: "+381" },
2788
+ { name: "Seychelles", iso2: "SC", dialCode: "+248" },
2789
+ { name: "Sierra Leone", iso2: "SL", dialCode: "+232" },
2790
+ { name: "Singapore", iso2: "SG", dialCode: "+65" },
2791
+ { name: "Sint Maarten", iso2: "SX", dialCode: "+1721" },
2792
+ { name: "Slovakia", iso2: "SK", dialCode: "+421" },
2793
+ { name: "Slovenia", iso2: "SI", dialCode: "+386" },
2794
+ { name: "Solomon Islands", iso2: "SB", dialCode: "+677" },
2795
+ { name: "Somalia", iso2: "SO", dialCode: "+252" },
2796
+ { name: "South Africa", iso2: "ZA", dialCode: "+27" },
2797
+ { name: "South Korea", iso2: "KR", dialCode: "+82" },
2798
+ { name: "South Sudan", iso2: "SS", dialCode: "+211" },
2799
+ { name: "Spain", iso2: "ES", dialCode: "+34" },
2800
+ { name: "Sri Lanka", iso2: "LK", dialCode: "+94" },
2801
+ { name: "Sudan", iso2: "SD", dialCode: "+249" },
2802
+ { name: "Suriname", iso2: "SR", dialCode: "+597" },
2803
+ { name: "Svalbard and Jan Mayen", iso2: "SJ", dialCode: "+47" },
2804
+ { name: "Sweden", iso2: "SE", dialCode: "+46" },
2805
+ { name: "Switzerland", iso2: "CH", dialCode: "+41" },
2806
+ { name: "Syria", iso2: "SY", dialCode: "+963" },
2807
+ { name: "Taiwan", iso2: "TW", dialCode: "+886" },
2808
+ { name: "Tajikistan", iso2: "TJ", dialCode: "+992" },
2809
+ { name: "Tanzania", iso2: "TZ", dialCode: "+255" },
2810
+ { name: "Thailand", iso2: "TH", dialCode: "+66" },
2811
+ { name: "Timor-Leste", iso2: "TL", dialCode: "+670" },
2812
+ { name: "Togo", iso2: "TG", dialCode: "+228" },
2813
+ { name: "Tokelau", iso2: "TK", dialCode: "+690" },
2814
+ { name: "Tonga", iso2: "TO", dialCode: "+676" },
2815
+ { name: "Trinidad and Tobago", iso2: "TT", dialCode: "+1868" },
2816
+ { name: "Tunisia", iso2: "TN", dialCode: "+216" },
2817
+ { name: "Turkey", iso2: "TR", dialCode: "+90" },
2818
+ { name: "Turkmenistan", iso2: "TM", dialCode: "+993" },
2819
+ { name: "Turks and Caicos Islands", iso2: "TC", dialCode: "+1649" },
2820
+ { name: "Tuvalu", iso2: "TV", dialCode: "+688" },
2821
+ { name: "Uganda", iso2: "UG", dialCode: "+256" },
2822
+ { name: "Ukraine", iso2: "UA", dialCode: "+380" },
2823
+ { name: "United Arab Emirates", iso2: "AE", dialCode: "+971" },
2824
+ { name: "United Kingdom", iso2: "GB", dialCode: "+44" },
2825
+ { name: "United States", iso2: "US", dialCode: "+1" },
2826
+ { name: "U.S. Virgin Islands", iso2: "VI", dialCode: "+1340" },
2827
+ { name: "Uruguay", iso2: "UY", dialCode: "+598" },
2828
+ { name: "Uzbekistan", iso2: "UZ", dialCode: "+998" },
2829
+ { name: "Vanuatu", iso2: "VU", dialCode: "+678" },
2830
+ { name: "Vatican City", iso2: "VA", dialCode: "+39" },
2831
+ { name: "Venezuela", iso2: "VE", dialCode: "+58" },
2832
+ { name: "Vietnam", iso2: "VN", dialCode: "+84" },
2833
+ { name: "Wallis and Futuna", iso2: "WF", dialCode: "+681" },
2834
+ { name: "Western Sahara", iso2: "EH", dialCode: "+212" },
2835
+ { name: "Yemen", iso2: "YE", dialCode: "+967" },
2836
+ { name: "Zambia", iso2: "ZM", dialCode: "+260" },
2837
+ { name: "Zimbabwe", iso2: "ZW", dialCode: "+263" }
2838
+ ];
2839
+ PRIMARY_COUNTRY_BY_DIAL_CODE = {
2840
+ "+1": "US",
2841
+ "+7": "RU",
2842
+ "+39": "IT",
2843
+ "+44": "GB",
2844
+ "+47": "NO",
2845
+ "+61": "AU",
2846
+ "+212": "MA",
2847
+ "+262": "RE",
2848
+ "+358": "FI",
2849
+ "+590": "GP",
2850
+ "+599": "CW"
2851
+ };
2852
+ findCountryByDialCode = (dialCode) => {
2853
+ const primaryIso2 = PRIMARY_COUNTRY_BY_DIAL_CODE[dialCode];
2854
+ return primaryIso2 && COUNTRY_CODES.find((c) => c.iso2 === primaryIso2) || COUNTRY_CODES.find((c) => c.dialCode === dialCode);
2855
+ };
2856
+ findCountryByIso2 = (iso2) => {
2857
+ if (!iso2) return void 0;
2858
+ const normalized = iso2.trim().toUpperCase();
2859
+ return COUNTRY_CODES.find((c) => c.iso2 === normalized);
2860
+ };
2861
+ getDialCodeByCountryCode = (iso2) => findCountryByIso2(iso2)?.dialCode;
2862
+ resolveCountry = (codeOrDialCode) => {
2863
+ const value = codeOrDialCode?.trim();
2864
+ if (!value) return void 0;
2865
+ return value.startsWith("+") ? findCountryByDialCode(value) : findCountryByIso2(value);
2866
+ };
2867
+ getCountryFlag = (iso2) => iso2.toUpperCase().replace(/./g, (char) => String.fromCodePoint(127397 + char.charCodeAt(0)));
2868
+ splitPhoneNumber = (value) => {
2869
+ const trimmed = (value ?? "").trim();
2870
+ if (!trimmed.startsWith("+")) {
2871
+ return { number: trimmed };
2872
+ }
2873
+ const [head, ...rest] = trimmed.split(/\s+/);
2874
+ const digits = trimmed.replace(/[^\d+]/g, "");
2875
+ const prefixMatch = [...COUNTRY_CODES].sort((a, b) => b.dialCode.length - a.dialCode.length).find((c) => digits.startsWith(c.dialCode));
2876
+ const country = (rest.length > 0 ? findCountryByDialCode(head) : void 0) ?? (prefixMatch ? findCountryByDialCode(prefixMatch.dialCode) : void 0);
2877
+ if (!country) {
2878
+ return { number: trimmed };
2879
+ }
2880
+ const number = rest.length > 0 && head === country.dialCode ? rest.join(" ") : digits.slice(country.dialCode.length);
2881
+ return { country, number };
2882
+ };
2883
+ }
2884
+ });
2885
+
2589
2886
  // src/components/controls/edit/PhoneInput.tsx
2590
- var import_react28, import_jsx_runtime35, PhoneInput, PhoneInput_default;
2887
+ var import_react28, import_jsx_runtime35, DEFAULT_DIAL_CODE, PhoneInput, PhoneInput_default;
2591
2888
  var init_PhoneInput = __esm({
2592
2889
  "src/components/controls/edit/PhoneInput.tsx"() {
2593
2890
  "use strict";
2594
2891
  import_react28 = __toESM(require("react"));
2892
+ init_CountryCodes();
2595
2893
  import_jsx_runtime35 = require("react/jsx-runtime");
2894
+ DEFAULT_DIAL_CODE = "+91";
2596
2895
  PhoneInput = (props) => {
2597
- const textChangeHandler = (event) => {
2598
- const text = event.target.value;
2896
+ const hasFixedPrefix = props.prefix !== void 0 && props.prefix !== null;
2897
+ let value = "";
2898
+ if (props.value !== void 0 && props.value !== null) {
2899
+ value = props.value;
2900
+ }
2901
+ const parsed = (0, import_react28.useMemo)(
2902
+ () => hasFixedPrefix ? { number: value } : splitPhoneNumber(String(value)),
2903
+ [hasFixedPrefix, value]
2904
+ );
2905
+ const defaultCountry = resolveCountry(props?.attributes?.defaultCountryCode) ?? findCountryByDialCode(DEFAULT_DIAL_CODE);
2906
+ const hasUserPickedCountry = (0, import_react28.useRef)(false);
2907
+ const [selectedIso2, setSelectedIso2] = (0, import_react28.useState)(
2908
+ parsed.country?.iso2 ?? defaultCountry.iso2
2909
+ );
2910
+ const selectedCountry = COUNTRY_CODES.find((c) => c.iso2 === selectedIso2) ?? defaultCountry;
2911
+ (0, import_react28.useEffect)(() => {
2912
+ if (parsed.country && parsed.country.dialCode !== selectedCountry.dialCode) {
2913
+ setSelectedIso2(parsed.country.iso2);
2914
+ }
2915
+ }, [parsed.country, selectedCountry.dialCode]);
2916
+ (0, import_react28.useEffect)(() => {
2917
+ if (!parsed.country && !parsed.number && !hasUserPickedCountry.current) {
2918
+ setSelectedIso2(defaultCountry.iso2);
2919
+ }
2920
+ }, [defaultCountry.iso2, parsed.country, parsed.number]);
2921
+ const emit = (text) => {
2599
2922
  if (props.callback !== void 0) {
2600
2923
  props.callback(
2601
2924
  {
@@ -2607,31 +2930,69 @@ var init_PhoneInput = __esm({
2607
2930
  );
2608
2931
  }
2609
2932
  };
2610
- let value = "";
2611
- if (props.value !== void 0 && props.value !== null) {
2612
- value = props.value;
2613
- }
2933
+ const combine = (dialCode, number) => number ? `${dialCode} ${number}` : "";
2934
+ const textChangeHandler = (event) => {
2935
+ const text = event.target.value;
2936
+ if (hasFixedPrefix) {
2937
+ emit(text);
2938
+ return;
2939
+ }
2940
+ emit(combine(selectedCountry.dialCode, text.replace(/\D/g, "")));
2941
+ };
2942
+ const countryChangeHandler = (event) => {
2943
+ const country = COUNTRY_CODES.find((c) => c.iso2 === event.target.value);
2944
+ if (!country) return;
2945
+ hasUserPickedCountry.current = true;
2946
+ setSelectedIso2(country.iso2);
2947
+ if (parsed.number) {
2948
+ emit(combine(country.dialCode, parsed.number));
2949
+ }
2950
+ };
2951
+ const isReadOnly = props?.attributes?.readOnly;
2614
2952
  return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_react28.default.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("label", { className: "block mb-1", children: [
2615
2953
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm font-medium ", children: props?.attributes?.label }),
2616
2954
  " ",
2617
2955
  props?.attributes?.label && props?.attributes?.required && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "bg-error-weak", children: "*" }),
2618
2956
  /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center rounded border ", children: [
2619
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "px-3", children: props.prefix }),
2957
+ hasFixedPrefix ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "px-3", children: props.prefix }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { className: "relative flex items-center gap-1 self-stretch px-3 border-r whitespace-nowrap", children: [
2958
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { "aria-hidden": "true", children: getCountryFlag(selectedCountry.iso2) }),
2959
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: selectedCountry.dialCode }),
2960
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("svg", { "aria-hidden": "true", className: "w-3 h-3 opacity-60", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("path", { fillRule: "evenodd", d: "M5.23 7.21a.75.75 0 011.06.02L10 11.17l3.71-3.94a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z", clipRule: "evenodd" }) }),
2961
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2962
+ "select",
2963
+ {
2964
+ "aria-label": "Country code",
2965
+ value: selectedCountry.iso2,
2966
+ onChange: countryChangeHandler,
2967
+ disabled: isReadOnly,
2968
+ className: "absolute inset-0 w-full h-full opacity-0 cursor-pointer disabled:cursor-not-allowed",
2969
+ children: COUNTRY_CODES.map((country) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("option", { value: country.iso2, children: [
2970
+ getCountryFlag(country.iso2),
2971
+ " ",
2972
+ country.name,
2973
+ " (",
2974
+ country.dialCode,
2975
+ ")"
2976
+ ] }, country.iso2))
2977
+ }
2978
+ )
2979
+ ] }),
2620
2980
  /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
2621
2981
  "input",
2622
2982
  {
2623
- type: "text",
2983
+ type: hasFixedPrefix ? "text" : "tel",
2984
+ inputMode: hasFixedPrefix ? void 0 : "numeric",
2624
2985
  name: props.name,
2625
2986
  id: props.name,
2626
- value,
2987
+ value: parsed.number,
2627
2988
  onChange: textChangeHandler,
2628
2989
  required: props?.attributes?.required,
2629
2990
  placeholder: props?.attributes?.placeholder,
2630
2991
  maxLength: props?.attributes?.maxLength,
2631
2992
  pattern: props?.attributes?.pattern,
2632
- disabled: props?.attributes?.readOnly,
2993
+ disabled: isReadOnly,
2633
2994
  minLength: props?.attributes?.minLength,
2634
- className: "py-1.5 block w-full outline-none border-0 mr-0.5"
2995
+ className: `py-1.5 block w-full outline-none border-0 mr-0.5 ${hasFixedPrefix ? "" : "pl-3"}`
2635
2996
  }
2636
2997
  )
2637
2998
  ] }),
@@ -6953,6 +7314,7 @@ var init_Slider = __esm({
6953
7314
  var index_exports = {};
6954
7315
  __export(index_exports, {
6955
7316
  Button: () => Button_default,
7317
+ COUNTRY_CODES: () => COUNTRY_CODES,
6956
7318
  CheckboxInput: () => CheckboxInput_default,
6957
7319
  ColorInput: () => ColorInput_default,
6958
7320
  DataFormRenderer: () => DataFormRenderer_default,
@@ -6979,7 +7341,13 @@ __export(index_exports, {
6979
7341
  Toast: () => Toast_default,
6980
7342
  ToastService: () => ToastService_default,
6981
7343
  ViewControl: () => ViewControl_default,
6982
- ViewControlTypes: () => ViewControlTypes_default
7344
+ ViewControlTypes: () => ViewControlTypes_default,
7345
+ findCountryByDialCode: () => findCountryByDialCode,
7346
+ findCountryByIso2: () => findCountryByIso2,
7347
+ getCountryFlag: () => getCountryFlag,
7348
+ getDialCodeByCountryCode: () => getDialCodeByCountryCode,
7349
+ resolveCountry: () => resolveCountry,
7350
+ splitPhoneNumber: () => splitPhoneNumber
6983
7351
  });
6984
7352
  module.exports = __toCommonJS(index_exports);
6985
7353
 
@@ -10142,6 +10510,7 @@ init_Button();
10142
10510
  init_MoneyInput();
10143
10511
  init_PercentageInput();
10144
10512
  init_PhoneInput();
10513
+ init_CountryCodes();
10145
10514
  init_NumberInput();
10146
10515
  init_CheckboxInput();
10147
10516
  init_OtpInput();
@@ -11602,6 +11971,7 @@ var DataFormRenderer_default = DataFormRenderer;
11602
11971
  // Annotate the CommonJS export names for ESM import in node:
11603
11972
  0 && (module.exports = {
11604
11973
  Button,
11974
+ COUNTRY_CODES,
11605
11975
  CheckboxInput,
11606
11976
  ColorInput,
11607
11977
  DataFormRenderer,
@@ -11628,5 +11998,11 @@ var DataFormRenderer_default = DataFormRenderer;
11628
11998
  Toast,
11629
11999
  ToastService,
11630
12000
  ViewControl,
11631
- ViewControlTypes
12001
+ ViewControlTypes,
12002
+ findCountryByDialCode,
12003
+ findCountryByIso2,
12004
+ getCountryFlag,
12005
+ getDialCodeByCountryCode,
12006
+ resolveCountry,
12007
+ splitPhoneNumber
11632
12008
  });
package/dist/index.mjs CHANGED
@@ -8,6 +8,7 @@ import {
8
8
  } from "./chunk-RSUG2VPX.mjs";
9
9
  import "./chunk-JDX47MFV.mjs";
10
10
  import {
11
+ COUNTRY_CODES,
11
12
  CheckboxInput_default,
12
13
  ColorInput_default,
13
14
  DateInput_default,
@@ -23,8 +24,14 @@ import {
23
24
  RadioInput_default,
24
25
  SelectWithSearchInput_default,
25
26
  Select_default,
26
- TimeInput_default
27
- } from "./chunk-LDS5ZLVG.mjs";
27
+ TimeInput_default,
28
+ findCountryByDialCode,
29
+ findCountryByIso2,
30
+ getCountryFlag,
31
+ getDialCodeByCountryCode,
32
+ resolveCountry,
33
+ splitPhoneNumber
34
+ } from "./chunk-JT7G3DNR.mjs";
28
35
  import {
29
36
  Constants,
30
37
  Hyperlink,
@@ -456,7 +463,7 @@ var ViewControl_default = ViewControl;
456
463
 
457
464
  // src/components/controls/edit/InputControl.tsx
458
465
  import dynamic7 from "next/dynamic";
459
- var InputControl = dynamic7(() => import("./InputControlClient-K6GXQEJD.mjs"), {
466
+ var InputControl = dynamic7(() => import("./InputControlClient-QMFSUGTK.mjs"), {
460
467
  ssr: false
461
468
  });
462
469
  var InputControl_default = InputControl;
@@ -4599,6 +4606,7 @@ var DataFormRenderer = ({
4599
4606
  var DataFormRenderer_default = DataFormRenderer;
4600
4607
  export {
4601
4608
  Button_default as Button,
4609
+ COUNTRY_CODES,
4602
4610
  CheckboxInput_default as CheckboxInput,
4603
4611
  ColorInput_default as ColorInput,
4604
4612
  DataFormRenderer_default as DataFormRenderer,
@@ -4625,5 +4633,11 @@ export {
4625
4633
  Toast_default as Toast,
4626
4634
  ToastService_default as ToastService,
4627
4635
  ViewControl_default as ViewControl,
4628
- ViewControlTypes_default as ViewControlTypes
4636
+ ViewControlTypes_default as ViewControlTypes,
4637
+ findCountryByDialCode,
4638
+ findCountryByIso2,
4639
+ getCountryFlag,
4640
+ getDialCodeByCountryCode,
4641
+ resolveCountry,
4642
+ splitPhoneNumber
4629
4643
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clyrex-digital/clyrex-controls-dev",
3
- "version": "0.8.1-dev.20260926063530",
3
+ "version": "0.8.1-dev.20260929055955",
4
4
  "description": "Reusable React components",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",