@bikdotai/bik-component-library 0.0.874-beta.0 → 0.0.875-beta.0

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.
Files changed (32) hide show
  1. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js +5 -5
  2. package/dist/cjs/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  3. package/dist/cjs/components/agent-builder/components/HandoverMethodSection.js +2 -0
  4. package/dist/cjs/components/agent-builder/components/HandoverMethodSection.js.map +1 -0
  5. package/dist/cjs/components/agent-builder/components/UndoToast.js +1 -1
  6. package/dist/cjs/components/agent-builder/components/UndoToast.js.map +1 -1
  7. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js +1 -1
  8. package/dist/cjs/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  9. package/dist/cjs/components/dropdown/Dropdown.js +1 -1
  10. package/dist/cjs/components/dropdown/Dropdown.js.map +1 -1
  11. package/dist/cjs/components/input/Input.js +1 -1
  12. package/dist/cjs/components/input/Input.js.map +1 -1
  13. package/dist/cjs/index.js +1 -1
  14. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js +57 -55
  15. package/dist/esm/components/agent-builder/components/ConfigToolPanel.js.map +1 -1
  16. package/dist/esm/components/agent-builder/components/HandoverMethodSection.d.ts +22 -0
  17. package/dist/esm/components/agent-builder/components/HandoverMethodSection.js +109 -0
  18. package/dist/esm/components/agent-builder/components/HandoverMethodSection.js.map +1 -0
  19. package/dist/esm/components/agent-builder/components/UndoToast.js +6 -7
  20. package/dist/esm/components/agent-builder/components/UndoToast.js.map +1 -1
  21. package/dist/esm/components/agent-builder/index.d.ts +3 -1
  22. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.d.ts +3 -2
  23. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js +31 -117
  24. package/dist/esm/components/agent-builder/steps/Step4HandoverRules.js.map +1 -1
  25. package/dist/esm/components/dropdown/Dropdown.js +14 -12
  26. package/dist/esm/components/dropdown/Dropdown.js.map +1 -1
  27. package/dist/esm/components/input/Input.js +40 -38
  28. package/dist/esm/components/input/Input.js.map +1 -1
  29. package/dist/esm/components/input/Input.model.d.ts +3 -0
  30. package/dist/esm/index.js +318 -314
  31. package/dist/esm/index.js.map +1 -1
  32. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),A=require("../../../assets/icons/cross.svg.js"),c=require("react"),$=require("styled-components"),O=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),F=require("../AgentBuilder.styled.js"),D=require("../constants/charLimits.js"),I=require("./DrawerHeaderText.js"),P=require("./ToolInstructionsField.js"),q=require("./VariableTriggerArea.js"),Y=require("../../side-modal/SideModal.js"),V=require("../../switch/Switch.js"),M=require("../../input/Input.js"),G=require("../../tag/Tag.js"),B=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},z=B(c),C=B($),H={send_email:{title:"Send email",subtitle:"Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message."},send_slack_message:{title:"Send Slack message",subtitle:"Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation."},google_sheet_get_data:{title:"Get data from sheet",subtitle:"Look up rows in a Google Sheet. You pick the sheet and describe its columns, the AI writes the query it needs."},google_sheet_add_row:{title:"Add row to sheet",subtitle:"Append a row to a Google Sheet. You pick the sheet and its columns, the AI fills them in from the conversation."}},W=({chips:t,onChange:a,placeholder:m,nativeID:y,hint:R,variablesData:w})=>{const[i,f]=c.useState(""),[j,s]=c.useState(!1),b=c.useRef(null),T=c.useRef(null),k=()=>{const n=i.split(",").map(l=>l.trim()).filter(Boolean);n.length&&a([...t,...n.filter(l=>!t.includes(l))]),f("")},x=c.useRef(k);x.current=k;const v=c.useRef(!1),u=c.useRef(!1);return r.jsxs(Q,{ref:b,children:[r.jsx(q.VariableTriggerArea,{addDataButton:!0,variablesData:w,onOpenChange:n=>{v.current=n,!n&&setTimeout(()=>{!u.current&&!b.current?.contains(document.activeElement)&&x.current(),u.current=!1},0)},onInsert:(n,l)=>{u.current=!0;const S=l??i.length;f(`${i.slice(0,S)}${n}${i.slice(S)}`),requestAnimationFrame(()=>{const h=T.current;h?.focus(),h?.setSelectionRange(S+n.length,S+n.length)})},children:r.jsx(U,{id:y,ref:T,type:"text",placeholder:j&&i===""&&(w?.length??0)>0?"Enter text, type @ to add variable":m,value:i,onChange:n=>f(n.target.value),onFocus:()=>s(!0),onBlur:()=>{s(!1),setTimeout(()=>{!v.current&&!b.current?.contains(document.activeElement)&&x.current()},0)},onKeyDown:n=>{n.key==="Enter"||n.key===","?(n.preventDefault(),k()):n.key==="Backspace"&&i===""&&t.length>0&&a(t.slice(0,-1))}})}),R,t.length>0&&r.jsx(X,{children:t.map((n,l)=>r.jsx(G.Tag,{tagText:n.replace(/\{\{variable:([^}]+)\}\}/g,"{{$1}}"),theme:"light",type:"neutral",variant:"regular",TrailingIcon:A.default,onTrailingIconClicked:()=>a(t.filter((S,h)=>h!==l))},`${n}-${l}`))})]})},N=(t,a)=>{const m={};return Object.keys(t).forEach(y=>{m[y]=a?.params[y]?.value??t[y].value}),m},J=t=>String(t??"").split(",").map(a=>a.trim()).filter(Boolean),K=({toolKey:t,template:a,onClose:m,onSave:y,initial:R,onImprove:w,charLimits:i=D.AGENT_CHAR_LIMITS,variablesData:f,zIndex:j})=>{const[s,b]=c.useState(()=>N(a,R)),[T,k]=c.useState(!1),x=Object.values(a),v=t==="send_email",u=(e,p)=>b(g=>({...g,[e]:p})),n=x.every(e=>!(e.required&&String(s[e.key]??"").trim()===""||e.component==="MultilineInput"&&String(s[e.key]??"").length>i.instructions)),l=async()=>{if(!n||T)return;const e={};x.forEach(o=>{e[o.key]={...o,value:s[o.key]}});const p={id:R?.id??`${t}_${Date.now().toString(36)}`,tool_key:t,params:e},g=y(p);if(g&&typeof g.then=="function"){k(!0);try{await g}finally{k(!1)}}},S=e=>{const p=`config-tool-${e.key.toLowerCase()}`;switch(e.component){case"KeywordInput":if(!v)break;return r.jsxs(F.FieldBlock,{children:[r.jsx(O.TitleSmall,{color:d.COLORS.content.primary,children:e.title}),r.jsx(W,{nativeID:p,placeholder:e.hint??"",chips:J(s[e.key]),onChange:o=>u(e.key,o.join(",")),variablesData:f,hint:r.jsx(O.BodyCaption,{color:d.COLORS.content.secondary,children:"Press Enter or comma to add multiple emails"})})]},e.key);case"MultilineInput":return r.jsx(P.ToolInstructionsField,{"data-test":p,label:e.title,value:String(s[e.key]??""),onChange:o=>u(e.key,o),maxLength:i.instructions,placeholder:e.hint??"",onImprove:w,variablesData:f},e.key);case"Switch":return r.jsxs(Z,{children:[r.jsxs(ee,{children:[r.jsx(O.TitleSmall,{color:d.COLORS.content.primary,children:e.title}),e.hint&&r.jsx(O.BodyCaption,{color:d.COLORS.content.secondary,children:e.hint})]}),r.jsx(V.Switch,{"data-test":p,value:!!s[e.key],onValueChange:async o=>u(e.key,o)})]},e.key)}const g=r.jsx(M.Input,{"data-test":p,variant:"small",labelText:e.title,labelTextBold:!0,placeholder:e.hint??"",value:String(s[e.key]??""),onChangeText:o=>u(e.key,o)});return v?r.jsx(q.VariableTriggerArea,{addDataButton:!0,variablesData:f,onInsert:(o,L)=>{const _=String(s[e.key]??""),E=L??_.length;u(e.key,`${_.slice(0,E)}${o}${_.slice(E)}`)},children:g},e.key):r.jsx(z.default.Fragment,{children:g},e.key)},h=H[t];return r.jsx(Y.SideModal,{header:h.title,closeOnEscapeKey:!1,zIndex:j,headerCustomComponent:r.jsx(I.DrawerHeaderText,{title:h.title,subtitle:h.subtitle}),hideCrossButton:!1,width:"431px",headerStyle:I.DRAWER_HEADER_STYLE,bodyStyle:I.DRAWER_BODY_STYLE,onClose:m,saveButtonProps:{"data-test":"config-tool-save",buttonText:"Save",buttonType:"primary",size:"small",disabled:!n,isLoading:T,onClick:l},cancelButtonProps:{"data-test":"config-tool-cancel",buttonText:"Cancel",buttonType:"tertiaryGray",size:"small",onClick:m},children:x.map(S)})},Q=C.default.div`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),A=require("../../../assets/icons/cross.svg.js"),c=require("react"),$=require("styled-components"),O=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),F=require("../AgentBuilder.styled.js"),D=require("../constants/charLimits.js"),I=require("./DrawerHeaderText.js"),P=require("./ToolInstructionsField.js"),q=require("./VariableTriggerArea.js"),Y=require("../../side-modal/SideModal.js"),V=require("../../switch/Switch.js"),M=require("../../input/Input.js"),G=require("../../tag/Tag.js"),B=t=>t&&typeof t=="object"&&"default"in t?t:{default:t},z=B(c),R=B($),H={send_email:{title:"Send email",subtitle:"Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message."},send_slack_message:{title:"Send Slack message",subtitle:"Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation."},google_sheet_get_data:{title:"Get data from sheet",subtitle:"Look up rows in a Google Sheet. You pick the sheet and describe its columns, the AI writes the query it needs."},google_sheet_add_row:{title:"Add row to sheet",subtitle:"Append a row to a Google Sheet. You pick the sheet and its columns, the AI fills them in from the conversation."}},W=({chips:t,onChange:a,placeholder:y,nativeID:h,hint:v,variablesData:w})=>{const[i,f]=c.useState(""),[j,s]=c.useState(!1),b=c.useRef(null),T=c.useRef(null),k=()=>{const n=i.split(",").map(l=>l.trim()).filter(Boolean);n.length&&a([...t,...n.filter(l=>!t.includes(l))]),f("")},x=c.useRef(k);x.current=k;const C=c.useRef(!1),u=c.useRef(!1);return r.jsxs(Q,{ref:b,children:[r.jsx(q.VariableTriggerArea,{addDataButton:!0,variablesData:w,onOpenChange:n=>{C.current=n,!n&&setTimeout(()=>{!u.current&&!b.current?.contains(document.activeElement)&&x.current(),u.current=!1},0)},onInsert:(n,l)=>{u.current=!0;const S=l??i.length;f(`${i.slice(0,S)}${n}${i.slice(S)}`),requestAnimationFrame(()=>{const p=T.current;p?.focus(),p?.setSelectionRange(S+n.length,S+n.length)})},children:r.jsx(U,{id:h,name:h,ref:T,type:"text",autoComplete:"off",placeholder:j&&i===""&&(w?.length??0)>0?"Enter text, type @ to add variable":y,value:i,onChange:n=>f(n.target.value),onFocus:()=>s(!0),onBlur:()=>{s(!1),setTimeout(()=>{!C.current&&!b.current?.contains(document.activeElement)&&x.current()},0)},onKeyDown:n=>{n.key==="Enter"||n.key===","?(n.preventDefault(),k()):n.key==="Backspace"&&i===""&&t.length>0&&a(t.slice(0,-1))}})}),v,t.length>0&&r.jsx(X,{children:t.map((n,l)=>r.jsx(G.Tag,{tagText:n.replace(/\{\{variable:([^}]+)\}\}/g,"{{$1}}"),theme:"light",type:"neutral",variant:"regular",TrailingIcon:A.default,onTrailingIconClicked:()=>a(t.filter((S,p)=>p!==l))},`${n}-${l}`))})]})},N=(t,a)=>{const y={};return Object.keys(t).forEach(h=>{y[h]=a?.params[h]?.value??t[h].value}),y},J=t=>String(t??"").split(",").map(a=>a.trim()).filter(Boolean),K=({toolKey:t,template:a,onClose:y,onSave:h,initial:v,onImprove:w,charLimits:i=D.AGENT_CHAR_LIMITS,variablesData:f,zIndex:j})=>{const[s,b]=c.useState(()=>N(a,v)),[T,k]=c.useState(!1),x=Object.values(a),C=t==="send_email",u=(e,g)=>b(m=>({...m,[e]:g})),n=x.every(e=>!(e.required&&String(s[e.key]??"").trim()===""||e.component==="MultilineInput"&&String(s[e.key]??"").length>i.instructions)),l=async()=>{if(!n||T)return;const e={};x.forEach(o=>{e[o.key]={...o,value:s[o.key]}});const g={id:v?.id??`${t}_${Date.now().toString(36)}`,tool_key:t,params:e},m=h(g);if(m&&typeof m.then=="function"){k(!0);try{await m}finally{k(!1)}}},S=e=>{const g=`config-tool-${e.key.toLowerCase()}`;switch(e.component){case"KeywordInput":if(!C)break;return r.jsxs(F.FieldBlock,{children:[r.jsx(O.TitleSmall,{color:d.COLORS.content.primary,children:e.title}),r.jsx(W,{nativeID:g,placeholder:e.hint??"",chips:J(s[e.key]),onChange:o=>u(e.key,o.join(",")),variablesData:f,hint:r.jsx(O.BodyCaption,{color:d.COLORS.content.secondary,children:"Press Enter or comma to add multiple emails"})})]},e.key);case"MultilineInput":return r.jsx(P.ToolInstructionsField,{"data-test":g,label:e.title,value:String(s[e.key]??""),onChange:o=>u(e.key,o),maxLength:i.instructions,placeholder:e.hint??"",onImprove:w,variablesData:f},e.key);case"Switch":return r.jsxs(Z,{children:[r.jsxs(ee,{children:[r.jsx(O.TitleSmall,{color:d.COLORS.content.primary,children:e.title}),e.hint&&r.jsx(O.BodyCaption,{color:d.COLORS.content.secondary,children:e.hint})]}),r.jsx(V.Switch,{"data-test":g,value:!!s[e.key],onValueChange:async o=>u(e.key,o)})]},e.key)}const m=r.jsx(M.Input,{"data-test":g,variant:"small",labelText:e.title,labelTextBold:!0,placeholder:e.hint??"",value:String(s[e.key]??""),onChangeText:o=>u(e.key,o)});return C?r.jsx(q.VariableTriggerArea,{addDataButton:!0,variablesData:f,onInsert:(o,L)=>{const _=String(s[e.key]??""),E=L??_.length;u(e.key,`${_.slice(0,E)}${o}${_.slice(E)}`)},children:m},e.key):r.jsx(z.default.Fragment,{children:m},e.key)},p=H[t];return r.jsx(Y.SideModal,{header:p.title,closeOnEscapeKey:!1,zIndex:j,headerCustomComponent:r.jsx(I.DrawerHeaderText,{title:p.title,subtitle:p.subtitle}),hideCrossButton:!1,width:"431px",headerStyle:I.DRAWER_HEADER_STYLE,bodyStyle:I.DRAWER_BODY_STYLE,onClose:y,saveButtonProps:{"data-test":"config-tool-save",buttonText:"Save",buttonType:"primary",size:"small",disabled:!n,isLoading:T,onClick:l},cancelButtonProps:{"data-test":"config-tool-cancel",buttonText:"Cancel",buttonType:"tertiaryGray",size:"small",onClick:y},children:x.map(S)})},Q=R.default.div`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  gap: 8px;
5
- `,U=C.default.input`
5
+ `,U=R.default.input`
6
6
  width: 100%;
7
7
  min-width: 0;
8
8
  box-sizing: border-box;
@@ -23,16 +23,16 @@
23
23
  &:focus {
24
24
  border-color: ${d.COLORS.stroke.brand};
25
25
  }
26
- `,X=C.default.div`
26
+ `,X=R.default.div`
27
27
  display: flex;
28
28
  flex-wrap: wrap;
29
29
  gap: 6px;
30
- `,Z=C.default.div`
30
+ `,Z=R.default.div`
31
31
  display: flex;
32
32
  align-items: center;
33
33
  justify-content: space-between;
34
34
  gap: 12px;
35
- `,ee=C.default.div`
35
+ `,ee=R.default.div`
36
36
  display: flex;
37
37
  flex-direction: column;
