@minimalstuff/ui 0.0.15 → 0.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +184 -2
- package/dist/index.es.js +1143 -449
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +8 -8
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(c,h){typeof exports=="object"&&typeof module<"u"?h(exports,require("@emotion/styled"),require("react"),require("@emotion/react"),require("react-hotkeys-hook"),require("hex-rgb"),require("tinycolor2"),require("react-dom"),require("react-toggle"),require("react-select")):typeof define=="function"&&define.amd?define(["exports","@emotion/styled","react","@emotion/react","react-hotkeys-hook","hex-rgb","tinycolor2","react-dom","react-toggle","react-select"],h):(c=typeof globalThis<"u"?globalThis:c||self,h(c["@minimalstuff/ui"]={},c.styled,c.React,c.react,c.reactHotkeysHook,c.hexRgb,c.tinycolor,c.ReactDOM,c.Toggle,c.Select))})(this,function(c,h,y,O,sr,cr,de,ur,dr,fr){"use strict";const pr=h.button(({theme:r,danger:t=!1,secondary:n=!1})=>{const a=t?r.colors.red.default:r.colors.blue.default,s=t?r.colors.red.dark:r.colors.blue.dark,u=n?a:r.colors.white,x=n?"transparent":a;return{cursor:"pointer",width:"100%",textTransform:"uppercase",fontSize:r.fontSizes.m,color:u,background:x,padding:"0.75em",border:`1px solid ${a}`,borderRadius:r.borders.radius.m,transition:r.transitions.delay.fast,"&:disabled":{cursor:"not-allowed",opacity:"0.5"},"&:not(:disabled):hover":{background:n?r.colors.secondary:s,borderColor:n?r.colors.secondary:s}}});var Q={exports:{}},Y={};/**
|
|
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
|
|
9
|
+
*/var fe;function br(){if(fe)return Y;fe=1;var r=y,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),a=Object.prototype.hasOwnProperty,s=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function x(w,v,j){var b,P={},_=null,A=null;j!==void 0&&(_=""+j),v.key!==void 0&&(_=""+v.key),v.ref!==void 0&&(A=v.ref);for(b in v)a.call(v,b)&&!u.hasOwnProperty(b)&&(P[b]=v[b]);if(w&&w.defaultProps)for(b in v=w.defaultProps,v)P[b]===void 0&&(P[b]=v[b]);return{$$typeof:t,type:w,key:_,ref:A,props:P,_owner:s.current}}return Y.Fragment=n,Y.jsx=x,Y.jsxs=x,Y}var N={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,18 +14,18 @@
|
|
|
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
|
|
18
|
-
`+
|
|
19
|
-
`),
|
|
20
|
-
`),
|
|
21
|
-
`+
|
|
17
|
+
*/var pe;function gr(){return pe||(pe=1,process.env.NODE_ENV!=="production"&&function(){var r=y,t=Symbol.for("react.element"),n=Symbol.for("react.portal"),a=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),x=Symbol.for("react.provider"),w=Symbol.for("react.context"),v=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),b=Symbol.for("react.suspense_list"),P=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),A=Symbol.for("react.offscreen"),We=Symbol.iterator,qr="@@iterator";function Gr(e){if(e===null||typeof e!="object")return null;var o=We&&e[We]||e[qr];return typeof o=="function"?o:null}var L=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function S(e){{for(var o=arguments.length,i=new Array(o>1?o-1:0),l=1;l<o;l++)i[l-1]=arguments[l];Kr("error",e,i)}}function Kr(e,o,i){{var l=L.ReactDebugCurrentFrame,g=l.getStackAddendum();g!==""&&(o+="%s",i=i.concat([g]));var m=i.map(function(p){return String(p)});m.unshift("Warning: "+o),Function.prototype.apply.call(console[e],console,m)}}var Jr=!1,Xr=!1,Zr=!1,Qr=!1,et=!1,Le;Le=Symbol.for("react.module.reference");function rt(e){return!!(typeof e=="string"||typeof e=="function"||e===a||e===u||et||e===s||e===j||e===b||Qr||e===A||Jr||Xr||Zr||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===P||e.$$typeof===x||e.$$typeof===w||e.$$typeof===v||e.$$typeof===Le||e.getModuleId!==void 0))}function tt(e,o,i){var l=e.displayName;if(l)return l;var g=o.displayName||o.name||"";return g!==""?i+"("+g+")":i}function Me(e){return e.displayName||"Context"}function I(e){if(e==null)return null;if(typeof e.tag=="number"&&S("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 n:return"Portal";case u:return"Profiler";case s:return"StrictMode";case j:return"Suspense";case b:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var o=e;return Me(o)+".Consumer";case x:var i=e;return Me(i._context)+".Provider";case v:return tt(e,e.render,"ForwardRef");case P:var l=e.displayName||null;return l!==null?l:I(e.type)||"Memo";case _:{var g=e,m=g._payload,p=g._init;try{return I(p(m))}catch{return null}}}return null}var $=Object.assign,z=0,Be,Ye,Ne,ze,Ue,Ve,He;function qe(){}qe.__reactDisabledLog=!0;function ot(){{if(z===0){Be=console.log,Ye=console.info,Ne=console.warn,ze=console.error,Ue=console.group,Ve=console.groupCollapsed,He=console.groupEnd;var e={configurable:!0,enumerable:!0,value:qe,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}z++}}function nt(){{if(z--,z===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:$({},e,{value:Be}),info:$({},e,{value:Ye}),warn:$({},e,{value:Ne}),error:$({},e,{value:ze}),group:$({},e,{value:Ue}),groupCollapsed:$({},e,{value:Ve}),groupEnd:$({},e,{value:He})})}z<0&&S("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var te=L.ReactCurrentDispatcher,oe;function K(e,o,i){{if(oe===void 0)try{throw Error()}catch(g){var l=g.stack.trim().match(/\n( *(at )?)/);oe=l&&l[1]||""}return`
|
|
18
|
+
`+oe+e}}var ne=!1,J;{var at=typeof WeakMap=="function"?WeakMap:Map;J=new at}function Ge(e,o){if(!e||ne)return"";{var i=J.get(e);if(i!==void 0)return i}var l;ne=!0;var g=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var m;m=te.current,te.current=null,ot();try{if(o){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(T){l=T}Reflect.construct(e,[],p)}else{try{p.call()}catch(T){l=T}e.call(p.prototype)}}else{try{throw Error()}catch(T){l=T}e()}}catch(T){if(T&&l&&typeof T.stack=="string"){for(var d=T.stack.split(`
|
|
19
|
+
`),C=l.stack.split(`
|
|
20
|
+
`),E=d.length-1,k=C.length-1;E>=1&&k>=0&&d[E]!==C[k];)k--;for(;E>=1&&k>=0;E--,k--)if(d[E]!==C[k]){if(E!==1||k!==1)do if(E--,k--,k<0||d[E]!==C[k]){var R=`
|
|
21
|
+
`+d[E].replace(" at new "," at ");return e.displayName&&R.includes("<anonymous>")&&(R=R.replace("<anonymous>",e.displayName)),typeof e=="function"&&J.set(e,R),R}while(E>=1&&k>=0);break}}}finally{ne=!1,te.current=m,nt(),Error.prepareStackTrace=g}var B=e?e.displayName||e.name:"",W=B?K(B):"";return typeof e=="function"&&J.set(e,W),W}function it(e,o,i){return Ge(e,!1)}function lt(e){var o=e.prototype;return!!(o&&o.isReactComponent)}function X(e,o,i){if(e==null)return"";if(typeof e=="function")return Ge(e,lt(e));if(typeof e=="string")return K(e);switch(e){case j:return K("Suspense");case b:return K("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case v:return it(e.render);case P:return X(e.type,o,i);case _:{var l=e,g=l._payload,m=l._init;try{return X(m(g),o,i)}catch{}}}return""}var U=Object.prototype.hasOwnProperty,Ke={},Je=L.ReactDebugCurrentFrame;function Z(e){if(e){var o=e._owner,i=X(e.type,e._source,o?o.type:null);Je.setExtraStackFrame(i)}else Je.setExtraStackFrame(null)}function st(e,o,i,l,g){{var m=Function.call.bind(U);for(var p in e)if(m(e,p)){var d=void 0;try{if(typeof e[p]!="function"){var C=Error((l||"React class")+": "+i+" 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 C.name="Invariant Violation",C}d=e[p](o,p,l,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(E){d=E}d&&!(d instanceof Error)&&(Z(g),S("%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).",l||"React class",i,p,typeof d),Z(null)),d instanceof Error&&!(d.message in Ke)&&(Ke[d.message]=!0,Z(g),S("Failed %s type: %s",i,d.message),Z(null))}}}var ct=Array.isArray;function ae(e){return ct(e)}function ut(e){{var o=typeof Symbol=="function"&&Symbol.toStringTag,i=o&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function dt(e){try{return Xe(e),!1}catch{return!0}}function Xe(e){return""+e}function Ze(e){if(dt(e))return S("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",ut(e)),Xe(e)}var V=L.ReactCurrentOwner,ft={key:!0,ref:!0,__self:!0,__source:!0},Qe,er,ie;ie={};function pt(e){if(U.call(e,"ref")){var o=Object.getOwnPropertyDescriptor(e,"ref").get;if(o&&o.isReactWarning)return!1}return e.ref!==void 0}function bt(e){if(U.call(e,"key")){var o=Object.getOwnPropertyDescriptor(e,"key").get;if(o&&o.isReactWarning)return!1}return e.key!==void 0}function gt(e,o){if(typeof e.ref=="string"&&V.current&&o&&V.current.stateNode!==o){var i=I(V.current.type);ie[i]||(S('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',I(V.current.type),e.ref),ie[i]=!0)}}function vt(e,o){{var i=function(){Qe||(Qe=!0,S("%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)",o))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}}function mt(e,o){{var i=function(){er||(er=!0,S("%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)",o))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}}var ht=function(e,o,i,l,g,m,p){var d={$$typeof:t,type:e,key:o,ref:i,props:p,_owner:m};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:l}),Object.defineProperty(d,"_source",{configurable:!1,enumerable:!1,writable:!1,value:g}),Object.freeze&&(Object.freeze(d.props),Object.freeze(d)),d};function yt(e,o,i,l,g){{var m,p={},d=null,C=null;i!==void 0&&(Ze(i),d=""+i),bt(o)&&(Ze(o.key),d=""+o.key),pt(o)&&(C=o.ref,gt(o,g));for(m in o)U.call(o,m)&&!ft.hasOwnProperty(m)&&(p[m]=o[m]);if(e&&e.defaultProps){var E=e.defaultProps;for(m in E)p[m]===void 0&&(p[m]=E[m])}if(d||C){var k=typeof e=="function"?e.displayName||e.name||"Unknown":e;d&&vt(p,k),C&&mt(p,k)}return ht(e,d,C,g,l,V.current,p)}}var le=L.ReactCurrentOwner,rr=L.ReactDebugCurrentFrame;function M(e){if(e){var o=e._owner,i=X(e.type,e._source,o?o.type:null);rr.setExtraStackFrame(i)}else rr.setExtraStackFrame(null)}var se;se=!1;function ce(e){return typeof e=="object"&&e!==null&&e.$$typeof===t}function tr(){{if(le.current){var e=I(le.current.type);if(e)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+e+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+e+"`."}return""}}function xt(e){return""}var or={};function wt(e){{var o=tr();if(!o){var i=typeof e=="string"?e:e.displayName||e.name;i&&(o=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+i+">.")}return o}}function nr(e,o){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var i=wt(o);if(or[i])return;or[i]=!0;var l="";e&&e._owner&&e._owner!==le.current&&(l=" It was passed a child from "+I(e._owner.type)+"."),M(e),S('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,l),M(null)}}function ar(e,o){{if(typeof e!="object")return;if(ae(e))for(var i=0;i<e.length;i++){var l=e[i];ce(l)&&nr(l,o)}else if(ce(e))e._store&&(e._store.validated=!0);else if(e){var g=Gr(e);if(typeof g=="function"&&g!==e.entries)for(var m=g.call(e),p;!(p=m.next()).done;)ce(p.value)&&nr(p.value,o)}}}function Et(e){{var o=e.type;if(o==null||typeof o=="string")return;var i;if(typeof o=="function")i=o.propTypes;else if(typeof o=="object"&&(o.$$typeof===v||o.$$typeof===P))i=o.propTypes;else return;if(i){var l=I(o);st(i,e.props,"prop",l,e)}else if(o.PropTypes!==void 0&&!se){se=!0;var g=I(o);S("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",g||"Unknown")}typeof o.getDefaultProps=="function"&&!o.getDefaultProps.isReactClassApproved&&S("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function kt(e){{for(var o=Object.keys(e.props),i=0;i<o.length;i++){var l=o[i];if(l!=="children"&&l!=="key"){M(e),S("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",l),M(null);break}}e.ref!==null&&(M(e),S("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}var ir={};function lr(e,o,i,l,g,m){{var p=rt(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 C=xt();C?d+=C:d+=tr();var E;e===null?E="null":ae(e)?E="array":e!==void 0&&e.$$typeof===t?(E="<"+(I(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):E=typeof e,S("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 k=yt(e,o,i,g,m);if(k==null)return k;if(p){var R=o.children;if(R!==void 0)if(l)if(ae(R)){for(var B=0;B<R.length;B++)ar(R[B],e);Object.freeze&&Object.freeze(R)}else S("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 ar(R,e)}if(U.call(o,"key")){var W=I(e),T=Object.keys(o).filter(function(Rt){return Rt!=="key"}),ue=T.length>0?"{key: someKey, "+T.join(": ..., ")+": ...}":"{key: someKey}";if(!ir[W+ue]){var jt=T.length>0?"{"+T.join(": ..., ")+": ...}":"{}";S(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,ne,P,kr,P),Fe[P+ne]=!0}}return e===d?Rr(f):Er(f),f}}function Tr(e,r,t){return Ae(e,r,t,!0)}function xr(e,r,t){return Ae(e,r,t,!1)}var wr=xr,Sr=Tr;L.Fragment=d,L.jsx=wr,L.jsxs=Sr}()),L}process.env.NODE_ENV==="production"?q.exports=$e():q.exports=Me();var se=q.exports;const Ve="__minimstuff_dark_theme__",Ue={borders:{radius:{xs:"1px",s:"2px",m:"3px",l:"4px",xl:"5px"}},medias:{mobile:"768px",tablet:"1024px",small_desktop:"1280px",medium_desktop:"1440px",large_desktop:"1920px",xlarge_desktop:"2560px"},transitions:{delay:{fast:"0.075s",normal:"0.15s",slow:"0.3s"}},fontSizes:{xs:"10px",s:"12px",m:"14px",l:"16px",xl:"18px"}},ue=(i,c)=>`rgba(${We(i,{format:"array"}).slice(0,-1).join(",")},${c})`;function E(i){const c=ae(i.color);if(!c.isValid())throw new Error("Invalid color provided");return{lightest:U({...i,multiplicator:2,type:"lighten"}),light:U({...i,multiplicator:1,type:"lighten"}),default:c.toString(),dark:U({...i,multiplicator:1,type:"darken"}),darkest:U({...i,multiplicator:2,type:"darken"})}}function U({color:i,fadeStep:c=15,multiplicator:p,type:d}){return ae(i)[d](c*p).toString()}const Ne={font:"#f0eef6",background:"#222831",secondary:"#323a47",black:"#333333",white:"#ffffff",grey:E({color:"#aaaaaa"}),blue:E({color:"#4fadfc"}),green:E({color:"#09b909"}),red:E({color:"red"}),yellow:E({color:"#ffc107"}),boxShadow:`0 0 1em 0 ${ue("#111",.4)}`},Be={font:"#333",background:"#f0eef6",secondary:"#fff",black:"#333",white:"#ffffff",grey:E({color:"#777777"}),blue:E({color:"#3f88c5"}),green:E({color:"green"}),red:E({color:"red"}),yellow:E({color:"#ffc107"}),boxShadow:`0 0 1em 0 ${ue("#aaa",.4)}`},le=W.createContext({isDarkTheme:!0,toggleDarkTheme:i=>{}});function ze({preferDarkTheme:i=!0,children:c,onPreferenceChange:p}){const[d,x]=W.useState(i),S=R=>{x(R),p==null||p(R)};return W.useEffect(()=>{localStorage.setItem(Ve,String(d))},[d]),se.jsx(Ie.ThemeProvider,{theme:{...Ue,colors:d?Ne:Be},children:se.jsx(le.Provider,{value:{isDarkTheme:d,toggleDarkTheme:S},children:c})})}m.Button=Ye,m.TextEllipsis=Le,m.ThemeContextProvider=ze,m._ThemeContext=le,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})});
|
|
30
|
+
<%s key={someKey} {...props} />`,ue,W,jt,W),ir[W+ue]=!0}}return e===a?kt(k):Et(k),k}}function _t(e,o,i){return lr(e,o,i,!0)}function St(e,o,i){return lr(e,o,i,!1)}var Ct=St,Tt=_t;N.Fragment=a,N.jsx=Ct,N.jsxs=Tt}()),N}process.env.NODE_ENV==="production"?Q.exports=br():Q.exports=gr();var f=Q.exports;O.keyframes({"0%":{opacity:0},"100%":{opacity:1}}),O.keyframes({to:{transform:"rotate(0deg)"},from:{transform:"rotate(360deg)"}});const vr=O.keyframes({from:{opacity:0,transform:"scale(0.95)"},to:{opacity:1,transform:"scale(1)"}}),ee=h.div(({theme:r})=>({animation:`${r.transitions.delay.normal} ${vr} both`})),be=h(ee)(({show:r,theme:t})=>({zIndex:99,position:"absolute",top:"calc(100% + 0.5em)",right:0,minWidth:"175px",backgroundColor:r?t.colors.secondary:t.colors.background,border:`2px solid ${t.colors.secondary}`,borderRadius:t.borders.radius.m,boxShadow:t.colors.boxShadow,display:r?"flex":"none",flexDirection:"column",overflow:"hidden"})),ge=h.div(({theme:r})=>({height:"auto",width:"auto",color:r.colors.font,display:"flex",gap:"0.35em"}));function ve(r,t){y.useEffect(()=>{function n(a){var s;r!=null&&r.current&&!((s=r.current)!=null&&s.contains(a.target))&&t()}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[r,t])}const mr={ARROW_DOWN:"ArrowDown",ARROW_UP:"ArrowUp",ESCAPE_KEY:"escape"},hr={globalHotkeysEnabled:!0,setGlobalHotkeysEnabled:r=>{}},yr=y.createContext(hr),me=()=>y.useContext(yr);function he(r,t,{enabled:n,disableGlobalCheck:a}={enabled:!0,disableGlobalCheck:!1}){const{globalHotkeysEnabled:s}=me();return sr.useHotkeys(mr[r],u=>{u.preventDefault(),t()},{enabled:a?n:n&&s,enableOnFormTags:["INPUT"]})}const xr=(r=!1)=>{const[t,n]=y.useState(r);return{isShowing:t,toggle:()=>n(x=>!x),open:()=>n(!0),close:()=>n(!1)}},wr=h.div(({opened:r,theme:t,svgSize:n=24})=>({cursor:"pointer",userSelect:"none",position:"relative",minWidth:"fit-content",width:"fit-content",maxWidth:"250px",backgroundColor:r?t.colors.secondary:t.colors.background,padding:"4px",borderRadius:t.borders.radius.m,"&:hover":{backgroundColor:t.colors.secondary},"& svg":{height:`${n}px`,width:`${n}px`}}));function Er({children:r,label:t,className:n,svgSize:a}){const s=y.useRef(null),{isShowing:u,toggle:x,close:w}=xr();return ve(s,w),he("ESCAPE_KEY",w,{disableGlobalCheck:!0}),f.jsxs(wr,{opened:u,onClick:x,ref:s,className:n,svgSize:a,children:[f.jsx(ge,{children:t}),f.jsx(be,{show:u,children:r})]})}const ye=h("div",{shouldForwardProp:r=>r!=="danger"})(({theme:r,danger:t})=>({fontSize:"14px",whiteSpace:"nowrap",color:t?r.colors.red.default:r.colors.blue.default,padding:"8px 12px",borderRadius:r.borders.radius.m,"&:hover":{backgroundColor:r.colors.background}})),kr=h(ye)({display:"flex",gap:"0.75em",alignItems:"center"}),_r=h(ye.withComponent("a"))({width:"100%",display:"flex",gap:"0.75em",alignItems:"center"});function Sr({children:r,title:t,...n}){return f.jsx("a",{target:"_blank",rel:"noreferrer",title:t,...n,children:r})}const xe=h.div({width:"100%",display:"flex",flex:1,alignItems:"center",flexDirection:"column"}),we=h(ee)(({theme:r})=>({minWidth:"500px",background:r.colors.background,padding:"1em",borderRadius:r.borders.radius.m,marginTop:"6em",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column",boxShadow:r.colors.boxShadow,[`@media (max-width: ${r.medias.mobile})`]:{maxHeight:"calc(100% - 2em)",width:"calc(100% - 2em)",minWidth:"unset",marginTop:"1em"}})),Ee=h.h3({width:"100%",margin:0,marginBottom:"0.75em",display:"flex",alignItems:"center",justifyContent:"space-between"}),ke=h.button(({theme:r})=>({cursor:"pointer",color:r.colors.blue.default,backgroundColor:"transparent",border:0,padding:0,margin:0})),F=(r,t)=>`rgba(${cr(r,{format:"array"}).slice(0,-1).join(",")},${t})`;function D(r){const t=de(r.color);if(!t.isValid())throw new Error("Invalid color provided");return{lightest:H({...r,multiplicator:2,type:"lighten"}),light:H({...r,multiplicator:1,type:"lighten"}),default:t.toString(),dark:H({...r,multiplicator:1,type:"darken"}),darkest:H({...r,multiplicator:2,type:"darken"})}}function H({color:r,fadeStep:t=15,multiplicator:n,type:a}){return de(r)[a](t*n).toString()}const _e=h.div(({theme:r})=>({zIndex:9999,position:"absolute",top:0,left:0,height:"100%",width:"100%",background:F(r.colors.black,.35),backdropFilter:"blur(0.1em)",display:"flex",alignItems:"center",flexDirection:"column",transition:r.transitions.delay.normal}));var Se={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Ce=y.createContext&&y.createContext(Se),Cr=["attr","size","title"];function Tr(r,t){if(r==null)return{};var n=jr(r,t),a,s;if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(r);for(s=0;s<u.length;s++)a=u[s],!(t.indexOf(a)>=0)&&Object.prototype.propertyIsEnumerable.call(r,a)&&(n[a]=r[a])}return n}function jr(r,t){if(r==null)return{};var n={};for(var a in r)if(Object.prototype.hasOwnProperty.call(r,a)){if(t.indexOf(a)>=0)continue;n[a]=r[a]}return n}function q(){return q=Object.assign?Object.assign.bind():function(r){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(r[a]=n[a])}return r},q.apply(this,arguments)}function Te(r,t){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(r);t&&(a=a.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),n.push.apply(n,a)}return n}function G(r){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Te(Object(n),!0).forEach(function(a){Rr(r,a,n[a])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Te(Object(n)).forEach(function(a){Object.defineProperty(r,a,Object.getOwnPropertyDescriptor(n,a))})}return r}function Rr(r,t,n){return t=Or(t),t in r?Object.defineProperty(r,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[t]=n,r}function Or(r){var t=Pr(r,"string");return typeof t=="symbol"?t:t+""}function Pr(r,t){if(typeof r!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var a=n.call(r,t||"default");if(typeof a!="object")return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function je(r){return r&&r.map((t,n)=>y.createElement(t.tag,G({key:n},t.attr),je(t.child)))}function Dr(r){return t=>y.createElement(Ir,q({attr:G({},r.attr)},t),je(r.child))}function Ir(r){var t=n=>{var{attr:a,size:s,title:u}=r,x=Tr(r,Cr),w=s||n.size||"1em",v;return n.className&&(v=n.className),r.className&&(v=(v?v+" ":"")+r.className),y.createElement("svg",q({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,a,x,{className:v,style:G(G({color:r.color||n.color},n.style),r.style),height:w,width:w,xmlns:"http://www.w3.org/2000/svg"}),u&&y.createElement("title",null,u),r.children)};return Ce!==void 0?y.createElement(Ce.Consumer,null,n=>t(n)):t(Se)}function Fr(r){return Dr({tag:"svg",attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"m289.94 256 95-95A24 24 0 0 0 351 127l-95 95-95-95a24 24 0 0 0-34 34l95 95-95 95a24 24 0 1 0 34 34l95-95 95 95a24 24 0 0 0 34-34z"},child:[]}]})(r)}const Re=h.p(({lines:r=1})=>r>1?{overflow:"hidden",display:"-webkit-box",WebkitLineClamp:r,WebkitBoxOrient:"vertical"}:{textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"});function Ar({title:r,children:t,opened:n=!0,hideCloseBtn:a=!1,className:s,close:u}){const x=y.useRef(null),{setGlobalHotkeysEnabled:w}=me();return ve(x,u),he("ESCAPE_KEY",u,{disableGlobalCheck:!0}),y.useEffect(()=>w(!n),[n,w]),typeof window>"u"?f.jsx(y.Fragment,{}):n&&ur.createPortal(f.jsx(_e,{children:f.jsxs(we,{className:s,ref:x,children:[(!a||r)&&f.jsxs(Ee,{children:[r&&f.jsx(Re,{children:r}),!a&&f.jsx(ke,{onClick:u,style:{marginLeft:r?"unset":"auto"},children:f.jsx(Fr,{size:20})})]}),f.jsx(xe,{children:t})]})}),document.body)}const $r=h.img(({theme:r,size:t=48})=>{const n=F(r.colors.black,.1);return{height:`${t}px`,width:`${t}px`,borderRadius:"50%","&:hover":{boxShadow:`0 1px 3px 0 ${n}, 0 1px 2px -1px ${n}`}}}),Oe=h.li(({theme:r,active:t,danger:n})=>{const a=n?r.colors.red.default:r.colors.blue.default;return{userSelect:"none",cursor:"pointer",backgroundColor:t?F(a,.15):r.colors.secondary,padding:"10px 20px",border:`1px solid ${t?F(a,.1):r.colors.secondary}`,borderBottom:`1px solid ${t?F(a,.25):r.colors.secondary}`,display:"flex",gap:"0.35em",alignItems:"center",transition:".075s"}}),Pe=h.ul({padding:0,margin:0,display:"flex",listStyle:"none"}),De=h.div(({theme:r})=>({zIndex:1,position:"relative",border:`1px solid ${F(r.colors.blue.default,.25)}`,padding:"20px",marginTop:"-1px"}));function Wr({tabs:r}){const[t,n]=y.useState(0),a=s=>{n(s)};return f.jsxs("div",{children:[f.jsx(Pe,{children:r.map(({title:s,icon:u,danger:x},w)=>f.jsxs(Oe,{active:w===t,onClick:()=>a(w),danger:x??!1,children:[!!u&&f.jsx(u,{size:20}),s]},w))}),f.jsx(De,{children:f.jsx(ee,{children:r[t].content})},r[t].title)]})}const re=h("div",{shouldForwardProp:r=>r!=="required"})(({required:r,theme:t})=>({display:"flex",gap:"0.25em",flexDirection:"column","& label":{position:"relative",userSelect:"none",width:"fit-content"},"& label::after":{position:"absolute",top:0,right:"-0.75em",color:t.colors.red.default,content:r?'"*"':'""'}})),Ie=h.p(({theme:r})=>({fontSize:"12px",color:r.colors.red.default}));function Lr({name:r,label:t,checked:n=!1,errors:a=[],onChange:s,required:u=!1,...x}){const[w,v]=y.useState(n);if(typeof window>"u")return f.jsx(y.Fragment,{});function j({target:b}){v(b.checked),s&&s(b.name,b.checked)}return f.jsxs(re,{css:{alignItems:"center",gap:"1em",flexDirection:"row"},required:u,children:[f.jsx("label",{htmlFor:r,title:t,children:t}),f.jsx(dr,{...x,onChange:j,checked:w,placeholder:x.placeholder??"Type something...",name:r,id:r}),a.length>0&&a.map(b=>f.jsx(Ie,{children:b},b))]})}const Mr=h.form({width:"100%",display:"flex",gap:"1em",flexDirection:"column"}),Br=h.input(({theme:r})=>({width:"100%",color:r.colors.font,backgroundColor:r.colors.secondary,padding:"0.75em",border:`1px solid ${r.colors.grey.light}`,borderBottom:`2px solid ${r.colors.grey.light}`,borderRadius:r.borders.radius.m,transition:r.transitions.delay.normal,"&:focus":{borderBottom:`2px solid ${r.colors.blue.default}`},"&:disabled":{opacity:.85},"&::placeholder":{fontStyle:"italic",color:r.colors.grey.default}}));function Yr({name:r,label:t,value:n="",errors:a=[],onChange:s,required:u=!1,...x}){const[w,v]=y.useState(n);function j({target:b}){v(b.value),s&&s(b.name,b.value)}return f.jsxs(re,{required:u,children:[f.jsx("label",{htmlFor:r,title:t,children:t}),f.jsx(Br,{...x,name:r,onChange:j,value:w,placeholder:x.placeholder??"Type something..."}),a.length>0&&a.map(b=>f.jsx(Ie,{children:b},b))]})}function Nr({name:r,label:t,value:n,options:a,onChangeCallback:s,formatOptionLabel:u,required:x=!1,...w}){const v=O.useTheme(),[j,b]=y.useState();y.useEffect(()=>{if(a.length===0)return;const _=a.find(A=>A.value===n);_&&b(_)},[a,n]);const P=_=>{b(_),s&&s(_.value)};return f.jsxs(re,{required:x,children:[t&&f.jsx("label",{htmlFor:r,title:`${r} field`,children:t}),f.jsx(fr,{value:j,onChange:_=>P(_),options:a,isDisabled:w.disabled,menuPlacement:"auto",formatOptionLabel:u?(_,A)=>u(_,A):void 0,css:{color:v.colors.black}})]})}const Fe="__minimstuff_dark_theme__",zr={borders:{radius:{xs:"1px",s:"2px",m:"3px",l:"4px",xl:"5px"}},medias:{mobile:"768px",tablet:"1024px",small_desktop:"1280px",medium_desktop:"1440px",large_desktop:"1920px",xlarge_desktop:"2560px"},transitions:{delay:{fast:"0.075s",normal:"0.15s",slow:"0.3s"}},fontSizes:{xs:"10px",s:"12px",m:"14px",l:"16px",xl:"18px"}},Ur={font:"#f0eef6",background:"#222831",secondary:"#323a47",black:"#333333",white:"#ffffff",grey:D({color:"#aaaaaa"}),blue:D({color:"#4fadfc"}),green:D({color:"#09b909"}),red:D({color:"red"}),yellow:D({color:"#ffc107"}),boxShadow:`0 0 1em 0 ${F("#111",.4)}`},Vr={font:"#333",background:"#f0eef6",secondary:"#fff",black:"#333",white:"#ffffff",grey:D({color:"#777777"}),blue:D({color:"#3f88c5"}),green:D({color:"green"}),red:D({color:"red"}),yellow:D({color:"#ffc107"}),boxShadow:`0 0 1em 0 ${F("#aaa",.4)}`},Wt="dark",Ae=y.createContext({isDarkTheme:!0,toggleDarkTheme:r=>{}});function Hr({children:r,onPreferenceChange:t}){const[n,a]=y.useState(()=>!!localStorage.getItem(Fe)),s=u=>{a(u),t==null||t(u)};return y.useEffect(()=>{localStorage.setItem(Fe,String(n))},[n]),f.jsx(O.ThemeProvider,{theme:{...zr,colors:n?Ur:Vr},children:f.jsxs(Ae.Provider,{value:{isDarkTheme:n,toggleDarkTheme:s},children:[f.jsx($e,{}),r]})})}function $e(){const r=O.useTheme(),t=O.css({"*":{boxSizing:"border-box",outline:0,margin:0,padding:0,scrollBehavior:"smooth"},".reset":{backgroundColor:"inherit",color:"inherit",padding:0,margin:0,border:0},a:{width:"fit-content",color:r.colors.blue.default,textDecoration:"none",borderBottom:"1px solid transparent"},b:{fontWeight:600,letterSpacing:"0.5px"},"h1, h2, h3, h4, h5, h6":{fontWeight:"500",color:r.colors.blue.default},kbd:{textShadow:"0 1px 0 #fff",fontSize:"12px",color:"rgb(51, 51, 51)",backgroundColor:"rgb(247, 247, 247)",padding:"0.25em 0.5em",borderRadius:"3px",border:"1px solid rgb(204, 204, 204)",boxShadow:"0 1px 0 rgba(0, 0, 0, 0.2), 0 0 0 2px #ffffff inset",display:"inline-block"},hr:{width:"100%",marginBlock:"1em",border:0,borderTop:`1px solid ${r.colors.background}`}}),n=O.css({"html, body, #app":{height:"100svh",width:"100%",fontFamily:"'Poppins', sans-serif",fontSize:"14px",color:r.colors.font,backgroundColor:r.colors.background,display:"flex",alignItems:"center",flexDirection:"column"}}),a=O.css({"::-webkit-scrollbar":{height:"0.45em",width:"0.45em"},"::-webkit-scrollbar-track":{borderRadius:r.borders.radius.m},"::-webkit-scrollbar-thumb":{background:r.colors.blue.default,borderRadius:r.borders.radius.m,"&:hover":{background:r.colors.blue.dark}}}),s=O.css({table:{height:"auto",width:"100%",borderCollapse:"collapse",borderRadius:r.borders.radius.m,overflow:"hidden"},th:{textAlign:"center",fontWeight:400,backgroundColor:r.colors.secondary},"td, th":{padding:"0.45em"},"th, td":{whiteSpace:"nowrap"},"tr:nth-of-type(even)":{backgroundColor:r.colors.secondary}});return f.jsx(O.Global,{styles:[t,n,a,s]})}c.Button=pr,c.Checkbox=Lr,c.Dropdown=Er,c.DropdownContainer=be,c.DropdownItemButton=kr,c.DropdownItemLink=_r,c.DropdownLabel=ge,c.ExternalLink=Sr,c.Form=Mr,c.Modal=Ar,c.ModalBody=xe,c.ModalCloseBtn=ke,c.ModalContainer=we,c.ModalHeader=Ee,c.ModalWrapper=_e,c.RoundedImage=$r,c.Selector=Nr,c.StyleReset=$e,c.TabItem=Oe,c.TabList=Pe,c.TabPanel=De,c.Tabs=Wr,c.TextEllipsis=Re,c.Textbox=Yr,c.ThemeContextProvider=Hr,c._ThemeContext=Ae,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|
|
31
31
|
//# sourceMappingURL=index.umd.js.map
|