react-native-ruler-date-picker 0.1.0 → 0.2.0

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 (220) hide show
  1. package/README.md +186 -60
  2. package/lib/commonjs/LensTick.js +83 -0
  3. package/lib/commonjs/LensTick.js.map +1 -0
  4. package/lib/commonjs/Ruler.js +38 -0
  5. package/lib/commonjs/Ruler.js.map +1 -0
  6. package/lib/commonjs/RulerContext.js +17 -0
  7. package/lib/commonjs/RulerContext.js.map +1 -0
  8. package/lib/commonjs/RulerDatePicker.js +38 -351
  9. package/lib/commonjs/RulerDatePicker.js.map +1 -1
  10. package/lib/commonjs/RulerDateRangePicker.js +56 -0
  11. package/lib/commonjs/RulerDateRangePicker.js.map +1 -0
  12. package/lib/commonjs/RulerHeader.js +106 -0
  13. package/lib/commonjs/RulerHeader.js.map +1 -0
  14. package/lib/commonjs/RulerIndicator.js +67 -0
  15. package/lib/commonjs/RulerIndicator.js.map +1 -0
  16. package/lib/commonjs/RulerLensTicks.js +55 -0
  17. package/lib/commonjs/RulerLensTicks.js.map +1 -0
  18. package/lib/commonjs/RulerLensTrack.js +52 -0
  19. package/lib/commonjs/RulerLensTrack.js.map +1 -0
  20. package/lib/commonjs/RulerRange.js +39 -0
  21. package/lib/commonjs/RulerRange.js.map +1 -0
  22. package/lib/commonjs/RulerRangeContext.js +17 -0
  23. package/lib/commonjs/RulerRangeContext.js.map +1 -0
  24. package/lib/commonjs/RulerRangeHeader.js +154 -0
  25. package/lib/commonjs/RulerRangeHeader.js.map +1 -0
  26. package/lib/commonjs/RulerRangeHighlight.js +50 -0
  27. package/lib/commonjs/RulerRangeHighlight.js.map +1 -0
  28. package/lib/commonjs/RulerRangeIndicator.js +71 -0
  29. package/lib/commonjs/RulerRangeIndicator.js.map +1 -0
  30. package/lib/commonjs/RulerRangeRoot.js +80 -0
  31. package/lib/commonjs/RulerRangeRoot.js.map +1 -0
  32. package/lib/commonjs/RulerRangeTicks.js +57 -0
  33. package/lib/commonjs/RulerRangeTicks.js.map +1 -0
  34. package/lib/commonjs/RulerRangeTrack.js +46 -0
  35. package/lib/commonjs/RulerRangeTrack.js.map +1 -0
  36. package/lib/commonjs/RulerResetButton.js +46 -0
  37. package/lib/commonjs/RulerResetButton.js.map +1 -0
  38. package/lib/commonjs/RulerRoot.js +87 -0
  39. package/lib/commonjs/RulerRoot.js.map +1 -0
  40. package/lib/commonjs/RulerTicks.js +51 -0
  41. package/lib/commonjs/RulerTicks.js.map +1 -0
  42. package/lib/commonjs/RulerTrack.js +46 -0
  43. package/lib/commonjs/RulerTrack.js.map +1 -0
  44. package/lib/commonjs/Tick.js +41 -36
  45. package/lib/commonjs/Tick.js.map +1 -1
  46. package/lib/commonjs/defaults.js +20 -19
  47. package/lib/commonjs/defaults.js.map +1 -1
  48. package/lib/commonjs/index.js +287 -1
  49. package/lib/commonjs/index.js.map +1 -1
  50. package/lib/commonjs/presets.js +108 -0
  51. package/lib/commonjs/presets.js.map +1 -0
  52. package/lib/commonjs/tickResolver.js +101 -0
  53. package/lib/commonjs/tickResolver.js.map +1 -0
  54. package/lib/commonjs/useHaptics.js +1 -1
  55. package/lib/commonjs/useHaptics.web.js +43 -0
  56. package/lib/commonjs/useHaptics.web.js.map +1 -0
  57. package/lib/commonjs/useRulerDatePicker.js +264 -0
  58. package/lib/commonjs/useRulerDatePicker.js.map +1 -0
  59. package/lib/commonjs/useRulerDateRangePicker.js +313 -0
  60. package/lib/commonjs/useRulerDateRangePicker.js.map +1 -0
  61. package/lib/commonjs/utils.js +61 -47
  62. package/lib/commonjs/utils.js.map +1 -1
  63. package/lib/module/LensTick.js +77 -0
  64. package/lib/module/LensTick.js.map +1 -0
  65. package/lib/module/Ruler.js +35 -0
  66. package/lib/module/Ruler.js.map +1 -0
  67. package/lib/module/RulerContext.js +12 -0
  68. package/lib/module/RulerContext.js.map +1 -0
  69. package/lib/module/RulerDatePicker.js +38 -350
  70. package/lib/module/RulerDatePicker.js.map +1 -1
  71. package/lib/module/RulerDateRangePicker.js +52 -0
  72. package/lib/module/RulerDateRangePicker.js.map +1 -0
  73. package/lib/module/RulerHeader.js +101 -0
  74. package/lib/module/RulerHeader.js.map +1 -0
  75. package/lib/module/RulerIndicator.js +62 -0
  76. package/lib/module/RulerIndicator.js.map +1 -0
  77. package/lib/module/RulerLensTicks.js +50 -0
  78. package/lib/module/RulerLensTicks.js.map +1 -0
  79. package/lib/module/RulerLensTrack.js +47 -0
  80. package/lib/module/RulerLensTrack.js.map +1 -0
  81. package/lib/module/RulerRange.js +36 -0
  82. package/lib/module/RulerRange.js.map +1 -0
  83. package/lib/module/RulerRangeContext.js +12 -0
  84. package/lib/module/RulerRangeContext.js.map +1 -0
  85. package/lib/module/RulerRangeHeader.js +149 -0
  86. package/lib/module/RulerRangeHeader.js.map +1 -0
  87. package/lib/module/RulerRangeHighlight.js +45 -0
  88. package/lib/module/RulerRangeHighlight.js.map +1 -0
  89. package/lib/module/RulerRangeIndicator.js +66 -0
  90. package/lib/module/RulerRangeIndicator.js.map +1 -0
  91. package/lib/module/RulerRangeRoot.js +75 -0
  92. package/lib/module/RulerRangeRoot.js.map +1 -0
  93. package/lib/module/RulerRangeTicks.js +51 -0
  94. package/lib/module/RulerRangeTicks.js.map +1 -0
  95. package/lib/module/RulerRangeTrack.js +41 -0
  96. package/lib/module/RulerRangeTrack.js.map +1 -0
  97. package/lib/module/RulerResetButton.js +41 -0
  98. package/lib/module/RulerResetButton.js.map +1 -0
  99. package/lib/module/RulerRoot.js +82 -0
  100. package/lib/module/RulerRoot.js.map +1 -0
  101. package/lib/module/RulerTicks.js +45 -0
  102. package/lib/module/RulerTicks.js.map +1 -0
  103. package/lib/module/RulerTrack.js +41 -0
  104. package/lib/module/RulerTrack.js.map +1 -0
  105. package/lib/module/Tick.js +41 -36
  106. package/lib/module/Tick.js.map +1 -1
  107. package/lib/module/defaults.js +19 -18
  108. package/lib/module/defaults.js.map +1 -1
  109. package/lib/module/index.js +46 -1
  110. package/lib/module/index.js.map +1 -1
  111. package/lib/module/presets.js +103 -0
  112. package/lib/module/presets.js.map +1 -0
  113. package/lib/module/tickResolver.js +97 -0
  114. package/lib/module/tickResolver.js.map +1 -0
  115. package/lib/module/useHaptics.js +1 -1
  116. package/lib/module/useHaptics.js.map +1 -1
  117. package/lib/module/useHaptics.web.js +39 -0
  118. package/lib/module/useHaptics.web.js.map +1 -0
  119. package/lib/module/useRulerDatePicker.js +260 -0
  120. package/lib/module/useRulerDatePicker.js.map +1 -0
  121. package/lib/module/useRulerDateRangePicker.js +310 -0
  122. package/lib/module/useRulerDateRangePicker.js.map +1 -0
  123. package/lib/module/utils.js +59 -45
  124. package/lib/module/utils.js.map +1 -1
  125. package/lib/typescript/LensTick.d.ts +20 -0
  126. package/lib/typescript/LensTick.d.ts.map +1 -0
  127. package/lib/typescript/Ruler.d.ts +31 -0
  128. package/lib/typescript/Ruler.d.ts.map +1 -0
  129. package/lib/typescript/RulerContext.d.ts +11 -0
  130. package/lib/typescript/RulerContext.d.ts.map +1 -0
  131. package/lib/typescript/RulerDatePicker.d.ts +10 -7
  132. package/lib/typescript/RulerDatePicker.d.ts.map +1 -1
  133. package/lib/typescript/RulerDateRangePicker.d.ts +26 -0
  134. package/lib/typescript/RulerDateRangePicker.d.ts.map +1 -0
  135. package/lib/typescript/RulerHeader.d.ts +14 -0
  136. package/lib/typescript/RulerHeader.d.ts.map +1 -0
  137. package/lib/typescript/RulerIndicator.d.ts +17 -0
  138. package/lib/typescript/RulerIndicator.d.ts.map +1 -0
  139. package/lib/typescript/RulerLensTicks.d.ts +12 -0
  140. package/lib/typescript/RulerLensTicks.d.ts.map +1 -0
  141. package/lib/typescript/RulerLensTrack.d.ts +13 -0
  142. package/lib/typescript/RulerLensTrack.d.ts.map +1 -0
  143. package/lib/typescript/RulerRange.d.ts +32 -0
  144. package/lib/typescript/RulerRange.d.ts.map +1 -0
  145. package/lib/typescript/RulerRangeContext.d.ts +11 -0
  146. package/lib/typescript/RulerRangeContext.d.ts.map +1 -0
  147. package/lib/typescript/RulerRangeHeader.d.ts +12 -0
  148. package/lib/typescript/RulerRangeHeader.d.ts.map +1 -0
  149. package/lib/typescript/RulerRangeHighlight.d.ts +8 -0
  150. package/lib/typescript/RulerRangeHighlight.d.ts.map +1 -0
  151. package/lib/typescript/RulerRangeIndicator.d.ts +17 -0
  152. package/lib/typescript/RulerRangeIndicator.d.ts.map +1 -0
  153. package/lib/typescript/RulerRangeRoot.d.ts +7 -0
  154. package/lib/typescript/RulerRangeRoot.d.ts.map +1 -0
  155. package/lib/typescript/RulerRangeTicks.d.ts +14 -0
  156. package/lib/typescript/RulerRangeTicks.d.ts.map +1 -0
  157. package/lib/typescript/RulerRangeTrack.d.ts +8 -0
  158. package/lib/typescript/RulerRangeTrack.d.ts.map +1 -0
  159. package/lib/typescript/RulerResetButton.d.ts +10 -0
  160. package/lib/typescript/RulerResetButton.d.ts.map +1 -0
  161. package/lib/typescript/RulerRoot.d.ts +7 -0
  162. package/lib/typescript/RulerRoot.d.ts.map +1 -0
  163. package/lib/typescript/RulerTicks.d.ts +9 -0
  164. package/lib/typescript/RulerTicks.d.ts.map +1 -0
  165. package/lib/typescript/RulerTrack.d.ts +8 -0
  166. package/lib/typescript/RulerTrack.d.ts.map +1 -0
  167. package/lib/typescript/Tick.d.ts +3 -16
  168. package/lib/typescript/Tick.d.ts.map +1 -1
  169. package/lib/typescript/defaults.d.ts +6 -9
  170. package/lib/typescript/defaults.d.ts.map +1 -1
  171. package/lib/typescript/index.d.ts +37 -1
  172. package/lib/typescript/index.d.ts.map +1 -1
  173. package/lib/typescript/presets.d.ts +27 -0
  174. package/lib/typescript/presets.d.ts.map +1 -0
  175. package/lib/typescript/tickResolver.d.ts +10 -0
  176. package/lib/typescript/tickResolver.d.ts.map +1 -0
  177. package/lib/typescript/types.d.ts +302 -85
  178. package/lib/typescript/types.d.ts.map +1 -1
  179. package/lib/typescript/useHaptics.web.d.ts +17 -0
  180. package/lib/typescript/useHaptics.web.d.ts.map +1 -0
  181. package/lib/typescript/useRulerDatePicker.d.ts +26 -0
  182. package/lib/typescript/useRulerDatePicker.d.ts.map +1 -0
  183. package/lib/typescript/useRulerDateRangePicker.d.ts +40 -0
  184. package/lib/typescript/useRulerDateRangePicker.d.ts.map +1 -0
  185. package/lib/typescript/utils.d.ts +14 -12
  186. package/lib/typescript/utils.d.ts.map +1 -1
  187. package/package.json +25 -7
  188. package/src/LensTick.tsx +90 -0
  189. package/src/Ruler.ts +32 -0
  190. package/src/RulerContext.tsx +20 -0
  191. package/src/RulerDatePicker.tsx +41 -439
  192. package/src/RulerDateRangePicker.tsx +53 -0
  193. package/src/RulerHeader.tsx +125 -0
  194. package/src/RulerIndicator.tsx +84 -0
  195. package/src/RulerLensTicks.tsx +50 -0
  196. package/src/RulerLensTrack.tsx +45 -0
  197. package/src/RulerRange.ts +33 -0
  198. package/src/RulerRangeContext.tsx +20 -0
  199. package/src/RulerRangeHeader.tsx +180 -0
  200. package/src/RulerRangeHighlight.tsx +47 -0
  201. package/src/RulerRangeIndicator.tsx +85 -0
  202. package/src/RulerRangeRoot.tsx +87 -0
  203. package/src/RulerRangeTicks.tsx +68 -0
  204. package/src/RulerRangeTrack.tsx +39 -0
  205. package/src/RulerResetButton.tsx +59 -0
  206. package/src/RulerRoot.tsx +93 -0
  207. package/src/RulerTicks.tsx +57 -0
  208. package/src/RulerTrack.tsx +39 -0
  209. package/src/Tick.tsx +60 -49
  210. package/src/defaults.ts +21 -19
  211. package/src/index.ts +83 -1
  212. package/src/presets.ts +108 -0
  213. package/src/tickResolver.ts +123 -0
  214. package/src/types.ts +354 -102
  215. package/src/useHaptics.web.ts +55 -0
  216. package/src/useRulerDatePicker.ts +373 -0
  217. package/src/useRulerDateRangePicker.ts +468 -0
  218. package/src/utils.ts +67 -68
  219. package/lib/commonjs/package.json +0 -1
  220. package/lib/module/package.json +0 -1
