@symbo.ls/uikit 2.7.7 → 2.7.16

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 (56) hide show
  1. package/README.md +3 -6
  2. package/package.json +30 -39
  3. package/src/Banner/index.js +23 -0
  4. package/src/Banner/style.js +27 -0
  5. package/src/Box.js +16 -0
  6. package/src/Button.js +48 -0
  7. package/src/ButtonSet.js +9 -0
  8. package/src/Collection.js +82 -0
  9. package/src/DatePicker/index.js +155 -0
  10. package/src/DatePicker/style.js +18 -0
  11. package/src/Dropdown.js +51 -0
  12. package/src/Field.js +41 -0
  13. package/src/GridLayouts/index.js +20 -0
  14. package/src/GridLayouts/style.js +47 -0
  15. package/src/Icon.js +34 -0
  16. package/src/IconText.js +20 -0
  17. package/src/Input.js +32 -0
  18. package/src/Label.js +25 -0
  19. package/src/Link.js +20 -0
  20. package/src/Notification.js +46 -0
  21. package/src/Pills.js +25 -0
  22. package/src/Range.js +132 -0
  23. package/src/Select.js +36 -0
  24. package/src/Sidebar.js +23 -0
  25. package/src/TextArea.js +15 -0
  26. package/src/Tooltip.js +37 -0
  27. package/src/User.js +32 -0
  28. package/src/__/Media copy.js +121 -0
  29. package/src/atoms/Animation.js +52 -0
  30. package/src/atoms/Block.js +151 -0
  31. package/src/atoms/Direction.js +10 -0
  32. package/src/atoms/Flex.js +17 -0
  33. package/src/atoms/Form.js +11 -0
  34. package/src/atoms/Grid.js +30 -0
  35. package/src/atoms/Iframe.js +16 -0
  36. package/src/atoms/Img.js +17 -0
  37. package/src/atoms/Interaction.js +9 -0
  38. package/src/atoms/InteractiveComponent.js +78 -0
  39. package/src/atoms/Media.js +164 -0
  40. package/src/atoms/Overflow.js +7 -0
  41. package/src/atoms/Picture.js +31 -0
  42. package/src/atoms/Position.js +21 -0
  43. package/src/atoms/Pseudo.js +7 -0
  44. package/src/atoms/SVG.js +16 -0
  45. package/src/atoms/Shape/index.js +42 -0
  46. package/src/atoms/Shape/style.js +204 -0
  47. package/src/atoms/Text.js +40 -0
  48. package/src/atoms/Theme.js +136 -0
  49. package/src/atoms/Timing.js +55 -0
  50. package/src/atoms/Transform.js +8 -0
  51. package/src/atoms/XYZ.js +7 -0
  52. package/src/atoms/index.js +24 -0
  53. package/src/index.js +29 -0
  54. package/src/styles.js +6 -0
  55. package/index.js +0 -30
  56. package/react.js +0 -8
