smbls 0.7.0 → 0.8.3

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.
Files changed (54) hide show
  1. package/README.md +25 -0
  2. package/package.json +24 -36
  3. package/src/Banner/index.js +24 -0
  4. package/src/Banner/style.js +27 -0
  5. package/src/Block/index.js +95 -0
  6. package/src/Block/style.js +1 -0
  7. package/src/Box/index.js +10 -0
  8. package/src/Button/index.js +54 -0
  9. package/src/Button/style.js +13 -0
  10. package/src/ButtonSet/index.js +14 -0
  11. package/src/DatePicker/index.js +115 -0
  12. package/src/DatePicker/style.js +100 -0
  13. package/src/Direction/index.js +10 -0
  14. package/src/Dropdown/index.js +42 -0
  15. package/src/Dropdown/style.js +37 -0
  16. package/src/Field/index.js +21 -0
  17. package/src/Field/style.js +30 -0
  18. package/src/Flex/index.js +20 -0
  19. package/src/Flex/style.js +5 -0
  20. package/src/Grid/index.js +18 -0
  21. package/src/Grid/style.js +5 -0
  22. package/src/GridLayouts/index.js +20 -0
  23. package/src/GridLayouts/style.js +47 -0
  24. package/src/Icon/index.js +14 -0
  25. package/src/Icon/style.js +8 -0
  26. package/src/IconText/index.js +18 -0
  27. package/src/IconText/style.js +12 -0
  28. package/src/Img/index.js +17 -0
  29. package/src/Input/index.js +32 -0
  30. package/src/Label/index.js +20 -0
  31. package/src/Link/index.js +19 -0
  32. package/src/Notification/index.js +37 -0
  33. package/src/Overflow/index.js +7 -0
  34. package/src/Pills/index.js +30 -0
  35. package/src/Position/index.js +27 -0
  36. package/src/Responsive/index.js +48 -0
  37. package/src/SVG/index.js +14 -0
  38. package/src/Select/index.js +24 -0
  39. package/src/Select/style.js +8 -0
  40. package/src/Shape/index.js +66 -0
  41. package/src/Shape/style.js +102 -0
  42. package/src/SideBar/index.js +22 -0
  43. package/src/Slider/index.js +89 -0
  44. package/src/Slider/style.js +19 -0
  45. package/src/Text/index.js +18 -0
  46. package/src/Text/style.js +2 -0
  47. package/src/Tooltip/index.js +13 -0
  48. package/src/Tooltip/style.js +12 -0
  49. package/src/Transform/index.js +9 -0
  50. package/src/User/index.js +25 -0
  51. package/src/User/style.js +19 -0
  52. package/src/index.js +39 -0
  53. package/src/styles.js +7 -0
  54. package/index.js +0 -35
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Symbols
2
+
3
+ UI Library in composition of [Scratch](https://github.com/smbo-ls/scratch) and [DOMQL](https://github.com/domql/domql)
4
+
5
+ [![npm version](https://badge.fury.io/js/smbls.svg)](https://badge.fury.io/js/smbls)
6
+
7
+ ### Setup
8
+
9
+ 1. Installation
10
+ ```
11
+ yarn add smbls
12
+ ```
13
+
14
+ 2. Import the component from Symbols
15
+ ```
16
+ import { Box } from 'smbls'
17
+ ```
18
+
19
+ 3. Use it inside your DOMQL code
20
+ ```
21
+ const Header = {
22
+ proto: Box,
23
+ // ...Other Properties
24
+ }
25
+ ```
package/package.json CHANGED
@@ -1,48 +1,36 @@
1
1
  {
2
2
  "name": "smbls",
3
3
  "description": "UI Library built on Scratch and DOMQL",
4
- "version": "0.7.0",
4
+ "private": false,
5
+ "author": "symbo.ls",
6
+ "version": "0.8.3",
5
7
  "repository": "https://github.com/rackai/symbols",
6
- "main": "index.js",
8
+ "main": "src/index.js",
7
9
  "files": [
8
10
  "src"
9
11
  ],
10
12
  "publishConfig": {
11
13
  "registry": "https://registry.npmjs.org"
12
14
  },
13
- "dependencies": {
14
- "@symbo.ls/banner": "latest",
15
- "@symbo.ls/block": "latest",
16
- "@symbo.ls/box": "latest",
17
- "@symbo.ls/button": "latest",
18
- "@symbo.ls/buttonset": "latest",
19
- "@symbo.ls/config-default": "latest",
20
- "@symbo.ls/datepicker": "latest",
21
- "@symbo.ls/direction": "latest",
22
- "@symbo.ls/dropdown": "latest",
23
- "@symbo.ls/field": "latest",
24
- "@symbo.ls/flex": "latest",
25
- "@symbo.ls/grid": "latest",
26
- "@symbo.ls/icon": "latest",
27
- "@symbo.ls/icon-text": "latest",
28
- "@symbo.ls/img": "latest",
29
- "@symbo.ls/input": "latest",
30
- "@symbo.ls/label": "latest",
31
- "@symbo.ls/link": "latest",
32
- "@symbo.ls/notification": "latest",
33
- "@symbo.ls/overflow": "latest",
34
- "@symbo.ls/pills": "latest",
35
- "@symbo.ls/position": "latest",
36
- "@symbo.ls/responsive": "latest",
37
- "@symbo.ls/select": "latest",
38
- "@symbo.ls/shape": "latest",
39
- "@symbo.ls/slider": "latest",
40
- "@symbo.ls/svg": "latest",
41
- "@symbo.ls/text": "latest",
42
- "@symbo.ls/tooltip": "latest",
43
- "@symbo.ls/user": "latest"
15
+ "scripts": {
16
+ "start": "parcel showcase/index.html",
17
+ "build": "parcel build showcase/index.html --public-url .",
18
+ "deploy": "yarn build && gh-pages -d dist",
19
+ "clean": "rm yarn.lock && rm -rf node_modules && rm -rf dist && rm -rf .cache",
20
+ "reinstall": "rm yarn.lock && rm -rf node_modules/rackai && yarn",
21
+ "bump": "npx np"
44
22
  },
45
- "browserslist": "> 0.5%, last 2 versions, not dead",
46
- "gitHead": "54fa6500c697604b3f48ba33a573545d7bff35fa",
47
- "source": "src/index.js"
23
+ "dependencies": {},
24
+ "devDependencies": {
25
+ "@babel/core": "^7.14.6",
26
+ "babel-eslint": "^10.0.3",
27
+ "emotion": "^10.0.27",
28
+ "np": "^7.2.0",
29
+ "parcel-bundler": "^1.12.3",
30
+ "parcel-plugin-svg-sprite": "^1.4.1",
31
+ "standard": "^13.1.0"
32
+ },
33
+ "standard": {
34
+ "parser": "babel-eslint"
35
+ }
48
36
  }
@@ -0,0 +1,24 @@
1
+ 'use strict'
2
+
3
+ import { Shape, Img, Icon } from '../'
4
+
5
+ import { UserBundle } from '../User'
6
+
7
+ import { styleParentMode } from './style'
8
+
9
+ export const ParentMode = {
10
+ proto: Shape,
11
+ round: 10,
12
+ theme: 'purple',
13
+ style: styleParentMode,
14
+ icon: {
15
+ proto: Icon,
16
+ props: { icon: 'checkMedium' }
17
+ },
18
+ h2: 'Welcome to parent Mode',
19
+ description: {
20
+ proto: UserBundle,
21
+ users: { ...[{}, {}, {}] },
22
+ span: 'You’ll now be able to chat with tutor privately. No other participants will see the messages.'
23
+ }
24
+ }
@@ -0,0 +1,27 @@
1
+ 'use strict'
2
+
3
+ export const styleParentMode = {
4
+ boxSizing: 'border-box',
5
+ padding: '3.6em 1.6em 4em 3.6em',
6
+ position: 'relative',
7
+ display: 'block',
8
+ width: '700px',
9
+ '> svg': {
10
+ position: 'absolute',
11
+ top: '1.2em',
12
+ right: '1.2em',
13
+ color: 'rgba(215, 100, 185, .2)'
14
+ },
15
+ '> div': {
16
+ alignItems: 'flex-start',
17
+ '> div': { marginTop: '4px'}
18
+ },
19
+ h2: {
20
+ margin: 0,
21
+ marginBottom: '10px'
22
+ },
23
+ span: {
24
+ maxWidth: `${314 / 14}em`,
25
+ lineHeight: '22px'
26
+ }
27
+ }
@@ -0,0 +1,95 @@
1
+ 'use strict'
2
+
3
+ import { SPACING, mapSpacing } from '@symbo.ls/scratch'
4
+
5
+ export const mapBasedOnRatio = (props, prop) => {
6
+ const { spacingRatio } = props
7
+ const val = props[prop]
8
+ if (spacingRatio) {
9
+ const params = SPACING[spacingRatio]
10
+
11
+ if (!params) {
12
+ SPACING[spacingRatio] = {
13
+ base: SPACING.base,
14
+ type: 'spacing',
15
+ ratio: spacingRatio,
16
+ range: [-5, +7],
17
+ subSequence: true,
18
+ sequence: {},
19
+ scales: {}
20
+ }
21
+ }
22
+
23
+ const result = mapSpacing(val, prop, params)
24
+
25
+ return result
26
+ }
27
+ return mapSpacing(val, prop)
28
+ }
29
+
30
+ export const Block = {
31
+ props: {},
32
+
33
+ class: {
34
+ display: ({ props }) => ({ display: props.display }),
35
+
36
+ width: ({ props }) => props.width && mapBasedOnRatio(props, 'width'),
37
+ height: ({ props }) => props.height && mapBasedOnRatio(props, 'height'),
38
+ boxSize: ({ props }) => {
39
+ if (typeof props.boxSize !== 'string') return
40
+ const [width, height] = props.boxSize.split(' ')
41
+ return {
42
+ ...mapSpacing(width, 'width'),
43
+ ...mapSpacing(height, 'height')
44
+ }
45
+ },
46
+
47
+ maxWidth: ({ props }) => props.maxWidth && mapBasedOnRatio(props, 'maxWidth'),
48
+ minWidth: ({ props }) => props.minWidth && mapBasedOnRatio(props, 'minWidth'),
49
+ widthRange: ({ props }) => {
50
+ if (typeof props.widthRange !== 'string') return
51
+ const [minWidth, maxWidth] = props.widthRange.split(' ')
52
+ return {
53
+ ...mapSpacing(minWidth, 'minWidth'),
54
+ ...mapSpacing(maxWidth, 'maxWidth')
55
+ }
56
+ },
57
+
58
+ maxHeight: ({ props }) => props.maxHeight && mapBasedOnRatio(props, 'maxHeight'),
59
+ minHeight: ({ props }) => props.minHeight && mapBasedOnRatio(props, 'minHeight'),
60
+ heightRange: ({ props }) => {
61
+ if (typeof props.heightRange !== 'string') return
62
+ const [minHeight, maxHeight] = props.heightRange.split(' ')
63
+ return {
64
+ ...mapSpacing(minHeight, 'minHeight'),
65
+ ...mapSpacing(maxHeight, 'maxHeight')
66
+ }
67
+ },
68
+
69
+ aspectRatio: ({ props }) => ({ aspectRatio: props.aspectRatio }),
70
+
71
+ padding: ({ props }) => mapBasedOnRatio(props, 'padding'),
72
+ margin: ({ props }) => mapBasedOnRatio(props, 'margin'),
73
+ gap: ({ props }) => mapBasedOnRatio(props, 'gap'),
74
+
75
+ flexFlow: ({ props }) => props.flexFlow && ({
76
+ display: 'flex',
77
+ flexFlow: props.flexFlow
78
+ }),
79
+ flexAlign: ({ props }) => {
80
+ if (typeof props.flexAlign !== 'string') return
81
+ const [alignItems, justifyContent] = props.flexAlign.split(' ')
82
+ return {
83
+ display: 'flex',
84
+ alignItems: alignItems,
85
+ justifyContent: justifyContent
86
+ }
87
+ },
88
+ flex: ({ props }) => props.flex && ({ flex: props.flex }),
89
+
90
+ size: ({ props }) => {
91
+ // if (typeof props.size !== 'string') return
92
+ // const [fontSize, padding, margin] = props.size.split(' ')
93
+ }
94
+ }
95
+ }
@@ -0,0 +1 @@
1
+ 'use strict'
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ import { Shape, Position, Block, Text, Responsive } from '..'
4
+
5
+ export const Box = {
6
+ proto: [Shape, Position, Block, Text, Responsive],
7
+ class: {
8
+ fromProps: ({ props }) => props && props.css
9
+ }
10
+ }
@@ -0,0 +1,54 @@
1
+ 'use strict'
2
+
3
+ import { Shape, Block, IconText, Direction } from '../'
4
+
5
+ import style from './style'
6
+
7
+ export const Button = {
8
+ proto: [IconText],
9
+ tag: 'button',
10
+ style,
11
+ props: {
12
+ type: 'button'
13
+ },
14
+ attr: {
15
+ type: ({ props }) => props.type
16
+ }
17
+ }
18
+
19
+ export const SquareButton = {
20
+ proto: Button,
21
+ props: {
22
+ fontSize: 'A',
23
+ width: 'A',
24
+ padding: 'Z',
25
+ aspectRatio: '1 / 1',
26
+ round: 'Z'
27
+ },
28
+ class: {
29
+ squareButton: {
30
+ justifyContent: 'center',
31
+ boxSizing: 'content-box'
32
+ }
33
+ }
34
+ }
35
+
36
+ export const CircleButton = {
37
+ proto: SquareButton,
38
+ props: { round: 'C' }
39
+ }
40
+
41
+ export const KangorooButton = {
42
+ tag: 'button',
43
+ style,
44
+
45
+ iconText: {
46
+ proto: IconText
47
+ },
48
+
49
+ child: {
50
+ proto: [IconText]
51
+ }
52
+ }
53
+
54
+ export default Button
@@ -0,0 +1,13 @@
1
+ 'use strict'
2
+
3
+ export default {
4
+ appearance: 'none',
5
+ border: 'none',
6
+ outline: 0,
7
+ cursor: 'pointer',
8
+ fontFamily: 'inherit',
9
+ display: 'inline-flex',
10
+ alignItems: 'center',
11
+ justifyContent: 'center',
12
+ textDecoration: 'none'
13
+ }
@@ -0,0 +1,14 @@
1
+ 'use strict'
2
+
3
+ import { SquareButton } from '../Button'
4
+ import { Shape } from '../Shape'
5
+ import { Flex } from '../Flex'
6
+ import { Block } from '../Block'
7
+
8
+ export const ButtonSet = {
9
+ tag: 'nav',
10
+ proto: [Shape, Flex, Block],
11
+ childProto: {
12
+ proto: [SquareButton]
13
+ }
14
+ }
@@ -0,0 +1,115 @@
1
+ 'use strict'
2
+
3
+ import style from './style'
4
+
5
+ import Icon from '../Icon'
6
+ import Shape from '../Shape'
7
+ import { Block } from '../Block'
8
+
9
+ export const DatePicker = {
10
+ style,
11
+
12
+ proto: [Shape, Block],
13
+ props: {
14
+ theme: 'lightDark',
15
+ padding: 'A',
16
+ round: 'Z',
17
+ depth: 16
18
+ },
19
+
20
+ aside: {
21
+ childProto: { tag: 'button' },
22
+ ...[
23
+ { text: '2020' },
24
+ { text: '2021' },
25
+ { text: '2022' },
26
+ { text: '2023' },
27
+ { text: '2024' },
28
+ { text: '2025' },
29
+ { text: '2026' },
30
+ { text: '2026' },
31
+ { text: '2026' }
32
+ ]
33
+ },
34
+
35
+ main: {
36
+ header: {
37
+ icon: {
38
+ proto: Icon,
39
+ props: { icon: 'arrowMediumLeft' }
40
+ },
41
+ month: {
42
+ childProto: { tag: 'span' },
43
+ ...[
44
+ { text: 'january' },
45
+ { text: 'february' },
46
+ { text: 'march' },
47
+ { text: 'april' },
48
+ { text: 'may' },
49
+ { text: 'june' },
50
+ { text: 'july' },
51
+ { text: 'august' },
52
+ { text: 'september' },
53
+ { text: 'october' },
54
+ { text: 'november' },
55
+ { text: 'december' }
56
+ ]
57
+ },
58
+ icon2: {
59
+ proto: Icon,
60
+ props: { icon: 'arrowMediumRight' }
61
+ }
62
+ },
63
+ days: {
64
+ tag: 'section',
65
+ header: {
66
+ childProto: { tag: 'span' },
67
+ ...[
68
+ { text: 'Mo' },
69
+ { text: 'Tu' },
70
+ { text: 'We' },
71
+ { text: 'Th' },
72
+ { text: 'Fr' },
73
+ { text: 'Sa' },
74
+ { text: 'Su' }
75
+ ]
76
+ },
77
+ content: {
78
+ childProto: { tag: 'button' },
79
+ ...[
80
+ { text: '1' },
81
+ { text: '2' },
82
+ { text: '3' },
83
+ { text: '4' },
84
+ { text: '5' },
85
+ { text: '6' },
86
+ { text: '7' },
87
+ { text: '8' },
88
+ { text: '9' },
89
+ { text: '10' },
90
+ { text: '11' },
91
+ { text: '12' },
92
+ { text: '13' },
93
+ { text: '14' },
94
+ { text: '15' },
95
+ { text: '16' },
96
+ { text: '17' },
97
+ { text: '18' },
98
+ { text: '19' },
99
+ { text: '20' },
100
+ { text: '21' },
101
+ { text: '22' },
102
+ { text: '23' },
103
+ { text: '24' },
104
+ { text: '25' },
105
+ { text: '26' },
106
+ { text: '27' },
107
+ { text: '28' },
108
+ { text: '29' },
109
+ { text: '30' },
110
+ { text: '31' }
111
+ ]
112
+ }
113
+ }
114
+ }
115
+ }
@@ -0,0 +1,100 @@
1
+ 'use strict'
2
+
3
+ export default {
4
+ maxWidth: `${336 / 16}em`,
5
+ maxHeight: `${260 / 16}em`,
6
+ display: 'flex',
7
+ padding: '0 1em',
8
+ boxSizing: 'border-box',
9
+ borderRadius: '10px',
10
+ button: {
11
+ border: 'none',
12
+ outline: 'none',
13
+ background: 'transparent',
14
+ cursor: 'pointer'
15
+ },
16
+
17
+ aside: {
18
+ display: 'flex',
19
+ flexDirection: 'column',
20
+ overflowX: 'auto',
21
+ paddingRight: `${10 / 16}em`,
22
+
23
+ button: {
24
+ opacity: 0.5,
25
+ marginBottom: `${22 / 12}em`
26
+ }
27
+ },
28
+
29
+ main: {
30
+ flex: 1,
31
+ paddingTop: `${14 / 16}em`,
32
+ paddingBottom: `${10 / 16}em`,
33
+ overflow: 'hidden',
34
+
35
+ display: 'flex',
36
+ flexDirection: 'column',
37
+
38
+ '> header': {
39
+ display: 'flex',
40
+ alignItems: 'center',
41
+ height: 'auto',
42
+ overflow: 'hidden',
43
+ width: '100%',
44
+ padding: `0 ${8 / 16}em ${14 / 16}em ${8 / 16}em`,
45
+ boxSizing: 'border-box'
46
+ },
47
+ '> header > svg': {
48
+ cursor: 'pointer'
49
+ },
50
+
51
+ '> header > div': {
52
+ display: 'flex',
53
+ overflow: 'hidden',
54
+ flex: 1
55
+ },
56
+ '> header span': {
57
+ minWidth: '100%',
58
+ textTransform: 'capitalize',
59
+ textAlign: 'center',
60
+ fontWeight: 'bold'
61
+ },
62
+
63
+ section: {
64
+ flex: 1,
65
+ display: 'flex',
66
+ flexDirection: 'column'
67
+ },
68
+ 'section > header': {
69
+ height: 'auto',
70
+ display: 'grid',
71
+ gridTemplateColumns: 'repeat(7, 1fr)',
72
+ gap: '6px',
73
+ paddingBottom: `${2 / 16}em`
74
+ },
75
+ 'section > header span': {
76
+ textAlign: 'center',
77
+ fontWeight: 'bold'
78
+ },
79
+ 'section > header span:nth-child(6)': {
80
+ opacity: 0.5
81
+ },
82
+ 'section > header span:nth-child(7)': {
83
+ opacity: 0.5
84
+ },
85
+ 'section > div': {
86
+ flex: 1,
87
+ display: 'grid',
88
+ gridTemplateColumns: 'repeat(7, 1fr)',
89
+ gap: '6px'
90
+ },
91
+ 'section > div button': {
92
+ },
93
+ 'section > div button:nth-child(7n)': {
94
+ opacity: 0.5
95
+ },
96
+ 'section > div button:nth-child(7n - 1)': {
97
+ opacity: 0.5
98
+ }
99
+ }
100
+ }
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ export const Direction = {
4
+ props: {
5
+ direction: 'ltr'
6
+ },
7
+ class: {
8
+ direction: ({ props }) => ({ direction: props.direction })
9
+ }
10
+ }
@@ -0,0 +1,42 @@
1
+ 'use strict'
2
+ import { Shape, IconText } from '..'
3
+ import { styleRow, styleRowActive, styleDropDown } from './style'
4
+
5
+ export const DropdownList = {
6
+ style: styleDropDown,
7
+ tag: 'ul',
8
+
9
+ proto: Shape,
10
+
11
+ state: {
12
+ active: 0
13
+ },
14
+
15
+ childProto: {
16
+ tag: 'li',
17
+ proto: [Shape],
18
+
19
+ style: styleRow,
20
+ props: (el, s) => ({
21
+ depth: 0,
22
+ round: 0
23
+ // theme: el.parent.props.rowTheme
24
+ }),
25
+
26
+ span: {
27
+ proto: [IconText],
28
+ props: {
29
+ icon: 'checkmark',
30
+ text: ''
31
+ }
32
+ },
33
+ class: {
34
+ active: (element, state) => (state.active === element.key) ? styleRowActive : {}
35
+ },
36
+ on: {
37
+ click: (event, element, state) => {
38
+ state.update({ active: element.key })
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ export const styleDropDown = {
4
+ listStyleType: 'none',
5
+ padding: '4px',
6
+ maxHeight: '17.6em'
7
+ }
8
+
9
+ export const styleRow = {
10
+ height: `${42 / 16}em`,
11
+ width: `${178 / 16}em`,
12
+ position: 'relative',
13
+ padding: 0,
14
+ span: {
15
+ height: '100%',
16
+ display: 'flex',
17
+ alignItems: 'center',
18
+ justifyContent: 'space-between',
19
+ padding: '0 10px',
20
+ margin: '0 6px',
21
+ svg: { display: 'none' }
22
+ },
23
+ '&:not(:last-child) > span': {
24
+ borderBottom: '.5px solid rgba(0, 0, 0, .12)'
25
+ }
26
+ }
27
+
28
+ export const styleRowActive = {
29
+ // '&:not(:last-child) > span': {
30
+ // borderBottom: 'none'
31
+ // },
32
+ 'span > svg': { display: 'inline' }
33
+ }
34
+
35
+ export const styleSelectDropdown = {
36
+ color: 'red'
37
+ }
@@ -0,0 +1,21 @@
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
+ }