@stevederico/skateboard-ui 5.4.0 → 5.6.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ 5.6.0
2
+
3
+ Add Sheet onUserClose
4
+
5
+ 5.5.0
6
+
7
+ Enlarge tap targets
8
+
1
9
  5.4.0
2
10
 
3
11
  Use shadcn dark palette
@@ -11,6 +11,8 @@ export interface SheetProps {
11
11
  title?: string;
12
12
  minHeight?: string;
13
13
  children?: ReactNode;
14
+ /** Called when the person closes the sheet (swipe, outside tap, Escape), not when code calls hide(). */
15
+ onUserClose?: () => void;
14
16
  }
15
17
  /**
16
18
  * Bottom sheet (drawer) component with imperative open/close API.
@@ -21,6 +23,7 @@ export interface SheetProps {
21
23
  * @param {string} [props.title=""] - Sheet header title
22
24
  * @param {string} [props.minHeight="auto"] - Minimum sheet height CSS value
23
25
  * @param {React.ReactNode} props.children - Sheet body content
26
+ * @param {Function} [props.onUserClose] - Called when the person closes the sheet, not when code calls hide()
24
27
  * @param {React.Ref} ref - Ref exposing { show, hide, open, close, toggle }
25
28
  * @returns {JSX.Element} Drawer sheet
26
29
  *
@@ -10,6 +10,7 @@ import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, } from "../ui/drawer.
10
10
  * @param {string} [props.title=""] - Sheet header title
11
11
  * @param {string} [props.minHeight="auto"] - Minimum sheet height CSS value
12
12
  * @param {React.ReactNode} props.children - Sheet body content
13
+ * @param {Function} [props.onUserClose] - Called when the person closes the sheet, not when code calls hide()
13
14
  * @param {React.Ref} ref - Ref exposing { show, hide, open, close, toggle }
14
15
  * @returns {JSX.Element} Drawer sheet
15
16
  *
@@ -30,7 +31,7 @@ import { Drawer, DrawerContent, DrawerHeader, DrawerTitle, } from "../ui/drawer.
30
31
  * }
31
32
  */
