@marktiderman/genesis-ui 2.3.1 → 2.4.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.
@@ -1,4 +1,4 @@
1
- export { A as AppShell, a as AppShellOptions, b as AppShellProps, N as NavItem, P as PageHeader, c as PageHeaderOptions, d as PageHeaderProps } from '../../AppShell-D_E_Hk4g.js';
1
+ export { A as AppShell, a as AppShellOptions, b as AppShellProps, N as NavItem, P as PageHeader, c as PageHeaderOptions, d as PageHeaderProps } from '../../AppShell-CX0M-dfc.js';
2
2
  export { DetailPage, DetailPageProps } from './detail-page.js';
3
3
  export { FormPage, FormPageProps } from './form-page.js';
4
4
  export { D as DashboardPage, a as DashboardPageProps, G as Grid, b as GridProps, g as gridVariants } from '../../dashboard-page-C0TihRl5.js';
@@ -9,6 +9,6 @@ import 'react';
9
9
  import 'lucide-react';
10
10
  import '../../view-toggle-CahQ87PW.js';
11
11
  import '../../hooks/use-view-settings.js';
12
- import '../../navigation-CpOEyUSb.js';
12
+ import '../../navigation-DBwcZ6vb.js';
13
13
  import 'class-variance-authority/types';
14
14
  import 'class-variance-authority';
@@ -1,22 +1,22 @@
1
- export { AppShell, PageHeader } from '../../chunk-UBCYXOXT.js';
1
+ export { AppShell, PageHeader } from '../../chunk-DWM7ELFI.js';
2
2
  import '../../chunk-46TZGMFW.js';
3
3
  export { Container, Stack, containerVariants, stackVariants } from '../../chunk-4CQHPWJD.js';
4
4
  export { FormPage } from '../../chunk-PLIYF6KI.js';
5
- export { Section, SettingsPage, sectionHeadingVariants } from '../../chunk-P64MFQXZ.js';
6
5
  import '../../chunk-OZZTPE7F.js';
7
- export { DashboardPage, Grid, gridVariants } from '../../chunk-ARJI2JUV.js';
6
+ export { Section, SettingsPage, sectionHeadingVariants } from '../../chunk-P64MFQXZ.js';
8
7
  import '../../chunk-QJ6P2DW6.js';
9
8
  import '../../chunk-B2GIBUQD.js';
10
9
  import '../../chunk-NPNADZHM.js';
11
10
  import '../../chunk-FK42ZGGV.js';
12
11
  import '../../chunk-22XB3Q6H.js';
13
12
  import '../../chunk-27ELYTGE.js';
13
+ import '../../chunk-NWSCYLPT.js';
14
+ import '../../chunk-F47U5KNW.js';
15
+ export { DashboardPage, Grid, gridVariants } from '../../chunk-ARJI2JUV.js';
14
16
  export { DetailPage } from '../../chunk-AFZ76Q26.js';
15
17
  export { Split, splitVariants } from '../../chunk-D2LIXA2Y.js';
16
18
  export { GAP_CLASSES, spaceScale } from '../../chunk-AVFZ4P4B.js';
17
- import '../../chunk-NWSCYLPT.js';
18
- import '../../chunk-F47U5KNW.js';
19
19
  import '../../chunk-NZ5WBA4R.js';
20
- import '../../chunk-6NPEMLBA.js';
20
+ import '../../chunk-CDYZRZ6U.js';
21
21
  //# sourceMappingURL=index.js.map
22
22
  //# sourceMappingURL=index.js.map
@@ -1,16 +1,16 @@
1
1
  export { ViewSettings, ViewToggle } from '../../chunk-46TZGMFW.js';
2
2
  export { StatusBadge, statusBadgeVariants } from '../../chunk-XMK3T4TA.js';
3
3
  export { ToggleRow } from '../../chunk-6M4NHHKG.js';
4
- export { SettingsRow } from '../../chunk-A7AHVDG7.js';
5
4
  export { UserAvatar, userAvatarVariants } from '../../chunk-XBX6QMR5.js';
6
5
  import '../../chunk-LNFF2RBD.js';
6
+ export { SettingsRow } from '../../chunk-A7AHVDG7.js';
7
7
  import '../../chunk-FK42ZGGV.js';
8
8
  import '../../chunk-22XB3Q6H.js';
9
- export { PageLoading, pageLoadingVariants } from '../../chunk-YRYQXU3G.js';
10
- import '../../chunk-OVU3Z2MT.js';
11
9
  import '../../chunk-27ELYTGE.js';
12
10
  export { EmptyState, NoFeaturesFound, NoFeedbackFound, NoSearchResults } from '../../chunk-65SPT7EA.js';
13
11
  import '../../chunk-NWSCYLPT.js';
