@infonomic/uikit 2.0.0 → 2.1.1

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 (314) hide show
  1. package/dist/components/button/index.js +1 -17
  2. package/dist/components/card/card.d.ts.map +1 -1
  3. package/dist/tsconfig.build.tsbuildinfo +1 -1
  4. package/package.json +35 -31
  5. package/src/astro.d.ts +43 -0
  6. package/src/astro.js +2 -2
  7. package/src/components/@types/shared.ts +24 -0
  8. package/src/components/accordion/accordion.module.css +60 -0
  9. package/src/components/accordion/accordion.stories.tsx +117 -0
  10. package/src/components/accordion/accordion.tsx +105 -0
  11. package/src/components/animation/fade-in-lift.stories.tsx +81 -0
  12. package/src/components/animation/fade-in-lift.tsx +42 -0
  13. package/src/components/avatar/avatar.module.css +54 -0
  14. package/src/components/avatar/avatar.stories.tsx +28 -0
  15. package/src/components/avatar/avatar.tsx +19 -0
  16. package/src/components/button/@types/button.ts +17 -0
  17. package/src/components/button/button-group.module.css +17 -0
  18. package/src/components/button/button-group.stories.tsx +45 -0
  19. package/src/components/button/button-group.tsx +132 -0
  20. package/src/components/button/button-icon.stories.tsx +145 -0
  21. package/src/components/button/button-intents.stories.tsx +50 -0
  22. package/src/components/button/button-variants.stories.tsx +60 -0
  23. package/src/components/button/button.astro +86 -0
  24. package/src/components/button/button.module.css +533 -0
  25. package/src/components/button/button.tsx +81 -0
  26. package/src/components/button/control-buttons.module.css +144 -0
  27. package/src/components/button/control-buttons.stories.tsx +60 -0
  28. package/src/components/button/control-buttons.tsx +137 -0
  29. package/src/components/button/copy-button.module.css +31 -0
  30. package/src/components/button/copy-button.stories.tsx +50 -0
  31. package/src/components/button/copy-button.tsx +92 -0
  32. package/src/components/button/icon-button.astro +47 -0
  33. package/src/components/button/icon-button.tsx +44 -0
  34. package/src/components/button/index.ts +5 -0
  35. package/src/components/calendar/calendar.module.css +315 -0
  36. package/src/components/calendar/calendar.stories.tsx +139 -0
  37. package/src/components/calendar/calendar.tsx +173 -0
  38. package/src/components/card/card-content.astro +14 -0
  39. package/src/components/card/card-description.astro +14 -0
  40. package/src/components/card/card-footer.astro +14 -0
  41. package/src/components/card/card-header.astro +14 -0
  42. package/src/components/card/card-title.astro +14 -0
  43. package/src/components/card/card.astro +41 -0
  44. package/src/components/card/card.module.css +67 -0
  45. package/src/components/card/card.stories.tsx +61 -0
  46. package/src/components/card/card.tsx +86 -0
  47. package/src/components/container/container.astro +13 -0
  48. package/src/components/container/container.module.css +28 -0
  49. package/src/components/container/container.stories.tsx +42 -0
  50. package/src/components/container/container.tsx +23 -0
  51. package/src/components/dropdown/dropdown.module.css +131 -0
  52. package/src/components/dropdown/dropdown.stories.tsx +103 -0
  53. package/src/components/dropdown/dropdown.tsx +193 -0
  54. package/src/components/hamburger/hamburger.astro +30 -0
  55. package/src/components/hamburger/hamburger.tsx +66 -0
  56. package/src/components/input/@types/checkbox.ts +20 -0
  57. package/src/components/input/@types/input.ts +20 -0
  58. package/src/components/input/checkbox-group.tsx +78 -0
  59. package/src/components/input/checkbox.module.css +267 -0
  60. package/src/components/input/checkbox.stories.tsx +240 -0
  61. package/src/components/input/checkbox.tsx +95 -0
  62. package/src/components/input/error-text.astro +14 -0
  63. package/src/components/input/error-text.module.css +19 -0
  64. package/src/components/input/error-text.tsx +18 -0
  65. package/src/components/input/errors.tsx +37 -0
  66. package/src/components/input/help-text.astro +13 -0
  67. package/src/components/input/help-text.module.css +19 -0
  68. package/src/components/input/help-text.tsx +13 -0
  69. package/src/components/input/index.tsx +8 -0
  70. package/src/components/input/input-adornment.astro +26 -0
  71. package/src/components/input/input-adornment.module.css +18 -0
  72. package/src/components/input/input-adornment.tsx +36 -0
  73. package/src/components/input/input.astro +99 -0
  74. package/src/components/input/input.module.css +310 -0
  75. package/src/components/input/input.stories.tsx +174 -0
  76. package/src/components/input/input.tsx +103 -0
  77. package/src/components/input/label.astro +24 -0
  78. package/src/components/input/label.module.css +28 -0
  79. package/src/components/input/label.tsx +25 -0
  80. package/src/components/input/radio-group.module.css +219 -0
  81. package/src/components/input/radio-group.stories.tsx +73 -0
  82. package/src/components/input/radio-group.tsx +67 -0
  83. package/src/components/input/select.module.css +75 -0
  84. package/src/components/input/select.stories.tsx +34 -0
  85. package/src/components/input/select.tsx +115 -0
  86. package/src/components/input/text-area.module.css +9 -0
  87. package/src/components/input/text-area.stories.tsx +51 -0
  88. package/src/components/input/text-area.tsx +81 -0
  89. package/src/components/input/utils.ts +21 -0
  90. package/src/components/notifications/@types/alert.ts +12 -0
  91. package/src/components/notifications/@types/toast.ts +12 -0
  92. package/src/components/notifications/alert.module.css +114 -0
  93. package/src/components/notifications/alert.stories.tsx +39 -0
  94. package/src/components/notifications/alert.tsx +117 -0
  95. package/src/components/notifications/index.ts +2 -0
  96. package/src/components/notifications/toast.module.css +237 -0
  97. package/src/components/notifications/toast.stories.tsx +42 -0
  98. package/src/components/notifications/toast.tsx +124 -0
  99. package/src/components/overlay/index.stories.tsx +29 -0
  100. package/src/components/overlay/index.ts +2 -0
  101. package/src/components/overlay/overlay.module.css +41 -0
  102. package/src/components/overlay/overlay.tsx +61 -0
  103. package/src/components/pager/@types/index.ts +2 -0
  104. package/src/components/pager/ellipses.tsx +18 -0
  105. package/src/components/pager/event-pager.tsx +18 -0
  106. package/src/components/pager/first-button.tsx +53 -0
  107. package/src/components/pager/hooks/types/usePagination.ts +80 -0
  108. package/src/components/pager/hooks/usePagination.ts +140 -0
  109. package/src/components/pager/icons/first.tsx +33 -0
  110. package/src/components/pager/icons/index.tsx +4 -0
  111. package/src/components/pager/icons/last.tsx +33 -0
  112. package/src/components/pager/icons/next.tsx +20 -0
  113. package/src/components/pager/icons/previous.tsx +20 -0
  114. package/src/components/pager/index.ts +4 -0
  115. package/src/components/pager/last-button.tsx +57 -0
  116. package/src/components/pager/next-button.tsx +55 -0
  117. package/src/components/pager/number-button.tsx +83 -0
  118. package/src/components/pager/pagination.module.css +165 -0
  119. package/src/components/pager/pagination.stories.tsx +190 -0
  120. package/src/components/pager/pagination.tsx +266 -0
  121. package/src/components/pager/previous-button.tsx +51 -0
  122. package/src/components/scroll-area/scroll-area.module.css +80 -0
  123. package/src/components/scroll-area/scroll-area.stories.tsx +33 -0
  124. package/src/components/scroll-area/scroll-area.tsx +22 -0
  125. package/src/components/scroll-to-top/scroll-to-top.tsx +59 -0
  126. package/src/components/section/section.astro +13 -0
  127. package/src/components/section/section.module.css +7 -0
  128. package/src/components/section/section.tsx +23 -0
  129. package/src/components/shimmer/shimmer.module.css +53 -0
  130. package/src/components/shimmer/shimmer.stories.tsx +24 -0
  131. package/src/components/shimmer/shimmer.tsx +70 -0
  132. package/src/components/table/table.module.css +100 -0
  133. package/src/components/table/table.stories.tsx +95 -0
  134. package/src/components/table/table.tsx +165 -0
  135. package/src/components/tabs/tabs.module.css +64 -0
  136. package/src/components/tabs/tabs.stories.tsx +47 -0
  137. package/src/components/tabs/tabs.tsx +75 -0
  138. package/src/components/timeline/timeline.module.css +87 -0
  139. package/src/components/timeline/timeline.stories.tsx +50 -0
  140. package/src/components/timeline/timeline.tsx +177 -0
  141. package/src/components/tooltip/tooltip.module.css +55 -0
  142. package/src/components/tooltip/tooltip.stories.tsx +59 -0
  143. package/src/components/tooltip/tooltip.tsx +51 -0
  144. package/src/declarations.d.ts +4 -0
  145. package/src/hooks/use-media-query.ts +20 -0
  146. package/src/icons/activity-icon.tsx +40 -0
  147. package/src/icons/calendar-icon.tsx +39 -0
  148. package/src/icons/check-icon.tsx +33 -0
  149. package/src/icons/chevron-down-icon.tsx +39 -0
  150. package/src/icons/chevron-left-double-icon.tsx +58 -0
  151. package/src/icons/chevron-left-icon.tsx +58 -0
  152. package/src/icons/chevron-right-double-icon.tsx +58 -0
  153. package/src/icons/chevron-right-icon.tsx +58 -0
  154. package/src/icons/chevrons-up-down.tsx +37 -0
  155. package/src/icons/close-icon.astro +38 -0
  156. package/src/icons/close-icon.tsx +30 -0
  157. package/src/icons/copy-icon.tsx +35 -0
  158. package/src/icons/danger-icon.tsx +18 -0
  159. package/src/icons/dashboard-icon.tsx +41 -0
  160. package/src/icons/delete-icon.tsx +34 -0
  161. package/src/icons/document-icon.tsx +38 -0
  162. package/src/icons/download-icon.tsx +39 -0
  163. package/src/icons/edit-icon.tsx +35 -0
  164. package/src/icons/ellipsis-icon.tsx +38 -0
  165. package/src/icons/email-icon.tsx +33 -0
  166. package/src/icons/external-link-icon.tsx +39 -0
  167. package/src/icons/github-icon.tsx +27 -0
  168. package/src/icons/globe-icon.tsx +50 -0
  169. package/src/icons/google-icon.tsx +44 -0
  170. package/src/icons/gripper-vertical-icon.tsx +43 -0
  171. package/src/icons/history-icon.tsx +32 -0
  172. package/src/icons/home-icon.tsx +34 -0
  173. package/src/icons/icon-element.astro +27 -0
  174. package/src/icons/icon-element.tsx +32 -0
  175. package/src/icons/icon-sprite.tsx +18 -0
  176. package/src/icons/icons.module.css +147 -0
  177. package/src/icons/index.stories.tsx +25 -0
  178. package/src/icons/index.ts +39 -0
  179. package/src/icons/info-icon.tsx +18 -0
  180. package/src/icons/infonomic-icon.tsx +173 -0
  181. package/src/icons/light-icon.astro +36 -0
  182. package/src/icons/light-icon.tsx +29 -0
  183. package/src/icons/location-pin-icon.tsx +36 -0
  184. package/src/icons/moon-icon.astro +38 -0
  185. package/src/icons/moon-icon.tsx +42 -0
  186. package/src/icons/plus-icon.tsx +34 -0
  187. package/src/icons/primary-icon.tsx +22 -0
  188. package/src/icons/refresh-icon.tsx +33 -0
  189. package/src/icons/return-icon.tsx +36 -0
  190. package/src/icons/roles-icon.tsx +34 -0
  191. package/src/icons/search-icon.astro +40 -0
  192. package/src/icons/search-icon.tsx +29 -0
  193. package/src/icons/search-menu-icon.tsx +42 -0
  194. package/src/icons/settings-gear-icon.tsx +36 -0
  195. package/src/icons/settings-sliders-icon.tsx +43 -0
  196. package/src/icons/sign-out-icon.tsx +35 -0
  197. package/src/icons/source/icon-calendar.svg +1 -0
  198. package/src/icons/source/icon-check.svg +4 -0
  199. package/src/icons/source/icon-close.svg +3 -0
  200. package/src/icons/source/icon-coinbase.svg +9 -0
  201. package/src/icons/source/icon-copy.svg +4 -0
  202. package/src/icons/source/icon-document.svg +5 -0
  203. package/src/icons/source/icon-download.svg +4 -0
  204. package/src/icons/source/icon-edit.svg +6 -0
  205. package/src/icons/source/icon-eth-purple.svg +15 -0
  206. package/src/icons/source/icon-etherscan.svg +5 -0
  207. package/src/icons/source/icon-external-link.svg +4 -0
  208. package/src/icons/source/icon-globe.svg +7 -0
  209. package/src/icons/source/icon-gripper-vertical.svg +9 -0
  210. package/src/icons/source/icon-info.svg +4 -0
  211. package/src/icons/source/icon-infonomic.svg +43 -0
  212. package/src/icons/source/icon-ledger.svg +4 -0
  213. package/src/icons/source/icon-light.svg +3 -0
  214. package/src/icons/source/icon-location-pin.svg +8 -0
  215. package/src/icons/source/icon-logout.svg +6 -0
  216. package/src/icons/source/icon-metamask.svg +32 -0
  217. package/src/icons/source/icon-moon.svg +3 -0
  218. package/src/icons/source/icon-plus.svg +4 -0
  219. package/src/icons/source/icon-refresh.svg +4 -0
  220. package/src/icons/source/icon-return.svg +4 -0
  221. package/src/icons/source/icon-search-menu.svg +13 -0
  222. package/src/icons/source/icon-search.svg +3 -0
  223. package/src/icons/source/icon-settings-gear.svg +5 -0
  224. package/src/icons/source/icon-settings.svg +12 -0
  225. package/src/icons/source/icon-wallet.svg +3 -0
  226. package/src/icons/source/icon-walletconnect.svg +4 -0
  227. package/src/icons/source/icon-x.svg +4 -0
  228. package/src/icons/stopwatch-icon.tsx +39 -0
  229. package/src/icons/success-icon.tsx +18 -0
  230. package/src/icons/types/icon.ts +8 -0
  231. package/src/icons/user-icon.tsx +33 -0
  232. package/src/icons/users-icon.tsx +35 -0
  233. package/src/icons/wallet-icon.tsx +29 -0
  234. package/src/icons/warning-icon.tsx +18 -0
  235. package/src/icons/x-icon.tsx +33 -0
  236. package/src/loaders/ellipses.tsx +36 -0
  237. package/src/loaders/loaders.stories.tsx +46 -0
  238. package/src/loaders/ring.tsx +33 -0
  239. package/src/loaders/spinner.tsx +28 -0
  240. package/src/loaders/types/index.ts +6 -0
  241. package/src/react.ts +99 -0
  242. package/src/styles/base/animations.css +143 -0
  243. package/src/styles/base/base.css +5 -0
  244. package/src/styles/base/colors.css +163 -0
  245. package/src/styles/base/colors.stories.tsx +671 -0
  246. package/src/styles/base/reset.css +464 -0
  247. package/src/styles/base/typography.css +25 -0
  248. package/src/styles/base/vars.css +188 -0
  249. package/src/styles/components/card.css +20 -0
  250. package/src/styles/components/checkbox.css +55 -0
  251. package/src/styles/components/components.css +11 -0
  252. package/src/styles/components/directional-button.css +92 -0
  253. package/src/styles/components/dropdown.css +19 -0
  254. package/src/styles/components/fade-in-lift.css +13 -0
  255. package/src/styles/components/hamburger.css +107 -0
  256. package/src/styles/components/icon-element.css +4 -0
  257. package/src/styles/components/list-checkbox.css +60 -0
  258. package/src/styles/components/loaders.css +196 -0
  259. package/src/styles/components/popover.css +15 -0
  260. package/src/styles/components/scroll-to-top.css +89 -0
  261. package/src/styles/components/toast.css +18 -0
  262. package/src/styles/styles.css +6 -0
  263. package/src/styles/theme/autofill.css +58 -0
  264. package/src/styles/theme/scrollers.css +52 -0
  265. package/src/styles/theme/theme.css +130 -0
  266. package/src/styles/theme/theme.stories.tsx +33 -0
  267. package/src/styles/typography/code.stories.tsx +76 -0
  268. package/src/styles/typography/default.stories.tsx +51 -0
  269. package/src/styles/typography/fonts.css +30 -0
  270. package/src/styles/typography/lists.stories.tsx +50 -0
  271. package/src/styles/typography/prose.css +404 -0
  272. package/src/styles/typography/quote.stories.tsx +37 -0
  273. package/src/styles/typography.css +24 -0
  274. package/src/styles/utils/scroll-layout-shift.css +9 -0
  275. package/src/styles/utils/utility-classes.css +1278 -0
  276. package/src/styles/utils/utils.css +2 -0
  277. package/src/theme/theme-provider/index.ts +1 -0
  278. package/src/theme/theme-provider/provider.tsx +44 -0
  279. package/src/utils/capitalize.ts +6 -0
  280. package/src/utils/externalLinkProps.ts +6 -0
  281. package/src/utils/findMatch.ts +7 -0
  282. package/src/utils/getPortalRoot.ts +3 -0
  283. package/src/utils/isTouchDevice.ts +11 -0
  284. package/src/utils/objectsToArray.ts +15 -0
  285. package/src/utils/objectsToString.ts +5 -0
  286. package/src/utils/polymorphic.ts +16 -0
  287. package/src/utils/to-kebab-case.ts +5 -0
  288. package/src/widgets/datepicker/datepicker.module.css +189 -0
  289. package/src/widgets/datepicker/datepicker.stories.tsx +25 -0
  290. package/src/widgets/datepicker/datepicker.tsx +310 -0
  291. package/src/widgets/drawer/drawer-container.tsx +26 -0
  292. package/src/widgets/drawer/drawer-content.tsx +26 -0
  293. package/src/widgets/drawer/drawer-context.tsx +49 -0
  294. package/src/widgets/drawer/drawer-header.tsx +27 -0
  295. package/src/widgets/drawer/drawer-top-actions.tsx +27 -0
  296. package/src/widgets/drawer/drawer-wrapper.tsx +54 -0
  297. package/src/widgets/drawer/drawer.module.css +116 -0
  298. package/src/widgets/drawer/drawer.stories.tsx +224 -0
  299. package/src/widgets/drawer/drawer.tsx +115 -0
  300. package/src/widgets/drawer/motionDomAnimation.ts +4 -0
  301. package/src/widgets/drawer/motionDomMax.ts +4 -0
  302. package/src/widgets/modal/modal-actions.tsx +26 -0
  303. package/src/widgets/modal/modal-container.tsx +26 -0
  304. package/src/widgets/modal/modal-content.tsx +26 -0
  305. package/src/widgets/modal/modal-header.tsx +27 -0
  306. package/src/widgets/modal/modal-wrapper.tsx +50 -0
  307. package/src/widgets/modal/modal.module.css +85 -0
  308. package/src/widgets/modal/modal.stories.tsx +71 -0
  309. package/src/widgets/modal/modal.tsx +110 -0
  310. package/src/widgets/modal/motionDomAnimation.ts +4 -0
  311. package/src/widgets/modal/motionDomMax.ts +4 -0
  312. package/src/widgets/search/index.ts +1 -0
  313. package/src/widgets/search/search.stories.tsx +18 -0
  314. package/src/widgets/search/search.tsx +186 -0
