@bricks-toolkit/toolkit 0.1.0 → 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/{components/Button/Button.types.d.ts → Button.types-BsQYqZml.d.ts} +8 -5
- package/dist/Button.types-D-srlWFf.d.mts +27 -0
- package/dist/{components/TextInput/TextInput.types.d.ts → TextInput.types-DRI8HQza.d.mts} +8 -5
- package/dist/TextInput.types-DRI8HQza.d.ts +32 -0
- package/dist/{components/Tooltip/Tooltip.types.d.ts → Tooltip.types-PbUasE3C.d.mts} +9 -6
- package/dist/Tooltip.types-PbUasE3C.d.ts +36 -0
- package/dist/avatar/index.cjs +11 -0
- package/dist/{components/Avatar/Avatar.types.d.ts → avatar/index.d.mts} +10 -5
- package/dist/avatar/index.d.ts +29 -0
- package/dist/avatar/index.mjs +2 -0
- package/dist/badge/index.cjs +11 -0
- package/dist/{components/Badge/Badge.types.d.ts → badge/index.d.mts} +20 -6
- package/dist/badge/index.d.ts +57 -0
- package/dist/badge/index.mjs +2 -0
- package/dist/breadcrumbs/index.cjs +11 -0
- package/dist/{components/Breadcrumbs/Breadcrumbs.types.d.ts → breadcrumbs/index.d.mts} +10 -5
- package/dist/breadcrumbs/index.d.ts +32 -0
- package/dist/breadcrumbs/index.mjs +2 -0
- package/dist/button/index.cjs +13 -0
- package/dist/button/index.d.mts +8 -0
- package/dist/button/index.d.ts +8 -0
- package/dist/button/index.mjs +4 -0
- package/dist/card/index.cjs +31 -0
- package/dist/card/index.d.mts +42 -0
- package/dist/card/index.d.ts +42 -0
- package/dist/card/index.mjs +2 -0
- package/dist/checkbox/index.cjs +11 -0
- package/dist/{components/Checkbox/Checkbox.types.d.ts → checkbox/index.d.mts} +9 -4
- package/dist/checkbox/index.d.ts +36 -0
- package/dist/checkbox/index.mjs +2 -0
- 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 -0
- package/dist/{components/ComboBox/ComboBox.types.d.ts → combo-box/index.d.mts} +10 -5
- package/dist/combo-box/index.d.ts +62 -0
- package/dist/combo-box/index.mjs +2 -0
- package/dist/date-picker/index.cjs +11 -0
- package/dist/date-picker/index.d.mts +32 -0
- package/dist/date-picker/index.d.ts +32 -0
- package/dist/date-picker/index.mjs +2 -0
- package/dist/dialog/index.cjs +27 -0
- package/dist/{components/Dialog/Dialog.types.d.ts → dialog/index.d.mts} +16 -7
- package/dist/dialog/index.d.ts +61 -0
- package/dist/dialog/index.mjs +2 -0
- package/dist/dropdown-menu/index.cjs +27 -0
- package/dist/dropdown-menu/index.d.mts +34 -0
- package/dist/dropdown-menu/index.d.ts +34 -0
- package/dist/dropdown-menu/index.mjs +2 -0
- package/dist/email/index.cjs +11 -0
- package/dist/{components/Email/Email.types.d.ts → email/index.d.mts} +10 -5
- package/dist/email/index.d.ts +38 -0
- package/dist/email/index.mjs +2 -0
- package/dist/file-upload/index.cjs +11 -0
- package/dist/file-upload/index.d.mts +27 -0
- package/dist/file-upload/index.d.ts +27 -0
- package/dist/file-upload/index.mjs +2 -0
- package/dist/header/index.cjs +14 -0
- package/dist/{components/Header/Header.types.d.ts → header/index.d.mts} +11 -2
- package/dist/header/index.d.ts +28 -0
- package/dist/header/index.mjs +5 -0
- package/dist/icon-button/index.cjs +13 -0
- package/dist/icon-button/index.d.mts +16 -0
- package/dist/icon-button/index.d.ts +16 -0
- package/dist/icon-button/index.mjs +4 -0
- package/dist/image/index.cjs +12 -0
- package/dist/{components/Image/Image.types.d.ts → image/index.d.mts} +10 -2
- package/dist/image/index.d.ts +48 -0
- package/dist/image/index.mjs +3 -0
- package/dist/index.cjs +839 -0
- package/dist/index.d.mts +141 -0
- package/dist/index.d.ts +141 -75
- package/dist/index.mjs +601 -0
- package/dist/link/index.cjs +11 -0
- package/dist/{components/Link/Link.types.d.ts → link/index.d.mts} +10 -5
- package/dist/link/index.d.ts +25 -0
- package/dist/link/index.mjs +2 -0
- package/dist/loader/index.cjs +11 -0
- package/dist/{components/Loader/Loader.types.d.ts → loader/index.d.mts} +8 -4
- package/dist/loader/index.d.ts +21 -0
- package/dist/loader/index.mjs +2 -0
- package/dist/modal/index.cjs +27 -0
- package/dist/{components/Modal/Modal.types.d.ts → modal/index.d.mts} +25 -9
- package/dist/modal/index.d.ts +116 -0
- package/dist/modal/index.mjs +2 -0
- package/dist/multi-select/index.cjs +11 -0
- package/dist/{components/MultiSelect/MultiSelect.types.d.ts → multi-select/index.d.mts} +9 -5
- package/dist/multi-select/index.d.ts +59 -0
- package/dist/multi-select/index.mjs +2 -0
- package/dist/otp-input/index.cjs +11 -0
- package/dist/{components/OtpInput/OtpInput.types.d.ts → otp-input/index.d.mts} +8 -4
- package/dist/otp-input/index.d.ts +57 -0
- package/dist/otp-input/index.mjs +2 -0
- package/dist/password-input/index.cjs +11 -0
- package/dist/password-input/index.d.mts +32 -0
- package/dist/password-input/index.d.ts +32 -0
- package/dist/password-input/index.mjs +2 -0
- package/dist/phone/index.cjs +11 -0
- package/dist/{components/Phone/Phone.types.d.ts → phone/index.d.mts} +11 -6
- package/dist/phone/index.d.ts +41 -0
- package/dist/phone/index.mjs +2 -0
- package/dist/radio-button/index.cjs +11 -0
- package/dist/{components/RadioButton/RadioButton.types.d.ts → radio-button/index.d.mts} +9 -4
- package/dist/radio-button/index.d.ts +56 -0
- package/dist/radio-button/index.mjs +2 -0
- package/dist/search-input/index.cjs +12 -0
- package/dist/search-input/index.d.mts +22 -0
- package/dist/search-input/index.d.ts +22 -0
- package/dist/search-input/index.mjs +3 -0
- package/dist/select/index.cjs +11 -0
- package/dist/{components/Select/Select.types.d.ts → select/index.d.mts} +11 -6
- package/dist/select/index.d.ts +36 -0
- package/dist/select/index.mjs +2 -0
- package/dist/sidebar/index.cjs +11 -0
- package/dist/{components/Sidebar/Sidebar.types.d.ts → sidebar/index.d.mts} +15 -6
- package/dist/sidebar/index.d.ts +96 -0
- package/dist/sidebar/index.mjs +2 -0
- package/dist/skeleton/index.cjs +27 -0
- package/dist/skeleton/index.d.mts +76 -0
- package/dist/skeleton/index.d.ts +76 -0
- package/dist/skeleton/index.mjs +2 -0
- package/dist/styles.css +5075 -0
- package/dist/styles.d.mts +2 -0
- package/dist/styles.d.ts +2 -0
- package/dist/table/index.cjs +15 -0
- package/dist/{components/Table/Table.types.d.ts → table/index.d.mts} +16 -9
- package/dist/table/index.d.ts +92 -0
- package/dist/table/index.mjs +2 -0
- package/dist/tabs/index.cjs +14 -0
- package/dist/tabs/index.d.mts +26 -0
- package/dist/tabs/index.d.ts +26 -0
- package/dist/tabs/index.mjs +5 -0
- package/dist/text-input/index.cjs +11 -0
- package/dist/text-input/index.d.mts +7 -0
- package/dist/text-input/index.d.ts +7 -0
- package/dist/text-input/index.mjs +2 -0
- package/dist/theme-provider/index.cjs +14 -0
- package/dist/{components/ThemeProvider/ThemeProvider.types.d.ts → theme-provider/index.d.mts} +16 -6
- package/dist/theme-provider/index.d.ts +122 -0
- package/dist/theme-provider/index.mjs +1 -0
- package/dist/time-picker/index.cjs +11 -0
- package/dist/time-picker/index.d.mts +32 -0
- package/dist/time-picker/index.d.ts +32 -0
- package/dist/time-picker/index.mjs +2 -0
- package/dist/toaster/index.cjs +11 -0
- package/dist/{components/Toaster/Toaster.types.d.ts → toaster/index.d.mts} +9 -4
- package/dist/toaster/index.d.ts +28 -0
- package/dist/toaster/index.mjs +2 -0
- package/dist/tooltip/index.cjs +12 -0
- package/dist/tooltip/index.d.mts +7 -0
- package/dist/tooltip/index.d.ts +7 -0
- package/dist/tooltip/index.mjs +3 -0
- package/package.json +78 -95
- 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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/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/index.d.ts +0 -2
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/index.d.ts +0 -1
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { forwardRef, useId, useState, useRef, useEffect } from 'react';
|
|
3
|
+
import { ChevronDownIcon, CheckIcon } from '@heroicons/react/20/solid';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var sizeClasses = {
|
|
7
|
+
xs: "py-1 px-2 text-xs min-h-[1.75rem]",
|
|
8
|
+
sm: "py-1.5 px-3 text-sm min-h-[2.125rem]",
|
|
9
|
+
md: "py-2 px-3 text-sm min-h-[2.5rem]",
|
|
10
|
+
lg: "py-2.5 px-4 text-base min-h-[3rem]",
|
|
11
|
+
xl: "py-3 px-4 text-lg min-h-[3.5rem]"
|
|
12
|
+
};
|
|
13
|
+
var labelSizeClasses = {
|
|
14
|
+
xs: "text-xs",
|
|
15
|
+
sm: "text-xs",
|
|
16
|
+
md: "text-sm",
|
|
17
|
+
lg: "text-sm",
|
|
18
|
+
xl: "text-base"
|
|
19
|
+
};
|
|
20
|
+
var variantClasses = {
|
|
21
|
+
default: "rounded-md border border-border bg-surface shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-0 transition-all duration-normal",
|
|
22
|
+
filled: "rounded-md border border-transparent bg-surface-secondary focus-visible:bg-surface focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-0 transition-all duration-normal",
|
|
23
|
+
flushed: "rounded-none border-0 border-b border-border bg-transparent focus-visible:outline-none focus-visible:ring-0",
|
|
24
|
+
unstyled: "border-0 bg-transparent p-0 focus-visible:outline-none focus-visible:ring-0"
|
|
25
|
+
};
|
|
26
|
+
var stateVariantClasses = {
|
|
27
|
+
default: {
|
|
28
|
+
default: "border-border focus-visible:border-primary focus-visible:ring-primary/40",
|
|
29
|
+
filled: "focus-visible:border-primary focus-visible:ring-primary/40",
|
|
30
|
+
flushed: "border-border focus-visible:border-primary",
|
|
31
|
+
unstyled: ""
|
|
32
|
+
},
|
|
33
|
+
error: {
|
|
34
|
+
default: "border-error focus-visible:border-error focus-visible:ring-error/20",
|
|
35
|
+
filled: "bg-error/5 focus-visible:border-error focus-visible:ring-error/20",
|
|
36
|
+
flushed: "border-error focus-visible:border-error",
|
|
37
|
+
unstyled: ""
|
|
38
|
+
},
|
|
39
|
+
success: {
|
|
40
|
+
default: "border-success focus-visible:border-success focus-visible:ring-success/20",
|
|
41
|
+
filled: "bg-success/5 focus-visible:border-success focus-visible:ring-success/20",
|
|
42
|
+
flushed: "border-success focus-visible:border-success",
|
|
43
|
+
unstyled: ""
|
|
44
|
+
},
|
|
45
|
+
warning: {
|
|
46
|
+
default: "border-warning focus-visible:border-warning focus-visible:ring-warning/20",
|
|
47
|
+
filled: "bg-warning/5 focus-visible:border-warning focus-visible:ring-warning/20",
|
|
48
|
+
flushed: "border-warning focus-visible:border-warning",
|
|
49
|
+
unstyled: ""
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var stateMessageClasses = {
|
|
53
|
+
default: "text-text-muted",
|
|
54
|
+
error: "text-error font-medium",
|
|
55
|
+
success: "text-success font-medium",
|
|
56
|
+
warning: "text-warning font-medium"
|
|
57
|
+
};
|
|
58
|
+
var disabledClasses = "disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-surface-secondary";
|
|
59
|
+
function getStateMessage(state, errorMessage, successMessage, warningMessage) {
|
|
60
|
+
if (state === "error" && errorMessage) return errorMessage;
|
|
61
|
+
if (state === "success" && successMessage) return successMessage;
|
|
62
|
+
if (state === "warning" && warningMessage) return warningMessage;
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
var MultiSelect = forwardRef(function MultiSelect2({
|
|
66
|
+
options,
|
|
67
|
+
value,
|
|
68
|
+
defaultValue = [],
|
|
69
|
+
onChange,
|
|
70
|
+
placeholder = "Select options...",
|
|
71
|
+
label,
|
|
72
|
+
required = false,
|
|
73
|
+
helperText,
|
|
74
|
+
errorMessage,
|
|
75
|
+
successMessage,
|
|
76
|
+
warningMessage,
|
|
77
|
+
variant = "default",
|
|
78
|
+
size = "md",
|
|
79
|
+
state = "default",
|
|
80
|
+
fullWidth = true,
|
|
81
|
+
disabled = false,
|
|
82
|
+
isLoading = false,
|
|
83
|
+
id: idProp,
|
|
84
|
+
wrapperClassName,
|
|
85
|
+
triggerClassName,
|
|
86
|
+
dropdownClassName,
|
|
87
|
+
labelClassName,
|
|
88
|
+
helperClassName
|
|
89
|
+
}, ref) {
|
|
90
|
+
const generatedId = useId();
|
|
91
|
+
const componentId = idProp ?? generatedId;
|
|
92
|
+
const helperId = `${componentId}-helper`;
|
|
93
|
+
const stateMessageId = `${componentId}-state`;
|
|
94
|
+
const listboxId = `${componentId}-listbox`;
|
|
95
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
96
|
+
const [internalValue, setInternalValue] = useState(defaultValue);
|
|
97
|
+
const isControlled = value !== void 0;
|
|
98
|
+
const selectedValues = isControlled ? value : internalValue;
|
|
99
|
+
const containerRef = useRef(null);
|
|
100
|
+
const handleToggleOpen = () => {
|
|
101
|
+
if (disabled || isLoading) return;
|
|
102
|
+
setIsOpen((prev) => !prev);
|
|
103
|
+
};
|
|
104
|
+
const handleOptionClick = (optionValue) => {
|
|
105
|
+
let newValues;
|
|
106
|
+
if (selectedValues.includes(optionValue)) {
|
|
107
|
+
newValues = selectedValues.filter((v) => v !== optionValue);
|
|
108
|
+
} else {
|
|
109
|
+
newValues = [...selectedValues, optionValue];
|
|
110
|
+
}
|
|
111
|
+
if (!isControlled) {
|
|
112
|
+
setInternalValue(newValues);
|
|
113
|
+
}
|
|
114
|
+
onChange?.(newValues);
|
|
115
|
+
};
|
|
116
|
+
useEffect(() => {
|
|
117
|
+
const handleOutsideClick = (event) => {
|
|
118
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
119
|
+
setIsOpen(false);
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
if (isOpen) {
|
|
123
|
+
document.addEventListener("mousedown", handleOutsideClick);
|
|
124
|
+
document.addEventListener("touchstart", handleOutsideClick);
|
|
125
|
+
}
|
|
126
|
+
return () => {
|
|
127
|
+
document.removeEventListener("mousedown", handleOutsideClick);
|
|
128
|
+
document.removeEventListener("touchstart", handleOutsideClick);
|
|
129
|
+
};
|
|
130
|
+
}, [isOpen]);
|
|
131
|
+
const stateMessage = getStateMessage(state, errorMessage, successMessage, warningMessage);
|
|
132
|
+
const describedBy = [helperText ? helperId : null, stateMessage ? stateMessageId : null].filter(Boolean).join(" ") || void 0;
|
|
133
|
+
const selectedLabels = options.filter((opt) => selectedValues.includes(opt.value)).map((opt) => opt.label);
|
|
134
|
+
return /* @__PURE__ */ jsxs(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: containerRef,
|
|
138
|
+
className: cn(
|
|
139
|
+
"relative flex flex-col gap-1",
|
|
140
|
+
fullWidth ? "w-full" : "w-fit",
|
|
141
|
+
isOpen && "z-[60]",
|
|
142
|
+
wrapperClassName
|
|
143
|
+
),
|
|
144
|
+
children: [
|
|
145
|
+
label !== void 0 && /* @__PURE__ */ jsxs(
|
|
146
|
+
"label",
|
|
147
|
+
{
|
|
148
|
+
htmlFor: componentId,
|
|
149
|
+
className: cn(
|
|
150
|
+
"font-black leading-none text-text uppercase tracking-widest",
|
|
151
|
+
labelSizeClasses[size],
|
|
152
|
+
disabled && "opacity-50 cursor-not-allowed",
|
|
153
|
+
labelClassName
|
|
154
|
+
),
|
|
155
|
+
children: [
|
|
156
|
+
label,
|
|
157
|
+
required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
),
|
|
161
|
+
/* @__PURE__ */ jsxs(
|
|
162
|
+
"button",
|
|
163
|
+
{
|
|
164
|
+
ref,
|
|
165
|
+
id: componentId,
|
|
166
|
+
type: "button",
|
|
167
|
+
disabled: disabled || isLoading,
|
|
168
|
+
"aria-haspopup": "listbox",
|
|
169
|
+
"aria-expanded": isOpen,
|
|
170
|
+
"aria-controls": isOpen ? listboxId : void 0,
|
|
171
|
+
"aria-invalid": state === "error" ? true : void 0,
|
|
172
|
+
"aria-describedby": describedBy,
|
|
173
|
+
onClick: handleToggleOpen,
|
|
174
|
+
className: cn(
|
|
175
|
+
"w-full flex items-center justify-between text-left transition-colors duration-150",
|
|
176
|
+
sizeClasses[size],
|
|
177
|
+
variantClasses[variant],
|
|
178
|
+
stateVariantClasses[state][variant],
|
|
179
|
+
disabledClasses,
|
|
180
|
+
triggerClassName
|
|
181
|
+
),
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-1 truncate", children: selectedLabels.length > 0 ? /* @__PURE__ */ jsx("span", { className: "truncate text-text font-bold leading-tight", children: selectedLabels.join(", ") }) : /* @__PURE__ */ jsx("span", { className: "text-text-muted truncate transition-all duration-normal", children: placeholder }) }),
|
|
184
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0 ml-2 text-text-muted", children: isLoading ? /* @__PURE__ */ jsxs(
|
|
185
|
+
"svg",
|
|
186
|
+
{
|
|
187
|
+
className: "animate-spin h-4 w-4 text-text-muted",
|
|
188
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
189
|
+
fill: "none",
|
|
190
|
+
viewBox: "0 0 24 24",
|
|
191
|
+
children: [
|
|
192
|
+
/* @__PURE__ */ jsx(
|
|
193
|
+
"circle",
|
|
194
|
+
{
|
|
195
|
+
className: "opacity-25",
|
|
196
|
+
cx: "12",
|
|
197
|
+
cy: "12",
|
|
198
|
+
r: "10",
|
|
199
|
+
stroke: "currentColor",
|
|
200
|
+
strokeWidth: "4"
|
|
201
|
+
}
|
|
202
|
+
),
|
|
203
|
+
/* @__PURE__ */ jsx(
|
|
204
|
+
"path",
|
|
205
|
+
{
|
|
206
|
+
className: "opacity-75",
|
|
207
|
+
fill: "currentColor",
|
|
208
|
+
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"
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
]
|
|
212
|
+
}
|
|
213
|
+
) : /* @__PURE__ */ jsx(
|
|
214
|
+
ChevronDownIcon,
|
|
215
|
+
{
|
|
216
|
+
className: cn("w-4 h-4 transition-transform duration-200", isOpen && "rotate-180")
|
|
217
|
+
}
|
|
218
|
+
) })
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
),
|
|
222
|
+
isOpen && /* @__PURE__ */ jsx(
|
|
223
|
+
"div",
|
|
224
|
+
{
|
|
225
|
+
className: cn(
|
|
226
|
+
"absolute z-dropdown w-full mt-1 bg-surface border border-border rounded-md shadow-lg",
|
|
227
|
+
"max-h-60 overflow-y-auto py-1 animate-in fade-in zoom-in-95 duration-200",
|
|
228
|
+
// Position it below the trigger
|
|
229
|
+
"top-full left-0",
|
|
230
|
+
dropdownClassName
|
|
231
|
+
),
|
|
232
|
+
children: /* @__PURE__ */ jsx(
|
|
233
|
+
"ul",
|
|
234
|
+
{
|
|
235
|
+
id: listboxId,
|
|
236
|
+
role: "listbox",
|
|
237
|
+
"aria-multiselectable": "true",
|
|
238
|
+
className: "flex flex-col outline-none",
|
|
239
|
+
tabIndex: -1,
|
|
240
|
+
children: options.length === 0 ? /* @__PURE__ */ jsx("li", { className: "px-3 py-2 text-sm text-gray-500 text-center", children: "No options available" }) : options.map((option) => {
|
|
241
|
+
const isSelected = selectedValues.includes(option.value);
|
|
242
|
+
return /* @__PURE__ */ jsxs(
|
|
243
|
+
"li",
|
|
244
|
+
{
|
|
245
|
+
role: "option",
|
|
246
|
+
"aria-selected": isSelected,
|
|
247
|
+
onClick: () => {
|
|
248
|
+
handleOptionClick(option.value);
|
|
249
|
+
},
|
|
250
|
+
onKeyDown: (e) => {
|
|
251
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
252
|
+
e.preventDefault();
|
|
253
|
+
handleOptionClick(option.value);
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
tabIndex: 0,
|
|
257
|
+
className: cn(
|
|
258
|
+
"flex items-center gap-2 px-3 py-2 cursor-pointer transition-all duration-fast",
|
|
259
|
+
"hover:bg-hover" + (isSelected ? "/60" : ""),
|
|
260
|
+
isSelected ? "text-primary font-bold" : "text-text",
|
|
261
|
+
labelSizeClasses[size]
|
|
262
|
+
),
|
|
263
|
+
children: [
|
|
264
|
+
/* @__PURE__ */ jsx(
|
|
265
|
+
"div",
|
|
266
|
+
{
|
|
267
|
+
className: cn(
|
|
268
|
+
"flex shrink-0 items-center justify-center w-4 h-4 border rounded-sm transition-all duration-normal",
|
|
269
|
+
isSelected ? "bg-primary border-primary" : "border-border"
|
|
270
|
+
),
|
|
271
|
+
children: isSelected && /* @__PURE__ */ jsx(CheckIcon, { className: "w-3 h-3 text-text-inverse" })
|
|
272
|
+
}
|
|
273
|
+
),
|
|
274
|
+
/* @__PURE__ */ jsx("span", { className: "truncate", children: option.label })
|
|
275
|
+
]
|
|
276
|
+
},
|
|
277
|
+
option.value
|
|
278
|
+
);
|
|
279
|
+
})
|
|
280
|
+
}
|
|
281
|
+
)
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
(helperText !== void 0 || stateMessage !== void 0) && /* @__PURE__ */ jsxs("div", { className: "mt-1", children: [
|
|
285
|
+
helperText !== void 0 && /* @__PURE__ */ jsx(
|
|
286
|
+
"p",
|
|
287
|
+
{
|
|
288
|
+
id: helperId,
|
|
289
|
+
className: cn("text-xs leading-tight text-text-muted font-medium", helperClassName),
|
|
290
|
+
children: helperText
|
|
291
|
+
}
|
|
292
|
+
),
|
|
293
|
+
stateMessage !== void 0 && /* @__PURE__ */ jsx(
|
|
294
|
+
"p",
|
|
295
|
+
{
|
|
296
|
+
id: stateMessageId,
|
|
297
|
+
role: state === "error" ? "alert" : void 0,
|
|
298
|
+
className: cn(
|
|
299
|
+
"text-xs leading-tight mt-1 font-medium",
|
|
300
|
+
stateMessageClasses[state],
|
|
301
|
+
helperClassName
|
|
302
|
+
),
|
|
303
|
+
children: stateMessage
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] })
|
|
307
|
+
]
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
});
|
|
311
|
+
MultiSelect.displayName = "MultiSelect";
|
|
312
|
+
|
|
313
|
+
export { MultiSelect };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { Skeleton } from './chunk-32SKYPQW.mjs';
|
|
2
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
3
|
+
import { forwardRef, useState } from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var Image = forwardRef(function Image2({
|
|
7
|
+
src,
|
|
8
|
+
alt,
|
|
9
|
+
fallback,
|
|
10
|
+
loadingComponent,
|
|
11
|
+
showSkeleton = true,
|
|
12
|
+
aspectRatio,
|
|
13
|
+
objectFit = "cover",
|
|
14
|
+
className,
|
|
15
|
+
containerClassName,
|
|
16
|
+
onLoad,
|
|
17
|
+
onError,
|
|
18
|
+
style,
|
|
19
|
+
...props
|
|
20
|
+
}, ref) {
|
|
21
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
22
|
+
const [hasError, setHasError] = useState(false);
|
|
23
|
+
const [prevSrc, setPrevSrc] = useState(src);
|
|
24
|
+
if (src !== prevSrc) {
|
|
25
|
+
setPrevSrc(src);
|
|
26
|
+
setIsLoading(true);
|
|
27
|
+
setHasError(false);
|
|
28
|
+
}
|
|
29
|
+
const handleLoad = (event) => {
|
|
30
|
+
setIsLoading(false);
|
|
31
|
+
onLoad?.(event);
|
|
32
|
+
};
|
|
33
|
+
const handleError = (event) => {
|
|
34
|
+
setIsLoading(false);
|
|
35
|
+
setHasError(true);
|
|
36
|
+
onError?.(event);
|
|
37
|
+
};
|
|
38
|
+
const renderFallback = () => {
|
|
39
|
+
const imgStyleClasses = cn(
|
|
40
|
+
"h-full w-full",
|
|
41
|
+
objectFit === "cover" && "object-cover",
|
|
42
|
+
objectFit === "contain" && "object-contain",
|
|
43
|
+
objectFit === "fill" && "object-fill",
|
|
44
|
+
objectFit === "none" && "object-none",
|
|
45
|
+
objectFit === "scale-down" && "object-scale-down",
|
|
46
|
+
className
|
|
47
|
+
);
|
|
48
|
+
if (typeof fallback === "string") {
|
|
49
|
+
return /* @__PURE__ */ jsx("img", { src: fallback, alt, className: imgStyleClasses, ...props });
|
|
50
|
+
}
|
|
51
|
+
return /* @__PURE__ */ jsx("div", { className: imgStyleClasses, children: fallback ?? /* @__PURE__ */ jsx("div", { className: "flex h-full w-full items-center justify-center bg-surface-secondary text-text-tertiary", children: /* @__PURE__ */ jsx(
|
|
52
|
+
"svg",
|
|
53
|
+
{
|
|
54
|
+
className: "h-1/3 w-1/3 opacity-20",
|
|
55
|
+
fill: "none",
|
|
56
|
+
viewBox: "0 0 24 24",
|
|
57
|
+
stroke: "currentColor",
|
|
58
|
+
children: /* @__PURE__ */ jsx(
|
|
59
|
+
"path",
|
|
60
|
+
{
|
|
61
|
+
strokeLinecap: "round",
|
|
62
|
+
strokeLinejoin: "round",
|
|
63
|
+
strokeWidth: 1.5,
|
|
64
|
+
d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
) }) });
|
|
69
|
+
};
|
|
70
|
+
const containerStyle = {
|
|
71
|
+
aspectRatio,
|
|
72
|
+
...style
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ jsxs(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
className: cn(
|
|
78
|
+
"relative overflow-hidden",
|
|
79
|
+
!aspectRatio && "h-full w-full",
|
|
80
|
+
containerClassName
|
|
81
|
+
),
|
|
82
|
+
style: containerStyle,
|
|
83
|
+
children: [
|
|
84
|
+
isLoading && showSkeleton && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-10", children: loadingComponent ?? /* @__PURE__ */ jsx(Skeleton, { className: "h-full w-full", variant: "wave" }) }),
|
|
85
|
+
hasError ? renderFallback() : /* @__PURE__ */ jsx(
|
|
86
|
+
"img",
|
|
87
|
+
{
|
|
88
|
+
ref,
|
|
89
|
+
src,
|
|
90
|
+
alt,
|
|
91
|
+
onLoad: handleLoad,
|
|
92
|
+
onError: handleError,
|
|
93
|
+
className: cn(
|
|
94
|
+
"transition-opacity duration-500 ease-in-out",
|
|
95
|
+
isLoading ? "opacity-0" : "opacity-100",
|
|
96
|
+
objectFit === "cover" && "object-cover",
|
|
97
|
+
objectFit === "contain" && "object-contain",
|
|
98
|
+
objectFit === "fill" && "object-fill",
|
|
99
|
+
objectFit === "none" && "object-none",
|
|
100
|
+
objectFit === "scale-down" && "object-scale-down",
|
|
101
|
+
"h-full w-full",
|
|
102
|
+
className
|
|
103
|
+
),
|
|
104
|
+
...props
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
);
|
|
110
|
+
});
|
|
111
|
+
Image.displayName = "Image";
|
|
112
|
+
|
|
113
|
+
export { Image };
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { cn } from './chunk-OCPFOFJ4.mjs';
|
|
2
|
+
import { forwardRef, useId, useRef, useState } from 'react';
|
|
3
|
+
import { CloudArrowUpIcon } from '@heroicons/react/24/outline';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var sizeClasses = {
|
|
7
|
+
sm: "p-4 text-sm",
|
|
8
|
+
md: "p-8 text-sm",
|
|
9
|
+
lg: "p-12 text-base"
|
|
10
|
+
};
|
|
11
|
+
var labelSizeClasses = {
|
|
12
|
+
sm: "text-xs",
|
|
13
|
+
md: "text-sm",
|
|
14
|
+
lg: "text-sm"
|
|
15
|
+
};
|
|
16
|
+
var stateClasses = {
|
|
17
|
+
default: "border-border hover:border-primary-hover bg-surface focus-within:ring-2 focus-within:ring-primary/20 focus-within:border-primary",
|
|
18
|
+
error: "border-error bg-error/5 focus-within:ring-2 focus-within:ring-error/20",
|
|
19
|
+
success: "border-success bg-success/5 focus-within:ring-2 focus-within:ring-success/20",
|
|
20
|
+
warning: "border-warning bg-warning/5 focus-within:ring-2 focus-within:ring-warning/20"
|
|
21
|
+
};
|
|
22
|
+
var stateMessageClasses = {
|
|
23
|
+
default: "text-text-muted",
|
|
24
|
+
error: "text-error font-medium",
|
|
25
|
+
success: "text-success font-medium",
|
|
26
|
+
warning: "text-warning font-medium"
|
|
27
|
+
};
|
|
28
|
+
var FileUpload = forwardRef(function FileUpload2({
|
|
29
|
+
label,
|
|
30
|
+
required = false,
|
|
31
|
+
helperText,
|
|
32
|
+
errorMessage,
|
|
33
|
+
successMessage,
|
|
34
|
+
warningMessage,
|
|
35
|
+
size = "md",
|
|
36
|
+
state = "default",
|
|
37
|
+
fullWidth = true,
|
|
38
|
+
wrapperClassName,
|
|
39
|
+
labelClassName,
|
|
40
|
+
helperClassName,
|
|
41
|
+
dropzoneClassName,
|
|
42
|
+
icon,
|
|
43
|
+
maxSize,
|
|
44
|
+
maxFiles,
|
|
45
|
+
onFilesSelected,
|
|
46
|
+
accept,
|
|
47
|
+
multiple,
|
|
48
|
+
disabled,
|
|
49
|
+
id: idProp,
|
|
50
|
+
className,
|
|
51
|
+
...rest
|
|
52
|
+
}, ref) {
|
|
53
|
+
const generatedId = useId();
|
|
54
|
+
const inputId = idProp ?? generatedId;
|
|
55
|
+
const internalRef = useRef(null);
|
|
56
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
57
|
+
const handleDragOver = (e) => {
|
|
58
|
+
e.preventDefault();
|
|
59
|
+
if (!disabled) setIsDragging(true);
|
|
60
|
+
};
|
|
61
|
+
const handleDragLeave = () => {
|
|
62
|
+
setIsDragging(false);
|
|
63
|
+
};
|
|
64
|
+
const handleDrop = (e) => {
|
|
65
|
+
e.preventDefault();
|
|
66
|
+
setIsDragging(false);
|
|
67
|
+
if (disabled) return;
|
|
68
|
+
const droppedFiles = Array.from(e.dataTransfer.files);
|
|
69
|
+
handleFiles(droppedFiles);
|
|
70
|
+
};
|
|
71
|
+
const handleChange = (e) => {
|
|
72
|
+
if (e.target.files) {
|
|
73
|
+
handleFiles(Array.from(e.target.files));
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const handleFiles = (files) => {
|
|
77
|
+
let filteredFiles = files;
|
|
78
|
+
if (maxFiles && files.length > maxFiles) {
|
|
79
|
+
filteredFiles = files.slice(0, maxFiles);
|
|
80
|
+
}
|
|
81
|
+
if (maxSize) {
|
|
82
|
+
filteredFiles = filteredFiles.filter((file) => file.size <= maxSize);
|
|
83
|
+
}
|
|
84
|
+
if (onFilesSelected) {
|
|
85
|
+
onFilesSelected(filteredFiles);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const handleClick = () => {
|
|
89
|
+
if (internalRef.current) {
|
|
90
|
+
internalRef.current.click();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const helperId = `${inputId}-helper`;
|
|
94
|
+
const stateMessageId = `${inputId}-state`;
|
|
95
|
+
const stateMsg = state === "error" ? errorMessage : state === "success" ? successMessage : state === "warning" ? warningMessage : void 0;
|
|
96
|
+
const handleKeyDown = (e) => {
|
|
97
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
handleClick();
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
return /* @__PURE__ */ jsxs(
|
|
103
|
+
"div",
|
|
104
|
+
{
|
|
105
|
+
className: cn(
|
|
106
|
+
"flex flex-col gap-1.5",
|
|
107
|
+
fullWidth ? "w-full" : "w-fit",
|
|
108
|
+
wrapperClassName,
|
|
109
|
+
className
|
|
110
|
+
),
|
|
111
|
+
children: [
|
|
112
|
+
label && /* @__PURE__ */ jsxs(
|
|
113
|
+
"label",
|
|
114
|
+
{
|
|
115
|
+
htmlFor: inputId,
|
|
116
|
+
className: cn(
|
|
117
|
+
"font-black leading-none text-text uppercase tracking-widest",
|
|
118
|
+
labelSizeClasses[size],
|
|
119
|
+
labelClassName
|
|
120
|
+
),
|
|
121
|
+
children: [
|
|
122
|
+
label,
|
|
123
|
+
required && /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: "ml-1 text-error", children: "*" })
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsxs(
|
|
128
|
+
"div",
|
|
129
|
+
{
|
|
130
|
+
onDragOver: handleDragOver,
|
|
131
|
+
onDragLeave: handleDragLeave,
|
|
132
|
+
onDrop: handleDrop,
|
|
133
|
+
onClick: handleClick,
|
|
134
|
+
onKeyDown: handleKeyDown,
|
|
135
|
+
role: "button",
|
|
136
|
+
tabIndex: disabled ? -1 : 0,
|
|
137
|
+
"aria-disabled": disabled,
|
|
138
|
+
className: cn(
|
|
139
|
+
"relative flex flex-col items-center justify-center border-2 border-dashed rounded-lg transition-all cursor-pointer group",
|
|
140
|
+
sizeClasses[size],
|
|
141
|
+
stateClasses[state],
|
|
142
|
+
isDragging && "border-primary bg-primary/5 scale-[1.01] shadow-md",
|
|
143
|
+
disabled && "opacity-50 cursor-not-allowed bg-surface-secondary border-border",
|
|
144
|
+
dropzoneClassName
|
|
145
|
+
),
|
|
146
|
+
children: [
|
|
147
|
+
/* @__PURE__ */ jsx(
|
|
148
|
+
"input",
|
|
149
|
+
{
|
|
150
|
+
...rest,
|
|
151
|
+
ref: (node) => {
|
|
152
|
+
internalRef.current = node;
|
|
153
|
+
if (typeof ref === "function") ref(node);
|
|
154
|
+
else if (ref) ref.current = node;
|
|
155
|
+
},
|
|
156
|
+
id: inputId,
|
|
157
|
+
type: "file",
|
|
158
|
+
accept,
|
|
159
|
+
multiple,
|
|
160
|
+
disabled,
|
|
161
|
+
onChange: handleChange,
|
|
162
|
+
className: "sr-only"
|
|
163
|
+
}
|
|
164
|
+
),
|
|
165
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2 text-center pointer-events-none", children: [
|
|
166
|
+
icon ?? /* @__PURE__ */ jsx(
|
|
167
|
+
CloudArrowUpIcon,
|
|
168
|
+
{
|
|
169
|
+
className: cn(
|
|
170
|
+
"w-10 h-10 mb-2 transition-all duration-normal group-hover:scale-110",
|
|
171
|
+
state === "default" ? "text-text-muted" : stateMessageClasses[state]
|
|
172
|
+
)
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold text-text transition-colors group-hover:text-primary", children: "Click to upload or drag and drop" }),
|
|
176
|
+
/* @__PURE__ */ jsxs("span", { className: "text-xs text-text-muted font-medium", children: [
|
|
177
|
+
accept ? `Available formats: ${accept}` : "Any file type",
|
|
178
|
+
maxSize && ` (Max ${String(Math.round(maxSize / 1024 / 1024))}MB)`
|
|
179
|
+
] })
|
|
180
|
+
] })
|
|
181
|
+
]
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
helperText && /* @__PURE__ */ jsx(
|
|
185
|
+
"p",
|
|
186
|
+
{
|
|
187
|
+
id: helperId,
|
|
188
|
+
className: cn("text-xs text-text-muted font-medium mt-1", helperClassName),
|
|
189
|
+
children: helperText
|
|
190
|
+
}
|
|
191
|
+
),
|
|
192
|
+
stateMsg && /* @__PURE__ */ jsx(
|
|
193
|
+
"p",
|
|
194
|
+
{
|
|
195
|
+
id: stateMessageId,
|
|
196
|
+
role: state === "error" ? "alert" : void 0,
|
|
197
|
+
className: cn("text-xs font-bold mt-1", stateMessageClasses[state], helperClassName),
|
|
198
|
+
children: stateMsg
|
|
199
|
+
}
|
|
200
|
+
)
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
);
|
|
204
|
+
});
|
|
205
|
+
FileUpload.displayName = "FileUpload";
|
|
206
|
+
|
|
207
|
+
export { FileUpload };
|