@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,70 @@
1
+ import cx from 'classnames'
2
+ import type React from 'react'
3
+ import styles from './shimmer.module.css'
4
+
5
+ interface ShimmerProps {
6
+ className?: string
7
+ width?: string | number
8
+ height?: string | number
9
+ borderRadius?: string
10
+ variant?: 'text' | 'rectangular' | 'circular'
11
+ lines?: number
12
+ children?: React.ReactNode
13
+ }
14
+
15
+ export function Shimmer({
16
+ className,
17
+ width = '100%',
18
+ height = '1rem',
19
+ borderRadius,
20
+ variant = 'rectangular',
21
+ lines = 1,
22
+ children,
23
+ ...other
24
+ }: ShimmerProps): React.JSX.Element {
25
+ const shimmerStyle = {
26
+ width: typeof width === 'number' ? `${width}px` : width,
27
+ height: typeof height === 'number' ? `${height}px` : height,
28
+ borderRadius: borderRadius,
29
+ }
30
+
31
+ const getVariantClass = () => {
32
+ switch (variant) {
33
+ case 'text':
34
+ return styles.text
35
+ case 'circular':
36
+ return styles.circular
37
+ case 'rectangular':
38
+ default:
39
+ return styles.rectangular
40
+ }
41
+ }
42
+
43
+ if (variant === 'text' && lines > 1) {
44
+ return (
45
+ <div className={cx(styles.shimmerContainer, className)} {...other}>
46
+ {Array.from({ length: lines }, (_, index) => (
47
+ <div
48
+ key={`shimmer-line-${index}`}
49
+ className={cx(styles.shimmer, styles.text)}
50
+ style={{
51
+ ...shimmerStyle,
52
+ width: index === lines - 1 ? '75%' : '100%',
53
+ marginBottom: index === lines - 1 ? 0 : '0.5rem',
54
+ }}
55
+ />
56
+ ))}
57
+ </div>
58
+ )
59
+ }
60
+
61
+ return (
62
+ <div
63
+ className={cx(styles.shimmer, getVariantClass(), className)}
64
+ style={shimmerStyle}
65
+ {...other}
66
+ >
67
+ {children}
68
+ </div>
69
+ )
70
+ }
@@ -0,0 +1,100 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ /* 'border-collapse w-full text-sm text-left text-gray-700 dark:text-gray-400 m-0', */
4
+ @layer infonomic-components {
5
+
6
+ /* 'table--container break-normal overflow-hidden relative shadow-md rounded-md my-[16px] dark:border dark:border-canvas-700', */
7
+ .table-container {
8
+ display: block;
9
+ overflow: hidden;
10
+ word-break: normal;
11
+ position: relative;
12
+ box-shadow: var(--shadow-sm);
13
+ border-radius: var(--border-radius-sm);
14
+ border: 1px solid var(--border-color);
15
+ }
16
+
17
+ .table-scroller {
18
+ overflow-x: auto;
19
+ max-width: calc(100vw - 32px);
20
+ }
21
+
22
+ .table {
23
+ width: 100%;
24
+ border-collapse: collapse;
25
+ margin: 0;
26
+ font-size: var(--font-size-sm);
27
+ text-align: left;
28
+ }
29
+
30
+ /* 'text-xs text-gray-700 uppercase bg-canvas-100 dark:bg-canvas-700 dark:text-gray-400', */
31
+ .table-header {
32
+ font-size: var(--font-size-xs);
33
+ text-transform: uppercase;
34
+ background-color: var(--canvas-50);
35
+ }
36
+
37
+ /* 'border-b border-solid border-canvas-200 bg-white hover:bg-canvas-100/50 dark:border-canvas-700/60 dark:bg-canvas-800/50 dark:hover:bg-canvas-700/50', */
38
+ .table-row {
39
+ border-bottom: 1px solid var(--canvas-50);
40
+ background-color: white;
41
+ }
42
+
43
+ .table-row:hover {
44
+ background-color: var(--canvas-50);
45
+ }
46
+
47
+ /* 'whitespace-nowrap px-2 py-4 text-sm text-gray-700 uppercase bg-canvas-100/50 dark:bg-canvas-800/50 dark:text-gray-200', */
48
+ .table-heading-cell {
49
+ white-space: nowrap;
50
+ padding: var(--spacing-2) var(--spacing-2);
51
+ font-size: var(--font-size-sm);
52
+ text-transform: uppercase;
53
+ background-color: var(--canvas-50);
54
+ }
55
+
56
+ /* not-prose px-2 py-2 text-sm [&_a]:underline */
57
+ .table-cell {
58
+ padding: var(--spacing-2);
59
+ font-size: var(--font-size-sm);
60
+
61
+ & a {
62
+ text-decoration: underline;
63
+ }
64
+ }
65
+
66
+ /* 'text-xs text-gray-700 uppercase bg-canvas-100 dark:bg-canvas-700 dark:text-gray-400', */
67
+ .table-footer {
68
+ font-size: var(--font-size-xs);
69
+ text-transform: uppercase;
70
+ background-color: var(--canvas-100);
71
+ }
72
+
73
+ /* 🌙 Dark via `.dark` class. We rely on the
74
+ * consuming application to detect a user's preferred
75
+ * color scheme - either by header or cookie, and set
76
+ * a root html class accordingly
77
+ */
78
+ :global(.dark) {
79
+ .table-header {
80
+ background-color: var(--canvas-700);
81
+ }
82
+
83
+ .table-row:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
84
+ border-bottom: 1px solid var(--canvas-700);
85
+ background-color: var(--canvas-800);
86
+ }
87
+
88
+ .table-row:hover:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
89
+ background-color: oklch(from var(--canvas-800) calc(l * 1.1) c h)
90
+ }
91
+
92
+ .table-heading-cell:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
93
+ background-color: oklch(from var(--canvas-800) calc(l * 1.1) c h);
94
+ }
95
+
96
+ .table-footer:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
97
+ background-color: var(--canvas-800);
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,95 @@
1
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
2
+ import type React from 'react'
3
+
4
+ import type { Meta } from '@storybook/react-vite'
5
+
6
+ import { Table as TableComponent } from './table.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',
14
+ component: TableComponent,
15
+ }
16
+
17
+ export default meta
18
+
19
+ export const Table = (): React.JSX.Element => {
20
+ return (
21
+ <div style={{ maxWidth: '960px', margin: '0 auto' }}>
22
+ <TableComponent.Container>
23
+ <TableComponent>
24
+ <TableComponent.Header>
25
+ <TableComponent.Row>
26
+ <TableComponent.HeadingCell scope="col">
27
+ <span>Check</span>
28
+ </TableComponent.HeadingCell>
29
+ <TableComponent.HeadingCell scope="col">
30
+ <p>Heading 1</p>
31
+ </TableComponent.HeadingCell>
32
+ <TableComponent.HeadingCell scope="col">
33
+ <p>Heading 2</p>
34
+ </TableComponent.HeadingCell>
35
+ <TableComponent.HeadingCell scope="col">
36
+ <p>Heading 3</p>
37
+ </TableComponent.HeadingCell>
38
+ </TableComponent.Row>
39
+ </TableComponent.Header>
40
+
41
+ <TableComponent.Body>
42
+ <TableComponent.Row>
43
+ <TableComponent.Cell>
44
+ <span>Check</span>
45
+ </TableComponent.Cell>
46
+ <TableComponent.Cell>1</TableComponent.Cell>
47
+ <TableComponent.Cell>2</TableComponent.Cell>
48
+ <TableComponent.Cell>3</TableComponent.Cell>
49
+ </TableComponent.Row>
50
+ <TableComponent.Row>
51
+ <TableComponent.Cell>
52
+ <span>Check</span>
53
+ </TableComponent.Cell>
54
+ <TableComponent.Cell>1</TableComponent.Cell>
55
+ <TableComponent.Cell>2</TableComponent.Cell>
56
+ <TableComponent.Cell>3</TableComponent.Cell>
57
+ </TableComponent.Row>
58
+ <TableComponent.Row>
59
+ <TableComponent.Cell>
60
+ <span>Check</span>
61
+ </TableComponent.Cell>
62
+ <TableComponent.Cell>1</TableComponent.Cell>
63
+ <TableComponent.Cell>2</TableComponent.Cell>
64
+ <TableComponent.Cell>3</TableComponent.Cell>
65
+ </TableComponent.Row>
66
+ <TableComponent.Row>
67
+ <TableComponent.Cell>
68
+ <span>Check</span>
69
+ </TableComponent.Cell>
70
+ <TableComponent.Cell>1</TableComponent.Cell>
71
+ <TableComponent.Cell>2</TableComponent.Cell>
72
+ <TableComponent.Cell>3</TableComponent.Cell>
73
+ </TableComponent.Row>
74
+ </TableComponent.Body>
75
+ <TableComponent.Footer>
76
+ <TableComponent.Row>
77
+ <TableComponent.HeadingCell scope="col">
78
+ <span>Check</span>
79
+ </TableComponent.HeadingCell>
80
+ <TableComponent.HeadingCell scope="col">
81
+ <p>Heading 1</p>
82
+ </TableComponent.HeadingCell>
83
+ <TableComponent.HeadingCell scope="col">
84
+ <p>Heading 2</p>
85
+ </TableComponent.HeadingCell>
86
+ <TableComponent.HeadingCell scope="col">
87
+ <p>Heading 3</p>
88
+ </TableComponent.HeadingCell>
89
+ </TableComponent.Row>
90
+ </TableComponent.Footer>
91
+ </TableComponent>
92
+ </TableComponent.Container>
93
+ </div>
94
+ )
95
+ }
@@ -0,0 +1,165 @@
1
+ import cx from 'classnames'
2
+ import type * as React from 'react'
3
+
4
+ import styles from './table.module.css'
5
+
6
+ export type TableProps = React.JSX.IntrinsicElements['table']
7
+
8
+ function Table({
9
+ ref,
10
+ className,
11
+ children,
12
+ ...rest
13
+ }: TableProps & {
14
+ ref?: React.RefObject<HTMLTableElement>
15
+ }): React.JSX.Element {
16
+ const classes = cx(styles.table, 'table', className)
17
+
18
+ return (
19
+ <table ref={ref} className={classes} {...rest}>
20
+ {children}
21
+ </table>
22
+ )
23
+ }
24
+
25
+ export type TableContainerProps = React.JSX.IntrinsicElements['div']
26
+
27
+ function Container({
28
+ ref,
29
+ className,
30
+ children,
31
+ ...rest
32
+ }: TableContainerProps & {
33
+ ref?: React.RefObject<HTMLDivElement>
34
+ }) {
35
+ const classes = cx(styles['table-container'], 'table-container', className)
36
+ return (
37
+ <div ref={ref} className={classes} {...rest}>
38
+ <div className={cx('table-scroller', styles['table-scroller'])}>{children}</div>
39
+ </div>
40
+ )
41
+ }
42
+
43
+ export type TableBodyProps = React.JSX.IntrinsicElements['tbody']
44
+
45
+ function Body({
46
+ ref,
47
+ className,
48
+ children,
49
+ ...rest
50
+ }: TableBodyProps & {
51
+ ref?: React.RefObject<HTMLTableSectionElement>
52
+ }): React.JSX.Element {
53
+ return (
54
+ <tbody ref={ref} className={cx('table-body', className)} {...rest}>
55
+ {children}
56
+ </tbody>
57
+ )
58
+ }
59
+
60
+ export type TableHeaderProps = React.JSX.IntrinsicElements['thead']
61
+
62
+ function Header({
63
+ ref,
64
+ className,
65
+ children,
66
+ ...rest
67
+ }: TableHeaderProps & {
68
+ ref?: React.RefObject<HTMLTableSectionElement>
69
+ }): React.JSX.Element {
70
+ const classes = cx(styles['table-header'], 'table-header', className)
71
+
72
+ return (
73
+ <thead ref={ref} className={classes} {...rest}>
74
+ {children}
75
+ </thead>
76
+ )
77
+ }
78
+
79
+ export type TableRowProps = React.JSX.IntrinsicElements['tr']
80
+
81
+ function Row({
82
+ ref,
83
+ className,
84
+ children,
85
+ ...rest
86
+ }: TableRowProps & {
87
+ ref?: React.RefObject<HTMLTableRowElement>
88
+ }): React.JSX.Element {
89
+ const classes = cx(styles['table-row'], 'table-row', className)
90
+
91
+ return (
92
+ <tr ref={ref} className={classes} {...rest}>
93
+ {children}
94
+ </tr>
95
+ )
96
+ }
97
+
98
+ export type TableHeadingCellProps = React.JSX.IntrinsicElements['th']
99
+
100
+ function HeadingCell({
101
+ ref,
102
+ className,
103
+ children,
104
+ ...rest
105
+ }: TableHeadingCellProps & {
106
+ ref?: React.RefObject<HTMLTableCellElement>
107
+ }): React.JSX.Element {
108
+ const classes = cx(styles['table-heading-cell'], 'table-heading-cell', 'not-prose', className)
109
+ return (
110
+ <th ref={ref} className={classes} {...rest}>
111
+ {children}
112
+ </th>
113
+ )
114
+ }
115
+
116
+ export type TableCellProps = React.JSX.IntrinsicElements['td']
117
+
118
+ function Cell({
119
+ ref,
120
+ className,
121
+ children,
122
+ ...rest
123
+ }: TableCellProps & {
124
+ ref?: React.RefObject<HTMLTableCellElement>
125
+ }): React.JSX.Element {
126
+ const classes = cx(styles['table-cell'], 'table-cell', className)
127
+
128
+ return (
129
+ <td ref={ref} className={classes} {...rest}>
130
+ {children}
131
+ </td>
132
+ )
133
+ }
134
+
135
+ export type TableFooterProps = React.JSX.IntrinsicElements['tfoot']
136
+
137
+ function Footer({
138
+ ref,
139
+ className,
140
+ children,
141
+ ...rest
142
+ }: TableFooterProps & {
143
+ ref?: React.RefObject<HTMLTableSectionElement>
144
+ }): React.JSX.Element {
145
+ const classes = cx(
146
+ 'text-xs text-gray-700 uppercase bg-canvas-100 dark:bg-canvas-700 dark:text-gray-400',
147
+ className
148
+ )
149
+
150
+ return (
151
+ <tfoot ref={ref} className={classes} {...rest}>
152
+ {children}
153
+ </tfoot>
154
+ )
155
+ }
156
+
157
+ Table.Container = Container
158
+ Table.Body = Body
159
+ Table.Header = Header
160
+ Table.Row = Row
161
+ Table.HeadingCell = HeadingCell
162
+ Table.Cell = Cell
163
+ Table.Footer = Footer
164
+
165
+ export { Table }
@@ -0,0 +1,64 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+
5
+ .tabs-root {
6
+ display: flex;
7
+ padding: var(--spacing-2);
8
+ flex-direction: column;
9
+ gap: var(--spacing-1);
10
+ border-radius: var(--border-radius-md);
11
+ border: 1px solid var(--border-color);
12
+ }
13
+
14
+ .tabs-list {
15
+ display: flex;
16
+ width: 100%;
17
+ gap: var(--gap-2);
18
+ align-items: center;
19
+ border-radius: var(--border-radius-md);
20
+ padding: var(--spacing-1);
21
+ border: 1px solid var(--border-color);
22
+
23
+ &:focus-visible {
24
+ outline: none;
25
+ }
26
+ }
27
+
28
+ .tabs-trigger {
29
+ align-items: center;
30
+ justify-content: center;
31
+ white-space: nowrap;
32
+ width: 100%;
33
+
34
+ /* &[data-state="active"] {
35
+ color: var(----primary-600);
36
+ box-shadow:
37
+ inset 0 -1px 0 0 currentColor,
38
+ 0 1px 0 0 currentColor;
39
+ } */
40
+
41
+ &:focus {
42
+ position: relative;
43
+ box-shadow: 0 0 0 2px black;
44
+ }
45
+ }
46
+
47
+ .tabs-content {
48
+ margin-top: var(--spacing-2);
49
+ padding: 6px;
50
+ outline: none;
51
+
52
+ &[data-state="inactive"] {
53
+ display: none;
54
+ }
55
+
56
+ &:focus {
57
+ outline: none;
58
+ }
59
+
60
+ &:focus-visible {
61
+ outline: none;
62
+ }
63
+ }
64
+ }
@@ -0,0 +1,47 @@
1
+ import type React from 'react'
2
+
3
+ import type { Meta } from '@storybook/react-vite'
4
+
5
+ import { Button } from '../button/button.js'
6
+ import { Tabs as TabsComponent } from './tabs.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',
14
+ component: TabsComponent,
15
+ }
16
+
17
+ export default meta
18
+
19
+ export const Tabs = (): React.JSX.Element => (
20
+ <div
21
+ style={{
22
+ maxWidth: '700px',
23
+ marginBottom: '24px',
24
+ display: 'flex',
25
+ justifyContent: 'center',
26
+ }}
27
+ >
28
+ <TabsComponent style={{ width: '400px', minHeight: '235px' }} defaultValue="detailsTab">
29
+ <TabsComponent.List>
30
+ <TabsComponent.Trigger asChild value="detailsTab">
31
+ <Button size="sm">Details</Button>
32
+ </TabsComponent.Trigger>
33
+ <TabsComponent.Trigger asChild value="rolesTab">
34
+ <Button size="sm">Roles</Button>
35
+ </TabsComponent.Trigger>
36
+ </TabsComponent.List>
37
+ <TabsComponent.Content value="detailsTab" forceMount={true}>
38
+ <p>Details tab content here. Some more text to make this tab content area a bit longer.</p>
39
+ <p>Details tab content here. Some more text to make this tab content area a bit longer.</p>
40
+ </TabsComponent.Content>
41
+ <TabsComponent.Content value="rolesTab">
42
+ <p>Roles tab content here. Some more text to make this tab content area a bit longer.</p>
43
+ <p>Roles tab content here. Some more text to make this tab content area a bit longer.</p>
44
+ </TabsComponent.Content>
45
+ </TabsComponent>
46
+ </div>
47
+ )
@@ -0,0 +1,75 @@
1
+ 'use client'
2
+
3
+ import cx from 'classnames'
4
+
5
+ import { Tabs as TabsPrimitive } from 'radix-ui'
6
+ import type * as React from 'react'
7
+
8
+ import styles from './tabs.module.css'
9
+
10
+ const Tabs = ({
11
+ ref,
12
+ className,
13
+ ...props
14
+ }: React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {
15
+ ref?: React.RefObject<React.ComponentRef<typeof TabsPrimitive.Root>>
16
+ }) => (
17
+ <TabsPrimitive.Root
18
+ ref={ref}
19
+ className={cx(styles['tabs-root'], 'tabs-root', className)}
20
+ {...props}
21
+ />
22
+ )
23
+ Tabs.displayName = TabsPrimitive.Root.displayName
24
+
25
+ const TabsList = ({
26
+ ref,
27
+ className,
28
+ ...props
29
+ }: React.ComponentPropsWithoutRef<typeof TabsPrimitive.List> & {
30
+ ref?: React.RefObject<React.ComponentRef<typeof TabsPrimitive.List>>
31
+ }) => (
32
+ <TabsPrimitive.List
33
+ ref={ref}
34
+ className={cx(styles['tabs-list'], 'tabs-list', className)}
35
+ {...props}
36
+ />
37
+ )
38
+ TabsList.displayName = TabsPrimitive.List.displayName
39
+
40
+ const TabsTrigger = ({
41
+ ref,
42
+ className,
43
+ ...props
44
+ }: React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger> & {
45
+ ref?: React.RefObject<React.ComponentRef<typeof TabsPrimitive.Trigger>>
46
+ }) => (
47
+ <TabsPrimitive.Trigger
48
+ ref={ref}
49
+ className={cx(styles['tabs-trigger'], 'tabs-trigger', className)}
50
+ {...props}
51
+ />
52
+ )
53
+ TabsTrigger.displayName = TabsPrimitive.Trigger.displayName
54
+
55
+ const TabsContent = ({
56
+ ref,
57
+ className,
58
+ ...props
59
+ }: React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content> & {
60
+ ref?: React.RefObject<React.ComponentRef<typeof TabsPrimitive.Content>>
61
+ }) => (
62
+ <TabsPrimitive.Content
63
+ ref={ref}
64
+ forceMount={true}
65
+ className={cx(styles['tabs-content'], 'tabs-content', className)}
66
+ {...props}
67
+ />
68
+ )
69
+ TabsContent.displayName = TabsPrimitive.Content.displayName
70
+
71
+ Tabs.List = TabsList
72
+ Tabs.Trigger = TabsTrigger
73
+ Tabs.Content = TabsContent
74
+
75
+ export { Tabs }
@@ -0,0 +1,87 @@
1
+ @layer infonomic-base, infonomic-utilities, infonomic-theme, infonomic-typography, infonomic-components;
2
+
3
+ @layer infonomic-components {
4
+ .timeline {
5
+ margin-left: var(--spacing-2);
6
+ }
7
+
8
+ .timeline-root {
9
+ position: relative;
10
+ list-style: none;
11
+ margin-left: var(--spacing-2);
12
+ padding-left: var(--spacing-8);
13
+ border-left-width: var(--border-width-thin);
14
+ border-left-color: var(--border-color);
15
+ border-left-style: var(--border-style-solid);
16
+ }
17
+
18
+ .timeline-item {
19
+ margin: 0 0 var(--spacing-6) 0;
20
+ }
21
+
22
+ /* 'absolute block flex items-center justify-center w-[36px] h-[36px] rounded-full -mt-[3px] sm:mt-0 -left-[18px] border-[6px] bg-secondary-600 dark:bg-secondary-900 border-gray-50 dark:border-canvas-600', */
23
+ .timeline-icon {
24
+ position: absolute;
25
+ display: flex;
26
+ align-items: center;
27
+ justify-content: center;
28
+ width: 36px;
29
+ height: 36px;
30
+ border-radius: 50%;
31
+ margin-top: -3px;
32
+ left: -18px;
33
+ border-width: 6px;
34
+ color: white;
35
+ background-color: var(--primary-600);
36
+ border-color: var(--gray-50);
37
+ }
38
+
39
+ .timeline-icon svg {
40
+ display: block;
41
+ width: 60%;
42
+ color: white;
43
+ }
44
+
45
+ /* 'text-[1.5rem] sm:text-[1.57rem] leading-[1.2] !m-0 font-semibold' */
46
+ .timeline-heading {
47
+ font-size: 1.5rem;
48
+ line-height: 1.2;
49
+ margin: 0;
50
+ font-weight: var(--font-weight-semibold);
51
+ }
52
+
53
+ /* 'block mt-2 mb-2 text-[0.9em] font-medium leading-none text-gray-900 dark:text-gray-100' */
54
+ .timeline-date {
55
+ display: block;
56
+ margin-top: var(--spacing-2);
57
+ margin-bottom: var(--spacing-2);
58
+ font-size: 0.9em;
59
+ font-weight: var(--font-weight-medium);
60
+ line-height: 0;
61
+ color: var(--gray-600);
62
+ }
63
+
64
+ /* '[&_p]:m-0 [&_p]:mb-4 [&_p]:sm:m-0 [&_p]:sm:mb-4 text-lg font-normal text-gray-900 dark:text-gray-300' */
65
+ .timeline-content {
66
+ margin: 0;
67
+ margin-bottom: var(--spacing-4);
68
+ font-size: 1.125rem;
69
+ font-weight: var(--font-weight-normal);
70
+
71
+ & p {
72
+ margin: 0;
73
+ margin-bottom: var(--spacing-4);
74
+ }
75
+ }
76
+
77
+ /* 🌙 Dark via `.dark` class. We rely on the
78
+ * consuming application to detect a user's preferred
79
+ * color scheme - either by header or cookie, and set
80
+ * a root html class accordingly
81
+ */
82
+ :global(.dark) {
83
+ .timeline-icon:not(:where([class~="not-dark"], [class~="not-dark"] *)) {
84
+ border-color: var(--canvas-600);
85
+ }
86
+ }
87
+ }