panelui-native 0.30.0 → 0.34.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 (81) hide show
  1. package/README.md +4 -2
  2. package/lib/module/components/button/index.js +106 -11
  3. package/lib/module/components/button/index.js.map +1 -1
  4. package/lib/module/components/calendar/index.js +107 -24
  5. package/lib/module/components/calendar/index.js.map +1 -1
  6. package/lib/module/components/drawer/index.js +477 -0
  7. package/lib/module/components/drawer/index.js.map +1 -0
  8. package/lib/module/components/heatmap-chart/index.js +9 -8
  9. package/lib/module/components/heatmap-chart/index.js.map +1 -1
  10. package/lib/module/components/map/index.js +50 -4
  11. package/lib/module/components/map/index.js.map +1 -1
  12. package/lib/module/components/panelside/index.js +1024 -0
  13. package/lib/module/components/panelside/index.js.map +1 -0
  14. package/lib/module/components/plan/index.js +307 -21
  15. package/lib/module/components/plan/index.js.map +1 -1
  16. package/lib/module/components/post/index.js +992 -0
  17. package/lib/module/components/post/index.js.map +1 -0
  18. package/lib/module/components/response/index.js +296 -0
  19. package/lib/module/components/response/index.js.map +1 -0
  20. package/lib/module/components/response/markdown.js +463 -0
  21. package/lib/module/components/response/markdown.js.map +1 -0
  22. package/lib/module/components/select/index.js +111 -18
  23. package/lib/module/components/select/index.js.map +1 -1
  24. package/lib/module/components/table/index.js +632 -0
  25. package/lib/module/components/table/index.js.map +1 -0
  26. package/lib/module/icons/index.js +220 -0
  27. package/lib/module/icons/index.js.map +1 -1
  28. package/lib/module/index.js +6 -1
  29. package/lib/module/index.js.map +1 -1
  30. package/lib/module/native/index.js +30 -0
  31. package/lib/module/native/index.js.map +1 -1
  32. package/lib/module/utils/date.js +129 -22
  33. package/lib/module/utils/date.js.map +1 -1
  34. package/lib/typescript/src/components/button/index.d.ts +22 -1
  35. package/lib/typescript/src/components/button/index.d.ts.map +1 -1
  36. package/lib/typescript/src/components/calendar/index.d.ts +12 -3
  37. package/lib/typescript/src/components/calendar/index.d.ts.map +1 -1
  38. package/lib/typescript/src/components/drawer/index.d.ts +146 -0
  39. package/lib/typescript/src/components/drawer/index.d.ts.map +1 -0
  40. package/lib/typescript/src/components/heatmap-chart/index.d.ts.map +1 -1
  41. package/lib/typescript/src/components/map/index.d.ts +8 -1
  42. package/lib/typescript/src/components/map/index.d.ts.map +1 -1
  43. package/lib/typescript/src/components/panelside/index.d.ts +354 -0
  44. package/lib/typescript/src/components/panelside/index.d.ts.map +1 -0
  45. package/lib/typescript/src/components/plan/index.d.ts +121 -10
  46. package/lib/typescript/src/components/plan/index.d.ts.map +1 -1
  47. package/lib/typescript/src/components/post/index.d.ts +358 -0
  48. package/lib/typescript/src/components/post/index.d.ts.map +1 -0
  49. package/lib/typescript/src/components/response/index.d.ts +91 -0
  50. package/lib/typescript/src/components/response/index.d.ts.map +1 -0
  51. package/lib/typescript/src/components/response/markdown.d.ts +88 -0
  52. package/lib/typescript/src/components/response/markdown.d.ts.map +1 -0
  53. package/lib/typescript/src/components/select/index.d.ts +27 -2
  54. package/lib/typescript/src/components/select/index.d.ts.map +1 -1
  55. package/lib/typescript/src/components/table/index.d.ts +274 -0
  56. package/lib/typescript/src/components/table/index.d.ts.map +1 -0
  57. package/lib/typescript/src/icons/index.d.ts +41 -1
  58. package/lib/typescript/src/icons/index.d.ts.map +1 -1
  59. package/lib/typescript/src/index.d.ts +7 -2
  60. package/lib/typescript/src/index.d.ts.map +1 -1
  61. package/lib/typescript/src/native/index.d.ts +20 -0
  62. package/lib/typescript/src/native/index.d.ts.map +1 -1
  63. package/lib/typescript/src/utils/date.d.ts +49 -5
  64. package/lib/typescript/src/utils/date.d.ts.map +1 -1
  65. package/package.json +1 -1
  66. package/src/components/button/index.tsx +140 -8
  67. package/src/components/calendar/index.tsx +136 -23
  68. package/src/components/drawer/index.tsx +662 -0
  69. package/src/components/heatmap-chart/index.tsx +9 -9
  70. package/src/components/map/index.tsx +53 -4
  71. package/src/components/panelside/index.tsx +1358 -0
  72. package/src/components/plan/index.tsx +344 -21
  73. package/src/components/post/index.tsx +1116 -0
  74. package/src/components/response/index.tsx +390 -0
  75. package/src/components/response/markdown.ts +489 -0
  76. package/src/components/select/index.tsx +155 -15
  77. package/src/components/table/index.tsx +747 -0
  78. package/src/icons/index.tsx +176 -1
  79. package/src/index.ts +93 -0
  80. package/src/native/index.ts +51 -0
  81. package/src/utils/date.ts +146 -22
