react-composable-treeview 1.0.16 → 1.0.18

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/README.md CHANGED
@@ -53,12 +53,13 @@ The `focus` state keep track of the curent focused item or group. This state is
53
53
 
54
54
  Contains all the parts of an tree view
55
55
 
56
- | Prop | Type | Default |
57
- | ------------- | ----------------------- | ----------- |
58
- | value | `Set<string>` | `new Set()` |
59
- | defaultValue | `Set<string>` | `new Set()` |
60
- | onValueChange | `(Set<string>) => void` | - |
61
- | draggable | `boolean` | `false` |
56
+ | Prop | Type | Default |
57
+ | ----------------- | ----------------------- | ----------- |
58
+ | value | `Set<string>` | `new Set()` |
59
+ | defaultValue | `Set<string>` | `new Set()` |
60
+ | defaultSelection | `string` | - |
61
+ | onValueChange | `(Set<string>) => void` | - |
62
+ | draggable | `boolean` | `false` |
62
63
 
63
64
  ### Group
64
65
 
@@ -8,6 +8,7 @@ export interface TreeViewContextType {
8
8
  setSelection: React.Dispatch<React.SetStateAction<string>>;
9
9
  focus: React.MutableRefObject<string>;
10
10
  nodeMap: useNodeMapHook[0];
11
- pushToNodeMap: useNodeMapHook[1];
11
+ registerNode: useNodeMapHook[1];
12
+ removeNode: useNodeMapHook[2];
12
13
  }
13
14
  export declare const TreeViewContext: React.Context<TreeViewContextType>;
@@ -10,7 +10,8 @@ export interface TreeNode {
10
10
  ref: React.RefObject<HTMLLIElement>;
11
11
  }
12
12
  export type useNodeMapHook = [
13
- Record<string, TreeNode>,
14
- (value: string, parent: string, index: number, isGroup: boolean, ref: React.RefObject<HTMLLIElement>) => void
13
+ React.RefObject<Record<string, TreeNode>>,
14
+ (value: string, parent: string, index: number, isGroup: boolean, ref: React.RefObject<HTMLLIElement>) => void,
15
+ (value: string) => void
15
16
  ];
16
17
  export declare function useNodeMap(): useNodeMapHook;
