@rxdrag/website-lib-react 0.0.3 → 0.0.6
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/ReactModalTrigger-9207e763.js +26 -0
- package/dist/ReactModalTrigger-9207e763.js.map +1 -0
- package/dist/components/RichTextOutline/parseOutline.d.ts +5 -0
- package/dist/components/all.d.ts +0 -21
- package/dist/components/index.d.ts +0 -5
- package/dist/forms.d.ts +1 -0
- package/dist/forms.mjs +1647 -0
- package/dist/forms.mjs.map +1 -0
- package/dist/index.mjs +9 -3918
- package/dist/index.mjs.map +1 -1
- package/dist/jsx-runtime-c02cc059.js +325 -0
- package/dist/jsx-runtime-c02cc059.js.map +1 -0
- package/dist/media.d.ts +1 -0
- package/dist/media.mjs +613 -0
- package/dist/media.mjs.map +1 -0
- package/dist/richtext.d.ts +1 -0
- package/dist/richtext.mjs +191 -0
- package/dist/richtext.mjs.map +1 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.mjs +687 -0
- package/dist/ui.mjs.map +1 -0
- package/dist/video.d.ts +2 -0
- package/dist/video.mjs +426 -0
- package/dist/video.mjs.map +1 -0
- package/forms.ts +1 -0
- package/index.ts +1 -0
- package/media.ts +1 -0
- package/package.json +41 -6
- package/richtext.ts +1 -0
- package/src/components/Analytics/eventHandlers.ts +173 -0
- package/src/components/Analytics/index.tsx +21 -0
- package/src/components/Analytics/singleton.ts +214 -0
- package/src/components/Analytics/tracking.ts +221 -0
- package/src/components/Analytics/types.ts +60 -0
- package/src/components/Analytics/utils.ts +95 -0
- package/src/components/AttachmentIcon/index.tsx +53 -0
- package/src/components/BackgroundHlsVideoPlayer.tsx +97 -0
- package/src/components/BackgroundVideoPlayer.tsx +32 -0
- package/src/components/Bulletin.tsx +30 -0
- package/src/components/ContactForm/ContactForm.tsx +290 -0
- package/src/components/ContactForm/FileUpload2.tsx +423 -0
- package/src/components/ContactForm/Input.tsx +48 -0
- package/src/components/ContactForm/Input2.tsx +59 -0
- package/src/components/ContactForm/Submit.tsx +48 -0
- package/src/components/ContactForm/TelInput.tsx +215 -0
- package/src/components/ContactForm/TelInput2.tsx +213 -0
- package/src/components/ContactForm/Textarea.tsx +48 -0
- package/src/components/ContactForm/Textarea2.tsx +89 -0
- package/src/components/ContactForm/countryDialCodes.ts +243 -0
- package/src/components/ContactForm/factory.tsx +60 -0
- package/src/components/ContactForm/funcs.ts +64 -0
- package/src/components/ContactForm/hooks/useInlineLabelPadding.ts +43 -0
- package/src/components/ContactForm/hooks/useTelControl.ts +81 -0
- package/src/components/ContactForm/index.ts +7 -0
- package/src/components/ContactForm/types.ts +68 -0
- package/src/components/Icon/index.tsx +20 -0
- package/src/components/Medias/MainMedia.tsx +257 -0
- package/src/components/Medias/Thumbnail.tsx +62 -0
- package/src/components/Medias/VideoPlayer.tsx +114 -0
- package/src/components/Medias/index.tsx +271 -0
- package/src/components/ProductCard/ProductCard.tsx +24 -0
- package/src/components/ProductCard/ProductCta/index.tsx +28 -0
- package/src/components/ProductCard/ProductCta/style.css +4 -0
- package/src/components/ProductCard/ProductDescription/index.tsx +13 -0
- package/src/components/ProductCard/ProductDescription/style.css +6 -0
- package/src/components/ProductCard/ProductMedia/index.tsx +35 -0
- package/src/components/ProductCard/ProductMedia/style.css +6 -0
- package/src/components/ProductCard/ProductTitle/index.tsx +7 -0
- package/src/components/ProductCard/ProductTitle/style.css +4 -0
- package/src/components/ProductCard/ProductView.tsx +36 -0
- package/src/components/ProductCard/index.ts +5 -0
- package/src/components/ProductCard/useQueryProduct.ts +32 -0
- package/src/components/ReactModalTrigger.tsx +28 -0
- package/src/components/ReactVideoPlayer.tsx +332 -0
- package/src/components/RichTextOutline/index.tsx +74 -0
- package/src/components/RichTextOutline/parseOutline.ts +63 -0
- package/src/components/RichTextOutline/useAcitviedHeading.ts +142 -0
- package/src/components/RichTextOutline/useAnchorScroll.ts +24 -0
- package/src/components/Scroller.tsx +39 -0
- package/src/components/SearchInput.tsx +21 -0
- package/src/components/Share/index.tsx +86 -0
- package/src/components/Share/socials.tsx +80 -0
- package/src/components/Share//350/265/204/346/226/231.md +7 -0
- package/src/components/ToTop.tsx +72 -0
- package/src/components/VideoPlayIcon.tsx +43 -0
- package/src/components/all.ts +25 -0
- package/src/components/index.ts +12 -0
- package/src/forms.ts +1 -0
- package/src/index.ts +1 -0
- package/src/media.ts +1 -0
- package/src/richtext.ts +1 -0
- package/src/types/view-model.ts +37 -0
- package/src/ui.ts +10 -0
- package/src/video.ts +2 -0
- package/ui.ts +1 -0
- package/video.ts +1 -0
- package/dist/style.css +0 -17
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
export type CountryDial = {
|
|
2
|
+
code: string; // ISO 3166-1 alpha-2
|
|
3
|
+
name: string; // English name
|
|
4
|
+
region?: string; // Continent/region label
|
|
5
|
+
dialCode: string; // +NN
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// Note: Names follow common English naming used in international forms.
|
|
9
|
+
// Region is a coarse grouping for search hints.
|
|
10
|
+
export const countries: CountryDial[] = [
|
|
11
|
+
{ code: "AF", name: "Afghanistan", region: "Asia", dialCode: "+93" },
|
|
12
|
+
{ code: "AL", name: "Albania", region: "Europe", dialCode: "+355" },
|
|
13
|
+
{ code: "DZ", name: "Algeria", region: "Africa", dialCode: "+213" },
|
|
14
|
+
{ code: "AS", name: "American Samoa", region: "Oceania", dialCode: "+1" },
|
|
15
|
+
{ code: "AD", name: "Andorra", region: "Europe", dialCode: "+376" },
|
|
16
|
+
{ code: "AO", name: "Angola", region: "Africa", dialCode: "+244" },
|
|
17
|
+
{ code: "AI", name: "Anguilla", region: "North America", dialCode: "+1" },
|
|
18
|
+
{ code: "AG", name: "Antigua and Barbuda", region: "North America", dialCode: "+1" },
|
|
19
|
+
{ code: "AR", name: "Argentina", region: "South America", dialCode: "+54" },
|
|
20
|
+
{ code: "AM", name: "Armenia", region: "Asia", dialCode: "+374" },
|
|
21
|
+
{ code: "AW", name: "Aruba", region: "North America", dialCode: "+297" },
|
|
22
|
+
{ code: "AU", name: "Australia", region: "Oceania", dialCode: "+61" },
|
|
23
|
+
{ code: "AT", name: "Austria", region: "Europe", dialCode: "+43" },
|
|
24
|
+
{ code: "AZ", name: "Azerbaijan", region: "Asia", dialCode: "+994" },
|
|
25
|
+
{ code: "BS", name: "Bahamas", region: "North America", dialCode: "+1" },
|
|
26
|
+
{ code: "BH", name: "Bahrain", region: "Asia", dialCode: "+973" },
|
|
27
|
+
{ code: "BD", name: "Bangladesh", region: "Asia", dialCode: "+880" },
|
|
28
|
+
{ code: "BB", name: "Barbados", region: "North America", dialCode: "+1" },
|
|
29
|
+
{ code: "BY", name: "Belarus", region: "Europe", dialCode: "+375" },
|
|
30
|
+
{ code: "BE", name: "Belgium", region: "Europe", dialCode: "+32" },
|
|
31
|
+
{ code: "BZ", name: "Belize", region: "North America", dialCode: "+501" },
|
|
32
|
+
{ code: "BJ", name: "Benin", region: "Africa", dialCode: "+229" },
|
|
33
|
+
{ code: "BM", name: "Bermuda", region: "North America", dialCode: "+1" },
|
|
34
|
+
{ code: "BT", name: "Bhutan", region: "Asia", dialCode: "+975" },
|
|
35
|
+
{ code: "BO", name: "Bolivia", region: "South America", dialCode: "+591" },
|
|
36
|
+
{ code: "BA", name: "Bosnia and Herzegovina", region: "Europe", dialCode: "+387" },
|
|
37
|
+
{ code: "BW", name: "Botswana", region: "Africa", dialCode: "+267" },
|
|
38
|
+
{ code: "BR", name: "Brazil", region: "South America", dialCode: "+55" },
|
|
39
|
+
{ code: "VG", name: "British Virgin Islands", region: "North America", dialCode: "+1" },
|
|
40
|
+
{ code: "BN", name: "Brunei", region: "Asia", dialCode: "+673" },
|
|
41
|
+
{ code: "BG", name: "Bulgaria", region: "Europe", dialCode: "+359" },
|
|
42
|
+
{ code: "BF", name: "Burkina Faso", region: "Africa", dialCode: "+226" },
|
|
43
|
+
{ code: "BI", name: "Burundi", region: "Africa", dialCode: "+257" },
|
|
44
|
+
{ code: "KH", name: "Cambodia", region: "Asia", dialCode: "+855" },
|
|
45
|
+
{ code: "CM", name: "Cameroon", region: "Africa", dialCode: "+237" },
|
|
46
|
+
{ code: "CA", name: "Canada", region: "North America", dialCode: "+1" },
|
|
47
|
+
{ code: "CV", name: "Cape Verde", region: "Africa", dialCode: "+238" },
|
|
48
|
+
{ code: "KY", name: "Cayman Islands", region: "North America", dialCode: "+1" },
|
|
49
|
+
{ code: "CF", name: "Central African Republic", region: "Africa", dialCode: "+236" },
|
|
50
|
+
{ code: "TD", name: "Chad", region: "Africa", dialCode: "+235" },
|
|
51
|
+
{ code: "CL", name: "Chile", region: "South America", dialCode: "+56" },
|
|
52
|
+
{ code: "CN", name: "China", region: "Asia", dialCode: "+86" },
|
|
53
|
+
{ code: "HK", name: "Hong Kong, China", region: "Asia", dialCode: "+852" },
|
|
54
|
+
{ code: "MO", name: "Macao, China", region: "Asia", dialCode: "+853" },
|
|
55
|
+
{ code: "TW", name: "Taiwan, China", region: "Asia", dialCode: "+886" },
|
|
56
|
+
{ code: "CO", name: "Colombia", region: "South America", dialCode: "+57" },
|
|
57
|
+
{ code: "KM", name: "Comoros", region: "Africa", dialCode: "+269" },
|
|
58
|
+
{ code: "CG", name: "Congo", region: "Africa", dialCode: "+242" },
|
|
59
|
+
{ code: "CD", name: "Congo (DRC)", region: "Africa", dialCode: "+243" },
|
|
60
|
+
{ code: "CR", name: "Costa Rica", region: "North America", dialCode: "+506" },
|
|
61
|
+
{ code: "CI", name: "Côte d’Ivoire", region: "Africa", dialCode: "+225" },
|
|
62
|
+
{ code: "HR", name: "Croatia", region: "Europe", dialCode: "+385" },
|
|
63
|
+
{ code: "CU", name: "Cuba", region: "North America", dialCode: "+53" },
|
|
64
|
+
{ code: "CY", name: "Cyprus", region: "Europe", dialCode: "+357" },
|
|
65
|
+
{ code: "CZ", name: "Czechia", region: "Europe", dialCode: "+420" },
|
|
66
|
+
{ code: "DK", name: "Denmark", region: "Europe", dialCode: "+45" },
|
|
67
|
+
{ code: "DJ", name: "Djibouti", region: "Africa", dialCode: "+253" },
|
|
68
|
+
{ code: "DM", name: "Dominica", region: "North America", dialCode: "+1" },
|
|
69
|
+
{ code: "DO", name: "Dominican Republic", region: "North America", dialCode: "+1" },
|
|
70
|
+
{ code: "EC", name: "Ecuador", region: "South America", dialCode: "+593" },
|
|
71
|
+
{ code: "EG", name: "Egypt", region: "Africa", dialCode: "+20" },
|
|
72
|
+
{ code: "SV", name: "El Salvador", region: "North America", dialCode: "+503" },
|
|
73
|
+
{ code: "GQ", name: "Equatorial Guinea", region: "Africa", dialCode: "+240" },
|
|
74
|
+
{ code: "ER", name: "Eritrea", region: "Africa", dialCode: "+291" },
|
|
75
|
+
{ code: "EE", name: "Estonia", region: "Europe", dialCode: "+372" },
|
|
76
|
+
{ code: "SZ", name: "Eswatini", region: "Africa", dialCode: "+268" },
|
|
77
|
+
{ code: "ET", name: "Ethiopia", region: "Africa", dialCode: "+251" },
|
|
78
|
+
{ code: "FO", name: "Faroe Islands", region: "Europe", dialCode: "+298" },
|
|
79
|
+
{ code: "FJ", name: "Fiji", region: "Oceania", dialCode: "+679" },
|
|
80
|
+
{ code: "FI", name: "Finland", region: "Europe", dialCode: "+358" },
|
|
81
|
+
{ code: "FR", name: "France", region: "Europe", dialCode: "+33" },
|
|
82
|
+
{ code: "GF", name: "French Guiana", region: "South America", dialCode: "+594" },
|
|
83
|
+
{ code: "PF", name: "French Polynesia", region: "Oceania", dialCode: "+689" },
|
|
84
|
+
{ code: "GA", name: "Gabon", region: "Africa", dialCode: "+241" },
|
|
85
|
+
{ code: "GM", name: "Gambia", region: "Africa", dialCode: "+220" },
|
|
86
|
+
{ code: "GE", name: "Georgia", region: "Asia", dialCode: "+995" },
|
|
87
|
+
{ code: "DE", name: "Germany", region: "Europe", dialCode: "+49" },
|
|
88
|
+
{ code: "GH", name: "Ghana", region: "Africa", dialCode: "+233" },
|
|
89
|
+
{ code: "GI", name: "Gibraltar", region: "Europe", dialCode: "+350" },
|
|
90
|
+
{ code: "GR", name: "Greece", region: "Europe", dialCode: "+30" },
|
|
91
|
+
{ code: "GL", name: "Greenland", region: "North America", dialCode: "+299" },
|
|
92
|
+
{ code: "GD", name: "Grenada", region: "North America", dialCode: "+1" },
|
|
93
|
+
{ code: "GP", name: "Guadeloupe", region: "North America", dialCode: "+590" },
|
|
94
|
+
{ code: "GU", name: "Guam", region: "Oceania", dialCode: "+1" },
|
|
95
|
+
{ code: "GT", name: "Guatemala", region: "North America", dialCode: "+502" },
|
|
96
|
+
{ code: "GG", name: "Guernsey", region: "Europe", dialCode: "+44" },
|
|
97
|
+
{ code: "GN", name: "Guinea", region: "Africa", dialCode: "+224" },
|
|
98
|
+
{ code: "GW", name: "Guinea-Bissau", region: "Africa", dialCode: "+245" },
|
|
99
|
+
{ code: "GY", name: "Guyana", region: "South America", dialCode: "+592" },
|
|
100
|
+
{ code: "HT", name: "Haiti", region: "North America", dialCode: "+509" },
|
|
101
|
+
{ code: "HN", name: "Honduras", region: "North America", dialCode: "+504" },
|
|
102
|
+
{ code: "HU", name: "Hungary", region: "Europe", dialCode: "+36" },
|
|
103
|
+
{ code: "IS", name: "Iceland", region: "Europe", dialCode: "+354" },
|
|
104
|
+
{ code: "IN", name: "India", region: "Asia", dialCode: "+91" },
|
|
105
|
+
{ code: "ID", name: "Indonesia", region: "Asia", dialCode: "+62" },
|
|
106
|
+
{ code: "IR", name: "Iran", region: "Asia", dialCode: "+98" },
|
|
107
|
+
{ code: "IQ", name: "Iraq", region: "Asia", dialCode: "+964" },
|
|
108
|
+
{ code: "IE", name: "Ireland", region: "Europe", dialCode: "+353" },
|
|
109
|
+
{ code: "IM", name: "Isle of Man", region: "Europe", dialCode: "+44" },
|
|
110
|
+
{ code: "IL", name: "Israel", region: "Asia", dialCode: "+972" },
|
|
111
|
+
{ code: "IT", name: "Italy", region: "Europe", dialCode: "+39" },
|
|
112
|
+
{ code: "JM", name: "Jamaica", region: "North America", dialCode: "+1" },
|
|
113
|
+
{ code: "JP", name: "Japan", region: "Asia", dialCode: "+81" },
|
|
114
|
+
{ code: "JE", name: "Jersey", region: "Europe", dialCode: "+44" },
|
|
115
|
+
{ code: "JO", name: "Jordan", region: "Asia", dialCode: "+962" },
|
|
116
|
+
{ code: "KZ", name: "Kazakhstan", region: "Asia", dialCode: "+7" },
|
|
117
|
+
{ code: "KE", name: "Kenya", region: "Africa", dialCode: "+254" },
|
|
118
|
+
{ code: "KI", name: "Kiribati", region: "Oceania", dialCode: "+686" },
|
|
119
|
+
{ code: "XK", name: "Kosovo", region: "Europe", dialCode: "+383" },
|
|
120
|
+
{ code: "KW", name: "Kuwait", region: "Asia", dialCode: "+965" },
|
|
121
|
+
{ code: "KG", name: "Kyrgyzstan", region: "Asia", dialCode: "+996" },
|
|
122
|
+
{ code: "LA", name: "Laos", region: "Asia", dialCode: "+856" },
|
|
123
|
+
{ code: "LV", name: "Latvia", region: "Europe", dialCode: "+371" },
|
|
124
|
+
{ code: "LB", name: "Lebanon", region: "Asia", dialCode: "+961" },
|
|
125
|
+
{ code: "LS", name: "Lesotho", region: "Africa", dialCode: "+266" },
|
|
126
|
+
{ code: "LR", name: "Liberia", region: "Africa", dialCode: "+231" },
|
|
127
|
+
{ code: "LY", name: "Libya", region: "Africa", dialCode: "+218" },
|
|
128
|
+
{ code: "LI", name: "Liechtenstein", region: "Europe", dialCode: "+423" },
|
|
129
|
+
{ code: "LT", name: "Lithuania", region: "Europe", dialCode: "+370" },
|
|
130
|
+
{ code: "LU", name: "Luxembourg", region: "Europe", dialCode: "+352" },
|
|
131
|
+
{ code: "MG", name: "Madagascar", region: "Africa", dialCode: "+261" },
|
|
132
|
+
{ code: "MW", name: "Malawi", region: "Africa", dialCode: "+265" },
|
|
133
|
+
{ code: "MY", name: "Malaysia", region: "Asia", dialCode: "+60" },
|
|
134
|
+
{ code: "MV", name: "Maldives", region: "Asia", dialCode: "+960" },
|
|
135
|
+
{ code: "ML", name: "Mali", region: "Africa", dialCode: "+223" },
|
|
136
|
+
{ code: "MT", name: "Malta", region: "Europe", dialCode: "+356" },
|
|
137
|
+
{ code: "MH", name: "Marshall Islands", region: "Oceania", dialCode: "+692" },
|
|
138
|
+
{ code: "MQ", name: "Martinique", region: "North America", dialCode: "+596" },
|
|
139
|
+
{ code: "MR", name: "Mauritania", region: "Africa", dialCode: "+222" },
|
|
140
|
+
{ code: "MU", name: "Mauritius", region: "Africa", dialCode: "+230" },
|
|
141
|
+
{ code: "YT", name: "Mayotte", region: "Africa", dialCode: "+262" },
|
|
142
|
+
{ code: "MX", name: "Mexico", region: "North America", dialCode: "+52" },
|
|
143
|
+
{ code: "FM", name: "Micronesia", region: "Oceania", dialCode: "+691" },
|
|
144
|
+
{ code: "MD", name: "Moldova", region: "Europe", dialCode: "+373" },
|
|
145
|
+
{ code: "MC", name: "Monaco", region: "Europe", dialCode: "+377" },
|
|
146
|
+
{ code: "MN", name: "Mongolia", region: "Asia", dialCode: "+976" },
|
|
147
|
+
{ code: "ME", name: "Montenegro", region: "Europe", dialCode: "+382" },
|
|
148
|
+
{ code: "MS", name: "Montserrat", region: "North America", dialCode: "+1" },
|
|
149
|
+
{ code: "MA", name: "Morocco", region: "Africa", dialCode: "+212" },
|
|
150
|
+
{ code: "MZ", name: "Mozambique", region: "Africa", dialCode: "+258" },
|
|
151
|
+
{ code: "MM", name: "Myanmar", region: "Asia", dialCode: "+95" },
|
|
152
|
+
{ code: "NA", name: "Namibia", region: "Africa", dialCode: "+264" },
|
|
153
|
+
{ code: "NR", name: "Nauru", region: "Oceania", dialCode: "+674" },
|
|
154
|
+
{ code: "NP", name: "Nepal", region: "Asia", dialCode: "+977" },
|
|
155
|
+
{ code: "NL", name: "Netherlands", region: "Europe", dialCode: "+31" },
|
|
156
|
+
{ code: "NC", name: "New Caledonia", region: "Oceania", dialCode: "+687" },
|
|
157
|
+
{ code: "NZ", name: "New Zealand", region: "Oceania", dialCode: "+64" },
|
|
158
|
+
{ code: "NI", name: "Nicaragua", region: "North America", dialCode: "+505" },
|
|
159
|
+
{ code: "NE", name: "Niger", region: "Africa", dialCode: "+227" },
|
|
160
|
+
{ code: "NG", name: "Nigeria", region: "Africa", dialCode: "+234" },
|
|
161
|
+
{ code: "NU", name: "Niue", region: "Oceania", dialCode: "+683" },
|
|
162
|
+
{ code: "NF", name: "Norfolk Island", region: "Oceania", dialCode: "+672" },
|
|
163
|
+
{ code: "KP", name: "North Korea", region: "Asia", dialCode: "+850" },
|
|
164
|
+
{ code: "MK", name: "North Macedonia", region: "Europe", dialCode: "+389" },
|
|
165
|
+
{ code: "MP", name: "Northern Mariana Islands", region: "Oceania", dialCode: "+1" },
|
|
166
|
+
{ code: "NO", name: "Norway", region: "Europe", dialCode: "+47" },
|
|
167
|
+
{ code: "OM", name: "Oman", region: "Asia", dialCode: "+968" },
|
|
168
|
+
{ code: "PK", name: "Pakistan", region: "Asia", dialCode: "+92" },
|
|
169
|
+
{ code: "PW", name: "Palau", region: "Oceania", dialCode: "+680" },
|
|
170
|
+
{ code: "PS", name: "Palestine", region: "Asia", dialCode: "+970" },
|
|
171
|
+
{ code: "PA", name: "Panama", region: "North America", dialCode: "+507" },
|
|
172
|
+
{ code: "PG", name: "Papua New Guinea", region: "Oceania", dialCode: "+675" },
|
|
173
|
+
{ code: "PY", name: "Paraguay", region: "South America", dialCode: "+595" },
|
|
174
|
+
{ code: "PE", name: "Peru", region: "South America", dialCode: "+51" },
|
|
175
|
+
{ code: "PH", name: "Philippines", region: "Asia", dialCode: "+63" },
|
|
176
|
+
{ code: "PL", name: "Poland", region: "Europe", dialCode: "+48" },
|
|
177
|
+
{ code: "PT", name: "Portugal", region: "Europe", dialCode: "+351" },
|
|
178
|
+
{ code: "PR", name: "Puerto Rico", region: "North America", dialCode: "+1" },
|
|
179
|
+
{ code: "QA", name: "Qatar", region: "Asia", dialCode: "+974" },
|
|
180
|
+
{ code: "RE", name: "Réunion", region: "Africa", dialCode: "+262" },
|
|
181
|
+
{ code: "RO", name: "Romania", region: "Europe", dialCode: "+40" },
|
|
182
|
+
{ code: "RU", name: "Russia", region: "Europe", dialCode: "+7" },
|
|
183
|
+
{ code: "RW", name: "Rwanda", region: "Africa", dialCode: "+250" },
|
|
184
|
+
{ code: "BL", name: "Saint Barthélemy", region: "North America", dialCode: "+590" },
|
|
185
|
+
{ code: "KN", name: "Saint Kitts and Nevis", region: "North America", dialCode: "+1" },
|
|
186
|
+
{ code: "LC", name: "Saint Lucia", region: "North America", dialCode: "+1" },
|
|
187
|
+
{ code: "MF", name: "Saint Martin", region: "North America", dialCode: "+590" },
|
|
188
|
+
{ code: "PM", name: "Saint Pierre and Miquelon", region: "North America", dialCode: "+508" },
|
|
189
|
+
{ code: "VC", name: "Saint Vincent and the Grenadines", region: "North America", dialCode: "+1" },
|
|
190
|
+
{ code: "WS", name: "Samoa", region: "Oceania", dialCode: "+685" },
|
|
191
|
+
{ code: "SM", name: "San Marino", region: "Europe", dialCode: "+378" },
|
|
192
|
+
{ code: "ST", name: "São Tomé and Príncipe", region: "Africa", dialCode: "+239" },
|
|
193
|
+
{ code: "SA", name: "Saudi Arabia", region: "Asia", dialCode: "+966" },
|
|
194
|
+
{ code: "SN", name: "Senegal", region: "Africa", dialCode: "+221" },
|
|
195
|
+
{ code: "RS", name: "Serbia", region: "Europe", dialCode: "+381" },
|
|
196
|
+
{ code: "SC", name: "Seychelles", region: "Africa", dialCode: "+248" },
|
|
197
|
+
{ code: "SL", name: "Sierra Leone", region: "Africa", dialCode: "+232" },
|
|
198
|
+
{ code: "SG", name: "Singapore", region: "Asia", dialCode: "+65" },
|
|
199
|
+
{ code: "SX", name: "Sint Maarten", region: "North America", dialCode: "+1" },
|
|
200
|
+
{ code: "SK", name: "Slovakia", region: "Europe", dialCode: "+421" },
|
|
201
|
+
{ code: "SI", name: "Slovenia", region: "Europe", dialCode: "+386" },
|
|
202
|
+
{ code: "SB", name: "Solomon Islands", region: "Oceania", dialCode: "+677" },
|
|
203
|
+
{ code: "SO", name: "Somalia", region: "Africa", dialCode: "+252" },
|
|
204
|
+
{ code: "ZA", name: "South Africa", region: "Africa", dialCode: "+27" },
|
|
205
|
+
{ code: "KR", name: "South Korea", region: "Asia", dialCode: "+82" },
|
|
206
|
+
{ code: "SS", name: "South Sudan", region: "Africa", dialCode: "+211" },
|
|
207
|
+
{ code: "ES", name: "Spain", region: "Europe", dialCode: "+34" },
|
|
208
|
+
{ code: "LK", name: "Sri Lanka", region: "Asia", dialCode: "+94" },
|
|
209
|
+
{ code: "SD", name: "Sudan", region: "Africa", dialCode: "+249" },
|
|
210
|
+
{ code: "SR", name: "Suriname", region: "South America", dialCode: "+597" },
|
|
211
|
+
{ code: "SE", name: "Sweden", region: "Europe", dialCode: "+46" },
|
|
212
|
+
{ code: "CH", name: "Switzerland", region: "Europe", dialCode: "+41" },
|
|
213
|
+
{ code: "SY", name: "Syria", region: "Asia", dialCode: "+963" },
|
|
214
|
+
{ code: "TJ", name: "Tajikistan", region: "Asia", dialCode: "+992" },
|
|
215
|
+
{ code: "TZ", name: "Tanzania", region: "Africa", dialCode: "+255" },
|
|
216
|
+
{ code: "TH", name: "Thailand", region: "Asia", dialCode: "+66" },
|
|
217
|
+
{ code: "TG", name: "Togo", region: "Africa", dialCode: "+228" },
|
|
218
|
+
{ code: "TK", name: "Tokelau", region: "Oceania", dialCode: "+690" },
|
|
219
|
+
{ code: "TO", name: "Tonga", region: "Oceania", dialCode: "+676" },
|
|
220
|
+
{ code: "TT", name: "Trinidad and Tobago", region: "North America", dialCode: "+1" },
|
|
221
|
+
{ code: "TN", name: "Tunisia", region: "Africa", dialCode: "+216" },
|
|
222
|
+
{ code: "TR", name: "Türkiye", region: "Europe", dialCode: "+90" },
|
|
223
|
+
{ code: "TM", name: "Turkmenistan", region: "Asia", dialCode: "+993" },
|
|
224
|
+
{ code: "TC", name: "Turks and Caicos Islands", region: "North America", dialCode: "+1" },
|
|
225
|
+
{ code: "TV", name: "Tuvalu", region: "Oceania", dialCode: "+688" },
|
|
226
|
+
{ code: "UG", name: "Uganda", region: "Africa", dialCode: "+256" },
|
|
227
|
+
{ code: "UA", name: "Ukraine", region: "Europe", dialCode: "+380" },
|
|
228
|
+
{ code: "AE", name: "United Arab Emirates", region: "Asia", dialCode: "+971" },
|
|
229
|
+
{ code: "GB", name: "United Kingdom", region: "Europe", dialCode: "+44" },
|
|
230
|
+
{ code: "US", name: "United States", region: "North America", dialCode: "+1" },
|
|
231
|
+
{ code: "UY", name: "Uruguay", region: "South America", dialCode: "+598" },
|
|
232
|
+
{ code: "UZ", name: "Uzbekistan", region: "Asia", dialCode: "+998" },
|
|
233
|
+
{ code: "VU", name: "Vanuatu", region: "Oceania", dialCode: "+678" },
|
|
234
|
+
{ code: "VA", name: "Vatican City", region: "Europe", dialCode: "+39" },
|
|
235
|
+
{ code: "VE", name: "Venezuela", region: "South America", dialCode: "+58" },
|
|
236
|
+
{ code: "VN", name: "Vietnam", region: "Asia", dialCode: "+84" },
|
|
237
|
+
{ code: "VI", name: "U.S. Virgin Islands", region: "North America", dialCode: "+1" },
|
|
238
|
+
{ code: "WF", name: "Wallis and Futuna", region: "Oceania", dialCode: "+681" },
|
|
239
|
+
{ code: "EH", name: "Western Sahara", region: "Africa", dialCode: "+212" },
|
|
240
|
+
{ code: "YE", name: "Yemen", region: "Asia", dialCode: "+967" },
|
|
241
|
+
{ code: "ZM", name: "Zambia", region: "Africa", dialCode: "+260" },
|
|
242
|
+
{ code: "ZW", name: "Zimbabwe", region: "Africa", dialCode: "+263" },
|
|
243
|
+
];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { FileUpload2, FileUploadProps } from "./FileUpload2";
|
|
2
|
+
import { Input } from "./Input";
|
|
3
|
+
import { Input2 } from "./Input2";
|
|
4
|
+
import { Textarea } from "./Textarea";
|
|
5
|
+
import { Textarea2 } from "./Textarea2";
|
|
6
|
+
import TelInput from "./TelInput";
|
|
7
|
+
import TelInput2 from "./TelInput2";
|
|
8
|
+
import { FieldStyle } from "./types";
|
|
9
|
+
|
|
10
|
+
export const getControl = (controlName?: string, fieldStyle?: FieldStyle) => {
|
|
11
|
+
switch (controlName) {
|
|
12
|
+
case "Input":
|
|
13
|
+
return getInput(fieldStyle);
|
|
14
|
+
case "Textarea":
|
|
15
|
+
return getTextarea(fieldStyle);
|
|
16
|
+
case "TelInput":
|
|
17
|
+
return getTelInput(fieldStyle);
|
|
18
|
+
default:
|
|
19
|
+
return getInput(fieldStyle);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const getInput = (fieldStyle?: FieldStyle) => {
|
|
24
|
+
if (fieldStyle === "default") {
|
|
25
|
+
return Input;
|
|
26
|
+
} else if (fieldStyle === "label-inline") {
|
|
27
|
+
return Input2;
|
|
28
|
+
} else {
|
|
29
|
+
return Input;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const getTextarea = (fieldStyle?: FieldStyle) => {
|
|
34
|
+
if (fieldStyle === "default") {
|
|
35
|
+
return Textarea;
|
|
36
|
+
} else if (fieldStyle === "label-inline") {
|
|
37
|
+
return Textarea2;
|
|
38
|
+
} else {
|
|
39
|
+
return Textarea;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const getTelInput = (fieldStyle?: FieldStyle) => {
|
|
44
|
+
if (fieldStyle === "label-inline") {
|
|
45
|
+
return TelInput2;
|
|
46
|
+
}
|
|
47
|
+
return TelInput;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const getFileUpload = (
|
|
51
|
+
fieldStyle?: FieldStyle
|
|
52
|
+
): React.FC<FileUploadProps> => {
|
|
53
|
+
if (fieldStyle === "default") {
|
|
54
|
+
return FileUpload2;
|
|
55
|
+
} else if (fieldStyle === "label-inline") {
|
|
56
|
+
return FileUpload2;
|
|
57
|
+
} else {
|
|
58
|
+
return FileUpload2;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 简单的加密函数,用于生成防机器人的加密字段
|
|
3
|
+
* @param value 需要加密的值
|
|
4
|
+
* @returns 加密后的字符串
|
|
5
|
+
*/
|
|
6
|
+
export const encrypt = (value: string, formSalt: string): string => {
|
|
7
|
+
// 获取当前时间戳,精确到分钟级别(防止频繁变化)
|
|
8
|
+
const timestamp = Math.floor(Date.now() / (60 * 1000));
|
|
9
|
+
|
|
10
|
+
// 将时间戳与盐值和输入值组合
|
|
11
|
+
const dataToEncrypt = `${formSalt}:${timestamp}:${value}`;
|
|
12
|
+
|
|
13
|
+
// 使用简单的哈希算法
|
|
14
|
+
let hash = 0;
|
|
15
|
+
for (let i = 0; i < dataToEncrypt.length; i++) {
|
|
16
|
+
const char = dataToEncrypt.charCodeAt(i);
|
|
17
|
+
hash = (hash << 5) - hash + char;
|
|
18
|
+
hash = hash & hash; // 转换为32位整数
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// 转换为16进制字符串并添加时间戳信息
|
|
22
|
+
return `${hash.toString(16)}_${timestamp}`;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 验证加密字段是否有效
|
|
27
|
+
* @param encryptedValue 加密后的字符串
|
|
28
|
+
* @param originalValue 原始值(如蜜罐字段的值)
|
|
29
|
+
* @param maxAgeMinutes 最大有效时间(分钟)
|
|
30
|
+
* @returns 是否有效
|
|
31
|
+
*/
|
|
32
|
+
export const verifyEncryption = (
|
|
33
|
+
formSalt: string,
|
|
34
|
+
encryptedValue: string = "",
|
|
35
|
+
originalValue: string = "",
|
|
36
|
+
maxAgeMinutes: number = 30
|
|
37
|
+
): boolean => {
|
|
38
|
+
// 解析加密值
|
|
39
|
+
const parts = encryptedValue.split("_");
|
|
40
|
+
if (parts.length !== 2) {
|
|
41
|
+
return false; // 格式不正确
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const [hashString, timestampString] = parts;
|
|
45
|
+
const timestamp = parseInt(timestampString, 10);
|
|
46
|
+
|
|
47
|
+
// 验证时间戳是否在有效期内
|
|
48
|
+
const currentTimestamp = Math.floor(Date.now() / (60 * 1000));
|
|
49
|
+
if (isNaN(timestamp) || currentTimestamp - timestamp > maxAgeMinutes) {
|
|
50
|
+
return false; // 时间戳无效或已过期
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 重新计算哈希值
|
|
54
|
+
const dataToEncrypt = `${formSalt}:${timestamp}:${originalValue}`;
|
|
55
|
+
let hash = 0;
|
|
56
|
+
for (let i = 0; i < dataToEncrypt.length; i++) {
|
|
57
|
+
const char = dataToEncrypt.charCodeAt(i);
|
|
58
|
+
hash = (hash << 5) - hash + char;
|
|
59
|
+
hash = hash & hash;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 比较哈希值
|
|
63
|
+
return hashString === hash.toString(16);
|
|
64
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 计算内联标签布局所需的 paddingLeft(= label 宽度 + 额外间距)
|
|
5
|
+
* - 返回 labelRef 供 <label ref={labelRef} /> 绑定
|
|
6
|
+
* - 返回 paddingLeft 用于内层输入/容器 style
|
|
7
|
+
*/
|
|
8
|
+
export function useInlineLabelPadding(extraSpace: number = 16) {
|
|
9
|
+
const labelRef = useRef<HTMLLabelElement>(null);
|
|
10
|
+
const [paddingLeft, setPaddingLeft] = useState<string>("3.5rem");
|
|
11
|
+
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
const labelEl = labelRef.current;
|
|
14
|
+
if (!labelEl) return;
|
|
15
|
+
|
|
16
|
+
let rafId = 0;
|
|
17
|
+
const measure = () => {
|
|
18
|
+
const width = labelEl.getBoundingClientRect().width;
|
|
19
|
+
setPaddingLeft(`${width + extraSpace}px`);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
measure();
|
|
23
|
+
rafId = requestAnimationFrame(measure);
|
|
24
|
+
|
|
25
|
+
if (typeof ResizeObserver === "undefined") {
|
|
26
|
+
return () => {
|
|
27
|
+
cancelAnimationFrame(rafId);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ro = new ResizeObserver(() => {
|
|
32
|
+
measure();
|
|
33
|
+
});
|
|
34
|
+
ro.observe(labelEl);
|
|
35
|
+
|
|
36
|
+
return () => {
|
|
37
|
+
cancelAnimationFrame(rafId);
|
|
38
|
+
ro.disconnect();
|
|
39
|
+
};
|
|
40
|
+
}, [extraSpace]);
|
|
41
|
+
|
|
42
|
+
return { labelRef, paddingLeft } as const;
|
|
43
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { useEffect, useMemo, useState } from "react";
|
|
2
|
+
import type { CountryDial } from "../countryDialCodes";
|
|
3
|
+
import { countries as defaultCountries } from "../countryDialCodes";
|
|
4
|
+
|
|
5
|
+
export interface UseTelControlOptions {
|
|
6
|
+
countries?: CountryDial[];
|
|
7
|
+
name: string;
|
|
8
|
+
value?: string | number | readonly string[] | undefined;
|
|
9
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function useTelControl({ countries, name, value, onChange }: UseTelControlOptions) {
|
|
13
|
+
const allCountries = useMemo<CountryDial[]>(() => countries || defaultCountries, [countries]);
|
|
14
|
+
|
|
15
|
+
const [selected, setSelected] = useState<CountryDial | null>(null);
|
|
16
|
+
const [localNumber, setLocalNumber] = useState<string>("");
|
|
17
|
+
|
|
18
|
+
const toStringValue = (val?: string | number | readonly string[]) => {
|
|
19
|
+
if (typeof val === "string") return val;
|
|
20
|
+
if (typeof val === "number") return String(val);
|
|
21
|
+
if (Array.isArray(val)) return val[0] ?? "";
|
|
22
|
+
return "";
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
const s = toStringValue(value).trim();
|
|
27
|
+
const m = s.match(/^\+\d{1,4}/);
|
|
28
|
+
const dial = m ? m[0] : "";
|
|
29
|
+
const number = s.slice(dial.length).trimStart();
|
|
30
|
+
setLocalNumber(number || "");
|
|
31
|
+
if (dial) {
|
|
32
|
+
const found = allCountries.find((c) => c.dialCode === dial) || null;
|
|
33
|
+
setSelected(found);
|
|
34
|
+
} else {
|
|
35
|
+
setSelected(null);
|
|
36
|
+
}
|
|
37
|
+
}, [value, allCountries]);
|
|
38
|
+
|
|
39
|
+
const emitChange = (combined: string) => {
|
|
40
|
+
if (!onChange) return;
|
|
41
|
+
const evt = {
|
|
42
|
+
target: { value: combined, name } as unknown,
|
|
43
|
+
currentTarget: { value: combined, name } as unknown,
|
|
44
|
+
} as unknown as React.ChangeEvent<HTMLInputElement>;
|
|
45
|
+
onChange(evt);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const filtered = (query: string) => {
|
|
49
|
+
if (!query) return allCountries;
|
|
50
|
+
const q = query.toLowerCase();
|
|
51
|
+
return allCountries.filter(
|
|
52
|
+
(c) =>
|
|
53
|
+
c.name.toLowerCase().includes(q) ||
|
|
54
|
+
(c.region && c.region.toLowerCase().includes(q)) ||
|
|
55
|
+
c.dialCode.replace("+", "").includes(q.replace("+", ""))
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const onSelectCountry = (c: CountryDial) => {
|
|
60
|
+
setSelected(c);
|
|
61
|
+
const combined = `${c.dialCode} ${localNumber}`.trim();
|
|
62
|
+
emitChange(combined);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const onChangeLocal = (next: string) => {
|
|
66
|
+
setLocalNumber(next);
|
|
67
|
+
const combined = `${selected?.dialCode || ""} ${next}`.trim();
|
|
68
|
+
emitChange(combined);
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
return {
|
|
72
|
+
allCountries,
|
|
73
|
+
selected,
|
|
74
|
+
setSelected,
|
|
75
|
+
localNumber,
|
|
76
|
+
setLocalNumber,
|
|
77
|
+
filtered,
|
|
78
|
+
onSelectCountry,
|
|
79
|
+
onChangeLocal,
|
|
80
|
+
} as const;
|
|
81
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { HTMLInputTypeAttribute } from "react";
|
|
2
|
+
|
|
3
|
+
export type FieldStyle = "default" | "label-inline" | string;
|
|
4
|
+
|
|
5
|
+
export type FieldConfig = {
|
|
6
|
+
name: string;
|
|
7
|
+
label: string;
|
|
8
|
+
controlName?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
labelClassName?: string;
|
|
13
|
+
inputClassName?: string;
|
|
14
|
+
rows?: number;
|
|
15
|
+
type?: HTMLInputTypeAttribute;
|
|
16
|
+
autoFocus?: boolean;
|
|
17
|
+
feildStyle?: FieldStyle;
|
|
18
|
+
isExtends?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type SubmitConfig = {
|
|
22
|
+
containerClassName?: string;
|
|
23
|
+
className?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
rawHtml?: string;
|
|
26
|
+
//rawHtml模式时,用于触发tailwind编译
|
|
27
|
+
needClasses?: string;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type ContactFormProps = {
|
|
31
|
+
submit?: SubmitConfig;
|
|
32
|
+
actionUrl?: string;
|
|
33
|
+
formSalt: string;
|
|
34
|
+
className?: string;
|
|
35
|
+
classNames?: {
|
|
36
|
+
inputContainer?: string;
|
|
37
|
+
input?: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
required?: string;
|
|
40
|
+
};
|
|
41
|
+
fields: FieldConfig[];
|
|
42
|
+
fromCta?: string;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export interface FileAttachment {
|
|
46
|
+
id: string;
|
|
47
|
+
name: string;
|
|
48
|
+
size: number;
|
|
49
|
+
url: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface QuoteRequest {
|
|
53
|
+
name?: string;
|
|
54
|
+
email?: string;
|
|
55
|
+
company?: string;
|
|
56
|
+
message?: string;
|
|
57
|
+
fromCta?: string;
|
|
58
|
+
// 电话或者whatsapp
|
|
59
|
+
mobile?: string;
|
|
60
|
+
// 蜜罐字段,用于检测机器人
|
|
61
|
+
phone: string;
|
|
62
|
+
// 一个加密字段,用于防机器人,点击时附加一个加密的字符串
|
|
63
|
+
encryptedField?: string;
|
|
64
|
+
// 附件文件信息列表(包含 ID, 名称, 大小, URL)
|
|
65
|
+
attachments?: FileAttachment[];
|
|
66
|
+
extents?: Record<string, unknown>;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon as IconifyIcon,
|
|
3
|
+
IconProps as IconifyIconProps,
|
|
4
|
+
} from "@iconify/react";
|
|
5
|
+
import type { IconifyIcon as IconifyIconData } from "@iconify/react";
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
|
|
8
|
+
export type IconProps = Omit<IconifyIconProps, "icon"> & {
|
|
9
|
+
icon?: string | IconifyIconData;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const Icon = forwardRef<SVGSVGElement, IconProps>((props, ref) => {
|
|
13
|
+
const { icon, ...rest } = props;
|
|
14
|
+
|
|
15
|
+
if (!icon) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return <IconifyIcon ref={ref} {...rest} icon={icon} />;
|
|
20
|
+
});
|