@@ -4,373 +4,60 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.RulerDatePicker = RulerDatePicker;
7
- var _react = _interopRequireWildcard(require("react"));
8
- var _reactNative = require("react-native");
9
- var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
10
- var _reactNativeGestureHandler = require("react-native-gesture-handler");
11
- var _defaults = require("./defaults");
12
- var _utils = require("./utils");
13
- var _useHaptics = require("./useHaptics");
14
- var _Tick = require("./Tick");
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _RulerRoot = require("./RulerRoot.js");
9
+ var _RulerHeader = require("./RulerHeader.js");
10
+ var _RulerTrack = require("./RulerTrack.js");
11
+ var _RulerIndicator = require("./RulerIndicator.js");
12
+ var _RulerTicks = require("./RulerTicks.js");
13
+ var _RulerLensTrack = require("./RulerLensTrack.js");
15
14
  var _jsxRuntime = require("react/jsx-runtime");
16
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
17
- const SCREEN_WIDTH = _reactNative.Dimensions.get('window').width;
18
-
15
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
19
16
  /**
20
- * A performant, customizable ruler-style date picker for React Native.
17
+ * A performant, customizable horizontal ruler date picker for React Native & Expo.
21
18
  *
22
19
  * Features:
23
- * - 60 FPS scrolling via Reanimated 3 decay physics + snap alignment
24
- * - Dual-speed haptic feedback engine (discrete ticks vs continuous buzz)
25
- * - Windowed tick rendering for memory efficiency
26
- * - Fully configurable dimensions, colors, and behaviors
20
+ * - 60 FPS scrolling via Reanimated 3 decay physics & snap alignment
21
+ * - Generic, unopinionated Rule-Based Tick System (`TickRule[]`)
22
+ * - Windowed tick rendering for high memory efficiency
23
+ * - Dual-speed haptic feedback (discrete ticks vs continuous buzz)
24
+ * - Non-linear fisheye lens distortion (`lensEffect`)
25
+ * - Automatic Dark/Light mode theme detection
27
26
  *
28
27
  * @example
29
28
  * ```tsx
30
29
  * <RulerDatePicker
31
- * selectedDate={new Date()}
32
- * onSelectDate={(date, dateString) => console.log(dateString)}
30
+ * value={selectedDate}
31
+ * onChange={(date, dateString) => console.log(dateString)}
32
+ * lensEffect
33
33
  * />
34
34
  * ```
35
35
  */
