@epam/ai-dial-ui-kit 0.2.0-rc.7 → 0.2.0-rc.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dial-ui-kit.cjs.js +1 -1
- package/dist/dial-ui-kit.es.js +289 -246
- package/dist/index.css +1 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts +33 -0
- package/dist/src/components/Switch/Switch.d.ts +1 -1
- package/dist/src/constants/icon.d.ts +5 -0
- package/dist/src/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/dial-ui-kit.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("classnames"),y=require("@tabler/icons-react"),d=require("@floating-ui/react"),f=require("react"),N=({icon:e,className:r})=>e?s.jsx("span",{className:u("flex-shrink-0",r),children:e}):null;var T=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(T||{});const K={[T.Primary]:"dial-primary-button",[T.Secondary]:"dial-secondary-button",[T.Tertiary]:"dial-tertiary-button"},L=({title:e,variant:r,cssClass:t,ref:n,onClick:a,disable:l,iconAfter:o,iconBefore:c,hideTitleOnMobile:i,ariaLabel:p})=>{const x=u("dial-small-semi",o?"mr-2":"",c?"ml-2":"",i?"hidden sm:inline":"inline"),m=u(r&&K[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:n,type:"button",className:m,onClick:v=>a?.(v),disabled:l,"aria-label":e||p,children:[s.jsx(N,{icon:c}),e&&s.jsx("span",{className:x,children:e}),s.jsx(N,{icon:o})]})},S=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),P=({fieldTitle:e,htmlFor:r,optional:t,optionalText:n,cssClass:a})=>e?s.jsxs("label",{className:u("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:r,children:[s.jsx("span",{className:"min-h-4",children:e}),t&&s.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var j=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(j||{});const O={info:s.jsx(y.IconInfoCircle,{size:24,stroke:2}),error:s.jsx(y.IconAlertCircle,{size:24,stroke:2}),warning:s.jsx(y.IconAlertTriangle,{size:24,stroke:2}),success:s.jsx(y.IconCircleCheck,{size:24,stroke:2})},V={[j.Info]:"bg-info border-info text-info",[j.Success]:"bg-success border-success text-success",[j.Warning]:"bg-warning border-warning text-warning",[j.Error]:"bg-error border-error text-error"},$="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",G=({variant:e=j.Info,message:r,cssClass:t,closable:n=!1,onClose:a})=>s.jsxs("div",{role:"alert",className:u($,V[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(N,{icon:O[e]}),s.jsx("div",{className:"text-primary",children:r})]}),n&&s.jsx(L,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(y.IconX,{size:16}),onClick:l=>a?.(l)})]}),X="flex items-center justify-center text-secondary",Y="shrink-0 grow-0 basis-auto animate-spin-steps",Z=({size:e=18,cssClass:r,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>s.jsx("div",{role:"status","aria-label":a,className:u({[X]:!0,"w-full h-full":n,[r||""]:!!r}),children:s.jsx(N,{icon:s.jsx(y.IconLoader,{width:e,height:e,className:u(Y,t)})})}),J=7,Q=2,M=f.createContext(null),W=()=>{const e=f.useContext(M);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},ee=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[l,o]=f.useState(e),c=f.useRef(null),i=n??l,p=a??o,x=d.useFloating({placement:r,open:i,onOpenChange:p,whileElementsMounted:d.autoUpdate,middleware:[d.offset(J+Q),d.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),d.shift({padding:5}),d.arrow({element:c})]}),m=d.useHover(x.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),v=d.useFocus(x.context,{enabled:n==null}),R=d.useDismiss(x.context),b=d.useRole(x.context,{role:"tooltip"}),g=d.useInteractions([m,v,R,b]);return f.useMemo(()=>({open:i,setOpen:p,arrowRef:c,...g,...x}),[i,p,g,x])},se=({children:e,...r})=>{const t=ee(r);return s.jsx(M.Provider,{value:t,children:e})},re=f.forwardRef(function({style:r,...t},n){const a=W(),l=d.useMergeRefs([a.refs.setFloating,n]);return a.open?s.jsx(d.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:l,style:{...a.floatingStyles,...r},...a.getFloatingProps(t),className:u("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(t).className),children:[t.children,s.jsx(d.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),te=f.forwardRef(function({children:r,asChild:t=!1,...n},a){const l=W(),c=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,i=d.useMergeRefs([l.refs.setReference,a,c]);return t&&f.isValidElement(r)?f.cloneElement(r,l.getReferenceProps({ref:i,...n,...r.props})):s.jsx("span",{ref:i,...l.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:r})}),k=({hideTooltip:e,tooltip:r,children:t,triggerClassName:n,contentClassName:a,...l})=>e||!r?s.jsx("span",{className:n,children:t}):s.jsxs(se,{...l,children:[s.jsx(te,{className:u(n,"truncate"),children:t}),s.jsx(re,{className:u("text-primary",a,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),z=({value:e,textareaId:r,placeholder:t,cssClass:n="",disabled:a,invalid:l,readonly:o,onChange:c})=>s.jsx(k,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:a,className:u("dial-textarea dial-input",l?"dial-input-error":"",a&&"dial-input-disable",o&&"dial-input-readonly",n),onChange:i=>!o&&c?.(i.currentTarget.value)})}),ne=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],ae=(e,r,t,n)=>{if((r==="number"||t!==void 0||n!==void 0)&&!ne.includes(e.key)&&!(e.key==="-"&&e.currentTarget.selectionStart===0&&(t===void 0||t<0))&&!(e.key==="."&&r==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if(t!==void 0||n!==void 0){const l=e.currentTarget.value,o=e.currentTarget.selectionStart||0,c=l.slice(0,o)+e.key+l.slice(o),i=parseFloat(c);if(!isNaN(i)){if(t!==void 0&&i<t){e.preventDefault();return}if(n!==void 0&&i>n){e.preventDefault();return}}}}},I=({iconBeforeInput:e,iconAfterInput:r,hideBorder:t,value:n,elementId:a,placeholder:l="",cssClass:o="",containerCssClass:c,tooltipTriggerClassName:i,type:p="text",disabled:x,readonly:m,invalid:v,onChange:R,min:b,max:g,prefix:E,suffix:A,textBeforeInput:w,textAfterInput:C})=>{const B=h=>h.target.blur(),H=p==="number"||b!==void 0||g!==void 0,U=h=>{ae(h,p,b,g)},_=h=>{const D=h.currentTarget.value;if(H&&D!==""){const F=parseFloat(D);if(isNaN(F)&&D!=="-"&&D!=="."||!isNaN(F)&&(b!==void 0&&F<b||g!==void 0&&F>g))return}R?.(D)};return s.jsxs("div",{className:u("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",v&&"dial-input-error",x&&"dial-input-disable",m&&"dial-input-readonly",!w&&"pl-1",!C&&"pr-1",c),children:[w&&s.jsx(k,{tooltip:w,children:s.jsx(I,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:w,disabled:!0,elementId:w+"textBefore"})}),E&&s.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",E]}),s.jsx(N,{icon:e,className:"pl-2"}),s.jsx(k,{tooltip:n,triggerClassName:i,children:s.jsx("input",{type:p,autoComplete:"off",id:a,placeholder:l,value:n??"",title:n?String(n):"",disabled:x,className:u("border-0 bg-transparent px-2",o),onChange:h=>!m&&_?.(h),onKeyDown:U,onWheel:B,min:b,max:g})}),s.jsx(N,{icon:r,className:"pr-2"}),A&&s.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",A]}),C&&s.jsx(k,{tooltip:C,children:s.jsx(I,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:C,disabled:!0,elementId:C+"textAfter"})})]})},le=/^0+\.(\d+)?$/,oe=/^0+/,q=({fieldTitle:e,errorText:r,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:l,containerCssClass:o,readonly:c,defaultEmptyText:i,min:p,max:x,...m})=>s.jsxs("div",{className:u("flex flex-col",o),children:[s.jsx(P,{fieldTitle:e,optional:t,htmlFor:l}),c?s.jsx("span",{children:m.value||(i??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(I,{elementId:l,cssClass:n,containerCssClass:a,invalid:r!=null,min:p,max:x,...m}),s.jsx(S,{errorText:r})]})]}),ie=({onChange:e,value:r,min:t,max:n,...a})=>{const l=o=>String(o)?.match(le)?String(o)?.replace(oe,"0"):Number(o);return s.jsx(q,{type:"number",onChange:o=>e?.(l(o)),value:r,min:t,max:n,...a})},ce=({onChange:e,...r})=>s.jsx(q,{type:"text",onChange:t=>e?.(t),...r}),ue=({fieldTitle:e,optional:r,elementId:t,elementCssClass:n,errorText:a,...l})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(P,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx(z,{textareaId:t,cssClass:n,...l}),s.jsx(S,{errorText:a})]}),de=({title:e,switchId:r,isOn:t=!1,disabled:n,onChange:a})=>{const l=u("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),o=f.useCallback(c=>{c.stopPropagation(),a?.(!t)},[a,t]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:o,id:r,disabled:n,className:"invisible w-0 h-0",checked:t}),s.jsx("label",{htmlFor:r,className:l,children:s.jsx("span",{className:u("size-3 rounded-full",n?t?"bg-controls-disable":"bg-layer-4":"bg-controls-enable-primary")})}),e&&s.jsx("span",{className:"h-[14px] pl-2 small text-primary",children:e})]})};exports.AlertVariant=j;exports.ButtonVariant=T;exports.DialAlert=G;exports.DialButton=L;exports.DialErrorText=S;exports.DialFieldLabel=P;exports.DialIcon=N;exports.DialInput=I;exports.DialLoader=Z;exports.DialNumberInputField=ie;exports.DialSwitch=de;exports.DialTextAreaField=ue;exports.DialTextInputField=ce;exports.DialTextarea=z;exports.DialTooltip=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),d=require("classnames"),g=require("@tabler/icons-react"),m=require("react"),x=require("@floating-ui/react"),y=({icon:e,className:r})=>e?s.jsx("span",{className:d("flex-shrink-0",r),children:e}):null;var k=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(k||{});const $={[k.Primary]:"dial-primary-button",[k.Secondary]:"dial-secondary-button",[k.Tertiary]:"dial-tertiary-button"},M=({title:e,variant:r,cssClass:t,ref:n,onClick:o,disable:a,iconAfter:l,iconBefore:c,hideTitleOnMobile:i,ariaLabel:p})=>{const u=d("dial-small-semi",l?"mr-2":"",c?"ml-2":"",i?"hidden sm:inline":"inline"),f=d(r&&$[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:n,type:"button",className:f,onClick:v=>o?.(v),disabled:a,"aria-label":e||p,children:[s.jsx(y,{icon:c}),e&&s.jsx("span",{className:u,children:e}),s.jsx(y,{icon:l})]})},R=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),P=({fieldTitle:e,htmlFor:r,optional:t,optionalText:n,cssClass:o})=>e?s.jsxs("label",{className:d("dial-tiny text-secondary",o,!o?.includes("mb")&&"mb-2"),htmlFor:r,children:[s.jsx("span",{className:"min-h-4",children:e}),t&&s.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var N=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(N||{});const K={info:s.jsx(g.IconInfoCircle,{size:24,stroke:2}),error:s.jsx(g.IconAlertCircle,{size:24,stroke:2}),warning:s.jsx(g.IconAlertTriangle,{size:24,stroke:2}),success:s.jsx(g.IconCircleCheck,{size:24,stroke:2})},V={[N.Info]:"bg-info border-info text-info",[N.Success]:"bg-success border-success text-success",[N.Warning]:"bg-warning border-warning text-warning",[N.Error]:"bg-error border-error text-error"},G="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",Z=({variant:e=N.Info,message:r,cssClass:t,closable:n=!1,onClose:o})=>s.jsxs("div",{role:"alert",className:d(G,V[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(y,{icon:K[e]}),s.jsx("div",{className:"text-primary",children:r})]}),n&&s.jsx(M,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(g.IconX,{size:16}),onClick:a=>o?.(a)})]}),X="flex items-center justify-center text-secondary",Y="shrink-0 grow-0 basis-auto animate-spin-steps",J=({size:e=18,cssClass:r,iconClass:t,fullWidth:n=!0,ariaLabel:o="Loading"})=>s.jsx("div",{role:"status","aria-label":o,className:d({[X]:!0,"w-full h-full":n,[r||""]:!!r}),children:s.jsx(y,{icon:s.jsx(g.IconLoader,{width:e,height:e,className:d(Y,t)})})}),Q=7,ee=2,_=m.createContext(null),z=()=>{const e=m.useContext(_);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},se=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:o}={})=>{const[a,l]=m.useState(e),c=m.useRef(null),i=n??a,p=o??l,u=x.useFloating({placement:r,open:i,onOpenChange:p,whileElementsMounted:x.autoUpdate,middleware:[x.offset(Q+ee),x.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),x.shift({padding:5}),x.arrow({element:c})]}),f=x.useHover(u.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),v=x.useFocus(u.context,{enabled:n==null}),S=x.useDismiss(u.context),h=x.useRole(u.context,{role:"tooltip"}),b=x.useInteractions([f,v,S,h]);return m.useMemo(()=>({open:i,setOpen:p,arrowRef:c,...b,...u}),[i,p,b,u])},re=({children:e,...r})=>{const t=se(r);return s.jsx(_.Provider,{value:t,children:e})},te=m.forwardRef(function({style:r,...t},n){const o=z(),a=x.useMergeRefs([o.refs.setFloating,n]);return o.open?s.jsx(x.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:a,style:{...o.floatingStyles,...r},...o.getFloatingProps(t),className:d("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",o.getFloatingProps(t).className),children:[t.children,s.jsx(x.FloatingArrow,{ref:o.arrowRef,context:o.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),ne=m.forwardRef(function({children:r,asChild:t=!1,...n},o){const a=z(),c=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,i=x.useMergeRefs([a.refs.setReference,o,c]);return t&&m.isValidElement(r)?m.cloneElement(r,a.getReferenceProps({ref:i,...n,...r.props})):s.jsx("span",{ref:i,...a.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:r})}),C=({hideTooltip:e,tooltip:r,children:t,triggerClassName:n,contentClassName:o,...a})=>e||!r?s.jsx("span",{className:n,children:t}):s.jsxs(re,{...a,children:[s.jsx(ne,{className:d(n,"truncate"),children:t}),s.jsx(te,{className:d("text-primary",o,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),oe=18,L={size:oe,stroke:2},ae=({label:e,id:r,checked:t,indeterminate:n,disabled:o,ariaLabel:a,onChange:l})=>{const c=m.useCallback(u=>{u.stopPropagation(),l?.(u.target.checked,r)},[l,r]),i=d("flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",`${t?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded before:mr-2'}`,o?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":""),p=d("mr-2 border rounded",o?"bg-layer-4 border-icon-secondary":"");return s.jsxs("label",{className:i,htmlFor:r,children:[t&&(n?s.jsx(g.IconMinus,{className:p,...L}):s.jsx(g.IconCheck,{className:p,...L})),e&&s.jsx(C,{tooltip:e,triggerClassName:"flex-1 min-w-0",children:s.jsx("p",{className:"text-primary w-full truncate",children:e})}),s.jsx("input",{type:"checkbox",onChange:c,id:r,checked:t,"aria-checked":n?"mixed":t,"aria-disabled":o||void 0,"aria-label":e?void 0:a,className:"invisible w-0 h-0"})]})},W=({value:e,textareaId:r,placeholder:t,cssClass:n="",disabled:o,invalid:a,readonly:l,onChange:c})=>s.jsx(C,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:o,className:d("dial-textarea dial-input",a?"dial-input-error":"",o&&"dial-input-disable",l&&"dial-input-readonly",n),onChange:i=>!l&&c?.(i.currentTarget.value)})}),le=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],ie=(e,r,t,n)=>{if((r==="number"||t!==void 0||n!==void 0)&&!le.includes(e.key)&&!(e.key==="-"&&e.currentTarget.selectionStart===0&&(t===void 0||t<0))&&!(e.key==="."&&r==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if(t!==void 0||n!==void 0){const a=e.currentTarget.value,l=e.currentTarget.selectionStart||0,c=a.slice(0,l)+e.key+a.slice(l),i=parseFloat(c);if(!isNaN(i)){if(t!==void 0&&i<t){e.preventDefault();return}if(n!==void 0&&i>n){e.preventDefault();return}}}}},F=({iconBeforeInput:e,iconAfterInput:r,hideBorder:t,value:n,elementId:o,placeholder:a="",cssClass:l="",containerCssClass:c,tooltipTriggerClassName:i,type:p="text",disabled:u,readonly:f,invalid:v,onChange:S,min:h,max:b,prefix:E,suffix:A,textBeforeInput:w,textAfterInput:D})=>{const O=j=>j.target.blur(),q=p==="number"||h!==void 0||b!==void 0,H=j=>{ie(j,p,h,b)},U=j=>{const T=j.currentTarget.value;if(q&&T!==""){const I=parseFloat(T);if(isNaN(I)&&T!=="-"&&T!=="."||!isNaN(I)&&(h!==void 0&&I<h||b!==void 0&&I>b))return}S?.(T)};return s.jsxs("div",{className:d("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",v&&"dial-input-error",u&&"dial-input-disable",f&&"dial-input-readonly",!w&&"pl-1",!D&&"pr-1",c),children:[w&&s.jsx(C,{tooltip:w,children:s.jsx(F,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:w,disabled:!0,elementId:w+"textBefore"})}),E&&s.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",E]}),s.jsx(y,{icon:e,className:"pl-2"}),s.jsx(C,{tooltip:n,triggerClassName:i,children:s.jsx("input",{type:p,autoComplete:"off",id:o,placeholder:a,value:n??"",title:n?String(n):"",disabled:u,className:d("border-0 bg-transparent px-2",l),onChange:j=>!f&&U?.(j),onKeyDown:H,onWheel:O,min:h,max:b})}),s.jsx(y,{icon:r,className:"pr-2"}),A&&s.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",A]}),D&&s.jsx(C,{tooltip:D,children:s.jsx(F,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:D,disabled:!0,elementId:D+"textAfter"})})]})},ce=/^0+\.(\d+)?$/,de=/^0+/,B=({fieldTitle:e,errorText:r,optional:t,elementCssClass:n,elementContainerCssClass:o,elementId:a,containerCssClass:l,readonly:c,defaultEmptyText:i,min:p,max:u,...f})=>s.jsxs("div",{className:d("flex flex-col",l),children:[s.jsx(P,{fieldTitle:e,optional:t,htmlFor:a}),c?s.jsx("span",{children:f.value||(i??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(F,{elementId:a,cssClass:n,containerCssClass:o,invalid:r!=null,min:p,max:u,...f}),s.jsx(R,{errorText:r})]})]}),ue=({onChange:e,value:r,min:t,max:n,...o})=>{const a=l=>String(l)?.match(ce)?String(l)?.replace(de,"0"):Number(l);return s.jsx(B,{type:"number",onChange:l=>e?.(a(l)),value:r,min:t,max:n,...o})},xe=({onChange:e,...r})=>s.jsx(B,{type:"text",onChange:t=>e?.(t),...r}),pe=({fieldTitle:e,optional:r,elementId:t,elementCssClass:n,errorText:o,...a})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(P,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx(W,{textareaId:t,cssClass:n,...a}),s.jsx(R,{errorText:o})]}),me=({title:e,switchId:r,isOn:t=!1,disabled:n,onChange:o})=>{const a=d("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),l=m.useCallback(c=>{c.stopPropagation(),o?.(!t)},[o,t]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:l,id:r,disabled:n,className:"invisible w-0 h-0",checked:t}),s.jsx("label",{htmlFor:r,className:a,children:s.jsx("span",{className:d("size-3 rounded-full",n?t?"bg-layer-4":"bg-controls-disable":"bg-controls-enable-primary")})}),e&&s.jsx("span",{className:"pl-2 dial-small text-primary",children:e})]})};exports.AlertVariant=N;exports.ButtonVariant=k;exports.DialAlert=Z;exports.DialButton=M;exports.DialCheckbox=ae;exports.DialErrorText=R;exports.DialFieldLabel=P;exports.DialIcon=y;exports.DialInput=F;exports.DialLoader=J;exports.DialNumberInputField=ue;exports.DialSwitch=me;exports.DialTextAreaField=pe;exports.DialTextInputField=xe;exports.DialTextarea=W;exports.DialTooltip=C;
|
package/dist/dial-ui-kit.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as K } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import { IconCircleCheck as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
const N = ({ icon: e, className: r }) => e ? /* @__PURE__ */
|
|
3
|
+
import { IconCircleCheck as $, IconAlertTriangle as G, IconAlertCircle as Z, IconInfoCircle as V, IconX as X, IconLoader as Y, IconMinus as q, IconCheck as J } from "@tabler/icons-react";
|
|
4
|
+
import { createContext as Q, useState as ee, useRef as re, useMemo as ne, useContext as te, forwardRef as R, isValidElement as oe, cloneElement as se, useCallback as A } from "react";
|
|
5
|
+
import { useFloating as ae, offset as le, flip as ie, shift as ce, arrow as de, autoUpdate as ue, useHover as pe, useFocus as me, useDismiss as fe, useRole as be, useInteractions as ge, useMergeRefs as L, FloatingPortal as he, FloatingArrow as xe } from "@floating-ui/react";
|
|
6
|
+
const N = ({ icon: e, className: r }) => e ? /* @__PURE__ */ t("span", { className: d("flex-shrink-0", r), children: e }) : null;
|
|
7
7
|
var T = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Tertiary = "tertiary", e))(T || {});
|
|
8
|
-
const
|
|
8
|
+
const Ne = {
|
|
9
9
|
[T.Primary]: "dial-primary-button",
|
|
10
10
|
[T.Secondary]: "dial-secondary-button",
|
|
11
11
|
[T.Tertiary]: "dial-tertiary-button"
|
|
12
|
-
},
|
|
12
|
+
}, ye = ({
|
|
13
13
|
title: e,
|
|
14
14
|
variant: r,
|
|
15
|
-
cssClass:
|
|
16
|
-
ref:
|
|
17
|
-
onClick:
|
|
15
|
+
cssClass: n,
|
|
16
|
+
ref: o,
|
|
17
|
+
onClick: s,
|
|
18
18
|
disable: a,
|
|
19
19
|
iconAfter: l,
|
|
20
20
|
iconBefore: c,
|
|
21
21
|
hideTitleOnMobile: i,
|
|
22
|
-
ariaLabel:
|
|
22
|
+
ariaLabel: p
|
|
23
23
|
}) => {
|
|
24
24
|
const u = d(
|
|
25
25
|
"dial-small-semi",
|
|
@@ -27,194 +27,194 @@ const he = {
|
|
|
27
27
|
c ? "ml-2" : "",
|
|
28
28
|
i ? "hidden sm:inline" : "inline"
|
|
29
29
|
), f = d(
|
|
30
|
-
r &&
|
|
31
|
-
|
|
30
|
+
r && Ne[r],
|
|
31
|
+
n,
|
|
32
32
|
"focus-visible:outline outline-offset-0"
|
|
33
33
|
);
|
|
34
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ m(
|
|
35
35
|
"button",
|
|
36
36
|
{
|
|
37
|
-
ref:
|
|
37
|
+
ref: o,
|
|
38
38
|
type: "button",
|
|
39
39
|
className: f,
|
|
40
|
-
onClick: (y) =>
|
|
40
|
+
onClick: (y) => s?.(y),
|
|
41
41
|
disabled: a,
|
|
42
|
-
"aria-label": e ||
|
|
42
|
+
"aria-label": e || p,
|
|
43
43
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
e && /* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ t(N, { icon: c }),
|
|
45
|
+
e && /* @__PURE__ */ t("span", { className: u, children: e }),
|
|
46
|
+
/* @__PURE__ */ t(N, { icon: l })
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
},
|
|
50
|
+
}, _ = ({ errorText: e }) => e && /* @__PURE__ */ t("span", { className: "text-error dial-tiny mt-1", children: e }), z = ({
|
|
51
51
|
fieldTitle: e,
|
|
52
52
|
htmlFor: r,
|
|
53
|
-
optional:
|
|
54
|
-
optionalText:
|
|
55
|
-
cssClass:
|
|
56
|
-
}) => e ? /* @__PURE__ */
|
|
53
|
+
optional: n,
|
|
54
|
+
optionalText: o,
|
|
55
|
+
cssClass: s
|
|
56
|
+
}) => e ? /* @__PURE__ */ m(
|
|
57
57
|
"label",
|
|
58
58
|
{
|
|
59
59
|
className: d(
|
|
60
60
|
"dial-tiny text-secondary",
|
|
61
|
-
|
|
62
|
-
!
|
|
61
|
+
s,
|
|
62
|
+
!s?.includes("mb") && "mb-2"
|
|
63
63
|
),
|
|
64
64
|
htmlFor: r,
|
|
65
65
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
66
|
+
/* @__PURE__ */ t("span", { className: "min-h-4", children: e }),
|
|
67
|
+
n && /* @__PURE__ */ t("span", { className: "ml-1", children: o ?? "(Optional)" })
|
|
68
68
|
]
|
|
69
69
|
}
|
|
70
70
|
) : null;
|
|
71
71
|
var x = /* @__PURE__ */ ((e) => (e.Info = "info", e.Success = "success", e.Warning = "warning", e.Error = "error", e))(x || {});
|
|
72
|
-
const
|
|
73
|
-
info: /* @__PURE__ */
|
|
74
|
-
error: /* @__PURE__ */
|
|
75
|
-
warning: /* @__PURE__ */
|
|
76
|
-
success: /* @__PURE__ */
|
|
77
|
-
},
|
|
72
|
+
const Ce = {
|
|
73
|
+
info: /* @__PURE__ */ t(V, { size: 24, stroke: 2 }),
|
|
74
|
+
error: /* @__PURE__ */ t(Z, { size: 24, stroke: 2 }),
|
|
75
|
+
warning: /* @__PURE__ */ t(G, { size: 24, stroke: 2 }),
|
|
76
|
+
success: /* @__PURE__ */ t($, { size: 24, stroke: 2 })
|
|
77
|
+
}, ve = {
|
|
78
78
|
[x.Info]: "bg-info border-info text-info",
|
|
79
79
|
[x.Success]: "bg-success border-success text-success",
|
|
80
80
|
[x.Warning]: "bg-warning border-warning text-warning",
|
|
81
81
|
[x.Error]: "bg-error border-error text-error"
|
|
82
|
-
},
|
|
82
|
+
}, we = "items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex", Ue = ({
|
|
83
83
|
variant: e = x.Info,
|
|
84
84
|
message: r,
|
|
85
|
-
cssClass:
|
|
86
|
-
closable:
|
|
87
|
-
onClose:
|
|
88
|
-
}) => /* @__PURE__ */
|
|
85
|
+
cssClass: n,
|
|
86
|
+
closable: o = !1,
|
|
87
|
+
onClose: s
|
|
88
|
+
}) => /* @__PURE__ */ m(
|
|
89
89
|
"div",
|
|
90
90
|
{
|
|
91
91
|
role: "alert",
|
|
92
92
|
className: d(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
we,
|
|
94
|
+
ve[e],
|
|
95
|
+
n
|
|
96
96
|
),
|
|
97
97
|
children: [
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
98
|
+
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
99
|
+
/* @__PURE__ */ t(N, { icon: Ce[e] }),
|
|
100
|
+
/* @__PURE__ */ t("div", { className: "text-primary", children: r })
|
|
101
101
|
] }),
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
o && /* @__PURE__ */ t(
|
|
103
|
+
ye,
|
|
104
104
|
{
|
|
105
105
|
cssClass: "ml-2 text-secondary hover:text-primary",
|
|
106
106
|
ariaLabel: "Close alert",
|
|
107
|
-
iconBefore: /* @__PURE__ */
|
|
108
|
-
onClick: (a) =>
|
|
107
|
+
iconBefore: /* @__PURE__ */ t(X, { size: 16 }),
|
|
108
|
+
onClick: (a) => s?.(a)
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
|
-
),
|
|
113
|
+
), ke = "flex items-center justify-center text-secondary", De = "shrink-0 grow-0 basis-auto animate-spin-steps", Ke = ({
|
|
114
114
|
size: e = 18,
|
|
115
115
|
cssClass: r,
|
|
116
|
-
iconClass:
|
|
117
|
-
fullWidth:
|
|
118
|
-
ariaLabel:
|
|
119
|
-
}) => /* @__PURE__ */
|
|
116
|
+
iconClass: n,
|
|
117
|
+
fullWidth: o = !0,
|
|
118
|
+
ariaLabel: s = "Loading"
|
|
119
|
+
}) => /* @__PURE__ */ t(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
122
122
|
role: "status",
|
|
123
|
-
"aria-label":
|
|
123
|
+
"aria-label": s,
|
|
124
124
|
className: d({
|
|
125
|
-
[
|
|
126
|
-
"w-full h-full":
|
|
125
|
+
[ke]: !0,
|
|
126
|
+
"w-full h-full": o,
|
|
127
127
|
[r || ""]: !!r
|
|
128
128
|
}),
|
|
129
|
-
children: /* @__PURE__ */
|
|
129
|
+
children: /* @__PURE__ */ t(
|
|
130
130
|
N,
|
|
131
131
|
{
|
|
132
|
-
icon: /* @__PURE__ */
|
|
133
|
-
|
|
132
|
+
icon: /* @__PURE__ */ t(
|
|
133
|
+
Y,
|
|
134
134
|
{
|
|
135
135
|
width: e,
|
|
136
136
|
height: e,
|
|
137
|
-
className: d(
|
|
137
|
+
className: d(De, n)
|
|
138
138
|
}
|
|
139
139
|
)
|
|
140
140
|
}
|
|
141
141
|
)
|
|
142
142
|
}
|
|
143
|
-
),
|
|
144
|
-
const e =
|
|
143
|
+
), Te = 7, Ie = 2, W = Q(null), j = () => {
|
|
144
|
+
const e = te(W);
|
|
145
145
|
if (e == null)
|
|
146
146
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
147
147
|
return e;
|
|
148
|
-
},
|
|
148
|
+
}, Fe = ({
|
|
149
149
|
initialOpen: e = !1,
|
|
150
150
|
placement: r = "bottom",
|
|
151
|
-
isTriggerClickable:
|
|
152
|
-
open:
|
|
153
|
-
onOpenChange:
|
|
151
|
+
isTriggerClickable: n = !1,
|
|
152
|
+
open: o,
|
|
153
|
+
onOpenChange: s
|
|
154
154
|
} = {}) => {
|
|
155
|
-
const [a, l] =
|
|
155
|
+
const [a, l] = ee(e), c = re(null), i = o ?? a, p = s ?? l, u = ae({
|
|
156
156
|
placement: r,
|
|
157
157
|
open: i,
|
|
158
|
-
onOpenChange:
|
|
159
|
-
whileElementsMounted:
|
|
158
|
+
onOpenChange: p,
|
|
159
|
+
whileElementsMounted: ue,
|
|
160
160
|
middleware: [
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
le(Te + Ie),
|
|
162
|
+
ie({
|
|
163
163
|
crossAxis: r.includes("-"),
|
|
164
164
|
fallbackAxisSideDirection: "start",
|
|
165
165
|
padding: 5
|
|
166
166
|
}),
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
ce({ padding: 5 }),
|
|
168
|
+
de({
|
|
169
169
|
element: c
|
|
170
170
|
})
|
|
171
171
|
]
|
|
172
|
-
}), f =
|
|
172
|
+
}), f = pe(u.context, {
|
|
173
173
|
move: !1,
|
|
174
|
-
enabled:
|
|
175
|
-
mouseOnly:
|
|
174
|
+
enabled: o == null,
|
|
175
|
+
mouseOnly: n,
|
|
176
176
|
delay: { open: 500, close: 0 }
|
|
177
|
-
}), y =
|
|
178
|
-
enabled:
|
|
179
|
-
}),
|
|
180
|
-
return
|
|
177
|
+
}), y = me(u.context, {
|
|
178
|
+
enabled: o == null
|
|
179
|
+
}), I = fe(u.context), g = be(u.context, { role: "tooltip" }), b = ge([f, y, I, g]);
|
|
180
|
+
return ne(
|
|
181
181
|
() => ({
|
|
182
182
|
open: i,
|
|
183
|
-
setOpen:
|
|
183
|
+
setOpen: p,
|
|
184
184
|
arrowRef: c,
|
|
185
|
-
...
|
|
185
|
+
...b,
|
|
186
186
|
...u
|
|
187
187
|
}),
|
|
188
|
-
[i,
|
|
188
|
+
[i, p, b, u]
|
|
189
189
|
);
|
|
190
|
-
},
|
|
190
|
+
}, Se = ({
|
|
191
191
|
children: e,
|
|
192
192
|
...r
|
|
193
193
|
}) => {
|
|
194
|
-
const
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
-
},
|
|
197
|
-
const
|
|
198
|
-
return
|
|
194
|
+
const n = Fe(r);
|
|
195
|
+
return /* @__PURE__ */ t(W.Provider, { value: n, children: e });
|
|
196
|
+
}, Pe = R(function({ style: r, ...n }, o) {
|
|
197
|
+
const s = j(), a = L([s.refs.setFloating, o]);
|
|
198
|
+
return s.open ? /* @__PURE__ */ t(he, { id: "tooltip-portal", children: /* @__PURE__ */ m(
|
|
199
199
|
"div",
|
|
200
200
|
{
|
|
201
201
|
ref: a,
|
|
202
202
|
style: {
|
|
203
|
-
...
|
|
203
|
+
...s.floatingStyles,
|
|
204
204
|
...r
|
|
205
205
|
},
|
|
206
|
-
...
|
|
206
|
+
...s.getFloatingProps(n),
|
|
207
207
|
className: d(
|
|
208
208
|
"z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",
|
|
209
|
-
|
|
209
|
+
s.getFloatingProps(n).className
|
|
210
210
|
),
|
|
211
211
|
children: [
|
|
212
|
-
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
|
|
212
|
+
n.children,
|
|
213
|
+
/* @__PURE__ */ t(
|
|
214
|
+
xe,
|
|
215
215
|
{
|
|
216
|
-
ref:
|
|
217
|
-
context:
|
|
216
|
+
ref: s.arrowRef,
|
|
217
|
+
context: s.context,
|
|
218
218
|
fill: "currentColor",
|
|
219
219
|
strokeWidth: 1,
|
|
220
220
|
className: "stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"
|
|
@@ -223,71 +223,113 @@ const xe = {
|
|
|
223
223
|
]
|
|
224
224
|
}
|
|
225
225
|
) }) : null;
|
|
226
|
-
}),
|
|
227
|
-
const a = j(), c = r && typeof r == "object" && "ref" in r && r.ref !== void 0 ? r.ref : void 0, i =
|
|
228
|
-
return
|
|
226
|
+
}), Ee = R(function({ children: r, asChild: n = !1, ...o }, s) {
|
|
227
|
+
const a = j(), c = r && typeof r == "object" && "ref" in r && r.ref !== void 0 ? r.ref : void 0, i = L([a.refs.setReference, s, c]);
|
|
228
|
+
return n && oe(r) ? se(
|
|
229
229
|
r,
|
|
230
230
|
a.getReferenceProps({
|
|
231
231
|
ref: i,
|
|
232
|
-
...
|
|
232
|
+
...o,
|
|
233
233
|
...r.props
|
|
234
234
|
})
|
|
235
|
-
) : /* @__PURE__ */
|
|
235
|
+
) : /* @__PURE__ */ t(
|
|
236
236
|
"span",
|
|
237
237
|
{
|
|
238
238
|
ref: i,
|
|
239
|
-
...a.getReferenceProps(
|
|
240
|
-
className:
|
|
239
|
+
...a.getReferenceProps(o),
|
|
240
|
+
className: o.className ?? "dial-tooltip-trigger text-left",
|
|
241
241
|
children: r
|
|
242
242
|
}
|
|
243
243
|
);
|
|
244
244
|
}), k = ({
|
|
245
245
|
hideTooltip: e,
|
|
246
246
|
tooltip: r,
|
|
247
|
-
children:
|
|
248
|
-
triggerClassName:
|
|
249
|
-
contentClassName:
|
|
247
|
+
children: n,
|
|
248
|
+
triggerClassName: o,
|
|
249
|
+
contentClassName: s,
|
|
250
250
|
...a
|
|
251
|
-
}) => e || !r ? /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
251
|
+
}) => e || !r ? /* @__PURE__ */ t("span", { className: o, children: n }) : /* @__PURE__ */ m(Se, { ...a, children: [
|
|
252
|
+
/* @__PURE__ */ t(Ee, { className: d(o, "truncate"), children: n }),
|
|
253
|
+
/* @__PURE__ */ t(
|
|
254
|
+
Pe,
|
|
255
255
|
{
|
|
256
256
|
className: d(
|
|
257
257
|
"text-primary",
|
|
258
|
-
|
|
258
|
+
s,
|
|
259
259
|
"max-w-[300px]",
|
|
260
260
|
(e || !r) && "hidden"
|
|
261
261
|
),
|
|
262
262
|
children: r
|
|
263
263
|
}
|
|
264
264
|
)
|
|
265
|
-
] }), Re =
|
|
265
|
+
] }), Re = 18, E = {
|
|
266
|
+
size: Re,
|
|
267
|
+
stroke: 2
|
|
268
|
+
}, $e = ({
|
|
269
|
+
label: e,
|
|
270
|
+
id: r,
|
|
271
|
+
checked: n,
|
|
272
|
+
indeterminate: o,
|
|
273
|
+
disabled: s,
|
|
274
|
+
ariaLabel: a,
|
|
275
|
+
onChange: l
|
|
276
|
+
}) => {
|
|
277
|
+
const c = A(
|
|
278
|
+
(u) => {
|
|
279
|
+
u.stopPropagation(), l?.(u.target.checked, r);
|
|
280
|
+
},
|
|
281
|
+
[l, r]
|
|
282
|
+
), i = d(
|
|
283
|
+
"flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",
|
|
284
|
+
`${n ? "" : 'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded before:mr-2'}`,
|
|
285
|
+
s ? "pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4" : ""
|
|
286
|
+
), p = d(
|
|
287
|
+
"mr-2 border rounded",
|
|
288
|
+
s ? "bg-layer-4 border-icon-secondary" : ""
|
|
289
|
+
);
|
|
290
|
+
return /* @__PURE__ */ m("label", { className: i, htmlFor: r, children: [
|
|
291
|
+
n && (o ? /* @__PURE__ */ t(q, { className: p, ...E }) : /* @__PURE__ */ t(J, { className: p, ...E })),
|
|
292
|
+
e && /* @__PURE__ */ t(k, { tooltip: e, triggerClassName: "flex-1 min-w-0", children: /* @__PURE__ */ t("p", { className: "text-primary w-full truncate", children: e }) }),
|
|
293
|
+
/* @__PURE__ */ t(
|
|
294
|
+
"input",
|
|
295
|
+
{
|
|
296
|
+
type: "checkbox",
|
|
297
|
+
onChange: c,
|
|
298
|
+
id: r,
|
|
299
|
+
checked: n,
|
|
300
|
+
"aria-checked": o ? "mixed" : n,
|
|
301
|
+
"aria-disabled": s || void 0,
|
|
302
|
+
"aria-label": e ? void 0 : a,
|
|
303
|
+
className: "invisible w-0 h-0"
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
] });
|
|
307
|
+
}, Ae = ({
|
|
266
308
|
value: e,
|
|
267
309
|
textareaId: r,
|
|
268
|
-
placeholder:
|
|
269
|
-
cssClass:
|
|
270
|
-
disabled:
|
|
310
|
+
placeholder: n,
|
|
311
|
+
cssClass: o = "",
|
|
312
|
+
disabled: s,
|
|
271
313
|
invalid: a,
|
|
272
314
|
readonly: l,
|
|
273
315
|
onChange: c
|
|
274
|
-
}) => /* @__PURE__ */
|
|
316
|
+
}) => /* @__PURE__ */ t(k, { tooltip: e, triggerClassName: "flex", children: /* @__PURE__ */ t(
|
|
275
317
|
"textarea",
|
|
276
318
|
{
|
|
277
319
|
id: r,
|
|
278
|
-
placeholder:
|
|
320
|
+
placeholder: n,
|
|
279
321
|
value: e || "",
|
|
280
|
-
disabled:
|
|
322
|
+
disabled: s,
|
|
281
323
|
className: d(
|
|
282
324
|
"dial-textarea dial-input",
|
|
283
325
|
a ? "dial-input-error" : "",
|
|
284
|
-
|
|
326
|
+
s && "dial-input-disable",
|
|
285
327
|
l && "dial-input-readonly",
|
|
286
|
-
|
|
328
|
+
o
|
|
287
329
|
),
|
|
288
330
|
onChange: (i) => !l && c?.(i.currentTarget.value)
|
|
289
331
|
}
|
|
290
|
-
) }),
|
|
332
|
+
) }), Le = [
|
|
291
333
|
"ArrowLeft",
|
|
292
334
|
"ArrowRight",
|
|
293
335
|
"ArrowUp",
|
|
@@ -299,273 +341,274 @@ const xe = {
|
|
|
299
341
|
"Escape",
|
|
300
342
|
"Home",
|
|
301
343
|
"End"
|
|
302
|
-
],
|
|
303
|
-
if ((r === "number" ||
|
|
344
|
+
], _e = (e, r, n, o) => {
|
|
345
|
+
if ((r === "number" || n !== void 0 || o !== void 0) && !Le.includes(e.key) && !(e.key === "-" && e.currentTarget.selectionStart === 0 && (n === void 0 || n < 0)) && !(e.key === "." && r === "number" && !e.currentTarget.value.includes("."))) {
|
|
304
346
|
if (!/^[0-9]$/.test(e.key)) {
|
|
305
347
|
e.preventDefault();
|
|
306
348
|
return;
|
|
307
349
|
}
|
|
308
|
-
if (
|
|
350
|
+
if (n !== void 0 || o !== void 0) {
|
|
309
351
|
const a = e.currentTarget.value, l = e.currentTarget.selectionStart || 0, c = a.slice(0, l) + e.key + a.slice(l), i = parseFloat(c);
|
|
310
352
|
if (!isNaN(i)) {
|
|
311
|
-
if (
|
|
353
|
+
if (n !== void 0 && i < n) {
|
|
312
354
|
e.preventDefault();
|
|
313
355
|
return;
|
|
314
356
|
}
|
|
315
|
-
if (
|
|
357
|
+
if (o !== void 0 && i > o) {
|
|
316
358
|
e.preventDefault();
|
|
317
359
|
return;
|
|
318
360
|
}
|
|
319
361
|
}
|
|
320
362
|
}
|
|
321
363
|
}
|
|
322
|
-
},
|
|
364
|
+
}, F = ({
|
|
323
365
|
iconBeforeInput: e,
|
|
324
366
|
iconAfterInput: r,
|
|
325
|
-
hideBorder:
|
|
326
|
-
value:
|
|
327
|
-
elementId:
|
|
367
|
+
hideBorder: n,
|
|
368
|
+
value: o,
|
|
369
|
+
elementId: s,
|
|
328
370
|
placeholder: a = "",
|
|
329
371
|
cssClass: l = "",
|
|
330
372
|
containerCssClass: c,
|
|
331
373
|
tooltipTriggerClassName: i,
|
|
332
|
-
type:
|
|
374
|
+
type: p = "text",
|
|
333
375
|
disabled: u,
|
|
334
376
|
readonly: f,
|
|
335
377
|
invalid: y,
|
|
336
|
-
onChange:
|
|
337
|
-
min:
|
|
338
|
-
max:
|
|
339
|
-
prefix:
|
|
378
|
+
onChange: I,
|
|
379
|
+
min: g,
|
|
380
|
+
max: b,
|
|
381
|
+
prefix: S,
|
|
340
382
|
suffix: P,
|
|
341
|
-
textBeforeInput:
|
|
342
|
-
textAfterInput:
|
|
383
|
+
textBeforeInput: C,
|
|
384
|
+
textAfterInput: v
|
|
343
385
|
}) => {
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
},
|
|
347
|
-
const w =
|
|
348
|
-
if (
|
|
386
|
+
const O = (h) => h.target.blur(), B = p === "number" || g !== void 0 || b !== void 0, H = (h) => {
|
|
387
|
+
_e(h, p, g, b);
|
|
388
|
+
}, U = (h) => {
|
|
389
|
+
const w = h.currentTarget.value;
|
|
390
|
+
if (B && w !== "") {
|
|
349
391
|
const D = parseFloat(w);
|
|
350
|
-
if (isNaN(D) && w !== "-" && w !== "." || !isNaN(D) && (
|
|
392
|
+
if (isNaN(D) && w !== "-" && w !== "." || !isNaN(D) && (g !== void 0 && D < g || b !== void 0 && D > b))
|
|
351
393
|
return;
|
|
352
394
|
}
|
|
353
|
-
|
|
395
|
+
I?.(w);
|
|
354
396
|
};
|
|
355
|
-
return /* @__PURE__ */
|
|
397
|
+
return /* @__PURE__ */ m(
|
|
356
398
|
"div",
|
|
357
399
|
{
|
|
358
400
|
className: d(
|
|
359
401
|
"dial-input-field flex flex-row items-center justify-between",
|
|
360
|
-
|
|
402
|
+
n ? "dial-input-no-border" : "dial-input",
|
|
361
403
|
y && "dial-input-error",
|
|
362
404
|
u && "dial-input-disable",
|
|
363
405
|
f && "dial-input-readonly",
|
|
364
|
-
!
|
|
365
|
-
!
|
|
406
|
+
!C && "pl-1",
|
|
407
|
+
!v && "pr-1",
|
|
366
408
|
c
|
|
367
409
|
),
|
|
368
410
|
children: [
|
|
369
|
-
|
|
370
|
-
|
|
411
|
+
C && /* @__PURE__ */ t(k, { tooltip: C, children: /* @__PURE__ */ t(
|
|
412
|
+
F,
|
|
371
413
|
{
|
|
372
414
|
hideBorder: !0,
|
|
373
415
|
containerCssClass: "rounded-r-none border-r-0",
|
|
374
416
|
cssClass: "px-2 overflow-hidden overflow-ellipsis dial-small",
|
|
375
|
-
value:
|
|
417
|
+
value: C,
|
|
376
418
|
disabled: !0,
|
|
377
|
-
elementId:
|
|
419
|
+
elementId: C + "textBefore"
|
|
378
420
|
}
|
|
379
421
|
) }),
|
|
380
|
-
|
|
422
|
+
S && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pl-2", children: [
|
|
381
423
|
" ",
|
|
382
|
-
|
|
424
|
+
S
|
|
383
425
|
] }),
|
|
384
|
-
/* @__PURE__ */
|
|
385
|
-
/* @__PURE__ */
|
|
426
|
+
/* @__PURE__ */ t(N, { icon: e, className: "pl-2" }),
|
|
427
|
+
/* @__PURE__ */ t(k, { tooltip: o, triggerClassName: i, children: /* @__PURE__ */ t(
|
|
386
428
|
"input",
|
|
387
429
|
{
|
|
388
|
-
type:
|
|
430
|
+
type: p,
|
|
389
431
|
autoComplete: "off",
|
|
390
|
-
id:
|
|
432
|
+
id: s,
|
|
391
433
|
placeholder: a,
|
|
392
|
-
value:
|
|
393
|
-
title:
|
|
434
|
+
value: o ?? "",
|
|
435
|
+
title: o ? String(o) : "",
|
|
394
436
|
disabled: u,
|
|
395
437
|
className: d("border-0 bg-transparent px-2", l),
|
|
396
|
-
onChange: (
|
|
397
|
-
onKeyDown:
|
|
398
|
-
onWheel:
|
|
399
|
-
min:
|
|
400
|
-
max:
|
|
438
|
+
onChange: (h) => !f && U?.(h),
|
|
439
|
+
onKeyDown: H,
|
|
440
|
+
onWheel: O,
|
|
441
|
+
min: g,
|
|
442
|
+
max: b
|
|
401
443
|
}
|
|
402
444
|
) }),
|
|
403
|
-
/* @__PURE__ */
|
|
404
|
-
P && /* @__PURE__ */
|
|
445
|
+
/* @__PURE__ */ t(N, { icon: r, className: "pr-2" }),
|
|
446
|
+
P && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pr-2", children: [
|
|
405
447
|
" ",
|
|
406
448
|
P
|
|
407
449
|
] }),
|
|
408
|
-
|
|
409
|
-
|
|
450
|
+
v && /* @__PURE__ */ t(k, { tooltip: v, children: /* @__PURE__ */ t(
|
|
451
|
+
F,
|
|
410
452
|
{
|
|
411
453
|
hideBorder: !0,
|
|
412
454
|
containerCssClass: "rounded-l-none border-l-0",
|
|
413
455
|
cssClass: "px-2",
|
|
414
|
-
value:
|
|
456
|
+
value: v,
|
|
415
457
|
disabled: !0,
|
|
416
|
-
elementId:
|
|
458
|
+
elementId: v + "textAfter"
|
|
417
459
|
}
|
|
418
460
|
) })
|
|
419
461
|
]
|
|
420
462
|
}
|
|
421
463
|
);
|
|
422
|
-
},
|
|
464
|
+
}, ze = /^0+\.(\d+)?$/, We = /^0+/, M = ({
|
|
423
465
|
fieldTitle: e,
|
|
424
466
|
errorText: r,
|
|
425
|
-
optional:
|
|
426
|
-
elementCssClass:
|
|
427
|
-
elementContainerCssClass:
|
|
467
|
+
optional: n,
|
|
468
|
+
elementCssClass: o,
|
|
469
|
+
elementContainerCssClass: s,
|
|
428
470
|
elementId: a,
|
|
429
471
|
containerCssClass: l,
|
|
430
472
|
readonly: c,
|
|
431
473
|
defaultEmptyText: i,
|
|
432
|
-
min:
|
|
474
|
+
min: p,
|
|
433
475
|
max: u,
|
|
434
476
|
...f
|
|
435
|
-
}) => /* @__PURE__ */
|
|
436
|
-
/* @__PURE__ */
|
|
437
|
-
|
|
477
|
+
}) => /* @__PURE__ */ m("div", { className: d("flex flex-col", l), children: [
|
|
478
|
+
/* @__PURE__ */ t(
|
|
479
|
+
z,
|
|
438
480
|
{
|
|
439
481
|
fieldTitle: e,
|
|
440
|
-
optional:
|
|
482
|
+
optional: n,
|
|
441
483
|
htmlFor: a
|
|
442
484
|
}
|
|
443
485
|
),
|
|
444
|
-
c ? /* @__PURE__ */
|
|
445
|
-
/* @__PURE__ */
|
|
446
|
-
|
|
486
|
+
c ? /* @__PURE__ */ t("span", { children: f.value || (i ?? "None") }) : /* @__PURE__ */ m(K, { children: [
|
|
487
|
+
/* @__PURE__ */ t(
|
|
488
|
+
F,
|
|
447
489
|
{
|
|
448
490
|
elementId: a,
|
|
449
|
-
cssClass:
|
|
450
|
-
containerCssClass:
|
|
491
|
+
cssClass: o,
|
|
492
|
+
containerCssClass: s,
|
|
451
493
|
invalid: r != null,
|
|
452
|
-
min:
|
|
494
|
+
min: p,
|
|
453
495
|
max: u,
|
|
454
496
|
...f
|
|
455
497
|
}
|
|
456
498
|
),
|
|
457
|
-
/* @__PURE__ */
|
|
499
|
+
/* @__PURE__ */ t(_, { errorText: r })
|
|
458
500
|
] })
|
|
459
|
-
] }),
|
|
501
|
+
] }), Ge = ({
|
|
460
502
|
onChange: e,
|
|
461
503
|
value: r,
|
|
462
|
-
min:
|
|
463
|
-
max:
|
|
464
|
-
...
|
|
504
|
+
min: n,
|
|
505
|
+
max: o,
|
|
506
|
+
...s
|
|
465
507
|
}) => {
|
|
466
|
-
const a = (l) => String(l)?.match(
|
|
467
|
-
return /* @__PURE__ */
|
|
468
|
-
|
|
508
|
+
const a = (l) => String(l)?.match(ze) ? String(l)?.replace(We, "0") : Number(l);
|
|
509
|
+
return /* @__PURE__ */ t(
|
|
510
|
+
M,
|
|
469
511
|
{
|
|
470
512
|
type: "number",
|
|
471
513
|
onChange: (l) => e?.(a(l)),
|
|
472
514
|
value: r,
|
|
473
|
-
min:
|
|
474
|
-
max:
|
|
475
|
-
...
|
|
515
|
+
min: n,
|
|
516
|
+
max: o,
|
|
517
|
+
...s
|
|
476
518
|
}
|
|
477
519
|
);
|
|
478
|
-
},
|
|
520
|
+
}, Ze = ({
|
|
479
521
|
onChange: e,
|
|
480
522
|
...r
|
|
481
|
-
}) => /* @__PURE__ */
|
|
482
|
-
|
|
523
|
+
}) => /* @__PURE__ */ t(
|
|
524
|
+
M,
|
|
483
525
|
{
|
|
484
526
|
type: "text",
|
|
485
|
-
onChange: (
|
|
527
|
+
onChange: (n) => e?.(n),
|
|
486
528
|
...r
|
|
487
529
|
}
|
|
488
|
-
),
|
|
530
|
+
), Ve = ({
|
|
489
531
|
fieldTitle: e,
|
|
490
532
|
optional: r,
|
|
491
|
-
elementId:
|
|
492
|
-
elementCssClass:
|
|
493
|
-
errorText:
|
|
533
|
+
elementId: n,
|
|
534
|
+
elementCssClass: o,
|
|
535
|
+
errorText: s,
|
|
494
536
|
...a
|
|
495
|
-
}) => /* @__PURE__ */
|
|
496
|
-
/* @__PURE__ */
|
|
497
|
-
|
|
537
|
+
}) => /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
|
|
538
|
+
/* @__PURE__ */ t(
|
|
539
|
+
z,
|
|
498
540
|
{
|
|
499
541
|
fieldTitle: e,
|
|
500
542
|
optional: r,
|
|
501
|
-
htmlFor:
|
|
543
|
+
htmlFor: n
|
|
502
544
|
}
|
|
503
545
|
),
|
|
504
|
-
/* @__PURE__ */
|
|
505
|
-
|
|
546
|
+
/* @__PURE__ */ t(
|
|
547
|
+
Ae,
|
|
506
548
|
{
|
|
507
|
-
textareaId:
|
|
508
|
-
cssClass:
|
|
549
|
+
textareaId: n,
|
|
550
|
+
cssClass: o,
|
|
509
551
|
...a
|
|
510
552
|
}
|
|
511
553
|
),
|
|
512
|
-
/* @__PURE__ */
|
|
513
|
-
] }),
|
|
554
|
+
/* @__PURE__ */ t(_, { errorText: s })
|
|
555
|
+
] }), Xe = ({
|
|
514
556
|
title: e,
|
|
515
557
|
switchId: r,
|
|
516
|
-
isOn:
|
|
517
|
-
disabled:
|
|
518
|
-
onChange:
|
|
558
|
+
isOn: n = !1,
|
|
559
|
+
disabled: o,
|
|
560
|
+
onChange: s
|
|
519
561
|
}) => {
|
|
520
562
|
const a = d(
|
|
521
|
-
"flex w-[36px] h-[18px]
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
), l =
|
|
563
|
+
"flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",
|
|
564
|
+
n ? "flex-row-reverse" : "flex-row",
|
|
565
|
+
o ? "pointer-events-none" : "",
|
|
566
|
+
o ? n ? "bg-controls-disable" : "bg-layer-4" : n ? "bg-accent-primary" : "bg-layer-4"
|
|
567
|
+
), l = A(
|
|
526
568
|
(c) => {
|
|
527
|
-
c.stopPropagation(),
|
|
569
|
+
c.stopPropagation(), s?.(!n);
|
|
528
570
|
},
|
|
529
|
-
[
|
|
571
|
+
[s, n]
|
|
530
572
|
);
|
|
531
|
-
return /* @__PURE__ */
|
|
532
|
-
/* @__PURE__ */
|
|
573
|
+
return /* @__PURE__ */ m("div", { className: "flex flex-row items-center", children: [
|
|
574
|
+
/* @__PURE__ */ t(
|
|
533
575
|
"input",
|
|
534
576
|
{
|
|
535
577
|
type: "checkbox",
|
|
536
578
|
onChange: l,
|
|
537
579
|
id: r,
|
|
538
|
-
disabled:
|
|
580
|
+
disabled: o,
|
|
539
581
|
className: "invisible w-0 h-0",
|
|
540
|
-
checked:
|
|
582
|
+
checked: n
|
|
541
583
|
}
|
|
542
584
|
),
|
|
543
|
-
/* @__PURE__ */
|
|
585
|
+
/* @__PURE__ */ t("label", { htmlFor: r, className: a, children: /* @__PURE__ */ t(
|
|
544
586
|
"span",
|
|
545
587
|
{
|
|
546
588
|
className: d(
|
|
547
589
|
"size-3 rounded-full",
|
|
548
|
-
|
|
590
|
+
o ? n ? "bg-layer-4" : "bg-controls-disable" : "bg-controls-enable-primary"
|
|
549
591
|
)
|
|
550
592
|
}
|
|
551
593
|
) }),
|
|
552
|
-
e && /* @__PURE__ */
|
|
594
|
+
e && /* @__PURE__ */ t("span", { className: "pl-2 dial-small text-primary", children: e })
|
|
553
595
|
] });
|
|
554
596
|
};
|
|
555
597
|
export {
|
|
556
598
|
x as AlertVariant,
|
|
557
599
|
T as ButtonVariant,
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
600
|
+
Ue as DialAlert,
|
|
601
|
+
ye as DialButton,
|
|
602
|
+
$e as DialCheckbox,
|
|
603
|
+
_ as DialErrorText,
|
|
604
|
+
z as DialFieldLabel,
|
|
562
605
|
N as DialIcon,
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
606
|
+
F as DialInput,
|
|
607
|
+
Ke as DialLoader,
|
|
608
|
+
Ge as DialNumberInputField,
|
|
609
|
+
Xe as DialSwitch,
|
|
610
|
+
Ve as DialTextAreaField,
|
|
611
|
+
Ze as DialTextInputField,
|
|
612
|
+
Ae as DialTextarea,
|
|
570
613
|
k as DialTooltip
|
|
571
614
|
};
|
package/dist/index.css
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
.dial-h1{font-weight:600}.dial-h1,.dial-h2{font-size:20px;line-height:24px}.dial-h2{font-weight:400}.dial-h3{font-weight:600;line-height:18px}.dial-body,.dial-h3{font-size:16px}.dial-body{font-weight:400;line-height:28px}.dial-small{font-weight:400}.dial-small,.dial-small-semi{font-size:14px;line-height:16px}.dial-small-semi{font-weight:600}.dial-small-medium{font-weight:400;font-size:14px;line-height:16px}.dial-small-150{font-weight:400;font-size:14px;line-height:21px}.dial-tiny{line-height:14px}.dial-tiny,.dial-tiny-150{font-weight:400;font-size:12px}.dial-tiny-150{line-height:18px}.dial-caption{font-weight:400;font-size:10px;line-height:12px}h1{font-weight:600}h1,h2{font-size:20px;line-height:24px}h2{font-weight:400}h3{font-weight:600;font-size:16px;line-height:18px}.dial-base-button{display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px}.dial-base-button-disable{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}.dial-primary-button{background-color:var(--controls-bg-accent,#5c8dea);color:var(--controls-primary,#fcfcfc);display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px;&:focus,&:hover{background-color:var(--controls-bg-accent-hover,#4878d2)}&:focus{border-color:var(--stroke-hover,#f3f4f6)}&:disabled{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}}.dial-secondary-button{background-color:transparent;color:var(--text-primary,#f3f4f6);display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px;border-color:var(--stroke-primary,#333942);&:focus,&:hover{background-color:var(--bg-layer-4,#333942)}&:focus{border-color:var(--stroke-hover,#f3f4f6)}&:disabled{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}}.dial-tertiary-button{background-color:transparent;color:var(--text-accent-primary,#5c8dea);display:flex;flex-direction:row;align-items:center;padding:.5rem .75rem;border-radius:3px;border:1px solid transparent;font-weight:400;font-size:14px;line-height:16px;min-width:38px;min-height:38px;&:focus,&:hover{background-color:var(--controls-bg-accent-alpha,#5c8dea2b)}&:active,&:focus{border-color:var(--stroke-accent-primary,#5c8dea)}&:disabled{pointer-events:none;background-color:var(--controls-bg-disable,#7f8792);color:var(--controls-disable,#333942)}}.dial-input{border-radius:3px;border-width:1px;border-style:solid;border-color:var(--stroke-primary,#333942);&:hover{border-color:var(--stroke-hover,#f3f4f6)}&:focus,&:focus-within{border-color:var(--stroke-accent-primary,#5c8dea)}}.dial-input,.dial-input-no-border{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;background-color:transparent;font-weight:400;font-size:14px;line-height:16px;width:100%;padding:.5rem .75rem;outline-width:0;&:not(:-moz-placeholder){color:var(--text-primary,#f3f4f6)}&:not(:placeholder-shown){color:var(--text-primary,#f3f4f6)}&:disabled{background-color:var(--bg-layer-3,#222932)}&:disabled:not(:-moz-placeholder){color:var(--text-secondary,#7f8792)}&:disabled,&:disabled:not(:placeholder-shown){color:var(--text-secondary,#7f8792)}}.dial-input-disable,.dial-input-readonly{background-color:var(--bg-layer-3,#222932)}.dial-input-disable:not(:-moz-placeholder){color:var(--text-secondary,#7f8792)}.dial-input-disable,.dial-input-disable:not(:placeholder-shown){color:var(--text-secondary,#7f8792)}.dial-input-error{border-color:var(--stroke-error,#f76464)}.dial-input-field{height:38px}input{-moz-appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}&:focus{outline:none}}.dial-textarea{min-height:72px;resize:both;overflow:auto;white-space:normal}@layer ui{*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }
|
|
2
|
-
/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.relative{position:relative}.z-\[55\]{z-index:55}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.size-3{width:.75rem;height:.75rem}.h-0{height:0}.h-\[
|
|
2
|
+
/*! tailwindcss v3.4.17 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width:640px){.container{max-width:640px}}@media (min-width:768px){.container{max-width:768px}}@media (min-width:1024px){.container{max-width:1024px}}@media (min-width:1280px){.container{max-width:1280px}}@media (min-width:1536px){.container{max-width:1536px}}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.relative{position:relative}.z-\[55\]{z-index:55}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mr-2{margin-right:.5rem}.mt-1{margin-top:.25rem}.inline{display:inline}.flex{display:flex}.table{display:table}.grid{display:grid}.hidden{display:none}.size-3{width:.75rem;height:.75rem}.h-0{height:0}.h-\[18px\]{height:18px}.h-\[300px\]{height:300px}.h-\[38px\]{height:38px}.h-full{height:100%}.min-h-4{min-height:1rem}.min-h-\[72px\]{min-height:72px}.w-0{width:0}.w-2{width:.5rem}.w-80{width:20rem}.w-\[250px\]{width:250px}.w-\[36px\]{width:36px}.w-\[500px\]{width:500px}.w-full{width:100%}.min-w-0{min-width:0}.min-w-\[800px\]{min-width:800px}.max-w-80{max-width:20rem}.max-w-\[1000px\]{max-width:1000px}.max-w-\[1200px\]{max-width:1200px}.max-w-\[1400px\]{max-width:1400px}.max-w-\[300px\]{max-width:300px}.flex-1{flex:1 1 0%}.flex-shrink-0,.shrink-0{flex-shrink:0}.grow-0{flex-grow:0}.basis-auto{flex-basis:auto}.border-collapse{border-collapse:collapse}@keyframes spin{to{transform:rotate(1turn)}}.animate-spin-steps{animation:spin .75s steps(6) infinite}.cursor-pointer{cursor:pointer}.resize{resize:both}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.grid-cols-\[minmax\(0\2c 100px\)_1fr\]{grid-template-columns:minmax(0,100px) 1fr}.flex-row{flex-direction:row}.flex-row-reverse{flex-direction:row-reverse}.flex-col{flex-direction:column}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-2{gap:.5rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.gap-x-2{-moz-column-gap:.5rem;column-gap:.5rem}.gap-x-\[160px\]{-moz-column-gap:160px;column-gap:160px}.gap-y-10{row-gap:2.5rem}.gap-y-6{row-gap:1.5rem}.gap-y-\[80px\]{row-gap:80px}.overflow-hidden,.truncate{overflow:hidden}.truncate{white-space:nowrap}.overflow-ellipsis,.truncate{text-overflow:ellipsis}.whitespace-normal{white-space:normal}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:3px}.rounded-full{border-radius:9999px}.rounded-l-none{border-top-left-radius:0;border-bottom-left-radius:0}.rounded-r-none{border-top-right-radius:0;border-bottom-right-radius:0}.border{border-width:1px}.border-0{border-width:0}.border-l-0{border-left-width:0}.border-r-0{border-right-width:0}.border-solid{border-style:solid}.border-dashed{border-style:dashed}.border-error{border-color:var(--stroke-error,#f76464)}.border-icon-secondary{border-color:var(--icon-secondary,#7f8792)}.border-primary{border-color:var(--stroke-primary,#333942)}.bg-accent-primary{background-color:var(--bg-accent-primary,#5c8dea)}.bg-blackout{background-color:var(--bg-blackout,#090d13b3)}.bg-controls-accent{background-color:var(--controls-bg-accent,#5c8dea)}.bg-controls-disable{background-color:var(--controls-bg-disable,#7f8792)}.bg-controls-enable-primary{background-color:var(--controls-enable-primary,#fcfcfc)}.bg-error{background-color:var(--bg-error,#402027)}.bg-info{background-color:var(--bg-info,#1c2c47)}.bg-layer-2{background-color:var(--bg-layer-2,#141a23)}.bg-layer-3{background-color:var(--bg-layer-3,#222932)}.bg-layer-4{background-color:var(--bg-layer-4,#333942)}.bg-success{background-color:var(--bg-success,#1d3841)}.bg-transparent{background-color:transparent}.bg-warning{background-color:var(--bg-warning,#3f3d25)}.stroke-primary{stroke:var(--stroke-primary,#333942)}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-2{padding-left:.5rem}.pr-1{padding-right:.25rem}.pr-2{padding-right:.5rem}.pr-4{padding-right:1rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.font-medium{font-weight:500}.font-semibold{font-weight:600}.text-\[var\(--bg-layer-0\2c _\#000000\)\]{color:var(--bg-layer-0,#000)}.text-accent-primary{color:var(--text-accent-primary,#5c8dea)}.text-controls-disable{color:var(--controls-disable,#333942)}.text-error{color:var(--text-error,#f76464)}.text-icon-accent-primary{color:var(--icon-accent-primary,#5c8dea)}.text-icon-accent-secondary{color:var(--icon-accent-secondary,#37babc)}.text-info{color:var(--text-info,#5c8dea)}.text-primary{color:var(--text-primary,#f3f4f6)}.text-secondary{color:var(--text-secondary,#7f8792)}.text-success{color:var(--text-success,#37babc)}.text-warning{color:var(--text-warning,#f4ce46)}.shadow{--tw-shadow:0 0 4px 0 var(--bg-blackout,#090d13b3);--tw-shadow-colored:0 0 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.outline-offset-0{outline-offset:0}.blur{--tw-blur:blur(8px);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}}.before\:mr-2:before{content:var(--tw-content);margin-right:.5rem}.before\:inline-block:before{content:var(--tw-content);display:inline-block}.before\:h-\[18px\]:before{content:var(--tw-content);height:18px}.before\:w-\[18px\]:before{content:var(--tw-content);width:18px}.before\:rounded:before{content:var(--tw-content);border-radius:3px}.before\:border:before{content:var(--tw-content);border-width:1px}.before\:border-hover:before{content:var(--tw-content);border-color:var(--stroke-hover,#f3f4f6)}.before\:border-icon-secondary:before{content:var(--tw-content);border-color:var(--icon-secondary,#7f8792)}.before\:bg-layer-4:before{content:var(--tw-content);background-color:var(--bg-layer-4,#333942)}.before\:content-\[\"\"\]:before{--tw-content:"";content:var(--tw-content)}.hover\:text-primary:hover{color:var(--text-primary,#f3f4f6)}.focus-visible\:outline:focus-visible{outline-style:solid}@media (min-width:640px){.sm\:inline{display:inline}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
export interface DialCheckboxProps {
|
|
3
|
+
id: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
checked: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
indeterminate?: boolean;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
onChange?: (value?: boolean, id?: string) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A Checkbox component with styling options
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <DialCheckbox
|
|
17
|
+
* id="checkbox"
|
|
18
|
+
* label="Dial Checkbox"
|
|
19
|
+
* checked={true}
|
|
20
|
+
* disabled={false}
|
|
21
|
+
* onChange={(value) => console.log(value)}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @param id - Unique identifier for the checkbox element
|
|
26
|
+
* @param [label] - The label text for the field
|
|
27
|
+
* @param [checked] - The current value of the checkbox
|
|
28
|
+
* @param [disabled=false] - Whether the checkbox is disabled
|
|
29
|
+
* @param [indeterminate=false] - indeterminate state
|
|
30
|
+
* @param [ariaLabel] - Accessible label for screen readers when no title is provided
|
|
31
|
+
* @param [onChange] - Callback function called when the checkbox value changes
|
|
32
|
+
*/
|
|
33
|
+
export declare const DialCheckbox: FC<DialCheckboxProps>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { DialFieldLabel } from './components/Field/Field';
|
|
|
4
4
|
export { DialIcon } from './components/Icon/Icon';
|
|
5
5
|
export { DialAlert } from './components/Alert/Alert';
|
|
6
6
|
export { DialLoader } from './components/Loader/Loader';
|
|
7
|
+
export { DialCheckbox } from './components/Checkbox/Checkbox';
|
|
7
8
|
export { DialTextarea } from './components/Textarea/Textarea';
|
|
8
9
|
export { DialTextAreaField } from './components/TextAreaField/TextAreaField';
|
|
9
10
|
export { DialTooltip } from './components/Tooltip/Tooltip';
|