@symbo.ls/uikit 3.7.3 → 3.7.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.
package/Atoms/Block.js ADDED
@@ -0,0 +1,29 @@
1
+ 'use strict'
2
+
3
+ export const Block = {
4
+ display: 'block'
5
+ }
6
+
7
+ export const Inline = {
8
+ display: 'inline'
9
+ }
10
+
11
+ export const Flex = {
12
+ display: 'flex'
13
+ }
14
+
15
+ export const InlineFlex = {
16
+ display: 'inline-flex'
17
+ }
18
+
19
+ export const Grid = {
20
+ display: 'grid'
21
+ }
22
+
23
+ export const InlineGrid = {
24
+ display: 'inline-grid'
25
+ }
26
+
27
+ export const Gutter = {
28
+ boxSize: 'C1'
29
+ }
package/Atoms/Box.js ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ import { useCssInProps } from 'css-in-props'
4
+
5
+ // Main class assignment handler
6
+ const onBeforeClassAssign = (element) => {
7
+ if (!element.context) return
8
+ const { props, __ref: ref } = element
9
+ const result = useCssInProps(props, element, { unpack: false })
10
+ ref.__class = result
11
+ }
12
+
13
+ export const Box = {
14
+ extends: [
15
+ 'Shape',
16
+ 'Theme'
17
+ ],
18
+
19
+ boxSizing: 'border-box',
20
+
21
+ onBeforeClassAssign
22
+ }
23
+
24
+ export const Hr = {
25
+ tag: 'hr',
26
+ margin: 'C1 0'
27
+ }
28
+ export const Br = { tag: 'br' }
29
+ export const Li = { tag: 'li' }
30
+ export const Ul = {
31
+ tag: 'ul',
32
+ childExtends: { extends: 'Li' }
33
+ }
34
+ export const Ol = {
35
+ tag: 'ol',
36
+ childExtends: { extends: 'Li' }
37
+ }
package/Atoms/Form.js ADDED
@@ -0,0 +1,5 @@
1
+ 'use strict'
2
+
3
+ export const Form = {
4
+ tag: 'form',
5
+ }
package/Atoms/Grid.js ADDED
@@ -0,0 +1,37 @@
1
+ 'use strict'
2
+
3
+ export const Grid = {
4
+ props: { display: 'grid' },
5
+
6
+ class: {
7
+ area: ({ props }) => (props.area ? { gridArea: props.area } : null),
8
+ template: ({ props }) =>
9
+ props.template ? { gridTemplate: props.template } : null,
10
+ templateAreas: ({ props }) =>
11
+ props.templateAreas ? { gridTemplateAreas: props.templateAreas } : null,
12
+
13
+ column: ({ props }) => (props.column ? { gridColumn: props.column } : null),
14
+ columns: ({ props }) =>
15
+ props.columns ? { gridTemplateColumns: props.columns } : null,
16
+ templateColumns: ({ props }) =>
17
+ props.templateColumns
18
+ ? { gridTemplateColumns: props.templateColumns }
19
+ : null,
20
+ autoColumns: ({ props }) =>
21
+ props.autoColumns ? { gridAutoColumns: props.autoColumns } : null,
22
+ columnStart: ({ props }) =>
23
+ props.columnStart ? { gridColumnStart: props.columnStart } : null,
24
+
25
+ row: ({ props }) => (props.row ? { gridRow: props.row } : null),
26
+ rows: ({ props }) => (props.rows ? { gridTemplateRows: props.rows } : null),
27
+ templateRows: ({ props }) =>
28
+ props.templateRows ? { gridTemplateRows: props.templateRows } : null,
29
+ autoRows: ({ props }) =>
30
+ props.autoRows ? { gridAutoRows: props.autoRows } : null,
31
+ rowStart: ({ props }) =>
32
+ props.rowStart ? { gridRowStart: props.rowStart } : null,
33
+
34
+ autoFlow: ({ props }) =>
35
+ props.autoFlow ? { gridAutoFlow: props.autoFlow } : null
36
+ }
37
+ }
@@ -0,0 +1,57 @@
1
+ 'use strict'
2
+
3
+ export const Hgroup = {
4
+ display: 'flex',
5
+ tag: 'hgroup',
6
+
7
+ flow: 'y',
8
+ gap: 'Y2',
9
+
10
+ H: {
11
+ color: 'title',
12
+ tag: 'h3',
13
+ lineHeight: '1em',
14
+ margin: '0'
15
+ },
16
+ P: {
17
+ margin: '0',
18
+ color: 'paragraph'
19
+ }
20
+ }
21
+
22
+ export const HgroupRows = {
23
+ extends: 'Hgroup',
24
+
25
+ H: {
26
+ display: 'flex',
27
+ color: 'title',
28
+ align: 'center space-between'
29
+ },
30
+
31
+ P: {
32
+ color: 'paragraph',
33
+ align: 'center space-between'
34
+ }
35
+ }
36
+
37
+ export const HgroupButton = {
38
+ extends: 'HgroupRows',
39
+
40
+ H: {
41
+ justifyContent: 'space-between',
42
+
43
+ Span: {},
44
+
45
+ Button: {
46
+ background: 'transparent',
47
+ color: 'currentColor',
48
+ padding: '0',
49
+ Icon: {
50
+ name: 'x',
51
+ fontSize: 'C'
52
+ }
53
+ }
54
+ },
55
+
56
+ P: {}
57
+ }
@@ -0,0 +1,8 @@
1
+ 'use strict'
2
+
3
+ export const Iframe = {
4
+ tag: 'iframe',
5
+ position: 'relative',
6
+ minWidth: 'H',
7
+ minHeight: 'H'
8
+ }
package/Atoms/Img.js ADDED
@@ -0,0 +1,22 @@
1
+ 'use strict'
2
+
3
+ import { resolvePropValue } from 'attrs-in-props'
4
+
5
+ export const Img = {
6
+ tag: 'img',
7
+
8
+ attr: {
9
+ src: (el) => {
10
+ const { props, context } = el
11
+ let src = (props.preSrc || '') + resolvePropValue(el, props.src)
12
+
13
+ let isUrl
14
+ try { isUrl = new URL(src) } catch (e) { }
15
+ if (isUrl) return src
16
+ const fileSrc = src && src.startsWith('/files/') ? src.slice(7) : src
17
+ const file = context.files && (context.files[src] || context.files[fileSrc])
18
+ if (file) return file.content && file.content.src
19
+ },
20
+ title: ({ props }) => props.title || props.alt
21
+ }
22
+ }
@@ -0,0 +1,66 @@
1
+ 'use strict'
2
+
3
+ const style = {
4
+ appearance: 'none',
5
+ border: 'none',
6
+ cursor: 'pointer',
7
+ fontFamily: 'inherit'
8
+ }
9
+
10
+ export const Hoverable = {
11
+ transition: 'C defaultBezier',
12
+ transitionProperty: 'opacity, transform',
13
+ opacity: 0.85,
14
+
15
+ ':hover': {
16
+ opacity: 0.9,
17
+ transform: 'scale(1.015)'
18
+ },
19
+ ':active': {
20
+ opacity: 1,
21
+ transform: 'scale(1.015)'
22
+ },
23
+ '.active': {
24
+ opacity: 1,
25
+ transform: 'scale(1.015)',
26
+
27
+ ':hover': { opacity: 1 }
28
+ }
29
+ }
30
+
31
+ export const Clickable = {
32
+ extends: 'Hoverable',
33
+ ':active': {
34
+ opacity: 1,
35
+ transform: 'scale(1.015)'
36
+ },
37
+ '.active': {
38
+ opacity: 1
39
+ }
40
+ }
41
+
42
+ export const Focusable = {
43
+ border: 'none',
44
+ outline: 'solid 0 blue.3',
45
+ ':focus-visible': {
46
+ opacity: 1,
47
+ outline: 'solid X blue.3'
48
+ },
49
+
50
+ attr: {
51
+ tabIndex: ({ props }) => props.tabIndex
52
+ }
53
+ }
54
+
55
+ export const FocusableComponent = {
56
+ extends: 'Focusable',
57
+ tag: 'button',
58
+ fontSize: 'A',
59
+ type: 'button',
60
+ border: 'none',
61
+ textDecoration: 'none',
62
+ lineHeight: '1',
63
+ whiteSpace: 'nowrap',
64
+ fontFamily: 'inherit',
65
+ style
66
+ }
@@ -0,0 +1,34 @@
1
+ 'use strict'
2
+
3
+ import { getSystemGlobalTheme } from './Theme.js'
4
+
5
+ export const Picture = {
6
+ deps: { getSystemGlobalTheme },
7
+ tag: 'picture',
8
+
9
+ childExtends: {
10
+ deps: { getSystemGlobalTheme },
11
+ tag: 'source',
12
+ attr: {
13
+ media: (element) => {
14
+ const { props, key, context, deps } = element
15
+ const { media: MEDIA } = context.designSystem
16
+ const globalTheme = deps.getSystemGlobalTheme(element)
17
+ const mediaName = (props.media || key).slice(1)
18
+
19
+ if (mediaName === globalTheme) return '(min-width: 0px)'
20
+ else if (mediaName === 'dark' || mediaName === 'light')
21
+ return '(max-width: 0px)'
22
+
23
+ return MEDIA[mediaName]
24
+ }
25
+ }
26
+ },
27
+
28
+ Img: {
29
+ width: 'inherit',
30
+ ignoreChildExtends: true,
31
+ height: 'inherit',
32
+ src: (element, state) => element.parent.props?.src || element.parent.src || state.src
33
+ }
34
+ }
@@ -0,0 +1,40 @@
1
+ 'use strict'
2
+
3
+ import { exec } from '@domql/utils'
4
+ import { SHAPES } from './style'
5
+ import { getSpacingBasedOnRatio, getMediaColor } from '@symbo.ls/scratch'
6
+
7
+ export const Shape = {
8
+ deps: { exec, getSpacingBasedOnRatio, getMediaColor },
9
+
10
+ classlist: {
11
+ shape: ({ props, deps }) => {
12
+ const { shape } = props
13
+ return deps.exec(SHAPES[shape], ({ props, deps }))
14
+ },
15
+ // TODO: replace with this
16
+ // shape: (el) => {
17
+ // const { shape } = el.props
18
+ // return el.call('exec', SHAPES[shape], el)
19
+ // },
20
+ shapeDirection: ({ props }) => {
21
+ const { shape, shapeDirection } = props
22
+ if (!shape || !shapeDirection) return
23
+ const shapeDir = SHAPES[shape + 'Direction']
24
+ return shape && shapeDir ? shapeDir[shapeDirection || 'left'] : null
25
+ },
26
+ shapeDirectionColor: ({ props, deps }) => {
27
+ const { background, backgroundColor } = props
28
+ const borderColor = {
29
+ borderColor: deps.getMediaColor(background || backgroundColor)
30
+ }
31
+ return props.shapeDirection ? borderColor : null
32
+ }
33
+ }
34
+ }
35
+
36
+ export const Circle = {
37
+ round: '100%'
38
+ }
39
+
40
+ export default Shape
package/Atoms/Shape.js ADDED
@@ -0,0 +1,226 @@
1
+ 'use strict'
2
+
3
+ import { getActiveConfig, getColor } from '@symbo.ls/scratch' // eslint-disable-line no-unused-vars
4
+ import { TIMING_PROPS } from 'css-in-props/src/props'
5
+
6
+ const CONFIG = getActiveConfig()
7
+
8
+ export const depth = {
9
+ 4: {
10
+ boxShadow: `rgba(0,0,0,.10) 0 2${CONFIG.UNIT.default} 4${CONFIG.UNIT.default}`
11
+ },
12
+ 6: {
13
+ boxShadow: `rgba(0,0,0,.10) 0 3${CONFIG.UNIT.default} 6${CONFIG.UNIT.default}`
14
+ },
15
+ 10: {
16
+ boxShadow: `rgba(0,0,0,.10) 0 4${CONFIG.UNIT.default} 10${CONFIG.UNIT.default}`
17
+ },
18
+ 16: {
19
+ boxShadow: `rgba(0,0,0,.10) 0 8${CONFIG.UNIT.default} 16${CONFIG.UNIT.default}`
20
+ },
21
+ 26: {
22
+ boxShadow: `rgba(0,0,0,.10) 0 14${CONFIG.UNIT.default} 26${CONFIG.UNIT.default}`
23
+ },
24
+ 42: {
25
+ boxShadow: `rgba(0,0,0,.10) 0 20${CONFIG.UNIT.default} 42${CONFIG.UNIT.default}`
26
+ }
27
+ }
28
+
29
+ const getComputedBackgroundColor = ({ props }) => {
30
+ return (
31
+ getColor(props.shapeDirectionColor) ||
32
+ getColor(props.borderColor) ||
33
+ getColor(props.backgroundColor) ||
34
+ getColor(props.background)
35
+ )
36
+ }
37
+
38
+ const inheritTransition = ({ props, deps }) => {
39
+ const exec = TIMING_PROPS.transition(props.transition, { props, deps })
40
+ return exec && exec.transition
41
+ }
42
+
43
+ export const SHAPES = {
44
+ rectangle: {},
45
+ circle: { borderRadius: '100%' },
46
+ bubble: {},
47
+ tv: {
48
+ borderRadius: '1.15em/2.5em'
49
+ },
50
+
51
+ tooltip: ({ props, deps }) => ({
52
+ position: props.position || 'relative',
53
+ '&:before': {
54
+ content: '""',
55
+ display: 'block',
56
+ width: '0px',
57
+ height: '0px',
58
+ border: '.35em solid',
59
+ borderColor: getComputedBackgroundColor({ props, deps }),
60
+ transition: inheritTransition({ props, deps }),
61
+ transitionProperty: 'border-color',
62
+ position: 'absolute',
63
+ borderRadius: '.15em'
64
+ }
65
+ }),
66
+
67
+ tooltipDirection: {
68
+ top: {
69
+ '&:before': {
70
+ top: '0',
71
+ left: '50%',
72
+ transform: 'translate(-50%, -50%) rotate(45deg)'
73
+ }
74
+ },
75
+ right: {
76
+ '&:before': {
77
+ top: '50%',
78
+ right: '0',
79
+ transform: 'translate(50%, -50%) rotate(45deg)'
80
+ }
81
+ },
82
+ bottom: {
83
+ '&:before': {
84
+ bottom: '0',
85
+ left: '50%',
86
+ transform: 'translate(-50%, 50%) rotate(45deg)'
87
+ }
88
+ },
89
+ left: {
90
+ '&:before': {
91
+ top: '50%',
92
+ left: '0',
93
+ transform: 'translate(-50%, -50%) rotate(45deg)'
94
+ }
95
+ }
96
+ },
97
+
98
+ tag: ({ props, deps }) => ({
99
+ position: 'relative',
100
+ '&:before': {
101
+ content: '""',
102
+ display: 'block',
103
+ background: getComputedBackgroundColor({ props, deps }),
104
+ transition: inheritTransition({ props, deps }),
105
+ transitionProperty: 'background',
106
+ borderRadius: '.25em',
107
+ position: 'absolute',
108
+ zIndex: '-1',
109
+ aspectRatio: '1/1',
110
+ top: '50%',
111
+ transformOrigin: '50% 50%',
112
+ height: '73%'
113
+ }
114
+ }),
115
+
116
+ tagDirection: {
117
+ top: {
118
+ '&:before': {
119
+ bottom: '100%',
120
+ left: '50%',
121
+ transform: 'translate(-50%, 50%) rotate(45deg)'
122
+ }
123
+ },
124
+ right: {
125
+ '&:before': {
126
+ top: '50%',
127
+ left: '100%',
128
+ transform: 'translate(-50%, -50%) rotate(45deg)'
129
+ }
130
+ },
131
+ bottom: {
132
+ '&:before': {
133
+ top: '100%',
134
+ left: '50%',
135
+ transform: 'translate(-50%, -50%) rotate(45deg)'
136
+ }
137
+ },
138
+ left: {
139
+ '&:before': {
140
+ top: '50%',
141
+ right: '100%',
142
+ transform: 'translate(50%, -50%) rotate(45deg)'
143
+ }
144
+ }
145
+ },
146
+
147
+ hexagon: ({ props, deps }) => ({
148
+ position: 'relative',
149
+ '&:before, &:after': {
150
+ content: '""',
151
+ display: 'block',
152
+ position: 'absolute',
153
+ zIndex: '-1',
154
+ borderRadius: '.25em',
155
+ aspectRatio: '1/1',
156
+ top: '50%',
157
+ transformOrigin: '50% 50%',
158
+ height: '73%',
159
+ background: getComputedBackgroundColor({ props, deps }),
160
+ transition: inheritTransition({ props, deps }),
161
+ transitionProperty: 'background'
162
+ },
163
+ '&:before': {
164
+ left: '0',
165
+ transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
166
+ },
167
+ '&:after': {
168
+ left: '100%',
169
+ transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
170
+ }
171
+ }),
172
+
173
+ chevron: ({ props, deps }) => ({
174
+ position: 'relative',
175
+ '&:before, &:after': {
176
+ content: '""',
177
+ display: 'block',
178
+ position: 'absolute',
179
+ zIndex: '-1',
180
+ aspectRatio: '1/1',
181
+ top: '50%',
182
+ transformOrigin: '50% 50%',
183
+ transition: inheritTransition({ props, deps }),
184
+ transitionProperty: 'background'
185
+ },
186
+ '&:before': {
187
+ background: `linear-gradient(225deg, ${getComputedBackgroundColor({
188
+ props,
189
+ deps
190
+ })} 25%, transparent 25%), linear-gradient(315deg, ${getComputedBackgroundColor(
191
+ { props, deps }
192
+ )} 25%, transparent 25%)`
193
+ },
194
+ '&:after': {
195
+ background: getComputedBackgroundColor({ props, deps }),
196
+ borderRadius: '.25em'
197
+ }
198
+ }),
199
+
200
+ chevronDirection: {
201
+ left: {
202
+ '&:before': {
203
+ height: '100%',
204
+ left: '100%',
205
+ transform: 'translate3d(-1%, -50%, 1px) scale(-1, 1)'
206
+ },
207
+ '&:after': {
208
+ height: '73%',
209
+ left: '0',
210
+ transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
211
+ }
212
+ },
213
+ right: {
214
+ '&:before': {
215
+ height: '100%',
216
+ left: '0',
217
+ transform: 'translate3d(-99%, -50%, 1px)'
218
+ },
219
+ '&:after': {
220
+ height: '73%',
221
+ left: '100%',
222
+ transform: 'translate3d(-50%, -50%, 1px) rotate(45deg)'
223
+ }
224
+ }
225
+ }
226
+ }
package/Atoms/Svg.js ADDED
@@ -0,0 +1,43 @@
1
+ 'use strict'
2
+
3
+ // create SVG symbol
4
+ export const Svg = {
5
+ tag: 'svg',
6
+ attr: {
7
+ xmlns: 'http://www.w3.org/2000/svg',
8
+ 'xmlns:xlink': 'http://www.w3.org/1999/xlink'
9
+ },
10
+ html: (el) => {
11
+ const { props, context } = el
12
+ if (props.semantic_symbols) return
13
+ if (props.html) return el.call('exec', props.html, el)
14
+
15
+ const { designSystem, utils } = context
16
+ const SVG = designSystem && designSystem.svg
17
+ const useSvgSprite = props.spriteId || (context.designSystem && context.designSystem.useSvgSprite)
18
+
19
+ const src = el.call('exec', props.src, el)
20
+ if (!useSvgSprite && src) return src
21
+
22
+ const useSVGSymbol = icon => `<use xlink:href="#${icon}" />`
23
+
24
+ const spriteId = props.spriteId
25
+ if (spriteId) return useSVGSymbol(spriteId)
26
+
27
+ const symbolId = Symbol.for(src)
28
+ let SVGKey = SVG[symbolId]
29
+ if (SVGKey && SVG[SVGKey]) return useSVGSymbol(SVGKey)
30
+
31
+ SVGKey = SVG[symbolId] = Math.random()
32
+ if (src) {
33
+ utils.init({
34
+ svg: { [SVGKey]: src }
35
+ }, {
36
+ document: context.document,
37
+ emotion: context.emotion
38
+ })
39
+ }
40
+
41
+ return useSVGSymbol(SVGKey)
42
+ }
43
+ }
package/Atoms/Text.js ADDED
@@ -0,0 +1,43 @@
1
+ 'use strict'
2
+
3
+ export const Text = {}
4
+
5
+ export const H1 = { tag: 'h1' }
6
+ export const H2 = { tag: 'h2' }
7
+ export const H3 = { tag: 'h3' }
8
+ export const H4 = { tag: 'h4' }
9
+ export const H5 = { tag: 'h5' }
10
+ export const H6 = { tag: 'h6' }
11
+ export const P = { tag: 'p' }
12
+ export const Caption = { tag: 'caption' }
13
+ export const Strong = {
14
+ tag: 'strong',
15
+ fontWeight: '700'
16
+ }
17
+ export const U = { tag: 'u' }
18
+ export const Underline = { tag: 'u' }
19
+ export const Italic = { tag: 'i' }
20
+
21
+ export const Title = {}
22
+
23
+ export const Headline = {
24
+ tag: 'h6',
25
+ fontSize: 'B',
26
+ fontWeight: 500
27
+ }
28
+
29
+ export const Subhead = {
30
+ tag: 'span',
31
+ fontSize: 'Z1'
32
+ }
33
+
34
+ export const Footnote = {
35
+ tag: 'span',
36
+ fontSize: 'Z'
37
+ }
38
+
39
+ export const B = { tag: 'b' }
40
+
41
+ export const I = { tag: 'i' }
42
+
43
+ export const Data = { tag: 'data' }
package/Atoms/Theme.js ADDED
@@ -0,0 +1,20 @@
1
+ 'use strict'
2
+
3
+ import { depth } from './Shape'
4
+ import { isUndefined } from '@domql/utils'
5
+
6
+ export const getSystemGlobalTheme = ({ context, state }) => {
7
+ const rootState = state && state.root
8
+ const theme = (rootState && rootState.globalTheme) || (context.designSystem && context.designSystem.globalTheme)
9
+ return theme === 'auto' ? null : theme
10
+ }
11
+
12
+ export const Theme = {
13
+ deps: {
14
+ depth
15
+ },
16
+
17
+ classlist: {
18
+ depth: ({ props, deps }) => !isUndefined(props.depth) && deps.depth[props.depth]
19
+ }
20
+ }
package/Atoms/Video.js ADDED
@@ -0,0 +1,11 @@
1
+ 'use strict'
2
+
3
+ export const Video = {
4
+ tag: 'video',
5
+
6
+ controls: true,
7
+
8
+ childExtends: {
9
+ tag: 'source'
10
+ }
11
+ }
package/Avatar.js ADDED
@@ -0,0 +1,10 @@
1
+ 'use strict'
2
+
3
+ export const Avatar = {
4
+ extends: 'Img',
5
+ display: 'block',
6
+ avatarType: 'adventurer-neutral',
7
+ borderRadius: '100%',
8
+ boxSize: 'C+X C+X',
9
+ src: el => `https://api.dicebear.com/7.x/${el.props.avatarType || 'initials'}/svg?seed=${el.props.key || el.key || 'no-avatar'}`
10
+ }