@olwiba/ui 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -13,6 +13,7 @@ type UIMode = 'default' | 'playful' | 'smooth';
13
13
  interface OlwibaUIContextValue {
14
14
  isMobile: boolean;
15
15
  mode: UIMode;
16
+ setMode: (mode: UIMode) => void;
16
17
  }
17
18
  interface OlwibaUIProviderProps {
18
19
  children: React.ReactNode;
@@ -31,7 +32,7 @@ interface OlwibaUIProviderProps {
31
32
  */
32
33
  mode?: UIMode;
33
34
  }
34
- declare function OlwibaUIProvider({ children, isMobile: isMobileProp, mode }: OlwibaUIProviderProps): react_jsx_runtime.JSX.Element;
35
+ declare function OlwibaUIProvider({ children, isMobile: isMobileProp, mode: initialMode }: OlwibaUIProviderProps): react_jsx_runtime.JSX.Element;
35
36
  declare function useOlwibaUI(): OlwibaUIContextValue;
36
37
  /** Returns just the current UI mode from context. */
37
38
  declare function useUIMode(): UIMode;
@@ -541,10 +542,11 @@ interface NavbarProps {
541
542
  href: string;
542
543
  };
543
544
  };
544
- showThemeToggle?: boolean;
545
+ /** Icon-button controls rendered right-of-nav, left-of-CTA. Pass e.g. ModeSwitchMinimal, ThemeSwitchMinimal. */
546
+ controls?: React.ReactNode[];
545
547
  renderLink?: AppShellRenderLink;
546
548
  }
547
- declare function Navbar({ brand, navLinks, cta, showThemeToggle, renderLink, }: NavbarProps): react_jsx_runtime.JSX.Element;
549
+ declare function Navbar({ brand, navLinks, cta, controls, renderLink, }: NavbarProps): react_jsx_runtime.JSX.Element;
548
550
 
