react-native-paper-dates 0.11.0 → 0.11.1

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 (42) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +8 -442
  3. package/lib/commonjs/Date/DatePickerModalContent.js +3 -3
  4. package/lib/commonjs/Date/DatePickerModalContent.js.map +1 -1
  5. package/lib/commonjs/Date/DatePickerModalHeader.js +2 -2
  6. package/lib/commonjs/Date/DatePickerModalHeader.js.map +1 -1
  7. package/lib/commonjs/Date/inputUtils.js +4 -4
  8. package/lib/commonjs/Date/inputUtils.js.map +1 -1
  9. package/lib/commonjs/translations/ar.js.map +1 -1
  10. package/lib/commonjs/translations/de.js.map +1 -1
  11. package/lib/commonjs/translations/es.js +25 -0
  12. package/lib/commonjs/translations/es.js.map +1 -0
  13. package/lib/commonjs/translations/fr.js +1 -1
  14. package/lib/commonjs/translations/fr.js.map +1 -1
  15. package/lib/module/Date/DatePickerModalContent.js +3 -3
  16. package/lib/module/Date/DatePickerModalContent.js.map +1 -1
  17. package/lib/module/Date/DatePickerModalHeader.js +2 -2
  18. package/lib/module/Date/DatePickerModalHeader.js.map +1 -1
  19. package/lib/module/Date/inputUtils.js +1 -1
  20. package/lib/module/Date/inputUtils.js.map +1 -1
  21. package/lib/module/translations/ar.js.map +1 -1
  22. package/lib/module/translations/de.js.map +1 -1
  23. package/lib/module/translations/es.js +18 -0
  24. package/lib/module/translations/es.js.map +1 -0
  25. package/lib/module/translations/fr.js +1 -1
  26. package/lib/module/translations/fr.js.map +1 -1
  27. package/lib/typescript/Date/DatePickerModalContent.d.ts +1 -0
  28. package/lib/typescript/translations/es.d.ts +3 -0
  29. package/package.json +17 -8
  30. package/src/Date/DatePickerModalContent.tsx +4 -3
  31. package/src/Date/DatePickerModalHeader.tsx +2 -2
  32. package/src/Date/inputUtils.ts +2 -2
  33. package/src/translations/ar.ts +1 -1
  34. package/src/translations/de.ts +1 -0
  35. package/src/translations/es.ts +21 -0
  36. package/src/translations/fr.ts +16 -18
  37. package/lib/commonjs/Date/dateUtils.test.js +0 -9
  38. package/lib/commonjs/Date/dateUtils.test.js.map +0 -1
  39. package/lib/module/Date/dateUtils.test.js +0 -6
  40. package/lib/module/Date/dateUtils.test.js.map +0 -1
  41. package/lib/typescript/Date/dateUtils.test.d.ts +0 -1
  42. package/src/Date/dateUtils.test.ts +0 -9
