@helpwave/hightide 0.0.13 → 0.0.16

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 (539) hide show
  1. package/dist/coloring/shading.d.mts +5 -0
  2. package/dist/coloring/shading.d.ts +5 -2
  3. package/dist/coloring/shading.js +80 -38
  4. package/dist/coloring/shading.js.map +1 -0
  5. package/dist/coloring/shading.mjs +47 -0
  6. package/dist/coloring/shading.mjs.map +1 -0
  7. package/dist/coloring/types.d.mts +13 -0
  8. package/dist/coloring/types.d.ts +8 -6
  9. package/dist/coloring/types.js +31 -1
  10. package/dist/coloring/types.js.map +1 -0
  11. package/dist/coloring/types.mjs +6 -0
  12. package/dist/coloring/types.mjs.map +1 -0
  13. package/dist/components/Avatar.d.mts +17 -0
  14. package/dist/components/Avatar.d.ts +9 -6
  15. package/dist/components/Avatar.js +79 -29
  16. package/dist/components/Avatar.js.map +1 -0
  17. package/dist/components/Avatar.mjs +48 -0
  18. package/dist/components/Avatar.mjs.map +1 -0
  19. package/dist/components/AvatarGroup.d.mts +14 -0
  20. package/dist/components/AvatarGroup.d.ts +7 -3
  21. package/dist/components/AvatarGroup.js +117 -12
  22. package/dist/components/AvatarGroup.js.map +1 -0
  23. package/dist/components/AvatarGroup.mjs +81 -0
  24. package/dist/components/AvatarGroup.mjs.map +1 -0
  25. package/dist/components/BreadCrumb.d.mts +19 -0
  26. package/dist/components/BreadCrumb.d.ts +6 -3
  27. package/dist/components/BreadCrumb.js +49 -11
  28. package/dist/components/BreadCrumb.js.map +1 -0
  29. package/dist/components/BreadCrumb.mjs +15 -0
  30. package/dist/components/BreadCrumb.mjs.map +1 -0
  31. package/dist/components/Button.d.mts +44 -0
  32. package/dist/components/Button.d.ts +16 -13
  33. package/dist/components/Button.js +232 -80
  34. package/dist/components/Button.js.map +1 -0
  35. package/dist/components/Button.mjs +198 -0
  36. package/dist/components/Button.mjs.map +1 -0
  37. package/dist/components/ChipList.d.mts +24 -0
  38. package/dist/components/ChipList.d.ts +10 -7
  39. package/dist/components/ChipList.js +103 -36
  40. package/dist/components/ChipList.js.map +1 -0
  41. package/dist/components/ChipList.mjs +69 -0
  42. package/dist/components/ChipList.mjs.map +1 -0
  43. package/dist/components/Circle.d.mts +10 -0
  44. package/dist/components/Circle.d.ts +7 -3
  45. package/dist/components/Circle.js +61 -9
  46. package/dist/components/Circle.js.map +1 -0
  47. package/dist/components/Circle.mjs +27 -0
  48. package/dist/components/Circle.mjs.map +1 -0
  49. package/dist/components/ErrorComponent.d.mts +18 -0
  50. package/dist/components/ErrorComponent.d.ts +9 -4
  51. package/dist/components/ErrorComponent.js +86 -17
  52. package/dist/components/ErrorComponent.js.map +1 -0
  53. package/dist/components/ErrorComponent.mjs +53 -0
  54. package/dist/components/ErrorComponent.mjs.map +1 -0
  55. package/dist/components/Expandable.d.mts +33 -0
  56. package/dist/components/Expandable.d.ts +8 -5
  57. package/dist/components/Expandable.js +79 -15
  58. package/dist/components/Expandable.js.map +1 -0
  59. package/dist/components/Expandable.mjs +45 -0
  60. package/dist/components/Expandable.mjs.map +1 -0
  61. package/dist/components/HelpwaveBadge.d.mts +14 -0
  62. package/dist/components/HelpwaveBadge.d.ts +6 -3
  63. package/dist/components/HelpwaveBadge.js +125 -13
  64. package/dist/components/HelpwaveBadge.js.map +1 -0
  65. package/dist/components/HelpwaveBadge.mjs +91 -0
  66. package/dist/components/HelpwaveBadge.mjs.map +1 -0
  67. package/dist/components/HideableContentSection.d.mts +14 -0
  68. package/dist/components/HideableContentSection.d.ts +7 -3
  69. package/dist/components/HideableContentSection.js +69 -14
  70. package/dist/components/HideableContentSection.js.map +1 -0
  71. package/dist/components/HideableContentSection.mjs +35 -0
  72. package/dist/components/HideableContentSection.mjs.map +1 -0
  73. package/dist/components/InputGroup.d.mts +17 -0
  74. package/dist/components/InputGroup.d.ts +7 -3
  75. package/dist/components/InputGroup.js +96 -32
  76. package/dist/components/InputGroup.js.map +1 -0
  77. package/dist/components/InputGroup.mjs +62 -0
  78. package/dist/components/InputGroup.mjs.map +1 -0
  79. package/dist/components/LoadingAndErrorComponent.d.mts +24 -0
  80. package/dist/components/LoadingAndErrorComponent.d.ts +12 -5
  81. package/dist/components/LoadingAndErrorComponent.js +178 -23
  82. package/dist/components/LoadingAndErrorComponent.js.map +1 -0
  83. package/dist/components/LoadingAndErrorComponent.mjs +145 -0
  84. package/dist/components/LoadingAndErrorComponent.mjs.map +1 -0
  85. package/dist/components/LoadingAnimation.d.mts +18 -0
  86. package/dist/components/LoadingAnimation.d.ts +9 -4
  87. package/dist/components/LoadingAnimation.js +124 -16
  88. package/dist/components/LoadingAnimation.js.map +1 -0
  89. package/dist/components/LoadingAnimation.mjs +90 -0
  90. package/dist/components/LoadingAnimation.mjs.map +1 -0
  91. package/dist/components/LoadingButton.d.mts +10 -0
  92. package/dist/components/LoadingButton.d.ts +7 -3
  93. package/dist/components/LoadingButton.js +169 -9
  94. package/dist/components/LoadingButton.js.map +1 -0
  95. package/dist/components/LoadingButton.mjs +135 -0
  96. package/dist/components/LoadingButton.mjs.map +1 -0
  97. package/dist/components/MarkdownInterpreter.d.mts +28 -0
  98. package/dist/components/MarkdownInterpreter.d.ts +8 -5
  99. package/dist/components/MarkdownInterpreter.js +246 -175
  100. package/dist/components/MarkdownInterpreter.js.map +1 -0
  101. package/dist/components/MarkdownInterpreter.mjs +235 -0
  102. package/dist/components/MarkdownInterpreter.mjs.map +1 -0
  103. package/dist/components/Pagination.d.mts +19 -0
  104. package/dist/components/Pagination.d.ts +9 -4
  105. package/dist/components/Pagination.js +100 -23
  106. package/dist/components/Pagination.js.map +1 -0
  107. package/dist/components/Pagination.mjs +67 -0
  108. package/dist/components/Pagination.mjs.map +1 -0
  109. package/dist/components/Profile.d.mts +31 -0
  110. package/dist/components/Profile.d.ts +8 -5
  111. package/dist/components/Profile.js +194 -42
  112. package/dist/components/Profile.js.map +1 -0
  113. package/dist/components/Profile.mjs +162 -0
  114. package/dist/components/Profile.mjs.map +1 -0
  115. package/dist/components/ProgressIndicator.d.mts +24 -0
  116. package/dist/components/ProgressIndicator.d.ts +6 -3
  117. package/dist/components/ProgressIndicator.js +82 -22
  118. package/dist/components/ProgressIndicator.js.map +1 -0
  119. package/dist/components/ProgressIndicator.mjs +59 -0
  120. package/dist/components/ProgressIndicator.mjs.map +1 -0
  121. package/dist/components/Ring.d.mts +35 -0
  122. package/dist/components/Ring.d.ts +13 -9
  123. package/dist/components/Ring.js +331 -107
  124. package/dist/components/Ring.js.map +1 -0
  125. package/dist/components/Ring.mjs +299 -0
  126. package/dist/components/Ring.mjs.map +1 -0
  127. package/dist/components/SearchableList.d.mts +22 -0
  128. package/dist/components/SearchableList.d.ts +9 -5
  129. package/dist/components/SearchableList.js +268 -24
  130. package/dist/components/SearchableList.js.map +1 -0
  131. package/dist/components/SearchableList.mjs +241 -0
  132. package/dist/components/SearchableList.mjs.map +1 -0
  133. package/dist/components/SortButton.d.mts +15 -0
  134. package/dist/components/SortButton.d.ts +9 -4
  135. package/dist/components/SortButton.js +131 -8
  136. package/dist/components/SortButton.js.map +1 -0
  137. package/dist/components/SortButton.mjs +97 -0
  138. package/dist/components/SortButton.mjs.map +1 -0
  139. package/dist/components/StepperBar.d.mts +28 -0
  140. package/dist/components/StepperBar.d.ts +10 -5
  141. package/dist/components/StepperBar.js +248 -44
  142. package/dist/components/StepperBar.js.map +1 -0
  143. package/dist/components/StepperBar.mjs +216 -0
  144. package/dist/components/StepperBar.mjs.map +1 -0
  145. package/dist/components/Table.d.mts +90 -0
  146. package/dist/components/Table.d.ts +20 -17
  147. package/dist/components/Table.js +396 -170
  148. package/dist/components/Table.js.map +1 -0
  149. package/dist/components/Table.mjs +370 -0
  150. package/dist/components/Table.mjs.map +1 -0
  151. package/dist/components/TechRadar.d.mts +39 -0
  152. package/dist/components/TechRadar.d.ts +5 -2
  153. package/dist/components/TechRadar.js +241 -189
  154. package/dist/components/TechRadar.js.map +1 -0
  155. package/dist/components/TechRadar.mjs +208 -0
  156. package/dist/components/TechRadar.mjs.map +1 -0
  157. package/dist/components/TextImage.d.mts +25 -0
  158. package/dist/components/TextImage.d.ts +9 -4
  159. package/dist/components/TextImage.js +121 -29
  160. package/dist/components/TextImage.js.map +1 -0
  161. package/dist/components/TextImage.mjs +86 -0
  162. package/dist/components/TextImage.mjs.map +1 -0
  163. package/dist/components/TimeDisplay.d.mts +35 -0
  164. package/dist/components/TimeDisplay.d.ts +8 -3
  165. package/dist/components/TimeDisplay.js +134 -81
  166. package/dist/components/TimeDisplay.js.map +1 -0
  167. package/dist/components/TimeDisplay.mjs +109 -0
  168. package/dist/components/TimeDisplay.mjs.map +1 -0
  169. package/dist/components/Tooltip.d.mts +37 -0
  170. package/dist/components/Tooltip.d.ts +7 -4
  171. package/dist/components/Tooltip.js +135 -37
  172. package/dist/components/Tooltip.js.map +1 -0
  173. package/dist/components/Tooltip.mjs +109 -0
  174. package/dist/components/Tooltip.mjs.map +1 -0
  175. package/dist/components/VerticalDivider.d.mts +15 -0
  176. package/dist/components/VerticalDivider.d.ts +6 -2
  177. package/dist/components/VerticalDivider.js +80 -6
  178. package/dist/components/VerticalDivider.js.map +1 -0
  179. package/dist/components/VerticalDivider.mjs +56 -0
  180. package/dist/components/VerticalDivider.mjs.map +1 -0
  181. package/dist/components/date/DatePicker.d.mts +32 -0
  182. package/dist/components/date/DatePicker.d.ts +13 -7
  183. package/dist/components/date/DatePicker.js +624 -55
  184. package/dist/components/date/DatePicker.js.map +1 -0
  185. package/dist/components/date/DatePicker.mjs +591 -0
  186. package/dist/components/date/DatePicker.mjs.map +1 -0
  187. package/dist/components/date/DayPicker.d.mts +20 -0
  188. package/dist/components/date/DayPicker.d.ts +8 -4
  189. package/dist/components/date/DayPicker.js +232 -36
  190. package/dist/components/date/DayPicker.js.map +1 -0
  191. package/dist/components/date/DayPicker.mjs +195 -0
  192. package/dist/components/date/DayPicker.mjs.map +1 -0
  193. package/dist/components/date/TimePicker.d.mts +15 -0
  194. package/dist/components/date/TimePicker.d.ts +7 -4
  195. package/dist/components/date/TimePicker.js +196 -75
  196. package/dist/components/date/TimePicker.js.map +1 -0
  197. package/dist/components/date/TimePicker.mjs +164 -0
  198. package/dist/components/date/TimePicker.mjs.map +1 -0
  199. package/dist/components/date/YearMonthPicker.d.mts +15 -0
  200. package/dist/components/date/YearMonthPicker.d.ts +7 -3
  201. package/dist/components/date/YearMonthPicker.js +281 -57
  202. package/dist/components/date/YearMonthPicker.js.map +1 -0
  203. package/dist/components/date/YearMonthPicker.mjs +247 -0
  204. package/dist/components/date/YearMonthPicker.mjs.map +1 -0
  205. package/dist/components/icons/Helpwave.d.mts +14 -0
  206. package/dist/components/icons/Helpwave.d.ts +7 -3
  207. package/dist/components/icons/Helpwave.js +66 -18
  208. package/dist/components/icons/Helpwave.js.map +1 -0
  209. package/dist/components/icons/Helpwave.mjs +43 -0
  210. package/dist/components/icons/Helpwave.mjs.map +1 -0
  211. package/dist/components/icons/Tag.d.mts +14 -0
  212. package/dist/components/icons/Tag.d.ts +7 -3
  213. package/dist/components/icons/Tag.js +59 -11
  214. package/dist/components/icons/Tag.js.map +1 -0
  215. package/dist/components/icons/Tag.mjs +25 -0
  216. package/dist/components/icons/Tag.mjs.map +1 -0
  217. package/dist/components/layout/Carousel.d.mts +25 -0
  218. package/dist/components/layout/Carousel.d.ts +6 -3
  219. package/dist/components/layout/Carousel.js +477 -226
  220. package/dist/components/layout/Carousel.js.map +1 -0
  221. package/dist/components/layout/Carousel.mjs +449 -0
  222. package/dist/components/layout/Carousel.mjs.map +1 -0
  223. package/dist/components/layout/DividerInserter.d.mts +15 -0
  224. package/dist/components/layout/DividerInserter.d.ts +7 -3
  225. package/dist/components/layout/DividerInserter.js +58 -18
  226. package/dist/components/layout/DividerInserter.js.map +1 -0
  227. package/dist/components/layout/DividerInserter.mjs +25 -0
  228. package/dist/components/layout/DividerInserter.mjs.map +1 -0
  229. package/dist/components/layout/FAQSection.d.mts +26 -0
  230. package/dist/components/layout/FAQSection.d.ts +9 -6
  231. package/dist/components/layout/FAQSection.js +336 -13
  232. package/dist/components/layout/FAQSection.js.map +1 -0
  233. package/dist/components/layout/FAQSection.mjs +302 -0
  234. package/dist/components/layout/FAQSection.mjs.map +1 -0
  235. package/dist/components/layout/Tile.d.mts +37 -0
  236. package/dist/components/layout/Tile.d.ts +9 -6
  237. package/dist/components/layout/Tile.js +76 -16
  238. package/dist/components/layout/Tile.js.map +1 -0
  239. package/dist/components/layout/Tile.mjs +42 -0
  240. package/dist/components/layout/Tile.mjs.map +1 -0
  241. package/dist/components/modals/ConfirmDialog.d.mts +38 -0
  242. package/dist/components/modals/ConfirmDialog.d.ts +13 -9
  243. package/dist/components/modals/ConfirmDialog.js +422 -28
  244. package/dist/components/modals/ConfirmDialog.js.map +1 -0
  245. package/dist/components/modals/ConfirmDialog.mjs +388 -0
  246. package/dist/components/modals/ConfirmDialog.mjs.map +1 -0
  247. package/dist/components/modals/DiscardChangesDialog.d.mts +23 -0
  248. package/dist/components/modals/DiscardChangesDialog.d.ts +9 -5
  249. package/dist/components/modals/DiscardChangesDialog.js +406 -23
  250. package/dist/components/modals/DiscardChangesDialog.js.map +1 -0
  251. package/dist/components/modals/DiscardChangesDialog.mjs +370 -0
  252. package/dist/components/modals/DiscardChangesDialog.mjs.map +1 -0
  253. package/dist/components/modals/InputModal.d.mts +19 -0
  254. package/dist/components/modals/InputModal.d.ts +14 -4
  255. package/dist/components/modals/InputModal.js +598 -8
  256. package/dist/components/modals/InputModal.js.map +1 -0
  257. package/dist/components/modals/InputModal.mjs +567 -0
  258. package/dist/components/modals/InputModal.mjs.map +1 -0
  259. package/dist/components/modals/LanguageModal.d.mts +21 -0
  260. package/dist/components/modals/LanguageModal.d.ts +9 -5
  261. package/dist/components/modals/LanguageModal.js +524 -33
  262. package/dist/components/modals/LanguageModal.js.map +1 -0
  263. package/dist/components/modals/LanguageModal.mjs +489 -0
  264. package/dist/components/modals/LanguageModal.mjs.map +1 -0
  265. package/dist/components/modals/Modal.d.mts +43 -0
  266. package/dist/components/modals/Modal.d.ts +13 -8
  267. package/dist/components/modals/Modal.js +280 -51
  268. package/dist/components/modals/Modal.js.map +1 -0
  269. package/dist/components/modals/Modal.mjs +249 -0
  270. package/dist/components/modals/Modal.mjs.map +1 -0
  271. package/dist/components/modals/ModalRegister.d.mts +16 -0
  272. package/dist/components/modals/ModalRegister.d.ts +9 -4
  273. package/dist/components/modals/ModalRegister.js +61 -26
  274. package/dist/components/modals/ModalRegister.js.map +1 -0
  275. package/dist/components/modals/ModalRegister.mjs +37 -0
  276. package/dist/components/modals/ModalRegister.mjs.map +1 -0
  277. package/dist/components/properties/CheckboxProperty.d.mts +20 -0
  278. package/dist/components/properties/CheckboxProperty.d.ts +10 -5
  279. package/dist/components/properties/CheckboxProperty.js +323 -24
  280. package/dist/components/properties/CheckboxProperty.js.map +1 -0
  281. package/dist/components/properties/CheckboxProperty.mjs +291 -0
  282. package/dist/components/properties/CheckboxProperty.mjs.map +1 -0
  283. package/dist/components/properties/DateProperty.d.mts +18 -0
  284. package/dist/components/properties/DateProperty.d.ts +10 -3
  285. package/dist/components/properties/DateProperty.js +422 -21
  286. package/dist/components/properties/DateProperty.js.map +1 -0
  287. package/dist/components/properties/DateProperty.mjs +393 -0
  288. package/dist/components/properties/DateProperty.mjs.map +1 -0
  289. package/dist/components/properties/MultiSelectProperty.d.mts +18 -0
  290. package/dist/components/properties/MultiSelectProperty.d.ts +12 -6
  291. package/dist/components/properties/MultiSelectProperty.js +815 -31
  292. package/dist/components/properties/MultiSelectProperty.js.map +1 -0
  293. package/dist/components/properties/MultiSelectProperty.mjs +787 -0
  294. package/dist/components/properties/MultiSelectProperty.mjs.map +1 -0
  295. package/dist/components/properties/NumberProperty.d.mts +21 -0
  296. package/dist/components/properties/NumberProperty.d.ts +10 -5
  297. package/dist/components/properties/NumberProperty.js +429 -39
  298. package/dist/components/properties/NumberProperty.js.map +1 -0
  299. package/dist/components/properties/NumberProperty.mjs +402 -0
  300. package/dist/components/properties/NumberProperty.mjs.map +1 -0
  301. package/dist/components/properties/PropertyBase.d.mts +27 -0
  302. package/dist/components/properties/PropertyBase.d.ts +9 -5
  303. package/dist/components/properties/PropertyBase.js +194 -24
  304. package/dist/components/properties/PropertyBase.js.map +1 -0
  305. package/dist/components/properties/PropertyBase.mjs +162 -0
  306. package/dist/components/properties/PropertyBase.mjs.map +1 -0
  307. package/dist/components/properties/SelectProperty.d.mts +19 -0
  308. package/dist/components/properties/SelectProperty.d.ts +13 -6
  309. package/dist/components/properties/SelectProperty.js +547 -19
  310. package/dist/components/properties/SelectProperty.js.map +1 -0
  311. package/dist/components/properties/SelectProperty.mjs +520 -0
  312. package/dist/components/properties/SelectProperty.mjs.map +1 -0
  313. package/dist/components/properties/TextProperty.d.mts +20 -0
  314. package/dist/components/properties/TextProperty.d.ts +10 -5
  315. package/dist/components/properties/TextProperty.js +378 -34
  316. package/dist/components/properties/TextProperty.js.map +1 -0
  317. package/dist/components/properties/TextProperty.mjs +346 -0
  318. package/dist/components/properties/TextProperty.mjs.map +1 -0
  319. package/dist/components/user-input/Checkbox.d.mts +41 -0
  320. package/dist/components/user-input/Checkbox.d.ts +9 -5
  321. package/dist/components/user-input/Checkbox.js +148 -63
  322. package/dist/components/user-input/Checkbox.js.map +1 -0
  323. package/dist/components/user-input/Checkbox.mjs +112 -0
  324. package/dist/components/user-input/Checkbox.mjs.map +1 -0
  325. package/dist/components/user-input/DateAndTimePicker.d.mts +47 -0
  326. package/dist/components/user-input/DateAndTimePicker.d.ts +15 -7
  327. package/dist/components/user-input/DateAndTimePicker.js +831 -60
  328. package/dist/components/user-input/DateAndTimePicker.js.map +1 -0
  329. package/dist/components/user-input/DateAndTimePicker.mjs +801 -0
  330. package/dist/components/user-input/DateAndTimePicker.mjs.map +1 -0
  331. package/dist/components/user-input/Input.d.mts +64 -0
  332. package/dist/components/user-input/Input.d.ts +12 -9
  333. package/dist/components/user-input/Input.js +219 -57
  334. package/dist/components/user-input/Input.js.map +1 -0
  335. package/dist/components/user-input/Input.mjs +191 -0
  336. package/dist/components/user-input/Input.mjs.map +1 -0
  337. package/dist/components/user-input/Label.d.mts +16 -0
  338. package/dist/components/user-input/Label.d.ts +8 -4
  339. package/dist/components/user-input/Label.js +43 -11
  340. package/dist/components/user-input/Label.js.map +1 -0
  341. package/dist/components/user-input/Label.mjs +19 -0
  342. package/dist/components/user-input/Label.mjs.map +1 -0
  343. package/dist/components/user-input/Menu.d.mts +24 -0
  344. package/dist/components/user-input/Menu.d.ts +8 -5
  345. package/dist/components/user-input/Menu.js +162 -25
  346. package/dist/components/user-input/Menu.js.map +1 -0
  347. package/dist/components/user-input/Menu.mjs +127 -0
  348. package/dist/components/user-input/Menu.mjs.map +1 -0
  349. package/dist/components/user-input/MultiSelect.d.mts +43 -0
  350. package/dist/components/user-input/MultiSelect.d.ts +12 -8
  351. package/dist/components/user-input/MultiSelect.js +545 -56
  352. package/dist/components/user-input/MultiSelect.js.map +1 -0
  353. package/dist/components/user-input/MultiSelect.mjs +516 -0
  354. package/dist/components/user-input/MultiSelect.mjs.map +1 -0
  355. package/dist/components/user-input/ScrollPicker.d.mts +15 -0
  356. package/dist/components/user-input/ScrollPicker.d.ts +6 -2
  357. package/dist/components/user-input/ScrollPicker.js +276 -145
  358. package/dist/components/user-input/ScrollPicker.js.map +1 -0
  359. package/dist/components/user-input/ScrollPicker.mjs +247 -0
  360. package/dist/components/user-input/ScrollPicker.mjs.map +1 -0
  361. package/dist/components/user-input/SearchableSelect.d.mts +14 -0
  362. package/dist/components/user-input/SearchableSelect.d.ts +9 -3
  363. package/dist/components/user-input/SearchableSelect.js +334 -13
  364. package/dist/components/user-input/SearchableSelect.js.map +1 -0
  365. package/dist/components/user-input/SearchableSelect.mjs +305 -0
  366. package/dist/components/user-input/SearchableSelect.mjs.map +1 -0
  367. package/dist/components/user-input/Select.d.mts +36 -0
  368. package/dist/components/user-input/Select.d.ts +9 -5
  369. package/dist/components/user-input/Select.js +152 -47
  370. package/dist/components/user-input/Select.js.map +1 -0
  371. package/dist/components/user-input/Select.mjs +118 -0
  372. package/dist/components/user-input/Select.mjs.map +1 -0
  373. package/dist/components/user-input/Textarea.d.mts +24 -0
  374. package/dist/components/user-input/Textarea.d.ts +8 -4
  375. package/dist/components/user-input/Textarea.js +153 -31
  376. package/dist/components/user-input/Textarea.js.map +1 -0
  377. package/dist/components/user-input/Textarea.mjs +120 -0
  378. package/dist/components/user-input/Textarea.mjs.map +1 -0
  379. package/dist/components/user-input/ToggleableInput.d.mts +35 -0
  380. package/dist/components/user-input/ToggleableInput.d.ts +6 -3
  381. package/dist/components/user-input/ToggleableInput.js +161 -38
  382. package/dist/components/user-input/ToggleableInput.js.map +1 -0
  383. package/dist/components/user-input/ToggleableInput.mjs +128 -0
  384. package/dist/components/user-input/ToggleableInput.mjs.map +1 -0
  385. package/dist/hooks/useHoverState.d.mts +42 -0
  386. package/dist/hooks/useHoverState.d.ts +5 -3
  387. package/dist/hooks/useHoverState.js +69 -43
  388. package/dist/hooks/useHoverState.js.map +1 -0
  389. package/dist/hooks/useHoverState.mjs +47 -0
  390. package/dist/hooks/useHoverState.mjs.map +1 -0
  391. package/dist/hooks/useLanguage.d.mts +21 -0
  392. package/dist/hooks/useLanguage.d.ts +15 -11
  393. package/dist/hooks/useLanguage.js +145 -50
  394. package/dist/hooks/useLanguage.js.map +1 -0
  395. package/dist/hooks/useLanguage.mjs +115 -0
  396. package/dist/hooks/useLanguage.mjs.map +1 -0
  397. package/dist/hooks/useLocalStorage.d.mts +6 -0
  398. package/dist/hooks/useLocalStorage.d.ts +4 -2
  399. package/dist/hooks/useLocalStorage.js +79 -23
  400. package/dist/hooks/useLocalStorage.js.map +1 -0
  401. package/dist/hooks/useLocalStorage.mjs +59 -0
  402. package/dist/hooks/useLocalStorage.mjs.map +1 -0
  403. package/dist/hooks/useOutsideClick.d.mts +5 -0
  404. package/dist/hooks/useOutsideClick.d.ts +5 -2
  405. package/dist/hooks/useOutsideClick.js +47 -21
  406. package/dist/hooks/useOutsideClick.js.map +1 -0
  407. package/dist/hooks/useOutsideClick.mjs +23 -0
  408. package/dist/hooks/useOutsideClick.mjs.map +1 -0
  409. package/dist/hooks/useSaveDelay.d.mts +6 -0
  410. package/dist/hooks/useSaveDelay.d.ts +2 -1
  411. package/dist/hooks/useSaveDelay.js +62 -38
  412. package/dist/hooks/useSaveDelay.js.map +1 -0
  413. package/dist/hooks/useSaveDelay.mjs +44 -0
  414. package/dist/hooks/useSaveDelay.mjs.map +1 -0
  415. package/dist/hooks/useTheme.d.mts +21 -0
  416. package/dist/hooks/useTheme.d.ts +14 -9
  417. package/dist/hooks/useTheme.js +65 -29
  418. package/dist/hooks/useTheme.js.map +1 -0
  419. package/dist/hooks/useTheme.mjs +40 -0
  420. package/dist/hooks/useTheme.mjs.map +1 -0
  421. package/dist/hooks/useTranslation.d.mts +28 -0
  422. package/dist/hooks/useTranslation.d.ts +9 -5
  423. package/dist/hooks/useTranslation.js +53 -10
  424. package/dist/hooks/useTranslation.js.map +1 -0
  425. package/dist/hooks/useTranslation.mjs +27 -0
  426. package/dist/hooks/useTranslation.mjs.map +1 -0
  427. package/dist/index.d.mts +86 -0
  428. package/dist/index.d.ts +86 -0
  429. package/dist/index.js +5716 -0
  430. package/dist/index.js.map +1 -0
  431. package/dist/index.mjs +5542 -0
  432. package/dist/index.mjs.map +1 -0
  433. package/dist/util/array.d.mts +25 -0
  434. package/dist/util/array.d.ts +9 -7
  435. package/dist/util/array.js +119 -92
  436. package/dist/util/array.js.map +1 -0
  437. package/dist/util/array.mjs +99 -0
  438. package/dist/util/array.mjs.map +1 -0
  439. package/dist/util/builder.d.mts +8 -0
  440. package/dist/util/builder.d.ts +3 -1
  441. package/dist/util/builder.js +33 -8
  442. package/dist/util/builder.js.map +1 -0
  443. package/dist/util/builder.mjs +9 -0
  444. package/dist/util/builder.mjs.map +1 -0
  445. package/dist/util/date.d.mts +30 -0
  446. package/dist/util/date.d.ts +17 -15
  447. package/dist/util/date.js +184 -123
  448. package/dist/util/date.js.map +1 -0
  449. package/dist/util/date.mjs +156 -0
  450. package/dist/util/date.mjs.map +1 -0
  451. package/dist/util/easeFunctions.d.mts +11 -0
  452. package/dist/util/easeFunctions.d.ts +4 -2
  453. package/dist/util/easeFunctions.js +63 -30
  454. package/dist/util/easeFunctions.js.map +1 -0
  455. package/dist/util/easeFunctions.mjs +36 -0
  456. package/dist/util/easeFunctions.mjs.map +1 -0
  457. package/dist/util/emailValidation.d.mts +3 -0
  458. package/dist/util/emailValidation.d.ts +3 -1
  459. package/dist/util/emailValidation.js +32 -2
  460. package/dist/util/emailValidation.js.map +1 -0
  461. package/dist/util/emailValidation.mjs +8 -0
  462. package/dist/util/emailValidation.mjs.map +1 -0
  463. package/dist/util/loopingArray.d.mts +25 -0
  464. package/dist/util/loopingArray.d.ts +4 -2
  465. package/dist/util/loopingArray.js +89 -59
  466. package/dist/util/loopingArray.js.map +1 -0
  467. package/dist/util/loopingArray.mjs +72 -0
  468. package/dist/util/loopingArray.mjs.map +1 -0
  469. package/dist/util/math.d.mts +3 -0
  470. package/dist/util/math.d.ts +3 -1
  471. package/dist/util/math.js +32 -2
  472. package/dist/util/math.js.map +1 -0
  473. package/dist/util/math.mjs +8 -0
  474. package/dist/util/math.mjs.map +1 -0
  475. package/dist/util/news.d.mts +103 -0
  476. package/dist/util/news.d.ts +12 -7
  477. package/dist/util/news.js +73 -24
  478. package/dist/util/news.js.map +1 -0
  479. package/dist/util/news.mjs +48 -0
  480. package/dist/util/news.mjs.map +1 -0
  481. package/dist/util/noop.d.mts +3 -0
  482. package/dist/util/noop.d.ts +3 -1
  483. package/dist/util/noop.js +31 -1
  484. package/dist/util/noop.js.map +1 -0
  485. package/dist/util/noop.mjs +6 -0
  486. package/dist/util/noop.mjs.map +1 -0
  487. package/dist/util/simpleSearch.d.mts +50 -0
  488. package/dist/util/simpleSearch.d.ts +6 -4
  489. package/dist/util/simpleSearch.js +50 -58
  490. package/dist/util/simpleSearch.js.map +1 -0
  491. package/dist/util/simpleSearch.mjs +26 -0
  492. package/dist/util/simpleSearch.mjs.map +1 -0
  493. package/dist/util/storage.d.mts +16 -0
  494. package/dist/util/storage.d.ts +4 -3
  495. package/dist/util/storage.js +63 -31
  496. package/dist/util/storage.js.map +1 -0
  497. package/dist/util/storage.mjs +38 -0
  498. package/dist/util/storage.mjs.map +1 -0
  499. package/dist/util/types.d.mts +3 -0
  500. package/dist/util/types.d.ts +3 -1
  501. package/dist/util/types.js +19 -1
  502. package/dist/util/types.js.map +1 -0
  503. package/dist/util/types.mjs +1 -0
  504. package/dist/util/types.mjs.map +1 -0
  505. package/package.json +20 -9
  506. package/dist/components/Span.d.ts +0 -0
  507. package/dist/components/Span.js +0 -1
  508. package/dist/components/examples/InputGroupExample.d.ts +0 -6
  509. package/dist/components/examples/InputGroupExample.js +0 -21
  510. package/dist/components/examples/MultiSelectExample.d.ts +0 -7
  511. package/dist/components/examples/MultiSelectExample.js +0 -27
  512. package/dist/components/examples/SearchableSelectExample.d.ts +0 -6
  513. package/dist/components/examples/SearchableSelectExample.js +0 -17
  514. package/dist/components/examples/SelectExample.d.ts +0 -4
  515. package/dist/components/examples/SelectExample.js +0 -15
  516. package/dist/components/examples/StackingModals.d.ts +0 -4
  517. package/dist/components/examples/StackingModals.js +0 -15
  518. package/dist/components/examples/TableExample.d.ts +0 -9
  519. package/dist/components/examples/TableExample.js +0 -92
  520. package/dist/components/examples/TextareaExample.d.ts +0 -6
  521. package/dist/components/examples/TextareaExample.js +0 -10
  522. package/dist/components/examples/TileExample.d.ts +0 -9
  523. package/dist/components/examples/TileExample.js +0 -9
  524. package/dist/components/examples/Title.d.ts +0 -0
  525. package/dist/components/examples/Title.js +0 -1
  526. package/dist/components/examples/date/DateTimePickerExample.d.ts +0 -10
  527. package/dist/components/examples/date/DateTimePickerExample.js +0 -21
  528. package/dist/components/examples/properties/CheckboxPropertyExample.d.ts +0 -8
  529. package/dist/components/examples/properties/CheckboxPropertyExample.js +0 -13
  530. package/dist/components/examples/properties/DatePropertyExample.d.ts +0 -8
  531. package/dist/components/examples/properties/DatePropertyExample.js +0 -23
  532. package/dist/components/examples/properties/MultiSelectPropertyExample.d.ts +0 -8
  533. package/dist/components/examples/properties/MultiSelectPropertyExample.js +0 -16
  534. package/dist/components/examples/properties/NumberPropertyExample.d.ts +0 -6
  535. package/dist/components/examples/properties/NumberPropertyExample.js +0 -13
  536. package/dist/components/examples/properties/SelectPropertyExample.d.ts +0 -6
  537. package/dist/components/examples/properties/SelectPropertyExample.js +0 -18
  538. package/dist/components/examples/properties/TextPropertyExample.d.ts +0 -8
  539. package/dist/components/examples/properties/TextPropertyExample.js +0 -13