549
551
  interface FooterProps {
550
552
  brand: {
@@ -884,6 +886,8 @@ declare function Suspensed({ children, fallback }: SuspensedProps): react_jsx_ru
884
886
 
885
887
  declare function ThemeSwitchMinimal(): react_jsx_runtime.JSX.Element;
886
888
 
889
+ declare function ModeSwitchMinimal(): react_jsx_runtime.JSX.Element;
890
+
887
891
  interface ThemeColorUpdaterProps {
888
892
  colorTheme?: string;
889
893
  }
@@ -1020,4 +1024,4 @@ interface UsePaginationReturn {
1020
1024
  }
1021
1025
  declare function usePagination(total: number, pageSize: number): UsePaginationReturn;
1022
1026
 
1023
- export { AppContent, type AppContentProps, AppGrid, AppGridCell, type AppGridCellProps, type AppGridProps, type AppNavItem, AppScreen, AppShell, type AppShellAction, type AppShellBrand, type AppShellProps, type AppShellRenderLink, type AppShellUser, type AuthFormProps, AuthSection, type AuthSectionProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, ChangelogCard, type ChangelogCardProps, ChangelogList, type ChangelogListProps, Checkbox, type CheckboxProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, type ContactInfoItem, ContactSection, type ContactSectionProps, ContextMenu, type ContextMenuDef, type ContextMenuProps, CountUp, type CountUpProps, CtaSection, type CtaSectionProps, DevBanner, type DevBannerProps, Dock, type DockItem, type DockProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, FadeIn, type FadeInProps, FaqSection, type FaqSectionProps, FeatureCard, type FeatureCardProps, FeaturesSection, type FeaturesSectionProps, Footer, type FooterProps, FullPageSpinner, GlassCard, type GlassCardProps, Grid, GridItem, type GridItemProps, type GridProps, HeroSection, type HeroSectionProps, type Hotkey, ImageCard, type ImageCardProps, Input, type InputProps, LogoStrip, type LogoStripProps, Navbar, type NavbarProps, NewsletterSection, type NewsletterSectionProps, OlwibaUIProvider, type OlwibaUIProviderProps, Overlay, type OverlayProps, type OverlayVariant, PageHeader, type PageHeaderBackButton, type PageHeaderBreadcrumb, type PageHeaderProps, PageTransition, type PageTransitionProps, PhoneFrame, type PhoneFrameProps, PostCard, type PostCardProps, PostList, type PostListProps, PricingCard, type PricingCardProps, type PricingFeature, type PricingPlan, PricingSection, type PricingSectionProps, PublicPageFrame, type PublicPageFrameProps, RegisterHotkeys, RootErrorFallback, Section, type SectionProps, SectionTitle, type SectionTitleProps, Spotlight, type SpotlightGroup, type SpotlightItem, type SpotlightProps, Stack, type StackProps, StaggerChildren, type StaggerChildrenProps, StatCard, type StatCardProps, StatsSection, type StatsSectionProps, Suspensed, Switch, type SwitchProps, TeamSection, TestimonialCard, type TestimonialCardProps, TestimonialsSection, type TestimonialsSectionProps, Textarea, type TextareaProps, ThemeColorUpdater, ThemeSwitchMinimal, type UIMode, Underlay, type UnderlayProps, type UnderlayVariant, type UpgradeComparisonRow, UpgradePrompt, type UpgradePromptProps, type UseConfirmReturn, type UseControlledOpenReturn, type UsePaginationReturn, VersionBanner, cn, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
1027
+ export { AppContent, type AppContentProps, AppGrid, AppGridCell, type AppGridCellProps, type AppGridProps, type AppNavItem, AppScreen, AppShell, type AppShellAction, type AppShellBrand, type AppShellProps, type AppShellRenderLink, type AppShellUser, type AuthFormProps, AuthSection, type AuthSectionProps, Badge, type BadgeProps, Button, type ButtonProps, Card, type CardProps, ChangelogCard, type ChangelogCardProps, ChangelogList, type ChangelogListProps, Checkbox, type CheckboxProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, type ContactInfoItem, ContactSection, type ContactSectionProps, ContextMenu, type ContextMenuDef, type ContextMenuProps, CountUp, type CountUpProps, CtaSection, type CtaSectionProps, DevBanner, type DevBannerProps, Dock, type DockItem, type DockProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, FadeIn, type FadeInProps, FaqSection, type FaqSectionProps, FeatureCard, type FeatureCardProps, FeaturesSection, type FeaturesSectionProps, Footer, type FooterProps, FullPageSpinner, GlassCard, type GlassCardProps, Grid, GridItem, type GridItemProps, type GridProps, HeroSection, type HeroSectionProps, type Hotkey, ImageCard, type ImageCardProps, Input, type InputProps, LogoStrip, type LogoStripProps, ModeSwitchMinimal, Navbar, type NavbarProps, NewsletterSection, type NewsletterSectionProps, OlwibaUIProvider, type OlwibaUIProviderProps, Overlay, type OverlayProps, type OverlayVariant, PageHeader, type PageHeaderBackButton, type PageHeaderBreadcrumb, type PageHeaderProps, PageTransition, type PageTransitionProps, PhoneFrame, type PhoneFrameProps, PostCard, type PostCardProps, PostList, type PostListProps, PricingCard, type PricingCardProps, type PricingFeature, type PricingPlan, PricingSection, type PricingSectionProps, PublicPageFrame, type PublicPageFrameProps, RegisterHotkeys, RootErrorFallback, Section, type SectionProps, SectionTitle, type SectionTitleProps, Spotlight, type SpotlightGroup, type SpotlightItem, type SpotlightProps, Stack, type StackProps, StaggerChildren, type StaggerChildrenProps, StatCard, type StatCardProps, StatsSection, type StatsSectionProps, Suspensed, Switch, type SwitchProps, TeamSection, TestimonialCard, type TestimonialCardProps, TestimonialsSection, type TestimonialsSectionProps, Textarea, type TextareaProps, ThemeColorUpdater, ThemeSwitchMinimal, type UIMode, Underlay, type UnderlayProps, type UnderlayVariant, type UpgradeComparisonRow, UpgradePrompt, type UpgradePromptProps, type UseConfirmReturn, type UseControlledOpenReturn, type UsePaginationReturn, VersionBanner, cn, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
package/dist/index.js CHANGED
@@ -5,17 +5,20 @@ import { useState, useEffect } from 'react';
5
5
  import { Button as Button$1, Card as Card$1, Input as Input$1, Textarea as Textarea$1, Checkbox as Checkbox$1, Switch as Switch$1, useIsMobile, UIVariantProvider, Badge as Badge$1, cn as cn$1, Table, TableHeader, TableRow, TableHead, TableBody, TableCell, Avatar, AvatarImage, AvatarFallback, Separator, Accordion, AccordionItem, AccordionTrigger, AccordionContent, Label, Sheet, SheetTrigger, SheetContent, CommandDialog, CommandInput, CommandList, CommandEmpty, CommandSeparator, CommandGroup, CommandItem, TooltipProvider, Tooltip, TooltipTrigger, TooltipContent, ContextMenu as ContextMenu$1, ContextMenuTrigger, ContextMenuContent, AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction, Spinner, SidebarProvider, SidebarInset, CardHeader, CardTitle, CardDescription, CardContent, ContextMenuSeparator, ContextMenuLabel, ContextMenuSub, ContextMenuSubTrigger, ContextMenuSubContent, ContextMenuItem, ContextMenuShortcut, Sidebar, SidebarHeader, SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarContent, SidebarGroup, SidebarGroupContent, SidebarFooter, SidebarTrigger, useSidebar, DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuGroup, DropdownMenuItem } from '@olwiba/cn';
6
6
  export { CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@olwiba/cn';
7
7
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
- import { Compass, ArrowLeft, X, ArrowRight, Sparkles, Check, Minus, Quote, Star, Twitter, Github, Linkedin, Mail, Phone, MapPin, MessageSquare, Send, Sun, Moon, Menu, Search, TrendingUp, TrendingDown, ChevronRight, ChevronLeft, AlertTriangle, Loader2, ShieldCheck, Building2, MoreVerticalIcon, CreditCardIcon, BellIcon, LogOutIcon } from 'lucide-react';
8
+ import { Compass, ArrowLeft, X, ArrowRight, Sparkles, Check, Minus, Quote, Star, Twitter, Github, Linkedin, Mail, Phone, MapPin, MessageSquare, Send, Menu, Search, TrendingUp, TrendingDown, ChevronRight, ChevronLeft, Sun, Moon, AlertTriangle, Loader2, Layers, LayoutGrid, ShieldCheck, Building2, MoreVerticalIcon, CreditCardIcon, BellIcon, LogOutIcon } from 'lucide-react';
9
9
 
10
10
  var OlwibaUIContext = React25.createContext({
11
11
  isMobile: false,
12
- mode: "default"
12
+ mode: "default",
13
+ setMode: () => {
14
+ }
13
15
  });
14
- function OlwibaUIProvider({ children, isMobile: isMobileProp, mode = "default" }) {
16
+ function OlwibaUIProvider({ children, isMobile: isMobileProp, mode: initialMode = "default" }) {
15
17
  const detectedMobile = useIsMobile();
16
18
  const isMobile = isMobileProp ?? detectedMobile;
19
+ const [mode, setMode] = React25.useState(initialMode);
17
20
  const variant = mode !== "default" ? mode : void 0;
18
- return /* @__PURE__ */ jsx(OlwibaUIContext.Provider, { value: { isMobile, mode }, children: /* @__PURE__ */ jsx(UIVariantProvider, { mode: variant, children }) });
21
+ return /* @__PURE__ */ jsx(OlwibaUIContext.Provider, { value: { isMobile, mode, setMode }, children: /* @__PURE__ */ jsx(UIVariantProvider, { mode: variant, children }) });
19
22
  }
20
23
  function useOlwibaUI() {
21
24
  return React25.useContext(OlwibaUIContext);
@@ -1569,38 +1572,17 @@ function ContactSection({
1569
1572
  ] }) })
1570
1573
  ] }) });
