@symbo.ls/avatar 2.11.202 → 2.11.205
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/Avatar.js +4 -6
- package/AvatarChooser.js +61 -0
- package/index.js +1 -49
- package/package.json +2 -2
package/Avatar.js
CHANGED
|
@@ -4,14 +4,12 @@ import { Img } from '@symbo.ls/atoms'
|
|
|
4
4
|
|
|
5
5
|
export const Avatar = {
|
|
6
6
|
extend: Img,
|
|
7
|
-
props: {
|
|
7
|
+
props: ({ key, props }) => ({
|
|
8
8
|
display: 'block',
|
|
9
9
|
avatarType: 'initials',
|
|
10
10
|
borderRadius: '100%',
|
|
11
11
|
boxSize: 'C+X C+X',
|
|
12
|
-
cursor: 'pointer'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
src: ({ key, props }) => props.src || `https://avatars.dicebear.com/api/${props.avatarType || 'adventurer-neutral'}/${props.key || key}.svg`
|
|
16
|
-
}
|
|
12
|
+
cursor: 'pointer',
|
|
13
|
+
src: `https://api.dicebear.com/7.x/${props.avatarType || 'adventurer-neutral'}/svg?seed=${props.key || key}`
|
|
14
|
+
})
|
|
17
15
|
}
|
package/AvatarChooser.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
import { Button } from '@symbo.ls/button'
|
|
4
|
+
|
|
5
|
+
export const AvatarChooser = {
|
|
6
|
+
extend: Button,
|
|
7
|
+
tag: 'label',
|
|
8
|
+
|
|
9
|
+
props: {
|
|
10
|
+
round: 'C',
|
|
11
|
+
gap: 'Y',
|
|
12
|
+
padding: 'W2 A W2 W2',
|
|
13
|
+
theme: 'tertiary',
|
|
14
|
+
position: 'relative',
|
|
15
|
+
cursor: 'pointer'
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
Avatar: {
|
|
19
|
+
props: ({ state }) => ({
|
|
20
|
+
key: state.key,
|
|
21
|
+
boxSize: 'B1',
|
|
22
|
+
pointerEvents: 'none'
|
|
23
|
+
})
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
Select: {
|
|
27
|
+
props: {
|
|
28
|
+
outline: 'none',
|
|
29
|
+
pointerEvents: 'all',
|
|
30
|
+
appearance: 'none',
|
|
31
|
+
border: 'none',
|
|
32
|
+
width: '100%',
|
|
33
|
+
height: '100%',
|
|
34
|
+
background: 'none',
|
|
35
|
+
color: 'currentColor',
|
|
36
|
+
fontSize: 'A',
|
|
37
|
+
lineHeight: 1,
|
|
38
|
+
margin: '0 0 0 -B1+X',
|
|
39
|
+
padding: '0 A 0 B1+X',
|
|
40
|
+
':focus-visible': {
|
|
41
|
+
outline: 'none'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
childExtend: { tag: 'option' },
|
|
46
|
+
$setPropsCollection: ({ parent, state }) => {
|
|
47
|
+
if (!parent.props.options) return []
|
|
48
|
+
return parent.props.options.map(v => {
|
|
49
|
+
if (v.text === state.key) return { ...v, selected: true }
|
|
50
|
+
return v
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
on: {
|
|
55
|
+
change: (ev, { state }) => {
|
|
56
|
+
state.update({ key: ev.target.value })
|
|
57
|
+
console.log(state.key)
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
package/index.js
CHANGED
|
@@ -1,54 +1,6 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { Button } from '@symbo.ls/button'
|
|
4
|
-
|
|
5
3
|
export * from './Avatar'
|
|
6
4
|
export * from './AvatarIndicator'
|
|
7
5
|
export * from './AvatarBundle'
|
|
8
|
-
|
|
9
|
-
export const AvatarChooser = {
|
|
10
|
-
extend: Button,
|
|
11
|
-
tag: 'label',
|
|
12
|
-
|
|
13
|
-
props: {
|
|
14
|
-
round: 'C',
|
|
15
|
-
gap: 'Y',
|
|
16
|
-
padding: 'W2 A W2 W2',
|
|
17
|
-
theme: 'tertiary',
|
|
18
|
-
position: 'relative',
|
|
19
|
-
cursor: 'pointer'
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
Avatar: {
|
|
23
|
-
boxSize: 'B1',
|
|
24
|
-
pointerEvents: 'none'
|
|
25
|
-
},
|
|
26
|
-
|
|
27
|
-
select: {
|
|
28
|
-
props: {
|
|
29
|
-
id: 'avatar-chooser',
|
|
30
|
-
outline: 'none',
|
|
31
|
-
pointerEvents: 'all',
|
|
32
|
-
appearance: 'none',
|
|
33
|
-
border: 'none',
|
|
34
|
-
width: '100%',
|
|
35
|
-
height: '100%',
|
|
36
|
-
background: 'none',
|
|
37
|
-
color: 'currentColor',
|
|
38
|
-
fontSize: 'A',
|
|
39
|
-
lineHeight: 1,
|
|
40
|
-
margin: '0 0 0 -B1+X',
|
|
41
|
-
padding: '0 A 0 B1+X'
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
attr: { name: 'avatar-chooser' },
|
|
45
|
-
|
|
46
|
-
childExtend: { tag: 'option' },
|
|
47
|
-
$setPropsCollection: ({ parent }) => parent.props.options,
|
|
48
|
-
on: {
|
|
49
|
-
change: (ev, { parent }) => {
|
|
50
|
-
parent.Avatar.update({ key: ev.target.value })
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
6
|
+
export * from './AvatarChooser'
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/avatar",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.205",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "34a12e0c41de4a08c45fa5f48b0913510b861c06",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@symbo.ls/atoms": "latest",
|
|
9
9
|
"@symbo.ls/button": "latest",
|