cherry-styled-components 0.1.0-1
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/.DS_Store +0 -0
- package/.eslintrc.json +3 -0
- package/.gitignore +43 -0
- package/.next/app-build-manifest.json +15 -0
- package/.next/build-manifest.json +19 -0
- package/.next/cache/.tsbuildinfo +1 -0
- package/.next/cache/eslint/.cache_hc9deq +1 -0
- package/.next/cache/webpack/client-development/0.pack.gz +0 -0
- package/.next/cache/webpack/client-development/1.pack.gz +0 -0
- package/.next/cache/webpack/client-development/10.pack.gz +0 -0
- package/.next/cache/webpack/client-development/11.pack.gz +0 -0
- package/.next/cache/webpack/client-development/12.pack.gz +0 -0
- package/.next/cache/webpack/client-development/13.pack.gz +0 -0
- package/.next/cache/webpack/client-development/14.pack.gz +0 -0
- package/.next/cache/webpack/client-development/15.pack.gz +0 -0
- package/.next/cache/webpack/client-development/16.pack.gz +0 -0
- package/.next/cache/webpack/client-development/17.pack.gz +0 -0
- package/.next/cache/webpack/client-development/18.pack.gz +0 -0
- package/.next/cache/webpack/client-development/19.pack.gz +0 -0
- package/.next/cache/webpack/client-development/2.pack.gz +0 -0
- package/.next/cache/webpack/client-development/20.pack.gz +0 -0
- package/.next/cache/webpack/client-development/21.pack.gz +0 -0
- package/.next/cache/webpack/client-development/22.pack.gz +0 -0
- package/.next/cache/webpack/client-development/23.pack.gz +0 -0
- package/.next/cache/webpack/client-development/3.pack.gz +0 -0
- package/.next/cache/webpack/client-development/4.pack.gz +0 -0
- package/.next/cache/webpack/client-development/5.pack.gz +0 -0
- package/.next/cache/webpack/client-development/6.pack.gz +0 -0
- package/.next/cache/webpack/client-development/7.pack.gz +0 -0
- package/.next/cache/webpack/client-development/8.pack.gz +0 -0
- package/.next/cache/webpack/client-development/9.pack.gz +0 -0
- package/.next/cache/webpack/client-development/index.pack.gz +0 -0
- package/.next/cache/webpack/client-development/index.pack.gz.old +0 -0
- package/.next/cache/webpack/client-development-fallback/0.pack.gz +0 -0
- package/.next/cache/webpack/client-development-fallback/1.pack.gz +0 -0
- package/.next/cache/webpack/client-development-fallback/index.pack.gz +0 -0
- package/.next/cache/webpack/client-development-fallback/index.pack.gz.old +0 -0
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/1.pack +0 -0
- package/.next/cache/webpack/client-production/2.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack.old +0 -0
- package/.next/cache/webpack/server-development/0.pack.gz +0 -0
- package/.next/cache/webpack/server-development/1.pack.gz +0 -0
- package/.next/cache/webpack/server-development/10.pack.gz +0 -0
- package/.next/cache/webpack/server-development/11.pack.gz +0 -0
- package/.next/cache/webpack/server-development/12.pack.gz +0 -0
- package/.next/cache/webpack/server-development/13.pack.gz +0 -0
- package/.next/cache/webpack/server-development/14.pack.gz +0 -0
- package/.next/cache/webpack/server-development/15.pack.gz +0 -0
- package/.next/cache/webpack/server-development/16.pack.gz +0 -0
- package/.next/cache/webpack/server-development/17.pack.gz +0 -0
- package/.next/cache/webpack/server-development/18.pack.gz +0 -0
- package/.next/cache/webpack/server-development/19.pack.gz +0 -0
- package/.next/cache/webpack/server-development/2.pack.gz +0 -0
- package/.next/cache/webpack/server-development/20.pack.gz +0 -0
- package/.next/cache/webpack/server-development/21.pack.gz +0 -0
- package/.next/cache/webpack/server-development/22.pack.gz +0 -0
- package/.next/cache/webpack/server-development/23.pack.gz +0 -0
- package/.next/cache/webpack/server-development/24.pack.gz +0 -0
- package/.next/cache/webpack/server-development/25.pack.gz +0 -0
- package/.next/cache/webpack/server-development/26.pack.gz +0 -0
- package/.next/cache/webpack/server-development/27.pack.gz +0 -0
- package/.next/cache/webpack/server-development/28.pack.gz +0 -0
- package/.next/cache/webpack/server-development/29.pack.gz +0 -0
- package/.next/cache/webpack/server-development/3.pack.gz +0 -0
- package/.next/cache/webpack/server-development/30.pack.gz +0 -0
- package/.next/cache/webpack/server-development/31.pack.gz +0 -0
- package/.next/cache/webpack/server-development/32.pack.gz +0 -0
- package/.next/cache/webpack/server-development/4.pack.gz +0 -0
- package/.next/cache/webpack/server-development/5.pack.gz +0 -0
- package/.next/cache/webpack/server-development/6.pack.gz +0 -0
- package/.next/cache/webpack/server-development/7.pack.gz +0 -0
- package/.next/cache/webpack/server-development/8.pack.gz +0 -0
- package/.next/cache/webpack/server-development/9.pack.gz +0 -0
- package/.next/cache/webpack/server-development/index.pack.gz +0 -0
- package/.next/cache/webpack/server-development/index.pack.gz.old +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/1.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack.old +0 -0
- package/.next/package.json +1 -0
- package/.next/react-loadable-manifest.json +1 -0
- package/.next/server/app/page.js +1072 -0
- package/.next/server/app/page_client-reference-manifest.js +1 -0
- package/.next/server/app-paths-manifest.json +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/next-font-manifest.js +1 -0
- package/.next/server/next-font-manifest.json +1 -0
- package/.next/server/pages-manifest.json +1 -0
- package/.next/server/server-reference-manifest.js +1 -0
- package/.next/server/server-reference-manifest.json +5 -0
- package/.next/server/vendor-chunks/@emotion.js +45 -0
- package/.next/server/vendor-chunks/@swc.js +75 -0
- package/.next/server/vendor-chunks/next.js +2197 -0
- package/.next/server/vendor-chunks/shallowequal.js +24 -0
- package/.next/server/vendor-chunks/styled-components.js +35 -0
- package/.next/server/vendor-chunks/stylis.js +85 -0
- package/.next/server/webpack-runtime.js +220 -0
- package/.next/static/chunks/app/layout.js +695 -0
- package/.next/static/chunks/app/page.js +28 -0
- package/.next/static/chunks/app-pages-internals.js +105 -0
- package/.next/static/chunks/main-app.js +1893 -0
- package/.next/static/chunks/polyfills.js +1 -0
- package/.next/static/chunks/webpack.js +1416 -0
- package/.next/static/css/app/layout.css +69 -0
- package/.next/static/development/_buildManifest.js +1 -0
- package/.next/static/development/_ssgManifest.js +1 -0
- package/.next/static/media/05a31a2ca4975f99-s.woff2 +0 -0
- package/.next/static/media/513657b02c5c193f-s.woff2 +0 -0
- package/.next/static/media/51ed15f9841b9f9d-s.woff2 +0 -0
- package/.next/static/media/c9a5bc6a7c948fb0-s.p.woff2 +0 -0
- package/.next/static/media/d6b16ce4a6175f26-s.woff2 +0 -0
- package/.next/static/media/ec159349637c90ad-s.woff2 +0 -0
- package/.next/static/media/fd4db3eb5472fc27-s.woff2 +0 -0
- package/.next/static/webpack/633457081244afec._.hot-update.json +1 -0
- package/.next/trace +19 -0
- package/.next/types/app/layout.ts +79 -0
- package/.next/types/app/page.ts +79 -0
- package/.next/types/package.json +1 -0
- package/.prettierrc +11 -0
- package/.vscode/settings.json +67 -0
- package/README.md +15 -0
- package/next-env.d.ts +5 -0
- package/next.config.mjs +8 -0
- package/package.json +51 -0
- package/src/app/components/box.tsx +16 -0
- package/src/app/components/button.tsx +177 -0
- package/src/app/components/col.tsx +39 -0
- package/src/app/components/container.tsx +55 -0
- package/src/app/components/flex.tsx +90 -0
- package/src/app/components/grid.tsx +60 -0
- package/src/app/components/index.ts +15 -0
- package/src/app/components/input.tsx +254 -0
- package/src/app/components/max-width.tsx +43 -0
- package/src/app/components/range.tsx +223 -0
- package/src/app/components/select.tsx +122 -0
- package/src/app/components/space.tsx +54 -0
- package/src/app/components/styled-components/index.ts +2 -0
- package/src/app/components/styled-components/registry.tsx +26 -0
- package/src/app/components/styled-components/theme-provider.tsx +21 -0
- package/src/app/components/textarea.tsx +98 -0
- package/src/app/components/toggle.tsx +148 -0
- package/src/app/components/utils/global.tsx +78 -0
- package/src/app/components/utils/icons.tsx +168 -0
- package/src/app/components/utils/index.ts +5 -0
- package/src/app/components/utils/mixins.tsx +107 -0
- package/src/app/components/utils/theme.ts +241 -0
- package/src/app/components/utils/typography.tsx +204 -0
- package/src/app/layout.tsx +19 -0
- package/src/app/page.tsx +14 -0
- package/tsconfig.json +29 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/types/.next/types/app/layout.d.ts +9 -0
- package/types/.next/types/app/page.d.ts +9 -0
- package/types/src/app/components/box.d.ts +4 -0
- package/types/src/app/components/button.d.ts +17 -0
- package/types/src/app/components/col.d.ts +16 -0
- package/types/src/app/components/container.d.ts +19 -0
- package/types/src/app/components/flex.d.ts +27 -0
- package/types/src/app/components/grid.d.ts +24 -0
- package/types/src/app/components/index.d.ts +15 -0
- package/types/src/app/components/input.d.ts +15 -0
- package/types/src/app/components/max-width.d.ts +13 -0
- package/types/src/app/components/range.d.ts +13 -0
- package/types/src/app/components/select.d.ts +14 -0
- package/types/src/app/components/space.d.ts +14 -0
- package/types/src/app/components/styled-components/index.d.ts +2 -0
- package/types/src/app/components/styled-components/registry.d.ts +5 -0
- package/types/src/app/components/styled-components/theme-provider.d.ts +6 -0
- package/types/src/app/components/textarea.d.ts +13 -0
- package/types/src/app/components/toggle.d.ts +14 -0
- package/types/src/app/components/utils/global.d.ts +3 -0
- package/types/src/app/components/utils/icons.d.ts +9 -0
- package/types/src/app/components/utils/index.d.ts +5 -0
- package/types/src/app/components/utils/mixins.d.ts +11 -0
- package/types/src/app/components/utils/theme.d.ts +227 -0
- package/types/src/app/components/utils/typography.d.ts +20 -0
- package/types/src/app/layout.d.ts +2 -0
- package/types/src/app/page.d.ts +4 -0
- package/types/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// File: /Users/luan/Developer/cherry-styled-components/src/app/layout.tsx
|
|
2
|
+
import * as entry from '../../../src/app/layout.js'
|
|
3
|
+
import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'
|
|
4
|
+
|
|
5
|
+
type TEntry = typeof import('../../../src/app/layout.js')
|
|
6
|
+
|
|
7
|
+
// Check that the entry is a valid entry
|
|
8
|
+
checkFields<Diff<{
|
|
9
|
+
default: Function
|
|
10
|
+
config?: {}
|
|
11
|
+
generateStaticParams?: Function
|
|
12
|
+
revalidate?: RevalidateRange<TEntry> | false
|
|
13
|
+
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
|
|
14
|
+
dynamicParams?: boolean
|
|
15
|
+
fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
|
|
16
|
+
preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
|
|
17
|
+
runtime?: 'nodejs' | 'experimental-edge' | 'edge'
|
|
18
|
+
maxDuration?: number
|
|
19
|
+
|
|
20
|
+
metadata?: any
|
|
21
|
+
generateMetadata?: Function
|
|
22
|
+
viewport?: any
|
|
23
|
+
generateViewport?: Function
|
|
24
|
+
|
|
25
|
+
}, TEntry, ''>>()
|
|
26
|
+
|
|
27
|
+
// Check the prop type of the entry function
|
|
28
|
+
checkFields<Diff<LayoutProps, FirstArg<TEntry['default']>, 'default'>>()
|
|
29
|
+
|
|
30
|
+
// Check the arguments and return type of the generateMetadata function
|
|
31
|
+
if ('generateMetadata' in entry) {
|
|
32
|
+
checkFields<Diff<LayoutProps, FirstArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()
|
|
33
|
+
checkFields<Diff<ResolvingMetadata, SecondArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Check the arguments and return type of the generateViewport function
|
|
37
|
+
if ('generateViewport' in entry) {
|
|
38
|
+
checkFields<Diff<LayoutProps, FirstArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()
|
|
39
|
+
checkFields<Diff<ResolvingViewport, SecondArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check the arguments and return type of the generateStaticParams function
|
|
43
|
+
if ('generateStaticParams' in entry) {
|
|
44
|
+
checkFields<Diff<{ params: PageParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
|
|
45
|
+
checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type PageParams = any
|
|
49
|
+
export interface PageProps {
|
|
50
|
+
params?: any
|
|
51
|
+
searchParams?: any
|
|
52
|
+
}
|
|
53
|
+
export interface LayoutProps {
|
|
54
|
+
children?: React.ReactNode
|
|
55
|
+
|
|
56
|
+
params?: any
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// =============
|
|
60
|
+
// Utility types
|
|
61
|
+
type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
|
|
62
|
+
|
|
63
|
+
// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
|
|
64
|
+
type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
|
|
65
|
+
type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
|
|
66
|
+
|
|
67
|
+
type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
|
|
68
|
+
type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
|
|
69
|
+
type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
function checkFields<_ extends { [k in keyof any]: never }>() {}
|
|
74
|
+
|
|
75
|
+
// https://github.com/sindresorhus/type-fest
|
|
76
|
+
type Numeric = number | bigint
|
|
77
|
+
type Zero = 0 | 0n
|
|
78
|
+
type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
|
|
79
|
+
type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// File: /Users/luan/Developer/cherry-styled-components/src/app/page.tsx
|
|
2
|
+
import * as entry from '../../../src/app/page.js'
|
|
3
|
+
import type { ResolvingMetadata, ResolvingViewport } from 'next/dist/lib/metadata/types/metadata-interface.js'
|
|
4
|
+
|
|
5
|
+
type TEntry = typeof import('../../../src/app/page.js')
|
|
6
|
+
|
|
7
|
+
// Check that the entry is a valid entry
|
|
8
|
+
checkFields<Diff<{
|
|
9
|
+
default: Function
|
|
10
|
+
config?: {}
|
|
11
|
+
generateStaticParams?: Function
|
|
12
|
+
revalidate?: RevalidateRange<TEntry> | false
|
|
13
|
+
dynamic?: 'auto' | 'force-dynamic' | 'error' | 'force-static'
|
|
14
|
+
dynamicParams?: boolean
|
|
15
|
+
fetchCache?: 'auto' | 'force-no-store' | 'only-no-store' | 'default-no-store' | 'default-cache' | 'only-cache' | 'force-cache'
|
|
16
|
+
preferredRegion?: 'auto' | 'global' | 'home' | string | string[]
|
|
17
|
+
runtime?: 'nodejs' | 'experimental-edge' | 'edge'
|
|
18
|
+
maxDuration?: number
|
|
19
|
+
|
|
20
|
+
metadata?: any
|
|
21
|
+
generateMetadata?: Function
|
|
22
|
+
viewport?: any
|
|
23
|
+
generateViewport?: Function
|
|
24
|
+
|
|
25
|
+
}, TEntry, ''>>()
|
|
26
|
+
|
|
27
|
+
// Check the prop type of the entry function
|
|
28
|
+
checkFields<Diff<PageProps, FirstArg<TEntry['default']>, 'default'>>()
|
|
29
|
+
|
|
30
|
+
// Check the arguments and return type of the generateMetadata function
|
|
31
|
+
if ('generateMetadata' in entry) {
|
|
32
|
+
checkFields<Diff<PageProps, FirstArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()
|
|
33
|
+
checkFields<Diff<ResolvingMetadata, SecondArg<MaybeField<TEntry, 'generateMetadata'>>, 'generateMetadata'>>()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// Check the arguments and return type of the generateViewport function
|
|
37
|
+
if ('generateViewport' in entry) {
|
|
38
|
+
checkFields<Diff<PageProps, FirstArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()
|
|
39
|
+
checkFields<Diff<ResolvingViewport, SecondArg<MaybeField<TEntry, 'generateViewport'>>, 'generateViewport'>>()
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check the arguments and return type of the generateStaticParams function
|
|
43
|
+
if ('generateStaticParams' in entry) {
|
|
44
|
+
checkFields<Diff<{ params: PageParams }, FirstArg<MaybeField<TEntry, 'generateStaticParams'>>, 'generateStaticParams'>>()
|
|
45
|
+
checkFields<Diff<{ __tag__: 'generateStaticParams', __return_type__: any[] | Promise<any[]> }, { __tag__: 'generateStaticParams', __return_type__: ReturnType<MaybeField<TEntry, 'generateStaticParams'>> }>>()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
type PageParams = any
|
|
49
|
+
export interface PageProps {
|
|
50
|
+
params?: any
|
|
51
|
+
searchParams?: any
|
|
52
|
+
}
|
|
53
|
+
export interface LayoutProps {
|
|
54
|
+
children?: React.ReactNode
|
|
55
|
+
|
|
56
|
+
params?: any
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// =============
|
|
60
|
+
// Utility types
|
|
61
|
+
type RevalidateRange<T> = T extends { revalidate: any } ? NonNegative<T['revalidate']> : never
|
|
62
|
+
|
|
63
|
+
// If T is unknown or any, it will be an empty {} type. Otherwise, it will be the same as Omit<T, keyof Base>.
|
|
64
|
+
type OmitWithTag<T, K extends keyof any, _M> = Omit<T, K>
|
|
65
|
+
type Diff<Base, T extends Base, Message extends string = ''> = 0 extends (1 & T) ? {} : OmitWithTag<T, keyof Base, Message>
|
|
66
|
+
|
|
67
|
+
type FirstArg<T extends Function> = T extends (...args: [infer T, any]) => any ? unknown extends T ? any : T : never
|
|
68
|
+
type SecondArg<T extends Function> = T extends (...args: [any, infer T]) => any ? unknown extends T ? any : T : never
|
|
69
|
+
type MaybeField<T, K extends string> = T extends { [k in K]: infer G } ? G extends Function ? G : never : never
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
function checkFields<_ extends { [k in keyof any]: never }>() {}
|
|
74
|
+
|
|
75
|
+
// https://github.com/sindresorhus/type-fest
|
|
76
|
+
type Numeric = number | bigint
|
|
77
|
+
type Zero = 0 | 0n
|
|
78
|
+
type Negative<T extends Numeric> = T extends Zero ? never : `${T}` extends `-${string}` ? T : never
|
|
79
|
+
type NonNegative<T extends Numeric> = T extends Zero ? T : Negative<T> extends never ? T : '__invalid_negative_number__'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type": "module"}
|
package/.prettierrc
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"search.exclude": {
|
|
3
|
+
"# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.": true,
|
|
4
|
+
"# dependencies": true,
|
|
5
|
+
"/node_modules": true,
|
|
6
|
+
"/.pnp": true,
|
|
7
|
+
".pnp.js": true,
|
|
8
|
+
".yarn/install-state.gz": true,
|
|
9
|
+
"# testing": true,
|
|
10
|
+
"/coverage": true,
|
|
11
|
+
"# next.js": true,
|
|
12
|
+
"/.next/": true,
|
|
13
|
+
"/out/": true,
|
|
14
|
+
".next": true,
|
|
15
|
+
"# production": true,
|
|
16
|
+
"/build": true,
|
|
17
|
+
"# misc": true,
|
|
18
|
+
".DS_Store": true,
|
|
19
|
+
"*.pem": true,
|
|
20
|
+
"# debug": true,
|
|
21
|
+
"npm-debug.log*": true,
|
|
22
|
+
"yarn-debug.log*": true,
|
|
23
|
+
"yarn-error.log*": true,
|
|
24
|
+
"# local env files": true,
|
|
25
|
+
".env*.local": true,
|
|
26
|
+
"# vercel": true,
|
|
27
|
+
".vercel": true,
|
|
28
|
+
"# typescript": true,
|
|
29
|
+
"*.tsbuildinfo": true,
|
|
30
|
+
"next-env.d.ts": true,
|
|
31
|
+
".env": true,
|
|
32
|
+
".vscode": true
|
|
33
|
+
},
|
|
34
|
+
"files.exclude": {
|
|
35
|
+
"# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.": true,
|
|
36
|
+
"# dependencies": true,
|
|
37
|
+
"/node_modules": true,
|
|
38
|
+
"/.pnp": true,
|
|
39
|
+
".pnp.js": true,
|
|
40
|
+
".yarn/install-state.gz": true,
|
|
41
|
+
"# testing": true,
|
|
42
|
+
"/coverage": true,
|
|
43
|
+
"# next.js": true,
|
|
44
|
+
"/.next/": true,
|
|
45
|
+
"/out/": true,
|
|
46
|
+
".next": true,
|
|
47
|
+
"# production": true,
|
|
48
|
+
"/build": true,
|
|
49
|
+
"# misc": true,
|
|
50
|
+
".DS_Store": true,
|
|
51
|
+
"*.pem": true,
|
|
52
|
+
"# debug": true,
|
|
53
|
+
"npm-debug.log*": true,
|
|
54
|
+
"yarn-debug.log*": true,
|
|
55
|
+
"yarn-error.log*": true,
|
|
56
|
+
"# local env files": true,
|
|
57
|
+
".env*.local": true,
|
|
58
|
+
"# vercel": true,
|
|
59
|
+
".vercel": true,
|
|
60
|
+
"# typescript": true,
|
|
61
|
+
"*.tsbuildinfo": true,
|
|
62
|
+
"next-env.d.ts": true,
|
|
63
|
+
".env": true,
|
|
64
|
+
".vscode": true
|
|
65
|
+
},
|
|
66
|
+
"svg.preview.background": "editor"
|
|
67
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Cherry Design System
|
|
2
|
+
## Introduction
|
|
3
|
+
The **Cherry Design System** is a versatile foundation for your projects. As a starting point, it provides a clean slate—a white label—upon which you can build and extend. Whether you’re creating a web application, mobile app, or any other digital interface, Cherry defines the essential components you need.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
- **White Label Base**: Cherry serves as a neutral canvas, allowing you to customize and brand it according to your project’s requirements.
|
|
7
|
+
- **React Components**: We’ve carefully curated the fundamental building blocks for a typical interface. These include components, typography, color schemes, and layout guidelines.
|
|
8
|
+
- **Theming Support**: Cherry embraces theming, enabling you to adapt the design system to different contexts while maintaining consistency.
|
|
9
|
+
Sanity and Consistency: By adhering to Cherry’s guidelines, you’ll create a cohesive user experience across various screens and interactions.
|
|
10
|
+
- **Open Source**: Cherry takes it a step further by providing ready-to-use source code for the **Figma designs**. This means you not only get the visual templates but also the actual implementation. It’s like having a bridge between your design tool and your codebase.
|
|
11
|
+
|
|
12
|
+
Getting Started
|
|
13
|
+
To begin using Cherry, refer to our comprehensive documentation at [cherry.design](https://cherry.design/). Explore the components, study the design principles, and integrate them seamlessly into your project. Remember, Cherry is not just a set of rules—it’s a toolkit that empowers you to create delightful user interfaces.
|
|
14
|
+
|
|
15
|
+
Happy designing! 🍒
|
package/next-env.d.ts
ADDED
package/next.config.mjs
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "cherry-styled-components",
|
|
3
|
+
"version": "0.1.0-1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"main": "src/app/components/index.ts",
|
|
6
|
+
"files": [
|
|
7
|
+
"**/*"
|
|
8
|
+
],
|
|
9
|
+
"types": "types/src/app/components/index.d.ts",
|
|
10
|
+
"author": "Luan Gjokaj <luan@riangle.com>",
|
|
11
|
+
"homepage": "https://cherry.design",
|
|
12
|
+
"repository": "https://github.com/cherry-design-system/styled-components",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"cherry",
|
|
16
|
+
"react",
|
|
17
|
+
"components",
|
|
18
|
+
"css",
|
|
19
|
+
"framework",
|
|
20
|
+
"design",
|
|
21
|
+
"design system",
|
|
22
|
+
"styled-components"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"dev": "next dev",
|
|
26
|
+
"build": "next build",
|
|
27
|
+
"build:types": "rimraf ./types && tsc",
|
|
28
|
+
"start": "next start",
|
|
29
|
+
"lint": "next lint",
|
|
30
|
+
"format": "prettier --write \"./src/**/*.{js,json,ts,tsx}\" \"!.node_modules/**\""
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"next": "14.1.3",
|
|
34
|
+
"react": "^18",
|
|
35
|
+
"react-dom": "^18"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@mdx-js/loader": "^3.0.1",
|
|
39
|
+
"@next/mdx": "^14.1.3",
|
|
40
|
+
"@types/node": "^20",
|
|
41
|
+
"@types/react": "^18",
|
|
42
|
+
"@types/react-dom": "^18",
|
|
43
|
+
"eslint": "^8",
|
|
44
|
+
"eslint-config-next": "14.1.3",
|
|
45
|
+
"polished": "^4.3.1",
|
|
46
|
+
"prettier": "^3.2.5",
|
|
47
|
+
"rimraf": "^5.0.5",
|
|
48
|
+
"styled-components": "^6.1.8",
|
|
49
|
+
"typescript": "^5"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Container, ContainerProps } from "./container";
|
|
5
|
+
|
|
6
|
+
const StylesBox = styled(Container)<ContainerProps>`
|
|
7
|
+
background: ${({ theme }) => theme.colors.light};
|
|
8
|
+
border-radius: ${({ theme }) => theme.spacing.radius.lg};
|
|
9
|
+
border: solid 1px ${({ theme }) => theme.colors.grayLight};
|
|
10
|
+
`;
|
|
11
|
+
|
|
12
|
+
function Box({ ...props }: ContainerProps) {
|
|
13
|
+
return <StylesBox {...props}>{props.children}</StylesBox>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export { Box };
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import styled, { css } from "styled-components";
|
|
5
|
+
import {
|
|
6
|
+
Theme,
|
|
7
|
+
theme as localTheme,
|
|
8
|
+
formElementHeightStyles,
|
|
9
|
+
resetButton,
|
|
10
|
+
} from "./utils";
|
|
11
|
+
|
|
12
|
+
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
$variant?: "primary" | "secondary" | "tertiary";
|
|
15
|
+
$size?: "default" | "big";
|
|
16
|
+
$outline?: boolean;
|
|
17
|
+
$fullWidth?: boolean;
|
|
18
|
+
theme?: Theme;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
interface LinkButtonProps extends ButtonProps {
|
|
22
|
+
href: string;
|
|
23
|
+
target?: "_blank" | "_self" | "_parent" | "_top";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const buttonStyles = (
|
|
27
|
+
theme: Theme,
|
|
28
|
+
$variant?: "primary" | "secondary" | "tertiary",
|
|
29
|
+
$size?: "default" | "big",
|
|
30
|
+
$outline?: boolean,
|
|
31
|
+
$fullWidth?: boolean,
|
|
32
|
+
disabled?: boolean,
|
|
33
|
+
) => css`
|
|
34
|
+
${resetButton};
|
|
35
|
+
font-family: inherit;
|
|
36
|
+
display: inline-block;
|
|
37
|
+
padding: 15px 30px;
|
|
38
|
+
border-radius: 100px;
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
white-space: nowrap;
|
|
41
|
+
hyphens: auto;
|
|
42
|
+
color: ${theme.colors.light};
|
|
43
|
+
text-decoration: none;
|
|
44
|
+
transition: all 0.3s ease;
|
|
45
|
+
|
|
46
|
+
${!disabled &&
|
|
47
|
+
$variant === "primary" &&
|
|
48
|
+
css`
|
|
49
|
+
color: ${$outline ? theme.colors.primary : theme.colors.light};
|
|
50
|
+
background: ${$outline ? "transparent" : theme.colors.primary};
|
|
51
|
+
border: solid 2px ${theme.colors.primary};
|
|
52
|
+
box-shadow: 0 0 0 0px ${theme.colors.primary};
|
|
53
|
+
|
|
54
|
+
@media (hover: hover) {
|
|
55
|
+
&:hover {
|
|
56
|
+
background: ${$outline
|
|
57
|
+
? "transparent"
|
|
58
|
+
: theme.colors.primaryDark};
|
|
59
|
+
border-color: ${theme.colors.primaryDark};
|
|
60
|
+
${$outline && `color: ${theme.colors.primaryDark}`};
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&:focus {
|
|
65
|
+
box-shadow: 0 0 0 4px ${theme.colors.primaryLight};
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&:active {
|
|
69
|
+
box-shadow: 0 0 0 2px ${theme.colors.primaryLight};
|
|
70
|
+
}
|
|
71
|
+
`}
|
|
72
|
+
|
|
73
|
+
${!disabled &&
|
|
74
|
+
$variant === "secondary" &&
|
|
75
|
+
css`
|
|
76
|
+
color: ${$outline ? theme.colors.secondary : theme.colors.light};
|
|
77
|
+
background: ${$outline ? "transparent" : theme.colors.secondary};
|
|
78
|
+
border: solid 2px ${theme.colors.secondary};
|
|
79
|
+
box-shadow: 0 0 0 0px ${theme.colors.secondary};
|
|
80
|
+
|
|
81
|
+
@media (hover: hover) {
|
|
82
|
+
&:hover {
|
|
83
|
+
background: ${$outline
|
|
84
|
+
? "transparent"
|
|
85
|
+
: theme.colors.secondaryDark};
|
|
86
|
+
border-color: ${theme.colors.secondaryDark};
|
|
87
|
+
${$outline && `color: ${theme.colors.secondaryDark}`};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&:focus {
|
|
92
|
+
box-shadow: 0 0 0 4px ${theme.colors.secondaryLight};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:active {
|
|
96
|
+
box-shadow: 0 0 0 2px ${theme.colors.secondaryLight};
|
|
97
|
+
}
|
|
98
|
+
`}
|
|
99
|
+
|
|
100
|
+
${!disabled &&
|
|
101
|
+
$variant === "tertiary" &&
|
|
102
|
+
css`
|
|
103
|
+
color: ${$outline ? theme.colors.tertiary : theme.colors.light};
|
|
104
|
+
background: ${$outline ? "transparent" : theme.colors.tertiary};
|
|
105
|
+
border: solid 2px ${theme.colors.tertiary};
|
|
106
|
+
box-shadow: 0 0 0 0px ${theme.colors.tertiary};
|
|
107
|
+
|
|
108
|
+
@media (hover: hover) {
|
|
109
|
+
&:hover {
|
|
110
|
+
background: ${$outline
|
|
111
|
+
? "transparent"
|
|
112
|
+
: theme.colors.tertiaryDark};
|
|
113
|
+
border-color: ${theme.colors.tertiaryDark};
|
|
114
|
+
${$outline && `color: ${theme.colors.tertiaryDark}`};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
&:focus {
|
|
119
|
+
box-shadow: 0 0 0 4px ${theme.colors.tertiaryLight};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&:active {
|
|
123
|
+
box-shadow: 0 0 0 2px ${theme.colors.tertiaryLight};
|
|
124
|
+
}
|
|
125
|
+
`}
|
|
126
|
+
|
|
127
|
+
${formElementHeightStyles($size)}
|
|
128
|
+
|
|
129
|
+
${$size === "big"
|
|
130
|
+
? `font-size: ${theme.fontSizes.buttonBig.lg};
|
|
131
|
+
line-height: ${theme.lineHeights.buttonBig.lg};
|
|
132
|
+
`
|
|
133
|
+
: `font-size: ${theme.fontSizes.button.lg};
|
|
134
|
+
line-height: ${theme.lineHeights.button.lg};`}
|
|
135
|
+
|
|
136
|
+
${disabled &&
|
|
137
|
+
`
|
|
138
|
+
cursor: not-allowed;
|
|
139
|
+
background: ${theme.colors.grayLight};
|
|
140
|
+
border-color: ${theme.colors.grayLight};
|
|
141
|
+
color: ${theme.colors.gray};
|
|
142
|
+
`}
|
|
143
|
+
|
|
144
|
+
${$fullWidth && `width: 100%;`}
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
const StyledButton = styled.button<ButtonProps>`
|
|
148
|
+
${({ theme, $variant, $size, $outline, $fullWidth, disabled }) =>
|
|
149
|
+
buttonStyles(theme, $variant, $size, $outline, $fullWidth, disabled)}
|
|
150
|
+
`;
|
|
151
|
+
|
|
152
|
+
const StyledLinkButton = styled(Link)<LinkButtonProps>`
|
|
153
|
+
${({ theme, $variant, $size, $outline, $fullWidth, disabled }) =>
|
|
154
|
+
buttonStyles(theme, $variant, $size, $outline, $fullWidth, disabled)}
|
|
155
|
+
`;
|
|
156
|
+
|
|
157
|
+
function Button({ $variant = "primary", ...props }: ButtonProps) {
|
|
158
|
+
return (
|
|
159
|
+
<StyledButton $variant={$variant} {...props}>
|
|
160
|
+
{props.children}
|
|
161
|
+
</StyledButton>
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function LinkButton({
|
|
166
|
+
$variant = "primary",
|
|
167
|
+
theme = localTheme,
|
|
168
|
+
...props
|
|
169
|
+
}: LinkButtonProps) {
|
|
170
|
+
return (
|
|
171
|
+
<StyledLinkButton $variant={$variant} {...props}>
|
|
172
|
+
{props.children}
|
|
173
|
+
</StyledLinkButton>
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export { Button, LinkButton };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Theme, generateColSpanStyles } from "./utils";
|
|
5
|
+
|
|
6
|
+
interface ColProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
$span?: number;
|
|
9
|
+
$xsSpan?: number;
|
|
10
|
+
$smSpan?: number;
|
|
11
|
+
$mdSpan?: number;
|
|
12
|
+
$lgSpan?: number;
|
|
13
|
+
$xlSpan?: number;
|
|
14
|
+
$xxlSpan?: number;
|
|
15
|
+
$xxxlSpan?: number;
|
|
16
|
+
theme?: Theme;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const StyledCol = styled.div<ColProps>`
|
|
20
|
+
${({ $span }) =>
|
|
21
|
+
$span &&
|
|
22
|
+
`
|
|
23
|
+
grid-column: span ${$span};
|
|
24
|
+
`}
|
|
25
|
+
|
|
26
|
+
${({ $xsSpan }) => $xsSpan && generateColSpanStyles("xs", $xsSpan)}
|
|
27
|
+
${({ $smSpan }) => $smSpan && generateColSpanStyles("sm", $smSpan)}
|
|
28
|
+
${({ $mdSpan }) => $mdSpan && generateColSpanStyles("md", $mdSpan)}
|
|
29
|
+
${({ $lgSpan }) => $lgSpan && generateColSpanStyles("lg", $lgSpan)}
|
|
30
|
+
${({ $xlSpan }) => $xlSpan && generateColSpanStyles("xl", $xlSpan)}
|
|
31
|
+
${({ $xxlSpan }) => $xxlSpan && generateColSpanStyles("xxl", $xxlSpan)}
|
|
32
|
+
${({ $xxxlSpan }) => $xxxlSpan && generateColSpanStyles("xxxl", $xxxlSpan)}
|
|
33
|
+
`;
|
|
34
|
+
|
|
35
|
+
function Col({ ...props }: ColProps) {
|
|
36
|
+
return <StyledCol {...props}>{props.children}</StyledCol>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Col };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import styled from "styled-components";
|
|
4
|
+
import { Theme, mq, generatePaddingStyles } from "./utils";
|
|
5
|
+
|
|
6
|
+
export interface ContainerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: React.ReactNode;
|
|
9
|
+
$fluid?: boolean;
|
|
10
|
+
$textAlign?: "right" | "left" | "center";
|
|
11
|
+
$padding?: number | "none";
|
|
12
|
+
$xsPadding?: number | "none";
|
|
13
|
+
$smPadding?: number | "none";
|
|
14
|
+
$mdPadding?: number | "none";
|
|
15
|
+
$lgPadding?: number | "none";
|
|
16
|
+
$xlPadding?: number | "none";
|
|
17
|
+
$xxlPadding?: number | "none";
|
|
18
|
+
$xxxlPadding?: number | "none";
|
|
19
|
+
theme?: Theme;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const StyledContainer = styled.div<ContainerProps>`
|
|
23
|
+
margin: auto;
|
|
24
|
+
width: 100%;
|
|
25
|
+
max-width: ${({ theme, $fluid }) =>
|
|
26
|
+
$fluid ? `100%` : theme.spacing.maxWidth.xs};
|
|
27
|
+
${({ $textAlign }) => $textAlign && `text-align: ${$textAlign}`};
|
|
28
|
+
padding: ${({ $padding, theme }) =>
|
|
29
|
+
($padding && `${$padding}px`) || theme.spacing.padding.xs};
|
|
30
|
+
|
|
31
|
+
${mq("lg")} {
|
|
32
|
+
padding: ${({ $padding, theme }) =>
|
|
33
|
+
($padding && `${$padding}px`) || theme.spacing.padding.lg};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
${mq("xxxl")} {
|
|
37
|
+
max-width: ${({ theme, $fluid }) =>
|
|
38
|
+
$fluid ? `100%` : theme.spacing.maxWidth.xxxl};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
${({ $xsPadding }) => $xsPadding && generatePaddingStyles("xs", $xsPadding)}
|
|
42
|
+
${({ $smPadding }) => $smPadding && generatePaddingStyles("sm", $smPadding)}
|
|
43
|
+
${({ $mdPadding }) => $mdPadding && generatePaddingStyles("md", $mdPadding)}
|
|
44
|
+
${({ $lgPadding }) => $lgPadding && generatePaddingStyles("lg", $lgPadding)}
|
|
45
|
+
${({ $xlPadding }) => $xlPadding && generatePaddingStyles("xl", $xlPadding)}
|
|
46
|
+
${({ $xxlPadding }) => $xxlPadding && generatePaddingStyles("xxl", $xxlPadding)}
|
|
47
|
+
${({ $xxxlPadding }) =>
|
|
48
|
+
$xxxlPadding && generatePaddingStyles("xxxl", $xxxlPadding)}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
function Container({ ...props }: ContainerProps) {
|
|
52
|
+
return <StyledContainer {...props}>{props.children}</StyledContainer>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { Container };
|