@xyd-js/components 0.1.0-build.168

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/.idea/git_toolbox_blame.xml +6 -0
  2. package/.idea/modules.xml +8 -0
  3. package/.idea/vcs.xml +6 -0
  4. package/.idea/xyd-components.iml +12 -0
  5. package/CHANGELOG.md +1369 -0
  6. package/LICENSE +21 -0
  7. package/README.md +3 -0
  8. package/TODO.md +1 -0
  9. package/coder.ts +1 -0
  10. package/content.ts +1 -0
  11. package/dist/Button-BLA2ghHZ.js +2 -0
  12. package/dist/Button-BLA2ghHZ.js.map +1 -0
  13. package/dist/Button-BTJ2hIal.js +2 -0
  14. package/dist/Button-BTJ2hIal.js.map +1 -0
  15. package/dist/Button-r4BCrEjy.js +2 -0
  16. package/dist/Button-r4BCrEjy.js.map +1 -0
  17. package/dist/CodeSample-BZ5tvyWY.js +2 -0
  18. package/dist/CodeSample-BZ5tvyWY.js.map +1 -0
  19. package/dist/CodeSample-BqXDbWdi.js +2 -0
  20. package/dist/CodeSample-BqXDbWdi.js.map +1 -0
  21. package/dist/CodeSample-Cqv86IdN.js +2 -0
  22. package/dist/CodeSample-Cqv86IdN.js.map +1 -0
  23. package/dist/Icon--77MqplU.js +2 -0
  24. package/dist/Icon--77MqplU.js.map +1 -0
  25. package/dist/Icon-DbNmvK_Q.js +2 -0
  26. package/dist/Icon-DbNmvK_Q.js.map +1 -0
  27. package/dist/Icon-uVIU1LW6.js +2 -0
  28. package/dist/Icon-uVIU1LW6.js.map +1 -0
  29. package/dist/PageFirstSlide-BDNmCTiJ.js +2 -0
  30. package/dist/PageFirstSlide-BDNmCTiJ.js.map +1 -0
  31. package/dist/PageFirstSlide-BpZ42bEU.js +2 -0
  32. package/dist/PageFirstSlide-BpZ42bEU.js.map +1 -0
  33. package/dist/PageFirstSlide-CqxiyK57.js +2 -0
  34. package/dist/PageFirstSlide-CqxiyK57.js.map +1 -0
  35. package/dist/TabsAnalytics-B_JYpawG.js +2 -0
  36. package/dist/TabsAnalytics-B_JYpawG.js.map +1 -0
  37. package/dist/TabsAnalytics-DAOfTZgv.js +2 -0
  38. package/dist/TabsAnalytics-DAOfTZgv.js.map +1 -0
  39. package/dist/TabsAnalytics-Dhyadlbu.js +2 -0
  40. package/dist/TabsAnalytics-Dhyadlbu.js.map +1 -0
  41. package/dist/Update-53fEhmjh.js +2 -0
  42. package/dist/Update-53fEhmjh.js.map +1 -0
  43. package/dist/Update-CFi6uapq.js +2 -0
  44. package/dist/Update-CFi6uapq.js.map +1 -0
  45. package/dist/Update-CiMIOgZi.js +2 -0
  46. package/dist/Update-CiMIOgZi.js.map +1 -0
  47. package/dist/VideoGuide-C0K9fFar.js +2 -0
  48. package/dist/VideoGuide-C0K9fFar.js.map +1 -0
  49. package/dist/VideoGuide-CJYkuLst.js +2 -0
  50. package/dist/VideoGuide-CJYkuLst.js.map +1 -0
  51. package/dist/VideoGuide-DBY-EyxG.js +2 -0
  52. package/dist/VideoGuide-DBY-EyxG.js.map +1 -0
  53. package/dist/_rollupPluginBabelHelpers-CvhQFv1t.js +4 -0
  54. package/dist/_rollupPluginBabelHelpers-CvhQFv1t.js.map +1 -0
  55. package/dist/_rollupPluginBabelHelpers-DSwDY1Dm.js +4 -0
  56. package/dist/_rollupPluginBabelHelpers-DSwDY1Dm.js.map +1 -0
  57. package/dist/_rollupPluginBabelHelpers-Dc-ocx4G.js +4 -0
  58. package/dist/_rollupPluginBabelHelpers-Dc-ocx4G.js.map +1 -0
  59. package/dist/coder/themes/classic.css +57 -0
  60. package/dist/coder/themes/classic.d.ts +96 -0
  61. package/dist/coder/themes/classic.js +2 -0
  62. package/dist/coder/themes/classic.js.map +1 -0
  63. package/dist/coder/themes/cosmo.css +64 -0
  64. package/dist/coder/themes/cosmo.d.ts +96 -0
  65. package/dist/coder/themes/cosmo.js +2 -0
  66. package/dist/coder/themes/cosmo.js.map +1 -0
  67. package/dist/coder.d.ts +94 -0
  68. package/dist/coder.js +2 -0
  69. package/dist/coder.js.map +1 -0
  70. package/dist/content.d.ts +411 -0
  71. package/dist/content.js +2 -0
  72. package/dist/content.js.map +1 -0
  73. package/dist/index.css +282 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.js +2 -0
  76. package/dist/index.js.map +1 -0
  77. package/dist/layouts.d.ts +33 -0
  78. package/dist/layouts.js +2 -0
  79. package/dist/layouts.js.map +1 -0
  80. package/dist/pages.d.ts +176 -0
  81. package/dist/pages.js +2 -0
  82. package/dist/pages.js.map +1 -0
  83. package/dist/system.d.ts +45 -0
  84. package/dist/system.js +2 -0
  85. package/dist/system.js.map +1 -0
  86. package/dist/useUXClick-DK3cTAMR.js +2 -0
  87. package/dist/useUXClick-DK3cTAMR.js.map +1 -0
  88. package/dist/useUXClick-DO6qBcRy.js +2 -0
  89. package/dist/useUXClick-DO6qBcRy.js.map +1 -0
  90. package/dist/useUXClick-NwpsiuK9.js +2 -0
  91. package/dist/useUXClick-NwpsiuK9.js.map +1 -0
  92. package/dist/useUXEvents-CJtgGV4R.js +2 -0
  93. package/dist/useUXEvents-CJtgGV4R.js.map +1 -0
  94. package/dist/useUXEvents-Cxgl7xb-.js +2 -0
  95. package/dist/useUXEvents-Cxgl7xb-.js.map +1 -0
  96. package/dist/useUXEvents-XqAGxoEj.js +2 -0
  97. package/dist/useUXEvents-XqAGxoEj.js.map +1 -0
  98. package/dist/useUXScrollDepth-3rk3Z95r.js +2 -0
  99. package/dist/useUXScrollDepth-3rk3Z95r.js.map +1 -0
  100. package/dist/useUXScrollDepth-BwK-XOBg.js +2 -0
  101. package/dist/useUXScrollDepth-BwK-XOBg.js.map +1 -0
  102. package/dist/useUXScrollDepth-DKre7PBz.js +2 -0
  103. package/dist/useUXScrollDepth-DKre7PBz.js.map +1 -0
  104. package/dist/uxsdk.d.ts +53 -0
  105. package/dist/uxsdk.js +2 -0
  106. package/dist/uxsdk.js.map +1 -0
  107. package/dist/views.d.ts +18 -0
  108. package/dist/views.js +2 -0
  109. package/dist/views.js.map +1 -0
  110. package/dist/writer.d.ts +580 -0
  111. package/dist/writer.js +2 -0
  112. package/dist/writer.js.map +1 -0
  113. package/docs/.nojekyll +1 -0
  114. package/docs/assets/hierarchy.js +1 -0
  115. package/docs/assets/highlight.css +22 -0
  116. package/docs/assets/icons.js +18 -0
  117. package/docs/assets/icons.svg +1 -0
  118. package/docs/assets/main.js +60 -0
  119. package/docs/assets/navigation.js +1 -0
  120. package/docs/assets/search.js +1 -0
  121. package/docs/assets/style.css +1640 -0
  122. package/docs/functions/GuideCard.html +6 -0
  123. package/docs/hierarchy.html +1 -0
  124. package/docs/index.html +2 -0
  125. package/docs/interfaces/GuideCardProps.html +18 -0
  126. package/docs/modules.html +1 -0
  127. package/index.ts +0 -0
  128. package/layouts.ts +1 -0
  129. package/output.txt +13 -0
  130. package/package.json +81 -0
  131. package/pages.ts +1 -0
  132. package/postcss.config.cjs +5 -0
  133. package/rollup.config.js +195 -0
  134. package/src/coder/Code/Code.styles.tsx +151 -0
  135. package/src/coder/Code/Code.tsx +171 -0
  136. package/src/coder/Code/CodeLoader.tsx +10 -0
  137. package/src/coder/Code/annotations.tsx +51 -0
  138. package/src/coder/Code/highlight.ts +208 -0
  139. package/src/coder/Code/index.ts +16 -0
  140. package/src/coder/CodeCopy/CodeCopy.styles.tsx +21 -0
  141. package/src/coder/CodeCopy/CodeCopy.tsx +36 -0
  142. package/src/coder/CodeCopy/index.ts +7 -0
  143. package/src/coder/CodeSample/CodeSample.tsx +118 -0
  144. package/src/coder/CodeSample/CodeSampleAnalytics.tsx +112 -0
  145. package/src/coder/CodeSample/index.ts +11 -0
  146. package/src/coder/CodeSample/withLocalStored.tsx +50 -0
  147. package/src/coder/CodeTabs/CodeTabs.styles.tsx +126 -0
  148. package/src/coder/CodeTabs/CodeTabs.tsx +128 -0
  149. package/src/coder/CodeTabs/index.ts +6 -0
  150. package/src/coder/CodeTheme/CodeTheme.tsx +126 -0
  151. package/src/coder/CodeTheme/index.ts +7 -0
  152. package/src/coder/CoderProvider.tsx +26 -0
  153. package/src/coder/README.md +1 -0
  154. package/src/coder/hooks/highlight.ts +182 -0
  155. package/src/coder/index.ts +37 -0
  156. package/src/coder/themes/classic.css +57 -0
  157. package/src/coder/themes/classic.ts +270 -0
  158. package/src/coder/themes/cosmo.css +64 -0
  159. package/src/coder/themes/cosmo.ts +264 -0
  160. package/src/content/AppearanceDecorator.styles.tsx +11 -0
  161. package/src/content/ContentDecoator.styles.tsx +180 -0
  162. package/src/content/ContentDecorator.tsx +17 -0
  163. package/src/content/GridDecorator.styles.tsx +86 -0
  164. package/src/content/GridDecorator.tsx +23 -0
  165. package/src/content/ReactContent.tsx +671 -0
  166. package/src/content/TODO.md +1 -0
  167. package/src/content/index.ts +13 -0
  168. package/src/kit/Loader/Loader.styles.tsx +53 -0
  169. package/src/kit/Loader/Loader.tsx +22 -0
  170. package/src/kit/TODO.md +2 -0
  171. package/src/kit/index.ts +1 -0
  172. package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +325 -0
  173. package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +252 -0
  174. package/src/layouts/LayoutPrimary/index.ts +3 -0
  175. package/src/layouts/index.ts +6 -0
  176. package/src/pages/PageBlogHome/PageBlogHome.styles.tsx +67 -0
  177. package/src/pages/PageBlogHome/PageBlogHome.tsx +64 -0
  178. package/src/pages/PageBlogHome/index.ts +3 -0
  179. package/src/pages/PageBlogHome/types.ts +35 -0
  180. package/src/pages/PageBlogPost/PageBlogPost.styles.tsx +4 -0
  181. package/src/pages/PageBlogPost/PageBlogPost.tsx +9 -0
  182. package/src/pages/PageBlogPost/index.ts +3 -0
  183. package/src/pages/PageFirstSlide/PageFirstSlide.styles.tsx +134 -0
  184. package/src/pages/PageFirstSlide/PageFirstSlide.tsx +56 -0
  185. package/src/pages/PageFirstSlide/index.ts +1 -0
  186. package/src/pages/PageFirstSlide/types.ts +67 -0
  187. package/src/pages/PageHome/PageHome.styles.tsx +51 -0
  188. package/src/pages/PageHome/PageHome.tsx +62 -0
  189. package/src/pages/PageHome/index.ts +3 -0
  190. package/src/pages/PageHome/types.ts +79 -0
  191. package/src/pages/index.ts +7 -0
  192. package/src/system/Baseline/Baseline.styles.tsx +128 -0
  193. package/src/system/Baseline/Baseline.tsx +40 -0
  194. package/src/system/Baseline/bun.svg +1 -0
  195. package/src/system/Baseline/check.svg +1 -0
  196. package/src/system/Baseline/index.ts +1 -0
  197. package/src/system/Baseline/logo.svg +1 -0
  198. package/src/system/Baseline/node.svg +7 -0
  199. package/src/system/Baseline/npm.svg +5 -0
  200. package/src/system/Baseline/pnpm.svg +1 -0
  201. package/src/system/Footer/Footer.styles.tsx +213 -0
  202. package/src/system/Footer/Footer.tsx +105 -0
  203. package/src/system/Footer/index.ts +1 -0
  204. package/src/system/SearchButton/SearchButton.styles.tsx +89 -0
  205. package/src/system/SearchButton/SearchButton.tsx +118 -0
  206. package/src/system/SearchButton/index.ts +1 -0
  207. package/src/system/index.ts +3 -0
  208. package/src/utils/useStyle.ts +19 -0
  209. package/src/uxsdk/const.ts +1 -0
  210. package/src/uxsdk/index.ts +21 -0
  211. package/src/uxsdk/useUXClick.ts +21 -0
  212. package/src/uxsdk/useUXEvents.ts +105 -0
  213. package/src/uxsdk/useUXScrollDepth.ts +49 -0
  214. package/src/uxsdk/useUXUnreachableElementTracker.ts +100 -0
  215. package/src/views/HomeView/HomeView.styles.tsx +37 -0
  216. package/src/views/HomeView/HomeView.tsx +34 -0
  217. package/src/views/HomeView/index.ts +3 -0
  218. package/src/writer/Anchor/Anchor.styles.tsx +26 -0
  219. package/src/writer/Anchor/Anchor.tsx +51 -0
  220. package/src/writer/Anchor/index.tsx +1 -0
  221. package/src/writer/Badge/Badge.styles.tsx +44 -0
  222. package/src/writer/Badge/Badge.tsx +47 -0
  223. package/src/writer/Badge/index.ts +7 -0
  224. package/src/writer/Banner/Banner.styles.tsx +111 -0
  225. package/src/writer/Banner/Banner.tsx +151 -0
  226. package/src/writer/Banner/index.ts +1 -0
  227. package/src/writer/Blockquote/Blockquote.styles.tsx +20 -0
  228. package/src/writer/Blockquote/Blockquote.tsx +38 -0
  229. package/src/writer/Blockquote/index.ts +7 -0
  230. package/src/writer/BlogCard/BlogCard.styles.tsx +4 -0
  231. package/src/writer/BlogCard/BlogCard.tsx +9 -0
  232. package/src/writer/BlogCard/index.ts +3 -0
  233. package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +24 -0
  234. package/src/writer/Breadcrumbs/Breadcrumbs.tsx +57 -0
  235. package/src/writer/Breadcrumbs/index.ts +7 -0
  236. package/src/writer/Button/Button.styles.tsx +149 -0
  237. package/src/writer/Button/Button.tsx +82 -0
  238. package/src/writer/Button/index.ts +2 -0
  239. package/src/writer/Callout/Callout.styles.tsx +102 -0
  240. package/src/writer/Callout/Callout.tsx +166 -0
  241. package/src/writer/Callout/index.tsx +3 -0
  242. package/src/writer/Card/Card.styles.tsx +110 -0
  243. package/src/writer/Card/Card.tsx +94 -0
  244. package/src/writer/Card/index.ts +1 -0
  245. package/src/writer/Code/Code.styles.tsx +16 -0
  246. package/src/writer/Code/Code.tsx +16 -0
  247. package/src/writer/Code/index.ts +3 -0
  248. package/src/writer/ColorSchemeButton/ColorSchemeButton.tsx +191 -0
  249. package/src/writer/ColorSchemeButton/index.ts +1 -0
  250. package/src/writer/Details/Details.styles.tsx +101 -0
  251. package/src/writer/Details/Details.tsx +168 -0
  252. package/src/writer/Details/DetailsProps.tsx +34 -0
  253. package/src/writer/Details/index.ts +6 -0
  254. package/src/writer/GuideCard/GuideCard.styles.tsx +129 -0
  255. package/src/writer/GuideCard/GuideCard.tsx +123 -0
  256. package/src/writer/GuideCard/index.ts +1 -0
  257. package/src/writer/Heading/Heading.styles.tsx +93 -0
  258. package/src/writer/Heading/Heading.tsx +123 -0
  259. package/src/writer/Heading/index.ts +7 -0
  260. package/src/writer/Hr/Hr.styles.tsx +7 -0
  261. package/src/writer/Hr/Hr.tsx +10 -0
  262. package/src/writer/Hr/index.ts +3 -0
  263. package/src/writer/Icon/Icon.styles.tsx +15 -0
  264. package/src/writer/Icon/Icon.tsx +99 -0
  265. package/src/writer/Icon/index.ts +1 -0
  266. package/src/writer/IconSocial/IconSocial.tsx +107 -0
  267. package/src/writer/IconSocial/index.ts +1 -0
  268. package/src/writer/Image/Image.styles.tsx +9 -0
  269. package/src/writer/Image/Image.tsx +35 -0
  270. package/src/writer/Image/index.ts +1 -0
  271. package/src/writer/List/List.styles.tsx +47 -0
  272. package/src/writer/List/List.tsx +29 -0
  273. package/src/writer/List/index.ts +4 -0
  274. package/src/writer/NavLinks/NavLinks.styles.ts +32 -0
  275. package/src/writer/NavLinks/NavLinks.tsx +95 -0
  276. package/src/writer/NavLinks/index.ts +7 -0
  277. package/src/writer/Pre/Pre.styles.tsx +13 -0
  278. package/src/writer/Pre/Pre.tsx +14 -0
  279. package/src/writer/Pre/index.ts +3 -0
  280. package/src/writer/README.md +1 -0
  281. package/src/writer/Steps/Steps.styles.tsx +91 -0
  282. package/src/writer/Steps/Steps.tsx +75 -0
  283. package/src/writer/Steps/index.ts +5 -0
  284. package/src/writer/Table/Table.styles.tsx +100 -0
  285. package/src/writer/Table/Table.tsx +158 -0
  286. package/src/writer/Table/index.ts +3 -0
  287. package/src/writer/Tabs/Tabs.tsx +67 -0
  288. package/src/writer/Tabs/TabsAnalytics.tsx +25 -0
  289. package/src/writer/Tabs/TabsPrimary.styles.tsx +187 -0
  290. package/src/writer/Tabs/TabsPrimary.tsx +215 -0
  291. package/src/writer/Tabs/TabsProps.tsx +13 -0
  292. package/src/writer/Tabs/TabsSecondary.styles.tsx +78 -0
  293. package/src/writer/Tabs/TabsSecondary.tsx +176 -0
  294. package/src/writer/Tabs/index.ts +2 -0
  295. package/src/writer/Tabs/useValueChange.ts +84 -0
  296. package/src/writer/Text/Text.styles.tsx +66 -0
  297. package/src/writer/Text/Text.tsx +79 -0
  298. package/src/writer/Text/index.ts +3 -0
  299. package/src/writer/TocCard/TocCard.module.css +44 -0
  300. package/src/writer/TocCard/TocCard.tsx +42 -0
  301. package/src/writer/TocCard/index.ts +3 -0
  302. package/src/writer/Update/Update.styles.tsx +33 -0
  303. package/src/writer/Update/Update.tsx +37 -0
  304. package/src/writer/Update/index.ts +1 -0
  305. package/src/writer/VideoGuide/VideoGuide.module.css +105 -0
  306. package/src/writer/VideoGuide/VideoGuide.tsx +75 -0
  307. package/src/writer/VideoGuide/index.ts +1 -0
  308. package/src/writer/index.ts +53 -0
  309. package/system.ts +1 -0
  310. package/tsconfig.json +46 -0
  311. package/types.d.ts +52 -0
  312. package/uxsdk.ts +1 -0
  313. package/views.ts +2 -0
  314. package/writer.ts +1 -0
