@dreamstack-us/kaal 0.0.1 → 0.0.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.
Files changed (134) hide show
  1. package/lib/module/components/CalendarGrid/CalendarGrid.js +47 -13
  2. package/lib/module/components/CalendarGrid/CalendarGrid.js.map +1 -1
  3. package/lib/module/components/CalendarGrid/CalendarGrid.styles.js +22 -17
  4. package/lib/module/components/CalendarGrid/CalendarGrid.styles.js.map +1 -1
  5. package/lib/module/components/CalendarGrid/CalendarGrid.web.js +203 -0
  6. package/lib/module/components/CalendarGrid/CalendarGrid.web.js.map +1 -0
  7. package/lib/module/components/CalendarGrid/DayCell.js +64 -52
  8. package/lib/module/components/CalendarGrid/DayCell.js.map +1 -1
  9. package/lib/module/components/CalendarGrid/DayCell.web.js +112 -0
  10. package/lib/module/components/CalendarGrid/DayCell.web.js.map +1 -0
  11. package/lib/module/components/CalendarGrid/index.js +1 -1
  12. package/lib/module/components/CalendarGrid/index.js.map +1 -1
  13. package/lib/module/components/DatePicker/DatePicker.android.js +17 -8
  14. package/lib/module/components/DatePicker/DatePicker.android.js.map +1 -1
  15. package/lib/module/components/DatePicker/DatePicker.ios.js +17 -8
  16. package/lib/module/components/DatePicker/DatePicker.ios.js.map +1 -1
  17. package/lib/module/components/DatePicker/DatePicker.js.map +1 -1
  18. package/lib/module/components/DatePicker/DatePicker.styles.js +19 -20
  19. package/lib/module/components/DatePicker/DatePicker.styles.js.map +1 -1
  20. package/lib/module/components/DatePicker/DatePicker.web.js +26 -12
  21. package/lib/module/components/DatePicker/DatePicker.web.js.map +1 -1
  22. package/lib/module/components/TimePicker/ClockFace.js +27 -7
  23. package/lib/module/components/TimePicker/ClockFace.js.map +1 -1
  24. package/lib/module/components/TimePicker/ClockFace.web.js +253 -0
  25. package/lib/module/components/TimePicker/ClockFace.web.js.map +1 -0
  26. package/lib/module/components/TimePicker/MaterialTimePicker.js +68 -16
  27. package/lib/module/components/TimePicker/MaterialTimePicker.js.map +1 -1
  28. package/lib/module/components/TimePicker/MaterialTimePicker.web.js +231 -0
  29. package/lib/module/components/TimePicker/MaterialTimePicker.web.js.map +1 -0
  30. package/lib/module/components/TimePicker/TimePicker.android.js +13 -6
  31. package/lib/module/components/TimePicker/TimePicker.android.js.map +1 -1
  32. package/lib/module/components/TimePicker/TimePicker.ios.js +14 -7
  33. package/lib/module/components/TimePicker/TimePicker.ios.js.map +1 -1
  34. package/lib/module/components/TimePicker/TimePicker.styles.js +53 -45
  35. package/lib/module/components/TimePicker/TimePicker.styles.js.map +1 -1
  36. package/lib/module/components/TimePicker/TimePicker.web.js +24 -12
  37. package/lib/module/components/TimePicker/TimePicker.web.js.map +1 -1
  38. package/lib/module/components/TimePicker/TimeWheelPicker.js +45 -10
  39. package/lib/module/components/TimePicker/TimeWheelPicker.js.map +1 -1
  40. package/lib/module/components/TimePicker/TimeWheelPicker.web.js +339 -0
  41. package/lib/module/components/TimePicker/TimeWheelPicker.web.js.map +1 -0
  42. package/lib/module/components/TimePicker/index.js +3 -3
  43. package/lib/module/components/TimePicker/index.js.map +1 -1
  44. package/lib/module/components/WheelPicker/WheelPicker.js +21 -2
  45. package/lib/module/components/WheelPicker/WheelPicker.js.map +1 -1
  46. package/lib/module/components/WheelPicker/WheelPicker.styles.js +13 -8
  47. package/lib/module/components/WheelPicker/WheelPicker.styles.js.map +1 -1
  48. package/lib/module/components/WheelPicker/WheelPicker.web.js +146 -57
  49. package/lib/module/components/WheelPicker/WheelPicker.web.js.map +1 -1
  50. package/lib/module/context/ThemeOverrideContext.js +34 -0
  51. package/lib/module/context/ThemeOverrideContext.js.map +1 -0
  52. package/lib/module/index.js +3 -0
  53. package/lib/module/index.js.map +1 -1
  54. package/lib/module/utils/validation.js +74 -34
  55. package/lib/module/utils/validation.js.map +1 -1
  56. package/lib/typescript/components/CalendarGrid/CalendarGrid.d.ts +9 -0
  57. package/lib/typescript/components/CalendarGrid/CalendarGrid.d.ts.map +1 -1
  58. package/lib/typescript/components/CalendarGrid/CalendarGrid.styles.d.ts +12 -10
  59. package/lib/typescript/components/CalendarGrid/CalendarGrid.styles.d.ts.map +1 -1
  60. package/lib/typescript/components/CalendarGrid/CalendarGrid.web.d.ts +21 -0
  61. package/lib/typescript/components/CalendarGrid/CalendarGrid.web.d.ts.map +1 -0
  62. package/lib/typescript/components/CalendarGrid/DayCell.d.ts.map +1 -1
  63. package/lib/typescript/components/CalendarGrid/DayCell.web.d.ts +12 -0
  64. package/lib/typescript/components/CalendarGrid/DayCell.web.d.ts.map +1 -0
  65. package/lib/typescript/components/DatePicker/DatePicker.android.d.ts.map +1 -1
  66. package/lib/typescript/components/DatePicker/DatePicker.d.ts +12 -1
  67. package/lib/typescript/components/DatePicker/DatePicker.d.ts.map +1 -1
  68. package/lib/typescript/components/DatePicker/DatePicker.ios.d.ts.map +1 -1
  69. package/lib/typescript/components/DatePicker/DatePicker.styles.d.ts +12 -13
  70. package/lib/typescript/components/DatePicker/DatePicker.styles.d.ts.map +1 -1
  71. package/lib/typescript/components/DatePicker/DatePicker.web.d.ts.map +1 -1
  72. package/lib/typescript/components/TimePicker/ClockFace.d.ts.map +1 -1
  73. package/lib/typescript/components/TimePicker/ClockFace.web.d.ts +12 -0
  74. package/lib/typescript/components/TimePicker/ClockFace.web.d.ts.map +1 -0
  75. package/lib/typescript/components/TimePicker/MaterialTimePicker.d.ts.map +1 -1
  76. package/lib/typescript/components/TimePicker/MaterialTimePicker.web.d.ts +12 -0
  77. package/lib/typescript/components/TimePicker/MaterialTimePicker.web.d.ts.map +1 -0
  78. package/lib/typescript/components/TimePicker/TimePicker.android.d.ts.map +1 -1
  79. package/lib/typescript/components/TimePicker/TimePicker.ios.d.ts.map +1 -1
  80. package/lib/typescript/components/TimePicker/TimePicker.styles.d.ts +29 -25
  81. package/lib/typescript/components/TimePicker/TimePicker.styles.d.ts.map +1 -1
  82. package/lib/typescript/components/TimePicker/TimePicker.web.d.ts.map +1 -1
  83. package/lib/typescript/components/TimePicker/TimeWheelPicker.d.ts.map +1 -1
  84. package/lib/typescript/components/TimePicker/TimeWheelPicker.web.d.ts +11 -0
  85. package/lib/typescript/components/TimePicker/TimeWheelPicker.web.d.ts.map +1 -0
  86. package/lib/typescript/components/WheelPicker/WheelPicker.d.ts +14 -1
  87. package/lib/typescript/components/WheelPicker/WheelPicker.d.ts.map +1 -1
  88. package/lib/typescript/components/WheelPicker/WheelPicker.styles.d.ts +9 -7
  89. package/lib/typescript/components/WheelPicker/WheelPicker.styles.d.ts.map +1 -1
  90. package/lib/typescript/components/WheelPicker/WheelPicker.web.d.ts.map +1 -1
  91. package/lib/typescript/context/ThemeOverrideContext.d.ts +23 -0
  92. package/lib/typescript/context/ThemeOverrideContext.d.ts.map +1 -0
  93. package/lib/typescript/index.d.ts +4 -2
  94. package/lib/typescript/index.d.ts.map +1 -1
  95. package/lib/typescript/types/datepicker.d.ts +41 -0
  96. package/lib/typescript/types/datepicker.d.ts.map +1 -1
  97. package/lib/typescript/types/timepicker.d.ts +62 -0
  98. package/lib/typescript/types/timepicker.d.ts.map +1 -1
  99. package/lib/typescript/utils/validation.d.ts +47 -27
  100. package/lib/typescript/utils/validation.d.ts.map +1 -1
  101. package/package.json +8 -8
  102. package/src/components/CalendarGrid/CalendarGrid.styles.ts +21 -17
  103. package/src/components/CalendarGrid/CalendarGrid.tsx +98 -12
  104. package/src/components/CalendarGrid/CalendarGrid.web.tsx +305 -0
  105. package/src/components/CalendarGrid/DayCell.tsx +78 -59
  106. package/src/components/CalendarGrid/DayCell.web.tsx +129 -0
  107. package/src/components/DatePicker/DatePicker.android.tsx +14 -8
  108. package/src/components/DatePicker/DatePicker.ios.tsx +14 -8
  109. package/src/components/DatePicker/DatePicker.styles.ts +18 -22
  110. package/src/components/DatePicker/DatePicker.tsx +12 -1
  111. package/src/components/DatePicker/DatePicker.web.tsx +21 -13
  112. package/src/components/TimePicker/ClockFace.tsx +34 -8
  113. package/src/components/TimePicker/ClockFace.web.tsx +303 -0
  114. package/src/components/TimePicker/MaterialTimePicker.tsx +144 -13
  115. package/src/components/TimePicker/MaterialTimePicker.web.tsx +271 -0
  116. package/src/components/TimePicker/TimePicker.android.tsx +9 -1
  117. package/src/components/TimePicker/TimePicker.ios.tsx +10 -6
  118. package/src/components/TimePicker/TimePicker.styles.ts +52 -45
  119. package/src/components/TimePicker/TimePicker.web.tsx +17 -7
  120. package/src/components/TimePicker/TimeWheelPicker.tsx +60 -6
  121. package/src/components/TimePicker/TimeWheelPicker.web.tsx +401 -0
  122. package/src/components/WheelPicker/WheelPicker.styles.ts +12 -8
  123. package/src/components/WheelPicker/WheelPicker.tsx +24 -2
  124. package/src/components/WheelPicker/WheelPicker.web.tsx +153 -57
  125. package/src/context/ThemeOverrideContext.tsx +38 -0
  126. package/src/index.ts +11 -0
  127. package/src/types/datepicker.ts +44 -0
  128. package/src/types/timepicker.ts +74 -0
  129. package/src/utils/validation.ts +111 -55
  130. package/lib/module/unistyles.js +0 -9
  131. package/lib/module/unistyles.js.map +0 -1
  132. package/lib/typescript/unistyles.d.ts +0 -3
  133. package/lib/typescript/unistyles.d.ts.map +0 -1
  134. package/src/unistyles.ts +0 -6
