@timeax/form-palette 0.0.30 → 0.0.32

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/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule } from './variant-BPDyK780.mjs';
2
- export { B as BaseProps, p as ButtonRef, w as EffectiveFieldLayout, v as FieldLayoutConfig, u as FieldOrdering, t as FieldRootId, r as FieldRoots, s as FieldSlotId, q as FieldSlots, m as FormProps, k as InferFromSchema, I as InputNumber, o as InputStore, x as LayoutResolveContext, y as LayoutResolver, R as RelativeRootsMap, l as SubmitEvent, T as Textarea, n as ValuesResult, z as VariantEntry, J as VariantLayoutDefaults, K as VariantModuleFor, G as VariantValidateFn, A as Variants } from './variant-BPDyK780.mjs';
1
+ import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule } from './variant-jHi2M5Ru.mjs';
2
+ export { B as BaseProps, p as ButtonRef, w as EffectiveFieldLayout, v as FieldLayoutConfig, u as FieldOrdering, t as FieldRootId, r as FieldRoots, s as FieldSlotId, q as FieldSlots, m as FormProps, k as InferFromSchema, I as InputNumber, o as InputStore, x as LayoutResolveContext, y as LayoutResolver, R as RelativeRootsMap, l as SubmitEvent, T as Textarea, n as ValuesResult, z as VariantEntry, J as VariantLayoutDefaults, K as VariantModuleFor, G as VariantValidateFn, A as Variants } from './variant-jHi2M5Ru.mjs';
3
3
  import { A as AdapterKey } from './adapter-CvjXO9Gi.mjs';
4
4
  export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.mjs';
5
5
  export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.mjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule } from './variant-v0LBdshU.js';
2
- export { B as BaseProps, p as ButtonRef, w as EffectiveFieldLayout, v as FieldLayoutConfig, u as FieldOrdering, t as FieldRootId, r as FieldRoots, s as FieldSlotId, q as FieldSlots, m as FormProps, k as InferFromSchema, I as InputNumber, o as InputStore, x as LayoutResolveContext, y as LayoutResolver, R as RelativeRootsMap, l as SubmitEvent, T as Textarea, n as ValuesResult, z as VariantEntry, J as VariantLayoutDefaults, K as VariantModuleFor, G as VariantValidateFn, A as Variants } from './variant-v0LBdshU.js';
1
+ import { D as Dict, C as CoreProps, a as CoreContext, F as Field, V as VariantKey, L as LabelPlacement, S as SublabelPlacement, b as DescriptionPlacement, H as HelpTextPlacement, E as ErrorTextPlacement, c as SlotPlacement, d as FieldSize, e as FieldDensity, f as ValidateResult, g as ChangeDetail, h as VariantValueFor, i as VariantPropsFor, j as VariantModule } from './variant-BhsBO5Yr.js';
2
+ export { B as BaseProps, p as ButtonRef, w as EffectiveFieldLayout, v as FieldLayoutConfig, u as FieldOrdering, t as FieldRootId, r as FieldRoots, s as FieldSlotId, q as FieldSlots, m as FormProps, k as InferFromSchema, I as InputNumber, o as InputStore, x as LayoutResolveContext, y as LayoutResolver, R as RelativeRootsMap, l as SubmitEvent, T as Textarea, n as ValuesResult, z as VariantEntry, J as VariantLayoutDefaults, K as VariantModuleFor, G as VariantValidateFn, A as Variants } from './variant-BhsBO5Yr.js';
3
3
  import { A as AdapterKey } from './adapter-CvjXO9Gi.js';
4
4
  export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig, j as NamedAdapterFactory } from './adapter-CvjXO9Gi.js';
5
5
  export { createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter } from './adapters.js';
package/dist/index.js CHANGED
@@ -23840,19 +23840,139 @@ function mapOptions(rawList, mapping, ctx) {
23840
23840
  }
23841
23841
 
23842
23842
  // src/presets/lister/engine/search.ts
