Skip to content

Commit 394dc4a

Browse files
authored
v0.3.0
2 parents 46886ed + b143ddb commit 394dc4a

File tree

132 files changed

+10770
-7849
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+10770
-7849
lines changed

.storybook/preview.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ import React from 'react'
33

44
/* Internel dependencies */
55
import EnableCSSHoudini from '../src/worklets/EnableCSSHoudini'
6-
import { ThemeProvider, LightTheme, DarkTheme } from '../src/styling/Theme'
6+
import {
7+
FoundationProvider,
8+
LightFoundation,
9+
DarkFoundation,
10+
styled,
11+
} from '../src/foundation'
712

813
// CSS Houdini
914
EnableCSSHoudini({ smoothCorners: true })
1015

11-
const ThemeKeyword = {
16+
const FoundationKeyword = {
1217
Light: 'light',
1318
Dark: 'dark',
1419
}
@@ -18,33 +23,35 @@ export const parameters = {
1823
}
1924

2025
export const globalTypes = {
21-
theme: {
22-
name: 'Theme',
23-
description: 'Global theme for components',
26+
Foundation: {
27+
name: 'Foundation',
28+
description: 'Global Foundation for components',
2429
defaultValue: 'light',
2530
toolbar: {
2631
icon: 'circlehollow',
27-
items: [ThemeKeyword.Light, ThemeKeyword.Dark],
32+
items: [FoundationKeyword.Light, FoundationKeyword.Dark],
2833
},
2934
},
3035
};
3136

32-
function getTheme(keyword) {
33-
if (keyword === ThemeKeyword.Light) return LightTheme
34-
return DarkTheme
37+
function getFoundation(keyword) {
38+
if (keyword === FoundationKeyword.Light) return LightFoundation
39+
return DarkFoundation
3540
}
3641

37-
function withThemeProvider(Story, context) {
38-
const theme = getTheme(context.globals.theme)
39-
const backgroundColor = context.globals.theme === 'dark' ? 'black' : 'white'
42+
function withFoundationProvider(Story, context) {
43+
const Foundation = getFoundation(context.globals.Foundation)
44+
const backgroundColor = context.globals.Foundation === 'dark'
45+
? DarkFoundation.theme['bg-white-normal']
46+
: LightFoundation.theme['bg-white-normal']
4047

4148
return (
42-
<div style={{ backgroundColor }}>
43-
<ThemeProvider theme={theme}>
49+
<div style={{ backgroundColor, padding: 100 }}>
50+
<FoundationProvider foundation={Foundation}>
4451
{ Story(context) }
45-
</ThemeProvider>
52+
</FoundationProvider>
4653
</div>
4754
)
4855
}
4956

50-
export const decorators = [withThemeProvider]
57+
export const decorators = [withFoundationProvider]

package-lock.json

Lines changed: 6655 additions & 6695 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@channel.io/design-system",
3-
"version": "0.2.21",
3+
"version": "0.3.0",
44
"description": "Design System by Channel",
55
"repository": {
66
"type": "git",
@@ -26,7 +26,7 @@
2626
"jest:watch": "cross-env BABEL_ENV=test jest --watch",
2727
"build": "cross-env BABEL_ENV=build rollup -c",
2828
"prebuild": "npm run typecheck",
29-
"prepublishOnly": "npm run build:icon && npm run build",
29+
"prepublishOnly": "npm run build:icon && npm run build && npm run build:storybook && npm run deploy:storybook",
3030
"antlr:lexer": "antlr4ts src/components/Editor/utils/Parsers/Antlr/TextBlockLexer.g4",
3131
"antlr:parser": "antlr4ts src/components/Editor/utils/Parsers/Antlr/TextBlockParser.g4",
3232
"build:storybook": "build-storybook",
@@ -64,73 +64,73 @@
6464
"> 1% in US"
6565
],
6666
"devDependencies": {
67-
"@babel/core": "^7.10.5",
67+
"@babel/core": "^7.12.10",
6868
"@babel/plugin-proposal-class-properties": "^7.12.1",
6969
"@babel/plugin-proposal-decorators": "^7.12.1",
7070
"@babel/plugin-transform-classes": "^7.12.1",
71-
"@babel/preset-env": "^7.10.4",
72-
"@babel/preset-react": "^7.10.4",
73-
"@babel/preset-typescript": "^7.10.4",
71+
"@babel/preset-env": "^7.12.11",
72+
"@babel/preset-react": "^7.12.10",
73+
"@babel/preset-typescript": "^7.12.7",
7474
"@channel.io/eslint-config": "^1.0.8",
75-
"@channel.io/stylelint-config": "^1.1.0",
76-
"@rollup/plugin-babel": "^5.1.0",
77-
"@rollup/plugin-commonjs": "^11.0.2",
78-
"@rollup/plugin-node-resolve": "^7.1.3",
79-
"@storybook/addon-actions": "^6.0.26",
80-
"@storybook/addon-controls": "^6.0.26",
81-
"@storybook/addon-docs": "^6.0.26",
82-
"@storybook/addon-toolbars": "^6.0.26",
83-
"@storybook/react": "^6.0.26",
75+
"@channel.io/stylelint-config": "^1.2.0",
76+
"@rollup/plugin-babel": "^5.2.2",
77+
"@rollup/plugin-commonjs": "^17.0.0",
78+
"@rollup/plugin-node-resolve": "^11.1.0",
79+
"@storybook/addon-actions": "^6.1.11",
80+
"@storybook/addon-controls": "^6.1.11",
81+
"@storybook/addon-docs": "^6.1.11",
82+
"@storybook/addon-toolbars": "^6.1.11",
83+
"@storybook/react": "^6.1.11",
8484
"@storybook/storybook-deployer": "^2.8.7",
8585
"@svgr/babel-plugin-add-jsx-attribute": "^5.4.0",
8686
"@svgr/babel-plugin-remove-jsx-attribute": "^5.4.0",
87-
"@svgr/cli": "^5.4.0",
88-
"@testing-library/jest-dom": "^5.5.0",
89-
"@testing-library/react": "^10.0.4",
87+
"@svgr/cli": "^5.5.0",
88+
"@testing-library/jest-dom": "^5.11.6",
89+
"@testing-library/react": "^10.4.9",
9090
"@types/antlr4": "^4.7.2",
91-
"@types/jest": "^25.2.1",
92-
"@types/lodash-es": "^4.17.3",
91+
"@types/jest": "^25.2.3",
92+
"@types/lodash-es": "^4.17.4",
9393
"@types/prosemirror-commands": "^1.0.3",
9494
"@types/prosemirror-inputrules": "^1.0.3",
9595
"@types/prosemirror-keymap": "^1.0.3",
96-
"@types/prosemirror-model": "^1.11.0",
96+
"@types/prosemirror-model": "^1.11.1",
9797
"@types/prosemirror-state": "^1.2.5",
9898
"@types/prosemirror-view": "^1.16.1",
99-
"@types/react": "^16.9.34",
100-
"@types/styled-components": "^5.1.0",
99+
"@types/react": "^16.14.2",
100+
"@types/styled-components": "^5.1.5",
101101
"@types/uuid": "^8.3.0",
102-
"@typescript-eslint/eslint-plugin": "^4.4.1",
103-
"@typescript-eslint/parser": "^4.4.1",
102+
"@typescript-eslint/eslint-plugin": "^4.10.0",
103+
"@typescript-eslint/parser": "^4.10.0",
104104
"babel-eslint": "^8.2.6",
105-
"babel-jest": "^26.2.2",
106-
"babel-loader": "^8.1.0",
105+
"babel-jest": "^26.6.3",
106+
"babel-loader": "^8.2.2",
107107
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
108108
"babel-plugin-transform-imports": "^2.0.0",
109109
"babel-preset-react-app": "^9.1.2",
110-
"core-js": "^3.6.5",
111-
"cross-env": "^7.0.2",
112-
"eslint": "^7.11.0",
110+
"core-js": "^3.8.1",
111+
"cross-env": "^7.0.3",
112+
"eslint": "^7.15.0",
113113
"eslint-import-resolver-typescript": "^2.3.0",
114-
"eslint-plugin-babel": "^5.3.0",
114+
"eslint-plugin-babel": "^5.3.1",
115115
"eslint-plugin-import": "^2.22.1",
116116
"eslint-plugin-jest": "^22.21.0",
117-
"eslint-plugin-jsx-a11y": "^6.3.1",
118-
"eslint-plugin-react": "^7.21.4",
119-
"eslint-plugin-react-hooks": "^4.1.2",
120-
"husky": "^4.2.5",
117+
"eslint-plugin-jsx-a11y": "^6.4.1",
118+
"eslint-plugin-react": "^7.21.5",
119+
"eslint-plugin-react-hooks": "^4.2.0",
120+
"husky": "^4.3.6",
121121
"identity-obj-proxy": "^3.0.0",
122-
"jest": "^26.0.1",
123-
"lint-staged": "^10.2.10",
122+
"jest": "^26.6.3",
123+
"lint-staged": "^10.5.3",
124124
"paths.macro": "^3.0.1",
125-
"react": "^16.13.1",
126-
"react-dom": "^16.13.1",
127-
"regenerator-runtime": "^0.13.5",
128-
"rollup": "^2.8.2",
129-
"rollup-plugin-peer-deps-external": "^2.2.2",
130-
"styled-components": "^5.1.0",
131-
"stylelint": "^13.6.0",
125+
"react": "^16.14.0",
126+
"react-dom": "^16.14.0",
127+
"regenerator-runtime": "^0.13.7",
128+
"rollup": "^2.37.1",
129+
"rollup-plugin-peer-deps-external": "^2.2.4",
130+
"styled-components": "^5.2.1",
131+
"stylelint": "^13.8.0",
132132
"ts-node": "^8.10.2",
133-
"typescript": "^3.8.3"
133+
"typescript": "^4.1.3"
134134
},
135135
"peerDependencies": {
136136
"react": ">=16.8.0",
@@ -144,10 +144,10 @@
144144
"prosemirror-commands": "^1.1.4",
145145
"prosemirror-inputrules": "^1.1.3",
146146
"prosemirror-keymap": "^1.1.4",
147-
"prosemirror-model": "^1.12.0",
147+
"prosemirror-model": "^1.13.0",
148148
"prosemirror-state": "^1.3.3",
149-
"prosemirror-view": "^1.16.0",
149+
"prosemirror-view": "^1.16.5",
150150
"ssr-window": "^2.0.0",
151-
"uuid": "^8.3.1"
151+
"uuid": "^8.3.2"
152152
}
153153
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/* Internal dependencies */
2-
import { styled } from '../../styling/Theme'
2+
import { styled } from '../../foundation'
33

44
interface BaseButtonProps {
55
width: number
66
height: number
77
}
88

99
export const StyledBaseButton = styled.div<BaseButtonProps>`
10+
box-sizing: content-box;
1011
display: flex;
1112
align-items: center;
1213
justify-content: center;
13-
box-shadow: 0 0 1px 10px black, 0 10px 10px black;
14-
outline: none;
1514
width: ${props => props.width};
1615
height: ${props => props.height};
17-
border-radius: 15px;
1816
background-color: white;
19-
box-sizing: content-box;
17+
border-radius: 15px;
18+
outline: none;
19+
box-shadow: 0 0 1px 10px black, 0 10px 10px black;
2020
`

src/components/Checkbox/Checkbox.styled.ts

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* Internal dependencies */
2-
import { styled } from '../../styling/Theme'
3-
import { absoluteCenter } from '../../styling/Mixins'
2+
import DisabledOpacity from '../../constants/DisabledOpacity'
3+
import { styled, css, absoluteCenter } from '../../foundation'
44
import { StyledWrapperProps, StyledCheckerProps, StyledContentProps } from './Checkbox.types'
55
import CheckType from './CheckType'
66

@@ -19,83 +19,88 @@ export const Wrapper = styled.div<StyledWrapperProps>`
1919
)}
2020
`
2121

22-
const checkerBase = (props: StyledCheckerProps) => `
22+
function isTrueOrPartial(checkStatus: CheckType = CheckType.False) {
23+
return checkStatus === CheckType.True || checkStatus === CheckType.Partial
24+
}
25+
26+
const checkerBase = css<StyledCheckerProps>`
27+
background-color:
28+
${({ foundation, checkStatus }) =>
29+
(isTrueOrPartial(checkStatus) ? foundation?.theme?.['bgtxt-green-normal'] : '')};
30+
border-color: ${({ checkStatus }) => (isTrueOrPartial(checkStatus) ? 'transparent' : '')};
31+
2332
&::after {
2433
${absoluteCenter`translateY(-13%) rotate(42deg)`}
25-
width: 4px;
26-
height: 9px;
27-
border-right: solid ${CHECKER_ICON_THICKNESS}px transparent;
28-
border-bottom: solid ${CHECKER_ICON_THICKNESS}px transparent;
29-
border-color: ${props.theme?.colors?.border0};
34+
display: ${({ checkStatus }) => (isTrueOrPartial(checkStatus) ? 'initial' : 'none')};
35+
width: 6px;
36+
height: 10px;
3037
content: '';
31-
transition: ${props.theme?.transition?.BorderTransition};
38+
${({ foundation }) =>
39+
foundation?.border?.getBorder(
40+
CHECKER_ICON_THICKNESS,
41+
foundation?.theme?.['bg-white-absolute'],
42+
{ top: false, left: false },
43+
)};
44+
${({ foundation }) => foundation?.transition?.getTransitionsCSS('border')};
3245
}
3346
34-
${(props.checkStatus === CheckType.True || props.checkStatus === CheckType.Partial) ? `
35-
background-color: ${props.theme?.colors?.success1};
36-
border-color: transparent;
37-
38-
${!props.disabled ? `
39-
&:hover {
40-
background-color: ${props.theme?.colors.success1Hover};
41-
}
42-
` : ''}
43-
` : ''}
47+
&:hover {
48+
background-color:
49+
${({ foundation, disabled, checkStatus }) =>
50+
((!disabled && isTrueOrPartial(checkStatus)) ? foundation?.theme?.['bgtxt-green-dark'] : '')};
51+
}
4452
`
4553

46-
const partialChecked = (props: StyledCheckerProps) => ((props.checkStatus === CheckType.Partial) ? `
54+
const partialChecked = css<StyledCheckerProps>`
4755
&::after {
4856
${absoluteCenter`translateY(-36%) rotate(0)`}
4957
width: 10px;
50-
border-right: none;
51-
border-bottom: solid 2px ${props.theme?.colors?.border0};
58+
${({ foundation }) =>
59+
foundation?.border?.getBorder(
60+
CHECKER_ICON_THICKNESS,
61+
foundation?.theme?.['bg-white-absolute'],
62+
{ top: false, right: false, left: false },
63+
)};
5264
}
53-
` : '')
54-
55-
const disabled = (props: StyledCheckerProps) => ((props.disabled) ? `
56-
background-color: ${props.theme?.colors?.disabled3};
65+
`
5766

58-
${(props.checkStatus === CheckType.False) ? `
59-
&::after {
60-
border-color: transparent;
61-
}
62-
` : `
63-
&::after {
64-
border-color: ${props.theme?.colors?.border5}
65-
}
66-
`}
67-
` : '')
67+
const disabledStyle = css<StyledCheckerProps>`
68+
opacity: ${DisabledOpacity};
69+
`
6870

6971
export const Checker = styled.div<StyledCheckerProps>`
7072
position: relative;
73+
box-sizing: border-box !important;
7174
display: flex;
7275
align-items: center;
7376
justify-content: center;
74-
box-sizing: border-box !important;
7577
width: ${CHECKER_BOX_SIZE}px;
76-
height: ${CHECKER_BOX_SIZE}px;
7778
min-width: ${CHECKER_BOX_SIZE}px;
79+
height: ${CHECKER_BOX_SIZE}px;
7880
min-height: ${CHECKER_BOX_SIZE}px;
7981
font-size: 10px;
8082
color: transparent;
81-
background-color: ${props => props.theme?.colors?.background0};
82-
border: ${CHECKER_BORDER_THICKNESS}px solid ${props => props.theme?.colors?.border3};
83+
${({ foundation }) =>
84+
foundation
85+
?.border
86+
?.getBorder(CHECKER_BORDER_THICKNESS, foundation?.theme?.['bd-black-light'])};
8387
border-radius: 4px;
84-
transition: ${props => props.theme?.transition?.BackgroundTransition}, ${props => props.theme?.transition?.ColorTransition};
8588
86-
${props => (!props.disabled ? `
89+
${({ foundation }) => foundation?.transition?.getTransitionsCSS(['background-color', 'opacity'])};
90+
91+
${({ foundation, disabled }) => (!disabled ? `
8792
&:hover {
8893
&::after {
89-
border-color: ${props.theme?.colors?.border2};
94+
border-color: ${foundation?.theme?.['bd-black-light']};
9095
}
9196
}
9297
` : '')}
9398
9499
${checkerBase}
95100
96-
${partialChecked}
101+
${({ checkStatus }) => (checkStatus === CheckType.Partial ? partialChecked : '')}
97102
98-
${disabled}
103+
${({ disabled }) => (disabled ? disabledStyle : '')}
99104
`
100105

101106
export const Content = styled.div<StyledContentProps>`

0 commit comments

Comments
 (0)