@idealyst/datepicker 1.0.83 → 1.0.85
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/README.md +1 -1
- package/package.json +8 -3
- package/src/DateInput/DateInput.native.tsx +1 -1
- package/src/DateInput/DateInput.styles.tsx +3 -3
- package/src/DateInput/DateInput.web.tsx +1 -1
- package/src/DateInput/types.ts +1 -1
- package/src/DatePicker/Calendar.native.tsx +2 -2
- package/src/DatePicker/Calendar.styles.tsx +24 -21
- package/src/DatePicker/Calendar.web.tsx +9 -4
- package/src/DatePicker/DatePicker.styles.tsx +5 -5
- package/src/DatePicker/types.ts +1 -1
- package/src/DateRangePicker/DateRangePicker.styles.tsx +7 -7
- package/src/DateRangePicker/RangeCalendar.native.tsx +15 -15
- package/src/DateRangePicker/RangeCalendar.styles.tsx +6 -2
- package/src/DateRangePicker/RangeCalendar.web.tsx +16 -16
- package/src/DateRangePicker/types.ts +1 -1
- package/src/DateTimePicker/DateTimePicker.styles.tsx +33 -6
- package/src/DateTimePicker/DateTimePickerBase.tsx +10 -29
- package/src/DateTimePicker/TimePicker.styles.tsx +2 -5
- package/src/DateTimePicker/TimePickerBase.tsx +1 -1
- package/src/DateTimePicker/types.ts +1 -1
- package/src/DateTimeRangePicker/DateTimeRangePicker.styles.tsx +27 -7
- package/src/DateTimeRangePicker/DateTimeRangePickerBase.tsx +11 -21
- package/src/DateTimeRangePicker/types.ts +1 -1
- package/src/examples/DatePickerExamples.tsx +29 -29
- package/src/primitives/CalendarGrid/CalendarGrid.styles.tsx +13 -24
- package/src/primitives/CalendarGrid/CalendarGrid.tsx +19 -11
- package/src/primitives/CalendarHeader/CalendarHeader.tsx +15 -15
- package/src/primitives/CalendarOverlay/CalendarOverlay.styles.tsx +7 -2
- package/src/primitives/CalendarOverlay/CalendarOverlay.tsx +38 -32
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native-unistyles';
|
|
2
2
|
|
|
3
|
+
type CalendarOverlayVariants = {
|
|
4
|
+
isSelected: boolean;
|
|
5
|
+
};
|
|
6
|
+
|
|
3
7
|
export const calendarOverlayStyles = StyleSheet.create((theme) => ({
|
|
4
8
|
container: {
|
|
5
9
|
position: 'absolute',
|
|
@@ -72,10 +76,11 @@ export const calendarOverlayStyles = StyleSheet.create((theme) => ({
|
|
|
72
76
|
fontWeight: '500',
|
|
73
77
|
color: theme.colors?.text?.primary || '#374151',
|
|
74
78
|
},
|
|
75
|
-
gridButton: {
|
|
79
|
+
gridButton: ({ isSelected }: CalendarOverlayVariants) => ({
|
|
76
80
|
minHeight: 28,
|
|
77
81
|
paddingHorizontal: 8,
|
|
78
82
|
paddingVertical: 4,
|
|
79
83
|
fontSize: 12,
|
|
80
|
-
|
|
84
|
+
color: isSelected ? undefined : theme.colors.text.primary,
|
|
85
|
+
}),
|
|
81
86
|
}));
|
|
@@ -58,8 +58,8 @@ export const CalendarOverlay: React.FC<CalendarOverlayProps> = ({
|
|
|
58
58
|
Select {mode === 'month' ? 'Month' : 'Year'}
|
|
59
59
|
</Text>
|
|
60
60
|
<Button
|
|
61
|
-
|
|
62
|
-
size="
|
|
61
|
+
type="text"
|
|
62
|
+
size="sm"
|
|
63
63
|
onPress={onClose}
|
|
64
64
|
style={calendarOverlayStyles.closeButton}
|
|
65
65
|
>
|
|
@@ -69,26 +69,29 @@ export const CalendarOverlay: React.FC<CalendarOverlayProps> = ({
|
|
|
69
69
|
|
|
70
70
|
{mode === 'month' ? (
|
|
71
71
|
<View style={calendarOverlayStyles.monthGrid}>
|
|
72
|
-
{months.map((month, index) =>
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
72
|
+
{months.map((month, index) => {
|
|
73
|
+
const isSelected = index === currentMonth;
|
|
74
|
+
return (
|
|
75
|
+
<Button
|
|
76
|
+
key={month}
|
|
77
|
+
type={isSelected ? 'contained' : 'text'}
|
|
78
|
+
intent={isSelected ? 'primary' : undefined}
|
|
79
|
+
size="sm"
|
|
80
|
+
onPress={() => handleMonthSelect(index)}
|
|
81
|
+
disabled={disabled}
|
|
82
|
+
style={calendarOverlayStyles.gridButton({ isSelected })}
|
|
83
|
+
>
|
|
84
|
+
{month.slice(0, 3)}
|
|
85
|
+
</Button>
|
|
86
|
+
);
|
|
87
|
+
})}
|
|
85
88
|
</View>
|
|
86
89
|
) : (
|
|
87
90
|
<View style={calendarOverlayStyles.yearContainer}>
|
|
88
91
|
<View style={calendarOverlayStyles.yearNavigation}>
|
|
89
92
|
<Button
|
|
90
|
-
|
|
91
|
-
size="
|
|
93
|
+
type="text"
|
|
94
|
+
size="sm"
|
|
92
95
|
onPress={goToPreviousYearRange}
|
|
93
96
|
disabled={disabled}
|
|
94
97
|
style={calendarOverlayStyles.yearNavButton}
|
|
@@ -99,8 +102,8 @@ export const CalendarOverlay: React.FC<CalendarOverlayProps> = ({
|
|
|
99
102
|
{yearRangeStart} - {yearRangeStart + 19}
|
|
100
103
|
</Text>
|
|
101
104
|
<Button
|
|
102
|
-
|
|
103
|
-
size="
|
|
105
|
+
type="text"
|
|
106
|
+
size="sm"
|
|
104
107
|
onPress={goToNextYearRange}
|
|
105
108
|
disabled={disabled}
|
|
106
109
|
style={calendarOverlayStyles.yearNavButton}
|
|
@@ -109,19 +112,22 @@ export const CalendarOverlay: React.FC<CalendarOverlayProps> = ({
|
|
|
109
112
|
</Button>
|
|
110
113
|
</View>
|
|
111
114
|
<View style={calendarOverlayStyles.yearGrid}>
|
|
112
|
-
{years.map((year) =>
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
115
|
+
{years.map((year) => {
|
|
116
|
+
const isSelected = year === currentYear;
|
|
117
|
+
return (
|
|
118
|
+
<Button
|
|
119
|
+
key={year}
|
|
120
|
+
type={isSelected ? 'contained' : 'text'}
|
|
121
|
+
intent={isSelected ? 'primary' : undefined}
|
|
122
|
+
size="sm"
|
|
123
|
+
onPress={() => handleYearSelect(year)}
|
|
124
|
+
disabled={disabled}
|
|
125
|
+
style={calendarOverlayStyles.gridButton({ isSelected })}
|
|
126
|
+
>
|
|
127
|
+
{year}
|
|
128
|
+
</Button>
|
|
129
|
+
);
|
|
130
|
+
})}
|
|
125
131
|
</View>
|
|
126
132
|
</View>
|
|
127
133
|
)}
|