@fountain-ui/lab 3.0.0-alpha.1 → 3.0.0-alpha.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.
@@ -40,7 +40,7 @@ function DateTimePicker(props) {
40
40
  } = props;
41
41
  const theme = (0, _styles.useTheme)();
42
42
  const textDayFontStyle = (0, _core.createFontStyle)(theme, {
43
- selector: typo => typo.body2
43
+ selector: typo => typo.body2.medium
44
44
  });
45
45
 
46
46
  const [yearPickerVisible, setYearPickerVisible] = _react.default.useState(false);
@@ -1 +1 @@
1
- {"version":3,"names":["useDateTimePicker","React","useContext","DateTimePickerContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","useTheme","textDayFontStyle","createFontStyle","selector","typo","body2","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","LocaleConfig","defaultLocale","format","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","formatDate","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint","textDayFontFamily","fontFamily","textDayFontSize","fontSize","textDayFontWeight","fontWeight","textDayHeaderFontFamily","textDayHeaderFontSize","textDayHeaderFontWeight"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, createFontStyle, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2 });\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'strong'}/>;\n const RightArrow = <Typography children={'>'} color={'strong'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n textDayFontFamily: textDayFontStyle.fontFamily,\n textDayFontSize: textDayFontStyle.fontSize,\n textDayFontWeight: textDayFontStyle.fontWeight,\n textDayHeaderFontFamily: textDayFontStyle.fontFamily,\n textDayHeaderFontSize: textDayFontStyle.fontSize,\n textDayHeaderFontWeight: textDayFontStyle.fontWeight,\n }}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AAC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AACmC,UALjC;MAMHC,eAAe,EAAEpC,gBAAgB,CAACqC,QAN/B;MAOHC,iBAAiB,EAAEtC,gBAAgB,CAACuC,UAPjC;MAQHC,uBAAuB,EAAExC,gBAAgB,CAACmC,UARvC;MASHM,qBAAqB,EAAEzC,gBAAgB,CAACqC,QATrC;MAUHK,uBAAuB,EAAE1C,gBAAgB,CAACuC;IAVvC;EAvBX,EADJ;AAsCH;;AAAA"}
1
+ {"version":3,"names":["useDateTimePicker","React","useContext","DateTimePickerContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","useTheme","textDayFontStyle","createFontStyle","selector","typo","body2","medium","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","LocaleConfig","defaultLocale","format","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","formatDate","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint","textDayFontFamily","fontFamily","textDayFontSize","fontSize","textDayFontWeight","fontWeight","textDayHeaderFontFamily","textDayHeaderFontSize","textDayHeaderFontWeight"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, createFontStyle, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2.medium });\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'strong'}/>;\n const RightArrow = <Typography children={'>'} color={'strong'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n textDayFontFamily: textDayFontStyle.fontFamily,\n textDayFontSize: textDayFontStyle.fontSize,\n textDayFontWeight: textDayFontStyle.fontWeight,\n textDayHeaderFontFamily: textDayFontStyle.fontFamily,\n textDayHeaderFontSize: textDayFontStyle.fontSize,\n textDayHeaderFontWeight: textDayFontStyle.fontWeight,\n }}\n />\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;AAPA;AASA,MAAMA,iBAAiB,GAAG,MAAM;EAC5B,OAAOC,cAAA,CAAM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B,EAAEvC,gBAAgB,CAACwC,UAPjC;MAQHC,uBAAuB,EAAEzC,gBAAgB,CAACoC,UARvC;MASHM,qBAAqB,EAAE1C,gBAAgB,CAACsC,QATrC;MAUHK,uBAAuB,EAAE3C,gBAAgB,CAACwC;IAVvC;EAvBX,EADJ;AAsCH;;AAAA"}
@@ -24,7 +24,7 @@ export default function DateTimePicker(props) {
24
24
  } = props;
25
25
  const theme = useTheme();
26
26
  const textDayFontStyle = createFontStyle(theme, {
27
- selector: typo => typo.body2
27
+ selector: typo => typo.body2.medium
28
28
  });
29
29
  const [yearPickerVisible, setYearPickerVisible] = React.useState(false);
