@rpcbase/ui 0.280.0 → 0.282.0
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/components/AddressAutocompleteInput/index.d.ts +1 -1
- package/dist/components/AddressAutocompleteInput/index.d.ts.map +1 -1
- package/dist/components/ApplePayButton/index.d.ts +1 -1
- package/dist/components/ApplePayButton/index.d.ts.map +1 -1
- package/dist/components/Checkbox/index.d.ts +1 -1
- package/dist/components/Checkbox/index.d.ts.map +1 -1
- package/dist/components/DayPickerField/index.d.ts +2 -2
- package/dist/components/DayPickerField/index.d.ts.map +1 -1
- package/dist/components/Dialog/index.d.ts +9 -9
- package/dist/components/Dialog/index.d.ts.map +1 -1
- package/dist/components/FilesUploadField/index.d.ts +1 -1
- package/dist/components/FilesUploadField/index.d.ts.map +1 -1
- package/dist/components/HourPickerField/index.d.ts +2 -2
- package/dist/components/HourPickerField/index.d.ts.map +1 -1
- package/dist/components/I18nField/index.d.ts +1 -1
- package/dist/components/I18nField/index.d.ts.map +1 -1
- package/dist/components/Image/index.d.ts +1 -1
- package/dist/components/Image/index.d.ts.map +1 -1
- package/dist/components/ImagesField/index.d.ts +1 -1
- package/dist/components/ImagesField/index.d.ts.map +1 -1
- package/dist/components/Input/index.d.ts +1 -1
- package/dist/components/Input/index.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationsButton.d.ts +1 -1
- package/dist/components/Notifications/NotificationsButton.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationsDrawer.d.ts +1 -1
- package/dist/components/Notifications/NotificationsDrawer.d.ts.map +1 -1
- package/dist/components/Notifications/NotificationsSettings.d.ts +1 -1
- package/dist/components/Notifications/NotificationsSettings.d.ts.map +1 -1
- package/dist/components/PhoneNumberInput/suggestions.d.ts +3 -3
- package/dist/components/PhoneNumberInput/suggestions.d.ts.map +1 -1
- package/dist/components/Select/index.d.ts +2 -2
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/header/MenuPopover/index.d.ts +1 -1
- package/dist/components/header/MenuPopover/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index10.js +6 -4
- package/dist/index10.js.map +1 -1
- package/dist/index12.js.map +1 -1
- package/dist/index13.js.map +1 -1
- package/dist/index14.js +88 -88
- package/dist/index14.js.map +1 -1
- package/dist/index15.js.map +1 -1
- package/dist/index154.js +19 -7
- package/dist/index154.js.map +1 -1
- package/dist/index16.js +36 -45
- package/dist/index16.js.map +1 -1
- package/dist/index160.js +3 -3
- package/dist/index160.js.map +1 -1
- package/dist/index166.js +5 -5
- package/dist/index166.js.map +1 -1
- package/dist/index172.js +27 -25
- package/dist/index172.js.map +1 -1
- package/dist/index181.js +1 -1
- package/dist/index181.js.map +1 -1
- package/dist/index182.js +145 -162
- package/dist/index182.js.map +1 -1
- package/dist/index184.js +6 -8
- package/dist/index184.js.map +1 -1
- package/dist/index186.js +2 -8
- package/dist/index186.js.map +1 -1
- package/dist/index19.js +1 -1
- package/dist/index19.js.map +1 -1
- package/dist/index195.js +1 -1
- package/dist/index195.js.map +1 -1
- package/dist/index196.js +2 -2
- package/dist/index196.js.map +1 -1
- package/dist/index197.js +1 -1
- package/dist/index197.js.map +1 -1
- package/dist/index198.js +16 -15
- package/dist/index198.js.map +1 -1
- package/dist/index199.js +13 -17
- package/dist/index199.js.map +1 -1
- package/dist/index200.js +3 -2
- package/dist/index200.js.map +1 -1
- package/dist/index207.js +5 -90
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +15 -3
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +102 -22
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +3 -28
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +23 -19
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +27 -6
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +19 -14
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +5 -6
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +14 -26
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +7 -22
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +27 -6
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +23 -5
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +6 -4
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +5 -4
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +4 -24
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +4 -3
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +21 -21
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +3 -23
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +23 -6
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +22 -9
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +5 -17
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +8 -49
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +18 -5
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +50 -19
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +20 -28
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +27 -104
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +98 -33
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +28 -113
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +117 -11
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +12 -4
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +4 -15
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +13 -62
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +64 -9
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +10 -106
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +107 -13
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +16 -13
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +13 -5
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +4 -316
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +315 -58
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +58 -223
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +215 -318
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +250 -306
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +308 -173
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +178 -7
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +8 -15
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +41 -5
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +46 -38
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +7 -50
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +49 -6
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +48 -46
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +6 -51
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +10 -9
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +60 -8
- package/dist/index259.js.map +1 -1
- package/dist/index26.js.map +1 -1
- package/dist/index260.js +41 -60
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +88 -34
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +47 -94
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +36 -49
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +45 -32
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +47 -46
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +18 -48
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +174 -15
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +47 -169
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +17 -34
- package/dist/index269.js.map +1 -1
- package/dist/index270.js +59 -10
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +10 -66
- package/dist/index271.js.map +1 -1
- package/dist/index272.js +4 -4
- package/dist/index273.js +71 -69
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +158 -152
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +7 -13
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +12 -5
- package/dist/index276.js.map +1 -1
- package/dist/index277.js +12 -6
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +11 -12
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +65 -9
- package/dist/index279.js.map +1 -1
- package/dist/index280.js +6 -74
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +25 -6
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +24 -24
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +125 -24
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +52 -115
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +59 -55
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +48 -61
- package/dist/index286.js.map +1 -1
- package/dist/index287.js +5 -48
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +14 -8
- package/dist/index288.js.map +1 -1
- package/dist/index289.js +18 -14
- package/dist/index289.js.map +1 -1
- package/dist/index290.js +10 -17
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +23 -11
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +52 -25
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +6 -52
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +137 -5
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +59 -149
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +90 -49
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +11 -117
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +863 -11
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +21 -865
- package/dist/index299.js.map +1 -1
- package/dist/index3.js.map +1 -1
- package/dist/index300.js +417 -27
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +774 -483
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +7436 -803
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +7 -7429
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +12 -6
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +5 -12
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +3 -3
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +469 -5
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +32 -464
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +18 -36
- package/dist/index309.js.map +1 -1
- package/dist/index310.js +28 -17
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +4 -30
- package/dist/index311.js.map +1 -1
- package/dist/index312.js +59 -4
- package/dist/index312.js.map +1 -1
- package/dist/index313.js +11 -59
- package/dist/index313.js.map +1 -1
- package/dist/index314.js +5 -9
- package/dist/index314.js.map +1 -1
- package/dist/index315.js +9 -5
- package/dist/index315.js.map +1 -1
- package/dist/index316.js +12 -9
- package/dist/index316.js.map +1 -1
- package/dist/index317.js +3 -13
- package/dist/index317.js.map +1 -1
- package/dist/index318.js +17 -3
- package/dist/index318.js.map +1 -1
- package/dist/index319.js +23 -14
- package/dist/index319.js.map +1 -1
- package/dist/index320.js +39 -23
- package/dist/index320.js.map +1 -1
- package/dist/index321.js +5 -41
- package/dist/index321.js.map +1 -1
- package/dist/index322.js +25 -5
- package/dist/index322.js.map +1 -1
- package/dist/index323.js +18 -24
- package/dist/index323.js.map +1 -1
- package/dist/index324.js +32 -17
- package/dist/index324.js.map +1 -1
- package/dist/index325.js +5 -34
- package/dist/index325.js.map +1 -1
- package/dist/index326.js +9 -5
- package/dist/index326.js.map +1 -1
- package/dist/index327.js +7 -8
- package/dist/index327.js.map +1 -1
- package/dist/index328.js +9 -8
- package/dist/index328.js.map +1 -1
- package/dist/index329.js +10 -9
- package/dist/index329.js.map +1 -1
- package/dist/index330.js +7 -10
- package/dist/index330.js.map +1 -1
- package/dist/index331.js +75 -7
- package/dist/index331.js.map +1 -1
- package/dist/index332.js +153 -66
- package/dist/index332.js.map +1 -1
- package/dist/index333.js +99 -147
- package/dist/index333.js.map +1 -1
- package/dist/index334.js +13 -113
- package/dist/index334.js.map +1 -1
- package/dist/index335.js +78 -12
- package/dist/index335.js.map +1 -1
- package/dist/index336.js +23 -57
- package/dist/index336.js.map +1 -1
- package/dist/index337.js +12 -45
- package/dist/index337.js.map +1 -1
- package/dist/index338.js +16 -13
- package/dist/index338.js.map +1 -1
- package/dist/index339.js +100 -15
- package/dist/index339.js.map +1 -1
- package/dist/index340.js +50 -95
- package/dist/index340.js.map +1 -1
- package/dist/index341.js +57 -5
- package/dist/index341.js.map +1 -1
- package/dist/index342.js +41 -78
- package/dist/index342.js.map +1 -1
- package/dist/index343.js +100 -58
- package/dist/index343.js.map +1 -1
- package/dist/index344.js +46 -104
- package/dist/index344.js.map +1 -1
- package/dist/index345.js +39 -51
- package/dist/index345.js.map +1 -1
- package/dist/index346.js +143 -42
- package/dist/index346.js.map +1 -1
- package/dist/index347.js +122 -123
- package/dist/index347.js.map +1 -1
- package/dist/index348.js +224 -108
- package/dist/index348.js.map +1 -1
- package/dist/index349.js +158 -174
- package/dist/index349.js.map +1 -1
- package/dist/index350.js +213 -144
- package/dist/index350.js.map +1 -1
- package/dist/index351.js +5 -309
- package/dist/index351.js.map +1 -1
- package/dist/index352.js +6 -5
- package/dist/index352.js.map +1 -1
- package/dist/index353.js +7 -6
- package/dist/index353.js.map +1 -1
- package/dist/index354.js +4 -5
- package/dist/index354.js.map +1 -1
- package/dist/index355.js +4 -4
- package/dist/index355.js.map +1 -1
- package/dist/index356.js +21 -6
- package/dist/index356.js.map +1 -1
- package/dist/index357.js +10 -21
- package/dist/index357.js.map +1 -1
- package/dist/index358.js +128 -10
- package/dist/index358.js.map +1 -1
- package/dist/index359.js +36 -122
- package/dist/index359.js.map +1 -1
- package/dist/index360.js +64 -38
- package/dist/index360.js.map +1 -1
- package/dist/index361.js +115 -66
- package/dist/index361.js.map +1 -1
- package/dist/index362.js +485 -112
- package/dist/index362.js.map +1 -1
- package/dist/index363.js +7 -490
- package/dist/index363.js.map +1 -1
- package/dist/index364.js +1 -1
- package/dist/index364.js.map +1 -1
- package/dist/index367.js +2 -9
- package/dist/index367.js.map +1 -1
- package/dist/index368.js +26 -5
- package/dist/index368.js.map +1 -1
- package/dist/index369.js +43 -27
- package/dist/index369.js.map +1 -1
- package/dist/index370.js +35 -46
- package/dist/index370.js.map +1 -1
- package/dist/index371.js +16 -27
- package/dist/index371.js.map +1 -1
- package/dist/index372.js +41 -16
- package/dist/index372.js.map +1 -1
- package/dist/index373.js +11 -42
- package/dist/index373.js.map +1 -1
- package/dist/index374.js +10 -14
- package/dist/index374.js.map +1 -1
- package/dist/index375.js +51 -9
- package/dist/index375.js.map +1 -1
- package/dist/index376.js +40 -53
- package/dist/index376.js.map +1 -1
- package/dist/index377.js +17 -43
- package/dist/index377.js.map +1 -1
- package/dist/index378.js +4 -15
- package/dist/index378.js.map +1 -1
- package/dist/index379.js +4 -4
- package/dist/index379.js.map +1 -1
- package/dist/index380.js +9 -4
- package/dist/index380.js.map +1 -1
- package/dist/index381.js +304 -9
- package/dist/index381.js.map +1 -1
- package/dist/index382.js +4 -339
- package/dist/index382.js.map +1 -1
- package/dist/index383.js +21 -5
- package/dist/index383.js.map +1 -1
- package/dist/index384.js +106 -16
- package/dist/index384.js.map +1 -1
- package/dist/index385.js +19 -109
- package/dist/index385.js.map +1 -1
- package/dist/index386.js +18 -18
- package/dist/index386.js.map +1 -1
- package/dist/index387.js +14 -19
- package/dist/index387.js.map +1 -1
- package/dist/index388.js +12 -4
- package/dist/index388.js.map +1 -1
- package/dist/index389.js +113 -20
- package/dist/index389.js.map +1 -1
- package/dist/index390.js +5 -11
- package/dist/index390.js.map +1 -1
- package/dist/index391.js +28 -85
- package/dist/index391.js.map +1 -1
- package/dist/index392.js +9 -9
- package/dist/index392.js.map +1 -1
- package/dist/index393.js +6 -29
- package/dist/index393.js.map +1 -1
- package/dist/index394.js +254 -10
- package/dist/index394.js.map +1 -1
- package/dist/index395.js +12 -6
- package/dist/index395.js.map +1 -1
- package/dist/index396.js +11 -252
- package/dist/index396.js.map +1 -1
- package/dist/index397.js +6 -11
- package/dist/index397.js.map +1 -1
- package/dist/index398.js +22 -10
- package/dist/index398.js.map +1 -1
- package/dist/index399.js +22 -6
- package/dist/index399.js.map +1 -1
- package/dist/index4.js.map +1 -1
- package/dist/index400.js +103 -21
- package/dist/index400.js.map +1 -1
- package/dist/index401.js +15 -23
- package/dist/index401.js.map +1 -1
- package/dist/index402.js +11 -108
- package/dist/index402.js.map +1 -1
- package/dist/index403.js +10 -15
- package/dist/index403.js.map +1 -1
- package/dist/index404.js +237 -10
- package/dist/index404.js.map +1 -1
- package/dist/index405.js +27 -9
- package/dist/index405.js.map +1 -1
- package/dist/index406.js +33 -238
- package/dist/index406.js.map +1 -1
- package/dist/index407.js +11 -30
- package/dist/index407.js.map +1 -1
- package/dist/index408.js +118 -48
- package/dist/index408.js.map +1 -1
- package/dist/index409.js +39 -11
- package/dist/index409.js.map +1 -1
- package/dist/index410.js +18 -121
- package/dist/index410.js.map +1 -1
- package/dist/index411.js +11 -39
- package/dist/index411.js.map +1 -1
- package/dist/index412.js +21 -24
- package/dist/index412.js.map +1 -1
- package/dist/index413.js +17 -11
- package/dist/index413.js.map +1 -1
- package/dist/index414.js +10 -20
- package/dist/index414.js.map +1 -1
- package/dist/index415.js +4 -17
- package/dist/index415.js.map +1 -1
- package/dist/index416.js +300 -14
- package/dist/index416.js.map +1 -1
- package/dist/index417.js +61 -323
- package/dist/index417.js.map +1 -1
- package/dist/index418.js +4 -63
- package/dist/index418.js.map +1 -1
- package/dist/index419.js +28 -4
- package/dist/index419.js.map +1 -1
- package/dist/index420.js +468 -25
- package/dist/index420.js.map +1 -1
- package/dist/index421.js +250 -452
- package/dist/index421.js.map +1 -1
- package/dist/index6.js.map +1 -1
- package/dist/index7.js +91 -133
- package/dist/index7.js.map +1 -1
- package/dist/index70.js +2 -2
- package/dist/index70.js.map +1 -1
- package/dist/index71.js +11 -4
- package/dist/index71.js.map +1 -1
- package/dist/index72.js +1 -3
- package/dist/index72.js.map +1 -1
- package/dist/index8.js.map +1 -1
- package/dist/index9.js +16 -19
- package/dist/index9.js.map +1 -1
- package/dist/test-only/TestCoverageTestBadge/index.d.ts +1 -1
- package/dist/test-only/TestCoverageTestBadge/index.d.ts.map +1 -1
- package/package.json +15 -15
- package/dist/index422.js +0 -272
- package/dist/index422.js.map +0 -1
package/dist/index362.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index362.js","names":["React","CountryCode","ControlProps","OptionProps","StylesConfig","cn","CountryOption","SuggestionContextValue","highlightedValue","setHighlightedOption","option","renderOptionLabel","ReactNode","consumeScrollBehavior","ScrollBehavior","SuggestionContext","createContext","assignOptionRef","ref","Ref","HTMLDivElement","node","Reflect","set","SuggestionOption","props","$","_c","context","useContext","isActive","data","value","onMouseMove","receivedClassName","restInnerProps","innerProps","className","t0","_temp","renderLabel","optionRef","useRef","innerRef","t1","current","assignRef","t2","behavior","target","parent","parentElement","top","offsetTop","bottom","offsetHeight","viewTop","scrollTop","viewBottom","clientHeight","scrollIntoView","block","t3","useEffect","t4","event","handleMouseMove","t5","t6","t7","t8","suggestionSelectStyles","control","display","menu","provided","marginTop","borderRadius","boxShadow","backgroundColor","overflow","zIndex","menuList","maxHeight","padding","state","fontSize","isFocused","isSelected","color","cursor","noOptionsMessage","HiddenControl","children","Symbol","for","height","minHeight","opacity","pointerEvents","NullComponent","formatCountryOption","flag","name","dialCode"],"sources":["../src/components/PhoneNumberInput/suggestions.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport type { ControlProps, OptionProps, StylesConfig } from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type { CountryOption } from \"./types\"\n\n\nexport type SuggestionContextValue = {\n highlightedValue: CountryCode | null\n setHighlightedOption: (option: CountryOption) => void\n renderOptionLabel: (option: CountryOption) => React.ReactNode\n consumeScrollBehavior: () => ScrollBehavior\n}\n\nexport const SuggestionContext = React.createContext<SuggestionContextValue | null>(null)\n\nfunction assignOptionRef(ref: React.Ref<HTMLDivElement> | undefined, node: HTMLDivElement | null) {\n if (typeof ref === \"function\") {\n ref(node)\n return\n }\n if (ref && typeof ref === \"object\") {\n Reflect.set(ref, \"current\", node)\n }\n}\n\nexport const SuggestionOption = (props: OptionProps<CountryOption, false>) => {\n const context = React.useContext(SuggestionContext)\n const isActive = context?.highlightedValue === props.data.value\n const { onMouseMove, className: receivedClassName, ...restInnerProps } = props.innerProps\n const renderLabel =\n context?.renderOptionLabel ?? ((option: CountryOption) => formatCountryOption(option))\n const optionRef = React.useRef<HTMLDivElement | null>(null)\n const { innerRef } = props\n\n const assignRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n optionRef.current = node\n assignOptionRef(innerRef, node)\n },\n [innerRef]\n )\n\n React.useEffect(() => {\n if (!isActive) {\n return\n }\n\n const consumeScrollBehavior = context?.consumeScrollBehavior\n const behavior = consumeScrollBehavior ? consumeScrollBehavior() : \"smooth\"\n\n const target = optionRef.current\n if (!target) {\n return\n }\n\n const parent = target.parentElement\n if (!parent) {\n return\n }\n\n const top = target.offsetTop\n const bottom = top + target.offsetHeight\n const viewTop = parent.scrollTop\n const viewBottom = viewTop + parent.clientHeight\n\n if (top >= viewTop && bottom <= viewBottom) {\n return\n }\n\n target.scrollIntoView({\n block: \"nearest\",\n behavior,\n })\n }, [context, isActive])\n\n const handleMouseMove = (event: React.MouseEvent<HTMLDivElement>) => {\n onMouseMove?.(event)\n context?.setHighlightedOption(props.data)\n }\n\n return (\n <div\n ref={assignRef}\n {...restInnerProps}\n onMouseMove={handleMouseMove}\n className={cn(\n \"flex cursor-pointer items-center justify-between gap-3 px-3 py-2 text-sm\",\n receivedClassName,\n isActive ? \"bg-muted text-foreground\" : \"text-foreground hover:bg-muted\"\n )}\n >\n {renderLabel(props.data)}\n </div>\n )\n}\n\nexport const suggestionSelectStyles: StylesConfig<CountryOption, false> = {\n control: () => ({\n display: \"none\",\n }),\n menu: (provided) => ({\n ...provided,\n marginTop: 4,\n borderRadius: \"var(--radius)\",\n boxShadow: \"0 18px 36px rgba(15, 23, 42, 0.18)\",\n backgroundColor: \"hsl(var(--popover))\",\n overflow: \"hidden\",\n zIndex: 20,\n }),\n menuList: (provided) => ({\n ...provided,\n maxHeight: 240,\n padding: 0,\n }),\n option: (provided, state) => ({\n ...provided,\n fontSize: \"0.875rem\",\n backgroundColor: state.isFocused\n ? \"hsl(var(--muted))\"\n : state.isSelected\n ? \"hsl(var(--accent))\"\n : \"transparent\",\n color: state.isSelected\n ? \"hsl(var(--accent-foreground))\"\n : \"hsl(var(--foreground))\",\n cursor: \"pointer\",\n }),\n noOptionsMessage: (provided) => ({\n ...provided,\n fontSize: \"0.875rem\",\n color: \"hsl(var(--muted-foreground))\",\n }),\n}\n\nexport const HiddenControl = (props: ControlProps<CountryOption, false>) => {\n const { children, innerProps, innerRef } = props\n\n return (\n <div\n {...innerProps}\n ref={innerRef}\n style={{\n height: 0,\n minHeight: 0,\n opacity: 0,\n overflow: \"hidden\",\n pointerEvents: \"none\",\n }}\n >\n {children}\n </div>\n )\n}\n\nexport const NullComponent = () => null\n\nexport function formatCountryOption(option: CountryOption) {\n return (\n <>\n <span className=\"flex min-w-0 items-center gap-2\">\n {option.flag ? (\n <span aria-hidden=\"true\" className=\"text-lg leading-none\">\n {option.flag}\n </span>\n ) : null}\n <span className=\"truncate\">{option.name}</span>\n </span>\n <span className=\"text-xs text-muted-foreground\">+{option.dialCode}</span>\n </>\n )\n}\n"],"mappings":";;;;;AAgBA,IAAae,IAAoBf,EAAMgB,cAA6C,IAAI;AAExF,SAASC,EAAgBC,GAA4CG,GAA6B;CAChG,IAAI,OAAOH,KAAQ,YAAY;EAC7BA,EAAIG,CAAI;EACR;CACF;CACA,AAAIH,KAAO,OAAOA,KAAQ,YACxBI,QAAQC,IAAIL,GAAK,WAAWG,CAAI;AAEpC;AAEA,IAAaG,KAAmBC,MAAA;CAAA,IAAAC,IAAAC,EAAA,EAAA,GAC9BC,IAAgB5B,EAAK6B,WAAYd,CAAiB,GAClDe,IAAiBF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ZNkB;AAYM,GAIGwD,UAAsB;AAEnC,SAAgBC,EAAoB3F,GAAuB;CACzD,OACE,kBAAA,GAAA,EAAA,UAAA,CACE,kBAAC,QAAD;EAAM,WAAU;YAAhB,CACGA,EAAO4F,OACN,kBAAC,QAAD;GAAM,eAAY;GAAO,WAAU;aAChC5F,EAAO4F;EACJ,CAAA,IACJ,MACJ,kBAAC,QAAD;GAAM,WAAU;aAAY5F,EAAO6F;EAAW,CAAA,CAC1C;KACN,kBAAC,QAAD;EAAM,WAAU;YAAhB,CAAgD,KAAE7F,EAAO8F,QAAe;GAC1E,EAAA,CAAA;AAEJ;AAjJgC,SAAAjE,EAAA7B,GAAA;CAAA,OAK8B2F,EAAoB3F,CAAM;AAAC"}
|
|
1
|
+
{"version":3,"file":"index362.js","names":["candidate","initialState","country","parsed","snapshot","option","a","b","current","event","target","value","nextStart"],"sources":["../src/components/PhoneNumberInput/index.tsx"],"sourcesContent":["import * as React from \"react\"\nimport type { CountryCode } from \"libphonenumber-js\"\nimport { getCountryCallingCode } from \"libphonenumber-js\"\nimport Select, {\n type Props as SelectProps,\n type SingleValue,\n type StylesConfig,\n} from \"react-select\"\n\nimport { cn } from \"@/lib/utils\"\n\nimport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputProps,\n PhoneNumberSelectedCountry,\n} from \"./types\"\nimport { resolveMessages } from \"./messages\"\nimport {\n COMMON_IDD_PREFIXES,\n DEFAULT_COUNTRY,\n buildFallbackSelectedCountry,\n getCachedCountryOptions,\n getLocaleCacheKey,\n getValidCountry,\n normalizeSearchValue,\n optionMatchIndex,\n parseLocaleCacheKey,\n toSelectedCountry,\n} from \"./country-options\"\nimport {\n formatWithAsYouType,\n getLengthIssue,\n sanitizeDigits,\n stripPrefix,\n type LengthIssue,\n} from \"./normalization\"\nimport {\n captureSelectionSnapshot,\n resolveSelection,\n skipFormattingCharactersLeft,\n skipFormattingCharactersRight,\n} from \"./selection\"\nimport {\n HiddenControl,\n NullComponent,\n SuggestionContext,\n SuggestionOption,\n formatCountryOption,\n suggestionSelectStyles,\n type SuggestionContextValue,\n} from \"./suggestions\"\n\n\nexport type {\n CountryOption,\n PhoneNumberChangeDetails,\n PhoneNumberInputMessages,\n PhoneNumberInputProps,\n PhoneNumberInputValidationCode,\n PhoneNumberSelectedCountry,\n} from \"./types\"\n\nconst INVISIBLE_FORMATTING_CHARACTERS =\n /[\\u061C\\u200B-\\u200F\\u202A-\\u202E\\u2066-\\u2069\\uFEFF]/g\n\ntype ParsedInput = Omit<PhoneNumberChangeDetails, \"selectedCountry\"> & {\n displayValue: string\n lengthIssue: LengthIssue | null\n}\n\nfunction stripInvisibleFormatting(value: string) {\n return value.replace(INVISIBLE_FORMATTING_CHARACTERS, \"\")\n}\n\nfunction stripIddPrefix(digits: string) {\n for (const prefix of COMMON_IDD_PREFIXES) {\n if (digits.startsWith(prefix)) {\n return digits.slice(prefix.length)\n }\n }\n return digits\n}\n\nfunction normalizeImplicitInternationalInput(digits: string) {\n const candidate = `+${digits}`\n const { phoneNumber, detectedCountry } = formatWithAsYouType(candidate)\n\n if (phoneNumber?.isValid() && detectedCountry) {\n return candidate\n }\n\n return null\n}\n\nfunction normalizeExplicitInternationalInput(value: string) {\n const cleaned = stripInvisibleFormatting(value).trim()\n if (!cleaned) {\n return null\n }\n\n if (cleaned.startsWith(\"+\")) {\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return \"+\"\n }\n\n const digitsWithoutIdd = stripIddPrefix(digits)\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : \"+\"\n }\n\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return null\n }\n\n const digitsWithoutIdd = stripIddPrefix(digits)\n if (digitsWithoutIdd !== digits) {\n return digitsWithoutIdd ? `+${digitsWithoutIdd}` : \"+\"\n }\n\n return null\n}\n\nfunction normalizeInternationalInput(value: string) {\n const explicitInternational = normalizeExplicitInternationalInput(value)\n if (explicitInternational != null) {\n return explicitInternational\n }\n\n const cleaned = stripInvisibleFormatting(value).trim()\n const digits = sanitizeDigits(cleaned)\n if (!digits) {\n return null\n }\n\n return normalizeImplicitInternationalInput(digits)\n}\n\nfunction getDialCode(country: CountryCode | null, parsedDialCode: string | undefined) {\n if (parsedDialCode) {\n return parsedDialCode\n }\n return country ? getCountryCallingCode(country) : null\n}\n\nfunction getInputValueForSelectedCountry(\n value: string,\n option: Pick<CountryOption, \"dialCode\" | \"value\">,\n options?: { allowImplicitInternational?: boolean }\n) {\n const cleaned = stripInvisibleFormatting(value).trim()\n const digits = sanitizeDigits(cleaned)\n\n if (!digits) {\n return `+${option.dialCode}`\n }\n\n const normalizedInternational =\n options?.allowImplicitInternational === false\n ? normalizeExplicitInternationalInput(cleaned)\n : normalizeInternationalInput(cleaned)\n if (normalizedInternational) {\n const normalizedDigits = sanitizeDigits(normalizedInternational)\n if (normalizedDigits.startsWith(option.dialCode)) {\n return normalizedInternational\n }\n\n const { phoneNumber } = formatWithAsYouType(normalizedInternational)\n const currentDialCode = phoneNumber?.countryCallingCode\n const nationalDigits =\n currentDialCode && normalizedDigits.startsWith(currentDialCode)\n ? normalizedDigits.slice(currentDialCode.length)\n : phoneNumber?.nationalNumber ?? normalizedDigits\n\n return `+${option.dialCode}${nationalDigits}`\n }\n\n const { phoneNumber } = formatWithAsYouType(cleaned, option.value)\n return `+${option.dialCode}${phoneNumber?.nationalNumber ?? digits}`\n}\n\nfunction preferSelectedCountry(\n parsed: ParsedInput,\n option: Pick<CountryOption, \"dialCode\" | \"value\">\n): ParsedInput {\n return {\n ...parsed,\n country: option.value,\n countryCallingCode: option.dialCode,\n lengthIssue: getLengthIssue(parsed.rawInput, option.value),\n }\n}\n\nfunction parsePhoneInput(rawValue: string | undefined, baseCountry?: CountryCode): ParsedInput {\n const cleaned = stripInvisibleFormatting(rawValue ?? \"\").trim()\n\n if (!cleaned) {\n const country = baseCountry ?? null\n const countryCallingCode = country ? getCountryCallingCode(country) : null\n\n return {\n displayValue: \"\",\n formattedInternational: \"\",\n formattedNational: \"\",\n e164: null,\n country,\n countryCallingCode,\n nationalNumber: \"\",\n rawInput: \"\",\n isValid: false,\n lengthIssue: null,\n }\n }\n\n const normalizedInternational = normalizeInternationalInput(cleaned)\n const shouldFormat = normalizedInternational != null || baseCountry != null\n\n if (!shouldFormat) {\n return {\n displayValue: cleaned,\n formattedInternational: cleaned,\n formattedNational: cleaned,\n e164: null,\n country: null,\n countryCallingCode: null,\n nationalNumber: sanitizeDigits(cleaned),\n rawInput: cleaned,\n isValid: false,\n lengthIssue: null,\n }\n }\n\n const normalized = normalizedInternational ?? cleaned\n const {\n international,\n national,\n formatted,\n phoneNumber,\n detectedCountry,\n } = formatWithAsYouType(normalized, baseCountry)\n const hasInternationalPrefix = normalizedInternational != null\n const country = hasInternationalPrefix\n ? detectedCountry ?? baseCountry ?? null\n : baseCountry ?? detectedCountry ?? null\n const countryCallingCode = getDialCode(country, phoneNumber?.countryCallingCode)\n const normalizedDigits = sanitizeDigits(normalized)\n const nationalNumber =\n phoneNumber?.nationalNumber ??\n (countryCallingCode && normalized.startsWith(\"+\")\n ? stripPrefix(normalizedDigits, countryCallingCode)\n : sanitizeDigits(cleaned))\n const displayValue = hasInternationalPrefix ? international : formatted\n\n return {\n displayValue,\n formattedInternational: phoneNumber?.formatInternational() ?? international,\n formattedNational: phoneNumber?.formatNational() ?? national,\n e164: phoneNumber?.number ?? null,\n country,\n countryCallingCode,\n nationalNumber,\n rawInput: normalized,\n isValid: phoneNumber?.isValid() ?? false,\n lengthIssue: country ? getLengthIssue(normalized, country) : null,\n }\n}\n\nexport const PhoneNumberInput = React.forwardRef<HTMLInputElement, PhoneNumberInputProps>(\n function PhoneNumberInput(props, forwardedRef) {\n const {\n value,\n defaultCountry,\n country: countryProp,\n locale,\n onChange,\n onCountryChange,\n className,\n inputClassName,\n disabled,\n readOnly,\n selectProps,\n autofillShimName,\n messages: messagesProp,\n renderValidationMessage,\n ...restProps\n } = props\n\n const {\n onFocus: onInputFocus,\n onBlur: onInputBlur,\n onKeyDown: onInputKeyDown,\n name: inputName,\n autoComplete: inputAutoComplete,\n ...restInputProps\n } = restProps\n\n const controlledCountry = typeof countryProp === \"string\" ? countryProp : null\n const localeCacheKey = getLocaleCacheKey(locale)\n const localeForBuild = React.useMemo(\n () => parseLocaleCacheKey(localeCacheKey),\n [localeCacheKey]\n )\n const resolvedMessages = React.useMemo(\n () => resolveMessages(localeForBuild, messagesProp),\n [localeForBuild, messagesProp]\n )\n const countryOptions = React.useMemo(\n () => getCachedCountryOptions(localeForBuild, localeCacheKey),\n [localeCacheKey, localeForBuild]\n )\n const resolveSelectedCountry = React.useCallback(\n (country: CountryCode): PhoneNumberSelectedCountry => {\n const match = countryOptions.find((candidate) => candidate.value === country)\n if (match) {\n return toSelectedCountry(match)\n }\n return buildFallbackSelectedCountry(country)\n },\n [countryOptions]\n )\n const menuPriorityCountry = React.useMemo(() => {\n const candidate = getValidCountry(defaultCountry ?? countryProp ?? DEFAULT_COUNTRY)\n if (countryOptions.some((option) => option.value === candidate)) {\n return candidate\n }\n return countryOptions[0]?.value ?? DEFAULT_COUNTRY\n }, [countryOptions, countryProp, defaultCountry])\n\n const initialStateRef = React.useRef<ParsedInput | null>(null)\n\n if (!initialStateRef.current) {\n const initialState = parsePhoneInput(value, controlledCountry ?? undefined)\n initialStateRef.current = initialState\n }\n\n const initialState = initialStateRef.current\n\n const [uncontrolledCountry, setUncontrolledCountry] = React.useState<CountryCode | null>(\n controlledCountry ? null : initialState.country\n )\n const [inputValueState, setInputValueState] = React.useState(initialState.displayValue)\n const [countryQuery, setCountryQuery] = React.useState(\"\")\n const [showSuggestions, setShowSuggestions] = React.useState(false)\n const [highlightedIndex, setHighlightedIndex] = React.useState<number>(-1)\n const [isFocused, setIsFocused] = React.useState(false)\n const [shouldRenderSelect, setShouldRenderSelect] = React.useState(false)\n const [lengthIssue, setLengthIssue] = React.useState<LengthIssue | null>(\n initialState.lengthIssue\n )\n\n const manualSelectionCountryRef = React.useRef<CountryCode | null>(null)\n const keyboardBufferRef = React.useRef(\"\")\n const bufferTimeoutRef = React.useRef<number | null>(null)\n const scrollBehaviorRef = React.useRef<ScrollBehavior>(\"smooth\")\n const pendingSelectionRef = React.useRef<{ start: number; end: number } | null>(null)\n const hasNotifiedCountryRef = React.useRef(false)\n const lastNotifiedCountryRef = React.useRef<CountryCode | null>(null)\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n\n const activeCountry = controlledCountry ?? uncontrolledCountry\n const explicitFormattingCountry = controlledCountry ?? manualSelectionCountryRef.current ?? undefined\n\n React.useImperativeHandle(forwardedRef, () => inputRef.current as HTMLInputElement, [])\n\n React.useLayoutEffect(() => {\n setShouldRenderSelect(true)\n }, [])\n\n React.useLayoutEffect(() => {\n const selection = pendingSelectionRef.current\n if (!selection) {\n return\n }\n\n const input = inputRef.current\n pendingSelectionRef.current = null\n if (!input) {\n return\n }\n\n const { start, end } = selection\n input.setSelectionRange(start, end)\n }, [inputValueState])\n\n const selectOverrides = selectProps ?? {}\n const generatedSelectInstanceId = React.useId()\n const {\n styles: userSelectStyles,\n components: userSelectComponents,\n classNamePrefix: userClassNamePrefix,\n formatOptionLabel: userFormatOptionLabel,\n menuPortalTarget: userMenuPortalTarget,\n menuPosition: userMenuPosition,\n ...forwardedSelectProps\n } = selectOverrides\n const {\n instanceId: userSelectInstanceId,\n noOptionsMessage,\n ...restForwardedSelectProps\n } = forwardedSelectProps\n const selectInstanceId = userSelectInstanceId ?? generatedSelectInstanceId\n const [defaultMenuPortalTarget, setDefaultMenuPortalTarget] =\n React.useState<HTMLElement | null>(null)\n const hasUserMenuPortalTarget = \"menuPortalTarget\" in selectOverrides\n const menuPortalTarget = hasUserMenuPortalTarget\n ? userMenuPortalTarget\n : defaultMenuPortalTarget\n\n const mergedSelectStyles = React.useMemo<StylesConfig<CountryOption, false>>(\n () => {\n const userMenuPortal = userSelectStyles?.menuPortal\n\n return {\n ...suggestionSelectStyles,\n ...(userSelectStyles ?? {}),\n menuPortal: (provided, state) => {\n const baseWithZIndex = {\n ...provided,\n zIndex: 1300,\n }\n const base = userMenuPortal ? userMenuPortal(baseWithZIndex, state) : baseWithZIndex\n\n if (typeof document === \"undefined\" || !menuPortalTarget || menuPortalTarget === document.body) {\n return base\n }\n\n const portalRect = menuPortalTarget.getBoundingClientRect()\n return {\n ...base,\n left: typeof base.left === \"number\" ? base.left - portalRect.left : base.left,\n top: typeof base.top === \"number\" ? base.top - portalRect.top : base.top,\n }\n },\n }\n },\n [menuPortalTarget, userSelectStyles]\n )\n\n React.useLayoutEffect(() => {\n if (hasUserMenuPortalTarget || typeof document === \"undefined\") {\n return\n }\n\n const portalTarget =\n inputRef.current?.closest<HTMLElement>(\n \"[data-slot='dialog-content'], [data-slot='sheet-content'], [role='dialog']\"\n ) ?? document.body\n setDefaultMenuPortalTarget(portalTarget)\n }, [hasUserMenuPortalTarget])\n\n const mergedSelectComponents = React.useMemo(() => {\n const baseComponents = {\n Control: HiddenControl,\n IndicatorsContainer: NullComponent,\n DropdownIndicator: NullComponent,\n IndicatorSeparator: NullComponent,\n ValueContainer: NullComponent,\n }\n\n const overrides = userSelectComponents ?? {}\n\n if (!overrides.Option) {\n return {\n ...baseComponents,\n ...overrides,\n Option: SuggestionOption,\n }\n }\n\n return {\n ...baseComponents,\n ...overrides,\n }\n }, [userSelectComponents])\n\n React.useEffect(() => () => {\n if (bufferTimeoutRef.current != null && typeof window !== \"undefined\") {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n }, [])\n\n React.useEffect(() => {\n if (value == null) {\n return\n }\n\n const parsed = parsePhoneInput(value, explicitFormattingCountry)\n keyboardBufferRef.current = \"\"\n\n setInputValueState(parsed.displayValue)\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry && parsed.country !== uncontrolledCountry) {\n setUncontrolledCountry(parsed.country)\n }\n }, [controlledCountry, explicitFormattingCountry, uncontrolledCountry, value])\n\n React.useEffect(() => {\n const country = activeCountry ?? null\n if (!hasNotifiedCountryRef.current && country == null) {\n return\n }\n\n if (hasNotifiedCountryRef.current && lastNotifiedCountryRef.current === country) {\n return\n }\n\n hasNotifiedCountryRef.current = true\n lastNotifiedCountryRef.current = country\n onCountryChange?.(country, country ? resolveSelectedCountry(country) : null)\n }, [activeCountry, onCountryChange, resolveSelectedCountry])\n\n const emitChange = React.useCallback(\n (details: Omit<PhoneNumberChangeDetails, \"selectedCountry\">) => {\n onChange?.({\n ...details,\n selectedCountry: details.country ? resolveSelectedCountry(details.country) : null,\n })\n },\n [onChange, resolveSelectedCountry]\n )\n\n const scheduleBufferReset = React.useCallback(() => {\n if (typeof window === \"undefined\") {\n return\n }\n\n if (bufferTimeoutRef.current != null) {\n window.clearTimeout(bufferTimeoutRef.current)\n }\n\n bufferTimeoutRef.current = window.setTimeout(() => {\n keyboardBufferRef.current = \"\"\n bufferTimeoutRef.current = null\n }, 800)\n }, [])\n\n const applyParsedInput = React.useCallback(\n (parsed: ParsedInput, snapshot: ReturnType<typeof captureSelectionSnapshot> | null) => {\n setInputValueState(parsed.displayValue)\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry && parsed.country !== uncontrolledCountry) {\n setUncontrolledCountry(parsed.country)\n }\n\n if (snapshot) {\n pendingSelectionRef.current = resolveSelection(snapshot, parsed.displayValue)\n }\n\n emitChange({\n formattedInternational: parsed.formattedInternational,\n formattedNational: parsed.formattedNational,\n e164: parsed.e164,\n country: parsed.country,\n countryCallingCode: parsed.countryCallingCode,\n nationalNumber: parsed.nationalNumber,\n rawInput: parsed.rawInput,\n isValid: parsed.isValid,\n })\n },\n [controlledCountry, emitChange, uncontrolledCountry]\n )\n\n const handleInputChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const target = event.target\n const snapshot = captureSelectionSnapshot(target)\n const raw = target.value\n keyboardBufferRef.current = \"\"\n\n const normalizedExplicitInternational = normalizeExplicitInternationalInput(raw)\n const manualCountry = manualSelectionCountryRef.current\n if (normalizedExplicitInternational != null && manualCountry) {\n const manualDialCode = getCountryCallingCode(manualCountry)\n if (!sanitizeDigits(normalizedExplicitInternational).startsWith(manualDialCode)) {\n manualSelectionCountryRef.current = null\n }\n } else if (normalizedExplicitInternational != null) {\n manualSelectionCountryRef.current = null\n }\n\n const activeManualCountry = manualSelectionCountryRef.current\n const rawDigits = sanitizeDigits(raw)\n if (\n !controlledCountry &&\n activeManualCountry &&\n normalizedExplicitInternational == null &&\n rawDigits\n ) {\n const manualOption = {\n value: activeManualCountry,\n dialCode: getCountryCallingCode(activeManualCountry),\n }\n const parsed = preferSelectedCountry(\n parsePhoneInput(\n getInputValueForSelectedCountry(\n raw,\n {\n value: manualOption.value,\n dialCode: manualOption.dialCode,\n },\n { allowImplicitInternational: false }\n ),\n activeManualCountry\n ),\n manualOption\n )\n applyParsedInput(parsed, snapshot)\n return\n }\n\n const baseCountry = controlledCountry ?? activeManualCountry ?? undefined\n const parsed = parsePhoneInput(raw, baseCountry)\n applyParsedInput(parsed, snapshot)\n },\n [applyParsedInput, controlledCountry]\n )\n\n const handleCountrySelect = React.useCallback(\n (option: SingleValue<CountryOption>) => {\n if (!option) {\n return\n }\n\n manualSelectionCountryRef.current = option.value\n const nextInputValue = getInputValueForSelectedCountry(inputValueState, option)\n const parsed = preferSelectedCountry(\n parsePhoneInput(nextInputValue, option.value),\n option\n )\n\n setInputValueState(parsed.displayValue)\n pendingSelectionRef.current = {\n start: parsed.displayValue.length,\n end: parsed.displayValue.length,\n }\n setShowSuggestions(false)\n setCountryQuery(\"\")\n setHighlightedIndex(-1)\n setLengthIssue(parsed.lengthIssue)\n\n if (!controlledCountry) {\n setUncontrolledCountry(option.value)\n }\n\n emitChange({\n formattedInternational: parsed.formattedInternational,\n formattedNational: parsed.formattedNational,\n e164: parsed.e164,\n country: parsed.country,\n countryCallingCode: parsed.countryCallingCode,\n nationalNumber: parsed.nationalNumber,\n rawInput: parsed.rawInput,\n isValid: parsed.isValid,\n })\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n },\n [controlledCountry, emitChange, inputValueState]\n )\n\n const filteredOptions = React.useMemo(() => {\n if (!showSuggestions) {\n return [] as CountryOption[]\n }\n\n const results: CountryOption[] = []\n\n const pushUnique = (option: CountryOption | undefined) => {\n if (option && !results.some((existing) => existing.value === option.value)) {\n results.push(option)\n }\n }\n\n const priorityOption = countryOptions.find((option) => option.value === menuPriorityCountry)\n const currentOption = activeCountry\n ? countryOptions.find((option) => option.value === activeCountry)\n : undefined\n const query = countryQuery.trim()\n const digitQuery = sanitizeDigits(query)\n const normalizedQuery = normalizeSearchValue(query)\n\n if (!digitQuery && !normalizedQuery) {\n pushUnique(currentOption)\n pushUnique(priorityOption)\n countryOptions.forEach(pushUnique)\n return results\n }\n\n if (digitQuery) {\n const dialMatches = countryOptions\n .filter((option) => option.dialCode.startsWith(digitQuery))\n .sort((a, b) => {\n const aExact = a.dialCode === digitQuery\n const bExact = b.dialCode === digitQuery\n if (aExact && !bExact) {\n return -1\n }\n if (!aExact && bExact) {\n return 1\n }\n return a.dialCode.length - b.dialCode.length\n })\n dialMatches.forEach(pushUnique)\n }\n\n if (normalizedQuery) {\n const nameMatches = countryOptions\n .filter((option) =>\n option.normalizedSearchableTokens.some((token) => token.includes(normalizedQuery))\n )\n .sort((a, b) => {\n const aIndex = optionMatchIndex(a.normalizedSearchableTokens, normalizedQuery)\n const bIndex = optionMatchIndex(b.normalizedSearchableTokens, normalizedQuery)\n if (aIndex !== bIndex) {\n return aIndex - bIndex\n }\n return a.name.localeCompare(b.name)\n })\n nameMatches.forEach(pushUnique)\n }\n\n pushUnique(currentOption)\n pushUnique(priorityOption)\n if (results.length === 0) {\n countryOptions.forEach(pushUnique)\n }\n\n return results\n }, [activeCountry, countryOptions, countryQuery, menuPriorityCountry, showSuggestions])\n\n const suggestionMenuIsOpen = isFocused && showSuggestions && filteredOptions.length > 0\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [suggestionMenuIsOpen])\n\n React.useEffect(() => {\n if (!suggestionMenuIsOpen) {\n setHighlightedIndex(-1)\n return\n }\n\n if (filteredOptions.length === 0) {\n setHighlightedIndex(-1)\n return\n }\n\n setHighlightedIndex((current) => {\n if (current < 0 || current >= filteredOptions.length) {\n return 0\n }\n return current\n })\n }, [filteredOptions, suggestionMenuIsOpen])\n\n const highlightedOption =\n highlightedIndex >= 0 ? filteredOptions[highlightedIndex] ?? null : null\n\n React.useEffect(() => {\n if (highlightedIndex < 0) {\n scrollBehaviorRef.current = \"smooth\"\n }\n }, [highlightedIndex])\n\n const consumeScrollBehavior = React.useCallback(() => {\n const behavior = scrollBehaviorRef.current\n scrollBehaviorRef.current = \"smooth\"\n return behavior\n }, [])\n\n const updateHighlightedOption = React.useCallback(\n (option: CountryOption) => {\n const index = filteredOptions.findIndex((candidate) => candidate.value === option.value)\n if (index !== -1) {\n setHighlightedIndex(index)\n }\n },\n [filteredOptions]\n )\n\n const selectFormatOptionLabel = React.useCallback<\n NonNullable<SelectProps<CountryOption, false>[\"formatOptionLabel\"]>\n >(\n (option, meta) => {\n if (userFormatOptionLabel) {\n return userFormatOptionLabel(option, meta)\n }\n return formatCountryOption(option)\n },\n [userFormatOptionLabel]\n )\n\n const optionLabelRenderer = React.useCallback(\n (option: CountryOption) =>\n selectFormatOptionLabel(option, {\n context: \"menu\",\n inputValue: countryQuery,\n selectValue: [],\n }),\n [countryQuery, selectFormatOptionLabel]\n )\n\n const highlightContextValue = React.useMemo<SuggestionContextValue>(\n () => ({\n highlightedValue: highlightedOption?.value ?? null,\n setHighlightedOption: updateHighlightedOption,\n renderOptionLabel: optionLabelRenderer,\n consumeScrollBehavior,\n }),\n [consumeScrollBehavior, highlightedOption, optionLabelRenderer, updateHighlightedOption]\n )\n\n const activeOption = activeCountry\n ? countryOptions.find((option) => option.value === activeCountry)\n : undefined\n const activeFlag = activeOption?.flag ?? \"\"\n const inlineFlagLabel = activeCountry\n ? resolvedMessages.selectedCountryLabel(activeOption?.name ?? activeCountry)\n : resolvedMessages.selectCountryLabel\n const hasInlineFlag = Boolean(activeCountry && activeFlag)\n const lengthHint =\n lengthIssue === \"TOO_LONG\"\n ? resolvedMessages.lengthTooLong(activeOption?.name ?? activeCountry ?? null)\n : null\n const countryName = activeOption?.name ?? activeCountry ?? null\n\n let validationNode: React.ReactNode = null\n if (lengthHint) {\n const rendered = renderValidationMessage?.({\n message: lengthHint,\n code: \"TOO_LONG\",\n countryName,\n })\n validationNode =\n rendered === undefined ? (\n <p className=\"mt-1 text-xs text-destructive\">\n <span>{lengthHint}</span>\n </p>\n ) : (\n rendered\n )\n }\n\n const appendToBuffer = React.useCallback(\n (char: string) => {\n keyboardBufferRef.current = `${keyboardBufferRef.current}${char}`.slice(-12)\n setCountryQuery(keyboardBufferRef.current)\n setShowSuggestions(true)\n scheduleBufferReset()\n },\n [scheduleBufferReset]\n )\n\n const popBuffer = React.useCallback(() => {\n const current = keyboardBufferRef.current\n if (!current) {\n return\n }\n keyboardBufferRef.current = current.slice(0, -1)\n setCountryQuery(keyboardBufferRef.current)\n if (keyboardBufferRef.current) {\n scheduleBufferReset()\n }\n }, [scheduleBufferReset])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n onInputKeyDown?.(event)\n if (event.defaultPrevented) {\n return\n }\n\n const key = event.key\n\n if (event.metaKey || event.ctrlKey || event.altKey) {\n return\n }\n\n const target = event.currentTarget\n const value = target.value\n const selectionStart = target.selectionStart ?? 0\n const selectionEnd = target.selectionEnd ?? selectionStart\n const isCollapsedSelection = selectionStart === selectionEnd\n\n if (key === \"Backspace\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n target.setSelectionRange(nextStart, nextStart)\n }\n } else if (key === \"ArrowLeft\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersLeft(value, selectionStart)\n if (nextStart !== selectionStart) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n } else if (key === \"ArrowRight\" && isCollapsedSelection) {\n const nextStart = skipFormattingCharactersRight(value, selectionEnd)\n if (nextStart !== selectionEnd) {\n event.preventDefault()\n target.setSelectionRange(nextStart, nextStart)\n return\n }\n }\n\n if (key === \"ArrowDown\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n const next = current < 0 ? 0 : (current + 1) % filteredOptions.length\n return next\n })\n }\n return\n }\n\n if (key === \"ArrowUp\") {\n scrollBehaviorRef.current = event.repeat ? \"auto\" : \"smooth\"\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? filteredOptions.length - 1 : -1)\n return\n }\n\n if (filteredOptions.length > 0) {\n setHighlightedIndex((current) => {\n if (current < 0) {\n return filteredOptions.length - 1\n }\n return (current - 1 + filteredOptions.length) % filteredOptions.length\n })\n }\n return\n }\n\n if (/^[a-z]$/i.test(key)) {\n event.preventDefault()\n if (!showSuggestions) {\n setShowSuggestions(true)\n setHighlightedIndex(filteredOptions.length > 0 ? 0 : -1)\n }\n appendToBuffer(key.toLowerCase())\n return\n }\n\n if (suggestionMenuIsOpen) {\n if (key === \"Backspace\" && keyboardBufferRef.current) {\n event.preventDefault()\n popBuffer()\n return\n }\n\n if (key === \"Escape\") {\n event.preventDefault()\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(false)\n return\n }\n\n if (key === \"Enter\" && filteredOptions.length > 0) {\n event.preventDefault()\n const targetOption = highlightedOption ?? filteredOptions[0]\n handleCountrySelect(targetOption)\n return\n }\n }\n },\n [\n appendToBuffer,\n filteredOptions,\n handleCountrySelect,\n highlightedOption,\n onInputKeyDown,\n popBuffer,\n showSuggestions,\n suggestionMenuIsOpen,\n ]\n )\n\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(true)\n onInputFocus?.(event)\n },\n [onInputFocus]\n )\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n setIsFocused(false)\n setShowSuggestions(false)\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n onInputBlur?.(event)\n },\n [onInputBlur]\n )\n\n const openCountryMenu = React.useCallback(() => {\n if (disabled || readOnly) {\n return\n }\n\n keyboardBufferRef.current = \"\"\n setCountryQuery(\"\")\n setShowSuggestions(true)\n setHighlightedIndex((current) => (current < 0 ? 0 : current))\n\n requestAnimationFrame(() => {\n inputRef.current?.focus()\n })\n }, [disabled, readOnly])\n\n const shimName = autofillShimName ?? (inputName ? `${inputName}_shim` : undefined)\n\n return (\n <div className={cn(\"relative flex flex-col\", className)}>\n <div className=\"relative\">\n <input\n {...restInputProps}\n ref={inputRef}\n type=\"tel\"\n className={cn(\n \"flex h-10 w-full rounded-md border border-input bg-background py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n \"pl-11 pr-3\",\n inputClassName\n )}\n name={inputName}\n value={inputValueState}\n onChange={handleInputChange}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n disabled={disabled}\n readOnly={readOnly}\n autoComplete={inputAutoComplete ?? \"off\"}\n />\n <button\n type=\"button\"\n className={cn(\n \"absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\",\n hasInlineFlag\n ? \"border-transparent\"\n : \"border-dashed border-border text-muted-foreground\",\n disabled\n ? \"cursor-not-allowed opacity-50\"\n : readOnly\n ? \"cursor-default\"\n : \"cursor-pointer hover:bg-muted\"\n )}\n aria-label={inlineFlagLabel}\n onMouseDown={(event) => event.preventDefault()}\n onClick={openCountryMenu}\n tabIndex={-1}\n disabled={disabled}\n >\n <span aria-hidden=\"true\">\n {hasInlineFlag ? activeFlag : \"?\"}\n </span>\n </button>\n </div>\n\n {shimName ? (\n <input\n tabIndex={-1}\n autoComplete=\"tel\"\n name={shimName}\n aria-hidden=\"true\"\n className=\"pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0\"\n />\n ) : null}\n\n <div\n className=\"absolute left-0 top-full z-30 mt-1\"\n style={{\n pointerEvents: suggestionMenuIsOpen ? \"auto\" : \"none\",\n width: \"min(260px, 100%)\",\n }}\n onMouseDown={(event) => event.preventDefault()}\n >\n {shouldRenderSelect ? (\n <SuggestionContext.Provider value={highlightContextValue}>\n <Select<CountryOption, false>\n {...restForwardedSelectProps}\n instanceId={selectInstanceId}\n menuIsOpen={suggestionMenuIsOpen}\n options={filteredOptions}\n value={null}\n components={mergedSelectComponents}\n styles={mergedSelectStyles}\n isClearable={false}\n isSearchable={false}\n backspaceRemovesValue={false}\n tabSelectsValue={false}\n menuShouldScrollIntoView={false}\n menuPortalTarget={menuPortalTarget}\n menuPosition={userMenuPosition ?? (menuPortalTarget ? \"fixed\" : \"absolute\")}\n onChange={handleCountrySelect}\n classNamePrefix={userClassNamePrefix ?? \"phone-number-suggestions\"}\n placeholder=\"\"\n formatOptionLabel={selectFormatOptionLabel}\n noOptionsMessage={\n noOptionsMessage ?? (() => resolvedMessages.noMatches)\n }\n />\n </SuggestionContext.Provider>\n ) : null}\n </div>\n\n {validationNode}\n </div>\n )\n }\n)\n\nPhoneNumberInput.displayName = \"PhoneNumberInput\"\n"],"mappings":";;;;;;;;;;;AA+DA,IAAM,IACJ;AAOF,SAAS,EAAyB,GAAe;CAC/C,OAAO,EAAM,QAA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,OAAO;KACjC,UAAA,kBAAC,IAAD;MACE,GAAI;MACJ,YAAY;MACZ,YAAY;MACZ,SAAS;MACT,OAAO;MACP,YAAY;MACZ,QAAQ;MACR,aAAa;MACb,cAAc;MACd,uBAAuB;MACvB,iBAAiB;MACjB,0BAA0B;MACR;MAClB,cAAc,OAAqB,IAAmB,UAAU;MAChE,UAAU;MACV,iBAAiB,MAAuB;MACxC,aAAY;MACZ,mBAAmB;MACnB,kBACE,aAA2B,EAAiB;KAC7C,CAAA;IAEuB,CAAA,IAC1B;GACD,CAAA;GAEJ;EACE;;AAET,CACF;AAEA,EAAiB,cAAc"}
|
package/dist/index363.js
CHANGED
|
@@ -1,494 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import { HiddenControl as ae, NullComponent as h, SuggestionContext as oe, SuggestionOption as se, formatCountryOption as ce, suggestionSelectStyles as le } from "./index362.js";
|
|
8
|
-
import * as g from "react";
|
|
9
|
-
import { jsx as _, jsxs as ue } from "react/jsx-runtime";
|
|
10
|
-
import de from "react-select";
|
|
11
|
-
//#region src/components/PhoneNumberInput/index.tsx
|
|
12
|
-
var v = /[\u061C\u200B-\u200F\u202A-\u202E\u2066-\u2069\uFEFF]/g;
|
|
13
|
-
function y(e) {
|
|
14
|
-
return e.replace(v, "");
|
|
1
|
+
"use client";
|
|
2
|
+
import * as e from "react";
|
|
3
|
+
//#region ../../node_modules/@base-ui/utils/useOnFirstRender.mjs
|
|
4
|
+
function t(t) {
|
|
5
|
+
let n = e.useRef(!0);
|
|
6
|
+
n.current && (n.current = !1, t());
|
|
15
7
|
}
|
|
16
|
-
function b(e) {
|
|
17
|
-
for (let t of r) if (e.startsWith(t)) return e.slice(t.length);
|
|
18
|
-
return e;
|
|
19
|
-
}
|
|
20
|
-
function fe(e) {
|
|
21
|
-
let t = `+${e}`, { phoneNumber: n, detectedCountry: r } = u(t);
|
|
22
|
-
return n?.isValid() && r ? t : null;
|
|
23
|
-
}
|
|
24
|
-
function pe(e) {
|
|
25
|
-
let t = y(e).trim();
|
|
26
|
-
if (!t) return null;
|
|
27
|
-
if (t.startsWith("+")) {
|
|
28
|
-
let e = f(t);
|
|
29
|
-
if (!e) return "+";
|
|
30
|
-
let n = b(e);
|
|
31
|
-
return n ? `+${n}` : "+";
|
|
32
|
-
}
|
|
33
|
-
let n = f(t);
|
|
34
|
-
if (!n) return null;
|
|
35
|
-
let r = b(n);
|
|
36
|
-
return r === n ? null : r ? `+${r}` : "+";
|
|
37
|
-
}
|
|
38
|
-
function me(e) {
|
|
39
|
-
let t = pe(e);
|
|
40
|
-
if (t != null) return t;
|
|
41
|
-
let n = f(y(e).trim());
|
|
42
|
-
return n ? fe(n) : null;
|
|
43
|
-
}
|
|
44
|
-
function he(e, n) {
|
|
45
|
-
return n || (e ? t(e) : null);
|
|
46
|
-
}
|
|
47
|
-
function ge(e, t, n) {
|
|
48
|
-
let r = y(e).trim(), i = f(r);
|
|
49
|
-
if (!i) return `+${t.dialCode}`;
|
|
50
|
-
let a = n?.allowImplicitInternational === !1 ? pe(r) : me(r);
|
|
51
|
-
if (a) {
|
|
52
|
-
let e = f(a);
|
|
53
|
-
if (e.startsWith(t.dialCode)) return a;
|
|
54
|
-
let { phoneNumber: n } = u(a), r = n?.countryCallingCode, i = r && e.startsWith(r) ? e.slice(r.length) : n?.nationalNumber ?? e;
|
|
55
|
-
return `+${t.dialCode}${i}`;
|
|
56
|
-
}
|
|
57
|
-
let { phoneNumber: o } = u(r, t.value);
|
|
58
|
-
return `+${t.dialCode}${o?.nationalNumber ?? i}`;
|
|
59
|
-
}
|
|
60
|
-
function _e(e, t) {
|
|
61
|
-
return {
|
|
62
|
-
...e,
|
|
63
|
-
country: t.value,
|
|
64
|
-
countryCallingCode: t.dialCode,
|
|
65
|
-
lengthIssue: d(e.rawInput, t.value)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function x(e, n) {
|
|
69
|
-
let r = y(e ?? "").trim();
|
|
70
|
-
if (!r) {
|
|
71
|
-
let e = n ?? null;
|
|
72
|
-
return {
|
|
73
|
-
displayValue: "",
|
|
74
|
-
formattedInternational: "",
|
|
75
|
-
formattedNational: "",
|
|
76
|
-
e164: null,
|
|
77
|
-
country: e,
|
|
78
|
-
countryCallingCode: e ? t(e) : null,
|
|
79
|
-
nationalNumber: "",
|
|
80
|
-
rawInput: "",
|
|
81
|
-
isValid: !1,
|
|
82
|
-
lengthIssue: null
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
let i = me(r);
|
|
86
|
-
if (!(i != null || n != null)) return {
|
|
87
|
-
displayValue: r,
|
|
88
|
-
formattedInternational: r,
|
|
89
|
-
formattedNational: r,
|
|
90
|
-
e164: null,
|
|
91
|
-
country: null,
|
|
92
|
-
countryCallingCode: null,
|
|
93
|
-
nationalNumber: f(r),
|
|
94
|
-
rawInput: r,
|
|
95
|
-
isValid: !1,
|
|
96
|
-
lengthIssue: null
|
|
97
|
-
};
|
|
98
|
-
let a = i ?? r, { international: o, national: s, formatted: ee, phoneNumber: c, detectedCountry: l } = u(a, n), te = i != null, p = te ? l ?? n ?? null : n ?? l ?? null, m = he(p, c?.countryCallingCode), re = f(a), ie = c?.nationalNumber ?? (m && a.startsWith("+") ? ne(re, m) : f(r));
|
|
99
|
-
return {
|
|
100
|
-
displayValue: te ? o : ee,
|
|
101
|
-
formattedInternational: c?.formatInternational() ?? o,
|
|
102
|
-
formattedNational: c?.formatNational() ?? s,
|
|
103
|
-
e164: c?.number ?? null,
|
|
104
|
-
country: p,
|
|
105
|
-
countryCallingCode: m,
|
|
106
|
-
nationalNumber: ie,
|
|
107
|
-
rawInput: a,
|
|
108
|
-
isValid: c?.isValid() ?? !1,
|
|
109
|
-
lengthIssue: p ? d(a, p) : null
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
var S = g.forwardRef(function(r, u) {
|
|
113
|
-
let { value: d, defaultCountry: ne, country: v, locale: y, onChange: b, onCountryChange: fe, className: me, inputClassName: he, disabled: S, readOnly: C, selectProps: ve, autofillShimName: ye, messages: be, renderValidationMessage: xe, ...Se } = r, { onFocus: Ce, onBlur: we, onKeyDown: Te, name: Ee, autoComplete: De, ...Oe } = Se, w = typeof v == "string" ? v : null, T = o(y), E = g.useMemo(() => l(T), [T]), D = g.useMemo(() => n(E, be), [E, be]), O = g.useMemo(() => a(E, T), [T, E]), k = g.useCallback((e) => {
|
|
114
|
-
let t = O.find((t) => t.value === e);
|
|
115
|
-
return t ? te(t) : i(e);
|
|
116
|
-
}, [O]), ke = g.useMemo(() => {
|
|
117
|
-
let e = s(ne ?? v ?? "US");
|
|
118
|
-
return O.some((t) => t.value === e) ? e : O[0]?.value ?? "US";
|
|
119
|
-
}, [
|
|
120
|
-
O,
|
|
121
|
-
v,
|
|
122
|
-
ne
|
|
123
|
-
]), Ae = g.useRef(null);
|
|
124
|
-
Ae.current ||= x(d, w ?? void 0);
|
|
125
|
-
let je = Ae.current, [A, Me] = g.useState(w ? null : je.country), [j, Ne] = g.useState(je.displayValue), [M, N] = g.useState(""), [P, F] = g.useState(!1), [I, L] = g.useState(-1), [Pe, Fe] = g.useState(!1), [Ie, Le] = g.useState(!1), [Re, R] = g.useState(je.lengthIssue), z = g.useRef(null), B = g.useRef(""), V = g.useRef(null), H = g.useRef("smooth"), U = g.useRef(null), ze = g.useRef(!1), Be = g.useRef(null), W = g.useRef(null), G = w ?? A, Ve = w ?? z.current ?? void 0;
|
|
126
|
-
g.useImperativeHandle(u, () => W.current, []), g.useLayoutEffect(() => {
|
|
127
|
-
Le(!0);
|
|
128
|
-
}, []), g.useLayoutEffect(() => {
|
|
129
|
-
let e = U.current;
|
|
130
|
-
if (!e) return;
|
|
131
|
-
let t = W.current;
|
|
132
|
-
if (U.current = null, !t) return;
|
|
133
|
-
let { start: n, end: r } = e;
|
|
134
|
-
t.setSelectionRange(n, r);
|
|
135
|
-
}, [j]);
|
|
136
|
-
let He = ve ?? {}, Ue = g.useId(), { styles: We, components: Ge, classNamePrefix: Ke, formatOptionLabel: qe, menuPortalTarget: Je, menuPosition: Ye, ...Xe } = He, { instanceId: Ze, noOptionsMessage: Qe, ...$e } = Xe, et = Ze ?? Ue, [tt, nt] = g.useState(null), rt = "menuPortalTarget" in He, K = rt ? Je : tt, it = g.useMemo(() => {
|
|
137
|
-
let e = We?.menuPortal;
|
|
138
|
-
return {
|
|
139
|
-
...le,
|
|
140
|
-
...We ?? {},
|
|
141
|
-
menuPortal: (t, n) => {
|
|
142
|
-
let r = {
|
|
143
|
-
...t,
|
|
144
|
-
zIndex: 1300
|
|
145
|
-
}, i = e ? e(r, n) : r;
|
|
146
|
-
if (typeof document > "u" || !K || K === document.body) return i;
|
|
147
|
-
let a = K.getBoundingClientRect();
|
|
148
|
-
return {
|
|
149
|
-
...i,
|
|
150
|
-
left: typeof i.left == "number" ? i.left - a.left : i.left,
|
|
151
|
-
top: typeof i.top == "number" ? i.top - a.top : i.top
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}, [K, We]);
|
|
156
|
-
g.useLayoutEffect(() => {
|
|
157
|
-
if (rt || typeof document > "u") return;
|
|
158
|
-
let e = W.current?.closest("[data-slot='dialog-content'], [data-slot='sheet-content'], [role='dialog']") ?? document.body;
|
|
159
|
-
nt(e);
|
|
160
|
-
}, [rt]);
|
|
161
|
-
let at = g.useMemo(() => {
|
|
162
|
-
let e = {
|
|
163
|
-
Control: ae,
|
|
164
|
-
IndicatorsContainer: h,
|
|
165
|
-
DropdownIndicator: h,
|
|
166
|
-
IndicatorSeparator: h,
|
|
167
|
-
ValueContainer: h
|
|
168
|
-
}, t = Ge ?? {};
|
|
169
|
-
return t.Option ? {
|
|
170
|
-
...e,
|
|
171
|
-
...t
|
|
172
|
-
} : {
|
|
173
|
-
...e,
|
|
174
|
-
...t,
|
|
175
|
-
Option: se
|
|
176
|
-
};
|
|
177
|
-
}, [Ge]);
|
|
178
|
-
g.useEffect(() => () => {
|
|
179
|
-
V.current != null && typeof window < "u" && window.clearTimeout(V.current);
|
|
180
|
-
}, []), g.useEffect(() => {
|
|
181
|
-
if (d == null) return;
|
|
182
|
-
let e = x(d, Ve);
|
|
183
|
-
B.current = "", Ne(e.displayValue), F(!1), N(""), L(-1), R(e.lengthIssue), !w && e.country !== A && Me(e.country);
|
|
184
|
-
}, [
|
|
185
|
-
w,
|
|
186
|
-
Ve,
|
|
187
|
-
A,
|
|
188
|
-
d
|
|
189
|
-
]), g.useEffect(() => {
|
|
190
|
-
let e = G ?? null;
|
|
191
|
-
!ze.current && e == null || ze.current && Be.current === e || (ze.current = !0, Be.current = e, fe?.(e, e ? k(e) : null));
|
|
192
|
-
}, [
|
|
193
|
-
G,
|
|
194
|
-
fe,
|
|
195
|
-
k
|
|
196
|
-
]);
|
|
197
|
-
let q = g.useCallback((e) => {
|
|
198
|
-
b?.({
|
|
199
|
-
...e,
|
|
200
|
-
selectedCountry: e.country ? k(e.country) : null
|
|
201
|
-
});
|
|
202
|
-
}, [b, k]), J = g.useCallback(() => {
|
|
203
|
-
typeof window > "u" || (V.current != null && window.clearTimeout(V.current), V.current = window.setTimeout(() => {
|
|
204
|
-
B.current = "", V.current = null;
|
|
205
|
-
}, 800));
|
|
206
|
-
}, []), ot = g.useCallback((e, t) => {
|
|
207
|
-
Ne(e.displayValue), F(!1), N(""), L(-1), R(e.lengthIssue), !w && e.country !== A && Me(e.country), t && (U.current = m(t, e.displayValue)), q({
|
|
208
|
-
formattedInternational: e.formattedInternational,
|
|
209
|
-
formattedNational: e.formattedNational,
|
|
210
|
-
e164: e.e164,
|
|
211
|
-
country: e.country,
|
|
212
|
-
countryCallingCode: e.countryCallingCode,
|
|
213
|
-
nationalNumber: e.nationalNumber,
|
|
214
|
-
rawInput: e.rawInput,
|
|
215
|
-
isValid: e.isValid
|
|
216
|
-
});
|
|
217
|
-
}, [
|
|
218
|
-
w,
|
|
219
|
-
q,
|
|
220
|
-
A
|
|
221
|
-
]), st = g.useCallback((e) => {
|
|
222
|
-
let n = e.target, r = p(n), i = n.value;
|
|
223
|
-
B.current = "";
|
|
224
|
-
let a = pe(i), o = z.current;
|
|
225
|
-
if (a != null && o) {
|
|
226
|
-
let e = t(o);
|
|
227
|
-
f(a).startsWith(e) || (z.current = null);
|
|
228
|
-
} else a != null && (z.current = null);
|
|
229
|
-
let s = z.current, ee = f(i);
|
|
230
|
-
if (!w && s && a == null && ee) {
|
|
231
|
-
let e = {
|
|
232
|
-
value: s,
|
|
233
|
-
dialCode: t(s)
|
|
234
|
-
}, n = _e(x(ge(i, {
|
|
235
|
-
value: e.value,
|
|
236
|
-
dialCode: e.dialCode
|
|
237
|
-
}, { allowImplicitInternational: !1 }), s), e);
|
|
238
|
-
ot(n, r);
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
let c = x(i, w ?? s ?? void 0);
|
|
242
|
-
ot(c, r);
|
|
243
|
-
}, [ot, w]), ct = g.useCallback((e) => {
|
|
244
|
-
if (!e) return;
|
|
245
|
-
z.current = e.value;
|
|
246
|
-
let t = _e(x(ge(j, e), e.value), e);
|
|
247
|
-
Ne(t.displayValue), U.current = {
|
|
248
|
-
start: t.displayValue.length,
|
|
249
|
-
end: t.displayValue.length
|
|
250
|
-
}, F(!1), N(""), L(-1), R(t.lengthIssue), w || Me(e.value), q({
|
|
251
|
-
formattedInternational: t.formattedInternational,
|
|
252
|
-
formattedNational: t.formattedNational,
|
|
253
|
-
e164: t.e164,
|
|
254
|
-
country: t.country,
|
|
255
|
-
countryCallingCode: t.countryCallingCode,
|
|
256
|
-
nationalNumber: t.nationalNumber,
|
|
257
|
-
rawInput: t.rawInput,
|
|
258
|
-
isValid: t.isValid
|
|
259
|
-
}), requestAnimationFrame(() => {
|
|
260
|
-
W.current?.focus();
|
|
261
|
-
});
|
|
262
|
-
}, [
|
|
263
|
-
w,
|
|
264
|
-
q,
|
|
265
|
-
j
|
|
266
|
-
]), Y = g.useMemo(() => {
|
|
267
|
-
if (!P) return [];
|
|
268
|
-
let e = [], t = (t) => {
|
|
269
|
-
t && !e.some((e) => e.value === t.value) && e.push(t);
|
|
270
|
-
}, n = O.find((e) => e.value === ke), r = G ? O.find((e) => e.value === G) : void 0, i = M.trim(), a = f(i), o = ee(i);
|
|
271
|
-
return !a && !o ? (t(r), t(n), O.forEach(t), e) : (a && O.filter((e) => e.dialCode.startsWith(a)).sort((e, t) => {
|
|
272
|
-
let n = e.dialCode === a, r = t.dialCode === a;
|
|
273
|
-
return n && !r ? -1 : !n && r ? 1 : e.dialCode.length - t.dialCode.length;
|
|
274
|
-
}).forEach(t), o && O.filter((e) => e.normalizedSearchableTokens.some((e) => e.includes(o))).sort((e, t) => {
|
|
275
|
-
let n = c(e.normalizedSearchableTokens, o), r = c(t.normalizedSearchableTokens, o);
|
|
276
|
-
return n === r ? e.name.localeCompare(t.name) : n - r;
|
|
277
|
-
}).forEach(t), t(r), t(n), e.length === 0 && O.forEach(t), e);
|
|
278
|
-
}, [
|
|
279
|
-
G,
|
|
280
|
-
O,
|
|
281
|
-
M,
|
|
282
|
-
ke,
|
|
283
|
-
P
|
|
284
|
-
]), X = Pe && P && Y.length > 0;
|
|
285
|
-
g.useEffect(() => {
|
|
286
|
-
X || (H.current = "smooth");
|
|
287
|
-
}, [X]), g.useEffect(() => {
|
|
288
|
-
if (!X) {
|
|
289
|
-
L(-1);
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
if (Y.length === 0) {
|
|
293
|
-
L(-1);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
L((e) => e < 0 || e >= Y.length ? 0 : e);
|
|
297
|
-
}, [Y, X]);
|
|
298
|
-
let Z = I >= 0 ? Y[I] ?? null : null;
|
|
299
|
-
g.useEffect(() => {
|
|
300
|
-
I < 0 && (H.current = "smooth");
|
|
301
|
-
}, [I]);
|
|
302
|
-
let lt = g.useCallback(() => {
|
|
303
|
-
let e = H.current;
|
|
304
|
-
return H.current = "smooth", e;
|
|
305
|
-
}, []), ut = g.useCallback((e) => {
|
|
306
|
-
let t = Y.findIndex((t) => t.value === e.value);
|
|
307
|
-
t !== -1 && L(t);
|
|
308
|
-
}, [Y]), dt = g.useCallback((e, t) => qe ? qe(e, t) : ce(e), [qe]), ft = g.useCallback((e) => dt(e, {
|
|
309
|
-
context: "menu",
|
|
310
|
-
inputValue: M,
|
|
311
|
-
selectValue: []
|
|
312
|
-
}), [M, dt]), pt = g.useMemo(() => ({
|
|
313
|
-
highlightedValue: Z?.value ?? null,
|
|
314
|
-
setHighlightedOption: ut,
|
|
315
|
-
renderOptionLabel: ft,
|
|
316
|
-
consumeScrollBehavior: lt
|
|
317
|
-
}), [
|
|
318
|
-
lt,
|
|
319
|
-
Z,
|
|
320
|
-
ft,
|
|
321
|
-
ut
|
|
322
|
-
]), Q = G ? O.find((e) => e.value === G) : void 0, mt = Q?.flag ?? "", ht = G ? D.selectedCountryLabel(Q?.name ?? G) : D.selectCountryLabel, gt = !!(G && mt), $ = Re === "TOO_LONG" ? D.lengthTooLong(Q?.name ?? G ?? null) : null, _t = Q?.name ?? G ?? null, vt = null;
|
|
323
|
-
if ($) {
|
|
324
|
-
let e = xe?.({
|
|
325
|
-
message: $,
|
|
326
|
-
code: "TOO_LONG",
|
|
327
|
-
countryName: _t
|
|
328
|
-
});
|
|
329
|
-
vt = e === void 0 ? /* @__PURE__ */ _("p", {
|
|
330
|
-
className: "mt-1 text-xs text-destructive",
|
|
331
|
-
children: /* @__PURE__ */ _("span", { children: $ })
|
|
332
|
-
}) : e;
|
|
333
|
-
}
|
|
334
|
-
let yt = g.useCallback((e) => {
|
|
335
|
-
B.current = `${B.current}${e}`.slice(-12), N(B.current), F(!0), J();
|
|
336
|
-
}, [J]), bt = g.useCallback(() => {
|
|
337
|
-
let e = B.current;
|
|
338
|
-
e && (B.current = e.slice(0, -1), N(B.current), B.current && J());
|
|
339
|
-
}, [J]), xt = g.useCallback((e) => {
|
|
340
|
-
if (Te?.(e), e.defaultPrevented) return;
|
|
341
|
-
let t = e.key;
|
|
342
|
-
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
343
|
-
let n = e.currentTarget, r = n.value, i = n.selectionStart ?? 0, a = n.selectionEnd ?? i, o = i === a;
|
|
344
|
-
if (t === "Backspace" && o) {
|
|
345
|
-
let e = re(r, i);
|
|
346
|
-
e !== i && n.setSelectionRange(e, e);
|
|
347
|
-
} else if (t === "ArrowLeft" && o) {
|
|
348
|
-
let t = re(r, i);
|
|
349
|
-
if (t !== i) {
|
|
350
|
-
e.preventDefault(), n.setSelectionRange(t, t);
|
|
351
|
-
return;
|
|
352
|
-
}
|
|
353
|
-
} else if (t === "ArrowRight" && o) {
|
|
354
|
-
let t = ie(r, a);
|
|
355
|
-
if (t !== a) {
|
|
356
|
-
e.preventDefault(), n.setSelectionRange(t, t);
|
|
357
|
-
return;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
if (t === "ArrowDown") {
|
|
361
|
-
if (H.current = e.repeat ? "auto" : "smooth", e.preventDefault(), !P) {
|
|
362
|
-
F(!0), L(Y.length > 0 ? 0 : -1);
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
Y.length > 0 && L((e) => e < 0 ? 0 : (e + 1) % Y.length);
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
if (t === "ArrowUp") {
|
|
369
|
-
if (H.current = e.repeat ? "auto" : "smooth", e.preventDefault(), !P) {
|
|
370
|
-
F(!0), L(Y.length > 0 ? Y.length - 1 : -1);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
Y.length > 0 && L((e) => e < 0 ? Y.length - 1 : (e - 1 + Y.length) % Y.length);
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
if (/^[a-z]$/i.test(t)) {
|
|
377
|
-
e.preventDefault(), P || (F(!0), L(Y.length > 0 ? 0 : -1)), yt(t.toLowerCase());
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
if (X) {
|
|
381
|
-
if (t === "Backspace" && B.current) {
|
|
382
|
-
e.preventDefault(), bt();
|
|
383
|
-
return;
|
|
384
|
-
}
|
|
385
|
-
if (t === "Escape") {
|
|
386
|
-
e.preventDefault(), B.current = "", N(""), F(!1);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
if (t === "Enter" && Y.length > 0) {
|
|
390
|
-
e.preventDefault();
|
|
391
|
-
let t = Z ?? Y[0];
|
|
392
|
-
ct(t);
|
|
393
|
-
return;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
}, [
|
|
397
|
-
yt,
|
|
398
|
-
Y,
|
|
399
|
-
ct,
|
|
400
|
-
Z,
|
|
401
|
-
Te,
|
|
402
|
-
bt,
|
|
403
|
-
P,
|
|
404
|
-
X
|
|
405
|
-
]), St = g.useCallback((e) => {
|
|
406
|
-
Fe(!0), Ce?.(e);
|
|
407
|
-
}, [Ce]), Ct = g.useCallback((e) => {
|
|
408
|
-
Fe(!1), F(!1), B.current = "", N(""), we?.(e);
|
|
409
|
-
}, [we]), wt = g.useCallback(() => {
|
|
410
|
-
S || C || (B.current = "", N(""), F(!0), L((e) => e < 0 ? 0 : e), requestAnimationFrame(() => {
|
|
411
|
-
W.current?.focus();
|
|
412
|
-
}));
|
|
413
|
-
}, [S, C]), Tt = ye ?? (Ee ? `${Ee}_shim` : void 0);
|
|
414
|
-
return /* @__PURE__ */ ue("div", {
|
|
415
|
-
className: e("relative flex flex-col", me),
|
|
416
|
-
children: [
|
|
417
|
-
/* @__PURE__ */ ue("div", {
|
|
418
|
-
className: "relative",
|
|
419
|
-
children: [/* @__PURE__ */ _("input", {
|
|
420
|
-
...Oe,
|
|
421
|
-
ref: W,
|
|
422
|
-
type: "tel",
|
|
423
|
-
className: e("flex h-10 w-full rounded-md border border-input bg-background py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm", "pl-11 pr-3", he),
|
|
424
|
-
name: Ee,
|
|
425
|
-
value: j,
|
|
426
|
-
onChange: st,
|
|
427
|
-
onFocus: St,
|
|
428
|
-
onBlur: Ct,
|
|
429
|
-
onKeyDown: xt,
|
|
430
|
-
disabled: S,
|
|
431
|
-
readOnly: C,
|
|
432
|
-
autoComplete: De ?? "off"
|
|
433
|
-
}), /* @__PURE__ */ _("button", {
|
|
434
|
-
type: "button",
|
|
435
|
-
className: e("absolute left-3 top-1/2 flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded border text-lg leading-none transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", gt ? "border-transparent" : "border-dashed border-border text-muted-foreground", S ? "cursor-not-allowed opacity-50" : C ? "cursor-default" : "cursor-pointer hover:bg-muted"),
|
|
436
|
-
"aria-label": ht,
|
|
437
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
438
|
-
onClick: wt,
|
|
439
|
-
tabIndex: -1,
|
|
440
|
-
disabled: S,
|
|
441
|
-
children: /* @__PURE__ */ _("span", {
|
|
442
|
-
"aria-hidden": "true",
|
|
443
|
-
children: gt ? mt : "?"
|
|
444
|
-
})
|
|
445
|
-
})]
|
|
446
|
-
}),
|
|
447
|
-
Tt ? /* @__PURE__ */ _("input", {
|
|
448
|
-
tabIndex: -1,
|
|
449
|
-
autoComplete: "tel",
|
|
450
|
-
name: Tt,
|
|
451
|
-
"aria-hidden": "true",
|
|
452
|
-
className: "pointer-events-none absolute left-0 top-0 h-0 w-0 opacity-0"
|
|
453
|
-
}) : null,
|
|
454
|
-
/* @__PURE__ */ _("div", {
|
|
455
|
-
className: "absolute left-0 top-full z-30 mt-1",
|
|
456
|
-
style: {
|
|
457
|
-
pointerEvents: X ? "auto" : "none",
|
|
458
|
-
width: "min(260px, 100%)"
|
|
459
|
-
},
|
|
460
|
-
onMouseDown: (e) => e.preventDefault(),
|
|
461
|
-
children: Ie ? /* @__PURE__ */ _(oe.Provider, {
|
|
462
|
-
value: pt,
|
|
463
|
-
children: /* @__PURE__ */ _(de, {
|
|
464
|
-
...$e,
|
|
465
|
-
instanceId: et,
|
|
466
|
-
menuIsOpen: X,
|
|
467
|
-
options: Y,
|
|
468
|
-
value: null,
|
|
469
|
-
components: at,
|
|
470
|
-
styles: it,
|
|
471
|
-
isClearable: !1,
|
|
472
|
-
isSearchable: !1,
|
|
473
|
-
backspaceRemovesValue: !1,
|
|
474
|
-
tabSelectsValue: !1,
|
|
475
|
-
menuShouldScrollIntoView: !1,
|
|
476
|
-
menuPortalTarget: K,
|
|
477
|
-
menuPosition: Ye ?? (K ? "fixed" : "absolute"),
|
|
478
|
-
onChange: ct,
|
|
479
|
-
classNamePrefix: Ke ?? "phone-number-suggestions",
|
|
480
|
-
placeholder: "",
|
|
481
|
-
formatOptionLabel: dt,
|
|
482
|
-
noOptionsMessage: Qe ?? (() => D.noMatches)
|
|
483
|
-
})
|
|
484
|
-
}) : null
|
|
485
|
-
}),
|
|
486
|
-
vt
|
|
487
|
-
]
|
|
488
|
-
});
|
|
489
|
-
});
|
|
490
|
-
S.displayName = "PhoneNumberInput";
|
|
491
8
|
//#endregion
|
|
492
|
-
export {
|
|
9
|
+
export { t as useOnFirstRender };
|
|
493
10
|
|
|
494
11
|
//# sourceMappingURL=index363.js.map
|