smbls 0.14.4 → 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/Button.js +2 -3
- 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/index.js +1 -0
package/package.json
CHANGED
package/src/Button.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
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
9
|
fontFamily: 'inherit',
|
|
11
10
|
'& > *': {
|
|
@@ -14,7 +13,7 @@ const style = {
|
|
|
14
13
|
}
|
|
15
14
|
|
|
16
15
|
export const Button = {
|
|
17
|
-
extend: IconText,
|
|
16
|
+
extend: [Focusable, IconText],
|
|
18
17
|
tag: 'button',
|
|
19
18
|
props: {
|
|
20
19
|
fontSize: 'A',
|
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
|
|