@infonomic/uikit 1.5.0 → 2.1.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 (370) hide show
  1. package/dist/components/button/button-group.d.ts +1 -1
  2. package/dist/components/button/button-group.d.ts.map +1 -1
  3. package/dist/components/button/button-group.js +1 -1
  4. package/dist/components/button/button.d.ts.map +1 -1
  5. package/dist/components/button/button.js +1 -1
  6. package/dist/components/button/control-buttons.d.ts.map +1 -1
  7. package/dist/components/button/control-buttons.js +3 -3
  8. package/dist/components/button/copy-button.d.ts.map +1 -1
  9. package/dist/components/button/copy-button.js +2 -2
  10. package/dist/components/button/icon-button.d.ts.map +1 -1
  11. package/dist/components/button/icon-button.js +1 -1
  12. package/dist/components/button/index.js +17 -1
  13. package/dist/components/card/card.d.ts.map +1 -1
  14. package/dist/components/dropdown/dropdown.d.ts +1 -1
  15. package/dist/components/dropdown/dropdown.d.ts.map +1 -1
  16. package/dist/components/input/checkbox.d.ts.map +1 -1
  17. package/dist/components/input/checkbox.js +4 -4
  18. package/dist/components/input/error-text.d.ts.map +1 -1
  19. package/dist/components/input/error-text.js +1 -1
  20. package/dist/components/input/help-text.d.ts.map +1 -1
  21. package/dist/components/input/help-text.js +1 -1
  22. package/dist/components/input/input-adornment.d.ts.map +1 -1
  23. package/dist/components/input/input-adornment.js +1 -1
  24. package/dist/components/input/input.d.ts.map +1 -1
  25. package/dist/components/input/input.js +3 -3
  26. package/dist/components/input/label.d.ts.map +1 -1
  27. package/dist/components/input/label.js +1 -1
  28. package/dist/components/input/radio-group.js +1 -1
  29. package/dist/components/input/select.d.ts +1 -1
  30. package/dist/components/input/select.d.ts.map +1 -1
  31. package/dist/components/input/select.js +3 -3
  32. package/dist/components/input/text-area.d.ts.map +1 -1
  33. package/dist/components/input/text-area.js +3 -3
  34. package/dist/components/notifications/alert.d.ts.map +1 -1
  35. package/dist/components/notifications/alert.js +2 -2
  36. package/dist/components/notifications/toast.js +4 -4
  37. package/dist/components/pager/ellipses.d.ts.map +1 -1
  38. package/dist/components/pager/ellipses.js +1 -1
  39. package/dist/components/pager/first-button.d.ts.map +1 -1
  40. package/dist/components/pager/first-button.js +2 -2
  41. package/dist/components/pager/last-button.d.ts.map +1 -1
  42. package/dist/components/pager/last-button.js +2 -2
  43. package/dist/components/pager/next-button.d.ts.map +1 -1
  44. package/dist/components/pager/next-button.js +2 -2
  45. package/dist/components/pager/number-button.d.ts.map +1 -1
  46. package/dist/components/pager/number-button.js +2 -2
  47. package/dist/components/pager/pagination.d.ts +1 -1
  48. package/dist/components/pager/pagination.d.ts.map +1 -1
  49. package/dist/components/pager/pagination.js +5 -5
  50. package/dist/components/pager/previous-button.d.ts.map +1 -1
  51. package/dist/components/pager/previous-button.js +2 -2
  52. package/dist/components/scroll-area/scroll-area.js +1 -1
  53. package/dist/components/table/table.d.ts.map +1 -1
  54. package/dist/components/table/table.js +2 -2
  55. package/dist/components/tabs/tabs.d.ts +1 -1
  56. package/dist/components/tabs/tabs.d.ts.map +1 -1
  57. package/dist/components/tabs/tabs.js +1 -1
  58. package/dist/components/tooltip/tooltip.d.ts.map +1 -1
  59. package/dist/icons/index.js +1 -17
  60. package/package.json +9 -5
  61. package/src/astro.d.ts +43 -0
  62. package/src/astro.js +2 -2
  63. package/src/components/@types/shared.ts +24 -0
  64. package/src/components/accordion/accordion.module.css +60 -0
  65. package/src/components/accordion/accordion.stories.tsx +117 -0
  66. package/src/components/accordion/accordion.tsx +105 -0
  67. package/src/components/animation/fade-in-lift.stories.tsx +81 -0
  68. package/src/components/animation/fade-in-lift.tsx +42 -0
  69. package/src/components/avatar/avatar.module.css +54 -0
  70. package/src/components/avatar/avatar.stories.tsx +28 -0
  71. package/src/components/avatar/avatar.tsx +19 -0
  72. package/src/components/button/@types/button.ts +17 -0
  73. package/src/components/button/button-group.module.css +17 -0
  74. package/src/components/button/button-group.stories.tsx +45 -0
  75. package/src/components/button/button-group.tsx +132 -0
  76. package/src/components/button/button-icon.stories.tsx +145 -0
  77. package/src/components/button/button-intents.stories.tsx +50 -0
  78. package/src/components/button/button-variants.stories.tsx +60 -0
  79. package/src/components/button/button.astro +86 -0
  80. package/src/components/button/button.module.css +533 -0
  81. package/src/components/button/button.tsx +81 -0
  82. package/src/components/button/control-buttons.module.css +144 -0
  83. package/src/components/button/control-buttons.stories.tsx +60 -0
  84. package/src/components/button/control-buttons.tsx +137 -0
  85. package/src/components/button/copy-button.module.css +31 -0
  86. package/src/components/button/copy-button.stories.tsx +50 -0
  87. package/src/components/button/copy-button.tsx +92 -0
  88. package/src/components/button/icon-button.astro +47 -0
  89. package/src/components/button/icon-button.tsx +44 -0
  90. package/src/components/button/index.ts +5 -0
  91. package/src/components/calendar/calendar.module.css +315 -0
  92. package/src/components/calendar/calendar.stories.tsx +139 -0
  93. package/src/components/calendar/calendar.tsx +173 -0
  94. package/src/components/card/card-content.astro +14 -0
  95. package/src/components/card/card-description.astro +14 -0
  96. package/src/components/card/card-footer.astro +14 -0
  97. package/src/components/card/card-header.astro +14 -0
  98. package/src/components/card/card-title.astro +14 -0
  99. package/src/components/card/card.astro +41 -0
  100. package/src/components/card/card.module.css +67 -0
  101. package/src/components/card/card.stories.tsx +61 -0
  102. package/src/components/card/card.tsx +86 -0
  103. package/src/components/container/container.astro +13 -0
  104. package/src/components/container/container.module.css +28 -0
  105. package/src/components/container/container.stories.tsx +42 -0
  106. package/src/components/container/container.tsx +23 -0
  107. package/src/components/dropdown/dropdown.module.css +131 -0
  108. package/src/components/dropdown/dropdown.stories.tsx +103 -0
  109. package/src/components/dropdown/dropdown.tsx +193 -0
  110. package/src/components/hamburger/hamburger.astro +30 -0
  111. package/src/components/hamburger/hamburger.tsx +66 -0
  112. package/src/components/input/@types/checkbox.ts +20 -0
  113. package/src/components/input/@types/input.ts +20 -0
  114. package/src/components/input/checkbox-group.tsx +78 -0
  115. package/src/components/input/checkbox.module.css +267 -0
  116. package/src/components/input/checkbox.stories.tsx +240 -0
  117. package/src/components/input/checkbox.tsx +95 -0
  118. package/src/components/input/error-text.astro +14 -0
  119. package/src/components/input/error-text.module.css +19 -0
  120. package/src/components/input/error-text.tsx +18 -0
  121. package/src/components/input/errors.tsx +37 -0
  122. package/src/components/input/help-text.astro +13 -0
  123. package/src/components/input/help-text.module.css +19 -0
  124. package/src/components/input/help-text.tsx +13 -0
  125. package/src/components/input/index.tsx +8 -0
  126. package/src/components/input/input-adornment.astro +26 -0
  127. package/src/components/input/input-adornment.module.css +18 -0
  128. package/src/components/input/input-adornment.tsx +36 -0
  129. package/src/components/input/input.astro +99 -0
  130. package/src/components/input/input.module.css +310 -0
  131. package/src/components/input/input.stories.tsx +174 -0
  132. package/src/components/input/input.tsx +103 -0
  133. package/src/components/input/label.astro +24 -0
  134. package/src/components/input/label.module.css +28 -0
  135. package/src/components/input/label.tsx +25 -0
  136. package/src/components/input/radio-group.module.css +219 -0
  137. package/src/components/input/radio-group.stories.tsx +73 -0
  138. package/src/components/input/radio-group.tsx +67 -0
  139. package/src/components/input/select.module.css +75 -0
  140. package/src/components/input/select.stories.tsx +34 -0
  141. package/src/components/input/select.tsx +115 -0
  142. package/src/components/input/text-area.module.css +9 -0
  143. package/src/components/input/text-area.stories.tsx +51 -0
  144. package/src/components/input/text-area.tsx +81 -0
  145. package/src/components/input/utils.ts +21 -0
  146. package/src/components/notifications/@types/alert.ts +12 -0
  147. package/src/components/notifications/@types/toast.ts +12 -0
  148. package/src/components/notifications/alert.module.css +114 -0
  149. package/src/components/notifications/alert.stories.tsx +39 -0
  150. package/src/components/notifications/alert.tsx +117 -0
  151. package/src/components/notifications/index.ts +2 -0
  152. package/src/components/notifications/toast.module.css +237 -0
  153. package/src/components/notifications/toast.stories.tsx +42 -0
  154. package/src/components/notifications/toast.tsx +124 -0
  155. package/src/components/overlay/index.stories.tsx +29 -0
  156. package/src/components/overlay/index.ts +2 -0
  157. package/src/components/overlay/overlay.module.css +41 -0
  158. package/src/components/overlay/overlay.tsx +61 -0
  159. package/src/components/pager/@types/index.ts +2 -0
  160. package/src/components/pager/ellipses.tsx +18 -0
  161. package/src/components/pager/event-pager.tsx +18 -0
  162. package/src/components/pager/first-button.tsx +53 -0
  163. package/src/components/pager/hooks/types/usePagination.ts +80 -0
  164. package/src/components/pager/hooks/usePagination.ts +140 -0
  165. package/src/components/pager/icons/first.tsx +33 -0
  166. package/src/components/pager/icons/index.tsx +4 -0
  167. package/src/components/pager/icons/last.tsx +33 -0
  168. package/src/components/pager/icons/next.tsx +20 -0
  169. package/src/components/pager/icons/previous.tsx +20 -0
  170. package/src/components/pager/index.ts +4 -0
  171. package/src/components/pager/last-button.tsx +57 -0
  172. package/src/components/pager/next-button.tsx +55 -0
  173. package/src/components/pager/number-button.tsx +83 -0
  174. package/src/components/pager/pagination.module.css +165 -0
  175. package/src/components/pager/pagination.stories.tsx +190 -0
  176. package/src/components/pager/pagination.tsx +266 -0
  177. package/src/components/pager/previous-button.tsx +51 -0
  178. package/src/components/scroll-area/scroll-area.module.css +80 -0
  179. package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
  180. package/src/components/scroll-area/scroll-area.tsx +22 -0
  181. package/src/components/scroll-to-top/scroll-to-top.tsx +59 -0
  182. package/src/components/section/section.astro +13 -0
  183. package/src/components/section/section.module.css +7 -0
  184. package/src/components/section/section.tsx +23 -0
  185. package/src/components/shimmer/shimmer.module.css +53 -0
  186. package/src/components/shimmer/shimmer.stories.tsx +24 -0
  187. package/src/components/shimmer/shimmer.tsx +70 -0
  188. package/src/components/table/table.module.css +100 -0
  189. package/src/components/table/table.stories.tsx +95 -0
  190. package/src/components/table/table.tsx +165 -0
  191. package/src/components/tabs/tabs.module.css +64 -0
  192. package/src/components/tabs/tabs.stories.tsx +47 -0
  193. package/src/components/tabs/tabs.tsx +75 -0
  194. package/src/components/timeline/timeline.module.css +87 -0
  195. package/src/components/timeline/timeline.stories.tsx +50 -0
  196. package/src/components/timeline/timeline.tsx +177 -0
  197. package/src/components/tooltip/tooltip.module.css +55 -0
  198. package/src/components/tooltip/tooltip.stories.tsx +59 -0
  199. package/src/components/tooltip/tooltip.tsx +51 -0
  200. package/src/declarations.d.ts +4 -0
  201. package/src/hooks/use-media-query.ts +20 -0
  202. package/src/icons/activity-icon.tsx +40 -0
  203. package/src/icons/calendar-icon.tsx +39 -0
  204. package/src/icons/check-icon.tsx +33 -0
  205. package/src/icons/chevron-down-icon.tsx +39 -0
  206. package/src/icons/chevron-left-double-icon.tsx +58 -0
  207. package/src/icons/chevron-left-icon.tsx +58 -0
  208. package/src/icons/chevron-right-double-icon.tsx +58 -0
  209. package/src/icons/chevron-right-icon.tsx +58 -0
  210. package/src/icons/chevrons-up-down.tsx +37 -0
  211. package/src/icons/close-icon.astro +38 -0
  212. package/src/icons/close-icon.tsx +30 -0
  213. package/src/icons/copy-icon.tsx +35 -0
  214. package/src/icons/danger-icon.tsx +18 -0
  215. package/src/icons/dashboard-icon.tsx +41 -0
  216. package/src/icons/delete-icon.tsx +34 -0
  217. package/src/icons/document-icon.tsx +38 -0
  218. package/src/icons/download-icon.tsx +39 -0
  219. package/src/icons/edit-icon.tsx +35 -0
  220. package/src/icons/ellipsis-icon.tsx +38 -0
  221. package/src/icons/email-icon.tsx +33 -0
  222. package/src/icons/external-link-icon.tsx +39 -0
  223. package/src/icons/github-icon.tsx +27 -0
  224. package/src/icons/globe-icon.tsx +50 -0
  225. package/src/icons/google-icon.tsx +44 -0
  226. package/src/icons/gripper-vertical-icon.tsx +43 -0
  227. package/src/icons/history-icon.tsx +32 -0
  228. package/src/icons/home-icon.tsx +34 -0
  229. package/src/icons/icon-element.astro +27 -0
  230. package/src/icons/icon-element.tsx +32 -0
  231. package/src/icons/icon-sprite.tsx +18 -0
  232. package/src/icons/icons.module.css +147 -0
  233. package/src/icons/index.stories.tsx +25 -0
  234. package/src/icons/index.ts +39 -0
  235. package/src/icons/info-icon.tsx +18 -0
  236. package/src/icons/infonomic-icon.tsx +173 -0
  237. package/src/icons/light-icon.astro +36 -0
  238. package/src/icons/light-icon.tsx +29 -0
  239. package/src/icons/location-pin-icon.tsx +36 -0
  240. package/src/icons/moon-icon.astro +38 -0
  241. package/src/icons/moon-icon.tsx +42 -0
  242. package/src/icons/plus-icon.tsx +34 -0
  243. package/src/icons/primary-icon.tsx +22 -0
  244. package/src/icons/refresh-icon.tsx +33 -0
  245. package/src/icons/return-icon.tsx +36 -0
  246. package/src/icons/roles-icon.tsx +34 -0
  247. package/src/icons/search-icon.astro +40 -0
  248. package/src/icons/search-icon.tsx +29 -0
  249. package/src/icons/search-menu-icon.tsx +42 -0
  250. package/src/icons/settings-gear-icon.tsx +36 -0
  251. package/src/icons/settings-sliders-icon.tsx +43 -0
  252. package/src/icons/sign-out-icon.tsx +35 -0
  253. package/src/icons/source/icon-calendar.svg +1 -0
  254. package/src/icons/source/icon-check.svg +4 -0
  255. package/src/icons/source/icon-close.svg +3 -0
  256. package/src/icons/source/icon-coinbase.svg +9 -0
  257. package/src/icons/source/icon-copy.svg +4 -0
  258. package/src/icons/source/icon-document.svg +5 -0
  259. package/src/icons/source/icon-download.svg +4 -0
  260. package/src/icons/source/icon-edit.svg +6 -0
  261. package/src/icons/source/icon-eth-purple.svg +15 -0
  262. package/src/icons/source/icon-etherscan.svg +5 -0
  263. package/src/icons/source/icon-external-link.svg +4 -0
  264. package/src/icons/source/icon-globe.svg +7 -0
  265. package/src/icons/source/icon-gripper-vertical.svg +9 -0
  266. package/src/icons/source/icon-info.svg +4 -0
  267. package/src/icons/source/icon-infonomic.svg +43 -0
  268. package/src/icons/source/icon-ledger.svg +4 -0
  269. package/src/icons/source/icon-light.svg +3 -0
  270. package/src/icons/source/icon-location-pin.svg +8 -0
  271. package/src/icons/source/icon-logout.svg +6 -0
  272. package/src/icons/source/icon-metamask.svg +32 -0
  273. package/src/icons/source/icon-moon.svg +3 -0
  274. package/src/icons/source/icon-plus.svg +4 -0
  275. package/src/icons/source/icon-refresh.svg +4 -0
  276. package/src/icons/source/icon-return.svg +4 -0
  277. package/src/icons/source/icon-search-menu.svg +13 -0
  278. package/src/icons/source/icon-search.svg +3 -0
  279. package/src/icons/source/icon-settings-gear.svg +5 -0
  280. package/src/icons/source/icon-settings.svg +12 -0
  281. package/src/icons/source/icon-wallet.svg +3 -0
  282. package/src/icons/source/icon-walletconnect.svg +4 -0
  283. package/src/icons/source/icon-x.svg +4 -0
  284. package/src/icons/stopwatch-icon.tsx +39 -0
  285. package/src/icons/success-icon.tsx +18 -0
  286. package/src/icons/types/icon.ts +8 -0
  287. package/src/icons/user-icon.tsx +33 -0
  288. package/src/icons/users-icon.tsx +35 -0
  289. package/src/icons/wallet-icon.tsx +29 -0
  290. package/src/icons/warning-icon.tsx +18 -0
  291. package/src/icons/x-icon.tsx +33 -0
  292. package/src/loaders/ellipses.tsx +36 -0
  293. package/src/loaders/loaders.stories.tsx +46 -0
  294. package/src/loaders/ring.tsx +33 -0
  295. package/src/loaders/spinner.tsx +28 -0
  296. package/src/loaders/types/index.ts +6 -0
  297. package/src/react.ts +99 -0
  298. package/src/styles/base/animations.css +143 -0
  299. package/src/styles/base/base.css +5 -0
  300. package/src/styles/base/colors.css +163 -0
  301. package/src/styles/base/colors.stories.tsx +671 -0
  302. package/src/styles/base/reset.css +464 -0
  303. package/src/styles/base/typography.css +25 -0
  304. package/src/styles/base/vars.css +188 -0
  305. package/src/styles/components/card.css +20 -0
  306. package/src/styles/components/checkbox.css +55 -0
  307. package/src/styles/components/components.css +11 -0
  308. package/src/styles/components/directional-button.css +92 -0
  309. package/src/styles/components/dropdown.css +19 -0
  310. package/src/styles/components/fade-in-lift.css +13 -0
  311. package/src/styles/components/hamburger.css +107 -0
  312. package/src/styles/components/icon-element.css +4 -0
  313. package/src/styles/components/list-checkbox.css +60 -0
  314. package/src/styles/components/loaders.css +196 -0
  315. package/src/styles/components/popover.css +15 -0
  316. package/src/styles/components/scroll-to-top.css +89 -0
  317. package/src/styles/components/toast.css +18 -0
  318. package/src/styles/styles.css +6 -0
  319. package/src/styles/theme/autofill.css +58 -0
  320. package/src/styles/theme/scrollers.css +52 -0
  321. package/src/styles/theme/theme.css +130 -0
  322. package/src/styles/theme/theme.stories.tsx +33 -0
  323. package/src/styles/typography/code.stories.tsx +76 -0
  324. package/src/styles/typography/default.stories.tsx +51 -0
  325. package/src/styles/typography/fonts.css +30 -0
  326. package/src/styles/typography/lists.stories.tsx +50 -0
  327. package/src/styles/typography/prose.css +404 -0
  328. package/src/styles/typography/quote.stories.tsx +37 -0
  329. package/src/styles/typography.css +24 -0
  330. package/src/styles/utils/scroll-layout-shift.css +9 -0
  331. package/src/styles/utils/utility-classes.css +1278 -0
  332. package/src/styles/utils/utils.css +2 -0
  333. package/src/theme/theme-provider/index.ts +1 -0
  334. package/src/theme/theme-provider/provider.tsx +44 -0
  335. package/src/utils/capitalize.ts +6 -0
  336. package/src/utils/externalLinkProps.ts +6 -0
  337. package/src/utils/findMatch.ts +7 -0
  338. package/src/utils/getPortalRoot.ts +3 -0
  339. package/src/utils/isTouchDevice.ts +11 -0
  340. package/src/utils/objectsToArray.ts +15 -0
  341. package/src/utils/objectsToString.ts +5 -0
  342. package/src/utils/polymorphic.ts +16 -0
  343. package/src/utils/to-kebab-case.ts +5 -0
  344. package/src/widgets/datepicker/datepicker.module.css +189 -0
  345. package/src/widgets/datepicker/datepicker.stories.tsx +25 -0
  346. package/src/widgets/datepicker/datepicker.tsx +310 -0
  347. package/src/widgets/drawer/drawer-container.tsx +26 -0
  348. package/src/widgets/drawer/drawer-content.tsx +26 -0
  349. package/src/widgets/drawer/drawer-context.tsx +49 -0
  350. package/src/widgets/drawer/drawer-header.tsx +27 -0
  351. package/src/widgets/drawer/drawer-top-actions.tsx +27 -0
  352. package/src/widgets/drawer/drawer-wrapper.tsx +54 -0
  353. package/src/widgets/drawer/drawer.module.css +116 -0
  354. package/src/widgets/drawer/drawer.stories.tsx +224 -0
  355. package/src/widgets/drawer/drawer.tsx +115 -0
  356. package/src/widgets/drawer/motionDomAnimation.ts +4 -0
  357. package/src/widgets/drawer/motionDomMax.ts +4 -0
  358. package/src/widgets/modal/modal-actions.tsx +26 -0
  359. package/src/widgets/modal/modal-container.tsx +26 -0
  360. package/src/widgets/modal/modal-content.tsx +26 -0
  361. package/src/widgets/modal/modal-header.tsx +27 -0
  362. package/src/widgets/modal/modal-wrapper.tsx +50 -0
  363. package/src/widgets/modal/modal.module.css +85 -0
  364. package/src/widgets/modal/modal.stories.tsx +71 -0
  365. package/src/widgets/modal/modal.tsx +110 -0
  366. package/src/widgets/modal/motionDomAnimation.ts +4 -0
  367. package/src/widgets/modal/motionDomMax.ts +4 -0
  368. package/src/widgets/search/index.ts +1 -0
  369. package/src/widgets/search/search.stories.tsx +18 -0
  370. package/src/widgets/search/search.tsx +186 -0