12
+ export { PageLoading, pageLoadingVariants } from '../../chunk-YRYQXU3G.js';
13
+ import '../../chunk-OVU3Z2MT.js';
14
14
  export { FormDescription, FormError, FormField, FormLabel } from '../../chunk-R7QFP6EL.js';
15
15
  import '../../chunk-F47U5KNW.js';
16
16
  import '../../chunk-NZ5WBA4R.js';
@@ -8,7 +8,7 @@ export { UseSavedViewsReturn, useSavedViews } from './use-saved-views.js';
8
8
  export { RouteMap, createPrefetch } from './use-prefetch.js';
9
9
  export { R as ResourceActions, a as ResourceColumnDef, U as UseResourcePageProps, b as UseResourcePageReturn, u as useResourcePage } from '../use-resource-page-DTQS011Q.js';
10
10
  export { CommandPalette, CommandPaletteItem, CommandPaletteProps, useCommandPaletteHotkey } from '../components/ui/command-palette.js';
11
- import '../navigation-CpOEyUSb.js';
11
+ import '../navigation-DBwcZ6vb.js';
12
12
  import 'react';
13
13
  import '../view-toggle-CahQ87PW.js';
14
14
  import '@marktiderman/genesis-core/provider';
@@ -6,10 +6,10 @@ export { CommandPalette, useCommandPaletteHotkey } from '../chunk-CNTWQSUT.js';
6
6
  import '../chunk-SEFK4NZV.js';
7
7
  import '../chunk-7XMZVISM.js';
8
8
  import '../chunk-NZ5WBA4R.js';
9
- export { useDataFilters } from '../chunk-D4JTQYP5.js';
10
- import '../chunk-6NPEMLBA.js';
9
+ export { useDataFilters } from '../chunk-JA3ZKULS.js';
10
+ import '../chunk-CDYZRZ6U.js';
11
11
  export { useKeyboardNavigation } from '../chunk-YJ6MPS6U.js';
12
- export { useIsMobile } from '../chunk-M7AU5DDM.js';
12
+ export { useIsMobile } from '../chunk-VFO3I7PV.js';
13
13
  export { createPrefetch } from '../chunk-HSHIZHYR.js';
14
14
  export { useOne, useResource, useResourceForm, useWizard } from '@marktiderman/genesis-core/hooks';
15
15
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { S as SearchParamsAdapter } from '../navigation-CpOEyUSb.js';
1
+ import { S as SearchParamsAdapter } from '../navigation-DBwcZ6vb.js';
2
2
  import 'react';
3
3
 
4
4
  type FilterType = "string" | "multi";
@@ -1,4 +1,4 @@
1
- export { useDataFilters } from '../chunk-D4JTQYP5.js';
2
- import '../chunk-6NPEMLBA.js';
1
+ export { useDataFilters } from '../chunk-JA3ZKULS.js';
2
+ import '../chunk-CDYZRZ6U.js';
3
3
  //# sourceMappingURL=use-data-filters.js.map
4
4
  //# sourceMappingURL=use-data-filters.js.map
@@ -1,3 +1,4 @@
1
+ /** Whether the viewport is narrower than the mobile breakpoint (768px). */
1
2
  declare function useIsMobile(): boolean;
2
3
 
3
4
  export { useIsMobile };
@@ -1,3 +1,3 @@
1
- export { useIsMobile } from '../chunk-M7AU5DDM.js';
1
+ export { useIsMobile } from '../chunk-VFO3I7PV.js';
2
2
  //# sourceMappingURL=use-mobile.js.map
3
3
  //# sourceMappingURL=use-mobile.js.map
package/dist/index.d.ts CHANGED
@@ -67,7 +67,7 @@ export { DetailPage, DetailPageProps } from './components/layout/detail-page.js'
67
67
  export { FormPage, FormPageProps } from './components/layout/form-page.js';
68
68
  export { SettingsPage, SettingsPageProps, SettingsPageSection } from './components/layout/settings-page.js';
69
69
  export { cn } from './utils.js';
70
- export { D as DefaultLink, G as GenesisLinkProps, L as LinkComponent, N as NavigateFn, S as SearchParamsAdapter, d as defaultNavigate, i as isPathActive, u as useBrowserSearchParams } from './navigation-CpOEyUSb.js';
70
+ export { D as DefaultLink, G as GenesisLinkProps, I as IsPathActiveOptions, L as LinkComponent, N as NavigateFn, a as NavigationNode, R as ResolvedNavigation, S as SearchParamsAdapter, d as defaultNavigate, i as isPathActive, r as resolveNavigation, u as useBrowserSearchParams } from './navigation-DBwcZ6vb.js';
71
71
  export { S as SlotOverride, a as SlotPropsFor, b as Slots, r as renderSlot } from './slots-tR0wf89f.js';
72
72
  export { toast } from 'sonner';
73
73
  import 'class-variance-authority/types';