@@ -0,0 +1,41 @@
1
+ ---
2
+ import type { HTMLAttributes } from 'astro/types'
3
+
4
+ interface Props extends HTMLAttributes<'button'>, Omit<HTMLAttributes<'a'>, 'type'> {
5
+ class?: string
6
+ hover?: boolean
7
+ href?: string
8
+ target?: string
9
+ as?: 'div' | 'a'
10
+ }
11
+
12
+ import styles from './card.module.css'
13
+
14
+ const {
15
+ class: className,
16
+ hover,
17
+ as = 'div',
18
+ href,
19
+ target = href?.startsWith('http') ? '_blank' : undefined,
20
+ ...rest
21
+ } = Astro.props as Props
22
+
23
+ const componentType = href != null ? 'a' : as
24
+ ---
25
+
26
+ {
27
+ componentType === 'a' ? (
28
+ <a
29
+ href={href}
30
+ target={target}
31
+ class:list={[styles.card, { [styles.cardHover]: hover }, className]}
32
+ {...rest}
33
+ >
34
+ <slot />
35
+ </a>
36
+ ) : (
37
+ <div class:list={[styles.card, { [styles.cardHover]: hover }, className]} {...rest}>
38
+ <slot />
39
+ </div>
40
+ )
41
+ }
@@ -0,0 +1,67 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .card {
5
+ display: flex;
6
+ flex-direction: column;
7
+ text-decoration: none;
8
+ width: 100%;
9
+ max-width: 100%;
10
+ color: var(--foreground);
11
+ background: var(--canvas-25);
12
+ border-width: var(--border-width-thin);
13
+ border-color: var(--border-color);
14
+ border-style: var(--border-style-solid);
15
+ border-radius: var(--border-radius-md);
16
+ box-shadow: var(--shadow-sm)
17
+ }
18
+
19
+ .card:is(:global(.dark) *) {
20
+ background: var(--canvas-800);
21
+ }
22
+
23
+ .cardHover {
24
+ transition: background 0.2s ease-in-out;
25
+ }
26
+
27
+ .cardHover:hover {
28
+ background: oklch(from var(--theme-50) 1 0.03 h);
29
+ }
30
+
31
+ .cardHover:hover:is(:global(.dark) *) {
32
+ background: oklch(from var(--canvas-800) 0.2 c h);
33
+ }
34
+
35
+ .cardHeader {
36
+ display: flex;
37
+ flex-direction: column;
38
+ gap: 0.5rem;
39
+ padding: 1rem;
40
+ }
41
+
42
+ .cardTitle {
43
+ color: var(--headings);
44
+ font-size: 1.8rem;
45
+ font-weight: bold;
46
+ line-height: 1;
47
+ letter-spacing: -0.015em;
48
+ }
49
+
50
+ .cardDescription {
51
+ font-size: 0.875rem;
52
+ color: var(--muted);
53
+ }
54
+
55
+ .cardContent {
56
+ flex: 1;
57
+ padding: 1rem;
58
+ padding-top: 0;
59
+ }
60
+
61
+ .cardFooter {
62
+ display: flex;
63
+ align-items: center;
64
+ padding: 1rem;
65
+ padding-top: 0;
66
+ }
67
+ }
@@ -0,0 +1,61 @@
1
+ import type { Meta } from '@storybook/react-vite'
2
+
3
+ import { Button } from '../button/button.js'
4
+
5
+ import { Card as CardComponent } from './card.js'
6
+
7
+ const meta: Meta = {
8
+ /* 👇 The title prop is optional.
9
+ * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
10
+ * to learn how to generate automatic titles
11
+ */
12
+ title: 'Components',
13
+ component: CardComponent,
14
+ }
15
+
16
+ export default meta
17
+
18
+ export const Card = (): React.JSX.Element => {
19
+ return (
20
+ <>
21
+ <div style={{ marginBottom: '48px' }} className="mb-6">
22
+ <div style={{ maxWidth: '400px', marginBottom: '24px' }}>
23
+ <CardComponent>
24
+ <CardComponent.Header>
25
+ <CardComponent.Title>
26
+ <h2>Normal Card</h2>
27
+ </CardComponent.Title>
28
+ <CardComponent.Description>
29
+ <p>Card description here.</p>
30
+ </CardComponent.Description>
31
+ </CardComponent.Header>
32
+ <CardComponent.Content>
33
+ <p>Card body with some text here.</p>
34
+ </CardComponent.Content>
35
+ <CardComponent.Footer>
36
+ <Button size="sm">A Button</Button>
37
+ </CardComponent.Footer>
38
+ </CardComponent>
39
+ </div>
40
+ <div style={{ maxWidth: '400px', marginBottom: '24px' }}>
41
+ <CardComponent hover={true}>
42
+ <CardComponent.Header>
43
+ <CardComponent.Title>
44
+ <h2>Card Hover</h2>
45
+ </CardComponent.Title>
46
+ <CardComponent.Description>
47
+ <p>Card description here.</p>
48
+ </CardComponent.Description>
49
+ </CardComponent.Header>
50
+ <CardComponent.Content>
51
+ <p>Card body with some text here.</p>
52
+ </CardComponent.Content>
53
+ <CardComponent.Footer>
54
+ <Button size="sm">A Button</Button>
55
+ </CardComponent.Footer>
56
+ </CardComponent>
57
+ </div>
58
+ </div>
59
+ </>
60
+ )
61
+ }
@@ -0,0 +1,86 @@
1
+ import { Slot } from '@radix-ui/react-slot'
2
+ import cx from 'classnames'
3
+ import type React from 'react'
4
+
5
+ import styles from './card.module.css'
6
+
7
+ export type AsDiv = {
8
+ asChild?: false
9
+ } & React.ComponentPropsWithoutRef<'div'>
10
+
11
+ export interface AsSlot {
12
+ asChild?: true
13
+ }
14
+
15
+ export type CardRefType<C extends React.ElementType> = React.ComponentPropsWithRef<C>['ref']
16
+
17
+ export type CardProps<C extends React.ElementType = 'div'> = {
18
+ children: React.ReactNode
19
+ className?: string
20
+ hover?: boolean
21
+ asChild?: boolean
22
+ ref?: CardRefType<C>
23
+ } & (AsSlot | AsDiv)
24
+
25
+ const Card = <C extends React.ElementType = 'div'>({
26
+ className,
27
+ hover,
28
+ children,
29
+ asChild,
30
+ ref,
31
+ ...rest
32
+ }: CardProps<C>) => {
33
+ const Comp: React.ElementType = asChild === true ? Slot : 'div'
34
+ const hoverClasses = hover != null && hover === true ? styles.cardHover : undefined
35
+ const classes = cx(styles.card, hoverClasses, className)
36
+
37
+ return (
38
+ <Comp ref={ref} className={classes} {...rest}>
39
+ {children}
40
+ </Comp>
41
+ )
42
+ }
43
+
44
+ Card.displayName = 'Card'
45
+
46
+ interface OtherProps extends React.HTMLAttributes<HTMLDivElement> {
47
+ ref?: React.Ref<HTMLDivElement>
48
+ }
49
+
50
+ const Header = ({ className, ref, ...props }: OtherProps) => (
51
+ <div ref={ref} className={cx(styles.cardHeader, className)} {...props} />
52
+ )
53
+
54
+ Header.displayName = 'CardHeader'
55
+
56
+ const Title = ({ className, ref, ...props }: OtherProps) => (
57
+ <div
58
+ ref={ref as React.Ref<HTMLDivElement>}
59
+ className={cx(styles.cardTitle, className)}
60
+ {...props}
61
+ />
62
+ )
63
+ Title.displayName = 'CardTitle'
64
+
65
+ const Description = ({ className, ref, ...props }: OtherProps) => (
66
+ <div ref={ref} className={cx(styles.cardDescription, className)} {...props} />
67
+ )
68
+ Description.displayName = 'CardDescription'
69
+
70
+ const Content = ({ className, ref, ...props }: OtherProps) => (
71
+ <div ref={ref} className={cx(styles.cardContent, className)} {...props} />
72
+ )
73
+ Content.displayName = 'CardContent'
74
+
75
+ const Footer = ({ className, ref, ...props }: OtherProps) => (
76
+ <div ref={ref} className={cx(styles.cardFooter, className)} {...props} />
77
+ )
78
+ Footer.displayName = 'CardFooter'
79
+
80
+ Card.Header = Header
81
+ Card.Title = Title
82
+ Card.Description = Description
83
+ Card.Content = Content
84
+ Card.Footer = Footer
85
+
86
+ export { Card }
@@ -0,0 +1,13 @@
1
+ ---
2
+ interface Props {
3
+ class?: string
4
+ }
5
+
6
+ import styles from './container.module.css'
7
+
8
+ const { class: className, ...rest } = Astro.props as Props
9
+ ---
10
+
11
+ <div class:list={[styles.container, className]} {...rest}>
12
+ <slot />
13
+ </div>
@@ -0,0 +1,28 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .container {
5
+ width: 100%;
6
+ padding: 0 16px;
7
+ margin: 0 auto;
8
+ max-width: 900px;
9
+ }
10
+
11
+ @media (min-width: 1100px) {
12
+ .container {
13
+ max-width: 1050px;
14
+ }
15
+ }
16
+
17
+ @media (min-width: 1300px) {
18
+ .container {
19
+ max-width: 1200px;
20
+ }
21
+ }
22
+
23
+ @media (min-width: 1536px) {
24
+ .container {
25
+ max-width: 1400px;
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,42 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import type React from 'react'
3
+
4
+ import type { Meta, StoryObj } from '@storybook/react-vite'
5
+
6
+ import { Section } from '../section/section.js'
7
+ import { Container as ContainerComponent } from './container.js'
8
+
9
+ const meta: Meta<typeof ContainerComponent> = {
10
+ /* 👇 The title prop is optional.
11
+ * See https://storybook.js.org/docs/react/configure/overview#configure-story-loading
12
+ * to learn how to generate automatic titles
13
+ */
14
+ title: 'Components/Container',
15
+ component: ContainerComponent,
16
+ }
17
+
18
+ export default meta
19
+
20
+ type Story = StoryObj<typeof ContainerComponent>
21
+
22
+ export const Container = (): React.JSX.Element => {
23
+ return (
24
+ <Section style={{ height: '100vh' }}>
25
+ <ContainerComponent
26
+ style={{
27
+ backgroundColor: 'lightblue',
28
+ height: '400px',
29
+ display: 'flex',
30
+ alignItems: 'center',
31
+ justifyContent: 'center',
32
+ }}
33
+ >
34
+ <p>I'm in a container</p>
35
+ </ContainerComponent>
36
+ </Section>
37
+ )
38
+ }
39
+
40
+ // export const Default: Story = {
41
+ // render: () => <DivDemo />,
42
+ // }
@@ -0,0 +1,23 @@
1
+ import type React from 'react'
2
+
3
+ import cx from 'classnames'
4
+
5
+ import styles from './container.module.css'
6
+
7
+ type ContainerIntrinsicProps = React.JSX.IntrinsicElements['div']
8
+ export interface ContainerProps extends ContainerIntrinsicProps {}
9
+
10
+ export const Container = function Container({
11
+ ref,
12
+ className,
13
+ children,
14
+ ...rest
15
+ }: ContainerProps & {
16
+ ref?: React.RefObject<HTMLDivElement>
17
+ }): React.JSX.Element {
18
+ return (
19
+ <div ref={ref} {...rest} className={cx(styles.container, className)}>
20
+ {children}
21
+ </div>
22
+ )
23
+ }
@@ -0,0 +1,131 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+
5
+ .dropdown-content,
6
+ .dropdown-subcontent {
7
+ z-index: 20;
8
+ background-color: var(--canvas-25);
9
+ padding: 4px;
10
+ animation-duration: 400ms;
11
+ animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
12
+ will-change: transform, opacity;
13
+ border-width: var(--border-width-thin);
14
+ border-color: var(--border-color);
15
+ border-style: var(--border-style-solid);
16
+ border-radius: var(--border-radius-md);
17
+ box-shadow: var(--shadow-sm);
18
+
19
+ &[data-side="top"] {
20
+ animation-name: slideDownAndFade;
21
+ }
22
+
23
+ &[data-side="right"] {
24
+ animation-name: slideLeftAndFade;
25
+ }
26
+
27
+ &[data-side="bottom"] {
28
+ animation-name: slideUpAndFade;
29
+ }
30
+
31
+ &[data-side="left"] {
32
+ animation-name: slideRightAndFade;
33
+ }
34
+ }
35
+
36
+
37
+ .dropdown-item {
38
+ display: flex;
39
+ align-items: center;
40
+ gap: var(--gap-1);
41
+ width: 100%;
42
+ padding: 5px 2px;
43
+ font-size: var(--font-size-sm);
44
+ transition: background-color 0.2s;
45
+ cursor: default;
46
+ outline: none;
47
+ border-radius: var(--border-radius-sm);
48
+ }
49
+
50
+ .dropdown-item:hover,
51
+ .dropdown-item:focus {
52
+ background-color: var(--canvas-50);
53
+ }
54
+
55
+ .dropdown-separator {
56
+ margin: 0 auto;
57
+ width: 90%;
58
+ background-color: var(--border-color);
59
+ margin: var(--spacing-1) 0;
60
+ border-top-width: var(--border-width-thin);
61
+ border-top-color: var(--border-color);
62
+ border-top-style: var(--border-style-solid);
63
+ }
64
+
65
+ /* 🌙 Dark via `.dark` class. We rely on the
66
+ * consuming application to detect a user's preferred
67
+ * color scheme - either by header or cookie, and set
68
+ * a root html class accordingly
69
+ */
70
+ :global(.dark) {
71
+
72
+ .dropdown-content:not(:where([class~="not-dark"], [class~="not-dark"] *)),
73
+ .dropdown-subcontent:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
74
+ background-color: var(--canvas-800);
75
+ }
76
+
77
+ .dropdown-item:hover:not(:where([class~="not-dark"], [class~="not-dark"] *)),
78
+ .dropdown-item:focus:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
79
+ background-color: var(--canvas-700);
80
+ }
81
+ }
82
+
83
+ @keyframes slideUpAndFade {
84
+ from {
85
+ opacity: 0;
86
+ transform: translateY(2px);
87
+ }
88
+
89
+ to {
90
+ opacity: 1;
91
+ transform: translateY(0);
92
+ }
93
+ }
94
+
95
+ @keyframes slideRightAndFade {
96
+ from {
97
+ opacity: 0;
98
+ transform: translateX(-2px);
99
+ }
100
+
101
+ to {
102
+ opacity: 1;
103
+ transform: translateX(0);
104
+ }
105
+ }
106
+
107
+ @keyframes slideDownAndFade {
108
+ from {
109
+ opacity: 0;
110
+ transform: translateY(-2px);
111
+ }
112
+
113
+ to {
114
+ opacity: 1;
115
+ transform: translateY(0);
116
+ }
117
+ }
118
+
119
+ @keyframes slideLeftAndFade {
120
+ from {
121
+ opacity: 0;
122
+ transform: translateX(2px);
123
+ }
124
+
125
+ to {
126
+ opacity: 1;
127
+ transform: translateX(0);
128
+ }
129
+ }
130
+
131
+ }
@@ -0,0 +1,103 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite'
2
+
3
+ import { SignOutIcon } from '../../icons/sign-out-icon.js'
4
+ import { UserIcon } from '../../icons/user-icon.js'
5
+ import { Button } from '../button/button.js'
6
+ import { Dropdown as DropdownComponent } from './dropdown.js'
7
+
8
+ const meta: Meta = {
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/Dropdown',
14
+ component: DropdownComponent.Root,
15
+ }
16
+
17
+ export default meta
18
+
19
+ type Story = StoryObj<typeof DropdownComponent.Root>
20
+
21
+ export const Dropdown: Story = {
22
+ args: {
23
+ modal: false,
24
+ },
25
+ render: (args) => {
26
+ return (
27
+ <>
28
+ <style>
29
+ {`
30
+ .dropdown-item-content {
31
+ display: flex;
32
+ align-items: center;
33
+ }
34
+
35
+ .dropdown-item-content-icon {
36
+ display: inline-block;
37
+ width: 28px;
38
+ }
39
+
40
+ .dropdown-item-content-text {
41
+ text-align: left;
42
+ display: inline-block;
43
+ width: 100%;
44
+ flex: 1;
45
+ }
46
+
47
+ `}
48
+ </style>
49
+ <div
50
+ style={{
51
+ maxWidth: '400px',
52
+ marginBottom: '24px',
53
+ display: 'flex',
54
+ justifyContent: 'center',
55
+ }}
56
+ >
57
+ <DropdownComponent.Root {...args}>
58
+ <DropdownComponent.Trigger asChild>
59
+ <Button size="sm" variant="filled">
60
+ +
61
+ </Button>
62
+ </DropdownComponent.Trigger>
63
+
64
+ <DropdownComponent.Portal>
65
+ <DropdownComponent.Content align="end" sideOffset={10}>
66
+ <DropdownComponent.Item>
67
+ <div className="dropdown-item-content">
68
+ <span className="dropdown-item-content-icon">
69
+ <UserIcon width="22px" height="22px" />
70
+ </span>
71
+ <span className="dropdown-item-content-text">Account</span>
72
+ </div>
73
+ </DropdownComponent.Item>
74
+ <DropdownComponent.Item>
75
+ <div className="dropdown-item-content">
76
+ <span className="dropdown-item-content-icon" />
77
+ <span className="dropdown-item-content-text">Menu Item 2</span>
78
+ </div>
79
+ </DropdownComponent.Item>
80
+ <DropdownComponent.Separator />
81
+ <DropdownComponent.Item>
82
+ <div className="dropdown-item-content">
83
+ <span className="dropdown-item-content-icon">
84
+ <SignOutIcon />
85
+ </span>
86
+ <span className="dropdown-item-content-text">
87
+ <button
88
+ type="button"
89
+ className="text-left inline-block w-full flex-1 leading-none text-black dark:text-gray-300"
90
+ >
91
+ Sign Out
92
+ </button>
93
+ </span>
94
+ </div>
95
+ </DropdownComponent.Item>
96
+ </DropdownComponent.Content>
97
+ </DropdownComponent.Portal>
98
+ </DropdownComponent.Root>
99
+ </div>
100
+ </>
101
+ )
102
+ },
103
+ }