dropdowns-js 1.0.6 → 1.0.8
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/dropdowns-js.cjs.js +10 -0
- package/dist/dropdowns-js.es.js +1069 -1326
- package/package.json +9 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("react/jsx-runtime"),J=require("react");function qe(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var se={exports:{}},ie={exports:{}},V={};var ye;function ke(){if(ye)return V;ye=1;var s=typeof Symbol=="function"&&Symbol.for,n=s?Symbol.for("react.element"):60103,c=s?Symbol.for("react.portal"):60106,a=s?Symbol.for("react.fragment"):60107,g=s?Symbol.for("react.strict_mode"):60108,p=s?Symbol.for("react.profiler"):60114,C=s?Symbol.for("react.provider"):60109,E=s?Symbol.for("react.context"):60110,T=s?Symbol.for("react.async_mode"):60111,d=s?Symbol.for("react.concurrent_mode"):60111,h=s?Symbol.for("react.forward_ref"):60112,w=s?Symbol.for("react.suspense"):60113,q=s?Symbol.for("react.suspense_list"):60120,$=s?Symbol.for("react.memo"):60115,Y=s?Symbol.for("react.lazy"):60116,R=s?Symbol.for("react.block"):60121,A=s?Symbol.for("react.fundamental"):60117,B=s?Symbol.for("react.responder"):60118,Q=s?Symbol.for("react.scope"):60119;function N(i){if(typeof i=="object"&&i!==null){var O=i.$$typeof;switch(O){case n:switch(i=i.type,i){case T:case d:case a:case p:case g:case w:return i;default:switch(i=i&&i.$$typeof,i){case E:case h:case Y:case $:case C:return i;default:return O}}case c:return O}}}function k(i){return N(i)===d}return V.AsyncMode=T,V.ConcurrentMode=d,V.ContextConsumer=E,V.ContextProvider=C,V.Element=n,V.ForwardRef=h,V.Fragment=a,V.Lazy=Y,V.Memo=$,V.Portal=c,V.Profiler=p,V.StrictMode=g,V.Suspense=w,V.isAsyncMode=function(i){return k(i)||N(i)===T},V.isConcurrentMode=k,V.isContextConsumer=function(i){return N(i)===E},V.isContextProvider=function(i){return N(i)===C},V.isElement=function(i){return typeof i=="object"&&i!==null&&i.$$typeof===n},V.isForwardRef=function(i){return N(i)===h},V.isFragment=function(i){return N(i)===a},V.isLazy=function(i){return N(i)===Y},V.isMemo=function(i){return N(i)===$},V.isPortal=function(i){return N(i)===c},V.isProfiler=function(i){return N(i)===p},V.isStrictMode=function(i){return N(i)===g},V.isSuspense=function(i){return N(i)===w},V.isValidElementType=function(i){return typeof i=="string"||typeof i=="function"||i===a||i===d||i===p||i===g||i===w||i===q||typeof i=="object"&&i!==null&&(i.$$typeof===Y||i.$$typeof===$||i.$$typeof===C||i.$$typeof===E||i.$$typeof===h||i.$$typeof===A||i.$$typeof===B||i.$$typeof===Q||i.$$typeof===R)},V.typeOf=N,V}var U={};var ge;function Ae(){return ge||(ge=1,process.env.NODE_ENV!=="production"&&(function(){var s=typeof Symbol=="function"&&Symbol.for,n=s?Symbol.for("react.element"):60103,c=s?Symbol.for("react.portal"):60106,a=s?Symbol.for("react.fragment"):60107,g=s?Symbol.for("react.strict_mode"):60108,p=s?Symbol.for("react.profiler"):60114,C=s?Symbol.for("react.provider"):60109,E=s?Symbol.for("react.context"):60110,T=s?Symbol.for("react.async_mode"):60111,d=s?Symbol.for("react.concurrent_mode"):60111,h=s?Symbol.for("react.forward_ref"):60112,w=s?Symbol.for("react.suspense"):60113,q=s?Symbol.for("react.suspense_list"):60120,$=s?Symbol.for("react.memo"):60115,Y=s?Symbol.for("react.lazy"):60116,R=s?Symbol.for("react.block"):60121,A=s?Symbol.for("react.fundamental"):60117,B=s?Symbol.for("react.responder"):60118,Q=s?Symbol.for("react.scope"):60119;function N(f){return typeof f=="string"||typeof f=="function"||f===a||f===d||f===p||f===g||f===w||f===q||typeof f=="object"&&f!==null&&(f.$$typeof===Y||f.$$typeof===$||f.$$typeof===C||f.$$typeof===E||f.$$typeof===h||f.$$typeof===A||f.$$typeof===B||f.$$typeof===Q||f.$$typeof===R)}function k(f){if(typeof f=="object"&&f!==null){var re=f.$$typeof;switch(re){case n:var oe=f.type;switch(oe){case T:case d:case a:case p:case g:case w:return oe;default:var he=oe&&oe.$$typeof;switch(he){case E:case h:case Y:case $:case C:return he;default:return re}}case c:return re}}}var i=T,O=d,K=E,S=C,e=n,t=h,l=a,o=Y,y=$,j=c,W=p,G=g,b=w,H=!1;function v(f){return H||(H=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),r(f)||k(f)===T}function r(f){return k(f)===d}function u(f){return k(f)===E}function P(f){return k(f)===C}function D(f){return typeof f=="object"&&f!==null&&f.$$typeof===n}function _(f){return k(f)===h}function L(f){return k(f)===a}function I(f){return k(f)===Y}function M(f){return k(f)===$}function z(f){return k(f)===c}function Z(f){return k(f)===p}function F(f){return k(f)===g}function ee(f){return k(f)===w}U.AsyncMode=i,U.ConcurrentMode=O,U.ContextConsumer=K,U.ContextProvider=S,U.Element=e,U.ForwardRef=t,U.Fragment=l,U.Lazy=o,U.Memo=y,U.Portal=j,U.Profiler=W,U.StrictMode=G,U.Suspense=b,U.isAsyncMode=v,U.isConcurrentMode=r,U.isContextConsumer=u,U.isContextProvider=P,U.isElement=D,U.isForwardRef=_,U.isFragment=L,U.isLazy=I,U.isMemo=M,U.isPortal=z,U.isProfiler=Z,U.isStrictMode=F,U.isSuspense=ee,U.isValidElementType=N,U.typeOf=k})()),U}var ve;function Te(){return ve||(ve=1,process.env.NODE_ENV==="production"?ie.exports=ke():ie.exports=Ae()),ie.exports}var ae,we;function Le(){if(we)return ae;we=1;var s=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,c=Object.prototype.propertyIsEnumerable;function a(p){if(p==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(p)}function g(){try{if(!Object.assign)return!1;var p=new String("abc");if(p[5]="de",Object.getOwnPropertyNames(p)[0]==="5")return!1;for(var C={},E=0;E<10;E++)C["_"+String.fromCharCode(E)]=E;var T=Object.getOwnPropertyNames(C).map(function(h){return C[h]});if(T.join("")!=="0123456789")return!1;var d={};return"abcdefghijklmnopqrst".split("").forEach(function(h){d[h]=h}),Object.keys(Object.assign({},d)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return ae=g()?Object.assign:function(p,C){for(var E,T=a(p),d,h=1;h<arguments.length;h++){E=Object(arguments[h]);for(var w in E)n.call(E,w)&&(T[w]=E[w]);if(s){d=s(E);for(var q=0;q<d.length;q++)c.call(E,d[q])&&(T[d[q]]=E[d[q]])}}return T},ae}var ue,me;function pe(){if(me)return ue;me=1;var s="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return ue=s,ue}var ce,Se;function Re(){return Se||(Se=1,ce=Function.call.bind(Object.prototype.hasOwnProperty)),ce}var le,be;function ze(){if(be)return le;be=1;var s=function(){};if(process.env.NODE_ENV!=="production"){var n=pe(),c={},a=Re();s=function(p){var C="Warning: "+p;typeof console<"u"&&console.error(C);try{throw new Error(C)}catch{}}}function g(p,C,E,T,d){if(process.env.NODE_ENV!=="production"){for(var h in p)if(a(p,h)){var w;try{if(typeof p[h]!="function"){var q=Error((T||"React class")+": "+E+" type `"+h+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof p[h]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw q.name="Invariant Violation",q}w=p[h](C,h,T,E,null,n)}catch(Y){w=Y}if(w&&!(w instanceof Error)&&s((T||"React class")+": type specification of "+E+" `"+h+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof w+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),w instanceof Error&&!(w.message in c)){c[w.message]=!0;var $=d?d():"";s("Failed "+E+" type: "+w.message+($??""))}}}}return g.resetWarningCache=function(){process.env.NODE_ENV!=="production"&&(c={})},le=g,le}var de,xe;function Fe(){if(xe)return de;xe=1;var s=Te(),n=Le(),c=pe(),a=Re(),g=ze(),p=function(){};process.env.NODE_ENV!=="production"&&(p=function(E){var T="Warning: "+E;typeof console<"u"&&console.error(T);try{throw new Error(T)}catch{}});function C(){return null}return de=function(E,T){var d=typeof Symbol=="function"&&Symbol.iterator,h="@@iterator";function w(r){var u=r&&(d&&r[d]||r[h]);if(typeof u=="function")return u}var q="<<anonymous>>",$={array:B("array"),bigint:B("bigint"),bool:B("boolean"),func:B("function"),number:B("number"),object:B("object"),string:B("string"),symbol:B("symbol"),any:Q(),arrayOf:N,element:k(),elementType:i(),instanceOf:O,node:t(),objectOf:S,oneOf:K,oneOfType:e,shape:o,exact:y};function Y(r,u){return r===u?r!==0||1/r===1/u:r!==r&&u!==u}function R(r,u){this.message=r,this.data=u&&typeof u=="object"?u:{},this.stack=""}R.prototype=Error.prototype;function A(r){if(process.env.NODE_ENV!=="production")var u={},P=0;function D(L,I,M,z,Z,F,ee){if(z=z||q,F=F||M,ee!==c){if(T){var f=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use `PropTypes.checkPropTypes()` to call them. Read more at http://fb.me/use-check-prop-types");throw f.name="Invariant Violation",f}else if(process.env.NODE_ENV!=="production"&&typeof console<"u"){var re=z+":"+M;!u[re]&&P<3&&(p("You are manually calling a React.PropTypes validation function for the `"+F+"` prop on `"+z+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),u[re]=!0,P++)}}return I[M]==null?L?I[M]===null?new R("The "+Z+" `"+F+"` is marked as required "+("in `"+z+"`, but its value is `null`.")):new R("The "+Z+" `"+F+"` is marked as required in "+("`"+z+"`, but its value is `undefined`.")):null:r(I,M,z,Z,F)}var _=D.bind(null,!1);return _.isRequired=D.bind(null,!0),_}function B(r){function u(P,D,_,L,I,M){var z=P[D],Z=G(z);if(Z!==r){var F=b(z);return new R("Invalid "+L+" `"+I+"` of type "+("`"+F+"` supplied to `"+_+"`, expected ")+("`"+r+"`."),{expectedType:r})}return null}return A(u)}function Q(){return A(C)}function N(r){function u(P,D,_,L,I){if(typeof r!="function")return new R("Property `"+I+"` of component `"+_+"` has invalid PropType notation inside arrayOf.");var M=P[D];if(!Array.isArray(M)){var z=G(M);return new R("Invalid "+L+" `"+I+"` of type "+("`"+z+"` supplied to `"+_+"`, expected an array."))}for(var Z=0;Z<M.length;Z++){var F=r(M,Z,_,L,I+"["+Z+"]",c);if(F instanceof Error)return F}return null}return A(u)}function k(){function r(u,P,D,_,L){var I=u[P];if(!E(I)){var M=G(I);return new R("Invalid "+_+" `"+L+"` of type "+("`"+M+"` supplied to `"+D+"`, expected a single ReactElement."))}return null}return A(r)}function i(){function r(u,P,D,_,L){var I=u[P];if(!s.isValidElementType(I)){var M=G(I);return new R("Invalid "+_+" `"+L+"` of type "+("`"+M+"` supplied to `"+D+"`, expected a single ReactElement type."))}return null}return A(r)}function O(r){function u(P,D,_,L,I){if(!(P[D]instanceof r)){var M=r.name||q,z=v(P[D]);return new R("Invalid "+L+" `"+I+"` of type "+("`"+z+"` supplied to `"+_+"`, expected ")+("instance of `"+M+"`."))}return null}return A(u)}function K(r){if(!Array.isArray(r))return process.env.NODE_ENV!=="production"&&(arguments.length>1?p("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):p("Invalid argument supplied to oneOf, expected an array.")),C;function u(P,D,_,L,I){for(var M=P[D],z=0;z<r.length;z++)if(Y(M,r[z]))return null;var Z=JSON.stringify(r,function(ee,f){var re=b(f);return re==="symbol"?String(f):f});return new R("Invalid "+L+" `"+I+"` of value `"+String(M)+"` "+("supplied to `"+_+"`, expected one of "+Z+"."))}return A(u)}function S(r){function u(P,D,_,L,I){if(typeof r!="function")return new R("Property `"+I+"` of component `"+_+"` has invalid PropType notation inside objectOf.");var M=P[D],z=G(M);if(z!=="object")return new R("Invalid "+L+" `"+I+"` of type "+("`"+z+"` supplied to `"+_+"`, expected an object."));for(var Z in M)if(a(M,Z)){var F=r(M,Z,_,L,I+"."+Z,c);if(F instanceof Error)return F}return null}return A(u)}function e(r){if(!Array.isArray(r))return process.env.NODE_ENV!=="production"&&p("Invalid argument supplied to oneOfType, expected an instance of array."),C;for(var u=0;u<r.length;u++){var P=r[u];if(typeof P!="function")return p("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+H(P)+" at index "+u+"."),C}function D(_,L,I,M,z){for(var Z=[],F=0;F<r.length;F++){var ee=r[F],f=ee(_,L,I,M,z,c);if(f==null)return null;f.data&&a(f.data,"expectedType")&&Z.push(f.data.expectedType)}var re=Z.length>0?", expected one of type ["+Z.join(", ")+"]":"";return new R("Invalid "+M+" `"+z+"` supplied to "+("`"+I+"`"+re+"."))}return A(D)}function t(){function r(u,P,D,_,L){return j(u[P])?null:new R("Invalid "+_+" `"+L+"` supplied to "+("`"+D+"`, expected a ReactNode."))}return A(r)}function l(r,u,P,D,_){return new R((r||"React class")+": "+u+" type `"+P+"."+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+_+"`.")}function o(r){function u(P,D,_,L,I){var M=P[D],z=G(M);if(z!=="object")return new R("Invalid "+L+" `"+I+"` of type `"+z+"` "+("supplied to `"+_+"`, expected `object`."));for(var Z in r){var F=r[Z];if(typeof F!="function")return l(_,L,I,Z,b(F));var ee=F(M,Z,_,L,I+"."+Z,c);if(ee)return ee}return null}return A(u)}function y(r){function u(P,D,_,L,I){var M=P[D],z=G(M);if(z!=="object")return new R("Invalid "+L+" `"+I+"` of type `"+z+"` "+("supplied to `"+_+"`, expected `object`."));var Z=n({},P[D],r);for(var F in Z){var ee=r[F];if(a(r,F)&&typeof ee!="function")return l(_,L,I,F,b(ee));if(!ee)return new R("Invalid "+L+" `"+I+"` key `"+F+"` supplied to `"+_+"`.\nBad object: "+JSON.stringify(P[D],null," ")+`
|
|
2
|
+
Valid keys: `+JSON.stringify(Object.keys(r),null," "));var f=ee(M,F,_,L,I+"."+F,c);if(f)return f}return null}return A(u)}function j(r){switch(typeof r){case"number":case"string":case"undefined":return!0;case"boolean":return!r;case"object":if(Array.isArray(r))return r.every(j);if(r===null||E(r))return!0;var u=w(r);if(u){var P=u.call(r),D;if(u!==r.entries){for(;!(D=P.next()).done;)if(!j(D.value))return!1}else for(;!(D=P.next()).done;){var _=D.value;if(_&&!j(_[1]))return!1}}else return!1;return!0;default:return!1}}function W(r,u){return r==="symbol"?!0:u?u["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&u instanceof Symbol:!1}function G(r){var u=typeof r;return Array.isArray(r)?"array":r instanceof RegExp?"object":W(u,r)?"symbol":u}function b(r){if(typeof r>"u"||r===null)return""+r;var u=G(r);if(u==="object"){if(r instanceof Date)return"date";if(r instanceof RegExp)return"regexp"}return u}function H(r){var u=b(r);switch(u){case"array":case"object":return"an "+u;case"boolean":case"date":case"regexp":return"a "+u;default:return u}}function v(r){return!r.constructor||!r.constructor.name?q:r.constructor.name}return $.checkPropTypes=g,$.resetWarningCache=g.resetWarningCache,$.PropTypes=$,$},de}var fe,Ee;function Ye(){if(Ee)return fe;Ee=1;var s=pe();function n(){}function c(){}return c.resetWarningCache=n,fe=function(){function a(C,E,T,d,h,w){if(w!==s){var q=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw q.name="Invariant Violation",q}}a.isRequired=a;function g(){return a}var p={array:a,bigint:a,bool:a,func:a,number:a,object:a,string:a,symbol:a,any:a,arrayOf:g,element:a,elementType:a,instanceOf:g,node:a,objectOf:g,oneOf:g,oneOfType:g,shape:g,exact:g,checkPropTypes:c,resetWarningCache:n};return p.PropTypes=p,p},fe}var Ce;function Ve(){if(Ce)return se.exports;if(Ce=1,process.env.NODE_ENV!=="production"){var s=Te(),n=!0;se.exports=Fe()(s.isElement,n)}else se.exports=Ye()();return se.exports}var Ue=Ve();const m=qe(Ue);var X={},je;function We(){if(je)return X;je=1;function s(e){return e?/^[a-zA-Z][a-zA-Z0-9_-]{2,50}$/.test(e):!1}X.isValidUserName=s;function n(e){return e?/^[A-Za-z' -]{2,50}$/.test(e):!1}X.isValidName=n;function c(e){return e?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(e):!1}X.isValidEmail=c;function a(e){return e?/^[0-9]{10,15}$/g.test(e):!1}X.isValidPhoneNum=a;function g(e){return e?/^[a-zA-Z0-9.\-\(\) ]{2,}$/.test(e):!1}X.isValidOrganisationName=g;function p(e){return!(!e||e.length<6||/[A-Z]/.test(e)===!1||/[a-z]/.test(e)===!1||/[0-9]/.test(e)===!1||/[\s]/.test(e)||/[\][!"#$%&'()*+,./:;<=>?@^\\_`{|}~-]/.test(e)===!1)}X.isValidPassword=p;function C(e){let t=e.getFullYear(),l=e.getMonth()+1;l=T(l,2);let o=e.getDate();return o=T(o,2),`${t}-${l}-${o}`}X.timeStampYyyyMmDd=C;function E(e){let t=T(e.getHours(),2),l=T(e.getMinutes(),2),o=T(e.getSeconds(),2),y=T(e.getMilliseconds(),3);return`${C(e)}T${t}:${l}:${o}.${y}`}X.timeStampString=E;function T(e,t){let l=e+"";const o=t-l.length;for(let y=1;y<=o;y++)l="0"+l;return l}X.addLeadingZeros=T;function d(e){return new Intl.NumberFormat("en-US",{style:"currency",currency:"ZAR"}).format(e).replace(/ZAR/gi,"R")}X.toZarCurrencyFormat=d;function h(e){if(Object.prototype.toString.call(e)!=="[object Object]")return e instanceof Date?new Date(e):Array.isArray(e)?e.map(l=>h(l)):(["string","number","boolean"].includes(typeof e),e);const t={};for(const l in e){const o=e[l];Object.prototype.toString.call(o)==="[object Object]"?t[l]=h(o):o instanceof Date?t[l]=new Date(o):Array.isArray(o)?t[l]=o.map(y=>h(y)):(["string","number","boolean"].includes(typeof o),t[l]=o)}return t}X.deepClone=h;function w(e){const t=[];if(Object.prototype.toString.call(e)!=="[object Object]")return t;for(const l in e){const o=w(e[l]);o.length>0?o.forEach(y=>{t.push(l+"."+y)}):t.push(l)}return t}X.getPaths=w;function q(e){const t=h(e),l=[],o={};for(let y in t)l.push(y);l.sort();for(let y in l){const j=l[y];Object.prototype.toString.call(t[j])==="[object Object]"?o[j]=q(t[j]):o[j]=t[j]}return o}X.getSortedObject=q;function $(e,t,l=void 0){if(w(e).includes(t)===!1)return l;let o=t.split("."),y=e[o[0]];return o.length>1?(o.splice(0,1),$(y,o.join("."))):h(y)}X.get=$;function Y(e,t,l){let o=t.split(".");if(o.length>1){e[o[0]]||(e[o[0]]={});const y=e[o[0]];o.splice(0,1),Y(y,o.join("."),l)}else e[o[0]]=l}X.set=Y;function R(e,t){let l=t.split(".");if(l.length>1){const o=e[l[0]];l.splice(0,1),R(o,l.join("."))}else delete e[l[0]]}X.unset=R;function A(e,...t){if(!t||!t.length)throw new Error("fields must be specified");const l=w(e);let o=0;for(const y in l){const j=l[y];if(t.includes(j))o++;else return!1}return o>0}X.hasOnly=A;function B(e,...t){if(!t||!t.length)throw new Error("fields must be specified");const l=w(e);let o=0;for(const y in t){const j=t[y];if(l.includes(j))o++;else return!1}return o===t.length}X.hasAll=B;function Q(e,...t){return A(e,...t)&&B(e,...t)}X.hasOnlyAll=Q;function N(e,t,l=0,o="asc"){const y=["asc","desc"];if(!["asc","desc"].includes(o))throw new Error(`arraySortDir must be one of ${y}`);if(e.length===0)return-1;let j=l,W=e.length-1;for(;j<W;){if(k(e[j],t)===0)return j;if(k(e[W],t)===0)return W;const G=Math.trunc((j+W)/2),b=k(e[G],t,o);if(b<0)j=G+1;else if(b>0)W=G-1;else return G}return j}X.binarySearch=N;function k(e,t,l="asc"){if(!["asc","desc"].includes(l))throw new Error(`sortDir must be one of ${l}`);const o=l==="desc"?-1:1;return e>t?o:e<t?-o:0}X.compare=k;function i(e,t,l=0,...o){if(e.length===0)return-1;let y=l,j=e.length-1;for(;y<j;){if(S(e[y],t,...o)===0)return y;if(S(e[j],t,...o)===0)return j;let W=Math.trunc((y+j)/2);if(S(e[W],t,...o)<0)y=W+1;else if(S(e[W],t,...o)>0)j=W-1;else return W}return y}X.binarySearchObj=i;function O(e,t,l,...o){let y=l,j=e.length-1;if(y>=e.length)throw new Error("startFrom is outside the bounds of the array.");if(S(t,e[y],...o)>0)throw new Error("targetObj is to the right ('greater than') objArray[startFrom].");for(;y<j;){let W=Math.trunc((y+j)/2);S(t,e[W],...o)===0?y=W+1:S(t,e[W],...o)<0&&(j=W)}return S(t,e[y],...o)===0?-1:y}X.getNextDifferent=O;function K(e,t,...l){if(e.length<=1)return[...e];if(typeof t!="boolean")throw new Error("firstOfDuplicates must be boolean true or false.");const o=[];let y=0;for(;y<e.length-1&&(t&&o.push(e[y]),y=O(e,e[y],y+1,...l),!(y<0));){let j=y-1;t||o.push(e[j])}return o.length===0?t?o.push(e[0]):o.push(e[e.length-1]):S(o[o.length-1],e[e.length-1],...l)!==0&&o.push(e[e.length-1]),o}X.getObjArrayWithNoDuplicates=K;function S(e,t,...l){if(l.length===0)throw new Error("comparisonFields not supplied!");const o=["","asc","desc"];for(const y in l){const j=l[y].split(" "),W=j[0];let G="";if(j.length===2&&(G=j[1]),!o.includes(G))throw new Error("Sort direction must be one of "+o.toString());const b=$(e,W),H=$(t,W),v=G==="desc"?-1:1;if(b>H)return v;if(b<H)return-v}return 0}return X.objCompare=S,X}var te=We();const $e=J.createContext();function Oe({children:s}){const n=J.useRef({});function c(d,h,w=null,q=!0,...$){if(a(d))throw new Error(`The collection ${d} already exists.`);q?n.current[d]=new Ze(d,h,w,...$):n.current[d]=new Pe(d,h,w,...$)}function a(d){return n.current[d]!==void 0}function g(d,h){if(!a(d))throw new Error(`Collection ${d} not found.`);n.current[d].updateData(h)}function p(d){if(!a(d))throw new Error(`Collection ${d} not found.`);return n.current[d].getData()}function C(d,h){if(!a(d))throw new Error(`Collection ${d} not found.`);n.current[d].setSelectedItems(h)}function E(d){if(!a(d))throw new Error(`Collection ${d} not found.`);return n.current[d].getSelectedItems()}function T(d){if(!a(d))throw new Error(`Collection ${d} not found.`);return n.current[d].getMaxNumSelections()}return x.jsx($e.Provider,{value:{addCollection:c,collectionExists:a,getCollectionData:p,updateCollection:g,setSelected:C,getSelected:E,getMaxNumSelections:T},children:s})}Oe.propTypes={children:m.element.isRequired};function ne(){return J.useContext($e)}class Pe{constructor(n,c,a=null,...g){this.sortFields=g,this.collectionName=n,this.selectedItems=[],this.maxNumSelections=a,this.data=[...c],this.sortData()}sortData(){this.data.sort(this.comparisonFunction)}comparisonFunction=(n,c)=>{if(Object.prototype.toString.call(n)==="[object Object]"&&Object.prototype.toString.call(c)==="[object Object]"){if(this.sortFields.length>0)return te.objCompare(n,c,...this.sortFields)}else{if(this.sortFields.length===1)return te.compare(n,c,this.sortFields[0]);if(this.sortFields.length===0)return te.compare(n,c);throw new Error("Only 1 sort order can be provided for a primitive data type collection.")}return 0};updateData(n){this.data=[...n],this.sortData();let c=null;this.selectedItems=this.selectedItems.filter(a=>this.data.findIndex(g=>(c===null&&(c=te.getPaths(g)),te.objCompare(g,a,...c)===0))>=0),this.selectedItems=this.selectedItems.toSorted(this.comparisonFunction)}setSelectedItems(n){if(this.maxNumSelections!==null&&n.length>this.maxNumSelections)return;let c=te.getPaths(this.data[0]);n=n.filter(a=>this.data.findIndex(g=>te.objCompare(g,a,...c)===0)>=0),this.selectedItems=n.toSorted(this.comparisonFunction)}getData(){return this.data}getSelectedItems(){return this.selectedItems}getCollectionName(){return this.collectionName}getMaxNumSelections(){return this.maxNumSelections}}class Ze extends Pe{constructor(n,c,a=null,...g){super(n,c,a,...g)}comparisonFunction(n,c){return te.compare(n,c,this.sortFields[0])}sortData(n){this.data.sort(this.comparisonFunction)}updateData(n){this.data=[...n],this.sortData(),this.selectedItems=this.selectedItems.filter(c=>this.data.findIndex(a=>a===c)>=0),this.selectedItems=this.selectedItems.toSorted(this.comparisonFunction)}setSelectedItems(n){if(this.maxNumSelections!==null&&n.length>this.maxNumSelections)throw new Error("Selected items exceed the maximum number of allowed selections.");n=n.filter(c=>this.data.findIndex(a=>a===c)>=0),this.selectedItems=n.toSorted(this.comparisonFunction)}}function _e({label:s,collectionName:n,onItemSelected:c=null,dropdownStyle:a,isDisabled:g=!1}){const{getCollectionData:p,setSelected:C,getSelected:E,collectionExists:T}=ne(),[d]=J.useState(()=>{const O={backgroundColor:a?.backgroundColor,color:a?.color};return a?.fontSize&&(O.fontSize=a?.fontSize),O}),h=a?.borderColor,[w,q]=J.useState(!1),[$,Y]=J.useState(""),[R,A]=J.useState([]);async function B(O){Y(O.target.value);let K=[];K=p(n),K=K.filter(S=>{const e=S.toUpperCase(),t=O.target.value.toUpperCase();return e.includes(t)}),A(K),K.length===0?k():i()}async function Q(O){Y(O),C(n,[O]),c!==null&&c(),k()}function N(){w?k():i()}function k(){q(!1)}function i(){R.length>0&&q(!0)}return J.useEffect(()=>{if(T(n))try{let O;O=p(n),A(O);const K=E(n);K.length>0?Y(K[0]):Y("")}catch{}},[T(n)]),x.jsxs("div",{className:`dropdown-js dropdown-js-rounded
|
|
3
|
+
${h&&`dropdown-js-border ${h}`}`,style:{...g?{pointerEvents:"none"}:{}},children:[x.jsxs("div",{className:"dropdown-js-input-wrapper dropdown-js-rounded",style:d,children:[x.jsx("input",{className:"dropdown-js-input dropdown-js-rounded",autoComplete:"off",type:"text",id:"searchDropDown",name:"searchDropDown",style:d,"aria-label":`Type to Search for ${s}`,"aria-required":!0,onChange:O=>B(O),disabled:g,placeholder:`Type to Search for ${s}`,value:$}),x.jsx("div",{className:"dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",onClick:O=>N(),children:x.jsx("span",{className:"dropdown-js-arrow dropdown-js-padding",children:w?"-":"+"})})]}),x.jsx("div",{className:`dropdown-js-padding dropdown-js-menu ${!w&&"dropdown-js-hide"}`,id:"dropDown",name:"dropDown",disabled:g,"aria-label":s,style:{...d,marginTop:"3.5px"},children:R.map((O,K)=>x.jsxs("div",{name:O,"aria-label":O,style:{cursor:"pointer"},onClick:S=>Q(O),children:[O,K<R.length-1&&x.jsx("hr",{style:{borderColor:d.color}})]},`${K}#${O}`))})]})}_e.propTypes={label:m.string.isRequired,collectionName:m.string.isRequired,isDisabled:m.bool,onItemSelected:m.func,dropdownStyle:m.shape({color:m.string.isRequired,backgroundColor:m.string.isRequired,fontSize:m.string,borderColor:m.string})};function De({label:s,collectionName:n,displayName:c,valueName:a,onItemSelected:g=null,dropdownStyle:p,isDisabled:C=!1}){const{getCollectionData:E,setSelected:T,getSelected:d,collectionExists:h}=ne(),[w]=J.useState(()=>{const S={backgroundColor:p?.backgroundColor,color:p?.color};return p?.fontSize&&(S.fontSize=p?.fontSize),S}),q=p?.borderColor,[$,Y]=J.useState(null),[R,A]=J.useState([]),[B,Q]=J.useState("");async function N(S){Q(S.target.value);let e=E(n);e=e.filter(t=>{const l=t[c].toUpperCase(),o=S.target.value.toUpperCase();return l.includes(o)}),A(e),K()}function k(S){Q(S[c]),T(n,[S]),g!==null&&g(),O()}function i(){$?O():K()}function O(){Y(!1)}function K(){R.length>0&&Y(!0)}return J.useEffect(()=>{if(!h(n))return;if(!c)throw new Error("displayName must be provided");if(!a)throw new Error("valueName must be provided");let S=[...E(n)];S.forEach((e,t)=>{if(!e[c])throw new Error(`Error in collection ${n}, index ${t}:
|
|
4
|
+
field ${c} found`);if(!e[a])throw new Error(`Error in collection ${n}, index ${t}:
|
|
5
|
+
field ${a} not found`)}),A(S),S=d(n),S.length>0?Q(S[0][c]):Q("")},[h(n)]),x.jsxs("div",{className:`dropdown-js dropdown-js-rounded
|
|
6
|
+
${q&&`dropdown-js-border ${q}`}`,style:{...C?{pointerEvents:"none"}:{}},children:[x.jsxs("div",{className:"dropdown-js-input-wrapper dropdown-js-rounded",style:w,children:[x.jsx("input",{className:"dropdown-js-input dropdown-js-rounded",style:w,type:"text",id:"searchDropDown",name:"searchDropDown",autoComplete:"off","aria-label":`Type to Search for ${s}`,"aria-required":!0,onChange:S=>N(S),disabled:C,placeholder:`Type to Search for ${s}`,value:B}),x.jsx("div",{className:"dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",onClick:S=>i(),children:x.jsx("span",{className:"dropdown-js-arrow dropdown-js-padding",children:$?"-":"+"})})]}),x.jsx("div",{className:`dropdown-js-padding dropdown-js-menu ${!$&&"dropdown-js-hide"}`,id:"dropDown",name:"dropDown","aria-label":s,style:{...w,marginTop:"3.5px"},children:R.map((S,e)=>x.jsxs("div",{name:S[c],"aria-label":S[c],style:{cursor:"pointer"},onClick:t=>k(S),children:[S[c],e<R.length-1&&x.jsx("hr",{style:{borderColor:w.color}})]},S[a]))})]})}De.propTypes={collectionName:m.string.isRequired,label:m.string.isRequired,isDisabled:m.bool,onItemSelected:m.func,dropdownStyle:m.shape({color:m.string.isRequired,backgroundColor:m.string.isRequired,fontSize:m.string,borderColor:m.string})};function Ie({label:s,collectionName:n,displayName:c,valueName:a,isDisabled:g=!1,onItemsSelected:p=null,dropdownStyle:C,buttonStyle:E}){const{collectionExists:T,getCollectionData:d,setSelected:h,getSelected:w,getMaxNumSelections:q}=ne(),[$,Y]=J.useState(!1),[R,A]=J.useState([]),[B,Q]=J.useState([]),[N,k]=J.useState(""),[i,O]=J.useState(Math.random()),[K,S]=J.useState(Math.random),e=1e-12,[t]=J.useState(()=>{const v={backgroundColor:C?.backgroundColor,color:C?.color};return C?.fontSize&&(v.fontSize=C?.fontSize),v}),l=C?.borderColor;J.useEffect(()=>{if(!T(n))return;if(!c)throw new Error("displayName must be provided");if(!a)throw new Error("valueName must be provided");const v=[...d(n)];v.forEach((u,P)=>{if(!u[c])throw new Error(`Error in collection ${n}, index ${P}:
|
|
7
|
+
field ${c} found`);if(!u[a])throw new Error(`Error in collection ${n}, index ${P}:
|
|
8
|
+
field ${a} not found`)}),A(v);const r=[...w(n)];Q(r)},[T(n)]);function o(v){k(v.target.value);const r=[...d(n).filter(u=>{const P=u[c].toUpperCase(),D=v.target.value.toUpperCase();return P.includes(D)})];A(r),r.length>0?H():b(),O(i+e)}function y(v){let r=[...B];if(j(v))r=r.filter(u=>JSON.stringify(u)!==JSON.stringify(v));else{const u=q(n);if(u!==null&&B.length>=u)return;r.push(v)}h(n,r),Q(r),S(K+e)}function j(v){return B.findIndex(r=>JSON.stringify(r)===JSON.stringify(v))>=0}function W(v){const r=B.filter(u=>JSON.stringify(u)!==JSON.stringify(v));Q(r),h(n,r),S(K+e),p!==null&&p()}function G(){$?b():H()}function b(){Y(!1),p!==null&&p()}function H(){R.length>0&&Y(!0)}return x.jsxs("div",{className:`dropdown-js dropdown-js-rounded
|
|
9
|
+
${l&&`dropdown-js-border ${l}`}`,style:{...g?{pointerEvents:"none"}:{}},children:[x.jsxs("div",{className:"dropdown-js-input-wrapper dropdown-js-rounded",style:t,children:[x.jsx("div",{children:x.jsx("input",{className:"dropdown-js-input dropdown-js-rounded",style:t,type:"text",id:"searchDropDown",name:"searchDropDown",autoComplete:"off","aria-label":`Type to Search for ${s}`,"aria-required":!0,onChange:v=>o(v),placeholder:`Type to Search for ${s}`,value:N})}),x.jsx("div",{className:"dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",onClick:v=>G(),children:x.jsx("span",{className:"dropdown-js-arrow dropdown-js-padding",children:$?"-":"+"})})]}),x.jsx("div",{className:"dropdown-js-padding dropdown-js-selected-wrapper dropdown-js-selected-container",children:x.jsx("div",{className:"dropdown-js-selected-items",children:B.map(v=>x.jsxs("span",{className:"dropdown-js-padding dropdown-js-rounded",style:{...t,margin:"3.5px",marginRight:"0px"},children:[v[c]," ",x.jsx("span",{className:"dropdown-js-padding",style:{cursor:"pointer"},onClick:r=>W(v),children:"×"})]},`${v[a]}${v[c]}`))},K)}),x.jsxs("div",{className:`dropdown-js-padding dropdown-js-menu dropdown-js-rounded ${!$&&"dropdown-js-hide"}`,style:t,id:"dropDown",name:"dropDown","aria-label":s,children:[R.map(v=>x.jsxs("div",{"aria-label":v[c],children:[x.jsx("input",{type:"checkbox",name:`${v[c]}Checkbox`,style:{cursor:"pointer"},checked:j(v),onChange:r=>y(v),value:v[a]}),x.jsx("label",{style:{marginLeft:"5px"},htmlFor:`${v[c]}`,children:v[c]}),x.jsx("hr",{style:{borderColor:t.color}})]},`${v[a]}${v[c]}`)),x.jsx("button",{className:"dropdown-js-padding dropdown-js-round",style:E,title:"Done",disabled:R.length===0,onClick:v=>b(),type:"button",children:"Done"})]},i)]})}Ie.propTypes={label:m.string.isRequired,collectionName:m.string.isRequired,displayName:m.string.isRequired,valueName:m.string.isRequired,isDisabled:m.bool,selectedItem:m.array,onItemsSelected:m.func,dropdownStyle:m.shape({color:m.string.isRequired,backgroundColor:m.string.isRequired,fontSize:m.string,borderColor:m.string}),buttonStyle:m.shape({color:m.string.isRequired,backgroundColor:m.string.isRequired,fontSize:m.string,borderColor:m.string})};function Me({label:s,collectionName:n,isDisabled:c=!1,onItemsSelected:a=null,dropdownStyle:g,buttonStyle:p}){const{getCollectionData:C,setSelected:E,getSelected:T,getMaxNumSelections:d,collectionExists:h}=ne(),[w,q]=J.useState(!1),[$,Y]=J.useState([]),[R,A]=J.useState([]),[B,Q]=J.useState(""),[N,k]=J.useState(Math.random()),[i,O]=J.useState(Math.random()),K=.001,[S]=J.useState(()=>{const b={backgroundColor:g?.backgroundColor,color:g?.color};return g?.fontSize&&(b.fontSize=g?.fontSize),b}),e=g?.borderColor;J.useEffect(()=>{if(!h(n))return;Y(C(n));const b=T(n);A(b)},[h(n)]);function t(b){Q(b.target.value);let H=C(n).filter(v=>{const r=v.toUpperCase(),u=b.target.value.toUpperCase();return r.includes(u)});Y(H),H.length>0?G():W(),k(N+K)}function l(b){let H=[...R];if(o(b))H=H.filter(v=>v!==b);else{const v=d(n);if(v!==null&&R.length>=v)return;H.push(b)}E(n,H),A(H),O(i+K)}function o(b){return R.findIndex(H=>H===b)>=0}function y(b){const H=R.filter(v=>v!==b);A(H),O(i+K),E(n,H),a!==null&&a()}function j(){w?W():G()}function W(){q(!1),a!==null&&a()}function G(){$.length>0&&q(!0)}return x.jsxs("div",{className:`dropdown-js dropdown-js-rounded
|
|
10
|
+
${e&&`dropdown-js-border ${e}`}`,style:{...c?{pointerEvents:"none"}:{}},children:[x.jsxs("div",{className:"dropdown-js-input-wrapper dropdown-js-rounded",style:S,children:[x.jsx("div",{children:x.jsx("input",{className:"dropdown-js-input dropdown-js-rounded",style:S,type:"text",id:"searchDropDown",name:"searchDropDown",autoComplete:"off","aria-label":`Type to search for ${s}`,"aria-required":!0,onChange:b=>t(b),placeholder:`Type to Search for ${s}`,value:B})}),x.jsx("div",{className:"dropdown-js-arrow-container dropdown-js-padding dropdown-js-rounded",onClick:b=>j(),children:x.jsx("span",{className:"dropdown-js-arrow dropdown-js-padding",children:w?"-":"+"})})]}),x.jsx("div",{className:"dropdown-js-padding dropdown-js-selected-wrapper dropdown-js-selected-container",children:x.jsx("div",{className:"dropdown-js-selected-items",children:R.map((b,H)=>x.jsxs("span",{className:"dropdown-js-padding dropdown-js-rounded",style:{...S,margin:"3.5px",marginRight:"0px"},children:[b," ",x.jsx("span",{style:{cursor:"pointer"},onClick:v=>y(b),children:"×"})]},`${b}`))},i)}),x.jsxs("div",{className:`dropdown-js-padding dropdown-js-menu dropdown-js-rounded ${!w&&"dropdown-js-hide"}`,style:S,id:"dropDown",name:"dropDown","aria-label":s,children:[$.map((b,H)=>x.jsxs("div",{"aria-label":b,children:[x.jsx("input",{type:"checkbox",name:`${b}Checkbox`,style:{cursor:"pointer"},checked:o(b),onChange:v=>l(b),value:b}),x.jsx("label",{style:{marginLeft:"5px"},htmlFor:`${b}`,children:b}),x.jsx("hr",{style:{borderColor:S.color}})]},`${H}#${b}`)),x.jsx("button",{className:"dropdown-js-padding dropdown-js-round",style:p,title:"Done",disabled:$.length===0,onClick:b=>W(),type:"button",children:"Done"})]},N)]})}Me.propTypes={label:m.string.isRequired,collectionName:m.string.isRequired,isDisabled:m.bool,selectedItem:m.array,onItemsSelected:m.func,dropdownStyle:m.shape({color:m.string.isRequired,backgroundColor:m.string.isRequired,fontSize:m.string,borderColor:m.string}),buttonStyle:m.shape({color:m.string.isRequired,backgroundColor:m.string.isRequired,fontSize:m.string,borderColor:m.string})};exports.CollectionsProvider=Oe;exports.Dropdown=_e;exports.DropdownObj=De;exports.MultiSelectionDropdown=Me;exports.MultiSelectionDropdownObj=Ie;exports.useCollectionsContext=ne;
|