@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,8 +1,13 @@
1
1
  import React, {Fragment} from 'react'
2
2
  import type {ReactElement} from 'react'
3
- import {ArrowRightIcon} from '@radix-ui/react-icons'
4
3
 
5
- import {$breadcrumbs} from './Breadcrumbs.styles'
4
+ import * as cn from './Breadcrumbs.styles'
5
+
6
+ function ArrowRightIcon() {
7
+ return <div>
8
+ TODO
9
+ </div>
10
+ }
6
11
 
7
12
  function Anchor({children, ...rest}) {
8
13
  return <a {...rest}>
@@ -11,26 +16,27 @@ function Anchor({children, ...rest}) {
11
16
  }
12
17
 
13
18
  export interface BreadcrumbsProps {
19
+ className?: string;
14
20
  items: {
15
21
  title: string
16
22
  href?: string
17
23
  }[]
18
24
  }
19
25
 
20
- export function Breadcrumbs(props: BreadcrumbsProps): ReactElement {
26
+ export function Breadcrumbs({className, items}: BreadcrumbsProps): ReactElement {
21
27
  return (
22
- <div className={$breadcrumbs.host}>
23
- {props.items.map((item, index) => {
24
- const lastActive = index === props.items.length - 1
28
+ <xyd-breadcrumbs
29
+ className={`${cn.BreadcrumbsHost} ${className || ''}`}
30
+ >
31
+ {items.map((item, index) => {
32
+ const lastActive = index === items.length - 1
25
33
 
26
34
  return (
27
35
  <Fragment key={item.href + item.title}>
28
- {index > 0 && <ArrowRightIcon className={$breadcrumbs.icon}/>}
29
- <div className={`
30
- ${$breadcrumbs.item}
31
- ${lastActive && $breadcrumbs.item$$active}
32
- `}
33
- title={item.title}
36
+ {index > 0 && <ArrowRightIcon part="icon"/>}
37
+ <div
38
+ part="item"
39
+ data-active={lastActive ? "true" : "false"}
34
40
  >
35
41
  {item.href && !lastActive ? (
36
42
  <Anchor href={item.href}>{item.title}</Anchor>
@@ -41,6 +47,6 @@ export function Breadcrumbs(props: BreadcrumbsProps): ReactElement {
41
47
  </Fragment>
42
48
  )
43
49
  })}
44
- </div>
50
+ </xyd-breadcrumbs>
45
51
  )
46
52
  }
@@ -0,0 +1,137 @@
1
+ import { css } from "@linaria/core";
2
+
3
+ export const ButtonHost = css`
4
+ @layer defaults {
5
+ display: inline-flex;
6
+ align-items: center;
7
+ justify-content: center;
8
+ border-radius: 6px;
9
+ border: 1px solid transparent;
10
+ font-weight: var(--xyd-font-weight-medium);
11
+ transition: all 0.2s ease;
12
+ cursor: pointer;
13
+ user-select: none;
14
+ white-space: nowrap;
15
+ gap: 8px;
16
+
17
+ &[data-size="sm"] {
18
+ height: 28px;
19
+ padding: 0 12px;
20
+ gap: 6px;
21
+
22
+ font-size: var(--xyd-font-size-xsmall);
23
+ line-height: var(--xyd-line-height-xsmall);
24
+
25
+ p {
26
+ font-size: var(--xyd-font-size-xsmall);
27
+ line-height: var(--xyd-line-height-xsmall);
28
+ }
29
+ }
30
+
31
+ &[data-size="md"] {
32
+ height: 36px;
33
+ padding: 0 16px;
34
+ gap: 8px;
35
+
36
+ font-size: var(--xyd-font-size-small);
37
+ line-height: var(--xyd-line-height-small);
38
+
39
+ p {
40
+ font-size: var(--xyd-font-size-small);
41
+ line-height: var(--xyd-line-height-small);
42
+ }
43
+ }
44
+
45
+ &[data-size="lg"] {
46
+ height: 44px;
47
+ padding: 0 20px;
48
+ gap: 10px;
49
+
50
+ font-size: var(--xyd-font-size-medium);
51
+ line-height: var(--xyd-line-height-medium);
52
+
53
+ p {
54
+ font-size: var(--xyd-font-size-medium);
55
+ line-height: var(--xyd-line-height-medium);
56
+ }
57
+ }
58
+
59
+ &[data-kind="primary"] {
60
+ background-color: var(--xyd-button-primary-bg);
61
+ color: var(--xyd-button-primary-color);
62
+ border-color: var(--xyd-button-primary-border);
63
+
64
+ &:hover:not(:disabled) {
65
+ background-color: var(--xyd-button-primary-bg-hover);
66
+ border-color: var(--xyd-button-primary-border-hover);
67
+ }
68
+ }
69
+
70
+ &[data-kind="secondary"] {
71
+ background-color: var(--xyd-button-secondary-bg);
72
+ color: var(--xyd-button-secondary-color);
73
+ border-color: var(--xyd-button-secondary-border);
74
+
75
+ &:hover:not(:disabled) {
76
+ background-color: var(--xyd-button-secondary-bg-hover);
77
+ border-color: var(--xyd-button-secondary-border-hover);
78
+ }
79
+ }
80
+
81
+ &[data-kind="tertiary"] {
82
+ background-color: var(--xyd-button-tertiary-bg);
83
+ color: var(--xyd-button-tertiary-color);
84
+ border-color: var(--xyd-button-tertiary-border);
85
+
86
+ &:hover:not(:disabled) {
87
+ background-color: var(--xyd-button-tertiary-bg-hover);
88
+ border-color: var(--xyd-button-tertiary-border-hover);
89
+ }
90
+ }
91
+
92
+ &[data-theme="ghost"] {
93
+ background-color: unset;
94
+ border: unset;
95
+
96
+ &:hover {
97
+ background-color: unset;
98
+ border: unset;
99
+
100
+ svg {
101
+ color: var(--dark64)
102
+ }
103
+ }
104
+
105
+ svg {
106
+ color: var(--dark48)
107
+ }
108
+ }
109
+
110
+ &:disabled {
111
+ opacity: 0.5;
112
+ cursor: not-allowed;
113
+ }
114
+
115
+ [part="content"] {
116
+ display: flex;
117
+ align-items: center;
118
+ justify-content: center;
119
+ }
120
+
121
+ [part="icon"] {
122
+ display: flex;
123
+ align-items: center;
124
+ justify-content: center;
125
+ flex-shrink: 0;
126
+ }
127
+ }
128
+ `;
129
+
130
+ export const ButtonIcon = css`
131
+ @layer defaults {
132
+ display: flex;
133
+ align-items: center;
134
+ justify-content: center;
135
+ flex-shrink: 0;
136
+ }
137
+ `;
@@ -0,0 +1,75 @@
1
+ import React from "react";
2
+
3
+ import * as cn from "./Button.styles";
4
+
5
+ export interface ButtonProps {
6
+ children?: React.ReactNode;
7
+ kind?: "primary" | "secondary" | "tertiary" | undefined
8
+ theme?: "ghost";
9
+ size?: "sm" | "md" | "lg";
10
+ className?: string;
11
+ onClick?: () => void;
12
+ disabled?: boolean;
13
+ icon?: React.ReactElement;
14
+ iconPosition?: "left" | "right";
15
+ href?: string;
16
+ }
17
+
18
+ export function Button({
19
+ children,
20
+ kind = "primary",
21
+ theme,
22
+ size = "md",
23
+ className,
24
+ onClick,
25
+ disabled = false,
26
+ icon,
27
+ iconPosition = "left",
28
+ href
29
+ }: ButtonProps) {
30
+ let Component = href ? "a" : "button"
31
+
32
+ let hrefProps = {}
33
+
34
+ if (href) {
35
+ hrefProps = {
36
+ href,
37
+ target: "_blank",
38
+ }
39
+ }
40
+
41
+ if (theme === "ghost") {
42
+ kind = undefined
43
+ }
44
+
45
+ return (
46
+ <Component
47
+ className={`${cn.ButtonHost} ${className || ''}`}
48
+ data-button={true}
49
+ data-kind={kind}
50
+ data-size={size}
51
+ data-theme={theme}
52
+ data-has-icon={!!icon}
53
+ data-icon-position={iconPosition}
54
+ onClick={onClick}
55
+ disabled={disabled}
56
+ {...hrefProps}
57
+ >
58
+ {icon && iconPosition === "left" && (
59
+ <span part="icon" className={cn.ButtonIcon}>
60
+ {icon}
61
+ </span>
62
+ )}
63
+ {
64
+ children ? <span part="content">
65
+ {children}
66
+ </span> : null
67
+ }
68
+ {icon && iconPosition === "right" && (
69
+ <span part="icon" className={cn.ButtonIcon}>
70
+ {icon}
71
+ </span>
72
+ )}
73
+ </Component>
74
+ );
75
+ }
@@ -0,0 +1,2 @@
1
+ export { Button } from "./Button";
2
+ export type { ButtonProps } from "./Button";
@@ -1,50 +1,39 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $callout = {
4
- host: css`
3
+ export const CalloutHost = css`
4
+ @layer defaults {
5
5
  display: inline-flex;
6
6
  align-items: center;
7
-
8
7
  position: relative;
9
8
  width: 100%;
10
9
  min-width: 275px;
11
10
  padding: 8px 12px;
12
-
13
11
  border-radius: 8px;
14
-
15
12
  text-align: center;
16
-
17
- border: 1px solid #ececf1;
18
- `,
19
- $$neutral: css`
20
- background-color: #f7f7f8;
21
-
22
- border-color: #ececf1;
23
- `
24
- }
25
-
26
- export const $icon = {
27
- host: css`
28
- display: inline-flex;
29
- margin-right: 14px;
30
- flex: 0 0 auto;
31
- align-self: flex-start;
32
-
33
- color: #6e6e80;
34
- font-size: 20px;
35
- margin-top: 2px;
36
- `
37
- }
38
-
39
- export const $message = {
40
- host: css`
41
- color: #353740;
42
- text-align: left;
43
-
44
- flex: 1 1 auto;
45
- `,
46
- body: css`
47
- font-size: 14px;
48
- line-height: 20px;
49
- `
50
- }
13
+ border: 1px solid var(--xyd-callout-border-color);
14
+ background-color: var(--xyd-callout-bgcolor);
15
+
16
+ code {
17
+ background: var(--white);
18
+ }
19
+
20
+ [part="icon"] {
21
+ display: inline-flex;
22
+ margin-right: 14px;
23
+ flex: 0 0 auto;
24
+ align-self: flex-start;
25
+ color: var(--xyd-callout-icon-color);
26
+ margin-top: 2px;
27
+ }
28
+
29
+ [part="message"] {
30
+ color: var(--xyd-callout-message-color);
31
+ text-align: left;
32
+ flex: 1 1 auto;
33
+ }
34
+
35
+ [part="message-body"] {
36
+ }
37
+
38
+ }
39
+ `;
@@ -1,12 +1,40 @@
1
1
  import React from "react"
2
2
 
3
- import {$callout, $icon, $message} from "./Callout.styles";
3
+ import * as cn from "./Callout.styles";
4
4
 
5
+ /**
6
+ * Props for the Callout component
7
+ */
5
8
  export interface CalloutProps {
9
+ /** Additional CSS class name to be applied to the callout */
10
+ className?: string;
11
+
12
+ /** Content to be displayed inside the callout */
6
13
  children: React.ReactNode;
7
14
  }
8
15
 
9
- function InfoIcon() {
16
+ /**
17
+ * A Callout component that displays important information or notices in a visually distinct way.
18
+ * It includes an info icon and a message area for content.
19
+ *
20
+ * @category Component
21
+ */
22
+ export function Callout({ className, children }: CalloutProps) {
23
+ return <xyd-callout
24
+ className={`${cn.CalloutHost} ${className || ''}`}
25
+ >
26
+ <div part="icon">
27
+ <$IconInfo />
28
+ </div>
29
+ <div part="message">
30
+ <div part="message-body">
31
+ {children}
32
+ </div>
33
+ </div>
34
+ </xyd-callout>
35
+ }
36
+
37
+ function $IconInfo() {
10
38
  return <svg
11
39
  xmlns="http://www.w3.org/2000/svg"
12
40
  width="1em"
@@ -14,7 +42,7 @@ function InfoIcon() {
14
42
  fill="currentColor"
15
43
  viewBox="0 0 24 24"
16
44
  >
17
- <path d="M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z"/>
45
+ <path d="M13 12a1 1 0 1 0-2 0v4a1 1 0 1 0 2 0v-4Zm-1-2.5A1.25 1.25 0 1 0 12 7a1.25 1.25 0 0 0 0 2.5Z" />
18
46
  <path
19
47
  fillRule="evenodd"
20
48
  d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM4 12a8 8 0 1 1 16 0 8 8 0 0 1-16 0Z"
@@ -22,16 +50,3 @@ function InfoIcon() {
22
50
  />
23
51
  </svg>
24
52
  }
25
-
26
- export function Callout({children}: CalloutProps) {
27
- return <div className={`${$callout.host} ${$callout.$$neutral}`}>
28
- <div className={$icon.host}>
29
- <InfoIcon/>
30
- </div>
31
- <div className={$message.host}>
32
- <div className={$message.body}>
33
- {children}
34
- </div>
35
- </div>
36
- </div>
37
- }
@@ -0,0 +1,47 @@
1
+ import { css } from "@linaria/core"
2
+
3
+ export const CardHost = css`
4
+ background-color: var(--xyd-card-bgcolor);
5
+ border-radius: 8px;
6
+ box-shadow: 0 1px 2px 0 var(--xyd-card-shadow-color);
7
+ flex-direction: column;
8
+ display: flex;
9
+ overflow: hidden;
10
+
11
+ &[data-shadow="md"] {
12
+ box-shadow: 0 5px 40px var(--xyd-card-shadow-color);
13
+ }
14
+
15
+ [part="image-container"] {
16
+ border-bottom: 2px solid var(--xyd-card-border-color);
17
+ height: 200px;
18
+ overflow: hidden;
19
+ position: relative;
20
+
21
+ [part="bg"] {
22
+ background-size: cover;
23
+ background-repeat: no-repeat;
24
+ position: relative;
25
+ height: 100%;
26
+ }
27
+
28
+ img {
29
+ width: 100%;
30
+ height: 100%;
31
+ object-fit: cover;
32
+ margin-bottom: -4px;
33
+ }
34
+ }
35
+
36
+ [part="body"] {
37
+ padding: 16px;
38
+
39
+ [part="header"] {
40
+ margin-right: 4px;
41
+ align-items: center;
42
+ justify-content: space-between;
43
+ margin-bottom: 12px;
44
+ display: flex;
45
+ }
46
+ }
47
+ `
@@ -0,0 +1,69 @@
1
+ import React from "react"
2
+
3
+ import { Button } from "../Button"
4
+ import { Text } from "../Text"
5
+
6
+ import * as cn from "./Card.styles"
7
+
8
+ interface CardProps {
9
+ title: string
10
+ href?: string
11
+ link?: React.ElementType
12
+
13
+ description?: string
14
+
15
+ imgSrc?: string
16
+ imgAlt?: string
17
+
18
+ shadow?: "md"
19
+ }
20
+
21
+ export function Card(props: CardProps) {
22
+ const {
23
+ title,
24
+ description,
25
+ imgSrc,
26
+ imgAlt,
27
+ shadow,
28
+ href,
29
+ link,
30
+ } = props
31
+
32
+ const Link = link
33
+
34
+ return <xyd-card
35
+ data-shadow={shadow || undefined}
36
+ className={cn.CardHost}
37
+ >
38
+ {imgSrc && (
39
+ <div part="image-container">
40
+ <div part="bg">
41
+ <img src={imgSrc} alt={imgAlt} />
42
+ </div>
43
+ </div>
44
+ )}
45
+
46
+ <div part="body">
47
+ <div part="header">
48
+ {Link && href ?
49
+ <Text weight="bold">
50
+ <Link href={href}>
51
+ {title}
52
+ </Link>
53
+ </Text>
54
+ : <Text weight="bold">
55
+ {title}
56
+ </Text>}
57
+ <Button size="sm" kind="secondary">
58
+ Source
59
+ </Button>
60
+ </div>
61
+ <div part="description">
62
+ <Text size="small">
63
+ {description}
64
+ </Text>
65
+ </div>
66
+ </div>
67
+ </xyd-card>
68
+ }
69
+
@@ -0,0 +1 @@
1
+ export {Card} from "./Card"
@@ -1,17 +1,16 @@
1
1
  import {css} from "@linaria/core";
2
2
 
3
- export const $code = {
4
- host: css`
3
+ export const CodeHost = css`
4
+ @layer defaults {
5
5
  display: inline-block;
6
6
  padding: 0 .3em;
7
7
  border-radius: 6px;
8
8
  margin: 0 3px;
9
- border: .5px solid #ececf1;
10
-
11
- font-size: 14px;
12
- font-weight: 500;
13
- line-height: 1.6em;
14
-
15
- background: linear-gradient(45deg, #f7f7f8 0%, rgba(247, 247, 248, 1) 100%);
16
- `
17
- }
9
+ border: .5px solid var(--xyd-code-border-color);
10
+ background: var(--xyd-code-bgcolor);
11
+
12
+ & [part="content"] {
13
+ position: relative;
14
+ }
15
+ }
16
+ `;
@@ -1,13 +1,16 @@
1
1
  import React from "react"
2
2
 
3
- import {$code} from "./Code.styles";
3
+ import * as cn from "./Code.styles";
4
4
 
5
5
  export interface CodeProps {
6
+ className?: string;
6
7
  children: React.ReactNode;
7
8
  }
8
9
 
9
- export function Code({children}: CodeProps) {
10
- return <code className={$code.host}>
11
- {children}
10
+ export function Code({ className, children }: CodeProps) {
11
+ return <code className={`${cn.CodeHost} ${className || ''}`}>
12
+ <span part="content">
13
+ {children}
14
+ </span>
12
15
  </code>
13
16
  }