36
36
  function RulerDatePicker(props) {
37
37
  const {
38
- selectedDate,
39
- onSelectDate,
40
- minDate,
41
- maxDate,
42
- labelInterval,
43
- highlightDays,
44
- tickSpacing = _defaults.DEFAULTS.tickSpacing,
45
- tickHeight = _defaults.DEFAULTS.tickHeight,
46
- tickTallHeight = _defaults.DEFAULTS.tickTallHeight,
47
- tickThickness = _defaults.DEFAULTS.tickThickness,
48
- height = _defaults.DEFAULTS.height,
49
- rulerHeight = _defaults.DEFAULTS.rulerHeight,
50
- indicatorWidth = _defaults.DEFAULTS.indicatorWidth,
51
- indicatorHeight = _defaults.DEFAULTS.indicatorHeight,
52
- todayDotSize = _defaults.DEFAULTS.todayDotSize,
53
- labelFontSize = _defaults.DEFAULTS.labelFontSize,
54
- bufferTicks = _defaults.DEFAULTS.bufferTicks,
55
- updateDebounceMs = _defaults.DEFAULTS.updateDebounceMs,
56
- enableHaptics = _defaults.DEFAULTS.enableHaptics,
57
- onHapticTrigger,
58
- fastSwipeTickThreshold = _defaults.DEFAULTS.fastSwipeTickThreshold,
59
- continuousHapticIntervalMs = _defaults.DEFAULTS.continuousHapticIntervalMs,
60
- showResetToToday = _defaults.DEFAULTS.showResetToToday,
61
- renderHeader
38
+ header = true,
39
+ indicator = true,
40
+ lensEffect,
41
+ ...rootProps
62
42
  } = props;
63
43
 
64
- // ── Resolve colors ──────────────────────────────────────────────────────
65
- const colors = (0, _utils.useResolvedColors)(props);
66
-
67
- // ── Haptics ─────────────────────────────────────────────────────────────
68
- const {
69
- fireDiscreteHaptic,
70
- startContinuousHaptic,
71
- stopContinuousHaptic
72
- } = (0, _useHaptics.useHaptics)({
73
- enableHaptics,
74
- onHapticTrigger,
75
- continuousHapticIntervalMs
76
- });
77
-
78
- // ── Reference time (midnight today) ─────────────────────────────────────
79
- const todayTime = (0, _react.useMemo)(() => {
80
- const d = new Date();
81
- d.setHours(0, 0, 0, 0);
82
- return d.getTime();
83
- }, []);
84
-
85
- // ── Date boundaries ─────────────────────────────────────────────────────
86
- const {
87
- minOffset,
88
- maxOffset
89
- } = (0, _react.useMemo)(() => (0, _utils.computeDayRange)(todayTime, minDate, maxDate), [todayTime, minDate, maxDate]);
90
-
91
- // ── Initial offset from today ───────────────────────────────────────────
92
- const initialOffsetDays = (0, _react.useMemo)(() => {
93
- return (0, _utils.dateToDayOffset)(selectedDate, todayTime);
94
- // Intentionally only computed once on mount
95
- // eslint-disable-next-line react-hooks/exhaustive-deps
96
- }, []);
97
- const halfVisible = Math.ceil(SCREEN_WIDTH / 2 / tickSpacing);
98
- const windowSize = halfVisible + bufferTicks;
99
-
100
- // ── Animated values ─────────────────────────────────────────────────────
101
- const translateX = (0, _reactNativeReanimated.useSharedValue)(-initialOffsetDays * tickSpacing);
102
- const contextX = (0, _reactNativeReanimated.useSharedValue)(0);
103
- const previousIndex = (0, _reactNativeReanimated.useSharedValue)(-initialOffsetDays);
104
- const isFastMode = (0, _reactNativeReanimated.useSharedValue)(false);
105
-
106
- // ── State ───────────────────────────────────────────────────────────────
107
- const initialDateStr = (0, _react.useMemo)(() => {
108
- const d = typeof selectedDate === 'string' ? new Date(selectedDate) : new Date(selectedDate);
109
- d.setHours(0, 0, 0, 0);
110
- return (0, _utils.formatDateString)(d);
111
- // eslint-disable-next-line react-hooks/exhaustive-deps
112
- }, []);
113
- const [displayDateStr, setDisplayDateStr] = (0, _react.useState)(initialDateStr);
114
- const debounceTimerRef = (0, _react.useRef)(null);
115
- const [windowCenter, setWindowCenter] = (0, _react.useState)(-initialOffsetDays);
116
-
117
- // ── Visible ticks (windowed rendering) ──────────────────────────────────
118
- const visibleTicks = (0, _react.useMemo)(() => {
119
- const ticks = [];
120
- const start = Math.max(windowCenter - windowSize, minOffset);
121
- const end = Math.min(windowCenter + windowSize, maxOffset);
122
- for (let i = start; i <= end; i++) {
123
- const d = new Date(todayTime + i * _defaults.MS_PER_DAY);
124
- ticks.push({
125
- offset: i,
126
- isLabeled: (0, _utils.shouldShowLabel)(d, labelInterval, todayTime),
127
- isToday: i === 0,
128
- isHighlighted: highlightDays ? highlightDays.includes(d.getDay()) : false,
129
- dateStr: d.getDate().toString()
130
- });
131
- }
132
- return ticks;
133
- }, [windowCenter, windowSize, todayTime, minOffset, maxOffset, labelInterval, highlightDays]);
134
-
135
- // ── Tick change callbacks ───────────────────────────────────────────────
136
-
137
- const onTickChanged = (0, _react.useCallback)((index, enteringFastMode) => {
138
- if (enteringFastMode) {
139
- startContinuousHaptic();
140
- } else {
141
- stopContinuousHaptic();
142
- fireDiscreteHaptic();
143
- }
144
-
145
- // Update display date
146
- const d = (0, _utils.dayOffsetToDate)(index, todayTime);
147
- const dateStr = (0, _utils.formatDateString)(d);
148
- setWindowCenter(prevCenter => {
149
- if (Math.abs(index - prevCenter) >= 5) {
150
- return index;
151
- }
152
- return prevCenter;
153
- });
154
-
155
- // Debounce the heavy onSelectDate callback
156
- if (debounceTimerRef.current) {
157
- clearTimeout(debounceTimerRef.current);
158
- }
159
- debounceTimerRef.current = setTimeout(() => {
160
- onSelectDate(d, dateStr);
161
- }, updateDebounceMs);
162
- }, [todayTime, onSelectDate, updateDebounceMs, startContinuousHaptic, stopContinuousHaptic, fireDiscreteHaptic]);
163
- const onAnimationSettled = (0, _react.useCallback)(index => {
164
- stopContinuousHaptic();
165
- fireDiscreteHaptic();
166
- const d = (0, _utils.dayOffsetToDate)(index, todayTime);
167
- const dateStr = (0, _utils.formatDateString)(d);
168
- setDisplayDateStr(dateStr);
169
- setWindowCenter(index);
170
- onSelectDate(d, dateStr);
171
- }, [todayTime, onSelectDate, stopContinuousHaptic, fireDiscreteHaptic]);
172
-
173
- // ── Animated reaction ───────────────────────────────────────────────────
174
- (0, _reactNativeReanimated.useAnimatedReaction)(() => Math.round(-translateX.value / tickSpacing), (index, prev) => {
175
- if (index !== prev && index >= minOffset && index <= maxOffset) {
176
- previousIndex.value = index;
177
- const ticksSkipped = prev !== null ? Math.abs(index - prev) : 1;
178
- const shouldBeFast = ticksSkipped > fastSwipeTickThreshold;
179
- if (shouldBeFast && !isFastMode.value) {
180
- isFastMode.value = true;
181
- (0, _reactNativeReanimated.runOnJS)(onTickChanged)(index, true);
182
- } else if (!shouldBeFast && isFastMode.value) {
183
- isFastMode.value = false;
184
- (0, _reactNativeReanimated.runOnJS)(onTickChanged)(index, false);
185
- } else if (!shouldBeFast) {
186
- (0, _reactNativeReanimated.runOnJS)(onTickChanged)(index, false);
187
- }
188
- if (shouldBeFast && isFastMode.value) {
189
- (0, _reactNativeReanimated.runOnJS)(onTickChanged)(index, true);
190
- }
191
- }
192
- }, [tickSpacing, minOffset, maxOffset, fastSwipeTickThreshold]);
193
-
194
- // ── Pan gesture ─────────────────────────────────────────────────────────
195
- const pan = _reactNativeGestureHandler.Gesture.Pan().onStart(() => {
196
- contextX.value = translateX.value;
197
- }).onUpdate(event => {
198
- translateX.value = contextX.value + event.translationX;
199
- }).onEnd(event => {
200
- translateX.value = (0, _reactNativeReanimated.withDecay)({
201
- velocity: event.velocityX,
202
- deceleration: 0.99
203
- }, finished => {
204
- if (finished) {
205
- const maxTranslateX = -minOffset * tickSpacing;
206
- const minTranslateX = -maxOffset * tickSpacing;
207
- const clampedX = Math.min(Math.max(translateX.value, minTranslateX), maxTranslateX);
208
- const snappedIndex = Math.round(clampedX / tickSpacing);
209
- const snappedX = snappedIndex * tickSpacing;
210
- translateX.value = (0, _reactNativeReanimated.withTiming)(snappedX, {
211
- duration: 150
212
- }, done => {
213
- if (done) {
214
- isFastMode.value = false;
215
- const index = Math.round(-snappedX / tickSpacing);
216
- (0, _reactNativeReanimated.runOnJS)(onAnimationSettled)(index);
217
- }
218
- });
219
- }
220
- });
221
- });
222
- const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
223
- transform: [{
224
- translateX: translateX.value
225
- }]
226
- }), [translateX]);
227
-
228
- // ── Header ──────────────────────────────────────────────────────────────
229
- const displayDate = new Date(displayDateStr);
230
- const displayFormat = displayDate.toLocaleDateString('en-US', {
231
- weekday: 'long',
232
- month: 'long',
233
- day: 'numeric'
234
- });
235
- const displayYear = displayDate.getFullYear();
236
- const currentYear = new Date().getFullYear();
237
- const showYear = displayYear !== currentYear;
238
- const isTodaySelected = displayDateStr === (0, _utils.formatDateString)(new Date(todayTime));
239
- const handleResetToToday = (0, _react.useCallback)(() => {
240
- stopContinuousHaptic();
241
- translateX.value = (0, _reactNativeReanimated.withTiming)(0, {
242
- duration: 300
243
- });
244
- const todayStr = (0, _utils.formatDateString)(new Date(todayTime));
245
- setDisplayDateStr(todayStr);
246
- setWindowCenter(0);
247
- onSelectDate(new Date(todayTime), todayStr);
248
- }, [todayTime, onSelectDate, stopContinuousHaptic, translateX]);
249
-
250
- // ── Render ──────────────────────────────────────────────────────────────
251
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
252
- style: [styles.container, {
253
- height,
254
- backgroundColor: colors.backgroundColor
255
- }],
256
- children: [renderHeader ? renderHeader(displayDate, isTodaySelected, handleResetToToday) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
257
- style: styles.headerContainer,
258
- children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
259
- style: styles.dateHeader,
260
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
261
- style: [styles.yearText, {
262
- color: colors.labelColor
263
- }],
264
- children: showYear ? displayYear : ''
265
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
266
- style: [styles.dateText, {
267
- color: colors.accentColor
268
- }],
269
- children: displayFormat
270
- })]
271
- }), showResetToToday && !isTodaySelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TouchableOpacity, {
272
- onPress: handleResetToToday,
273
- style: styles.resetBtn,
274
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
275
- style: [styles.resetText, {
276
- color: colors.accentColor
277
- }],
278
- children: "Today"
279
- })
280
- })]
281
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
282
- gesture: pan,
283
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
284
- style: [styles.rulerContainer, {
285
- height: rulerHeight
286
- }],
287
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
288
- style: [styles.centerIndicator, {
289
- backgroundColor: colors.indicatorColor,
290
- width: indicatorWidth,
291
- height: indicatorHeight
292
- }]
293
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
294
- style: [styles.ticksWrapper, animatedStyle],
295
- children: visibleTicks.map(tick => /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tick.Tick, {
296
- offset: tick.offset,
297
- isLabeled: tick.isLabeled,
298
- isToday: tick.isToday,
299
- isHighlighted: tick.isHighlighted,
300
- dateStr: tick.dateStr,
301
- tickSpacing: tickSpacing,
302
- tickHeight: tickHeight,
303
- tickTallHeight: tickTallHeight,
304
- tickThickness: tickThickness,
305
- tickColor: colors.tickColor,
306
- tickTallColor: colors.tickTallColor,
307
- labelColor: colors.labelColor,
308
- accentColor: colors.accentColor,
309
- todayDotSize: todayDotSize,
310
- labelFontSize: labelFontSize,
311
- rulerHeight: rulerHeight
312
- }, tick.offset))
313
- })]
314
- })
44
+ // Resolve Header
45
+ const isHeaderVisible = header !== false;
46
+ const headerConfig = typeof header === 'object' ? header : undefined;
47
+
48
+ // Resolve Indicator
49
+ const isIndicatorVisible = indicator !== false;
50
+ const indicatorConfig = typeof indicator === 'object' ? indicator : undefined;
51
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_RulerRoot.RulerRoot, {
52
+ ...rootProps,
53
+ header: header,
54
+ lensEffect: lensEffect,
55
+ indicator: indicatorConfig,
56
+ children: [isHeaderVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerHeader.RulerHeader, {
57
+ ...headerConfig
58
+ }), lensEffect ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerLensTrack.RulerLensTrack, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_RulerTrack.RulerTrack, {
59
+ children: [isIndicatorVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerIndicator.RulerIndicator, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerTicks.RulerTicks, {})]
315
60
  })]
