@marktiderman/genesis-ui 2.12.0 → 2.12.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/{AppShell-DpQdcLE-.d.ts → AppShell-HCXpi6nv.d.ts} +3 -2
- package/dist/chunk-424PT5DM.js +21 -0
- package/dist/chunk-424PT5DM.js.map +1 -0
- package/dist/chunk-J45FHL7D.js +46 -0
- package/dist/chunk-J45FHL7D.js.map +1 -0
- package/dist/{chunk-SZMXNC5Q.js → chunk-MLZEKXV2.js} +3 -3
- package/dist/{chunk-SZMXNC5Q.js.map → chunk-MLZEKXV2.js.map} +1 -1
- package/dist/{chunk-XGG5RUDE.js → chunk-PMCUHSZS.js} +3 -3
- package/dist/{chunk-XGG5RUDE.js.map → chunk-PMCUHSZS.js.map} +1 -1
- package/dist/{chunk-3TWCZYZY.js → chunk-STZVZUYO.js} +3 -3
- package/dist/{chunk-3TWCZYZY.js.map → chunk-STZVZUYO.js.map} +1 -1
- package/dist/chunk-WALJMVEF.js +10 -0
- package/dist/chunk-WALJMVEF.js.map +1 -0
- package/dist/components/data/index.d.ts +7 -6
- package/dist/components/data/index.js +14 -13
- package/dist/components/data/index.js.map +1 -1
- package/dist/components/layout/dashboard-page.js +1 -0
- package/dist/components/layout/detail-page.js +1 -0
- package/dist/components/layout/form-page.js +1 -0
- package/dist/components/layout/index.d.ts +3 -2
- package/dist/components/layout/index.js +3 -2
- package/dist/components/layout/settings-page.js +1 -0
- package/dist/components/patterns/empty-state.js +1 -0
- package/dist/components/patterns/form-field.js +1 -0
- package/dist/components/patterns/index.js +1 -0
- package/dist/components/patterns/page-loading.js +1 -0
- package/dist/components/patterns/settings-row.js +1 -0
- package/dist/components/patterns/sortable-list.js +1 -0
- package/dist/components/patterns/status-badge.js +1 -0
- package/dist/components/patterns/toggle-row.js +1 -0
- package/dist/components/patterns/user-avatar.js +1 -0
- package/dist/components/rich-text/rich-text-editor.js +1 -0
- package/dist/components/rich-text/rich-text-editor.js.map +1 -1
- package/dist/components/rich-text/rich-text.js +1 -0
- package/dist/components/sheet-grid/sheet-grid.js +1 -0
- package/dist/components/sheet-grid/sheet-grid.js.map +1 -1
- package/dist/components/ui/accessible-icon.js +1 -0
- package/dist/components/ui/accordion.js +1 -0
- package/dist/components/ui/alert-dialog.js +1 -0
- package/dist/components/ui/alert.js +1 -0
- package/dist/components/ui/aspect-ratio.js +1 -0
- package/dist/components/ui/avatar.js +1 -0
- package/dist/components/ui/badge.js +1 -0
- package/dist/components/ui/breadcrumb.js +1 -0
- package/dist/components/ui/button-group.js +1 -0
- package/dist/components/ui/button.js +1 -0
- package/dist/components/ui/calendar.js +1 -0
- package/dist/components/ui/card.js +1 -0
- package/dist/components/ui/carousel.js +1 -0
- package/dist/components/ui/chart.js +1 -0
- package/dist/components/ui/checkbox.js +1 -0
- package/dist/components/ui/collapsible.js +1 -0
- package/dist/components/ui/command-palette.js +1 -0
- package/dist/components/ui/command.js +1 -0
- package/dist/components/ui/context-menu.js +1 -0
- package/dist/components/ui/date-picker.js +1 -0
- package/dist/components/ui/dialog.js +1 -0
- package/dist/components/ui/drawer.js +1 -0
- package/dist/components/ui/dropdown-menu.js +1 -0
- package/dist/components/ui/hover-card.js +1 -0
- package/dist/components/ui/input-group.js +1 -0
- package/dist/components/ui/input-otp.js +1 -0
- package/dist/components/ui/input.js +1 -0
- package/dist/components/ui/kbd.js +1 -0
- package/dist/components/ui/label.js +1 -0
- package/dist/components/ui/menubar.js +1 -0
- package/dist/components/ui/navigation-menu.js +1 -0
- package/dist/components/ui/pagination.js +1 -0
- package/dist/components/ui/password-toggle-field.js +1 -0
- package/dist/components/ui/popover.js +1 -0
- package/dist/components/ui/progress.js +1 -0
- package/dist/components/ui/radio-group.js +1 -0
- package/dist/components/ui/resizable.js +1 -0
- package/dist/components/ui/scroll-area.js +1 -0
- package/dist/components/ui/select.js +1 -0
- package/dist/components/ui/separator.js +1 -0
- package/dist/components/ui/sheet.js +1 -0
- package/dist/components/ui/skeleton.js +1 -0
- package/dist/components/ui/slider.js +1 -0
- package/dist/components/ui/sonner.js +1 -0
- package/dist/components/ui/spinner.js +1 -0
- package/dist/components/ui/switch.js +1 -0
- package/dist/components/ui/table.js +1 -0
- package/dist/components/ui/tabs.js +1 -0
- package/dist/components/ui/textarea.js +1 -0
- package/dist/components/ui/toggle-group.js +1 -0
- package/dist/components/ui/toggle.js +1 -0
- package/dist/components/ui/toolbar.js +1 -0
- package/dist/components/ui/tooltip.js +1 -0
- package/dist/components/ui/typography.js +1 -0
- package/dist/components/ui/visually-hidden.js +1 -0
- package/dist/hooks/index.d.ts +3 -3
- package/dist/hooks/index.js +4 -3
- package/dist/hooks/use-data-filters.d.ts +1 -1
- package/dist/hooks/use-data-filters.js +3 -2
- package/dist/hooks/use-keyboard-navigation.js +1 -0
- package/dist/hooks/use-mobile.js +1 -0
- package/dist/hooks/use-prefetch.js +1 -0
- package/dist/hooks/use-resource-page.js +1 -0
- package/dist/hooks/use-resource-url-state.d.ts +1 -1
- package/dist/hooks/use-resource-url-state.js +1 -0
- package/dist/hooks/use-saved-views.js +1 -0
- package/dist/hooks/use-view-preference.js +1 -0
- package/dist/hooks/use-view-settings.js +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +360 -2
- package/dist/index.js.map +1 -1
- package/dist/navigation-vmFJ6r1m.d.ts +90 -0
- package/dist/router/react-router.d.ts +1 -1
- package/dist/router/react-router.js +1 -0
- package/dist/router/react-router.js.map +1 -1
- package/dist/router/tanstack-router.d.ts +1 -1
- package/dist/router/tanstack-router.js +2 -1
- package/dist/router/tanstack-router.js.map +1 -1
- package/dist/status-colors.js +2 -0
- package/dist/status-colors.js.map +1 -1
- package/dist/{use-resource-table-DrTkD5O1.d.ts → use-resource-table-easmRDQI.d.ts} +2 -2
- package/dist/utils.js +1 -0
- package/package.json +4 -4
- package/dist/chunk-7S7LKQBD.js +0 -12
- package/dist/chunk-7S7LKQBD.js.map +0 -1
- package/dist/chunk-KC43CNMA.js +0 -141
- package/dist/chunk-KC43CNMA.js.map +0 -1
- package/dist/navigation-By1DrzaM.d.ts +0 -190
- package/dist/slots-tR0wf89f.d.ts +0 -60
|
@@ -1,190 +0,0 @@
|
|
|
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 a router inject an adapter that maps these props to their own `<Link>` /
|
|
10
|
-
* router. Ready-made ones ship on their own subpaths, each with its router as
|
|
11
|
-
* an optional peer: `@marktiderman/genesis-ui/router/react-router` and
|
|
12
|
-
* `@marktiderman/genesis-ui/router/tanstack-router`. Next.js passes
|
|
13
|
-
* `next/link` directly.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Props passed to an injectable link component. The contract is a plain anchor
|
|
18
|
-
* (`href`), so the default works with NO router. A React Router consumer maps
|
|
19
|
-
* `href` → `to`; a Next.js consumer passes `next/link` directly (it already
|
|
20
|
-
* accepts `href`, `className`, `children`).
|
|
21
|
-
*
|
|
22
|
-
* @stability Beta
|
|
23
|
-
*/
|
|
24
|
-
interface GenesisLinkProps {
|
|
25
|
-
/** Destination path or URL. */
|
|
26
|
-
href: string;
|
|
27
|
-
className?: string;
|
|
28
|
-
onClick?: () => void;
|
|
29
|
-
children?: ReactNode;
|
|
30
|
-
/** Set to "page" when the link points at the active route. */
|
|
31
|
-
"aria-current"?: AnchorHTMLAttributes<HTMLAnchorElement>["aria-current"];
|
|
32
|
-
/** Accessible name — useful when the visible label is hidden (icon rail). */
|
|
33
|
-
"aria-label"?: string;
|
|
34
|
-
/** Native tooltip / title attribute. */
|
|
35
|
-
title?: string;
|
|
36
|
-
/**
|
|
37
|
-
* Stable test/automation selector. {@link DefaultLink} renders it as
|
|
38
|
-
* `data-testid`; injected router adapters (`next/link`, RR `Link`) forward it
|
|
39
|
-
* to the underlying `<a>` too.
|
|
40
|
-
*/
|
|
41
|
-
testID?: string;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* A component that renders a navigable link from {@link GenesisLinkProps}.
|
|
45
|
-
*
|
|
46
|
-
* @stability Beta
|
|
47
|
-
*/
|
|
48
|
-
type LinkComponent = ComponentType<GenesisLinkProps>;
|
|
49
|
-
/**
|
|
50
|
-
* Default link — a plain `<a>`. No router required.
|
|
51
|
-
*
|
|
52
|
-
* @stability Beta
|
|
53
|
-
*/
|
|
54
|
-
declare const DefaultLink: LinkComponent;
|
|
55
|
-
/**
|
|
56
|
-
* Options for {@link isPathActive}.
|
|
57
|
-
*
|
|
58
|
-
* @stability Beta
|
|
59
|
-
*/
|
|
60
|
-
interface IsPathActiveOptions {
|
|
61
|
-
/** Require an exact path match instead of a prefix match (like `NavLink end`). */
|
|
62
|
-
end?: boolean;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Default active-path matcher, mirroring React Router's `NavLink` (prefix
|
|
66
|
-
* match, with `/` treated as exact). Consumers can override via an `isActive`
|
|
67
|
-
* prop where components accept one.
|
|
68
|
-
*
|
|
69
|
-
* `activePath` may carry a query and hash (`pathname + search + hash`). An
|
|
70
|
-
* item whose `to` has neither compares against the path part only, exactly as
|
|
71
|
-
* before. An item that opts in by putting a query or hash in its `to`
|
|
72
|
-
* (`/admin?tab=users`, `/settings#profile`) is active only when the path
|
|
73
|
-
* matches exactly AND every query param it names has the same value in
|
|
74
|
-
* `activePath` (extra params such as `&page=2` are ignored) AND, if it names a
|
|
75
|
-
* hash, the hash is equal.
|
|
76
|
-
*
|
|
77
|
-
* @stability Beta
|
|
78
|
-
*/
|
|
79
|
-
declare function isPathActive(to: string, activePath?: string, options?: IsPathActiveOptions): boolean;
|
|
80
|
-
/**
|
|
81
|
-
* One node of a logical navigation hierarchy. `path` is a route pattern whose
|
|
82
|
-
* segments are either static (`clients`) or named params (`$clientId`). A
|
|
83
|
-
* node's place in the tree is its LOGICAL parent, which need not share its URL
|
|
84
|
-
* prefix — `/clients/$clientId` can sit under `/dashboard`.
|
|
85
|
-
*
|
|
86
|
-
* @stability Beta
|
|
87
|
-
*/
|
|
88
|
-
interface NavigationNode<T> {
|
|
89
|
-
id: string;
|
|
90
|
-
path: string;
|
|
91
|
-
label: string;
|
|
92
|
-
/** Contextual nav items to show while this node is current. */
|
|
93
|
-
items: T[];
|
|
94
|
-
children?: NavigationNode<T>[];
|
|
95
|
-
/**
|
|
96
|
-
* Ask the app shell to open its desktop sidebar collapsed (icon rail) while
|
|
97
|
-
* this node, or a descendant that doesn't set its own value, is current.
|
|
98
|
-
* The nearest node in the resolved trail that sets it wins, so
|
|
99
|
-
* `defaultCollapsed: false` on a child re-opens it under a collapsed
|
|
100
|
-
* parent. Only a default: once the user has toggled the sidebar, their
|
|
101
|
-
* choice wins everywhere. `AppShell` reads it; `resolveNavigation` copies
|
|
102
|
-
* it through untouched.
|
|
103
|
-
*
|
|
104
|
-
* @stability Beta
|
|
105
|
-
*/
|
|
106
|
-
defaultCollapsed?: boolean;
|
|
107
|
-
/**
|
|
108
|
-
* How the app shell shows this node's `items` (its child pages, e.g. a
|
|
109
|
-
* form's Questions / Logic / Responses / Settings). `"tabs"` (across the
|
|
110
|
-
* top of the content) or `"sidebar"` (nested under the active item) turn
|
|
111
|
-
* shell sub-navigation on, which also gives phones a back item plus the
|
|
112
|
-
* children in the bottom bar. `"section"` is the legacy rendering (the
|
|
113
|
-
* shell's default) and `"off"` hides them. The nearest node in the trail
|
|
114
|
-
* that sets it wins over the shell's `options.subNav`.
|
|
115
|
-
*
|
|
116
|
-
* @stability Beta
|
|
117
|
-
*/
|
|
118
|
-
subNav?: "section" | "tabs" | "sidebar" | "off";
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Result of {@link resolveNavigation}. `current`, `parent` and every `trail`
|
|
122
|
-
* entry are shallow copies of their tree nodes with `path` interpolated from
|
|
123
|
-
* `params` (a param the URL did not supply stays as `$name`).
|
|
124
|
-
*
|
|
125
|
-
* @stability Beta
|
|
126
|
-
*/
|
|
127
|
-
interface ResolvedNavigation<T> {
|
|
128
|
-
/** The best-matching node — the root when nothing else matches. */
|
|
129
|
-
current: NavigationNode<T>;
|
|
130
|
-
/** `current`'s logical parent, for an "up" / back-to-parent link. */
|
|
131
|
-
parent?: NavigationNode<T>;
|
|
132
|
-
/** `current.items`. */
|
|
133
|
-
items: T[];
|
|
134
|
-
/** Root → `current`, inclusive. */
|
|
135
|
-
trail: NavigationNode<T>[];
|
|
136
|
-
/** Params captured by `current.path`, URL-decoded. */
|
|
137
|
-
params: Record<string, string>;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Resolve where `pathname` sits in a logical navigation tree. Pure: it never
|
|
141
|
-
* reads browser history or `window`.
|
|
142
|
-
*
|
|
143
|
-
* A node matches when its pattern matches a leading run of WHOLE path
|
|
144
|
-
* segments (`/my` matches `/my/tasks`, never `/my-other`). Among matches the
|
|
145
|
-
* winner is decided by positional specificity: at the first position where
|
|
146
|
-
* one pattern is static and the other a `$param`, the static one wins (so
|
|
147
|
-
* `/clients/new` beats `/clients/$clientId` whatever the sibling order, and
|
|
148
|
-
* `/my` beats `/$space/tasks` for `/my/tasks`). Otherwise the pattern matching
|
|
149
|
-
* more segments wins, then the deeper tree node.
|
|
150
|
-
* Non-matching nodes are still searched, so a match keeps its logical
|
|
151
|
-
* ancestors even when their URLs differ.
|
|
152
|
-
*
|
|
153
|
-
* @stability Beta
|
|
154
|
-
*/
|
|
155
|
-
declare function resolveNavigation<T>(tree: NavigationNode<T>, pathname: string): ResolvedNavigation<T>;
|
|
156
|
-
/**
|
|
157
|
-
* Injectable imperative navigation callback.
|
|
158
|
-
*
|
|
159
|
-
* @stability Beta
|
|
160
|
-
*/
|
|
161
|
-
type NavigateFn = (path: string) => void;
|
|
162
|
-
/**
|
|
163
|
-
* Default navigate — a full-page navigation. No router required.
|
|
164
|
-
*
|
|
165
|
-
* @stability Beta
|
|
166
|
-
*/
|
|
167
|
-
declare const defaultNavigate: NavigateFn;
|
|
168
|
-
/**
|
|
169
|
-
* Minimal, router-agnostic replacement for React Router's `useSearchParams`
|
|
170
|
-
* return shape. Consumers may inject their router's implementation for full
|
|
171
|
-
* SPA integration; otherwise the browser History API is used.
|
|
172
|
-
*
|
|
173
|
-
* @stability Beta
|
|
174
|
-
*/
|
|
175
|
-
interface SearchParamsAdapter {
|
|
176
|
-
searchParams: URLSearchParams;
|
|
177
|
-
setSearchParams: (next: URLSearchParams, options?: {
|
|
178
|
-
replace?: boolean;
|
|
179
|
-
}) => void;
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Browser-native {@link SearchParamsAdapter} built on the History API. Reads
|
|
183
|
-
* the current query string and writes updates via `pushState`/`replaceState`,
|
|
184
|
-
* staying reactive to `popstate` events. No router required.
|
|
185
|
-
*
|
|
186
|
-
* @stability Beta
|
|
187
|
-
*/
|
|
188
|
-
declare function useBrowserSearchParams(): SearchParamsAdapter;
|
|
189
|
-
|
|
190
|
-
export { DefaultLink as D, type GenesisLinkProps as G, type IsPathActiveOptions as I, type LinkComponent as L, type NavigationNode as N, type ResolvedNavigation as R, type SearchParamsAdapter as S, type NavigateFn as a, defaultNavigate as d, isPathActive as i, resolveNavigation as r, useBrowserSearchParams as u };
|
package/dist/slots-tR0wf89f.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { ComponentType, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The slot contract — genesis's escape hatch from an all-or-nothing pattern.
|
|
5
|
-
*
|
|
6
|
-
* A pattern component (`ResourcePage`, `DataPageShell`, …) is a composition of
|
|
7
|
-
* interior parts. Without a way to reach those parts, a consumer who needs ONE
|
|
8
|
-
* of them to differ has exactly two options: accept the whole thing as shipped,
|
|
9
|
-
* or fork it. Both are bad, and the second is what actually happens — which is
|
|
10
|
-
* how a downstream app ends up maintaining its own copy of a header it only
|
|
11
|
-
* wanted to change one button in.
|
|
12
|
-
*
|
|
13
|
-
* Genesis offers a customisation ladder, and this is its missing rung:
|
|
14
|
-
*
|
|
15
|
-
* 1. the pattern `<ResourcePage title="Questions" />`
|
|
16
|
-
* 2. the pattern + slots ← here: keep the wiring, swap or drop one part
|
|
17
|
-
* 3. the primitives `<DataPageShell><DataTable/></DataPageShell>`
|
|
18
|
-
* 4. the hook `useResourcePage()`, render it all yourself
|
|
19
|
-
*
|
|
20
|
-
* Rungs 1, 3 and 4 already existed (75 subpath exports, 9 hooks). Rung 2 is
|
|
21
|
-
* the one that keeps a consumer ON the ladder: dropping to rung 3 because a
|
|
22
|
-
* single part was wrong means re-deriving all the wiring that was already
|
|
23
|
-
* right, and that re-derivation is where the forks come from.
|
|
24
|
-
*
|
|
25
|
-
* Two knobs, following the `slots`/`slotProps` convention Material UI settled
|
|
26
|
-
* on (mui/material-ui#33416) so the shape is one a React developer already
|
|
27
|
-
* knows rather than one genesis invented:
|
|
28
|
-
*
|
|
29
|
-
* `slots` — REPLACE a part. Your component receives exactly the props
|
|
30
|
-
* genesis would have passed the default, so it can wrap the
|
|
31
|
-
* default and change one thing rather than reimplement it.
|
|
32
|
-
* `slotProps` — KEEP the part, pass it more props. The common case: a
|
|
33
|
-
* `className`, a `data-testid`, an `aria-label`.
|
|
34
|
-
*
|
|
35
|
-
* And the eject button: `slots={{ bulkBar: null }}` drops that part entirely.
|
|
36
|
-
* A pattern is a default, not a mandate — a consumer who wants the shell and
|
|
37
|
-
* the grid but none of the bulk bar should not have to leave to get that.
|
|
38
|
-
*/
|
|
39
|
-
/** Replace a part (`ComponentType`), or eject it (`null`). */
|
|
40
|
-
type SlotOverride<P> = ComponentType<P> | null;
|
|
41
|
-
/** `{ [part]: Component | null }` — see {@link renderSlot}. */
|
|
42
|
-
type Slots<M extends Record<string, object>> = {
|
|
43
|
-
[K in keyof M]?: SlotOverride<M[K]>;
|
|
44
|
-
};
|
|
45
|
-
/** `{ [part]: extraProps }` — merged over what genesis passes. */
|
|
46
|
-
type SlotPropsFor<M extends Record<string, object>> = {
|
|
47
|
-
[K in keyof M]?: Partial<M[K]>;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Renders one slot: the override if given, the default otherwise, nothing if
|
|
51
|
-
* ejected with `null`.
|
|
52
|
-
*
|
|
53
|
-
* `extra` merges LAST, so `slotProps` wins over genesis's own value. That is
|
|
54
|
-
* deliberate: a consumer reaching for `slotProps` is overriding on purpose,
|
|
55
|
-
* and a hatch that silently loses to the default is not a hatch. `className`
|
|
56
|
-
* is the one prop a caller should merge with `cn()` instead of replacing.
|
|
57
|
-
*/
|
|
58
|
-
declare function renderSlot<P extends object>(Default: ComponentType<P>, override: SlotOverride<P> | undefined, props: P, extra?: Partial<P>): ReactNode;
|
|
59
|
-
|
|
60
|
-
export { type SlotOverride as S, type SlotPropsFor as a, type Slots as b, renderSlot as r };
|