@kivid/native-components 1.0.0-alpha.21 → 1.0.0-alpha.23

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/dist/commonjs/components/ActionButton/index.js +2 -1
  2. package/dist/commonjs/components/ActionButton/index.js.map +1 -1
  3. package/dist/commonjs/components/DatePicker/assets/theme.js +99 -0
  4. package/dist/commonjs/components/DatePicker/assets/theme.js.map +1 -0
  5. package/dist/commonjs/components/DatePicker/index.js +182 -0
  6. package/dist/commonjs/components/DatePicker/index.js.map +1 -0
  7. package/dist/commonjs/components/DatePicker/types.js +6 -0
  8. package/dist/commonjs/components/DatePicker/types.js.map +1 -0
  9. package/dist/commonjs/components/LoadingDots/assets/loading-button-gray.json +739 -0
  10. package/dist/commonjs/components/LoadingDots/index.js +2 -1
  11. package/dist/commonjs/components/LoadingDots/index.js.map +1 -1
  12. package/dist/commonjs/components/index.js +11 -0
  13. package/dist/commonjs/components/index.js.map +1 -1
  14. package/dist/module/components/ActionButton/index.js +2 -1
  15. package/dist/module/components/ActionButton/index.js.map +1 -1
  16. package/dist/module/components/DatePicker/assets/theme.js +95 -0
  17. package/dist/module/components/DatePicker/assets/theme.js.map +1 -0
  18. package/dist/module/components/DatePicker/index.js +177 -0
  19. package/dist/module/components/DatePicker/index.js.map +1 -0
  20. package/dist/module/components/DatePicker/types.js +4 -0
  21. package/dist/module/components/DatePicker/types.js.map +1 -0
  22. package/dist/module/components/LoadingDots/assets/loading-button-gray.json +739 -0
  23. package/dist/module/components/LoadingDots/index.js +2 -1
  24. package/dist/module/components/LoadingDots/index.js.map +1 -1
  25. package/dist/module/components/index.js +1 -0
  26. package/dist/module/components/index.js.map +1 -1
  27. package/dist/typescript/components/ActionButton/types.d.ts +4 -0
  28. package/dist/typescript/components/DatePicker/assets/theme.d.ts +92 -0
  29. package/dist/typescript/components/DatePicker/index.d.ts +4 -0
  30. package/dist/typescript/components/DatePicker/types.d.ts +17 -0
  31. package/dist/typescript/components/LoadingDots/types.d.ts +1 -1
  32. package/dist/typescript/components/index.d.ts +2 -0
  33. package/package.json +9 -5
  34. package/src/components/ActionButton/index.tsx +2 -0
  35. package/src/components/ActionButton/types.ts +4 -0
  36. package/src/components/DatePicker/assets/theme.ts +92 -0
  37. package/src/components/DatePicker/index.tsx +250 -0
  38. package/src/components/DatePicker/types.ts +20 -0
  39. package/src/components/LoadingDots/assets/loading-button-gray.json +739 -0
  40. package/src/components/LoadingDots/index.tsx +1 -0
  41. package/src/components/LoadingDots/types.ts +1 -1
  42. package/src/components/index.ts +3 -0