@@ -15,6 +15,66 @@ export type TimePickerTheme = 'native' | 'ios' | 'android';
15
15
  * Minute interval options for time selection
16
16
  */
17
17
  export type MinuteInterval = 1 | 5 | 10 | 15 | 30;
18
+ /**
19
+ * Theme overrides for TimePicker components.
20
+ * These allow customizing colors without matching Kaal's internal theme structure.
21
+ */
22
+ export interface TimePickerThemeOverrides {
23
+ /** Background color of the clock face */
24
+ clockBackground?: string;
25
+ /** Color of the clock hand */
26
+ clockHandColor?: string;
27
+ /** Color of clock numbers */
28
+ clockTextColor?: string;
29
+ /** Color of selected clock number */
30
+ clockTextSelectedColor?: string;
31
+ /** Color of the center dot */
32
+ clockCenterColor?: string;
33
+ /** Color of the selection dot on clock edge */
34
+ clockSelectionColor?: string;
35
+ /** Background color of period buttons */
36
+ periodBackground?: string;
37
+ /** Background color of active period button */
38
+ periodActiveBackground?: string;
39
+ /** Border color of period buttons */
40
+ periodBorderColor?: string;
41
+ /** Text color of period buttons */
42
+ periodTextColor?: string;
43
+ /** Text color of active period button */
44
+ periodTextActiveColor?: string;
45
+ /** Background color of time fields */
46
+ timeFieldBackground?: string;
47
+ /** Background color of active time field */
48
+ timeFieldActiveBackground?: string;
49
+ /** Text color of time fields */
50
+ textColor?: string;
51
+ /** Text color of active time field */
52
+ textActiveColor?: string;
53
+ /** Color of the colon separator */
54
+ separatorColor?: string;
55
+ /** Background color of wheel picker */
56
+ wheelContainerBackground?: string;
57
+ /** Color of wheel selection highlight */
58
+ wheelSelectionHighlight?: string;
59
+ /** Color of wheel separator */
60
+ wheelSeparatorColor?: string;
61
+ /** Text color in wheel */
62
+ wheelTextColor?: string;
63
+ /** Text color of selected wheel item */
64
+ wheelTextSelectedColor?: string;
65
+ /** Container background color */
66
+ containerBackground?: string;
67
+ /** Header text color */
68
+ headerColor?: string;
69
+ /** Action button text color */
70
+ actionButtonColor?: string;
71
+ /** Primary accent color */
72
+ primaryColor?: string;
73
+ /** Border radius for container */
74
+ borderRadius?: number;
75
+ /** Generic background color (fallback for all container backgrounds) */
76
+ backgroundColor?: string;
77
+ }
18
78
  /**
19
79
  * Props for the TimePicker component
20
80
  */