23843
- function optionText(o3) {
23844
- var _a;
23845
- const l2 = o3.label;
23846
- if (typeof l2 === "string") return l2;
23847
- if (typeof l2 === "number") return String(l2);
23848
- const rl = (_a = o3.raw) == null ? void 0 : _a.label;
23849
- if (typeof rl === "string") return rl;
23850
- return String(o3.value);
23851
- }
23852
- function filterOptionsLocal(options, query) {
23843
+ function getPath2(obj, path) {
23844
+ if (!obj || !path) return void 0;
23845
+ if (!path.includes(".")) return obj[path];
23846
+ let cur = obj;
23847
+ for (const part of path.split(".")) {
23848
+ if (cur == null) return void 0;
23849
+ cur = cur[part];
23850
+ }
23851
+ return cur;
23852
+ }
23853
+ function toText(v2) {
23854
+ if (v2 == null) return "";
23855
+ if (typeof v2 === "string") return v2;
23856
+ if (typeof v2 === "number" || typeof v2 === "boolean") return String(v2);
23857
+ return "";
23858
+ }
23859
+ function collectAllText(obj, out, depth = 2, budget = { n: 80 }) {
23860
+ if (obj == null || budget.n <= 0) return;
23861
+ const t4 = typeof obj;
23862
+ if (t4 === "string" || t4 === "number" || t4 === "boolean") {
23863
+ out.push(String(obj));
23864
+ budget.n -= 1;
23865
+ return;
23866
+ }
23867
+ if (depth <= 0) return;
23868
+ if (Array.isArray(obj)) {
23869
+ for (const x2 of obj) collectAllText(x2, out, depth - 1, budget);
23870
+ return;
23871
+ }
23872
+ if (t4 === "object") {
23873
+ for (const k2 of Object.keys(obj)) {
23874
+ collectAllText(obj[k2], out, depth - 1, budget);
23875
+ if (budget.n <= 0) break;
23876
+ }
23877
+ }
23878
+ }
23879
+ function matchQueryInText(q2, text) {
23880
+ if (!q2) return true;
23881
+ return text.toLowerCase().includes(q2);
23882
+ }
23883
+ function buildSearchTextForKeys(raw, keys) {
23884
+ const parts = [];
23885
+ for (const k2 of keys) {
23886
+ const key = String(k2);
23887
+ const v2 = getPath2(raw, key);
23888
+ if (v2 == null) continue;
23889
+ if (Array.isArray(v2)) {
23890
+ for (const x2 of v2) {
23891
+ const s4 = toText(x2);
23892
+ if (s4) parts.push(s4);
23893
+ }
23894
+ continue;
23895
+ }
23896
+ const s3 = toText(v2);
23897
+ if (s3) parts.push(s3);
23898
+ }
23899
+ return parts.join(" ");
23900
+ }
23901
+ function matchesSearch(raw, q2, search) {
23902
+ if (!q2) return true;
23903
+ if (search == null ? void 0 : search.searchAll) {
23904
+ return matchQueryInText(q2, buildSearchTextAll(raw));
23905
+ }
23906
+ if (Array.isArray(search == null ? void 0 : search.searchOnly) && search.searchOnly.length) {
23907
+ return matchQueryInText(
23908
+ q2,
23909
+ buildSearchTextForKeys(raw, search.searchOnly)
23910
+ );
23911
+ }
23912
+ if (typeof (search == null ? void 0 : search.subject) === "string" && search.subject) {
23913
+ return matchQueryInText(
23914
+ q2,
23915
+ buildSearchTextForKeys(raw, [search.subject])
23916
+ );
23917
+ }
23918
+ return matchQueryInText(q2, buildSearchTextAll(raw));
23919
+ }
23920
+ function buildSearchTextAll(raw) {
23921
+ const parts = [];
23922
+ collectAllText(raw, parts, 2);
23923
+ return parts.join(" ");
23924
+ }
23925
+ function isEmptyFilterValue(v2) {
23926
+ if (v2 === void 0 || v2 === null) return true;
23927
+ if (typeof v2 === "string" && v2.trim() === "") return true;
23928
+ return Array.isArray(v2) && v2.length === 0;
23929
+ }
23930
+ function matchesFilters(raw, filters) {
23931
+ if (!filters) return true;
23932
+ for (const key of Object.keys(filters)) {
23933
+ if (key === "search" || key === "subject" || key === "searchAll" || key === "searchOnly") {
23934
+ continue;
23935
+ }
23936
+ const fv = filters[key];
23937
+ if (isEmptyFilterValue(fv)) continue;
23938
+ const rv = getPath2(raw, key);
23939
+ if (Array.isArray(fv)) {
23940
+ if (Array.isArray(rv)) {
23941
+ const ok = rv.some((x2) => fv.includes(x2));
23942
+ if (!ok) return false;
23943
+ } else {
23944
+ if (!fv.includes(rv)) return false;
23945
+ }
23946
+ continue;
23947
+ }
23948
+ if (Array.isArray(rv)) {
23949
+ if (!rv.includes(fv)) return false;
23950
+ continue;
23951
+ }
23952
+ if (String(rv) !== String(fv)) return false;
23953
+ }
23954
+ return true;
23955
+ }
23956
+ function filterRawListLocal(rawList, query, search, filters, opts) {
23957
+ let list = Array.isArray(rawList) ? rawList : [];
23958
+ const ctx = { query, search, filters };
23959
+ const filtersLocal = (opts == null ? void 0 : opts.filtersSpec) && opts.filtersSpec.local;
23960
+ if (typeof filtersLocal === "function") {
23961
+ const out = filtersLocal(list, ctx);
23962
+ if (Array.isArray(out)) list = out;
23963
+ } else {
23964
+ list = list.filter(
23965
+ (r5) => matchesFilters(r5, filters)
23966
+ );
23967
+ }
23853
23968
  const q2 = (query != null ? query : "").trim().toLowerCase();
23854
- if (!q2) return options;
23855
- return options.filter((o3) => optionText(o3).toLowerCase().includes(q2));
23969
+ if (!q2) return list;
23970
+ const searchLocal = (opts == null ? void 0 : opts.searchSpec) && opts.searchSpec.local;
23971
+ if (typeof searchLocal === "function") {
23972
+ const out = searchLocal(list, ctx);
23973
+ if (Array.isArray(out)) return out;
23974
+ }
23975
+ return list.filter((r5) => matchesSearch(r5, q2, search));
23856
23976
  }
23857
23977
 
23858
23978
  // src/presets/lister/engine/selection.ts
@@ -24014,7 +24134,8 @@ function initialSessionState(sessionId) {
24014
24134
  filtersPatch: {},
24015
24135
  effectiveFilters: void 0,
24016
24136
  // IMPORTANT: these are now OPTION IDS (not db values)
24017
- selectedFilterValues: []
24137
+ selectedFilterValues: [],
24138
+ searchPayload: void 0
24018
24139
  };
24019
24140
  }
