smbls 0.14.3 → 0.14.5
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/package.json +1 -1
- package/src/Box.js +2 -2
- package/src/Button.js +39 -7
- package/src/DatePicker/index.js +8 -4
- package/src/Input.js +3 -0
- package/src/Interaction.js +34 -0
- package/src/Label.js +13 -8
- package/src/Link.js +2 -0
- package/src/Theme.js +27 -15
- package/src/Timing.js +65 -0
- package/src/index.js +2 -1
- package/src/Transition.js +0 -37
package/package.json
CHANGED
package/src/Box.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { Shape, Position, Theme, Block, Text, Overflow,
|
|
3
|
+
import { Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Responsive, Interaction, XYZ } from '.'
|
|
4
4
|
|
|
5
5
|
const PropsCSS = {
|
|
6
6
|
class: {
|
|
@@ -9,5 +9,5 @@ const PropsCSS = {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const Box = {
|
|
12
|
-
extend: [Shape, Position, Theme, Block, Text, Overflow,
|
|
12
|
+
extend: [Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Responsive, PropsCSS, Interaction, XYZ]
|
|
13
13
|
}
|
package/src/Button.js
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { IconText } from '.'
|
|
3
|
+
import { IconText, Focusable } from '.'
|
|
4
4
|
|
|
5
5
|
const style = {
|
|
6
6
|
appearance: 'none',
|
|
7
7
|
border: 'none',
|
|
8
|
-
outline: 0,
|
|
9
8
|
cursor: 'pointer',
|
|
10
|
-
fontFamily: 'inherit'
|
|
9
|
+
fontFamily: 'inherit',
|
|
10
|
+
'& > *': {
|
|
11
|
+
pointerEvents: 'none'
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export const Button = {
|
|
14
|
-
extend: IconText,
|
|
16
|
+
extend: [Focusable, IconText],
|
|
15
17
|
tag: 'button',
|
|
16
18
|
props: {
|
|
17
19
|
fontSize: 'A',
|
|
@@ -51,9 +53,39 @@ export const CircleButton = {
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
export const KangorooButton = {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
extend: Button,
|
|
57
|
+
|
|
58
|
+
props: {
|
|
59
|
+
theme: 'quinary',
|
|
60
|
+
round: 'Z2',
|
|
61
|
+
padding: 'X1 X1 X1 A2',
|
|
62
|
+
size: 'A',
|
|
63
|
+
gap: 'A',
|
|
64
|
+
transition: 'A defaultBezier',
|
|
65
|
+
transitionProperty: 'background, color, opacity',
|
|
66
|
+
|
|
67
|
+
label: {
|
|
68
|
+
gap: 'X1',
|
|
69
|
+
text: 'Become PRO',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
fontWeight: 'bold',
|
|
72
|
+
icon: {
|
|
73
|
+
name: 'star',
|
|
74
|
+
color: 'yellow'
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
child: {
|
|
78
|
+
theme: 'tertiary',
|
|
79
|
+
round: 'Z',
|
|
80
|
+
size: 'Z',
|
|
81
|
+
padding: 'Z A2',
|
|
82
|
+
text: '1 month free',
|
|
83
|
+
opacity: '.85'
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
style
|
|
87
|
+
},
|
|
56
88
|
|
|
57
|
-
|
|
89
|
+
label: { extend: IconText },
|
|
58
90
|
child: { extend: IconText }
|
|
59
91
|
}
|
package/src/DatePicker/index.js
CHANGED
|
@@ -121,13 +121,17 @@ const main = {
|
|
|
121
121
|
cnt: {
|
|
122
122
|
childExtend: {
|
|
123
123
|
extend: SquareButton,
|
|
124
|
-
|
|
124
|
+
|
|
125
|
+
props: ({ key, state }) => ({
|
|
125
126
|
...buttonProps,
|
|
126
|
-
theme: '
|
|
127
|
-
|
|
127
|
+
theme: 'quaternary',
|
|
128
|
+
active: key === '18',
|
|
129
|
+
'.active': {
|
|
130
|
+
theme: 'quinary'
|
|
131
|
+
}
|
|
132
|
+
})
|
|
128
133
|
},
|
|
129
134
|
|
|
130
|
-
// Generate days
|
|
131
135
|
...new Array(31).fill(undefined).map((_, i) => ({ text: i + 1 }))
|
|
132
136
|
}
|
|
133
137
|
}
|
package/src/Input.js
CHANGED
package/src/Interaction.js
CHANGED
|
@@ -6,3 +6,37 @@ export const Interaction = {
|
|
|
6
6
|
cursor: ({ props }) => props.cursor && ({ cursor: props.cursor })
|
|
7
7
|
}
|
|
8
8
|
}
|
|
9
|
+
|
|
10
|
+
export const Hoverable = {
|
|
11
|
+
props: {
|
|
12
|
+
transition: 'B',
|
|
13
|
+
transitionProperty: 'opacity, transform',
|
|
14
|
+
opacity: 0.85,
|
|
15
|
+
|
|
16
|
+
':hover': {
|
|
17
|
+
opacity: 0.9,
|
|
18
|
+
transform: 'scale(1.015)'
|
|
19
|
+
},
|
|
20
|
+
':active': {
|
|
21
|
+
opacity: 1,
|
|
22
|
+
transform: 'scale(1.015)'
|
|
23
|
+
},
|
|
24
|
+
'.active': {
|
|
25
|
+
opacity: 1
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const Focusable = {
|
|
31
|
+
props: {
|
|
32
|
+
outline: 'none',
|
|
33
|
+
':focus-visible': {
|
|
34
|
+
opacity: 1,
|
|
35
|
+
outline: 'solid, X, blue .3'
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
attr: {
|
|
40
|
+
placeholder: ({ props }) => props.placeholder
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/Label.js
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
import { Block } from './Block'
|
|
3
|
-
import { Shape } from './Shape'
|
|
4
|
-
import { Text } from './Text'
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
extend: [Shape, Block, Text],
|
|
3
|
+
import { Button } from '.'
|
|
8
4
|
|
|
9
|
-
|
|
5
|
+
export const Label = {
|
|
6
|
+
extend: Button,
|
|
10
7
|
|
|
11
8
|
props: {
|
|
9
|
+
fontSize: 'Z',
|
|
12
10
|
emoji: '👍',
|
|
13
11
|
text: '3',
|
|
14
12
|
padding: 'X2 Z',
|
|
15
13
|
round: 'C',
|
|
16
|
-
|
|
14
|
+
lineHeight: 1,
|
|
15
|
+
gap: 'X2',
|
|
16
|
+
depth: 16,
|
|
17
|
+
fontWeight: '500',
|
|
18
|
+
background: 'blue .3',
|
|
19
|
+
color: 'white'
|
|
17
20
|
},
|
|
18
21
|
|
|
19
|
-
emoji:
|
|
22
|
+
emoji: {
|
|
23
|
+
props: ({ parent }) => ({ text: parent.props.emoji })
|
|
24
|
+
}
|
|
20
25
|
}
|
package/src/Link.js
CHANGED
package/src/Theme.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { isArray, isObject } from '@domql/utils'
|
|
4
3
|
import { getSpacingByKey, getMediaTheme, getColor, getMediaColor } from '@symbo.ls/scratch'
|
|
5
4
|
|
|
6
5
|
import { depth } from './Shape/style'
|
|
@@ -8,15 +7,14 @@ import { depth } from './Shape/style'
|
|
|
8
7
|
const isBorderStyle = str =>
|
|
9
8
|
['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial'].some(v => str.includes(v))
|
|
10
9
|
|
|
11
|
-
const transformBorder =
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (v.slice(-2) === 'px' || v.slice(-2) === 'em')
|
|
16
|
-
else if (
|
|
17
|
-
|
|
18
|
-
})
|
|
19
|
-
return obj
|
|
10
|
+
const transformBorder = border => {
|
|
11
|
+
const arr = border.split(', ')
|
|
12
|
+
return arr.map(v => {
|
|
13
|
+
if (isBorderStyle(v)) return v || 'solid'
|
|
14
|
+
else if (v.slice(-2) === 'px' || v.slice(-2) === 'em') return v // TODO: add map spacing
|
|
15
|
+
else if (getColor(v).length > 2) return getColor(v)
|
|
16
|
+
return getSpacingByKey(v, 'border').border
|
|
17
|
+
}).join(' ')
|
|
20
18
|
}
|
|
21
19
|
|
|
22
20
|
const transformTextStroke = stroke => ({
|
|
@@ -65,14 +63,28 @@ export const Theme = {
|
|
|
65
63
|
|
|
66
64
|
textStroke: ({ props }) => props.textStroke ? transformTextStroke(props.textStroke) : null,
|
|
67
65
|
|
|
68
|
-
|
|
66
|
+
outline: ({ props }) => props.outline && ({
|
|
67
|
+
outline: transformBorder(props.outline)
|
|
68
|
+
}),
|
|
69
|
+
|
|
70
|
+
border: ({ props }) => props.border && ({
|
|
71
|
+
border: transformBorder(props.border)
|
|
72
|
+
}),
|
|
69
73
|
borderColor: ({ props }) => (props.borderColor) && getMediaColor(props.borderColor, 'borderColor'),
|
|
70
74
|
borderStyle: ({ props }) => props.borderStyle && ({ borderStyle: props.borderStyle }),
|
|
71
75
|
|
|
72
|
-
borderLeft: ({ props }) => props.borderLeft
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
borderLeft: ({ props }) => props.borderLeft && ({
|
|
77
|
+
borderLeft: transformBorder(props.borderLeft)
|
|
78
|
+
}),
|
|
79
|
+
borderTop: ({ props }) => props.borderTop && ({
|
|
80
|
+
borderTop: transformBorder(props.borderTop)
|
|
81
|
+
}),
|
|
82
|
+
borderRight: ({ props }) => props.borderRight && ({
|
|
83
|
+
borderRight: transformBorder(props.borderRight)
|
|
84
|
+
}),
|
|
85
|
+
borderBottom: ({ props }) => props.borderBottom && ({
|
|
86
|
+
borderBottom: transformBorder(props.borderBottom)
|
|
87
|
+
}),
|
|
76
88
|
|
|
77
89
|
boxShadow: ({ props }) => props.boxShadow ? transformShadow(props.boxShadow) : null,
|
|
78
90
|
|
package/src/Timing.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { isString } from '@domql/utils'
|
|
4
|
+
import { getTimingByKey, getTimingFunction } from '@symbo.ls/scratch'
|
|
5
|
+
|
|
6
|
+
const transformTransition = transition => {
|
|
7
|
+
const arr = transition.split(' ')
|
|
8
|
+
|
|
9
|
+
if (!arr.length) return transition
|
|
10
|
+
|
|
11
|
+
return arr.map(v => {
|
|
12
|
+
if (v.length < 3 || v.includes('ms')) {
|
|
13
|
+
const mapWithSequence = getTimingByKey(v)
|
|
14
|
+
return mapWithSequence.timing || v
|
|
15
|
+
}
|
|
16
|
+
if (getTimingFunction(v)) return getTimingFunction(v)
|
|
17
|
+
return v
|
|
18
|
+
}).join(' ')
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const transformDuration = (duration, props, propertyName) => {
|
|
22
|
+
if (!isString(duration)) return
|
|
23
|
+
return duration.split(',').map(getTimingByKey).join(',')
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const splitTransition = transition => {
|
|
27
|
+
const arr = transition.split(',')
|
|
28
|
+
if (!arr.length) return
|
|
29
|
+
return arr.map(transformTransition).join(',')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const Timing = {
|
|
33
|
+
class: {
|
|
34
|
+
transition: ({ props }) => props.transition && ({
|
|
35
|
+
transition: splitTransition(props.transition)
|
|
36
|
+
}),
|
|
37
|
+
transitionDuration: ({ props }) => props.transitionDuration && ({
|
|
38
|
+
transitionDuration: transformDuration(props.transitionDuration)
|
|
39
|
+
}),
|
|
40
|
+
transitionDelay: ({ props }) => props.transitionDelay && ({
|
|
41
|
+
transitionDelay: transformDuration(props.transitionDelay)
|
|
42
|
+
}),
|
|
43
|
+
transitionTimingFunction: ({ props }) => props.transitionTimingFunction && ({
|
|
44
|
+
transitionTimingFunction: getTimingFunction(props.transitionTimingFunction)
|
|
45
|
+
}),
|
|
46
|
+
transitionProperty: ({ props }) => props.transitionProperty && ({
|
|
47
|
+
transitionProperty: props.transitionProperty,
|
|
48
|
+
willChange: props.transitionProperty
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
animationDuration: ({ props }) => props.animationDuration && ({
|
|
52
|
+
animationDuration: transformDuration(props.animationDuration)
|
|
53
|
+
}),
|
|
54
|
+
animationDelay: ({ props }) => props.animationDelay && ({
|
|
55
|
+
animationDelay: transformDuration(props.animationDelay)
|
|
56
|
+
}),
|
|
57
|
+
animationTimingFunction: ({ props }) => props.animationTimingFunction && ({
|
|
58
|
+
animationTimingFunction: getTimingFunction(props.animationTimingFunction)
|
|
59
|
+
}),
|
|
60
|
+
animationProperty: ({ props }) => props.animationProperty && ({
|
|
61
|
+
animationProperty: props.animationProperty,
|
|
62
|
+
willChange: props.animationProperty
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
}
|
package/src/index.js
CHANGED
|
@@ -17,7 +17,8 @@ export * from './Direction'
|
|
|
17
17
|
export * from './Position'
|
|
18
18
|
export * from './Overflow'
|
|
19
19
|
export * from './Transform'
|
|
20
|
-
export * from './
|
|
20
|
+
export * from './Timing'
|
|
21
|
+
|
|
21
22
|
export * from './Media'
|
|
22
23
|
export * from './Interaction'
|
|
23
24
|
export * from './XYZ'
|
package/src/Transition.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { getTimingByKey } from '@symbo.ls/scratch'
|
|
4
|
-
|
|
5
|
-
const transformTransition = transition => {
|
|
6
|
-
const arr = transition.split(' ')
|
|
7
|
-
|
|
8
|
-
if (!arr.length) return transition
|
|
9
|
-
|
|
10
|
-
return arr.map(v => {
|
|
11
|
-
if (v.length < 3 || v.includes('ms')) {
|
|
12
|
-
const mapWithSequence = getTimingByKey(v)
|
|
13
|
-
return mapWithSequence.duration
|
|
14
|
-
}
|
|
15
|
-
return v
|
|
16
|
-
}).join(' ')
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const splitTransition = transition => {
|
|
20
|
-
const arr = transition.split(',')
|
|
21
|
-
if (!arr.length) return
|
|
22
|
-
return {
|
|
23
|
-
transition: arr.map(transformTransition).join(',')
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const Transition = {
|
|
28
|
-
class: {
|
|
29
|
-
transition: ({ props }) => props.transition && splitTransition(props.transition),
|
|
30
|
-
transitionEasing: ({ props }) => props.transitionEasing && ({ transitionEasing: props.transitionEasing }),
|
|
31
|
-
transitionTimingFunction: ({ props }) => props.transitionTimingFunction && ({ transitionTimingFunction: props.transitionTimingFunction }),
|
|
32
|
-
transitionProperty: ({ props }) => props.transitionProperty && ({
|
|
33
|
-
transitionProperty: props.transitionProperty,
|
|
34
|
-
willChange: props.transitionProperty
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
}
|