@@ -1 +1 @@
1
- {"version":3,"names":["ar","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["ar.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst ar: TranslationsType = {\n save: 'حفظ',\n selectSingle: 'حدد تاريخ',\n selectMultiple: 'حدد التواريخ',\n selectRange: 'حدد الفترة',\n notAccordingToDateFormat: (inputFormat:string) =>\n `يجب أن يكون تنسيق التاريخ ${inputFormat}`,\n mustBeHigherThan: (date) => `يجب أن يكون بعد ${date}`,\n mustBeLowerThan: (date) => `يجب أن يكون قبل ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `يجب أن يكون بين ${startDate} - ${endDate}`,\n dateIsDisabled: 'اليوم غير مسموح به',\n previous: 'السابق',\n next: 'التالي',\n typeInDate: 'اكتب التاريخ',\n pickDateFromCalendar: 'اختر التاريخ من التقويم',\n close: 'أغلق',\n}\nexport default ar\n"],"mappings":";;;;;;AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,KADqB;EAE3BC,YAAY,EAAE,WAFa;EAG3BC,cAAc,EAAE,cAHW;EAI3BC,WAAW,EAAE,YAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,6BAA4BA,WAAY,EANhB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,oBAAmBA,IAAK,EAP1B;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,oBAAmBA,IAAK,EARzB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,mBAAkBD,SAAU,MAAKC,OAAQ,EAVjB;EAW3BC,cAAc,EAAE,oBAXW;EAY3BC,QAAQ,EAAE,QAZiB;EAa3BC,IAAI,EAAE,QAbqB;EAc3BC,UAAU,EAAE,cAde;EAe3BC,oBAAoB,EAAE,yBAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;eAkBelB,E"}
1
+ {"version":3,"names":["ar","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["ar.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst ar: TranslationsType = {\n save: 'حفظ',\n selectSingle: 'حدد تاريخ',\n selectMultiple: 'حدد التواريخ',\n selectRange: 'حدد الفترة',\n notAccordingToDateFormat: (inputFormat: string) =>\n `يجب أن يكون تنسيق التاريخ ${inputFormat}`,\n mustBeHigherThan: (date) => `يجب أن يكون بعد ${date}`,\n mustBeLowerThan: (date) => `يجب أن يكون قبل ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `يجب أن يكون بين ${startDate} - ${endDate}`,\n dateIsDisabled: 'اليوم غير مسموح به',\n previous: 'السابق',\n next: 'التالي',\n typeInDate: 'اكتب التاريخ',\n pickDateFromCalendar: 'اختر التاريخ من التقويم',\n close: 'أغلق',\n}\nexport default ar\n"],"mappings":";;;;;;AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,KADqB;EAE3BC,YAAY,EAAE,WAFa;EAG3BC,cAAc,EAAE,cAHW;EAI3BC,WAAW,EAAE,YAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,6BAA4BA,WAAY,EANhB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,oBAAmBA,IAAK,EAP1B;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,oBAAmBA,IAAK,EARzB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,mBAAkBD,SAAU,MAAKC,OAAQ,EAVjB;EAW3BC,cAAc,EAAE,oBAXW;EAY3BC,QAAQ,EAAE,QAZiB;EAa3BC,IAAI,EAAE,QAbqB;EAc3BC,UAAU,EAAE,cAde;EAe3BC,oBAAoB,EAAE,yBAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;eAkBelB,E"}
@@ -1 +1 @@
1
- {"version":3,"names":["de","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["de.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\nconst de: TranslationsType = {\n save: 'Speichern',\n selectSingle: 'Wähle Datum',\n selectMultiple: 'Wähle Daten',\n selectRange: 'Wähle Zeitspanne',\n notAccordingToDateFormat: (inputFormat) =>\n `Das Format sollte ${inputFormat} sein`,\n mustBeHigherThan: (date) => `Muss nach dem ${date} sein`,\n mustBeLowerThan: (date) => `Muss vor dem ${date} sein`,\n mustBeBetween: (startDate, endDate) =>\n `Muss in dieser Zeitspanne liegen ${startDate} - ${endDate}`,\n dateIsDisabled: 'Datum nicht wählbar',\n previous: 'Vorheriges',\n next: 'Nächstes',\n typeInDate: 'Datum eingeben',\n pickDateFromCalendar: 'Datum vom Kalender auswählen',\n close: 'Schliessen',\n}\nexport default de\n"],"mappings":";;;;;;AACA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,WADqB;EAE3BC,YAAY,EAAE,aAFa;EAG3BC,cAAc,EAAE,aAHW;EAI3BC,WAAW,EAAE,kBAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,qBAAoBA,WAAY,OANR;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,iBAAgBA,IAAK,OAPvB;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,gBAAeA,IAAK,OARrB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,oCAAmCD,SAAU,MAAKC,OAAQ,EAVlC;EAW3BC,cAAc,EAAE,qBAXW;EAY3BC,QAAQ,EAAE,YAZiB;EAa3BC,IAAI,EAAE,UAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,8BAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;eAkBelB,E"}
1
+ {"version":3,"names":["de","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["de.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst de: TranslationsType = {\n save: 'Speichern',\n selectSingle: 'Wähle Datum',\n selectMultiple: 'Wähle Daten',\n selectRange: 'Wähle Zeitspanne',\n notAccordingToDateFormat: (inputFormat) =>\n `Das Format sollte ${inputFormat} sein`,\n mustBeHigherThan: (date) => `Muss nach dem ${date} sein`,\n mustBeLowerThan: (date) => `Muss vor dem ${date} sein`,\n mustBeBetween: (startDate, endDate) =>\n `Muss in dieser Zeitspanne liegen ${startDate} - ${endDate}`,\n dateIsDisabled: 'Datum nicht wählbar',\n previous: 'Vorheriges',\n next: 'Nächstes',\n typeInDate: 'Datum eingeben',\n pickDateFromCalendar: 'Datum vom Kalender auswählen',\n close: 'Schliessen',\n}\nexport default de\n"],"mappings":";;;;;;AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,WADqB;EAE3BC,YAAY,EAAE,aAFa;EAG3BC,cAAc,EAAE,aAHW;EAI3BC,WAAW,EAAE,kBAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,qBAAoBA,WAAY,OANR;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,iBAAgBA,IAAK,OAPvB;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,gBAAeA,IAAK,OARrB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,oCAAmCD,SAAU,MAAKC,OAAQ,EAVlC;EAW3BC,cAAc,EAAE,qBAXW;EAY3BC,QAAQ,EAAE,YAZiB;EAa3BC,IAAI,EAAE,UAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,8BAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;eAkBelB,E"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ const es = {
8
+ save: 'Guardar',
9
+ selectSingle: 'Seleccionar fecha',
10
+ selectMultiple: 'Seleccionar fechas',
11
+ selectRange: 'Seleccionar periodo',
12
+ notAccordingToDateFormat: inputFormat => `Formato de fecha debe ser ${inputFormat}`,
13
+ mustBeHigherThan: date => `Debe ser posterior a ${date}`,
14
+ mustBeLowerThan: date => `Debe ser anterior a ${date}`,
15
+ mustBeBetween: (startDate, endDate) => `Debe estar entre ${startDate} - ${endDate}`,
16
+ dateIsDisabled: 'Día no permitido',
17
+ previous: 'Anterior',
18
+ next: 'Siguiente',
19
+ typeInDate: 'Escribir fecha',
20
+ pickDateFromCalendar: 'Seleccionar fecha del calendario',
21
+ close: 'Cerrar'
22
+ };
23
+ var _default = es;
24
+ exports.default = _default;
25
+ //# sourceMappingURL=es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["es","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["es.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst es: TranslationsType = {\n save: 'Guardar',\n selectSingle: 'Seleccionar fecha',\n selectMultiple: 'Seleccionar fechas',\n selectRange: 'Seleccionar periodo',\n notAccordingToDateFormat: (inputFormat) =>\n `Formato de fecha debe ser ${inputFormat}`,\n mustBeHigherThan: (date) => `Debe ser posterior a ${date}`,\n mustBeLowerThan: (date) => `Debe ser anterior a ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `Debe estar entre ${startDate} - ${endDate}`,\n dateIsDisabled: 'Día no permitido',\n previous: 'Anterior',\n next: 'Siguiente',\n typeInDate: 'Escribir fecha',\n pickDateFromCalendar: 'Seleccionar fecha del calendario',\n close: 'Cerrar',\n}\nexport default es\n"],"mappings":";;;;;;AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,SADqB;EAE3BC,YAAY,EAAE,mBAFa;EAG3BC,cAAc,EAAE,oBAHW;EAI3BC,WAAW,EAAE,qBAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,6BAA4BA,WAAY,EANhB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,wBAAuBA,IAAK,EAP9B;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,uBAAsBA,IAAK,EAR5B;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,oBAAmBD,SAAU,MAAKC,OAAQ,EAVlB;EAW3BC,cAAc,EAAE,kBAXW;EAY3BC,QAAQ,EAAE,UAZiB;EAa3BC,IAAI,EAAE,WAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,kCAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;eAkBelB,E"}
@@ -13,7 +13,7 @@ const fr = {
13
13
  mustBeHigherThan: date => `La date doit être après le ${date}`,
14
14
  mustBeLowerThan: date => `La date doit être avant le ${date}`,
15
15
  mustBeBetween: (startDate, endDate) => `La date doit être en le ${startDate} et le ${endDate}`,
16
- dateIsDisabled: 'Le jour n\'est pas autorisé',
16
+ dateIsDisabled: "Le jour n'est pas autorisé",
17
17
  previous: 'Précédent',
18
18
  next: 'Suivant',
19
19
  typeInDate: 'Entrer la date',
@@ -1 +1 @@
1
- {"version":3,"names":["fr","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["fr.ts"],"sourcesContent":["\n \nimport type { TranslationsType } from './utils'\n\nconst fr: TranslationsType = {\n save: 'Enregistrer',\n selectSingle: 'Sélectionner une date',\n selectMultiple: 'Sélectionner plusieurs dates',\n selectRange: 'Sélectionner une période',\n notAccordingToDateFormat: (inputFormat) =>\n `La date doit être au format ${inputFormat}`,\n mustBeHigherThan: (date) => `La date doit être après le ${date}`,\n mustBeLowerThan: (date) => `La date doit être avant le ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `La date doit être en le ${startDate} et le ${endDate}`,\n dateIsDisabled: 'Le jour n\\'est pas autorisé',\n previous: 'Précédent',\n next: 'Suivant',\n typeInDate: 'Entrer la date',\n pickDateFromCalendar: 'Sélectionner une date dans le calendrier',\n close: 'Fermer',\n}\nexport default fr\n"],"mappings":";;;;;;AAIA,MAAMA,EAAoB,GAAG;EACzBC,IAAI,EAAE,aADmB;EAEzBC,YAAY,EAAE,uBAFW;EAGzBC,cAAc,EAAE,8BAHS;EAIzBC,WAAW,EAAE,0BAJY;EAKzBC,wBAAwB,EAAGC,WAAD,IACrB,+BAA8BA,WAAY,EANtB;EAOzBC,gBAAgB,EAAGC,IAAD,IAAW,8BAA6BA,IAAK,EAPtC;EAQzBC,eAAe,EAAGD,IAAD,IAAW,8BAA6BA,IAAK,EARrC;EASzBE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACV,2BAA0BD,SAAU,UAASC,OAAQ,EAVjC;EAWzBC,cAAc,EAAE,6BAXS;EAYzBC,QAAQ,EAAE,WAZe;EAazBC,IAAI,EAAE,SAbmB;EAczBC,UAAU,EAAE,gBAda;EAezBC,oBAAoB,EAAE,0CAfG;EAgBzBC,KAAK,EAAE;AAhBkB,CAA7B;eAkBelB,E"}
1
+ {"version":3,"names":["fr","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["fr.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst fr: TranslationsType = {\n save: 'Enregistrer',\n selectSingle: 'Sélectionner une date',\n selectMultiple: 'Sélectionner plusieurs dates',\n selectRange: 'Sélectionner une période',\n notAccordingToDateFormat: (inputFormat) =>\n `La date doit être au format ${inputFormat}`,\n mustBeHigherThan: (date) => `La date doit être après le ${date}`,\n mustBeLowerThan: (date) => `La date doit être avant le ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `La date doit être en le ${startDate} et le ${endDate}`,\n dateIsDisabled: \"Le jour n'est pas autorisé\",\n previous: 'Précédent',\n next: 'Suivant',\n typeInDate: 'Entrer la date',\n pickDateFromCalendar: 'Sélectionner une date dans le calendrier',\n close: 'Fermer',\n}\nexport default fr\n"],"mappings":";;;;;;AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,aADqB;EAE3BC,YAAY,EAAE,uBAFa;EAG3BC,cAAc,EAAE,8BAHW;EAI3BC,WAAW,EAAE,0BAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,+BAA8BA,WAAY,EANlB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,8BAA6BA,IAAK,EAPpC;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,8BAA6BA,IAAK,EARnC;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,2BAA0BD,SAAU,UAASC,OAAQ,EAV7B;EAW3BC,cAAc,EAAE,4BAXW;EAY3BC,QAAQ,EAAE,WAZiB;EAa3BC,IAAI,EAAE,SAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,0CAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;eAkBelB,E"}
@@ -70,8 +70,8 @@ export function DatePickerModalContent(props) {
70
70
  onSave: onInnerConfirm,
71
71
  onDismiss: onDismiss,
72
72
  saveLabel: props.saveLabel,
73
- saveLabelDisabled: props.saveLabelDisabled || false,
74
- uppercase: props.uppercase || true,
73
+ saveLabelDisabled: props.saveLabelDisabled ?? false,
74
+ uppercase: props.uppercase ?? true,
75
75
  disableSafeTop: disableSafeTop,
76
76
  closeIcon: props.closeIcon
77
77
  }), /*#__PURE__*/React.createElement(DatePickerModalContentHeader, {
@@ -85,7 +85,7 @@ export function DatePickerModalContent(props) {
85
85
  moreLabel: props.moreLabel,
86
86
  startLabel: props.startLabel,
87
87
  endLabel: props.endLabel,
88
- uppercase: props.uppercase || true,
88
+ uppercase: props.uppercase ?? true,
89
89
  locale: locale,
90
90
  editIcon: props.editIcon,
91
91
  calendarIcon: props.calendarIcon
@@ -1 +1 @@
1
- {"version":3,"names":["React","Calendar","AnimatedCrossView","DatePickerModalHeader","DatePickerModalContentHeader","CalendarEdit","DatePickerModalHeaderBackground","DatePickerModalContent","props","mode","onChange","onConfirm","onDismiss","disableSafeTop","disableWeekDays","locale","validRange","dateMode","startYear","endYear","anyProps","state","setState","useState","date","startDate","endDate","dates","useEffect","collapsed","setCollapsed","onInnerChange","useCallback","params","prev","onInnerConfirm","onToggleCollapse","saveLabel","saveLabelDisabled","uppercase","closeIcon","headerSeparator","emptyLabel","label","moreLabel","startLabel","endLabel","editIcon","calendarIcon","memo"],"sources":["DatePickerModalContent.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport Calendar, {\n BaseCalendarProps,\n CalendarDate,\n CalendarDates,\n MultiChange,\n MultiConfirm,\n RangeChange,\n SingleChange,\n} from './Calendar'\n\nimport AnimatedCrossView from './AnimatedCrossView'\n\nimport DatePickerModalHeader from './DatePickerModalHeader'\nimport DatePickerModalContentHeader, {\n HeaderPickProps,\n} from './DatePickerModalContentHeader'\nimport CalendarEdit from './CalendarEdit'\nimport DatePickerModalHeaderBackground from './DatePickerModalHeaderBackground'\n\nexport type LocalState = {\n startDate: CalendarDate\n endDate: CalendarDate\n date: CalendarDate\n dates: CalendarDates\n}\n\ninterface DatePickerModalContentBaseProps {\n inputFormat?: string\n locale: string\n onDismiss: () => any\n disableSafeTop?: boolean\n saveLabelDisabled?: boolean\n}\n\nexport interface DatePickerModalContentRangeProps\n extends HeaderPickProps,\n BaseCalendarProps,\n DatePickerModalContentBaseProps {\n mode: 'range'\n startDate: CalendarDate\n endDate: CalendarDate\n onChange?: RangeChange\n onConfirm: RangeChange\n}\n\nexport interface DatePickerModalContentSingleProps\n extends HeaderPickProps,\n BaseCalendarProps,\n DatePickerModalContentBaseProps {\n mode: 'single'\n date?: CalendarDate\n onChange?: SingleChange\n onConfirm: SingleChange\n dateMode?: 'start' | 'end'\n}\n\nexport interface DatePickerModalContentMultiProps\n extends HeaderPickProps,\n BaseCalendarProps,\n DatePickerModalContentBaseProps {\n mode: 'multiple'\n dates?: CalendarDates\n onChange?: MultiChange\n onConfirm: MultiConfirm\n}\n\nexport function DatePickerModalContent(\n props:\n | DatePickerModalContentRangeProps\n | DatePickerModalContentSingleProps\n | DatePickerModalContentMultiProps\n) {\n const {\n mode,\n onChange,\n onConfirm,\n onDismiss,\n disableSafeTop,\n disableWeekDays,\n locale,\n validRange,\n dateMode,\n startYear,\n endYear,\n } = props\n\n const anyProps = props as any\n\n // use local state to add only onConfirm state changes\n const [state, setState] = React.useState<LocalState>({\n date: anyProps.date,\n startDate: anyProps.startDate,\n endDate: anyProps.endDate,\n dates: anyProps.dates,\n })\n\n // update local state if changed from outside or if modal is opened\n React.useEffect(() => {\n setState({\n date: anyProps.date,\n startDate: anyProps.startDate,\n endDate: anyProps.endDate,\n dates: anyProps.dates,\n })\n }, [anyProps.date, anyProps.startDate, anyProps.endDate, anyProps.dates])\n\n const [collapsed, setCollapsed] = React.useState<boolean>(true)\n\n const onInnerChange = React.useCallback(\n (params: any) => {\n onChange && onChange(params)\n setState((prev) => ({ ...prev, ...params }))\n },\n [onChange, setState]\n )\n\n const onInnerConfirm = React.useCallback(() => {\n if (mode === 'single') {\n ;(onConfirm as DatePickerModalContentSingleProps['onConfirm'])({\n date: state.date,\n })\n } else if (mode === 'range') {\n ;(onConfirm as DatePickerModalContentRangeProps['onConfirm'])({\n startDate: state.startDate,\n endDate: state.endDate,\n })\n } else if (mode === 'multiple') {\n ;(onConfirm as DatePickerModalContentMultiProps['onConfirm'])({\n dates: state.dates || [],\n })\n }\n }, [state, mode, onConfirm])\n\n const onToggleCollapse = React.useCallback(() => {\n setCollapsed((prev) => !prev)\n }, [setCollapsed])\n\n return (\n <>\n <DatePickerModalHeaderBackground>\n <DatePickerModalHeader\n locale={locale}\n onSave={onInnerConfirm}\n onDismiss={onDismiss}\n saveLabel={props.saveLabel}\n saveLabelDisabled={props.saveLabelDisabled || false}\n uppercase={props.uppercase || true}\n disableSafeTop={disableSafeTop}\n closeIcon={props.closeIcon}\n />\n <DatePickerModalContentHeader\n state={state}\n mode={mode}\n collapsed={collapsed}\n onToggle={onToggleCollapse}\n headerSeparator={props.headerSeparator}\n emptyLabel={props.emptyLabel}\n label={props.label}\n moreLabel={props.moreLabel}\n startLabel={props.startLabel}\n endLabel={props.endLabel}\n uppercase={props.uppercase || true}\n locale={locale}\n editIcon={props.editIcon}\n calendarIcon={props.calendarIcon}\n />\n </DatePickerModalHeaderBackground>\n\n <AnimatedCrossView\n collapsed={collapsed}\n calendar={\n <Calendar\n locale={locale}\n mode={mode}\n startDate={state.startDate}\n endDate={state.endDate}\n date={state.date}\n onChange={onInnerChange}\n disableWeekDays={disableWeekDays}\n dates={state.dates}\n validRange={validRange}\n dateMode={dateMode}\n startYear={startYear}\n endYear={endYear}\n />\n }\n calendarEdit={\n <CalendarEdit\n mode={mode}\n state={state}\n label={props.label}\n startLabel={props.startLabel}\n endLabel={props.endLabel}\n collapsed={collapsed}\n onChange={onInnerChange}\n validRange={validRange}\n loc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AK,EAAEb,KAAK,CAACmC,KAHf;MAIE,UAAU,EAAEnC,KAAK,CAACqC,UAJpB;MAKE,QAAQ,EAAErC,KAAK,CAACsC,QALlB;MAME,SAAS,EAAEjB,SANb;MAOE,QAAQ,EAAEE,aAPZ;MAQE,UAAU,EAAEf,UARd;MASE,MAAM,EAAED;IATV;EAnBJ,EA9BF,CADF;AAiED;AAED,4BAAef,KAAK,CAACiD,IAAN,CAAW1C,sBAAX,CAAf"}
1
+ {"version":3,"names":["React","Calendar","AnimatedCrossView","DatePickerModalHeader","DatePickerModalContentHeader","CalendarEdit","DatePickerModalHeaderBackground","DatePickerModalContent","props","mode","onChange","onConfirm","onDismiss","disableSafeTop","disableWeekDays","locale","validRange","dateMode","startYear","endYear","anyProps","state","setState","useState","date","startDate","endDate","dates","useEffect","collapsed","setCollapsed","onInnerChange","useCallback","params","prev","onInnerConfirm","onToggleCollapse","saveLabel","saveLabelDisabled","uppercase","closeIcon","headerSeparator","emptyLabel","label","moreLabel","startLabel","endLabel","editIcon","calendarIcon","memo"],"sources":["DatePickerModalContent.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport Calendar, {\n BaseCalendarProps,\n CalendarDate,\n CalendarDates,\n MultiChange,\n MultiConfirm,\n RangeChange,\n SingleChange,\n} from './Calendar'\n\nimport AnimatedCrossView from './AnimatedCrossView'\n\nimport DatePickerModalHeader from './DatePickerModalHeader'\nimport DatePickerModalContentHeader, {\n HeaderPickProps,\n} from './DatePickerModalContentHeader'\nimport CalendarEdit from './CalendarEdit'\nimport DatePickerModalHeaderBackground from './DatePickerModalHeaderBackground'\n\nexport type LocalState = {\n startDate: CalendarDate\n endDate: CalendarDate\n date: CalendarDate\n dates: CalendarDates\n}\n\ninterface DatePickerModalContentBaseProps {\n inputFormat?: string\n locale: string\n onDismiss: () => any\n disableSafeTop?: boolean\n saveLabelDisabled?: boolean\n uppercase?: boolean\n}\n\nexport interface DatePickerModalContentRangeProps\n extends HeaderPickProps,\n BaseCalendarProps,\n DatePickerModalContentBaseProps {\n mode: 'range'\n startDate: CalendarDate\n endDate: CalendarDate\n onChange?: RangeChange\n onConfirm: RangeChange\n}\n\nexport interface DatePickerModalContentSingleProps\n extends HeaderPickProps,\n BaseCalendarProps,\n DatePickerModalContentBaseProps {\n mode: 'single'\n date?: CalendarDate\n onChange?: SingleChange\n onConfirm: SingleChange\n dateMode?: 'start' | 'end'\n}\n\nexport interface DatePickerModalContentMultiProps\n extends HeaderPickProps,\n BaseCalendarProps,\n DatePickerModalContentBaseProps {\n mode: 'multiple'\n dates?: CalendarDates\n onChange?: MultiChange\n onConfirm: MultiConfirm\n}\n\nexport function DatePickerModalContent(\n props:\n | DatePickerModalContentRangeProps\n | DatePickerModalContentSingleProps\n | DatePickerModalContentMultiProps\n) {\n const {\n mode,\n onChange,\n onConfirm,\n onDismiss,\n disableSafeTop,\n disableWeekDays,\n locale,\n validRange,\n dateMode,\n startYear,\n endYear,\n } = props\n\n const anyProps = props as any\n\n // use local state to add only onConfirm state changes\n const [state, setState] = React.useState<LocalState>({\n date: anyProps.date,\n startDate: anyProps.startDate,\n endDate: anyProps.endDate,\n dates: anyProps.dates,\n })\n\n // update local state if changed from outside or if modal is opened\n React.useEffect(() => {\n setState({\n date: anyProps.date,\n startDate: anyProps.startDate,\n endDate: anyProps.endDate,\n dates: anyProps.dates,\n })\n }, [anyProps.date, anyProps.startDate, anyProps.endDate, anyProps.dates])\n\n const [collapsed, setCollapsed] = React.useState<boolean>(true)\n\n const onInnerChange = React.useCallback(\n (params: any) => {\n onChange && onChange(params)\n setState((prev) => ({ ...prev, ...params }))\n },\n [onChange, setState]\n )\n\n const onInnerConfirm = React.useCallback(() => {\n if (mode === 'single') {\n ;(onConfirm as DatePickerModalContentSingleProps['onConfirm'])({\n date: state.date,\n })\n } else if (mode === 'range') {\n ;(onConfirm as DatePickerModalContentRangeProps['onConfirm'])({\n startDate: state.startDate,\n endDate: state.endDate,\n })\n } else if (mode === 'multiple') {\n ;(onConfirm as DatePickerModalContentMultiProps['onConfirm'])({\n dates: state.dates || [],\n })\n }\n }, [state, mode, onConfirm])\n\n const onToggleCollapse = React.useCallback(() => {\n setCollapsed((prev) => !prev)\n }, [setCollapsed])\n\n return (\n <>\n <DatePickerModalHeaderBackground>\n <DatePickerModalHeader\n locale={locale}\n onSave={onInnerConfirm}\n onDismiss={onDismiss}\n saveLabel={props.saveLabel}\n saveLabelDisabled={props.saveLabelDisabled ?? false}\n uppercase={props.uppercase ?? true}\n disableSafeTop={disableSafeTop}\n closeIcon={props.closeIcon}\n />\n <DatePickerModalContentHeader\n state={state}\n mode={mode}\n collapsed={collapsed}\n onToggle={onToggleCollapse}\n headerSeparator={props.headerSeparator}\n emptyLabel={props.emptyLabel}\n label={props.label}\n moreLabel={props.moreLabel}\n startLabel={props.startLabel}\n endLabel={props.endLabel}\n uppercase={props.uppercase ?? true}\n locale={locale}\n editIcon={props.editIcon}\n calendarIcon={props.calendarIcon}\n />\n </DatePickerModalHeaderBackground>\n\n <AnimatedCrossView\n collapsed={collapsed}\n calendar={\n <Calendar\n locale={locale}\n mode={mode}\n startDate={state.startDate}\n endDate={state.endDate}\n date={state.date}\n onChange={onInnerChange}\n disableWeekDays={disableWeekDays}\n dates={state.dates}\n validRange={validRange}\n dateMode={dateMode}\n startYear={startYear}\n endYear={endYear}\n />\n }\n calendarEdit={\n <CalendarEdit\n mode={mode}\n state={state}\n label={props.label}\n startLabel={props.startLabel}\n endLabel={props.endLabel}\n collapsed={collapsed}\n onChange={onInnerChange}\n validRange={validRange}\n locale={locale}\n />\n }\n />\n </>\n )\n}\n\nexport default React.memo(DatePickerModalContent)\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AAEA,OAAOC,QAAP,MAQO,YARP;AAUA,OAAOC,iBAAP,MAA8B,qBAA9B;AAEA,OAAOC,qBAAP,MAAkC,yBAAlC;AACA,OAAOC,4BAAP,MAEO,gCAFP;AAGA,OAAOC,YAAP,MAAyB,gBAAzB;AACA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CAAf"}
@@ -33,8 +33,8 @@ export default function DatePickerModalHeader(props) {
33
33
  color: color,
34
34
  textColor: color,
35
35
  onPress: props.onSave,
36
- disabled: props.saveLabelDisabled || false,
37
- uppercase: props.uppercase || true,
36
+ disabled: props.saveLabelDisabled ?? false,
37
+ uppercase: props.uppercase ?? true,
38
38
  testID: "react-native-paper-dates-save"
39
39
  }, saveLabel)));
40
40
  }
@@ -1 +1 @@
1
- {"version":3,"names":["React","Animated","StyleSheet","Appbar","Button","useHeaderTextColor","getTranslation","useSafeAreaInsets","DatePickerModalHeader","props","disableSafeTop","locale","closeIcon","saveLabel","color","insets","styles","animated","paddingTop","top","paddingLeft","left","paddingRight","right","appbarHeader","onDismiss","onSave","saveLabelDisabled","uppercase","create","fill","flex","elevation","header","height","alignItems","flexDirection","headerContentContainer","marginTop","label","letterSpacing","fontSize","singleHeaderText","rangeHeaderText","headerTextFilled","headerTextEmpty","headerSeparator","backgroundColor"],"sources":["DatePickerModalHeader.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Animated, StyleSheet } from 'react-native'\nimport { Appbar, Button } from 'react-native-paper'\n\nimport { useHeaderTextColor } from '../utils'\nimport { getTranslation } from '../translations/utils'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nexport interface DatePickerModalHeaderProps {\n disableSafeTop?: boolean\n saveLabel?: string\n saveLabelDisabled?: boolean\n uppercase?: boolean\n onDismiss: () => void\n onSave: () => void\n locale: string | undefined\n closeIcon?: string\n}\n\nexport default function DatePickerModalHeader(\n props: DatePickerModalHeaderProps\n) {\n const { disableSafeTop, locale, closeIcon = 'close' } = props\n const saveLabel = props.saveLabel || getTranslation(locale, 'save')\n const color = useHeaderTextColor()\n const insets = useSafeAreaInsets()\n\n return (\n <Animated.View\n style={[\n styles.animated,\n {\n paddingTop: disableSafeTop ? 0 : insets.top,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n ]}\n >\n <Appbar style={styles.appbarHeader}>\n <Appbar.Action\n icon={closeIcon}\n accessibilityLabel={getTranslation(locale, 'close')}\n onPress={props.onDismiss}\n color={color}\n testID=\"react-native-paper-dates-close\"\n />\n <Appbar.Content title={''} />\n <Button\n color={color}\n textColor={color}\n onPress={props.onSave}\n disabled={props.saveLabelDisabled || false}\n uppercase={props.uppercase || true}\n testID=\"react-native-paper-dates-save\"\n >\n {saveLabel}\n </Button>\n </Appbar>\n </Animated.View>\n )\n}\n\nconst styles = StyleSheet.create({\n fill: {\n flex: 1,\n },\n animated: {\n elevation: 4,\n },\n\n header: {\n height: 75,\n alignItems: 'center',\n flexDirection: 'row',\n paddingLeft: 24,\n paddingRight: 12,\n },\n headerContentContainer: { marginTop: 5, flexDirection: 'row' },\n label: { color: '#fff', letterSpacing: 1, fontSize: 13 },\n singleHeaderText: { color: '#fff', fontSize: 25 },\n rangeHeaderText: { color: '#fff', fontSize: 25 },\n headerTextFilled: { color: 'rgba(255,255,255,1)' },\n headerTextEmpty: { color: 'rgba(255,255,255,0.5)' },\n headerSeparator: {\n color: 'rgba(255,255,255,1)',\n fontSize: 25,\n paddingLeft: 6,\n paddingRight: 6,\n },\n appbarHeader: {\n elevation: 0,\n backgroundColor: 'transparent',\n // alignItems:'center'\n },\n})\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,QAAT,EAAmBC,UAAnB,QAAqC,cAArC;AACA,SAASC,MAAT,EAAiBC,MAAjB,QAA+B,oBAA/B;AAEA,SAASC,kBAAT,QAAmC,UAAnC;AACA,SAASC,cAAT,QAA+B,uBAA/B;AACA,SAASC,iBAAT,QAAkC,gCAAlC;AAaA,eAAe,SAASC,qBAAT,CACbC,KADa,EAEb;EACA,MAAM;IAAEC,cAAF;IAAkBC,MAAlB;IAA0BC,SAAS,GAAG;EAAtC,IAAkDH,KAAxD;EACA,MAAMI,SAAS,GAAGJ,KAAK,CAACI,SAAN,IAAmBP,cAAc,CAACK,MAAD,EAAS,MAAT,CAAnD;EACA,MAAMG,KAAK,G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AAEC,SAAS,EAAE,CAAb;IAAgBF,aAAa,EAAE;EAA/B,CAfO;EAgB/BG,KAAK,EAAE;IAAEzB,KAAK,EAAE,MAAT;IAAiB0B,aAAa,EAAE,CAAhC;IAAmCC,QAAQ,EAAE;EAA7C,CAhBwB;EAiB/BC,gBAAgB,EAAE;IAAE5B,KAAK,EAAE,MAAT;IAAiB2B,QAAQ,EAAE;EAA3B,CAjBa;EAkB/BE,eAAe,EAAE;IAAE7B,KAAK,EAAE,MAAT;IAAiB2B,QAAQ,EAAE;EAA3B,CAlBc;EAmB/BG,gBAAgB,EAAE;IAAE9B,KAAK,EAAE;EAAT,CAnBa;EAoB/B+B,eAAe,EAAE;IAAE/B,KAAK,EAAE;EAAT,CApBc;EAqB/BgC,eAAe,EAAE;IACfhC,KAAK,EAAE,qBADQ;IAEf2B,QAAQ,EAAE,EAFK;IAGfrB,WAAW,EAAE,CAHE;IAIfE,YAAY,EAAE;EAJC,CArBc;EA2B/BE,YAAY,EAAE;IACZQ,SAAS,EAAE,CADC;IAEZe,eAAe,EAAE,aAFL,CAGZ;;EAHY;AA3BiB,CAAlB,CAAf"}
1
+ {"version":3,"names":["React","Animated","StyleSheet","Appbar","Button","useHeaderTextColor","getTranslation","useSafeAreaInsets","DatePickerModalHeader","props","disableSafeTop","locale","closeIcon","saveLabel","color","insets","styles","animated","paddingTop","top","paddingLeft","left","paddingRight","right","appbarHeader","onDismiss","onSave","saveLabelDisabled","uppercase","create","fill","flex","elevation","header","height","alignItems","flexDirection","headerContentContainer","marginTop","label","letterSpacing","fontSize","singleHeaderText","rangeHeaderText","headerTextFilled","headerTextEmpty","headerSeparator","backgroundColor"],"sources":["DatePickerModalHeader.tsx"],"sourcesContent":["import * as React from 'react'\nimport { Animated, StyleSheet } from 'react-native'\nimport { Appbar, Button } from 'react-native-paper'\n\nimport { useHeaderTextColor } from '../utils'\nimport { getTranslation } from '../translations/utils'\nimport { useSafeAreaInsets } from 'react-native-safe-area-context'\n\nexport interface DatePickerModalHeaderProps {\n disableSafeTop?: boolean\n saveLabel?: string\n saveLabelDisabled?: boolean\n uppercase?: boolean\n onDismiss: () => void\n onSave: () => void\n locale: string | undefined\n closeIcon?: string\n}\n\nexport default function DatePickerModalHeader(\n props: DatePickerModalHeaderProps\n) {\n const { disableSafeTop, locale, closeIcon = 'close' } = props\n const saveLabel = props.saveLabel || getTranslation(locale, 'save')\n const color = useHeaderTextColor()\n const insets = useSafeAreaInsets()\n\n return (\n <Animated.View\n style={[\n styles.animated,\n {\n paddingTop: disableSafeTop ? 0 : insets.top,\n paddingLeft: insets.left,\n paddingRight: insets.right,\n },\n ]}\n >\n <Appbar style={styles.appbarHeader}>\n <Appbar.Action\n icon={closeIcon}\n accessibilityLabel={getTranslation(locale, 'close')}\n onPress={props.onDismiss}\n color={color}\n testID=\"react-native-paper-dates-close\"\n />\n <Appbar.Content title={''} />\n <Button\n color={color}\n textColor={color}\n onPress={props.onSave}\n disabled={props.saveLabelDisabled ?? false}\n uppercase={props.uppercase ?? true}\n testID=\"react-native-paper-dates-save\"\n >\n {saveLabel}\n </Button>\n </Appbar>\n </Animated.View>\n )\n}\n\nconst styles = StyleSheet.create({\n fill: {\n flex: 1,\n },\n animated: {\n elevation: 4,\n },\n\n header: {\n height: 75,\n alignItems: 'center',\n flexDirection: 'row',\n paddingLeft: 24,\n paddingRight: 12,\n },\n headerContentContainer: { marginTop: 5, flexDirection: 'row' },\n label: { color: '#fff', letterSpacing: 1, fontSize: 13 },\n singleHeaderText: { color: '#fff', fontSize: 25 },\n rangeHeaderText: { color: '#fff', fontSize: 25 },\n headerTextFilled: { color: 'rgba(255,255,255,1)' },\n headerTextEmpty: { color: 'rgba(255,255,255,0.5)' },\n headerSeparator: {\n color: 'rgba(255,255,255,1)',\n fontSize: 25,\n paddingLeft: 6,\n paddingRight: 6,\n },\n appbarHeader: {\n elevation: 0,\n backgroundColor: 'transparent',\n // alignItems:'center'\n },\n})\n"],"mappings":"AAAA,OAAO,KAAKA,KAAZ,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- import { getTranslation } from 'react-native-paper-dates';
3
+ import { getTranslation } from '../translations/utils';
4
4
  export default function useDateInput(_ref) {
5
5
  let {
6
6
  locale,
@@ -1 +1 @@
1
- {"version":3,"names":["useInputFormat","useInputFormatter","useRangeChecker","React","getTranslation","useDateInput","locale","value","validRange","inputMode","onChange","isDisabled","isWithinValidRange","validStart","validEnd","error","setError","useState","formatter","inputFormat","formattedValue","format","onChangeText","date","dayIndex","indexOf","monthIndex","yearIndex","day","Number","slice","year","month","isNaN","finalDate","Date","errors","filter","n","join"],"sources":["inputUtils.ts"],"sourcesContent":["import { useInputFormat, useInputFormatter, useRangeChecker } from './dateUtils'\nimport * as React from 'react'\nimport type { ValidRangeType } from './Calendar'\nimport { getTranslation } from 'react-native-paper-dates'\n\nexport default function useDateInput({\n locale,\n value,\n validRange,\n inputMode,\n onChange,\n}: {\n onChange: (d: Date) => void\n locale: undefined | string\n value: Date | undefined\n validRange: ValidRangeType | undefined\n inputMode: 'start' | 'end'\n}) {\n const { isDisabled, isWithinValidRange, validStart, validEnd } =\n useRangeChecker(validRange)\n const [error, setError] = React.useState<null | string>(null)\n const formatter = useInputFormatter({ locale })\n const inputFormat = useInputFormat({ formatter, locale })\n const formattedValue = value !== null ? formatter.format(value) : '';\n const onChangeText = (date: string) => {\n const dayIndex = inputFormat.indexOf('DD')\n const monthIndex = inputFormat.indexOf('MM')\n const yearIndex =\n locale === 'pt'\n ? inputFormat.indexOf('AAAA')\n : inputFormat.indexOf('YYYY')\n\n const day = Number(date.slice(dayIndex, dayIndex + 2))\n const year = Number(date.slice(yearIndex, yearIndex + 4))\n const month = Number(date.slice(monthIndex, monthIndex + 2))\n\n if (Number.isNaN(day) || Number.isNaN(year) || Number.isNaN(month)) {\n setError(\n getTranslation(\n locale,\n 'notAccordingToDateFormat',\n () => 'notAccordingToDateFormat'\n )(inputFormat)\n )\n return\n }\n\n const finalDate =\n inputMode === 'end'\n ? new Date(year, month - 1, day, 23, 59, 59)\n : new Date(year, month - 1, day)\n\n if (isDisabled(finalDate)) {\n setError(getTranslation(locale, 'dateIsDisabled'))\n return\n }\n if (!isWithinValidRange(finalDate)) {\n let errors =\n validStart && validEnd\n ? [\n `${getTranslation(\n locale,\n 'mustBeBetween',\n () => 'mustBeBetween'\n )(formatter.format(validStart), formatter.format(validEnd))}`,\n ]\n : [\n validStart\n ? getTranslation(\n locale,\n 'mustBeHigherThan',\n () => 'mustBeHigherThan'\n )(formatter.format(validStart))\n : '',\n validEnd\n ? getTranslation(\n locale,\n 'mustBeLowerThan',\n () => 'mustBeLowerThan'\n )(formatter.format(validEnd))\n : '',\n ]\n setError(errors.filter((n) => n).join(' '))\n return\n }\n\n setError(null)\n if (inputMode === 'end') {\n onChange(finalDate)\n } else {\n onChange(finalDate)\n }\n }\n return {\n onChange,\n error,\n formattedValue,\n onChangeText,\n inputFormat,\n }\n}\n"],"mappings":"AAAA,SAASA,cAAT,EAAyBC,iBAAzB,EAA4CC,eAA5C,QAAmE,aAAnE;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,cAAT,QAA+B,0BAA/B;AAEA,eAAe,SAASC,YAAT,OAYZ;EAAA,IAZkC;IACnCC,MADmC;IAEnCC,KAFmC;IAGnCC,UAHmC;IAInCC,SAJmC;IAKnCC;EALmC,CAYlC;EACD,MAAM;IAAEC,UAAF;IAAcC,kBAAd;IAAkCC,UAAlC;IAA8CC;EAA9C,IACJZ,eAAe,CAACM,UAAD,CADjB;EAEA,MAAM,CAACO,KAAD,EAAQC,QAAR,IAAoBb,KAAK,CAACc,QAAN,CAA8B,IAA9B,CAA1B;EACA,MAAMC,SAAS,GAAGjB,iBAAiB,CAAC;IAAEK;EAAF,CAAD,CAAnC;EACA,MAAMa,WAAW,GAAGnB,cAAc,CAAC;IAAEkB,SAAF;IAAaZ;EAAb,CAAD,CAAlC;EACA,MAAMc,cAAc,GAAGb,KAAK,KAAK,IAAV,GAAiBW,SAAS,CAACG,MAAV,CAAiBd,KAAjB,CAA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AACZ,cAAc,CAACE,MAAD,EAAS,gBAAT,CAAf,CAAR;MACA;IACD;;IACD,IAAI,CAACM,kBAAkB,CAACsB,SAAD,CAAvB,EAAoC;MAClC,IAAIE,MAAM,GACRvB,UAAU,IAAIC,QAAd,GACI,CACG,GAAEV,cAAc,CACfE,MADe,EAEf,eAFe,EAGf,MAAM,eAHS,CAAd,CAIDY,SAAS,CAACG,MAAV,CAAiBR,UAAjB,CAJC,EAI6BK,SAAS,CAACG,MAAV,CAAiBP,QAAjB,CAJ7B,CAIyD,EAL9D,CADJ,GAQI,CACED,UAAU,GACNT,cAAc,CACZE,MADY,EAEZ,kBAFY,EAGZ,MAAM,kBAHM,CAAd,CAIEY,SAAS,CAACG,MAAV,CAAiBR,UAAjB,CAJF,CADM,GAMN,EAPN,EAQEC,QAAQ,GACJV,cAAc,CACZE,MADY,EAEZ,iBAFY,EAGZ,MAAM,iBAHM,CAAd,CAIEY,SAAS,CAACG,MAAV,CAAiBP,QAAjB,CAJF,CADI,GAMJ,EAdN,CATN;MAyBAE,QAAQ,CAACoB,MAAM,CAACC,MAAP,CAAeC,CAAD,IAAOA,CAArB,EAAwBC,IAAxB,CAA6B,GAA7B,CAAD,CAAR;MACA;IACD;;IAEDvB,QAAQ,CAAC,IAAD,CAAR;;IACA,IAAIP,SAAS,KAAK,KAAlB,EAAyB;MACvBC,QAAQ,CAACwB,SAAD,CAAR;IACD,CAFD,MAEO;MACLxB,QAAQ,CAACwB,SAAD,CAAR;IACD;EACF,CApED;;EAqEA,OAAO;IACLxB,QADK;IAELK,KAFK;IAGLK,cAHK;IAILE,YAJK;IAKLH;EALK,CAAP;AAOD"}
1
+ {"version":3,"names":["useInputFormat","useInputFormatter","useRangeChecker","React","getTranslation","useDateInput","locale","value","validRange","inputMode","onChange","isDisabled","isWithinValidRange","validStart","validEnd","error","setError","useState","formatter","inputFormat","formattedValue","format","onChangeText","date","dayIndex","indexOf","monthIndex","yearIndex","day","Number","slice","year","month","isNaN","finalDate","Date","errors","filter","n","join"],"sources":["inputUtils.ts"],"sourcesContent":["import { useInputFormat, useInputFormatter, useRangeChecker } from './dateUtils'\nimport * as React from 'react'\nimport type { ValidRangeType } from './Calendar'\nimport { getTranslation } from '../translations/utils'\n\nexport default function useDateInput({\n locale,\n value,\n validRange,\n inputMode,\n onChange,\n}: {\n onChange: (d: Date) => void\n locale: undefined | string\n value: Date | undefined\n validRange: ValidRangeType | undefined\n inputMode: 'start' | 'end'\n}) {\n const { isDisabled, isWithinValidRange, validStart, validEnd } =\n useRangeChecker(validRange)\n const [error, setError] = React.useState<null | string>(null)\n const formatter = useInputFormatter({ locale })\n const inputFormat = useInputFormat({ formatter, locale })\n const formattedValue = value !== null ? formatter.format(value) : ''\n const onChangeText = (date: string) => {\n const dayIndex = inputFormat.indexOf('DD')\n const monthIndex = inputFormat.indexOf('MM')\n const yearIndex =\n locale === 'pt'\n ? inputFormat.indexOf('AAAA')\n : inputFormat.indexOf('YYYY')\n\n const day = Number(date.slice(dayIndex, dayIndex + 2))\n const year = Number(date.slice(yearIndex, yearIndex + 4))\n const month = Number(date.slice(monthIndex, monthIndex + 2))\n\n if (Number.isNaN(day) || Number.isNaN(year) || Number.isNaN(month)) {\n setError(\n getTranslation(\n locale,\n 'notAccordingToDateFormat',\n () => 'notAccordingToDateFormat'\n )(inputFormat)\n )\n return\n }\n\n const finalDate =\n inputMode === 'end'\n ? new Date(year, month - 1, day, 23, 59, 59)\n : new Date(year, month - 1, day)\n\n if (isDisabled(finalDate)) {\n setError(getTranslation(locale, 'dateIsDisabled'))\n return\n }\n if (!isWithinValidRange(finalDate)) {\n let errors =\n validStart && validEnd\n ? [\n `${getTranslation(\n locale,\n 'mustBeBetween',\n () => 'mustBeBetween'\n )(formatter.format(validStart), formatter.format(validEnd))}`,\n ]\n : [\n validStart\n ? getTranslation(\n locale,\n 'mustBeHigherThan',\n () => 'mustBeHigherThan'\n )(formatter.format(validStart))\n : '',\n validEnd\n ? getTranslation(\n locale,\n 'mustBeLowerThan',\n () => 'mustBeLowerThan'\n )(formatter.format(validEnd))\n : '',\n ]\n setError(errors.filter((n) => n).join(' '))\n return\n }\n\n setError(null)\n if (inputMode === 'end') {\n onChange(finalDate)\n } else {\n onChange(finalDate)\n }\n }\n return {\n onChange,\n error,\n formattedValue,\n onChangeText,\n inputFormat,\n }\n}\n"],"mappings":"AAAA,SAASA,cAAT,EAAyBC,iBAAzB,EAA4CC,eAA5C,QAAmE,aAAnE;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AAEA,SAASC,cAAT,QAA+B,uBAA/B;AAEA,eAAe,SAASC,YAAT,OAYZ;EAAA,IAZkC;IACnCC,MADmC;IAEnCC,KAFmC;IAGnCC,UAHmC;IAInCC,SAJmC;IAKnCC;EALmC,CAYlC;EACD,MAAM;IAAEC,UAAF;IAAcC,kBAAd;IAAkCC,UAAlC;IAA8CC;EAA9C,IACJZ,eAAe,CAACM,UAAD,CADjB;EAEA,MAAM,CAACO,KAAD,EAAQC,QAAR,IAAoBb,KAAK,CAACc,QAAN,CAA8B,IAA9B,CAA1B;EACA,MAAMC,SAAS,GAAGjB,iBAAiB,CAAC;IAAEK;EAAF,CAAD,CAAnC;EACA,MAAMa,WAAW,GAAGnB,cAAc,CAAC;IAAEkB,SAAF;IAAaZ;EAAb,CAAD,CAAlC;EACA,MAAMc,cAAc,GAAGb,KAAK,KAAK,IAAV,GAAiBW,SAAS,CAACG,MAAV,CAAiBd,KAAjB,CAAjB,GAA2C,EAAlE;;EACA,MAAMe,YAAY,GAAIC,IAAD,IAAkB;IACrC,MAAMC,QAAQ,GAAGL,WAAW,CAACM,OAAZ,CAAoB,IAApB,CAAjB;IACA,MAAMC,UAAU,GAAGP,WAAW,CAACM,OAAZ,CAAoB,IAApB,CAAnB;IACA,MAAME,SAAS,GACbrB,MAAM,KAAK,IAAX,GACIa,WAAW,CAACM,OAAZ,CAAoB,MAApB,CADJ,GAEIN,WAAW,CAACM,OAAZ,CAAoB,MAApB,CAHN;IAKA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AIyD,EAL9D,CADJ,GAQI,CACED,UAAU,GACNT,cAAc,CACZE,MADY,EAEZ,kBAFY,EAGZ,MAAM,kBAHM,CAAd,CAIEY,SAAS,CAACG,MAAV,CAAiBR,UAAjB,CAJF,CADM,GAMN,EAPN,EAQEC,QAAQ,GACJV,cAAc,CACZE,MADY,EAEZ,iBAFY,EAGZ,MAAM,iBAHM,CAAd,CAIEY,SAAS,CAACG,MAAV,CAAiBP,QAAjB,CAJF,CADI,GAMJ,EAdN,CATN;MAyBAE,QAAQ,CAACoB,MAAM,CAACC,MAAP,CAAeC,CAAD,IAAOA,CAArB,EAAwBC,IAAxB,CAA6B,GAA7B,CAAD,CAAR;MACA;IACD;;IAEDvB,QAAQ,CAAC,IAAD,CAAR;;IACA,IAAIP,SAAS,KAAK,KAAlB,EAAyB;MACvBC,QAAQ,CAACwB,SAAD,CAAR;IACD,CAFD,MAEO;MACLxB,QAAQ,CAACwB,SAAD,CAAR;IACD;EACF,CApED;;EAqEA,OAAO;IACLxB,QADK;IAELK,KAFK;IAGLK,cAHK;IAILE,YAJK;IAKLH;EALK,CAAP;AAOD"}
@@ -1 +1 @@
1
- {"version":3,"names":["ar","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["ar.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst ar: TranslationsType = {\n save: 'حفظ',\n selectSingle: 'حدد تاريخ',\n selectMultiple: 'حدد التواريخ',\n selectRange: 'حدد الفترة',\n notAccordingToDateFormat: (inputFormat:string) =>\n `يجب أن يكون تنسيق التاريخ ${inputFormat}`,\n mustBeHigherThan: (date) => `يجب أن يكون بعد ${date}`,\n mustBeLowerThan: (date) => `يجب أن يكون قبل ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `يجب أن يكون بين ${startDate} - ${endDate}`,\n dateIsDisabled: 'اليوم غير مسموح به',\n previous: 'السابق',\n next: 'التالي',\n typeInDate: 'اكتب التاريخ',\n pickDateFromCalendar: 'اختر التاريخ من التقويم',\n close: 'أغلق',\n}\nexport default ar\n"],"mappings":"AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,KADqB;EAE3BC,YAAY,EAAE,WAFa;EAG3BC,cAAc,EAAE,cAHW;EAI3BC,WAAW,EAAE,YAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,6BAA4BA,WAAY,EANhB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,oBAAmBA,IAAK,EAP1B;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,oBAAmBA,IAAK,EARzB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,mBAAkBD,SAAU,MAAKC,OAAQ,EAVjB;EAW3BC,cAAc,EAAE,oBAXW;EAY3BC,QAAQ,EAAE,QAZiB;EAa3BC,IAAI,EAAE,QAbqB;EAc3BC,UAAU,EAAE,cAde;EAe3BC,oBAAoB,EAAE,yBAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;AAkBA,eAAelB,EAAf"}
1
+ {"version":3,"names":["ar","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["ar.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst ar: TranslationsType = {\n save: 'حفظ',\n selectSingle: 'حدد تاريخ',\n selectMultiple: 'حدد التواريخ',\n selectRange: 'حدد الفترة',\n notAccordingToDateFormat: (inputFormat: string) =>\n `يجب أن يكون تنسيق التاريخ ${inputFormat}`,\n mustBeHigherThan: (date) => `يجب أن يكون بعد ${date}`,\n mustBeLowerThan: (date) => `يجب أن يكون قبل ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `يجب أن يكون بين ${startDate} - ${endDate}`,\n dateIsDisabled: 'اليوم غير مسموح به',\n previous: 'السابق',\n next: 'التالي',\n typeInDate: 'اكتب التاريخ',\n pickDateFromCalendar: 'اختر التاريخ من التقويم',\n close: 'أغلق',\n}\nexport default ar\n"],"mappings":"AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,KADqB;EAE3BC,YAAY,EAAE,WAFa;EAG3BC,cAAc,EAAE,cAHW;EAI3BC,WAAW,EAAE,YAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,6BAA4BA,WAAY,EANhB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,oBAAmBA,IAAK,EAP1B;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,oBAAmBA,IAAK,EARzB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,mBAAkBD,SAAU,MAAKC,OAAQ,EAVjB;EAW3BC,cAAc,EAAE,oBAXW;EAY3BC,QAAQ,EAAE,QAZiB;EAa3BC,IAAI,EAAE,QAbqB;EAc3BC,UAAU,EAAE,cAde;EAe3BC,oBAAoB,EAAE,yBAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;AAkBA,eAAelB,EAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":["de","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["de.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\nconst de: TranslationsType = {\n save: 'Speichern',\n selectSingle: 'Wähle Datum',\n selectMultiple: 'Wähle Daten',\n selectRange: 'Wähle Zeitspanne',\n notAccordingToDateFormat: (inputFormat) =>\n `Das Format sollte ${inputFormat} sein`,\n mustBeHigherThan: (date) => `Muss nach dem ${date} sein`,\n mustBeLowerThan: (date) => `Muss vor dem ${date} sein`,\n mustBeBetween: (startDate, endDate) =>\n `Muss in dieser Zeitspanne liegen ${startDate} - ${endDate}`,\n dateIsDisabled: 'Datum nicht wählbar',\n previous: 'Vorheriges',\n next: 'Nächstes',\n typeInDate: 'Datum eingeben',\n pickDateFromCalendar: 'Datum vom Kalender auswählen',\n close: 'Schliessen',\n}\nexport default de\n"],"mappings":"AACA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,WADqB;EAE3BC,YAAY,EAAE,aAFa;EAG3BC,cAAc,EAAE,aAHW;EAI3BC,WAAW,EAAE,kBAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,qBAAoBA,WAAY,OANR;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,iBAAgBA,IAAK,OAPvB;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,gBAAeA,IAAK,OARrB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,oCAAmCD,SAAU,MAAKC,OAAQ,EAVlC;EAW3BC,cAAc,EAAE,qBAXW;EAY3BC,QAAQ,EAAE,YAZiB;EAa3BC,IAAI,EAAE,UAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,8BAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;AAkBA,eAAelB,EAAf"}
1
+ {"version":3,"names":["de","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["de.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst de: TranslationsType = {\n save: 'Speichern',\n selectSingle: 'Wähle Datum',\n selectMultiple: 'Wähle Daten',\n selectRange: 'Wähle Zeitspanne',\n notAccordingToDateFormat: (inputFormat) =>\n `Das Format sollte ${inputFormat} sein`,\n mustBeHigherThan: (date) => `Muss nach dem ${date} sein`,\n mustBeLowerThan: (date) => `Muss vor dem ${date} sein`,\n mustBeBetween: (startDate, endDate) =>\n `Muss in dieser Zeitspanne liegen ${startDate} - ${endDate}`,\n dateIsDisabled: 'Datum nicht wählbar',\n previous: 'Vorheriges',\n next: 'Nächstes',\n typeInDate: 'Datum eingeben',\n pickDateFromCalendar: 'Datum vom Kalender auswählen',\n close: 'Schliessen',\n}\nexport default de\n"],"mappings":"AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,WADqB;EAE3BC,YAAY,EAAE,aAFa;EAG3BC,cAAc,EAAE,aAHW;EAI3BC,WAAW,EAAE,kBAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,qBAAoBA,WAAY,OANR;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,iBAAgBA,IAAK,OAPvB;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,gBAAeA,IAAK,OARrB;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,oCAAmCD,SAAU,MAAKC,OAAQ,EAVlC;EAW3BC,cAAc,EAAE,qBAXW;EAY3BC,QAAQ,EAAE,YAZiB;EAa3BC,IAAI,EAAE,UAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,8BAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;AAkBA,eAAelB,EAAf"}
@@ -0,0 +1,18 @@
1
+ const es = {
2
+ save: 'Guardar',
3
+ selectSingle: 'Seleccionar fecha',
4
+ selectMultiple: 'Seleccionar fechas',
5
+ selectRange: 'Seleccionar periodo',
6
+ notAccordingToDateFormat: inputFormat => `Formato de fecha debe ser ${inputFormat}`,
7
+ mustBeHigherThan: date => `Debe ser posterior a ${date}`,
8
+ mustBeLowerThan: date => `Debe ser anterior a ${date}`,
9
+ mustBeBetween: (startDate, endDate) => `Debe estar entre ${startDate} - ${endDate}`,
10
+ dateIsDisabled: 'Día no permitido',
11
+ previous: 'Anterior',
12
+ next: 'Siguiente',
13
+ typeInDate: 'Escribir fecha',
14
+ pickDateFromCalendar: 'Seleccionar fecha del calendario',
15
+ close: 'Cerrar'
16
+ };
17
+ export default es;
18
+ //# sourceMappingURL=es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["es","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["es.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst es: TranslationsType = {\n save: 'Guardar',\n selectSingle: 'Seleccionar fecha',\n selectMultiple: 'Seleccionar fechas',\n selectRange: 'Seleccionar periodo',\n notAccordingToDateFormat: (inputFormat) =>\n `Formato de fecha debe ser ${inputFormat}`,\n mustBeHigherThan: (date) => `Debe ser posterior a ${date}`,\n mustBeLowerThan: (date) => `Debe ser anterior a ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `Debe estar entre ${startDate} - ${endDate}`,\n dateIsDisabled: 'Día no permitido',\n previous: 'Anterior',\n next: 'Siguiente',\n typeInDate: 'Escribir fecha',\n pickDateFromCalendar: 'Seleccionar fecha del calendario',\n close: 'Cerrar',\n}\nexport default es\n"],"mappings":"AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,SADqB;EAE3BC,YAAY,EAAE,mBAFa;EAG3BC,cAAc,EAAE,oBAHW;EAI3BC,WAAW,EAAE,qBAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,6BAA4BA,WAAY,EANhB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,wBAAuBA,IAAK,EAP9B;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,uBAAsBA,IAAK,EAR5B;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,oBAAmBD,SAAU,MAAKC,OAAQ,EAVlB;EAW3BC,cAAc,EAAE,kBAXW;EAY3BC,QAAQ,EAAE,UAZiB;EAa3BC,IAAI,EAAE,WAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,kCAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;AAkBA,eAAelB,EAAf"}
@@ -7,7 +7,7 @@ const fr = {
7
7
  mustBeHigherThan: date => `La date doit être après le ${date}`,
8
8
  mustBeLowerThan: date => `La date doit être avant le ${date}`,
9
9
  mustBeBetween: (startDate, endDate) => `La date doit être en le ${startDate} et le ${endDate}`,
10
- dateIsDisabled: 'Le jour n\'est pas autorisé',
10
+ dateIsDisabled: "Le jour n'est pas autorisé",
11
11
  previous: 'Précédent',
12
12
  next: 'Suivant',
13
13
  typeInDate: 'Entrer la date',
@@ -1 +1 @@
1
- {"version":3,"names":["fr","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["fr.ts"],"sourcesContent":["\n \nimport type { TranslationsType } from './utils'\n\nconst fr: TranslationsType = {\n save: 'Enregistrer',\n selectSingle: 'Sélectionner une date',\n selectMultiple: 'Sélectionner plusieurs dates',\n selectRange: 'Sélectionner une période',\n notAccordingToDateFormat: (inputFormat) =>\n `La date doit être au format ${inputFormat}`,\n mustBeHigherThan: (date) => `La date doit être après le ${date}`,\n mustBeLowerThan: (date) => `La date doit être avant le ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `La date doit être en le ${startDate} et le ${endDate}`,\n dateIsDisabled: 'Le jour n\\'est pas autorisé',\n previous: 'Précédent',\n next: 'Suivant',\n typeInDate: 'Entrer la date',\n pickDateFromCalendar: 'Sélectionner une date dans le calendrier',\n close: 'Fermer',\n}\nexport default fr\n"],"mappings":"AAIA,MAAMA,EAAoB,GAAG;EACzBC,IAAI,EAAE,aADmB;EAEzBC,YAAY,EAAE,uBAFW;EAGzBC,cAAc,EAAE,8BAHS;EAIzBC,WAAW,EAAE,0BAJY;EAKzBC,wBAAwB,EAAGC,WAAD,IACrB,+BAA8BA,WAAY,EANtB;EAOzBC,gBAAgB,EAAGC,IAAD,IAAW,8BAA6BA,IAAK,EAPtC;EAQzBC,eAAe,EAAGD,IAAD,IAAW,8BAA6BA,IAAK,EARrC;EASzBE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACV,2BAA0BD,SAAU,UAASC,OAAQ,EAVjC;EAWzBC,cAAc,EAAE,6BAXS;EAYzBC,QAAQ,EAAE,WAZe;EAazBC,IAAI,EAAE,SAbmB;EAczBC,UAAU,EAAE,gBAda;EAezBC,oBAAoB,EAAE,0CAfG;EAgBzBC,KAAK,EAAE;AAhBkB,CAA7B;AAkBA,eAAelB,EAAf"}
1
+ {"version":3,"names":["fr","save","selectSingle","selectMultiple","selectRange","notAccordingToDateFormat","inputFormat","mustBeHigherThan","date","mustBeLowerThan","mustBeBetween","startDate","endDate","dateIsDisabled","previous","next","typeInDate","pickDateFromCalendar","close"],"sources":["fr.ts"],"sourcesContent":["import type { TranslationsType } from './utils'\n\nconst fr: TranslationsType = {\n save: 'Enregistrer',\n selectSingle: 'Sélectionner une date',\n selectMultiple: 'Sélectionner plusieurs dates',\n selectRange: 'Sélectionner une période',\n notAccordingToDateFormat: (inputFormat) =>\n `La date doit être au format ${inputFormat}`,\n mustBeHigherThan: (date) => `La date doit être après le ${date}`,\n mustBeLowerThan: (date) => `La date doit être avant le ${date}`,\n mustBeBetween: (startDate, endDate) =>\n `La date doit être en le ${startDate} et le ${endDate}`,\n dateIsDisabled: \"Le jour n'est pas autorisé\",\n previous: 'Précédent',\n next: 'Suivant',\n typeInDate: 'Entrer la date',\n pickDateFromCalendar: 'Sélectionner une date dans le calendrier',\n close: 'Fermer',\n}\nexport default fr\n"],"mappings":"AAEA,MAAMA,EAAoB,GAAG;EAC3BC,IAAI,EAAE,aADqB;EAE3BC,YAAY,EAAE,uBAFa;EAG3BC,cAAc,EAAE,8BAHW;EAI3BC,WAAW,EAAE,0BAJc;EAK3BC,wBAAwB,EAAGC,WAAD,IACvB,+BAA8BA,WAAY,EANlB;EAO3BC,gBAAgB,EAAGC,IAAD,IAAW,8BAA6BA,IAAK,EAPpC;EAQ3BC,eAAe,EAAGD,IAAD,IAAW,8BAA6BA,IAAK,EARnC;EAS3BE,aAAa,EAAE,CAACC,SAAD,EAAYC,OAAZ,KACZ,2BAA0BD,SAAU,UAASC,OAAQ,EAV7B;EAW3BC,cAAc,EAAE,4BAXW;EAY3BC,QAAQ,EAAE,WAZiB;EAa3BC,IAAI,EAAE,SAbqB;EAc3BC,UAAU,EAAE,gBAde;EAe3BC,oBAAoB,EAAE,0CAfK;EAgB3BC,KAAK,EAAE;AAhBoB,CAA7B;AAkBA,eAAelB,EAAf"}
@@ -13,6 +13,7 @@ interface DatePickerModalContentBaseProps {
13
13
  onDismiss: () => any;
14
14
  disableSafeTop?: boolean;
15
15
  saveLabelDisabled?: boolean;
16
+ uppercase?: boolean;
16
17
  }
17
18
  export interface DatePickerModalContentRangeProps extends HeaderPickProps, BaseCalendarProps, DatePickerModalContentBaseProps {
18
19
  mode: 'range';
@@ -0,0 +1,3 @@
1
+ import type { TranslationsType } from './utils';
2
+ declare const es: TranslationsType;
3
+ export default es;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-paper-dates",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Performant Date Picker for React Native Paper",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -22,14 +22,16 @@
22
22
  "!**/__mocks__"
23
23
  ],
24
24
  "scripts": {
25
- "test": "jest",
26
- "typescript": "tsc --noEmit",
25
+ "test": "jest --config=jest.config.js --watchAll=false",
26
+ "test-watch": "jest --config=jest.config.js --watchAll",
27
+ "typecheck": "tsc --noEmit",
27
28
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
28
29
  "prepare": "husky install && bob build",
29
- "release": "release-it",
30
+ "release": "release-it --ci",
30
31
  "example": "yarn --cwd example",
31
32
  "pods": "cd example && pod-install --quiet",
32
- "bootstrap": "yarn example && yarn && yarn pods"
33
+ "bootstrap": "yarn example && yarn && yarn pods",
34
+ "prepack": "bob build"
33
35
  },
34
36
  "keywords": [
35
37
  "react-native",
@@ -50,10 +52,13 @@
50
52
  "@commitlint/config-conventional": "^17.0.3",
51
53
  "@react-native-community/eslint-config": "^3.1.0",
52
54
  "@release-it/conventional-changelog": "^5.1.0",
55
+ "@testing-library/jest-native": "^5.3.3",
56
+ "@testing-library/react-native": "^11.5.0",
53
57
  "@types/color": "^3.0.3",
54
58
  "@types/jest": "^29.2.4",
55
59
  "@types/react": "^18.0.26",
56
60
  "@types/react-native": "^0.70.8",
61
+ "@types/react-native-vector-icons": "^6.4.12",
57
62
  "babel-loader": "^8.2.5",
58
63
  "commitlint": "^17.0.3",
59
64
  "eslint": "^8.22.0",
@@ -69,6 +74,7 @@
69
74
  "react-native-builder-bob": "^0.18.3",
70
75
  "react-native-paper": "^5.0.2",
71
76
  "react-native-safe-area-context": "^4.4.1",
77
+ "react-native-vector-icons": "^9.2.0",
72
78
  "release-it": "^15.4.0",
73
79
  "typescript": "^4.9.4"
74
80
  },
@@ -81,7 +87,7 @@
81
87
  "husky": {
82
88
  "hooks": {
83
89
  "commit-msg": "commitlint -E HUSKY_GIT_PARAMS",
84
- "pre-commit": "yarn lint && yarn typescript"
90
+ "pre-commit": "yarn lint && yarn typecheck"
85
91
  }
86
92
  },
87
93
  "commitlint": {
@@ -130,7 +136,8 @@
130
136
  "node_modules/",
131
137
  "lib/",
132
138
  "example/node_modules",
133
- "example/web-build"
139
+ "example/web-build",
140
+ "docusaurus"
134
141
  ],
135
142
  "prettier": {
136
143
  "quoteProps": "consistent",
@@ -155,7 +162,9 @@
155
162
  ]
156
163
  },
157
164
  "dependencies": {
165
+ "@types/react-test-renderer": "^18.0.0",
158
166
  "caniuse-lite": "^1.0.30001383",
159
- "color": "^3.2.1"
167
+ "color": "^3.2.1",
168
+ "react-test-renderer": "^18.2.0"
160
169
  }
161
170
  }
@@ -32,6 +32,7 @@ interface DatePickerModalContentBaseProps {
32
32
  onDismiss: () => any
33
33
  disableSafeTop?: boolean
34
34
  saveLabelDisabled?: boolean
35
+ uppercase?: boolean
35
36
  }
36
37
 
37
38
  export interface DatePickerModalContentRangeProps
@@ -145,8 +146,8 @@ export function DatePickerModalContent(
145
146
  onSave={onInnerConfirm}
146
147
  onDismiss={onDismiss}
147
148
  saveLabel={props.saveLabel}
148
- saveLabelDisabled={props.saveLabelDisabled || false}
149
- uppercase={props.uppercase || true}
149
+ saveLabelDisabled={props.saveLabelDisabled ?? false}
150
+ uppercase={props.uppercase ?? true}
150
151
  disableSafeTop={disableSafeTop}
151
152
  closeIcon={props.closeIcon}
152
153
  />
@@ -161,7 +162,7 @@ export function DatePickerModalContent(
161
162
  moreLabel={props.moreLabel}
162
163
  startLabel={props.startLabel}
163
164
  endLabel={props.endLabel}
164
- uppercase={props.uppercase || true}
165
+ uppercase={props.uppercase ?? true}
165
166
  locale={locale}
166
167
  editIcon={props.editIcon}
167
168
  calendarIcon={props.calendarIcon}
@@ -49,8 +49,8 @@ export default function DatePickerModalHeader(
49
49
  color={color}
50
50
  textColor={color}
51
51
  onPress={props.onSave}
52
- disabled={props.saveLabelDisabled || false}
53
- uppercase={props.uppercase || true}
52
+ disabled={props.saveLabelDisabled ?? false}
53
+ uppercase={props.uppercase ?? true}
54
54
  testID="react-native-paper-dates-save"
55
55
  >
56
56
  {saveLabel}
@@ -1,7 +1,7 @@
1
1
  import { useInputFormat, useInputFormatter, useRangeChecker } from './dateUtils'
2
2
  import * as React from 'react'
3
3
  import type { ValidRangeType } from './Calendar'
4
- import { getTranslation } from 'react-native-paper-dates'
4
+ import { getTranslation } from '../translations/utils'
5
5
 
6
6
  export default function useDateInput({
7
7
  locale,
@@ -21,7 +21,7 @@ export default function useDateInput({
21
21
  const [error, setError] = React.useState<null | string>(null)
22
22
  const formatter = useInputFormatter({ locale })
23
23
  const inputFormat = useInputFormat({ formatter, locale })
24
- const formattedValue = value !== null ? formatter.format(value) : '';
24
+ const formattedValue = value !== null ? formatter.format(value) : ''
25
25
  const onChangeText = (date: string) => {
26
26
  const dayIndex = inputFormat.indexOf('DD')
27
27
  const monthIndex = inputFormat.indexOf('MM')
@@ -5,7 +5,7 @@ const ar: TranslationsType = {
5
5
  selectSingle: 'حدد تاريخ',
6
6
  selectMultiple: 'حدد التواريخ',
7
7
  selectRange: 'حدد الفترة',
8
- notAccordingToDateFormat: (inputFormat:string) =>
8
+ notAccordingToDateFormat: (inputFormat: string) =>
9
9
  `يجب أن يكون تنسيق التاريخ ${inputFormat}`,
10
10
  mustBeHigherThan: (date) => `يجب أن يكون بعد ${date}`,
11
11
  mustBeLowerThan: (date) => `يجب أن يكون قبل ${date}`,
@@ -1,4 +1,5 @@
1
1
  import type { TranslationsType } from './utils'
2
+
2
3
  const de: TranslationsType = {
3
4
  save: 'Speichern',
4
5
  selectSingle: 'Wähle Datum',
@@ -0,0 +1,21 @@
1
+ import type { TranslationsType } from './utils'
2
+
3
+ const es: TranslationsType = {
4
+ save: 'Guardar',
5
+ selectSingle: 'Seleccionar fecha',
6
+ selectMultiple: 'Seleccionar fechas',
7
+ selectRange: 'Seleccionar periodo',
8
+ notAccordingToDateFormat: (inputFormat) =>
9
+ `Formato de fecha debe ser ${inputFormat}`,
10
+ mustBeHigherThan: (date) => `Debe ser posterior a ${date}`,
11
+ mustBeLowerThan: (date) => `Debe ser anterior a ${date}`,
12
+ mustBeBetween: (startDate, endDate) =>
13
+ `Debe estar entre ${startDate} - ${endDate}`,
14
+ dateIsDisabled: 'Día no permitido',
15
+ previous: 'Anterior',
16
+ next: 'Siguiente',
17
+ typeInDate: 'Escribir fecha',
18
+ pickDateFromCalendar: 'Seleccionar fecha del calendario',
19
+ close: 'Cerrar',
20
+ }
21
+ export default es
@@ -1,23 +1,21 @@
1
-
2
-
3
1
  import type { TranslationsType } from './utils'
4
2
 
5
3
  const fr: TranslationsType = {
6
- save: 'Enregistrer',
7
- selectSingle: 'Sélectionner une date',
8
- selectMultiple: 'Sélectionner plusieurs dates',
9
- selectRange: 'Sélectionner une période',
10
- notAccordingToDateFormat: (inputFormat) =>
11
- `La date doit être au format ${inputFormat}`,
12
- mustBeHigherThan: (date) => `La date doit être après le ${date}`,
13
- mustBeLowerThan: (date) => `La date doit être avant le ${date}`,
14
- mustBeBetween: (startDate, endDate) =>
15
- `La date doit être en le ${startDate} et le ${endDate}`,
16
- dateIsDisabled: 'Le jour n\'est pas autorisé',
17
- previous: 'Précédent',
18
- next: 'Suivant',
19
- typeInDate: 'Entrer la date',
20
- pickDateFromCalendar: 'Sélectionner une date dans le calendrier',
21
- close: 'Fermer',
4
+ save: 'Enregistrer',
5
+ selectSingle: 'Sélectionner une date',
6
+ selectMultiple: 'Sélectionner plusieurs dates',
7
+ selectRange: 'Sélectionner une période',
8
+ notAccordingToDateFormat: (inputFormat) =>
9
+ `La date doit être au format ${inputFormat}`,
10
+ mustBeHigherThan: (date) => `La date doit être après le ${date}`,
11
+ mustBeLowerThan: (date) => `La date doit être avant le ${date}`,
12
+ mustBeBetween: (startDate, endDate) =>
13
+ `La date doit être en le ${startDate} et le ${endDate}`,
14
+ dateIsDisabled: "Le jour n'est pas autorisé",
15
+ previous: 'Précédent',
16
+ next: 'Suivant',
17
+ typeInDate: 'Entrer la date',
18
+ pickDateFromCalendar: 'Sélectionner une date dans le calendrier',
19
+ close: 'Fermer',
22
20
  }
23
21
  export default fr
@@ -1,9 +0,0 @@
1
- "use strict";
2
-
3
- var _dateUtils = require("./dateUtils");
4
-
5
- test('gridCounts contains the right data for October 2021', () => {
6
- const gridCount = (0, _dateUtils.getGridCountForDate)((0, _dateUtils.addMonths)(new Date(2018, 10 - 1, 1), 12 * 3));
7
- expect(gridCount).toBe(6);
8
- });
9
- //# sourceMappingURL=dateUtils.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["test","gridCount","getGridCountForDate","addMonths","Date","expect","toBe"],"sources":["dateUtils.test.ts"],"sourcesContent":["import { addMonths, getGridCountForDate } from './dateUtils'\n\ntest('gridCounts contains the right data for October 2021', () => {\n const gridCount = getGridCountForDate(\n addMonths(new Date(2018, 10 - 1, 1), 12 * 3)\n )\n\n expect(gridCount).toBe(6)\n})\n"],"mappings":";;AAAA;;AAEAA,IAAI,CAAC,qDAAD,EAAwD,MAAM;EAChE,MAAMC,SAAS,GAAG,IAAAC,8BAAA,EAChB,IAAAC,oBAAA,EAAU,IAAIC,IAAJ,CAAS,IAAT,EAAe,KAAK,CAApB,EAAuB,CAAvB,CAAV,EAAqC,KAAK,CAA1C,CADgB,CAAlB;EAIAC,MAAM,CAACJ,SAAD,CAAN,CAAkBK,IAAlB,CAAuB,CAAvB;AACD,CANG,CAAJ"}
@@ -1,6 +0,0 @@
1
- import { addMonths, getGridCountForDate } from './dateUtils';
2
- test('gridCounts contains the right data for October 2021', () => {
3
- const gridCount = getGridCountForDate(addMonths(new Date(2018, 10 - 1, 1), 12 * 3));
4
- expect(gridCount).toBe(6);
5
- });
6
- //# sourceMappingURL=dateUtils.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["addMonths","getGridCountForDate","test","gridCount","Date","expect","toBe"],"sources":["dateUtils.test.ts"],"sourcesContent":["import { addMonths, getGridCountForDate } from './dateUtils'\n\ntest('gridCounts contains the right data for October 2021', () => {\n const gridCount = getGridCountForDate(\n addMonths(new Date(2018, 10 - 1, 1), 12 * 3)\n )\n\n expect(gridCount).toBe(6)\n})\n"],"mappings":"AAAA,SAASA,SAAT,EAAoBC,mBAApB,QAA+C,aAA/C;AAEAC,IAAI,CAAC,qDAAD,EAAwD,MAAM;EAChE,MAAMC,SAAS,GAAGF,mBAAmB,CACnCD,SAAS,CAAC,IAAII,IAAJ,CAAS,IAAT,EAAe,KAAK,CAApB,EAAuB,CAAvB,CAAD,EAA4B,KAAK,CAAjC,CAD0B,CAArC;EAIAC,MAAM,CAACF,SAAD,CAAN,CAAkBG,IAAlB,CAAuB,CAAvB;AACD,CANG,CAAJ"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,9 +0,0 @@
1
- import { addMonths, getGridCountForDate } from './dateUtils'
2
-
3
- test('gridCounts contains the right data for October 2021', () => {
4
- const gridCount = getGridCountForDate(
5
- addMonths(new Date(2018, 10 - 1, 1), 12 * 3)
6
- )
7
-
8
- expect(gridCount).toBe(6)
9
- })