@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,2 +0,0 @@
1
- function t(t,n){var e={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&n.indexOf(r)<0&&(e[r]=t[r]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(t);o<r.length;o++)n.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(t,r[o])&&(e[r[o]]=t[r[o]])}return e}function n(t,n,e,r){return new(e||(e=Promise))((function(o,c){function p(t){try{f(r.next(t))}catch(t){c(t)}}function a(t){try{f(r.throw(t))}catch(t){c(t)}}function f(t){var n;t.done?o(t.value):(n=t.value,n instanceof e?n:new e((function(t){t(n)}))).then(p,a)}f((r=r.apply(t,n||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;export{t as _,n as a};
2
- //# sourceMappingURL=tslib.es6-DUrRPhZd.js.map
@@ -1,63 +0,0 @@
1
- import React, {forwardRef} from 'react'
2
- import type {ComponentProps, ReactElement} from 'react'
3
-
4
- import {css} from "@linaria/core";
5
-
6
- const $anchor = {
7
- host: css`
8
- color: #7051d4;
9
- `,
10
- };
11
-
12
- export type AnchorProps = Omit<ComponentProps<'a'>, 'ref'> & {
13
- newWindow?: boolean
14
- }
15
-
16
- // TODO: where react-router?
17
-
18
- export const Anchor = forwardRef<HTMLAnchorElement, AnchorProps>(function (
19
- {href = '', children, newWindow},
20
- // ref is used in <NavbarMenu />
21
- forwardedRef
22
- ): ReactElement {
23
- if (newWindow) {
24
- return (
25
- <a
26
- ref={forwardedRef}
27
- to={href}
28
- href={href}
29
- target="_blank"
30
- rel="noreferrer"
31
- className={$anchor.host}
32
- >
33
- {children}
34
- </a>
35
- )
36
- }
37
-
38
- if (!href) {
39
- return (
40
- <a
41
- ref={forwardedRef}
42
- to={href}
43
- href={href}
44
- className={$anchor.host}
45
- >
46
- {children}
47
- </a>
48
- )
49
- }
50
-
51
- return (
52
- <a
53
- ref={forwardedRef}
54
- to={href}
55
- href={href}
56
- className={$anchor.host}
57
- >
58
- {children}
59
- </a>
60
- )
61
- })
62
-
63
- Anchor.displayName = 'Anchor'
@@ -1,3 +0,0 @@
1
- export type {AnchorProps} from "./Anchor";
2
-
3
- export {Anchor} from "./Anchor";
@@ -1,21 +0,0 @@
1
- import React from "react"
2
- import {css} from "@linaria/core";
3
-
4
- const $content = {
5
- host: css`
6
- display: flex;
7
- flex-direction: column;
8
- //align-items: center;
9
- gap: 24px;
10
- `
11
- }
12
-
13
- export interface ContentProps {
14
- children: React.ReactNode
15
- }
16
-
17
- export function Content({children}: ContentProps) {
18
- return <div className={$content.host}>
19
- {children}
20
- </div>
21
- }
@@ -1,3 +0,0 @@
1
- export type {ContentProps} from "./Content";
2
-
3
- export {Content} from "./Content";
@@ -1,180 +0,0 @@
1
- import React from 'react'
2
-
3
- import {
4
- Badge,
5
- Blockquote,
6
- Callout,
7
- Code,
8
- Details,
9
- GuideCard,
10
- Heading,
11
- Hr,
12
- Table,
13
- TableV2,
14
- Tabs,
15
- Steps,
16
-
17
- IconCode,
18
- IconCustomEvent,
19
- IconFunnels,
20
- IconMetrics,
21
- IconSessionReplay,
22
- IconAlert,
23
- IconBrowser,
24
- IconREST,
25
- IconGraphQL,
26
- IconWebhooks,
27
- IconJSBrowser,
28
- IconJSNode,
29
- IconStorybook,
30
- IconReactRouter,
31
- IconNextJS,
32
- IconAppTemplate,
33
- IconQuote
34
- } from '../writer'
35
- import {CodeSample} from "../coder";
36
-
37
- import {Content as ContentComponent} from "./Content/index";
38
- import {Subtitle} from "./Subtitle";
39
- import {Anchor} from "./Anchor";
40
-
41
- const EXTERNAL_HREF_REGEX = /https?:\/\//
42
-
43
- const Link = ({href = '', className = "", ...props}) => (
44
- <Anchor
45
- href={href}
46
- newWindow={EXTERNAL_HREF_REGEX.test(href)}
47
- {...props}
48
- />
49
- )
50
-
51
- // TODO: options?
52
- export default function content() {
53
- return {
54
- ...stdContent(),
55
- ...writerContent(),
56
- ...helperContent(),
57
- ...iconContent(),
58
- ...coderContent(),
59
- ...directiveContent(),
60
- }
61
- }
62
-
63
- export function stdContent() {
64
- return {
65
- h1: (props) => <div><Heading id={props.children} {...props}/></div>,
66
- h2: props => <div><Heading id={props.children} size={2} {...props} /></div>,
67
- h3: props => <div><Heading id={props.children} size={3} {...props} /></div>,
68
- h4: props => <div><Heading id={props.children} size={4} {...props} /></div>,
69
- h5: props => <div><Heading id={props.children} size={5} {...props} /></div>,
70
- h6: props => <div><Heading id={props.children} size={6} {...props} /></div>,
71
- p: props => <p {...props} />,
72
-
73
- ul: props => (
74
- <ul{...props}>
75
- {props.children}
76
- </ul>
77
- ),
78
- ol: props => (
79
- <ol{...props}
80
- >
81
- {props.children}
82
- </ol>
83
- ),
84
- li: props => <li {...props} >
85
- {props.children}
86
- </li>,
87
-
88
- table: TableV2,
89
- tr: TableV2.Tr,
90
- th: TableV2.Th,
91
- td: TableV2.Td,
92
- td: (props) => <TableV2.Td {...props} >
93
- <TableV2.Cell>
94
- {props.children}
95
- </TableV2.Cell>
96
- </TableV2.Td>,
97
-
98
- code: Code,
99
- pre: props => {
100
- const lang = (props?.children?.props?.className || "").replace("language-", "") // TODO: better solution
101
-
102
- return <CodeSample
103
- name={lang}
104
- description={props?.children?.props?.meta}
105
- codeblocks={[
106
- {
107
- value: props?.children?.props?.children,
108
- lang: lang,
109
- meta: lang,
110
- }
111
- ]}
112
- size="full" // TODO: in the future configurable
113
- />
114
- },
115
- details: Details,
116
- blockquote: Blockquote,
117
-
118
- hr: Hr,
119
- a: Link,
120
- }
121
- }
122
-
123
- export function writerContent() {
124
- return {
125
- Callout,
126
- Details,
127
- GuideCard,
128
- Steps,
129
- Tabs,
130
- Table: TableV2,
131
- Badge,
132
- }
133
- }
134
-
135
- export function directiveContent() {
136
- return {
137
- // TODO: deprecate?
138
- DirectiveCodeSample: (props) => {
139
- return <CodeSample
140
- {...props}
141
- codeblocks={JSON.parse(props.codeblocks)}
142
- />
143
- }
144
- }
145
- }
146
-
147
- export function helperContent() {
148
- return {
149
- Content: ContentComponent,
150
- Subtitle
151
- }
152
- }
153
-
154
- export function iconContent() {
155
- return {
156
- IconSessionReplay,
157
- IconMetrics,
158
- IconFunnels,
159
- IconCode,
160
- IconCustomEvent,
161
- IconAlert,
162
- IconBrowser,
163
- IconREST,
164
- IconGraphQL,
165
- IconWebhooks,
166
- IconJSBrowser,
167
- IconJSNode,
168
- IconStorybook,
169
- IconReactRouter,
170
- IconNextJS,
171
- IconAppTemplate,
172
- IconQuote,
173
- }
174
- }
175
-
176
- export function coderContent() {
177
- return {
178
- CodeSample,
179
- }
180
- }
@@ -1,21 +0,0 @@
1
- import React from "react"
2
- import {css} from "@linaria/core";
3
-
4
- const cn = {
5
- Host: css`
6
- margin-top: -18px;
7
- font-size: 18px;
8
- color: #6e6e80;
9
- font-weight: 300;
10
- `
11
- }
12
-
13
- export interface SubtitleProps {
14
- children: React.ReactNode
15
- }
16
-
17
- export function Subtitle({children}: SubtitleProps) {
18
- return <div className={cn.Host}>
19
- {children}
20
- </div>
21
- }
@@ -1,3 +0,0 @@
1
- export type {SubtitleProps} from "./Subtitle";
2
-
3
- export {Subtitle} from "./Subtitle";
@@ -1,151 +0,0 @@
1
- import {css} from "@linaria/core";
2
-
3
- const globalPageGutter = '8px';
4
- export const globalHeaderHeight = '46px';
5
- const globalHeaderWarningHeight = "0px";
6
- const contentTopSpace = "12px";
7
-
8
- const globalHeaderHeightWithSub = '90px';
9
-
10
- const cubicMove = "cubic-bezier(.65, 0, .35, 1)";
11
- const sidebarWidth = "210px";
12
-
13
- // TODO: better solution - design tokens
14
- export const globals = css`
15
- :global() {
16
- :root {
17
- --xyd-navbar-height: ${globalHeaderHeight};
18
- --xyd-global-page-gutter: ${globalPageGutter};
19
- }
20
- }
21
- `;
22
-
23
- export const $layout = {
24
- host: css`
25
- width: 100%;
26
- `,
27
- header: css`
28
- display: flex;
29
- justify-content: space-between;
30
- align-items: center;
31
-
32
- position: fixed;
33
- top: ${globalHeaderWarningHeight};
34
- right: ${globalPageGutter};
35
- left: ${globalPageGutter};
36
-
37
- height: ${globalHeaderHeight};
38
- `,
39
- header$$sub: css`
40
- flex-direction: column;
41
- height: ${globalHeaderHeightWithSub};
42
- transition: transform 200ms;
43
- `,
44
- header$$hideMain: css`
45
- transform: translateY(calc(-${globalHeaderHeight} + 3px));
46
- `,
47
- main: css`
48
- position: fixed;
49
- top: calc(${globalHeaderHeight} + ${globalHeaderWarningHeight});
50
- bottom: ${globalPageGutter};
51
- left: ${globalPageGutter};
52
- right: ${globalPageGutter};
53
- }`,
54
- main$$sub: css`
55
- top: calc(${globalHeaderHeightWithSub} + ${globalHeaderWarningHeight});
56
- transition: top 200ms;
57
- `,
58
- sidebar: css`
59
- flex-direction: column;
60
- position: absolute;
61
- top: 0;
62
- left: 0;
63
- bottom: 0;
64
- right: 0;
65
- z-index: 101;
66
- width: ${sidebarWidth};
67
- border: 0;
68
- padding: ${contentTopSpace} 0 0;
69
- overflow: visible;
70
- background: none;
71
- border-radius: 0;
72
- opacity: 1;
73
- visibility: visible;
74
- transition: opacity .3s ${cubicMove};
75
- `,
76
- }
77
-
78
- export const $page = {
79
- host: css`
80
- position: absolute;
81
- top: ${contentTopSpace};
82
- right: 0;
83
- bottom: 0;
84
- z-index: 201;
85
- background: #fff;
86
-
87
- //border-radius: 8px;
88
- //border: 1px solid #ececf1;
89
-
90
- overflow: hidden;
91
- transition: opacity .3s ${cubicMove};
92
-
93
- left: ${sidebarWidth};
94
- `,
95
- scroll: css`
96
- //position: absolute;
97
- //top: 0;
98
- //right: 0;
99
- //bottom: 0;
100
- //left: 0;
101
- //overflow: auto;
102
-
103
- overflow: scroll;
104
- height: 100%;
105
-
106
- `,
107
- container: css`
108
- padding: 0;
109
- width: 100%;
110
- //position: relative; TODO: unset if during client render?
111
- min-height: 100%;
112
-
113
- max-width: 100%;
114
- margin: 0 auto;
115
- font-size: 15px;
116
- line-height: 24px;
117
- `,
118
- articleContainer: css`
119
- width: 980px;
120
- padding: 40px 56px;
121
- padding-top: 20px;
122
- max-width: 100%;
123
- margin: 0 auto;
124
- `,
125
- articleContainer$$fullWidth: css`
126
- width: 1200px;
127
- `,
128
-
129
- }
130
-
131
- export const $article = {
132
- host: css`
133
- display: flex;
134
- gap: 30px;
135
- width: 100%;
136
- align-items: flex-start;;
137
- `,
138
- content: css`
139
- flex: 1 1 0;
140
- overflow: hidden;
141
- `,
142
- nav: css`
143
- position: sticky;
144
- top: 30px;
145
- width: 180px;
146
- margin-top: 0;
147
- margin-left: 50px;
148
- padding-left: 16px;
149
- flex: none;
150
- `
151
- }
@@ -1,121 +0,0 @@
1
- import React, {useEffect, useState} from "react"
2
-
3
- import {$layout, $page, $article, globalHeaderHeight} from "./Layout.styles"
4
-
5
- export interface LayoutProps {
6
- header: React.ReactNode;
7
- aside: React.ReactNode;
8
- content: React.ReactNode;
9
- contentNav: React.ReactNode;
10
- subheader?: boolean;
11
- kind?: "fullwidth"
12
- }
13
-
14
- export function Layout(props: LayoutProps) {
15
- const [hideMainHeader, setHideMainHeader] = useState(false)
16
- const [scrollTop, setScrollTop] = useState(0)
17
- const [controlScrollPos, setControlScrollPos] = useState(0)
18
-
19
- useEffect(() => {
20
- if (scrollTop === controlScrollPos) {
21
- return
22
- }
23
-
24
- const checkpoint = parseInt(globalHeaderHeight, 10) / 2
25
- const diff = scrollTop - controlScrollPos
26
- const reversePosDiff = Math.abs(scrollTop - controlScrollPos)
27
-
28
- if (diff > checkpoint) {
29
- setHideMainHeader(true)
30
- } else if (reversePosDiff > checkpoint) {
31
- setHideMainHeader(false)
32
- }
33
- }, [
34
- scrollTop,
35
- controlScrollPos,
36
- ]);
37
-
38
- function onScroll(e: Event) {
39
- if (!(e.target instanceof HTMLElement)) {
40
- return
41
- }
42
-
43
- const scroll = e.target?.scrollTop
44
- setScrollTop(scroll)
45
- }
46
-
47
- function onScrollFinish(e: Event) {
48
- if (!(e.target instanceof HTMLElement)) {
49
- return
50
- }
51
-
52
- setControlScrollPos(e.target?.scrollTop)
53
- }
54
-
55
- // TODO: by ref?
56
- // TODO: MOVE SOMEWHERE ELSE BECAUSE IT DECREASE PERFORMANCE (RERENDER)
57
- useEffect(() => {
58
- // return // TODO: UNCOMMENT
59
-
60
- if (!props.subheader) {
61
- return
62
- }
63
-
64
- document.querySelector(`.${$page.scroll}`)?.addEventListener("scroll", onScroll)
65
- document.querySelector(`.${$page.scroll}`)?.addEventListener("scrollend", onScrollFinish)
66
-
67
- return () => {
68
- document.querySelector(`.${$page.scroll}`)?.removeEventListener("scroll", onScroll)
69
- document.querySelector(`.${$page.scroll}`)?.removeEventListener("scrollend", onScrollFinish)
70
- }
71
- }, []);
72
-
73
- return <div className={$layout.host}>
74
- <Layout.Header className={`
75
- ${props.subheader && $layout.header$$sub}
76
- ${hideMainHeader && $layout.header$$hideMain}
77
- `}>
78
- {props.header}
79
- </Layout.Header>
80
- <main className={`
81
- ${$layout.main}
82
- ${!hideMainHeader && props.subheader && $layout.main$$sub}
83
- `}>
84
- <aside className={$layout.sidebar}>
85
- {props.aside}
86
- </aside>
87
- <div className={$page.host}>
88
- <div className={$page.scroll}>
89
- <div className={$page.container}>
90
- <div className={`
91
- ${$page.articleContainer}
92
- ${props.kind == "fullwidth" && $page.articleContainer$$fullWidth}
93
- `}>
94
- <article className={$article.host}>
95
- <section className={$article.content}>
96
- {props.content}
97
- </section>
98
- {
99
- props.contentNav && <nav className={`
100
- ${$article.nav}
101
- `}>
102
- {props.contentNav}
103
- </nav>
104
- }
105
- </article>
106
- </div>
107
- </div>
108
- </div>
109
- </div>
110
- </main>
111
- </div>
112
- }
113
-
114
- Layout.Header = function LayoutHeader({className, children}: { className?: string, children: React.ReactNode }) {
115
- return <header className={`
116
- ${$layout.header}
117
- ${className}
118
- `}>
119
- {children}
120
- </header>
121
- }
@@ -1,52 +0,0 @@
1
- import {css} from "@linaria/core";
2
-
3
- export const $loader = {
4
- host: css`
5
- display: inline-flex;
6
- align-items: center;
7
- justify-content: center;
8
- `,
9
- dots: css`
10
- display: flex;
11
- gap: 4px;
12
- `,
13
- dot: css`
14
- width: 8px;
15
- height: 8px;
16
- background-color: currentColor;
17
- border-radius: 50%;
18
- animation: pulse 1.4s infinite ease-in-out;
19
- opacity: 0.6;
20
-
21
- &:nth-of-type(2) {
22
- animation-delay: 0.2s;
23
- }
24
-
25
- &:nth-of-type(3) {
26
- animation-delay: 0.4s;
27
- }
28
-
29
- @keyframes pulse {
30
- 0%, 80%, 100% {
31
- transform: scale(0.6);
32
- opacity: 0.4;
33
- }
34
- 40% {
35
- transform: scale(1);
36
- opacity: 1;
37
- }
38
- }
39
- `,
40
- $$small: css`
41
- .${$loader.dot} {
42
- width: 6px;
43
- height: 6px;
44
- }
45
- `,
46
- $$large: css`
47
- .${$loader.dot} {
48
- width: 12px;
49
- height: 12px;
50
- }
51
- `
52
- }
@@ -1,26 +0,0 @@
1
- import React from "react";
2
- import {$loader} from "./Loader.styles.tsx";
3
-
4
- export interface LoaderProps {
5
- size?: "small" | "medium" | "large";
6
- className?: string;
7
- }
8
-
9
- export function Loader({ size = "medium", className }: LoaderProps) {
10
- return (
11
- <div
12
- className={`
13
- ${$loader.host}
14
- ${size === "small" && $loader.$$small}
15
- ${size === "large" && $loader.$$large}
16
- ${className}
17
- `}
18
- >
19
- <div className={$loader.dots}>
20
- <div className={$loader.dot} />
21
- <div className={$loader.dot} />
22
- <div className={$loader.dot} />
23
- </div>
24
- </div>
25
- );
26
- }
package/src/ui/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from "./Loader/Loader";