@@ -0,0 +1,477 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Drawer — a panel that comes in from an edge of the screen and covers the app
5
+ * until it is dismissed.
6
+ *
7
+ * ```tsx
8
+ * <Drawer>
9
+ * <Drawer.Trigger>
10
+ * <Button variant="outline">Menu</Button>
11
+ * </Drawer.Trigger>
12
+ * <Drawer.Content>
13
+ * <Drawer.Header title="Workspace" description="Switch or manage" />
14
+ * <Drawer.Body>
15
+ * <Item title="Projects" />
16
+ * <Item title="Members" />
17
+ * </Drawer.Body>
18
+ * <Drawer.Footer>
19
+ * <Button className="flex-1">Settings</Button>
20
+ * </Drawer.Footer>
21
+ * </Drawer.Content>
22
+ * </Drawer>
23
+ * ```
24
+ *
25
+ * ## Why the sides are `start` and `end`
26
+ *
27
+ * A drawer is the one overlay whose whole identity is the edge it belongs to,
28
+ * and in a right-to-left app "the navigation edge" is the right one. Naming the
29
+ * sides `left` and `right` would bake a reading direction into the API and
30
+ * force every caller in an RTL app to invert it themselves, so the sides are
31
+ * logical: `start` is the edge text begins at, `end` the edge it runs toward.
32
+ * Both follow the enclosing `<Direction>`, and `top` and `bottom` mean what
33
+ * they say because the vertical axis does not mirror.
34
+ *
35
+ * Yoga mirrors the panel's own position, because that is laid out from `start-0`
36
+ * / `end-0`. It does not mirror the drag, which is measured in raw pixels — so
37
+ * the gesture consults the direction and negates itself, which is what keeps a
38
+ * swipe *outward* dismissing in both directions rather than only one.
39
+ *
40
+ * ## Why it is not a BottomSheet with a different edge
41
+ *
42
+ * A sheet is sized by its content and dragged along the axis its scroller runs
43
+ * on, which is why so much of it is about sharing one drag between the two. A
44
+ * side drawer is sized by the screen and dragged across its scroller's axis, so
45
+ * the two gestures never compete: the cross-axis drag simply fails and the list
46
+ * keeps it. That difference is the reason this is a separate component and not
47
+ * a prop on the sheet.
48
+ */
49
+ import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useState } from 'react';
50
+ import { Pressable, ScrollView, useWindowDimensions, View } from 'react-native';
51
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
52
+ import Animated, { SlideInDown, SlideInLeft, SlideInRight, SlideInUp, SlideOutDown, SlideOutLeft, SlideOutRight, SlideOutUp, runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
53
+ import { useSafeAreaInsets } from 'react-native-safe-area-context';
54
+ import { tv } from 'tailwind-variants';
55
+ import { useCSSVariable } from 'uniwind';
56
+ import { XIcon } from "../../icons/index.js";
57
+ import { Portal } from "../../primitives/portal.js";
58
+ import { Scrim } from "../../primitives/scrim.js";
59
+ import { Text, textChildren } from "../../primitives/text.js";
60
+ import { useBackHandler } from "../../hooks/use-back-handler.js";
61
+ import { DirectionContext, useDirection, useDirectionSign } from "../../hooks/use-direction.js";
62
+ import { cn } from "../../utils/cn.js";
63
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
64
+ const SPRING = {
65
+ damping: 24,
66
+ stiffness: 300,
67
+ mass: 0.7
68
+ };
69
+ /** How far a drag has to travel outward before releasing it dismisses. */
70
+ const DISMISS_DISTANCE = 80;
71
+ /** A flick this fast dismisses regardless of how far it got. */
72
+ const DISMISS_VELOCITY = 650;
73
+ /**
74
+ * How much of the screen each size asks for, and the cap it is never allowed
75
+ * past on a wide screen.
76
+ *
77
+ * The cap is the whole point. A fraction alone reads correctly on a phone and
78
+ * absurdly on a tablet, where 78% of the width is a navigation list with a
79
+ * column of whitespace beside it. Capping turns the fraction into "no wider
80
+ * than it needs to be", which is what a drawer is.
81
+ */
82
+ const WIDTH = {
83
+ sm: {
84
+ fraction: 0.62,
85
+ max: 280
86
+ },
87
+ md: {
88
+ fraction: 0.78,
89
+ max: 320
90
+ },
91
+ lg: {
92
+ fraction: 0.88,
93
+ max: 400
94
+ },
95
+ // Not 1: an edge of the app left showing is what says it is still there
96
+ // behind the drawer, and it is also the only thing left to tap to dismiss.
97
+ full: {
98
+ fraction: 0.94,
99
+ max: Infinity
100
+ }
101
+ };
102
+
103
+ /** The same idea on the vertical axis, where there is no sensible cap. */
104
+ const HEIGHT = {
105
+ sm: 0.3,
106
+ md: 0.45,
107
+ lg: 0.62,
108
+ full: 0.94
109
+ };
110
+ const panelVariants = tv({
111
+ base: 'absolute border-border bg-popover shadow-lg',
112
+ variants: {
113
+ side: {
114
+ // Three real edges each. The fourth is the screen edge the drawer is
115
+ // docked to, and drawing a border or a radius along it would be a line
116
+ // through the middle of nothing.
117
+ start: 'bottom-0 start-0 top-0 rounded-e-3xl border-e',
118
+ end: 'bottom-0 end-0 top-0 rounded-s-3xl border-s',
119
+ top: 'end-0 start-0 top-0 rounded-b-3xl border-b',
120
+ bottom: 'bottom-0 end-0 start-0 rounded-t-3xl border-t'
121
+ }
122
+ },
123
+ defaultVariants: {
124
+ side: 'start'
125
+ }
126
+ });
127
+ const DrawerContext = /*#__PURE__*/createContext(null);
128
+ function useDrawer(component) {
129
+ const context = useContext(DrawerContext);
130
+ if (!context) {
131
+ throw new Error(`${component} must be used within a <Drawer>`);
132
+ }
133
+ return context;
134
+ }
135
+
136
+ /**
137
+ * What the panel knows and its parts need: which corner the close button took,
138
+ * so a header can leave it clear rather than wrap underneath it.
139
+ */
140
+
141
+ const DrawerSurfaceContext = /*#__PURE__*/createContext(null);
142
+ function DrawerRoot({
143
+ children,
144
+ open: controlledOpen,
145
+ onOpenChange,
146
+ defaultOpen = false
147
+ }) {
148
+ const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
149
+ const controlled = controlledOpen !== undefined;
150
+ const open = controlled ? controlledOpen : uncontrolledOpen;
151
+ const setOpen = useCallback(next => {
152
+ if (!controlled) setUncontrolledOpen(next);
153
+ onOpenChange?.(next);
154
+ }, [controlled, onOpenChange]);
155
+ const context = useMemo(() => ({
156
+ open,
157
+ setOpen
158
+ }), [open, setOpen]);
159
+ return /*#__PURE__*/_jsx(DrawerContext.Provider, {
160
+ value: context,
161
+ children: children
162
+ });
163
+ }
164
+ function DrawerTrigger({
165
+ children
166
+ }) {
167
+ const {
168
+ setOpen
169
+ } = useDrawer('Drawer.Trigger');
170
+ if (! /*#__PURE__*/isValidElement(children)) return children;
171
+ return /*#__PURE__*/cloneElement(children, {
172
+ onPress: (...args) => {
173
+ children.props.onPress?.(...args);
174
+ setOpen(true);
175
+ }
176
+ });
177
+ }
178
+ function DrawerClose({
179
+ children
180
+ }) {
181
+ const {
182
+ setOpen
183
+ } = useDrawer('Drawer.Close');
184
+ if (! /*#__PURE__*/isValidElement(children)) return children;
185
+ return /*#__PURE__*/cloneElement(children, {
186
+ onPress: (...args) => {
187
+ children.props.onPress?.(...args);
188
+ setOpen(false);
189
+ }
190
+ });
191
+ }
192
+ function DrawerContent({
193
+ className,
194
+ side = 'start',
195
+ size = 'md',
196
+ dismissible = true,
197
+ swipeToDismiss = true,
198
+ showClose = true,
199
+ blur = false,
200
+ children,
201
+ ...props
202
+ }) {
203
+ const {
204
+ open,
205
+ setOpen
206
+ } = useDrawer('Drawer.Content');
207
+ const {
208
+ width: screenWidth,
209
+ height: screenHeight
210
+ } = useWindowDimensions();
211
+ const insets = useSafeAreaInsets();
212
+ const dir = useDirection();
213
+ const sign = useDirectionSign();
214
+ const closeTint = useCSSVariable('--color-muted-foreground');
215
+
216
+ // Memoised for the reason `Direction` memoises its own: this is the object
217
+ // that invalidates layout for the whole panel, and a fresh one every render
218
+ // would re-run Yoga over it for a value that almost never changes.
219
+ const directionStyle = useMemo(() => ({
220
+ direction: dir
221
+ }), [dir]);
222
+ const close = useCallback(() => setOpen(false), [setOpen]);
223
+
224
+ // An open drawer catches the Android back button, closing itself instead of
225
+ // popping the screen behind it.
226
+ useBackHandler(open, close);
227
+ const horizontal = side === 'start' || side === 'end';
228
+
229
+ /**
230
+ * How far the panel has to travel to be fully off-screen — the distance a
231
+ * dismissing drag animates out to, and the axis the drag is measured on.
232
+ */
233
+ const extent = horizontal ? Math.min(screenWidth * WIDTH[size].fraction, WIDTH[size].max) : screenHeight * HEIGHT[size];
234
+
235
+ /**
236
+ * Which way "outward" points in raw pixels.
237
+ *
238
+ * Yoga has already mirrored where the panel sits, but a transform is not
239
+ * laid out — it is applied to whatever Yoga decided — so this is the one
240
+ * place that has to know the reading direction and negate itself. A `start`
241
+ * drawer leaves toward negative X in a left-to-right app and positive X in a
242
+ * right-to-left one; `end` is the mirror of that.
243
+ */
244
+ const outward = horizontal ? (side === 'start' ? -1 : 1) * sign : side === 'top' ? -1 : 1;
245
+
246
+ /** Outward drag distance in points. Negative means dragged further in. */
247
+ const travel = useSharedValue(0);
248
+
249
+ /*
250
+ * Parked at zero on every open. A swipe-dismiss leaves the panel a full
251
+ * extent outward, and without this the next open would draw a lit backdrop
252
+ * over an app with the drawer still off-screen behind it — dimmed, blocking,
253
+ * and with nothing on it to close.
254
+ */
255
+ useEffect(() => {
256
+ if (open) travel.value = 0;
257
+ }, [open, travel]);
258
+ const pan = useMemo(() => {
259
+ const gesture = Gesture.Pan().enabled(swipeToDismiss).onChange(event => {
260
+ const delta = (horizontal ? event.changeX : event.changeY) * outward;
261
+ const next = travel.value + delta;
262
+ // Follow the finger outward; rubber-band the pull further in, which
263
+ // has nowhere to go.
264
+ travel.value = next > 0 ? next : next / 3;
265
+ }).onEnd(event => {
266
+ const velocity = (horizontal ? event.velocityX : event.velocityY) * outward;
267
+ if (travel.value > DISMISS_DISTANCE || velocity > DISMISS_VELOCITY) {
268
+ travel.value = withTiming(extent, {
269
+ duration: 180
270
+ }, finished => {
271
+ if (finished) runOnJS(close)();
272
+ });
273
+ } else {
274
+ travel.value = withSpring(0, SPRING);
275
+ }
276
+ });
277
+
278
+ /*
279
+ * The drag has to give way to whatever the content is doing on the other
280
+ * axis. A side drawer holds a vertical list, so a mostly-vertical drag
281
+ * fails here and the list keeps it — which is why a side drawer needs none
282
+ * of the shared-gesture machinery a bottom sheet does.
283
+ */
284
+ return horizontal ? gesture.activeOffsetX([-12, 12]).failOffsetY([-18, 18]) : gesture.activeOffsetY([-12, 12]).failOffsetX([-18, 18]);
285
+ }, [close, extent, horizontal, outward, swipeToDismiss, travel]);
286
+ const panelStyle = useAnimatedStyle(() => horizontal ? {
287
+ transform: [{
288
+ translateX: travel.value * outward
289
+ }]
290
+ } : {
291
+ transform: [{
292
+ translateY: travel.value * outward
293
+ }]
294
+ });
295
+ const surface = useMemo(() => ({
296
+ side,
297
+ showClose
298
+ }), [side, showClose]);
299
+ if (!open) return null;
300
+
301
+ /*
302
+ * The slide has to be given a physical direction, since the animation
303
+ * presets are physical. This is the same mirroring Yoga did for the panel's
304
+ * position, applied by hand to the one thing Yoga does not own.
305
+ */
306
+ const physical = horizontal ? side === 'start' === (dir === 'ltr') ? 'left' : 'right' : side;
307
+ const entering = {
308
+ left: SlideInLeft,
309
+ right: SlideInRight,
310
+ top: SlideInUp,
311
+ bottom: SlideInDown
312
+ }[physical];
313
+ const exiting = {
314
+ left: SlideOutLeft,
315
+ right: SlideOutRight,
316
+ top: SlideOutUp,
317
+ bottom: SlideOutDown
318
+ }[physical];
319
+
320
+ /*
321
+ * The inset and the panel's own padding stack rather than compete.
322
+ *
323
+ * A drawer that reaches the top of the screen is drawn behind the status bar
324
+ * on purpose — a surface the app disappears under should not stop short of
325
+ * the edge — but the clock and the battery are drawn *in* that band, so the
326
+ * content clears the whole of it and then takes its padding on top. `Math.max`
327
+ * gave the two the same slot: on a 59-point inset it resolved to 59, leaving
328
+ * the header and the close button flush against the clock with nothing
329
+ * between them.
330
+ *
331
+ * `bottom` is the one side whose top edge is nowhere near the status bar, and
332
+ * `top` the one side ending in open screen rather than at the home indicator.
333
+ * Each takes plain padding on the edge it does not meet.
334
+ */
335
+ const padding = {
336
+ paddingTop: side === 'bottom' ? 16 : insets.top + 16,
337
+ paddingBottom: side === 'top' ? 16 : Math.max(insets.bottom, 16)
338
+ };
339
+ return /*#__PURE__*/_jsx(Portal, {
340
+ children: /*#__PURE__*/_jsx(DrawerContext.Provider, {
341
+ value: {
342
+ open,
343
+ setOpen
344
+ },
345
+ children: /*#__PURE__*/_jsx(DirectionContext.Provider, {
346
+ value: dir,
347
+ children: /*#__PURE__*/_jsxs(View, {
348
+ className: "absolute inset-0",
349
+ style: directionStyle,
350
+ children: [/*#__PURE__*/_jsxs(View, {
351
+ className: "absolute inset-0",
352
+ children: [/*#__PURE__*/_jsx(Scrim, {
353
+ blur: blur
354
+ }), /*#__PURE__*/_jsx(Pressable, {
355
+ accessibilityLabel: "Close drawer",
356
+ className: "flex-1",
357
+ onPress: dismissible ? close : undefined
358
+ })]
359
+ }), /*#__PURE__*/_jsx(GestureDetector, {
360
+ gesture: pan,
361
+ children: /*#__PURE__*/_jsx(Animated.View, {
362
+ entering: entering.springify().damping(24).stiffness(260).mass(0.7),
363
+ exiting: exiting.duration(200),
364
+ accessibilityViewIsModal: true,
365
+ className: panelVariants({
366
+ side,
367
+ className
368
+ }),
369
+ ...props,
370
+ // After the spread, and folding the caller's own `style` in
371
+ // rather than replacing the array: spread last, a caller
372
+ // passing `style` would silently drop the drag transform and
373
+ // the safe-area padding with it.
374
+ style: [panelStyle, padding, horizontal ? {
375
+ width: extent
376
+ } : {
377
+ height: extent
378
+ }, props.style],
379
+ children: /*#__PURE__*/_jsxs(DrawerSurfaceContext.Provider, {
380
+ value: surface,
381
+ children: [textChildren(children), showClose ? /*#__PURE__*/_jsx(Pressable, {
382
+ accessibilityRole: "button",
383
+ accessibilityLabel: "Close",
384
+ onPress: close,
385
+ hitSlop: 8,
386
+ className: cn('absolute z-10 h-8 w-8 items-center justify-center rounded-full bg-muted active:opacity-70', side === 'end' ? 'start-4' : 'end-4'),
387
+ style: {
388
+ top: padding.paddingTop
389
+ },
390
+ children: /*#__PURE__*/_jsx(XIcon, {
391
+ size: 16,
392
+ color: typeof closeTint === 'string' ? closeTint : undefined
393
+ })
394
+ }) : null]
395
+ })
396
+ })
397
+ })]
398
+ })
399
+ })
400
+ })
401
+ });
402
+ }
403
+ function DrawerHeader({
404
+ className,
405
+ title,
406
+ description,
407
+ children,
408
+ ...props
409
+ }) {
410
+ const surface = useContext(DrawerSurfaceContext);
411
+
412
+ /*
413
+ * Padding on whichever side the close button took, so a long title wraps
414
+ * above it rather than running underneath it. Nothing to clear when the
415
+ * button was turned off, and a header used outside a panel keeps its plain
416
+ * padding rather than reserving a corner for a button that is not there.
417
+ */
418
+ const clearance = !surface?.showClose ? undefined : surface.side === 'end' ? 'ps-14' : 'pe-14';
419
+ return /*#__PURE__*/_jsxs(View, {
420
+ className: cn('gap-1 px-5 pb-3', clearance, className),
421
+ ...props,
422
+ children: [typeof title === 'string' ? /*#__PURE__*/_jsx(Text, {
423
+ size: "lg",
424
+ weight: "semibold",
425
+ children: title
426
+ }) : title, typeof description === 'string' ? /*#__PURE__*/_jsx(Text, {
427
+ className: "text-sm text-muted-foreground",
428
+ children: description
429
+ }) : description, textChildren(children)]
430
+ });
431
+ }
432
+ function DrawerBody({
433
+ className,
434
+ scrollable = true,
435
+ children,
436
+ contentContainerStyle,
437
+ ...props
438
+ }) {
439
+ if (!scrollable) {
440
+ return /*#__PURE__*/_jsx(View, {
441
+ className: cn('flex-1 px-5', className),
442
+ children: textChildren(children)
443
+ });
444
+ }
445
+ return /*#__PURE__*/_jsx(ScrollView, {
446
+ className: cn('flex-1', className),
447
+ showsVerticalScrollIndicator: false
448
+ // The drawer's own drag runs across this axis and fails out of a mostly
449
+ // vertical touch, so the two never have to be reconciled.
450
+ ,
451
+ contentContainerStyle: [{
452
+ paddingHorizontal: 20
453
+ }, contentContainerStyle],
454
+ ...props,
455
+ children: textChildren(children)
456
+ });
457
+ }
458
+ function DrawerFooter({
459
+ className,
460
+ children,
461
+ ...props
462
+ }) {
463
+ return /*#__PURE__*/_jsx(View, {
464
+ className: cn('flex-row items-center gap-2 border-t border-border px-5 pt-3', className),
465
+ ...props,
466
+ children: textChildren(children)
467
+ });
468
+ }
469
+ export const Drawer = Object.assign(DrawerRoot, {
470
+ Trigger: DrawerTrigger,
471
+ Content: DrawerContent,
472
+ Header: DrawerHeader,
473
+ Body: DrawerBody,
474
+ Footer: DrawerFooter,
475
+ Close: DrawerClose
476
+ });
477
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["cloneElement","createContext","isValidElement","useCallback","useContext","useEffect","useMemo","useState","Pressable","ScrollView","useWindowDimensions","View","Gesture","GestureDetector","Animated","SlideInDown","SlideInLeft","SlideInRight","SlideInUp","SlideOutDown","SlideOutLeft","SlideOutRight","SlideOutUp","runOnJS","useAnimatedStyle","useSharedValue","withSpring","withTiming","useSafeAreaInsets","tv","useCSSVariable","XIcon","Portal","Scrim","Text","textChildren","useBackHandler","DirectionContext","useDirection","useDirectionSign","cn","jsx","_jsx","jsxs","_jsxs","SPRING","damping","stiffness","mass","DISMISS_DISTANCE","DISMISS_VELOCITY","WIDTH","sm","fraction","max","md","lg","full","Infinity","HEIGHT","panelVariants","base","variants","side","start","end","top","bottom","defaultVariants","DrawerContext","useDrawer","component","context","Error","DrawerSurfaceContext","DrawerRoot","children","open","controlledOpen","onOpenChange","defaultOpen","uncontrolledOpen","setUncontrolledOpen","controlled","undefined","setOpen","next","Provider","value","DrawerTrigger","onPress","args","props","DrawerClose","DrawerContent","className","size","dismissible","swipeToDismiss","showClose","blur","width","screenWidth","height","screenHeight","insets","dir","sign","closeTint","directionStyle","direction","close","horizontal","extent","Math","min","outward","travel","pan","gesture","Pan","enabled","onChange","event","delta","changeX","changeY","onEnd","velocity","velocityX","velocityY","duration","finished","activeOffsetX","failOffsetY","activeOffsetY","failOffsetX","panelStyle","transform","translateX","translateY","surface","physical","entering","left","right","exiting","padding","paddingTop","paddingBottom","style","accessibilityLabel","springify","accessibilityViewIsModal","accessibilityRole","hitSlop","color","DrawerHeader","title","description","clearance","weight","DrawerBody","scrollable","contentContainerStyle","showsVerticalScrollIndicator","paddingHorizontal","DrawerFooter","Drawer","Object","assign","Trigger","Content","Header","Body","Footer","Close"],"sourceRoot":"../../../../src","sources":["components/drawer/index.tsx"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SACEA,YAAY,EACZC,aAAa,EACbC,cAAc,EACdC,WAAW,EACXC,UAAU,EACVC,SAAS,EACTC,OAAO,EACPC,QAAQ,QAGH,OAAO;AACd,SACEC,SAAS,EACTC,UAAU,EACVC,mBAAmB,EACnBC,IAAI,QAGC,cAAc;AACrB,SAASC,OAAO,EAAEC,eAAe,QAAQ,8BAA8B;AACvE,OAAOC,QAAQ,IACbC,WAAW,EACXC,WAAW,EACXC,YAAY,EACZC,SAAS,EACTC,YAAY,EACZC,YAAY,EACZC,aAAa,EACbC,UAAU,EACVC,OAAO,EACPC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,iBAAiB,QAAQ,gCAAgC;AAClE,SAASC,EAAE,QAAQ,mBAAmB;AACtC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,KAAK,QAAQ,sBAAa;AACnC,SAASC,MAAM,QAAQ,4BAAyB;AAChD,SAASC,KAAK,QAAQ,2BAAwB;AAC9C,SAASC,IAAI,EAAEC,YAAY,QAAQ,0BAAuB;AAC1D,SAASC,cAAc,QAAQ,iCAA8B;AAC7D,SACEC,gBAAgB,EAChBC,YAAY,EACZC,gBAAgB,QACX,8BAA2B;AAClC,SAASC,EAAE,QAAQ,mBAAgB;AAAC,SAAAC,GAA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AC;AAEX;AAEA,OAAO,MAAM4F,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC/F,UAAU,EAAE;EAC9CgG,OAAO,EAAElF,aAAa;EACtBmF,OAAO,EAAE9E,aAAa;EACtB+E,MAAM,EAAEhB,YAAY;EACpBiB,IAAI,EAAEZ,UAAU;EAChBa,MAAM,EAAER,YAAY;EACpBS,KAAK,EAAEnF;AACT,CAAC,CAAC","ignoreList":[]}
@@ -44,6 +44,7 @@ import Svg, { ClipPath, Defs, G, Line as SvgLine, Rect } from 'react-native-svg'
44
44
  import { useCSSVariable } from 'uniwind';
45
45
  import { Text } from "../../primitives/text.js";
46
46
  import { cn } from "../../utils/cn.js";
47
+ import { normalizeWeekStart, startOfDay } from "../../utils/date.js";
47
48
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
48
49
  const AnimatedRect = Animated.createAnimatedComponent(Rect);
49
50
 
@@ -137,11 +138,14 @@ export function useHeatmapChart() {
137
138
  * empty cells or the calendar develops holes.
138
139
  */
139
140
  export function buildHeatmapCalendar(entries, options = {}) {
140
- const weekStartDay = options.weekStartDay ?? 0;
141
+ const weekStartDay = normalizeWeekStart(options.weekStartDay ?? 0);
141
142
  if (!entries.length && !options.start) return [];
142
143
  const times = entries.map(entry => entry.date.getTime());
143
- const start = options.start ?? new Date(Math.min(...times));
144
- const end = options.end ?? new Date(Math.max(...times));
144
+ // Both bounds at local midnight, and both the same way. Comparing a
145
+ // normalised lower bound against a raw upper one drops the last day whenever
146
+ // the caller's `end` carries a time earlier than the cell being tested.
147
+ const start = startOfDay(options.start ?? new Date(Math.min(...times)));
148
+ const end = startOfDay(options.end ?? new Date(Math.max(...times)));
145
149
  const byDay = new Map();
146
150
  for (const entry of entries) {
147
151
  const key = dayKey(entry.date);
@@ -150,7 +154,7 @@ export function buildHeatmapCalendar(entries, options = {}) {
150
154
 
151
155
  // Back up to the first day of the week the range starts in, so column 0 is a
152
156
  // whole week and every row lines up with a weekday for the rest of the chart.
153
- const cursor = new Date(start.getFullYear(), start.getMonth(), start.getDate());
157
+ const cursor = startOfDay(start);
154
158
  cursor.setDate(cursor.getDate() - (cursor.getDay() - weekStartDay + 7) % 7);
155
159
  const columns = [];
156
160
  let column = [];
@@ -159,7 +163,7 @@ export function buildHeatmapCalendar(entries, options = {}) {
159
163
  const date = new Date(cursor);
160
164
  // Before the range starts and after it ends the cell exists but has no
161
165
  // reading — `count: 0` and no date, so the tooltip stays quiet on it.
162
- const inRange = date >= startOfDay(start) && date <= end;
166
+ const inRange = date >= start && date <= end;
163
167
  column.push({
164
168
  bin: row,
165
169
  count: inRange ? byDay.get(dayKey(date)) ?? 0 : 0,
@@ -177,9 +181,6 @@ export function buildHeatmapCalendar(entries, options = {}) {
177
181
  }
178
182
  return columns;
179
183
  }
180
- function startOfDay(date) {
181
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
182
- }
183
184
  function dayKey(date) {
184
185
  return `${date.getFullYear()}-${date.getMonth()}-${date.getDate()}`;
185
186
  }