@xyd-js/atlas 0.1.0-xyd.8 → 0.1.0-xyd.99
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/.storybook/index.css +1 -27
- package/.storybook/preview.ts +1 -2
- package/CHANGELOG.md +1057 -0
- package/LICENSE +21 -0
- package/dist/Update-0XruJHjj-COLbZvRj.js +4 -0
- package/dist/Update-0XruJHjj-COLbZvRj.js.map +1 -0
- package/dist/Update-DKOAw8p9-COLbZvRj.js +4 -0
- package/dist/Update-DKOAw8p9-COLbZvRj.js.map +1 -0
- package/dist/index.css +43 -54
- package/dist/index.d.ts +30 -11
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +89 -0
- package/dist/tokens.css +60 -0
- package/dist/xydPlugin.d.ts +5 -0
- package/dist/xydPlugin.js +2 -0
- package/dist/xydPlugin.js.map +1 -0
- package/index.ts +1 -1
- package/package.json +20 -21
- package/packages/xyd-plugin/SidebarItem.tsx +27 -0
- package/packages/xyd-plugin/index.ts +20 -0
- package/rollup.config.js +56 -12
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +95 -63
- package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +507 -55
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +186 -143
- package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +584 -76
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +19 -23
- package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +39 -24
- package/src/components/Atlas/Atlas.styles.tsx +3 -5
- package/src/components/Atlas/Atlas.tsx +34 -21
- package/src/components/Atlas/AtlasContext.tsx +47 -0
- package/src/components/Atlas/AtlasDecorator.styles.ts +22 -0
- package/src/components/Atlas/AtlasDecorator.tsx +15 -0
- package/src/components/Atlas/AtlasLazy/AtlasLazy.styles.tsx +7 -8
- package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +4 -6
- package/src/components/Atlas/AtlasPrimary.tsx +21 -0
- package/src/components/Atlas/AtlasSecondary.tsx +148 -0
- package/src/components/Atlas/index.ts +6 -2
- package/src/components/Atlas/types.ts +11 -0
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +56 -141
- package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +19 -28
- package/src/components/Code/index.ts +0 -4
- package/src/components/Icon/index.tsx +384 -0
- package/src/styles/styles.css +89 -0
- package/src/styles/tokens.css +60 -0
- package/src/utils/mdx.ts +0 -29
- package/tsconfig.json +9 -2
- package/types.d.ts +22 -0
- package/src/components/Code/CodeCopy/CodeCopy.style.tsx +0 -21
- package/src/components/Code/CodeCopy/CodeCopy.tsx +0 -32
- package/src/components/Code/CodeCopy/index.ts +0 -7
- package/src/components/Code/CodeSample/CodeSample.styles.tsx +0 -134
- package/src/components/Code/CodeSample/CodeSample.tsx +0 -149
- package/src/components/Code/CodeSample/index.ts +0 -8
- package/src/components/Code/CodeSample/withLocalStored.tsx +0 -52
- package/src/components/Code/default-theme.ts +0 -266
|
@@ -1,143 +1,58 @@
|
|
|
1
1
|
import {css} from "@linaria/core";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
color: #6B7280;
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
62
|
-
//color: var(--atlas-comp-code-sample_buttons-color--active);
|
|
63
|
-
color: #111827;
|
|
64
|
-
}
|
|
65
|
-
`,
|
|
66
|
-
$$active: css`
|
|
67
|
-
//color: var(--atlas-comp-code-sample_buttons-color--active);
|
|
68
|
-
//background-color: var(--atlas-comp-code-sample_buttons-background--active);
|
|
69
|
-
color: #111827;
|
|
70
|
-
background-color: #ffffff;
|
|
71
|
-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
72
|
-
`
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/*
|
|
76
|
-
import {css} from "@linaria/core";
|
|
77
|
-
|
|
78
|
-
export const $sample = {
|
|
79
|
-
host: css`
|
|
80
|
-
position: relative;
|
|
81
|
-
max-width: 100%;
|
|
82
|
-
`,
|
|
83
|
-
container: css`
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
border-radius: 8px;
|
|
87
|
-
background-color: #F3F4F6;
|
|
88
|
-
`
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export const $arrow = {
|
|
92
|
-
host: css`
|
|
93
|
-
padding: 8px;
|
|
94
|
-
background-color: #ffffff;
|
|
95
|
-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
96
|
-
`,
|
|
97
|
-
icon: css`
|
|
98
|
-
width: 16px;
|
|
99
|
-
height: 16px;
|
|
100
|
-
`
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
export const $scroller = {
|
|
104
|
-
host: css`
|
|
105
|
-
overflow-x: auto;
|
|
106
|
-
flex-grow: 1;
|
|
107
|
-
`,
|
|
108
|
-
container: css`
|
|
109
|
-
display: inline-flex;
|
|
110
|
-
gap: 4px;
|
|
111
|
-
|
|
112
|
-
padding: 4px;
|
|
113
|
-
margin-left: 4px;
|
|
114
|
-
`
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
export const $button = {
|
|
118
|
-
host: css`
|
|
119
|
-
padding: 0.5rem 1rem;
|
|
120
|
-
|
|
121
|
-
border-radius: 0.375rem;
|
|
122
|
-
font-size: 0.875rem;
|
|
123
|
-
line-height: 1.25rem;
|
|
124
|
-
font-weight: 500;
|
|
125
|
-
white-space: nowrap;
|
|
126
|
-
|
|
127
|
-
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
128
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
129
|
-
transition-duration: 300ms;
|
|
130
|
-
|
|
131
|
-
color: #6B7280;
|
|
132
|
-
|
|
133
|
-
&:hover {
|
|
134
|
-
color: #111827;
|
|
135
|
-
}
|
|
136
|
-
`,
|
|
137
|
-
$$active: css`
|
|
138
|
-
color: #111827;
|
|
139
|
-
background-color: #ffffff;
|
|
140
|
-
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
141
|
-
`
|
|
142
|
-
}
|
|
143
|
-
*/
|
|
3
|
+
export const CodeSampleButtonsHost = css`
|
|
4
|
+
position: relative;
|
|
5
|
+
max-width: 100%;
|
|
6
|
+
`;
|
|
7
|
+
|
|
8
|
+
export const CodeSampleButtonsContainer = css`
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
width: 100%;
|
|
11
|
+
align-items: center;
|
|
12
|
+
border-radius: 8px;
|
|
13
|
+
background-color: var(--XydAtlas-Component-Code-SampleButtons__color-containerBackground);
|
|
14
|
+
`;
|
|
15
|
+
|
|
16
|
+
export const CodeSampleButtonsArrowHost = css`
|
|
17
|
+
padding: 8px;
|
|
18
|
+
background-color: #ffffff;
|
|
19
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const CodeSampleButtonsArrowIcon = css`
|
|
23
|
+
width: 16px;
|
|
24
|
+
height: 16px;
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export const CodeSampleButtonsScrollerHost = css`
|
|
28
|
+
overflow-x: auto;
|
|
29
|
+
flex-grow: 1;
|
|
30
|
+
font-weight: var(--xyd-font-weight-semibold);
|
|
31
|
+
`;
|
|
32
|
+
|
|
33
|
+
export const CodeSampleButtonsScrollerContainer = css`
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
gap: 4px;
|
|
36
|
+
padding: 4px;
|
|
37
|
+
margin-left: 4px;
|
|
38
|
+
`;
|
|
39
|
+
|
|
40
|
+
export const CodeSampleButtonsButtonHost = css`
|
|
41
|
+
padding: 4px 16px;
|
|
42
|
+
border-radius: 0.375rem;
|
|
43
|
+
white-space: nowrap;
|
|
44
|
+
transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
|
|
45
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
46
|
+
transition-duration: 300ms;
|
|
47
|
+
color: var(--XydAtlas-Component-Code-SampleButtons__color);
|
|
48
|
+
|
|
49
|
+
&:hover {
|
|
50
|
+
color: var(--XydAtlas-Component-Code-SampleButtons__color--active);
|
|
51
|
+
}
|
|
52
|
+
`;
|
|
53
|
+
|
|
54
|
+
export const CodeSampleButtonsButtonActive = css`
|
|
55
|
+
color: var(--XydAtlas-Component-Code-SampleButtons__color--active);
|
|
56
|
+
background-color: var(--XydAtlas-Component-Code-SampleButtons__color-background--active);
|
|
57
|
+
box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
|
|
58
|
+
`;
|
|
@@ -3,21 +3,12 @@ import {ChevronLeft, ChevronRight} from "lucide-react"
|
|
|
3
3
|
|
|
4
4
|
import {Example} from "@xyd-js/uniform";
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
$sample,
|
|
10
|
-
$arrow,
|
|
11
|
-
$scroller,
|
|
12
|
-
$button
|
|
13
|
-
} from "./CodeSampleButtons.styles";
|
|
6
|
+
import * as cn from "./CodeSampleButtons.styles";
|
|
14
7
|
|
|
15
8
|
export interface CodeExampleButtonsProps {
|
|
16
|
-
examples:
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onClick: (example: MDXReference<Example>) => void
|
|
9
|
+
examples: Example[]
|
|
10
|
+
activeExample: Example | null
|
|
11
|
+
onClick: (example: Example) => void
|
|
21
12
|
}
|
|
22
13
|
|
|
23
14
|
export function CodeExampleButtons({examples, activeExample, onClick}: CodeExampleButtonsProps) {
|
|
@@ -47,40 +38,40 @@ export function CodeExampleButtons({examples, activeExample, onClick}: CodeExamp
|
|
|
47
38
|
}
|
|
48
39
|
|
|
49
40
|
return (
|
|
50
|
-
<div className={
|
|
51
|
-
<div className={
|
|
41
|
+
<div className={cn.CodeSampleButtonsHost}>
|
|
42
|
+
<div className={cn.CodeSampleButtonsContainer}>
|
|
52
43
|
{showLeftArrow && (
|
|
53
44
|
<button
|
|
54
45
|
onClick={() => scroll('left')}
|
|
55
|
-
className={
|
|
46
|
+
className={cn.CodeSampleButtonsArrowHost}
|
|
56
47
|
>
|
|
57
|
-
<ChevronLeft className={
|
|
48
|
+
<ChevronLeft className={cn.CodeSampleButtonsArrowIcon}/>
|
|
58
49
|
</button>
|
|
59
50
|
)}
|
|
60
51
|
<div
|
|
61
52
|
ref={scrollContainerRef}
|
|
62
53
|
onScroll={handleScroll}
|
|
63
|
-
className={
|
|
54
|
+
className={cn.CodeSampleButtonsScrollerHost}
|
|
64
55
|
>
|
|
65
|
-
<div className={
|
|
56
|
+
<div className={cn.CodeSampleButtonsScrollerContainer}>
|
|
66
57
|
{examples?.map((example) => (
|
|
67
|
-
|
|
58
|
+
<SampleButton
|
|
68
59
|
key={example.codeblock.title}
|
|
69
60
|
onClick={() => onClick(example)}
|
|
70
61
|
example={example}
|
|
71
62
|
activeExample={activeExample}
|
|
72
63
|
>
|
|
73
|
-
{
|
|
74
|
-
|
|
64
|
+
{(example.codeblock.title || null)}
|
|
65
|
+
</SampleButton>
|
|
75
66
|
))}
|
|
76
67
|
</div>
|
|
77
68
|
</div>
|
|
78
69
|
{showRightArrow && (
|
|
79
70
|
<button
|
|
80
71
|
onClick={() => scroll('right')}
|
|
81
|
-
className={
|
|
72
|
+
className={cn.CodeSampleButtonsArrowHost}
|
|
82
73
|
>
|
|
83
|
-
<ChevronRight className={
|
|
74
|
+
<ChevronRight className={cn.CodeSampleButtonsArrowIcon}/>
|
|
84
75
|
</button>
|
|
85
76
|
)}
|
|
86
77
|
</div>
|
|
@@ -88,18 +79,18 @@ export function CodeExampleButtons({examples, activeExample, onClick}: CodeExamp
|
|
|
88
79
|
)
|
|
89
80
|
}
|
|
90
81
|
|
|
91
|
-
function
|
|
82
|
+
function SampleButton({onClick, children, activeExample, example}: {
|
|
92
83
|
onClick: () => void,
|
|
93
84
|
children: React.ReactNode,
|
|
94
|
-
example:
|
|
95
|
-
activeExample:
|
|
85
|
+
example: Example,
|
|
86
|
+
activeExample: Example | null,
|
|
96
87
|
}) {
|
|
97
88
|
const markExampleAsActive = (activeExample?.description && activeExample?.description === example?.description) ||
|
|
98
89
|
(activeExample?.codeblock?.title && activeExample?.codeblock?.title === example.codeblock.title)
|
|
99
90
|
|
|
100
91
|
return <button
|
|
101
92
|
onClick={onClick}
|
|
102
|
-
className={`${
|
|
93
|
+
className={`${cn.CodeSampleButtonsButtonHost} ${markExampleAsActive && cn.CodeSampleButtonsButtonActive}`}
|
|
103
94
|
>
|
|
104
95
|
{children}
|
|
105
96
|
</button>
|