@bricks-toolkit/toolkit 0.1.1 → 0.1.2
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/README.md +9 -9
- package/dist/avatar/index.cjs +11 -1
- package/dist/avatar/index.mjs +2 -1
- package/dist/badge/index.cjs +11 -1
- package/dist/badge/index.mjs +2 -1
- package/dist/breadcrumbs/index.cjs +11 -1
- package/dist/breadcrumbs/index.mjs +2 -1
- package/dist/button/index.cjs +13 -2
- package/dist/button/index.mjs +4 -2
- package/dist/card/index.cjs +31 -1
- package/dist/card/index.mjs +2 -1
- package/dist/checkbox/index.cjs +11 -1
- package/dist/checkbox/index.mjs +2 -1
- package/dist/chunk-2POU3NX4.mjs +192 -0
- package/dist/chunk-32SKYPQW.mjs +156 -0
- package/dist/chunk-446OJWC6.mjs +285 -0
- package/dist/chunk-4DA7CRNV.mjs +376 -0
- package/dist/chunk-4DR57X7U.mjs +182 -0
- package/dist/chunk-4QSDPHPI.mjs +285 -0
- package/dist/chunk-56ILK7Y4.cjs +315 -0
- package/dist/chunk-5J3OMAO4.cjs +222 -0
- package/dist/chunk-5RKET2JO.cjs +287 -0
- package/dist/chunk-65UZC3FK.mjs +312 -0
- package/dist/chunk-6CC5KIA5.cjs +148 -0
- package/dist/chunk-6R3OYBQ6.cjs +209 -0
- package/dist/chunk-6UO72EJA.cjs +2 -0
- package/dist/chunk-6ZCY4O5M.mjs +63 -0
- package/dist/chunk-7364SUK6.mjs +359 -0
- package/dist/chunk-7DDDQ3RH.cjs +66 -0
- package/dist/chunk-7PDGAIC3.cjs +189 -0
- package/dist/chunk-7R5JRJ2W.cjs +255 -0
- package/dist/chunk-7WNJ7L4Z.mjs +335 -0
- package/dist/chunk-AJXVELXK.cjs +218 -0
- package/dist/chunk-ARTXRQO6.mjs +1 -0
- package/dist/chunk-B4OV5GRT.cjs +510 -0
- package/dist/chunk-B5MYGYJY.mjs +122 -0
- package/dist/chunk-BBVWG5GH.cjs +75 -0
- package/dist/chunk-BVBCAAES.mjs +35 -0
- package/dist/chunk-CBA54EY4.mjs +508 -0
- package/dist/chunk-CMER5LO3.mjs +330 -0
- package/dist/chunk-DHC5LI2P.cjs +338 -0
- package/dist/chunk-DMLPA65B.mjs +107 -0
- package/dist/chunk-DN2GFJF4.mjs +175 -0
- package/dist/chunk-ECLNLPOR.cjs +70 -0
- package/dist/chunk-EV463QT5.cjs +53 -0
- package/dist/chunk-FOVJHEWH.mjs +51 -0
- package/dist/chunk-G4HVY6FM.mjs +203 -0
- package/dist/chunk-H77YWN3L.mjs +220 -0
- package/dist/chunk-HIWJDLIS.cjs +124 -0
- package/dist/chunk-HQGDSOSN.mjs +274 -0
- package/dist/chunk-JKPNJ4PZ.mjs +313 -0
- package/dist/chunk-JV6AWBN5.mjs +113 -0
- package/dist/chunk-KA35BV7V.mjs +207 -0
- package/dist/chunk-KLBABQEJ.cjs +378 -0
- package/dist/chunk-L5VQZZVR.cjs +3197 -0
- package/dist/chunk-LTG6YP5I.cjs +69 -0
- package/dist/chunk-MVUNJPGH.cjs +184 -0
- package/dist/chunk-NMJ5CVZH.cjs +2 -0
- package/dist/chunk-NRCNRHXL.cjs +109 -0
- package/dist/chunk-NRZIXK35.cjs +276 -0
- package/dist/chunk-OCPFOFJ4.mjs +3195 -0
- package/dist/chunk-OEU5VG3D.cjs +362 -0
- package/dist/chunk-OPOCCRJG.cjs +193 -0
- package/dist/chunk-OQPCL5XX.mjs +187 -0
- package/dist/chunk-PCYGJNEQ.cjs +280 -0
- package/dist/chunk-PJH2KEWK.mjs +200 -0
- package/dist/chunk-PJWELBN2.cjs +115 -0
- package/dist/chunk-Q3IFXFFD.cjs +202 -0
- package/dist/chunk-R72GDCWE.cjs +314 -0
- package/dist/chunk-RAD5VJHR.mjs +146 -0
- package/dist/chunk-RYWDZHKG.mjs +274 -0
- package/dist/chunk-S7VEND5Z.cjs +162 -0
- package/dist/chunk-SBNNV6FE.mjs +1 -0
- package/dist/chunk-SFUOCZJY.mjs +187 -0
- package/dist/chunk-SHQ2MPBE.mjs +73 -0
- package/dist/chunk-TIVSMCXZ.mjs +253 -0
- package/dist/chunk-TNGW5YHA.cjs +37 -0
- package/dist/chunk-VC7MOPU6.cjs +287 -0
- package/dist/chunk-VHVFRWF5.mjs +64 -0
- package/dist/chunk-VKQDW7C2.mjs +336 -0
- package/dist/chunk-VRZFAKSV.cjs +177 -0
- package/dist/chunk-W2ZAPLQH.cjs +337 -0
- package/dist/chunk-XFNRKHHF.cjs +332 -0
- package/dist/chunk-Y3NTKFUE.mjs +66 -0
- package/dist/chunk-Y6AN7AWX.cjs +205 -0
- package/dist/chunk-YMMNWJT6.cjs +134 -0
- package/dist/chunk-YOTCXSXL.mjs +132 -0
- package/dist/combo-box/index.cjs +11 -1
- package/dist/combo-box/index.mjs +2 -1
- package/dist/date-picker/index.cjs +11 -2
- package/dist/date-picker/index.mjs +2 -2
- package/dist/dialog/index.cjs +27 -1
- package/dist/dialog/index.mjs +2 -1
- package/dist/dropdown-menu/index.cjs +27 -1
- package/dist/dropdown-menu/index.mjs +2 -1
- package/dist/email/index.cjs +11 -2
- package/dist/email/index.mjs +2 -2
- package/dist/file-upload/index.cjs +11 -1
- package/dist/file-upload/index.mjs +2 -1
- package/dist/header/index.cjs +14 -2
- package/dist/header/index.mjs +5 -2
- package/dist/icon-button/index.cjs +13 -2
- package/dist/icon-button/index.mjs +4 -2
- package/dist/image/index.cjs +12 -1
- package/dist/image/index.mjs +3 -1
- package/dist/index.cjs +839 -2
- package/dist/index.d.ts +141 -75
- package/dist/index.mjs +601 -2
- package/dist/link/index.cjs +11 -1
- package/dist/link/index.mjs +2 -1
- package/dist/loader/index.cjs +11 -2
- package/dist/loader/index.mjs +2 -2
- package/dist/modal/index.cjs +27 -1
- package/dist/modal/index.mjs +2 -1
- package/dist/multi-select/index.cjs +11 -2
- package/dist/multi-select/index.mjs +2 -2
- package/dist/otp-input/index.cjs +11 -1
- package/dist/otp-input/index.mjs +2 -1
- package/dist/password-input/index.cjs +11 -2
- package/dist/password-input/index.mjs +2 -2
- package/dist/phone/index.cjs +11 -2
- package/dist/phone/index.mjs +2 -2
- package/dist/radio-button/index.cjs +11 -1
- package/dist/radio-button/index.mjs +2 -1
- package/dist/search-input/index.cjs +12 -2
- package/dist/search-input/index.mjs +3 -2
- package/dist/select/index.cjs +11 -2
- package/dist/select/index.mjs +2 -2
- package/dist/sidebar/index.cjs +11 -1
- package/dist/sidebar/index.mjs +2 -1
- package/dist/skeleton/index.cjs +27 -1
- package/dist/skeleton/index.mjs +2 -1
- package/dist/styles.css +5074 -1
- package/dist/table/index.cjs +15 -1
- package/dist/table/index.mjs +2 -1
- package/dist/tabs/index.cjs +14 -2
- package/dist/tabs/index.mjs +5 -2
- package/dist/text-input/index.cjs +11 -2
- package/dist/text-input/index.mjs +2 -2
- package/dist/theme-provider/index.cjs +14 -1
- package/dist/theme-provider/index.mjs +1 -1
- package/dist/time-picker/index.cjs +11 -2
- package/dist/time-picker/index.mjs +2 -2
- package/dist/toaster/index.cjs +11 -1
- package/dist/toaster/index.mjs +2 -1
- package/dist/tooltip/index.cjs +12 -1
- package/dist/tooltip/index.mjs +3 -1
- package/package.json +122 -141
- package/dist/components/Accordion/Accordion.d.ts +0 -5
- package/dist/components/Accordion/Accordion.types.d.ts +0 -32
- package/dist/components/Accordion/index.d.ts +0 -2
- package/dist/components/Avatar/Avatar.d.ts +0 -2
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -11
- package/dist/components/Avatar/Avatar.test.d.ts +0 -1
- package/dist/components/Avatar/Avatar.types.d.ts +0 -24
- package/dist/components/Avatar/index.d.ts +0 -2
- package/dist/components/Badge/Badge.d.ts +0 -11
- package/dist/components/Badge/Badge.stories.d.ts +0 -21
- package/dist/components/Badge/Badge.test.d.ts +0 -1
- package/dist/components/Badge/Badge.types.d.ts +0 -43
- package/dist/components/Badge/index.d.ts +0 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.stories.d.ts +0 -13
- package/dist/components/Breadcrumbs/Breadcrumbs.test.d.ts +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.types.d.ts +0 -27
- package/dist/components/Breadcrumbs/index.d.ts +0 -2
- package/dist/components/Button/Button.d.ts +0 -2
- package/dist/components/Button/Button.stories.d.ts +0 -20
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/Button/Button.types.d.ts +0 -24
- package/dist/components/Button/index.d.ts +0 -2
- package/dist/components/Card/Card.d.ts +0 -25
- package/dist/components/Card/Card.stories.d.ts +0 -8
- package/dist/components/Card/Card.test.d.ts +0 -1
- package/dist/components/Card/Card.types.d.ts +0 -14
- package/dist/components/Card/index.d.ts +0 -2
- package/dist/components/Checkbox/Checkbox.d.ts +0 -2
- package/dist/components/Checkbox/Checkbox.stories.d.ts +0 -16
- package/dist/components/Checkbox/Checkbox.test.d.ts +0 -1
- package/dist/components/Checkbox/Checkbox.types.d.ts +0 -31
- package/dist/components/Checkbox/index.d.ts +0 -2
- package/dist/components/ComboBox/ComboBox.d.ts +0 -2
- package/dist/components/ComboBox/ComboBox.stories.d.ts +0 -12
- package/dist/components/ComboBox/ComboBox.test.d.ts +0 -1
- package/dist/components/ComboBox/ComboBox.types.d.ts +0 -57
- package/dist/components/ComboBox/index.d.ts +0 -2
- package/dist/components/DatePicker/DatePicker.d.ts +0 -2
- package/dist/components/DatePicker/DatePicker.stories.d.ts +0 -25
- package/dist/components/DatePicker/DatePicker.test.d.ts +0 -1
- package/dist/components/DatePicker/DatePicker.types.d.ts +0 -27
- package/dist/components/DatePicker/index.d.ts +0 -2
- package/dist/components/Dialog/Dialog.d.ts +0 -6
- package/dist/components/Dialog/Dialog.stories.d.ts +0 -9
- package/dist/components/Dialog/Dialog.test.d.ts +0 -1
- package/dist/components/Dialog/Dialog.types.d.ts +0 -52
- package/dist/components/Dialog/index.d.ts +0 -2
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +0 -7
- package/dist/components/DropdownMenu/DropdownMenu.stories.d.ts +0 -9
- package/dist/components/DropdownMenu/DropdownMenu.test.d.ts +0 -1
- package/dist/components/DropdownMenu/DropdownMenu.types.d.ts +0 -24
- package/dist/components/DropdownMenu/index.d.ts +0 -2
- package/dist/components/Email/Email.d.ts +0 -2
- package/dist/components/Email/Email.stories.d.ts +0 -11
- package/dist/components/Email/Email.test.d.ts +0 -1
- package/dist/components/Email/Email.types.d.ts +0 -33
- package/dist/components/Email/index.d.ts +0 -2
- package/dist/components/FileUpload/FileUpload.d.ts +0 -2
- package/dist/components/FileUpload/FileUpload.stories.d.ts +0 -10
- package/dist/components/FileUpload/FileUpload.test.d.ts +0 -1
- package/dist/components/FileUpload/FileUpload.types.d.ts +0 -22
- package/dist/components/FileUpload/index.d.ts +0 -2
- package/dist/components/Header/Header.d.ts +0 -7
- package/dist/components/Header/Header.stories.d.ts +0 -8
- package/dist/components/Header/Header.test.d.ts +0 -1
- package/dist/components/Header/Header.types.d.ts +0 -19
- package/dist/components/Header/index.d.ts +0 -2
- package/dist/components/IconButton/IconButton.d.ts +0 -2
- package/dist/components/IconButton/IconButton.stories.d.ts +0 -17
- package/dist/components/IconButton/IconButton.types.d.ts +0 -10
- package/dist/components/IconButton/index.d.ts +0 -2
- package/dist/components/Image/Image.d.ts +0 -6
- package/dist/components/Image/Image.stories.d.ts +0 -13
- package/dist/components/Image/Image.test.d.ts +0 -1
- package/dist/components/Image/Image.types.d.ts +0 -40
- package/dist/components/Image/index.d.ts +0 -2
- package/dist/components/Link/Link.d.ts +0 -2
- package/dist/components/Link/Link.stories.d.ts +0 -15
- package/dist/components/Link/Link.test.d.ts +0 -1
- package/dist/components/Link/Link.types.d.ts +0 -20
- package/dist/components/Link/index.d.ts +0 -2
- package/dist/components/Loader/Loader.d.ts +0 -2
- package/dist/components/Loader/Loader.stories.d.ts +0 -12
- package/dist/components/Loader/Loader.test.d.ts +0 -1
- package/dist/components/Loader/Loader.types.d.ts +0 -17
- package/dist/components/Loader/index.d.ts +0 -2
- package/dist/components/Modal/Modal.d.ts +0 -14
- package/dist/components/Modal/Modal.stories.d.ts +0 -14
- package/dist/components/Modal/Modal.test.d.ts +0 -1
- package/dist/components/Modal/Modal.types.d.ts +0 -100
- package/dist/components/Modal/index.d.ts +0 -2
- package/dist/components/MultiSelect/MultiSelect.d.ts +0 -2
- package/dist/components/MultiSelect/MultiSelect.stories.d.ts +0 -15
- package/dist/components/MultiSelect/MultiSelect.test.d.ts +0 -1
- package/dist/components/MultiSelect/MultiSelect.types.d.ts +0 -55
- package/dist/components/MultiSelect/index.d.ts +0 -2
- package/dist/components/OtpInput/OtpInput.d.ts +0 -2
- package/dist/components/OtpInput/OtpInput.stories.d.ts +0 -10
- package/dist/components/OtpInput/OtpInput.test.d.ts +0 -1
- package/dist/components/OtpInput/OtpInput.types.d.ts +0 -53
- package/dist/components/OtpInput/index.d.ts +0 -2
- package/dist/components/PasswordInput/PasswordInput.d.ts +0 -2
- package/dist/components/PasswordInput/PasswordInput.stories.d.ts +0 -23
- package/dist/components/PasswordInput/PasswordInput.test.d.ts +0 -1
- package/dist/components/PasswordInput/PasswordInput.types.d.ts +0 -27
- package/dist/components/PasswordInput/index.d.ts +0 -2
- package/dist/components/Phone/Phone.d.ts +0 -2
- package/dist/components/Phone/Phone.stories.d.ts +0 -11
- package/dist/components/Phone/Phone.test.d.ts +0 -1
- package/dist/components/Phone/Phone.types.d.ts +0 -36
- package/dist/components/Phone/countries.d.ts +0 -8
- package/dist/components/Phone/index.d.ts +0 -2
- package/dist/components/RadioButton/RadioButton.d.ts +0 -2
- package/dist/components/RadioButton/RadioButton.stories.d.ts +0 -21
- package/dist/components/RadioButton/RadioButton.test.d.ts +0 -1
- package/dist/components/RadioButton/RadioButton.types.d.ts +0 -51
- package/dist/components/RadioButton/index.d.ts +0 -2
- package/dist/components/SearchInput/SearchInput.d.ts +0 -6
- package/dist/components/SearchInput/SearchInput.stories.d.ts +0 -8
- package/dist/components/SearchInput/SearchInput.test.d.ts +0 -1
- package/dist/components/SearchInput/SearchInput.types.d.ts +0 -12
- package/dist/components/SearchInput/index.d.ts +0 -2
- package/dist/components/Select/Select.d.ts +0 -2
- package/dist/components/Select/Select.stories.d.ts +0 -12
- package/dist/components/Select/Select.test.d.ts +0 -1
- package/dist/components/Select/Select.types.d.ts +0 -31
- package/dist/components/Select/index.d.ts +0 -2
- package/dist/components/Sidebar/Sidebar.d.ts +0 -7
- package/dist/components/Sidebar/Sidebar.stories.d.ts +0 -10
- package/dist/components/Sidebar/Sidebar.test.d.ts +0 -1
- package/dist/components/Sidebar/Sidebar.types.d.ts +0 -87
- package/dist/components/Sidebar/index.d.ts +0 -2
- package/dist/components/Skeleton/Skeleton.d.ts +0 -26
- package/dist/components/Skeleton/Skeleton.stories.d.ts +0 -13
- package/dist/components/Skeleton/Skeleton.types.d.ts +0 -47
- package/dist/components/Skeleton/index.d.ts +0 -2
- package/dist/components/Stepper/Stepper.d.ts +0 -2
- package/dist/components/Stepper/Stepper.stories.d.ts +0 -23
- package/dist/components/Stepper/Stepper.test.d.ts +0 -1
- package/dist/components/Stepper/Stepper.types.d.ts +0 -47
- package/dist/components/Stepper/index.d.ts +0 -2
- package/dist/components/Table/Pagination.d.ts +0 -3
- package/dist/components/Table/Table.d.ts +0 -3
- package/dist/components/Table/Table.stories.d.ts +0 -13
- package/dist/components/Table/Table.test.d.ts +0 -1
- package/dist/components/Table/Table.types.d.ts +0 -85
- package/dist/components/Table/index.d.ts +0 -3
- package/dist/components/Tabs/Tabs.d.ts +0 -2
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -17
- package/dist/components/Tabs/Tabs.test.d.ts +0 -1
- package/dist/components/Tabs/Tabs.types.d.ts +0 -21
- package/dist/components/Tabs/index.d.ts +0 -2
- package/dist/components/TextInput/TextInput.d.ts +0 -2
- package/dist/components/TextInput/TextInput.stories.d.ts +0 -25
- package/dist/components/TextInput/TextInput.test.d.ts +0 -1
- package/dist/components/TextInput/TextInput.types.d.ts +0 -29
- package/dist/components/TextInput/index.d.ts +0 -2
- package/dist/components/ThemeProvider/ThemeProvider.d.ts +0 -8
- package/dist/components/ThemeProvider/ThemeProvider.stories.d.ts +0 -16
- package/dist/components/ThemeProvider/ThemeProvider.test.d.ts +0 -1
- package/dist/components/ThemeProvider/ThemeProvider.types.d.ts +0 -112
- package/dist/components/ThemeProvider/index.d.ts +0 -2
- package/dist/components/TimePicker/TimePicker.d.ts +0 -2
- package/dist/components/TimePicker/TimePicker.stories.d.ts +0 -23
- package/dist/components/TimePicker/TimePicker.test.d.ts +0 -1
- package/dist/components/TimePicker/TimePicker.types.d.ts +0 -27
- package/dist/components/TimePicker/index.d.ts +0 -2
- package/dist/components/Toaster/Toaster.d.ts +0 -2
- package/dist/components/Toaster/Toaster.stories.d.ts +0 -13
- package/dist/components/Toaster/Toaster.test.d.ts +0 -1
- package/dist/components/Toaster/Toaster.types.d.ts +0 -23
- package/dist/components/Toaster/index.d.ts +0 -2
- package/dist/components/Toggle/Toggle.d.ts +0 -2
- package/dist/components/Toggle/Toggle.stories.d.ts +0 -11
- package/dist/components/Toggle/Toggle.types.d.ts +0 -10
- package/dist/components/Toggle/index.d.ts +0 -2
- package/dist/components/Tooltip/Tooltip.d.ts +0 -2
- package/dist/components/Tooltip/Tooltip.stories.d.ts +0 -13
- package/dist/components/Tooltip/Tooltip.test.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +0 -33
- package/dist/components/Tooltip/index.d.ts +0 -2
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -1
|
@@ -0,0 +1,510 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkL5VQZZVR_cjs = require('./chunk-L5VQZZVR.cjs');
|
|
4
|
+
var react = require('react');
|
|
5
|
+
var solid = require('@heroicons/react/20/solid');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
// src/components/Phone/countries.ts
|
|
9
|
+
var COUNTRIES = [
|
|
10
|
+
{ name: "Afghanistan", id: "AF", dialCode: "+93", maxLength: 9, flag: "\u{1F1E6}\u{1F1EB}" },
|
|
11
|
+
{ name: "Albania", id: "AL", dialCode: "+355", maxLength: 9, flag: "\u{1F1E6}\u{1F1F1}" },
|
|
12
|
+
{ name: "Algeria", id: "DZ", dialCode: "+213", maxLength: 9, flag: "\u{1F1E9}\u{1F1FF}" },
|
|
13
|
+
{ name: "Andorra", id: "AD", dialCode: "+376", maxLength: 6, flag: "\u{1F1E6}\u{1F1E9}" },
|
|
14
|
+
{ name: "Angola", id: "AO", dialCode: "+244", maxLength: 9, flag: "\u{1F1E6}\u{1F1F4}" },
|
|
15
|
+
{ name: "Argentina", id: "AR", dialCode: "+54", maxLength: 10, flag: "\u{1F1E6}\u{1F1F7}" },
|
|
16
|
+
{ name: "Armenia", id: "AM", dialCode: "+374", maxLength: 8, flag: "\u{1F1E6}\u{1F1F2}" },
|
|
17
|
+
{ name: "Australia", id: "AU", dialCode: "+61", maxLength: 9, flag: "\u{1F1E6}\u{1F1FA}" },
|
|
18
|
+
{ name: "Austria", id: "AT", dialCode: "+43", maxLength: 13, flag: "\u{1F1E6}\u{1F1F9}" },
|
|
19
|
+
{ name: "Azerbaijan", id: "AZ", dialCode: "+994", maxLength: 9, flag: "\u{1F1E6}\u{1F1FF}" },
|
|
20
|
+
{ name: "Bahrain", id: "BH", dialCode: "+973", maxLength: 8, flag: "\u{1F1E7}\u{1F1ED}" },
|
|
21
|
+
{ name: "Bangladesh", id: "BD", dialCode: "+880", maxLength: 10, flag: "\u{1F1E7}\u{1F1E9}" },
|
|
22
|
+
{ name: "Belarus", id: "BY", dialCode: "+375", maxLength: 9, flag: "\u{1F1E7}\u{1F1FE}" },
|
|
23
|
+
{ name: "Belgium", id: "BE", dialCode: "+32", maxLength: 9, flag: "\u{1F1E7}\u{1F1EA}" },
|
|
24
|
+
{ name: "Bolivia", id: "BO", dialCode: "+591", maxLength: 8, flag: "\u{1F1E7}\u{1F1F4}" },
|
|
25
|
+
{ name: "Bosnia and Herzegovina", id: "BA", dialCode: "+387", maxLength: 8, flag: "\u{1F1E7}\u{1F1E6}" },
|
|
26
|
+
{ name: "Brazil", id: "BR", dialCode: "+55", maxLength: 11, flag: "\u{1F1E7}\u{1F1F7}" },
|
|
27
|
+
{ name: "Bulgaria", id: "BG", dialCode: "+359", maxLength: 9, flag: "\u{1F1E7}\u{1F1EC}" },
|
|
28
|
+
{ name: "Cambodia", id: "KH", dialCode: "+855", maxLength: 9, flag: "\u{1F1F0}\u{1F1ED}" },
|
|
29
|
+
{ name: "Canada", id: "CA", dialCode: "+1", maxLength: 10, flag: "\u{1F1E8}\u{1F1E6}" },
|
|
30
|
+
{ name: "Chile", id: "CL", dialCode: "+56", maxLength: 9, flag: "\u{1F1E8}\u{1F1F1}" },
|
|
31
|
+
{ name: "China", id: "CN", dialCode: "+86", maxLength: 11, flag: "\u{1F1E8}\u{1F1F3}" },
|
|
32
|
+
{ name: "Colombia", id: "CO", dialCode: "+57", maxLength: 10, flag: "\u{1F1E8}\u{1F1F4}" },
|
|
33
|
+
{ name: "Costa Rica", id: "CR", dialCode: "+506", maxLength: 8, flag: "\u{1F1E8}\u{1F1F7}" },
|
|
34
|
+
{ name: "Croatia", id: "HR", dialCode: "+385", maxLength: 9, flag: "\u{1F1ED}\u{1F1F7}" },
|
|
35
|
+
{ name: "Cuba", id: "CU", dialCode: "+53", maxLength: 8, flag: "\u{1F1E8}\u{1F1FA}" },
|
|
36
|
+
{ name: "Cyprus", id: "CY", dialCode: "+357", maxLength: 8, flag: "\u{1F1E8}\u{1F1FE}" },
|
|
37
|
+
{ name: "Czech Republic", id: "CZ", dialCode: "+420", maxLength: 9, flag: "\u{1F1E8}\u{1F1FF}" },
|
|
38
|
+
{ name: "Denmark", id: "DK", dialCode: "+45", maxLength: 8, flag: "\u{1F1E9}\u{1F1F0}" },
|
|
39
|
+
{ name: "Ecuador", id: "EC", dialCode: "+593", maxLength: 9, flag: "\u{1F1EA}\u{1F1E8}" },
|
|
40
|
+
{ name: "Egypt", id: "EG", dialCode: "+20", maxLength: 10, flag: "\u{1F1EA}\u{1F1EC}" },
|
|
41
|
+
{ name: "Estonia", id: "EE", dialCode: "+372", maxLength: 8, flag: "\u{1F1EA}\u{1F1EA}" },
|
|
42
|
+
{ name: "Ethiopia", id: "ET", dialCode: "+251", maxLength: 9, flag: "\u{1F1EA}\u{1F1F9}" },
|
|
43
|
+
{ name: "Finland", id: "FI", dialCode: "+358", maxLength: 10, flag: "\u{1F1EB}\u{1F1EE}" },
|
|
44
|
+
{ name: "France", id: "FR", dialCode: "+33", maxLength: 9, flag: "\u{1F1EB}\u{1F1F7}" },
|
|
45
|
+
{ name: "Georgia", id: "GE", dialCode: "+995", maxLength: 9, flag: "\u{1F1EC}\u{1F1EA}" },
|
|
46
|
+
{ name: "Germany", id: "DE", dialCode: "+49", maxLength: 11, flag: "\u{1F1E9}\u{1F1EA}" },
|
|
47
|
+
{ name: "Ghana", id: "GH", dialCode: "+233", maxLength: 9, flag: "\u{1F1EC}\u{1F1ED}" },
|
|
48
|
+
{ name: "Greece", id: "GR", dialCode: "+30", maxLength: 10, flag: "\u{1F1EC}\u{1F1F7}" },
|
|
49
|
+
{ name: "Guatemala", id: "GT", dialCode: "+502", maxLength: 8, flag: "\u{1F1EC}\u{1F1F9}" },
|
|
50
|
+
{ name: "Hong Kong", id: "HK", dialCode: "+852", maxLength: 8, flag: "\u{1F1ED}\u{1F1F0}" },
|
|
51
|
+
{ name: "Hungary", id: "HU", dialCode: "+36", maxLength: 9, flag: "\u{1F1ED}\u{1F1FA}" },
|
|
52
|
+
{ name: "Iceland", id: "IS", dialCode: "+354", maxLength: 7, flag: "\u{1F1EE}\u{1F1F8}" },
|
|
53
|
+
{ name: "India", id: "IN", dialCode: "+91", maxLength: 10, flag: "\u{1F1EE}\u{1F1F3}" },
|
|
54
|
+
{ name: "Indonesia", id: "ID", dialCode: "+62", maxLength: 12, flag: "\u{1F1EE}\u{1F1E9}" },
|
|
55
|
+
{ name: "Iran", id: "IR", dialCode: "+98", maxLength: 10, flag: "\u{1F1EE}\u{1F1F7}" },
|
|
56
|
+
{ name: "Iraq", id: "IQ", dialCode: "+964", maxLength: 10, flag: "\u{1F1EE}\u{1F1F6}" },
|
|
57
|
+
{ name: "Ireland", id: "IE", dialCode: "+353", maxLength: 9, flag: "\u{1F1EE}\u{1F1EA}" },
|
|
58
|
+
{ name: "Israel", id: "IL", dialCode: "+972", maxLength: 9, flag: "\u{1F1EE}\u{1F1F1}" },
|
|
59
|
+
{ name: "Italy", id: "IT", dialCode: "+39", maxLength: 10, flag: "\u{1F1EE}\u{1F1F9}" },
|
|
60
|
+
{ name: "Japan", id: "JP", dialCode: "+81", maxLength: 10, flag: "\u{1F1EF}\u{1F1F5}" },
|
|
61
|
+
{ name: "Jordan", id: "JO", dialCode: "+962", maxLength: 9, flag: "\u{1F1EF}\u{1F1F4}" },
|
|
62
|
+
{ name: "Kazakhstan", id: "KZ", dialCode: "+7", maxLength: 10, flag: "\u{1F1F0}\u{1F1FF}" },
|
|
63
|
+
{ name: "Kenya", id: "KE", dialCode: "+254", maxLength: 9, flag: "\u{1F1F0}\u{1F1EA}" },
|
|
64
|
+
{ name: "Kuwait", id: "KW", dialCode: "+965", maxLength: 8, flag: "\u{1F1F0}\u{1F1FC}" },
|
|
65
|
+
{ name: "Latvia", id: "LV", dialCode: "+371", maxLength: 8, flag: "\u{1F1F1}\u{1F1FB}" },
|
|
66
|
+
{ name: "Lebanon", id: "LB", dialCode: "+961", maxLength: 8, flag: "\u{1F1F1}\u{1F1E7}" },
|
|
67
|
+
{ name: "Lithuania", id: "LT", dialCode: "+370", maxLength: 8, flag: "\u{1F1F1}\u{1F1F9}" },
|
|
68
|
+
{ name: "Luxembourg", id: "LU", dialCode: "+352", maxLength: 9, flag: "\u{1F1F1}\u{1F1FA}" },
|
|
69
|
+
{ name: "Macau", id: "MO", dialCode: "+853", maxLength: 8, flag: "\u{1F1F2}\u{1F1F4}" },
|
|
70
|
+
{ name: "Malaysia", id: "MY", dialCode: "+60", maxLength: 10, flag: "\u{1F1F2}\u{1F1FE}" },
|
|
71
|
+
{ name: "Mexico", id: "MX", dialCode: "+52", maxLength: 10, flag: "\u{1F1F2}\u{1F1FD}" },
|
|
72
|
+
{ name: "Morocco", id: "MA", dialCode: "+212", maxLength: 9, flag: "\u{1F1F2}\u{1F1E6}" },
|
|
73
|
+
{ name: "Myanmar", id: "MM", dialCode: "+95", maxLength: 9, flag: "\u{1F1F2}\u{1F1F2}" },
|
|
74
|
+
{ name: "Nepal", id: "NP", dialCode: "+977", maxLength: 10, flag: "\u{1F1F3}\u{1F1F5}" },
|
|
75
|
+
{ name: "Netherlands", id: "NL", dialCode: "+31", maxLength: 9, flag: "\u{1F1F3}\u{1F1F1}" },
|
|
76
|
+
{ name: "New Zealand", id: "NZ", dialCode: "+64", maxLength: 9, flag: "\u{1F1F3}\u{1F1FF}" },
|
|
77
|
+
{ name: "Nigeria", id: "NG", dialCode: "+234", maxLength: 10, flag: "\u{1F1F3}\u{1F1EC}" },
|
|
78
|
+
{ name: "Norway", id: "NO", dialCode: "+47", maxLength: 8, flag: "\u{1F1F3}\u{1F1F4}" },
|
|
79
|
+
{ name: "Oman", id: "OM", dialCode: "+968", maxLength: 8, flag: "\u{1F1F4}\u{1F1F2}" },
|
|
80
|
+
{ name: "Pakistan", id: "PK", dialCode: "+92", maxLength: 10, flag: "\u{1F1F5}\u{1F1F0}" },
|
|
81
|
+
{ name: "Panama", id: "PA", dialCode: "+507", maxLength: 8, flag: "\u{1F1F5}\u{1F1E6}" },
|
|
82
|
+
{ name: "Paraguay", id: "PY", dialCode: "+595", maxLength: 9, flag: "\u{1F1F5}\u{1F1FE}" },
|
|
83
|
+
{ name: "Peru", id: "PE", dialCode: "+51", maxLength: 9, flag: "\u{1F1F5}\u{1F1EA}" },
|
|
84
|
+
{ name: "Philippines", id: "PH", dialCode: "+63", maxLength: 10, flag: "\u{1F1F5}\u{1F1ED}" },
|
|
85
|
+
{ name: "Poland", id: "PL", dialCode: "+48", maxLength: 9, flag: "\u{1F1F5}\u{1F1F1}" },
|
|
86
|
+
{ name: "Portugal", id: "PT", dialCode: "+351", maxLength: 9, flag: "\u{1F1F5}\u{1F1F9}" },
|
|
87
|
+
{ name: "Qatar", id: "QA", dialCode: "+974", maxLength: 8, flag: "\u{1F1F6}\u{1F1E6}" },
|
|
88
|
+
{ name: "Romania", id: "RO", dialCode: "+40", maxLength: 9, flag: "\u{1F1F7}\u{1F1F4}" },
|
|
89
|
+
{ name: "Russia", id: "RU", dialCode: "+7", maxLength: 10, flag: "\u{1F1F7}\u{1F1FA}" },
|
|
90
|
+
{ name: "Saudi Arabia", id: "SA", dialCode: "+966", maxLength: 9, flag: "\u{1F1F8}\u{1F1E6}" },
|
|
91
|
+
{ name: "Serbia", id: "RS", dialCode: "+381", maxLength: 9, flag: "\u{1F1F7}\u{1F1F8}" },
|
|
92
|
+
{ name: "Singapore", id: "SG", dialCode: "+65", maxLength: 8, flag: "\u{1F1F8}\u{1F1EC}" },
|
|
93
|
+
{ name: "Slovakia", id: "SK", dialCode: "+421", maxLength: 9, flag: "\u{1F1F8}\u{1F1F0}" },
|
|
94
|
+
{ name: "Slovenia", id: "SI", dialCode: "+386", maxLength: 8, flag: "\u{1F1F8}\u{1F1EE}" },
|
|
95
|
+
{ name: "South Africa", id: "ZA", dialCode: "+27", maxLength: 9, flag: "\u{1F1FF}\u{1F1E6}" },
|
|
96
|
+
{ name: "South Korea", id: "KR", dialCode: "+82", maxLength: 10, flag: "\u{1F1F0}\u{1F1F7}" },
|
|
97
|
+
{ name: "Spain", id: "ES", dialCode: "+34", maxLength: 9, flag: "\u{1F1EA}\u{1F1F8}" },
|
|
98
|
+
{ name: "Sri Lanka", id: "LK", dialCode: "+94", maxLength: 9, flag: "\u{1F1F1}\u{1F1F0}" },
|
|
99
|
+
{ name: "Sweden", id: "SE", dialCode: "+46", maxLength: 9, flag: "\u{1F1F8}\u{1F1EA}" },
|
|
100
|
+
{ name: "Switzerland", id: "CH", dialCode: "+41", maxLength: 9, flag: "\u{1F1E8}\u{1F1ED}" },
|
|
101
|
+
{ name: "Syria", id: "SY", dialCode: "+963", maxLength: 9, flag: "\u{1F1F8}\u{1F1FE}" },
|
|
102
|
+
{ name: "Taiwan", id: "TW", dialCode: "+886", maxLength: 9, flag: "\u{1F1F9}\u{1F1FC}" },
|
|
103
|
+
{ name: "Thailand", id: "TH", dialCode: "+66", maxLength: 9, flag: "\u{1F1F9}\u{1F1ED}" },
|
|
104
|
+
{ name: "Tunisia", id: "TN", dialCode: "+216", maxLength: 8, flag: "\u{1F1F9}\u{1F1F3}" },
|
|
105
|
+
{ name: "Turkey", id: "TR", dialCode: "+90", maxLength: 10, flag: "\u{1F1F9}\u{1F1F7}" },
|
|
106
|
+
{ name: "Ukraine", id: "UA", dialCode: "+380", maxLength: 9, flag: "\u{1F1FA}\u{1F1E6}" },
|
|
107
|
+
{ name: "United Arab Emirates", id: "AE", dialCode: "+971", maxLength: 9, flag: "\u{1F1E6}\u{1F1EA}" },
|
|
108
|
+
{ name: "United Kingdom", id: "GB", dialCode: "+44", maxLength: 10, flag: "\u{1F1EC}\u{1F1E7}" },
|
|
109
|
+
{ name: "United States", id: "US", dialCode: "+1", maxLength: 10, flag: "\u{1F1FA}\u{1F1F8}" },
|
|
110
|
+
{ name: "Uruguay", id: "UY", dialCode: "+598", maxLength: 8, flag: "\u{1F1FA}\u{1F1FE}" },
|
|
111
|
+
{ name: "Uzbekistan", id: "UZ", dialCode: "+998", maxLength: 9, flag: "\u{1F1FA}\u{1F1FF}" },
|
|
112
|
+
{ name: "Venezuela", id: "VE", dialCode: "+58", maxLength: 10, flag: "\u{1F1FB}\u{1F1EA}" },
|
|
113
|
+
{ name: "Vietnam", id: "VN", dialCode: "+84", maxLength: 9, flag: "\u{1F1FB}\u{1F1F3}" },
|
|
114
|
+
{ name: "Yemen", id: "YE", dialCode: "+967", maxLength: 9, flag: "\u{1F1FE}\u{1F1EA}" }
|
|
115
|
+
];
|
|
116
|
+
var wrapperSizeClasses = {
|
|
117
|
+
xs: "h-6 text-xs",
|
|
118
|
+
sm: "h-8 text-sm",
|
|
119
|
+
md: "h-10 text-sm",
|
|
120
|
+
lg: "h-11 text-base",
|
|
121
|
+
xl: "h-12 text-lg"
|
|
122
|
+
};
|
|
123
|
+
var labelSizeClasses = {
|
|
124
|
+
xs: "text-xs",
|
|
125
|
+
sm: "text-xs",
|
|
126
|
+
md: "text-sm",
|
|
127
|
+
lg: "text-sm",
|
|
128
|
+
xl: "text-base"
|
|
129
|
+
};
|
|
130
|
+
var variantClasses = {
|
|
131
|
+
default: "rounded-md border border-border bg-surface shadow-sm focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",
|
|
132
|
+
filled: "rounded-md border border-transparent bg-surface-secondary focus-within:bg-surface focus-within:ring-2 focus-within:ring-primary/40 focus-within:border-primary transition-all duration-normal",
|
|
133
|
+
flushed: "rounded-none border-0 border-b border-border bg-transparent focus-within:border-primary transition-all",
|
|
134
|
+
unstyled: "border-0 bg-transparent p-0"
|
|
135
|
+
};
|
|
136
|
+
var stateVariantClasses = {
|
|
137
|
+
default: {
|
|
138
|
+
default: "border-border focus-within:border-primary focus-within:ring-primary/40",
|
|
139
|
+
filled: "focus-within:border-primary focus-within:ring-primary/40",
|
|
140
|
+
flushed: "border-border focus-within:border-primary",
|
|
141
|
+
unstyled: ""
|
|
142
|
+
},
|
|
143
|
+
error: {
|
|
144
|
+
default: "border-error focus-within:border-error focus-within:ring-error/20",
|
|
145
|
+
filled: "bg-error/5 focus-within:border-error focus-within:ring-error/20",
|
|
146
|
+
flushed: "border-error focus-within:border-error",
|
|
147
|
+
unstyled: ""
|
|
148
|
+
},
|
|
149
|
+
success: {
|
|
150
|
+
default: "border-success focus-within:border-success focus-within:ring-success/20",
|
|
151
|
+
filled: "bg-success/5 focus-within:border-success focus-within:ring-success/20",
|
|
152
|
+
flushed: "border-success focus-within:border-success",
|
|
153
|
+
unstyled: ""
|
|
154
|
+
},
|
|
155
|
+
warning: {
|
|
156
|
+
default: "border-warning focus-within:border-warning focus-within:ring-warning/20",
|
|
157
|
+
filled: "bg-warning/5 border-warning focus-within:border-warning focus-within:ring-warning/20",
|
|
158
|
+
flushed: "border-warning focus-within:border-warning",
|
|
159
|
+
unstyled: ""
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
var stateMessageClasses = {
|
|
163
|
+
default: "text-text-muted",
|
|
164
|
+
error: "text-error",
|
|
165
|
+
success: "text-success",
|
|
166
|
+
warning: "text-warning"
|
|
167
|
+
};
|
|
168
|
+
var disabledClasses = "cursor-not-allowed opacity-50 bg-surface-secondary [&_*]:cursor-not-allowed";
|
|
169
|
+
function getStateMessage(state, errorMessage, successMessage, warningMessage) {
|
|
170
|
+
if (state === "error" && errorMessage) return errorMessage;
|
|
171
|
+
if (state === "success" && successMessage) return successMessage;
|
|
172
|
+
if (state === "warning" && warningMessage) return warningMessage;
|
|
173
|
+
return void 0;
|
|
174
|
+
}
|
|
175
|
+
var Phone = react.forwardRef(function Phone2({
|
|
176
|
+
label,
|
|
177
|
+
required = false,
|
|
178
|
+
helperText,
|
|
179
|
+
errorMessage,
|
|
180
|
+
successMessage,
|
|
181
|
+
warningMessage,
|
|
182
|
+
variant = "default",
|
|
183
|
+
size = "md",
|
|
184
|
+
state = "default",
|
|
185
|
+
fullWidth = true,
|
|
186
|
+
leftElement,
|
|
187
|
+
rightElement,
|
|
188
|
+
prefix,
|
|
189
|
+
suffix,
|
|
190
|
+
wrapperClassName,
|
|
191
|
+
inputGroupClassName,
|
|
192
|
+
inputClassName,
|
|
193
|
+
labelClassName,
|
|
194
|
+
helperClassName,
|
|
195
|
+
id: idProp,
|
|
196
|
+
disabled,
|
|
197
|
+
className,
|
|
198
|
+
clearable,
|
|
199
|
+
isLoading,
|
|
200
|
+
value,
|
|
201
|
+
defaultValue,
|
|
202
|
+
onChange,
|
|
203
|
+
showFlag = true,
|
|
204
|
+
defaultCountryCode = "+91",
|
|
205
|
+
autoComplete = "tel",
|
|
206
|
+
...rest
|
|
207
|
+
}, ref) {
|
|
208
|
+
const generatedId = react.useId();
|
|
209
|
+
const inputId = idProp ?? generatedId;
|
|
210
|
+
const helperId = `${inputId}-helper`;
|
|
211
|
+
const stateMessageId = `${inputId}-state`;
|
|
212
|
+
const [internalError, setInternalError] = react.useState(null);
|
|
213
|
+
const [isOpen, setIsOpen] = react.useState(false);
|
|
214
|
+
const [searchTerm, setSearchTerm] = react.useState("");
|
|
215
|
+
const dropdownRef = react.useRef(null);
|
|
216
|
+
const [internalPhone, setInternalPhone] = react.useState(
|
|
217
|
+
defaultValue ?? { countryCode: defaultCountryCode, phoneNumber: "" }
|
|
218
|
+
);
|
|
219
|
+
const isControlled = value !== void 0;
|
|
220
|
+
const currentPhone = isControlled ? value : internalPhone;
|
|
221
|
+
const activeCountry = COUNTRIES.find((c) => c.dialCode === currentPhone.countryCode) ?? COUNTRIES[0];
|
|
222
|
+
const currentMaxLength = activeCountry?.maxLength ?? 15;
|
|
223
|
+
const showClear = clearable && currentPhone.phoneNumber.length > 0;
|
|
224
|
+
const hasLeftElement = leftElement !== void 0;
|
|
225
|
+
const hasRightElement = rightElement !== void 0 || Boolean(showClear) || Boolean(isLoading);
|
|
226
|
+
const mergedState = internalError ? "error" : state;
|
|
227
|
+
const mergedErrorMessage = internalError ?? errorMessage;
|
|
228
|
+
const stateMessage = getStateMessage(
|
|
229
|
+
mergedState,
|
|
230
|
+
mergedErrorMessage,
|
|
231
|
+
successMessage,
|
|
232
|
+
warningMessage
|
|
233
|
+
);
|
|
234
|
+
const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null].filter(Boolean).join(" ") || void 0;
|
|
235
|
+
const triggerChange = (newPhone) => {
|
|
236
|
+
if (!isControlled) {
|
|
237
|
+
setInternalPhone(newPhone);
|
|
238
|
+
}
|
|
239
|
+
if (onChange) {
|
|
240
|
+
onChange(newPhone);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
const handleChange = (e) => {
|
|
244
|
+
const rawValue = e.target.value;
|
|
245
|
+
const numericValue = rawValue.replace(/\D/g, "");
|
|
246
|
+
if (numericValue !== rawValue) {
|
|
247
|
+
setInternalError("Only numbers are allowed");
|
|
248
|
+
} else {
|
|
249
|
+
setInternalError(null);
|
|
250
|
+
}
|
|
251
|
+
if (numericValue.length > currentMaxLength) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
triggerChange({ ...currentPhone, phoneNumber: numericValue });
|
|
255
|
+
};
|
|
256
|
+
const handleClear = () => {
|
|
257
|
+
setInternalError(null);
|
|
258
|
+
triggerChange({ ...currentPhone, phoneNumber: "" });
|
|
259
|
+
};
|
|
260
|
+
react.useEffect(() => {
|
|
261
|
+
if (!isOpen) return;
|
|
262
|
+
const handleClickOutside = (e) => {
|
|
263
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
264
|
+
setIsOpen(false);
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
268
|
+
return () => {
|
|
269
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
270
|
+
};
|
|
271
|
+
}, [isOpen]);
|
|
272
|
+
const filteredCountries = COUNTRIES.filter(
|
|
273
|
+
(c) => c.name.toLowerCase().includes(searchTerm.toLowerCase()) || c.dialCode.includes(searchTerm)
|
|
274
|
+
);
|
|
275
|
+
const renderRightIcon = () => {
|
|
276
|
+
if (isLoading) {
|
|
277
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
278
|
+
"svg",
|
|
279
|
+
{
|
|
280
|
+
className: "animate-spin h-4 w-4 text-text-muted",
|
|
281
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
282
|
+
fill: "none",
|
|
283
|
+
viewBox: "0 0 24 24",
|
|
284
|
+
children: [
|
|
285
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
286
|
+
"circle",
|
|
287
|
+
{
|
|
288
|
+
className: "opacity-25",
|
|
289
|
+
cx: "12",
|
|
290
|
+
cy: "12",
|
|
291
|
+
r: "10",
|
|
292
|
+
stroke: "currentColor",
|
|
293
|
+
strokeWidth: "4"
|
|
294
|
+
}
|
|
295
|
+
),
|
|
296
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
297
|
+
"path",
|
|
298
|
+
{
|
|
299
|
+
className: "opacity-75",
|
|
300
|
+
fill: "currentColor",
|
|
301
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
302
|
+
}
|
|
303
|
+
)
|
|
304
|
+
]
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
}
|
|
308
|
+
if (showClear) {
|
|
309
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
310
|
+
"button",
|
|
311
|
+
{
|
|
312
|
+
type: "button",
|
|
313
|
+
onClick: handleClear,
|
|
314
|
+
disabled,
|
|
315
|
+
className: "flex items-center justify-center rounded-full text-text-muted hover:text-text hover:bg-hover p-0.5 transition-all duration-fast disabled:cursor-not-allowed",
|
|
316
|
+
"aria-label": "Clear input",
|
|
317
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(solid.XMarkIcon, { className: "w-4 h-4" })
|
|
318
|
+
}
|
|
319
|
+
);
|
|
320
|
+
}
|
|
321
|
+
return rightElement;
|
|
322
|
+
};
|
|
323
|
+
const leftRadiusClass = prefix !== void 0 || variant === "flushed" || variant === "unstyled" ? "" : "rounded-l-md";
|
|
324
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
325
|
+
"div",
|
|
326
|
+
{
|
|
327
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
328
|
+
"flex flex-col gap-1",
|
|
329
|
+
fullWidth ? "w-full" : "w-fit",
|
|
330
|
+
wrapperClassName,
|
|
331
|
+
className
|
|
332
|
+
),
|
|
333
|
+
children: [
|
|
334
|
+
label !== void 0 && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
335
|
+
"label",
|
|
336
|
+
{
|
|
337
|
+
htmlFor: inputId,
|
|
338
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
339
|
+
"font-black leading-none text-text mb-2 uppercase tracking-widest",
|
|
340
|
+
labelSizeClasses[size],
|
|
341
|
+
labelClassName
|
|
342
|
+
),
|
|
343
|
+
children: [
|
|
344
|
+
label,
|
|
345
|
+
required && /* @__PURE__ */ jsxRuntime.jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
350
|
+
"div",
|
|
351
|
+
{
|
|
352
|
+
className: chunkL5VQZZVR_cjs.cn("flex items-stretch", fullWidth ? "w-full" : "w-fit", inputGroupClassName),
|
|
353
|
+
children: [
|
|
354
|
+
prefix !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center rounded-l-md border border-r-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none", children: prefix }),
|
|
355
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
356
|
+
"div",
|
|
357
|
+
{
|
|
358
|
+
ref: dropdownRef,
|
|
359
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
360
|
+
"relative flex flex-1 items-stretch",
|
|
361
|
+
wrapperSizeClasses[size],
|
|
362
|
+
variantClasses[variant],
|
|
363
|
+
stateVariantClasses[mergedState][variant],
|
|
364
|
+
disabled ? disabledClasses : "",
|
|
365
|
+
prefix !== void 0 && suffix !== void 0 ? "rounded-none" : prefix !== void 0 ? "rounded-l-none" : suffix !== void 0 ? "rounded-r-none" : ""
|
|
366
|
+
),
|
|
367
|
+
children: [
|
|
368
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
369
|
+
"button",
|
|
370
|
+
{
|
|
371
|
+
type: "button",
|
|
372
|
+
onClick: () => {
|
|
373
|
+
setIsOpen(!isOpen);
|
|
374
|
+
},
|
|
375
|
+
disabled: Boolean(disabled) || Boolean(isLoading),
|
|
376
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
377
|
+
"relative flex items-center justify-center flex-shrink-0 px-2 sm:px-3 text-text bg-surface-secondary border-r border-border hover:bg-hover active:bg-active transition-colors outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:z-10 disabled:cursor-not-allowed",
|
|
378
|
+
leftRadiusClass
|
|
379
|
+
),
|
|
380
|
+
children: [
|
|
381
|
+
showFlag && activeCountry && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-1.5 text-base sm:text-lg opacity-90", children: activeCountry.flag }),
|
|
382
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: activeCountry?.dialCode ?? defaultCountryCode }),
|
|
383
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
384
|
+
solid.ChevronDownIcon,
|
|
385
|
+
{
|
|
386
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
387
|
+
"w-3.5 h-3.5 ml-1.5 text-text-secondary transition-transform",
|
|
388
|
+
isOpen && "rotate-180"
|
|
389
|
+
)
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
isOpen && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "absolute top-full left-0 mt-1 w-64 rounded-md border border-border bg-surface p-1 shadow-lg z-dropdown flex flex-col animate-in fade-in zoom-in-95 duration-fast", children: [
|
|
396
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 pb-2 sticky top-0 bg-surface z-10 border-b border-divider", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
397
|
+
"input",
|
|
398
|
+
{
|
|
399
|
+
type: "text",
|
|
400
|
+
placeholder: "Search country...",
|
|
401
|
+
className: "w-full text-sm bg-transparent px-1 focus:outline-none text-text placeholder:text-text-muted",
|
|
402
|
+
value: searchTerm,
|
|
403
|
+
onChange: (e) => {
|
|
404
|
+
setSearchTerm(e.target.value);
|
|
405
|
+
},
|
|
406
|
+
onKeyDown: (e) => {
|
|
407
|
+
e.stopPropagation();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
) }),
|
|
411
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
412
|
+
"ul",
|
|
413
|
+
{
|
|
414
|
+
role: "listbox",
|
|
415
|
+
className: "max-h-56 overflow-y-auto overflow-x-hidden p-1 scrollbar-thin scrollbar-thumb-border scrollbar-track-transparent",
|
|
416
|
+
children: filteredCountries.length > 0 ? filteredCountries.map((c) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
417
|
+
"li",
|
|
418
|
+
{
|
|
419
|
+
role: "option",
|
|
420
|
+
tabIndex: 0,
|
|
421
|
+
"aria-selected": currentPhone.countryCode === c.dialCode,
|
|
422
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
423
|
+
"flex items-center px-2 py-1.5 text-sm rounded-sm cursor-pointer transition-colors outline-none focus:bg-hover active:bg-active",
|
|
424
|
+
currentPhone.countryCode === c.dialCode ? "bg-primary/10 text-primary font-medium" : "text-text"
|
|
425
|
+
),
|
|
426
|
+
onKeyDown: (e) => {
|
|
427
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
428
|
+
e.preventDefault();
|
|
429
|
+
triggerChange({ ...currentPhone, countryCode: c.dialCode });
|
|
430
|
+
setIsOpen(false);
|
|
431
|
+
setSearchTerm("");
|
|
432
|
+
}
|
|
433
|
+
},
|
|
434
|
+
onClick: () => {
|
|
435
|
+
triggerChange({ ...currentPhone, countryCode: c.dialCode });
|
|
436
|
+
setIsOpen(false);
|
|
437
|
+
setSearchTerm("");
|
|
438
|
+
},
|
|
439
|
+
children: [
|
|
440
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "mr-2 text-base", children: c.flag }),
|
|
441
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "flex-1 truncate", children: c.name }),
|
|
442
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
443
|
+
"span",
|
|
444
|
+
{
|
|
445
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
446
|
+
"text-xs ml-2",
|
|
447
|
+
currentPhone.countryCode === c.dialCode ? "text-primary/70" : "text-text-muted"
|
|
448
|
+
),
|
|
449
|
+
children: c.dialCode
|
|
450
|
+
}
|
|
451
|
+
)
|
|
452
|
+
]
|
|
453
|
+
},
|
|
454
|
+
c.id
|
|
455
|
+
)) : /* @__PURE__ */ jsxRuntime.jsx("li", { className: "px-2 py-3 text-center text-sm text-text-muted", children: "No countries found" })
|
|
456
|
+
}
|
|
457
|
+
)
|
|
458
|
+
] }),
|
|
459
|
+
hasLeftElement && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center pl-3", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-secondary flex items-center justify-center", children: leftElement }) }),
|
|
460
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
461
|
+
"input",
|
|
462
|
+
{
|
|
463
|
+
ref,
|
|
464
|
+
...rest,
|
|
465
|
+
id: inputId,
|
|
466
|
+
disabled: Boolean(disabled) || Boolean(isLoading),
|
|
467
|
+
type: "tel",
|
|
468
|
+
inputMode: "numeric",
|
|
469
|
+
value: currentPhone.phoneNumber,
|
|
470
|
+
onChange: handleChange,
|
|
471
|
+
autoComplete,
|
|
472
|
+
"aria-invalid": mergedState === "error" ? true : void 0,
|
|
473
|
+
"aria-describedby": describedBy,
|
|
474
|
+
"aria-required": required,
|
|
475
|
+
maxLength: currentMaxLength,
|
|
476
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
477
|
+
"flex-1 w-full bg-transparent border-none outline-none focus:ring-0 focus:outline-none focus:border-none focus-visible:ring-0 focus-visible:outline-none px-3 min-w-0 transition-colors duration-150 disabled:cursor-not-allowed",
|
|
478
|
+
inputClassName
|
|
479
|
+
)
|
|
480
|
+
}
|
|
481
|
+
),
|
|
482
|
+
hasRightElement && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center pr-3", children: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-text-secondary flex items-center justify-center", children: renderRightIcon() }) })
|
|
483
|
+
]
|
|
484
|
+
}
|
|
485
|
+
),
|
|
486
|
+
suffix !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex items-center rounded-r-md border border-l-0 border-border bg-surface-secondary px-3 text-sm text-text-secondary select-none", children: suffix })
|
|
487
|
+
]
|
|
488
|
+
}
|
|
489
|
+
),
|
|
490
|
+
helperText !== void 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { id: helperId, className: chunkL5VQZZVR_cjs.cn("text-xs leading-tight text-text-muted", helperClassName), children: helperText }),
|
|
491
|
+
stateMessage !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
|
|
492
|
+
"p",
|
|
493
|
+
{
|
|
494
|
+
id: stateMessageId,
|
|
495
|
+
role: mergedState === "error" ? "alert" : void 0,
|
|
496
|
+
className: chunkL5VQZZVR_cjs.cn(
|
|
497
|
+
"text-xs leading-tight mt-1",
|
|
498
|
+
stateMessageClasses[mergedState],
|
|
499
|
+
helperClassName
|
|
500
|
+
),
|
|
501
|
+
children: stateMessage
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
);
|
|
507
|
+
});
|
|
508
|
+
Phone.displayName = "Phone";
|
|
509
|
+
|
|
510
|
+
exports.Phone = Phone;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { forwardRef, useState } from 'react';
|
|
3
|
+
import { UserIcon } from '@heroicons/react/24/solid';
|
|
4
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var sizeClasses = {
|
|
7
|
+
"2xs": "w-4 h-4 text-[10px]",
|
|
8
|
+
xs: "w-6 h-6 text-xs",
|
|
9
|
+
sm: "w-8 h-8 text-sm",
|
|
10
|
+
md: "w-10 h-10 text-base",
|
|
11
|
+
lg: "w-12 h-12 text-lg",
|
|
12
|
+
xl: "w-14 h-14 text-xl",
|
|
13
|
+
"2xl": "w-16 h-16 text-2xl",
|
|
14
|
+
"3xl": "w-20 h-20 text-3xl",
|
|
15
|
+
"4xl": "w-24 h-24 text-4xl"
|
|
16
|
+
};
|
|
17
|
+
var variantClasses = {
|
|
18
|
+
circle: "rounded-full",
|
|
19
|
+
square: "rounded-none",
|
|
20
|
+
rounded: "rounded-md"
|
|
21
|
+
};
|
|
22
|
+
var stateBorderClasses = {
|
|
23
|
+
default: "ring-0",
|
|
24
|
+
error: "ring-2 ring-error ring-offset-2 ring-offset-surface",
|
|
25
|
+
success: "ring-2 ring-success ring-offset-2 ring-offset-surface",
|
|
26
|
+
warning: "ring-2 ring-warning ring-offset-2 ring-offset-surface",
|
|
27
|
+
offline: "ring-2 ring-border ring-offset-2 ring-offset-surface",
|
|
28
|
+
online: "ring-2 ring-success ring-offset-2 ring-offset-surface",
|
|
29
|
+
busy: "ring-2 ring-error ring-offset-2 ring-offset-surface",
|
|
30
|
+
away: "ring-2 ring-warning ring-offset-2 ring-offset-surface"
|
|
31
|
+
};
|
|
32
|
+
var stateBadgeClasses = {
|
|
33
|
+
default: "hidden",
|
|
34
|
+
error: "bg-error",
|
|
35
|
+
success: "bg-success",
|
|
36
|
+
warning: "bg-warning",
|
|
37
|
+
offline: "bg-border",
|
|
38
|
+
online: "bg-success",
|
|
39
|
+
busy: "bg-error",
|
|
40
|
+
away: "bg-warning"
|
|
41
|
+
};
|
|
42
|
+
function getInitials(name) {
|
|
43
|
+
const parts = name.trim().split(/\s+/);
|
|
44
|
+
if (parts.length === 0) return "";
|
|
45
|
+
if (parts.length === 1) return parts[0]?.substring(0, 2).toUpperCase() ?? "";
|
|
46
|
+
const first = parts[0];
|
|
47
|
+
const last = parts[parts.length - 1];
|
|
48
|
+
return `${first?.[0] ?? ""}${last?.[0] ?? ""}`.toUpperCase();
|
|
49
|
+
}
|
|
50
|
+
var Avatar = forwardRef(function Avatar2({
|
|
51
|
+
size = "md",
|
|
52
|
+
variant = "circle",
|
|
53
|
+
state = "default",
|
|
54
|
+
stateType = "border",
|
|
55
|
+
fallback,
|
|
56
|
+
alt,
|
|
57
|
+
src,
|
|
58
|
+
className,
|
|
59
|
+
containerClassName,
|
|
60
|
+
fallbackClassName,
|
|
61
|
+
...rest
|
|
62
|
+
}, ref) {
|
|
63
|
+
const [hasError, setHasError] = useState(false);
|
|
64
|
+
const showFallback = typeof src !== "string" || src.length === 0 || hasError;
|
|
65
|
+
let initial = "";
|
|
66
|
+
if (typeof fallback === "string") {
|
|
67
|
+
initial = getInitials(fallback);
|
|
68
|
+
} else if (typeof alt === "string" && alt.length > 0) {
|
|
69
|
+
initial = getInitials(alt);
|
|
70
|
+
}
|
|
71
|
+
const renderedFallback = typeof fallback === "string" || typeof fallback === "undefined" ? /* @__PURE__ */ jsx(
|
|
72
|
+
"span",
|
|
73
|
+
{
|
|
74
|
+
className: cn(
|
|
75
|
+
"flex h-full w-full items-center justify-center font-bold text-text-muted",
|
|
76
|
+
fallbackClassName
|
|
77
|
+
),
|
|
78
|
+
children: initial || /* @__PURE__ */ jsx(UserIcon, { className: "h-3/5 w-3/5 text-text-muted/40", "aria-hidden": "true" })
|
|
79
|
+
}
|
|
80
|
+
) : /* @__PURE__ */ jsx("span", { className: cn("flex h-full w-full items-center justify-center", fallbackClassName), children: fallback });
|
|
81
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("relative inline-block", containerClassName), children: [
|
|
82
|
+
/* @__PURE__ */ jsx(
|
|
83
|
+
"div",
|
|
84
|
+
{
|
|
85
|
+
ref,
|
|
86
|
+
className: cn(
|
|
87
|
+
"relative inline-flex shrink-0 items-center justify-center overflow-hidden bg-surface-secondary",
|
|
88
|
+
sizeClasses[size],
|
|
89
|
+
variantClasses[variant],
|
|
90
|
+
stateType === "border" ? stateBorderClasses[state] : "",
|
|
91
|
+
className
|
|
92
|
+
),
|
|
93
|
+
children: showFallback ? renderedFallback : /* @__PURE__ */ jsx(
|
|
94
|
+
"img",
|
|
95
|
+
{
|
|
96
|
+
src,
|
|
97
|
+
alt,
|
|
98
|
+
onError: () => {
|
|
99
|
+
setHasError(true);
|
|
100
|
+
},
|
|
101
|
+
className: "h-full w-full object-cover",
|
|
102
|
+
...rest
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
stateType === "badge" && state !== "default" && /* @__PURE__ */ jsx(
|
|
108
|
+
"span",
|
|
109
|
+
{
|
|
110
|
+
className: cn(
|
|
111
|
+
"absolute bottom-0 right-0 block rounded-full border-2 border-surface",
|
|
112
|
+
stateBadgeClasses[state],
|
|
113
|
+
size === "2xs" || size === "xs" ? "h-2 w-2" : size === "sm" ? "h-2.5 w-2.5" : size === "md" ? "h-3 w-3" : size === "lg" ? "h-3.5 w-3.5" : size === "xl" ? "h-4 w-4" : size === "2xl" ? "h-4.5 w-4.5" : size === "3xl" ? "h-5 w-5" : "h-6 w-6",
|
|
114
|
+
variant === "square" ? "-translate-x-1/2 -translate-y-1/2" : ""
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
)
|
|
118
|
+
] });
|
|
119
|
+
});
|
|
120
|
+
Avatar.displayName = "Avatar";
|
|
121
|
+
|
|
122
|
+
export { Avatar };
|