@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.
- package/.idea/git_toolbox_blame.xml +6 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/xyd-components.iml +12 -0
- package/CHANGELOG.md +718 -0
- package/LICENSE +21 -0
- package/TODO.md +1 -0
- package/content.ts +0 -2
- package/dist/CTABanner-Bc77pnms.js +2 -0
- package/dist/CTABanner-Bc77pnms.js.map +1 -0
- package/dist/CTABanner-DzO62aGj.js +2 -0
- package/dist/CTABanner-DzO62aGj.js.map +1 -0
- package/dist/CodeSample-BWPDgd2G.js +2 -0
- package/dist/CodeSample-BWPDgd2G.js.map +1 -0
- package/dist/CodeSample-DLnR-knP.js +2 -0
- package/dist/CodeSample-DLnR-knP.js.map +1 -0
- package/dist/HomeView-C8QlNdKh.js +2 -0
- package/dist/HomeView-C8QlNdKh.js.map +1 -0
- package/dist/HomeView-ZAP5saNy.js +2 -0
- package/dist/HomeView-ZAP5saNy.js.map +1 -0
- package/dist/Icon-BESh23UN.js +2 -0
- package/dist/Icon-BESh23UN.js.map +1 -0
- package/dist/Icon-xNucOqd2.js +2 -0
- package/dist/Icon-xNucOqd2.js.map +1 -0
- package/dist/Text-CfN9RkYA.js +2 -0
- package/dist/Text-CfN9RkYA.js.map +1 -0
- package/dist/Text-DKycD2zu.js +2 -0
- package/dist/Text-DKycD2zu.js.map +1 -0
- package/dist/Update-0XruJHjj.js +2 -0
- package/dist/Update-0XruJHjj.js.map +1 -0
- package/dist/Update-DKOAw8p9.js +2 -0
- package/dist/Update-DKOAw8p9.js.map +1 -0
- package/dist/VideoGuide-BUyomFVz.js +2 -0
- package/dist/VideoGuide-BUyomFVz.js.map +1 -0
- package/dist/VideoGuide-B_iUKKv7.js +2 -0
- package/dist/VideoGuide-B_iUKKv7.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-CxSUtGup.js +4 -0
- package/dist/_rollupPluginBabelHelpers-CxSUtGup.js.map +1 -0
- package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js +4 -0
- package/dist/_rollupPluginBabelHelpers-DZ-ucadG.js.map +1 -0
- package/dist/brand.d.ts +9 -9
- package/dist/brand.js +1 -1
- package/dist/brand.js.map +1 -1
- package/dist/coder/themes/cosmo-light.js.map +1 -1
- package/dist/coder.d.ts +29 -9
- package/dist/coder.js +1 -1
- package/dist/coder.js.map +1 -1
- package/dist/content.d.ts +268 -204
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/index.css +267 -216
- package/dist/layouts.d.ts +20 -21
- package/dist/layouts.js +1 -1
- package/dist/layouts.js.map +1 -1
- package/dist/pages.js +1 -1
- package/dist/pages.js.map +1 -1
- package/dist/system.d.ts +10 -0
- package/dist/system.js +2 -0
- package/dist/system.js.map +1 -0
- package/dist/tslib.es6-DyL9kPq9.js +2 -0
- package/dist/{tslib.es6-DDIOdJiV.js.map → tslib.es6-DyL9kPq9.js.map} +1 -1
- package/dist/tslib.es6-Hqk-Mdr9.js +2 -0
- package/dist/{tslib.es6-DUrRPhZd.js.map → tslib.es6-Hqk-Mdr9.js.map} +1 -1
- package/dist/views.js +1 -1
- package/dist/writer.d.ts +411 -78
- package/dist/writer.js +1 -1
- package/dist/writer.js.map +1 -1
- package/docs/.nojekyll +1 -0
- package/docs/assets/hierarchy.js +1 -0
- package/docs/assets/highlight.css +22 -0
- package/docs/assets/icons.js +18 -0
- package/docs/assets/icons.svg +1 -0
- package/docs/assets/main.js +60 -0
- package/docs/assets/navigation.js +1 -0
- package/docs/assets/search.js +1 -0
- package/docs/assets/style.css +1640 -0
- package/docs/functions/GuideCard.html +6 -0
- package/docs/hierarchy.html +1 -0
- package/docs/index.html +2 -0
- package/docs/interfaces/GuideCardProps.html +18 -0
- package/docs/modules.html +1 -0
- package/index.ts +0 -1
- package/package.json +13 -18
- package/project.json +677 -0
- package/rollup.config.js +32 -3
- package/src/brand/Button/Button.styles.tsx +28 -0
- package/src/brand/Button/Button.tsx +3 -35
- package/src/brand/CTABanner/CTABanner.styles.tsx +80 -0
- package/src/brand/CTABanner/CTABanner.tsx +34 -112
- package/src/brand/Footer/Footer.styles.tsx +18 -0
- package/src/brand/Footer/Footer.tsx +4 -24
- package/src/brand/TODO.md +1 -0
- package/src/coder/Code/Code.styles.tsx +134 -35
- package/src/coder/Code/Code.tsx +131 -40
- package/src/coder/Code/CodeLoader.tsx +4 -4
- package/src/coder/Code/annotations.tsx +28 -8
- package/src/coder/Code/highlight.ts +38 -0
- package/src/coder/Code/index.ts +2 -1
- package/src/coder/CodeCopy/{CodeCopy.style.tsx → CodeCopy.styles.tsx} +6 -6
- package/src/coder/CodeCopy/CodeCopy.tsx +6 -6
- package/src/coder/CodeSample/CodeSample.tsx +83 -27
- package/src/coder/CodeTabs/CodeTabs.styles.tsx +99 -78
- package/src/coder/CodeTabs/CodeTabs.tsx +71 -56
- package/src/coder/CodeTheme/CodeTheme.tsx +89 -49
- package/src/coder/CodeTheme/index.ts +0 -1
- package/src/coder/CoderProvider.tsx +26 -0
- package/src/coder/index.ts +8 -4
- package/src/content/ContentDecoator.styles.tsx +113 -0
- package/src/content/ContentDecorator.tsx +17 -0
- package/src/content/GridDecorator.styles.tsx +67 -0
- package/src/content/GridDecorator.tsx +21 -0
- package/src/content/ReactContent.tsx +575 -0
- package/src/content/index.ts +10 -2
- package/src/icons/index.ts +0 -0
- package/src/kit/Loader/Loader.styles.tsx +53 -0
- package/src/kit/Loader/Loader.tsx +22 -0
- package/src/kit/TODO.md +2 -0
- package/src/kit/index.ts +1 -0
- package/src/layouts/LayoutPrimary/LayoutPrimary.styles.tsx +263 -278
- package/src/layouts/LayoutPrimary/LayoutPrimary.tsx +173 -96
- package/src/layouts/LayoutPrimary/index.ts +0 -2
- package/src/layouts/index.ts +0 -7
- package/src/pages/HomePage/HomePage.styles.tsx +16 -0
- package/src/pages/HomePage/HomePage.tsx +7 -21
- package/src/pages/TODO.md +1 -0
- package/src/system/SearchButton/SearchButton.styles.tsx +86 -0
- package/src/system/SearchButton/SearchButton.tsx +116 -0
- package/src/system/SearchButton/index.ts +1 -0
- package/src/system/index.ts +1 -0
- package/src/utils/useStyle.ts +19 -0
- package/src/views/HomeView/HomeView.styles.tsx +37 -0
- package/src/views/HomeView/HomeView.tsx +5 -45
- package/src/views/TODO.md +1 -0
- package/src/writer/Anchor/Anchor.styles.tsx +11 -0
- package/src/writer/Anchor/Anchor.tsx +51 -0
- package/src/writer/Anchor/index.tsx +1 -0
- package/src/writer/Badge/Badge.styles.tsx +39 -28
- package/src/writer/Badge/Badge.tsx +37 -20
- package/src/writer/Banner/Banner.styles.tsx +91 -0
- package/src/writer/Banner/Banner.tsx +70 -0
- package/src/writer/Banner/index.ts +1 -0
- package/src/writer/Blockquote/Blockquote.styles.tsx +4 -4
- package/src/writer/Blockquote/Blockquote.tsx +6 -3
- package/src/writer/Breadcrumbs/Breadcrumbs.styles.ts +22 -21
- package/src/writer/Breadcrumbs/Breadcrumbs.tsx +19 -13
- package/src/writer/Button/Button.styles.tsx +137 -0
- package/src/writer/Button/Button.tsx +75 -0
- package/src/writer/Button/index.ts +2 -0
- package/src/writer/Callout/Callout.styles.tsx +29 -40
- package/src/writer/Callout/Callout.tsx +31 -16
- package/src/writer/Card/Card.styles.tsx +47 -0
- package/src/writer/Card/Card.tsx +69 -0
- package/src/writer/Card/index.ts +1 -0
- package/src/writer/Code/Code.styles.tsx +10 -11
- package/src/writer/Code/Code.tsx +7 -4
- package/src/writer/ColorSchemeButton/ColorSchemeButton.tsx +172 -0
- package/src/writer/ColorSchemeButton/index.ts +1 -0
- package/src/writer/Details/Details.styles.tsx +84 -84
- package/src/writer/Details/Details.tsx +71 -51
- package/src/writer/Example/index.tsx +5 -0
- package/src/writer/GuideCard/GuideCard.styles.tsx +108 -107
- package/src/writer/GuideCard/GuideCard.tsx +72 -37
- package/src/writer/Heading/Heading.styles.tsx +69 -49
- package/src/writer/Heading/Heading.tsx +92 -22
- package/src/writer/Hr/Hr.styles.tsx +5 -5
- package/src/writer/Hr/Hr.tsx +3 -6
- package/src/writer/Icon/Icon.tsx +48 -0
- package/src/writer/Icon/index.ts +1 -0
- package/src/writer/Image/Image.styles.tsx +9 -0
- package/src/writer/Image/Image.tsx +19 -0
- package/src/writer/Image/index.ts +1 -0
- package/src/writer/List/List.styles.tsx +47 -0
- package/src/writer/List/List.tsx +29 -0
- package/src/writer/List/index.ts +4 -0
- package/src/writer/NavLinks/NavLinks.styles.ts +23 -24
- package/src/writer/NavLinks/NavLinks.tsx +66 -19
- package/src/writer/Pre/Pre.styles.tsx +5 -5
- package/src/writer/Pre/Pre.tsx +4 -3
- package/src/writer/Steps/Steps.styles.tsx +14 -12
- package/src/writer/Steps/Steps.tsx +39 -10
- package/src/writer/Table/Table.styles.tsx +62 -30
- package/src/writer/Table/Table.tsx +121 -11
- package/src/writer/Table/index.ts +0 -11
- package/src/writer/Tabs/Tabs.styles.tsx +63 -70
- package/src/writer/Tabs/Tabs.tsx +31 -29
- package/src/writer/Text/Text.styles.tsx +66 -0
- package/src/writer/Text/Text.tsx +79 -0
- package/src/writer/Text/index.ts +3 -0
- package/src/writer/TocCard/TocCard.module.css +44 -0
- package/src/writer/TocCard/TocCard.tsx +42 -0
- package/src/writer/TocCard/index.ts +3 -0
- package/src/writer/UnderlineNav/Tabs.tsx +51 -0
- package/src/writer/UnderlineNav/TabsPrimary.styles.tsx +184 -0
- package/src/writer/UnderlineNav/TabsPrimary.tsx +209 -0
- package/src/writer/UnderlineNav/TabsSecondary.styles.tsx +77 -0
- package/src/writer/UnderlineNav/TabsSecondary.tsx +171 -0
- package/src/writer/UnderlineNav/UnderlineNav.styles.tsx +181 -45
- package/src/writer/UnderlineNav/UnderlineNav.tsx +258 -23
- package/src/writer/UnderlineNav/index.ts +2 -1
- package/src/writer/UnderlineNav/useValueChange.ts +60 -0
- package/src/writer/Update/Update.styles.tsx +33 -0
- package/src/writer/Update/Update.tsx +37 -0
- package/src/writer/Update/index.ts +1 -0
- package/src/writer/VideoGuide/VideoGuide.module.css +105 -0
- package/src/writer/VideoGuide/VideoGuide.tsx +75 -0
- package/src/writer/VideoGuide/index.ts +1 -0
- package/src/writer/index.ts +23 -1
- package/tsconfig.json +11 -6
- package/types.d.ts +50 -0
- package/writer.ts +1 -1
- package/dist/CTABanner-BrdYlhnD.js +0 -2
- package/dist/CTABanner-BrdYlhnD.js.map +0 -1
- package/dist/CTABanner-XQNnnpUx.js +0 -2
- package/dist/CTABanner-XQNnnpUx.js.map +0 -1
- package/dist/CodeSample-Cp42Adjc.js +0 -2
- package/dist/CodeSample-Cp42Adjc.js.map +0 -1
- package/dist/CodeSample-DxPp80ID.js +0 -2
- package/dist/CodeSample-DxPp80ID.js.map +0 -1
- package/dist/HomeView-BN9mZXh9.js +0 -2
- package/dist/HomeView-BN9mZXh9.js.map +0 -1
- package/dist/HomeView-BVaaV0uE.js +0 -2
- package/dist/HomeView-BVaaV0uE.js.map +0 -1
- package/dist/UnderlineNav-Bs7Ot9Ch.js +0 -2
- package/dist/UnderlineNav-Bs7Ot9Ch.js.map +0 -1
- package/dist/UnderlineNav-C2aEVraN.js +0 -2
- package/dist/UnderlineNav-C2aEVraN.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-BMmCG_qQ.js +0 -2
- package/dist/_rollupPluginBabelHelpers-BMmCG_qQ.js.map +0 -1
- package/dist/_rollupPluginBabelHelpers-DsEzE6Ab.js +0 -2
- package/dist/_rollupPluginBabelHelpers-DsEzE6Ab.js.map +0 -1
- package/dist/index-BVUz77Tm.js +0 -2
- package/dist/index-BVUz77Tm.js.map +0 -1
- package/dist/index-jxd3nv2J.js +0 -2
- package/dist/index-jxd3nv2J.js.map +0 -1
- package/dist/tslib.es6-DDIOdJiV.js +0 -2
- package/dist/tslib.es6-DUrRPhZd.js +0 -2
- package/src/content/Anchor/Anchor.tsx +0 -63
- package/src/content/Anchor/index.tsx +0 -3
- package/src/content/Content/Content.tsx +0 -21
- package/src/content/Content/index.tsx +0 -3
- package/src/content/Content.tsx +0 -180
- package/src/content/Subtitle/Subtitle.tsx +0 -21
- package/src/content/Subtitle/index.tsx +0 -3
- package/src/layouts/Layout.styles.tsx +0 -151
- package/src/layouts/Layout.tsx +0 -121
- package/src/ui/Loader/Loader.styles.tsx +0 -52
- package/src/ui/Loader/Loader.tsx +0 -26
- package/src/ui/index.ts +0 -1
- package/src/writer/Icon/index.tsx +0 -355
- package/src/writer/Table/TableV2.styles.tsx +0 -117
- 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
|
|
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(
|
|
26
|
+
export function Breadcrumbs({className, items}: BreadcrumbsProps): ReactElement {
|
|
21
27
|
return (
|
|
22
|
-
<
|
|
23
|
-
{
|
|
24
|
-
|
|
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
|
|
29
|
-
<div
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
</
|
|
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
|
+
}
|
|
@@ -1,50 +1,39 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
4
|
-
|
|
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
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
+
`;
|
package/src/writer/Code/Code.tsx
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
|
|
3
|
-
import
|
|
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={
|
|
11
|
-
|
|
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
|
}
|