react-native-paper-dates 0.11.11 → 0.11.12
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/lib/commonjs/Date/Calendar.js +4 -0
- package/lib/commonjs/Date/Calendar.js.map +1 -1
- package/lib/commonjs/Date/CalendarHeader.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalContent.js +1 -1
- package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalContentHeader.js +15 -11
- package/lib/commonjs/Date/DatePickerModalContentHeader.js.map +1 -1
- package/lib/commonjs/Date/DatePickerModalHeader.js +5 -4
- package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
- package/lib/commonjs/Date/Day.js +4 -4
- package/lib/commonjs/Date/Day.js.map +1 -1
- package/lib/commonjs/Date/DayName.js +3 -2
- package/lib/commonjs/Date/DayName.js.map +1 -1
- package/lib/commonjs/Date/Month.js +4 -3
- package/lib/commonjs/Date/Month.js.map +1 -1
- package/lib/commonjs/Date/YearPicker.js +6 -4
- package/lib/commonjs/Date/YearPicker.js.map +1 -1
- package/lib/commonjs/Time/timeUtils.js +5 -1
- package/lib/commonjs/Time/timeUtils.js.map +1 -1
- package/lib/commonjs/utils.js +11 -0
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/Date/Calendar.js +4 -0
- package/lib/module/Date/Calendar.js.map +1 -1
- package/lib/module/Date/CalendarHeader.js.map +1 -1
- package/lib/module/Date/DatePickerModalContent.js +1 -1
- package/lib/module/Date/DatePickerModalContent.js.map +1 -1
- package/lib/module/Date/DatePickerModalContentHeader.js +15 -11
- package/lib/module/Date/DatePickerModalContentHeader.js.map +1 -1
- package/lib/module/Date/DatePickerModalHeader.js +6 -5
- package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
- package/lib/module/Date/Day.js +4 -4
- package/lib/module/Date/Day.js.map +1 -1
- package/lib/module/Date/DayName.js +3 -2
- package/lib/module/Date/DayName.js.map +1 -1
- package/lib/module/Date/Month.js +4 -3
- package/lib/module/Date/Month.js.map +1 -1
- package/lib/module/Date/YearPicker.js +6 -4
- package/lib/module/Date/YearPicker.js.map +1 -1
- package/lib/module/Time/timeUtils.js +5 -1
- package/lib/module/Time/timeUtils.js.map +1 -1
- package/lib/module/utils.js +11 -0
- package/lib/module/utils.js.map +1 -1
- package/lib/typescript/utils.d.ts +1 -1
- package/package.json +1 -1
- package/src/Date/Calendar.tsx +3 -0
- package/src/Date/CalendarHeader.tsx +0 -1
- package/src/Date/DatePickerModalContent.tsx +1 -4
- package/src/Date/DatePickerModalContentHeader.tsx +41 -12
- package/src/Date/DatePickerModalHeader.tsx +4 -3
- package/src/Date/Day.tsx +24 -10
- package/src/Date/DayName.tsx +8 -2
- package/src/Date/Month.tsx +19 -6
- package/src/Date/YearPicker.tsx +8 -2
- package/src/Time/timeUtils.ts +4 -1
- package/src/utils.ts +7 -0
package/lib/module/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","overlay","useTheme","Color","useLatest","value","ref","useRef","current","useHeaderBackgroundColor","theme","
|
|
1
|
+
{"version":3,"names":["React","overlay","useTheme","Color","useLatest","value","ref","useRef","current","useHeaderBackgroundColor","theme","isV3","colors","surface","dark","mode","primary","useHeaderColorIsLight","background","isLight","useHeaderTextColor","onSurfaceVariant","useTextColorOnPrimary","isDark","onSurface","onPrimary","range","start","end","Array","fill","map","_","i","lightenBy","color","ratio","lightness","darkenBy"],"sources":["utils.ts"],"sourcesContent":["import * as React from 'react'\nimport {\n DefaultTheme,\n MD3DarkTheme,\n overlay,\n useTheme,\n} from 'react-native-paper'\nimport Color from 'color'\n\nexport type PaperTheme = typeof MD3DarkTheme | typeof DefaultTheme\n\nexport function useLatest<T>(value: T) {\n const ref = React.useRef(value)\n ref.current = value\n return ref\n}\n\nexport function useHeaderBackgroundColor() {\n const theme = useTheme()\n if (theme.isV3) {\n return theme.colors.surface\n }\n return theme.dark && theme.mode === 'adaptive'\n ? overlay(4, theme.colors.surface)\n : theme.colors.primary\n}\n\nexport function useHeaderColorIsLight() {\n const theme = useTheme()\n const background =\n theme.dark && theme.mode === 'adaptive'\n ? theme.colors.surface\n : theme.colors.primary\n return Color(background).isLight()\n}\n\nexport function useHeaderTextColor() {\n const theme = useTheme()\n const isLight = useHeaderColorIsLight()\n if (theme.isV3) {\n return theme.colors.onSurfaceVariant\n }\n return !isLight ? '#fff' : '#000'\n}\n\nexport function useTextColorOnPrimary() {\n const theme = useTheme()\n const isDark = !Color(theme.colors.primary).isLight()\n\n if (theme.isV3) {\n if (isDark && theme.dark) {\n return theme.colors.onSurface\n } else {\n return theme.colors.onPrimary\n }\n }\n\n return isDark ? '#fff' : '#000'\n}\n\nexport function range(start: number, end: number) {\n return Array(end - start + 1)\n .fill(null)\n .map((_, i) => start + i)\n}\n\nexport function lightenBy(color: Color, ratio: number) {\n const lightness = color.lightness()\n return color.lightness(lightness + (100 - lightness) * ratio)\n}\n\nexport function darkenBy(color: Color, ratio: number) {\n const lightness = color.lightness()\n return color.lightness(lightness - lightness * ratio)\n}\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAGEC,OAHF,EAIEC,QAJF,QAKO,oBALP;AAMA,OAAOC,KAAP,MAAkB,OAAlB;AAIA,OAAO,SAASC,SAAT,CAAsBC,KAAtB,EAAgC;EACrC,MAAMC,GAAG,GAAGN,KAAK,CAACO,MAAN,CAAaF,KAAb,CAAZ;EACAC,GAAG,CAACE,OAAJ,GAAcH,KAAd;EACA,OAAOC,GAAP;AACD;AAED,OAAO,SAASG,wBAAT,GAAoC;EACzC,MAAMC,KAAK,GAAGR,QAAQ,EAAtB;;EACA,IAAIQ,KAAK,CAACC,IAAV,EAAgB;IACd,OAAOD,KAAK,CAACE,MAAN,CAAaC,OAApB;EACD;;EACD,OAAOH,KAAK,CAACI,IAAN,IAAcJ,KAAK,CAACK,IAAN,KAAe,UAA7B,GACHd,OAAO,CAAC,CAAD,EAAIS,KAAK,CAACE,MAAN,CAAaC,OAAjB,CADJ,GAEHH,KAAK,CAACE,MAAN,CAAaI,OAFjB;AAGD;AAED,OAAO,SAASC,qBAAT,GAAiC;EACtC,MAAMP,KAAK,GAAGR,QAAQ,EAAtB;EACA,MAAMgB,UAAU,GACdR,KAAK,CAACI,IAAN,IAAcJ,KAAK,CAACK,IAAN,KAAe,UAA7B,GACIL,KAAK,CAACE,MAAN,CAAaC,OADjB,GAEIH,KAAK,CAACE,MAAN,CAAaI,OAHnB;EAIA,OAAOb,KAAK,CAACe,UAAD,CAAL,CAAkBC,OAAlB,EAAP;AACD;AAED,OAAO,SAASC,kBAAT,GAA8B;EACnC,MAAMV,KAAK,GAAGR,QAAQ,EAAtB;EACA,MAAMiB,OAAO,GAAGF,qBAAqB,EAArC;;EACA,IAAIP,KAAK,CAACC,IAAV,EAAgB;IACd,OAAOD,KAAK,CAACE,MAAN,CAAaS,gBAApB;EACD;;EACD,OAAO,CAACF,OAAD,GAAW,MAAX,GAAoB,MAA3B;AACD;AAED,OAAO,SAASG,qBAAT,GAAiC;EACtC,MAAMZ,KAAK,GAAGR,QAAQ,EAAtB;EACA,MAAMqB,MAAM,GAAG,CAACpB,KAAK,CAACO,KAAK,CAACE,MAAN,CAAaI,OAAd,CAAL,CAA4BG,OAA5B,EAAhB;;EAEA,IAAIT,KAAK,CAACC,IAAV,EAAgB;IACd,IAAIY,MAAM,IAAIb,KAAK,CAACI,IAApB,EAA0B;MACxB,OAAOJ,KAAK,CAACE,MAAN,CAAaY,SAApB;IACD,CAFD,MAEO;MACL,OAAOd,KAAK,CAACE,MAAN,CAAaa,SAApB;IACD;EACF;;EAED,OAAOF,MAAM,GAAG,MAAH,GAAY,MAAzB;AACD;AAED,OAAO,SAASG,KAAT,CAAeC,KAAf,EAA8BC,GAA9B,EAA2C;EAChD,OAAOC,KAAK,CAACD,GAAG,GAAGD,KAAN,GAAc,CAAf,CAAL,CACJG,IADI,CACC,IADD,EAEJC,GAFI,CAEA,CAACC,CAAD,EAAIC,CAAJ,KAAUN,KAAK,GAAGM,CAFlB,CAAP;AAGD;AAED,OAAO,SAASC,SAAT,CAAmBC,KAAnB,EAAiCC,KAAjC,EAAgD;EACrD,MAAMC,SAAS,GAAGF,KAAK,CAACE,SAAN,EAAlB;EACA,OAAOF,KAAK,CAACE,SAAN,CAAgBA,SAAS,GAAG,CAAC,MAAMA,SAAP,IAAoBD,KAAhD,CAAP;AACD;AAED,OAAO,SAASE,QAAT,CAAkBH,KAAlB,EAAgCC,KAAhC,EAA+C;EACpD,MAAMC,SAAS,GAAGF,KAAK,CAACE,SAAN,EAAlB;EACA,OAAOF,KAAK,CAACE,SAAN,CAAgBA,SAAS,GAAGA,SAAS,GAAGD,KAAxC,CAAP;AACD"}
|
|
@@ -5,7 +5,7 @@ export type PaperTheme = typeof MD3DarkTheme | typeof DefaultTheme;
|
|
|
5
5
|
export declare function useLatest<T>(value: T): React.MutableRefObject<T>;
|
|
6
6
|
export declare function useHeaderBackgroundColor(): string;
|
|
7
7
|
export declare function useHeaderColorIsLight(): boolean;
|
|
8
|
-
export declare function useHeaderTextColor():
|
|
8
|
+
export declare function useHeaderTextColor(): string;
|
|
9
9
|
export declare function useTextColorOnPrimary(): string;
|
|
10
10
|
export declare function range(start: number, end: number): number[];
|
|
11
11
|
export declare function lightenBy(color: Color, ratio: number): Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | Color<string | number | any | ArrayLike<number> | {
|
package/package.json
CHANGED
package/src/Date/Calendar.tsx
CHANGED
|
@@ -100,6 +100,9 @@ function Calendar(
|
|
|
100
100
|
const theme = useTheme()
|
|
101
101
|
|
|
102
102
|
const selectColor = useMemo<string>(() => {
|
|
103
|
+
if (theme.isV3) {
|
|
104
|
+
return theme.colors.primaryContainer
|
|
105
|
+
}
|
|
103
106
|
if (theme.dark) {
|
|
104
107
|
return darkenBy(Color(theme.colors.primary), 0.1).hex()
|
|
105
108
|
}
|
|
@@ -11,7 +11,6 @@ import Calendar, {
|
|
|
11
11
|
} from './Calendar'
|
|
12
12
|
|
|
13
13
|
import AnimatedCrossView from './AnimatedCrossView'
|
|
14
|
-
|
|
15
14
|
import DatePickerModalHeader from './DatePickerModalHeader'
|
|
16
15
|
import DatePickerModalContentHeader, {
|
|
17
16
|
HeaderPickProps,
|
|
@@ -86,7 +85,6 @@ export function DatePickerModalContent(
|
|
|
86
85
|
startYear,
|
|
87
86
|
endYear,
|
|
88
87
|
} = props
|
|
89
|
-
|
|
90
88
|
const anyProps = props as any
|
|
91
89
|
|
|
92
90
|
// use local state to add only onConfirm state changes
|
|
@@ -164,11 +162,10 @@ export function DatePickerModalContent(
|
|
|
164
162
|
endLabel={props.endLabel}
|
|
165
163
|
uppercase={props.uppercase ?? true}
|
|
166
164
|
locale={locale}
|
|
167
|
-
editIcon={props
|
|
165
|
+
editIcon={props?.editIcon}
|
|
168
166
|
calendarIcon={props.calendarIcon}
|
|
169
167
|
/>
|
|
170
168
|
</DatePickerModalHeaderBackground>
|
|
171
|
-
|
|
172
169
|
<AnimatedCrossView
|
|
173
170
|
collapsed={collapsed}
|
|
174
171
|
calendar={
|
|
@@ -58,23 +58,26 @@ export default function DatePickerModalContentHeader(
|
|
|
58
58
|
mode,
|
|
59
59
|
moreLabel,
|
|
60
60
|
uppercase,
|
|
61
|
-
editIcon
|
|
62
|
-
calendarIcon
|
|
61
|
+
editIcon,
|
|
62
|
+
calendarIcon,
|
|
63
63
|
} = props
|
|
64
64
|
const theme = useTheme()
|
|
65
65
|
const label = getLabel(props.locale, props.mode, props.label)
|
|
66
66
|
|
|
67
67
|
const color = useHeaderTextColor()
|
|
68
|
+
const supportingTextColor = theme.isV3 ? theme.colors.onSurfaceVariant : color
|
|
68
69
|
const allowEditing = mode !== 'multiple'
|
|
69
70
|
|
|
70
71
|
let textFont = theme?.isV3
|
|
71
|
-
? theme.fonts.
|
|
72
|
+
? theme.fonts.labelMedium
|
|
72
73
|
: (theme as any as MD2Theme).fonts.medium
|
|
73
74
|
|
|
74
75
|
return (
|
|
75
|
-
<View style={
|
|
76
|
+
<View style={styles.header}>
|
|
76
77
|
<View>
|
|
77
|
-
<Text
|
|
78
|
+
<Text
|
|
79
|
+
style={[styles.label, { color: supportingTextColor, ...textFont }]}
|
|
80
|
+
>
|
|
78
81
|
{uppercase ? label.toUpperCase() : label}
|
|
79
82
|
</Text>
|
|
80
83
|
<View style={styles.headerContentContainer}>
|
|
@@ -96,13 +99,21 @@ export default function DatePickerModalContentHeader(
|
|
|
96
99
|
<View style={styles.fill} />
|
|
97
100
|
{allowEditing ? (
|
|
98
101
|
<IconButton
|
|
99
|
-
icon={
|
|
102
|
+
icon={
|
|
103
|
+
collapsed
|
|
104
|
+
? editIcon ?? theme.isV3
|
|
105
|
+
? 'pencil-outline'
|
|
106
|
+
: 'pencil'
|
|
107
|
+
: calendarIcon ?? theme.isV3
|
|
108
|
+
? 'calendar-blank'
|
|
109
|
+
: 'calendar'
|
|
110
|
+
}
|
|
100
111
|
accessibilityLabel={
|
|
101
112
|
collapsed
|
|
102
113
|
? getTranslation(props.locale, 'typeInDate')
|
|
103
114
|
: getTranslation(props.locale, 'pickDateFromCalendar')
|
|
104
115
|
}
|
|
105
|
-
iconColor={color}
|
|
116
|
+
iconColor={theme.isV3 ? theme.colors.onSurface : color}
|
|
106
117
|
onPress={onToggle}
|
|
107
118
|
/>
|
|
108
119
|
) : null}
|
|
@@ -116,8 +127,13 @@ export function HeaderContentSingle({
|
|
|
116
127
|
color,
|
|
117
128
|
locale,
|
|
118
129
|
}: HeaderContentProps & { color: string }) {
|
|
130
|
+
const theme = useTheme()
|
|
119
131
|
const lighterColor = Color(color).fade(0.5).rgb().toString()
|
|
120
|
-
const dateColor = state.date
|
|
132
|
+
const dateColor = state.date
|
|
133
|
+
? theme.isV3
|
|
134
|
+
? theme.colors.onSurface
|
|
135
|
+
: color
|
|
136
|
+
: lighterColor
|
|
121
137
|
|
|
122
138
|
const formatter = React.useMemo(() => {
|
|
123
139
|
return new Intl.DateTimeFormat(locale, {
|
|
@@ -140,9 +156,14 @@ export function HeaderContentMulti({
|
|
|
140
156
|
color,
|
|
141
157
|
locale,
|
|
142
158
|
}: HeaderContentProps & { color: string; moreLabel: string | undefined }) {
|
|
159
|
+
const theme = useTheme()
|
|
143
160
|
const dateCount = state.dates?.length || 0
|
|
144
161
|
const lighterColor = Color(color).fade(0.5).rgb().toString()
|
|
145
|
-
const dateColor = dateCount
|
|
162
|
+
const dateColor = dateCount
|
|
163
|
+
? theme.isV3
|
|
164
|
+
? theme.colors.onSurface
|
|
165
|
+
: color
|
|
166
|
+
: lighterColor
|
|
146
167
|
|
|
147
168
|
const formatter = React.useMemo(() => {
|
|
148
169
|
return new Intl.DateTimeFormat(locale, {
|
|
@@ -174,6 +195,7 @@ export function HeaderContentRange({
|
|
|
174
195
|
endLabel = 'End',
|
|
175
196
|
color,
|
|
176
197
|
}: HeaderContentProps & { color: string }) {
|
|
198
|
+
const theme = useTheme()
|
|
177
199
|
const formatter = React.useMemo(() => {
|
|
178
200
|
return new Intl.DateTimeFormat(locale, {
|
|
179
201
|
month: 'short',
|
|
@@ -182,8 +204,16 @@ export function HeaderContentRange({
|
|
|
182
204
|
}, [locale])
|
|
183
205
|
|
|
184
206
|
const lighterColor = Color(color).fade(0.5).rgb().toString()
|
|
185
|
-
const startColor = state.startDate
|
|
186
|
-
|
|
207
|
+
const startColor = state.startDate
|
|
208
|
+
? theme.isV3
|
|
209
|
+
? theme.colors.onSurface
|
|
210
|
+
: color
|
|
211
|
+
: lighterColor
|
|
212
|
+
const endColor = state.endDate
|
|
213
|
+
? theme.isV3
|
|
214
|
+
? theme.colors.onSurface
|
|
215
|
+
: color
|
|
216
|
+
: lighterColor
|
|
187
217
|
|
|
188
218
|
return (
|
|
189
219
|
<>
|
|
@@ -226,7 +256,6 @@ const styles = StyleSheet.create({
|
|
|
226
256
|
marginTop: -3,
|
|
227
257
|
marginLeft: 3,
|
|
228
258
|
},
|
|
229
|
-
|
|
230
259
|
headerSeparator: {
|
|
231
260
|
color: 'rgba(255,255,255,1)',
|
|
232
261
|
fontSize: 25,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react'
|
|
2
2
|
import { Animated, StyleSheet } from 'react-native'
|
|
3
|
-
import { Appbar, Button } from 'react-native-paper'
|
|
3
|
+
import { Appbar, Button, useTheme } from 'react-native-paper'
|
|
4
4
|
|
|
5
5
|
import { useHeaderTextColor } from '../utils'
|
|
6
6
|
import { getTranslation } from '../translations/utils'
|
|
@@ -20,6 +20,7 @@ export interface DatePickerModalHeaderProps {
|
|
|
20
20
|
export default function DatePickerModalHeader(
|
|
21
21
|
props: DatePickerModalHeaderProps
|
|
22
22
|
) {
|
|
23
|
+
const theme = useTheme()
|
|
23
24
|
const { disableSafeTop, locale, closeIcon = 'close' } = props
|
|
24
25
|
const saveLabel = props.saveLabel || getTranslation(locale, 'save')
|
|
25
26
|
const color = useHeaderTextColor()
|
|
@@ -29,6 +30,7 @@ export default function DatePickerModalHeader(
|
|
|
29
30
|
<Animated.View
|
|
30
31
|
style={[
|
|
31
32
|
styles.animated,
|
|
33
|
+
// eslint-disable-next-line react-native/no-inline-styles
|
|
32
34
|
{
|
|
33
35
|
paddingTop: disableSafeTop ? 0 : insets.top,
|
|
34
36
|
paddingLeft: insets.left,
|
|
@@ -47,7 +49,7 @@ export default function DatePickerModalHeader(
|
|
|
47
49
|
<Appbar.Content title={''} />
|
|
48
50
|
<Button
|
|
49
51
|
color={color}
|
|
50
|
-
textColor={color}
|
|
52
|
+
textColor={theme.isV3 ? theme.colors.primary : color}
|
|
51
53
|
onPress={props.onSave}
|
|
52
54
|
disabled={props.saveLabelDisabled ?? false}
|
|
53
55
|
uppercase={props.uppercase ?? true}
|
|
@@ -90,6 +92,5 @@ const styles = StyleSheet.create({
|
|
|
90
92
|
appbarHeader: {
|
|
91
93
|
elevation: 0,
|
|
92
94
|
backgroundColor: 'transparent',
|
|
93
|
-
// alignItems:'center'
|
|
94
95
|
},
|
|
95
96
|
})
|
package/src/Date/Day.tsx
CHANGED
|
@@ -47,17 +47,27 @@ function Day(props: {
|
|
|
47
47
|
onPressDate(new Date(year, month, day))
|
|
48
48
|
}, [onPressDate, year, month, day])
|
|
49
49
|
|
|
50
|
-
const borderColor =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
50
|
+
const borderColor = theme.isV3
|
|
51
|
+
? theme.colors.primary
|
|
52
|
+
: selected || (inRange && theme.dark)
|
|
53
|
+
? textColorOnPrimary
|
|
54
|
+
: theme.dark
|
|
55
|
+
? '#fff'
|
|
56
|
+
: '#000'
|
|
57
|
+
|
|
56
58
|
const textColor =
|
|
57
|
-
|
|
59
|
+
theme.isV3 && selected
|
|
60
|
+
? theme.colors.onPrimary
|
|
61
|
+
: theme.isV3 && inRange && theme.dark
|
|
62
|
+
? theme.colors.onPrimaryContainer
|
|
63
|
+
: selected || (inRange && theme.dark)
|
|
64
|
+
? textColorOnPrimary
|
|
65
|
+
: theme.isV3
|
|
66
|
+
? theme.colors.onSurface
|
|
67
|
+
: undefined
|
|
58
68
|
|
|
59
69
|
let textFont = theme?.isV3
|
|
60
|
-
? theme.fonts.
|
|
70
|
+
? theme.fonts.bodySmall
|
|
61
71
|
: (theme as any as MD2Theme).fonts.medium
|
|
62
72
|
|
|
63
73
|
return (
|
|
@@ -68,7 +78,6 @@ function Day(props: {
|
|
|
68
78
|
rightCrop={rightCrop}
|
|
69
79
|
selectColor={selectColor}
|
|
70
80
|
/>
|
|
71
|
-
|
|
72
81
|
<TouchableRipple
|
|
73
82
|
testID={`react-native-paper-dates-day-${year}-${month}-${day}`}
|
|
74
83
|
disabled={disabled}
|
|
@@ -89,7 +98,12 @@ function Day(props: {
|
|
|
89
98
|
>
|
|
90
99
|
<Text
|
|
91
100
|
style={[
|
|
92
|
-
textColor
|
|
101
|
+
textColor
|
|
102
|
+
? {
|
|
103
|
+
color:
|
|
104
|
+
theme.isV3 && isToday ? theme.colors.primary : textColor,
|
|
105
|
+
}
|
|
106
|
+
: undefined,
|
|
93
107
|
{ ...textFont },
|
|
94
108
|
]}
|
|
95
109
|
selectable={false}
|
package/src/Date/DayName.tsx
CHANGED
|
@@ -6,12 +6,18 @@ function DayName({ label }: { label: string }) {
|
|
|
6
6
|
const theme = useTheme()
|
|
7
7
|
|
|
8
8
|
let textFont = theme?.isV3
|
|
9
|
-
? theme.fonts.
|
|
9
|
+
? theme.fonts.bodySmall
|
|
10
10
|
: (theme as any as MD2Theme).fonts.medium
|
|
11
11
|
|
|
12
12
|
return (
|
|
13
13
|
<View style={styles.dayName}>
|
|
14
|
-
<Text
|
|
14
|
+
<Text
|
|
15
|
+
style={[
|
|
16
|
+
styles.dayNameLabel,
|
|
17
|
+
{ ...textFont, color: theme.colors.onSurface },
|
|
18
|
+
]}
|
|
19
|
+
selectable={false}
|
|
20
|
+
>
|
|
15
21
|
{label}
|
|
16
22
|
</Text>
|
|
17
23
|
</View>
|
package/src/Date/Month.tsx
CHANGED
|
@@ -251,7 +251,7 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
|
|
|
251
251
|
])
|
|
252
252
|
|
|
253
253
|
let textFont = theme?.isV3
|
|
254
|
-
? theme.fonts.
|
|
254
|
+
? theme.fonts.titleSmall
|
|
255
255
|
: (theme as any as MD2Theme).fonts.medium
|
|
256
256
|
|
|
257
257
|
return (
|
|
@@ -288,7 +288,15 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
|
|
|
288
288
|
]}
|
|
289
289
|
>
|
|
290
290
|
<Text
|
|
291
|
-
style={[
|
|
291
|
+
style={[
|
|
292
|
+
styles.monthLabel,
|
|
293
|
+
{
|
|
294
|
+
...textFont,
|
|
295
|
+
color: theme.isV3
|
|
296
|
+
? theme.colors.onSurfaceVariant
|
|
297
|
+
: theme.colors.onSurface,
|
|
298
|
+
},
|
|
299
|
+
]}
|
|
292
300
|
selectable={false}
|
|
293
301
|
>
|
|
294
302
|
{monthName} {year}
|
|
@@ -296,13 +304,20 @@ function Month(props: MonthSingleProps | MonthRangeProps | MonthMultiProps) {
|
|
|
296
304
|
<View style={isHorizontal ? styles.opacity1 : styles.opacity0}>
|
|
297
305
|
<IconButton
|
|
298
306
|
onPress={isHorizontal ? () => onPressYear(year) : undefined}
|
|
299
|
-
icon={
|
|
307
|
+
icon={
|
|
308
|
+
selectingYear
|
|
309
|
+
? theme.isV3
|
|
310
|
+
? 'menu-up'
|
|
311
|
+
: 'chevron-up'
|
|
312
|
+
: theme.isV3
|
|
313
|
+
? 'menu-down'
|
|
314
|
+
: 'chevron-down'
|
|
315
|
+
}
|
|
300
316
|
/>
|
|
301
317
|
</View>
|
|
302
318
|
</View>
|
|
303
319
|
</TouchableRipple>
|
|
304
320
|
</View>
|
|
305
|
-
|
|
306
321
|
{grid.map(({ weekIndex, generatedDays }) => (
|
|
307
322
|
<View style={styles.week} key={weekIndex}>
|
|
308
323
|
{generatedDays
|
|
@@ -350,9 +365,7 @@ const styles = StyleSheet.create({
|
|
|
350
365
|
marginBottom: weekMargin,
|
|
351
366
|
height: daySize,
|
|
352
367
|
},
|
|
353
|
-
|
|
354
368
|
month: {},
|
|
355
|
-
|
|
356
369
|
monthHeader: {
|
|
357
370
|
height: montHeaderHeight,
|
|
358
371
|
justifyContent: 'center',
|
package/src/Date/YearPicker.tsx
CHANGED
|
@@ -96,7 +96,14 @@ function YearPure({
|
|
|
96
96
|
<Text
|
|
97
97
|
style={[
|
|
98
98
|
styles.yearLabel,
|
|
99
|
-
selected
|
|
99
|
+
selected
|
|
100
|
+
? // eslint-disable-next-line react-native/no-inline-styles
|
|
101
|
+
{ color: theme.isV3 ? theme.colors.onPrimary : '#fff' }
|
|
102
|
+
: {
|
|
103
|
+
color: theme.isV3
|
|
104
|
+
? theme.colors.onSurfaceVariant
|
|
105
|
+
: undefined,
|
|
106
|
+
},
|
|
100
107
|
{ ...textFont },
|
|
101
108
|
]}
|
|
102
109
|
selectable={false}
|
|
@@ -127,7 +134,6 @@ const styles = StyleSheet.create({
|
|
|
127
134
|
height: ITEM_HEIGHT,
|
|
128
135
|
justifyContent: 'center',
|
|
129
136
|
},
|
|
130
|
-
selectedYear: { color: '#fff' },
|
|
131
137
|
yearButton: {
|
|
132
138
|
borderRadius: 46 / 2,
|
|
133
139
|
overflow: 'hidden',
|
package/src/Time/timeUtils.ts
CHANGED
|
@@ -265,7 +265,10 @@ export function toHourOutputFormat(
|
|
|
265
265
|
if (is24Hour) {
|
|
266
266
|
return newHours
|
|
267
267
|
}
|
|
268
|
-
if (
|
|
268
|
+
if (previousHours === 0 && newHours !== 0) {
|
|
269
|
+
return newHours - 12 < 0 ? newHours : newHours - 12
|
|
270
|
+
}
|
|
271
|
+
if (previousHours >= 12 && newHours < 12) {
|
|
269
272
|
return newHours + 12
|
|
270
273
|
}
|
|
271
274
|
return newHours
|
package/src/utils.ts
CHANGED
|
@@ -17,6 +17,9 @@ export function useLatest<T>(value: T) {
|
|
|
17
17
|
|
|
18
18
|
export function useHeaderBackgroundColor() {
|
|
19
19
|
const theme = useTheme()
|
|
20
|
+
if (theme.isV3) {
|
|
21
|
+
return theme.colors.surface
|
|
22
|
+
}
|
|
20
23
|
return theme.dark && theme.mode === 'adaptive'
|
|
21
24
|
? overlay(4, theme.colors.surface)
|
|
22
25
|
: theme.colors.primary
|
|
@@ -32,7 +35,11 @@ export function useHeaderColorIsLight() {
|
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
export function useHeaderTextColor() {
|
|
38
|
+
const theme = useTheme()
|
|
35
39
|
const isLight = useHeaderColorIsLight()
|
|
40
|
+
if (theme.isV3) {
|
|
41
|
+
return theme.colors.onSurfaceVariant
|
|
42
|
+
}
|
|
36
43
|
return !isLight ? '#fff' : '#000'
|
|
37
44
|
}
|
|
38
45
|
|