@dev-fastn-ai/react-core 2.3.2 → 2.3.4

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.cjs.js CHANGED
@@ -1738,666 +1738,6 @@ const useConnectors = () => {
1738
1738
  return query;
1739
1739
  };
1740
1740
 
1741
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
1742
-
1743
- function getDefaultExportFromCjs (x) {
1744
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1745
- }
1746
-
1747
- /**
1748
- * Checks if `value` is the
1749
- * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1750
- * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1751
- *
1752
- * @static
1753
- * @memberOf _
1754
- * @since 0.1.0
1755
- * @category Lang
1756
- * @param {*} value The value to check.
1757
- * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1758
- * @example
1759
- *
1760
- * _.isObject({});
1761
- * // => true
1762
- *
1763
- * _.isObject([1, 2, 3]);
1764
- * // => true
1765
- *
1766
- * _.isObject(_.noop);
1767
- * // => true
1768
- *
1769
- * _.isObject(null);
1770
- * // => false
1771
- */
1772
-
1773
- var isObject_1;
1774
- var hasRequiredIsObject;
1775
-
1776
- function requireIsObject () {
1777
- if (hasRequiredIsObject) return isObject_1;
1778
- hasRequiredIsObject = 1;
1779
- function isObject(value) {
1780
- var type = typeof value;
1781
- return value != null && (type == 'object' || type == 'function');
1782
- }
1783
-
1784
- isObject_1 = isObject;
1785
- return isObject_1;
1786
- }
1787
-
1788
- /** Detect free variable `global` from Node.js. */
1789
-
1790
- var _freeGlobal;
1791
- var hasRequired_freeGlobal;
1792
-
1793
- function require_freeGlobal () {
1794
- if (hasRequired_freeGlobal) return _freeGlobal;
1795
- hasRequired_freeGlobal = 1;
1796
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
1797
-
1798
- _freeGlobal = freeGlobal;
1799
- return _freeGlobal;
1800
- }
1801
-
1802
- var _root;
1803
- var hasRequired_root;
1804
-
1805
- function require_root () {
1806
- if (hasRequired_root) return _root;
1807
- hasRequired_root = 1;
1808
- var freeGlobal = require_freeGlobal();
1809
-
1810
- /** Detect free variable `self`. */
1811
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
1812
-
1813
- /** Used as a reference to the global object. */
1814
- var root = freeGlobal || freeSelf || Function('return this')();
1815
-
1816
- _root = root;
1817
- return _root;
1818
- }
1819
-
1820
- var now_1;
1821
- var hasRequiredNow;
1822
-
1823
- function requireNow () {
1824
- if (hasRequiredNow) return now_1;
1825
- hasRequiredNow = 1;
1826
- var root = require_root();
1827
-
1828
- /**
1829
- * Gets the timestamp of the number of milliseconds that have elapsed since
1830
- * the Unix epoch (1 January 1970 00:00:00 UTC).
1831
- *
1832
- * @static
1833
- * @memberOf _
1834
- * @since 2.4.0
1835
- * @category Date
1836
- * @returns {number} Returns the timestamp.
1837
- * @example
1838
- *
1839
- * _.defer(function(stamp) {
1840
- * console.log(_.now() - stamp);
1841
- * }, _.now());
1842
- * // => Logs the number of milliseconds it took for the deferred invocation.
1843
- */
1844
- var now = function() {
1845
- return root.Date.now();
1846
- };
1847
-
1848
- now_1 = now;
1849
- return now_1;
1850
- }
1851
-
1852
- /** Used to match a single whitespace character. */
1853
-
1854
- var _trimmedEndIndex;
1855
- var hasRequired_trimmedEndIndex;
1856
-
1857
- function require_trimmedEndIndex () {
1858
- if (hasRequired_trimmedEndIndex) return _trimmedEndIndex;
1859
- hasRequired_trimmedEndIndex = 1;
1860
- var reWhitespace = /\s/;
1861
-
1862
- /**
1863
- * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
1864
- * character of `string`.
1865
- *
1866
- * @private
1867
- * @param {string} string The string to inspect.
1868
- * @returns {number} Returns the index of the last non-whitespace character.
1869
- */
1870
- function trimmedEndIndex(string) {
1871
- var index = string.length;
1872
-
1873
- while (index-- && reWhitespace.test(string.charAt(index))) {}
1874
- return index;
1875
- }
1876
-
1877
- _trimmedEndIndex = trimmedEndIndex;
1878
- return _trimmedEndIndex;
1879
- }
1880
-
1881
- var _baseTrim;
1882
- var hasRequired_baseTrim;
1883
-
1884
- function require_baseTrim () {
1885
- if (hasRequired_baseTrim) return _baseTrim;
1886
- hasRequired_baseTrim = 1;
1887
- var trimmedEndIndex = require_trimmedEndIndex();
1888
-
1889
- /** Used to match leading whitespace. */
1890
- var reTrimStart = /^\s+/;
1891
-
1892
- /**
1893
- * The base implementation of `_.trim`.
1894
- *
1895
- * @private
1896
- * @param {string} string The string to trim.
1897
- * @returns {string} Returns the trimmed string.
1898
- */
1899
- function baseTrim(string) {
1900
- return string
1901
- ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
1902
- : string;
1903
- }
1904
-
1905
- _baseTrim = baseTrim;
1906
- return _baseTrim;
1907
- }
1908
-
1909
- var _Symbol;
1910
- var hasRequired_Symbol;
1911
-
1912
- function require_Symbol () {
1913
- if (hasRequired_Symbol) return _Symbol;
1914
- hasRequired_Symbol = 1;
1915
- var root = require_root();
1916
-
1917
- /** Built-in value references. */
1918
- var Symbol = root.Symbol;
1919
-
1920
- _Symbol = Symbol;
1921
- return _Symbol;
1922
- }
1923
-
1924
- var _getRawTag;
1925
- var hasRequired_getRawTag;
1926
-
1927
- function require_getRawTag () {
1928
- if (hasRequired_getRawTag) return _getRawTag;
1929
- hasRequired_getRawTag = 1;
1930
- var Symbol = require_Symbol();
1931
-
1932
- /** Used for built-in method references. */
1933
- var objectProto = Object.prototype;
1934
-
1935
- /** Used to check objects for own properties. */
1936
- var hasOwnProperty = objectProto.hasOwnProperty;
1937
-
1938
- /**
1939
- * Used to resolve the
1940
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1941
- * of values.
1942
- */
1943
- var nativeObjectToString = objectProto.toString;
1944
-
1945
- /** Built-in value references. */
1946
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
1947
-
1948
- /**
1949
- * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1950
- *
1951
- * @private
1952
- * @param {*} value The value to query.
1953
- * @returns {string} Returns the raw `toStringTag`.
1954
- */
1955
- function getRawTag(value) {
1956
- var isOwn = hasOwnProperty.call(value, symToStringTag),
1957
- tag = value[symToStringTag];
1958
-
1959
- try {
1960
- value[symToStringTag] = undefined;
1961
- var unmasked = true;
1962
- } catch (e) {}
1963
-
1964
- var result = nativeObjectToString.call(value);
1965
- if (unmasked) {
1966
- if (isOwn) {
1967
- value[symToStringTag] = tag;
1968
- } else {
1969
- delete value[symToStringTag];
1970
- }
1971
- }
1972
- return result;
1973
- }
1974
-
1975
- _getRawTag = getRawTag;
1976
- return _getRawTag;
1977
- }
1978
-
1979
- /** Used for built-in method references. */
1980
-
1981
- var _objectToString;
1982
- var hasRequired_objectToString;
1983
-
1984
- function require_objectToString () {
1985
- if (hasRequired_objectToString) return _objectToString;
1986
- hasRequired_objectToString = 1;
1987
- var objectProto = Object.prototype;
1988
-
1989
- /**
1990
- * Used to resolve the
1991
- * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1992
- * of values.
1993
- */
1994
- var nativeObjectToString = objectProto.toString;
1995
-
1996
- /**
1997
- * Converts `value` to a string using `Object.prototype.toString`.
1998
- *
1999
- * @private
2000
- * @param {*} value The value to convert.
2001
- * @returns {string} Returns the converted string.
2002
- */
2003
- function objectToString(value) {
2004
- return nativeObjectToString.call(value);
2005
- }
2006
-
2007
- _objectToString = objectToString;
2008
- return _objectToString;
2009
- }
2010
-
2011
- var _baseGetTag;
2012
- var hasRequired_baseGetTag;
2013
-
2014
- function require_baseGetTag () {
2015
- if (hasRequired_baseGetTag) return _baseGetTag;
2016
- hasRequired_baseGetTag = 1;
2017
- var Symbol = require_Symbol(),
2018
- getRawTag = require_getRawTag(),
2019
- objectToString = require_objectToString();
2020
-
2021
- /** `Object#toString` result references. */
2022
- var nullTag = '[object Null]',
2023
- undefinedTag = '[object Undefined]';
2024
-
2025
- /** Built-in value references. */
2026
- var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
2027
-
2028
- /**
2029
- * The base implementation of `getTag` without fallbacks for buggy environments.
2030
- *
2031
- * @private
2032
- * @param {*} value The value to query.
2033
- * @returns {string} Returns the `toStringTag`.
2034
- */
2035
- function baseGetTag(value) {
2036
- if (value == null) {
2037
- return value === undefined ? undefinedTag : nullTag;
2038
- }
2039
- return (symToStringTag && symToStringTag in Object(value))
2040
- ? getRawTag(value)
2041
- : objectToString(value);
2042
- }
2043
-
2044
- _baseGetTag = baseGetTag;
2045
- return _baseGetTag;
2046
- }
2047
-
2048
- /**
2049
- * Checks if `value` is object-like. A value is object-like if it's not `null`
2050
- * and has a `typeof` result of "object".
2051
- *
2052
- * @static
2053
- * @memberOf _
2054
- * @since 4.0.0
2055
- * @category Lang
2056
- * @param {*} value The value to check.
2057
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
2058
- * @example
2059
- *
2060
- * _.isObjectLike({});
2061
- * // => true
2062
- *
2063
- * _.isObjectLike([1, 2, 3]);
2064
- * // => true
2065
- *
2066
- * _.isObjectLike(_.noop);
2067
- * // => false
2068
- *
2069
- * _.isObjectLike(null);
2070
- * // => false
2071
- */
2072
-
2073
- var isObjectLike_1;
2074
- var hasRequiredIsObjectLike;
2075
-
2076
- function requireIsObjectLike () {
2077
- if (hasRequiredIsObjectLike) return isObjectLike_1;
2078
- hasRequiredIsObjectLike = 1;
2079
- function isObjectLike(value) {
2080
- return value != null && typeof value == 'object';
2081
- }
2082
-
2083
- isObjectLike_1 = isObjectLike;
2084
- return isObjectLike_1;
2085
- }
2086
-
2087
- var isSymbol_1;
2088
- var hasRequiredIsSymbol;
2089
-
2090
- function requireIsSymbol () {
2091
- if (hasRequiredIsSymbol) return isSymbol_1;
2092
- hasRequiredIsSymbol = 1;
2093
- var baseGetTag = require_baseGetTag(),
2094
- isObjectLike = requireIsObjectLike();
2095
-
2096
- /** `Object#toString` result references. */
2097
- var symbolTag = '[object Symbol]';
2098
-
2099
- /**
2100
- * Checks if `value` is classified as a `Symbol` primitive or object.
2101
- *
2102
- * @static
2103
- * @memberOf _
2104
- * @since 4.0.0
2105
- * @category Lang
2106
- * @param {*} value The value to check.
2107
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
2108
- * @example
2109
- *
2110
- * _.isSymbol(Symbol.iterator);
2111
- * // => true
2112
- *
2113
- * _.isSymbol('abc');
2114
- * // => false
2115
- */
2116
- function isSymbol(value) {
2117
- return typeof value == 'symbol' ||
2118
- (isObjectLike(value) && baseGetTag(value) == symbolTag);
2119
- }
2120
-
2121
- isSymbol_1 = isSymbol;
2122
- return isSymbol_1;
2123
- }
2124
-
2125
- var toNumber_1;
2126
- var hasRequiredToNumber;
2127
-
2128
- function requireToNumber () {
2129
- if (hasRequiredToNumber) return toNumber_1;
2130
- hasRequiredToNumber = 1;
2131
- var baseTrim = require_baseTrim(),
2132
- isObject = requireIsObject(),
2133
- isSymbol = requireIsSymbol();
2134
-
2135
- /** Used as references for various `Number` constants. */
2136
- var NAN = 0 / 0;
2137
-
2138
- /** Used to detect bad signed hexadecimal string values. */
2139
- var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
2140
-
2141
- /** Used to detect binary string values. */
2142
- var reIsBinary = /^0b[01]+$/i;
2143
-
2144
- /** Used to detect octal string values. */
2145
- var reIsOctal = /^0o[0-7]+$/i;
2146
-
2147
- /** Built-in method references without a dependency on `root`. */
2148
- var freeParseInt = parseInt;
2149
-
2150
- /**
2151
- * Converts `value` to a number.
2152
- *
2153
- * @static
2154
- * @memberOf _
2155
- * @since 4.0.0
2156
- * @category Lang
2157
- * @param {*} value The value to process.
2158
- * @returns {number} Returns the number.
2159
- * @example
2160
- *
2161
- * _.toNumber(3.2);
2162
- * // => 3.2
2163
- *
2164
- * _.toNumber(Number.MIN_VALUE);
2165
- * // => 5e-324
2166
- *
2167
- * _.toNumber(Infinity);
2168
- * // => Infinity
2169
- *
2170
- * _.toNumber('3.2');
2171
- * // => 3.2
2172
- */
2173
- function toNumber(value) {
2174
- if (typeof value == 'number') {
2175
- return value;
2176
- }
2177
- if (isSymbol(value)) {
2178
- return NAN;
2179
- }
2180
- if (isObject(value)) {
2181
- var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
2182
- value = isObject(other) ? (other + '') : other;
2183
- }
2184
- if (typeof value != 'string') {
2185
- return value === 0 ? value : +value;
2186
- }
2187
- value = baseTrim(value);
2188
- var isBinary = reIsBinary.test(value);
2189
- return (isBinary || reIsOctal.test(value))
2190
- ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
2191
- : (reIsBadHex.test(value) ? NAN : +value);
2192
- }
2193
-
2194
- toNumber_1 = toNumber;
2195
- return toNumber_1;
2196
- }
2197
-
2198
- var debounce_1;
2199
- var hasRequiredDebounce;
2200
-
2201
- function requireDebounce () {
2202
- if (hasRequiredDebounce) return debounce_1;
2203
- hasRequiredDebounce = 1;
2204
- var isObject = requireIsObject(),
2205
- now = requireNow(),
2206
- toNumber = requireToNumber();
2207
-
2208
- /** Error message constants. */
2209
- var FUNC_ERROR_TEXT = 'Expected a function';
2210
-
2211
- /* Built-in method references for those with the same name as other `lodash` methods. */
2212
- var nativeMax = Math.max,
2213
- nativeMin = Math.min;
2214
-
2215
- /**
2216
- * Creates a debounced function that delays invoking `func` until after `wait`
2217
- * milliseconds have elapsed since the last time the debounced function was
2218
- * invoked. The debounced function comes with a `cancel` method to cancel
2219
- * delayed `func` invocations and a `flush` method to immediately invoke them.
2220
- * Provide `options` to indicate whether `func` should be invoked on the
2221
- * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
2222
- * with the last arguments provided to the debounced function. Subsequent
2223
- * calls to the debounced function return the result of the last `func`
2224
- * invocation.
2225
- *
2226
- * **Note:** If `leading` and `trailing` options are `true`, `func` is
2227
- * invoked on the trailing edge of the timeout only if the debounced function
2228
- * is invoked more than once during the `wait` timeout.
2229
- *
2230
- * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
2231
- * until to the next tick, similar to `setTimeout` with a timeout of `0`.
2232
- *
2233
- * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
2234
- * for details over the differences between `_.debounce` and `_.throttle`.
2235
- *
2236
- * @static
2237
- * @memberOf _
2238
- * @since 0.1.0
2239
- * @category Function
2240
- * @param {Function} func The function to debounce.
2241
- * @param {number} [wait=0] The number of milliseconds to delay.
2242
- * @param {Object} [options={}] The options object.
2243
- * @param {boolean} [options.leading=false]
2244
- * Specify invoking on the leading edge of the timeout.
2245
- * @param {number} [options.maxWait]
2246
- * The maximum time `func` is allowed to be delayed before it's invoked.
2247
- * @param {boolean} [options.trailing=true]
2248
- * Specify invoking on the trailing edge of the timeout.
2249
- * @returns {Function} Returns the new debounced function.
2250
- * @example
2251
- *
2252
- * // Avoid costly calculations while the window size is in flux.
2253
- * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
2254
- *
2255
- * // Invoke `sendMail` when clicked, debouncing subsequent calls.
2256
- * jQuery(element).on('click', _.debounce(sendMail, 300, {
2257
- * 'leading': true,
2258
- * 'trailing': false
2259
- * }));
2260
- *
2261
- * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
2262
- * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
2263
- * var source = new EventSource('/stream');
2264
- * jQuery(source).on('message', debounced);
2265
- *
2266
- * // Cancel the trailing debounced invocation.
2267
- * jQuery(window).on('popstate', debounced.cancel);
2268
- */
2269
- function debounce(func, wait, options) {
2270
- var lastArgs,
2271
- lastThis,
2272
- maxWait,
2273
- result,
2274
- timerId,
2275
- lastCallTime,
2276
- lastInvokeTime = 0,
2277
- leading = false,
2278
- maxing = false,
2279
- trailing = true;
2280
-
2281
- if (typeof func != 'function') {
2282
- throw new TypeError(FUNC_ERROR_TEXT);
2283
- }
2284
- wait = toNumber(wait) || 0;
2285
- if (isObject(options)) {
2286
- leading = !!options.leading;
2287
- maxing = 'maxWait' in options;
2288
- maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
2289
- trailing = 'trailing' in options ? !!options.trailing : trailing;
2290
- }
2291
-
2292
- function invokeFunc(time) {
2293
- var args = lastArgs,
2294
- thisArg = lastThis;
2295
-
2296
- lastArgs = lastThis = undefined;
2297
- lastInvokeTime = time;
2298
- result = func.apply(thisArg, args);
2299
- return result;
2300
- }
2301
-
2302
- function leadingEdge(time) {
2303
- // Reset any `maxWait` timer.
2304
- lastInvokeTime = time;
2305
- // Start the timer for the trailing edge.
2306
- timerId = setTimeout(timerExpired, wait);
2307
- // Invoke the leading edge.
2308
- return leading ? invokeFunc(time) : result;
2309
- }
2310
-
2311
- function remainingWait(time) {
2312
- var timeSinceLastCall = time - lastCallTime,
2313
- timeSinceLastInvoke = time - lastInvokeTime,
2314
- timeWaiting = wait - timeSinceLastCall;
2315
-
2316
- return maxing
2317
- ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
2318
- : timeWaiting;
2319
- }
2320
-
2321
- function shouldInvoke(time) {
2322
- var timeSinceLastCall = time - lastCallTime,
2323
- timeSinceLastInvoke = time - lastInvokeTime;
2324
-
2325
- // Either this is the first call, activity has stopped and we're at the
2326
- // trailing edge, the system time has gone backwards and we're treating
2327
- // it as the trailing edge, or we've hit the `maxWait` limit.
2328
- return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
2329
- (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
2330
- }
2331
-
2332
- function timerExpired() {
2333
- var time = now();
2334
- if (shouldInvoke(time)) {
2335
- return trailingEdge(time);
2336
- }
2337
- // Restart the timer.
2338
- timerId = setTimeout(timerExpired, remainingWait(time));
2339
- }
2340
-
2341
- function trailingEdge(time) {
2342
- timerId = undefined;
2343
-
2344
- // Only invoke if we have `lastArgs` which means `func` has been
2345
- // debounced at least once.
2346
- if (trailing && lastArgs) {
2347
- return invokeFunc(time);
2348
- }
2349
- lastArgs = lastThis = undefined;
2350
- return result;
2351
- }
2352
-
2353
- function cancel() {
2354
- if (timerId !== undefined) {
2355
- clearTimeout(timerId);
2356
- }
2357
- lastInvokeTime = 0;
2358
- lastArgs = lastCallTime = lastThis = timerId = undefined;
2359
- }
2360
-
2361
- function flush() {
2362
- return timerId === undefined ? result : trailingEdge(now());
2363
- }
2364
-
2365
- function debounced() {
2366
- var time = now(),
2367
- isInvoking = shouldInvoke(time);
2368
-
2369
- lastArgs = arguments;
2370
- lastThis = this;
2371
- lastCallTime = time;
2372
-
2373
- if (isInvoking) {
2374
- if (timerId === undefined) {
2375
- return leadingEdge(lastCallTime);
2376
- }
2377
- if (maxing) {
2378
- // Handle invocations in a tight loop.
2379
- clearTimeout(timerId);
2380
- timerId = setTimeout(timerExpired, wait);
2381
- return invokeFunc(lastCallTime);
2382
- }
2383
- }
2384
- if (timerId === undefined) {
2385
- timerId = setTimeout(timerExpired, wait);
2386
- }
2387
- return result;
2388
- }
2389
- debounced.cancel = cancel;
2390
- debounced.flush = flush;
2391
- return debounced;
2392
- }
2393
-
2394
- debounce_1 = debounce;
2395
- return debounce_1;
2396
- }
2397
-
2398
- var debounceExports = requireDebounce();
2399
- var debounce = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);
2400
-
2401
1741
  /**
2402
1742
  * Custom hook to manage async select field options with search, pagination, and error handling using React Query.
2403
1743
  *
@@ -2422,13 +1762,13 @@ var debounce = /*@__PURE__*/getDefaultExportFromCjs(debounceExports);
2422
1762
  * ```
2423
1763
  */
2424
1764
  function useFieldOptions(field) {
2425
- var _a, _b, _c, _d, _e, _f, _g;
1765
+ var _a, _b, _c, _d, _e, _f;
2426
1766
  const [searchQuery, setSearchQuery] = react.useState("");
2427
1767
  const queryClient = reactQuery.useQueryClient();
2428
1768
  // Generate a unique query key for this field
2429
1769
  const queryKey = react.useMemo(() => {
2430
1770
  return ["field-options", field.key, field.name];
2431
- }, [field.key, field.name, searchQuery]);
1771
+ }, [field.key, field.name]);
2432
1772
  // Initial fetch query for static options or first page
2433
1773
  const initialQuery = reactQuery.useQuery({
2434
1774
  queryKey: [...queryKey, "initial"],
@@ -2445,16 +1785,12 @@ function useFieldOptions(field) {
2445
1785
  type: "OFFSET",
2446
1786
  hasNextPage: false,
2447
1787
  };
2448
- return await field.optionsSource.getOptions(pagination, {}, searchQuery);
1788
+ return await field.optionsSource.getOptions(pagination, {});
2449
1789
  },
2450
1790
  enabled: !!((_a = field.optionsSource) === null || _a === void 0 ? void 0 : _a.getOptions),
2451
1791
  staleTime: 1000 * 60 * 5, // 5 minutes
2452
1792
  gcTime: 1000 * 60 * 10, // 10 minutes (formerly cacheTime)
2453
1793
  });
2454
- // Create debounced search function for server-side search
2455
- const debouncedSetSearch = react.useMemo(() => debounce((query) => {
2456
- setSearchQuery(query);
2457
- }, 800), []);
2458
1794
  // Infinite query for pagination
2459
1795
  const infiniteQuery = reactQuery.useInfiniteQuery({
2460
1796
  queryKey: [...queryKey, "infinite"],
@@ -2480,43 +1816,35 @@ function useFieldOptions(field) {
2480
1816
  staleTime: 1000 * 60 * 5, // 5 minutes
2481
1817
  gcTime: 1000 * 60 * 10, // 10 minutes
2482
1818
  });
2483
- // Combine all options from initial query and infinite query with deduplication
1819
+ // Combine all options from initial query and infinite query
2484
1820
  const allOptions = react.useMemo(() => {
2485
1821
  var _a, _b;
2486
- const optionsMap = new Map();
1822
+ const options = [];
2487
1823
  // Add initial options
2488
1824
  if ((_a = initialQuery.data) === null || _a === void 0 ? void 0 : _a.options) {
2489
- initialQuery.data.options.forEach((option) => {
2490
- optionsMap.set(option.value, option);
2491
- });
1825
+ options.push(...initialQuery.data.options);
2492
1826
  }
2493
1827
  // Add paginated options
2494
1828
  if ((_b = infiniteQuery.data) === null || _b === void 0 ? void 0 : _b.pages) {
2495
1829
  infiniteQuery.data.pages.forEach((page) => {
2496
1830
  if (page.options) {
2497
- page.options.forEach((option) => {
2498
- optionsMap.set(option.value, option);
2499
- });
1831
+ options.push(...page.options);
2500
1832
  }
2501
1833
  });
2502
1834
  }
2503
- return Array.from(optionsMap.values());
1835
+ return options;
2504
1836
  }, [initialQuery.data, infiniteQuery.data]);
2505
- // Filter options by query (client-side filtering only when not searchable)
1837
+ // Filter options by query (client-side filtering)
2506
1838
  const filteredOptions = react.useMemo(() => {
2507
- var _a;
2508
- if (!((_a = initialQuery.data) === null || _a === void 0 ? void 0 : _a.searchable) && searchQuery) {
2509
- // Only do client-side filtering when not searchable
2510
- return allOptions.filter((option) => option.label.toLowerCase().includes(searchQuery.toLowerCase()));
2511
- }
2512
- // When searchable is true, use the server-filtered results directly
2513
- return allOptions;
2514
- }, [allOptions, searchQuery, (_e = initialQuery.data) === null || _e === void 0 ? void 0 : _e.searchable]);
1839
+ // For now, we'll do client-side filtering
1840
+ // In a real implementation, you might want to use the searchOptions function
1841
+ // and create a separate query for search results
1842
+ return allOptions.filter((option) => option.label.toLowerCase().includes(searchQuery.toLowerCase()));
1843
+ }, [allOptions, searchQuery]);
2515
1844
  // Search handler
2516
1845
  const search = react.useCallback((query) => {
2517
- // Always use debounced search to prevent rapid state updates
2518
- debouncedSetSearch(query);
2519
- }, [debouncedSetSearch]);
1846
+ setSearchQuery(query);
1847
+ }, []);
2520
1848
  // Load more handler
2521
1849
  const loadMore = react.useCallback(async () => {
2522
1850
  if (infiniteQuery.hasNextPage && !infiniteQuery.isFetchingNextPage) {
@@ -2565,7 +1893,7 @@ function useFieldOptions(field) {
2565
1893
  search,
2566
1894
  loadMore,
2567
1895
  totalLoadedOptions: allOptions.length,
2568
- error: ((_f = initialQuery.error) === null || _f === void 0 ? void 0 : _f.message) || ((_g = infiniteQuery.error) === null || _g === void 0 ? void 0 : _g.message) || null,
1896
+ error: ((_e = initialQuery.error) === null || _e === void 0 ? void 0 : _e.message) || ((_f = infiniteQuery.error) === null || _f === void 0 ? void 0 : _f.message) || null,
2569
1897
  };
2570
1898
  }
2571
1899