@scripso-homepad/ui 0.4.30 → 0.4.31
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/dist/index.cjs +17 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Calendar.tsx +8 -13
- package/src/theme/calendar.ts +11 -9
package/package.json
CHANGED
|
@@ -77,27 +77,20 @@ export type CalendarRangeProps = CalendarBaseProps & {
|
|
|
77
77
|
export type CalendarProps = CalendarSingleProps | CalendarRangeProps;
|
|
78
78
|
|
|
79
79
|
function resolveDayCellStyle(day: CalendarDayCell): StyleProp<ViewStyle> {
|
|
80
|
-
if (day.isDisabled) {
|
|
81
|
-
return [calendarDropdownMetrics.dayCell];
|
|
82
|
-
}
|
|
83
|
-
|
|
84
80
|
if (day.isSelected) {
|
|
85
81
|
return [calendarDropdownMetrics.dayCell, calendarDropdownMetrics.dayCellSelected];
|
|
86
82
|
}
|
|
87
83
|
|
|
84
|
+
const useMutedBackground =
|
|
85
|
+
day.inCurrentMonth && !day.isToday && (day.isPast || day.isDisabled);
|
|
86
|
+
|
|
88
87
|
return [
|
|
89
88
|
calendarDropdownMetrics.dayCell,
|
|
90
|
-
|
|
91
|
-
? calendarDropdownMetrics.dayCellPast
|
|
92
|
-
: null,
|
|
89
|
+
useMutedBackground ? calendarDropdownMetrics.dayCellPast : null,
|
|
93
90
|
];
|
|
94
91
|
}
|
|
95
92
|
|
|
96
93
|
function resolveDayLabelStyle(day: CalendarDayCell): StyleProp<TextStyle> {
|
|
97
|
-
if (day.isDisabled) {
|
|
98
|
-
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelDisabled];
|
|
99
|
-
}
|
|
100
|
-
|
|
101
94
|
if (day.isSelected) {
|
|
102
95
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelSelected];
|
|
103
96
|
}
|
|
@@ -110,7 +103,7 @@ function resolveDayLabelStyle(day: CalendarDayCell): StyleProp<TextStyle> {
|
|
|
110
103
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelToday];
|
|
111
104
|
}
|
|
112
105
|
|
|
113
|
-
if (day.isPast) {
|
|
106
|
+
if (day.isPast || day.isDisabled) {
|
|
114
107
|
return [calendarDropdownMetrics.dayLabel, calendarDropdownMetrics.dayLabelMuted];
|
|
115
108
|
}
|
|
116
109
|
|
|
@@ -364,7 +357,9 @@ export function Calendar(props: CalendarProps) {
|
|
|
364
357
|
>
|
|
365
358
|
<Text style={resolveDayLabelStyle(day)}>{day.date.getDate()}</Text>
|
|
366
359
|
{day.isToday && day.inCurrentMonth && !day.isSelected ? (
|
|
367
|
-
<View style={calendarDropdownMetrics.
|
|
360
|
+
<View style={calendarDropdownMetrics.todayDotWrap}>
|
|
361
|
+
<View style={calendarDropdownMetrics.todayDot} />
|
|
362
|
+
</View>
|
|
368
363
|
) : null}
|
|
369
364
|
</Pressable>
|
|
370
365
|
))}
|
package/src/theme/calendar.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const CALENDAR_NAV_ICON_COLOR = colors.stormGray850;
|
|
|
35
35
|
export const CALENDAR_FIELD_ICON_SIZE = 20;
|
|
36
36
|
export const CALENDAR_FIELD_WIDTH = CALENDAR_PANEL_WIDTH;
|
|
37
37
|
export const CALENDAR_FIELD_HEIGHT = 52;
|
|
38
|
-
export const CALENDAR_FIELD_PADDING =
|
|
38
|
+
export const CALENDAR_FIELD_PADDING = 14;
|
|
39
39
|
export const CALENDAR_FIELD_GAP = spacing.sm;
|
|
40
40
|
export const CALENDAR_FIELD_PLACEHOLDER_COLOR = colors.stormGray200;
|
|
41
41
|
|
|
@@ -217,18 +217,19 @@ export const calendarDropdownMetrics = StyleSheet.create({
|
|
|
217
217
|
},
|
|
218
218
|
dayLabelDisabled: {
|
|
219
219
|
color: colors.stormGray300,
|
|
220
|
-
opacity: 0.5,
|
|
221
220
|
},
|
|
222
|
-
|
|
221
|
+
todayDotWrap: {
|
|
223
222
|
position: "absolute",
|
|
224
|
-
bottom:
|
|
225
|
-
left:
|
|
223
|
+
bottom: 4,
|
|
224
|
+
left: 0,
|
|
225
|
+
right: 0,
|
|
226
|
+
alignItems: "center",
|
|
227
|
+
},
|
|
228
|
+
todayDot: {
|
|
226
229
|
width: CALENDAR_DAY_DOT_SIZE,
|
|
227
230
|
height: CALENDAR_DAY_DOT_SIZE,
|
|
228
|
-
borderRadius:
|
|
231
|
+
borderRadius: CALENDAR_DAY_DOT_SIZE / 2,
|
|
229
232
|
backgroundColor: CALENDAR_TODAY_DOT_COLOR,
|
|
230
|
-
marginLeft: -(CALENDAR_DAY_DOT_SIZE / 2),
|
|
231
|
-
zIndex: 1,
|
|
232
233
|
},
|
|
233
234
|
pickerBody: {
|
|
234
235
|
width: CALENDAR_DAY_GRID_WIDTH,
|
|
@@ -347,7 +348,8 @@ export const calendarFieldMetrics = StyleSheet.create({
|
|
|
347
348
|
paddingVertical: 0,
|
|
348
349
|
paddingHorizontal: 0,
|
|
349
350
|
margin: 0,
|
|
350
|
-
|
|
351
|
+
includeFontPadding: false,
|
|
352
|
+
...(Platform.OS === "android" ? { textAlignVertical: "center" as const } : null),
|
|
351
353
|
...(Platform.OS === "web"
|
|
352
354
|
? ({
|
|
353
355
|
outlineStyle: "none",
|