@shellui/core 0.4.1 → 0.5.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/README.md +2 -2
  2. package/package.json +15 -3
  3. package/schemas/curated-themes.json +4035 -0
  4. package/schemas/shellui.config.schema.json +961 -0
  5. package/schemas/shellui.theme.schema.json +187 -0
  6. package/src/app.tsx +4 -1
  7. package/src/components/ContentView.tsx +144 -9
  8. package/src/components/LoadingOverlay.tsx +1 -1
  9. package/src/components/ui/alert-dialog.tsx +1 -1
  10. package/src/components/ui/dialog.tsx +23 -5
  11. package/src/components/ui/drawer.tsx +282 -42
  12. package/src/components/ui/dropdown-menu.tsx +7 -2
  13. package/src/components/ui/input.tsx +21 -0
  14. package/src/components/ui/separator.tsx +23 -0
  15. package/src/components/ui/sheet.tsx +220 -0
  16. package/src/components/ui/sidebar.tsx +785 -221
  17. package/src/components/ui/skeleton.tsx +13 -0
  18. package/src/constants/urls.ts +1 -0
  19. package/src/features/admin/utils.ts +2 -45
  20. package/src/features/alertDialog/DialogContext.tsx +1 -1
  21. package/src/features/auth/components/LoginButton.tsx +25 -18
  22. package/src/features/auth/components/LoginPreferencesControls.tsx +124 -0
  23. package/src/features/auth/components/LoginView.tsx +131 -49
  24. package/src/features/config/types.ts +64 -82
  25. package/src/features/drawer/DrawerContext.tsx +55 -19
  26. package/src/features/layouts/AppLayout.tsx +3 -3
  27. package/src/features/layouts/OverlayShell.tsx +376 -77
  28. package/src/features/layouts/appbar/AppBarLayout.tsx +501 -88
  29. package/src/features/layouts/branding/AppBrandIcon.tsx +95 -0
  30. package/src/features/layouts/branding/resolveThemeAsset.spec.ts +33 -0
  31. package/src/features/layouts/branding/resolveThemeAsset.ts +33 -0
  32. package/src/features/layouts/chrome/CollapsedDesktopTitlebar.tsx +49 -0
  33. package/src/features/layouts/chrome/ContentDragOverlay.tsx +19 -0
  34. package/src/features/layouts/chrome/DesktopBackButton.tsx +71 -0
  35. package/src/features/layouts/chrome/DesktopChrome.tsx +28 -0
  36. package/src/features/layouts/chrome/DesktopForwardButton.tsx +59 -0
  37. package/src/features/layouts/chrome/DesktopHistoryButtons.tsx +16 -0
  38. package/src/features/layouts/chrome/constants.ts +11 -0
  39. package/src/features/layouts/chrome/goDesktopBack.spec.ts +218 -0
  40. package/src/features/layouts/chrome/goDesktopBack.ts +106 -0
  41. package/src/features/layouts/chrome/index.ts +26 -0
  42. package/src/features/layouts/chrome/runtime.ts +45 -0
  43. package/src/features/layouts/findMatchingNavigationItem.spec.ts +55 -0
  44. package/src/features/layouts/fullscreen/FullscreenLayout.tsx +17 -1
  45. package/src/features/layouts/isFrameForAppUrl.spec.ts +33 -0
  46. package/src/features/layouts/sidebar/NavigationContent.tsx +70 -34
  47. package/src/features/layouts/sidebar/SidebarIcons.tsx +41 -42
  48. package/src/features/layouts/sidebar/SidebarInner.tsx +142 -24
  49. package/src/features/layouts/sidebar/SidebarLayout.tsx +100 -37
  50. package/src/features/layouts/sidebar/sidebarUtils.ts +0 -7
  51. package/src/features/layouts/sidebar/types.ts +3 -3
  52. package/src/features/layouts/utils.ts +73 -5
  53. package/src/features/layouts/windows/WindowsLayout.tsx +173 -61
  54. package/src/features/modal/ModalContext.tsx +21 -8
  55. package/src/features/overlays/OverlayDrawerPendingBar.tsx +26 -0
  56. package/src/features/overlays/OverlayDynamicDemoView.tsx +108 -0
  57. package/src/features/overlays/OverlayPendingSpinner.tsx +18 -0
  58. package/src/features/overlays/ResponsiveModal.tsx +483 -0
  59. package/src/features/overlays/overlaySize.spec.ts +71 -0
  60. package/src/features/overlays/overlaySize.ts +228 -0
  61. package/src/features/overlays/useOverlayReportedSize.ts +130 -0
  62. package/src/features/settings/SettingsProvider.tsx +66 -46
  63. package/src/features/settings/SettingsView.tsx +42 -47
  64. package/src/features/settings/components/Appearance.tsx +305 -55
  65. package/src/features/settings/components/develop/DrawerTestButtons.tsx +18 -0
  66. package/src/features/settings/components/develop/ModalTestButtons.tsx +23 -0
  67. package/src/features/settings/utils/getResolvedAppearanceForSettings.ts +11 -5
  68. package/src/features/theme/applyTheme.ts +143 -0
  69. package/src/features/theme/color.ts +83 -0
  70. package/src/features/theme/curated/amber-minimal.json +86 -0
  71. package/src/features/theme/curated/amethyst-haze.json +86 -0
  72. package/src/features/theme/curated/astro-vista.json +86 -0
  73. package/src/features/theme/curated/bold-tech.json +86 -0
  74. package/src/features/theme/curated/bubblegum.json +86 -0
  75. package/src/features/theme/curated/caffeine.json +83 -0
  76. package/src/features/theme/curated/candyland.json +86 -0
  77. package/src/features/theme/curated/catppuccin.json +86 -0
  78. package/src/features/theme/curated/claude.json +86 -0
  79. package/src/features/theme/curated/claymorphism.json +86 -0
  80. package/src/features/theme/curated/clean-slate.json +86 -0
  81. package/src/features/theme/curated/cosmic-night.json +86 -0
  82. package/src/features/theme/curated/cyberpunk.json +86 -0
  83. package/src/features/theme/curated/darkmatter.json +86 -0
  84. package/src/features/theme/curated/doom-64.json +86 -0
  85. package/src/features/theme/curated/elegant-luxury.json +86 -0
  86. package/src/features/theme/curated/graphite.json +86 -0
  87. package/src/features/theme/curated/index.ts +260 -0
  88. package/src/features/theme/curated/kodama-grove.json +86 -0
  89. package/src/features/theme/curated/light-green.json +87 -0
  90. package/src/features/theme/curated/midnight-bloom.json +86 -0
  91. package/src/features/theme/curated/mocha-mousse.json +86 -0
  92. package/src/features/theme/curated/modern-minimal.json +86 -0
  93. package/src/features/theme/curated/mono.json +84 -0
  94. package/src/features/theme/curated/nature.json +86 -0
  95. package/src/features/theme/curated/neo-brutalism.json +86 -0
  96. package/src/features/theme/curated/northern-lights.json +86 -0
  97. package/src/features/theme/curated/notebook.json +87 -0
  98. package/src/features/theme/curated/ocean-breeze.json +86 -0
  99. package/src/features/theme/curated/pastel-dreams.json +86 -0
  100. package/src/features/theme/curated/perpetuity.json +86 -0
  101. package/src/features/theme/curated/quantum-rose.json +86 -0
  102. package/src/features/theme/curated/retro-arcade.json +86 -0
  103. package/src/features/theme/curated/sage-garden.json +86 -0
  104. package/src/features/theme/curated/shadcn.json +83 -0
  105. package/src/features/theme/curated/shellui.json +82 -0
  106. package/src/features/theme/curated/soft-pop.json +86 -0
  107. package/src/features/theme/curated/solar-dusk.json +86 -0
  108. package/src/features/theme/curated/starry-night.json +86 -0
  109. package/src/features/theme/curated/sunset-horizon.json +86 -0
  110. package/src/features/theme/curated/supabase.json +85 -0
  111. package/src/features/theme/curated/t3-chat.json +83 -0
  112. package/src/features/theme/curated/tangerine.json +86 -0
  113. package/src/features/theme/curated/twitter.json +86 -0
  114. package/src/features/theme/curated/vercel.json +86 -0
  115. package/src/features/theme/curated/vintage-paper.json +86 -0
  116. package/src/features/theme/curated/violet-bloom.json +87 -0
  117. package/src/features/theme/curated/zen-inspired.json +87 -0
  118. package/src/features/theme/index.ts +76 -0
  119. package/src/features/theme/normalize.ts +159 -0
  120. package/src/features/theme/registry.ts +50 -0
  121. package/src/features/theme/resolveConfig.ts +182 -0
  122. package/src/features/theme/safeApplyTheme.ts +147 -0
  123. package/src/features/theme/themes.spec.ts +276 -0
  124. package/src/features/theme/themes.ts +82 -558
  125. package/src/features/theme/tokenKeys.ts +60 -0
  126. package/src/features/theme/types.ts +170 -0
  127. package/src/features/theme/useTheme.tsx +48 -50
  128. package/src/hooks/use-mobile.tsx +19 -0
  129. package/src/i18n/translations/en/common.json +41 -0
  130. package/src/i18n/translations/en/settings.json +10 -2
  131. package/src/i18n/translations/fr/common.json +41 -0
  132. package/src/i18n/translations/fr/settings.json +10 -2
  133. package/src/index.css +372 -128
  134. package/src/index.ts +71 -0
  135. package/src/lib/z-index.ts +4 -1
  136. package/src/routes/components/IndexRoute.tsx +12 -2
  137. package/src/routes/components/NavigationItemRoute.tsx +1 -10
  138. package/src/routes/hooks/useNavigationItems.ts +29 -44
  139. package/src/routes/routes.tsx +58 -27
  140. package/tailwind.config.js +27 -27
  141. package/src/features/layouts/sidebar/BottomNavItem.tsx +0 -88
  142. package/src/features/layouts/sidebar/MobileBottomNav.tsx +0 -168
