@symbo.ls/datepicker 1.1.1 → 1.2.2

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