groovinads-ui 1.0.8 → 1.0.9
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/.yarn/install-state.gz +0 -0
- package/README (test).md +141 -0
- package/assets/groovinads-logo.png +0 -0
- package/dist/index.es.js +3 -3
- package/dist/index.js +2 -2
- package/package.json +4 -2
- package/src/components/Button/Button.jsx +60 -71
- package/src/components/Button/index.js +1 -1
- package/src/components/Inputs/Checkbox.jsx +14 -18
- package/src/components/Inputs/Input.jsx +36 -45
- package/src/components/Inputs/Radio.jsx +13 -13
- package/src/components/Inputs/Switch.jsx +12 -21
- package/src/components/Inputs/Textarea.jsx +18 -33
- package/src/stories/Button.stories.jsx +4 -4
- package/src/stories/Checkbox.stories.jsx +11 -5
- package/src/stories/Input.stories.jsx +14 -5
- package/src/stories/Radio.stories.jsx +12 -5
- package/src/stories/Switch.stories.jsx +11 -5
- package/src/stories/Textarea.stories.jsx +14 -5
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/README (test).md
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
<img src="assets/groovinads-logo.png" alt="Groovinads logo" width="200">
|
|
2
|
+
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Groovinads UI
|
|
6
|
+
Groovinads UI is a React component library that provides ready-to-use UI elements based on the Groovinads UI kit. This library is designed to facilitate the implementation of common UI elements in Groovinads applications.
|
|
7
|
+
|
|
8
|
+
## Included Components (v 1.0.9)
|
|
9
|
+
|
|
10
|
+
The library includes the following components:
|
|
11
|
+
|
|
12
|
+
- **Buttons**: For user actions.
|
|
13
|
+
- **Checkbox**: For multiple option selections.
|
|
14
|
+
- **Input**: For user data entry.
|
|
15
|
+
- **Radio**: For exclusive selections.
|
|
16
|
+
- **Switch**: For toggle states.
|
|
17
|
+
- **Textarea**: For multiline text input.
|
|
18
|
+
|
|
19
|
+
## Requirements
|
|
20
|
+
- The component styles must be included from: `https://ui.groovinads.com/styles.min.css`.
|
|
21
|
+
- **npm** (v18 or higher).
|
|
22
|
+
- [Font Awesome](https://fontawesome.com/) icons must be included in the project.
|
|
23
|
+
|
|
24
|
+
## Installation
|
|
25
|
+
|
|
26
|
+
To use the Groovinads UI library in your project, run the following command:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
yarn add groovinads-ui
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
Here are examples of how to use the components included in the Groovinads UI library:
|
|
34
|
+
|
|
35
|
+
### Button
|
|
36
|
+
```jsx
|
|
37
|
+
<Button
|
|
38
|
+
variant={'primary | secondary | tertiary | outline'}
|
|
39
|
+
size={'xs | md | lg'}
|
|
40
|
+
onClick={function}
|
|
41
|
+
icon?={FontAwesome Icon string}
|
|
42
|
+
iconPosition={'start | end'}
|
|
43
|
+
className={string}
|
|
44
|
+
processing={boolean}
|
|
45
|
+
>
|
|
46
|
+
children
|
|
47
|
+
</Button>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Prop name | Description | Options | Default values | Type |
|
|
51
|
+
|--------------|--------------|--------------|--------------|--------------|
|
|
52
|
+
| ```variant``` | Fila 1, Col 2 | ``` primary ``` ``` secondary ``` ``` terciary ``` ``` outline ```| ``` primary ```| String |
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Checkbox
|
|
57
|
+
```jsx
|
|
58
|
+
<Checkbox
|
|
59
|
+
className={string}
|
|
60
|
+
id={string}
|
|
61
|
+
name={id}
|
|
62
|
+
status={boolean}
|
|
63
|
+
setStatus={function}
|
|
64
|
+
>
|
|
65
|
+
children
|
|
66
|
+
</Checkbox>
|
|
67
|
+
```
|
|
68
|
+
### Input
|
|
69
|
+
```jsx
|
|
70
|
+
<Input
|
|
71
|
+
className={string}
|
|
72
|
+
disabled={boolean}
|
|
73
|
+
helpText={string}
|
|
74
|
+
icon={string}
|
|
75
|
+
label={string}
|
|
76
|
+
name={string}
|
|
77
|
+
onChange={function}
|
|
78
|
+
prefix={string}
|
|
79
|
+
requiredText={string}
|
|
80
|
+
showError={boolean}
|
|
81
|
+
setShowError={function}
|
|
82
|
+
size={'xs | md | xl'}
|
|
83
|
+
suffix={string}
|
|
84
|
+
type={'color | date | datetime-local | email | file | image | month | number | password | tel | text | time | url | week'}
|
|
85
|
+
value={string | number}
|
|
86
|
+
/>
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Radio
|
|
90
|
+
```jsx
|
|
91
|
+
<Radio
|
|
92
|
+
className={string}
|
|
93
|
+
id={string}
|
|
94
|
+
name={string}
|
|
95
|
+
setStatus={function}
|
|
96
|
+
status={boolean}
|
|
97
|
+
>
|
|
98
|
+
children
|
|
99
|
+
</Radio>
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Switch
|
|
103
|
+
```jsx
|
|
104
|
+
<Switch
|
|
105
|
+
className={string}
|
|
106
|
+
icon={boolean}
|
|
107
|
+
id={string}
|
|
108
|
+
name={string}
|
|
109
|
+
size={'xs | md | xl'}
|
|
110
|
+
setStatus={function}
|
|
111
|
+
status={boolean}
|
|
112
|
+
switchPosition={'start | end'}
|
|
113
|
+
>
|
|
114
|
+
children
|
|
115
|
+
</Switch>
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Textarea
|
|
119
|
+
```jsx
|
|
120
|
+
<Textarea
|
|
121
|
+
className={string}
|
|
122
|
+
helpText={string}
|
|
123
|
+
label={string}
|
|
124
|
+
name={string}
|
|
125
|
+
onChange={function}
|
|
126
|
+
requiredText={string}
|
|
127
|
+
showError={boolean}
|
|
128
|
+
setShowError={function}
|
|
129
|
+
size={'xs | md | xl'}
|
|
130
|
+
/>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Customization
|
|
134
|
+
Currently, the components are not customizable.
|
|
135
|
+
|
|
136
|
+
## Contributions
|
|
137
|
+
This library is for internal use by Groovinads and is not open to external contributions.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
For more information or support, contact the [Groovinads development team](mailto:helpdesk@groovinads.com).
|
|
Binary file
|
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useCallback as t,
|
|
1
|
+
import e,{useCallback as t,useEffect as r}from"react";function n(e,t){return e(t={exports:{}},t.exports),t.exports
|
|
2
2
|
/** @license React v16.13.1
|
|
3
3
|
* react-is.production.min.js
|
|
4
4
|
*
|
|
@@ -6,9 +6,9 @@ import e,{useCallback as t,useState as n,useEffect as r}from"react";function o(e
|
|
|
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 o="function"==typeof Symbol&&Symbol.for,a=o?Symbol.for("react.element"):60103,i=o?Symbol.for("react.portal"):60106,s=o?Symbol.for("react.fragment"):60107,c=o?Symbol.for("react.strict_mode"):60108,l=o?Symbol.for("react.profiler"):60114,u=o?Symbol.for("react.provider"):60109,f=o?Symbol.for("react.context"):60110,p=o?Symbol.for("react.async_mode"):60111,m=o?Symbol.for("react.concurrent_mode"):60111,d=o?Symbol.for("react.forward_ref"):60112,y=o?Symbol.for("react.suspense"):60113,b=o?Symbol.for("react.suspense_list"):60120,g=o?Symbol.for("react.memo"):60115,h=o?Symbol.for("react.lazy"):60116,v=o?Symbol.for("react.block"):60121,E=o?Symbol.for("react.fundamental"):60117,x=o?Symbol.for("react.responder"):60118,S=o?Symbol.for("react.scope"):60119;function w(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case a:switch(e=e.type){case p:case m:case s:case l:case c:case y:return e;default:switch(e=e&&e.$$typeof){case f:case d:case h:case g:case u:return e;default:return t}}case i:return t}}}function O(e){return w(e)===m}var N={AsyncMode:p,ConcurrentMode:m,ContextConsumer:f,ContextProvider:u,Element:a,ForwardRef:d,Fragment:s,Lazy:h,Memo:g,Portal:i,Profiler:l,StrictMode:c,Suspense:y,isAsyncMode:function(e){return O(e)||w(e)===p},isConcurrentMode:O,isContextConsumer:function(e){return w(e)===f},isContextProvider:function(e){return w(e)===u},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===a},isForwardRef:function(e){return w(e)===d},isFragment:function(e){return w(e)===s},isLazy:function(e){return w(e)===h},isMemo:function(e){return w(e)===g},isPortal:function(e){return w(e)===i},isProfiler:function(e){return w(e)===l},isStrictMode:function(e){return w(e)===c},isSuspense:function(e){return w(e)===y},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===s||e===m||e===l||e===c||e===y||e===b||"object"==typeof e&&null!==e&&(e.$$typeof===h||e.$$typeof===g||e.$$typeof===u||e.$$typeof===f||e.$$typeof===d||e.$$typeof===E||e.$$typeof===x||e.$$typeof===S||e.$$typeof===v)},typeOf:w},$=n((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=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,s=e?Symbol.for("react.provider"):60109,c=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,m=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,h=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 r:var m=e.type;switch(m){case l:case u:case o:case i:case a:case p:return m;default:var b=m&&m.$$typeof;switch(b){case c:case f:case y:case d:case s:return b;default:return t}}case n:return t}}}var x=l,S=u,w=c,O=s,N=r,$=f,C=o,T=y,P=d,k=n,j=i,_=a,I=p,M=!1;function R(e){return E(e)===u}t.AsyncMode=x,t.ConcurrentMode=S,t.ContextConsumer=w,t.ContextProvider=O,t.Element=N,t.ForwardRef=$,t.Fragment=C,t.Lazy=T,t.Memo=P,t.Portal=k,t.Profiler=j,t.StrictMode=_,t.Suspense=I,t.isAsyncMode=function(e){return M||(M=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(e)||E(e)===l},t.isConcurrentMode=R,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},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)===d},t.isPortal=function(e){return E(e)===n},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===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===g||e.$$typeof===h||e.$$typeof===v||e.$$typeof===b)},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 C=n((function(e){"production"===process.env.NODE_ENV?e.exports=N:e.exports=$})),T=Object.getOwnPropertySymbols,P=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
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};
|
|
14
|
+
*/var j=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={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==n.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 r,n,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 r=Object(arguments[a]))P.call(r,i)&&(o[i]=r[i]);if(T){n=T(r);for(var s=0;s<n.length;s++)k.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},_="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 R=_,A={},F=I;M=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function V(e,t,r,n,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(F(e,a)){var i;try{if("function"!=typeof e[a]){var s=Error((n||"React class")+": "+r+" 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 s.name="Invariant Violation",s}i=e[a](t,a,n,r,null,R)}catch(e){i=e}if(!i||i instanceof Error||M((n||"React class")+": type specification of "+r+" `"+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 A)){A[i.message]=!0;var c=o?o():"";M("Failed "+r+" type: "+i.message+(null!=c?c:""))}}}V.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(A={})};var z=V,q=function(){};function D(){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 L=function(e,t){var r="function"==typeof Symbol&&Symbol.iterator,n="@@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:c(D),arrayOf:function(e){return c((function(t,r,n,o,a){if("function"!=typeof e)return new s("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var i=t[r];if(!Array.isArray(i))return new s("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+n+"`, expected an array.");for(var c=0;c<i.length;c++){var l=e(i,c,n,o,a+"["+c+"]",_);if(l instanceof Error)return l}return null}))},element:c((function(t,r,n,o,a){var i=t[r];return e(i)?null:new s("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:c((function(e,t,r,n,o){var a=e[t];return C.isValidElementType(a)?null:new s("Invalid "+n+" `"+o+"` of type `"+p(a)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return c((function(t,r,n,a,i){if(!(t[r]instanceof e)){var c=e.name||o;return new s("Invalid "+a+" `"+i+"` of type `"+(((l=t[r]).constructor&&l.constructor.name?l.constructor.name:o)+"` supplied to `")+n+"`, expected instance of `"+c+"`.")}var l;return null}))},node:c((function(e,t,r,n,o){return f(e[t])?null:new s("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return c((function(t,r,n,o,a){if("function"!=typeof e)return new s("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var i=t[r],c=p(i);if("object"!==c)return new s("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var l in i)if(I(i,l)){var u=e(i,l,n,o,a+"."+l,_);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."),D;return c((function(t,r,n,o,a){for(var c=t[r],l=0;l<e.length;l++)if(i(c,e[l]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===m(t)?String(t):t}));return new s("Invalid "+o+" `"+a+"` of value `"+String(c)+"` supplied to `"+n+"`, 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."),D;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return q("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+d(r)+" at index "+t+"."),D}return c((function(t,r,n,o,a){for(var i=[],c=0;c<e.length;c++){var l=(0,e[c])(t,r,n,o,a,_);if(null==l)return null;l.data&&I(l.data,"expectedType")&&i.push(l.data.expectedType)}return new s("Invalid "+o+" `"+a+"` supplied to `"+n+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")}))},shape:function(e){return c((function(t,r,n,o,a){var i=t[r],c=p(i);if("object"!==c)return new s("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");for(var l in e){var f=e[l];if("function"!=typeof f)return u(n,o,a,l,m(f));var d=f(i,l,n,o,a+"."+l,_);if(d)return d}return null}))},exact:function(e){return c((function(t,r,n,o,a){var i=t[r],c=p(i);if("object"!==c)return new s("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");var l=j({},t[r],e);for(var f in l){var d=e[f];if(I(e,f)&&"function"!=typeof d)return u(n,o,a,f,m(d));if(!d)return new s("Invalid "+o+" `"+a+"` key `"+f+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=d(i,f,n,o,a+"."+f,_);if(y)return y}return null}))}};function i(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t}function s(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function c(e){if("production"!==process.env.NODE_ENV)var r={},n=0;function a(a,i,c,l,u,f,p){if(l=l||o,f=f||c,p!==_){if(t){var m=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 m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var d=l+":"+c;!r[d]&&n<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."),r[d]=!0,n++)}}return null==i[c]?a?null===i[c]?new s("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `null`."):new s("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `undefined`."):null:e(i,c,l,u,f)}var i=a.bind(null,!1);return i.isRequired=a.bind(null,!0),i}function l(e){return c((function(t,r,n,o,a,i){var c=t[r];return p(c)!==e?new s("Invalid "+o+" `"+a+"` of type `"+m(c)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,r,n,o){return new s((e||"React class")+": "+t+" type `"+r+"."+n+"` 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&&(r&&e[r]||e[n]);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 s=a.value;if(s&&!f(s[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 m(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 d(e){var t=m(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return s.prototype=Error.prototype,a.checkPropTypes=z,a.resetWarningCache=z.resetWarningCache,a.PropTypes=a,a};function W(){}function U(){}U.resetWarningCache=W;var Y=n((function(e){if("production"!==process.env.NODE_ENV){var t=C;e.exports=L(t.isElement,!0)}else e.exports=function(){function e(e,t,r,n,o,a){if(a!==_){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 r={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:U,resetWarningCache:W};return r.PropTypes=r,r}()}));const J=({variant:t="primary",size:r="md",onClick:n,children:o,icon:a,iconPosition:i="start",className:s,style:c="default",processing:l=!1})=>{let u=`btn ${s}`;"default"!==t&&(u+=` btn-${t}`),"md"!==r&&(u+=` btn-${r}`),"default"!==c&&(u+=` btn-${c}`),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:n},f)};J.propTypes={variant:Y.oneOf(["primary","secondary","terciary","outline"]),size:Y.oneOf(["xs","md","lg"]),onClick:Y.func,children:Y.node,icon:Y.string,iconPosition:Y.oneOf(["start","end"]),className:Y.string,style:Y.oneOf(["default","success","danger","warning","link"]),processing:Y.bool};const B=()=>({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}),[])}),Z=({children:t,className:r,id:n,name:o,status:a=!1,setStatus:i})=>{const{toCamelCase:s}=B();let c=n;n||"string"!=typeof t||(c=s(t));return e.createElement("div",{className:`form-group form-check ${r}`},e.createElement("label",{className:"checkbox"},e.createElement("input",{type:"checkbox",checked:a,onChange:e=>{i(e.target.checked)},minLength:"1",id:c,name:o}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};Z.propTypes={className:Y.string,id:Y.string,name:Y.string,status:Y.bool,setStatus:Y.func};const H=({className:t,disabled:n,helpText:o,icon:a,label:i="Label",name:s,onChange:c,prefix:l,requiredText:u,showError:f,setShowError:p,size:m="md",suffix:d,type:y="text",value:b})=>{const{toCamelCase:g}=B(),h="lg"===m?"form-control-lg":"xs"===m?"form-control-xs":"",v=g(i);return r((()=>{f&&setTimeout((()=>{p(!1)}),3e3)}),[f]),e.createElement("div",{className:`position-relative ${t}`},l||d||a?e.createElement("div",{className:"input-group "+(f?"not-validated":""),"data-error":u},a&&e.createElement("span",{className:"input-group-text"},e.createElement("i",{className:`fa-solid ${a}`})),l&&e.createElement("span",{className:"input-group-text"},l),e.createElement("div",{className:"form-floating"},e.createElement("input",{type:y,className:`form-control ${h}`,value:b,id:v,name:s,placeholder:i,onChange:c,required:!!u}),e.createElement("label",{htmlFor:v},i)),d&&e.createElement("span",{className:"input-group-text"},d)):e.createElement("div",{className:"form-floating "+(f?"not-validated":""),"data-error":u},e.createElement("input",{type:y,className:`form-control ${h}`,value:b,id:v,placeholder:i,onChange:c,required:!!u,name:s,disabled:n}),e.createElement("label",{htmlFor:v},i)),o&&e.createElement("small",{className:"form-text text-muted"},o))};H.propTypes={className:Y.string,disabled:Y.bool,helpText:Y.string,icon:Y.string,label:Y.string,name:Y.string,onChange:Y.func,prefix:Y.string,requiredText:Y.string,size:Y.oneOf(["xs","md","lg"]),showError:Y.bool,setShowError:Y.func,suffix:Y.string,type:Y.oneOf(["color","date","datetime-local","email","file","image","month","number","password","tel","text","time","url","week"]),value:Y.oneOfType([Y.string,Y.number])};const G=({children:t,className:r,id:n,name:o,setStatus:a,status:i=!1})=>{const{toCamelCase:s}=B();let c=n;n||"string"!=typeof t||(c=s(t));return e.createElement("div",{className:`form-group form-check ${r}`},e.createElement("label",{className:"radio"},e.createElement("input",{type:"radio",checked:i,onChange:e=>{a(e.target.checked)},minLength:"1",id:c,name:o}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};G.propTypes={className:Y.string,id:Y.string,name:Y.string,setStatus:Y.func,status:Y.bool};const K=({children:t,className:r,icon:n=!1,id:o,name:a,size:i,setStatus:s,status:c=!1,switchPosition:l="start"})=>{const{toCamelCase:u}=B(),f="lg"===i?"form-switch-lg":"xs"===i?"form-switch-xs":"",p=o||u(t);return e.createElement("div",{className:`form-check form-switch ${f} ${r} ${"end"===l?"switch-end":""} ${n?"switch-icon":""}`},e.createElement("input",{className:"form-check-input",type:"checkbox",role:"switch",onChange:e=>{s(e.target.checked)},id:p,name:a,checked:c}),t&&e.createElement("label",{className:"form-check-label",htmlFor:p},t))};K.propTypes={className:Y.string,icon:Y.bool,id:Y.string,name:Y.string,setStatus:Y.func,status:Y.bool,switchPosition:Y.oneOf(["start","end"])};const Q=({className:t,helpText:n,label:o="Label",name:a,onChange:i,requiredText:s,showError:c,setShowError:l,size:u="md"})=>{const{toCamelCase:f}=B(),p="lg"===u?"form-control-lg":"xs"===u?"form-control-xs":"",m=f(o);return r((()=>{c&&setTimeout((()=>{l(!1)}),3e3)}),[c]),e.createElement("div",{className:`position-relative ${t}`},e.createElement("div",{className:"form-floating "+(c?"not-validated":""),"data-error":s},e.createElement("textarea",{className:`form-control ${p}`,onChange:i,placeholder:o,id:m,name:a,required:!!s}),e.createElement("label",{htmlFor:m},o),n&&e.createElement("small",{className:"form-text text-muted"},n)))};Q.propTypes={className:Y.string,helpText:Y.string,label:Y.string,name:Y.string,onChange:Y.func,requiredText:Y.string,showError:Y.bool,size:Y.oneOf(["xs","md","lg"])};export{J as Button,Z as Checkbox,H as Input,G as Radio,K as Switch,Q as Textarea};
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
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 r="function"==typeof Symbol&&Symbol.for,n=r?Symbol.for("react.element"):60103,o=r?Symbol.for("react.portal"):60106,a=r?Symbol.for("react.fragment"):60107,i=r?Symbol.for("react.strict_mode"):60108,s=r?Symbol.for("react.profiler"):60114,c=r?Symbol.for("react.provider"):60109,l=r?Symbol.for("react.context"):60110,u=r?Symbol.for("react.async_mode"):60111,f=r?Symbol.for("react.concurrent_mode"):60111,p=r?Symbol.for("react.forward_ref"):60112,m=r?Symbol.for("react.suspense"):60113,d=r?Symbol.for("react.suspense_list"):60120,y=r?Symbol.for("react.memo"):60115,b=r?Symbol.for("react.lazy"):60116,g=r?Symbol.for("react.block"):60121,h=r?Symbol.for("react.fundamental"):60117,v=r?Symbol.for("react.responder"):60118,E=r?Symbol.for("react.scope"):60119;function x(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case n:switch(e=e.type){case u:case f:case a:case s:case i:case m:return e;default:switch(e=e&&e.$$typeof){case l:case p:case b:case y:case c:return e;default:return t}}case o:return t}}}function S(e){return x(e)===f}var w={AsyncMode:u,ConcurrentMode:f,ContextConsumer:l,ContextProvider:c,Element:n,ForwardRef:p,Fragment:a,Lazy:b,Memo:y,Portal:o,Profiler:s,StrictMode:i,Suspense:m,isAsyncMode:function(e){return S(e)||x(e)===u},isConcurrentMode:S,isContextConsumer:function(e){return x(e)===l},isContextProvider:function(e){return x(e)===c},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===n},isForwardRef:function(e){return x(e)===p},isFragment:function(e){return x(e)===a},isLazy:function(e){return x(e)===b},isMemo:function(e){return x(e)===y},isPortal:function(e){return x(e)===o},isProfiler:function(e){return x(e)===s},isStrictMode:function(e){return x(e)===i},isSuspense:function(e){return x(e)===m},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===a||e===f||e===s||e===i||e===m||e===d||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===y||e.$$typeof===c||e.$$typeof===l||e.$$typeof===p||e.$$typeof===h||e.$$typeof===v||e.$$typeof===E||e.$$typeof===g)},typeOf:x},O=t((function(e,t){"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,r=e?Symbol.for("react.element"):60103,n=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,s=e?Symbol.for("react.provider"):60109,c=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,m=e?Symbol.for("react.suspense_list"):60120,d=e?Symbol.for("react.memo"):60115,y=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,g=e?Symbol.for("react.fundamental"):60117,h=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 r:var m=e.type;switch(m){case l:case u:case o:case i:case a:case p:return m;default:var b=m&&m.$$typeof;switch(b){case c:case f:case y:case d:case s:return b;default:return t}}case n:return t}}}var x=l,S=u,w=c,O=s,N=r,$=f,C=o,T=y,k=d,P=n,j=i,_=a,I=p,M=!1;function R(e){return E(e)===u}t.AsyncMode=x,t.ConcurrentMode=S,t.ContextConsumer=w,t.ContextProvider=O,t.Element=N,t.ForwardRef=$,t.Fragment=C,t.Lazy=T,t.Memo=k,t.Portal=P,t.Profiler=j,t.StrictMode=_,t.Suspense=I,t.isAsyncMode=function(e){return M||(M=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),R(e)||E(e)===l},t.isConcurrentMode=R,t.isContextConsumer=function(e){return E(e)===c},t.isContextProvider=function(e){return E(e)===s},t.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},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)===d},t.isPortal=function(e){return E(e)===n},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===m||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===d||e.$$typeof===s||e.$$typeof===c||e.$$typeof===f||e.$$typeof===g||e.$$typeof===h||e.$$typeof===v||e.$$typeof===b)},t.typeOf=E}()}));O.AsyncMode,O.ConcurrentMode,O.ContextConsumer,O.ContextProvider,O.Element,O.ForwardRef,O.Fragment,O.Lazy,O.Memo,O.Portal,O.Profiler,O.StrictMode,O.Suspense,O.isAsyncMode,O.isConcurrentMode,O.isContextConsumer,O.isContextProvider,O.isElement,O.isForwardRef,O.isFragment,O.isLazy,O.isMemo,O.isPortal,O.isProfiler,O.isStrictMode,O.isSuspense,O.isValidElementType,O.typeOf;var N=t((function(e){"production"===process.env.NODE_ENV?e.exports=w:e.exports=O})),$=Object.getOwnPropertySymbols,C=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable;
|
|
10
10
|
/*
|
|
11
11
|
object-assign
|
|
12
12
|
(c) Sindre Sorhus
|
|
13
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;
|
|
14
|
+
*/var k=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={},r=0;r<10;r++)t["_"+String.fromCharCode(r)]=r;var n=Object.getOwnPropertyNames(t).map((function(e){return t[e]}));if("0123456789"!==n.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 r,n,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 r=Object(arguments[a]))C.call(r,i)&&(o[i]=r[i]);if($){n=$(r);for(var s=0;s<n.length;s++)T.call(r,n[s])&&(o[n[s]]=r[n[s]])}}return o},P="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",j=Function.call.bind(Object.prototype.hasOwnProperty),_=function(){};if("production"!==process.env.NODE_ENV){var I=P,M={},R=j;_=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}}}function A(e,t,r,n,o){if("production"!==process.env.NODE_ENV)for(var a in e)if(R(e,a)){var i;try{if("function"!=typeof e[a]){var s=Error((n||"React class")+": "+r+" 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 s.name="Invariant Violation",s}i=e[a](t,a,n,r,null,I)}catch(e){i=e}if(!i||i instanceof Error||_((n||"React class")+": type specification of "+r+" `"+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 M)){M[i.message]=!0;var c=o?o():"";_("Failed "+r+" type: "+i.message+(null!=c?c:""))}}}A.resetWarningCache=function(){"production"!==process.env.NODE_ENV&&(M={})};var F=A,V=function(){};function z(){return null}"production"!==process.env.NODE_ENV&&(V=function(e){var t="Warning: "+e;"undefined"!=typeof console&&console.error(t);try{throw new Error(t)}catch(e){}});var q=function(e,t){var r="function"==typeof Symbol&&Symbol.iterator,n="@@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:c(z),arrayOf:function(e){return c((function(t,r,n,o,a){if("function"!=typeof e)return new s("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside arrayOf.");var i=t[r];if(!Array.isArray(i))return new s("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+n+"`, expected an array.");for(var c=0;c<i.length;c++){var l=e(i,c,n,o,a+"["+c+"]",P);if(l instanceof Error)return l}return null}))},element:c((function(t,r,n,o,a){var i=t[r];return e(i)?null:new s("Invalid "+o+" `"+a+"` of type `"+p(i)+"` supplied to `"+n+"`, expected a single ReactElement.")})),elementType:c((function(e,t,r,n,o){var a=e[t];return N.isValidElementType(a)?null:new s("Invalid "+n+" `"+o+"` of type `"+p(a)+"` supplied to `"+r+"`, expected a single ReactElement type.")})),instanceOf:function(e){return c((function(t,r,n,a,i){if(!(t[r]instanceof e)){var c=e.name||o;return new s("Invalid "+a+" `"+i+"` of type `"+(((l=t[r]).constructor&&l.constructor.name?l.constructor.name:o)+"` supplied to `")+n+"`, expected instance of `"+c+"`.")}var l;return null}))},node:c((function(e,t,r,n,o){return f(e[t])?null:new s("Invalid "+n+" `"+o+"` supplied to `"+r+"`, expected a ReactNode.")})),objectOf:function(e){return c((function(t,r,n,o,a){if("function"!=typeof e)return new s("Property `"+a+"` of component `"+n+"` has invalid PropType notation inside objectOf.");var i=t[r],c=p(i);if("object"!==c)return new s("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected an object.");for(var l in i)if(j(i,l)){var u=e(i,l,n,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&&V(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 c((function(t,r,n,o,a){for(var c=t[r],l=0;l<e.length;l++)if(i(c,e[l]))return null;var u=JSON.stringify(e,(function(e,t){return"symbol"===m(t)?String(t):t}));return new s("Invalid "+o+" `"+a+"` of value `"+String(c)+"` supplied to `"+n+"`, expected one of "+u+".")}))},oneOfType:function(e){if(!Array.isArray(e))return"production"!==process.env.NODE_ENV&&V("Invalid argument supplied to oneOfType, expected an instance of array."),z;for(var t=0;t<e.length;t++){var r=e[t];if("function"!=typeof r)return V("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+d(r)+" at index "+t+"."),z}return c((function(t,r,n,o,a){for(var i=[],c=0;c<e.length;c++){var l=(0,e[c])(t,r,n,o,a,P);if(null==l)return null;l.data&&j(l.data,"expectedType")&&i.push(l.data.expectedType)}return new s("Invalid "+o+" `"+a+"` supplied to `"+n+"`"+(i.length>0?", expected one of type ["+i.join(", ")+"]":"")+".")}))},shape:function(e){return c((function(t,r,n,o,a){var i=t[r],c=p(i);if("object"!==c)return new s("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");for(var l in e){var f=e[l];if("function"!=typeof f)return u(n,o,a,l,m(f));var d=f(i,l,n,o,a+"."+l,P);if(d)return d}return null}))},exact:function(e){return c((function(t,r,n,o,a){var i=t[r],c=p(i);if("object"!==c)return new s("Invalid "+o+" `"+a+"` of type `"+c+"` supplied to `"+n+"`, expected `object`.");var l=k({},t[r],e);for(var f in l){var d=e[f];if(j(e,f)&&"function"!=typeof d)return u(n,o,a,f,m(d));if(!d)return new s("Invalid "+o+" `"+a+"` key `"+f+"` supplied to `"+n+"`.\nBad object: "+JSON.stringify(t[r],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(e),null," "));var y=d(i,f,n,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 s(e,t){this.message=e,this.data=t&&"object"==typeof t?t:{},this.stack=""}function c(e){if("production"!==process.env.NODE_ENV)var r={},n=0;function a(a,i,c,l,u,f,p){if(l=l||o,f=f||c,p!==P){if(t){var m=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 m.name="Invariant Violation",m}if("production"!==process.env.NODE_ENV&&"undefined"!=typeof console){var d=l+":"+c;!r[d]&&n<3&&(V("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."),r[d]=!0,n++)}}return null==i[c]?a?null===i[c]?new s("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `null`."):new s("The "+u+" `"+f+"` is marked as required in `"+l+"`, but its value is `undefined`."):null:e(i,c,l,u,f)}var i=a.bind(null,!1);return i.isRequired=a.bind(null,!0),i}function l(e){return c((function(t,r,n,o,a,i){var c=t[r];return p(c)!==e?new s("Invalid "+o+" `"+a+"` of type `"+m(c)+"` supplied to `"+n+"`, expected `"+e+"`.",{expectedType:e}):null}))}function u(e,t,r,n,o){return new s((e||"React class")+": "+t+" type `"+r+"."+n+"` 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&&(r&&e[r]||e[n]);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 s=a.value;if(s&&!f(s[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 m(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 d(e){var t=m(e);switch(t){case"array":case"object":return"an "+t;case"boolean":case"date":case"regexp":return"a "+t;default:return t}}return s.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=N;e.exports=q(t.isElement,!0)}else e.exports=function(){function e(e,t,r,n,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 r={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 r.PropTypes=r,r}()}));const U=({variant:t="primary",size:r="md",onClick:n,children:o,icon:a,iconPosition:i="start",className:s,style:c="default",processing:l=!1})=>{let u=`btn ${s}`;"default"!==t&&(u+=` btn-${t}`),"md"!==r&&(u+=` btn-${r}`),"default"!==c&&(u+=` btn-${c}`),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:n},f)};U.propTypes={variant:W.oneOf(["primary","secondary","terciary","outline"]),size:W.oneOf(["xs","md","lg"]),onClick:W.func,children:W.node,icon:W.string,iconPosition:W.oneOf(["start","end"]),className:W.string,style:W.oneOf(["default","success","danger","warning","link"]),processing:W.bool};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:r,id:n,name:o,status:a=!1,setStatus:i})=>{const{toCamelCase:s}=Y();let c=n;n||"string"!=typeof t||(c=s(t));return e.createElement("div",{className:`form-group form-check ${r}`},e.createElement("label",{className:"checkbox"},e.createElement("input",{type:"checkbox",checked:a,onChange:e=>{i(e.target.checked)},minLength:"1",id:c,name:o}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};B.propTypes={className:W.string,id:W.string,name:W.string,status:W.bool,setStatus:W.func};const J=({className:t,disabled:r,helpText:n,icon:o,label:a="Label",name:i,onChange:s,prefix:c,requiredText:l,showError:u,setShowError:f,size:p="md",suffix:m,type:d="text",value:y})=>{const{toCamelCase:b}=Y(),g="lg"===p?"form-control-lg":"xs"===p?"form-control-xs":"",h=b(a);return e.useEffect((()=>{u&&setTimeout((()=>{f(!1)}),3e3)}),[u]),e.createElement("div",{className:`position-relative ${t}`},c||m||o?e.createElement("div",{className:"input-group "+(u?"not-validated":""),"data-error":l},o&&e.createElement("span",{className:"input-group-text"},e.createElement("i",{className:`fa-solid ${o}`})),c&&e.createElement("span",{className:"input-group-text"},c),e.createElement("div",{className:"form-floating"},e.createElement("input",{type:d,className:`form-control ${g}`,value:y,id:h,name:i,placeholder:a,onChange:s,required:!!l}),e.createElement("label",{htmlFor:h},a)),m&&e.createElement("span",{className:"input-group-text"},m)):e.createElement("div",{className:"form-floating "+(u?"not-validated":""),"data-error":l},e.createElement("input",{type:d,className:`form-control ${g}`,value:y,id:h,placeholder:a,onChange:s,required:!!l,name:i,disabled:r}),e.createElement("label",{htmlFor:h},a)),n&&e.createElement("small",{className:"form-text text-muted"},n))};J.propTypes={className:W.string,disabled:W.bool,helpText:W.string,icon:W.string,label:W.string,name:W.string,onChange:W.func,prefix:W.string,requiredText:W.string,size:W.oneOf(["xs","md","lg"]),showError:W.bool,setShowError:W.func,suffix:W.string,type:W.oneOf(["color","date","datetime-local","email","file","image","month","number","password","tel","text","time","url","week"]),value:W.oneOfType([W.string,W.number])};const Z=({children:t,className:r,id:n,name:o,setStatus:a,status:i=!1})=>{const{toCamelCase:s}=Y();let c=n;n||"string"!=typeof t||(c=s(t));return e.createElement("div",{className:`form-group form-check ${r}`},e.createElement("label",{className:"radio"},e.createElement("input",{type:"radio",checked:i,onChange:e=>{a(e.target.checked)},minLength:"1",id:c,name:o}),e.createElement("span",{className:"outer"},e.createElement("span",{className:"inner"})),t))};Z.propTypes={className:W.string,id:W.string,name:W.string,setStatus:W.func,status:W.bool};const H=({children:t,className:r,icon:n=!1,id:o,name:a,size:i,setStatus:s,status:c=!1,switchPosition:l="start"})=>{const{toCamelCase:u}=Y(),f="lg"===i?"form-switch-lg":"xs"===i?"form-switch-xs":"",p=o||u(t);return e.createElement("div",{className:`form-check form-switch ${f} ${r} ${"end"===l?"switch-end":""} ${n?"switch-icon":""}`},e.createElement("input",{className:"form-check-input",type:"checkbox",role:"switch",onChange:e=>{s(e.target.checked)},id:p,name:a,checked:c}),t&&e.createElement("label",{className:"form-check-label",htmlFor:p},t))};H.propTypes={className:W.string,icon:W.bool,id:W.string,name:W.string,setStatus:W.func,status:W.bool,switchPosition:W.oneOf(["start","end"])};const G=({className:t,helpText:r,label:n="Label",name:o,onChange:a,requiredText:i,showError:s,setShowError:c,size:l="md"})=>{const{toCamelCase:u}=Y(),f="lg"===l?"form-control-lg":"xs"===l?"form-control-xs":"",p=u(n);return e.useEffect((()=>{s&&setTimeout((()=>{c(!1)}),3e3)}),[s]),e.createElement("div",{className:`position-relative ${t}`},e.createElement("div",{className:"form-floating "+(s?"not-validated":""),"data-error":i},e.createElement("textarea",{className:`form-control ${f}`,onChange:a,placeholder:n,id:p,name:o,required:!!i}),e.createElement("label",{htmlFor:p},n),r&&e.createElement("small",{className:"form-text text-muted"},r)))};G.propTypes={className:W.string,helpText:W.string,label:W.string,name:W.string,onChange:W.func,requiredText:W.string,showError:W.bool,size:W.oneOf(["xs","md","lg"])},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.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.es.js",
|
|
6
6
|
"repository": "git@bitbucket.org:groovinads/react-components.git",
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"prettier": "^3.2.5",
|
|
23
23
|
"prop-types": "^15.8.1",
|
|
24
24
|
"react": "^18.2.0",
|
|
25
|
-
"react-bootstrap": "^2.10.1",
|
|
26
25
|
"react-dom": "^18.2.0",
|
|
27
26
|
"rollup": "^4.14.0",
|
|
28
27
|
"rollup-plugin-babel": "^4.4.0",
|
|
@@ -45,5 +44,8 @@
|
|
|
45
44
|
"sb": "storybook dev -p 6006",
|
|
46
45
|
"build-storybook": "storybook build",
|
|
47
46
|
"build-lib": "rollup -c"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"react-router-dom": "^6.23.0"
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -2,88 +2,77 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
const Button = ({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
variant = 'primary',
|
|
6
|
+
size = 'md',
|
|
7
|
+
onClick,
|
|
8
|
+
children,
|
|
9
|
+
icon,
|
|
10
|
+
iconPosition = 'start',
|
|
11
|
+
className,
|
|
12
|
+
style = 'default',
|
|
13
|
+
processing = false,
|
|
14
14
|
}) => {
|
|
15
|
-
|
|
15
|
+
let classes = `btn ${className}`;
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// Variant
|
|
18
|
+
if (variant !== 'default') {
|
|
19
|
+
classes += ` btn-${variant}`;
|
|
20
|
+
}
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
// Size
|
|
23
|
+
if (size !== 'md') {
|
|
24
|
+
classes += ` btn-${size}`;
|
|
25
|
+
}
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
// Style
|
|
28
|
+
if (style !== 'default') {
|
|
29
|
+
classes += ` btn-${style}`;
|
|
30
|
+
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// Processing
|
|
33
|
+
if (processing) {
|
|
34
|
+
classes += ` btn-processing`;
|
|
35
|
+
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
) : (
|
|
50
|
-
<>
|
|
51
|
-
<i className={`fa-solid ${icon}`} aria-hidden='true'></i>
|
|
52
|
-
{children && <span>{children}</span>}
|
|
53
|
-
</>
|
|
54
|
-
)
|
|
37
|
+
// Icon
|
|
38
|
+
const content = processing ? (
|
|
39
|
+
<>
|
|
40
|
+
<i className='fa-solid fa-spinner-third fa-spin' aria-hidden='true'></i>
|
|
41
|
+
{children && <span>{children}…</span>}
|
|
42
|
+
</>
|
|
43
|
+
) : icon ? (
|
|
44
|
+
iconPosition === 'end' ? (
|
|
45
|
+
<>
|
|
46
|
+
{children && <span>{children}</span>}
|
|
47
|
+
<i className={`fa-solid ${icon}`} aria-hidden='true'></i>
|
|
48
|
+
</>
|
|
55
49
|
) : (
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
<>
|
|
51
|
+
<i className={`fa-solid ${icon}`} aria-hidden='true'></i>
|
|
52
|
+
{children && <span>{children}</span>}
|
|
53
|
+
</>
|
|
54
|
+
)
|
|
55
|
+
) : (
|
|
56
|
+
children && <span>{children}</span>
|
|
57
|
+
);
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
59
|
+
return (
|
|
60
|
+
<button className={classes} onClick={onClick}>
|
|
61
|
+
{content}
|
|
62
|
+
</button>
|
|
63
|
+
);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
66
|
Button.propTypes = {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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,
|
|
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.string,
|
|
72
|
+
iconPosition: PropTypes.oneOf(['start', 'end']),
|
|
73
|
+
className: PropTypes.string,
|
|
74
|
+
style: PropTypes.oneOf(['default', 'success', 'danger', 'warning', 'link']),
|
|
75
|
+
processing: PropTypes.bool,
|
|
87
76
|
};
|
|
88
77
|
|
|
89
78
|
export default Button;
|
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
|
-
// STYLES
|
|
5
|
-
/* import '../../scss/components/_checks.scss'; */
|
|
6
|
-
|
|
7
4
|
// HOOKS
|
|
8
5
|
import useTextFormatter from '../../hooks/textFormatter';
|
|
9
6
|
|
|
10
7
|
// Checkbox
|
|
11
|
-
const Checkbox = ({
|
|
12
|
-
|
|
8
|
+
const Checkbox = ({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
id,
|
|
12
|
+
name,
|
|
13
|
+
status = false,
|
|
14
|
+
setStatus
|
|
15
|
+
}) => {
|
|
16
|
+
const { toCamelCase } = useTextFormatter();
|
|
13
17
|
|
|
14
18
|
let checkboxId = id;
|
|
15
|
-
|
|
19
|
+
if (!id && typeof children === 'string') {
|
|
16
20
|
checkboxId = toCamelCase(children);
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
const handleChange = (event) => {
|
|
20
|
-
|
|
24
|
+
setStatus(event.target.checked);
|
|
21
25
|
};
|
|
22
26
|
|
|
23
27
|
return (
|
|
@@ -25,8 +29,7 @@ const Checkbox = ({ children, className, id, checked, setChecked, name }) => {
|
|
|
25
29
|
<label className='checkbox'>
|
|
26
30
|
<input
|
|
27
31
|
type='checkbox'
|
|
28
|
-
|
|
29
|
-
checked={checked}
|
|
32
|
+
checked={status}
|
|
30
33
|
onChange={handleChange}
|
|
31
34
|
minLength='1'
|
|
32
35
|
id={checkboxId}
|
|
@@ -44,16 +47,9 @@ const Checkbox = ({ children, className, id, checked, setChecked, name }) => {
|
|
|
44
47
|
Checkbox.propTypes = {
|
|
45
48
|
className: PropTypes.string,
|
|
46
49
|
id: PropTypes.string,
|
|
47
|
-
checked: PropTypes.bool,
|
|
48
|
-
setChecked: PropTypes.func,
|
|
49
50
|
name: PropTypes.string,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
Checkbox.defaultProps = {
|
|
53
|
-
className: '',
|
|
54
|
-
id: '',
|
|
55
|
-
checked: false,
|
|
56
|
-
setChecked: () => {},
|
|
51
|
+
status: PropTypes.bool,
|
|
52
|
+
setStatus: PropTypes.func,
|
|
57
53
|
};
|
|
58
54
|
|
|
59
55
|
export default Checkbox;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
// HOOKS
|
|
@@ -6,20 +6,21 @@ import useTextFormatter from '../../hooks/textFormatter';
|
|
|
6
6
|
|
|
7
7
|
// Input
|
|
8
8
|
const Input = ({
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
value,
|
|
12
|
-
label,
|
|
13
|
-
prefix,
|
|
14
|
-
suffix,
|
|
15
|
-
icon,
|
|
9
|
+
className,
|
|
10
|
+
disabled,
|
|
16
11
|
helpText,
|
|
17
|
-
|
|
12
|
+
icon,
|
|
13
|
+
label = 'Label',
|
|
14
|
+
name,
|
|
18
15
|
onChange,
|
|
19
|
-
|
|
16
|
+
prefix,
|
|
17
|
+
requiredText,
|
|
20
18
|
showError,
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
setShowError,
|
|
20
|
+
size = 'md',
|
|
21
|
+
suffix,
|
|
22
|
+
type = 'text',
|
|
23
|
+
value
|
|
23
24
|
}) => {
|
|
24
25
|
const { toCamelCase } = useTextFormatter();
|
|
25
26
|
|
|
@@ -27,15 +28,19 @@ const Input = ({
|
|
|
27
28
|
size === 'lg' ? 'form-control-lg' : size === 'xs' ? 'form-control-xs' : '';
|
|
28
29
|
const id = toCamelCase(label);
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (showError) {
|
|
33
|
+
setTimeout(() => {
|
|
34
|
+
setShowError(false);
|
|
35
|
+
}, 3000);
|
|
36
|
+
}
|
|
37
|
+
}, [showError]);
|
|
31
38
|
|
|
32
39
|
return (
|
|
33
40
|
<div className={`position-relative ${className}`}>
|
|
34
41
|
{prefix || suffix || icon ? (
|
|
35
42
|
<div
|
|
36
|
-
className={
|
|
37
|
-
showError ? `input-group ${notValidatedClass}` : 'input-group'
|
|
38
|
-
}
|
|
43
|
+
className={`input-group ${showError ? 'not-validated' : ''}`}
|
|
39
44
|
data-error={requiredText}
|
|
40
45
|
>
|
|
41
46
|
{icon && (
|
|
@@ -61,9 +66,7 @@ const Input = ({
|
|
|
61
66
|
</div>
|
|
62
67
|
) : (
|
|
63
68
|
<div
|
|
64
|
-
className={
|
|
65
|
-
showError ? `form-floating ${notValidatedClass}` : 'form-floating'
|
|
66
|
-
}
|
|
69
|
+
className={`form-floating ${showError ? 'not-validated' : ''}`}
|
|
67
70
|
data-error={requiredText}
|
|
68
71
|
>
|
|
69
72
|
<input
|
|
@@ -81,12 +84,24 @@ const Input = ({
|
|
|
81
84
|
</div>
|
|
82
85
|
)}
|
|
83
86
|
{helpText && <small className='form-text text-muted'>{helpText}</small>}
|
|
84
|
-
{requiredText && <div className='invalid-feedback'>{requiredText}</div>}
|
|
85
87
|
</div>
|
|
86
88
|
);
|
|
87
89
|
};
|
|
88
90
|
|
|
89
91
|
Input.propTypes = {
|
|
92
|
+
className: PropTypes.string,
|
|
93
|
+
disabled: PropTypes.bool,
|
|
94
|
+
helpText: PropTypes.string,
|
|
95
|
+
icon: PropTypes.string,
|
|
96
|
+
label: PropTypes.string,
|
|
97
|
+
name: PropTypes.string,
|
|
98
|
+
onChange: PropTypes.func,
|
|
99
|
+
prefix: PropTypes.string,
|
|
100
|
+
requiredText: PropTypes.string,
|
|
101
|
+
size: PropTypes.oneOf(['xs', 'md', 'lg']),
|
|
102
|
+
showError: PropTypes.bool,
|
|
103
|
+
setShowError: PropTypes.func,
|
|
104
|
+
suffix: PropTypes.string,
|
|
90
105
|
type: PropTypes.oneOf([
|
|
91
106
|
'color',
|
|
92
107
|
'date',
|
|
@@ -102,32 +117,8 @@ Input.propTypes = {
|
|
|
102
117
|
'time',
|
|
103
118
|
'url',
|
|
104
119
|
'week',
|
|
105
|
-
])
|
|
106
|
-
size: PropTypes.oneOf(['xs', 'md', 'lg']),
|
|
120
|
+
]),
|
|
107
121
|
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
122
|
};
|
|
132
123
|
|
|
133
124
|
export default Input;
|
|
@@ -5,7 +5,14 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import useTextFormatter from '../../hooks/textFormatter';
|
|
6
6
|
|
|
7
7
|
// Radio
|
|
8
|
-
const Radio = ({
|
|
8
|
+
const Radio = ({
|
|
9
|
+
children,
|
|
10
|
+
className,
|
|
11
|
+
id,
|
|
12
|
+
name,
|
|
13
|
+
setStatus,
|
|
14
|
+
status = false
|
|
15
|
+
}) => {
|
|
9
16
|
const { toCamelCase } = useTextFormatter();
|
|
10
17
|
|
|
11
18
|
let RadioId = id;
|
|
@@ -14,7 +21,7 @@ const Radio = ({ children, className, id, checked, setChecked, name }) => {
|
|
|
14
21
|
}
|
|
15
22
|
|
|
16
23
|
const handleChange = (event) => {
|
|
17
|
-
|
|
24
|
+
setStatus(event.target.checked);
|
|
18
25
|
};
|
|
19
26
|
|
|
20
27
|
return (
|
|
@@ -22,7 +29,7 @@ const Radio = ({ children, className, id, checked, setChecked, name }) => {
|
|
|
22
29
|
<label className='radio'>
|
|
23
30
|
<input
|
|
24
31
|
type='radio'
|
|
25
|
-
|
|
32
|
+
checked={status}
|
|
26
33
|
onChange={handleChange}
|
|
27
34
|
minLength='1'
|
|
28
35
|
id={RadioId}
|
|
@@ -40,16 +47,9 @@ const Radio = ({ children, className, id, checked, setChecked, name }) => {
|
|
|
40
47
|
Radio.propTypes = {
|
|
41
48
|
className: PropTypes.string,
|
|
42
49
|
id: PropTypes.string,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
Radio.defaultProps = {
|
|
49
|
-
className: '',
|
|
50
|
-
id: '',
|
|
51
|
-
checked: false,
|
|
52
|
-
setChecked: () => {},
|
|
50
|
+
name: PropTypes.string,
|
|
51
|
+
setStatus: PropTypes.func,
|
|
52
|
+
status: PropTypes.bool,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export default Radio;
|
|
@@ -5,15 +5,15 @@ import PropTypes from 'prop-types';
|
|
|
5
5
|
import useTextFormatter from '../../hooks/textFormatter';
|
|
6
6
|
|
|
7
7
|
const Switch = ({
|
|
8
|
-
status,
|
|
9
|
-
icon,
|
|
10
|
-
size,
|
|
11
8
|
children,
|
|
12
9
|
className,
|
|
10
|
+
icon = false,
|
|
13
11
|
id,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
name,
|
|
13
|
+
size,
|
|
14
|
+
setStatus,
|
|
15
|
+
status = false,
|
|
16
|
+
switchPosition = 'start'
|
|
17
17
|
}) => {
|
|
18
18
|
const { toCamelCase } = useTextFormatter();
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ const Switch = ({
|
|
|
23
23
|
const inputId = id ? id : toCamelCase(children);
|
|
24
24
|
|
|
25
25
|
const handleChange = (event) => {
|
|
26
|
-
|
|
26
|
+
setStatus(event.target.checked);
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
return (
|
|
@@ -36,10 +36,10 @@ const Switch = ({
|
|
|
36
36
|
className='form-check-input'
|
|
37
37
|
type='checkbox'
|
|
38
38
|
role='switch'
|
|
39
|
-
defaultChecked={status}
|
|
40
39
|
onChange={handleChange}
|
|
41
40
|
id={inputId}
|
|
42
41
|
name={name}
|
|
42
|
+
checked={status}
|
|
43
43
|
/>
|
|
44
44
|
{children && (
|
|
45
45
|
<label className='form-check-label' htmlFor={inputId}>
|
|
@@ -51,22 +51,13 @@ const Switch = ({
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
Switch.propTypes = {
|
|
54
|
-
icon: PropTypes.bool,
|
|
55
54
|
className: PropTypes.string,
|
|
55
|
+
icon: PropTypes.bool,
|
|
56
56
|
id: PropTypes.string,
|
|
57
|
-
checked: PropTypes.bool,
|
|
58
|
-
setChecked: PropTypes.func,
|
|
59
|
-
switchPosition: PropTypes.oneOf(['start', 'end']),
|
|
60
57
|
name: PropTypes.string,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
icon: false,
|
|
65
|
-
className: '',
|
|
66
|
-
id: '',
|
|
67
|
-
checked: false,
|
|
68
|
-
setChecked: () => {},
|
|
69
|
-
switchPosition: 'start',
|
|
58
|
+
setStatus: PropTypes.func,
|
|
59
|
+
status: PropTypes.bool,
|
|
60
|
+
switchPosition: PropTypes.oneOf(['start', 'end']),
|
|
70
61
|
};
|
|
71
62
|
|
|
72
63
|
export default Switch;
|
|
@@ -1,41 +1,38 @@
|
|
|
1
|
-
import React, { useEffect
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
|
|
4
4
|
// HOOKS
|
|
5
5
|
import useTextFormatter from '../../hooks/textFormatter';
|
|
6
6
|
|
|
7
7
|
const Textarea = ({
|
|
8
|
-
|
|
9
|
-
value,
|
|
10
|
-
label,
|
|
8
|
+
className,
|
|
11
9
|
helpText,
|
|
12
|
-
|
|
10
|
+
label = 'Label',
|
|
11
|
+
name,
|
|
13
12
|
onChange,
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
requiredText,
|
|
14
|
+
showError,
|
|
15
|
+
setShowError,
|
|
16
|
+
size = 'md'
|
|
16
17
|
}) => {
|
|
17
18
|
const { toCamelCase } = useTextFormatter();
|
|
18
19
|
|
|
19
20
|
const sizeClass =
|
|
20
21
|
size === 'lg' ? 'form-control-lg' : size === 'xs' ? 'form-control-xs' : '';
|
|
21
22
|
const id = toCamelCase(label);
|
|
22
|
-
const [notValidated, setNotValidated] = useState(false);
|
|
23
23
|
|
|
24
24
|
useEffect(() => {
|
|
25
|
-
if (
|
|
26
|
-
setNotValidated(true);
|
|
25
|
+
if (showError) {
|
|
27
26
|
setTimeout(() => {
|
|
28
|
-
|
|
27
|
+
setShowError(false);
|
|
29
28
|
}, 3000);
|
|
30
29
|
}
|
|
31
|
-
}, [
|
|
32
|
-
|
|
33
|
-
const notValidatedClass = notValidated ? 'not-validated' : '';
|
|
30
|
+
}, [showError]);
|
|
34
31
|
|
|
35
32
|
return (
|
|
36
33
|
<div className={`position-relative ${className}`}>
|
|
37
34
|
<div
|
|
38
|
-
className={`form-floating ${
|
|
35
|
+
className={`form-floating ${showError ? 'not-validated' : ''}`}
|
|
39
36
|
data-error={requiredText}
|
|
40
37
|
>
|
|
41
38
|
<textarea
|
|
@@ -54,26 +51,14 @@ const Textarea = ({
|
|
|
54
51
|
};
|
|
55
52
|
|
|
56
53
|
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
54
|
className: PropTypes.string,
|
|
55
|
+
helpText: PropTypes.string,
|
|
56
|
+
label: PropTypes.string,
|
|
63
57
|
name: PropTypes.string,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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: '',
|
|
58
|
+
onChange: PropTypes.func,
|
|
59
|
+
requiredText: PropTypes.string,
|
|
60
|
+
showError: PropTypes.bool,
|
|
61
|
+
size: PropTypes.oneOf(['xs', 'md', 'lg']),
|
|
77
62
|
};
|
|
78
63
|
|
|
79
64
|
export default Textarea;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Button from
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import Button from '../components/Button/Button';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: 'Buttons/Button',
|
|
6
6
|
component: Button,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
const Template = (args) => <Button {...args}>Button</Button>;
|
|
10
10
|
|
|
11
|
-
export const
|
|
11
|
+
export const Default = Template.bind({});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Checkbox from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Checkbox from '../components/Inputs/Checkbox';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: 'Inputs/Checkbox',
|
|
6
6
|
component: Checkbox,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
const [status, setStatus] = useState(false);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
return (
|
|
13
|
+
<Checkbox {...args} status={status} setStatus={setStatus}>Checkbox</Checkbox>
|
|
14
|
+
)
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Input from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Input from '../components/Inputs/Input';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: 'Inputs/Input',
|
|
6
6
|
component: Input,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
const [showError, setShowError] = useState(false);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<button onClick={()=>setShowError(true)}>False</button>
|
|
15
|
+
<Input {...args} setShowError={setShowError} showError={showError} />
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Radio from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Radio from '../components/Inputs/Radio';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: 'Inputs/Radio',
|
|
6
6
|
component: Radio,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
const [status, setStatus] = useState(false);
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<Radio {...args} status={status} setStatus={setStatus}>Radio</Radio>
|
|
14
|
+
)
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
10
18
|
|
|
11
|
-
export const Primary = Template.bind({});
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Switch from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Switch from '../components/Inputs/Switch';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: 'Inputs/Switch',
|
|
6
6
|
component: Switch,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
const [status, setStatus] = useState(false);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
return (
|
|
13
|
+
<Switch {...args} status={status} setStatus={setStatus}>Switch</Switch>
|
|
14
|
+
)
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const Default = Template.bind({});
|
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import Textarea from
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import Textarea from '../components/Inputs/Textarea';
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
|
-
title:
|
|
5
|
+
title: 'Inputs/Textarea',
|
|
6
6
|
component: Textarea,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const Template = (args) =>
|
|
9
|
+
const Template = (args) => {
|
|
10
|
+
const [showError, setShowError] = useState(false);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<button onClick={()=>setShowError(true)}>False</button>
|
|
15
|
+
<Textarea {...args} setShowError={setShowError} showError={showError} />
|
|
16
|
+
</>
|
|
17
|
+
)
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const Default = Template.bind({});
|