1571
1574
  }
1572
- function ThemeSwitchMinimal() {
1573
- const [theme, setThemeState] = React25.useState("dark");
1574
- React25.useEffect(() => {
1575
- const stored = localStorage.getItem("theme");
1576
- const resolved = stored ?? (document.documentElement.classList.contains("dark") ? "dark" : "light");
1577
- setThemeState(resolved);
1578
- }, []);
1579
- const toggle = () => {
1580
- const next = theme === "dark" ? "light" : "dark";
1581
- setThemeState(next);
1582
- localStorage.setItem("theme", next);
1583
- document.documentElement.classList.toggle("dark", next === "dark");
1584
- };
1585
- return /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "icon", onClick: toggle, className: "size-8", "aria-label": "Toggle theme", children: /* @__PURE__ */ jsx(
1586
- "span",
1587
- {
1588
- className: "inline-flex size-4 items-center justify-center animate-in fade-in zoom-in-75 spin-in-90 duration-200 motion-reduce:animate-none",
1589
- children: theme === "dark" ? /* @__PURE__ */ jsx(Sun, { className: "size-4" }) : /* @__PURE__ */ jsx(Moon, { className: "size-4" })
1590
- },
1591
- theme
1592
- ) });
1593
- }
1594
1575
  var defaultRenderLink7 = ({ href, children, className }) => /* @__PURE__ */ jsx("a", { href, className, children });
