smbls 0.8.10 → 0.8.13
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/Block/index.js +4 -5
- package/src/Icon/index.js +1 -1
- package/src/Shape/index.js +3 -1
- package/src/Text/index.js +1 -0
package/package.json
CHANGED
package/src/Block/index.js
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import { SPACING, mapSpacing } from '@symbo.ls/scratch'
|
|
4
4
|
|
|
5
|
-
export const mapBasedOnRatio = (props, prop) => {
|
|
5
|
+
export const mapBasedOnRatio = (props, prop, unit) => {
|
|
6
6
|
const { spacingRatio } = props
|
|
7
7
|
const val = props[prop]
|
|
8
|
+
// TODO: move this to mapSpacing
|
|
8
9
|
if (spacingRatio) {
|
|
9
10
|
const params = SPACING[spacingRatio]
|
|
10
11
|
|
|
@@ -20,11 +21,9 @@ export const mapBasedOnRatio = (props, prop) => {
|
|
|
20
21
|
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return result
|
|
24
|
+
return mapSpacing(val, prop, params, unit)
|
|
26
25
|
}
|
|
27
|
-
return mapSpacing(val, prop)
|
|
26
|
+
return mapSpacing(val, prop, null, unit)
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
export const Block = {
|
package/src/Icon/index.js
CHANGED
package/src/Shape/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
+
import { isArray, isObject } from '@domql/utils'
|
|
3
4
|
import { mapSpacing, getTheme, getColor } from '@symbo.ls/scratch'
|
|
4
5
|
|
|
5
6
|
import style, { shape, depth } from './style'
|
|
@@ -9,7 +10,7 @@ const isBorderStyle = str =>
|
|
|
9
10
|
|
|
10
11
|
const diffBorder = (border, key = 'border') => {
|
|
11
12
|
const obj = {}
|
|
12
|
-
const arr = border.split(' ')
|
|
13
|
+
const arr = isObject(border) ? Object.values(border) : isArray(border) ? border : border.split(', ')
|
|
13
14
|
arr.map(v => {
|
|
14
15
|
if (v.includes('px')) obj[`${key}Width`] = v
|
|
15
16
|
else if (isBorderStyle(v)) obj[`${key}Style`] = v || 'solid'
|
|
@@ -26,6 +27,7 @@ export const Shape = {
|
|
|
26
27
|
shapeDirectionColor: ({ props, ...el }) => props.shapeDirection ? { '&:before': { borderColor: el.class.backgroundColor } } : null,
|
|
27
28
|
depth: ({ props }) => depth[props.depth],
|
|
28
29
|
round: ({ props, key, ...el }) => props.round ? (mapSpacing(props.round, 'borderRadius') || ({ borderRadius: props.round })) : null,
|
|
30
|
+
borderRadius: ({ props, key, ...el }) => props.borderRadius ? (mapSpacing(props.borderRadius, 'borderRadius') || ({ borderRadius: props.borderRadius })) : null,
|
|
29
31
|
theme: ({ props }) => props.theme ? getTheme(props.theme) : null,
|
|
30
32
|
color: ({ props }) => props.color ? ({ color: getColor(props.color) }) : null,
|
|
31
33
|
background: ({ props }) => props.background ? ({ backgroundColor: getColor(props.background) }) : null,
|
package/src/Text/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export const Text = {
|
|
|
11
11
|
fontSize: ({ props }) => props.fontSize ? mapFontSize(props.fontSize) : null,
|
|
12
12
|
fontFamily: ({ props }) => props.fontFamily && ({ fontFamily: getFontFamily(FONT_FAMILY, props.fontFamily) || props.fontFamily }),
|
|
13
13
|
lineHeight: ({ props }) => props.lineHeight && ({ lineHeight: props.lineHeight }),
|
|
14
|
+
// lineHeight: ({ props }) => props.lineHeight && mapBasedOnRatio(props, 'lineHeight', null, ''),
|
|
14
15
|
textDecoration: ({ props }) => props.textDecoration && ({ textDecoration: props.textDecoration }),
|
|
15
16
|
textTransform: ({ props }) => props.textTransform && ({ textTransform: props.textTransform }),
|
|
16
17
|
textAlign: ({ props }) => props.textAlign && ({ textAlign: props.textAlign }),
|