24020
24141
  function buildSearchPayloadFromTarget(target) {
@@ -24026,7 +24147,7 @@ function buildSearchPayloadFromTarget(target) {
24026
24147
  return subject ? { subject } : void 0;
24027
24148
  }
24028
24149
  if (target.mode === "only") {
24029
- const only = Array.isArray(target.only) ? target.only.filter(Boolean) : void 0;
24150
+ const only = Array.isArray(target.only) ? target.only.filter((v2) => v2 !== null && v2 !== void 0) : void 0;
24030
24151
  return only && only.length ? { searchOnly: only } : void 0;
24031
24152
  }
24032
24153
  return void 0;
@@ -24283,16 +24404,15 @@ function ListerProvider(props) {
24283
24404
  );
24284
24405
  const fetchAndHydrate = React67__namespace.useCallback(
24285
24406
  async (id, reason, override) => {
24286
- var _a2, _b2, _c2, _d, _e, _f, _g, _h;
24407
+ var _a2, _b2, _c2, _d, _e, _f, _g;
24287
24408
  const s0 = getSession(id);
24288
24409
  if (!(s0 == null ? void 0 : s0.definition)) return;
24289
24410
  const myReq = ((_a2 = reqIdBySessionRef.current[id]) != null ? _a2 : 0) + 1;
24290
24411
  reqIdBySessionRef.current[id] = myReq;
24291
24412
  const query = (_b2 = override == null ? void 0 : override.query) != null ? _b2 : s0.query;
24292
24413
  const filters = (_d = (_c2 = override == null ? void 0 : override.filters) != null ? _c2 : s0.effectiveFilters) != null ? _d : s0.filters;
24293
- const search = (_f = override == null ? void 0 : override.search) != null ? _f : buildSearchPayloadFromTarget(
24294
- (_e = getSession(id)) == null ? void 0 : _e.searchTarget
24295
- );
24414
+ const hasSearchOverride = !!override && Object.prototype.hasOwnProperty.call(override, "search");
24415
+ const search = hasSearchOverride ? override.search : (_e = s0.searchPayload) != null ? _e : buildSearchPayloadFromTarget(s0.searchTarget);
24296
24416
  patchSession(id, {
24297
24417
  errorCode: void 0,
24298
24418
  loading: reason !== "refresh",
@@ -24325,7 +24445,7 @@ function ListerProvider(props) {
24325
24445
  details: {
24326
24446
  sessionId: id,
24327
24447
  kind: s3 == null ? void 0 : s3.kind,
24328
- endpoint: (_h = (_g = s3 == null ? void 0 : s3.definition) == null ? void 0 : _g.source) == null ? void 0 : _h.endpoint,
24448
+ endpoint: (_g = (_f = s3 == null ? void 0 : s3.definition) == null ? void 0 : _f.source) == null ? void 0 : _g.endpoint,
24329
24449
  query,
24330
24450
  filters,
24331
24451
  search
@@ -24379,7 +24499,7 @@ function ListerProvider(props) {
24379
24499
  nextPatch,
24380
24500
  spec
24381
24501
  );
24382
- shouldFetch = (spec == null ? void 0 : spec.autoFetch) !== false;
24502
+ shouldFetch = (spec == null ? void 0 : spec.autoFetch) !== false && s4.searchMode !== "local";
24383
24503
  return {
24384
24504
  ...s4,
24385
24505
  filtersPatch: nextPatch,
@@ -24468,7 +24588,7 @@ function ListerProvider(props) {
24468
24588
  );
24469
24589
  const apiOpenAny = React67__namespace.useCallback(
24470
24590
  async (kindOrDef, filters, opts) => {
24471
- var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i;
24591
+ var _a2, _b2, _c2, _d, _e, _f, _g, _h, _i, _j, _k, _l;
24472
24592
  const mode = (_a2 = opts == null ? void 0 : opts.mode) != null ? _a2 : "single";
24473
24593
  try {
24474
24594
  const def = typeof kindOrDef === "string" ? getPreset(kindOrDef) : kindOrDef;
@@ -24491,7 +24611,8 @@ function ListerProvider(props) {
24491
24611
  const pos = anchorToPos(opts == null ? void 0 : opts.anchor);
24492
24612
  const filtersSpec = (_d = opts == null ? void 0 : opts.filtersSpec) != null ? _d : prev == null ? void 0 : prev.filtersSpec;
24493
24613
  const filtersPatch = (_e = prev == null ? void 0 : prev.filtersPatch) != null ? _e : {};
24494
- const selectedFilterValues = (_f = prev == null ? void 0 : prev.selectedFilterValues) != null ? _f : [];
24614
+ const resolvedSearchMode = (_g = (_f = opts == null ? void 0 : opts.searchMode) != null ? _f : prev == null ? void 0 : prev.searchMode) != null ? _g : "remote";
24615
+ const selectedFilterValues = (_h = prev == null ? void 0 : prev.selectedFilterValues) != null ? _h : [];
24495
24616
  const effectiveFilters = computeEffectiveFilters(
24496
24617
  filters,
24497
24618
  filtersPatch,
@@ -24500,9 +24621,9 @@ function ListerProvider(props) {
24500
24621
  const searchSpec = def == null ? void 0 : def.search;
24501
24622
  const defaultCol = searchSpec == null ? void 0 : searchSpec.default;
24502
24623
  const defaultSearchTarget = defaultCol ? { mode: "subject", subject: defaultCol, only: null } : void 0;
24503
- const searchTarget = (_g = prev == null ? void 0 : prev.searchTarget) != null ? _g : defaultSearchTarget;
24504
- const initialQuery = (_i = (_h = opts == null ? void 0 : opts.initialQuery) != null ? _h : prev == null ? void 0 : prev.query) != null ? _i : "";
24505
- const searchPayload = buildSearchPayloadFromTarget(searchTarget);
24624
+ const searchTarget = (_i = prev == null ? void 0 : prev.searchTarget) != null ? _i : defaultSearchTarget;
24625
+ const initialQuery = (_k = (_j = opts == null ? void 0 : opts.initialQuery) != null ? _j : prev == null ? void 0 : prev.query) != null ? _k : "";
24626
+ const searchPayload = (_l = prev == null ? void 0 : prev.searchPayload) != null ? _l : buildSearchPayloadFromTarget(searchTarget);
24506
24627
  const { rawList, optionsList } = await performFetch(
24507
24628
  def,
24508
24629
  effectiveFilters,
@@ -24510,7 +24631,7 @@ function ListerProvider(props) {
24510
24631
  );
24511
24632
  return await new Promise(
24512
24633
  (resolve) => {
24513
- var _a3, _b3, _c3, _d2;
24634
+ var _a3, _b3, _c3;
24514
24635
  const base = initialSessionState(sessionId);
24515
24636
  const nextSession = {
24516
24637
  ...prev ? { ...prev } : base,
@@ -24526,12 +24647,12 @@ function ListerProvider(props) {
24526
24647
  draggable: (_a3 = opts == null ? void 0 : opts.draggable) != null ? _a3 : true,
24527
24648
  position: pos,
24528
24649
  hasMoved: false,
24529
- searchMode: (_b3 = opts == null ? void 0 : opts.searchMode) != null ? _b3 : "remote",
24650
+ searchMode: resolvedSearchMode,
24530
24651
  query: initialQuery,
24531
24652
  searchSpec,
24532
24653
  searchTarget,
24533
- showRefresh: (_c3 = opts == null ? void 0 : opts.showRefresh) != null ? _c3 : false,
24534
- refreshMode: (_d2 = opts == null ? void 0 : opts.refreshMode) != null ? _d2 : "preserve-selection",
24654
+ showRefresh: (_b3 = opts == null ? void 0 : opts.showRefresh) != null ? _b3 : false,
24655
+ refreshMode: (_c3 = opts == null ? void 0 : opts.refreshMode) != null ? _c3 : "preserve-selection",
24535
24656
  // filters
24536
24657
  filtersSpec,
24537
24658
  filtersPatch,
@@ -24749,17 +24870,32 @@ function ListerProvider(props) {
24749
24870
  );
24750
24871
  const setSearchMode = React67__namespace.useCallback(
24751
24872
  (id, mode) => {
24873
+ var _a2;
24874
+ const s3 = getSession(id);
24875
+ if (!s3) return;
24876
+ const prevMode = s3.searchMode;
24752
24877
  patchSession(id, { searchMode: mode });
24878
+ if (prevMode === mode) return;
24879
+ if (mode === "local") {
24880
+ fetchAndHydrate(id, "refresh", {
24881
+ filters: (_a2 = s3.effectiveFilters) != null ? _a2 : s3.filters,
24882
+ query: "",
24883
+ // base fetch (unsearched)
24884
+ search: void 0
24885
+ // force NO search payload
24886
+ });
24887
+ }
24753
24888
  },
24754
- [patchSession]
24889
+ [fetchAndHydrate, getSession, patchSession]
24755
24890
  );
24756
24891
  const scheduleRemoteFetch = React67__namespace.useCallback(
24757
24892
  (id, q2, payloadOverride) => {
24758
24893
  if (timerBySessionRef.current[id])
24759
24894
  clearTimeout(timerBySessionRef.current[id]);
24760
24895
  timerBySessionRef.current[id] = setTimeout(() => {
24896
+ var _a2;
24761
24897
  const s3 = getSession(id);
24762
- const search = payloadOverride != null ? payloadOverride : buildSearchPayloadFromTarget(s3 == null ? void 0 : s3.searchTarget);
24898
+ const search = (_a2 = payloadOverride != null ? payloadOverride : s3 == null ? void 0 : s3.searchPayload) != null ? _a2 : buildSearchPayloadFromTarget(s3 == null ? void 0 : s3.searchTarget);
24763
24899
  fetchAndHydrate(id, "search", { query: q2, search });
24764
24900
  }, debounceMs);
24765
24901
  },
@@ -24768,7 +24904,10 @@ function ListerProvider(props) {
24768
24904
  const setSearchTarget = React67__namespace.useCallback(
24769
24905
  (id, target) => {
24770
24906
  var _a2, _b2;
24771
- patchSession(id, { searchTarget: target });
24907
+ patchSession(id, {
24908
+ searchTarget: target,
24909
+ searchPayload: void 0
24910
+ });
24772
24911
  const s3 = getSession(id);
24773
24912
  const mode = (_a2 = s3 == null ? void 0 : s3.searchMode) != null ? _a2 : "remote";
24774
24913
  const q2 = (_b2 = s3 == null ? void 0 : s3.query) != null ? _b2 : "";
@@ -24780,7 +24919,7 @@ function ListerProvider(props) {
24780
24919
  );
24781
24920
  const searchLocalImpl = React67__namespace.useCallback(
24782
24921
  (id, q2, payload) => {
24783
- patchSession(id, { query: q2 });
24922
+ patchSession(id, { query: q2, searchPayload: payload });
24784
24923
  const s3 = getSession(id);
24785
24924
  if (!s3) return;
24786
24925
  if (s3.searchMode === "hybrid") {
@@ -24791,7 +24930,7 @@ function ListerProvider(props) {
24791
24930
  );
24792
24931
  const searchRemoteImpl = React67__namespace.useCallback(
24793
24932
  (id, q2, payload) => {
24794
- patchSession(id, { query: q2 });
24933
+ patchSession(id, { query: q2, searchPayload: payload });
24795
24934
  scheduleRemoteFetch(id, q2, payload);
24796
24935
  },
24797
24936
  [patchSession, scheduleRemoteFetch]
@@ -24819,13 +24958,30 @@ function ListerProvider(props) {
24819
24958
  );
24820
24959
  const getVisibleOptions = React67__namespace.useCallback(
24821
24960
  (id) => {
24961
+ var _a2, _b2, _c2, _d;
24822
24962
  const s3 = getSession(id);
24823
24963
  if (!s3) return [];
24824
- if (s3.searchMode === "local")
24825
- return filterOptionsLocal(s3.optionsList, s3.query);
24826
- if (s3.searchMode === "hybrid")
24827
- return filterOptionsLocal(s3.optionsList, s3.query);
24828
- return s3.optionsList;
24964
+ if (s3.searchMode === "remote") return s3.optionsList;
24965
+ const def = s3.definition;
24966
+ if (!def) return [];
24967
+ const filters = (_a2 = s3.effectiveFilters) != null ? _a2 : s3.filters;
24968
+ const payload = (_b2 = s3.searchPayload) != null ? _b2 : buildSearchPayloadFromTarget(s3 == null ? void 0 : s3.searchTarget);
24969
+ const visibleRaw = filterRawListLocal(
24970
+ (_c2 = s3.rawList) != null ? _c2 : [],
24971
+ s3.query,
24972
+ payload,
24973
+ filters,
24974
+ {
24975
+ searchSpec: (_d = s3.searchSpec) != null ? _d : def.search,
24976
+ filtersSpec: s3.filtersSpec
24977
+ }
24978
+ );
24979
+ const mapCtx = { query: s3.query, filters };
24980
+ return mapOptions(
24981
+ visibleRaw,
24982
+ def.mapping,
24983
+ mapCtx
24984
+ );
24829
24985
  },
24830
24986
  [getSession]
24831
24987
  );
@@ -24890,50 +25046,6 @@ function ListerProvider(props) {
24890
25046
  );
24891
25047
  return /* @__PURE__ */ jsxRuntime.jsx(Ctx.Provider, { value, children: props.children });
24892
25048
  }
24893
- function useLister() {
24894
- const ctx = React67__namespace.useContext(Ctx);
24895
- if (!ctx)
24896
- throw new Error("useLister must be used within <ListerProvider />");
24897
- const api = React67__namespace.useMemo(() => {
24898
- const fetch = ((kindOrDef, filters, opts) => ctx.apiFetchAny(kindOrDef, filters, opts));
24899
- const open = ((kindOrDef, filters, opts) => ctx.apiOpenAny(kindOrDef, filters, opts));
24900
- return {
24901
- fetch,
24902
- open,
24903
- registerPreset: (kind, def) => ctx.registerPreset(kind, def),
24904
- getPreset: (kind) => ctx.getPreset(kind)
24905
- };
24906
- }, [ctx]);
24907
- const active = ctx.store.activeId ? ctx.store.sessions[ctx.store.activeId] : void 0;
24908
- return {
24909
- api,
24910
- store: ctx.store,
24911
- state: active,
24912
- actions: {
24913
- focus: ctx.focus,
24914
- dispose: ctx.dispose,
24915
- apply: ctx.apply,
24916
- cancel: ctx.cancel,
24917
- close: ctx.close,
24918
- toggle: ctx.toggle,
24919
- select: ctx.select,
24920
- deselect: ctx.deselect,
24921
- clear: ctx.clear,
24922
- setQuery: ctx.setQuery,
24923
- setSearchMode: ctx.setSearchMode,
24924
- setSearchTarget: ctx.setSearchTarget,
24925
- searchLocal: ctx.searchLocal,
24926
- searchRemote: ctx.searchRemote,
24927
- refresh: ctx.refresh,
24928
- setPosition: ctx.setPosition,
24929
- getFilterCtx: ctx.getFilterCtx,
24930
- applyFilterOption: ctx.applyFilterOption,
24931
- registerPreset: ctx.registerPreset,
24932
- getPreset: ctx.getPreset,
24933
- getVisibleOptions: ctx.getVisibleOptions
24934
- }
24935
- };
24936
- }
24937
25049
  function asArray(v2) {
24938
25050
  if (v2 == null) return [];
24939
25051
  return Array.isArray(v2) ? v2 : [v2];
@@ -25416,7 +25528,7 @@ function SearchBar(props) {
25416
25528
  {
25417
25529
  variant: "select",
25418
25530
  mode: "button",
25419
- value: searchMode,
25531
+ defaultValue: searchMode,
25420
25532
  triggerClassName: "border-none ring-0 shadow-none! px-1! cursor-pointer",
25421
25533
  options: [
25422
25534
  {
@@ -25562,6 +25674,50 @@ function FooterBar(props) {
25562
25674
  }
25563
25675
  );
25564
25676
  }
25677
+ function useLister() {
25678
+ const ctx = React67__namespace.useContext(Ctx);
25679
+ if (!ctx)
25680
+ throw new Error("useLister must be used within <ListerProvider />");
25681
+ const api = React67__namespace.useMemo(() => {
25682
+ const fetch = ((kindOrDef, filters, opts) => ctx.apiFetchAny(kindOrDef, filters, opts));
25683
+ const open = ((kindOrDef, filters, opts) => ctx.apiOpenAny(kindOrDef, filters, opts));
25684
+ return {
25685
+ fetch,
25686
+ open,
25687
+ registerPreset: (kind, def) => ctx.registerPreset(kind, def),
25688
+ getPreset: (kind) => ctx.getPreset(kind)
25689
+ };
25690
+ }, [ctx]);
25691
+ const active = ctx.store.activeId ? ctx.store.sessions[ctx.store.activeId] : void 0;
25692
+ return {
25693
+ api,
25694
+ store: ctx.store,
25695
+ state: active,
25696
+ actions: {
25697
+ focus: ctx.focus,
25698
+ dispose: ctx.dispose,
25699
+ apply: ctx.apply,
25700
+ cancel: ctx.cancel,
25701
+ close: ctx.close,
25702
+ toggle: ctx.toggle,
25703
+ select: ctx.select,
25704
+ deselect: ctx.deselect,
25705
+ clear: ctx.clear,
25706
+ setQuery: ctx.setQuery,
25707
+ setSearchMode: ctx.setSearchMode,
25708
+ setSearchTarget: ctx.setSearchTarget,
25709
+ searchLocal: ctx.searchLocal,
25710
+ searchRemote: ctx.searchRemote,
25711
+ refresh: ctx.refresh,
25712
+ setPosition: ctx.setPosition,
25713
+ getFilterCtx: ctx.getFilterCtx,
25714
+ applyFilterOption: ctx.applyFilterOption,
25715
+ registerPreset: ctx.registerPreset,
25716
+ getPreset: ctx.getPreset,
25717
+ getVisibleOptions: ctx.getVisibleOptions
25718
+ }
25719
+ };
25720
+ }
25565
25721
  function pick(raw, keyOrFn, ctx) {
25566
25722
  if (!keyOrFn) return void 0;
25567
25723
  if (typeof keyOrFn === "function") return keyOrFn(raw, ctx);