@@ -33,6 +93,8 @@ export interface TimePickerProps {
33
93
  minTime?: TimeValue;
34
94
  /** Maximum selectable time */
35
95
  maxTime?: TimeValue;
96
+ /** Custom theme overrides for styling without matching Kaal's theme structure */
97
+ themeOverrides?: TimePickerThemeOverrides;
36
98
  }
37
99
  /**
38
100
  * Period indicator for 12-hour format
@@ -1 +1 @@
1
- {"version":3,"file":"timepicker.d.ts","sourceRoot":"","sources":["../../../src/types/timepicker.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAE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IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,+BAA+B;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAG3B,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kCAAkC;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,wEAAwE;IACxE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,yBAAyB;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,iCAAiC;IACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;IACpC,qDAAqD;IACrD,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,oCAAoC;IACpC,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,uDAAuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,iFAAiF;IACjF,cAAc,CAAC,EAAE,wBAAwB,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,CAAC;AAErC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,eAAe;IACf,MAAM,EAAE,UAAU,CAAC;CACpB"}
@@ -1,40 +1,60 @@
1
- import * as v from 'valibot';
2
1
  /**
3
- * Validates an ISO 8601 date string (YYYY-MM-DD)
2
+ * Simple validation utilities for date/time pickers
3
+ * No external dependencies - just inline checks
4
4
  */
