@timeax/form-palette 0.1.3 → 0.1.5
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 +2280 -0
- package/dist/{core-BD0ObjuE.d.mts → core-EVtvQ-ma.d.mts} +31 -4
- package/dist/{core-q_p0E4W9.d.ts → core-ZuVzbe2m.d.ts} +31 -4
- package/dist/extra.d.mts +134 -163
- package/dist/extra.d.ts +134 -163
- package/dist/extra.js +2785 -2920
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +2704 -2837
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1769 -2012
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1693 -1936
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -2
- package/Readme.md +0 -1380
|
@@ -2226,6 +2226,12 @@ declare function Badge({ className, variant, asChild, ...props }: React.Componen
|
|
|
2226
2226
|
}): react_jsx_runtime.JSX.Element;
|
|
2227
2227
|
|
|
2228
2228
|
type FileSourceKind = "native" | "path" | "url" | "custom";
|
|
2229
|
+
/**
|
|
2230
|
+
* ✅ What the form receives on submit:
|
|
2231
|
+
* - native picker -> File
|
|
2232
|
+
* - custom pickers -> string (url/path)
|
|
2233
|
+
*/
|
|
2234
|
+
type FileValue = File | string;
|
|
2229
2235
|
interface FileItem {
|
|
2230
2236
|
id: string;
|
|
2231
2237
|
kind: FileSourceKind;
|
|
@@ -2259,8 +2265,7 @@ type CustomFileLoader = (ctx: {
|
|
|
2259
2265
|
allowedTypes?: string[];
|
|
2260
2266
|
}) => Promise<CustomFileLoaderResult> | CustomFileLoaderResult;
|
|
2261
2267
|
type BadgeVariant = React.ComponentProps<typeof Badge>["variant"];
|
|
2262
|
-
type
|
|
2263
|
-
multiple?: boolean;
|
|
2268
|
+
type FileVariantExtras = {
|
|
2264
2269
|
accept?: string | string[];
|
|
2265
2270
|
maxFiles?: number;
|
|
2266
2271
|
maxTotalSize?: number;
|
|
@@ -2269,6 +2274,10 @@ type FileVariantBaseProps = Pick<VariantBaseProps<FileItem[]>, "value" | "onValu
|
|
|
2269
2274
|
dropTitle?: React.ReactNode;
|
|
2270
2275
|
dropDescription?: React.ReactNode;
|
|
2271
2276
|
custom?: boolean;
|
|
2277
|
+
/**
|
|
2278
|
+
* Kept for compatibility; we now always submit File|string.
|
|
2279
|
+
* (Raw FileItem[] is available in ChangeDetail.meta.items)
|
|
2280
|
+
*/
|
|
2272
2281
|
asRaw?: boolean;
|
|
2273
2282
|
renderDropArea?: (ctx: {
|
|
2274
2283
|
openPicker: () => void;
|
|
@@ -2295,6 +2304,20 @@ type FileVariantBaseProps = Pick<VariantBaseProps<FileItem[]>, "value" | "onValu
|
|
|
2295
2304
|
listClassName?: string;
|
|
2296
2305
|
triggerClassName?: string;
|
|
2297
2306
|
};
|
|
2307
|
+
type FileSingleValueProps = Omit<VariantBaseProps<FileValue | null>, "value"> & {
|
|
2308
|
+
multiple?: false;
|
|
2309
|
+
/**
|
|
2310
|
+
* Accepts File | string | FileLike-object (url/path/file/name/etc)
|
|
2311
|
+
*/
|
|
2312
|
+
value?: FileLike | null;
|
|
2313
|
+
};
|
|
2314
|
+
type FileMultiValueProps = Omit<VariantBaseProps<FileValue[]>, "value"> & {
|
|
2315
|
+
multiple: true;
|
|
2316
|
+
/**
|
|
2317
|
+
* Accepts (File | string | FileLike-object)[]
|
|
2318
|
+
*/
|
|
2319
|
+
value?: FileLike[] | null;
|
|
2320
|
+
};
|
|
2298
2321
|
type FileDefaultModeProps = {
|
|
2299
2322
|
mode?: "default";
|
|
2300
2323
|
leadingIcons?: React.ReactNode[];
|
|
@@ -2341,7 +2364,7 @@ type FileButtonModeProps = {
|
|
|
2341
2364
|
joinControls?: never;
|
|
2342
2365
|
extendBoxToControls?: never;
|
|
2343
2366
|
};
|
|
2344
|
-
type ShadcnFileVariantProps =
|
|
2367
|
+
type ShadcnFileVariantProps = FileVariantExtras & (FileSingleValueProps | FileMultiValueProps) & (FileDefaultModeProps | FileButtonModeProps);
|
|
2345
2368
|
|
|
2346
2369
|
type SelectPrimitive = string | number;
|
|
2347
2370
|
type SelectOption = SelectPrimitive | {
|
|
@@ -3059,6 +3082,7 @@ type ListerPermissionCtx = {
|
|
|
3059
3082
|
endpoint?: string;
|
|
3060
3083
|
filters?: any;
|
|
3061
3084
|
sessionId?: ListerSessionId;
|
|
3085
|
+
ownerKey?: string;
|
|
3062
3086
|
};
|
|
3063
3087
|
interface ListerProviderHost {
|
|
3064
3088
|
/** Host decides permission logic. Mandatory permissions end with '!' */
|
|
@@ -3142,6 +3166,7 @@ type ListerSearchSpec<TColumn extends string = string> = {
|
|
|
3142
3166
|
type ListerDefinition<TRaw, TValue extends ListerId, TFilters = unknown, TMeta = unknown, TCtx = any, TSearchColumn extends string = string> = {
|
|
3143
3167
|
/** optional stable id used by presets */
|
|
3144
3168
|
id?: string;
|
|
3169
|
+
title?: string;
|
|
3145
3170
|
source: ListerSource<TFilters>;
|
|
3146
3171
|
/** If missing: default extraction uses body.data (runtime). Must produce an array. */
|
|
3147
3172
|
selector?: Selector<TRaw>;
|
|
@@ -3326,6 +3351,7 @@ type ListerOpenOptions<TRaw, TValue extends ListerId, TFilters, TMeta, TMode ext
|
|
|
3326
3351
|
}) => any;
|
|
3327
3352
|
/** Live change hook (sync + veto) */
|
|
3328
3353
|
onChange?: (value: ListerValueForMode<TValue, TMode>, details: ListerDetails<TRaw, TValue, TMeta, TMode>, e: ListerChangeEvent) => void;
|
|
3354
|
+
ownerKey?: string;
|
|
3329
3355
|
};
|
|
3330
3356
|
type ListerOpenResult<TRaw, TValue extends ListerId, TMeta, TMode extends ListerMode> = {
|
|
3331
3357
|
reason: ListerOpenReason;
|
|
@@ -3418,6 +3444,7 @@ type ListerRuntimeState<TRaw, TValue extends ListerId, TFilters, TMeta, TMode ex
|
|
|
3418
3444
|
searchSpec?: ListerSearchSpec<string>;
|
|
3419
3445
|
/** Persisted user selection (subject/all/only) */
|
|
3420
3446
|
searchTarget?: ListerSearchTarget;
|
|
3447
|
+
ownerKey?: string;
|
|
3421
3448
|
};
|
|
3422
3449
|
type ListerStoreState = {
|
|
3423
3450
|
/** rendering order (last = topmost) */
|
|
@@ -4353,4 +4380,4 @@ interface CoreContext<V extends Dict> {
|
|
|
4353
4380
|
isDirty(): boolean;
|
|
4354
4381
|
}
|
|
4355
4382
|
|
|
4356
|
-
export { type
|
|
4383
|
+
export { type ListerSessionId as $, type LayoutResolveContext as A, type BaseProps as B, type CoreProps as C, type Dict as D, type ErrorTextPlacement as E, type Field as F, type LayoutResolver as G, type HelpTextPlacement as H, InputNumber as I, type VariantEntry as J, type Variants as K, type LabelPlacement as L, type VariantValidateFn as M, type VariantLayoutDefaults as N, type VariantModuleFor as O, type PhoneCountry as P, type ListerSearchPayload as Q, type RelativeRootsMap as R, type SublabelPlacement as S, Textarea as T, type ListerId as U, type VariantKey as V, type ListerDefinition as W, type ListerOption as X, type PresetMap as Y, type ListerApi as Z, type ListerStoreState as _, type CoreContext as a, type ListerSearchTarget as a0, type ListerSearchMode as a1, type ListerFilterCtx as a2, type ListerDetails as a3, type ListerProviderHost as a4, type ListerRuntimeState as a5, type ShadcnJsonEditorProps as a6, type JsonEditorIndexHandle as a7, type ListerMode as a8, type ListerOpenReason as a9, type PresetValue as aA, type PresetFilters as aB, type PresetMeta as aC, type ListerSessionState as aD, type Selector as aa, type Resolver as ab, type OpenAnchor as ac, type ListerChangeEvent as ad, type ListerLogLevel as ae, type ListerLogCode as af, type ListerLogEntry as ag, type ListerPermissionCtx as ah, type ListerMapping as ai, type ListerSource as aj, type ListerSearchSpec as ak, type ListerFilterApplyMode as al, type ListerFilterApply as am, type ListerFilterBindKey as an, type ListerFilterInput as ao, type ListerFilterGroupOption as ap, type ListerFilterValueOption as aq, type ListerFilterInputOption as ar, type ListerFilterOption as as, type ListerFilterSpec as at, type ListerValueForMode as au, type ListerRawForMode as av, type ListerOptionsForMode as aw, type ListerOpenOptions as ax, type ListerOpenResult as ay, type PresetRaw as az, type DescriptionPlacement as b, type SlotPlacement as c, type FieldSize as d, type FieldDensity as e, type ValidateResult as f, type ChangeDetail as g, type VariantValueFor as h, type VariantPropsFor as i, type VariantModule as j, type PasswordDefinitionMap as k, type CustomFileLoader as l, type FileItem as m, type InferFromSchema as n, type SubmitEvent as o, type FormProps as p, type ValuesResult as q, type InputStore as r, type ButtonRef as s, type FieldSlots as t, type FieldRoots as u, type FieldSlotId as v, type FieldRootId as w, type FieldOrdering as x, type FieldLayoutConfig as y, type EffectiveFieldLayout as z };
|
|
@@ -2226,6 +2226,12 @@ declare function Badge({ className, variant, asChild, ...props }: React.Componen
|
|
|
2226
2226
|
}): react_jsx_runtime.JSX.Element;
|
|
2227
2227
|
|
|
2228
2228
|
type FileSourceKind = "native" | "path" | "url" | "custom";
|
|
2229
|
+
/**
|
|
2230
|
+
* ✅ What the form receives on submit:
|
|
2231
|
+
* - native picker -> File
|
|
2232
|
+
* - custom pickers -> string (url/path)
|
|
2233
|
+
*/
|
|
2234
|
+
type FileValue = File | string;
|
|
2229
2235
|
interface FileItem {
|
|
2230
2236
|
id: string;
|
|
2231
2237
|
kind: FileSourceKind;
|
|
@@ -2259,8 +2265,7 @@ type CustomFileLoader = (ctx: {
|
|
|
2259
2265
|
allowedTypes?: string[];
|
|
2260
2266
|
}) => Promise<CustomFileLoaderResult> | CustomFileLoaderResult;
|
|
2261
2267
|
type BadgeVariant = React.ComponentProps<typeof Badge>["variant"];
|
|
2262
|
-
type
|
|
2263
|
-
multiple?: boolean;
|
|
2268
|
+
type FileVariantExtras = {
|
|
2264
2269
|
accept?: string | string[];
|
|
2265
2270
|
maxFiles?: number;
|
|
2266
2271
|
maxTotalSize?: number;
|
|
@@ -2269,6 +2274,10 @@ type FileVariantBaseProps = Pick<VariantBaseProps<FileItem[]>, "value" | "onValu
|
|
|
2269
2274
|
dropTitle?: React.ReactNode;
|
|
2270
2275
|
dropDescription?: React.ReactNode;
|
|
2271
2276
|
custom?: boolean;
|
|
2277
|
+
/**
|
|
2278
|
+
* Kept for compatibility; we now always submit File|string.
|
|
2279
|
+
* (Raw FileItem[] is available in ChangeDetail.meta.items)
|
|
2280
|
+
*/
|
|
2272
2281
|
asRaw?: boolean;
|
|
2273
2282
|
renderDropArea?: (ctx: {
|
|
2274
2283
|
openPicker: () => void;
|
|
@@ -2295,6 +2304,20 @@ type FileVariantBaseProps = Pick<VariantBaseProps<FileItem[]>, "value" | "onValu
|
|
|
2295
2304
|
listClassName?: string;
|
|
2296
2305
|
triggerClassName?: string;
|
|
2297
2306
|
};
|
|
2307
|
+
type FileSingleValueProps = Omit<VariantBaseProps<FileValue | null>, "value"> & {
|
|
2308
|
+
multiple?: false;
|
|
2309
|
+
/**
|
|
2310
|
+
* Accepts File | string | FileLike-object (url/path/file/name/etc)
|
|
2311
|
+
*/
|
|
2312
|
+
value?: FileLike | null;
|
|
2313
|
+
};
|
|
2314
|
+
type FileMultiValueProps = Omit<VariantBaseProps<FileValue[]>, "value"> & {
|
|
2315
|
+
multiple: true;
|
|
2316
|
+
/**
|
|
2317
|
+
* Accepts (File | string | FileLike-object)[]
|
|
2318
|
+
*/
|
|
2319
|
+
value?: FileLike[] | null;
|
|
2320
|
+
};
|
|
2298
2321
|
type FileDefaultModeProps = {
|
|
2299
2322
|
mode?: "default";
|
|
2300
2323
|
leadingIcons?: React.ReactNode[];
|
|
@@ -2341,7 +2364,7 @@ type FileButtonModeProps = {
|
|
|
2341
2364
|
joinControls?: never;
|
|
2342
2365
|
extendBoxToControls?: never;
|
|
2343
2366
|
};
|
|
2344
|
-
type ShadcnFileVariantProps =
|
|
2367
|
+
type ShadcnFileVariantProps = FileVariantExtras & (FileSingleValueProps | FileMultiValueProps) & (FileDefaultModeProps | FileButtonModeProps);
|
|
2345
2368
|
|
|
2346
2369
|
type SelectPrimitive = string | number;
|
|
2347
2370
|
type SelectOption = SelectPrimitive | {
|
|
@@ -3059,6 +3082,7 @@ type ListerPermissionCtx = {
|
|
|
3059
3082
|
endpoint?: string;
|
|
3060
3083
|
filters?: any;
|
|
3061
3084
|
sessionId?: ListerSessionId;
|
|
3085
|
+
ownerKey?: string;
|
|
3062
3086
|
};
|
|
3063
3087
|
interface ListerProviderHost {
|
|
3064
3088
|
/** Host decides permission logic. Mandatory permissions end with '!' */
|
|
@@ -3142,6 +3166,7 @@ type ListerSearchSpec<TColumn extends string = string> = {
|
|
|
3142
3166
|
type ListerDefinition<TRaw, TValue extends ListerId, TFilters = unknown, TMeta = unknown, TCtx = any, TSearchColumn extends string = string> = {
|
|
3143
3167
|
/** optional stable id used by presets */
|
|
3144
3168
|
id?: string;
|
|
3169
|
+
title?: string;
|
|
3145
3170
|
source: ListerSource<TFilters>;
|
|
3146
3171
|
/** If missing: default extraction uses body.data (runtime). Must produce an array. */
|
|
3147
3172
|
selector?: Selector<TRaw>;
|
|
@@ -3326,6 +3351,7 @@ type ListerOpenOptions<TRaw, TValue extends ListerId, TFilters, TMeta, TMode ext
|
|
|
3326
3351
|
}) => any;
|
|
3327
3352
|
/** Live change hook (sync + veto) */
|
|
3328
3353
|
onChange?: (value: ListerValueForMode<TValue, TMode>, details: ListerDetails<TRaw, TValue, TMeta, TMode>, e: ListerChangeEvent) => void;
|
|
3354
|
+
ownerKey?: string;
|
|
3329
3355
|
};
|
|
3330
3356
|
type ListerOpenResult<TRaw, TValue extends ListerId, TMeta, TMode extends ListerMode> = {
|
|
3331
3357
|
reason: ListerOpenReason;
|
|
@@ -3418,6 +3444,7 @@ type ListerRuntimeState<TRaw, TValue extends ListerId, TFilters, TMeta, TMode ex
|
|
|
3418
3444
|
searchSpec?: ListerSearchSpec<string>;
|
|
3419
3445
|
/** Persisted user selection (subject/all/only) */
|
|
3420
3446
|
searchTarget?: ListerSearchTarget;
|
|
3447
|
+
ownerKey?: string;
|
|
3421
3448
|
};
|
|
3422
3449
|
type ListerStoreState = {
|
|
3423
3450
|
/** rendering order (last = topmost) */
|
|
@@ -4353,4 +4380,4 @@ interface CoreContext<V extends Dict> {
|
|
|
4353
4380
|
isDirty(): boolean;
|
|
4354
4381
|
}
|
|
4355
4382
|
|
|
4356
|
-
export { type
|
|
4383
|
+
export { type ListerSessionId as $, type LayoutResolveContext as A, type BaseProps as B, type CoreProps as C, type Dict as D, type ErrorTextPlacement as E, type Field as F, type LayoutResolver as G, type HelpTextPlacement as H, InputNumber as I, type VariantEntry as J, type Variants as K, type LabelPlacement as L, type VariantValidateFn as M, type VariantLayoutDefaults as N, type VariantModuleFor as O, type PhoneCountry as P, type ListerSearchPayload as Q, type RelativeRootsMap as R, type SublabelPlacement as S, Textarea as T, type ListerId as U, type VariantKey as V, type ListerDefinition as W, type ListerOption as X, type PresetMap as Y, type ListerApi as Z, type ListerStoreState as _, type CoreContext as a, type ListerSearchTarget as a0, type ListerSearchMode as a1, type ListerFilterCtx as a2, type ListerDetails as a3, type ListerProviderHost as a4, type ListerRuntimeState as a5, type ShadcnJsonEditorProps as a6, type JsonEditorIndexHandle as a7, type ListerMode as a8, type ListerOpenReason as a9, type PresetValue as aA, type PresetFilters as aB, type PresetMeta as aC, type ListerSessionState as aD, type Selector as aa, type Resolver as ab, type OpenAnchor as ac, type ListerChangeEvent as ad, type ListerLogLevel as ae, type ListerLogCode as af, type ListerLogEntry as ag, type ListerPermissionCtx as ah, type ListerMapping as ai, type ListerSource as aj, type ListerSearchSpec as ak, type ListerFilterApplyMode as al, type ListerFilterApply as am, type ListerFilterBindKey as an, type ListerFilterInput as ao, type ListerFilterGroupOption as ap, type ListerFilterValueOption as aq, type ListerFilterInputOption as ar, type ListerFilterOption as as, type ListerFilterSpec as at, type ListerValueForMode as au, type ListerRawForMode as av, type ListerOptionsForMode as aw, type ListerOpenOptions as ax, type ListerOpenResult as ay, type PresetRaw as az, type DescriptionPlacement as b, type SlotPlacement as c, type FieldSize as d, type FieldDensity as e, type ValidateResult as f, type ChangeDetail as g, type VariantValueFor as h, type VariantPropsFor as i, type VariantModule as j, type PasswordDefinitionMap as k, type CustomFileLoader as l, type FileItem as m, type InferFromSchema as n, type SubmitEvent as o, type FormProps as p, type ValuesResult as q, type InputStore as r, type ButtonRef as s, type FieldSlots as t, type FieldRoots as u, type FieldSlotId as v, type FieldRootId as w, type FieldOrdering as x, type FieldLayoutConfig as y, type EffectiveFieldLayout as z };
|
package/dist/extra.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import { Q as
|
|
4
|
-
export {
|
|
3
|
+
import { Q as ListerSearchPayload, U as ListerId, W as ListerDefinition, X as ListerOption, Y as PresetMap, Z as ListerApi, _ as ListerStoreState, $ as ListerSessionId, a0 as ListerSearchTarget, a1 as ListerSearchMode, a2 as ListerFilterCtx, a3 as ListerDetails, a4 as ListerProviderHost, a5 as ListerRuntimeState, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-EVtvQ-ma.mjs';
|
|
4
|
+
export { ad as ListerChangeEvent, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterOption, at as ListerFilterSpec, aq as ListerFilterValueOption, af as ListerLogCode, ag as ListerLogEntry, ae as ListerLogLevel, ai as ListerMapping, a8 as ListerMode, ax as ListerOpenOptions, a9 as ListerOpenReason, ay as ListerOpenResult, aw as ListerOptionsForMode, ah as ListerPermissionCtx, av as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, au as ListerValueForMode, ac as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, ab as Resolver, aa as Selector } from './core-EVtvQ-ma.mjs';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './adapter-CvjXO9Gi.mjs';
|
|
7
7
|
import '@inertiajs/core';
|
|
@@ -11,189 +11,155 @@ import 'class-variance-authority/types';
|
|
|
11
11
|
import 'class-variance-authority';
|
|
12
12
|
import '@radix-ui/react-switch';
|
|
13
13
|
|
|
14
|
+
type HttpMethod = "GET" | "POST";
|
|
14
15
|
type HttpReq = {
|
|
15
16
|
endpoint: string;
|
|
16
|
-
method
|
|
17
|
+
method?: HttpMethod;
|
|
17
18
|
params?: any;
|
|
18
19
|
body?: any;
|
|
19
|
-
headers?:
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
requestId?: string;
|
|
20
23
|
};
|
|
21
24
|
type ListerHttpClient = (req: HttpReq) => Promise<any>;
|
|
22
25
|
|
|
23
|
-
type
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
searchSpec?: any;
|
|
33
|
-
searchTarget?: any;
|
|
34
|
-
searchPayload?: any;
|
|
35
|
-
ownerKey?: string;
|
|
26
|
+
type ListerFetchOpts<TCtx = any> = {
|
|
27
|
+
query?: string;
|
|
28
|
+
search?: ListerSearchPayload;
|
|
29
|
+
cursor?: string | null;
|
|
30
|
+
/** request control */
|
|
31
|
+
signal?: AbortSignal;
|
|
32
|
+
requestId?: string;
|
|
33
|
+
/** mapping context override */
|
|
34
|
+
ctx?: TCtx;
|
|
36
35
|
};
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
declare function fetchListerList<TRaw, TValue extends ListerId, TFilters, TMeta, TCtx>(args: {
|
|
37
|
+
def: ListerDefinition<TRaw, TValue, TFilters, TMeta, TCtx>;
|
|
39
38
|
http: ListerHttpClient;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
*/
|
|
59
|
-
setSearchTarget(id: ListerSessionId, target: ListerSearchTarget): void;
|
|
60
|
-
/**
|
|
61
|
-
* Backwards compatible signatures:
|
|
62
|
-
* - existing calls still work: searchRemote(id, q)
|
|
63
|
-
* - new calls can optionally override payload: searchRemote(id, q, payload)
|
|
64
|
-
*
|
|
65
|
-
* If payload is omitted, implementation should read from session.searchTarget.
|
|
66
|
-
*/
|
|
67
|
-
searchLocal: {
|
|
68
|
-
(id: ListerSessionId, q: string): void;
|
|
69
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
70
|
-
};
|
|
71
|
-
searchRemote: {
|
|
72
|
-
(id: ListerSessionId, q: string): void;
|
|
73
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
74
|
-
};
|
|
75
|
-
refresh(id: ListerSessionId): void;
|
|
76
|
-
setPosition(id: ListerSessionId, pos: {
|
|
77
|
-
x: number;
|
|
78
|
-
y: number;
|
|
79
|
-
} | null): void;
|
|
80
|
-
/** Filters (non-UI logic; per session) */
|
|
81
|
-
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
82
|
-
/**
|
|
83
|
-
* NEW semantics:
|
|
84
|
-
* - `optionId` is the UI identifier of the filter option (NOT the db value)
|
|
85
|
-
* - `selectedFilterValues` tracks selected option ids (for UI checkmarks/badge)
|
|
86
|
-
*/
|
|
87
|
-
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
88
|
-
registerPreset(kind: string, def: AnyDef): void;
|
|
89
|
-
getPreset(kind: string): AnyDef | undefined;
|
|
90
|
-
/** Derived list for UI later (local/hybrid filtering) */
|
|
91
|
-
getVisibleOptions(id: ListerSessionId): any[];
|
|
92
|
-
};
|
|
93
|
-
declare const Ctx: React.Context<InternalContextValue | null>;
|
|
94
|
-
type ResolvedFilterNode<TFilters> = {
|
|
95
|
-
option: ListerFilterOption<TFilters>;
|
|
96
|
-
id: string;
|
|
97
|
-
kind?: string;
|
|
98
|
-
disabled?: boolean;
|
|
99
|
-
bindKey?: string;
|
|
100
|
-
dbValue?: any;
|
|
101
|
-
apply?: {
|
|
102
|
-
key?: string;
|
|
103
|
-
mode?: "replace" | "merge" | "unset";
|
|
104
|
-
toggleable?: boolean;
|
|
105
|
-
value?: any;
|
|
106
|
-
};
|
|
39
|
+
filters?: TFilters;
|
|
40
|
+
opts?: ListerFetchOpts<TCtx>;
|
|
41
|
+
}): Promise<{
|
|
42
|
+
rawList: TRaw[];
|
|
43
|
+
optionsList: Array<ListerOption<TRaw, TValue, TMeta>>;
|
|
44
|
+
responseBody: any;
|
|
45
|
+
requestId?: string;
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
type ListerEngine = {
|
|
49
|
+
http: ListerHttpClient;
|
|
50
|
+
fetch: <TRaw, TValue extends ListerId, TFilters, TMeta, TCtx>(args: {
|
|
51
|
+
def: ListerDefinition<TRaw, TValue, TFilters, TMeta, TCtx>;
|
|
52
|
+
filters?: TFilters;
|
|
53
|
+
opts?: ListerFetchOpts<TCtx> & {
|
|
54
|
+
search?: ListerSearchPayload;
|
|
55
|
+
};
|
|
56
|
+
}) => ReturnType<typeof fetchListerList<TRaw, TValue, TFilters, TMeta, TCtx>>;
|
|
107
57
|
};
|
|
108
|
-
|
|
109
|
-
|
|
58
|
+
|
|
59
|
+
type CreateListerRuntimeOptions<P extends PresetMap> = {
|
|
110
60
|
host: ListerProviderHost;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
/**
|
|
61
|
+
/** Provide your own engine (for tests / custom http). */
|
|
62
|
+
engine?: ListerEngine;
|
|
63
|
+
/** Initial preset map (kind => definition). */
|
|
64
|
+
presets?: P;
|
|
65
|
+
/** Debounce used when searchMode is remote/hybrid and query changes. */
|
|
114
66
|
remoteDebounceMs?: number;
|
|
115
|
-
|
|
116
|
-
|
|
67
|
+
now?: () => number;
|
|
68
|
+
makeSessionId?: () => string;
|
|
69
|
+
};
|
|
70
|
+
type ListerRuntime<P extends PresetMap> = {
|
|
71
|
+
engine: ListerEngine;
|
|
72
|
+
api: ListerApi<P>;
|
|
73
|
+
getState(): ListerStoreState;
|
|
74
|
+
subscribe(fn: () => void): () => void;
|
|
75
|
+
actions: {
|
|
76
|
+
focus(sessionId: ListerSessionId): void;
|
|
77
|
+
close(sessionId: ListerSessionId): void;
|
|
78
|
+
cancel(sessionId: ListerSessionId): void;
|
|
79
|
+
apply(sessionId: ListerSessionId): void;
|
|
80
|
+
clear(sessionId: ListerSessionId): void;
|
|
81
|
+
toggle(sessionId: ListerSessionId, value: any): void;
|
|
82
|
+
select(sessionId: ListerSessionId, value: any): void;
|
|
83
|
+
deselect(sessionId: ListerSessionId, value: any): void;
|
|
84
|
+
setQuery(sessionId: ListerSessionId, query: string): void;
|
|
85
|
+
setSearchTarget(sessionId: ListerSessionId, target?: ListerSearchTarget): void;
|
|
86
|
+
setSearchMode(sessionId: ListerSessionId, mode: ListerSearchMode): void;
|
|
87
|
+
setFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
88
|
+
mergeFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
89
|
+
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
90
|
+
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
91
|
+
refresh(sessionId: ListerSessionId): void;
|
|
92
|
+
};
|
|
93
|
+
selectors: {
|
|
94
|
+
effectiveFilters(sessionId: ListerSessionId): any;
|
|
95
|
+
visibleOptions(sessionId: ListerSessionId): any[];
|
|
96
|
+
detailsPayload(sessionId: ListerSessionId, action: ListerDetails<any, any, any, any>["action"]): any;
|
|
97
|
+
};
|
|
98
|
+
};
|
|
117
99
|
|
|
118
100
|
/**
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
101
|
+
* Context for Lister runtime bridge.
|
|
102
|
+
*/
|
|
103
|
+
declare const ListerContext: React.Context<ListerRuntime<any> | null>;
|
|
104
|
+
type ListerProviderProps<P extends PresetMap> = React.PropsWithChildren<CreateListerRuntimeOptions<P>>;
|
|
105
|
+
/**
|
|
106
|
+
* ListerProvider — creates a singleton runtime and exposes it via React context.
|
|
123
107
|
*
|
|
124
|
-
*
|
|
125
|
-
* -
|
|
126
|
-
* -
|
|
127
|
-
* -
|
|
108
|
+
* Responsibilities:
|
|
109
|
+
* - instantiate `createListerRuntime` once per provider
|
|
110
|
+
* - subscribe to runtime store (if needed by descendants)
|
|
111
|
+
* - expose `api`, `actions`, `selectors`, and `state`
|
|
128
112
|
*/
|
|
129
|
-
declare function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
declare function ListerUI(): react_jsx_runtime.JSX.Element | null;
|
|
135
|
-
declare function HeaderBar(props: {
|
|
136
|
-
id: ListerSessionId;
|
|
137
|
-
title: string;
|
|
138
|
-
loading: boolean;
|
|
139
|
-
refreshing: boolean;
|
|
140
|
-
showRefresh: boolean;
|
|
141
|
-
draggable: boolean;
|
|
142
|
-
onRefresh(): void;
|
|
143
|
-
onClose(): void;
|
|
144
|
-
}): react_jsx_runtime.JSX.Element;
|
|
113
|
+
declare function ListerProvider<P extends PresetMap>({ children, ...opts }: ListerProviderProps<P>): react_jsx_runtime.JSX.Element;
|
|
114
|
+
/**
|
|
115
|
+
* Helper: get current runtime or throw
|
|
116
|
+
*/
|
|
117
|
+
declare function useListerRuntime<P extends PresetMap>(): ListerRuntime<P>;
|
|
145
118
|
|
|
146
|
-
declare function
|
|
147
|
-
id: ListerSessionId;
|
|
148
|
-
className?: string;
|
|
149
|
-
}): react_jsx_runtime.JSX.Element;
|
|
150
|
-
declare function FooterBar(props: {
|
|
151
|
-
id: ListerSessionId;
|
|
152
|
-
mode: ListerMode;
|
|
153
|
-
confirm: boolean;
|
|
154
|
-
onClear(): void;
|
|
155
|
-
onCancel(): void;
|
|
156
|
-
onApply(): void;
|
|
157
|
-
}): react_jsx_runtime.JSX.Element;
|
|
119
|
+
declare function ListerUI(): React.ReactPortal | null;
|
|
158
120
|
|
|
121
|
+
/**
|
|
122
|
+
* useLister — stable hook returning { api, store/state, actions, selectors }.
|
|
123
|
+
*
|
|
124
|
+
* It directly mirrors the current runtime, with stable reference equality
|
|
125
|
+
* for top-level properties (api/actions/selectors), while `state` updates on
|
|
126
|
+
* store changes.
|
|
127
|
+
*/
|
|
159
128
|
declare function useLister<P extends PresetMap>(): {
|
|
160
129
|
api: ListerApi<P>;
|
|
161
|
-
store: ListerStoreState;
|
|
162
|
-
/** active session convenience (can be undefined if none open) */
|
|
163
|
-
state: AnyState | undefined;
|
|
164
130
|
actions: {
|
|
165
|
-
focus(
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
toggle(
|
|
171
|
-
select(
|
|
172
|
-
deselect(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
setSearchMode(
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
(id: ListerSessionId, q: string): void;
|
|
179
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
180
|
-
};
|
|
181
|
-
searchRemote: {
|
|
182
|
-
(id: ListerSessionId, q: string): void;
|
|
183
|
-
(id: ListerSessionId, q: string, payload?: ListerSearchPayload): void;
|
|
184
|
-
};
|
|
185
|
-
refresh(id: ListerSessionId): void;
|
|
186
|
-
setPosition(id: ListerSessionId, pos: {
|
|
187
|
-
x: number;
|
|
188
|
-
y: number;
|
|
189
|
-
} | null): void;
|
|
190
|
-
/** Filters (non-UI logic) */
|
|
131
|
+
focus(sessionId: ListerSessionId): void;
|
|
132
|
+
close(sessionId: ListerSessionId): void;
|
|
133
|
+
cancel(sessionId: ListerSessionId): void;
|
|
134
|
+
apply(sessionId: ListerSessionId): void;
|
|
135
|
+
clear(sessionId: ListerSessionId): void;
|
|
136
|
+
toggle(sessionId: ListerSessionId, value: any): void;
|
|
137
|
+
select(sessionId: ListerSessionId, value: any): void;
|
|
138
|
+
deselect(sessionId: ListerSessionId, value: any): void;
|
|
139
|
+
setQuery(sessionId: ListerSessionId, query: string): void;
|
|
140
|
+
setSearchTarget(sessionId: ListerSessionId, target?: ListerSearchTarget): void;
|
|
141
|
+
setSearchMode(sessionId: ListerSessionId, mode: ListerSearchMode): void;
|
|
142
|
+
setFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
143
|
+
mergeFiltersPatch(sessionId: ListerSessionId, patch: any): void;
|
|
191
144
|
getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
|
|
192
145
|
applyFilterOption(id: ListerSessionId, optionId: string | number): void;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
146
|
+
refresh(sessionId: ListerSessionId): void;
|
|
147
|
+
};
|
|
148
|
+
selectors: {
|
|
149
|
+
effectiveFilters(sessionId: ListerSessionId): any;
|
|
150
|
+
visibleOptions(sessionId: ListerSessionId): any[];
|
|
151
|
+
detailsPayload(sessionId: ListerSessionId, action: ListerDetails<any, any, any, any>["action"]): any;
|
|
196
152
|
};
|
|
153
|
+
state: ListerStoreState;
|
|
154
|
+
store: ListerStoreState;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* useListerSession — convenience hook for one active session.
|
|
158
|
+
* Example: UI overlays or modals can call this to get the current session.
|
|
159
|
+
*/
|
|
160
|
+
declare function useListerSession<P extends PresetMap>(sessionId?: ListerSessionId): {
|
|
161
|
+
session: ListerRuntimeState<any, any, any, any, any> | undefined;
|
|
162
|
+
activeId: string | undefined;
|
|
197
163
|
};
|
|
198
164
|
|
|
199
165
|
/**
|
|
@@ -239,7 +205,7 @@ type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
|
|
|
239
205
|
method?: "GET" | "POST";
|
|
240
206
|
selector?: DataSelector<TItem>;
|
|
241
207
|
/**
|
|
242
|
-
* Passed through into
|
|
208
|
+
* Passed through into request builder (same signature shape as legacy provider)
|
|
243
209
|
*/
|
|
244
210
|
buildRequest?: (ctx: DataBuildRequestCtx<TFilters>) => DataBuildRequestResult;
|
|
245
211
|
/**
|
|
@@ -260,6 +226,10 @@ type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
|
|
|
260
226
|
* Optional selection support (by stable item key)
|
|
261
227
|
*/
|
|
262
228
|
selection?: DataSelectionConfig<TItem>;
|
|
229
|
+
/**
|
|
230
|
+
* Optional override: custom http client (otherwise uses global axios / axios import)
|
|
231
|
+
*/
|
|
232
|
+
http?: ListerHttpClient;
|
|
263
233
|
};
|
|
264
234
|
type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
265
235
|
id?: string;
|
|
@@ -291,10 +261,11 @@ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
|
|
|
291
261
|
query?: string;
|
|
292
262
|
filters?: TFilters;
|
|
293
263
|
searchTarget?: ListerSearchTarget;
|
|
264
|
+
search?: ListerSearchPayload;
|
|
294
265
|
}) => Promise<TItem[]>;
|
|
295
266
|
};
|
|
296
267
|
declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>): UseDataResult<TItem, TFilters>;
|
|
297
268
|
|
|
298
269
|
declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
|
|
299
270
|
|
|
300
|
-
export { type
|
|
271
|
+
export { type DataBuildRequestCtx, type DataBuildRequestResult, type DataKey, type DataSearchConfig, type DataSelectionConfig, type DataSelectionKey, type DataSelectionMode, type DataSelector, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerContext, ListerDefinition, ListerDetails, ListerFilterCtx, ListerId, ListerOption, ListerProvider, ListerProviderHost, type ListerProviderProps, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, PresetMap, type UseDataOptions, type UseDataResult, useData, useLister, useListerRuntime, useListerSession };
|