38
38
  gap: 4px;
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigToolPanel.js","sources":["../../../../../src/components/agent-builder/components/ConfigToolPanel.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport React, { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { Switch } from '@src/components/switch';\nimport { Tag } from '@src/components/tag';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tConfigToolConfig,\n\tConfigToolKey,\n\tParamField,\n\tParamsBlob,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\nimport { VariableTriggerArea } from './VariableTriggerArea';\n\n/** Header copy per shared-drawer tool. */\nconst TOOL_COPY: Record<ConfigToolKey, { title: string; subtitle: string }> = {\n\tsend_email: {\n\t\ttitle: 'Send email',\n\t\tsubtitle:\n\t\t\t\"Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message.\",\n\t},\n\tsend_slack_message: {\n\t\ttitle: 'Send Slack message',\n\t\tsubtitle:\n\t\t\t'Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation.',\n\t},\n\tgoogle_sheet_get_data: {\n\t\ttitle: 'Get data from sheet',\n\t\tsubtitle:\n\t\t\t'Look up rows in a Google Sheet. You pick the sheet and describe its columns, the AI writes the query it needs.',\n\t},\n\tgoogle_sheet_add_row: {\n\t\ttitle: 'Add row to sheet',\n\t\tsubtitle:\n\t\t\t'Append a row to a Google Sheet. You pick the sheet and its columns, the AI fills them in from the conversation.',\n\t},\n};\n\ninterface ConfigToolPanelProps {\n\t/** Which tool this drawer configures (drives copy + persistence). */\n\ttoolKey: ConfigToolKey;\n\t/**\n\t * The backend template (`list-catalog` → params) for `toolKey`. The form is\n\t * DYNAMIC: exactly these fields render, in this order, each by its\n\t * `component` kind (KeywordInput | MultilineInput | Switch | fallback input).\n\t */\n\ttemplate: ParamsBlob;\n\tonClose: () => void;\n\t/** Persist the filled template. A pending promise shows the Save loader. */\n\tonSave: (config: ConfigToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: ConfigToolConfig;\n\t/** Optional \"Improve with AI\" for multiline fields. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/**\n\t * Variable catalog for the `@` trigger. When non-empty, `@` in the email\n\t * tool's Subject / Send To / Reply To / CC opens the variable picker\n\t * directly, and Message Instructions upgrades to the variables-only mention\n\t * editor. Absent → the drawer behaves exactly as before.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n}\n\ninterface EmailChipsFieldProps {\n\tchips: string[];\n\tonChange: (next: string[]) => void;\n\tplaceholder: string;\n\tnativeID?: string;\n\t/** Optional helper caption shown between the input and the chips. */\n\thint?: React.ReactNode;\n\t/**\n\t * Variable catalog for the `@` trigger. A picked variable is interpolated\n\t * into the entry TEXT at the caret (so values can mix text and variables,\n\t * e.g. `ops-{{variable:store_name}}@acme.com`) — it becomes a chip on\n\t * Enter / comma like any typed value.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n}\n\n/**\n * Email entry field: type an address and press Enter / comma (or blur) to add\n * it. Added emails render as removable chips BELOW the input — not inside it.\n * Backspace on an empty input removes the last chip.\n */\nconst EmailChipsField: React.FC<EmailChipsFieldProps> = ({\n\tchips,\n\tonChange,\n\tplaceholder,\n\tnativeID,\n\thint,\n\tvariablesData,\n}) => {\n\tconst [buffer, setBuffer] = useState('');\n\tconst [entryFocused, setEntryFocused] = useState(false);\n\tconst wrapRef = useRef<HTMLDivElement>(null);\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst commit = () => {\n\t\tconst parts = buffer\n\t\t\t.split(',')\n\t\t\t.map((s) => s.trim())\n\t\t\t.filter(Boolean);\n\t\tif (parts.length) {\n\t\t\tonChange([...chips, ...parts.filter((p) => !chips.includes(p))]);\n\t\t}\n\t\tsetBuffer('');\n\t};\n\t// The blur handler defers via setTimeout — read the LATEST commit (with the\n\t// current buffer), not the one captured when the blur fired.\n\tconst commitRef = useRef(commit);\n\tcommitRef.current = commit;\n\t// While the variable panel is open, focus bounces through it (search box,\n\t// rows) — blur must not commit the half-composed entry.\n\tconst panelOpenRef = useRef(false);\n\t// A variable was just picked — the panel-close commit below must not fire\n\t// (onInsert refocuses the entry, so its eventual blur commits instead).\n\tconst insertedRef = useRef(false);\n\n\treturn (\n\t\t<ChipsFieldWrap ref={wrapRef}>\n\t\t\t<VariableTriggerArea\n\t\t\t\taddDataButton\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\tonOpenChange={(open) => {\n\t\t\t\t\tpanelOpenRef.current = open;\n\t\t\t\t\tif (open) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// Panel closed (Escape / outside click / pick). If the entry's\n\t\t\t\t\t// blur-commit was skipped while the panel was open and focus is\n\t\t\t\t\t// not coming back, the half-typed entry would be silently lost\n\t\t\t\t\t// on save — commit it now.\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!insertedRef.current &&\n\t\t\t\t\t\t\t!wrapRef.current?.contains(document.activeElement)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcommitRef.current();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinsertedRef.current = false;\n\t\t\t\t\t}, 0);\n\t\t\t\t}}\n\t\t\t\tonInsert={(token, caret) => {\n\t\t\t\t\tinsertedRef.current = true;\n\t\t\t\t\tconst at = caret ?? buffer.length;\n\t\t\t\t\tsetBuffer(`${buffer.slice(0, at)}${token}${buffer.slice(at)}`);\n\t\t\t\t\t// Put the caret after the inserted token so typing continues\n\t\t\t\t\t// naturally (e.g. `{{variable:store_name}}|@acme.com`).\n\t\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t\tconst el = inputRef.current;\n\t\t\t\t\t\tel?.focus();\n\t\t\t\t\t\tel?.setSelectionRange(at + token.length, at + token.length);\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EmailInputBox\n\t\t\t\t\tid={nativeID}\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t// Focused + empty → the @ hint (only when a catalog makes @ do\n\t\t\t\t\t// anything); otherwise the field's own text.\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tentryFocused && buffer === '' && (variablesData?.length ?? 0) > 0\n\t\t\t\t\t\t\t? 'Enter text, type @ to add variable'\n\t\t\t\t\t\t\t: placeholder\n\t\t\t\t\t}\n\t\t\t\t\tvalue={buffer}\n\t\t\t\t\tonChange={(e) => setBuffer(e.target.value)}\n\t\t\t\t\tonFocus={() => setEntryFocused(true)}\n\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\tsetEntryFocused(false);\n\t\t\t\t\t\t// Focus moving into the variable panel / pill is not \"leaving\n\t\t\t\t\t\t// the field\" — committing then would chip a half-composed value.\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!panelOpenRef.current &&\n\t\t\t\t\t\t\t\t!wrapRef.current?.contains(document.activeElement)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcommitRef.current();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}}\n\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\tif (e.key === 'Enter' || e.key === ',') {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tcommit();\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\te.key === 'Backspace' &&\n\t\t\t\t\t\t\tbuffer === '' &&\n\t\t\t\t\t\t\tchips.length > 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonChange(chips.slice(0, -1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</VariableTriggerArea>\n\t\t\t{hint}\n\t\t\t{chips.length > 0 && (\n\t\t\t\t<ChipRow>\n\t\t\t\t\t{chips.map((email, i) => (\n\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\tkey={`${email}-${i}`}\n\t\t\t\t\t\t\t// Variable tokens display as the short {{name}} (values can mix\n\t\t\t\t\t\t\t// text and tokens); the stored value keeps {{variable:<name>}}.\n\t\t\t\t\t\t\ttagText={email.replace(/\\{\\{variable:([^}]+)\\}\\}/g, '{{$1}}')}\n\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\tTrailingIcon={CrossIcon}\n\t\t\t\t\t\t\tonTrailingIconClicked={() =>\n\t\t\t\t\t\t\t\tonChange(chips.filter((_, idx) => idx !== i))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</ChipRow>\n\t\t\t)}\n\t\t</ChipsFieldWrap>\n\t);\n};\n\n/** Field values keyed by param key (the editable part of a {@link ParamsBlob}). */\ntype ParamValues = Record<string, string | boolean | number | object>;\n\nconst seedValues = (\n\ttemplate: ParamsBlob,\n\tinitial?: ConfigToolConfig,\n): ParamValues => {\n\tconst values: ParamValues = {};\n\tObject.keys(template).forEach((key) => {\n\t\tvalues[key] = initial?.params[key]?.value ?? template[key].value;\n\t});\n\treturn values;\n};\n\n/** Chips ↔ the string value KeywordInput fields carry (comma-separated). */\nconst toChips = (value: unknown): string[] =>\n\tString(value ?? '')\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n\n/**\n * Shared right-side drawer for the params-driven configurable tools (email /\n * Slack). Fully backend-driven: it renders the template fields by their\n * `component` kind and returns the same blob with values filled in. KeywordInput\n * renders as multi-value email chips only for `send_email`; every other tool\n * gets a plain single-line input. Mount it fresh per open (key it) so `initial`\n * seeds the state. Built on the shared `SideModal` shell.\n */\nexport const ConfigToolPanel: React.FC<ConfigToolPanelProps> = ({\n\ttoolKey,\n\ttemplate,\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tvariablesData,\n\tzIndex,\n}) => {\n\tconst [values, setValues] = useState<ParamValues>(() =>\n\t\tseedValues(template, initial),\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\tconst fields = Object.values(template);\n\tconst isEmail = toolKey === 'send_email';\n\tconst setValue = (key: string, value: string | boolean | number | object) =>\n\t\tsetValues((prev) => ({ ...prev, [key]: value }));\n\n\tconst canSave = fields.every((f) => {\n\t\tif (f.required && String(values[f.key] ?? '').trim() === '') {\n\t\t\treturn false;\n\t\t}\n\t\t// MultilineInput renders the soft-limit editor (a paste may exceed the\n\t\t// cap, rendered grey) — gate the save so over-limit text can't persist.\n\t\tif (\n\t\t\tf.component === 'MultilineInput' &&\n\t\t\tString(values[f.key] ?? '').length > charLimits.instructions\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst params: ParamsBlob = {};\n\t\tfields.forEach((f) => {\n\t\t\t// Save the FULL descriptor with only `value` changed — the backend\n\t\t\t// infers each field's type from `component` and reads `required`.\n\t\t\tparams[f.key] = { ...f, value: values[f.key] };\n\t\t});\n\t\tconst config: ConfigToolConfig = {\n\t\t\tid: initial?.id ?? `${toolKey}_${Date.now().toString(36)}`,\n\t\t\ttool_key: toolKey,\n\t\t\tparams,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst renderField = (field: ParamField) => {\n\t\tconst testId = `config-tool-${field.key.toLowerCase()}`;\n\t\tswitch (field.component) {\n\t\t\t// Multi-value email chips — only for the email tool. Slack's KeywordInput\n\t\t\t// (channelId) falls through to the plain input below.\n\t\t\tcase 'KeywordInput':\n\t\t\t\tif (!isEmail) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<FieldBlock key={field.key}>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t{field.title}\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t{/* `@` at a word boundary (or the \"+ Add data\" pill) interpolates\n\t\t\t\t\t\t a variable into the entry TEXT at the caret — mixed values like\n\t\t\t\t\t\t ops-{{variable:store_name}}@acme.com chip on Enter / comma. */}\n\t\t\t\t\t\t<EmailChipsField\n\t\t\t\t\t\t\tnativeID={testId}\n\t\t\t\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\t\t\t\tchips={toChips(values[field.key])}\n\t\t\t\t\t\t\tonChange={(chips) => setValue(field.key, chips.join(','))}\n\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t\thint={\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\tPress Enter or comma to add multiple emails\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FieldBlock>\n\t\t\t\t);\n\t\t\tcase 'MultilineInput':\n\t\t\t\treturn (\n\t\t\t\t\t<ToolInstructionsField\n\t\t\t\t\t\tkey={field.key}\n\t\t\t\t\t\tdata-test={testId}\n\t\t\t\t\t\tlabel={field.title}\n\t\t\t\t\t\tvalue={String(values[field.key] ?? '')}\n\t\t\t\t\t\tonChange={(text) => setValue(field.key, text)}\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\t\t\tonImprove={onImprove}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase 'Switch':\n\t\t\t\treturn (\n\t\t\t\t\t<SwitchRow key={field.key}>\n\t\t\t\t\t\t<SwitchText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t{field.title}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t{field.hint && (\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t{field.hint}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</SwitchText>\n\t\t\t\t\t\t<Switch\n\t\t\t\t\t\t\tdata-test={testId}\n\t\t\t\t\t\t\tvalue={Boolean(values[field.key])}\n\t\t\t\t\t\t\tonValueChange={async (next) => setValue(field.key, next)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SwitchRow>\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tconst plainInput = (\n\t\t\t<Input\n\t\t\t\tdata-test={testId}\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText={field.title}\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\tvalue={String(values[field.key] ?? '')}\n\t\t\t\tonChangeText={(text) => setValue(field.key, text)}\n\t\t\t/>\n\t\t);\n\t\t// `@` variables only in the email tool's free-text fields (Subject) —\n\t\t// a Slack channel id can't hold a variable.\n\t\tif (!isEmail) {\n\t\t\treturn <React.Fragment key={field.key}>{plainInput}</React.Fragment>;\n\t\t}\n\t\treturn (\n\t\t\t<VariableTriggerArea\n\t\t\t\taddDataButton\n\t\t\t\tkey={field.key}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\tonInsert={(token, caret) => {\n\t\t\t\t\tconst current = String(values[field.key] ?? '');\n\t\t\t\t\tconst at = caret ?? current.length;\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tfield.key,\n\t\t\t\t\t\t`${current.slice(0, at)}${token}${current.slice(at)}`,\n\t\t\t\t\t);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{plainInput}\n\t\t\t</VariableTriggerArea>\n\t\t);\n\t};\n\n\tconst copy = TOOL_COPY[toolKey];\n\n\treturn (\n\t\t<SideModal\n\t\t\theader={copy.title}\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText title={copy.title} subtitle={copy.subtitle} />\n\t\t\t}\n\t\t\thideCrossButton={false}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'config-tool-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'config-tool-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t{fields.map(renderField)}\n\t\t</SideModal>\n\t);\n};\n\nconst ChipsFieldWrap = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\nconst EmailInputBox = styled.input`\n\twidth: 100%;\n\tmin-width: 0;\n\tbox-sizing: border-box;\n\theight: 32px;\n\tpadding: 0 8px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tfont-family: 'Inter', sans-serif;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${COLORS.surface.standard};\n\toutline: none;\n\n\t&::placeholder {\n\t\tcolor: ${COLORS.content.secondary};\n\t}\n\n\t&:focus {\n\t\tborder-color: ${COLORS.stroke.brand};\n\t}\n`;\n\nconst ChipRow = styled.div`\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n`;\n\nconst SwitchRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n`;\n\nconst SwitchText = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n`;\n"],"names":["TOOL_COPY","EmailChipsField","chips","onChange","placeholder","nativeID","hint","variablesData","buffer","setBuffer","useState","entryFocused","setEntryFocused","wrapRef","useRef","inputRef","commit","parts","s","p","commitRef","panelOpenRef","insertedRef","jsxs","ChipsFieldWrap","jsx","VariableTriggerArea","open","token","caret","at","el","EmailInputBox","e","ChipRow","email","i","Tag","CrossIcon","_","idx","seedValues","template","initial","values","key","toChips","value","ConfigToolPanel","toolKey","onClose","onSave","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","setValues","saving","setSaving","fields","isEmail","setValue","prev","canSave","f","handleSave","params","config","result","renderField","field","testId","FieldBlock","TitleSmall","COLORS","BodyCaption","ToolInstructionsField","text","SwitchRow","SwitchText","Switch","next","plainInput","Input","current","React","copy","SideModal","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","styled"],"mappings":"2rBA4BMA,EAAwE,CAC7E,WAAY,CACX,MAAO,aACP,SACC,4GAAA,EAEF,mBAAoB,CACnB,MAAO,qBACP,SACC,6GAAA,EAEF,sBAAuB,CACtB,MAAO,sBACP,SACC,gHAAA,EAEF,qBAAsB,CACrB,MAAO,mBACP,SACC,iHAAA,CAEH,EAmDMC,EAAkD,CAAC,CACxD,MAAAC,EACA,SAAAC,EACA,YAAAC,EACA,SAAAC,EACA,KAAAC,EACA,cAAAC,CACD,IAAM,CACL,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAE,EACjC,CAACC,EAAcC,CAAe,EAAIF,EAAAA,SAAS,EAAK,EAChDG,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAWD,EAAAA,OAAyB,IAAI,EAExCE,EAAS,IAAM,CACpB,MAAMC,EAAQT,EACZ,MAAM,GAAG,EACT,IAAKU,GAAMA,EAAE,KAAA,CAAM,EACnB,OAAO,OAAO,EACZD,EAAM,QACTd,EAAS,CAAC,GAAGD,EAAO,GAAGe,EAAM,OAAQE,GAAM,CAACjB,EAAM,SAASiB,CAAC,CAAC,CAAC,CAAC,EAEhEV,EAAU,EAAE,CACb,EAGMW,EAAYN,EAAAA,OAAOE,CAAM,EAC/BI,EAAU,QAAUJ,EAGpB,MAAMK,EAAeP,EAAAA,OAAO,EAAK,EAG3BQ,EAAcR,EAAAA,OAAO,EAAK,EAEhC,OACCS,EAAAA,KAACC,EAAA,CAAe,IAAKX,EACpB,SAAA,CAAAY,EAAAA,IAACC,EAAAA,oBAAA,CACA,cAAa,GACb,cAA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ConfigToolPanel.tsx"],"sourcesContent":["import CrossIcon from '@src/assets/icons/cross.svg';\nimport React, { useRef, useState } from 'react';\nimport styled from 'styled-components';\nimport { Input } from '@src/components/input';\nimport { SideModal } from '@src/components/side-modal';\nimport { Switch } from '@src/components/switch';\nimport { Tag } from '@src/components/tag';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport type { VariableListInterfaceV3 } from '../../variable-picker-v3/model';\nimport {\n\tConfigToolConfig,\n\tConfigToolKey,\n\tParamField,\n\tParamsBlob,\n} from '../AgentBuilder.model';\nimport { FieldBlock } from '../AgentBuilder.styled';\nimport type { AgentCharLimits } from '../constants/charLimits';\nimport { AGENT_CHAR_LIMITS } from '../constants/charLimits';\nimport {\n\tDRAWER_BODY_STYLE,\n\tDRAWER_HEADER_STYLE,\n\tDrawerHeaderText,\n} from './DrawerHeaderText';\nimport { ToolInstructionsField } from './ToolInstructionsField';\nimport { VariableTriggerArea } from './VariableTriggerArea';\n\n/** Header copy per shared-drawer tool. */\nconst TOOL_COPY: Record<ConfigToolKey, { title: string; subtitle: string }> = {\n\tsend_email: {\n\t\ttitle: 'Send email',\n\t\tsubtitle:\n\t\t\t\"Notify someone by email when this agent can't continue. You pick the recipient, the AI drafts the message.\",\n\t},\n\tsend_slack_message: {\n\t\ttitle: 'Send Slack message',\n\t\tsubtitle:\n\t\t\t'Post a message to a Slack channel. You pick the channel, the AI composes the message from the conversation.',\n\t},\n\tgoogle_sheet_get_data: {\n\t\ttitle: 'Get data from sheet',\n\t\tsubtitle:\n\t\t\t'Look up rows in a Google Sheet. You pick the sheet and describe its columns, the AI writes the query it needs.',\n\t},\n\tgoogle_sheet_add_row: {\n\t\ttitle: 'Add row to sheet',\n\t\tsubtitle:\n\t\t\t'Append a row to a Google Sheet. You pick the sheet and its columns, the AI fills them in from the conversation.',\n\t},\n};\n\ninterface ConfigToolPanelProps {\n\t/** Which tool this drawer configures (drives copy + persistence). */\n\ttoolKey: ConfigToolKey;\n\t/**\n\t * The backend template (`list-catalog` → params) for `toolKey`. The form is\n\t * DYNAMIC: exactly these fields render, in this order, each by its\n\t * `component` kind (KeywordInput | MultilineInput | Switch | fallback input).\n\t */\n\ttemplate: ParamsBlob;\n\tonClose: () => void;\n\t/** Persist the filled template. A pending promise shows the Save loader. */\n\tonSave: (config: ConfigToolConfig) => void | Promise<void>;\n\t/** Seed values when editing an existing tool. */\n\tinitial?: ConfigToolConfig;\n\t/** Optional \"Improve with AI\" for multiline fields. Omit to hide it. */\n\tonImprove?: (text: string) => Promise<string>;\n\tcharLimits?: AgentCharLimits;\n\t/**\n\t * Variable catalog for the `@` trigger. When non-empty, `@` in the email\n\t * tool's Subject / Send To / Reply To / CC opens the variable picker\n\t * directly, and Message Instructions upgrades to the variables-only mention\n\t * editor. Absent → the drawer behaves exactly as before.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n\t/** SideModal stacking order — raise it when opened over another drawer. */\n\tzIndex?: number;\n}\n\ninterface EmailChipsFieldProps {\n\tchips: string[];\n\tonChange: (next: string[]) => void;\n\tplaceholder: string;\n\tnativeID?: string;\n\t/** Optional helper caption shown between the input and the chips. */\n\thint?: React.ReactNode;\n\t/**\n\t * Variable catalog for the `@` trigger. A picked variable is interpolated\n\t * into the entry TEXT at the caret (so values can mix text and variables,\n\t * e.g. `ops-{{variable:store_name}}@acme.com`) — it becomes a chip on\n\t * Enter / comma like any typed value.\n\t */\n\tvariablesData?: VariableListInterfaceV3[];\n}\n\n/**\n * Email entry field: type an address and press Enter / comma (or blur) to add\n * it. Added emails render as removable chips BELOW the input — not inside it.\n * Backspace on an empty input removes the last chip.\n */\nconst EmailChipsField: React.FC<EmailChipsFieldProps> = ({\n\tchips,\n\tonChange,\n\tplaceholder,\n\tnativeID,\n\thint,\n\tvariablesData,\n}) => {\n\tconst [buffer, setBuffer] = useState('');\n\tconst [entryFocused, setEntryFocused] = useState(false);\n\tconst wrapRef = useRef<HTMLDivElement>(null);\n\tconst inputRef = useRef<HTMLInputElement>(null);\n\n\tconst commit = () => {\n\t\tconst parts = buffer\n\t\t\t.split(',')\n\t\t\t.map((s) => s.trim())\n\t\t\t.filter(Boolean);\n\t\tif (parts.length) {\n\t\t\tonChange([...chips, ...parts.filter((p) => !chips.includes(p))]);\n\t\t}\n\t\tsetBuffer('');\n\t};\n\t// The blur handler defers via setTimeout — read the LATEST commit (with the\n\t// current buffer), not the one captured when the blur fired.\n\tconst commitRef = useRef(commit);\n\tcommitRef.current = commit;\n\t// While the variable panel is open, focus bounces through it (search box,\n\t// rows) — blur must not commit the half-composed entry.\n\tconst panelOpenRef = useRef(false);\n\t// A variable was just picked — the panel-close commit below must not fire\n\t// (onInsert refocuses the entry, so its eventual blur commits instead).\n\tconst insertedRef = useRef(false);\n\n\treturn (\n\t\t<ChipsFieldWrap ref={wrapRef}>\n\t\t\t<VariableTriggerArea\n\t\t\t\taddDataButton\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\tonOpenChange={(open) => {\n\t\t\t\t\tpanelOpenRef.current = open;\n\t\t\t\t\tif (open) {\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\t// Panel closed (Escape / outside click / pick). If the entry's\n\t\t\t\t\t// blur-commit was skipped while the panel was open and focus is\n\t\t\t\t\t// not coming back, the half-typed entry would be silently lost\n\t\t\t\t\t// on save — commit it now.\n\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!insertedRef.current &&\n\t\t\t\t\t\t\t!wrapRef.current?.contains(document.activeElement)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tcommitRef.current();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tinsertedRef.current = false;\n\t\t\t\t\t}, 0);\n\t\t\t\t}}\n\t\t\t\tonInsert={(token, caret) => {\n\t\t\t\t\tinsertedRef.current = true;\n\t\t\t\t\tconst at = caret ?? buffer.length;\n\t\t\t\t\tsetBuffer(`${buffer.slice(0, at)}${token}${buffer.slice(at)}`);\n\t\t\t\t\t// Put the caret after the inserted token so typing continues\n\t\t\t\t\t// naturally (e.g. `{{variable:store_name}}|@acme.com`).\n\t\t\t\t\trequestAnimationFrame(() => {\n\t\t\t\t\t\tconst el = inputRef.current;\n\t\t\t\t\t\tel?.focus();\n\t\t\t\t\t\tel?.setSelectionRange(at + token.length, at + token.length);\n\t\t\t\t\t});\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<EmailInputBox\n\t\t\t\t\tid={nativeID}\n\t\t\t\t\tname={nativeID}\n\t\t\t\t\tref={inputRef}\n\t\t\t\t\ttype=\"text\"\n\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t// Focused + empty → the @ hint (only when a catalog makes @ do\n\t\t\t\t\t// anything); otherwise the field's own text.\n\t\t\t\t\tplaceholder={\n\t\t\t\t\t\tentryFocused && buffer === '' && (variablesData?.length ?? 0) > 0\n\t\t\t\t\t\t\t? 'Enter text, type @ to add variable'\n\t\t\t\t\t\t\t: placeholder\n\t\t\t\t\t}\n\t\t\t\t\tvalue={buffer}\n\t\t\t\t\tonChange={(e) => setBuffer(e.target.value)}\n\t\t\t\t\tonFocus={() => setEntryFocused(true)}\n\t\t\t\t\tonBlur={() => {\n\t\t\t\t\t\tsetEntryFocused(false);\n\t\t\t\t\t\t// Focus moving into the variable panel / pill is not \"leaving\n\t\t\t\t\t\t// the field\" — committing then would chip a half-composed value.\n\t\t\t\t\t\tsetTimeout(() => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t!panelOpenRef.current &&\n\t\t\t\t\t\t\t\t!wrapRef.current?.contains(document.activeElement)\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tcommitRef.current();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 0);\n\t\t\t\t\t}}\n\t\t\t\t\tonKeyDown={(e) => {\n\t\t\t\t\t\tif (e.key === 'Enter' || e.key === ',') {\n\t\t\t\t\t\t\te.preventDefault();\n\t\t\t\t\t\t\tcommit();\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\te.key === 'Backspace' &&\n\t\t\t\t\t\t\tbuffer === '' &&\n\t\t\t\t\t\t\tchips.length > 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tonChange(chips.slice(0, -1));\n\t\t\t\t\t\t}\n\t\t\t\t\t}}\n\t\t\t\t/>\n\t\t\t</VariableTriggerArea>\n\t\t\t{hint}\n\t\t\t{chips.length > 0 && (\n\t\t\t\t<ChipRow>\n\t\t\t\t\t{chips.map((email, i) => (\n\t\t\t\t\t\t<Tag\n\t\t\t\t\t\t\tkey={`${email}-${i}`}\n\t\t\t\t\t\t\t// Variable tokens display as the short {{name}} (values can mix\n\t\t\t\t\t\t\t// text and tokens); the stored value keeps {{variable:<name>}}.\n\t\t\t\t\t\t\ttagText={email.replace(/\\{\\{variable:([^}]+)\\}\\}/g, '{{$1}}')}\n\t\t\t\t\t\t\ttheme=\"light\"\n\t\t\t\t\t\t\ttype=\"neutral\"\n\t\t\t\t\t\t\tvariant=\"regular\"\n\t\t\t\t\t\t\tTrailingIcon={CrossIcon}\n\t\t\t\t\t\t\tonTrailingIconClicked={() =>\n\t\t\t\t\t\t\t\tonChange(chips.filter((_, idx) => idx !== i))\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t))}\n\t\t\t\t</ChipRow>\n\t\t\t)}\n\t\t</ChipsFieldWrap>\n\t);\n};\n\n/** Field values keyed by param key (the editable part of a {@link ParamsBlob}). */\ntype ParamValues = Record<string, string | boolean | number | object>;\n\nconst seedValues = (\n\ttemplate: ParamsBlob,\n\tinitial?: ConfigToolConfig,\n): ParamValues => {\n\tconst values: ParamValues = {};\n\tObject.keys(template).forEach((key) => {\n\t\tvalues[key] = initial?.params[key]?.value ?? template[key].value;\n\t});\n\treturn values;\n};\n\n/** Chips ↔ the string value KeywordInput fields carry (comma-separated). */\nconst toChips = (value: unknown): string[] =>\n\tString(value ?? '')\n\t\t.split(',')\n\t\t.map((s) => s.trim())\n\t\t.filter(Boolean);\n\n/**\n * Shared right-side drawer for the params-driven configurable tools (email /\n * Slack). Fully backend-driven: it renders the template fields by their\n * `component` kind and returns the same blob with values filled in. KeywordInput\n * renders as multi-value email chips only for `send_email`; every other tool\n * gets a plain single-line input. Mount it fresh per open (key it) so `initial`\n * seeds the state. Built on the shared `SideModal` shell.\n */\nexport const ConfigToolPanel: React.FC<ConfigToolPanelProps> = ({\n\ttoolKey,\n\ttemplate,\n\tonClose,\n\tonSave,\n\tinitial,\n\tonImprove,\n\tcharLimits = AGENT_CHAR_LIMITS,\n\tvariablesData,\n\tzIndex,\n}) => {\n\tconst [values, setValues] = useState<ParamValues>(() =>\n\t\tseedValues(template, initial),\n\t);\n\tconst [saving, setSaving] = useState(false);\n\n\tconst fields = Object.values(template);\n\tconst isEmail = toolKey === 'send_email';\n\tconst setValue = (key: string, value: string | boolean | number | object) =>\n\t\tsetValues((prev) => ({ ...prev, [key]: value }));\n\n\tconst canSave = fields.every((f) => {\n\t\tif (f.required && String(values[f.key] ?? '').trim() === '') {\n\t\t\treturn false;\n\t\t}\n\t\t// MultilineInput renders the soft-limit editor (a paste may exceed the\n\t\t// cap, rendered grey) — gate the save so over-limit text can't persist.\n\t\tif (\n\t\t\tf.component === 'MultilineInput' &&\n\t\t\tString(values[f.key] ?? '').length > charLimits.instructions\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t});\n\n\tconst handleSave = async () => {\n\t\tif (!canSave || saving) {\n\t\t\treturn;\n\t\t}\n\t\tconst params: ParamsBlob = {};\n\t\tfields.forEach((f) => {\n\t\t\t// Save the FULL descriptor with only `value` changed — the backend\n\t\t\t// infers each field's type from `component` and reads `required`.\n\t\t\tparams[f.key] = { ...f, value: values[f.key] };\n\t\t});\n\t\tconst config: ConfigToolConfig = {\n\t\t\tid: initial?.id ?? `${toolKey}_${Date.now().toString(36)}`,\n\t\t\ttool_key: toolKey,\n\t\t\tparams,\n\t\t};\n\t\tconst result = onSave(config);\n\t\tif (result && typeof (result as Promise<void>).then === 'function') {\n\t\t\tsetSaving(true);\n\t\t\ttry {\n\t\t\t\tawait result;\n\t\t\t} finally {\n\t\t\t\tsetSaving(false);\n\t\t\t}\n\t\t}\n\t};\n\n\tconst renderField = (field: ParamField) => {\n\t\tconst testId = `config-tool-${field.key.toLowerCase()}`;\n\t\tswitch (field.component) {\n\t\t\t// Multi-value email chips — only for the email tool. Slack's KeywordInput\n\t\t\t// (channelId) falls through to the plain input below.\n\t\t\tcase 'KeywordInput':\n\t\t\t\tif (!isEmail) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\treturn (\n\t\t\t\t\t<FieldBlock key={field.key}>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t{field.title}\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t{/* `@` at a word boundary (or the \"+ Add data\" pill) interpolates\n\t\t\t\t\t\t a variable into the entry TEXT at the caret — mixed values like\n\t\t\t\t\t\t ops-{{variable:store_name}}@acme.com chip on Enter / comma. */}\n\t\t\t\t\t\t<EmailChipsField\n\t\t\t\t\t\t\tnativeID={testId}\n\t\t\t\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\t\t\t\tchips={toChips(values[field.key])}\n\t\t\t\t\t\t\tonChange={(chips) => setValue(field.key, chips.join(','))}\n\t\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t\t\thint={\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\tPress Enter or comma to add multiple emails\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</FieldBlock>\n\t\t\t\t);\n\t\t\tcase 'MultilineInput':\n\t\t\t\treturn (\n\t\t\t\t\t<ToolInstructionsField\n\t\t\t\t\t\tkey={field.key}\n\t\t\t\t\t\tdata-test={testId}\n\t\t\t\t\t\tlabel={field.title}\n\t\t\t\t\t\tvalue={String(values[field.key] ?? '')}\n\t\t\t\t\t\tonChange={(text) => setValue(field.key, text)}\n\t\t\t\t\t\tmaxLength={charLimits.instructions}\n\t\t\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\t\t\tonImprove={onImprove}\n\t\t\t\t\t\tvariablesData={variablesData}\n\t\t\t\t\t/>\n\t\t\t\t);\n\t\t\tcase 'Switch':\n\t\t\t\treturn (\n\t\t\t\t\t<SwitchRow key={field.key}>\n\t\t\t\t\t\t<SwitchText>\n\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t{field.title}\n\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t{field.hint && (\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\t{field.hint}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</SwitchText>\n\t\t\t\t\t\t<Switch\n\t\t\t\t\t\t\tdata-test={testId}\n\t\t\t\t\t\t\tvalue={Boolean(values[field.key])}\n\t\t\t\t\t\t\tonValueChange={async (next) => setValue(field.key, next)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</SwitchRow>\n\t\t\t\t);\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\tconst plainInput = (\n\t\t\t<Input\n\t\t\t\tdata-test={testId}\n\t\t\t\tvariant=\"small\"\n\t\t\t\tlabelText={field.title}\n\t\t\t\tlabelTextBold\n\t\t\t\tplaceholder={field.hint ?? ''}\n\t\t\t\tvalue={String(values[field.key] ?? '')}\n\t\t\t\tonChangeText={(text) => setValue(field.key, text)}\n\t\t\t/>\n\t\t);\n\t\t// `@` variables only in the email tool's free-text fields (Subject) —\n\t\t// a Slack channel id can't hold a variable.\n\t\tif (!isEmail) {\n\t\t\treturn <React.Fragment key={field.key}>{plainInput}</React.Fragment>;\n\t\t}\n\t\treturn (\n\t\t\t<VariableTriggerArea\n\t\t\t\taddDataButton\n\t\t\t\tkey={field.key}\n\t\t\t\tvariablesData={variablesData}\n\t\t\t\tonInsert={(token, caret) => {\n\t\t\t\t\tconst current = String(values[field.key] ?? '');\n\t\t\t\t\tconst at = caret ?? current.length;\n\t\t\t\t\tsetValue(\n\t\t\t\t\t\tfield.key,\n\t\t\t\t\t\t`${current.slice(0, at)}${token}${current.slice(at)}`,\n\t\t\t\t\t);\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t{plainInput}\n\t\t\t</VariableTriggerArea>\n\t\t);\n\t};\n\n\tconst copy = TOOL_COPY[toolKey];\n\n\treturn (\n\t\t<SideModal\n\t\t\theader={copy.title}\n\t\t\tcloseOnEscapeKey={false}\n\t\t\tzIndex={zIndex}\n\t\t\theaderCustomComponent={\n\t\t\t\t<DrawerHeaderText title={copy.title} subtitle={copy.subtitle} />\n\t\t\t}\n\t\t\thideCrossButton={false}\n\t\t\twidth=\"431px\"\n\t\t\theaderStyle={DRAWER_HEADER_STYLE}\n\t\t\tbodyStyle={DRAWER_BODY_STYLE}\n\t\t\tonClose={onClose}\n\t\t\tsaveButtonProps={{\n\t\t\t\t'data-test': 'config-tool-save',\n\t\t\t\tbuttonText: 'Save',\n\t\t\t\tbuttonType: 'primary',\n\t\t\t\tsize: 'small',\n\t\t\t\tdisabled: !canSave,\n\t\t\t\tisLoading: saving,\n\t\t\t\tonClick: handleSave,\n\t\t\t}}\n\t\t\tcancelButtonProps={{\n\t\t\t\t'data-test': 'config-tool-cancel',\n\t\t\t\tbuttonText: 'Cancel',\n\t\t\t\tbuttonType: 'tertiaryGray',\n\t\t\t\tsize: 'small',\n\t\t\t\tonClick: onClose,\n\t\t\t}}\n\t\t>\n\t\t\t{fields.map(renderField)}\n\t\t</SideModal>\n\t);\n};\n\nconst ChipsFieldWrap = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 8px;\n`;\n\nconst EmailInputBox = styled.input`\n\twidth: 100%;\n\tmin-width: 0;\n\tbox-sizing: border-box;\n\theight: 32px;\n\tpadding: 0 8px;\n\tborder: 1px solid ${COLORS.stroke.primary};\n\tborder-radius: 4px;\n\tfont-family: 'Inter', sans-serif;\n\tfont-size: 14px;\n\tcolor: ${COLORS.content.primary};\n\tbackground: ${COLORS.surface.standard};\n\toutline: none;\n\n\t&::placeholder {\n\t\tcolor: ${COLORS.content.secondary};\n\t}\n\n\t&:focus {\n\t\tborder-color: ${COLORS.stroke.brand};\n\t}\n`;\n\nconst ChipRow = styled.div`\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 6px;\n`;\n\nconst SwitchRow = styled.div`\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: space-between;\n\tgap: 12px;\n`;\n\nconst SwitchText = styled.div`\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 4px;\n\tmin-width: 0;\n`;\n"],"names":["TOOL_COPY","EmailChipsField","chips","onChange","placeholder","nativeID","hint","variablesData","buffer","setBuffer","useState","entryFocused","setEntryFocused","wrapRef","useRef","inputRef","commit","parts","s","p","commitRef","panelOpenRef","insertedRef","jsxs","ChipsFieldWrap","jsx","VariableTriggerArea","open","token","caret","at","el","EmailInputBox","e","ChipRow","email","i","Tag","CrossIcon","_","idx","seedValues","template","initial","values","key","toChips","value","ConfigToolPanel","toolKey","onClose","onSave","onImprove","charLimits","AGENT_CHAR_LIMITS","zIndex","setValues","saving","setSaving","fields","isEmail","setValue","prev","canSave","f","handleSave","params","config","result","renderField","field","testId","FieldBlock","TitleSmall","COLORS","BodyCaption","ToolInstructionsField","text","SwitchRow","SwitchText","Switch","next","plainInput","Input","current","React","copy","SideModal","DrawerHeaderText","DRAWER_HEADER_STYLE","DRAWER_BODY_STYLE","styled"],"mappings":"2rBA4BMA,EAAwE,CAC7E,WAAY,CACX,MAAO,aACP,SACC,4GAAA,EAEF,mBAAoB,CACnB,MAAO,qBACP,SACC,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AaG,EAAAA,oBACb,UAAWC,EAAAA,kBACX,QAAAxC,EACA,gBAAiB,CAChB,YAAa,mBACb,WAAY,OACZ,WAAY,UACZ,KAAM,QACN,SAAU,CAACa,EACX,UAAWN,EACX,QAASQ,CAAA,EAEV,kBAAmB,CAClB,YAAa,qBACb,WAAY,SACZ,WAAY,eACZ,KAAM,QACN,QAASf,CAAA,EAGT,SAAAS,EAAO,IAAIU,CAAW,CAAA,CAAA,CAG1B,EAEM7C,EAAiBmE,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA,EAMxB3D,EAAgB2D,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAMRjB,EAAAA,OAAO,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,UAIhCA,EAAAA,OAAO,QAAQ,OAAO;AAAA,eACjBA,EAAAA,OAAO,QAAQ,QAAQ;AAAA;AAAA;AAAA;AAAA,WAI3BA,EAAAA,OAAO,QAAQ,SAAS;AAAA;AAAA;AAAA;AAAA,kBAIjBA,EAAAA,OAAO,OAAO,KAAK;AAAA;AAAA,EAI/BxC,EAAUyD,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA,EAMjBb,EAAYa,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAOnBZ,GAAaY,EAAAA,QAAO;AAAA;AAAA;AAAA;AAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("../../../assets/icons/RedirectToNew.svg.js"),d=require("../../radioButton/RadioButton.js"),n=require("../../TypographyStyle.js"),t=require("../../../constants/Theme.js"),o=require("../AgentBuilder.styled.js"),x=require("../../tooltips/Tooltip.js"),s="default",C=({method:l,onMethodChange:r,onSmartAgentHandover:a,"data-test":c})=>{const i=l!==s;return e.jsxs(o.FieldBlock,{"data-test":c,children:[e.jsx(n.TitleSmall,{color:t.COLORS.content.primary,children:"Handover method"}),e.jsxs(o.CardRow,{children:[e.jsxs(o.RadioCard,{"data-test":"handover-method-default",type:"button",selected:!i,onClick:()=>r(s),children:[e.jsx(d.RadioButton,{isActive:!i,onValueChange:()=>r(s),skipSelectingOff:!0,activeColor:t.BASE_COLORS.brand[800]}),e.jsxs(o.RadioCardText,{children:[e.jsx(n.TitleSmall,{color:t.COLORS.content.primary,children:"Use default settings"}),e.jsxs(n.BodyCaption,{color:t.COLORS.content.secondary,children:["As defined in"," ",a?e.jsxs(o.ChannelsLink,{"data-test":"handover-smart-agent-link",type:"button",onClick:u=>{u.stopPropagation(),a()},style:{display:"inline-flex"},children:["Smart agent handover",e.jsx(h.default,{width:12,height:12})]}):"Smart agent handover"]})]})]}),e.jsx(x.Tooltip,{body:"Custom handover rules are coming soon. For now this agent follows your smart agent handover settings.",placement:"top",children:e.jsx("span",{style:{flex:1,display:"flex",cursor:"not-allowed"},children:e.jsxs(o.RadioCard,{"data-test":"handover-method-custom",type:"button",disabled:!0,selected:i,children:[e.jsx(d.RadioButton,{isActive:i,isDisabled:!0,onValueChange:()=>{},skipSelectingOff:!0,activeColor:t.BASE_COLORS.brand[800]}),e.jsxs(o.RadioCardText,{children:[e.jsx(n.TitleSmall,{color:t.COLORS.content.inactive,children:"Custom instructions"}),e.jsx(n.BodyCaption,{color:t.COLORS.content.inactive,children:"Write custom handover rules for this agent."})]})]})})})]})]})};exports.HandoverMethodSection=C;
2
+ //# sourceMappingURL=HandoverMethodSection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HandoverMethodSection.js","sources":["../../../../../src/components/agent-builder/components/HandoverMethodSection.tsx"],"sourcesContent":["import RedirectIcon from '@src/assets/icons/RedirectToNew.svg';\nimport React from 'react';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport type { HandoverMethod } from '../AgentBuilder.model';\nimport {\n\tCardRow,\n\tChannelsLink,\n\tFieldBlock,\n\tRadioCard,\n\tRadioCardText,\n} from '../AgentBuilder.styled';\n\n/**\n * The stored `handover.method` that means \"inherit the store's smart-agent\n * handover settings\" — the BIK default, and the only method selectable today.\n */\nconst DEFAULT_METHOD: HandoverMethod = 'default';\n\nexport interface HandoverMethodSectionProps {\n\t/** The agent's current `handover.method`. */\n\tmethod: HandoverMethod;\n\t/** Called with the newly picked method. */\n\tonMethodChange: (method: HandoverMethod) => void;\n\t/**\n\t * Open the store's smart-agent-handover settings. When absent the\n\t * \"Smart agent handover\" text renders as plain text instead of a link.\n\t */\n\tonSmartAgentHandover?: () => void;\n\t'data-test'?: string;\n}\n\n/**\n * The BIK \"Handover method\" picker: \"Use default settings\" (selectable, links\n * out to smart agent handover) and \"Custom instructions\" (disabled until that\n * flow is built). Presentational and context-free so any host — the\n * AgentBuilder's Step 4 or an embedding product like the journey builder —\n * renders the identical UI.\n */\nexport const HandoverMethodSection: React.FC<HandoverMethodSectionProps> = ({\n\tmethod,\n\tonMethodChange,\n\tonSmartAgentHandover,\n\t'data-test': dataTest,\n}) => {\n\t// Anything other than the default method means the merchant is on custom\n\t// instructions.\n\tconst usesCustom = method !== DEFAULT_METHOD;\n\n\treturn (\n\t\t<FieldBlock data-test={dataTest}>\n\t\t\t<TitleSmall color={COLORS.content.primary}>Handover method</TitleSmall>\n\n\t\t\t<CardRow>\n\t\t\t\t<RadioCard\n\t\t\t\t\tdata-test=\"handover-method-default\"\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tselected={!usesCustom}\n\t\t\t\t\tonClick={() => onMethodChange(DEFAULT_METHOD)}\n\t\t\t\t>\n\t\t\t\t\t<RadioButton\n\t\t\t\t\t\tisActive={!usesCustom}\n\t\t\t\t\t\tonValueChange={() => onMethodChange(DEFAULT_METHOD)}\n\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\tactiveColor={BASE_COLORS.brand['800']}\n\t\t\t\t\t/>\n\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\tUse default settings\n\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\tAs defined in{' '}\n\t\t\t\t\t\t\t{onSmartAgentHandover ? (\n\t\t\t\t\t\t\t\t<ChannelsLink\n\t\t\t\t\t\t\t\t\tdata-test=\"handover-smart-agent-link\"\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t// The link sits inside the card's own click target, so\n\t\t\t\t\t\t\t\t\t// stop the click bubbling up and re-selecting the card.\n\t\t\t\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\tonSmartAgentHandover();\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tstyle={{ display: 'inline-flex' }}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\tSmart agent handover\n\t\t\t\t\t\t\t\t\t<RedirectIcon width={12} height={12} />\n\t\t\t\t\t\t\t\t</ChannelsLink>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t'Smart agent handover'\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t</RadioCardText>\n\t\t\t\t</RadioCard>\n\n\t\t\t\t{/* Custom handover rules aren't built yet — the card is shown so the\n\t\t\t\t merchant knows it's coming, but it can't be selected. */}\n\t\t\t\t<Tooltip\n\t\t\t\t\tbody=\"Custom handover rules are coming soon. For now this agent follows your smart agent handover settings.\"\n\t\t\t\t\tplacement=\"top\"\n\t\t\t\t>\n\t\t\t\t\t{/* A disabled <button> fires no mouse events, so the tooltip would\n\t\t\t\t\t never open on the card itself — the span is the hover target\n\t\t\t\t\t (same wrapper IconButton uses for its disabled tooltip). It also\n\t\t\t\t\t has to carry the card's `flex: 1`, since it is now the flex item. */}\n\t\t\t\t\t<span\n\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\tcursor: 'not-allowed',\n\t\t\t\t\t\t}}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RadioCard\n\t\t\t\t\t\t\tdata-test=\"handover-method-custom\"\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\tselected={usesCustom}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\tisActive={usesCustom}\n\t\t\t\t\t\t\t\tisDisabled\n\t\t\t\t\t\t\t\tonValueChange={() => undefined}\n\t\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\t\tactiveColor={BASE_COLORS.brand['800']}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.inactive}>\n\t\t\t\t\t\t\t\t\tCustom instructions\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.inactive}>\n\t\t\t\t\t\t\t\t\tWrite custom handover rules for this agent.\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t\t</RadioCard>\n\t\t\t\t\t</span>\n\t\t\t\t</Tooltip>\n\t\t\t</CardRow>\n\t\t</FieldBlock>\n\t);\n};\n"],"names":["DEFAULT_METHOD","HandoverMethodSection","method","onMethodChange","onSmartAgentHandover","dataTest","usesCustom","jsxs","FieldBlock","jsx","TitleSmall","COLORS","CardRow","RadioCard","RadioButton","BASE_COLORS","RadioCardText","BodyCaption","ChannelsLink","event","RedirectIcon","Tooltip"],"mappings":"wXAmBMA,EAAiC,UAsB1BC,EAA8D,CAAC,CAC3E,OAAAC,EACA,eAAAC,EACA,qBAAAC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ACR,SAAUP,EAEV,SAAA,CAAAG,EAAAA,IAACK,EAAAA,YAAA,CACA,SAAUR,EACV,WAAU,GACV,cAAe,IAAA,GACf,iBAAgB,GAChB,YAAaS,EAAAA,YAAY,MAAM,GAAK,CAAA,CAAA,SAEpCC,EAAAA,cAAA,CACA,SAAA,CAAAP,MAACC,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,SAAU,SAAA,sBAE5C,QACCM,EAAAA,YAAA,CAAY,MAAON,EAAAA,OAAO,QAAQ,SAAU,SAAA,6CAAA,CAE7C,CAAA,CAAA,CACD,CAAA,CAAA,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,EACD,CAEF"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("../context/AgentBuilderContext.js"),r=require("../../toaster/Toaster.js"),u=()=>{const{undoToast:t,undoRemoval:o,dismissUndo:e}=s.useAgentBuilderContext();return t?n.jsx(r.Toaster,{text:t.message,type:"info",position:"top-right",autoClose:5e3,hideCloseButton:!0,buttonProps:{buttonText:"Undo",showButton:!0,onButtonClick:()=>(o(),{})},onCloseToast:()=>e()},t.id):null};exports.UndoToast=u;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),s=require("../context/AgentBuilderContext.js"),r=require("../../toaster/Toaster.js"),u=()=>{const{undoToast:t,undoRemoval:o,dismissUndo:e}=s.useAgentBuilderContext();return t?n.jsx(r.Toaster,{text:t.message,type:"info",position:"top-right",autoClose:5e3,buttonProps:{buttonText:"Undo",showButton:!0,onButtonClick:()=>(o(),{})},onCloseToast:()=>e()},t.id):null};exports.UndoToast=u;
2
2
  //# sourceMappingURL=UndoToast.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UndoToast.js","sources":["../../../../../src/components/agent-builder/components/UndoToast.tsx"],"sourcesContent":["import React from 'react';\nimport { Toaster } from '@src/components/toaster';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\n/**\n * Top-right toast shown after a tool / sub-agent is removed, offering an Undo.\n * Re-keyed per removal so each one restarts the auto-close timer. Uses the\n * shared `Toaster` (which mounts its own ToastContainer).\n */\nexport const UndoToast: React.FC = () => {\n\tconst { undoToast, undoRemoval, dismissUndo } = useAgentBuilderContext();\n\n\tif (!undoToast) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Toaster\n\t\t\tkey={undoToast.id}\n\t\t\ttext={undoToast.message}\n\t\t\ttype=\"info\"\n\t\t\tposition=\"top-right\"\n\t\t\tautoClose={5000}\n\t\t\thideCloseButton\n\t\t\tbuttonProps={{\n\t\t\t\tbuttonText: 'Undo',\n\t\t\t\tshowButton: true,\n\t\t\t\tonButtonClick: () => {\n\t\t\t\t\tundoRemoval();\n\t\t\t\t\treturn {} as Record<string, never>;\n\t\t\t\t},\n\t\t\t}}\n\t\t\tonCloseToast={() => dismissUndo()}\n\t\t/>\n\t);\n};\n"],"names":["UndoToast","undoToast","undoRemoval","dismissUndo","useAgentBuilderContext","jsx","Toaster"],"mappings":"0MASaA,EAAsB,IAAM,CACxC,KAAM,CAAE,UAAAC,EAAW,YAAAC,EAAa,YAAAC,CAAA,EAAgBC,EAAAA,uBAAA,EAEhD,OAAKH,EAKJI,EAAAA,IAACC,EAAAA,QAAA,CAEA,KAAML,EAAU,QAChB,KAAK,OACL,SAAS,YACT,UAAW,IACX,gBAAe,GACf,YAAa,CACZ,WAAY,OACZ,WAAY,GACZ,cAAe,KACdC,EAAA,EACO,CAAA,EACR,EAED,aAAc,IAAMC,EAAA,CAAY,EAd3BF,EAAU,EAAA,EALT,IAsBT"}
1
+ {"version":3,"file":"UndoToast.js","sources":["../../../../../src/components/agent-builder/components/UndoToast.tsx"],"sourcesContent":["import React from 'react';\nimport { Toaster } from '@src/components/toaster';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\n\n/**\n * Top-right toast shown after a tool / sub-agent is removed, offering an Undo.\n * Re-keyed per removal so each one restarts the auto-close timer. Uses the\n * shared `Toaster` (which mounts its own ToastContainer).\n */\nexport const UndoToast: React.FC = () => {\n\tconst { undoToast, undoRemoval, dismissUndo } = useAgentBuilderContext();\n\n\tif (!undoToast) {\n\t\treturn null;\n\t}\n\n\treturn (\n\t\t<Toaster\n\t\t\tkey={undoToast.id}\n\t\t\ttext={undoToast.message}\n\t\t\ttype=\"info\"\n\t\t\tposition=\"top-right\"\n\t\t\tautoClose={5000}\n\t\t\tbuttonProps={{\n\t\t\t\tbuttonText: 'Undo',\n\t\t\t\tshowButton: true,\n\t\t\t\tonButtonClick: () => {\n\t\t\t\t\tundoRemoval();\n\t\t\t\t\treturn {} as Record<string, never>;\n\t\t\t\t},\n\t\t\t}}\n\t\t\tonCloseToast={() => dismissUndo()}\n\t\t/>\n\t);\n};\n"],"names":["UndoToast","undoToast","undoRemoval","dismissUndo","useAgentBuilderContext","jsx","Toaster"],"mappings":"0MASaA,EAAsB,IAAM,CACxC,KAAM,CAAE,UAAAC,EAAW,YAAAC,EAAa,YAAAC,CAAA,EAAgBC,EAAAA,uBAAA,EAEhD,OAAKH,EAKJI,EAAAA,IAACC,EAAAA,QAAA,CAEA,KAAML,EAAU,QAChB,KAAK,OACL,SAAS,YACT,UAAW,IACX,YAAa,CACZ,WAAY,OACZ,WAAY,GACZ,cAAe,KACdC,EAAA,EACO,CAAA,EACR,EAED,aAAc,IAAMC,EAAA,CAAY,EAb3BF,EAAU,EAAA,EALT,IAqBT"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),g=require("../../../assets/icons/RedirectToNew.svg.js"),u=require("../../radioButton/RadioButton.js"),s=require("../../TypographyStyle.js"),n=require("../../../constants/Theme.js"),t=require("../AgentBuilder.styled.js"),j=require("../components/AiTextArea.js"),p=require("../components/StepSectionHeader.js"),C=require("../constants/steps.js"),v=require("../context/AgentBuilderContext.js"),y=require("../utils/mentionSerialization.js"),T=require("../../tooltips/Tooltip.js"),d=C.STEP_DEFINITIONS[3],h="default",f=()=>{const{value:l,patch:a,applicationType:c,onSmartAgentHandover:o}=v.useAgentBuilderContext(),{handover:r}=l,m=y.appTypeLabel(c)==="BIK",i=r.method!==h;return m?e.jsxs("div",{className:"bik-agent-step bik-agent-step--handover",children:[e.jsx(p.StepSectionHeader,{title:d.title,helper:d.helper}),e.jsxs(t.SectionBodyWrap,{children:[e.jsxs(t.FieldBlock,{children:[e.jsx(s.TitleSmall,{color:n.COLORS.content.primary,children:"Handover method"}),e.jsxs(t.CardRow,{children:[e.jsxs(t.RadioCard,{"data-test":"handover-method-default",type:"button",selected:!i,onClick:()=>a({handover:{...r,method:h}}),children:[e.jsx(u.RadioButton,{isActive:!i,onValueChange:()=>a({handover:{...r,method:h}}),skipSelectingOff:!0,activeColor:n.BASE_COLORS.brand[800]}),e.jsxs(t.RadioCardText,{children:[e.jsx(s.TitleSmall,{color:n.COLORS.content.primary,children:"Use default settings"}),e.jsxs(s.BodyCaption,{color:n.COLORS.content.secondary,children:["As defined in"," ",o?e.jsxs(t.ChannelsLink,{"data-test":"handover-smart-agent-link",type:"button",onClick:S=>{S.stopPropagation(),o()},style:{display:"inline-flex"},children:["Smart agent handover",e.jsx(g.default,{width:12,height:12})]}):"Smart agent handover"]})]})]}),e.jsx(T.Tooltip,{body:"Custom handover rules are coming soon. For now this agent follows your smart agent handover settings.",placement:"top",children:e.jsx("span",{style:{flex:1,display:"flex",cursor:"not-allowed"},children:e.jsxs(t.RadioCard,{"data-test":"handover-method-custom",type:"button",disabled:!0,selected:i,children:[e.jsx(u.RadioButton,{isActive:i,isDisabled:!0,onValueChange:()=>{},skipSelectingOff:!0,activeColor:n.BASE_COLORS.brand[800]}),e.jsxs(t.RadioCardText,{children:[e.jsx(s.TitleSmall,{color:n.COLORS.content.inactive,children:"Custom instructions"}),e.jsx(s.BodyCaption,{color:n.COLORS.content.inactive,children:"Write custom handover rules for this agent."})]})]})})})]})]}),i&&e.jsx(x,{})]})]}):e.jsxs("div",{className:"bik-agent-step bik-agent-step--handover",children:[e.jsx(p.StepSectionHeader,{title:d.title,helper:d.helper}),e.jsx(t.SectionBodyWrap,{children:e.jsx(x,{})})]})},x=()=>{const{value:l,patch:a,charLimits:c}=v.useAgentBuilderContext(),{handover:o}=l;return e.jsx(j.AiTextArea,{"data-test":"handover-when",label:"Handover when",value:o.when,onChange:r=>a({handover:{...o,when:r}}),maxLength:c.handoverWhen,placeholder:"e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.",minHeight:"120px"})};exports.Step4HandoverRules=f;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("../AgentBuilder.styled.js"),v=require("../components/AiTextArea.js"),x=require("../components/HandoverMethodSection.js"),d=require("../components/StepSectionHeader.js"),S=require("../constants/steps.js"),h=require("../context/AgentBuilderContext.js"),g=require("../utils/mentionSerialization.js"),r=S.STEP_DEFINITIONS[3],m="default",H=()=>{const{value:o,patch:s,applicationType:a,onSmartAgentHandover:n}=h.useAgentBuilderContext(),{handover:t}=o,l=g.appTypeLabel(a)==="BIK",u=t.method!==m;return l?e.jsxs("div",{className:"bik-agent-step bik-agent-step--handover",children:[e.jsx(d.StepSectionHeader,{title:r.title,helper:r.helper}),e.jsxs(i.SectionBodyWrap,{children:[e.jsx(x.HandoverMethodSection,{method:t.method,onMethodChange:p=>s({handover:{...t,method:p}}),onSmartAgentHandover:n}),u&&e.jsx(c,{})]})]}):e.jsxs("div",{className:"bik-agent-step bik-agent-step--handover",children:[e.jsx(d.StepSectionHeader,{title:r.title,helper:r.helper}),e.jsx(i.SectionBodyWrap,{children:e.jsx(c,{})})]})},c=()=>{const{value:o,patch:s,charLimits:a}=h.useAgentBuilderContext(),{handover:n}=o;return e.jsx(v.AiTextArea,{"data-test":"handover-when",label:"Handover when",value:n.when,onChange:t=>s({handover:{...n,when:t}}),maxLength:a.handoverWhen,placeholder:"e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.",minHeight:"120px"})};exports.Step4HandoverRules=H;
2
2
  //# sourceMappingURL=Step4HandoverRules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Step4HandoverRules.js","sources":["../../../../../src/components/agent-builder/steps/Step4HandoverRules.tsx"],"sourcesContent":["import RedirectIcon from '@src/assets/icons/RedirectToNew.svg';\nimport React from 'react';\nimport { RadioButton } from '@src/components/radioButton/RadioButton';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodyCaption, TitleSmall } from '@src/components/TypographyStyle';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport type { HandoverMethod } from '../AgentBuilder.model';\nimport {\n\tCardRow,\n\tChannelsLink,\n\tFieldBlock,\n\tRadioCard,\n\tRadioCardText,\n\tSectionBodyWrap,\n} from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport { appTypeLabel } from '../utils/mentionSerialization';\n\nconst STEP = STEP_DEFINITIONS[3];\n\n/**\n * The stored `handover.method` that means \"inherit the store's smart-agent\n * handover settings\" — the BIK default, and the only method selectable today.\n */\nconst DEFAULT_METHOD: HandoverMethod = 'default';\n\n/**\n * Step 4.\n *\n * **Manifest** (and any other host) keeps the original single free-text field:\n * the method is implicit and the consumer always sends the seeded `'default'`.\n *\n * **BIK** picks a handover *method* first. \"Use default settings\" is selected by\n * default and links out to where those defaults live; \"Custom instructions\" is\n * deliberately disabled until that flow is built, so the free-text field only\n * appears for an agent already saved with a non-default method.\n */\nexport const Step4HandoverRules: React.FC = () => {\n\tconst { value, patch, applicationType, onSmartAgentHandover } =\n\t\tuseAgentBuilderContext();\n\tconst { handover } = value;\n\n\tconst isBik = appTypeLabel(applicationType) === 'BIK';\n\t// Anything other than the default method means the merchant is on custom\n\t// instructions, so the free-text field is what they need to see.\n\tconst usesCustom = handover.method !== DEFAULT_METHOD;\n\n\tif (!isBik) {\n\t\treturn (\n\t\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<HandoverWhenField />\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<SectionBodyWrap>\n\t\t\t\t<FieldBlock>\n\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\tHandover method\n\t\t\t\t\t</TitleSmall>\n\n\t\t\t\t\t<CardRow>\n\t\t\t\t\t\t<RadioCard\n\t\t\t\t\t\t\tdata-test=\"handover-method-default\"\n\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\tselected={!usesCustom}\n\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\tpatch({ handover: { ...handover, method: DEFAULT_METHOD } })\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\tisActive={!usesCustom}\n\t\t\t\t\t\t\t\tonValueChange={() =>\n\t\t\t\t\t\t\t\t\tpatch({ handover: { ...handover, method: DEFAULT_METHOD } })\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\t\tactiveColor={BASE_COLORS.brand['800']}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.primary}>\n\t\t\t\t\t\t\t\t\tUse default settings\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.secondary}>\n\t\t\t\t\t\t\t\t\tAs defined in{' '}\n\t\t\t\t\t\t\t\t\t{onSmartAgentHandover ? (\n\t\t\t\t\t\t\t\t\t\t<ChannelsLink\n\t\t\t\t\t\t\t\t\t\t\tdata-test=\"handover-smart-agent-link\"\n\t\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t\t// The link sits inside the card's own click target, so\n\t\t\t\t\t\t\t\t\t\t\t// stop the click bubbling up and re-selecting the card.\n\t\t\t\t\t\t\t\t\t\t\tonClick={(event) => {\n\t\t\t\t\t\t\t\t\t\t\t\tevent.stopPropagation();\n\t\t\t\t\t\t\t\t\t\t\t\tonSmartAgentHandover();\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ display: 'inline-flex' }}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\tSmart agent handover\n\t\t\t\t\t\t\t\t\t\t\t<RedirectIcon width={12} height={12} />\n\t\t\t\t\t\t\t\t\t\t</ChannelsLink>\n\t\t\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t\t\t'Smart agent handover'\n\t\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t\t</RadioCard>\n\n\t\t\t\t\t\t{/* Custom handover rules aren't built yet — the card is shown so the\n\t\t\t\t\t\t merchant knows it's coming, but it can't be selected. */}\n\t\t\t\t\t\t<Tooltip\n\t\t\t\t\t\t\tbody=\"Custom handover rules are coming soon. For now this agent follows your smart agent handover settings.\"\n\t\t\t\t\t\t\tplacement=\"top\"\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* A disabled <button> fires no mouse events, so the tooltip would\n\t\t\t\t\t\t\t never open on the card itself — the span is the hover target\n\t\t\t\t\t\t\t (same wrapper IconButton uses for its disabled tooltip). It also\n\t\t\t\t\t\t\t has to carry the card's `flex: 1`, since it is now the flex item. */}\n\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\tflex: 1,\n\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\tcursor: 'not-allowed',\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t<RadioCard\n\t\t\t\t\t\t\t\t\tdata-test=\"handover-method-custom\"\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tdisabled\n\t\t\t\t\t\t\t\t\tselected={usesCustom}\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<RadioButton\n\t\t\t\t\t\t\t\t\t\tisActive={usesCustom}\n\t\t\t\t\t\t\t\t\t\tisDisabled\n\t\t\t\t\t\t\t\t\t\tonValueChange={() => undefined}\n\t\t\t\t\t\t\t\t\t\tskipSelectingOff\n\t\t\t\t\t\t\t\t\t\tactiveColor={BASE_COLORS.brand['800']}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t<RadioCardText>\n\t\t\t\t\t\t\t\t\t\t<TitleSmall color={COLORS.content.inactive}>\n\t\t\t\t\t\t\t\t\t\t\tCustom instructions\n\t\t\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t\t\t\t<BodyCaption color={COLORS.content.inactive}>\n\t\t\t\t\t\t\t\t\t\t\tWrite custom handover rules for this agent.\n\t\t\t\t\t\t\t\t\t\t</BodyCaption>\n\t\t\t\t\t\t\t\t\t</RadioCardText>\n\t\t\t\t\t\t\t\t</RadioCard>\n\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t</CardRow>\n\t\t\t\t</FieldBlock>\n\n\t\t\t\t{usesCustom && <HandoverWhenField />}\n\t\t\t</SectionBodyWrap>\n\t\t</div>\n\t);\n};\n\n/** The free-text \"Handover when\" field, shared by both layouts. */\nconst HandoverWhenField: React.FC = () => {\n\tconst { value, patch, charLimits } = useAgentBuilderContext();\n\tconst { handover } = value;\n\n\treturn (\n\t\t<AiTextArea\n\t\t\tdata-test=\"handover-when\"\n\t\t\tlabel=\"Handover when\"\n\t\t\tvalue={handover.when}\n\t\t\tonChange={(text) => patch({ handover: { ...handover, when: text } })}\n\t\t\tmaxLength={charLimits.handoverWhen}\n\t\t\tplaceholder=\"e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.\"\n\t\t\tminHeight=\"120px\"\n\t\t/>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","DEFAULT_METHOD","Step4HandoverRules","value","patch","applicationType","onSmartAgentHandover","useAgentBuilderContext","handover","isBik","appTypeLabel","usesCustom","jsxs","jsx","StepSectionHeader","SectionBodyWrap","FieldBlock","TitleSmall","COLORS","CardRow","RadioCard","RadioButton","BASE_COLORS","RadioCardText","BodyCaption","ChannelsLink","event","RedirectIcon","Tooltip","HandoverWhenField","charLimits","AiTextArea","text"],"mappings":"ilBAqBMA,EAAOC,EAAAA,iBAAiB,CAAC,EAMzBC,EAAiC,UAa1BC,EAA+B,IAAM,CACjD,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,gBAAAC,EAAiB,qBAAAC,CAAA,EACtCC,EAAAA,uBAAA,EACK,CAAE,SAAAC,GAAaL,EAEfM,EAAQC,EAAAA,aAAaL,CAAe,IAAM,MAG1CM,EAAaH,EAAS,SAAWP,EAEvC,OAAKQ,EAYJG,EAAAA,KAAC,MAAA,CAAI,UAAU,0CACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOf,EAAK,MAAO,OAAQA,EAAK,OAAQ,SAE1DgB,EAAAA,gBAAA,CACA,SAAA,CAAAH,OAACI,EAAAA,WAAA,CACA,SAAA,CAAAH,MAACI,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,QAAS,SAAA,kBAE3C,SA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B,GAChB,YAAaW,EAAAA,YAAY,MAAM,GAAK,CAAA,CAAA,SAEpCC,EAAAA,cAAA,CACA,SAAA,CAAAV,MAACI,EAAAA,WAAA,CAAW,MAAOC,EAAAA,OAAO,QAAQ,SAAU,SAAA,sBAE5C,QACCM,EAAAA,YAAA,CAAY,MAAON,EAAAA,OAAO,QAAQ,SAAU,SAAA,6CAAA,CAE7C,CAAA,CAAA,CACD,CAAA,CAAA,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,CACD,CAAA,EACD,EAECP,SAAekB,EAAA,CAAA,CAAkB,CAAA,CAAA,CACnC,CAAA,EACD,EA9GCjB,EAAAA,KAAC,MAAA,CAAI,UAAU,0CACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOf,EAAK,MAAO,OAAQA,EAAK,OAAQ,EAC3Dc,EAAAA,IAACE,EAAAA,gBAAA,CACA,SAAAF,EAAAA,IAACgB,EAAA,CAAA,CAAkB,CAAA,CACpB,CAAA,EACD,CA2GH,EAGMA,EAA8B,IAAM,CACzC,KAAM,CAAE,MAAA1B,EAAO,MAAAC,EAAO,WAAA0B,CAAA,EAAevB,EAAAA,uBAAA,EAC/B,CAAE,SAAAC,GAAaL,EAErB,OACCU,EAAAA,IAACkB,EAAAA,WAAA,CACA,YAAU,gBACV,MAAM,gBACN,MAAOvB,EAAS,KAChB,SAAWwB,GAAS5B,EAAM,CAAE,SAAU,CAAE,GAAGI,EAAU,KAAMwB,CAAA,EAAQ,EACnE,UAAWF,EAAW,aACtB,YAAY,wHACZ,UAAU,OAAA,CAAA,CAGb"}
1
+ {"version":3,"file":"Step4HandoverRules.js","sources":["../../../../../src/components/agent-builder/steps/Step4HandoverRules.tsx"],"sourcesContent":["import React from 'react';\nimport type { HandoverMethod } from '../AgentBuilder.model';\nimport { SectionBodyWrap } from '../AgentBuilder.styled';\nimport { AiTextArea } from '../components/AiTextArea';\nimport { HandoverMethodSection } from '../components/HandoverMethodSection';\nimport { StepSectionHeader } from '../components/StepSectionHeader';\nimport { STEP_DEFINITIONS } from '../constants/steps';\nimport { useAgentBuilderContext } from '../context/AgentBuilderContext';\nimport { appTypeLabel } from '../utils/mentionSerialization';\n\nconst STEP = STEP_DEFINITIONS[3];\n\n/**\n * The stored `handover.method` that means \"inherit the store's smart-agent\n * handover settings\" — the BIK default, and the only method selectable today.\n */\nconst DEFAULT_METHOD: HandoverMethod = 'default';\n\n/**\n * Step 4.\n *\n * **Manifest** (and any other host) keeps the original single free-text field:\n * the method is implicit and the consumer always sends the seeded `'default'`.\n *\n * **BIK** picks a handover *method* first, via the shared\n * {@link HandoverMethodSection}: \"Use default settings\" is selected by default\n * and links out to where those defaults live; \"Custom instructions\" is\n * deliberately disabled until that flow is built, so the free-text field only\n * appears for an agent already saved with a non-default method.\n */\nexport const Step4HandoverRules: React.FC = () => {\n\tconst { value, patch, applicationType, onSmartAgentHandover } =\n\t\tuseAgentBuilderContext();\n\tconst { handover } = value;\n\n\tconst isBik = appTypeLabel(applicationType) === 'BIK';\n\t// Anything other than the default method means the merchant is on custom\n\t// instructions, so the free-text field is what they need to see.\n\tconst usesCustom = handover.method !== DEFAULT_METHOD;\n\n\tif (!isBik) {\n\t\treturn (\n\t\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\t\t\t\t<SectionBodyWrap>\n\t\t\t\t\t<HandoverWhenField />\n\t\t\t\t</SectionBodyWrap>\n\t\t\t</div>\n\t\t);\n\t}\n\n\treturn (\n\t\t<div className=\"bik-agent-step bik-agent-step--handover\">\n\t\t\t<StepSectionHeader title={STEP.title} helper={STEP.helper} />\n\n\t\t\t<SectionBodyWrap>\n\t\t\t\t<HandoverMethodSection\n\t\t\t\t\tmethod={handover.method}\n\t\t\t\t\tonMethodChange={(method) =>\n\t\t\t\t\t\tpatch({ handover: { ...handover, method } })\n\t\t\t\t\t}\n\t\t\t\t\tonSmartAgentHandover={onSmartAgentHandover}\n\t\t\t\t/>\n\n\t\t\t\t{usesCustom && <HandoverWhenField />}\n\t\t\t</SectionBodyWrap>\n\t\t</div>\n\t);\n};\n\n/** The free-text \"Handover when\" field, shared by both layouts. */\nconst HandoverWhenField: React.FC = () => {\n\tconst { value, patch, charLimits } = useAgentBuilderContext();\n\tconst { handover } = value;\n\n\treturn (\n\t\t<AiTextArea\n\t\t\tdata-test=\"handover-when\"\n\t\t\tlabel=\"Handover when\"\n\t\t\tvalue={handover.when}\n\t\t\tonChange={(text) => patch({ handover: { ...handover, when: text } })}\n\t\t\tmaxLength={charLimits.handoverWhen}\n\t\t\tplaceholder=\"e.g. Hand over if the customer is angry or asks for a human three times. Hand over if the order value exceeds ₹5,000.\"\n\t\t\tminHeight=\"120px\"\n\t\t/>\n\t);\n};\n"],"names":["STEP","STEP_DEFINITIONS","DEFAULT_METHOD","Step4HandoverRules","value","patch","applicationType","onSmartAgentHandover","useAgentBuilderContext","handover","isBik","appTypeLabel","usesCustom","jsxs","jsx","StepSectionHeader","SectionBodyWrap","HandoverMethodSection","method","HandoverWhenField","charLimits","AiTextArea","text"],"mappings":"yaAUMA,EAAOC,EAAAA,iBAAiB,CAAC,EAMzBC,EAAiC,UAc1BC,EAA+B,IAAM,CACjD,KAAM,CAAE,MAAAC,EAAO,MAAAC,EAAO,gBAAAC,EAAiB,qBAAAC,CAAA,EACtCC,EAAAA,uBAAA,EACK,CAAE,SAAAC,GAAaL,EAEfM,EAAQC,EAAAA,aAAaL,CAAe,IAAM,MAG1CM,EAAaH,EAAS,SAAWP,EAEvC,OAAKQ,EAYJG,EAAAA,KAAC,MAAA,CAAI,UAAU,0CACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOf,EAAK,MAAO,OAAQA,EAAK,OAAQ,SAE1DgB,EAAAA,gBAAA,CACA,SAAA,CAAAF,EAAAA,IAACG,EAAAA,sBAAA,CACA,OAAQR,EAAS,OACjB,eAAiBS,GAChBb,EAAM,CAAE,SAAU,CAAE,GAAGI,EAAU,OAAAS,CAAA,EAAU,EAE5C,qBAAAX,CAAA,CAAA,EAGAK,SAAeO,EAAA,CAAA,CAAkB,CAAA,CAAA,CACnC,CAAA,EACD,EAxBCN,EAAAA,KAAC,MAAA,CAAI,UAAU,0CACd,SAAA,CAAAC,MAACC,EAAAA,mBAAkB,MAAOf,EAAK,MAAO,OAAQA,EAAK,OAAQ,EAC3Dc,EAAAA,IAACE,EAAAA,gBAAA,CACA,SAAAF,EAAAA,IAACK,EAAA,CAAA,CAAkB,CAAA,CACpB,CAAA,EACD,CAqBH,EAGMA,EAA8B,IAAM,CACzC,KAAM,CAAE,MAAAf,EAAO,MAAAC,EAAO,WAAAe,CAAA,EAAeZ,EAAAA,uBAAA,EAC/B,CAAE,SAAAC,GAAaL,EAErB,OACCU,EAAAA,IAACO,EAAAA,WAAA,CACA,YAAU,gBACV,MAAM,gBACN,MAAOZ,EAAS,KAChB,SAAWa,GAASjB,EAAM,CAAE,SAAU,CAAE,GAAGI,EAAU,KAAMa,CAAA,EAAQ,EACnE,UAAWF,EAAW,aACtB,YAAY,wHACZ,UAAU,OAAA,CAAA,CAGb"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),c=require("react"),n=require("../../constants/Theme.js"),_=require("../../assets/icons/chevronDown.svg.js"),G=require("../input/context/InputStyleProvider.js"),J=require("./ChipInput.js"),K=require("./DropdownPopover/index.js"),Q=require("./OpenedDropdown/utils/iterationOnOptions.js"),X=require("../input/Input.js");function I(){}const L=({placeHolder:l,size:j,onSelect:q,defaultOptions:d,disabled:s,solidDisabled:a,noErrorHint:W,placeHolderHeight:v,showPlaceholderWhenSelected:b=!1,inputStyle:k={},inputType:C="default",onDeleteChip:E,truncatedText:M,showLeadingIconInPlaceholder:T=!1,showTrailingIconPlaceholder:w=!1,showLabelsOnMoreHover:p=!1,value:u,showSelected:O=!1,onDropdownVisbilityChange:A,...e})=>{const[h,F]=c.useState(!1),[m,y]=c.useState(!1),r=j??"default",V=c.useRef(),[o,f]=c.useState(d??[]);function z(t){Array.isArray(t)?f([...t]):f([t]),q?.(t)}c.useEffect(()=>{const t=[];e?.options?.forEach(x=>{x.options?x.options.forEach(S=>{S.selected&&t.push({...S,label:S.label})}):x.selected&&t.push(x)}),f([...t])},[e.options]),c.useEffect(()=>{d&&f([...d])},[d]);const B=Q.getSelectedOptionsAsText(o),N=b?l:B??l??"Select an option",g=e.buttonWidth,R=g??e.width??"100%",U=e.dropdownWidth??R;return i.jsx(i.Fragment,{children:i.jsx(G.InputStyleContext.Provider,{value:{InputWrapper:{height:v||(r==="x-small"?24:r==="small"?32:48),width:R,...g?{maxWidth:g}:{},zIndex:1,cursor:"pointer",padding:r==="x-small"?"4px 8px":"6px 8px",backgroundColor:s&&a?n.COLORS.background.base:e.version==="3.0"?h||m?n.COLORS.surface.hovered:n.COLORS.surface.standard:O&&u!==void 0?n.BASE_COLORS.positive[100]:m&&!h?n.COLORS.background.inactive:n.COLORS.surface.standard,transition:"background-color 0.3s ease",...k},input:{minHeight:"100%",maxWidth:"100%",color:s&&a?n.COLORS.content.secondary:O&&u!==void 0?n.COLORS.content.positive:"inherit"}},children:i.jsx("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:e.width?{width:e.width}:void 0,children:i.jsxs(K.DropdownPopover,{"data-test":e["data-test"],ref:V,onSelect:z,disabled:s,...e,onDropdownVisbilityChange:t=>{F(t),A?.(t)},width:U,children:[C=="default"&&i.jsx(X.Input,{version:e.version,noErrorHint:W,state:s?"disabled":"none",solidDisabled:a,value:u===void 0?N:u,errorMessage:e.error,variant:r,placeholder:l??"Select an option",onChangeText:I,leftIcon:T&&o[0]?.leadingIcon?{icon:()=>i.jsx(i.Fragment,{children:o[0]?.leadingIcon})}:void 0,rightIcon:{icon:()=>i.jsxs("div",{style:{display:"flex"},children:[w&&o[0]?.trailingIcon,i.jsx(_.default,{style:{transform:h?"rotate(180deg)":"rotate(0deg)"},onClick:I,width:r==="x-small"?16:r==="small"?20:24,height:r==="x-small"?16:r==="small"?20:24,color:O?n.COLORS.content.positive:n.COLORS.content.primary})]})},truncateText:M??!0}),C=="chip"&&i.jsx(J.default,{placeholder:l??"Select options",placeholderColor:s&&a?n.COLORS.content.secondary:void 0,chips:o,onDeleteChip:t=>{E?.(t)},errorMessage:e.error,isDropdownOpened:h,sizeToUse:r,containerStyle:{width:e.width??"100%",cursor:"pointer",...s&&a?{backgroundColor:n.COLORS.background.base,pointerEvents:"none"}:{}},showLabelsOnMoreHover:p})]})})})})};L.displayName="Dropdown";exports.Dropdown=L;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),o=require("react"),n=require("../../constants/Theme.js"),_=require("../../assets/icons/chevronDown.svg.js"),G=require("../input/context/InputStyleProvider.js"),J=require("./ChipInput.js"),K=require("./DropdownPopover/index.js"),Q=require("./OpenedDropdown/utils/iterationOnOptions.js"),X=require("../input/Input.js");function I(){}const L=({placeHolder:l,size:j,onSelect:q,defaultOptions:d,disabled:s,solidDisabled:a,noErrorHint:W,placeHolderHeight:v,showPlaceholderWhenSelected:b=!1,inputStyle:k={},inputType:C="default",onDeleteChip:E,truncatedText:M,showLeadingIconInPlaceholder:T=!1,showTrailingIconPlaceholder:p=!1,showLabelsOnMoreHover:w=!1,value:u,showSelected:O=!1,onDropdownVisbilityChange:A,...e})=>{const[h,F]=o.useState(!1),[m,y]=o.useState(!1),r=j??"default",V=o.useRef(),[c,f]=o.useState(d??[]);function z(t){Array.isArray(t)?f([...t]):f([t]),q?.(t)}o.useEffect(()=>{const t=[];e?.options?.forEach(x=>{x.options?x.options.forEach(S=>{S.selected&&t.push({...S,label:S.label})}):x.selected&&t.push(x)}),f([...t])},[e.options]),o.useEffect(()=>{d&&f([...d])},[d]);const B=Q.getSelectedOptionsAsText(c),N=b?l:B??l??"Select an option",g=e.buttonWidth,R=g??e.width??"100%",U=e.dropdownWidth??R;return i.jsx(i.Fragment,{children:i.jsx(G.InputStyleContext.Provider,{value:{InputWrapper:{height:v||(r==="x-small"?24:r==="small"?32:48),width:R,...g?{maxWidth:g}:{},zIndex:1,cursor:"pointer",padding:r==="x-small"?"4px 8px":"6px 8px",backgroundColor:s&&a?n.COLORS.background.base:e.version==="3.0"?h||m?n.COLORS.surface.hovered:n.COLORS.surface.standard:O&&u!==void 0?n.BASE_COLORS.positive[100]:m&&!h?n.COLORS.background.inactive:n.COLORS.surface.standard,transition:"background-color 0.3s ease",...k},input:{minHeight:"100%",maxWidth:"100%",color:s&&a?n.COLORS.content.secondary:O&&u!==void 0?n.COLORS.content.positive:"inherit"}},children:i.jsx("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),style:e.width?{width:e.width}:void 0,children:i.jsxs(K.DropdownPopover,{"data-test":e["data-test"],ref:V,onSelect:z,disabled:s,...e,onDropdownVisbilityChange:t=>{F(t),A?.(t)},width:U,children:[C=="default"&&i.jsx(X.Input,{version:e.version,noErrorHint:W,state:s?"disabled":"none",solidDisabled:a,value:u===void 0?N:u,errorMessage:e.error,variant:r,placeholder:l??"Select an option",onChangeText:I,readOnly:!0,autoComplete:"off",leftIcon:T&&c[0]?.leadingIcon?{icon:()=>i.jsx(i.Fragment,{children:c[0]?.leadingIcon})}:void 0,rightIcon:{icon:()=>i.jsxs("div",{style:{display:"flex"},children:[p&&c[0]?.trailingIcon,i.jsx(_.default,{style:{transform:h?"rotate(180deg)":"rotate(0deg)"},onClick:I,width:r==="x-small"?16:r==="small"?20:24,height:r==="x-small"?16:r==="small"?20:24,color:O?n.COLORS.content.positive:n.COLORS.content.primary})]})},truncateText:M??!0}),C=="chip"&&i.jsx(J.default,{placeholder:l??"Select options",placeholderColor:s&&a?n.COLORS.content.secondary:void 0,chips:c,onDeleteChip:t=>{E?.(t)},errorMessage:e.error,isDropdownOpened:h,sizeToUse:r,containerStyle:{width:e.width??"100%",cursor:"pointer",...s&&a?{backgroundColor:n.COLORS.background.base,pointerEvents:"none"}:{}},showLabelsOnMoreHover:w})]})})})})};L.displayName="Dropdown";exports.Dropdown=L;
2
2
  //# sourceMappingURL=Dropdown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Dropdown.js","sources":["../../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import React, { Ref, useEffect, useRef, useState } from 'react';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport { Input } from '../input';\nimport { InputStyleContext } from '../input/context/InputStyleProvider';\nimport ChipInput from './ChipInput';\nimport { DropdownPopover } from './DropdownPopover';\nimport { getSelectedOptionsAsText } from './OpenedDropdown/utils/iterationOnOptions';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from './type';\n\nexport type DropdownProps = OpenDropdownProps & {\n\tplaceHolder?: string;\n\tsize?: 'default' | 'small' | 'x-small';\n\tdisabled?: boolean;\n\t/** When disabled, render a solid grey box (background.base) with secondary text and no opacity wash. */\n\tsolidDisabled?: boolean;\n\tnoErrorHint?: boolean;\n\tbuttonWidth?: string;\n\tplaceHolderHeight?: string;\n\tshowPlaceholderWhenSelected?: boolean;\n\tinputStyle?: React.CSSProperties;\n\tinputType?: 'chip' | 'default';\n\tonDeleteChip?: (chip: SingleOption) => void;\n\ttruncatedText?: boolean;\n\t'data-test'?: string;\n\tshowLeadingIconInPlaceholder?: boolean;\n\tshowTrailingIconPlaceholder?: boolean;\n\tshowLabelsOnMoreHover?: boolean;\n\tbackgroundColor?: string;\n\tvalue?: string;\n\tshowSelected?: boolean;\n\t/** Fired when the dropdown opens/closes. Runs alongside internal open state. */\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n};\n\nfunction noop() {\n\t/** empty */\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n\tplaceHolder,\n\tsize,\n\tonSelect,\n\tdefaultOptions,\n\tdisabled,\n\tsolidDisabled,\n\tnoErrorHint,\n\tplaceHolderHeight,\n\tshowPlaceholderWhenSelected = false,\n\tinputStyle = {},\n\tinputType = 'default',\n\tonDeleteChip,\n\ttruncatedText,\n\tshowLeadingIconInPlaceholder = false,\n\tshowTrailingIconPlaceholder = false,\n\tshowLabelsOnMoreHover = false,\n\tvalue,\n\tshowSelected = false,\n\tonDropdownVisbilityChange,\n\t...openDropdownProps\n}) => {\n\tconst [isDropdownOpened, setDropdownOpenFlag] = useState(false);\n\tconst [isHovering, setIsHovering] = useState(false);\n\tconst sizeToUse = size ?? 'default';\n\tconst dropdownVisibilityRef = useRef<{\n\t\topenDropdown: boolean;\n\t}>();\n\tconst [selectedOption, setSelectedOption] = useState<DropdownOption[]>(\n\t\tdefaultOptions ?? [],\n\t);\n\tfunction handleSelection(option: DropdownOption | DropdownOption[]) {\n\t\tif (Array.isArray(option)) {\n\t\t\tsetSelectedOption([...option]);\n\t\t} else {\n\t\t\tsetSelectedOption([...[option]]);\n\t\t}\n\t\tonSelect?.(option);\n\t}\n\n\tuseEffect(() => {\n\t\tconst flatSelectedOption: SingleOption[] = [];\n\t\topenDropdownProps?.options?.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((op) => {\n\t\t\t\t\tif (op.selected) {\n\t\t\t\t\t\tflatSelectedOption.push({\n\t\t\t\t\t\t\t...op,\n\t\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif ((option as SingleOption).selected) {\n\t\t\t\t\tflatSelectedOption.push(option as SingleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsetSelectedOption([...flatSelectedOption]);\n\t}, [openDropdownProps.options]);\n\n\tuseEffect(() => {\n\t\tif (defaultOptions) {\n\t\t\tsetSelectedOption([...defaultOptions]);\n\t\t}\n\t}, [defaultOptions]);\n\n\tconst textVal = getSelectedOptionsAsText(selectedOption);\n\tconst displayText = showPlaceholderWhenSelected\n\t\t? placeHolder\n\t\t: textVal ?? placeHolder ?? 'Select an option';\n\n\tconst configuredMaxWidth = openDropdownProps.buttonWidth;\n\n\t// Shared width for the input wrapper and dropdown popover\n\tconst inputWidth = configuredMaxWidth ?? openDropdownProps.width ?? '100%';\n\n\t// Width passed to dropdown popover — matches input box width\n\tconst dropdownWidth = openDropdownProps.dropdownWidth ?? inputWidth;\n\n\treturn (\n\t\t<>\n\t\t\t<InputStyleContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tInputWrapper: {\n\t\t\t\t\t\theight: placeHolderHeight\n\t\t\t\t\t\t\t? placeHolderHeight\n\t\t\t\t\t\t\t: sizeToUse === 'x-small'\n\t\t\t\t\t\t\t? 24\n\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t? 32\n\t\t\t\t\t\t\t: 48,\n\t\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t\t...(configuredMaxWidth ? { maxWidth: configuredMaxWidth } : {}),\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\tpadding: sizeToUse === 'x-small' ? '4px 8px' : '6px 8px',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t? COLORS.background.base\n\t\t\t\t\t\t\t\t: openDropdownProps.version === '3.0'\n\t\t\t\t\t\t\t\t? isDropdownOpened || isHovering\n\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t: COLORS.surface.standard\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? BASE_COLORS.positive['100']\n\t\t\t\t\t\t\t\t: // The hover wrapper also contains the popover, so while the\n\t\t\t\t\t\t\t\t// dropdown is open, hovering an option would grey the input\n\t\t\t\t\t\t\t\t// — only show hover feedback while closed.\n\t\t\t\t\t\t\t\tisHovering && !isDropdownOpened\n\t\t\t\t\t\t\t\t? COLORS.background.inactive\n\t\t\t\t\t\t\t\t: COLORS.surface.standard,\n\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t...inputStyle,\n\t\t\t\t\t},\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tminHeight: '100%',\n\t\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t? COLORS.content.secondary\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t: 'inherit',\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tonMouseEnter={() => setIsHovering(true)}\n\t\t\t\t\tonMouseLeave={() => setIsHovering(false)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\topenDropdownProps.width\n\t\t\t\t\t\t\t? { width: openDropdownProps.width }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\tref={\n\t\t\t\t\t\t\tdropdownVisibilityRef as Ref<{\n\t\t\t\t\t\t\t\topenDropdown: boolean;\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={handleSelection}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\tonDropdownVisbilityChange={(isOpen) => {\n\t\t\t\t\t\t\t// Keep the internal open flag (carat/open styling) AND forward\n\t\t\t\t\t\t\t// to a consumer-provided handler so callers can react to open state.\n\t\t\t\t\t\t\tsetDropdownOpenFlag(isOpen);\n\t\t\t\t\t\t\tonDropdownVisbilityChange?.(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={dropdownWidth}\n\t\t\t\t\t>\n\t\t\t\t\t\t{inputType == 'default' && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tversion={openDropdownProps.version}\n\t\t\t\t\t\t\t\tnoErrorHint={noErrorHint}\n\t\t\t\t\t\t\t\tstate={disabled ? 'disabled' : 'none'}\n\t\t\t\t\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\t\t\t\t\tvalue={value === undefined ? displayText : value}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tvariant={sizeToUse}\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select an option'}\n\t\t\t\t\t\t\t\tonChangeText={noop}\n\t\t\t\t\t\t\t\tleftIcon={\n\t\t\t\t\t\t\t\t\tshowLeadingIconInPlaceholder && selectedOption[0]?.leadingIcon\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\ticon: () => <>{selectedOption[0]?.leadingIcon}</>,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trightIcon={{\n\t\t\t\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{showTrailingIconPlaceholder &&\n\t\t\t\t\t\t\t\t\t\t\t\t(selectedOption[0] as SingleOption)?.trailingIcon}\n\t\t\t\t\t\t\t\t\t\t\t<DownIcon\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransform: isDropdownOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'rotate(180deg)'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'rotate(0deg)',\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={noop}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttruncateText={truncatedText ?? true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{inputType == 'chip' && (\n\t\t\t\t\t\t\t<ChipInput\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select options'}\n\t\t\t\t\t\t\t\tplaceholderColor={\n\t\t\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.secondary\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchips={selectedOption as SingleOption[]}\n\t\t\t\t\t\t\t\tonDeleteChip={(chip) => {\n\t\t\t\t\t\t\t\t\tonDeleteChip?.(chip);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tisDropdownOpened={isDropdownOpened}\n\t\t\t\t\t\t\t\tsizeToUse={sizeToUse}\n\t\t\t\t\t\t\t\tcontainerStyle={{\n\t\t\t\t\t\t\t\t\twidth: openDropdownProps.width ?? '100%',\n\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t\t...(disabled && solidDisabled\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: COLORS.background.base,\n\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowLabelsOnMoreHover={showLabelsOnMoreHover}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</InputStyleContext.Provider>\n\t\t</>\n\t);\n};\n\nDropdown.displayName = 'Dropdown';\n"],"names":["noop","Dropdown","placeHolder","size","onSelect","defaultOptions","disabled","solidDisabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","showSelected","onDropdownVisbilityChange","openDropdownProps","isDropdownOpened","setDropdownOpenFlag","useState","isHovering","setIsHovering","sizeToUse","dropdownVisibilityRef","useRef","selectedOption","setSelectedOption","handleSelection","option","useEffect","flatSelectedOption","op","textVal","getSelectedOptionsAsText","displayText","configuredMaxWidth","inputWidth","dropdownWidth","jsx","Fragment","InputStyleContext","COLORS","BASE_COLORS","jsxs","DropdownPopover","isOpen","Input","DownIcon","ChipInput","chip"],"mappings":"kbAwCA,SAASA,GAAO,CAEhB,CAEO,MAAMC,EAAoC,CAAC,CACjD,YAAAC,EACA,KAAAC,EACA,SAAAC,EACA,eAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,4BAAAC,EAA8B,GAC9B,WAAAC,EAAa,CAAA,EACb,UAAAC,EAAY,UACZ,aAAAC,EACA,cAAAC,EACA,6BAAAC,EAA+B,GAC/B,4BAAAC,EAA8B,GAC9B,sBAAAC,EAAwB,GACxB,MAAAC,EACA,aAAAC,EAAe,GACf,0BAAAC,EACA,GAAGC,CACJ,IAAM,CACL,KAAM,CAACC,EAAkBC,CAAmB,EAAIC,EAAAA,SAAS,EAAK,EACxD,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5CG,EAAYxB,GAAQ,UACpByB,EAAwBC,EAAAA,OAAA,EAGxB,CAACC,EAAgBC,CAAiB,EAAIP,EAAAA,SAC3CnB,GAAkB,CAAA,CAAC,EAEpB,SAAS2B,EAAgBC,EAA2C,CAC/D,MAAM,QAAQA,CAAM,EACvBF,EAAkB,CAAC,GAAGE,CAAM,CAAC,EAE7BF,EAAkB,CAAKE,CAAO,CAAC,EAEhC7B,IAAW6B,CAAM,CAClB,CAEAC,EAAAA,UAAU,IAAM,CACf,MAAMC,EAAqC,CAAA,EAC3Cd,GAAmB,SAAS,QAASY,GAAW,CAC1CA,EAAyB,QAC5BA,EAAyB,QAAQ,QAASG,GAAO,CAC7CA,EAAG,UACND,EAAmB,KAAK,CACvB,GAAGC,EACH,MAAOA,EAAG,KAAA,CACV,CAEH,CAAC,EAEIH,EAAwB,UAC5BE,EAAmB,KAAKF,CAAsB,CAGjD,CAAC,EAEDF,EAAkB,CAAC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AAK,EACA,eAAgB,CACf,MAAON,EAAkB,OAAS,OAClC,OAAQ,UACR,GAAIf,GAAYC,EACb,CACA,gBAAiBuC,EAAAA,OAAO,WAAW,KACnC,cAAe,MAAA,EAEf,CAAA,CAAC,EAEL,sBAAA7B,CAAA,CAAA,CACD,CAAA,CAAA,CAEF,CAAA,CACD,CAAA,EAEF,CAEF,EAEAhB,EAAS,YAAc"}
