groovinads-ui 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.
Binary file
package/dist/index.es.js CHANGED
@@ -1 +1,14 @@
1
- import e from"react";const n=({variant:n,size:a,onClick:t,children:i,icon:l,iconPosition:s,className:r,style:o,processing:c})=>{let d=`btn ${r}`;"default"!==n&&(d+=` btn-${n}`),"md"!==a&&(d+=` btn-${a}`),"default"!==o&&(d+=` btn-${o}`),c&&(d+=" btn-processing");const m=c?e.createElement(e.Fragment,null,e.createElement("i",{className:"fa-solid fa-spinner-third fa-spin","aria-hidden":"true"}),i&&e.createElement("span",null,i,"…")):l?"end"===s?e.createElement(e.Fragment,null,i&&e.createElement("span",null,i),e.createElement("i",{className:`fa-solid ${l}`,"aria-hidden":"true"})):e.createElement(e.Fragment,null,e.createElement("i",{className:`fa-solid ${l}`,"aria-hidden":"true"}),i&&e.createElement("span",null,i)):i&&e.createElement("span",null,i);return e.createElement("button",{className:d,onClick:t},m)};n.propTypes={variant:(void 0)(["primary","secondary","terciary","outline"]),size:(void 0)(["xs","md","lg"]),onClick:void 0,children:void 0,icon:void 0,iconPosition:(void 0)(["start","end"]),className:void 0,style:(void 0)(["default","success","danger","warning","link"]),processing:void 0},n.defaultProps={variant:"primary",size:"md",onClick:null,icon:null,iconPosition:"start",className:"",style:"default",processing:!1};export{n as Button};
1
+ import e,{useCallback as t,useState as n,useEffect as r}from"react";function o(e,t){return e(t={exports:{}},t.exports),t.exports
2
+ /** @license React v16.13.1
3
+ * react-is.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */}var a="function"==typeof Symbol&&Symbol.for,i=a?Symbol.for("react.element"):60103,c=a?Symbol.for("react.portal"):60106,s=a?Symbol.for("react.fragment"):60107,l=a?Symbol.for("react.strict_mode"):60108,u=a?Symbol.for("react.profiler"):60114,f=a?Symbol.for("react.provider"):60109,p=a?Symbol.for("react.context"):60110,d=a?Symbol.for("react.async_mode"):60111,m=a?Symbol.for("react.concurrent_mode"):60111,y=a?Symbol.for("react.forward_ref"):60112,h=a?Symbol.for("react.suspense"):60113,b=a?Symbol.for("react.suspense_list"):60120,g=a?Symbol.for("react.memo"):60115,v=a?Symbol.for("react.lazy"):60116,E=a?Symbol.for("react.block"):60121,x=a?Symbol.for("react.fundamental"):60117,N=a?Symbol.for("react.responder"):60118,C=a?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case i:switch(e=e.type){case d:case m:case s:case u:case l:case h:return e;default:switch(e=e&&e.$$typeof){case p:case y:case v:case g:case f:return e;default:return t}}case c:return t}}}function O(e){return w(e)===m}var S={AsyncMode:d,ConcurrentMode:m,ContextConsumer:p,ContextProvider:f,Element:i,ForwardRef:y,Fragment:s,Lazy:v,Memo:g,Portal:c,Profiler:u,StrictMode:l,Suspense:h,isAsyncMode:function(e){return O(e)||w(e)===d},isConcurrentMode:O,isContextConsumer:function(e){return w(e)===p},isContextProvider:function(e){return w(e)===f},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===i},isForwardRef:function(e){return w(e)===y},isFragment:function(e){return w(e)===s},isLazy:function(e){return w(e)===v},isMemo:function(e){return w(e)===g},isPortal:function(e){return w(e)===c},isProfiler:function(e){return w(e)===u},isStrictMode:function(e){return w(e)===l},isSuspense:function(e){return w(e)===h},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===s||e===m||e===u||e===l||e===h||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===v||e.$$typeof===g||e.$$typeof===f||e.$$typeof===p||e.$$typeof===y||e.$$typeof===x||e.$$typeof===N||e.$$typeof===C||e.$$typeof===E)},typeOf:w},$=o((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var d=e.type;switch(d){case l:case u:case o:case i:case a:case p:return d;default:var h=d&&d.$$typeof;switch(h){case s:case f:case y:case m:case c:return h;default:return t}}case r:return t}}}var x=l,N=u,C=s,w=c,O=n,S=f,$=o,k=y,T=m,P=r,j=i,_=a,R=p,I=!1;function M(e){return E(e)===u}t.AsyncMode=x,t.ConcurrentMode=N,t.ContextConsumer=C,t.ContextProvider=w,t.Element=O,t.ForwardRef=S,t.Fragment=$,t.Lazy=k,t.Memo=T,t.Portal=P,t.Profiler=j,t.StrictMode=_,t.Suspense=R,t.isAsyncMode=function(e){return I||(I=!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.")),M(e)||E(e)===l},t.isConcurrentMode=M,t.isContextConsumer=function(e){return E(e)===s},t.isContextProvider=function(e){return E(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return E(e)===f},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===y},t.isMemo=function(e){return E(e)===m},t.isPortal=function(e){return E(e)===r},t.isProfiler=function(e){return E(e)===i},t.isStrictMode=function(e){return E(e)===a},t.isSuspense=function(e){return E(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===u||e===i||e===a||e===p||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===m||e.$$typeof===c||e.$$typeof===s||e.$$typeof===f||e.$$typeof===b||e.$$typeof===g||e.$$typeof===v||e.$$typeof===h)},t.typeOf=E}()}));$.AsyncMode,$.ConcurrentMode,$.ContextConsumer,$.ContextProvider,$.Element,$.ForwardRef,$.Fragment,$.Lazy,$.Memo,$.Portal,$.Profiler,$.StrictMode,$.Suspense,$.isAsyncMode,$.isConcurrentMode,$.isContextConsumer,$.isContextProvider,$.isElement,$.isForwardRef,$.isFragment,$.isLazy,$.isMemo,$.isPortal,$.isProfiler,$.isStrictMode,$.isSuspense,$.isValidElementType,$.typeOf;var k=o((function(e){"production"===process.env.NODE_ENV?e.exports=S:e.exports=$})),T=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable;
10
+ /*
11
+ object-assign
12
+ (c) Sindre Sorhus
13
+ @license MIT
14
+ */var _=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a<arguments.length;a++){for(var i in n=Object(arguments[a]))P.call(n,i)&&(o[i]=n[i]);if(T){r=T(n);for(var c=0;c<r.length;c++)j.call(n,r[c])&&(o[r[c]]=n[r[c]])}}return o},R="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",I=Function.call.bind(Object.prototype.hasOwnProperty),M=function(){};if("production"!==process.env.NODE_ENV){var A=R,F={},z=I;M=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function q(e,t,n,r,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(z(e,a)){var i;try{if("function"!=typeof e[a]){var c=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}i=e[a](t,a,r,n,null,A)}catch(e){i=e}if(!i||i instanceof Error||M((r||"React class")+": type specification of "+n+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in F)){F[i.message]=!0;var s=o?o():"";M("Failed "+n+" type: "+i.message+(null!=s?s:""))}}}q.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(F={})};var V=q,D=function(){};function L(){return null}"production"!==process.env.NODE_ENV&&(D=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var W=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,r="@@iterator";var o="<<anonymous>>",a={array:l("array"),bigint:l("bigint"),bool:l("boolean"),func:l("function"),number:l("number"),object:l("object"),string:l("string"),symbol:l("symbol"),any:s(L),arrayOf:function(e){return s((function(t,n,r,o,a){if("function"!=typeof e)return new c("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new c("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+r+"`, expected an array.");for(var s=0;s<i.length;s++){var l=e(i,s,r,o,a+"["+s+"]",R);if(l instanceof Error)return l}return null}))},element:s((function(t,n,r,o,a){var i=t[n];return e(i)?null:new c("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:s((function(e,t,n,r,o){var a=e[t];return k.isValidElementType(a)?null:new c("Invalid "+r+" `"+o+"` of type `"+p(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return s((function(t,n,r,a,i){if(!(t[n]instanceof e)){var s=e.name||o;return new c("Invalid "+a+" `"+i+"` of type `"+(((l=t[n]).constructor&&l.constructor.name?l.constructor.name:o)+"` supplied to `")+r+"`, expected instance of `"+s+"`.")}var l;return null}))},node:s((function(e,t,n,r,o){return f(e[t])?null:new c("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return s((function(t,n,r,o,a){if("function"!=typeof e)return new c("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=t[n],s=p(i);if("object"!==s)return new c("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var l in i)if(I(i,l)){var u=e(i,l,r,o,a+"."+l,R);if(u instanceof Error)return u}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&D(arguments.length>1?"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]).":"Invalid argument supplied to oneOf, expected an array."),L;return s((function(t,n,r,o,a){for(var s=t[n],l=0;l<e.length;l++)if(i(s,e[l]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===d(t)?String(t):t}));return new c("Invalid "+o+" `"+a+"` of value `"+String(s)+"` supplied to `"+r+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&D("Invalid argument supplied to oneOfType, expected an instance of array."),L;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return D("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+m(n)+" at index "+t+"."),L}return s((function(t,n,r,o,a){for(var i=[],s=0;s<e.length;s++){var l=(0,e[s])(t,n,r,o,a,R);if(null==l)return null;l.data&&I(l.data,"expectedType")&&i.push(l.data.expectedType)}return new c("Invalid "+o+" `"+a+"` supplied to `"+r+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")}))},shape:function(e){return s((function(t,n,r,o,a){var i=t[n],s=p(i);if("object"!==s)return new c("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var l in e){var f=e[l];if("function"!=typeof f)return u(r,o,a,l,d(f));var m=f(i,l,r,o,a+"."+l,R);if(m)return m}return null}))},exact:function(e){return s((function(t,n,r,o,a){var i=t[n],s=p(i);if("object"!==s)return new c("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");var l=_({},t[n],e);for(var f in l){var m=e[f];if(I(e,f)&&"function"!=typeof m)return u(r,o,a,f,d(m));if(!m)return new c("Invalid "+o+" `"+a+"` key `"+f+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=m(i,f,r,o,a+"."+f,R);if(y)return y}return null}))}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function s(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function a(a,i,s,l,u,f,p){if(l=l||o,f=f||s,p!==R){if(t){var d=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 d.name="Invariant Violation",d}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=l+":"+s;!n[m]&&r<3&&(D("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+l+"`. 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."),n[m]=!0,r++)}}return null==i[s]?a?null===i[s]?new c("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `null`."):new c("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `undefined`."):null:e(i,s,l,u,f)}var i=a.bind(null,!1);return i.isRequired=a.bind(null,!0),i}function l(e){return s((function(t,n,r,o,a,i){var s=t[n];return p(s)!==e?new c("Invalid "+o+" `"+a+"` of type `"+d(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,n,r,o){return new c((e||"React class")+": "+t+" type `"+n+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function f(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(f);if(null===t||e(t))return!0;var o=function(e){var t=e&&(n&&e[n]||e[r]);if("function"==typeof t)return t}(t);if(!o)return!1;var a,i=o.call(t);if(o!==t.entries){for(;!(a=i.next()).done;)if(!f(a.value))return!1}else for(;!(a=i.next()).done;){var c=a.value;if(c&&!f(c[1]))return!1}return!0;default:return!1}}function p(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=p(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function m(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return c.prototype=Error.prototype,a.checkPropTypes=V,a.resetWarningCache=V.resetWarningCache,a.PropTypes=a,a};function U(){}function Y(){}Y.resetWarningCache=U;var J=o((function(e){if("production"!==process.env.NODE_ENV){var t=k;e.exports=W(t.isElement,!0)}else e.exports=function(){function e(e,t,n,r,o,a){if(a!==R){var i=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 i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:Y,resetWarningCache:U};return n.PropTypes=n,n}()}));const B=({variant:t,size:n,onClick:r,children:o,icon:a,iconPosition:i,className:c,style:s,processing:l})=>{let u=`btn ${c}`;"default"!==t&&(u+=` btn-${t}`),"md"!==n&&(u+=` btn-${n}`),"default"!==s&&(u+=` btn-${s}`),l&&(u+=" btn-processing");const f=l?e.createElement(e.Fragment,null,e.createElement("i",{className:"fa-solid fa-spinner-third fa-spin","aria-hidden":"true"}),o&&e.createElement("span",null,o,"…")):a?"end"===i?e.createElement(e.Fragment,null,o&&e.createElement("span",null,o),e.createElement("i",{className:`fa-solid ${a}`,"aria-hidden":"true"})):e.createElement(e.Fragment,null,e.createElement("i",{className:`fa-solid ${a}`,"aria-hidden":"true"}),o&&e.createElement("span",null,o)):o&&e.createElement("span",null,o);return e.createElement("button",{className:u,onClick:r},f)};B.propTypes={variant:J.oneOf(["primary","secondary","terciary","outline"]),size:J.oneOf(["xs","md","lg"]),onClick:J.func,children:J.node,icon:J.node,iconPosition:J.oneOf(["start","end"]),className:J.string,style:J.oneOf(["default","success","danger","warning","link"]),processing:J.bool},B.defaultProps={variant:"primary",size:"md",onClick:null,icon:null,iconPosition:"start",className:"",style:"default",processing:!1};const Z=()=>({toCamelCase:t((e=>{let t=e?.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g,(function(e,t){return 0==+e?"":0===t?e?.toLowerCase():e?.toUpperCase()}));return t=t?.replace(/^\d+/,""),t=t?.replace(/[^a-zA-Z0-9_]/g,""),t}),[])}),H=({children:t,className:n,id:r,checked:o,setChecked:a,name:i})=>{const{toCamelCase:c}=Z();let s=r;r||"string"!=typeof t||(s=c(t));return e.createElement("div",{className:`form-group form-check ${n}`},e.createElement("label",{className:"checkbox"},e.createElement("input",{type:"checkbox",defaultChecked:o,checked:o,onChange:e=>{a(e.target.checked)},minLength:"1",id:s,name:i}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};H.propTypes={className:J.string,id:J.string,checked:J.bool,setChecked:J.func,name:J.string},H.defaultProps={className:"",id:"",checked:!1,setChecked:()=>{}};const G=({type:t,size:n,value:r,label:o,prefix:a,suffix:i,icon:c,helpText:s,requiredText:l,onChange:u,className:f,showError:p,name:d,disabled:m})=>{const{toCamelCase:y}=Z(),h="lg"===n?"form-control-lg":"xs"===n?"form-control-xs":"",b=y(o),g="not-validated";return e.createElement("div",{className:`position-relative ${f}`},a||i||c?e.createElement("div",{className:p?`input-group ${g}`:"input-group","data-error":l},c&&e.createElement("span",{className:"input-group-text"},e.createElement("i",{className:`fa-solid ${c}`})),a&&e.createElement("span",{className:"input-group-text"},a),e.createElement("div",{className:"form-floating"},e.createElement("input",{type:t,className:`form-control ${h}`,value:r,id:b,name:d,placeholder:o,onChange:u,required:!!l}),e.createElement("label",{htmlFor:b},o)),i&&e.createElement("span",{className:"input-group-text"},i)):e.createElement("div",{className:p?`form-floating ${g}`:"form-floating","data-error":l},e.createElement("input",{type:t,className:`form-control ${h}`,value:r,id:b,placeholder:o,onChange:u,required:!!l,name:d,disabled:m}),e.createElement("label",{htmlFor:b},o)),s&&e.createElement("small",{className:"form-text text-muted"},s),l&&e.createElement("div",{className:"invalid-feedback"},l))};G.propTypes={type:J.oneOf(["color","date","datetime-local","email","file","image","month","number","password","tel","text","time","url","week"]).isRequired,size:J.oneOf(["xs","md","lg"]),value:J.oneOfType([J.string,J.number]),label:J.string.isRequired,prefix:J.string,suffix:J.string,icon:J.node,helpText:J.string,requiredText:J.string,onChange:J.func,className:J.string,name:J.string},G.defaultProps={type:"text",icon:null,helperText:null,prefixLeft:null,prefixRight:null,label:null,required:null,value:void 0,size:"md",onChange:null,className:""};const K=({children:t,className:n,id:r,checked:o,setChecked:a,name:i})=>{const{toCamelCase:c}=Z();let s=r;r||"string"!=typeof t||(s=c(t));return e.createElement("div",{className:`form-group form-check ${n}`},e.createElement("label",{className:"radio"},e.createElement("input",{type:"radio",defaultChecked:o,onChange:e=>{a(e.target.checked)},minLength:"1",id:s,name:i}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};K.propTypes={className:J.string,id:J.string,checked:J.bool,setChecked:J.func,name:J.string.isRequired},K.defaultProps={className:"",id:"",checked:!1,setChecked:()=>{}};const Q=({status:t,icon:n,size:r,children:o,className:a,id:i,setChecked:c,switchPosition:s,name:l})=>{const{toCamelCase:u}=Z(),f="lg"===r?"form-switch-lg":"xs"===r?"form-switch-xs":"",p=i||u(o);return e.createElement("div",{className:`form-check form-switch ${f} ${a} ${"end"===s?"switch-end":""} ${n?"switch-icon":""}`},e.createElement("input",{className:"form-check-input",type:"checkbox",role:"switch",defaultChecked:t,onChange:e=>{c(e.target.checked)},id:p,name:l}),o&&e.createElement("label",{className:"form-check-label",htmlFor:p},o))};Q.propTypes={icon:J.bool,className:J.string,id:J.string,checked:J.bool,setChecked:J.func,switchPosition:J.oneOf(["start","end"]),name:J.string},Q.defaultProps={icon:!1,className:"",id:"",checked:!1,setChecked:()=>{},switchPosition:"start"};const X=({size:t,value:o,label:a,helpText:i,requiredText:c,onChange:s,className:l,name:u})=>{const{toCamelCase:f}=Z(),p="lg"===t?"form-control-lg":"xs"===t?"form-control-xs":"",d=f(a),[m,y]=n(!1);r((()=>{c&&(y(!0),setTimeout((()=>{y(!1)}),3e3))}),[c]);const h=m?"not-validated":"";return e.createElement("div",{className:`position-relative ${l}`},e.createElement("div",{className:`form-floating ${h}`,"data-error":c},e.createElement("textarea",{className:`form-control ${p}`,onChange:s,placeholder:a,id:d,name:u,required:!!c}),e.createElement("label",{htmlFor:d},a),i&&e.createElement("small",{className:"form-text text-muted"},i)))};X.propTypes={size:J.oneOf(["xs","md","lg"]),label:J.string.isRequired,helpText:J.string,requiredText:J.string,onChange:J.func,className:J.string,name:J.string},X.defaultProps={icon:null,helperText:null,prefixLeft:null,prefixRight:null,label:null,required:null,value:void 0,size:"md",onChange:null,className:""};export{B as Button,H as Checkbox,G as Input,K as Radio,Q as Switch,X as Textarea};
package/dist/index.js CHANGED
@@ -1 +1,14 @@
1
- "use strict";var e=require("react");const n=({variant:n,size:t,onClick:a,children:i,icon:l,iconPosition:s,className:r,style:c,processing:o})=>{let d=`btn ${r}`;"default"!==n&&(d+=` btn-${n}`),"md"!==t&&(d+=` btn-${t}`),"default"!==c&&(d+=` btn-${c}`),o&&(d+=" btn-processing");const m=o?e.createElement(e.Fragment,null,e.createElement("i",{className:"fa-solid fa-spinner-third fa-spin","aria-hidden":"true"}),i&&e.createElement("span",null,i,"…")):l?"end"===s?e.createElement(e.Fragment,null,i&&e.createElement("span",null,i),e.createElement("i",{className:`fa-solid ${l}`,"aria-hidden":"true"})):e.createElement(e.Fragment,null,e.createElement("i",{className:`fa-solid ${l}`,"aria-hidden":"true"}),i&&e.createElement("span",null,i)):i&&e.createElement("span",null,i);return e.createElement("button",{className:d,onClick:a},m)};n.propTypes={variant:(void 0)(["primary","secondary","terciary","outline"]),size:(void 0)(["xs","md","lg"]),onClick:void 0,children:void 0,icon:void 0,iconPosition:(void 0)(["start","end"]),className:void 0,style:(void 0)(["default","success","danger","warning","link"]),processing:void 0},n.defaultProps={variant:"primary",size:"md",onClick:null,icon:null,iconPosition:"start",className:"",style:"default",processing:!1},exports.Button=n;
1
+ "use strict";var e=require("react");function t(e,t){return e(t={exports:{}},t.exports),t.exports
2
+ /** @license React v16.13.1
3
+ * react-is.production.min.js
4
+ *
5
+ * Copyright (c) Facebook, Inc. and its affiliates.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */}var n="function"==typeof Symbol&&Symbol.for,r=n?Symbol.for("react.element"):60103,o=n?Symbol.for("react.portal"):60106,a=n?Symbol.for("react.fragment"):60107,i=n?Symbol.for("react.strict_mode"):60108,c=n?Symbol.for("react.profiler"):60114,s=n?Symbol.for("react.provider"):60109,l=n?Symbol.for("react.context"):60110,u=n?Symbol.for("react.async_mode"):60111,f=n?Symbol.for("react.concurrent_mode"):60111,p=n?Symbol.for("react.forward_ref"):60112,d=n?Symbol.for("react.suspense"):60113,m=n?Symbol.for("react.suspense_list"):60120,y=n?Symbol.for("react.memo"):60115,h=n?Symbol.for("react.lazy"):60116,b=n?Symbol.for("react.block"):60121,g=n?Symbol.for("react.fundamental"):60117,v=n?Symbol.for("react.responder"):60118,E=n?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case f:case a:case c:case i:case d:return e;default:switch(e=e&&e.$$typeof){case l:case p:case h:case y:case s:return e;default:return t}}case o:return t}}}function C(e){return x(e)===f}var N={AsyncMode:u,ConcurrentMode:f,ContextConsumer:l,ContextProvider:s,Element:r,ForwardRef:p,Fragment:a,Lazy:h,Memo:y,Portal:o,Profiler:c,StrictMode:i,Suspense:d,isAsyncMode:function(e){return C(e)||x(e)===u},isConcurrentMode:C,isContextConsumer:function(e){return x(e)===l},isContextProvider:function(e){return x(e)===s},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},isForwardRef:function(e){return x(e)===p},isFragment:function(e){return x(e)===a},isLazy:function(e){return x(e)===h},isMemo:function(e){return x(e)===y},isPortal:function(e){return x(e)===o},isProfiler:function(e){return x(e)===c},isStrictMode:function(e){return x(e)===i},isSuspense:function(e){return x(e)===d},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===a||e===f||e===c||e===i||e===d||e===m||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===y||e.$$typeof===s||e.$$typeof===l||e.$$typeof===p||e.$$typeof===g||e.$$typeof===v||e.$$typeof===E||e.$$typeof===b)},typeOf:x},w=t((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,n=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,o=e?Symbol.for("react.fragment"):60107,a=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,c=e?Symbol.for("react.provider"):60109,s=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,d=e?Symbol.for("react.suspense_list"):60120,m=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,h=e?Symbol.for("react.block"):60121,b=e?Symbol.for("react.fundamental"):60117,g=e?Symbol.for("react.responder"):60118,v=e?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:var d=e.type;switch(d){case l:case u:case o:case i:case a:case p:return d;default:var h=d&&d.$$typeof;switch(h){case s:case f:case y:case m:case c:return h;default:return t}}case r:return t}}}var x=l,C=u,N=s,w=c,S=n,O=f,$=o,k=y,T=m,P=r,j=i,R=a,_=p,I=!1;function M(e){return E(e)===u}t.AsyncMode=x,t.ConcurrentMode=C,t.ContextConsumer=N,t.ContextProvider=w,t.Element=S,t.ForwardRef=O,t.Fragment=$,t.Lazy=k,t.Memo=T,t.Portal=P,t.Profiler=j,t.StrictMode=R,t.Suspense=_,t.isAsyncMode=function(e){return I||(I=!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.")),M(e)||E(e)===l},t.isConcurrentMode=M,t.isContextConsumer=function(e){return E(e)===s},t.isContextProvider=function(e){return E(e)===c},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},t.isForwardRef=function(e){return E(e)===f},t.isFragment=function(e){return E(e)===o},t.isLazy=function(e){return E(e)===y},t.isMemo=function(e){return E(e)===m},t.isPortal=function(e){return E(e)===r},t.isProfiler=function(e){return E(e)===i},t.isStrictMode=function(e){return E(e)===a},t.isSuspense=function(e){return E(e)===p},t.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===o||e===u||e===i||e===a||e===p||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===m||e.$$typeof===c||e.$$typeof===s||e.$$typeof===f||e.$$typeof===b||e.$$typeof===g||e.$$typeof===v||e.$$typeof===h)},t.typeOf=E}()}));w.AsyncMode,w.ConcurrentMode,w.ContextConsumer,w.ContextProvider,w.Element,w.ForwardRef,w.Fragment,w.Lazy,w.Memo,w.Portal,w.Profiler,w.StrictMode,w.Suspense,w.isAsyncMode,w.isConcurrentMode,w.isContextConsumer,w.isContextProvider,w.isElement,w.isForwardRef,w.isFragment,w.isLazy,w.isMemo,w.isPortal,w.isProfiler,w.isStrictMode,w.isSuspense,w.isValidElementType,w.typeOf;var S=t((function(e){"production"===process.env.NODE_ENV?e.exports=N:e.exports=w})),O=Object.getOwnPropertySymbols,$=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;
10
+ /*
11
+ object-assign
12
+ (c) Sindre Sorhus
13
+ @license MIT
14
+ */var T=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==r.join(""))return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach((function(e){o[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},o)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,r,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),a=1;a<arguments.length;a++){for(var i in n=Object(arguments[a]))$.call(n,i)&&(o[i]=n[i]);if(O){r=O(n);for(var c=0;c<r.length;c++)k.call(n,r[c])&&(o[r[c]]=n[r[c]])}}return o},P="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",j=Function.call.bind(Object.prototype.hasOwnProperty),R=function(){};if("production"!==process.env.NODE_ENV){var _=P,I={},M=j;R=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function A(e,t,n,r,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(M(e,a)){var i;try{if("function"!=typeof e[a]){var c=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw c.name="Invariant Violation",c}i=e[a](t,a,r,n,null,_)}catch(e){i=e}if(!i||i instanceof Error||R((r||"React class")+": type specification of "+n+" `"+a+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof i+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),i instanceof Error&&!(i.message in I)){I[i.message]=!0;var s=o?o():"";R("Failed "+n+" type: "+i.message+(null!=s?s:""))}}}A.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(I={})};var F=A,q=function(){};function z(){return null}"production"!==process.env.NODE_ENV&&(q=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var V=function(e,t){var n="function"==typeof Symbol&&Symbol.iterator,r="@@iterator";var o="<<anonymous>>",a={array:l("array"),bigint:l("bigint"),bool:l("boolean"),func:l("function"),number:l("number"),object:l("object"),string:l("string"),symbol:l("symbol"),any:s(z),arrayOf:function(e){return s((function(t,n,r,o,a){if("function"!=typeof e)return new c("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside arrayOf.");var i=t[n];if(!Array.isArray(i))return new c("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+r+"`, expected an array.");for(var s=0;s<i.length;s++){var l=e(i,s,r,o,a+"["+s+"]",P);if(l instanceof Error)return l}return null}))},element:s((function(t,n,r,o,a){var i=t[n];return e(i)?null:new c("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+r+"`, expected a single ReactElement.")})),elementType:s((function(e,t,n,r,o){var a=e[t];return S.isValidElementType(a)?null:new c("Invalid "+r+" `"+o+"` of type `"+p(a)+"` supplied to `"+n+"`, expected a single ReactElement type.")})),instanceOf:function(e){return s((function(t,n,r,a,i){if(!(t[n]instanceof e)){var s=e.name||o;return new c("Invalid "+a+" `"+i+"` of type `"+(((l=t[n]).constructor&&l.constructor.name?l.constructor.name:o)+"` supplied to `")+r+"`, expected instance of `"+s+"`.")}var l;return null}))},node:s((function(e,t,n,r,o){return f(e[t])?null:new c("Invalid "+r+" `"+o+"` supplied to `"+n+"`, expected a ReactNode.")})),objectOf:function(e){return s((function(t,n,r,o,a){if("function"!=typeof e)return new c("Property `"+a+"` of component `"+r+"` has invalid PropType notation inside objectOf.");var i=t[n],s=p(i);if("object"!==s)return new c("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected an object.");for(var l in i)if(j(i,l)){var u=e(i,l,r,o,a+"."+l,P);if(u instanceof Error)return u}return null}))},oneOf:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&q(arguments.length>1?"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]).":"Invalid argument supplied to oneOf, expected an array."),z;return s((function(t,n,r,o,a){for(var s=t[n],l=0;l<e.length;l++)if(i(s,e[l]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===d(t)?String(t):t}));return new c("Invalid "+o+" `"+a+"` of value `"+String(s)+"` supplied to `"+r+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&q("Invalid argument supplied to oneOfType, expected an instance of array."),z;for(var t=0;t<e.length;t++){var n=e[t];if("function"!=typeof n)return q("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+m(n)+" at index "+t+"."),z}return s((function(t,n,r,o,a){for(var i=[],s=0;s<e.length;s++){var l=(0,e[s])(t,n,r,o,a,P);if(null==l)return null;l.data&&j(l.data,"expectedType")&&i.push(l.data.expectedType)}return new c("Invalid "+o+" `"+a+"` supplied to `"+r+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")}))},shape:function(e){return s((function(t,n,r,o,a){var i=t[n],s=p(i);if("object"!==s)return new c("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");for(var l in e){var f=e[l];if("function"!=typeof f)return u(r,o,a,l,d(f));var m=f(i,l,r,o,a+"."+l,P);if(m)return m}return null}))},exact:function(e){return s((function(t,n,r,o,a){var i=t[n],s=p(i);if("object"!==s)return new c("Invalid "+o+" `"+a+"` of type `"+s+"` supplied to `"+r+"`, expected `object`.");var l=T({},t[n],e);for(var f in l){var m=e[f];if(j(e,f)&&"function"!=typeof m)return u(r,o,a,f,d(m));if(!m)return new c("Invalid "+o+" `"+a+"` key `"+f+"` supplied to `"+r+"`.\nBad object: "+JSON.stringify(t[n],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=m(i,f,r,o,a+"."+f,P);if(y)return y}return null}))}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function c(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function s(e){if("production"!==process.env.NODE_ENV)var n={},r=0;function a(a,i,s,l,u,f,p){if(l=l||o,f=f||s,p!==P){if(t){var d=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 d.name="Invariant Violation",d}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var m=l+":"+s;!n[m]&&r<3&&(q("You are manually calling a React.PropTypes validation function for the `"+f+"` prop on `"+l+"`. 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."),n[m]=!0,r++)}}return null==i[s]?a?null===i[s]?new c("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `null`."):new c("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `undefined`."):null:e(i,s,l,u,f)}var i=a.bind(null,!1);return i.isRequired=a.bind(null,!0),i}function l(e){return s((function(t,n,r,o,a,i){var s=t[n];return p(s)!==e?new c("Invalid "+o+" `"+a+"` of type `"+d(s)+"` supplied to `"+r+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,n,r,o){return new c((e||"React class")+": "+t+" type `"+n+"."+r+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+o+"`.")}function f(t){switch(typeof t){case"number":case"string":case"undefined":return!0;case"boolean":return!t;case"object":if(Array.isArray(t))return t.every(f);if(null===t||e(t))return!0;var o=function(e){var t=e&&(n&&e[n]||e[r]);if("function"==typeof t)return t}(t);if(!o)return!1;var a,i=o.call(t);if(o!==t.entries){for(;!(a=i.next()).done;)if(!f(a.value))return!1}else for(;!(a=i.next()).done;){var c=a.value;if(c&&!f(c[1]))return!1}return!0;default:return!1}}function p(e){var t=typeof e;return Array.isArray(e)?"array":e instanceof RegExp?"object":function(e,t){return"symbol"===e||!!t&&("Symbol"===t["@@toStringTag"]||"function"==typeof Symbol&&t instanceof Symbol)}(t,e)?"symbol":t}function d(e){if(null==e)return""+e;var t=p(e);if("object"===t){if(e instanceof Date)return"date";if(e instanceof RegExp)return"regexp"}return t}function m(e){var t=d(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return c.prototype=Error.prototype,a.checkPropTypes=F,a.resetWarningCache=F.resetWarningCache,a.PropTypes=a,a};function D(){}function L(){}L.resetWarningCache=D;var W=t((function(e){if("production"!==process.env.NODE_ENV){var t=S;e.exports=V(t.isElement,!0)}else e.exports=function(){function e(e,t,n,r,o,a){if(a!==P){var i=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 i.name="Invariant Violation",i}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:L,resetWarningCache:D};return n.PropTypes=n,n}()}));const U=({variant:t,size:n,onClick:r,children:o,icon:a,iconPosition:i,className:c,style:s,processing:l})=>{let u=`btn ${c}`;"default"!==t&&(u+=` btn-${t}`),"md"!==n&&(u+=` btn-${n}`),"default"!==s&&(u+=` btn-${s}`),l&&(u+=" btn-processing");const f=l?e.createElement(e.Fragment,null,e.createElement("i",{className:"fa-solid fa-spinner-third fa-spin","aria-hidden":"true"}),o&&e.createElement("span",null,o,"…")):a?"end"===i?e.createElement(e.Fragment,null,o&&e.createElement("span",null,o),e.createElement("i",{className:`fa-solid ${a}`,"aria-hidden":"true"})):e.createElement(e.Fragment,null,e.createElement("i",{className:`fa-solid ${a}`,"aria-hidden":"true"}),o&&e.createElement("span",null,o)):o&&e.createElement("span",null,o);return e.createElement("button",{className:u,onClick:r},f)};U.propTypes={variant:W.oneOf(["primary","secondary","terciary","outline"]),size:W.oneOf(["xs","md","lg"]),onClick:W.func,children:W.node,icon:W.node,iconPosition:W.oneOf(["start","end"]),className:W.string,style:W.oneOf(["default","success","danger","warning","link"]),processing:W.bool},U.defaultProps={variant:"primary",size:"md",onClick:null,icon:null,iconPosition:"start",className:"",style:"default",processing:!1};const Y=()=>({toCamelCase:e.useCallback((e=>{let t=e?.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g,(function(e,t){return 0==+e?"":0===t?e?.toLowerCase():e?.toUpperCase()}));return t=t?.replace(/^\d+/,""),t=t?.replace(/[^a-zA-Z0-9_]/g,""),t}),[])}),B=({children:t,className:n,id:r,checked:o,setChecked:a,name:i})=>{const{toCamelCase:c}=Y();let s=r;r||"string"!=typeof t||(s=c(t));return e.createElement("div",{className:`form-group form-check ${n}`},e.createElement("label",{className:"checkbox"},e.createElement("input",{type:"checkbox",defaultChecked:o,checked:o,onChange:e=>{a(e.target.checked)},minLength:"1",id:s,name:i}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};B.propTypes={className:W.string,id:W.string,checked:W.bool,setChecked:W.func,name:W.string},B.defaultProps={className:"",id:"",checked:!1,setChecked:()=>{}};const J=({type:t,size:n,value:r,label:o,prefix:a,suffix:i,icon:c,helpText:s,requiredText:l,onChange:u,className:f,showError:p,name:d,disabled:m})=>{const{toCamelCase:y}=Y(),h="lg"===n?"form-control-lg":"xs"===n?"form-control-xs":"",b=y(o),g="not-validated";return e.createElement("div",{className:`position-relative ${f}`},a||i||c?e.createElement("div",{className:p?`input-group ${g}`:"input-group","data-error":l},c&&e.createElement("span",{className:"input-group-text"},e.createElement("i",{className:`fa-solid ${c}`})),a&&e.createElement("span",{className:"input-group-text"},a),e.createElement("div",{className:"form-floating"},e.createElement("input",{type:t,className:`form-control ${h}`,value:r,id:b,name:d,placeholder:o,onChange:u,required:!!l}),e.createElement("label",{htmlFor:b},o)),i&&e.createElement("span",{className:"input-group-text"},i)):e.createElement("div",{className:p?`form-floating ${g}`:"form-floating","data-error":l},e.createElement("input",{type:t,className:`form-control ${h}`,value:r,id:b,placeholder:o,onChange:u,required:!!l,name:d,disabled:m}),e.createElement("label",{htmlFor:b},o)),s&&e.createElement("small",{className:"form-text text-muted"},s),l&&e.createElement("div",{className:"invalid-feedback"},l))};J.propTypes={type:W.oneOf(["color","date","datetime-local","email","file","image","month","number","password","tel","text","time","url","week"]).isRequired,size:W.oneOf(["xs","md","lg"]),value:W.oneOfType([W.string,W.number]),label:W.string.isRequired,prefix:W.string,suffix:W.string,icon:W.node,helpText:W.string,requiredText:W.string,onChange:W.func,className:W.string,name:W.string},J.defaultProps={type:"text",icon:null,helperText:null,prefixLeft:null,prefixRight:null,label:null,required:null,value:void 0,size:"md",onChange:null,className:""};const Z=({children:t,className:n,id:r,checked:o,setChecked:a,name:i})=>{const{toCamelCase:c}=Y();let s=r;r||"string"!=typeof t||(s=c(t));return e.createElement("div",{className:`form-group form-check ${n}`},e.createElement("label",{className:"radio"},e.createElement("input",{type:"radio",defaultChecked:o,onChange:e=>{a(e.target.checked)},minLength:"1",id:s,name:i}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};Z.propTypes={className:W.string,id:W.string,checked:W.bool,setChecked:W.func,name:W.string.isRequired},Z.defaultProps={className:"",id:"",checked:!1,setChecked:()=>{}};const H=({status:t,icon:n,size:r,children:o,className:a,id:i,setChecked:c,switchPosition:s,name:l})=>{const{toCamelCase:u}=Y(),f="lg"===r?"form-switch-lg":"xs"===r?"form-switch-xs":"",p=i||u(o);return e.createElement("div",{className:`form-check form-switch ${f} ${a} ${"end"===s?"switch-end":""} ${n?"switch-icon":""}`},e.createElement("input",{className:"form-check-input",type:"checkbox",role:"switch",defaultChecked:t,onChange:e=>{c(e.target.checked)},id:p,name:l}),o&&e.createElement("label",{className:"form-check-label",htmlFor:p},o))};H.propTypes={icon:W.bool,className:W.string,id:W.string,checked:W.bool,setChecked:W.func,switchPosition:W.oneOf(["start","end"]),name:W.string},H.defaultProps={icon:!1,className:"",id:"",checked:!1,setChecked:()=>{},switchPosition:"start"};const G=({size:t,value:n,label:r,helpText:o,requiredText:a,onChange:i,className:c,name:s})=>{const{toCamelCase:l}=Y(),u="lg"===t?"form-control-lg":"xs"===t?"form-control-xs":"",f=l(r),[p,d]=e.useState(!1);e.useEffect((()=>{a&&(d(!0),setTimeout((()=>{d(!1)}),3e3))}),[a]);const m=p?"not-validated":"";return e.createElement("div",{className:`position-relative ${c}`},e.createElement("div",{className:`form-floating ${m}`,"data-error":a},e.createElement("textarea",{className:`form-control ${u}`,onChange:i,placeholder:r,id:f,name:s,required:!!a}),e.createElement("label",{htmlFor:f},r),o&&e.createElement("small",{className:"form-text text-muted"},o)))};G.propTypes={size:W.oneOf(["xs","md","lg"]),label:W.string.isRequired,helpText:W.string,requiredText:W.string,onChange:W.func,className:W.string,name:W.string},G.defaultProps={icon:null,helperText:null,prefixLeft:null,prefixRight:null,label:null,required:null,value:void 0,size:"md",onChange:null,className:""},exports.Button=U,exports.Checkbox=B,exports.Input=J,exports.Radio=Z,exports.Switch=H,exports.Textarea=G;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groovinads-ui",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.es.js",
6
6
  "repository": "git@bitbucket.org:groovinads/react-components.git",
@@ -26,6 +26,7 @@
26
26
  "react-dom": "^18.2.0",
27
27
  "rollup": "^4.14.0",
28
28
  "rollup-plugin-babel": "^4.4.0",
29
+ "rollup-plugin-commonjs": "^10.1.0",
29
30
  "rollup-plugin-peer-deps-external": "^2.2.4",
30
31
  "rollup-plugin-postcss": "^4.0.2",
31
32
  "rollup-plugin-terser": "^7.0.2",
package/rollup.config.mjs CHANGED
@@ -3,7 +3,8 @@ import resolve from '@rollup/plugin-node-resolve';
3
3
  import external from 'rollup-plugin-peer-deps-external';
4
4
  import { terser } from 'rollup-plugin-terser';
5
5
  import postcss from 'rollup-plugin-postcss';
6
- import typescript from 'rollup-plugin-typescript2';
6
+ import commonjs from 'rollup-plugin-commonjs';
7
+ // import typescript from 'rollup-plugin-typescript2';
7
8
 
8
9
  export default [
9
10
  {
@@ -20,6 +21,9 @@ export default [
20
21
  }
21
22
  ],
22
23
  plugins: [
24
+ commonjs({
25
+ include: 'node_modules/**', // incluye todos los módulos de node_modules
26
+ }),
23
27
  postcss({
24
28
  plugins: [],
25
29
  minimize: true,
@@ -29,7 +33,7 @@ export default [
29
33
  presets: ['@babel/preset-react']
30
34
  }),
31
35
  external(),
32
- typescript(), // Añade esto para procesar archivos TypeScript
36
+ // typescript(), // Añade esto para procesar archivos TypeScript
33
37
  resolve({extensions: ['.mjs', '.js', '.jsx', '.ts', '.tsx', '.json']}),
34
38
  terser(),
35
39
  ]
@@ -1,32 +1,21 @@
1
1
  import React from 'react';
2
+ import PropTypes from 'prop-types';
2
3
 
3
- type ButtonProps = {
4
- variant?: 'primary' | 'secondary' | 'terciary' | 'outline';
5
- size?: 'xs' | 'md' | 'lg';
6
- onClick?: () => void;
7
- children: React.ReactNode;
8
- icon?: string | undefined;
9
- iconPosition?: 'start' | 'end';
10
- className?: string;
11
- style?: 'default' | 'success' | 'danger' | 'warning' | 'link';
12
- processing?: boolean;
13
- }
14
-
15
- const Button = ({
16
- variant = 'primary',
17
- size = 'md',
18
- onClick = () => {},
19
- children = null,
4
+ const Button = ({
5
+ variant,
6
+ size,
7
+ onClick,
8
+ children,
20
9
  icon,
21
- iconPosition = 'start',
22
- className = '',
23
- style = 'default',
24
- processing = false,
25
- }: ButtonProps) => {
10
+ iconPosition,
11
+ className,
12
+ style,
13
+ processing,
14
+ }) => {
26
15
  let classes = `btn ${className}`;
27
16
 
28
17
  // Variant
29
- if (variant !== 'primary') {
18
+ if (variant !== 'default') {
30
19
  classes += ` btn-${variant}`;
31
20
  }
32
21
 
@@ -74,5 +63,27 @@ type ButtonProps = {
74
63
  );
75
64
  };
76
65
 
66
+ Button.propTypes = {
67
+ variant: PropTypes.oneOf(['primary', 'secondary', 'terciary', 'outline']),
68
+ size: PropTypes.oneOf(['xs', 'md', 'lg']),
69
+ onClick: PropTypes.func,
70
+ children: PropTypes.node,
71
+ icon: PropTypes.node,
72
+ iconPosition: PropTypes.oneOf(['start', 'end']),
73
+ className: PropTypes.string,
74
+ style: PropTypes.oneOf(['default', 'success', 'danger', 'warning', 'link']),
75
+ processing: PropTypes.bool,
76
+ };
77
+
78
+ Button.defaultProps = {
79
+ variant: 'primary',
80
+ size: 'md',
81
+ onClick: null,
82
+ icon: null,
83
+ iconPosition: 'start',
84
+ className: '',
85
+ style: 'default',
86
+ processing: false,
87
+ };
77
88
 
78
89
  export default Button;
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ // STYLES
5
+ /* import '../../scss/components/_checks.scss'; */
6
+
7
+ // HOOKS
8
+ import useTextFormatter from '../../hooks/textFormatter';
9
+
10
+ // Checkbox
11
+ const Checkbox = ({ children, className, id, checked, setChecked, name }) => {
12
+ const { toCamelCase } = useTextFormatter();
13
+
14
+ let checkboxId = id;
15
+ if (!id && typeof children === 'string') {
16
+ checkboxId = toCamelCase(children);
17
+ }
18
+
19
+ const handleChange = (event) => {
20
+ setChecked(event.target.checked);
21
+ };
22
+
23
+ return (
24
+ <div className={`form-group form-check ${className}`}>
25
+ <label className='checkbox'>
26
+ <input
27
+ type='checkbox'
28
+ defaultChecked={checked}
29
+ checked={checked}
30
+ onChange={handleChange}
31
+ minLength='1'
32
+ id={checkboxId}
33
+ name={name}
34
+ />
35
+ <span className='outer'>
36
+ <span className='inner'></span>
37
+ </span>
38
+ {children}
39
+ </label>
40
+ </div>
41
+ );
42
+ };
43
+
44
+ Checkbox.propTypes = {
45
+ className: PropTypes.string,
46
+ id: PropTypes.string,
47
+ checked: PropTypes.bool,
48
+ setChecked: PropTypes.func,
49
+ name: PropTypes.string,
50
+ };
51
+
52
+ Checkbox.defaultProps = {
53
+ className: '',
54
+ id: '',
55
+ checked: false,
56
+ setChecked: () => {},
57
+ };
58
+
59
+ export default Checkbox;
@@ -0,0 +1,133 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ // HOOKS
5
+ import useTextFormatter from '../../hooks/textFormatter';
6
+
7
+ // Input
8
+ const Input = ({
9
+ type,
10
+ size,
11
+ value,
12
+ label,
13
+ prefix,
14
+ suffix,
15
+ icon,
16
+ helpText,
17
+ requiredText,
18
+ onChange,
19
+ className,
20
+ showError,
21
+ name,
22
+ disabled,
23
+ }) => {
24
+ const { toCamelCase } = useTextFormatter();
25
+
26
+ const sizeClass =
27
+ size === 'lg' ? 'form-control-lg' : size === 'xs' ? 'form-control-xs' : '';
28
+ const id = toCamelCase(label);
29
+
30
+ const notValidatedClass = 'not-validated';
31
+
32
+ return (
33
+ <div className={`position-relative ${className}`}>
34
+ {prefix || suffix || icon ? (
35
+ <div
36
+ className={
37
+ showError ? `input-group ${notValidatedClass}` : 'input-group'
38
+ }
39
+ data-error={requiredText}
40
+ >
41
+ {icon && (
42
+ <span className='input-group-text'>
43
+ <i className={`fa-solid ${icon}`}></i>
44
+ </span>
45
+ )}
46
+ {prefix && <span className='input-group-text'>{prefix}</span>}
47
+ <div className='form-floating'>
48
+ <input
49
+ type={type}
50
+ className={`form-control ${sizeClass}`}
51
+ value={value}
52
+ id={id}
53
+ name={name}
54
+ placeholder={label}
55
+ onChange={onChange}
56
+ required={!!requiredText}
57
+ />
58
+ <label htmlFor={id}>{label}</label>
59
+ </div>
60
+ {suffix && <span className='input-group-text'>{suffix}</span>}
61
+ </div>
62
+ ) : (
63
+ <div
64
+ className={
65
+ showError ? `form-floating ${notValidatedClass}` : 'form-floating'
66
+ }
67
+ data-error={requiredText}
68
+ >
69
+ <input
70
+ type={type}
71
+ className={`form-control ${sizeClass}`}
72
+ value={value}
73
+ id={id}
74
+ placeholder={label}
75
+ onChange={onChange}
76
+ required={!!requiredText}
77
+ name={name}
78
+ disabled={disabled}
79
+ />
80
+ <label htmlFor={id}>{label}</label>
81
+ </div>
82
+ )}
83
+ {helpText && <small className='form-text text-muted'>{helpText}</small>}
84
+ {requiredText && <div className='invalid-feedback'>{requiredText}</div>}
85
+ </div>
86
+ );
87
+ };
88
+
89
+ Input.propTypes = {
90
+ type: PropTypes.oneOf([
91
+ 'color',
92
+ 'date',
93
+ 'datetime-local',
94
+ 'email',
95
+ 'file',
96
+ 'image',
97
+ 'month',
98
+ 'number',
99
+ 'password',
100
+ 'tel',
101
+ 'text',
102
+ 'time',
103
+ 'url',
104
+ 'week',
105
+ ]).isRequired,
106
+ size: PropTypes.oneOf(['xs', 'md', 'lg']),
107
+ value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
108
+ label: PropTypes.string.isRequired,
109
+ prefix: PropTypes.string,
110
+ suffix: PropTypes.string,
111
+ icon: PropTypes.node,
112
+ helpText: PropTypes.string,
113
+ requiredText: PropTypes.string,
114
+ onChange: PropTypes.func,
115
+ className: PropTypes.string,
116
+ name: PropTypes.string,
117
+ };
118
+
119
+ Input.defaultProps = {
120
+ type: 'text',
121
+ icon: null,
122
+ helperText: null,
123
+ prefixLeft: null,
124
+ prefixRight: null,
125
+ label: null,
126
+ required: null,
127
+ value: undefined,
128
+ size: 'md',
129
+ onChange: null,
130
+ className: '',
131
+ };
132
+
133
+ export default Input;
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ // HOOKS
5
+ import useTextFormatter from '../../hooks/textFormatter';
6
+
7
+ // Radio
8
+ const Radio = ({ children, className, id, checked, setChecked, name }) => {
9
+ const { toCamelCase } = useTextFormatter();
10
+
11
+ let RadioId = id;
12
+ if (!id && typeof children === 'string') {
13
+ RadioId = toCamelCase(children);
14
+ }
15
+
16
+ const handleChange = (event) => {
17
+ setChecked(event.target.checked);
18
+ };
19
+
20
+ return (
21
+ <div className={`form-group form-check ${className}`}>
22
+ <label className='radio'>
23
+ <input
24
+ type='radio'
25
+ defaultChecked={checked}
26
+ onChange={handleChange}
27
+ minLength='1'
28
+ id={RadioId}
29
+ name={name}
30
+ />
31
+ <span className='outer'>
32
+ <span className='inner'></span>
33
+ </span>
34
+ {children}
35
+ </label>
36
+ </div>
37
+ );
38
+ };
39
+
40
+ Radio.propTypes = {
41
+ className: PropTypes.string,
42
+ id: PropTypes.string,
43
+ checked: PropTypes.bool,
44
+ setChecked: PropTypes.func,
45
+ name: PropTypes.string.isRequired,
46
+ };
47
+
48
+ Radio.defaultProps = {
49
+ className: '',
50
+ id: '',
51
+ checked: false,
52
+ setChecked: () => {},
53
+ };
54
+
55
+ export default Radio;
@@ -0,0 +1,72 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ // HOOKS
5
+ import useTextFormatter from '../../hooks/textFormatter';
6
+
7
+ const Switch = ({
8
+ status,
9
+ icon,
10
+ size,
11
+ children,
12
+ className,
13
+ id,
14
+ setChecked,
15
+ switchPosition,
16
+ name
17
+ }) => {
18
+ const { toCamelCase } = useTextFormatter();
19
+
20
+ const sizeClass =
21
+ size === 'lg' ? 'form-switch-lg' : size === 'xs' ? 'form-switch-xs' : '';
22
+
23
+ const inputId = id ? id : toCamelCase(children);
24
+
25
+ const handleChange = (event) => {
26
+ setChecked(event.target.checked);
27
+ };
28
+
29
+ return (
30
+ <div
31
+ className={`form-check form-switch ${sizeClass} ${className} ${
32
+ switchPosition === 'end' ? 'switch-end' : ''
33
+ } ${icon ? 'switch-icon' : ''}`}
34
+ >
35
+ <input
36
+ className='form-check-input'
37
+ type='checkbox'
38
+ role='switch'
39
+ defaultChecked={status}
40
+ onChange={handleChange}
41
+ id={inputId}
42
+ name={name}
43
+ />
44
+ {children && (
45
+ <label className='form-check-label' htmlFor={inputId}>
46
+ {children}
47
+ </label>
48
+ )}
49
+ </div>
50
+ );
51
+ };
52
+
53
+ Switch.propTypes = {
54
+ icon: PropTypes.bool,
55
+ className: PropTypes.string,
56
+ id: PropTypes.string,
57
+ checked: PropTypes.bool,
58
+ setChecked: PropTypes.func,
59
+ switchPosition: PropTypes.oneOf(['start', 'end']),
60
+ name: PropTypes.string,
61
+ };
62
+
63
+ Switch.defaultProps = {
64
+ icon: false,
65
+ className: '',
66
+ id: '',
67
+ checked: false,
68
+ setChecked: () => {},
69
+ switchPosition: 'start',
70
+ };
71
+
72
+ export default Switch;
@@ -0,0 +1,79 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+
4
+ // HOOKS
5
+ import useTextFormatter from '../../hooks/textFormatter';
6
+
7
+ const Textarea = ({
8
+ size,
9
+ value,
10
+ label,
11
+ helpText,
12
+ requiredText,
13
+ onChange,
14
+ className,
15
+ name
16
+ }) => {
17
+ const { toCamelCase } = useTextFormatter();
18
+
19
+ const sizeClass =
20
+ size === 'lg' ? 'form-control-lg' : size === 'xs' ? 'form-control-xs' : '';
21
+ const id = toCamelCase(label);
22
+ const [notValidated, setNotValidated] = useState(false);
23
+
24
+ useEffect(() => {
25
+ if (requiredText) {
26
+ setNotValidated(true);
27
+ setTimeout(() => {
28
+ setNotValidated(false);
29
+ }, 3000);
30
+ }
31
+ }, [requiredText]);
32
+
33
+ const notValidatedClass = notValidated ? 'not-validated' : '';
34
+
35
+ return (
36
+ <div className={`position-relative ${className}`}>
37
+ <div
38
+ className={`form-floating ${notValidatedClass}`}
39
+ data-error={requiredText}
40
+ >
41
+ <textarea
42
+ className={`form-control ${sizeClass}`}
43
+ onChange={onChange}
44
+ placeholder={label}
45
+ id={id}
46
+ name={name}
47
+ required={!!requiredText}
48
+ />
49
+ <label htmlFor={id}>{label}</label>
50
+ {helpText && <small className='form-text text-muted'>{helpText}</small>}
51
+ </div>
52
+ </div>
53
+ );
54
+ };
55
+
56
+ Textarea.propTypes = {
57
+ size: PropTypes.oneOf(['xs', 'md', 'lg']),
58
+ label: PropTypes.string.isRequired,
59
+ helpText: PropTypes.string,
60
+ requiredText: PropTypes.string,
61
+ onChange: PropTypes.func,
62
+ className: PropTypes.string,
63
+ name: PropTypes.string,
64
+ };
65
+
66
+ Textarea.defaultProps = {
67
+ icon: null,
68
+ helperText: null,
69
+ prefixLeft: null,
70
+ prefixRight: null,
71
+ label: null,
72
+ required: null,
73
+ value: undefined,
74
+ size: 'md',
75
+ onChange: null,
76
+ className: '',
77
+ };
78
+
79
+ export default Textarea;
@@ -0,0 +1,7 @@
1
+ import Checkbox from './Checkbox';
2
+ import Input from './Input';
3
+ import Radio from './Radio';
4
+ import Switch from './Switch';
5
+ import Textarea from './Textarea';
6
+
7
+ export { Checkbox, Input, Radio, Switch, Textarea }
@@ -0,0 +1,3 @@
1
+ import textFormatter from './textFormatter';
2
+
3
+ export { textFormatter };
@@ -0,0 +1,24 @@
1
+ import { useCallback } from 'react';
2
+
3
+ const useTextFormatter = () => {
4
+ const toCamelCase = useCallback((str) => {
5
+ let s = str?.replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, index) {
6
+ if (+match === 0) return ''; // or if (/\s+/.test(match)) for white spaces
7
+ return index === 0 ? match?.toLowerCase() : match?.toUpperCase();
8
+ });
9
+
10
+ // Ensure the string doesn't start with a number
11
+ s = s?.replace(/^\d+/, '');
12
+
13
+ // Remove any remaining non-alphanumeric characters (excluding underscores)
14
+ s = s?.replace(/[^a-zA-Z0-9_]/g, '');
15
+
16
+ return s;
17
+ }, []);
18
+
19
+ // Additional methods can be added here
20
+
21
+ return { toCamelCase };
22
+ };
23
+
24
+ export default useTextFormatter;
package/src/index.js CHANGED
@@ -1,3 +1,9 @@
1
1
  import Button from "./components/Button/Button";
2
2
 
3
- export { Button };
3
+ import Checkbox from './components/Inputs/Checkbox';
4
+ import Input from './components/Inputs/Input';
5
+ import Radio from './components/Inputs/Radio';
6
+ import Switch from './components/Inputs/Switch';
7
+ import Textarea from './components/Inputs/Textarea';
8
+
9
+ export { Button, Checkbox, Input, Radio, Switch, Textarea }
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import Checkbox from "../components/Inputs/Checkbox";
3
+
4
+ export default {
5
+ title: "Example/Checkbox",
6
+ component: Checkbox,
7
+ };
8
+
9
+ const Template = (args) => <Checkbox {...args}>Checkbox</Checkbox>;
10
+
11
+ export const Primary = Template.bind({});
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import Input from "../components/Inputs/Input";
3
+
4
+ export default {
5
+ title: "Example/Input",
6
+ component: Input,
7
+ };
8
+
9
+ const Template = (args) => <Input {...args}>Input</Input>;
10
+
11
+ export const Primary = Template.bind({});
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import Radio from "../components/Inputs/Radio";
3
+
4
+ export default {
5
+ title: "Example/Radio",
6
+ component: Radio,
7
+ };
8
+
9
+ const Template = (args) => <Radio {...args}>Radio</Radio>;
10
+
11
+ export const Primary = Template.bind({});
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import Switch from "../components/Inputs/Switch";
3
+
4
+ export default {
5
+ title: "Example/Switch",
6
+ component: Switch,
7
+ };
8
+
9
+ const Template = (args) => <Switch {...args}>Switch</Switch>;
10
+
11
+ export const Primary = Template.bind({});
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import Textarea from "../components/Inputs/Textarea";
3
+
4
+ export default {
5
+ title: "Example/Textarea",
6
+ component: Textarea,
7
+ };
8
+
9
+ const Template = (args) => <Textarea {...args}>Textarea</Textarea>;
10
+
11
+ export const Primary = Template.bind({});