@symbo.ls/datepicker 1.1.1 → 1.2.0

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 (3) hide show
  1. package/index.js +140 -44
  2. package/package.json +2 -2
  3. package/style.js +0 -82
package/index.js CHANGED
@@ -2,60 +2,156 @@
2
2
 
3
3
  import style from './style'
4
4
 
5
- import { Icon } from '@symbo.ls/icon'
5
+ import { SquareButton, Button } from '@symbo.ls/button'
6
+ import { Flex } from '@symbo.ls/flex'
7
+ import { Grid } from '@symbo.ls/grid'
6
8
 
7
- export const DatePicker = {
8
- style,
9
+ const buttonProps = {
10
+ theme: 'transparent',
11
+ color: '--theme-quinary-dark-color',
12
+ ':hover': {
13
+ theme: 'quinary .child'
14
+ }
15
+ }
9
16
 
17
+ const aside = {
10
18
  props: {
11
- theme: 'lightDark',
12
- padding: 'A',
13
- round: 'Z',
14
- depth: 16
19
+ gap: 'X2',
20
+ margin: '-Z - -Z -X2',
21
+ padding: 'Z - Z X2',
22
+ minHeight: '100%',
23
+ height: '100%',
24
+ width: '--spacing-D'
15
25
  },
16
26
 
17
- aside: {
18
- childExtends: { tag: 'button' },
19
- ...[
20
- { text: '2020' },
21
- // ...
22
- ]
23
- },
27
+ cnt: {
28
+ extend: Flex,
29
+ props: {
30
+ flow: 'column',
31
+ overflow: 'hidden auto',
32
+ boxSize: '100% --spacing-D',
33
+ top: '0',
34
+ position: 'absolute',
35
+ maxHeight: '100%',
36
+ justifyContent: 'flex-end'
37
+ },
24
38
 
25
- main: {
26
- header: {
27
- icon: {
28
- extends: Icon,
29
- props: { icon: 'arrowMediumLeft' }
30
- },
31
- month: {
32
- childExtends: { tag: 'span' },
33
- ...[
34
- { text: 'january' },
35
- // ...
36
- ]
39
+ childExtend: {
40
+ extend: Button,
41
+ props: {
42
+ ...buttonProps,
43
+ fontSize: 'Z1'
37
44
  },
38
- icon2: {
39
- extends: Icon,
40
- props: { icon: 'arrowMediumRight' }
45
+ text: ({ state }) => state.value
46
+ }
47
+ }
48
+
49
+ }
50
+
51
+ const main = {
52
+ extend: Flex,
53
+
54
+ props: {
55
+ flex: 1,
56
+ gap: 'X2',
57
+ flow: 'column',
58
+
59
+ header: {
60
+ align: 'center space-between'
61
+ }
62
+ },
63
+
64
+ header: {
65
+ extend: Flex,
66
+ left: {
67
+ extend: SquareButton,
68
+ props: {
69
+ ...buttonProps,
70
+ round: 'C',
71
+ icon: 'arrowAngleLeft'
41
72
  }
42
73
  },
43
- days: {
44
- tag: 'section',
45
- header: {
46
- childExtends: { tag: 'span' },
47
- ...[
48
- { text: 'Mo' },
49
- // ...
50
- ]
51
- },
52
- content: {
53
- childExtends: { tag: 'button' },
54
- ...[
55
- { text: '1' },
56
- // ...
57
- ]
74
+ month: {
75
+ tag: 'span',
76
+ text: 'December'
77
+ },
78
+ right: {
79
+ extend: SquareButton,
80
+ props: {
81
+ ...buttonProps,
82
+ round: 'C',
83
+ icon: 'arrowAngleRight'
58
84
  }
59
85
  }
86
+ },
87
+ days: {
88
+ extend: Flex,
89
+ props: {
90
+ flow: 'column',
91
+ gap: 'X2'
92
+ },
93
+ childExtend: {
94
+ extend: Grid,
95
+ props: {
96
+ columns: 'repeat(7, 1fr)',
97
+ gap: 'X2'
98
+ }
99
+ },
100
+ weekDays: {
101
+ childExtend: {
102
+ extend: Button,
103
+ props: {
104
+ ...buttonProps,
105
+ fontSize: 'Z1',
106
+ padding: 'X2'
107
+ }
108
+ },
109
+ ...[
110
+ { text: 'Mo' },
111
+ { text: 'Tu' },
112
+ { text: 'We' },
113
+ { text: 'Th' },
114
+ { text: 'Fr' },
115
+ { text: 'Sa' },
116
+ { text: 'Su' }
117
+ ]
118
+ },
119
+
120
+ cnt: {
121
+ childExtend: {
122
+ extend: SquareButton,
123
+
124
+ props: ({ key, state }) => ({
125
+ ...buttonProps,
126
+ theme: 'quaternary',
127
+ active: key === '18',
128
+ '.active': {
129
+ theme: 'quinary'
130
+ }
131
+ })
132
+ },
133
+
134
+ ...new Array(31).fill(undefined).map((_, i) => ({ text: i + 1 }))
135
+ }
60
136
  }
61
137
  }
138
+
139
+ export const DatePicker = {
140
+ style,
141
+ extend: Flex,
142
+
143
+ props: {
144
+ position: 'relative',
145
+ theme: 'quinary',
146
+ transition: 'A all',
147
+ round: 'Z',
148
+ padding: 'Z Z2 Z X2',
149
+ gap: 'X2',
150
+ depth: 16,
151
+ minHeight: '0',
152
+ align: 'stretch center'
153
+ },
154
+
155
+ aside,
156
+ main
157
+ }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/datepicker",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "12925f3ed5a651a53282e32d28f21c015d3875e0",
6
+ "gitHead": "769d39aee2ab66f0d64b1e0052893442857e7432",
7
7
  "dependencies": {
8
8
  "@symbo.ls/block": "latest",
9
9
  "@symbo.ls/icon": "latest",
package/style.js CHANGED
@@ -1,95 +1,13 @@
1
1
  'use strict'
2
2
 
3
3
  export default {
4
- maxWidth: `${336 / 16}em`,
5
- maxHeight: `${260 / 16}em`,
6
- display: 'flex',
7
- padding: '0 1em',
8
- boxSizing: 'border-box',
9
- borderRadius: '10px',
10
- button: {
11
- border: 'none',
12
- outline: 'none',
13
- background: 'transparent',
14
- cursor: 'pointer'
15
- },
16
-
17
- aside: {
18
- display: 'flex',
19
- flexDirection: 'column',
20
- overflowX: 'auto',
21
- paddingRight: `${10 / 16}em`,
22
-
23
- button: {
24
- opacity: 0.5,
25
- marginBottom: `${22 / 12}em`
26
- }
27
- },
28
-
29
4
  main: {
30
- flex: 1,
31
- paddingTop: `${14 / 16}em`,
32
- paddingBottom: `${10 / 16}em`,
33
- overflow: 'hidden',
34
-
35
- display: 'flex',
36
- flexDirection: 'column',
37
-
38
- '> header': {
39
- display: 'flex',
40
- alignItems: 'center',
41
- height: 'auto',
42
- overflow: 'hidden',
43
- width: '100%',
44
- padding: `0 ${8 / 16}em ${14 / 16}em ${8 / 16}em`,
45
- boxSizing: 'border-box'
46
- },
47
- '> header > svg': {
48
- cursor: 'pointer'
49
- },
50
-
51
- '> header > div': {
52
- display: 'flex',
53
- overflow: 'hidden',
54
- flex: 1
55
- },
56
- '> header span': {
57
- minWidth: '100%',
58
- textTransform: 'capitalize',
59
- textAlign: 'center',
60
- fontWeight: 'bold'
61
- },
62
-
63
- section: {
64
- flex: 1,
65
- display: 'flex',
66
- flexDirection: 'column'
67
- },
68
- 'section > header': {
69
- height: 'auto',
70
- display: 'grid',
71
- gridTemplateColumns: 'repeat(7, 1fr)',
72
- gap: '6px',
73
- paddingBottom: `${2 / 16}em`
74
- },
75
- 'section > header span': {
76
- textAlign: 'center',
77
- fontWeight: 'bold'
78
- },
79
5
  'section > header span:nth-child(6)': {
80
6
  opacity: 0.5
81
7
  },
82
8
  'section > header span:nth-child(7)': {
83
9
  opacity: 0.5
84
10
  },
85
- 'section > div': {
86
- flex: 1,
87
- display: 'grid',
88
- gridTemplateColumns: 'repeat(7, 1fr)',
89
- gap: '6px'
90
- },
91
- 'section > div button': {
92
- },
93
11
  'section > div button:nth-child(7n)': {
94
12
  opacity: 0.5
95
13
  },