@idealyst/datepicker 1.0.82 → 1.0.84

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 (30) hide show
  1. package/README.md +1 -1
  2. package/package.json +8 -3
  3. package/src/DateInput/DateInput.native.tsx +1 -1
  4. package/src/DateInput/DateInput.styles.tsx +3 -3
  5. package/src/DateInput/DateInput.web.tsx +1 -1
  6. package/src/DateInput/types.ts +1 -1
  7. package/src/DatePicker/Calendar.native.tsx +2 -2
  8. package/src/DatePicker/Calendar.styles.tsx +24 -21
  9. package/src/DatePicker/Calendar.web.tsx +9 -4
  10. package/src/DatePicker/DatePicker.styles.tsx +5 -5
  11. package/src/DatePicker/types.ts +1 -1
  12. package/src/DateRangePicker/DateRangePicker.styles.tsx +7 -7
  13. package/src/DateRangePicker/RangeCalendar.native.tsx +15 -15
  14. package/src/DateRangePicker/RangeCalendar.styles.tsx +6 -2
  15. package/src/DateRangePicker/RangeCalendar.web.tsx +16 -16
  16. package/src/DateRangePicker/types.ts +1 -1
  17. package/src/DateTimePicker/DateTimePicker.styles.tsx +33 -6
  18. package/src/DateTimePicker/DateTimePickerBase.tsx +10 -29
  19. package/src/DateTimePicker/TimePicker.styles.tsx +2 -5
  20. package/src/DateTimePicker/TimePickerBase.tsx +1 -1
  21. package/src/DateTimePicker/types.ts +1 -1
  22. package/src/DateTimeRangePicker/DateTimeRangePicker.styles.tsx +27 -7
  23. package/src/DateTimeRangePicker/DateTimeRangePickerBase.tsx +11 -21
  24. package/src/DateTimeRangePicker/types.ts +1 -1
  25. package/src/examples/DatePickerExamples.tsx +29 -29
  26. package/src/primitives/CalendarGrid/CalendarGrid.styles.tsx +13 -24
  27. package/src/primitives/CalendarGrid/CalendarGrid.tsx +19 -11
  28. package/src/primitives/CalendarHeader/CalendarHeader.tsx +15 -15
  29. package/src/primitives/CalendarOverlay/CalendarOverlay.styles.tsx +7 -2
  30. 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
- variant="text"
62
- size="small"
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
- <Button
74
- key={month}
75
- variant={index === currentMonth ? 'contained' : 'outlined'}
76
- intent={index === currentMonth ? 'primary' : 'neutral'}
77
- size="small"
78
- onPress={() => handleMonthSelect(index)}
79
- disabled={disabled}
80
- style={calendarOverlayStyles.gridButton}
81
- >
82
- {month.slice(0, 3)}
83
- </Button>
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
- variant="text"
91
- size="small"
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
- variant="text"
103
- size="small"
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
- <Button
114
- key={year}
115
- variant={year === currentYear ? 'contained' : 'outlined'}
116
- intent={year === currentYear ? 'primary' : 'neutral'}
117
- size="small"
118
- onPress={() => handleYearSelect(year)}
119
- disabled={disabled}
120
- style={calendarOverlayStyles.gridButton}
121
- >
122
- {year}
123
- </Button>
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
  )}