@@ -2,12 +2,17 @@
2
2
 
3
3
  import {
4
4
  forwardRef,
5
+ useCallback,
6
+ useEffect,
7
+ useRef,
8
+ useState,
5
9
  type ComponentProps,
6
10
  type ComponentPropsWithoutRef,
7
11
  type ComponentRef,
8
12
  type ReactNode,
9
13
  type CSSProperties,
10
14
  type HTMLAttributes,
15
+ type PointerEvent as ReactPointerEvent,
11
16
  } from 'react';
12
17
  import { Drawer as VaulDrawer } from 'vaul';
13
18
  import { cn } from '../../lib/utils';
@@ -15,10 +20,14 @@ import { Z_INDEX } from '../../lib/z-index';
15
20
 
16
21
  export type DrawerDirection = 'top' | 'bottom' | 'left' | 'right';
17
22
 
23
+ const MIN_DRAWER_SIZE = 240;
24
+ const VIEWPORT_MARGIN = 8;
25
+
18
26
  const Drawer = ({
19
27
  open,
20
28
  onOpenChange,
21
29
  direction = 'right',
30
+ dismissible = true,
22
31
  ...props
23
32
  }: ComponentProps<typeof VaulDrawer.Root> & {
24
33
  direction?: DrawerDirection;
@@ -27,6 +36,7 @@ const Drawer = ({
27
36
  open={open}
28
37
  onOpenChange={onOpenChange}
29
38
  direction={direction}
39
+ dismissible={dismissible}
30
40
  {...props}
31
41
  />
32
42
  );
@@ -40,13 +50,24 @@ const DrawerPortal = VaulDrawer.Portal;
40
50
 
41
51
  const DrawerOverlay = forwardRef<
42
52
  ComponentRef<typeof VaulDrawer.Overlay>,
43
- ComponentPropsWithoutRef<typeof VaulDrawer.Overlay>
44
- >(({ className, ...props }, ref) => (
53
+ ComponentPropsWithoutRef<typeof VaulDrawer.Overlay> & {
54
+ /** When false, pointer events pass through and overlay clicks do not dismiss. */
55
+ closeOnClick?: boolean;
56
+ }
57
+ >(({ className, closeOnClick = true, onClick, ...props }, ref) => (
45
58
  <VaulDrawer.Overlay
46
59
  ref={ref}
47
60
  data-drawer-overlay
48
- className={cn('fixed inset-0 bg-[hsl(var(--background)/0.8)] backdrop-blur-[1px]', className)}
61
+ className={cn('fixed inset-0 bg-black/50 backdrop-blur-[1px]', className)}
49
62
  style={{ zIndex: Z_INDEX.DRAWER_OVERLAY }}
63
+ onClick={(e) => {
64
+ if (!closeOnClick) {
65
+ e.preventDefault();
66
+ e.stopPropagation();
67
+ return;
68
+ }
69
+ onClick?.(e);
70
+ }}
50
71
  {...props}
51
72
  />
52
73
  ));
@@ -54,13 +75,46 @@ DrawerOverlay.displayName = VaulDrawer.Overlay.displayName;
54
75
 
55
76
  /** Base layout classes per direction — max dimension is applied via style so size prop can override. */
56
77
  const drawerContentByDirection: Record<DrawerDirection, string> = {
57
- bottom: 'fixed inset-x-0 bottom-0 mt-24 flex h-auto flex-col border border-border bg-background',
58
- top: 'fixed inset-x-0 top-0 mb-24 flex h-auto flex-col border border-border bg-background',
59
- left: 'fixed inset-y-0 left-0 mr-24 flex h-full w-auto flex-col border border-border bg-background',
78
+ bottom:
79
+ 'fixed inset-x-0 bottom-0 mt-24 flex h-auto flex-col rounded-t-xl border border-border bg-background',
80
+ top: 'fixed inset-x-0 top-0 mb-24 flex h-auto flex-col rounded-b-xl border border-border bg-background',
81
+ left: 'fixed inset-y-0 left-0 mr-24 flex h-full w-auto flex-col rounded-r-xl border border-border bg-background',
60
82
  right:
61
- 'fixed inset-y-0 right-0 ml-24 flex h-full w-auto flex-col border border-border bg-background',
83
+ 'fixed inset-y-0 right-0 ml-24 flex h-full w-auto flex-col rounded-l-xl border border-border bg-background',
62
84
  };
63
85
 
86
+ /** Free-edge resize handle (opposite the anchored side). */
87
+ const resizeHandleByDirection: Record<DrawerDirection, { className: string; cursor: string }> = {
88
+ right: {
89
+ className: 'absolute left-0 top-3 bottom-3 w-1.5 -translate-x-1/2',
90
+ cursor: 'ew-resize',
91
+ },
92
+ left: {
93
+ className: 'absolute right-0 top-3 bottom-3 w-1.5 translate-x-1/2',
94
+ cursor: 'ew-resize',
95
+ },
96
+ bottom: {
97
+ className: 'absolute top-0 left-3 right-3 h-1.5 -translate-y-1/2',
98
+ cursor: 'ns-resize',
99
+ },
100
+ top: {
101
+ className: 'absolute bottom-0 left-3 right-3 h-1.5 translate-y-1/2',
102
+ cursor: 'ns-resize',
103
+ },
104
+ };
105
+
106
+ function maxPrimarySize(direction: DrawerDirection): number {
107
+ const isVertical = direction === 'top' || direction === 'bottom';
108
+ return Math.max(
109
+ MIN_DRAWER_SIZE,
110
+ (isVertical ? window.innerHeight : window.innerWidth) - VIEWPORT_MARGIN,
111
+ );
112
+ }
113
+
114
+ function clampDrawerSize(px: number, direction: DrawerDirection): number {
115
+ return Math.min(Math.max(px, MIN_DRAWER_SIZE), maxPrimarySize(direction));
116
+ }
117
+
64
118
  interface DrawerContentProps extends Omit<
65
119
  ComponentPropsWithoutRef<typeof VaulDrawer.Content>,
66
120
  'direction'
@@ -71,56 +125,234 @@ interface DrawerContentProps extends Omit<
71
125
  className?: string;
72
126
  children?: ReactNode;
73
127
  style?: CSSProperties;
128
+ /** When true (default), render the chrome close (×) control. */
129
+ showCloseButton?: boolean;
130
+ /** When true, render a native drag handle for swipe-to-dismiss. */
131
+ showDragHandle?: boolean;
132
+ /** Forwarded to overlay — when false, backdrop clicks do not close. */
133
+ closeOnOverlayClick?: boolean;
134
+ /**
135
+ * When true (default), show a resize handle on the free edge (desktop).
136
+ * Drawers are not movable.
137
+ */
138
+ resizable?: boolean;
139
+ /** When the drawer opens, manual resize override is cleared. */
140
+ open?: boolean;
74
141
  }
75
142
 
76
143
  const DrawerContent = forwardRef<ComponentRef<typeof VaulDrawer.Content>, DrawerContentProps>(
77
- ({ className, direction = 'right', size, children, style, ...props }, ref) => {
144
+ (
145
+ {
146
+ className,
147
+ direction = 'right',
148
+ size,
149
+ children,
150
+ style,
151
+ showCloseButton = true,
152
+ showDragHandle = false,
153
+ closeOnOverlayClick = true,
154
+ resizable = true,
155
+ open,
156
+ ...props
157
+ },
158
+ ref,
159
+ ) => {
78
160
  const pos: DrawerDirection = direction;
79
161
  const isVertical = pos === 'top' || pos === 'bottom';
80
- // Set dimension via inline style; use both width/height and max so Vaul/defaults don't override.
81
- const effectiveSize = size?.trim() || (isVertical ? '80vh' : '80vw');
82
- // Use min() to ensure drawer doesn't exceed viewport on mobile devices
83
- const sizeStyle = isVertical
84
- ? { height: effectiveSize, maxHeight: `min(${effectiveSize}, 100vh)` }
85
- : { width: effectiveSize, maxWidth: `min(${effectiveSize}, 100%)` };
162
+ const contentRef = useRef<HTMLDivElement | null>(null);
163
+ const [overridePx, setOverridePx] = useState<number | null>(null);
164
+ const [isResizing, setIsResizing] = useState(false);
165
+ const resizeStart = useRef<{ pointer: number; size: number } | null>(null);
166
+ const wasOpenRef = useRef(false);
167
+
168
+ // Each open starts from the requested/default size — ignore prior manual resize
169
+ useEffect(() => {
170
+ const justOpened = open === true && !wasOpenRef.current;
171
+ wasOpenRef.current = open === true;
172
+ if (justOpened) {
173
+ setOverridePx(null);
174
+ resizeStart.current = null;
175
+ setIsResizing(false);
176
+ }
177
+ }, [open]);
178
+
179
+ // New size/direction from the open call → drop manual override
180
+ useEffect(() => {
181
+ setOverridePx(null);
182
+ }, [size, direction]);
183
+
184
+ // Keep resized drawer within the viewport when the browser shrinks
185
+ useEffect(() => {
186
+ if (overridePx === null) return;
187
+ const onResize = () => {
188
+ setOverridePx((prev) => (prev === null ? prev : clampDrawerSize(prev, pos)));
189
+ };
190
+ window.addEventListener('resize', onResize);
191
+ return () => window.removeEventListener('resize', onResize);
192
+ }, [overridePx, pos]);
193
+
194
+ const setRefs = useCallback(
195
+ (node: HTMLDivElement | null) => {
196
+ contentRef.current = node;
197
+ if (typeof ref === 'function') ref(node);
198
+ else if (ref) ref.current = node;
199
+ },
200
+ [ref],
201
+ );
202
+
203
+ const beginResize = useCallback(
204
+ (e: ReactPointerEvent<HTMLDivElement>) => {
205
+ if (!resizable) return;
206
+ e.preventDefault();
207
+ e.stopPropagation();
208
+ const el = contentRef.current;
209
+ if (!el) return;
210
+ const rect = el.getBoundingClientRect();
211
+ const current = isVertical ? rect.height : rect.width;
212
+ resizeStart.current = {
213
+ pointer: isVertical ? e.clientY : e.clientX,
214
+ size: overridePx ?? current,
215
+ };
216
+ setOverridePx(clampDrawerSize(overridePx ?? current, pos));
217
+ setIsResizing(true);
218
+ e.currentTarget.setPointerCapture(e.pointerId);
219
+ },
220
+ [resizable, isVertical, overridePx, pos],
221
+ );
222
+
223
+ const onResizeMove = useCallback(
224
+ (e: ReactPointerEvent<HTMLDivElement>) => {
225
+ const start = resizeStart.current;
226
+ if (!start) return;
227
+ const pointer = isVertical ? e.clientY : e.clientX;
228
+ const delta = pointer - start.pointer;
229
+ // Dragging the free edge: right drawer grows when pointer moves left
230
+ let next = start.size;
231
+ if (pos === 'right') next = start.size - delta;
232
+ else if (pos === 'left') next = start.size + delta;
233
+ else if (pos === 'bottom') next = start.size - delta;
234
+ else next = start.size + delta;
235
+ setOverridePx(clampDrawerSize(next, pos));
236
+ },
237
+ [isVertical, pos],
238
+ );
239
+
240
+ const endResize = useCallback((e: ReactPointerEvent<HTMLDivElement>) => {
241
+ if (!resizeStart.current) return;
242
+ try {
243
+ e.currentTarget.releasePointerCapture(e.pointerId);
244
+ } catch {
245
+ // ignore
246
+ }
247
+ resizeStart.current = null;
248
+ setIsResizing(false);
249
+ }, []);
250
+
251
+ const effectiveSize =
252
+ overridePx !== null ? `${overridePx}px` : size?.trim() || (isVertical ? '80dvh' : '80vw');
253
+ const sizeStyle: CSSProperties =
254
+ overridePx !== null
255
+ ? isVertical
256
+ ? {
257
+ height: effectiveSize,
258
+ maxHeight: `min(${effectiveSize}, calc(100dvh - ${VIEWPORT_MARGIN}px))`,
259
+ }
260
+ : {
261
+ width: effectiveSize,
262
+ maxWidth: `min(${effectiveSize}, calc(100vw - ${VIEWPORT_MARGIN}px))`,
263
+ }
264
+ : size === null
265
+ ? isVertical
266
+ ? { maxHeight: 'min(90dvh, 100dvh)' }
267
+ : { maxWidth: 'min(90vw, 100%)' }
268
+ : isVertical
269
+ ? { height: effectiveSize, maxHeight: `min(${effectiveSize}, 100dvh)` }
270
+ : { width: effectiveSize, maxWidth: `min(${effectiveSize}, 100%)` };
271
+
272
+ const sideHandleClass =
273
+ pos === 'left'
274
+ ? 'absolute right-2 top-1/2 z-20 my-0 h-[100px] w-1.5 -translate-y-1/2 rounded-full'
275
+ : 'absolute left-2 top-1/2 z-20 my-0 h-[100px] w-1.5 -translate-y-1/2 rounded-full';
276
+
277
+ const resizeHandle = resizeHandleByDirection[pos];
278
+
86
279
  return (
87
280
  <DrawerPortal>
88
- <DrawerOverlay />
281
+ <DrawerOverlay closeOnClick={closeOnOverlayClick} />
89
282
  <VaulDrawer.Content
90
- ref={ref}
283
+ ref={setRefs}
91
284
  data-drawer-content
285
+ data-drawer-direction={pos}
286
+ data-drawer-resizing={isResizing ? 'true' : undefined}
92
287
  className={cn('outline-none', drawerContentByDirection[pos], className)}
93
288
  style={{
94
- backgroundColor: 'hsl(var(--background))',
289
+ backgroundColor: 'var(--background)',
95
290
  zIndex: Z_INDEX.DRAWER_CONTENT,
291
+ ...(style?.transition === 'none' || isResizing
292
+ ? { transition: 'none' }
293
+ : {
294
+ transitionProperty: 'height, width, max-height, max-width',
295
+ transitionDuration: '200ms',
296
+ transitionTimingFunction: 'ease',
297
+ }),
96
298
  ...sizeStyle,
97
299
  ...style,
98
300
  }}
99
301
  {...props}
100
302
  >
101
303
  {children}
102
- <VaulDrawer.Close
103
- className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground cursor-pointer"
104
- aria-label="Close"
105
- onPointerDown={(e) => e.currentTarget.click()}
106
- >
107
- <svg
108
- xmlns="http://www.w3.org/2000/svg"
109
- width="24"
110
- height="24"
111
- viewBox="0 0 24 24"
112
- fill="none"
113
- stroke="currentColor"
114
- strokeWidth="2"
115
- strokeLinecap="round"
116
- strokeLinejoin="round"
117
- className="h-4 w-4"
304
+ {showDragHandle &&
305
+ (pos === 'bottom' || pos === 'top' ? (
306
+ <div
307
+ data-drawer-handle-overlay
308
+ className={cn(
309
+ 'pointer-events-none absolute inset-x-0 z-20 flex justify-center bg-transparent',
310
+ pos === 'bottom' ? 'top-0 pt-3' : 'bottom-0 pb-3',
311
+ )}
312
+ >
313
+ <DrawerHandle className="pointer-events-auto !mt-0" />
314
+ </div>
315
+ ) : (
316
+ <DrawerHandle className={cn('rounded-full', sideHandleClass)} />
317
+ ))}
318
+ {showCloseButton && (
319
+ <VaulDrawer.Close
320
+ className="absolute right-4 top-4 z-10 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground cursor-pointer"
321
+ aria-label="Close"
322
+ onPointerDown={(e) => e.currentTarget.click()}
118
323
  >
119
- <path d="M18 6 6 18" />
120
- <path d="m6 6 12 12" />
121
- </svg>
122
- <span className="sr-only">Close</span>
123
- </VaulDrawer.Close>
324
+ <svg
325
+ xmlns="http://www.w3.org/2000/svg"
326
+ width="24"
327
+ height="24"
328
+ viewBox="0 0 24 24"
329
+ fill="none"
330
+ stroke="currentColor"
331
+ strokeWidth="2"
332
+ strokeLinecap="round"
333
+ strokeLinejoin="round"
334
+ className="h-4 w-4"
335
+ >
336
+ <path d="M18 6 6 18" />
337
+ <path d="m6 6 12 12" />
338
+ </svg>
339
+ <span className="sr-only">Close</span>
340
+ </VaulDrawer.Close>
341
+ )}
342
+ {resizable && (
343
+ <div
344
+ data-drawer-resize-handle
345
+ className={cn('z-20 touch-none', resizeHandle.className)}
346
+ style={{ cursor: resizeHandle.cursor }}
347
+ onPointerDown={beginResize}
348
+ onPointerMove={onResizeMove}
349
+ onPointerUp={endResize}
350
+ onPointerCancel={endResize}
351
+ role="separator"
352
+ aria-orientation={isVertical ? 'horizontal' : 'vertical'}
353
+ aria-label="Resize drawer"
354
+ />
355
+ )}
124
356
  </VaulDrawer.Content>
125
357
  </DrawerPortal>
126
358
  );
@@ -178,13 +410,21 @@ const DrawerDescription = forwardRef<
178
410
  ));
179
411
  DrawerDescription.displayName = VaulDrawer.Description.displayName;
180
412
 
181
- const DrawerHandle = ({ className, ...props }: HTMLAttributes<HTMLDivElement>) => (
182
- <div
413
+ /** Theme-aware drag handle — uses Vaul Handle so swipe-to-dismiss works from the bar. */
414
+ const DrawerHandle = forwardRef<
415
+ ComponentRef<typeof VaulDrawer.Handle>,
416
+ ComponentPropsWithoutRef<typeof VaulDrawer.Handle>
417
+ >(({ className, ...props }, ref) => (
418
+ <VaulDrawer.Handle
419
+ ref={ref}
183
420
  data-drawer-handle
184
- className={cn('mx-auto mt-4 h-2 w-[100px] rounded-full bg-muted', className)}
421
+ className={cn(
422
+ 'mx-auto mt-3 h-1.5 w-12 shrink-0 rounded-full bg-muted-foreground/40',
423
+ className,
424
+ )}
185
425
  {...props}
186
426
  />
187
- );
427
+ ));
188
428
  DrawerHandle.displayName = 'DrawerHandle';
189
429
 
190
430
  export {
@@ -12,14 +12,19 @@ const DropdownMenuPortal = DropdownMenuPrimitive.Portal;
12
12
  const DropdownMenuContent = forwardRef<
13
13
  ElementRef<typeof DropdownMenuPrimitive.Content>,
14
14
  ComponentPropsWithoutRef<typeof DropdownMenuPrimitive.Content>
15
- >(({ className, sideOffset = 6, forceMount, ...props }, ref) => (
15
+ >(({ className, sideOffset = 6, collisionPadding = 8, forceMount, ...props }, ref) => (
16
16
  <DropdownMenuPrimitive.Portal>
17
17
  <DropdownMenuPrimitive.Content
18
18
  ref={ref}
19
19
  forceMount={forceMount}
20
20
  sideOffset={sideOffset}
21
+ collisionPadding={collisionPadding}
22
+ avoidCollisions
23
+ sticky="always"
24
+ data-dropdown-menu-content=""
21
25
  className={cn(
22
- 'z-50 min-w-[12rem] overflow-hidden rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md',
26
+ 'pointer-events-auto z-50 min-w-[min(12rem,calc(100vw-1.5rem))] max-w-[calc(100vw-1.5rem)] overflow-x-hidden overflow-y-auto rounded-md border border-border bg-popover p-1 text-popover-foreground shadow-md',
27
+ 'max-h-[min(24rem,var(--radix-dropdown-menu-content-available-height,24rem))]',
23
28
  'data-[state=open]:animate-in data-[state=closed]:animate-out',
24
29
  'data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
25
30
  'data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95',
@@ -0,0 +1,21 @@
1
+ import { forwardRef, type ComponentProps } from 'react';
2
+ import { cn } from '../../lib/utils';
3
+
4
+ const Input = forwardRef<HTMLInputElement, ComponentProps<'input'>>(
5
+ ({ className, type, ...props }, ref) => {
6
+ return (
7
+ <input
8
+ type={type}
9
+ className={cn(
10
+ 'flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',
11
+ className,
12
+ )}
13
+ ref={ref}
14
+ {...props}
15
+ />
16
+ );
17
+ },
18
+ );
19
+ Input.displayName = 'Input';
20
+
21
+ export { Input };
@@ -0,0 +1,23 @@
1
+ import { forwardRef, type ComponentPropsWithoutRef, type ElementRef } from 'react';
2
+ import * as SeparatorPrimitive from '@radix-ui/react-separator';
3
+ import { cn } from '../../lib/utils';
4
+
5
+ const Separator = forwardRef<
6
+ ElementRef<typeof SeparatorPrimitive.Root>,
7
+ ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>
8
+ >(({ className, orientation = 'horizontal', decorative = true, ...props }, ref) => (
9
+ <SeparatorPrimitive.Root
10
+ ref={ref}
11
+ decorative={decorative}
12
+ orientation={orientation}
13
+ className={cn(
14
+ 'shrink-0 bg-border',
15
+ orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',
16
+ className,
17
+ )}
18
+ {...props}
19
+ />
20
+ ));
21
+ Separator.displayName = SeparatorPrimitive.Root.displayName;
22
+
23
+ export { Separator };