30
30
  const {
@@ -1 +1 @@
1
- {"version":3,"names":["React","format","Calendar","LocaleConfig","Button","createFontStyle","Typography","useTheme","YearPicker","DateTimePickerContext","formatDate","useDateTimePicker","useContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","textDayFontStyle","selector","typo","body2","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","defaultLocale","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint","textDayFontFamily","fontFamily","textDayFontSize","fontSize","textDayFontWeight","fontWeight","textDayHeaderFontFamily","textDayHeaderFontSize","textDayHeaderFontWeight"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, createFontStyle, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2 });\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'strong'}/>;\n const RightArrow = <Typography children={'>'} color={'strong'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n textDayFontFamily: textDayFontStyle.fontFamily,\n textDayFontSize: textDayFontStyle.fontSize,\n textDayFontWeight: textDayFontStyle.fontWeight,\n textDayHeaderFontFamily: textDayFontStyle.fontFamily,\n textDayHeaderFontSize: textDayFontStyle.fontSize,\n textDayHeaderFontWeight: textDayFontStyle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KAAK,CAACiB,OAAN,CAAcO,KAAd,CAAoBC,OADlC;MAEHC,kBAAkB,EAAE1B,KAAK,CAACiB,OAAN,CAAcO,KAAd,CAAoBC,OAFrC;MAGHE,YAAY,EAAE3B,KAAK,CAACiB,OAAN,CAAcW,IAAd,CAAmBV,OAH9B;MAIHW,iBAAiB,EAAE7B,KAAK,CAACiB,OAAN,CAAcW,IAAd,CAAmBE,IAJnC;MAKHC,iBAAiB,EAAE9B,gBAAgB,CAAC+B,UALjC;MAMHC,eAAe,EAAEhC,gBAAgB,CAACiC,QAN/B;MAOHC,iBAAiB,EAAElC,gBAAgB,CAACmC,UAPjC;MAQHC,uBAAuB,EAAEpC,gBAAgB,CAAC+B,UARvC;MASHM,qBAAqB,EAAErC,gBAAgB,CAACiC,QATrC;MAUHK,uBAAuB,EAAEtC,gBAAgB,CAACmC;IAVvC;EAvBX,EADJ;AAsCH;AAAA"}
1
+ {"version":3,"names":["React","format","Calendar","LocaleConfig","Button","createFontStyle","Typography","useTheme","YearPicker","DateTimePickerContext","formatDate","useDateTimePicker","useContext","DateTimePicker","props","currentMonth","Date","locale","markedDate","markedDateProp","maxDate","minDate","onDayPress","onYearPress","onYearPressProp","theme","textDayFontStyle","selector","typo","body2","medium","yearPickerVisible","setYearPickerVisible","useState","locales","LeftArrow","RightArrow","date","defaultLocale","direction","selected","disableTouchEvent","selectedColor","palette","primary","main","selectedTextColor","contrastTextColor","toDate","backgroundColor","paper","default","calendarBackground","dayTextColor","text","textDisabledColor","hint","textDayFontFamily","fontFamily","textDayFontSize","fontSize","textDayFontWeight","fontWeight","textDayHeaderFontFamily","textDayHeaderFontSize","textDayHeaderFontWeight"],"sources":["DateTimePicker.tsx"],"sourcesContent":["import React from 'react';\nimport { format } from 'date-fns';\n//@ts-ignore\nimport { Calendar, LocaleConfig } from 'react-native-calendars';\nimport { Button, createFontStyle, Typography } from '@fountain-ui/core';\nimport { useTheme } from '@fountain-ui/styles';\nimport YearPicker from './YearPicker';\nimport { DateTimePickerContext } from './DateTimePickerProvider';\nimport type DateTimePickerProps from './DateTimePickerProps';\nimport { formatDate } from './utils';\n\nconst useDateTimePicker = () => {\n return React.useContext(DateTimePickerContext);\n};\n\nexport default function DateTimePicker(props: DateTimePickerProps) {\n const {\n currentMonth = new Date(),\n locale,\n markedDate: markedDateProp,\n maxDate,\n minDate,\n onDayPress,\n onYearPress: onYearPressProp,\n } = props;\n\n const theme = useTheme();\n\n const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2.medium });\n\n const [yearPickerVisible, setYearPickerVisible] = React.useState(false);\n const { locales } = useDateTimePicker();\n\n //TODO: Need to update arrow components\n const LeftArrow = <Typography children={'<'} color={'strong'}/>;\n const RightArrow = <Typography children={'>'} color={'strong'}/>;\n\n const onYearPress = (date: Date) => {\n setYearPickerVisible(false);\n onYearPressProp && onYearPressProp(date);\n };\n\n if (locale) {\n LocaleConfig.locales = locales;\n LocaleConfig.defaultLocale = locale;\n }\n\n const markedDate = markedDateProp ? format(markedDateProp, 'yyyy-MM-dd') : '';\n\n if (yearPickerVisible) {\n return (\n <YearPicker\n date={currentMonth}\n locale={locale}\n maxDate={maxDate}\n minDate={minDate}\n onYearPress={onYearPress}\n />\n );\n }\n\n return (\n <Calendar\n current={currentMonth}\n onDayPress={onDayPress}\n maxDate={maxDate}\n minDate={minDate}\n renderArrow={(direction: string) => direction === 'left' ? LeftArrow : RightArrow}\n markedDates={{\n [markedDate]: {\n selected: true,\n disableTouchEvent: true,\n selectedColor: theme.palette.primary.main,\n selectedTextColor: theme.palette.primary.contrastTextColor,\n },\n }}\n // @ts-ignore\n renderHeader={(date) => (\n <Button\n children={formatDate(date.toDate(), locale)}\n variant={'text'}\n size={'small'}\n onPress={() => setYearPickerVisible(true)}\n />\n )}\n theme={{\n backgroundColor: theme.palette.paper.default,\n calendarBackground: theme.palette.paper.default,\n dayTextColor: theme.palette.text.primary,\n textDisabledColor: theme.palette.text.hint,\n textDayFontFamily: textDayFontStyle.fontFamily,\n textDayFontSize: textDayFontStyle.fontSize,\n textDayFontWeight: textDayFontStyle.fontWeight,\n textDayHeaderFontFamily: textDayFontStyle.fontFamily,\n textDayHeaderFontSize: textDayFontStyle.fontSize,\n textDayHeaderFontWeight: textDayFontStyle.fontWeight,\n }}\n />\n );\n};\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,MAAT,QAAuB,UAAvB,C,CACA;;AACA,SAASC,QAAT,EAAmBC,YAAnB,QAAuC,wBAAvC;AACA,SAASC,MAAT,EAAiBC,eAAjB,EAAkCC,UAAlC,QAAoD,mBAApD;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,qBAAT,QAAsC,0BAAtC;AAEA,SAASC,UAAT,QAA2B,SAA3B;;AAEA,MAAMC,iBAAiB,GAAG,MAAM;EAC5B,OAAOX,KAAK,CAACY,UAAN,CAAiBH,qBAAjB,CAAP;AACH,CAFD;;AAIA,eAAe,SAASI,cAAT,CAAwBC,KAAxB,EAAoD;EAC/D,MAAM;IACFC,YAAY,GAAG,IAAIC,IAAJ,EADb;IAEFC,MAFE;IAGFC,UAAU,EAAEC,cAHV;IAIFC,OAJE;IAKFC,OALE;IAMFC,UANE;IAOFC,WAAW,EAAEC;EAPX,IAQFV,KARJ;EAUA,MAAMW,KAAK,GAAGlB,QAAQ,EAAtB;EAEA,MAAMmB,gBAAgB,GAAGrB,eAAe,CAACoB,KAAD,EAAQ;IAAEE,QAAQ,EAAGC,IAAD,IAAUA,IAAI,CAACC,KAAL,CAAWC;EAAjC,CAAR,CAAxC;EAEA,MAAM,CAACC,iBAAD,EAAoBC,oBAApB,IAA4ChC,KAAK,CAACiC,QAAN,CAAe,KAAf,CAAlD;EACA,MAAM;IAAEC;EAAF,IAAcvB,iBAAiB,EAArC,CAhB+D,CAkB/D;;EACA,MAAMwB,SAAS,gBAAG,oBAAC,UAAD;IAAY,QAAQ,EAAE,GAAtB;IAA2B,K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EAAgB/B,MAAhB,CADxB;MAEI,OAAO,EAAE,MAFb;MAGI,IAAI,EAAE,OAHV;MAII,OAAO,EAAE,MAAMe,oBAAoB,CAAC,IAAD;IAJvC,EAhBR;IAuBI,KAAK,EAAE;MACHiB,eAAe,EAAExB,KAAK,CAACkB,OAAN,CAAcO,KAAd,CAAoBC,OADlC;MAEHC,kBAAkB,EAAE3B,KAAK,CAACkB,OAAN,CAAcO,KAAd,CAAoBC,OAFrC;MAGHE,YAAY,EAAE5B,KAAK,CAACkB,OAAN,CAAcW,IAAd,CAAmBV,OAH9B;MAIHW,iBAAiB,EAAE9B,KAAK,CAACkB,OAAN,CAAcW,IAAd,CAAmBE,IAJnC;MAKHC,iBAAiB,EAAE/B,gBAAgB,CAACgC,UALjC;MAMHC,eAAe,EAAEjC,gBAAgB,CAACkC,QAN/B;MAOHC,iBAAiB,EAAEnC,gBAAgB,CAACoC,UAPjC;MAQHC,uBAAuB,EAAErC,gBAAgB,CAACgC,UARvC;MASHM,qBAAqB,EAAEtC,gBAAgB,CAACkC,QATrC;MAUHK,uBAAuB,EAAEvC,gBAAgB,CAACoC;IAVvC;EAvBX,EADJ;AAsCH;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fountain-ui/lab",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.2",
4
4
  "private": false,
5
5
  "author": "Fountain-UI Team",
6
6
  "description": "Incubator for Fountain-UI React components.",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "88b0532dcdf185877d95cd713f9d9076728abe12"
73
+ "gitHead": "28005225fc7de910f1946bf35cab98be3f53094c"
74
74
  }
@@ -26,7 +26,7 @@ export default function DateTimePicker(props: DateTimePickerProps) {
26
26
 
27
27
  const theme = useTheme();
28
28
 
29
- const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2 });
29
+ const textDayFontStyle = createFontStyle(theme, { selector: (typo) => typo.body2.medium });
30
30
 
31
31
  const [yearPickerVisible, setYearPickerVisible] = React.useState(false);
32
32
  const { locales } = useDateTimePicker();