@ram_28/kf-ai-sdk 1.0.13 → 1.0.15

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.
@@ -203,43 +203,33 @@ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnTy
203
203
  // ADD OPERATIONS
204
204
  // ============================================================
205
205
 
206
- const add = useCallback((condition: Omit<ConditionType, "id">): string => {
207
- const id = generateId();
208
- const newCondition: ConditionType = { ...condition, id };
209
- setItems((prev) => [...prev, newCondition]);
210
- return id;
211
- }, []);
212
-
213
- const addGroup = useCallback((groupOperator: ConditionGroupOperatorType): string => {
214
- const id = generateId();
215
- const newGroup: ConditionGroupType = {
216
- id,
217
- Operator: groupOperator,
218
- Condition: [],
219
- };
220
- setItems((prev) => [...prev, newGroup]);
221
- return id;
222
- }, []);
223
-
224
- const addTo = useCallback(
225
- (parentId: string, condition: Omit<ConditionType, "id">): string => {
206
+ const addCondition = useCallback(
207
+ (condition: Omit<ConditionType, "id">, parentId?: string): string => {
226
208
  const id = generateId();
227
209
  const newCondition: ConditionType = { ...condition, id };
228
- setItems((prev) => addToParent(prev, parentId, newCondition));
210
+ if (parentId) {
211
+ setItems((prev) => addToParent(prev, parentId, newCondition));
212
+ } else {
213
+ setItems((prev) => [...prev, newCondition]);
214
+ }
229
215
  return id;
230
216
  },
231
217
  []
232
218
  );
233
219
 
234
- const addGroupTo = useCallback(
235
- (parentId: string, groupOperator: ConditionGroupOperatorType): string => {
220
+ const addConditionGroup = useCallback(
221
+ (groupOperator: ConditionGroupOperatorType, parentId?: string): string => {
236
222
  const id = generateId();
237
223
  const newGroup: ConditionGroupType = {
238
224
  id,
239
225
  Operator: groupOperator,
240
226
  Condition: [],
241
227
  };
242
- setItems((prev) => addToParent(prev, parentId, newGroup));
228
+ if (parentId) {
229
+ setItems((prev) => addToParent(prev, parentId, newGroup));
230
+ } else {
231
+ setItems((prev) => [...prev, newGroup]);
232
+ }
243
233
  return id;
244
234
  },
245
235
  []
@@ -249,7 +239,7 @@ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnTy
249
239
  // UPDATE OPERATIONS
250
240
  // ============================================================
251
241
 
252
- const update = useCallback(
242
+ const updateCondition = useCallback(
253
243
  (id: string, updates: Partial<Omit<ConditionType, "id">>): void => {
254
244
  setItems((prev) =>
255
245
  updateInTree(prev, id, (item) => {
@@ -263,7 +253,7 @@ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnTy
263
253
  []
264
254
  );
265
255
 
266
- const updateOperator = useCallback(
256
+ const updateGroupOperator = useCallback(
267
257
  (id: string, newOperator: ConditionGroupOperatorType): void => {
268
258
  setItems((prev) =>
269
259
  updateInTree(prev, id, (item) => {
@@ -281,11 +271,11 @@ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnTy
281
271
  // REMOVE & ACCESS
282
272
  // ============================================================
283
273
 
284
- const remove = useCallback((id: string): void => {
274
+ const removeCondition = useCallback((id: string): void => {
285
275
  setItems((prev) => removeFromTree(prev, id));
286
276
  }, []);
287
277
 
288
- const get = useCallback(
278
+ const getCondition = useCallback(
289
279
  (id: string): ConditionType | ConditionGroupType | undefined => {
290
280
  return findById(items, id);
291
281
  },
@@ -296,11 +286,11 @@ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnTy
296
286
  // UTILITY
297
287
  // ============================================================
298
288
 
299
- const clear = useCallback((): void => {
289
+ const clearAllConditions = useCallback((): void => {
300
290
  setItems([]);
301
291
  }, []);
302
292
 
303
- const setOperator = useCallback((op: ConditionGroupOperatorType): void => {
293
+ const setRootOperator = useCallback((op: ConditionGroupOperatorType): void => {
304
294
  setOperatorState(op);
305
295
  }, []);
306
296
 
@@ -316,21 +306,19 @@ export function useFilter(options: UseFilterOptionsType = {}): UseFilterReturnTy
316
306
  hasConditions,
317
307
 
318
308
  // Add operations
319
- add,
320
- addGroup,
321
- addTo,
322
- addGroupTo,
309
+ addCondition,
310
+ addConditionGroup,
323
311
 
324
312
  // Update operations
325
- update,
326
- updateOperator,
313
+ updateCondition,
314
+ updateGroupOperator,
327
315
 
328
316
  // Remove & access
329
- remove,
330
- get,
317
+ removeCondition,
318
+ getCondition,
331
319
 
332
320
  // Utility
333
- clear,
334
- setOperator,
321
+ clearAllConditions,
322
+ setRootOperator,
335
323
  };
336
324
  }
@@ -1,30 +0,0 @@
1
- "use strict";const Se=require("react");var X={exports:{}},k={};/**
2
- * @license React
3
- * react-jsx-runtime.production.min.js
4
- *
5
- * Copyright (c) Facebook, Inc. and its affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Te;function lr(){if(Te)return k;Te=1;var V=Se,C=Symbol.for("react.element"),M=Symbol.for("react.fragment"),m=Object.prototype.hasOwnProperty,F=V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,A={key:!0,ref:!0,__self:!0,__source:!0};function w(_,f,T){var p,E={},b=null,I=null;T!==void 0&&(b=""+T),f.key!==void 0&&(b=""+f.key),f.ref!==void 0&&(I=f.ref);for(p in f)m.call(f,p)&&!A.hasOwnProperty(p)&&(E[p]=f[p]);if(_&&_.defaultProps)for(p in f=_.defaultProps,f)E[p]===void 0&&(E[p]=f[p]);return{$$typeof:C,type:_,key:b,ref:I,props:E,_owner:F.current}}return k.Fragment=M,k.jsx=w,k.jsxs=w,k}var D={};/**
10
- * @license React
11
- * react-jsx-runtime.development.js
12
- *
13
- * Copyright (c) Facebook, Inc. and its affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var Oe;function fr(){return Oe||(Oe=1,process.env.NODE_ENV!=="production"&&function(){var V=Se,C=Symbol.for("react.element"),M=Symbol.for("react.portal"),m=Symbol.for("react.fragment"),F=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),w=Symbol.for("react.provider"),_=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),T=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),I=Symbol.for("react.offscreen"),H=Symbol.iterator,Pe="@@iterator";function Ce(e){if(e===null||typeof e!="object")return null;var r=H&&e[H]||e[Pe];return typeof r=="function"?r:null}var O=V.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function c(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];we("error",e,t)}}function we(e,r,t){{var n=O.ReactDebugCurrentFrame,o=n.getStackAddendum();o!==""&&(r+="%s",t=t.concat([o]));var u=t.map(function(i){return String(i)});u.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,u)}}var je=!1,xe=!1,ke=!1,De=!1,Fe=!1,Z;Z=Symbol.for("react.module.reference");function Ae(e){return!!(typeof e=="string"||typeof e=="function"||e===m||e===A||Fe||e===F||e===T||e===p||De||e===I||je||xe||ke||typeof e=="object"&&e!==null&&(e.$$typeof===b||e.$$typeof===E||e.$$typeof===w||e.$$typeof===_||e.$$typeof===f||e.$$typeof===Z||e.getModuleId!==void 0))}function Ie(e,r,t){var n=e.displayName;if(n)return n;var o=r.displayName||r.name||"";return o!==""?t+"("+o+")":t}function Q(e){return e.displayName||"Context"}function y(e){if(e==null)return null;if(typeof e.tag=="number"&&c("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case m:return"Fragment";case M:return"Portal";case A:return"Profiler";case F:return"StrictMode";case T:return"Suspense";case p:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case _:var r=e;return Q(r)+".Consumer";case w:var t=e;return Q(t._context)+".Provider";case f:return Ie(e,e.render,"ForwardRef");case E:var n=e.displayName||null;return n!==null?n:y(e.type)||"Memo";case b:{var o=e,u=o._payload,i=o._init;try{return y(i(u))}catch{return null}}}return null}var R=Object.assign,j=0,ee,re,te,ne,ae,ie,oe;function ue(){}ue.__reactDisabledLog=!0;function $e(){{if(j===0){ee=console.log,re=console.info,te=console.warn,ne=console.error,ae=console.group,ie=console.groupCollapsed,oe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:ue,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}j++}}function We(){{if(j--,j===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},e,{value:ee}),info:R({},e,{value:re}),warn:R({},e,{value:te}),error:R({},e,{value:ne}),group:R({},e,{value:ae}),groupCollapsed:R({},e,{value:ie}),groupEnd:R({},e,{value:oe})})}j<0&&c("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var U=O.ReactCurrentDispatcher,N;function $(e,r,t){{if(N===void 0)try{throw Error()}catch(o){var n=o.stack.trim().match(/\n( *(at )?)/);N=n&&n[1]||""}return`
18
- `+N+e}}var B=!1,W;{var Ye=typeof WeakMap=="function"?WeakMap:Map;W=new Ye}function se(e,r){if(!e||B)return"";{var t=W.get(e);if(t!==void 0)return t}var n;B=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var u;u=U.current,U.current=null,$e();try{if(r){var i=function(){throw Error()};if(Object.defineProperty(i.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(i,[])}catch(d){n=d}Reflect.construct(e,[],i)}else{try{i.call()}catch(d){n=d}e.call(i.prototype)}}else{try{throw Error()}catch(d){n=d}e()}}catch(d){if(d&&n&&typeof d.stack=="string"){for(var a=d.stack.split(`
19
- `),v=n.stack.split(`
20
- `),s=a.length-1,l=v.length-1;s>=1&&l>=0&&a[s]!==v[l];)l--;for(;s>=1&&l>=0;s--,l--)if(a[s]!==v[l]){if(s!==1||l!==1)do if(s--,l--,l<0||a[s]!==v[l]){var g=`
21
- `+a[s].replace(" at new "," at ");return e.displayName&&g.includes("<anonymous>")&&(g=g.replace("<anonymous>",e.displayName)),typeof e=="function"&&W.set(e,g),g}while(s>=1&&l>=0);break}}}finally{B=!1,U.current=u,We(),Error.prepareStackTrace=o}var P=e?e.displayName||e.name:"",h=P?$(P):"";return typeof e=="function"&&W.set(e,h),h}function Le(e,r,t){return se(e,!1)}function Ve(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Y(e,r,t){if(e==null)return"";if(typeof e=="function")return se(e,Ve(e));if(typeof e=="string")return $(e);switch(e){case T:return $("Suspense");case p:return $("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Le(e.render);case E:return Y(e.type,r,t);case b:{var n=e,o=n._payload,u=n._init;try{return Y(u(o),r,t)}catch{}}}return""}var x=Object.prototype.hasOwnProperty,le={},fe=O.ReactDebugCurrentFrame;function L(e){if(e){var r=e._owner,t=Y(e.type,e._source,r?r.type:null);fe.setExtraStackFrame(t)}else fe.setExtraStackFrame(null)}function Me(e,r,t,n,o){{var u=Function.call.bind(x);for(var i in e)if(u(e,i)){var a=void 0;try{if(typeof e[i]!="function"){var v=Error((n||"React class")+": "+t+" type `"+i+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[i]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw v.name="Invariant Violation",v}a=e[i](r,i,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(s){a=s}a&&!(a instanceof Error)&&(L(o),c("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,i,typeof a),L(null)),a instanceof Error&&!(a.message in le)&&(le[a.message]=!0,L(o),c("Failed %s type: %s",t,a.message),L(null))}}}var Ue=Array.isArray;function J(e){return Ue(e)}function Ne(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Be(e){try{return ce(e),!1}catch{return!0}}function ce(e){return""+e}function ve(e){if(Be(e))return c("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ne(e)),ce(e)}var de=O.ReactCurrentOwner,Je={key:!0,ref:!0,__self:!0,__source:!0},pe,ge;function qe(e){if(x.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Ke(e){if(x.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ge(e,r){typeof e.ref=="string"&&de.current}function ze(e,r){{var t=function(){pe||(pe=!0,c("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function Xe(e,r){{var t=function(){ge||(ge=!0,c("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var He=function(e,r,t,n,o,u,i){var a={$$typeof:C,type:e,key:r,ref:t,props:i,_owner:u};return a._store={},Object.defineProperty(a._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(a,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(a,"_source",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.freeze&&(Object.freeze(a.props),Object.freeze(a)),a};function Ze(e,r,t,n,o){{var u,i={},a=null,v=null;t!==void 0&&(ve(t),a=""+t),Ke(r)&&(ve(r.key),a=""+r.key),qe(r)&&(v=r.ref,Ge(r,o));for(u in r)x.call(r,u)&&!Je.hasOwnProperty(u)&&(i[u]=r[u]);if(e&&e.defaultProps){var s=e.defaultProps;for(u in s)i[u]===void 0&&(i[u]=s[u])}if(a||v){var l=typeof e=="function"?e.displayName||e.name||"Unknown":e;a&&ze(i,l),v&&Xe(i,l)}return He(e,a,v,o,n,de.current,i)}}var q=O.ReactCurrentOwner,Ee=O.ReactDebugCurrentFrame;function S(e){if(e){var r=e._owner,t=Y(e.type,e._source,r?r.type:null);Ee.setExtraStackFrame(t)}else Ee.setExtraStackFrame(null)}var K;K=!1;function G(e){return typeof e=="object"&&e!==null&&e.$$typeof===C}function ye(){{if(q.current){var e=y(q.current.type);if(e)return`
22
-
23
- Check the render method of \``+e+"`."}return""}}function Qe(e){return""}var _e={};function er(e){{var r=ye();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
-
25
- Check the top-level render call using <`+t+">.")}return r}}function be(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=er(r);if(_e[t])return;_e[t]=!0;var n="";e&&e._owner&&e._owner!==q.current&&(n=" It was passed a child from "+y(e._owner.type)+"."),S(e),c('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),S(null)}}function Re(e,r){{if(typeof e!="object")return;if(J(e))for(var t=0;t<e.length;t++){var n=e[t];G(n)&&be(n,r)}else if(G(e))e._store&&(e._store.validated=!0);else if(e){var o=Ce(e);if(typeof o=="function"&&o!==e.entries)for(var u=o.call(e),i;!(i=u.next()).done;)G(i.value)&&be(i.value,r)}}}function rr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===E))t=r.propTypes;else return;if(t){var n=y(r);Me(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!K){K=!0;var o=y(r);c("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",o||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&c("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function tr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){S(e),c("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),S(null);break}}e.ref!==null&&(S(e),c("Invalid attribute `ref` supplied to `React.Fragment`."),S(null))}}var he={};function me(e,r,t,n,o,u){{var i=Ae(e);if(!i){var a="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var v=Qe();v?a+=v:a+=ye();var s;e===null?s="null":J(e)?s="array":e!==void 0&&e.$$typeof===C?(s="<"+(y(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):s=typeof e,c("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",s,a)}var l=Ze(e,r,t,o,u);if(l==null)return l;if(i){var g=r.children;if(g!==void 0)if(n)if(J(g)){for(var P=0;P<g.length;P++)Re(g[P],e);Object.freeze&&Object.freeze(g)}else c("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else Re(g,e)}if(x.call(r,"key")){var h=y(e),d=Object.keys(r).filter(function(sr){return sr!=="key"}),z=d.length>0?"{key: someKey, "+d.join(": ..., ")+": ...}":"{key: someKey}";if(!he[h+z]){var ur=d.length>0?"{"+d.join(": ..., ")+": ...}":"{}";c(`A props object containing a "key" prop is being spread into JSX:
26
- let props = %s;
27
- <%s {...props} />
28
- React keys must be passed directly to JSX without using spread:
29
- let props = %s;
30
- <%s key={someKey} {...props} />`,z,h,ur,h),he[h+z]=!0}}return e===m?tr(l):rr(l),l}}function nr(e,r,t){return me(e,r,t,!0)}function ar(e,r,t){return me(e,r,t,!1)}var ir=ar,or=nr;D.Fragment=m,D.jsx=ir,D.jsxs=or}()),D}process.env.NODE_ENV==="production"?X.exports=lr():X.exports=fr();var cr=X.exports;exports.jsxRuntimeExports=cr;