playbook-ui 18.2.0 → 18.3.0-rc.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.
Files changed (36) hide show
  1. package/dist/.vite/manifest.json +55 -55
  2. package/dist/advanced-table.js +1 -1
  3. package/dist/ai/all-schemas.json +53 -14
  4. package/dist/ai/forms.json +2 -2
  5. package/dist/ai/index.json +2 -2
  6. package/dist/ai/kits/dropdown.schema.json +44 -11
  7. package/dist/ai/kits/label_pill.schema.json +1 -0
  8. package/dist/ai/kits/legend.schema.json +1 -0
  9. package/dist/ai/kits/online_status.schema.json +1 -0
  10. package/dist/ai/kits/pill.schema.json +1 -0
  11. package/dist/ai/kits/source.schema.json +1 -0
  12. package/dist/ai/kits/stat_change.schema.json +1 -0
  13. package/dist/ai/kits/typeahead.schema.json +3 -3
  14. package/dist/ai/playgrounds/dropdown.json +1 -1
  15. package/dist/ai/playgrounds/index.json +1 -1
  16. package/dist/ai/playgrounds/typeahead.json +1 -1
  17. package/dist/charts.js +1 -1
  18. package/dist/chunks/_pagination-D0hcdUl3.js +1 -0
  19. package/dist/chunks/{_pb_line_graph-Du7xE9vl.js → _pb_line_graph-BKwbOeqo.js} +1 -1
  20. package/dist/chunks/{_detail-Bsvl694i.js → _tooltip-DfZEKsnv.js} +2 -2
  21. package/dist/chunks/_typeahead-CmJ8Ggzz.js +1 -0
  22. package/dist/chunks/{globalProps-B120NbSJ.js → globalProps-BivjwRew.js} +1 -1
  23. package/dist/chunks/lib-C50eCpoN.js +29 -0
  24. package/dist/chunks/{time_picker_helper-CYGg0UQ0.js → time_picker_helper-DfKvHCJu.js} +1 -1
  25. package/dist/chunks/vendor.js +2 -2
  26. package/dist/playbook-advanced-table.js +1 -1
  27. package/dist/playbook-charts.js +1 -1
  28. package/dist/playbook-rails-charts-bindings.js +1 -1
  29. package/dist/playbook-rails-react-bindings.js +1 -1
  30. package/dist/playbook-rails.js +1 -1
  31. package/dist/playbook.css +1 -1
  32. package/dist/playbook.js +1 -1
  33. package/package.json +2 -4
  34. package/dist/chunks/_table-Bf6LGyL9.js +0 -1
  35. package/dist/chunks/_typeahead-w6S5Vx4b.js +0 -1
  36. package/dist/chunks/lib-Buo6zHEw.js +0 -29
@@ -3,54 +3,54 @@
3
3
  "file": "chunks/StickyLayoutHelper-DCzCcWUN.js",
4
4
  "name": "StickyLayoutHelper"
5
5
  },