5
- export declare const isoDateSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>;
6
5
  /**
7
- * Validates an ISO 8601 datetime string with timezone offset
6
+ * Validates an ISO 8601 date string (YYYY-MM-DD)
8
7
  */
9
- export declare const isoDateTimeSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.IsoTimestampAction<string, undefined>]>;
8
+ export declare function isValidISODate(value: string): boolean;
10
9
  /**
11
- * Validates a date range where start <= end
10
+ * Validates an ISO 8601 datetime string
12
11
  */
13
- export declare const dateRangeSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
14
- readonly start: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>;
15
- readonly end: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>;
16
- }, undefined>, v.CheckAction<{
17
- start: string;
18
- end: string;
19
- }, "Start date must be before or equal to end date">]>;
12
+ export declare function isValidISODateTime(value: string): boolean;
20
13
  /**
21
- * Validates date picker configuration
14
+ * Validates a time value (24-hour format)
22
15
  */
23
- export declare const datePickerValueSchema: v.ObjectSchema<{
24
- readonly selectedDate: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>;
25
- readonly minDate: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>, undefined>;
26
- readonly maxDate: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>, undefined>;
27
- readonly disabledDates: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.CheckAction<string, "Invalid ISO 8601 date format">]>, undefined>, undefined>;
28
- }, undefined>;
16
+ export declare function isValidTime(hours: number, minutes: number): boolean;
29
17
  /**
30
- * Parses an ISO date string to a Date object
31
- * @deprecated Use parseISODate from date utils instead. Kept for backward compatibility.
18
+ * Validates a date range where start <= end
32
19
  */