@@ -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,32 @@
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
+ fontFamily: 'smbls',
17
+ padding: 'Z A'
18
+ },
19
+
20
+ attr: {
21
+ pattern: ({ props }) => props.pattern,
22
+ minlength: ({ props }) => props.minlength,
23
+ maxlength: ({ props }) => props.maxlength,
24
+ name: ({ props }) => props.name,
25
+ placeholder: ({ props }) => props.placeholder,
26
+ value: ({ props, state }) => props.value,
27
+ disabled: ({ props }) => props.disabled || null,
28
+ readonly: ({ props }) => props.readonly,
29
+ required: ({ props }) => props.required,
30
+ type: ({ props }) => props.type
31
+ }
32
+ }
package/src/Label.js ADDED
@@ -0,0 +1,25 @@
1
+ 'use strict'
2
+
3
+ import { Button } from '.'
4
+
5
+ export const Label = {
6
+ extend: Button,
7
+
8
+ props: {
9
+ fontSize: 'Z2',
10
+ emoji: '👍',
11
+ text: '3',
12
+ padding: 'X2 Z',
13
+ round: 'C',
14
+ lineHeight: 1,
15
+ gap: 'X2',
16
+ depth: 16,
17
+ fontWeight: '500',
18
+ background: 'blue .3',
19
+ color: 'white'
20
+ },
21
+
22
+ emoji: {
23
+ props: ({ parent }) => ({ text: parent.props.emoji })
24
+ }
25
+ }
package/src/Link.js ADDED
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ import { exec } from '@domql/utils'
4
+ import { Focusable } from './atoms'
5
+
6
+ export const Link = {
7
+ extend: Focusable,
8
+ tag: 'a',
9
+ props: {
10
+ aria: {},
11
+ fontWeight: 'bold',
12
+ textDecoration: 'none',
13
+ color: 'currentColor'
14
+ },
15
+ attr: {
16
+ href: element => exec(element.props.href, element) || exec(element.props, element).href,
17
+ target: ({ props }) => props.target,
18
+ 'aria-label': ({ props }) => props.aria ? props.aria.label : props.text
19
+ }
20
+ }
@@ -0,0 +1,46 @@
1
+ 'use strict'
2
+
3
+ import { IconText, Flex } from '.'
4
+
5
+ export const Notification = {
6
+ extend: Flex,
7
+
8
+ props: {
9
+ theme: 'alert',
10
+ padding: 'Z1 B Z A',
11
+ round: 'A A A Y2',
12
+ gap: 'X2',
13
+ cursor: 'pointer',
14
+ align: 'flex-start center',
15
+
16
+ icon: {
17
+ icon: 'info outline'
18
+ },
19
+
20
+ article: {
21
+ flow: 'column',
22
+ align: 'flex-start',
23
+ gap: 'X2',
24
+ title: {
25
+ fontWeight: '600',
26
+ lineHeight: '1em',
27
+ text: 'Notification'
28
+ },
29
+ p: {
30
+ fontSize: 'Z',
31
+ margin: '0',
32
+ text: 'is not always a distraction'
33
+ }
34
+ }
35
+ },
36
+
37
+ icon: {
38
+ extend: [IconText]
39
+ },
40
+
41
+ article: {
42
+ extend: Flex,
43
+ title: {},
44
+ p: {}
45
+ }
46
+ }
package/src/Pills.js ADDED
@@ -0,0 +1,25 @@
1
+ 'use strict'
2
+
3
+ import { Flex } from '.'
4
+
5
+ export const Pills = {
6
+ extend: Flex,
7
+ props: (el, s) => ({
8
+ display: 'flex',
9
+ gap: 'Y2',
10
+
11
+ childProps: {
12
+ background: 'gray6',
13
+ width: 'Y2',
14
+ height: 'Y2',
15
+ round: 'A',
16
+
17
+ '.active': {
18
+ background: 'gray9'
19
+ }
20
+ }
21
+ }),
22
+ childExtend: {
23
+ props: (el, s) => ({ active: parseInt(el.key) === s.active })
24
+ }
25
+ }
package/src/Range.js ADDED
@@ -0,0 +1,132 @@
1
+ 'use strict'
2
+
3
+ import { opacify } from '@symbo.ls/scratch'
4
+ import { isFunction } from '@domql/utils'
5
+
6
+ import { SquareButton } from '.'
7
+
8
+ const props = {
9
+ appearance: 'none',
10
+ width: '100%',
11
+ height: '2px',
12
+ outline: 'none',
13
+ flex: 1,
14
+
15
+ style: {
16
+ appearance: 'none'
17
+ },
18
+
19
+ '::-webkit-slider-thumb': {
20
+ boxSizing: 'content-box',
21
+ width: '8px',
22
+ height: '8px',
23
+ borderWidth: '2px',
24
+ borderStyle: 'solid',
25
+ borderRadius: '100%',
26
+ opacity: '.8',
27
+
28
+ style: {
29
+ appearance: 'none'
30
+ }
31
+ },
32
+
33
+ '::-webkit-slider-runnable-track': {
34
+ },
35
+
36
+ '@dark': {
37
+ background: 'white 0.2',
38
+
39
+ '::-webkit-slider-thumb': {
40
+ background: '#232526',
41
+ borderColor: opacify('#454646', 0.75)
42
+ },
43
+
44
+ ':hover': {
45
+ '::-webkit-slider-thumb': {
46
+ borderColor: opacify('#fff', 0.35)
47
+ }
48
+ },
49
+
50
+ ':focus': {
51
+ '::-webkit-slider-thumb': {
52
+ borderColor: '#3C6AC0'
53
+ }
54
+ }
55
+ },
56
+
57
+ '@light': {
58
+ background: 'gray9',
59
+
60
+ '::-webkit-slider-thumb': {
61
+ background: 'white',
62
+ borderColor: 'gray9'
63
+ },
64
+
65
+ ':hover': {
66
+ '::-webkit-slider-thumb': {
67
+ borderColor: 'gray7'
68
+ }
69
+ },
70
+
71
+ ':focus': {
72
+ '::-webkit-slider-thumb': {
73
+ borderColor: 'blue'
74
+ }
75
+ }
76
+ }
77
+ }
78
+
79
+ export const Range = {
80
+ props,
81
+
82
+ tag: 'input',
83
+ attr: { type: 'range' }
84
+ }
85
+
86
+ const listenProp = (el, prop, def) => {
87
+ const val = el.props && el.props[prop]
88
+ const r = (isFunction(val) ? val(el, el.state) : val !== undefined ? val : def !== undefined ? def : 50)
89
+ return r + ''
90
+ }
91
+
92
+ export const RangeWithButtons = {
93
+ minus: {
94
+ extend: SquareButton,
95
+ props: { theme: 'tertiary', icon: 'minus' },
96
+ on: {
97
+ click: (ev, el, s) => {
98
+ el.props && isFunction(el.props.onClick) && el.props.onClick(ev, el, s)
99
+ }
100
+ }
101
+ },
102
+ value: {
103
+ style: { width: '4ch' },
104
+ tag: 'span',
105
+ text: (el, s) => {
106
+ const unit = listenProp(el.parent.input, 'unit', '')
107
+ return '' + (s.value || 50) + unit
108
+ }
109
+ },
110
+ input: {
111
+ extend: Range,
112
+ attr: {
113
+ value: (el, s) => parseFloat(s.value),
114
+ min: (el, s) => listenProp(el, 'min', 0),
115
+ max: (el, s) => listenProp(el, 'max', 100),
116
+ step: (el, s) => listenProp(el, 'step', 1)
117
+ },
118
+ on: {
119
+ input: (ev, el, s) => el.props && isFunction(el.props.onInput) && el.props.onInput(ev, el, s),
120
+ change: (ev, el, s) => el.props && isFunction(el.props.onChange) && el.props.onChange(ev, el, s)
121
+ }
122
+ },
123
+ plus: {
124
+ extend: SquareButton,
125
+ props: { theme: 'tertiary', icon: 'plus' },
126
+ on: {
127
+ click: (ev, el, s) => {
128
+ el.props && isFunction(el.props.onClick) && el.props.onClick(ev, el, s)
129
+ }
130
+ }
131
+ }
132
+ }
package/src/Select.js ADDED
@@ -0,0 +1,36 @@
1
+ 'use strict'
2
+
3
+ import { Focusable } from './atoms'
4
+
5
+ export const Select = {
6
+ extend: Focusable,
7
+ tag: 'select',
8
+
9
+ props: {
10
+ fontSize: 'A',
11
+ style: {
12
+ border: 'none',
13
+ boxSizing: 'border-box',
14
+ cursor: 'pointer'
15
+ }
16
+ },
17
+
18
+ childExtend: {
19
+ tag: 'option',
20
+ props: {
21
+ value: '',
22
+ selected: '',
23
+ disabled: ''
24
+ },
25
+ attr: {
26
+ value: ({ props }) => props.value,
27
+ selected: ({ props }) => props.selected,
28
+ disabled: ({ props }) => props.disabled
29
+ }
30
+ },
31
+
32
+ attr: {
33
+ name: ({ props }) => props.name,
34
+ disabled: ({ props }) => props.disabled
35
+ }
36
+ }
package/src/Sidebar.js ADDED
@@ -0,0 +1,23 @@
1
+ 'use strict'
2
+
3
+ import { Icon, Link } from '.'
4
+
5
+ const MenuItem = {
6
+ extend: Link,
7
+ props: { icon: '' },
8
+ glyph: {
9
+ extend: Icon,
10
+ name: ({ props }) => props.icon
11
+ }
12
+ }
13
+
14
+ export const Sidebar = {
15
+ caption: '',
16
+ nav: {
17
+ style: {
18
+ a: { cursor: 'pointer' }
19
+ },
20
+ childExtend: MenuItem,
21
+ ...[{}]
22
+ }
23
+ }
@@ -0,0 +1,15 @@
1
+ 'use strict'
2
+
3
+ import { Input, Focusable } from '.'
4
+
5
+ const props = {
6
+ height: 'E',
7
+ lineHeight: 1.4,
8
+ style: { resize: 'none' }
9
+ }
10
+
11
+ export const TextArea = {
12
+ extend: [Input, Focusable],
13
+ props,
14
+ tag: 'textarea'
15
+ }
package/src/Tooltip.js ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ import { Flex } from '.'
4
+
5
+ export const Tooltip = {
6
+ extend: Flex,
7
+ props: {
8
+ background: 'black',
9
+ color: 'white',
10
+ flow: 'column',
11
+ shape: 'tooltip',
12
+ shapeDirection: 'top',
13
+ padding: 'Z1 A',
14
+ round: 'Y2',
15
+ minWidth: 'D2',
16
+ gap: 'X',
17
+ textAlign: 'center',
18
+
19
+ title: {
20
+ fontWeight: 500,
21
+ color: 'gray12',
22
+ text: 'And tooltip is coming'
23
+ },
24
+ p: {
25
+ fontSize: 'Z2',
26
+ margin: '0',
27
+ color: 'gray6',
28
+ text: 'and winter too',
29
+ fontWeight: '400'
30
+ }
31
+ },
32
+
33
+ attr: { tooltip: true },
34
+
35
+ title: {},
36
+ p: {}
37
+ }
package/src/User.js ADDED
@@ -0,0 +1,32 @@
1
+ 'use strict'
2
+
3
+ import { Img, Flex } from '.'
4
+
5
+ export const User = {
6
+ extend: Img,
7
+ key: 'nikoloza',
8
+ props: {
9
+ display: 'block',
10
+ avatarType: 'initials',
11
+ borderRadius: '100%',
12
+ boxSize: 'B',
13
+ cursor: 'pointer'
14
+ },
15
+ attr: {
16
+ src: ({ key, props }) => props.src || `https://avatars.dicebear.com/api/${props.avatarType || 'adventurer-neutral'}/${props.key || key}.svg`
17
+ }
18
+ }
19
+
20
+ export const UserBundle = {
21
+ extend: Flex,
22
+ childExtend: {
23
+ extend: User,
24
+ props: ({ key }) => ({
25
+ boxSize: 'B1',
26
+ border: '0.1312em, black .85, solid',
27
+ ':not(:last-child)': {
28
+ margin: '0 -Y2 0 0'
29
+ }
30
+ })
31
+ }
32
+ }
@@ -0,0 +1,121 @@
1
+ 'use strict'
2
+
3
+ import { merge, isArray } from '@domql/utils'
4
+ import { CASES as CONFIG_CASES, MEDIA as CONFIG_MEDIA, getTheme } from '@symbo.ls/scratch'
5
+
6
+ const keySetters = {
7
+ '@': (key, props, result, element, isSubtree) => applyMediaProps(key, props, isSubtree ? result : result.media, element),
8
+ ':': (key, props, result, element, isSubtree) => applySelectorProps(key, props, isSubtree ? result : result.selector, element),
9
+ $: (key, props, result, element, isSubtree) => applyCaseProps(key, props, isSubtree ? result : result.case, element),
10
+ '.': (key, props, result, element, isSubtree) => applyConditionalCaseProps(key, props, isSubtree ? result : result.case, element)
11
+ }
12
+
13
+ const execClass = (key, props, result, element) => {
14
+ const { class: className } = element
15
+ const classnameExec = className[key]
16
+
17
+ if (typeof classnameExec !== 'function') return
18
+
19
+ let classExec = classnameExec({ props })
20
+ if (isArray(classExec)) {
21
+ classExec = classExec.reduce((a, c) => merge(a, c), {})
22
+ }
23
+
24
+ for (const finalProp in classExec) {
25
+ result[finalProp] = classExec[finalProp]
26
+ }
27
+ }
28
+
29
+ const convertPropsToClass = (props, result, element) => {
30
+ const propsClassObj = {}
31
+
32
+ for (const key in props) {
33
+ const setter = keySetters[key.slice(0, 1)]
34
+ if (setter) {
35
+ setter(key, props[key], propsClassObj, element, true)
36
+ continue
37
+ } else {
38
+ execClass(key, props, propsClassObj, element)
39
+ }
40
+ }
41
+
42
+ return propsClassObj
43
+ }
44
+
45
+ const applyMediaProps = (key, props, result, element) => {
46
+ const mediaName = CONFIG_MEDIA[key.slice(1)]
47
+ const mediaKey = `@media screen and ${mediaName}`
48
+ result[mediaKey] = convertPropsToClass(props, result, element)
49
+ }
50
+
51
+ const applySelectorProps = (key, props, result, element) => {
52
+ const selectorKey = `&${key}`
53
+ result[selectorKey] = convertPropsToClass(props, result, element)
54
+ }
55
+
56
+ const applyCaseProps = (key, props, result, element) => {
57
+ const caseKey = key.slice(1)
58
+ if (!CONFIG_CASES[caseKey]) return
59
+ merge(result, convertPropsToClass(props, result, element))
60
+ }
61
+
62
+ const applyConditionalCaseProps = (key, props, result, element) => {
63
+ const caseKey = key.slice(1)
64
+ if (!element.props[caseKey]) return // remove classname if not here
65
+ merge(result, convertPropsToClass(props, result, element))
66
+ }
67
+
68
+ const init = (element, s) => {
69
+ const { props, class: className } = element
70
+
71
+ const CLASS_NAMES = {
72
+ media: {},
73
+ selector: {},
74
+ case: {}
75
+ }
76
+
77
+ for (const key in props) {
78
+ const setter = keySetters[key.slice(0, 1)]
79
+ if (setter) setter(key, props[key], CLASS_NAMES, element)
80
+ }
81
+
82
+ merge(className, CLASS_NAMES)
83
+ }
84
+
85
+ export const initUpdate = el => {
86
+ // FORCE PROJECT_STATE UPDATE:
87
+ const { props, class: className } = el
88
+ const rootState = el.__root ? el.__root.state : el.state
89
+ // if (el.key !== 'app') return
90
+ const { props, class: className } = element
91
+
92
+ if (props.theme) {
93
+ for (const key in convertTheme) {
94
+ if (key.includes('dark') || key.includes('light')) {
95
+ const parse = key.split(': ')[1].split(')')[0]
96
+ if (rootState.globalTheme === parse) {
97
+ props.theme = getTheme(theme[key])
98
+ } else props.theme = theme
99
+ className.MEDIA_FORCED_BY_PROJECT_STATE = props.theme
100
+ }
101
+ }
102
+ }
103
+
104
+ for (const screen in props) {
105
+ if (screen.slice(0, 1) === '@') {
106
+ const mediaName = screen.slice(1)
107
+ const mediaKey = `@media screen and ${CONFIG_MEDIA[mediaName]}`
108
+ if (mediaName === 'dark' || mediaName === 'light') {
109
+ const { MEDIA_FORCE } = className
110
+ if (!MEDIA_FORCE) className.media = {}
111
+ if (rootState.globalTheme === mediaName) {
112
+ className.MEDIA_FORCED = className.MEDIA[mediaKey]
113
+ } else className.MEDIA_FORCED = {}
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ export const Responsive = {
120
+ on: { init, initUpdate }
121
+ }
@@ -0,0 +1,52 @@
1
+ 'use strict'
2
+
3
+ import { getTimingByKey, getTimingFunction } from '@symbo.ls/scratch'
4
+ import { isObject } from '@domql/utils'
5
+ import { emotion } from '@symbo.ls/emotion'
6
+ const { keyframes } = emotion
7
+
8
+ const applyAnimationProps = (animation, element) => {
9
+ if (isObject(animation)) return { animationName: keyframes(animation) }
10
+ const { ANIMATION } = element.context && element.context.system
11
+ const record = ANIMATION[animation]
12
+ return keyframes(record)
13
+ }
14
+
15
+ export const Animation = {
16
+ class: {
17
+ animation: (el) => el.props.animation && {
18
+ animationName: applyAnimationProps(el.props.animation, el),
19
+ animationDuration: getTimingByKey(el.props.animationDuration || 'A').timing,
20
+ animationDelay: getTimingByKey(el.props.animationDelay || '0s').timing,
21
+ animationTimingFunction: getTimingFunction(el.props.animationTimingFunction || 'ease'),
22
+ animationFillMode: el.props.animationFillMode || 'both',
23
+ animationPlayState: el.props.animationPlayState,
24
+ animationDirection: el.props.animationDirection
25
+ },
26
+ animationName: (el) => el.props.animationName && {
27
+ animationName: applyAnimationProps(el.props.animationName, el)
28
+ },
29
+
30
+ animationDuration: ({ props }) => props.animationDuration && ({
31
+ animationDuration: getTimingByKey(props.animationDuration).timing
32
+ }),
33
+ animationDelay: ({ props }) => props.animationDelay && ({
34
+ animationDelay: getTimingByKey(props.animationDelay).timing
35
+ }),
36
+ animationTimingFunction: ({ props }) => props.animationTimingFunction && ({
37
+ animationTimingFunction: getTimingFunction(props.animationTimingFunction)
38
+ }),
39
+ animationFillMode: ({ props }) => props.animationFillMode && ({
40
+ animationFillMode: props.animationFillMode
41
+ }),
42
+ animationPlayState: ({ props }) => props.animationPlayState && ({
43
+ animationPlayState: props.animationPlayState
44
+ }),
45
+ animationIterationCount: ({ props }) => props.animationIterationCount && ({
46
+ animationIterationCount: props.animationIterationCount || 1
47
+ }),
48
+ animationDirection: ({ props }) => props.animationDirection && ({
49
+ animationDirection: props.animationDirection
50
+ })
51
+ }
52
+ }