@tristan2828/ui-foundation 4.81.0 → 4.82.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/README.md CHANGED
@@ -18,7 +18,7 @@ than installing this by hand:
18
18
 
19
19
  | Import | What |
20
20
  |---|---|
21
- | `@tristan2828/ui-foundation` | `AppShell`, `DataTable`, `EntityView` (with `EditableValue`, `editInPlace`, printing its notes and `usePrinting`, `KeyStats`, `IconAction`), `EntityForm`, `Markdown` (with `countTasks`, `toggleTaskAt`), `RichTextEditor`, `ErrorState`, `MultiChoice`, `MultiReference`, `ListEditor`, `PasswordInput`, `RouteErrorBoundary`, `FoundationProviders`, `DataEnvironmentBanner`, `LoginRoute`, `RegisterRoute`, `useAuth`, `useTableUrlState`, `useRecordUpdate`, `useDebouncedValue`, `createQueryClient`, `cn`; types `Page`, `AppError`, `QuerySpec`. For timed screens (`docs/foundation/timed-screens.md`): `SessionView`, `useSessionClock`, `useWakeLock`, `useMuted`, `usePrefersReducedMotion`, and the audio cues `unlockAudio`, `chime`, `sequence`, `cancelCues`, `onCuesRecovered`, `cuesInSync`, `keepAudioAlive`, `say`, `hush`, `vibrate`, `canVibrate`. For reminders (`docs/foundation/reminders.md`): `AllowReminders`, `usePushPermission`. For a record opened in a dialog over its list (`docs/foundation/add-an-entity.md`): `RecordDialogRoute`, `RecordLink`, `useOpenRecord`, `useRecordDialog`, `recordDialogState` |
21
+ | `@tristan2828/ui-foundation` | `AppShell`, `DataTable`, `EntityView` (with `EditableValue`, `editInPlace`, printing its notes and `usePrinting`, `KeyStats`, `IconAction`), `EntityForm`, `Markdown` (with `countTasks`, `toggleTaskAt`), `RichTextEditor`, `ErrorState`, `MultiChoice`, `MultiReference`, `ListEditor`, `PasswordInput`, `RouteErrorBoundary`, `FoundationProviders`, `DataEnvironmentBanner`, `LoginRoute`, `RegisterRoute`, `useAuth`, `useTableUrlState`, `useRecordUpdate`, `useDebouncedValue`, `createQueryClient`, `cn`; types `Page`, `AppError`, `QuerySpec`. For timed screens (`docs/foundation/timed-screens.md`): `SessionView`, `useSessionClock`, `useWakeLock`, `useMuted`, `usePrefersReducedMotion`, and the audio cues `unlockAudio`, `chime`, `sequence`, `cancelCues`, `onCuesRecovered`, `cuesInSync`, `keepAudioAlive`, `say`, `hush`, `vibrate`, `canVibrate`. For reminders (`docs/foundation/reminders.md`): `AllowReminders`, `usePushPermission`. For a record opened in a dialog over its list (`docs/foundation/add-an-entity.md`): `RecordDialogRoute`, `RecordLink`, `useOpenRecord`, `useRecordDialog`, `recordDialogState`, and for a new record over it `useNewRecordDialog`. A small form in a dialog: `FormDialog`. From `/ui/dialog`, `DialogContent` takes `size` and `dirty`, and `DiscardChangesDialog` is the "Discard your changes?" prompt |
22
22
  | `@tristan2828/ui-foundation/ui/<name>` | shadcn primitives: badge, button, calendar, card, checkbox, combobox, dialog, empty, field, input, input-group, label, popover, select, separator, sheet, sidebar, skeleton, sonner, spinner, switch, table, textarea, tooltip |
23
23
  | `@tristan2828/ui-foundation/gateway` | `safeFetch`, `toAppError`, `networkError` — for an app's `src/api/gateway/` only |
24
24
  | `@tristan2828/ui-foundation/mocks` | MSW: `authHandlers`, `environmentHandlers`, `resetMockAuth`, `getMockCurrentUser`, `MOCK_USER`, `exposeMswForE2E` |
@@ -3,26 +3,27 @@
3
3
  <!-- index: written by `npm run docs:index` in the package from the headings below; never edit it by hand -->
4
4
  ## Index
5
5
 