@@ -1,233 +1,484 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import clsx from 'clsx';
3
- import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
- import { ChevronLeft, ChevronRight } from 'lucide-react';
5
- import { createLoopingListWithIndex, range } from '../../util/array';
6
- import { clamp } from '../../util/math';
7
- import { EaseFunctions } from '../../util/easeFunctions';
8
- import { LoopingArrayCalculator } from '../../util/loopingArray';
9
- export const Carousel = ({ children, animationTime = 200, isLooping = false, isAutoLooping = false, autoLoopingTimeOut = 5000, autoLoopAnimationTime = 500, hintNext = false, arrows = false, dots = true, overScrollThreshold = 0.1, blurColor = 'from-white', className = '', heightClassName = 'h-[24rem]', widthClassName = 'w-[70%] desktop:w-1/2', }) => {
10
- if (isAutoLooping && !isLooping) {
11
- console.error('When isAutoLooping is true, isLooping should also be true');
12
- isLooping = true;
13
- }
14
- const [{ currentPosition, dragState, animationState, }, setCarouselInformation] = useState({
15
- currentPosition: 0,
16
- });
17
- const animationId = useRef(undefined);
18
- const timeOut = useRef(undefined);
19
- autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut);
20
- const length = children.length;
21
- const paddingItemCount = 3; // The number of items to append left and right of the list to allow for clean transition when looping
22
- const util = useMemo(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold]);
23
- const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition));
24
- animationTime = Math.max(200, animationTime); // in ms, must be > 0
25
- autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime);
26
- const getStyleOffset = (index) => {
27
- const baseOffset = -50 + (index - currentPosition) * 100;
28
- return `${baseOffset}%`;
29
- };
30
- const animation = useCallback((time) => {
31
- let keepAnimating = true;
32
- // Other calculation in the setState call to avoid updating the useCallback to often
33
- setCarouselInformation((state) => {
34
- const { animationState, dragState } = state;
35
- if (animationState === undefined || dragState !== undefined) {
36
- keepAnimating = false;
37
- return state;
38
- }
39
- if (!animationState.startTime || !animationState.lastUpdateTime) {
40
- return {
41
- ...state,
42
- animationState: {
43
- ...animationState,
44
- startTime: time,
45
- lastUpdateTime: time
46
- }
47
- };
48
- }
49
- const useAnimationTime = animationState.isAutoLooping ? autoLoopAnimationTime : animationTime;
50
- const progress = clamp((time - animationState.startTime) / useAnimationTime); // progress
51
- const easedProgress = EaseFunctions.easeInEaseOut(progress);
52
- const distance = util.getDistanceDirectional(animationState.startPosition, animationState.targetPosition, animationState.direction);
53
- const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState.direction + animationState.startPosition);
54
- if (animationState.targetPosition === newPosition || progress === 1) {
55
- keepAnimating = false;
56
- return ({
57
- currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),
58
- animationState: undefined
59
- });
60
- }
61
- return ({
62
- currentPosition: newPosition,
63
- animationState: {
64
- ...animationState,
65
- lastUpdateTime: time
66
- }
67
- });
68
- });
69
- if (keepAnimating) {
70
- animationId.current = requestAnimationFrame(time1 => animation(time1));
71
- }
72
- }, [animationTime, autoLoopAnimationTime, util]);
73
- useEffect(() => {
74
- if (animationState) {
75
- animationId.current = requestAnimationFrame(animation);
76
- }
77
- return () => {
78
- if (animationId.current) {
79
- cancelAnimationFrame(animationId.current);
80
- animationId.current = 0;
81
- }
82
- };
83
- }, [animationState]); // eslint-disable-line react-hooks/exhaustive-deps
84
- const startAutoLoop = () => setCarouselInformation(prevState => ({
85
- ...prevState,
86
- dragState: prevState.dragState,
87
- animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {
88
- startPosition: currentPosition,
89
- targetPosition: (currentPosition + 1) % length,
90
- direction: 1, // always move forward
91
- isAutoLooping: true
92
- }
93
- }));
94
- useEffect(() => {
95
- if (!animationId.current && !animationState && !dragState && !timeOut.current) {
96
- if (autoLoopingTimeOut > 0) {
97
- timeOut.current = setTimeout(() => {
98
- startAutoLoop();
99
- timeOut.current = undefined;
100
- }, autoLoopingTimeOut);
101
- }
102
- else {
103
- startAutoLoop();
104
- }
105
- }
106
- }, [animationState, dragState, animationId.current, timeOut.current]); // eslint-disable-line react-hooks/exhaustive-deps
107
- const startAnimation = (targetPosition) => {
108
- if (targetPosition === undefined) {
109
- targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition);
110
- }
111
- if (targetPosition === currentPosition) {
112
- return; // we are exactly where we want to be
113
- }
114
- // find target index and fastest path to it
115
- const direction = util.getBestDirection(currentPosition, targetPosition);
116
- clearTimeout(timeOut.current);
117
- timeOut.current = undefined;
118
- if (animationId.current) {
119
- cancelAnimationFrame(animationId.current);
120
- animationId.current = undefined;
121
- }
122
- setCarouselInformation(prevState => ({
123
- ...prevState,
124
- dragState: undefined,
125
- animationState: {
126
- targetPosition: targetPosition,
127
- direction,
128
- startPosition: currentPosition,
129
- isAutoLooping: false
130
- },
131
- timeOut: undefined
132
- }));
133
- };
134
- const canGoLeft = () => {
135
- return isLooping || currentPosition !== 0;
136
- };
137
- const canGoRight = () => {
138
- return isLooping || currentPosition !== length - 1;
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/components/layout/Carousel.tsx
31
+ var Carousel_exports = {};
32
+ __export(Carousel_exports, {
33
+ Carousel: () => Carousel
34
+ });
35
+ module.exports = __toCommonJS(Carousel_exports);
36
+ var import_clsx = __toESM(require("clsx"));
37
+ var import_react = require("react");
38
+ var import_lucide_react = require("lucide-react");
39
+
40
+ // src/util/array.ts
41
+ var range = (start, end, allowEmptyRange = false) => {
42
+ if (end < start) {
43
+ if (!allowEmptyRange) {
44
+ console.warn(`range: end (${end}) < start (${start}) should be allowed explicitly, set allowEmptyRange to true`);
45
+ }
46
+ return [];
47
+ }
48
+ return Array.from({ length: end - start + 1 }, (_, index) => index + start);
49
+ };
50
+ var createLoopingListWithIndex = (list, startIndex = 0, length = 0, forwards = true) => {
51
+ if (length < 0) {
52
+ console.warn(`createLoopingList: length must be >= 0, given ${length}`);
53
+ } else if (length === 0) {
54
+ length = list.length;
55
+ }
56
+ const returnList = [];
57
+ if (forwards) {
58
+ for (let i = startIndex; returnList.length < length; i = (i + 1) % list.length) {
59
+ returnList.push([i, list[i]]);
60
+ }
61
+ } else {
62
+ for (let i = startIndex; returnList.length < length; i = i === 0 ? i = list.length - 1 : i - 1) {
63
+ returnList.push([i, list[i]]);
64
+ }
65
+ }
66
+ return returnList;
67
+ };
68
+
69
+ // src/util/math.ts
70
+ var clamp = (value, min = 0, max = 1) => {
71
+ return Math.min(Math.max(value, min), max);
72
+ };
73
+
74
+ // src/util/easeFunctions.ts
75
+ var EaseFunctions = class _EaseFunctions {
76
+ static cubicBezierGeneric(x1, y1, x2, y2) {
77
+ const cx = 3 * x1;
78
+ const bx = 3 * (x2 - x1) - cx;
79
+ const ax = 1 - cx - bx;
80
+ const cy = 3 * y1;
81
+ const by = 3 * (y2 - y1) - cy;
82
+ const ay = 1 - cy - by;
83
+ const x = (t) => ((ax * t + bx) * t + cx) * t;
84
+ const y = (t) => ((ay * t + by) * t + cy) * t;
85
+ return {
86
+ x,
87
+ y
139
88
  };
140
- const left = () => {
141
- if (canGoLeft()) {
142
- startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1));
143
- }
89
+ }
90
+ static cubicBezier(x1, y1, x2, y2) {
91
+ const { y } = _EaseFunctions.cubicBezierGeneric(x1, y1, x2, y2);
92
+ return (t) => {
93
+ t = clamp(t);
94
+ return y(t);
144
95
  };
145
- const right = () => {
146
- if (canGoRight()) {
147
- startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length));
96
+ }
97
+ static easeInEaseOut(t) {
98
+ return _EaseFunctions.cubicBezier(0.65, 0, 0.35, 1)(t);
99
+ }
100
+ };
101
+
102
+ // src/util/loopingArray.ts
103
+ var LoopingArrayCalculator = class _LoopingArrayCalculator {
104
+ constructor(length, isLooping = true, allowedOverScroll = 0.1) {
105
+ if (allowedOverScroll < 0 || length < 1) {
106
+ throw new Error("Invalid parameters: allowedOverScroll >= 0 and length >= 1 must be true");
107
+ }
108
+ this.length = length;
109
+ this.isLooping = isLooping;
110
+ this.allowedOverScroll = allowedOverScroll;
111
+ }
112
+ getCorrectedPosition(position) {
113
+ if (!this.isLooping) {
114
+ return Math.max(-this.allowedOverScroll, Math.min(this.allowedOverScroll + this.length - 1, position));
115
+ }
116
+ if (position >= this.length) {
117
+ return position % this.length;
118
+ }
119
+ if (position < 0) {
120
+ return this.length - Math.abs(position) % this.length;
121
+ }
122
+ return position;
123
+ }
124
+ static withoutOffset(position) {
125
+ return position + _LoopingArrayCalculator.getOffset(position);
126
+ }
127
+ static getOffset(position) {
128
+ return Math.round(position) - position;
129
+ }
130
+ /**
131
+ * @return absolute distance forwards or Infinity when the target cannot be reached (only possible when not isLooping)
132
+ */
133
+ getDistanceDirectional(position, target, direction) {
134
+ if (!this.isLooping && (position < -this.allowedOverScroll || position > this.allowedOverScroll + this.length - 1)) {
135
+ throw new Error("Invalid parameters: position is out of bounds.");
136
+ }
137
+ const isForwardInvalid = direction === 1 && position > target;
138
+ const isBackwardInvalid = direction === -1 && target < position;
139
+ if (!this.isLooping && (isForwardInvalid || isBackwardInvalid)) {
140
+ return Infinity;
141
+ }
142
+ if (direction === -1) {
143
+ return this.getDistanceDirectional(target, position, 1);
144
+ }
145
+ position = this.getCorrectedPosition(position);
146
+ target = this.getCorrectedPosition(target);
147
+ let distance = (target - position) * direction;
148
+ if (distance < 0) {
149
+ distance = this.length - Math.abs(position) % this.length + target;
150
+ }
151
+ return distance;
152
+ }
153
+ getDistanceForward(position, target) {
154
+ return this.getDistanceDirectional(position, target, 1);
155
+ }
156
+ getDistanceBackward(position, target) {
157
+ return this.getDistanceDirectional(position, target, -1);
158
+ }
159
+ getDistance(position, target) {
160
+ const forwardDistance = this.getDistanceForward(position, target);
161
+ const backwardDistance = this.getDistanceBackward(position, target);
162
+ return Math.min(forwardDistance, backwardDistance);
163
+ }
164
+ getBestDirection(position, target) {
165
+ const forwardDistance = this.getDistanceForward(position, target);
166
+ const backwardDistance = this.getDistanceBackward(position, target);
167
+ return forwardDistance < backwardDistance ? 1 : -1;
168
+ }
169
+ };
170
+
171
+ // src/components/layout/Carousel.tsx
172
+ var import_jsx_runtime = require("react/jsx-runtime");
173
+ var Carousel = ({
174
+ children,
175
+ animationTime = 200,
176
+ isLooping = false,
177
+ isAutoLooping = false,
178
+ autoLoopingTimeOut = 5e3,
179
+ autoLoopAnimationTime = 500,
180
+ hintNext = false,
181
+ arrows = false,
182
+ dots = true,
183
+ overScrollThreshold = 0.1,
184
+ blurColor = "from-white",
185
+ className = "",
186
+ heightClassName = "h-[24rem]",
187
+ widthClassName = "w-[70%] desktop:w-1/2"
188
+ }) => {
189
+ if (isAutoLooping && !isLooping) {
190
+ console.error("When isAutoLooping is true, isLooping should also be true");
191
+ isLooping = true;
192
+ }
193
+ const [{
194
+ currentPosition,
195
+ dragState,
196
+ animationState
197
+ }, setCarouselInformation] = (0, import_react.useState)({
198
+ currentPosition: 0
199
+ });
200
+ const animationId = (0, import_react.useRef)(void 0);
201
+ const timeOut = (0, import_react.useRef)(void 0);
202
+ autoLoopingTimeOut = Math.max(0, autoLoopingTimeOut);
203
+ const length = children.length;
204
+ const paddingItemCount = 3;
205
+ const util = (0, import_react.useMemo)(() => new LoopingArrayCalculator(length, isLooping, overScrollThreshold), [length, isLooping, overScrollThreshold]);
206
+ const currentIndex = util.getCorrectedPosition(LoopingArrayCalculator.withoutOffset(currentPosition));
207
+ animationTime = Math.max(200, animationTime);
208
+ autoLoopAnimationTime = Math.max(200, autoLoopAnimationTime);
209
+ const getStyleOffset = (index) => {
210
+ const baseOffset = -50 + (index - currentPosition) * 100;
211
+ return `${baseOffset}%`;
212
+ };
213
+ const animation = (0, import_react.useCallback)((time) => {
214
+ let keepAnimating = true;
215
+ setCarouselInformation((state) => {
216
+ const {
217
+ animationState: animationState2,
218
+ dragState: dragState2
219
+ } = state;
220
+ if (animationState2 === void 0 || dragState2 !== void 0) {
221
+ keepAnimating = false;
222
+ return state;
223
+ }
224
+ if (!animationState2.startTime || !animationState2.lastUpdateTime) {
225
+ return {
226
+ ...state,
227
+ animationState: {
228
+ ...animationState2,
229
+ startTime: time,
230
+ lastUpdateTime: time
231
+ }
232
+ };
233
+ }
234
+ const useAnimationTime = animationState2.isAutoLooping ? autoLoopAnimationTime : animationTime;
235
+ const progress = clamp((time - animationState2.startTime) / useAnimationTime);
236
+ const easedProgress = EaseFunctions.easeInEaseOut(progress);
237
+ const distance = util.getDistanceDirectional(animationState2.startPosition, animationState2.targetPosition, animationState2.direction);
238
+ const newPosition = util.getCorrectedPosition(easedProgress * distance * animationState2.direction + animationState2.startPosition);
239
+ if (animationState2.targetPosition === newPosition || progress === 1) {
240
+ keepAnimating = false;
241
+ return {
242
+ currentPosition: LoopingArrayCalculator.withoutOffset(newPosition),
243
+ animationState: void 0
244
+ };
245
+ }
246
+ return {
247
+ currentPosition: newPosition,
248
+ animationState: {
249
+ ...animationState2,
250
+ lastUpdateTime: time
148
251
  }
252
+ };
253
+ });
254
+ if (keepAnimating) {
255
+ animationId.current = requestAnimationFrame((time1) => animation(time1));
256
+ }
257
+ }, [animationTime, autoLoopAnimationTime, util]);
258
+ (0, import_react.useEffect)(() => {
259
+ if (animationState) {
260
+ animationId.current = requestAnimationFrame(animation);
261
+ }
262
+ return () => {
263
+ if (animationId.current) {
264
+ cancelAnimationFrame(animationId.current);
265
+ animationId.current = 0;
266
+ }
149
267
  };
150
- let items = children.map((item, index) => ({
151
- index,
152
- item
268
+ }, [animationState]);
269
+ const startAutoLoop = () => setCarouselInformation((prevState) => ({
270
+ ...prevState,
271
+ dragState: prevState.dragState,
272
+ animationState: prevState.animationState || prevState.dragState ? prevState.animationState : {
273
+ startPosition: currentPosition,
274
+ targetPosition: (currentPosition + 1) % length,
275
+ direction: 1,
276
+ // always move forward
277
+ isAutoLooping: true
278
+ }
279
+ }));
280
+ (0, import_react.useEffect)(() => {
281
+ if (!animationId.current && !animationState && !dragState && !timeOut.current) {
282
+ if (autoLoopingTimeOut > 0) {
283
+ timeOut.current = setTimeout(() => {
284
+ startAutoLoop();
285
+ timeOut.current = void 0;
286
+ }, autoLoopingTimeOut);
287
+ } else {
288
+ startAutoLoop();
289
+ }
290
+ }
291
+ }, [animationState, dragState, animationId.current, timeOut.current]);
292
+ const startAnimation = (targetPosition) => {
293
+ if (targetPosition === void 0) {
294
+ targetPosition = LoopingArrayCalculator.withoutOffset(currentPosition);
295
+ }
296
+ if (targetPosition === currentPosition) {
297
+ return;
298
+ }
299
+ const direction = util.getBestDirection(currentPosition, targetPosition);
300
+ clearTimeout(timeOut.current);
301
+ timeOut.current = void 0;
302
+ if (animationId.current) {
303
+ cancelAnimationFrame(animationId.current);
304
+ animationId.current = void 0;
305
+ }
306
+ setCarouselInformation((prevState) => ({
307
+ ...prevState,
308
+ dragState: void 0,
309
+ animationState: {
310
+ targetPosition,
311
+ direction,
312
+ startPosition: currentPosition,
313
+ isAutoLooping: false
314
+ },
315
+ timeOut: void 0
153
316
  }));
154
- if (isLooping) {
155
- const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({
156
- index,
157
- item
158
- }));
159
- const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({
160
- index,
161
- item
162
- }));
163
- items = [
164
- ...before,
165
- ...items,
166
- ...after
167
- ];
168
- }
169
- const onDragStart = (x) => setCarouselInformation(prevState => ({
170
- ...prevState,
171
- dragState: {
172
- lastX: x,
173
- startX: x,
174
- startTime: Date.now(),
175
- startIndex: currentPosition,
176
- },
177
- animationState: undefined // cancel animation
317
+ };
318
+ const canGoLeft = () => {
319
+ return isLooping || currentPosition !== 0;
320
+ };
321
+ const canGoRight = () => {
322
+ return isLooping || currentPosition !== length - 1;
323
+ };
324
+ const left = () => {
325
+ if (canGoLeft()) {
326
+ startAnimation(currentPosition === 0 ? length - 1 : LoopingArrayCalculator.withoutOffset(currentPosition - 1));
327
+ }
328
+ };
329
+ const right = () => {
330
+ if (canGoRight()) {
331
+ startAnimation(LoopingArrayCalculator.withoutOffset((currentPosition + 1) % length));
332
+ }
333
+ };
334
+ let items = children.map((item, index) => ({
335
+ index,
336
+ item
337
+ }));
338
+ if (isLooping) {
339
+ const before = createLoopingListWithIndex(children, length - 1, paddingItemCount, false).reverse().map(([index, item]) => ({
340
+ index,
341
+ item
178
342
  }));
179
- const onDrag = (x, width) => {
180
- // For some weird reason the clientX is 0 on the last dragUpdate before drag end causing issues
181
- if (!dragState || x === 0) {
182
- return;
183
- }
184
- const offsetUpdate = (dragState.lastX - x) / width;
185
- const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate);
186
- setCarouselInformation(prevState => ({
187
- ...prevState,
188
- currentPosition: newPosition,
189
- dragState: {
190
- ...dragState,
191
- lastX: x
192
- },
193
- }));
194
- };
195
- const onDragEnd = (x, width) => {
196
- if (!dragState) {
197
- return;
198
- }
199
- const distance = dragState.startX - x;
200
- const relativeDistance = distance / width;
201
- const duration = (Date.now() - dragState.startTime); // in milliseconds
202
- const velocity = distance / (Date.now() - dragState.startTime);
203
- const isSlide = Math.abs(velocity) > 2 || (duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50));
204
- if (isSlide) {
205
- if (distance > 0 && canGoRight()) {
206
- right();
207
- return;
208
- }
209
- else if (distance < 0 && canGoLeft()) {
210
- left();
211
- return;
212
- }
213
- }
214
- startAnimation();
215
- };
216
- const dragHandlers = {
217
- draggable: true,
218
- onDragStart: (event) => {
219
- onDragStart(event.clientX);
220
- event.dataTransfer.setDragImage(document.createElement('div'), 0, 0);
221
- },
222
- onDrag: (event) => onDrag(event.clientX, event.target.getBoundingClientRect().width),
223
- onDragEnd: (event) => onDragEnd(event.clientX, event.target.getBoundingClientRect().width),
224
- onTouchStart: (event) => onDragStart(event.touches[0].clientX),
225
- onTouchMove: (event) => onDrag(event.touches[0].clientX, event.target.getBoundingClientRect().width),
226
- onTouchEnd: (event) => onDragEnd(event.changedTouches[0].clientX, event.target.getBoundingClientRect().width),
227
- onTouchCancel: (event) => onDragEnd(event.changedTouches[0].clientX, event.target.getBoundingClientRect().width),
228
- };
229
- return (_jsxs("div", { className: "col items-center w-full gap-y-2", children: [_jsxs("div", { className: clsx(`relative w-full overflow-hidden`, heightClassName, className), children: [arrows && (_jsxs(_Fragment, { children: [_jsx("div", { className: clsx('absolute z-10 left-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoLeft() }), onClick: () => left(), children: _jsx(ChevronLeft, { size: 32 }) }), _jsx("div", { className: clsx('absolute z-10 right-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2', { hidden: !canGoRight() }), onClick: () => right(), children: _jsx(ChevronRight, { size: 32 }) })] })), hintNext ? (_jsxs("div", { className: clsx(`relative row h-full`, heightClassName), children: [_jsx("div", { className: "relative row h-full w-full px-2 overflow-hidden", children: items.map(({ item, index }, listIndex) => (_jsx("div", { className: clsx(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { '!cursor-grabbing': !!dragState }), style: { translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) }, ...dragHandlers, onClick: () => startAnimation(index), children: item }, listIndex))) }), _jsx("div", { className: clsx(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor) }), _jsx("div", { className: clsx(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor) })] })) : (_jsx("div", { className: clsx('px-16 h-full', { '!cursor-grabbing': !!dragState }), ...dragHandlers, children: children[currentIndex] }))] }), dots && (_jsx("div", { className: "row items-center justify-center w-full my-2", children: range(0, length - 1).map(index => (_jsx("button", { className: clsx('w-[2rem] min-w-[2rem] h-[0.75rem] min-h-[0.75rem] hover:bg-primary hover:brightness-90 first:rounded-l-md last:rounded-r-md', {
230
- 'bg-gray-200': currentIndex !== index,
231
- 'bg-primary': currentIndex === index
232
- }), onClick: () => startAnimation(index) }, index))) }))] }));
343
+ const after = createLoopingListWithIndex(children, 0, paddingItemCount).map(([index, item]) => ({
344
+ index,
345
+ item
346
+ }));
347
+ items = [
348
+ ...before,
349
+ ...items,
350
+ ...after
351
+ ];
352
+ }
353
+ const onDragStart = (x) => setCarouselInformation((prevState) => ({
354
+ ...prevState,
355
+ dragState: {
356
+ lastX: x,
357
+ startX: x,
358
+ startTime: Date.now(),
359
+ startIndex: currentPosition
360
+ },
361
+ animationState: void 0
362
+ // cancel animation
363
+ }));
364
+ const onDrag = (x, width) => {
365
+ if (!dragState || x === 0) {
366
+ return;
367
+ }
368
+ const offsetUpdate = (dragState.lastX - x) / width;
369
+ const newPosition = util.getCorrectedPosition(currentPosition + offsetUpdate);
370
+ setCarouselInformation((prevState) => ({
371
+ ...prevState,
372
+ currentPosition: newPosition,
373
+ dragState: {
374
+ ...dragState,
375
+ lastX: x
376
+ }
377
+ }));
378
+ };
379
+ const onDragEnd = (x, width) => {
380
+ if (!dragState) {
381
+ return;
382
+ }
383
+ const distance = dragState.startX - x;
384
+ const relativeDistance = distance / width;
385
+ const duration = Date.now() - dragState.startTime;
386
+ const velocity = distance / (Date.now() - dragState.startTime);
387
+ const isSlide = Math.abs(velocity) > 2 || duration < 200 && (Math.abs(relativeDistance) > 0.2 || Math.abs(distance) > 50);
388
+ if (isSlide) {
389
+ if (distance > 0 && canGoRight()) {
390
+ right();
391
+ return;
392
+ } else if (distance < 0 && canGoLeft()) {
393
+ left();
394
+ return;
395
+ }
396
+ }
397
+ startAnimation();
398
+ };
399
+ const dragHandlers = {
400
+ draggable: true,
401
+ onDragStart: (event) => {
402
+ onDragStart(event.clientX);
403
+ event.dataTransfer.setDragImage(document.createElement("div"), 0, 0);
404
+ },
405
+ onDrag: (event) => onDrag(event.clientX, event.target.getBoundingClientRect().width),
406
+ onDragEnd: (event) => onDragEnd(event.clientX, event.target.getBoundingClientRect().width),
407
+ onTouchStart: (event) => onDragStart(event.touches[0].clientX),
408
+ onTouchMove: (event) => onDrag(event.touches[0].clientX, event.target.getBoundingClientRect().width),
409
+ onTouchEnd: (event) => onDragEnd(event.changedTouches[0].clientX, event.target.getBoundingClientRect().width),
410
+ onTouchCancel: (event) => onDragEnd(event.changedTouches[0].clientX, event.target.getBoundingClientRect().width)
411
+ };
412
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "col items-center w-full gap-y-2", children: [
413
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_clsx.default)(`relative w-full overflow-hidden`, heightClassName, className), children: [
414
+ arrows && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
415
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
416
+ "div",
417
+ {
418
+ className: (0, import_clsx.default)("absolute z-10 left-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2", { hidden: !canGoLeft() }),
419
+ onClick: () => left(),
420
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronLeft, { size: 32 })
421
+ }
422
+ ),
423
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
424
+ "div",
425
+ {
426
+ className: (0, import_clsx.default)("absolute z-10 right-0 top-1/2 -translate-y-1/2 bg-gray-200 hover:bg-gray-300 rounded-lg cursor-pointer border-black border-2", { hidden: !canGoRight() }),
427
+ onClick: () => right(),
428
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronRight, { size: 32 })
429
+ }
430
+ )
431
+ ] }),
432
+ hintNext ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_clsx.default)(`relative row h-full`, heightClassName), children: [
433
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative row h-full w-full px-2 overflow-hidden", children: items.map(({
434
+ item,
435
+ index
436
+ }, listIndex) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
437
+ "div",
438
+ {
439
+ className: (0, import_clsx.default)(`absolute left-[50%] h-full overflow-hidden`, widthClassName, { "!cursor-grabbing": !!dragState }),
440
+ style: { translate: getStyleOffset(listIndex - (isLooping ? paddingItemCount : 0)) },
441
+ ...dragHandlers,
442
+ onClick: () => startAnimation(index),
443
+ children: item
444
+ },
445
+ listIndex
446
+ )) }),
447
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
448
+ "div",
449
+ {
450
+ className: (0, import_clsx.default)(`hidden pointer-events-none desktop:block absolute left-0 h-full w-[20%] bg-gradient-to-r to-transparent`, blurColor)
451
+ }
452
+ ),
453
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
454
+ "div",
455
+ {
456
+ className: (0, import_clsx.default)(`hidden pointer-events-none desktop:block absolute right-0 h-full w-[20%] bg-gradient-to-l to-transparent`, blurColor)
457
+ }
458
+ )
459
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_clsx.default)("px-16 h-full", { "!cursor-grabbing": !!dragState }), ...dragHandlers, children: children[currentIndex] })
460
+ ] }),
461
+ dots && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
462
+ "div",
463
+ {
464
+ className: "row items-center justify-center w-full my-2",
465
+ children: range(0, length - 1).map((index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
466
+ "button",
467
+ {
468
+ className: (0, import_clsx.default)("w-[2rem] min-w-[2rem] h-[0.75rem] min-h-[0.75rem] hover:bg-primary hover:brightness-90 first:rounded-l-md last:rounded-r-md", {
469
+ "bg-gray-200": currentIndex !== index,
470
+ "bg-primary": currentIndex === index
471
+ }),
472
+ onClick: () => startAnimation(index)
473
+ },
474
+ index
475
+ ))
476
+ }
477
+ )
478
+ ] });
233
479
  };
480
+ // Annotate the CommonJS export names for ESM import in node:
481
+ 0 && (module.exports = {
482
+ Carousel
483
+ });
484
+ //# sourceMappingURL=Carousel.js.map