@midas-ds/components 15.0.0 → 15.1.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/AccordionItem-8UtB6O1X.js +347 -0
- package/AccordionItem-DKE794Si.cjs +1 -0
- package/CHANGELOG.md +15 -3
- package/{ComboBox-BDX4BYWJ.js → ComboBox-BgqJgBYV.js} +2 -2
- package/{ComboBox-DFPrJUoV.cjs → ComboBox-lQ8Gfsyj.cjs} +1 -1
- package/{ListBox-u6ZXp5Yi.cjs → ListBox-2wZ6XOeD.cjs} +1 -1
- package/{ListBox-LJ3VgZMr.js → ListBox-Der0Te-R.js} +22 -22
- package/{ListBoxLoadMoreItem-DMUOzVtt.cjs → ListBoxLoadMoreItem-CTldtPr1.cjs} +1 -1
- package/{ListBoxLoadMoreItem-B4GFbdYf.js → ListBoxLoadMoreItem-CzGGgav4.js} +1 -1
- package/{ListBoxSection-CBlpg0AG.cjs → ListBoxSection-C_PqDyMP.cjs} +1 -1
- package/{ListBoxSection-DjGs1ndn.js → ListBoxSection-D9EUOerv.js} +1 -1
- package/{Select-CiCng7ZP.js → Select-D55aInrV.js} +2 -2
- package/{Select-JIDW2mN8.cjs → Select-DUthwkvg.cjs} +1 -1
- package/{Select-D4wi-0Jw.cjs → Select-DWLD64cL.cjs} +1 -1
- package/{Select-C-ykeY_T.js → Select-Dbfur2xF.js} +1 -1
- package/accordion/Accordion.d.ts +5 -0
- package/accordion/AccordionContext.d.ts +2 -3
- package/accordion/AccordionItem.d.ts +5 -1
- package/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/assets/AccordionItem.css +1 -1
- package/assets/ListBox.css +1 -1
- package/combobox/index.cjs +1 -1
- package/combobox/index.js +1 -1
- package/index.cjs +1 -1
- package/index.js +7 -7
- package/legacy-select/index.cjs +1 -1
- package/legacy-select/index.js +1 -1
- package/list-box/index.cjs +1 -1
- package/list-box/index.js +3 -3
- package/package.json +1 -1
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/AccordionItem-DTbu3lqx.js +0 -343
- package/AccordionItem-tWS22wDv.cjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./assets/ListBox.css');const M=require("react/jsx-runtime"),J=require("./ListBox-FD30iELk.cjs"),q=require("./Collection-vGO6v3_U.cjs"),c=require("react"),k=require("./mergeProps-Du5A8xi8.cjs"),K=require("./context-UOrD6Zxk.cjs"),E=require("react-dom"),Q=require("./OverlayArrow-bcrb_syE.cjs"),Z=require("./useEvent-C125NAue.cjs"),ee=require("./clsx-DKOfLqne.cjs"),V=require("./SelectionManager-CNJmHeCF.cjs");class te{shouldInvalidate(e,t){return e.width!==t.width||e.height!==t.height}shouldInvalidateLayoutOptions(e,t){return e!==t}update(e){}getItemRect(e){var t,i;return(i=(t=this.getLayoutInfo(e))===null||t===void 0?void 0:t.rect)!==null&&i!==void 0?i:null}getVisibleRect(){return this.virtualizer.visibleRect}constructor(){this.virtualizer=null}}class b{copy(){let e=new b(this.type,this.key,this.rect.copy());return e.estimatedSize=this.estimatedSize,e.opacity=this.opacity,e.transform=this.transform,e.parentKey=this.parentKey,e.content=this.content,e.isSticky=this.isSticky,e.zIndex=this.zIndex,e.allowOverflow=this.allowOverflow,e}constructor(e,t,i){this.type=e,this.key=t,this.parentKey=null,this.content=null,this.rect=i,this.estimatedSize=!1,this.isSticky=!1,this.opacity=1,this.transform=null,this.zIndex=0,this.allowOverflow=!1}}class x{copy(){return new x(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}isOrigin(){return this.x===0&&this.y===0}constructor(e=0,t=0){this.x=e,this.y=t}}class g{get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new x(this.x,this.y)}get topRight(){return new x(this.maxX,this.y)}get bottomLeft(){return new x(this.x,this.maxY)}get bottomRight(){return new x(this.maxX,this.maxY)}intersects(e){return(process.env.NODE_ENV==="test"&&!process.env.VIRT_ON||this.area>0&&e.area>0)&&this.x<=e.x+e.width&&e.x<=this.x+this.width&&this.y<=e.y+e.height&&e.y<=this.y+this.height}containsRect(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.maxX&&this.maxY>=e.maxY}containsPoint(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.x&&this.maxY>=e.y}getCornerInRect(e){for(let t of["topLeft","topRight","bottomLeft","bottomRight"])if(e.containsPoint(this[t]))return t;return null}equals(e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}pointEquals(e){return this.x===e.x&&this.y===e.y}sizeEquals(e){return this.width===e.width&&this.height===e.height}union(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),l=Math.max(this.maxX,e.maxX)-t,n=Math.max(this.maxY,e.maxY)-i;return new g(t,i,l,n)}intersection(e){if(!this.intersects(e))return new g(0,0,0,0);let t=Math.max(this.x,e.x),i=Math.max(this.y,e.y);return new g(t,i,Math.min(this.maxX,e.maxX)-t,Math.min(this.maxY,e.maxY)-i)}copy(){return new g(this.x,this.y,this.width,this.height)}constructor(e=0,t=0,i=0,l=0){this.x=e,this.y=t,this.width=i,this.height=l}}class ${copy(){return new $(this.width,this.height)}equals(e){return this.width===e.width&&this.height===e.height}get area(){return this.width*this.height}constructor(e=0,t=0){this.width=Math.max(e,0),this.height=Math.max(t,0)}}let ie=0;class B{prepareForReuse(){this.content=null,this.rendered=null,this.layoutInfo=null}getReusableView(e){let t=this.reusableViews.get(e);return t&&t.length>0?t.shift():new ne(this.virtualizer,this,e)}reuseChild(e){e.prepareForReuse();let t=this.reusableViews.get(e.viewType);t||(t=[],this.reusableViews.set(e.viewType,t)),t.push(e)}constructor(e,t){this.virtualizer=e,this.key=++ie,this.viewType=t,this.children=new Set,this.reusableViews=new Map,this.layoutInfo=null,this.content=null,this.rendered=null}}class le extends B{constructor(e){super(e,"root")}}class ne extends B{constructor(e,t,i){super(e,i),this.parent=t}}function oe(s,e){if(s===e)return!0;if(s.size!==e.size)return!1;for(let t of s)if(!e.has(t))return!1;return!0}class se{setVisibleRect(e){let t=performance.now()-this.startTime;t<500&&(e.x!==this.visibleRect.x&&t>0&&(this.velocity.x=(e.x-this.visibleRect.x)/t),e.y!==this.visibleRect.y&&t>0&&(this.velocity.y=(e.y-this.visibleRect.y)/t)),this.startTime=performance.now(),this.visibleRect=e}getOverscannedRect(){let e=this.visibleRect.copy(),t=this.visibleRect.height/3;if(e.height+=t,this.velocity.y<0&&(e.y-=t),this.velocity.x!==0){let i=this.visibleRect.width/3;e.width+=i,this.velocity.x<0&&(e.x-=i)}return e}constructor(){this.startTime=0,this.velocity=new x(0,0),this.visibleRect=new g}}class re{isPersistedKey(e){if(this.persistedKeys.has(e))return!0;for(let t of this.persistedKeys)for(;t!=null;){let i=this.layout.getLayoutInfo(t);if(!i||i.parentKey==null)break;if(t=i.parentKey,t===e)return!0}return!1}getParentView(e){return e.parentKey!=null?this._visibleViews.get(e.parentKey):this._rootView}getReusableView(e){let i=this.getParentView(e).getReusableView(e.type);return i.layoutInfo=e,this._renderView(i),i}_renderView(e){if(e.layoutInfo){let{type:t,key:i,content:l}=e.layoutInfo;e.content=l||this.collection.getItem(i),e.rendered=this._renderContent(t,e.content)}}_renderContent(e,t){let i=t!=null?this._renderedContent.get(t):null;if(i!=null)return i;let l=this.delegate.renderView(e,t);return t&&this._renderedContent.set(t,l),l}keyAtPoint(e){let t=new g(e.x,e.y,1,1),i=t.area===0?[]:this.layout.getVisibleLayoutInfos(t);for(let l of i)if(l.rect.intersects(t))return l.key;return null}relayout(e={}){this.layout.update(e),this.contentSize=this.layout.getContentSize();let t=this.visibleRect,i=e.contentChanged?0:t.x,l=e.contentChanged?0:t.y;if(i=Math.max(0,Math.min(this.contentSize.width-t.width,i)),l=Math.max(0,Math.min(this.contentSize.height-t.height,l)),i!==t.x||l!==t.y){let n=new g(i,l,t.width,t.height);this.delegate.setVisibleRect(n)}else this.updateSubviews()}getVisibleLayoutInfos(){let e=process.env.NODE_ENV==="test"&&!process.env.VIRT_ON,t=e&&typeof HTMLElement<"u"&&Object.getOwnPropertyNames(HTMLElement.prototype).includes("clientWidth"),i=e&&typeof HTMLElement<"u"&&Object.getOwnPropertyNames(HTMLElement.prototype).includes("clientHeight"),l;e&&!(t&&i)?l=new g(0,0,this.contentSize.width,this.contentSize.height):l=this._overscanManager.getOverscannedRect();let n=this.layout.getVisibleLayoutInfos(l),o=new Map;for(let a of n)o.set(a.key,a);return o}updateSubviews(){let e=this.getVisibleLayoutInfos(),t=new Set;for(let[i,l]of this._visibleViews){let n=e.get(i);(!n||l.parent!==this.getParentView(n))&&(this._visibleViews.delete(i),l.parent.reuseChild(l),t.add(l))}for(let[i,l]of e){let n=this._visibleViews.get(i);if(!n)n=this.getReusableView(l),n.parent.children.add(n),this._visibleViews.set(i,n),t.delete(n);else{n.layoutInfo=l;let o=this.collection.getItem(l.key);n.content!==o&&(n.content!=null&&this._renderedContent.delete(n.content),this._renderView(n))}}for(let i of t)i.parent.children.delete(i),i.parent.reusableViews.clear();if(!this._isScrolling)for(let i of e.keys()){let l=this._visibleViews.get(i);l.parent.children.delete(l),l.parent.children.add(l)}}render(e){let t=this,i=!1,l=!1,n=!1,o=!1,a=!1,h=!1;return e.collection!==this.collection&&(t.collection=e.collection,i=!0),(e.layout!==this.layout||this.layout.virtualizer!==this)&&(this.layout&&(this.layout.virtualizer=null),e.layout.virtualizer=this,t.layout=e.layout,i=!0),e.persistedKeys&&!oe(e.persistedKeys,this.persistedKeys)&&(t.persistedKeys=e.persistedKeys,h=!0),this.visibleRect.equals(e.visibleRect)||(this._overscanManager.setVisibleRect(e.visibleRect),this.layout.shouldInvalidate(e.visibleRect,this.visibleRect)?(l=!e.visibleRect.pointEquals(this.visibleRect),n=!e.visibleRect.sizeEquals(this.visibleRect),i=!0):h=!0,t.visibleRect=e.visibleRect),e.invalidationContext!==this._invalidationContext&&(e.invalidationContext&&(n||(n=e.invalidationContext.sizeChanged||!1),l||(l=e.invalidationContext.offsetChanged||!1),o||(o=e.invalidationContext.itemSizeChanged||!1),a||(a=e.invalidationContext.layoutOptions!=null&&this._invalidationContext.layoutOptions!=null&&e.invalidationContext.layoutOptions!==this._invalidationContext.layoutOptions&&this.layout.shouldInvalidateLayoutOptions(e.invalidationContext.layoutOptions,this._invalidationContext.layoutOptions)),i||(i=o||n||l||a)),this._invalidationContext=e.invalidationContext),e.isScrolling!==this._isScrolling&&(this._isScrolling=e.isScrolling,e.isScrolling||(h=!0)),i?this.relayout({offsetChanged:l,sizeChanged:n,itemSizeChanged:o,layoutOptionsChanged:a,layoutOptions:this._invalidationContext.layoutOptions}):h&&this.updateSubviews(),Array.from(this._rootView.children)}getVisibleView(e){return this._visibleViews.get(e)}invalidate(e){this.delegate.invalidate(e)}updateItemSize(e,t){if(!this.layout.updateItemSize)return;this.layout.updateItemSize(e,t)&&this.invalidate({itemSizeChanged:!0})}constructor(e){this.delegate=e.delegate,this.collection=e.collection,this.layout=e.layout,this.contentSize=new $,this.visibleRect=new g,this.persistedKeys=new Set,this._visibleViews=new Map,this._renderedContent=new WeakMap,this._rootView=new le(this),this._isScrolling=!1,this._invalidationContext={},this._overscanManager=new se}}const ae=typeof document<"u"?c.useLayoutEffect:()=>{};function he(s){let[e,t]=c.useState(new g(0,0,0,0)),[i,l]=c.useState(!1),[n,o]=c.useState({}),a=c.useRef(!1),[h]=c.useState(()=>new re({collection:s.collection,layout:s.layout,delegate:{setVisibleRect(p){t(p),a.current=!0},renderView:s.renderView,invalidate:o}}));ae(()=>{a.current&&(a.current=!1,s.onVisibleRectChange(e))});let r=c.useMemo(()=>s.layoutOptions!=null?{...n,layoutOptions:s.layoutOptions}:n,[n,s.layoutOptions]),d=h.render({layout:s.layout,collection:s.collection,persistedKeys:s.persistedKeys,layoutOptions:s.layoutOptions,visibleRect:e,invalidationContext:r,isScrolling:i}),u=h.contentSize,f=c.useCallback(()=>{l(!0)},[]),v=c.useCallback(()=>{l(!1)},[]);return c.useMemo(()=>({virtualizer:h,visibleViews:d,setVisibleRect:t,contentSize:u,isScrolling:i,startScrolling:f,endScrolling:v}),[h,d,t,u,i,f,v])}const R=48;class de extends te{get collection(){return this.virtualizer.collection}getLayoutInfo(e){var t;return this.ensureLayoutInfo(e),((t=this.layoutNodes.get(e))===null||t===void 0?void 0:t.layoutInfo)||null}getVisibleLayoutInfos(e){if(e.height>1){var t,i;let o=((i=(t=this.rowHeight)!==null&&t!==void 0?t:this.estimatedRowHeight)!==null&&i!==void 0?i:R)+this.gap;e.y=Math.floor(e.y/o)*o,e.height=Math.ceil(e.height/o)*o}this.layoutIfNeeded(e);let l=[],n=o=>{for(let a of o)this.isVisible(a,e)&&(l.push(a.layoutInfo),a.children&&n(a.children))};return n(this.rootNodes),l}layoutIfNeeded(e){if(this.lastCollection){this.requestedRect.containsRect(e)||(this.requestedRect=this.requestedRect.union(e),this.rootNodes=this.buildCollection());for(let t of this.virtualizer.persistedKeys)if(this.ensureLayoutInfo(t))return}}ensureLayoutInfo(e){return!this.layoutNodes.has(e)&&this.requestedRect.area<this.contentSize.area&&this.lastCollection?(this.requestedRect=new g(0,0,1/0,1/0),this.rootNodes=this.buildCollection(),this.requestedRect=new g(0,0,this.contentSize.width,this.contentSize.height),!0):!1}isVisible(e,t){return e.layoutInfo.rect.intersects(t)||e.layoutInfo.isSticky||e.layoutInfo.type==="header"||e.layoutInfo.type==="loader"||this.virtualizer.isPersistedKey(e.layoutInfo.key)}shouldInvalidateEverything(e){let t=e.layoutOptions;var i,l,n,o,a;return e.sizeChanged||this.rowHeight!==((i=t==null?void 0:t.rowHeight)!==null&&i!==void 0?i:this.rowHeight)||this.headingHeight!==((l=t==null?void 0:t.headingHeight)!==null&&l!==void 0?l:this.headingHeight)||this.loaderHeight!==((n=t==null?void 0:t.loaderHeight)!==null&&n!==void 0?n:this.loaderHeight)||this.gap!==((o=t==null?void 0:t.gap)!==null&&o!==void 0?o:this.gap)||this.padding!==((a=t==null?void 0:t.padding)!==null&&a!==void 0?a:this.padding)}shouldInvalidateLayoutOptions(e,t){return e.rowHeight!==t.rowHeight||e.estimatedRowHeight!==t.estimatedRowHeight||e.headingHeight!==t.headingHeight||e.estimatedHeadingHeight!==t.estimatedHeadingHeight||e.loaderHeight!==t.loaderHeight||e.dropIndicatorThickness!==t.dropIndicatorThickness||e.gap!==t.gap||e.padding!==t.padding}update(e){let t=this.virtualizer.collection;this.invalidateEverything=this.shouldInvalidateEverything(e),this.invalidateEverything&&(this.requestedRect=this.virtualizer.visibleRect.copy(),this.layoutNodes.clear());let i=e.layoutOptions;var l;this.rowHeight=(l=i==null?void 0:i.rowHeight)!==null&&l!==void 0?l:this.rowHeight;var n;this.estimatedRowHeight=(n=i==null?void 0:i.estimatedRowHeight)!==null&&n!==void 0?n:this.estimatedRowHeight;var o;this.headingHeight=(o=i==null?void 0:i.headingHeight)!==null&&o!==void 0?o:this.headingHeight;var a;this.estimatedHeadingHeight=(a=i==null?void 0:i.estimatedHeadingHeight)!==null&&a!==void 0?a:this.estimatedHeadingHeight;var h;this.loaderHeight=(h=i==null?void 0:i.loaderHeight)!==null&&h!==void 0?h:this.loaderHeight;var r;this.dropIndicatorThickness=(r=i==null?void 0:i.dropIndicatorThickness)!==null&&r!==void 0?r:this.dropIndicatorThickness;var d;this.gap=(d=i==null?void 0:i.gap)!==null&&d!==void 0?d:this.gap;var u;if(this.padding=(u=i==null?void 0:i.padding)!==null&&u!==void 0?u:this.padding,this.rootNodes=this.buildCollection(),this.lastCollection&&t!==this.lastCollection)for(let f of this.lastCollection.getKeys())t.getItem(f)||this.layoutNodes.get(f)&&this.layoutNodes.delete(f);this.lastCollection=t,this.invalidateEverything=!1,this.validRect=this.requestedRect.copy()}buildCollection(e=this.padding){let t=this.virtualizer.collection,i=[...t],l=i.filter(r=>r.type==="loader"),n=[],o=(t==null?void 0:t.size)===0;o&&(e=0);for(let r of i){var a,h;let d=((h=(a=this.rowHeight)!==null&&a!==void 0?a:this.estimatedRowHeight)!==null&&h!==void 0?h:R)+this.gap;if(r.type==="item"&&e+d<this.requestedRect.y&&!this.isValid(r,e)){e+=d;continue}let u=this.buildChild(r,this.padding,e,null);if(e=u.layoutInfo.rect.maxY+this.gap,n.push(u),r.type==="loader"){let f=l.indexOf(r);l.splice(f,1)}if((r.type==="item"||r.type==="loader")&&e>this.requestedRect.maxY){let f=i.indexOf(r);for(let v of l){let y=i.indexOf(v);e+=(y-f-1)*d;let p=this.buildChild(v,this.padding,e,null);n.push(p),e=p.layoutInfo.rect.maxY,f=y}e+=(i.length-f-1)*d;break}}return e-=this.gap,e+=o?0:this.padding,this.contentSize=new $(this.virtualizer.visibleRect.width,e),n}isValid(e,t){let i=this.layoutNodes.get(e.key);return!this.invalidateEverything&&!!i&&i.node===e&&t===i.layoutInfo.rect.y&&i.layoutInfo.rect.intersects(this.validRect)&&i.validRect.containsRect(i.layoutInfo.rect.intersection(this.requestedRect))}buildChild(e,t,i,l){if(this.isValid(e,i))return this.layoutNodes.get(e.key);let n=this.buildNode(e,t,i);return n.layoutInfo.parentKey=l??null,n.layoutInfo.allowOverflow=!0,this.layoutNodes.set(e.key,n),n}buildNode(e,t,i){switch(e.type){case"section":return this.buildSection(e,t,i);case"item":return this.buildItem(e,t,i);case"header":return this.buildSectionHeader(e,t,i);case"loader":return this.buildLoader(e,t,i);case"separator":return this.buildItem(e,t,i);default:throw new Error("Unsupported node type: "+e.type)}}buildLoader(e,t,i){let l=new g(t,i,this.padding,0),n=new b("loader",e.key,l);l.width=this.virtualizer.contentSize.width-this.padding-t;var o,a,h;return l.height=e.props.isLoading?(h=(a=(o=this.loaderHeight)!==null&&o!==void 0?o:this.rowHeight)!==null&&a!==void 0?a:this.estimatedRowHeight)!==null&&h!==void 0?h:R:0,{layoutInfo:n,validRect:l.intersection(this.requestedRect)}}buildSection(e,t,i){let l=this.virtualizer.collection,n=this.virtualizer.visibleRect.width-this.padding,o=new g(t,i,n-t,0),a=new b(e.type,e.key,o),h=i,r=0,d=[];for(let v of V.$c5a24bc478652b5f$export$1005530eda016c13(e,l)){var u,f;let y=((f=(u=this.rowHeight)!==null&&u!==void 0?u:this.estimatedRowHeight)!==null&&f!==void 0?f:R)+this.gap;if(i+y<this.requestedRect.y&&!this.isValid(e,i)){i+=y,r++;continue}let p=this.buildChild(v,t,i,a.key);if(i=p.layoutInfo.rect.maxY+this.gap,d.push(p),i>this.requestedRect.maxY){i+=([...V.$c5a24bc478652b5f$export$1005530eda016c13(e,l)].length-(d.length+r))*y;break}}return i-=this.gap,o.height=i-h,{layoutInfo:a,children:d,validRect:a.rect.intersection(this.requestedRect),node:e}}buildSectionHeader(e,t,i){let l=this.virtualizer.visibleRect.width-this.padding,n=this.headingHeight,o=!1;if(n==null){let r=this.layoutNodes.get(e.key),d=r==null?void 0:r.layoutInfo;if(d){let u=this.virtualizer.collection.getItem(e.key),f=this.lastCollection?this.lastCollection.getItem(e.key):null;n=d.rect.height,o=l!==d.rect.width||u!==f||d.estimatedSize}else n=e.rendered?this.estimatedHeadingHeight:0,o=!0}n==null&&(n=R);let a=new g(t,i,l-t,n),h=new b("header",e.key,a);return h.estimatedSize=o,{layoutInfo:h,children:[],validRect:h.rect.intersection(this.requestedRect),node:e}}buildItem(e,t,i){let l=this.virtualizer.visibleRect.width-this.padding-t,n=this.rowHeight,o=!1;if(n==null){let r=this.layoutNodes.get(e.key);r?(n=r.layoutInfo.rect.height,o=l!==r.layoutInfo.rect.width||e!==r.node||r.layoutInfo.estimatedSize):(n=this.estimatedRowHeight,o=!0)}n==null&&(n=R);let a=new g(t,i,l,n),h=new b(e.type,e.key,a);return h.estimatedSize=o,{layoutInfo:h,children:[],validRect:h.rect,node:e}}updateItemSize(e,t){let i=this.layoutNodes.get(e);if(!i)return!1;let l=this.virtualizer.collection,n=i.layoutInfo;if(n.estimatedSize=!1,n.rect.height!==t.height){let o=n.copy();o.rect.height=t.height,i.layoutInfo=o,this.validRect.height=Math.min(this.validRect.height,n.rect.y-this.validRect.y),this.requestedRect.height+=o.rect.height-n.rect.height,this.updateLayoutNode(e,n,o);let a=n.parentKey!=null?l.getItem(n.parentKey):null;for(;a;)this.updateLayoutNode(a.key,n,o),a=a.parentKey!=null?l.getItem(a.parentKey):null;return!0}return!1}updateLayoutNode(e,t,i){let l=this.layoutNodes.get(e);l&&(l.validRect=l.validRect.intersection(this.validRect),l.layoutInfo===t&&(l.layoutInfo=i))}getContentSize(){return this.contentSize}getDropTargetFromPoint(e,t,i){e+=this.virtualizer.visibleRect.x,t+=this.virtualizer.visibleRect.y;let l=new g(e,Math.max(0,t-this.gap),1,Math.max(1,this.gap*2)),n=this.getVisibleLayoutInfos(l),o=null,a=1/0;for(let u of n){if(!u.rect.intersects(l))continue;let f=Math.abs(u.rect.y-t),v=Math.abs(u.rect.maxY-t),y=Math.min(f,v);y<a&&(a=y,o=u.key)}if(o==null||this.virtualizer.collection.size===0)return{type:"root"};let h=this.getLayoutInfo(o);if(!h)return null;let r=h.rect,d={type:"item",key:h.key,dropPosition:"on"};return i(d)?t<=r.y+10&&i({...d,dropPosition:"before"})?d.dropPosition="before":t>=r.maxY-10&&i({...d,dropPosition:"after"})&&(d.dropPosition="after"):t<=r.y+r.height/2&&i({...d,dropPosition:"before"})?d.dropPosition="before":i({...d,dropPosition:"after"})&&(d.dropPosition="after"),d}getDropTargetLayoutInfo(e){let t=this.getLayoutInfo(e.key),i;if(e.dropPosition==="before")i=new g(t.rect.x,Math.max(0,t.rect.y-this.dropIndicatorThickness/2),t.rect.width,this.dropIndicatorThickness);else if(e.dropPosition==="after"){let n=this.collection.getItem(e.key);if(n){var l;let o=(l=n.level)!==null&&l!==void 0?l:0,a=this.collection.getKeyAfter(e.key);for(;a!=null;){let h=this.collection.getItem(a);if(!h||h.level<=o)break;t=this.getLayoutInfo(a)||t,a=this.collection.getKeyAfter(a)}}i=new g(t.rect.x,t.rect.maxY-this.dropIndicatorThickness/2,t.rect.width,this.dropIndicatorThickness)}else i=t.rect;return new b("dropIndicator",e.key+":"+e.dropPosition,i)}constructor(e={}){super();var t;this.rowHeight=(t=e.rowHeight)!==null&&t!==void 0?t:null;var i;this.estimatedRowHeight=(i=e.estimatedRowHeight)!==null&&i!==void 0?i:null;var l;this.headingHeight=(l=e.headingHeight)!==null&&l!==void 0?l:null;var n;this.estimatedHeadingHeight=(n=e.estimatedHeadingHeight)!==null&&n!==void 0?n:null;var o;this.loaderHeight=(o=e.loaderHeight)!==null&&o!==void 0?o:null,this.dropIndicatorThickness=e.dropIndicatorThickness||2,this.gap=e.gap||0,this.padding=e.padding||0,this.layoutNodes=new Map,this.rootNodes=[],this.lastCollection=null,this.invalidateEverything=!1,this.validRect=new g,this.requestedRect=new g,this.contentSize=new $}}let S=null;function ce(s=!1){if(S===null||s){const e=document.createElement("div"),t=e.style;t.width="50px",t.height="50px",t.overflow="scroll",t.direction="rtl";const i=document.createElement("div"),l=i.style;return l.width="100px",l.height="100px",e.appendChild(i),document.body.appendChild(e),e.scrollLeft>0?S="positive-descending":(e.scrollLeft=1,e.scrollLeft===0?S="negative":S="positive-ascending"),document.body.removeChild(e),S}return S}function ue(s,e){let{scrollLeft:t}=s;if(e==="rtl"){let{scrollWidth:i,clientWidth:l}=s;switch(ce()){case"negative":t=-t;break;case"positive-descending":t=i-l-t;break}}return t}function fe(s,e){let{contentSize:t,onVisibleRectChange:i,innerStyle:l,onScrollStart:n,onScrollEnd:o,scrollDirection:a="both",...h}=s,r=c.useRef({scrollTop:0,scrollLeft:0,scrollEndTime:0,scrollTimeout:null,width:0,height:0,isScrolling:!1}).current,{direction:d}=K.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7(),[u,f]=c.useState(!1),v=c.useCallback(w=>{w.target===w.currentTarget&&(s.onScroll&&s.onScroll(w),E.flushSync(()=>{let m=w.currentTarget.scrollTop,z=ue(w.currentTarget,d);r.scrollTop=Math.max(0,Math.min(m,t.height-r.height)),r.scrollLeft=Math.max(0,Math.min(z,t.width-r.width)),i(new g(r.scrollLeft,r.scrollTop,r.width,r.height)),r.isScrolling||(r.isScrolling=!0,f(!0),window.dispatchEvent(new Event("tk.disconnect-observer")),n&&n());let C=Date.now();r.scrollEndTime<=C+50&&(r.scrollEndTime=C+300,r.scrollTimeout!=null&&clearTimeout(r.scrollTimeout),r.scrollTimeout=setTimeout(()=>{r.isScrolling=!1,f(!1),r.scrollTimeout=null,window.dispatchEvent(new Event("tk.connect-observer")),o&&o()},300))}))},[s,d,r,t,i,n,o]);Z.$e9faafb641e167db$export$90fc3a17d93f704c(e,"scroll",v),c.useEffect(()=>()=>{r.scrollTimeout!=null&&clearTimeout(r.scrollTimeout),r.isScrolling&&window.dispatchEvent(new Event("tk.connect-observer"))},[]);let y=c.useRef(!1),p=k.$8ae05eaa5c114e9c$export$7f54fc3180508a52(w=>{let m=e.current;if(!m||y.current)return;y.current=!0;let z=process.env.NODE_ENV==="test"&&!process.env.VIRT_ON,C=Object.getOwnPropertyNames(window.HTMLElement.prototype).includes("clientWidth"),G=Object.getOwnPropertyNames(window.HTMLElement.prototype).includes("clientHeight"),N=m.clientWidth,T=m.clientHeight,_=z&&!C?1/0:N,L=z&&!G?1/0:T;(r.width!==_||r.height!==L)&&(r.width=_,r.height=L,w(()=>{i(new g(r.scrollLeft,r.scrollTop,_,L))}),(!z&&N!==m.clientWidth||T!==m.clientHeight)&&(r.width=m.clientWidth,r.height=m.clientHeight,w(()=>{i(new g(r.scrollLeft,r.scrollTop,r.width,r.height))}))),y.current=!1}),H=c.useRef(null),[j,F]=c.useState({});k.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{if(!y.current&&(H.current==null||!t.equals(H.current)))if(typeof IS_REACT_ACT_ENVIRONMENT=="boolean"?IS_REACT_ACT_ENVIRONMENT:typeof jest<"u"){F({}),H.current=t;return}else queueMicrotask(()=>p(E.flushSync));H.current=t}),k.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{p(w=>w())},[j]);let U=c.useCallback(()=>{p(E.flushSync)},[p]);Q.$9daab02d461809db$export$683480f191c0e3ea({ref:e,box:"border-box",onResize:U});let I={padding:0,...h.style};return a==="horizontal"?(I.overflowX="auto",I.overflowY="hidden"):a==="vertical"||t.width===r.width?(I.overflowY="auto",I.overflowX="hidden"):I.overflow="auto",l={width:Number.isFinite(t.width)?t.width:void 0,height:Number.isFinite(t.height)?t.height:void 0,pointerEvents:u?"none":"auto",position:"relative",...l},{isScrolling:u,scrollViewProps:{...h,style:I},contentProps:{role:"presentation",style:l}}}function ge(s){let{layoutInfo:e,virtualizer:t,ref:i}=s,l=e==null?void 0:e.key,n=c.useCallback(()=>{if(l!=null&&i.current){let o=ye(i.current);t.updateItemSize(l,o)}},[t,l,i]);return k.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{e!=null&&e.estimatedSize&&n()}),{updateSize:n}}function ye(s){let e=s.style.height;s.style.height="";let t=new $(s.scrollWidth,s.scrollHeight);return s.style.height=e,t}function Y(s){let{style:e,className:t,layoutInfo:i,virtualizer:l,parent:n,children:o}=s,{direction:a}=K.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7(),h=c.useRef(null);return ge({layoutInfo:i,virtualizer:l,ref:h}),c.createElement("div",{role:"presentation",ref:h,className:t,style:{...ve(i,a,n),...e}},o)}let O=new WeakMap;function ve(s,e,t){let i=e==="rtl"?"right":"left",l=O.get(s);if(l&&l[i]!=null){if(!t)return l;let h=s.rect.y-t.rect.y,r=s.rect.x-t.rect.x;if(l.top===h&&l[i]===r)return l}let n={top:s.rect.y-(t&&!(t.allowOverflow&&s.isSticky)?t.rect.y:0),[i]:s.rect.x-(t&&!(t.allowOverflow&&s.isSticky)?t.rect.x:0),width:s.rect.width,height:s.rect.height};Object.entries(n).forEach(([h,r])=>{Number.isFinite(r)||(n[h]=void 0)});var o;let a={position:s.isSticky?"sticky":"absolute",display:s.isSticky?"inline-block":void 0,overflow:s.allowOverflow?"visible":"hidden",opacity:s.opacity,zIndex:s.zIndex,transform:(o=s.transform)!==null&&o!==void 0?o:void 0,contain:"size layout style",...n};return O.set(s,a),a}const W=c.createContext(null),D=c.createContext(null);function pe(s){let{children:e,layout:t,layoutOptions:i}=s,l=c.useMemo(()=>typeof t=="function"?new t:t,[t]),n=c.useMemo(()=>({isVirtualized:!0,layoutDelegate:l,dropTargetDelegate:l.getDropTargetFromPoint?l:void 0,CollectionRoot:we,CollectionBranch:me}),[l]);return c.createElement(q.$7135fc7d473fd974$export$4feb769f8ddf26c5.Provider,{value:n},c.createElement(D.Provider,{value:{layout:l,layoutOptions:i}},e))}function we({collection:s,persistedKeys:e,scrollRef:t,renderDropIndicator:i}){var l;let{layout:n,layoutOptions:o}=c.useContext(D),a=(l=n.useLayoutOptions)===null||l===void 0?void 0:l.call(n),h=he({layout:n,collection:s,renderView:(d,u)=>{var f;return u==null||(f=u.render)===null||f===void 0?void 0:f.call(u,u)},onVisibleRectChange(d){let u=t==null?void 0:t.current;u&&(u.scrollLeft=d.x,u.scrollTop=d.y)},persistedKeys:e,layoutOptions:c.useMemo(()=>o&&a?{...o,...a}:o||a,[o,a])}),{contentProps:r}=fe({onVisibleRectChange:h.setVisibleRect,contentSize:h.contentSize,onScrollStart:h.startScrolling,onScrollEnd:h.endScrolling},t);return c.createElement("div",r,c.createElement(W.Provider,{value:h},X(null,h.visibleViews,i)))}function me({parent:s,renderDropIndicator:e}){let i=c.useContext(W).virtualizer.getVisibleView(s.key);return X(i,Array.from(i.children),e)}function X(s,e,t){return e.map(i=>be(s,i,t))}function be(s,e,t){let i=c.createElement(Y,{key:e.key,layoutInfo:e.layoutInfo,virtualizer:e.virtualizer,parent:s==null?void 0:s.layoutInfo},e.rendered),{collection:l,layout:n}=e.virtualizer,o=e.content;return(o==null?void 0:o.type)==="item"&&t&&n.getDropTargetLayoutInfo&&(i=c.createElement(c.Fragment,{key:e.key},P(s,e,{type:"item",key:e.content.key,dropPosition:"before"},t),i,q.$7135fc7d473fd974$export$2dbbd341daed716d(l,o,a=>P(s,e,a,t)))),i}function P(s,e,t,i){let l=i(t);if(l){let n=e.virtualizer.layout.getDropTargetLayoutInfo(t);l=c.createElement(Y,{layoutInfo:n,virtualizer:e.virtualizer,parent:s==null?void 0:s.layoutInfo},l)}return l}class xe extends de{getContentSize(){var t;const e=(t=this==null?void 0:this.virtualizer)==null?void 0:t.collection.getKeys();return Array.from(e||[]).forEach(i=>{this.getLayoutInfo(i)}),this.contentSize}}const Ie="_listBox_13mbb_4",Re="_listBoxPopover_13mbb_16",Se="_listBoxSectionHeading_13mbb_31",$e="_listBoxButton_13mbb_43",ze="_listBoxItem_13mbb_55",He="_listBoxLoadMoreItem_13mbb_165",A={listBox:Ie,listBoxPopover:Re,listBoxSectionHeading:Se,listBoxButton:$e,listBoxItem:ze,listBoxLoadMoreItem:He},Ce=({className:s,children:e,...t})=>M.jsx(pe,{layout:xe,layoutOptions:{headingHeight:38},children:M.jsx(J.$eed445e0843c11d0$export$41f133550aa26f48,{className:ee.clsx(A.listBox,s),...t,children:e})});exports.ListBox=Ce;exports.styles=A;
|
|
1
|
+
"use strict";require('./assets/ListBox.css');const M=require("react/jsx-runtime"),J=require("./ListBox-FD30iELk.cjs"),q=require("./Collection-vGO6v3_U.cjs"),c=require("react"),k=require("./mergeProps-Du5A8xi8.cjs"),K=require("./context-UOrD6Zxk.cjs"),E=require("react-dom"),Q=require("./OverlayArrow-bcrb_syE.cjs"),Z=require("./useEvent-C125NAue.cjs"),ee=require("./clsx-DKOfLqne.cjs"),V=require("./SelectionManager-CNJmHeCF.cjs");class te{shouldInvalidate(e,t){return e.width!==t.width||e.height!==t.height}shouldInvalidateLayoutOptions(e,t){return e!==t}update(e){}getItemRect(e){var t,i;return(i=(t=this.getLayoutInfo(e))===null||t===void 0?void 0:t.rect)!==null&&i!==void 0?i:null}getVisibleRect(){return this.virtualizer.visibleRect}constructor(){this.virtualizer=null}}class b{copy(){let e=new b(this.type,this.key,this.rect.copy());return e.estimatedSize=this.estimatedSize,e.opacity=this.opacity,e.transform=this.transform,e.parentKey=this.parentKey,e.content=this.content,e.isSticky=this.isSticky,e.zIndex=this.zIndex,e.allowOverflow=this.allowOverflow,e}constructor(e,t,i){this.type=e,this.key=t,this.parentKey=null,this.content=null,this.rect=i,this.estimatedSize=!1,this.isSticky=!1,this.opacity=1,this.transform=null,this.zIndex=0,this.allowOverflow=!1}}class x{copy(){return new x(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}isOrigin(){return this.x===0&&this.y===0}constructor(e=0,t=0){this.x=e,this.y=t}}class g{get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new x(this.x,this.y)}get topRight(){return new x(this.maxX,this.y)}get bottomLeft(){return new x(this.x,this.maxY)}get bottomRight(){return new x(this.maxX,this.maxY)}intersects(e){return(process.env.NODE_ENV==="test"&&!process.env.VIRT_ON||this.area>0&&e.area>0)&&this.x<=e.x+e.width&&e.x<=this.x+this.width&&this.y<=e.y+e.height&&e.y<=this.y+this.height}containsRect(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.maxX&&this.maxY>=e.maxY}containsPoint(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.x&&this.maxY>=e.y}getCornerInRect(e){for(let t of["topLeft","topRight","bottomLeft","bottomRight"])if(e.containsPoint(this[t]))return t;return null}equals(e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}pointEquals(e){return this.x===e.x&&this.y===e.y}sizeEquals(e){return this.width===e.width&&this.height===e.height}union(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),l=Math.max(this.maxX,e.maxX)-t,n=Math.max(this.maxY,e.maxY)-i;return new g(t,i,l,n)}intersection(e){if(!this.intersects(e))return new g(0,0,0,0);let t=Math.max(this.x,e.x),i=Math.max(this.y,e.y);return new g(t,i,Math.min(this.maxX,e.maxX)-t,Math.min(this.maxY,e.maxY)-i)}copy(){return new g(this.x,this.y,this.width,this.height)}constructor(e=0,t=0,i=0,l=0){this.x=e,this.y=t,this.width=i,this.height=l}}class ${copy(){return new $(this.width,this.height)}equals(e){return this.width===e.width&&this.height===e.height}get area(){return this.width*this.height}constructor(e=0,t=0){this.width=Math.max(e,0),this.height=Math.max(t,0)}}let ie=0;class B{prepareForReuse(){this.content=null,this.rendered=null,this.layoutInfo=null}getReusableView(e){let t=this.reusableViews.get(e);return t&&t.length>0?t.shift():new ne(this.virtualizer,this,e)}reuseChild(e){e.prepareForReuse();let t=this.reusableViews.get(e.viewType);t||(t=[],this.reusableViews.set(e.viewType,t)),t.push(e)}constructor(e,t){this.virtualizer=e,this.key=++ie,this.viewType=t,this.children=new Set,this.reusableViews=new Map,this.layoutInfo=null,this.content=null,this.rendered=null}}class le extends B{constructor(e){super(e,"root")}}class ne extends B{constructor(e,t,i){super(e,i),this.parent=t}}function oe(s,e){if(s===e)return!0;if(s.size!==e.size)return!1;for(let t of s)if(!e.has(t))return!1;return!0}class se{setVisibleRect(e){let t=performance.now()-this.startTime;t<500&&(e.x!==this.visibleRect.x&&t>0&&(this.velocity.x=(e.x-this.visibleRect.x)/t),e.y!==this.visibleRect.y&&t>0&&(this.velocity.y=(e.y-this.visibleRect.y)/t)),this.startTime=performance.now(),this.visibleRect=e}getOverscannedRect(){let e=this.visibleRect.copy(),t=this.visibleRect.height/3;if(e.height+=t,this.velocity.y<0&&(e.y-=t),this.velocity.x!==0){let i=this.visibleRect.width/3;e.width+=i,this.velocity.x<0&&(e.x-=i)}return e}constructor(){this.startTime=0,this.velocity=new x(0,0),this.visibleRect=new g}}class re{isPersistedKey(e){if(this.persistedKeys.has(e))return!0;for(let t of this.persistedKeys)for(;t!=null;){let i=this.layout.getLayoutInfo(t);if(!i||i.parentKey==null)break;if(t=i.parentKey,t===e)return!0}return!1}getParentView(e){return e.parentKey!=null?this._visibleViews.get(e.parentKey):this._rootView}getReusableView(e){let i=this.getParentView(e).getReusableView(e.type);return i.layoutInfo=e,this._renderView(i),i}_renderView(e){if(e.layoutInfo){let{type:t,key:i,content:l}=e.layoutInfo;e.content=l||this.collection.getItem(i),e.rendered=this._renderContent(t,e.content)}}_renderContent(e,t){let i=t!=null?this._renderedContent.get(t):null;if(i!=null)return i;let l=this.delegate.renderView(e,t);return t&&this._renderedContent.set(t,l),l}keyAtPoint(e){let t=new g(e.x,e.y,1,1),i=t.area===0?[]:this.layout.getVisibleLayoutInfos(t);for(let l of i)if(l.rect.intersects(t))return l.key;return null}relayout(e={}){this.layout.update(e),this.contentSize=this.layout.getContentSize();let t=this.visibleRect,i=e.contentChanged?0:t.x,l=e.contentChanged?0:t.y;if(i=Math.max(0,Math.min(this.contentSize.width-t.width,i)),l=Math.max(0,Math.min(this.contentSize.height-t.height,l)),i!==t.x||l!==t.y){let n=new g(i,l,t.width,t.height);this.delegate.setVisibleRect(n)}else this.updateSubviews()}getVisibleLayoutInfos(){let e=process.env.NODE_ENV==="test"&&!process.env.VIRT_ON,t=e&&typeof HTMLElement<"u"&&Object.getOwnPropertyNames(HTMLElement.prototype).includes("clientWidth"),i=e&&typeof HTMLElement<"u"&&Object.getOwnPropertyNames(HTMLElement.prototype).includes("clientHeight"),l;e&&!(t&&i)?l=new g(0,0,this.contentSize.width,this.contentSize.height):l=this._overscanManager.getOverscannedRect();let n=this.layout.getVisibleLayoutInfos(l),o=new Map;for(let a of n)o.set(a.key,a);return o}updateSubviews(){let e=this.getVisibleLayoutInfos(),t=new Set;for(let[i,l]of this._visibleViews){let n=e.get(i);(!n||l.parent!==this.getParentView(n))&&(this._visibleViews.delete(i),l.parent.reuseChild(l),t.add(l))}for(let[i,l]of e){let n=this._visibleViews.get(i);if(!n)n=this.getReusableView(l),n.parent.children.add(n),this._visibleViews.set(i,n),t.delete(n);else{n.layoutInfo=l;let o=this.collection.getItem(l.key);n.content!==o&&(n.content!=null&&this._renderedContent.delete(n.content),this._renderView(n))}}for(let i of t)i.parent.children.delete(i),i.parent.reusableViews.clear();if(!this._isScrolling)for(let i of e.keys()){let l=this._visibleViews.get(i);l.parent.children.delete(l),l.parent.children.add(l)}}render(e){let t=this,i=!1,l=!1,n=!1,o=!1,a=!1,h=!1;return e.collection!==this.collection&&(t.collection=e.collection,i=!0),(e.layout!==this.layout||this.layout.virtualizer!==this)&&(this.layout&&(this.layout.virtualizer=null),e.layout.virtualizer=this,t.layout=e.layout,i=!0),e.persistedKeys&&!oe(e.persistedKeys,this.persistedKeys)&&(t.persistedKeys=e.persistedKeys,h=!0),this.visibleRect.equals(e.visibleRect)||(this._overscanManager.setVisibleRect(e.visibleRect),this.layout.shouldInvalidate(e.visibleRect,this.visibleRect)?(l=!e.visibleRect.pointEquals(this.visibleRect),n=!e.visibleRect.sizeEquals(this.visibleRect),i=!0):h=!0,t.visibleRect=e.visibleRect),e.invalidationContext!==this._invalidationContext&&(e.invalidationContext&&(n||(n=e.invalidationContext.sizeChanged||!1),l||(l=e.invalidationContext.offsetChanged||!1),o||(o=e.invalidationContext.itemSizeChanged||!1),a||(a=e.invalidationContext.layoutOptions!=null&&this._invalidationContext.layoutOptions!=null&&e.invalidationContext.layoutOptions!==this._invalidationContext.layoutOptions&&this.layout.shouldInvalidateLayoutOptions(e.invalidationContext.layoutOptions,this._invalidationContext.layoutOptions)),i||(i=o||n||l||a)),this._invalidationContext=e.invalidationContext),e.isScrolling!==this._isScrolling&&(this._isScrolling=e.isScrolling,e.isScrolling||(h=!0)),i?this.relayout({offsetChanged:l,sizeChanged:n,itemSizeChanged:o,layoutOptionsChanged:a,layoutOptions:this._invalidationContext.layoutOptions}):h&&this.updateSubviews(),Array.from(this._rootView.children)}getVisibleView(e){return this._visibleViews.get(e)}invalidate(e){this.delegate.invalidate(e)}updateItemSize(e,t){if(!this.layout.updateItemSize)return;this.layout.updateItemSize(e,t)&&this.invalidate({itemSizeChanged:!0})}constructor(e){this.delegate=e.delegate,this.collection=e.collection,this.layout=e.layout,this.contentSize=new $,this.visibleRect=new g,this.persistedKeys=new Set,this._visibleViews=new Map,this._renderedContent=new WeakMap,this._rootView=new le(this),this._isScrolling=!1,this._invalidationContext={},this._overscanManager=new se}}const ae=typeof document<"u"?c.useLayoutEffect:()=>{};function he(s){let[e,t]=c.useState(new g(0,0,0,0)),[i,l]=c.useState(!1),[n,o]=c.useState({}),a=c.useRef(!1),[h]=c.useState(()=>new re({collection:s.collection,layout:s.layout,delegate:{setVisibleRect(p){t(p),a.current=!0},renderView:s.renderView,invalidate:o}}));ae(()=>{a.current&&(a.current=!1,s.onVisibleRectChange(e))});let r=c.useMemo(()=>s.layoutOptions!=null?{...n,layoutOptions:s.layoutOptions}:n,[n,s.layoutOptions]),d=h.render({layout:s.layout,collection:s.collection,persistedKeys:s.persistedKeys,layoutOptions:s.layoutOptions,visibleRect:e,invalidationContext:r,isScrolling:i}),u=h.contentSize,f=c.useCallback(()=>{l(!0)},[]),v=c.useCallback(()=>{l(!1)},[]);return c.useMemo(()=>({virtualizer:h,visibleViews:d,setVisibleRect:t,contentSize:u,isScrolling:i,startScrolling:f,endScrolling:v}),[h,d,t,u,i,f,v])}const R=48;class de extends te{get collection(){return this.virtualizer.collection}getLayoutInfo(e){var t;return this.ensureLayoutInfo(e),((t=this.layoutNodes.get(e))===null||t===void 0?void 0:t.layoutInfo)||null}getVisibleLayoutInfos(e){if(e.height>1){var t,i;let o=((i=(t=this.rowHeight)!==null&&t!==void 0?t:this.estimatedRowHeight)!==null&&i!==void 0?i:R)+this.gap;e.y=Math.floor(e.y/o)*o,e.height=Math.ceil(e.height/o)*o}this.layoutIfNeeded(e);let l=[],n=o=>{for(let a of o)this.isVisible(a,e)&&(l.push(a.layoutInfo),a.children&&n(a.children))};return n(this.rootNodes),l}layoutIfNeeded(e){if(this.lastCollection){this.requestedRect.containsRect(e)||(this.requestedRect=this.requestedRect.union(e),this.rootNodes=this.buildCollection());for(let t of this.virtualizer.persistedKeys)if(this.ensureLayoutInfo(t))return}}ensureLayoutInfo(e){return!this.layoutNodes.has(e)&&this.requestedRect.area<this.contentSize.area&&this.lastCollection?(this.requestedRect=new g(0,0,1/0,1/0),this.rootNodes=this.buildCollection(),this.requestedRect=new g(0,0,this.contentSize.width,this.contentSize.height),!0):!1}isVisible(e,t){return e.layoutInfo.rect.intersects(t)||e.layoutInfo.isSticky||e.layoutInfo.type==="header"||e.layoutInfo.type==="loader"||this.virtualizer.isPersistedKey(e.layoutInfo.key)}shouldInvalidateEverything(e){let t=e.layoutOptions;var i,l,n,o,a;return e.sizeChanged||this.rowHeight!==((i=t==null?void 0:t.rowHeight)!==null&&i!==void 0?i:this.rowHeight)||this.headingHeight!==((l=t==null?void 0:t.headingHeight)!==null&&l!==void 0?l:this.headingHeight)||this.loaderHeight!==((n=t==null?void 0:t.loaderHeight)!==null&&n!==void 0?n:this.loaderHeight)||this.gap!==((o=t==null?void 0:t.gap)!==null&&o!==void 0?o:this.gap)||this.padding!==((a=t==null?void 0:t.padding)!==null&&a!==void 0?a:this.padding)}shouldInvalidateLayoutOptions(e,t){return e.rowHeight!==t.rowHeight||e.estimatedRowHeight!==t.estimatedRowHeight||e.headingHeight!==t.headingHeight||e.estimatedHeadingHeight!==t.estimatedHeadingHeight||e.loaderHeight!==t.loaderHeight||e.dropIndicatorThickness!==t.dropIndicatorThickness||e.gap!==t.gap||e.padding!==t.padding}update(e){let t=this.virtualizer.collection;this.invalidateEverything=this.shouldInvalidateEverything(e),this.invalidateEverything&&(this.requestedRect=this.virtualizer.visibleRect.copy(),this.layoutNodes.clear());let i=e.layoutOptions;var l;this.rowHeight=(l=i==null?void 0:i.rowHeight)!==null&&l!==void 0?l:this.rowHeight;var n;this.estimatedRowHeight=(n=i==null?void 0:i.estimatedRowHeight)!==null&&n!==void 0?n:this.estimatedRowHeight;var o;this.headingHeight=(o=i==null?void 0:i.headingHeight)!==null&&o!==void 0?o:this.headingHeight;var a;this.estimatedHeadingHeight=(a=i==null?void 0:i.estimatedHeadingHeight)!==null&&a!==void 0?a:this.estimatedHeadingHeight;var h;this.loaderHeight=(h=i==null?void 0:i.loaderHeight)!==null&&h!==void 0?h:this.loaderHeight;var r;this.dropIndicatorThickness=(r=i==null?void 0:i.dropIndicatorThickness)!==null&&r!==void 0?r:this.dropIndicatorThickness;var d;this.gap=(d=i==null?void 0:i.gap)!==null&&d!==void 0?d:this.gap;var u;if(this.padding=(u=i==null?void 0:i.padding)!==null&&u!==void 0?u:this.padding,this.rootNodes=this.buildCollection(),this.lastCollection&&t!==this.lastCollection)for(let f of this.lastCollection.getKeys())t.getItem(f)||this.layoutNodes.get(f)&&this.layoutNodes.delete(f);this.lastCollection=t,this.invalidateEverything=!1,this.validRect=this.requestedRect.copy()}buildCollection(e=this.padding){let t=this.virtualizer.collection,i=[...t],l=i.filter(r=>r.type==="loader"),n=[],o=(t==null?void 0:t.size)===0;o&&(e=0);for(let r of i){var a,h;let d=((h=(a=this.rowHeight)!==null&&a!==void 0?a:this.estimatedRowHeight)!==null&&h!==void 0?h:R)+this.gap;if(r.type==="item"&&e+d<this.requestedRect.y&&!this.isValid(r,e)){e+=d;continue}let u=this.buildChild(r,this.padding,e,null);if(e=u.layoutInfo.rect.maxY+this.gap,n.push(u),r.type==="loader"){let f=l.indexOf(r);l.splice(f,1)}if((r.type==="item"||r.type==="loader")&&e>this.requestedRect.maxY){let f=i.indexOf(r);for(let v of l){let y=i.indexOf(v);e+=(y-f-1)*d;let p=this.buildChild(v,this.padding,e,null);n.push(p),e=p.layoutInfo.rect.maxY,f=y}e+=(i.length-f-1)*d;break}}return e-=this.gap,e+=o?0:this.padding,this.contentSize=new $(this.virtualizer.visibleRect.width,e),n}isValid(e,t){let i=this.layoutNodes.get(e.key);return!this.invalidateEverything&&!!i&&i.node===e&&t===i.layoutInfo.rect.y&&i.layoutInfo.rect.intersects(this.validRect)&&i.validRect.containsRect(i.layoutInfo.rect.intersection(this.requestedRect))}buildChild(e,t,i,l){if(this.isValid(e,i))return this.layoutNodes.get(e.key);let n=this.buildNode(e,t,i);return n.layoutInfo.parentKey=l??null,n.layoutInfo.allowOverflow=!0,this.layoutNodes.set(e.key,n),n}buildNode(e,t,i){switch(e.type){case"section":return this.buildSection(e,t,i);case"item":return this.buildItem(e,t,i);case"header":return this.buildSectionHeader(e,t,i);case"loader":return this.buildLoader(e,t,i);case"separator":return this.buildItem(e,t,i);default:throw new Error("Unsupported node type: "+e.type)}}buildLoader(e,t,i){let l=new g(t,i,this.padding,0),n=new b("loader",e.key,l);l.width=this.virtualizer.contentSize.width-this.padding-t;var o,a,h;return l.height=e.props.isLoading?(h=(a=(o=this.loaderHeight)!==null&&o!==void 0?o:this.rowHeight)!==null&&a!==void 0?a:this.estimatedRowHeight)!==null&&h!==void 0?h:R:0,{layoutInfo:n,validRect:l.intersection(this.requestedRect)}}buildSection(e,t,i){let l=this.virtualizer.collection,n=this.virtualizer.visibleRect.width-this.padding,o=new g(t,i,n-t,0),a=new b(e.type,e.key,o),h=i,r=0,d=[];for(let v of V.$c5a24bc478652b5f$export$1005530eda016c13(e,l)){var u,f;let y=((f=(u=this.rowHeight)!==null&&u!==void 0?u:this.estimatedRowHeight)!==null&&f!==void 0?f:R)+this.gap;if(i+y<this.requestedRect.y&&!this.isValid(e,i)){i+=y,r++;continue}let p=this.buildChild(v,t,i,a.key);if(i=p.layoutInfo.rect.maxY+this.gap,d.push(p),i>this.requestedRect.maxY){i+=([...V.$c5a24bc478652b5f$export$1005530eda016c13(e,l)].length-(d.length+r))*y;break}}return i-=this.gap,o.height=i-h,{layoutInfo:a,children:d,validRect:a.rect.intersection(this.requestedRect),node:e}}buildSectionHeader(e,t,i){let l=this.virtualizer.visibleRect.width-this.padding,n=this.headingHeight,o=!1;if(n==null){let r=this.layoutNodes.get(e.key),d=r==null?void 0:r.layoutInfo;if(d){let u=this.virtualizer.collection.getItem(e.key),f=this.lastCollection?this.lastCollection.getItem(e.key):null;n=d.rect.height,o=l!==d.rect.width||u!==f||d.estimatedSize}else n=e.rendered?this.estimatedHeadingHeight:0,o=!0}n==null&&(n=R);let a=new g(t,i,l-t,n),h=new b("header",e.key,a);return h.estimatedSize=o,{layoutInfo:h,children:[],validRect:h.rect.intersection(this.requestedRect),node:e}}buildItem(e,t,i){let l=this.virtualizer.visibleRect.width-this.padding-t,n=this.rowHeight,o=!1;if(n==null){let r=this.layoutNodes.get(e.key);r?(n=r.layoutInfo.rect.height,o=l!==r.layoutInfo.rect.width||e!==r.node||r.layoutInfo.estimatedSize):(n=this.estimatedRowHeight,o=!0)}n==null&&(n=R);let a=new g(t,i,l,n),h=new b(e.type,e.key,a);return h.estimatedSize=o,{layoutInfo:h,children:[],validRect:h.rect,node:e}}updateItemSize(e,t){let i=this.layoutNodes.get(e);if(!i)return!1;let l=this.virtualizer.collection,n=i.layoutInfo;if(n.estimatedSize=!1,n.rect.height!==t.height){let o=n.copy();o.rect.height=t.height,i.layoutInfo=o,this.validRect.height=Math.min(this.validRect.height,n.rect.y-this.validRect.y),this.requestedRect.height+=o.rect.height-n.rect.height,this.updateLayoutNode(e,n,o);let a=n.parentKey!=null?l.getItem(n.parentKey):null;for(;a;)this.updateLayoutNode(a.key,n,o),a=a.parentKey!=null?l.getItem(a.parentKey):null;return!0}return!1}updateLayoutNode(e,t,i){let l=this.layoutNodes.get(e);l&&(l.validRect=l.validRect.intersection(this.validRect),l.layoutInfo===t&&(l.layoutInfo=i))}getContentSize(){return this.contentSize}getDropTargetFromPoint(e,t,i){e+=this.virtualizer.visibleRect.x,t+=this.virtualizer.visibleRect.y;let l=new g(e,Math.max(0,t-this.gap),1,Math.max(1,this.gap*2)),n=this.getVisibleLayoutInfos(l),o=null,a=1/0;for(let u of n){if(!u.rect.intersects(l))continue;let f=Math.abs(u.rect.y-t),v=Math.abs(u.rect.maxY-t),y=Math.min(f,v);y<a&&(a=y,o=u.key)}if(o==null||this.virtualizer.collection.size===0)return{type:"root"};let h=this.getLayoutInfo(o);if(!h)return null;let r=h.rect,d={type:"item",key:h.key,dropPosition:"on"};return i(d)?t<=r.y+10&&i({...d,dropPosition:"before"})?d.dropPosition="before":t>=r.maxY-10&&i({...d,dropPosition:"after"})&&(d.dropPosition="after"):t<=r.y+r.height/2&&i({...d,dropPosition:"before"})?d.dropPosition="before":i({...d,dropPosition:"after"})&&(d.dropPosition="after"),d}getDropTargetLayoutInfo(e){let t=this.getLayoutInfo(e.key),i;if(e.dropPosition==="before")i=new g(t.rect.x,Math.max(0,t.rect.y-this.dropIndicatorThickness/2),t.rect.width,this.dropIndicatorThickness);else if(e.dropPosition==="after"){let n=this.collection.getItem(e.key);if(n){var l;let o=(l=n.level)!==null&&l!==void 0?l:0,a=this.collection.getKeyAfter(e.key);for(;a!=null;){let h=this.collection.getItem(a);if(!h||h.level<=o)break;t=this.getLayoutInfo(a)||t,a=this.collection.getKeyAfter(a)}}i=new g(t.rect.x,t.rect.maxY-this.dropIndicatorThickness/2,t.rect.width,this.dropIndicatorThickness)}else i=t.rect;return new b("dropIndicator",e.key+":"+e.dropPosition,i)}constructor(e={}){super();var t;this.rowHeight=(t=e.rowHeight)!==null&&t!==void 0?t:null;var i;this.estimatedRowHeight=(i=e.estimatedRowHeight)!==null&&i!==void 0?i:null;var l;this.headingHeight=(l=e.headingHeight)!==null&&l!==void 0?l:null;var n;this.estimatedHeadingHeight=(n=e.estimatedHeadingHeight)!==null&&n!==void 0?n:null;var o;this.loaderHeight=(o=e.loaderHeight)!==null&&o!==void 0?o:null,this.dropIndicatorThickness=e.dropIndicatorThickness||2,this.gap=e.gap||0,this.padding=e.padding||0,this.layoutNodes=new Map,this.rootNodes=[],this.lastCollection=null,this.invalidateEverything=!1,this.validRect=new g,this.requestedRect=new g,this.contentSize=new $}}let S=null;function ce(s=!1){if(S===null||s){const e=document.createElement("div"),t=e.style;t.width="50px",t.height="50px",t.overflow="scroll",t.direction="rtl";const i=document.createElement("div"),l=i.style;return l.width="100px",l.height="100px",e.appendChild(i),document.body.appendChild(e),e.scrollLeft>0?S="positive-descending":(e.scrollLeft=1,e.scrollLeft===0?S="negative":S="positive-ascending"),document.body.removeChild(e),S}return S}function ue(s,e){let{scrollLeft:t}=s;if(e==="rtl"){let{scrollWidth:i,clientWidth:l}=s;switch(ce()){case"negative":t=-t;break;case"positive-descending":t=i-l-t;break}}return t}function fe(s,e){let{contentSize:t,onVisibleRectChange:i,innerStyle:l,onScrollStart:n,onScrollEnd:o,scrollDirection:a="both",...h}=s,r=c.useRef({scrollTop:0,scrollLeft:0,scrollEndTime:0,scrollTimeout:null,width:0,height:0,isScrolling:!1}).current,{direction:d}=K.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7(),[u,f]=c.useState(!1),v=c.useCallback(w=>{w.target===w.currentTarget&&(s.onScroll&&s.onScroll(w),E.flushSync(()=>{let m=w.currentTarget.scrollTop,z=ue(w.currentTarget,d);r.scrollTop=Math.max(0,Math.min(m,t.height-r.height)),r.scrollLeft=Math.max(0,Math.min(z,t.width-r.width)),i(new g(r.scrollLeft,r.scrollTop,r.width,r.height)),r.isScrolling||(r.isScrolling=!0,f(!0),window.dispatchEvent(new Event("tk.disconnect-observer")),n&&n());let C=Date.now();r.scrollEndTime<=C+50&&(r.scrollEndTime=C+300,r.scrollTimeout!=null&&clearTimeout(r.scrollTimeout),r.scrollTimeout=setTimeout(()=>{r.isScrolling=!1,f(!1),r.scrollTimeout=null,window.dispatchEvent(new Event("tk.connect-observer")),o&&o()},300))}))},[s,d,r,t,i,n,o]);Z.$e9faafb641e167db$export$90fc3a17d93f704c(e,"scroll",v),c.useEffect(()=>()=>{r.scrollTimeout!=null&&clearTimeout(r.scrollTimeout),r.isScrolling&&window.dispatchEvent(new Event("tk.connect-observer"))},[]);let y=c.useRef(!1),p=k.$8ae05eaa5c114e9c$export$7f54fc3180508a52(w=>{let m=e.current;if(!m||y.current)return;y.current=!0;let z=process.env.NODE_ENV==="test"&&!process.env.VIRT_ON,C=Object.getOwnPropertyNames(window.HTMLElement.prototype).includes("clientWidth"),G=Object.getOwnPropertyNames(window.HTMLElement.prototype).includes("clientHeight"),N=m.clientWidth,T=m.clientHeight,_=z&&!C?1/0:N,L=z&&!G?1/0:T;(r.width!==_||r.height!==L)&&(r.width=_,r.height=L,w(()=>{i(new g(r.scrollLeft,r.scrollTop,_,L))}),(!z&&N!==m.clientWidth||T!==m.clientHeight)&&(r.width=m.clientWidth,r.height=m.clientHeight,w(()=>{i(new g(r.scrollLeft,r.scrollTop,r.width,r.height))}))),y.current=!1}),H=c.useRef(null),[j,F]=c.useState({});k.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{if(!y.current&&(H.current==null||!t.equals(H.current)))if(typeof IS_REACT_ACT_ENVIRONMENT=="boolean"?IS_REACT_ACT_ENVIRONMENT:typeof jest<"u"){F({}),H.current=t;return}else queueMicrotask(()=>p(E.flushSync));H.current=t}),k.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{p(w=>w())},[j]);let U=c.useCallback(()=>{p(E.flushSync)},[p]);Q.$9daab02d461809db$export$683480f191c0e3ea({ref:e,box:"border-box",onResize:U});let I={padding:0,...h.style};return a==="horizontal"?(I.overflowX="auto",I.overflowY="hidden"):a==="vertical"||t.width===r.width?(I.overflowY="auto",I.overflowX="hidden"):I.overflow="auto",l={width:Number.isFinite(t.width)?t.width:void 0,height:Number.isFinite(t.height)?t.height:void 0,pointerEvents:u?"none":"auto",position:"relative",...l},{isScrolling:u,scrollViewProps:{...h,style:I},contentProps:{role:"presentation",style:l}}}function ge(s){let{layoutInfo:e,virtualizer:t,ref:i}=s,l=e==null?void 0:e.key,n=c.useCallback(()=>{if(l!=null&&i.current){let o=ye(i.current);t.updateItemSize(l,o)}},[t,l,i]);return k.$f0a04ccd8dbdd83b$export$e5c5a5f917a5871c(()=>{e!=null&&e.estimatedSize&&n()}),{updateSize:n}}function ye(s){let e=s.style.height;s.style.height="";let t=new $(s.scrollWidth,s.scrollHeight);return s.style.height=e,t}function Y(s){let{style:e,className:t,layoutInfo:i,virtualizer:l,parent:n,children:o}=s,{direction:a}=K.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7(),h=c.useRef(null);return ge({layoutInfo:i,virtualizer:l,ref:h}),c.createElement("div",{role:"presentation",ref:h,className:t,style:{...ve(i,a,n),...e}},o)}let O=new WeakMap;function ve(s,e,t){let i=e==="rtl"?"right":"left",l=O.get(s);if(l&&l[i]!=null){if(!t)return l;let h=s.rect.y-t.rect.y,r=s.rect.x-t.rect.x;if(l.top===h&&l[i]===r)return l}let n={top:s.rect.y-(t&&!(t.allowOverflow&&s.isSticky)?t.rect.y:0),[i]:s.rect.x-(t&&!(t.allowOverflow&&s.isSticky)?t.rect.x:0),width:s.rect.width,height:s.rect.height};Object.entries(n).forEach(([h,r])=>{Number.isFinite(r)||(n[h]=void 0)});var o;let a={position:s.isSticky?"sticky":"absolute",display:s.isSticky?"inline-block":void 0,overflow:s.allowOverflow?"visible":"hidden",opacity:s.opacity,zIndex:s.zIndex,transform:(o=s.transform)!==null&&o!==void 0?o:void 0,contain:"size layout style",...n};return O.set(s,a),a}const W=c.createContext(null),D=c.createContext(null);function pe(s){let{children:e,layout:t,layoutOptions:i}=s,l=c.useMemo(()=>typeof t=="function"?new t:t,[t]),n=c.useMemo(()=>({isVirtualized:!0,layoutDelegate:l,dropTargetDelegate:l.getDropTargetFromPoint?l:void 0,CollectionRoot:we,CollectionBranch:me}),[l]);return c.createElement(q.$7135fc7d473fd974$export$4feb769f8ddf26c5.Provider,{value:n},c.createElement(D.Provider,{value:{layout:l,layoutOptions:i}},e))}function we({collection:s,persistedKeys:e,scrollRef:t,renderDropIndicator:i}){var l;let{layout:n,layoutOptions:o}=c.useContext(D),a=(l=n.useLayoutOptions)===null||l===void 0?void 0:l.call(n),h=he({layout:n,collection:s,renderView:(d,u)=>{var f;return u==null||(f=u.render)===null||f===void 0?void 0:f.call(u,u)},onVisibleRectChange(d){let u=t==null?void 0:t.current;u&&(u.scrollLeft=d.x,u.scrollTop=d.y)},persistedKeys:e,layoutOptions:c.useMemo(()=>o&&a?{...o,...a}:o||a,[o,a])}),{contentProps:r}=fe({onVisibleRectChange:h.setVisibleRect,contentSize:h.contentSize,onScrollStart:h.startScrolling,onScrollEnd:h.endScrolling},t);return c.createElement("div",r,c.createElement(W.Provider,{value:h},X(null,h.visibleViews,i)))}function me({parent:s,renderDropIndicator:e}){let i=c.useContext(W).virtualizer.getVisibleView(s.key);return X(i,Array.from(i.children),e)}function X(s,e,t){return e.map(i=>be(s,i,t))}function be(s,e,t){let i=c.createElement(Y,{key:e.key,layoutInfo:e.layoutInfo,virtualizer:e.virtualizer,parent:s==null?void 0:s.layoutInfo},e.rendered),{collection:l,layout:n}=e.virtualizer,o=e.content;return(o==null?void 0:o.type)==="item"&&t&&n.getDropTargetLayoutInfo&&(i=c.createElement(c.Fragment,{key:e.key},P(s,e,{type:"item",key:e.content.key,dropPosition:"before"},t),i,q.$7135fc7d473fd974$export$2dbbd341daed716d(l,o,a=>P(s,e,a,t)))),i}function P(s,e,t,i){let l=i(t);if(l){let n=e.virtualizer.layout.getDropTargetLayoutInfo(t);l=c.createElement(Y,{layoutInfo:n,virtualizer:e.virtualizer,parent:s==null?void 0:s.layoutInfo},l)}return l}class xe extends de{getContentSize(){var t;const e=(t=this==null?void 0:this.virtualizer)==null?void 0:t.collection.getKeys();return Array.from(e||[]).forEach(i=>{this.getLayoutInfo(i)}),this.contentSize}}const Ie="_listBox_1k43m_4",Re="_listBoxPopover_1k43m_16",Se="_listBoxSectionHeading_1k43m_31",$e="_listBoxButton_1k43m_43",ze="_listBoxItem_1k43m_55",He="_listBoxLoadMoreItem_1k43m_167",A={listBox:Ie,listBoxPopover:Re,listBoxSectionHeading:Se,listBoxButton:$e,listBoxItem:ze,listBoxLoadMoreItem:He},Ce=({className:s,children:e,...t})=>M.jsx(pe,{layout:xe,layoutOptions:{headingHeight:38},children:M.jsx(J.$eed445e0843c11d0$export$41f133550aa26f48,{className:ee.clsx(A.listBox,s),...t,children:e})});exports.ListBox=Ce;exports.styles=A;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as K } from "react/jsx-runtime";
|
|
2
2
|
import { e as te } from "./ListBox-5GK4ZRj1.js";
|
|
3
3
|
import { g as ie, m as le } from "./Collection-BkxwF21i.js";
|
|
4
|
-
import m, { useState as z, useRef as
|
|
4
|
+
import m, { useState as z, useRef as k, useMemo as _, useCallback as C, useEffect as oe, createContext as W, useContext as D } from "react";
|
|
5
5
|
import { d as ne, $ as M } from "./mergeProps-Ct8m5-xW.js";
|
|
6
6
|
import { $ as X } from "./context-Dl_saGB6.js";
|
|
7
7
|
import { flushSync as V } from "react-dom";
|
|
@@ -388,7 +388,7 @@ class ye {
|
|
|
388
388
|
const ve = typeof document < "u" ? m.useLayoutEffect : () => {
|
|
389
389
|
};
|
|
390
390
|
function pe(s) {
|
|
391
|
-
let [e, t] = z(new f(0, 0, 0, 0)), [i, l] = z(!1), [o, n] = z({}), a =
|
|
391
|
+
let [e, t] = z(new f(0, 0, 0, 0)), [i, l] = z(!1), [o, n] = z({}), a = k(!1), [h] = z(() => new ye({
|
|
392
392
|
collection: s.collection,
|
|
393
393
|
layout: s.layout,
|
|
394
394
|
delegate: {
|
|
@@ -403,7 +403,7 @@ function pe(s) {
|
|
|
403
403
|
ve(() => {
|
|
404
404
|
a.current && (a.current = !1, s.onVisibleRectChange(e));
|
|
405
405
|
});
|
|
406
|
-
let r =
|
|
406
|
+
let r = _(() => s.layoutOptions != null ? {
|
|
407
407
|
...o,
|
|
408
408
|
layoutOptions: s.layoutOptions
|
|
409
409
|
} : o, [
|
|
@@ -417,12 +417,12 @@ function pe(s) {
|
|
|
417
417
|
visibleRect: e,
|
|
418
418
|
invalidationContext: r,
|
|
419
419
|
isScrolling: i
|
|
420
|
-
}), c = h.contentSize, u =
|
|
420
|
+
}), c = h.contentSize, u = C(() => {
|
|
421
421
|
l(!0);
|
|
422
|
-
}, []), y =
|
|
422
|
+
}, []), y = C(() => {
|
|
423
423
|
l(!1);
|
|
424
424
|
}, []);
|
|
425
|
-
return
|
|
425
|
+
return _(() => ({
|
|
426
426
|
virtualizer: h,
|
|
427
427
|
visibleViews: d,
|
|
428
428
|
setVisibleRect: t,
|
|
@@ -744,7 +744,7 @@ function be(s, e) {
|
|
|
744
744
|
return t;
|
|
745
745
|
}
|
|
746
746
|
function xe(s, e) {
|
|
747
|
-
let { contentSize: t, onVisibleRectChange: i, innerStyle: l, onScrollStart: o, onScrollEnd: n, scrollDirection: a = "both", ...h } = s, r =
|
|
747
|
+
let { contentSize: t, onVisibleRectChange: i, innerStyle: l, onScrollStart: o, onScrollEnd: n, scrollDirection: a = "both", ...h } = s, r = k({
|
|
748
748
|
scrollTop: 0,
|
|
749
749
|
scrollLeft: 0,
|
|
750
750
|
scrollEndTime: 0,
|
|
@@ -752,7 +752,7 @@ function xe(s, e) {
|
|
|
752
752
|
width: 0,
|
|
753
753
|
height: 0,
|
|
754
754
|
isScrolling: !1
|
|
755
|
-
}).current, { direction: d } = X(), [c, u] = z(!1), y =
|
|
755
|
+
}).current, { direction: d } = X(), [c, u] = z(!1), y = C((p) => {
|
|
756
756
|
p.target === p.currentTarget && (s.onScroll && s.onScroll(p), V(() => {
|
|
757
757
|
let w = p.currentTarget.scrollTop, H = be(p.currentTarget, d);
|
|
758
758
|
r.scrollTop = Math.max(0, Math.min(w, t.height - r.height)), r.scrollLeft = Math.max(0, Math.min(H, t.width - r.width)), i(new f(r.scrollLeft, r.scrollTop, r.width, r.height)), r.isScrolling || (r.isScrolling = !0, u(!0), window.dispatchEvent(new Event("tk.disconnect-observer")), o && o());
|
|
@@ -773,7 +773,7 @@ function xe(s, e) {
|
|
|
773
773
|
re(e, "scroll", y), oe(() => () => {
|
|
774
774
|
r.scrollTimeout != null && clearTimeout(r.scrollTimeout), r.isScrolling && window.dispatchEvent(new Event("tk.connect-observer"));
|
|
775
775
|
}, []);
|
|
776
|
-
let g =
|
|
776
|
+
let g = k(!1), v = ne((p) => {
|
|
777
777
|
let w = e.current;
|
|
778
778
|
if (!w || g.current) return;
|
|
779
779
|
g.current = !0;
|
|
@@ -783,7 +783,7 @@ function xe(s, e) {
|
|
|
783
783
|
}), (!H && O !== w.clientWidth || P !== w.clientHeight) && (r.width = w.clientWidth, r.height = w.clientHeight, p(() => {
|
|
784
784
|
i(new f(r.scrollLeft, r.scrollTop, r.width, r.height));
|
|
785
785
|
}))), g.current = !1;
|
|
786
|
-
}), L =
|
|
786
|
+
}), L = k(null), [J, Q] = z({});
|
|
787
787
|
M(() => {
|
|
788
788
|
if (!g.current && (L.current == null || !t.equals(L.current)))
|
|
789
789
|
if (typeof IS_REACT_ACT_ENVIRONMENT == "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest < "u") {
|
|
@@ -796,7 +796,7 @@ function xe(s, e) {
|
|
|
796
796
|
}, [
|
|
797
797
|
J
|
|
798
798
|
]);
|
|
799
|
-
let Z =
|
|
799
|
+
let Z = C(() => {
|
|
800
800
|
v(V);
|
|
801
801
|
}, [
|
|
802
802
|
v
|
|
@@ -830,7 +830,7 @@ function xe(s, e) {
|
|
|
830
830
|
};
|
|
831
831
|
}
|
|
832
832
|
function Ie(s) {
|
|
833
|
-
let { layoutInfo: e, virtualizer: t, ref: i } = s, l = e == null ? void 0 : e.key, o =
|
|
833
|
+
let { layoutInfo: e, virtualizer: t, ref: i } = s, l = e == null ? void 0 : e.key, o = C(() => {
|
|
834
834
|
if (l != null && i.current) {
|
|
835
835
|
let n = Re(i.current);
|
|
836
836
|
t.updateItemSize(l, n);
|
|
@@ -853,7 +853,7 @@ function Re(s) {
|
|
|
853
853
|
return s.style.height = e, t;
|
|
854
854
|
}
|
|
855
855
|
function F(s) {
|
|
856
|
-
let { style: e, className: t, layoutInfo: i, virtualizer: l, parent: o, children: n } = s, { direction: a } = X(), h =
|
|
856
|
+
let { style: e, className: t, layoutInfo: i, virtualizer: l, parent: o, children: n } = s, { direction: a } = X(), h = k(null);
|
|
857
857
|
return Ie({
|
|
858
858
|
layoutInfo: i,
|
|
859
859
|
virtualizer: l,
|
|
@@ -905,9 +905,9 @@ function Se(s, e, t) {
|
|
|
905
905
|
}
|
|
906
906
|
const j = /* @__PURE__ */ W(null), U = /* @__PURE__ */ W(null);
|
|
907
907
|
function ze(s) {
|
|
908
|
-
let { children: e, layout: t, layoutOptions: i } = s, l =
|
|
908
|
+
let { children: e, layout: t, layoutOptions: i } = s, l = _(() => typeof t == "function" ? new t() : t, [
|
|
909
909
|
t
|
|
910
|
-
]), o =
|
|
910
|
+
]), o = _(() => ({
|
|
911
911
|
isVirtualized: !0,
|
|
912
912
|
layoutDelegate: l,
|
|
913
913
|
dropTargetDelegate: l.getDropTargetFromPoint ? l : void 0,
|
|
@@ -939,7 +939,7 @@ function $e({ collection: s, persistedKeys: e, scrollRef: t, renderDropIndicator
|
|
|
939
939
|
c && (c.scrollLeft = d.x, c.scrollTop = d.y);
|
|
940
940
|
},
|
|
941
941
|
persistedKeys: e,
|
|
942
|
-
layoutOptions:
|
|
942
|
+
layoutOptions: _(() => n && a ? {
|
|
943
943
|
...n,
|
|
944
944
|
...a
|
|
945
945
|
} : n || a, [
|
|
@@ -961,9 +961,9 @@ function He({ parent: s, renderDropIndicator: e }) {
|
|
|
961
961
|
return G(i, Array.from(i.children), e);
|
|
962
962
|
}
|
|
963
963
|
function G(s, e, t) {
|
|
964
|
-
return e.map((i) =>
|
|
964
|
+
return e.map((i) => ke(s, i, t));
|
|
965
965
|
}
|
|
966
|
-
function
|
|
966
|
+
function ke(s, e, t) {
|
|
967
967
|
let i = /* @__PURE__ */ m.createElement(F, {
|
|
968
968
|
key: e.key,
|
|
969
969
|
layoutInfo: e.layoutInfo,
|
|
@@ -990,7 +990,7 @@ function Y(s, e, t, i) {
|
|
|
990
990
|
}
|
|
991
991
|
return l;
|
|
992
992
|
}
|
|
993
|
-
class
|
|
993
|
+
class _e extends me {
|
|
994
994
|
/**
|
|
995
995
|
* When using the ListLayout our scroll container height is not calculated properly when the content is partially sectioned.
|
|
996
996
|
* ```ts
|
|
@@ -1015,8 +1015,8 @@ class Ce extends me {
|
|
|
1015
1015
|
}), this.contentSize;
|
|
1016
1016
|
}
|
|
1017
1017
|
}
|
|
1018
|
-
const
|
|
1019
|
-
listBox:
|
|
1018
|
+
const Ce = "_listBox_1k43m_4", Le = "_listBoxPopover_1k43m_16", Ee = "_listBoxSectionHeading_1k43m_31", Ne = "_listBoxButton_1k43m_43", Te = "_listBoxItem_1k43m_55", Ve = "_listBoxLoadMoreItem_1k43m_167", Me = {
|
|
1019
|
+
listBox: Ce,
|
|
1020
1020
|
listBoxPopover: Le,
|
|
1021
1021
|
listBoxSectionHeading: Ee,
|
|
1022
1022
|
listBoxButton: Ne,
|
|
@@ -1029,7 +1029,7 @@ const ke = "_listBox_13mbb_4", Le = "_listBoxPopover_13mbb_16", Ee = "_listBoxSe
|
|
|
1029
1029
|
}) => /* @__PURE__ */ K(
|
|
1030
1030
|
ze,
|
|
1031
1031
|
{
|
|
1032
|
-
layout:
|
|
1032
|
+
layout: _e,
|
|
1033
1033
|
layoutOptions: {
|
|
1034
1034
|
headingHeight: 38
|
|
1035
1035
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const t=require("react/jsx-runtime"),r=require("./clsx-DKOfLqne.cjs"),n=require("./ListBox-
|
|
1
|
+
"use strict";const t=require("react/jsx-runtime"),r=require("./clsx-DKOfLqne.cjs"),n=require("./ListBox-2wZ6XOeD.cjs"),c=require("./ListBox-FD30iELk.cjs"),l=require("./Spinner-DIapnvIz.cjs"),d=require("./useLocalizedStringFormatter-BSac43NO.cjs"),x=({className:s,children:e,...o})=>t.jsx("button",{type:"button",className:r.clsx(n.styles.listBoxItem,n.styles.listBoxButton,s),...o,children:e}),u={"loading...":"Loading..."},m={"loading...":"Laddar..."},L={en:u,sv:m},B=({className:s,children:e,isLoading:o,...i})=>{const a=d.useLocalizedStringFormatter(L);return t.jsx(c.$eed445e0843c11d0$export$8e6d031a08cf56a1,{className:r.clsx(n.styles.listBoxLoadMoreItem,s),isLoading:o,...i,children:e||t.jsxs(t.Fragment,{children:[t.jsx(l.Spinner,{small:!0}),t.jsx("span",{"aria-hidden":!0,children:a.format("loading...")})]})})};exports.ListBoxButton=x;exports.ListBoxLoadMoreItem=B;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as t, jsxs as m, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { c as e } from "./clsx-jbLnTBqA.js";
|
|
3
|
-
import { s as a } from "./ListBox-
|
|
3
|
+
import { s as a } from "./ListBox-Der0Te-R.js";
|
|
4
4
|
import { $ as c } from "./ListBox-5GK4ZRj1.js";
|
|
5
5
|
import { S as l } from "./Spinner-D6Fcu_Dp.js";
|
|
6
6
|
import { u as p } from "./useLocalizedStringFormatter-aOhh7wdl.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const o=require("react/jsx-runtime"),r=require("./ListBox-FD30iELk.cjs"),c=require("./clsx-DKOfLqne.cjs"),i=require("./ListBox-
|
|
1
|
+
"use strict";const o=require("react/jsx-runtime"),r=require("./ListBox-FD30iELk.cjs"),c=require("./clsx-DKOfLqne.cjs"),i=require("./ListBox-2wZ6XOeD.cjs"),n=require("./Dialog-DycTLpdr.cjs"),l=require("./Separator-DCi4bnBr.cjs"),d=({children:s,className:e,hideSelectionIndicator:t,...a})=>o.jsx(r.$eed445e0843c11d0$export$a11e76429ed99b4,{className:c.clsx(i.styles.listBoxItem,e),"data-show-selection":!t||void 0,...a,children:s}),B=({className:s,children:e,...t})=>o.jsx(n.$07b14b47974efb58$export$5b6b19405a83ff9d,{className:c.clsx(s,i.styles.listBoxPopover),offset:0,...t,children:e}),x=({className:s,...e})=>o.jsx(l.$72a5793c14baf454$export$8b251419efc915eb,{className:c.clsx(i.styles.listBoxSectionHeading,s),...e}),$=({children:s,name:e,...t})=>o.jsxs(r.$eed445e0843c11d0$export$dca12b0bb56e4fc,{...t,children:[e&&o.jsx(x,{children:e}),s]});exports.ListBoxHeader=x;exports.ListBoxItem=d;exports.ListBoxPopover=B;exports.ListBoxSection=$;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
2
2
|
import { a as m, b } from "./ListBox-5GK4ZRj1.js";
|
|
3
3
|
import { c as a } from "./clsx-jbLnTBqA.js";
|
|
4
|
-
import { s as r } from "./ListBox-
|
|
4
|
+
import { s as r } from "./ListBox-Der0Te-R.js";
|
|
5
5
|
import { b as x } from "./Dialog-D4Py85wi.js";
|
|
6
6
|
import { $ as f } from "./Separator-CQfDz_zr.js";
|
|
7
7
|
const h = ({
|
|
@@ -7,8 +7,8 @@ import { a as R, $ as G, T as W } from "./Tag-DX1X_NZE.js";
|
|
|
7
7
|
import { $ as H } from "./TextField-DyR61bjZ.js";
|
|
8
8
|
import { c as U } from "./Collection-BkxwF21i.js";
|
|
9
9
|
import { C as I } from "./Checkbox-CdN1D5pD.js";
|
|
10
|
-
import { L as q } from "./ListBox-
|
|
11
|
-
import { b as X, L as J, a as Q } from "./ListBoxSection-
|
|
10
|
+
import { L as q } from "./ListBox-Der0Te-R.js";
|
|
11
|
+
import { b as X, L as J, a as Q } from "./ListBoxSection-D9EUOerv.js";
|
|
12
12
|
import { C as Y } from "./check-B5h1DvDs.js";
|
|
13
13
|
import { d as Z } from "./useHover-DkC5FyNd.js";
|
|
14
14
|
import { p as ee, q as te } from "./Dialog-D4Py85wi.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./assets/Select2.css');const r=require("react/jsx-runtime"),g=require("react"),q=require("./clsx-DKOfLqne.cjs"),E=require("./utils-CtICjCYt.cjs"),S=require("./Tag-BL-_PONN.cjs"),R=require("./TextField-DtD9-arA.cjs"),H=require("./Collection-vGO6v3_U.cjs"),I=require("./Checkbox-BgrLxY6P.cjs"),G=require("./ListBox-u6ZXp5Yi.cjs"),C=require("./ListBoxSection-CBlpg0AG.cjs"),W=require("./check-B0aKTFe5.cjs"),U=require("./useHover-DULSfLuK.cjs"),M=require("./Dialog-DycTLpdr.cjs"),K=require("./ListKeyboardDelegate-8zuIfwQ7.cjs"),X=require("./SelectionManager-CNJmHeCF.cjs"),$=require("./mergeProps-Du5A8xi8.cjs"),J=require("./filterDOMProps-RRlKPKX0.cjs"),Q=require("./useField-DvszkIMx.cjs"),j=require("./useFormValidation-DV2Ioblb.cjs"),Y=require("./useListState-DZFWpD-x.cjs"),Z=require("./VisuallyHidden-BMelU6B0.cjs"),P=require("./Label-DpY2SZdQ.cjs"),ee=require("./Text-D5OSv6Uv.cjs"),te=require("./x-rV-nu490.cjs"),N=require("./useLocalizedStringFormatter-BSac43NO.cjs"),le=require("./useButton-C0r5nrqs.cjs"),ne=require("./chevron-down-5hFlg_lR.cjs"),k=require("./FieldError-JWxR_EqN.cjs");function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const F=re(g);function T(e){return null}T.getCollectionNode=function*(t,i){let{childItems:o,title:l,children:s}=t,n=t.title||t.children,a=t.textValue||(typeof n=="string"?n:"")||t["aria-label"]||"";!a&&!(i!=null&&i.suppressTextValueWarning)&&process.env.NODE_ENV!=="production"&&console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop."),yield{type:"item",props:t,rendered:n,textValue:a,"aria-label":t["aria-label"],hasChildNodes:ie(t),*childNodes(){if(o)for(let c of o)yield{type:"item",value:c};else if(l){let c=[];g.Children.forEach(s,u=>{c.push({type:"item",element:u})}),yield*c}}}};function ie(e){return e.hasChildItems!=null?e.hasChildItems:!!(e.childItems||e.title&&g.Children.count(e.children)>0)}let V=T;function A(e){return null}A.getCollectionNode=function*(t){let{children:i,title:o,items:l}=t;yield{type:"section",props:t,hasChildNodes:!0,rendered:o,"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 s of l)yield{type:"item",value:s,renderer:i}}else{let s=[];g.Children.forEach(i,n=>{s.push({type:"item",element:n})}),yield*s}}}};let oe=A;const se="_wrapper_1rw0v_7",ce="_trigger_1rw0v_18",ae="_medium_1rw0v_32",de="_icon_1rw0v_68",ue="_tagGroup_1rw0v_74",fe="_listBoxItemCheckmark_1rw0v_90",be="_triggerContainer_1rw0v_95",he="_selectValueTag_1rw0v_101",ge="_clearButton_1rw0v_117",xe="_truncate_1rw0v_129",me="_checkboxContainer_1rw0v_166",ye="_selectAll_1rw0v_172",h={wrapper:se,trigger:ce,medium:ae,icon:de,tagGroup:ue,listBoxItemCheckmark:fe,triggerContainer:be,selectValueTag:he,clearButton:ge,truncate:xe,checkboxContainer:me,selectAll:ye},z=({item:e})=>r.jsx(C.ListBoxItem,{...e.value,textValue:e.textValue,"aria-label":e.textValue,hideSelectionIndicator:!0,children:({isDisabled:t,isSelected:i,selectionMode:o})=>r.jsxs(r.Fragment,{children:[o==="multiple"?r.jsx("div",{className:h.checkboxContainer,"aria-hidden":!0,children:r.jsx(I.Checkbox,{isDisabled:t,isSelected:i,isReadOnly:!0,excludeFromTabOrder:!0,"aria-label":e.textValue})}):null,e.rendered,i&&o==="single"?r.jsx(W.Check,{size:20,className:h.listBoxItemCheckmark}):null]})}),pe=({section:e,state:t})=>r.jsx(C.ListBoxSection,{...e.value,children:t.collection.getChildren?r.jsx(H.$e1995378a142960e$export$fb8073518f34e6ec,{items:t.collection.getChildren(e.key),children:i=>r.jsx(z,{item:i})}):null}),$e=({state:e,...t})=>r.jsx(G.ListBox,{...t,...e,escapeKeyBehavior:"none",onSelectionChange:e.setSelectedKeys,items:e.collection,children:i=>i.type==="section"?r.jsx(pe,{state:e,section:i}):r.jsx(z,{item:i})});function ve(e,t,i){const{disallowEmptySelection:o,isDisabled:l}=e,s=K.$325a3faab7a68acd$export$a16aca283550c30d({usage:"search",sensitivity:"base"}),n=g.useMemo(()=>new K.$2a25aae57d74318e$export$a05409b8bb224a5a(t.collection,t.disabledKeys,null,s),[t.collection,t.disabledKeys,s]),{menuTriggerProps:a,menuProps:c}=M.$168583247155ddda$export$dc9c12ed27dd1b49({isDisabled:l,type:"listbox"},t,i),u=f=>{const{selectedKeys:v,selectionMode:L}=t,_=v.values().next().value;if(L==="single")switch(f.key){case"ArrowLeft":{f.preventDefault();const p=v.size>0?n.getKeyAbove(_):n.getFirstKey();p&&t.setSelectedKeys([p]);break}case"ArrowRight":{f.preventDefault();const p=v.size>0?n.getKeyBelow(_):n.getFirstKey();p&&t.setSelectedKeys([p]);break}}},{typeSelectProps:d}=X.$fb3050f43d946246$export$e32c88dfddc6e1d8({keyboardDelegate:n,selectionManager:t.selectionManager,onTypeSelect(f){t.setSelectedKeys([f])}}),{labelProps:y,fieldProps:x}=Q.$2baaea4c71418dea$export$294aa081a6c6f55d({...e,labelElementType:"span"});d.onKeyDown=d.onKeyDownCapture,delete d.onKeyDownCapture;const b=J.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),m=$.$3ef42575df84b30b$export$9d1611c77c2fe928(d,a,x),w=$.$bdb11010cef70236$export$f680877a34711e37();return{labelProps:{...y,onClick:()=>{var f;e.isDisabled||((f=i.current)==null||f.focus(),U.$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard"))}},triggerProps:$.$3ef42575df84b30b$export$9d1611c77c2fe928(b,{...m,onKeyDown:$.$ff5963eb1fccf552$export$e08e3b67e392101e(m.onKeyDown,u,e.onKeyDown),onKeyUp:e.onKeyUp,"aria-labelledby":[m["aria-labelledby"],m["aria-label"]&&!m["aria-labelledby"]?m.id:null,w].filter(Boolean).join(" "),onFocus(f){t.isFocused||(e.onFocus&&e.onFocus(f),t.setFocused(!0))},onBlur(f){t.isOpen||(e.onBlur&&e.onBlur(f),t.setFocused(!1))}}),valueProps:{id:w},menuProps:{...c,disallowEmptySelection:o,autoFocus:t.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,onBlur:f=>{f.currentTarget.contains(f.relatedTarget)||(e.onBlur&&e.onBlur(f),t.setFocused(!1))},"aria-labelledby":[x["aria-labelledby"],m["aria-label"]&&!x["aria-labelledby"]?m.id:null].filter(Boolean).join(" ")}}}function Se(e){const{collection:t,disabledKeys:i,selectionManager:o,selectionManager:{setSelectedKeys:l,selectedKeys:s,selectionMode:n}}=Y.$e72dd72e1c76a225$export$2f645645f7bca764(e),a=[],c=s.size!==0?Array.from(s).map(u=>{const d=t.getItem(u);return d||a.push(u),d}).filter(Boolean):null;return a.length&&console.warn(`Select: Keys "${a.join(", ")}" passed to "selectedKeys" are not present in the collection.`),{collection:t,disabledKeys:i,selectionManager:o,selectionMode:n,selectedKeys:s,setSelectedKeys:l.bind(o),selectedItems:c}}function je(e){const[t,i]=g.useState(!1),o=M.$a28c903ee9ad8dc5$export$79fefeb1c2091ac3(e),l=e.selectionMode==="single",s=Se({...e,onSelectionChange:d=>{e.onSelectionChange&&e.onSelectionChange(d),l&&o.close()}}),n=j.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,validationBehavior:"native",value:s.selectedKeys}),a=s.collection.size===0,c=!!s.selectedKeys.size,u=g.useCallback(()=>{n.resetValidation(),n.commitValidation()},[n]);return g.useEffect(()=>{l&&c&&u()},[c,l,u]),{...s,...o,close(){o.close(),c&&u()},open(){a||o.open()},toggle(d){a||o.toggle(d)},isFocused:t,setFocused:i,...n}}function Ce(e,t={}){const[i,o]=g.useState({width:0,height:0}),l=t.delay===void 0?500:t.delay,s=!!t.includePadding;return g.useEffect(()=>{if(!e)return;const n=new ResizeObserver(we(([a])=>{const{inlineSize:c,blockSize:u}=s?a.borderBoxSize[0]:a.contentBoxSize[0];o({width:c,height:u})},l));return n.observe(e),()=>{n.disconnect()}},[l,e,s]),i}function we(e,t){let i;return(o,l)=>{clearTimeout(i),i=setTimeout(()=>{e(o,l)},t)}}function _e({autoComplete:e,name:t,isDisabled:i,isRequired:o,selectRef:l},s,n){const{visuallyHiddenProps:a}=Z.$5c3e21d68f1c4674$export$a966af930f325cab();return j.$99facab73266f662$export$5add1d006293d136(l,s.selectedKeys,s.setSelectedKeys),j.$e93e671b31057976$export$b8473d3665f3a75a({validationBehavior:"native",focus:()=>{var c;return(c=n.current)==null?void 0:c.focus()}},s,l),{containerProps:{...a,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":"aria-hidden-focus"},inputProps:{style:{display:"none"}},selectProps:{tabIndex:-1,autoComplete:e,disabled:i,required:o,name:t,value:Array.from(s.selectedKeys).map(c=>c.toString()),onChange:c=>s.setSelectedKeys(c.target.value),multiple:!0}}}function Ke(e){const{state:t,triggerRef:i,name:o,isDisabled:l}=e,s=`${e.label}-hidden`,n=g.useRef(null),{containerProps:a,selectProps:c}=_e({...e,selectRef:n},t,i);return t.collection.size<=300?r.jsx("div",{...a,"data-testid":"hidden-select-container",children:r.jsxs("label",{children:[s,r.jsxs("select",{...c,ref:n,children:[r.jsx("option",{}),[...t.collection.getKeys()].map(u=>{const d=t.collection.getItem(u);return d&&d.type==="item"?r.jsx("option",{value:d.key,children:d.textValue},d.key):null})]})]})}):o?r.jsx("input",{type:"hidden",autoComplete:c.autoComplete,name:o,disabled:l,value:Array.from(t.selectedKeys).map(u=>u.toString())??[""]}):null}const Pe={clearAll:"Clear all",selectAll:"Select all",selectedItems:"Selected items",chosen:"chosen"},ke={clearAll:"Rensa alla",selectAll:"Välj alla",selectedItems:"Valda objekt",chosen:"valda"},D={en:Pe,sv:ke},Ve=({state:{selectedItems:e},isDisabled:t,parentWidth:i,onClear:o,triggerRef:l,isClearable:s})=>{const n=N.useLocalizedStringFormatter(D);return r.jsxs("div",{className:h.selectValueTag,"data-disabled":t||void 0,children:[r.jsx("span",{className:h.truncate,style:{maxWidth:i-92},children:e!=null&&e.length&&e.length>1?`${e.length} ${n.format("chosen")}`:e==null?void 0:e[0].textValue}),s&&r.jsx("button",{disabled:t,"aria-label":n.format("clearAll"),className:h.clearButton,onClick:()=>{var a;o(),(a=l==null?void 0:l.current)==null||a.focus()},children:r.jsx(te.X,{width:20,height:20})})]})},Be=({autoFocus:e,excludeFromTabOrder:t,isDisabled:i,size:o="large",isOpen:l,isInvalid:s,selectionMode:n,state:{selectedItems:a},placeholder:c,children:u,triggerRef:d,...y})=>{const{buttonProps:x}=le.$701a24aa0da5b062$export$ea18c227d4417cc3({autoFocus:e,excludeFromTabOrder:t,isDisabled:i,...y},d),b=n==="multiple";return r.jsxs("div",{className:h.triggerContainer,"data-disabled":i||void 0,children:[r.jsxs("button",{...x,autoFocus:e,className:q.clsx(h.trigger,{[h.medium]:o==="medium"}),"data-disabled":i||void 0,"data-invalid":s||void 0,"data-open":l||void 0,ref:d,type:"button",children:[b&&!a?r.jsx("span",{children:c}):null,b?null:r.jsx("span",{children:a?a[0].textValue:c}),r.jsx("div",{className:h.icon,"aria-hidden":"true",children:r.jsx(ne.ChevronDown,{size:20})})]}),u]})},B=({state:e,errorMessage:t})=>r.jsx(k.$ee014567cb39d3f0$export$ff05c3ac10437e03.Provider,{value:{...e.displayValidation},children:r.jsx(k.FieldError,{children:t})}),qe=F.forwardRef(({isClearable:e=!0,popover:t,...i},o)=>{const l={selectionMode:"single",errorPosition:"top",disallowEmptySelection:!e,isClearable:e,size:"large",popover:t,...i},s=E.$df56164dff5785e2$export$4338b53315abf666(o),n=je(l),a=N.useLocalizedStringFormatter(D),{labelProps:c,triggerProps:u,valueProps:d,menuProps:y}=ve(l,n,s),{width:x}=Ce(s.current,{includePadding:!0});return r.jsxs(R.$bcdf0525bf22703d$export$2c73285ae9390cec,{...l,className:q.clsx(h.wrapper,l.className),children:[r.jsx(Ke,{...l,state:n,triggerRef:s}),r.jsx(P.LabelWrapper,{popover:t,children:l.label&&r.jsx(P.Label,{...c,"data-disabled":l.isDisabled||void 0,children:l.label})}),l.description&&r.jsx(ee.Text,{slot:"description",children:l.description}),l.errorPosition==="top"&&r.jsx(B,{...l,state:n}),r.jsx(Be,{...l,...u,isInvalid:n.displayValidation.isInvalid,triggerRef:s,state:n,children:l.selectionMode==="multiple"&&n.selectedItems?r.jsx("span",{...d,children:r.jsx(Ve,{...l,state:n,parentWidth:x,onClear:()=>n.selectionManager.clearSelection(),triggerRef:s})}):null}),l.errorPosition==="bottom"&&r.jsx(B,{...l,state:n}),r.jsxs(C.ListBoxPopover,{isOpen:n.isOpen,onOpenChange:b=>{b||n.close()},triggerRef:s,style:{width:x},children:[l.isSelectableAll&&r.jsx(I.Checkbox,{isSelected:n.selectionManager.isSelectAll,isIndeterminate:!n.selectionManager.isSelectAll&&!n.selectionManager.isEmpty,className:h.selectAll,onChange:()=>n.selectionManager.toggleSelectAll(),children:a.format("selectAll")}),r.jsx($e,{...y,state:n})]}),l.showTags&&!!n.selectedItems&&r.jsx(S.TagGroup,{"aria-label":a.format("selectedItems"),selectionBehavior:"toggle",onRemove:b=>n.selectionManager.toggleSelection(Array.from(b)[0]),className:h.tagGroup,children:r.jsx(S.$eaf9e70818b436db$export$f9fef0f55402315b,{items:n.selectedItems,children:b=>r.jsx(S.Tag,{textValue:b.textValue,id:b.key,dismissable:!0,isDisabled:l.isDisabled,children:b.textValue},b.key)})})]})}),O=F.forwardRef(({options:e,...t},i)=>r.jsx(qe,{...t,items:e,ref:i,children:o=>o.children?r.jsx(oe,{items:o.children,title:o.name,children:l=>r.jsx(V,{textValue:l.textValue,children:l.name})},o.name):r.jsx(V,{textValue:o.textValue,children:o.name})}));O.displayName="Select";exports.Select=O;
|
|
1
|
+
"use strict";require('./assets/Select2.css');const r=require("react/jsx-runtime"),g=require("react"),q=require("./clsx-DKOfLqne.cjs"),E=require("./utils-CtICjCYt.cjs"),S=require("./Tag-BL-_PONN.cjs"),R=require("./TextField-DtD9-arA.cjs"),H=require("./Collection-vGO6v3_U.cjs"),I=require("./Checkbox-BgrLxY6P.cjs"),G=require("./ListBox-2wZ6XOeD.cjs"),C=require("./ListBoxSection-C_PqDyMP.cjs"),W=require("./check-B0aKTFe5.cjs"),U=require("./useHover-DULSfLuK.cjs"),M=require("./Dialog-DycTLpdr.cjs"),K=require("./ListKeyboardDelegate-8zuIfwQ7.cjs"),X=require("./SelectionManager-CNJmHeCF.cjs"),$=require("./mergeProps-Du5A8xi8.cjs"),J=require("./filterDOMProps-RRlKPKX0.cjs"),Q=require("./useField-DvszkIMx.cjs"),j=require("./useFormValidation-DV2Ioblb.cjs"),Y=require("./useListState-DZFWpD-x.cjs"),Z=require("./VisuallyHidden-BMelU6B0.cjs"),P=require("./Label-DpY2SZdQ.cjs"),ee=require("./Text-D5OSv6Uv.cjs"),te=require("./x-rV-nu490.cjs"),N=require("./useLocalizedStringFormatter-BSac43NO.cjs"),le=require("./useButton-C0r5nrqs.cjs"),ne=require("./chevron-down-5hFlg_lR.cjs"),k=require("./FieldError-JWxR_EqN.cjs");function re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const i in e)if(i!=="default"){const o=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,o.get?o:{enumerable:!0,get:()=>e[i]})}}return t.default=e,Object.freeze(t)}const F=re(g);function T(e){return null}T.getCollectionNode=function*(t,i){let{childItems:o,title:l,children:s}=t,n=t.title||t.children,a=t.textValue||(typeof n=="string"?n:"")||t["aria-label"]||"";!a&&!(i!=null&&i.suppressTextValueWarning)&&process.env.NODE_ENV!=="production"&&console.warn("<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop."),yield{type:"item",props:t,rendered:n,textValue:a,"aria-label":t["aria-label"],hasChildNodes:ie(t),*childNodes(){if(o)for(let c of o)yield{type:"item",value:c};else if(l){let c=[];g.Children.forEach(s,u=>{c.push({type:"item",element:u})}),yield*c}}}};function ie(e){return e.hasChildItems!=null?e.hasChildItems:!!(e.childItems||e.title&&g.Children.count(e.children)>0)}let V=T;function A(e){return null}A.getCollectionNode=function*(t){let{children:i,title:o,items:l}=t;yield{type:"section",props:t,hasChildNodes:!0,rendered:o,"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 s of l)yield{type:"item",value:s,renderer:i}}else{let s=[];g.Children.forEach(i,n=>{s.push({type:"item",element:n})}),yield*s}}}};let oe=A;const se="_wrapper_1rw0v_7",ce="_trigger_1rw0v_18",ae="_medium_1rw0v_32",de="_icon_1rw0v_68",ue="_tagGroup_1rw0v_74",fe="_listBoxItemCheckmark_1rw0v_90",be="_triggerContainer_1rw0v_95",he="_selectValueTag_1rw0v_101",ge="_clearButton_1rw0v_117",xe="_truncate_1rw0v_129",me="_checkboxContainer_1rw0v_166",ye="_selectAll_1rw0v_172",h={wrapper:se,trigger:ce,medium:ae,icon:de,tagGroup:ue,listBoxItemCheckmark:fe,triggerContainer:be,selectValueTag:he,clearButton:ge,truncate:xe,checkboxContainer:me,selectAll:ye},z=({item:e})=>r.jsx(C.ListBoxItem,{...e.value,textValue:e.textValue,"aria-label":e.textValue,hideSelectionIndicator:!0,children:({isDisabled:t,isSelected:i,selectionMode:o})=>r.jsxs(r.Fragment,{children:[o==="multiple"?r.jsx("div",{className:h.checkboxContainer,"aria-hidden":!0,children:r.jsx(I.Checkbox,{isDisabled:t,isSelected:i,isReadOnly:!0,excludeFromTabOrder:!0,"aria-label":e.textValue})}):null,e.rendered,i&&o==="single"?r.jsx(W.Check,{size:20,className:h.listBoxItemCheckmark}):null]})}),pe=({section:e,state:t})=>r.jsx(C.ListBoxSection,{...e.value,children:t.collection.getChildren?r.jsx(H.$e1995378a142960e$export$fb8073518f34e6ec,{items:t.collection.getChildren(e.key),children:i=>r.jsx(z,{item:i})}):null}),$e=({state:e,...t})=>r.jsx(G.ListBox,{...t,...e,escapeKeyBehavior:"none",onSelectionChange:e.setSelectedKeys,items:e.collection,children:i=>i.type==="section"?r.jsx(pe,{state:e,section:i}):r.jsx(z,{item:i})});function ve(e,t,i){const{disallowEmptySelection:o,isDisabled:l}=e,s=K.$325a3faab7a68acd$export$a16aca283550c30d({usage:"search",sensitivity:"base"}),n=g.useMemo(()=>new K.$2a25aae57d74318e$export$a05409b8bb224a5a(t.collection,t.disabledKeys,null,s),[t.collection,t.disabledKeys,s]),{menuTriggerProps:a,menuProps:c}=M.$168583247155ddda$export$dc9c12ed27dd1b49({isDisabled:l,type:"listbox"},t,i),u=f=>{const{selectedKeys:v,selectionMode:L}=t,_=v.values().next().value;if(L==="single")switch(f.key){case"ArrowLeft":{f.preventDefault();const p=v.size>0?n.getKeyAbove(_):n.getFirstKey();p&&t.setSelectedKeys([p]);break}case"ArrowRight":{f.preventDefault();const p=v.size>0?n.getKeyBelow(_):n.getFirstKey();p&&t.setSelectedKeys([p]);break}}},{typeSelectProps:d}=X.$fb3050f43d946246$export$e32c88dfddc6e1d8({keyboardDelegate:n,selectionManager:t.selectionManager,onTypeSelect(f){t.setSelectedKeys([f])}}),{labelProps:y,fieldProps:x}=Q.$2baaea4c71418dea$export$294aa081a6c6f55d({...e,labelElementType:"span"});d.onKeyDown=d.onKeyDownCapture,delete d.onKeyDownCapture;const b=J.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),m=$.$3ef42575df84b30b$export$9d1611c77c2fe928(d,a,x),w=$.$bdb11010cef70236$export$f680877a34711e37();return{labelProps:{...y,onClick:()=>{var f;e.isDisabled||((f=i.current)==null||f.focus(),U.$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard"))}},triggerProps:$.$3ef42575df84b30b$export$9d1611c77c2fe928(b,{...m,onKeyDown:$.$ff5963eb1fccf552$export$e08e3b67e392101e(m.onKeyDown,u,e.onKeyDown),onKeyUp:e.onKeyUp,"aria-labelledby":[m["aria-labelledby"],m["aria-label"]&&!m["aria-labelledby"]?m.id:null,w].filter(Boolean).join(" "),onFocus(f){t.isFocused||(e.onFocus&&e.onFocus(f),t.setFocused(!0))},onBlur(f){t.isOpen||(e.onBlur&&e.onBlur(f),t.setFocused(!1))}}),valueProps:{id:w},menuProps:{...c,disallowEmptySelection:o,autoFocus:t.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,onBlur:f=>{f.currentTarget.contains(f.relatedTarget)||(e.onBlur&&e.onBlur(f),t.setFocused(!1))},"aria-labelledby":[x["aria-labelledby"],m["aria-label"]&&!x["aria-labelledby"]?m.id:null].filter(Boolean).join(" ")}}}function Se(e){const{collection:t,disabledKeys:i,selectionManager:o,selectionManager:{setSelectedKeys:l,selectedKeys:s,selectionMode:n}}=Y.$e72dd72e1c76a225$export$2f645645f7bca764(e),a=[],c=s.size!==0?Array.from(s).map(u=>{const d=t.getItem(u);return d||a.push(u),d}).filter(Boolean):null;return a.length&&console.warn(`Select: Keys "${a.join(", ")}" passed to "selectedKeys" are not present in the collection.`),{collection:t,disabledKeys:i,selectionManager:o,selectionMode:n,selectedKeys:s,setSelectedKeys:l.bind(o),selectedItems:c}}function je(e){const[t,i]=g.useState(!1),o=M.$a28c903ee9ad8dc5$export$79fefeb1c2091ac3(e),l=e.selectionMode==="single",s=Se({...e,onSelectionChange:d=>{e.onSelectionChange&&e.onSelectionChange(d),l&&o.close()}}),n=j.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,validationBehavior:"native",value:s.selectedKeys}),a=s.collection.size===0,c=!!s.selectedKeys.size,u=g.useCallback(()=>{n.resetValidation(),n.commitValidation()},[n]);return g.useEffect(()=>{l&&c&&u()},[c,l,u]),{...s,...o,close(){o.close(),c&&u()},open(){a||o.open()},toggle(d){a||o.toggle(d)},isFocused:t,setFocused:i,...n}}function Ce(e,t={}){const[i,o]=g.useState({width:0,height:0}),l=t.delay===void 0?500:t.delay,s=!!t.includePadding;return g.useEffect(()=>{if(!e)return;const n=new ResizeObserver(we(([a])=>{const{inlineSize:c,blockSize:u}=s?a.borderBoxSize[0]:a.contentBoxSize[0];o({width:c,height:u})},l));return n.observe(e),()=>{n.disconnect()}},[l,e,s]),i}function we(e,t){let i;return(o,l)=>{clearTimeout(i),i=setTimeout(()=>{e(o,l)},t)}}function _e({autoComplete:e,name:t,isDisabled:i,isRequired:o,selectRef:l},s,n){const{visuallyHiddenProps:a}=Z.$5c3e21d68f1c4674$export$a966af930f325cab();return j.$99facab73266f662$export$5add1d006293d136(l,s.selectedKeys,s.setSelectedKeys),j.$e93e671b31057976$export$b8473d3665f3a75a({validationBehavior:"native",focus:()=>{var c;return(c=n.current)==null?void 0:c.focus()}},s,l),{containerProps:{...a,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":"aria-hidden-focus"},inputProps:{style:{display:"none"}},selectProps:{tabIndex:-1,autoComplete:e,disabled:i,required:o,name:t,value:Array.from(s.selectedKeys).map(c=>c.toString()),onChange:c=>s.setSelectedKeys(c.target.value),multiple:!0}}}function Ke(e){const{state:t,triggerRef:i,name:o,isDisabled:l}=e,s=`${e.label}-hidden`,n=g.useRef(null),{containerProps:a,selectProps:c}=_e({...e,selectRef:n},t,i);return t.collection.size<=300?r.jsx("div",{...a,"data-testid":"hidden-select-container",children:r.jsxs("label",{children:[s,r.jsxs("select",{...c,ref:n,children:[r.jsx("option",{}),[...t.collection.getKeys()].map(u=>{const d=t.collection.getItem(u);return d&&d.type==="item"?r.jsx("option",{value:d.key,children:d.textValue},d.key):null})]})]})}):o?r.jsx("input",{type:"hidden",autoComplete:c.autoComplete,name:o,disabled:l,value:Array.from(t.selectedKeys).map(u=>u.toString())??[""]}):null}const Pe={clearAll:"Clear all",selectAll:"Select all",selectedItems:"Selected items",chosen:"chosen"},ke={clearAll:"Rensa alla",selectAll:"Välj alla",selectedItems:"Valda objekt",chosen:"valda"},D={en:Pe,sv:ke},Ve=({state:{selectedItems:e},isDisabled:t,parentWidth:i,onClear:o,triggerRef:l,isClearable:s})=>{const n=N.useLocalizedStringFormatter(D);return r.jsxs("div",{className:h.selectValueTag,"data-disabled":t||void 0,children:[r.jsx("span",{className:h.truncate,style:{maxWidth:i-92},children:e!=null&&e.length&&e.length>1?`${e.length} ${n.format("chosen")}`:e==null?void 0:e[0].textValue}),s&&r.jsx("button",{disabled:t,"aria-label":n.format("clearAll"),className:h.clearButton,onClick:()=>{var a;o(),(a=l==null?void 0:l.current)==null||a.focus()},children:r.jsx(te.X,{width:20,height:20})})]})},Be=({autoFocus:e,excludeFromTabOrder:t,isDisabled:i,size:o="large",isOpen:l,isInvalid:s,selectionMode:n,state:{selectedItems:a},placeholder:c,children:u,triggerRef:d,...y})=>{const{buttonProps:x}=le.$701a24aa0da5b062$export$ea18c227d4417cc3({autoFocus:e,excludeFromTabOrder:t,isDisabled:i,...y},d),b=n==="multiple";return r.jsxs("div",{className:h.triggerContainer,"data-disabled":i||void 0,children:[r.jsxs("button",{...x,autoFocus:e,className:q.clsx(h.trigger,{[h.medium]:o==="medium"}),"data-disabled":i||void 0,"data-invalid":s||void 0,"data-open":l||void 0,ref:d,type:"button",children:[b&&!a?r.jsx("span",{children:c}):null,b?null:r.jsx("span",{children:a?a[0].textValue:c}),r.jsx("div",{className:h.icon,"aria-hidden":"true",children:r.jsx(ne.ChevronDown,{size:20})})]}),u]})},B=({state:e,errorMessage:t})=>r.jsx(k.$ee014567cb39d3f0$export$ff05c3ac10437e03.Provider,{value:{...e.displayValidation},children:r.jsx(k.FieldError,{children:t})}),qe=F.forwardRef(({isClearable:e=!0,popover:t,...i},o)=>{const l={selectionMode:"single",errorPosition:"top",disallowEmptySelection:!e,isClearable:e,size:"large",popover:t,...i},s=E.$df56164dff5785e2$export$4338b53315abf666(o),n=je(l),a=N.useLocalizedStringFormatter(D),{labelProps:c,triggerProps:u,valueProps:d,menuProps:y}=ve(l,n,s),{width:x}=Ce(s.current,{includePadding:!0});return r.jsxs(R.$bcdf0525bf22703d$export$2c73285ae9390cec,{...l,className:q.clsx(h.wrapper,l.className),children:[r.jsx(Ke,{...l,state:n,triggerRef:s}),r.jsx(P.LabelWrapper,{popover:t,children:l.label&&r.jsx(P.Label,{...c,"data-disabled":l.isDisabled||void 0,children:l.label})}),l.description&&r.jsx(ee.Text,{slot:"description",children:l.description}),l.errorPosition==="top"&&r.jsx(B,{...l,state:n}),r.jsx(Be,{...l,...u,isInvalid:n.displayValidation.isInvalid,triggerRef:s,state:n,children:l.selectionMode==="multiple"&&n.selectedItems?r.jsx("span",{...d,children:r.jsx(Ve,{...l,state:n,parentWidth:x,onClear:()=>n.selectionManager.clearSelection(),triggerRef:s})}):null}),l.errorPosition==="bottom"&&r.jsx(B,{...l,state:n}),r.jsxs(C.ListBoxPopover,{isOpen:n.isOpen,onOpenChange:b=>{b||n.close()},triggerRef:s,style:{width:x},children:[l.isSelectableAll&&r.jsx(I.Checkbox,{isSelected:n.selectionManager.isSelectAll,isIndeterminate:!n.selectionManager.isSelectAll&&!n.selectionManager.isEmpty,className:h.selectAll,onChange:()=>n.selectionManager.toggleSelectAll(),children:a.format("selectAll")}),r.jsx($e,{...y,state:n})]}),l.showTags&&!!n.selectedItems&&r.jsx(S.TagGroup,{"aria-label":a.format("selectedItems"),selectionBehavior:"toggle",onRemove:b=>n.selectionManager.toggleSelection(Array.from(b)[0]),className:h.tagGroup,children:r.jsx(S.$eaf9e70818b436db$export$f9fef0f55402315b,{items:n.selectedItems,children:b=>r.jsx(S.Tag,{textValue:b.textValue,id:b.key,dismissable:!0,isDisabled:l.isDisabled,children:b.textValue},b.key)})})]})}),O=F.forwardRef(({options:e,...t},i)=>r.jsx(qe,{...t,items:e,ref:i,children:o=>o.children?r.jsx(oe,{items:o.children,title:o.name,children:l=>r.jsx(V,{textValue:l.textValue,children:l.name})},o.name):r.jsx(V,{textValue:o.textValue,children:o.name})}));O.displayName="Select";exports.Select=O;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./assets/Select.css');const u=require("react/jsx-runtime"),R=require("./Button-1sEX8jKn.cjs"),V=require("./utils-CtICjCYt.cjs"),N=require("./FieldError-JWxR_EqN.cjs"),le=require("./Form-BuOomA4T.cjs"),te=require("./intlStrings-ClBuC6xN.cjs"),X=require("./ListBox-FD30iELk.cjs"),O=require("./Dialog-DycTLpdr.cjs"),H=require("./Text-0wXj3J8E.cjs"),ae=require("./Collection-vGO6v3_U.cjs"),re=require("./Hidden-BxRZGdEW.cjs"),A=require("./mergeProps-Du5A8xi8.cjs"),G=require("./filterDOMProps-RRlKPKX0.cjs"),Y=require("./OverlayArrow-bcrb_syE.cjs"),t=require("react"),ie=require("./context-UOrD6Zxk.cjs"),ne=require("./useLocalizedStringFormatter-CHAo1AyN.cjs"),z=require("./useFormValidation-DV2Ioblb.cjs"),oe=require("./useListState-DZFWpD-x.cjs"),se=require("./useControlledState-D0L6S_5r.cjs"),de=require("./useFocusRing-C-XVcAE5.cjs"),J=require("./ListKeyboardDelegate-8zuIfwQ7.cjs"),ce=require("./SelectionManager-CNJmHeCF.cjs"),ue=require("./useHover-DULSfLuK.cjs"),fe=require("./useField-DvszkIMx.cjs"),be=require("./VisuallyHidden-BMelU6B0.cjs"),Z=require("./SelectionIndicator-ClG0GpJu.cjs"),Q=require("./Label-DpY2SZdQ.cjs"),w=require("./clsx-DKOfLqne.cjs"),$e=require("./Text-D5OSv6Uv.cjs"),me=require("./Checkbox-BgrLxY6P.cjs"),_=require("./useLocalizedStringFormatter-BSac43NO.cjs"),ve=require("./x-rV-nu490.cjs"),ge=require("./ListBox-u6ZXp5Yi.cjs"),xe=require("./Popover-DpB0XDBp.cjs"),L=require("./Tag-BL-_PONN.cjs"),he=require("./clsx-C11secjj.cjs"),ye=require("./chevron-down-5hFlg_lR.cjs");function pe(e={}){let{locale:l}=ie.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7();return t.useMemo(()=>new Intl.ListFormat(l,e),[l,e])}const W=new WeakMap;function Se(e,l,i){let{keyboardDelegate:a,isDisabled:r,isRequired:c,name:v,form:o,validationBehavior:n="aria"}=e,f=J.$325a3faab7a68acd$export$a16aca283550c30d({usage:"search",sensitivity:"base"}),d=t.useMemo(()=>a||new J.$2a25aae57d74318e$export$a05409b8bb224a5a(l.collection,l.disabledKeys,i,f),[a,l.collection,l.disabledKeys,f,i]),{menuTriggerProps:b,menuProps:x}=O.$168583247155ddda$export$dc9c12ed27dd1b49({isDisabled:r,type:"listbox"},l,i),h=g=>{if(l.selectionManager.selectionMode!=="multiple")switch(g.key){case"ArrowLeft":{var j,D;g.preventDefault();let B=l.selectedKey!=null?(j=d.getKeyAbove)===null||j===void 0?void 0:j.call(d,l.selectedKey):(D=d.getFirstKey)===null||D===void 0?void 0:D.call(d);B&&l.setSelectedKey(B);break}case"ArrowRight":{var T,k;g.preventDefault();let B=l.selectedKey!=null?(T=d.getKeyBelow)===null||T===void 0?void 0:T.call(d,l.selectedKey):(k=d.getFirstKey)===null||k===void 0?void 0:k.call(d);B&&l.setSelectedKey(B);break}}},{typeSelectProps:$}=ce.$fb3050f43d946246$export$e32c88dfddc6e1d8({keyboardDelegate:d,selectionManager:l.selectionManager,onTypeSelect(g){l.setSelectedKey(g)}}),{isInvalid:P,validationErrors:q,validationDetails:m}=l.displayValidation,{labelProps:y,fieldProps:S,descriptionProps:s,errorMessageProps:F}=fe.$2baaea4c71418dea$export$294aa081a6c6f55d({...e,labelElementType:"span",isInvalid:P,errorMessage:e.errorMessage||q});$.onKeyDown=$.onKeyDownCapture,delete $.onKeyDownCapture,l.selectionManager.selectionMode==="multiple"&&($={});let M=G.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),p=A.$3ef42575df84b30b$export$9d1611c77c2fe928($,b,S),K=A.$bdb11010cef70236$export$f680877a34711e37();return W.set(l,{isDisabled:r,isRequired:c,name:v,form:o,validationBehavior:n}),{labelProps:{...y,onClick:()=>{if(!e.isDisabled){var g;(g=i.current)===null||g===void 0||g.focus(),ue.$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard")}}},triggerProps:A.$3ef42575df84b30b$export$9d1611c77c2fe928(M,{...p,isDisabled:r,onKeyDown:A.$ff5963eb1fccf552$export$e08e3b67e392101e(p.onKeyDown,h,e.onKeyDown),onKeyUp:e.onKeyUp,"aria-labelledby":[K,p["aria-labelledby"],p["aria-label"]&&!p["aria-labelledby"]?p.id:null].filter(Boolean).join(" "),onFocus(g){l.isFocused||(e.onFocus&&e.onFocus(g),e.onFocusChange&&e.onFocusChange(!0),l.setFocused(!0))},onBlur(g){l.isOpen||(e.onBlur&&e.onBlur(g),e.onFocusChange&&e.onFocusChange(!1),l.setFocused(!1))}}),valueProps:{id:K},menuProps:{...x,autoFocus:l.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,disallowEmptySelection:!0,linkBehavior:"selection",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||(e.onBlur&&e.onBlur(g),e.onFocusChange&&e.onFocusChange(!1),l.setFocused(!1))},"aria-labelledby":[S["aria-labelledby"],p["aria-label"]&&!S["aria-labelledby"]?p.id:null].filter(Boolean).join(" ")},descriptionProps:s,errorMessageProps:F,isInvalid:P,validationErrors:q,validationDetails:m,hiddenSelectProps:{isDisabled:r,name:v,label:e.label,state:l,triggerRef:i,form:o}}}function Pe(e,l,i){let a=W.get(l)||{},{autoComplete:r,name:c=a.name,form:v=a.form,isDisabled:o=a.isDisabled}=e,{validationBehavior:n,isRequired:f}=a,{visuallyHiddenProps:d}=be.$5c3e21d68f1c4674$export$a966af930f325cab({style:{position:"fixed",top:0,left:0}});z.$99facab73266f662$export$5add1d006293d136(e.selectRef,l.defaultValue,l.setValue),z.$e93e671b31057976$export$b8473d3665f3a75a({validationBehavior:n,focus:()=>{var $;return($=i.current)===null||$===void 0?void 0:$.focus()}},l,e.selectRef);let b=l.setValue,x=t.useCallback($=>{$.target.multiple?b(Array.from($.target.selectedOptions,P=>P.value)):b($.currentTarget.value)},[b]);var h;return{containerProps:{...d,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":"aria-hidden-focus"},inputProps:{style:{display:"none"}},selectProps:{tabIndex:-1,autoComplete:r,disabled:o,multiple:l.selectionManager.selectionMode==="multiple",required:n==="native"&&f,name:c,form:v,value:(h=l.value)!==null&&h!==void 0?h:"",onChange:x,onInput:x}}}function qe(e){let{state:l,triggerRef:i,label:a,name:r,form:c,isDisabled:v}=e,o=t.useRef(null),n=t.useRef(null),{containerProps:f,selectProps:d}=Pe({...e,selectRef:l.collection.size<=300?o:n},l,i);if(l.collection.size<=300)return t.createElement("div",{...f,"data-testid":"hidden-select-container"},t.createElement("label",null,a,t.createElement("select",{...d,ref:o},t.createElement("option",null),[...l.collection.getKeys()].map(b=>{let x=l.collection.getItem(b);if(x&&x.type==="item")return t.createElement("option",{key:x.key,value:x.key},x.textValue)}))));if(r){let b=W.get(l)||{},{validationBehavior:x}=b,h=Array.isArray(l.value)?l.value:[l.value];h.length===0&&(h=[null]);let $=h.map((P,q)=>{let m={type:"hidden",autoComplete:d.autoComplete,name:r,form:c,disabled:v,value:P??""};return x==="native"?t.createElement("input",{key:q,...m,ref:q===0?n:null,style:{display:"none"},type:"text",required:q===0?d.required:!1,onChange:()=>{}}):t.createElement("input",{key:q,...m,ref:q===0?n:null})});return t.createElement(t.Fragment,null,$)}return null}function Ce(e){let{selectionMode:l="single"}=e,i=Y.$fc909762b330b746$export$61c6a8c84e605fb6(e),[a,r]=t.useState(null),c=t.useMemo(()=>{var s;return e.defaultValue!==void 0?e.defaultValue:l==="single"?(s=e.defaultSelectedKey)!==null&&s!==void 0?s:null:[]},[e.defaultValue,e.defaultSelectedKey,l]),v=t.useMemo(()=>e.value!==void 0?e.value:l==="single"?e.selectedKey:void 0,[e.value,e.selectedKey,l]),[o,n]=se.$458b0a5536c1a7cf$export$40bfa8c7b0832715(v,c,e.onChange),f=l==="single"&&Array.isArray(o)?o[0]:o,d=s=>{if(l==="single"){var F,M;let p=Array.isArray(s)?(M=s[0])!==null&&M!==void 0?M:null:s;n(p),p!==f&&((F=e.onSelectionChange)===null||F===void 0||F.call(e,p))}else{let p=[];Array.isArray(s)?p=s:s!=null&&(p=[s]),n(p)}},b=oe.$e72dd72e1c76a225$export$2f645645f7bca764({...e,selectionMode:l,disallowEmptySelection:l==="single",allowDuplicateSelectionEvents:!0,selectedKeys:t.useMemo(()=>Fe(f),[f]),onSelectionChange:s=>{if(s!=="all"){if(l==="single"){var F;let M=(F=s.values().next().value)!==null&&F!==void 0?F:null;d(M),i.close()}else d([...s]);$.commitValidation()}}}),x=b.selectionManager.firstSelectedKey,h=t.useMemo(()=>[...b.selectionManager.selectedKeys].map(s=>b.collection.getItem(s)).filter(s=>s!=null),[b.selectionManager.selectedKeys,b.collection]),$=z.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,value:Array.isArray(f)&&f.length===0?null:f}),[P,q]=t.useState(!1),[m]=t.useState(f);var y,S;return{...$,...b,...i,value:f,defaultValue:c??m,setValue:d,selectedKey:x,setSelectedKey:d,selectedItem:(y=h[0])!==null&&y!==void 0?y:null,selectedItems:h,defaultSelectedKey:(S=e.defaultSelectedKey)!==null&&S!==void 0?S:e.selectionMode==="single"?m:null,focusStrategy:a,open(s=null){b.collection.size!==0&&(r(s),i.open())},toggle(s=null){b.collection.size!==0&&(r(s),i.toggle())},isFocused:P,setFocused:q}}function Fe(e){if(e!==void 0)return e===null?[]:Array.isArray(e)?e:[e]}function Me(e){return e&&e.__esModule?e.default:e}const U=t.createContext(null),I=t.createContext(null),Ve=t.forwardRef(function(l,i){[l,i]=V.$64fa3d84918910a7$export$29f1550f4b0d4415(l,i,U);let{children:a,isDisabled:r=!1,isInvalid:c=!1,isRequired:v=!1}=l,o=t.useMemo(()=>typeof a=="function"?a({isOpen:!1,isDisabled:r,isInvalid:c,isRequired:v,isFocused:!1,isFocusVisible:!1,defaultChildren:null}):a,[a,r,c,v]);return t.createElement(ae.$e1995378a142960e$export$bf788dd355e3a401,{content:o},n=>t.createElement(De,{props:l,collection:n,selectRef:i}))}),je=[R.$01b77f81d0f07f68$export$75b6ee27786ba447,R.$d2b4bc8c273e7be6$export$24d547caef80ccd1,H.$514c0188e459b4c0$export$9afb8bc826b033ea];function De({props:e,selectRef:l,collection:i}){let{validationBehavior:a}=V.$64fa3d84918910a7$export$fabf2dc03a41866e(le.$d3e0e05bdfcf66bd$export$c24727297075ec6a)||{};var r,c;let v=(c=(r=e.validationBehavior)!==null&&r!==void 0?r:a)!==null&&c!==void 0?c:"native",o=Ce({...e,collection:i,children:void 0,validationBehavior:v}),{isFocusVisible:n,focusProps:f}=de.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),d=t.useRef(null),[b,x]=V.$64fa3d84918910a7$export$9d4c57ee4c6ffdd8(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:h,triggerProps:$,valueProps:P,menuProps:q,descriptionProps:m,errorMessageProps:y,hiddenSelectProps:S,...s}=Se({...V.$64fa3d84918910a7$export$ef03459518577ad4(e),label:x,validationBehavior:v},o,d),[F,M]=t.useState(null),p=t.useCallback(()=>{d.current&&M(d.current.offsetWidth+"px")},[d]);Y.$9daab02d461809db$export$683480f191c0e3ea({ref:d,onResize:p});let K=t.useMemo(()=>({isOpen:o.isOpen,isFocused:o.isFocused,isFocusVisible:n,isDisabled:e.isDisabled||!1,isInvalid:s.isInvalid||!1,isRequired:e.isRequired||!1}),[o.isOpen,o.isFocused,n,e.isDisabled,s.isInvalid,e.isRequired]),g=V.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,values:K,defaultClassName:"react-aria-Select"}),j=G.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});delete j.id;let D=t.useRef(null);return t.createElement(V.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[U,e],[I,o],[ee,P],[R.$01b77f81d0f07f68$export$75b6ee27786ba447,{...h,ref:b,elementType:"span"}],[R.$d2b4bc8c273e7be6$export$24d547caef80ccd1,{...$,ref:d,isPressed:o.isOpen,autoFocus:e.autoFocus}],[O.$de32f1b87079253c$export$d2f961adcb0afbe,o],[O.$07b14b47974efb58$export$9b9a0cd73afb7ca4,{trigger:"Select",triggerRef:d,scrollRef:D,placement:"bottom start",style:{"--trigger-width":F},"aria-labelledby":q["aria-labelledby"],clearContexts:je}],[X.$eed445e0843c11d0$export$7ff8f37d2d81a48d,{...q,ref:D}],[X.$eed445e0843c11d0$export$7c5906fe4f1f2af2,o],[H.$514c0188e459b4c0$export$9afb8bc826b033ea,{slots:{description:m,errorMessage:y}}],[N.$ee014567cb39d3f0$export$ff05c3ac10437e03,s]]},t.createElement("div",{...A.$3ef42575df84b30b$export$9d1611c77c2fe928(j,g,f),ref:l,slot:e.slot||void 0,"data-focused":o.isFocused||void 0,"data-focus-visible":n||void 0,"data-open":o.isOpen||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":s.isInvalid||void 0,"data-required":e.isRequired||void 0},g.children,t.createElement(qe,{...S,autoComplete:e.autoComplete})))}const ee=t.createContext(null),Re=re.$f39a9eba43920ace$export$86427a43e3e48ebb(function(l,i){var a;[l,i]=V.$64fa3d84918910a7$export$29f1550f4b0d4415(l,i,ee);let r=t.useContext(I),{placeholder:c}=V.$64fa3d84918910a7$export$fabf2dc03a41866e(U),v=r.selectedItems.map(m=>{var y;let S=(y=m.props)===null||y===void 0?void 0:y.children;return typeof S=="function"&&(S=S({isHovered:!1,isPressed:!1,isSelected:!1,isFocused:!1,isFocusVisible:!1,isDisabled:!1,selectionMode:"single",selectionBehavior:"toggle"})),S}),o=pe(),n=t.useMemo(()=>r.selectedItems.map(m=>m==null?void 0:m.textValue),[r.selectedItems]),f=r.selectionManager.selectionMode,d=t.useMemo(()=>{var m;return f==="single"?(m=n[0])!==null&&m!==void 0?m:"":o.format(n)},[f,o,n]),b=t.useMemo(()=>{if(f==="single")return v[0];let m=o.formatToParts(n);if(m.length===0)return null;let y=0;return m.map(S=>S.type==="element"?t.createElement(t.Fragment,{key:y},v[y++]):S.value)},[f,o,n,v]),x=ne.$fca6afa0e843324b$export$f12b703ca79dfbb1(Me(te.$df39c1238ae2b5f3$exports),"react-aria-components");var h,$;let P=V.$64fa3d84918910a7$export$4d86445c2cf5e3({...l,defaultChildren:(h=b??c)!==null&&h!==void 0?h:x.format("selectPlaceholder"),defaultClassName:"react-aria-SelectValue",values:{selectedItem:($=(a=r.selectedItems[0])===null||a===void 0?void 0:a.value)!==null&&$!==void 0?$:null,selectedItems:t.useMemo(()=>r.selectedItems.map(m=>{var y;return(y=m.value)!==null&&y!==void 0?y:null}),[r.selectedItems]),selectedText:d,isPlaceholder:r.selectedItems.length===0,state:r}}),q=G.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(l,{global:!0});return t.createElement("span",{ref:i,...q,...P,"data-placeholder":r.selectedItems.length===0||void 0},t.createElement(H.$514c0188e459b4c0$export$9afb8bc826b033ea.Provider,{value:void 0},P.children))}),Ie={clearAll:"Clear all",selectAll:"Select all",selectedItems:"Selected items",selected:"selected"},Be={clearAll:"Rensa alla",selectAll:"Välj alla",selectedItems:"Valda objekt",selected:"valda"},E={en:Ie,sv:Be},Ae="_select_1jd5h_1",Ke="_triggerContainer_1jd5h_6",_e="_trigger_1jd5h_6",Ee="_medium_1jd5h_27",Te="_selectValue_1jd5h_70",ke="_placeholder_1jd5h_80",we="_selectValueTag_1jd5h_94",Le="_clearButton_1jd5h_108",Ne="_truncate_1jd5h_120",Oe="_popover_1jd5h_157",ze="_selectAll_1jd5h_181",He="_tagGroup_1jd5h_244",C={select:Ae,triggerContainer:Ke,trigger:_e,medium:Ee,selectValue:Te,placeholder:ke,selectValueTag:we,clearButton:Le,truncate:Ne,popover:Oe,selectAll:ze,tagGroup:He},Ge=()=>{const e=t.useContext(I),l=_.useLocalizedStringFormatter(E),i=()=>e==null?void 0:e.setValue(e!=null&&e.selectionManager.isSelectAll?null:Array.from(e.collection.getKeys()));return u.jsx(me.Checkbox,{className:C.selectAll,isIndeterminate:!(e!=null&&e.selectionManager.isSelectAll)&&!(e!=null&&e.selectionManager.isEmpty),isSelected:e==null?void 0:e.selectionManager.isSelectAll,onChange:i,children:l.format("selectAll")})},We=({isDisabled:e,selectedItems:l,selectedText:i})=>{const a=_.useLocalizedStringFormatter(E),r=()=>l.length===1?i:`${l.length} ${a.format("selected")}`;return u.jsxs("div",{className:C.selectValueTag,"data-disabled":e||void 0,children:[u.jsx("span",{className:C.truncate,children:r()}),u.jsx(Ue,{isDisabled:e})]})},Ue=({isDisabled:e})=>{const l=t.useContext(I),i=_.useLocalizedStringFormatter(E),a=Z.$9bf71ea28793e738$export$10c5169755ce7bd7(),r=()=>{a==null||a.focusFirst(),l==null||l.setValue(null)};return u.jsx(R.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{"aria-label":i.format("clearAll"),className:C.clearButton,onPress:r,slot:null,isDisabled:e,children:u.jsx(ve.X,{width:20,height:20})})},Xe=({showTags:e,isDisabled:l})=>{const i=_.useLocalizedStringFormatter(E),a=t.useContext(I),r=c=>{a==null||a.selectionManager.toggleSelection(Array.from(c)[0])};return!(a!=null&&a.selectedItems.length)||!e?null:u.jsx(L.TagGroup,{"aria-label":i.format("selectedItems"),className:C.tagGroup,onRemove:r,selectionBehavior:"toggle",children:u.jsx(L.$eaf9e70818b436db$export$f9fef0f55402315b,{items:a.selectedItems,children:c=>u.jsx(L.Tag,{dismissable:!0,id:c.key,isDisabled:l,textValue:c.textValue,children:c.textValue},c.key)})})},Je=({size:e})=>{const l=t.useContext(I);return u.jsx(R.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{className:he.clsx({[C.medium]:e==="medium"},C.trigger),"data-invalid":!!(l!=null&&l.displayValidation.isInvalid)||void 0,children:u.jsx("span",{"aria-hidden":"true",style:{display:"flex"},children:u.jsx(ye.ChevronDown,{size:20})})})};function Qe({children:e,description:l,errorMessage:i,errorPosition:a="top",items:r,label:c,popover:v,size:o="large",...n}){return u.jsx(Z.$9bf71ea28793e738$export$20e40289641fbbb6,{children:u.jsxs(Ve,{...n,className:w.clsx(n.className,C.select),children:[u.jsx(Q.LabelWrapper,{popover:v,children:c&&u.jsx(Q.Label,{"data-disabled":n.isDisabled||void 0,children:c})}),l&&u.jsx($e.Text,{slot:"description",children:l}),a==="top"&&u.jsx(N.FieldError,{children:i}),u.jsxs("div",{className:C.triggerContainer,"data-disabled":n.isDisabled||void 0,children:[u.jsx(Je,{size:o}),u.jsx(Re,{className:C.selectValue,"data-disabled":n.isDisabled||void 0,children:f=>f.isPlaceholder||n.selectionMode!=="multiple"?u.jsx("div",{className:w.clsx(C.placeholder),children:u.jsx("span",{className:w.clsx(C.truncate),children:f.defaultChildren})}):u.jsx(We,{...n,...f})})]}),a==="bottom"&&u.jsx(N.FieldError,{children:i}),u.jsxs(xe.Popover,{className:C.popover,offset:0,hideArrow:!0,children:[n.isSelectableAll&&u.jsx(Ge,{}),u.jsx(ge.ListBox,{escapeKeyBehavior:"none",items:r,children:e})]}),u.jsx(Xe,{...n})]})})}exports.Select=Qe;
|
|
1
|
+
"use strict";require('./assets/Select.css');const u=require("react/jsx-runtime"),R=require("./Button-1sEX8jKn.cjs"),V=require("./utils-CtICjCYt.cjs"),N=require("./FieldError-JWxR_EqN.cjs"),le=require("./Form-BuOomA4T.cjs"),te=require("./intlStrings-ClBuC6xN.cjs"),X=require("./ListBox-FD30iELk.cjs"),O=require("./Dialog-DycTLpdr.cjs"),H=require("./Text-0wXj3J8E.cjs"),ae=require("./Collection-vGO6v3_U.cjs"),re=require("./Hidden-BxRZGdEW.cjs"),A=require("./mergeProps-Du5A8xi8.cjs"),G=require("./filterDOMProps-RRlKPKX0.cjs"),Y=require("./OverlayArrow-bcrb_syE.cjs"),t=require("react"),ie=require("./context-UOrD6Zxk.cjs"),ne=require("./useLocalizedStringFormatter-CHAo1AyN.cjs"),z=require("./useFormValidation-DV2Ioblb.cjs"),oe=require("./useListState-DZFWpD-x.cjs"),se=require("./useControlledState-D0L6S_5r.cjs"),de=require("./useFocusRing-C-XVcAE5.cjs"),J=require("./ListKeyboardDelegate-8zuIfwQ7.cjs"),ce=require("./SelectionManager-CNJmHeCF.cjs"),ue=require("./useHover-DULSfLuK.cjs"),fe=require("./useField-DvszkIMx.cjs"),be=require("./VisuallyHidden-BMelU6B0.cjs"),Z=require("./SelectionIndicator-ClG0GpJu.cjs"),Q=require("./Label-DpY2SZdQ.cjs"),w=require("./clsx-DKOfLqne.cjs"),$e=require("./Text-D5OSv6Uv.cjs"),me=require("./Checkbox-BgrLxY6P.cjs"),_=require("./useLocalizedStringFormatter-BSac43NO.cjs"),ve=require("./x-rV-nu490.cjs"),ge=require("./ListBox-2wZ6XOeD.cjs"),xe=require("./Popover-DpB0XDBp.cjs"),L=require("./Tag-BL-_PONN.cjs"),he=require("./clsx-C11secjj.cjs"),ye=require("./chevron-down-5hFlg_lR.cjs");function pe(e={}){let{locale:l}=ie.$18f2051aff69b9bf$export$43bb16f9c6d9e3f7();return t.useMemo(()=>new Intl.ListFormat(l,e),[l,e])}const W=new WeakMap;function Se(e,l,i){let{keyboardDelegate:a,isDisabled:r,isRequired:c,name:v,form:o,validationBehavior:n="aria"}=e,f=J.$325a3faab7a68acd$export$a16aca283550c30d({usage:"search",sensitivity:"base"}),d=t.useMemo(()=>a||new J.$2a25aae57d74318e$export$a05409b8bb224a5a(l.collection,l.disabledKeys,i,f),[a,l.collection,l.disabledKeys,f,i]),{menuTriggerProps:b,menuProps:x}=O.$168583247155ddda$export$dc9c12ed27dd1b49({isDisabled:r,type:"listbox"},l,i),h=g=>{if(l.selectionManager.selectionMode!=="multiple")switch(g.key){case"ArrowLeft":{var j,D;g.preventDefault();let B=l.selectedKey!=null?(j=d.getKeyAbove)===null||j===void 0?void 0:j.call(d,l.selectedKey):(D=d.getFirstKey)===null||D===void 0?void 0:D.call(d);B&&l.setSelectedKey(B);break}case"ArrowRight":{var T,k;g.preventDefault();let B=l.selectedKey!=null?(T=d.getKeyBelow)===null||T===void 0?void 0:T.call(d,l.selectedKey):(k=d.getFirstKey)===null||k===void 0?void 0:k.call(d);B&&l.setSelectedKey(B);break}}},{typeSelectProps:$}=ce.$fb3050f43d946246$export$e32c88dfddc6e1d8({keyboardDelegate:d,selectionManager:l.selectionManager,onTypeSelect(g){l.setSelectedKey(g)}}),{isInvalid:P,validationErrors:q,validationDetails:m}=l.displayValidation,{labelProps:y,fieldProps:S,descriptionProps:s,errorMessageProps:F}=fe.$2baaea4c71418dea$export$294aa081a6c6f55d({...e,labelElementType:"span",isInvalid:P,errorMessage:e.errorMessage||q});$.onKeyDown=$.onKeyDownCapture,delete $.onKeyDownCapture,l.selectionManager.selectionMode==="multiple"&&($={});let M=G.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{labelable:!0}),p=A.$3ef42575df84b30b$export$9d1611c77c2fe928($,b,S),K=A.$bdb11010cef70236$export$f680877a34711e37();return W.set(l,{isDisabled:r,isRequired:c,name:v,form:o,validationBehavior:n}),{labelProps:{...y,onClick:()=>{if(!e.isDisabled){var g;(g=i.current)===null||g===void 0||g.focus(),ue.$507fabe10e71c6fb$export$8397ddfc504fdb9a("keyboard")}}},triggerProps:A.$3ef42575df84b30b$export$9d1611c77c2fe928(M,{...p,isDisabled:r,onKeyDown:A.$ff5963eb1fccf552$export$e08e3b67e392101e(p.onKeyDown,h,e.onKeyDown),onKeyUp:e.onKeyUp,"aria-labelledby":[K,p["aria-labelledby"],p["aria-label"]&&!p["aria-labelledby"]?p.id:null].filter(Boolean).join(" "),onFocus(g){l.isFocused||(e.onFocus&&e.onFocus(g),e.onFocusChange&&e.onFocusChange(!0),l.setFocused(!0))},onBlur(g){l.isOpen||(e.onBlur&&e.onBlur(g),e.onFocusChange&&e.onFocusChange(!1),l.setFocused(!1))}}),valueProps:{id:K},menuProps:{...x,autoFocus:l.focusStrategy||!0,shouldSelectOnPressUp:!0,shouldFocusOnHover:!0,disallowEmptySelection:!0,linkBehavior:"selection",onBlur:g=>{g.currentTarget.contains(g.relatedTarget)||(e.onBlur&&e.onBlur(g),e.onFocusChange&&e.onFocusChange(!1),l.setFocused(!1))},"aria-labelledby":[S["aria-labelledby"],p["aria-label"]&&!S["aria-labelledby"]?p.id:null].filter(Boolean).join(" ")},descriptionProps:s,errorMessageProps:F,isInvalid:P,validationErrors:q,validationDetails:m,hiddenSelectProps:{isDisabled:r,name:v,label:e.label,state:l,triggerRef:i,form:o}}}function Pe(e,l,i){let a=W.get(l)||{},{autoComplete:r,name:c=a.name,form:v=a.form,isDisabled:o=a.isDisabled}=e,{validationBehavior:n,isRequired:f}=a,{visuallyHiddenProps:d}=be.$5c3e21d68f1c4674$export$a966af930f325cab({style:{position:"fixed",top:0,left:0}});z.$99facab73266f662$export$5add1d006293d136(e.selectRef,l.defaultValue,l.setValue),z.$e93e671b31057976$export$b8473d3665f3a75a({validationBehavior:n,focus:()=>{var $;return($=i.current)===null||$===void 0?void 0:$.focus()}},l,e.selectRef);let b=l.setValue,x=t.useCallback($=>{$.target.multiple?b(Array.from($.target.selectedOptions,P=>P.value)):b($.currentTarget.value)},[b]);var h;return{containerProps:{...d,"aria-hidden":!0,"data-react-aria-prevent-focus":!0,"data-a11y-ignore":"aria-hidden-focus"},inputProps:{style:{display:"none"}},selectProps:{tabIndex:-1,autoComplete:r,disabled:o,multiple:l.selectionManager.selectionMode==="multiple",required:n==="native"&&f,name:c,form:v,value:(h=l.value)!==null&&h!==void 0?h:"",onChange:x,onInput:x}}}function qe(e){let{state:l,triggerRef:i,label:a,name:r,form:c,isDisabled:v}=e,o=t.useRef(null),n=t.useRef(null),{containerProps:f,selectProps:d}=Pe({...e,selectRef:l.collection.size<=300?o:n},l,i);if(l.collection.size<=300)return t.createElement("div",{...f,"data-testid":"hidden-select-container"},t.createElement("label",null,a,t.createElement("select",{...d,ref:o},t.createElement("option",null),[...l.collection.getKeys()].map(b=>{let x=l.collection.getItem(b);if(x&&x.type==="item")return t.createElement("option",{key:x.key,value:x.key},x.textValue)}))));if(r){let b=W.get(l)||{},{validationBehavior:x}=b,h=Array.isArray(l.value)?l.value:[l.value];h.length===0&&(h=[null]);let $=h.map((P,q)=>{let m={type:"hidden",autoComplete:d.autoComplete,name:r,form:c,disabled:v,value:P??""};return x==="native"?t.createElement("input",{key:q,...m,ref:q===0?n:null,style:{display:"none"},type:"text",required:q===0?d.required:!1,onChange:()=>{}}):t.createElement("input",{key:q,...m,ref:q===0?n:null})});return t.createElement(t.Fragment,null,$)}return null}function Ce(e){let{selectionMode:l="single"}=e,i=Y.$fc909762b330b746$export$61c6a8c84e605fb6(e),[a,r]=t.useState(null),c=t.useMemo(()=>{var s;return e.defaultValue!==void 0?e.defaultValue:l==="single"?(s=e.defaultSelectedKey)!==null&&s!==void 0?s:null:[]},[e.defaultValue,e.defaultSelectedKey,l]),v=t.useMemo(()=>e.value!==void 0?e.value:l==="single"?e.selectedKey:void 0,[e.value,e.selectedKey,l]),[o,n]=se.$458b0a5536c1a7cf$export$40bfa8c7b0832715(v,c,e.onChange),f=l==="single"&&Array.isArray(o)?o[0]:o,d=s=>{if(l==="single"){var F,M;let p=Array.isArray(s)?(M=s[0])!==null&&M!==void 0?M:null:s;n(p),p!==f&&((F=e.onSelectionChange)===null||F===void 0||F.call(e,p))}else{let p=[];Array.isArray(s)?p=s:s!=null&&(p=[s]),n(p)}},b=oe.$e72dd72e1c76a225$export$2f645645f7bca764({...e,selectionMode:l,disallowEmptySelection:l==="single",allowDuplicateSelectionEvents:!0,selectedKeys:t.useMemo(()=>Fe(f),[f]),onSelectionChange:s=>{if(s!=="all"){if(l==="single"){var F;let M=(F=s.values().next().value)!==null&&F!==void 0?F:null;d(M),i.close()}else d([...s]);$.commitValidation()}}}),x=b.selectionManager.firstSelectedKey,h=t.useMemo(()=>[...b.selectionManager.selectedKeys].map(s=>b.collection.getItem(s)).filter(s=>s!=null),[b.selectionManager.selectedKeys,b.collection]),$=z.$e5be200c675c3b3a$export$fc1a364ae1f3ff10({...e,value:Array.isArray(f)&&f.length===0?null:f}),[P,q]=t.useState(!1),[m]=t.useState(f);var y,S;return{...$,...b,...i,value:f,defaultValue:c??m,setValue:d,selectedKey:x,setSelectedKey:d,selectedItem:(y=h[0])!==null&&y!==void 0?y:null,selectedItems:h,defaultSelectedKey:(S=e.defaultSelectedKey)!==null&&S!==void 0?S:e.selectionMode==="single"?m:null,focusStrategy:a,open(s=null){b.collection.size!==0&&(r(s),i.open())},toggle(s=null){b.collection.size!==0&&(r(s),i.toggle())},isFocused:P,setFocused:q}}function Fe(e){if(e!==void 0)return e===null?[]:Array.isArray(e)?e:[e]}function Me(e){return e&&e.__esModule?e.default:e}const U=t.createContext(null),I=t.createContext(null),Ve=t.forwardRef(function(l,i){[l,i]=V.$64fa3d84918910a7$export$29f1550f4b0d4415(l,i,U);let{children:a,isDisabled:r=!1,isInvalid:c=!1,isRequired:v=!1}=l,o=t.useMemo(()=>typeof a=="function"?a({isOpen:!1,isDisabled:r,isInvalid:c,isRequired:v,isFocused:!1,isFocusVisible:!1,defaultChildren:null}):a,[a,r,c,v]);return t.createElement(ae.$e1995378a142960e$export$bf788dd355e3a401,{content:o},n=>t.createElement(De,{props:l,collection:n,selectRef:i}))}),je=[R.$01b77f81d0f07f68$export$75b6ee27786ba447,R.$d2b4bc8c273e7be6$export$24d547caef80ccd1,H.$514c0188e459b4c0$export$9afb8bc826b033ea];function De({props:e,selectRef:l,collection:i}){let{validationBehavior:a}=V.$64fa3d84918910a7$export$fabf2dc03a41866e(le.$d3e0e05bdfcf66bd$export$c24727297075ec6a)||{};var r,c;let v=(c=(r=e.validationBehavior)!==null&&r!==void 0?r:a)!==null&&c!==void 0?c:"native",o=Ce({...e,collection:i,children:void 0,validationBehavior:v}),{isFocusVisible:n,focusProps:f}=de.$f7dceffc5ad7768b$export$4e328f61c538687f({within:!0}),d=t.useRef(null),[b,x]=V.$64fa3d84918910a7$export$9d4c57ee4c6ffdd8(!e["aria-label"]&&!e["aria-labelledby"]),{labelProps:h,triggerProps:$,valueProps:P,menuProps:q,descriptionProps:m,errorMessageProps:y,hiddenSelectProps:S,...s}=Se({...V.$64fa3d84918910a7$export$ef03459518577ad4(e),label:x,validationBehavior:v},o,d),[F,M]=t.useState(null),p=t.useCallback(()=>{d.current&&M(d.current.offsetWidth+"px")},[d]);Y.$9daab02d461809db$export$683480f191c0e3ea({ref:d,onResize:p});let K=t.useMemo(()=>({isOpen:o.isOpen,isFocused:o.isFocused,isFocusVisible:n,isDisabled:e.isDisabled||!1,isInvalid:s.isInvalid||!1,isRequired:e.isRequired||!1}),[o.isOpen,o.isFocused,n,e.isDisabled,s.isInvalid,e.isRequired]),g=V.$64fa3d84918910a7$export$4d86445c2cf5e3({...e,values:K,defaultClassName:"react-aria-Select"}),j=G.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(e,{global:!0});delete j.id;let D=t.useRef(null);return t.createElement(V.$64fa3d84918910a7$export$2881499e37b75b9a,{values:[[U,e],[I,o],[ee,P],[R.$01b77f81d0f07f68$export$75b6ee27786ba447,{...h,ref:b,elementType:"span"}],[R.$d2b4bc8c273e7be6$export$24d547caef80ccd1,{...$,ref:d,isPressed:o.isOpen,autoFocus:e.autoFocus}],[O.$de32f1b87079253c$export$d2f961adcb0afbe,o],[O.$07b14b47974efb58$export$9b9a0cd73afb7ca4,{trigger:"Select",triggerRef:d,scrollRef:D,placement:"bottom start",style:{"--trigger-width":F},"aria-labelledby":q["aria-labelledby"],clearContexts:je}],[X.$eed445e0843c11d0$export$7ff8f37d2d81a48d,{...q,ref:D}],[X.$eed445e0843c11d0$export$7c5906fe4f1f2af2,o],[H.$514c0188e459b4c0$export$9afb8bc826b033ea,{slots:{description:m,errorMessage:y}}],[N.$ee014567cb39d3f0$export$ff05c3ac10437e03,s]]},t.createElement("div",{...A.$3ef42575df84b30b$export$9d1611c77c2fe928(j,g,f),ref:l,slot:e.slot||void 0,"data-focused":o.isFocused||void 0,"data-focus-visible":n||void 0,"data-open":o.isOpen||void 0,"data-disabled":e.isDisabled||void 0,"data-invalid":s.isInvalid||void 0,"data-required":e.isRequired||void 0},g.children,t.createElement(qe,{...S,autoComplete:e.autoComplete})))}const ee=t.createContext(null),Re=re.$f39a9eba43920ace$export$86427a43e3e48ebb(function(l,i){var a;[l,i]=V.$64fa3d84918910a7$export$29f1550f4b0d4415(l,i,ee);let r=t.useContext(I),{placeholder:c}=V.$64fa3d84918910a7$export$fabf2dc03a41866e(U),v=r.selectedItems.map(m=>{var y;let S=(y=m.props)===null||y===void 0?void 0:y.children;return typeof S=="function"&&(S=S({isHovered:!1,isPressed:!1,isSelected:!1,isFocused:!1,isFocusVisible:!1,isDisabled:!1,selectionMode:"single",selectionBehavior:"toggle"})),S}),o=pe(),n=t.useMemo(()=>r.selectedItems.map(m=>m==null?void 0:m.textValue),[r.selectedItems]),f=r.selectionManager.selectionMode,d=t.useMemo(()=>{var m;return f==="single"?(m=n[0])!==null&&m!==void 0?m:"":o.format(n)},[f,o,n]),b=t.useMemo(()=>{if(f==="single")return v[0];let m=o.formatToParts(n);if(m.length===0)return null;let y=0;return m.map(S=>S.type==="element"?t.createElement(t.Fragment,{key:y},v[y++]):S.value)},[f,o,n,v]),x=ne.$fca6afa0e843324b$export$f12b703ca79dfbb1(Me(te.$df39c1238ae2b5f3$exports),"react-aria-components");var h,$;let P=V.$64fa3d84918910a7$export$4d86445c2cf5e3({...l,defaultChildren:(h=b??c)!==null&&h!==void 0?h:x.format("selectPlaceholder"),defaultClassName:"react-aria-SelectValue",values:{selectedItem:($=(a=r.selectedItems[0])===null||a===void 0?void 0:a.value)!==null&&$!==void 0?$:null,selectedItems:t.useMemo(()=>r.selectedItems.map(m=>{var y;return(y=m.value)!==null&&y!==void 0?y:null}),[r.selectedItems]),selectedText:d,isPlaceholder:r.selectedItems.length===0,state:r}}),q=G.$65484d02dcb7eb3e$export$457c3d6518dd4c6f(l,{global:!0});return t.createElement("span",{ref:i,...q,...P,"data-placeholder":r.selectedItems.length===0||void 0},t.createElement(H.$514c0188e459b4c0$export$9afb8bc826b033ea.Provider,{value:void 0},P.children))}),Ie={clearAll:"Clear all",selectAll:"Select all",selectedItems:"Selected items",selected:"selected"},Be={clearAll:"Rensa alla",selectAll:"Välj alla",selectedItems:"Valda objekt",selected:"valda"},E={en:Ie,sv:Be},Ae="_select_1jd5h_1",Ke="_triggerContainer_1jd5h_6",_e="_trigger_1jd5h_6",Ee="_medium_1jd5h_27",Te="_selectValue_1jd5h_70",ke="_placeholder_1jd5h_80",we="_selectValueTag_1jd5h_94",Le="_clearButton_1jd5h_108",Ne="_truncate_1jd5h_120",Oe="_popover_1jd5h_157",ze="_selectAll_1jd5h_181",He="_tagGroup_1jd5h_244",C={select:Ae,triggerContainer:Ke,trigger:_e,medium:Ee,selectValue:Te,placeholder:ke,selectValueTag:we,clearButton:Le,truncate:Ne,popover:Oe,selectAll:ze,tagGroup:He},Ge=()=>{const e=t.useContext(I),l=_.useLocalizedStringFormatter(E),i=()=>e==null?void 0:e.setValue(e!=null&&e.selectionManager.isSelectAll?null:Array.from(e.collection.getKeys()));return u.jsx(me.Checkbox,{className:C.selectAll,isIndeterminate:!(e!=null&&e.selectionManager.isSelectAll)&&!(e!=null&&e.selectionManager.isEmpty),isSelected:e==null?void 0:e.selectionManager.isSelectAll,onChange:i,children:l.format("selectAll")})},We=({isDisabled:e,selectedItems:l,selectedText:i})=>{const a=_.useLocalizedStringFormatter(E),r=()=>l.length===1?i:`${l.length} ${a.format("selected")}`;return u.jsxs("div",{className:C.selectValueTag,"data-disabled":e||void 0,children:[u.jsx("span",{className:C.truncate,children:r()}),u.jsx(Ue,{isDisabled:e})]})},Ue=({isDisabled:e})=>{const l=t.useContext(I),i=_.useLocalizedStringFormatter(E),a=Z.$9bf71ea28793e738$export$10c5169755ce7bd7(),r=()=>{a==null||a.focusFirst(),l==null||l.setValue(null)};return u.jsx(R.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{"aria-label":i.format("clearAll"),className:C.clearButton,onPress:r,slot:null,isDisabled:e,children:u.jsx(ve.X,{width:20,height:20})})},Xe=({showTags:e,isDisabled:l})=>{const i=_.useLocalizedStringFormatter(E),a=t.useContext(I),r=c=>{a==null||a.selectionManager.toggleSelection(Array.from(c)[0])};return!(a!=null&&a.selectedItems.length)||!e?null:u.jsx(L.TagGroup,{"aria-label":i.format("selectedItems"),className:C.tagGroup,onRemove:r,selectionBehavior:"toggle",children:u.jsx(L.$eaf9e70818b436db$export$f9fef0f55402315b,{items:a.selectedItems,children:c=>u.jsx(L.Tag,{dismissable:!0,id:c.key,isDisabled:l,textValue:c.textValue,children:c.textValue},c.key)})})},Je=({size:e})=>{const l=t.useContext(I);return u.jsx(R.$d2b4bc8c273e7be6$export$353f5b6fc5456de1,{className:he.clsx({[C.medium]:e==="medium"},C.trigger),"data-invalid":!!(l!=null&&l.displayValidation.isInvalid)||void 0,children:u.jsx("span",{"aria-hidden":"true",style:{display:"flex"},children:u.jsx(ye.ChevronDown,{size:20})})})};function Qe({children:e,description:l,errorMessage:i,errorPosition:a="top",items:r,label:c,popover:v,size:o="large",...n}){return u.jsx(Z.$9bf71ea28793e738$export$20e40289641fbbb6,{children:u.jsxs(Ve,{...n,className:w.clsx(n.className,C.select),children:[u.jsx(Q.LabelWrapper,{popover:v,children:c&&u.jsx(Q.Label,{"data-disabled":n.isDisabled||void 0,children:c})}),l&&u.jsx($e.Text,{slot:"description",children:l}),a==="top"&&u.jsx(N.FieldError,{children:i}),u.jsxs("div",{className:C.triggerContainer,"data-disabled":n.isDisabled||void 0,children:[u.jsx(Je,{size:o}),u.jsx(Re,{className:C.selectValue,"data-disabled":n.isDisabled||void 0,children:f=>f.isPlaceholder||n.selectionMode!=="multiple"?u.jsx("div",{className:w.clsx(C.placeholder),children:u.jsx("span",{className:w.clsx(C.truncate),children:f.defaultChildren})}):u.jsx(We,{...n,...f})})]}),a==="bottom"&&u.jsx(N.FieldError,{children:i}),u.jsxs(xe.Popover,{className:C.popover,offset:0,hideArrow:!0,children:[n.isSelectableAll&&u.jsx(Ge,{}),u.jsx(ge.ListBox,{escapeKeyBehavior:"none",items:r,children:e})]}),u.jsx(Xe,{...n})]})})}exports.Select=Qe;
|
|
@@ -31,7 +31,7 @@ import { T as Ne } from "./Text-BBFWBNAH.js";
|
|
|
31
31
|
import { C as Oe } from "./Checkbox-CdN1D5pD.js";
|
|
32
32
|
import { u as k } from "./useLocalizedStringFormatter-aOhh7wdl.js";
|
|
33
33
|
import { X as Le } from "./x-C2xUHAEl.js";
|
|
34
|
-
import { L as ze } from "./ListBox-
|
|
34
|
+
import { L as ze } from "./ListBox-Der0Te-R.js";
|
|
35
35
|
import { P as Ge } from "./Popover-CS8Yyfrq.js";
|
|
36
36
|
import { a as We, $ as He, T as Ue } from "./Tag-DX1X_NZE.js";
|
|
37
37
|
import { c as Xe } from "./clsx-OuTLNxxd.js";
|
package/accordion/Accordion.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DisclosureGroupProps } from 'react-aria-components';
|
|
2
|
+
import { Size } from '../common/types';
|
|
2
3
|
import * as React from 'react';
|
|
3
4
|
export interface MidasAccordion extends DisclosureGroupProps {
|
|
4
5
|
/**
|
|
@@ -9,6 +10,10 @@ export interface MidasAccordion extends DisclosureGroupProps {
|
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
isDisabled?: boolean;
|
|
11
12
|
isContained?: boolean;
|
|
13
|
+
/** Component size when used with `isContained` (large: height 48px, medium: height 40px)
|
|
14
|
+
* @default 'large'
|
|
15
|
+
**/
|
|
16
|
+
size?: Size;
|
|
12
17
|
}
|
|
13
18
|
/**
|
|
14
19
|
* Accordions help reduce visual clutter on a page by organizing content into collapsible sections.
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
import { MidasAccordion } from './Accordion';
|
|
2
|
+
export type AccordionContextValue = Pick<MidasAccordion, 'isContained' | 'size'>;
|
|
4
3
|
export declare const AccordionContext: import('react').Context<AccordionContextValue | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DisclosureProps } from 'react-aria-components';
|
|
2
2
|
import { HeadingProps } from '../heading';
|
|
3
|
-
import { FeedbackStatus } from '../common/types';
|
|
3
|
+
import { FeedbackStatus, Size } from '../common/types';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
interface MidasAccordionItem extends Omit<DisclosureProps, 'children'> {
|
|
6
6
|
/** The text displayed in the collapsed state. If a ReactNode is provided, a heading will not be automatically added, and you must provide one yourself. */
|
|
@@ -16,6 +16,10 @@ interface MidasAccordionItem extends Omit<DisclosureProps, 'children'> {
|
|
|
16
16
|
**/
|
|
17
17
|
hasBackground?: boolean;
|
|
18
18
|
isContained?: boolean;
|
|
19
|
+
/** Component size when used with `isContained` (large: height 48px, medium: height 40px)
|
|
20
|
+
* @default 'large'
|
|
21
|
+
**/
|
|
22
|
+
size?: Size;
|
|
19
23
|
}
|
|
20
24
|
export declare const AccordionItem: React.FC<MidasAccordionItem>;
|
|
21
25
|
export {};
|
package/accordion/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../AccordionItem-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("../AccordionItem-DKE794Si.cjs");exports.Accordion=o.Accordion;exports.AccordionItem=o.AccordionItem;
|
package/accordion/index.js
CHANGED
package/assets/AccordionItem.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
._root_17bdp_1{--gap: .75rem;--heading-color: var(--midas-text-primary);font-family:var(--midas-typography-font-family);color:var(--midas-text-primary);width:100%;display:flex;flex-direction:column;gap:var(--gap)}._root_17bdp_1._contained_17bdp_5{--gap: .25rem}._root_17bdp_1[data-disabled]{--heading-color: var(--midas-text-disabled)}._root_17bdp_1[data-disabled] ._triggerButton_17bdp_12{background:transparent}.
|
|
1
|
+
._root_17bdp_1{--gap: .75rem;--heading-color: var(--midas-text-primary);font-family:var(--midas-typography-font-family);color:var(--midas-text-primary);width:100%;display:flex;flex-direction:column;gap:var(--gap)}._root_17bdp_1._contained_17bdp_5{--gap: .25rem}._root_17bdp_1[data-disabled]{--heading-color: var(--midas-text-disabled)}._root_17bdp_1[data-disabled] ._triggerButton_17bdp_12{background:transparent}._item_bbrk2_1{--item-padding: 0;--content-padding: var(--midas-spacing-20) var(--midas-spacing-50) var(--midas-spacing-50) 1.85rem;--border: none;--accordion-background: transparent;--accordion-background-hover: transparent;--text-color: var(--midas-text-primary);--icon-color: var(--midas-icon-primary);font-family:var(--midas-typography-font-family);color:var(--text-color);background-color:var(--accordion-background);border:var(--border);border-color:var(--border-color)}._contained_bbrk2_18{--gap: var(--midas-spacing-20);--item-padding: calc(var(--midas-spacing-40) - 2px) var(--midas-spacing-40);--content-padding: var(--midas-spacing-40) var(--midas-spacing-50) var(--midas-spacing-50) var(--midas-spacing-50);--border-color: var(--midas-border-color-secondary);--border: 1px solid;--accordion-background: var(--midas-layer-01-base);--accordion-background-hover: var(--midas-layer-01-hover)}._contained_bbrk2_18._medium_bbrk2_28{--item-padding: calc(var(--midas-spacing-30) - 2px) var(--midas-spacing-40)}._success_bbrk2_33{--accordion-background: var(--midas-support-background-success);--accordion-background-hover: var(--midas-support-background-success-hover);--border-color: var(--midas-support-border-success)}._warning_bbrk2_39{--accordion-background: var(--midas-support-background-warning);--accordion-background-hover: var(--midas-support-background-warning-hover);--border-color: var(--midas-support-border-warning)}._info_bbrk2_45{--accordion-background: var(--midas-support-background-info);--accordion-background-hover: var(--midas-support-background-info-hover);--border-color: var(--midas-support-border-info)}._important_bbrk2_51{--accordion-background: var(--midas-support-background-important);--accordion-background-hover: var(--midas-support-background-important-hover);--border-color: var(--midas-support-border-important)}._item_bbrk2_1[data-disabled]{--border-color: var(--midas-border-color-disabled);--icon-color: var(--midas-text-disabled);--text-color: var(--midas-text-disabled)}._item_bbrk2_1[data-disabled] ._triggerButton_bbrk2_62{background:transparent}._item_bbrk2_1[data-disabled] ._triggerText_bbrk2_66{color:var(--midas-text-disabled)}._trigger_bbrk2_62{border:0;cursor:pointer;margin:0;position:relative;z-index:1}._triggerMainContent_bbrk2_79{flex:1 0 0;text-align:left}._triggerText_bbrk2_66{margin:0;padding:0}:not(#_\ _bbrk2_1) ._triggerButton_bbrk2_62{width:100%;padding:var(--item-padding);align-items:flex-start;min-height:unset}._chevronIcon_bbrk2_96{transform:rotate(0);transition:transform var(--midas-transition-duration-normal) ease;padding:var(--midas-spacing-10) 0}._statusIcon_bbrk2_102{color:var(--icon-color);padding:var(--midas-spacing-10) 0}@media (forced-colors: active){._statusIcon_bbrk2_102{color:currentColor}}._triggerButton_bbrk2_62[aria-expanded=true] ._chevronIcon_bbrk2_96{transform:rotate(-180deg);transition:transform var(--midas-transition-duration-normal) ease}._triggerButton_bbrk2_62[data-hovered]{background-color:var(--accordion-background-hover)}._panel_bbrk2_120{height:var(--disclosure-panel-height);transition:height var(--midas-transition-panel-collapse);overflow:clip}._content_bbrk2_128{height:auto;padding:var(--content-padding)}._hasBackground_bbrk2_133{background-color:var(--midas-background-base)}._header_bbrk2_137{margin:0}
|