@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,45 +1,155 @@
|
|
|
1
1
|
import React from "react"
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import cn from "./Table.styles";
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Props for the Table component
|
|
7
|
+
*/
|
|
5
8
|
export interface TableProps {
|
|
9
|
+
/** The content to be rendered inside the table */
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
|
|
12
|
+
/** Optional CSS class name to be applied to the table */
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A table component that provides a structured way to display tabular data.
|
|
18
|
+
* It supports custom styling through className prop and can contain various table elements.
|
|
19
|
+
*
|
|
20
|
+
* @category Component
|
|
21
|
+
*/
|
|
22
|
+
export function Table({ children, className }: TableProps) {
|
|
23
|
+
return (
|
|
24
|
+
<table className={`${cn.Host} ${className || ''}`}>
|
|
25
|
+
{children}
|
|
26
|
+
</table>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Props for the TableHead component
|
|
32
|
+
*/
|
|
33
|
+
export interface TableHeadProps {
|
|
34
|
+
/** The content to be rendered inside the table header */
|
|
6
35
|
children: React.ReactNode;
|
|
7
36
|
}
|
|
8
37
|
|
|
9
|
-
|
|
10
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Represents the header section of a table.
|
|
40
|
+
* Use this component to group header content at the top of the table.
|
|
41
|
+
*/
|
|
42
|
+
Table.Head = function TableHead({ children }: TableHeadProps) {
|
|
43
|
+
return <thead className={cn.Thead}>
|
|
11
44
|
{children}
|
|
12
|
-
</
|
|
45
|
+
</thead>
|
|
13
46
|
}
|
|
14
47
|
|
|
48
|
+
/**
|
|
49
|
+
* Props for the TableTh component
|
|
50
|
+
*/
|
|
15
51
|
export interface TableThProps {
|
|
52
|
+
/** The content to be rendered inside the table header cell */
|
|
16
53
|
children: React.ReactNode;
|
|
54
|
+
|
|
55
|
+
/** Whether the cell content should be right-aligned (for numeric values) */
|
|
56
|
+
numeric?: boolean;
|
|
17
57
|
}
|
|
18
58
|
|
|
19
|
-
|
|
20
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Represents a header cell in the table.
|
|
61
|
+
* Use this component for column headers in the table.
|
|
62
|
+
*/
|
|
63
|
+
Table.Th = function TableTh({ children, numeric }: TableThProps) {
|
|
64
|
+
return <th className={`${cn.Th} ${numeric ? 'numeric' : ''}`}>
|
|
21
65
|
{children}
|
|
22
66
|
</th>
|
|
23
67
|
}
|
|
24
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Props for the TableTr component
|
|
71
|
+
*/
|
|
25
72
|
export interface TableTrProps {
|
|
73
|
+
/** The content to be rendered inside the table row */
|
|
26
74
|
children: React.ReactNode;
|
|
27
75
|
}
|
|
28
76
|
|
|
29
|
-
|
|
30
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Represents a row in the table.
|
|
79
|
+
* Use this component to create rows in the table body or header.
|
|
80
|
+
*/
|
|
81
|
+
Table.Tr = function TableTr({ children }: TableTrProps) {
|
|
82
|
+
return <tr className={cn.Tr}>
|
|
31
83
|
{children}
|
|
32
84
|
</tr>
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Props for the TableBody component
|
|
89
|
+
*/
|
|
90
|
+
export interface TableBodyProps {
|
|
91
|
+
/** The content to be rendered inside the table body */
|
|
92
|
+
children: React.ReactNode;
|
|
93
|
+
}
|
|
33
94
|
|
|
95
|
+
/**
|
|
96
|
+
* Represents the main content area of the table.
|
|
97
|
+
* Use this component to group the main content rows of the table.
|
|
98
|
+
*/
|
|
99
|
+
Table.Body = function TableBody({ children }: TableBodyProps) {
|
|
100
|
+
return <tbody className={cn.Tbody}>
|
|
101
|
+
{children}
|
|
102
|
+
</tbody>
|
|
34
103
|
}
|
|
35
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Props for the TableTd component
|
|
107
|
+
*/
|
|
36
108
|
export interface TableTdProps {
|
|
109
|
+
/** The content to be rendered inside the table cell */
|
|
37
110
|
children: React.ReactNode;
|
|
111
|
+
|
|
112
|
+
/** Whether the cell content should be right-aligned (for numeric values) */
|
|
113
|
+
numeric?: boolean;
|
|
114
|
+
|
|
115
|
+
/** Whether the cell should have a muted appearance */
|
|
116
|
+
muted?: boolean;
|
|
38
117
|
}
|
|
39
118
|
|
|
40
|
-
|
|
41
|
-
|
|
119
|
+
/**
|
|
120
|
+
* Represents a data cell in the table.
|
|
121
|
+
* Use this component for regular data cells in the table body.
|
|
122
|
+
*/
|
|
123
|
+
Table.Td = function TableTd({ children, numeric, muted }: TableTdProps) {
|
|
124
|
+
return <td className={`${cn.Td} ${numeric ? 'numeric' : ''} ${muted ? 'muted' : ''}`}>
|
|
42
125
|
{children}
|
|
43
126
|
</td>
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Props for the TableCell component
|
|
131
|
+
*/
|
|
132
|
+
export interface TableCellProps {
|
|
133
|
+
/** The content to be rendered inside the table cell */
|
|
134
|
+
children: React.ReactNode;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* A custom table cell component that wraps content in a div with specific styling.
|
|
139
|
+
* Use this component when you need a custom-styled cell with additional structure.
|
|
140
|
+
*/
|
|
141
|
+
Table.Cell = function TableCell({ children }: TableCellProps) {
|
|
142
|
+
return <xyd-table-cell className={cn.Cell}>
|
|
143
|
+
<div part="child">
|
|
144
|
+
{children}
|
|
145
|
+
</div>
|
|
146
|
+
</xyd-table-cell>
|
|
147
|
+
}
|
|
44
148
|
|
|
45
|
-
|
|
149
|
+
/**
|
|
150
|
+
* Props for the TableModelCell component
|
|
151
|
+
*/
|
|
152
|
+
export interface TableModelCellProps {
|
|
153
|
+
/** The content to be rendered inside the model cell */
|
|
154
|
+
children: React.ReactNode;
|
|
155
|
+
}
|
|
@@ -1,77 +1,70 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
3
|
+
export const TabsSampleHost = css`
|
|
4
|
+
@layer defaults {
|
|
5
|
+
display: block;
|
|
5
6
|
position: relative;
|
|
6
7
|
max-width: 100%;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
`,
|
|
23
|
-
icon: css`
|
|
24
|
-
width: 16px;
|
|
25
|
-
height: 16px;
|
|
26
|
-
`
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const $scroller = {
|
|
30
|
-
host: css`
|
|
31
|
-
overflow-x: auto;
|
|
32
|
-
flex-grow: 1;
|
|
33
|
-
`,
|
|
34
|
-
container: css`
|
|
35
|
-
display: inline-flex;
|
|
36
|
-
gap: 4px;
|
|
37
|
-
|
|
38
|
-
border-radius: 8px;
|
|
39
|
-
background-color: #F3F4F6;
|
|
40
|
-
|
|
41
|
-
padding: 4px;
|
|
42
|
-
margin-left: 4px;
|
|
43
|
-
`
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export const $button = {
|
|
47
|
-
host: css`
|
|
48
|
-
padding: 0.5rem 1rem;
|
|
49
|
-
|
|
50
|
-
border-radius: 0.375rem;
|
|
51
|
-
font-size: 0.875rem;
|
|
52
|
-
line-height: 1.25rem;
|
|
53
|
-
font-weight: 500;
|
|
54
|
-
white-space: nowrap;
|
|
55
|
-
|
|
56
|
-
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
57
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
58
|
-
transition-duration: 300ms;
|
|
59
|
-
|
|
60
|
-
color: #6B7280;
|
|
61
|
-
|
|
62
|
-
&:hover {
|
|
63
|
-
color: #111827;
|
|
8
|
+
|
|
9
|
+
[part="buttons"] {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part="arrow"] {
|
|
15
|
+
padding: 8px;
|
|
16
|
+
background-color: var(--xyd-tabs-arrow-bgcolor);
|
|
17
|
+
box-shadow: 0 1px 2px 0 var(--xyd-tabs-shadow-color--active);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
[part="arrow-icon"] {
|
|
21
|
+
width: 16px;
|
|
22
|
+
height: 16px;
|
|
64
23
|
}
|
|
65
24
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
25
|
+
[part="scroller"] {
|
|
26
|
+
overflow-x: auto;
|
|
27
|
+
flex-grow: 1;
|
|
70
28
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
29
|
+
|
|
30
|
+
[part="scroller-container"] {
|
|
31
|
+
display: inline-flex;
|
|
32
|
+
gap: 4px;
|
|
33
|
+
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
background-color: var(--xyd-tabs-bgcolor);
|
|
36
|
+
|
|
37
|
+
padding: 4px;
|
|
38
|
+
margin-left: 4px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
[part="button"] {
|
|
42
|
+
padding: 5px 16px;
|
|
43
|
+
|
|
44
|
+
border-radius: 0.375rem;
|
|
45
|
+
white-space: nowrap;
|
|
46
|
+
|
|
47
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
48
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
49
|
+
transition-duration: 300ms;
|
|
50
|
+
|
|
51
|
+
color: var(--xyd-tabs-color);
|
|
52
|
+
|
|
53
|
+
&:hover {
|
|
54
|
+
color: var(--xyd-tabs-color--active);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&[data-state="active"] {
|
|
58
|
+
color: var(--xyd-tabs-color--active);
|
|
59
|
+
background-color: var(--xyd-tabs-bgcolor--active);
|
|
60
|
+
box-shadow: 0 1px 2px 0 var(--xyd-tabs-shadow-color--active);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[part="content"] {
|
|
65
|
+
margin-top: 16px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
|
package/src/writer/Tabs/Tabs.tsx
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import React, {useState, useRef, useEffect} from 'react'
|
|
2
|
-
import
|
|
3
|
-
import {ChevronLeft, ChevronRight} from "lucide-react"
|
|
1
|
+
import React, { useState, useRef, useEffect } from 'react'
|
|
2
|
+
import {Tabs as RadixTabs} from "radix-ui"; // TODO: remove and use separation
|
|
3
|
+
import { ChevronLeft, ChevronRight } from "lucide-react"
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
$sample,
|
|
7
|
-
$arrow,
|
|
8
|
-
$scroller,
|
|
9
|
-
$button
|
|
10
|
-
} from "./Tabs.styles";
|
|
5
|
+
import * as cn from "./Tabs.styles";
|
|
11
6
|
|
|
12
7
|
export interface TabsProps {
|
|
13
8
|
children: React.ReactNode;
|
|
14
9
|
items: string[];
|
|
15
10
|
tabIndex?: number;
|
|
11
|
+
className?: string;
|
|
16
12
|
}
|
|
17
13
|
|
|
18
|
-
export function Tabs({children, items, tabIndex}: TabsProps) {
|
|
14
|
+
export function Tabs({ children, items, tabIndex, className }: TabsProps) {
|
|
19
15
|
const [showLeftArrow, setShowLeftArrow] = useState(false)
|
|
20
16
|
const [showRightArrow, setShowRightArrow] = useState(false)
|
|
21
17
|
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
|
@@ -24,7 +20,7 @@ export function Tabs({children, items, tabIndex}: TabsProps) {
|
|
|
24
20
|
|
|
25
21
|
const handleScroll = () => {
|
|
26
22
|
if (scrollContainerRef.current) {
|
|
27
|
-
const {scrollLeft, scrollWidth, clientWidth} = scrollContainerRef.current
|
|
23
|
+
const { scrollLeft, scrollWidth, clientWidth } = scrollContainerRef.current
|
|
28
24
|
setShowLeftArrow(scrollLeft > 0)
|
|
29
25
|
setShowRightArrow(scrollLeft < scrollWidth - clientWidth)
|
|
30
26
|
}
|
|
@@ -39,33 +35,37 @@ export function Tabs({children, items, tabIndex}: TabsProps) {
|
|
|
39
35
|
const scroll = (direction: 'left' | 'right') => {
|
|
40
36
|
if (scrollContainerRef.current) {
|
|
41
37
|
const scrollAmount = direction === 'left' ? -200 : 200
|
|
42
|
-
scrollContainerRef.current.scrollBy({left: scrollAmount, behavior: 'smooth'})
|
|
38
|
+
scrollContainerRef.current.scrollBy({ left: scrollAmount, behavior: 'smooth' })
|
|
43
39
|
}
|
|
44
40
|
}
|
|
45
41
|
|
|
46
42
|
return (
|
|
47
43
|
<RadixTabs.Root asChild value={value} onValueChange={setActiveTab}>
|
|
48
|
-
<
|
|
49
|
-
|
|
44
|
+
<xyd-tabs
|
|
45
|
+
className={`${cn.TabsSampleHost} ${className || ""}`}
|
|
46
|
+
>
|
|
47
|
+
<div part="buttons">
|
|
50
48
|
{showLeftArrow && (
|
|
51
49
|
<button
|
|
52
50
|
onClick={() => scroll('left')}
|
|
53
|
-
|
|
51
|
+
part="arrow"
|
|
54
52
|
>
|
|
55
|
-
<ChevronLeft
|
|
53
|
+
<ChevronLeft part="arrow-icon" />
|
|
56
54
|
</button>
|
|
57
55
|
)}
|
|
58
56
|
|
|
59
57
|
<div
|
|
60
58
|
ref={scrollContainerRef}
|
|
61
59
|
onScroll={handleScroll}
|
|
62
|
-
|
|
60
|
+
part="scroller"
|
|
63
61
|
>
|
|
64
|
-
<div
|
|
62
|
+
<div
|
|
63
|
+
part="scroller-container"
|
|
64
|
+
>
|
|
65
65
|
<RadixTabs.List>
|
|
66
|
-
{items.map((item, index) =>
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
{items.map((item, index) => <$TabsItem key={index} value={item}>
|
|
67
|
+
{item}
|
|
68
|
+
</$TabsItem>
|
|
69
69
|
)}
|
|
70
70
|
</RadixTabs.List>
|
|
71
71
|
</div>
|
|
@@ -74,31 +74,33 @@ export function Tabs({children, items, tabIndex}: TabsProps) {
|
|
|
74
74
|
{showRightArrow && (
|
|
75
75
|
<button
|
|
76
76
|
onClick={() => scroll('right')}
|
|
77
|
-
|
|
77
|
+
part="arrow"
|
|
78
78
|
>
|
|
79
|
-
<ChevronRight
|
|
79
|
+
<ChevronRight part="arrow-icon" />
|
|
80
80
|
</button>
|
|
81
81
|
)}
|
|
82
82
|
</div>
|
|
83
83
|
|
|
84
|
-
<div
|
|
84
|
+
<div part="content">
|
|
85
85
|
{children}
|
|
86
86
|
</div>
|
|
87
|
-
</
|
|
87
|
+
</xyd-tabs>
|
|
88
88
|
</RadixTabs.Root>
|
|
89
89
|
)
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
function TabsItem({children, value}) {
|
|
92
|
+
function $TabsItem({ children, value }) {
|
|
93
93
|
return <RadixTabs.Trigger asChild value={value}>
|
|
94
|
-
<button
|
|
94
|
+
<button part="button">
|
|
95
95
|
{children}
|
|
96
96
|
</button>
|
|
97
97
|
</RadixTabs.Trigger>
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
Tabs.Content = function TabsContent({children, value}) {
|
|
100
|
+
Tabs.Content = function TabsContent({ children, value }) {
|
|
101
101
|
return <RadixTabs.Content asChild value={value}>
|
|
102
|
-
|
|
102
|
+
<div>
|
|
103
|
+
{children}
|
|
104
|
+
</div>
|
|
103
105
|
</RadixTabs.Content>
|
|
104
106
|
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { css } from "@linaria/core";
|
|
2
|
+
|
|
3
|
+
export const TextHost = css`
|
|
4
|
+
@layer defaults {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
margin: 0;
|
|
7
|
+
|
|
8
|
+
&[data-size="xsmall"] {
|
|
9
|
+
font-size: var(--xyd-font-size-xsmall);
|
|
10
|
+
line-height: var(--xyd-line-height-xsmall);
|
|
11
|
+
}
|
|
12
|
+
&[data-size="small"] {
|
|
13
|
+
font-size: var(--xyd-font-size-small);
|
|
14
|
+
line-height: var(--xyd-line-height-small);
|
|
15
|
+
}
|
|
16
|
+
&[data-size="medium"] {
|
|
17
|
+
font-size: var(--xyd-font-size-medium);
|
|
18
|
+
line-height: var(--xyd-line-height-medium);
|
|
19
|
+
}
|
|
20
|
+
&[data-size="large"] {
|
|
21
|
+
font-size: var(--xyd-font-size-large);
|
|
22
|
+
line-height: var(--xyd-line-height-large);
|
|
23
|
+
}
|
|
24
|
+
&[data-size="xlarge"] {
|
|
25
|
+
font-size: var(--xyd-font-size-xlarge);
|
|
26
|
+
line-height: var(--xyd-line-height-xlarge);
|
|
27
|
+
}
|
|
28
|
+
&[data-size="xxlarge"] {
|
|
29
|
+
font-size: var(--xyd-font-size-xxlarge);
|
|
30
|
+
line-height: var(--xyd-line-height-xxlarge);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
&[data-kind="default"] {
|
|
34
|
+
color: var(--xyd-text-color--default);
|
|
35
|
+
}
|
|
36
|
+
&[data-kind="ghost"] {
|
|
37
|
+
color: var(--xyd-text-color--ghost);
|
|
38
|
+
}
|
|
39
|
+
&[data-kind="success"] {
|
|
40
|
+
color: var(--xyd-text-color--success);
|
|
41
|
+
}
|
|
42
|
+
&[data-kind="warn"] {
|
|
43
|
+
color: var(--xyd-text-color--warn);
|
|
44
|
+
}
|
|
45
|
+
&[data-kind="error"] {
|
|
46
|
+
color: var(--xyd-text-color--error);
|
|
47
|
+
}
|
|
48
|
+
&[data-kind="primary"] {
|
|
49
|
+
color: var(--xyd-text-color--primary);
|
|
50
|
+
}
|
|
51
|
+
&[data-kind="secondary"] {
|
|
52
|
+
color: var(--xyd-text-color--secondary);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&[data-weight="normal"] {
|
|
56
|
+
font-weight: var(--xyd-font-weight-normal);
|
|
57
|
+
}
|
|
58
|
+
&[data-weight="bold"] {
|
|
59
|
+
font-weight: var(--xyd-font-weight-medium);
|
|
60
|
+
}
|
|
61
|
+
&[data-weight="extra-bold"] {
|
|
62
|
+
font-weight: var(--xyd-font-weight-semibold);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
|
|
3
|
+
import * as cn from "./Text.styles";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Available font sizes for the Text component
|
|
7
|
+
*/
|
|
8
|
+
export type TextFontSizes = "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Available text styles/kinds for the Text component
|
|
12
|
+
*/
|
|
13
|
+
export type TextKindTypes = "default" | "ghost" | "success" | "warn" | "error" | "primary" | "secondary";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Available font weights for the Text component
|
|
17
|
+
*/
|
|
18
|
+
export type TextFontWeights = "normal" | "bold" | "extra-bold";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Props for the Text component
|
|
22
|
+
*/
|
|
23
|
+
export interface TextProps {
|
|
24
|
+
/** Font size of the text */
|
|
25
|
+
size?: TextFontSizes
|
|
26
|
+
|
|
27
|
+
/** Visual style/kind of the text */
|
|
28
|
+
kind?: TextKindTypes
|
|
29
|
+
|
|
30
|
+
/** Font weight of the text */
|
|
31
|
+
weight?: TextFontWeights
|
|
32
|
+
|
|
33
|
+
/** Content to be rendered inside the text component */
|
|
34
|
+
children?: React.ReactNode
|
|
35
|
+
|
|
36
|
+
/** Additional CSS class name */
|
|
37
|
+
className?: string
|
|
38
|
+
|
|
39
|
+
/** HTML id attribute */
|
|
40
|
+
id?: string
|
|
41
|
+
|
|
42
|
+
/** Click event handler */
|
|
43
|
+
onClick?: () => void
|
|
44
|
+
|
|
45
|
+
/** HTML tag to render the text as */
|
|
46
|
+
as?: "span" | "p"
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A flexible text component that supports different sizes, styles, and weights.
|
|
51
|
+
*
|
|
52
|
+
* @category Component
|
|
53
|
+
*/
|
|
54
|
+
export function Text({
|
|
55
|
+
size = "medium",
|
|
56
|
+
kind = "default",
|
|
57
|
+
weight = "normal",
|
|
58
|
+
children,
|
|
59
|
+
className,
|
|
60
|
+
id,
|
|
61
|
+
onClick,
|
|
62
|
+
as = "p"
|
|
63
|
+
}: TextProps) {
|
|
64
|
+
const Tag = as || "p";
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<Tag
|
|
68
|
+
className={`${cn.TextHost} ${className || ''}`}
|
|
69
|
+
data-size={size}
|
|
70
|
+
data-kind={kind}
|
|
71
|
+
data-weight={weight}
|
|
72
|
+
onClick={onClick}
|
|
73
|
+
id={id}
|
|
74
|
+
>
|
|
75
|
+
{children}
|
|
76
|
+
</Tag>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@layer defaults {
|
|
2
|
+
.TocCardHost {
|
|
3
|
+
display: block;
|
|
4
|
+
max-width: 250px;
|
|
5
|
+
|
|
6
|
+
[part="container"] {
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
[part="description"] {
|
|
10
|
+
color: var(--xyd-toccard-color);
|
|
11
|
+
letter-spacing: 0;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
[part="link"] {
|
|
15
|
+
display: block;
|
|
16
|
+
border: 1px solid var(--xyd-toccard-border-color);
|
|
17
|
+
border-radius: 6px;
|
|
18
|
+
padding: 8px 16px 12px;
|
|
19
|
+
text-decoration: none;
|
|
20
|
+
|
|
21
|
+
&:hover {
|
|
22
|
+
border-color: var(--xyd-toccard-border-color--active);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[part="title-container"] {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: space-between;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
[part="title"] {
|
|
33
|
+
color: var(--xyd-toccard-title-color);
|
|
34
|
+
margin-bottom: 2px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
[part="link-icon"] {
|
|
38
|
+
width: 1em;
|
|
39
|
+
height: 1em;
|
|
40
|
+
object-fit: contain;
|
|
41
|
+
color: var(--xyd-toccard-icon-color);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
import cn from "./TocCard.module.css";
|
|
4
|
+
import { Icon } from "writer";
|
|
5
|
+
|
|
6
|
+
interface TocCardProps {
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
href: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
icon?: string;
|
|
12
|
+
as?: React.ElementType;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function TocCard({ title, description, href, className, icon, as }: TocCardProps) {
|
|
16
|
+
const Link = as || $Link;
|
|
17
|
+
|
|
18
|
+
return <xyd-toccard
|
|
19
|
+
className={`${cn.TocCardHost} ${className || ""}`}
|
|
20
|
+
>
|
|
21
|
+
<div part="container">
|
|
22
|
+
<Link
|
|
23
|
+
part="link"
|
|
24
|
+
href={href}
|
|
25
|
+
target="_blank"
|
|
26
|
+
rel="noreferrer"
|
|
27
|
+
>
|
|
28
|
+
<div part="title-container">
|
|
29
|
+
<div part="title">{title}</div>
|
|
30
|
+
{icon && <Icon name={icon} size={16} />}
|
|
31
|
+
</div>
|
|
32
|
+
<div part="description">
|
|
33
|
+
{description}
|
|
34
|
+
</div>
|
|
35
|
+
</Link>
|
|
36
|
+
</div>
|
|
37
|
+
</xyd-toccard>
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function $Link({ children, href, ...props }: React.ComponentProps<'a'>) {
|
|
41
|
+
return <a href={href} {...props}>{children}</a>
|
|
42
|
+
}
|