@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,193 @@
1
+ 'use client'
2
+
3
+ import cx from 'classnames'
4
+ import { DropdownMenu as DropdownMenuPrimitive } from 'radix-ui'
5
+ import type React from 'react'
6
+
7
+ import styles from './dropdown.module.css'
8
+
9
+ function Root({ children, ...rest }: DropdownMenuPrimitive.DropdownMenuProps): React.JSX.Element {
10
+ return <DropdownMenuPrimitive.Root {...rest}>{children}</DropdownMenuPrimitive.Root>
11
+ }
12
+
13
+ const Trigger = ({
14
+ ref,
15
+ className,
16
+ children,
17
+ ...rest
18
+ }: DropdownMenuPrimitive.DropdownMenuTriggerProps & {
19
+ ref?: React.RefObject<React.ComponentRef<'button'>>
20
+ }): React.JSX.Element => {
21
+ return (
22
+ <DropdownMenuPrimitive.Trigger
23
+ className={cx('dropdown-menu-trigger', className)}
24
+ ref={ref}
25
+ {...rest}
26
+ >
27
+ {children}
28
+ </DropdownMenuPrimitive.Trigger>
29
+ )
30
+ }
31
+ Trigger.displayName = 'Trigger'
32
+
33
+ function Portal({
34
+ children,
35
+ ...rest
36
+ }: DropdownMenuPrimitive.DropdownMenuPortalProps): React.JSX.Element {
37
+ return <DropdownMenuPrimitive.Portal {...rest}>{children}</DropdownMenuPrimitive.Portal>
38
+ }
39
+
40
+ const Content = ({
41
+ ref,
42
+ className,
43
+ children,
44
+ ...rest
45
+ }: DropdownMenuPrimitive.DropdownMenuContentProps & {
46
+ ref?: React.RefObject<React.ComponentRef<'div'>>
47
+ }): React.JSX.Element => {
48
+ return (
49
+ <DropdownMenuPrimitive.Content
50
+ ref={ref}
51
+ className={cx('dropdown-menu-content', styles['dropdown-content'], className)}
52
+ {...rest}
53
+ >
54
+ {children}
55
+ </DropdownMenuPrimitive.Content>
56
+ )
57
+ }
58
+ Content.displayName = 'Content'
59
+
60
+ const Group = ({
61
+ ref,
62
+ className,
63
+ children,
64
+ ...rest
65
+ }: DropdownMenuPrimitive.DropdownMenuGroupProps & {
66
+ ref?: React.RefObject<React.ComponentRef<'div'>>
67
+ }): React.JSX.Element => {
68
+ return (
69
+ <DropdownMenuPrimitive.Group
70
+ ref={ref}
71
+ className={cx('dropdown-menu-group', className)}
72
+ {...rest}
73
+ >
74
+ {children}
75
+ </DropdownMenuPrimitive.Group>
76
+ )
77
+ }
78
+ Group.displayName = 'Group'
79
+
80
+ const Item = ({
81
+ ref,
82
+ className,
83
+ children,
84
+ ...rest
85
+ }: DropdownMenuPrimitive.DropdownMenuItemProps & {
86
+ ref?: React.RefObject<React.ComponentRef<'div'>>
87
+ }): React.JSX.Element => {
88
+ return (
89
+ <DropdownMenuPrimitive.Item
90
+ ref={ref}
91
+ className={cx('dropdown-menu-item', styles['dropdown-item'], className)}
92
+ {...rest}
93
+ >
94
+ {children}
95
+ </DropdownMenuPrimitive.Item>
96
+ )
97
+ }
98
+ Item.displayName = 'Item'
99
+
100
+ const Label = ({
101
+ ref,
102
+ className,
103
+ children,
104
+ ...rest
105
+ }: DropdownMenuPrimitive.DropdownMenuLabelProps & {
106
+ ref?: React.RefObject<React.ComponentRef<'div'>>
107
+ }): React.JSX.Element => {
108
+ return (
109
+ <DropdownMenuPrimitive.Label
110
+ ref={ref}
111
+ className={cx('dropdown-menu-label', className)}
112
+ {...rest}
113
+ >
114
+ {children}
115
+ </DropdownMenuPrimitive.Label>
116
+ )
117
+ }
118
+ Label.displayName = 'Label'
119
+
120
+ const Separator = ({
121
+ ref,
122
+ className,
123
+ ...props
124
+ }: DropdownMenuPrimitive.DropdownMenuSeparatorProps & {
125
+ ref?: React.RefObject<React.ComponentRef<'div'>>
126
+ }): React.JSX.Element => {
127
+ return (
128
+ <DropdownMenuPrimitive.Separator
129
+ ref={ref}
130
+ className={cx('dropdown-menu-separator', styles['dropdown-separator'], className)}
131
+ {...props}
132
+ />
133
+ )
134
+ }
135
+ Separator.displayName = 'Separator'
136
+
137
+ function Sub({ children, ...rest }: DropdownMenuPrimitive.DropdownMenuSubProps): React.JSX.Element {
138
+ return <DropdownMenuPrimitive.Sub {...rest}>{children}</DropdownMenuPrimitive.Sub>
139
+ }
140
+
141
+ const SubContent = ({
142
+ ref,
143
+ className,
144
+ children,
145
+ ...rest
146
+ }: DropdownMenuPrimitive.DropdownMenuSubContentProps & {
147
+ ref?: React.RefObject<React.ComponentRef<'div'>>
148
+ }): React.JSX.Element => {
149
+ return (
150
+ <DropdownMenuPrimitive.SubContent
151
+ ref={ref}
152
+ className={cx('dropdown-menu-subcontent', className)}
153
+ {...rest}
154
+ >
155
+ {children}
156
+ </DropdownMenuPrimitive.SubContent>
157
+ )
158
+ }
159
+ SubContent.displayName = 'SubContent'
160
+
161
+ const SubTrigger = ({
162
+ ref,
163
+ className,
164
+ children,
165
+ ...rest
166
+ }: DropdownMenuPrimitive.DropdownMenuSubTriggerProps & {
167
+ ref?: React.RefObject<React.ComponentRef<'div'>>
168
+ }): React.JSX.Element => {
169
+ return (
170
+ <DropdownMenuPrimitive.SubTrigger
171
+ ref={ref}
172
+ className={cx('dropdown-menu-trigger', className)}
173
+ {...rest}
174
+ >
175
+ {children}
176
+ </DropdownMenuPrimitive.SubTrigger>
177
+ )
178
+ }
179
+ SubTrigger.displayName = 'SubTrigger'
180
+
181
+ export const Dropdown = {
182
+ Root,
183
+ Trigger,
184
+ Portal,
185
+ Content,
186
+ Group,
187
+ Item,
188
+ Label,
189
+ Separator,
190
+ Sub,
191
+ SubContent,
192
+ SubTrigger,
193
+ }
@@ -0,0 +1,30 @@
1
+ ---
2
+ // SEE: uikit/src/styles/components/hamburger.css
3
+
4
+ // NOTE: we don't use open or color props in Astro.
5
+ // Instead we set open / closed state via nanostores.
6
+ // and then apply global classes according.
7
+ // Class overrides for inner span colors are set in
8
+ // Astro app.css
9
+
10
+ interface HamburgerProps {
11
+ class?: string
12
+ ariaLabel?: string
13
+ ariaControls?: string
14
+ }
15
+
16
+ const { class: className, ariaLabel, ariaControls } = Astro.props as HamburgerProps
17
+ ---
18
+
19
+ <button
20
+ id="component--hamburger"
21
+ class:list={['component--hamburger', className]}
22
+ tabindex="0"
23
+ aria-label={ariaLabel}
24
+ aria-controls={ariaControls}
25
+ aria-haspopup="true"
26
+ >
27
+ <span class="box" aria-hidden="true">
28
+ <span class="inner"></span>
29
+ </span>
30
+ </button>
@@ -0,0 +1,66 @@
1
+ 'use client'
2
+
3
+ import type React from 'react'
4
+ import { useCallback, useEffect, useState } from 'react'
5
+
6
+ import cx from 'classnames'
7
+
8
+ interface HamburgerProps {
9
+ className?: string
10
+ color?: string
11
+ activeBorderColor?: string
12
+ open: boolean
13
+ onChange: (event: React.MouseEvent<HTMLButtonElement> | null) => void
14
+ }
15
+
16
+ export function Hamburger({
17
+ className,
18
+ color = 'bg-white before:bg-white after:bg-white',
19
+ activeBorderColor,
20
+ open,
21
+ onChange,
22
+ ...other
23
+ }: HamburgerProps): React.JSX.Element {
24
+ const [isOpen, setIsOpen] = useState(false)
25
+
26
+ const handleClick = (event: React.MouseEvent<HTMLButtonElement>): void => {
27
+ setIsOpen(!isOpen)
28
+ onChange(event)
29
+ }
30
+
31
+ const handleEscapeKey = useCallback(
32
+ (event: KeyboardEvent): void => {
33
+ if (event.key === 'Escape') {
34
+ if (isOpen) {
35
+ setIsOpen(false)
36
+ onChange(null)
37
+ }
38
+ }
39
+ },
40
+ [isOpen, onChange]
41
+ )
42
+
43
+ useEffect(() => {
44
+ setIsOpen(open)
45
+ document.addEventListener('keydown', handleEscapeKey, false)
46
+ return () => {
47
+ document.removeEventListener('keydown', handleEscapeKey, false)
48
+ }
49
+ }, [open, handleEscapeKey])
50
+
51
+ return (
52
+ <button
53
+ onClick={handleClick}
54
+ className={cx(`component--hamburger ${isOpen ? 'is_active' : ''}`, className)}
55
+ tabIndex={0}
56
+ aria-label="Open main menu"
57
+ aria-controls="main-menu"
58
+ aria-haspopup="true"
59
+ {...other}
60
+ >
61
+ <span className="box" aria-hidden="true">
62
+ <span className={cx('inner', color)} />
63
+ </span>
64
+ </button>
65
+ )
66
+ }
@@ -0,0 +1,20 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { ReactNode } from 'react'
3
+
4
+ // generic types
5
+ import type { Intent as t } from '../../@types/shared.js'
6
+
7
+ /**
8
+ * This file contains the types and prop-types for Button and IconButton component.
9
+ */
10
+
11
+ // typescript types
12
+ export const variant = ['outlined', 'filled'] as const
13
+ export type Variant = (typeof variant)[number]
14
+
15
+ export const size = ['sm', 'md', 'lg'] as const
16
+ export type Size = (typeof size)[number]
17
+
18
+ export type Intent = 'primary' | t
19
+ export type ClassName = string
20
+ export type Children = ReactNode
@@ -0,0 +1,20 @@
1
+ /* eslint-disable @typescript-eslint/naming-convention */
2
+ import type { ReactNode } from 'react'
3
+
4
+ // generic types
5
+ import type { Intent as t } from '../../@types/shared.js'
6
+
7
+ /**
8
+ * This file contains the types and prop-types for Button and IconButton component.
9
+ */
10
+
11
+ // typescript types
12
+ export const variant = ['outlined', 'filled', 'underlined'] as const
13
+ export type Variant = (typeof variant)[number]
14
+
15
+ export const size = ['sm', 'md', 'lg'] as const
16
+ export type Size = (typeof size)[number]
17
+
18
+ export type Intent = 'primary' | t
19
+ export type ClassName = string
20
+ export type Children = ReactNode
@@ -0,0 +1,78 @@
1
+ 'use client'
2
+
3
+ import type React from 'react'
4
+ import { useEffect, useState } from 'react'
5
+
6
+ import { Checkbox } from './checkbox.js'
7
+
8
+ export interface CheckboxGroupProps {
9
+ groupName: string
10
+ checkBoxes: { id: string; label: string }[]
11
+ defaultValues?: string[]
12
+ controlledValue?: string
13
+ disabled?: boolean
14
+ onChange?: (selectedRoles: string[]) => void
15
+ }
16
+
17
+ export const CheckboxGroup: React.FC<CheckboxGroupProps> = ({
18
+ groupName,
19
+ checkBoxes,
20
+ defaultValues,
21
+ controlledValue,
22
+ disabled = false,
23
+ onChange,
24
+ }) => {
25
+ let initialValue: string[] = []
26
+ if (controlledValue !== undefined && controlledValue.length > 0) {
27
+ initialValue = controlledValue.split(',')
28
+ } else if (defaultValues !== undefined) {
29
+ initialValue = defaultValues
30
+ }
31
+
32
+ const [selected, setSelected] = useState<string[]>(initialValue)
33
+
34
+ // We have to call setSelected here in useEffect to
35
+ // synchronize controlledValue - we can't rely on
36
+ // initialValue alone
37
+ useEffect(() => {
38
+ if (controlledValue !== undefined && controlledValue.length > 0) {
39
+ setSelected(controlledValue.split(','))
40
+ } else if (defaultValues !== undefined) {
41
+ setSelected(defaultValues)
42
+ } else {
43
+ setSelected([])
44
+ }
45
+ }, [controlledValue, defaultValues])
46
+
47
+ const handleCheckboxChange = (id: string, checked: boolean | 'indeterminate') => {
48
+ const s = [...selected]
49
+ if (checked === true) {
50
+ if (s.includes(id) === false) {
51
+ s.push(id)
52
+ }
53
+ } else {
54
+ const index = s.indexOf(id)
55
+ if (index !== -1) {
56
+ s.splice(index, 1)
57
+ }
58
+ }
59
+ setSelected(s)
60
+ onChange?.(s)
61
+ }
62
+
63
+ return (
64
+ <div className="space-y-2">
65
+ {checkBoxes.map((cb) => (
66
+ <Checkbox
67
+ key={cb.id}
68
+ id={`${groupName}-${cb.id}`}
69
+ name={`${groupName}-${cb.id}`}
70
+ label={cb.label}
71
+ checked={selected.includes(cb.id)}
72
+ disabled={disabled}
73
+ onCheckedChange={(checked) => handleCheckboxChange(cb.id, checked)}
74
+ />
75
+ ))}
76
+ </div>
77
+ )
78
+ }
@@ -0,0 +1,267 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .container {
5
+ display: flex;
6
+ align-items: center;
7
+ gap: var(--gap-2);
8
+ }
9
+
10
+ .reverse {
11
+ flex-direction: row-reverse;
12
+ }
13
+
14
+ .checkbox {
15
+ display: inline-flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ border-radius: var(--border-radius-sm);
19
+ transition: all var(--transition-normal);
20
+ }
21
+
22
+ .checkbox[data-state="checked"] {
23
+ --ring-offset-color: var(--background);
24
+ --ring-offset-shadow: var(--ring-inset) 0 0 0 var(--ring-offset-width) var(--ring-offset-color);
25
+ --ring-shadow: var(--ring-inset) 0 0 0 calc(1px + var(--ring-offset-width)) var(--ring-color);
26
+ box-shadow: var(--ring-offset-shadow), var(--ring-shadow), var(--shadow, 0 0 #0000);
27
+ }
28
+
29
+ .checkbox:disabled,
30
+ .checkbox[disabled] {
31
+ pointer-events: none;
32
+ }
33
+
34
+ .indicator {
35
+ display: flex;
36
+ align-items: center;
37
+ justify-content: center;
38
+ }
39
+
40
+ .icon {
41
+ width: 20px;
42
+ height: 20px;
43
+ color: var(--checkbox-icon-color);
44
+ }
45
+
46
+ /* Style for the "checked" state */
47
+ .indicator[data-state="checked"] .icon {
48
+ animation: checkBoxIn 0.3s cubic-bezier(0.25, 1.5, 0.5, 1) forwards;
49
+ opacity: 1;
50
+ transform: scale(1);
51
+ }
52
+
53
+ /* Style for the "unchecked" state */
54
+ .indicator[data-state="unchecked"] .icon {
55
+ animation: checkBoxOut 0.2s ease-in;
56
+ opacity: 0;
57
+ transform: scale(0.8);
58
+ }
59
+
60
+ .label {
61
+ margin-left: 0.25rem;
62
+ cursor: pointer;
63
+ font-weight: 500;
64
+ color: var(--label-color);
65
+ }
66
+
67
+ .checkbox:disabled~.label,
68
+ .checkbox[disabled]~.label {
69
+ pointer-events: none;
70
+ }
71
+
72
+ .errorText {
73
+ margin-top: 0.25rem;
74
+ font-size: 0.875rem;
75
+ color: red;
76
+ }
77
+
78
+ /* Sizes */
79
+ .sm {
80
+ width: 18px;
81
+ height: 18px;
82
+ }
83
+
84
+ .md {
85
+ width: 20px;
86
+ height: 20px;
87
+ }
88
+
89
+ .lg {
90
+ width: 22px;
91
+ height: 22px;
92
+ }
93
+
94
+ /* Variants */
95
+ .outlined {
96
+ border: 2px solid var(--checkbox-variant-outlined-border);
97
+ --checkbox-icon-color: white;
98
+ }
99
+
100
+ .outlined[data-state="checked"] {
101
+ --ring-color: var(--checkbox-variant-outline-ring-color);
102
+ background-color: var(--checkbox-variant-outlined);
103
+ }
104
+
105
+ .filled {
106
+ background-color: var(--checkbox-variant-filled);
107
+ --checkbox-icon-color: white;
108
+ }
109
+
110
+ /* Intents */
111
+ .primary {
112
+ --checkbox-variant-outlined-border: var(--primary-400);
113
+ --checkbox-variant-outlined: var(--primary-400);
114
+ --checkbox-variant-outlined-hover-border: var(--primary-500);
115
+ --checkbox-variant-outline-ring-color: var(--primary-400);
116
+ --checkbox-variant-filled: var(--primary-400);
117
+ }
118
+
119
+ .secondary {
120
+ --checkbox-variant-outlined-border: var(--secondary-500);
121
+ --checkbox-variant-outlined: var(--secondary-500);
122
+ --checkbox-variant-outlined-hover-border: var(--secondary-500);
123
+ --checkbox-variant-outline-ring-color: var(--secondary-500);
124
+ --checkbox-variant-filled: var(--secondary-500);
125
+ }
126
+
127
+ .noeffect {
128
+ --checkbox-variant-outlined-border: var(--gray-400);
129
+ --checkbox-variant-outlined: var(--gray-400);
130
+ --checkbox-variant-outlined-hover-border: var(--gray-400);
131
+ --checkbox-variant-outline-ring-color: var(--gray-400);
132
+ --checkbox-variant-filled: var(--gray-400);
133
+ }
134
+
135
+ .success {
136
+ --checkbox-variant-outlined-border: var(--green-400);
137
+ --checkbox-variant-outlined: var(--green-400);
138
+ --checkbox-variant-outlined-hover-border: var(--green-400);
139
+ --checkbox-variant-outline-ring-color: var(--green-400);
140
+ --checkbox-variant-filled: var(--green-400);
141
+ }
142
+
143
+ .info {
144
+ --checkbox-variant-outlined-border: var(--blue-400);
145
+ --checkbox-variant-outlined: var(--blue-400);
146
+ --checkbox-variant-outlined-hover-border: var(--blue-400);
147
+ --checkbox-variant-outline-ring-color: var(--blue-400);
148
+ --checkbox-variant-filled: var(--blue-400);
149
+ }
150
+
151
+ .warning {
152
+ --checkbox-variant-outlined-border: var(--yellow-400);
153
+ --checkbox-variant-outlined: var(--yellow-400);
154
+ --checkbox-variant-outlined-hover-border: var(--yellow-400);
155
+ --checkbox-variant-outline-ring-color: var(--yellow-400);
156
+ --checkbox-variant-filled: var(--yellow-400);
157
+ }
158
+
159
+ .danger {
160
+ --checkbox-variant-outlined-border: var(--red-400);
161
+ --checkbox-variant-outlined: var(--red-400);
162
+ --checkbox-variant-outlined-hover-border: var(--red-400);
163
+ --checkbox-variant-outline-ring-color: var(--red-400);
164
+ --checkbox-variant-filled: var(--red-400);
165
+ }
166
+
167
+ /* 🌙 Dark via `.dark` class. We rely on the
168
+ * consuming application to detect a user's preferred
169
+ * color scheme - either by header or cookie, and set
170
+ * a root html class accordingly
171
+ */
172
+ :global(.dark) {
173
+
174
+ /* Intents */
175
+ .primary:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
176
+ --checkbox-variant-outlined-border: var(--primary-300);
177
+ --checkbox-variant-outlined: var(--primary-300);
178
+ --checkbox-variant-outlined-hover-border: var(--primary-500);
179
+ --checkbox-variant-outline-ring-color: var(--primary-300);
180
+ --checkbox-variant-filled: var(--primary-500);
181
+ }
182
+
183
+ .secondary:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
184
+ --checkbox-variant-outlined-border: var(--secondary-500);
185
+ --checkbox-variant-outlined: var(--secondary-500);
186
+ --checkbox-variant-outlined-hover-border: var(--secondary-500);
187
+ --checkbox-variant-outline-ring-color: var(--secondary-500);
188
+ --checkbox-variant-filled: var(--secondary-500);
189
+ }
190
+
191
+ .noeffect:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
192
+ --checkbox-variant-outlined-border: var(--gray-400);
193
+ --checkbox-variant-outlined: var(--gray-400);
194
+ --checkbox-variant-outlined-hover-border: var(--gray-400);
195
+ --checkbox-variant-outline-ring-color: var(--gray-400);
196
+ --checkbox-variant-filled: var(--gray-400);
197
+ }
198
+
199
+ .success:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
200
+ --checkbox-variant-outlined-border: var(--green-400);
201
+ --checkbox-variant-outlined: var(--green-400);
202
+ --checkbox-variant-outlined-hover-border: var(--green-400);
203
+ --checkbox-variant-outline-ring-color: var(--green-400);
204
+ --checkbox-variant-filled: var(--green-400);
205
+ }
206
+
207
+ .info:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
208
+ --checkbox-variant-outlined-border: var(--blue-400);
209
+ --checkbox-variant-outlined: var(--blue-400);
210
+ --checkbox-variant-outlined-hover-border: var(--blue-400);
211
+ --checkbox-variant-outline-ring-color: var(--blue-400);
212
+ --checkbox-variant-filled: var(--blue-400);
213
+ }
214
+
215
+ .warning:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
216
+ --checkbox-variant-outlined-border: var(--yellow-400);
217
+ --checkbox-variant-outlined: var(--yellow-400);
218
+ --checkbox-variant-outlined-hover-border: var(--yellow-400);
219
+ --checkbox-variant-outline-ring-color: var(--yellow-400);
220
+ --checkbox-variant-filled: var(--yellow-400);
221
+ }
222
+
223
+ .danger:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
224
+ --checkbox-variant-outlined-border: var(--red-400);
225
+ --checkbox-variant-outlined: var(--red-400);
226
+ --checkbox-variant-outlined-hover-border: var(--red-400);
227
+ --checkbox-variant-outline-ring-color: var(--red-400);
228
+ --checkbox-variant-filled: var(--red-400);
229
+ }
230
+ }
231
+
232
+ @keyframes checkBoxIn {
233
+ 0% {
234
+ opacity: 0;
235
+ transform: scale(0.8);
236
+ }
237
+
238
+ 50% {
239
+ opacity: 1;
240
+ transform: scale(1.2);
241
+ /* Overshoot */
242
+ }
243
+
244
+ 80% {
245
+ transform: scale(0.9);
246
+ /* Slight bounce back */
247
+ }
248
+
249
+ 100% {
250
+ transform: scale(1);
251
+ /* Settle */
252
+ }
253
+ }
254
+
255
+ /* Define keyframes for the "unchecked" state */
256
+ @keyframes checkBoxOut {
257
+ from {
258
+ opacity: 1;
259
+ transform: scale(1);
260
+ }
261
+
262
+ to {
263
+ opacity: 0;
264
+ transform: scale(0.8);
265
+ }
266
+ }
267
+ }