33
- export declare const dateSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.TransformAction<string, Date>]>;
20
+ export declare function isValidDateRange(start: string, end: string): boolean;
34
21
  /**
35
- * @deprecated Alias for dateSchema for backward compatibility
22
+ * Parses an ISO date string to a Date object
23
+ * Returns null if invalid
36
24
  */
37
- export declare const temporalDateSchema: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Must be in YYYY-MM-DD format">, v.TransformAction<string, Date>]>;
38
- export type DatePickerValue = v.InferOutput<typeof datePickerValueSchema>;
39
- export type DateRange = v.InferOutput<typeof dateRangeSchema>;
25
+ export declare function parseISODateSafe(value: string): Date | null;
26
+ export interface DatePickerValue {
27
+ selectedDate: string;
28
+ minDate?: string;
29
+ maxDate?: string;
30
+ disabledDates?: string[];
31
+ }
32
+ export interface DateRange {
33
+ start: string;
34
+ end: string;
35
+ }
36
+ /** @deprecated Use isValidISODate() instead */
37
+ export declare const isoDateSchema: {
38
+ parse: (value: string) => string;
39
+ };
40
+ /** @deprecated Use isValidISODateTime() instead */
41
+ export declare const isoDateTimeSchema: {
42
+ parse: (value: string) => string;
43
+ };
44
+ /** @deprecated Use isValidDateRange() instead */
45
+ export declare const dateRangeSchema: {
46
+ parse: (value: DateRange) => DateRange;
47
+ };
48
+ /** @deprecated Use DatePickerValue type instead */
49
+ export declare const datePickerValueSchema: {
50
+ parse: (value: DatePickerValue) => DatePickerValue;
51
+ };
52
+ /** @deprecated Use parseISODateSafe() instead */
53
+ export declare const dateSchema: {
54
+ parse: (value: string) => Date;
55
+ };
56
+ /** @deprecated Alias for dateSchema */
57
+ export declare const temporalDateSchema: {
58
+ parse: (value: string) => Date;
59
+ };
40
60
  //# sourceMappingURL=validation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,SAAS,CAAC;AAW7B;;GAEG;AACH,eAAO,MAAM,aAAa,sKAYzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,iGAAuC,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,eAAe;;;;;;sDAQ3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;aAKhC,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,UAAU,gJAOtB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,gJAAa,CAAC;AAE7C,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAC1E,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,WAAW,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAerD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAIzD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CASnE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAGpE;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAQ3D;AAGD,MAAM,WAAW,eAAe;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAKD,+CAA+C;AAC/C,eAAO,MAAM,aAAa;mBACT,MAAM;CAItB,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,iBAAiB;mBACb,MAAM;CAItB,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,eAAe;mBACX,SAAS;CAKzB,CAAC;AAEF,mDAAmD;AACnD,eAAO,MAAM,qBAAqB;mBACjB,eAAe;CAC/B,CAAC;AAEF,iDAAiD;AACjD,eAAO,MAAM,UAAU;mBACN,MAAM;CAKtB,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,kBAAkB;mBARd,MAAM;CAQqB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamstack-us/kaal",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "High-performance React Native DatePicker with Unistyles v3",
