@symbo.ls/avatar
Advanced tools
Comparing version 2.11.202 to 2.11.204
@@ -7,3 +7,3 @@ 'use strict' | ||
extend: Img, | ||
props: { | ||
props: ({ key, props }) => ({ | ||
display: 'block', | ||
@@ -13,7 +13,5 @@ avatarType: 'initials', | ||
boxSize: 'C+X C+X', | ||
cursor: 'pointer' | ||
}, | ||
attr: { | ||
src: ({ key, props }) => props.src || `https://avatars.dicebear.com/api/${props.avatarType || 'adventurer-neutral'}/${props.key || key}.svg` | ||
} | ||
cursor: 'pointer', | ||
src: `https://api.dicebear.com/7.x/${props.avatarType || 'adventurer-neutral'}/svg?seed=${props.key || key}` | ||
}) | ||
} |
30
index.js
@@ -23,9 +23,11 @@ 'use strict' | ||
Avatar: { | ||
boxSize: 'B1', | ||
pointerEvents: 'none' | ||
props: ({ state }) => ({ | ||
key: state.key, | ||
boxSize: 'B1', | ||
pointerEvents: 'none' | ||
}) | ||
}, | ||
select: { | ||
Select: { | ||
props: { | ||
id: 'avatar-chooser', | ||
outline: 'none', | ||
@@ -42,12 +44,20 @@ pointerEvents: 'all', | ||
margin: '0 0 0 -B1+X', | ||
padding: '0 A 0 B1+X' | ||
padding: '0 A 0 B1+X', | ||
':focus-visible': { | ||
outline: 'none' | ||
} | ||
}, | ||
attr: { name: 'avatar-chooser' }, | ||
childExtend: { tag: 'option' }, | ||
$setPropsCollection: ({ parent, state }) => { | ||
return parent.props.options.map(v => { | ||
if (v.text === state.key) return { ...v, selected: true } | ||
return v | ||
}) | ||
}, | ||
childExtend: { tag: 'option' }, | ||
$setPropsCollection: ({ parent }) => parent.props.options, | ||
on: { | ||
change: (ev, { parent }) => { | ||
parent.Avatar.update({ key: ev.target.value }) | ||
change: (ev, { state }) => { | ||
state.update({ key: ev.target.value }) | ||
console.log(state.key) | ||
} | ||
@@ -54,0 +64,0 @@ } |
{ | ||
"name": "@symbo.ls/avatar", | ||
"version": "2.11.202", | ||
"version": "2.11.204", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"gitHead": "4a6bc5b8ca219fa9ae195bd25b29f9b82d6fbdae", | ||
"gitHead": "dab7f6d84335bca5af356b849c51204910670e76", | ||
"dependencies": { | ||
@@ -8,0 +8,0 @@ "@symbo.ls/atoms": "latest", |
4123
132