@majapisoftwares/ui 4.3.16 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (482) hide show
  1. package/AGENTS.md +17 -0
  2. package/README.md +71 -0
  3. package/THIRD_PARTY_NOTICES.md +15 -0
  4. package/components.json +25 -0
  5. package/docs/MIGRATION-0.2.md +20 -0
  6. package/docs/NEXT-STARTER-VALIDATION.md +14 -0
  7. package/docs/STANDARDS.md +36 -0
  8. package/docs/VALIDATION.md +11 -0
  9. package/package.json +69 -2
  10. package/scripts/check-standards.mjs +39 -0
  11. package/src/components/ui/alert.tsx +77 -0
  12. package/src/components/ui/badge.tsx +55 -0
  13. package/src/components/ui/button.tsx +63 -0
  14. package/src/components/ui/empty.tsx +105 -0
  15. package/src/components/ui/field.tsx +238 -0
  16. package/src/components/ui/input.tsx +21 -0
  17. package/src/components/ui/label.tsx +19 -0
  18. package/src/components/ui/native-select.tsx +66 -0
  19. package/src/components/ui/separator.tsx +24 -0
  20. package/src/components/ui/sheet.tsx +137 -0
  21. package/src/components/ui/skeleton.tsx +15 -0
  22. package/src/components/ui/table.tsx +115 -0
  23. package/src/components/ui/tabs.tsx +81 -0
  24. package/src/lib/utils.ts +1 -0
  25. package/src/patterns/app-shell.tsx +70 -0
  26. package/src/patterns/data-table.tsx +225 -0
  27. package/src/patterns/details-sheet.tsx +51 -0
  28. package/src/patterns/page-header.tsx +40 -0
  29. package/src/patterns/status-badge.tsx +23 -0
  30. package/src/styles.css +465 -0
  31. package/src/templates/admin-dashboard.tsx +63 -0
  32. package/src/templates/auth-layout.tsx +36 -0
  33. package/src/templates/login-form.tsx +97 -0
  34. package/src/templates/signup-form.tsx +137 -0
  35. package/src/vite-env.d.ts +1 -0
  36. package/base.css +0 -360
  37. package/bootstrap/AppProps.d.ts +0 -9
  38. package/bootstrap/AppProps.js +0 -1
  39. package/bootstrap/index.d.ts +0 -1
  40. package/bootstrap/index.js +0 -1
  41. package/bootstrap/modeScript.d.ts +0 -2
  42. package/bootstrap/modeScript.js +0 -35
  43. package/bootstrap/nprogress.d.ts +0 -1
  44. package/bootstrap/nprogress.js +0 -19
  45. package/bootstrap/scrolledScript.d.ts +0 -2
  46. package/bootstrap/scrolledScript.js +0 -27
  47. package/bootstrap/setupFocusManager.d.ts +0 -1
  48. package/bootstrap/setupFocusManager.js +0 -13
  49. package/bootstrap/suppressConsoleLog.d.ts +0 -1
  50. package/bootstrap/suppressConsoleLog.js +0 -8
  51. package/components/Accordion/Accordion.d.ts +0 -16
  52. package/components/Accordion/Accordion.jsx +0 -27
  53. package/components/Accordion/index.d.ts +0 -3
  54. package/components/Accordion/index.jsx +0 -3
  55. package/components/Alert/Alert.d.ts +0 -31
  56. package/components/Alert/Alert.jsx +0 -53
  57. package/components/Alert/index.d.ts +0 -3
  58. package/components/Alert/index.jsx +0 -3
  59. package/components/AntiClickjacking/AntiClickjacking.d.ts +0 -1
  60. package/components/AntiClickjacking/AntiClickjacking.jsx +0 -17
  61. package/components/AntiClickjacking/index.d.ts +0 -2
  62. package/components/AntiClickjacking/index.jsx +0 -2
  63. package/components/Aurora/Aurora.d.ts +0 -10
  64. package/components/Aurora/Aurora.jsx +0 -189
  65. package/components/Aurora/index.d.ts +0 -3
  66. package/components/Aurora/index.jsx +0 -3
  67. package/components/Autocomplete/Autocomplete.d.ts +0 -7
  68. package/components/Autocomplete/Autocomplete.jsx +0 -23
  69. package/components/Autocomplete/UnstyledAutocomplete.d.ts +0 -36
  70. package/components/Autocomplete/UnstyledAutocomplete.jsx +0 -72
  71. package/components/Autocomplete/index.d.ts +0 -5
  72. package/components/Autocomplete/index.jsx +0 -5
  73. package/components/BackgroundEffects/BottomBlurryPoint.d.ts +0 -3
  74. package/components/BackgroundEffects/BottomBlurryPoint.jsx +0 -14
  75. package/components/BackgroundEffects/TopBlurryPoint.d.ts +0 -3
  76. package/components/BackgroundEffects/TopBlurryPoint.jsx +0 -14
  77. package/components/Badge/Badge.d.ts +0 -42
  78. package/components/Badge/Badge.jsx +0 -51
  79. package/components/Badge/index.d.ts +0 -3
  80. package/components/Badge/index.jsx +0 -3
  81. package/components/Breadcrumbs/Breadcrumbs.d.ts +0 -20
  82. package/components/Breadcrumbs/Breadcrumbs.jsx +0 -42
  83. package/components/Breadcrumbs/index.d.ts +0 -3
  84. package/components/Breadcrumbs/index.jsx +0 -3
  85. package/components/Button/Button.d.ts +0 -111
  86. package/components/Button/Button.jsx +0 -129
  87. package/components/Button/UnstyledButton.d.ts +0 -10
  88. package/components/Button/UnstyledButton.jsx +0 -13
  89. package/components/Button/index.d.ts +0 -3
  90. package/components/Button/index.jsx +0 -3
  91. package/components/Carousel/Carousel.d.ts +0 -19
  92. package/components/Carousel/Carousel.jsx +0 -55
  93. package/components/Carousel/index.d.ts +0 -3
  94. package/components/Carousel/index.jsx +0 -3
  95. package/components/Checkbox/Checkbox.d.ts +0 -14
  96. package/components/Checkbox/Checkbox.jsx +0 -45
  97. package/components/Checkbox/index.d.ts +0 -3
  98. package/components/Checkbox/index.js +0 -3
  99. package/components/Code/Code.d.ts +0 -12
  100. package/components/Code/Code.jsx +0 -25
  101. package/components/Code/Json.d.ts +0 -5
  102. package/components/Code/Json.jsx +0 -7
  103. package/components/Code/index.d.ts +0 -4
  104. package/components/Code/index.jsx +0 -4
  105. package/components/ConfirmationButton/ConfirmationButton.d.ts +0 -17
  106. package/components/ConfirmationButton/ConfirmationButton.jsx +0 -13
  107. package/components/ConfirmationButton/index.d.ts +0 -3
  108. package/components/ConfirmationButton/index.jsx +0 -3
  109. package/components/ContextMenu/ContextMenu.d.ts +0 -28
  110. package/components/ContextMenu/ContextMenu.jsx +0 -70
  111. package/components/ContextMenu/index.d.ts +0 -3
  112. package/components/ContextMenu/index.jsx +0 -3
  113. package/components/CopyButton/CopyButton.d.ts +0 -7
  114. package/components/CopyButton/CopyButton.jsx +0 -29
  115. package/components/CopyButton/index.d.ts +0 -3
  116. package/components/CopyButton/index.jsx +0 -3
  117. package/components/DateInput/DateInput.d.ts +0 -6
  118. package/components/DateInput/DateInput.jsx +0 -19
  119. package/components/DateInput/DateTimeInput.d.ts +0 -3
  120. package/components/DateInput/DateTimeInput.jsx +0 -8
  121. package/components/DateInput/index.d.ts +0 -4
  122. package/components/DateInput/index.jsx +0 -4
  123. package/components/DateInput/useRefValue.d.ts +0 -5
  124. package/components/DateInput/useRefValue.js +0 -48
  125. package/components/DatePicker/DatePicker.d.ts +0 -19
  126. package/components/DatePicker/DatePicker.jsx +0 -55
  127. package/components/DatePicker/index.d.ts +0 -3
  128. package/components/DatePicker/index.jsx +0 -3
  129. package/components/DateRangePicker/DateRangePicker.d.ts +0 -16
  130. package/components/DateRangePicker/DateRangePicker.jsx +0 -56
  131. package/components/DateRangePicker/index.d.ts +0 -3
  132. package/components/DateRangePicker/index.jsx +0 -3
  133. package/components/Dialog/Dialog.d.ts +0 -25
  134. package/components/Dialog/Dialog.jsx +0 -35
  135. package/components/Dialog/Dialogs.d.ts +0 -1
  136. package/components/Dialog/Dialogs.jsx +0 -21
  137. package/components/Dialog/dialogs.state.d.ts +0 -21
  138. package/components/Dialog/dialogs.state.js +0 -40
  139. package/components/Dialog/index.d.ts +0 -6
  140. package/components/Dialog/index.jsx +0 -7
  141. package/components/Drawer/Drawer.d.ts +0 -15
  142. package/components/Drawer/Drawer.jsx +0 -72
  143. package/components/Drawer/index.d.ts +0 -3
  144. package/components/Drawer/index.jsx +0 -3
  145. package/components/DropdownMenu/DropdownMenu.d.ts +0 -33
  146. package/components/DropdownMenu/DropdownMenu.jsx +0 -74
  147. package/components/DropdownMenu/index.d.ts +0 -3
  148. package/components/DropdownMenu/index.jsx +0 -3
  149. package/components/ErrorBoundary/ErrorBoundary.d.ts +0 -18
  150. package/components/ErrorBoundary/ErrorBoundary.jsx +0 -32
  151. package/components/ErrorBoundary/index.d.ts +0 -3
  152. package/components/ErrorBoundary/index.jsx +0 -3
  153. package/components/ErrorPage/Error404Page.d.ts +0 -1
  154. package/components/ErrorPage/Error404Page.jsx +0 -4
  155. package/components/ErrorPage/Error500Page.d.ts +0 -1
  156. package/components/ErrorPage/Error500Page.jsx +0 -4
  157. package/components/ErrorPage/ErrorPage.d.ts +0 -11
  158. package/components/ErrorPage/ErrorPage.jsx +0 -23
  159. package/components/FileInput/FileInput.d.ts +0 -53
  160. package/components/FileInput/FileInput.jsx +0 -141
  161. package/components/FileInput/PreviewFile.d.ts +0 -18
  162. package/components/FileInput/PreviewFile.jsx +0 -54
  163. package/components/FileInput/index.d.ts +0 -3
  164. package/components/FileInput/index.jsx +0 -3
  165. package/components/FileInput/isImage.d.ts +0 -1
  166. package/components/FileInput/isImage.js +0 -10
  167. package/components/FileInput/isVideo.d.ts +0 -1
  168. package/components/FileInput/isVideo.js +0 -10
  169. package/components/FileSelect/FileSelect.d.ts +0 -31
  170. package/components/FileSelect/FileSelect.jsx +0 -146
  171. package/components/FileSelect/index.d.ts +0 -3
  172. package/components/FileSelect/index.jsx +0 -3
  173. package/components/Footer/Footer.d.ts +0 -19
  174. package/components/Footer/Footer.jsx +0 -30
  175. package/components/Footer/index.d.ts +0 -3
  176. package/components/Footer/index.jsx +0 -3
  177. package/components/GridPattern/GridPattern.d.ts +0 -2
  178. package/components/GridPattern/GridPattern.jsx +0 -12
  179. package/components/GridPattern/index.d.ts +0 -3
  180. package/components/GridPattern/index.jsx +0 -3
  181. package/components/Group/Group.d.ts +0 -5
  182. package/components/Group/Group.jsx +0 -6
  183. package/components/Group/index.d.ts +0 -3
  184. package/components/Group/index.jsx +0 -3
  185. package/components/Header/Header.d.ts +0 -5
  186. package/components/Header/Header.jsx +0 -19
  187. package/components/Header/index.d.ts +0 -3
  188. package/components/Header/index.jsx +0 -3
  189. package/components/ImageInput/ImageInput.d.ts +0 -4
  190. package/components/ImageInput/ImageInput.jsx +0 -8
  191. package/components/ImageInput/index.d.ts +0 -3
  192. package/components/ImageInput/index.jsx +0 -3
  193. package/components/Input/Input.d.ts +0 -14
  194. package/components/Input/Input.jsx +0 -57
  195. package/components/Input/InputIcon.d.ts +0 -9
  196. package/components/Input/InputIcon.jsx +0 -7
  197. package/components/Input/MultiSelectInput.d.ts +0 -16
  198. package/components/Input/MultiSelectInput.jsx +0 -48
  199. package/components/Input/NumericInput.d.ts +0 -6
  200. package/components/Input/NumericInput.jsx +0 -6
  201. package/components/Input/PatternInput.d.ts +0 -6
  202. package/components/Input/PatternInput.jsx +0 -6
  203. package/components/Input/SelectInput.d.ts +0 -12
  204. package/components/Input/SelectInput.jsx +0 -25
  205. package/components/Input/UnstyledInput.d.ts +0 -22
  206. package/components/Input/UnstyledInput.jsx +0 -28
  207. package/components/Input/index.d.ts +0 -6
  208. package/components/Input/index.jsx +0 -6
  209. package/components/Input/useInputRefValue.d.ts +0 -11
  210. package/components/Input/useInputRefValue.jsx +0 -51
  211. package/components/Input2/InputWrapper.d.ts +0 -11
  212. package/components/Input2/InputWrapper.jsx +0 -11
  213. package/components/Link/Link.d.ts +0 -3
  214. package/components/Link/Link.jsx +0 -9
  215. package/components/Link/index.d.ts +0 -3
  216. package/components/Link/index.jsx +0 -3
  217. package/components/Loading/Loading.d.ts +0 -5
  218. package/components/Loading/Loading.jsx +0 -15
  219. package/components/Loading/index.d.ts +0 -3
  220. package/components/Loading/index.jsx +0 -3
  221. package/components/Magnet/Magnet.d.ts +0 -13
  222. package/components/Magnet/Magnet.jsx +0 -50
  223. package/components/Magnet/index.d.ts +0 -3
  224. package/components/Magnet/index.jsx +0 -3
  225. package/components/Markdown/Markdown.d.ts +0 -8
  226. package/components/Markdown/Markdown.jsx +0 -11
  227. package/components/Markdown/index.d.ts +0 -3
  228. package/components/Markdown/index.jsx +0 -3
  229. package/components/Menu/Menu.d.ts +0 -28
  230. package/components/Menu/Menu.jsx +0 -54
  231. package/components/Modal/Modal.d.ts +0 -45
  232. package/components/Modal/Modal.jsx +0 -65
  233. package/components/Modal/index.d.ts +0 -4
  234. package/components/Modal/index.jsx +0 -4
  235. package/components/Modal/useModalState.d.ts +0 -6
  236. package/components/Modal/useModalState.js +0 -16
  237. package/components/ModeToggle/ModeToggle.d.ts +0 -9
  238. package/components/ModeToggle/ModeToggle.jsx +0 -12
  239. package/components/ModeToggle/index.d.ts +0 -4
  240. package/components/ModeToggle/index.jsx +0 -5
  241. package/components/ModeToggle/useModeToggle.d.ts +0 -1
  242. package/components/ModeToggle/useModeToggle.js +0 -21
  243. package/components/MultiSelect/MultiSelect.d.ts +0 -28
  244. package/components/MultiSelect/MultiSelect.jsx +0 -116
  245. package/components/MultiSelect/MultiSelectInput.d.ts +0 -12
  246. package/components/MultiSelect/MultiSelectInput.jsx +0 -27
  247. package/components/MultiSelect/index.d.ts +0 -5
  248. package/components/MultiSelect/index.jsx +0 -5
  249. package/components/MultiText/MultiText.d.ts +0 -23
  250. package/components/MultiText/MultiText.jsx +0 -118
  251. package/components/MultiText/index.d.ts +0 -3
  252. package/components/MultiText/index.jsx +0 -3
  253. package/components/NavigationDrawer/NavigationDrawer.d.ts +0 -9
  254. package/components/NavigationDrawer/NavigationDrawer.jsx +0 -29
  255. package/components/NavigationDrawer/NavigationItem.d.ts +0 -13
  256. package/components/NavigationDrawer/NavigationItem.jsx +0 -24
  257. package/components/NavigationDrawer/index.d.ts +0 -6
  258. package/components/NavigationDrawer/index.jsx +0 -6
  259. package/components/NavigationDrawer/navigationDrawer.state.d.ts +0 -9
  260. package/components/NavigationDrawer/navigationDrawer.state.js +0 -19
  261. package/components/NoSsr/NoSsr.d.ts +0 -4
  262. package/components/NoSsr/NoSsr.jsx +0 -8
  263. package/components/NoSsr/index.d.ts +0 -3
  264. package/components/NoSsr/index.jsx +0 -3
  265. package/components/Noise/Noise.d.ts +0 -11
  266. package/components/Noise/Noise.jsx +0 -69
  267. package/components/Noise/index.d.ts +0 -3
  268. package/components/Noise/index.jsx +0 -3
  269. package/components/Notifications/Notifications.d.ts +0 -3
  270. package/components/Notifications/Notifications.jsx +0 -60
  271. package/components/Notifications/index.d.ts +0 -5
  272. package/components/Notifications/index.jsx +0 -6
  273. package/components/Notifications/notifications.state.d.ts +0 -24
  274. package/components/Notifications/notifications.state.js +0 -41
  275. package/components/Orb/Orb.d.ts +0 -8
  276. package/components/Orb/Orb.jsx +0 -258
  277. package/components/Orb/index.d.ts +0 -3
  278. package/components/Orb/index.jsx +0 -3
  279. package/components/Pagination/Pagination.d.ts +0 -13
  280. package/components/Pagination/Pagination.jsx +0 -64
  281. package/components/Pagination/index.d.ts +0 -3
  282. package/components/Pagination/index.jsx +0 -3
  283. package/components/Particles/Particles.d.ts +0 -18
  284. package/components/Particles/Particles.jsx +0 -205
  285. package/components/Particles/index.d.ts +0 -3
  286. package/components/Particles/index.jsx +0 -3
  287. package/components/PictureCropInput/PictureCropInput.d.ts +0 -20
  288. package/components/PictureCropInput/PictureCropInput.jsx +0 -174
  289. package/components/PictureCropInput/canvasPreview.d.ts +0 -2
  290. package/components/PictureCropInput/canvasPreview.js +0 -37
  291. package/components/PictureCropInput/index.d.ts +0 -3
  292. package/components/PictureCropInput/index.js +0 -3
  293. package/components/Popover/Popover.d.ts +0 -13
  294. package/components/Popover/Popover.jsx +0 -22
  295. package/components/Popover/index.d.ts +0 -3
  296. package/components/Popover/index.jsx +0 -3
  297. package/components/Resizable/Resizable.d.ts +0 -12
  298. package/components/Resizable/Resizable.jsx +0 -54
  299. package/components/Resizable/index.d.ts +0 -3
  300. package/components/Resizable/index.jsx +0 -3
  301. package/components/ScrollArea/ScrollArea.d.ts +0 -9
  302. package/components/ScrollArea/ScrollArea.jsx +0 -16
  303. package/components/ScrollArea/index.d.ts +0 -3
  304. package/components/ScrollArea/index.jsx +0 -3
  305. package/components/Select/Select.d.ts +0 -25
  306. package/components/Select/Select.jsx +0 -55
  307. package/components/Select/index.d.ts +0 -3
  308. package/components/Select/index.jsx +0 -3
  309. package/components/Skeleton/Skeleton.d.ts +0 -2
  310. package/components/Skeleton/Skeleton.jsx +0 -8
  311. package/components/Skeleton/index.d.ts +0 -3
  312. package/components/Skeleton/index.jsx +0 -3
  313. package/components/Slider/Slider.d.ts +0 -10
  314. package/components/Slider/Slider.jsx +0 -21
  315. package/components/Slider/index.d.ts +0 -3
  316. package/components/Slider/index.jsx +0 -3
  317. package/components/Spotlight/Spotlight.d.ts +0 -30
  318. package/components/Spotlight/Spotlight.jsx +0 -86
  319. package/components/Spotlight/index.d.ts +0 -3
  320. package/components/Spotlight/index.jsx +0 -3
  321. package/components/SpotlightCard/SpotlightCard.d.ts +0 -7
  322. package/components/SpotlightCard/SpotlightCard.jsx +0 -35
  323. package/components/SpotlightCard/index.d.ts +0 -3
  324. package/components/SpotlightCard/index.jsx +0 -3
  325. package/components/Stack/Stack.d.ts +0 -4
  326. package/components/Stack/Stack.jsx +0 -5
  327. package/components/Stack/index.d.ts +0 -3
  328. package/components/Stack/index.jsx +0 -3
  329. package/components/StarBorder/StarBorder.d.ts +0 -10
  330. package/components/StarBorder/StarBorder.jsx +0 -19
  331. package/components/StarBorder/index.d.ts +0 -3
  332. package/components/StarBorder/index.jsx +0 -3
  333. package/components/Switch/Switch.d.ts +0 -16
  334. package/components/Switch/Switch.jsx +0 -24
  335. package/components/Switch/index.d.ts +0 -3
  336. package/components/Switch/index.jsx +0 -3
  337. package/components/Table/DataTable.d.ts +0 -57
  338. package/components/Table/DataTable.jsx +0 -155
  339. package/components/Table/Table.d.ts +0 -27
  340. package/components/Table/Table.jsx +0 -31
  341. package/components/Table/TableActionButton.d.ts +0 -6
  342. package/components/Table/TableActionButton.jsx +0 -20
  343. package/components/Table/TableBody.d.ts +0 -6
  344. package/components/Table/TableBody.jsx +0 -10
  345. package/components/Table/TableCell.d.ts +0 -9
  346. package/components/Table/TableCell.jsx +0 -18
  347. package/components/Table/TableFooter.d.ts +0 -5
  348. package/components/Table/TableFooter.jsx +0 -5
  349. package/components/Table/TableFooterWithPagination.d.ts +0 -13
  350. package/components/Table/TableFooterWithPagination.jsx +0 -57
  351. package/components/Table/TableHead.d.ts +0 -5
  352. package/components/Table/TableHead.jsx +0 -9
  353. package/components/Table/TableHeadContext.d.ts +0 -4
  354. package/components/Table/TableHeadContext.jsx +0 -3
  355. package/components/Table/TableHeader.d.ts +0 -7
  356. package/components/Table/TableHeader.jsx +0 -15
  357. package/components/Table/TableRow.d.ts +0 -8
  358. package/components/Table/TableRow.jsx +0 -9
  359. package/components/Table/index.d.ts +0 -3
  360. package/components/Table/index.jsx +0 -3
  361. package/components/Tabs/Tabs.d.ts +0 -9
  362. package/components/Tabs/Tabs.jsx +0 -13
  363. package/components/Tabs/index.d.ts +0 -3
  364. package/components/Tabs/index.jsx +0 -3
  365. package/components/TabsSwitcher/Tab.d.ts +0 -15
  366. package/components/TabsSwitcher/Tab.jsx +0 -18
  367. package/components/TabsSwitcher/TabsSwitcher.d.ts +0 -22
  368. package/components/TabsSwitcher/TabsSwitcher.jsx +0 -31
  369. package/components/TabsSwitcher/index.d.ts +0 -4
  370. package/components/TabsSwitcher/index.jsx +0 -4
  371. package/components/Text/Text.d.ts +0 -24
  372. package/components/Text/Text.jsx +0 -29
  373. package/components/Text/index.d.ts +0 -3
  374. package/components/Text/index.jsx +0 -3
  375. package/components/Textarea/Textarea.d.ts +0 -5
  376. package/components/Textarea/Textarea.jsx +0 -6
  377. package/components/Textarea/index.d.ts +0 -3
  378. package/components/Textarea/index.js +0 -3
  379. package/components/Threads/Threads.d.ts +0 -9
  380. package/components/Threads/Threads.jsx +0 -203
  381. package/components/Threads/index.d.ts +0 -3
  382. package/components/Threads/index.jsx +0 -3
  383. package/components/Tooltip/Tooltip.d.ts +0 -11
  384. package/components/Tooltip/Tooltip.jsx +0 -21
  385. package/components/Tooltip/index.d.ts +0 -3
  386. package/components/Tooltip/index.jsx +0 -3
  387. package/components/VisibilityActivatedButton/VisibilityActivatedButton.d.ts +0 -7
  388. package/components/VisibilityActivatedButton/VisibilityActivatedButton.jsx +0 -18
  389. package/components/VisibilityActivatedButton/index.d.ts +0 -3
  390. package/components/VisibilityActivatedButton/index.jsx +0 -3
  391. package/form.d.ts +0 -82
  392. package/form.js +0 -113
  393. package/form2.d.ts +0 -15
  394. package/form2.jsx +0 -30
  395. package/hooks/useBeforeUnload.d.ts +0 -1
  396. package/hooks/useBeforeUnload.js +0 -17
  397. package/hooks/useDebounceEffect.d.ts +0 -2
  398. package/hooks/useDebounceEffect.js +0 -14
  399. package/hooks/useDebouncedValue.d.ts +0 -2
  400. package/hooks/useDebouncedValue.js +0 -14
  401. package/hooks/useLagRadar.d.ts +0 -1
  402. package/hooks/useLagRadar.jsx +0 -124
  403. package/hooks/useMediaQuery.d.ts +0 -1
  404. package/hooks/useMediaQuery.js +0 -37
  405. package/hooks/useMutationWindowCloseProtection.d.ts +0 -2
  406. package/hooks/useMutationWindowCloseProtection.js +0 -13
  407. package/hooks/useScroll.d.ts +0 -3
  408. package/hooks/useScroll.js +0 -47
  409. package/hooks/useTranslation.d.ts +0 -4
  410. package/hooks/useTranslation.js +0 -11
  411. package/hooks/useWhyDidYouUpdate.d.ts +0 -3
  412. package/hooks/useWhyDidYouUpdate.js +0 -44
  413. package/imgur.d.ts +0 -1
  414. package/imgur.js +0 -13
  415. package/styles/DayPicker.classNames.d.ts +0 -29
  416. package/styles/DayPicker.classNames.js +0 -30
  417. package/styles/DayPicker.classNames.ts +0 -81
  418. package/styles/Dropdown.classNames.d.ts +0 -6
  419. package/styles/Dropdown.classNames.js +0 -7
  420. package/styles/Dropdown.classNames.ts +0 -38
  421. package/styles/Input.css +0 -23
  422. package/styles/Modal.classNames.d.ts +0 -2
  423. package/styles/Modal.classNames.js +0 -3
  424. package/styles/Modal.classNames.ts +0 -15
  425. package/styles/MultiText.css +0 -40
  426. package/styles/Pagination.css +0 -19
  427. package/styles/Tabs.css +0 -23
  428. package/tsconfig.tsbuildinfo +0 -1
  429. package/types.d.ts +0 -6
  430. package/types.js +0 -1
  431. package/utils/UseState.d.ts +0 -2
  432. package/utils/UseState.js +0 -1
  433. package/utils/blobToText.d.ts +0 -1
  434. package/utils/blobToText.js +0 -13
  435. package/utils/capitalize.d.ts +0 -1
  436. package/utils/capitalize.js +0 -6
  437. package/utils/clsx.d.ts +0 -2
  438. package/utils/clsx.js +0 -5
  439. package/utils/copy2DToClipboard.d.ts +0 -1
  440. package/utils/copy2DToClipboard.js +0 -44
  441. package/utils/cpfCpnjUtils.d.ts +0 -3
  442. package/utils/cpfCpnjUtils.js +0 -43
  443. package/utils/createLocalStorageStateHydration.d.ts +0 -1
  444. package/utils/createLocalStorageStateHydration.js +0 -18
  445. package/utils/createStateHydration.d.ts +0 -3
  446. package/utils/createStateHydration.js +0 -49
  447. package/utils/csvBlobToJson.d.ts +0 -2
  448. package/utils/csvBlobToJson.js +0 -59
  449. package/utils/downloadArrayAsCSV.d.ts +0 -1
  450. package/utils/downloadArrayAsCSV.js +0 -34
  451. package/utils/emailRegExp.d.ts +0 -2
  452. package/utils/emailRegExp.js +0 -2
  453. package/utils/fakeArray.d.ts +0 -1
  454. package/utils/fakeArray.js +0 -3
  455. package/utils/filterBoolean.d.ts +0 -1
  456. package/utils/filterBoolean.js +0 -3
  457. package/utils/formatClock.d.ts +0 -1
  458. package/utils/formatClock.js +0 -21
  459. package/utils/getInitials.d.ts +0 -4
  460. package/utils/getInitials.js +0 -22
  461. package/utils/isBrowser.d.ts +0 -12
  462. package/utils/isBrowser.js +0 -26
  463. package/utils/ms.d.ts +0 -6
  464. package/utils/ms.js +0 -31
  465. package/utils/preventDefault.d.ts +0 -2
  466. package/utils/preventDefault.js +0 -3
  467. package/utils/recursiveChildrenMap.d.ts +0 -2
  468. package/utils/recursiveChildrenMap.js +0 -16
  469. package/utils/setSelectionRange.d.ts +0 -1
  470. package/utils/setSelectionRange.js +0 -55
  471. package/utils/smoothScrollToHref.d.ts +0 -2
  472. package/utils/smoothScrollToHref.js +0 -14
  473. package/utils/stopPropagation.d.ts +0 -2
  474. package/utils/stopPropagation.js +0 -3
  475. package/utils/stripHtml.d.ts +0 -1
  476. package/utils/stripHtml.js +0 -4
  477. package/utils/stripLineBreak.d.ts +0 -1
  478. package/utils/stripLineBreak.js +0 -4
  479. package/utils/stripMarkdown.d.ts +0 -1
  480. package/utils/stripMarkdown.js +0 -28
  481. package/utils/xlsxBlobToJson.d.ts +0 -2
  482. package/utils/xlsxBlobToJson.js +0 -62
