@xyd-js/components 0.1.0-xyd.7 → 0.1.0-xyd.94

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 (251) 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 +718 -0
  6. package/LICENSE +21 -0
  7. package/TODO.md +1 -0
  8. package/content.ts +0 -2
  9. package/dist/CTABanner-Bc77pnms.js +2 -0
  10. package/dist/CTABanner-Bc77pnms.js.map +1 -0
  11. package/dist/CTABanner-DzO62aGj.js +2 -0
  12. package/dist/CTABanner-DzO62aGj.js.map +1 -0
  13. package/dist/CodeSample-BWPDgd2G.js +2 -0
  14. package/dist/CodeSample-BWPDgd2G.js.map +1 -0
  15. package/dist/CodeSample-DLnR-knP.js +2 -0
  16. package/dist/CodeSample-DLnR-knP.js.map +1 -0
  17. package/dist/HomeView-C8QlNdKh.js +2 -0
  18. package/dist/HomeView-C8QlNdKh.js.map +1 -0
  19. package/dist/HomeView-ZAP5saNy.js +2 -0
  20. package/dist/HomeView-ZAP5saNy.js.map +1 -0
  21. package/dist/Icon-BESh23UN.js +2 -0
  22. package/dist/Icon-BESh23UN.js.map +1 -0
  23. package/dist/Icon-xNucOqd2.js +2 -0
  24. package/dist/Icon-xNucOqd2.js.map +1 -0
  25. package/dist/Text-CfN9RkYA.js +2 -0
  26. package/dist/Text-CfN9RkYA.js.map +1 -0
  27. package/dist/Text-DKycD2zu.js +2 -0
  28. package/dist/Text-DKycD2zu.js.map +1 -0
  29. package/dist/Update-0XruJHjj.js +2 -0
  30. package/dist/Update-0XruJHjj.js.map +1 -0
  31. package/dist/Update-DKOAw8p9.js +2 -0
  32. package/dist/Update-DKOAw8p9.js.map +1 -0
  33. package/dist/VideoGuide-BUyomFVz.js +2 -0
  34. package/dist/VideoGuide-BUyomFVz.js.map +1 -0
  35. package/dist/VideoGuide-B_iUKKv7.js +2 -0
  36. package/dist/VideoGuide-B_iUKKv7.js.map +1 -0
  37. package/dist/_rollupPluginBabelHelpers-CxSUtGup.js +4 -0
  38. package/dist/_rollupPluginBabelHelpers-CxSUtGup.js.map +1 -0
  39. package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js +4 -0
  40. package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js.map +1 -0
  41. package/dist/brand.d.ts +9 -9
  42. package/dist/brand.js +1 -1
  43. package/dist/brand.js.map +1 -1
  44. package/dist/coder/themes/cosmo-light.js.map +1 -1
  45. package/dist/coder.d.ts +29 -9
  46. package/dist/coder.js +1 -1
  47. package/dist/coder.js.map +1 -1
  48. package/dist/content.d.ts +268 -204
  49. package/dist/content.js +1 -1
  50. package/dist/content.js.map +1 -1
  51. package/dist/index.css +267 -216
  52. package/dist/layouts.d.ts +20 -21
  53. package/dist/layouts.js +1 -1
  54. package/dist/layouts.js.map +1 -1
  55. package/dist/pages.js +1 -1
  56. package/dist/pages.js.map +1 -1
  57. package/dist/system.d.ts +10 -0
  58. package/dist/system.js +2 -0
  59. package/dist/system.js.map +1 -0
  60. package/dist/tslib.es6-DyL9kPq9.js +2 -0
  61. package/dist/{tslib.es6-DDIOdJiV.js.map → tslib.es6-DyL9kPq9.js.map} +1 -1
  62. package/dist/tslib.es6-Hqk-Mdr9.js +2 -0
  63. package/dist/{tslib.es6-DUrRPhZd.js.map → tslib.es6-Hqk-Mdr9.js.map} +1 -1
  64. package/dist/views.js +1 -1
  65. package/dist/writer.d.ts +411 -78
  66. package/dist/writer.js +1 -1
  67. package/dist/writer.js.map +1 -1
  68. package/docs/.nojekyll +1 -0
  69. package/docs/assets/hierarchy.js +1 -0
  70. package/docs/assets/highlight.css +22 -0
  71. package/docs/assets/icons.js +18 -0
  72. package/docs/assets/icons.svg +1 -0
  73. package/docs/assets/main.js +60 -0
  74. package/docs/assets/navigation.js +1 -0
  75. package/docs/assets/search.js +1 -0
  76. package/docs/assets/style.css +1640 -0
  77. package/docs/functions/GuideCard.html +6 -0
  78. package/docs/hierarchy.html +1 -0
  79. package/docs/index.html +2 -0
  80. package/docs/interfaces/GuideCardProps.html +18 -0
  81. package/docs/modules.html +1 -0
  82. package/index.ts +0 -1
  83. package/package.json +13 -18
  84. package/project.json +677 -0
  85. package/rollup.config.js +32 -3
  86. package/src/brand/Button/Button.styles.tsx +28 -0
  87. package/src/brand/Button/Button.tsx +3 -35
  88. package/src/brand/CTABanner/CTABanner.styles.tsx +80 -0
  89. package/src/brand/CTABanner/CTABanner.tsx +34 -112
  90. package/src/brand/Footer/Footer.styles.tsx +18 -0
  91. package/src/brand/Footer/Footer.tsx +4 -24
  92. package/src/brand/TODO.md +1 -0
  93. package/src/coder/Code/Code.styles.tsx +134 -35
  94. package/src/coder/Code/Code.tsx +131 -40
  95. package/src/coder/Code/CodeLoader.tsx +4 -4
  96. package/src/coder/Code/annotations.tsx +28 -8
  97. package/src/coder/Code/highlight.ts +38 -0
  98. package/src/coder/Code/index.ts +2 -1
  99. package/src/coder/CodeCopy/{CodeCopy.style.tsx → CodeCopy.styles.tsx} +6 -6
  100. package/src/coder/CodeCopy/CodeCopy.tsx +6 -6
  101. package/src/coder/CodeSample/CodeSample.tsx +83 -27
  102. package/src/coder/CodeTabs/CodeTabs.styles.tsx +99 -78
  103. package/src/coder/CodeTabs/CodeTabs.tsx +71 -56
  104. package/src/coder/CodeTheme/CodeTheme.tsx +89 -49
  105. package/src/coder/CodeTheme/index.ts +0 -1
  106. package/src/coder/CoderProvider.tsx +26 -0
  107. package/src/coder/index.ts +8 -4
  108. package/src/content/ContentDecoator.styles.tsx +113 -0
  109. package/src/content/ContentDecorator.tsx +17 -0
  110. package/src/content/GridDecorator.styles.tsx +67 -0
  111. package/src/content/GridDecorator.tsx +21 -0
  112. package/src/content/ReactContent.tsx +575 -0
  113. package/src/content/index.ts +10 -2
  114. package/src/icons/index.ts +0 -0
  115. package/src/kit/Loader/Loader.styles.tsx +53 -0
  116. package/src/kit/Loader/Loader.tsx +22 -0
  117. package/src/kit/TODO.md +2 -0
  118. package/src/kit/index.ts +1 -0
  119. package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +263 -278
  120. package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +173 -96
  121. package/src/layouts/LayoutPrimary/index.ts +0 -2
  122. package/src/layouts/index.ts +0 -7
  123. package/src/pages/HomePage/HomePage.styles.tsx +16 -0
  124. package/src/pages/HomePage/HomePage.tsx +7 -21
  125. package/src/pages/TODO.md +1 -0
  126. package/src/system/SearchButton/SearchButton.styles.tsx +86 -0
  127. package/src/system/SearchButton/SearchButton.tsx +116 -0
  128. package/src/system/SearchButton/index.ts +1 -0
  129. package/src/system/index.ts +1 -0
  130. package/src/utils/useStyle.ts +19 -0
  131. package/src/views/HomeView/HomeView.styles.tsx +37 -0
  132. package/src/views/HomeView/HomeView.tsx +5 -45
  133. package/src/views/TODO.md +1 -0
  134. package/src/writer/Anchor/Anchor.styles.tsx +11 -0
  135. package/src/writer/Anchor/Anchor.tsx +51 -0
  136. package/src/writer/Anchor/index.tsx +1 -0
  137. package/src/writer/Badge/Badge.styles.tsx +39 -28
  138. package/src/writer/Badge/Badge.tsx +37 -20
  139. package/src/writer/Banner/Banner.styles.tsx +91 -0
  140. package/src/writer/Banner/Banner.tsx +70 -0
  141. package/src/writer/Banner/index.ts +1 -0
  142. package/src/writer/Blockquote/Blockquote.styles.tsx +4 -4
  143. package/src/writer/Blockquote/Blockquote.tsx +6 -3
  144. package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +22 -21
  145. package/src/writer/Breadcrumbs/Breadcrumbs.tsx +19 -13
  146. package/src/writer/Button/Button.styles.tsx +137 -0
  147. package/src/writer/Button/Button.tsx +75 -0
  148. package/src/writer/Button/index.ts +2 -0
  149. package/src/writer/Callout/Callout.styles.tsx +29 -40
  150. package/src/writer/Callout/Callout.tsx +31 -16
  151. package/src/writer/Card/Card.styles.tsx +47 -0
  152. package/src/writer/Card/Card.tsx +69 -0
  153. package/src/writer/Card/index.ts +1 -0
  154. package/src/writer/Code/Code.styles.tsx +10 -11
  155. package/src/writer/Code/Code.tsx +7 -4
  156. package/src/writer/ColorSchemeButton/ColorSchemeButton.tsx +172 -0
  157. package/src/writer/ColorSchemeButton/index.ts +1 -0
  158. package/src/writer/Details/Details.styles.tsx +84 -84
  159. package/src/writer/Details/Details.tsx +71 -51
  160. package/src/writer/Example/index.tsx +5 -0
  161. package/src/writer/GuideCard/GuideCard.styles.tsx +108 -107
  162. package/src/writer/GuideCard/GuideCard.tsx +72 -37
  163. package/src/writer/Heading/Heading.styles.tsx +69 -49
  164. package/src/writer/Heading/Heading.tsx +92 -22
  165. package/src/writer/Hr/Hr.styles.tsx +5 -5
  166. package/src/writer/Hr/Hr.tsx +3 -6
  167. package/src/writer/Icon/Icon.tsx +48 -0
  168. package/src/writer/Icon/index.ts +1 -0
  169. package/src/writer/Image/Image.styles.tsx +9 -0
  170. package/src/writer/Image/Image.tsx +19 -0
  171. package/src/writer/Image/index.ts +1 -0
  172. package/src/writer/List/List.styles.tsx +47 -0
  173. package/src/writer/List/List.tsx +29 -0
  174. package/src/writer/List/index.ts +4 -0
  175. package/src/writer/NavLinks/NavLinks.styles.ts +23 -24
  176. package/src/writer/NavLinks/NavLinks.tsx +66 -19
  177. package/src/writer/Pre/Pre.styles.tsx +5 -5
  178. package/src/writer/Pre/Pre.tsx +4 -3
  179. package/src/writer/Steps/Steps.styles.tsx +14 -12
  180. package/src/writer/Steps/Steps.tsx +39 -10
  181. package/src/writer/Table/Table.styles.tsx +62 -30
  182. package/src/writer/Table/Table.tsx +121 -11
  183. package/src/writer/Table/index.ts +0 -11
  184. package/src/writer/Tabs/Tabs.styles.tsx +63 -70
  185. package/src/writer/Tabs/Tabs.tsx +31 -29
  186. package/src/writer/Text/Text.styles.tsx +66 -0
  187. package/src/writer/Text/Text.tsx +79 -0
  188. package/src/writer/Text/index.ts +3 -0
  189. package/src/writer/TocCard/TocCard.module.css +44 -0
  190. package/src/writer/TocCard/TocCard.tsx +42 -0
  191. package/src/writer/TocCard/index.ts +3 -0
  192. package/src/writer/UnderlineNav/Tabs.tsx +51 -0
  193. package/src/writer/UnderlineNav/TabsPrimary.styles.tsx +184 -0
  194. package/src/writer/UnderlineNav/TabsPrimary.tsx +209 -0
  195. package/src/writer/UnderlineNav/TabsSecondary.styles.tsx +77 -0
  196. package/src/writer/UnderlineNav/TabsSecondary.tsx +171 -0
  197. package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +181 -45
  198. package/src/writer/UnderlineNav/UnderlineNav.tsx +258 -23
  199. package/src/writer/UnderlineNav/index.ts +2 -1
  200. package/src/writer/UnderlineNav/useValueChange.ts +60 -0
  201. package/src/writer/Update/Update.styles.tsx +33 -0
  202. package/src/writer/Update/Update.tsx +37 -0
  203. package/src/writer/Update/index.ts +1 -0
  204. package/src/writer/VideoGuide/VideoGuide.module.css +105 -0
  205. package/src/writer/VideoGuide/VideoGuide.tsx +75 -0
  206. package/src/writer/VideoGuide/index.ts +1 -0
  207. package/src/writer/index.ts +23 -1
  208. package/tsconfig.json +11 -6
  209. package/types.d.ts +50 -0
  210. package/writer.ts +1 -1
  211. package/dist/CTABanner-BrdYlhnD.js +0 -2
  212. package/dist/CTABanner-BrdYlhnD.js.map +0 -1
  213. package/dist/CTABanner-XQNnnpUx.js +0 -2
  214. package/dist/CTABanner-XQNnnpUx.js.map +0 -1
  215. package/dist/CodeSample-Cp42Adjc.js +0 -2
  216. package/dist/CodeSample-Cp42Adjc.js.map +0 -1
  217. package/dist/CodeSample-DxPp80ID.js +0 -2
  218. package/dist/CodeSample-DxPp80ID.js.map +0 -1
  219. package/dist/HomeView-BN9mZXh9.js +0 -2
  220. package/dist/HomeView-BN9mZXh9.js.map +0 -1
  221. package/dist/HomeView-BVaaV0uE.js +0 -2
  222. package/dist/HomeView-BVaaV0uE.js.map +0 -1
  223. package/dist/UnderlineNav-Bs7Ot9Ch.js +0 -2
  224. package/dist/UnderlineNav-Bs7Ot9Ch.js.map +0 -1
  225. package/dist/UnderlineNav-C2aEVraN.js +0 -2
  226. package/dist/UnderlineNav-C2aEVraN.js.map +0 -1
  227. package/dist/_rollupPluginBabelHelpers-BMmCG_qQ.js +0 -2
  228. package/dist/_rollupPluginBabelHelpers-BMmCG_qQ.js.map +0 -1
  229. package/dist/_rollupPluginBabelHelpers-DsEzE6Ab.js +0 -2
  230. package/dist/_rollupPluginBabelHelpers-DsEzE6Ab.js.map +0 -1
  231. package/dist/index-BVUz77Tm.js +0 -2
  232. package/dist/index-BVUz77Tm.js.map +0 -1
  233. package/dist/index-jxd3nv2J.js +0 -2
  234. package/dist/index-jxd3nv2J.js.map +0 -1
  235. package/dist/tslib.es6-DDIOdJiV.js +0 -2
  236. package/dist/tslib.es6-DUrRPhZd.js +0 -2
  237. package/src/content/Anchor/Anchor.tsx +0 -63
  238. package/src/content/Anchor/index.tsx +0 -3
  239. package/src/content/Content/Content.tsx +0 -21
  240. package/src/content/Content/index.tsx +0 -3
  241. package/src/content/Content.tsx +0 -180
  242. package/src/content/Subtitle/Subtitle.tsx +0 -21
  243. package/src/content/Subtitle/index.tsx +0 -3
  244. package/src/layouts/Layout.styles.tsx +0 -151
  245. package/src/layouts/Layout.tsx +0 -121
  246. package/src/ui/Loader/Loader.styles.tsx +0 -52
  247. package/src/ui/Loader/Loader.tsx +0 -26
  248. package/src/ui/index.ts +0 -1
  249. package/src/writer/Icon/index.tsx +0 -355
  250. package/src/writer/Table/TableV2.styles.tsx +0 -117
  251. package/src/writer/Table/TableV2.tsx +0 -83
