@epam/ai-dial-ui-kit 0.2.0-rc.10 → 0.2.0-rc.12
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 +248 -201
- package/dist/src/components/PasswordInput/Icons/HideIcon.d.ts +16 -0
- package/dist/src/components/PasswordInput/Icons/ShowIcon.d.ts +16 -0
- package/dist/src/components/PasswordInput/PasswordInput.d.ts +24 -0
- package/dist/src/components/PasswordInput/PasswordInputField.d.ts +29 -0
- package/dist/src/components/Steps/Step.d.ts +1 -1
- package/dist/src/components/Steps/Steps.d.ts +3 -3
- package/dist/src/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/dial-ui-kit.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("classnames"),b=require("@tabler/icons-react"),p=require("react"),x=require("@floating-ui/react"),N=({icon:e,className:s})=>e?r.jsx("span",{className:d("flex-shrink-0",s),children:e}):null;var k=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(k||{});const $={[k.Primary]:"dial-primary-button",[k.Secondary]:"dial-secondary-button",[k.Tertiary]:"dial-tertiary-button"},V=({title:e,variant:s,cssClass:t,ref:n,onClick:a,disable:o,iconAfter:l,iconBefore:i,hideTitleOnMobile:c,ariaLabel:m})=>{const u=d("dial-small-semi",l?"mr-2":"",i?"ml-2":"",c?"hidden sm:inline":"inline"),h=d(s&&$[s],t,"focus-visible:outline outline-offset-0");return r.jsxs("button",{ref:n,type:"button",className:h,onClick:v=>a?.(v),disabled:o,"aria-label":e||m,children:[r.jsx(N,{icon:i}),e&&r.jsx("span",{className:u,children:e}),r.jsx(N,{icon:l})]})},S=({errorText:e})=>e&&r.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),A=({fieldTitle:e,htmlFor:s,optional:t,optionalText:n,cssClass:a})=>e?r.jsxs("label",{className:d("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:s,children:[r.jsx("span",{className:"min-h-4",children:e}),t&&r.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var C=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(C||{});const K={info:r.jsx(b.IconInfoCircle,{size:24,stroke:2}),error:r.jsx(b.IconAlertCircle,{size:24,stroke:2}),warning:r.jsx(b.IconAlertTriangle,{size:24,stroke:2}),success:r.jsx(b.IconCircleCheck,{size:24,stroke:2})},G={[C.Info]:"bg-info border-info text-info",[C.Success]:"bg-success border-success text-success",[C.Warning]:"bg-warning border-warning text-warning",[C.Error]:"bg-error border-error text-error"},Z="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",X=({variant:e=C.Info,message:s,cssClass:t,closable:n=!1,onClose:a})=>r.jsxs("div",{role:"alert",className:d(Z,G[e],t),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(N,{icon:K[e]}),r.jsx("div",{className:"text-primary",children:s})]}),n&&r.jsx(V,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:r.jsx(b.IconX,{size:16}),onClick:o=>a?.(o)})]}),Y="flex items-center justify-center text-secondary",J="shrink-0 grow-0 basis-auto animate-spin-steps",Q=({size:e=18,cssClass:s,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>r.jsx("div",{role:"status","aria-label":a,className:d({[Y]:!0,"w-full h-full":n,[s||""]:!!s}),children:r.jsx(N,{icon:r.jsx(b.IconLoader,{width:e,height:e,className:d(J,t)})})}),ee=7,re=2,z=p.createContext(null),M=()=>{const e=p.useContext(z);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},se=({initialOpen:e=!1,placement:s="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[o,l]=p.useState(e),i=p.useRef(null),c=n??o,m=a??l,u=x.useFloating({placement:s,open:c,onOpenChange:m,whileElementsMounted:x.autoUpdate,middleware:[x.offset(ee+re),x.flip({crossAxis:s.includes("-"),fallbackAxisSideDirection:"start",padding:5}),x.shift({padding:5}),x.arrow({element:i})]}),h=x.useHover(u.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),v=x.useFocus(u.context,{enabled:n==null}),F=x.useDismiss(u.context),j=x.useRole(u.context,{role:"tooltip"}),g=x.useInteractions([h,v,F,j]);return p.useMemo(()=>({open:c,setOpen:m,arrowRef:i,...g,...u}),[c,m,g,u])},te=({children:e,...s})=>{const t=se(s);return r.jsx(z.Provider,{value:t,children:e})},ne=p.forwardRef(function({style:s,...t},n){const a=M(),o=x.useMergeRefs([a.refs.setFloating,n]);return a.open?r.jsx(x.FloatingPortal,{id:"tooltip-portal",children:r.jsxs("div",{ref:o,style:{...a.floatingStyles,...s},...a.getFloatingProps(t),className:d("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(t).className),children:[t.children,r.jsx(x.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),ae=p.forwardRef(function({children:s,asChild:t=!1,...n},a){const o=M(),i=s&&typeof s=="object"&&"ref"in s&&s.ref!==void 0?s.ref:void 0,c=x.useMergeRefs([o.refs.setReference,a,i]);return t&&p.isValidElement(s)?p.cloneElement(s,o.getReferenceProps({ref:c,...n,...s.props})):r.jsx("span",{ref:c,...o.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:s})}),w=({hideTooltip:e,tooltip:s,children:t,triggerClassName:n,contentClassName:a,...o})=>e||!s?r.jsx("span",{className:n,children:t}):r.jsxs(te,{...o,children:[r.jsx(ae,{className:d(n,"truncate"),children:t}),r.jsx(ne,{className:d("text-primary",a,"max-w-[300px]",(e||!s)&&"hidden"),children:s})]}),oe=18,O={size:oe,stroke:2},le=({label:e,id:s,checked:t,indeterminate:n,disabled:a,ariaLabel:o,onChange:l})=>{const i=p.useCallback(u=>{u.stopPropagation(),l?.(u.target.checked,s)},[l,s]),c=d("flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",`${t?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded before:mr-2'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":""),m=d("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":"");return r.jsxs("label",{className:c,htmlFor:s,children:[t&&(n?r.jsx(b.IconMinus,{className:m,...O}):r.jsx(b.IconCheck,{className:m,...O})),e&&r.jsx(w,{tooltip:e,triggerClassName:"flex-1 min-w-0",children:r.jsx("p",{className:"text-primary w-full truncate",children:e})}),r.jsx("input",{type:"checkbox",onChange:i,id:s,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 ie=(e,s)=>{if(s===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"}},ce=(e,s)=>{if(s===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"}},de=({step:e,index:s,currentStep:t,handleStepChange: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?r.jsx(b.IconExclamationCircle,{stroke:2,size:16}):t!==e.id&&e.status===f.VALID?r.jsx(b.IconCheck,{stroke:2,size:16}):s+1;return r.jsxs("button",{className:d(a,ie(e,t)),onClick:()=>n(e.id),children:[r.jsx("span",{className:d(o,ce(e,t)),children:l()}),r.jsx("span",{children:e.name})]})},ue=({steps:e,currentStep:s,setCurrentStep:t})=>{const n=a=>{const o=e.findIndex(i=>i.id===s),l=e.findIndex(i=>i.id===a);(a!==s&&e[o].status===f.VALID||l<o)&&t(a)};return r.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,o)=>r.jsx(de,{currentStep:s,handleStepChange:n,step:a,index:o},a.id))})},_=({value:e,textareaId:s,placeholder:t,cssClass:n="",disabled:a,invalid:o,readonly:l,onChange:i})=>r.jsx(w,{tooltip:e,triggerClassName:"flex",children:r.jsx("textarea",{id:s,placeholder:t,value:e||"",disabled:a,className:d("dial-textarea dial-input",o?"dial-input-error":"",a&&"dial-input-disable",l&&"dial-input-readonly",n),onChange:c=>!l&&i?.(c.currentTarget.value)})}),xe=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],me=(e,s,t,n)=>{if((s==="number"||t!==void 0||n!==void 0)&&!xe.includes(e.key)&&!(e.key==="-"&&e.currentTarget.selectionStart===0&&(t===void 0||t<0))&&!(e.key==="."&&s==="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}}}}},E=({iconBeforeInput:e,iconAfterInput:s,hideBorder:t,value:n,elementId:a,placeholder:o="",cssClass:l="",containerCssClass:i,tooltipTriggerClassName:c,type:m="text",disabled:u,readonly:h,invalid:v,onChange:F,min:j,max:g,prefix:P,suffix:L,textBeforeInput:D,textAfterInput:I})=>{const B=y=>y.target.blur(),q=m==="number"||j!==void 0||g!==void 0,H=y=>{me(y,m,j,g)},U=y=>{const R=y.currentTarget.value;if(q&&R!==""){const T=parseFloat(R);if(isNaN(T)&&R!=="-"&&R!=="."||!isNaN(T)&&(j!==void 0&&T<j||g!==void 0&&T>g))return}F?.(R)};return r.jsxs("div",{className:d("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",v&&"dial-input-error",u&&"dial-input-disable",h&&"dial-input-readonly",!D&&"pl-1",!I&&"pr-1",i),children:[D&&r.jsx(w,{tooltip:D,children:r.jsx(E,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:D,disabled:!0,elementId:D+"textBefore"})}),P&&r.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",P]}),r.jsx(N,{icon:e,className:"pl-2"}),r.jsx(w,{tooltip:n,triggerClassName:c,children:r.jsx("input",{type:m,autoComplete:"off",id:a,placeholder:o,value:n??"",title:n?String(n):"",disabled:u,className:d("border-0 bg-transparent px-2",l),onChange:y=>!h&&U?.(y),onKeyDown:H,onWheel:B,min:j,max:g})}),r.jsx(N,{icon:s,className:"pr-2"}),L&&r.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",L]}),I&&r.jsx(w,{tooltip:I,children:r.jsx(E,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:I,disabled:!0,elementId:I+"textAfter"})})]})},fe=/^0+\.(\d+)?$/,pe=/^0+/,W=({fieldTitle:e,errorText:s,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:o,containerCssClass:l,readonly:i,defaultEmptyText:c,min:m,max:u,...h})=>r.jsxs("div",{className:d("flex flex-col",l),children:[r.jsx(A,{fieldTitle:e,optional:t,htmlFor:o}),i?r.jsx("span",{children:h.value||(c??"None")}):r.jsxs(r.Fragment,{children:[r.jsx(E,{elementId:o,cssClass:n,containerCssClass:a,invalid:s!=null,min:m,max:u,...h}),r.jsx(S,{errorText:s})]})]}),be=({onChange:e,value:s,min:t,max:n,...a})=>{const o=l=>String(l)?.match(fe)?String(l)?.replace(pe,"0"):Number(l);return r.jsx(W,{type:"number",onChange:l=>e?.(o(l)),value:s,min:t,max:n,...a})},he=({onChange:e,...s})=>r.jsx(W,{type:"text",onChange:t=>e?.(t),...s}),ge=({fieldTitle:e,optional:s,elementId:t,elementCssClass:n,errorText:a,...o})=>r.jsxs("div",{className:"flex flex-col",children:[r.jsx(A,{fieldTitle:e,optional:s,htmlFor:t}),r.jsx(_,{textareaId:t,cssClass:n,...o}),r.jsx(S,{errorText:a})]}),je=({title:e,switchId:s,isOn:t=!1,disabled:n,onChange:a})=>{const o=d("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),l=p.useCallback(i=>{i.stopPropagation(),a?.(!t)},[a,t]);return r.jsxs("div",{className:"flex flex-row items-center",children:[r.jsx("input",{type:"checkbox",onChange:l,id:s,disabled:n,className:"invisible w-0 h-0",checked:t}),r.jsx("label",{htmlFor:s,className:o,children:r.jsx("span",{className:d("size-3 rounded-full",n?t?"bg-layer-4":"bg-controls-disable":"bg-controls-enable-primary")})}),e&&r.jsx("span",{className:"pl-2 dial-small text-primary",children:e})]})};exports.AlertVariant=C;exports.ButtonVariant=k;exports.DialAlert=X;exports.DialButton=V;exports.DialCheckbox=le;exports.DialErrorText=S;exports.DialFieldLabel=A;exports.DialIcon=N;exports.DialInput=E;exports.DialLoader=Q;exports.DialNumberInputField=be;exports.DialSteps=ue;exports.DialSwitch=je;exports.DialTextAreaField=ge;exports.DialTextInputField=he;exports.DialTextarea=_;exports.DialTooltip=w;exports.StepStatus=f;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),d=require("classnames"),b=require("@tabler/icons-react"),m=require("react"),x=require("@floating-ui/react"),w=({icon:e,className:s})=>e?r.jsx("span",{className:d("flex-shrink-0",s),children:e}):null;var k=(e=>(e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e))(k||{});const K={[k.Primary]:"dial-primary-button",[k.Secondary]:"dial-secondary-button",[k.Tertiary]:"dial-tertiary-button"},V=({title:e,variant:s,cssClass:t,ref:n,onClick:a,disable:o,iconAfter:l,iconBefore:i,hideTitleOnMobile:c,ariaLabel:p})=>{const u=d("dial-small-semi",l?"mr-2":"",i?"ml-2":"",c?"hidden sm:inline":"inline"),h=d(s&&K[s],t,"focus-visible:outline outline-offset-0");return r.jsxs("button",{ref:n,type:"button",className:h,onClick:D=>a?.(D),disabled:o,"aria-label":e||p,children:[r.jsx(w,{icon:i}),e&&r.jsx("span",{className:u,children:e}),r.jsx(w,{icon:l})]})},F=({errorText:e})=>e&&r.jsx("span",{className:"text-error dial-tiny mt-1",children:e}),P=({fieldTitle:e,htmlFor:s,optional:t,optionalText:n,cssClass:a})=>e?r.jsxs("label",{className:d("dial-tiny text-secondary",a,!a?.includes("mb")&&"mb-2"),htmlFor:s,children:[r.jsx("span",{className:"min-h-4",children:e}),t&&r.jsx("span",{className:"ml-1",children:n??"(Optional)"})]}):null;var C=(e=>(e.Info="info",e.Success="success",e.Warning="warning",e.Error="error",e))(C||{});const G={info:r.jsx(b.IconInfoCircle,{size:24,stroke:2}),error:r.jsx(b.IconAlertCircle,{size:24,stroke:2}),warning:r.jsx(b.IconAlertTriangle,{size:24,stroke:2}),success:r.jsx(b.IconCircleCheck,{size:24,stroke:2})},Z={[C.Info]:"bg-info border-info text-info",[C.Success]:"bg-success border-success text-success",[C.Warning]:"bg-warning border-warning text-warning",[C.Error]:"bg-error border-error text-error"},X="items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex",Y=({variant:e=C.Info,message:s,cssClass:t,closable:n=!1,onClose:a})=>r.jsxs("div",{role:"alert",className:d(X,Z[e],t),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(w,{icon:G[e]}),r.jsx("div",{className:"text-primary",children:s})]}),n&&r.jsx(V,{cssClass:"ml-2 text-secondary hover:text-primary",ariaLabel:"Close alert",iconBefore:r.jsx(b.IconX,{size:16}),onClick:o=>a?.(o)})]}),J="flex items-center justify-center text-secondary",Q="shrink-0 grow-0 basis-auto animate-spin-steps",ee=({size:e=18,cssClass:s,iconClass:t,fullWidth:n=!0,ariaLabel:a="Loading"})=>r.jsx("div",{role:"status","aria-label":a,className:d({[J]:!0,"w-full h-full":n,[s||""]:!!s}),children:r.jsx(w,{icon:r.jsx(b.IconLoader,{width:e,height:e,className:d(Q,t)})})}),re=7,se=2,z=m.createContext(null),M=()=>{const e=m.useContext(z);if(e==null)throw new Error("Tooltip components must be wrapped in <Tooltip />");return e},te=({initialOpen:e=!1,placement:s="bottom",isTriggerClickable:t=!1,open:n,onOpenChange:a}={})=>{const[o,l]=m.useState(e),i=m.useRef(null),c=n??o,p=a??l,u=x.useFloating({placement:s,open:c,onOpenChange:p,whileElementsMounted:x.autoUpdate,middleware:[x.offset(re+se),x.flip({crossAxis:s.includes("-"),fallbackAxisSideDirection:"start",padding:5}),x.shift({padding:5}),x.arrow({element:i})]}),h=x.useHover(u.context,{move:!1,enabled:n==null,mouseOnly:t,delay:{open:500,close:0}}),D=x.useFocus(u.context,{enabled:n==null}),A=x.useDismiss(u.context),j=x.useRole(u.context,{role:"tooltip"}),g=x.useInteractions([h,D,A,j]);return m.useMemo(()=>({open:c,setOpen:p,arrowRef:i,...g,...u}),[c,p,g,u])},ne=({children:e,...s})=>{const t=te(s);return r.jsx(z.Provider,{value:t,children:e})},ae=m.forwardRef(function({style:s,...t},n){const a=M(),o=x.useMergeRefs([a.refs.setFloating,n]);return a.open?r.jsx(x.FloatingPortal,{id:"tooltip-portal",children:r.jsxs("div",{ref:o,style:{...a.floatingStyles,...s},...a.getFloatingProps(t),className:d("z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",a.getFloatingProps(t).className),children:[t.children,r.jsx(x.FloatingArrow,{ref:a.arrowRef,context:a.context,fill:"currentColor",strokeWidth:1,className:"stroke-primary w-2 text-[var(--bg-layer-0,_#000000)]"})]})}):null}),oe=m.forwardRef(function({children:s,asChild:t=!1,...n},a){const o=M(),i=s&&typeof s=="object"&&"ref"in s&&s.ref!==void 0?s.ref:void 0,c=x.useMergeRefs([o.refs.setReference,a,i]);return t&&m.isValidElement(s)?m.cloneElement(s,o.getReferenceProps({ref:c,...n,...s.props})):r.jsx("span",{ref:c,...o.getReferenceProps(n),className:n.className??"dial-tooltip-trigger text-left",children:s})}),N=({hideTooltip:e,tooltip:s,children:t,triggerClassName:n,contentClassName:a,...o})=>e||!s?r.jsx("span",{className:n,children:t}):r.jsxs(ne,{...o,children:[r.jsx(oe,{className:d(n,"truncate"),children:t}),r.jsx(ae,{className:d("text-primary",a,"max-w-[300px]",(e||!s)&&"hidden"),children:s})]}),le=18,E={size:le,stroke:2},ie=({label:e,id:s,checked:t,indeterminate:n,disabled:a,ariaLabel:o,onChange:l})=>{const i=m.useCallback(u=>{u.stopPropagation(),l?.(u.target.checked,s)},[l,s]),c=d("flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",`${t?"":'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded before:mr-2'}`,a?"pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4":""),p=d("mr-2 border rounded",a?"bg-layer-4 border-icon-secondary":"");return r.jsxs("label",{className:c,htmlFor:s,children:[t&&(n?r.jsx(b.IconMinus,{className:p,...E}):r.jsx(b.IconCheck,{className:p,...E})),e&&r.jsx(N,{tooltip:e,triggerClassName:"flex-1 min-w-0",children:r.jsx("p",{className:"text-primary w-full truncate",children:e})}),r.jsx("input",{type:"checkbox",onChange:i,id:s,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 ce=(e,s)=>{if(s===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"}},de=(e,s)=>{if(s===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"}},ue=({step:e,index:s,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?r.jsx(b.IconExclamationCircle,{stroke:2,size:16}):t!==e.id&&e.status===f.VALID?r.jsx(b.IconCheck,{stroke:2,size:16}):s+1;return r.jsxs("button",{className:d(a,ce(e,t)),onClick:()=>n(e.id),children:[r.jsx("span",{className:d(o,de(e,t)),children:l()}),r.jsx("span",{children:e.name})]})},xe=({steps:e,currentStep:s,onChangeStep:t})=>{const n=a=>{const o=e.findIndex(i=>i.id===s),l=e.findIndex(i=>i.id===a);(a!==s&&e[o].status===f.VALID||l<o)&&t(a)};return r.jsx("div",{id:"steps",className:"flex gap-x-3",children:e.map((a,o)=>r.jsx(ue,{currentStep:s,onChangeStep:n,step:a,index:o},a.id))})},_=({value:e,textareaId:s,placeholder:t,cssClass:n="",disabled:a,invalid:o,readonly:l,onChange:i})=>r.jsx(N,{tooltip:e,triggerClassName:"flex",children:r.jsx("textarea",{id:s,placeholder:t,value:e||"",disabled:a,className:d("dial-textarea dial-input",o?"dial-input-error":"",a&&"dial-input-disable",l&&"dial-input-readonly",n),onChange:c=>!l&&i?.(c.currentTarget.value)})}),pe=["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Backspace","Delete","Tab","Enter","Escape","Home","End"],fe=(e,s,t,n)=>{if((s==="number"||t!==void 0||n!==void 0)&&!pe.includes(e.key)&&!(e.key==="-"&&e.currentTarget.selectionStart===0&&(t===void 0||t<0))&&!(e.key==="."&&s==="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}}}}},T=({iconBeforeInput:e,iconAfterInput:s,hideBorder:t,value:n,elementId:a,placeholder:o="",cssClass:l="",containerCssClass:i,tooltipTriggerClassName:c,type:p="text",disabled:u,readonly:h,invalid:D,onChange:A,min:j,max:g,prefix:L,suffix:O,textBeforeInput:v,textAfterInput:I})=>{const q=y=>y.target.blur(),H=p==="number"||j!==void 0||g!==void 0,U=y=>{fe(y,p,j,g)},$=y=>{const R=y.currentTarget.value;if(H&&R!==""){const S=parseFloat(R);if(isNaN(S)&&R!=="-"&&R!=="."||!isNaN(S)&&(j!==void 0&&S<j||g!==void 0&&S>g))return}A?.(R)};return r.jsxs("div",{className:d("dial-input-field flex flex-row items-center justify-between",t?"dial-input-no-border":"dial-input",D&&"dial-input-error",u&&"dial-input-disable",h&&"dial-input-readonly",!v&&"pl-1",!I&&"pr-1",i),children:[v&&r.jsx(N,{tooltip:v,children:r.jsx(T,{hideBorder:!0,containerCssClass:"rounded-r-none border-r-0",cssClass:"px-2 overflow-hidden overflow-ellipsis dial-small",value:v,disabled:!0,elementId:v+"textBefore"})}),L&&r.jsxs("p",{className:"text-secondary dial-small pl-2",children:[" ",L]}),r.jsx(w,{icon:e,className:"pl-2"}),r.jsx(N,{tooltip:n,triggerClassName:c,children:r.jsx("input",{type:p,autoComplete:"off",id:a,placeholder:o,value:n??"",title:n?String(n):"",disabled:u,className:d("border-0 bg-transparent px-2",l),onChange:y=>!h&&$?.(y),onKeyDown:U,onWheel:q,min:j,max:g})}),r.jsx(w,{icon:s,className:"pr-2"}),O&&r.jsxs("p",{className:"text-secondary dial-small pr-2",children:[" ",O]}),I&&r.jsx(N,{tooltip:I,children:r.jsx(T,{hideBorder:!0,containerCssClass:"rounded-l-none border-l-0",cssClass:"px-2",value:I,disabled:!0,elementId:I+"textAfter"})})]})},me=/^0+\.(\d+)?$/,be=/^0+/,W=({fieldTitle:e,errorText:s,optional:t,elementCssClass:n,elementContainerCssClass:a,elementId:o,containerCssClass:l,readonly:i,defaultEmptyText:c,min:p,max:u,...h})=>r.jsxs("div",{className:d("flex flex-col",l),children:[r.jsx(P,{fieldTitle:e,optional:t,htmlFor:o}),i?r.jsx("span",{children:h.value||(c??"None")}):r.jsxs(r.Fragment,{children:[r.jsx(T,{elementId:o,cssClass:n,containerCssClass:a,invalid:s!=null,min:p,max:u,...h}),r.jsx(F,{errorText:s})]})]}),he=({onChange:e,value:s,min:t,max:n,...a})=>{const o=l=>String(l)?.match(me)?String(l)?.replace(be,"0"):Number(l);return r.jsx(W,{type:"number",onChange:l=>e?.(o(l)),value:s,min:t,max:n,...a})},ge=({onChange:e,...s})=>r.jsx(W,{type:"text",onChange:t=>e?.(t),...s}),je=({fieldTitle:e,optional:s,elementId:t,elementCssClass:n,errorText:a,...o})=>r.jsxs("div",{className:"flex flex-col",children:[r.jsx(P,{fieldTitle:e,optional:s,htmlFor:t}),r.jsx(_,{textareaId:t,cssClass:n,...o}),r.jsx(F,{errorText:a})]}),ye=({title:e,switchId:s,isOn:t=!1,disabled:n,onChange:a})=>{const o=d("flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",t?"flex-row-reverse":"flex-row",n?"pointer-events-none":"",n?t?"bg-controls-disable":"bg-layer-4":t?"bg-accent-primary":"bg-layer-4"),l=m.useCallback(i=>{i.stopPropagation(),a?.(!t)},[a,t]);return r.jsxs("div",{className:"flex flex-row items-center",children:[r.jsx("input",{type:"checkbox",onChange:l,id:s,disabled:n,className:"invisible w-0 h-0",checked:t}),r.jsx("label",{htmlFor:s,className:o,children:r.jsx("span",{className:d("size-3 rounded-full",n?t?"bg-layer-4":"bg-controls-disable":"bg-controls-enable-primary")})}),e&&r.jsx("span",{className:"pl-2 dial-small text-primary",children:e})]})},Ce=({onClick:e})=>r.jsx(b.IconEyeOff,{...E,className:"text-primary",onClick:e}),we=({onClick:e})=>r.jsx(b.IconEye,{...E,className:"text-primary",onClick:e}),B=({...e})=>{const[s,t]=m.useState(!1),n=m.useCallback(a=>{t(a)},[]);return r.jsx(T,{type:s?"text":"password",...e,iconAfterInput:s?r.jsx(Ce,{onClick:()=>n(!1)}):r.jsx(we,{onClick:()=>n(!0)})})},Ne=({fieldTitle:e,optional:s,elementCssClass:t,elementId:n,errorText:a,...o})=>r.jsxs("div",{className:"flex flex-col",children:[r.jsx(P,{fieldTitle:e,optional:s,htmlFor:n}),r.jsx(B,{cssClass:t,elementId:n,invalid:!!a,...o}),r.jsx(F,{errorText:a})]});exports.AlertVariant=C;exports.ButtonVariant=k;exports.DialAlert=Y;exports.DialButton=V;exports.DialCheckbox=ie;exports.DialErrorText=F;exports.DialFieldLabel=P;exports.DialIcon=w;exports.DialInput=T;exports.DialLoader=ee;exports.DialNumberInputField=he;exports.DialPasswordInput=B;exports.DialPasswordInputField=Ne;exports.DialSteps=xe;exports.DialSwitch=ye;exports.DialTextAreaField=je;exports.DialTextInputField=ge;exports.DialTextarea=_;exports.DialTooltip=N;exports.StepStatus=f;
|
package/dist/dial-ui-kit.es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as t, jsxs as m, Fragment as G } from "react/jsx-runtime";
|
|
2
2
|
import d from "classnames";
|
|
3
|
-
import { IconCircleCheck as
|
|
4
|
-
import { createContext as
|
|
5
|
-
import { useFloating as
|
|
6
|
-
const
|
|
3
|
+
import { IconCircleCheck as Z, IconAlertTriangle as X, IconAlertCircle as Y, IconInfoCircle as q, IconX as J, IconLoader as Q, IconMinus as ee, IconCheck as V, IconExclamationCircle as re, IconEyeOff as te, IconEye as ne } from "@tabler/icons-react";
|
|
4
|
+
import { createContext as se, useState as z, useRef as oe, useMemo as ae, useContext as le, forwardRef as _, isValidElement as ie, cloneElement as ce, useCallback as S } from "react";
|
|
5
|
+
import { useFloating as de, offset as ue, flip as me, shift as fe, arrow as pe, autoUpdate as he, useHover as be, useFocus as ge, useDismiss as xe, useRole as ye, useInteractions as Ce, useMergeRefs as j, FloatingPortal as Ne, FloatingArrow as we } from "@floating-ui/react";
|
|
6
|
+
const C = ({ icon: e, className: r }) => e ? /* @__PURE__ */ t("span", { className: d("flex-shrink-0", r), children: e }) : null;
|
|
7
7
|
var k = /* @__PURE__ */ ((e) => (e.Primary = "primary", e.Secondary = "secondary", e.Tertiary = "tertiary", e))(k || {});
|
|
8
|
-
const
|
|
8
|
+
const ve = {
|
|
9
9
|
[k.Primary]: "dial-primary-button",
|
|
10
10
|
[k.Secondary]: "dial-secondary-button",
|
|
11
11
|
[k.Tertiary]: "dial-tertiary-button"
|
|
12
|
-
},
|
|
12
|
+
}, De = ({
|
|
13
13
|
title: e,
|
|
14
14
|
variant: r,
|
|
15
|
-
cssClass:
|
|
15
|
+
cssClass: n,
|
|
16
16
|
ref: s,
|
|
17
17
|
onClick: o,
|
|
18
18
|
disable: a,
|
|
@@ -26,9 +26,9 @@ const Ce = {
|
|
|
26
26
|
l ? "mr-2" : "",
|
|
27
27
|
i ? "ml-2" : "",
|
|
28
28
|
c ? "hidden sm:inline" : "inline"
|
|
29
|
-
),
|
|
30
|
-
r &&
|
|
31
|
-
|
|
29
|
+
), h = d(
|
|
30
|
+
r && ve[r],
|
|
31
|
+
n,
|
|
32
32
|
"focus-visible:outline outline-offset-0"
|
|
33
33
|
);
|
|
34
34
|
return /* @__PURE__ */ m(
|
|
@@ -36,21 +36,21 @@ const Ce = {
|
|
|
36
36
|
{
|
|
37
37
|
ref: s,
|
|
38
38
|
type: "button",
|
|
39
|
-
className:
|
|
40
|
-
onClick: (
|
|
39
|
+
className: h,
|
|
40
|
+
onClick: (N) => o?.(N),
|
|
41
41
|
disabled: a,
|
|
42
42
|
"aria-label": e || f,
|
|
43
43
|
children: [
|
|
44
|
-
/* @__PURE__ */
|
|
45
|
-
e && /* @__PURE__ */
|
|
46
|
-
/* @__PURE__ */
|
|
44
|
+
/* @__PURE__ */ t(C, { icon: i }),
|
|
45
|
+
e && /* @__PURE__ */ t("span", { className: u, children: e }),
|
|
46
|
+
/* @__PURE__ */ t(C, { icon: l })
|
|
47
47
|
]
|
|
48
48
|
}
|
|
49
49
|
);
|
|
50
|
-
},
|
|
50
|
+
}, P = ({ errorText: e }) => e && /* @__PURE__ */ t("span", { className: "text-error dial-tiny mt-1", children: e }), A = ({
|
|
51
51
|
fieldTitle: e,
|
|
52
52
|
htmlFor: r,
|
|
53
|
-
optional:
|
|
53
|
+
optional: n,
|
|
54
54
|
optionalText: s,
|
|
55
55
|
cssClass: o
|
|
56
56
|
}) => e ? /* @__PURE__ */ m(
|
|
@@ -63,26 +63,26 @@ const Ce = {
|
|
|
63
63
|
),
|
|
64
64
|
htmlFor: r,
|
|
65
65
|
children: [
|
|
66
|
-
/* @__PURE__ */
|
|
67
|
-
|
|
66
|
+
/* @__PURE__ */ t("span", { className: "min-h-4", children: e }),
|
|
67
|
+
n && /* @__PURE__ */ t("span", { className: "ml-1", children: s ?? "(Optional)" })
|
|
68
68
|
]
|
|
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
|
|
73
|
-
info: /* @__PURE__ */
|
|
74
|
-
error: /* @__PURE__ */
|
|
75
|
-
warning: /* @__PURE__ */
|
|
76
|
-
success: /* @__PURE__ */
|
|
77
|
-
},
|
|
72
|
+
const Ie = {
|
|
73
|
+
info: /* @__PURE__ */ t(q, { size: 24, stroke: 2 }),
|
|
74
|
+
error: /* @__PURE__ */ t(Y, { size: 24, stroke: 2 }),
|
|
75
|
+
warning: /* @__PURE__ */ t(X, { size: 24, stroke: 2 }),
|
|
76
|
+
success: /* @__PURE__ */ t(Z, { size: 24, stroke: 2 })
|
|
77
|
+
}, Re = {
|
|
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
|
+
}, ke = "items-center justify-between gap-2 p-3 border border-solid dial-small-150 rounded flex", Qe = ({
|
|
83
83
|
variant: e = y.Info,
|
|
84
84
|
message: r,
|
|
85
|
-
cssClass:
|
|
85
|
+
cssClass: n,
|
|
86
86
|
closable: s = !1,
|
|
87
87
|
onClose: o
|
|
88
88
|
}) => /* @__PURE__ */ m(
|
|
@@ -90,112 +90,112 @@ const ve = {
|
|
|
90
90
|
{
|
|
91
91
|
role: "alert",
|
|
92
92
|
className: d(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
ke,
|
|
94
|
+
Re[e],
|
|
95
|
+
n
|
|
96
96
|
),
|
|
97
97
|
children: [
|
|
98
98
|
/* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
99
|
+
/* @__PURE__ */ t(C, { icon: Ie[e] }),
|
|
100
|
+
/* @__PURE__ */ t("div", { className: "text-primary", children: r })
|
|
101
101
|
] }),
|
|
102
|
-
s && /* @__PURE__ */
|
|
103
|
-
|
|
102
|
+
s && /* @__PURE__ */ t(
|
|
103
|
+
De,
|
|
104
104
|
{
|
|
105
105
|
cssClass: "ml-2 text-secondary hover:text-primary",
|
|
106
106
|
ariaLabel: "Close alert",
|
|
107
|
-
iconBefore: /* @__PURE__ */
|
|
107
|
+
iconBefore: /* @__PURE__ */ t(J, { size: 16 }),
|
|
108
108
|
onClick: (a) => o?.(a)
|
|
109
109
|
}
|
|
110
110
|
)
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
|
-
),
|
|
113
|
+
), Te = "flex items-center justify-center text-secondary", Ee = "shrink-0 grow-0 basis-auto animate-spin-steps", er = ({
|
|
114
114
|
size: e = 18,
|
|
115
115
|
cssClass: r,
|
|
116
|
-
iconClass:
|
|
116
|
+
iconClass: n,
|
|
117
117
|
fullWidth: s = !0,
|
|
118
118
|
ariaLabel: o = "Loading"
|
|
119
|
-
}) => /* @__PURE__ */
|
|
119
|
+
}) => /* @__PURE__ */ t(
|
|
120
120
|
"div",
|
|
121
121
|
{
|
|
122
122
|
role: "status",
|
|
123
123
|
"aria-label": o,
|
|
124
124
|
className: d({
|
|
125
|
-
[
|
|
125
|
+
[Te]: !0,
|
|
126
126
|
"w-full h-full": s,
|
|
127
127
|
[r || ""]: !!r
|
|
128
128
|
}),
|
|
129
|
-
children: /* @__PURE__ */
|
|
130
|
-
|
|
129
|
+
children: /* @__PURE__ */ t(
|
|
130
|
+
C,
|
|
131
131
|
{
|
|
132
|
-
icon: /* @__PURE__ */
|
|
133
|
-
|
|
132
|
+
icon: /* @__PURE__ */ t(
|
|
133
|
+
Q,
|
|
134
134
|
{
|
|
135
135
|
width: e,
|
|
136
136
|
height: e,
|
|
137
|
-
className: d(
|
|
137
|
+
className: d(Ee, n)
|
|
138
138
|
}
|
|
139
139
|
)
|
|
140
140
|
}
|
|
141
141
|
)
|
|
142
142
|
}
|
|
143
|
-
),
|
|
144
|
-
const e =
|
|
143
|
+
), Fe = 7, Se = 2, W = se(null), M = () => {
|
|
144
|
+
const e = le(W);
|
|
145
145
|
if (e == null)
|
|
146
146
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
147
147
|
return e;
|
|
148
|
-
},
|
|
148
|
+
}, Pe = ({
|
|
149
149
|
initialOpen: e = !1,
|
|
150
150
|
placement: r = "bottom",
|
|
151
|
-
isTriggerClickable:
|
|
151
|
+
isTriggerClickable: n = !1,
|
|
152
152
|
open: s,
|
|
153
153
|
onOpenChange: o
|
|
154
154
|
} = {}) => {
|
|
155
|
-
const [a, l] =
|
|
155
|
+
const [a, l] = z(e), i = oe(null), c = s ?? a, f = o ?? l, u = de({
|
|
156
156
|
placement: r,
|
|
157
157
|
open: c,
|
|
158
158
|
onOpenChange: f,
|
|
159
|
-
whileElementsMounted:
|
|
159
|
+
whileElementsMounted: he,
|
|
160
160
|
middleware: [
|
|
161
|
-
|
|
162
|
-
|
|
161
|
+
ue(Fe + Se),
|
|
162
|
+
me({
|
|
163
163
|
crossAxis: r.includes("-"),
|
|
164
164
|
fallbackAxisSideDirection: "start",
|
|
165
165
|
padding: 5
|
|
166
166
|
}),
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
fe({ padding: 5 }),
|
|
168
|
+
pe({
|
|
169
169
|
element: i
|
|
170
170
|
})
|
|
171
171
|
]
|
|
172
|
-
}),
|
|
172
|
+
}), h = be(u.context, {
|
|
173
173
|
move: !1,
|
|
174
174
|
enabled: s == null,
|
|
175
|
-
mouseOnly:
|
|
175
|
+
mouseOnly: n,
|
|
176
176
|
delay: { open: 500, close: 0 }
|
|
177
|
-
}),
|
|
177
|
+
}), N = ge(u.context, {
|
|
178
178
|
enabled: s == null
|
|
179
|
-
}),
|
|
180
|
-
return
|
|
179
|
+
}), F = xe(u.context), g = ye(u.context, { role: "tooltip" }), b = Ce([h, N, F, g]);
|
|
180
|
+
return ae(
|
|
181
181
|
() => ({
|
|
182
182
|
open: c,
|
|
183
183
|
setOpen: f,
|
|
184
184
|
arrowRef: i,
|
|
185
|
-
...
|
|
185
|
+
...b,
|
|
186
186
|
...u
|
|
187
187
|
}),
|
|
188
|
-
[c, f,
|
|
188
|
+
[c, f, b, u]
|
|
189
189
|
);
|
|
190
|
-
},
|
|
190
|
+
}, Ae = ({
|
|
191
191
|
children: e,
|
|
192
192
|
...r
|
|
193
193
|
}) => {
|
|
194
|
-
const
|
|
195
|
-
return /* @__PURE__ */
|
|
196
|
-
},
|
|
197
|
-
const o =
|
|
198
|
-
return o.open ? /* @__PURE__ */
|
|
194
|
+
const n = Pe(r);
|
|
195
|
+
return /* @__PURE__ */ t(W.Provider, { value: n, children: e });
|
|
196
|
+
}, Le = _(function({ style: r, ...n }, s) {
|
|
197
|
+
const o = M(), a = j([o.refs.setFloating, s]);
|
|
198
|
+
return o.open ? /* @__PURE__ */ t(Ne, { id: "tooltip-portal", children: /* @__PURE__ */ m(
|
|
199
199
|
"div",
|
|
200
200
|
{
|
|
201
201
|
ref: a,
|
|
@@ -203,15 +203,15 @@ const ve = {
|
|
|
203
203
|
...o.floatingStyles,
|
|
204
204
|
...r
|
|
205
205
|
},
|
|
206
|
-
...o.getFloatingProps(
|
|
206
|
+
...o.getFloatingProps(n),
|
|
207
207
|
className: d(
|
|
208
208
|
"z-[55] whitespace-pre-wrap rounded border border-primary bg-blackout px-2 py-1 dial-tiny shadow max-w-[300px]",
|
|
209
|
-
o.getFloatingProps(
|
|
209
|
+
o.getFloatingProps(n).className
|
|
210
210
|
),
|
|
211
211
|
children: [
|
|
212
|
-
|
|
213
|
-
/* @__PURE__ */
|
|
214
|
-
|
|
212
|
+
n.children,
|
|
213
|
+
/* @__PURE__ */ t(
|
|
214
|
+
we,
|
|
215
215
|
{
|
|
216
216
|
ref: o.arrowRef,
|
|
217
217
|
context: o.context,
|
|
@@ -223,16 +223,16 @@ const ve = {
|
|
|
223
223
|
]
|
|
224
224
|
}
|
|
225
225
|
) }) : null;
|
|
226
|
-
}),
|
|
227
|
-
const a =
|
|
228
|
-
return
|
|
226
|
+
}), Oe = _(function({ children: r, asChild: n = !1, ...s }, o) {
|
|
227
|
+
const a = M(), i = r && typeof r == "object" && "ref" in r && r.ref !== void 0 ? r.ref : void 0, c = j([a.refs.setReference, o, i]);
|
|
228
|
+
return n && ie(r) ? ce(
|
|
229
229
|
r,
|
|
230
230
|
a.getReferenceProps({
|
|
231
231
|
ref: c,
|
|
232
232
|
...s,
|
|
233
233
|
...r.props
|
|
234
234
|
})
|
|
235
|
-
) : /* @__PURE__ */
|
|
235
|
+
) : /* @__PURE__ */ t(
|
|
236
236
|
"span",
|
|
237
237
|
{
|
|
238
238
|
ref: c,
|
|
@@ -244,14 +244,14 @@ const ve = {
|
|
|
244
244
|
}), I = ({
|
|
245
245
|
hideTooltip: e,
|
|
246
246
|
tooltip: r,
|
|
247
|
-
children:
|
|
247
|
+
children: n,
|
|
248
248
|
triggerClassName: s,
|
|
249
249
|
contentClassName: o,
|
|
250
250
|
...a
|
|
251
|
-
}) => e || !r ? /* @__PURE__ */
|
|
252
|
-
/* @__PURE__ */
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
|
|
251
|
+
}) => e || !r ? /* @__PURE__ */ t("span", { className: s, children: n }) : /* @__PURE__ */ m(Ae, { ...a, children: [
|
|
252
|
+
/* @__PURE__ */ t(Oe, { className: d(s, "truncate"), children: n }),
|
|
253
|
+
/* @__PURE__ */ t(
|
|
254
|
+
Le,
|
|
255
255
|
{
|
|
256
256
|
className: d(
|
|
257
257
|
"text-primary",
|
|
@@ -262,42 +262,42 @@ const ve = {
|
|
|
262
262
|
children: r
|
|
263
263
|
}
|
|
264
264
|
)
|
|
265
|
-
] }),
|
|
266
|
-
size:
|
|
265
|
+
] }), Ve = 18, T = {
|
|
266
|
+
size: Ve,
|
|
267
267
|
stroke: 2
|
|
268
|
-
},
|
|
268
|
+
}, rr = ({
|
|
269
269
|
label: e,
|
|
270
270
|
id: r,
|
|
271
|
-
checked:
|
|
271
|
+
checked: n,
|
|
272
272
|
indeterminate: s,
|
|
273
273
|
disabled: o,
|
|
274
274
|
ariaLabel: a,
|
|
275
275
|
onChange: l
|
|
276
276
|
}) => {
|
|
277
|
-
const i =
|
|
277
|
+
const i = S(
|
|
278
278
|
(u) => {
|
|
279
279
|
u.stopPropagation(), l?.(u.target.checked, r);
|
|
280
280
|
},
|
|
281
281
|
[l, r]
|
|
282
282
|
), c = d(
|
|
283
283
|
"flex flex-row items-center cursor-pointer text-accent-primary small-medium flex-1 min-w-0",
|
|
284
|
-
`${
|
|
284
|
+
`${n ? "" : 'before:content-[""] before:inline-block before:w-[18px] before:h-[18px] before:border before:border-hover before:rounded before:mr-2'}`,
|
|
285
285
|
o ? "pointer-events-none text-secondary before:border-icon-secondary before:bg-layer-4" : ""
|
|
286
286
|
), f = d(
|
|
287
287
|
"mr-2 border rounded",
|
|
288
288
|
o ? "bg-layer-4 border-icon-secondary" : ""
|
|
289
289
|
);
|
|
290
290
|
return /* @__PURE__ */ m("label", { className: c, htmlFor: r, children: [
|
|
291
|
-
|
|
292
|
-
e && /* @__PURE__ */
|
|
293
|
-
/* @__PURE__ */
|
|
291
|
+
n && (s ? /* @__PURE__ */ t(ee, { className: f, ...T }) : /* @__PURE__ */ t(V, { className: f, ...T })),
|
|
292
|
+
e && /* @__PURE__ */ t(I, { tooltip: e, triggerClassName: "flex-1 min-w-0", children: /* @__PURE__ */ t("p", { className: "text-primary w-full truncate", children: e }) }),
|
|
293
|
+
/* @__PURE__ */ t(
|
|
294
294
|
"input",
|
|
295
295
|
{
|
|
296
296
|
type: "checkbox",
|
|
297
297
|
onChange: i,
|
|
298
298
|
id: r,
|
|
299
|
-
checked:
|
|
300
|
-
"aria-checked": s ? "mixed" :
|
|
299
|
+
checked: n,
|
|
300
|
+
"aria-checked": s ? "mixed" : n,
|
|
301
301
|
"aria-disabled": o || void 0,
|
|
302
302
|
"aria-label": e ? void 0 : a,
|
|
303
303
|
className: "invisible w-0 h-0"
|
|
@@ -306,7 +306,7 @@ const ve = {
|
|
|
306
306
|
] });
|
|
307
307
|
};
|
|
308
308
|
var p = /* @__PURE__ */ ((e) => (e.VALID = "valid", e.ERROR = "error", e))(p || {});
|
|
309
|
-
const
|
|
309
|
+
const ze = (e, r) => {
|
|
310
310
|
if (r === e.id)
|
|
311
311
|
switch (e.status) {
|
|
312
312
|
case p.VALID:
|
|
@@ -324,7 +324,7 @@ const Oe = (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 p.VALID:
|
|
@@ -342,63 +342,63 @@ const Oe = (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
|
-
currentStep:
|
|
349
|
-
|
|
348
|
+
currentStep: n,
|
|
349
|
+
onChangeStep: s
|
|
350
350
|
}) => {
|
|
351
|
-
const o = "h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer", a = "w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white", l = () =>
|
|
351
|
+
const o = "h-[32px] flex flex-1 min-w-[180px] items-center dial-tiny border-t-2 cursor-pointer", a = "w-[22px] h-[22px] flex justify-center items-center mr-2 rounded-full text-white", l = () => n === e.id && e.status === p.ERROR ? /* @__PURE__ */ t(re, { stroke: 2, size: 16 }) : n !== e.id && e.status === p.VALID ? /* @__PURE__ */ t(V, { stroke: 2, size: 16 }) : r + 1;
|
|
352
352
|
return /* @__PURE__ */ m(
|
|
353
353
|
"button",
|
|
354
354
|
{
|
|
355
|
-
className: d(o,
|
|
355
|
+
className: d(o, ze(e, n)),
|
|
356
356
|
onClick: () => s(e.id),
|
|
357
357
|
children: [
|
|
358
|
-
/* @__PURE__ */
|
|
358
|
+
/* @__PURE__ */ t(
|
|
359
359
|
"span",
|
|
360
360
|
{
|
|
361
|
-
className: d(a,
|
|
361
|
+
className: d(a, _e(e, n)),
|
|
362
362
|
children: l()
|
|
363
363
|
}
|
|
364
364
|
),
|
|
365
|
-
/* @__PURE__ */
|
|
365
|
+
/* @__PURE__ */ t("span", { children: e.name })
|
|
366
366
|
]
|
|
367
367
|
}
|
|
368
368
|
);
|
|
369
|
-
},
|
|
369
|
+
}, tr = ({
|
|
370
370
|
steps: e,
|
|
371
371
|
currentStep: r,
|
|
372
|
-
|
|
372
|
+
onChangeStep: n
|
|
373
373
|
}) => {
|
|
374
374
|
const s = (o) => {
|
|
375
375
|
const a = e.findIndex((i) => i.id === r), l = e.findIndex((i) => i.id === o);
|
|
376
|
-
(o !== r && e[a].status === p.VALID || l < a) &&
|
|
376
|
+
(o !== r && e[a].status === p.VALID || l < a) && n(o);
|
|
377
377
|
};
|
|
378
|
-
return /* @__PURE__ */
|
|
379
|
-
|
|
378
|
+
return /* @__PURE__ */ t("div", { id: "steps", className: "flex gap-x-3", children: e.map((o, a) => /* @__PURE__ */ t(
|
|
379
|
+
je,
|
|
380
380
|
{
|
|
381
381
|
currentStep: r,
|
|
382
|
-
|
|
382
|
+
onChangeStep: s,
|
|
383
383
|
step: o,
|
|
384
384
|
index: a
|
|
385
385
|
},
|
|
386
386
|
o.id
|
|
387
387
|
)) });
|
|
388
|
-
},
|
|
388
|
+
}, We = ({
|
|
389
389
|
value: e,
|
|
390
390
|
textareaId: r,
|
|
391
|
-
placeholder:
|
|
391
|
+
placeholder: n,
|
|
392
392
|
cssClass: s = "",
|
|
393
393
|
disabled: o,
|
|
394
394
|
invalid: a,
|
|
395
395
|
readonly: l,
|
|
396
396
|
onChange: i
|
|
397
|
-
}) => /* @__PURE__ */
|
|
397
|
+
}) => /* @__PURE__ */ t(I, { tooltip: e, triggerClassName: "flex", children: /* @__PURE__ */ t(
|
|
398
398
|
"textarea",
|
|
399
399
|
{
|
|
400
400
|
id: r,
|
|
401
|
-
placeholder:
|
|
401
|
+
placeholder: n,
|
|
402
402
|
value: e || "",
|
|
403
403
|
disabled: o,
|
|
404
404
|
className: d(
|
|
@@ -410,7 +410,7 @@ const Oe = (e, r) => {
|
|
|
410
410
|
),
|
|
411
411
|
onChange: (c) => !l && i?.(c.currentTarget.value)
|
|
412
412
|
}
|
|
413
|
-
) }),
|
|
413
|
+
) }), Me = [
|
|
414
414
|
"ArrowLeft",
|
|
415
415
|
"ArrowRight",
|
|
416
416
|
"ArrowUp",
|
|
@@ -422,16 +422,16 @@ const Oe = (e, r) => {
|
|
|
422
422
|
"Escape",
|
|
423
423
|
"Home",
|
|
424
424
|
"End"
|
|
425
|
-
],
|
|
426
|
-
if ((r === "number" ||
|
|
425
|
+
], He = (e, r, n, s) => {
|
|
426
|
+
if ((r === "number" || n !== void 0 || s !== void 0) && !Me.includes(e.key) && !(e.key === "-" && e.currentTarget.selectionStart === 0 && (n === void 0 || n < 0)) && !(e.key === "." && r === "number" && !e.currentTarget.value.includes("."))) {
|
|
427
427
|
if (!/^[0-9]$/.test(e.key)) {
|
|
428
428
|
e.preventDefault();
|
|
429
429
|
return;
|
|
430
430
|
}
|
|
431
|
-
if (
|
|
431
|
+
if (n !== void 0 || s !== void 0) {
|
|
432
432
|
const a = e.currentTarget.value, l = e.currentTarget.selectionStart || 0, i = a.slice(0, l) + e.key + a.slice(l), c = parseFloat(i);
|
|
433
433
|
if (!isNaN(c)) {
|
|
434
|
-
if (
|
|
434
|
+
if (n !== void 0 && c < n) {
|
|
435
435
|
e.preventDefault();
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
@@ -445,7 +445,7 @@ const Oe = (e, r) => {
|
|
|
445
445
|
}, E = ({
|
|
446
446
|
iconBeforeInput: e,
|
|
447
447
|
iconAfterInput: r,
|
|
448
|
-
hideBorder:
|
|
448
|
+
hideBorder: n,
|
|
449
449
|
value: s,
|
|
450
450
|
elementId: o,
|
|
451
451
|
placeholder: a = "",
|
|
@@ -454,42 +454,42 @@ const Oe = (e, r) => {
|
|
|
454
454
|
tooltipTriggerClassName: c,
|
|
455
455
|
type: f = "text",
|
|
456
456
|
disabled: u,
|
|
457
|
-
readonly:
|
|
458
|
-
invalid:
|
|
459
|
-
onChange:
|
|
457
|
+
readonly: h,
|
|
458
|
+
invalid: N,
|
|
459
|
+
onChange: F,
|
|
460
460
|
min: g,
|
|
461
|
-
max:
|
|
462
|
-
prefix:
|
|
463
|
-
suffix:
|
|
461
|
+
max: b,
|
|
462
|
+
prefix: L,
|
|
463
|
+
suffix: O,
|
|
464
464
|
textBeforeInput: w,
|
|
465
465
|
textAfterInput: v
|
|
466
466
|
}) => {
|
|
467
|
-
const B = (x) => x.target.blur(),
|
|
468
|
-
|
|
469
|
-
},
|
|
467
|
+
const B = (x) => x.target.blur(), U = f === "number" || g !== void 0 || b !== void 0, K = (x) => {
|
|
468
|
+
He(x, f, g, b);
|
|
469
|
+
}, $ = (x) => {
|
|
470
470
|
const D = x.currentTarget.value;
|
|
471
|
-
if (
|
|
471
|
+
if (U && D !== "") {
|
|
472
472
|
const R = parseFloat(D);
|
|
473
|
-
if (isNaN(R) && D !== "-" && D !== "." || !isNaN(R) && (g !== void 0 && R < g ||
|
|
473
|
+
if (isNaN(R) && D !== "-" && D !== "." || !isNaN(R) && (g !== void 0 && R < g || b !== void 0 && R > b))
|
|
474
474
|
return;
|
|
475
475
|
}
|
|
476
|
-
|
|
476
|
+
F?.(D);
|
|
477
477
|
};
|
|
478
478
|
return /* @__PURE__ */ m(
|
|
479
479
|
"div",
|
|
480
480
|
{
|
|
481
481
|
className: d(
|
|
482
482
|
"dial-input-field flex flex-row items-center justify-between",
|
|
483
|
-
|
|
484
|
-
|
|
483
|
+
n ? "dial-input-no-border" : "dial-input",
|
|
484
|
+
N && "dial-input-error",
|
|
485
485
|
u && "dial-input-disable",
|
|
486
|
-
|
|
486
|
+
h && "dial-input-readonly",
|
|
487
487
|
!w && "pl-1",
|
|
488
488
|
!v && "pr-1",
|
|
489
489
|
i
|
|
490
490
|
),
|
|
491
491
|
children: [
|
|
492
|
-
w && /* @__PURE__ */
|
|
492
|
+
w && /* @__PURE__ */ t(I, { tooltip: w, children: /* @__PURE__ */ t(
|
|
493
493
|
E,
|
|
494
494
|
{
|
|
495
495
|
hideBorder: !0,
|
|
@@ -500,12 +500,12 @@ const Oe = (e, r) => {
|
|
|
500
500
|
elementId: w + "textBefore"
|
|
501
501
|
}
|
|
502
502
|
) }),
|
|
503
|
-
|
|
503
|
+
L && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pl-2", children: [
|
|
504
504
|
" ",
|
|
505
|
-
|
|
505
|
+
L
|
|
506
506
|
] }),
|
|
507
|
-
/* @__PURE__ */
|
|
508
|
-
/* @__PURE__ */
|
|
507
|
+
/* @__PURE__ */ t(C, { icon: e, className: "pl-2" }),
|
|
508
|
+
/* @__PURE__ */ t(I, { tooltip: s, triggerClassName: c, children: /* @__PURE__ */ t(
|
|
509
509
|
"input",
|
|
510
510
|
{
|
|
511
511
|
type: f,
|
|
@@ -516,19 +516,19 @@ const Oe = (e, r) => {
|
|
|
516
516
|
title: s ? String(s) : "",
|
|
517
517
|
disabled: u,
|
|
518
518
|
className: d("border-0 bg-transparent px-2", l),
|
|
519
|
-
onChange: (x) => !
|
|
520
|
-
onKeyDown:
|
|
519
|
+
onChange: (x) => !h && $?.(x),
|
|
520
|
+
onKeyDown: K,
|
|
521
521
|
onWheel: B,
|
|
522
522
|
min: g,
|
|
523
|
-
max:
|
|
523
|
+
max: b
|
|
524
524
|
}
|
|
525
525
|
) }),
|
|
526
|
-
/* @__PURE__ */
|
|
527
|
-
|
|
526
|
+
/* @__PURE__ */ t(C, { icon: r, className: "pr-2" }),
|
|
527
|
+
O && /* @__PURE__ */ m("p", { className: "text-secondary dial-small pr-2", children: [
|
|
528
528
|
" ",
|
|
529
|
-
|
|
529
|
+
O
|
|
530
530
|
] }),
|
|
531
|
-
v && /* @__PURE__ */
|
|
531
|
+
v && /* @__PURE__ */ t(I, { tooltip: v, children: /* @__PURE__ */ t(
|
|
532
532
|
E,
|
|
533
533
|
{
|
|
534
534
|
hideBorder: !0,
|
|
@@ -542,10 +542,10 @@ const Oe = (e, r) => {
|
|
|
542
542
|
]
|
|
543
543
|
}
|
|
544
544
|
);
|
|
545
|
-
},
|
|
545
|
+
}, Be = /^0+\.(\d+)?$/, Ue = /^0+/, H = ({
|
|
546
546
|
fieldTitle: e,
|
|
547
547
|
errorText: r,
|
|
548
|
-
optional:
|
|
548
|
+
optional: n,
|
|
549
549
|
elementCssClass: s,
|
|
550
550
|
elementContainerCssClass: o,
|
|
551
551
|
elementId: a,
|
|
@@ -554,18 +554,18 @@ const Oe = (e, r) => {
|
|
|
554
554
|
defaultEmptyText: c,
|
|
555
555
|
min: f,
|
|
556
556
|
max: u,
|
|
557
|
-
...
|
|
557
|
+
...h
|
|
558
558
|
}) => /* @__PURE__ */ m("div", { className: d("flex flex-col", l), children: [
|
|
559
|
-
/* @__PURE__ */
|
|
560
|
-
|
|
559
|
+
/* @__PURE__ */ t(
|
|
560
|
+
A,
|
|
561
561
|
{
|
|
562
562
|
fieldTitle: e,
|
|
563
|
-
optional:
|
|
563
|
+
optional: n,
|
|
564
564
|
htmlFor: a
|
|
565
565
|
}
|
|
566
566
|
),
|
|
567
|
-
i ? /* @__PURE__ */
|
|
568
|
-
/* @__PURE__ */
|
|
567
|
+
i ? /* @__PURE__ */ t("span", { children: h.value || (c ?? "None") }) : /* @__PURE__ */ m(G, { children: [
|
|
568
|
+
/* @__PURE__ */ t(
|
|
569
569
|
E,
|
|
570
570
|
{
|
|
571
571
|
elementId: a,
|
|
@@ -574,85 +574,85 @@ const Oe = (e, r) => {
|
|
|
574
574
|
invalid: r != null,
|
|
575
575
|
min: f,
|
|
576
576
|
max: u,
|
|
577
|
-
...
|
|
577
|
+
...h
|
|
578
578
|
}
|
|
579
579
|
),
|
|
580
|
-
/* @__PURE__ */
|
|
580
|
+
/* @__PURE__ */ t(P, { errorText: r })
|
|
581
581
|
] })
|
|
582
|
-
] }),
|
|
582
|
+
] }), nr = ({
|
|
583
583
|
onChange: e,
|
|
584
584
|
value: r,
|
|
585
|
-
min:
|
|
585
|
+
min: n,
|
|
586
586
|
max: s,
|
|
587
587
|
...o
|
|
588
588
|
}) => {
|
|
589
|
-
const a = (l) => String(l)?.match(
|
|
590
|
-
return /* @__PURE__ */
|
|
591
|
-
|
|
589
|
+
const a = (l) => String(l)?.match(Be) ? String(l)?.replace(Ue, "0") : Number(l);
|
|
590
|
+
return /* @__PURE__ */ t(
|
|
591
|
+
H,
|
|
592
592
|
{
|
|
593
593
|
type: "number",
|
|
594
594
|
onChange: (l) => e?.(a(l)),
|
|
595
595
|
value: r,
|
|
596
|
-
min:
|
|
596
|
+
min: n,
|
|
597
597
|
max: s,
|
|
598
598
|
...o
|
|
599
599
|
}
|
|
600
600
|
);
|
|
601
|
-
},
|
|
601
|
+
}, sr = ({
|
|
602
602
|
onChange: e,
|
|
603
603
|
...r
|
|
604
|
-
}) => /* @__PURE__ */
|
|
605
|
-
|
|
604
|
+
}) => /* @__PURE__ */ t(
|
|
605
|
+
H,
|
|
606
606
|
{
|
|
607
607
|
type: "text",
|
|
608
|
-
onChange: (
|
|
608
|
+
onChange: (n) => e?.(n),
|
|
609
609
|
...r
|
|
610
610
|
}
|
|
611
|
-
),
|
|
611
|
+
), or = ({
|
|
612
612
|
fieldTitle: e,
|
|
613
613
|
optional: r,
|
|
614
|
-
elementId:
|
|
614
|
+
elementId: n,
|
|
615
615
|
elementCssClass: s,
|
|
616
616
|
errorText: o,
|
|
617
617
|
...a
|
|
618
618
|
}) => /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
|
|
619
|
-
/* @__PURE__ */
|
|
620
|
-
|
|
619
|
+
/* @__PURE__ */ t(
|
|
620
|
+
A,
|
|
621
621
|
{
|
|
622
622
|
fieldTitle: e,
|
|
623
623
|
optional: r,
|
|
624
|
-
htmlFor:
|
|
624
|
+
htmlFor: n
|
|
625
625
|
}
|
|
626
626
|
),
|
|
627
|
-
/* @__PURE__ */
|
|
628
|
-
|
|
627
|
+
/* @__PURE__ */ t(
|
|
628
|
+
We,
|
|
629
629
|
{
|
|
630
|
-
textareaId:
|
|
630
|
+
textareaId: n,
|
|
631
631
|
cssClass: s,
|
|
632
632
|
...a
|
|
633
633
|
}
|
|
634
634
|
),
|
|
635
|
-
/* @__PURE__ */
|
|
636
|
-
] }),
|
|
635
|
+
/* @__PURE__ */ t(P, { errorText: o })
|
|
636
|
+
] }), ar = ({
|
|
637
637
|
title: e,
|
|
638
638
|
switchId: r,
|
|
639
|
-
isOn:
|
|
639
|
+
isOn: n = !1,
|
|
640
640
|
disabled: s,
|
|
641
641
|
onChange: o
|
|
642
642
|
}) => {
|
|
643
643
|
const a = d(
|
|
644
644
|
"flex w-[36px] h-[18px] cursor-pointer items-center gap-1 rounded-full p-0.5 transition-all duration-200",
|
|
645
|
-
|
|
645
|
+
n ? "flex-row-reverse" : "flex-row",
|
|
646
646
|
s ? "pointer-events-none" : "",
|
|
647
|
-
s ?
|
|
648
|
-
), l =
|
|
647
|
+
s ? n ? "bg-controls-disable" : "bg-layer-4" : n ? "bg-accent-primary" : "bg-layer-4"
|
|
648
|
+
), l = S(
|
|
649
649
|
(i) => {
|
|
650
|
-
i.stopPropagation(), o?.(!
|
|
650
|
+
i.stopPropagation(), o?.(!n);
|
|
651
651
|
},
|
|
652
|
-
[o,
|
|
652
|
+
[o, n]
|
|
653
653
|
);
|
|
654
654
|
return /* @__PURE__ */ m("div", { className: "flex flex-row items-center", children: [
|
|
655
|
-
/* @__PURE__ */
|
|
655
|
+
/* @__PURE__ */ t(
|
|
656
656
|
"input",
|
|
657
657
|
{
|
|
658
658
|
type: "checkbox",
|
|
@@ -660,38 +660,85 @@ const Oe = (e, r) => {
|
|
|
660
660
|
id: r,
|
|
661
661
|
disabled: s,
|
|
662
662
|
className: "invisible w-0 h-0",
|
|
663
|
-
checked:
|
|
663
|
+
checked: n
|
|
664
664
|
}
|
|
665
665
|
),
|
|
666
|
-
/* @__PURE__ */
|
|
666
|
+
/* @__PURE__ */ t("label", { htmlFor: r, className: a, children: /* @__PURE__ */ t(
|
|
667
667
|
"span",
|
|
668
668
|
{
|
|
669
669
|
className: d(
|
|
670
670
|
"size-3 rounded-full",
|
|
671
|
-
s ?
|
|
671
|
+
s ? n ? "bg-layer-4" : "bg-controls-disable" : "bg-controls-enable-primary"
|
|
672
672
|
)
|
|
673
673
|
}
|
|
674
674
|
) }),
|
|
675
|
-
e && /* @__PURE__ */
|
|
675
|
+
e && /* @__PURE__ */ t("span", { className: "pl-2 dial-small text-primary", children: e })
|
|
676
676
|
] });
|
|
677
|
-
}
|
|
677
|
+
}, Ke = ({ onClick: e }) => /* @__PURE__ */ t(
|
|
678
|
+
te,
|
|
679
|
+
{
|
|
680
|
+
...T,
|
|
681
|
+
className: "text-primary",
|
|
682
|
+
onClick: e
|
|
683
|
+
}
|
|
684
|
+
), $e = ({ onClick: e }) => /* @__PURE__ */ t(ne, { ...T, className: "text-primary", onClick: e }), Ge = ({ ...e }) => {
|
|
685
|
+
const [r, n] = z(!1), s = S((o) => {
|
|
686
|
+
n(o);
|
|
687
|
+
}, []);
|
|
688
|
+
return /* @__PURE__ */ t(
|
|
689
|
+
E,
|
|
690
|
+
{
|
|
691
|
+
type: r ? "text" : "password",
|
|
692
|
+
...e,
|
|
693
|
+
iconAfterInput: r ? /* @__PURE__ */ t(Ke, { onClick: () => s(!1) }) : /* @__PURE__ */ t($e, { onClick: () => s(!0) })
|
|
694
|
+
}
|
|
695
|
+
);
|
|
696
|
+
}, lr = ({
|
|
697
|
+
fieldTitle: e,
|
|
698
|
+
optional: r,
|
|
699
|
+
elementCssClass: n,
|
|
700
|
+
elementId: s,
|
|
701
|
+
errorText: o,
|
|
702
|
+
...a
|
|
703
|
+
}) => /* @__PURE__ */ m("div", { className: "flex flex-col", children: [
|
|
704
|
+
/* @__PURE__ */ t(
|
|
705
|
+
A,
|
|
706
|
+
{
|
|
707
|
+
fieldTitle: e,
|
|
708
|
+
optional: r,
|
|
709
|
+
htmlFor: s
|
|
710
|
+
}
|
|
711
|
+
),
|
|
712
|
+
/* @__PURE__ */ t(
|
|
713
|
+
Ge,
|
|
714
|
+
{
|
|
715
|
+
cssClass: n,
|
|
716
|
+
elementId: s,
|
|
717
|
+
invalid: !!o,
|
|
718
|
+
...a
|
|
719
|
+
}
|
|
720
|
+
),
|
|
721
|
+
/* @__PURE__ */ t(P, { errorText: o })
|
|
722
|
+
] });
|
|
678
723
|
export {
|
|
679
724
|
y as AlertVariant,
|
|
680
725
|
k as ButtonVariant,
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
726
|
+
Qe as DialAlert,
|
|
727
|
+
De as DialButton,
|
|
728
|
+
rr as DialCheckbox,
|
|
729
|
+
P as DialErrorText,
|
|
730
|
+
A as DialFieldLabel,
|
|
731
|
+
C as DialIcon,
|
|
687
732
|
E as DialInput,
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
733
|
+
er as DialLoader,
|
|
734
|
+
nr as DialNumberInputField,
|
|
735
|
+
Ge as DialPasswordInput,
|
|
736
|
+
lr as DialPasswordInputField,
|
|
737
|
+
tr as DialSteps,
|
|
738
|
+
ar as DialSwitch,
|
|
739
|
+
or as DialTextAreaField,
|
|
740
|
+
sr as DialTextInputField,
|
|
741
|
+
We as DialTextarea,
|
|
695
742
|
I as DialTooltip,
|
|
696
743
|
p as StepStatus
|
|
697
744
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* An icon button component for hiding password input (eye-off icon).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <DialHideIcon onClick={() => setShowPassword(false)} />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param onClick - Callback function called when the icon is clicked
|
|
14
|
+
*/
|
|
15
|
+
export declare const DialHideIcon: FC<Props>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
interface Props {
|
|
3
|
+
onClick: () => void;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* An icon button component for showing password input (eye icon).
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <DialShowIcon onClick={() => setShowPassword(true)} />
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
13
|
+
* @param onClick - Callback function called when the icon is clicked
|
|
14
|
+
*/
|
|
15
|
+
export declare const DialShowIcon: FC<Props>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DialInputProps } from '../Input/Input';
|
|
3
|
+
/**
|
|
4
|
+
* A password input component with show/hide functionality and customizable props.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <DialPasswordInput
|
|
9
|
+
* id="password"
|
|
10
|
+
* label="Password"
|
|
11
|
+
* value={password}
|
|
12
|
+
* onChange={e => setPassword(e.target.value)}
|
|
13
|
+
* disabled={false}
|
|
14
|
+
* />
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @param id - Unique identifier for the input element
|
|
18
|
+
* @param [label] - The label text for the field
|
|
19
|
+
* @param [value] - The current value of the input
|
|
20
|
+
* @param [onChange] - Callback function called when the input value changes
|
|
21
|
+
* @param [disabled=false] - Whether the input is disabled
|
|
22
|
+
* @param [iconAfterInput] - Custom icon to display after the input (overridden by show/hide icons)
|
|
23
|
+
*/
|
|
24
|
+
export declare const DialPasswordInput: FC<DialInputProps>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { DialInputFieldBaseProps } from '../InputField/InputField';
|
|
3
|
+
export interface DialPasswordInputFieldProps extends DialInputFieldBaseProps {
|
|
4
|
+
onChange?: (value: string) => void;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* A password input field component with label, error text, and show/hide functionality.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* <DialPasswordInputField
|
|
12
|
+
* elementId="password"
|
|
13
|
+
* fieldTitle="Password"
|
|
14
|
+
* value={password}
|
|
15
|
+
* onChange={setPassword}
|
|
16
|
+
* errorText={error}
|
|
17
|
+
* optional={false}
|
|
18
|
+
* />
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param elementId - Unique identifier for the input element
|
|
22
|
+
* @param [fieldTitle] - The label text for the field
|
|
23
|
+
* @param [value] - The current value of the input
|
|
24
|
+
* @param [onChange] - Callback function called when the input value changes
|
|
25
|
+
* @param [errorText] - Error message to display below the input
|
|
26
|
+
* @param [optional=false] - Whether the field is optional
|
|
27
|
+
* @param [cssClass] - Custom CSS class for the input element
|
|
28
|
+
*/
|
|
29
|
+
export declare const DialPasswordInputField: FC<DialPasswordInputFieldProps>;
|
|
@@ -3,7 +3,7 @@ import { Step } from '../../models/step';
|
|
|
3
3
|
export interface DialStepsProps {
|
|
4
4
|
steps: Step[];
|
|
5
5
|
currentStep: string;
|
|
6
|
-
|
|
6
|
+
onChangeStep: (step: string) => void;
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Props for the DialSteps component, which renders a multi-step navigation UI.
|
|
@@ -13,12 +13,12 @@ export interface DialStepsProps {
|
|
|
13
13
|
* <DialSteps
|
|
14
14
|
* steps={[{ id: 'step1', label: 'Step 1', status: StepStatus.VALID }, { id: 'step2', label: 'Step 2', status: StepStatus.ERROR }]}
|
|
15
15
|
* currentStep="step1"
|
|
16
|
-
*
|
|
16
|
+
* onChangeStep={(step) => console.log(step)}
|
|
17
17
|
* />
|
|
18
18
|
* ```
|
|
19
19
|
*
|
|
20
20
|
* @param steps - Array of step objects to display
|
|
21
21
|
* @param currentStep - The id of the currently active step
|
|
22
|
-
* @param
|
|
22
|
+
* @param onChangeStep - Callback to set the current step by id
|
|
23
23
|
*/
|
|
24
24
|
export declare const DialSteps: FC<DialStepsProps>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export { DialSwitch } from './components/Switch/Switch';
|
|
|
13
13
|
export { DialInput } from './components/Input/Input';
|
|
14
14
|
export { DialNumberInputField } from './components/InputField/InputField';
|
|
15
15
|
export { DialTextInputField } from './components/InputField/InputField';
|
|
16
|
+
export { DialPasswordInputField } from './components/PasswordInput/PasswordInputField';
|
|
17
|
+
export { DialPasswordInput } from './components/PasswordInput/PasswordInput';
|
|
16
18
|
export { AlertVariant } from './types/alert';
|
|
17
19
|
export { ButtonVariant } from './types/button';
|
|
18
20
|
export { StepStatus } from './models/step';
|