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 CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "UI Library built on Scratch and DOMQL",
4
4
  "private": false,
5
5
  "author": "symbo.ls",
6
- "version": "0.8.10",
6
+ "version": "0.8.13",
7
7
  "repository": "https://github.com/rackai/symbols",
8
8
  "main": "src/index.js",
9
9
  "files": [
@@ -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
- const result = mapSpacing(val, prop, params)
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
@@ -8,7 +8,7 @@ export const Icon = {
8
8
  proto: SVG,
9
9
  style,
10
10
  define: { name: param => param },
11
- name: ({ props }) => props.icon,
11
+ name: ({ props }) => props.name || props.icon,
12
12
  attr: { viewBox: '0 0 24 24' },
13
13
  src: ({ key, name }) => name || key || 'noIcon'
14
14
  }
@@ -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 }),