@clicktap/ui 0.38.0 → 0.39.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/components/Collapsible/Collapsible.js +1 -1
- package/components/Collapsible/CollapsibleTrigger.js +1 -7
- package/components/Collapsible/index.js +1 -1
- package/components/Collection/CollectionToolbar/CollectionToolbar.js +1 -1
- package/components/Collection/CollectionToolbar/index.js +1 -1
- package/components/Collection/index.js +1 -1
- package/components/Select/ButtonSelect.js +1 -1
- package/components/Select/ComboBoxSelect.js +1 -1
- package/components/Select/MultiButtonSelect.d.ts +3 -0
- package/components/Select/MultiButtonSelect.js +1 -0
- package/components/Select/Option.js +1 -1
- package/components/Select/Select.js +1 -1
- package/components/Select/index.js +1 -1
- package/package.json +3 -1
- package/assets/Section-DVpZrRV-.js +0 -1
- package/assets/useControlledState-Cmn8tE-_.js +0 -1
- package/assets/useEffectEvent-gqjrDmw8.js +0 -1
- package/assets/useOverlayTriggerState-CooW9h9l.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{useContext as p}from"react";import{motion as a}from"framer-motion";import{CollapsibleTriggerStateContext as l}from"./CollapsibleTrigger.js";import{cn as m}from"../../utils/cn.js";import"react-aria-components";import"@react-stately/utils";import"@react-aria/interactions";function g({children:i,className:t}){const{isOpen:e,id:o,defaultOpen:n}=p(l);return r(a.div,{className:m("w-full overflow-hidden",t),id:o,variants:{hidden:{height:"0px",opacity:0},visible:{height:"auto",opacity:1}},initial:n?"visible":"hidden",animate:e?"visible":"hidden",transition:{type:"spring",bounce:0},children:i})}export{g as Collapsible,g as default};
|
|
@@ -1,7 +1 @@
|
|
|
1
|
-
"use client";import{jsx as le}from"react/jsx-runtime";import{Provider as De}from"react-aria-components";import{$ as Ne}from"../../assets/useControlledState-Cmn8tE-_.js";import Ue,{useRef as he,useCallback as h,useEffect as ee,useState as _e,useMemo as Ve,useContext as Fe,createContext as Re,useId as He}from"react";import{d as D,a as p,c as C,b as Ye,e as q,$ as b}from"../../assets/useEffectEvent-gqjrDmw8.js";import{flushSync as Ge}from"react-dom";import{cn as Xe}from"../../utils/cn.js";const je=typeof Element<"u"&&"checkVisibility"in Element.prototype;function We(e){const t=D(e);if(!(e instanceof t.HTMLElement)&&!(e instanceof t.SVGElement))return!1;let{display:o,visibility:i}=e.style,s=o!=="none"&&i!=="hidden"&&i!=="collapse";if(s){const{getComputedStyle:l}=e.ownerDocument.defaultView;let{display:c,visibility:f}=l(e);s=c!=="none"&&f!=="hidden"&&f!=="collapse"}return s}function Be(e,t){return!e.hasAttribute("hidden")&&!e.hasAttribute("data-react-aria-prevent-focus")&&(e.nodeName==="DETAILS"&&t&&t.nodeName!=="SUMMARY"?e.hasAttribute("open"):!0)}function Ee(e,t){return je?e.checkVisibility({visibilityProperty:!0})&&!e.closest("[data-react-aria-prevent-focus]"):e.nodeName!=="#comment"&&We(e)&&Be(e,t)&&(!e.parentElement||Ee(e.parentElement,e))}const Pe=["input:not([disabled]):not([type=hidden])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","a[href]","area[href]","summary","iframe","object","embed","audio[controls]","video[controls]",'[contenteditable]:not([contenteditable^="false"])',"permission"],ze=Pe.join(":not([hidden]),")+",[tabindex]:not([disabled]):not([hidden])";Pe.push('[tabindex]:not([tabindex="-1"]):not([disabled])');function qe(e,t){return e.matches(ze)&&!Je(e)&&(t?.skipVisibilityCheck||Ee(e))}function Je(e){let t=e;for(;t!=null;){if(t instanceof t.ownerDocument.defaultView.HTMLElement&&t.inert)return!0;t=t.parentElement}return!1}function Se(...e){return(...t)=>{for(let o of e)typeof o=="function"&&o(...t)}}let te=new Map;typeof FinalizationRegistry<"u"&&new FinalizationRegistry(e=>{te.delete(e)});function Qe(e,t){if(e===t)return e;let o=te.get(e);if(o)return o.forEach(s=>s.current=t),t;let i=te.get(t);return i?(i.forEach(s=>s.current=e),e):t}function Ze(...e){return e.length===1&&e[0]?e[0]:t=>{let o=!1;const i=e.map(s=>{const l=ue(s,t);return o||=typeof l=="function",l});if(o)return()=>{i.forEach((s,l)=>{typeof s=="function"?s():ue(e[l],null)})}}}function ue(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function we(e){var t,o,i="";if(typeof e=="string"||typeof e=="number")i+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(o=we(e[t]))&&(i&&(i+=" "),i+=o)}else for(o in e)e[o]&&(i&&(i+=" "),i+=o);return i}function et(){for(var e,t,o=0,i="",s=arguments.length;o<s;o++)(e=arguments[o])&&(t=we(e))&&(i&&(i+=" "),i+=t);return i}function xe(...e){let t={...e[0]};for(let o=1;o<e.length;o++){let i=e[o];for(let s in i){let l=t[s],c=i[s];typeof l=="function"&&typeof c=="function"&&s[0]==="o"&&s[1]==="n"&&s.charCodeAt(2)>=65&&s.charCodeAt(2)<=90?t[s]=Se(l,c):(s==="className"||s==="UNSAFE_className")&&typeof l=="string"&&typeof c=="string"?t[s]=et(l,c):s==="id"&&l&&c?t.id=Qe(l,c):s==="ref"&&l&&c?t.ref=Ze(l,c):t[s]=c!==void 0?c:l}}return t}function Y(e){if(tt())e.focus({preventScroll:!0});else{let t=rt(e);e.focus(),nt(t)}}let F=null;function tt(){if(F==null){F=!1;try{document.createElement("div").focus({get preventScroll(){return F=!0,!0}})}catch{}}return F}function rt(e){let t=e.parentNode,o=[],i=document.scrollingElement||document.documentElement;for(;t instanceof HTMLElement&&t!==i;)(t.offsetHeight<t.scrollHeight||t.offsetWidth<t.scrollWidth)&&o.push({element:t,scrollTop:t.scrollTop,scrollLeft:t.scrollLeft}),t=t.parentNode;return i instanceof HTMLElement&&o.push({element:i,scrollTop:i.scrollTop,scrollLeft:i.scrollLeft}),o}function nt(e){for(let{element:t,scrollTop:o,scrollLeft:i}of e)t.scrollTop=o,t.scrollLeft=i}function it(e){let t=e;return t.nativeEvent=e,t.isDefaultPrevented=()=>t.defaultPrevented,t.isPropagationStopped=()=>t.cancelBubble,t.persist=()=>{},t}function ot(e,t){Object.defineProperty(e,"target",{value:t}),Object.defineProperty(e,"currentTarget",{value:t})}function ce(e){for(;e&&!qe(e,{skipVisibilityCheck:!0});)e=e.parentElement;let t=D(e),o=t.document.activeElement;if(!o||o===e)return;let i=!1,s=v=>{(p(v)===o||i)&&v.stopImmediatePropagation()},l=v=>{(p(v)===o||i)&&(v.stopImmediatePropagation(),!e&&!i&&(i=!0,Y(o),T()))},c=v=>{(p(v)===e||i)&&v.stopImmediatePropagation()},f=v=>{(p(v)===e||i)&&(v.stopImmediatePropagation(),i||(i=!0,Y(o),T()))};t.addEventListener("blur",s,!0),t.addEventListener("focusout",l,!0),t.addEventListener("focusin",f,!0),t.addEventListener("focus",c,!0);let T=()=>{cancelAnimationFrame(m),t.removeEventListener("blur",s,!0),t.removeEventListener("focusout",l,!0),t.removeEventListener("focusin",f,!0),t.removeEventListener("focus",c,!0),i=!1},m=requestAnimationFrame(T);return T}function G(e){if(typeof window>"u"||window.navigator==null)return!1;let t=window.navigator.userAgentData?.brands;return Array.isArray(t)&&t.some(o=>e.test(o.brand))||e.test(window.navigator.userAgent)}function ie(e){return typeof window<"u"&&window.navigator!=null?e.test(window.navigator.userAgentData?.platform||window.navigator.platform):!1}function S(e){if(process.env.NODE_ENV==="test")return e;let t=null;return()=>(t==null&&(t=e()),t)}const U=S(function(){return ie(/^Mac/i)}),st=S(function(){return ie(/^iPhone/i)}),ke=S(function(){return ie(/^iPad/i)||U()&&navigator.maxTouchPoints>1}),oe=S(function(){return st()||ke()});S(function(){return U()||oe()});const at=S(function(){return G(/AppleWebKit/i)&&!lt()}),lt=S(function(){return G(/Chrome/i)}),Le=S(function(){return G(/Android/i)}),ut=S(function(){return G(/Firefox/i)});let L=new Map,re=new Set;function fe(){if(typeof window>"u")return;function e(i){return"propertyName"in i}let t=i=>{let s=p(i);if(!e(i)||!s)return;let l=L.get(s);l||(l=new Set,L.set(s,l),s.addEventListener("transitioncancel",o,{once:!0})),l.add(i.propertyName)},o=i=>{let s=p(i);if(!e(i)||!s)return;let l=L.get(s);if(l&&(l.delete(i.propertyName),l.size===0&&(s.removeEventListener("transitioncancel",o),L.delete(s)),L.size===0)){for(let c of re)c();re.clear()}};document.body.addEventListener("transitionrun",t),document.body.addEventListener("transitionend",o)}typeof document<"u"&&(document.readyState!=="loading"?fe():document.addEventListener("DOMContentLoaded",fe));function ct(){for(const[e]of L)"isConnected"in e&&!e.isConnected&&L.delete(e)}function ft(e){requestAnimationFrame(()=>{ct(),L.size===0?e():re.add(e)})}let A="default",ne="",H=new WeakMap;function de(e){if(oe()){if(A==="default"){const t=C(e);ne=t.documentElement.style.webkitUserSelect,t.documentElement.style.webkitUserSelect="none"}A="disabled"}else if(e instanceof HTMLElement||e instanceof SVGElement){let t="userSelect"in e.style?"userSelect":"webkitUserSelect";H.set(e,e.style[t]),e.style[t]="none"}}function J(e){if(oe()){if(A!=="disabled")return;A="restoring",setTimeout(()=>{ft(()=>{if(A==="restoring"){const t=C(e);t.documentElement.style.webkitUserSelect==="none"&&(t.documentElement.style.webkitUserSelect=ne||""),ne="",A="default"}})},300)}else if((e instanceof HTMLElement||e instanceof SVGElement)&&e&&H.has(e)){let t=H.get(e),o="userSelect"in e.style?"userSelect":"webkitUserSelect";e.style[o]==="none"&&(e.style[o]=t),e.getAttribute("style")===""&&e.removeAttribute("style"),H.delete(e)}}function pe(e){return e?.defaultView?.__webpack_nonce__||globalThis.__webpack_nonce__||void 0}let Q=new WeakMap;function dt(e){let t=e??(typeof document<"u"?document:void 0);if(!t)return pe(t);if(Q.has(t))return Q.get(t);let o=t.querySelector('meta[property="csp-nonce"]'),i=o&&o instanceof D(o).HTMLMetaElement&&(o.nonce||o.content)||pe(t)||void 0;return i!==void 0&&Q.set(t,i),i}function ge(e){return e.pointerType===""&&e.isTrusted?!0:Le()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function pt(e){return!Le()&&e.width===0&&e.height===0||e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"}function _(e,t,o=!0){let{metaKey:i,ctrlKey:s,altKey:l,shiftKey:c}=t;ut()&&window.event?.type?.startsWith("key")&&e.target==="_blank"&&(U()?i=!0:s=!0);let f=at()&&U()&&!ke()&&process.env.NODE_ENV!=="test"?new KeyboardEvent("keydown",{keyIdentifier:"Enter",metaKey:i,ctrlKey:s,altKey:l,shiftKey:c}):new MouseEvent("click",{metaKey:i,ctrlKey:s,altKey:l,shiftKey:c,detail:1,bubbles:!0,cancelable:!0});_.isOpening=o,Y(e),e.dispatchEvent(f),_.isOpening=!1}_.isOpening=!1;const Oe=Ue.createContext({register:()=>{}});Oe.displayName="PressResponderContext";function gt(){let e=he(new Map),t=h((s,l,c,f)=>{let T=f?.once?(...m)=>{e.current.delete(c),c(...m)}:c;e.current.set(c,{type:l,eventTarget:s,fn:T,options:f}),s.addEventListener(l,T,f)},[]),o=h((s,l,c,f)=>{let T=e.current.get(c)?.fn||c;s.removeEventListener(l,T,f),e.current.delete(c)},[]),i=h(()=>{e.current.forEach((s,l)=>{o(s.eventTarget,s.type,l,s.options)})},[o]);return ee(()=>i,[i]),{addGlobalListener:t,removeGlobalListener:o,removeAllGlobalListeners:i}}function $t(e,t){Ye(()=>{if(e&&e.ref&&t)return e.ref.current=t.current,()=>{e.ref&&(e.ref.current=null)}})}function bt(e){let t=Fe(Oe);if(t){let{register:o,ref:i,...s}=t;e=xe(s,e),o()}return $t(t,e.ref),e}class R{#e;constructor(t,o,i,s){this.#e=!0;const c=(s?.target??i.currentTarget)?.getBoundingClientRect();let f,T=0,m,v=null;i.clientX!=null&&i.clientY!=null&&(m=i.clientX,v=i.clientY),c&&(m!=null&&v!=null?(f=m-c.left,T=v-c.top):(f=c.width/2,T=c.height/2)),this.type=t,this.pointerType=o,this.target=i.currentTarget,this.shiftKey=i.shiftKey,this.metaKey=i.metaKey,this.ctrlKey=i.ctrlKey,this.altKey=i.altKey,this.x=f,this.y=T,this.key=i.key}continuePropagation(){this.#e=!1}get shouldStopPropagation(){return this.#e}}const $e=Symbol("linkClicked"),be="react-aria-pressable-style",ye="data-react-aria-pressable";function yt(e){let{onPress:t,onPressChange:o,onPressStart:i,onPressEnd:s,onPressUp:l,onClick:c,isDisabled:f,isPressed:T,preventFocusOnPress:m,shouldCancelOnPointerExit:v,allowTextSelectionOnPress:w,ref:X,...Ce}=bt(e),[Ke,ae]=_e(!1),K=he({isPressed:!1,ignoreEmulatedMouseEvents:!1,didFirePressStart:!1,isTriggeringEvent:!1,activePointerId:null,target:null,isOverTarget:!1,pointerType:null,disposables:[]}),{addGlobalListener:O,removeAllGlobalListeners:N}=gt(),E=h((r,u)=>{let y=K.current;if(f||y.didFirePressStart)return!1;let a=!0;if(y.isTriggeringEvent=!0,i){let $=new R("pressstart",u,r);i($),a=$.shouldStopPropagation}return o&&o(!0),y.isTriggeringEvent=!1,y.didFirePressStart=!0,ae(!0),a},[f,i,o]),j=h((r,u,y=!0)=>{let a=K.current;if(!a.didFirePressStart)return!1;a.didFirePressStart=!1,a.isTriggeringEvent=!0;let $=!0;if(s){let n=new R("pressend",u,r);s(n),$=n.shouldStopPropagation}if(o&&o(!1),ae(!1),t&&y&&!f){let n=new R("press",u,r);t(n),$&&=n.shouldStopPropagation}return a.isTriggeringEvent=!1,$},[f,s,o,t]),x=q(j),Ie=h((r,u)=>{let y=K.current;if(f)return!1;if(l){y.isTriggeringEvent=!0;let a=new R("pressup",u,r);return l(a),y.isTriggeringEvent=!1,a.shouldStopPropagation}return!0},[f,l]),I=q(Ie),W=h(r=>{let u=K.current;if(u.isPressed&&u.target){u.didFirePressStart&&u.pointerType!=null&&j(M(u.target,r),u.pointerType,!1),u.isPressed=!1,u.isOverTarget=!1,u.activePointerId=null,u.pointerType=null,N(),w||J(u.target);for(let y of u.disposables)y();u.disposables=[]}},[w,N,j]),P=q(W),V=h(r=>{v&&W(r)},[v,W]),B=h(r=>{f||c?.(r)},[f,c]),z=h((r,u)=>{if(!f&&c){let y=new MouseEvent("click",r);ot(y,u),c(it(y))}},[f,c]),Ae=Ve(()=>{let r=K.current,u={onKeyDown(a){if(Z(a.nativeEvent,a.currentTarget)&&b(a.currentTarget,p(a))){me(p(a),a.key)&&a.preventDefault();let $=!0;!r.isPressed&&!a.repeat&&(r.target=a.currentTarget,r.isPressed=!0,r.pointerType="keyboard",$=E(a,"keyboard"));let n=a.currentTarget,d=g=>{Z(g,n)&&!g.repeat&&b(n,p(g))&&r.target&&I(M(r.target,g),"keyboard")};O(C(a.currentTarget),"keyup",Se(d,y),!0),$&&a.stopPropagation(),a.metaKey&&U()&&r.metaKeyEvents?.set(a.key,a.nativeEvent)}else a.key==="Meta"&&(r.metaKeyEvents=new Map)},onClick(a){if(!(a&&!b(a.currentTarget,p(a)))&&a&&a.button===0&&!r.isTriggeringEvent&&!_.isOpening){let $=!0;if(f&&a.preventDefault(),!r.ignoreEmulatedMouseEvents&&!r.isPressed&&(r.pointerType==="virtual"||ge(a.nativeEvent))){let n=E(a,"virtual"),d=I(a,"virtual"),g=x(a,"virtual");B(a),$=n&&d&&g}else if(r.isPressed&&r.pointerType!=="keyboard"){let n=r.pointerType||a.nativeEvent.pointerType||"virtual",d=I(M(a.currentTarget,a),n),g=x(M(a.currentTarget,a),n,!0);$=d&&g,r.isOverTarget=!1,B(a),P(a)}r.ignoreEmulatedMouseEvents=!1,$&&a.stopPropagation()}}},y=a=>{if(r.isPressed&&r.target&&Z(a,r.target)){me(p(a),a.key)&&a.preventDefault();let $=p(a),n=b(r.target,$);x(M(r.target,a),"keyboard",n),n&&z(a,r.target),N(),a.key!=="Enter"&&se(r.target)&&b(r.target,$)&&!a[$e]&&(a[$e]=!0,_(r.target,a,!1)),r.isPressed=!1,r.metaKeyEvents?.delete(a.key)}else if(a.key==="Meta"&&r.metaKeyEvents?.size){let $=r.metaKeyEvents;r.metaKeyEvents=void 0;for(let n of $.values())r.target?.dispatchEvent(new KeyboardEvent("keyup",n))}};if(typeof PointerEvent<"u"){u.onPointerDown=n=>{if(n.button!==0||!b(n.currentTarget,p(n)))return;if(pt(n.nativeEvent)){r.pointerType="virtual";return}r.pointerType=n.pointerType;let d=!0;if(!r.isPressed){r.isPressed=!0,r.isOverTarget=!0,r.activePointerId=n.pointerId,r.target=n.currentTarget,w||de(r.target),d=E(n,r.pointerType);let g=p(n);"releasePointerCapture"in g&&("hasPointerCapture"in g?g.hasPointerCapture(n.pointerId)&&g.releasePointerCapture(n.pointerId):g.releasePointerCapture(n.pointerId)),O(C(n.currentTarget),"pointerup",a,!1),O(C(n.currentTarget),"pointercancel",$,!1)}d&&n.stopPropagation()},u.onMouseDown=n=>{if(b(n.currentTarget,p(n))&&n.button===0){if(m){let d=ce(n.target);d&&r.disposables.push(d)}n.stopPropagation()}},u.onPointerUp=n=>{!b(n.currentTarget,p(n))||r.pointerType==="virtual"||n.button===0&&!r.isPressed&&I(n,r.pointerType||n.pointerType)},u.onPointerEnter=n=>{n.pointerId===r.activePointerId&&r.target&&!r.isOverTarget&&r.pointerType!=null&&(r.isOverTarget=!0,E(M(r.target,n),r.pointerType))},u.onPointerLeave=n=>{n.pointerId===r.activePointerId&&r.target&&r.isOverTarget&&r.pointerType!=null&&(r.isOverTarget=!1,x(M(r.target,n),r.pointerType,!1),V(n))};let a=n=>{if(n.pointerId===r.activePointerId&&r.isPressed&&n.button===0&&r.target){if(b(r.target,p(n))&&r.pointerType!=null){let d=!1,g=setTimeout(()=>{r.isPressed&&r.target instanceof HTMLElement&&(d?P(n):(Y(r.target),r.target.click()))},80);O(n.currentTarget,"click",()=>d=!0,!0),r.disposables.push(()=>clearTimeout(g))}else P(n);r.isOverTarget=!1}},$=n=>{P(n)};u.onDragStart=n=>{b(n.currentTarget,p(n))&&P(n)}}else if(process.env.NODE_ENV==="test"){u.onMouseDown=n=>{if(n.button!==0||!b(n.currentTarget,p(n)))return;if(r.ignoreEmulatedMouseEvents){n.stopPropagation();return}if(r.isPressed=!0,r.isOverTarget=!0,r.target=n.currentTarget,r.pointerType=ge(n.nativeEvent)?"virtual":"mouse",Ge(()=>E(n,r.pointerType))&&n.stopPropagation(),m){let g=ce(n.target);g&&r.disposables.push(g)}O(C(n.currentTarget),"mouseup",a,!1)},u.onMouseEnter=n=>{if(!b(n.currentTarget,p(n)))return;let d=!0;r.isPressed&&!r.ignoreEmulatedMouseEvents&&r.pointerType!=null&&(r.isOverTarget=!0,d=E(n,r.pointerType)),d&&n.stopPropagation()},u.onMouseLeave=n=>{if(!b(n.currentTarget,p(n)))return;let d=!0;r.isPressed&&!r.ignoreEmulatedMouseEvents&&r.pointerType!=null&&(r.isOverTarget=!1,d=x(n,r.pointerType,!1),V(n)),d&&n.stopPropagation()},u.onMouseUp=n=>{b(n.currentTarget,p(n))&&!r.ignoreEmulatedMouseEvents&&n.button===0&&!r.isPressed&&I(n,r.pointerType||"mouse")};let a=n=>{if(n.button===0){if(r.ignoreEmulatedMouseEvents){r.ignoreEmulatedMouseEvents=!1;return}r.target&&b(r.target,p(n))&&r.pointerType!=null||P(n),r.isOverTarget=!1}};u.onTouchStart=n=>{if(!b(n.currentTarget,p(n)))return;let d=vt(n.nativeEvent);if(!d)return;r.activePointerId=d.identifier,r.ignoreEmulatedMouseEvents=!0,r.isOverTarget=!0,r.isPressed=!0,r.target=n.currentTarget,r.pointerType="touch",w||de(r.target),E(k(r.target,n),r.pointerType)&&n.stopPropagation(),O(D(n.currentTarget),"scroll",$,!0)},u.onTouchMove=n=>{if(!b(n.currentTarget,p(n)))return;if(!r.isPressed){n.stopPropagation();return}let d=ve(n.nativeEvent,r.activePointerId),g=!0;d&&Te(d,n.currentTarget)?!r.isOverTarget&&r.pointerType!=null&&(r.isOverTarget=!0,g=E(k(r.target,n),r.pointerType)):r.isOverTarget&&r.pointerType!=null&&(r.isOverTarget=!1,g=x(k(r.target,n),r.pointerType,!1),V(k(r.target,n))),g&&n.stopPropagation()},u.onTouchEnd=n=>{if(!b(n.currentTarget,p(n)))return;if(!r.isPressed){n.stopPropagation();return}let d=ve(n.nativeEvent,r.activePointerId),g=!0;d&&Te(d,n.currentTarget)&&r.pointerType!=null?(I(k(r.target,n),r.pointerType),g=x(k(r.target,n),r.pointerType),z(n.nativeEvent,r.target)):r.isOverTarget&&r.pointerType!=null&&(g=x(k(r.target,n),r.pointerType,!1)),g&&n.stopPropagation(),r.isPressed=!1,r.activePointerId=null,r.isOverTarget=!1,r.ignoreEmulatedMouseEvents=!0,r.target&&!w&&J(r.target),N()},u.onTouchCancel=n=>{b(n.currentTarget,p(n))&&(n.stopPropagation(),r.isPressed&&P(k(r.target,n)))};let $=n=>{r.isPressed&&b(p(n),r.target)&&P({currentTarget:r.target,shiftKey:!1,ctrlKey:!1,metaKey:!1,altKey:!1})};u.onDragStart=n=>{b(n.currentTarget,p(n))&&P(n)}}return u},[O,f,m,N,w,V,E,B,z]);return ee(()=>{if(!X||process.env.NODE_ENV==="test")return;const r=C(X.current);if(!r||!r.head||r.getElementById(be))return;const u=r.createElement("style");u.id=be;let y=dt(r);y&&(u.nonce=y),u.textContent=`
|
|
2
|
-
@layer {
|
|
3
|
-
[${ye}] {
|
|
4
|
-
touch-action: pan-x pan-y pinch-zoom;
|
|
5
|
-
}
|
|
6
|
-
}
|
|
7
|
-
`.trim(),r.head.prepend(u)},[X]),ee(()=>{let r=K.current;return()=>{w||J(r.target??void 0);for(let u of r.disposables)u();r.disposables=[]}},[w]),{isPressed:T||Ke,pressProps:xe(Ce,Ae,{[ye]:!0})}}function se(e){return e.tagName==="A"&&e.hasAttribute("href")}function Z(e,t){const{key:o,code:i}=e,s=t,l=s.getAttribute("role");return(o==="Enter"||o===" "||o==="Spacebar"||i==="Space")&&!(s instanceof D(s).HTMLInputElement&&!Me(s,o)||s instanceof D(s).HTMLTextAreaElement||s.isContentEditable)&&!((l==="link"||!l&&se(s))&&o!=="Enter")}function vt(e){const{targetTouches:t}=e;return t.length>0?t[0]:null}function ve(e,t){const o=e.changedTouches;for(let i=0;i<o.length;i++){const s=o[i];if(s.identifier===t)return s}return null}function k(e,t){let o=0,i=0;return t.targetTouches&&t.targetTouches.length===1&&(o=t.targetTouches[0].clientX,i=t.targetTouches[0].clientY),{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:o,clientY:i}}function M(e,t){let o=t.clientX,i=t.clientY;return{currentTarget:e,shiftKey:t.shiftKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,clientX:o,clientY:i,key:t.key}}function Tt(e){let t=0,o=0;return e.width!==void 0?t=e.width/2:e.radiusX!==void 0&&(t=e.radiusX),e.height!==void 0?o=e.height/2:e.radiusY!==void 0&&(o=e.radiusY),{top:e.clientY-o,right:e.clientX+t,bottom:e.clientY+o,left:e.clientX-t}}function mt(e,t){return!(e.left>t.right||t.left>e.right||e.top>t.bottom||t.top>e.bottom)}function Te(e,t){let o=t.getBoundingClientRect(),i=Tt(e);return mt(o,i)}function ht(e){return e instanceof HTMLInputElement?!1:e instanceof HTMLButtonElement?e.type!=="submit"&&e.type!=="reset":!se(e)}function me(e,t){return e instanceof HTMLInputElement?!Me(e,t):ht(e)}const Et=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Me(e,t){return e.type==="checkbox"||e.type==="radio"?t===" ":Et.has(e.type)}const Pt=Re({});function Ct({children:e,className:t,...o}){const i=He(),[s,l]=Ne(o.isOpen,o.defaultOpen||!1,o.onOpenChange),c=h(()=>{l(!s)},[l,s]),{pressProps:f}=yt({onPress:c});return le(De,{values:[[Pt,{isOpen:s,id:i,defaultOpen:o.defaultOpen||!1}]],children:le("div",{...f,role:"button",tabIndex:0,"aria-expanded":s,"aria-controls":i,className:Xe("w-full",t),children:e})})}export{Ct as CollapsibleTrigger,Pt as CollapsibleTriggerStateContext,Ct as default};
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{Provider as f}from"react-aria-components";import{useControlledState as u}from"@react-stately/utils";import{createContext as c,useId as d,useCallback as m}from"react";import{usePress as p}from"@react-aria/interactions";import{cn as g}from"../../utils/cn.js";const C=c({});function I({children:s,className:a,...e}){const o=d(),[t,n]=u(e.isOpen,e.defaultOpen||!1,e.onOpenChange),l=m(()=>{n(!t)},[n,t]),{pressProps:i}=p({onPress:l});return r(f,{values:[[C,{isOpen:t,id:o,defaultOpen:e.defaultOpen||!1}]],children:r("div",{...i,role:"button",tabIndex:0,"aria-expanded":t,"aria-controls":o,className:g("w-full",a),children:s})})}export{I as CollapsibleTrigger,C as CollapsibleTriggerStateContext,I as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Collapsible as
|
|
1
|
+
import{Collapsible as g}from"./Collapsible.js";import{CollapsibleTrigger as b,CollapsibleTriggerStateContext as s}from"./CollapsibleTrigger.js";import"react/jsx-runtime";import"react";import"framer-motion";import"../../utils/cn.js";import"react-aria-components";import"@react-stately/utils";import"@react-aria/interactions";export{g as Collapsible,b as CollapsibleTrigger,s as CollapsibleTriggerStateContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{Option as p}from"../../Select/Option.js";import{Select as x}from"../../Select/Select.js";import{Button as h}from"../../Button/Button.js";import"framer-motion";import{FilterIcon as d}from"../../Icon/FilterIcon.js";import"react";import"
|
|
1
|
+
"use client";import{jsxs as i,jsx as l}from"react/jsx-runtime";import{Option as p}from"../../Select/Option.js";import{Select as x}from"../../Select/Select.js";import{Button as h}from"../../Button/Button.js";import"framer-motion";import{FilterIcon as d}from"../../Icon/FilterIcon.js";import"react-stately";import"react";import"../../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../../../utils/cn.js";import"../../Select/parts.js";import"react-aria-components";import"../../Select/ComboBoxSelect.js";import"../../Loader/Pulse.js";import"../../Select/MultiButtonSelect.js";function K({totalItems:o,startItem:s,endItem:r,setShowMobileFilters:a,availableSortOrders:m,appliedSortOrder:e,onSortChange:n}){const c=[...e?[e]:[],...m];return i("div",{className:"flex flex-col gap-y-5 mb-3",children:[i("div",{className:"flex items-center justify-between lg:justify-end gap-x-2",children:[i(h,{className:"lg:hidden grow-0 shrink-0 basis-auto gap-x-3 px-4",size:"sm",variant:"outline",onPress:()=>a(!0),"aria-details":"show filters",children:[l(d,{className:"w-3 h-3"}),"Filters"]}),l(x,{className:"w-44",selectedKey:e?`${e.code}_${e.direction}`:null,onSelectionChange:n,placeholder:"Sort by",label:"Sort By:",classNames:{input:"text-xs w-44 h-8 min-h-0",value:"text-xs",label:"hidden lg:block text-xs text-gray-600 whitespace-nowrap"},children:c.map(t=>l(p,{textValue:t.label,children:t.label},`${t.code}_${t.direction}`))})]}),o>0&&i("p",{className:"text-sm text-slate-500",children:["Displaying ",s," - ",r," of ",o," items"]})]})}export{K as CollectionToolbar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{CollectionToolbar as
|
|
1
|
+
import{CollectionToolbar as j}from"./CollectionToolbar.js";import"react/jsx-runtime";import"../../Select/Option.js";import"react-stately";import"../../Select/Select.js";import"react";import"../../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../../../utils/cn.js";import"../../Select/parts.js";import"react-aria-components";import"../../Select/ComboBoxSelect.js";import"framer-motion";import"../../Loader/Pulse.js";import"../../Select/MultiButtonSelect.js";import"../../Button/Button.js";import"../../Icon/FilterIcon.js";export{j as CollectionToolbar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AttributeDataProvider as
|
|
1
|
+
import{AttributeDataProvider as V,useAttributeData as W}from"./AttributeDataProvider/AttributeDataProvider.js";import{EmptyResults as Y}from"./EmptyResults/EmptyResults.js";import{ProductPrice as _}from"./ProductPrice/ProductPrice.js";import{FilterRenderer as rr}from"./FilterRenderer/FilterRenderer.js";import{CollectionFilterChips as tr}from"./CollectionFilterChips/CollectionFilterChips.js";import{FilterAccordionTitle as pr}from"./FilterAccordionTitle/FilterAccordionTitle.js";import{ProductCardSwatches as er}from"./ProductCardSwatches/ProductCardSwatches.js";import{CollectionFilters as cr}from"./CollectionFilters/CollectionFilters.js";import{CollectionToolbar as xr}from"./CollectionToolbar/CollectionToolbar.js";import"react/jsx-runtime";import"react";import"../../utils/env.js";import"../../utils/swatch.js";import"./FilterRenderer/Renderer/Option.js";import"../Checkbox/Checkbox.js";import"react-aria-components";import"../../utils/cn.js";import"./FilterRenderer/Renderer/useOptionFilterToggle.js";import"./FilterRenderer/Renderer/Swatch.js";import"./FilterRenderer/Renderer/Swatch/SwatchColor.js";import"../Icon/CheckIcon.js";import"../../utils/color.js";import"./FilterRenderer/Renderer/Swatch/SwatchImage.js";import"./FilterRenderer/Renderer/Swatch/SwatchText.js";import"./FilterRenderer/Renderer/Boolean.js";import"../RadioGroup/RadioGroup.js";import"../Radio/Radio.js";import"./FilterRenderer/Renderer/Range.js";import"../Button/Button.js";import"framer-motion";import"../Icon/CrossSmall.js";import"../../utils/collection/getAppliedFilterChips.js";import"../../utils/collection/removeFilterChip.js";import"../Accordion/Accordion.js";import"@nextui-org/accordion";import"../Icon/DownArrow.js";import"../ModalOverlay/ModalOverlay.js";import"../DialogTrigger/DialogTrigger.js";import"../Modal/Modal.js";import"../Drawer/Drawer.js";import"../Icon/Cross.js";import"../Icon/Search.js";import"../../utils/collection/mergeFilters.js";import"../Select/Option.js";import"react-stately";import"../Select/Select.js";import"../Select/ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../Select/parts.js";import"../Select/ComboBoxSelect.js";import"../Loader/Pulse.js";import"../Select/MultiButtonSelect.js";import"../Icon/FilterIcon.js";export{V as AttributeDataProvider,tr as CollectionFilterChips,cr as CollectionFilters,xr as CollectionToolbar,Y as EmptyResults,pr as FilterAccordionTitle,rr as FilterRenderer,er as ProductCardSwatches,_ as ProductPrice,W as useAttributeData};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as c,jsx as l}from"react/jsx-runtime";import{useRef as r}from"react";import{useSelect as z,useButton as A,HiddenSelect as E}from"react-aria";import{useInteractOutside as G}from"@react-aria/interactions";import{useSelectState as J}from"react-stately";import{cn as e}from"../../utils/cn.js";import{ChevronIcon as Q,SelectPopover as T,SelectListBox as U}from"./parts.js";import"react-aria-components";function se(d){const{label:a,description:u,errorMessage:f,children:x,placeholder:h,slots:g,popoverOffset:v,className:N,classNames:t,isLoading:I,name:m,selectedKey:P,defaultSelectedKey:S,onSelectionChange:y,isRequired:w,items:B,autoFocus:R,isInvalid:C,"aria-label":O,"aria-labelledby":L}=d,n=!!(d.isDisabled||I),p={label:a,children:x,items:B,name:m,selectedKey:P,defaultSelectedKey:S,onSelectionChange:y,isDisabled:n,isRequired:w,autoFocus:R,isInvalid:C,"aria-label":O,"aria-labelledby":L},s=J(p),b=r(null),o=r(null),j=r(null),H=r(null),{labelProps:M,triggerProps:D,valueProps:K,menuProps:_,descriptionProps:k,errorMessageProps:q,isInvalid:i}=z(p,s,o),{buttonProps:F}=A(D,o);return G({ref:b,onInteractOutside:()=>s.close()}),c("div",{ref:b,className:e("flex flex-col","w-full",N),children:[l("label",{...M,className:e("flex","text-xs text-slate-500",t?.label),children:a}),l(E,{state:s,triggerRef:o,label:a,name:m,isDisabled:n}),c("div",{className:e("flex","relative","w-full",t?.comboBoxContainer),children:[c("button",{...F,ref:o,className:e("flex items-center justify-between gap-2","border border-solid border-slate-300","text-sm text-slate-900 text-left","py-0 px-3","h-10 w-full","m-0","rounded-md","bg-white","cursor-pointer","transition-all ease-in-out duration-200","hover:border-slate-400","focus:outline focus:outline-2 focus:outline-slate-200 focus:border-slate-400","disabled:bg-slate-100 disabled:border-slate-300 disabled:cursor-default",i&&"border-red-500 bg-red-100 text-red-600 hover:border-red-600 focus:border-red-600 focus:outline-red-200",t?.input),children:[l("span",{...K,className:e("truncate",!s.selectedItem&&"text-slate-400",t?.value),children:s.selectedItem?s.selectedItem.rendered:h??"Select..."}),l("span",{className:e("shrink-0 [&_svg]:w-4 [&_svg]:h-4",t?.arrowButton),children:l(Q,{isOpen:s.isOpen,isDisabled:n,isInvalid:i,buttonIcon:g?.buttonIcon})})]}),s.isOpen&&l(T,{popoverRef:H,offset:v,className:e(t?.listContainer),children:l(U,{state:s,listBoxProps:_,listBoxRef:j,optionClassName:e(t?.option),sectionHeadingClassName:e(t?.sectionHeading),className:e("max-h-80","overflow-y-auto","outline-none",t?.list)})})]}),u&&l("span",{...k,className:e("flex","text-xs","text-slate-500",t?.description),children:u}),i&&typeof f=="string"&&l("span",{...q,className:e("flex","text-xs","text-red-500",t?.errorMessage),children:f})]})}export{se as ButtonSelect,se as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsxs as
|
|
1
|
+
"use client";import{jsxs as z,jsx as r}from"react/jsx-runtime";import{forwardRef as ye,useRef as a,useState as Ie,useMemo as G,useEffect as x}from"react";import{useFilter as ve,useObjectRef as Ce,useComboBox as Re,useButton as Ke,HiddenSelect as Be}from"react-aria";import{useComboBoxState as Fe}from"react-stately";import{cn as o}from"../../utils/cn.js";import"framer-motion";import{Pulse as Ne}from"../Loader/Pulse.js";import{SelectTags as Se,ChevronIcon as Pe,SelectOverlay as we,SelectListBox as Ve}from"./parts.js";import"react-aria-components";function h(l){return l?typeof l.rendered=="string"?l.rendered:l.textValue??"":""}function Me(l){let d=l.getFirstKey();for(;d!=null;){if(l.getItem(d)?.type==="item")return d;d=l.getKeyAfter(d)}return null}function Oe(l,d){const{label:y,description:w,errorMessage:V,children:L,placeholder:M,isLoading:O,slots:D,popoverOffset:W,className:_,classNames:n,autoComplete:I,menuTrigger:J,selectTextOnFocus:Q=!0,autoFocusFirstOption:U=!0,searchable:De,selectionMode:X="single",selectedKey:Y,defaultSelectedKey:Z,selectedKeys:v,defaultSelectedKeys:C,onSelectionChange:T,name:$,...f}=l,s=X==="multiple",R=!!f.isDisabled,g=a(!1),p=a(null),u=f.inputValue!==void 0,[K,m]=Ie(""),ee=u?f.inputValue:K,te=G(()=>s&&v?[...v]:void 0,[s,v]),oe=G(()=>s&&C?[...C]:void 0,[s,C]),A={...f,label:y,children:L,placeholder:M,isDisabled:R,menuTrigger:J??"focus",autoComplete:I,inputValue:ee,...s?{selectionMode:"multiple",value:te,defaultValue:oe,onChange:T}:{selectedKey:Y,defaultSelectedKey:Z,onSelectionChange:e=>{if(!u){const i=e!=null?p.current?.collection.getItem(e):null;m(h(i))}T?.(e)}},onInputChange:e=>{u||m(e),f.onInputChange?.(e),!s&&e===""&&p.current?.selectedKey!=null&&p.current.setSelectedKey(null)}},{contains:ne}=ve({sensitivity:"base"}),t=Fe({...A,defaultFilter:ne,allowsEmptyCollection:!0});x(()=>{p.current=t});const H=a(0),B=t.selectionManager.selectedKeys.size;x(()=>{s&&(B>H.current&&!u&&m(""),H.current=B)},[s,B,u]);const F=h(t.selectedItem);x(()=>{u||s||g.current||K===F||m(F)},[F,u,K,s]);const se=a(null),k=Ce(d),E=a(null),j=a(null),N=a(null),S=a(null),P=a(null),{inputProps:re,listBoxProps:le,labelProps:ie,buttonProps:ae,descriptionProps:ue,errorMessageProps:ce}=Re({...A,inputRef:k,listBoxRef:E,popoverRef:j,buttonRef:N},t),{buttonProps:de}=Ke(ae,N),b=t.displayValidation.isInvalid,{onKeyDown:fe,onFocus:pe,onBlur:me,...ge}=re,be=e=>{e.key==="Home"||e.key==="End"||fe?.(e)};x(()=>{const e=t.selectionManager;if(!U||!t.isOpen||t.inputValue.length===0){P.current=null;return}const i=e.focusedKey;if(i!=null&&i!==P.current)return;const c=Me(t.collection);P.current=c??null,c!=null&&c!==i&&e.setFocusedKey(c)});const xe=e=>{pe?.(e);const i=g.current;if(g.current=!0,i||!Q)return;const c=e.target,q=c.value;q&&requestAnimationFrame(()=>{c.value===q&&c.select()})},he=e=>{me?.(e);const i=e.currentTarget;requestAnimationFrame(()=>{document.activeElement!==i&&(g.current=!1,u||m(s?"":h(p.current?.selectedItem)))})};return z("div",{ref:se,className:o("flex flex-col","w-full",_),children:[r("label",{...ie,className:o("flex","text-xs text-slate-500",n?.label),children:y}),r(Be,{state:t,triggerRef:S,label:y,name:$,isDisabled:R,autoComplete:I}),s&&r(Se,{items:(t.selectedItems??[]).map(e=>({id:e.key,label:h(e)})),onRemove:e=>t.selectionManager.toggleSelection(e),classNames:{tagGroup:o(n?.tagGroup),tag:o(n?.tag),tagRemoveButton:o(n?.tagRemoveButton)}}),z("div",{ref:S,className:o("flex","relative","w-full",n?.comboBoxContainer),children:[r("input",{...ge,onKeyDown:be,onFocus:xe,onBlur:he,ref:k,placeholder:M,autoComplete:I,className:o("border border-solid border-slate-300","text-sm text-slate-900","py-0 px-2","h-10 w-full","m-0","rounded-md","bg-white","transition-all ease-in-out duration-200","hover:border-slate-400","focus:border-slate-400 focus:outline focus:outline-2 focus:outline-slate-200","disabled:bg-slate-100 disabled:border-slate-300",O?"disabled:text-slate-900":"disabled:text-slate-500",b&&"border-red-500 bg-red-100 text-red-600 placeholder:text-slate-400",b&&"hover:border-red-600 focus:border-red-600 focus:outline-red-200",n?.input)}),O?r("div",{className:o("absolute top-2 right-2","block",n?.loader),children:D?.loadingIcon||r(Ne,{})}):r("button",{...de,ref:N,className:o("absolute top-2 right-0","block","border-none bg-none",n?.arrowButton),children:r(Pe,{isOpen:t.isOpen,isDisabled:R,isInvalid:b,buttonIcon:D?.buttonIcon})}),t.isOpen&&t.collection.size>0&&r(we,{state:t,triggerRef:S,popoverRef:j,offset:W,className:o(n?.listContainer),children:r(Ve,{state:t,listBoxProps:le,listBoxRef:E,optionVirtualFocus:!0,optionClassName:o(n?.option),sectionHeadingClassName:o(n?.sectionHeading),className:o("max-h-80","overflow-y-auto","outline-none",n?.list)})})]}),w&&r("span",{...ue,className:o("flex","text-xs","text-slate-500",n?.description),children:w}),b&&typeof V=="string"&&r("span",{...ce,className:o("flex","text-xs","text-red-500",n?.errorMessage),children:V})]})}const We=ye(Oe);export{We as ComboBoxSelect,We as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsxs as d,jsx as s}from"react/jsx-runtime";import{useRef as r}from"react";import{useButton as D}from"react-aria";import{useListState as F,useOverlayTriggerState as H}from"react-stately";import{cn as e}from"../../utils/cn.js";import{ChevronIcon as _,SelectOverlay as k,SelectListBox as T}from"./parts.js";import"react-aria-components";function J(u){const{label:f,description:p,errorMessage:m,children:g,placeholder:h,slots:v,popoverOffset:y,className:N,classNames:t,isLoading:S,items:B,isInvalid:w,"aria-label":b,"aria-labelledby":I,selectedKeys:O,defaultSelectedKeys:C,onSelectionChange:R}=u,x=!!(u.isDisabled||S),a=F({children:g,items:B,selectionMode:"multiple",selectionBehavior:"toggle",selectedKeys:O,defaultSelectedKeys:C,onSelectionChange:l=>{l!=="all"&&R?.([...l])}}),o=H({}),L=r(null),n=r(null),M=r(null),j=r(null),{buttonProps:P}=D({isDisabled:x,onPress:()=>o.toggle(),"aria-label":b,"aria-labelledby":I},n),i=!!w,c=[...a.collection.getKeys()].map(l=>a.collection.getItem(l)).filter(l=>l!=null&&l.type==="item"&&a.selectionManager.isSelected(l.key)),K=c.map(l=>l.textValue).join(", ");return d("div",{ref:L,className:e("flex flex-col","w-full",N),children:[s("label",{className:e("flex","text-xs text-slate-500",t?.label),children:f}),d("div",{className:e("flex","relative","w-full",t?.comboBoxContainer),children:[d("button",{...P,ref:n,"aria-haspopup":"listbox","aria-expanded":o.isOpen,className:e("flex items-center justify-between gap-2","border border-solid border-slate-300","text-sm text-slate-900 text-left","py-0 px-3","h-10 w-full","m-0","rounded-md","bg-white","cursor-pointer","transition-all ease-in-out duration-200","hover:border-slate-400","focus:outline focus:outline-2 focus:outline-slate-200 focus:border-slate-400","disabled:bg-slate-100 disabled:border-slate-300 disabled:cursor-default",i&&"border-red-500 bg-red-100 text-red-600 hover:border-red-600 focus:border-red-600 focus:outline-red-200",t?.input),children:[s("span",{className:e("truncate",c.length===0&&"text-slate-400",t?.value),children:c.length>0?K:h??"Select..."}),s("span",{className:e("shrink-0 [&_svg]:w-4 [&_svg]:h-4",t?.arrowButton),children:s(_,{isOpen:o.isOpen,isDisabled:x,isInvalid:i,buttonIcon:v?.buttonIcon})})]}),o.isOpen&&s(k,{state:o,triggerRef:n,popoverRef:j,offset:y,className:e(t?.listContainer),children:s(T,{state:a,listBoxProps:{"aria-label":f??b??"Options",autoFocus:"first",shouldFocusWrap:!0},listBoxRef:M,optionClassName:e(t?.option),sectionHeadingClassName:e(t?.sectionHeading),className:e("max-h-80","overflow-y-auto","outline-none",t?.list)})})]}),p&&s("span",{className:e("flex","text-xs","text-slate-500",t?.description),children:p}),i&&typeof m=="string"&&s("span",{className:e("flex","text-xs","text-red-500",t?.errorMessage),children:m})]})}export{J as MultiButtonSelect,J as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{Item as o}from"react-stately";import{Section as p}from"react-stately";const e=o;export{e as Option,p as Section,e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r}from"react/jsx-runtime";import{forwardRef as
|
|
1
|
+
"use client";import{jsx as r}from"react/jsx-runtime";import{forwardRef as m,Children as n,isValidElement as c}from"react";import{ButtonSelect as l}from"./ButtonSelect.js";import{ComboBoxSelect as u}from"./ComboBoxSelect.js";import{MultiButtonSelect as f}from"./MultiButtonSelect.js";import{Section as a}from"react-stately";import"react-aria";import"@react-aria/interactions";import"../../utils/cn.js";import"./parts.js";import"react-aria-components";import"framer-motion";import"../Loader/Pulse.js";const h=8;function s(t){if(t.items)return[...t.items].length;if(typeof t.children=="function")return Number.POSITIVE_INFINITY;let e=0;return n.forEach(t.children,o=>{if(c(o)&&o.type===a){const i=o.props.children;e+=n.count(i)}else e+=1}),e}function S(t,e){return(t.searchable==="auto"?s(t)>h:!!t.searchable)?r(u,{ref:e,...t}):t.selectionMode==="multiple"?r(f,{...t}):r(l,{...t})}const p=m(S);export{p as Select,p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Option as
|
|
1
|
+
import{Option as a}from"./Option.js";import{Select as d}from"./Select.js";import{Section as h}from"react-stately";import"react/jsx-runtime";import"react";import"./ButtonSelect.js";import"react-aria";import"@react-aria/interactions";import"../../utils/cn.js";import"./parts.js";import"react-aria-components";import"./ComboBoxSelect.js";import"framer-motion";import"../Loader/Pulse.js";import"./MultiButtonSelect.js";export{a as Option,h as Section,d as Select};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clicktap/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Clicktap",
|
|
6
6
|
"description": "A library of React UI components and low-level hooks.",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"glob": "^11.0.0",
|
|
52
52
|
"react-aria": "^3.46.0",
|
|
53
53
|
"react-aria-components": "^1.15.0",
|
|
54
|
+
"react-stately": "^3.46.0",
|
|
54
55
|
"tailwindcss": "^4.0.15"
|
|
55
56
|
},
|
|
56
57
|
"peerDependencies": {
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"react": "^18.0.0",
|
|
65
66
|
"react-aria": "^3.46.0",
|
|
66
67
|
"react-aria-components": "^1.15.0",
|
|
68
|
+
"react-stately": "^3.36.0",
|
|
67
69
|
"react-dom": "^18.0.0",
|
|
68
70
|
"react-international-phone": "^4.3.0"
|
|
69
71
|
},
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import d from"react";function r(o){return null}r.getCollectionNode=function*(t){let{children:i,title:n,items:l}=t;yield{type:"section",props:t,hasChildNodes:!0,rendered:n,"aria-label":t["aria-label"],*childNodes(){if(typeof i=="function"){if(!l)throw new Error("props.children was a function but props.items is missing");for(let e of l)yield{type:"item",value:e,renderer:i}}else{let e=[];d.Children.forEach(i,c=>{e.push({type:"item",element:c})}),yield*e}}}};let a=r;export{a as $};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import s,{useState as R,useRef as d,useEffect as V,useReducer as m,useCallback as b}from"react";const y=typeof document<"u"?s.useInsertionEffect??s.useLayoutEffect:()=>{};function C(o,a,c){let[l,i]=R(o||a),r=d(l),u=d(o!==void 0),t=o!==void 0;V(()=>{let e=u.current;e!==t&&process.env.NODE_ENV!=="production"&&console.warn(`WARN: A component changed from ${e?"controlled":"uncontrolled"} to ${t?"controlled":"uncontrolled"}.`),u.current=t},[t]);let f=t?o:l;y(()=>{r.current=f});let[,p]=m(()=>({}),{}),$=b((e,...E)=>{let n=typeof e=="function"?e(r.current):e;Object.is(r.current,n)||(r.current=n,i(n),p(),c?.(n,...E))},[c]);return[f,$]}export{C as $};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n,{useRef as o,useCallback as c}from"react";const s=e=>e?.ownerDocument??document,b=e=>e&&"window"in e&&e.window===e?e:s(e).defaultView||window;function u(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&typeof e.nodeType=="number"}function i(e){return u(e)&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&"host"in e}const $=typeof document<"u"?n.useLayoutEffect:()=>{};let d=!1;function a(){return d}function m(e,f){if(!a())return f&&e?e.contains(f):!1;if(!e||!f)return!1;let t=f;for(;t!==null;){if(t===e)return!0;t.tagName==="SLOT"&&t.assignedSlot?t=t.assignedSlot.parentNode:i(t)?t=t.host:t=t.parentNode}return!1}function w(e){if(a()&&e.target instanceof Element&&e.target.shadowRoot){if("composedPath"in e)return e.composedPath()[0]??null;if("composedPath"in e.nativeEvent)return e.nativeEvent.composedPath()[0]??null}return e.target}const p=n.useInsertionEffect??$;function E(e){const f=o(null);return p(()=>{f.current=e},[e]),c((...t)=>{const r=f.current;return r?.(...t)},[])}export{m as $,w as a,$ as b,s as c,b as d,E as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import v,{useMemo as m,useContext as Y,useState as $,useRef as b,useEffect as B,createContext as G,useCallback as C}from"react";import{$ as P}from"./useControlledState-Cmn8tE-_.js";const W={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valueMissing:!1,valid:!0},q={...W,customError:!0,valid:!1},V={isInvalid:!1,validationDetails:W,validationErrors:[]},H=G({}),z="__reactAriaFormValidationState";function ue(i){if(i[z]){let{realtimeValidation:e,displayValidation:t,updateValidation:l,resetValidation:s,commitValidation:n}=i[z];return{realtimeValidation:e,displayValidation:t,updateValidation:l,resetValidation:s,commitValidation:n}}return J(i)}function J(i){let{isInvalid:e,validationState:t,name:l,value:s,builtinValidation:n,validate:r,validationBehavior:a="aria"}=i;t&&(e||=t==="invalid");let o=e!==void 0?{isInvalid:e,validationErrors:[],validationDetails:q}:null,c=m(()=>{if(!r||s==null)return null;let u=X(r,s);return O(u)},[r,s]);n?.validationDetails.valid&&(n=void 0);let d=Y(H),g=m(()=>l?Array.isArray(l)?l.flatMap(u=>D(d[u])):D(d[l]):[],[d,l]),[h,p]=$(d),[E,S]=$(!1);d!==h&&(p(d),S(!1));let f=m(()=>O(E?[]:g),[E,g]),w=b(V),[x,y]=$(V),I=b(V),j=()=>{if(!Q)return;k(!1);let u=c||n||w.current;A(u,I.current)||(I.current=u,y(u))},[Q,k]=$(!1);return B(j),{realtimeValidation:o||f||c||n||V,displayValidation:a==="native"?o||f||x:o||f||c||n||x,updateValidation(u){a==="aria"&&!A(x,u)?y(u):w.current=u},resetValidation(){let u=V;A(u,I.current)||(I.current=u,y(u)),a==="native"&&k(!1),S(!0)},commitValidation(){a==="native"&&k(!0),S(!0)}}}function D(i){return i?Array.isArray(i)?i:[i]:[]}function X(i,e){if(typeof i=="function"){let t=i(e);if(t&&typeof t!="boolean")return D(t)}return[]}function O(i){return i.length?{isInvalid:!0,validationErrors:i,validationDetails:q}:null}function A(i,e){return i===e?!0:!!i&&!!e&&i.isInvalid===e.isInvalid&&i.validationErrors.length===e.validationErrors.length&&i.validationErrors.every((t,l)=>t===e.validationErrors[l])&&Object.entries(i.validationDetails).every(([t,l])=>e.validationDetails[t]===l)}function Z(i,e){return typeof e.getChildren=="function"?e.getChildren(i.key):i.childNodes}function N(i){return ee(i)}function ee(i,e){for(let t of i)return t}function F(i,e,t){if(e.parentKey===t.parentKey)return e.index-t.index;let l=[..._(i,e),e],s=[..._(i,t),t],n=l.slice(0,s.length).findIndex((r,a)=>r!==s[a]);return n!==-1?(e=l[n],t=s[n],e.index-t.index):l.findIndex(r=>r===t)>=0?1:(s.findIndex(r=>r===e)>=0,-1)}function _(i,e){let t=[],l=e;for(;l?.parentKey!=null;)l=i.getItem(l.parentKey),l&&t.unshift(l);return t}class T{constructor(e){this.keyMap=new Map,this.firstKey=null,this.lastKey=null,this.iterable=e;let t=r=>{if(this.keyMap.set(r.key,r),r.childNodes&&r.type==="section")for(let a of r.childNodes)t(a)};for(let r of e)t(r);let l=null,s=0,n=0;for(let[r,a]of this.keyMap)l?(l.nextKey=r,a.prevKey=l.key):(this.firstKey=r,a.prevKey=void 0),a.type==="item"&&(a.index=s++),(a.type==="section"||a.type==="item")&&n++,l=a,l.nextKey=void 0;this._size=n,this.lastKey=l?.key??null}*[Symbol.iterator](){yield*this.iterable}get size(){return this._size}getKeys(){return this.keyMap.keys()}getKeyBefore(e){let t=this.keyMap.get(e);return t?t.prevKey??null:null}getKeyAfter(e){let t=this.keyMap.get(e);return t?t.nextKey??null:null}getFirstKey(){return this.firstKey}getLastKey(){return this.lastKey}getItem(e){return this.keyMap.get(e)??null}at(e){const t=[...this.getKeys()];return this.getItem(t[e])}getChildren(e){return this.keyMap.get(e)?.childNodes||[]}}class K extends Set{constructor(e,t,l){super(e),e instanceof K?(this.anchorKey=t??e.anchorKey,this.currentKey=l??e.currentKey):(this.anchorKey=t??null,this.currentKey=l??null)}}function te(i,e){if(i.size!==e.size)return!1;for(let t of i)if(!e.has(t))return!1;return!0}function le(i){let{selectionMode:e="none",disallowEmptySelection:t=!1,allowDuplicateSelectionEvents:l,selectionBehavior:s="toggle",disabledBehavior:n="all"}=i,r=b(!1),[,a]=$(!1),o=b(null),c=b(null),[,d]=$(null),g=m(()=>L(i.selectedKeys),[i.selectedKeys]),h=m(()=>L(i.defaultSelectedKeys,new K),[i.defaultSelectedKeys]),[p,E]=P(g,h,i.onSelectionChange),S=m(()=>i.disabledKeys?new Set(i.disabledKeys):new Set,[i.disabledKeys]),[f,w]=$(s);s==="replace"&&f==="toggle"&&typeof p=="object"&&p.size===0&&w("replace");let x=b(s);return B(()=>{s!==x.current&&(w(s),x.current=s)},[s]),{selectionMode:e,disallowEmptySelection:t,selectionBehavior:f,setSelectionBehavior:w,get isFocused(){return r.current},setFocused(y){r.current=y,a(y)},get focusedKey(){return o.current},get childFocusStrategy(){return c.current},setFocusedKey(y,I="first"){o.current=y,c.current=I,d(y)},selectedKeys:p,setSelectedKeys(y){(l||!te(y,p))&&E(y)},disabledKeys:S,disabledBehavior:n}}function L(i,e){return i?i==="all"?"all":new K(i):e}class R{constructor(e,t,l){this.collection=e,this.state=t,this.allowsCellSelection=l?.allowsCellSelection??!1,this._isSelectAll=null,this.layoutDelegate=l?.layoutDelegate||null,this.fullCollection=l?.fullCollection||null}get selectionMode(){return this.state.selectionMode}get disallowEmptySelection(){return this.state.disallowEmptySelection}get selectionBehavior(){return this.state.selectionBehavior}setSelectionBehavior(e){this.state.setSelectionBehavior(e)}get isFocused(){return this.state.isFocused}setFocused(e){this.state.setFocused(e)}get focusedKey(){return this.state.focusedKey}get childFocusStrategy(){return this.state.childFocusStrategy}setFocusedKey(e,t){(e==null||this.collection.getItem(e))&&this.state.setFocusedKey(e,t)}get selectedKeys(){return this.state.selectedKeys==="all"?new Set(this.getSelectAllKeys()):this.state.selectedKeys}get rawSelection(){return this.state.selectedKeys}isSelected(e){if(this.state.selectionMode==="none")return!1;let t=this.getKey(e);return t==null?!1:this.state.selectedKeys==="all"?this.canSelectItem(t):this.state.selectedKeys.has(t)}get isEmpty(){return this.state.selectedKeys!=="all"&&this.state.selectedKeys.size===0}get isSelectAll(){if(this.isEmpty)return!1;if(this.state.selectedKeys==="all")return!0;if(this._isSelectAll!=null)return this._isSelectAll;let e=this.getSelectAllKeys(),t=this.state.selectedKeys;return this._isSelectAll=e.every(l=>t.has(l)),this._isSelectAll}get firstSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let l=this.collection.getItem(t);(!e||l&&F(this.collection,l,e)<0)&&(e=l)}return e?.key??null}get lastSelectedKey(){let e=null;for(let t of this.state.selectedKeys){let l=this.collection.getItem(t);(!e||l&&F(this.collection,l,e)>0)&&(e=l)}return e?.key??null}get disabledKeys(){return this.state.disabledKeys}get disabledBehavior(){return this.state.disabledBehavior}extendSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let l;if(this.state.selectedKeys==="all")l=new K([t],t,t);else{let s=this.state.selectedKeys,n=s.anchorKey??t;l=new K(s,n,t);for(let r of this.getKeyRange(n,s.currentKey??t))l.delete(r);for(let r of this.getKeyRange(t,n))this.canSelectItem(r)&&l.add(r)}this.state.setSelectedKeys(l)}getKeyRange(e,t){let l=this.collection.getItem(e),s=this.collection.getItem(t);return l&&s?F(this.collection,l,s)<=0?this.getKeyRangeInternal(e,t):this.getKeyRangeInternal(t,e):[]}getKeyRangeInternal(e,t){if(this.layoutDelegate?.getKeyRange)return this.layoutDelegate.getKeyRange(e,t);let l=[],s=e;for(;s!=null;){let n=this.collection.getItem(s);if(n&&(n.type==="item"||n.type==="cell"&&this.allowsCellSelection)&&l.push(s),s===t)return l;s=this.collection.getKeyAfter(s)}return[]}getKey(e){let t=this.collection.getItem(e);if(!t||t.type==="cell"&&this.allowsCellSelection)return e;for(;t&&t.type!=="item"&&t.parentKey!=null;)t=this.collection.getItem(t.parentKey);return!t||t.type!=="item"?null:t.key}toggleSelection(e){if(this.selectionMode==="none")return;if(this.selectionMode==="single"&&!this.isSelected(e)){this.replaceSelection(e);return}let t=this.getKey(e);if(t==null)return;let l=new K(this.state.selectedKeys==="all"?this.getSelectAllKeys():this.state.selectedKeys);l.has(t)?l.delete(t):this.canSelectItem(t)&&(l.add(t),l.anchorKey=t,l.currentKey=t),!(this.disallowEmptySelection&&l.size===0)&&this.state.setSelectedKeys(l)}replaceSelection(e){if(this.selectionMode==="none")return;let t=this.getKey(e);if(t==null)return;let l=this.canSelectItem(t)?new K([t],t,t):new K;this.state.setSelectedKeys(l)}setSelectedKeys(e){if(this.selectionMode==="none")return;let t=new K;for(let l of e){let s=this.getKey(l);if(s!=null&&(t.add(s),this.selectionMode==="single"))break}this.state.setSelectedKeys(t)}getSelectAllKeys(){let e=this.fullCollection??this.collection,t=[],l=s=>{for(;s!=null;){if(this.canSelectItemIn(s,e)){let n=e.getItem(s);n?.type==="item"&&t.push(s),n?.hasChildNodes&&(this.allowsCellSelection||n.type!=="item")&&l(N(Z(n,e))?.key??null)}s=e.getKeyAfter(s)}};return l(e.getFirstKey()),t}selectAll(){!this.isSelectAll&&this.selectionMode==="multiple"&&this.state.setSelectedKeys("all")}clearSelection(){!this.disallowEmptySelection&&(this.state.selectedKeys==="all"||this.state.selectedKeys.size>0)&&this.state.setSelectedKeys(new K)}toggleSelectAll(){this.isSelectAll?this.clearSelection():this.selectAll()}select(e,t){this.selectionMode!=="none"&&(this.selectionMode==="single"?this.isSelected(e)&&!this.disallowEmptySelection?this.toggleSelection(e):this.replaceSelection(e):this.selectionBehavior==="toggle"||t&&(t.pointerType==="touch"||t.pointerType==="virtual")?this.toggleSelection(e):this.replaceSelection(e))}isSelectionEqual(e){if(e===this.state.selectedKeys)return!0;let t=this.selectedKeys;if(e.size!==t.size)return!1;for(let l of e)if(!t.has(l))return!1;for(let l of t)if(!e.has(l))return!1;return!0}canSelectItem(e){return this.canSelectItemIn(e,this.collection)}canSelectItemIn(e,t){if(this.state.selectionMode==="none"||this.state.disabledKeys.has(e))return!1;let l=t.getItem(e);return!(!l||l?.props?.isDisabled||l.type==="cell"&&!this.allowsCellSelection)}isDisabled(e){return this.state.disabledBehavior==="all"&&(this.state.disabledKeys.has(e)||!!this.collection.getItem(e)?.props?.isDisabled)}isLink(e){return!!this.collection.getItem(e)?.props?.href}getItemProps(e){return this.collection.getItem(e)?.props}withCollection(e){return new R(e,this.state,{allowsCellSelection:this.allowsCellSelection,layoutDelegate:this.layoutDelegate||void 0,fullCollection:this.fullCollection??this.collection})}}class ie{build(e,t){return this.context=t,U(()=>this.iterateCollection(e))}*iterateCollection(e){let{children:t,items:l}=e;if(v.isValidElement(t)&&t.type===v.Fragment)yield*this.iterateCollection({children:t.props.children,items:l});else if(typeof t=="function"){if(!l)throw new Error("props.children was a function but props.items is missing");let s=0;for(let n of l)yield*this.getFullNode({value:n,index:s},{renderer:t}),s++}else{let s=[];v.Children.forEach(t,r=>{r&&s.push(r)});let n=0;for(let r of s){let a=this.getFullNode({element:r,index:n},{});for(let o of a)n++,yield o}}}getKey(e,t,l,s){if(e.key!=null)return e.key;if(t.type==="cell"&&t.key!=null)return`${s}${t.key}`;let n=t.value;if(n!=null){let r=n.key??n.id;if(r==null)throw new Error("No key found for item");return r}return s?`${s}.${t.index}`:`$.${t.index}`}getChildState(e,t){return{renderer:t.renderer||e.renderer}}*getFullNode(e,t,l,s){if(v.isValidElement(e.element)&&e.element.type===v.Fragment){let o=[];v.Children.forEach(e.element.props.children,d=>{o.push(d)});let c=e.index??0;for(const d of o)yield*this.getFullNode({element:d,index:c++},t,l,s);return}let n=e.element;if(!n&&e.value&&t&&t.renderer){let o=this.cache.get(e.value);if(o&&(!o.shouldInvalidate||!o.shouldInvalidate(this.context))){o.index=e.index,o.parentKey=s?s.key:null,yield o;return}n=t.renderer(e.value)}if(v.isValidElement(n)){let o=n.type;if(typeof o!="function"&&typeof o.getCollectionNode!="function"){let h=n.type;throw new Error(`Unknown element <${h}> in collection.`)}let c=o.getCollectionNode(n.props,this.context),d=e.index??0,g=c.next();for(;!g.done&&g.value;){let h=g.value;e.index=d;let p=h.key??null;p==null&&(p=h.element?null:this.getKey(n,e,t,l));let S=[...this.getFullNode({...h,key:p,index:d,wrapper:se(e.wrapper,h.wrapper)},this.getChildState(t,h),l?`${l}${n.key}`:n.key,s)];for(let f of S){if(f.value=h.value??e.value??null,f.value&&this.cache.set(f.value,f),e.type&&f.type!==e.type)throw new Error(`Unsupported type <${M(f.type)}> in <${M(s?.type??"unknown parent type")}>. Only <${M(e.type)}> is supported.`);d++,yield f}g=c.next(S)}return}if(e.key==null||e.type==null)return;let r=this,a={type:e.type,props:e.props,key:e.key,parentKey:s?s.key:null,value:e.value??null,level:(s?.level??0)+(s?.type==="item"?1:0),index:e.index,rendered:e.rendered,textValue:e.textValue??"","aria-label":e["aria-label"],wrapper:e.wrapper,shouldInvalidate:e.shouldInvalidate,hasChildNodes:e.hasChildNodes||!1,childNodes:U(function*(){if(!e.hasChildNodes||!e.childNodes)return;let o=0;for(let c of e.childNodes()){c.key!=null&&(c.key=`${a.key}${c.key}`);let d=r.getFullNode({...c,index:o},r.getChildState(t,c),a.key,a);for(let g of d)o++,yield g}})};yield a}constructor(){this.cache=new WeakMap}}function U(i){let e=[],t=null;return{*[Symbol.iterator](){for(let l of e)yield l;t||(t=i());for(let l of t)e.push(l),yield l}}}function se(i,e){if(i&&e)return t=>i(e(t));if(i)return i;if(e)return e}function M(i){return i[0].toUpperCase()+i.slice(1)}function ne(i,e,t){let l=m(()=>new ie,[]),{children:s,items:n,collection:r}=i;return m(()=>{if(r)return r;let o=l.build({children:s,items:n},t);return e(o)},[l,s,n,r,t,e])}function fe(i){let{filter:e,layoutDelegate:t}=i,l=le(i),s=m(()=>i.disabledKeys?new Set(i.disabledKeys):new Set,[i.disabledKeys]),n=C(c=>e?new T(e(c)):new T(c),[e]),r=m(()=>({suppressTextValueWarning:i.suppressTextValueWarning}),[i.suppressTextValueWarning]),a=ne(i,n,r),o=m(()=>new R(a,l,{layoutDelegate:t}),[a,l,t]);return re(a,o),{collection:a,disabledKeys:s,selectionManager:o}}function re(i,e){const t=b(null);B(()=>{if(e.focusedKey!=null&&!i.getItem(e.focusedKey)&&t.current){let l=t.current.getKeyAfter(e.focusedKey),s=null;for(;l!=null;){let n=i.getItem(l);if(n&&n.type==="item"&&!e.isDisabled(l)){s=l;break}l=t.current.getKeyAfter(l)}if(s==null)for(l=t.current.getKeyBefore(e.focusedKey);l!=null;){let n=i.getItem(l);if(n&&n.type==="item"&&!e.isDisabled(l)){s=l;break}l=t.current.getKeyBefore(l)}e.setFocusedKey(s)}t.current=i},[i,e])}function he(i){let[e,t]=P(i.isOpen,i.defaultOpen||!1,i.onOpenChange);const l=C(()=>{t(!0)},[t]),s=C(()=>{t(!1)},[t]),n=C(()=>{t(!e)},[t,e]);return{isOpen:e,setOpen:t,open:l,close:s,toggle:n}}export{fe as $,Z as a,he as b,T as c,ue as d};
|