ingred-ui 27.0.4 → 27.0.5

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/index.es.js CHANGED
@@ -574,7 +574,7 @@ var _n=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[hr
574
574
  flex: 1;
575
575
  overflow: auto;
576
576
  padding: ${({$hasStickyHeader:e,$hasStickyFooter:t})=>`${e?"8px":"0"} 0 ${t?"8px":"0"}`};
577
- `,ns=n((({open:n,trigger:l,width:s,minWidth:u,maxHeight:p,children:h,onOpenChange:g,stickyHeader:f,stickyFooter:b,placement:v,middleware:x},y)=>{const{isRoot:w,close:C}=c(Di),[E,I]=r(!1),[k,A]=r(!1),M=a((()=>!!k||(void 0!==n?n:E)),[n,E,k]),L=d((()=>{C(),I(!1),A(!1),null==g||g(!1)}),[C,I,A,g]),$=function(e){const t=Er(),n=$r(),r=Lr();return vr((()=>{const e={id:t,parentId:r};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,r]),t}(),{refs:D,floatingStyles:O,context:S}=gi({nodeId:$,open:M,onOpenChange:e=>{I(e),null==g||g(e)},placement:v,middleware:null!=x?x:[bn({mainAxis:5,crossAxis:0}),xn({apply({availableWidth:e,availableHeight:t,elements:n}){let r=Math.max(0,t);if(p)if("number"==typeof p)r=Math.min(r,p);else{if(!/[a-z%]+$/i.test(p)){const e=parseFloat(p);isNaN(e)||(r=Math.min(r,e))}}Object.assign(n.floating.style,{maxWidth:`${Math.max(0,e)}px`,maxHeight:`${r}px`})}}),gn((()=>{if(w)return{allowedPlacements:["bottom-start","bottom-end","top-start","top-end"]};return{allowedPlacements:window.matchMedia("(max-width: 480px)").matches?["bottom-start"]:["right-start","left-start"],autoAlignment:!1}}))],whileElementsMounted:Vn}),V=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:i,dataRef:o,elements:{domReference:a}}=t,{enabled:l=!0,event:s="click",toggle:c=!0,ignoreMouse:d=!1,keyboardHandlers:u=!0}=n,p=e.useRef(),m=e.useRef(!1);return e.useMemo((()=>l?{reference:{onPointerDown(e){p.current=e.pointerType},onMouseDown(e){0===e.button&&(Rt(p.current,!0)&&d||"click"!==s&&(!r||!c||o.current.openEvent&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),i(!0,e.nativeEvent,"click")):i(!1,e.nativeEvent,"click")))},onClick(e){"mousedown"===s&&p.current?p.current=void 0:Rt(p.current,!0)&&d||(!r||!c||o.current.openEvent&&"click"!==o.current.openEvent.type?i(!0,e.nativeEvent,"click"):i(!1,e.nativeEvent,"click"))},onKeyDown(e){p.current=void 0,e.defaultPrevented||!u||si(e)||(" "!==e.key||ci(a)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&i(!r||!c,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!u||si(e)||ci(a)||" "===e.key&&m.current&&(m.current=!1,i(!r||!c,e.nativeEvent,"click"))}}}:{}),[l,o,s,d,u,a,c,r,i])}(S),N=Rr(S,{enabled:!w,mouseOnly:!0,delay:{open:100,close:k?999999:100},restMs:100,handleClose:Mi()}),H=mi(S),[R,T]=r(null),Z=ki(S),z=i([]),B=Ii(S,{listRef:z,activeIndex:R,onNavigate:T,loop:!0,nested:!w}),_=$i(z,[]),{getReferenceProps:P,getFloatingProps:F,getItemProps:G}=bi([V,N,H,Z,B]),j=[ns.displayName,Hi.displayName,_i.displayName,Xi.displayName,qi.displayName,Wl.displayName,Xl.displayName];o((()=>{Ul(l)&&D.setPositionReference({getBoundingClientRect:()=>({width:0,height:0,x:l.x,y:l.y,top:l.y,left:l.x,right:l.x,bottom:l.y})})}),[l,y,D]);const W=function(t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}),t)}([y,D.setReference]);return t.createElement(t.Fragment,null,Ul(l)?null:m(l,Object.assign(Object.assign({ref:W},P()),l.props)),t.createElement(Dr,{id:$},M&&t.createElement(ii,null,t.createElement(li,{context:S,modal:!1,initialFocus:-1,returnFocus:!1},t.createElement(ql,Object.assign({ref:D.setFloating,$maxHeight:p,style:Object.assign(Object.assign({},O),{width:null!=s?s:"auto",minWidth:null!=u?u:"auto"})},F()),t.createElement(Di.Provider,{value:{isRoot:!1,activeIndex:R,maxActiveIndex:_,setActiveIndex:T,close:L}},t.createElement(Hl.Provider,{value:{isSorting:k,setIsSorting:A}},f&&t.createElement(Kl,null,f),t.createElement(ts,{$hasStickyHeader:!!f,$hasStickyFooter:!!b},((e,n=!0)=>t.Children.toArray(e).filter((e=>{if(!t.isValidElement(e))return!1;const r=e.type;if(r===t.Fragment)return!0;const i="function"==typeof r||"object"==typeof r?r.displayName:void 0;return"ContextMenu2TriggerItem"===i||"DataTable2MenuCountControl"===i||"DataTable2MenuSpaceControl"===i||"DataTable2MenuOrderControl"===i||("ContextMenu2Container"===i||(n||("function"==typeof r||"object"==typeof r)&&j.includes(r.displayName)))})).map((e=>t.isValidElement(e)?t.cloneElement(e,Object.assign(Object.assign(Object.assign({tabIndex:R===e.key?0:-1,ref:t=>{z.current[e.key]=t}},G()),e.props),{key:e.key})):e)))(h)),b&&t.createElement(es,null,b))))))))}));ns.displayName="ContextMenu2";const rs=({children:e})=>{if(!g(e)||"string"==typeof e.type||"function"!=typeof e.type&&"object"!=typeof e.type||!("displayName"in e.type)||e.type.displayName!==ns.displayName)throw new Error("ContextMenu2Container には 1 つの ContextMenu2 しか入れられません");return t.createElement(Di.Provider,{value:{isRoot:!0,close:()=>{},activeIndex:null,maxActiveIndex:-1,setActiveIndex:()=>{}}},t.createElement(Or,null,e))},is=x((({className:e,children:n})=>t.createElement("p",{className:e},n)))`
577
+ `,ns=n((({open:n,trigger:l,width:s,minWidth:u,maxHeight:p,children:h,onOpenChange:g,stickyHeader:f,stickyFooter:b,placement:v,middleware:x},y)=>{const{isRoot:w,close:C}=c(Di),[E,I]=r(!1),[k,A]=r(!1),M=a((()=>!!k||(void 0!==n?n:E)),[n,E,k]),L=d((()=>{C(),I(!1),A(!1),null==g||g(!1)}),[C,I,A,g]),$=function(e){const t=Er(),n=$r(),r=Lr();return vr((()=>{const e={id:t,parentId:r};return null==n||n.addNode(e),()=>{null==n||n.removeNode(e)}}),[n,t,r]),t}(),{refs:D,floatingStyles:O,context:S}=gi({nodeId:$,open:M,onOpenChange:e=>{I(e),null==g||g(e)},placement:v,middleware:null!=x?x:[bn({mainAxis:5,crossAxis:0}),gn((()=>{if(w)return{allowedPlacements:["bottom-start","bottom-end","top-start","top-end"]};return{allowedPlacements:window.matchMedia("(max-width: 480px)").matches?["bottom-start"]:["right-start","left-start"],autoAlignment:!1}})),xn({apply({availableWidth:e,availableHeight:t,elements:n}){let r=Math.max(0,t);if(p)if("number"==typeof p)r=Math.min(r,p);else{if(!/[a-z%]+$/i.test(p)){const e=parseFloat(p);isNaN(e)||(r=Math.min(r,e))}}Object.assign(n.floating.style,Object.assign({maxWidth:`${Math.max(0,e)}px`,maxHeight:`${r}px`},null!=s&&{width:`${s}px`}))}})],whileElementsMounted:Vn}),V=function(t,n){void 0===n&&(n={});const{open:r,onOpenChange:i,dataRef:o,elements:{domReference:a}}=t,{enabled:l=!0,event:s="click",toggle:c=!0,ignoreMouse:d=!1,keyboardHandlers:u=!0}=n,p=e.useRef(),m=e.useRef(!1);return e.useMemo((()=>l?{reference:{onPointerDown(e){p.current=e.pointerType},onMouseDown(e){0===e.button&&(Rt(p.current,!0)&&d||"click"!==s&&(!r||!c||o.current.openEvent&&"mousedown"!==o.current.openEvent.type?(e.preventDefault(),i(!0,e.nativeEvent,"click")):i(!1,e.nativeEvent,"click")))},onClick(e){"mousedown"===s&&p.current?p.current=void 0:Rt(p.current,!0)&&d||(!r||!c||o.current.openEvent&&"click"!==o.current.openEvent.type?i(!0,e.nativeEvent,"click"):i(!1,e.nativeEvent,"click"))},onKeyDown(e){p.current=void 0,e.defaultPrevented||!u||si(e)||(" "!==e.key||ci(a)||(e.preventDefault(),m.current=!0),"Enter"===e.key&&i(!r||!c,e.nativeEvent,"click"))},onKeyUp(e){e.defaultPrevented||!u||si(e)||ci(a)||" "===e.key&&m.current&&(m.current=!1,i(!r||!c,e.nativeEvent,"click"))}}}:{}),[l,o,s,d,u,a,c,r,i])}(S),N=Rr(S,{enabled:!w,mouseOnly:!0,delay:{open:100,close:k?999999:100},restMs:100,handleClose:Mi()}),H=mi(S),[R,T]=r(null),Z=ki(S),z=i([]),B=Ii(S,{listRef:z,activeIndex:R,onNavigate:T,loop:!0,nested:!w}),_=$i(z,[]),{getReferenceProps:P,getFloatingProps:F,getItemProps:G}=bi([V,N,H,Z,B]),j=[ns.displayName,Hi.displayName,_i.displayName,Xi.displayName,qi.displayName,Wl.displayName,Xl.displayName];o((()=>{Ul(l)&&D.setPositionReference({getBoundingClientRect:()=>({width:0,height:0,x:l.x,y:l.y,top:l.y,left:l.x,right:l.x,bottom:l.y})})}),[l,y,D]);const W=function(t){return e.useMemo((()=>t.every((e=>null==e))?null:e=>{t.forEach((t=>{"function"==typeof t?t(e):null!=t&&(t.current=e)}))}),t)}([y,D.setReference]);return t.createElement(t.Fragment,null,Ul(l)?null:m(l,Object.assign(Object.assign({ref:W},P()),l.props)),t.createElement(Dr,{id:$},M&&t.createElement(ii,null,t.createElement(li,{context:S,modal:!1,initialFocus:-1,returnFocus:!1},t.createElement(ql,Object.assign({ref:D.setFloating,$maxHeight:p,style:Object.assign(Object.assign(Object.assign({},O),null!=x&&null!=s&&{width:`${s}px`}),{minWidth:null!=u?u:"auto"})},F()),t.createElement(Di.Provider,{value:{isRoot:!1,activeIndex:R,maxActiveIndex:_,setActiveIndex:T,close:L}},t.createElement(Hl.Provider,{value:{isSorting:k,setIsSorting:A}},f&&t.createElement(Kl,null,f),t.createElement(ts,{$hasStickyHeader:!!f,$hasStickyFooter:!!b},((e,n=!0)=>t.Children.toArray(e).filter((e=>{if(!t.isValidElement(e))return!1;const r=e.type;if(r===t.Fragment)return!0;const i="function"==typeof r||"object"==typeof r?r.displayName:void 0;return"ContextMenu2TriggerItem"===i||"DataTable2MenuCountControl"===i||"DataTable2MenuSpaceControl"===i||"DataTable2MenuOrderControl"===i||("ContextMenu2Container"===i||(n||("function"==typeof r||"object"==typeof r)&&j.includes(r.displayName)))})).map((e=>t.isValidElement(e)?t.cloneElement(e,Object.assign(Object.assign(Object.assign({tabIndex:R===e.key?0:-1,ref:t=>{z.current[e.key]=t}},G()),e.props),{key:e.key})):e)))(h)),b&&t.createElement(es,null,b))))))))}));ns.displayName="ContextMenu2";const rs=({children:e})=>{if(!g(e)||"string"==typeof e.type||"function"!=typeof e.type&&"object"!=typeof e.type||!("displayName"in e.type)||e.type.displayName!==ns.displayName)throw new Error("ContextMenu2Container には 1 つの ContextMenu2 しか入れられません");return t.createElement(Di.Provider,{value:{isRoot:!0,close:()=>{},activeIndex:null,maxActiveIndex:-1,setActiveIndex:()=>{}}},t.createElement(Or,null,e))},is=x((({className:e,children:n})=>t.createElement("p",{className:e},n)))`
578
578
  border-radius: 4px;
579
579
  padding: 4px 8px;
580
580
  margin-bottom: 8px;