32
33
  const MySheet = forwardRef(function MySheet(props, ref) {
33
- const { title = "", minHeight = "auto", children } = props;
34
+ const { title = "", minHeight = "auto", children, onUserClose } = props;
34
35
  const [isOpen, setIsOpen] = useState(false);
35
36
  useImperativeHandle(ref, () => ({
36
37
  show: () => setIsOpen(true),
@@ -39,6 +40,10 @@ const MySheet = forwardRef(function MySheet(props, ref) {
39
40
  close: () => setIsOpen(false),
40
41
  toggle: () => setIsOpen(prev => !prev)
41
42
  }));
42
- return (_jsx(Drawer, { open: isOpen, onOpenChange: setIsOpen, children: _jsxs(DrawerContent, { style: { minHeight }, children: [_jsx(DrawerHeader, { children: _jsx(DrawerTitle, { children: title }) }), _jsx("div", { className: "px-4 pb-4", children: children })] }) }));
43
+ return (_jsx(Drawer, { open: isOpen, onOpenChange: (open) => {
44
+ setIsOpen(open);
45
+ if (!open)
46
+ onUserClose?.();
47
+ }, children: _jsxs(DrawerContent, { style: { minHeight }, children: [_jsx(DrawerHeader, { children: _jsx(DrawerTitle, { children: title }) }), _jsx("div", { className: "px-4 pb-4", children: children })] }) }));
43
48
  });
44
49
  export default MySheet;
@@ -14,7 +14,7 @@ export default function ThemeToggle({ className = "", iconSize = 16, variant = "
14
14
  return null;
15
15
  const isDarkMode = resolvedTheme === 'dark';
16
16
  const toggleTheme = () => setTheme(isDarkMode ? 'light' : 'dark');
17
- return (_jsx(Button, { variant: variant === "landing" ? "outline" : "ghost", size: "icon", onClick: toggleTheme, className: cn(className), "aria-label": "Toggle dark mode", ...props, children: isDarkMode
17
+ return (_jsx(Button, { variant: variant === "landing" ? "outline" : "ghost", size: "icon", onClick: toggleTheme, className: cn("size-11", className), "aria-label": "Toggle dark mode", ...props, children: isDarkMode
18
18
  ? _jsx(Sun, { size: iconSize })
19
19
  : _jsx(Moon, { size: iconSize }) }));
20
20
  }
@@ -20,6 +20,6 @@ export default function TabBar({ className, ...props }) {
20
20
  ];
21
21
  return (_jsx("nav", { className: cn("fixed md:hidden bottom-0 inset-x-0 bg-background z-50", className), role: "navigation", "aria-label": "Main navigation", ...props, children: _jsx("div", { className: "flex justify-around items-center pt-2 pb-4", children: tabs.map((tab) => {
22
22
  const isActive = currentPage === tab.match;
23
- return (_jsxs(Link, { to: tab.to, className: cn("flex flex-col items-center gap-0.5 px-3 transition-colors", isActive ? "text-foreground" : "text-muted-foreground"), "aria-label": tab.title, "aria-current": isActive ? 'page' : undefined, children: [_jsx(ConstantsIcon, { name: tab.icon, size: 24, strokeWidth: isActive ? 2 : 1.5 }), _jsx("span", { className: "text-xs", children: tab.title })] }, tab.title));
23
+ return (_jsxs(Link, { to: tab.to, className: cn("flex min-h-11 min-w-11 flex-col items-center justify-center gap-0.5 px-3 transition-colors", isActive ? "text-foreground" : "text-muted-foreground"), "aria-label": tab.title, "aria-current": isActive ? 'page' : undefined, children: [_jsx(ConstantsIcon, { name: tab.icon, size: 24, strokeWidth: isActive ? 2 : 1.5 }), _jsx("span", { className: "text-xs", children: tab.title })] }, tab.title));
24
24
  }) }) }));
25
25
  }
@@ -58,5 +58,5 @@ export default function SettingsView() {
58
58
  else {
59
59
  navigate('/signin');
60
60
  }
61
- }, children: "Sign In" }) })] }) })), showAuth && (_jsx(Card, { className: "w-full max-w-lg", children: _jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex items-center gap-3", children: [_jsx(Avatar, { children: _jsx(AvatarFallback, { className: "bg-app text-white uppercase font-medium text-sm", children: user.name?.split(' ').map(w => w[0]).join('') || "NA" }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2 capitalize", children: [user.name || "No User", subscription?.status === "active" && _jsx(Badge, { children: "Pro" })] }), _jsx(CardDescription, { className: "font-normal normal-case", children: user.email || "no@user.com" })] })] }), _jsx(CardAction, { children: _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", children: "Sign Out" }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Sign Out" }), _jsx(AlertDialogDescription, { children: "Are you sure you want to sign out? You'll need to sign in again to access your account." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Cancel" }), _jsx(AlertDialogAction, { onClick: signOutClicked, children: "Sign Out" })] })] })] }) })] }) })), _jsx(Card, { className: "w-full max-w-lg", children: _jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Support" }), _jsx(CardDescription, { children: "How can we help?" }), _jsx(CardAction, { children: _jsx(Button, { variant: "outline", size: "sm", onClick: () => { window.location.href = `mailto:${constants.companyEmail}`; }, children: "Contact" }) })] }) }), showAuth && (_jsx(Card, { className: "w-full max-w-lg", children: _jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex items-center gap-2", children: ["Billing", subscription?.status === "active" ? (_jsx(Badge, { children: "Active" })) : subscription?.status === "canceled" ? (_jsx(Badge, { variant: "destructive", children: "Canceled" })) : (_jsx(Badge, { variant: "secondary", children: "Free" }))] }), _jsx(CardDescription, { children: getBillingDescription() }), _jsx(CardAction, { children: stripeID ? (_jsx(Button, { variant: "outline", size: "sm", onClick: () => { showManage(stripeID); }, children: "Manage" })) : (_jsx(Button, { variant: "gradient", size: "sm", onClick: () => { showCheckout(user.email); }, children: "Subscribe" })) })] }) }))] }), _jsx("div", { className: "mt-8 text-center pb-24 md:pb-8", children: _jsxs("p", { className: "text-xs text-muted-foreground", children: ["v", constants.version || '0.0.0'] }) })] }));
61
+ }, children: "Sign In" }) })] }) })), showAuth && (_jsx(Card, { className: "w-full max-w-lg", children: _jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex items-center gap-3", children: [_jsx(Avatar, { children: _jsx(AvatarFallback, { className: "bg-app text-white uppercase font-medium text-sm", children: user.name?.split(' ').map(w => w[0]).join('') || "NA" }) }), _jsxs("div", { children: [_jsxs("div", { className: "flex items-center gap-2 capitalize", children: [user.name || "No User", subscription?.status === "active" && _jsx(Badge, { children: "Pro" })] }), _jsx(CardDescription, { className: "font-normal normal-case", children: user.email || "no@user.com" })] })] }), _jsx(CardAction, { children: _jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { render: _jsx(Button, { variant: "outline", size: "sm", className: "min-h-11 px-4", children: "Sign Out" }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Sign Out" }), _jsx(AlertDialogDescription, { children: "Are you sure you want to sign out? You'll need to sign in again to access your account." })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Cancel" }), _jsx(AlertDialogAction, { onClick: signOutClicked, children: "Sign Out" })] })] })] }) })] }) })), _jsx(Card, { className: "w-full max-w-lg", children: _jsxs(CardHeader, { children: [_jsx(CardTitle, { children: "Support" }), _jsx(CardDescription, { children: "How can we help?" }), _jsx(CardAction, { children: _jsx(Button, { variant: "outline", size: "sm", onClick: () => { window.location.href = `mailto:${constants.companyEmail}`; }, children: "Contact" }) })] }) }), showAuth && (_jsx(Card, { className: "w-full max-w-lg", children: _jsxs(CardHeader, { children: [_jsxs(CardTitle, { className: "flex items-center gap-2", children: ["Billing", subscription?.status === "active" ? (_jsx(Badge, { children: "Active" })) : subscription?.status === "canceled" ? (_jsx(Badge, { variant: "destructive", children: "Canceled" })) : (_jsx(Badge, { variant: "secondary", children: "Free" }))] }), _jsx(CardDescription, { children: getBillingDescription() }), _jsx(CardAction, { children: stripeID ? (_jsx(Button, { variant: "outline", size: "sm", onClick: () => { showManage(stripeID); }, children: "Manage" })) : (_jsx(Button, { variant: "gradient", size: "sm", onClick: () => { showCheckout(user.email); }, children: "Subscribe" })) })] }) }))] }), _jsx("div", { className: "mt-8 text-center pb-24 md:pb-8", children: _jsxs("p", { className: "text-xs text-muted-foreground", children: ["v", constants.version || '0.0.0'] }) })] }));
62
62
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stevederico/skateboard-ui",
3
3
  "private": false,
4
- "version": "5.4.0",
4
+ "version": "5.6.0",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {