smbls 0.8.22 → 0.8.25
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/index.js +1 -1
- package/src/Button/index.js +16 -17
- package/src/Button/style.js +0 -5
- package/src/Field.js +40 -0
- package/src/Flex/index.js +11 -1
- package/src/Icon.js +28 -0
- package/src/IconText.js +20 -0
- package/src/{Input/index.js → Input.js} +1 -1
- package/src/Media/index.js +3 -4
- package/src/SVG/index.js +3 -3
- package/src/{Select/index.js → Select.js} +9 -5
- package/src/Shape/index.js +1 -1
- package/src/Field/index.js +0 -21
- package/src/Field/style.js +0 -30
- package/src/Icon/index.js +0 -14
- package/src/Icon/style.js +0 -8
- package/src/IconText/index.js +0 -22
- package/src/IconText/style.js +0 -7
- package/src/Select/style.js +0 -8
package/package.json
CHANGED
package/src/Box/index.js
CHANGED
package/src/Button/index.js
CHANGED
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { IconText } from '../'
|
|
4
|
+
|
|
5
|
+
const css = {
|
|
6
|
+
appearance: 'none',
|
|
7
|
+
border: 'none',
|
|
8
|
+
outline: 0,
|
|
9
|
+
cursor: 'pointer',
|
|
10
|
+
fontFamily: 'inherit'
|
|
11
|
+
}
|
|
6
12
|
|
|
7
13
|
export const Button = {
|
|
8
14
|
proto: IconText,
|
|
9
15
|
tag: 'button',
|
|
10
|
-
style,
|
|
11
16
|
props: {
|
|
12
17
|
type: 'button',
|
|
13
18
|
display: 'inline-flex',
|
|
14
19
|
alignItems: 'center',
|
|
15
20
|
justifyContent: 'center',
|
|
16
|
-
textDecoration: 'none'
|
|
21
|
+
textDecoration: 'none',
|
|
22
|
+
css
|
|
17
23
|
},
|
|
18
24
|
attr: {
|
|
19
25
|
type: ({ props }) => props.type
|
|
@@ -28,10 +34,8 @@ export const SquareButton = {
|
|
|
28
34
|
padding: 'Z',
|
|
29
35
|
aspectRatio: '1 / 1',
|
|
30
36
|
justifyContent: 'center',
|
|
31
|
-
round: 'Z'
|
|
32
|
-
|
|
33
|
-
class: {
|
|
34
|
-
squareButton: { boxSizing: 'content-box' }
|
|
37
|
+
round: 'Z',
|
|
38
|
+
css: { boxSizing: 'content-box' }
|
|
35
39
|
}
|
|
36
40
|
}
|
|
37
41
|
|
|
@@ -42,15 +46,10 @@ export const CircleButton = {
|
|
|
42
46
|
|
|
43
47
|
export const KangorooButton = {
|
|
44
48
|
tag: 'button',
|
|
45
|
-
|
|
49
|
+
props: { css },
|
|
46
50
|
|
|
47
|
-
iconText: {
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
child: {
|
|
52
|
-
proto: [IconText]
|
|
53
|
-
}
|
|
51
|
+
iconText: { proto: IconText },
|
|
52
|
+
child: { proto: IconText }
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
export default Button
|
package/src/Button/style.js
CHANGED
package/src/Field.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { IconText, Input } from '.'
|
|
4
|
+
|
|
5
|
+
export const Field = {
|
|
6
|
+
proto: IconText,
|
|
7
|
+
props: (el, s) => ({
|
|
8
|
+
value: s[el.key],
|
|
9
|
+
|
|
10
|
+
depth: 16,
|
|
11
|
+
placeholder: '',
|
|
12
|
+
padding: 'A B',
|
|
13
|
+
round: 'C',
|
|
14
|
+
type: 'text',
|
|
15
|
+
position: 'relative',
|
|
16
|
+
width: '16em',
|
|
17
|
+
|
|
18
|
+
css: {
|
|
19
|
+
appearance: 'none',
|
|
20
|
+
outline: 0,
|
|
21
|
+
border: 'none',
|
|
22
|
+
cursor: 'pointer',
|
|
23
|
+
fontFamily: 'inherit',
|
|
24
|
+
boxSizing: 'border-box'
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
input: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
height: '100%',
|
|
30
|
+
border: 'none'
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
svg: {
|
|
34
|
+
position: 'absolute',
|
|
35
|
+
right: '1em'
|
|
36
|
+
}
|
|
37
|
+
}),
|
|
38
|
+
|
|
39
|
+
input: { proto: Input }
|
|
40
|
+
}
|
package/src/Flex/index.js
CHANGED
|
@@ -16,6 +16,16 @@ export const Flex = {
|
|
|
16
16
|
alignItems: ({ props }) => props.alignItems && ({ alignItems: props.alignItems }),
|
|
17
17
|
alignContent: ({ props }) => props.alignContent && ({ alignContent: props.alignContent }),
|
|
18
18
|
justifyContent: ({ props }) => props.justifyContent && ({ justifyContent: props.justifyContent }),
|
|
19
|
-
gap: ({ props }) => props.gap && mapBasedOnRatio(props, 'gap')
|
|
19
|
+
gap: ({ props }) => props.gap && mapBasedOnRatio(props, 'gap'),
|
|
20
|
+
|
|
21
|
+
align: ({ props }) => {
|
|
22
|
+
if (typeof props.align !== 'string') return
|
|
23
|
+
const [alignItems, justifyContent] = props.align.split(' ')
|
|
24
|
+
return {
|
|
25
|
+
display: 'flex',
|
|
26
|
+
alignItems: alignItems,
|
|
27
|
+
justifyContent: justifyContent
|
|
28
|
+
}
|
|
29
|
+
}
|
|
20
30
|
}
|
|
21
31
|
}
|
package/src/Icon.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { SVG } from '.'
|
|
4
|
+
|
|
5
|
+
import { ICONS } from '@symbo.ls/scratch'
|
|
6
|
+
|
|
7
|
+
export const Icon = {
|
|
8
|
+
proto: SVG,
|
|
9
|
+
props: ({ key, props, parent }) => {
|
|
10
|
+
let iconName = props.inheritedString || props.name || props.icon || key || 'noIcon'
|
|
11
|
+
|
|
12
|
+
const isArray = iconName.split(' ')
|
|
13
|
+
const secondArg = props.iconModifier || isArray[1]
|
|
14
|
+
|
|
15
|
+
if (secondArg) iconName = isArray[0] + secondArg.slice(0, 1).toUpperCase() + secondArg.slice(1)
|
|
16
|
+
|
|
17
|
+
const iconFromLibrary = ICONS[iconName]
|
|
18
|
+
|
|
19
|
+
return {
|
|
20
|
+
width: 'A',
|
|
21
|
+
height: 'A',
|
|
22
|
+
display: 'inline-block',
|
|
23
|
+
src: iconFromLibrary,
|
|
24
|
+
css: { fill: 'currentColor' }
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
attr: { viewBox: '0 0 24 24' }
|
|
28
|
+
}
|
package/src/IconText.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { Flex, Icon } from '.'
|
|
4
|
+
|
|
5
|
+
export const IconText = {
|
|
6
|
+
proto: Flex,
|
|
7
|
+
|
|
8
|
+
props: {
|
|
9
|
+
align: 'center center',
|
|
10
|
+
lineHeight: 1
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
icon: {
|
|
14
|
+
proto: Icon,
|
|
15
|
+
if: ({ parent }) => parent.props.icon,
|
|
16
|
+
props: 'match'
|
|
17
|
+
},
|
|
18
|
+
|
|
19
|
+
text: ({ props }) => props.text
|
|
20
|
+
}
|
package/src/Media/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { MEDIA as BREAKPOINTS } from '@symbo.ls/scratch'
|
|
4
4
|
|
|
5
5
|
export const Responsive = {
|
|
6
6
|
on: {
|
|
@@ -10,7 +10,7 @@ export const Responsive = {
|
|
|
10
10
|
for (const screen in props) {
|
|
11
11
|
if (screen.slice(0, 1) === '@') {
|
|
12
12
|
const mediaName = screen.slice(1)
|
|
13
|
-
const responsiveKey = `@media screen and ${
|
|
13
|
+
const responsiveKey = `@media screen and ${BREAKPOINTS[mediaName]}`
|
|
14
14
|
const screenProps = props[screen]
|
|
15
15
|
const calculatedScreenProps = {}
|
|
16
16
|
|
|
@@ -39,11 +39,10 @@ export const Responsive = {
|
|
|
39
39
|
}
|
|
40
40
|
} else if (screen.slice(0, 1) === ':') {
|
|
41
41
|
const selectorProps = {}
|
|
42
|
-
const selectorName = screen.slice(1)
|
|
42
|
+
// const selectorName = screen.slice(1)
|
|
43
43
|
const underSelectorProps = props[screen]
|
|
44
44
|
const selectorKey = `&${screen}`
|
|
45
45
|
|
|
46
|
-
|
|
47
46
|
for (const prop in underSelectorProps) {
|
|
48
47
|
const classProp = el.class[prop]
|
|
49
48
|
if (typeof classProp !== 'function') continue
|
package/src/SVG/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const useSVGSymbol = file => `<use xlink:href="${file}" />`
|
|
4
4
|
|
|
5
5
|
// create icon
|
|
6
6
|
export const SVG = {
|
|
@@ -9,6 +9,6 @@ export const SVG = {
|
|
|
9
9
|
xmlns: 'http://www.w3.org/2000/svg',
|
|
10
10
|
'xmlns:xlink': 'http://www.w3.org/1999/xlink'
|
|
11
11
|
},
|
|
12
|
-
define: { src: param => param },
|
|
13
|
-
html: ({ key,
|
|
12
|
+
// define: { src: param => param },
|
|
13
|
+
html: ({ key, props }) => useSVGSymbol(props.src || key)
|
|
14
14
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import Shape from '../Shape'
|
|
4
|
-
import style from './style'
|
|
5
|
-
|
|
6
3
|
export const Select = {
|
|
7
|
-
proto: Shape,
|
|
8
4
|
tag: 'select',
|
|
9
|
-
|
|
5
|
+
|
|
6
|
+
props: {
|
|
7
|
+
fontSize: 'A',
|
|
8
|
+
css: {
|
|
9
|
+
border: 'none',
|
|
10
|
+
boxSizing: 'border-box',
|
|
11
|
+
cursor: 'pointer'
|
|
12
|
+
}
|
|
13
|
+
},
|
|
10
14
|
|
|
11
15
|
childProto: {
|
|
12
16
|
tag: 'option',
|
package/src/Shape/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { mapSpacing, getTheme, getColor } from '@symbo.ls/scratch'
|
|
|
6
6
|
import style, { SHAPES, depth } from './style'
|
|
7
7
|
|
|
8
8
|
const isBorderStyle = str =>
|
|
9
|
-
['none','hidden','dotted','dashed','solid','double','groove','ridge','inset','outset','initial'].some(v => str.includes(v))
|
|
9
|
+
['none', 'hidden', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset', 'initial'].some(v => str.includes(v))
|
|
10
10
|
|
|
11
11
|
const diffBorder = (border, key = 'border') => {
|
|
12
12
|
const obj = {}
|
package/src/Field/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { IconText, Input } from '../'
|
|
4
|
-
import style from './style'
|
|
5
|
-
|
|
6
|
-
export const Field = {
|
|
7
|
-
style,
|
|
8
|
-
proto: [IconText],
|
|
9
|
-
props: (el, s) => ({
|
|
10
|
-
depth: 16,
|
|
11
|
-
placeholder: '',
|
|
12
|
-
value: s[el.key],
|
|
13
|
-
padding: 'A B',
|
|
14
|
-
round: 'C',
|
|
15
|
-
type: 'text'
|
|
16
|
-
}),
|
|
17
|
-
input: {
|
|
18
|
-
proto: Input,
|
|
19
|
-
props: el => el.parent.props
|
|
20
|
-
}
|
|
21
|
-
}
|
package/src/Field/style.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { TYPOGRAPHY } from '@symbo.ls/scratch'
|
|
4
|
-
|
|
5
|
-
const primaryFont = Object.keys(TYPOGRAPHY)[0]
|
|
6
|
-
const defaultFont = primaryFont || '--system-default'
|
|
7
|
-
|
|
8
|
-
export default {
|
|
9
|
-
appearance: 'none',
|
|
10
|
-
outline: 0,
|
|
11
|
-
border: 'none',
|
|
12
|
-
cursor: 'pointer',
|
|
13
|
-
fontFamily: 'inherit',
|
|
14
|
-
boxSizing: 'border-box',
|
|
15
|
-
position: 'relative',
|
|
16
|
-
padding: 0,
|
|
17
|
-
|
|
18
|
-
width: '16em',
|
|
19
|
-
|
|
20
|
-
input: {
|
|
21
|
-
width: '100%',
|
|
22
|
-
height: '100%',
|
|
23
|
-
border: 'none'
|
|
24
|
-
},
|
|
25
|
-
|
|
26
|
-
svg: {
|
|
27
|
-
position: 'absolute',
|
|
28
|
-
right: '1em'
|
|
29
|
-
}
|
|
30
|
-
}
|
package/src/Icon/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import style from './style'
|
|
4
|
-
|
|
5
|
-
import { SVG } from '..'
|
|
6
|
-
|
|
7
|
-
export const Icon = {
|
|
8
|
-
proto: SVG,
|
|
9
|
-
style,
|
|
10
|
-
define: { name: param => param },
|
|
11
|
-
name: ({ props }) => props.name || props.icon,
|
|
12
|
-
attr: { viewBox: '0 0 24 24' },
|
|
13
|
-
src: ({ key, name }) => name || key || 'noIcon'
|
|
14
|
-
}
|
package/src/Icon/style.js
DELETED
package/src/IconText/index.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict'
|
|
2
|
-
|
|
3
|
-
import { Icon } from '../Icon'
|
|
4
|
-
|
|
5
|
-
export const IconText = {
|
|
6
|
-
props: {
|
|
7
|
-
flexAlign: 'center flex-start',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
alignItems: 'center',
|
|
10
|
-
alignContent: 'center',
|
|
11
|
-
lineHeight: 1,
|
|
12
|
-
icon: 'noicon'
|
|
13
|
-
},
|
|
14
|
-
|
|
15
|
-
icon: {
|
|
16
|
-
proto: Icon,
|
|
17
|
-
if: ({ parent }) => parent.props.icon,
|
|
18
|
-
props: ({ parent }) => ({ icon: parent.props.icon })
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
text: ({ props }) => props.text
|
|
22
|
-
}
|
package/src/IconText/style.js
DELETED