@passui/tanstack 0.2.4 → 0.2.6
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 +3 -42
- package/dist/types/src/auth-shell/auth-shell.d.ts +5 -0
- package/dist/types/src/document/compose-viewport.d.ts +20 -0
- package/dist/types/src/form-fields/fields.d.ts +24 -0
- package/dist/types/src/form-fields/index.d.ts +2 -0
- package/dist/types/src/form-fields/selection.d.ts +21 -0
- package/dist/types/src/form-fields/submit.d.ts +3 -0
- package/dist/types/src/forms/contexts.d.ts +1 -0
- package/dist/types/src/forms/elements/form-alert.d.ts +6 -0
- package/dist/types/src/forms/elements/submit.d.ts +1 -0
- package/dist/types/src/forms/fields/avatar-picker.d.ts +30 -0
- package/dist/types/src/forms/fields/avatar.d.ts +30 -0
- package/dist/types/src/forms/fields/checkbox.d.ts +1 -0
- package/dist/types/src/forms/fields/index.d.ts +21 -0
- package/dist/types/src/forms/fields/input.d.ts +1 -0
- package/dist/types/src/forms/fields/multiselect.d.ts +1 -0
- package/dist/types/src/forms/fields/otp.d.ts +1 -0
- package/dist/types/src/forms/fields/radio-card.d.ts +1 -0
- package/dist/types/src/forms/fields/switch.d.ts +1 -0
- package/dist/types/src/forms/fields/textarea.d.ts +1 -0
- package/dist/types/src/forms/index.d.ts +41 -0
- package/dist/types/src/mutation/index.d.ts +1 -0
- package/dist/types/src/mutation/use-app-mutation.d.ts +22 -0
- package/dist/types/src/route-boundary/default-boundary.d.ts +2 -0
- package/dist/types/src/route-boundary/default-loader.d.ts +6 -0
- package/dist/types/src/route-boundary/index.d.ts +3 -0
- package/dist/types/src/route-boundary/not-founder.d.ts +4 -0
- package/dist/types/src/settings/setting-list.d.ts +51 -0
- package/dist/types/src/shared/index.d.ts +2 -0
- package/dist/types/src/shared/optimistic.d.ts +3 -0
- package/dist/types/src/shared/table.d.ts +11 -0
- package/dist/types/src/{solid/tables → tables}/columns.d.ts +1 -2
- package/dist/types/src/tables/data-table.d.ts +76 -0
- package/dist/types/src/tables/filter-row.d.ts +9 -0
- package/dist/types/src/{solid/tables → tables}/index.d.ts +0 -1
- package/dist/types/src/tables/pagination.d.ts +8 -0
- package/dist/types/src/tables/utils.d.ts +1 -0
- package/package.json +8 -93
- package/src/document/compose-viewport.tsx +4 -20
- package/src/form-fields/fields.tsx +17 -62
- package/src/form-fields/selection.tsx +12 -52
- package/src/form-fields/submit.tsx +1 -6
- package/src/forms/contexts.ts +2 -6
- package/src/forms/elements/form-alert.tsx +2 -11
- package/src/forms/fields/avatar-picker.tsx +39 -119
- package/src/forms/fields/avatar.tsx +13 -43
- package/src/forms/fields/index.ts +1 -4
- package/src/forms/index.ts +1 -5
- package/src/mutation/use-app-mutation.ts +32 -88
- package/src/route-boundary/default-boundary.tsx +4 -19
- package/src/route-boundary/default-loader.tsx +14 -10
- package/src/route-boundary/not-founder.tsx +3 -14
- package/src/settings/setting-list.tsx +10 -41
- package/src/shared/optimistic.ts +15 -3
- package/src/shared/table.ts +6 -24
- package/src/tables/columns.tsx +4 -13
- package/src/tables/data-table.tsx +130 -225
- package/src/tables/filter-row.tsx +19 -83
- package/src/tables/pagination.tsx +4 -12
- package/dist/client/chunks/form-fields-DlWu70u5.js +0 -630
- package/dist/client/src/solid/auth-shell/index.js +0 -15
- package/dist/client/src/solid/document/index.js +0 -51
- package/dist/client/src/solid/form-fields/index.js +0 -1
- package/dist/client/src/solid/forms/index.js +0 -33
- package/dist/client/src/solid/mutation/index.js +0 -46
- package/dist/client/src/solid/route-boundary/index.js +0 -73
- package/dist/client/src/solid/settings/index.js +0 -173
- package/dist/client/src/solid/tables/index.js +0 -500
- package/dist/server/src/solid/auth-shell/index.js +0 -15
- package/dist/server/src/solid/document/index.js +0 -55
- package/dist/server/src/solid/form-fields/index.js +0 -598
- package/dist/server/src/solid/forms/index.js +0 -33
- package/dist/server/src/solid/mutation/index.js +0 -46
- package/dist/server/src/solid/route-boundary/index.js +0 -73
- package/dist/server/src/solid/settings/index.js +0 -169
- package/dist/server/src/solid/tables/index.js +0 -480
- package/dist/types/src/solid/auth-shell/auth-shell.d.ts +0 -4
- package/dist/types/src/solid/document/compose-viewport.d.ts +0 -14
- package/dist/types/src/solid/form-fields/avatar.d.ts +0 -26
- package/dist/types/src/solid/form-fields/fields.d.ts +0 -45
- package/dist/types/src/solid/form-fields/index.d.ts +0 -3
- package/dist/types/src/solid/form-fields/submit.d.ts +0 -3
- package/dist/types/src/solid/forms/contexts.d.ts +0 -1
- package/dist/types/src/solid/forms/form-alert.d.ts +0 -6
- package/dist/types/src/solid/forms/index.d.ts +0 -43
- package/dist/types/src/solid/mutation/index.d.ts +0 -1
- package/dist/types/src/solid/mutation/use-app-mutation.d.ts +0 -22
- package/dist/types/src/solid/route-boundary/boundaries.d.ts +0 -8
- package/dist/types/src/solid/route-boundary/index.d.ts +0 -1
- package/dist/types/src/solid/settings/setting-list.d.ts +0 -37
- package/dist/types/src/solid/tables/data-table.d.ts +0 -58
- package/dist/types/src/solid/tables/filter-row.d.ts +0 -9
- package/dist/types/src/solid/tables/pagination.d.ts +0 -7
- package/src/solid/auth-shell/auth-shell.tsx +0 -16
- package/src/solid/auth-shell/index.ts +0 -1
- package/src/solid/document/compose-viewport.tsx +0 -69
- package/src/solid/document/index.ts +0 -1
- package/src/solid/form-fields/avatar.tsx +0 -370
- package/src/solid/form-fields/fields.tsx +0 -336
- package/src/solid/form-fields/index.ts +0 -3
- package/src/solid/form-fields/submit.tsx +0 -31
- package/src/solid/forms/contexts.ts +0 -7
- package/src/solid/forms/form-alert.tsx +0 -19
- package/src/solid/forms/index.ts +0 -32
- package/src/solid/mutation/index.ts +0 -5
- package/src/solid/mutation/use-app-mutation.ts +0 -171
- package/src/solid/route-boundary/boundaries.tsx +0 -104
- package/src/solid/route-boundary/index.ts +0 -1
- package/src/solid/settings/index.ts +0 -1
- package/src/solid/settings/setting-list.tsx +0 -185
- package/src/solid/styles.css +0 -2
- package/src/solid/tables/columns.tsx +0 -40
- package/src/solid/tables/data-table.tsx +0 -448
- package/src/solid/tables/filter-row.tsx +0 -161
- package/src/solid/tables/index.ts +0 -4
- package/src/solid/tables/pagination.tsx +0 -78
- /package/dist/types/src/{solid/auth-shell → auth-shell}/index.d.ts +0 -0
- /package/dist/types/src/{solid/document → document}/index.d.ts +0 -0
- /package/dist/types/src/{solid/settings → settings}/index.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,45 +1,7 @@
|
|
|
1
1
|
# @passui/tanstack
|
|
2
2
|
|
|
3
3
|
Optional TanStack Form, Query, Table and Router integrations for Passui.
|
|
4
|
-
|
|
5
|
-
entry points. Shared helpers have no UI runtime dependency.
|
|
6
|
-
|
|
7
|
-
## SolidJS
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
bunx @passui/cli@latest init --framework solid --integration tanstack
|
|
11
|
-
# Manual alternative
|
|
12
|
-
bun add @passui/solid @passui/tanstack solid-js tailwindcss @tanstack/solid-form @tanstack/solid-query @tanstack/solid-router @tanstack/solid-table
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
```css
|
|
16
|
-
@import "@passui/tanstack/solid/styles.css";
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
import { createAppForm } from "@passui/tanstack/solid/forms"
|
|
21
|
-
import { createAppMutation } from "@passui/tanstack/solid/mutation"
|
|
22
|
-
import { DataTable, selectColumn } from "@passui/tanstack/solid/tables"
|
|
23
|
-
import { ComposeViewport } from "@passui/tanstack/solid/document"
|
|
24
|
-
import { AuthShell } from "@passui/tanstack/solid/auth-shell"
|
|
25
|
-
import { SettingList } from "@passui/tanstack/solid/settings"
|
|
26
|
-
import { DefaultBoundary, DefaultLoader, NotFound } from "@passui/tanstack/solid/route-boundary"
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Solid form and mutation options are accessors: `createAppForm(() => ({
|
|
30
|
-
defaultValues, onSubmit }))` and `createAppMutation(() => ({ mutationFn }))`.
|
|
31
|
-
`useAppForm` and `useAppMutation` aliases are also exported. Field contexts
|
|
32
|
-
return an accessor; use `field().state.value`. Bound fields include input,
|
|
33
|
-
checkbox, textarea, switch, radioCard, multiselect, avatar and otp.
|
|
34
|
-
Mount Solid QueryClientProvider around mutation consumers.
|
|
35
|
-
|
|
36
|
-
Use SolidJS 1.9.17+ and compile this package's TSX through Solid. In Vite 8,
|
|
37
|
-
exclude `@passui/solid` and `@passui/tanstack` from `optimizeDeps`, include
|
|
38
|
-
`solid` in `resolve.conditions`, and put both packages plus
|
|
39
|
-
`/@tanstack\/solid-/` in `ssr.noExternal`. SSR conditions should include
|
|
40
|
-
`solid`, `module`, `node` and `development|production`. This compiles the
|
|
41
|
-
Solid framework source for the right server runtime. See the complete
|
|
42
|
-
config in `@passui/solid`'s README or use the generated starter.
|
|
4
|
+
This package provides React adapters and runtime-independent shared helpers.
|
|
43
5
|
|
|
44
6
|
## React
|
|
45
7
|
|
|
@@ -56,12 +18,11 @@ React exports use `/react/forms`, `/react/form-fields`, `/react/mutation`,
|
|
|
56
18
|
and `/react/route-boundary`. Existing unprefixed paths, such as `/forms`,
|
|
57
19
|
remain React defaults. Existing `/styles.css` also remains available.
|
|
58
20
|
|
|
59
|
-
|
|
60
|
-
mandatory React dependencies. The CLI installs the appropriate peers
|
|
21
|
+
Framework dependencies are optional peers. The CLI installs the appropriate peers
|
|
61
22
|
while preserving existing versions. Manual React setups must install the
|
|
62
23
|
React TanStack adapters they use; `/document` also imports TanStack React
|
|
63
24
|
devtools and their Query and Router panels. See package.json for supported
|
|
64
|
-
peer ranges.
|
|
25
|
+
peer ranges.
|
|
65
26
|
|
|
66
27
|
## Shared core
|
|
67
28
|
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComponentPropsWithoutRef, PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
/** Extra props (such as `data-theme`) land on `<html>` itself. */
|
|
3
|
+
type ComposeViewportProps = PropsWithChildren<ComponentPropsWithoutRef<"html">>;
|
|
4
|
+
type WindowProps = ComponentPropsWithoutRef<"body"> & {
|
|
5
|
+
/**
|
|
6
|
+
* Rendered as direct `<body>` children, after `<main>`, not inside it.
|
|
7
|
+
* `<Scripts />` (and devtools) belong here — TanStack Router's own docs
|
|
8
|
+
* say `<Scripts />` "should be placed near the end of the document
|
|
9
|
+
* body", not nested inside the app's content wrapper.
|
|
10
|
+
*/
|
|
11
|
+
after?: ReactNode;
|
|
12
|
+
};
|
|
13
|
+
export declare function ComposeViewport({ children, lang, className, ...props }: ComposeViewportProps): import("react").JSX.Element;
|
|
14
|
+
export declare namespace ComposeViewport {
|
|
15
|
+
export { Window };
|
|
16
|
+
export { Devtools };
|
|
17
|
+
}
|
|
18
|
+
declare function Window({ className, children, after, ...props }: WindowProps): import("react").JSX.Element;
|
|
19
|
+
declare function Devtools(): import("react").JSX.Element;
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type TextFieldProps } from "@passui/react/text-field";
|
|
2
|
+
import { type ComponentProps, type ReactNode } from "react";
|
|
3
|
+
export declare const PeachFieldLabels: import("react").Context<{
|
|
4
|
+
show: string;
|
|
5
|
+
hide: string;
|
|
6
|
+
} | undefined>;
|
|
7
|
+
export declare function FieldInput(props: Omit<TextFieldProps, "value" | "onChange" | "onBlur" | "name">): import("react").JSX.Element;
|
|
8
|
+
export declare function FieldCheckbox({ label }: {
|
|
9
|
+
label: string;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
export declare function FieldSwitch({ label, description, disabled, }: {
|
|
12
|
+
label: string;
|
|
13
|
+
description?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export declare function FieldTextarea({ label, icon, ...props }: ComponentProps<"textarea"> & {
|
|
17
|
+
label: string;
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
}): import("react").JSX.Element;
|
|
20
|
+
export declare function FieldOtp({ label, maxLength, onComplete, }: {
|
|
21
|
+
label: string;
|
|
22
|
+
maxLength?: number;
|
|
23
|
+
onComplete?: (value: string) => void;
|
|
24
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
type Option = {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function FieldRadioCard({ label, description, options, disabled, columns, }: {
|
|
10
|
+
label: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
options: Option[];
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
columns?: 1 | 2;
|
|
15
|
+
}): import("react").JSX.Element;
|
|
16
|
+
export declare function FieldMultiselect({ label, description, options, }: {
|
|
17
|
+
label: string;
|
|
18
|
+
description?: string;
|
|
19
|
+
options: Option[];
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fieldContext: import("react").Context<import("@tanstack/react-form").AnyFieldApi>, formContext: import("react").Context<import("@tanstack/react-form").AnyFormApi>, useFieldContext: <TData>() => import("@tanstack/react-form").FieldApi<any, string, TData, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any, any>, useFormContext: () => import("@tanstack/react-form").ReactFormExtendedApi<Record<string, never>, any, any, any, any, any, any, any, any, any, any, any>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/** A form-level error people can't miss: announced, tinted, and gently shaken in. */
|
|
3
|
+
export declare function FormAlert({ children, className }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
className?: string;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Submit } from "../../form-fields/submit";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type AvatarPickerLabels = {
|
|
2
|
+
photo: string;
|
|
3
|
+
photoDescription: string;
|
|
4
|
+
choosePhoto: string;
|
|
5
|
+
takePhoto: string;
|
|
6
|
+
capture: string;
|
|
7
|
+
monogram: string;
|
|
8
|
+
removePhoto: string;
|
|
9
|
+
cancel: string;
|
|
10
|
+
};
|
|
11
|
+
type AvatarPickerProps = {
|
|
12
|
+
open: boolean;
|
|
13
|
+
onOpenChange: (open: boolean) => void;
|
|
14
|
+
label: string;
|
|
15
|
+
image?: string;
|
|
16
|
+
clearable: boolean;
|
|
17
|
+
labels: AvatarPickerLabels;
|
|
18
|
+
onChooseFile: () => void;
|
|
19
|
+
/** A captured frame, still to be framed in Move and Scale. */
|
|
20
|
+
onCapture: (file: File) => void;
|
|
21
|
+
/** A finished image that needs no framing, like a monogram. */
|
|
22
|
+
onChoose: (file: File) => void;
|
|
23
|
+
onRemove: () => void;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The photo sheet Apple shows for a contact photo: the current photo lit by
|
|
27
|
+
* its own colors, then the ways to change it.
|
|
28
|
+
*/
|
|
29
|
+
export declare function AvatarPicker({ open, onOpenChange, label, image, clearable, labels, onChooseFile, onCapture, onChoose, onRemove, }: AvatarPickerProps): import("react").ReactPortal | null;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { AvatarPickerLabels } from "./avatar-picker";
|
|
3
|
+
export type FieldAvatarValue = File | null | false;
|
|
4
|
+
export type FieldAvatarLabels = AvatarPickerLabels & {
|
|
5
|
+
edit: string;
|
|
6
|
+
remove: string;
|
|
7
|
+
/** Shown under a picked photo until it's kept or dropped. */
|
|
8
|
+
confirmHint: string;
|
|
9
|
+
save: string;
|
|
10
|
+
};
|
|
11
|
+
type FieldAvatarProps = {
|
|
12
|
+
/** Compact identity row for account settings. */
|
|
13
|
+
compact?: boolean;
|
|
14
|
+
existingImage?: string | null;
|
|
15
|
+
label: string;
|
|
16
|
+
accept?: string;
|
|
17
|
+
/** Offer removing the image once there is one. Off by default: a
|
|
18
|
+
* personal avatar usually just gets replaced, not cleared to nothing. */
|
|
19
|
+
clearable?: boolean;
|
|
20
|
+
/** Sit the photo in a surface lit by its own colors, with this under it. */
|
|
21
|
+
caption?: ReactNode;
|
|
22
|
+
/** For a translated UI; English otherwise. */
|
|
23
|
+
labels?: Partial<FieldAvatarLabels>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A photo you click to replace: a small menu (choose, take, monogram), then
|
|
27
|
+
* the new image shows in place and Enter keeps it (Esc drops it); no cropping dialog.
|
|
28
|
+
*/
|
|
29
|
+
export declare function FieldAvatar({ compact, existingImage, label, accept, clearable, caption, labels, }: FieldAvatarProps): import("react").JSX.Element;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldCheckbox } from "../../form-fields/fields";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { FieldInput, FieldCheckbox, FieldTextarea, FieldSwitch, FieldOtp } from "../../form-fields/fields";
|
|
2
|
+
import { FieldRadioCard, FieldMultiselect } from "../../form-fields/selection";
|
|
3
|
+
import { FieldAvatar } from "./avatar";
|
|
4
|
+
export declare const fields: {
|
|
5
|
+
input: typeof FieldInput;
|
|
6
|
+
checkbox: typeof FieldCheckbox;
|
|
7
|
+
textarea: typeof FieldTextarea;
|
|
8
|
+
switch: typeof FieldSwitch;
|
|
9
|
+
radioCard: typeof FieldRadioCard;
|
|
10
|
+
multiselect: typeof FieldMultiselect;
|
|
11
|
+
avatar: typeof FieldAvatar;
|
|
12
|
+
otp: typeof FieldOtp;
|
|
13
|
+
};
|
|
14
|
+
export * from "./input";
|
|
15
|
+
export * from "./checkbox";
|
|
16
|
+
export * from "./textarea";
|
|
17
|
+
export * from "./switch";
|
|
18
|
+
export * from "./radio-card";
|
|
19
|
+
export * from "./multiselect";
|
|
20
|
+
export * from "./avatar";
|
|
21
|
+
export * from "./otp";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldInput } from "../../form-fields/fields";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldMultiselect } from "../../form-fields/selection";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldOtp } from "../../form-fields/fields";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldRadioCard } from "../../form-fields/selection";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldSwitch } from "../../form-fields/fields";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { FieldTextarea } from "../../form-fields/fields";
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useSelector, useStore } from "@tanstack/react-form";
|
|
2
|
+
import { Submit } from "./elements/submit";
|
|
3
|
+
export declare const useAppForm: <TFormData, TOnMount extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TSubmitMeta>(props: import("@tanstack/react-form").FormOptions<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta>) => import("@tanstack/react-form").AppFieldExtendedReactFormApi<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
4
|
+
readonly input: typeof import(".").FieldInput;
|
|
5
|
+
readonly checkbox: typeof import(".").FieldCheckbox;
|
|
6
|
+
readonly textarea: typeof import(".").FieldTextarea;
|
|
7
|
+
readonly switch: typeof import(".").FieldSwitch;
|
|
8
|
+
readonly radioCard: typeof import(".").FieldRadioCard;
|
|
9
|
+
readonly multiselect: typeof import(".").FieldMultiselect;
|
|
10
|
+
readonly avatar: typeof import(".").FieldAvatar;
|
|
11
|
+
readonly otp: typeof import(".").FieldOtp;
|
|
12
|
+
}, {
|
|
13
|
+
readonly submit: typeof Submit;
|
|
14
|
+
}>, withForm: <TFormData, TOnMount extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnChange extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnChangeAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnBlur extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnBlurAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnSubmit extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnSubmitAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnDynamic extends undefined | import("@tanstack/react-form").FormValidateOrFn<TFormData>, TOnDynamicAsync extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TOnServer extends undefined | import("@tanstack/react-form").FormAsyncValidateOrFn<TFormData>, TSubmitMeta, TRenderProps extends object = {}>({ render, props, }: import("@tanstack/react-form").WithFormProps<TFormData, TOnMount, TOnChange, TOnChangeAsync, TOnBlur, TOnBlurAsync, TOnSubmit, TOnSubmitAsync, TOnDynamic, TOnDynamicAsync, TOnServer, TSubmitMeta, {
|
|
15
|
+
readonly input: typeof import(".").FieldInput;
|
|
16
|
+
readonly checkbox: typeof import(".").FieldCheckbox;
|
|
17
|
+
readonly textarea: typeof import(".").FieldTextarea;
|
|
18
|
+
readonly switch: typeof import(".").FieldSwitch;
|
|
19
|
+
readonly radioCard: typeof import(".").FieldRadioCard;
|
|
20
|
+
readonly multiselect: typeof import(".").FieldMultiselect;
|
|
21
|
+
readonly avatar: typeof import(".").FieldAvatar;
|
|
22
|
+
readonly otp: typeof import(".").FieldOtp;
|
|
23
|
+
}, {
|
|
24
|
+
readonly submit: typeof Submit;
|
|
25
|
+
}, TRenderProps>) => import("react").FunctionComponent<import("react").PropsWithChildren<NoInfer<[unknown] extends [TRenderProps] ? any : TRenderProps> & {
|
|
26
|
+
form: import("@tanstack/react-form").AppFieldExtendedReactFormApi<[unknown] extends [TFormData] ? any : TFormData, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnMount] ? [TOnMount] extends [TOnMount & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnMount : TOnMount, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChange] ? [TOnChange] extends [TOnChange & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChange : TOnChange, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnChangeAsync] ? [TOnChangeAsync] extends [TOnChangeAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnChangeAsync : TOnChangeAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlur] ? [TOnBlur] extends [TOnBlur & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlur : TOnBlur, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnBlurAsync] ? [TOnBlurAsync] extends [TOnBlurAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnBlurAsync : TOnBlurAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmit] ? [TOnSubmit] extends [TOnSubmit & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmit : TOnSubmit, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnSubmitAsync] ? [TOnSubmitAsync] extends [TOnSubmitAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnSubmitAsync : TOnSubmitAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamic] ? [TOnDynamic] extends [TOnDynamic & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamic : TOnDynamic, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnDynamicAsync] ? [TOnDynamicAsync] extends [TOnDynamicAsync & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnDynamicAsync : TOnDynamicAsync, [import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined] extends [TOnServer] ? [TOnServer] extends [TOnServer & (import("@tanstack/react-form").FormValidateOrFn<TFormData> | undefined)] ? any : TOnServer : TOnServer, [unknown] extends [TSubmitMeta] ? any : TSubmitMeta, {
|
|
27
|
+
readonly input: typeof import(".").FieldInput;
|
|
28
|
+
readonly checkbox: typeof import(".").FieldCheckbox;
|
|
29
|
+
readonly textarea: typeof import(".").FieldTextarea;
|
|
30
|
+
readonly switch: typeof import(".").FieldSwitch;
|
|
31
|
+
readonly radioCard: typeof import(".").FieldRadioCard;
|
|
32
|
+
readonly multiselect: typeof import(".").FieldMultiselect;
|
|
33
|
+
readonly avatar: typeof import(".").FieldAvatar;
|
|
34
|
+
readonly otp: typeof import(".").FieldOtp;
|
|
35
|
+
}, {
|
|
36
|
+
readonly submit: typeof Submit;
|
|
37
|
+
}>;
|
|
38
|
+
}>>;
|
|
39
|
+
export { useSelector, useStore };
|
|
40
|
+
export * from "./fields/index";
|
|
41
|
+
export { FormAlert } from "./elements/form-alert";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./use-app-mutation";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { QueryKey, UseMutationOptions } from "@tanstack/react-query";
|
|
2
|
+
type OptimisticUpdate<TOptimisticData, TVariables> = {
|
|
3
|
+
queryKey: QueryKey;
|
|
4
|
+
/** Applied to the cache immediately, before the mutation resolves. Rolled back if it errors. */
|
|
5
|
+
updater: (old: TOptimisticData | undefined, variables: TVariables) => TOptimisticData;
|
|
6
|
+
};
|
|
7
|
+
type MutationContext<TOptimisticData> = {
|
|
8
|
+
previous: TOptimisticData | undefined;
|
|
9
|
+
next: TOptimisticData;
|
|
10
|
+
} | undefined;
|
|
11
|
+
export { shouldRestoreOptimisticSnapshot, restoreOptimisticSnapshot } from "../shared/optimistic";
|
|
12
|
+
type AppMutationOptions<TData, TVariables, TOptimisticData> = Omit<UseMutationOptions<TData, Error, TVariables, MutationContext<TOptimisticData>>, "onSuccess" | "onError" | "onMutate" | "onSettled"> & {
|
|
13
|
+
/** Query keys to invalidate once the mutation settles, win or lose. */
|
|
14
|
+
invalidates?: QueryKey[];
|
|
15
|
+
optimisticUpdate?: OptimisticUpdate<TOptimisticData, TVariables>;
|
|
16
|
+
successMessage?: string | ((data: TData, variables: TVariables) => string);
|
|
17
|
+
successDescription?: string | ((data: TData, variables: TVariables) => string | undefined);
|
|
18
|
+
errorMessage?: string;
|
|
19
|
+
onSuccess?: (data: TData, variables: TVariables) => void;
|
|
20
|
+
onError?: (error: Error, variables: TVariables) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare function useAppMutation<TData, TVariables = void, TOptimisticData = unknown>({ invalidates, optimisticUpdate, successMessage, successDescription, errorMessage, onSuccess, onError, ...options }: AppMutationOptions<TData, TVariables, TOptimisticData>): import("@tanstack/react-query").UseMutationResult<TData, Error, TVariables, MutationContext<TOptimisticData>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type DefaultLoaderProps = {
|
|
2
|
+
/** Translated loading status for assistive technology; never displayed visually. */
|
|
3
|
+
label?: string;
|
|
4
|
+
className?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function DefaultLoader({ label, className }?: DefaultLoaderProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type IconButtonSize } from "@passui/react/icon-button";
|
|
2
|
+
import type { LinkProps } from "@tanstack/react-router";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
type SettingListProps = {
|
|
5
|
+
id?: string;
|
|
6
|
+
/** h3 when the list sits inside an Area that already has the h2. */
|
|
7
|
+
as?: "h2" | "h3";
|
|
8
|
+
/** A Glyph beside the heading; rows themselves stay plain. */
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
/** Right of the heading: an Add button, or a Coming soon badge. */
|
|
13
|
+
action?: ReactNode;
|
|
14
|
+
/** "tile": the rounded, lifted card of the account app's overview. */
|
|
15
|
+
variant?: "inset" | "tile";
|
|
16
|
+
children: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
};
|
|
19
|
+
type RowProps = {
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
title: ReactNode;
|
|
22
|
+
description?: ReactNode;
|
|
23
|
+
/** The current value, muted on the right, like "On" or an email. */
|
|
24
|
+
value?: ReactNode;
|
|
25
|
+
trailing?: ReactNode;
|
|
26
|
+
to?: LinkProps["to"];
|
|
27
|
+
params?: LinkProps["params"];
|
|
28
|
+
hash?: string;
|
|
29
|
+
onClick?: () => void;
|
|
30
|
+
/** Show the chevron without a destination, for a preview row. */
|
|
31
|
+
chevron?: boolean;
|
|
32
|
+
tone?: "default" | "destructive";
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* A titled group of settings in one inset card, hairlines between rows
|
|
36
|
+
* (even rows wrapped in a Preview), a soft highlight under the one you point at.
|
|
37
|
+
*/
|
|
38
|
+
export declare function SettingList({ id, as: Heading, icon, title, description, action, variant, children, className, }: SettingListProps): import("react").JSX.Element;
|
|
39
|
+
export declare namespace SettingList {
|
|
40
|
+
export { Row };
|
|
41
|
+
export { Copy };
|
|
42
|
+
}
|
|
43
|
+
declare function Row({ icon, title, description, value, trailing, to, params, hash, onClick, chevron, tone, }: RowProps): import("react").JSX.Element;
|
|
44
|
+
/** A row's trailing copy button; shows a tick for a moment after copying. */
|
|
45
|
+
declare function Copy({ value, label, size, }: {
|
|
46
|
+
value: string;
|
|
47
|
+
label?: string;
|
|
48
|
+
/** Quiet and row-sized by default; any of Passui's icon sizes. */
|
|
49
|
+
size?: IconButtonSize;
|
|
50
|
+
}): import("react").JSX.Element;
|
|
51
|
+
export {};
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
import type { QueryClient, QueryKey } from "@tanstack/react-query";
|
|
1
2
|
/** Restore only the snapshot this mutation wrote, preserving newer concurrent writes. */
|
|
2
3
|
export declare function shouldRestoreOptimisticSnapshot<T>(current: T | undefined, expected: T): boolean;
|
|
4
|
+
/** Remove a new optimistic cache entry when no cache value existed before the mutation. */
|
|
5
|
+
export declare function restoreOptimisticSnapshot<T>(client: Pick<QueryClient, "getQueryData" | "setQueryData" | "removeQueries">, queryKey: QueryKey, previous: T | undefined, expected: T): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function isArrayValuedColumn<TData>(data: TData[], colId: string): boolean;
|
|
2
|
+
export declare function getColumnLabel(column: {
|
|
3
|
+
columnDef: {
|
|
4
|
+
header?: unknown;
|
|
5
|
+
};
|
|
6
|
+
id: string;
|
|
7
|
+
}): string;
|
|
8
|
+
export declare function columnIdOf(column: {
|
|
9
|
+
id?: string;
|
|
10
|
+
accessorKey?: unknown;
|
|
11
|
+
}): string | undefined;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
import type { RowData } from "@tanstack/solid-table";
|
|
1
|
+
import type { RowData } from "@tanstack/react-table";
|
|
3
2
|
import type { DataTableColumnDef } from "./data-table";
|
|
4
3
|
export declare function selectColumn<TData extends RowData>(): DataTableColumnDef<TData>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { ColumnDef, ColumnVisibilityState, RowData } from "@tanstack/react-table";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
export declare const baseTableFeatures: {
|
|
4
|
+
globalFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
5
|
+
columnFilteringFeature: import("@tanstack/react-table").TableFeature;
|
|
6
|
+
rowSortingFeature: import("@tanstack/react-table").TableFeature;
|
|
7
|
+
rowPaginationFeature: import("@tanstack/react-table").TableFeature;
|
|
8
|
+
columnVisibilityFeature: import("@tanstack/react-table").TableFeature;
|
|
9
|
+
rowSelectionFeature: import("@tanstack/react-table").TableFeature;
|
|
10
|
+
filteredRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
11
|
+
sortedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
12
|
+
paginatedRowModel: (table: import("@tanstack/react-table").Table<any, any>) => () => import("@tanstack/react-table").RowModel<any, any>;
|
|
13
|
+
filterFns: {
|
|
14
|
+
includesString: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
15
|
+
inNumberRange: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
16
|
+
equals: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
17
|
+
arrIncludes: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
18
|
+
arrIncludesSome: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
19
|
+
inDateRange: import("@tanstack/react-table").CreatedFilterFn<any, any>;
|
|
20
|
+
};
|
|
21
|
+
sortFns: {
|
|
22
|
+
text: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
23
|
+
alphanumeric: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
24
|
+
datetime: import("@tanstack/react-table").CreatedSortFn<any, any>;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type DataTableFeatures = typeof baseTableFeatures;
|
|
28
|
+
/**
|
|
29
|
+
* `filterVariant: 'date'` is the one thing a caller has to opt into
|
|
30
|
+
* explicitly (`updatedAt`/`createdAt`, or a custom `type: 'date'` column):
|
|
31
|
+
* unlike an array-valued column (detected automatically below, from the
|
|
32
|
+
* actual data), a date is just a string or number at runtime, nothing to
|
|
33
|
+
* sniff it from safely.
|
|
34
|
+
*/
|
|
35
|
+
export type DataTableColumnMeta = {
|
|
36
|
+
filterVariant?: "date";
|
|
37
|
+
};
|
|
38
|
+
export type DataTableColumnDef<TData extends RowData, TValue = unknown> = ColumnDef<DataTableFeatures, TData, TValue> & {
|
|
39
|
+
meta?: DataTableColumnMeta;
|
|
40
|
+
};
|
|
41
|
+
type DataTableProps<TData extends RowData> = {
|
|
42
|
+
data: TData[];
|
|
43
|
+
columns: DataTableColumnDef<TData, any>[];
|
|
44
|
+
/**
|
|
45
|
+
* A stable id per row, used as the React key and by react-table's row
|
|
46
|
+
* model. Without this, react-table falls back to the row's array index,
|
|
47
|
+
* so deleting a row shifts every id below it onto a different row's
|
|
48
|
+
* data, reusing DOM nodes (and any open dropdown/overlay state) across
|
|
49
|
+
* what are now different rows. Required, not defaulted, so this can't
|
|
50
|
+
* silently regress.
|
|
51
|
+
*/
|
|
52
|
+
getRowId: (row: TData) => string;
|
|
53
|
+
"aria-label": string;
|
|
54
|
+
emptyMessage?: ReactNode;
|
|
55
|
+
searchPlaceholder?: string;
|
|
56
|
+
bulkActions?: (selectedRows: TData[], clearSelection: () => void) => ReactNode;
|
|
57
|
+
/** Set false to render just the table. Default true. */
|
|
58
|
+
pagination?: boolean;
|
|
59
|
+
pageSizeOptions?: number[];
|
|
60
|
+
onSelectedRowsChange?: (rows: TData[]) => void;
|
|
61
|
+
/** Opens a row, e.g. its detail drawer. Ignored while rows are selectable. */
|
|
62
|
+
onRowClick?: (row: TData) => void;
|
|
63
|
+
/** A summary row rendered inside the table's own <tfoot>, below the data rows — e.g. a totals line. Gets the visible column count for its colSpan. */
|
|
64
|
+
footer?: (columnCount: number) => ReactNode;
|
|
65
|
+
/** True while a background refetch is in flight (e.g. after a mutation invalidates the query). Dims the existing rows and shows a small spinner rather than rendering nothing, since `data` still holds the last good result. */
|
|
66
|
+
isLoading?: boolean;
|
|
67
|
+
/** Columns hidden until someone turns them on from the Columns menu, keyed by column id. */
|
|
68
|
+
initialColumnVisibility?: ColumnVisibilityState;
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* Self-contained table: pass `data` + `columns`, get sorting, pagination,
|
|
72
|
+
* search, column visibility, per-column filters, and row selection for
|
|
73
|
+
* free. There's no `useTable` state to wire up on the caller's side.
|
|
74
|
+
*/
|
|
75
|
+
export declare function DataTable<TData extends RowData>({ data, columns, getRowId, emptyMessage, searchPlaceholder, bulkActions, pagination, pageSizeOptions, onSelectedRowsChange, onRowClick, footer, isLoading, initialColumnVisibility, "aria-label": ariaLabel, }: DataTableProps<TData>): import("react").JSX.Element;
|
|
76
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Column, RowData } from "@tanstack/react-table";
|
|
2
|
+
import type { DataTableFeatures } from "./data-table";
|
|
3
|
+
export declare function FilterRow<TData extends RowData>({ column, data, skip, isArrayColumn, isDateColumn, }: {
|
|
4
|
+
column: Column<DataTableFeatures, TData, unknown>;
|
|
5
|
+
data: TData[];
|
|
6
|
+
skip: string[];
|
|
7
|
+
isArrayColumn: boolean;
|
|
8
|
+
isDateColumn: boolean;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ReactTable, RowData } from "@tanstack/react-table";
|
|
2
|
+
import type { DataTableFeatures } from "./data-table";
|
|
3
|
+
type DataTablePaginationProps<TData extends RowData> = {
|
|
4
|
+
table: ReactTable<DataTableFeatures, TData>;
|
|
5
|
+
pageSizeOptions?: number[];
|
|
6
|
+
};
|
|
7
|
+
export declare function DataTablePagination<TData extends RowData>({ table, pageSizeOptions, }: DataTablePaginationProps<TData>): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { isArrayValuedColumn, getColumnLabel, columnIdOf, } from "../shared/table";
|