etendo-ui-library 1.0.0
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/.storybook/main.js +12 -0
- package/.storybook/preview.js +9 -0
- package/babel.config.js +4 -0
- package/dist/cjs/components/Button.d.ts +4 -0
- package/dist/cjs/components/Button.types.d.ts +8 -0
- package/dist/cjs/components/Input.d.ts +4 -0
- package/dist/cjs/components/Input.types.d.ts +11 -0
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +42 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/components/Button.d.ts +4 -0
- package/dist/esm/components/Button.types.d.ts +8 -0
- package/dist/esm/components/Input.d.ts +4 -0
- package/dist/esm/components/Input.types.d.ts +11 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +42 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/jest.config.ts +199 -0
- package/package.json +48 -0
- package/rollup.config.js +39 -0
- package/src/components/Button.tsx +52 -0
- package/src/components/Button.types.ts +8 -0
- package/src/components/Input.tsx +70 -0
- package/src/components/Input.types.ts +12 -0
- package/src/components/__stories__/Button.stories.tsx +59 -0
- package/src/components/__stories__/Input.stories.tsx +22 -0
- package/src/components/__stories__/Introduction.stories.mdx +211 -0
- package/src/components/__stories__/assets/code-brackets.svg +1 -0
- package/src/components/__stories__/assets/colors.svg +1 -0
- package/src/components/__stories__/assets/comments.svg +1 -0
- package/src/components/__stories__/assets/direction.svg +1 -0
- package/src/components/__stories__/assets/flow.svg +1 -0
- package/src/components/__stories__/assets/plugin.svg +1 -0
- package/src/components/__stories__/assets/repo.svg +1 -0
- package/src/components/__stories__/assets/stackalt.svg +1 -0
- package/src/components/__tests__/Button.test.tsx +12 -0
- package/src/components/__tests__/Input.test.tsx +26 -0
- package/src/index.d.ts +0 -0
- package/src/index.ts +5 -0
- package/tsconfig.json +101 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
"stories": [
|
|
3
|
+
"../src/**/*.stories.mdx",
|
|
4
|
+
"../src/**/*.stories.@(js|jsx|ts|tsx)"
|
|
5
|
+
],
|
|
6
|
+
"addons": [
|
|
7
|
+
"@storybook/addon-links",
|
|
8
|
+
"@storybook/addon-essentials",
|
|
9
|
+
"@storybook/addon-interactions"
|
|
10
|
+
],
|
|
11
|
+
"framework": "@storybook/react"
|
|
12
|
+
}
|
package/babel.config.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEventHandler } from "react";
|
|
2
|
+
export interface InputProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
message?: string;
|
|
7
|
+
success?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),r=require("styled-components");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=t(e),a=t(r);function l(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var a=0;for(o=Object.getOwnPropertySymbols(e);a<o.length;a++)r.indexOf(o[a])<0&&Object.prototype.propertyIsEnumerable.call(e,o[a])&&(t[o[a]]=e[o[a]])}return t}const d=a.default.button`
|
|
2
|
+
border: 0;
|
|
3
|
+
line-height: 1;
|
|
4
|
+
font-size: 15px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
font-weight: 700;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
border-radius: 3px;
|
|
9
|
+
display: inline-block;
|
|
10
|
+
padding: ${e=>"small"===e.size?"7px 25px 8px":"medium"===e.size?"9px 30px 11px":"14px 30px 16px"};
|
|
11
|
+
color: ${e=>e.primary?"#1b116e":"#ffffff"};
|
|
12
|
+
background-color: ${e=>e.primary?"#6bedb5":"#1b116e"};
|
|
13
|
+
opacity: ${e=>e.disabled?.5:1};
|
|
14
|
+
&:hover {
|
|
15
|
+
background-color: ${e=>e.primary?"#55bd90":"#6bedb5"};
|
|
16
|
+
}
|
|
17
|
+
&:active {
|
|
18
|
+
border: solid 2px #1b116e;
|
|
19
|
+
padding: ${e=>"small"===e.size?"5px 23px 6px":"medium"===e.size?"7px 28px 9px":"12px 28px 14px"};
|
|
20
|
+
}
|
|
21
|
+
`,i=a.default.input`
|
|
22
|
+
height: 40px;
|
|
23
|
+
width: 300px;
|
|
24
|
+
border-radius: 3px;
|
|
25
|
+
border: solid 2px ${e=>e.disabled?"#e4e3ea":e.error?"#a9150b":e.success?"#067d68":"#353637"};
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
&:focus{
|
|
28
|
+
border: solid 2px #1b116e;
|
|
29
|
+
}
|
|
30
|
+
`,p=a.default.div`
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
color: ${e=>e.disabled?"#e4e3ea":"#080808"};
|
|
33
|
+
padding-bottom: 6px;
|
|
34
|
+
`,n=a.default.div`
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
color: #a9150b8;
|
|
37
|
+
padding-top: 4px;
|
|
38
|
+
`,s=a.default.p`
|
|
39
|
+
margin: 0px;
|
|
40
|
+
color: ${e=>e.disabled?"#e4e3ea":e.error?"#a9150b":"#080808"};
|
|
41
|
+
`;exports.Button=e=>{var{size:r,primary:t,disabled:a,text:i,onClick:p}=e,n=l(e,["size","primary","disabled","text","onClick"]);return o.default.createElement(d,Object.assign({type:"button",onClick:p,primary:t,disabled:a,size:r},n),i)},exports.Input=r=>{var{id:t,disabled:a,label:d,message:c,error:b,success:u,onChange:f,placeholder:x}=r,m=l(r,["id","disabled","label","message","error","success","onChange","placeholder"]);return o.default.createElement(e.Fragment,null,o.default.createElement(p,null,o.default.createElement(s,{disabled:a,error:b},d)),o.default.createElement(i,Object.assign({id:t,type:"text",onChange:f,disabled:a,error:b,success:u,placeholder:x},m)),o.default.createElement(n,null,o.default.createElement(s,{error:b},c)))};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/components/Button.tsx","../../src/components/Input.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n",null,null],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","StyledButton","styled","button","props","size","primary","disabled","StyledInput","input","error","success","StyledLabel","div","StyledMessage","StyledText","_a","text","onClick","React","createElement","assign","type","id","label","message","onChange","placeholder","Fragment"],"mappings":"oNA0CO,SAASA,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT,GAAIU,EAAIP,EAAEQ,OAAQD,IAC3DT,EAAEO,QAAQL,EAAEO,IAAM,GAAKN,OAAOC,UAAUO,qBAAqBL,KAAKP,EAAGG,EAAEO,MACvER,EAAEC,EAAEO,IAAMV,EAAEG,EAAEO,IAF4B,CAItD,OAAOR,CACX,CC/CA,MAAMW,EAAeC,EAAAA,QAAOC,MAAmB;;;;;;;;;eAShCC,GAAwB,UAAfA,EAAMC,KAAmB,eAAiC,WAAfD,EAAMC,KAAoB,gBAAkB;aAClGD,GAASA,EAAME,QAAU,UAAY;wBAC1BF,GAASA,EAAME,QAAU,UAAY;eAC9CF,GAASA,EAAMG,SAAW,GAAM;;0BAErBH,GAASA,EAAME,QAAU,UAAY;;;;mBAI5CF,GAAwB,UAAfA,EAAMC,KAAmB,eAAiC,WAAfD,EAAMC,KAAoB,eAAiB;;ECnB5GG,EAAcN,EAAAA,QAAOO,KAAiB;;;;wBAIpBL,GAASA,EAAMG,SAAW,UAAaH,EAAMM,MAAQ,UAAaN,EAAMO,QAAU,UAAY;;;;;EAOhHC,EAAcV,EAAAA,QAAOW,GAAe;;YAE9BT,GAASA,EAAMG,SAAW,UAAY;;EAI5CO,EAAgBZ,EAAAA,QAAOW,GAAe;;;;EAMtCE,EAAab,EAAAA,QAAOX,CAAa;;YAE3Ba,GAASA,EAAMG,SAAW,UAAaH,EAAMM,MAAQ,UAAY;iBDF5CM,IAAA,IAAAX,KAAEA,EAAIC,QAAEA,EAAOC,SAAEA,EAAQU,KAAEA,EAAIC,QAAEA,GAAmBF,EAAPZ,EAAKjB,EAAA6B,EAAlD,gDAC/B,OACEG,EAAA,QAAAC,cAACnB,EAAYT,OAAA6B,OAAA,CAACC,KAAK,SAASJ,QAASA,EAASZ,QAASA,EAASC,SAAUA,EAAUF,KAAMA,GAAUD,GACjGa,EAEJ,gBCA4BD,QAAAO,GAAEA,EAAEhB,SAAEA,EAAQiB,MAAEA,EAAKC,QAAEA,EAAOf,MAAEA,EAAKC,QAAEA,EAAOe,SAAEA,EAAQC,YAAEA,GAAWX,EAAKZ,EAAKjB,EAAA6B,EAA/E,gFAC7B,OACEG,wBAACS,EAAAA,SAAQ,KACPT,UAAAC,cAACR,EAAW,KAACO,UAAAC,cAACL,EAAU,CAACR,SAAUA,EAAUG,MAAOA,GAAQc,IAC5DL,UAAAC,cAACZ,EAAWhB,OAAA6B,OAAA,CAACE,GAAIA,EAAID,KAAK,OAAOI,SAAUA,EAAUnB,SAAUA,EAAUG,MAAOA,EAAOC,QAASA,EAASgB,YAAaA,GAAiBvB,IACvIe,UAAAC,cAACN,EAAa,KAACK,UAACC,cAAAL,EAAW,CAAAL,MAAOA,GAAQe,IAE7C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeEventHandler } from "react";
|
|
2
|
+
export interface InputProps {
|
|
3
|
+
id?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
error?: boolean;
|
|
6
|
+
message?: string;
|
|
7
|
+
success?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import e,{Fragment as r}from"react";import o from"styled-components";function t(e,r){var o={};for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.indexOf(t)<0&&(o[t]=e[t]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(t=Object.getOwnPropertySymbols(e);i<t.length;i++)r.indexOf(t[i])<0&&Object.prototype.propertyIsEnumerable.call(e,t[i])&&(o[t[i]]=e[t[i]])}return o}const i=o.button`
|
|
2
|
+
border: 0;
|
|
3
|
+
line-height: 1;
|
|
4
|
+
font-size: 15px;
|
|
5
|
+
cursor: pointer;
|
|
6
|
+
font-weight: 700;
|
|
7
|
+
font-weight: bold;
|
|
8
|
+
border-radius: 3px;
|
|
9
|
+
display: inline-block;
|
|
10
|
+
padding: ${e=>"small"===e.size?"7px 25px 8px":"medium"===e.size?"9px 30px 11px":"14px 30px 16px"};
|
|
11
|
+
color: ${e=>e.primary?"#1b116e":"#ffffff"};
|
|
12
|
+
background-color: ${e=>e.primary?"#6bedb5":"#1b116e"};
|
|
13
|
+
opacity: ${e=>e.disabled?.5:1};
|
|
14
|
+
&:hover {
|
|
15
|
+
background-color: ${e=>e.primary?"#55bd90":"#6bedb5"};
|
|
16
|
+
}
|
|
17
|
+
&:active {
|
|
18
|
+
border: solid 2px #1b116e;
|
|
19
|
+
padding: ${e=>"small"===e.size?"5px 23px 6px":"medium"===e.size?"7px 28px 9px":"12px 28px 14px"};
|
|
20
|
+
}
|
|
21
|
+
`,a=r=>{var{size:o,primary:a,disabled:l,text:p,onClick:d}=r,n=t(r,["size","primary","disabled","text","onClick"]);return e.createElement(i,Object.assign({type:"button",onClick:d,primary:a,disabled:l,size:o},n),p)},l=o.input`
|
|
22
|
+
height: 40px;
|
|
23
|
+
width: 300px;
|
|
24
|
+
border-radius: 3px;
|
|
25
|
+
border: solid 2px ${e=>e.disabled?"#e4e3ea":e.error?"#a9150b":e.success?"#067d68":"#353637"};
|
|
26
|
+
background-color: #fff;
|
|
27
|
+
&:focus{
|
|
28
|
+
border: solid 2px #1b116e;
|
|
29
|
+
}
|
|
30
|
+
`,p=o.div`
|
|
31
|
+
font-size: 14px;
|
|
32
|
+
color: ${e=>e.disabled?"#e4e3ea":"#080808"};
|
|
33
|
+
padding-bottom: 6px;
|
|
34
|
+
`,d=o.div`
|
|
35
|
+
font-size: 14px;
|
|
36
|
+
color: #a9150b8;
|
|
37
|
+
padding-top: 4px;
|
|
38
|
+
`,n=o.p`
|
|
39
|
+
margin: 0px;
|
|
40
|
+
color: ${e=>e.disabled?"#e4e3ea":e.error?"#a9150b":"#080808"};
|
|
41
|
+
`,s=o=>{var{id:i,disabled:a,label:s,message:c,error:b,success:x,onChange:m,placeholder:u}=o,f=t(o,["id","disabled","label","message","error","success","onChange","placeholder"]);return e.createElement(r,null,e.createElement(p,null,e.createElement(n,{disabled:a,error:b},s)),e.createElement(l,Object.assign({id:i,type:"text",onChange:m,disabled:a,error:b,success:x,placeholder:u},f)),e.createElement(d,null,e.createElement(n,{error:b},c)))};export{a as Button,s as Input};
|
|
42
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../node_modules/tslib/tslib.es6.js","../../src/components/Button.tsx","../../src/components/Input.tsx"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n var desc = Object.getOwnPropertyDescriptor(m, k);\r\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\r\n desc = { enumerable: true, get: function() { return m[k]; } };\r\n }\r\n Object.defineProperty(o, k2, desc);\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || Array.prototype.slice.call(from));\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\nexport function __classPrivateFieldIn(state, receiver) {\r\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\r\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\r\n}\r\n",null,null],"names":["__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","StyledButton","styled","button","props","size","primary","disabled","Button","_a","text","onClick","React","createElement","assign","type","StyledInput","input","error","success","StyledLabel","div","StyledMessage","StyledText","Input","id","label","message","onChange","placeholder","Fragment"],"mappings":"qEA0CO,SAASA,EAAOC,EAAGC,GACtB,IAAIC,EAAI,CAAA,EACR,IAAK,IAAIC,KAAKH,EAAOI,OAAOC,UAAUC,eAAeC,KAAKP,EAAGG,IAAMF,EAAEO,QAAQL,GAAK,IAC9ED,EAAEC,GAAKH,EAAEG,IACb,GAAS,MAALH,GAAqD,mBAAjCI,OAAOK,sBACtB,KAAIC,EAAI,EAAb,IAAgBP,EAAIC,OAAOK,sBAAsBT,GAAIU,EAAIP,EAAEQ,OAAQD,IAC3DT,EAAEO,QAAQL,EAAEO,IAAM,GAAKN,OAAOC,UAAUO,qBAAqBL,KAAKP,EAAGG,EAAEO,MACvER,EAAEC,EAAEO,IAAMV,EAAEG,EAAEO,IAF4B,CAItD,OAAOR,CACX,CC/CA,MAAMW,EAAeC,EAAOC,MAAmB;;;;;;;;;eAShCC,GAAwB,UAAfA,EAAMC,KAAmB,eAAiC,WAAfD,EAAMC,KAAoB,gBAAkB;aAClGD,GAASA,EAAME,QAAU,UAAY;wBAC1BF,GAASA,EAAME,QAAU,UAAY;eAC9CF,GAASA,EAAMG,SAAW,GAAM;;0BAErBH,GAASA,EAAME,QAAU,UAAY;;;;mBAI5CF,GAAwB,UAAfA,EAAMC,KAAmB,eAAiC,WAAfD,EAAMC,KAAoB,eAAiB;;EAI5GG,EAA2BC,IAAA,IAAAJ,KAAEA,EAAIC,QAAEA,EAAOC,SAAEA,EAAQG,KAAEA,EAAIC,QAAEA,GAAmBF,EAAPL,EAAKjB,EAAAsB,EAAlD,gDAC/B,OACEG,EAAAC,cAACZ,EAAYT,OAAAsB,OAAA,CAACC,KAAK,SAASJ,QAASA,EAASL,QAASA,EAASC,SAAUA,EAAUF,KAAMA,GAAUD,GACjGM,EAEJ,EC5BGM,EAAcd,EAAOe,KAAiB;;;;wBAIpBb,GAASA,EAAMG,SAAW,UAAaH,EAAMc,MAAQ,UAAad,EAAMe,QAAU,UAAY;;;;;EAOhHC,EAAclB,EAAOmB,GAAe;;YAE9BjB,GAASA,EAAMG,SAAW,UAAY;;EAI5Ce,EAAgBpB,EAAOmB,GAAe;;;;EAMtCE,EAAarB,EAAOX,CAAa;;YAE3Ba,GAASA,EAAMG,SAAW,UAAaH,EAAMc,MAAQ,UAAY;EAGvEM,EAAyBf,QAAAgB,GAAEA,EAAElB,SAAEA,EAAQmB,MAAEA,EAAKC,QAAEA,EAAOT,MAAEA,EAAKC,QAAEA,EAAOS,SAAEA,EAAQC,YAAEA,GAAWpB,EAAKL,EAAKjB,EAAAsB,EAA/E,gFAC7B,OACEG,gBAACkB,EAAQ,KACPlB,EAAAC,cAACO,EAAW,KAACR,EAAAC,cAACU,EAAU,CAAChB,SAAUA,EAAUW,MAAOA,GAAQQ,IAC5Dd,EAAAC,cAACG,EAAWxB,OAAAsB,OAAA,CAACW,GAAIA,EAAIV,KAAK,OAAOa,SAAUA,EAAUrB,SAAUA,EAAUW,MAAOA,EAAOC,QAASA,EAASU,YAAaA,GAAiBzB,IACvIQ,EAAAC,cAACS,EAAa,KAACV,EAACC,cAAAU,EAAW,CAAAL,MAAOA,GAAQS,IAE7C"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MouseEventHandler, FC, ChangeEventHandler } from 'react';
|
|
2
|
+
|
|
3
|
+
interface ButtonProps {
|
|
4
|
+
text?: string;
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
size?: "small" | "medium" | "large";
|
|
8
|
+
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare const Button: FC<ButtonProps>;
|
|
12
|
+
|
|
13
|
+
interface InputProps {
|
|
14
|
+
id?: string;
|
|
15
|
+
label?: string;
|
|
16
|
+
error?: boolean;
|
|
17
|
+
message?: string;
|
|
18
|
+
success?: boolean;
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
placeholder?: string;
|
|
21
|
+
onChange?: ChangeEventHandler<HTMLInputElement>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare const Input: FC<InputProps>;
|
|
25
|
+
|
|
26
|
+
export { Button, Input };
|
package/jest.config.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* For a detailed explanation regarding each configuration property and type check, visit:
|
|
3
|
+
* https://jestjs.io/docs/configuration
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
// All imported modules in your tests should be mocked automatically
|
|
8
|
+
// automock: false,
|
|
9
|
+
|
|
10
|
+
// Stop running tests after `n` failures
|
|
11
|
+
// bail: 0,
|
|
12
|
+
|
|
13
|
+
// The directory where Jest should store its cached dependency information
|
|
14
|
+
// cacheDirectory: "/private/var/folders/dt/p28p76nx47d7d_kp3n4vvh5c0000gn/T/jest_dx",
|
|
15
|
+
|
|
16
|
+
// Automatically clear mock calls, instances, contexts and results before every test
|
|
17
|
+
// clearMocks: false,
|
|
18
|
+
|
|
19
|
+
// Indicates whether the coverage information should be collected while executing the test
|
|
20
|
+
// collectCoverage: false,
|
|
21
|
+
|
|
22
|
+
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
|
23
|
+
// collectCoverageFrom: undefined,
|
|
24
|
+
|
|
25
|
+
// The directory where Jest should output its coverage files
|
|
26
|
+
// coverageDirectory: undefined,
|
|
27
|
+
|
|
28
|
+
// An array of regexp pattern strings used to skip coverage collection
|
|
29
|
+
// coveragePathIgnorePatterns: [
|
|
30
|
+
// "/node_modules/"
|
|
31
|
+
// ],
|
|
32
|
+
|
|
33
|
+
// Indicates which provider should be used to instrument code for coverage
|
|
34
|
+
// coverageProvider: "babel",
|
|
35
|
+
|
|
36
|
+
// A list of reporter names that Jest uses when writing coverage reports
|
|
37
|
+
// coverageReporters: [
|
|
38
|
+
// "json",
|
|
39
|
+
// "text",
|
|
40
|
+
// "lcov",
|
|
41
|
+
// "clover"
|
|
42
|
+
// ],
|
|
43
|
+
|
|
44
|
+
// An object that configures minimum threshold enforcement for coverage results
|
|
45
|
+
// coverageThreshold: undefined,
|
|
46
|
+
|
|
47
|
+
// A path to a custom dependency extractor
|
|
48
|
+
// dependencyExtractor: undefined,
|
|
49
|
+
|
|
50
|
+
// Make calling deprecated APIs throw helpful error messages
|
|
51
|
+
// errorOnDeprecated: false,
|
|
52
|
+
|
|
53
|
+
// The default configuration for fake timers
|
|
54
|
+
// fakeTimers: {
|
|
55
|
+
// "enableGlobally": false
|
|
56
|
+
// },
|
|
57
|
+
|
|
58
|
+
// Force coverage collection from ignored files using an array of glob patterns
|
|
59
|
+
// forceCoverageMatch: [],
|
|
60
|
+
|
|
61
|
+
// A path to a module which exports an async function that is triggered once before all test suites
|
|
62
|
+
// globalSetup: undefined,
|
|
63
|
+
|
|
64
|
+
// A path to a module which exports an async function that is triggered once after all test suites
|
|
65
|
+
// globalTeardown: undefined,
|
|
66
|
+
|
|
67
|
+
// A set of global variables that need to be available in all test environments
|
|
68
|
+
// globals: {},
|
|
69
|
+
|
|
70
|
+
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
|
71
|
+
// maxWorkers: "50%",
|
|
72
|
+
|
|
73
|
+
// An array of directory names to be searched recursively up from the requiring module's location
|
|
74
|
+
// moduleDirectories: [
|
|
75
|
+
// "node_modules"
|
|
76
|
+
// ],
|
|
77
|
+
|
|
78
|
+
// An array of file extensions your modules use
|
|
79
|
+
// moduleFileExtensions: [
|
|
80
|
+
// "js",
|
|
81
|
+
// "mjs",
|
|
82
|
+
// "cjs",
|
|
83
|
+
// "jsx",
|
|
84
|
+
// "ts",
|
|
85
|
+
// "tsx",
|
|
86
|
+
// "json",
|
|
87
|
+
// "node"
|
|
88
|
+
// ],
|
|
89
|
+
|
|
90
|
+
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
|
91
|
+
// moduleNameMapper: {},
|
|
92
|
+
|
|
93
|
+
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
|
94
|
+
// modulePathIgnorePatterns: [],
|
|
95
|
+
|
|
96
|
+
// Activates notifications for test results
|
|
97
|
+
// notify: false,
|
|
98
|
+
|
|
99
|
+
// An enum that specifies notification mode. Requires { notify: true }
|
|
100
|
+
// notifyMode: "failure-change",
|
|
101
|
+
|
|
102
|
+
// A preset that is used as a base for Jest's configuration
|
|
103
|
+
//preset: 'jasmine-ts',
|
|
104
|
+
|
|
105
|
+
// Run tests from one or more projects
|
|
106
|
+
// projects: undefined,
|
|
107
|
+
|
|
108
|
+
// Use this configuration option to add custom reporters to Jest
|
|
109
|
+
// reporters: undefined,
|
|
110
|
+
|
|
111
|
+
// Automatically reset mock state before every test
|
|
112
|
+
// resetMocks: false,
|
|
113
|
+
|
|
114
|
+
// Reset the module registry before running each individual test
|
|
115
|
+
// resetModules: false,
|
|
116
|
+
|
|
117
|
+
// A path to a custom resolver
|
|
118
|
+
// resolver: undefined,
|
|
119
|
+
|
|
120
|
+
// Automatically restore mock state and implementation before every test
|
|
121
|
+
// restoreMocks: false,
|
|
122
|
+
|
|
123
|
+
// The root directory that Jest should scan for tests and modules within
|
|
124
|
+
// rootDir: undefined,
|
|
125
|
+
|
|
126
|
+
// A list of paths to directories that Jest should use to search for files in
|
|
127
|
+
// roots: [
|
|
128
|
+
// "<rootDir>"
|
|
129
|
+
// ],
|
|
130
|
+
|
|
131
|
+
// Allows you to use a custom runner instead of Jest's default test runner
|
|
132
|
+
// runner: "jest-runner",
|
|
133
|
+
|
|
134
|
+
// The paths to modules that run some code to configure or set up the testing environment before each test
|
|
135
|
+
// setupFiles: [],
|
|
136
|
+
|
|
137
|
+
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
|
138
|
+
// setupFilesAfterEnv: [],
|
|
139
|
+
|
|
140
|
+
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
|
141
|
+
// slowTestThreshold: 5,
|
|
142
|
+
|
|
143
|
+
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
|
144
|
+
// snapshotSerializers: [],
|
|
145
|
+
|
|
146
|
+
// The test environment that will be used for testing
|
|
147
|
+
testEnvironment: "jsdom",
|
|
148
|
+
|
|
149
|
+
// Options that will be passed to the testEnvironment
|
|
150
|
+
// testEnvironmentOptions: {},
|
|
151
|
+
|
|
152
|
+
// Adds a location field to test results
|
|
153
|
+
// testLocationInResults: false,
|
|
154
|
+
|
|
155
|
+
// The glob patterns Jest uses to detect test files
|
|
156
|
+
// testMatch: [
|
|
157
|
+
// "**/__tests__/**/*.[jt]s?(x)",
|
|
158
|
+
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
|
159
|
+
// ],
|
|
160
|
+
|
|
161
|
+
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
|
162
|
+
// testPathIgnorePatterns: [
|
|
163
|
+
// "/node_modules/"
|
|
164
|
+
// ],
|
|
165
|
+
|
|
166
|
+
// The regexp pattern or array of patterns that Jest uses to detect test files
|
|
167
|
+
// testRegex: [],
|
|
168
|
+
|
|
169
|
+
// This option allows the use of a custom results processor
|
|
170
|
+
// testResultsProcessor: undefined,
|
|
171
|
+
|
|
172
|
+
// This option allows use of a custom test runner
|
|
173
|
+
// testRunner: "jest-circus/runner",
|
|
174
|
+
|
|
175
|
+
// A map from regular expressions to paths to transformers
|
|
176
|
+
/*transform: {
|
|
177
|
+
"^.+\\.(js|ts)$": "jasmine-ts",
|
|
178
|
+
}, */
|
|
179
|
+
|
|
180
|
+
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
|
181
|
+
/*
|
|
182
|
+
transformIgnorePatterns: [
|
|
183
|
+
"/node_modules/(?![@autofiy/autofiyable|@autofiy/property]).+\\.js$",
|
|
184
|
+
"/node_modules/(?![@autofiy/autofiyable|@autofiy/property]).+\\.ts$",
|
|
185
|
+
"/node_modules/(?![@autofiy/autofiyable|@autofiy/property]).+\\.tsx$",
|
|
186
|
+
],
|
|
187
|
+
*/
|
|
188
|
+
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
|
189
|
+
// unmockedModulePathPatterns: undefined,
|
|
190
|
+
|
|
191
|
+
// Indicates whether each individual test should be reported during the run
|
|
192
|
+
// verbose: undefined,
|
|
193
|
+
|
|
194
|
+
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
|
195
|
+
// watchPathIgnorePatterns: [],
|
|
196
|
+
|
|
197
|
+
// Whether to use watchman for file crawling
|
|
198
|
+
// watchman: true,
|
|
199
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "etendo-ui-library",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/cjs/index.js",
|
|
5
|
+
"module": "dist/esm/index.js",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "rollup -c",
|
|
9
|
+
"storybook": "start-storybook -p 6006",
|
|
10
|
+
"build-storybook": "build-storybook",
|
|
11
|
+
"test": "jest"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@babel/core": "^7.19.1",
|
|
15
|
+
"@rollup/plugin-commonjs": "^22.0.2",
|
|
16
|
+
"@rollup/plugin-node-resolve": "^14.1.0",
|
|
17
|
+
"@rollup/plugin-typescript": "^8.5.0",
|
|
18
|
+
"@storybook/addon-actions": "^6.5.12",
|
|
19
|
+
"@storybook/addon-essentials": "^6.5.12",
|
|
20
|
+
"@storybook/addon-interactions": "^6.5.12",
|
|
21
|
+
"@storybook/addon-links": "^6.5.12",
|
|
22
|
+
"@storybook/builder-webpack4": "^6.5.12",
|
|
23
|
+
"@storybook/manager-webpack4": "^6.5.12",
|
|
24
|
+
"@storybook/react": "^6.5.12",
|
|
25
|
+
"@storybook/testing-library": "^0.0.13",
|
|
26
|
+
"@testing-library/jest-dom": "^5.16.5",
|
|
27
|
+
"@testing-library/react": "^13.4.0",
|
|
28
|
+
"@testing-library/user-event": "^14.4.3",
|
|
29
|
+
"@types/jest": "^29.0.3",
|
|
30
|
+
"@types/react": "^18.0.20",
|
|
31
|
+
"@types/styled-components": "^5.1.26",
|
|
32
|
+
"babel-loader": "^8.2.5",
|
|
33
|
+
"jasmine-ts": "^0.4.0",
|
|
34
|
+
"jest": "^29.0.3",
|
|
35
|
+
"jest-environment-jsdom": "^29.0.3",
|
|
36
|
+
"react": "^18.2.0",
|
|
37
|
+
"react-dom": "^18.2.0",
|
|
38
|
+
"rollup": "^2.79.0",
|
|
39
|
+
"rollup-plugin-dts": "^4.2.2",
|
|
40
|
+
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
41
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
42
|
+
"styled-components": "^5.3.5",
|
|
43
|
+
"ts-node": "^10.9.1",
|
|
44
|
+
"tslib": "^2.4.0",
|
|
45
|
+
"typescript": "^4.8.3"
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {}
|
|
48
|
+
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import resolve from "@rollup/plugin-node-resolve";
|
|
2
|
+
import commonjs from "@rollup/plugin-commonjs";
|
|
3
|
+
import typescript from "@rollup/plugin-typescript";
|
|
4
|
+
import dts from "rollup-plugin-dts";
|
|
5
|
+
import { terser } from "rollup-plugin-terser";
|
|
6
|
+
import peerDepsExternal from 'rollup-plugin-peer-deps-external';
|
|
7
|
+
|
|
8
|
+
const packageJson = require("./package.json");
|
|
9
|
+
|
|
10
|
+
export default [
|
|
11
|
+
{
|
|
12
|
+
input: "src/index.ts",
|
|
13
|
+
output: [
|
|
14
|
+
{
|
|
15
|
+
file: packageJson.main,
|
|
16
|
+
format: "cjs",
|
|
17
|
+
sourcemap: true,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
file: packageJson.module,
|
|
21
|
+
format: "esm",
|
|
22
|
+
sourcemap: true,
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
plugins: [
|
|
26
|
+
peerDepsExternal(),
|
|
27
|
+
resolve(),
|
|
28
|
+
commonjs(),
|
|
29
|
+
typescript({ tsconfig: "./tsconfig.json" }),
|
|
30
|
+
terser(),
|
|
31
|
+
],
|
|
32
|
+
external: ["react", "react-dom", "styled-components"]
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
input: "dist/esm/index.d.ts",
|
|
36
|
+
output: [{ file: "dist/index.d.ts", format: "esm" }],
|
|
37
|
+
plugins: [dts()],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import styled from "styled-components";
|
|
3
|
+
import { ButtonProps } from "./Button.types";
|
|
4
|
+
|
|
5
|
+
const StyledButton = styled.button<ButtonProps>`
|
|
6
|
+
border: 0;
|
|
7
|
+
line-height: 1;
|
|
8
|
+
font-size: 15px;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
font-weight: 700;
|
|
11
|
+
font-weight: bold;
|
|
12
|
+
border-radius: 3px;
|
|
13
|
+
display: inline-block;
|
|
14
|
+
padding: ${(props) =>
|
|
15
|
+
props.size === "small"
|
|
16
|
+
? "7px 25px 8px"
|
|
17
|
+
: props.size === "medium"
|
|
18
|
+
? "9px 30px 11px"
|
|
19
|
+
: "14px 30px 16px"};
|
|
20
|
+
color: ${(props) => (props.primary ? "#1b116e" : "#ffffff")};
|
|
21
|
+
background-color: ${(props) => (props.primary ? "#6bedb5" : "#1b116e")};
|
|
22
|
+
opacity: ${(props) => (props.disabled ? 0.5 : 1)};
|
|
23
|
+
&:hover {
|
|
24
|
+
background-color: ${(props) => (props.primary ? "#55bd90" : "#6bedb5")};
|
|
25
|
+
}
|
|
26
|
+
&:active {
|
|
27
|
+
border: solid 2px #1b116e;
|
|
28
|
+
padding: ${(props) =>
|
|
29
|
+
props.size === "small"
|
|
30
|
+
? "5px 23px 6px"
|
|
31
|
+
: props.size === "medium"
|
|
32
|
+
? "7px 28px 9px"
|
|
33
|
+
: "12px 28px 14px"};
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
|
|
37
|
+
const Button: React.FC<ButtonProps> = ({ text, primary, disabled, size, onClick, ...props }) => {
|
|
38
|
+
return (
|
|
39
|
+
<StyledButton
|
|
40
|
+
type="button"
|
|
41
|
+
onClick={onClick}
|
|
42
|
+
primary={primary}
|
|
43
|
+
disabled={disabled}
|
|
44
|
+
size={size}
|
|
45
|
+
{...props}
|
|
46
|
+
>
|
|
47
|
+
{text}
|
|
48
|
+
</StyledButton>
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export default Button;
|