@enonic/ui 0.40.0 → 0.40.1
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
|
@@ -190,4 +190,4 @@ return I(zr,{ref:l,icon:i,variant:"text",title:t?"Collapse":"Expand",tabIndex:-1
|
|
|
190
190
|
/* @__PURE__ */I(ll,{level:e,levelIndent:t}),r??/* @__PURE__ */I("span",{className:"text-sm text-subtle italic",children:"Placeholder"})]}));ml.displayName="TreeList.RowPlaceholder";const fl=Object.assign(tl,{Root:tl,Container:nl,Row:rl,RowLeft:il,RowRight:ol,RowContent:al,RowLevelSpacer:ll,RowExpandControl:cl,RowSelectionControl:dl,RowLoading:ul,RowPlaceholder:ml,Action:sl}),gl=a(({items:e,selection:t,defaultSelection:n,onSelectionChange:r,selectionMode:i="single",active:a,defaultActive:d,onActiveChange:m,onExpand:f,onCollapse:g,onActivate:p,virtuosoRef:b,loop:v=!1,getItemInteraction:h,clearActiveOnReclick:y=!1,preserveFilteredSelection:w=!1,clearSelectionOnEscape:x=!0,"aria-label":N,className:k,children:C,...D},S)=>{const M=Q(void 0,"virtualized-tree-list"),A=u(null),[P,R]=Zn(t,n??/* @__PURE__ */new Set,r),[O,z]=Xn(a,d,m),T=u(null),E=l(()=>{if(!O)return null;const t=e.findIndex(e=>e.id===O);return-1===t?null:t},[O,e]),$=o(t=>{if(null===t)z(null);else{const n=e[t];n&&z(n.id)}},[e,z]),[V,L]=s(!1),F=o(e=>{b?.current?.scrollToIndex({index:e,align:"center",behavior:"auto"})},[b]),K=o(e=>h?h(e):e.isLoading||null==e.data?"none":"full",[h]),H=o(e=>"none"!==K(e),[K]),B=o(e=>"full"===K(e),[K]),j=o((t,n)=>{if("none"===i)return;const r=e[n];if(!r||!B(r))return;const o=new Set("multiple"===i?P:[]),a=P.has(t);a?o.delete(t):o.add(t),a||(T.current=n),R(o)},[P,i,R,e,B]),G=o((t,n)=>{if("multiple"!==i)return;const r=Math.min(t,n),o=Math.max(t,n),a=e.slice(r,o+1).filter(e=>B(e)).map(e=>e.id);R(/* @__PURE__ */new Set([...P,...a]))},[e,P,i,R,B]),q=o(t=>e.findIndex(e=>e.id===t),[e]),[W,Y]=s(void 0),_='button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',U=o(()=>{Y(void 0);const e=A.current?.querySelector('[role="tree"]');e?.focus()},[]);c(()=>{if(!W)return;const e=`${M}-item-${W}`,t=new MutationObserver(()=>{document.getElementById(e)||(Y(void 0),t.disconnect(),requestAnimationFrame(()=>{const e=A.current?.querySelector('[role="tree"]');e?.focus()}))}),n=A.current;return n&&t.observe(n,{childList:!0,subtree:!0}),()=>t.disconnect()},[W,M]),c(()=>{const t=new Set(e.map(e=>e.id));if(!w){let e=!1;const n=/* @__PURE__ */new Set;for(const r of P)t.has(r)?n.add(r):e=!0;e&&R(n)}if(O&&!t.has(O)){const t=e[0]?.id??null;z(t)}if(null!==T.current){const n=e[T.current];n&&t.has(n.id)||(T.current=null)}},[e,w]);const Z=o((t,n)=>{if(!e.length)return null;let r=(t??(n>0?-1:e.length))+n;for(;r>=0&&r<e.length;){const t=e[r];if(t&&H(t))return r;r+=n}return null},[e,H]),{handleKeyDown:X}=pr({items:e,activeIndex:E,setActiveIndex:$,scrollToIndex:F,onExpand:f,onCollapse:g,onSelect:(e,t)=>j(e,t),loop:v,isItemDisabled:e=>!H(e)}),J=o(t=>{if(!W||" "!==t.key&&"Enter"!==t.key){if("F2"===t.key){if(t.preventDefault(),null===E)return;const n=e[E];if(!n)return;return F(E),void requestAnimationFrame(()=>{const e=`${M}-item-${n.id}`,t=document.getElementById(e);if(!t)return;const r=t.querySelectorAll(_)[0];r&&(Y(n.id),r.focus())})}if("Tab"===t.key&&W){t.preventDefault();const e=`${M}-item-${W}`,n=document.getElementById(e);if(!n)return void U();const r=Array.from(n.querySelectorAll(_));if(0===r.length)return void U();const i=r.indexOf(document.activeElement);return void(t.shiftKey?i<=0?U():r[i-1]?.focus():-1===i||i===r.length-1?U():r[i+1]?.focus())}if("Escape"===t.key)return t.preventDefault(),void(W?U():x&&"none"!==i&&R(/* @__PURE__ */new Set));if("Enter"===t.key&&null!==E){t.preventDefault();const n=e[E];return void(n&&B(n)&&p?.(n.id))}if(t.shiftKey&&"multiple"===i&&("ArrowUp"===t.key||"ArrowDown"===t.key)){if(t.preventDefault(),null===E)return;const n=T.current??E;null===T.current&&(T.current=E);const r="ArrowDown"===t.key?1:-1,i=Z(E,r);if(null!==i){$(i),F(i);const[t,r]=[Math.min(n,i),Math.max(n,i)],o=e.slice(t,r+1).filter(e=>B(e)).map(e=>e.id);R(new Set(o))}return}if((t.ctrlKey||t.metaKey)&&"a"===t.key&&"multiple"===i){t.preventDefault();const n=e.filter(e=>B(e)).map(e=>e.id),r=n.every(e=>P.has(e));return void R(r?/* @__PURE__ */new Set:new Set(n))}X(t)}},[W,E,e,F,M,U,i,R,p,Z,$,P,X,B,x]),ee=o((t,n,r)=>{if(r.target.closest('button, a, input, select, textarea, [role="button"]'))return;const o=e[n];if(!o||!H(o))return;const a=r.currentTarget.closest('[role="tree"]');a?.focus(),y&&E===n&&1===r.detail?$(null):y&&r.detail>1||($(n),y||B(o)&&"none"!==i&&("multiple"===i?r.shiftKey&&null!==T.current?G(T.current,n):r.metaKey||r.ctrlKey?j(t,n):(T.current=n,R(/* @__PURE__ */new Set([t]))):j(t,n)))},[i,$,j,G,R,e,H,B,y,E]),te=o((e,t)=>{const n=E===e,r=P.has(t.id);let o;return"none"!==i&&(o=!!r||"multiple"!==i&&void 0),{id:`${M}-item-${t.id}`,"data-index":e,role:"treeitem","aria-selected":o,"aria-expanded":t.hasChildren?t.isExpanded:void 0,"aria-level":t.level,onClick:n=>ee(t.id,e,n),onDblClick:()=>p?.(t.id),onDoubleClick:()=>p?.(t.id),active:n,selected:r}},[M,E,P,i,ee,p]),ne=o(()=>{L(!0)},[]),re=o(()=>{L(!1)},[]),ie=l(()=>({role:"tree","aria-label":N,"aria-activedescendant":O?`${M}-item-${O}`:void 0,"aria-multiselectable":"multiple"===i||void 0,tabIndex:0,className:"group/tree outline-none",onKeyDown:J,onFocus:ne,onBlur:re}),[N,O,M,i,J,ne,re]),oe=l(()=>({items:e,getItemProps:te,activeIndex:E,containerProps:ie}),[e,te,E,ie]),ae=l(()=>({baseId:M,activeIndex:E,activeId:O??null,setActiveIndex:$,selection:P,toggleSelection:j,selectionMode:i,isFocused:V,items:e,getItemIndex:q,scrollToIndex:F,onExpand:f,onCollapse:g,onActivate:p,actionModeRowId:W,exitActionMode:U}),[M,E,O,$,P,j,i,V,e,q,F,f,g,p,W,U]);/* @__PURE__ */
|
|
191
191
|
return I(Be,{value:ae,children:/* @__PURE__ */I("div",{id:M,ref:e=>{A.current=e,"function"==typeof S?S(e):S&&(S.current=e)},className:ln("outline-none focus-within:ring-2 focus-within:ring-ring/10 focus-within:ring-inset",k),...D,children:C(oe)})})});gl.displayName="VirtualizedTreeList";const pl=a(({active:e=!1,selected:t=!1,disabled:n=!1,selectable:r=!0,className:i,children:o,...a},s)=>/* @__PURE__ */I("div",{ref:s,"data-tone":t?"inverse":void 0,"data-active":e||void 0,"aria-disabled":n||void 0,className:ln(el({active:e,selected:t,disabled:n,selectable:r&&!n}),e&&!n&&["group-focus-visible/tree:ring-3 group-focus-visible/tree:ring-ring-offset group-focus-visible/tree:ring-inset","group-focus-visible/tree:ring-offset-3 group-focus-visible/tree:ring-offset-ring"],i),...a,children:o}));pl.displayName="VirtualizedTreeList.Row";const bl=({children:e})=>g(e,{tabIndex:-1});bl.displayName="VirtualizedTreeList.Action";const vl=a(({rowId:e,expanded:t=!1,hasChildren:n=!1,onToggle:r,icon:i=zn,selected:o=!1,className:a,...s},l)=>{const c=je();if(!n)/* @__PURE__ */
|
|
192
192
|
return I("span",{className:"size-5 shrink-0"});/* @__PURE__ */
|
|
193
|
-
return I(zr,{ref:l,icon:i,variant:"text",title:t?"Collapse":"Expand",tabIndex:-1,className:ln("size-5 bg-transparent transition-transform duration-150 hover:bg-transparent active:bg-transparent active:text-main",o&&"text-alt hover:text-alt active:text-alt",t&&"rotate-90",a),onClick:t=>{if(r?.(),e){const t=c.getItemIndex(e);-1!==t&&c.setActiveIndex(t)}t.stopPropagation()},onDblClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),...s})});vl.displayName="VirtualizedTreeList.RowExpandControl";const hl=a(({rowId:e,selected:t,selectable:n=!0,variant:r,className:i,...a},s)=>{const{selection:l,toggleSelection:c,setActiveIndex:d,selectionMode:u,getItemIndex:m}=je(),f=t??l.has(e),g=r??("multiple"===u?"checkbox":void 0),p=o(t=>{t.stopPropagation();const n=m(e);-1!==n&&(d(n),c(e,n));const r=t.currentTarget.closest('[role="tree"]');r?.focus()},[e,d,c,m]),b=o(t=>{if(" "===t.key||"Enter"===t.key){t.preventDefault(),t.stopPropagation();const n=m(e);-1!==n&&(d(n),c(e,n))}},[e,d,c,m]);return n&&"none"!==u&&g?/* @__PURE__ */I("div","radio"===g?{ref:s,role:"radio","aria-checked":f,"aria-label":f?"Selected":"Select row",tabIndex:-1,className:ln("flex size-4 cursor-pointer items-center",i),onKeyDown:b,onDblClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),...a,onClick:p,children:f?/* @__PURE__ */I(br,{className:"size-4"}):/* @__PURE__ */I(Ln,{className:"size-4",strokeWidth:2})}:{ref:s,role:"checkbox","aria-checked":f,"aria-label":f?"Deselect row":"Select row",tabIndex:-1,className:ln("flex size-4 cursor-pointer items-center",i),onKeyDown:b,onDblClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),...a,onClick:p,children:/* @__PURE__ */I(f?Dr:Wn,{})}):null});hl.displayName="VirtualizedTreeList.RowSelectionControl";const yl=Object.assign(gl,{Row:pl,RowLeft:il,RowRight:ol,RowContent:al,RowLevelSpacer:ll,RowExpandControl:vl,RowSelectionControl:hl,RowLoading:ul,RowPlaceholder:ml,Action:bl});export{yn as Avatar,A as AvatarProvider,xn as Button,Rr as Checkbox,br as CircleDisc,vr as CircleDiscIcon,li as Combobox,O as ComboboxProvider,Mi as ContextMenu,E as ContextMenuProvider,ho as DatePicker,L as DatePickerProvider,Go as Dialog,H as DialogProvider,hr as FilledCircleAlert,yr as FilledCircleAlertIcon,wr as FilledCircleCheck,xr as FilledCircleCheckIcon,Ir as FilledCircleInfo,Nr as FilledCircleInfoIcon,kr as FilledCircleX,Cr as FilledCircleXIcon,Dr as FilledSquareCheck,Sr as FilledSquareCheckIcon,Mr as FilledSquareMinus,Ar as FilledSquareMinusIcon,j as FocusContainerContext,Uo as GridList,W as GridListProvider,U as GridListRowProvider,zr as IconButton,J as IdProvider,Jo as Input,ea as Link,sa as ListItem,Fr as Listbox,te as ListboxProvider,ha as Menu,ie as MenuProvider,Ea as Menubar,ae as MenubarMenuContext,se as MenubarMenuProvider,ue as MenubarProvider,Ha as RadioGroup,pe as RadioGroupProvider,Gr as SearchField,he as SearchFieldProvider,Ba as SelectableListItem,Gi as Selector,xe as SelectorProvider,ja as Separator,_a as Skeleton,So as Stepper,ke as StepperProvider,es as Tab,Se as TabProvider,ns as TextArea,vs as TimePicker,Pe as TimePickerProvider,Ms as Toast,ze as ToastProvider,As as Toggle,Ts as ToggleGroup,$e as ToggleGroupProvider,_s as Toolbar,Js as Tooltip,fl as TreeList,Fe as TreeListProvider,al as TreeListRowContent,cl as TreeListRowExpandControl,il as TreeListRowLeft,ll as TreeListRowLevelSpacer,ul as TreeListRowLoading,ml as TreeListRowPlaceholder,ol as TreeListRowRight,dl as TreeListRowSelectionControl,yl as VirtualizedTreeList,Be as VirtualizedTreeListProvider,ln as cn,Ge as generateAriaId,qe as generateAriaIds,We as generateItemId,Ye as getActiveDescendantId,dn as getIsMobile,mn as setRef,un as subscribeToMobileChanges,el as treeListRowVariants,gn as unwrap,_n as useActiveItemFocus,P as useAvatar,Un as useClickOutside,z as useCombobox,fn as useComposedRefs,$ as useContextMenu,Zn as useControlledState,Xn as useControlledStateWithNull,F as useDatePicker,B as useDialog,Jn as useFloatingPosition,G as useFocusContainerRegistry,Y as useGridList,Z as useGridListRow,er as useGridNavigation,tr as useItemRegistry,nr as useItemTextRegistry,rr as useKeyboardNavigation,ne as useListbox,oe as useMenu,me as useMenubar,le as useMenubarMenu,ce as useMenubarMenuOptional,fe as useMenubarOptional,or as usePointerPosition,ar as usePortalFocusContainer,Q as usePrefixedId,be as useRadioGroup,sr as useRadioNavigation,lr as useRovingTabIndex,cr as useScrollActiveIntoView,dr as useScrollLock,ye as useSearchField,Ie as useSelector,mr as useSelectorKeyboard,fr as useStepNavigation,Ce as useStepper,gr as useSyncValue,Me as useTab,Re as useTimePicker,Te as useToast,Ve as useToggleGroup,Bs as useToolbar,js as useToolbarOptional,Ke as useTreeList,ur as useTypeAhead,pr as useVirtualizedKeyboardNavigation,je as useVirtualizedTreeList};
|
|
193
|
+
return I(zr,{ref:l,icon:i,variant:"text",title:t?"Collapse":"Expand",tabIndex:-1,className:ln("size-5 bg-transparent transition-transform duration-150 hover:bg-transparent active:bg-transparent active:text-main",o&&"text-alt hover:text-alt active:text-alt",t&&"rotate-90",a),onClick:t=>{if(r?.(),e){const t=c.getItemIndex(e);-1!==t&&c.setActiveIndex(t)}t.stopPropagation()},onDblClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),...s})});vl.displayName="VirtualizedTreeList.RowExpandControl";const hl=a(({rowId:e,selected:t,selectable:n=!0,variant:r,className:i,...a},s)=>{const{selection:l,toggleSelection:c,setActiveIndex:d,selectionMode:u,getItemIndex:m}=je(),f=t??l.has(e),g=r??("multiple"===u?"checkbox":void 0),p=o(t=>{t.stopPropagation();const n=m(e);-1!==n&&(d(n),c(e,n));const r=t.currentTarget.closest('[role="tree"]');r?.focus()},[e,d,c,m]),b=o(t=>{if(" "===t.key||"Enter"===t.key){t.preventDefault(),t.stopPropagation();const n=m(e);-1!==n&&(d(n),c(e,n))}},[e,d,c,m]);return n&&"none"!==u&&g?/* @__PURE__ */I("div","radio"===g?{ref:s,role:"radio","aria-checked":f,"aria-label":f?"Selected":"Select row",tabIndex:-1,className:ln("flex size-4 cursor-pointer items-center",i),onKeyDown:b,onDblClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),...a,onClick:p,children:f?/* @__PURE__ */I(br,{className:"size-4"}):/* @__PURE__ */I(Ln,{className:"size-4",strokeWidth:2})}:{ref:s,role:"checkbox","aria-checked":f,"aria-label":f?"Deselect row":"Select row",tabIndex:-1,className:ln("flex size-4 cursor-pointer items-center",'after:-inset-1 after:-z-10 relative z-0 after:pointer-events-auto after:absolute after:rounded-sm after:content-[""]',i),onKeyDown:b,onDblClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),...a,onClick:p,children:/* @__PURE__ */I(f?Dr:Wn,{})}):null});hl.displayName="VirtualizedTreeList.RowSelectionControl";const yl=Object.assign(gl,{Row:pl,RowLeft:il,RowRight:ol,RowContent:al,RowLevelSpacer:ll,RowExpandControl:vl,RowSelectionControl:hl,RowLoading:ul,RowPlaceholder:ml,Action:bl});export{yn as Avatar,A as AvatarProvider,xn as Button,Rr as Checkbox,br as CircleDisc,vr as CircleDiscIcon,li as Combobox,O as ComboboxProvider,Mi as ContextMenu,E as ContextMenuProvider,ho as DatePicker,L as DatePickerProvider,Go as Dialog,H as DialogProvider,hr as FilledCircleAlert,yr as FilledCircleAlertIcon,wr as FilledCircleCheck,xr as FilledCircleCheckIcon,Ir as FilledCircleInfo,Nr as FilledCircleInfoIcon,kr as FilledCircleX,Cr as FilledCircleXIcon,Dr as FilledSquareCheck,Sr as FilledSquareCheckIcon,Mr as FilledSquareMinus,Ar as FilledSquareMinusIcon,j as FocusContainerContext,Uo as GridList,W as GridListProvider,U as GridListRowProvider,zr as IconButton,J as IdProvider,Jo as Input,ea as Link,sa as ListItem,Fr as Listbox,te as ListboxProvider,ha as Menu,ie as MenuProvider,Ea as Menubar,ae as MenubarMenuContext,se as MenubarMenuProvider,ue as MenubarProvider,Ha as RadioGroup,pe as RadioGroupProvider,Gr as SearchField,he as SearchFieldProvider,Ba as SelectableListItem,Gi as Selector,xe as SelectorProvider,ja as Separator,_a as Skeleton,So as Stepper,ke as StepperProvider,es as Tab,Se as TabProvider,ns as TextArea,vs as TimePicker,Pe as TimePickerProvider,Ms as Toast,ze as ToastProvider,As as Toggle,Ts as ToggleGroup,$e as ToggleGroupProvider,_s as Toolbar,Js as Tooltip,fl as TreeList,Fe as TreeListProvider,al as TreeListRowContent,cl as TreeListRowExpandControl,il as TreeListRowLeft,ll as TreeListRowLevelSpacer,ul as TreeListRowLoading,ml as TreeListRowPlaceholder,ol as TreeListRowRight,dl as TreeListRowSelectionControl,yl as VirtualizedTreeList,Be as VirtualizedTreeListProvider,ln as cn,Ge as generateAriaId,qe as generateAriaIds,We as generateItemId,Ye as getActiveDescendantId,dn as getIsMobile,mn as setRef,un as subscribeToMobileChanges,el as treeListRowVariants,gn as unwrap,_n as useActiveItemFocus,P as useAvatar,Un as useClickOutside,z as useCombobox,fn as useComposedRefs,$ as useContextMenu,Zn as useControlledState,Xn as useControlledStateWithNull,F as useDatePicker,B as useDialog,Jn as useFloatingPosition,G as useFocusContainerRegistry,Y as useGridList,Z as useGridListRow,er as useGridNavigation,tr as useItemRegistry,nr as useItemTextRegistry,rr as useKeyboardNavigation,ne as useListbox,oe as useMenu,me as useMenubar,le as useMenubarMenu,ce as useMenubarMenuOptional,fe as useMenubarOptional,or as usePointerPosition,ar as usePortalFocusContainer,Q as usePrefixedId,be as useRadioGroup,sr as useRadioNavigation,lr as useRovingTabIndex,cr as useScrollActiveIntoView,dr as useScrollLock,ye as useSearchField,Ie as useSelector,mr as useSelectorKeyboard,fr as useStepNavigation,Ce as useStepper,gr as useSyncValue,Me as useTab,Re as useTimePicker,Te as useToast,Ve as useToggleGroup,Bs as useToolbar,js as useToolbarOptional,Ke as useTreeList,ur as useTypeAhead,pr as useVirtualizedKeyboardNavigation,je as useVirtualizedTreeList};
|