6
- - [The reference files](#the-reference-files) · lines 41–63
7
- - [Before anything: the entity plan](#before-anything-the-entity-plan) · lines 65–806
8
- - Step 1: Add `<Entity>` to `openapi.yaml` · lines 107–114
9
- - Step 2: `npm run gen:api` · lines 115–116
10
- - Step 3: Add gateway tests in `tests/gateway/<entity>.test.ts`, derived from the spec · lines 117–128
11
- - Step 4: Add MSW handlers in `src/mocks/<entity>.ts` · lines 129–138
12
- - Step 5: Add a gateway module in `src/api/gateway/<entity>.ts` · lines 139–143
13
- - Step 6: Copy the reference files, one for one, not just the two screens · lines 144–693
14
- - Step 7: Register routes · lines 694–709
15
- - Step 8: Add Playwright specs for all three screens · lines 710–788
16
- - Step 9: Register the nav entry and route names · lines 789–803
17
- - Step 10: `npm run verify`. · lines 804–806
18
- - [How a list opens a record](#how-a-list-opens-a-record) · lines 808–960
19
- - [The record view](#the-record-view) · lines 921–960
20
- - [What not to copy](#what-not-to-copy) · lines 962–988
21
- - [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 990–1007
22
- - [Deleting](#deleting) · lines 1009–1038
23
- - [Fields only a script writes](#fields-only-a-script-writes) · lines 1040–1061
24
- - [Searching one part of the app](#searching-one-part-of-the-app) · lines 1063–1072
25
- - [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1075–1114
6
+ - [The reference files](#the-reference-files) · lines 42–64
7
+ - [Before anything: the entity plan](#before-anything-the-entity-plan) · lines 66–807
8
+ - Step 1: Add `<Entity>` to `openapi.yaml` · lines 108–115
9
+ - Step 2: `npm run gen:api` · lines 116–117
10
+ - Step 3: Add gateway tests in `tests/gateway/<entity>.test.ts`, derived from the spec · lines 118–129
11
+ - Step 4: Add MSW handlers in `src/mocks/<entity>.ts` · lines 130–139
12
+ - Step 5: Add a gateway module in `src/api/gateway/<entity>.ts` · lines 140–144
13
+ - Step 6: Copy the reference files, one for one, not just the two screens · lines 145–694
14
+ - Step 7: Register routes · lines 695–710
15
+ - Step 8: Add Playwright specs for all three screens · lines 711–789
16
+ - Step 9: Register the nav entry and route names · lines 790–804
17
+ - Step 10: `npm run verify`. · lines 805–807
18
+ - [How a list opens a record](#how-a-list-opens-a-record) · lines 809–1024
19
+ - [The record view](#the-record-view) · lines 958–997
20
+ - [Dialogs](#dialogs) · lines 999–1024
21
+ - [What not to copy](#what-not-to-copy) · lines 1026–1052
22
+ - [After a commit, in the backend](#after-a-commit-in-the-backend) · lines 1054–1071
23
+ - [Deleting](#deleting) · lines 1073–1102
24
+ - [Fields only a script writes](#fields-only-a-script-writes) · lines 1104–1125
25
+ - [Searching one part of the app](#searching-one-part-of-the-app) · lines 1127–1136
26
+ - [What a chat is told about an entity](#what-a-chat-is-told-about-an-entity) · lines 1139–1178
26
27
 
27
28
  <!-- /index -->
28
29
 
@@ -881,6 +882,42 @@ the dialog.
881
882
  { path: '<parents>/:id/edit', element: <<Parent>FormRoute /> }, // a sibling, not a child
882
883
  ```
883
884
 
885
+ **A new record over its list** (4.82), for a create form of up to about
886
+ 8 fields (a longer one is its own page, `<entity>/new` beside the list as
887
+ above): the list's `new` child route, named by `newPath`, is a
888
+ `FormDialog` over the list, from the list's New button
889
+ (`<RecordLink to="/<entity>/new">` or `useOpenRecord()`) and from a deep
890
+ link alike. Closing goes back to the list as a record's dialog does, and
891
+ after the save `useNewRecordDialog().openRecord(to)` opens the new record
892
+ over the same list, in the form's history entry.
893
+
894
+ ```tsx
895
+ {
896
+ path: '<entity>',
897
+ element: <RecordDialogRoute list={<<Entity>sTableRoute />} label="<Entity>" newPath="new" />,
898
+ children: [
899
+ { path: 'new', element: <New<Entity>Route /> },
900
+ { path: ':id', element: <<Entity>ViewRoute /> },
901
+ ],
902
+ },
903
+
904
+ // New<Entity>Route: the form's own fields and react-hook-form, in FormDialog (no `open`).
905
+ const created = useNewRecordDialog()
906
+ <FormDialog
907
+ title="New <entity>"
908
+ submitLabel="Add <entity>"
909
+ onSubmit={form.handleSubmit(async (values) => {
910
+ const saved = await create.mutateAsync(values)
911
+ created?.openRecord(`/<entity>/${saved.id}`)
912
+ })}
913
+ isSubmitting={create.isPending}
914
+ submitError={create.error}
915
+ dirty={form.formState.isDirty}
916
+ >
917
+ …fields…
918
+ </FormDialog>
919
+ ```
920
+
884
921
  - **The row opens it**: a click on the row, Enter on it, ↑/↓ between
885
922
  rows. So does a click on a link in the row to the record's own address
886
923
  (the name cell can stay a plain `<Link>`), and in a card layout a click
@@ -959,6 +996,33 @@ view reaches them all. A record uses the parts it has, in this order:
959
996
  Edit and its form page stay only for a field the view can't edit in
960
997
  place yet; the plan says which, and the gap is raised for the package.
961
998
 
999
+ ### Dialogs
1000
+
1001
+ Every dialog is one of three widths, `DialogContent`'s `size` (4.82):
1002
+
1003
+ | `size` | Width | On a phone (under 48rem) | Use it for |
1004
+ | --- | --- | --- | --- |
1005
+ | `confirm` | 420px | a sheet from the bottom, the buttons full width, the action above Cancel | a question with two answers: a delete, "Discard your changes?" |
1006
+ | `form` | 640px | the whole screen, the title and buttons pinned | a small form (`FormDialog`, which is this size) |
1007
+ | `record` | 1,120px | full width, the rail under the main column | a record over its list (`RecordDialogRoute`, which is this size) |
1008
+
1009
+ - **Never a width of its own** (`sm:max-w-…` on `DialogContent`). A
1010
+ confirm's buttons go in `DialogFooter`, Cancel first, so the phone's
1011
+ sheet stacks the action on top.
1012
+ - **A dialog with something typed asks before it closes**:
1013
+ `DialogContent dirty` (react-hook-form's `formState.isDirty`) makes Esc,
1014
+ ✕, a click outside and Cancel ask "Discard your changes?" first;
1015
+ nothing typed, nothing asked. Closing it from code after a save
1016
+ (`open={false}`) never asks. `DiscardChangesDialog` is that prompt on
1017
+ its own, for any other way of leaving with something unsaved.
1018
+ - **A form in a dialog is a `FormDialog`**: the title, the fields
1019
+ scrolling between it and the pinned Cancel and Add, a failed save as a
1020
+ destructive `Notice` above the buttons with Try again, and `dirty`.
1021
+ Opened from a page with `open`/`onOpenChange`; as a list's `new` route
1022
+ with neither (above).
1023
+ - **Always a dialog, never a side panel**, except a phone's filters
1024
+ (a bottom sheet of controls for the list behind it).
1025
+
962
1026
  ## What not to copy
963
1027
 
964
1028
  - `widget-quick-actions.tsx`, its `quick action: …` specs and
@@ -23,7 +23,7 @@ import { useCallback, useContext, useEffect, useId, useLayoutEffect, useRef, use
23
23
  import { useBlocker } from 'react-router';
24
24
  import { cn } from 'cn';
25
25
  import { Button } from '../ui/button.js';
26
- import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from '../ui/dialog.js';
26
+ import { DiscardChangesDialog } from '../ui/dialog.js';
27
27
  import { FieldError } from '../ui/field.js';
28
28
  import { Spinner } from '../ui/spinner.js';
29
29
  import { EditInPlaceContext } from './edit-in-place.js';
@@ -278,16 +278,14 @@ export function LeaveGuard({ store }) {
278
278
  document.removeEventListener('visibilitychange', onVisibilityChange);
279
279
  };
280
280
  }, [dirty, store]);
281
- return (_jsx(Dialog, { open: blocker.state === 'blocked' && (!savesOnLeave || saveFailed), onOpenChange: (open) => {
282
- if (open)
283
- return;
281
+ return (_jsx(DiscardChangesDialog, { open: blocker.state === 'blocked' && (!savesOnLeave || saveFailed), description: "A field you're editing hasn't been saved. Leaving now loses what you typed.", "data-leave-guard": "", onKeepEditing: () => {
284
282
  setSaveFailed(false);
285
283
  if (blocker.state === 'blocked')
286
284
  blocker.reset();
287
- }, children: _jsxs(DialogContent, { showCloseButton: false, "data-leave-guard": "", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Discard your changes?" }), _jsx(DialogDescription, { children: "A field you're editing hasn't been saved. Leaving now loses what you typed." })] }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { render: _jsx(Button, { variant: "outline" }), children: "Keep editing" }), _jsx(Button, { variant: "destructive", onClick: () => {
288
- store.discard();
289
- setSaveFailed(false);
290
- if (blocker.state === 'blocked')
291
- blocker.proceed();
292
- }, children: "Discard" })] })] }) }));
285
+ }, onDiscard: () => {
286
+ store.discard();
287
+ setSaveFailed(false);
288
+ if (blocker.state === 'blocked')
289
+ blocker.proceed();
290
+ } }));
293
291
  }
@@ -0,0 +1,29 @@
1
+ import { type FormEvent, type ReactNode } from 'react';
2
+ import type { AppError } from '../../api/contracts.js';
3
+ export type FormDialogProps = {
4
+ /** "New book": the dialog's name. */
5
+ title: string;
6
+ /** One short line under the title, only where the title can't say it. */
7
+ description?: ReactNode;
8
+ /**
9
+ * Whether it's open. Leave it out inside RecordDialogRoute's `newPath`
10
+ * route, which opens it; anywhere else it's closed until it's given.
11
+ */
12
+ open?: boolean;
13
+ /** Asked to close (Esc, the close button, a click outside, Cancel). */
14
+ onOpenChange?: (open: boolean) => void;
15
+ onSubmit: (event: FormEvent<HTMLFormElement>) => void;
16
+ isSubmitting: boolean;
17
+ /** "Add book": the word Add on every create form. */
18
+ submitLabel: string;
19
+ /** A save that failed: a Notice above the buttons, with Try again. */
20
+ submitError?: AppError | null;
21
+ /** Try again's action. Defaults to submitting the form again. */
22
+ onRetry?: () => void;
23
+ /** Something was typed: closing asks "Discard your changes?" first. */
24
+ dirty?: boolean;
25
+ /** The fields. */
26
+ children: ReactNode;
27
+ className?: string;
28
+ };
29
+ export declare function FormDialog({ title, description, open, onOpenChange, onSubmit, isSubmitting, submitLabel, submitError, onRetry, dirty, children, className, }: FormDialogProps): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ // A small form in a dialog (4.82): a new record of up to about eight
3
+ // fields over its list, or any short form a page opens (a weak spot, a
4
+ // quick add). The title and the buttons stay put and the fields scroll
5
+ // between them; 640px wide (DialogContent `size="form"`), the whole screen
6
+ // on a phone, with Cancel and the submit button as two wide buttons.
7
+ //
8
+ // Two ways to open one:
9
+ //
10
+ // - Anywhere, with `open` and `onOpenChange`, as any dialog.
11
+ // - As RecordDialogRoute's `newPath` route (`/widgets/new`), with neither:
12
+ // the route opens it over the list and closing goes back, as a record's
13
+ // dialog does. After the save, `useNewRecordDialog().openRecord(to)`
14
+ // opens the new record over the same list.
15
+ //
16
+ // `dirty` (react-hook-form's `formState.isDirty`) makes Esc, the close
17
+ // button, a click outside and Cancel ask "Discard your changes?" first.
18
+ // A failed save is a Notice above the buttons with Try again, which
19
+ // submits again unless `onRetry` says otherwise; what was typed stays.
20
+ //
21
+ // The form is the app's: its fields, its schema and its react-hook-form
22
+ // wiring, as with EntityForm. This draws the chrome around them.
23
+ import { useId, useRef } from 'react';
24
+ import { cn } from 'cn';
25
+ import { Button } from '../ui/button.js';
26
+ import { Dialog, DialogClose, DialogContent, DialogDescription, DialogTitle } from '../ui/dialog.js';
27
+ import { FieldGroup } from '../ui/field.js';
28
+ import { Spinner } from '../ui/spinner.js';
29
+ import { Notice } from './notice.js';
30
+ import { useNewRecordDialog } from './record-dialog-context.js';
31
+ export function FormDialog({ title, description, open, onOpenChange, onSubmit, isSubmitting, submitLabel, submitError, onRetry, dirty = false, children, className, }) {
32
+ const route = useNewRecordDialog();
33
+ const form = useRef(null);
34
+ const formId = useId();
35
+ const isOpen = open ?? route !== null;
36
+ return (_jsx(Dialog, { open: isOpen, onOpenChange: (next) => {
37
+ if (onOpenChange)
38
+ onOpenChange(next);
39
+ else if (!next)
40
+ route?.close();
41
+ }, children: _jsxs(DialogContent, { size: "form", dirty: dirty, "data-slot": "form-dialog", className: cn('gap-0 p-0', className), children: [_jsxs("div", { "data-slot": "form-dialog-header", className: "flex flex-col gap-1 px-4 pt-4 pb-2 pr-12 md:px-6 md:pt-5 md:pr-14", children: [_jsx(DialogTitle, { className: "type-section-title", children: title }), description && _jsx(DialogDescription, { children: description })] }), _jsxs("form", { ref: form, id: formId, onSubmit: onSubmit, noValidate: true, className: "flex min-h-0 flex-1 flex-col", children: [_jsx("div", { "data-slot": "form-dialog-body", className: "min-h-0 flex-1 overflow-y-auto px-4 py-4 md:px-6", children: _jsx(FieldGroup, { children: children }) }), _jsxs("div", { "data-slot": "form-dialog-bar", className: "flex flex-col gap-3 border-t px-4 py-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] md:px-6 md:pb-3", children: [_jsx("div", { role: "status", className: "empty:hidden", children: submitError && (_jsx(Notice, { tone: "destructive", action: _jsx(Button, { type: "button", size: "sm", variant: "outline", disabled: isSubmitting, onClick: () => (onRetry ? onRetry() : form.current?.requestSubmit()), children: "Try again" }), children: submitError.message })) }), _jsxs("div", { className: "flex justify-end gap-2 max-md:[&>*]:h-10 max-md:[&>*]:flex-1", children: [_jsx(DialogClose, { render: _jsx(Button, { type: "button", variant: "outline", disabled: isSubmitting }), children: "Cancel" }), _jsxs(Button, { type: "submit", disabled: isSubmitting, children: [isSubmitting && _jsx(Spinner, { className: "size-4" }), submitLabel] })] })] })] })] }) }));
42
+ }
@@ -37,3 +37,20 @@ export declare const RecordDialogContext: import("react").Context<RecordDialogCo
37
37
  * on the record's full page.
38
38
  */
39
39
  export declare function useRecordDialog(): RecordDialogContextValue | null;
40
+ export type NewRecordDialogContextValue = {
41
+ /** Closes the new record's form: back to the list, as Back does. */
42
+ close: () => void;
43
+ /**
44
+ * After the save: the new record, over the same list (this entry
45
+ * replaced, so Back from it is the list). `open('/widgets/12')`.
46
+ */
47
+ openRecord: (to: string) => void;
48
+ };
49
+ export declare const NewRecordDialogContext: import("react").Context<NewRecordDialogContextValue | null>;
50
+ /**
51
+ * Inside RecordDialogRoute's `newPath` route (`/widgets/new`): its `close`
52
+ * and `openRecord`. FormDialog reads it to open itself over the list with
53
+ * no `open` of its own; the route's form calls `openRecord` once it has
54
+ * saved. `null` anywhere else.
55
+ */
56
+ export declare function useNewRecordDialog(): NewRecordDialogContextValue | null;
@@ -46,3 +46,13 @@ export const RecordDialogContext = createContext(null);
46
46
  export function useRecordDialog() {
47
47
  return useContext(RecordDialogContext);
48
48
  }
49
+ export const NewRecordDialogContext = createContext(null);
50
+ /**
51
+ * Inside RecordDialogRoute's `newPath` route (`/widgets/new`): its `close`
52
+ * and `openRecord`. FormDialog reads it to open itself over the list with
53
+ * no `open` of its own; the route's form calls `openRecord` once it has
54
+ * saved. `null` anywhere else.
55
+ */
56
+ export function useNewRecordDialog() {
57
+ return useContext(NewRecordDialogContext);
58
+ }
@@ -8,7 +8,7 @@ export type RecordDialogRouteProps = {
8
8
  * loads, fails or isn't found. Once it loads, its title names the dialog.
9
9
  */
10
10
  label: string;
11
- /** Extra classes on the dialog's popup (its width, say: `sm:max-w-5xl`). */
11
+ /** Extra classes on the dialog's popup. It's 1,120px (`size="record"`) by default. */
12
12
  className?: string;
13
13
  /**
14
14
  * False: the record has no full page, only this dialog (DataTable's
@@ -26,8 +26,15 @@ export type RecordDialogRouteProps = {
26
26
  * records (the nested pattern).
27
27
  */
28
28
  listPath?: string;
29
+ /**
30
+ * The child route that creates a record (`'new'` for `/widgets/new`):
31
+ * drawn over the list with no record dialog round it, its element a
32
+ * FormDialog, which opens itself (useNewRecordDialog). Left out, every
33
+ * child is a record.
34
+ */
35
+ newPath?: string;
29
36
  };
30
- export declare function RecordDialogRoute({ list, label, className, fullPage, listPath: listAt }: RecordDialogRouteProps): import("react").JSX.Element | null;
37
+ export declare function RecordDialogRoute({ list, label, className, fullPage, listPath: listAt, newPath: newAt, }: RecordDialogRouteProps): import("react").JSX.Element | null;
31
38
  export type RecordLinkProps = Omit<ComponentProps<typeof Link>, 'state'>;
32
39
  /**
33
40
  * A link to a record that opens it over the current list (a board's card,
@@ -47,6 +47,22 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
47
47
  // { path: 'parents/:id', element: <RecordDialogRoute list={<ParentView />} label="Document" fullPage={false} />,
48
48
  // children: [{ path: 'children/:childId', element: <ChildView /> }] }
49
49
  //
50
+ // A new record over its list (4.82, `newPath`): the list's `new` child
51
+ // route (`/widgets/new`) is the create form, drawn as its own FormDialog
52
+ // over the list, always: opened from the list, from anywhere else, or a
53
+ // deep link (a form of up to about 8 fields has no page of its own). It
54
+ // has no record dialog round it; FormDialog opens itself from the
55
+ // route's context (useNewRecordDialog), closing goes back as a record's
56
+ // dialog does, and `openRecord` after the save swaps the entry for the new
57
+ // record over the same list:
58
+ //
59
+ // { path: 'widgets', element: <RecordDialogRoute list={<WidgetsTableRoute />} label="Widget" newPath="new" />,
60
+ // children: [{ path: 'new', element: <NewWidgetRoute /> }, { path: ':id', element: <WidgetViewRoute /> }] }
61
+ //
62
+ // The record dialog is 1,120px (DialogContent `size="record"`, 4.82), so
63
+ // an EntityView with `layout="rail"` keeps its rail beside the main
64
+ // column, as on its page; a narrower screen stacks them.
65
+ //
50
66
  // Inside, the record's route renders as it always does. EntityView sees
51
67
  // the dialog (useRecordDialog): its heading names the dialog, its back link
52
68
  // gives way to the dialog's own bar, and not found's way out closes the
@@ -58,16 +74,19 @@ import { cn } from 'cn';
58
74
  import { Button, buttonVariants } from '../ui/button.js';
59
75
  import { Dialog, DialogClose, DialogContent } from '../ui/dialog.js';
60
76
  import { escapePassedThrough } from './escape-passthrough.js';
61
- import { backgroundOf, recordDialogState, RecordDialogContext } from './record-dialog-context.js';
77
+ import { backgroundOf, NewRecordDialogContext, recordDialogState, RecordDialogContext, } from './record-dialog-context.js';
62
78
  // Two paths are the same address, give or take a trailing slash.
63
79
  const samePath = (a, b) => a.replace(/\/+$/, '') === b.replace(/\/+$/, '');
64
- export function RecordDialogRoute({ list, label, className, fullPage = true, listPath: listAt }) {
80
+ export function RecordDialogRoute({ list, label, className, fullPage = true, listPath: listAt, newPath: newAt, }) {
65
81
  const location = useLocation();
66
82
  const navigationType = useNavigationType();
67
83
  const navigate = useNavigate();
68
84
  const childOutlet = useOutlet();
69
85
  const titleId = useId();
70
86
  const listPath = useResolvedPath(listAt ?? '.').pathname;
87
+ // Resolved from the list's address: `/widgets/new` beside `/widgets/12`.
88
+ const newPathname = useResolvedPath(newAt === undefined ? '.' : `${listPath}/${newAt}`).pathname;
89
+ const atNew = newAt !== undefined && samePath(location.pathname, newPathname);
71
90
  // With `listPath`, its own (element-less) child is the list, not a record.
72
91
  const atList = listAt !== undefined && samePath(location.pathname, listPath);
73
92
  const outlet = atList ? null : childOutlet;
@@ -76,16 +95,19 @@ export function RecordDialogRoute({ list, label, className, fullPage = true, lis
76
95
  // would be a page the user wasn't on.
77
96
  // With no full page, a record opened any other way is the dialog over
78
97
  // the list's plain address, with nothing to go back over.
98
+ // The new record's form is always over the list.
99
+ const plainList = { pathname: listPath, search: '', hash: '', depth: 0 };
79
100
  const background = opened && samePath(opened.pathname, listPath)
80
101
  ? opened
81
- : !fullPage && outlet !== null
82
- ? { pathname: listPath, search: '', hash: '', depth: 0 }
102
+ : (!fullPage || atNew) && outlet !== null
103
+ ? plainList
83
104
  : null;
84
- const open = outlet !== null && background !== null;
105
+ const over = outlet !== null && background !== null;
106
+ const open = over && !atNew;
85
107
  // The list sees the address it was opened from, not the record's, so
86
108
  // its URL state (filters, sort, page) stays as it was under the dialog.
87
109
  const { pathname, search, hash } = background ?? location;
88
- const listLocation = useMemo(() => ({ pathname, search, hash, state: null, key: open ? 'record-dialog-list' : location.key }), [pathname, search, hash, open, location.key]);
110
+ const listLocation = useMemo(() => ({ pathname, search, hash, state: null, key: over ? 'record-dialog-list' : location.key }), [pathname, search, hash, over, location.key]);
89
111
  const listContext = useMemo(() => ({ location: listLocation, navigationType }), [listLocation, navigationType]);
90
112
  const depth = background?.depth ?? 0;
91
113
  const close = useCallback(() => {
@@ -98,14 +120,19 @@ export function RecordDialogRoute({ list, label, className, fullPage = true, lis
98
120
  void navigate(-depth);
99
121
  }, [navigate, location.key, depth, pathname, search, hash]);
100
122
  const dialog = useMemo(() => ({ titleId, close }), [titleId, close]);
123
+ // After the save: the new record over the same list, in this entry.
124
+ const created = useMemo(() => ({
125
+ close,
126
+ openRecord: (to) => void navigate(to, { replace: true, state: { recordDialog: { pathname, search, hash, depth } } }),
127
+ }), [close, navigate, pathname, search, hash, depth]);
101
128
  // The record's full page: a deep link, or "Open full page".
102
- if (outlet !== null && !open)
129
+ if (outlet !== null && !over)
103
130
  return outlet;
104
131
  // `listPath` given and this route's own address (no index route): there
105
132
  // is no list here to draw.
106
133
  if (listAt !== undefined && outlet === null && !atList)
107
134
  return null;
108
- return (_jsxs(_Fragment, { children: [_jsx(LocationContext.Provider, { value: listContext, children: list }), _jsx(Dialog, { open: open, onOpenChange: (next, details) => {
135
+ return (_jsxs(_Fragment, { children: [_jsx(LocationContext.Provider, { value: listContext, children: list }), atNew && _jsx(NewRecordDialogContext.Provider, { value: created, children: outlet }), _jsx(Dialog, { open: open, onOpenChange: (next, details) => {
109
136
  if (next)
110
137
  return;
111
138
  // An Esc something inside already used (a field edited in place
@@ -118,7 +145,7 @@ export function RecordDialogRoute({ list, label, className, fullPage = true, lis
118
145
  return;
119
146
  }
120
147
  close();
121
- }, children: _jsxs(DialogContent, { showCloseButton: false, "aria-labelledby": titleId, "aria-label": label, "data-slot": "record-dialog", className: cn('flex max-h-[calc(100dvh-2rem)] flex-col gap-0 overflow-hidden p-0 sm:max-w-4xl data-closed:hidden', className), children: [_jsxs("div", { className: cn('flex items-center gap-2 border-b px-2 py-2', fullPage ? 'justify-between' : 'justify-end'), children: [fullPage && (_jsxs(Link, { to: { pathname: location.pathname, search: location.search, hash: location.hash }, replace: true, className: buttonVariants({ variant: 'ghost', size: 'sm' }), children: [_jsx(Maximize2Icon, { "aria-hidden": "true" }), "Open full page"] })), _jsxs(DialogClose, { render: _jsx(Button, { variant: "ghost", size: "icon-sm" }), children: [_jsx(XIcon, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: "Close" })] })] }), _jsx("div", { "data-slot": "record-dialog-body", className: "min-h-0 overflow-y-auto p-4 sm:p-6", children: _jsx(RecordDialogContext.Provider, { value: dialog, children: open && outlet }) })] }) })] }));
148
+ }, children: _jsxs(DialogContent, { showCloseButton: false, "aria-labelledby": titleId, "aria-label": label, "data-slot": "record-dialog", size: "record", className: cn('gap-0 overflow-hidden p-0 data-closed:hidden', className), children: [_jsxs("div", { className: cn('flex items-center gap-2 border-b px-2 py-2', fullPage ? 'justify-between' : 'justify-end'), children: [fullPage && (_jsxs(Link, { to: { pathname: location.pathname, search: location.search, hash: location.hash }, replace: true, className: buttonVariants({ variant: 'ghost', size: 'sm' }), children: [_jsx(Maximize2Icon, { "aria-hidden": "true" }), "Open full page"] })), _jsxs(DialogClose, { render: _jsx(Button, { variant: "ghost", size: "icon-sm" }), children: [_jsx(XIcon, { "aria-hidden": "true" }), _jsx("span", { className: "sr-only", children: "Close" })] })] }), _jsx("div", { "data-slot": "record-dialog-body", className: "min-h-0 overflow-y-auto p-4 sm:p-6", children: _jsx(RecordDialogContext.Provider, { value: dialog, children: open && outlet }) })] }) })] }));
122
149
  }
123
150
  /**
124
151
  * A link to a record that opens it over the current list (a board's card,
@@ -1,7 +1,7 @@
1
1
  import { useRender } from "@base-ui/react/use-render";
2
2
  import { type VariantProps } from "class-variance-authority";
3
3
  declare const badgeVariants: (props?: ({
4
- variant?: "link" | "success" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "solid" | "warning" | "info" | "outline-success" | "outline-warning" | "outline-info" | "outline-destructive" | "tinted-success" | "tinted-warning" | "tinted-info" | "tinted-destructive" | null | undefined;
4
+ variant?: "link" | "success" | "default" | "outline" | "secondary" | "ghost" | "destructive" | "solid" | "info" | "warning" | "outline-success" | "outline-warning" | "outline-info" | "outline-destructive" | "tinted-success" | "tinted-warning" | "tinted-info" | "tinted-destructive" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  declare function Badge({ className, variant, render, ...props }: useRender.ComponentProps<"span"> & VariantProps<typeof badgeVariants>): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
7
7
  export { Badge, badgeVariants };
@@ -1,12 +1,26 @@
1
1
  import * as React from "react";
2
2
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
3
- declare function Dialog({ ...props }: DialogPrimitive.Root.Props): React.JSX.Element;
3
+ declare function Dialog({ onOpenChange, actionsRef: actionsRefProp, children, ...props }: DialogPrimitive.Root.Props): React.JSX.Element;
4
4
  declare function DialogTrigger({ ...props }: DialogPrimitive.Trigger.Props): React.JSX.Element;
5
5
  declare function DialogPortal({ ...props }: DialogPrimitive.Portal.Props): React.JSX.Element;
6
6
  declare function DialogClose({ ...props }: DialogPrimitive.Close.Props): React.JSX.Element;
7
7
  declare function DialogOverlay({ className, ...props }: DialogPrimitive.Backdrop.Props): React.JSX.Element;
8
- declare function DialogContent({ className, children, showCloseButton, ...props }: DialogPrimitive.Popup.Props & {
8
+ /**
9
+ * The dialog's width: `confirm` 420px (a question with two buttons; a
10
+ * bottom sheet on a phone), `form` 640px (a small form; the whole screen
11
+ * on a phone), `record` 1,120px (a record over its list, as wide as its
12
+ * page). Left out, shadcn's 384px.
13
+ */
14
+ type DialogSize = "confirm" | "form" | "record";
15
+ declare function DialogContent({ className, children, showCloseButton, size, dirty, ...props }: DialogPrimitive.Popup.Props & {
9
16
  showCloseButton?: boolean;
17
+ /** One of the three widths (see DialogSize). Left out, 384px. */
18
+ size?: DialogSize;
19
+ /**
20
+ * Something was typed and not saved: closing (Esc, the close button, a
21
+ * click outside, a DialogClose) asks "Discard your changes?" first.
22
+ */
23
+ dirty?: boolean;
10
24
  }): React.JSX.Element;
11
25
  declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
12
26
  declare function DialogFooter({ className, showCloseButton, children, ...props }: React.ComponentProps<"div"> & {
@@ -14,4 +28,19 @@ declare function DialogFooter({ className, showCloseButton, children, ...props }
14
28
  }): React.JSX.Element;
15
29
  declare function DialogTitle({ className, ...props }: DialogPrimitive.Title.Props): React.JSX.Element;
16
30
  declare function DialogDescription({ className, ...props }: DialogPrimitive.Description.Props): React.JSX.Element;
17
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
31
+ /**
32
+ * "Discard your changes?": the one prompt for leaving with something typed
33
+ * and not saved (a dialog's `dirty`, a form's leave guard, a value edited
34
+ * in place). A confirm: 420px, a bottom sheet on a phone. Esc or a click
35
+ * outside keeps editing.
36
+ */
37
+ declare function DiscardChangesDialog({ open, onKeepEditing, onDiscard, description, ...props }: {
38
+ open: boolean;
39
+ /** Keep editing, Esc or a click outside: the prompt closes and nothing is lost. */
40
+ onKeepEditing: () => void;
41
+ /** Discard: throw away what was typed and leave. */
42
+ onDiscard: () => void;
43
+ /** The line under the question. Defaults to "What you typed will be lost." */
44
+ description?: React.ReactNode;
45
+ } & Omit<DialogPrimitive.Popup.Props, "children">): React.JSX.Element;
46
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscardChangesDialog, type DialogSize, };
@@ -1,11 +1,35 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { Dialog as DialogPrimitive } from "@base-ui/react/dialog";
4
4
  import { cn } from "cn";
5
5
  import { Button } from "./button.js";
6
6
  import { XIcon } from "lucide-react";
7
- function Dialog({ ...props }) {
8
- return _jsx(DialogPrimitive.Root, { "data-slot": "dialog", ...props });
7
+ const DialogGuardContext = React.createContext(null);
8
+ const IMPERATIVE = "imperative-action";
9
+ function Dialog({ onOpenChange, actionsRef: actionsRefProp, children, ...props }) {
10
+ const ownActions = React.useRef(null);
11
+ const actionsRef = actionsRefProp ?? ownActions;
12
+ const dirty = React.useRef(false);
13
+ const [asking, setAsking] = React.useState(false);
14
+ const guard = React.useMemo(() => ({
15
+ setDirty: (next) => {
16
+ dirty.current = next;
17
+ },
18
+ }), []);
19
+ const discard = () => {
20
+ setAsking(false);
21
+ dirty.current = false;
22
+ actionsRef.current?.close();
23
+ };
24
+ const ask = (_jsx(DiscardChangesDialog, { open: asking, onKeepEditing: () => setAsking(false), onDiscard: discard }));
25
+ return (_jsx(DialogGuardContext.Provider, { value: guard, children: _jsx(DialogPrimitive.Root, { "data-slot": "dialog", actionsRef: actionsRef, onOpenChange: (open, details) => {
26
+ if (!open && dirty.current && details.reason !== IMPERATIVE) {
27
+ details.cancel();
28
+ setAsking(true);
29
+ return;
30
+ }
31
+ onOpenChange?.(open, details);
32
+ }, ...props, children: typeof children === "function" ? ((payload) => (_jsxs(_Fragment, { children: [children(payload), ask] }))) : (_jsxs(_Fragment, { children: [children, ask] })) }) }));
9
33
  }
10
34
  function DialogTrigger({ ...props }) {
11
35
  return _jsx(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
@@ -19,8 +43,27 @@ function DialogClose({ ...props }) {
19
43
  function DialogOverlay({ className, ...props }) {
20
44
  return (_jsx(DialogPrimitive.Backdrop, { "data-slot": "dialog-overlay", className: cn("fixed inset-0 isolate z-50 bg-black/20 duration-100 supports-backdrop-filter:backdrop-blur-sm dark:bg-black/40 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0", className), ...props }));
21
45
  }
22
- function DialogContent({ className, children, showCloseButton = true, ...props }) {
23
- return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-2 right-2", size: "icon-sm" }), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
46
+ // Written phone first, the laptop's look from `md:` (48rem), so nothing
47
+ // in the base classes' `sm:` (40rem) leaks into a phone's layout between
48
+ // the two. cn() drops each base class these replace.
49
+ const DIALOG_SIZE = {
50
+ // A phone: a sheet across the bottom, its footer's buttons full width
51
+ // and 40px, stacked with the action (the footer's last child) on top,
52
+ // clear of the home indicator.
53
+ confirm: cn("top-auto bottom-0 left-0 max-w-none translate-x-0 translate-y-0 rounded-t-2xl rounded-b-none sm:max-w-none data-open:slide-in-from-bottom-8 data-closed:slide-out-to-bottom-8", "max-md:[&_[data-slot=dialog-footer]]:flex-col-reverse max-md:[&_[data-slot=dialog-footer]]:pb-[calc(1rem+env(safe-area-inset-bottom))] max-md:[&_[data-slot=dialog-footer]>*]:h-10 max-md:[&_[data-slot=dialog-footer]>*]:w-full", "md:top-1/2 md:bottom-auto md:left-1/2 md:max-w-[26.25rem] md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-xl md:data-open:slide-in-from-bottom-0 md:data-closed:slide-out-to-bottom-0"),
54
+ // A column whose children decide what scrolls (FormDialog's body). A
55
+ // phone: the whole screen.
56
+ form: cn("inset-0 flex h-dvh max-h-none max-w-none translate-x-0 translate-y-0 flex-col rounded-none ring-0 sm:max-w-none", "md:inset-auto md:top-1/2 md:left-1/2 md:h-auto md:max-h-[calc(100dvh-2rem)] md:max-w-[40rem] md:-translate-x-1/2 md:-translate-y-1/2 md:rounded-xl md:ring-1"),
57
+ // A phone keeps the 1rem margin round it, the rail under the main column.
58
+ record: "flex max-h-[calc(100dvh-2rem)] flex-col sm:max-w-[70rem]",
59
+ };
60
+ function DialogContent({ className, children, showCloseButton = true, size, dirty = false, ...props }) {
61
+ const guard = React.useContext(DialogGuardContext);
62
+ React.useEffect(() => {
63
+ guard?.setDirty(dirty);
64
+ }, [guard, dirty]);
65
+ React.useEffect(() => () => guard?.setDirty(false), [guard]);
66
+ return (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Popup, { "data-slot": "dialog-content", "data-size": size, className: cn("fixed top-1/2 left-1/2 z-50 grid w-full max-w-[calc(100%-2rem)] -translate-x-1/2 -translate-y-1/2 gap-4 rounded-xl bg-popover p-4 text-sm text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none sm:max-w-sm data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", size && DIALOG_SIZE[size], className), ...props, children: [children, showCloseButton && (_jsxs(DialogPrimitive.Close, { "data-slot": "dialog-close", render: _jsx(Button, { variant: "ghost", className: "absolute top-2 right-2", size: "icon-sm" }), children: [_jsx(XIcon, {}), _jsx("span", { className: "sr-only", children: "Close" })] }))] })] }));
24
67
  }
25
68
  function DialogHeader({ className, ...props }) {
26
69
  return (_jsx("div", { "data-slot": "dialog-header", className: cn("flex flex-col gap-2", className), ...props }));
@@ -34,4 +77,18 @@ function DialogTitle({ className, ...props }) {
34
77
  function DialogDescription({ className, ...props }) {
35
78
  return (_jsx(DialogPrimitive.Description, { "data-slot": "dialog-description", className: cn("text-sm text-muted-foreground *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground", className), ...props }));
36
79
  }
37
- export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, };
80
+ /**
81
+ * "Discard your changes?": the one prompt for leaving with something typed
82
+ * and not saved (a dialog's `dirty`, a form's leave guard, a value edited
83
+ * in place). A confirm: 420px, a bottom sheet on a phone. Esc or a click
84
+ * outside keeps editing.
85
+ */
86
+ function DiscardChangesDialog({ open, onKeepEditing, onDiscard, description = "What you typed will be lost.", ...props }) {
87
+ // Its own Root, outside any guard: rendered inside a dirty dialog, its
88
+ // content mustn't tell that dialog's guard it's clean.
89
+ return (_jsx(DialogGuardContext.Provider, { value: null, children: _jsx(DialogPrimitive.Root, { open: open, onOpenChange: (next) => {
90
+ if (!next)
91
+ onKeepEditing();
92
+ }, children: _jsxs(DialogContent, { size: "confirm", showCloseButton: false, "data-discard-changes": "", ...props, children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { children: "Discard your changes?" }), _jsx(DialogDescription, { children: description })] }), _jsxs(DialogFooter, { children: [_jsx(DialogClose, { render: _jsx(Button, { variant: "outline" }), children: "Keep editing" }), _jsx(Button, { variant: "destructive", onClick: onDiscard, children: "Discard" })] })] }) }) }));
93
+ }
94
+ export { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DiscardChangesDialog, };
package/dist/index.d.ts CHANGED
@@ -19,7 +19,8 @@ export { EntityView, type EntityViewEmptyFields, type EntityViewField, type Enti
19
19
  export { entityViewTabSlug } from './lib/entity-view-tab.js';
20
20
  export { usePrinting } from './components/app/print-context.js';
21
21
  export { RecordDialogRoute, RecordLink, type RecordDialogRouteProps, type RecordLinkProps, } from './components/app/record-dialog.js';
22
- export { recordDialogState, useOpenRecord, useRecordDialog, type RecordDialogBackground, type RecordDialogContextValue, type RecordDialogState, } from './components/app/record-dialog-context.js';
22
+ export { recordDialogState, useNewRecordDialog, useOpenRecord, useRecordDialog, type NewRecordDialogContextValue, type RecordDialogBackground, type RecordDialogContextValue, type RecordDialogState, } from './components/app/record-dialog-context.js';
23
+ export { FormDialog, type FormDialogProps } from './components/app/form-dialog.js';
23
24
  export { editInPlace, type EditControlProps, type EditInPlace, type EditInPlaceList, type EditInPlaceListOptions, type EditInPlaceOptions, type EditKind, type EditListAddProps, type EditListItemProps, } from './components/app/edit-in-place.js';
24
25
  export { inPlace, type InPlaceDateConfig, type InPlaceFieldsOptions, type InPlaceLinkConfig, type InPlaceLinkValue, type InPlaceMoneyConfig, type InPlaceMonthDayConfig, type InPlaceNumberConfig, type InPlaceOption, type InPlacePart, type InPlaceRecord, type InPlaceReferenceConfig, type InPlaceSaved, type InPlaceSelectConfig, type InPlaceTextConfig, } from './components/app/edit-in-place-presets.js';
25
26
  export { linkHost, linkHref, linkRule } from './lib/link-href.js';
package/dist/index.js CHANGED
@@ -23,7 +23,8 @@ export { EntityView, } from './components/app/entity-view.js';
23
23
  export { entityViewTabSlug } from './lib/entity-view-tab.js';
24
24
  export { usePrinting } from './components/app/print-context.js';
25
25
  export { RecordDialogRoute, RecordLink, } from './components/app/record-dialog.js';
26
- export { recordDialogState, useOpenRecord, useRecordDialog, } from './components/app/record-dialog-context.js';
26
+ export { recordDialogState, useNewRecordDialog, useOpenRecord, useRecordDialog, } from './components/app/record-dialog-context.js';
27
+ export { FormDialog } from './components/app/form-dialog.js';
27
28
  export { editInPlace, } from './components/app/edit-in-place.js';
28
29
  export { inPlace, } from './components/app/edit-in-place-presets.js';
29
30
  export { linkHost, linkHref, linkRule } from './lib/link-href.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tristan2828/ui-foundation",
3
- "version": "4.81.0",
3
+ "version": "4.82.0",
4
4
  "description": "Shared UI foundation for contract-first, database-backed React apps: shadcn primitives, DataTable/EntityForm composites, auth, the gateway error seam, design tokens, lint rules and the AI playbook.",
5
5
  "license": "MIT",
6
6
  "repository": {