playbook-ui 18.2.0-alpha.potentialissuesfixed20738 → 18.2.0-alpha.potentialissuesfixed20791

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.
@@ -59,13 +59,13 @@
59
59
  "file": "chunks/StickyLayoutHelper-DCzCcWUN.js",
60
60
  "name": "StickyLayoutHelper"
61
61
  },
62
- "__pagination-BerABFl1.js": {
63
- "file": "chunks/_pagination-BerABFl1.js",
62
+ "__pagination-CARbC_IN.js": {
63
+ "file": "chunks/_pagination-CARbC_IN.js",
64
64
  "name": "_pagination",
65
65
  "imports": [
66
66
  "_globalProps-BivjwRew.js",
67
67
  "_lib-C50eCpoN.js",
68
- "__tooltip-oLlDlk9r.js",
68
+ "__tooltip-UkcgcThO.js",
69
69
  "_quickpickDateSync-DLDx4zce.js"
70
70
  ]
71
71
  },
@@ -77,21 +77,21 @@
77
77
  "_lib-C50eCpoN.js"
78
78
  ]
79
79
  },
80
- "__tooltip-oLlDlk9r.js": {
81
- "file": "chunks/_tooltip-oLlDlk9r.js",
80
+ "__tooltip-UkcgcThO.js": {
81
+ "file": "chunks/_tooltip-UkcgcThO.js",
82
82
  "name": "_tooltip",
83
83
  "imports": [
84
84
  "_globalProps-BivjwRew.js",
85
85
  "_lib-C50eCpoN.js"
86
86
  ]
87
87
  },
88
- "__typeahead-Cyk5N5Po.js": {
89
- "file": "chunks/_typeahead-Cyk5N5Po.js",
88
+ "__typeahead-NYVJDWmJ.js": {
89
+ "file": "chunks/_typeahead-NYVJDWmJ.js",
90
90
  "name": "_typeahead",
91
91
  "imports": [
92
92
  "_lib-C50eCpoN.js",
93
93
  "_globalProps-BivjwRew.js",
94
- "__tooltip-oLlDlk9r.js"
94
+ "__tooltip-UkcgcThO.js"
95
95
  ]
96
96
  },
97
97
  "_componentRegistry-DRSp5D_e.js": {
@@ -144,8 +144,8 @@
144
144
  "entrypoints/playbook-advanced-table.js",
145
145
  "_globalProps-BivjwRew.js",
146
146
  "_lib-C50eCpoN.js",
147
- "__pagination-BerABFl1.js",
148
- "__tooltip-oLlDlk9r.js",
147
+ "__pagination-CARbC_IN.js",
148
+ "__tooltip-UkcgcThO.js",
149
149
  "_quickpickDateSync-DLDx4zce.js",
150
150
  "_StickyLayoutHelper-DCzCcWUN.js"
151
151
  ]
@@ -180,10 +180,10 @@
180
180
  "isEntry": true,
181
181
  "imports": [
182
182
  "_componentRegistry-DRSp5D_e.js",
183
- "__typeahead-Cyk5N5Po.js",
183
+ "__typeahead-NYVJDWmJ.js",
184
184
  "_lib-C50eCpoN.js",
185
185
  "_globalProps-BivjwRew.js",
186
- "__tooltip-oLlDlk9r.js"
186
+ "__tooltip-UkcgcThO.js"
187
187
  ]
188
188
  },
189
189
  "entrypoints/playbook-rails.js": {
@@ -193,13 +193,13 @@
193
193
  "isEntry": true,
194
194
  "imports": [
195
195
  "_lib-C50eCpoN.js",
196
- "__typeahead-Cyk5N5Po.js",
196
+ "__typeahead-NYVJDWmJ.js",
197
197
  "_time_picker_helper-DfKvHCJu.js",
198
198
  "_quickpickDateSync-DLDx4zce.js",
199
199
  "_StickyLayoutHelper-DCzCcWUN.js",
200
200
  "entrypoints/playbook-rails-react-bindings.js",
201
201
  "_globalProps-BivjwRew.js",
202
- "__tooltip-oLlDlk9r.js",
202
+ "__tooltip-UkcgcThO.js",
203
203
  "_componentRegistry-DRSp5D_e.js"
204
204
  ],
205
205
  "dynamicImports": [
@@ -218,10 +218,10 @@
218
218
  "src": "entrypoints/playbook.js",
219
219
  "isEntry": true,
220
220
  "imports": [
221
- "__tooltip-oLlDlk9r.js",
222
- "__typeahead-Cyk5N5Po.js",
221
+ "__tooltip-UkcgcThO.js",
222
+ "__typeahead-NYVJDWmJ.js",
223
223
  "entrypoints/playbook.js",
224
- "__pagination-BerABFl1.js",
224
+ "__pagination-CARbC_IN.js",
225
225
  "_lib-C50eCpoN.js",
226
226
  "_globalProps-BivjwRew.js",
227
227
  "_time_picker_helper-DfKvHCJu.js",
@@ -237,13 +237,5 @@
237
237
  "file": "reset.css",
238
238
  "src": "entrypoints/reset.scss",
239
239
  "isEntry": true
240
- },
241
- "pb_kits/playbook/pb_phone_number_input/img/flags.webp": {
242
- "file": "assets/flags.webp",
243
- "src": "pb_kits/playbook/pb_phone_number_input/img/flags.webp"
244
- },
245
- "pb_kits/playbook/pb_phone_number_input/img/flags@2x.webp": {
246
- "file": "assets/flags@2x.webp",
247
- "src": "pb_kits/playbook/pb_phone_number_input/img/flags@2x.webp"
248
240
  }
249
241
  }
@@ -1,4 +1,4 @@
1
- import{jsx,jsxs,Fragment}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useRef,useState,useCallback,useEffect,useMemo,useContext,useLayoutEffect}from"react";import{d as classnames,e as buildCss,g as globalProps,b as buildAriaProps,a as buildDataProps,c as buildHtmlProps}from"./chunks/globalProps-BivjwRew.js";import{C as Checkbox,P as PbReactPopover,S as SectionSeparator,L as LoadingInline,a as Pagination,F as FlexItem,T as Table}from"./chunks/_pagination-BerABFl1.js";import{flushSync}from"react-dom";import{m as measureElementHeight,s as scheduleStickyActionBarHeightUpdate,b as updateStickyLayoutHeights}from"./chunks/StickyLayoutHelper-DCzCcWUN.js";import{I as Icon,F as Flex,C as Caption,D as Detail,a as Card,T as Tooltip}from"./chunks/_tooltip-oLlDlk9r.js";import"./chunks/lib-C50eCpoN.js";import"./chunks/quickpickDateSync-DLDx4zce.js";function memo$1(getDeps,fn,opts){let deps=opts.initialDeps??[];let result;return()=>{var _a,_b,_c,_d;let depTime;if(opts.key&&((_a=opts.debug)==null?void 0:_a.call(opts)))depTime=Date.now();const newDeps=getDeps();const depsChanged=newDeps.length!==deps.length||newDeps.some(((dep,index)=>deps[index]!==dep));if(!depsChanged){return result}deps=newDeps;let resultTime;if(opts.key&&((_b=opts.debug)==null?void 0:_b.call(opts)))resultTime=Date.now();result=fn(...newDeps);if(opts.key&&((_c=opts.debug)==null?void 0:_c.call(opts))){const depEndTime=Math.round((Date.now()-depTime)*100)/100;const resultEndTime=Math.round((Date.now()-resultTime)*100)/100;const resultFpsPercentage=resultEndTime/16;const pad=(str,num)=>{str=String(str);while(str.length<num){str=" "+str}return str};console.info(`%c⏱ ${pad(resultEndTime,5)} /${pad(depEndTime,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*resultFpsPercentage,120))}deg 100% 31%);`,opts==null?void 0:opts.key)}(_d=opts==null?void 0:opts.onChange)==null?void 0:_d.call(opts,result);return result}}function notUndefined(value,msg){if(value===void 0){throw new Error(`Unexpected undefined${""}`)}else{return value}}const approxEqual=(a,b)=>Math.abs(a-b)<1;const debounce=(targetWindow,fn,ms)=>{let timeoutId;return function(...args){targetWindow.clearTimeout(timeoutId);timeoutId=targetWindow.setTimeout((()=>fn.apply(this,args)),ms)}};const defaultKeyExtractor=index=>index;const defaultRangeExtractor=range=>{const start=Math.max(range.startIndex-range.overscan,0);const end=Math.min(range.endIndex+range.overscan,range.count-1);const arr=[];for(let i=start;i<=end;i++){arr.push(i)}return arr};const observeElementRect=(instance,cb)=>{const element=instance.scrollElement;if(!element){return}const targetWindow=instance.targetWindow;if(!targetWindow){return}const handler=rect=>{const{width:width,height:height}=rect;cb({width:Math.round(width),height:Math.round(height)})};handler(element.getBoundingClientRect());if(!targetWindow.ResizeObserver){return()=>{}}const observer=new targetWindow.ResizeObserver((entries=>{const run=()=>{const entry=entries[0];if(entry==null?void 0:entry.borderBoxSize){const box=entry.borderBoxSize[0];if(box){handler({width:box.inlineSize,height:box.blockSize});return}}handler(element.getBoundingClientRect())};instance.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(run):run()}));observer.observe(element,{box:"border-box"});return()=>{observer.unobserve(element)}};const addEventListenerOptions={passive:true};const supportsScrollend=typeof window=="undefined"?true:"onscrollend"in window;const observeElementOffset=(instance,cb)=>{const element=instance.scrollElement;if(!element){return}const targetWindow=instance.targetWindow;if(!targetWindow){return}let offset=0;const fallback=instance.options.useScrollendEvent&&supportsScrollend?()=>void 0:debounce(targetWindow,(()=>{cb(offset,false)}),instance.options.isScrollingResetDelay);const createHandler=isScrolling=>()=>{const{horizontal:horizontal,isRtl:isRtl}=instance.options;offset=horizontal?element["scrollLeft"]*(isRtl&&-1||1):element["scrollTop"];fallback();cb(offset,isScrolling)};const handler=createHandler(true);const endHandler=createHandler(false);endHandler();element.addEventListener("scroll",handler,addEventListenerOptions);const registerScrollendEvent=instance.options.useScrollendEvent&&supportsScrollend;if(registerScrollendEvent){element.addEventListener("scrollend",endHandler,addEventListenerOptions)}return()=>{element.removeEventListener("scroll",handler);if(registerScrollendEvent){element.removeEventListener("scrollend",endHandler)}}};const measureElement=(element,entry,instance)=>{if(entry==null?void 0:entry.borderBoxSize){const box=entry.borderBoxSize[0];if(box){const size=Math.round(box[instance.options.horizontal?"inlineSize":"blockSize"]);return size}}return Math.round(element.getBoundingClientRect()[instance.options.horizontal?"width":"height"])};const elementScroll=(offset,{adjustments:adjustments=0,behavior:behavior},instance)=>{var _a,_b;const toOffset=offset+adjustments;(_b=(_a=instance.scrollElement)==null?void 0:_a.scrollTo)==null?void 0:_b.call(_a,{[instance.options.horizontal?"left":"top"]:toOffset,behavior:behavior})};class Virtualizer{constructor(opts){this.unsubs=[];this.scrollElement=null;this.targetWindow=null;this.isScrolling=false;this.scrollToIndexTimeoutId=null;this.measurementsCache=[];this.itemSizeCache=new Map;this.pendingMeasuredCacheIndexes=[];this.scrollRect=null;this.scrollOffset=null;this.scrollDirection=null;this.scrollAdjustments=0;this.elementsCache=new Map;this.observer=(()=>{let _ro=null;const get=()=>{if(_ro){return _ro}if(!this.targetWindow||!this.targetWindow.ResizeObserver){return null}return _ro=new this.targetWindow.ResizeObserver((entries=>{entries.forEach((entry=>{const run=()=>{this._measureElement(entry.target,entry)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(run):run()}))}))};return{disconnect:()=>{var _a;(_a=get())==null?void 0:_a.disconnect();_ro=null},observe:target=>{var _a;return(_a=get())==null?void 0:_a.observe(target,{box:"border-box"})},unobserve:target=>{var _a;return(_a=get())==null?void 0:_a.unobserve(target)}}})();this.range=null;this.setOptions=opts2=>{Object.entries(opts2).forEach((([key,value])=>{if(typeof value==="undefined")delete opts2[key]}));this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:defaultKeyExtractor,rangeExtractor:defaultRangeExtractor,onChange:()=>{},measureElement:measureElement,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,useAnimationFrameWithResizeObserver:false,...opts2}};this.notify=sync=>{var _a,_b;(_b=(_a=this.options).onChange)==null?void 0:_b.call(_a,this,sync)};this.maybeNotify=memo$1((()=>{this.calculateRange();return[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),(isScrolling=>{this.notify(isScrolling)}),{key:false,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]});this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((d=>d()));this.unsubs=[];this.observer.disconnect();this.scrollElement=null;this.targetWindow=null};this._didMount=()=>()=>{this.cleanup()};this._willUpdate=()=>{var _a;const scrollElement=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==scrollElement){this.cleanup();if(!scrollElement){this.maybeNotify();return}this.scrollElement=scrollElement;if(this.scrollElement&&"ownerDocument"in this.scrollElement){this.targetWindow=this.scrollElement.ownerDocument.defaultView}else{this.targetWindow=((_a=this.scrollElement)==null?void 0:_a.window)??null}this.elementsCache.forEach((cached=>{this.observer.observe(cached)}));this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0});this.unsubs.push(this.options.observeElementRect(this,(rect=>{this.scrollRect=rect;this.maybeNotify()})));this.unsubs.push(this.options.observeElementOffset(this,((offset,isScrolling)=>{this.scrollAdjustments=0;this.scrollDirection=isScrolling?this.getScrollOffset()<offset?"forward":"backward":null;this.scrollOffset=offset;this.isScrolling=isScrolling;this.maybeNotify()})))}};this.getSize=()=>{if(!this.options.enabled){this.scrollRect=null;return 0}this.scrollRect=this.scrollRect??this.options.initialRect;return this.scrollRect[this.options.horizontal?"width":"height"]};this.getScrollOffset=()=>{if(!this.options.enabled){this.scrollOffset=null;return 0}this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==="function"?this.options.initialOffset():this.options.initialOffset);return this.scrollOffset};this.getFurthestMeasurement=(measurements,index)=>{const furthestMeasurementsFound=new Map;const furthestMeasurements=new Map;for(let m=index-1;m>=0;m--){const measurement=measurements[m];if(furthestMeasurementsFound.has(measurement.lane)){continue}const previousFurthestMeasurement=furthestMeasurements.get(measurement.lane);if(previousFurthestMeasurement==null||measurement.end>previousFurthestMeasurement.end){furthestMeasurements.set(measurement.lane,measurement)}else if(measurement.end<previousFurthestMeasurement.end){furthestMeasurementsFound.set(measurement.lane,true)}if(furthestMeasurementsFound.size===this.options.lanes){break}}return furthestMeasurements.size===this.options.lanes?Array.from(furthestMeasurements.values()).sort(((a,b)=>{if(a.end===b.end){return a.index-b.index}return a.end-b.end}))[0]:void 0};this.getMeasurementOptions=memo$1((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((count2,paddingStart,scrollMargin,getItemKey,enabled)=>{this.pendingMeasuredCacheIndexes=[];return{count:count2,paddingStart:paddingStart,scrollMargin:scrollMargin,getItemKey:getItemKey,enabled:enabled}}),{key:false});this.getMeasurements=memo$1((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:count2,paddingStart:paddingStart,scrollMargin:scrollMargin,getItemKey:getItemKey,enabled:enabled},itemSizeCache)=>{if(!enabled){this.measurementsCache=[];this.itemSizeCache.clear();return[]}if(this.measurementsCache.length===0){this.measurementsCache=this.options.initialMeasurementsCache;this.measurementsCache.forEach((item=>{this.itemSizeCache.set(item.key,item.size)}))}const min2=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const measurements=this.measurementsCache.slice(0,min2);for(let i=min2;i<count2;i++){const key=getItemKey(i);const furthestMeasurement=this.options.lanes===1?measurements[i-1]:this.getFurthestMeasurement(measurements,i);const start=furthestMeasurement?furthestMeasurement.end+this.options.gap:paddingStart+scrollMargin;const measuredSize=itemSizeCache.get(key);const size=typeof measuredSize==="number"?measuredSize:this.options.estimateSize(i);const end=start+size;const lane=furthestMeasurement?furthestMeasurement.lane:i%this.options.lanes;measurements[i]={index:i,start:start,size:size,end:end,key:key,lane:lane}}this.measurementsCache=measurements;return measurements}),{key:false,debug:()=>this.options.debug});this.calculateRange=memo$1((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()]),((measurements,outerSize,scrollOffset)=>this.range=measurements.length>0&&outerSize>0?calculateRange({measurements:measurements,outerSize:outerSize,scrollOffset:scrollOffset}):null),{key:false,debug:()=>this.options.debug});this.getVirtualIndexes=memo$1((()=>{let startIndex=null;let endIndex=null;const range=this.calculateRange();if(range){startIndex=range.startIndex;endIndex=range.endIndex}return[this.options.rangeExtractor,this.options.overscan,this.options.count,startIndex,endIndex]}),((rangeExtractor,overscan,count2,startIndex,endIndex)=>startIndex===null||endIndex===null?[]:rangeExtractor({startIndex:startIndex,endIndex:endIndex,overscan:overscan,count:count2})),{key:false,debug:()=>this.options.debug});this.indexFromElement=node=>{const attributeName=this.options.indexAttribute;const indexStr=node.getAttribute(attributeName);if(!indexStr){console.warn(`Missing attribute name '${attributeName}={index}' on measured element.`);return-1}return parseInt(indexStr,10)};this._measureElement=(node,entry)=>{const index=this.indexFromElement(node);const item=this.measurementsCache[index];if(!item){return}const key=item.key;const prevNode=this.elementsCache.get(key);if(prevNode!==node){if(prevNode){this.observer.unobserve(prevNode)}this.observer.observe(node);this.elementsCache.set(key,node)}if(node.isConnected){this.resizeItem(index,this.options.measureElement(node,entry,this))}};this.resizeItem=(index,size)=>{const item=this.measurementsCache[index];if(!item){return}const itemSize=this.itemSizeCache.get(item.key)??item.size;const delta=size-itemSize;if(delta!==0){if(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(item,delta,this):item.start<this.getScrollOffset()+this.scrollAdjustments){this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=delta,behavior:void 0})}this.pendingMeasuredCacheIndexes.push(item.index);this.itemSizeCache=new Map(this.itemSizeCache.set(item.key,size));this.notify(false)}};this.measureElement=node=>{if(!node){this.elementsCache.forEach(((cached,key)=>{if(!cached.isConnected){this.observer.unobserve(cached);this.elementsCache.delete(key)}}));return}this._measureElement(node,void 0)};this.getVirtualItems=memo$1((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((indexes,measurements)=>{const virtualItems=[];for(let k=0,len=indexes.length;k<len;k++){const i=indexes[k];const measurement=measurements[i];virtualItems.push(measurement)}return virtualItems}),{key:false,debug:()=>this.options.debug});this.getVirtualItemForOffset=offset=>{const measurements=this.getMeasurements();if(measurements.length===0){return void 0}return notUndefined(measurements[findNearestBinarySearch(0,measurements.length-1,(index=>notUndefined(measurements[index]).start),offset)])};this.getOffsetForAlignment=(toOffset,align)=>{const size=this.getSize();const scrollOffset=this.getScrollOffset();if(align==="auto"){if(toOffset>=scrollOffset+size){align="end"}}if(align==="end"){toOffset-=size}const scrollSizeProp=this.options.horizontal?"scrollWidth":"scrollHeight";const scrollSize=this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[scrollSizeProp]:this.scrollElement[scrollSizeProp]:0;const maxOffset=scrollSize-size;return Math.max(Math.min(maxOffset,toOffset),0)};this.getOffsetForIndex=(index,align="auto")=>{index=Math.max(0,Math.min(index,this.options.count-1));const item=this.measurementsCache[index];if(!item){return void 0}const size=this.getSize();const scrollOffset=this.getScrollOffset();if(align==="auto"){if(item.end>=scrollOffset+size-this.options.scrollPaddingEnd){align="end"}else if(item.start<=scrollOffset+this.options.scrollPaddingStart){align="start"}else{return[scrollOffset,align]}}const centerOffset=item.start-this.options.scrollPaddingStart+(item.size-size)/2;switch(align){case"center":return[this.getOffsetForAlignment(centerOffset,align),align];case"end":return[this.getOffsetForAlignment(item.end+this.options.scrollPaddingEnd,align),align];default:return[this.getOffsetForAlignment(item.start-this.options.scrollPaddingStart,align),align]}};this.isDynamicMode=()=>this.elementsCache.size>0;this.cancelScrollToIndex=()=>{if(this.scrollToIndexTimeoutId!==null&&this.targetWindow){this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);this.scrollToIndexTimeoutId=null}};this.scrollToOffset=(toOffset,{align:align="start",behavior:behavior}={})=>{this.cancelScrollToIndex();if(behavior==="smooth"&&this.isDynamicMode()){console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.")}this._scrollToOffset(this.getOffsetForAlignment(toOffset,align),{adjustments:void 0,behavior:behavior})};this.scrollToIndex=(index,{align:initialAlign="auto",behavior:behavior}={})=>{index=Math.max(0,Math.min(index,this.options.count-1));this.cancelScrollToIndex();if(behavior==="smooth"&&this.isDynamicMode()){console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.")}const offsetAndAlign=this.getOffsetForIndex(index,initialAlign);if(!offsetAndAlign)return;const[offset,align]=offsetAndAlign;this._scrollToOffset(offset,{adjustments:void 0,behavior:behavior});if(behavior!=="smooth"&&this.isDynamicMode()&&this.targetWindow){this.scrollToIndexTimeoutId=this.targetWindow.setTimeout((()=>{this.scrollToIndexTimeoutId=null;const elementInDOM=this.elementsCache.has(this.options.getItemKey(index));if(elementInDOM){const[latestOffset]=notUndefined(this.getOffsetForIndex(index,align));if(!approxEqual(latestOffset,this.getScrollOffset())){this.scrollToIndex(index,{align:align,behavior:behavior})}}else{this.scrollToIndex(index,{align:align,behavior:behavior})}}))}};this.scrollBy=(delta,{behavior:behavior}={})=>{this.cancelScrollToIndex();if(behavior==="smooth"&&this.isDynamicMode()){console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.")}this._scrollToOffset(this.getScrollOffset()+delta,{adjustments:void 0,behavior:behavior})};this.getTotalSize=()=>{var _a;const measurements=this.getMeasurements();let end;if(measurements.length===0){end=this.options.paddingStart}else{end=this.options.lanes===1?((_a=measurements[measurements.length-1])==null?void 0:_a.end)??0:Math.max(...measurements.slice(-this.options.lanes).map((m=>m.end)))}return Math.max(end-this.options.scrollMargin+this.options.paddingEnd,0)};this._scrollToOffset=(offset,{adjustments:adjustments,behavior:behavior})=>{this.options.scrollToFn(offset,{behavior:behavior,adjustments:adjustments},this)};this.measure=()=>{this.itemSizeCache=new Map;this.notify(false)};this.setOptions(opts)}}const findNearestBinarySearch=(low,high,getCurrentValue,value)=>{while(low<=high){const middle=(low+high)/2|0;const currentValue=getCurrentValue(middle);if(currentValue<value){low=middle+1}else if(currentValue>value){high=middle-1}else{return middle}}if(low>0){return low-1}else{return 0}};function calculateRange({measurements:measurements,outerSize:outerSize,scrollOffset:scrollOffset}){const count2=measurements.length-1;const getOffset=index=>measurements[index].start;const startIndex=findNearestBinarySearch(0,count2,getOffset,scrollOffset);let endIndex=startIndex;while(endIndex<count2&&measurements[endIndex].end<scrollOffset+outerSize){endIndex++}return{startIndex:startIndex,endIndex:endIndex}}const useIsomorphicLayoutEffect=typeof document!=="undefined"?React.useLayoutEffect:React.useEffect;function useVirtualizerBase(options){const rerender=React.useReducer((()=>({})),{})[1];const resolvedOptions={...options,onChange:(instance2,sync)=>{var _a;if(sync){flushSync(rerender)}else{rerender()}(_a=options.onChange)==null?void 0:_a.call(options,instance2,sync)}};const[instance]=React.useState((()=>new Virtualizer(resolvedOptions)));instance.setOptions(resolvedOptions);useIsomorphicLayoutEffect((()=>instance._didMount()),[]);useIsomorphicLayoutEffect((()=>instance._willUpdate()));return instance}function useVirtualizer(options){return useVirtualizerBase({observeElementRect:observeElementRect,observeElementOffset:observeElementOffset,scrollToFn:elementScroll,...options})}const getVirtualizedContainerStyles=maxHeight=>{let heightValue="600px";if(maxHeight){switch(maxHeight){case"xs":heightValue="200px";break;case"sm":heightValue="300px";break;case"md":heightValue="400px";break;case"lg":heightValue="500px";break;case"xl":heightValue="600px";break;case"xxl":heightValue="700px";break;case"xxxl":heightValue="800px";break;default:if(maxHeight!=="auto"){heightValue=maxHeight}}}return{overflow:"auto",position:"relative",height:heightValue,width:"100%"}};const getVirtualizedRowStyle=startPosition=>({position:"absolute",top:0,left:0,height:"40px",transform:`translateY(${startPosition}px)`,tableLayout:"fixed"});const getRowHeightEstimate=rowType=>{switch(rowType){case"header":return 40;case"loading":return 30;case"footer":return 40;case"row":default:return 40}};const AdvancedTableContext=createContext({});const AdvancedTableProvider=({children:children,...props})=>{var _a;const tableContainerRef=useRef(null);const containerRef=props.tableContainerRef||tableContainerRef;const table=props.table;const isVirtualized=props.virtualizedRows||props.enableVirtualization;const headerRef=useRef(null);const sampleRowRef=useRef(null);const[headerHeight,setHeaderHeight]=useState(44);const[rowHeight,setRowHeight]=useState(38);const[actionBarHeight,setActionBarHeight]=useState(0);const measureHeights=useCallback((()=>{var _a2;const wrapper=((_a2=props.tableContainerRef)==null?void 0:_a2.current)||tableContainerRef.current;if(headerRef.current){const headerElement=headerRef.current;const headerRect=headerElement.getBoundingClientRect();if(headerRect.height>0){setHeaderHeight(headerRect.height)}}if(sampleRowRef.current){const rowRect=sampleRowRef.current.getBoundingClientRect();if(rowRect.height>0){setRowHeight(rowRect.height)}}if(wrapper){const actionBar=wrapper.querySelector(".row-selection-actions-card.is-visible, .row-selection-actions-card.show-action-card");const measuredActionBarHeight=actionBar?measureElementHeight(actionBar):0;setActionBarHeight(measuredActionBarHeight);wrapper.style.setProperty("--advanced-table-action-bar-height",`${measuredActionBarHeight}px`)}}),[props.tableContainerRef]);useEffect((()=>{var _a2;const resizeObserver=new ResizeObserver((()=>{measureHeights()}));if(headerRef.current){resizeObserver.observe(headerRef.current)}const wrapper=((_a2=props.tableContainerRef)==null?void 0:_a2.current)||tableContainerRef.current;const actionBar=wrapper==null?void 0:wrapper.querySelector(".row-selection-actions-card");if(actionBar){resizeObserver.observe(actionBar)}if(sampleRowRef.current){resizeObserver.observe(sampleRowRef.current)}const timeoutId=setTimeout(measureHeights,100);return()=>{resizeObserver.disconnect();clearTimeout(timeoutId)}}),[measureHeights]);const headerGroupCount=((_a=table==null?void 0:table.getHeaderGroups())==null?void 0:_a.length)??0;useEffect((()=>{measureHeights()}),[table==null?void 0:table.getRowModel().rows.length,headerGroupCount,props.isActionBarVisible,measureHeights]);const flattenedItems=useMemo((()=>{if(!isVirtualized||!table){return[]}const tableRows=table.getRowModel().rows;const items=[];const subRowHeaders=props.subRowHeaders;const inlineRowLoading=props.inlineRowLoading;const columnDefinitions=props.columnDefinitions;tableRows.forEach(((row,index)=>{var _a2,_b,_c;const isFirstChildofSubrow=row.depth>0&&row.index===0;if(isFirstChildofSubrow&&subRowHeaders){items.push({type:"header",row:row,id:`header-${row.id}-${index}`})}items.push({type:"row",row:row,id:`row-${row.id}-${index}`});const isExpandable=row.getIsExpanded();const rowHasNoChildren=((_a2=row.original)==null?void 0:_a2.children)&&!row.original.children.length?true:false;const isDataLoading=isExpandable&&(inlineRowLoading&&rowHasNoChildren)&&row.depth<(((_c=(_b=columnDefinitions[0])==null?void 0:_b.cellAccessors)==null?void 0:_c.length)||0);if(isDataLoading){items.push({type:"loading",row:row,id:`loading-${row.id}-${index}`})}}));const isFetching=props.isFetching||false;const shouldAddFooter=table&&!isFetching&&tableRows.length>0;if(shouldAddFooter){items.push({type:"footer",row:{},id:`footer-row`})}return items}),[isVirtualized,table,props.subRowHeaders,props.inlineRowLoading,props.columnDefinitions,table==null?void 0:table.getRowModel().rows.length,JSON.stringify((table==null?void 0:table.getState().sorting)||[]),JSON.stringify((table==null?void 0:table.getState().expanded)||{})]);const virtualizer=useVirtualizer({count:isVirtualized&&flattenedItems.length>0?flattenedItems.length:0,getScrollElement:()=>containerRef.current,estimateSize:index=>{if(!isVirtualized||flattenedItems.length===0)return 0;const item=flattenedItems[index];if(!item)return getRowHeightEstimate("row");return getRowHeightEstimate(item.type)},overscan:10,getItemKey:index=>{var _a2;if(!isVirtualized||flattenedItems.length===0||index>=flattenedItems.length){return`item-${index}`}return((_a2=flattenedItems[index])==null?void 0:_a2.id)||`item-${index}`}});useEffect((()=>{if(isVirtualized&&virtualizer&&table&&containerRef.current){virtualizer.setOptions({...virtualizer.options,count:flattenedItems.length});virtualizer.measure()}}),[isVirtualized,virtualizer,table,containerRef,JSON.stringify((table==null?void 0:table.getState().sorting)||[]),JSON.stringify((table==null?void 0:table.getState().expanded)||{}),flattenedItems.length]);const contextValue={...props,table:table,tableContainerRef:containerRef,virtualizer:isVirtualized?virtualizer:null,flattenedItems:flattenedItems,virtualizedRows:isVirtualized,enableVirtualization:isVirtualized,rowPinning:props.rowPinning,setRowPinning:props.setRowPinning,keepPinnedRows:props.keepPinnedRows,headerHeight:headerHeight,rowHeight:rowHeight,actionBarHeight:actionBarHeight,headerRef:headerRef,sampleRowRef:sampleRowRef,measureHeights:measureHeights};return jsx(AdvancedTableContext.Provider,{value:contextValue,children:children})};
1
+ import{jsx,jsxs,Fragment}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useRef,useState,useCallback,useEffect,useMemo,useContext,useLayoutEffect}from"react";import{d as classnames,e as buildCss,g as globalProps,b as buildAriaProps,a as buildDataProps,c as buildHtmlProps}from"./chunks/globalProps-BivjwRew.js";import{C as Checkbox,P as PbReactPopover,S as SectionSeparator,L as LoadingInline,a as Pagination,F as FlexItem,T as Table}from"./chunks/_pagination-CARbC_IN.js";import{flushSync}from"react-dom";import{m as measureElementHeight,s as scheduleStickyActionBarHeightUpdate,b as updateStickyLayoutHeights}from"./chunks/StickyLayoutHelper-DCzCcWUN.js";import{I as Icon,F as Flex,C as Caption,D as Detail,a as Card,T as Tooltip}from"./chunks/_tooltip-UkcgcThO.js";import"./chunks/lib-C50eCpoN.js";import"./chunks/quickpickDateSync-DLDx4zce.js";function memo$1(getDeps,fn,opts){let deps=opts.initialDeps??[];let result;return()=>{var _a,_b,_c,_d;let depTime;if(opts.key&&((_a=opts.debug)==null?void 0:_a.call(opts)))depTime=Date.now();const newDeps=getDeps();const depsChanged=newDeps.length!==deps.length||newDeps.some(((dep,index)=>deps[index]!==dep));if(!depsChanged){return result}deps=newDeps;let resultTime;if(opts.key&&((_b=opts.debug)==null?void 0:_b.call(opts)))resultTime=Date.now();result=fn(...newDeps);if(opts.key&&((_c=opts.debug)==null?void 0:_c.call(opts))){const depEndTime=Math.round((Date.now()-depTime)*100)/100;const resultEndTime=Math.round((Date.now()-resultTime)*100)/100;const resultFpsPercentage=resultEndTime/16;const pad=(str,num)=>{str=String(str);while(str.length<num){str=" "+str}return str};console.info(`%c⏱ ${pad(resultEndTime,5)} /${pad(depEndTime,5)} ms`,`\n font-size: .6rem;\n font-weight: bold;\n color: hsl(${Math.max(0,Math.min(120-120*resultFpsPercentage,120))}deg 100% 31%);`,opts==null?void 0:opts.key)}(_d=opts==null?void 0:opts.onChange)==null?void 0:_d.call(opts,result);return result}}function notUndefined(value,msg){if(value===void 0){throw new Error(`Unexpected undefined${""}`)}else{return value}}const approxEqual=(a,b)=>Math.abs(a-b)<1;const debounce=(targetWindow,fn,ms)=>{let timeoutId;return function(...args){targetWindow.clearTimeout(timeoutId);timeoutId=targetWindow.setTimeout((()=>fn.apply(this,args)),ms)}};const defaultKeyExtractor=index=>index;const defaultRangeExtractor=range=>{const start=Math.max(range.startIndex-range.overscan,0);const end=Math.min(range.endIndex+range.overscan,range.count-1);const arr=[];for(let i=start;i<=end;i++){arr.push(i)}return arr};const observeElementRect=(instance,cb)=>{const element=instance.scrollElement;if(!element){return}const targetWindow=instance.targetWindow;if(!targetWindow){return}const handler=rect=>{const{width:width,height:height}=rect;cb({width:Math.round(width),height:Math.round(height)})};handler(element.getBoundingClientRect());if(!targetWindow.ResizeObserver){return()=>{}}const observer=new targetWindow.ResizeObserver((entries=>{const run=()=>{const entry=entries[0];if(entry==null?void 0:entry.borderBoxSize){const box=entry.borderBoxSize[0];if(box){handler({width:box.inlineSize,height:box.blockSize});return}}handler(element.getBoundingClientRect())};instance.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(run):run()}));observer.observe(element,{box:"border-box"});return()=>{observer.unobserve(element)}};const addEventListenerOptions={passive:true};const supportsScrollend=typeof window=="undefined"?true:"onscrollend"in window;const observeElementOffset=(instance,cb)=>{const element=instance.scrollElement;if(!element){return}const targetWindow=instance.targetWindow;if(!targetWindow){return}let offset=0;const fallback=instance.options.useScrollendEvent&&supportsScrollend?()=>void 0:debounce(targetWindow,(()=>{cb(offset,false)}),instance.options.isScrollingResetDelay);const createHandler=isScrolling=>()=>{const{horizontal:horizontal,isRtl:isRtl}=instance.options;offset=horizontal?element["scrollLeft"]*(isRtl&&-1||1):element["scrollTop"];fallback();cb(offset,isScrolling)};const handler=createHandler(true);const endHandler=createHandler(false);endHandler();element.addEventListener("scroll",handler,addEventListenerOptions);const registerScrollendEvent=instance.options.useScrollendEvent&&supportsScrollend;if(registerScrollendEvent){element.addEventListener("scrollend",endHandler,addEventListenerOptions)}return()=>{element.removeEventListener("scroll",handler);if(registerScrollendEvent){element.removeEventListener("scrollend",endHandler)}}};const measureElement=(element,entry,instance)=>{if(entry==null?void 0:entry.borderBoxSize){const box=entry.borderBoxSize[0];if(box){const size=Math.round(box[instance.options.horizontal?"inlineSize":"blockSize"]);return size}}return Math.round(element.getBoundingClientRect()[instance.options.horizontal?"width":"height"])};const elementScroll=(offset,{adjustments:adjustments=0,behavior:behavior},instance)=>{var _a,_b;const toOffset=offset+adjustments;(_b=(_a=instance.scrollElement)==null?void 0:_a.scrollTo)==null?void 0:_b.call(_a,{[instance.options.horizontal?"left":"top"]:toOffset,behavior:behavior})};class Virtualizer{constructor(opts){this.unsubs=[];this.scrollElement=null;this.targetWindow=null;this.isScrolling=false;this.scrollToIndexTimeoutId=null;this.measurementsCache=[];this.itemSizeCache=new Map;this.pendingMeasuredCacheIndexes=[];this.scrollRect=null;this.scrollOffset=null;this.scrollDirection=null;this.scrollAdjustments=0;this.elementsCache=new Map;this.observer=(()=>{let _ro=null;const get=()=>{if(_ro){return _ro}if(!this.targetWindow||!this.targetWindow.ResizeObserver){return null}return _ro=new this.targetWindow.ResizeObserver((entries=>{entries.forEach((entry=>{const run=()=>{this._measureElement(entry.target,entry)};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(run):run()}))}))};return{disconnect:()=>{var _a;(_a=get())==null?void 0:_a.disconnect();_ro=null},observe:target=>{var _a;return(_a=get())==null?void 0:_a.observe(target,{box:"border-box"})},unobserve:target=>{var _a;return(_a=get())==null?void 0:_a.unobserve(target)}}})();this.range=null;this.setOptions=opts2=>{Object.entries(opts2).forEach((([key,value])=>{if(typeof value==="undefined")delete opts2[key]}));this.options={debug:false,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:false,getItemKey:defaultKeyExtractor,rangeExtractor:defaultRangeExtractor,onChange:()=>{},measureElement:measureElement,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:true,isRtl:false,useScrollendEvent:true,useAnimationFrameWithResizeObserver:false,...opts2}};this.notify=sync=>{var _a,_b;(_b=(_a=this.options).onChange)==null?void 0:_b.call(_a,this,sync)};this.maybeNotify=memo$1((()=>{this.calculateRange();return[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),(isScrolling=>{this.notify(isScrolling)}),{key:false,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]});this.cleanup=()=>{this.unsubs.filter(Boolean).forEach((d=>d()));this.unsubs=[];this.observer.disconnect();this.scrollElement=null;this.targetWindow=null};this._didMount=()=>()=>{this.cleanup()};this._willUpdate=()=>{var _a;const scrollElement=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==scrollElement){this.cleanup();if(!scrollElement){this.maybeNotify();return}this.scrollElement=scrollElement;if(this.scrollElement&&"ownerDocument"in this.scrollElement){this.targetWindow=this.scrollElement.ownerDocument.defaultView}else{this.targetWindow=((_a=this.scrollElement)==null?void 0:_a.window)??null}this.elementsCache.forEach((cached=>{this.observer.observe(cached)}));this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0});this.unsubs.push(this.options.observeElementRect(this,(rect=>{this.scrollRect=rect;this.maybeNotify()})));this.unsubs.push(this.options.observeElementOffset(this,((offset,isScrolling)=>{this.scrollAdjustments=0;this.scrollDirection=isScrolling?this.getScrollOffset()<offset?"forward":"backward":null;this.scrollOffset=offset;this.isScrolling=isScrolling;this.maybeNotify()})))}};this.getSize=()=>{if(!this.options.enabled){this.scrollRect=null;return 0}this.scrollRect=this.scrollRect??this.options.initialRect;return this.scrollRect[this.options.horizontal?"width":"height"]};this.getScrollOffset=()=>{if(!this.options.enabled){this.scrollOffset=null;return 0}this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==="function"?this.options.initialOffset():this.options.initialOffset);return this.scrollOffset};this.getFurthestMeasurement=(measurements,index)=>{const furthestMeasurementsFound=new Map;const furthestMeasurements=new Map;for(let m=index-1;m>=0;m--){const measurement=measurements[m];if(furthestMeasurementsFound.has(measurement.lane)){continue}const previousFurthestMeasurement=furthestMeasurements.get(measurement.lane);if(previousFurthestMeasurement==null||measurement.end>previousFurthestMeasurement.end){furthestMeasurements.set(measurement.lane,measurement)}else if(measurement.end<previousFurthestMeasurement.end){furthestMeasurementsFound.set(measurement.lane,true)}if(furthestMeasurementsFound.size===this.options.lanes){break}}return furthestMeasurements.size===this.options.lanes?Array.from(furthestMeasurements.values()).sort(((a,b)=>{if(a.end===b.end){return a.index-b.index}return a.end-b.end}))[0]:void 0};this.getMeasurementOptions=memo$1((()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled]),((count2,paddingStart,scrollMargin,getItemKey,enabled)=>{this.pendingMeasuredCacheIndexes=[];return{count:count2,paddingStart:paddingStart,scrollMargin:scrollMargin,getItemKey:getItemKey,enabled:enabled}}),{key:false});this.getMeasurements=memo$1((()=>[this.getMeasurementOptions(),this.itemSizeCache]),(({count:count2,paddingStart:paddingStart,scrollMargin:scrollMargin,getItemKey:getItemKey,enabled:enabled},itemSizeCache)=>{if(!enabled){this.measurementsCache=[];this.itemSizeCache.clear();return[]}if(this.measurementsCache.length===0){this.measurementsCache=this.options.initialMeasurementsCache;this.measurementsCache.forEach((item=>{this.itemSizeCache.set(item.key,item.size)}))}const min2=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const measurements=this.measurementsCache.slice(0,min2);for(let i=min2;i<count2;i++){const key=getItemKey(i);const furthestMeasurement=this.options.lanes===1?measurements[i-1]:this.getFurthestMeasurement(measurements,i);const start=furthestMeasurement?furthestMeasurement.end+this.options.gap:paddingStart+scrollMargin;const measuredSize=itemSizeCache.get(key);const size=typeof measuredSize==="number"?measuredSize:this.options.estimateSize(i);const end=start+size;const lane=furthestMeasurement?furthestMeasurement.lane:i%this.options.lanes;measurements[i]={index:i,start:start,size:size,end:end,key:key,lane:lane}}this.measurementsCache=measurements;return measurements}),{key:false,debug:()=>this.options.debug});this.calculateRange=memo$1((()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()]),((measurements,outerSize,scrollOffset)=>this.range=measurements.length>0&&outerSize>0?calculateRange({measurements:measurements,outerSize:outerSize,scrollOffset:scrollOffset}):null),{key:false,debug:()=>this.options.debug});this.getVirtualIndexes=memo$1((()=>{let startIndex=null;let endIndex=null;const range=this.calculateRange();if(range){startIndex=range.startIndex;endIndex=range.endIndex}return[this.options.rangeExtractor,this.options.overscan,this.options.count,startIndex,endIndex]}),((rangeExtractor,overscan,count2,startIndex,endIndex)=>startIndex===null||endIndex===null?[]:rangeExtractor({startIndex:startIndex,endIndex:endIndex,overscan:overscan,count:count2})),{key:false,debug:()=>this.options.debug});this.indexFromElement=node=>{const attributeName=this.options.indexAttribute;const indexStr=node.getAttribute(attributeName);if(!indexStr){console.warn(`Missing attribute name '${attributeName}={index}' on measured element.`);return-1}return parseInt(indexStr,10)};this._measureElement=(node,entry)=>{const index=this.indexFromElement(node);const item=this.measurementsCache[index];if(!item){return}const key=item.key;const prevNode=this.elementsCache.get(key);if(prevNode!==node){if(prevNode){this.observer.unobserve(prevNode)}this.observer.observe(node);this.elementsCache.set(key,node)}if(node.isConnected){this.resizeItem(index,this.options.measureElement(node,entry,this))}};this.resizeItem=(index,size)=>{const item=this.measurementsCache[index];if(!item){return}const itemSize=this.itemSizeCache.get(item.key)??item.size;const delta=size-itemSize;if(delta!==0){if(this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(item,delta,this):item.start<this.getScrollOffset()+this.scrollAdjustments){this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=delta,behavior:void 0})}this.pendingMeasuredCacheIndexes.push(item.index);this.itemSizeCache=new Map(this.itemSizeCache.set(item.key,size));this.notify(false)}};this.measureElement=node=>{if(!node){this.elementsCache.forEach(((cached,key)=>{if(!cached.isConnected){this.observer.unobserve(cached);this.elementsCache.delete(key)}}));return}this._measureElement(node,void 0)};this.getVirtualItems=memo$1((()=>[this.getVirtualIndexes(),this.getMeasurements()]),((indexes,measurements)=>{const virtualItems=[];for(let k=0,len=indexes.length;k<len;k++){const i=indexes[k];const measurement=measurements[i];virtualItems.push(measurement)}return virtualItems}),{key:false,debug:()=>this.options.debug});this.getVirtualItemForOffset=offset=>{const measurements=this.getMeasurements();if(measurements.length===0){return void 0}return notUndefined(measurements[findNearestBinarySearch(0,measurements.length-1,(index=>notUndefined(measurements[index]).start),offset)])};this.getOffsetForAlignment=(toOffset,align)=>{const size=this.getSize();const scrollOffset=this.getScrollOffset();if(align==="auto"){if(toOffset>=scrollOffset+size){align="end"}}if(align==="end"){toOffset-=size}const scrollSizeProp=this.options.horizontal?"scrollWidth":"scrollHeight";const scrollSize=this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[scrollSizeProp]:this.scrollElement[scrollSizeProp]:0;const maxOffset=scrollSize-size;return Math.max(Math.min(maxOffset,toOffset),0)};this.getOffsetForIndex=(index,align="auto")=>{index=Math.max(0,Math.min(index,this.options.count-1));const item=this.measurementsCache[index];if(!item){return void 0}const size=this.getSize();const scrollOffset=this.getScrollOffset();if(align==="auto"){if(item.end>=scrollOffset+size-this.options.scrollPaddingEnd){align="end"}else if(item.start<=scrollOffset+this.options.scrollPaddingStart){align="start"}else{return[scrollOffset,align]}}const centerOffset=item.start-this.options.scrollPaddingStart+(item.size-size)/2;switch(align){case"center":return[this.getOffsetForAlignment(centerOffset,align),align];case"end":return[this.getOffsetForAlignment(item.end+this.options.scrollPaddingEnd,align),align];default:return[this.getOffsetForAlignment(item.start-this.options.scrollPaddingStart,align),align]}};this.isDynamicMode=()=>this.elementsCache.size>0;this.cancelScrollToIndex=()=>{if(this.scrollToIndexTimeoutId!==null&&this.targetWindow){this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId);this.scrollToIndexTimeoutId=null}};this.scrollToOffset=(toOffset,{align:align="start",behavior:behavior}={})=>{this.cancelScrollToIndex();if(behavior==="smooth"&&this.isDynamicMode()){console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.")}this._scrollToOffset(this.getOffsetForAlignment(toOffset,align),{adjustments:void 0,behavior:behavior})};this.scrollToIndex=(index,{align:initialAlign="auto",behavior:behavior}={})=>{index=Math.max(0,Math.min(index,this.options.count-1));this.cancelScrollToIndex();if(behavior==="smooth"&&this.isDynamicMode()){console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.")}const offsetAndAlign=this.getOffsetForIndex(index,initialAlign);if(!offsetAndAlign)return;const[offset,align]=offsetAndAlign;this._scrollToOffset(offset,{adjustments:void 0,behavior:behavior});if(behavior!=="smooth"&&this.isDynamicMode()&&this.targetWindow){this.scrollToIndexTimeoutId=this.targetWindow.setTimeout((()=>{this.scrollToIndexTimeoutId=null;const elementInDOM=this.elementsCache.has(this.options.getItemKey(index));if(elementInDOM){const[latestOffset]=notUndefined(this.getOffsetForIndex(index,align));if(!approxEqual(latestOffset,this.getScrollOffset())){this.scrollToIndex(index,{align:align,behavior:behavior})}}else{this.scrollToIndex(index,{align:align,behavior:behavior})}}))}};this.scrollBy=(delta,{behavior:behavior}={})=>{this.cancelScrollToIndex();if(behavior==="smooth"&&this.isDynamicMode()){console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.")}this._scrollToOffset(this.getScrollOffset()+delta,{adjustments:void 0,behavior:behavior})};this.getTotalSize=()=>{var _a;const measurements=this.getMeasurements();let end;if(measurements.length===0){end=this.options.paddingStart}else{end=this.options.lanes===1?((_a=measurements[measurements.length-1])==null?void 0:_a.end)??0:Math.max(...measurements.slice(-this.options.lanes).map((m=>m.end)))}return Math.max(end-this.options.scrollMargin+this.options.paddingEnd,0)};this._scrollToOffset=(offset,{adjustments:adjustments,behavior:behavior})=>{this.options.scrollToFn(offset,{behavior:behavior,adjustments:adjustments},this)};this.measure=()=>{this.itemSizeCache=new Map;this.notify(false)};this.setOptions(opts)}}const findNearestBinarySearch=(low,high,getCurrentValue,value)=>{while(low<=high){const middle=(low+high)/2|0;const currentValue=getCurrentValue(middle);if(currentValue<value){low=middle+1}else if(currentValue>value){high=middle-1}else{return middle}}if(low>0){return low-1}else{return 0}};function calculateRange({measurements:measurements,outerSize:outerSize,scrollOffset:scrollOffset}){const count2=measurements.length-1;const getOffset=index=>measurements[index].start;const startIndex=findNearestBinarySearch(0,count2,getOffset,scrollOffset);let endIndex=startIndex;while(endIndex<count2&&measurements[endIndex].end<scrollOffset+outerSize){endIndex++}return{startIndex:startIndex,endIndex:endIndex}}const useIsomorphicLayoutEffect=typeof document!=="undefined"?React.useLayoutEffect:React.useEffect;function useVirtualizerBase(options){const rerender=React.useReducer((()=>({})),{})[1];const resolvedOptions={...options,onChange:(instance2,sync)=>{var _a;if(sync){flushSync(rerender)}else{rerender()}(_a=options.onChange)==null?void 0:_a.call(options,instance2,sync)}};const[instance]=React.useState((()=>new Virtualizer(resolvedOptions)));instance.setOptions(resolvedOptions);useIsomorphicLayoutEffect((()=>instance._didMount()),[]);useIsomorphicLayoutEffect((()=>instance._willUpdate()));return instance}function useVirtualizer(options){return useVirtualizerBase({observeElementRect:observeElementRect,observeElementOffset:observeElementOffset,scrollToFn:elementScroll,...options})}const getVirtualizedContainerStyles=maxHeight=>{let heightValue="600px";if(maxHeight){switch(maxHeight){case"xs":heightValue="200px";break;case"sm":heightValue="300px";break;case"md":heightValue="400px";break;case"lg":heightValue="500px";break;case"xl":heightValue="600px";break;case"xxl":heightValue="700px";break;case"xxxl":heightValue="800px";break;default:if(maxHeight!=="auto"){heightValue=maxHeight}}}return{overflow:"auto",position:"relative",height:heightValue,width:"100%"}};const getVirtualizedRowStyle=startPosition=>({position:"absolute",top:0,left:0,height:"40px",transform:`translateY(${startPosition}px)`,tableLayout:"fixed"});const getRowHeightEstimate=rowType=>{switch(rowType){case"header":return 40;case"loading":return 30;case"footer":return 40;case"row":default:return 40}};const AdvancedTableContext=createContext({});const AdvancedTableProvider=({children:children,...props})=>{var _a;const tableContainerRef=useRef(null);const containerRef=props.tableContainerRef||tableContainerRef;const table=props.table;const isVirtualized=props.virtualizedRows||props.enableVirtualization;const headerRef=useRef(null);const sampleRowRef=useRef(null);const[headerHeight,setHeaderHeight]=useState(44);const[rowHeight,setRowHeight]=useState(38);const[actionBarHeight,setActionBarHeight]=useState(0);const measureHeights=useCallback((()=>{var _a2;const wrapper=((_a2=props.tableContainerRef)==null?void 0:_a2.current)||tableContainerRef.current;if(headerRef.current){const headerElement=headerRef.current;const headerRect=headerElement.getBoundingClientRect();if(headerRect.height>0){setHeaderHeight(headerRect.height)}}if(sampleRowRef.current){const rowRect=sampleRowRef.current.getBoundingClientRect();if(rowRect.height>0){setRowHeight(rowRect.height)}}if(wrapper){const actionBar=wrapper.querySelector(".row-selection-actions-card.is-visible, .row-selection-actions-card.show-action-card");const measuredActionBarHeight=actionBar?measureElementHeight(actionBar):0;setActionBarHeight(measuredActionBarHeight);wrapper.style.setProperty("--advanced-table-action-bar-height",`${measuredActionBarHeight}px`)}}),[props.tableContainerRef]);useEffect((()=>{var _a2;const resizeObserver=new ResizeObserver((()=>{measureHeights()}));if(headerRef.current){resizeObserver.observe(headerRef.current)}const wrapper=((_a2=props.tableContainerRef)==null?void 0:_a2.current)||tableContainerRef.current;const actionBar=wrapper==null?void 0:wrapper.querySelector(".row-selection-actions-card");if(actionBar){resizeObserver.observe(actionBar)}if(sampleRowRef.current){resizeObserver.observe(sampleRowRef.current)}const timeoutId=setTimeout(measureHeights,100);return()=>{resizeObserver.disconnect();clearTimeout(timeoutId)}}),[measureHeights]);const headerGroupCount=((_a=table==null?void 0:table.getHeaderGroups())==null?void 0:_a.length)??0;useEffect((()=>{measureHeights()}),[table==null?void 0:table.getRowModel().rows.length,headerGroupCount,props.isActionBarVisible,measureHeights]);const flattenedItems=useMemo((()=>{if(!isVirtualized||!table){return[]}const tableRows=table.getRowModel().rows;const items=[];const subRowHeaders=props.subRowHeaders;const inlineRowLoading=props.inlineRowLoading;const columnDefinitions=props.columnDefinitions;tableRows.forEach(((row,index)=>{var _a2,_b,_c;const isFirstChildofSubrow=row.depth>0&&row.index===0;if(isFirstChildofSubrow&&subRowHeaders){items.push({type:"header",row:row,id:`header-${row.id}-${index}`})}items.push({type:"row",row:row,id:`row-${row.id}-${index}`});const isExpandable=row.getIsExpanded();const rowHasNoChildren=((_a2=row.original)==null?void 0:_a2.children)&&!row.original.children.length?true:false;const isDataLoading=isExpandable&&(inlineRowLoading&&rowHasNoChildren)&&row.depth<(((_c=(_b=columnDefinitions[0])==null?void 0:_b.cellAccessors)==null?void 0:_c.length)||0);if(isDataLoading){items.push({type:"loading",row:row,id:`loading-${row.id}-${index}`})}}));const isFetching=props.isFetching||false;const shouldAddFooter=table&&!isFetching&&tableRows.length>0;if(shouldAddFooter){items.push({type:"footer",row:{},id:`footer-row`})}return items}),[isVirtualized,table,props.subRowHeaders,props.inlineRowLoading,props.columnDefinitions,table==null?void 0:table.getRowModel().rows.length,JSON.stringify((table==null?void 0:table.getState().sorting)||[]),JSON.stringify((table==null?void 0:table.getState().expanded)||{})]);const virtualizer=useVirtualizer({count:isVirtualized&&flattenedItems.length>0?flattenedItems.length:0,getScrollElement:()=>containerRef.current,estimateSize:index=>{if(!isVirtualized||flattenedItems.length===0)return 0;const item=flattenedItems[index];if(!item)return getRowHeightEstimate("row");return getRowHeightEstimate(item.type)},overscan:10,getItemKey:index=>{var _a2;if(!isVirtualized||flattenedItems.length===0||index>=flattenedItems.length){return`item-${index}`}return((_a2=flattenedItems[index])==null?void 0:_a2.id)||`item-${index}`}});useEffect((()=>{if(isVirtualized&&virtualizer&&table&&containerRef.current){virtualizer.setOptions({...virtualizer.options,count:flattenedItems.length});virtualizer.measure()}}),[isVirtualized,virtualizer,table,containerRef,JSON.stringify((table==null?void 0:table.getState().sorting)||[]),JSON.stringify((table==null?void 0:table.getState().expanded)||{}),flattenedItems.length]);const contextValue={...props,table:table,tableContainerRef:containerRef,virtualizer:isVirtualized?virtualizer:null,flattenedItems:flattenedItems,virtualizedRows:isVirtualized,enableVirtualization:isVirtualized,rowPinning:props.rowPinning,setRowPinning:props.setRowPinning,keepPinnedRows:props.keepPinnedRows,headerHeight:headerHeight,rowHeight:rowHeight,actionBarHeight:actionBarHeight,headerRef:headerRef,sampleRowRef:sampleRowRef,measureHeights:measureHeights};return jsx(AdvancedTableContext.Provider,{value:contextValue,children:children})};
2
2
  /**
3
3
  * table-core
4
4
  *
@@ -5578,6 +5578,22 @@
5578
5578
  "react"
5579
5579
  ]
5580
5580
  },
5581
+ "enablePillReorder": {
5582
+ "type": "boolean",
5583
+ "platforms": [
5584
+ "react",
5585
+ "rails"
5586
+ ],
5587
+ "default": false
5588
+ },
5589
+ "externalDragHandle": {
5590
+ "type": "boolean",
5591
+ "platforms": [
5592
+ "react",
5593
+ "rails"
5594
+ ],
5595
+ "default": false
5596
+ },
5581
5597
  "isClosed": {
5582
5598
  "type": "boolean",
5583
5599
  "platforms": [
@@ -5650,6 +5666,14 @@
5650
5666
  ],
5651
5667
  "default": true
5652
5668
  },
5669
+ "showPillIndex": {
5670
+ "type": "boolean",
5671
+ "platforms": [
5672
+ "react",
5673
+ "rails"
5674
+ ],
5675
+ "default": false
5676
+ },
5653
5677
  "variant": {
5654
5678
  "type": "enum",
5655
5679
  "platforms": [
@@ -5853,7 +5877,7 @@
5853
5877
  "submission": {
5854
5878
  "submits": true,
5855
5879
  "value": "Selected option id in a CSS-hidden input (not input type=hidden).",
5856
- "multi": "syncHiddenInputs emits one hidden input per selected id in selection order, adds [] to the name only if absent and clears the original CSS-hidden input and removes its name while selections exist, so no blank array entry is submitted. When empty, the original name and required state are restored, including after Turbo reconnects. These submission fixes apply whether or not allow_option_creation is enabled. Comma-joining is used for default-value encoding, not as an additional submitted selection.",
5880
+ "multi": "syncHiddenInputs emits one hidden input per selected id in selection order, adds [] to the name only if absent and clears the original CSS-hidden input and removes its name while selections exist, so no blank array entry is submitted. When empty, the original name and required state are restored, including after Turbo reconnects. These submission fixes apply whether or not allow_option_creation is enabled. With enable_pill_reorder, drag or keyboard reordering updates that same selection order before syncHiddenInputs runs, so submitted values and pb:dropdown:reordered / pb:dropdown:selected details match the pill order. Comma-joining is used for default-value encoding, not as an additional submitted selection.",
5857
5881
  "dynamicOptions": "props.options_by_context with props.context_selector replaces the rendered options when the referenced element fires change, and props.clear_on_context_change (default true) then clears the selection, so a context change can submit an empty value. A pb:dropdown:updateOptions event, or an event named in props.options_event_type, replaces options the same way; clearSelection: false keeps only selections whose id exists in the replacement options."
5858
5882
  },
5859
5883
  "validation": {
@@ -5987,6 +6011,19 @@
5987
6011
  "form.rails.builder.simpleForm"
5988
6012
  ]
5989
6013
  },
6014
+ {
6015
+ "id": "dropdown.pill-reorder",
6016
+ "platforms": [
6017
+ "react",
6018
+ "rails"
6019
+ ],
6020
+ "questions": [
6021
+ "Can multi-select Dropdown pills be reordered?",
6022
+ "How do I enable draggable pills on Dropdown?",
6023
+ "Does pill reorder preserve form submission order?"
6024
+ ],
6025
+ "answer": "Opt in with enablePillReorder (Rails: enable_pill_reorder) on multi-select or multi-select + autocomplete. showPillIndex / show_pill_index numbers the pills. By default the whole pill is draggable with an in-pill grip; externalDragHandle / external_drag_handle requires an external grip. Focused pills reorder with ArrowLeft / ArrowRight. React onChange and Rails hidden inputs keep the new order; Rails also emits pb:dropdown:reordered (and pb:dropdown:selected) with the reordered array. Single-select is unaffected; reordering is off by default."
6026
+ },
5990
6027
  {
5991
6028
  "id": "dropdown.option-creation",
5992
6029
  "platforms": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "metadataVersion": 1,
3
- "version": "18.2.0-alpha.potentialissuesfixed20738",
3
+ "version": "18.2.0-alpha.potentialissuesfixed20791",
4
4
  "builder": {
5
5
  "class": "Playbook::Forms::Builder",
6
6
  "helper": "pb_form_with",
@@ -557,7 +557,7 @@
557
557
  "submission": {
558
558
  "submits": true,
559
559
  "value": "Selected option id in a CSS-hidden input (not input type=hidden).",
560
- "multi": "syncHiddenInputs emits one hidden input per selected id in selection order, adds [] to the name only if absent and clears the original CSS-hidden input and removes its name while selections exist, so no blank array entry is submitted. When empty, the original name and required state are restored, including after Turbo reconnects. These submission fixes apply whether or not allow_option_creation is enabled. Comma-joining is used for default-value encoding, not as an additional submitted selection.",
560
+ "multi": "syncHiddenInputs emits one hidden input per selected id in selection order, adds [] to the name only if absent and clears the original CSS-hidden input and removes its name while selections exist, so no blank array entry is submitted. When empty, the original name and required state are restored, including after Turbo reconnects. These submission fixes apply whether or not allow_option_creation is enabled. With enable_pill_reorder, drag or keyboard reordering updates that same selection order before syncHiddenInputs runs, so submitted values and pb:dropdown:reordered / pb:dropdown:selected details match the pill order. Comma-joining is used for default-value encoding, not as an additional submitted selection.",
561
561
  "dynamicOptions": "props.options_by_context with props.context_selector replaces the rendered options when the referenced element fires change, and props.clear_on_context_change (default true) then clears the selection, so a context change can submit an empty value. A pb:dropdown:updateOptions event, or an event named in props.options_event_type, replaces options the same way; clearSelection: false keeps only selections whose id exists in the replacement options."
562
562
  },
563
563
  "validation": {
@@ -1,8 +1,8 @@
1
1
  {
2
- "version": "18.2.0-alpha.potentialissuesfixed20738",
2
+ "version": "18.2.0-alpha.potentialissuesfixed20791",
3
3
  "metadataVersion": 1,
4
4
  "forms": "forms.json",
5
- "generated": "2026-11-02T17:11:43.065Z",
5
+ "generated": "2026-11-03T17:39:21.598Z",
6
6
  "schemas": {
7
7
  "globalProps": "global-props.schema.json",
8
8
  "globalEventProps": "global-event-props.schema.json",
@@ -161,6 +161,22 @@
161
161
  "react"
162
162
  ]
163
163
  },
164
+ "enablePillReorder": {
165
+ "type": "boolean",
166
+ "platforms": [
167
+ "react",
168
+ "rails"
169
+ ],
170
+ "default": false
171
+ },
172
+ "externalDragHandle": {
173
+ "type": "boolean",
174
+ "platforms": [
175
+ "react",
176
+ "rails"
177
+ ],
178
+ "default": false
179
+ },
164
180
  "isClosed": {
165
181
  "type": "boolean",
166
182
  "platforms": [
@@ -233,6 +249,14 @@
233
249
  ],
234
250
  "default": true
235
251
  },
252
+ "showPillIndex": {
253
+ "type": "boolean",
254
+ "platforms": [
255
+ "react",
256
+ "rails"
257
+ ],
258
+ "default": false
259
+ },
236
260
  "variant": {
237
261
  "type": "enum",
238
262
  "platforms": [
@@ -436,7 +460,7 @@
436
460
  "submission": {
437
461
  "submits": true,
438
462
  "value": "Selected option id in a CSS-hidden input (not input type=hidden).",
439
- "multi": "syncHiddenInputs emits one hidden input per selected id in selection order, adds [] to the name only if absent and clears the original CSS-hidden input and removes its name while selections exist, so no blank array entry is submitted. When empty, the original name and required state are restored, including after Turbo reconnects. These submission fixes apply whether or not allow_option_creation is enabled. Comma-joining is used for default-value encoding, not as an additional submitted selection.",
463
+ "multi": "syncHiddenInputs emits one hidden input per selected id in selection order, adds [] to the name only if absent and clears the original CSS-hidden input and removes its name while selections exist, so no blank array entry is submitted. When empty, the original name and required state are restored, including after Turbo reconnects. These submission fixes apply whether or not allow_option_creation is enabled. With enable_pill_reorder, drag or keyboard reordering updates that same selection order before syncHiddenInputs runs, so submitted values and pb:dropdown:reordered / pb:dropdown:selected details match the pill order. Comma-joining is used for default-value encoding, not as an additional submitted selection.",
440
464
  "dynamicOptions": "props.options_by_context with props.context_selector replaces the rendered options when the referenced element fires change, and props.clear_on_context_change (default true) then clears the selection, so a context change can submit an empty value. A pb:dropdown:updateOptions event, or an event named in props.options_event_type, replaces options the same way; clearSelection: false keeps only selections whose id exists in the replacement options."
441
465
  },
442
466
  "validation": {
@@ -570,6 +594,19 @@
570
594
  "form.rails.builder.simpleForm"
571
595
  ]
572
596
  },
597
+ {
598
+ "id": "dropdown.pill-reorder",
599
+ "platforms": [
600
+ "react",
601
+ "rails"
602
+ ],
603
+ "questions": [
604
+ "Can multi-select Dropdown pills be reordered?",
605
+ "How do I enable draggable pills on Dropdown?",
606
+ "Does pill reorder preserve form submission order?"
607
+ ],
608
+ "answer": "Opt in with enablePillReorder (Rails: enable_pill_reorder) on multi-select or multi-select + autocomplete. showPillIndex / show_pill_index numbers the pills. By default the whole pill is draggable with an in-pill grip; externalDragHandle / external_drag_handle requires an external grip. Focused pills reorder with ArrowLeft / ArrowRight. React onChange and Rails hidden inputs keep the new order; Rails also emits pb:dropdown:reordered (and pb:dropdown:selected) with the reordered array. Single-select is unaffected; reordering is off by default."
609
+ },
573
610
  {
574
611
  "id": "dropdown.option-creation",
575
612
  "platforms": [
@@ -1 +1 @@
1
- {"presets":[{"name":"Create tags","props":{"allowOptionCreation":true,"multiSelect":true,"name":"tags[]","label":"Tags"}},{"name":"Async search","structureMode":"async","props":{}},{"name":"Rich results and selection","structureMode":"rich","props":{}},{"name":"Controlled selection","structureMode":"controlled","props":{}},{"name":"External search","structureMode":"external","props":{}},{"name":"Default trigger","props":{"variant":"default","placeholder":"Select a country"}},{"name":"With label","props":{"label":"Select a Country","placeholder":"Choose a country"}},{"name":"Disabled options","props":{"label":"Select a Country","placeholder":"Choose a country"}},{"name":"Subtle Variant","props":{"variant":"subtle","separators":false}},{"name":"Quick pick","props":{"variant":"quickpick","label":"Date Range","placeholder":"Select a Date Range"}},{"name":"Quick pick custom","props":{"variant":"quickpick","label":"Date Range","customQuickPickDates":{"dates":[{"label":"Last 15 months","value":{"timePeriod":"months","amount":15}},{"label":"First Week of June 2022","value":["06/01/2022","06/07/2022"]}]}}},{"name":"Quick pick append defaults","props":{"variant":"quickpick","label":"Date Range","customQuickPickDates":{"dates":[{"label":"Last 15 months","value":{"timePeriod":"months","amount":15}},{"label":"First Week of June 2022","value":["06/01/2022","06/07/2022"]}],"override":false}}},{"name":"Multi-select","props":{"variant":"default","multiSelect":true,"placeholder":"Select countries"}},{"name":"Multi-select with pills","props":{"variant":"default","multiSelect":true,"placeholder":"Select countries","formPillProps":{"size":"small","color":"neutral"},"defaultValue":[{"label":"United States","value":"unitedStates"},{"label":"Italy","value":"italy"}]}},{"name":"With error","props":{"variant":"default","label":"Required field","placeholder":"Required field","error":"Please make a selection."}},{"name":"Search (autocomplete)","props":{"variant":"default","autocomplete":true,"placeholder":"Search..."}},{"name":"Constrained height","props":{"label":"Choose an Option","constrainHeight":true}}],"hints":{"async_search_info":{"when":{"async":true},"message":"Async examples search the public DummyJSON sample-user API. Try Emily or Michael, or an unmatched term for the empty state. defaultOptions preloads results; cacheOptions reuses successful searches. Use the Async search structure with autocomplete off and searchbar on to search inside the menu.","type":"info"},"external_search_info":{"presetName":"External search","message":"The wrapper owns a 250ms debounce, a three-character minimum, request cancellation, options, and loading. onInputChange reports input/clear; onSelect receives the complete option. Inspect the generated code for the integration.","type":"info"},"rich_results_info":{"presetName":"Rich results and selection","message":"renderOption customizes results; the existing Trigger customDisplay renders selected company details. The selected option shown below retains custom company data.","type":"info"},"quickpick_scope":{"when":{"variant":"quickpick"},"message":"Quick pick uses preset date-range options. Use customQuickPickDates to replace or extend them, and pair controlsStartId / controlsEndId with DatePicker when you need synced date inputs.","type":"info"},"multi_options":{"when":{"multiSelect":true},"message":"Multi-select returns arrays of selected options. Use formPillProps to adjust the selected-pill appearance and clearable to let users reset the selection.","type":"info"},"autocomplete_info":{"when":{"autocomplete":true,"async":false},"message":"Autocomplete filters the provided options list in place. It works especially well with longer option sets.","type":"info"},"quickpick_custom_info":{"presetName":"Quick pick custom","message":"When override is omitted or true, customQuickPickDates replaces the default quick-pick menu.","type":"info"},"quickpick_append_info":{"presetName":"Quick pick append defaults","message":"Set customQuickPickDates.override to false to append your custom ranges to the built-in quick-pick options.","type":"info"},"constrained_height_info":{"presetName":"Constrained height","message":"constrainHeight restricts the height of the dropdown menu and enables vertical scrolling when the content exceeds this height. This prevents long dropdown lists from rendering off-screen.","type":"info"},"disabled_options_info":{"presetName":"Disabled options","message":"Set disabled: true on individual option objects to keep them visible while preventing selection.","type":"info"},"subcomponent_structure_info":{"message":"Switch Structure to “With Subcomponents” to see the explicit Dropdown.Trigger, Dropdown.Container, and Dropdown.Option composition API.","type":"info"}},"conditionals":{"loadOptions":{"requires":"async"},"defaultOptions":{"requires":"async"},"cacheOptions":{"requires":"async"},"loading":{"requires":"async"},"searchbar":{"structureMode":"async"},"requiredIndicator":{"requires":"label"},"formPillProps":{"requires":"multiSelect"},"rangeEndsToday":{"requires":{"variant":"quickpick"}},"controlsStartId":{"requires":{"variant":"quickpick"}},"controlsEndId":{"requires":{"variant":"quickpick"}},"customQuickPickDates":{"requires":{"variant":"quickpick"}}},"structureModes":{"default":"simple","modes":{"simple":{"label":"Simple","template":"<Dropdown options={options}{{props}} />","children":""},"async":{"label":"Async search","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger />\n <Dropdown.Container{{Container.props}} />\n</Dropdown>","children":"","props":{"async":true,"autocomplete":true,"options":[],"label":"User","placeholder":"Try Emily or Michael","loadOptions":"loadUsers","defaultOptions":true,"cacheOptions":true},"wrapper":"const loadUsers = (term) => fetch(`https://dummyjson.com/users/search?${new URLSearchParams({ q: term, limit: '10', select: 'firstName,lastName,company' })}`, { credentials: 'omit' })\n .then((response) => {\n if (!response.ok) throw new Error('Search failed')\n return response.json()\n })\n .then(({ users }) => users.map((user) => ({\n ...user,\n label: `${user.firstName} ${user.lastName}`,\n value: user.id,\n })));\n\n{{component}}"},"rich":{"label":"Rich async results","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger customDisplay={selected && <Detail text={companyDetail(selected)} />} />\n <Dropdown.Container{{Container.props}} />\n</Dropdown>","children":"","props":{"async":true,"autocomplete":true,"options":[],"label":"User","placeholder":"Try Emily or Michael","loadOptions":"loadUsers","renderOption":"renderUser","onSelect":"setSelected","value":{"__playgroundCode":"selected"}},"externalImports":["import React, { useState } from 'react'"],"wrapper":"const loadUsers = (term) => fetch(`https://dummyjson.com/users/search?${new URLSearchParams({ q: term, limit: '10', select: 'firstName,lastName,company' })}`, { credentials: 'omit' })\n .then((response) => {\n if (!response.ok) throw new Error('Search failed')\n return response.json()\n })\n .then(({ users }) => users.map((user) => ({\n ...user,\n label: `${user.firstName} ${user.lastName}`,\n value: user.id,\n })))\n\nconst companyDetail = (user) => [user.company?.title, user.company?.department].filter(Boolean).join(' · ')\n\nconst renderUser = (user) => (\n <div>\n <Body text={user.label} />\n <Detail text={companyDetail(user)} />\n </div>\n)\n\nconst RichDropdownPlayground = () => {\n const [selected, setSelected] = useState(null)\n return (\n <>\n {{component}}\n <Detail text={selected ? JSON.stringify(selected) : \"Select a user to inspect the complete option object.\"} />\n </>\n )\n};\n\n<RichDropdownPlayground />"},"controlled":{"label":"Controlled selection","template":"<Dropdown options={options}{{props}} />","children":"","props":{"multiSelect":true,"label":"Countries","value":{"__playgroundCode":"selected"},"onSelect":"setSelected"},"externalImports":["import React, { useState } from 'react'"],"wrapper":"const ControlledDropdownPlayground = () => {\n const [selected, setSelected] = useState([])\n return (\n <>\n {{component}}\n <Flex gap=\"xs\" marginTop=\"sm\">\n <Button text=\"Select all enabled\" onClick={() => setSelected(options.filter((option) => !option.disabled))} />\n <Button text=\"Clear\" variant=\"secondary\" onClick={() => setSelected([])} />\n </Flex>\n </>\n )\n};\n\n<ControlledDropdownPlayground />"},"external":{"label":"External async search","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger />\n <Dropdown.Container{{Container.props}} />\n</Dropdown>","children":"","props":{"async":true,"autocomplete":true,"options":[],"label":"User","placeholder":"Type at least 3 characters","loading":{"__playgroundCode":"loading"},"value":{"__playgroundCode":"selected"},"onInputChange":"(text, { reason }) => setQuery(reason === 'input' ? text : '')","onSelect":"(option) => { setSelected(option); setQuery('') }"},"externalImports":["import React, { useEffect, useState } from 'react'"],"wrapper":"const ExternalDropdownPlayground = () => {\n const [query, setQuery] = useState('')\n const [options, setOptions] = useState([])\n const [loading, setLoading] = useState(false)\n const [selected, setSelected] = useState(null)\n\n useEffect(() => {\n const controller = new AbortController()\n setOptions([])\n setLoading(false)\n if (query.length < 3) return () => controller.abort()\n setLoading(true)\n const timer = setTimeout(() => {\n const params = new URLSearchParams({ q: query, limit: '10', select: 'firstName,lastName' })\n fetch(`https://dummyjson.com/users/search?${params}`, { signal: controller.signal, credentials: 'omit' })\n .then((response) => {\n if (!response.ok) throw new Error('Search failed')\n return response.json()\n })\n .then(({ users }) => {\n if (!controller.signal.aborted) setOptions(users.map((user) => ({\n ...user,\n label: `${user.firstName} ${user.lastName}`,\n value: user.id,\n })))\n })\n .catch(() => { if (!controller.signal.aborted) setOptions([]) })\n .finally(() => { if (!controller.signal.aborted) setLoading(false) })\n }, 250)\n return () => { clearTimeout(timer); controller.abort() }\n }, [query])\n\n return ({{component}})\n};\n\n<ExternalDropdownPlayground />"},"subcomponents":{"label":"With Subcomponents","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger />\n <Dropdown.Container{{Container.props}}>\n {options.map((option) => (\n <Dropdown.Option key={option.id} option={option} />\n ))}\n </Dropdown.Container>\n</Dropdown>","children":""}}},"template":"<Dropdown{{props}} />","customProps":{"loadOptions":{"type":"function","platforms":["react"],"description":"Promise or callback loader. Receives the search term; return options with id, label, and value plus any custom data."},"searchbar":{"type":"boolean","default":false,"platforms":["react"],"description":"Show a search input inside Dropdown.Container. Turn autocomplete off to try this mode."},"options":{"type":"array","platforms":["react","rails"],"description":"Dropdown option data with label, value, id, and optional disabled state."}},"propTargets":{"searchbar":"Container.props","options":"Options.data"}}
1
+ {"presets":[{"name":"Create tags","props":{"allowOptionCreation":true,"multiSelect":true,"name":"tags[]","label":"Tags"}},{"name":"Async search","structureMode":"async","props":{}},{"name":"Rich results and selection","structureMode":"rich","props":{}},{"name":"Controlled selection","structureMode":"controlled","props":{}},{"name":"External search","structureMode":"external","props":{}},{"name":"Default trigger","props":{"variant":"default","placeholder":"Select a country"}},{"name":"With label","props":{"label":"Select a Country","placeholder":"Choose a country"}},{"name":"Disabled options","props":{"label":"Select a Country","placeholder":"Choose a country"}},{"name":"Subtle Variant","props":{"variant":"subtle","separators":false}},{"name":"Quick pick","props":{"variant":"quickpick","label":"Date Range","placeholder":"Select a Date Range"}},{"name":"Quick pick custom","props":{"variant":"quickpick","label":"Date Range","customQuickPickDates":{"dates":[{"label":"Last 15 months","value":{"timePeriod":"months","amount":15}},{"label":"First Week of June 2022","value":["06/01/2022","06/07/2022"]}]}}},{"name":"Quick pick append defaults","props":{"variant":"quickpick","label":"Date Range","customQuickPickDates":{"dates":[{"label":"Last 15 months","value":{"timePeriod":"months","amount":15}},{"label":"First Week of June 2022","value":["06/01/2022","06/07/2022"]}],"override":false}}},{"name":"Multi-select","props":{"variant":"default","multiSelect":true,"placeholder":"Select countries"}},{"name":"Multi-select with pills","props":{"variant":"default","multiSelect":true,"placeholder":"Select countries","formPillProps":{"size":"small","color":"neutral"},"defaultValue":[{"label":"United States","value":"unitedStates"},{"label":"Italy","value":"italy"}]}},{"name":"With error","props":{"variant":"default","label":"Required field","placeholder":"Required field","error":"Please make a selection."}},{"name":"Search (autocomplete)","props":{"variant":"default","autocomplete":true,"placeholder":"Search..."}},{"name":"Constrained height","props":{"label":"Choose an Option","constrainHeight":true}}],"hints":{"async_search_info":{"when":{"async":true},"message":"Async examples search the public DummyJSON sample-user API. Try Emily or Michael, or an unmatched term for the empty state. defaultOptions preloads results; cacheOptions reuses successful searches. Use the Async search structure with autocomplete off and searchbar on to search inside the menu.","type":"info"},"external_search_info":{"presetName":"External search","message":"The wrapper owns a 250ms debounce, a three-character minimum, request cancellation, options, and loading. onInputChange reports input/clear; onSelect receives the complete option. Inspect the generated code for the integration.","type":"info"},"rich_results_info":{"presetName":"Rich results and selection","message":"renderOption customizes results; the existing Trigger customDisplay renders selected company details. The selected option shown below retains custom company data.","type":"info"},"quickpick_scope":{"when":{"variant":"quickpick"},"message":"Quick pick uses preset date-range options. Use customQuickPickDates to replace or extend them, and pair controlsStartId / controlsEndId with DatePicker when you need synced date inputs.","type":"info"},"multi_options":{"when":{"multiSelect":true},"message":"Multi-select returns arrays of selected options. Use formPillProps to adjust the selected-pill appearance and clearable to let users reset the selection. Opt into enablePillReorder to drag pills into a new priority order.","type":"info"},"autocomplete_info":{"when":{"autocomplete":true,"async":false},"message":"Autocomplete filters the provided options list in place. It works especially well with longer option sets.","type":"info"},"quickpick_custom_info":{"presetName":"Quick pick custom","message":"When override is omitted or true, customQuickPickDates replaces the default quick-pick menu.","type":"info"},"quickpick_append_info":{"presetName":"Quick pick append defaults","message":"Set customQuickPickDates.override to false to append your custom ranges to the built-in quick-pick options.","type":"info"},"constrained_height_info":{"presetName":"Constrained height","message":"constrainHeight restricts the height of the dropdown menu and enables vertical scrolling when the content exceeds this height. This prevents long dropdown lists from rendering off-screen.","type":"info"},"disabled_options_info":{"presetName":"Disabled options","message":"Set disabled: true on individual option objects to keep them visible while preventing selection.","type":"info"},"subcomponent_structure_info":{"message":"Switch Structure to “With Subcomponents” to see the explicit Dropdown.Trigger, Dropdown.Container, and Dropdown.Option composition API.","type":"info"}},"conditionals":{"loadOptions":{"requires":"async"},"defaultOptions":{"requires":"async"},"cacheOptions":{"requires":"async"},"loading":{"requires":"async"},"searchbar":{"structureMode":"async"},"requiredIndicator":{"requires":"label"},"formPillProps":{"requires":"multiSelect"},"enablePillReorder":{"requires":"multiSelect"},"externalDragHandle":{"requires":"enablePillReorder"},"showPillIndex":{"requires":"multiSelect"},"rangeEndsToday":{"requires":{"variant":"quickpick"}},"controlsStartId":{"requires":{"variant":"quickpick"}},"controlsEndId":{"requires":{"variant":"quickpick"}},"customQuickPickDates":{"requires":{"variant":"quickpick"}}},"structureModes":{"default":"simple","modes":{"simple":{"label":"Simple","template":"<Dropdown options={options}{{props}} />","children":""},"async":{"label":"Async search","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger />\n <Dropdown.Container{{Container.props}} />\n</Dropdown>","children":"","props":{"async":true,"autocomplete":true,"options":[],"label":"User","placeholder":"Try Emily or Michael","loadOptions":"loadUsers","defaultOptions":true,"cacheOptions":true},"wrapper":"const loadUsers = (term) => fetch(`https://dummyjson.com/users/search?${new URLSearchParams({ q: term, limit: '10', select: 'firstName,lastName,company' })}`, { credentials: 'omit' })\n .then((response) => {\n if (!response.ok) throw new Error('Search failed')\n return response.json()\n })\n .then(({ users }) => users.map((user) => ({\n ...user,\n label: `${user.firstName} ${user.lastName}`,\n value: user.id,\n })));\n\n{{component}}"},"rich":{"label":"Rich async results","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger customDisplay={selected && <Detail text={companyDetail(selected)} />} />\n <Dropdown.Container{{Container.props}} />\n</Dropdown>","children":"","props":{"async":true,"autocomplete":true,"options":[],"label":"User","placeholder":"Try Emily or Michael","loadOptions":"loadUsers","renderOption":"renderUser","onSelect":"setSelected","value":{"__playgroundCode":"selected"}},"externalImports":["import React, { useState } from 'react'"],"wrapper":"const loadUsers = (term) => fetch(`https://dummyjson.com/users/search?${new URLSearchParams({ q: term, limit: '10', select: 'firstName,lastName,company' })}`, { credentials: 'omit' })\n .then((response) => {\n if (!response.ok) throw new Error('Search failed')\n return response.json()\n })\n .then(({ users }) => users.map((user) => ({\n ...user,\n label: `${user.firstName} ${user.lastName}`,\n value: user.id,\n })))\n\nconst companyDetail = (user) => [user.company?.title, user.company?.department].filter(Boolean).join(' · ')\n\nconst renderUser = (user) => (\n <div>\n <Body text={user.label} />\n <Detail text={companyDetail(user)} />\n </div>\n)\n\nconst RichDropdownPlayground = () => {\n const [selected, setSelected] = useState(null)\n return (\n <>\n {{component}}\n <Detail text={selected ? JSON.stringify(selected) : \"Select a user to inspect the complete option object.\"} />\n </>\n )\n};\n\n<RichDropdownPlayground />"},"controlled":{"label":"Controlled selection","template":"<Dropdown options={options}{{props}} />","children":"","props":{"multiSelect":true,"label":"Countries","value":{"__playgroundCode":"selected"},"onSelect":"setSelected"},"externalImports":["import React, { useState } from 'react'"],"wrapper":"const ControlledDropdownPlayground = () => {\n const [selected, setSelected] = useState([])\n return (\n <>\n {{component}}\n <Flex gap=\"xs\" marginTop=\"sm\">\n <Button text=\"Select all enabled\" onClick={() => setSelected(options.filter((option) => !option.disabled))} />\n <Button text=\"Clear\" variant=\"secondary\" onClick={() => setSelected([])} />\n </Flex>\n </>\n )\n};\n\n<ControlledDropdownPlayground />"},"external":{"label":"External async search","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger />\n <Dropdown.Container{{Container.props}} />\n</Dropdown>","children":"","props":{"async":true,"autocomplete":true,"options":[],"label":"User","placeholder":"Type at least 3 characters","loading":{"__playgroundCode":"loading"},"value":{"__playgroundCode":"selected"},"onInputChange":"(text, { reason }) => setQuery(reason === 'input' ? text : '')","onSelect":"(option) => { setSelected(option); setQuery('') }"},"externalImports":["import React, { useEffect, useState } from 'react'"],"wrapper":"const ExternalDropdownPlayground = () => {\n const [query, setQuery] = useState('')\n const [options, setOptions] = useState([])\n const [loading, setLoading] = useState(false)\n const [selected, setSelected] = useState(null)\n\n useEffect(() => {\n const controller = new AbortController()\n setOptions([])\n setLoading(false)\n if (query.length < 3) return () => controller.abort()\n setLoading(true)\n const timer = setTimeout(() => {\n const params = new URLSearchParams({ q: query, limit: '10', select: 'firstName,lastName' })\n fetch(`https://dummyjson.com/users/search?${params}`, { signal: controller.signal, credentials: 'omit' })\n .then((response) => {\n if (!response.ok) throw new Error('Search failed')\n return response.json()\n })\n .then(({ users }) => {\n if (!controller.signal.aborted) setOptions(users.map((user) => ({\n ...user,\n label: `${user.firstName} ${user.lastName}`,\n value: user.id,\n })))\n })\n .catch(() => { if (!controller.signal.aborted) setOptions([]) })\n .finally(() => { if (!controller.signal.aborted) setLoading(false) })\n }, 250)\n return () => { clearTimeout(timer); controller.abort() }\n }, [query])\n\n return ({{component}})\n};\n\n<ExternalDropdownPlayground />"},"subcomponents":{"label":"With Subcomponents","template":"<Dropdown options={options}{{props}}>\n <Dropdown.Trigger />\n <Dropdown.Container{{Container.props}}>\n {options.map((option) => (\n <Dropdown.Option key={option.id} option={option} />\n ))}\n </Dropdown.Container>\n</Dropdown>","children":""}}},"template":"<Dropdown{{props}} />","customProps":{"loadOptions":{"type":"function","platforms":["react"],"description":"Promise or callback loader. Receives the search term; return options with id, label, and value plus any custom data."},"searchbar":{"type":"boolean","default":false,"platforms":["react"],"description":"Show a search input inside Dropdown.Container. Turn autocomplete off to try this mode."},"options":{"type":"array","platforms":["react","rails"],"description":"Dropdown option data with label, value, id, and optional disabled state."}},"propTargets":{"searchbar":"Container.props","options":"Options.data"}}