@epam/ai-dial-ui-kit 0.3.0-rc.1 → 0.3.0-rc.3
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 +1078 -809
- package/dist/index.css +1 -1
- package/dist/src/components/Dropdown/Dropdown.d.ts +70 -0
- package/dist/src/components/Dropdown/constants.d.ts +8 -0
- package/dist/src/components/RadioGroupPopupField/RadioGroupPopupField.d.ts +68 -0
- package/dist/src/index.d.ts +3 -0
- package/dist/src/models/dropdown.d.ts +14 -0
- package/dist/src/types/dropdown.d.ts +13 -0
- package/package.json +1 -1
- package/dist/src/components/RadioGroupModalField/RadioGroupModal.d.ts +0 -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"),i=require("classnames"),v=require("@tabler/icons-react"),m=require("react"),j=require("@floating-ui/react"),ie=require("react-dom");function ce(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const k=ce(m),O=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),M=({fieldTitle:e,htmlFor:t,optional:r,optionalText:n,cssClass:a})=>e?s.jsxs("label",{className:i("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:t,children:[s.jsx("span",{className:"min-h-4",children:e}),r&&s.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null,S=({icon:e,className:t})=>e?s.jsx("span",{className:i("flex-shrink-0",t),children:e}):null;var I=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e.Danger="danger",e))(I||{});const ue={[I.Primary]:"dial-primary-button",[I.Secondary]:"dial-secondary-button",[I.Tertiary]:"dial-tertiary-button",[I.Danger]:"dial-danger-button"},P=({title:e,variant:t,cssClass:r,textCssClass:n,ref:a,onClick:o,disable:c,iconAfter:d,iconBefore:u,hideTitleOnMobile:l,ariaLabel:x})=>{const p=i("dial-small-semi",d?"mr-2":"",u?"ml-2":"",l?"hidden sm:inline":"inline",n),h=i(t&&ue[t],r,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:a,type:"button",className:h,onClick:f=>o?.(f),disabled:c,"aria-label":e||x,children:[s.jsx(S,{icon:u}),e&&s.jsx("span",{className:p,children:e}),s.jsx(S,{icon:d})]})};var E=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(E||{});const de={info:s.jsx(v.IconInfoCircle,{size:24,stroke:2}),error:s.jsx(v.IconAlertCircle,{size:24,stroke:2}),warning:s.jsx(v.IconAlertTriangle,{size:24,stroke:2}),success:s.jsx(v.IconCircleCheck,{size:24,stroke:2})},xe={[E.Info]:"bg-info border-info text-info",[E.Success]:"bg-success border-success text-success",[E.Warning]:"bg-warning border-warning text-warning",[E.Error]:"bg-error border-error text-error"},pe="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",me=({variant:e=E.Info,message:t,cssClass:r,closable:n=!1,onClose:a})=>s.jsxs("div",{role:"alert",className:i(pe,xe[e],r),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(S,{icon:de[e]}),s.jsx("div",{className:"text-primary",children:t})]}),n&&s.jsx(P,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(v.IconX,{size:16}),onClick:o=>a?.(o)})]}),fe="flex items-center justify-center text-secondary",he="shrink-0 grow-0 basis-auto animate-spin-steps",ge=e=>k.createElement("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M24 39V46.5",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.4,d:"M9 24H1.5",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.5,d:"M8.0918 8.0918L13.3994 13.3994",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.6,d:"M24 1.5V9",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.7,d:"M39.9121 8.08594L37.2607 10.7373L34.6094 13.3887",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.8,d:"M46.5 24H39",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.9,d:"M34.6055 34.6055L39.9082 39.9082",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),k.createElement("path",{opacity:.3,d:"M13.3936 34.6055L8.08594 39.9131",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"})),Q=({size:e=18,cssClass:t,iconClass:r,fullWidth:n=!0,ariaLabel:a="Loading"})=>s.jsx("div",{role:"status","aria-label":a,className:i({[fe]:!0,"w-full h-full":n,[t||""]:!!t}),children:s.jsx(S,{icon:s.jsx(ge,{width:e,height:e,className:i(he,r),role:"img"})})}),je=7,be=2,Y=m.createContext(null),J=()=>{const e=m.useContext(Y);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},Ce=({initialOpen:e=!1,placement:t="bottom",isTriggerClickable:r=!1,open:n,onOpenChange:a}={})=>{const[o,c]=m.useState(e),d=m.useRef(null),u=n??o,l=a??c,x=j.useFloating({placement:t,open:u,onOpenChange:l,whileElementsMounted:j.autoUpdate,middleware:[j.offset(je+be),j.flip({crossAxis:t.includes("-"),fallbackAxisSideDirection:"start",padding:5}),j.shift({padding:5}),j.arrow({element:d})]}),p=j.useHover(x.context,{move:!1,enabled:n==null,mouseOnly:r,delay:{open:500,close:0}}),h=j.useFocus(x.context,{enabled:n==null}),f=j.useDismiss(x.context),C=j.useRole(x.context,{role:"tooltip"}),g=j.useInteractions([p,h,f,C]);return m.useMemo(()=>({open:u,setOpen:l,arrowRef:d,...g,...x}),[u,l,g,x])},ye=({children:e,...t})=>{const r=Ce(t);return s.jsx(Y.Provider,{value:r,children:e})},ve=m.forwardRef(function({style:t,...r},n){const a=J(),o=j.useMergeRefs([a.refs.setFloating,n]);return a.open?s.jsx(j.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:o,style:{...a.floatingStyles,...t},...a.getFloatingProps(r),className:i("z-[55] whitespace-pre-wrap break-words rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(r).className),children:[r.children,s.jsx(j.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),we=m.forwardRef(function({children:t,asChild:r=!1,...n},a){const o=J(),d=t&&typeof t=="object"&&"ref"in t&&t.ref!==void 0?t.ref:void 0,u=j.useMergeRefs([o.refs.setReference,a,d]);return r&&m.isValidElement(t)?m.cloneElement(t,o.getReferenceProps({ref:u,...n,...t.props})):s.jsx("span",{ref:u,...o.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:t})}),T=({hideTooltip:e,tooltip:t,children:r,triggerClassName:n,contentClassName:a,...o})=>s.jsxs(ye,{...o,children:[s.jsx(we,{className:i(n,"truncate"),children:r}),s.jsx(ve,{className:i("text-primary",a,"max-w-[300px]",(e||!t)&&"hidden"),children:t})]}),A=18,V={size:A,stroke:2},Ne=({label:e,id:t,checked:r,indeterminate:n,disabled:a,ariaLabel:o,onChange:c})=>{const d=m.useCallback(x=>{x.stopPropagation(),c?.(x.target.checked,t)},[c,t]),u=i("flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",`${r?"":'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":""),l=i("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":"");return s.jsxs("label",{className:u,htmlFor:t,children:[r&&(n?s.jsx(v.IconMinus,{className:l,...V}):s.jsx(v.IconCheck,{className:l,...V})),e&&s.jsx(T,{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:t,checked:r,"aria-checked":n?"mixed":r,"aria-disabled":a||void 0,"aria-label":e?void 0:o,className:"invisible w-0 h-0"})]})};var N=(e=>(e.VALID="valid",e.ERROR="error",e))(N||{});const De=(e,t)=>{if(t===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"}},ke=(e,t)=>{if(t===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"}},Ie=({step:e,index:t,currentStep:r,onChangeStep:n})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer",o="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",c=()=>r===e.id&&e.status===N.ERROR?s.jsx(v.IconExclamationCircle,{stroke:2,size:16}):r!==e.id&&e.status===N.VALID?s.jsx(v.IconCheck,{stroke:2,size:16}):t+1;return s.jsxs("button",{className:i(a,De(e,r)),onClick:()=>n(e.id),children:[s.jsx("span",{className:i(o,ke(e,r)),children:c()}),s.jsx("span",{children:e.name})]})},Se=({steps:e,currentStep:t,onChangeStep:r})=>{const n=a=>{const o=e.findIndex(d=>d.id===t),c=e.findIndex(d=>d.id===a);(a!==t&&e[o].status===N.VALID||c<o)&&r(a)};return s.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,o)=>s.jsx(Ie,{currentStep:t,onChangeStep:n,step:a,index:o},a.id))})},ee=({name:e,value:t,title:r,description:n,checked:a=!1,inputId:o,cssClass:c,labelCssClass:d,disabled:u,onChange:l,descriptionCssClass:x})=>{const p=`${o}-desc`,h=i("dial-small cursor-pointer",u?"text-secondary":"text-primary",d),f=i("cursor-pointer dial-input-radio",r&&"mr-2",c),C=i("flex flex-col",!!n&&"mb-2"),g=i("dial-tiny mt-2 ml-[26px] text-secondary",x),D=R=>{u||R.target.checked&&l?.(t)};return s.jsxs("div",{className:C,children:[s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"radio",id:o,name:e,value:t,checked:a,disabled:u,"aria-describedby":a&&n?p:void 0,className:f,onChange:D}),r?s.jsx("label",{className:h,htmlFor:o,children:r}):null]}),a&&n&&s.jsx("div",{id:p,className:g,children:n})]})};var G=(e=>(e.Row="Row",e.Column="Column",e))(G||{});const Re="flex flex-col gap-2",Te="flex",Le="pb-1 mt-2",Ee={[G.Column]:"flex-col gap-y-3",[G.Row]:"flex-row gap-x-6"},Fe=({fieldTitle:e,radioCssClass:t,labelCssClass:r,disabled:n,elementId:a,radioButtons:o,activeRadioButton:c,orientation:d,onChange:u})=>s.jsxs("div",{className:Re,children:[e&&s.jsx(M,{fieldTitle:e,htmlFor:a}),s.jsx("div",{role:"radiogroup","aria-label":e,"aria-disabled":n||void 0,className:i(Te,Ee[d]),children:o.map(l=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(ee,{name:a,value:l.id,inputId:l.id,disabled:n,cssClass:t,labelCssClass:r,title:l.name,checked:l.id===c,onChange:()=>u(l.id)}),l.id===c&&l.content?s.jsx("div",{className:Le,children:l.content}):null]},l.id))})]}),Pe=({icon:e,title:t,description:r})=>s.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-secondary",children:[e||s.jsx(v.IconClipboardX,{width:60,height:60}),s.jsx("span",{className:"small mt-2 text-primary",children:t}),r&&s.jsx("span",{className:"mt-1 text-primary",children:r})]}),Ae=60,Ve=({containerCssClass:e,children:t,width:r,title:n,iconSize:a=A,titleCssClass:o,additionalButtons:c})=>{const[d,u]=m.useState(r),[l,x]=m.useState(!0),p=i(["transform rotate-180 [writing-mode:tb-rl]",l&&"hidden",o]),h=i(["flex flex-row gap-2 cursor-pointer text-secondary",l?"justify-end":"justify-center"]),f=()=>{u(l?Ae:r),x(!l)};return s.jsxs("div",{className:i(["rounded p-4 flex flex-col justify-between overflow-y-auto flex-shrink-0",e]),style:{width:`${d}px`},children:[s.jsx("div",{className:i(["flex-1 min-h-0 overflow-auto",!l&&"hidden"]),children:t}),s.jsx("div",{className:p,children:n}),s.jsxs("div",{className:h,children:[l&&c,s.jsx(P,{cssClass:"hover:text-icon-accent-primary",onClick:f,iconBefore:l?s.jsx(v.IconChevronsLeft,{size:a,stroke:V.stroke}):s.jsx(v.IconChevronsRight,{size:a,stroke:V.stroke})})]})]})},Oe=({label:e,text:t,children:r,postfix:n})=>s.jsxs("div",{className:i("flex flex-col text-secondary",r?"":"max-w-[200px]"),children:[s.jsx("label",{className:"dial-tiny mb-2",children:e}),r||s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx(T,{triggerClassName:"text-primary",tooltip:t,children:t}),n||null]})]});var K=(e=>(e.Default="default",e))(K||{});const Me={[K.Default]:"border-icon-secondary bg-layer-3"},se=({tag:e,cssClass:t,remove:r,variant:n=K.Default})=>{const a=Me[n],o=i("flex items-center gap-1 tiny border rounded p-1 h-[22px] text-primary",t,a);return s.jsxs("div",{className:o,children:[s.jsx("span",{children:e}),r&&s.jsx(P,{iconAfter:s.jsx(v.IconX,{size:16}),onClick:r})]},e)},te=({ariaLabel:e,cssClass:t,size:r=24,onClose:n})=>s.jsx(P,{ariaLabel:e,cssClass:i("text-secondary hover:text-accent-primary",t),onClick:n,iconBefore:s.jsx(v.IconX,{size:r})}),re=({value:e,textareaId:t,placeholder:r,cssClass:n="",disabled:a,invalid:o,readonly:c,onChange:d})=>s.jsx(T,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:t,placeholder:r,value:e||"",disabled:a,className:i("dial-textarea dial-input px-3 py-2",o?"dial-input-error":"",a&&"dial-input-disable",c&&"dial-input-readonly",n),onChange:u=>!c&&d?.(u.currentTarget.value)})}),ze=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],Be=(e,t,r,n)=>{if((t==="number"||r!==void 0||n!==void 0)&&!ze.includes(e.key)&&!(e.key==="-"&&e.currentTarget.selectionStart===0&&(r===void 0||r<0))&&!(e.key==="."&&t==="number"&&!e.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(e.key)){e.preventDefault();return}if(r!==void 0||n!==void 0){const o=e.currentTarget.value,c=e.currentTarget.selectionStart||0,d=o.slice(0,c)+e.key+o.slice(c),u=parseFloat(d);if(!isNaN(u)){if(r!==void 0&&u<r){e.preventDefault();return}if(n!==void 0&&u>n){e.preventDefault();return}}}}},W=({iconBefore:e,iconAfter:t,hideBorder:r,value:n,elementId:a,placeholder:o="",cssClass:c="",containerCssClass:d,tooltipTriggerClassName:u,type:l="text",disabled:x,readonly:p,invalid:h,onChange:f,min:C,max:g,prefix:D,suffix:R,textBeforeInput:y,textAfterInput:b})=>{const w=L=>L.target.blur(),z=l==="number"||C!==void 0||g!==void 0,$=L=>{Be(L,l,C,g)},le=L=>{const B=L.currentTarget.value;if(z&&B!==""){const q=parseFloat(B);if(isNaN(q)&&B!=="-"&&B!=="."||!isNaN(q)&&(C!==void 0&&q<C||g!==void 0&&q>g))return}f?.(B)};return s.jsxs("div",{className:i("dial-input-field flex flex-row items-center justify-between py-2",r?"dial-input-no-border":"dial-input",h&&"dial-input-error",x&&"dial-input-disable",p&&"dial-input-readonly",!y&&"pl-3",!b&&"pr-3",d),children:[y&&s.jsx("div",{children:s.jsx(W,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"overflow-hidden overflow-ellipsis dial-small",value:y,disabled:!0,elementId:y+"textBefore"})}),D&&s.jsxs("p",{className:"text-secondary dial-small",children:[" ",D]}),s.jsx(S,{icon:e}),s.jsx(T,{tooltip:n,triggerClassName:i(u,"flex-1"),children:s.jsx("input",{type:l,autoComplete:"off",id:a,placeholder:o,value:n??"",disabled:x,className:i("border-0 bg-transparent",c),onChange:L=>!p&&le?.(L),onKeyDown:$,onWheel:w,min:C,max:g})}),s.jsx(S,{icon:t}),R&&s.jsxs("p",{className:"text-secondary dial-small",children:[" ",R]}),b&&s.jsx("div",{children:s.jsx(W,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",value:b,disabled:!0,elementId:b+"textAfter"})})]})},We=/^0+\.(\d+)?$/,_e=/^0+/,ne=({fieldTitle:e,errorText:t,optional:r,elementCssClass:n,elementContainerCssClass:a,elementId:o,containerCssClass:c,readonly:d,defaultEmptyText:u,min:l,max:x,...p})=>s.jsxs("div",{className:i("flex flex-col",c),children:[s.jsx(M,{fieldTitle:e,optional:r,htmlFor:o}),d?s.jsx("span",{children:p.value||(u??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(W,{elementId:o,cssClass:n,containerCssClass:a,invalid:t!=null,min:l,max:x,...p}),s.jsx(O,{errorText:t})]})]}),He=({onChange:e,value:t,min:r,max:n,...a})=>{const o=c=>String(c)?.match(We)?String(c)?.replace(_e,"0"):Number(c);return s.jsx(ne,{type:"number",onChange:c=>e?.(o(c)),value:t,min:r,max:n,...a})},qe=({onChange:e,...t})=>s.jsx(ne,{type:"text",onChange:r=>e?.(r),...t}),Ge=({fieldTitle:e,optional:t,elementId:r,elementCssClass:n,errorText:a,...o})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(M,{fieldTitle:e,optional:t,htmlFor:r}),s.jsx(re,{textareaId:r,cssClass:n,...o}),s.jsx(O,{errorText:a})]}),Ke=({title:e,switchId:t,isOn:r=!1,disabled:n,onChange:a})=>{const o=i("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",r?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?r?"bg-controls-disable":"bg-layer-4":r?"bg-accent-primary":"bg-layer-4"),c=m.useCallback(d=>{d.stopPropagation(),a?.(!r)},[a,r]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:c,id:t,disabled:n,className:"invisible w-0 h-0",checked:r}),s.jsx("label",{htmlFor:t,className:o,children:s.jsx("span",{className:i("size-3 rounded-full",n?r?"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 $e="z-[52] flex items-center justify-center bg-blackout md:p-4",Xe="divide-tertiary divide-y",Ze="flex flex-row justify-between py-4 px-6 items-center",Ue={[F.Sm]:"dial-sm-popup",[F.Md]:"dial-md-popup",[F.Lg]:"dial-lg-popup"},ae=({open:e=!1,title:t,portalId:r,cssClass:n,overlayClass:a,headingClass:o,dividers:c=!0,children:d,footer:u,onClose:l,size:x=F.Md})=>{const{refs:p,context:h}=j.useFloating({open:e,onOpenChange:y=>{y||l?.(null)}}),f=j.useRole(h,{role:"dialog"}),C=j.useDismiss(h,{outsidePress:!0}),{getFloatingProps:g}=j.useInteractions([f,C]);if(!e)return null;const D=typeof t=="string"?"dial-popup-heading":void 0,R=y=>y?typeof y=="string"?s.jsx("h3",{id:D,className:i("flex-1 min-w-0 mr-3 truncate dial-h3 text-primary",o),children:s.jsx(T,{tooltip:y,children:y})}):y:s.jsx("span",{});return s.jsx(j.FloatingPortal,{id:r,children:s.jsx(j.FloatingOverlay,{className:i($e,a),children:s.jsx(j.FloatingFocusManager,{context:h,children:s.jsxs("div",{ref:p.setFloating,...g(),role:"dialog","aria-modal":"true","aria-labelledby":D,className:i("dial-popup",Ue[x],c&&Xe,n),children:[s.jsxs("div",{className:Ze,children:[R(t),s.jsx(te,{ariaLabel:"Close dialog",onClose:y=>l?.(y)})]}),s.jsx("div",{className:"flex-grow overflow-auto",children:d}),u]})})})})};var _=(e=>(e.Info="info",e.Danger="danger",e))(_||{});const Qe="flex justify-end gap-2 px-6 py-4",Ye="text-secondary dial-small-150 px-6 py-4",Je="Cancel",Z={[_.Info]:{confirmVariant:I.Primary,cancelVariant:I.Secondary},[_.Danger]:{container:"border-t-4 border-error",confirmVariant:I.Danger,cancelVariant:I.Secondary}},es=({title:e,description:t,descriptionCssClass:r,open:n=!1,confirmLabel:a,cancelLabel:o=Je,isLoading:c=!1,disableConfirmButton:d=!1,cssClass:u,confirmClassName:l,onClose:x,onConfirm:p,onCancel:h,children:f,dividers:C=!1,variant:g=_.Info,size:D=F.Sm})=>{const R=c?null:s.jsxs("div",{className:Qe,children:[s.jsx(P,{variant:I.Secondary,title:o,onClick:()=>h?h():x?.()}),s.jsx(P,{variant:Z[g].confirmVariant,cssClass:l,title:a,disable:d,onClick:()=>p()})]}),y=m.useCallback(()=>c?s.jsx("div",{className:"px-6 py-4 h-[120px]",children:s.jsx(Q,{size:50})}):f??(t?s.jsx("div",{className:i(Ye,r),children:t}):null),[f,t,c,r]);return s.jsx(ae,{open:n,title:e,cssClass:i(Z[g].container,u),dividers:C,onClose:()=>x?.(),footer:R,size:D,children:y()})},ss=({onClick:e})=>s.jsx(v.IconEyeOff,{...V,className:"text-primary",onClick:e}),ts=({onClick:e})=>s.jsx(v.IconEye,{...V,className:"text-primary",onClick:e}),oe=({...e})=>{const[t,r]=m.useState(!1),n=m.useCallback(a=>{r(a)},[]);return s.jsx(W,{type:t?"text":"password",...e,iconAfter:t?s.jsx(ss,{onClick:()=>n(!1)}):s.jsx(ts,{onClick:()=>n(!0)})})},rs=({fieldTitle:e,optional:t,elementCssClass:r,elementId:n,errorText:a,...o})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(M,{fieldTitle:e,optional:t,htmlFor:n}),s.jsx(oe,{cssClass:r,elementId:n,invalid:!!a,...o}),s.jsx(O,{errorText:a})]});var H=(e=>(e.Small="small",e.Base="base",e))(H||{});const ns={[H.Small]:{textClass:"text-xs px-1",containerClass:"px-[6px] py-1 h-[22px]",iconSize:10,iconStroke:1},[H.Base]:{textClass:"text-sm px-2",containerClass:"px-3 py-2 h-[38px]",iconSize:18,iconStroke:1.5}},as=({elementId:e,value:t,placeholder:r,disabled:n,readonly:a,invalid:o,cssClass:c,containerCssClass:d,onChange:u,size:l=H.Base})=>{const[x,p]=m.useState(t||"");m.useEffect(()=>{p(t||"")},[t]);const h=m.useCallback(g=>{p(g),u?.(g)},[u]),f=ns[l],C=m.useCallback(()=>{h("")},[h]);return s.jsxs("div",{className:i("dial-input flex flex-row items-center justify-between",o&&"dial-input-error",n&&"dial-input-disable",a&&"dial-input-readonly",f.containerClass,d),children:[s.jsx(S,{className:i(n?"text-secondary":"text-primary"),icon:s.jsx(v.IconSearch,{size:f.iconSize,stroke:f.iconStroke})}),s.jsx("input",{id:e,type:"text",autoComplete:"off",placeholder:r,value:x??"",disabled:n,readOnly:a,className:i("border-0 bg-transparent w-full",c,f.textClass),onChange:g=>!a&&h(g.currentTarget.value)}),x&&!a&&!n&&s.jsx(S,{className:"text-primary cursor-pointer",icon:s.jsx(v.IconX,{size:f.iconSize,stroke:f.iconStroke,onClick:C,"aria-label":"Clear search",role:"button"})})]})},X=({selectedItems:e,listCssClass:t,listElementCssClass:r})=>!!e?.length&&s.jsx("ul",{className:i("flex-row items-center truncate flex-wrap","flex gap-x-2 gap-y-1",t),children:e?.map(n=>s.jsx("li",{className:i(["tiny bg-layer-3 rounded p-1 border border-primary max-w-[200px] truncate",r]),children:s.jsx(T,{tooltip:n,children:s.jsx("button",{"aria-label":"autocomplete-action",type:"button",className:"truncate w-full",children:n})})},n))}),U=e=>k.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M2.25 13.5V12C2.25 11.5858 2.58579 11.25 3 11.25C3.41421 11.25 3.75 11.5858 3.75 12V13.5C3.75 13.6989 3.82907 13.8896 3.96973 14.0303C4.11038 14.1709 4.30109 14.25 4.5 14.25H6C6.41421 14.25 6.75 14.5858 6.75 15C6.75 15.4142 6.41421 15.75 6 15.75H4.5C3.90326 15.75 3.33114 15.5128 2.90918 15.0908C2.48722 14.6689 2.25 14.0967 2.25 13.5ZM14.25 6V4.5C14.25 4.30109 14.1709 4.11038 14.0303 3.96973C13.8896 3.82907 13.6989 3.75 13.5 3.75H12C11.5858 3.75 11.25 3.41421 11.25 3C11.25 2.58579 11.5858 2.25 12 2.25H13.5C14.0967 2.25 14.6689 2.48722 15.0908 2.90918C15.5128 3.33114 15.75 3.90326 15.75 4.5V6C15.75 6.41421 15.4142 6.75 15 6.75C14.5858 6.75 14.25 6.41421 14.25 6Z",fill:"currentColor"})),os=({children:e,open:t,readonly:r,selectedValue:n,valueCssClasses:a,inputCssClasses:o,onOpen:c,elementId:d,errorText:u,emptyValueText:l})=>{const x=Array.isArray(n)&&n.length>0,p=typeof n=="string"&&!!n.trim(),h=x||p?n:l,f=r?void 0:c,C=()=>s.jsxs(s.Fragment,{children:[s.jsx("button",{type:"button",className:"w-full",onClick:f,"aria-label":"open-popup",id:d,children:s.jsxs("div",{className:i("dial-input px-3 py-2 dial-input-field flex flex-row items-center w-full justify-between",o,r&&"dial-input-disable",u&&"dial-input-error"),children:[s.jsx(T,{tooltip:String(h),children:s.jsx("span",{className:a,children:h})}),!r&&s.jsx("div",{className:"flex-shrink-0",children:s.jsx(S,{icon:s.jsx(U,{role:"img",width:A,height:A})})})]})}),u&&s.jsx(O,{errorText:u})]}),g=()=>s.jsx("div",{className:"w-full",onClick:f,children:s.jsxs("div",{className:i("dial-input px-3 py-2 flex flex-row items-center w-full justify-between",r&&"dial-input-disable"),children:[s.jsx(X,{selectedItems:h}),!r&&s.jsx("div",{className:"ml-1",children:s.jsx(S,{icon:s.jsx(U,{role:"img",width:A,height:A})})})]})});return s.jsxs(s.Fragment,{children:[x?g():C(),t&&ie.createPortal(e,document.body)]})},ls=({placeholder:e="",selectedItems:t=[],updateSelected:r,listCssClass:n,listElementCssClass:a,containerCssClass:o,inputCssClass:c})=>{const[d,u]=m.useState(""),l=m.useCallback(p=>{p.key==="Enter"&&(r([...t,p.currentTarget.value]),u("")),(p.key==="Backspace"||p.key==="Delete")&&t.length&&!d&&r(t.slice(0,-1))},[t,r,d]),x=m.useCallback(p=>{u(p.target.value)},[u]);return s.jsxs("div",{className:i(["dial-input px-3 py-2 flex flex-row items-center flex-wrap w-fit gap-2",o]),children:[s.jsx(X,{selectedItems:t,listCssClass:n,listElementCssClass:a}),s.jsx("input",{type:"text",value:d,className:i(["border-0 bg-transparent p-0",c]),placeholder:t?.length?"":e,onKeyDown:l,onChange:x})]})},is=({initialTags:e=[],fieldTitle:t,optional:r,elementId:n,placeholder:a,errorText:o,invalid:c,disabled:d,onChange:u})=>{const l=m.useRef(null),[x,p]=m.useState(e),[h,f]=m.useState(""),[C,g]=m.useState(!1),D=b=>{const w=b.trim().replace(/,$/,"");if(w&&!x.includes(w)){const z=[w,...x];p(z),u?.(z)}},R=b=>{(b.key===","||b.key==="Enter")&&(b.preventDefault(),D(h),f(""))},y=b=>{const w=x.filter((z,$)=>$!==b);p(w),u?.(w)};return m.useEffect(()=>{const b=new ResizeObserver(()=>{if(l.current){const w=l.current.scrollHeight>l.current.clientHeight+10;g(w)}});return l.current&&b.observe(l.current),()=>b.disconnect()},[x]),s.jsxs("div",{className:i("flex flex-col w-full"),children:[s.jsx(M,{fieldTitle:t,optional:r,htmlFor:n}),s.jsx("div",{className:i("dial-input min-h-[38px] p-[6px]",c&&"dial-input-error",d&&"dial-input-disable"),children:s.jsxs("div",{ref:l,className:i("flex flex-wrap gap-2 items-center",C?"flex-col-reverse":"flex-row"),children:[x.map((b,w)=>s.jsx(se,{tag:b,remove:d?void 0:()=>y(w)},b+w)),s.jsx("input",{type:"text",value:h,onChange:b=>f(b.target.value),onKeyDown:R,className:i("dial-input-no-border outline-none border-none w-full min-w-[100px] flex-1 p-1"),placeholder:a,disabled:d})]})}),s.jsx(O,{errorText:o})]})};exports.AlertVariant=E;exports.ButtonVariant=I;exports.ConfirmationPopupVariant=_;exports.DialAlert=me;exports.DialAutocompleteInput=ls;exports.DialAutocompleteInputValue=X;exports.DialButton=P;exports.DialCheckbox=Ne;exports.DialCloseButton=te;exports.DialCollapsibleSidebar=Ve;exports.DialConfirmationPopup=es;exports.DialErrorText=O;exports.DialFieldLabel=M;exports.DialIcon=S;exports.DialInput=W;exports.DialInputPopup=os;exports.DialLabelledText=Oe;exports.DialLoader=Q;exports.DialNoDataContent=Pe;exports.DialNumberInputField=He;exports.DialPasswordInput=oe;exports.DialPasswordInputField=rs;exports.DialPopup=ae;exports.DialRadioButton=ee;exports.DialRadioGroup=Fe;exports.DialSearch=as;exports.DialSteps=Se;exports.DialSwitch=Ke;exports.DialTag=se;exports.DialTagInput=is;exports.DialTextAreaField=Ge;exports.DialTextInputField=qe;exports.DialTextarea=re;exports.DialTooltip=T;exports.PopupSize=F;exports.RadioGroupOrientation=G;exports.SearchSize=H;exports.StepStatus=N;exports.TagVariant=K;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("classnames"),N=require("@tabler/icons-react"),f=require("react"),h=require("@floating-ui/react"),ke=require("react-dom");function De(s){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>s[n]})}}return t.default=s,Object.freeze(t)}const L=De(f),$=({errorText:s})=>s&&e.jsx("span",{className:"text-error dial-tiny mt-1",children:s}),W=({fieldTitle:s,htmlFor:t,optional:n,optionalText:r,cssClass:a})=>s?e.jsxs("label",{className:l("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:t,children:[e.jsx("span",{className:"min-h-4",children:s}),n&&e.jsx("span",{className:"ml-1",children:r??"(Optional)"})]}):null,R=({icon:s,className:t})=>s?e.jsx("span",{className:l("flex-shrink-0",t),children:s}):null;var I=(s=>(s.Primary="primary",s.Secondary="secondary",s.Tertiary="tertiary",s.Danger="danger",s))(I||{});const Ie={[I.Primary]:"dial-primary-button",[I.Secondary]:"dial-secondary-button",[I.Tertiary]:"dial-tertiary-button",[I.Danger]:"dial-danger-button"},M=({title:s,variant:t,cssClass:n,textCssClass:r,ref:a,onClick:o,disable:c,iconAfter:u,iconBefore:d,hideTitleOnMobile:i,ariaLabel:x})=>{const p=l("dial-small-semi",u?"mr-2":"",d?"ml-2":"",i?"hidden sm:inline":"inline",r),j=l(t&&Ie[t],n,"focus-visible:outline outline-offset-0");return e.jsxs("button",{ref:a,type:"button",className:j,onClick:g=>o?.(g),disabled:c,"aria-label":s||x,children:[e.jsx(R,{icon:d}),s&&e.jsx("span",{className:p,children:s}),e.jsx(R,{icon:u})]})};var V=(s=>(s.Info="info",s.Success="success",s.Warning="warning",s.Error="error",s))(V||{});const Se={info:e.jsx(N.IconInfoCircle,{size:24,stroke:2}),error:e.jsx(N.IconAlertCircle,{size:24,stroke:2}),warning:e.jsx(N.IconAlertTriangle,{size:24,stroke:2}),success:e.jsx(N.IconCircleCheck,{size:24,stroke:2})},Re={[V.Info]:"bg-info border-info text-info",[V.Success]:"bg-success border-success text-success",[V.Warning]:"bg-warning border-warning text-warning",[V.Error]:"bg-error border-error text-error"},Fe="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",Ee=({variant:s=V.Info,message:t,cssClass:n,closable:r=!1,onClose:a})=>e.jsxs("div",{role:"alert",className:l(Fe,Re[s],n),children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(R,{icon:Se[s]}),e.jsx("div",{className:"text-primary",children:t})]}),r&&e.jsx(M,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:e.jsx(N.IconX,{size:16}),onClick:o=>a?.(o)})]}),Le="flex items-center justify-center text-secondary",Pe="shrink-0 grow-0 basis-auto animate-spin-steps",Te=s=>L.createElement("svg",{viewBox:"0 0 48 48",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},L.createElement("path",{d:"M24 39V46.5",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.4,d:"M9 24H1.5",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.5,d:"M8.0918 8.0918L13.3994 13.3994",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.6,d:"M24 1.5V9",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.7,d:"M39.9121 8.08594L37.2607 10.7373L34.6094 13.3887",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.8,d:"M46.5 24H39",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.9,d:"M34.6055 34.6055L39.9082 39.9082",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"}),L.createElement("path",{opacity:.3,d:"M13.3936 34.6055L8.08594 39.9131",stroke:"currentColor",strokeWidth:3,strokeLinecap:"round",strokeLinejoin:"round"})),re=({size:s=18,cssClass:t,iconClass:n,fullWidth:r=!0,ariaLabel:a="Loading"})=>e.jsx("div",{role:"status","aria-label":a,className:l({[Le]:!0,"w-full h-full":r,[t||""]:!!t}),children:e.jsx(R,{icon:e.jsx(Te,{width:s,height:s,className:l(Pe,n),role:"img"})})}),Ae=7,Me=2,ae=f.createContext(null),oe=()=>{const s=f.useContext(ae);if(s==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return s},Oe=({initialOpen:s=!1,placement:t="bottom",isTriggerClickable:n=!1,open:r,onOpenChange:a}={})=>{const[o,c]=f.useState(s),u=f.useRef(null),d=r??o,i=a??c,x=h.useFloating({placement:t,open:d,onOpenChange:i,whileElementsMounted:h.autoUpdate,middleware:[h.offset(Ae+Me),h.flip({crossAxis:t.includes("-"),fallbackAxisSideDirection:"start",padding:5}),h.shift({padding:5}),h.arrow({element:u})]}),p=h.useHover(x.context,{move:!1,enabled:r==null,mouseOnly:n,delay:{open:500,close:0}}),j=h.useFocus(x.context,{enabled:r==null}),g=h.useDismiss(x.context),v=h.useRole(x.context,{role:"tooltip"}),b=h.useInteractions([p,j,g,v]);return f.useMemo(()=>({open:d,setOpen:i,arrowRef:u,...b,...x}),[d,i,b,x])},Ve=({children:s,...t})=>{const n=Oe(t);return e.jsx(ae.Provider,{value:n,children:s})},Be=f.forwardRef(function({style:t,...n},r){const a=oe(),o=h.useMergeRefs([a.refs.setFloating,r]);return a.open?e.jsx(h.FloatingPortal,{id:"tooltip-portal",children:e.jsxs("div",{ref:o,style:{...a.floatingStyles,...t},...a.getFloatingProps(n),className:l("z-[55] whitespace-pre-wrap break-words rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(n).className),children:[n.children,e.jsx(h.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),We=f.forwardRef(function({children:t,asChild:n=!1,...r},a){const o=oe(),u=t&&typeof t=="object"&&"ref"in t&&t.ref!==void 0?t.ref:void 0,d=h.useMergeRefs([o.refs.setReference,a,u]);return n&&f.isValidElement(t)?f.cloneElement(t,o.getReferenceProps({ref:d,...r,...t.props})):e.jsx("span",{ref:d,...o.getReferenceProps(r),className:r.className??"dial-tooltip-trigger text-left",children:t})}),O=({hideTooltip:s,tooltip:t,children:n,triggerClassName:r,contentClassName:a,...o})=>e.jsxs(Ve,{...o,children:[e.jsx(We,{className:l(r,"truncate"),children:n}),e.jsx(Be,{className:l("text-primary",a,"max-w-[300px]",(s||!t)&&"hidden"),children:t})]}),_=18,G={size:_,stroke:2},ze=({label:s,id:t,checked:n,indeterminate:r,disabled:a,ariaLabel:o,onChange:c})=>{const u=f.useCallback(p=>{c?.(p.target.checked,t)},[c,t]),d=l("flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",`${n||r?"":'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":""),i=l("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":""),x=()=>r?e.jsx(N.IconMinus,{className:i,...G}):n?e.jsx(N.IconCheck,{className:i,...G}):null;return e.jsxs("label",{className:d,htmlFor:t,children:[x(),s&&e.jsx(O,{tooltip:s,triggerClassName:"flex-1 min-w-0",children:e.jsx("p",{className:"text-primary w-full truncate",children:s})}),e.jsx("input",{type:"checkbox",role:"checkbox",name:t,onChange:u,id:t,checked:n,"aria-checked":r?"mixed":n,"aria-disabled":a||void 0,"aria-label":s?void 0:o,className:"invisible w-0 h-0"})]})};var S=(s=>(s.VALID="valid",s.ERROR="error",s))(S||{});const He=(s,t)=>{if(t===s.id)switch(s.status){case S.VALID:return"border-accent-secondary text-primary";case S.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(s.status){case S.VALID:return"border-primary text-white";case S.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},_e=(s,t)=>{if(t===s.id)switch(s.status){case S.VALID:return"bg-accent-secondary";case S.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(s.status){case S.VALID:return"bg-accent-secondary";case S.ERROR:return"bg-red-400";default:return"bg-layer-4"}},Ge=({step:s,index:t,currentStep:n,onChangeStep:r})=>{const a="h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer",o="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",c=()=>n===s.id&&s.status===S.ERROR?e.jsx(N.IconExclamationCircle,{stroke:2,size:16}):n!==s.id&&s.status===S.VALID?e.jsx(N.IconCheck,{stroke:2,size:16}):t+1;return e.jsxs("button",{className:l(a,He(s,n)),onClick:()=>r(s.id),children:[e.jsx("span",{className:l(o,_e(s,n)),children:c()}),e.jsx("span",{children:s.name})]})},$e=({steps:s,currentStep:t,onChangeStep:n})=>{const r=a=>{const o=s.findIndex(u=>u.id===t),c=s.findIndex(u=>u.id===a);(a!==t&&s[o].status===S.VALID||c<o)&&n(a)};return e.jsx("div",{id:"steps",className:"flex gap-x-3",children:s.map((a,o)=>e.jsx(Ge,{currentStep:t,onChangeStep:r,step:a,index:o},a.id))})},le=({name:s,value:t,title:n,description:r,checked:a=!1,inputId:o,cssClass:c,labelCssClass:u,disabled:d,onChange:i,descriptionCssClass:x})=>{const p=`${o}-desc`,j=l("dial-small cursor-pointer",d?"text-secondary":"text-primary",u),g=l("cursor-pointer dial-input-radio",n&&"mr-2",c),v=l("flex flex-col",!!r&&"mb-2"),b=l("dial-tiny mt-2 ml-[26px] text-secondary",x),D=k=>{d||k.target.checked&&i?.(t)};return e.jsxs("div",{className:v,children:[e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx("input",{type:"radio",id:o,name:s,value:t,checked:a,disabled:d,"aria-describedby":a&&r?p:void 0,className:g,onChange:D}),n?e.jsx("label",{className:j,htmlFor:o,children:n}):null]}),a&&r&&e.jsx("div",{id:p,className:b,children:r})]})};var K=(s=>(s.Row="Row",s.Column="Column",s))(K||{});const qe="flex flex-col gap-2",Ke="flex",Ue="pb-1 mt-2",Xe={[K.Column]:"flex-col gap-y-3",[K.Row]:"flex-row gap-x-6"},ie=({fieldTitle:s,radioCssClass:t,labelCssClass:n,disabled:r,elementId:a,radioButtons:o,activeRadioButton:c,orientation:u,onChange:d})=>e.jsxs("div",{className:qe,children:[s&&e.jsx(W,{fieldTitle:s,htmlFor:a}),e.jsx("div",{role:"radiogroup","aria-label":s,"aria-disabled":r||void 0,className:l(Ke,Xe[u]),children:o.map(i=>e.jsxs("div",{className:"flex flex-col",children:[e.jsx(le,{name:a,value:i.id,inputId:i.id,disabled:r,cssClass:t,labelCssClass:n,title:i.name,checked:i.id===c,onChange:()=>d(i.id)}),i.id===c&&i.content?e.jsx("div",{className:Ue,children:i.content}):null]},i.id))})]}),Ze=({icon:s,title:t,description:n})=>e.jsxs("div",{className:"h-full w-full flex flex-col items-center justify-center text-secondary",children:[s||e.jsx(N.IconClipboardX,{width:60,height:60}),e.jsx("span",{className:"small mt-2 text-primary",children:t}),n&&e.jsx("span",{className:"mt-1 text-primary",children:n})]}),Qe=60,Ye=({containerCssClass:s,children:t,width:n,title:r,iconSize:a=_,titleCssClass:o,additionalButtons:c})=>{const[u,d]=f.useState(n),[i,x]=f.useState(!0),p=l(["transform rotate-180 [writing-mode:tb-rl]",i&&"hidden",o]),j=l(["flex flex-row gap-2 cursor-pointer text-secondary",i?"justify-end":"justify-center"]),g=()=>{d(i?Qe:n),x(!i)};return e.jsxs("div",{className:l(["rounded p-4 flex flex-col justify-between overflow-y-auto flex-shrink-0",s]),style:{width:`${u}px`},children:[e.jsx("div",{className:l(["flex-1 min-h-0 overflow-auto",!i&&"hidden"]),children:t}),e.jsx("div",{className:p,children:r}),e.jsxs("div",{className:j,children:[i&&c,e.jsx(M,{cssClass:"hover:text-icon-accent-primary",onClick:g,iconBefore:i?e.jsx(N.IconChevronsLeft,{size:a,stroke:G.stroke}):e.jsx(N.IconChevronsRight,{size:a,stroke:G.stroke})})]})]})},Je=({label:s,text:t,children:n,postfix:r})=>e.jsxs("div",{className:l("flex flex-col text-secondary",n?"":"max-w-[200px]"),children:[e.jsx("label",{className:"dial-tiny mb-2",children:s}),n||e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx(O,{triggerClassName:"text-primary",tooltip:t,children:t}),r||null]})]});var Y=(s=>(s.Default="default",s))(Y||{});const es={[Y.Default]:"border-icon-secondary bg-layer-3"},ce=({tag:s,cssClass:t,remove:n,variant:r=Y.Default})=>{const a=es[r],o=l("flex items-center gap-1 tiny border rounded p-1 h-[22px] text-primary",t,a);return e.jsxs("div",{className:o,children:[e.jsx("span",{children:s}),n&&e.jsx(M,{iconAfter:e.jsx(N.IconX,{size:16}),onClick:n})]},s)},J=({ariaLabel:s,cssClass:t,size:n=24,onClose:r})=>e.jsx(M,{ariaLabel:s,cssClass:l("text-secondary hover:text-accent-primary",t),onClick:r,iconBefore:e.jsx(N.IconX,{size:n})}),de=({value:s,textareaId:t,placeholder:n,cssClass:r="",disabled:a,invalid:o,readonly:c,onChange:u})=>e.jsx(O,{tooltip:s,triggerClassName:"flex",children:e.jsx("textarea",{id:t,placeholder:n,value:s||"",disabled:a,className:l("dial-textarea dial-input px-3 py-2",o?"dial-input-error":"",a&&"dial-input-disable",c&&"dial-input-readonly",r),onChange:d=>!c&&u?.(d.currentTarget.value)})}),ss=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],ts=(s,t,n,r)=>{if((t==="number"||n!==void 0||r!==void 0)&&!ss.includes(s.key)&&!(s.key==="-"&&s.currentTarget.selectionStart===0&&(n===void 0||n<0))&&!(s.key==="."&&t==="number"&&!s.currentTarget.value.includes("."))){if(!/^[0-9]$/.test(s.key)){s.preventDefault();return}if(n!==void 0||r!==void 0){const o=s.currentTarget.value,c=s.currentTarget.selectionStart||0,u=o.slice(0,c)+s.key+o.slice(c),d=parseFloat(u);if(!isNaN(d)){if(n!==void 0&&d<n){s.preventDefault();return}if(r!==void 0&&d>r){s.preventDefault();return}}}}},U=({iconBefore:s,iconAfter:t,hideBorder:n,value:r,elementId:a,placeholder:o="",cssClass:c="",containerCssClass:u,tooltipTriggerClassName:d,type:i="text",disabled:x,readonly:p,invalid:j,onChange:g,min:v,max:b,prefix:D,suffix:k,textBeforeInput:y,textAfterInput:C})=>{const w=F=>F.target.blur(),A=i==="number"||v!==void 0||b!==void 0,P=F=>{ts(F,i,v,b)},z=F=>{const E=F.currentTarget.value;if(A&&E!==""){const H=parseFloat(E);if(isNaN(H)&&E!=="-"&&E!=="."||!isNaN(H)&&(v!==void 0&&H<v||b!==void 0&&H>b))return}g?.(E)};return e.jsxs("div",{className:l("dial-input-field flex flex-row items-center justify-between py-2",n?"dial-input-no-border":"dial-input",j&&"dial-input-error",x&&"dial-input-disable",p&&"dial-input-readonly",!y&&"pl-3",!C&&"pr-3",u),children:[y&&e.jsx("div",{children:e.jsx(U,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"overflow-hidden overflow-ellipsis dial-small",value:y,disabled:!0,elementId:y+"textBefore"})}),D&&e.jsxs("p",{className:"text-secondary dial-small",children:[" ",D]}),e.jsx(R,{icon:s}),e.jsx(O,{tooltip:r,triggerClassName:l(d,"flex-1"),children:e.jsx("input",{type:i,autoComplete:"off",id:a,placeholder:o,value:r??"",disabled:x,className:l("border-0 bg-transparent",c),onChange:F=>!p&&z?.(F),onKeyDown:P,onWheel:w,min:v,max:b})}),e.jsx(R,{icon:t}),k&&e.jsxs("p",{className:"text-secondary dial-small",children:[" ",k]}),C&&e.jsx("div",{children:e.jsx(U,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",value:C,disabled:!0,elementId:C+"textAfter"})})]})},ns=/^0+\.(\d+)?$/,rs=/^0+/,ue=({fieldTitle:s,errorText:t,optional:n,elementCssClass:r,elementContainerCssClass:a,elementId:o,containerCssClass:c,readonly:u,defaultEmptyText:d,min:i,max:x,...p})=>e.jsxs("div",{className:l("flex flex-col",c),children:[e.jsx(W,{fieldTitle:s,optional:n,htmlFor:o}),u?e.jsx("span",{children:p.value||(d??"None")}):e.jsxs(e.Fragment,{children:[e.jsx(U,{elementId:o,cssClass:r,containerCssClass:a,invalid:t!=null,min:i,max:x,...p}),e.jsx($,{errorText:t})]})]}),as=({onChange:s,value:t,min:n,max:r,...a})=>{const o=c=>String(c)?.match(ns)?String(c)?.replace(rs,"0"):Number(c);return e.jsx(ue,{type:"number",onChange:c=>s?.(o(c)),value:t,min:n,max:r,...a})},os=({onChange:s,...t})=>e.jsx(ue,{type:"text",onChange:n=>s?.(n),...t}),ls=({fieldTitle:s,optional:t,elementId:n,elementCssClass:r,errorText:a,...o})=>e.jsxs("div",{className:"flex flex-col",children:[e.jsx(W,{fieldTitle:s,optional:t,htmlFor:n}),e.jsx(de,{textareaId:n,cssClass:r,...o}),e.jsx($,{errorText:a})]}),is=({title:s,switchId:t,isOn:n=!1,disabled:r,onChange:a})=>{const o=l("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",n?"flex-row-reverse":"flex-row",r?"pointer-events-none":"",r?n?"bg-controls-disable":"bg-layer-4":n?"bg-accent-primary":"bg-layer-4"),c=f.useCallback(u=>{u.stopPropagation(),a?.(!n)},[a,n]);return e.jsxs("div",{className:"flex flex-row items-center",children:[e.jsx("input",{type:"checkbox",onChange:c,id:t,disabled:r,className:"invisible w-0 h-0",checked:n}),e.jsx("label",{htmlFor:t,className:o,children:e.jsx("span",{className:l("size-3 rounded-full",r?n?"bg-layer-4":"bg-controls-disable":"bg-controls-enable-primary")})}),s&&e.jsx("span",{className:"pl-2 dial-small text-primary",children:s})]})};var B=(s=>(s.Sm="sm",s.Md="md",s.Lg="lg",s))(B||{});const cs="z-[52] flex items-center justify-center bg-blackout md:p-4",ds="divide-tertiary divide-y",us="flex flex-row justify-between py-4 px-6 items-center",xs={[B.Sm]:"dial-sm-popup",[B.Md]:"dial-md-popup",[B.Lg]:"dial-lg-popup"},ee=({open:s=!1,title:t,portalId:n,cssClass:r,overlayClass:a,headingClass:o,dividers:c=!0,children:u,footer:d,onClose:i,size:x=B.Md})=>{const{refs:p,context:j}=h.useFloating({open:s,onOpenChange:y=>{y||i?.(null)}}),g=h.useRole(j,{role:"dialog"}),v=h.useDismiss(j,{outsidePress:!0}),{getFloatingProps:b}=h.useInteractions([g,v]);if(!s)return null;const D=typeof t=="string"?"dial-popup-heading":void 0,k=y=>y?typeof y=="string"?e.jsx("h3",{id:D,className:l("flex-1 min-w-0 mr-3 truncate dial-h3 text-primary",o),children:e.jsx(O,{tooltip:y,children:y})}):y:e.jsx("span",{});return e.jsx(h.FloatingPortal,{id:n,children:e.jsx(h.FloatingOverlay,{className:l(cs,a),children:e.jsx(h.FloatingFocusManager,{context:j,children:e.jsxs("div",{ref:p.setFloating,...b(),role:"dialog","aria-modal":"true","aria-labelledby":D,className:l("dial-popup",xs[x],c&&ds,r),children:[e.jsxs("div",{className:us,children:[k(t),e.jsx(J,{ariaLabel:"Close dialog",onClose:y=>i?.(y)})]}),e.jsx("div",{className:"flex-grow overflow-auto",children:u}),d]})})})})};var X=(s=>(s.Info="info",s.Danger="danger",s))(X||{});const ps="flex justify-end gap-2 px-6 py-4",fs="text-secondary dial-small-150 px-6 py-4",ms="Cancel",te={[X.Info]:{confirmVariant:I.Primary,cancelVariant:I.Secondary},[X.Danger]:{container:"border-t-4 border-error",confirmVariant:I.Danger,cancelVariant:I.Secondary}},hs=({title:s,description:t,descriptionCssClass:n,open:r=!1,confirmLabel:a,cancelLabel:o=ms,isLoading:c=!1,disableConfirmButton:u=!1,cssClass:d,confirmClassName:i,onClose:x,onConfirm:p,onCancel:j,children:g,dividers:v=!1,variant:b=X.Info,size:D=B.Sm})=>{const k=c?null:e.jsxs("div",{className:ps,children:[e.jsx(M,{variant:I.Secondary,title:o,onClick:()=>j?j():x?.()}),e.jsx(M,{variant:te[b].confirmVariant,cssClass:i,title:a,disable:u,onClick:()=>p()})]}),y=f.useCallback(()=>c?e.jsx("div",{className:"px-6 py-4 h-[120px]",children:e.jsx(re,{size:50})}):g??(t?e.jsx("div",{className:l(fs,n),children:t}):null),[g,t,c,n]);return e.jsx(ee,{open:r,title:s,cssClass:l(te[b].container,d),dividers:v,onClose:()=>x?.(),footer:k,size:D,children:y()})},se=({selectedItems:s,listCssClass:t,listElementCssClass:n})=>!!s?.length&&e.jsx("ul",{className:l("flex-row items-center truncate flex-wrap","flex gap-x-2 gap-y-1",t),children:s?.map(r=>e.jsx("li",{className:l(["tiny bg-layer-3 rounded p-1 border border-primary max-w-[200px] truncate",n]),children:e.jsx(O,{tooltip:r,children:e.jsx("button",{"aria-label":"autocomplete-action",type:"button",className:"truncate w-full",children:r})})},r))}),ne=s=>L.createElement("svg",{width:18,height:18,viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",...s},L.createElement("path",{d:"M2.25 13.5V12C2.25 11.5858 2.58579 11.25 3 11.25C3.41421 11.25 3.75 11.5858 3.75 12V13.5C3.75 13.6989 3.82907 13.8896 3.96973 14.0303C4.11038 14.1709 4.30109 14.25 4.5 14.25H6C6.41421 14.25 6.75 14.5858 6.75 15C6.75 15.4142 6.41421 15.75 6 15.75H4.5C3.90326 15.75 3.33114 15.5128 2.90918 15.0908C2.48722 14.6689 2.25 14.0967 2.25 13.5ZM14.25 6V4.5C14.25 4.30109 14.1709 4.11038 14.0303 3.96973C13.8896 3.82907 13.6989 3.75 13.5 3.75H12C11.5858 3.75 11.25 3.41421 11.25 3C11.25 2.58579 11.5858 2.25 12 2.25H13.5C14.0967 2.25 14.6689 2.48722 15.0908 2.90918C15.5128 3.33114 15.75 3.90326 15.75 4.5V6C15.75 6.41421 15.4142 6.75 15 6.75C14.5858 6.75 14.25 6.41421 14.25 6Z",fill:"currentColor"})),xe=({children:s,open:t,readonly:n,selectedValue:r,valueCssClasses:a,inputCssClasses:o,onOpen:c,elementId:u,errorText:d,emptyValueText:i})=>{const x=Array.isArray(r)&&r.length>0,p=typeof r=="string"&&!!r.trim(),j=x||p?r:i,g=n?void 0:c,v=()=>e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:"w-full",onClick:g,"aria-label":"open-popup",id:u,children:e.jsxs("div",{className:l("dial-input px-3 py-2 dial-input-field flex flex-row items-center w-full justify-between",o,n&&"dial-input-disable",d&&"dial-input-error"),children:[e.jsx(O,{tooltip:String(j),children:e.jsx("span",{className:a,children:j})}),!n&&e.jsx("div",{className:"flex-shrink-0",children:e.jsx(R,{icon:e.jsx(ne,{role:"img",width:_,height:_})})})]})}),d&&e.jsx($,{errorText:d})]}),b=()=>e.jsx("div",{className:"w-full",onClick:g,children:e.jsxs("div",{className:l("dial-input px-3 py-2 flex flex-row items-center w-full justify-between",n&&"dial-input-disable"),children:[e.jsx(se,{selectedItems:j}),!n&&e.jsx("div",{className:"ml-1",children:e.jsx(R,{icon:e.jsx(ne,{role:"img",width:_,height:_})})})]})});return e.jsxs(e.Fragment,{children:[x?b():v(),t&&ke.createPortal(s,document.body)]})},gs=({fieldTitle:s,htmlFor:t,readonly:n,selectedValue:r,radioButtons:a,customInputValue:o,valueCssClasses:c,inputCssClasses:u,emptyValueText:d,onClose:i,title:x,portalId:p,onApply:j,cancelButtonTitle:g="Cancel",applyButtonTitle:v="Apply",isValid:b,selectedRadioValue:D,onChangeRadioField:k,id:y})=>{const[C,w]=f.useState(!1),A=f.useCallback(()=>{n||w(!0)},[n]),P=f.useCallback(()=>{w(!1),i?.()},[i]),z=f.useCallback(()=>{j(),P()},[j,P]);return e.jsxs("div",{className:"flex flex-col",children:[e.jsx(W,{fieldTitle:s,htmlFor:t}),e.jsx(xe,{readonly:n,open:C,selectedValue:o??a.find(F=>F.id===r)?.name,valueCssClasses:c,inputCssClasses:l(u,"py-2","px-3"),emptyValueText:d,onOpen:A,children:e.jsx(ee,{open:C,onClose:P,title:x,portalId:p,footer:e.jsxs("div",{className:"flex flex-row items-center justify-end gap-2 px-6 py-4",children:[e.jsx(M,{variant:I.Secondary,title:g,onClick:P}),e.jsx(M,{variant:I.Primary,title:v,onClick:z,disable:!b})]}),children:e.jsx("div",{className:"px-6 py-4",children:e.jsx(ie,{radioButtons:a,labelCssClass:"dial-small",activeRadioButton:D,onChange:k,elementId:y,orientation:K.Column})})})})]})},js=({onClick:s})=>e.jsx(N.IconEyeOff,{...G,className:"text-primary",onClick:s}),Cs=({onClick:s})=>e.jsx(N.IconEye,{...G,className:"text-primary",onClick:s}),pe=({...s})=>{const[t,n]=f.useState(!1),r=f.useCallback(a=>{n(a)},[]);return e.jsx(U,{type:t?"text":"password",...s,iconAfter:t?e.jsx(js,{onClick:()=>r(!1)}):e.jsx(Cs,{onClick:()=>r(!0)})})},bs=({fieldTitle:s,optional:t,elementCssClass:n,elementId:r,errorText:a,...o})=>e.jsxs("div",{className:"flex flex-col",children:[e.jsx(W,{fieldTitle:s,optional:t,htmlFor:r}),e.jsx(pe,{cssClass:n,elementId:r,invalid:!!a,...o}),e.jsx($,{errorText:a})]});var Z=(s=>(s.Small="small",s.Base="base",s))(Z||{});const ys={[Z.Small]:{textClass:"text-xs px-1",containerClass:"px-[6px] py-1 h-[22px]",iconSize:10,iconStroke:1},[Z.Base]:{textClass:"text-sm px-2",containerClass:"px-3 py-2 h-[38px]",iconSize:18,iconStroke:1.5}},vs=({elementId:s,value:t,placeholder:n,disabled:r,readonly:a,invalid:o,cssClass:c,containerCssClass:u,onChange:d,size:i=Z.Base})=>{const[x,p]=f.useState(t||"");f.useEffect(()=>{p(t||"")},[t]);const j=f.useCallback(b=>{p(b),d?.(b)},[d]),g=ys[i],v=f.useCallback(()=>{j("")},[j]);return e.jsxs("div",{className:l("dial-input flex flex-row items-center justify-between",o&&"dial-input-error",r&&"dial-input-disable",a&&"dial-input-readonly",g.containerClass,u),children:[e.jsx(R,{className:l(r?"text-secondary":"text-primary"),icon:e.jsx(N.IconSearch,{size:g.iconSize,stroke:g.iconStroke})}),e.jsx("input",{id:s,type:"text",autoComplete:"off",placeholder:n,value:x??"",disabled:r,readOnly:a,className:l("border-0 bg-transparent w-full",c,g.textClass),onChange:b=>!a&&j(b.currentTarget.value)}),x&&!a&&!r&&e.jsx(R,{className:"text-primary cursor-pointer",icon:e.jsx(N.IconX,{size:g.iconSize,stroke:g.iconStroke,onClick:v,"aria-label":"Clear search",role:"button"})})]})},ws=({placeholder:s="",selectedItems:t=[],updateSelected:n,listCssClass:r,listElementCssClass:a,containerCssClass:o,inputCssClass:c})=>{const[u,d]=f.useState(""),i=f.useCallback(p=>{p.key==="Enter"&&(n([...t,p.currentTarget.value]),d("")),(p.key==="Backspace"||p.key==="Delete")&&t.length&&!u&&n(t.slice(0,-1))},[t,n,u]),x=f.useCallback(p=>{d(p.target.value)},[d]);return e.jsxs("div",{className:l(["dial-input px-3 py-2 flex flex-row items-center flex-wrap w-fit gap-2",o]),children:[e.jsx(se,{selectedItems:t,listCssClass:r,listElementCssClass:a}),e.jsx("input",{type:"text",value:u,className:l(["border-0 bg-transparent p-0",c]),placeholder:t?.length?"":s,onKeyDown:i,onChange:x})]})},Ns=({initialTags:s=[],fieldTitle:t,optional:n,elementId:r,placeholder:a,errorText:o,invalid:c,disabled:u,onChange:d})=>{const i=f.useRef(null),[x,p]=f.useState(s),[j,g]=f.useState(""),[v,b]=f.useState(!1),D=C=>{const w=C.trim().replace(/,$/,"");if(w&&!x.includes(w)){const A=[w,...x];p(A),d?.(A)}},k=C=>{(C.key===","||C.key==="Enter")&&(C.preventDefault(),D(j),g(""))},y=C=>{const w=x.filter((A,P)=>P!==C);p(w),d?.(w)};return f.useEffect(()=>{const C=new ResizeObserver(()=>{if(i.current){const w=i.current.scrollHeight>i.current.clientHeight+10;b(w)}});return i.current&&C.observe(i.current),()=>C.disconnect()},[x]),e.jsxs("div",{className:l("flex flex-col w-full"),children:[e.jsx(W,{fieldTitle:t,optional:n,htmlFor:r}),e.jsx("div",{className:l("dial-input min-h-[38px] p-[6px]",c&&"dial-input-error",u&&"dial-input-disable"),children:e.jsxs("div",{ref:i,className:l("flex flex-wrap gap-2 items-center",v?"flex-col-reverse":"flex-row"),children:[x.map((C,w)=>e.jsx(ce,{tag:C,remove:u?void 0:()=>y(w)},C+w)),e.jsx("input",{type:"text",value:j,onChange:C=>g(C.target.value),onKeyDown:k,className:l("dial-input-no-border outline-none border-none w-full min-w-[100px] flex-1 p-1"),placeholder:a,disabled:u})]})}),e.jsx($,{errorText:o})]})};var fe=(s=>(s.Dropdown="dropdown",s.Menu="menu",s))(fe||{}),q=(s=>(s.Click="click",s.Hover="hover",s.ContextMenu="contextMenu",s))(q||{}),me=(s=>(s.Item="item",s.Divider="divider",s))(me||{});const ks=l("inline-flex items-center gap-2 align-middle","h-auto px-0 bg-transparent border-0"),Ds=l("z-[53] overflow-auto rounded bg-layer-0 text-primary shadow focus-visible:outline-none","w-max"),Is=l("flex w-full cursor-pointer items-center gap-3","focus-visible:border-none focus-visible:outline-none","hover:bg-accent-primary-alpha px-3","dial-small h-[34px] rounded text-primary"),Ss="opacity-75 !cursor-not-allowed",Rs="text-error",Fs="my-1 border-t border-hover",Q=8,Es=({children:s,menu:t,renderOverlay:n,trigger:r=[q.Click],placement:a,disabled:o=!1,open:c,defaultOpen:u=!1,onOpenChange:d,closable:i=!1,onClose:x,cssClass:p,listClassName:j,outsidePressIgnoreRef:g,outsideClosable:v=!0})=>{const[b,D]=f.useState(u),k=c!==void 0,y=k?!!c:b,C=f.useCallback(m=>{k||D(m),d?.(m)},[k,d]),w=f.useId(),A=m=>m?"clientWidth"in m?m.clientWidth:m.getBoundingClientRect?.()?.width??0:0,P=a===void 0,{refs:z,floatingStyles:F,context:E}=h.useFloating({placement:a,open:y,onOpenChange:C,whileElementsMounted:h.autoUpdate,middleware:[h.offset({mainAxis:Q,crossAxis:0}),P?h.autoPlacement({alignment:"start",crossAxis:!0,padding:Q}):h.flip({padding:Q}),h.shift({padding:Q}),h.size({apply({availableWidth:m,elements:T}){const Ne=A(T.reference);T.floating.style.setProperty("--reference-width",`${Ne}px`),T.floating.style.maxWidth=`${m}px`}})]}),H=h.useClick(E,{enabled:r.includes(q.Click)&&!o}),he=h.useHover(E,{enabled:r.includes(q.Hover)&&!o,move:!1,restMs:40,delay:{open:80,close:80}}),ge=h.useDismiss(E,{bubbles:!0,referencePress:!1,outsidePress:m=>{if(!v)return!1;const T=m.target;return!(g?.current&&T instanceof Node&&g.current.contains(T))}}),je=h.useRole(E,{role:"menu"}),{getReferenceProps:Ce,getFloatingProps:be}=h.useInteractions([H,he,ge,je]),ye=m=>{!r.includes(q.ContextMenu)||o||(m.preventDefault(),C(!0))};f.useEffect(()=>{o&&y&&C(!1)},[o,y,C]);const ve=m=>T=>{m.disabled||(m.onClick?.({key:m.key,domEvent:T}),t?.onClick?.({key:m.key,domEvent:T}),C(!1))},we=n?n():t&&e.jsx("div",{role:"none",className:"py-1",children:t.items.map(m=>m.type===me.Divider?e.jsx("div",{role:"separator",className:Fs},m.key):e.jsxs("button",{role:"menuitem",type:"button","aria-disabled":!!m.disabled,className:l(Is,m.disabled&&Ss,m.danger&&Rs),disabled:m.disabled,onClick:ve(m),children:[m.icon&&e.jsx("span",{className:l(m.danger&&"text-error",m.disabled&&"text-secondary"),children:e.jsx(R,{icon:m.icon})}),e.jsx("span",{className:l("flex-1 truncate text-left",m.danger&&"text-error",m.disabled&&"text-secondary"),children:m.label})]},m.key))});return e.jsxs(e.Fragment,{children:[e.jsx("span",{ref:z.setReference,className:l(ks,o&&"!cursor-not-allowed opacity-75",p),"aria-haspopup":"menu","aria-expanded":y,"aria-controls":w,onContextMenu:ye,...Ce(),children:s}),y&&e.jsx(h.FloatingPortal,{children:e.jsx(h.FloatingFocusManager,{context:E,modal:!1,initialFocus:-1,returnFocus:!0,children:e.jsxs("div",{id:w,ref:z.setFloating,style:F,className:l(Ds,j),...be(),children:[i&&e.jsx("div",{className:"flex items-center justify-between px-2 pt-2",children:e.jsx(J,{ariaLabel:"Close dropdown",onClose:m=>{x?.(m),C(!1)}})}),we]})})})]})};exports.AlertVariant=V;exports.ButtonVariant=I;exports.ConfirmationPopupVariant=X;exports.DialAlert=Ee;exports.DialAutocompleteInput=ws;exports.DialAutocompleteInputValue=se;exports.DialButton=M;exports.DialCheckbox=ze;exports.DialCloseButton=J;exports.DialCollapsibleSidebar=Ye;exports.DialConfirmationPopup=hs;exports.DialDropdown=Es;exports.DialErrorText=$;exports.DialFieldLabel=W;exports.DialIcon=R;exports.DialInput=U;exports.DialInputPopup=xe;exports.DialLabelledText=Je;exports.DialLoader=re;exports.DialNoDataContent=Ze;exports.DialNumberInputField=as;exports.DialPasswordInput=pe;exports.DialPasswordInputField=bs;exports.DialPopup=ee;exports.DialRadioButton=le;exports.DialRadioGroup=ie;exports.DialRadioGroupPopupField=gs;exports.DialSearch=vs;exports.DialSteps=$e;exports.DialSwitch=is;exports.DialTag=ce;exports.DialTagInput=Ns;exports.DialTextAreaField=ls;exports.DialTextInputField=os;exports.DialTextarea=de;exports.DialTooltip=O;exports.DropdownType=fe;exports.PopupSize=B;exports.RadioGroupOrientation=K;exports.SearchSize=Z;exports.StepStatus=S;exports.TagVariant=Y;
|