@@ -0,0 +1,100 @@
1
+ import {css} from "@linaria/core";
2
+
3
+ export default {
4
+ Host: css`
5
+ @layer defaults {
6
+ display: table;
7
+ width: 100%;
8
+ border-collapse: separate;
9
+ border-spacing: 0;
10
+ border: 1px solid var(--xyd-table-border-color);
11
+ border-radius: 8px;
12
+ margin-top: 16px;
13
+ //overflow: hidden;
14
+
15
+ &[data-kind="secondary"] {
16
+ border: none;
17
+
18
+ th, td {
19
+ border: none;
20
+ border-bottom: 1px solid var(--xyd-table-border-color);
21
+ }
22
+ }
23
+
24
+ @media (min-width: 1400px) {
25
+ min-width: 640px;
26
+ }
27
+
28
+ @media (max-width: 1024px) {
29
+ overflow: auto;
30
+ display: block;
31
+ }
32
+ }
33
+ `,
34
+ Thead: css`
35
+ @layer defaults {
36
+ background: var(--xyd-table-bgcolor);
37
+ }
38
+ `,
39
+ Tbody: css`
40
+
41
+ `,
42
+ Th: css`
43
+ @layer defaults {
44
+ text-align: left;
45
+ //font-weight: var(--xyd-font-weight-medium);
46
+ font-weight: bold;
47
+ padding: 0.5rem 1rem;
48
+ white-space: nowrap;
49
+ vertical-align: middle;
50
+ color: var(--xyd-table-color);
51
+ border-bottom: 1px solid var(--xyd-table-border-color);
52
+ border-right: 1px solid var(--xyd-table-border-color);
53
+
54
+
55
+ }
56
+ `,
57
+ Tr: css`
58
+ @layer defaults {
59
+ &:not(:last-child) {
60
+ border-bottom: 1px solid var(--xyd-table-border-color);
61
+ }
62
+ }
63
+ `,
64
+ Td: css`
65
+ @layer defaults {
66
+ padding: 0.5rem 1rem;
67
+ vertical-align: middle;
68
+ border-top: 1px solid var(--xyd-table-border-color);
69
+ border-right: 1px solid var(--xyd-table-border-color);
70
+ max-width: 300px;
71
+ overflow: auto;
72
+
73
+ @media (max-width: 768px) {
74
+ padding: 0.5rem;
75
+ }
76
+
77
+ code {
78
+ &.json {
79
+ width: 100%;
80
+ font-family: unset; // TODO: BETTER - cuz issues with displaying json on mobile
81
+ }
82
+ text-align: left;
83
+ }
84
+ }
85
+ `,
86
+ Cell: css`
87
+ @layer defaults {
88
+ display: flex;
89
+ align-items: baseline;
90
+ width: 100%;
91
+ gap: 0.5rem;
92
+
93
+ [part="child"] {
94
+ flex: 1;
95
+ //text-align: right;
96
+ }
97
+ }
98
+ `
99
+ }
100
+
@@ -0,0 +1,158 @@
1
+ import React from "react"
2
+
3
+ import cn from "./Table.styles";
4
+
5
+ /**
6
+ * Props for the Table component
7
+ */
8
+ export interface TableProps {
9
+ /** The content to be rendered inside the table */
10
+ children: React.ReactNode;
11
+
12
+ /** Optional kind of the table, can be used for styling purposes */
13
+ kind?: "secondary"
14
+
15
+ /** Optional CSS class name to be applied to the table */
16
+ className?: string;
17
+ }
18
+
19
+ /**
20
+ * A table component that provides a structured way to display tabular data.
21
+ * It supports custom styling through className prop and can contain various table elements.
22
+ *
23
+ * @category Component
24
+ */
25
+ export function Table({ children, kind, className }: TableProps) {
26
+ return (
27
+ <table data-kind={kind || undefined} className={`${cn.Host} ${className || ''}`}>
28
+ {children}
29
+ </table>
30
+ );
31
+ }
32
+
33
+ /**
34
+ * Props for the TableHead component
35
+ */
36
+ export interface TableHeadProps {
37
+ /** The content to be rendered inside the table header */
38
+ children: React.ReactNode;
39
+ }
40
+
41
+ /**
42
+ * Represents the header section of a table.
43
+ * Use this component to group header content at the top of the table.
44
+ */
45
+ Table.Head = function TableHead({ children }: TableHeadProps) {
46
+ return <thead className={cn.Thead}>
47
+ {children}
48
+ </thead>
49
+ }
50
+
51
+ /**
52
+ * Props for the TableTh component
53
+ */
54
+ export interface TableThProps {
55
+ /** The content to be rendered inside the table header cell */
56
+ children: React.ReactNode;
57
+
58
+ /** Whether the cell content should be right-aligned (for numeric values) */
59
+ numeric?: boolean;
60
+ }
61
+
62
+ /**
63
+ * Represents a header cell in the table.
64
+ * Use this component for column headers in the table.
65
+ */
66
+ Table.Th = function TableTh({ children, numeric }: TableThProps) {
67
+ return <th className={`${cn.Th} ${numeric ? 'numeric' : ''}`}>
68
+ {children}
69
+ </th>
70
+ }
71
+
72
+ /**
73
+ * Props for the TableTr component
74
+ */
75
+ export interface TableTrProps {
76
+ /** The content to be rendered inside the table row */
77
+ children: React.ReactNode;
78
+ }
79
+
80
+ /**
81
+ * Represents a row in the table.
82
+ * Use this component to create rows in the table body or header.
83
+ */
84
+ Table.Tr = function TableTr({ children }: TableTrProps) {
85
+ return <tr className={cn.Tr}>
86
+ {children}
87
+ </tr>
88
+ }
89
+
90
+ /**
91
+ * Props for the TableBody component
92
+ */
93
+ export interface TableBodyProps {
94
+ /** The content to be rendered inside the table body */
95
+ children: React.ReactNode;
96
+ }
97
+
98
+ /**
99
+ * Represents the main content area of the table.
100
+ * Use this component to group the main content rows of the table.
101
+ */
102
+ Table.Body = function TableBody({ children }: TableBodyProps) {
103
+ return <tbody className={cn.Tbody}>
104
+ {children}
105
+ </tbody>
106
+ }
107
+
108
+ /**
109
+ * Props for the TableTd component
110
+ */
111
+ export interface TableTdProps {
112
+ /** The content to be rendered inside the table cell */
113
+ children: React.ReactNode;
114
+
115
+ /** Whether the cell content should be right-aligned (for numeric values) */
116
+ numeric?: boolean;
117
+
118
+ /** Whether the cell should have a muted appearance */
119
+ muted?: boolean;
120
+ }
121
+
122
+ /**
123
+ * Represents a data cell in the table.
124
+ * Use this component for regular data cells in the table body.
125
+ */
126
+ Table.Td = function TableTd({ children, numeric, muted }: TableTdProps) {
127
+ return <td className={`${cn.Td} ${numeric ? 'numeric' : ''} ${muted ? 'muted' : ''}`}>
128
+ {children}
129
+ </td>
130
+ }
131
+
132
+ /**
133
+ * Props for the TableCell component
134
+ */
135
+ export interface TableCellProps {
136
+ /** The content to be rendered inside the table cell */
137
+ children: React.ReactNode;
138
+ }
139
+
140
+ /**
141
+ * A custom table cell component that wraps content in a div with specific styling.
142
+ * Use this component when you need a custom-styled cell with additional structure.
143
+ */
144
+ Table.Cell = function TableCell({ children }: TableCellProps) {
145
+ return <xyd-table-cell className={cn.Cell}>
146
+ <div part="child">
147
+ {children}
148
+ </div>
149
+ </xyd-table-cell>
150
+ }
151
+
152
+ /**
153
+ * Props for the TableModelCell component
154
+ */
155
+ export interface TableModelCellProps {
156
+ /** The content to be rendered inside the model cell */
157
+ children: React.ReactNode;
158
+ }
@@ -0,0 +1,3 @@
1
+ export {
2
+ Table
3
+ } from "./Table"
@@ -0,0 +1,67 @@
1
+ import React, {createContext, useContext, useState, useRef} from "react"
2
+
3
+ import {TabsPrimary, TabsPrimaryProps} from "./TabsPrimary"
4
+ import {TabsSecondary, TabsSecondaryProps} from "./TabsSecondary";
5
+ import {TabsAnalytics} from "./TabsAnalytics";
6
+
7
+ export interface TabsPropsCommon {
8
+ /** The kind of tabs to render. If not provided, the component will render the primary tabs. */
9
+ kind?: 'secondary' | null
10
+ }
11
+
12
+ // // TODO: in the future unify the TabsPrimary and TabsSecondary components?
13
+ type TabsProps<T> = T & TabsPropsCommon
14
+
15
+ const TabsContext = createContext<{
16
+ kind: string | null
17
+ }>({
18
+ kind: null,
19
+ })
20
+
21
+ /**
22
+ * A component that renders a tabs component.
23
+ *
24
+ * @category Component
25
+ */
26
+ export function Tabs(props: TabsProps<TabsSecondaryProps | TabsPrimaryProps>) {
27
+ let tabs: React.ReactNode
28
+
29
+ if (props.kind === 'secondary') {
30
+ tabs = <TabsContext.Provider value={{kind: 'secondary'}}>
31
+ <TabsSecondary {...props} />
32
+ </TabsContext.Provider>
33
+
34
+ } else {
35
+ tabs = <TabsContext.Provider value={{kind: null}}>
36
+ <TabsPrimary {...props} />
37
+ </TabsContext.Provider>
38
+ }
39
+
40
+ return <TabsAnalytics>
41
+ {tabs}
42
+ </TabsAnalytics>
43
+ }
44
+
45
+ Tabs.Item = function TabsItem(props: any) {
46
+ const {kind} = useContext(TabsContext)
47
+
48
+ if (kind === 'secondary') {
49
+ return <TabsSecondary.Item {...props} />
50
+ }
51
+
52
+ return <TabsPrimary.Item {...props} />
53
+ }
54
+ //@ts-ignore TODO: fix ts
55
+ Tabs.Item.displayName = "Tabs.Item"
56
+
57
+ Tabs.Content = function TabsContent(props: any) {
58
+ const {kind} = useContext(TabsContext)
59
+
60
+ if (kind === 'secondary') {
61
+ return <TabsSecondary.Content {...props} />
62
+ }
63
+
64
+ return <TabsPrimary.Content {...props} />
65
+ }
66
+ //@ts-ignore TODO: fix ts
67
+ Tabs.Content.displayName = "Tabs.Content"
@@ -0,0 +1,25 @@
1
+ import React, {createContext, useContext, useRef, useState} from "react";
2
+
3
+ const TabsAnalyticsContext = createContext<{
4
+ value: string
5
+ setValue: (value: string) => void
6
+ tabsRef: React.RefObject<HTMLElement | null>
7
+ }>({
8
+ value: "",
9
+ setValue: () => {
10
+ },
11
+ tabsRef: {current: null}
12
+ })
13
+
14
+ export function TabsAnalytics({children}: { children: React.ReactNode }) {
15
+ const [value, setValue] = useState("")
16
+ const tabsRef = useRef<HTMLElement | null>(null)
17
+
18
+ return <TabsAnalyticsContext value={{value, setValue, tabsRef}}>
19
+ {children}
20
+ </TabsAnalyticsContext>
21
+ }
22
+
23
+ export function useTabsAnalytics() {
24
+ return useContext(TabsAnalyticsContext)
25
+ }
@@ -0,0 +1,187 @@
1
+ import { css } from "@linaria/core"
2
+
3
+ export const TabsPrimaryHost = css`
4
+ @layer defaults {
5
+ display: block;
6
+
7
+ [part="nav"] {
8
+ align-items: center;
9
+ display: flex;
10
+ height: 42px;
11
+ background-color: var(--xyd-tabs-primary-bgcolor);
12
+ border-bottom: 1px solid var(--xyd-tabs-primary-border-color);
13
+ z-index: 99;
14
+ overflow-x: auto;
15
+
16
+ &[data-kind="secondary"] {
17
+ border-bottom: none;
18
+ border-radius: 8px;
19
+ padding: 4px;
20
+ background-color: var(--xyd-tabs-bgcolor);
21
+ }
22
+ }
23
+
24
+ [part="list"] {
25
+ display: flex;
26
+ gap: 10px;
27
+ height: 100%;
28
+ color: var(--xyd-tabs-primary-list-color);
29
+ list-style: none;
30
+ padding: 0;
31
+ white-space: nowrap;
32
+
33
+ [data-kind="secondary"] & {
34
+ gap: 4px;
35
+ }
36
+ }
37
+
38
+ [part="item"] {
39
+ height: 100%;
40
+ position: relative;
41
+
42
+ a, button {
43
+ height: 100%;
44
+ }
45
+
46
+ &[data-state="active"] {
47
+ a {
48
+ border-bottom-color: var(--xyd-tabs-primary-color--active);
49
+ }
50
+
51
+ [data-kind="secondary"] & a {
52
+ border-bottom-color: transparent;
53
+ color: var(--xyd-tabs-color--active);
54
+ background-color: var(--xyd-tabs-bgcolor--active);
55
+ box-shadow: 0 1px 2px 0 var(--xyd-tabs-shadow-color--active);
56
+ }
57
+ }
58
+
59
+ &[data-state="inactive"] {
60
+ a, button {
61
+ color: unset;
62
+ }
63
+ }
64
+ }
65
+
66
+ [part="link"] {
67
+ display: inline-flex;
68
+ border-bottom: 3px solid transparent;
69
+ text-decoration: none;
70
+ height: 100%;
71
+ padding: 10px;
72
+ transition: all 0.3s ease;
73
+ cursor: pointer;
74
+
75
+ &:hover {
76
+ color: var(--xyd-tabs-primary-color--active);
77
+ }
78
+
79
+ [data-kind="secondary"] & {
80
+ border-bottom: none;
81
+ padding: 5px 16px;
82
+ border-radius: 0.375rem;
83
+ color: var(--xyd-tabs-color);
84
+
85
+ &:hover {
86
+ color: var(--xyd-tabs-color--active);
87
+ }
88
+ }
89
+ }
90
+
91
+ [part="content"] {
92
+ position: relative;
93
+ overflow: hidden;
94
+
95
+ [data-kind="secondary"] & {
96
+ margin-top: 16px;
97
+ }
98
+ }
99
+ }
100
+ `;
101
+
102
+ export const TabsPrimaryContent = css`
103
+ @keyframes fadeInFromRight {
104
+ from {
105
+ opacity: 0;
106
+ transform: translateX(75px);
107
+ }
108
+ to {
109
+ opacity: 1;
110
+ transform: translateX(0);
111
+ }
112
+ }
113
+
114
+ @keyframes fadeOutToLeft {
115
+ from {
116
+ opacity: 1;
117
+ transform: translateX(0);
118
+ }
119
+ to {
120
+ opacity: 0;
121
+ transform: translateX(-75px);
122
+ }
123
+ }
124
+
125
+ @keyframes fadeInFromLeft {
126
+ from {
127
+ opacity: 0;
128
+ transform: translateX(-75px);
129
+ }
130
+ to {
131
+ opacity: 1;
132
+ transform: translateX(0);
133
+ }
134
+ }
135
+
136
+ @keyframes fadeOutToRight {
137
+ from {
138
+ opacity: 1;
139
+ transform: translateX(0);
140
+ }
141
+ to {
142
+ opacity: 0;
143
+ transform: translateX(75px);
144
+ }
145
+ }
146
+
147
+ @layer defaults {
148
+ position: relative;
149
+ width: 100%;
150
+
151
+ &[data-state="inactive"] {
152
+ display: none;
153
+ }
154
+
155
+ /* Only apply animations when parent has data-slide="true" */
156
+ [data-slide="true"] & {
157
+ /* Forward direction (left to right) */
158
+
159
+ &[data-direction="forward"][data-state="active"] {
160
+ position: relative;
161
+ animation: fadeInFromRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
162
+ }
163
+
164
+ &[data-direction="forward"][data-state="inactive"] {
165
+ position: absolute;
166
+ animation: fadeOutToLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
167
+ }
168
+
169
+ /* Backward direction (right to left) */
170
+
171
+ &[data-direction="backward"][data-state="active"] {
172
+ position: relative;
173
+ animation: fadeInFromLeft 0.4s cubic-bezier(0.16, 1, 0.3, 1);
174
+ }
175
+
176
+ &[data-direction="backward"][data-state="inactive"] {
177
+ position: absolute;
178
+ animation: fadeOutToRight 0.4s cubic-bezier(0.16, 1, 0.3, 1);
179
+ }
180
+ }
181
+
182
+ [part="child"] {
183
+ padding: 20px;
184
+ transition: all 0.3s ease;
185
+ }
186
+ }
187
+ `;