@epam/ai-dial-ui-kit 0.2.0-rc.21 → 0.2.0-rc.23
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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),i=require("classnames"),C=require("@tabler/icons-react"),j=require("react"),p=require("@floating-ui/react"),_=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),L=({fieldTitle:e,htmlFor:r,optional:t,optionalText:n,cssClass:a})=>e?s.jsxs("label",{className:i("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,D=({icon:e,className:r})=>e?s.jsx("span",{className:i("flex-shrink-0",r),children:e}):null;var w=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e.Danger="danger",e))(w||{});const se={[w.Primary]:"dial-primary-button",[w.Secondary]:"dial-secondary-button",[w.Tertiary]:"dial-tertiary-button",[w.Danger]:"dial-danger-button"},T=({title:e,variant:r,cssClass:t,ref:n,onClick:a,disable:l,iconAfter:o,iconBefore:c,hideTitleOnMobile:d,ariaLabel:u})=>{const x=i("dial-small-semi",o?"mr-2":"",c?"ml-2":"",d?"hidden sm:inline":"inline"),f=i(r&&se[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:n,type:"button",className:f,onClick:h=>a?.(h),disabled:l,"aria-label":e||u,children:[s.jsx(D,{icon:c}),e&&s.jsx("span",{className:x,children:e}),s.jsx(D,{icon:o})]})};var S=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(S||{});const re={info:s.jsx(C.IconInfoCircle,{size:24,stroke:2}),error:s.jsx(C.IconAlertCircle,{size:24,stroke:2}),warning:s.jsx(C.IconAlertTriangle,{size:24,stroke:2}),success:s.jsx(C.IconCircleCheck,{size:24,stroke:2})},te={[S.Info]:"bg-info border-info text-info",[S.Success]:"bg-success border-success text-success",[S.Warning]:"bg-warning border-warning text-warning",[S.Error]:"bg-error border-error text-error"},ne="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",ae=({variant:e=S.Info,message:r,cssClass:t,closable:n=!1,onClose:a})=>s.jsxs("div",{role:"alert",className:i(ne,te[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(D,{icon:re[e]}),s.jsx("div",{className:"text-primary",children:r})]}),n&&s.jsx(T,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(C.IconX,{size:16}),onClick:l=>a?.(l)})]}),le="flex items-center justify-center text-secondary",oe="shrink-0 grow-0 basis-auto animate-spin-steps",q=({size:e=18,cssClass:r,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>s.jsx("div",{role:"status","aria-label":a,className:i({[le]:!0,"w-full h-full":n,[r||""]:!!r}),children:s.jsx(D,{icon:s.jsx(C.IconLoader,{width:e,height:e,className:i(oe,t)})})}),ie=7,ce=2,H=j.createContext(null),G=()=>{const e=j.useContext(H);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},de=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[l,o]=j.useState(e),c=j.useRef(null),d=n??l,u=a??o,x=p.useFloating({placement:r,open:d,onOpenChange:u,whileElementsMounted:p.autoUpdate,middleware:[p.offset(ie+ce),p.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),p.shift({padding:5}),p.arrow({element:c})]}),f=p.useHover(x.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),h=p.useFocus(x.context,{enabled:n==null}),g=p.useDismiss(x.context),y=p.useRole(x.context,{role:"tooltip"}),m=p.useInteractions([f,h,g,y]);return j.useMemo(()=>({open:d,setOpen:u,arrowRef:c,...m,...x}),[d,u,m,x])},ue=({children:e,...r})=>{const t=de(r);return s.jsx(H.Provider,{value:t,children:e})},xe=j.forwardRef(function({style:r,...t},n){const a=G(),l=p.useMergeRefs([a.refs.setFloating,n]);return a.open?s.jsx(p.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:l,style:{...a.floatingStyles,...r},...a.getFloatingProps(t),className:i("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(p.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),pe=j.forwardRef(function({children:r,asChild:t=!1,...n},a){const l=G(),c=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,d=p.useMergeRefs([l.refs.setReference,a,c]);return t&&j.isValidElement(r)?j.cloneElement(r,l.getReferenceProps({ref:d,...n,...r.props})):s.jsx("span",{ref:d,...l.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:r})}),R=({hideTooltip:e,tooltip:r,children:t,triggerClassName:n,contentClassName:a,...l})=>s.jsxs(ue,{...l,children:[s.jsx(pe,{className:i(n,"truncate"),children:t}),s.jsx(xe,{className:i("text-primary",a,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),me=18,O={size:me,stroke:2},fe=({label:e,id:r,checked:t,indeterminate:n,disabled:a,ariaLabel:l,onChange:o})=>{const c=j.useCallback(x=>{x.stopPropagation(),o?.(x.target.checked,r)},[o,r]),d=i("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'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":""),u=i("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":"");return s.jsxs("label",{className:d,htmlFor:r,children:[t&&(n?s.jsx(C.IconMinus,{className:u,...O}):s.jsx(C.IconCheck,{className:u,...O})),e&&s.jsx(R,{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":a||void 0,"aria-label":e?void 0:l,className:"invisible w-0 h-0"})]})};var N=(e=>(e.VALID="valid",e.ERROR="error",e))(N||{});const he=(e,r)=>{if(r===e.id)switch(e.status){case N.VALID:return"border-accent-secondary text-primary";case N.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case N.VALID:return"border-primary text-white";case N.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},ge=(e,r)=>{if(r===e.id)switch(e.status){case N.VALID:return"bg-accent-secondary";case N.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case N.VALID:return"bg-accent-secondary";case N.ERROR:return"bg-red-400";default:return"bg-layer-4"}},je=({step:e,index:r,currentStep:t,onChangeStep:n})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer",l="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",o=()=>t===e.id&&e.status===N.ERROR?s.jsx(C.IconExclamationCircle,{stroke:2,size:16}):t!==e.id&&e.status===N.VALID?s.jsx(C.IconCheck,{stroke:2,size:16}):r+1;return s.jsxs("button",{className:i(a,he(e,t)),onClick:()=>n(e.id),children:[s.jsx("span",{className:i(l,ge(e,t)),children:o()}),s.jsx("span",{children:e.name})]})},be=({steps:e,currentStep:r,onChangeStep:t})=>{const n=a=>{const l=e.findIndex(c=>c.id===r),o=e.findIndex(c=>c.id===a);(a!==r&&e[l].status===N.VALID||o<l)&&t(a)};return s.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,l)=>s.jsx(je,{currentStep:r,onChangeStep:n,step:a,index:l},a.id))})},X=({name:e,value:r,title:t,description:n,checked:a=!1,inputId:l,cssClass:o,labelCssClass:c,disabled:d,onChange:u,descriptionCssClass:x})=>{const f=`${l}-desc`,h=i("dial-small cursor-pointer",d?"text-secondary":"text-primary",c),g=i("cursor-pointer dial-input-radio",t&&"mr-2",o),y=i("flex flex-col",!!n&&"mb-2"),m=i("dial-tiny mt-2 ml-[26px] text-secondary",x),v=I=>{d||I.target.checked&&u?.(r)};return s.jsxs("div",{className:y,children:[s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"radio",id:l,name:e,value:r,checked:a,disabled:d,"aria-describedby":a&&n?f:void 0,className:g,onChange:v}),t?s.jsx("label",{className:h,htmlFor:l,children:t}):null]}),a&&n&&s.jsx("div",{id:f,className:m,children:n})]})};var V=(e=>(e.Row="Row",e.Column="Column",e))(V||{});const Ce="flex flex-col gap-2",ye="flex",Ne="pb-1 mt-2",we={[V.Column]:"flex-col gap-y-3",[V.Row]:"flex-row gap-x-6"},ve=({fieldTitle:e,radioCssClass:r,labelCssClass:t,disabled:n,elementId:a,radioButtons:l,activeRadioButton:o,orientation:c,onChange:d})=>s.jsxs("div",{className:Ce,children:[e&&s.jsx(L,{fieldTitle:e,htmlFor:a}),s.jsx("div",{role:"radiogroup","aria-label":e,"aria-disabled":n||void 0,className:i(ye,we[c]),children:l.map(u=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(X,{name:a,value:u.id,inputId:u.id,disabled:n,cssClass:r,labelCssClass:t,title:u.name,checked:u.id===o,onChange:()=>d(u.id)}),u.id===o&&u.content?s.jsx("div",{className:Ne,children:u.content}):null]},u.id))})]}),De=({icon:e,title:r,description:t})=>s.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-secondary",children:[e||s.jsx(C.IconClipboardX,{width:60,height:60}),s.jsx("span",{className:"small mt-2 text-primary",children:r}),t&&s.jsx("span",{className:"mt-1 text-primary",children:t})]}),Ie=({ariaLabel:e,cssClass:r,size:t=24,onClose:n})=>s.jsx(T,{ariaLabel:e,cssClass:i("text-secondary hover:text-accent-primary",r),onClick:n,iconBefore:s.jsx(C.IconX,{size:t})}),$=({value:e,textareaId:r,placeholder:t,cssClass:n="",disabled:a,invalid:l,readonly:o,onChange:c})=>s.jsx(R,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:a,className:i("dial-textarea dial-input px-3 py-2",l?"dial-input-error":"",a&&"dial-input-disable",o&&"dial-input-readonly",n),onChange:d=>!o&&c?.(d.currentTarget.value)})}),ke=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],Se=(e,r,t,n)=>{if((r==="number"||t!==void 0||n!==void 0)&&!ke.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),d=parseFloat(c);if(!isNaN(d)){if(t!==void 0&&d<t){e.preventDefault();return}if(n!==void 0&&d>n){e.preventDefault();return}}}}},A=({iconBefore:e,iconAfter:r,hideBorder:t,value:n,elementId:a,placeholder:l="",cssClass:o="",containerCssClass:c,tooltipTriggerClassName:d,type:u="text",disabled:x,readonly:f,invalid:h,onChange:g,min:y,max:m,prefix:v,suffix:I,textBeforeInput:b,textAfterInput:P})=>{const Q=k=>k.target.blur(),Y=u==="number"||y!==void 0||m!==void 0,J=k=>{Se(k,u,y,m)},ee=k=>{const E=k.currentTarget.value;if(Y&&E!==""){const z=parseFloat(E);if(isNaN(z)&&E!=="-"&&E!=="."||!isNaN(z)&&(y!==void 0&&z<y||m!==void 0&&z>m))return}g?.(E)};return s.jsxs("div",{className:i("dial-input-field flex flex-row items-center justify-between px-3 py-2",t?"dial-input-no-border":"dial-input",h&&"dial-input-error",x&&"dial-input-disable",f&&"dial-input-readonly",!b&&"pl-1",!P&&"pr-1",c),children:[b&&s.jsx(R,{tooltip:b,children:s.jsx(A,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:b,disabled:!0,elementId:b+"textBefore"})}),v&&s.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",v]}),s.jsx(D,{icon:e}),s.jsx(R,{tooltip:n,triggerClassName:i(d,"flex-1"),children:s.jsx("input",{type:u,autoComplete:"off",id:a,placeholder:l,value:n??"",title:n?String(n):"",disabled:x,className:i("border-0 bg-transparent px-2",o),onChange:k=>!f&&ee?.(k),onKeyDown:J,onWheel:Q,min:y,max:m})}),s.jsx(D,{icon:r}),I&&s.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",I]}),P&&s.jsx(R,{tooltip:P,children:s.jsx(A,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:P,disabled:!0,elementId:P+"textAfter"})})]})},Re=/^0+\.(\d+)?$/,Fe=/^0+/,U=({fieldTitle:e,errorText:r,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:l,containerCssClass:o,readonly:c,defaultEmptyText:d,min:u,max:x,...f})=>s.jsxs("div",{className:i("flex flex-col",o),children:[s.jsx(L,{fieldTitle:e,optional:t,htmlFor:l}),c?s.jsx("span",{children:f.value||(d??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(A,{elementId:l,cssClass:n,containerCssClass:a,invalid:r!=null,min:u,max:x,...f}),s.jsx(_,{errorText:r})]})]}),Te=({onChange:e,value:r,min:t,max:n,...a})=>{const l=o=>String(o)?.match(Re)?String(o)?.replace(Fe,"0"):Number(o);return s.jsx(U,{type:"number",onChange:o=>e?.(l(o)),value:r,min:t,max:n,...a})},Pe=({onChange:e,...r})=>s.jsx(U,{type:"text",onChange:t=>e?.(t),...r}),Ee=({fieldTitle:e,optional:r,elementId:t,elementCssClass:n,errorText:a,...l})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(L,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx($,{textareaId:t,cssClass:n,...l}),s.jsx(_,{errorText:a})]}),Ae=({title:e,switchId:r,isOn:t=!1,disabled:n,onChange:a})=>{const l=i("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=j.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:i("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})]})};var F=(e=>(e.Sm="sm",e.Md="md",e.Lg="lg",e))(F||{});const Be="z-[52] flex items-center justify-center bg-blackout md:p-4",Le="relative max-h-full rounded bg-layer-3 flex flex-col shadow w-full h-full md:h-auto",ze="divide-tertiary divide-y",Oe="flex flex-row justify-between py-4 px-6 items-center",Ve={[F.Sm]:"max-w-full md:max-w-[400px]",[F.Md]:"max-w-full md:max-w-[800px]",[F.Lg]:"max-w-full md:max-w-[1200px]"},K=({open:e=!1,title:r,portalId:t,cssClass:n,overlayClass:a,headingClass:l,dividers:o=!0,children:c,footer:d,onClose:u,size:x=F.Md})=>{const{refs:f,context:h}=p.useFloating({open:e,onOpenChange:b=>{b||u?.(null)}}),g=p.useRole(h,{role:"dialog"}),y=p.useDismiss(h,{outsidePress:!0}),{getFloatingProps:m}=p.useInteractions([g,y]);if(!e)return null;const v=typeof r=="string"?"dial-popup-heading":void 0,I=b=>b?typeof b=="string"?s.jsx("h3",{id:v,className:i("flex-1 min-w-0 mr-3 truncate dial-h3 text-primary",l),children:s.jsx(R,{tooltip:b,children:b})}):b:s.jsx("span",{});return s.jsx(p.FloatingPortal,{id:t,children:s.jsx(p.FloatingOverlay,{className:i(Be,a),children:s.jsx(p.FloatingFocusManager,{context:h,children:s.jsxs("div",{ref:f.setFloating,...m(),role:"dialog","aria-modal":"true","aria-labelledby":v,className:i(Le,Ve[x],o&&ze,n),children:[s.jsxs("div",{className:Oe,children:[I(r),s.jsx(T,{cssClass:"text-secondary hover:text-accent-primary",ariaLabel:"Close dialog",iconBefore:s.jsx(C.IconX,{size:18}),onClick:b=>u?.(b)})]}),s.jsx("div",{className:"flex-grow overflow-auto",children:c}),d]})})})})};var B=(e=>(e.Info="info",e.Danger="danger",e))(B||{});const Me="flex justify-end gap-2 px-6 py-4",_e="text-secondary dial-small-150 px-6 py-4",We="Cancel",W={[B.Info]:{confirmVariant:w.Primary,cancelVariant:w.Secondary},[B.Danger]:{container:"border-t-4 border-error",confirmVariant:w.Danger,cancelVariant:w.Secondary}},qe=({title:e,description:r,descriptionCssClass:t,open:n=!1,confirmLabel:a,cancelLabel:l=We,isLoading:o=!1,disableConfirmButton:c=!1,cssClass:d,confirmClassName:u,onClose:x,onConfirm:f,onCancel:h,children:g,dividers:y=!1,variant:m=B.Info,size:v=F.Sm})=>{const I=o?null:s.jsxs("div",{className:Me,children:[s.jsx(T,{variant:w.Secondary,title:l,onClick:()=>h?h():x?.()}),s.jsx(T,{variant:W[m].confirmVariant,cssClass:u,title:a,disable:c,onClick:()=>f()})]}),b=j.useCallback(()=>o?s.jsx("div",{className:"px-6 py-4 h-[120px]",children:s.jsx(q,{size:50})}):g??(r?s.jsx("div",{className:i(_e,t),children:r}):null),[g,r,o,t]);return s.jsx(K,{open:n,title:e,cssClass:i(W[m].container,d),dividers:y,onClose:()=>x?.(),footer:I,size:v,children:b()})},He=({onClick:e})=>s.jsx(C.IconEyeOff,{...O,className:"text-primary",onClick:e}),Ge=({onClick:e})=>s.jsx(C.IconEye,{...O,className:"text-primary",onClick:e}),Z=({...e})=>{const[r,t]=j.useState(!1),n=j.useCallback(a=>{t(a)},[]);return s.jsx(A,{type:r?"text":"password",...e,iconAfter:r?s.jsx(He,{onClick:()=>n(!1)}):s.jsx(Ge,{onClick:()=>n(!0)})})},Xe=({fieldTitle:e,optional:r,elementCssClass:t,elementId:n,errorText:a,...l})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(L,{fieldTitle:e,optional:r,htmlFor:n}),s.jsx(Z,{cssClass:t,elementId:n,invalid:!!a,...l}),s.jsx(_,{errorText:a})]});var M=(e=>(e.Small="small",e.Base="base",e))(M||{});const $e={[M.Small]:{textClass:"text-xs px-1",containerClass:"px-[6px] py-1 h-[22px]",iconSize:10,iconStroke:1},[M.Base]:{textClass:"text-sm px-2",containerClass:"px-3 py-2 h-[38px]",iconSize:18,iconStroke:1.5}},Ue=({elementId:e,value:r,placeholder:t,disabled:n,readonly:a,invalid:l,cssClass:o,containerCssClass:c,onChange:d,size:u=M.Base})=>{const[x,f]=j.useState(r||"");j.useEffect(()=>{f(r||"")},[r]);const h=j.useCallback(m=>{f(m),d?.(m)},[d]),g=$e[u],y=j.useCallback(()=>{h("")},[h]);return s.jsxs("div",{className:i("dial-input flex flex-row items-center justify-between",l&&"dial-input-error",n&&"dial-input-disable",a&&"dial-input-readonly",g.containerClass,c),children:[s.jsx(D,{className:i(n?"text-secondary":"text-primary"),icon:s.jsx(C.IconSearch,{size:g.iconSize,stroke:g.iconStroke})}),s.jsx("input",{id:e,type:"text",autoComplete:"off",placeholder:t,value:x??"",title:x?String(x):"",disabled:n,readOnly:a,className:i("border-0 bg-transparent w-full",o,g.textClass),onChange:m=>!a&&h(m.currentTarget.value)}),x&&!a&&!n&&s.jsx(D,{className:"text-primary cursor-pointer",icon:s.jsx(C.IconX,{size:g.iconSize,stroke:g.iconStroke,onClick:y,"aria-label":"Clear search",role:"button"})})]})};exports.AlertVariant=S;exports.ButtonVariant=w;exports.ConfirmationPopupVariant=B;exports.DialAlert=ae;exports.DialButton=T;exports.DialCheckbox=fe;exports.DialCloseButton=Ie;exports.DialConfirmationPopup=qe;exports.DialErrorText=_;exports.DialFieldLabel=L;exports.DialIcon=D;exports.DialInput=A;exports.DialLoader=q;exports.DialNoDataContent=De;exports.DialNumberInputField=Te;exports.DialPasswordInput=Z;exports.DialPasswordInputField=Xe;exports.DialPopup=K;exports.DialRadioButton=X;exports.DialRadioGroup=ve;exports.DialSearch=Ue;exports.DialSteps=be;exports.DialSwitch=Ae;exports.DialTextAreaField=Ee;exports.DialTextInputField=Pe;exports.DialTextarea=$;exports.DialTooltip=R;exports.PopupSize=F;exports.RadioGroupOrientation=V;exports.StepStatus=N;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),c=require("classnames"),b=require("@tabler/icons-react"),j=require("react"),m=require("@floating-ui/react"),W=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),B=({fieldTitle:e,htmlFor:r,optional:t,optionalText:a,cssClass:n})=>e?s.jsxs("label",{className:c("dial-tiny text-secondary",n,!n?.includes("mb")&&"mb-2"),htmlFor:r,children:[s.jsx("span",{className:"min-h-4",children:e}),t&&s.jsx("span",{className:"ml-1",children:a??"(Optional)"})]}):null,D=({icon:e,className:r})=>e?s.jsx("span",{className:c("flex-shrink-0",r),children:e}):null;var N=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e.Danger="danger",e))(N||{});const te={[N.Primary]:"dial-primary-button",[N.Secondary]:"dial-secondary-button",[N.Tertiary]:"dial-tertiary-button",[N.Danger]:"dial-danger-button"},F=({title:e,variant:r,cssClass:t,ref:a,onClick:n,disable:l,iconAfter:o,iconBefore:d,hideTitleOnMobile:u,ariaLabel:i})=>{const x=c("dial-small-semi",o?"mr-2":"",d?"ml-2":"",u?"hidden sm:inline":"inline"),p=c(r&&te[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:a,type:"button",className:p,onClick:f=>n?.(f),disabled:l,"aria-label":e||i,children:[s.jsx(D,{icon:d}),e&&s.jsx("span",{className:x,children:e}),s.jsx(D,{icon:o})]})};var S=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(S||{});const ne={info:s.jsx(b.IconInfoCircle,{size:24,stroke:2}),error:s.jsx(b.IconAlertCircle,{size:24,stroke:2}),warning:s.jsx(b.IconAlertTriangle,{size:24,stroke:2}),success:s.jsx(b.IconCircleCheck,{size:24,stroke:2})},ae={[S.Info]:"bg-info border-info text-info",[S.Success]:"bg-success border-success text-success",[S.Warning]:"bg-warning border-warning text-warning",[S.Error]:"bg-error border-error text-error"},le="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",oe=({variant:e=S.Info,message:r,cssClass:t,closable:a=!1,onClose:n})=>s.jsxs("div",{role:"alert",className:c(le,ae[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(D,{icon:ne[e]}),s.jsx("div",{className:"text-primary",children:r})]}),a&&s.jsx(F,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(b.IconX,{size:16}),onClick:l=>n?.(l)})]}),ie="flex items-center justify-center text-secondary",ce="shrink-0 grow-0 basis-auto animate-spin-steps",H=({size:e=18,cssClass:r,iconClass:t,fullWidth:a=!0,ariaLabel:n="Loading"})=>s.jsx("div",{role:"status","aria-label":n,className:c({[ie]:!0,"w-full h-full":a,[r||""]:!!r}),children:s.jsx(D,{icon:s.jsx(b.IconLoader,{width:e,height:e,className:c(ce,t)})})}),de=7,ue=2,q=j.createContext(null),$=()=>{const e=j.useContext(q);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},xe=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:a,onOpenChange:n}={})=>{const[l,o]=j.useState(e),d=j.useRef(null),u=a??l,i=n??o,x=m.useFloating({placement:r,open:u,onOpenChange:i,whileElementsMounted:m.autoUpdate,middleware:[m.offset(de+ue),m.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),m.shift({padding:5}),m.arrow({element:d})]}),p=m.useHover(x.context,{move:!1,enabled:a==null,mouseOnly:t,delay:{open:500,close:0}}),f=m.useFocus(x.context,{enabled:a==null}),h=m.useDismiss(x.context),y=m.useRole(x.context,{role:"tooltip"}),g=m.useInteractions([p,f,h,y]);return j.useMemo(()=>({open:u,setOpen:i,arrowRef:d,...g,...x}),[u,i,g,x])},me=({children:e,...r})=>{const t=xe(r);return s.jsx(q.Provider,{value:t,children:e})},pe=j.forwardRef(function({style:r,...t},a){const n=$(),l=m.useMergeRefs([n.refs.setFloating,a]);return n.open?s.jsx(m.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:l,style:{...n.floatingStyles,...r},...n.getFloatingProps(t),className:c("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",n.getFloatingProps(t).className),children:[t.children,s.jsx(m.FloatingArrow,{ref:n.arrowRef,context:n.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),fe=j.forwardRef(function({children:r,asChild:t=!1,...a},n){const l=$(),d=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,u=m.useMergeRefs([l.refs.setReference,n,d]);return t&&j.isValidElement(r)?j.cloneElement(r,l.getReferenceProps({ref:u,...a,...r.props})):s.jsx("span",{ref:u,...l.getReferenceProps(a),className:a.className??"dial-tooltip-trigger text-left",children:r})}),O=({hideTooltip:e,tooltip:r,children:t,triggerClassName:a,contentClassName:n,...l})=>s.jsxs(me,{...l,children:[s.jsx(fe,{className:c(a,"truncate"),children:t}),s.jsx(pe,{className:c("text-primary",n,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),G=18,T={size:G,stroke:2},he=({label:e,id:r,checked:t,indeterminate:a,disabled:n,ariaLabel:l,onChange:o})=>{const d=j.useCallback(x=>{x.stopPropagation(),o?.(x.target.checked,r)},[o,r]),u=c("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'}`,n?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":""),i=c("mr-2 border rounded",n?"bg-layer-4 border-icon-secondary":"");return s.jsxs("label",{className:u,htmlFor:r,children:[t&&(a?s.jsx(b.IconMinus,{className:i,...T}):s.jsx(b.IconCheck,{className:i,...T})),e&&s.jsx(O,{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:d,id:r,checked:t,"aria-checked":a?"mixed":t,"aria-disabled":n||void 0,"aria-label":e?void 0:l,className:"invisible w-0 h-0"})]})};var v=(e=>(e.VALID="valid",e.ERROR="error",e))(v||{});const ge=(e,r)=>{if(r===e.id)switch(e.status){case v.VALID:return"border-accent-secondary text-primary";case v.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case v.VALID:return"border-primary text-white";case v.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},je=(e,r)=>{if(r===e.id)switch(e.status){case v.VALID:return"bg-accent-secondary";case v.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case v.VALID:return"bg-accent-secondary";case v.ERROR:return"bg-red-400";default:return"bg-layer-4"}},be=({step:e,index:r,currentStep:t,onChangeStep:a})=>{const n="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer",l="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",o=()=>t===e.id&&e.status===v.ERROR?s.jsx(b.IconExclamationCircle,{stroke:2,size:16}):t!==e.id&&e.status===v.VALID?s.jsx(b.IconCheck,{stroke:2,size:16}):r+1;return s.jsxs("button",{className:c(n,ge(e,t)),onClick:()=>a(e.id),children:[s.jsx("span",{className:c(l,je(e,t)),children:o()}),s.jsx("span",{children:e.name})]})},Ce=({steps:e,currentStep:r,onChangeStep:t})=>{const a=n=>{const l=e.findIndex(d=>d.id===r),o=e.findIndex(d=>d.id===n);(n!==r&&e[l].status===v.VALID||o<l)&&t(n)};return s.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((n,l)=>s.jsx(be,{currentStep:r,onChangeStep:a,step:n,index:l},n.id))})},U=({name:e,value:r,title:t,description:a,checked:n=!1,inputId:l,cssClass:o,labelCssClass:d,disabled:u,onChange:i,descriptionCssClass:x})=>{const p=`${l}-desc`,f=c("dial-small cursor-pointer",u?"text-secondary":"text-primary",d),h=c("cursor-pointer dial-input-radio",t&&"mr-2",o),y=c("flex flex-col",!!a&&"mb-2"),g=c("dial-tiny mt-2 ml-[26px] text-secondary",x),w=I=>{u||I.target.checked&&i?.(r)};return s.jsxs("div",{className:y,children:[s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"radio",id:l,name:e,value:r,checked:n,disabled:u,"aria-describedby":n&&a?p:void 0,className:h,onChange:w}),t?s.jsx("label",{className:f,htmlFor:l,children:t}):null]}),n&&a&&s.jsx("div",{id:p,className:g,children:a})]})};var M=(e=>(e.Row="Row",e.Column="Column",e))(M||{});const ye="flex flex-col gap-2",ve="flex",Ne="pb-1 mt-2",we={[M.Column]:"flex-col gap-y-3",[M.Row]:"flex-row gap-x-6"},De=({fieldTitle:e,radioCssClass:r,labelCssClass:t,disabled:a,elementId:n,radioButtons:l,activeRadioButton:o,orientation:d,onChange:u})=>s.jsxs("div",{className:ye,children:[e&&s.jsx(B,{fieldTitle:e,htmlFor:n}),s.jsx("div",{role:"radiogroup","aria-label":e,"aria-disabled":a||void 0,className:c(ve,we[d]),children:l.map(i=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(U,{name:n,value:i.id,inputId:i.id,disabled:a,cssClass:r,labelCssClass:t,title:i.name,checked:i.id===o,onChange:()=>u(i.id)}),i.id===o&&i.content?s.jsx("div",{className:Ne,children:i.content}):null]},i.id))})]}),Ie=({icon:e,title:r,description:t})=>s.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-secondary",children:[e||s.jsx(b.IconClipboardX,{width:60,height:60}),s.jsx("span",{className:"small mt-2 text-primary",children:r}),t&&s.jsx("span",{className:"mt-1 text-primary",children:t})]}),ke=60,Se=({containerCssClass:e,children:r,width:t,title:a,iconSize:n=G,titleCssClass:l,additionalButtons:o})=>{const[d,u]=j.useState(t),[i,x]=j.useState(!0),p=c(["transform rotate-180 [writing-mode:tb-rl]",i&&"hidden",l]),f=c(["flex flex-row gap-2 cursor-pointer text-secondary",i?"justify-end":"justify-center"]),h=()=>{u(i?ke:t),x(!i)};return s.jsxs("div",{className:c(["rounded p-4 flex flex-col justify-between overflow-y-auto flex-shrink-0",e]),style:{width:`${d}px`},children:[s.jsx("div",{className:c(["flex-1 min-h-0 overflow-auto",!i&&"hidden"]),children:r}),s.jsx("div",{className:p,children:a}),s.jsxs("div",{className:f,children:[i&&o,s.jsx(F,{cssClass:"hover:text-icon-accent-primary",onClick:h,iconBefore:i?s.jsx(b.IconChevronsLeft,{size:n,stroke:T.stroke}):s.jsx(b.IconChevronsRight,{size:n,stroke:T.stroke})})]})]})},X=({ariaLabel:e,cssClass:r,size:t=24,onClose:a})=>s.jsx(F,{ariaLabel:e,cssClass:c("text-secondary hover:text-accent-primary",r),onClick:a,iconBefore:s.jsx(b.IconX,{size:t})}),K=({value:e,textareaId:r,placeholder:t,cssClass:a="",disabled:n,invalid:l,readonly:o,onChange:d})=>s.jsx(O,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:n,className:c("dial-textarea dial-input px-3 py-2",l?"dial-input-error":"",n&&"dial-input-disable",o&&"dial-input-readonly",a),onChange:u=>!o&&d?.(u.currentTarget.value)})}),Re=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],Fe=(e,r,t,a)=>{if((r==="number"||t!==void 0||a!==void 0)&&!Re.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||a!==void 0){const l=e.currentTarget.value,o=e.currentTarget.selectionStart||0,d=l.slice(0,o)+e.key+l.slice(o),u=parseFloat(d);if(!isNaN(u)){if(t!==void 0&&u<t){e.preventDefault();return}if(a!==void 0&&u>a){e.preventDefault();return}}}}},P=({iconBefore:e,iconAfter:r,hideBorder:t,value:a,elementId:n,placeholder:l="",cssClass:o="",containerCssClass:d,tooltipTriggerClassName:u,type:i="text",disabled:x,readonly:p,invalid:f,onChange:h,min:y,max:g,prefix:w,suffix:I,textBeforeInput:C,textAfterInput:z})=>{const J=k=>k.target.blur(),ee=i==="number"||y!==void 0||g!==void 0,se=k=>{Fe(k,i,y,g)},re=k=>{const E=k.currentTarget.value;if(ee&&E!==""){const V=parseFloat(E);if(isNaN(V)&&E!=="-"&&E!=="."||!isNaN(V)&&(y!==void 0&&V<y||g!==void 0&&V>g))return}h?.(E)};return s.jsxs("div",{className:c("dial-input-field flex flex-row items-center justify-between py-2",t?"dial-input-no-border":"dial-input",f&&"dial-input-error",x&&"dial-input-disable",p&&"dial-input-readonly",!C&&"pl-3",!z&&"pr-3",d),children:[C&&s.jsx("div",{children:s.jsx(P,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:C,disabled:!0,elementId:C+"textBefore"})}),w&&s.jsxs("p",{className:"text-secondary dial-small",children:[" ",w]}),s.jsx(D,{icon:e}),s.jsx(O,{tooltip:a,triggerClassName:c(u,"flex-1"),children:s.jsx("input",{type:i,autoComplete:"off",id:n,placeholder:l,value:a??"",disabled:x,className:c("border-0 bg-transparent px-2",o),onChange:k=>!p&&re?.(k),onKeyDown:se,onWheel:J,min:y,max:g})}),s.jsx(D,{icon:r}),I&&s.jsxs("p",{className:"text-secondary dial-small",children:[" ",I]}),z&&s.jsx("div",{children:s.jsx(P,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:z,disabled:!0,elementId:z+"textAfter"})})]})},Te=/^0+\.(\d+)?$/,Ee=/^0+/,Z=({fieldTitle:e,errorText:r,optional:t,elementCssClass:a,elementContainerCssClass:n,elementId:l,containerCssClass:o,readonly:d,defaultEmptyText:u,min:i,max:x,...p})=>s.jsxs("div",{className:c("flex flex-col",o),children:[s.jsx(B,{fieldTitle:e,optional:t,htmlFor:l}),d?s.jsx("span",{children:p.value||(u??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(P,{elementId:l,cssClass:a,containerCssClass:n,invalid:r!=null,min:i,max:x,...p}),s.jsx(W,{errorText:r})]})]}),Pe=({onChange:e,value:r,min:t,max:a,...n})=>{const l=o=>String(o)?.match(Te)?String(o)?.replace(Ee,"0"):Number(o);return s.jsx(Z,{type:"number",onChange:o=>e?.(l(o)),value:r,min:t,max:a,...n})},Ae=({onChange:e,...r})=>s.jsx(Z,{type:"text",onChange:t=>e?.(t),...r}),Le=({fieldTitle:e,optional:r,elementId:t,elementCssClass:a,errorText:n,...l})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(B,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx(K,{textareaId:t,cssClass:a,...l}),s.jsx(W,{errorText:n})]}),Be=({title:e,switchId:r,isOn:t=!1,disabled:a,onChange:n})=>{const l=c("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",a?"pointer-events-none":"",a?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),o=j.useCallback(d=>{d.stopPropagation(),n?.(!t)},[n,t]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:o,id:r,disabled:a,className:"invisible w-0 h-0",checked:t}),s.jsx("label",{htmlFor:r,className:l,children:s.jsx("span",{className:c("size-3 rounded-full",a?t?"bg-layer-4":"bg-controls-disable":"bg-controls-enable-primary")})}),e&&s.jsx("span",{className:"pl-2 dial-small text-primary",children:e})]})};var R=(e=>(e.Sm="sm",e.Md="md",e.Lg="lg",e))(R||{});const Oe="z-[52] flex items-center justify-center bg-blackout md:p-4",ze="relative max-h-full rounded bg-layer-3 flex flex-col shadow w-full h-full md:h-auto",Ve="divide-tertiary divide-y",Me="flex flex-row justify-between py-4 px-6 items-center",We={[R.Sm]:"max-w-full md:max-w-[400px]",[R.Md]:"max-w-full md:max-w-[800px]",[R.Lg]:"max-w-full md:max-w-[1200px]"},Q=({open:e=!1,title:r,portalId:t,cssClass:a,overlayClass:n,headingClass:l,dividers:o=!0,children:d,footer:u,onClose:i,size:x=R.Md})=>{const{refs:p,context:f}=m.useFloating({open:e,onOpenChange:C=>{C||i?.(null)}}),h=m.useRole(f,{role:"dialog"}),y=m.useDismiss(f,{outsidePress:!0}),{getFloatingProps:g}=m.useInteractions([h,y]);if(!e)return null;const w=typeof r=="string"?"dial-popup-heading":void 0,I=C=>C?typeof C=="string"?s.jsx("h3",{id:w,className:c("flex-1 min-w-0 mr-3 truncate dial-h3 text-primary",l),children:s.jsx(O,{tooltip:C,children:C})}):C:s.jsx("span",{});return s.jsx(m.FloatingPortal,{id:t,children:s.jsx(m.FloatingOverlay,{className:c(Oe,n),children:s.jsx(m.FloatingFocusManager,{context:f,children:s.jsxs("div",{ref:p.setFloating,...g(),role:"dialog","aria-modal":"true","aria-labelledby":w,className:c(ze,We[x],o&&Ve,a),children:[s.jsxs("div",{className:Me,children:[I(r),s.jsx(X,{ariaLabel:"Close dialog",onClose:C=>i?.(C)})]}),s.jsx("div",{className:"flex-grow overflow-auto",children:d}),u]})})})})};var A=(e=>(e.Info="info",e.Danger="danger",e))(A||{});const _e="flex justify-end gap-2 px-6 py-4",He="text-secondary dial-small-150 px-6 py-4",qe="Cancel",_={[A.Info]:{confirmVariant:N.Primary,cancelVariant:N.Secondary},[A.Danger]:{container:"border-t-4 border-error",confirmVariant:N.Danger,cancelVariant:N.Secondary}},$e=({title:e,description:r,descriptionCssClass:t,open:a=!1,confirmLabel:n,cancelLabel:l=qe,isLoading:o=!1,disableConfirmButton:d=!1,cssClass:u,confirmClassName:i,onClose:x,onConfirm:p,onCancel:f,children:h,dividers:y=!1,variant:g=A.Info,size:w=R.Sm})=>{const I=o?null:s.jsxs("div",{className:_e,children:[s.jsx(F,{variant:N.Secondary,title:l,onClick:()=>f?f():x?.()}),s.jsx(F,{variant:_[g].confirmVariant,cssClass:i,title:n,disable:d,onClick:()=>p()})]}),C=j.useCallback(()=>o?s.jsx("div",{className:"px-6 py-4 h-[120px]",children:s.jsx(H,{size:50})}):h??(r?s.jsx("div",{className:c(He,t),children:r}):null),[h,r,o,t]);return s.jsx(Q,{open:a,title:e,cssClass:c(_[g].container,u),dividers:y,onClose:()=>x?.(),footer:I,size:w,children:C()})},Ge=({onClick:e})=>s.jsx(b.IconEyeOff,{...T,className:"text-primary",onClick:e}),Ue=({onClick:e})=>s.jsx(b.IconEye,{...T,className:"text-primary",onClick:e}),Y=({...e})=>{const[r,t]=j.useState(!1),a=j.useCallback(n=>{t(n)},[]);return s.jsx(P,{type:r?"text":"password",...e,iconAfter:r?s.jsx(Ge,{onClick:()=>a(!1)}):s.jsx(Ue,{onClick:()=>a(!0)})})},Xe=({fieldTitle:e,optional:r,elementCssClass:t,elementId:a,errorText:n,...l})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(B,{fieldTitle:e,optional:r,htmlFor:a}),s.jsx(Y,{cssClass:t,elementId:a,invalid:!!n,...l}),s.jsx(W,{errorText:n})]});var L=(e=>(e.Small="small",e.Base="base",e))(L||{});const Ke={[L.Small]:{textClass:"text-xs px-1",containerClass:"px-[6px] py-1 h-[22px]",iconSize:10,iconStroke:1},[L.Base]:{textClass:"text-sm px-2",containerClass:"px-3 py-2 h-[38px]",iconSize:18,iconStroke:1.5}},Ze=({elementId:e,value:r,placeholder:t,disabled:a,readonly:n,invalid:l,cssClass:o,containerCssClass:d,onChange:u,size:i=L.Base})=>{const[x,p]=j.useState(r||"");j.useEffect(()=>{p(r||"")},[r]);const f=j.useCallback(g=>{p(g),u?.(g)},[u]),h=Ke[i],y=j.useCallback(()=>{f("")},[f]);return s.jsxs("div",{className:c("dial-input flex flex-row items-center justify-between",l&&"dial-input-error",a&&"dial-input-disable",n&&"dial-input-readonly",h.containerClass,d),children:[s.jsx(D,{className:c(a?"text-secondary":"text-primary"),icon:s.jsx(b.IconSearch,{size:h.iconSize,stroke:h.iconStroke})}),s.jsx("input",{id:e,type:"text",autoComplete:"off",placeholder:t,value:x??"",disabled:a,readOnly:n,className:c("border-0 bg-transparent w-full",o,h.textClass),onChange:g=>!n&&f(g.currentTarget.value)}),x&&!n&&!a&&s.jsx(D,{className:"text-primary cursor-pointer",icon:s.jsx(b.IconX,{size:h.iconSize,stroke:h.iconStroke,onClick:y,"aria-label":"Clear search",role:"button"})})]})};exports.AlertVariant=S;exports.ButtonVariant=N;exports.ConfirmationPopupVariant=A;exports.DialAlert=oe;exports.DialButton=F;exports.DialCheckbox=he;exports.DialCloseButton=X;exports.DialCollapsibleSidebar=Se;exports.DialConfirmationPopup=$e;exports.DialErrorText=W;exports.DialFieldLabel=B;exports.DialIcon=D;exports.DialInput=P;exports.DialLoader=H;exports.DialNoDataContent=Ie;exports.DialNumberInputField=Pe;exports.DialPasswordInput=Y;exports.DialPasswordInputField=Xe;exports.DialPopup=Q;exports.DialRadioButton=U;exports.DialRadioGroup=De;exports.DialSearch=Ze;exports.DialSteps=Ce;exports.DialSwitch=Be;exports.DialTextAreaField=Le;exports.DialTextInputField=Ae;exports.DialTextarea=K;exports.DialTooltip=O;exports.PopupSize=R;exports.RadioGroupOrientation=M;exports.SearchSize=L;exports.StepStatus=v;
|