@symbo.ls/datepicker 2.11.523 → 3.0.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.
- package/days.js +1 -1
- package/grid.js +18 -18
- package/index.js +2 -2
- package/months.js +3 -3
- package/package.json +5 -5
- package/weekdays.js +3 -3
- package/years.js +3 -3
package/days.js
CHANGED
package/grid.js
CHANGED
|
@@ -20,7 +20,7 @@ const extractMonthDays = (data) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export const DatePickerGrid = {
|
|
23
|
-
|
|
23
|
+
extends: 'Grid',
|
|
24
24
|
|
|
25
25
|
props: {
|
|
26
26
|
columns: 'repeat(7, 1fr)',
|
|
@@ -30,8 +30,9 @@ export const DatePickerGrid = {
|
|
|
30
30
|
style: { scrollSnapAlign: 'center' }
|
|
31
31
|
},
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
childExtends: DatePickerDay,
|
|
34
|
+
childrenAs: 'state',
|
|
35
|
+
children: ({ state }) => state.days
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export const DatePickerGridContainer = {
|
|
@@ -84,24 +85,23 @@ export const DatePickerGridContainer = {
|
|
|
84
85
|
},
|
|
85
86
|
|
|
86
87
|
Flex: {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
left: el.node.offsetLeft,
|
|
97
|
-
behavior: state.initialized ? 'smooth' : 'instant'
|
|
98
|
-
})
|
|
88
|
+
childProps: {
|
|
89
|
+
onRender: (el, state) => {
|
|
90
|
+
const { key } = el
|
|
91
|
+
const isSelected = state.parent.parent.activeMonth === parseInt(key)
|
|
92
|
+
if (isSelected) {
|
|
93
|
+
window.requestAnimationFrame(() => {
|
|
94
|
+
el.parent.parent.node.scrollTo({
|
|
95
|
+
left: el.node.offsetLeft,
|
|
96
|
+
behavior: state.initialized ? 'smooth' : 'instant'
|
|
99
97
|
})
|
|
100
|
-
|
|
101
|
-
|
|
98
|
+
})
|
|
99
|
+
// if (!state.initialized) state.update({ initialized: true }, { preventUpdate: true, isHoisted: true })
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
},
|
|
105
|
-
|
|
103
|
+
childExtends: 'DatePickerGrid',
|
|
104
|
+
childrenAs: 'state',
|
|
105
|
+
children: ({ state }) => state.parse()
|
|
106
106
|
}
|
|
107
107
|
}
|
package/index.js
CHANGED
|
@@ -10,7 +10,7 @@ export * from './years'
|
|
|
10
10
|
export * from './grid'
|
|
11
11
|
|
|
12
12
|
export const DatePicker = {
|
|
13
|
-
|
|
13
|
+
extends: [Dialog, Flex],
|
|
14
14
|
|
|
15
15
|
state: ({ props }) => {
|
|
16
16
|
const date = new Date()
|
|
@@ -53,7 +53,7 @@ export const DatePicker = {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export const DatePickerTwoColumns = {
|
|
56
|
-
|
|
56
|
+
extends: DatePicker,
|
|
57
57
|
DatePickerYears: {},
|
|
58
58
|
Flex: {
|
|
59
59
|
DatePickerMonthsSlider: {
|
package/months.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
export const DatePickerMonthsSlider = {
|
|
4
|
-
|
|
4
|
+
extends: 'Flex',
|
|
5
5
|
props: {
|
|
6
6
|
position: 'relative',
|
|
7
7
|
overflow: 'hidden',
|
|
@@ -76,7 +76,7 @@ export const DatePickerMonthsSlider = {
|
|
|
76
76
|
'::-webkit-scrollbar': { display: 'none' }
|
|
77
77
|
},
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
childExtends: {
|
|
80
80
|
tag: 'h6',
|
|
81
81
|
props: ({ state, key }) => ({
|
|
82
82
|
fontSize: 'Z1',
|
|
@@ -106,7 +106,7 @@ export const DatePickerMonthsSlider = {
|
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
children: ({ state, parent }) => {
|
|
110
110
|
return [
|
|
111
111
|
{ text: 'January' },
|
|
112
112
|
{ text: 'February' },
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/datepicker",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "c4dacc88fa3a65574680d11e320307dd2a22e6e9",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@symbo.ls/atoms": "^
|
|
9
|
-
"@symbo.ls/button": "^
|
|
10
|
-
"@symbo.ls/dialog": "^
|
|
8
|
+
"@symbo.ls/atoms": "^3.0.2",
|
|
9
|
+
"@symbo.ls/button": "^3.0.2",
|
|
10
|
+
"@symbo.ls/dialog": "^3.0.2",
|
|
11
11
|
"headless-datepicker": "^1.0.1"
|
|
12
12
|
},
|
|
13
13
|
"source": "src/index.js"
|
package/weekdays.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
3
|
export const DatePickerWeekDays = {
|
|
4
|
-
|
|
4
|
+
extends: 'Grid',
|
|
5
5
|
props: {
|
|
6
6
|
overflow: 'hidden',
|
|
7
7
|
padding: '- Z A',
|
|
@@ -14,9 +14,9 @@ export const DatePickerWeekDays = {
|
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
childExtends: {
|
|
18
18
|
tag: 'span',
|
|
19
|
-
|
|
19
|
+
extends: 'Flex',
|
|
20
20
|
props: {
|
|
21
21
|
fontSize: 'Y1',
|
|
22
22
|
textTransform: 'capitalize',
|
package/years.js
CHANGED
|
@@ -43,8 +43,8 @@ export const DatePickerYears = {
|
|
|
43
43
|
'::-webkit-scrollbar': { display: 'none' }
|
|
44
44
|
},
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
childExtends: {
|
|
47
|
+
extends: 'Button',
|
|
48
48
|
props: ({ state, text }) => ({
|
|
49
49
|
fontSize: 'Y1',
|
|
50
50
|
opacity: '.4',
|
|
@@ -69,7 +69,7 @@ export const DatePickerYears = {
|
|
|
69
69
|
}
|
|
70
70
|
},
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
children: (element) => {
|
|
73
73
|
const { yearRange } = element.state
|
|
74
74
|
if (!yearRange) return
|
|
75
75
|
|