smbls 1.1.6 → 2.5.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.
Files changed (54) hide show
  1. package/README.md +4 -17
  2. package/package.json +29 -39
  3. package/src/Banner/index.js +24 -0
  4. package/src/Banner/style.js +27 -0
  5. package/src/Box.js +13 -0
  6. package/src/Button.js +48 -0
  7. package/src/ButtonSet.js +9 -0
  8. package/src/DatePicker/index.js +155 -0
  9. package/src/DatePicker/style.js +18 -0
  10. package/src/Dropdown.js +51 -0
  11. package/src/Field.js +41 -0
  12. package/src/GridLayouts/index.js +20 -0
  13. package/src/GridLayouts/style.js +47 -0
  14. package/src/Icon.js +34 -0
  15. package/src/IconText.js +20 -0
  16. package/src/Input.js +28 -0
  17. package/src/Label.js +25 -0
  18. package/src/Link.js +20 -0
  19. package/src/Notification.js +46 -0
  20. package/src/Pills.js +25 -0
  21. package/src/Range.js +141 -0
  22. package/src/Select.js +36 -0
  23. package/src/Sidebar.js +23 -0
  24. package/src/Tooltip.js +37 -0
  25. package/src/User.js +31 -0
  26. package/src/__/Media copy.js +121 -0
  27. package/src/atoms/Animation.js +53 -0
  28. package/src/atoms/Block.js +145 -0
  29. package/src/atoms/Direction.js +10 -0
  30. package/src/atoms/Flex.js +17 -0
  31. package/src/atoms/Form.js +11 -0
  32. package/src/atoms/Grid.js +26 -0
  33. package/src/atoms/Iframe.js +16 -0
  34. package/src/atoms/Img.js +17 -0
  35. package/src/atoms/Interaction.js +9 -0
  36. package/src/atoms/InteractiveComponent.js +82 -0
  37. package/src/atoms/Media.js +166 -0
  38. package/src/atoms/Overflow.js +7 -0
  39. package/src/atoms/Picture.js +31 -0
  40. package/src/atoms/Position.js +21 -0
  41. package/src/atoms/Pseudo.js +7 -0
  42. package/src/atoms/SVG.js +16 -0
  43. package/src/atoms/Shape/index.js +42 -0
  44. package/src/atoms/Shape/style.js +204 -0
  45. package/src/atoms/Text.js +37 -0
  46. package/src/atoms/Theme.js +136 -0
  47. package/src/atoms/Timing.js +55 -0
  48. package/src/atoms/Transform.js +8 -0
  49. package/src/atoms/XYZ.js +7 -0
  50. package/src/atoms/index.js +24 -0
  51. package/src/index.js +29 -0
  52. package/src/styles.js +6 -0
  53. package/index.js +0 -38
  54. package/react.js +0 -10
package/README.md CHANGED
@@ -1,21 +1,14 @@
1
1
  # Symbols
2
2
 
