Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@zag-js/tags-input

Package Overview
Dependencies
Maintainers
1
Versions
1036
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zag-js/tags-input - npm Package Compare versions

Comparing version 0.0.0-dev-20220407084218 to 0.0.0-dev-20220408111010

2

dist/index.js

@@ -1,2 +0,2 @@

var P=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var q=e=>P(e,"__esModule",{value:!0});var G=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},K=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $(t))!z.call(e,r)&&(n||r!=="default")&&P(e,r,{get:()=>t[r],enumerable:!(o=W(t,r))||o.enumerable});return e};var Y=(e=>(t,n)=>e&&e.get(t)||(n=K(q({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var re={};G(re,{connect:()=>U,machine:()=>H});var s=e=>e?"":void 0;var k=new WeakMap;function j(e){var t;if(!e)return{};let n=k.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),k.set(e,n)),n}function X(e,t){if(!e)return;let n=j(e),o="box-sizing:"+n.boxSizing+";border-left:"+n.borderLeftWidth+" solid red;border-right:"+n.borderRightWidth+" solid red;font-family:"+n.fontFamily+";font-feature-settings:"+n.fontFeatureSettings+";font-kerning:"+n.fontKerning+";font-size:"+n.fontSize+";font-stretch:"+n.fontStretch+";font-style:"+n.fontStyle+";font-variant:"+n.fontVariant+";font-variant-caps:"+n.fontVariantCaps+";font-variant-ligatures:"+n.fontVariantLigatures+";font-variant-numeric:"+n.fontVariantNumeric+";font-weight:"+n.fontWeight+";letter-spacing:"+n.letterSpacing+";margin-left:"+n.marginLeft+";margin-right:"+n.marginRight+";padding-left:"+n.paddingLeft+";padding-right:"+n.paddingRight+";text-indent:"+n.textIndent+";text-transform:"+n.textTransform;t.style.cssText+=o}function f(e){let t=new Set;function n(o){let r=globalThis.requestAnimationFrame(o);t.add(()=>globalThis.cancelAnimationFrame(r))}return n(()=>n(e)),function(){t.forEach(function(o){o()})}}function y(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}function J(e){var t=e.createElement("div");return t.id="ghost",t.style.cssText="display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;",e.body.appendChild(t),t}function _(e){var t;if(!e)return;let n=(t=e.ownerDocument)!=null?t:document,o=J(n);X(e,o);function r(){y(()=>{o.innerHTML=e.value;let l=getComputedStyle(o);e==null||e.style.setProperty("width",l.width)})}return r(),e==null||e.addEventListener("input",r),e==null||e.addEventListener("change",r),()=>{n.body.removeChild(o),e==null||e.removeEventListener("input",r),e==null||e.removeEventListener("change",r)}}var le=(()=>{let e=0;return()=>(e++,e.toString(36))})();function S(e){var t;return(t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window}function C(e){var t;return(t=e.nativeEvent)!=null?t:e}function Z(e,t="input"){var n;let o=S(e)[t==="input"?"HTMLInputElement":"HTMLTextAreaElement"].prototype;return(n=Object.getOwnPropertyDescriptor(o,"value"))!=null?n:{}}function D(e,t){var n;let o=S(e);if(!(e instanceof o.HTMLInputElement))return;e.type="text",e.hidden=!0,(n=Z(e).set)==null||n.call(e,t);let r=new o.Event("input",{bubbles:!0});e.dispatchEvent(r),e.type="hidden",e.hidden=!1}function V(e,t){var n;let o=Array.isArray(t.exclude)?t.exclude:[t.exclude],r=(n=e.relatedTarget)!=null?n:t.fallback;return o.every(l=>!(l==null?void 0:l.contains(r)))}var ue=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");var R={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft",Home:"End",End:"Home"},Q={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"};function O(e,t={}){var n;let{dir:o="ltr",orientation:r="horizontal"}=t,{key:l}=e;return l=(n=Q[l])!=null?n:l,o==="rtl"&&r==="horizontal"&&l in R&&(l=R[l]),l}var ee={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function te(e){Object.assign(e.style,ee)}function M(e={}){var t;let{level:n="polite",doc:o,root:r,delay:l=0}=e,g=o!=null?o:document,E=(t=g.defaultView)!=null?t:window,v=r!=null?r:g.body;function h(i,c){let u=g.getElementById("__live-region__");u&&v.removeChild(u),c=c!=null?c:l;let d=g.createElement("span");d.id="__live-region__";var p=n!=="assertive"?"status":"alert";d.setAttribute("aria-live",n),d.setAttribute("role",p),te(d),v.appendChild(d),E.setTimeout(()=>{d.textContent=i},c)}function T(){let i=g.getElementById("__live-region__");i&&v.removeChild(i)}return{announce:h,destroy:T}}function F(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function ne(e,t){return e.find(n=>n.id===t)}function b(e,t){let n=ne(e,t);return n?e.indexOf(n):-1}function B(e,t,n=!0){let o=b(e,t);return o=n?(o+1)%e.length:Math.min(o+1,e.length-1),e[o]}function x(e,t,n=!0){let o=b(e,t);return o===-1?n?e[e.length-1]:null:(o=n?(o-1+e.length)%e.length:Math.max(0,o-1),e[o])}function ae(e){return{button:e,label:e,input:e,output:e,element:e}}var N=ae(e=>e);var a={getDoc:e=>{var t;return(t=e.doc)!=null?t:document},getRootId:e=>`tags-input-${e.uid}-root`,getInputId:e=>`tags-input-${e.uid}-input`,getEditInputId:e=>`${e.editedId}-input`,getClearButtonId:e=>`tags-input-${e.uid}-clear-btn`,getHiddenInputId:e=>`tags-input-${e.uid}-hidden-input`,getLabelId:e=>`tags-input-${e.uid}-label`,getControlId:e=>`tags-input-${e.uid}-control`,getTagId:(e,t)=>`tags-input-${e.uid}-tag-${t.value}-${t.index}`,getTagDeleteBtnId:(e,t)=>`${a.getTagId(e,t)}-delete-btn`,getTagInputId:(e,t)=>`${a.getTagId(e,t)}-input`,getTagInputEl:(e,t)=>{var n;return(n=a.getDoc(e))==null?void 0:n.getElementById(a.getTagInputId(e,t))},getRootEl:e=>a.getDoc(e).getElementById(a.getRootId(e)),getInputEl:e=>a.getDoc(e).getElementById(a.getInputId(e)),getHiddenInputEl:e=>a.getDoc(e).getElementById(a.getHiddenInputId(e)),getEditInputEl:e=>a.getDoc(e).getElementById(a.getEditInputId(e)),getElements:e=>F(a.getRootEl(e),"[data-part=tag]:not([data-disabled])"),getIndexOfId:(e,t)=>b(a.getElements(e),t),getElAtIndex:(e,t)=>a.getElements(e)[t],isInputFocused:e=>a.getDoc(e).activeElement===a.getInputEl(e),getFirstEl:e=>a.getElements(e)[0],getLastEl:e=>a.getElements(e)[a.getElements(e).length-1],getPrevEl:(e,t)=>x(a.getElements(e),t,!1),getNextEl:(e,t)=>B(a.getElements(e),t,!1),getFocusedTagValue:e=>{var n;if(!e.focusedId)return null;let t=a.getIndexOfId(e,e.focusedId);return t===-1?null:(n=a.getElements(e)[t].dataset.value)!=null?n:null},setHoverIntent:e=>{let t=e.closest("[data-part=tag]");!t||(t.dataset.deleteIntent="")},clearHoverIntent:e=>{let t=e.closest("[data-part=tag]");!t||delete t.dataset.deleteIntent},dispatchInputEvent(e){let t=a.getHiddenInputEl(e);!t||D(t,e.valueAsString)}};function U(e,t,n=N){let o=e.context.isInteractive,r=e.context.disabled,l=e.context.readonly,g=e.context.invalid||e.context.isOverflowing,E=e.context.messages,v=e.hasTag("focused"),h=e.matches("editing:tag"),T=e.context.count===0;return{isEmpty:T,inputValue:e.context.trimmedInputValue,value:e.context.value,count:e.context.count,valueAsString:e.context.valueAsString,isAtMax:e.context.isAtMax,setValue(i){t({type:"SET_VALUE",value:i})},clearAll(){t("CLEAR_ALL")},addValue(i){t({type:"ADD_TAG",value:i})},deleteValue(i){t({type:"DELETE_TAG",id:i})},setInputValue(i){t({type:"SET_INPUT_VALUE",value:i})},clearInputValue(){t({type:"SET_INPUT_VALUE",value:""})},focus(){f(()=>{var i;(i=a.getInputEl(e.context))==null||i.focus()})},rootProps:n.element({dir:e.context.dir,"data-part":"root","data-invalid":s(g),"data-readonly":s(l),"data-disabled":s(r),"data-focus":s(v),"data-empty":s(T),id:a.getRootId(e.context),onPointerDown(){!o||t("POINTER_DOWN")}}),labelProps:n.label({"data-part":"label","data-disabled":s(r),"data-invalid":s(g),"data-readonly":s(l),id:a.getLabelId(e.context),htmlFor:a.getInputId(e.context)}),controlProps:n.element({id:a.getControlId(e.context),"data-part":"control",tabIndex:l?0:void 0,"data-disabled":s(r),"data-readonly":s(l),"data-invalid":s(g),"data-focus":s(v)}),inputProps:n.input({"data-part":"input","data-invalid":s(g),"aria-invalid":g,"data-readonly":s(l),maxLength:e.context.maxLength,id:a.getInputId(e.context),value:e.context.inputValue,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",disabled:r||l,onChange(i){let c=C(i);c.isComposing||c.inputType==="insertFromPaste"||t({type:"TYPE",value:i.target.value})},onFocus(){t("FOCUS")},onBlur(i){V(i,{exclude:a.getRootEl(e.context)})&&t("BLUR")},onPaste(i){let c=i.clipboardData.getData("text/plain");t({type:"PASTE",value:c})},onKeyDown(i){if(C(i).isComposing)return;let u={ArrowDown(){t("ARROW_DOWN")},ArrowLeft(){t("ARROW_LEFT")},ArrowRight(){e.context.focusedId&&i.preventDefault(),t("ARROW_RIGHT")},Escape(A){A.preventDefault(),t("ESCAPE")},Backspace(){t("BACKSPACE")},Delete(){t("DELETE")},Enter(A){A.preventDefault(),t("ENTER")}},d=O(i,e.context),p=u[d];if(p){p==null||p(i);return}i.key===e.context.delimiter&&(i.preventDefault(),t("DELIMITER_KEY"))}}),hiddenInputProps:n.input({"data-part":"hidden-input",type:"hidden",name:e.context.name,id:a.getHiddenInputId(e.context),value:e.context.valueAsString}),getTagProps(i){let{value:c}=i,u=a.getTagId(e.context,i);return n.element({"data-part":"tag",id:u,hidden:h?e.context.editedId===u:!1,"data-value":c,"data-disabled":s(r),"data-selected":s(u===e.context.focusedId),onPointerDown(d){!o||(d.preventDefault(),t({type:"POINTER_DOWN_TAG",id:u}))},onDoubleClick(){!o||t({type:"DOUBLE_CLICK_TAG",id:u})}})},getTagInputProps(i){let c=a.getTagId(e.context,i),u=e.context.editedId===c;return n.input({"data-part":"tag-input","aria-label":E.tagEdited(i.value),"aria-hidden":!0,disabled:r,id:a.getTagInputId(e.context,i),type:"text",tabIndex:-1,hidden:h?!u:!0,value:u?e.context.editedTagValue:"",onChange(d){t({type:"TAG_INPUT_TYPE",value:d.target.value})},onBlur(d){t({type:"TAG_INPUT_BLUR",target:d.relatedTarget})},onKeyDown(d){let L={Enter(){t("TAG_INPUT_ENTER")},Escape(){t("TAG_INPUT_ESCAPE")}}[d.key];L&&(d.preventDefault(),L(d))}})},getTagDeleteButtonProps(i){let c=a.getTagId(e.context,i);return n.button({"data-part":"delete-button",id:a.getTagDeleteBtnId(e.context,i),type:"button",disabled:r,"aria-label":E.deleteTagButtonLabel(i.value),tabIndex:-1,onPointerDown(u){o||u.preventDefault()},onPointerMove(u){!o||a.setHoverIntent(u.currentTarget)},onPointerLeave(u){!o||a.clearHoverIntent(u.currentTarget)},onClick(){!o||t({type:"DELETE_TAG",id:c})}})},clearButtonProps:n.button({"data-part":"clear-button",id:a.getClearButtonId(e.context),type:"button","data-readonly":s(l),disabled:r,"aria-label":E.clearButtonLabel,hidden:T,onClick(){!o||t("CLEAR_ALL")}})}}var m=require("@zag-js/core");var{and:w,not:I,or:oe}=m.guards,H=(0,m.createMachine)({id:"tags-input",initial:"unknown",context:{log:{current:null,prev:null},uid:"",inputValue:"",editedTagValue:"",focusedId:null,editedId:null,value:[],dir:"ltr",max:1/0,liveRegion:null,blurBehavior:void 0,addOnPaste:!1,allowEditTag:!0,validate:()=>!0,delimiter:",",messages:{clearButtonLabel:"Clear all tags",deleteTagButtonLabel:e=>`Delete tag ${e}`,tagAdded:e=>`Added tag ${e}`,tagsPasted:e=>`Pasted ${e.length} tags`,tagEdited:e=>`Editing tag ${e}. Press enter to save or escape to cancel.`,tagUpdated:e=>`Tag update to ${e}`,tagDeleted:e=>`Tag ${e} deleted`,tagSelected:e=>`Tag ${e} selected. Press enter to edit, delete or backspace to remove.`}},computed:{count:e=>e.value.length,valueAsString:e=>JSON.stringify(e.value),trimmedInputValue:e=>e.inputValue.trim(),isInteractive:e=>!(e.readonly||e.disabled),isAtMax:e=>e.count===e.max,isOverflowing:e=>e.count>e.max},watch:{focusedId:["invokeOnHighlight","logFocused"],isOverflowing:"invokeOnInvalid",value:["invokeOnChange","dispatchChangeEvent"],log:"announceLog"},exit:["removeLiveRegion","clearLog"],on:{DOUBLE_CLICK_TAG:{guard:"allowEditTag",target:"editing:tag",actions:["setEditedId","initializeEditedTagValue"]},POINTER_DOWN_TAG:{guard:I("isTagFocused"),target:"navigating:tag",actions:["focusTag","focusInput"]},SET_INPUT_VALUE:{actions:["setInputValue"]},SET_VALUE:{actions:["setValue"]},DELETE_TAG:{actions:["deleteTag"]},CLEAR_ALL:{actions:["clearTags","focusInput"]},ADD_TAG:{guard:w(oe(I("isAtMax"),"allowOverflow"),I("isInputValueEmpty")),actions:["addTag","clearInputValue"]},EXT_BLUR:[{guard:"addOnBlur",actions:"raiseAddTagEvent"},{guard:"clearOnBlur",actions:"clearInputValue"}]},states:{unknown:{on:{SETUP:[{guard:"autoFocus",target:"focused:input",actions:"setupDocument"},{target:"idle",actions:"setupDocument"}]}},idle:{on:{FOCUS:"focused:input",POINTER_DOWN:{guard:I("hasFocusedId"),target:"focused:input"}}},"focused:input":{tags:["focused"],entry:["focusInput","clearFocusedId"],on:{TYPE:{actions:"setInputValue"},BLUR:[{guard:"addOnBlur",target:"idle",actions:"raiseAddTagEvent"},{guard:"clearOnBlur",target:"idle",actions:"clearInputValue"},{target:"idle"}],ENTER:{actions:["raiseAddTagEvent"]},DELIMITER_KEY:{actions:["raiseAddTagEvent"]},ARROW_LEFT:{guard:w("hasTags","isInputCaretAtStart"),target:"navigating:tag",actions:"focusLastTag"},BACKSPACE:{target:"navigating:tag",guard:w("hasTags","isInputCaretAtStart"),actions:"focusLastTag"},PASTE:{guard:"addOnPaste",actions:["setInputValue","addTagFromPaste"]}}},"navigating:tag":{tags:["focused"],on:{ARROW_RIGHT:[{guard:w("hasTags","isInputCaretAtStart",I("isLastTagFocused")),actions:"focusNextTag"},{target:"focused:input"}],ARROW_LEFT:{actions:"focusPrevTag"},BLUR:{target:"idle",actions:"clearFocusedId"},ENTER:{guard:"allowEditTag",target:"editing:tag",actions:["setEditedId","initializeEditedTagValue","focusEditedTagInput"]},ARROW_DOWN:"focused:input",ESCAPE:"focused:input",TYPE:{target:"focused:input",actions:"setInputValue"},BACKSPACE:[{guard:"isFirstTagFocused",actions:["deleteFocusedTag","focusFirstTag"]},{actions:["deleteFocusedTag","focusPrevTag"]}],DELETE:{actions:["deleteFocusedTag","focusTagAtIndex"]}}},"editing:tag":{tags:["editing","focused"],entry:"focusEditedTagInput",activities:["autoResizeTagInput"],on:{TAG_INPUT_TYPE:{actions:"setEditedTagValue"},TAG_INPUT_ESCAPE:{target:"navigating:tag",actions:["clearEditedTagValue","focusInput","clearEditedId","focusTagAtIndex"]},TAG_INPUT_BLUR:[{guard:"isInputRelatedTarget",target:"navigating:tag",actions:["clearEditedTagValue","clearFocusedId","clearEditedId"]},{target:"idle",actions:["clearEditedTagValue","clearFocusedId","clearEditedId","raiseExtBlurEvent"]}],TAG_INPUT_ENTER:{target:"navigating:tag",actions:["submitEditedTagValue","focusInput","clearEditedId","focusTagAtIndex","invokeOnTagUpdate"]}}}}},{guards:{isInputRelatedTarget:(e,t)=>t.relatedTarget===a.getInputEl(e),isAtMax:e=>e.isAtMax,hasFocusedId:e=>e.focusedId!==null,isTagFocused:(e,t)=>e.focusedId===t.id,isFirstTagFocused:e=>{var t;return((t=a.getFirstEl(e))==null?void 0:t.id)===e.focusedId},isLastTagFocused:e=>{var t;return((t=a.getLastEl(e))==null?void 0:t.id)===e.focusedId},isInputValueEmpty:e=>e.trimmedInputValue.length===0,hasTags:e=>e.value.length>0,allowOverflow:e=>!!e.allowOverflow,autoFocus:e=>!!e.autoFocus,addOnBlur:e=>e.blurBehavior==="add",clearOnBlur:e=>e.blurBehavior==="clear",addOnPaste:e=>!!e.addOnPaste,allowEditTag:e=>!!e.allowEditTag,isInputCaretAtStart(e){let t=a.getInputEl(e);if(!t)return!1;try{return t.selectionStart===0&&t.selectionEnd===0}catch(n){return t.value===""}}},activities:{autoResizeTagInput(e){if(!e.editedTagValue||e.__index==null||!e.allowEditTag)return;let t=a.getTagInputEl(e,{value:e.editedTagValue,index:e.__index});return _(t)}},actions:{raiseAddTagEvent(e,t,{self:n}){n.send("ADD_TAG")},raiseExtBlurEvent(e,t,{self:n}){n.send("EXT_BLUR")},invokeOnHighlight(e){var n;let t=a.getFocusedTagValue(e);(n=e.onHighlight)==null||n.call(e,t)},invokeOnTagUpdate(e){var n;if(!e.__index)return;let t=e.value[e.__index];(n=e.onTagUpdate)==null||n.call(e,t,e.__index)},invokeOnChange(e){var t;(t=e.onChange)==null||t.call(e,e.value)},dispatchChangeEvent(e){a.dispatchInputEvent(e)},setupDocument(e,t){e.uid=t.id,t.doc&&(e.doc=(0,m.ref)(t.doc)),f(()=>{e.liveRegion=M({level:"assertive",doc:e.doc})})},focusNextTag(e){if(!e.focusedId)return;let t=a.getNextEl(e,e.focusedId);t&&(e.focusedId=t.id)},focusFirstTag(e){y(()=>{var n;let t=(n=a.getFirstEl(e))==null?void 0:n.id;t&&(e.focusedId=t)})},focusLastTag(e){let t=a.getLastEl(e);t&&(e.focusedId=t.id)},focusPrevTag(e){if(!e.focusedId)return;let t=a.getPrevEl(e,e.focusedId);t&&(e.focusedId=t.id)},focusTag(e,t){e.focusedId=t.id},focusTagAtIndex(e){y(()=>{if(e.__index==null)return;let t=a.getElAtIndex(e,e.__index);t&&(e.focusedId=t.id,e.__index=void 0)})},deleteTag(e,t){let n=a.getIndexOfId(e,t.id),o=e.value[n];e.log.prev=e.log.current,e.log.current={type:"delete",value:o},e.value.splice(n,1)},deleteFocusedTag(e){if(!e.focusedId)return;let t=a.getIndexOfId(e,e.focusedId);e.__index=t;let n=e.value[t];e.log.prev=e.log.current,e.log.current={type:"delete",value:n},e.value.splice(t,1)},setEditedId(e,t){var n;e.editedId=(n=t.id)!=null?n:e.focusedId,e.__index=a.getIndexOfId(e,e.editedId)},clearEditedId(e){e.editedId=null},clearEditedTagValue(e){e.editedTagValue=""},setEditedTagValue(e,t){e.editedTagValue=t.value},submitEditedTagValue(e){var n;if(!e.editedId)return;let t=a.getIndexOfId(e,e.editedId);e.value[t]=(n=e.editedTagValue)!=null?n:"",e.log.prev=e.log.current,e.log.current={type:"update",value:e.editedTagValue}},initializeEditedTagValue(e){if(!e.editedId)return;let t=a.getIndexOfId(e,e.editedId);e.editedTagValue=e.value[t]},focusEditedTagInput(e){f(()=>{var t;(t=a.getEditInputEl(e))==null||t.select()})},setInputValue(e,t){e.inputValue=t.value},clearFocusedId(e){e.focusedId=null},focusInput(e){f(()=>{var t;(t=a.getInputEl(e))==null||t.focus()})},clearInputValue(e){e.inputValue=""},addTag(e,t){var r,l,g;let n=(r=t.value)!=null?r:e.trimmedInputValue;((l=e.validate)==null?void 0:l.call(e,{inputValue:n,values:e.value}))?(e.value.push(n),e.log.prev=e.log.current,e.log.current={type:"add",value:n}):(g=e.onInvalid)==null||g.call(e,"invalidTag")},addTagFromPaste(e){f(()=>{var o,r;let t=e.trimmedInputValue;if((o=e.validate)==null?void 0:o.call(e,{inputValue:t,values:e.value})){let l=e.delimiter?t.split(e.delimiter).map(g=>g.trim()):[t];e.value.push(...l),e.log.prev=e.log.current,e.log.current={type:"paste",values:l}}else(r=e.onInvalid)==null||r.call(e,"invalidTag");e.inputValue=""})},clearTags(e){e.value=[],e.log.prev=e.log.current,e.log.current={type:"clear"}},setValue(e,t){e.value=t.value},removeLiveRegion(e){var t;(t=e.liveRegion)==null||t.destroy()},invokeOnInvalid(e){var t;e.isOverflowing&&((t=e.onInvalid)==null||t.call(e,"rangeOverflow"))},clearLog(e){e.log={prev:null,current:null}},logFocused(e){if(!e.focusedId)return;let t=a.getIndexOfId(e,e.focusedId);e.log.prev=e.log.current,e.log.current={type:"select",value:e.value[t]}},announceLog(e){if(!e.log.current||e.liveRegion==null)return;let t=e.liveRegion,{current:n,prev:o}=e.log,r;switch(n.type){case"add":r=e.messages.tagAdded(n.value);break;case"delete":r=e.messages.tagDeleted(n.value);break;case"update":r=e.messages.tagUpdated(n.value);break;case"paste":r=e.messages.tagsPasted(n.values);break;case"select":r=e.messages.tagSelected(n.value),(o==null?void 0:o.type)==="delete"?r=`${e.messages.tagDeleted(o.value)}. ${r}`:(o==null?void 0:o.type)==="update"&&(r=`${e.messages.tagUpdated(o.value)}. ${r}`);break;default:break}r&&t.announce(r)}}});module.exports=Y(re);
var P=Object.defineProperty;var W=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var z=Object.prototype.hasOwnProperty;var q=e=>P(e,"__esModule",{value:!0});var G=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},K=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of $(t))!z.call(e,r)&&(n||r!=="default")&&P(e,r,{get:()=>t[r],enumerable:!(o=W(t,r))||o.enumerable});return e};var Y=(e=>(t,n)=>e&&e.get(t)||(n=K(q({}),t,1),e&&e.set(t,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var re={};G(re,{connect:()=>U,machine:()=>H});var s=e=>e?"":void 0;var C=new WeakMap;function j(e){var t;if(!e)return{};let n=C.get(e);return n||(n=((t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window).getComputedStyle(e),C.set(e,n)),n}function X(e,t){if(!e)return;let n=j(e),o="box-sizing:"+n.boxSizing+";border-left:"+n.borderLeftWidth+" solid red;border-right:"+n.borderRightWidth+" solid red;font-family:"+n.fontFamily+";font-feature-settings:"+n.fontFeatureSettings+";font-kerning:"+n.fontKerning+";font-size:"+n.fontSize+";font-stretch:"+n.fontStretch+";font-style:"+n.fontStyle+";font-variant:"+n.fontVariant+";font-variant-caps:"+n.fontVariantCaps+";font-variant-ligatures:"+n.fontVariantLigatures+";font-variant-numeric:"+n.fontVariantNumeric+";font-weight:"+n.fontWeight+";letter-spacing:"+n.letterSpacing+";margin-left:"+n.marginLeft+";margin-right:"+n.marginRight+";padding-left:"+n.paddingLeft+";padding-right:"+n.paddingRight+";text-indent:"+n.textIndent+";text-transform:"+n.textTransform;t.style.cssText+=o}function f(e){let t=new Set;function n(o){let r=globalThis.requestAnimationFrame(o);t.add(()=>globalThis.cancelAnimationFrame(r))}return n(()=>n(e)),function(){t.forEach(function(o){o()})}}function y(e){let t=globalThis.requestAnimationFrame(e);return function(){globalThis.cancelAnimationFrame(t)}}function Z(e){var t=e.createElement("div");return t.id="ghost",t.style.cssText="display:inline-block;height:0;overflow:hidden;position:absolute;top:0;visibility:hidden;white-space:nowrap;",e.body.appendChild(t),t}function _(e){var t;if(!e)return;let n=(t=e.ownerDocument)!=null?t:document,o=Z(n);X(e,o);function r(){y(()=>{o.innerHTML=e.value;let l=getComputedStyle(o);e==null||e.style.setProperty("width",l.width)})}return r(),e==null||e.addEventListener("input",r),e==null||e.addEventListener("change",r),()=>{n.body.removeChild(o),e==null||e.removeEventListener("input",r),e==null||e.removeEventListener("change",r)}}var le=(()=>{let e=0;return()=>(e++,e.toString(36))})();function S(e){var t;return(t=e==null?void 0:e.ownerDocument.defaultView)!=null?t:window}function k(e){var t;return(t=e.nativeEvent)!=null?t:e}function J(e,t){var n;let{type:o,property:r}=t,l=S(e)[o==="input"?"HTMLInputElement":"HTMLTextAreaElement"].prototype;return(n=Object.getOwnPropertyDescriptor(l,r))!=null?n:{}}function V(e,t){var n;let o=S(e);if(!(e instanceof o.HTMLInputElement))return;(n=J(e,{type:"input",property:"value"}).set)==null||n.call(e,t);let r=new o.Event("input",{bubbles:!0});e.dispatchEvent(r)}function D(e,t){var n;let o=Array.isArray(t.exclude)?t.exclude:[t.exclude],r=(n=e.relatedTarget)!=null?n:t.fallback;return o.every(l=>!(l==null?void 0:l.contains(r)))}var ue=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","embed","iframe","object","a[href]","area[href]","[tabindex]","audio[controls]","video[controls]","*[tabindex]:not([aria-disabled])","[contenteditable]:not([contenteditable=false])","details > summary:first-of-type"].join(",");var R={ArrowLeft:"ArrowRight",ArrowRight:"ArrowLeft",Home:"End",End:"Home"},Q={Up:"ArrowUp",Down:"ArrowDown",Esc:"Escape"," ":"Space",",":"Comma",Left:"ArrowLeft",Right:"ArrowRight"};function O(e,t={}){var n;let{dir:o="ltr",orientation:r="horizontal"}=t,{key:l}=e;return l=(n=Q[l])!=null?n:l,o==="rtl"&&r==="horizontal"&&l in R&&(l=R[l]),l}var ee={border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px",whiteSpace:"nowrap",wordWrap:"normal"};function te(e){Object.assign(e.style,ee)}function M(e={}){var t;let{level:n="polite",doc:o,root:r,delay:l=0}=e,g=o!=null?o:document,E=(t=g.defaultView)!=null?t:window,v=r!=null?r:g.body;function h(i,c){let u=g.getElementById("__live-region__");u&&v.removeChild(u),c=c!=null?c:l;let d=g.createElement("span");d.id="__live-region__";var p=n!=="assertive"?"status":"alert";d.setAttribute("aria-live",n),d.setAttribute("role",p),te(d),v.appendChild(d),E.setTimeout(()=>{d.textContent=i},c)}function T(){let i=g.getElementById("__live-region__");i&&v.removeChild(i)}return{announce:h,destroy:T}}function F(e,t){var n;return Array.from((n=e==null?void 0:e.querySelectorAll(t))!=null?n:[])}function ne(e,t){return e.find(n=>n.id===t)}function b(e,t){let n=ne(e,t);return n?e.indexOf(n):-1}function B(e,t,n=!0){let o=b(e,t);return o=n?(o+1)%e.length:Math.min(o+1,e.length-1),e[o]}function x(e,t,n=!0){let o=b(e,t);return o===-1?n?e[e.length-1]:null:(o=n?(o-1+e.length)%e.length:Math.max(0,o-1),e[o])}function ae(e){return{button:e,label:e,input:e,output:e,element:e}}var N=ae(e=>e);var a={getDoc:e=>{var t;return(t=e.doc)!=null?t:document},getRootId:e=>`tags-input-${e.uid}-root`,getInputId:e=>`tags-input-${e.uid}-input`,getEditInputId:e=>`${e.editedId}-input`,getClearButtonId:e=>`tags-input-${e.uid}-clear-btn`,getHiddenInputId:e=>`tags-input-${e.uid}-hidden-input`,getLabelId:e=>`tags-input-${e.uid}-label`,getControlId:e=>`tags-input-${e.uid}-control`,getTagId:(e,t)=>`tags-input-${e.uid}-tag-${t.value}-${t.index}`,getTagDeleteBtnId:(e,t)=>`${a.getTagId(e,t)}-delete-btn`,getTagInputId:(e,t)=>`${a.getTagId(e,t)}-input`,getTagInputEl:(e,t)=>{var n;return(n=a.getDoc(e))==null?void 0:n.getElementById(a.getTagInputId(e,t))},getRootEl:e=>a.getDoc(e).getElementById(a.getRootId(e)),getInputEl:e=>a.getDoc(e).getElementById(a.getInputId(e)),getHiddenInputEl:e=>a.getDoc(e).getElementById(a.getHiddenInputId(e)),getEditInputEl:e=>a.getDoc(e).getElementById(a.getEditInputId(e)),getElements:e=>F(a.getRootEl(e),"[data-part=tag]:not([data-disabled])"),getIndexOfId:(e,t)=>b(a.getElements(e),t),getElAtIndex:(e,t)=>a.getElements(e)[t],isInputFocused:e=>a.getDoc(e).activeElement===a.getInputEl(e),getFirstEl:e=>a.getElements(e)[0],getLastEl:e=>a.getElements(e)[a.getElements(e).length-1],getPrevEl:(e,t)=>x(a.getElements(e),t,!1),getNextEl:(e,t)=>B(a.getElements(e),t,!1),getFocusedTagValue:e=>{var n;if(!e.focusedId)return null;let t=a.getIndexOfId(e,e.focusedId);return t===-1?null:(n=a.getElements(e)[t].dataset.value)!=null?n:null},setHoverIntent:e=>{let t=e.closest("[data-part=tag]");!t||(t.dataset.deleteIntent="")},clearHoverIntent:e=>{let t=e.closest("[data-part=tag]");!t||delete t.dataset.deleteIntent},dispatchInputEvent(e){let t=a.getHiddenInputEl(e);!t||V(t,e.valueAsString)}};function U(e,t,n=N){let o=e.context.isInteractive,r=e.context.disabled,l=e.context.readonly,g=e.context.invalid||e.context.isOverflowing,E=e.context.messages,v=e.hasTag("focused"),h=e.matches("editing:tag"),T=e.context.count===0;return{isEmpty:T,inputValue:e.context.trimmedInputValue,value:e.context.value,count:e.context.count,valueAsString:e.context.valueAsString,isAtMax:e.context.isAtMax,setValue(i){t({type:"SET_VALUE",value:i})},clearAll(){t("CLEAR_ALL")},addValue(i){t({type:"ADD_TAG",value:i})},deleteValue(i){t({type:"DELETE_TAG",id:i})},setInputValue(i){t({type:"SET_INPUT_VALUE",value:i})},clearInputValue(){t({type:"SET_INPUT_VALUE",value:""})},focus(){f(()=>{var i;(i=a.getInputEl(e.context))==null||i.focus()})},rootProps:n.element({dir:e.context.dir,"data-part":"root","data-invalid":s(g),"data-readonly":s(l),"data-disabled":s(r),"data-focus":s(v),"data-empty":s(T),id:a.getRootId(e.context),onPointerDown(){!o||t("POINTER_DOWN")}}),labelProps:n.label({"data-part":"label","data-disabled":s(r),"data-invalid":s(g),"data-readonly":s(l),id:a.getLabelId(e.context),htmlFor:a.getInputId(e.context)}),controlProps:n.element({id:a.getControlId(e.context),"data-part":"control",tabIndex:l?0:void 0,"data-disabled":s(r),"data-readonly":s(l),"data-invalid":s(g),"data-focus":s(v)}),inputProps:n.input({"data-part":"input","data-invalid":s(g),"aria-invalid":g,"data-readonly":s(l),maxLength:e.context.maxLength,id:a.getInputId(e.context),value:e.context.inputValue,autoComplete:"off",autoCorrect:"off",autoCapitalize:"none",disabled:r||l,onChange(i){let c=k(i);c.isComposing||c.inputType==="insertFromPaste"||t({type:"TYPE",value:i.target.value})},onFocus(){t("FOCUS")},onBlur(i){D(i,{exclude:a.getRootEl(e.context)})&&t("BLUR")},onPaste(i){let c=i.clipboardData.getData("text/plain");t({type:"PASTE",value:c})},onKeyDown(i){if(k(i).isComposing)return;let u={ArrowDown(){t("ARROW_DOWN")},ArrowLeft(){t("ARROW_LEFT")},ArrowRight(){e.context.focusedId&&i.preventDefault(),t("ARROW_RIGHT")},Escape(A){A.preventDefault(),t("ESCAPE")},Backspace(){t("BACKSPACE")},Delete(){t("DELETE")},Enter(A){A.preventDefault(),t("ENTER")}},d=O(i,e.context),p=u[d];if(p){p==null||p(i);return}i.key===e.context.delimiter&&(i.preventDefault(),t("DELIMITER_KEY"))}}),hiddenInputProps:n.input({"data-part":"hidden-input",type:"text",hidden:!0,name:e.context.name,id:a.getHiddenInputId(e.context),defaultValue:e.context.valueAsString}),getTagProps(i){let{value:c}=i,u=a.getTagId(e.context,i);return n.element({"data-part":"tag",id:u,hidden:h?e.context.editedId===u:!1,"data-value":c,"data-disabled":s(r),"data-selected":s(u===e.context.focusedId),onPointerDown(d){!o||(d.preventDefault(),t({type:"POINTER_DOWN_TAG",id:u}))},onDoubleClick(){!o||t({type:"DOUBLE_CLICK_TAG",id:u})}})},getTagInputProps(i){let c=a.getTagId(e.context,i),u=e.context.editedId===c;return n.input({"data-part":"tag-input","aria-label":E.tagEdited(i.value),"aria-hidden":!0,disabled:r,id:a.getTagInputId(e.context,i),type:"text",tabIndex:-1,hidden:h?!u:!0,value:u?e.context.editedTagValue:"",onChange(d){t({type:"TAG_INPUT_TYPE",value:d.target.value})},onBlur(d){t({type:"TAG_INPUT_BLUR",target:d.relatedTarget})},onKeyDown(d){let L={Enter(){t("TAG_INPUT_ENTER")},Escape(){t("TAG_INPUT_ESCAPE")}}[d.key];L&&(d.preventDefault(),L(d))}})},getTagDeleteButtonProps(i){let c=a.getTagId(e.context,i);return n.button({"data-part":"delete-button",id:a.getTagDeleteBtnId(e.context,i),type:"button",disabled:r,"aria-label":E.deleteTagButtonLabel(i.value),tabIndex:-1,onPointerDown(u){o||u.preventDefault()},onPointerMove(u){!o||a.setHoverIntent(u.currentTarget)},onPointerLeave(u){!o||a.clearHoverIntent(u.currentTarget)},onClick(){!o||t({type:"DELETE_TAG",id:c})}})},clearButtonProps:n.button({"data-part":"clear-button",id:a.getClearButtonId(e.context),type:"button","data-readonly":s(l),disabled:r,"aria-label":E.clearButtonLabel,hidden:T,onClick(){!o||t("CLEAR_ALL")}})}}var m=require("@zag-js/core");var{and:w,not:I,or:oe}=m.guards,H=(0,m.createMachine)({id:"tags-input",initial:"unknown",context:{log:{current:null,prev:null},uid:"",inputValue:"",editedTagValue:"",focusedId:null,editedId:null,value:[],dir:"ltr",max:1/0,liveRegion:null,blurBehavior:void 0,addOnPaste:!1,allowEditTag:!0,validate:()=>!0,delimiter:",",messages:{clearButtonLabel:"Clear all tags",deleteTagButtonLabel:e=>`Delete tag ${e}`,tagAdded:e=>`Added tag ${e}`,tagsPasted:e=>`Pasted ${e.length} tags`,tagEdited:e=>`Editing tag ${e}. Press enter to save or escape to cancel.`,tagUpdated:e=>`Tag update to ${e}`,tagDeleted:e=>`Tag ${e} deleted`,tagSelected:e=>`Tag ${e} selected. Press enter to edit, delete or backspace to remove.`}},computed:{count:e=>e.value.length,valueAsString:e=>JSON.stringify(e.value),trimmedInputValue:e=>e.inputValue.trim(),isInteractive:e=>!(e.readonly||e.disabled),isAtMax:e=>e.count===e.max,isOverflowing:e=>e.count>e.max},watch:{focusedId:["invokeOnHighlight","logFocused"],isOverflowing:"invokeOnInvalid",value:["invokeOnChange","dispatchChangeEvent"],log:"announceLog"},exit:["removeLiveRegion","clearLog"],on:{DOUBLE_CLICK_TAG:{guard:"allowEditTag",target:"editing:tag",actions:["setEditedId","initializeEditedTagValue"]},POINTER_DOWN_TAG:{guard:I("isTagFocused"),target:"navigating:tag",actions:["focusTag","focusInput"]},SET_INPUT_VALUE:{actions:["setInputValue"]},SET_VALUE:{actions:["setValue"]},DELETE_TAG:{actions:["deleteTag"]},CLEAR_ALL:{actions:["clearTags","focusInput"]},ADD_TAG:{guard:w(oe(I("isAtMax"),"allowOverflow"),I("isInputValueEmpty")),actions:["addTag","clearInputValue"]},EXT_BLUR:[{guard:"addOnBlur",actions:"raiseAddTagEvent"},{guard:"clearOnBlur",actions:"clearInputValue"}]},states:{unknown:{on:{SETUP:[{guard:"autoFocus",target:"focused:input",actions:"setupDocument"},{target:"idle",actions:"setupDocument"}]}},idle:{on:{FOCUS:"focused:input",POINTER_DOWN:{guard:I("hasFocusedId"),target:"focused:input"}}},"focused:input":{tags:["focused"],entry:["focusInput","clearFocusedId"],on:{TYPE:{actions:"setInputValue"},BLUR:[{guard:"addOnBlur",target:"idle",actions:"raiseAddTagEvent"},{guard:"clearOnBlur",target:"idle",actions:"clearInputValue"},{target:"idle"}],ENTER:{actions:["raiseAddTagEvent"]},DELIMITER_KEY:{actions:["raiseAddTagEvent"]},ARROW_LEFT:{guard:w("hasTags","isInputCaretAtStart"),target:"navigating:tag",actions:"focusLastTag"},BACKSPACE:{target:"navigating:tag",guard:w("hasTags","isInputCaretAtStart"),actions:"focusLastTag"},PASTE:{guard:"addOnPaste",actions:["setInputValue","addTagFromPaste"]}}},"navigating:tag":{tags:["focused"],on:{ARROW_RIGHT:[{guard:w("hasTags","isInputCaretAtStart",I("isLastTagFocused")),actions:"focusNextTag"},{target:"focused:input"}],ARROW_LEFT:{actions:"focusPrevTag"},BLUR:{target:"idle",actions:"clearFocusedId"},ENTER:{guard:"allowEditTag",target:"editing:tag",actions:["setEditedId","initializeEditedTagValue","focusEditedTagInput"]},ARROW_DOWN:"focused:input",ESCAPE:"focused:input",TYPE:{target:"focused:input",actions:"setInputValue"},BACKSPACE:[{guard:"isFirstTagFocused",actions:["deleteFocusedTag","focusFirstTag"]},{actions:["deleteFocusedTag","focusPrevTag"]}],DELETE:{actions:["deleteFocusedTag","focusTagAtIndex"]}}},"editing:tag":{tags:["editing","focused"],entry:"focusEditedTagInput",activities:["autoResizeTagInput"],on:{TAG_INPUT_TYPE:{actions:"setEditedTagValue"},TAG_INPUT_ESCAPE:{target:"navigating:tag",actions:["clearEditedTagValue","focusInput","clearEditedId","focusTagAtIndex"]},TAG_INPUT_BLUR:[{guard:"isInputRelatedTarget",target:"navigating:tag",actions:["clearEditedTagValue","clearFocusedId","clearEditedId"]},{target:"idle",actions:["clearEditedTagValue","clearFocusedId","clearEditedId","raiseExtBlurEvent"]}],TAG_INPUT_ENTER:{target:"navigating:tag",actions:["submitEditedTagValue","focusInput","clearEditedId","focusTagAtIndex","invokeOnTagUpdate"]}}}}},{guards:{isInputRelatedTarget:(e,t)=>t.relatedTarget===a.getInputEl(e),isAtMax:e=>e.isAtMax,hasFocusedId:e=>e.focusedId!==null,isTagFocused:(e,t)=>e.focusedId===t.id,isFirstTagFocused:e=>{var t;return((t=a.getFirstEl(e))==null?void 0:t.id)===e.focusedId},isLastTagFocused:e=>{var t;return((t=a.getLastEl(e))==null?void 0:t.id)===e.focusedId},isInputValueEmpty:e=>e.trimmedInputValue.length===0,hasTags:e=>e.value.length>0,allowOverflow:e=>!!e.allowOverflow,autoFocus:e=>!!e.autoFocus,addOnBlur:e=>e.blurBehavior==="add",clearOnBlur:e=>e.blurBehavior==="clear",addOnPaste:e=>!!e.addOnPaste,allowEditTag:e=>!!e.allowEditTag,isInputCaretAtStart(e){let t=a.getInputEl(e);if(!t)return!1;try{return t.selectionStart===0&&t.selectionEnd===0}catch(n){return t.value===""}}},activities:{autoResizeTagInput(e){if(!e.editedTagValue||e.__index==null||!e.allowEditTag)return;let t=a.getTagInputEl(e,{value:e.editedTagValue,index:e.__index});return _(t)}},actions:{raiseAddTagEvent(e,t,{self:n}){n.send("ADD_TAG")},raiseExtBlurEvent(e,t,{self:n}){n.send("EXT_BLUR")},invokeOnHighlight(e){var n;let t=a.getFocusedTagValue(e);(n=e.onHighlight)==null||n.call(e,t)},invokeOnTagUpdate(e){var n;if(!e.__index)return;let t=e.value[e.__index];(n=e.onTagUpdate)==null||n.call(e,t,e.__index)},invokeOnChange(e){var t;(t=e.onChange)==null||t.call(e,e.value)},dispatchChangeEvent(e){a.dispatchInputEvent(e)},setupDocument(e,t){e.uid=t.id,t.doc&&(e.doc=(0,m.ref)(t.doc)),f(()=>{e.liveRegion=M({level:"assertive",doc:e.doc})})},focusNextTag(e){if(!e.focusedId)return;let t=a.getNextEl(e,e.focusedId);t&&(e.focusedId=t.id)},focusFirstTag(e){y(()=>{var n;let t=(n=a.getFirstEl(e))==null?void 0:n.id;t&&(e.focusedId=t)})},focusLastTag(e){let t=a.getLastEl(e);t&&(e.focusedId=t.id)},focusPrevTag(e){if(!e.focusedId)return;let t=a.getPrevEl(e,e.focusedId);t&&(e.focusedId=t.id)},focusTag(e,t){e.focusedId=t.id},focusTagAtIndex(e){y(()=>{if(e.__index==null)return;let t=a.getElAtIndex(e,e.__index);t&&(e.focusedId=t.id,e.__index=void 0)})},deleteTag(e,t){let n=a.getIndexOfId(e,t.id),o=e.value[n];e.log.prev=e.log.current,e.log.current={type:"delete",value:o},e.value.splice(n,1)},deleteFocusedTag(e){if(!e.focusedId)return;let t=a.getIndexOfId(e,e.focusedId);e.__index=t;let n=e.value[t];e.log.prev=e.log.current,e.log.current={type:"delete",value:n},e.value.splice(t,1)},setEditedId(e,t){var n;e.editedId=(n=t.id)!=null?n:e.focusedId,e.__index=a.getIndexOfId(e,e.editedId)},clearEditedId(e){e.editedId=null},clearEditedTagValue(e){e.editedTagValue=""},setEditedTagValue(e,t){e.editedTagValue=t.value},submitEditedTagValue(e){var n;if(!e.editedId)return;let t=a.getIndexOfId(e,e.editedId);e.value[t]=(n=e.editedTagValue)!=null?n:"",e.log.prev=e.log.current,e.log.current={type:"update",value:e.editedTagValue}},initializeEditedTagValue(e){if(!e.editedId)return;let t=a.getIndexOfId(e,e.editedId);e.editedTagValue=e.value[t]},focusEditedTagInput(e){f(()=>{var t;(t=a.getEditInputEl(e))==null||t.select()})},setInputValue(e,t){e.inputValue=t.value},clearFocusedId(e){e.focusedId=null},focusInput(e){f(()=>{var t;(t=a.getInputEl(e))==null||t.focus()})},clearInputValue(e){e.inputValue=""},addTag(e,t){var r,l,g;let n=(r=t.value)!=null?r:e.trimmedInputValue;((l=e.validate)==null?void 0:l.call(e,{inputValue:n,values:e.value}))?(e.value.push(n),e.log.prev=e.log.current,e.log.current={type:"add",value:n}):(g=e.onInvalid)==null||g.call(e,"invalidTag")},addTagFromPaste(e){f(()=>{var o,r;let t=e.trimmedInputValue;if((o=e.validate)==null?void 0:o.call(e,{inputValue:t,values:e.value})){let l=e.delimiter?t.split(e.delimiter).map(g=>g.trim()):[t];e.value.push(...l),e.log.prev=e.log.current,e.log.current={type:"paste",values:l}}else(r=e.onInvalid)==null||r.call(e,"invalidTag");e.inputValue=""})},clearTags(e){e.value=[],e.log.prev=e.log.current,e.log.current={type:"clear"}},setValue(e,t){e.value=t.value},removeLiveRegion(e){var t;(t=e.liveRegion)==null||t.destroy()},invokeOnInvalid(e){var t;e.isOverflowing&&((t=e.onInvalid)==null||t.call(e,"rangeOverflow"))},clearLog(e){e.log={prev:null,current:null}},logFocused(e){if(!e.focusedId)return;let t=a.getIndexOfId(e,e.focusedId);e.log.prev=e.log.current,e.log.current={type:"select",value:e.value[t]}},announceLog(e){if(!e.log.current||e.liveRegion==null)return;let t=e.liveRegion,{current:n,prev:o}=e.log,r;switch(n.type){case"add":r=e.messages.tagAdded(n.value);break;case"delete":r=e.messages.tagDeleted(n.value);break;case"update":r=e.messages.tagUpdated(n.value);break;case"paste":r=e.messages.tagsPasted(n.values);break;case"select":r=e.messages.tagSelected(n.value),(o==null?void 0:o.type)==="delete"?r=`${e.messages.tagDeleted(o.value)}. ${r}`:(o==null?void 0:o.type)==="update"&&(r=`${e.messages.tagUpdated(o.value)}. ${r}`);break;default:break}r&&t.announce(r)}}});module.exports=Y(re);
//# sourceMappingURL=index.js.map
{
"name": "@zag-js/tags-input",
"version": "0.0.0-dev-20220407084218",
"version": "0.0.0-dev-20220408111010",
"description": "Core logic for the tags-input widget implemented as a state machine",

@@ -32,6 +32,6 @@ "keywords": [

"dependencies": {
"@zag-js/core": "^0.0.0-dev-20220407084218",
"@zag-js/dom-utils": "^0.0.0-dev-20220407084218",
"@zag-js/types": "^0.0.0-dev-20220407084218"
"@zag-js/core": "^0.0.0-dev-20220408111010",
"@zag-js/dom-utils": "^0.0.0-dev-20220408111010",
"@zag-js/types": "^0.0.0-dev-20220408111010"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc