@zonos/amino 5.4.5 → 5.4.6
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,10 +1,12 @@
|
|
|
1
1
|
export type MultiInputProps = {
|
|
2
2
|
className?: string;
|
|
3
|
+
inputValue: string;
|
|
3
4
|
placeholder?: string;
|
|
4
5
|
style?: React.CSSProperties;
|
|
5
6
|
tags: string[];
|
|
6
7
|
setHasValidationError?: (hasValidationError: boolean) => void;
|
|
8
|
+
setInputValue: (input: string) => void;
|
|
7
9
|
setTags: (tags: string[]) => void;
|
|
8
10
|
tagValidation?: (tag: string) => boolean;
|
|
9
11
|
};
|
|
10
|
-
export declare const MultiInput: ({ className, placeholder, setHasValidationError, setTags, style, tags, tagValidation, }: MultiInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const MultiInput: ({ className, inputValue, placeholder, setHasValidationError, setInputValue, setTags, style, tags, tagValidation, }: MultiInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
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"),
|
|
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"),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: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 a=r.className,i=r.inputValue,p=r.placeholder,d=void 0===p?"":p,g=r.setHasValidationError,_=r.setInputValue,f=r.setTags,m=r.style,h=r.tags,I=r.tagValidation,x=t.useRef(null),v=e.__read(t.useState(null),2),A=v[0],j=v[1];t.useEffect((function(){if(g&&I){var e=h.some((function(e){return!I(e)}));g(e)}}),[h,I,g]);var y=function(e){f(h.filter((function(n,t){return t!==e})))};return n.jsxs(u.Flex,{alignItems:"center",className:o.default([a,s]),flexWrap:"wrap",gap:4,style:m,children:[h.map((function(e,t){var r=!(!I||I(e)),a=A===t,i=r?"error":"default";return n.jsx(u.Flex,{alignItems:"center",gap:0,children:n.jsx(l.Tag,{highlighted:a,intent:i,onClick:function(){return j(t)},onClose:function(){return y(t)},size:"lg",children:e})},e)})),n.jsx("input",{ref:x,className:c,onChange:function(e){_(e.target.value)},onFocus:function(){x.current&&(x.current.selectionStart=x.current.value.length,x.current.selectionEnd=x.current.value.length)},onKeyDown:function(n){var t;"Enter"!==n.key&&","!==n.key&&" "!==n.key||!i?"Backspace"===n.key?""===i&&h.length>0&&(null===A?j(h.length-1):(y(A),j(null))):"ArrowLeft"===n.key?null===A&&h.length>0?j(h.length-1):null!==A&&A>0&&j(A-1):"ArrowRight"===n.key&&null!==A&&A<h.length-1?j(A+1):j(null):(n.preventDefault(),(t=i.trim())&&(f(e.__spreadArray(e.__spreadArray([],e.__read(h),!1),[t],!1)),_("")))},placeholder:h.length?"":d,value:i})]})};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../_tslib-bd4862e8.js"),t=require("react"),i=require("@floating-ui/react");exports.useDropdown=function(n){var o=null!=n?n:{},s=o.floatingOptions,r=void 0===s?{}:s,u=o.offsetCrossAxis,a=void 0===u?0:u,
|
|
1
|
+
"use strict";var e=require("../../_tslib-bd4862e8.js"),t=require("react"),i=require("@floating-ui/react");exports.useDropdown=function(n){var o=null!=n?n:{},s=o.floatingOptions,r=void 0===s?{}:s,u=o.offsetCrossAxis,a=void 0===u?0:u,l=o.offsetMainAxis,d=void 0===l?0:l,f=o.placement,c=void 0===f?"bottom-start":f,v=o.startOpen,p=void 0!==v&&v,m=e.__read(t.useState(p),2),b=m[0],g=m[1],w=b?"visible":"hidden",x=t.useRef(null),y=i.useFloating(e.__assign({middleware:[i.shift(),i.offset({crossAxis:a,mainAxis:d}),i.flip()],placement:c,whileElementsMounted:i.autoUpdate},r)),_=y.floatingStyles,A=y.refs,E=t.useCallback((function(e){var t,i=e.target;b&&0===e.button&&((null===(t=null==x?void 0:x.current)||void 0===t?void 0:t.contains(i))||(e.preventDefault(),e.stopPropagation(),g(!1)))}),[b]);return t.useEffect((function(){return"undefined"!=typeof document&&document.addEventListener("mousedown",E),function(){"undefined"!=typeof document&&document.removeEventListener("mousedown",E)}}),[E]),{floatingStyles:_,refs:A,setVisible:g,visibility:w,visible:b,wrapperRef:x}};
|