@hbuesing/ui-library 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +2 -0
- package/dist/bundle.js.map +1 -0
- package/dist/components/button/customButton.d.ts +10 -0
- package/dist/components/button/index.d.ts +1 -0
- package/dist/components/checkbox/customCheckBox.d.ts +10 -0
- package/dist/components/checkbox/index.d.ts +1 -0
- package/dist/components/images/index.d.ts +1 -0
- package/dist/components/images/svgIcon.d.ts +9 -0
- package/dist/components/input/baseInput.d.ts +11 -0
- package/dist/components/input/customInput.d.ts +8 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/passwordInput.d.ts +18 -0
- package/dist/components/modal/baseModal.d.ts +16 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/notifyModal.d.ts +11 -0
- package/dist/components/modal/questionModal.d.ts +10 -0
- package/dist/components/radio/customRadio.d.ts +17 -0
- package/dist/components/radio/index.d.ts +1 -0
- package/dist/enums/index.d.ts +1 -0
- package/dist/enums/modalType.d.ts +6 -0
- package/dist/enums/passwordRuleTypes.d.ts +8 -0
- package/dist/hooks/clickOutside.d.ts +1 -0
- package/dist/hooks/getColor.d.ts +1 -0
- package/{src/hooks/index.ts → dist/hooks/index.d.ts} +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/utils/generateKey.d.ts +1 -0
- package/dist/utils/useInjectStyles.d.ts +2 -0
- package/package.json +9 -4
- package/src/components/button/button.scss +0 -25
- package/src/components/button/customButton.tsx +0 -84
- package/src/components/button/index.ts +0 -1
- package/src/components/checkbox/checkbox.scss +0 -13
- package/src/components/checkbox/customCheckBox.tsx +0 -35
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/global.scss +0 -60
- package/src/components/images/images.scss +0 -12
- package/src/components/images/index.ts +0 -1
- package/src/components/images/svgIcon.tsx +0 -39
- package/src/components/input/baseInput.tsx +0 -48
- package/src/components/input/customInput.tsx +0 -54
- package/src/components/input/index.ts +0 -2
- package/src/components/input/input.scss +0 -142
- package/src/components/input/passwordInput.tsx +0 -118
- package/src/components/modal/baseModal.tsx +0 -105
- package/src/components/modal/index.ts +0 -2
- package/src/components/modal/modal.scss +0 -125
- package/src/components/modal/notifyModal.tsx +0 -24
- package/src/components/modal/questionModal.tsx +0 -23
- package/src/components/radio/customRadio.tsx +0 -72
- package/src/components/radio/index.ts +0 -1
- package/src/components/radio/radio.scss +0 -28
- package/src/components/variables.scss +0 -61
- package/src/enums/index.ts +0 -1
- package/src/enums/modalType.ts +0 -6
- package/src/enums/passwordRuleTypes.ts +0 -8
- package/src/hooks/clickOutside.ts +0 -25
- package/src/hooks/getColor.ts +0 -16
- package/src/index.ts +0 -9
- package/src/utils/generateKey.ts +0 -3
- package/src/utils/styles.scss +0 -7
- package/src/utils/styles.scss.d.ts +0 -2
- package/src/utils/useInjectStyles.ts +0 -19
- package/tsconfig.json +0 -24
package/dist/bundle.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import e,{useEffect as l,useRef as i,useState as r}from"react";function t(){return t=Object.assign?Object.assign.bind():function(e){for(var l=1;l<arguments.length;l++){var i=arguments[l];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},t.apply(null,arguments)}function a(e,l){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(l.includes(r))continue;i[r]=e[r]}return i}var o=":root{--uil-black:#000;--uil-black-alt:#222;--uil-white:#fff;--uil-grey:#f3f3f3;--uil-grey-alt:#cfcfcf;--uil-grey-dark:#878787;--uil-outline-focus:#1e90ff;--uil-outline-disabled:#8b0000;--uil-success:#006a4e;--uil-error:#800020;--uil-question:#00416a;--uil-warning:gold;--uil-xxxs:.125rem;--uil-xxs:.25rem;--uil-xs:.5rem;--uil-s:.75rem;--uil-m:1rem;--uil-l:1.25rem;--uil-xl:1.5rem;--uil-xxl:1.75rem;--uil-xxxl:2rem;--uil-font-base:var(--uil-l);--uil-font-small:var(--uil-m)}.uil-button{background-color:var(--uil-white);border:1px solid var(--uil-black);border-radius:2px;box-shadow:0 0 3px 0 var(--uil-black-alt);color:var(--uil-black);cursor:pointer;letter-spacing:1px;padding:var(--uil-xs) var(--uil-s)}.uil-button.uil-disabled{background-color:var(--uil-grey-dark);border:transparent;color:var(--uil-grey)}.uil-button.uil-small{font-size:var(--uil-font-small);line-height:var(--uil-font-small);padding:var(--uil-xxs) var(--uil-xs)}.uil-check-wrapper{align-items:center;display:flex;font-size:var(--uil-font-base);gap:var(--uil-s);line-height:var(--uil-font-base)}.uil-check-wrapper .uil-checkbox{border-radius:2px}.uil-svg-wrapper{display:flex;height:-moz-fit-content;height:fit-content;width:-moz-fit-content;width:fit-content}.uil-svg-wrapper .uil-svg{height:var(--uil-xxxl);width:var(--uil-xxxl)}.uil-input-wrapper{display:block;position:relative}.uil-input-wrapper .uil-label{background:linear-gradient(0deg,var(--uil-white) 9px,transparent 0);color:var(--uil-black);cursor:text;font-weight:700;left:var(--uil-xxs);opacity:.6;padding:0 var(--uil-xxxs);position:absolute;top:25%;transition:top .25s ease-in-out}.uil-input-wrapper .uil-input{background-color:var(--uil-white);border:1px solid var(--uil-black);border-radius:0;box-sizing:border-box;color:var(--uil-black);padding:var(--uil-xs);width:100%}.uil-input-wrapper .uil-input::-moz-placeholder{color:transparent;height:0;width:0}.uil-input-wrapper .uil-input::placeholder{color:transparent;height:0;width:0}.uil-input-wrapper .uil-input:focus{outline:1px solid var(--uil-outline-focus)}.uil-input-wrapper .uil-input:disabled{background-color:var(--uil-grey);border:2px solid var(--uil-outline-disabled);color:var(--uil-grey-dark);cursor:not-allowed}.uil-input-wrapper .uil-input:disabled~.uil-label{background:transparent;color:var(--uil-grey-dark);cursor:not-allowed}.uil-input-wrapper .uil-input:disabled~.uil-icon{fill:var(--uil-grey-dark);cursor:not-allowed}.uil-input-wrapper .uil-input:disabled:not(:-moz-placeholder-shown)~.uil-label{background:linear-gradient(0deg,var(--uil-grey) 8px,transparent 0)}.uil-input-wrapper .uil-input:disabled:not(:placeholder-shown)~.uil-label{background:linear-gradient(0deg,var(--uil-grey) 8px,transparent 0)}.uil-input-wrapper .uil-icon{fill:var(--uil-black);align-items:center;display:flex;justify-content:center;opacity:.5;position:absolute;right:var(--uil-xs);top:50%;transform:translateY(-50%)}.uil-input-wrapper .uil-input:not(:-moz-placeholder-shown)~.uil-label{opacity:1;top:-30%}.uil-input-wrapper .uil-input:focus~.uil-label,.uil-input-wrapper .uil-input:not(:placeholder-shown)~.uil-label{opacity:1;top:-30%}.uil-input-wrapper .uil-input:not(:-moz-placeholder-shown)~.uil-icon{opacity:1}.uil-input-wrapper .uil-input:focus~.uil-icon,.uil-input-wrapper .uil-input:not(:placeholder-shown)~.uil-icon{opacity:1}.uil-tooltip-wrapper{position:relative}.uil-tooltip-wrapper .uil-tooltip-icon{fill:var(--uil-black-alt);cursor:pointer;margin-bottom:var(--uil-xxs)}.uil-tooltip-wrapper .uil-tooltip-icon:has(~.uil-input-wrapper>.uil-input:not(:-moz-placeholder-shown),~.uil-input-wrapper:focus-within){opacity:0;-moz-transition:opacity .3s,visibility .3s;transition:opacity .3s,visibility .3s;visibility:hidden}.uil-tooltip-wrapper .uil-tooltip-icon:has(~.uil-input-wrapper>.uil-input:not(:placeholder-shown),~.uil-input-wrapper:focus-within){opacity:0;transition:opacity .3s,visibility .3s;visibility:hidden}.uil-tooltip-wrapper .uil-tooltip{background-color:rgba(34,34,34,.9);border-radius:3px;box-sizing:border-box;color:var(--uil-white);font-size:var(--uil-font-small);left:0;line-height:var(--uil-font-small);padding:var(--uil-s);position:absolute;top:0;width:100%;z-index:1}.uil-tooltip-wrapper .uil-tooltip .uil-tooltip-button{background-color:transparent;border:none;border-bottom:1px solid var(--uil-white);color:var(--uil-white);cursor:pointer;display:block;margin-bottom:var(--uil-m);margin-left:auto;padding:0}.uil-password-rules{display:flex;flex-direction:column;gap:var(--uil-xs);margin-left:var(--uil-xs);margin-top:var(--uil-m)}.uil-password-rules .uil-password-rule{align-items:center;display:flex;font-size:var(--uil-font-small);gap:var(--uil-xxs);line-height:var(--uil-font-small)}.uil-modal-wrapper{background-color:rgba(0,0,0,.5);height:100%;left:0;position:fixed;top:0;width:100%;z-index:99}.uil-modal-wrapper .uil-modal{border-radius:5px;box-shadow:0 0 6px 0 var(--uil-black);left:50%;position:absolute;top:30%;transform:translateX(-50%);width:95%;z-index:999}@media (min-width:1025px){.uil-modal-wrapper .uil-modal{width:75%}}@media (min-width:1250px){.uil-modal-wrapper .uil-modal{width:55%}}@media (min-width:1920px){.uil-modal-wrapper .uil-modal{width:35%}}.uil-modal-wrapper .uil-modal .uil-progress-wrapper{background-color:var(--uil-grey-alt)}.uil-modal-wrapper .uil-modal .uil-progress-wrapper .uil-progress-bar{animation-duration:2s;animation-iteration-count:1;animation-name:uil-progress;border:2px solid var(--uil-grey-dark)}@keyframes uil-progress{0%{width:100%}to{width:0}}.uil-modal-wrapper .uil-modal .uil-header{background-color:var(--uil-question);border-top-left-radius:3px;border-top-right-radius:3px;color:var(--uil-white);display:flex;font-size:var(--uil-xl);font-weight:700;justify-content:space-between;line-height:var(--uil-xl);margin:0;padding:var(--uil-s)}@media (min-width:1025px){.uil-modal-wrapper .uil-modal .uil-header{font-size:var(--uil-xxxl);line-height:var(--uil-xxxl);padding:var(--uil-m)}}.uil-modal-wrapper .uil-modal .uil-header.uil-success{background-color:var(--uil-success)}.uil-modal-wrapper .uil-modal .uil-header.uil-error{background-color:var(--uil-error)}.uil-modal-wrapper .uil-modal .uil-header.uil-warning{background-color:var(--uil-warning);color:var(--uil-black)}.uil-modal-wrapper .uil-modal .uil-content{background-color:var(--uil-white);border-bottom-left-radius:3px;border-bottom-right-radius:3px;display:flex;flex-direction:column;gap:var(--uil-m);padding:var(--uil-m)}@media (min-width:1025px){.uil-modal-wrapper .uil-modal .uil-content{gap:var(--uil-xxxl);padding:var(--uil-l)}}.uil-modal-wrapper .uil-modal .uil-content .uil-modal-text{color:var(--uil-black);font-size:var(--uil-font-small);line-height:var(--uil-font-small);margin:var(--uil-s) 0}@media (min-width:760px){.uil-modal-wrapper .uil-modal .uil-content .uil-modal-text{font-size:var(--uil-font-base);line-height:var(--uil-font-base)}}.uil-modal-wrapper .uil-modal .uil-content .uil-button-wrapper{display:flex;justify-content:space-between}.uil-modal-wrapper .uil-modal .uil-content .uil-button-wrapper.uil-single{justify-content:end}.uil-radio-title{display:block;font-size:var(--uil-xl);line-height:var(--uil-xl);margin-bottom:var(--uil-m)}.uil-radio-wrapper{display:flex;flex-direction:column;gap:var(--uil-m)}.uil-radio-wrapper .uil-radio-option{align-items:center;display:flex;gap:.25rem}.uil-radio-wrapper .uil-radio-option .uil-radio,.uil-radio-wrapper .uil-radio-option .uil-radio .uil-radio-check{border-radius:50%}.uil-fit{height:-moz-fit-content;height:fit-content;width:-moz-fit-content;width:fit-content}.uil-font-base{font-size:var(--uil-font-base);line-height:var(--uil-font-base)}.uil-check{border:2px solid var(--uil-black-alt);box-sizing:border-box;cursor:pointer;display:block;font-size:var(--uil-font-small);line-height:var(--uil-font-small);min-height:var(--uil-l);min-width:var(--uil-l);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.uil-check:has(input:disabled){background-color:var(--uil-grey);border-color:var(--uil-grey-dark)}.uil-check input{cursor:pointer;height:0;opacity:0;position:absolute;width:0}.uil-check input:checked~.uil-checkmark{transform:scale(1)}.uil-check input:disabled~.uil-checkmark{background-color:var(--uil-grey-dark)}.uil-check .uil-checkmark{background-color:var(--uil-black-alt);height:var(--uil-xs);left:25%;position:absolute;top:25%;transform:scale(0);transition:.1s ease;width:var(--uil-xs)}";const n=[];function u(e){l(()=>{const l=e.current?e.current.ownerDocument:document;if(void 0!==l&&!n.includes(l)){const e=l.createElement("style");e.innerHTML=o,n.push(l),l.head.appendChild(e)}},[])}function c(e){if(7!==e.length)throw new Error("provided hex color must be 7 characters (including #) long");e=e.substring(1,7);const l=[parseInt(e.substring(0,2),16)/255,parseInt(e.substring(2,4),16)/255,parseInt(e.substring(4,6),16)/255].map(e=>e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4));return.2126*l[0]+.7152*l[1]+.0722*l[2]>.179?"#000000":"#ffffff"}const s=["disabled","label","small","theme"];function p(l){const{disabled:r=!1,label:o,small:n=!1,theme:p}=l,d=a(l,s),m=i(null);return u(m),e.createElement("button",t({className:function(){const e="uil-button uil-fit";return r&&!n?`${e} uil-font-base uil-disabled`:r&&n?`${e} uil-disabled uil-small`:n?`${e} uil-small`:`${e} uil-font-base`}(),style:function(){if(!r&&p){if(p.includes("#"))return{color:c(p),backgroundColor:p,border:"transparent"};switch(p){case"success":return{color:c("#006A4E"),backgroundColor:"#006A4E",border:"transparent"};case"warning":return{color:"#000000",backgroundColor:"#FFD700",border:"transparent"};case"error":return{color:c("#800020"),backgroundColor:"#800020",border:"transparent"};default:throw new Error("invalid theme provided")}}}(),disabled:r},d,{ref:m}),o)}const d=["checkColor","checked","toggleCheck","label","children"];function m(l){const{checkColor:r,checked:o,toggleCheck:n,label:c,children:s}=l,p=a(l,d),m=i(null);return u(m),e.createElement("div",{className:"uil-check-wrapper",ref:m},e.createElement("label",{className:"uil-checkbox uil-check"},e.createElement("input",t({type:"checkbox",checked:o,onChange:()=>{n(!o)}},p)),e.createElement("div",{className:"uil-checkmark",style:{backgroundColor:r}})),s||e.createElement("span",{onClick:()=>n(!o),style:{cursor:"pointer",userSelect:"none"}},c))}function h(l){const{src:r,color:t,height:a,width:o}=l;if(!r.includes(".svg"))throw new Error("Provided src is not an svg image");const n=i(null);return u(n),e.createElement("div",{ref:n,className:"uil-svg-wrapper"},e.createElement("svg",{"aria-hidden":!0,className:"uil-svg",style:{fill:t,height:`${a}px`,width:`${o}px`}},e.createElement("use",{href:r})))}const b=["iconColor","iconSrc","inputColor","label","toggle","valueChanged"];function g(l){const{iconColor:r,iconSrc:o,inputColor:n,label:c,toggle:s,valueChanged:p}=l,d=a(l,b),m=i(null);return u(m),e.createElement("label",{className:"uil-input-wrapper",htmlFor:d.id,ref:m},e.createElement("input",t({className:"uil-input uil-font-base",onChange:e=>p(e.target.value),placeholder:c,style:{color:n}},d)),o&&e.createElement("div",{className:"uil-icon",onClick:s},e.createElement(h,{src:o,width:24,height:24,color:r})),e.createElement("span",{className:"uil-label uil-font-base",style:{color:n}},c))}function f(e){const r=i(null);return l(()=>{if(r.current)return document.addEventListener("click",l),document.addEventListener("touchend",l),()=>{document.removeEventListener("click",l),document.removeEventListener("touchend",l)};function l(l){r.current&&!r.current.contains(l.target)&&e()}},[e]),r}const v=["tooltipClose","tooltipIcon","tooltipText"];function w(l){const{tooltipClose:i,tooltipIcon:o,tooltipText:n}=l,u=a(l,v),[c,s]=r(!1),p=f(d);function d(){s(!1)}return e.createElement(e.Fragment,null,o?e.createElement("div",{className:"uil-tooltip-wrapper",ref:p},c&&e.createElement("div",{className:"uil-tooltip"},i&&e.createElement("button",{className:"uil-tooltip-button uil-fit",onClick:d},i),e.createElement("span",null,n)),e.createElement("div",{className:"uil-tooltip-icon uil-fit",onClick:()=>s(!c)},e.createElement(h,{src:o,height:16,width:16})),e.createElement(g,t({},u))):e.createElement(g,t({},u)))}var k;!function(e){e[e.minLength=1]="minLength",e[e.maxLength=2]="maxLength",e[e.letters=3]="letters",e[e.numbers=4]="numbers",e[e.special=5]="special",e[e.upper=6]="upper"}(k||(k={}));const x=["capsLockWarning","rules","ruleChecked","ruleUnchecked","setFailedRules"];function y(i){const{capsLockWarning:o,rules:n,ruleChecked:u,ruleUnchecked:c,setFailedRules:s}=i,p=a(i,x),[d,m]=r(!1);function b(e){let l;if(e.type){if(!e.count)throw new Error("count must not be empty if a type is provided");switch(e.type){case k.minLength:l=`[a-zA-Z0-9ßÄäÖöÜü._!"\`'#%&§,:;<>=@{}~\\$\\(\\)\\*\\+\\/\\\\\\?\\[\\]\\^\\|\\-]{${e.count},}`;break;case k.maxLength:l=`^[a-zA-Z0-9ßÄäÖöÜü._!"\`'#%&,:;<>=@{}~\\$\\(\\)\\*\\+\\/\\\\\\?\\[\\]\\^\\|\\-]{0,${e.count}}$`;break;case k.letters:l=`[a-zA-ZßÄäÖöÜü]{${e.count},}`;break;case k.numbers:l=`[0-9]{${e.count},}`;break;case k.special:l=`[._!"\`'#%&§,:;<>=@{}~\\$\\(\\)\\*\\+\\/\\\\\\?\\[\\]\\^\\|\\-]{${e.count},}`;break;case k.upper:l=`[A-ZÄÖÜ]{${e.count},}`;break;default:throw new Error("unrecognized rule type provided")}}else l=e.pattern?e.pattern:"";if(""===l)throw new Error("pattern must not be an empty string");return new RegExp(l).test(i.value)}return l(()=>{!function(){const e=[];n.forEach(l=>{b(l)||e.push(l)}),null==s||s(e)}()},[i.value]),l(()=>{if(o)return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e);function e(e){m(null==e.getModifierState?void 0:e.getModifierState("CapsLock"))}},[]),e.createElement(e.Fragment,null,e.createElement(w,t({},p)),e.createElement("div",{className:"uil-password-rules"},d&&e.createElement("div",{className:"uil-password-rule"},o),n.map((l,i)=>e.createElement("div",{key:i,className:"uil-password-rule"},e.createElement(h,{src:b(l)?u:c,height:12,width:12}),e.createElement("span",null,l.label)))))}var E;function C(r){const{callback:t,cancelLabel:a="",close:o,closeLabel:n,confirm:c,confirmLabel:s="",message:d,timeout:m,title:h,type:b}=r;let g;const f=i(null);return u(f),l(()=>{if(m)return g=setTimeout(()=>t?t():o(),m),()=>clearTimeout(g)},[]),e.createElement("div",{className:"uil-modal-wrapper",ref:f},e.createElement("div",{className:"uil-modal"},e.createElement("div",{className:function(){const e="uil-header";switch(b){case E.error:return`${e} uil-error`;case E.success:return`${e} uil-success`;case E.warning:return`${e} uil-warning`;default:return e}}()},h),m&&e.createElement("div",{className:"uil-progress-wrapper"},e.createElement("div",{className:"uil-progress-bar",style:{animationDuration:m/1e3+.5+"s"}})),e.createElement("div",{className:"uil-content"},e.createElement("div",null,Array.isArray(d)?d.map((l,i)=>e.createElement("p",{key:i,className:"uil-modal-text"},l)):e.createElement("p",{className:"uil-modal-text"},d)),e.createElement("div",{className:"uil-button-wrapper "+(b!==E.question?"uil-single":"")},b!==E.question&&e.createElement(p,{label:null!=n?n:"",onClick:function(){clearTimeout(g),m&&t?t():o()},type:"button"}),b==E.question&&r.confirm&&e.createElement(e.Fragment,null,e.createElement(p,{label:s,theme:"#00416A",onClick:c,type:"button"}),e.createElement(p,{label:a,onClick:o,type:"button"}))))))}!function(e){e.error="error",e.question="question",e.success="success",e.warning="warning"}(E||(E={}));const z=["modalType"];function N(l){const{modalType:i}=l,r=a(l,z);return e.createElement(C,t({type:i},r))}const $=["cancel"];function L(l){const{cancel:i}=l,r=a(l,$);return e.createElement(C,t({type:E.question,close:i},r))}function A(r){const{checkColor:t,disabled:a,label:o,options:n,value:c,valueChanged:s}=r,p=i(null);function d(e){c!==e&&s(e)}return u(p),l(()=>{n.forEach(e=>{e.checked&&d(e.value)})},[]),e.createElement("div",{ref:p},o&&e.createElement("div",{className:"uil-radio-title"},o),e.createElement("div",{className:"uil-radio-wrapper"},n.map((l,i)=>{return e.createElement("div",{key:(r=i,`${r}-${(new Date).getTime()}`),className:"uil-radio-option"},e.createElement("label",{className:"uil-radio uil-check"},e.createElement("input",{name:l.label,type:"radio",value:l.value,checked:c===l.value||""===c&&l.checked,onChange:()=>d(l.value),disabled:a||l.disabled}),e.createElement("div",{className:"uil-checkmark uil-radio-check",style:{backgroundColor:t}})),e.createElement("span",{className:"uil-font-base"},l.label));var r})))}export{p as CustomButton,m as CustomCheckBox,w as CustomInput,A as CustomRadio,N as NotifyModal,y as PasswordInput,k as PasswordRuleTypes,L as QuestionModal,h as SVG,f as useClickOutsideRef,c as useGetColor};
|
|
2
|
+
//# sourceMappingURL=bundle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bundle.js","sources":["../src/utils/useInjectStyles.ts","../src/hooks/getColor.ts","../src/components/button/customButton.tsx","../src/components/checkbox/customCheckBox.tsx","../src/components/images/svgIcon.tsx","../src/components/input/baseInput.tsx","../src/hooks/clickOutside.ts","../src/components/input/customInput.tsx","../src/enums/passwordRuleTypes.ts","../src/components/input/passwordInput.tsx","../src/enums/modalType.ts","../src/components/modal/baseModal.tsx","../src/components/modal/notifyModal.tsx","../src/components/modal/questionModal.tsx","../src/components/radio/customRadio.tsx","../src/utils/generateKey.ts"],"sourcesContent":["import {RefObject, useEffect} from \"react\";\nimport styles from \"./styles.scss\";\n\nconst injectedStyles: Document[] = [];\n\nexport default function useInjectStyleSheet(nodeRef: RefObject<HTMLElement>): void {\n useEffect(() => {\n const parentDocument = nodeRef.current ? nodeRef.current.ownerDocument : document;\n\n if (typeof parentDocument !== \"undefined\" && !injectedStyles.includes(parentDocument)) {\n const styleElement = parentDocument.createElement(\"style\");\n\n styleElement.innerHTML = styles;\n injectedStyles.push(parentDocument);\n\n parentDocument.head.appendChild(styleElement);\n }\n }, []);\n}","export function useGetColor(backgroundColor: string) {\n if (backgroundColor.length !== 7) throw new Error('provided hex color must be 7 characters (including #) long');\n\n backgroundColor = backgroundColor.substring(1, 7);\n const uiColors = [\n parseInt(backgroundColor.substring(0, 2), 16) / 255,\n parseInt(backgroundColor.substring(2, 4), 16) / 255,\n parseInt(backgroundColor.substring(4, 6), 16) / 255\n ];\n const c = uiColors.map(col => {\n return col <= 0.03928? (col / 12.92) : Math.pow((col + 0.055) / 1.055, 2.4);\n });\n const contrast = (0.2126 * c[0]) + (0.7152 * c[1]) + (0.0722 * c[2]);\n\n return contrast > 0.179 ? '#000000' : '#ffffff';\n}","import React, {ComponentPropsWithoutRef, CSSProperties, useRef} from 'react';\nimport useInjectStyleSheet from \"utils/useInjectStyles\";\nimport {useGetColor} from 'hooks/getColor';\n\ntype HEXColor = `#${string}`\n\ninterface ICustomButton extends ComponentPropsWithoutRef<'button'> {\n label : string;\n disabled?: boolean;\n small? : boolean;\n theme? : HEXColor | 'success' | 'warning' | 'error';\n}\n\nexport function CustomButton(props: ICustomButton) {\n const {\n disabled = false,\n label,\n small = false,\n theme,\n ...buttonProps\n } = props;\n\n const nodeRef = useRef<HTMLButtonElement>(null);\n useInjectStyleSheet(nodeRef);\n\n function getStyle(): CSSProperties | undefined {\n if (disabled || !theme) return undefined;\n\n if (theme.includes('#')) {\n return {\n color: useGetColor(theme),\n backgroundColor: theme,\n border: 'transparent'\n };\n }\n\n switch (theme) {\n case 'success':\n return {\n color: useGetColor('#006A4E'),\n backgroundColor: '#006A4E',\n border: 'transparent'\n };\n case 'warning':\n return {\n color: '#000000',\n backgroundColor: '#FFD700',\n border: 'transparent'\n };\n case 'error':\n return {\n color: useGetColor('#800020'),\n backgroundColor: '#800020',\n border: 'transparent'\n };\n default:\n throw new Error('invalid theme provided')\n }\n }\n\n function getClassName(): string {\n const base = 'uil-button uil-fit'\n\n if (disabled && !small) {\n return `${base} uil-font-base uil-disabled`;\n }\n\n if (disabled && small) {\n return `${base} uil-disabled uil-small`;\n }\n\n if (small) {\n return `${base} uil-small`;\n }\n\n return `${base} uil-font-base`;\n }\n\n return (\n <button className={getClassName()} style={getStyle()} disabled={disabled} {...buttonProps} ref={nodeRef}>\n {label}\n </button>\n );\n}","import React, {ComponentPropsWithoutRef, ReactNode, useRef} from 'react';\nimport useInjectStyleSheet from \"utils/useInjectStyles\";\n\ninterface ICustomCheckbox extends ComponentPropsWithoutRef<'input'> {\n checked : boolean;\n label? : string;\n toggleCheck : (value: boolean) => void;\n checkColor? : string;\n children? : ReactNode;\n}\n\nexport function CustomCheckBox(props: ICustomCheckbox) {\n const {\n checkColor,\n checked,\n toggleCheck,\n label,\n children,\n ...checkProps\n } = props;\n\n const nodeRef = useRef<HTMLDivElement>(null);\n useInjectStyleSheet(nodeRef);\n\n return (\n <div className={'uil-check-wrapper'} ref={nodeRef}>\n <label className={'uil-checkbox uil-check'}>\n <input type={'checkbox'} checked={checked} onChange={() => {toggleCheck(!checked)}} {...checkProps}/>\n <div className={'uil-checkmark'} style={{backgroundColor: checkColor}}/>\n </label>\n\n {children ? children : <span onClick={() => toggleCheck(!checked)} style={{cursor: 'pointer', userSelect: 'none'}}>{label}</span>}\n </div>\n );\n}","import React, {ComponentPropsWithoutRef, CSSProperties, useRef} from 'react';\nimport useInjectStyleSheet from \"utils/useInjectStyles\";\n\ninterface ISvgIcon extends ComponentPropsWithoutRef<'svg'>{\n src : string;\n color? : string | undefined;\n height?: number;\n width? : number;\n}\n\nexport function SVG(props: ISvgIcon) {\n const {\n src,\n color,\n height,\n width\n } = props;\n\n if (!src.includes('.svg')) {\n throw new Error('Provided src is not an svg image');\n }\n\n const nodeRef = useRef<HTMLDivElement>(null);\n useInjectStyleSheet(nodeRef);\n\n const style: CSSProperties = {\n fill: color,\n height: `${height}px`,\n width: `${width}px`\n }\n\n return (\n <div ref={nodeRef} className={'uil-svg-wrapper'}>\n <svg aria-hidden={true} className={'uil-svg'} style={style}>\n <use href={src}/>\n </svg>\n </div>\n );\n}","import React, {ComponentPropsWithoutRef, useRef} from 'react';\nimport {SVG} from 'components/images/svgIcon';\nimport useInjectStyleSheet from \"../../utils/useInjectStyles\";\n\nexport interface IBaseInput extends ComponentPropsWithoutRef<'input'> {\n label : string;\n value : string;\n valueChanged: (value: string) => void;\n iconColor? : string;\n iconSrc? : string;\n inputColor? : string;\n toggle? : () => void;\n}\n\nexport function BaseInput(props: IBaseInput) {\n const {\n iconColor,\n iconSrc,\n inputColor,\n label,\n toggle,\n valueChanged,\n ...inputProps\n } = props;\n\n const nodeRef = useRef<HTMLLabelElement>(null);\n useInjectStyleSheet(nodeRef);\n\n return (\n <label className={'uil-input-wrapper'} htmlFor={inputProps.id} ref={nodeRef}>\n <input\n className={'uil-input uil-font-base'}\n onChange={(e) => valueChanged(e.target.value)}\n placeholder={label}\n style={{color: inputColor}}\n {...inputProps}\n />\n\n {iconSrc &&\n <div className={'uil-icon'} onClick={toggle}>\n <SVG src={iconSrc} width={24} height={24} color={iconColor}/>\n </div>\n }\n\n <span className={'uil-label uil-font-base'} style={{color: inputColor}}>{label}</span>\n </label>\n );\n}","import {useEffect, useRef} from 'react';\n\nexport function useClickOutsideRef<T extends HTMLElement>(callback: () => void) {\n const ref = useRef<T>(null);\n\n useEffect(() => {\n if (!ref.current) return;\n\n function handleClickOutside (event: MouseEvent | TouchEvent) {\n if (ref.current && !ref.current.contains(event.target as Node)) {\n callback();\n }\n }\n\n document.addEventListener('click', handleClickOutside);\n document.addEventListener('touchend', handleClickOutside);\n\n return () => {\n document.removeEventListener('click', handleClickOutside);\n document.removeEventListener('touchend', handleClickOutside);\n };\n }, [callback]);\n\n return ref;\n}","import React, {useState} from 'react';\nimport {BaseInput, IBaseInput} from './baseInput';\nimport {SVG} from 'components/images/svgIcon';\nimport {useClickOutsideRef} from 'hooks/clickOutside';\n\nexport interface ICustomInput extends IBaseInput {\n tooltipClose?: string;\n tooltipIcon? : string;\n tooltipText? : string;\n}\n\nexport function CustomInput(props: ICustomInput) {\n const {\n tooltipClose,\n tooltipIcon,\n tooltipText,\n ...inputProps\n } = props;\n\n const [tooltipVisible, setTooltipVisible] = useState(false);\n const ref = useClickOutsideRef<HTMLDivElement>(closeTooltip);\n\n function closeTooltip() {\n setTooltipVisible(false);\n }\n\n return (\n <>\n {tooltipIcon ?\n <div className={'uil-tooltip-wrapper'} ref={ref}>\n {tooltipVisible &&\n <div className={'uil-tooltip'}>\n {tooltipClose &&\n <button className={'uil-tooltip-button uil-fit'} onClick={closeTooltip}>\n {tooltipClose}\n </button>\n }\n\n <span>{tooltipText}</span>\n </div>\n }\n\n <div className={'uil-tooltip-icon uil-fit'} onClick={() => setTooltipVisible(!tooltipVisible)}>\n <SVG src={tooltipIcon} height={16} width={16}/>\n </div>\n\n <BaseInput {...inputProps}/>\n </div> :\n\n <BaseInput {...inputProps}/>\n }\n </>\n );\n}","export enum PasswordRuleTypes {\n minLength = 1,\n maxLength,\n letters,\n numbers,\n special,\n upper\n}","import React, {useEffect, useState} from 'react';\nimport {CustomInput, ICustomInput} from './customInput';\nimport {SVG} from 'components/images/svgIcon';\nimport {PasswordRuleTypes} from 'enums/passwordRuleTypes';\n\ninterface IPasswordInput extends ICustomInput {\n ruleChecked : string;\n rules : PasswordRule[];\n ruleUnchecked : string;\n capsLockWarning?: string;\n setFailedRules? : (value: PasswordRule[]) => void;\n}\n\nexport interface PasswordRule {\n label : string;\n count? : number;\n type? : PasswordRuleTypes;\n pattern?: string;\n}\n\nexport function PasswordInput(props: IPasswordInput) {\n const {\n capsLockWarning,\n rules,\n ruleChecked,\n ruleUnchecked,\n setFailedRules,\n ...inputProps\n } = props;\n\n const [capsLock, setCapsLock] = useState(false);\n\n useEffect(() => {\n validateInput();\n }, [props.value]);\n\n useEffect(() => {\n if (!capsLockWarning) return;\n\n function setCapsLockState(event: globalThis.KeyboardEvent) {\n setCapsLock(event.getModifierState?.('CapsLock'));\n }\n\n document.addEventListener('keydown', setCapsLockState);\n\n return () => document.removeEventListener('keydown', setCapsLockState);\n }, []);\n\n function validateInput() {\n const failedRules: PasswordRule[] = [];\n\n rules.forEach(rule => {\n if (!checkRule(rule)) {\n failedRules.push(rule);\n }\n });\n\n setFailedRules?.(failedRules);\n }\n\n function checkRule(rule: PasswordRule): boolean {\n let pattern: string;\n\n if (rule.type) {\n if (!rule.count) throw new Error('count must not be empty if a type is provided');\n\n switch (rule.type) {\n case PasswordRuleTypes.minLength:\n pattern = `[a-zA-Z0-9ßÄäÖöÜü._!\"\\`'#%&§,:;<>=@{}~\\\\$\\\\(\\\\)\\\\*\\\\+\\\\/\\\\\\\\\\\\?\\\\[\\\\]\\\\^\\\\|\\\\-]{${rule.count},}`;\n break;\n case PasswordRuleTypes.maxLength:\n pattern = `^[a-zA-Z0-9ßÄäÖöÜü._!\"\\`'#%&,:;<>=@{}~\\\\$\\\\(\\\\)\\\\*\\\\+\\\\/\\\\\\\\\\\\?\\\\[\\\\]\\\\^\\\\|\\\\-]{0,${rule.count}}$`;\n break;\n case PasswordRuleTypes.letters:\n pattern = `[a-zA-ZßÄäÖöÜü]{${rule.count},}`;\n break;\n case PasswordRuleTypes.numbers:\n pattern = `[0-9]{${rule.count},}`;\n break;\n case PasswordRuleTypes.special:\n pattern = `[._!\"\\`'#%&§,:;<>=@{}~\\\\$\\\\(\\\\)\\\\*\\\\+\\\\/\\\\\\\\\\\\?\\\\[\\\\]\\\\^\\\\|\\\\-]{${rule.count},}`;\n break;\n case PasswordRuleTypes.upper:\n pattern = `[A-ZÄÖÜ]{${rule.count},}`;\n break;\n default:\n throw new Error('unrecognized rule type provided');\n }\n } else {\n pattern = rule.pattern ? rule.pattern : '';\n }\n\n if (pattern === '') throw new Error('pattern must not be an empty string');\n\n const reg = new RegExp(pattern);\n return reg.test(props.value);\n }\n\n return (\n <>\n <CustomInput {...inputProps}/>\n\n <div className={'uil-password-rules'}>\n {capsLock &&\n <div className={'uil-password-rule'}>{capsLockWarning}</div>\n }\n\n {rules.map((rule, idx) =>\n <div key={idx} className={'uil-password-rule'}>\n <SVG src={checkRule(rule) ? ruleChecked : ruleUnchecked} height={12} width={12}/>\n\n <span>{rule.label}</span>\n </div>\n )}\n </div>\n </>\n );\n}","export enum ModalType {\n error = 'error',\n question = 'question',\n success = 'success',\n warning = 'warning',\n}","import React, {useEffect, useRef} from 'react';\nimport {ModalType} from 'enums/modalType';\nimport {CustomButton} from 'components/button/customButton';\nimport useInjectStyleSheet from \"utils/useInjectStyles\";\n\ninterface IBaseModal {\n close : () => void;\n message : string | string[];\n title : string;\n type : ModalType;\n callback? : (() => void) | undefined;\n cancelLabel? : string;\n closeLabel? : string;\n confirm? : () => void;\n confirmLabel?: string;\n timeout? : number;\n}\n\nexport function BaseModal(props: IBaseModal) {\n const {\n callback,\n cancelLabel = '',\n close,\n closeLabel,\n confirm,\n confirmLabel = '',\n message,\n timeout,\n title,\n type\n } = props;\n\n let timer: NodeJS.Timeout | undefined = undefined;\n const nodeRef = useRef<HTMLDivElement>(null);\n useInjectStyleSheet(nodeRef);\n\n useEffect(() => {\n if (!timeout) return;\n\n timer = setTimeout(() => {\n return callback ? callback() : close();\n }, timeout);\n\n return () => clearTimeout(timer);\n },[]);\n\n function setHeaderClass() {\n const base = 'uil-header';\n\n switch (type) {\n case ModalType.error:\n return `${base} uil-error`;\n case ModalType.success:\n return `${base} uil-success`;\n case ModalType.warning:\n return `${base} uil-warning`;\n default:\n return base;\n }\n }\n\n //run callback if timeout and callback are set, otherwise close\n function handleClose() {\n clearTimeout(timer);\n timeout && callback ? callback() : close();\n }\n\n return (\n <div className={'uil-modal-wrapper'} ref={nodeRef}>\n <div className={'uil-modal'}>\n <div className={setHeaderClass()}>\n {title}\n </div>\n\n {timeout &&\n <div className={'uil-progress-wrapper'}>\n <div className={'uil-progress-bar'} style={{animationDuration: `${(timeout / 1000) + .5}s`}}/>\n </div>\n }\n\n <div className={'uil-content'}>\n <div>\n {Array.isArray(message) ?\n message.map((m, idx) => <p key={idx} className={'uil-modal-text'}>{m}</p>)\n : <p className={'uil-modal-text'}>{message}</p>\n }\n </div>\n\n <div className={`uil-button-wrapper ${type !== ModalType.question ? 'uil-single' : ''}`}>\n {type !== ModalType.question &&\n <CustomButton label={closeLabel?? ''} onClick={handleClose} type={'button'}/>\n }\n\n {type == ModalType.question && props.confirm &&\n <>\n <CustomButton label={confirmLabel} theme={'#00416A'} onClick={confirm} type={'button'}/>\n <CustomButton label={cancelLabel} onClick={close} type={'button'}/>\n </>\n }\n </div>\n </div>\n </div>\n </div>\n );\n}","import React from 'react';\nimport {BaseModal} from './baseModal';\nimport {ModalType} from 'enums/modalType';\n\nexport interface INotifyModal {\n close : () => void;\n closeLabel: string;\n modalType : 'success' | 'warning' | 'error';\n message : string | string[];\n title : string;\n callback? : (() => void) | undefined;\n timeout? : number;\n}\n\nexport function NotifyModal(props: INotifyModal) {\n const {\n modalType,\n ...modalProps\n } = props;\n\n return (\n <BaseModal type={modalType as ModalType} {...modalProps}/>\n );\n}","import React from 'react';\nimport {BaseModal} from './baseModal';\nimport {ModalType} from 'enums/modalType';\n\nexport interface IQuestionModal {\n cancel : () => void;\n cancelLabel : string;\n confirm : () => void;\n confirmLabel: string;\n message : string | string[];\n title : string;\n}\n\nexport function QuestionModal(props: IQuestionModal) {\n const {\n cancel,\n ...modalProps\n } = props;\n\n return (\n <BaseModal type={ModalType.question} close={cancel} {...modalProps}/>\n );\n}","import React, {useEffect, useRef} from 'react';\nimport generateKey from 'utils/generateKey';\nimport useInjectStyleSheet from \"utils/useInjectStyles\";\n\ninterface ICustomRadio {\n options : RadioOption[];\n value : string;\n valueChanged: (value: string) => void;\n checkColor? : string;\n disabled? : boolean;\n label? : string;\n}\n\nexport interface RadioOption {\n label : string;\n value : string;\n checked? : boolean;\n disabled?: boolean;\n}\n\nexport function CustomRadio(props: ICustomRadio) {\n const {\n checkColor,\n disabled,\n label,\n options,\n value,\n valueChanged,\n } = props;\n\n const nodeRef = useRef<HTMLDivElement>(null);\n useInjectStyleSheet(nodeRef);\n\n useEffect(() => {\n // prevents multiple radio options being checked at the same time\n options.forEach(option => {\n if (option.checked) handleRadioChange(option.value);\n });\n },[]);\n\n function handleRadioChange(newValue: string) {\n if (value === newValue) return;\n\n valueChanged(newValue);\n }\n\n return (\n <div ref={nodeRef}>\n {label && <div className={'uil-radio-title'}>{label}</div>}\n\n <div className={'uil-radio-wrapper'}>\n {options.map((option, idx) =>\n <div key={generateKey(idx)} className={'uil-radio-option'}>\n <label className={'uil-radio uil-check'}>\n <input\n name={option.label}\n type={'radio'}\n value={option.value}\n checked={value === option.value || value === '' && option.checked}\n onChange={() => handleRadioChange(option.value)}\n disabled={disabled? disabled : option.disabled}\n />\n <div className={'uil-checkmark uil-radio-check'} style={{backgroundColor: checkColor}}/>\n </label>\n\n <span className={'uil-font-base'}>{option.label}</span>\n </div>\n )}\n </div>\n </div>\n );\n}","export default function generateKey(prefix: string | number) {\n return `${prefix}-${new Date().getTime()}`;\n}"],"names":["injectedStyles","useInjectStyleSheet","nodeRef","useEffect","parentDocument","current","ownerDocument","document","includes","styleElement","createElement","innerHTML","styles","push","head","appendChild","useGetColor","backgroundColor","length","Error","substring","c","parseInt","map","col","Math","pow","_excluded","CustomButton","props","disabled","label","small","theme","buttonProps","_objectWithoutPropertiesLoose","useRef","React","_extends","className","base","getClassName","style","color","border","getStyle","ref","CustomCheckBox","checkColor","checked","toggleCheck","children","checkProps","type","onChange","onClick","cursor","userSelect","SVG","src","height","width","fill","href","BaseInput","iconColor","iconSrc","inputColor","toggle","valueChanged","inputProps","htmlFor","id","e","target","value","placeholder","useClickOutsideRef","callback","addEventListener","handleClickOutside","removeEventListener","event","contains","CustomInput","tooltipClose","tooltipIcon","tooltipText","tooltipVisible","setTooltipVisible","useState","closeTooltip","Fragment","PasswordRuleTypes","PasswordInput","capsLockWarning","rules","ruleChecked","ruleUnchecked","setFailedRules","capsLock","setCapsLock","checkRule","rule","pattern","count","minLength","maxLength","letters","numbers","special","upper","RegExp","test","failedRules","forEach","validateInput","setCapsLockState","getModifierState","idx","key","ModalType","BaseModal","cancelLabel","close","closeLabel","confirm","confirmLabel","message","timeout","title","timer","setTimeout","clearTimeout","error","success","warning","setHeaderClass","animationDuration","Array","isArray","m","question","NotifyModal","modalType","modalProps","QuestionModal","cancel","CustomRadio","options","handleRadioChange","newValue","option","prefix","Date","getTime","name"],"mappings":"2pRAGA,MAAMA,EAA6B,GAEX,SAAAC,EAAoBC,GAC1CC,EAAU,KACR,MAAMC,EAAiBF,EAAQG,QAAUH,EAAQG,QAAQC,cAAgBC,SAEzE,QAA8B,IAAnBH,IAAmCJ,EAAeQ,SAASJ,GAAiB,CACrF,MAAMK,EAAeL,EAAeM,cAAc,SAElDD,EAAaE,UAAYC,EACzBZ,EAAea,KAAKT,GAEpBA,EAAeU,KAAKC,YAAYN,EAClC,GACC,GACL,UClBgBO,EAAYC,GAC1B,GAA+B,IAA3BA,EAAgBC,OAAc,UAAUC,MAAM,8DAElDF,EAAkBA,EAAgBG,UAAU,EAAG,GAC/C,MAKMC,EALW,CACfC,SAASL,EAAgBG,UAAU,EAAG,GAAI,IAAM,IAChDE,SAASL,EAAgBG,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EAAOzH,MACbsB,KAAM,QACNsB,MAAO6E,EAAO7E,MACd1B,QAAS0B,IAAU6E,EAAO7E,OAAmB,KAAVA,GAAgB6E,EAAOvG,QAC1DK,SAAUA,IAAMgG,EAAkBE,EAAO7E,OACzC7C,SAAUA,GAAqB0H,EAAO1H,WAExCO,EAAA3B,cAAA,MAAA,CAAK6B,UAAW,gCAAiCG,MAAO,CAACzB,gBAAiB+B,MAG5EX,EAAA3B,cAAA,OAAA,CAAM6B,UAAW,iBAAkBiH,EAAOzH,QCjE9B,IAAY0H,CDkEpB,IAKhB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
type HEXColor = `#${string}`;
|
|
3
|
+
interface ICustomButton extends ComponentPropsWithoutRef<'button'> {
|
|
4
|
+
label: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
small?: boolean;
|
|
7
|
+
theme?: HEXColor | 'success' | 'warning' | 'error';
|
|
8
|
+
}
|
|
9
|
+
export declare function CustomButton(props: ICustomButton): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './customButton';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef, ReactNode } from 'react';
|
|
2
|
+
interface ICustomCheckbox extends ComponentPropsWithoutRef<'input'> {
|
|
3
|
+
checked: boolean;
|
|
4
|
+
label?: string;
|
|
5
|
+
toggleCheck: (value: boolean) => void;
|
|
6
|
+
checkColor?: string;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function CustomCheckBox(props: ICustomCheckbox): React.JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './customCheckBox';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './svgIcon';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
interface ISvgIcon extends ComponentPropsWithoutRef<'svg'> {
|
|
3
|
+
src: string;
|
|
4
|
+
color?: string | undefined;
|
|
5
|
+
height?: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function SVG(props: ISvgIcon): React.JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
export interface IBaseInput extends ComponentPropsWithoutRef<'input'> {
|
|
3
|
+
label: string;
|
|
4
|
+
value: string;
|
|
5
|
+
valueChanged: (value: string) => void;
|
|
6
|
+
iconColor?: string;
|
|
7
|
+
iconSrc?: string;
|
|
8
|
+
inputColor?: string;
|
|
9
|
+
toggle?: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function BaseInput(props: IBaseInput): React.JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IBaseInput } from './baseInput';
|
|
3
|
+
export interface ICustomInput extends IBaseInput {
|
|
4
|
+
tooltipClose?: string;
|
|
5
|
+
tooltipIcon?: string;
|
|
6
|
+
tooltipText?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function CustomInput(props: ICustomInput): React.JSX.Element;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ICustomInput } from './customInput';
|
|
3
|
+
import { PasswordRuleTypes } from 'enums/passwordRuleTypes';
|
|
4
|
+
interface IPasswordInput extends ICustomInput {
|
|
5
|
+
ruleChecked: string;
|
|
6
|
+
rules: PasswordRule[];
|
|
7
|
+
ruleUnchecked: string;
|
|
8
|
+
capsLockWarning?: string;
|
|
9
|
+
setFailedRules?: (value: PasswordRule[]) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface PasswordRule {
|
|
12
|
+
label: string;
|
|
13
|
+
count?: number;
|
|
14
|
+
type?: PasswordRuleTypes;
|
|
15
|
+
pattern?: string;
|
|
16
|
+
}
|
|
17
|
+
export declare function PasswordInput(props: IPasswordInput): React.JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ModalType } from 'enums/modalType';
|
|
3
|
+
interface IBaseModal {
|
|
4
|
+
close: () => void;
|
|
5
|
+
message: string | string[];
|
|
6
|
+
title: string;
|
|
7
|
+
type: ModalType;
|
|
8
|
+
callback?: (() => void) | undefined;
|
|
9
|
+
cancelLabel?: string;
|
|
10
|
+
closeLabel?: string;
|
|
11
|
+
confirm?: () => void;
|
|
12
|
+
confirmLabel?: string;
|
|
13
|
+
timeout?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function BaseModal(props: IBaseModal): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface INotifyModal {
|
|
3
|
+
close: () => void;
|
|
4
|
+
closeLabel: string;
|
|
5
|
+
modalType: 'success' | 'warning' | 'error';
|
|
6
|
+
message: string | string[];
|
|
7
|
+
title: string;
|
|
8
|
+
callback?: (() => void) | undefined;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function NotifyModal(props: INotifyModal): React.JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface IQuestionModal {
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
cancelLabel: string;
|
|
5
|
+
confirm: () => void;
|
|
6
|
+
confirmLabel: string;
|
|
7
|
+
message: string | string[];
|
|
8
|
+
title: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function QuestionModal(props: IQuestionModal): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface ICustomRadio {
|
|
3
|
+
options: RadioOption[];
|
|
4
|
+
value: string;
|
|
5
|
+
valueChanged: (value: string) => void;
|
|
6
|
+
checkColor?: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
label?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RadioOption {
|
|
11
|
+
label: string;
|
|
12
|
+
value: string;
|
|
13
|
+
checked?: boolean;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function CustomRadio(props: ICustomRadio): React.JSX.Element;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './customRadio';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './passwordRuleTypes';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useClickOutsideRef<T extends HTMLElement>(callback: () => void): import("react").RefObject<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGetColor(backgroundColor: string): "#000000" | "#ffffff";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from './clickOutside';
|
|
2
|
-
export * from './getColor';
|
|
2
|
+
export * from './getColor';
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { CustomButton } from './components/button/index';
|
|
2
|
+
export { CustomCheckBox } from './components/checkbox/index';
|
|
3
|
+
export { SVG } from './components/images/index';
|
|
4
|
+
export { CustomInput, PasswordInput, PasswordRule } from './components/input/index';
|
|
5
|
+
export { NotifyModal, QuestionModal } from './components/modal/index';
|
|
6
|
+
export { CustomRadio, RadioOption } from './components/radio/index';
|
|
7
|
+
export { useClickOutsideRef, useGetColor } from './hooks/index';
|
|
8
|
+
export { PasswordRuleTypes } from './enums/index';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function generateKey(prefix: string | number): string;
|
package/package.json
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@hbuesing/ui-library",
|
|
4
|
-
"version": "3.0.
|
|
4
|
+
"version": "3.0.1",
|
|
5
5
|
"description": "Collection of reusable ui components for react based applications",
|
|
6
6
|
"source": "src/index.ts",
|
|
7
|
-
"
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": "./dist/bundle.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist/*"
|
|
12
|
+
],
|
|
8
13
|
"scripts": {
|
|
9
14
|
"clean": "rimraf ./dist && mkdir dist",
|
|
10
15
|
"lint": "eslint src",
|
|
11
16
|
"lint:nw": "eslint src --max-warnings 0",
|
|
12
|
-
"build": "microbundle build --output ./dist/bundle.
|
|
17
|
+
"build": "microbundle build --output ./dist/bundle.js --generateTypes true --format modern --jsx react --globals react/jsx-runtime=jsxRuntime --css inline",
|
|
13
18
|
"build:uil": "microbundle build --output ../website/src/uil-bundle/bundle.mjs --no-pkg-main --generateTypes true --format modern --jsx react --globals react/jsx-runtime=jsxRuntime --css inline",
|
|
14
19
|
"dev": "microbundle -w --output ./dist/bundle.mjs --no-pkg-main --generateTypes true --format modern --jsx react --globals react/jsx-runtime=jsxRuntime --css inline",
|
|
15
20
|
"stats": "microbundle --visualize"
|
|
16
21
|
},
|
|
17
22
|
"license": "MIT",
|
|
18
|
-
"homepage": "https://
|
|
23
|
+
"homepage": "https://hb-ui-library-docs.vercel.app",
|
|
19
24
|
"bugs": "https://github.com/HenrikBuesing/ui-library/issues",
|
|
20
25
|
"repository": {
|
|
21
26
|
"type": "git",
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
@use '../variables' as *;
|
|
2
|
-
|
|
3
|
-
.uil-button {
|
|
4
|
-
letter-spacing: 1px;
|
|
5
|
-
color: var(--uil-black);
|
|
6
|
-
background-color: var(--uil-white);
|
|
7
|
-
border: 1px solid var(--uil-black);
|
|
8
|
-
border-radius: 2px;
|
|
9
|
-
cursor: pointer;
|
|
10
|
-
padding: var(--uil-xs) var(--uil-s);
|
|
11
|
-
-webkit-box-shadow: 0 0 3px 0 var(--uil-black-alt);
|
|
12
|
-
box-shadow: 0 0 3px 0 var(--uil-black-alt);
|
|
13
|
-
|
|
14
|
-
&.uil-disabled {
|
|
15
|
-
background-color: var(--uil-grey-dark);
|
|
16
|
-
color: var(--uil-grey);
|
|
17
|
-
border: transparent;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&.uil-small {
|
|
21
|
-
font-size: var(--uil-font-small);
|
|
22
|
-
line-height: var(--uil-font-small);
|
|
23
|
-
padding: var(--uil-xxs) var(--uil-xs);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import React, {ComponentPropsWithoutRef, CSSProperties, useRef} from 'react';
|
|
2
|
-
import useInjectStyleSheet from "utils/useInjectStyles";
|
|
3
|
-
import {useGetColor} from 'hooks/getColor';
|
|
4
|
-
|
|
5
|
-
type HEXColor = `#${string}`
|
|
6
|
-
|
|
7
|
-
interface ICustomButton extends ComponentPropsWithoutRef<'button'> {
|
|
8
|
-
label : string;
|
|
9
|
-
disabled?: boolean;
|
|
10
|
-
small? : boolean;
|
|
11
|
-
theme? : HEXColor | 'success' | 'warning' | 'error';
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export function CustomButton(props: ICustomButton) {
|
|
15
|
-
const {
|
|
16
|
-
disabled = false,
|
|
17
|
-
label,
|
|
18
|
-
small = false,
|
|
19
|
-
theme,
|
|
20
|
-
...buttonProps
|
|
21
|
-
} = props;
|
|
22
|
-
|
|
23
|
-
const nodeRef = useRef<HTMLButtonElement>(null);
|
|
24
|
-
useInjectStyleSheet(nodeRef);
|
|
25
|
-
|
|
26
|
-
function getStyle(): CSSProperties | undefined {
|
|
27
|
-
if (disabled || !theme) return undefined;
|
|
28
|
-
|
|
29
|
-
if (theme.includes('#')) {
|
|
30
|
-
return {
|
|
31
|
-
color: useGetColor(theme),
|
|
32
|
-
backgroundColor: theme,
|
|
33
|
-
border: 'transparent'
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
switch (theme) {
|
|
38
|
-
case 'success':
|
|
39
|
-
return {
|
|
40
|
-
color: useGetColor('#006A4E'),
|
|
41
|
-
backgroundColor: '#006A4E',
|
|
42
|
-
border: 'transparent'
|
|
43
|
-
};
|
|
44
|
-
case 'warning':
|
|
45
|
-
return {
|
|
46
|
-
color: '#000000',
|
|
47
|
-
backgroundColor: '#FFD700',
|
|
48
|
-
border: 'transparent'
|
|
49
|
-
};
|
|
50
|
-
case 'error':
|
|
51
|
-
return {
|
|
52
|
-
color: useGetColor('#800020'),
|
|
53
|
-
backgroundColor: '#800020',
|
|
54
|
-
border: 'transparent'
|
|
55
|
-
};
|
|
56
|
-
default:
|
|
57
|
-
throw new Error('invalid theme provided')
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function getClassName(): string {
|
|
62
|
-
const base = 'uil-button uil-fit'
|
|
63
|
-
|
|
64
|
-
if (disabled && !small) {
|
|
65
|
-
return `${base} uil-font-base uil-disabled`;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (disabled && small) {
|
|
69
|
-
return `${base} uil-disabled uil-small`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (small) {
|
|
73
|
-
return `${base} uil-small`;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return `${base} uil-font-base`;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
return (
|
|
80
|
-
<button className={getClassName()} style={getStyle()} disabled={disabled} {...buttonProps} ref={nodeRef}>
|
|
81
|
-
{label}
|
|
82
|
-
</button>
|
|
83
|
-
);
|
|
84
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './customButton'
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React, {ComponentPropsWithoutRef, ReactNode, useRef} from 'react';
|
|
2
|
-
import useInjectStyleSheet from "utils/useInjectStyles";
|
|
3
|
-
|
|
4
|
-
interface ICustomCheckbox extends ComponentPropsWithoutRef<'input'> {
|
|
5
|
-
checked : boolean;
|
|
6
|
-
label? : string;
|
|
7
|
-
toggleCheck : (value: boolean) => void;
|
|
8
|
-
checkColor? : string;
|
|
9
|
-
children? : ReactNode;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export function CustomCheckBox(props: ICustomCheckbox) {
|
|
13
|
-
const {
|
|
14
|
-
checkColor,
|
|
15
|
-
checked,
|
|
16
|
-
toggleCheck,
|
|
17
|
-
label,
|
|
18
|
-
children,
|
|
19
|
-
...checkProps
|
|
20
|
-
} = props;
|
|
21
|
-
|
|
22
|
-
const nodeRef = useRef<HTMLDivElement>(null);
|
|
23
|
-
useInjectStyleSheet(nodeRef);
|
|
24
|
-
|
|
25
|
-
return (
|
|
26
|
-
<div className={'uil-check-wrapper'} ref={nodeRef}>
|
|
27
|
-
<label className={'uil-checkbox uil-check'}>
|
|
28
|
-
<input type={'checkbox'} checked={checked} onChange={() => {toggleCheck(!checked)}} {...checkProps}/>
|
|
29
|
-
<div className={'uil-checkmark'} style={{backgroundColor: checkColor}}/>
|
|
30
|
-
</label>
|
|
31
|
-
|
|
32
|
-
{children ? children : <span onClick={() => toggleCheck(!checked)} style={{cursor: 'pointer', userSelect: 'none'}}>{label}</span>}
|
|
33
|
-
</div>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './customCheckBox';
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
@use "variables" as *;
|
|
2
|
-
|
|
3
|
-
.uil-fit {
|
|
4
|
-
height: fit-content;
|
|
5
|
-
width: fit-content;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
.uil-font-base {
|
|
9
|
-
font-size: var(--uil-font-base);
|
|
10
|
-
line-height: var(--uil-font-base);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.uil-check {
|
|
14
|
-
position: relative;
|
|
15
|
-
display: block;
|
|
16
|
-
cursor: pointer;
|
|
17
|
-
font-size: var(--uil-font-small);
|
|
18
|
-
line-height: var(--uil-font-small);
|
|
19
|
-
min-height: var(--uil-l);
|
|
20
|
-
min-width: var(--uil-l);
|
|
21
|
-
user-select: none;
|
|
22
|
-
border: 2px solid var(--uil-black-alt);
|
|
23
|
-
box-sizing: border-box;
|
|
24
|
-
|
|
25
|
-
&:has(input:disabled) {
|
|
26
|
-
background-color: var(--uil-grey);
|
|
27
|
-
border-color: var(--uil-grey-dark);
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
input {
|
|
31
|
-
position: absolute;
|
|
32
|
-
cursor: pointer;
|
|
33
|
-
height: 0;
|
|
34
|
-
width: 0;
|
|
35
|
-
opacity: 0;
|
|
36
|
-
|
|
37
|
-
&:checked {
|
|
38
|
-
~ .uil-checkmark {
|
|
39
|
-
transform: scale(1);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&:disabled {
|
|
44
|
-
~ .uil-checkmark {
|
|
45
|
-
background-color: var(--uil-grey-dark);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.uil-checkmark {
|
|
51
|
-
position: absolute;
|
|
52
|
-
top: 25%;
|
|
53
|
-
left: 25%;
|
|
54
|
-
background-color: var(--uil-black-alt);
|
|
55
|
-
width: var(--uil-xs);
|
|
56
|
-
height: var(--uil-xs);
|
|
57
|
-
transform: scale(0);
|
|
58
|
-
transition: .1s ease;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './svgIcon';
|