@hbuesing/ui-library 5.0.0-beta.14 → 5.0.0-beta.15
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/components/button/index.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { Dialog, DialogTitle, DialogContent, DialogControls } from './components/dialog';
|
|
2
|
-
export { Button } from './components/button';
|
|
2
|
+
export { Button, type ButtonProps } from './components/button';
|
|
3
3
|
export { Radio } from './components/check/radio';
|
|
4
4
|
export { Backdrop } from './components/backdrop';
|
|
5
5
|
export { Checkbox } from './components/check/checkbox';
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var d={fit:"L",fontSmall:"M",fontMedium:"N",fontLarge:"O",dark:"P"};import S,{useEffect as
|
|
1
|
+
var d={fit:"L",fontSmall:"M",fontMedium:"N",fontLarge:"O",dark:"P"};import S,{useEffect as B,useRef as M}from"react";function i(r){let o="";return r.forEach(e=>{e==null||e===!1||(o!==""&&(o+=" "),o+=e)}),o}var h={dialog:"e",small:"Q",medium:"R",large:"S",title:"f",default:"A",success:"B",warning:"G",error:"H",content:"I",divider:"T",controls:"z",start:"U",end:"V","space-between":"W"};function L(r){let{ariaModal:o,children:e,dark:l=!1,describedby:a,labelledby:p,onCancel:u,open:f,scrollable:s=!1,size:c}=r,n=M(null);return B(()=>{f?(s||(document.body.style.paddingRight="15px",document.body.style.overflow="hidden"),n.current?.showModal()):(s||(document.body.style.paddingRight="",document.body.style.overflow=""),n.current?.close())},[f]),S.createElement("dialog",{ref:n,"aria-describedby":a,"aria-labelledby":p,"aria-modal":o,className:i([h.dialog,l&&d.dark,c&&h[c]]),onCancel:u},e)}import H from"react";function G(r){let{children:o,color:e,id:l}=r;return H.createElement("div",{className:i([h.title,e&&h[e],d.fontLarge]),id:l},o)}import O from"react";function j(r){let{children:o,divider:e=!1,id:l}=r;return O.createElement("div",{className:i([h.content,e&&h.divider]),id:l},o)}import q from"react";function K(r){let{children:o,position:e="end"}=r;return q.createElement("div",{className:i([h.controls,h[e]])},o)}var A=new RegExp(/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/);function C(r){if(!A.test(r))throw new Error(`useContrastColor received an invalid hex color format. Expected '#000' or '#000000', but got: ${r}`);r=r.replace("#","");let o;r.length===3?o=[parseInt(r.substring(0),16)/255,parseInt(r.substring(1),16)/255,parseInt(r.substring(2),16)/255]:o=[parseInt(r.substring(0,2),16)/255,parseInt(r.substring(2,4),16)/255,parseInt(r.substring(4,6),16)/255];let[e,l,a]=o.map(u=>u<=.04045?u/12.92:((u+.055)/1.055)**2.4);return .2126*e+.7152*l+.0722*a>.179?"#000000":"#ffffff"}import T from"react";var k={button:"l",filled:"h",outlined:"v",text:"p",success:"w",warning:"k",error:"m",custom:"j",disabled:"C",small:"X",medium:"Y",large:"Z"};function U(r){let{children:o,color:e,dark:l,disabled:a,href:p,size:u="medium",target:f,variant:s,...c}=r,n=m();function m(){if(!(a||!e?.includes("#")))switch(s){case"filled":return{color:C(e),backgroundColor:e};case"outlined":return{color:e,borderColor:e};case"text":return{color:e};default:throw new Error(`<Button> received an unexpected variant. Expected 'filled', 'outline' or 'text', but got: ${String(s)}'`)}}function W(){let x;switch(u){case"small":x=d.fontSmall;break;case"medium":x=d.fontMedium;break;case"large":x=d.fontLarge;break;default:throw new Error(`<Button> received an unsupported size. Expected 'small', 'medium' or 'large', but got: ${String(u)}`)}return i([k.button,d.fit,x,k[u],k[s],l&&d.dark,e&&!e.includes("#")&&k[e],n&&k.custom,a&&k.disabled])}return p||p===""?T.createElement("a",{href:p,target:f,id:c.id,title:c.title,style:n,className:W()},o):T.createElement("button",{style:n,className:W(),type:c.type??"button",disabled:a,"aria-disabled":a,tabIndex:a?-1:c.tabIndex,...c},o)}import y from"react";function v(){let r=new Uint32Array(2);return crypto.getRandomValues(r),`uil${r[0].toString(32)}${r[1].toString(16)}`}var b={checkWrapper:"n",label:"J",check:"b",box:"_",radio:"K",radioCheck:"rr",checkmark:"D",radioWrapper:"E",row:"or",column:"ir"};function I(r){let{checked:o,children:e,color:l,dark:a,disabled:p,id:u,name:f,onChange:s,value:c,...n}=r,m=u??v();function W(F){!p&&s&&s(F)}function x(){document.querySelector(`#${m}`).click()}return y.createElement("div",{className:i([b.checkWrapper,a&&d.dark])},y.createElement("div",{className:`${b.check} ${b.radio}`,onClick:()=>{x()}},y.createElement("input",{id:m,name:f,type:"radio",value:c,checked:o,onChange:F=>{W(F)},disabled:p,tabIndex:p?-1:n.tabIndex??void 0,...n}),y.createElement("div",{className:`${b.checkmark} ${b.radioCheck}`,style:p?void 0:{backgroundColor:l}})),e&&y.createElement("label",{htmlFor:m,className:`${d.fontMedium} ${b.label}`},e))}var N={backdrop:"lr"};import{createPortal as J}from"react-dom";import Q from"react";function Y(r){let{children:o,onClick:e,open:l,zIndex:a}=r;return l?J(Q.createElement("div",{className:N.backdrop,style:{zIndex:a},onClick:e},o),document.body):null}import w from"react";function Z(r){let{checked:o,children:e,color:l,dark:a,disabled:p,onChange:u,...f}=r,s=f.id??v();function c(m){!p&&u&&u(m)}function n(){document.querySelector(`#${s}`).click()}return w.createElement("div",{className:i([b.checkWrapper,a&&d.dark])},w.createElement("div",{className:i([b.check,b.box]),onClick:n},w.createElement("input",{type:"checkbox",checked:o,onChange:c,id:s,disabled:p,...f}),w.createElement("div",{className:i([b.checkmark]),style:p?void 0:{backgroundColor:l}})),e&&w.createElement("label",{htmlFor:s,className:`${d.fontMedium} ${b.label}`},e))}var t={inputField:"r",inputWrapper:"o",basic:"d",input:"i",label:"u",fieldset:"a",decorator:"t",start:"F",outlined:"s",end:"ar",error:"c",visible:"y",legend:"er",labelText:"g",asterisk:"tr",focus:"x",helpText:"q"};import rr from"react";function P(r){let{children:o,onFocus:e,position:l}=r;return rr.createElement("div",{className:i([t.decorator,d.fontSmall,l==="start"?t.start:t.end,e?t.focus:t.visible])},o)}import g,{isValidElement as D}from"react";function er(r){let{children:o,dark:e,error:l,helpText:a,id:p,label:u,required:f,variant:s,...c}=r;if(o&&(!D(o)||o.type!==P))throw new Error(`<Input> received an invalid child. Expected <InputDecorator />, but got: ${D(o)?String(o.type):typeof o}.`);let n=p??v(),m=a?v():void 0;return g.createElement("div",{className:i([t.inputField,e&&d.dark])},g.createElement("div",{className:i([t.inputWrapper,s==="basic"?t.basic:t.outlined,l&&t.error])},g.createElement("input",{id:n,className:`${t.input} ${d.fontMedium}`,placeholder:"",required:f,...c,"aria-describedby":m}),o&&o,g.createElement("fieldset",{className:t.fieldset,"aria-hidden":!0},g.createElement("legend",{className:t.legend},g.createElement("span",{className:t.labelText},u),f&&g.createElement("span",{className:`${t.labelText} ${t.asterisk}`,"aria-hidden":!0},"*"))),g.createElement("label",{htmlFor:n,className:t.label},g.createElement("span",{className:t.labelText},u),f&&g.createElement("span",{className:`${t.labelText} ${t.asterisk}`,"aria-hidden":!0},"*"))),a&&g.createElement("div",{className:i([t.helpText,l&&t.error]),id:m},a))}import E from"react";function or(r){let{color:o,dark:e=!1,direction:l="column",disabled:a,name:p,onChange:u,options:f,selected:s}=r;function c(n){!a&&u&&u(n)}return E.createElement("div",{className:i([b.radioWrapper,b[l]])},f.map((n,m)=>E.createElement(I,{key:m,dark:e,color:o,onChange:c,checked:s===n.value,disabled:a??n.disabled,name:p,...n},n.label)))}export{Y as Backdrop,U as Button,Z as Checkbox,L as Dialog,j as DialogContent,K as DialogControls,G as DialogTitle,er as Input,P as InputDecorator,I as Radio,or as RadioGroup,C as useContrastColor};
|
package/package.json
CHANGED