3
- UI Library in composition of [Scratch](https://github.com/symbo.ls/scratch) and [DOMQL](https://github.com/symbo.ls/domql) or [React](https://github.com/symbo-ls/smbls/tree/main/packages/all/packages/react.js)
4
-
5
- Check out the [documentation page](https://docs.symbols.app/).
3
+ UI Library in composition of [Scratch](https://github.com/smbo-ls/scratch) and [DOMQL](https://github.com/domql/domql)
6
4
 
7
5
  [![npm version](https://badge.fury.io/js/smbls.svg)](https://badge.fury.io/js/smbls)
8
6
 
9
- ### UI Components
10
-
11
- Library consists with packages. Components can be invoked individually.
12
-
13
-
14
7
  ### Setup
15
8
 
16
9
  1. Installation
17
10
  ```
18
- yarn add 'smbls@^1.1.1'
11
+ yarn add smbls
19
12
  ```
20
13
 
21
14
  2. Import the component from Symbols
@@ -24,15 +17,9 @@ import { Box } from 'smbls'
24
17
  ```
25
18
 
26
19
  3. Use it inside your DOMQL code
27
- ### DOMQL
28
- ```javascript
20
+ ```
29
21
  const Header = {
30
- extends: Box,
22
+ extend: Box,
31
23
  // ...Other Properties
32
24
  }
33
25
  ```
34
-
35
- ### React
36
- ```javascript
37
- <Box {...props} />
38
- ```
package/package.json CHANGED
@@ -1,53 +1,43 @@
1
1
  {
2
2
  "name": "smbls",
3
3
  "description": "UI Library built on Scratch and DOMQL",
4
- "version": "1.1.6",
4
+ "private": false,
5
5
  "author": "symbo.ls",
6
+ "version": "2.5.5",
6
7
  "repository": "https://github.com/symbo-ls/smbls",
7
- "main": "index.js",
8
+ "main": "src/index.js",
8
9
  "files": [
9
- "index.js",
10
- "react.js"
10
+ "src"
11
11
  ],
12
12
  "publishConfig": {
13
13
  "registry": "https://registry.npmjs.org"
14
14
  },
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"
22
+ },
15
23
  "dependencies": {
16
- "@symbo.ls/banner": "latest",
17
- "@symbo.ls/block": "latest",
18
- "@symbo.ls/box": "latest",
19
- "@symbo.ls/button": "latest",
20
- "@symbo.ls/buttonset": "latest",
21
- "@symbo.ls/config-default": "latest",
22
- "@symbo.ls/datepicker": "latest",
23
- "@symbo.ls/direction": "latest",
24
- "@symbo.ls/dropdown": "latest",
25
- "@symbo.ls/field": "latest",
26
- "@symbo.ls/flex": "latest",
27
- "@symbo.ls/grid": "latest",
28
- "@symbo.ls/icon": "latest",
29
- "@symbo.ls/icon-text": "latest",
30
- "@symbo.ls/img": "latest",
24
+ "@domql/utils": "latest",
25
+ "@symbo.ls/cli": "latest",
26
+ "@symbo.ls/socket": "latest",
31
27
  "@symbo.ls/init": "latest",
32
- "@symbo.ls/input": "latest",
33
- "@symbo.ls/label": "latest",
34
- "@symbo.ls/link": "latest",
35
- "@symbo.ls/notification": "latest",
36
- "@symbo.ls/overflow": "latest",
37
- "@symbo.ls/pills": "latest",
38
- "@symbo.ls/position": "latest",
39
- "@symbo.ls/react-box": "symbo-ls/react-box",
40
- "@symbo.ls/react-provider": "latest",
41
- "@symbo.ls/responsive": "latest",
42
- "@symbo.ls/select": "latest",
43
- "@symbo.ls/shape": "latest",
44
- "@symbo.ls/slider": "latest",
45
- "@symbo.ls/svg": "latest",
46
- "@symbo.ls/text": "latest",
47
- "@symbo.ls/tooltip": "latest",
48
- "@symbo.ls/user": "latest"
28
+ "@symbo.ls/scratch": "latest",
29
+ "@symbo.ls/utils": "latest"
30
+ },
31
+ "devDependencies": {
32
+ "@babel/core": "^7.11.5",
33
+ "@emotion/css": "^11.5.0",
34
+ "babel-eslint": "^10.0.3",
35
+ "eslint": "^6.1.0",
36
+ "parcel-bundler": "^1.12.4",
37
+ "parcel-plugin-svg-sprite": "^1.4.1",
38
+ "standard": "^13.1.0"
49
39
  },
50
- "browserslist": "> 0.5%, last 2 versions, not dead",
51
- "gitHead": "eb13ed79529011424a032e472d87df11b8e19e4f",
52
- "source": "src/index.js"
40
+ "standard": {
41
+ "parser": "babel-eslint"
42
+ }
53
43
  }
@@ -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
+ extend: Shape,
11
+ round: 10,
12
+ theme: 'purple',
13
+ style: styleParentMode,
14
+ icon: {
15
+ extend: Icon,
16
+ props: { icon: 'checkMedium' }
17
+ },
18
+ h2: 'Welcome to parent Mode',
19
+ description: {
20
+ extend: 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
+ }
package/src/Box.js ADDED
@@ -0,0 +1,13 @@
1
+ 'use strict'
2
+
3
+ import { Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, Interaction, XYZ, Animation } from './atoms'
4
+
5
+ const PropsCSS = {
6
+ class: {
7
+ style: ({ props }) => props && props.style
8
+ }
9
+ }
10
+
11
+ export const Box = {
12
+ extend: [Shape, Position, Theme, Block, Text, Overflow, Timing, Transform, Media, PropsCSS, Interaction, XYZ, Animation]
13
+ }
package/src/Button.js ADDED
@@ -0,0 +1,48 @@
1
+ 'use strict'
2
+
3
+ import { FocusableComponent } from './atoms'
4
+ import { IconText } from '.'
5
+
6
+ export const Button = {
7
+ extend: [FocusableComponent, IconText],
8
+ tag: 'button',
9
+ props: {
10
+ fontSize: 'A',
11
+ type: 'button',
12
+ border: 'none',
13
+ display: 'inline-flex',
14
+ align: 'center center',
15
+ textDecoration: 'none',
16
+ lineHeight: '1',
17
+ whiteSpace: 'nowrap',
18
+ padding: 'Z A1',
19
+ fontFamily: 'inherit',
20
+ round: 'C2'
21
+ },
22
+ attr: {
23
+ type: ({ props }) => props.type
24
+ }
25
+ }
26
+
27
+ export const SquareButton = {
28
+ extend: Button,
29
+ props: {
30
+ fontSize: 'A',
31
+ width: 'A',
32
+ padding: 'Z',
33
+ aspectRatio: '1 / 1',
34
+ justifyContent: 'center',
35
+ round: 'Z',
36
+ style: { boxSizing: 'content-box' }
37
+ }
38
+ }
39
+
40
+ export const CircleButton = {
41
+ extend: SquareButton,
42
+ props: { round: 'C' }
43
+ }
44
+
45
+ export const KangorooButton = {
46
+ extend: Button,
47
+ childExtend: IconText
48
+ }
@@ -0,0 +1,9 @@
1
+ 'use strict'
2
+
3
+ import { SquareButton, Flex } from './'
4
+
5
+ export const ButtonSet = {
6
+ tag: 'nav',
7
+ extend: Flex,
8
+ childExtend: SquareButton
9
+ }
@@ -0,0 +1,155 @@
1
+ 'use strict'
2
+
3
+ import style from './style'
4
+
5
+ import { SquareButton, Flex, Button, Grid } from '../'
6
+
7
+ const buttonProps = {
8
+ theme: 'transparent',
9
+ color: '--theme-quinary-dark-color',
10
+ ':hover': {
11
+ theme: 'quinary .child'
12
+ }
13
+ }
14
+
15
+ const aside = {
16
+ props: {
17
+ gap: 'X2',
18
+ margin: '-Z - -Z -X2',
19
+ padding: 'Z - Z X2',
20
+ minHeight: '100%',
21
+ height: '100%',
22
+ width: '--spacing-D'
23
+ },
24
+
25
+ cnt: {
26
+ extend: Flex,
27
+ props: {
28
+ flow: 'column',
29
+ overflow: 'hidden auto',
30
+ boxSize: '100% --spacing-D',
31
+ top: '0',
32
+ position: 'absolute',
33
+ maxHeight: '100%',
34
+ justifyContent: 'flex-end'
35
+ },
36
+
37
+ childExtend: {
38
+ extend: Button,
39
+ props: {
40
+ ...buttonProps,
41
+ fontSize: 'Z1'
42
+ },
43
+ text: ({ state }) => state.value
44
+ }
45
+ }
46
+
47
+ }
48
+
49
+ const main = {
50
+ extend: Flex,
51
+
52
+ props: {
53
+ flex: 1,
54
+ gap: 'X2',
55
+ flow: 'column',
56
+
57
+ header: {
58
+ align: 'center space-between'
59
+ }
60
+ },
61
+
62
+ header: {
63
+ extend: Flex,
64
+ left: {
65
+ extend: SquareButton,
66
+ props: {
67
+ ...buttonProps,
68
+ round: 'C',
69
+ icon: 'arrowAngleLeft'
70
+ }
71
+ },
72
+ month: {
73
+ tag: 'span',
74
+ text: 'December'
75
+ },
76
+ right: {
77
+ extend: SquareButton,
78
+ props: {
79
+ ...buttonProps,
80
+ round: 'C',
81
+ icon: 'arrowAngleRight'
82
+ }
83
+ }
84
+ },
85
+ days: {
86
+ extend: Flex,
87
+ props: {
88
+ flow: 'column',
89
+ gap: 'X2'
90
+ },
91
+ childExtend: {
92
+ extend: Grid,
93
+ props: {
94
+ columns: 'repeat(7, 1fr)',
95
+ gap: 'X2'
96
+ }
97
+ },
98
+ weekDays: {
99
+ childExtend: {
100
+ extend: Button,
101
+ props: {
102
+ ...buttonProps,
103
+ fontSize: 'Z1',
104
+ padding: 'X2'
105
+ }
106
+ },
107
+ ...[
108
+ { text: 'Mo' },
109
+ { text: 'Tu' },
110
+ { text: 'We' },
111
+ { text: 'Th' },
112
+ { text: 'Fr' },
113
+ { text: 'Sa' },
114
+ { text: 'Su' }
115
+ ]
116
+ },
117
+
118
+ cnt: {
119
+ childExtend: {
120
+ extend: SquareButton,
121
+
122
+ props: ({ key, state }) => ({
123
+ ...buttonProps,
124
+ theme: 'quaternary',
125
+ active: key === '18',
126
+ '.active': {
127
+ theme: 'quinary'
128
+ }
129
+ })
130
+ },
131
+
132
+ ...new Array(31).fill(undefined).map((_, i) => ({ text: i + 1 }))
133
+ }
134
+ }
135
+ }
136
+
137
+ export const DatePicker = {
138
+ style,
139
+ extend: Flex,
140
+
141
+ props: {
142
+ position: 'relative',
143
+ theme: 'quinary',
144
+ transition: 'A all',
145
+ round: 'Z',
146
+ padding: 'Z Z2 Z X2',
147
+ gap: 'X2',
148
+ depth: 16,
149
+ minHeight: '0',
150
+ align: 'stretch center'
151
+ },
152
+
153
+ aside,
154
+ main
155
+ }
@@ -0,0 +1,18 @@
1
+ 'use strict'
2
+
3
+ export default {
4
+ main: {
5
+ 'section > header span:nth-child(6)': {
6
+ opacity: 0.5
7
+ },
8
+ 'section > header span:nth-child(7)': {
9
+ opacity: 0.5
10
+ },
11
+ 'section > div button:nth-child(7n)': {
12
+ opacity: 0.5
13
+ },
14
+ 'section > div button:nth-child(7n - 1)': {
15
+ opacity: 0.5
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,51 @@
1
+ 'use strict'
2
+
3
+ import { Flex, Button } from '.'
4
+
5
+ export const DropdownList = {
6
+ extend: Flex,
7
+
8
+ props: {
9
+ padding: '0 Y',
10
+ maxHeight: 'G',
11
+ flow: 'column',
12
+ theme: 'quaternary',
13
+ overflow: 'hidden auto',
14
+ style: { listStyleType: 'none' }
15
+ },
16
+
17
+ childExtend: {
18
+ extend: Button,
19
+
20
+ props: (el, s) => ({
21
+ active: s.active === el.key,
22
+ position: 'relative',
23
+ round: '0',
24
+ align: 'center flex-end',
25
+ flow: 'row-reverse',
26
+ padding: 'Z2 C Z2 Y2',
27
+ margin: '0',
28
+ gap: 'Y2',
29
+ theme: 'quaternary .child',
30
+
31
+ ':hover': {
32
+ style: {
33
+ svg: { opacity: '0.5' }
34
+ }
35
+ },
36
+
37
+ icon: {
38
+ active: s.active === el.key,
39
+ name: 'checkmark',
40
+ opacity: '0.1',
41
+ '.active': { opacity: '1' }
42
+ },
43
+
44
+ ':not(:first-child)': {
45
+ '@dark': { border: 'gray4 .65, solid' },
46
+ '@light': { border: 'gray11, solid' },
47
+ borderWidth: '1px 0 0'
48
+ }
49
+ })
50
+ }
51
+ }
package/src/Field.js ADDED
@@ -0,0 +1,41 @@
1
+ 'use strict'
2
+
3
+ import { IconText, Input, Focusable } from '.'
4
+
5
+ export const Field = {
6
+ extend: [IconText],
7
+
8
+ props: (el, s) => ({
9
+ value: s[el.key],
10
+
11
+ depth: 16,
12
+ placeholder: '',
13
+ padding: 'A B',
14
+ round: 'C',
15
+ type: 'text',
16
+ position: 'relative',
17
+ width: '16em',
18
+
19
+ style: {
20
+ appearance: 'none',
21
+ outline: 0,
22
+ border: 'none',
23
+ cursor: 'pointer',
24
+ fontFamily: 'inherit',
25
+ boxSizing: 'border-box'
26
+ },
27
+
28
+ input: {
29
+ width: '100%',
30
+ height: '100%',
31
+ border: 'none'
32
+ },
33
+
34
+ svg: {
35
+ position: 'absolute',
36
+ right: '1em'
37
+ }
38
+ }),
39
+
40
+ input: { extend: [Focusable, Input] }
41
+ }
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ import { Button, Link } from '..'
4
+
5
+ import { styleGrid, styleGrid2 } from './style'
6
+
7
+ const componentLink = {
8
+ extend: Link,
9
+ attr: {
10
+ href: '#'
11
+ }
12
+ }
13
+
14
+ export const grid = {
15
+ style: styleGrid
16
+ }
17
+
18
+ export const grid2 = {
19
+ style: styleGrid2
20
+ }
@@ -0,0 +1,47 @@
1
+ 'use strict'
2
+
3
+ export const styleGrid = {
4
+ display: 'grid',
5
+ gridTemplateColumns: 'repeat(15, 1fr)',
6
+ boxSizing: 'border-box',
7
+ padding: '0 8em',
8
+ marginBottom: '2em',
9
+ rowGap: '10px',
10
+ gridAutoColumns: 'auto',
11
+ gridAutoRows: 'auto',
12
+ gridAutoFlow: 'column',
13
+ '> a': {
14
+ padding: '70px 0',
15
+ display: 'flex',
16
+ justifyContent: 'center',
17
+ background: 'rgba(255, 255, 255, .05)',
18
+ borderRadius: '12px',
19
+ alignItems: 'center'
20
+ },
21
+ '> a:first-child': {
22
+ gridColumn: '1 / span 15'
23
+ },
24
+ '> a:nth-child(2)': {
25
+ gridRow: '2',
26
+ gridColumn: '1 / span 3',
27
+ marginRight: '10px'
28
+ },
29
+ '> a:nth-child(3)': {
30
+ gridRow: '2',
31
+ gridColumn: '4 / span 6',
32
+ marginRight: '10px'
33
+ },
34
+ '> a:nth-child(4)': {
35
+ gridRow: '2',
36
+ gridColumn: '10 / span 15'
37
+ },
38
+ '> a:nth-child(5)': {
39
+ gridRow: '3',
40
+ gridColumn: '1 / span 6',
41
+ marginRight: '10px'
42
+ },
43
+ '> a:nth-child(6)': {
44
+ gridRow: '3',
45
+ gridColumn: '7 / span 15'
46
+ }
47
+ }
package/src/Icon.js ADDED
@@ -0,0 +1,34 @@
1
+ 'use strict'
2
+
3
+ import { SVG } from './atoms'
4
+ import { toCamelCase } from '@symbo.ls/utils'
5
+
6
+ export const Icon = {
7
+ extend: SVG,
8
+ props: ({ key, props, parent, context }) => {
9
+ const { ICONS } = context && context.SYSTEM
10
+ const iconName = props.inheritedString || props.name || props.icon || key
11
+ const camelCase = toCamelCase(iconName)
12
+
13
+ const isArray = camelCase.split(/([a-z])([A-Z])/g)
14
+
15
+ let activeIconName
16
+ if (props.active) {
17
+ activeIconName = props['.active'].name || props['.active'].icon
18
+ }
19
+ if (parent.props.active && parent.props['.active'] && parent.props['.active'].icon) {
20
+ activeIconName = parent.props['.active'].icon.name || parent.props['.active'].icon.icon || parent.props['.active'].icon
21
+ }
22
+
23
+ const iconFromLibrary = ICONS[activeIconName] || ICONS[camelCase] || (ICONS[isArray[0] + isArray[1]]) || ICONS[isArray[0]] || ICONS['noIcon']
24
+
25
+ return {
26
+ width: 'A',
27
+ height: 'A',
28
+ display: 'inline-block',
29
+ src: iconFromLibrary,
30
+ style: { fill: 'currentColor' }
31
+ }
32
+ },
33
+ attr: { viewBox: '0 0 24 24' }
34
+ }
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ import { Flex, Icon } from '.'
4
+
5
+ export const IconText = {
6
+ extend: Flex,
7
+
8
+ props: {
9
+ align: 'center center',
10
+ lineHeight: 1
11
+ },
12
+
13
+ icon: {
14
+ extend: Icon,
15
+ if: ({ parent }) => parent.props.icon,
16
+ props: 'match'
17
+ },
18
+
19
+ text: ({ props }) => props.text
20
+ }
package/src/Input.js ADDED
@@ -0,0 +1,28 @@
1
+ 'use strict'
2
+
3
+ import { Focusable } from './'
4
+
5
+ export const Input = {
6
+ extend: [Focusable],
7
+ tag: 'input',
8
+
9
+ props: {
10
+ border: 'none',
11
+ type: 'input',
12
+ theme: 'quaternary',
13
+ fontSize: 'A',
14
+ round: 'C',
15
+ lineHeight: 1,
16
+ padding: 'Z A'
17
+ },
18
+
19
+ attr: {
20
+ name: ({ props }) => props.name,
21
+ placeholder: ({ props }) => props.placeholder,
22
+ value: ({ props }) => props.value,
23
+ disabled: ({ props }) => props.disabled || null,
24
+ readonly: ({ props }) => props.readonly,
25
+ required: ({ props }) => props.required,
26
+ type: ({ props }) => props.type
27
+ }
28
+ }