5
5
  "type": "module",
6
6
  "main": "./lib/module/index.js",
@@ -29,9 +29,7 @@
29
29
  "clean": "rm -rf lib",
30
30
  "size": "size-limit"
31
31
  },
32
- "dependencies": {
33
- "valibot": "^1.0.0"
34
- },
32
+ "dependencies": {},
35
33
  "peerDependencies": {
36
34
  "react": ">=18.2.0",
37
35
  "react-native": ">=0.78.0",
@@ -39,15 +37,18 @@
39
37
  "react-native-nitro-modules": "0.31.4",
40
38
  "react-native-reanimated": ">=3.17.0",
41
39
  "react-native-gesture-handler": ">=2.20.0",
42
- "react-native-svg": ">=13.0.0"
40
+ "react-native-svg": ">=13.0.0",
41
+ "@dreamstack-us/kaal-themes": ">=1.0.0"
43
42
  },
44
43
  "peerDependenciesMeta": {
45
44
  "@expo/ui": {
46
45
  "optional": true
46
+ },
47
+ "@dreamstack-us/kaal-themes": {
48
+ "optional": true
47
49
  }
48
50
  },
49
51
  "devDependencies": {
50
- "@dreamstack-us/kaal-themes": "workspace:*",
51
52
  "@types/react": "^18.3.0",
52
53
  "react": "18.3.1",
53
54
  "react-native": "0.78.0",
@@ -57,8 +58,7 @@
57
58
  "react-native-reanimated": "^3.17.0",
58
59
  "react-native-svg": "^15.15.1",
59
60
  "react-native-unistyles": "^3.0.0",
60
- "typescript": "^5.7.0",
61
- "typescript-config": "workspace:*"
61
+ "typescript": "^5.7.0"
62
62
  },