package/dist/index.js CHANGED
@@ -26,20 +26,19 @@ export { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, Breadcr
26
26
  export { ButtonGroup } from './chunk-K4YLKVMX.js';
27
27
  export { Calendar, CalendarDayButton } from './chunk-J6FBA7PH.js';
28
28
  export { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from './chunk-AOZGQM6W.js';
29
- export { Container, Stack, containerVariants, stackVariants } from './chunk-4CQHPWJD.js';
30
- export { FormPage } from './chunk-PLIYF6KI.js';
31
- export { Section, SettingsPage, sectionHeadingVariants } from './chunk-P64MFQXZ.js';
32
29
  export { AccessibleIcon } from './chunk-JAMLFMDS.js';
33
30
  export { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from './chunk-YWFPMND7.js';
34
31
  export { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger } from './chunk-M62CHO3N.js';
35
- export { Alert, AlertDescription, AlertTitle, alertVariants } from './chunk-OZZTPE7F.js';
36
32
  export { AspectRatio } from './chunk-6Q6CLLJ4.js';
33
+ export { Container, Stack, containerVariants, stackVariants } from './chunk-4CQHPWJD.js';
34
+ export { FormPage } from './chunk-PLIYF6KI.js';
35
+ export { Alert, AlertDescription, AlertTitle, alertVariants } from './chunk-OZZTPE7F.js';
36
+ export { Section, SettingsPage, sectionHeadingVariants } from './chunk-P64MFQXZ.js';
37
37
  export { StatusBadge, statusBadgeVariants } from './chunk-XMK3T4TA.js';
38
38
  export { ToggleRow } from './chunk-6M4NHHKG.js';
39
- export { SettingsRow } from './chunk-A7AHVDG7.js';
40
39
  export { UserAvatar, userAvatarVariants } from './chunk-XBX6QMR5.js';
41
40
  export { Avatar, AvatarFallback, AvatarImage } from './chunk-LNFF2RBD.js';
42
- export { DashboardPage, Grid, gridVariants } from './chunk-ARJI2JUV.js';
41
+ export { SettingsRow } from './chunk-A7AHVDG7.js';
43
42
  export { renderSlot } from './chunk-7S7LKQBD.js';
44
43
  export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from './chunk-N2ZFNOOT.js';
45
44
  export { Textarea } from './chunk-YETMISCE.js';
@@ -55,20 +54,21 @@ export { Collapsible, CollapsibleContent, CollapsibleTrigger } from './chunk-B2G
55
54
  export { Badge } from './chunk-NPNADZHM.js';
56
55
  export { Select, SelectContent, SelectGroup, SelectItem, SelectScrollDownButton, SelectScrollUpButton, SelectTrigger, SelectValue } from './chunk-FK42ZGGV.js';
57
56
  export { Popover, PopoverContent, PopoverTrigger } from './chunk-22XB3Q6H.js';
58
- export { PageLoading, pageLoadingVariants } from './chunk-YRYQXU3G.js';
59
- export { Spinner } from './chunk-OVU3Z2MT.js';
60
57
  export { Switch } from './chunk-27ELYTGE.js';
61
- export { DetailPage } from './chunk-AFZ76Q26.js';
62
- export { Split, splitVariants } from './chunk-D2LIXA2Y.js';
63
- export { GAP_CLASSES, spaceScale } from './chunk-AVFZ4P4B.js';
64
58
  export { EmptyState, NoFeaturesFound, NoFeedbackFound, NoSearchResults } from './chunk-65SPT7EA.js';
65
59
  export { Button } from './chunk-NWSCYLPT.js';
60
+ export { PageLoading, pageLoadingVariants } from './chunk-YRYQXU3G.js';
61
+ export { Spinner } from './chunk-OVU3Z2MT.js';
66
62
  export { FormDescription, FormError, FormField, FormLabel } from './chunk-R7QFP6EL.js';
67
63
  export { Label } from './chunk-F47U5KNW.js';
64
+ export { DashboardPage, Grid, gridVariants } from './chunk-ARJI2JUV.js';
65
+ export { DetailPage } from './chunk-AFZ76Q26.js';
66
+ export { Split, splitVariants } from './chunk-D2LIXA2Y.js';
67
+ export { GAP_CLASSES, spaceScale } from './chunk-AVFZ4P4B.js';
68
68
  export { CommandPalette, useCommandPaletteHotkey } from './chunk-CNTWQSUT.js';
69
69
  export { Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut } from './chunk-SEFK4NZV.js';
70
70
  export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from './chunk-7XMZVISM.js';
71
71
  export { cn } from './chunk-NZ5WBA4R.js';
72
- export { DefaultLink, defaultNavigate, isPathActive, useBrowserSearchParams } from './chunk-6NPEMLBA.js';
72
+ export { DefaultLink, defaultNavigate, isPathActive, resolveNavigation, useBrowserSearchParams } from './chunk-CDYZRZ6U.js';
73
73
  //# sourceMappingURL=index.js.map
74
74
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,163 @@
1
+ import { ComponentType, ReactNode, AnchorHTMLAttributes } from 'react';
2
+
3
+ /**
4
+ * Router-agnostic navigation primitives.
5
+ *
6
+ * genesis-ui does NOT depend on any router. Components that need to render a
7
+ * link or navigate imperatively accept an injectable abstraction defined here,
8
+ * and default to plain browser behavior (`<a>` / `window.location`). Consumers
9
+ * on React Router or Next.js inject a thin adapter that maps these props to
10
+ * their own `<Link>` / router.
11
+ */
12
+
13
+ /**
14
+ * Props passed to an injectable link component. The contract is a plain anchor
15
+ * (`href`), so the default works with NO router. A React Router consumer maps
16
+ * `href` → `to`; a Next.js consumer passes `next/link` directly (it already
17
+ * accepts `href`, `className`, `children`).
18
+ *
19
+ * @stability Beta
20
+ */
21
+ interface GenesisLinkProps {
22
+ /** Destination path or URL. */
23
+ href: string;
24
+ className?: string;
25
+ onClick?: () => void;
26
+ children?: ReactNode;
27
+ /** Set to "page" when the link points at the active route. */
28
+ "aria-current"?: AnchorHTMLAttributes<HTMLAnchorElement>["aria-current"];
29
+ /** Accessible name — useful when the visible label is hidden (icon rail). */
30
+ "aria-label"?: string;
31
+ /** Native tooltip / title attribute. */
32
+ title?: string;
33
+ /**
34
+ * Stable test/automation selector. {@link DefaultLink} renders it as
35
+ * `data-testid`; injected router adapters (`next/link`, RR `Link`) forward it
36
+ * to the underlying `<a>` too.
37
+ */
38
+ testID?: string;
39
+ }
40
+ /**
41
+ * A component that renders a navigable link from {@link GenesisLinkProps}.
42
+ *
43
+ * @stability Beta
44
+ */
45
+ type LinkComponent = ComponentType<GenesisLinkProps>;
46
+ /**
47
+ * Default link — a plain `<a>`. No router required.
48
+ *
49
+ * @stability Beta
50
+ */
51
+ declare const DefaultLink: LinkComponent;
52
+ /**
53
+ * Options for {@link isPathActive}.
54
+ *
55
+ * @stability Beta
56
+ */
57
+ interface IsPathActiveOptions {
58
+ /** Require an exact path match instead of a prefix match (like `NavLink end`). */
59
+ end?: boolean;
60
+ }
61
+ /**
62
+ * Default active-path matcher, mirroring React Router's `NavLink` (prefix
63
+ * match, with `/` treated as exact). Consumers can override via an `isActive`
64
+ * prop where components accept one.
65
+ *
66
+ * `activePath` may carry a query and hash (`pathname + search + hash`). An
67
+ * item whose `to` has neither compares against the path part only, exactly as
68
+ * before. An item that opts in by putting a query or hash in its `to`
69
+ * (`/admin?tab=users`, `/settings#profile`) is active only when the path
70
+ * matches exactly AND every query param it names has the same value in
71
+ * `activePath` (extra params such as `&page=2` are ignored) AND, if it names a
72
+ * hash, the hash is equal.
73
+ *
74
+ * @stability Beta
75
+ */
76
+ declare function isPathActive(to: string, activePath?: string, options?: IsPathActiveOptions): boolean;
77
+ /**
78
+ * One node of a logical navigation hierarchy. `path` is a route pattern whose
79
+ * segments are either static (`clients`) or named params (`$clientId`). A
80
+ * node's place in the tree is its LOGICAL parent, which need not share its URL
81
+ * prefix — `/clients/$clientId` can sit under `/dashboard`.
82
+ *
83
+ * @stability Beta
84
+ */
85
+ interface NavigationNode<T> {
86
+ id: string;
87
+ path: string;
88
+ label: string;
89
+ /** Contextual nav items to show while this node is current. */
90
+ items: T[];
91
+ children?: NavigationNode<T>[];
92
+ }
93
+ /**
94
+ * Result of {@link resolveNavigation}. `current`, `parent` and every `trail`
95
+ * entry are shallow copies of their tree nodes with `path` interpolated from
96
+ * `params` (a param the URL did not supply stays as `$name`).
97
+ *
98
+ * @stability Beta
99
+ */
100
+ interface ResolvedNavigation<T> {
101
+ /** The best-matching node — the root when nothing else matches. */
102
+ current: NavigationNode<T>;
103
+ /** `current`'s logical parent, for an "up" / back-to-parent link. */
104
+ parent?: NavigationNode<T>;
105
+ /** `current.items`. */
106
+ items: T[];
107
+ /** Root → `current`, inclusive. */
108
+ trail: NavigationNode<T>[];
109
+ /** Params captured by `current.path`, URL-decoded. */
110
+ params: Record<string, string>;
111
+ }
112
+ /**
113
+ * Resolve where `pathname` sits in a logical navigation tree. Pure: it never
114
+ * reads browser history or `window`.
115
+ *
116
+ * A node matches when its pattern matches a leading run of WHOLE path
117
+ * segments (`/my` matches `/my/tasks`, never `/my-other`). Among matches the
118
+ * winner is decided by positional specificity: at the first position where
119
+ * one pattern is static and the other a `$param`, the static one wins (so
120
+ * `/clients/new` beats `/clients/$clientId` whatever the sibling order, and
121
+ * `/my` beats `/$space/tasks` for `/my/tasks`). Otherwise the pattern matching
122
+ * more segments wins, then the deeper tree node.
123
+ * Non-matching nodes are still searched, so a match keeps its logical
124
+ * ancestors even when their URLs differ.
125
+ *
126
+ * @stability Beta
127
+ */
128
+ declare function resolveNavigation<T>(tree: NavigationNode<T>, pathname: string): ResolvedNavigation<T>;
129
+ /**
130
+ * Injectable imperative navigation callback.
131
+ *
132
+ * @stability Beta
133
+ */
134
+ type NavigateFn = (path: string) => void;
135
+ /**
136
+ * Default navigate — a full-page navigation. No router required.
137
+ *
138
+ * @stability Beta
139
+ */
140
+ declare const defaultNavigate: NavigateFn;
141
+ /**
142
+ * Minimal, router-agnostic replacement for React Router's `useSearchParams`
143
+ * return shape. Consumers may inject their router's implementation for full
144
+ * SPA integration; otherwise the browser History API is used.
145
+ *
146
+ * @stability Beta
147
+ */
148
+ interface SearchParamsAdapter {
149
+ searchParams: URLSearchParams;
150
+ setSearchParams: (next: URLSearchParams, options?: {
151
+ replace?: boolean;
152
+ }) => void;
153
+ }
154
+ /**
155
+ * Browser-native {@link SearchParamsAdapter} built on the History API. Reads
156
+ * the current query string and writes updates via `pushState`/`replaceState`,
157
+ * staying reactive to `popstate` events. No router required.
158
+ *
159
+ * @stability Beta
160
+ */
161
+ declare function useBrowserSearchParams(): SearchParamsAdapter;
162
+
163
+ export { DefaultLink as D, type GenesisLinkProps as G, type IsPathActiveOptions as I, type LinkComponent as L, type NavigateFn as N, type ResolvedNavigation as R, type SearchParamsAdapter as S, type NavigationNode as a, defaultNavigate as d, isPathActive as i, resolveNavigation as r, useBrowserSearchParams as u };
@@ -0,0 +1,11 @@
1
+ /*
2
+ * Tailwind v4 source entry for @marktiderman/genesis-ui.
3
+ *
4
+ * Copied to dist/styles.css at build time, so "./" is the published dist/
5
+ * folder: importing this file makes Tailwind scan genesis-ui's compiled
6
+ * components for the utility classes they use.
7
+ *
8
+ * @import "tailwindcss";
9
+ * @import "@marktiderman/genesis-ui/styles.css";
10
+ */
11
+ @source "./";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marktiderman/genesis-ui",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -22,7 +22,8 @@
22
22
  "dist",
23
23
  "!dist/metafile-*.json",
24
24
  "README.md",
25
- "EXTENDING.md"
25
+ "EXTENDING.md",
26
+ "SKILL.md"
26
27
  ],
27
28
  "exports": {
28
29
  ".": {
@@ -61,6 +62,7 @@
61
62
  "types": "./dist/provider/index.d.ts",
62
63
  "import": "./dist/provider/index.js"
63
64
  },
65
+ "./styles.css": "./dist/styles.css",
64
66
  "./accessible-icon": {
65
67
  "types": "./dist/components/ui/accessible-icon.d.ts",
66
68
  "import": "./dist/components/ui/accessible-icon.js"
@@ -327,7 +329,7 @@
327
329
  }
328
330
  },
329
331
  "peerDependencies": {
330
- "@marktiderman/genesis-design-system": "^1.2.1",
332
+ "@marktiderman/genesis-design-system": "^1.3.0",
331
333
  "cmdk": "^1.0.0",
332
334
  "date-fns": "^4.0.0",
333
335
  "embla-carousel-react": "^8.0.0",
@@ -352,7 +354,7 @@
352
354
  },
353
355
  "devDependencies": {
354
356
  "@hookform/resolvers": "^5.2.2",
355
- "@marktiderman/genesis-design-system": "^1.2.1",
357
+ "@marktiderman/genesis-design-system": "^1.3.0",
356
358
  "@testing-library/react": "^16.3.2",
357
359
  "@radix-ui/react-accordion": "^1.2.0",
358
360
  "@radix-ui/react-aspect-ratio": "^1.1.0",
@@ -392,7 +394,7 @@
392
394
  "zod": "^4.3.6"
393
395
  },
394
396
  "scripts": {
395
- "build": "tsup && node scripts/stamp-use-client.mjs && node ../../scripts/check-exports-resolve.mjs",
397
+ "build": "tsup && node scripts/stamp-use-client.mjs && cp src/styles.css dist/styles.css && node ../../scripts/check-exports-resolve.mjs",
396
398
  "clean": "rm -rf dist",
397
399
  "check:exports": "node ../../scripts/check-exports-resolve.mjs",
398
400
  "test": "vitest run"
@@ -1,51 +0,0 @@
1
- "use client";
2
- import { useState, useEffect, useCallback } from 'react';
3
- import { jsx } from 'react/jsx-runtime';
4
-
5
- // src/navigation.tsx
6
- var DefaultLink = ({
7
- href,
8
- children,
9
- testID,
10
- ...rest
11
- }) => /* @__PURE__ */ jsx("a", { href, "data-testid": testID, ...rest, children });
12
- function isPathActive(to, activePath) {
13
- if (activePath == null) return false;
14
- if (to === activePath) return true;
15
- if (to !== "/" && activePath.startsWith(to + "/")) return true;
16
- return false;
17
- }
18
- var defaultNavigate = (path) => {
19
- if (typeof window !== "undefined") window.location.assign(path);
20
- };
21
- function useBrowserSearchParams() {
22
- const read = () => new URLSearchParams(
23
- typeof window !== "undefined" ? window.location.search : ""
24
- );
25
- const [searchParams, setLocal] = useState(read);
26
- useEffect(() => {
27
- if (typeof window === "undefined") return;
28
- const onPop = () => setLocal(read());
29
- window.addEventListener("popstate", onPop);
30
- return () => window.removeEventListener("popstate", onPop);
31
- }, []);
32
- const setSearchParams = useCallback(
33
- (next, options) => {
34
- if (typeof window === "undefined") return;
35
- const qs = next.toString();
36
- const url = window.location.pathname + (qs ? `?${qs}` : "") + window.location.hash;
37
- if (options?.replace) {
38
- window.history.replaceState(window.history.state, "", url);
39
- } else {
40
- window.history.pushState(window.history.state, "", url);
41
- }
42
- setLocal(new URLSearchParams(next));
43
- },
44
- []
45
- );
46
- return { searchParams, setSearchParams };
47
- }
48
-
49
- export { DefaultLink, defaultNavigate, isPathActive, useBrowserSearchParams };
50
- //# sourceMappingURL=chunk-6NPEMLBA.js.map
51
- //# sourceMappingURL=chunk-6NPEMLBA.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/navigation.tsx"],"names":[],"mappings":";;;;AAgEO,IAAM,cAA6B,CAAC;AAAA,EACzC,IAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,GAAG;AACL,CAAA,yBACG,GAAA,EAAA,EAAE,IAAA,EAAY,eAAa,MAAA,EAAS,GAAG,MACrC,QAAA,EACH;AAUK,SAAS,YAAA,CAAa,IAAY,UAAA,EAA8B;AACrE,EAAA,IAAI,UAAA,IAAc,MAAM,OAAO,KAAA;AAC/B,EAAA,IAAI,EAAA,KAAO,YAAY,OAAO,IAAA;AAC9B,EAAA,IAAI,OAAO,GAAA,IAAO,UAAA,CAAW,WAAW,EAAA,GAAK,GAAG,GAAG,OAAO,IAAA;AAC1D,EAAA,OAAO,KAAA;AACT;AAkBO,IAAM,eAAA,GAA8B,CAAC,IAAA,KAAS;AACnD,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,MAAA,CAAO,QAAA,CAAS,OAAO,IAAI,CAAA;AAChE;AA4BO,SAAS,sBAAA,GAA8C;AAC5D,EAAA,MAAM,IAAA,GAAO,MACX,IAAI,eAAA;AAAA,IACF,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,SAAS,MAAA,GAAS;AAAA,GAC3D;AAEF,EAAA,MAAM,CAAC,YAAA,EAAc,QAAQ,CAAA,GAAI,SAA0B,IAAI,CAAA;AAE/D,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,IAAA,MAAM,KAAA,GAAQ,MAAM,QAAA,CAAS,IAAA,EAAM,CAAA;AACnC,IAAA,MAAA,CAAO,gBAAA,CAAiB,YAAY,KAAK,CAAA;AACzC,IAAA,OAAO,MAAM,MAAA,CAAO,mBAAA,CAAoB,UAAA,EAAY,KAAK,CAAA;AAAA,EAC3D,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,MAAM,eAAA,GAAkB,WAAA;AAAA,IACtB,CAAC,MAAM,OAAA,KAAY;AACjB,MAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,MAAA,MAAM,EAAA,GAAK,KAAK,QAAA,EAAS;AACzB,MAAA,MAAM,GAAA,GACJ,MAAA,CAAO,QAAA,CAAS,QAAA,IAAY,EAAA,GAAK,IAAI,EAAE,CAAA,CAAA,GAAK,EAAA,CAAA,GAAM,MAAA,CAAO,QAAA,CAAS,IAAA;AACpE,MAAA,IAAI,SAAS,OAAA,EAAS;AACpB,QAAA,MAAA,CAAO,QAAQ,YAAA,CAAa,MAAA,CAAO,OAAA,CAAQ,KAAA,EAAO,IAAI,GAAG,CAAA;AAAA,MAC3D,CAAA,MAAO;AACL,QAAA,MAAA,CAAO,QAAQ,SAAA,CAAU,MAAA,CAAO,OAAA,CAAQ,KAAA,EAAO,IAAI,GAAG,CAAA;AAAA,MACxD;AACA,MAAA,QAAA,CAAS,IAAI,eAAA,CAAgB,IAAI,CAAC,CAAA;AAAA,IACpC,CAAA;AAAA,IACA;AAAC,GACH;AAEA,EAAA,OAAO,EAAE,cAAc,eAAA,EAAgB;AACzC","file":"chunk-6NPEMLBA.js","sourcesContent":["\"use client\";\n\n/**\n * Router-agnostic navigation primitives.\n *\n * genesis-ui does NOT depend on any router. Components that need to render a\n * link or navigate imperatively accept an injectable abstraction defined here,\n * and default to plain browser behavior (`<a>` / `window.location`). Consumers\n * on React Router or Next.js inject a thin adapter that maps these props to\n * their own `<Link>` / router.\n */\nimport {\n useCallback,\n useEffect,\n useState,\n type AnchorHTMLAttributes,\n type ComponentType,\n type ReactNode,\n} from \"react\";\n\n// ---------------------------------------------------------------------------\n// Link abstraction\n// ---------------------------------------------------------------------------\n\n/**\n * Props passed to an injectable link component. The contract is a plain anchor\n * (`href`), so the default works with NO router. A React Router consumer maps\n * `href` → `to`; a Next.js consumer passes `next/link` directly (it already\n * accepts `href`, `className`, `children`).\n *\n * @stability Beta\n */\nexport interface GenesisLinkProps {\n /** Destination path or URL. */\n href: string;\n className?: string;\n onClick?: () => void;\n children?: ReactNode;\n /** Set to \"page\" when the link points at the active route. */\n \"aria-current\"?: AnchorHTMLAttributes<HTMLAnchorElement>[\"aria-current\"];\n /** Accessible name — useful when the visible label is hidden (icon rail). */\n \"aria-label\"?: string;\n /** Native tooltip / title attribute. */\n title?: string;\n /**\n * Stable test/automation selector. {@link DefaultLink} renders it as\n * `data-testid`; injected router adapters (`next/link`, RR `Link`) forward it\n * to the underlying `<a>` too.\n */\n testID?: string;\n}\n\n/**\n * A component that renders a navigable link from {@link GenesisLinkProps}.\n *\n * @stability Beta\n */\nexport type LinkComponent = ComponentType<GenesisLinkProps>;\n\n/**\n * Default link — a plain `<a>`. No router required.\n *\n * @stability Beta\n */\nexport const DefaultLink: LinkComponent = ({\n href,\n children,\n testID,\n ...rest\n}) => (\n <a href={href} data-testid={testID} {...rest}>\n {children}\n </a>\n);\n\n/**\n * Default active-path matcher, mirroring React Router's `NavLink` (prefix\n * match, with `/` treated as exact). Consumers can override via an `isActive`\n * prop where components accept one.\n *\n * @stability Beta\n */\nexport function isPathActive(to: string, activePath?: string): boolean {\n if (activePath == null) return false;\n if (to === activePath) return true;\n if (to !== \"/\" && activePath.startsWith(to + \"/\")) return true;\n return false;\n}\n\n// ---------------------------------------------------------------------------\n// Imperative navigation abstraction\n// ---------------------------------------------------------------------------\n\n/**\n * Injectable imperative navigation callback.\n *\n * @stability Beta\n */\nexport type NavigateFn = (path: string) => void;\n\n/**\n * Default navigate — a full-page navigation. No router required.\n *\n * @stability Beta\n */\nexport const defaultNavigate: NavigateFn = (path) => {\n if (typeof window !== \"undefined\") window.location.assign(path);\n};\n\n// ---------------------------------------------------------------------------\n// Search-params abstraction (for URL-synced hooks)\n// ---------------------------------------------------------------------------\n\n/**\n * Minimal, router-agnostic replacement for React Router's `useSearchParams`\n * return shape. Consumers may inject their router's implementation for full\n * SPA integration; otherwise the browser History API is used.\n *\n * @stability Beta\n */\nexport interface SearchParamsAdapter {\n searchParams: URLSearchParams;\n setSearchParams: (\n next: URLSearchParams,\n options?: { replace?: boolean },\n ) => void;\n}\n\n/**\n * Browser-native {@link SearchParamsAdapter} built on the History API. Reads\n * the current query string and writes updates via `pushState`/`replaceState`,\n * staying reactive to `popstate` events. No router required.\n *\n * @stability Beta\n */\nexport function useBrowserSearchParams(): SearchParamsAdapter {\n const read = () =>\n new URLSearchParams(\n typeof window !== \"undefined\" ? window.location.search : \"\",\n );\n\n const [searchParams, setLocal] = useState<URLSearchParams>(read);\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const onPop = () => setLocal(read());\n window.addEventListener(\"popstate\", onPop);\n return () => window.removeEventListener(\"popstate\", onPop);\n }, []);\n\n const setSearchParams = useCallback<SearchParamsAdapter[\"setSearchParams\"]>(\n (next, options) => {\n if (typeof window === \"undefined\") return;\n const qs = next.toString();\n const url =\n window.location.pathname + (qs ? `?${qs}` : \"\") + window.location.hash;\n if (options?.replace) {\n window.history.replaceState(window.history.state, \"\", url);\n } else {\n window.history.pushState(window.history.state, \"\", url);\n }\n setLocal(new URLSearchParams(next));\n },\n [],\n );\n\n return { searchParams, setSearchParams };\n}\n"]}
@@ -1,26 +0,0 @@
1
- "use client";
2
- import { useState, useEffect } from 'react';
3
-
4
- // src/hooks/use-mobile.ts
5
- var MOBILE_BREAKPOINT = 768;
6
- function useIsMobile() {
7
- const [isMobile, setIsMobile] = useState(() => {
8
- if (typeof window === "undefined") return false;
9
- return window.innerWidth < MOBILE_BREAKPOINT;
10
- });
11
- useEffect(() => {
12
- if (typeof window === "undefined") return;
13
- const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
14
- const onChange = () => {
15
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
16
- };
17
- mql.addEventListener("change", onChange);
18
- setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
19
- return () => mql.removeEventListener("change", onChange);
20
- }, []);
21
- return isMobile;
22
- }
23
-
24
- export { useIsMobile };
25
- //# sourceMappingURL=chunk-M7AU5DDM.js.map
26
- //# sourceMappingURL=chunk-M7AU5DDM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/hooks/use-mobile.ts"],"names":[],"mappings":";;;AAIA,IAAM,iBAAA,GAAoB,GAAA;AAEnB,SAAS,WAAA,GAAuB;AACrC,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,SAAkB,MAAM;AACtD,IAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAC1C,IAAA,OAAO,OAAO,UAAA,GAAa,iBAAA;AAAA,EAC7B,CAAC,CAAA;AAED,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,IAAA,MAAM,MAAM,MAAA,CAAO,UAAA,CAAW,CAAA,YAAA,EAAe,iBAAA,GAAoB,CAAC,CAAA,GAAA,CAAK,CAAA;AACvE,IAAA,MAAM,WAAW,MAAM;AACrB,MAAA,WAAA,CAAY,MAAA,CAAO,aAAa,iBAAiB,CAAA;AAAA,IACnD,CAAA;AACA,IAAA,GAAA,CAAI,gBAAA,CAAiB,UAAU,QAAQ,CAAA;AACvC,IAAA,WAAA,CAAY,MAAA,CAAO,aAAa,iBAAiB,CAAA;AACjD,IAAA,OAAO,MAAM,GAAA,CAAI,mBAAA,CAAoB,QAAA,EAAU,QAAQ,CAAA;AAAA,EACzD,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,QAAA;AACT","file":"chunk-M7AU5DDM.js","sourcesContent":["\"use client\";\n\nimport { useState, useEffect } from \"react\";\n\nconst MOBILE_BREAKPOINT = 768;\n\nexport function useIsMobile(): boolean {\n const [isMobile, setIsMobile] = useState<boolean>(() => {\n if (typeof window === \"undefined\") return false;\n return window.innerWidth < MOBILE_BREAKPOINT;\n });\n\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);\n const onChange = () => {\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n };\n mql.addEventListener(\"change\", onChange);\n setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);\n return () => mql.removeEventListener(\"change\", onChange);\n }, []);\n\n return isMobile;\n}\n"]}