316
61
  });
317
62
  }
318
- const styles = _reactNative.StyleSheet.create({
319
- container: {
320
- justifyContent: 'center',
321
- alignItems: 'center',
322
- overflow: 'hidden'
323
- },
324
- headerContainer: {
325
- flexDirection: 'row',
326
- alignItems: 'center',
327
- justifyContent: 'center',
328
- width: '100%',
329
- paddingHorizontal: 20,
330
- marginBottom: 20,
331
- height: 40
332
- },
333
- dateHeader: {
334
- alignItems: 'center'
335
- },
336
- yearText: {
337
- fontSize: 12,
338
- fontWeight: '500',
339
- marginBottom: 2
340
- },
341
- dateText: {
342
- fontSize: 18,
343
- fontWeight: '600'
344
- },
345
- resetBtn: {
346
- position: 'absolute',
347
- right: 20,
348
- paddingVertical: 6,
349
- paddingHorizontal: 12,
350
- borderRadius: 16,
351
- backgroundColor: 'rgba(0,0,0,0.05)'
352
- },
353
- resetText: {
354
- fontSize: 14,
355
- fontWeight: '600'
356
- },
357
- rulerContainer: {
358
- width: SCREEN_WIDTH,
359
- position: 'relative',
360
- flexDirection: 'row',
361
- alignItems: 'flex-end',
362
- justifyContent: 'center'
363
- },
364
- centerIndicator: {
365
- position: 'absolute',
366
- zIndex: 10,
367
- bottom: 0
368
- },
369
- ticksWrapper: {
370
- position: 'absolute',
371
- height: '100%',
372
- width: 0,
373
- left: SCREEN_WIDTH / 2
374
- }
375
- });
376
63
  //# sourceMappingURL=RulerDatePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_reactNativeReanimated","_reactNativeGestureHandler","_defaults","_utils","_useHaptics","_Tick","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SCREEN_WIDTH","Dimensions","width","RulerDatePicker","props","selectedDate","onSelectDate","minDate","maxDate","labelInterval","highlightDays","tickSpacing","DEFAULTS","tickHeight","tickTallHeight","tickThickness","height","rulerHeight","indicatorWidth","indicatorHeight","todayDotSize","labelFontSize","bufferTicks","updateDebounceMs","enableHaptics","onHapticTrigger","fastSwipeTickThreshold","continuousHapticIntervalMs","showResetToToday","renderHeader","colors","useResolvedColors","fireDiscreteHaptic","startContinuousHaptic","stopContinuousHaptic","useHaptics","todayTime","useMemo","d","Date","setHours","getTime","minOffset","maxOffset","computeDayRange","initialOffsetDays","dateToDayOffset","halfVisible","Math","ceil","windowSize","translateX","useSharedValue","contextX","previousIndex","isFastMode","initialDateStr","formatDateString","displayDateStr","setDisplayDateStr","useState","debounceTimerRef","useRef","windowCenter","setWindowCenter","visibleTicks","ticks","start","max","end","min","MS_PER_DAY","push","offset","isLabeled","shouldShowLabel","isToday","isHighlighted","includes","getDay","dateStr","getDate","toString","onTickChanged","useCallback","index","enteringFastMode","dayOffsetToDate","prevCenter","abs","current","clearTimeout","setTimeout","onAnimationSettled","useAnimatedReaction","round","value","prev","ticksSkipped","shouldBeFast","runOnJS","pan","Gesture","Pan","onStart","onUpdate","event","translationX","onEnd","withDecay","velocity","velocityX","deceleration","finished","maxTranslateX","minTranslateX","clampedX","snappedIndex","snappedX","withTiming","duration","done","animatedStyle","useAnimatedStyle","transform","displayDate","displayFormat","toLocaleDateString","weekday","month","day","displayYear","getFullYear","currentYear","showYear","isTodaySelected","handleResetToToday","todayStr","jsxs","View","style","styles","container","backgroundColor","children","headerContainer","dateHeader","jsx","Text","yearText","color","labelColor","dateText","accentColor","TouchableOpacity","onPress","resetBtn","resetText","GestureDetector","gesture","rulerContainer","centerIndicator","indicatorColor","ticksWrapper","map","tick","Tick","tickColor","tickTallColor","StyleSheet","create","justifyContent","alignItems","overflow","flexDirection","paddingHorizontal","marginBottom","fontSize","fontWeight","position","right","paddingVertical","borderRadius","zIndex","bottom","left"],"sourceRoot":"../../src","sources":["RulerDatePicker.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAOA,IAAAE,sBAAA,GAAAH,uBAAA,CAAAC,OAAA;AAQA,IAAAG,0BAAA,GAAAH,OAAA;AAGA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAQA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAA8B,IAAAQ,WAAA,GAAAR,OAAA;AAAA,SAAAD,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAU,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA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Q;IACpBC,QAAQ,EAAE;EACZ,CAAC;EACD5B,eAAe,EAAE;IACf6B,aAAa,EAAE,KAAK;IACpBF,UAAU,EAAE,QAAQ;IACpBD,cAAc,EAAE,QAAQ;IACxBzK,KAAK,EAAE,MAAM;IACb6K,iBAAiB,EAAE,EAAE;IACrBC,YAAY,EAAE,EAAE;IAChBhK,MAAM,EAAE;EACV,CAAC;EACDkI,UAAU,EAAE;IACV0B,UAAU,EAAE;EACd,CAAC;EACDvB,QAAQ,EAAE;IACR4B,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE,KAAK;IACjBF,YAAY,EAAE;EAChB,CAAC;EACDxB,QAAQ,EAAE;IACRyB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDtB,QAAQ,EAAE;IACRuB,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE,EAAE;IACTC,eAAe,EAAE,CAAC;IAClBN,iBAAiB,EAAE,EAAE;IACrBO,YAAY,EAAE,EAAE;IAChBvC,eAAe,EAAE;EACnB,CAAC;EACDc,SAAS,EAAE;IACToB,QAAQ,EAAE,EAAE;IACZC,UAAU,EAAE;EACd,CAAC;EACDlB,cAAc,EAAE;IACd9J,KAAK,EAAEF,YAAY;IACnBmL,QAAQ,EAAE,UAAU;IACpBL,aAAa,EAAE,KAAK;IACpBF,UAAU,EAAE,UAAU;IACtBD,cAAc,EAAE;EAClB,CAAC;EACDV,eAAe,EAAE;IACfkB,QAAQ,EAAE,UAAU;IACpBI,MAAM,EAAE,EAAE;IACVC,MAAM,EAAE;EACV,CAAC;EACDrB,YAAY,EAAE;IACZgB,QAAQ,EAAE,UAAU;IACpBnK,MAAM,EAAE,MAAM;IACdd,KAAK,EAAE,CAAC;IACRuL,IAAI,EAAEzL,YAAY,GAAG;EACvB;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_RulerRoot","_RulerHeader","_RulerTrack","_RulerIndicator","_RulerTicks","_RulerLensTrack","_jsxRuntime","e","__esModule","default","RulerDatePicker","props","header","indicator","lensEffect","rootProps","isHeaderVisible","headerConfig","undefined","isIndicatorVisible","indicatorConfig","jsxs","RulerRoot","children","jsx","RulerHeader","RulerLensTrack","RulerTrack","RulerIndicator","RulerTicks"],"sourceRoot":"../../src","sources":["RulerDatePicker.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,eAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,eAAA,GAAAN,OAAA;AAAkD,IAAAO,WAAA,GAAAP,OAAA;AAAA,SAAAD,uBAAAS,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,eAAeA,CAACC,KAA2B,EAAE;EAC3D,MAAM;IACJC,MAAM,GAAG,IAAI;IACbC,SAAS,GAAG,IAAI;IAChBC,UAAU;IACV,GAAGC;EACL,CAAC,GAAGJ,KAAK;;EAET;EACA,MAAMK,eAAe,GAAGJ,MAAM,KAAK,KAAK;EACxC,MAAMK,YAAY,GAAG,OAAOL,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGM,SAAS;;EAEpE;EACA,MAAMC,kBAAkB,GAAGN,SAAS,KAAK,KAAK;EAC9C,MAAMO,eAAe,GAAG,OAAOP,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGK,SAAS;EAE7E,oBACE,IAAAZ,WAAA,CAAAe,IAAA,EAACrB,UAAA,CAAAsB,SAAS;IAAA,GACJP,SAAS;IACbH,MAAM,EAAEA,MAAO;IACfE,UAAU,EAAEA,UAAW;IACvBD,SAAS,EAAEO,eAAgB;IAAAG,QAAA,GAE1BP,eAAe,iBAAI,IAAAV,WAAA,CAAAkB,GAAA,EAACvB,YAAA,CAAAwB,WAAW;MAAA,GAAKR;IAAY,CAAG,CAAC,EACpDH,UAAU,gBACT,IAAAR,WAAA,CAAAkB,GAAA,EAACnB,eAAA,CAAAqB,cAAc,IAAE,CAAC,gBAElB,IAAApB,WAAA,CAAAe,IAAA,EAACnB,WAAA,CAAAyB,UAAU;MAAAJ,QAAA,GACRJ,kBAAkB,iBAAI,IAAAb,WAAA,CAAAkB,GAAA,EAACrB,eAAA,CAAAyB,cAAc,IAAE,CAAC,eACzC,IAAAtB,WAAA,CAAAkB,GAAA,EAACpB,WAAA,CAAAyB,UAAU,IAAE,CAAC;IAAA,CACJ,CACb;EAAA,CACQ,CAAC;AAEhB","ignoreList":[]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RulerDateRangePicker = RulerDateRangePicker;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _RulerRangeRoot = require("./RulerRangeRoot.js");