@@ -0,0 +1,315 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .day-picker {
5
+ padding: var(--spacing-3)
6
+ }
7
+
8
+ /* relative flex flex-col gap-4 sm:flex-row */
9
+ .months {
10
+ position: relative;
11
+ display: flex;
12
+ flex-direction: column;
13
+ gap: var(--spacing-4);
14
+ }
15
+
16
+ /* 'relative flex h-7 items-center justify-center', */
17
+ .months-caption {
18
+ position: relative;
19
+ display: flex;
20
+ height: 1.75rem;
21
+ /* 28px */
22
+ align-items: center;
23
+ justify-content: center;
24
+ }
25
+
26
+ /* 'flex items-center justify-center gap-2 w-full',_dropdownsClassName */
27
+ .dropdowns {
28
+ display: flex;
29
+ align-items: center;
30
+ justify-content: center;
31
+ gap: var(--spacing-2);
32
+ width: 100%;
33
+ }
34
+
35
+ .select-trigger {
36
+ width: 100%;
37
+ height: 2.25rem;
38
+ /* 36px */
39
+ font-size: 0.875rem;
40
+ /* 14px */
41
+ }
42
+
43
+ .select-content {
44
+ z-index: 100;
45
+ background-color: var(--background);
46
+ color: var(--foreground);
47
+ }
48
+
49
+ .select-item {
50
+ display: flex;
51
+ align-items: center;
52
+ width: 100%;
53
+ justify-content: center;
54
+ padding: 0.25rem 0.5rem;
55
+ font-size: 0.875rem;
56
+ cursor: pointer;
57
+ border: none;
58
+ /* 14px */
59
+ }
60
+
61
+ .select-item:hover {
62
+ background-color: var(--gray-50);
63
+ color: var(--foreground);
64
+ }
65
+
66
+ .select-chevrons {
67
+ stroke: var(--primary-400);
68
+ opacity: 0.7
69
+ }
70
+
71
+ .scroll-area {
72
+ border: 1px solid var(--border-color);
73
+ height: 240px;
74
+ width: 120px;
75
+ background-color: var(--background);
76
+ text-align: center;
77
+ }
78
+
79
+ .disabled {
80
+ color: var(--muted);
81
+ opacity: 0.5;
82
+ }
83
+
84
+ /* 'invisible flex-1' */
85
+ /* This is used to hide the month when the calendar is in single mode */
86
+ /* and the month is not selected */
87
+ .hidden {
88
+ visibility: hidden;
89
+ flex: 1;
90
+ }
91
+
92
+
93
+ /* 'text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30', */
94
+ .outside {
95
+ color: var(--muted);
96
+ opacity: 0.5;
97
+ }
98
+
99
+ .outside[aria-selected='true'] {
100
+ color: var(--muted);
101
+ opacity: 0.3;
102
+ }
103
+
104
+ /* 'pt-3 text-sm' */
105
+ .footer {
106
+ padding-top: var(--spacing-3);
107
+ font-size: 0.875rem;
108
+ /* 14px */
109
+ }
110
+
111
+ .weekdays {
112
+ display: flex;
113
+ }
114
+
115
+ /* 'w-9 text-sm font-normal text-muted-foreground', */
116
+ .weekday {
117
+ width: 2.25rem;
118
+ /* 36px */
119
+ font-size: 0.875rem;
120
+ /* 14px */
121
+ font-weight: normal;
122
+ color: var(--muted);
123
+ }
124
+
125
+ /* 'truncate text-sm font-medium' */
126
+ .caption-label {
127
+ overflow: hidden;
128
+ text-overflow: ellipsis;
129
+ white-space: nowrap;
130
+ font-size: 0.875rem;
131
+ /* 14px */
132
+ font-weight: 500;
133
+ }
134
+
135
+ /* 'mx-auto mt-4' */
136
+ .month-grid {
137
+ margin-left: auto;
138
+ margin-right: auto;
139
+ margin-top: var(--spacing-4);
140
+ }
141
+
142
+ /* 'mt-2 flex w-max items-start' */
143
+ .week {
144
+ margin-top: var(--spacing-2);
145
+ display: flex;
146
+ width: max-content;
147
+ align-items: flex-start;
148
+ }
149
+
150
+ /* 'flex size-9 flex-1 items-center justify-center p-0 text-sm', */
151
+ .day {
152
+ display: flex;
153
+ width: 2.25rem;
154
+ /* 36px */
155
+ height: 2.25rem;
156
+ /* 36px */
157
+ flex: 1;
158
+ align-items: center;
159
+ justify-content: center;
160
+ padding: 0;
161
+ font-size: 0.875rem;
162
+ /* 14px */
163
+ }
164
+
165
+ /* '[&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground', */
166
+ .day>button {
167
+ color: var(--foreground);
168
+ }
169
+
170
+ /* '[&>button]:bg-accent [&>button]:text-accent-foreground', */
171
+ .today>button {
172
+ /* background-color: var(--gray-50); */
173
+ border: solid 1px var(--primary-300);
174
+ color: var(--foreground);
175
+ }
176
+
177
+ .day>button:hover,
178
+ .day-selected>button {
179
+ background-color: var(--primary-400);
180
+ color: white;
181
+ }
182
+
183
+ /* 'size-9 rounded-md p-0 font-normal transition-none aria-selected:opacity-100', */
184
+ .day-button {
185
+ width: 2.25rem;
186
+ /* 36px */
187
+ height: 2.25rem;
188
+ /* 36px */
189
+ border-radius: var(--border-radius-md);
190
+ padding: 0;
191
+ font-weight: normal;
192
+ transition: none;
193
+ }
194
+
195
+ .day-button[aria-selected='true'] {
196
+ opacity: 1;
197
+ }
198
+
199
+ /* 'bg-accent [&>button]:bg-primary [&>button]:text-primary-foreground [&>button]:hover:bg-primary [&>button]:hover:text-primary-foreground' */
200
+ .button-range {
201
+ background-color: var(--gray-100);
202
+ color: var(--foreground);
203
+ }
204
+
205
+ .button-range>button {
206
+ background-color: var(--primary-400);
207
+ color: white;
208
+ }
209
+
210
+ .button-range>button:hover {
211
+ background-color: var(--primary-400);
212
+ color: var(--foreground);
213
+ }
214
+
215
+ .range-start {
216
+ border-top-left-radius: var(--border-radius-md);
217
+ border-bottom-left-radius: var(--border-radius-md);
218
+ }
219
+
220
+ .range-end {
221
+ border-top-right-radius: var(--border-radius-md);
222
+ border-bottom-right-radius: var(--border-radius-md);
223
+ }
224
+
225
+ /* 'bg-accent !text-foreground [&>button]:bg-transparent [&>button]:!text-foreground [&>button]:hover:bg-transparent [&>button]:hover:!text-foreground', */
226
+ .range-middle {
227
+ background-color: var(--gray-50);
228
+ color: var(--foreground);
229
+ }
230
+
231
+ .range-middle>button,
232
+ .range-middle>button:hover {
233
+ background-color: transparent;
234
+ color: var(--foreground);
235
+ }
236
+
237
+ @media (min-width: 640px) {
238
+ .months {
239
+ flex-direction: row;
240
+ }
241
+ }
242
+
243
+ /* 🌙 Dark via `.dark` class. We rely on the
244
+ * consuming application to detect a user's preferred
245
+ * color scheme - either by header or cookie, and set
246
+ * a root html class accordingly
247
+ */
248
+ :global(.dark) {
249
+ .select-content {
250
+ background-color: var(--canvas-800);
251
+ color: var(--foreground);
252
+ }
253
+
254
+ .scroll-area {
255
+ background-color: var(--canvas-800);
256
+ color: var(--foreground);
257
+ }
258
+
259
+ .select-item:hover {
260
+ background-color: var(--primary-400);
261
+ color: var(--foreground);
262
+ }
263
+
264
+ .select-chevrons {
265
+ stroke: var(--primary-200);
266
+ opacity: 0.7;
267
+ }
268
+
269
+ .footer {
270
+ color: var(--muted);
271
+ }
272
+
273
+ .day>button {
274
+ color: var(--foreground);
275
+ }
276
+
277
+ .day>button:hover,
278
+ .day-selected>button {
279
+ background-color: var(--primary-400);
280
+ color: var(--foreground);
281
+ }
282
+
283
+ /* '[&>button]:bg-accent [&>button]:text-accent-foreground', */
284
+ .today>button {
285
+ /* background-color: var(--canvas-700); */
286
+ border: solid 1px var(--primary-300);
287
+ color: var(--foreground);
288
+ }
289
+
290
+ .button-range {
291
+ background-color: var(--canvas-700);
292
+ color: var(--foreground);
293
+ }
294
+
295
+ .button-range>button {
296
+ background-color: var(--primary-400);
297
+ color: var(--foreground);
298
+ }
299
+
300
+ .button-range>button:hover {
301
+ background-color: var(--primary-400);
302
+ color: var(--foreground);
303
+ }
304
+
305
+ .range-middle {
306
+ background-color: var(--canvas-700);
307
+ color: var(--foreground);
308
+ }
309
+
310
+ .range-middle>button {
311
+ background-color: var(--canvas-700);
312
+ color: var(--foreground);
313
+ }
314
+ }
315
+ }
@@ -0,0 +1,139 @@
1
+ import type { Meta } from '@storybook/react-vite'
2
+ import { format } from 'date-fns'
3
+ import { useRef, useState } from 'react'
4
+ import type { DateRange } from 'react-day-picker'
5
+ import { Button } from '../button/button.js'
6
+ import { Calendar as CalendarComponent } from './calendar.js'
7
+
8
+ const meta: Meta<typeof CalendarComponent> = {
9
+ /* 👇 The title prop is optional.
10
+ * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
11
+ * to learn how to generate automatic titles
12
+ */
13
+ title: 'Components/Calendar',
14
+ component: CalendarComponent,
15
+ }
16
+
17
+ export default meta
18
+
19
+ export const Calendar = (): React.JSX.Element => {
20
+ const [isOpen, setIsOpen] = useState(false)
21
+ const [time, setTime] = useState<string>('05:00')
22
+ const [date, setDate] = useState<Date>(new Date())
23
+ const [month, setMonth] = useState<Date>(date)
24
+
25
+ const calendarRef = useRef<HTMLDivElement | null>(null)
26
+
27
+ return (
28
+ <div style={{ height: '100vh' }}>
29
+ <div ref={calendarRef} style={{ position: 'relative', width: 'fit-content', margin: 'auto' }}>
30
+ <CalendarComponent
31
+ required
32
+ mode="single"
33
+ captionLayout="dropdown"
34
+ selected={date}
35
+ month={month}
36
+ onMonthChange={setMonth}
37
+ onSelect={(selectedDate: Date) => {
38
+ if (selectedDate) {
39
+ const [hours, minutes] = time.split(':')
40
+ selectedDate.setHours(Number.parseInt(hours), Number.parseInt(minutes))
41
+ setDate(selectedDate)
42
+ setMonth(selectedDate)
43
+ }
44
+ }}
45
+ onDayClick={() => setIsOpen(false)}
46
+ // fromYear={2000}
47
+ // toYear={new Date().getFullYear()}
48
+ // disabled={(date: Date) =>
49
+ // Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
50
+ // Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
51
+ // }
52
+ />
53
+ <div style={{ paddingLeft: '1rem', paddingTop: '1rem' }}>
54
+ {date ? `${format(date, 'PPPp')}` : 'No date selected'}
55
+ </div>
56
+ <div style={{ paddingLeft: '1rem', paddingTop: '1rem' }}>
57
+ <Button
58
+ size="sm"
59
+ intent="noeffect"
60
+ className="mt-2"
61
+ onClick={() => {
62
+ const today = new Date()
63
+ setDate(today)
64
+ setMonth(today)
65
+ }}
66
+ >
67
+ Today
68
+ </Button>
69
+ </div>
70
+ </div>
71
+ </div>
72
+ )
73
+ }
74
+
75
+ export const Multiple = (): React.JSX.Element => {
76
+ const [isOpen, setIsOpen] = useState(false)
77
+ const [dates, setDates] = useState<Date[] | undefined>([new Date()])
78
+
79
+ const calendarRef = useRef<HTMLDivElement | null>(null)
80
+
81
+ return (
82
+ <div style={{ height: '100vh' }}>
83
+ <div ref={calendarRef} style={{ position: 'relative', width: 'fit-content', margin: 'auto' }}>
84
+ <CalendarComponent
85
+ required
86
+ mode="multiple"
87
+ captionLayout="dropdown"
88
+ selected={dates}
89
+ onSelect={(selectedDates: Date[]) => {
90
+ if (selectedDates) {
91
+ // selectedDate.setHours(Number.parseInt(hours), Number.parseInt(minutes))
92
+ setDates(selectedDates)
93
+ }
94
+ }}
95
+ onDayClick={() => setIsOpen(false)}
96
+ // fromYear={2000}
97
+ // toYear={new Date().getFullYear()}
98
+ // disabled={(date: Date) =>
99
+ // Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
100
+ // Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
101
+ // }
102
+ />
103
+ </div>
104
+ </div>
105
+ )
106
+ }
107
+
108
+ export const Range = (): React.JSX.Element => {
109
+ const [isOpen, setIsOpen] = useState(false)
110
+ const [dateRange, setDateRange] = useState<DateRange | undefined>(undefined)
111
+
112
+ const calendarRef = useRef<HTMLDivElement | null>(null)
113
+
114
+ return (
115
+ <div style={{ height: '100vh' }}>
116
+ <div ref={calendarRef} style={{ position: 'relative', width: 'fit-content', margin: 'auto' }}>
117
+ <CalendarComponent
118
+ required
119
+ mode="range"
120
+ captionLayout="dropdown"
121
+ selected={dateRange}
122
+ onSelect={(selectedDateRange: DateRange) => {
123
+ if (selectedDateRange) {
124
+ // selectedDate.setHours(Number.parseInt(hours), Number.parseInt(minutes))
125
+ setDateRange(selectedDateRange)
126
+ }
127
+ }}
128
+ onDayClick={() => setIsOpen(false)}
129
+ // fromYear={2000}
130
+ // toYear={new Date().getFullYear()}
131
+ // disabled={(date: Date) =>
132
+ // Number(date) < Date.now() - 1000 * 60 * 60 * 24 ||
133
+ // Number(date) > Date.now() + 1000 * 60 * 60 * 24 * 30
134
+ // }
135
+ />
136
+ </div>
137
+ </div>
138
+ )
139
+ }
@@ -0,0 +1,173 @@
1
+ 'use client'
2
+ /**
3
+ * @file Calendar component using react-day-picker and radix-ui
4
+ * @see https://github.com/Maliksidk19/shadcn-datetime-picker/
5
+ * Portions copyright (c) 2023 Maliksidk19 licensed under the MIT
6
+ * license found in the LICENSE file in the root directory of this source tree.
7
+ * of https://github.com/Maliksidk19/shadcn-datetime-picker/
8
+ */
9
+
10
+ import cx from 'classnames'
11
+ import { Select as SelectPrimitive } from 'radix-ui'
12
+ import * as React from 'react'
13
+ import {
14
+ DayPicker,
15
+ type DayPickerProps,
16
+ type Dropdown as DropDownDayPicker,
17
+ } from 'react-day-picker'
18
+ import { ChevronsUpDown } from '../../icons/chevrons-up-down.js'
19
+ import { Button } from '../button/button.js'
20
+ import { ScrollArea } from '../scroll-area/scroll-area.js'
21
+
22
+ import styles from './calendar.module.css'
23
+
24
+ export type CalendarProps = DayPickerProps & {
25
+ ref?: React.RefObject<HTMLDivElement>
26
+ captionLabelClassName?: string
27
+ dayClassName?: string
28
+ dayButtonClassName?: string
29
+ dropdownsClassName?: string
30
+ footerClassName?: string
31
+ monthClassName?: string
32
+ monthCaptionClassName?: string
33
+ monthGridClassName?: string
34
+ monthsClassName?: string
35
+ weekClassName?: string
36
+ weekdayClassName?: string
37
+ weekdaysClassName?: string
38
+ rangeEndClassName?: string
39
+ rangeMiddleClassName?: string
40
+ rangeStartClassName?: string
41
+ selectedClassName?: string
42
+ disabledClassName?: string
43
+ hiddenClassName?: string
44
+ outsideClassName?: string
45
+ todayClassName?: string
46
+ selectTriggerClassName?: string
47
+ }
48
+
49
+ export function Calendar({
50
+ ref,
51
+ className,
52
+ classNames,
53
+ hideNavigation,
54
+ showOutsideDays = true,
55
+ components: customComponents,
56
+ ...props
57
+ }: CalendarProps) {
58
+ const _monthsClassName = cx(styles.months, props.monthsClassName)
59
+ const _monthCaptionClassName = cx(styles['months-caption'], props.monthCaptionClassName)
60
+ const _dropdownsClassName = cx(styles.dropdowns, props.dropdownsClassName)
61
+ const _footerClassName = cx(styles.footer, props.footerClassName)
62
+ const _weekdaysClassName = cx(styles.weekdays, props.weekdaysClassName)
63
+ const _weekdayClassName = cx(styles.weekday, props.weekdayClassName)
64
+ const _captionLabelClassName = cx(styles['caption-label'], props.captionLabelClassName)
65
+
66
+ const _monthGridClassName = cx(styles['month-grid'], props.monthGridClassName)
67
+ const _weekClassName = cx(styles.week, props.weekClassName)
68
+ const _dayClassName = cx(styles.day, props.dayClassName)
69
+ const _dayButtonClassName = cx(styles['day-button'], props.dayButtonClassName)
70
+
71
+ const buttonRangeClassName = cx(styles['button-range'])
72
+ const _rangeStartClassName = cx(
73
+ buttonRangeClassName,
74
+ styles['range-start'],
75
+ props.rangeStartClassName
76
+ )
77
+ const _rangeEndClassName = cx(buttonRangeClassName, styles['range-end'], props.rangeEndClassName)
78
+ const _rangeMiddleClassName = cx(styles['range-middle'], props.rangeMiddleClassName)
79
+ const _selectedClassName = cx(styles['day-selected'], props.selectedClassName)
80
+ const _todayClassName = cx(styles.today, props.todayClassName)
81
+ const _outsideClassName = cx(styles.outside, props.outsideClassName)
82
+ const _disabledClassName = cx(styles.disabled, props.disabledClassName)
83
+ const _hiddenClassName = cx(styles.hidden, props.hiddenClassName)
84
+
85
+ const Dropdown = React.useCallback(
86
+ ({ value, onChange, options }: React.ComponentProps<typeof DropDownDayPicker>) => {
87
+ const selected = options?.find((option) => option.value === value)
88
+ const handleChange = (value: string) => {
89
+ const changeEvent = {
90
+ target: { value },
91
+ } as React.ChangeEvent<HTMLSelectElement>
92
+ onChange?.(changeEvent)
93
+ }
94
+ return (
95
+ <SelectPrimitive.Root
96
+ value={value?.toString()}
97
+ onValueChange={(value) => {
98
+ handleChange(value)
99
+ }}
100
+ >
101
+ <SelectPrimitive.Trigger asChild>
102
+ <Button
103
+ variant="outlined"
104
+ size="sm"
105
+ className={cx(styles['select-trigger'], props.selectTriggerClassName)}
106
+ >
107
+ <SelectPrimitive.Value>{selected?.label}</SelectPrimitive.Value>
108
+ <ChevronsUpDown height="18px" width="18px" svgClassName={styles['select-chevrons']} />
109
+ </Button>
110
+ </SelectPrimitive.Trigger>
111
+ <SelectPrimitive.Content
112
+ className={styles['select-content']}
113
+ position="popper"
114
+ sideOffset={4}
115
+ align="center"
116
+ >
117
+ <ScrollArea className={cx(styles['scroll-area'])}>
118
+ {options?.map(({ value, label, disabled }, id) => (
119
+ <SelectPrimitive.Item
120
+ className={styles['select-item']}
121
+ key={`${value}-${id}`}
122
+ value={value?.toString()}
123
+ disabled={disabled}
124
+ >
125
+ {label}
126
+ </SelectPrimitive.Item>
127
+ ))}
128
+ </ScrollArea>
129
+ </SelectPrimitive.Content>
130
+ </SelectPrimitive.Root>
131
+ )
132
+ },
133
+ [props.selectTriggerClassName]
134
+ )
135
+
136
+ return (
137
+ <DayPicker
138
+ showOutsideDays={showOutsideDays}
139
+ hideNavigation={true} // Ensure navigation is hidden
140
+ className={cx(styles['day-picker'], className)}
141
+ classNames={{
142
+ caption_label: _captionLabelClassName,
143
+ day: _dayClassName,
144
+ day_button: _dayButtonClassName,
145
+ dropdowns: _dropdownsClassName,
146
+ footer: _footerClassName,
147
+ month: props.monthClassName,
148
+ month_caption: _monthCaptionClassName,
149
+ month_grid: _monthGridClassName,
150
+ months: _monthsClassName,
151
+ week: _weekClassName,
152
+ weekday: _weekdayClassName,
153
+ weekdays: _weekdaysClassName,
154
+ range_end: _rangeEndClassName,
155
+ range_middle: _rangeMiddleClassName,
156
+ range_start: _rangeStartClassName,
157
+ selected: _selectedClassName,
158
+ disabled: _disabledClassName,
159
+ hidden: _hiddenClassName,
160
+ outside: _outsideClassName,
161
+ today: _todayClassName,
162
+ nav: 'hidden', // This hides the navigation (chevrons)
163
+ ...classNames,
164
+ }}
165
+ components={{
166
+ Dropdown,
167
+ ...customComponents,
168
+ }}
169
+ {...props}
170
+ />
171
+ )
172
+ }
173
+ Calendar.displayName = 'Calendar'
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ interface Props extends HTMLAttributes<'div'> {
4
+ class?: string
5
+ }
6
+
7
+ import styles from './card.module.css'
8
+
9
+ const { class: className, ...rest } = Astro.props as Props
10
+ ---
11
+
12
+ <div class:list={[styles.cardContent, className]} {...rest}>
13
+ <slot />
14
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ interface Props extends HTMLAttributes<'div'> {
4
+ class?: string
5
+ }
6
+
7
+ import styles from './card.module.css'
8
+
9
+ const { class: className, ...rest } = Astro.props as Props
10
+ ---
11
+
12
+ <div class:list={[styles.cardDescription, className]} {...rest}>
13
+ <slot />
14
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ interface Props extends HTMLAttributes<'div'> {
4
+ class?: string
5
+ }
6
+
7
+ import styles from './card.module.css'
8
+
9
+ const { class: className, ...rest } = Astro.props as Props
10
+ ---
11
+
12
+ <div class:list={[styles.cardFooter, className]} {...rest}>
13
+ <slot />
14
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ interface Props extends HTMLAttributes<'div'> {
4
+ class?: string
5
+ }
6
+
7
+ import styles from './card.module.css'
8
+
9
+ const { class: className, ...rest } = Astro.props as Props
10
+ ---
11
+
12
+ <div class:list={[styles.cardHeader, className]} {...rest}>
13
+ <slot />
14
+ </div>
@@ -0,0 +1,14 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+ interface Props extends HTMLAttributes<'div'> {
4
+ class?: string
5
+ }
6
+
7
+ import styles from './card.module.css'
8
+
9
+ const { class: className, ...rest } = Astro.props as Props
10
+ ---
11
+
12
+ <div class:list={[styles.cardTitle, className]} {...rest}>
13
+ <slot />
14
+ </div>