@lax-wp/design-system 0.3.66 → 0.3.68

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.
@@ -1,4 +1,4 @@
1
- import { FC } from "react";
1
+ import { type FC } from "react";
2
2
  import type { LabelType } from "../../data-display/label/Label";
3
3
  /**
4
4
  * Props for the DynamicDataInput component
@@ -8,17 +8,17 @@ export type DynamicDataInputProps = {
8
8
  /** Unique identifier for the input */
9
9
  id: string;
10
10
  /** Label text to display above the input */
11
- label: string;
11
+ label?: string;
12
12
  /** Input type (text, email, password, number, etc.) */
13
- type: string;
13
+ type?: string;
14
14
  /** Placeholder text for the input */
15
- placeholder: string;
15
+ placeholder?: string;
16
16
  /** Current value of the input (JSON string for dynamic data) */
17
17
  value: string;
18
18
  /** Callback function called when value changes */
19
19
  onChange: (value: string) => void;
20
20
  /** Error message to display below the input */
21
- errorMessage: string;
21
+ errorMessage?: string;
22
22
  /** Whether to preserve original case in the label */
23
23
  originalCase?: boolean;
24
24
  /** Whether the field is required */
package/dist/index.es.js CHANGED
@@ -25616,13 +25616,13 @@ const UF = ({
25616
25616
  ), sM = (e) => {
25617
25617
  const {
25618
25618
  id: t,
25619
- label: n,
25620
- type: r,
25621
- placeholder: i,
25619
+ label: n = "",
25620
+ type: r = "text",
25621
+ placeholder: i = "",
25622
25622
  value: l,
25623
25623
  onChange: o,
25624
25624
  originalCase: s = !1,
25625
- errorMessage: c,
25625
+ errorMessage: c = "",
25626
25626
  required: u,
25627
25627
  bg: d,
25628
25628
  tags: h,
package/dist/index.umd.js CHANGED
@@ -140,7 +140,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
140
140
  `),Q=Q.split(`
141
141
  `).map(oe=>oe.trimEnd()).join(`
142
142
  `),Q=Q.replace(/\n+$/,"")+`
143
- `),navigator?.clipboard?.writeText(Q).then(()=>{}).catch(oe=>{const Ce=oe;Fe.error(Ce?.message||Xt.copyFailure("Python Code"),{toastId:Xt.copyFailure("Python Code")})})}catch(Q){const oe=Q;Fe.error(oe?.message||Xt.copyFailure("Python Code"),{toastId:Xt.copyFailure("Python Code")})}else if(o==="json")try{const Q=JSON.parse(e),oe=JSON.stringify(Q,null,4);navigator?.clipboard?.writeText(oe)}catch(Q){const oe=Q;Fe.error(oe?.message||Xt.copyFailure("JSON Code"),{toastId:Xt.copyFailure("JSON Code")})}else navigator?.clipboard?.writeText(e)},ee=Q=>Q==="python"?{type:"text/x-python",extension:"py"}:Q==="json"?{type:"application/json",extension:"json"}:{type:"text/plain",extension:"txt"},be=(Q,oe)=>Q.replace(/[<>:"/\\|?*\x00-\x1f]/g,"_").replace(/\.{2,}/g,".").replace(/^\.+|\.+$/g,"").trim()||oe,je=()=>{try{const Q=new Blob([e],{type:ee(o)?.type}),oe=URL.createObjectURL(Q),Ce=document.createElement("a");Ce.href=oe;const Qe=ee(o)?.extension||"txt",Re=be(Qe,"txt");Ce.download=be(`code_${Date.now()}.${Re}`,`code_${Date.now()}.${Re}`),document.body.appendChild(Ce),Ce.click(),document.body.removeChild(Ce),URL.revokeObjectURL(oe)}catch(Q){const oe=Q;Fe.error(oe?.message||Xt.copyFailure("Code download"),{toastId:Xt.copyFailure("Code download")})}};return f.jsx(FF,{handle:V,className:"h-full",children:f.jsxs("div",{className:"relative border border-neutral-200 dark:border-neutral-700 rounded-lg h-full",id:"code-editor-container-with-json-grid",children:[f.jsxs("div",{className:Y(`px-3 py-2 flex items-center bg-white rounded-t-lg dark:bg-neutral-800 ${h?"border-none":"border-b border-neutral-200 dark:border-neutral-700"} `,X?"justify-between":"justify-end"),children:[X&&h&&f.jsx($m,{variant:"switch",tabs:Wm,activeTab:A,size:"sm",onTabClick:Q=>$(Q),tabIcons:GF,height:"h-[20px]"}),f.jsxs("div",{className:"flex items-center gap-0.5",children:[A==="Grid"&&i&&h&&f.jsx("span",{className:"flex items-center justify-center border-r border-neutral-200 dark:border-neutral-700 mr-1.5 pr-1.5",children:f.jsx(et,{title:"Add key",children:f.jsx("button",{id:"btn-code-editor-json-grid-up",onClick:()=>D(!0),className:Y("p-0.5 rounded-md flex items-center justify-center","hover:bg-blue-100 hover:dark:bg-neutral-800 text-blue-600 dark:text-neutral-100"),children:f.jsx(DF,{fontSize:16})})})}),A==="Grid"?f.jsxs(f.Fragment,{children:[f.jsx(et,{title:"Collapse all",children:f.jsx("button",{id:"btn-code-editor-json-grid-up",onClick:()=>I(!1),className:J,children:f.jsx(PF,{fontSize:16})})}),f.jsx(et,{title:"Expand all",children:f.jsx("button",{id:"btn-code-editor-json-grid-down",onClick:()=>I(!0),className:J,children:f.jsx(jF,{fontSize:16})})})]}):null,A==="JSON"&&h?f.jsx(et,{title:"Format",children:f.jsx("button",{id:"btn-code-editor-format-code",onClick:ue,className:J,children:f.jsx(VF,{fontSize:14})})}):null,r&&A==="JSON"&&h?f.jsx(et,{title:M==="vs"?"Dark mode":"Light mode",children:f.jsx("button",{id:"btn-code-editor-with-theme",onClick:()=>w(M==="vs"?"vs-dark":"vs"),className:J,children:M==="vs"?f.jsx(TF,{fontSize:14}):f.jsx(OF,{fontSize:14})})}):null,(o==="python"||o==="json")&&u?f.jsx(et,{title:"Copy",children:f.jsx("button",{id:"btn-code-editor-copy-code",onClick:fe,className:J,children:f.jsx(LF,{fontSize:14})})}):null,(o==="python"||o==="json")&&c?f.jsx(et,{title:"Download",children:f.jsx("button",{id:"btn-code-editor-download-code",onClick:je,className:J,children:f.jsx(BF,{fontSize:14})})}):null,n?f.jsx(et,{title:"Fullscreen",children:f.jsx("button",{onClick:K,id:"btn-code-editor-fullscreen",className:J,children:f.jsx(HF,{fontSize:14})})}):null]})]}),A==="Grid"&&o==="json"?f.jsx("div",{children:f.jsx(_m,{isFullScreen:V?.active,allExpanded:z,toggleAll:()=>I(Q=>!Q),isEditMode:!!i,isDarkMode:E==="dark",style:{height:V?.active?"100vh":a},value:e,onChange:t,setIsAddKeyModalOpen:D,isAddKeyModalOpen:W})}):f.jsx(yz,{height:V?.active?"100vh":a,containerStyle:{height:a},language:o,value:e,onChange:U,theme:M,onMount:ae,options:{fontSize:16,folding:!0,fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontLigatures:!0,readOnly:!i}})]})})},Xm=({isVisible:e,onClose:t,onChange:n,defaultValue:r,title:i="Dynamic Data",saveText:a="Save",width:o=1040})=>{const[s,u]=l.useState(r);l.useEffect(()=>{u(r)},[e,r]);const c=()=>{t()},d=()=>{try{const p=JSON.parse(s);n(JSON.stringify(p)),t()}catch(p){const g=p instanceof Error?p.message:"Invalid JSON";Fe.error(g,{toastId:"Invalid JSON"})}},h=p=>{u(p)},m=f.jsx("div",{className:"flex justify-end mt-4",children:f.jsx(Kt,{id:"btn-dynamic-data-modal-save",status:"primary",onClick:d,type:"submit",children:a})},"submit");return f.jsx(Vn,{asForm:!0,title:i,open:e,onCancel:c,width:o,className:"no-body-padding-modal",footer:m,children:f.jsx("div",{className:"h-[calc(100vh-400px)] overflow-y-auto bg-neutral-50 dark:bg-black-800 px-6",children:f.jsx("div",{className:"py-5 w-full overflow-x-auto",children:f.jsx("div",{className:"border rounded-lg",children:f.jsx(Um,{height:"420px",value:s,onChange:p=>h(p),isEditMode:!0})})})})})},ss=({fill:e="currentColor",size:t=20,className:n="",...r})=>f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 20 20",fill:e,className:n,...r,children:f.jsx("g",{children:f.jsx("path",{d:"M16.0833 7.43749L12.5417 3.93749L13.7083 2.77082C14.0278 2.45138 14.4201 2.29166 14.8854 2.29166C15.3507 2.29166 15.7431 2.45138 16.0625 2.77082L17.2292 3.93749C17.5486 4.25693 17.7153 4.64235 17.7292 5.09374C17.7431 5.54513 17.5903 5.93055 17.2708 6.24999L16.0833 7.43749ZM3.33333 17.5C3.09722 17.5 2.89931 17.4201 2.73958 17.2604C2.57986 17.1007 2.5 16.9028 2.5 16.6667V14.3125C2.5 14.2014 2.52083 14.0937 2.5625 13.9896C2.60417 13.8854 2.66667 13.7917 2.75 13.7083L11.3333 5.12499L14.875 8.66666L6.29167 17.25C6.20833 17.3333 6.11458 17.3958 6.01042 17.4375C5.90625 17.4792 5.79861 17.5 5.6875 17.5H3.33333Z"})})}),Zm=e=>{const{id:t,label:n,type:r,placeholder:i,value:a,onChange:o,originalCase:s=!1,errorMessage:u,required:c,bg:d,tags:h,index:m,className:p,tooltip:g="",simpleMode:b,inputFieldClassName:v,isAiExtracted:x=!1,disabled:y=!1,...C}=e,[M,E]=l.useState(null),[w,z]=l.useState(!1),I=l.useRef(null);l.useEffect(()=>{E(null)},[m]),l.useEffect(()=>{M!==null&&o(M)},[M,o]);const k=()=>{z(!w)},F=N=>{E(N),k()};return f.jsxs(f.Fragment,{children:[b?f.jsxs("div",{className:"relative w-full h-full",children:[f.jsx("input",{type:r,placeholder:i,className:v,onChange:N=>{o(N.target.value)},ref:I,value:a?"{DYNAMIC}":"",disabled:!0,...C}),f.jsx("button",{id:"btn-dynamic-data-input-edit",onClick:k,className:Y("absolute inset-y-0 right-0 flex items-center px-4 focus:border-transparent border-l",y?"cursor-not-allowed":""),disabled:y,type:"button",children:f.jsx(ss,{})})]}):f.jsxs("div",{className:Y("flex flex-col w-full",p),children:[f.jsxs("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-black-300 dark:text-black-300 inline-flex items-center gap-1 flex-wrap ${s?"":"capitalize"}`,children:[f.jsxs(se,{size:"extra-small",variant:"medium",appearance:"subtitle",children:[n,c&&f.jsx(Nt,{})]}),x&&f.jsx(rn,{}),f.jsx(St,{labels:h}),g&&f.jsx(et,{placement:"top",title:g,children:f.jsx("div",{className:"cursor-pointer",children:f.jsx(Vt,{})})})]}),f.jsxs("label",{className:"relative block",children:[f.jsx("input",{type:r,id:t,required:c,placeholder:i,className:Y("border",u?"border-red-300 focus:border-red-300":"border-gray-300 dark:border-black-600 focus:border-blue-500 dark:focus:border-primary-400",d,"text-sm rounded-lg block w-full p-2.5 font-inter font-medium",r==="currency"?"pl-8":"","bg-white dark:bg-black-600 text-gray-900 dark:text-black-200"),onChange:N=>{o(N.target.value)},ref:I,value:a?"{DYNAMIC}":"",disabled:!0,autoComplete:"off",...C}),f.jsx("button",{onClick:k,className:"absolute inset-y-0 right-0 flex items-center px-4 focus:border-transparent border-l",type:"button",children:f.jsx(ss,{})})]}),u&&f.jsx(se,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:u})]}),f.jsx(Xm,{isVisible:w,onChange:F,onClose:k,defaultValue:a})]})};Zm.displayName="DynamicDataInput";const Ym=l.forwardRef(({id:e,label:t,value:n,onChange:r,errorMessage:i,defaultValue:a,disabled:o,max:s,min:u,required:c=!1,isRequiredConditional:d=!1,bg:h,tags:m,color:p,className:g,originalCase:b=!1,tooltip:v,simpleMode:x=!1,inputFieldClassName:y="",isAiExtracted:C=!1,isGTN:M=!1,gtnName:E=null,inputStyle:w,withDollarSign:z=!0,labelClassName:I,isLiveField:k=!1,onBlur:F,onAddGTNToDocument:N,riskDetails:B,isRiskAnalysisOpen:H=!1,RiskDetailsCard:L,t:S=V=>V,placeholder:T,...G},O)=>{const[V,A]=l.useState(!1),$=W=>{N&&N({key:E,value:W})};return x?f.jsxs("label",{id:e,className:`mb-1 text-xs font-medium text-gray-600 dark:text-neutral-200 inline-flex items-center gap-1 ${b?"":"capitalize"} ${I||""}`,children:[z&&f.jsx("span",{className:"absolute inset-y-0 left-1 flex items-center pl-3",children:"$"}),f.jsx("input",{...G,ref:O,onBlur:F,type:"number",required:c,className:Y(y,"pl-8 h-[32px]"),onChange:W=>{r(W.target.value)},value:n,...a&&!n?{defaultValue:a}:{},id:e||t,style:w,autoComplete:"off"})]}):f.jsxs("div",{className:Y("flex gap-0.5 relative",V&&M?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),children:[M&&!V?f.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,f.jsxs("div",{className:Y("w-full flex flex-col",g),children:[f.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 dark:text-neutral-300 inline-flex items-center gap-1 ${b?"":"uppercase"} ${I||""}`,children:f.jsxs("div",{className:"w-full flex items-center justify-between flex-wrap",children:[f.jsxs("div",{className:"inline-flex items-center gap-1 flex-wrap dark:text-black-300",children:[f.jsxs(se,{size:"extra-small",variant:"medium",appearance:"subtitle",children:[t,c&&f.jsx(Nt,{isConditional:d})]}),k&&f.jsx(Ue.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),C&&f.jsx(rn,{}),f.jsx(St,{labels:m}),v&&f.jsx(et,{placement:"top",title:v,children:f.jsx("div",{className:"cursor-pointer",children:f.jsx(Vt,{})})})]}),M&&V&&N?f.jsx("button",{id:"btn-percentage-input-add-to-document",className:"cursor-pointer",onClick:()=>$(n?.toString()),type:"button",children:f.jsx(Be.Tooltip,{placement:"top",title:S("Add to document"),children:f.jsx(Ue.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})}),f.jsxs("label",{className:"relative block",children:[f.jsx("input",{...G,ref:O,onBlur:F,type:"number",required:c,disabled:o,min:u,max:s,className:`border ${i?"border-red-300":H&&B?.color?`border-${B.color}-300`:"border-gray-300"} ${h} h-[32px] text-gray-900 dark:bg-black-600 dark:text-neutral-200 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 font-inter font-medium
143
+ `),navigator?.clipboard?.writeText(Q).then(()=>{}).catch(oe=>{const Ce=oe;Fe.error(Ce?.message||Xt.copyFailure("Python Code"),{toastId:Xt.copyFailure("Python Code")})})}catch(Q){const oe=Q;Fe.error(oe?.message||Xt.copyFailure("Python Code"),{toastId:Xt.copyFailure("Python Code")})}else if(o==="json")try{const Q=JSON.parse(e),oe=JSON.stringify(Q,null,4);navigator?.clipboard?.writeText(oe)}catch(Q){const oe=Q;Fe.error(oe?.message||Xt.copyFailure("JSON Code"),{toastId:Xt.copyFailure("JSON Code")})}else navigator?.clipboard?.writeText(e)},ee=Q=>Q==="python"?{type:"text/x-python",extension:"py"}:Q==="json"?{type:"application/json",extension:"json"}:{type:"text/plain",extension:"txt"},be=(Q,oe)=>Q.replace(/[<>:"/\\|?*\x00-\x1f]/g,"_").replace(/\.{2,}/g,".").replace(/^\.+|\.+$/g,"").trim()||oe,je=()=>{try{const Q=new Blob([e],{type:ee(o)?.type}),oe=URL.createObjectURL(Q),Ce=document.createElement("a");Ce.href=oe;const Qe=ee(o)?.extension||"txt",Re=be(Qe,"txt");Ce.download=be(`code_${Date.now()}.${Re}`,`code_${Date.now()}.${Re}`),document.body.appendChild(Ce),Ce.click(),document.body.removeChild(Ce),URL.revokeObjectURL(oe)}catch(Q){const oe=Q;Fe.error(oe?.message||Xt.copyFailure("Code download"),{toastId:Xt.copyFailure("Code download")})}};return f.jsx(FF,{handle:V,className:"h-full",children:f.jsxs("div",{className:"relative border border-neutral-200 dark:border-neutral-700 rounded-lg h-full",id:"code-editor-container-with-json-grid",children:[f.jsxs("div",{className:Y(`px-3 py-2 flex items-center bg-white rounded-t-lg dark:bg-neutral-800 ${h?"border-none":"border-b border-neutral-200 dark:border-neutral-700"} `,X?"justify-between":"justify-end"),children:[X&&h&&f.jsx($m,{variant:"switch",tabs:Wm,activeTab:A,size:"sm",onTabClick:Q=>$(Q),tabIcons:GF,height:"h-[20px]"}),f.jsxs("div",{className:"flex items-center gap-0.5",children:[A==="Grid"&&i&&h&&f.jsx("span",{className:"flex items-center justify-center border-r border-neutral-200 dark:border-neutral-700 mr-1.5 pr-1.5",children:f.jsx(et,{title:"Add key",children:f.jsx("button",{id:"btn-code-editor-json-grid-up",onClick:()=>D(!0),className:Y("p-0.5 rounded-md flex items-center justify-center","hover:bg-blue-100 hover:dark:bg-neutral-800 text-blue-600 dark:text-neutral-100"),children:f.jsx(DF,{fontSize:16})})})}),A==="Grid"?f.jsxs(f.Fragment,{children:[f.jsx(et,{title:"Collapse all",children:f.jsx("button",{id:"btn-code-editor-json-grid-up",onClick:()=>I(!1),className:J,children:f.jsx(PF,{fontSize:16})})}),f.jsx(et,{title:"Expand all",children:f.jsx("button",{id:"btn-code-editor-json-grid-down",onClick:()=>I(!0),className:J,children:f.jsx(jF,{fontSize:16})})})]}):null,A==="JSON"&&h?f.jsx(et,{title:"Format",children:f.jsx("button",{id:"btn-code-editor-format-code",onClick:ue,className:J,children:f.jsx(VF,{fontSize:14})})}):null,r&&A==="JSON"&&h?f.jsx(et,{title:M==="vs"?"Dark mode":"Light mode",children:f.jsx("button",{id:"btn-code-editor-with-theme",onClick:()=>w(M==="vs"?"vs-dark":"vs"),className:J,children:M==="vs"?f.jsx(TF,{fontSize:14}):f.jsx(OF,{fontSize:14})})}):null,(o==="python"||o==="json")&&u?f.jsx(et,{title:"Copy",children:f.jsx("button",{id:"btn-code-editor-copy-code",onClick:fe,className:J,children:f.jsx(LF,{fontSize:14})})}):null,(o==="python"||o==="json")&&c?f.jsx(et,{title:"Download",children:f.jsx("button",{id:"btn-code-editor-download-code",onClick:je,className:J,children:f.jsx(BF,{fontSize:14})})}):null,n?f.jsx(et,{title:"Fullscreen",children:f.jsx("button",{onClick:K,id:"btn-code-editor-fullscreen",className:J,children:f.jsx(HF,{fontSize:14})})}):null]})]}),A==="Grid"&&o==="json"?f.jsx("div",{children:f.jsx(_m,{isFullScreen:V?.active,allExpanded:z,toggleAll:()=>I(Q=>!Q),isEditMode:!!i,isDarkMode:E==="dark",style:{height:V?.active?"100vh":a},value:e,onChange:t,setIsAddKeyModalOpen:D,isAddKeyModalOpen:W})}):f.jsx(yz,{height:V?.active?"100vh":a,containerStyle:{height:a},language:o,value:e,onChange:U,theme:M,onMount:ae,options:{fontSize:16,folding:!0,fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontLigatures:!0,readOnly:!i}})]})})},Xm=({isVisible:e,onClose:t,onChange:n,defaultValue:r,title:i="Dynamic Data",saveText:a="Save",width:o=1040})=>{const[s,u]=l.useState(r);l.useEffect(()=>{u(r)},[e,r]);const c=()=>{t()},d=()=>{try{const p=JSON.parse(s);n(JSON.stringify(p)),t()}catch(p){const g=p instanceof Error?p.message:"Invalid JSON";Fe.error(g,{toastId:"Invalid JSON"})}},h=p=>{u(p)},m=f.jsx("div",{className:"flex justify-end mt-4",children:f.jsx(Kt,{id:"btn-dynamic-data-modal-save",status:"primary",onClick:d,type:"submit",children:a})},"submit");return f.jsx(Vn,{asForm:!0,title:i,open:e,onCancel:c,width:o,className:"no-body-padding-modal",footer:m,children:f.jsx("div",{className:"h-[calc(100vh-400px)] overflow-y-auto bg-neutral-50 dark:bg-black-800 px-6",children:f.jsx("div",{className:"py-5 w-full overflow-x-auto",children:f.jsx("div",{className:"border rounded-lg",children:f.jsx(Um,{height:"420px",value:s,onChange:p=>h(p),isEditMode:!0})})})})})},ss=({fill:e="currentColor",size:t=20,className:n="",...r})=>f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:t,height:t,viewBox:"0 0 20 20",fill:e,className:n,...r,children:f.jsx("g",{children:f.jsx("path",{d:"M16.0833 7.43749L12.5417 3.93749L13.7083 2.77082C14.0278 2.45138 14.4201 2.29166 14.8854 2.29166C15.3507 2.29166 15.7431 2.45138 16.0625 2.77082L17.2292 3.93749C17.5486 4.25693 17.7153 4.64235 17.7292 5.09374C17.7431 5.54513 17.5903 5.93055 17.2708 6.24999L16.0833 7.43749ZM3.33333 17.5C3.09722 17.5 2.89931 17.4201 2.73958 17.2604C2.57986 17.1007 2.5 16.9028 2.5 16.6667V14.3125C2.5 14.2014 2.52083 14.0937 2.5625 13.9896C2.60417 13.8854 2.66667 13.7917 2.75 13.7083L11.3333 5.12499L14.875 8.66666L6.29167 17.25C6.20833 17.3333 6.11458 17.3958 6.01042 17.4375C5.90625 17.4792 5.79861 17.5 5.6875 17.5H3.33333Z"})})}),Zm=e=>{const{id:t,label:n="",type:r="text",placeholder:i="",value:a,onChange:o,originalCase:s=!1,errorMessage:u="",required:c,bg:d,tags:h,index:m,className:p,tooltip:g="",simpleMode:b,inputFieldClassName:v,isAiExtracted:x=!1,disabled:y=!1,...C}=e,[M,E]=l.useState(null),[w,z]=l.useState(!1),I=l.useRef(null);l.useEffect(()=>{E(null)},[m]),l.useEffect(()=>{M!==null&&o(M)},[M,o]);const k=()=>{z(!w)},F=N=>{E(N),k()};return f.jsxs(f.Fragment,{children:[b?f.jsxs("div",{className:"relative w-full h-full",children:[f.jsx("input",{type:r,placeholder:i,className:v,onChange:N=>{o(N.target.value)},ref:I,value:a?"{DYNAMIC}":"",disabled:!0,...C}),f.jsx("button",{id:"btn-dynamic-data-input-edit",onClick:k,className:Y("absolute inset-y-0 right-0 flex items-center px-4 focus:border-transparent border-l",y?"cursor-not-allowed":""),disabled:y,type:"button",children:f.jsx(ss,{})})]}):f.jsxs("div",{className:Y("flex flex-col w-full",p),children:[f.jsxs("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-black-300 dark:text-black-300 inline-flex items-center gap-1 flex-wrap ${s?"":"capitalize"}`,children:[f.jsxs(se,{size:"extra-small",variant:"medium",appearance:"subtitle",children:[n,c&&f.jsx(Nt,{})]}),x&&f.jsx(rn,{}),f.jsx(St,{labels:h}),g&&f.jsx(et,{placement:"top",title:g,children:f.jsx("div",{className:"cursor-pointer",children:f.jsx(Vt,{})})})]}),f.jsxs("label",{className:"relative block",children:[f.jsx("input",{type:r,id:t,required:c,placeholder:i,className:Y("border",u?"border-red-300 focus:border-red-300":"border-gray-300 dark:border-black-600 focus:border-blue-500 dark:focus:border-primary-400",d,"text-sm rounded-lg block w-full p-2.5 font-inter font-medium",r==="currency"?"pl-8":"","bg-white dark:bg-black-600 text-gray-900 dark:text-black-200"),onChange:N=>{o(N.target.value)},ref:I,value:a?"{DYNAMIC}":"",disabled:!0,autoComplete:"off",...C}),f.jsx("button",{onClick:k,className:"absolute inset-y-0 right-0 flex items-center px-4 focus:border-transparent border-l",type:"button",children:f.jsx(ss,{})})]}),u&&f.jsx(se,{className:"text-error-500 mt-1",appearance:"custom",size:"extra-small",variant:"medium",children:u})]}),f.jsx(Xm,{isVisible:w,onChange:F,onClose:k,defaultValue:a})]})};Zm.displayName="DynamicDataInput";const Ym=l.forwardRef(({id:e,label:t,value:n,onChange:r,errorMessage:i,defaultValue:a,disabled:o,max:s,min:u,required:c=!1,isRequiredConditional:d=!1,bg:h,tags:m,color:p,className:g,originalCase:b=!1,tooltip:v,simpleMode:x=!1,inputFieldClassName:y="",isAiExtracted:C=!1,isGTN:M=!1,gtnName:E=null,inputStyle:w,withDollarSign:z=!0,labelClassName:I,isLiveField:k=!1,onBlur:F,onAddGTNToDocument:N,riskDetails:B,isRiskAnalysisOpen:H=!1,RiskDetailsCard:L,t:S=V=>V,placeholder:T,...G},O)=>{const[V,A]=l.useState(!1),$=W=>{N&&N({key:E,value:W})};return x?f.jsxs("label",{id:e,className:`mb-1 text-xs font-medium text-gray-600 dark:text-neutral-200 inline-flex items-center gap-1 ${b?"":"capitalize"} ${I||""}`,children:[z&&f.jsx("span",{className:"absolute inset-y-0 left-1 flex items-center pl-3",children:"$"}),f.jsx("input",{...G,ref:O,onBlur:F,type:"number",required:c,className:Y(y,"pl-8 h-[32px]"),onChange:W=>{r(W.target.value)},value:n,...a&&!n?{defaultValue:a}:{},id:e||t,style:w,autoComplete:"off"})]}):f.jsxs("div",{className:Y("flex gap-0.5 relative",V&&M?"border rounded-lg border-primary-100 bg-primary-50 p-1":""),onMouseEnter:()=>A(!0),onMouseLeave:()=>A(!1),children:[M&&!V?f.jsx("div",{className:"w-1 h-1 bg-primary-600 rounded-full animate-blink mt-1.5"}):null,f.jsxs("div",{className:Y("w-full flex flex-col",g),children:[f.jsx("label",{htmlFor:"text",className:`mb-1 text-xs font-medium text-gray-600 dark:text-neutral-300 inline-flex items-center gap-1 ${b?"":"uppercase"} ${I||""}`,children:f.jsxs("div",{className:"w-full flex items-center justify-between flex-wrap",children:[f.jsxs("div",{className:"inline-flex items-center gap-1 flex-wrap dark:text-black-300",children:[f.jsxs(se,{size:"extra-small",variant:"medium",appearance:"subtitle",children:[t,c&&f.jsx(Nt,{isConditional:d})]}),k&&f.jsx(Ue.BoltOutlined,{sx:{fontSize:16,color:"var(--color-primary-600)",rotate:"15deg"}}),C&&f.jsx(rn,{}),f.jsx(St,{labels:m}),v&&f.jsx(et,{placement:"top",title:v,children:f.jsx("div",{className:"cursor-pointer",children:f.jsx(Vt,{})})})]}),M&&V&&N?f.jsx("button",{id:"btn-percentage-input-add-to-document",className:"cursor-pointer",onClick:()=>$(n?.toString()),type:"button",children:f.jsx(Be.Tooltip,{placement:"top",title:S("Add to document"),children:f.jsx(Ue.NoteAddOutlined,{className:"text-primary-600",sx:{fontSize:16}})})}):null]})}),f.jsxs("label",{className:"relative block",children:[f.jsx("input",{...G,ref:O,onBlur:F,type:"number",required:c,disabled:o,min:u,max:s,className:`border ${i?"border-red-300":H&&B?.color?`border-${B.color}-300`:"border-gray-300"} ${h} h-[32px] text-gray-900 dark:bg-black-600 dark:text-neutral-200 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 font-inter font-medium
144
144
  disabled:bg-neutral-50 dark:disabled:!bg-black-800 dark:disabled:placeholder:!text-black-400
145
145
  ${H&&B?.color&&`bg-${B.color}-50`}
146
146
  ${p||""}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lax-wp/design-system",
3
3
  "private": false,
4
- "version": "0.3.66",
4
+ "version": "0.3.68",
5
5
  "type": "module",
6
6
  "main": "dist/index.umd.js",
7
7
  "module": "dist/index.es.js",