@zonos/amino 5.4.2 → 5.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var e=require("../../_tslib-bd4862e8.js"),t=require("react/jsx-runtime"),n=require("react"),r=require("clsx"),u=require("../flex/Flex.js"),l=require("../tag/Tag.js"),a=require("../../style-inject.es-d4ddeae4.js");function i(e){return e&&e.__esModule?e:{default:e}}require("../../icons/RemoveIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../styles/constants/theme.js");var o=i(r),s="Amino_MultiInput-module__tagInputWrapper--FTdAL",c="Amino_MultiInput-module__tagInput--cBsz8";a.styleInject(".Amino_MultiInput-module__tagInputWrapper--FTdAL.Amino_MultiInput-module__tagInputWrapper--FTdAL{border:1px solid #ccc;border-radius:4px;overflow-x:auto;padding:5px}.Amino_MultiInput-module__tagInputWrapper--FTdAL.Amino_MultiInput-module__tagInputWrapper--FTdAL .Amino_MultiInput-module__tagInput--cBsz8{border:none;flex:1 1 auto;flex-grow:1;font-size:var(--amino-font-size-base);font-weight:500;min-width:100px;min-width:50px;outline:none;padding:5px}");exports.MultiInput=function(r){var a=r.className,i=r.placeholder,p=void 0===i?"":i,d=r.setHasValidationError,g=r.setTags,_=r.style,f=r.tags,m=r.tagValidation,h=e.__read(n.useState(""),2),x=h[0],I=h[1],v=n.useRef(null),A=e.__read(n.useState(null),2),j=A[0],y=A[1];n.useEffect((function(){if(d&&m){var e=f.some((function(e){return!m(e)}));d(e)}}),[f,m,d]);var q=function(e){g(f.filter((function(t,n){return n!==e})))};return t.jsxs(u.Flex,{alignItems:"center",className:o.default([a,s]),flexWrap:"wrap",gap:4,style:_,children:[f.map((function(e,n){var r=!(!m||m(e)),a=j===n,i=r?"error":"default";return t.jsx(u.Flex,{alignItems:"center",gap:0,children:t.jsx(l.Tag,{highlighted:a,intent:i,onClick:function(){return y(n)},onClose:function(){return q(n)},size:"lg",children:e})},e)})),t.jsx("input",{ref:v,className:c,onChange:function(e){I(e.target.value)},onFocus:function(){v.current&&(v.current.selectionStart=v.current.value.length,v.current.selectionEnd=v.current.value.length)},onKeyDown:function(t){var n;"Enter"!==t.key&&","!==t.key&&" "!==t.key||!x?"Backspace"===t.key?""===x&&f.length>0&&(null===j?y(f.length-1):(q(j),y(null))):"ArrowLeft"===t.key?null===j&&f.length>0?y(f.length-1):null!==j&&j>0&&y(j-1):"ArrowRight"===t.key&&null!==j&&j<f.length-1?y(j+1):y(null):(t.preventDefault(),(n=x.trim())&&(g(e.__spreadArray(e.__spreadArray([],e.__read(f),!1),[n],!1)),I("")))},placeholder:f.length?"":p,value:x})]})};
1
+ "use strict";var e=require("../../_tslib-bd4862e8.js"),n=require("react/jsx-runtime"),t=require("react"),r=require("clsx"),u=require("../flex/Flex.js"),a=require("../tag/Tag.js"),l=require("../../style-inject.es-d4ddeae4.js");function i(e){return e&&e.__esModule?e:{default:e}}require("../../icons/RemoveIcon.js"),require("../../icons/icon-base/_IconBase.js"),require("../../styles/constants/theme.js");var o=i(r),s="Amino_MultiInput-module__tagInputWrapper--FTdAL",c="Amino_MultiInput-module__tagInput--cBsz8";l.styleInject(".Amino_MultiInput-module__tagInputWrapper--FTdAL.Amino_MultiInput-module__tagInputWrapper--FTdAL{border:var(--amino-border);border-radius:var(--amino-radius-10);overflow-x:auto;padding:6px}.Amino_MultiInput-module__tagInputWrapper--FTdAL.Amino_MultiInput-module__tagInputWrapper--FTdAL .Amino_MultiInput-module__tagInput--cBsz8{background-color:initial;border:none;flex:1 1 auto;flex-grow:1;font-size:var(--amino-font-size-base);font-weight:500;min-width:100px;min-width:50px;outline:none;padding:6px}");exports.MultiInput=function(r){var l=r.className,i=r.placeholder,d=void 0===i?"":i,p=r.setHasValidationError,g=r.setTags,_=r.style,f=r.tags,m=r.tagValidation,h=e.__read(t.useState(""),2),I=h[0],x=h[1],v=t.useRef(null),A=e.__read(t.useState(null),2),j=A[0],y=A[1];t.useEffect((function(){if(p&&m){var e=f.some((function(e){return!m(e)}));p(e)}}),[f,m,p]);var q=function(e){g(f.filter((function(n,t){return t!==e})))};return n.jsxs(u.Flex,{alignItems:"center",className:o.default([l,s]),flexWrap:"wrap",gap:4,style:_,children:[f.map((function(e,t){var r=!(!m||m(e)),l=j===t,i=r?"error":"default";return n.jsx(u.Flex,{alignItems:"center",gap:0,children:n.jsx(a.Tag,{highlighted:l,intent:i,onClick:function(){return y(t)},onClose:function(){return q(t)},size:"lg",children:e})},e)})),n.jsx("input",{ref:v,className:c,onChange:function(e){x(e.target.value)},onFocus:function(){v.current&&(v.current.selectionStart=v.current.value.length,v.current.selectionEnd=v.current.value.length)},onKeyDown:function(n){var t;"Enter"!==n.key&&","!==n.key&&" "!==n.key||!I?"Backspace"===n.key?""===I&&f.length>0&&(null===j?y(f.length-1):(q(j),y(null))):"ArrowLeft"===n.key?null===j&&f.length>0?y(f.length-1):null!==j&&j>0&&y(j-1):"ArrowRight"===n.key&&null!==j&&j<f.length-1?y(j+1):y(null):(n.preventDefault(),(t=I.trim())&&(g(e.__spreadArray(e.__spreadArray([],e.__read(f),!1),[t],!1)),x("")))},placeholder:f.length?"":d,value:I})]})};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zonos/amino",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "Core UI components for Amino",
5
5
  "repository": "git@github.com:Zonos/amino.git",
6
6
  "license": "MIT",