@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.
@@ -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 FileVariantBaseProps = Pick<VariantBaseProps<FileItem[]>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> & {
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 = FileVariantBaseProps & (FileDefaultModeProps | FileButtonModeProps);
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 ListerSearchMode 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 ListerDefinition as Q, type RelativeRootsMap as R, type SublabelPlacement as S, Textarea as T, type ListerRuntimeState as U, type VariantKey as V, type ListerProviderHost as W, type PresetMap as X, type ListerStoreState as Y, type ListerSessionId as Z, type ListerId as _, type CoreContext as a, type ListerSearchTarget as a0, type ListerSearchPayload as a1, type ListerFilterCtx as a2, type ListerFilterOption as a3, type ListerMode as a4, type ListerApi as a5, type ShadcnJsonEditorProps as a6, type JsonEditorIndexHandle as a7, type ListerOpenReason as a8, type Selector as a9, type PresetValue as aA, type PresetFilters as aB, type PresetMeta as aC, type ListerSessionState as aD, type Resolver as aa, type OpenAnchor as ab, type ListerChangeEvent as ac, type ListerLogLevel as ad, type ListerLogCode as ae, type ListerLogEntry as af, type ListerPermissionCtx as ag, type ListerOption 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 ListerFilterSpec as as, type ListerValueForMode as at, type ListerRawForMode as au, type ListerOptionsForMode as av, type ListerDetails 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 };
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 FileVariantBaseProps = Pick<VariantBaseProps<FileItem[]>, "value" | "onValue" | "error" | "disabled" | "readOnly" | "size" | "density"> & {
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 = FileVariantBaseProps & (FileDefaultModeProps | FileButtonModeProps);
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 ListerSearchMode 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 ListerDefinition as Q, type RelativeRootsMap as R, type SublabelPlacement as S, Textarea as T, type ListerRuntimeState as U, type VariantKey as V, type ListerProviderHost as W, type PresetMap as X, type ListerStoreState as Y, type ListerSessionId as Z, type ListerId as _, type CoreContext as a, type ListerSearchTarget as a0, type ListerSearchPayload as a1, type ListerFilterCtx as a2, type ListerFilterOption as a3, type ListerMode as a4, type ListerApi as a5, type ShadcnJsonEditorProps as a6, type JsonEditorIndexHandle as a7, type ListerOpenReason as a8, type Selector as a9, type PresetValue as aA, type PresetFilters as aB, type PresetMeta as aC, type ListerSessionState as aD, type Resolver as aa, type OpenAnchor as ab, type ListerChangeEvent as ac, type ListerLogLevel as ad, type ListerLogCode as ae, type ListerLogEntry as af, type ListerPermissionCtx as ag, type ListerOption 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 ListerFilterSpec as as, type ListerValueForMode as at, type ListerRawForMode as au, type ListerOptionsForMode as av, type ListerDetails 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 };
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 ListerDefinition, U as ListerRuntimeState, W as ListerProviderHost, X as PresetMap, Y as ListerStoreState, Z as ListerSessionId, _ as ListerId, $ as ListerSearchMode, a0 as ListerSearchTarget, a1 as ListerSearchPayload, a2 as ListerFilterCtx, a3 as ListerFilterOption, a4 as ListerMode, a5 as ListerApi, a6 as ShadcnJsonEditorProps, a7 as JsonEditorIndexHandle } from './core-BD0ObjuE.mjs';
4
- export { ac as ListerChangeEvent, aw as ListerDetails, am as ListerFilterApply, al as ListerFilterApplyMode, an as ListerFilterBindKey, ap as ListerFilterGroupOption, ao as ListerFilterInput, ar as ListerFilterInputOption, as as ListerFilterSpec, aq as ListerFilterValueOption, ae as ListerLogCode, af as ListerLogEntry, ad as ListerLogLevel, ai as ListerMapping, ax as ListerOpenOptions, a8 as ListerOpenReason, ay as ListerOpenResult, ah as ListerOption, av as ListerOptionsForMode, ag as ListerPermissionCtx, au as ListerRawForMode, ak as ListerSearchSpec, aD as ListerSessionState, aj as ListerSource, at as ListerValueForMode, ab as OpenAnchor, aB as PresetFilters, aC as PresetMeta, az as PresetRaw, aA as PresetValue, aa as Resolver, a9 as Selector } from './core-BD0ObjuE.mjs';
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: "GET" | "POST";
17
+ method?: HttpMethod;
17
18
  params?: any;
18
19
  body?: any;
