@epam/ai-dial-ui-kit 0.2.0-rc.14 → 0.2.0-rc.16
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"),u=require("classnames"),b=require("@tabler/icons-react"),p=require("react"),m=require("@floating-ui/react"),w=({icon:e,className:r})=>e?s.jsx("span",{className:u("flex-shrink-0",r),children:e}):null;var T=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(T||{});const Z={[T.Primary]:"dial-primary-button",[T.Secondary]:"dial-secondary-button",[T.Tertiary]:"dial-tertiary-button"},z=({title:e,variant:r,cssClass:t,ref:n,onClick:a,disable:o,iconAfter:l,iconBefore:i,hideTitleOnMobile:c,ariaLabel:d})=>{const x=u("dial-small-semi",l?"mr-2":"",i?"ml-2":"",c?"hidden sm:inline":"inline"),h=u(r&&Z[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:n,type:"button",className:h,onClick:C=>a?.(C),disabled:o,"aria-label":e||d,children:[s.jsx(w,{icon:i}),e&&s.jsx("span",{className:x,children:e}),s.jsx(w,{icon:l})]})},V=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),S=({fieldTitle:e,htmlFor:r,optional:t,optionalText:n,cssClass:a})=>e?s.jsxs("label",{className:u("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:r,children:[s.jsx("span",{className:"min-h-4",children:e}),t&&s.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var N=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(N||{});const X={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})},Y={[N.Info]:"bg-info border-info text-info",[N.Success]:"bg-success border-success text-success",[N.Warning]:"bg-warning border-warning text-warning",[N.Error]:"bg-error border-error text-error"},J="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",Q=({variant:e=N.Info,message:r,cssClass:t,closable:n=!1,onClose:a})=>s.jsxs("div",{role:"alert",className:u(J,Y[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(w,{icon:X[e]}),s.jsx("div",{className:"text-primary",children:r})]}),n&&s.jsx(z,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(b.IconX,{size:16}),onClick:o=>a?.(o)})]}),ee="flex items-center justify-center text-secondary",se="shrink-0 grow-0 basis-auto animate-spin-steps",re=({size:e=18,cssClass:r,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>s.jsx("div",{role:"status","aria-label":a,className:u({[ee]:!0,"w-full h-full":n,[r||""]:!!r}),children:s.jsx(w,{icon:s.jsx(b.IconLoader,{width:e,height:e,className:u(se,t)})})}),te=7,ne=2,B=p.createContext(null),M=()=>{const e=p.useContext(B);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},ae=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[o,l]=p.useState(e),i=p.useRef(null),c=n??o,d=a??l,x=m.useFloating({placement:r,open:c,onOpenChange:d,whileElementsMounted:m.autoUpdate,middleware:[m.offset(te+ne),m.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),m.shift({padding:5}),m.arrow({element:i})]}),h=m.useHover(x.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),C=m.useFocus(x.context,{enabled:n==null}),D=m.useDismiss(x.context),j=m.useRole(x.context,{role:"tooltip"}),g=m.useInteractions([h,C,D,j]);return p.useMemo(()=>({open:c,setOpen:d,arrowRef:i,...g,...x}),[c,d,g,x])},oe=({children:e,...r})=>{const t=ae(r);return s.jsx(B.Provider,{value:t,children:e})},le=p.forwardRef(function({style:r,...t},n){const a=M(),o=m.useMergeRefs([a.refs.setFloating,n]);return a.open?s.jsx(m.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:o,style:{...a.floatingStyles,...r},...a.getFloatingProps(t),className:u("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(t).className),children:[t.children,s.jsx(m.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),ie=p.forwardRef(function({children:r,asChild:t=!1,...n},a){const o=M(),i=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,c=m.useMergeRefs([o.refs.setReference,a,i]);return t&&p.isValidElement(r)?p.cloneElement(r,o.getReferenceProps({ref:c,...n,...r.props})):s.jsx("span",{ref:c,...o.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:r})}),v=({hideTooltip:e,tooltip:r,children:t,triggerClassName:n,contentClassName:a,...o})=>e||!r?s.jsx("span",{className:n,children:t}):s.jsxs(oe,{...o,children:[s.jsx(ie,{className:u(n,"truncate"),children:t}),s.jsx(le,{className:u("text-primary",a,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),ce=18,L={size:ce,stroke:2},de=({label:e,id:r,checked:t,indeterminate:n,disabled:a,ariaLabel:o,onChange:l})=>{const i=p.useCallback(x=>{x.stopPropagation(),l?.(x.target.checked,r)},[l,r]),c=u("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":""),d=u("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":"");return s.jsxs("label",{className:c,htmlFor:r,children:[t&&(n?s.jsx(b.IconMinus,{className:d,...L}):s.jsx(b.IconCheck,{className:d,...L})),e&&s.jsx(v,{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:i,id:r,checked:t,"aria-checked":n?"mixed":t,"aria-disabled":a||void 0,"aria-label":e?void 0:o,className:"invisible w-0 h-0"})]})};var f=(e=>(e.VALID="valid",e.ERROR="error",e))(f||{});const ue=(e,r)=>{if(r===e.id)switch(e.status){case f.VALID:return"border-accent-secondary text-primary";case f.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case f.VALID:return"border-primary text-white";case f.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},xe=(e,r)=>{if(r===e.id)switch(e.status){case f.VALID:return"bg-accent-secondary";case f.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case f.VALID:return"bg-accent-secondary";case f.ERROR:return"bg-red-400";default:return"bg-layer-4"}},me=({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",o="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",l=()=>t===e.id&&e.status===f.ERROR?s.jsx(b.IconExclamationCircle,{stroke:2,size:16}):t!==e.id&&e.status===f.VALID?s.jsx(b.IconCheck,{stroke:2,size:16}):r+1;return s.jsxs("button",{className:u(a,ue(e,t)),onClick:()=>n(e.id),children:[s.jsx("span",{className:u(o,xe(e,t)),children:l()}),s.jsx("span",{children:e.name})]})},pe=({steps:e,currentStep:r,onChangeStep:t})=>{const n=a=>{const o=e.findIndex(i=>i.id===r),l=e.findIndex(i=>i.id===a);(a!==r&&e[o].status===f.VALID||l<o)&&t(a)};return s.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,o)=>s.jsx(me,{currentStep:r,onChangeStep:n,step:a,index:o},a.id))})},W=({name:e,value:r,title:t,description:n,checked:a=!1,inputId:o,cssClass:l,labelCssClass:i,disabled:c,onChange:d,descriptionCssClass:x})=>{const h=`${o}-desc`,C=u("dial-small cursor-pointer",c?"text-secondary":"text-primary",i),D=u("cursor-pointer dial-input-radio",t&&"mr-2",l),j=u("flex flex-col",!!n&&"mb-2"),g=u("dial-tiny mt-2 ml-[26px] text-secondary",x),E=P=>{c||P.target.checked&&d?.(r)};return s.jsxs("div",{className:j,children:[s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"radio",id:o,name:e,value:r,checked:a,disabled:c,"aria-describedby":a&&n?h:void 0,className:D,onChange:E}),t?s.jsx("label",{className:C,htmlFor:o,children:t}):null]}),a&&n&&s.jsx("div",{id:h,className:g,children:n})]})};var O=(e=>(e.Row="Row",e.Column="Column",e))(O||{});const fe="flex flex-col gap-2",he="flex",be="pb-1",ge={[O.Column]:"flex-col gap-y-3",[O.Row]:"flex-row gap-x-6"},je=({fieldTitle:e,radioCssClass:r,labelCssClass:t,disabled:n,elementId:a,radioButtons:o,activeRadioButton:l,orientation:i,onChange:c})=>s.jsxs("div",{className:fe,children:[e&&s.jsx(S,{fieldTitle:e,htmlFor:a}),s.jsx("div",{role:"radiogroup","aria-label":e,"aria-disabled":n||void 0,className:u(he,ge[i]),children:o.map(d=>s.jsxs(p.Fragment,{children:[s.jsx(W,{name:a,value:d.id,inputId:d.id,disabled:n,cssClass:r,labelCssClass:t,title:d.name,checked:d.id===l,onChange:()=>c(d.id)}),d.id===l&&d.content?s.jsx("div",{className:be,children:d.content}):null]},d.id))})]}),_=({value:e,textareaId:r,placeholder:t,cssClass:n="",disabled:a,invalid:o,readonly:l,onChange:i})=>s.jsx(v,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:a,className:u("dial-textarea dial-input",o?"dial-input-error":"",a&&"dial-input-disable",l&&"dial-input-readonly",n),onChange:c=>!l&&i?.(c.currentTarget.value)})}),Ce=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],ye=(e,r,t,n)=>{if((r==="number"||t!==void 0||n!==void 0)&&!Ce.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 o=e.currentTarget.value,l=e.currentTarget.selectionStart||0,i=o.slice(0,l)+e.key+o.slice(l),c=parseFloat(i);if(!isNaN(c)){if(t!==void 0&&c<t){e.preventDefault();return}if(n!==void 0&&c>n){e.preventDefault();return}}}}},F=({iconBeforeInput:e,iconAfterInput:r,hideBorder:t,value:n,elementId:a,placeholder:o="",cssClass:l="",containerCssClass:i,tooltipTriggerClassName:c,type:d="text",disabled:x,readonly:h,invalid:C,onChange:D,min:j,max:g,prefix:E,suffix:P,textBeforeInput:I,textAfterInput:R})=>{const $=y=>y.target.blur(),U=d==="number"||j!==void 0||g!==void 0,G=y=>{ye(y,d,j,g)},K=y=>{const k=y.currentTarget.value;if(U&&k!==""){const A=parseFloat(k);if(isNaN(A)&&k!=="-"&&k!=="."||!isNaN(A)&&(j!==void 0&&A<j||g!==void 0&&A>g))return}D?.(k)};return s.jsxs("div",{className:u("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",C&&"dial-input-error",x&&"dial-input-disable",h&&"dial-input-readonly",!I&&"pl-1",!R&&"pr-1",i),children:[I&&s.jsx(v,{tooltip:I,children:s.jsx(F,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:I,disabled:!0,elementId:I+"textBefore"})}),E&&s.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",E]}),s.jsx(w,{icon:e,className:"pl-2"}),s.jsx(v,{tooltip:n,triggerClassName:c,children:s.jsx("input",{type:d,autoComplete:"off",id:a,placeholder:o,value:n??"",title:n?String(n):"",disabled:x,className:u("border-0 bg-transparent px-2",l),onChange:y=>!h&&K?.(y),onKeyDown:G,onWheel:$,min:j,max:g})}),s.jsx(w,{icon:r,className:"pr-2"}),P&&s.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",P]}),R&&s.jsx(v,{tooltip:R,children:s.jsx(F,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:R,disabled:!0,elementId:R+"textAfter"})})]})},Ne=/^0+\.(\d+)?$/,we=/^0+/,q=({fieldTitle:e,errorText:r,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:o,containerCssClass:l,readonly:i,defaultEmptyText:c,min:d,max:x,...h})=>s.jsxs("div",{className:u("flex flex-col",l),children:[s.jsx(S,{fieldTitle:e,optional:t,htmlFor:o}),i?s.jsx("span",{children:h.value||(c??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(F,{elementId:o,cssClass:n,containerCssClass:a,invalid:r!=null,min:d,max:x,...h}),s.jsx(V,{errorText:r})]})]}),ve=({onChange:e,value:r,min:t,max:n,...a})=>{const o=l=>String(l)?.match(Ne)?String(l)?.replace(we,"0"):Number(l);return s.jsx(q,{type:"number",onChange:l=>e?.(o(l)),value:r,min:t,max:n,...a})},De=({onChange:e,...r})=>s.jsx(q,{type:"text",onChange:t=>e?.(t),...r}),Ie=({fieldTitle:e,optional:r,elementId:t,elementCssClass:n,errorText:a,...o})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(S,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx(_,{textareaId:t,cssClass:n,...o}),s.jsx(V,{errorText:a})]}),Re=({title:e,switchId:r,isOn:t=!1,disabled:n,onChange:a})=>{const o=u("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),l=p.useCallback(i=>{i.stopPropagation(),a?.(!t)},[a,t]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:l,id:r,disabled:n,className:"invisible w-0 h-0",checked:t}),s.jsx("label",{htmlFor:r,className:o,children:s.jsx("span",{className:u("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})]})},ke=({onClick:e})=>s.jsx(b.IconEyeOff,{...L,className:"text-primary",onClick:e}),Te=({onClick:e})=>s.jsx(b.IconEye,{...L,className:"text-primary",onClick:e}),H=({...e})=>{const[r,t]=p.useState(!1),n=p.useCallback(a=>{t(a)},[]);return s.jsx(F,{type:r?"text":"password",...e,iconAfterInput:r?s.jsx(ke,{onClick:()=>n(!1)}):s.jsx(Te,{onClick:()=>n(!0)})})},Fe=({fieldTitle:e,optional:r,elementCssClass:t,elementId:n,errorText:a,...o})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(S,{fieldTitle:e,optional:r,htmlFor:n}),s.jsx(H,{cssClass:t,elementId:n,invalid:!!a,...o}),s.jsx(V,{errorText:a})]});exports.AlertVariant=N;exports.ButtonVariant=T;exports.DialAlert=Q;exports.DialButton=z;exports.DialCheckbox=de;exports.DialErrorText=V;exports.DialFieldLabel=S;exports.DialIcon=w;exports.DialInput=F;exports.DialLoader=re;exports.DialNumberInputField=ve;exports.DialPasswordInput=H;exports.DialPasswordInputField=Fe;exports.DialRadioButton=W;exports.DialRadioGroup=je;exports.DialSteps=pe;exports.DialSwitch=Re;exports.DialTextAreaField=Ie;exports.DialTextInputField=De;exports.DialTextarea=_;exports.DialTooltip=v;exports.StepStatus=f;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),u=require("classnames"),b=require("@tabler/icons-react"),f=require("react"),m=require("@floating-ui/react"),w=({icon:e,className:r})=>e?s.jsx("span",{className:u("flex-shrink-0",r),children:e}):null;var T=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(T||{});const Z={[T.Primary]:"dial-primary-button",[T.Secondary]:"dial-secondary-button",[T.Tertiary]:"dial-tertiary-button"},z=({title:e,variant:r,cssClass:t,ref:n,onClick:a,disable:o,iconAfter:l,iconBefore:i,hideTitleOnMobile:c,ariaLabel:d})=>{const x=u("dial-small-semi",l?"mr-2":"",i?"ml-2":"",c?"hidden sm:inline":"inline"),h=u(r&&Z[r],t,"focus-visible:outline outline-offset-0");return s.jsxs("button",{ref:n,type:"button",className:h,onClick:C=>a?.(C),disabled:o,"aria-label":e||d,children:[s.jsx(w,{icon:i}),e&&s.jsx("span",{className:x,children:e}),s.jsx(w,{icon:l})]})},V=({errorText:e})=>e&&s.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),S=({fieldTitle:e,htmlFor:r,optional:t,optionalText:n,cssClass:a})=>e?s.jsxs("label",{className:u("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:r,children:[s.jsx("span",{className:"min-h-4",children:e}),t&&s.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var N=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(N||{});const X={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})},Y={[N.Info]:"bg-info border-info text-info",[N.Success]:"bg-success border-success text-success",[N.Warning]:"bg-warning border-warning text-warning",[N.Error]:"bg-error border-error text-error"},J="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",Q=({variant:e=N.Info,message:r,cssClass:t,closable:n=!1,onClose:a})=>s.jsxs("div",{role:"alert",className:u(J,Y[e],t),children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(w,{icon:X[e]}),s.jsx("div",{className:"text-primary",children:r})]}),n&&s.jsx(z,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:s.jsx(b.IconX,{size:16}),onClick:o=>a?.(o)})]}),ee="flex items-center justify-center text-secondary",se="shrink-0 grow-0 basis-auto animate-spin-steps",re=({size:e=18,cssClass:r,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>s.jsx("div",{role:"status","aria-label":a,className:u({[ee]:!0,"w-full h-full":n,[r||""]:!!r}),children:s.jsx(w,{icon:s.jsx(b.IconLoader,{width:e,height:e,className:u(se,t)})})}),te=7,ne=2,B=f.createContext(null),M=()=>{const e=f.useContext(B);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},ae=({initialOpen:e=!1,placement:r="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[o,l]=f.useState(e),i=f.useRef(null),c=n??o,d=a??l,x=m.useFloating({placement:r,open:c,onOpenChange:d,whileElementsMounted:m.autoUpdate,middleware:[m.offset(te+ne),m.flip({crossAxis:r.includes("-"),fallbackAxisSideDirection:"start",padding:5}),m.shift({padding:5}),m.arrow({element:i})]}),h=m.useHover(x.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),C=m.useFocus(x.context,{enabled:n==null}),D=m.useDismiss(x.context),j=m.useRole(x.context,{role:"tooltip"}),g=m.useInteractions([h,C,D,j]);return f.useMemo(()=>({open:c,setOpen:d,arrowRef:i,...g,...x}),[c,d,g,x])},oe=({children:e,...r})=>{const t=ae(r);return s.jsx(B.Provider,{value:t,children:e})},le=f.forwardRef(function({style:r,...t},n){const a=M(),o=m.useMergeRefs([a.refs.setFloating,n]);return a.open?s.jsx(m.FloatingPortal,{id:"tooltip-portal",children:s.jsxs("div",{ref:o,style:{...a.floatingStyles,...r},...a.getFloatingProps(t),className:u("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(t).className),children:[t.children,s.jsx(m.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),ie=f.forwardRef(function({children:r,asChild:t=!1,...n},a){const o=M(),i=r&&typeof r=="object"&&"ref"in r&&r.ref!==void 0?r.ref:void 0,c=m.useMergeRefs([o.refs.setReference,a,i]);return t&&f.isValidElement(r)?f.cloneElement(r,o.getReferenceProps({ref:c,...n,...r.props})):s.jsx("span",{ref:c,...o.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:r})}),v=({hideTooltip:e,tooltip:r,children:t,triggerClassName:n,contentClassName:a,...o})=>s.jsxs(oe,{...o,children:[s.jsx(ie,{className:u(n,"truncate"),children:t}),s.jsx(le,{className:u("text-primary",a,"max-w-[300px]",(e||!r)&&"hidden"),children:r})]}),ce=18,L={size:ce,stroke:2},de=({label:e,id:r,checked:t,indeterminate:n,disabled:a,ariaLabel:o,onChange:l})=>{const i=f.useCallback(x=>{x.stopPropagation(),l?.(x.target.checked,r)},[l,r]),c=u("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":""),d=u("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":"");return s.jsxs("label",{className:c,htmlFor:r,children:[t&&(n?s.jsx(b.IconMinus,{className:d,...L}):s.jsx(b.IconCheck,{className:d,...L})),e&&s.jsx(v,{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:i,id:r,checked:t,"aria-checked":n?"mixed":t,"aria-disabled":a||void 0,"aria-label":e?void 0:o,className:"invisible w-0 h-0"})]})};var p=(e=>(e.VALID="valid",e.ERROR="error",e))(p||{});const ue=(e,r)=>{if(r===e.id)switch(e.status){case p.VALID:return"border-accent-secondary text-primary";case p.ERROR:return"border-red-900 text-primary";default:return"border-accent-primary text-primary"}switch(e.status){case p.VALID:return"border-primary text-white";case p.ERROR:return"border-red-900 text-error";default:return"border-primary text-secondary"}},xe=(e,r)=>{if(r===e.id)switch(e.status){case p.VALID:return"bg-accent-secondary";case p.ERROR:return"bg-red-400";default:return"bg-accent-primary"}switch(e.status){case p.VALID:return"bg-accent-secondary";case p.ERROR:return"bg-red-400";default:return"bg-layer-4"}},me=({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",o="w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white",l=()=>t===e.id&&e.status===p.ERROR?s.jsx(b.IconExclamationCircle,{stroke:2,size:16}):t!==e.id&&e.status===p.VALID?s.jsx(b.IconCheck,{stroke:2,size:16}):r+1;return s.jsxs("button",{className:u(a,ue(e,t)),onClick:()=>n(e.id),children:[s.jsx("span",{className:u(o,xe(e,t)),children:l()}),s.jsx("span",{children:e.name})]})},pe=({steps:e,currentStep:r,onChangeStep:t})=>{const n=a=>{const o=e.findIndex(i=>i.id===r),l=e.findIndex(i=>i.id===a);(a!==r&&e[o].status===p.VALID||l<o)&&t(a)};return s.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,o)=>s.jsx(me,{currentStep:r,onChangeStep:n,step:a,index:o},a.id))})},W=({name:e,value:r,title:t,description:n,checked:a=!1,inputId:o,cssClass:l,labelCssClass:i,disabled:c,onChange:d,descriptionCssClass:x})=>{const h=`${o}-desc`,C=u("dial-small cursor-pointer",c?"text-secondary":"text-primary",i),D=u("cursor-pointer dial-input-radio",t&&"mr-2",l),j=u("flex flex-col",!!n&&"mb-2"),g=u("dial-tiny mt-2 ml-[26px] text-secondary",x),E=P=>{c||P.target.checked&&d?.(r)};return s.jsxs("div",{className:j,children:[s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"radio",id:o,name:e,value:r,checked:a,disabled:c,"aria-describedby":a&&n?h:void 0,className:D,onChange:E}),t?s.jsx("label",{className:C,htmlFor:o,children:t}):null]}),a&&n&&s.jsx("div",{id:h,className:g,children:n})]})};var O=(e=>(e.Row="Row",e.Column="Column",e))(O||{});const fe="flex flex-col gap-2",he="flex",be="pb-1 mt-2",ge={[O.Column]:"flex-col gap-y-3",[O.Row]:"flex-row gap-x-6"},je=({fieldTitle:e,radioCssClass:r,labelCssClass:t,disabled:n,elementId:a,radioButtons:o,activeRadioButton:l,orientation:i,onChange:c})=>s.jsxs("div",{className:fe,children:[e&&s.jsx(S,{fieldTitle:e,htmlFor:a}),s.jsx("div",{role:"radiogroup","aria-label":e,"aria-disabled":n||void 0,className:u(he,ge[i]),children:o.map(d=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(W,{name:a,value:d.id,inputId:d.id,disabled:n,cssClass:r,labelCssClass:t,title:d.name,checked:d.id===l,onChange:()=>c(d.id)}),d.id===l&&d.content?s.jsx("div",{className:be,children:d.content}):null]},d.id))})]}),_=({value:e,textareaId:r,placeholder:t,cssClass:n="",disabled:a,invalid:o,readonly:l,onChange:i})=>s.jsx(v,{tooltip:e,triggerClassName:"flex",children:s.jsx("textarea",{id:r,placeholder:t,value:e||"",disabled:a,className:u("dial-textarea dial-input",o?"dial-input-error":"",a&&"dial-input-disable",l&&"dial-input-readonly",n),onChange:c=>!l&&i?.(c.currentTarget.value)})}),Ce=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],ye=(e,r,t,n)=>{if((r==="number"||t!==void 0||n!==void 0)&&!Ce.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 o=e.currentTarget.value,l=e.currentTarget.selectionStart||0,i=o.slice(0,l)+e.key+o.slice(l),c=parseFloat(i);if(!isNaN(c)){if(t!==void 0&&c<t){e.preventDefault();return}if(n!==void 0&&c>n){e.preventDefault();return}}}}},F=({iconBeforeInput:e,iconAfterInput:r,hideBorder:t,value:n,elementId:a,placeholder:o="",cssClass:l="",containerCssClass:i,tooltipTriggerClassName:c,type:d="text",disabled:x,readonly:h,invalid:C,onChange:D,min:j,max:g,prefix:E,suffix:P,textBeforeInput:I,textAfterInput:R})=>{const $=y=>y.target.blur(),U=d==="number"||j!==void 0||g!==void 0,G=y=>{ye(y,d,j,g)},K=y=>{const k=y.currentTarget.value;if(U&&k!==""){const A=parseFloat(k);if(isNaN(A)&&k!=="-"&&k!=="."||!isNaN(A)&&(j!==void 0&&A<j||g!==void 0&&A>g))return}D?.(k)};return s.jsxs("div",{className:u("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",C&&"dial-input-error",x&&"dial-input-disable",h&&"dial-input-readonly",!I&&"pl-1",!R&&"pr-1",i),children:[I&&s.jsx(v,{tooltip:I,children:s.jsx(F,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:I,disabled:!0,elementId:I+"textBefore"})}),E&&s.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",E]}),s.jsx(w,{icon:e}),s.jsx(v,{tooltip:n,triggerClassName:c,children:s.jsx("input",{type:d,autoComplete:"off",id:a,placeholder:o,value:n??"",title:n?String(n):"",disabled:x,className:u("border-0 bg-transparent px-2",l),onChange:y=>!h&&K?.(y),onKeyDown:G,onWheel:$,min:j,max:g})}),s.jsx(w,{icon:r}),P&&s.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",P]}),R&&s.jsx(v,{tooltip:R,children:s.jsx(F,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:R,disabled:!0,elementId:R+"textAfter"})})]})},Ne=/^0+\.(\d+)?$/,we=/^0+/,q=({fieldTitle:e,errorText:r,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:o,containerCssClass:l,readonly:i,defaultEmptyText:c,min:d,max:x,...h})=>s.jsxs("div",{className:u("flex flex-col",l),children:[s.jsx(S,{fieldTitle:e,optional:t,htmlFor:o}),i?s.jsx("span",{children:h.value||(c??"None")}):s.jsxs(s.Fragment,{children:[s.jsx(F,{elementId:o,cssClass:n,containerCssClass:a,invalid:r!=null,min:d,max:x,...h}),s.jsx(V,{errorText:r})]})]}),ve=({onChange:e,value:r,min:t,max:n,...a})=>{const o=l=>String(l)?.match(Ne)?String(l)?.replace(we,"0"):Number(l);return s.jsx(q,{type:"number",onChange:l=>e?.(o(l)),value:r,min:t,max:n,...a})},De=({onChange:e,...r})=>s.jsx(q,{type:"text",onChange:t=>e?.(t),...r}),Ie=({fieldTitle:e,optional:r,elementId:t,elementCssClass:n,errorText:a,...o})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(S,{fieldTitle:e,optional:r,htmlFor:t}),s.jsx(_,{textareaId:t,cssClass:n,...o}),s.jsx(V,{errorText:a})]}),Re=({title:e,switchId:r,isOn:t=!1,disabled:n,onChange:a})=>{const o=u("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),l=f.useCallback(i=>{i.stopPropagation(),a?.(!t)},[a,t]);return s.jsxs("div",{className:"flex flex-row items-center",children:[s.jsx("input",{type:"checkbox",onChange:l,id:r,disabled:n,className:"invisible w-0 h-0",checked:t}),s.jsx("label",{htmlFor:r,className:o,children:s.jsx("span",{className:u("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})]})},ke=({onClick:e})=>s.jsx(b.IconEyeOff,{...L,className:"text-primary",onClick:e}),Te=({onClick:e})=>s.jsx(b.IconEye,{...L,className:"text-primary",onClick:e}),H=({...e})=>{const[r,t]=f.useState(!1),n=f.useCallback(a=>{t(a)},[]);return s.jsx(F,{type:r?"text":"password",...e,iconAfterInput:r?s.jsx(ke,{onClick:()=>n(!1)}):s.jsx(Te,{onClick:()=>n(!0)})})},Fe=({fieldTitle:e,optional:r,elementCssClass:t,elementId:n,errorText:a,...o})=>s.jsxs("div",{className:"flex flex-col",children:[s.jsx(S,{fieldTitle:e,optional:r,htmlFor:n}),s.jsx(H,{cssClass:t,elementId:n,invalid:!!a,...o}),s.jsx(V,{errorText:a})]});exports.AlertVariant=N;exports.ButtonVariant=T;exports.DialAlert=Q;exports.DialButton=z;exports.DialCheckbox=de;exports.DialErrorText=V;exports.DialFieldLabel=S;exports.DialIcon=w;exports.DialInput=F;exports.DialLoader=re;exports.DialNumberInputField=ve;exports.DialPasswordInput=H;exports.DialPasswordInputField=Fe;exports.DialRadioButton=W;exports.DialRadioGroup=je;exports.DialSteps=pe;exports.DialSwitch=Re;exports.DialTextAreaField=Ie;exports.DialTextInputField=De;exports.DialTextarea=_;exports.DialTooltip=v;exports.StepStatus=p;
|
package/dist/dial-ui-kit.es.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as n, jsxs as m, Fragment as Z } from "react/jsx-runtime";
|
|
2
2
|
import u from "classnames";
|
|
3
3
|
import { IconCircleCheck as X, IconAlertTriangle as Y, IconAlertCircle as q, IconInfoCircle as J, IconX as Q, IconLoader as ee, IconMinus as re, IconCheck as z, IconExclamationCircle as ne, IconEyeOff as te, IconEye as se } from "@tabler/icons-react";
|
|
4
|
-
import { createContext as ae, useState as W, useRef as oe, useMemo as le, useContext as ie, forwardRef as _, isValidElement as ce, cloneElement as de, useCallback as O
|
|
5
|
-
import { useFloating as
|
|
4
|
+
import { createContext as ae, useState as W, useRef as oe, useMemo as le, useContext as ie, forwardRef as _, isValidElement as ce, cloneElement as de, useCallback as O } from "react";
|
|
5
|
+
import { useFloating as ue, offset as me, flip as pe, shift as fe, arrow as he, autoUpdate as xe, useHover as be, useFocus as ge, useDismiss as Ce, useRole as ye, useInteractions as Ne, useMergeRefs as j, FloatingPortal as we, FloatingArrow as ve } from "@floating-ui/react";
|
|
6
6
|
const N = ({ icon: e, className: r }) => e ? /* @__PURE__ */ n("span", { className: u("flex-shrink-0", r), children: e }) : null;
|
|
7
|
-
var
|
|
8
|
-
const
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
},
|
|
7
|
+
var T = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Tertiary = "tertiary", e))(T || {});
|
|
8
|
+
const De = {
|
|
9
|
+
[T.Primary]: "dial-primary-button",
|
|
10
|
+
[T.Secondary]: "dial-secondary-button",
|
|
11
|
+
[T.Tertiary]: "dial-tertiary-button"
|
|
12
|
+
}, Ie = ({
|
|
13
13
|
title: e,
|
|
14
14
|
variant: r,
|
|
15
15
|
cssClass: t,
|
|
@@ -27,7 +27,7 @@ const Ie = {
|
|
|
27
27
|
i ? "ml-2" : "",
|
|
28
28
|
c ? "hidden sm:inline" : "inline"
|
|
29
29
|
), f = u(
|
|
30
|
-
r &&
|
|
30
|
+
r && De[r],
|
|
31
31
|
t,
|
|
32
32
|
"focus-visible:outline outline-offset-0"
|
|
33
33
|
);
|
|
@@ -69,17 +69,17 @@ const Ie = {
|
|
|
69
69
|
}
|
|
70
70
|
) : null;
|
|
71
71
|
var y = /* @__PURE__ */ ((e) => (e.Info = "info", e.Success = "success", e.Warning = "warning", e.Error = "error", e))(y || {});
|
|
72
|
-
const
|
|
72
|
+
const Re = {
|
|
73
73
|
info: /* @__PURE__ */ n(J, { size: 24, stroke: 2 }),
|
|
74
74
|
error: /* @__PURE__ */ n(q, { size: 24, stroke: 2 }),
|
|
75
75
|
warning: /* @__PURE__ */ n(Y, { size: 24, stroke: 2 }),
|
|
76
76
|
success: /* @__PURE__ */ n(X, { size: 24, stroke: 2 })
|
|
77
|
-
},
|
|
77
|
+
}, ke = {
|
|
78
78
|
[y.Info]: "bg-info border-info text-info",
|
|
79
79
|
[y.Success]: "bg-success border-success text-success",
|
|
80
80
|
[y.Warning]: "bg-warning border-warning text-warning",
|
|
81
81
|
[y.Error]: "bg-error border-error text-error"
|
|
82
|
-
},
|
|
82
|
+
}, Ee = "items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex", ar = ({
|
|
83
83
|
variant: e = y.Info,
|
|
84
84
|
message: r,
|
|
85
85
|
cssClass: t,
|
|
@@ -90,17 +90,17 @@ const ke = {
|
|
|
90
90
|
{
|
|
91
91
|
role: "alert",
|
|
92
92
|
className: u(
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
Ee,
|
|
94
|
+
ke[e],
|
|
95
95
|
t
|
|
96
96
|
),
|
|
97
97
|
children: [
|
|
98
98
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
99
|
-
/* @__PURE__ */ n(N, { icon:
|
|
99
|
+
/* @__PURE__ */ n(N, { icon: Re[e] }),
|
|
100
100
|
/* @__PURE__ */ n("div", { className: "text-primary", children: r })
|
|
101
101
|
] }),
|
|
102
102
|
s && /* @__PURE__ */ n(
|
|
103
|
-
|
|
103
|
+
Ie,
|
|
104
104
|
{
|
|
105
105
|
cssClass: "ml-2 text-secondary hover:text-primary",
|
|
106
106
|
ariaLabel: "Close alert",
|
|
@@ -110,7 +110,7 @@ const ke = {
|
|
|
110
110
|
)
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
|
-
), Te = "flex items-center justify-center text-secondary",
|
|
113
|
+
), Te = "flex items-center justify-center text-secondary", Fe = "shrink-0 grow-0 basis-auto animate-spin-steps", or = ({
|
|
114
114
|
size: e = 18,
|
|
115
115
|
cssClass: r,
|
|
116
116
|
iconClass: t,
|
|
@@ -134,49 +134,49 @@ const ke = {
|
|
|
134
134
|
{
|
|
135
135
|
width: e,
|
|
136
136
|
height: e,
|
|
137
|
-
className: u(
|
|
137
|
+
className: u(Fe, t)
|
|
138
138
|
}
|
|
139
139
|
)
|
|
140
140
|
}
|
|
141
141
|
)
|
|
142
142
|
}
|
|
143
|
-
),
|
|
143
|
+
), Se = 7, Pe = 2, M = ae(null), B = () => {
|
|
144
144
|
const e = ie(M);
|
|
145
145
|
if (e == null)
|
|
146
146
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
147
147
|
return e;
|
|
148
|
-
},
|
|
148
|
+
}, Ae = ({
|
|
149
149
|
initialOpen: e = !1,
|
|
150
150
|
placement: r = "bottom",
|
|
151
151
|
isTriggerClickable: t = !1,
|
|
152
152
|
open: s,
|
|
153
153
|
onOpenChange: a
|
|
154
154
|
} = {}) => {
|
|
155
|
-
const [o, l] = W(e), i = oe(null), c = s ?? o, d = a ?? l, p =
|
|
155
|
+
const [o, l] = W(e), i = oe(null), c = s ?? o, d = a ?? l, p = ue({
|
|
156
156
|
placement: r,
|
|
157
157
|
open: c,
|
|
158
158
|
onOpenChange: d,
|
|
159
|
-
whileElementsMounted:
|
|
159
|
+
whileElementsMounted: xe,
|
|
160
160
|
middleware: [
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
me(Se + Pe),
|
|
162
|
+
pe({
|
|
163
163
|
crossAxis: r.includes("-"),
|
|
164
164
|
fallbackAxisSideDirection: "start",
|
|
165
165
|
padding: 5
|
|
166
166
|
}),
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
fe({ padding: 5 }),
|
|
168
|
+
he({
|
|
169
169
|
element: i
|
|
170
170
|
})
|
|
171
171
|
]
|
|
172
|
-
}), f =
|
|
172
|
+
}), f = be(p.context, {
|
|
173
173
|
move: !1,
|
|
174
174
|
enabled: s == null,
|
|
175
175
|
mouseOnly: t,
|
|
176
176
|
delay: { open: 500, close: 0 }
|
|
177
|
-
}), g =
|
|
177
|
+
}), g = ge(p.context, {
|
|
178
178
|
enabled: s == null
|
|
179
|
-
}), w =
|
|
179
|
+
}), w = Ce(p.context), b = ye(p.context, { role: "tooltip" }), x = Ne([f, g, w, b]);
|
|
180
180
|
return le(
|
|
181
181
|
() => ({
|
|
182
182
|
open: c,
|
|
@@ -187,15 +187,15 @@ const ke = {
|
|
|
187
187
|
}),
|
|
188
188
|
[c, d, x, p]
|
|
189
189
|
);
|
|
190
|
-
},
|
|
190
|
+
}, Le = ({
|
|
191
191
|
children: e,
|
|
192
192
|
...r
|
|
193
193
|
}) => {
|
|
194
|
-
const t =
|
|
194
|
+
const t = Ae(r);
|
|
195
195
|
return /* @__PURE__ */ n(M.Provider, { value: t, children: e });
|
|
196
|
-
},
|
|
196
|
+
}, Oe = _(function({ style: r, ...t }, s) {
|
|
197
197
|
const a = B(), o = j([a.refs.setFloating, s]);
|
|
198
|
-
return a.open ? /* @__PURE__ */ n(
|
|
198
|
+
return a.open ? /* @__PURE__ */ n(we, { id: "tooltip-portal", children: /* @__PURE__ */ m(
|
|
199
199
|
"div",
|
|
200
200
|
{
|
|
201
201
|
ref: o,
|
|
@@ -211,7 +211,7 @@ const ke = {
|
|
|
211
211
|
children: [
|
|
212
212
|
t.children,
|
|
213
213
|
/* @__PURE__ */ n(
|
|
214
|
-
|
|
214
|
+
ve,
|
|
215
215
|
{
|
|
216
216
|
ref: a.arrowRef,
|
|
217
217
|
context: a.context,
|
|
@@ -223,7 +223,7 @@ const ke = {
|
|
|
223
223
|
]
|
|
224
224
|
}
|
|
225
225
|
) }) : null;
|
|
226
|
-
}),
|
|
226
|
+
}), Ve = _(function({ children: r, asChild: t = !1, ...s }, a) {
|
|
227
227
|
const o = B(), i = r && typeof r == "object" && "ref" in r && r.ref !== void 0 ? r.ref : void 0, c = j([o.refs.setReference, a, i]);
|
|
228
228
|
return t && ce(r) ? de(
|
|
229
229
|
r,
|
|
@@ -248,10 +248,10 @@ const ke = {
|
|
|
248
248
|
triggerClassName: s,
|
|
249
249
|
contentClassName: a,
|
|
250
250
|
...o
|
|
251
|
-
}) =>
|
|
252
|
-
/* @__PURE__ */ n(
|
|
251
|
+
}) => /* @__PURE__ */ m(Le, { ...o, children: [
|
|
252
|
+
/* @__PURE__ */ n(Ve, { className: u(s, "truncate"), children: t }),
|
|
253
253
|
/* @__PURE__ */ n(
|
|
254
|
-
|
|
254
|
+
Oe,
|
|
255
255
|
{
|
|
256
256
|
className: u(
|
|
257
257
|
"text-primary",
|
|
@@ -262,10 +262,10 @@ const ke = {
|
|
|
262
262
|
children: r
|
|
263
263
|
}
|
|
264
264
|
)
|
|
265
|
-
] }),
|
|
266
|
-
size:
|
|
265
|
+
] }), ze = 18, F = {
|
|
266
|
+
size: ze,
|
|
267
267
|
stroke: 2
|
|
268
|
-
},
|
|
268
|
+
}, lr = ({
|
|
269
269
|
label: e,
|
|
270
270
|
id: r,
|
|
271
271
|
checked: t,
|
|
@@ -288,7 +288,7 @@ const ke = {
|
|
|
288
288
|
a ? "bg-layer-4 border-icon-secondary" : ""
|
|
289
289
|
);
|
|
290
290
|
return /* @__PURE__ */ m("label", { className: c, htmlFor: r, children: [
|
|
291
|
-
t && (s ? /* @__PURE__ */ n(re, { className: d, ...
|
|
291
|
+
t && (s ? /* @__PURE__ */ n(re, { className: d, ...F }) : /* @__PURE__ */ n(z, { className: d, ...F })),
|
|
292
292
|
e && /* @__PURE__ */ n(R, { tooltip: e, triggerClassName: "flex-1 min-w-0", children: /* @__PURE__ */ n("p", { className: "text-primary w-full truncate", children: e }) }),
|
|
293
293
|
/* @__PURE__ */ n(
|
|
294
294
|
"input",
|
|
@@ -306,7 +306,7 @@ const ke = {
|
|
|
306
306
|
] });
|
|
307
307
|
};
|
|
308
308
|
var h = /* @__PURE__ */ ((e) => (e.VALID = "valid", e.ERROR = "error", e))(h || {});
|
|
309
|
-
const
|
|
309
|
+
const We = (e, r) => {
|
|
310
310
|
if (r === e.id)
|
|
311
311
|
switch (e.status) {
|
|
312
312
|
case h.VALID:
|
|
@@ -324,7 +324,7 @@ const _e = (e, r) => {
|
|
|
324
324
|
default:
|
|
325
325
|
return "border-primary text-secondary";
|
|
326
326
|
}
|
|
327
|
-
},
|
|
327
|
+
}, _e = (e, r) => {
|
|
328
328
|
if (r === e.id)
|
|
329
329
|
switch (e.status) {
|
|
330
330
|
case h.VALID:
|
|
@@ -342,7 +342,7 @@ const _e = (e, r) => {
|
|
|
342
342
|
default:
|
|
343
343
|
return "bg-layer-4";
|
|
344
344
|
}
|
|
345
|
-
},
|
|
345
|
+
}, je = ({
|
|
346
346
|
step: e,
|
|
347
347
|
index: r,
|
|
348
348
|
currentStep: t,
|
|
@@ -352,13 +352,13 @@ const _e = (e, r) => {
|
|
|
352
352
|
return /* @__PURE__ */ m(
|
|
353
353
|
"button",
|
|
354
354
|
{
|
|
355
|
-
className: u(a,
|
|
355
|
+
className: u(a, We(e, t)),
|
|
356
356
|
onClick: () => s(e.id),
|
|
357
357
|
children: [
|
|
358
358
|
/* @__PURE__ */ n(
|
|
359
359
|
"span",
|
|
360
360
|
{
|
|
361
|
-
className: u(o,
|
|
361
|
+
className: u(o, _e(e, t)),
|
|
362
362
|
children: l()
|
|
363
363
|
}
|
|
364
364
|
),
|
|
@@ -366,7 +366,7 @@ const _e = (e, r) => {
|
|
|
366
366
|
]
|
|
367
367
|
}
|
|
368
368
|
);
|
|
369
|
-
},
|
|
369
|
+
}, ir = ({
|
|
370
370
|
steps: e,
|
|
371
371
|
currentStep: r,
|
|
372
372
|
onChangeStep: t
|
|
@@ -376,7 +376,7 @@ const _e = (e, r) => {
|
|
|
376
376
|
(a !== r && e[o].status === h.VALID || l < o) && t(a);
|
|
377
377
|
};
|
|
378
378
|
return /* @__PURE__ */ n("div", { id: "steps", className: "flex gap-x-3", children: e.map((a, o) => /* @__PURE__ */ n(
|
|
379
|
-
|
|
379
|
+
je,
|
|
380
380
|
{
|
|
381
381
|
currentStep: r,
|
|
382
382
|
onChangeStep: s,
|
|
@@ -385,7 +385,7 @@ const _e = (e, r) => {
|
|
|
385
385
|
},
|
|
386
386
|
a.id
|
|
387
387
|
)) });
|
|
388
|
-
},
|
|
388
|
+
}, Me = ({
|
|
389
389
|
name: e,
|
|
390
390
|
value: r,
|
|
391
391
|
title: t,
|
|
@@ -434,10 +434,10 @@ const _e = (e, r) => {
|
|
|
434
434
|
] });
|
|
435
435
|
};
|
|
436
436
|
var L = /* @__PURE__ */ ((e) => (e.Row = "Row", e.Column = "Column", e))(L || {});
|
|
437
|
-
const
|
|
437
|
+
const Be = "flex flex-col gap-2", He = "flex", Ue = "pb-1 mt-2", $e = {
|
|
438
438
|
[L.Column]: "flex-col gap-y-3",
|
|
439
439
|
[L.Row]: "flex-row gap-x-6"
|
|
440
|
-
},
|
|
440
|
+
}, cr = ({
|
|
441
441
|
fieldTitle: e,
|
|
442
442
|
radioCssClass: r,
|
|
443
443
|
labelCssClass: t,
|
|
@@ -447,7 +447,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
447
447
|
activeRadioButton: l,
|
|
448
448
|
orientation: i,
|
|
449
449
|
onChange: c
|
|
450
|
-
}) => /* @__PURE__ */ m("div", { className:
|
|
450
|
+
}) => /* @__PURE__ */ m("div", { className: Be, children: [
|
|
451
451
|
e && /* @__PURE__ */ n(P, { fieldTitle: e, htmlFor: a }),
|
|
452
452
|
/* @__PURE__ */ n(
|
|
453
453
|
"div",
|
|
@@ -456,12 +456,12 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
456
456
|
"aria-label": e,
|
|
457
457
|
"aria-disabled": s || void 0,
|
|
458
458
|
className: u(
|
|
459
|
-
|
|
460
|
-
|
|
459
|
+
He,
|
|
460
|
+
$e[i]
|
|
461
461
|
),
|
|
462
|
-
children: o.map((d) => /* @__PURE__ */ m(
|
|
462
|
+
children: o.map((d) => /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
|
|
463
463
|
/* @__PURE__ */ n(
|
|
464
|
-
|
|
464
|
+
Me,
|
|
465
465
|
{
|
|
466
466
|
name: a,
|
|
467
467
|
value: d.id,
|
|
@@ -478,7 +478,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
478
478
|
] }, d.id))
|
|
479
479
|
}
|
|
480
480
|
)
|
|
481
|
-
] }),
|
|
481
|
+
] }), Ke = ({
|
|
482
482
|
value: e,
|
|
483
483
|
textareaId: r,
|
|
484
484
|
placeholder: t,
|
|
@@ -503,7 +503,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
503
503
|
),
|
|
504
504
|
onChange: (c) => !l && i?.(c.currentTarget.value)
|
|
505
505
|
}
|
|
506
|
-
) }),
|
|
506
|
+
) }), Ge = [
|
|
507
507
|
"ArrowLeft",
|
|
508
508
|
"ArrowRight",
|
|
509
509
|
"ArrowUp",
|
|
@@ -515,8 +515,8 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
515
515
|
"Escape",
|
|
516
516
|
"Home",
|
|
517
517
|
"End"
|
|
518
|
-
],
|
|
519
|
-
if ((r === "number" || t !== void 0 || s !== void 0) && !
|
|
518
|
+
], Ze = (e, r, t, s) => {
|
|
519
|
+
if ((r === "number" || t !== void 0 || s !== void 0) && !Ge.includes(e.key) && !(e.key === "-" && e.currentTarget.selectionStart === 0 && (t === void 0 || t < 0)) && !(e.key === "." && r === "number" && !e.currentTarget.value.includes("."))) {
|
|
520
520
|
if (!/^[0-9]$/.test(e.key)) {
|
|
521
521
|
e.preventDefault();
|
|
522
522
|
return;
|
|
@@ -557,11 +557,11 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
557
557
|
textBeforeInput: v,
|
|
558
558
|
textAfterInput: D
|
|
559
559
|
}) => {
|
|
560
|
-
const
|
|
561
|
-
|
|
560
|
+
const U = (C) => C.target.blur(), $ = d === "number" || b !== void 0 || x !== void 0, K = (C) => {
|
|
561
|
+
Ze(C, d, b, x);
|
|
562
562
|
}, G = (C) => {
|
|
563
563
|
const I = C.currentTarget.value;
|
|
564
|
-
if (
|
|
564
|
+
if ($ && I !== "") {
|
|
565
565
|
const E = parseFloat(I);
|
|
566
566
|
if (isNaN(E) && I !== "-" && I !== "." || !isNaN(E) && (b !== void 0 && E < b || x !== void 0 && E > x))
|
|
567
567
|
return;
|
|
@@ -597,7 +597,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
597
597
|
" ",
|
|
598
598
|
A
|
|
599
599
|
] }),
|
|
600
|
-
/* @__PURE__ */ n(N, { icon: e
|
|
600
|
+
/* @__PURE__ */ n(N, { icon: e }),
|
|
601
601
|
/* @__PURE__ */ n(R, { tooltip: s, triggerClassName: c, children: /* @__PURE__ */ n(
|
|
602
602
|
"input",
|
|
603
603
|
{
|
|
@@ -611,12 +611,12 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
611
611
|
className: u("border-0 bg-transparent px-2", l),
|
|
612
612
|
onChange: (C) => !f && G?.(C),
|
|
613
613
|
onKeyDown: K,
|
|
614
|
-
onWheel:
|
|
614
|
+
onWheel: U,
|
|
615
615
|
min: b,
|
|
616
616
|
max: x
|
|
617
617
|
}
|
|
618
618
|
) }),
|
|
619
|
-
/* @__PURE__ */ n(N, { icon: r
|
|
619
|
+
/* @__PURE__ */ n(N, { icon: r }),
|
|
620
620
|
k && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pr-2", children: [
|
|
621
621
|
" ",
|
|
622
622
|
k
|
|
@@ -635,7 +635,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
635
635
|
]
|
|
636
636
|
}
|
|
637
637
|
);
|
|
638
|
-
},
|
|
638
|
+
}, Xe = /^0+\.(\d+)?$/, Ye = /^0+/, H = ({
|
|
639
639
|
fieldTitle: e,
|
|
640
640
|
errorText: r,
|
|
641
641
|
optional: t,
|
|
@@ -672,14 +672,14 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
672
672
|
),
|
|
673
673
|
/* @__PURE__ */ n(V, { errorText: r })
|
|
674
674
|
] })
|
|
675
|
-
] }),
|
|
675
|
+
] }), dr = ({
|
|
676
676
|
onChange: e,
|
|
677
677
|
value: r,
|
|
678
678
|
min: t,
|
|
679
679
|
max: s,
|
|
680
680
|
...a
|
|
681
681
|
}) => {
|
|
682
|
-
const o = (l) => String(l)?.match(
|
|
682
|
+
const o = (l) => String(l)?.match(Xe) ? String(l)?.replace(Ye, "0") : Number(l);
|
|
683
683
|
return /* @__PURE__ */ n(
|
|
684
684
|
H,
|
|
685
685
|
{
|
|
@@ -691,7 +691,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
691
691
|
...a
|
|
692
692
|
}
|
|
693
693
|
);
|
|
694
|
-
},
|
|
694
|
+
}, ur = ({
|
|
695
695
|
onChange: e,
|
|
696
696
|
...r
|
|
697
697
|
}) => /* @__PURE__ */ n(
|
|
@@ -701,7 +701,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
701
701
|
onChange: (t) => e?.(t),
|
|
702
702
|
...r
|
|
703
703
|
}
|
|
704
|
-
),
|
|
704
|
+
), mr = ({
|
|
705
705
|
fieldTitle: e,
|
|
706
706
|
optional: r,
|
|
707
707
|
elementId: t,
|
|
@@ -718,7 +718,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
718
718
|
}
|
|
719
719
|
),
|
|
720
720
|
/* @__PURE__ */ n(
|
|
721
|
-
|
|
721
|
+
Ke,
|
|
722
722
|
{
|
|
723
723
|
textareaId: t,
|
|
724
724
|
cssClass: s,
|
|
@@ -726,7 +726,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
726
726
|
}
|
|
727
727
|
),
|
|
728
728
|
/* @__PURE__ */ n(V, { errorText: a })
|
|
729
|
-
] }),
|
|
729
|
+
] }), pr = ({
|
|
730
730
|
title: e,
|
|
731
731
|
switchId: r,
|
|
732
732
|
isOn: t = !1,
|
|
@@ -767,14 +767,14 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
767
767
|
) }),
|
|
768
768
|
e && /* @__PURE__ */ n("span", { className: "pl-2 dial-small text-primary", children: e })
|
|
769
769
|
] });
|
|
770
|
-
},
|
|
770
|
+
}, qe = ({ onClick: e }) => /* @__PURE__ */ n(
|
|
771
771
|
te,
|
|
772
772
|
{
|
|
773
|
-
...
|
|
773
|
+
...F,
|
|
774
774
|
className: "text-primary",
|
|
775
775
|
onClick: e
|
|
776
776
|
}
|
|
777
|
-
),
|
|
777
|
+
), Je = ({ onClick: e }) => /* @__PURE__ */ n(se, { ...F, className: "text-primary", onClick: e }), Qe = ({ ...e }) => {
|
|
778
778
|
const [r, t] = W(!1), s = O((a) => {
|
|
779
779
|
t(a);
|
|
780
780
|
}, []);
|
|
@@ -783,10 +783,10 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
783
783
|
{
|
|
784
784
|
type: r ? "text" : "password",
|
|
785
785
|
...e,
|
|
786
|
-
iconAfterInput: r ? /* @__PURE__ */ n(
|
|
786
|
+
iconAfterInput: r ? /* @__PURE__ */ n(qe, { onClick: () => s(!1) }) : /* @__PURE__ */ n(Je, { onClick: () => s(!0) })
|
|
787
787
|
}
|
|
788
788
|
);
|
|
789
|
-
},
|
|
789
|
+
}, fr = ({
|
|
790
790
|
fieldTitle: e,
|
|
791
791
|
optional: r,
|
|
792
792
|
elementCssClass: t,
|
|
@@ -803,7 +803,7 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
803
803
|
}
|
|
804
804
|
),
|
|
805
805
|
/* @__PURE__ */ n(
|
|
806
|
-
|
|
806
|
+
Qe,
|
|
807
807
|
{
|
|
808
808
|
cssClass: t,
|
|
809
809
|
elementId: s,
|
|
@@ -815,25 +815,25 @@ const He = "flex flex-col gap-2", $e = "flex", Ue = "pb-1", Ke = {
|
|
|
815
815
|
] });
|
|
816
816
|
export {
|
|
817
817
|
y as AlertVariant,
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
818
|
+
T as ButtonVariant,
|
|
819
|
+
ar as DialAlert,
|
|
820
|
+
Ie as DialButton,
|
|
821
|
+
lr as DialCheckbox,
|
|
822
822
|
V as DialErrorText,
|
|
823
823
|
P as DialFieldLabel,
|
|
824
824
|
N as DialIcon,
|
|
825
825
|
S as DialInput,
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
826
|
+
or as DialLoader,
|
|
827
|
+
dr as DialNumberInputField,
|
|
828
|
+
Qe as DialPasswordInput,
|
|
829
|
+
fr as DialPasswordInputField,
|
|
830
|
+
Me as DialRadioButton,
|
|
831
|
+
cr as DialRadioGroup,
|
|
832
|
+
ir as DialSteps,
|
|
833
|
+
pr as DialSwitch,
|
|
834
|
+
mr as DialTextAreaField,
|
|
835
|
+
ur as DialTextInputField,
|
|
836
|
+
Ke as DialTextarea,
|
|
837
837
|
R as DialTooltip,
|
|
838
838
|
h as StepStatus
|
|
839
839
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RadioGroupOrientation } from '../../types/radio-group';
|
|
2
2
|
export declare const groupBaseClasses = "flex flex-col gap-2";
|
|
3
3
|
export declare const optionsWrapperBaseClasses = "flex";
|
|
4
|
-
export declare const selectedContentClasses = "pb-1";
|
|
4
|
+
export declare const selectedContentClasses = "pb-1 mt-2";
|
|
5
5
|
export declare const orientationClassMap: Record<RadioGroupOrientation, string>;
|