63
63
  "react-native-builder-bob": {
64
64
  "source": "src",
@@ -1,44 +1,48 @@
1
- import { StyleSheet } from 'react-native-unistyles';
1
+ import { StyleSheet } from 'react-native';
2
2
 
3
- export const styles = StyleSheet.create((theme) => ({
3
+ /**
4
+ * Default styles for CalendarGrid using plain React Native StyleSheet.
5
+ * Colors use dark theme defaults - consumers override via themeOverrides prop.
6
+ */
7
+ export const styles = StyleSheet.create({
4
8
  container: {
5
- backgroundColor: theme.colors.background.default,
6
- borderRadius: theme.radii.card,
7
- padding: theme.spacing(4),
9
+ backgroundColor: '#1E1E1E',
10
+ borderRadius: 16,
11
+ padding: 16,
8
12
  },
9
13
  header: {
10
14
  flexDirection: 'row',
11
15
  justifyContent: 'space-between',
12
16
  alignItems: 'center',
13
- marginBottom: theme.spacing(4),
14
- paddingHorizontal: theme.spacing(2),
17
+ marginBottom: 16,
18
+ paddingHorizontal: 8,
15
19
  },
16
20
  navButton: {
17
21
  width: 40,
18
22
  height: 40,
19
23
  justifyContent: 'center',
20
24
  alignItems: 'center',
21
- borderRadius: theme.radii.button,
25
+ borderRadius: 8,
22
26
  },
23
27
  navText: {
24
28
  fontSize: 24,
25
- color: theme.colors.primary.default,
29
+ color: '#4DA6FF',
26
30
  fontWeight: '600',
27
31
  },
28
32
  monthTitle: {
29
- fontSize: theme.typography.monthHeader.fontSize,
30
- fontWeight: theme.typography.monthHeader.fontWeight,
31
- color: theme.colors.foreground.default,
33
+ fontSize: 17,
34
+ fontWeight: '600',
35
+ color: '#FFFFFF',
32
36
  },
33
37
  weekDays: {
34
38
  flexDirection: 'row',
35
- marginBottom: theme.spacing(2),
39
+ marginBottom: 8,
36
40
  },
37
41
  weekDayText: {
38
42
  flex: 1,
39
43
  textAlign: 'center',
40
- fontSize: theme.typography.dayHeader.fontSize,
41
- fontWeight: theme.typography.dayHeader.fontWeight,
42
- color: theme.colors.foreground.muted,
44
+ fontSize: 13,
45
+ fontWeight: '500',
46
+ color: '#8E8E93',
43
47
  },
44
- }));
48
+ });
@@ -1,5 +1,6 @@
1
1
  import React, { memo, useCallback, useMemo } from 'react';
2
2
  import { FlatList, Pressable, Text, View } from 'react-native';
3
+ import { useDatePickerOverrides } from '../../context/ThemeOverrideContext';
3
4
  import {
4
5
  addMonths,
5
6
  compareDates,
@@ -20,16 +21,60 @@ interface CalendarGridProps {
20
21
  maxDate?: Date;
21
22
  disabledDates?: Date[];
22
23
  themeMode: 'ios' | 'android' | 'custom';
24
+ /**
25
+ * First day of the week: 0 = Sunday, 1 = Monday
26
+ * @default 0 (Sunday)
27
+ *
28
+ * TODO: This is a temporary solution. In the future, we need to add full
29
+ * locale support to handle different calendar formats, layouts, and
30
+ * localized day/month names across different regions.
31
+ */
32
+ weekStartsOn?: 0 | 1;
23
33
  }
24
34
 
25
35
  const CELL_SIZE = 44;
26
- const WEEK_DAYS = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
27
36
 
28
- const generateMonthDays = (currentMonth: Date): (Date | null)[] => {
37
+ // Week day labels starting from Sunday
38
+ const WEEK_DAYS_SUNDAY_START = [
39
+ 'Sun',
40
+ 'Mon',
41
+ 'Tue',
42
+ 'Wed',
43
+ 'Thu',
44
+ 'Fri',
45
+ 'Sat',
46
+ ];
47
+ const WEEK_DAYS_MONDAY_START = [
48
+ 'Mon',
49
+ 'Tue',
50
+ 'Wed',
51
+ 'Thu',
52
+ 'Fri',
53
+ 'Sat',
54
+ 'Sun',
55
+ ];
56
+
57
+ /**
58
+ * Generate padding days for the month grid based on week start day
59
+ * TODO: This logic should be refactored when adding locale support
60
+ */
61
+ const generateMonthDays = (
62
+ currentMonth: Date,
63
+ weekStartsOn: 0 | 1,
64
+ ): (Date | null)[] => {
29
65
  const firstDay = getFirstDayOfMonth(currentMonth);
30
- // getDayOfWeek returns 0 for Sunday, we want Monday = 0
31
- const startOfWeek = getDayOfWeek(firstDay);
32
- const paddingDays = startOfWeek === 0 ? 6 : startOfWeek - 1;
66
+ // getDayOfWeek returns 0 for Sunday, 1 for Monday, etc.
67
+ const dayOfWeek = getDayOfWeek(firstDay);
68
+
69
+ // Calculate padding days based on week start
70
+ let paddingDays: number;
71
+ if (weekStartsOn === 0) {
72
+ // Sunday start: Sunday = 0 padding, Monday = 1, etc.
73
+ paddingDays = dayOfWeek;
74
+ } else {
75
+ // Monday start: Monday = 0 padding, Sunday = 6 padding
76
+ paddingDays = dayOfWeek === 0 ? 6 : dayOfWeek - 1;
77
+ }
33
78
 
34
79
  const days: (Date | null)[] = [];
35
80
 
@@ -56,12 +101,27 @@ const generateMonthDays = (currentMonth: Date): (Date | null)[] => {
56
101
  };
57
102
 
58
103
  export const CalendarGrid: React.FC<CalendarGridProps> = memo(
59
- ({ value, onChange, minDate, maxDate, disabledDates, themeMode }) => {
104
+ ({
105
+ value,
106
+ onChange,
107
+ minDate,
108
+ maxDate,
109
+ disabledDates,
110
+ themeMode,
111
+ weekStartsOn = 0,
112
+ }) => {
113
+ const overrides = useDatePickerOverrides();
60
114
  const [currentMonth, setCurrentMonth] = React.useState(() =>
61
115
  getFirstDayOfMonth(value),
62
116
  );
63
117
 
64
- const days = useMemo(() => generateMonthDays(currentMonth), [currentMonth]);
118
+ const days = useMemo(
119
+ () => generateMonthDays(currentMonth, weekStartsOn),
120
+ [currentMonth, weekStartsOn],
121
+ );
122
+
123
+ const weekDays =
124
+ weekStartsOn === 0 ? WEEK_DAYS_SUNDAY_START : WEEK_DAYS_MONDAY_START;
65
125
 
66
126
  const todayDate = useMemo(() => today(), []);
67
127
 
@@ -111,20 +171,46 @@ export const CalendarGrid: React.FC<CalendarGridProps> = memo(
111
171
  [],
112
172
  );
113
173
 
174
+ // Build override styles from themeOverrides
175
+ const containerStyle = useMemo(
176
+ () => ({
177
+ backgroundColor: overrides?.backgroundColor ?? '#1E1E1E',
178
+ borderRadius: overrides?.borderRadius ?? 16,
179
+ padding: overrides?.padding ?? 16,
180
+ }),
181
+ [overrides],
182
+ );
183
+
184
+ const navTextStyle = useMemo(
185
+ () => ({
186
+ color: overrides?.primaryColor ?? '#4DA6FF',
187
+ }),
188
+ [overrides],
189
+ );
190
+
191
+ const monthTitleStyle = useMemo(
192
+ () => ({
193
+ color: overrides?.textColor ?? '#FFFFFF',
194
+ }),
195
+ [overrides],
196
+ );
197
+
114
198
  return (
115
- <View style={styles.container}>
199
+ <View style={[styles.container, containerStyle]}>
116
200
  <View style={styles.header}>
117
201
  <Pressable onPress={() => navigateMonth(-1)} style={styles.navButton}>
118
- <Text style={styles.navText}>‹</Text>
202
+ <Text style={[styles.navText, navTextStyle]}>‹</Text>
119
203
  </Pressable>
120
- <Text style={styles.monthTitle}>{formatYearMonth(currentMonth)}</Text>
204
+ <Text style={[styles.monthTitle, monthTitleStyle]}>
205
+ {formatYearMonth(currentMonth)}
206
+ </Text>
121
207
  <Pressable onPress={() => navigateMonth(1)} style={styles.navButton}>
122
- <Text style={styles.navText}>›</Text>
208
+ <Text style={[styles.navText, navTextStyle]}>›</Text>
123
209
  </Pressable>
124
210
  </View>
125
211
 
126
212
  <View style={styles.weekDays}>
127
- {WEEK_DAYS.map((day) => (
213
+ {weekDays.map((day) => (
128
214
  <Text key={day} style={styles.weekDayText}>
129
215
  {day}
130
216
  </Text>