@timeax/form-palette 0.0.29 → 0.0.31

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.
@@ -0,0 +1,300 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { M as ListerDefinition, N as ListerRuntimeState, O as ListerProviderHost, P as PresetMap, Q as ListerStoreState, U as ListerSessionId, W as ListerId, X as ListerSearchMode, Y as ListerSearchTarget, Z as ListerSearchPayload, _ as ListerFilterCtx, $ as ListerFilterOption, a0 as ListerMode, a1 as ListerApi, a2 as ShadcnJsonEditorProps, a3 as JsonEditorIndexHandle } from './variant-jHi2M5Ru.mjs';
4
+ export { a8 as ListerChangeEvent, as as ListerDetails, ai as ListerFilterApply, ah as ListerFilterApplyMode, aj as ListerFilterBindKey, al as ListerFilterGroupOption, ak as ListerFilterInput, an as ListerFilterInputOption, ao as ListerFilterSpec, am as ListerFilterValueOption, aa as ListerLogCode, ab as ListerLogEntry, a9 as ListerLogLevel, ae as ListerMapping, at as ListerOpenOptions, a4 as ListerOpenReason, au as ListerOpenResult, ad as ListerOption, ar as ListerOptionsForMode, ac as ListerPermissionCtx, aq as ListerRawForMode, ag as ListerSearchSpec, az as ListerSessionState, af as ListerSource, ap as ListerValueForMode, a7 as OpenAnchor, ax as PresetFilters, ay as PresetMeta, av as PresetRaw, aw as PresetValue, a6 as Resolver, a5 as Selector } from './variant-jHi2M5Ru.mjs';
5
+ import 'zod';
6
+ import './adapter-CvjXO9Gi.mjs';
7
+ import '@inertiajs/core';
8
+ import 'axios';
9
+ import 'react-day-picker';
10
+ import 'class-variance-authority/types';
11
+ import 'class-variance-authority';
12
+ import '@radix-ui/react-switch';
13
+
14
+ type HttpReq = {
15
+ endpoint: string;
16
+ method: "GET" | "POST";
17
+ params?: any;
18
+ body?: any;
19
+ headers?: any;
20
+ };
21
+ type ListerHttpClient = (req: HttpReq) => Promise<any>;
22
+
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;
36
+ };
37
+ type InternalContextValue = {
38
+ host: ListerProviderHost;
39
+ 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
+ };
107
+ };
108
+ declare function buildSearchPayloadFromTarget(target?: ListerSearchTarget | null): ListerSearchPayload | undefined;
109
+ declare function ListerProvider(props: {
110
+ host: ListerProviderHost;
111
+ presets?: PresetMap;
112
+ http?: ListerHttpClient;
113
+ /** provider-side debounce for remote search (default 300ms) */
114
+ remoteDebounceMs?: number;
115
+ children: React.ReactNode;
116
+ }): react_jsx_runtime.JSX.Element;
117
+
118
+ /**
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)
123
+ *
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
128
+ */
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;
145
+
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;
158
+
159
+ declare function useLister<P extends PresetMap>(): {
160
+ api: ListerApi<P>;
161
+ store: ListerStoreState;
162
+ /** active session convenience (can be undefined if none open) */
163
+ state: AnyState | undefined;
164
+ 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) */
191
+ getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
192
+ 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[];
196
+ };
197
+ };
198
+
199
+ /**
200
+ * Minimal selector contract (matches extractArray contract used by lister)
201
+ * - function: (body) => array
202
+ * - string: path selector
203
+ */
204
+ type DataSelector<T> = any;
205
+ type DataSearchConfig = {
206
+ default?: string;
207
+ };
208
+ type DataBuildRequestCtx<TFilters> = {
209
+ filters?: TFilters;
210
+ query: string;
211
+ cursor: any;
212
+ };
213
+ type DataBuildRequestResult = {
214
+ params?: any;
215
+ body?: any;
216
+ headers?: any;
217
+ };
218
+ type DataKey = string | number;
219
+ type DataSelectionMode = "none" | "single" | "multiple";
220
+ type DataSelectionKey<TItem> = keyof TItem | string | ((item: TItem) => DataKey | null | undefined);
221
+ type DataSelectionConfig<TItem> = {
222
+ mode?: Exclude<DataSelectionMode, "none">;
223
+ /**
224
+ * How to resolve the ID for an item.
225
+ * - string/ keyof: item[key]
226
+ * - function: (item) => id
227
+ * Defaults to: item.id ?? item.value
228
+ */
229
+ key?: DataSelectionKey<TItem>;
230
+ /**
231
+ * If "missing", selection IDs that don't exist in the *latest fetched list* are removed.
232
+ * Default: "never" (recommended; avoids wiping selection on remote searches).
233
+ */
234
+ prune?: "never" | "missing";
235
+ };
236
+ type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
237
+ id?: string;
238
+ endpoint: string;
239
+ method?: "GET" | "POST";
240
+ selector?: DataSelector<TItem>;
241
+ /**
242
+ * Passed through into the inline def source.buildRequest (same signature as provider)
243
+ */
244
+ buildRequest?: (ctx: DataBuildRequestCtx<TFilters>) => DataBuildRequestResult;
245
+ /**
246
+ * Minimal search config (default subject column).
247
+ */
248
+ search?: DataSearchConfig;
249
+ /**
250
+ * Raw filters object
251
+ */
252
+ filters?: TFilters;
253
+ initial?: TItem[];
254
+ enabled?: boolean;
255
+ fetchOnMount?: boolean;
256
+ searchMode?: ListerSearchMode;
257
+ debounceMs?: number;
258
+ autoFetchOnFilterChange?: boolean;
259
+ /**
260
+ * Optional selection support (by stable item key)
261
+ */
262
+ selection?: DataSelectionConfig<TItem>;
263
+ };
264
+ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
265
+ id?: string;
266
+ data: TItem[];
267
+ visible: TItem[];
268
+ loading: boolean;
269
+ error: any;
270
+ query: string;
271
+ setQuery: (q: string) => void;
272
+ searchMode: ListerSearchMode;
273
+ setSearchMode: (m: ListerSearchMode) => void;
274
+ searchTarget?: ListerSearchTarget;
275
+ setSearchTarget: (t: ListerSearchTarget) => void;
276
+ filters?: TFilters;
277
+ setFilters: (next: TFilters | undefined) => void;
278
+ patchFilters: (patch: Partial<TFilters>) => void;
279
+ clearFilters: () => void;
280
+ selectionMode: DataSelectionMode;
281
+ selectedIds: DataKey | DataKey[] | null;
282
+ selected: TItem | TItem[] | null;
283
+ select: (id: DataKey | DataKey[]) => void;
284
+ deselect: (id: DataKey | DataKey[]) => void;
285
+ toggle: (id: DataKey) => void;
286
+ clearSelection: () => void;
287
+ isSelected: (id: DataKey) => boolean;
288
+ getSelection: () => TItem | TItem[] | null;
289
+ refresh: () => void;
290
+ fetch: (override?: {
291
+ query?: string;
292
+ filters?: TFilters;
293
+ searchTarget?: ListerSearchTarget;
294
+ }) => Promise<TItem[]>;
295
+ };
296
+ declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>): UseDataResult<TItem, TFilters>;
297
+
298
+ declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
299
+
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 };
@@ -0,0 +1,300 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React from 'react';
3
+ import { M as ListerDefinition, N as ListerRuntimeState, O as ListerProviderHost, P as PresetMap, Q as ListerStoreState, U as ListerSessionId, W as ListerId, X as ListerSearchMode, Y as ListerSearchTarget, Z as ListerSearchPayload, _ as ListerFilterCtx, $ as ListerFilterOption, a0 as ListerMode, a1 as ListerApi, a2 as ShadcnJsonEditorProps, a3 as JsonEditorIndexHandle } from './variant-BhsBO5Yr.js';
4
+ export { a8 as ListerChangeEvent, as as ListerDetails, ai as ListerFilterApply, ah as ListerFilterApplyMode, aj as ListerFilterBindKey, al as ListerFilterGroupOption, ak as ListerFilterInput, an as ListerFilterInputOption, ao as ListerFilterSpec, am as ListerFilterValueOption, aa as ListerLogCode, ab as ListerLogEntry, a9 as ListerLogLevel, ae as ListerMapping, at as ListerOpenOptions, a4 as ListerOpenReason, au as ListerOpenResult, ad as ListerOption, ar as ListerOptionsForMode, ac as ListerPermissionCtx, aq as ListerRawForMode, ag as ListerSearchSpec, az as ListerSessionState, af as ListerSource, ap as ListerValueForMode, a7 as OpenAnchor, ax as PresetFilters, ay as PresetMeta, av as PresetRaw, aw as PresetValue, a6 as Resolver, a5 as Selector } from './variant-BhsBO5Yr.js';
5
+ import 'zod';
6
+ import './adapter-CvjXO9Gi.js';
7
+ import '@inertiajs/core';
8
+ import 'axios';
9
+ import 'react-day-picker';
10
+ import 'class-variance-authority/types';
11
+ import 'class-variance-authority';
12
+ import '@radix-ui/react-switch';
13
+
14
+ type HttpReq = {
15
+ endpoint: string;
16
+ method: "GET" | "POST";
17
+ params?: any;
18
+ body?: any;
19
+ headers?: any;
20
+ };
21
+ type ListerHttpClient = (req: HttpReq) => Promise<any>;
22
+
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;
36
+ };
37
+ type InternalContextValue = {
38
+ host: ListerProviderHost;
39
+ 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
+ };
107
+ };
108
+ declare function buildSearchPayloadFromTarget(target?: ListerSearchTarget | null): ListerSearchPayload | undefined;
109
+ declare function ListerProvider(props: {
110
+ host: ListerProviderHost;
111
+ presets?: PresetMap;
112
+ http?: ListerHttpClient;
113
+ /** provider-side debounce for remote search (default 300ms) */
114
+ remoteDebounceMs?: number;
115
+ children: React.ReactNode;
116
+ }): react_jsx_runtime.JSX.Element;
117
+
118
+ /**
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)
123
+ *
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
128
+ */
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;
145
+
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;
158
+
159
+ declare function useLister<P extends PresetMap>(): {
160
+ api: ListerApi<P>;
161
+ store: ListerStoreState;
162
+ /** active session convenience (can be undefined if none open) */
163
+ state: AnyState | undefined;
164
+ 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) */
191
+ getFilterCtx<TFilters>(id: ListerSessionId): ListerFilterCtx<TFilters>;
192
+ 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[];
196
+ };
197
+ };
198
+
199
+ /**
200
+ * Minimal selector contract (matches extractArray contract used by lister)
201
+ * - function: (body) => array
202
+ * - string: path selector
203
+ */
204
+ type DataSelector<T> = any;
205
+ type DataSearchConfig = {
206
+ default?: string;
207
+ };
208
+ type DataBuildRequestCtx<TFilters> = {
209
+ filters?: TFilters;
210
+ query: string;
211
+ cursor: any;
212
+ };
213
+ type DataBuildRequestResult = {
214
+ params?: any;
215
+ body?: any;
216
+ headers?: any;
217
+ };
218
+ type DataKey = string | number;
219
+ type DataSelectionMode = "none" | "single" | "multiple";
220
+ type DataSelectionKey<TItem> = keyof TItem | string | ((item: TItem) => DataKey | null | undefined);
221
+ type DataSelectionConfig<TItem> = {
222
+ mode?: Exclude<DataSelectionMode, "none">;
223
+ /**
224
+ * How to resolve the ID for an item.
225
+ * - string/ keyof: item[key]
226
+ * - function: (item) => id
227
+ * Defaults to: item.id ?? item.value
228
+ */
229
+ key?: DataSelectionKey<TItem>;
230
+ /**
231
+ * If "missing", selection IDs that don't exist in the *latest fetched list* are removed.
232
+ * Default: "never" (recommended; avoids wiping selection on remote searches).
233
+ */
234
+ prune?: "never" | "missing";
235
+ };
236
+ type UseDataOptions<TItem = any, TFilters = Record<string, any>> = {
237
+ id?: string;
238
+ endpoint: string;
239
+ method?: "GET" | "POST";
240
+ selector?: DataSelector<TItem>;
241
+ /**
242
+ * Passed through into the inline def source.buildRequest (same signature as provider)
243
+ */
244
+ buildRequest?: (ctx: DataBuildRequestCtx<TFilters>) => DataBuildRequestResult;
245
+ /**
246
+ * Minimal search config (default subject column).
247
+ */
248
+ search?: DataSearchConfig;
249
+ /**
250
+ * Raw filters object
251
+ */
252
+ filters?: TFilters;
253
+ initial?: TItem[];
254
+ enabled?: boolean;
255
+ fetchOnMount?: boolean;
256
+ searchMode?: ListerSearchMode;
257
+ debounceMs?: number;
258
+ autoFetchOnFilterChange?: boolean;
259
+ /**
260
+ * Optional selection support (by stable item key)
261
+ */
262
+ selection?: DataSelectionConfig<TItem>;
263
+ };
264
+ type UseDataResult<TItem = any, TFilters = Record<string, any>> = {
265
+ id?: string;
266
+ data: TItem[];
267
+ visible: TItem[];
268
+ loading: boolean;
269
+ error: any;
270
+ query: string;
271
+ setQuery: (q: string) => void;
272
+ searchMode: ListerSearchMode;
273
+ setSearchMode: (m: ListerSearchMode) => void;
274
+ searchTarget?: ListerSearchTarget;
275
+ setSearchTarget: (t: ListerSearchTarget) => void;
276
+ filters?: TFilters;
277
+ setFilters: (next: TFilters | undefined) => void;
278
+ patchFilters: (patch: Partial<TFilters>) => void;
279
+ clearFilters: () => void;
280
+ selectionMode: DataSelectionMode;
281
+ selectedIds: DataKey | DataKey[] | null;
282
+ selected: TItem | TItem[] | null;
283
+ select: (id: DataKey | DataKey[]) => void;
284
+ deselect: (id: DataKey | DataKey[]) => void;
285
+ toggle: (id: DataKey) => void;
286
+ clearSelection: () => void;
287
+ isSelected: (id: DataKey) => boolean;
288
+ getSelection: () => TItem | TItem[] | null;
289
+ refresh: () => void;
290
+ fetch: (override?: {
291
+ query?: string;
292
+ filters?: TFilters;
293
+ searchTarget?: ListerSearchTarget;
294
+ }) => Promise<TItem[]>;
295
+ };
296
+ declare function useData<TItem = any, TFilters = Record<string, any>>(opts: UseDataOptions<TItem, TFilters>): UseDataResult<TItem, TFilters>;
297
+
298
+ declare const ShadcnJsonEditorVariant: React.ForwardRefExoticComponent<ShadcnJsonEditorProps & React.RefAttributes<JsonEditorIndexHandle>>;
299
+
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 };