@symbo.ls/dropdown 0.0.1
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/package.json +7 -0
- package/packages/react/index.js +1 -0
- package/packages/react/package.json +7 -0
- package/src/index.js +42 -0
- package/src/style.js +37 -0
package/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
'use strict'
|
package/src/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
import { Shape, IconText } from '..'
|
|
3
|
+
import { styleRow, styleRowActive, styleDropDown } from './style'
|
|
4
|
+
|
|
5
|
+
export const DropdownList = {
|
|
6
|
+
style: styleDropDown,
|
|
7
|
+
tag: 'ul',
|
|
8
|
+
|
|
9
|
+
proto: Shape,
|
|
10
|
+
|
|
11
|
+
state: {
|
|
12
|
+
active: 0
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
childProto: {
|
|
16
|
+
tag: 'li',
|
|
17
|
+
proto: [Shape],
|
|
18
|
+
|
|
19
|
+
style: styleRow,
|
|
20
|
+
props: (el, s) => ({
|
|
21
|
+
depth: 0,
|
|
22
|
+
round: 0
|
|
23
|
+
// theme: el.parent.props.rowTheme
|
|
24
|
+
}),
|
|
25
|
+
|
|
26
|
+
span: {
|
|
27
|
+
proto: [IconText],
|
|
28
|
+
props: {
|
|
29
|
+
icon: 'checkmark',
|
|
30
|
+
text: ''
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
class: {
|
|
34
|
+
active: (element, state) => (state.active === element.key) ? styleRowActive : {}
|
|
35
|
+
},
|
|
36
|
+
on: {
|
|
37
|
+
click: (event, element, state) => {
|
|
38
|
+
state.update({ active: element.key })
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/style.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
|
|
3
|
+
export const styleDropDown = {
|
|
4
|
+
listStyleType: 'none',
|
|
5
|
+
padding: '4px',
|
|
6
|
+
maxHeight: '17.6em'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const styleRow = {
|
|
10
|
+
height: `${42 / 16}em`,
|
|
11
|
+
width: `${178 / 16}em`,
|
|
12
|
+
position: 'relative',
|
|
13
|
+
padding: 0,
|
|
14
|
+
span: {
|
|
15
|
+
height: '100%',
|
|
16
|
+
display: 'flex',
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
justifyContent: 'space-between',
|
|
19
|
+
padding: '0 10px',
|
|
20
|
+
margin: '0 6px',
|
|
21
|
+
svg: { display: 'none' }
|
|
22
|
+
},
|
|
23
|
+
'&:not(:last-child) > span': {
|
|
24
|
+
borderBottom: '.5px solid rgba(0, 0, 0, .12)'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const styleRowActive = {
|
|
29
|
+
// '&:not(:last-child) > span': {
|
|
30
|
+
// borderBottom: 'none'
|
|
31
|
+
// },
|
|
32
|
+
'span > svg': { display: 'inline' }
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const styleSelectDropdown = {
|
|
36
|
+
color: 'red'
|
|
37
|
+
}
|