package/dist/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";const R=require("react");var ue={exports:{}},G={};/**
1
+ "use strict";const h=require("react");var se={exports:{}},B={};/**
2
2
  * @license React
3
3
  * react-jsx-runtime.production.min.js
4
4
  *
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */var Fe;function lr(){if(Fe)return G;Fe=1;var t=R,o=Symbol.for("react.element"),i=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,h=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,v={key:!0,ref:!0,__self:!0,__source:!0};function l(s,d,w){var b,x={},T=null,P=null;w!==void 0&&(T=""+w),d.key!==void 0&&(T=""+d.key),d.ref!==void 0&&(P=d.ref);for(b in d)a.call(d,b)&&!v.hasOwnProperty(b)&&(x[b]=d[b]);if(s&&s.defaultProps)for(b in d=s.defaultProps,d)x[b]===void 0&&(x[b]=d[b]);return{$$typeof:o,type:s,key:T,ref:P,props:x,_owner:h.current}}return G.Fragment=i,G.jsx=l,G.jsxs=l,G}var q={};/**
9
+ */var Ie;function lr(){if(Ie)return B;Ie=1;var n=h,i=Symbol.for("react.element"),o=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,l={key:!0,ref:!0,__self:!0,__source:!0};function R(u,f,P){var w,b={},x=null,j=null;P!==void 0&&(x=""+P),f.key!==void 0&&(x=""+f.key),f.ref!==void 0&&(j=f.ref);for(w in f)a.call(f,w)&&!l.hasOwnProperty(w)&&(b[w]=f[w]);if(u&&u.defaultProps)for(w in f=u.defaultProps,f)b[w]===void 0&&(b[w]=f[w]);return{$$typeof:i,type:u,key:x,ref:j,props:b,_owner:s.current}}return B.Fragment=o,B.jsx=R,B.jsxs=R,B}var K={};/**
10
10
  * @license React
11
11
  * react-jsx-runtime.development.js
12
12
  *
@@ -14,13 +14,13 @@
14
14
  *
15
15
  * This source code is licensed under the MIT license found in the
16
16
  * LICENSE file in the root directory of this source tree.
17
- */var Ie;function dr(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&function(){var t=R,o=Symbol.for("react.element"),i=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),h=Symbol.for("react.strict_mode"),v=Symbol.for("react.profiler"),l=Symbol.for("react.provider"),s=Symbol.for("react.context"),d=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),x=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),A=Symbol.iterator,m="@@iterator";function I(e){if(e===null||typeof e!="object")return null;var r=A&&e[A]||e[m];return typeof r=="function"?r:null}var O=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function _(e){{for(var r=arguments.length,n=new Array(r>1?r-1:0),u=1;u<r;u++)n[u-1]=arguments[u];C("error",e,n)}}function C(e,r,n){{var u=O.ReactDebugCurrentFrame,p=u.getStackAddendum();p!==""&&(r+="%s",n=n.concat([p]));var g=n.map(function(f){return String(f)});g.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,g)}}var j=!1,V=!1,J=!1,z=!1,Le=!1,ce;ce=Symbol.for("react.module.reference");function $e(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===v||Le||e===h||e===w||e===b||z||e===P||j||V||J||typeof e=="object"&&e!==null&&(e.$$typeof===T||e.$$typeof===x||e.$$typeof===l||e.$$typeof===s||e.$$typeof===d||e.$$typeof===ce||e.getModuleId!==void 0))}function Ne(e,r,n){var u=e.displayName;if(u)return u;var p=r.displayName||r.name||"";return p!==""?n+"("+p+")":n}function fe(e){return e.displayName||"Context"}function L(e){if(e==null)return null;if(typeof e.tag=="number"&&_("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 a:return"Fragment";case i:return"Portal";case v:return"Profiler";case h:return"StrictMode";case w:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case s:var r=e;return fe(r)+".Consumer";case l:var n=e;return fe(n._context)+".Provider";case d:return Ne(e,e.render,"ForwardRef");case x:var u=e.displayName||null;return u!==null?u:L(e.type)||"Memo";case T:{var p=e,g=p._payload,f=p._init;try{return L(f(g))}catch{return null}}}return null}var $=Object.assign,U=0,le,de,ve,pe,he,_e,ge;function Re(){}Re.__reactDisabledLog=!0;function Ye(){{if(U===0){le=console.log,de=console.info,ve=console.warn,pe=console.error,he=console.group,_e=console.groupCollapsed,ge=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Re,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function We(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:le}),info:$({},e,{value:de}),warn:$({},e,{value:ve}),error:$({},e,{value:pe}),group:$({},e,{value:he}),groupCollapsed:$({},e,{value:_e}),groupEnd:$({},e,{value:ge})})}U<0&&_("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ee=O.ReactCurrentDispatcher,re;function M(e,r,n){{if(re===void 0)try{throw Error()}catch(p){var u=p.stack.trim().match(/\n( *(at )?)/);re=u&&u[1]||""}return`
18
- `+re+e}}var te=!1,H;{var Ue=typeof WeakMap=="function"?WeakMap:Map;H=new Ue}function be(e,r){if(!e||te)return"";{var n=H.get(e);if(n!==void 0)return n}var u;te=!0;var p=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var g;g=ee.current,ee.current=null,Ye();try{if(r){var f=function(){throw Error()};if(Object.defineProperty(f.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(f,[])}catch(D){u=D}Reflect.construct(e,[],f)}else{try{f.call()}catch(D){u=D}e.call(f.prototype)}}else{try{throw Error()}catch(D){u=D}e()}}catch(D){if(D&&u&&typeof D.stack=="string"){for(var c=D.stack.split(`
19
- `),S=u.stack.split(`
20
- `),E=c.length-1,y=S.length-1;E>=1&&y>=0&&c[E]!==S[y];)y--;for(;E>=1&&y>=0;E--,y--)if(c[E]!==S[y]){if(E!==1||y!==1)do if(E--,y--,y<0||c[E]!==S[y]){var k=`
21
- `+c[E].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&H.set(e,k),k}while(E>=1&&y>=0);break}}}finally{te=!1,ee.current=g,We(),Error.prepareStackTrace=p}var Y=e?e.displayName||e.name:"",Ae=Y?M(Y):"";return typeof e=="function"&&H.set(e,Ae),Ae}function Ge(e,r,n){return be(e,!1)}function qe(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function X(e,r,n){if(e==null)return"";if(typeof e=="function")return be(e,qe(e));if(typeof e=="string")return M(e);switch(e){case w:return M("Suspense");case b:return M("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case d:return Ge(e.render);case x:return X(e.type,r,n);case T:{var u=e,p=u._payload,g=u._init;try{return X(g(p),r,n)}catch{}}}return""}var Z=Object.prototype.hasOwnProperty,Ee={},me=O.ReactDebugCurrentFrame;function Q(e){if(e){var r=e._owner,n=X(e.type,e._source,r?r.type:null);me.setExtraStackFrame(n)}else me.setExtraStackFrame(null)}function Be(e,r,n,u,p){{var g=Function.call.bind(Z);for(var f in e)if(g(e,f)){var c=void 0;try{if(typeof e[f]!="function"){var S=Error((u||"React class")+": "+n+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}c=e[f](r,f,u,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){c=E}c&&!(c instanceof Error)&&(Q(p),_("%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).",u||"React class",n,f,typeof c),Q(null)),c instanceof Error&&!(c.message in Ee)&&(Ee[c.message]=!0,Q(p),_("Failed %s type: %s",n,c.message),Q(null))}}}var Ke=Array.isArray;function ne(e){return Ke(e)}function Je(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,n=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function ze(e){try{return ye(e),!1}catch{return!0}}function ye(e){return""+e}function we(e){if(ze(e))return _("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Je(e)),ye(e)}var xe=O.ReactCurrentOwner,Me={key:!0,ref:!0,__self:!0,__source:!0},Te,Ce;function He(e){if(Z.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Xe(e){if(Z.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ze(e,r){typeof e.ref=="string"&&xe.current}function Qe(e,r){{var n=function(){Te||(Te=!0,_("%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))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}}function er(e,r){{var n=function(){Ce||(Ce=!0,_("%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))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}}var rr=function(e,r,n,u,p,g,f){var c={$$typeof:o,type:e,key:r,ref:n,props:f,_owner:g};return c._store={},Object.defineProperty(c._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(c,"_self",{configurable:!1,enumerable:!1,writable:!1,value:u}),Object.defineProperty(c,"_source",{configurable:!1,enumerable:!1,writable:!1,value:p}),Object.freeze&&(Object.freeze(c.props),Object.freeze(c)),c};function tr(e,r,n,u,p){{var g,f={},c=null,S=null;n!==void 0&&(we(n),c=""+n),Xe(r)&&(we(r.key),c=""+r.key),He(r)&&(S=r.ref,Ze(r,p));for(g in r)Z.call(r,g)&&!Me.hasOwnProperty(g)&&(f[g]=r[g]);if(e&&e.defaultProps){var E=e.defaultProps;for(g in E)f[g]===void 0&&(f[g]=E[g])}if(c||S){var y=typeof e=="function"?e.displayName||e.name||"Unknown":e;c&&Qe(f,y),S&&er(f,y)}return rr(e,c,S,p,u,xe.current,f)}}var oe=O.ReactCurrentOwner,Se=O.ReactDebugCurrentFrame;function N(e){if(e){var r=e._owner,n=X(e.type,e._source,r?r.type:null);Se.setExtraStackFrame(n)}else Se.setExtraStackFrame(null)}var ae;ae=!1;function ie(e){return typeof e=="object"&&e!==null&&e.$$typeof===o}function Pe(){{if(oe.current){var e=L(oe.current.type);if(e)return`
17
+ */var Ve;function dr(){return Ve||(Ve=1,process.env.NODE_ENV!=="production"&&function(){var n=h,i=Symbol.for("react.element"),o=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),R=Symbol.for("react.provider"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),x=Symbol.for("react.lazy"),j=Symbol.for("react.offscreen"),O=Symbol.iterator,V="@@iterator";function N(e){if(e===null||typeof e!="object")return null;var r=O&&e[O]||e[V];return typeof r=="function"?r:null}var g=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function m(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),c=1;c<r;c++)t[c-1]=arguments[c];L("error",e,t)}}function L(e,r,t){{var c=g.ReactDebugCurrentFrame,v=c.getStackAddendum();v!==""&&(r+="%s",t=t.concat([v]));var _=t.map(function(p){return String(p)});_.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,_)}}var C=!1,A=!1,T=!1,D=!1,H=!1,G;G=Symbol.for("react.module.reference");function Le(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===l||H||e===s||e===P||e===w||D||e===j||C||A||T||typeof e=="object"&&e!==null&&(e.$$typeof===x||e.$$typeof===b||e.$$typeof===R||e.$$typeof===u||e.$$typeof===f||e.$$typeof===G||e.getModuleId!==void 0))}function $e(e,r,t){var c=e.displayName;if(c)return c;var v=r.displayName||r.name||"";return v!==""?t+"("+v+")":t}function le(e){return e.displayName||"Context"}function $(e){if(e==null)return null;if(typeof e.tag=="number"&&m("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 a:return"Fragment";case o:return"Portal";case l:return"Profiler";case s:return"StrictMode";case P:return"Suspense";case w:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case u:var r=e;return le(r)+".Consumer";case R:var t=e;return le(t._context)+".Provider";case f:return $e(e,e.render,"ForwardRef");case b:var c=e.displayName||null;return c!==null?c:$(e.type)||"Memo";case x:{var v=e,_=v._payload,p=v._init;try{return $(p(_))}catch{return null}}}return null}var Y=Object.assign,q=0,de,pe,ve,he,_e,ge,Re;function be(){}be.__reactDisabledLog=!0;function Ye(){{if(q===0){de=console.log,pe=console.info,ve=console.warn,he=console.error,_e=console.group,ge=console.groupCollapsed,Re=console.groupEnd;var e={configurable:!0,enumerable:!0,value:be,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}q++}}function Me(){{if(q--,q===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:Y({},e,{value:de}),info:Y({},e,{value:pe}),warn:Y({},e,{value:ve}),error:Y({},e,{value:he}),group:Y({},e,{value:_e}),groupCollapsed:Y({},e,{value:ge}),groupEnd:Y({},e,{value:Re})})}q<0&&m("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=g.ReactCurrentDispatcher,ne;function X(e,r,t){{if(ne===void 0)try{throw Error()}catch(v){var c=v.stack.trim().match(/\n( *(at )?)/);ne=c&&c[1]||""}return`
18
+ `+ne+e}}var oe=!1,Z;{var We=typeof WeakMap=="function"?WeakMap:Map;Z=new We}function me(e,r){if(!e||oe)return"";{var t=Z.get(e);if(t!==void 0)return t}var c;oe=!0;var v=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var _;_=te.current,te.current=null,Ye();try{if(r){var p=function(){throw Error()};if(Object.defineProperty(p.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(p,[])}catch(F){c=F}Reflect.construct(e,[],p)}else{try{p.call()}catch(F){c=F}e.call(p.prototype)}}else{try{throw Error()}catch(F){c=F}e()}}catch(F){if(F&&c&&typeof F.stack=="string"){for(var d=F.stack.split(`
19
+ `),S=c.stack.split(`
20
+ `),E=d.length-1,y=S.length-1;E>=1&&y>=0&&d[E]!==S[y];)y--;for(;E>=1&&y>=0;E--,y--)if(d[E]!==S[y]){if(E!==1||y!==1)do if(E--,y--,y<0||d[E]!==S[y]){var k=`
21
+ `+d[E].replace(" at new "," at ");return e.displayName&&k.includes("<anonymous>")&&(k=k.replace("<anonymous>",e.displayName)),typeof e=="function"&&Z.set(e,k),k}while(E>=1&&y>=0);break}}}finally{oe=!1,te.current=_,Me(),Error.prepareStackTrace=v}var W=e?e.displayName||e.name:"",Fe=W?X(W):"";return typeof e=="function"&&Z.set(e,Fe),Fe}function Ue(e,r,t){return me(e,!1)}function Ge(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function Q(e,r,t){if(e==null)return"";if(typeof e=="function")return me(e,Ge(e));if(typeof e=="string")return X(e);switch(e){case P:return X("Suspense");case w:return X("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case f:return Ue(e.render);case b:return Q(e.type,r,t);case x:{var c=e,v=c._payload,_=c._init;try{return Q(_(v),r,t)}catch{}}}return""}var ee=Object.prototype.hasOwnProperty,Ee={},ye=g.ReactDebugCurrentFrame;function re(e){if(e){var r=e._owner,t=Q(e.type,e._source,r?r.type:null);ye.setExtraStackFrame(t)}else ye.setExtraStackFrame(null)}function qe(e,r,t,c,v){{var _=Function.call.bind(ee);for(var p in e)if(_(e,p)){var d=void 0;try{if(typeof e[p]!="function"){var S=Error((c||"React class")+": "+t+" type `"+p+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[p]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}d=e[p](r,p,c,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){d=E}d&&!(d instanceof Error)&&(re(v),m("%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).",c||"React class",t,p,typeof d),re(null)),d instanceof Error&&!(d.message in Ee)&&(Ee[d.message]=!0,re(v),m("Failed %s type: %s",t,d.message),re(null))}}}var Be=Array.isArray;function ae(e){return Be(e)}function Ke(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function Je(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function xe(e){if(Je(e))return m("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Ke(e)),we(e)}var Ce=g.ReactCurrentOwner,ze={key:!0,ref:!0,__self:!0,__source:!0},Te,Se;function He(e){if(ee.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function Xe(e){if(ee.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function Ze(e,r){typeof e.ref=="string"&&Ce.current}function Qe(e,r){{var t=function(){Te||(Te=!0,m("%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 er(e,r){{var t=function(){Se||(Se=!0,m("%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 rr=function(e,r,t,c,v,_,p){var d={$$typeof:i,type:e,key:r,ref:t,props:p,_owner:_};return d._store={},Object.defineProperty(d._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(d,"_self",{configurable:!1,enumerable:!1,writable:!1,value:c}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:v}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function tr(e,r,t,c,v){{var _,p={},d=null,S=null;t!==void 0&&(xe(t),d=""+t),Xe(r)&&(xe(r.key),d=""+r.key),He(r)&&(S=r.ref,Ze(r,v));for(_ in r)ee.call(r,_)&&!ze.hasOwnProperty(_)&&(p[_]=r[_]);if(e&&e.defaultProps){var E=e.defaultProps;for(_ in E)p[_]===void 0&&(p[_]=E[_])}if(d||S){var y=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&Qe(p,y),S&&er(p,y)}return rr(e,d,S,v,c,Ce.current,p)}}var ie=g.ReactCurrentOwner,Pe=g.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=Q(e.type,e._source,r?r.type:null);Pe.setExtraStackFrame(t)}else Pe.setExtraStackFrame(null)}var ue;ue=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===i}function Oe(){{if(ie.current){var e=$(ie.current.type);if(e)return`
22
22
 
23
- Check the render method of \``+e+"`."}return""}}function nr(e){return""}var Oe={};function or(e){{var r=Pe();if(!r){var n=typeof e=="string"?e:e.displayName||e.name;n&&(r=`
23
+ Check the render method of \``+e+"`."}return""}}function nr(e){return""}var ke={};function or(e){{var r=Oe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
24
24
 
25
- Check the top-level render call using <`+n+">.")}return r}}function ke(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var n=or(r);if(Oe[n])return;Oe[n]=!0;var u="";e&&e._owner&&e._owner!==oe.current&&(u=" It was passed a child from "+L(e._owner.type)+"."),N(e),_('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,u),N(null)}}function je(e,r){{if(typeof e!="object")return;if(ne(e))for(var n=0;n<e.length;n++){var u=e[n];ie(u)&&ke(u,r)}else if(ie(e))e._store&&(e._store.validated=!0);else if(e){var p=I(e);if(typeof p=="function"&&p!==e.entries)for(var g=p.call(e),f;!(f=g.next()).done;)ie(f.value)&&ke(f.value,r)}}}function ar(e){{var r=e.type;if(r==null||typeof r=="string")return;var n;if(typeof r=="function")n=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===d||r.$$typeof===x))n=r.propTypes;else return;if(n){var u=L(r);Be(n,e.props,"prop",u,e)}else if(r.PropTypes!==void 0&&!ae){ae=!0;var p=L(r);_("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",p||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&_("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ir(e){{for(var r=Object.keys(e.props),n=0;n<r.length;n++){var u=r[n];if(u!=="children"&&u!=="key"){N(e),_("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",u),N(null);break}}e.ref!==null&&(N(e),_("Invalid attribute `ref` supplied to `React.Fragment`."),N(null))}}function De(e,r,n,u,p,g){{var f=$e(e);if(!f){var c="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(c+=" 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 S=nr();S?c+=S:c+=Pe();var E;e===null?E="null":ne(e)?E="array":e!==void 0&&e.$$typeof===o?(E="<"+(L(e.type)||"Unknown")+" />",c=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,_("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,c)}var y=tr(e,r,n,p,g);if(y==null)return y;if(f){var k=r.children;if(k!==void 0)if(u)if(ne(k)){for(var Y=0;Y<k.length;Y++)je(k[Y],e);Object.freeze&&Object.freeze(k)}else _("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 je(k,e)}return e===a?ir(y):ar(y),y}}function ur(e,r,n){return De(e,r,n,!0)}function sr(e,r,n){return De(e,r,n,!1)}var cr=sr,fr=ur;q.Fragment=a,q.jsx=cr,q.jsxs=fr}()),q}process.env.NODE_ENV==="production"?ue.exports=lr():ue.exports=dr();var F=ue.exports;const K=R.createContext({rootValue:new Set,setRootValue:()=>{},selection:null,setSelection:()=>{},focus:{current:""},nodeMap:{},pushToNodeMap:()=>{}});function vr(){const t={__root__:{value:"__root__",parent:"",children:{},index:0,childrenLength:0,isGroup:!0,ref:{current:null}}};return[t,(i,a,h,v,l)=>{t[i]={value:i,parent:a,children:{},childrenLength:0,index:h,isGroup:v,ref:l},t[a].children[h]=i,(h+1>t[a].childrenLength||t[t[a].childrenLength-1]==null)&&(t[a].childrenLength=h+1)}]}const W=R.createContext({parent:"",getIndex:()=>-1,depth:-1});function pr(t,o,i){const[a,h]=R.useState(i),v=t!==void 0?t:a;return[v,s=>{const d=typeof s=="function"?s(v):s;o&&o(d),h(d)}]}function B(t,o){return function(a){const h=a.defaultPrevented;h&&(a.defaultPrevented=!1),t==null||t(a);let v;return a.defaultPrevented||(v=o==null?void 0:o(a),h&&(a.defaultPrevented=!0)),v}}function se(...t){return R.useCallback(o=>{for(const i of t)typeof i=="function"?i(o):i!=null&&(i.current=o)},[t])}function Ve(){let t=-1;const o={};function i(a){return o[a]==null&&(o[a]=++t),o[a]}return i}const hr=["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","Home","End","Enter"];function _r(t,o){var a;const i=t[o].children[0];i!=null&&((a=t[i].ref.current)==null||a.focus())}function gr(t,o){var a;const i=t[o].parent;i!="__root__"&&((a=t[i].ref.current)==null||a.focus())}function Rr(t,o){var h,v;const i=t[o].parent,a=t[o].index;if(a!=0){let l=t[i].children[a-1],s;for(;t[l].isGroup&&(s=t[l].children[t[l].childrenLength-1],!(s==null||t[s].ref.current==null));)l=s;(h=t[l].ref.current)==null||h.focus();return}i!="__root__"&&((v=t[i].ref.current)==null||v.focus())}function br(t,o){var h,v;if(t[o].isGroup){const l=(h=t[t[o].children[0]])==null?void 0:h.ref.current;if(l){l.focus();return}}let i,a;for(;i=t[o].parent,a=t[i].children[t[o].index+1],a==null;){if(i=="__root__")return;o=i}(v=t[a].ref.current)==null||v.focus()}function Er(t){var i;const o=t.__root__.children[0];(i=t[o].ref.current)==null||i.focus()}function mr(t){var a;let o="__root__",i;for(;t[o].isGroup&&(i=t[o].children[t[o].childrenLength-1],!(i==null||t[i].ref.current==null));)o=i;(a=t[o].ref.current)==null||a.focus()}const yr=R.forwardRef(({value:t,onValueChange:o,defaultValue:i,onKeyDown:a,...h},v)=>{const[l,s]=vr(),d=Ve(),[w,b]=pr(t,o,i??new Set),[x,T]=R.useState(""),P=R.useRef(null),A=se(P,v),m=R.useRef(""),I=R.useCallback(_=>{if(!(!hr.includes(_.key)||!l))switch(_.key){case"ArrowRight":if(!l[m.current].isGroup)break;_.preventDefault(),w.has(m.current)?_r(l,m.current):b(C=>new Set([...C,m.current]));break;case"ArrowLeft":_.preventDefault(),w.has(m.current)?b(C=>new Set([...C].filter(j=>j!==m.current))):gr(l,m.current);break;case"ArrowUp":_.preventDefault(),Rr(l,m.current);break;case"ArrowDown":_.preventDefault(),br(l,m.current);break;case"Home":_.preventDefault(),Er(l);break;case"End":_.preventDefault(),mr(l);break;case"Enter":_.preventDefault(),T(m.current),w.has(m.current)?b(C=>new Set([...C].filter(j=>j!==m.current))):b(C=>new Set([...C,m.current]));break}},[w]),O=B(a,I);return F.jsx(K.Provider,{value:{rootValue:w,setRootValue:b,selection:x,setSelection:T,focus:m,nodeMap:l,pushToNodeMap:s},children:F.jsx(W.Provider,{value:{parent:"__root__",getIndex:d,depth:0},children:F.jsx("ul",{ref:A,role:"tree","aria-multiselectable":"false",onKeyDown:O,...h})})})}),wr=R.forwardRef(({value:t,onFocus:o,onClick:i,...a},h)=>{const{selection:v,setSelection:l,focus:s,nodeMap:d,pushToNodeMap:w}=R.useContext(K),{parent:b,getIndex:x,depth:T}=R.useContext(W),P=R.useRef(null),A=se(P,h),m=B(o,O),I=B(i,_);function O(j){var V,J,z;(J=(V=d==null?void 0:d[s.current])==null?void 0:V.ref.current)==null||J.setAttribute("tabindex","-1"),(z=P.current)==null||z.setAttribute("tabindex","0"),s.current=t,j.stopPropagation()}function _(){l(t)}const C=x(t);return w(t,b,C,!1,P),s.current==""&&b=="__root__"&&C==0&&(s.current=t),R.useEffect(()=>()=>{s.current==t&&(s.current="")},[]),F.jsx("li",{ref:A,role:"treeitem","aria-selected":v==t,tabIndex:s.current==t?0:-1,onFocus:m,onClick:I,"data-depth":T,...a})}),xr=R.forwardRef(({value:t,onFocus:o,...i},a)=>{const h=Ve(),{rootValue:v,selection:l,focus:s,nodeMap:d,pushToNodeMap:w}=R.useContext(K),{parent:b,getIndex:x,depth:T}=R.useContext(W),P=R.useRef(null),A=se(P,a),m=B(o,I);function I(_){var C,j,V;(j=(C=d==null?void 0:d[s.current])==null?void 0:C.ref.current)==null||j.setAttribute("tabindex","-1"),(V=P.current)==null||V.setAttribute("tabindex","0"),s.current=t,_.stopPropagation()}const O=x(t);return w(t,b,O,!0,P),s.current==""&&b=="__root__"&&O==0&&(s.current=t),R.useEffect(()=>()=>{s.current==t&&(s.current="")},[]),F.jsx(W.Provider,{value:{parent:t,getIndex:h,depth:T+1},children:F.jsx("li",{ref:A,role:"treeitem","data-state":v.has(t)?"open":"closed","data-depth":T,"aria-expanded":v.has(t),"aria-selected":l==t,tabIndex:s.current==t?0:-1,onFocus:m,...i})})}),Tr=R.forwardRef(({onClick:t,...o},i)=>{const{setRootValue:a,setSelection:h}=R.useContext(K),{parent:v}=R.useContext(W),l=B(t,s);function s(){h(v),a(d=>d.has(v)?new Set([...d].filter(w=>w!==v)):new Set([...d,v]))}return F.jsx("div",{ref:i,onClick:l,...o})}),Cr=R.forwardRef(({...t},o)=>{const{rootValue:i}=R.useContext(K),{parent:a}=R.useContext(W);if(i.has(a))return F.jsx("ul",{ref:o,role:"group",...t})}),Sr={Root:yr,Group:xr,Trigger:Tr,Content:Cr,Item:wr};module.exports=Sr;
25
+ Check the top-level render call using <`+t+">.")}return r}}function je(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=or(r);if(ke[t])return;ke[t]=!0;var c="";e&&e._owner&&e._owner!==ie.current&&(c=" It was passed a child from "+$(e._owner.type)+"."),M(e),m('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,c),M(null)}}function De(e,r){{if(typeof e!="object")return;if(ae(e))for(var t=0;t<e.length;t++){var c=e[t];ce(c)&&je(c,r)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var v=N(e);if(typeof v=="function"&&v!==e.entries)for(var _=v.call(e),p;!(p=_.next()).done;)ce(p.value)&&je(p.value,r)}}}function ar(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===b))t=r.propTypes;else return;if(t){var c=$(r);qe(t,e.props,"prop",c,e)}else if(r.PropTypes!==void 0&&!ue){ue=!0;var v=$(r);m("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",v||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&m("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function ir(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var c=r[t];if(c!=="children"&&c!=="key"){M(e),m("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",c),M(null);break}}e.ref!==null&&(M(e),m("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}function Ae(e,r,t,c,v,_){{var p=Le(e);if(!p){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" 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 S=nr();S?d+=S:d+=Oe();var E;e===null?E="null":ae(e)?E="array":e!==void 0&&e.$$typeof===i?(E="<"+($(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,m("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",E,d)}var y=tr(e,r,t,v,_);if(y==null)return y;if(p){var k=r.children;if(k!==void 0)if(c)if(ae(k)){for(var W=0;W<k.length;W++)De(k[W],e);Object.freeze&&Object.freeze(k)}else m("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 De(k,e)}return e===a?ir(y):ar(y),y}}function ur(e,r,t){return Ae(e,r,t,!0)}function cr(e,r,t){return Ae(e,r,t,!1)}var sr=cr,fr=ur;K.Fragment=a,K.jsx=sr,K.jsxs=fr}()),K}process.env.NODE_ENV==="production"?se.exports=lr():se.exports=dr();var I=se.exports;const z=h.createContext({rootValue:new Set,setRootValue:()=>{},selection:null,setSelection:()=>{},focus:{current:""},nodeMap:{current:{}},registerNode:()=>{},removeNode:()=>{}});function pr(){const n=h.useRef({__root__:{value:"__root__",parent:"",children:{},index:0,childrenLength:0,isGroup:!0,ref:{current:null}}});return[n,(a,s,l,R,u)=>{if(n.current==null)return;const f=n.current;f[a]={value:a,parent:s,children:{},childrenLength:0,index:l,isGroup:R,ref:u},f[s].children[l]=a,(l+1>f[s].childrenLength||f[f[s].childrenLength-1]==null)&&(f[s].childrenLength=l+1)},a=>{if(n.current==null)return;const s=n.current[a],l=n.current[s.parent];for(delete l.children[s.index];l.childrenLength>0&&l.children[l.childrenLength-1]==null;)l.childrenLength-=1;delete n.current[a]}]}const U=h.createContext({parent:"",getIndex:()=>-1,depth:-1});function vr(n,i,o){const[a,s]=h.useState(o),l=n!==void 0?n:a;return[l,u=>{const f=typeof u=="function"?u(l):u;i&&i(f),s(f)}]}function J(n,i){return function(a){const s=a.defaultPrevented;s&&(a.defaultPrevented=!1),n==null||n(a);let l;return a.defaultPrevented||(l=i==null?void 0:i(a),s&&(a.defaultPrevented=!0)),l}}function fe(...n){return h.useCallback(i=>{for(const o of n)typeof o=="function"?o(i):o!=null&&(o.current=i)},[n])}function Ne(){let n=-1;const i={};function o(a){return i[a]==null&&(i[a]=++n),i[a]}return o}const hr=["ArrowRight","ArrowUp","ArrowLeft","ArrowDown","Home","End","Enter"];function _r(n,i){var s;const o=n.current;if(!o)return;const a=o[i].children[0];a!=null&&((s=o[a].ref.current)==null||s.focus())}function gr(n,i){var s;const o=n.current;if(!o)return;const a=o[i].parent;a!="__root__"&&((s=o[a].ref.current)==null||s.focus())}function Rr(n,i){var l,R;const o=n.current;if(!o)return;const a=o[i].parent,s=o[i].index;if(s!=0){let u=o[a].children[s-1],f;for(;o[u].isGroup&&(f=o[u].children[o[u].childrenLength-1],!(f==null||o[f].ref.current==null));)u=f;(l=o[u].ref.current)==null||l.focus();return}a!="__root__"&&((R=o[a].ref.current)==null||R.focus())}function br(n,i){var l,R;const o=n.current;if(!o)return;if(o[i].isGroup){const u=(l=o[o[i].children[0]])==null?void 0:l.ref.current;if(u){u.focus();return}}let a,s;for(;a=o[i].parent,s=o[a].children[o[i].index+1],s==null;){if(a=="__root__")return;i=a}(R=o[s].ref.current)==null||R.focus()}function mr(n){var a;const i=n.current;if(!i)return;const o=i.__root__.children[0];(a=i[o].ref.current)==null||a.focus()}function Er(n){var s;const i=n.current;if(!i)return;let o="__root__",a;for(;i[o].isGroup&&(a=i[o].children[i[o].childrenLength-1],!(a==null||i[a].ref.current==null));)o=a;(s=i[o].ref.current)==null||s.focus()}const yr=h.forwardRef(({value:n,onValueChange:i,defaultValue:o,defaultSelection:a,onKeyDown:s,...l},R)=>{const[u,f,P]=pr(),w=Ne(),[b,x]=vr(n,i,o??new Set),[j,O]=h.useState(""),V=h.useRef(null),N=fe(V,R),g=h.useRef(""),m=h.useCallback(C=>{var A;if(!(!hr.includes(C.key)||!u))switch(C.key){case"ArrowRight":if(!((A=u.current)!=null&&A[g.current].isGroup))break;C.preventDefault(),b.has(g.current)?_r(u,g.current):x(T=>new Set([...T,g.current]));break;case"ArrowLeft":C.preventDefault(),b.has(g.current)?x(T=>new Set([...T].filter(D=>D!==g.current))):gr(u,g.current);break;case"ArrowUp":C.preventDefault(),Rr(u,g.current);break;case"ArrowDown":C.preventDefault(),br(u,g.current);break;case"Home":C.preventDefault(),mr(u);break;case"End":C.preventDefault(),Er(u);break;case"Enter":C.preventDefault(),O(g.current),b.has(g.current)?x(T=>new Set([...T].filter(D=>D!==g.current))):x(T=>new Set([...T,g.current]));break}},[b]),L=J(s,m);return I.jsx(z.Provider,{value:{rootValue:b,setRootValue:x,selection:j,setSelection:O,focus:g,nodeMap:u,registerNode:f,removeNode:P},children:I.jsx(U.Provider,{value:{parent:"__root__",getIndex:w,depth:0},children:I.jsx("ul",{ref:N,role:"tree","aria-multiselectable":"false",onKeyDown:L,...l})})})}),wr=h.forwardRef(({value:n,onFocus:i,onClick:o,...a},s)=>{const{selection:l,setSelection:R,focus:u,nodeMap:f,registerNode:P,removeNode:w}=h.useContext(z),{parent:b,getIndex:x,depth:j}=h.useContext(U),O=h.useRef(null),V=fe(O,s),N=J(i,m),g=J(o,L);function m(A){var T,D,H,G;(H=(D=(T=f.current)==null?void 0:T[u.current])==null?void 0:D.ref.current)==null||H.setAttribute("tabindex","-1"),(G=O.current)==null||G.setAttribute("tabindex","0"),u.current=n,A.stopPropagation()}function L(){R(n)}const C=x(n);return u.current==""&&b=="__root__"&&C==0&&(u.current=n),h.useEffect(()=>(P(n,b,C,!1,O),()=>w(n)),[]),h.useEffect(()=>()=>{u.current==n&&(u.current="")},[]),I.jsx("li",{ref:V,role:"treeitem","aria-selected":l==n,tabIndex:u.current==n?0:-1,onFocus:N,onClick:g,"data-depth":j,...a})}),xr=h.forwardRef(({value:n,onFocus:i,...o},a)=>{const s=Ne(),{rootValue:l,selection:R,focus:u,nodeMap:f,registerNode:P,removeNode:w}=h.useContext(z),{parent:b,getIndex:x,depth:j}=h.useContext(U),O=h.useRef(null),V=fe(O,a),N=J(i,g);function g(L){var C,A,T,D;(T=(A=(C=f.current)==null?void 0:C[u.current])==null?void 0:A.ref.current)==null||T.setAttribute("tabindex","-1"),(D=O.current)==null||D.setAttribute("tabindex","0"),u.current=n,L.stopPropagation()}const m=x(n);return u.current==""&&b=="__root__"&&m==0&&(u.current=n),h.useEffect(()=>(P(n,b,m,!0,O),()=>w(n)),[]),h.useEffect(()=>()=>{u.current==n&&(u.current="")},[]),I.jsx(U.Provider,{value:{parent:n,getIndex:s,depth:j+1},children:I.jsx("li",{ref:V,role:"treeitem","data-state":l.has(n)?"open":"closed","data-depth":j,"aria-expanded":l.has(n),"aria-selected":R==n,tabIndex:u.current==n?0:-1,onFocus:N,...o})})}),Cr=h.forwardRef(({onClick:n,...i},o)=>{const{setRootValue:a,setSelection:s}=h.useContext(z),{parent:l}=h.useContext(U),R=J(n,u);function u(){s(l),a(f=>f.has(l)?new Set([...f].filter(P=>P!==l)):new Set([...f,l]))}return I.jsx("div",{ref:o,onClick:R,...i})}),Tr=h.forwardRef(({...n},i)=>{const{rootValue:o}=h.useContext(z),{parent:a}=h.useContext(U);if(o.has(a))return I.jsx("ul",{ref:i,role:"group",...n})}),Sr={Root:yr,Group:xr,Trigger:Cr,Content:Tr,Item:wr};module.exports=Sr;
26
26
  //# sourceMappingURL=index.cjs.map