1595
1576
  function Navbar({
1596
1577
  brand,
1597
1578
  navLinks,
1598
1579
  cta,
1599
- showThemeToggle = false,
1580
+ controls,
1600
1581
  renderLink = defaultRenderLink7
1601
1582
  }) {
1602
1583
  const [open, setOpen] = React25.useState(false);
1603
1584
  const brandHref = brand.href ?? "/";
1585
+ const hasRightContent = controls?.length || cta?.primary || cta?.secondary;
1604
1586
  return /* @__PURE__ */ jsx("section", { className: "overflow-hidden rounded-2xl border bg-card", children: /* @__PURE__ */ jsxs("nav", { className: "grid h-16 grid-cols-[1fr_auto_1fr] items-center px-6", children: [
1605
1587
  renderLink({
1606
1588
  href: brandHref,
@@ -1609,12 +1591,14 @@ function Navbar({
1609
1591
  /* @__PURE__ */ jsx("span", { children: brand.name })
1610
1592
  ] })
1611
1593
  }),
1612
- /* @__PURE__ */ jsx("div", { className: "hidden items-center gap-1 md:flex", children: navLinks.map((link) => /* @__PURE__ */ jsx("span", { children: renderLink({
1594
+ /* @__PURE__ */ jsx("div", { className: `hidden items-center gap-1 md:flex ${!hasRightContent ? "col-span-2 justify-end" : ""}`, children: navLinks.map((link) => /* @__PURE__ */ jsx("span", { children: renderLink({
1613
1595
  href: link.href,
1614
1596
  className: "rounded-md px-3 py-1.5 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground",
1615
1597
  children: link.label
1616
1598
  }) }, link.label)) }),
1617
- /* @__PURE__ */ jsxs("div", { className: "hidden items-center justify-end gap-3 md:flex", children: [
1599
+ hasRightContent && /* @__PURE__ */ jsxs("div", { className: "hidden items-center justify-end gap-2 md:flex", children: [
1600
+ controls?.map((control, i) => /* @__PURE__ */ jsx(React25.Fragment, { children: control }, i)),
1601
+ (cta?.secondary || cta?.primary) && controls?.length ? /* @__PURE__ */ jsx("div", { className: "mx-1 h-4 w-px bg-border" }) : null,
1618
1602
  cta?.secondary && renderLink({
1619
1603
  href: cta.secondary.href,
1620
1604
  children: /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "sm", children: cta.secondary.label })
@@ -1622,8 +1606,7 @@ function Navbar({
1622
1606
  cta?.primary && renderLink({
1623
1607
  href: cta.primary.href,
1624
1608
  children: /* @__PURE__ */ jsx(Button$1, { size: "sm", children: cta.primary.label })
1625
- }),
1626
- showThemeToggle && /* @__PURE__ */ jsx(ThemeSwitchMinimal, {})
1609
+ })
1627
1610
  ] }),
1628
1611
  /* @__PURE__ */ jsxs(Sheet, { open, onOpenChange: setOpen, children: [
1629
1612
  /* @__PURE__ */ jsx(SheetTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(Button$1, { variant: "ghost", size: "icon", className: "justify-self-end md:hidden", children: [
@@ -1640,7 +1623,7 @@ function Navbar({
1640
1623
  ] })
1641
1624
  }) }),
1642
1625
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
1643
- showThemeToggle && /* @__PURE__ */ jsx(ThemeSwitchMinimal, {}),
1626
+ controls?.map((control, i) => /* @__PURE__ */ jsx(React25.Fragment, { children: control }, i)),
1644
1627
  /* @__PURE__ */ jsxs(Button$1, { variant: "ghost", size: "icon", onClick: () => setOpen(false), children: [
1645
1628
  /* @__PURE__ */ jsx(X, { className: "size-4" }),
1646
1629
  /* @__PURE__ */ jsx("span", { className: "sr-only", children: "Close menu" })
@@ -2255,6 +2238,54 @@ function PageHeader({
2255
2238
  function Suspensed({ children, fallback }) {
2256
2239
  return /* @__PURE__ */ jsx(React25.Suspense, { fallback: fallback ?? /* @__PURE__ */ jsx(Spinner, {}), children });
2257
2240
  }
2241
+ function ThemeSwitchMinimal() {
2242
+ const [theme, setThemeState] = React25.useState("dark");
2243
+ React25.useEffect(() => {
2244
+ const stored = localStorage.getItem("theme");
2245
+ const resolved = stored ?? (document.documentElement.classList.contains("dark") ? "dark" : "light");
2246
+ setThemeState(resolved);
2247
+ }, []);
2248
+ const toggle = () => {
2249
+ const next = theme === "dark" ? "light" : "dark";
2250
+ setThemeState(next);
2251
+ localStorage.setItem("theme", next);
2252
+ document.documentElement.classList.toggle("dark", next === "dark");
2253
+ };
2254
+ return /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "icon", onClick: toggle, className: "size-8", "aria-label": "Toggle theme", children: /* @__PURE__ */ jsx(
2255
+ "span",
2256
+ {
2257
+ className: "inline-flex size-4 items-center justify-center animate-in fade-in zoom-in-75 spin-in-90 duration-200 motion-reduce:animate-none",
2258
+ children: theme === "dark" ? /* @__PURE__ */ jsx(Sun, { className: "size-4" }) : /* @__PURE__ */ jsx(Moon, { className: "size-4" })
2259
+ },
2260
+ theme
2261
+ ) });
2262
+ }
2263
+ var MODES = ["default", "playful", "smooth"];
2264
+ var MODE_ICONS = {
2265
+ default: /* @__PURE__ */ jsx(LayoutGrid, { className: "size-4" }),
2266
+ playful: /* @__PURE__ */ jsx(Sparkles, { className: "size-4" }),
2267
+ smooth: /* @__PURE__ */ jsx(Layers, { className: "size-4" })
2268
+ };
2269
+ var MODE_LABELS = {
2270
+ default: "Default mode",
2271
+ playful: "Playful mode",
2272
+ smooth: "Smooth mode"
2273
+ };
2274
+ function ModeSwitchMinimal() {
2275
+ const { mode, setMode } = useOlwibaUI();
2276
+ const cycle = () => {
2277
+ const idx = MODES.indexOf(mode);
2278
+ setMode(MODES[(idx + 1) % MODES.length]);
2279
+ };
2280
+ return /* @__PURE__ */ jsx(Button$1, { variant: "ghost", size: "icon", onClick: cycle, className: "size-8", "aria-label": MODE_LABELS[mode], children: /* @__PURE__ */ jsx(
2281
+ "span",
2282
+ {
2283
+ className: "inline-flex size-4 items-center justify-center animate-in fade-in zoom-in-75 duration-200 motion-reduce:animate-none",
2284
+ children: MODE_ICONS[mode]
2285
+ },
2286
+ mode
2287
+ ) });
2288
+ }
2258
2289
  function ThemeColorUpdater({ colorTheme }) {
2259
2290
  React25.useEffect(() => {
2260
2291
  if (colorTheme) {
@@ -2552,6 +2583,6 @@ function usePagination(total, pageSize) {
2552
2583
  return { page, pageSize, totalPages, offset, hasPrev: page > 1, hasNext: page < totalPages, goTo, next, prev };
2553
2584
  }
2554
2585
 
2555
- export { AppContent, AppGrid, AppGridCell, AppScreen, AppShell, AuthSection, Badge, Button, Card, ChangelogCard, ChangelogList, Checkbox, ConfirmDialog, ContactSection, ContextMenu, CountUp, CtaSection, DevBanner, Dock, EmptyState, ErrorPage, FadeIn, FaqSection, FeatureCard, FeaturesSection, Footer, FullPageSpinner, GlassCard, Grid, GridItem, HeroSection, ImageCard, Input, LogoStrip, Navbar, NewsletterSection, OlwibaUIProvider, Overlay, PageHeader, PageTransition, PhoneFrame, PostCard, PostList, PricingCard, PricingSection, PublicPageFrame, RegisterHotkeys, RootErrorFallback, Section, SectionTitle, Spotlight, Stack, StaggerChildren, StatCard, StatsSection, Suspensed, Switch, TeamSection, TestimonialCard, TestimonialsSection, Textarea, ThemeColorUpdater, ThemeSwitchMinimal, Underlay, UpgradePrompt, VersionBanner, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
2586
+ export { AppContent, AppGrid, AppGridCell, AppScreen, AppShell, AuthSection, Badge, Button, Card, ChangelogCard, ChangelogList, Checkbox, ConfirmDialog, ContactSection, ContextMenu, CountUp, CtaSection, DevBanner, Dock, EmptyState, ErrorPage, FadeIn, FaqSection, FeatureCard, FeaturesSection, Footer, FullPageSpinner, GlassCard, Grid, GridItem, HeroSection, ImageCard, Input, LogoStrip, ModeSwitchMinimal, Navbar, NewsletterSection, OlwibaUIProvider, Overlay, PageHeader, PageTransition, PhoneFrame, PostCard, PostList, PricingCard, PricingSection, PublicPageFrame, RegisterHotkeys, RootErrorFallback, Section, SectionTitle, Spotlight, Stack, StaggerChildren, StatCard, StatsSection, Suspensed, Switch, TeamSection, TestimonialCard, TestimonialsSection, Textarea, ThemeColorUpdater, ThemeSwitchMinimal, Underlay, UpgradePrompt, VersionBanner, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
2556
2587
  //# sourceMappingURL=index.js.map
2557
2588
  //# sourceMappingURL=index.js.map