@@ -1,115 +1,116 @@
1
- import {css} from "@linaria/core";
2
-
3
- export const $guide = {
4
- host: css`
5
- `,
6
- host$$secondary: css`
7
- //flex-grow: 1;
8
- //width: 100%;
9
- display: flex;
10
- position: relative;
11
- overflow: hidden;
12
- border: .5px solid #ececf1;
13
- background: linear-gradient(238deg, rgba(247, 247, 248, .5) 0%, rgba(247, 247, 248, 1) 100%);
14
- border-radius: 8px;
15
- padding: 16px 20px 20px;
16
- z-index: 0;
17
- transition: box-shadow .2s ease-in-out, background-image .2s ease;
18
-
19
- &:hover {
20
- background: linear-gradient(238deg, rgba(255, 255, 255, .5) 0%, rgba(250, 250, 250, 1) 100%);
1
+ import { css } from "@linaria/core";
2
+
3
+ export const GuideHost = css`
4
+ @layer defaults {
5
+ display: block;
6
+
7
+ &[data-kind="secondary"] {
8
+ display: flex;
9
+ position: relative;
10
+ overflow: hidden;
11
+ border: 1px solid var(--xyd-guidecard-border-color--secondary);
12
+ background: var(--xyd-guidecard-bgcolor--secondary);
13
+ border-radius: 8px;
14
+ padding: 24px;
15
+ z-index: 0;
16
+ transition: box-shadow .2s ease-in-out, background-image .2s ease;
17
+
18
+ &:hover {
19
+ background: var(--xyd-guidecard-bgcolor--secondary-hover);
20
+ }
21
+
22
+ &[data-size="md"] {
23
+ padding: 21px 25px 25px;
24
+ }
25
+ }
26
+
27
+ [part="link"] {
28
+ width: 100%;
29
+ height: 100%;
21
30
  }
22
- `,
23
- host$$secondary$$md: css`
24
- padding: 21px 25px 25px;
25
- `,
26
- link: css`
27
- width: 100%;
28
- height: 100%;
29
- `,
30
- item: css`
31
- border-radius: 8px;
32
- display: flex;
33
-
34
- align-items: flex-start;
35
- cursor: pointer;
36
- transition: opacity .15s;
37
-
38
- &:hover {
39
- [data-pointer="true"] {
40
- opacity: 1;
41
- transform: translate(0);
31
+
32
+ [part="item"] {
33
+ border-radius: 8px;
34
+ display: flex;
35
+
36
+ align-items: flex-start;
37
+ cursor: pointer;
38
+ transition: opacity .15s;
39
+
40
+ &:hover {
41
+ [part="pointer"] {
42
+ opacity: 1;
43
+ transform: translate(0);
44
+ }
42
45
  }
43
46
  }
44
- `,
45
- item$$secondary: css`
46
- width: 100%;
47
- height: 100%;
48
- `,
49
- icon: css`
50
- line-height: 0px;
51
- font-size: 24px;
52
- border-radius: 8px;
53
- width: 48px;
54
- height: 48px;
55
- display: flex;
56
- justify-content: center;
57
- align-items: center;
58
- color: #353740;
59
- border: 1px solid #ececf1;
60
- background: linear-gradient(238deg, rgba(255, 255, 255, .5) 0%, rgba(250, 250, 250, 1) 100%);
61
- transition: background .2s ease;
62
- box-sizing: border-box;
63
- flex-shrink: 0;
64
- `,
65
- right: css`
66
- padding-left: 16px;
67
- display: flex;
68
- flex-direction: column;
69
- gap: 4px;
70
- `,
71
- title: css`
72
- display: flex;
73
- color: #202123;
74
- font-weight: 400;
75
- align-items: center;
76
- transition: color .15s;
77
- `,
78
- titleBody: css`
79
- font-size: 16px;
80
- line-height: 20px;
81
- `,
82
- titleBody$$md: css`
83
- font-size: 18px;
84
- `,
85
- body: css`
86
- font-weight: 400;
87
- font-size: 14px;
88
- line-height: 20px;
89
-
90
- color: #6e6e80;
91
- white-space: normal;
92
- overflow: hidden;
93
- text-overflow: ellipsis;
94
- `,
95
- body$$md: css`
96
- font-size: 16px;
97
- `,
98
- pointer: css`
99
- opacity: 0;
100
- transform: translate(-4px);
101
- display: flex;
102
- justify-content: center;
103
- transition: opacity .15s ease-in-out, transform .15s ease-in-out;
104
- `
105
- }
47
+ &[data-kind="secondary"] [part="item"] {
48
+ width: 100%;
49
+ height: 100%;
50
+ }
51
+
52
+ [part="icon"] {
53
+ height: 32px;
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ color: var(--xyd-guidecard-icon-color);
58
+ transition: background .2s ease;
59
+ box-sizing: border-box;
60
+ flex-shrink: 0;
106
61
 
62
+ svg {
63
+ width: 24px;
64
+ height: 24px;
65
+ }
66
+ }
67
+
68
+ [part="right"] {
69
+ padding-left: 16px;
70
+ display: flex;
71
+ flex-direction: column;
72
+ gap: 4px;
73
+ }
74
+
75
+ [part="title"] {
76
+ display: flex;
77
+ color: var(--xyd-guidecard-title-color);
78
+ align-items: center;
79
+ font-weight: var(--xyd-font-weight-semibold);
80
+ transition: color .15s;
81
+ }
82
+
83
+ [part="title-body"] {
84
+ }
85
+ &[data-size="md"] [part="title-body"] {
86
+ }
87
+
88
+ [part="body"] {
89
+ font-weight: var(--xyd-font-weight-normal);
90
+
91
+ color: var(--xyd-guidecard-color);
92
+ white-space: normal;
93
+ overflow: hidden;
94
+ text-overflow: ellipsis;
95
+ }
96
+ &[data-size="md"] [part="body"] {
97
+ }
98
+
99
+ [part="pointer"] {
100
+ opacity: 0;
101
+ transform: translate(-4px);
102
+ display: flex;
103
+ justify-content: center;
104
+ transition: opacity .15s ease-in-out, transform .15s ease-in-out;
105
+ }
106
+ }
107
+ `;
107
108
 
108
- export const $list = {
109
- host: css`
109
+ export const GuideListHost = css`
110
+ @layer defaults {
110
111
  display: grid;
111
112
  grid-template-columns: 1fr 1fr;
112
113
  justify-content: center;
113
- gap: 30px;
114
- `
115
- }
114
+ gap: 24px;
115
+ }
116
+ `;
@@ -1,69 +1,95 @@
1
1
  import React from "react"
2
2
 
3
- import {$guide, $list} from "./GuideCard.styles";
3
+ import * as cn from "./GuideCard.styles";
4
4
 
5
+ /**
6
+ * Props for the GuideCard component
7
+ */
5
8
  export interface GuideCardProps {
9
+ /** Content to be displayed in the card body */
6
10
  children: React.ReactNode;
11
+
12
+ /** URL the card links to */
7
13
  href: string
14
+
15
+ /** Title displayed at the top of the card */
8
16
  title: string;
17
+
18
+ /** Optional icon displayed to the left of the content */
9
19
  icon?: React.ReactNode;
20
+
21
+ /** Visual style variant of the card */
10
22
  kind?: "secondary"
23
+
24
+ /** Size variant of the card */
11
25
  size?: "sm" | "md"
26
+
27
+ /** Additional CSS class names to apply to the card */
28
+ className?: string
29
+
30
+ /** Additional props to pass to the link element */
31
+ as?: React.ElementType
12
32
  }
13
33
 
34
+ /**
35
+ * A card component that displays content with a title and optional icon.
36
+ * The entire card is clickable and links to the specified URL.
37
+ *
38
+ * @category Component
39
+ */
14
40
  export function GuideCard({
15
- children,
16
- href,
17
- icon,
18
- title,
19
- kind,
20
- size,
41
+ children,
42
+ href,
43
+ icon,
44
+ title,
45
+ kind,
46
+ size,
47
+ className,
48
+ as,
49
+ }: GuideCardProps) {
50
+ const Link = as || $Link
21
51
 
22
- }: GuideCardProps) {
23
- return <div className={`
24
- ${$guide.host}
25
- ${kind === "secondary" && $guide.host$$secondary}
26
- ${kind === "secondary" && size == "md" && $guide.host$$secondary$$md}
27
- `}>
28
- <a className={$guide.link} href={href}>
29
- <div className={`
30
- ${$guide.item}
31
- ${kind === "secondary" && $guide.item$$secondary}
32
- `}>
33
- {icon && <div className={$guide.icon}>
52
+ return <xyd-guidecard
53
+ className={`${cn.GuideHost} ${className || ""}`}
54
+ data-kind={kind}
55
+ data-size={size}
56
+ >
57
+ <Link part="link" href={href}>
58
+ <div part="item">
59
+ {icon && <div part="icon">
34
60
  {icon}
35
61
  </div>}
36
- <div className={$guide.right}>
37
- <div className={$guide.title}>
38
- <div className={`
39
- ${$guide.title}
40
- ${$guide.titleBody}
41
- ${size == "md" && $guide.titleBody$$md}
42
- `}>
62
+ <div part="right">
63
+ <div part="title">
64
+ <div part="title-body">
43
65
  {title}
44
66
  </div>
45
- <$Pointer/>
67
+ <$Pointer />
46
68
  </div>
47
- <div className={`
48
- ${$guide.body}
49
- ${size == "md" && $guide.body$$md}
50
- `}>
69
+ <div part="body">
51
70
  {children}
52
71
  </div>
53
72
  </div>
54
73
  </div>
55
- </a>
56
- </div>
74
+ </Link>
75
+ </xyd-guidecard>
57
76
  }
58
77
 
59
- GuideCard.List = function GuideCardList({children}: { children: React.ReactNode }) {
60
- return <div className={$list.host}>
78
+ /**
79
+ * A container component for grouping multiple GuideCard components.
80
+ * Provides consistent spacing and layout for a list of guide cards.
81
+ */
82
+ GuideCard.List = function GuideCardList({ children }: { children: React.ReactNode }) {
83
+ return <xyd-guidecard-list className={cn.GuideListHost}>
61
84
  {children}
62
- </div>
85
+ </xyd-guidecard-list>
63
86
  }
64
87
 
88
+ /**
89
+ * Internal component that renders the arrow pointer icon.
90
+ */
65
91
  function $Pointer() {
66
- return <div data-pointer="true" className={$guide.pointer}>
92
+ return <div part="pointer">
67
93
  <svg
68
94
  xmlns="http://www.w3.org/2000/svg"
69
95
  width={24}
@@ -78,4 +104,13 @@ function $Pointer() {
78
104
  />
79
105
  </svg>
80
106
  </div>
107
+ }
108
+
109
+ function $Link({ href, children, ...rest }) {
110
+ return <a
111
+ href={href}
112
+ {...rest}
113
+ >
114
+ {children}
115
+ </a>
81
116
  }
@@ -1,73 +1,93 @@
1
- import {css} from "@linaria/core";
1
+ import { css } from "@linaria/core";
2
2
 
3
- export const $heading = {
4
- host: css`
5
- line-height: 40px;
6
- font-weight: 300;
7
- color: #202123;
3
+ export const HeadingHost = css`
4
+ @layer defaults {
5
+ color: var(--xyd-heading-color);
6
+ line-height: var(--xyd-line-height-xlarge);
7
+ font-weight: var(--xyd-font-weight-semibold);
8
8
 
9
9
  position: relative;
10
- display: inline-block;
10
+ display: table;
11
11
  margin: 0;
12
12
  padding: 0 24px 0 0;
13
13
  scroll-margin-top: 30px;
14
- cursor: pointer;
14
+ cursor: default;
15
+
16
+ &[id] {
17
+ cursor: pointer;
18
+ }
19
+ &[data-noanchor="true"] {
20
+ cursor: default;
21
+ }
22
+
23
+ &[data-has-label="true"] {
24
+ display: flex;
25
+ align-items: center;
26
+ gap: 8px;
27
+
28
+ xyd-badge {
29
+ font-size: var(--xyd-font-size-xsmall);
30
+ line-height: var(--xyd-line-height-xsmall);
31
+ letter-spacing: 2px;
32
+ }
33
+ }
15
34
 
16
35
  &:hover {
17
36
  svg {
18
37
  opacity: 1;
19
38
  }
20
39
  }
21
- `,
22
- h1: css`
23
- font-size: 36px;
24
40
 
25
- code {
26
- font-size: 30px;
41
+ &[data-kind="muted"] {
42
+ color: var(--xyd-heading-color--muted);
43
+ cursor: default;
44
+ font-weight: var(--xyd-font-weight-medium);
27
45
  }
28
- `,
29
- h2: css`
30
- font-size: 30px;
31
46
 
32
- code {
33
- font-size: 24px;
47
+ &[data-size="1"] {
48
+ font-size: var(--xyd-font-size-2xl);
49
+ line-height: var(--xyd-line-height-2xl);
34
50
  }
35
- `,
36
- h3: css`
37
- font-size: 26px;
38
51
 
39
- code {
40
- font-size: 22px;
52
+ &[data-size="2"] {
53
+ font-size: var(--xyd-font-size-xxlarge);
54
+ line-height: var(--xyd-line-height-xxlarge);
41
55
  }
42
- `,
43
- h4: css`
44
- font-size: 22px;
45
56
 
46
- code {
47
- font-size: 18px;
57
+ &[data-size="3"] {
58
+ font-size: var(--xyd-font-size-xlarge);
59
+ line-height: var(--xyd-line-height-xlarge);
48
60
  }
49
- `,
50
- h5: css`
51
- font-size: 18px;
52
61
 
53
- code {
54
- font-size: 14px;
62
+ &[data-size="4"] {
63
+ font-size: var(--xyd-font-size-large);
64
+ line-height: var(--xyd-line-height-large);
55
65
  }
56
- `,
57
- h6: css`
58
- font-size: 16px;
59
66
 
60
- code {
61
- font-size: 12px;
67
+ &[data-size="5"] {
68
+ font-size: var(--xyd-font-size-medium);
69
+ line-height: var(--xyd-line-height-medium);
62
70
  }
63
- `,
64
- link: css`
65
- position: absolute;
66
- top: 50%;
67
- right: 0;
68
- margin-top: -6px;
69
- opacity: 0;
70
- color: #7051d4;
71
- transition: opacity .15s ease;
72
- `
73
- }
71
+
72
+ &[data-size="6"] {
73
+ font-size: var(--xyd-font-size-small);
74
+ line-height: var(--xyd-line-height-small);
75
+ }
76
+
77
+ [part="icon"] {
78
+ position: absolute;
79
+ top: 50%;
80
+ right: 0;
81
+ margin-top: -6px;
82
+ opacity: 0;
83
+ color: var(--xyd-heading-icon-color);
84
+ transition: opacity .15s ease;
85
+ }
86
+ &[data-active="true"] {
87
+ [part="icon"] {
88
+ opacity: 1;
89
+ }
90
+ }
91
+ }
92
+ `;
93
+
@@ -1,47 +1,117 @@
1
- import React, {useRef} from "react"
1
+ import React, { } from "react"
2
2
 
3
- import {$heading} from "./Heading.styles";
3
+ import * as cn from "./Heading.styles";
4
+ import { Badge } from "writer";
4
5
 
6
+ /**
7
+ * Props for the Heading component
8
+ * @interface HeadingProps
9
+ */
5
10
  export interface HeadingProps {
11
+ /** Content to be rendered inside the heading */
6
12
  children: React.ReactNode
13
+
14
+ /** The size of the heading (1-6, corresponding to h1-h6) */
7
15
  size: 1 | 2 | 3 | 4 | 5 | 6
16
+
17
+ /** Optional HTML element to render as (div or span) */
8
18
  as?: "div" | "span"
19
+
20
+ /** Optional ID for the heading element */
9
21
  id?: string
22
+
23
+ /** Optional visual style variant */
24
+ kind?: "muted"
25
+
26
+ /** Optional click handler */
10
27
  onClick?: () => void
28
+
29
+ /** Optional additional CSS class name */
30
+ className?: string
31
+
32
+ /** Optional active state */
33
+ active?: boolean
34
+
35
+ /** Optional label for the heading */
36
+ label?: string
37
+
38
+ /** Optional subtitle for the heading */
39
+ subtitle?: string
40
+
41
+ /** Optional to hide the anchor icon */
42
+ noanchor?: boolean
43
+
44
+ /** Optional ref for the heading element */
45
+ ref?: React.RefObject<HTMLHeadingElement>
46
+
47
+ style?: React.CSSProperties
11
48
  }
12
49
 
13
- export function Heading({children, size = 1, as, id, onClick}: HeadingProps) {
50
+ /**
51
+ * A flexible heading component that can render as any heading level (h1-h6) or as a div/span
52
+ *
53
+ * @category Component
54
+ */
55
+ export function Heading(props: HeadingProps) {
56
+ const {
57
+ children,
58
+ size = 1,
59
+ as,
60
+ id,
61
+ onClick,
62
+ className,
63
+ kind,
64
+ active,
65
+ label,
66
+ subtitle,
67
+ noanchor,
68
+ ref,
69
+ style,
70
+ } = props
14
71
  let HeadingComponent = as ? as : `h${size}` as "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
15
72
 
16
- const obRef = useRef<HTMLAnchorElement>(null)
17
-
18
- return <HeadingComponent
19
- className={`
20
- ${$heading.host}
21
- ${size === 1 && $heading.h1}
22
- ${size === 2 && $heading.h2}
23
- ${size === 3 && $heading.h3}
24
- ${size === 4 && $heading.h4}
25
- ${size === 5 && $heading.h5}
26
- ${size === 6 && $heading.h6}
27
- xyd_comp-comp-heading
28
- `}
29
- onClick={onClick}
30
- >
31
- {children}
73
+ return <>
74
+ <HeadingComponent
75
+ style={style || undefined}
76
+ className={` ${cn.HeadingHost} ${className || ''}`}
77
+ data-size={size}
78
+ data-kind={kind}
79
+ data-has-label={String(label ? "true" : "false")}
80
+ data-noanchor={String(noanchor || "false")}
81
+ data-active={String(active || "false")}
82
+ onClick={noanchor ? undefined : onClick}
83
+ id={id}
84
+ ref={ref}
85
+ >
86
+ {children}
87
+
88
+ {label && <Badge size="sm">{label}</Badge>}
89
+
90
+ {id && !noanchor && <$Anchor />}
91
+ </HeadingComponent>
32
92
 
33
- {id && <$Anchor/>}
34
- </HeadingComponent>
93
+ {
94
+ subtitle ? <Heading
95
+ {...props}
96
+ size={4}
97
+ kind="muted"
98
+ subtitle={undefined}
99
+ label={undefined}
100
+ >
101
+ {subtitle}
102
+ </Heading> : null
103
+ }
104
+ </>
35
105
  }
36
106
 
37
107
  function $Anchor() {
38
108
  return <svg
109
+ part="icon"
39
110
  xmlns="http://www.w3.org/2000/svg"
40
111
  width={15}
41
112
  height={15}
42
113
  fill="currentColor"
43
114
  viewBox="0 0 24 24"
44
- className={$heading.link}
45
115
  role="presentation"
46
116
  >
47
117
  <path
@@ -1,7 +1,7 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $hr = {
4
- host: css`
5
- border-color: rgb(229 229 229 / 0.7);
6
- `
7
- }
3
+ export const HrHost = css`
4
+ @layer defaults {
5
+ border: 0.5px solid var(--xyd-hr-border-color);
6
+ }
7
+ `;
@@ -1,13 +1,10 @@
1
1
  import React from "react"
2
2
 
3
- import {$hr} from "./Hr.styles";
3
+ import * as cn from "./Hr.styles";
4
4
 
5
5
  export interface HrProps {
6
- children: React.ReactNode;
7
6
  }
8
7
 
9
- export function Hr({children}: HrProps) {
10
- return <hr className={$hr.host}>
11
- {children}
12
- </hr>
8
+ export function Hr() {
9
+ return <hr part="hr" className={cn.HrHost}/>
13
10
  }