9
+ var _RulerRangeHeader = require("./RulerRangeHeader.js");
10
+ var _RulerRangeTrack = require("./RulerRangeTrack.js");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ /**
14
+ * A performant, customizable horizontal ruler date range picker for React Native & Expo.
15
+ *
16
+ * @experimental This component is experimental. The API surface, options, and physics
17
+ * mechanics may undergo breaking changes in future minor releases as dual-handle
18
+ * interactions and gestures are refined.
19
+ *
20
+ * Features:
21
+ * - Dual-handle windowed date range selection with connecting highlight strip
22
+ * - Active handle auto-switching (tap near a handle or tap between to focus)
23
+ * - 60 FPS scrolling via Reanimated 3 decay physics & snap alignment
24
+ * - Min/max selectable span in days (`minSpanDays`, `maxSpanDays`)
25
+ * - Automatic Dark/Light mode theme detection
26
+ *
27
+ * @example
28
+ * ```tsx
29
+ * <RulerDateRangePicker
30
+ * value={{ start: new Date(), end: new Date(Date.now() + 7 * 86400000) }}
31
+ * onChange={({ startDate, endDate }) => console.log(startDate, endDate)}
32
+ * />
33
+ * ```
34
+ */
35
+ function RulerDateRangePicker(props) {
36
+ const {
37
+ header = true,
38
+ indicator = true,
39
+ highlight = true,
40
+ ...rootProps
41
+ } = props;
42
+ const isHeaderVisible = header !== false;
43
+ const headerConfig = typeof header === 'object' ? header : undefined;
44
+ const indicatorConfig = typeof indicator === 'object' ? indicator : undefined;
45
+ const highlightConfig = typeof highlight === 'object' ? highlight : undefined;
46
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_RulerRangeRoot.RulerRangeRoot, {
47
+ ...rootProps,
48
+ header: header,
49
+ indicator: indicatorConfig,
50
+ highlight: highlightConfig,
51
+ children: [isHeaderVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerRangeHeader.RulerRangeHeader, {
52
+ ...headerConfig
53
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerRangeTrack.RulerRangeTrack, {})]
54
+ });
55
+ }
56
+ //# sourceMappingURL=RulerDateRangePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_RulerRangeRoot","_RulerRangeHeader","_RulerRangeTrack","_jsxRuntime","e","__esModule","default","RulerDateRangePicker","props","header","indicator","highlight","rootProps","isHeaderVisible","headerConfig","undefined","indicatorConfig","highlightConfig","jsxs","RulerRangeRoot","children","jsx","RulerRangeHeader","RulerRangeTrack"],"sourceRoot":"../../src","sources":["RulerDateRangePicker.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAAoD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,oBAAoBA,CAACC,KAAgC,EAAE;EACrE,MAAM;IACJC,MAAM,GAAG,IAAI;IACbC,SAAS,GAAG,IAAI;IAChBC,SAAS,GAAG,IAAI;IAChB,GAAGC;EACL,CAAC,GAAGJ,KAAK;EAET,MAAMK,eAAe,GAAGJ,MAAM,KAAK,KAAK;EACxC,MAAMK,YAAY,GAAG,OAAOL,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAGM,SAAS;EACpE,MAAMC,eAAe,GAAG,OAAON,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGK,SAAS;EAC7E,MAAME,eAAe,GAAG,OAAON,SAAS,KAAK,QAAQ,GAAGA,SAAS,GAAGI,SAAS;EAE7E,oBACE,IAAAZ,WAAA,CAAAe,IAAA,EAAClB,eAAA,CAAAmB,cAAc;IAAA,GACTP,SAAS;IACbH,MAAM,EAAEA,MAAO;IACfC,SAAS,EAAEM,eAAgB;IAC3BL,SAAS,EAAEM,eAAgB;IAAAG,QAAA,GAE1BP,eAAe,iBAAI,IAAAV,WAAA,CAAAkB,GAAA,EAACpB,iBAAA,CAAAqB,gBAAgB;MAAA,GAAKR;IAAY,CAAG,CAAC,eAC1D,IAAAX,WAAA,CAAAkB,GAAA,EAACnB,gBAAA,CAAAqB,eAAe,IAAE,CAAC;EAAA,CACL,CAAC;AAErB","ignoreList":[]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.RulerHeader = RulerHeader;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _RulerContext = require("./RulerContext.js");
10
+ var _RulerResetButton = require("./RulerResetButton.js");
11
+ var _jsxRuntime = require("react/jsx-runtime");
12
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
+ function RulerHeader({
14
+ children,
15
+ style,
16
+ dateStyle,
17
+ yearStyle,
18
+ showResetToToday: customShowReset,
19
+ resetLabel: customResetLabel,
20
+ format: customFormat,
21
+ render
22
+ } = {}) {
23
+ const {
24
+ selectedDate,
25
+ isTodaySelected,
26
+ resetToToday,
27
+ theme,
28
+ headerConfig,
29
+ locale = 'default'
30
+ } = (0, _RulerContext.useRulerContext)();
31
+ const headerStyle = style ?? headerConfig?.style;
32
+ if (children) {
33
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
34
+ style: [styles.headerContainer, headerStyle],
35
+ children: children
36
+ });
37
+ }
38
+ const customRenderer = render ?? headerConfig?.render;
39
+ if (customRenderer) {
40
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
41
+ children: customRenderer(selectedDate, isTodaySelected, resetToToday)
42
+ });
43
+ }
44
+ const showReset = customShowReset ?? headerConfig?.showResetToToday ?? false;
45
+ const resetLabel = customResetLabel ?? headerConfig?.resetLabel;
46
+ const formatFn = customFormat ?? headerConfig?.format;
47
+ const displayFormat = formatFn ? formatFn(selectedDate) : selectedDate.toLocaleDateString(locale, {
48
+ weekday: 'long',
49
+ month: 'long',
50
+ day: 'numeric'
51
+ });
52
+ const displayYear = selectedDate.getFullYear();
53
+ const currentYear = new Date().getFullYear();
54
+ const showYear = !formatFn && displayYear !== currentYear;
55
+ const resolvedDateStyle = dateStyle ?? headerConfig?.dateStyle;
56
+ const resolvedYearStyle = yearStyle ?? headerConfig?.yearStyle;
57
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
58
+ style: [styles.headerContainer, headerStyle],
59
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
60
+ style: styles.dateHeader,
61
+ children: [showYear && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
62
+ style: [styles.yearText, {
63
+ color: theme.labelColor
64
+ }, resolvedYearStyle],
65
+ children: displayYear
66
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
67
+ style: [styles.dateText, {
68
+ color: theme.accentColor
69
+ }, resolvedDateStyle],
70
+ children: displayFormat
71
+ })]
72
+ }), showReset && !isTodaySelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_RulerResetButton.RulerResetButton, {
73
+ style: styles.resetBtnPosition,
74
+ label: resetLabel
75
+ })]
76
+ });
77
+ }
78
+ const styles = _reactNative.StyleSheet.create({
79
+ headerContainer: {
80
+ flexDirection: 'row',
81
+ alignItems: 'center',
82
+ justifyContent: 'center',
83
+ width: '100%',
84
+ paddingHorizontal: 20,
85
+ marginBottom: 16,
86
+ minHeight: 40,
87
+ position: 'relative'
88
+ },
89
+ dateHeader: {
90
+ alignItems: 'center'
91
+ },
92
+ yearText: {
93
+ fontSize: 12,
94
+ fontWeight: '500',
95
+ marginBottom: 2
96
+ },
97
+ dateText: {
98
+ fontSize: 18,
99
+ fontWeight: '600'
100
+ },
101
+ resetBtnPosition: {
102
+ position: 'absolute',
103
+ right: 20
104
+ }
105
+ });
106
+ //# sourceMappingURL=RulerHeader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_RulerContext","_RulerResetButton","_jsxRuntime","e","__esModule","default","RulerHeader","children","style","dateStyle","yearStyle","showResetToToday","customShowReset","resetLabel","customResetLabel","format","customFormat","render","selectedDate","isTodaySelected","resetToToday","theme","headerConfig","locale","useRulerContext","headerStyle","jsx","View","styles","headerContainer","customRenderer","Fragment","showReset","formatFn","displayFormat","toLocaleDateString","weekday","month","day","displayYear","getFullYear","currentYear","Date","showYear","resolvedDateStyle","resolvedYearStyle","jsxs","dateHeader","Text","yearText","color","labelColor","dateText","accentColor","RulerResetButton","resetBtnPosition","label","StyleSheet","create","flexDirection","alignItems","justifyContent","width","paddingHorizontal","marginBottom","minHeight","position","fontSize","fontWeight","right"],"sourceRoot":"../../src","sources":["RulerHeader.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AAAsD,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAD,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAiB/C,SAASG,WAAWA,CAAC;EAC1BC,QAAQ;EACRC,KAAK;EACLC,SAAS;EACTC,SAAS;EACTC,gBAAgB,EAAEC,eAAe;EACjCC,UAAU,EAAEC,gBAAgB;EAC5BC,MAAM,EAAEC,YAAY;EACpBC;AACgB,CAAC,GAAG,CAAC,CAAC,EAAE;EACxB,MAAM;IACJC,YAAY;IACZC,eAAe;IACfC,YAAY;IACZC,KAAK;IACLC,YAAY;IACZC,MAAM,GAAG;EACX,CAAC,GAAG,IAAAC,6BAAe,EAAC,CAAC;EAErB,MAAMC,WAAW,GAAGjB,KAAK,IAAIc,YAAY,EAAEd,KAAK;EAEhD,IAAID,QAAQ,EAAE;IACZ,oBAAO,IAAAL,WAAA,CAAAwB,GAAA,EAAC3B,YAAA,CAAA4B,IAAI;MAACnB,KAAK,EAAE,CAACoB,MAAM,CAACC,eAAe,EAAEJ,WAAW,CAAE;MAAAlB,QAAA,EAAEA;IAAQ,CAAO,CAAC;EAC9E;EAEA,MAAMuB,cAAc,GAAGb,MAAM,IAAIK,YAAY,EAAEL,MAAM;EACrD,IAAIa,cAAc,EAAE;IAClB,oBAAO,IAAA5B,WAAA,CAAAwB,GAAA,EAAAxB,WAAA,CAAA6B,QAAA;MAAAxB,QAAA,EAAGuB,cAAc,CAACZ,YAAY,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