@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.
Files changed (56) hide show
  1. package/.storybook/index.css +1 -27
  2. package/.storybook/preview.ts +1 -2
  3. package/CHANGELOG.md +1057 -0
  4. package/LICENSE +21 -0
  5. package/dist/Update-0XruJHjj-COLbZvRj.js +4 -0
  6. package/dist/Update-0XruJHjj-COLbZvRj.js.map +1 -0
  7. package/dist/Update-DKOAw8p9-COLbZvRj.js +4 -0
  8. package/dist/Update-DKOAw8p9-COLbZvRj.js.map +1 -0
  9. package/dist/index.css +43 -54
  10. package/dist/index.d.ts +30 -11
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/styles.css +89 -0
  14. package/dist/tokens.css +60 -0
  15. package/dist/xydPlugin.d.ts +5 -0
  16. package/dist/xydPlugin.js +2 -0
  17. package/dist/xydPlugin.js.map +1 -0
  18. package/index.ts +1 -1
  19. package/package.json +20 -21
  20. package/packages/xyd-plugin/SidebarItem.tsx +27 -0
  21. package/packages/xyd-plugin/index.ts +20 -0
  22. package/rollup.config.js +56 -12
  23. package/src/components/ApiRef/ApiRefItem/ApiRefItem.styles.tsx +95 -63
  24. package/src/components/ApiRef/ApiRefItem/ApiRefItem.tsx +507 -55
  25. package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.styles.tsx +186 -143
  26. package/src/components/ApiRef/ApiRefProperties/ApiRefProperties.tsx +584 -76
  27. package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.styles.tsx +19 -23
  28. package/src/components/ApiRef/ApiRefSamples/ApiRefSamples.tsx +39 -24
  29. package/src/components/Atlas/Atlas.styles.tsx +3 -5
  30. package/src/components/Atlas/Atlas.tsx +34 -21
  31. package/src/components/Atlas/AtlasContext.tsx +47 -0
  32. package/src/components/Atlas/AtlasDecorator.styles.ts +22 -0
  33. package/src/components/Atlas/AtlasDecorator.tsx +15 -0
  34. package/src/components/Atlas/AtlasLazy/AtlasLazy.styles.tsx +7 -8
  35. package/src/components/Atlas/AtlasLazy/AtlasLazy.tsx +4 -6
  36. package/src/components/Atlas/AtlasPrimary.tsx +21 -0
  37. package/src/components/Atlas/AtlasSecondary.tsx +148 -0
  38. package/src/components/Atlas/index.ts +6 -2
  39. package/src/components/Atlas/types.ts +11 -0
  40. package/src/components/Code/CodeSampleButtons/CodeSampleButtons.styles.tsx +56 -141
  41. package/src/components/Code/CodeSampleButtons/CodeSampleButtons.tsx +19 -28
  42. package/src/components/Code/index.ts +0 -4
  43. package/src/components/Icon/index.tsx +384 -0
  44. package/src/styles/styles.css +89 -0
  45. package/src/styles/tokens.css +60 -0
  46. package/src/utils/mdx.ts +0 -29
  47. package/tsconfig.json +9 -2
  48. package/types.d.ts +22 -0
  49. package/src/components/Code/CodeCopy/CodeCopy.style.tsx +0 -21
  50. package/src/components/Code/CodeCopy/CodeCopy.tsx +0 -32
  51. package/src/components/Code/CodeCopy/index.ts +0 -7
  52. package/src/components/Code/CodeSample/CodeSample.styles.tsx +0 -134
  53. package/src/components/Code/CodeSample/CodeSample.tsx +0 -149
  54. package/src/components/Code/CodeSample/index.ts +0 -8
  55. package/src/components/Code/CodeSample/withLocalStored.tsx +0 -52
  56. 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 $sample = {
4
- host: css`
5
- position: relative;
6
- max-width: 100%;
7
- `,
8
- container: css`
9
- display: flex;
10
- align-items: center;
11
- border-radius: 8px;
12
- //background-color: var(--atlas-comp-code-sample_buttons-container-background);
13
- background-color: #F3F4F6;
14
- `
15
- }
16
-
17
- export const $arrow = {
18
- host: css`
19
- padding: 8px;
20
- //background-color: var(--atlas-comp-code-sample_buttons-background--active);
21
- background-color: #ffffff;
22
- box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
23
- `,
24
- icon: css`
25
- width: 16px;
26
- height: 16px;
27
- `
28
- }
29
-
30
- export const $scroller = {
31
- host: css`
32
- overflow-x: auto;
33
- flex-grow: 1;
34
- `,
35
- container: css`
36
- display: inline-flex;
37
- gap: 4px;
38
-
39
- padding: 4px;
40
- margin-left: 4px;
41
- `
42
- }
43
-
44
- export const $button = {
45
- host: css`
46
- padding: 0.5rem 1rem;
47
-
48
- border-radius: 0.375rem;
49
- font-size: 0.875rem;
50
- line-height: 1.25rem;
51
- font-weight: 500;
52
- white-space: nowrap;
53
-
54
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
55
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
56
- transition-duration: 300ms;
57
-
58
- //color: var(--atlas-comp-code-sample_buttons-color);
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 {MDXReference, mdxValue} from "@/utils/mdx";
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: MDXReference<Example[]>
17
-
18
- activeExample: MDXReference<Example> | null
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={$sample.host}>
51
- <div className={$sample.container}>
41
+ <div className={cn.CodeSampleButtonsHost}>
42
+ <div className={cn.CodeSampleButtonsContainer}>
52
43
  {showLeftArrow && (
53
44
  <button
54
45
  onClick={() => scroll('left')}
55
- className={$arrow.host}
46
+ className={cn.CodeSampleButtonsArrowHost}
56
47
  >
57
- <ChevronLeft className={$arrow.icon}/>
48
+ <ChevronLeft className={cn.CodeSampleButtonsArrowIcon}/>
58
49
  </button>
59
50
  )}
60
51
  <div
61
52
  ref={scrollContainerRef}
62
53
  onScroll={handleScroll}
63
- className={$scroller.host}
54
+ className={cn.CodeSampleButtonsScrollerHost}
64
55
  >
65
- <div className={$scroller.container}>
56
+ <div className={cn.CodeSampleButtonsScrollerContainer}>
66
57
  {examples?.map((example) => (
67
- <$SampleButton
58
+ <SampleButton
68
59
  key={example.codeblock.title}
69
60
  onClick={() => onClick(example)}
70
61
  example={example}
71
62
  activeExample={activeExample}
72
63
  >
73
- {mdxValue(example.codeblock.title || null)}
74
- </$SampleButton>
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={$arrow.host}
72
+ className={cn.CodeSampleButtonsArrowHost}
82
73
  >
83
- <ChevronRight className={$arrow.icon}/>
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 $SampleButton({onClick, children, activeExample, example}: {
82
+ function SampleButton({onClick, children, activeExample, example}: {
92
83
  onClick: () => void,
93
84
  children: React.ReactNode,
94
- example: MDXReference<Example>,
95
- activeExample: MDXReference<Example> | null,
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={`${$button.host} ${markExampleAsActive && $button.$$active}`}
93
+ className={`${cn.CodeSampleButtonsButtonHost} ${markExampleAsActive && cn.CodeSampleButtonsButtonActive}`}
103
94
  >
104
95
  {children}
105
96
  </button>
@@ -1,6 +1,2 @@
1
- export * from "./CodeCopy";
2
-
3
- export * from "./CodeSample";
4
-
5
1
  export * from "./CodeSampleButtons";
6
2