1
+ {"version":3,"file":"Dropdown.js","sources":["../../../../src/components/dropdown/Dropdown.tsx"],"sourcesContent":["import React, { Ref, useEffect, useRef, useState } from 'react';\nimport { BASE_COLORS, COLORS } from '@src/constants/Theme';\nimport DownIcon from '../../assets/icons/chevronDown.svg';\nimport { Input } from '../input';\nimport { InputStyleContext } from '../input/context/InputStyleProvider';\nimport ChipInput from './ChipInput';\nimport { DropdownPopover } from './DropdownPopover';\nimport { getSelectedOptionsAsText } from './OpenedDropdown/utils/iterationOnOptions';\nimport {\n\tDropdownOption,\n\tGroupedOption,\n\tOpenDropdownProps,\n\tSingleOption,\n} from './type';\n\nexport type DropdownProps = OpenDropdownProps & {\n\tplaceHolder?: string;\n\tsize?: 'default' | 'small' | 'x-small';\n\tdisabled?: boolean;\n\t/** When disabled, render a solid grey box (background.base) with secondary text and no opacity wash. */\n\tsolidDisabled?: boolean;\n\tnoErrorHint?: boolean;\n\tbuttonWidth?: string;\n\tplaceHolderHeight?: string;\n\tshowPlaceholderWhenSelected?: boolean;\n\tinputStyle?: React.CSSProperties;\n\tinputType?: 'chip' | 'default';\n\tonDeleteChip?: (chip: SingleOption) => void;\n\ttruncatedText?: boolean;\n\t'data-test'?: string;\n\tshowLeadingIconInPlaceholder?: boolean;\n\tshowTrailingIconPlaceholder?: boolean;\n\tshowLabelsOnMoreHover?: boolean;\n\tbackgroundColor?: string;\n\tvalue?: string;\n\tshowSelected?: boolean;\n\t/** Fired when the dropdown opens/closes. Runs alongside internal open state. */\n\tonDropdownVisbilityChange?: (isOpen: boolean) => void;\n};\n\nfunction noop() {\n\t/** empty */\n}\n\nexport const Dropdown: React.FC<DropdownProps> = ({\n\tplaceHolder,\n\tsize,\n\tonSelect,\n\tdefaultOptions,\n\tdisabled,\n\tsolidDisabled,\n\tnoErrorHint,\n\tplaceHolderHeight,\n\tshowPlaceholderWhenSelected = false,\n\tinputStyle = {},\n\tinputType = 'default',\n\tonDeleteChip,\n\ttruncatedText,\n\tshowLeadingIconInPlaceholder = false,\n\tshowTrailingIconPlaceholder = false,\n\tshowLabelsOnMoreHover = false,\n\tvalue,\n\tshowSelected = false,\n\tonDropdownVisbilityChange,\n\t...openDropdownProps\n}) => {\n\tconst [isDropdownOpened, setDropdownOpenFlag] = useState(false);\n\tconst [isHovering, setIsHovering] = useState(false);\n\tconst sizeToUse = size ?? 'default';\n\tconst dropdownVisibilityRef = useRef<{\n\t\topenDropdown: boolean;\n\t}>();\n\tconst [selectedOption, setSelectedOption] = useState<DropdownOption[]>(\n\t\tdefaultOptions ?? [],\n\t);\n\tfunction handleSelection(option: DropdownOption | DropdownOption[]) {\n\t\tif (Array.isArray(option)) {\n\t\t\tsetSelectedOption([...option]);\n\t\t} else {\n\t\t\tsetSelectedOption([...[option]]);\n\t\t}\n\t\tonSelect?.(option);\n\t}\n\n\tuseEffect(() => {\n\t\tconst flatSelectedOption: SingleOption[] = [];\n\t\topenDropdownProps?.options?.forEach((option) => {\n\t\t\tif ((option as GroupedOption).options) {\n\t\t\t\t(option as GroupedOption).options.forEach((op) => {\n\t\t\t\t\tif (op.selected) {\n\t\t\t\t\t\tflatSelectedOption.push({\n\t\t\t\t\t\t\t...op,\n\t\t\t\t\t\t\tlabel: op.label,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tif ((option as SingleOption).selected) {\n\t\t\t\t\tflatSelectedOption.push(option as SingleOption);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tsetSelectedOption([...flatSelectedOption]);\n\t}, [openDropdownProps.options]);\n\n\tuseEffect(() => {\n\t\tif (defaultOptions) {\n\t\t\tsetSelectedOption([...defaultOptions]);\n\t\t}\n\t}, [defaultOptions]);\n\n\tconst textVal = getSelectedOptionsAsText(selectedOption);\n\tconst displayText = showPlaceholderWhenSelected\n\t\t? placeHolder\n\t\t: textVal ?? placeHolder ?? 'Select an option';\n\n\tconst configuredMaxWidth = openDropdownProps.buttonWidth;\n\n\t// Shared width for the input wrapper and dropdown popover\n\tconst inputWidth = configuredMaxWidth ?? openDropdownProps.width ?? '100%';\n\n\t// Width passed to dropdown popover — matches input box width\n\tconst dropdownWidth = openDropdownProps.dropdownWidth ?? inputWidth;\n\n\treturn (\n\t\t<>\n\t\t\t<InputStyleContext.Provider\n\t\t\t\tvalue={{\n\t\t\t\t\tInputWrapper: {\n\t\t\t\t\t\theight: placeHolderHeight\n\t\t\t\t\t\t\t? placeHolderHeight\n\t\t\t\t\t\t\t: sizeToUse === 'x-small'\n\t\t\t\t\t\t\t? 24\n\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t? 32\n\t\t\t\t\t\t\t: 48,\n\t\t\t\t\t\twidth: inputWidth,\n\t\t\t\t\t\t...(configuredMaxWidth ? { maxWidth: configuredMaxWidth } : {}),\n\t\t\t\t\t\tzIndex: 1,\n\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\tpadding: sizeToUse === 'x-small' ? '4px 8px' : '6px 8px',\n\t\t\t\t\t\tbackgroundColor:\n\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t? COLORS.background.base\n\t\t\t\t\t\t\t\t: openDropdownProps.version === '3.0'\n\t\t\t\t\t\t\t\t? isDropdownOpened || isHovering\n\t\t\t\t\t\t\t\t\t? COLORS.surface.hovered\n\t\t\t\t\t\t\t\t\t: COLORS.surface.standard\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? BASE_COLORS.positive['100']\n\t\t\t\t\t\t\t\t: // The hover wrapper also contains the popover, so while the\n\t\t\t\t\t\t\t\t// dropdown is open, hovering an option would grey the input\n\t\t\t\t\t\t\t\t// — only show hover feedback while closed.\n\t\t\t\t\t\t\t\tisHovering && !isDropdownOpened\n\t\t\t\t\t\t\t\t? COLORS.background.inactive\n\t\t\t\t\t\t\t\t: COLORS.surface.standard,\n\t\t\t\t\t\ttransition: 'background-color 0.3s ease',\n\t\t\t\t\t\t...inputStyle,\n\t\t\t\t\t},\n\t\t\t\t\tinput: {\n\t\t\t\t\t\tminHeight: '100%',\n\t\t\t\t\t\tmaxWidth: '100%',\n\t\t\t\t\t\tcolor:\n\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t? COLORS.content.secondary\n\t\t\t\t\t\t\t\t: showSelected && value !== undefined\n\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t: 'inherit',\n\t\t\t\t\t},\n\t\t\t\t}}\n\t\t\t>\n\t\t\t\t<div\n\t\t\t\t\tonMouseEnter={() => setIsHovering(true)}\n\t\t\t\t\tonMouseLeave={() => setIsHovering(false)}\n\t\t\t\t\tstyle={\n\t\t\t\t\t\topenDropdownProps.width\n\t\t\t\t\t\t\t? { width: openDropdownProps.width }\n\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t}\n\t\t\t\t>\n\t\t\t\t\t<DropdownPopover\n\t\t\t\t\t\tdata-test={openDropdownProps['data-test']}\n\t\t\t\t\t\tref={\n\t\t\t\t\t\t\tdropdownVisibilityRef as Ref<{\n\t\t\t\t\t\t\t\topenDropdown: boolean;\n\t\t\t\t\t\t\t}>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tonSelect={handleSelection}\n\t\t\t\t\t\tdisabled={disabled}\n\t\t\t\t\t\t{...openDropdownProps}\n\t\t\t\t\t\tonDropdownVisbilityChange={(isOpen) => {\n\t\t\t\t\t\t\t// Keep the internal open flag (carat/open styling) AND forward\n\t\t\t\t\t\t\t// to a consumer-provided handler so callers can react to open state.\n\t\t\t\t\t\t\tsetDropdownOpenFlag(isOpen);\n\t\t\t\t\t\t\tonDropdownVisbilityChange?.(isOpen);\n\t\t\t\t\t\t}}\n\t\t\t\t\t\twidth={dropdownWidth}\n\t\t\t\t\t>\n\t\t\t\t\t\t{inputType == 'default' && (\n\t\t\t\t\t\t\t<Input\n\t\t\t\t\t\t\t\tversion={openDropdownProps.version}\n\t\t\t\t\t\t\t\tnoErrorHint={noErrorHint}\n\t\t\t\t\t\t\t\tstate={disabled ? 'disabled' : 'none'}\n\t\t\t\t\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\t\t\t\t\tvalue={value === undefined ? displayText : value}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tvariant={sizeToUse}\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select an option'}\n\t\t\t\t\t\t\t\tonChangeText={noop}\n\t\t\t\t\t\t\t\t// Display-only box (onChangeText is noop) — readOnly keeps\n\t\t\t\t\t\t\t\t// browser autofill from writing an address into it.\n\t\t\t\t\t\t\t\treadOnly\n\t\t\t\t\t\t\t\tautoComplete=\"off\"\n\t\t\t\t\t\t\t\tleftIcon={\n\t\t\t\t\t\t\t\t\tshowLeadingIconInPlaceholder && selectedOption[0]?.leadingIcon\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\ticon: () => <>{selectedOption[0]?.leadingIcon}</>,\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\trightIcon={{\n\t\t\t\t\t\t\t\t\ticon: () => (\n\t\t\t\t\t\t\t\t\t\t<div\n\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{showTrailingIconPlaceholder &&\n\t\t\t\t\t\t\t\t\t\t\t\t(selectedOption[0] as SingleOption)?.trailingIcon}\n\t\t\t\t\t\t\t\t\t\t\t<DownIcon\n\t\t\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\t\t\ttransform: isDropdownOpened\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 'rotate(180deg)'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 'rotate(0deg)',\n\t\t\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\t\t\tonClick={noop}\n\t\t\t\t\t\t\t\t\t\t\t\twidth={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\theight={\n\t\t\t\t\t\t\t\t\t\t\t\t\tsizeToUse === 'x-small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 16\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: sizeToUse === 'small'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? 20\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: 24\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\t\tshowSelected\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.positive\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t: COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\ttruncateText={truncatedText ?? true}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{inputType == 'chip' && (\n\t\t\t\t\t\t\t<ChipInput\n\t\t\t\t\t\t\t\tplaceholder={placeHolder ?? 'Select options'}\n\t\t\t\t\t\t\t\tplaceholderColor={\n\t\t\t\t\t\t\t\t\tdisabled && solidDisabled\n\t\t\t\t\t\t\t\t\t\t? COLORS.content.secondary\n\t\t\t\t\t\t\t\t\t\t: undefined\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tchips={selectedOption as SingleOption[]}\n\t\t\t\t\t\t\t\tonDeleteChip={(chip) => {\n\t\t\t\t\t\t\t\t\tonDeleteChip?.(chip);\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\terrorMessage={openDropdownProps.error}\n\t\t\t\t\t\t\t\tisDropdownOpened={isDropdownOpened}\n\t\t\t\t\t\t\t\tsizeToUse={sizeToUse}\n\t\t\t\t\t\t\t\tcontainerStyle={{\n\t\t\t\t\t\t\t\t\twidth: openDropdownProps.width ?? '100%',\n\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t\t...(disabled && solidDisabled\n\t\t\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: COLORS.background.base,\n\t\t\t\t\t\t\t\t\t\t\t\tpointerEvents: 'none',\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\tshowLabelsOnMoreHover={showLabelsOnMoreHover}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</DropdownPopover>\n\t\t\t\t</div>\n\t\t\t</InputStyleContext.Provider>\n\t\t</>\n\t);\n};\n\nDropdown.displayName = 'Dropdown';\n"],"names":["noop","Dropdown","placeHolder","size","onSelect","defaultOptions","disabled","solidDisabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","showSelected","onDropdownVisbilityChange","openDropdownProps","isDropdownOpened","setDropdownOpenFlag","useState","isHovering","setIsHovering","sizeToUse","dropdownVisibilityRef","useRef","selectedOption","setSelectedOption","handleSelection","option","useEffect","flatSelectedOption","op","textVal","getSelectedOptionsAsText","displayText","configuredMaxWidth","inputWidth","dropdownWidth","jsx","Fragment","InputStyleContext","COLORS","BASE_COLORS","jsxs","DropdownPopover","isOpen","Input","DownIcon","ChipInput","chip"],"mappings":"kbAwCA,SAASA,GAAO,CAEhB,CAEO,MAAMC,EAAoC,CAAC,CACjD,YAAAC,EACA,KAAAC,EACA,SAAAC,EACA,eAAAC,EACA,SAAAC,EACA,cAAAC,EACA,YAAAC,EACA,kBAAAC,EACA,4BAAAC,EAA8B,GAC9B,WAAAC,EAAa,CAAA,EACb,UAAAC,EAAY,UACZ,aAAAC,EACA,cAAAC,EACA,6BAAAC,EAA+B,GAC/B,4BAAAC,EAA8B,GAC9B,sBAAAC,EAAwB,GACxB,MAAAC,EACA,aAAAC,EAAe,GACf,0BAAAC,EACA,GAAGC,CACJ,IAAM,CACL,KAAM,CAACC,EAAkBC,CAAmB,EAAIC,EAAAA,SAAS,EAAK,EACxD,CAACC,EAAYC,CAAa,EAAIF,EAAAA,SAAS,EAAK,EAC5CG,EAAYxB,GAAQ,UACpByB,EAAwBC,EAAAA,OAAA,EAGxB,CAACC,EAAgBC,CAAiB,EAAIP,EAAAA,SAC3CnB,GAAkB,CAAA,CAAC,EAEpB,SAAS2B,EAAgBC,EAA2C,CAC/D,MAAM,QAAQA,CAAM,EACvBF,EAAkB,CAAC,GAAGE,CAAM,CAAC,EAE7BF,EAAkB,CAAKE,CAAO,CAAC,EAEhC7B,IAAW6B,CAAM,CAClB,CAEAC,EAAAA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AA,OAAO,QAAQ,OAAA,CAAA,CAEpB,CAAA,CAAA,CACD,EAGF,aAAchC,GAAiB,EAAA,CAAA,EAGhCF,GAAa,QACb+B,EAAAA,IAACU,EAAAA,QAAA,CACA,YAAanD,GAAe,iBAC5B,iBACCI,GAAYC,EACTuC,EAAAA,OAAO,QAAQ,UACf,OAEJ,MAAOhB,EACP,aAAewB,GAAS,CACvBzC,IAAeyC,CAAI,CACpB,EACA,aAAcjC,EAAkB,MAChC,iBAAAC,EACA,UAAAK,EACA,eAAgB,CACf,MAAON,EAAkB,OAAS,OAClC,OAAQ,UACR,GAAIf,GAAYC,EACb,CACA,gBAAiBuC,EAAAA,OAAO,WAAW,KACnC,cAAe,MAAA,EAEf,CAAA,CAAC,EAEL,sBAAA7B,CAAA,CAAA,CACD,CAAA,CAAA,CAEF,CAAA,CACD,CAAA,EAEF,CAEF,EAEAhB,EAAS,YAAc"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),Le=require("../../assets/icons/info.svg.js"),we=require("../../helpers/sanitize.js"),l=require("react"),m=require("./Input-helper.js"),ne=require("../TypographyStyle.js"),ie=require("../../constants/Theme.js"),He=require("../../assets/icons/errorInfo.svg.js"),Re=require("./context/InputStyleProvider.js"),r=require("./Input.styled.js"),le=require("../button/Button.js"),_e=require("../tooltips/Tooltip.js"),re=l.forwardRef((e,se)=>{const{placeholder:H,leftIcon:R,rightIcon:v,labelText:T,maxCharLimit:a,isRequired:_,hintText:p,type:c,state:j,validate:ae,variant:o,button:h,suffixText:F,prefixText:k,onChangeText:A,value:x,noErrorHint:oe,reset:O,rangeValidation:ce,noKeyDownChange:ue,version:he,noMaxCharCheck:q,labelElement:B,autoGrow:S,minHeight:b,maxHeight:de,labelTextBold:fe,truncateText:xe,maxCharLimitPosition:D,maxCharStyle:z,hightlightInputColor:ge,onKeyDownEvent:P,hideInputHeader:Ie,hideBorder:me,inputWrapperStyles:ye,minCharsToTrigger:K,maxCharAlignment:Ce,isDisabled:N=!1,solidDisabled:V=!1,allowUnsafeInput:ve,preventFormulaInjection:Te,leftIconStyle:je}={maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP",minCharsToTrigger:0,maxCharAlignment:!1,...e},W=R?.icon,X=v?.icon,[M,y]=l.useState(!1),[Se,E]=l.useState(!1),[d,U]=l.useState(),G=o==="x-small"?"12px":o==="small"?"18px":"22px",C=l.useContext(Re.InputStyleContext),[Y,L]=l.useState(""),be=l.useRef(null),s=se??be;l.useEffect(()=>{L(x||""),!x&&S&&(s.current.style.height=b||"48px")},[x]),l.useEffect(()=>{s.current&&e.onReferenceInit?.(s.current)},[s]),l.useEffect(()=>{const t=s.current;if(t&&["phonenumber","zip","number"].includes(c))return t.addEventListener("wheel",Q,{passive:!1}),()=>{t.removeEventListener("wheel",Q)}},[]),l.useEffect(()=>{O&&L("")},[O]),l.useEffect(()=>{E(!!e.isActive),e.isActive&&s.current?.focus()},[e.isActive]),l.useEffect(()=>{U(e.errorMessage)},[e.errorMessage]),l.useEffect(()=>{y(!1),(e.state==="invalid"||d||e.state==="disabled-invalid")&&y(!0),e.state==="active"&&s.current?.focus()},[e.state,d]),l.useEffect(()=>{y(!!d||e.state==="invalid")},[d,e.state]);const f=(t,...i)=>{m.isFunction(t)&&t(...i)},$=()=>c==="zip"?6:2e3,J=t=>{const i=a!==0?a:$(),g=[8],I=K,u=t.target.value;P&&(!u.length||u.length>=I)&&P(t),!ue&&(!u.length||u.length>=I)&&A(x||"",t),!q&&!g.includes(t.which)&&i>0&&u.length>=i&&t.preventDefault()},Q=t=>{t.preventDefault()},Z=t=>{let i=t.target.value;const g=a!==0?a+1:$(),I=K;if(!ve&&m.shouldSanitizeForType(c)&&(i=m.sanitizeUnsafeInput(i)),Te&&(i=we.escapeFormulaInjection(i)),!q&&g>0&&i.length>=g&&(i=i.substring(0,g-1)),e.textControl||L(i||""),I&&i&&i.length<I)return;A(i,t),S&&(s.current.style.height=`${s.current.scrollHeight}px`,i||(s.current.style.height=b||"48px"));const u=ae||m.validateInput;if(!u||!m.isFunction(u))return;const[Me,Ee]=u(i,c,ce);y(!Me),U(e.errorMessage?e.errorMessage:Ee)},ee=t=>{e.skipFocus||E(!0),f(e.onFocus?.(t))},te=t=>{e.skipFocus||E(!1),f(e.onBlur?.(t))},w=()=>n.jsxs(n.Fragment,{children:[c!=="multiline"&&n.jsx("input",{className:xe?"truncate-class":"","data-test":e["data-test"],id:e.id,style:C?.input??{},ref:s,disabled:N,type:["phonenumber","zip","number"].includes(c)?"number":c,value:Y,onFocus:t=>ee(t),onBlur:t=>te(t),placeholder:H||"Enter here",onChange:Z,onClick:t=>f(e.onClick),onKeyDown:t=>J(t)}),c==="multiline"&&n.jsx("textarea",{"data-test":e["data-test"],value:Y,ref:s,onFocus:t=>ee(t),onBlur:t=>te(t),onClick:t=>f(e.onClick),disabled:N,placeholder:H||"Enter here",onChange:Z,onKeyDown:t=>J(t),maxLength:a>0?a:void 0})]});return n.jsxs(r.RootContainer,{width:e.width,height:e.height,state:j,solidDisabled:V,type:c,style:C?.RootContainer??{},children:[n.jsxs("div",{className:"flex-align-center",children:[!oe&&(!!p||!!d)&&n.jsxs(r.InputFooter,{invalid:!!d,children:[!!d&&n.jsx(He.default,{width:16,height:16}),d||p]}),a>0&&D==="BOTTOM"&&n.jsxs(r.MaxCharStyle,{position:"BOTTOM",style:z,children:[(x??"").toString()?.length??0,"/",a]})]}),n.jsxs(r.InputWrapper,{variant:o,state:j,solidDisabled:V,width:e.width,isActive:j==="active"||Se,isInvalid:M,style:C?.InputWrapper??ye??{},version:he,height:e.height,hightlightInputColor:ge,hideBorder:me,children:[!!W&&n.jsx(r.IconHolder,{variant:o,iconSize:G,onClick:()=>f(R?.callback),isLeft:!0,style:{...C?.IconHolder??{},...je},children:n.jsx(W,{})}),!!k&&n.jsx(r.PrefixHolder,{variant:o,children:k}),o==="default"&&n.jsx(r.InputContainer,{height:e.height,type:e.type,minHeight:b,maxHeight:de,autoGrow:S,children:w()}),o==="small"&&n.jsx(r.InputContainerSmall,{height:e.height,type:e.type,children:w()}),o==="x-small"&&n.jsx(r.InputContainerXSmall,{height:e.height,type:e.type,children:w()}),!!X&&n.jsx(r.IconHolder,{variant:o,iconSize:G,onClick:()=>f(v?.callback),isLeft:!1,"data-test":v?.["data-test"],children:n.jsx(X,{})}),!!F&&n.jsx(r.SuffixHolder,{variant:o,children:F}),h&&h.text&&n.jsx(le.Button,{buttonText:h.text,buttonType:h.buttonType,onClick:()=>f(h?.onClick)}),h&&h.buttonProps&&n.jsx(le.Button,{...h.buttonProps})]}),!Ie&&(!!T||!!a)&&n.jsxs(r.InputHeader,{invalid:M,maxCharAlignment:Ce,children:[B&&B,n.jsxs("div",{className:"label__container",children:[fe?n.jsxs(ne.TitleSmall,{children:[T,_?n.jsx("span",{children:"*"}):""]}):n.jsxs(ne.BodySecondary,{children:[T,_?n.jsx("span",{children:"*"}):""]}),e.tooltipText&&n.jsx(_e.Tooltip,{body:e.tooltipText,placement:"top",children:n.jsx("span",{children:n.jsx(Le.default,{"data-test":"input-tooltip-icon",style:{marginTop:-3},width:e.tooltipIconSize??18,height:e.tooltipIconSize??18,color:M?ie.COLORS.content.negative:e.tooltipIconColor??ie.COLORS.content.primary})})})]}),a>0&&D==="TOP"&&n.jsxs(r.MaxCharStyle,{style:z,children:[(x??"").toString()?.length??0,"/",a]})]})]})});re.displayName="Input";exports.Input=re;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),Le=require("../../assets/icons/info.svg.js"),we=require("../../helpers/sanitize.js"),l=require("react"),I=require("./Input-helper.js"),ne=require("../TypographyStyle.js"),ie=require("../../constants/Theme.js"),He=require("../../assets/icons/errorInfo.svg.js"),Oe=require("./context/InputStyleProvider.js"),r=require("./Input.styled.js"),le=require("../button/Button.js"),Re=require("../tooltips/Tooltip.js"),re=l.forwardRef((e,ae)=>{const{placeholder:H,leftIcon:O,rightIcon:v,labelText:T,maxCharLimit:s,isRequired:R,hintText:_,type:c,state:j,validate:se,variant:o,button:h,suffixText:F,prefixText:k,onChangeText:A,value:x,noErrorHint:oe,reset:p,rangeValidation:ce,noKeyDownChange:ue,version:he,noMaxCharCheck:q,labelElement:B,autoGrow:S,minHeight:b,maxHeight:de,labelTextBold:fe,truncateText:xe,maxCharLimitPosition:D,maxCharStyle:z,hightlightInputColor:ge,onKeyDownEvent:P,hideInputHeader:me,hideBorder:Ie,inputWrapperStyles:ye,minCharsToTrigger:K,maxCharAlignment:Ce,isDisabled:N=!1,solidDisabled:V=!1,allowUnsafeInput:ve,preventFormulaInjection:Te,leftIconStyle:je}={maxCharLimit:0,type:"text",variant:"default",maxCharLimitPosition:"TOP",minCharsToTrigger:0,maxCharAlignment:!1,...e},W=O?.icon,X=v?.icon,[M,y]=l.useState(!1),[Se,E]=l.useState(!1),[d,U]=l.useState(),G=o==="x-small"?"12px":o==="small"?"18px":"22px",C=l.useContext(Oe.InputStyleContext),[Y,L]=l.useState(""),be=l.useRef(null),a=ae??be;l.useEffect(()=>{L(x||""),!x&&S&&(a.current.style.height=b||"48px")},[x]),l.useEffect(()=>{a.current&&e.onReferenceInit?.(a.current)},[a]),l.useEffect(()=>{const t=a.current;if(t&&["phonenumber","zip","number"].includes(c))return t.addEventListener("wheel",Q,{passive:!1}),()=>{t.removeEventListener("wheel",Q)}},[]),l.useEffect(()=>{p&&L("")},[p]),l.useEffect(()=>{E(!!e.isActive),e.isActive&&a.current?.focus()},[e.isActive]),l.useEffect(()=>{U(e.errorMessage)},[e.errorMessage]),l.useEffect(()=>{y(!1),(e.state==="invalid"||d||e.state==="disabled-invalid")&&y(!0),e.state==="active"&&a.current?.focus()},[e.state,d]),l.useEffect(()=>{y(!!d||e.state==="invalid")},[d,e.state]);const f=(t,...i)=>{I.isFunction(t)&&t(...i)},$=()=>c==="zip"?6:2e3,J=t=>{const i=s!==0?s:$(),g=[8],m=K,u=t.target.value;P&&(!u.length||u.length>=m)&&P(t),!ue&&(!u.length||u.length>=m)&&A(x||"",t),!q&&!g.includes(t.which)&&i>0&&u.length>=i&&t.preventDefault()},Q=t=>{t.preventDefault()},Z=t=>{let i=t.target.value;const g=s!==0?s+1:$(),m=K;if(!ve&&I.shouldSanitizeForType(c)&&(i=I.sanitizeUnsafeInput(i)),Te&&(i=we.escapeFormulaInjection(i)),!q&&g>0&&i.length>=g&&(i=i.substring(0,g-1)),e.textControl||L(i||""),m&&i&&i.length<m)return;A(i,t),S&&(a.current.style.height=`${a.current.scrollHeight}px`,i||(a.current.style.height=b||"48px"));const u=se||I.validateInput;if(!u||!I.isFunction(u))return;const[Me,Ee]=u(i,c,ce);y(!Me),U(e.errorMessage?e.errorMessage:Ee)},ee=t=>{e.skipFocus||E(!0),f(e.onFocus?.(t))},te=t=>{e.skipFocus||E(!1),f(e.onBlur?.(t))},w=()=>n.jsxs(n.Fragment,{children:[c!=="multiline"&&n.jsx("input",{className:xe?"truncate-class":"","data-test":e["data-test"],id:e.id,style:C?.input??{},ref:a,disabled:N,type:["phonenumber","zip","number"].includes(c)?"number":c,value:Y,readOnly:e.readOnly,autoComplete:e.autoComplete,onFocus:t=>ee(t),onBlur:t=>te(t),placeholder:H||"Enter here",onChange:Z,onClick:t=>f(e.onClick),onKeyDown:t=>J(t)}),c==="multiline"&&n.jsx("textarea",{"data-test":e["data-test"],value:Y,ref:a,onFocus:t=>ee(t),onBlur:t=>te(t),onClick:t=>f(e.onClick),disabled:N,placeholder:H||"Enter here",onChange:Z,onKeyDown:t=>J(t),maxLength:s>0?s:void 0})]});return n.jsxs(r.RootContainer,{width:e.width,height:e.height,state:j,solidDisabled:V,type:c,style:C?.RootContainer??{},children:[n.jsxs("div",{className:"flex-align-center",children:[!oe&&(!!_||!!d)&&n.jsxs(r.InputFooter,{invalid:!!d,children:[!!d&&n.jsx(He.default,{width:16,height:16}),d||_]}),s>0&&D==="BOTTOM"&&n.jsxs(r.MaxCharStyle,{position:"BOTTOM",style:z,children:[(x??"").toString()?.length??0,"/",s]})]}),n.jsxs(r.InputWrapper,{variant:o,state:j,solidDisabled:V,width:e.width,isActive:j==="active"||Se,isInvalid:M,style:C?.InputWrapper??ye??{},version:he,height:e.height,hightlightInputColor:ge,hideBorder:Ie,children:[!!W&&n.jsx(r.IconHolder,{variant:o,iconSize:G,onClick:()=>f(O?.callback),isLeft:!0,style:{...C?.IconHolder??{},...je},children:n.jsx(W,{})}),!!k&&n.jsx(r.PrefixHolder,{variant:o,children:k}),o==="default"&&n.jsx(r.InputContainer,{height:e.height,type:e.type,minHeight:b,maxHeight:de,autoGrow:S,children:w()}),o==="small"&&n.jsx(r.InputContainerSmall,{height:e.height,type:e.type,children:w()}),o==="x-small"&&n.jsx(r.InputContainerXSmall,{height:e.height,type:e.type,children:w()}),!!X&&n.jsx(r.IconHolder,{variant:o,iconSize:G,onClick:()=>f(v?.callback),isLeft:!1,"data-test":v?.["data-test"],children:n.jsx(X,{})}),!!F&&n.jsx(r.SuffixHolder,{variant:o,children:F}),h&&h.text&&n.jsx(le.Button,{buttonText:h.text,buttonType:h.buttonType,onClick:()=>f(h?.onClick)}),h&&h.buttonProps&&n.jsx(le.Button,{...h.buttonProps})]}),!me&&(!!T||!!s)&&n.jsxs(r.InputHeader,{invalid:M,maxCharAlignment:Ce,children:[B&&B,n.jsxs("div",{className:"label__container",children:[fe?n.jsxs(ne.TitleSmall,{children:[T,R?n.jsx("span",{children:"*"}):""]}):n.jsxs(ne.BodySecondary,{children:[T,R?n.jsx("span",{children:"*"}):""]}),e.tooltipText&&n.jsx(Re.Tooltip,{body:e.tooltipText,placement:"top",children:n.jsx("span",{children:n.jsx(Le.default,{"data-test":"input-tooltip-icon",style:{marginTop:-3},width:e.tooltipIconSize??18,height:e.tooltipIconSize??18,color:M?ie.COLORS.content.negative:e.tooltipIconColor??ie.COLORS.content.primary})})})]}),s>0&&D==="TOP"&&n.jsxs(r.MaxCharStyle,{style:z,children:[(x??"").toString()?.length??0,"/",s]})]})]})});re.displayName="Input";exports.Input=re;
2
2
  //# sourceMappingURL=Input.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input.js","sources":["../../../../src/components/input/Input.tsx"],"sourcesContent":["import InfoIcon from '@src/assets/icons/info.svg';\nimport { escapeFormulaInjection } from '@src/helpers/sanitize';\nimport React, {\n\tforwardRef,\n\tMutableRefObject,\n\tRef,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { Button } from '@src/components/button';\nimport {\n\tisFunction,\n\tsanitizeUnsafeInput,\n\tshouldSanitizeForType,\n\tvalidateInput,\n} from '@src/components/input/Input-helper';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodySecondary, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport ErrorIcon from '../../assets/icons/errorInfo.svg';\nimport { InputStyleContext } from './context/InputStyleProvider';\nimport { InputProps, InputTypeI, InputVariant } from './Input.model';\nimport * as SC from './Input.styled';\nimport { PrefixHolder, SuffixHolder } from './Input.styled';\n\nexport const Input = forwardRef(\n\t(\n\t\tprops: InputProps,\n\t\tfRef: React.ForwardedRef<HTMLInputElement | HTMLTextAreaElement | null>,\n\t) => {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tleftIcon,\n\t\t\trightIcon,\n\t\t\tlabelText,\n\t\t\tmaxCharLimit,\n\t\t\tisRequired,\n\t\t\thintText,\n\t\t\ttype,\n\t\t\tstate,\n\t\t\tvalidate,\n\t\t\tvariant,\n\t\t\tbutton,\n\t\t\tsuffixText,\n\t\t\tprefixText,\n\t\t\tonChangeText,\n\t\t\tvalue,\n\t\t\tnoErrorHint,\n\t\t\treset,\n\t\t\trangeValidation,\n\t\t\tnoKeyDownChange,\n\t\t\tversion,\n\t\t\tnoMaxCharCheck,\n\t\t\tlabelElement,\n\t\t\tautoGrow,\n\t\t\tminHeight,\n\t\t\tmaxHeight,\n\t\t\tlabelTextBold,\n\t\t\ttruncateText,\n\t\t\tmaxCharLimitPosition,\n\t\t\tmaxCharStyle,\n\t\t\thightlightInputColor,\n\t\t\tonKeyDownEvent,\n\t\t\thideInputHeader,\n\t\t\thideBorder,\n\t\t\tinputWrapperStyles,\n\t\t\tminCharsToTrigger,\n\t\t\tmaxCharAlignment,\n\t\t\tisDisabled = false,\n\t\t\tsolidDisabled = false,\n\t\t\tallowUnsafeInput,\n\t\t\tpreventFormulaInjection,\n\t\t\tleftIconStyle,\n\t\t} = {\n\t\t\tmaxCharLimit: 0,\n\t\t\ttype: 'text' as InputTypeI,\n\t\t\tvariant: 'default' as InputVariant,\n\t\t\tmaxCharLimitPosition: 'TOP',\n\t\t\tminCharsToTrigger: 0,\n\t\t\tmaxCharAlignment: false,\n\t\t\t...props,\n\t\t};\n\t\tconst LeftIcon = leftIcon?.icon;\n\t\tconst RightIcon = rightIcon?.icon;\n\t\tconst [isInvalid, setIsInvalid] = useState<boolean>(false);\n\t\tconst [isActive, setIsActive] = useState<boolean>(false);\n\t\tconst [errorMessage, setErrorMessage] = useState<string>();\n\t\tconst iconSize =\n\t\t\tvariant === 'x-small' ? '12px' : variant === 'small' ? '18px' : '22px';\n\t\tconst stylesFromOutside = useContext(InputStyleContext);\n\t\tconst [inputValue, setInputValue] = useState<string>('');\n\t\tconst _ref = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n\t\tconst inputRef: MutableRefObject<HTMLInputElement | HTMLTextAreaElement> =\n\t\t\t(fRef ?? _ref) as MutableRefObject<\n\t\t\t\tHTMLInputElement | HTMLTextAreaElement\n\t\t\t>;\n\n\t\tuseEffect(() => {\n\t\t\tsetInputValue(value || '');\n\t\t\tif (!value && autoGrow) {\n\t\t\t\tinputRef.current.style.height = minHeight || '48px';\n\t\t\t}\n\t\t}, [value]);\n\n\t\tuseEffect(() => {\n\t\t\tif (!inputRef.current) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprops.onReferenceInit?.(inputRef.current);\n\t\t}, [inputRef]);\n\n\t\tuseEffect(() => {\n\t\t\tconst numberInput = inputRef.current;\n\t\t\tif (numberInput && ['phonenumber', 'zip', 'number'].includes(type)) {\n\t\t\t\tnumberInput.addEventListener('wheel', onWheel, { passive: false });\n\n\t\t\t\treturn () => {\n\t\t\t\t\tnumberInput.removeEventListener('wheel', onWheel);\n\t\t\t\t};\n\t\t\t}\n\t\t}, []);\n\n\t\tuseEffect(() => {\n\t\t\tif (!reset) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetInputValue('');\n\t\t}, [reset]);\n\n\t\tuseEffect(() => {\n\t\t\tsetIsActive(!!props.isActive);\n\t\t\tif (props.isActive) {\n\t\t\t\tinputRef.current?.focus();\n\t\t\t}\n\t\t}, [props.isActive]);\n\n\t\tuseEffect(() => {\n\t\t\tsetErrorMessage(props.errorMessage);\n\t\t}, [props.errorMessage]);\n\n\t\tuseEffect(() => {\n\t\t\tsetIsInvalid(false);\n\t\t\tif (\n\t\t\t\tprops.state === 'invalid' ||\n\t\t\t\terrorMessage ||\n\t\t\t\tprops.state === 'disabled-invalid'\n\t\t\t) {\n\t\t\t\tsetIsInvalid(true);\n\t\t\t}\n\t\t\tif (props.state === 'active') {\n\t\t\t\tinputRef.current?.focus();\n\t\t\t}\n\t\t}, [props.state, errorMessage]);\n\n\t\tuseEffect(() => {\n\t\t\tsetIsInvalid(!!errorMessage || props.state === 'invalid');\n\t\t}, [errorMessage, props.state]);\n\n\t\tconst executeCallback = (cb: any, ...params: any[]): void => {\n\t\t\tif (!isFunction(cb)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcb(...params);\n\t\t};\n\n\t\tconst getMaxChar = () => {\n\t\t\tif (type === 'zip') {\n\t\t\t\treturn 6;\n\t\t\t}\n\t\t\treturn 2000;\n\t\t};\n\n\t\tconst onKeyDown = (e) => {\n\t\t\tconst MAX_CHAR_LIMIT = maxCharLimit !== 0 ? maxCharLimit : getMaxChar();\n\t\t\tconst KEY_CODES_TO_BE_EXCLUDED = [8];\n\t\t\tconst MIN_CHAR_LIMIT = minCharsToTrigger;\n\t\t\tconst inputText = e.target.value;\n\t\t\tif (\n\t\t\t\tonKeyDownEvent &&\n\t\t\t\t(!inputText.length || inputText.length >= MIN_CHAR_LIMIT)\n\t\t\t) {\n\t\t\t\tonKeyDownEvent(e);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!noKeyDownChange &&\n\t\t\t\t(!inputText.length || inputText.length >= MIN_CHAR_LIMIT)\n\t\t\t) {\n\t\t\t\tonChangeText(value || '', e);\n\t\t\t}\n\t\t\tif (noMaxCharCheck) return;\n\n\t\t\tif (\n\t\t\t\t!KEY_CODES_TO_BE_EXCLUDED.includes(e.which) &&\n\t\t\t\tMAX_CHAR_LIMIT > 0 &&\n\t\t\t\tinputText.length >= MAX_CHAR_LIMIT\n\t\t\t) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t};\n\n\t\tconst onWheel = (event) => {\n\t\t\tevent.preventDefault(); // Prevent the default scroll behavior\n\t\t};\n\n\t\tconst onChange = (e) => {\n\t\t\tlet inputText = e.target.value;\n\t\t\tconst MAX_CHAR_LIMIT =\n\t\t\t\tmaxCharLimit !== 0 ? maxCharLimit + 1 : getMaxChar();\n\t\t\tconst MIN_CHAR_LIMIT = minCharsToTrigger;\n\n\t\t\tif (!allowUnsafeInput && shouldSanitizeForType(type)) {\n\t\t\t\tinputText = sanitizeUnsafeInput(inputText);\n\t\t\t}\n\n\t\t\tif (preventFormulaInjection) {\n\t\t\t\tinputText = escapeFormulaInjection(inputText);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!noMaxCharCheck &&\n\t\t\t\tMAX_CHAR_LIMIT > 0 &&\n\t\t\t\tinputText.length >= MAX_CHAR_LIMIT\n\t\t\t) {\n\t\t\t\t// letting user to copy paste text upto max limit instead of blank action\n\t\t\t\tinputText = inputText.substring(0, MAX_CHAR_LIMIT - 1);\n\t\t\t}\n\n\t\t\tif (!props.textControl) {\n\t\t\t\tsetInputValue(inputText || '');\n\t\t\t}\n\t\t\tif (MIN_CHAR_LIMIT && inputText && inputText.length < MIN_CHAR_LIMIT) {\n\t\t\t\t// if minCharsToTrigger exists and is not reached, do nothing\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonChangeText(inputText, e);\n\t\t\tif (autoGrow) {\n\t\t\t\tinputRef.current.style.height = `${inputRef.current.scrollHeight}px`;\n\t\t\t\tif (!inputText) {\n\t\t\t\t\tinputRef.current.style.height = minHeight || '48px';\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst validateFunction = validate || validateInput;\n\t\t\tif (!validateFunction || !isFunction(validateFunction)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst [isValid, error] = validateFunction(\n\t\t\t\tinputText,\n\t\t\t\ttype,\n\t\t\t\trangeValidation,\n\t\t\t);\n\n\t\t\tsetIsInvalid(!isValid);\n\t\t\tsetErrorMessage(props.errorMessage ? props.errorMessage : error);\n\t\t};\n\n\t\tconst onFocus = (e) => {\n\t\t\tif (!props.skipFocus) {\n\t\t\t\tsetIsActive(true);\n\t\t\t}\n\t\t\texecuteCallback(props.onFocus?.(e));\n\t\t};\n\n\t\tconst onBlur = (e) => {\n\t\t\tif (!props.skipFocus) {\n\t\t\t\tsetIsActive(false);\n\t\t\t}\n\t\t\texecuteCallback(props.onBlur?.(e));\n\t\t};\n\n\t\tconst getInputHTML = () => {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{type !== 'multiline' && (\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tclassName={truncateText ? 'truncate-class' : ''}\n\t\t\t\t\t\t\tdata-test={props['data-test']}\n\t\t\t\t\t\t\tid={props.id}\n\t\t\t\t\t\t\tstyle={stylesFromOutside?.input ?? {}}\n\t\t\t\t\t\t\tref={inputRef as Ref<HTMLInputElement>}\n\t\t\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\t\t\ttype={\n\t\t\t\t\t\t\t\t['phonenumber', 'zip', 'number'].includes(type)\n\t\t\t\t\t\t\t\t\t? 'number'\n\t\t\t\t\t\t\t\t\t: type\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\tonFocus={(e) => onFocus(e)}\n\t\t\t\t\t\t\tonBlur={(e) => onBlur(e)}\n\t\t\t\t\t\t\tplaceholder={placeholder || 'Enter here'}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tonClick={(e) => executeCallback(props.onClick)}\n\t\t\t\t\t\t\tonKeyDown={(e) => onKeyDown(e)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{type === 'multiline' && (\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\tdata-test={props['data-test']}\n\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\tref={inputRef as Ref<HTMLTextAreaElement>}\n\t\t\t\t\t\t\tonFocus={(e) => onFocus(e)}\n\t\t\t\t\t\t\tonBlur={(e) => onBlur(e)}\n\t\t\t\t\t\t\tonClick={(e) => executeCallback(props.onClick)}\n\t\t\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\t\t\tplaceholder={placeholder || 'Enter here'}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tonKeyDown={(e) => onKeyDown(e)}\n\t\t\t\t\t\t\tmaxLength={maxCharLimit > 0 ? maxCharLimit : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<SC.RootContainer\n\t\t\t\twidth={props.width}\n\t\t\t\theight={props.height}\n\t\t\t\tstate={state}\n\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\ttype={type}\n\t\t\t\tstyle={stylesFromOutside?.RootContainer ?? {}}\n\t\t\t>\n\t\t\t\t<div className=\"flex-align-center\">\n\t\t\t\t\t{!noErrorHint && (!!hintText || !!errorMessage) && (\n\t\t\t\t\t\t<SC.InputFooter invalid={!!errorMessage}>\n\t\t\t\t\t\t\t{!!errorMessage && <ErrorIcon width={16} height={16} />}\n\t\t\t\t\t\t\t{errorMessage || hintText}\n\t\t\t\t\t\t</SC.InputFooter>\n\t\t\t\t\t)}\n\t\t\t\t\t{maxCharLimit > 0 && maxCharLimitPosition === 'BOTTOM' && (\n\t\t\t\t\t\t<SC.MaxCharStyle position={'BOTTOM'} style={maxCharStyle}>\n\t\t\t\t\t\t\t{(value ?? '').toString()?.length ?? 0}/{maxCharLimit}\n\t\t\t\t\t\t</SC.MaxCharStyle>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<SC.InputWrapper\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tstate={state}\n\t\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\t\twidth={props.width}\n\t\t\t\t\tisActive={state === 'active' || isActive}\n\t\t\t\t\tisInvalid={isInvalid}\n\t\t\t\t\tstyle={stylesFromOutside?.InputWrapper ?? inputWrapperStyles ?? {}}\n\t\t\t\t\tversion={version}\n\t\t\t\t\theight={props.height}\n\t\t\t\t\thightlightInputColor={hightlightInputColor}\n\t\t\t\t\thideBorder={hideBorder}\n\t\t\t\t>\n\t\t\t\t\t{!!LeftIcon && (\n\t\t\t\t\t\t<SC.IconHolder\n\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\t\t\tonClick={() => executeCallback(leftIcon?.callback)}\n\t\t\t\t\t\t\tisLeft={true}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t...(stylesFromOutside?.IconHolder ?? {}),\n\t\t\t\t\t\t\t\t...leftIconStyle,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LeftIcon />\n\t\t\t\t\t\t</SC.IconHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!prefixText && (\n\t\t\t\t\t\t<PrefixHolder variant={variant}>{prefixText}</PrefixHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{variant === 'default' && (\n\t\t\t\t\t\t<SC.InputContainer\n\t\t\t\t\t\t\theight={props.height}\n\t\t\t\t\t\t\ttype={props.type}\n\t\t\t\t\t\t\tminHeight={minHeight}\n\t\t\t\t\t\t\tmaxHeight={maxHeight}\n\t\t\t\t\t\t\tautoGrow={autoGrow}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{getInputHTML()}\n\t\t\t\t\t\t</SC.InputContainer>\n\t\t\t\t\t)}\n\t\t\t\t\t{variant === 'small' && (\n\t\t\t\t\t\t<SC.InputContainerSmall height={props.height} type={props.type}>\n\t\t\t\t\t\t\t{getInputHTML()}\n\t\t\t\t\t\t</SC.InputContainerSmall>\n\t\t\t\t\t)}\n\t\t\t\t\t{variant === 'x-small' && (\n\t\t\t\t\t\t<SC.InputContainerXSmall height={props.height} type={props.type}>\n\t\t\t\t\t\t\t{getInputHTML()}\n\t\t\t\t\t\t</SC.InputContainerXSmall>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!RightIcon && (\n\t\t\t\t\t\t<SC.IconHolder\n\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\t\t\tonClick={() => executeCallback(rightIcon?.callback)}\n\t\t\t\t\t\t\tisLeft={false}\n\t\t\t\t\t\t\tdata-test={rightIcon?.['data-test']}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RightIcon />\n\t\t\t\t\t\t</SC.IconHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!suffixText && (\n\t\t\t\t\t\t<SuffixHolder variant={variant}>{suffixText}</SuffixHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{button && button.text && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbuttonText={button.text}\n\t\t\t\t\t\t\tbuttonType={button.buttonType}\n\t\t\t\t\t\t\tonClick={() => executeCallback(button?.onClick)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{button && button.buttonProps && <Button {...button.buttonProps} />}\n\t\t\t\t</SC.InputWrapper>\n\t\t\t\t{!hideInputHeader && (!!labelText || !!maxCharLimit) && (\n\t\t\t\t\t<SC.InputHeader\n\t\t\t\t\t\tinvalid={isInvalid}\n\t\t\t\t\t\tmaxCharAlignment={maxCharAlignment}\n\t\t\t\t\t>\n\t\t\t\t\t\t{labelElement && labelElement}\n\t\t\t\t\t\t<div className=\"label__container\">\n\t\t\t\t\t\t\t{labelTextBold ? (\n\t\t\t\t\t\t\t\t<TitleSmall>\n\t\t\t\t\t\t\t\t\t{labelText}\n\t\t\t\t\t\t\t\t\t{isRequired ? <span>*</span> : ''}\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<BodySecondary>\n\t\t\t\t\t\t\t\t\t{labelText}\n\t\t\t\t\t\t\t\t\t{isRequired ? <span>*</span> : ''}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.tooltipText && (\n\t\t\t\t\t\t\t\t<Tooltip body={props.tooltipText} placement={'top'}>\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t<InfoIcon\n\t\t\t\t\t\t\t\t\t\t\tdata-test=\"input-tooltip-icon\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ marginTop: -3 }}\n\t\t\t\t\t\t\t\t\t\t\twidth={props.tooltipIconSize ?? 18}\n\t\t\t\t\t\t\t\t\t\t\theight={props.tooltipIconSize ?? 18}\n\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\tisInvalid\n\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t\t\t\t\t\t\t: props.tooltipIconColor ?? COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{maxCharLimit > 0 && maxCharLimitPosition === 'TOP' && (\n\t\t\t\t\t\t\t<SC.MaxCharStyle style={maxCharStyle}>\n\t\t\t\t\t\t\t\t{(value ?? '').toString()?.length ?? 0}/{maxCharLimit}\n\t\t\t\t\t\t\t</SC.MaxCharStyle>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SC.InputHeader>\n\t\t\t\t)}\n\t\t\t</SC.RootContainer>\n\t\t);\n\t},\n);\n\nInput.displayName = 'Input';\n"],"names":["Input","forwardRef","props","fRef","placeholder","leftIcon","rightIcon","labelText","maxCharLimit","isRequired","hintText","type","state","validate","variant","button","suffixText","prefixText","onChangeText","value","noErrorHint","reset","rangeValidation","noKeyDownChange","version","noMaxCharCheck","labelElement","autoGrow","minHeight","maxHeight","labelTextBold","truncateText","maxCharLimitPosition","maxCharStyle","hightlightInputColor","onKeyDownEvent","hideInputHeader","hideBorder","inputWrapperStyles","minCharsToTrigger","maxCharAlignment","isDisabled","solidDisabled","allowUnsafeInput","preventFormulaInjection","leftIconStyle","LeftIcon","RightIcon","isInvalid","setIsInvalid","useState","isActive","setIsActive","errorMessage","setErrorMessage","iconSize","stylesFromOutside","useContext","InputStyleContext","inputValue","setInputValue","_ref","useRef","inputRef","useEffect","numberInput","onWheel","executeCallback","cb","params","isFunction","getMaxChar","onKeyDown","e","MAX_CHAR_LIMIT","KEY_CODES_TO_BE_EXCLUDED","MIN_CHAR_LIMIT","inputText","event","onChange","shouldSanitizeForType","sanitizeUnsafeInput","escapeFormulaInjection","validateFunction","validateInput","isValid","error","onFocus","onBlur","getInputHTML","jsxs","Fragment","jsx","SC.RootContainer","SC.InputFooter","ErrorIcon","SC.MaxCharStyle","SC.InputWrapper","SC.IconHolder","PrefixHolder","SC.InputContainer","SC.InputContainerSmall","SC.InputContainerXSmall","SuffixHolder","Button","SC.InputHeader","TitleSmall","BodySecondary","Tooltip","InfoIcon","COLORS"],"mappings":"6gBA2BaA,GAAQC,EAAAA,WACpB,CACCC,EACAC,KACI,CACJ,KAAM,CACL,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,UAAAC,EACA,aAAAC,EACA,WAAAC,EACA,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,SAAAC,GACA,QAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,aAAAC,EACA,MAAAC,EACA,YAAAC,GACA,MAAAC,EACA,gBAAAC,GACA,gBAAAC,GACA,QAAAC,GACA,eAAAC,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,UAAAC,GACA,cAAAC,GACA,aAAAC,GACA,qBAAAC,EACA,aAAAC,EACA,qBAAAC,GACA,eAAAC,EACA,gBAAAC,GACA,WAAAC,GACA,mBAAAC,GACA,kBAAAC,EACA,iBAAAC,GACA,WAAAC,EAAa,GACb,cAAAC,EAAgB,GAChB,iBAAAC,GACA,wBAAAC,GACA,cAAAC,EAAA,EACG,CACH,aAAc,EACd,KAAM,OACN,QAAS,UACT,qBAAsB,MACtB,kBAAmB,EACnB,iBAAkB,GAClB,GAAG3C,CAAA,EAEE4C,EAAWzC,GAAU,KACrB0C,EAAYzC,GAAW,KACvB,CAAC0C,EAAWC,CAAY,EAAIC,EAAAA,SAAkB,EAAK,EACnD,CAACC,GAAUC,CAAW,EAAIF,EAAAA,SAAkB,EAAK,EACjD,CAACG,EAAcC,CAAe,EAAIJ,WAAA,EAClCK,EACLzC,IAAY,UAAY,OAASA,IAAY,QAAU,OAAS,OAC3D0C,EAAoBC,EAAAA,WAAWC,oBAAiB,EAChD,CAACC,EAAYC,CAAa,EAAIV,EAAAA,SAAiB,EAAE,EACjDW,GAAOC,EAAAA,OAA+C,IAAI,EAC1DC,EACJ5D,IAAQ0D,GAIVG,EAAAA,UAAU,IAAM,CACfJ,EAAczC,GAAS,EAAE,EACrB,CAACA,GAASQ,IACboC,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Q,KAAM1G,EAAM,YAAa,UAAW,MAC5C,SAAA0F,EAAAA,IAAC,OAAA,CACA,SAAAA,EAAAA,IAACiB,GAAAA,QAAA,CACA,YAAU,qBACV,MAAO,CAAE,UAAW,EAAA,EACpB,MAAO3G,EAAM,iBAAmB,GAChC,OAAQA,EAAM,iBAAmB,GACjC,MACC8C,EACG8D,GAAAA,OAAO,QAAQ,SACf5G,EAAM,kBAAoB4G,GAAAA,OAAO,QAAQ,OAAA,CAAA,EAG/C,CAAA,CACD,CAAA,EAEF,EACCtG,EAAe,GAAKwB,IAAyB,cAC5CgE,EAAAA,aAAA,CAAgB,MAAO/D,EACrB,SAAA,EAAAd,GAAS,IAAI,SAAA,GAAY,QAAU,EAAE,IAAEX,CAAA,CAAA,CAC1C,CAAA,CAAA,CAAA,CAEF,CAAA,CAAA,CAIJ,CACD,EAEAR,GAAM,YAAc"}
1
+ {"version":3,"file":"Input.js","sources":["../../../../src/components/input/Input.tsx"],"sourcesContent":["import InfoIcon from '@src/assets/icons/info.svg';\nimport { escapeFormulaInjection } from '@src/helpers/sanitize';\nimport React, {\n\tforwardRef,\n\tMutableRefObject,\n\tRef,\n\tuseContext,\n\tuseEffect,\n\tuseRef,\n\tuseState,\n} from 'react';\nimport { Button } from '@src/components/button';\nimport {\n\tisFunction,\n\tsanitizeUnsafeInput,\n\tshouldSanitizeForType,\n\tvalidateInput,\n} from '@src/components/input/Input-helper';\nimport { Tooltip } from '@src/components/tooltips';\nimport { BodySecondary, TitleSmall } from '@src/components/TypographyStyle';\nimport { COLORS } from '@src/constants/Theme';\nimport ErrorIcon from '../../assets/icons/errorInfo.svg';\nimport { InputStyleContext } from './context/InputStyleProvider';\nimport { InputProps, InputTypeI, InputVariant } from './Input.model';\nimport * as SC from './Input.styled';\nimport { PrefixHolder, SuffixHolder } from './Input.styled';\n\nexport const Input = forwardRef(\n\t(\n\t\tprops: InputProps,\n\t\tfRef: React.ForwardedRef<HTMLInputElement | HTMLTextAreaElement | null>,\n\t) => {\n\t\tconst {\n\t\t\tplaceholder,\n\t\t\tleftIcon,\n\t\t\trightIcon,\n\t\t\tlabelText,\n\t\t\tmaxCharLimit,\n\t\t\tisRequired,\n\t\t\thintText,\n\t\t\ttype,\n\t\t\tstate,\n\t\t\tvalidate,\n\t\t\tvariant,\n\t\t\tbutton,\n\t\t\tsuffixText,\n\t\t\tprefixText,\n\t\t\tonChangeText,\n\t\t\tvalue,\n\t\t\tnoErrorHint,\n\t\t\treset,\n\t\t\trangeValidation,\n\t\t\tnoKeyDownChange,\n\t\t\tversion,\n\t\t\tnoMaxCharCheck,\n\t\t\tlabelElement,\n\t\t\tautoGrow,\n\t\t\tminHeight,\n\t\t\tmaxHeight,\n\t\t\tlabelTextBold,\n\t\t\ttruncateText,\n\t\t\tmaxCharLimitPosition,\n\t\t\tmaxCharStyle,\n\t\t\thightlightInputColor,\n\t\t\tonKeyDownEvent,\n\t\t\thideInputHeader,\n\t\t\thideBorder,\n\t\t\tinputWrapperStyles,\n\t\t\tminCharsToTrigger,\n\t\t\tmaxCharAlignment,\n\t\t\tisDisabled = false,\n\t\t\tsolidDisabled = false,\n\t\t\tallowUnsafeInput,\n\t\t\tpreventFormulaInjection,\n\t\t\tleftIconStyle,\n\t\t} = {\n\t\t\tmaxCharLimit: 0,\n\t\t\ttype: 'text' as InputTypeI,\n\t\t\tvariant: 'default' as InputVariant,\n\t\t\tmaxCharLimitPosition: 'TOP',\n\t\t\tminCharsToTrigger: 0,\n\t\t\tmaxCharAlignment: false,\n\t\t\t...props,\n\t\t};\n\t\tconst LeftIcon = leftIcon?.icon;\n\t\tconst RightIcon = rightIcon?.icon;\n\t\tconst [isInvalid, setIsInvalid] = useState<boolean>(false);\n\t\tconst [isActive, setIsActive] = useState<boolean>(false);\n\t\tconst [errorMessage, setErrorMessage] = useState<string>();\n\t\tconst iconSize =\n\t\t\tvariant === 'x-small' ? '12px' : variant === 'small' ? '18px' : '22px';\n\t\tconst stylesFromOutside = useContext(InputStyleContext);\n\t\tconst [inputValue, setInputValue] = useState<string>('');\n\t\tconst _ref = useRef<HTMLInputElement | HTMLTextAreaElement>(null);\n\t\tconst inputRef: MutableRefObject<HTMLInputElement | HTMLTextAreaElement> =\n\t\t\t(fRef ?? _ref) as MutableRefObject<\n\t\t\t\tHTMLInputElement | HTMLTextAreaElement\n\t\t\t>;\n\n\t\tuseEffect(() => {\n\t\t\tsetInputValue(value || '');\n\t\t\tif (!value && autoGrow) {\n\t\t\t\tinputRef.current.style.height = minHeight || '48px';\n\t\t\t}\n\t\t}, [value]);\n\n\t\tuseEffect(() => {\n\t\t\tif (!inputRef.current) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tprops.onReferenceInit?.(inputRef.current);\n\t\t}, [inputRef]);\n\n\t\tuseEffect(() => {\n\t\t\tconst numberInput = inputRef.current;\n\t\t\tif (numberInput && ['phonenumber', 'zip', 'number'].includes(type)) {\n\t\t\t\tnumberInput.addEventListener('wheel', onWheel, { passive: false });\n\n\t\t\t\treturn () => {\n\t\t\t\t\tnumberInput.removeEventListener('wheel', onWheel);\n\t\t\t\t};\n\t\t\t}\n\t\t}, []);\n\n\t\tuseEffect(() => {\n\t\t\tif (!reset) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tsetInputValue('');\n\t\t}, [reset]);\n\n\t\tuseEffect(() => {\n\t\t\tsetIsActive(!!props.isActive);\n\t\t\tif (props.isActive) {\n\t\t\t\tinputRef.current?.focus();\n\t\t\t}\n\t\t}, [props.isActive]);\n\n\t\tuseEffect(() => {\n\t\t\tsetErrorMessage(props.errorMessage);\n\t\t}, [props.errorMessage]);\n\n\t\tuseEffect(() => {\n\t\t\tsetIsInvalid(false);\n\t\t\tif (\n\t\t\t\tprops.state === 'invalid' ||\n\t\t\t\terrorMessage ||\n\t\t\t\tprops.state === 'disabled-invalid'\n\t\t\t) {\n\t\t\t\tsetIsInvalid(true);\n\t\t\t}\n\t\t\tif (props.state === 'active') {\n\t\t\t\tinputRef.current?.focus();\n\t\t\t}\n\t\t}, [props.state, errorMessage]);\n\n\t\tuseEffect(() => {\n\t\t\tsetIsInvalid(!!errorMessage || props.state === 'invalid');\n\t\t}, [errorMessage, props.state]);\n\n\t\tconst executeCallback = (cb: any, ...params: any[]): void => {\n\t\t\tif (!isFunction(cb)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tcb(...params);\n\t\t};\n\n\t\tconst getMaxChar = () => {\n\t\t\tif (type === 'zip') {\n\t\t\t\treturn 6;\n\t\t\t}\n\t\t\treturn 2000;\n\t\t};\n\n\t\tconst onKeyDown = (e) => {\n\t\t\tconst MAX_CHAR_LIMIT = maxCharLimit !== 0 ? maxCharLimit : getMaxChar();\n\t\t\tconst KEY_CODES_TO_BE_EXCLUDED = [8];\n\t\t\tconst MIN_CHAR_LIMIT = minCharsToTrigger;\n\t\t\tconst inputText = e.target.value;\n\t\t\tif (\n\t\t\t\tonKeyDownEvent &&\n\t\t\t\t(!inputText.length || inputText.length >= MIN_CHAR_LIMIT)\n\t\t\t) {\n\t\t\t\tonKeyDownEvent(e);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!noKeyDownChange &&\n\t\t\t\t(!inputText.length || inputText.length >= MIN_CHAR_LIMIT)\n\t\t\t) {\n\t\t\t\tonChangeText(value || '', e);\n\t\t\t}\n\t\t\tif (noMaxCharCheck) return;\n\n\t\t\tif (\n\t\t\t\t!KEY_CODES_TO_BE_EXCLUDED.includes(e.which) &&\n\t\t\t\tMAX_CHAR_LIMIT > 0 &&\n\t\t\t\tinputText.length >= MAX_CHAR_LIMIT\n\t\t\t) {\n\t\t\t\te.preventDefault();\n\t\t\t}\n\t\t};\n\n\t\tconst onWheel = (event) => {\n\t\t\tevent.preventDefault(); // Prevent the default scroll behavior\n\t\t};\n\n\t\tconst onChange = (e) => {\n\t\t\tlet inputText = e.target.value;\n\t\t\tconst MAX_CHAR_LIMIT =\n\t\t\t\tmaxCharLimit !== 0 ? maxCharLimit + 1 : getMaxChar();\n\t\t\tconst MIN_CHAR_LIMIT = minCharsToTrigger;\n\n\t\t\tif (!allowUnsafeInput && shouldSanitizeForType(type)) {\n\t\t\t\tinputText = sanitizeUnsafeInput(inputText);\n\t\t\t}\n\n\t\t\tif (preventFormulaInjection) {\n\t\t\t\tinputText = escapeFormulaInjection(inputText);\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\t!noMaxCharCheck &&\n\t\t\t\tMAX_CHAR_LIMIT > 0 &&\n\t\t\t\tinputText.length >= MAX_CHAR_LIMIT\n\t\t\t) {\n\t\t\t\t// letting user to copy paste text upto max limit instead of blank action\n\t\t\t\tinputText = inputText.substring(0, MAX_CHAR_LIMIT - 1);\n\t\t\t}\n\n\t\t\tif (!props.textControl) {\n\t\t\t\tsetInputValue(inputText || '');\n\t\t\t}\n\t\t\tif (MIN_CHAR_LIMIT && inputText && inputText.length < MIN_CHAR_LIMIT) {\n\t\t\t\t// if minCharsToTrigger exists and is not reached, do nothing\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tonChangeText(inputText, e);\n\t\t\tif (autoGrow) {\n\t\t\t\tinputRef.current.style.height = `${inputRef.current.scrollHeight}px`;\n\t\t\t\tif (!inputText) {\n\t\t\t\t\tinputRef.current.style.height = minHeight || '48px';\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst validateFunction = validate || validateInput;\n\t\t\tif (!validateFunction || !isFunction(validateFunction)) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst [isValid, error] = validateFunction(\n\t\t\t\tinputText,\n\t\t\t\ttype,\n\t\t\t\trangeValidation,\n\t\t\t);\n\n\t\t\tsetIsInvalid(!isValid);\n\t\t\tsetErrorMessage(props.errorMessage ? props.errorMessage : error);\n\t\t};\n\n\t\tconst onFocus = (e) => {\n\t\t\tif (!props.skipFocus) {\n\t\t\t\tsetIsActive(true);\n\t\t\t}\n\t\t\texecuteCallback(props.onFocus?.(e));\n\t\t};\n\n\t\tconst onBlur = (e) => {\n\t\t\tif (!props.skipFocus) {\n\t\t\t\tsetIsActive(false);\n\t\t\t}\n\t\t\texecuteCallback(props.onBlur?.(e));\n\t\t};\n\n\t\tconst getInputHTML = () => {\n\t\t\treturn (\n\t\t\t\t<>\n\t\t\t\t\t{type !== 'multiline' && (\n\t\t\t\t\t\t<input\n\t\t\t\t\t\t\tclassName={truncateText ? 'truncate-class' : ''}\n\t\t\t\t\t\t\tdata-test={props['data-test']}\n\t\t\t\t\t\t\tid={props.id}\n\t\t\t\t\t\t\tstyle={stylesFromOutside?.input ?? {}}\n\t\t\t\t\t\t\tref={inputRef as Ref<HTMLInputElement>}\n\t\t\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\t\t\ttype={\n\t\t\t\t\t\t\t\t['phonenumber', 'zip', 'number'].includes(type)\n\t\t\t\t\t\t\t\t\t? 'number'\n\t\t\t\t\t\t\t\t\t: type\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\treadOnly={props.readOnly}\n\t\t\t\t\t\t\tautoComplete={props.autoComplete}\n\t\t\t\t\t\t\tonFocus={(e) => onFocus(e)}\n\t\t\t\t\t\t\tonBlur={(e) => onBlur(e)}\n\t\t\t\t\t\t\tplaceholder={placeholder || 'Enter here'}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tonClick={(e) => executeCallback(props.onClick)}\n\t\t\t\t\t\t\tonKeyDown={(e) => onKeyDown(e)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{type === 'multiline' && (\n\t\t\t\t\t\t<textarea\n\t\t\t\t\t\t\tdata-test={props['data-test']}\n\t\t\t\t\t\t\tvalue={inputValue}\n\t\t\t\t\t\t\tref={inputRef as Ref<HTMLTextAreaElement>}\n\t\t\t\t\t\t\tonFocus={(e) => onFocus(e)}\n\t\t\t\t\t\t\tonBlur={(e) => onBlur(e)}\n\t\t\t\t\t\t\tonClick={(e) => executeCallback(props.onClick)}\n\t\t\t\t\t\t\tdisabled={isDisabled}\n\t\t\t\t\t\t\tplaceholder={placeholder || 'Enter here'}\n\t\t\t\t\t\t\tonChange={onChange}\n\t\t\t\t\t\t\tonKeyDown={(e) => onKeyDown(e)}\n\t\t\t\t\t\t\tmaxLength={maxCharLimit > 0 ? maxCharLimit : undefined}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t);\n\t\t};\n\n\t\treturn (\n\t\t\t<SC.RootContainer\n\t\t\t\twidth={props.width}\n\t\t\t\theight={props.height}\n\t\t\t\tstate={state}\n\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\ttype={type}\n\t\t\t\tstyle={stylesFromOutside?.RootContainer ?? {}}\n\t\t\t>\n\t\t\t\t<div className=\"flex-align-center\">\n\t\t\t\t\t{!noErrorHint && (!!hintText || !!errorMessage) && (\n\t\t\t\t\t\t<SC.InputFooter invalid={!!errorMessage}>\n\t\t\t\t\t\t\t{!!errorMessage && <ErrorIcon width={16} height={16} />}\n\t\t\t\t\t\t\t{errorMessage || hintText}\n\t\t\t\t\t\t</SC.InputFooter>\n\t\t\t\t\t)}\n\t\t\t\t\t{maxCharLimit > 0 && maxCharLimitPosition === 'BOTTOM' && (\n\t\t\t\t\t\t<SC.MaxCharStyle position={'BOTTOM'} style={maxCharStyle}>\n\t\t\t\t\t\t\t{(value ?? '').toString()?.length ?? 0}/{maxCharLimit}\n\t\t\t\t\t\t</SC.MaxCharStyle>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t\t<SC.InputWrapper\n\t\t\t\t\tvariant={variant}\n\t\t\t\t\tstate={state}\n\t\t\t\t\tsolidDisabled={solidDisabled}\n\t\t\t\t\twidth={props.width}\n\t\t\t\t\tisActive={state === 'active' || isActive}\n\t\t\t\t\tisInvalid={isInvalid}\n\t\t\t\t\tstyle={stylesFromOutside?.InputWrapper ?? inputWrapperStyles ?? {}}\n\t\t\t\t\tversion={version}\n\t\t\t\t\theight={props.height}\n\t\t\t\t\thightlightInputColor={hightlightInputColor}\n\t\t\t\t\thideBorder={hideBorder}\n\t\t\t\t>\n\t\t\t\t\t{!!LeftIcon && (\n\t\t\t\t\t\t<SC.IconHolder\n\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\t\t\tonClick={() => executeCallback(leftIcon?.callback)}\n\t\t\t\t\t\t\tisLeft={true}\n\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t...(stylesFromOutside?.IconHolder ?? {}),\n\t\t\t\t\t\t\t\t...leftIconStyle,\n\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<LeftIcon />\n\t\t\t\t\t\t</SC.IconHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!prefixText && (\n\t\t\t\t\t\t<PrefixHolder variant={variant}>{prefixText}</PrefixHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{variant === 'default' && (\n\t\t\t\t\t\t<SC.InputContainer\n\t\t\t\t\t\t\theight={props.height}\n\t\t\t\t\t\t\ttype={props.type}\n\t\t\t\t\t\t\tminHeight={minHeight}\n\t\t\t\t\t\t\tmaxHeight={maxHeight}\n\t\t\t\t\t\t\tautoGrow={autoGrow}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{getInputHTML()}\n\t\t\t\t\t\t</SC.InputContainer>\n\t\t\t\t\t)}\n\t\t\t\t\t{variant === 'small' && (\n\t\t\t\t\t\t<SC.InputContainerSmall height={props.height} type={props.type}>\n\t\t\t\t\t\t\t{getInputHTML()}\n\t\t\t\t\t\t</SC.InputContainerSmall>\n\t\t\t\t\t)}\n\t\t\t\t\t{variant === 'x-small' && (\n\t\t\t\t\t\t<SC.InputContainerXSmall height={props.height} type={props.type}>\n\t\t\t\t\t\t\t{getInputHTML()}\n\t\t\t\t\t\t</SC.InputContainerXSmall>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!RightIcon && (\n\t\t\t\t\t\t<SC.IconHolder\n\t\t\t\t\t\t\tvariant={variant}\n\t\t\t\t\t\t\ticonSize={iconSize}\n\t\t\t\t\t\t\tonClick={() => executeCallback(rightIcon?.callback)}\n\t\t\t\t\t\t\tisLeft={false}\n\t\t\t\t\t\t\tdata-test={rightIcon?.['data-test']}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t<RightIcon />\n\t\t\t\t\t\t</SC.IconHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{!!suffixText && (\n\t\t\t\t\t\t<SuffixHolder variant={variant}>{suffixText}</SuffixHolder>\n\t\t\t\t\t)}\n\t\t\t\t\t{button && button.text && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\tbuttonText={button.text}\n\t\t\t\t\t\t\tbuttonType={button.buttonType}\n\t\t\t\t\t\t\tonClick={() => executeCallback(button?.onClick)}\n\t\t\t\t\t\t/>\n\t\t\t\t\t)}\n\t\t\t\t\t{button && button.buttonProps && <Button {...button.buttonProps} />}\n\t\t\t\t</SC.InputWrapper>\n\t\t\t\t{!hideInputHeader && (!!labelText || !!maxCharLimit) && (\n\t\t\t\t\t<SC.InputHeader\n\t\t\t\t\t\tinvalid={isInvalid}\n\t\t\t\t\t\tmaxCharAlignment={maxCharAlignment}\n\t\t\t\t\t>\n\t\t\t\t\t\t{labelElement && labelElement}\n\t\t\t\t\t\t<div className=\"label__container\">\n\t\t\t\t\t\t\t{labelTextBold ? (\n\t\t\t\t\t\t\t\t<TitleSmall>\n\t\t\t\t\t\t\t\t\t{labelText}\n\t\t\t\t\t\t\t\t\t{isRequired ? <span>*</span> : ''}\n\t\t\t\t\t\t\t\t</TitleSmall>\n\t\t\t\t\t\t\t) : (\n\t\t\t\t\t\t\t\t<BodySecondary>\n\t\t\t\t\t\t\t\t\t{labelText}\n\t\t\t\t\t\t\t\t\t{isRequired ? <span>*</span> : ''}\n\t\t\t\t\t\t\t\t</BodySecondary>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t{props.tooltipText && (\n\t\t\t\t\t\t\t\t<Tooltip body={props.tooltipText} placement={'top'}>\n\t\t\t\t\t\t\t\t\t<span>\n\t\t\t\t\t\t\t\t\t\t<InfoIcon\n\t\t\t\t\t\t\t\t\t\t\tdata-test=\"input-tooltip-icon\"\n\t\t\t\t\t\t\t\t\t\t\tstyle={{ marginTop: -3 }}\n\t\t\t\t\t\t\t\t\t\t\twidth={props.tooltipIconSize ?? 18}\n\t\t\t\t\t\t\t\t\t\t\theight={props.tooltipIconSize ?? 18}\n\t\t\t\t\t\t\t\t\t\t\tcolor={\n\t\t\t\t\t\t\t\t\t\t\t\tisInvalid\n\t\t\t\t\t\t\t\t\t\t\t\t\t? COLORS.content.negative\n\t\t\t\t\t\t\t\t\t\t\t\t\t: props.tooltipIconColor ?? COLORS.content.primary\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t</Tooltip>\n\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t{maxCharLimit > 0 && maxCharLimitPosition === 'TOP' && (\n\t\t\t\t\t\t\t<SC.MaxCharStyle style={maxCharStyle}>\n\t\t\t\t\t\t\t\t{(value ?? '').toString()?.length ?? 0}/{maxCharLimit}\n\t\t\t\t\t\t\t</SC.MaxCharStyle>\n\t\t\t\t\t\t)}\n\t\t\t\t\t</SC.InputHeader>\n\t\t\t\t)}\n\t\t\t</SC.RootContainer>\n\t\t);\n\t},\n);\n\nInput.displayName = 'Input';\n"],"names":["Input","forwardRef","props","fRef","placeholder","leftIcon","rightIcon","labelText","maxCharLimit","isRequired","hintText","type","state","validate","variant","button","suffixText","prefixText","onChangeText","value","noErrorHint","reset","rangeValidation","noKeyDownChange","version","noMaxCharCheck","labelElement","autoGrow","minHeight","maxHeight","labelTextBold","truncateText","maxCharLimitPosition","maxCharStyle","hightlightInputColor","onKeyDownEvent","hideInputHeader","hideBorder","inputWrapperStyles","minCharsToTrigger","maxCharAlignment","isDisabled","solidDisabled","allowUnsafeInput","preventFormulaInjection","leftIconStyle","LeftIcon","RightIcon","isInvalid","setIsInvalid","useState","isActive","setIsActive","errorMessage","setErrorMessage","iconSize","stylesFromOutside","useContext","InputStyleContext","inputValue","setInputValue","_ref","useRef","inputRef","useEffect","numberInput","onWheel","executeCallback","cb","params","isFunction","getMaxChar","onKeyDown","e","MAX_CHAR_LIMIT","KEY_CODES_TO_BE_EXCLUDED","MIN_CHAR_LIMIT","inputText","event","onChange","shouldSanitizeForType","sanitizeUnsafeInput","escapeFormulaInjection","validateFunction","validateInput","isValid","error","onFocus","onBlur","getInputHTML","jsxs","Fragment","jsx","SC.RootContainer","SC.InputFooter","ErrorIcon","SC.MaxCharStyle","SC.InputWrapper","SC.IconHolder","PrefixHolder","SC.InputContainer","SC.InputContainerSmall","SC.InputContainerXSmall","SuffixHolder","Button","SC.InputHeader","TitleSmall","BodySecondary","Tooltip","InfoIcon","COLORS"],"mappings":"6gBA2BaA,GAAQC,EAAAA,WACpB,CACCC,EACAC,KACI,CACJ,KAAM,CACL,YAAAC,EACA,SAAAC,EACA,UAAAC,EACA,UAAAC,EACA,aAAAC,EACA,WAAAC,EACA,SAAAC,EACA,KAAAC,EACA,MAAAC,EACA,SAAAC,GACA,QAAAC,EACA,OAAAC,EACA,WAAAC,EACA,WAAAC,EACA,aAAAC,EACA,MAAAC,EACA,YAAAC,GACA,MAAAC,EACA,gBAAAC,GACA,gBAAAC,GACA,QAAAC,GACA,eAAAC,EACA,aAAAC,EACA,SAAAC,EACA,UAAAC,EACA,UAAAC,GACA,cAAAC,GACA,aAAAC,GACA,qBAAAC,EACA,aAAAC,EACA,qBAAAC,GACA,eAAAC,EACA,gBAAAC,GACA,WAAAC,GACA,mBAAAC,GACA,kBAAAC,EACA,iBAAAC,GACA,WAAAC,EAAa,GACb,cAAAC,EAAgB,GAChB,iBAAAC,GACA,wBAAAC,GACA,cAAAC,EAAA,EACG,CACH,aAAc,EACd,KAAM,OACN,Q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