19
- headers?: any;
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 AnyDef = ListerDefinition<any, any, any, any>;
24
- /**
25
- * IMPORTANT:
26
- * Your types file may not yet include these runtime-only fields (searchSpec/searchTarget).
27
- * Without widening here, TS2353 will fire when we create session objects containing them.
28
- *
29
- * This keeps compilation green while you finish syncing the types.
30
- */
31
- type AnyState = ListerRuntimeState<any, any, any, any, any> & {
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
- type InternalContextValue = {
38
- host: ListerProviderHost;
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
- presetsRef: React.RefObject<PresetMap>;
41
- store: ListerStoreState;
42
- apiFetchAny: (kindOrDef: string | AnyDef, filters?: any, opts?: any) => Promise<any>;
43
- apiOpenAny: (kindOrDef: string | AnyDef, filters?: any, opts?: any) => Promise<any>;
44
- focus(id: ListerSessionId): void;
45
- dispose(id: ListerSessionId): void;
46
- apply(id: ListerSessionId): void;
47
- cancel(id: ListerSessionId): void;
48
- close(id: ListerSessionId): void;
49
- toggle(id: ListerSessionId, value: ListerId): void;
50
- select(id: ListerSessionId, value: ListerId): void;
51
- deselect(id: ListerSessionId, value: ListerId): void;
52
- clear(id: ListerSessionId): void;
53
- setQuery(id: ListerSessionId, q: string): void;
54
- setSearchMode(id: ListerSessionId, mode: ListerSearchMode): void;
55
- /**
56
- * Persist the user's current search target (subject/all/only)
57
- * so all searches (local/remote/hybrid) can include it.
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
- declare function buildSearchPayloadFromTarget(target?: ListerSearchTarget | null): ListerSearchPayload | undefined;
109
- declare function ListerProvider(props: {
58
+
59
+ type CreateListerRuntimeOptions<P extends PresetMap> = {
110
60
  host: ListerProviderHost;
111
- presets?: PresetMap;
112
- http?: ListerHttpClient;
113
- /** provider-side debounce for remote search (default 300ms) */
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
- children: React.ReactNode;
116
- }): react_jsx_runtime.JSX.Element;
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
- * Search bar + trailing controls:
120
- * - Search target (all/subject/only) popover (leading control)
121
- * - Search mode toggle (remote/local/hybrid)
122
- * - Filters UI (custom popover button)
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
- * Notes:
125
- * - Search mode is bound to session.searchMode via actions.setSearchMode(id, mode)
126
- * - Search target is bound to session.searchTarget via actions.setSearchTarget(id, target)
127
- * - Filters live in session.filtersSpec?.options and session.selectedFilterValues
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 SearchBar(props: {
130
- id: ListerSessionId;
131
- store: ListerStoreState;
132
- }): react_jsx_runtime.JSX.Element;
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 OptionList(props: {
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(id: ListerSessionId): void;
166
- dispose(id: ListerSessionId): void;
167
- apply(id: ListerSessionId): void;
168
- cancel(id: ListerSessionId): void;
169
- close(id: ListerSessionId): void;
170
- toggle(id: ListerSessionId, value: ListerId): void;
171
- select(id: ListerSessionId, value: ListerId): void;
172
- deselect(id: ListerSessionId, value: ListerId): void;
173
- clear(id: ListerSessionId): void;
174
- setQuery(id: ListerSessionId, q: string): void;
175
- setSearchMode(id: ListerSessionId, mode: ListerSearchMode): void;
176
- setSearchTarget(id: ListerSessionId, target: ListerSearchTarget): void;
177
- searchLocal: {
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
- registerPreset(kind: string, def: AnyDef): void;
194
- getPreset(kind: string): AnyDef | undefined;
195
- getVisibleOptions(id: ListerSessionId): any[];
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 the inline def source.buildRequest (same signature as provider)
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 AnyDef, type AnyState, Ctx, type DataBuildRequestCtx, type DataBuildRequestResult, type DataKey, type DataSearchConfig, type DataSelectionConfig, type DataSelectionKey, type DataSelectionMode, type DataSelector, FooterBar, HeaderBar, type InternalContextValue, ShadcnJsonEditorVariant as JsonEditor, ListerApi, ListerDefinition, ListerFilterCtx, ListerFilterOption, ListerId, ListerMode, ListerProvider, ListerProviderHost, ListerRuntimeState, ListerSearchMode, ListerSearchPayload, ListerSearchTarget, ListerSessionId, ListerStoreState, ListerUI, OptionList, PresetMap, type ResolvedFilterNode, SearchBar, type UseDataOptions, type UseDataResult, buildSearchPayloadFromTarget, useData, useLister };
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 };