6
- "__detail-Bsvl694i.js": {
7
- "file": "chunks/_detail-Bsvl694i.js",
8
- "name": "_detail",
6
+ "__pagination-D0hcdUl3.js": {
7
+ "file": "chunks/_pagination-D0hcdUl3.js",
8
+ "name": "_pagination",
9
9
  "imports": [
10
- "_globalProps-B120NbSJ.js",
11
- "_lib-Buo6zHEw.js"
10
+ "_globalProps-BivjwRew.js",
11
+ "_lib-C50eCpoN.js",
12
+ "__tooltip-DfZEKsnv.js",
13
+ "_quickpickDateSync-DLDx4zce.js"
12
14
  ]
13
15
  },
14
- "__pb_line_graph-Du7xE9vl.js": {
15
- "file": "chunks/_pb_line_graph-Du7xE9vl.js",
16
+ "__pb_line_graph-BKwbOeqo.js": {
17
+ "file": "chunks/_pb_line_graph-BKwbOeqo.js",
16
18
  "name": "_pb_line_graph",
17
19
  "imports": [
18
- "_globalProps-B120NbSJ.js",
19
- "_lib-Buo6zHEw.js"
20
+ "_globalProps-BivjwRew.js",
21
+ "_lib-C50eCpoN.js"
20
22
  ]
21
23
  },
22
- "__table-Bf6LGyL9.js": {
23
- "file": "chunks/_table-Bf6LGyL9.js",
24
- "name": "_table",
24
+ "__tooltip-DfZEKsnv.js": {
25
+ "file": "chunks/_tooltip-DfZEKsnv.js",
26
+ "name": "_tooltip",
25
27
  "imports": [
26
- "__detail-Bsvl694i.js",
27
- "_globalProps-B120NbSJ.js",
28
- "_lib-Buo6zHEw.js",
29
- "_quickpickDateSync-DLDx4zce.js"
28
+ "_globalProps-BivjwRew.js",
29
+ "_lib-C50eCpoN.js"
30
30
  ]
31
31
  },
32
- "__typeahead-w6S5Vx4b.js": {
33
- "file": "chunks/_typeahead-w6S5Vx4b.js",
32
+ "__typeahead-CmJ8Ggzz.js": {
33
+ "file": "chunks/_typeahead-CmJ8Ggzz.js",
34
34
  "name": "_typeahead",
35
35
  "imports": [
36
- "_lib-Buo6zHEw.js",
37
- "_globalProps-B120NbSJ.js",
38
- "__detail-Bsvl694i.js"
36
+ "_lib-C50eCpoN.js",
37
+ "_globalProps-BivjwRew.js",
38
+ "__tooltip-DfZEKsnv.js"
39
39
  ]
40
40
  },
41
41
  "_componentRegistry-DRSp5D_e.js": {
42
42
  "file": "chunks/componentRegistry-DRSp5D_e.js",
43
43
  "name": "componentRegistry"
44
44
  },
45
- "_globalProps-B120NbSJ.js": {
46
- "file": "chunks/globalProps-B120NbSJ.js",
45
+ "_globalProps-BivjwRew.js": {
46
+ "file": "chunks/globalProps-BivjwRew.js",
47
47
  "name": "globalProps",
48
48
  "imports": [
49
- "_lib-Buo6zHEw.js"
49
+ "_lib-C50eCpoN.js"
50
50
  ]
51
51
  },
52
- "_lib-Buo6zHEw.js": {
53
- "file": "chunks/lib-Buo6zHEw.js",
52
+ "_lib-C50eCpoN.js": {
53
+ "file": "chunks/lib-C50eCpoN.js",
54
54
  "name": "lib",
55
55
  "css": [
56
56
  "lib.css"
@@ -64,11 +64,11 @@
64
64
  "file": "chunks/quickpickDateSync-DLDx4zce.js",
65
65
  "name": "quickpickDateSync"
66
66
  },
67
- "_time_picker_helper-CYGg0UQ0.js": {
68
- "file": "chunks/time_picker_helper-CYGg0UQ0.js",
67
+ "_time_picker_helper-DfKvHCJu.js": {
68
+ "file": "chunks/time_picker_helper-DfKvHCJu.js",
69
69
  "name": "time_picker_helper",
70
70
  "imports": [
71
- "_lib-Buo6zHEw.js"
71
+ "_lib-C50eCpoN.js"
72
72
  ]
73
73
  },
74
74
  "entrypoints/playbook-advanced-table.js": {
@@ -78,10 +78,10 @@
78
78
  "isEntry": true,
79
79
  "imports": [
80
80
  "entrypoints/playbook-advanced-table.js",
81
- "_globalProps-B120NbSJ.js",
82
- "_lib-Buo6zHEw.js",
83
- "__table-Bf6LGyL9.js",
84
- "__detail-Bsvl694i.js",
81
+ "_globalProps-BivjwRew.js",
82
+ "_lib-C50eCpoN.js",
83
+ "__pagination-D0hcdUl3.js",
84
+ "__tooltip-DfZEKsnv.js",
85
85
  "_quickpickDateSync-DLDx4zce.js",
86
86
  "_StickyLayoutHelper-DCzCcWUN.js"
87
87
  ]
@@ -92,9 +92,9 @@
92
92
  "src": "entrypoints/playbook-charts.js",
93
93
  "isEntry": true,
94
94
  "imports": [
95
- "__pb_line_graph-Du7xE9vl.js",
96
- "_globalProps-B120NbSJ.js",
97
- "_lib-Buo6zHEw.js"
95
+ "__pb_line_graph-BKwbOeqo.js",
96
+ "_globalProps-BivjwRew.js",
97
+ "_lib-C50eCpoN.js"
98
98
  ]
99
99
  },
100
100
  "entrypoints/playbook-rails-charts-bindings.js": {
@@ -104,9 +104,9 @@
104
104
  "isEntry": true,
105
105
  "imports": [
106
106
  "_componentRegistry-DRSp5D_e.js",
107
- "__pb_line_graph-Du7xE9vl.js",
108
- "_globalProps-B120NbSJ.js",
109
- "_lib-Buo6zHEw.js"
107
+ "__pb_line_graph-BKwbOeqo.js",
108
+ "_globalProps-BivjwRew.js",
109
+ "_lib-C50eCpoN.js"
110
110
  ]
111
111
  },
112
112
  "entrypoints/playbook-rails-react-bindings.js": {
@@ -116,10 +116,10 @@
116
116
  "isEntry": true,
117
117
  "imports": [
118
118
  "_componentRegistry-DRSp5D_e.js",
119
- "__typeahead-w6S5Vx4b.js",
120
- "_lib-Buo6zHEw.js",
121
- "_globalProps-B120NbSJ.js",
122
- "__detail-Bsvl694i.js"
119
+ "__typeahead-CmJ8Ggzz.js",
120
+ "_lib-C50eCpoN.js",
121
+ "_globalProps-BivjwRew.js",
122
+ "__tooltip-DfZEKsnv.js"
123
123
  ]
124
124
  },
125
125
  "entrypoints/playbook-rails.js": {
@@ -128,14 +128,14 @@
128
128
  "src": "entrypoints/playbook-rails.js",
129
129
  "isEntry": true,
130
130
  "imports": [
131
- "_lib-Buo6zHEw.js",
132
- "__typeahead-w6S5Vx4b.js",
133
- "_time_picker_helper-CYGg0UQ0.js",
131
+ "_lib-C50eCpoN.js",
132
+ "__typeahead-CmJ8Ggzz.js",
133
+ "_time_picker_helper-DfKvHCJu.js",
134
134
  "_quickpickDateSync-DLDx4zce.js",
135
135
  "_StickyLayoutHelper-DCzCcWUN.js",
136
136
  "entrypoints/playbook-rails-react-bindings.js",
137
- "_globalProps-B120NbSJ.js",
138
- "__detail-Bsvl694i.js",
137
+ "_globalProps-BivjwRew.js",
138
+ "__tooltip-DfZEKsnv.js",
139
139
  "_componentRegistry-DRSp5D_e.js"
140
140
  ]
141
141
  },
@@ -145,14 +145,14 @@
145
145
  "src": "entrypoints/playbook.js",
146
146
  "isEntry": true,
147
147
  "imports": [
148
- "__detail-Bsvl694i.js",
149
- "__typeahead-w6S5Vx4b.js",
148
+ "__tooltip-DfZEKsnv.js",
149
+ "__typeahead-CmJ8Ggzz.js",
150
150
  "entrypoints/playbook.js",
151
- "__table-Bf6LGyL9.js",
152
- "_lib-Buo6zHEw.js",
153
- "_globalProps-B120NbSJ.js",
154
- "_quickpickDateSync-DLDx4zce.js",
155
- "_time_picker_helper-CYGg0UQ0.js"
151
+ "__pagination-D0hcdUl3.js",
152
+ "_lib-C50eCpoN.js",
153
+ "_globalProps-BivjwRew.js",
154
+ "_time_picker_helper-DfKvHCJu.js",
155
+ "_quickpickDateSync-DLDx4zce.js"
156
156
  ]
157
157
  },
158
158
  "entrypoints/playbook.scss": {
@@ -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-B120NbSJ.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/_table-Bf6LGyL9.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/_detail-Bsvl694i.js";import"./chunks/lib-Buo6zHEw.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-D0hcdUl3.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-DfZEKsnv.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
  *
@@ -5415,6 +5415,14 @@
5415
5415
  "rails"
5416
5416
  ],
5417
5417
  "props": {
5418
+ "allowOptionCreation": {
5419
+ "type": "boolean",
5420
+ "platforms": [
5421
+ "react",
5422
+ "rails"
5423
+ ],
5424
+ "default": false
5425
+ },
5418
5426
  "async": {
5419
5427
  "type": "boolean",
5420
5428
  "platforms": [
@@ -5555,6 +5563,12 @@
5555
5563
  "rails"
5556
5564
  ]
5557
5565
  },
5566
+ "enableFormSupport": {
5567
+ "type": "boolean",
5568
+ "platforms": [
5569
+ "react"
5570
+ ]
5571
+ },
5558
5572
  "isClosed": {
5559
5573
  "type": "boolean",
5560
5574
  "platforms": [
@@ -5680,17 +5694,19 @@
5680
5694
  "default": false
5681
5695
  },
5682
5696
  "required": {
5697
+ "type": "boolean",
5683
5698
  "platforms": [
5699
+ "react",
5684
5700
  "rails"
5685
5701
  ],
5686
- "type": "boolean",
5687
5702
  "default": false
5688
5703
  },
5689
5704
  "validationMessage": {
5705
+ "type": "string",
5690
5706
  "platforms": [
5707
+ "react",
5691
5708
  "rails"
5692
5709
  ],
5693
- "type": "string",
5694
5710
  "default": ""
5695
5711
  },
5696
5712
  "searchTermMinimumLength": {
@@ -5779,13 +5795,13 @@
5779
5795
  "usage": {
5780
5796
  "react": {
5781
5797
  "import": "import { Dropdown } from 'playbook-ui'",
5782
- "example": "<Dropdown />",
5783
- "preset": "Async search"
5798
+ "example": "<Dropdown allowOptionCreation multiSelect name=\"tags[]\" label=\"Tags\" />",
5799
+ "preset": "Create tags"
5784
5800
  },
5785
5801
  "rails": {
5786
5802
  "import": null,
5787
- "example": "<%= pb_rails(\"dropdown\") %>",
5788
- "preset": "Async search"
5803
+ "example": "<%= pb_rails(\"dropdown\", props: { allow_option_creation: true, multi_select: true, name: \"tags[]\", label: \"Tags\" }) %>",
5804
+ "preset": "Create tags"
5789
5805
  }
5790
5806
  },
5791
5807
  "category": "form_selection",
@@ -5828,7 +5844,7 @@
5828
5844
  "submission": {
5829
5845
  "submits": true,
5830
5846
  "value": "Selected option id in a CSS-hidden input (not input type=hidden).",
5831
- "multi": "Comma-joining is only the default-value encoding (data-default-value and a temporary baseInput.value). After kit JS runs, syncHiddenInputs emits one input type=\"hidden\" per selected id, all named name[] (the CSS-hidden input already has [] appended), then clears that original CSS-hidden input. Rails receives separate array entries such as [\"ca\",\"us\"], not \"ca,us\".",
5847
+ "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.",
5832
5848
  "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."
5833
5849
  },
5834
5850
  "validation": {
@@ -5962,6 +5978,20 @@
5962
5978
  "form.rails.builder.simpleForm"
5963
5979
  ]
5964
5980
  },
5981
+ {
5982
+ "id": "dropdown.option-creation",
5983
+ "platforms": [
5984
+ "react",
5985
+ "rails"
5986
+ ],
5987
+ "questions": [
5988
+ "How do I create new Dropdown options?"
5989
+ ],
5990
+ "answer": "Enable allowOptionCreation (Rails: allow_option_creation). The default trigger enables autocomplete. Custom Rails subcomponents must supply an autocomplete trigger or search bar. Creation supports single and multiple selections, including async, and is ignored for quickpick. A selectable Create row yields { id: text, label: text, value: text, __isNew__: true } through normal React selection callbacks, Rails pb:dropdown:selected events, and native form submission. Text is trimmed and blank or case-insensitive existing/selected labels, values and IDs are rejected. Exact ID or value matches keep the existing option selectable even if its label does not contain the query. Pending async searches and errors suppress creation. Creation only selects local text; the application owns persistence.",
5991
+ "props": [
5992
+ "allowOptionCreation"
5993
+ ]
5994
+ },
5965
5995
  {
5966
5996
  "id": "dropdown.builder-name",
5967
5997
  "platforms": [
@@ -5971,7 +6001,7 @@
5971
6001
  "Does dropdown_field scope country to user[country]?",
5972
6002
  "Does multi_select submit separate array values?"
5973
6003
  ],
5974
- "answer": "Pass the attribute (e.g. :country) so the builder can auto-bind default_value and errors from the model; pass user[country] explicitly when you need that nested parameter name instead. multi_select appends [] to the CSS-hidden input name. Comma-joining is only for default-value encoding. After kit JS runs, Playbook emits one type=\"hidden\" input per selected id (all named name[]), clears the original CSS-hidden input, and Rails receives separate array entries.",
6004
+ "answer": "Pass the attribute (e.g. :country) so the builder can auto-bind default_value and errors from the model; pass user[country] explicitly when you need that nested parameter name instead. multi_select adds [] only if absent, preserves selection order and removes the original CSS-hidden input name while per-selection hidden inputs submit. When selection is 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.",
5975
6005
  "contractPaths": [
5976
6006
  "form.rails.builder.methods"
5977
6007
  ],
@@ -6073,7 +6103,7 @@
6073
6103
  "How do I reset React Dropdown?",
6074
6104
  "Does cacheOptions remember an empty search?"
6075
6105
  ],
6076
- "answer": "Use onInputChange(text, { reason }) for input and clear notifications. Selection itself does not emit an input notification; use onSelect. In async mode, emptying single-select autocomplete proposes an empty selection even without onInputChange; emptying a multi-select or search-bar query preserves selection. With loadOptions, an empty query and a multi-select selection restore the defaultOptions results. A single-select autocomplete selection keeps that search result list and shows the selected label in the input; opening the menu again shows only results whose labels contain that text. Typing a character replaces the query only while the input still shows that label, including when a controlled value later arrives as null. Once the text has changed, further characters edit the query in place. Backspace and Delete remove one character and keep the selection until the query is empty. Escape, an outside click, or disabling the kit cancels an in-flight loadOptions request and ignores its late response. If that search had cleared the list, the last settled options return, or defaultOptions when nothing has settled yet. Opening the menu again searches for the query still in the input; ref.clearSelected() drops that retry. A search that already settled as an error or with no results keeps that message when the menu closes, and opening it again does not search again. Opening an async Dropdown with no source options, or a search that settles empty and has no earlier label matches, shows the empty message (noOptionsText, default \"No results found\"). When a search returns nothing, earlier results whose labels contain the query stay visible, including text typed after a space. cacheOptions stores the server response for that exact query, including an empty array. Each Dropdown keeps at most 100 queries. Errors are not cached. Repeating the query after a clear shows that cached response, so an empty search stays empty. Already-selected rows are hidden and do not count as an empty search, so a successful result list or an idle list that still contains options does not show that message when every remaining row is selected. blankSelection is not a search result: an empty async list shows the empty message instead of the blank row, and the blank row is included when results are present. Async options are identified by value, then id, then label. Reset controlled value through the application or form library, or call ref.clearSelected() for an uncontrolled selection. React Dropdown does not add native form-reset handling. For application-managed fetching, use async with options and loading without loadOptions; the application owns debounce, query thresholds, errors and stale-response protection. When the menu is open, a new result list focuses the first match so Enter selects it, for both loadOptions and application-managed options. ArrowDown and ArrowUp still move through that list.",
6106
+ "answer": "Use onInputChange(text, { reason }) for input and clear notifications. Selection itself does not emit an input notification; use onSelect. In async mode, emptying single-select autocomplete proposes an empty selection even without onInputChange; emptying a multi-select or search-bar query preserves selection. With loadOptions, an empty query and a multi-select selection restore the defaultOptions results. A single-select autocomplete selection keeps that search result list and shows the selected label in the input; opening the menu again shows only results whose labels contain that text. Typing a character replaces the query only while the input still shows that label, including when a controlled value later arrives as null. Once the text has changed, further characters edit the query in place. Backspace and Delete remove one character and keep the selection until the query is empty. Escape, an outside click, or disabling the kit cancels an in-flight loadOptions request and ignores its late response. If that search had cleared the list, the last settled options return, or defaultOptions when nothing has settled yet. Opening the menu again searches for the query still in the input; ref.clearSelected() drops that retry. A search that already settled as an error or with no results keeps that message when the menu closes, and opening it again does not search again. Opening an async Dropdown with no source options, or a search that settles empty and has no earlier label matches, shows the empty message (noOptionsText, default \"No results found\"). When a search returns nothing, earlier results whose labels contain the query stay visible, including text typed after a space. cacheOptions stores the server response for that exact query, including an empty array. Each Dropdown keeps at most 100 queries. Errors are not cached. Repeating the query after a clear shows that cached response, so an empty search stays empty. Already-selected rows are hidden and do not count as an empty search, so a successful result list or an idle list that still contains options does not show that message when every remaining row is selected. blankSelection is not a search result: an empty async list shows the empty message instead of the blank row, and the blank row is included when results are present. Async options are identified by value, then id, then label. Reset controlled value through the application or form library, or call ref.clearSelected() for an uncontrolled selection. With enableFormSupport: true, native form reset restores defaultValue, clears the query and validation state, closes the menu, and reports the reset through selection callbacks. Controlled parents must accept the new value. Canceled resets preserve state. For application-managed fetching, use async with options and loading without loadOptions; the application owns debounce, query thresholds, errors and stale-response protection. When the menu is open, a new result list focuses the first match so Enter selects it, for both loadOptions and application-managed options. ArrowDown and ArrowUp still move through that list.",
6077
6107
  "props": [
6078
6108
  "onInputChange",
6079
6109
  "async",
@@ -6096,12 +6126,15 @@
6096
6126
  "Can I use Dropdown with react-hook-form?",
6097
6127
  "Does the React Dropdown submit a value?"
6098
6128
  ],
6099
- "answer": "Spread register(\"country\") onto Dropdown. It accepts name and onChange, and calls onChange with { target: { name, value } } in addition to any onSelect. value is the selected option object, an array for multiSelect and null or [] when cleared, so read value.value in form state. The ref from register resolves to the kit imperative handle, not an input, and no named input is rendered; the React kit has no native form submission.",
6129
+ "answer": "Use a controlled form-library adapter with name, value, and onChange. It accepts name and onChange, and calls onChange with { target: { name, value } } in addition to any onSelect. value is the selected option object, an array for multiSelect and null or [] when cleared, so read value.value in form state. The ref resolves to the kit imperative handle, not an input. With enableFormSupport: true and name, native forms submit selected id (falling back to value) through hidden inputs; multiSelect emits one input per selection and adds [] only if absent. Disabled fields are omitted. enableFormSupport defaults to false, so name alone adds no native inputs or reset handling. With form support enabled, required validates the selection and validationMessage sets the inline required message. Native reset restores defaultValue through the normal callbacks; controlled parents must update value.",
6100
6130
  "props": [
6101
6131
  "name",
6102
6132
  "onChange",
6103
6133
  "onSelect",
6104
- "multiSelect"
6134
+ "multiSelect",
6135
+ "enableFormSupport",
6136
+ "required",
6137
+ "validationMessage"
6105
6138
  ]
6106
6139
  }
6107
6140
  ]
@@ -7995,6 +8028,7 @@
7995
8028
  }
7996
8029
  },
7997
8030
  "globalProps": true,
8031
+ "globalEventProps": true,
7998
8032
  "usage": {
7999
8033
  "react": {
8000
8034
  "import": "import { LabelPill } from 'playbook-ui'",
@@ -8273,6 +8307,7 @@
8273
8307
  }
8274
8308
  },
8275
8309
  "globalProps": true,
8310
+ "globalEventProps": true,
8276
8311
  "usage": {
8277
8312
  "react": {
8278
8313
  "import": "import { Legend } from 'playbook-ui'",
@@ -9497,6 +9532,7 @@
9497
9532
  }
9498
9533
  },
9499
9534
  "globalProps": true,
9535
+ "globalEventProps": true,
9500
9536
  "usage": {
9501
9537
  "react": {
9502
9538
  "import": "import { OnlineStatus } from 'playbook-ui'",
@@ -10519,6 +10555,7 @@
10519
10555
  }
10520
10556
  },
10521
10557
  "globalProps": true,
10558
+ "globalEventProps": true,
10522
10559
  "usage": {
10523
10560
  "react": {
10524
10561
  "import": "import { Pill } from 'playbook-ui'",
@@ -12364,6 +12401,7 @@
12364
12401
  }
12365
12402
  },
12366
12403
  "globalProps": true,
12404
+ "globalEventProps": true,
12367
12405
  "usage": {
12368
12406
  "react": {
12369
12407
  "import": "import { Source } from 'playbook-ui'",
@@ -12764,6 +12802,7 @@
12764
12802
  }
12765
12803
  },
12766
12804
  "globalProps": true,
12805
+ "globalEventProps": true,
12767
12806
  "usage": {
12768
12807
  "react": {
12769
12808
  "import": "import { StatChange } from 'playbook-ui'",
@@ -15622,7 +15661,7 @@
15622
15661
  ],
15623
15662
  "default": false
15624
15663
  },
15625
- "showPillIndex": {
15664
+ "externalDragHandle": {
15626
15665
  "type": "boolean",
15627
15666
  "platforms": [
15628
15667
  "react",
@@ -15630,13 +15669,13 @@
15630
15669
  ],
15631
15670
  "default": false
15632
15671
  },
15633
- "pillDragHandle": {
15672
+ "showPillIndex": {
15634
15673
  "type": "boolean",
15635
15674
  "platforms": [
15636
15675
  "react",
15637
15676
  "rails"
15638
15677
  ],
15639
- "default": true
15678
+ "default": false
15640
15679
  },
15641
15680
  "styles": {
15642
15681
  "type": "TypeaheadStylesConfig",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "metadataVersion": 1,
3
- "version": "18.2.0",
3
+ "version": "18.3.0-rc.1",
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": "Comma-joining is only the default-value encoding (data-default-value and a temporary baseInput.value). After kit JS runs, syncHiddenInputs emits one input type=\"hidden\" per selected id, all named name[] (the CSS-hidden input already has [] appended), then clears that original CSS-hidden input. Rails receives separate array entries such as [\"ca\",\"us\"], not \"ca,us\".",
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.",
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",
2
+ "version": "18.3.0-rc.1",
3
3
  "metadataVersion": 1,
4
4
  "forms": "forms.json",
5
- "generated": "2026-10-22T17:59:05.292Z",
5
+ "generated": "2026-10-26T19:43:37.493Z",
6
6
  "schemas": {
7
7
  "globalProps": "global-props.schema.json",
8
8
  "globalEventProps": "global-event-props.schema.json",