@enonic/ui 1.0.0-beta.7 → 1.0.0-beta.8
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.
- package/dist/enonic-ui.cjs +1 -1
- package/dist/enonic-ui.es.js +1 -1
- package/package.json +1 -1
package/dist/enonic-ui.es.js
CHANGED
|
@@ -18,7 +18,7 @@ return N(Jr,{"data-component":"SearchField.Clear",className:bn("-mx-1.5 flex siz
|
|
|
18
18
|
return N(O,"tree"===I||"listbox"===I?{value:le,children:e}:{value:le,children:/* @__PURE__ */N(oo.Root,{selectionMode:R?"multiple":"single",selection:K,onSelectionChange:ne,disabled:f,active:j,focusMode:"roving-tabindex",baseId:k,setActive:q,registerItem:W,unregisterItem:_,getItems:Y,isItemDisabled:U,autoActiveOnOpen:Z,children:e})})};po.displayName="Combobox";const go=i(({className:e,children:t,...n},r)=>{const o=u(null),{setOpen:i,closeOnBlur:s}=z(),l=a(e=>{if(!s)return;const{relatedTarget:t}=e;t instanceof Node&&o.current?.contains(t)||t instanceof Element&&t.closest("[data-combobox-popup]")||i(!1)},[i,s]);
|
|
19
19
|
/* @__PURE__ */
|
|
20
20
|
return N("div",{"data-component":"Combobox.Content",ref:xn(r,o),className:bn("relative",e),onBlur:l,...n,children:t})});go.displayName="Combobox.Content";const bo=M(["flex items-center gap-2.5","h-12 rounded-sm border bg-surface-neutral","focus-within:outline-none focus-within:ring-3 focus-within:ring-ring focus-within:ring-offset-3 focus-within:ring-offset-ring-offset","transition-highlight"],{variants:{error:{true:"border-error focus-within:border-error focus-within:ring-error",false:"border-bdr-subtle"},open:{true:"border-bdr-strong",false:null},disabled:{true:"pointer-events-none select-none opacity-30",false:null}},compoundVariants:[{error:!0,open:!0,class:"border-error"}],defaultVariants:{error:!1,open:!1,disabled:!1}}),vo=({className:e,children:t,...n})=>{const{open:r,disabled:o,error:a,controlRef:i}=z();/* @__PURE__ */
|
|
21
|
-
return N("div",{"data-component":"Combobox.Control",ref:i,className:bn(bo({error:a,open:r,disabled:o}),e),"data-open":r?"true":void 0,...n,children:t})};vo.displayName="Combobox.Control";const ho=i((e,t)=>{const n=u(null),r=xn(t,n),{open:o,keyHandler:a,baseId:i,disabled:s,error:l,contentType:d,hasValue:m}=z();c(()=>{o&&!s&&n.current?.focus()},[o,s]);const f=u(o);return c(()=>{!f.current||o||s||n.current?.focus({focusVisible:!0}),f.current=o},[o,s]),m&&!o?null:/* @__PURE__ */N(co.Input,{"data-component":"Combobox.Input",ref:r,id:`${i}-input`,onKeyDown:a,"aria-disabled":s,"aria-invalid":l??void 0,role:"combobox","aria-autocomplete":"list","aria-expanded":o,"aria-haspopup":"tree"===d?"tree":"listbox","aria-controls":`${i}-${"tree"===d?"tree":"listbox"}`,...e})});ho.displayName="Combobox.Input";const yo=({children:e,className:t,...n})=>{const{inputValue:r,setInputValue:o,error:a}=z();/* @__PURE__ */
|
|
21
|
+
return N("div",{"data-component":"Combobox.Control",ref:i,className:bn(bo({error:a,open:r,disabled:o}),e),"data-open":r?"true":void 0,...n,children:t})};vo.displayName="Combobox.Control";const ho=i((e,t)=>{const n=u(null),r=xn(t,n),{open:o,keyHandler:a,baseId:i,disabled:s,error:l,contentType:d,hasValue:m}=z();c(()=>{o&&!s&&n.current?.focus()},[o,s]);const f=u(o);return c(()=>{!f.current||o||s||n.current?.focus({focusVisible:!0}),f.current=o},[o,s]),m&&!o?null:/* @__PURE__ */N(co.Input,{"data-component":"Combobox.Input",ref:r,id:`${i}-input`,onKeyDown:a,disabled:s,"aria-disabled":s,"aria-invalid":l??void 0,role:"combobox","aria-autocomplete":"list","aria-expanded":o,"aria-haspopup":"tree"===d?"tree":"listbox","aria-controls":`${i}-${"tree"===d?"tree":"listbox"}`,...e})});ho.displayName="Combobox.Input";const yo=({children:e,className:t,...n})=>{const{inputValue:r,setInputValue:o,error:a}=z();/* @__PURE__ */
|
|
22
22
|
return N(co.Root,{"data-component":"Combobox.Search",value:r,onChange:o,className:bn("w-full pr-0","border-0 focus-within:border-0 focus-within:ring-0 focus-within:ring-offset-0",a&&"hover:outline-error",t),...n,children:e})};yo.displayName="Combobox.Search";const wo=({className:e,...t})=>{const{open:n,hasValue:r}=z();return r&&!n?null:/* @__PURE__ */N(co.Icon,{"data-component":"Combobox.SearchIcon",className:e,...t})};wo.displayName="Combobox.SearchIcon";const xo=({className:e,...t})=>{const{open:n,setOpen:r,disabled:o}=z();/* @__PURE__ */
|
|
23
23
|
return N(Jr,{"data-component":"Combobox.Toggle",type:"button",variant:"text",size:"sm",iconSize:"lg",icon:Hn,"aria-label":"Toggle",onClick:()=>{o||r(!n)},disabled:o,tabIndex:-1,iconClassName:bn("transition-transform duration-150",n&&"rotate-180"),className:bn("mr-1.25 shrink-0 rounded-[0.1875rem] text-subtle hover:bg-surface-neutral-hover",'after:-inset-1 after:-z-10 relative z-0 overflow-visible after:absolute after:rounded-sm after:content-[""]',!o&&"after:pointer-events-auto","disabled:opacity-100",e),...t})};xo.displayName="Combobox.Toggle";const Io=({className:e,children:t,...n})=>{const{open:r,setOpen:o,disabled:i,setHasValue:s}=z(),l=u(null),d=u(r);m(()=>(s(!0),()=>s(!1)),[s]),c(()=>{d.current&&!r&&l.current?.focus(),d.current=r},[r]);const f=a(()=>{i||o(!0)},[i,o]),p=a(e=>{"Enter"!==e.key&&" "!==e.key&&"ArrowDown"!==e.key&&"ArrowUp"!==e.key||(e.preventDefault(),o(!0))},[o]);return r?null:/* @__PURE__ */N("button",{"data-component":"Combobox.Value",ref:l,type:"button",onClick:f,onKeyDown:p,disabled:i,className:bn("flex flex-1 items-center gap-2 truncate text-left","-mx-4.5 -my-3 h-11.5 px-4.5","cursor-pointer select-none","focus-visible:outline-none",i&&"pointer-events-none cursor-not-allowed",e),...n,children:t})};Io.displayName="Combobox.Value";const No=({className:e,label:t="Apply",...n})=>{const{stagingEnabled:r,hasStagedChanges:o,applyStagedSelection:a}=z();return r&&o?/* @__PURE__ */N(Pn,{"data-component":"Combobox.Apply",className:bn("h-7 min-w-14 gap-2 px-2.5 text-xs",e),type:"button",label:t,variant:"outline",onClick:a,...n}):null};No.displayName="Combobox.Apply";const ko=({container:e,forceMount:t,children:n})=>{const{open:r}=z(),[o,a]=s(!1);return c(()=>{a(!0)},[]),o&&(t||r)?h(n,e??document.body):null};ko.displayName="Combobox.Portal";const Co=i(({children:e,className:t,style:n,...r},o)=>{const{open:i,setOpen:l,controlRef:c,closeOnBlur:d,contentType:f,baseId:p,stagingEnabled:g,applyStagedSelection:b,selectionMode:v}=z(),h=u(null),y=xn(o,h),[w,x]=s(!1);m(()=>{if(!i||!h.current)return;const e=h.current.parentElement;x(e===document.body)},[i]),xr(h,w);const I=ur({enabled:i&&w,anchorRef:c,contentRef:h,align:"start"});sr({enabled:i&&w&&d,contentRef:h,excludeRefs:c?[c]:void 0,onClose:()=>l(!1)});const k=a(()=>{const e=document.getElementById(`${p}-input`);e?.focus({focusVisible:!0})},[p]),C=a(e=>{if("tree"!==f){if("Escape"===e.key)return e.preventDefault(),e.stopPropagation(),l(!1),void k();if("Enter"===e.key){if("single"===v&&!g)return;e.preventDefault(),e.stopPropagation(),g?b():l(!1),k()}}},[f,l,k,g,b,v]),D=a(e=>{if("tree"===f)return;if(e.metaKey||e.ctrlKey||e.altKey)return;const t=1===e.key.length&&" "!==e.key,n="Backspace"===e.key;(t||n)&&k()},[f,k]);if(!i)return null;const S=w&&c?.current?c.current.offsetWidth:void 0,M=w&&!I,A=w?{position:"fixed",top:I?`${I.top}px`:"0",left:void 0!==I?.left?`${I.left}px`:void 0,right:void 0!==I?.right?`${I.right}px`:void 0,width:S,...n??{}}:n??{};
|
|
24
24
|
/* @__PURE__ */
|