@@ -1,6 +0,0 @@
1
- import Notifications from "./Notifications";
2
- export * from "./Notifications";
3
- export default Notifications;
4
- // noinspection JSUnusedGlobalSymbols
5
- export { default as notificationsState } from "./notifications.state";
6
- export * from "./notifications.state";
@@ -1,24 +0,0 @@
1
- import { type StringValue } from "ms";
2
- import type { CSSProperties, ReactElement, ReactNode } from "react";
3
- type Notification = {
4
- _id: string;
5
- message: string | ReactElement;
6
- title?: string;
7
- timeout?: number | StringValue;
8
- icon?: "success" | "error" | ReactElement;
9
- dismissable?: boolean;
10
- actions?: ReactNode;
11
- suppress?: boolean;
12
- style?: CSSProperties;
13
- className?: string;
14
- };
15
- declare const notificationsState: {
16
- rendered: boolean;
17
- setRendered(rendered: boolean): void;
18
- notifications: Notification[];
19
- add({ _id, dismissable, timeout, ...notification }: Pick<Partial<Notification>, "_id"> & Omit<Notification, "_id">): void;
20
- remove(_id: string): void;
21
- };
22
- export declare function showNotification(notification: string | (Pick<Partial<Notification>, "_id"> & Omit<Notification, "_id">)): void;
23
- export declare function removeNotification(_id: string): void;
24
- export default notificationsState;
@@ -1,41 +0,0 @@
1
- import { proxy, ref } from "valtio";
2
- import isomorphicObjectId from "@majapisoftwares/next/utils/isomorphicObjectId";
3
- import ms, {} from "ms";
4
- const notificationsState = proxy({
5
- rendered: false,
6
- setRendered(rendered) {
7
- notificationsState.rendered = rendered;
8
- },
9
- notifications: [],
10
- add({ _id = isomorphicObjectId().toString(), dismissable = true, timeout, ...notification }) {
11
- if (!notificationsState.rendered) {
12
- console.error("<Notifications /> is not rendered. The notification will be ignored.");
13
- }
14
- notificationsState.notifications.push(ref({
15
- ...notification,
16
- dismissable,
17
- _id,
18
- }));
19
- if (timeout) {
20
- setTimeout(() => {
21
- notificationsState.remove(_id);
22
- }, typeof timeout !== "number" ? ms(timeout) : timeout);
23
- }
24
- },
25
- remove(_id) {
26
- notificationsState.notifications.splice(notificationsState.notifications.findIndex((n) => n._id === _id), 1);
27
- },
28
- });
29
- export function showNotification(notification) {
30
- const notificationObject = typeof notification === "string" ? { message: notification } : notification;
31
- if (notificationObject.suppress &&
32
- notificationsState.notifications.find((n) => n.message === notificationObject.message &&
33
- n.title === notificationObject.title)) {
34
- return;
35
- }
36
- notificationsState.add(notificationObject);
37
- }
38
- export function removeNotification(_id) {
39
- notificationsState.remove(_id);
40
- }
41
- export default notificationsState;
@@ -1,8 +0,0 @@
1
- interface OrbProps {
2
- hue?: number;
3
- hoverIntensity?: number;
4
- rotateOnHover?: boolean;
5
- forceHoverState?: boolean;
6
- }
7
- export default function Orb({ hue, hoverIntensity, rotateOnHover, forceHoverState, }: OrbProps): import("react").JSX.Element;
8
- export {};
@@ -1,258 +0,0 @@
1
- import { useEffect, useRef } from "react";
2
- import { Mesh, Program, Renderer, Triangle, Vec3 } from "ogl";
3
- export default function Orb({ hue = 0, hoverIntensity = 0.2, rotateOnHover = true, forceHoverState = false, }) {
4
- const ctnDom = useRef(null);
5
- const vert = /* glsl */ `
6
- precision highp float;
7
- attribute vec2 position;
8
- attribute vec2 uv;
9
- varying vec2 vUv;
10
- void main() {
11
- vUv = uv;
12
- gl_Position = vec4(position, 0.0, 1.0);
13
- }
14
- `;
15
- const frag = /* glsl */ `
16
- precision highp float;
17
-
18
- uniform float iTime;
19
- uniform vec3 iResolution;
20
- uniform float hue;
21
- uniform float hover;
22
- uniform float rot;
23
- uniform float hoverIntensity;
24
- varying vec2 vUv;
25
-
26
- vec3 rgb2yiq(vec3 c) {
27
- float y = dot(c, vec3(0.299, 0.587, 0.114));
28
- float i = dot(c, vec3(0.596, -0.274, -0.322));
29
- float q = dot(c, vec3(0.211, -0.523, 0.312));
30
- return vec3(y, i, q);
31
- }
32
-
33
- vec3 yiq2rgb(vec3 c) {
34
- float r = c.x + 0.956 * c.y + 0.621 * c.z;
35
- float g = c.x - 0.272 * c.y - 0.647 * c.z;
36
- float b = c.x - 1.106 * c.y + 1.703 * c.z;
37
- return vec3(r, g, b);
38
- }
39
-
40
- vec3 adjustHue(vec3 color, float hueDeg) {
41
- float hueRad = hueDeg * 3.14159265 / 180.0;
42
- vec3 yiq = rgb2yiq(color);
43
- float cosA = cos(hueRad);
44
- float sinA = sin(hueRad);
45
- float i = yiq.y * cosA - yiq.z * sinA;
46
- float q = yiq.y * sinA + yiq.z * cosA;
47
- yiq.y = i;
48
- yiq.z = q;
49
- return yiq2rgb(yiq);
50
- }
51
-
52
- vec3 hash33(vec3 p3) {
53
- p3 = fract(p3 * vec3(0.1031, 0.11369, 0.13787));
54
- p3 += dot(p3, p3.yxz + 19.19);
55
- return -1.0 + 2.0 * fract(vec3(
56
- p3.x + p3.y,
57
- p3.x + p3.z,
58
- p3.y + p3.z
59
- ) * p3.zyx);
60
- }
61
-
62
- float snoise3(vec3 p) {
63
- const float K1 = 0.333333333;
64
- const float K2 = 0.166666667;
65
- vec3 i = floor(p + (p.x + p.y + p.z) * K1);
66
- vec3 d0 = p - (i - (i.x + i.y + i.z) * K2);
67
- vec3 e = step(vec3(0.0), d0 - d0.yzx);
68
- vec3 i1 = e * (1.0 - e.zxy);
69
- vec3 i2 = 1.0 - e.zxy * (1.0 - e);
70
- vec3 d1 = d0 - (i1 - K2);
71
- vec3 d2 = d0 - (i2 - K1);
72
- vec3 d3 = d0 - 0.5;
73
- vec4 h = max(0.6 - vec4(
74
- dot(d0, d0),
75
- dot(d1, d1),
76
- dot(d2, d2),
77
- dot(d3, d3)
78
- ), 0.0);
79
- vec4 n = h * h * h * h * vec4(
80
- dot(d0, hash33(i)),
81
- dot(d1, hash33(i + i1)),
82
- dot(d2, hash33(i + i2)),
83
- dot(d3, hash33(i + 1.0))
84
- );
85
- return dot(vec4(31.316), n);
86
- }
87
-
88
- vec4 extractAlpha(vec3 colorIn) {
89
- float a = max(max(colorIn.r, colorIn.g), colorIn.b);
90
- return vec4(colorIn.rgb / (a + 1e-5), a);
91
- }
92
-
93
- const vec3 baseColor1 = vec3(0.611765, 0.262745, 0.996078);
94
- const vec3 baseColor2 = vec3(0.298039, 0.760784, 0.913725);
95
- const vec3 baseColor3 = vec3(0.062745, 0.078431, 0.600000);
96
- const float innerRadius = 0.6;
97
- const float noiseScale = 0.65;
98
-
99
- float light1(float intensity, float attenuation, float dist) {
100
- return intensity / (1.0 + dist * attenuation);
101
- }
102
-
103
- float light2(float intensity, float attenuation, float dist) {
104
- return intensity / (1.0 + dist * dist * attenuation);
105
- }
106
-
107
- vec4 draw(vec2 uv) {
108
- vec3 color1 = adjustHue(baseColor1, hue);
109
- vec3 color2 = adjustHue(baseColor2, hue);
110
- vec3 color3 = adjustHue(baseColor3, hue);
111
-
112
- float ang = atan(uv.y, uv.x);
113
- float len = length(uv);
114
- float invLen = len > 0.0 ? 1.0 / len : 0.0;
115
-
116
- float n0 = snoise3(vec3(uv * noiseScale, iTime * 0.5)) * 0.5 + 0.5;
117
- float r0 = mix(mix(innerRadius, 1.0, 0.4), mix(innerRadius, 1.0, 0.6), n0);
118
- float d0 = distance(uv, (r0 * invLen) * uv);
119
- float v0 = light1(1.0, 10.0, d0);
120
- v0 *= smoothstep(r0 * 1.05, r0, len);
121
- float cl = cos(ang + iTime * 2.0) * 0.5 + 0.5;
122
-
123
- float a = iTime * -1.0;
124
- vec2 pos = vec2(cos(a), sin(a)) * r0;
125
- float d = distance(uv, pos);
126
- float v1 = light2(1.5, 5.0, d);
127
- v1 *= light1(1.0, 50.0, d0);
128
-
129
- float v2 = smoothstep(1.0, mix(innerRadius, 1.0, n0 * 0.5), len);
130
- float v3 = smoothstep(innerRadius, mix(innerRadius, 1.0, 0.5), len);
131
-
132
- vec3 col = mix(color1, color2, cl);
133
- col = mix(color3, col, v0);
134
- col = (col + v1) * v2 * v3;
135
- col = clamp(col, 0.0, 1.0);
136
-
137
- return extractAlpha(col);
138
- }
139
-
140
- vec4 mainImage(vec2 fragCoord) {
141
- vec2 center = iResolution.xy * 0.5;
142
- float size = min(iResolution.x, iResolution.y);
143
- vec2 uv = (fragCoord - center) / size * 2.0;
144
-
145
- float angle = rot;
146
- float s = sin(angle);
147
- float c = cos(angle);
148
- uv = vec2(c * uv.x - s * uv.y, s * uv.x + c * uv.y);
149
-
150
- uv.x += hover * hoverIntensity * 0.1 * sin(uv.y * 10.0 + iTime);
151
- uv.y += hover * hoverIntensity * 0.1 * sin(uv.x * 10.0 + iTime);
152
-
153
- return draw(uv);
154
- }
155
-
156
- void main() {
157
- vec2 fragCoord = vUv * iResolution.xy;
158
- vec4 col = mainImage(fragCoord);
159
- gl_FragColor = vec4(col.rgb * col.a, col.a);
160
- }
161
- `;
162
- useEffect(() => {
163
- const container = ctnDom.current;
164
- if (!container)
165
- return;
166
- const renderer = new Renderer({ alpha: true, premultipliedAlpha: false });
167
- const gl = renderer.gl;
168
- gl.clearColor(0, 0, 0, 0);
169
- container.appendChild(gl.canvas);
170
- const geometry = new Triangle(gl);
171
- const program = new Program(gl, {
172
- vertex: vert,
173
- fragment: frag,
174
- uniforms: {
175
- iTime: { value: 0 },
176
- iResolution: {
177
- value: new Vec3(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height),
178
- },
179
- hue: { value: hue },
180
- hover: { value: 0 },
181
- rot: { value: 0 },
182
- hoverIntensity: { value: hoverIntensity },
183
- },
184
- });
185
- const mesh = new Mesh(gl, { geometry, program });
186
- function resize() {
187
- if (!container)
188
- return;
189
- const dpr = window.devicePixelRatio || 1;
190
- const width = container.clientWidth;
191
- const height = container.clientHeight;
192
- renderer.setSize(width * dpr, height * dpr);
193
- gl.canvas.style.width = width + "px";
194
- gl.canvas.style.height = height + "px";
195
- program.uniforms.iResolution.value.set(gl.canvas.width, gl.canvas.height, gl.canvas.width / gl.canvas.height);
196
- }
197
- window.addEventListener("resize", resize);
198
- resize();
199
- let targetHover = 0;
200
- let lastTime = 0;
201
- let currentRot = 0;
202
- const rotationSpeed = 0.3; // radians per second
203
- const handleMouseMove = (e) => {
204
- const rect = container.getBoundingClientRect();
205
- const x = e.clientX - rect.left;
206
- const y = e.clientY - rect.top;
207
- const width = rect.width;
208
- const height = rect.height;
209
- const size = Math.min(width, height);
210
- const centerX = width / 2;
211
- const centerY = height / 2;
212
- const uvX = ((x - centerX) / size) * 2.0;
213
- const uvY = ((y - centerY) / size) * 2.0;
214
- if (Math.sqrt(uvX * uvX + uvY * uvY) < 0.8) {
215
- targetHover = 1;
216
- }
217
- else {
218
- targetHover = 0;
219
- }
220
- };
221
- const handleMouseLeave = () => {
222
- targetHover = 0;
223
- };
224
- if (hoverIntensity) {
225
- container.addEventListener("mousemove", handleMouseMove);
226
- container.addEventListener("mouseleave", handleMouseLeave);
227
- }
228
- let rafId;
229
- const update = (t) => {
230
- rafId = requestAnimationFrame(update);
231
- const dt = (t - lastTime) * 0.001;
232
- lastTime = t;
233
- program.uniforms.iTime.value = t * 0.001;
234
- program.uniforms.hue.value = hue;
235
- program.uniforms.hoverIntensity.value = hoverIntensity;
236
- const effectiveHover = forceHoverState ? 1 : targetHover;
237
- program.uniforms.hover.value +=
238
- (effectiveHover - program.uniforms.hover.value) * 0.1;
239
- if (rotateOnHover && effectiveHover > 0.5) {
240
- currentRot += dt * rotationSpeed;
241
- }
242
- program.uniforms.rot.value = currentRot;
243
- renderer.render({ scene: mesh });
244
- };
245
- rafId = requestAnimationFrame(update);
246
- return () => {
247
- cancelAnimationFrame(rafId);
248
- window.removeEventListener("resize", resize);
249
- if (hoverIntensity) {
250
- container.removeEventListener("mousemove", handleMouseMove);
251
- container.removeEventListener("mouseleave", handleMouseLeave);
252
- }
253
- container.removeChild(gl.canvas);
254
- gl.getExtension("WEBGL_lose_context")?.loseContext();
255
- };
256
- }, [hue, hoverIntensity, rotateOnHover, forceHoverState, vert, frag]);
257
- return <div ref={ctnDom} className="h-full w-full"/>;
258
- }
@@ -1,3 +0,0 @@
1
- import Orb from "./Orb";
2
- export * from "./Orb";
3
- export default Orb;
@@ -1,3 +0,0 @@
1
- import Orb from "./Orb";
2
- export * from "./Orb";
3
- export default Orb;
@@ -1,13 +0,0 @@
1
- export interface PaginationProps {
2
- totalItems?: number;
3
- itemsPerPage?: number;
4
- currentPage: number;
5
- onChangePage?: (page: number) => void;
6
- className?: string;
7
- pageHref?: (page: number) => string;
8
- paginationText?: string;
9
- previousText?: string;
10
- nextText?: string;
11
- pagesToClickAmount?: number;
12
- }
13
- export default function Pagination({ totalItems, itemsPerPage, currentPage, onChangePage, className, pageHref, paginationText, previousText, nextText, pagesToClickAmount, }: PaginationProps): import("react").JSX.Element;
@@ -1,64 +0,0 @@
1
- import { ChevronLeftIcon, ChevronRightIcon } from "@heroicons/react/20/solid";
2
- import { useCallback, useEffect, useMemo, useState, } from "react";
3
- import clsx from "../../utils/clsx";
4
- import { range } from "lodash-es";
5
- import UnstyledButton from "../Button/UnstyledButton";
6
- export default function Pagination({ totalItems, itemsPerPage, currentPage, onChangePage, className, pageHref, paginationText = "Pagination", previousText = "Previous", nextText = "Next", pagesToClickAmount = 7, }) {
7
- const [page, setPage] = useState(currentPage);
8
- useEffect(() => {
9
- if (page !== currentPage) {
10
- setPage(currentPage);
11
- }
12
- // eslint-disable-next-line react-hooks/exhaustive-deps
13
- }, [currentPage]);
14
- useEffect(() => {
15
- if (onChangePage) {
16
- onChangePage(page);
17
- }
18
- // eslint-disable-next-line react-hooks/exhaustive-deps
19
- }, [page]);
20
- const [previousTotalItems, setPreviousTotalItems] = useState(totalItems || 0);
21
- useEffect(() => {
22
- if (totalItems !== undefined) {
23
- setPreviousTotalItems(totalItems);
24
- }
25
- }, [totalItems]);
26
- const pageCount = itemsPerPage !== undefined
27
- ? Math.ceil(previousTotalItems / itemsPerPage) || 1
28
- : 0;
29
- const pages = useMemo(() => {
30
- if (pageCount < pagesToClickAmount) {
31
- return range(1, pageCount + 1);
32
- }
33
- if (page < pagesToClickAmount - 2) {
34
- return [...range(1, pagesToClickAmount - 1), "...1", pageCount];
35
- }
36
- if (page > pageCount - (pagesToClickAmount - 3)) {
37
- return [
38
- 1,
39
- "...1",
40
- ...range(pageCount - (pagesToClickAmount - 3), pageCount + 1),
41
- ];
42
- }
43
- return [1, "...1", page - 1, page, page + 1, "...2", pageCount];
44
- }, [page, pageCount, pagesToClickAmount]);
45
- const handlePageClick = useCallback((page) => (e) => {
46
- e.preventDefault();
47
- setPage(page);
48
- }, []);
49
- return (<nav className={clsx("ui-pagination", className)} aria-label={paginationText}>
50
- <UnstyledButton disabled={page === 1} onClick={handlePageClick(page - 1)} href={page !== 1 && pageHref ? pageHref(page - 1) : undefined}>
51
- <span className="sr-only">{previousText}</span>
52
- <ChevronLeftIcon className="h-5 w-5" aria-hidden="true"/>
53
- </UnstyledButton>
54
- {pages.map((p) => typeof p === "number" ? (<UnstyledButton key={p} onClick={handlePageClick(p)} data-active={page === p ? "" : undefined} href={pageHref ? pageHref(p) : undefined}>
55
- {p}
56
- </UnstyledButton>) : (<button key={p} disabled>
57
- ...
58
- </button>))}
59
- <UnstyledButton disabled={page === pageCount} onClick={handlePageClick(page + 1)} href={page !== pageCount && pageHref ? pageHref(page + 1) : undefined}>
60
- <span className="sr-only">{nextText}</span>
61
- <ChevronRightIcon className="h-5 w-5" aria-hidden="true"/>
62
- </UnstyledButton>
63
- </nav>);
64
- }
@@ -1,3 +0,0 @@
1
- import Pagination from "./Pagination";
2
- export * from "./Pagination";
3
- export default Pagination;
@@ -1,3 +0,0 @@
1
- import Pagination from "./Pagination";
2
- export * from "./Pagination";
3
- export default Pagination;
@@ -1,18 +0,0 @@
1
- import React from "react";
2
- interface ParticlesProps {
3
- particleCount?: number;
4
- particleSpread?: number;
5
- speed?: number;
6
- particleColors?: string[];
7
- moveParticlesOnHover?: boolean;
8
- particleHoverFactor?: number;
9
- alphaParticles?: boolean;
10
- particleBaseSize?: number;
11
- sizeRandomness?: number;
12
- cameraDistance?: number;
13
- disableRotation?: boolean;
14
- className?: string;
15
- useWindowMouseMove?: boolean;
16
- }
17
- declare const Particles: React.FC<ParticlesProps>;
18
- export default Particles;
@@ -1,205 +0,0 @@
1
- import React, { useEffect, useRef } from "react";
2
- import { Camera, Geometry, Mesh, Program, Renderer } from "ogl";
3
- const defaultColors = ["#ffffff", "#ffffff", "#ffffff"];
4
- const hexToRgb = (hex) => {
5
- hex = hex.replace(/^#/, "");
6
- if (hex.length === 3) {
7
- hex = hex
8
- .split("")
9
- .map((c) => c + c)
10
- .join("");
11
- }
12
- const int = parseInt(hex, 16);
13
- const r = ((int >> 16) & 255) / 255;
14
- const g = ((int >> 8) & 255) / 255;
15
- const b = (int & 255) / 255;
16
- return [r, g, b];
17
- };
18
- const vertex = /* glsl */ `
19
- attribute vec3 position;
20
- attribute vec4 random;
21
- attribute vec3 color;
22
-
23
- uniform mat4 modelMatrix;
24
- uniform mat4 viewMatrix;
25
- uniform mat4 projectionMatrix;
26
- uniform float uTime;
27
- uniform float uSpread;
28
- uniform float uBaseSize;
29
- uniform float uSizeRandomness;
30
-
31
- varying vec4 vRandom;
32
- varying vec3 vColor;
33
-
34
- void main() {
35
- vRandom = random;
36
- vColor = color;
37
-
38
- vec3 pos = position * uSpread;
39
- pos.z *= 10.0;
40
-
41
- vec4 mPos = modelMatrix * vec4(pos, 1.0);
42
- float t = uTime;
43
- mPos.x += sin(t * random.z + 6.28 * random.w) * mix(0.1, 1.5, random.x);
44
- mPos.y += sin(t * random.y + 6.28 * random.x) * mix(0.1, 1.5, random.w);
45
- mPos.z += sin(t * random.w + 6.28 * random.y) * mix(0.1, 1.5, random.z);
46
-
47
- vec4 mvPos = viewMatrix * mPos;
48
- gl_PointSize = (uBaseSize * (1.0 + uSizeRandomness * (random.x - 0.5))) / length(mvPos.xyz);
49
- gl_Position = projectionMatrix * mvPos;
50
- }
51
- `;
52
- const fragment = /* glsl */ `
53
- precision highp float;
54
-
55
- uniform float uTime;
56
- uniform float uAlphaParticles;
57
- varying vec4 vRandom;
58
- varying vec3 vColor;
59
-
60
- void main() {
61
- vec2 uv = gl_PointCoord.xy;
62
- float d = length(uv - vec2(0.5));
63
-
64
- if(uAlphaParticles < 0.5) {
65
- if(d > 0.5) {
66
- discard;
67
- }
68
- gl_FragColor = vec4(vColor + 0.2 * sin(uv.yxx + uTime + vRandom.y * 6.28), 1.0);
69
- } else {
70
- float circle = smoothstep(0.5, 0.4, d) * 0.8;
71
- gl_FragColor = vec4(vColor + 0.2 * sin(uv.yxx + uTime + vRandom.y * 6.28), circle);
72
- }
73
- }
74
- `;
75
- const Particles = ({ particleCount = 200, particleSpread = 10, speed = 0.1, particleColors, moveParticlesOnHover = false, particleHoverFactor = 1, alphaParticles = false, particleBaseSize = 100, sizeRandomness = 1, cameraDistance = 20, disableRotation = false, className, useWindowMouseMove = false, }) => {
76
- const containerRef = useRef(null);
77
- const mouseRef = useRef({ x: 0, y: 0 });
78
- useEffect(() => {
79
- const container = containerRef.current;
80
- if (!container)
81
- return;
82
- const renderer = new Renderer({ depth: false, alpha: true });
83
- const gl = renderer.gl;
84
- container.appendChild(gl.canvas);
85
- gl.clearColor(0, 0, 0, 0);
86
- const camera = new Camera(gl, { fov: 15 });
87
- camera.position.set(0, 0, cameraDistance);
88
- const resize = () => {
89
- const width = container.clientWidth;
90
- const height = container.clientHeight;
91
- renderer.setSize(width, height);
92
- camera.perspective({ aspect: gl.canvas.width / gl.canvas.height });
93
- };
94
- window.addEventListener("resize", resize, false);
95
- resize();
96
- const handleMouseMove = (e) => {
97
- const rect = container.getBoundingClientRect();
98
- const x = ((e.clientX - rect.left) / rect.width) * 2 - 1;
99
- const y = -(((e.clientY - rect.top) / rect.height) * 2 - 1);
100
- mouseRef.current = { x, y };
101
- };
102
- if (moveParticlesOnHover) {
103
- if (useWindowMouseMove) {
104
- window.addEventListener("mousemove", handleMouseMove);
105
- }
106
- else {
107
- container.addEventListener("mousemove", handleMouseMove);
108
- }
109
- }
110
- const count = particleCount;
111
- const positions = new Float32Array(count * 3);
112
- const randoms = new Float32Array(count * 4);
113
- const colors = new Float32Array(count * 3);
114
- const palette = particleColors && particleColors.length > 0
115
- ? particleColors
116
- : defaultColors;
117
- for (let i = 0; i < count; i++) {
118
- let x, y, z, len;
119
- do {
120
- x = Math.random() * 2 - 1;
121
- y = Math.random() * 2 - 1;
122
- z = Math.random() * 2 - 1;
123
- len = x * x + y * y + z * z;
124
- } while (len > 1 || len === 0);
125
- const r = Math.cbrt(Math.random());
126
- positions.set([x * r, y * r, z * r], i * 3);
127
- randoms.set([Math.random(), Math.random(), Math.random(), Math.random()], i * 4);
128
- const col = hexToRgb(palette[Math.floor(Math.random() * palette.length)]);
129
- colors.set(col, i * 3);
130
- }
131
- const geometry = new Geometry(gl, {
132
- position: { size: 3, data: positions },
133
- random: { size: 4, data: randoms },
134
- color: { size: 3, data: colors },
135
- });
136
- const program = new Program(gl, {
137
- vertex,
138
- fragment,
139
- uniforms: {
140
- uTime: { value: 0 },
141
- uSpread: { value: particleSpread },
142
- uBaseSize: { value: particleBaseSize },
143
- uSizeRandomness: { value: sizeRandomness },
144
- uAlphaParticles: { value: alphaParticles ? 1 : 0 },
145
- },
146
- transparent: true,
147
- depthTest: false,
148
- });
149
- const particles = new Mesh(gl, { mode: gl.POINTS, geometry, program });
150
- let animationFrameId;
151
- let lastTime = performance.now();
152
- let elapsed = 0;
153
- const update = (t) => {
154
- animationFrameId = requestAnimationFrame(update);
155
- const delta = t - lastTime;
156
- lastTime = t;
157
- elapsed += delta * speed;
158
- program.uniforms.uTime.value = elapsed * 0.001;
159
- if (moveParticlesOnHover) {
160
- particles.position.x = -mouseRef.current.x * particleHoverFactor;
161
- particles.position.y = -mouseRef.current.y * particleHoverFactor;
162
- }
163
- else {
164
- particles.position.x = 0;
165
- particles.position.y = 0;
166
- }
167
- if (!disableRotation) {
168
- particles.rotation.x = Math.sin(elapsed * 0.0002) * 0.1;
169
- particles.rotation.y = Math.cos(elapsed * 0.0005) * 0.15;
170
- particles.rotation.z += 0.01 * speed;
171
- }
172
- renderer.render({ scene: particles, camera });
173
- };
174
- animationFrameId = requestAnimationFrame(update);
175
- return () => {
176
- window.removeEventListener("resize", resize);
177
- if (moveParticlesOnHover) {
178
- if (useWindowMouseMove) {
179
- window.removeEventListener("mousemove", handleMouseMove);
180
- }
181
- else {
182
- container.removeEventListener("mousemove", handleMouseMove);
183
- }
184
- }
185
- cancelAnimationFrame(animationFrameId);
186
- if (container.contains(gl.canvas)) {
187
- container.removeChild(gl.canvas);
188
- }
189
- };
190
- // eslint-disable-next-line react-hooks/exhaustive-deps
191
- }, [
192
- particleCount,
193
- particleSpread,
194
- speed,
195
- moveParticlesOnHover,
196
- particleHoverFactor,
197
- alphaParticles,
198
- particleBaseSize,
199
- sizeRandomness,
200
- cameraDistance,
201
- disableRotation,
202
- ]);
203
- return (<div ref={containerRef} className={`relative h-full w-full ${className}`}/>);
204
- };
205
- export default Particles;
@@ -1,3 +0,0 @@
1
- import Particles from "./Particles";
2
- export * from "./Particles";
3
- export default Particles;
@@ -1,3 +0,0 @@
1
- import Particles from "./Particles";
2
- export * from "./Particles";
3
- export default Particles;