@@ -14,7 +14,8 @@ export const LoadingDots = ({
14
14
  const variantsMap = {
15
15
  grape: require("./assets/loading-button-grape.json"),
16
16
  light: require("./assets/loading-button-light.json"),
17
- dark: require("./assets/loading-button-dark.json")
17
+ dark: require("./assets/loading-button-dark.json"),
18
+ gray: require("./assets/loading-button-gray.json")
18
19
  };
19
20
  const purposefulOverwrittenSrc = variantsMap[variant];
20
21
  const narrowedStyle = lottieViewStyle || {};
@@ -1 +1 @@
1
- {"version":3,"names":["LottieView","View","jsx","_jsx","LoadingDots","variant","className","style","lottieViewStyle","ref","rest","variantsMap","grape","require","light","dark","purposefulOverwrittenSrc","narrowedStyle","children","loop","autoPlay","width","height","source"],"sourceRoot":"../../../../src","sources":["components/LoadingDots/index.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,qBAAqB;AAE5C,SAASC,IAAI,QAAmB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/C,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,OAAO,GAAG,OAAO;EACjBC,SAAS;EACTC,KAAK;EACLC,eAAe;EACfC,GAAG;EACH,GAAGC;AACa,CAAC,KAAK;EACtB,MAAMC,WAA+C,GAAG;IACtDC,KAAK,EAAEC,OAAO,CAAC,oCAAoC,CAAC;IACpDC,KAAK,EAAED,OAAO,CAAC,oCAAoC,CAAC;IACpDE,IAAI,EAAEF,OAAO,CAAC,mCAAmC;EACnD,CAAC;EAED,MAAMG,wBAAwB,GAAGL,WAAW,CAACN,OAAO,CAAC;EAErD,MAAMY,aAAa,GAAIT,eAAe,IAAkB,CAAC,CAAC;EAE1D,oBACEL,IAAA,CAACF,IAAI;IAACK,SAAS,EAAEA,SAAU;IAACC,KAAK,EAAEA,KAAM;IAACE,GAAG,EAAEA,GAAI;IAAAS,QAAA,eACjDf,IAAA,CAACH,UAAU;MACTmB,IAAI,EAAE,IAAK;MACXC,QAAQ,EAAE,IAAK;MAAA,GACXV,IAAI;MACRH,KAAK,EAAE;QAAEc,KAAK,EAAE,EAAE;QAAEC,MAAM,EAAE,EAAE;QAAE,GAAGL;MAAc,CAAE;MACnDM,MAAM,EAAEP;IAAyB,CAClC;EAAC,CACE,CAAC;AAEX,CAAC;AAED,eAAeZ,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["LottieView","View","jsx","_jsx","LoadingDots","variant","className","style","lottieViewStyle","ref","rest","variantsMap","grape","require","light","dark","gray","purposefulOverwrittenSrc","narrowedStyle","children","loop","autoPlay","width","height","source"],"sourceRoot":"../../../../src","sources":["components/LoadingDots/index.tsx"],"mappings":";;AAAA,OAAOA,UAAU,MAAM,qBAAqB;AAE5C,SAASC,IAAI,QAAmB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE/C,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,OAAO,GAAG,OAAO;EACjBC,SAAS;EACTC,KAAK;EACLC,eAAe;EACfC,GAAG;EACH,GAAGC;AACa,CAAC,KAAK;EACtB,MAAMC,WAA+C,GAAG;IACtDC,KAAK,EAAEC,OAAO,CAAC,oCAAoC,CAAC;IACpDC,KAAK,EAAED,OAAO,CAAC,oCAAoC,CAAC;IACpDE,IAAI,EAAEF,OAAO,CAAC,mCAAmC,CAAC;IAClDG,IAAI,EAAEH,OAAO,CAAC,mCAAmC;EACnD,CAAC;EAED,MAAMI,wBAAwB,GAAGN,WAAW,CAACN,OAAO,CAAC;EAErD,MAAMa,aAAa,GAAIV,eAAe,IAAkB,CAAC,CAAC;EAE1D,oBACEL,IAAA,CAACF,IAAI;IAACK,SAAS,EAAEA,SAAU;IAACC,KAAK,EAAEA,KAAM;IAACE,GAAG,EAAEA,GAAI;IAAAU,QAAA,eACjDhB,IAAA,CAACH,UAAU;MACToB,IAAI,EAAE,IAAK;MACXC,QAAQ,EAAE,IAAK;MAAA,GACXX,IAAI;MACRH,KAAK,EAAE;QAAEe,KAAK,EAAE,EAAE;QAAEC,MAAM,EAAE,EAAE;QAAE,GAAGL;MAAc,CAAE;MACnDM,MAAM,EAAEP;IAAyB,CAClC;EAAC,CACE,CAAC;AAEX,CAAC;AAED,eAAeb,WAAW","ignoreList":[]}
@@ -39,4 +39,5 @@ export * from "./PasswordInput/index.js";
39
39
  export * from "./PageIndicators/index.js";
40
40
  export * from "./ActionButton/index.js";
41
41
  export * from "./MessageInput/index.js";
42
+ export * from "./DatePicker/index.js";
42
43
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,mBAAU;AACxB,cAAc,mBAAU;AAGxB,cAAc,uBAAc;AAI5B,cAAc,iBAAQ;AACtB,cAAc,uBAAc;AAC5B,cAAc,iBAAc;AAE5B,cAAc,8BAAqB;AACnC,cAAc,8BAA2B;AAGzC,cAAc,0BAAiB;AAC/B,cAAc,gCAAuB;AAGrC,cAAc,qBAAY;AAC1B,cAAc,2BAAkB;AAGhC,cAAc,yBAAgB;AAG9B,cAAc,4BAAmB;AAGjC,cAAc,wBAAe;AAC7B,cAAc,wBAAqB;AAEnC,cAAc,iBAAQ;AACtB,cAAc,uBAAc;AAG5B,cAAc,kBAAS;AAGvB,cAAc,mBAAU;AACxB,cAAc,yBAAgB;AAG9B,cAAc,uBAAc;AAG5B,cAAc,kBAAS;AACvB,cAAc,wBAAe;AAG7B,cAAc,oBAAW;AAGzB,cAAc,uBAAc;AAC5B,cAAc,6BAAoB;AAGlC,cAAc,sBAAa;AAC3B,cAAc,sBAAmB;AAGjC,cAAc,yBAAgB;AAC9B,cAAc,+BAAsB;AAGpC,cAAc,uBAAc;AAC5B,cAAc,6BAAoB;AAGlC,cAAc,uBAAc;AAC5B,cAAc,uBAAoB;AAGlC,cAAc,0BAAiB;AAG/B,cAAc,2BAAkB;AAGhC,cAAc,yBAAgB;AAG9B,cAAc,yBAAgB","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,mBAAU;AACxB,cAAc,mBAAU;AAGxB,cAAc,uBAAc;AAI5B,cAAc,iBAAQ;AACtB,cAAc,uBAAc;AAC5B,cAAc,iBAAc;AAE5B,cAAc,8BAAqB;AACnC,cAAc,8BAA2B;AAGzC,cAAc,0BAAiB;AAC/B,cAAc,gCAAuB;AAGrC,cAAc,qBAAY;AAC1B,cAAc,2BAAkB;AAGhC,cAAc,yBAAgB;AAG9B,cAAc,4BAAmB;AAGjC,cAAc,wBAAe;AAC7B,cAAc,wBAAqB;AAEnC,cAAc,iBAAQ;AACtB,cAAc,uBAAc;AAG5B,cAAc,kBAAS;AAGvB,cAAc,mBAAU;AACxB,cAAc,yBAAgB;AAG9B,cAAc,uBAAc;AAG5B,cAAc,kBAAS;AACvB,cAAc,wBAAe;AAG7B,cAAc,oBAAW;AAGzB,cAAc,uBAAc;AAC5B,cAAc,6BAAoB;AAGlC,cAAc,sBAAa;AAC3B,cAAc,sBAAmB;AAGjC,cAAc,yBAAgB;AAC9B,cAAc,+BAAsB;AAGpC,cAAc,uBAAc;AAC5B,cAAc,6BAAoB;AAGlC,cAAc,uBAAc;AAC5B,cAAc,uBAAoB;AAGlC,cAAc,0BAAiB;AAG/B,cAAc,2BAAkB;AAGhC,cAAc,yBAAgB;AAG9B,cAAc,yBAAgB;AAG9B,cAAc,uBAAc","ignoreList":[]}
@@ -38,6 +38,10 @@ export interface ActionButtonProps extends VariantProps<typeof menuCardVariants>
38
38
  * Whether the card is disabled
39
39
  */
40
40
  disabled?: boolean;
41
+ /**
42
+ * Whether the card is selected (only affects outline variant)
43
+ */
44
+ selected?: boolean;
41
45
  /**
42
46
  * Additional class names for the main container
43
47
  */
@@ -0,0 +1,92 @@
1
+ export declare const defaultTheme: {
2
+ backgroundColor: string;
3
+ calendarBackground: string;
4
+ textSectionTitleColor: string;
5
+ textSectionTitleDisabledColor: string;
6
+ selectedDayBackgroundColor: string;
7
+ selectedDayTextColor: string;
8
+ todayTextColor: string;
9
+ dayTextColor: string;
10
+ textDisabledColor: string;
11
+ dotColor: string;
12
+ selectedDotColor: string;
13
+ arrowColor: string;
14
+ disabledArrowColor: string;
15
+ monthTextColor: string;
16
+ indicatorColor: string;
17
+ textDayFontFamily: string;
18
+ textMonthFontFamily: string;
19
+ textDayHeaderFontFamily: string;
20
+ textDayFontWeight: "500";
21
+ textMonthFontWeight: "600";
22
+ textDayHeaderFontWeight: "700";
23
+ textDayFontSize: number;
24
+ textMonthFontSize: number;
25
+ textDayHeaderFontSize: number;
26
+ "stylesheet.calendar.header": {
27
+ header: {
28
+ flexDirection: "row";
29
+ justifyContent: "space-between";
30
+ alignItems: "center";
31
+ backgroundColor: string;
32
+ borderBottomWidth: number;
33
+ borderBottomColor: string;
34
+ };
35
+ monthText: {
36
+ fontSize: number;
37
+ fontWeight: "600";
38
+ color: string;
39
+ };
40
+ arrow: {
41
+ padding: number;
42
+ };
43
+ arrowImage: {
44
+ tintColor: string;
45
+ };
46
+ week: {
47
+ marginTop: number;
48
+ marginBottom: number;
49
+ flexDirection: "row";
50
+ justifyContent: "space-around";
51
+ };
52
+ };
53
+ "stylesheet.day.basic": {
54
+ base: {
55
+ width: number;
56
+ height: number;
57
+ alignItems: "center";
58
+ justifyContent: "center";
59
+ borderWidth: number;
60
+ borderColor: string;
61
+ borderRadius: number;
62
+ paddingTop: number;
63
+ paddingBottom: number;
64
+ };
65
+ text: {
66
+ fontSize: number;
67
+ fontWeight: "500";
68
+ color: string;
69
+ };
70
+ selected: {
71
+ backgroundColor: string;
72
+ borderWidth: number;
73
+ borderColor: string;
74
+ };
75
+ today: {
76
+ backgroundColor: string;
77
+ borderWidth: number;
78
+ borderColor: string;
79
+ };
80
+ todayText: {
81
+ color: string;
82
+ fontWeight: "600";
83
+ };
84
+ disabled: {
85
+ opacity: number;
86
+ borderWidth: number;
87
+ };
88
+ disabledText: {
89
+ color: string;
90
+ };
91
+ };
92
+ };
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import type { DatePickerProps } from "./types";
3
+ declare const NativeWindDatePicker: React.ComponentType<DatePickerProps>;
4
+ export { NativeWindDatePicker as DatePicker };
@@ -0,0 +1,17 @@
1
+ import { CalendarProps } from "react-native-calendars";
2
+ import { MarkingTypes } from "react-native-calendars/src/types";
3
+ export interface DatePickerProps extends Omit<CalendarProps, "onDayPress"> {
4
+ onDateSelect?: (date: string, additionalData?: string[] | {
5
+ start: string;
6
+ end: string;
7
+ }) => void;
8
+ initialDate?: string;
9
+ minDate?: string;
10
+ maxDate?: string;
11
+ markedDates?: CalendarProps["markedDates"];
12
+ theme?: CalendarProps["theme"];
13
+ selectionType?: MarkingTypes;
14
+ unavailableDates?: string[];
15
+ selectedDates: string[];
16
+ onSelectedDatesChange: (dateOrUpdater: string | ((prev: string[]) => string[])) => void;
17
+ }
@@ -1,6 +1,6 @@
1
1
  import type { LottieViewProps } from "lottie-react-native";
2
2
  import { StyleProp, View, ViewStyle } from "react-native";
3
- export type LoadingDotsVariant = "grape" | "light" | "dark";
3
+ export type LoadingDotsVariant = "grape" | "light" | "dark" | "gray";
4
4
  export interface LoadingDotsProps extends Omit<LottieViewProps, "source"> {
5
5
  variant?: LoadingDotsVariant;
6
6
  lottieViewStyle?: StyleProp<ViewStyle>;
@@ -60,3 +60,5 @@ export * from "./ActionButton";
60
60
  export type * from "./ActionButton/types";
61
61
  export * from "./MessageInput";
62
62
  export type * from "./MessageInput/types";
63
+ export * from "./DatePicker";
64
+ export type * from "./DatePicker/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kivid/native-components",
3
- "version": "1.0.0-alpha.21",
3
+ "version": "1.0.0-alpha.23",
4
4
  "description": "A React Native component library for the Butterfly Design System.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -88,8 +88,8 @@
88
88
  "react-test-renderer": "19.0.0",
89
89
  "ts-jest": "^29.2.5",
90
90
  "typescript": "~5.8.3",
91
- "@kivid/tailwind-preset": "1.0.0-alpha.21",
92
- "@kivid/icons": "1.0.0-alpha.21"
91
+ "@kivid/tailwind-preset": "1.0.0-alpha.23",
92
+ "@kivid/icons": "1.0.0-alpha.23"
93
93
  },
94
94
  "peerDependencies": {
95
95
  "@lottiefiles/dotlottie-react": "^0.15.1",
@@ -99,13 +99,17 @@
99
99
  "react": "19.0.0",
100
100
  "react-native": "0.79.5",
101
101
  "react-native-svg": "^15.12.0",
102
- "@kivid/tailwind-preset": "1.0.0-alpha.21",
103
- "@kivid/icons": "1.0.0-alpha.21"
102
+ "@kivid/tailwind-preset": "1.0.0-alpha.23",
103
+ "@kivid/icons": "1.0.0-alpha.23"
104
104
  },
105
105
  "eslintIgnore": [
106
106
  "node_modules/",
107
107
  "dist/"
108
108
  ],
109
+ "dependencies": {
110
+ "date-fns": "^4.1.0",
111
+ "react-native-calendars": "^1.1313.0"
112
+ },
109
113
  "scripts": {
110
114
  "build": "rm -rf dist && tsc -p tsconfig.build.json && bob build && node postbuild.js",
111
115
  "dev": "tsc -p tsconfig.build.json --watch",
@@ -16,6 +16,7 @@ export function ActionButton(props: ActionButtonProps) {
16
16
  variant = "grape",
17
17
  corners = CornersEnum.MEDIUM,
18
18
  disabled = false,
19
+ selected = false,
19
20
  className,
20
21
  iconContainerClassName,
21
22
  onPress,
@@ -45,6 +46,7 @@ export function ActionButton(props: ActionButtonProps) {
45
46
  corners,
46
47
  }),
47
48
  isPressed && !disabled && pressedColorMap[variant],
49
+ selected && variant === "outline" && "border-grape-300 bg-grape-100",
48
50
  className
49
51
  );
50
52
 
@@ -53,6 +53,10 @@ export interface ActionButtonProps
53
53
  * Whether the card is disabled
54
54
  */
55
55
  disabled?: boolean;
56
+ /**
57
+ * Whether the card is selected (only affects outline variant)
58
+ */
59
+ selected?: boolean;
56
60
  /**
57
61
  * Additional class names for the main container
58
62
  */
@@ -0,0 +1,92 @@
1
+ export const defaultTheme = {
2
+ backgroundColor: "#FAFCFC",
3
+ calendarBackground: "#FAFCFC",
4
+ textSectionTitleColor: "#6B7280",
5
+ textSectionTitleDisabledColor: "#D1D5DB",
6
+ selectedDayBackgroundColor: "#EAE0FF",
7
+ selectedDayTextColor: "#1F2937",
8
+ todayTextColor: "#1F2937",
9
+ dayTextColor: "#1F2937",
10
+ textDisabledColor: "#D1D5DB",
11
+ dotColor: "#1F2937",
12
+ selectedDotColor: "#1F2937",
13
+ arrowColor: "#1F2937",
14
+ disabledArrowColor: "#D1D5DB",
15
+ monthTextColor: "#1F2937",
16
+ indicatorColor: "#1F2937",
17
+ textDayFontFamily: "System",
18
+ textMonthFontFamily: "System",
19
+ textDayHeaderFontFamily: "System",
20
+ textDayFontWeight: "500" as const,
21
+ textMonthFontWeight: "600" as const,
22
+ textDayHeaderFontWeight: "700" as const,
23
+ textDayFontSize: 16,
24
+ textMonthFontSize: 18,
25
+ textDayHeaderFontSize: 13.5,
26
+ "stylesheet.calendar.header": {
27
+ header: {
28
+ flexDirection: "row" as const,
29
+ justifyContent: "space-between" as const,
30
+ alignItems: "center" as const,
31
+ backgroundColor: "#FAFCFC",
32
+ borderBottomWidth: 1,
33
+ borderBottomColor: "#DEE7E7",
34
+ },
35
+ monthText: {
36
+ fontSize: 18,
37
+ fontWeight: "600" as const,
38
+ color: "#1F2937",
39
+ },
40
+ arrow: {
41
+ padding: 0,
42
+ },
43
+ arrowImage: {
44
+ tintColor: "#1F2937",
45
+ },
46
+ week: {
47
+ marginTop: 16,
48
+ marginBottom: 8,
49
+ flexDirection: "row" as const,
50
+ justifyContent: "space-around" as const,
51
+ },
52
+ },
53
+ "stylesheet.day.basic": {
54
+ base: {
55
+ width: 40,
56
+ height: 35,
57
+ alignItems: "center" as const,
58
+ justifyContent: "center" as const,
59
+ borderWidth: 1,
60
+ borderColor: "#DEE7E7",
61
+ borderRadius: 8,
62
+ paddingTop: 6,
63
+ paddingBottom: 4,
64
+ },
65
+ text: {
66
+ fontSize: 16,
67
+ fontWeight: "500" as const,
68
+ color: "#1F2937",
69
+ },
70
+ selected: {
71
+ backgroundColor: "#EAE0FF",
72
+ borderWidth: 1,
73
+ borderColor: "#B9A0F2",
74
+ },
75
+ today: {
76
+ backgroundColor: "transparent",
77
+ borderWidth: 1,
78
+ borderColor: "#DEE7E7",
79
+ },
80
+ todayText: {
81
+ color: "#1F2937",
82
+ fontWeight: "600" as const,
83
+ },
84
+ disabled: {
85
+ opacity: 0.3,
86
+ borderWidth: 0,
87
+ },
88
+ disabledText: {
89
+ color: "#D1D5DB",
90
+ },
91
+ },
92
+ };
@@ -0,0 +1,250 @@
1
+ import React, { useState, useMemo, useCallback } from "react";
2
+ import { View } from "react-native";
3
+ import { Calendar, DateData, LocaleConfig } from "react-native-calendars";
4
+ import { format } from "date-fns";
5
+ import { ptBR } from "date-fns/locale";
6
+ import type { DatePickerProps } from "./types";
7
+
8
+ import { defaultTheme } from "./assets/theme";
9
+ import Typography from "../Typography";
10
+ import { ArrowLeftStroke, ArrowRightStroke } from "@kivid/icons/native";
11
+ import { cssInterop } from "nativewind";
12
+
13
+ LocaleConfig.locales["pt-br"] = {
14
+ monthNames: [
15
+ "Janeiro",
16
+ "Fevereiro",
17
+ "Março",
18
+ "Abril",
19
+ "Maio",
20
+ "Junho",
21
+ "Julho",
22
+ "Agosto",
23
+ "Setembro",
24
+ "Outubro",
25
+ "Novembro",
26
+ "Dezembro",
27
+ ],
28
+ monthNamesShort: [
29
+ "Jan",
30
+ "Fev",
31
+ "Mar",
32
+ "Abr",
33
+ "Mai",
34
+ "Jun",
35
+ "Jul",
36
+ "Ago",
37
+ "Set",
38
+ "Out",
39
+ "Nov",
40
+ "Dez",
41
+ ],
42
+ dayNames: [
43
+ "Domingo",
44
+ "Segunda",
45
+ "Terça",
46
+ "Quarta",
47
+ "Quinta",
48
+ "Sexta",
49
+ "Sábado",
50
+ ],
51
+ dayNamesShort: ["D", "S", "T", "Q", "Q", "S", "S"],
52
+ today: "Hoje",
53
+ };
54
+ LocaleConfig.defaultLocale = "pt-br";
55
+
56
+ function DatePicker(props: DatePickerProps) {
57
+ const {
58
+ selectedDates,
59
+ onSelectedDatesChange,
60
+ initialDate,
61
+ minDate,
62
+ maxDate,
63
+ markedDates: externalMarkedDates,
64
+ unavailableDates,
65
+ theme: customTheme,
66
+ selectionType,
67
+ ...rest
68
+ } = props;
69
+
70
+ const [currentMonth, setCurrentMonth] = useState<string>(
71
+ initialDate || format(new Date(), "yyyy-MM-dd")
72
+ );
73
+
74
+ const onDayPress = useCallback(
75
+ (day: DateData) => {
76
+ const dateString = day.dateString;
77
+
78
+ if (unavailableDates?.includes(dateString)) {
79
+ return;
80
+ }
81
+
82
+ if (externalMarkedDates?.[dateString]) {
83
+ return;
84
+ }
85
+
86
+ if (!selectionType) {
87
+ onSelectedDatesChange(dateString);
88
+
89
+ return;
90
+ }
91
+
92
+ if (selectionType === "multi-dot") {
93
+ onSelectedDatesChange((prev) => {
94
+ const isSelected = prev.includes(dateString);
95
+ const newDates = isSelected
96
+ ? prev.filter((d) => d !== dateString)
97
+ : [...prev, dateString];
98
+ return newDates;
99
+ });
100
+ return;
101
+ }
102
+ },
103
+ [
104
+ onSelectedDatesChange,
105
+ selectionType,
106
+ externalMarkedDates,
107
+ unavailableDates,
108
+ ]
109
+ );
110
+
111
+ const markedDates = useMemo(() => {
112
+ const filteredExternalMarkedDates = externalMarkedDates
113
+ ? Object.keys(externalMarkedDates).reduce(
114
+ (acc, date) => {
115
+ if (!unavailableDates?.includes(date)) {
116
+ acc[date] = externalMarkedDates[date];
117
+ }
118
+ return acc;
119
+ },
120
+ {} as typeof externalMarkedDates
121
+ )
122
+ : {};
123
+
124
+ const marked = { ...filteredExternalMarkedDates };
125
+
126
+ if (unavailableDates) {
127
+ unavailableDates.forEach((date) => {
128
+ marked[date] = {
129
+ disabled: true,
130
+ disableTouchEvent: true,
131
+ textColor: "#D1D5DB",
132
+ dotColor: "#D1D5DB",
133
+ };
134
+ });
135
+ }
136
+
137
+ if (filteredExternalMarkedDates) {
138
+ Object.keys(filteredExternalMarkedDates).forEach((date) => {
139
+ marked[date] = {
140
+ ...marked[date],
141
+ disableTouchEvent: true,
142
+ selected: true,
143
+ selectedColor: "#EAE0FF",
144
+ selectedTextColor: "#1F2937",
145
+ };
146
+ });
147
+ }
148
+
149
+ if (!selectionType && selectedDates && selectedDates.length > 0) {
150
+ const firstDate = selectedDates[0];
151
+ if (!unavailableDates?.includes(firstDate)) {
152
+ marked[firstDate] = {
153
+ ...marked[firstDate],
154
+ selected: true,
155
+ selectedColor: "#EAE0FF",
156
+ selectedTextColor: "#1F2937",
157
+ };
158
+ }
159
+ return marked;
160
+ }
161
+
162
+ if (selectionType === "multi-dot") {
163
+ selectedDates.forEach((date) => {
164
+ if (!unavailableDates?.includes(date)) {
165
+ marked[date] = {
166
+ ...marked[date],
167
+ selected: true,
168
+ selectedColor: "#EAE0FF",
169
+ selectedTextColor: "#1F2937",
170
+ };
171
+ }
172
+ });
173
+ return marked;
174
+ }
175
+
176
+ return marked;
177
+ }, [selectedDates, externalMarkedDates, selectionType, unavailableDates]);
178
+
179
+ const mergedTheme = {
180
+ ...defaultTheme,
181
+ ...customTheme,
182
+ };
183
+
184
+ const handlePressArrowLeft = useCallback((subtractMonth: () => void) => {
185
+ subtractMonth();
186
+ }, []);
187
+
188
+ const handlePressArrowRight = useCallback((addMonth: () => void) => {
189
+ addMonth();
190
+ }, []);
191
+
192
+ const handleMonthChange = useCallback((date: DateData) => {
193
+ setCurrentMonth(date.dateString);
194
+ }, []);
195
+
196
+ return (
197
+ <View>
198
+ <Calendar
199
+ current={currentMonth}
200
+ onDayPress={onDayPress}
201
+ onMonthChange={handleMonthChange}
202
+ onPressArrowLeft={handlePressArrowLeft}
203
+ onPressArrowRight={handlePressArrowRight}
204
+ markedDates={markedDates}
205
+ minDate={minDate}
206
+ maxDate={maxDate}
207
+ theme={mergedTheme}
208
+ enableSwipeMonths
209
+ hideExtraDays={false}
210
+ markingType={selectionType}
211
+ firstDay={0}
212
+ renderArrow={(direction) => (
213
+ <View className="items-center border p-400 mb-600 rounded-500 border-chia-400 bg-chia-100">
214
+ {direction === "left" ? (
215
+ <ArrowLeftStroke size={24} className="text-gray-900" />
216
+ ) : (
217
+ <ArrowRightStroke size={24} className="text-gray-900" />
218
+ )}
219
+ </View>
220
+ )}
221
+ renderHeader={(date) => {
222
+ const formattedDate = format(new Date(date), "MMMM yy", {
223
+ locale: ptBR,
224
+ });
225
+ const capitalizedDate =
226
+ formattedDate.charAt(0).toUpperCase() + formattedDate.slice(1);
227
+
228
+ return (
229
+ <View className="items-center translate-y-[-8px]">
230
+ <Typography variant="label_large" weight="700">
231
+ {capitalizedDate}
232
+ </Typography>
233
+ </View>
234
+ );
235
+ }}
236
+ {...rest}
237
+ />
238
+ </View>
239
+ );
240
+ }
241
+
242
+ const NativeWindDatePicker = cssInterop?.(DatePicker, {
243
+ className: {
244
+ target: "style",
245
+ },
246
+ }) as React.ComponentType<DatePickerProps>;
247
+
248
+ NativeWindDatePicker.displayName = "DatePicker";
249
+
250
+ export { NativeWindDatePicker as DatePicker };
@@ -0,0 +1,20 @@
1
+ import { CalendarProps } from "react-native-calendars";
2
+ import { MarkingTypes } from "react-native-calendars/src/types";
3
+
4
+ export interface DatePickerProps extends Omit<CalendarProps, "onDayPress"> {
5
+ onDateSelect?: (
6
+ date: string,
7
+ additionalData?: string[] | { start: string; end: string }
8
+ ) => void;
9
+ initialDate?: string;
10
+ minDate?: string;
11
+ maxDate?: string;
12
+ markedDates?: CalendarProps["markedDates"];
13
+ theme?: CalendarProps["theme"];
14
+ selectionType?: MarkingTypes;
15
+ unavailableDates?: string[];
16
+ selectedDates: string[];
17
+ onSelectedDatesChange: (
18
+ dateOrUpdater: string | ((prev: string[]) => string[])
19
+ ) => void;
20
+ }