beyond-system 0.1.0 → 0.1.3
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/dist/components/react/Checkbox/index.d.ts +1 -0
- package/dist/components/react/Checkbox/index.js +2 -0
- package/dist/components/react/Checkbox/index.js.map +1 -0
- package/dist/components/react/DefaultButton/DefaultButton.d.ts +12 -0
- package/dist/components/react/DefaultButton/DefaultButton.stories.d.ts +7 -0
- package/dist/components/react/DefaultButton/index.d.ts +1 -0
- package/dist/components/react/DefaultButton/index.js +2 -0
- package/dist/components/react/DefaultButton/index.js.map +1 -0
- package/dist/components/react/IconButton/IconButton.d.ts +10 -0
- package/dist/components/react/IconButton/IconButton.stories.d.ts +7 -0
- package/dist/components/react/IconButton/index.d.ts +1 -0
- package/dist/components/react/IconButton/index.js +2 -0
- package/dist/components/react/IconButton/index.js.map +1 -0
- package/dist/components/react/Loader/index.d.ts +3 -0
- package/dist/components/react/Loader/index.js +4 -0
- package/dist/components/react/Loader/index.js.map +1 -0
- package/dist/components/react/OutlineButton/OutlineButton.d.ts +12 -0
- package/dist/components/react/OutlineButton/OutlineButton.stories.d.ts +7 -0
- package/dist/components/react/OutlineButton/index.d.ts +1 -0
- package/dist/components/react/OutlineButton/index.js +2 -0
- package/dist/components/react/OutlineButton/index.js.map +1 -0
- package/dist/components/react/RadioInput/index.d.ts +1 -0
- package/dist/components/react/RadioInput/index.js +2 -0
- package/dist/components/react/RadioInput/index.js.map +1 -0
- package/dist/components/react/Switch/index.d.ts +1 -0
- package/dist/components/react/Switch/index.js +2 -0
- package/dist/components/react/Switch/index.js.map +1 -0
- package/dist/components/react/TransparentButton/index.d.ts +1 -0
- package/dist/components/react/TransparentButton/index.js +2 -0
- package/dist/components/react/TransparentButton/index.js.map +1 -0
- package/dist/components/react/index.d.ts +8 -0
- package/dist/components/react/index.js +9 -0
- package/dist/components/react/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/package.json +16 -1
- package/.auto-changelog +0 -10
- package/.editorconfig +0 -9
- package/.eslintrc.js +0 -74
- package/.storybook/growth-theme.js +0 -23
- package/.storybook/main.js +0 -21
- package/.storybook/manager.js +0 -7
- package/.storybook/preview-head.html +0 -13
- package/.storybook/preview.js +0 -29
- package/changelog-template.hbs +0 -19
- package/next.config.js +0 -6
- package/prettier.config.js +0 -5
- package/public/favicon.ico +0 -0
- package/public/next.svg +0 -1
- package/public/thirteen.svg +0 -1
- package/public/vercel.svg +0 -1
- package/setup.js +0 -15
- package/src/colors/base-colors.ts +0 -75
- package/src/colors/gradients.ts +0 -9
- package/src/colors/index.ts +0 -3
- package/src/colors/shadows.ts +0 -9
- package/src/components/react/Checkbox/Checkbox.stories.tsx +0 -59
- package/src/components/react/Checkbox/Checkbox.styles.ts +0 -84
- package/src/components/react/Checkbox/Checkbox.tsx +0 -33
- package/src/components/react/Checkbox/Checkbox.variants.ts +0 -27
- package/src/components/react/DefaultButton/DefaultButton.stories.tsx +0 -98
- package/src/components/react/DefaultButton/DefaultButton.styles.ts +0 -106
- package/src/components/react/DefaultButton/DefaultButton.tsx +0 -67
- package/src/components/react/DefaultButton/DefaultButton.variants.ts +0 -49
- package/src/components/react/IconButton/IconButton.stories.tsx +0 -71
- package/src/components/react/IconButton/IconButton.styles.ts +0 -98
- package/src/components/react/IconButton/IconButton.tsx +0 -55
- package/src/components/react/IconButton/IconButton.variants.ts +0 -40
- package/src/components/react/Loader/Loader.stories.tsx +0 -36
- package/src/components/react/Loader/Loader.tsx +0 -40
- package/src/components/react/Loader/index.tsx +0 -1
- package/src/components/react/OutlineButton/OutlineButton.stories.tsx +0 -98
- package/src/components/react/OutlineButton/OutlineButton.styles.ts +0 -97
- package/src/components/react/OutlineButton/OutlineButton.tsx +0 -67
- package/src/components/react/OutlineButton/OutlineButton.variants.ts +0 -40
- package/src/components/react/RadioInput/RadioInput.stories.tsx +0 -53
- package/src/components/react/RadioInput/RadioInput.styles.ts +0 -69
- package/src/components/react/RadioInput/RadioInput.tsx +0 -23
- package/src/components/react/RadioInput/RadioInput.variants.ts +0 -23
- package/src/components/react/Switch/Switch.stories.tsx +0 -53
- package/src/components/react/Switch/Switch.styles.ts +0 -60
- package/src/components/react/Switch/Switch.tsx +0 -28
- package/src/components/react/Switch/Switch.variants.ts +0 -19
- package/src/components/react/TransparentButton/TransparentButton.stories.tsx +0 -53
- package/src/components/react/TransparentButton/TransparentButton.styles.ts +0 -74
- package/src/components/react/TransparentButton/TransparentButton.tsx +0 -41
- package/src/components/react/TransparentButton/TransparentButton.variants.ts +0 -35
- package/src/stories/base-colors/base-colors.stories.styles.ts +0 -65
- package/src/stories/base-colors/base-colors.stories.tsx +0 -89
- package/src/stories/gradients/gradients.stories.styles.ts +0 -60
- package/src/stories/gradients/gradients.stories.tsx +0 -39
- package/src/stories/shadows/shadows.stories.styles.ts +0 -59
- package/src/stories/shadows/shadows.stories.tsx +0 -37
- package/src/web/border.ts +0 -13
- package/src/web/font.ts +0 -38
- package/src/web/index.ts +0 -2
- package/tsconfig.json +0 -24
- package/vercel.json +0 -8
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
|
|
3
|
-
import * as RadixSwitch from '@radix-ui/react-switch'
|
|
4
|
-
|
|
5
|
-
import { COLORS } from '@/colors'
|
|
6
|
-
|
|
7
|
-
export type StyledSwitchProps = {
|
|
8
|
-
thumbColor: string
|
|
9
|
-
thumbHoverColor: string
|
|
10
|
-
thumbActiveColor: string
|
|
11
|
-
trackColor: string
|
|
12
|
-
trackHoverColor: string
|
|
13
|
-
trackActiveColor: string
|
|
14
|
-
width: string
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const SwitchContainer = styled(RadixSwitch.Root)<StyledSwitchProps>`
|
|
18
|
-
all: unset;
|
|
19
|
-
position: relative;
|
|
20
|
-
|
|
21
|
-
width: ${(props) => props.width};
|
|
22
|
-
aspect-ratio: 2/1;
|
|
23
|
-
|
|
24
|
-
background-color: ${(props) => props.trackColor};
|
|
25
|
-
border-radius: ${(props) => props.width};
|
|
26
|
-
|
|
27
|
-
:focus {
|
|
28
|
-
outline: none;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
&[data-state='checked'] {
|
|
32
|
-
background-color: ${(props) => props.trackActiveColor};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
:disabled {
|
|
36
|
-
background-color: ${COLORS.NEUTRAL_LIGHT};
|
|
37
|
-
}
|
|
38
|
-
`
|
|
39
|
-
|
|
40
|
-
export const SwitchThumb = styled(RadixSwitch.Thumb)<StyledSwitchProps>`
|
|
41
|
-
display: block;
|
|
42
|
-
|
|
43
|
-
width: calc(${(props) => props.width} * 0.4);
|
|
44
|
-
aspect-ratio: 1/1;
|
|
45
|
-
|
|
46
|
-
border-radius: 50%;
|
|
47
|
-
background-color: ${(props) => props.thumbColor};
|
|
48
|
-
|
|
49
|
-
transition: transform 100ms;
|
|
50
|
-
transform: translateX(calc(${(props) => props.width} * 0.05));
|
|
51
|
-
will-change: transform;
|
|
52
|
-
|
|
53
|
-
&[data-state='checked'] {
|
|
54
|
-
transform: translateX(
|
|
55
|
-
calc(
|
|
56
|
-
(${(props) => props.width} * 0.95) - (${(props) => props.width} * 0.4)
|
|
57
|
-
)
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
`
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import * as RadixSwitch from '@radix-ui/react-switch'
|
|
3
|
-
|
|
4
|
-
import { DEFAULT_SWITCH_VARIANTS } from './Switch.variants'
|
|
5
|
-
import { SwitchContainer, SwitchThumb } from './Switch.styles'
|
|
6
|
-
|
|
7
|
-
type RootSwitchProps = React.ComponentProps<typeof RadixSwitch.Root>
|
|
8
|
-
type SwitchProps = {
|
|
9
|
-
variant?: keyof typeof DEFAULT_SWITCH_VARIANTS.color
|
|
10
|
-
size?: keyof typeof DEFAULT_SWITCH_VARIANTS.size
|
|
11
|
-
} & RootSwitchProps
|
|
12
|
-
|
|
13
|
-
const Switch = ({
|
|
14
|
-
variant = 'primary',
|
|
15
|
-
size = 'MD',
|
|
16
|
-
...props
|
|
17
|
-
}: SwitchProps) => {
|
|
18
|
-
const colorProps = DEFAULT_SWITCH_VARIANTS.color[variant]
|
|
19
|
-
const sizeProps = DEFAULT_SWITCH_VARIANTS.size[size]
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<SwitchContainer {...props} {...colorProps} {...sizeProps}>
|
|
23
|
-
<SwitchThumb {...colorProps} {...sizeProps} />
|
|
24
|
-
</SwitchContainer>
|
|
25
|
-
)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export default Switch
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { COLORS } from '@/colors'
|
|
2
|
-
|
|
3
|
-
export const DEFAULT_SWITCH_VARIANTS = {
|
|
4
|
-
color: {
|
|
5
|
-
primary: {
|
|
6
|
-
thumbColor: COLORS.NEUTRAL_HIGH,
|
|
7
|
-
thumbHoverColor: COLORS.GROWTH_MID,
|
|
8
|
-
thumbActiveColor: COLORS.GROWTH_MID,
|
|
9
|
-
trackColor: COLORS.GROWTH_MID,
|
|
10
|
-
trackHoverColor: COLORS.GROWTH_MID,
|
|
11
|
-
trackActiveColor: COLORS.GROWTH_MID,
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
size: {
|
|
15
|
-
MD: {
|
|
16
|
-
width: '42px',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
-
|
|
4
|
-
import ButtonComponent from './TransparentButton'
|
|
5
|
-
import { TRANSPARENT_BUTTON_VARIANTS } from './TransparentButton.variants'
|
|
6
|
-
|
|
7
|
-
type Props = React.ComponentProps<typeof ButtonComponent>
|
|
8
|
-
|
|
9
|
-
export const TransparentButton = (props: Props) => {
|
|
10
|
-
return <ButtonComponent {...props} />
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default {
|
|
14
|
-
title: 'Buttons/TransparentButton',
|
|
15
|
-
parameters: {
|
|
16
|
-
component: TransparentButton,
|
|
17
|
-
},
|
|
18
|
-
args: {
|
|
19
|
-
children: 'Button',
|
|
20
|
-
variant: 'primary',
|
|
21
|
-
size: 'MD',
|
|
22
|
-
disabled: false,
|
|
23
|
-
},
|
|
24
|
-
argTypes: {
|
|
25
|
-
children: {
|
|
26
|
-
control: {
|
|
27
|
-
type: 'text',
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
variant: {
|
|
31
|
-
control: {
|
|
32
|
-
type: 'select',
|
|
33
|
-
options: Object.keys(TRANSPARENT_BUTTON_VARIANTS.color),
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
size: {
|
|
37
|
-
control: {
|
|
38
|
-
type: 'select',
|
|
39
|
-
options: Object.keys(TRANSPARENT_BUTTON_VARIANTS.size),
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
disabled: {
|
|
43
|
-
control: {
|
|
44
|
-
type: 'boolean',
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
onClick: {
|
|
48
|
-
control: {
|
|
49
|
-
action: 'clicked',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
} as Meta
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { COLORS } from '@/colors'
|
|
3
|
-
|
|
4
|
-
type StyledButtonProps = {
|
|
5
|
-
padding: string
|
|
6
|
-
color: string
|
|
7
|
-
fontSize: string
|
|
8
|
-
gap: string
|
|
9
|
-
hoverColor: string
|
|
10
|
-
activeColor: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export const StyledButtonContainer = styled.button<StyledButtonProps>`
|
|
14
|
-
all: unset;
|
|
15
|
-
|
|
16
|
-
display: flex;
|
|
17
|
-
flex-direction: row;
|
|
18
|
-
|
|
19
|
-
align-items: center;
|
|
20
|
-
justify-content: center;
|
|
21
|
-
|
|
22
|
-
transition: 0.05s ease-in-out;
|
|
23
|
-
|
|
24
|
-
padding: ${(props) => props.padding};
|
|
25
|
-
gap: ${(props) => props.gap};
|
|
26
|
-
|
|
27
|
-
color: ${(props) => props.color};
|
|
28
|
-
font-size: ${(props) => props.fontSize};
|
|
29
|
-
font-weight: 600;
|
|
30
|
-
|
|
31
|
-
* {
|
|
32
|
-
color: ${(props) => props.color};
|
|
33
|
-
font-size: ${(props) => props.fontSize};
|
|
34
|
-
font-weight: 600;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
padding: ${(props) => props.padding};
|
|
38
|
-
|
|
39
|
-
:hover {
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
transform: scale(1.01);
|
|
42
|
-
|
|
43
|
-
color: ${(props) => props.hoverColor};
|
|
44
|
-
|
|
45
|
-
* {
|
|
46
|
-
color: ${(props) => props.hoverColor};
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
:active {
|
|
51
|
-
transform: scale(0.98);
|
|
52
|
-
|
|
53
|
-
color: ${(props) => props.activeColor};
|
|
54
|
-
|
|
55
|
-
* {
|
|
56
|
-
color: ${(props) => props.activeColor};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
:disabled {
|
|
61
|
-
color: ${COLORS.NEUTRAL_LIGHT};
|
|
62
|
-
border-color: ${COLORS.NEUTRAL_LIGHT};
|
|
63
|
-
background-color: ${COLORS.NEUTRAL_HIGH};
|
|
64
|
-
|
|
65
|
-
:hover {
|
|
66
|
-
cursor: default;
|
|
67
|
-
transform: scale(1);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
:active {
|
|
71
|
-
transform: scale(1);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
`
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React, { forwardRef } from 'react'
|
|
2
|
-
|
|
3
|
-
import { StyledButtonContainer } from './TransparentButton.styles'
|
|
4
|
-
import { TRANSPARENT_BUTTON_VARIANTS } from './TransparentButton.variants'
|
|
5
|
-
|
|
6
|
-
type TransparentButtonProps = {
|
|
7
|
-
children: React.ReactNode
|
|
8
|
-
variant?: keyof typeof TRANSPARENT_BUTTON_VARIANTS.color
|
|
9
|
-
size?: keyof typeof TRANSPARENT_BUTTON_VARIANTS.size
|
|
10
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement>
|
|
11
|
-
|
|
12
|
-
const TransparentButton = forwardRef<HTMLButtonElement, TransparentButtonProps>(
|
|
13
|
-
(
|
|
14
|
-
{
|
|
15
|
-
children,
|
|
16
|
-
variant = 'primary',
|
|
17
|
-
size = 'MD',
|
|
18
|
-
...props
|
|
19
|
-
}: TransparentButtonProps,
|
|
20
|
-
ref: any
|
|
21
|
-
) => {
|
|
22
|
-
const variantProps = TRANSPARENT_BUTTON_VARIANTS.color[variant]
|
|
23
|
-
const sizeProps = TRANSPARENT_BUTTON_VARIANTS.size[size]
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<StyledButtonContainer
|
|
27
|
-
type="button"
|
|
28
|
-
{...props}
|
|
29
|
-
{...variantProps}
|
|
30
|
-
{...sizeProps}
|
|
31
|
-
ref={ref}
|
|
32
|
-
>
|
|
33
|
-
{children}
|
|
34
|
-
</StyledButtonContainer>
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
TransparentButton.displayName = 'TransparentButton'
|
|
40
|
-
|
|
41
|
-
export default TransparentButton
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { COLORS } from '@/colors'
|
|
2
|
-
import { FONT } from '@/web'
|
|
3
|
-
|
|
4
|
-
export const TRANSPARENT_BUTTON_VARIANTS = {
|
|
5
|
-
color: {
|
|
6
|
-
primary: {
|
|
7
|
-
color: COLORS.GROWTH_MID,
|
|
8
|
-
hoverColor: COLORS.GROWTH_LIGHT,
|
|
9
|
-
activeColor: COLORS.GROWTH_DARK,
|
|
10
|
-
},
|
|
11
|
-
light: {
|
|
12
|
-
color: COLORS.NEUTRAL_LIGHTER,
|
|
13
|
-
hoverColor: COLORS.NEUTRAL_HIGH,
|
|
14
|
-
activeColor: COLORS.NEUTRAL_LIGHT,
|
|
15
|
-
},
|
|
16
|
-
dark: {
|
|
17
|
-
color: COLORS.NEUTRAL_DARKER,
|
|
18
|
-
hoverColor: COLORS.NEUTRAL_DARK,
|
|
19
|
-
activeColor: COLORS.NEUTRAL_LOW,
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
size: {
|
|
23
|
-
SM: {
|
|
24
|
-
fontSize: FONT.SIZE.SM,
|
|
25
|
-
padding: '6px 12px',
|
|
26
|
-
gap: '4px',
|
|
27
|
-
iconSize: '16px',
|
|
28
|
-
},
|
|
29
|
-
MD: {
|
|
30
|
-
fontSize: FONT.SIZE.MD,
|
|
31
|
-
gap: '8px',
|
|
32
|
-
padding: '10px 20px',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
|
|
3
|
-
export const BaseColorsContainer = styled.div`
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
justify-content: space-around;
|
|
7
|
-
width: 100%;
|
|
8
|
-
margin: 0 auto;
|
|
9
|
-
|
|
10
|
-
gap: 16px;
|
|
11
|
-
|
|
12
|
-
.color-item {
|
|
13
|
-
all: unset;
|
|
14
|
-
|
|
15
|
-
display: flex;
|
|
16
|
-
align-items: center;
|
|
17
|
-
width: 100%;
|
|
18
|
-
max-width: 400px;
|
|
19
|
-
|
|
20
|
-
background-color: #fff;
|
|
21
|
-
border-radius: 4px;
|
|
22
|
-
|
|
23
|
-
transition: 0.2s ease-in-out;
|
|
24
|
-
padding-right: 8px;
|
|
25
|
-
|
|
26
|
-
gap: 16px;
|
|
27
|
-
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
|
28
|
-
|
|
29
|
-
:hover {
|
|
30
|
-
cursor: pointer;
|
|
31
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
|
|
32
|
-
transform: scale(1.02);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.color-item__name {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-direction: column;
|
|
39
|
-
font-size: 1rem;
|
|
40
|
-
font-weight: 700;
|
|
41
|
-
|
|
42
|
-
color: #454545;
|
|
43
|
-
overflow: hidden;
|
|
44
|
-
text-overflow: ellipsis;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
.color-item__name__hex {
|
|
48
|
-
font-size: 0.75em;
|
|
49
|
-
font-weight: 700;
|
|
50
|
-
color: #8e96a2;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.color-item__name__aliases {
|
|
54
|
-
font-size: 0.75em;
|
|
55
|
-
font-weight: 700;
|
|
56
|
-
color: #8e96a2;
|
|
57
|
-
}
|
|
58
|
-
`
|
|
59
|
-
|
|
60
|
-
export const StyledSquare = styled.div<any>`
|
|
61
|
-
min-width: 75px;
|
|
62
|
-
min-height: 75px;
|
|
63
|
-
border-radius: 4px;
|
|
64
|
-
background: ${(props) => props.color};
|
|
65
|
-
`
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
-
|
|
4
|
-
import { COLORS } from '@/colors/base-colors'
|
|
5
|
-
|
|
6
|
-
import { BaseColorsContainer, StyledSquare } from './base-colors.stories.styles'
|
|
7
|
-
|
|
8
|
-
const getColorValue = (color: string): string => {
|
|
9
|
-
const colorParts = color.split('.')
|
|
10
|
-
let colorValue: any = COLORS
|
|
11
|
-
colorParts.forEach((colorPart) => {
|
|
12
|
-
colorValue = colorValue[colorPart]
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
return colorValue
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const handleCopyToClipboard = (hex: string) => {
|
|
19
|
-
navigator.clipboard.writeText(hex)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export const BaseColors = () => {
|
|
23
|
-
const flattenedColors = Object.entries(COLORS).reduce((acc, [key, value]) => {
|
|
24
|
-
if (typeof value === 'object') {
|
|
25
|
-
const newKeys = Object.keys(value).map((k) => `${key}.${k}`) as string[]
|
|
26
|
-
const newValues = Object.values(value) as string[]
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
...acc,
|
|
30
|
-
...Object.fromEntries(newKeys.map((k, i) => [k, newValues[i]])),
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
...acc,
|
|
36
|
-
[key]: value,
|
|
37
|
-
}
|
|
38
|
-
}, {})
|
|
39
|
-
|
|
40
|
-
const uniqueFlattenedColors = Object.entries(flattenedColors).reduce(
|
|
41
|
-
(acc, [key, value]) => {
|
|
42
|
-
if (Object.values(acc).includes(value)) {
|
|
43
|
-
return acc
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return {
|
|
47
|
-
...acc,
|
|
48
|
-
[key]: value,
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
{}
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<BaseColorsContainer>
|
|
56
|
-
{Object.keys(uniqueFlattenedColors).map((key) => {
|
|
57
|
-
const colorHex = getColorValue(key)
|
|
58
|
-
const aliases = Object.entries(flattenedColors)
|
|
59
|
-
.filter(([k, v]) => v === colorHex && k !== key)
|
|
60
|
-
.map(([k]) => k)
|
|
61
|
-
.join(', ')
|
|
62
|
-
|
|
63
|
-
return (
|
|
64
|
-
<button
|
|
65
|
-
key={key}
|
|
66
|
-
className="color-item"
|
|
67
|
-
onClick={() => handleCopyToClipboard(colorHex)}
|
|
68
|
-
>
|
|
69
|
-
<StyledSquare color={colorHex} title={colorHex} />
|
|
70
|
-
<div title={key} className="color-item__name">
|
|
71
|
-
<span className="color-item__name__hex">
|
|
72
|
-
{colorHex.toUpperCase()}
|
|
73
|
-
</span>
|
|
74
|
-
<span className="color-item__name__key">{key}</span>
|
|
75
|
-
<span className="color-item__name__aliases">{aliases}</span>
|
|
76
|
-
</div>
|
|
77
|
-
</button>
|
|
78
|
-
)
|
|
79
|
-
})}
|
|
80
|
-
</BaseColorsContainer>
|
|
81
|
-
)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export default {
|
|
85
|
-
title: 'Fundation/Colors',
|
|
86
|
-
parameters: {
|
|
87
|
-
component: BaseColors,
|
|
88
|
-
},
|
|
89
|
-
} as Meta
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
|
|
3
|
-
export const BaseColorsContainer = styled.div`
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
justify-content: space-around;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100%;
|
|
9
|
-
margin: 0 auto;
|
|
10
|
-
|
|
11
|
-
gap: 16px;
|
|
12
|
-
|
|
13
|
-
.color-item {
|
|
14
|
-
all: unset;
|
|
15
|
-
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: center;
|
|
18
|
-
width: 100%;
|
|
19
|
-
max-width: 45%;
|
|
20
|
-
|
|
21
|
-
background-color: #fff;
|
|
22
|
-
border-radius: 4px;
|
|
23
|
-
|
|
24
|
-
transition: 0.2s ease-in-out;
|
|
25
|
-
padding-right: 8px;
|
|
26
|
-
|
|
27
|
-
gap: 16px;
|
|
28
|
-
box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
|
|
29
|
-
|
|
30
|
-
:hover {
|
|
31
|
-
cursor: pointer;
|
|
32
|
-
box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
|
|
33
|
-
transform: scale(1.02);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
.color-item__name {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
font-size: 1rem;
|
|
41
|
-
font-weight: 700;
|
|
42
|
-
|
|
43
|
-
color: #454545;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
text-overflow: ellipsis;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.color-item__name__value {
|
|
49
|
-
font-size: 0.75em;
|
|
50
|
-
font-weight: 700;
|
|
51
|
-
color: #8e96a2;
|
|
52
|
-
}
|
|
53
|
-
`
|
|
54
|
-
|
|
55
|
-
export const StyledSquare = styled.div<any>`
|
|
56
|
-
min-width: 150px;
|
|
57
|
-
min-height: 100px;
|
|
58
|
-
border-radius: 4px;
|
|
59
|
-
background: ${(props) => props.gradient};
|
|
60
|
-
`
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
-
|
|
4
|
-
import { GRADIENTS } from '@/colors/gradients'
|
|
5
|
-
|
|
6
|
-
import { BaseColorsContainer, StyledSquare } from './gradients.stories.styles'
|
|
7
|
-
|
|
8
|
-
const handleCopyToClipboard = (hex: string) => {
|
|
9
|
-
navigator.clipboard.writeText(hex)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Gradients = () => {
|
|
13
|
-
return (
|
|
14
|
-
<BaseColorsContainer>
|
|
15
|
-
{Object.entries(GRADIENTS).map(([key, value]) => {
|
|
16
|
-
return (
|
|
17
|
-
<button
|
|
18
|
-
key={key}
|
|
19
|
-
className="color-item"
|
|
20
|
-
onClick={() => handleCopyToClipboard(value)}
|
|
21
|
-
>
|
|
22
|
-
<StyledSquare gradient={value} />
|
|
23
|
-
<div title={key} className="color-item__name">
|
|
24
|
-
<span className="color-item__name__key">{key}</span>
|
|
25
|
-
<span className="color-item__name__value">{value}</span>
|
|
26
|
-
</div>
|
|
27
|
-
</button>
|
|
28
|
-
)
|
|
29
|
-
})}
|
|
30
|
-
</BaseColorsContainer>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default {
|
|
35
|
-
title: 'Fundation/Colors',
|
|
36
|
-
parameters: {
|
|
37
|
-
component: Gradients,
|
|
38
|
-
},
|
|
39
|
-
} as Meta
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
|
|
3
|
-
export const BaseColorsContainer = styled.div`
|
|
4
|
-
display: flex;
|
|
5
|
-
flex-wrap: wrap;
|
|
6
|
-
justify-content: space-around;
|
|
7
|
-
width: 100%;
|
|
8
|
-
height: 100%;
|
|
9
|
-
margin: 0 auto;
|
|
10
|
-
|
|
11
|
-
gap: 64px 16px;
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
export const StyledSquare = styled.button<any>`
|
|
15
|
-
all: unset;
|
|
16
|
-
width: 100%;
|
|
17
|
-
max-width: 300px;
|
|
18
|
-
min-height: 150px;
|
|
19
|
-
|
|
20
|
-
padding: 24px;
|
|
21
|
-
border-radius: 4px;
|
|
22
|
-
box-shadow: ${(props) => props.boxShadow};
|
|
23
|
-
|
|
24
|
-
display: flex;
|
|
25
|
-
flex-direction: column;
|
|
26
|
-
align-items: center;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
|
|
29
|
-
background-color: #fff;
|
|
30
|
-
border-radius: 4px;
|
|
31
|
-
|
|
32
|
-
transition: 0.2s ease-in-out;
|
|
33
|
-
padding-right: 8px;
|
|
34
|
-
|
|
35
|
-
gap: 16px;
|
|
36
|
-
|
|
37
|
-
.item__name__key {
|
|
38
|
-
display: flex;
|
|
39
|
-
flex-direction: column;
|
|
40
|
-
font-size: 1rem;
|
|
41
|
-
font-weight: 700;
|
|
42
|
-
|
|
43
|
-
color: #454545;
|
|
44
|
-
overflow: hidden;
|
|
45
|
-
text-align: center;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.item__name__value {
|
|
49
|
-
font-size: 0.75em;
|
|
50
|
-
font-weight: 700;
|
|
51
|
-
color: #8e96a2;
|
|
52
|
-
text-align: center;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
:hover {
|
|
56
|
-
cursor: pointer;
|
|
57
|
-
transform: scale(1.02);
|
|
58
|
-
}
|
|
59
|
-
`
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { Meta } from '@storybook/react/types-6-0'
|
|
3
|
-
|
|
4
|
-
import { SHADOWS } from '@/colors/shadows'
|
|
5
|
-
|
|
6
|
-
import { BaseColorsContainer, StyledSquare } from './shadows.stories.styles'
|
|
7
|
-
|
|
8
|
-
const handleCopyToClipboard = (hex: string) => {
|
|
9
|
-
navigator.clipboard.writeText(hex)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const Shadows = () => {
|
|
13
|
-
return (
|
|
14
|
-
<BaseColorsContainer>
|
|
15
|
-
{Object.entries(SHADOWS).map(([key, value]) => {
|
|
16
|
-
return (
|
|
17
|
-
<StyledSquare
|
|
18
|
-
boxShadow={value}
|
|
19
|
-
title={key}
|
|
20
|
-
key={key}
|
|
21
|
-
onClick={() => handleCopyToClipboard(value)}
|
|
22
|
-
>
|
|
23
|
-
<span className="item__name__key">{key}</span>
|
|
24
|
-
<span className="item__name__value">{value}</span>
|
|
25
|
-
</StyledSquare>
|
|
26
|
-
)
|
|
27
|
-
})}
|
|
28
|
-
</BaseColorsContainer>
|
|
29
|
-
)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default {
|
|
33
|
-
title: 'Fundation/Colors',
|
|
34
|
-
parameters: {
|
|
35
|
-
component: Shadows,
|
|
36
|
-
},
|
|
37
|
-
} as Meta
|