@ngrok/mantle 0.90.3 → 0.90.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.json +1 -1
- package/dist/data-table.d.ts +106 -12
- package/dist/data-table.js +1 -1
- package/dist/llms.txt +1 -1
- package/package.json +1 -1
package/dist/agent.json
CHANGED
package/dist/data-table.d.ts
CHANGED
|
@@ -9,6 +9,40 @@ export * from "@tanstack/react-table";
|
|
|
9
9
|
//#region src/components/data-table/types.d.ts
|
|
10
10
|
declare const sortDirections: readonly ["asc", "desc", "unsorted"];
|
|
11
11
|
type SortDirection = (typeof sortDirections)[number];
|
|
12
|
+
/**
|
|
13
|
+
* How wide a `DataTable` column renders. `"fit"` makes the column only as wide
|
|
14
|
+
* as its widest content, on one line, and gives the spare width to the other
|
|
15
|
+
* columns.
|
|
16
|
+
*/
|
|
17
|
+
type ColumnWidth = "fit";
|
|
18
|
+
/**
|
|
19
|
+
* The column `meta` fields that `DataTable.Header` and `DataTable.Cell` read
|
|
20
|
+
* through their `column` prop. Tables with no `columnMeta` slot get these
|
|
21
|
+
* fields from the global `ColumnMeta` interface. A table with a `columnMeta`
|
|
22
|
+
* slot must add them to the slot type, because the slot replaces the global
|
|
23
|
+
* interface.
|
|
24
|
+
*
|
|
25
|
+
* @see https://mantle.ngrok.com/components/data-display/data-table#sizing-a-column-to-its-content
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* type PaymentsColumnMeta = DataTableColumnMeta & { align?: "start" | "end" };
|
|
30
|
+
*
|
|
31
|
+
* const features = tableFeatures({
|
|
32
|
+
* columnMeta: metaHelper<PaymentsColumnMeta>(),
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
type DataTableColumnMeta = {
|
|
37
|
+
/**
|
|
38
|
+
* How wide the column renders. When omitted, the browser shares the
|
|
39
|
+
* table's spare width across every column.
|
|
40
|
+
*/
|
|
41
|
+
width?: ColumnWidth;
|
|
42
|
+
};
|
|
43
|
+
declare module "@tanstack/react-table" {
|
|
44
|
+
interface ColumnMeta<in out TFeatures extends TableFeatures, in out TData extends RowData, TValue extends CellData = CellData> extends DataTableColumnMeta {}
|
|
45
|
+
}
|
|
12
46
|
//#endregion
|
|
13
47
|
//#region src/components/data-table/data-table.d.ts
|
|
14
48
|
/**
|
|
@@ -191,7 +225,8 @@ declare function HeaderSortButton<TFeatures extends SortableTableFeatures, TData
|
|
|
191
225
|
type DataTableHeaderProps<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData> = ComponentProps<typeof Table$1.Header> & {
|
|
192
226
|
/**
|
|
193
227
|
* The TanStack Table column this cell heads (`props.column` in `header`).
|
|
194
|
-
* When the column is sorted, the cell carries `aria-sort`.
|
|
228
|
+
* When the column is sorted, the cell carries `aria-sort`. When the
|
|
229
|
+
* column's `meta.width` is `"fit"`, the cell carries `data-column-width="fit"`.
|
|
195
230
|
*/
|
|
196
231
|
column?: Column<TFeatures, TData, TValue>;
|
|
197
232
|
} & WithDataSlot;
|
|
@@ -199,7 +234,15 @@ type DataTableHeaderProps<TFeatures extends TableFeatures, TData extends RowData
|
|
|
199
234
|
* A `<th>` optimized for header actions. Wrap each column's header content in
|
|
200
235
|
* this; for sortable columns, nest a `DataTable.HeaderSortButton` inside and
|
|
201
236
|
* pass the same `column` here, so the cell carries `aria-sort` while the column
|
|
202
|
-
* is sorted. Non-sortable columns can render plain text.
|
|
237
|
+
* is sorted. Non-sortable columns can render plain text. The `column` prop
|
|
238
|
+
* also applies the column's `meta.width`.
|
|
239
|
+
*
|
|
240
|
+
* **Data attributes:**
|
|
241
|
+
*
|
|
242
|
+
* | Data Attribute | Value | Description |
|
|
243
|
+
* | --- | --- | --- |
|
|
244
|
+
* | `data-slot` | `"data-table-header table-header"` | On the `<th>`, joined ahead of `Table.Header`'s own slot. |
|
|
245
|
+
* | `data-column-width` | `"fit"` | Present when the `column` prop's `meta.width` is `"fit"`. The header does not wrap its content, and the column shrinks to fit it. |
|
|
203
246
|
*
|
|
204
247
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatableheader
|
|
205
248
|
*
|
|
@@ -219,6 +262,40 @@ type DataTableHeaderProps<TFeatures extends TableFeatures, TData extends RowData
|
|
|
219
262
|
* ```
|
|
220
263
|
*/
|
|
221
264
|
declare function Header<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData>({ "data-slot": dataSlot, children, className, column, ...props }: DataTableHeaderProps<TFeatures, TData, TValue>): import("react").JSX.Element;
|
|
265
|
+
type DataTableCellProps<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData> = ComponentProps<typeof Table$1.Cell> & {
|
|
266
|
+
/**
|
|
267
|
+
* The TanStack Table column this cell belongs to (`props.column` in `cell`).
|
|
268
|
+
* When the column's `meta.width` is `"fit"`, the cell carries
|
|
269
|
+
* `data-column-width="fit"`.
|
|
270
|
+
*/
|
|
271
|
+
column?: Column<TFeatures, TData, TValue>;
|
|
272
|
+
} & WithDataSlot;
|
|
273
|
+
/**
|
|
274
|
+
* A `<td>` for one data cell. Wrap the output of each column's `cell`
|
|
275
|
+
* function in this; a raw `<td>` skips mantle typography and padding. Pass
|
|
276
|
+
* `column` to apply the column's `meta.width`, and pass the same `column` to
|
|
277
|
+
* the column's `DataTable.Header`, so the header and every cell agree.
|
|
278
|
+
*
|
|
279
|
+
* **Data attributes:**
|
|
280
|
+
*
|
|
281
|
+
* | Data Attribute | Value | Description |
|
|
282
|
+
* | --- | --- | --- |
|
|
283
|
+
* | `data-slot` | `"data-table-cell table-cell"` | On the `<td>`, joined ahead of `Table.Cell`'s own slot. |
|
|
284
|
+
* | `data-column-width` | `"fit"` | Present when the `column` prop's `meta.width` is `"fit"`. The cell does not wrap its content, and the column shrinks to fit it. |
|
|
285
|
+
*
|
|
286
|
+
* @see https://mantle.ngrok.com/components/data-display/data-table#datatablecell
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```tsx
|
|
290
|
+
* columnHelper.accessor("createdAt", {
|
|
291
|
+
* id: "createdAt",
|
|
292
|
+
* meta: { width: "fit" },
|
|
293
|
+
* header: (props) => <DataTable.Header column={props.column}>Created</DataTable.Header>,
|
|
294
|
+
* cell: (props) => <DataTable.Cell column={props.column}>{props.getValue()}</DataTable.Cell>,
|
|
295
|
+
* });
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
declare function Cell<TFeatures extends TableFeatures, TData extends RowData, TValue extends CellData>({ "data-slot": dataSlot, className, column, ...props }: DataTableCellProps<TFeatures, TData, TValue>): import("react").JSX.Element;
|
|
222
299
|
/**
|
|
223
300
|
* The `<tbody>` container for rows of data. Typically wraps a map of
|
|
224
301
|
* `DataTable.Row`, with a `DataTable.EmptyRow` fallback when there is no data.
|
|
@@ -1200,22 +1277,31 @@ declare const DataTable: {
|
|
|
1200
1277
|
*/
|
|
1201
1278
|
readonly ActionHeader: typeof ActionHeader;
|
|
1202
1279
|
/**
|
|
1203
|
-
* A `<td>` for
|
|
1204
|
-
*
|
|
1205
|
-
*
|
|
1280
|
+
* A `<td>` for one data cell. Wrap the output of each column's `cell`
|
|
1281
|
+
* function in this; a raw `<td>` skips mantle typography and padding. Pass
|
|
1282
|
+
* `column` to apply the column's `meta.width`, and pass the same `column` to
|
|
1283
|
+
* the column's `DataTable.Header`, so the header and every cell agree.
|
|
1284
|
+
*
|
|
1285
|
+
* **Data attributes:**
|
|
1286
|
+
*
|
|
1287
|
+
* | Data Attribute | Value | Description |
|
|
1288
|
+
* | --- | --- | --- |
|
|
1289
|
+
* | `data-slot` | `"data-table-cell table-cell"` | On the `<td>`, joined ahead of `Table.Cell`'s own slot. |
|
|
1290
|
+
* | `data-column-width` | `"fit"` | Present when the `column` prop's `meta.width` is `"fit"`. The cell does not wrap its content, and the column shrinks to fit it. |
|
|
1206
1291
|
*
|
|
1207
1292
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatablecell
|
|
1208
1293
|
*
|
|
1209
1294
|
* @example
|
|
1210
1295
|
* ```tsx
|
|
1211
|
-
* columnHelper.accessor("
|
|
1212
|
-
* id: "
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1296
|
+
* columnHelper.accessor("createdAt", {
|
|
1297
|
+
* id: "createdAt",
|
|
1298
|
+
* meta: { width: "fit" },
|
|
1299
|
+
* header: (props) => <DataTable.Header column={props.column}>Created</DataTable.Header>,
|
|
1300
|
+
* cell: (props) => <DataTable.Cell column={props.column}>{props.getValue()}</DataTable.Cell>,
|
|
1215
1301
|
* });
|
|
1216
1302
|
* ```
|
|
1217
1303
|
*/
|
|
1218
|
-
readonly Cell:
|
|
1304
|
+
readonly Cell: typeof Cell;
|
|
1219
1305
|
/**
|
|
1220
1306
|
* The `<tbody>` container for rows of data. Typically wraps a map of
|
|
1221
1307
|
* `DataTable.Row`, with a `DataTable.EmptyRow` fallback when there is
|
|
@@ -1280,7 +1366,15 @@ declare const DataTable: {
|
|
|
1280
1366
|
* A `<th>` optimized for header actions. Wrap each column's header content in
|
|
1281
1367
|
* this; for sortable columns, nest a `DataTable.HeaderSortButton` inside and
|
|
1282
1368
|
* pass the same `column` here, so the cell carries `aria-sort` while the column
|
|
1283
|
-
* is sorted. Non-sortable columns can render plain text.
|
|
1369
|
+
* is sorted. Non-sortable columns can render plain text. The `column` prop
|
|
1370
|
+
* also applies the column's `meta.width`.
|
|
1371
|
+
*
|
|
1372
|
+
* **Data attributes:**
|
|
1373
|
+
*
|
|
1374
|
+
* | Data Attribute | Value | Description |
|
|
1375
|
+
* | --- | --- | --- |
|
|
1376
|
+
* | `data-slot` | `"data-table-header table-header"` | On the `<th>`, joined ahead of `Table.Header`'s own slot. |
|
|
1377
|
+
* | `data-column-width` | `"fit"` | Present when the `column` prop's `meta.width` is `"fit"`. The header does not wrap its content, and the column shrinks to fit it. |
|
|
1284
1378
|
*
|
|
1285
1379
|
* @see https://mantle.ngrok.com/components/data-display/data-table#datatableheader
|
|
1286
1380
|
*
|
|
@@ -1493,4 +1587,4 @@ declare const DataTable: {
|
|
|
1493
1587
|
readonly ExpandedRow: typeof ExpandedRow;
|
|
1494
1588
|
};
|
|
1495
1589
|
//#endregion
|
|
1496
|
-
export { DataTable, expandedRowId };
|
|
1590
|
+
export { DataTable, type DataTableColumnMeta, expandedRowId };
|
package/dist/data-table.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-b2HKEIE2.js";import{t as r}from"./button-Bkl_QYpp.js";import{t as i}from"./use-prefers-reduced-motion-DimzRx-M.js";import{t as a}from"./icons-CDLz5lpI.js";import{n as o}from"./sandboxed-on-click-C7pPu-2M.js";import{t as s}from"./table-DBbKqOVq.js";import{c}from"react/compiler-runtime";import{Fragment as l,createContext as u,useContext as d,useEffect as f,useRef as p,useState as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{Subscribe as y,callMemoOrStaticFn as b,flexRender as x}from"@tanstack/react-table";import{MinusIcon as S}from"@phosphor-icons/react/Minus";import{PlusIcon as C}from"@phosphor-icons/react/Plus";import{column_getIsSorted as w,row_getIsExpanded as T,row_getVisibleCells as E,table_getVisibleLeafColumns as D}from"@tanstack/react-table/static-functions";export*from"@tanstack/react-table";const O=[`unsorted`,`asc`,`desc`],k=[`unsorted`,`desc`,`asc`];function A(e,t){return j(t===`alphanumeric`?O:k,e)??`unsorted`}function j(e,t,n){if(e.length===0)return n;let r=e.findIndex(e=>e===t);if(r===-1)return n;let i=(r+1)%e.length;return e.at(i)??n}const M=u(null);function N(){return d(M)?.table.options}function P(){let e=d(M);return h(e,`useDataTableContext should only be used within a DataTable child component`),e}const F=u(null),I=/* @__PURE__ */ new Set;function L(e){return[...e.querySelectorAll(`:scope > tr`)]}function ee(e){let[,t=`0px`]=getComputedStyle(e).translate.split(` `);return e.offsetTop+(Number.parseFloat(t)||0)}function R(e,t,n){let r=/* @__PURE__ */ new Map,i=0,a=0;for(let o of L(e)){o.hasAttribute(`data-closing`)?a+=o.offsetHeight:(i+=a,a=0);let e=-i,s=t.get(o),c=s==null||Math.abs(s-o.offsetTop-e)<.5?e:s-o.offsetTop;r.set(o,o.offsetTop+e);let l=n.get(o);if(c!==e||(l?.to??0)!==e){if(n.delete(o),c!==e||e!==0){let t=o.animate([{translate:`0 ${c}px`},{translate:`0 ${e}px`}],{duration:c===e?0:200,easing:`cubic-bezier(0.23, 1, 0.32, 1)`,fill:e===0?`none`:`forwards`});n.set(o,{animation:t,to:e})}l?.animation.cancel()}}return r}function z(){let e=c(14),[t,n]=m(I),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=/* @__PURE__ */ new Map,e[0]=r):r=e[0];let a=p(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ new Map,e[1]=o):o=e[1];let s=p(o),l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=/* @__PURE__ */ new WeakMap,e[2]=l):l=e[2];let u=p(l),d,h;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=a.current,t=s.current;return()=>{for(let{timer:t}of e.values())clearTimeout(t);for(let{observer:e}of t.values())e.disconnect()}},h=[],e[3]=d,e[4]=h):(d=e[3],h=e[4]),f(d,h);let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},e[5]=g):g=e[5];let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let t=s.current.get(e);if(t!=null&&t.before==null){for(let t of a.current.values())if(t.body===e)return;t.observer.disconnect(),s.current.delete(e)}},e[6]=v):v=e[6];let y=v,b;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>{let n=s.current.get(e),r=t.filter(t=>t.type===`childList`?t.target===e:t.target.parentNode===e);if(n==null||r.length===0)return;let i=n.awaiting==null?null:a.current.get(n.awaiting);for(let e of r){let{target:t}=e;i!=null&&e.type===`attributes`&&t instanceof Element&&t.hasAttribute(`data-closing`)&&i.rows.add(t)}i!=null&&i.rows.size>0&&(n.awaiting=null);for(let[t,n]of a.current)n.body===e&&n.rows.size>0&&![...n.rows].some(te)&&(clearTimeout(n.timer),a.current.delete(t),_(t));let o=n.before??n.rest;n.before=null,n.rest=R(e,o,u.current),y(e)},e[7]=b):b=e[7];let x=b,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let t=s.current.get(e);if(t==null){let n=new MutationObserver(t=>x(e,t));n.observe(e,{attributeFilter:[`data-closing`],childList:!0,subtree:!0}),t={observer:n,before:null,rest:/* @__PURE__ */ new Map,awaiting:null},s.current.set(e,t)}if(t.before==null){let n=new Map(L(e).map(B));t.before=n;let r=t;requestAnimationFrame(()=>{r.before===n&&(r.before=null,y(e))})}return t},e[8]=S):S=e[8];let C=S,w;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=(e,t)=>{e!=null&&!i()&&C(e),t()},e[9]=w):w=e[9];let T=w,E;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{let t=a.current.get(e);t!=null&&(clearTimeout(t.timer),a.current.delete(e),C(t.body)),_(e)},e[10]=E):E=e[10];let D=E,O;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(e,t,r)=>{t==null||i()?r():(D(e),C(t).awaiting=e,a.current.set(e,{body:t,rows:/* @__PURE__ */ new Set,timer:setTimeout(()=>{a.current.delete(e),C(t),_(e),r()},200)}),n(t=>new Set(t).add(e)))},e[11]=O):O=e[11];let k=O,A;return e[12]===t?A=e[13]:(A={closingRowIds:t,startExpand:T,startCollapse:k,cancelCollapse:D},e[12]=t,e[13]=A),A}function B(e){return[e,ee(e)]}function te(e){return e.isConnected}function ne(e){let n=c(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({"data-slot":i,children:r,table:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let l;n[5]===o?l=n[6]:(l={table:o},n[5]=o,n[6]=l);let u=l,d=z(),f;n[7]===i?f=n[8]:(f=t(i,`data-table`),n[7]=i,n[8]=f);let p;n[9]===r?p=n[10]:(p=/* @__PURE__ */ _(s.Element,{children:r}),n[9]=r,n[10]=p);let m;n[11]!==a||n[12]!==f||n[13]!==p?(m=/* @__PURE__ */ _(s.Root,{"data-slot":f,...a,children:p}),n[11]=a,n[12]=f,n[13]=p,n[14]=m):m=n[14];let h;n[15]!==d||n[16]!==m?(h=/* @__PURE__ */ _(F.Provider,{value:d,children:m}),n[15]=d,n[16]=m,n[17]=h):h=n[17];let g;return n[18]!==u||n[19]!==h?(g=/* @__PURE__ */ _(M.Provider,{value:u,children:h}),n[18]=u,n[19]=h,n[20]=g):g=n[20],g}function re(r){let i=c(33),a,o,s,l,u,d,f,p,m,h,g,v;i[0]===r?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],v=i[12]):({"data-slot":l,appearance:m,children:a,className:o,column:s,disableSorting:h,iconPlacement:g,intent:v,sortingMode:p,sortIcon:d,onClick:u,...f}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=p,i[9]=m,i[10]=h,i[11]=g,i[12]=v);let b=m===void 0?`ghost`:m,x=h!==void 0&&h,S=g===void 0?`end`:g,C=v===void 0?`neutral`:v,w;i[13]!==b||i[14]!==a||i[15]!==o||i[16]!==s||i[17]!==l||i[18]!==x||i[19]!==S||i[20]!==C||i[21]!==u||i[22]!==d||i[23]!==f||i[24]!==p?(w=()=>{let r=s.getIsSorted(),i=!x&&s.getCanSort(),c=i&&typeof r==`string`?r:`unsorted`;if(!i)return/* @__PURE__ */ _(`span`,{"data-slot":t(l,`data-table-header-sort-button`),"data-sort-direction":`unsorted`,className:e(`flex w-full items-center justify-start`,b===`ghost`&&C===`neutral`&&`text-muted`,o),...f,children:a});let m=d?.(c)??/* @__PURE__ */ _($,{mode:p,direction:c});return/* @__PURE__ */ _(n,{appearance:b,"data-slot":t(l,`data-table-header-sort-button`),className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none`,b===`ghost`&&C===`neutral`&&`text-muted`,o),"data-sort-direction":c,"data-table-header-action":!0,icon:m,iconPlacement:S,onClick:e=>{u?.(e),!e.defaultPrevented&&p!==void 0&&_e(s,p)},intent:C,type:`button`,...f,children:a})},i[13]=b,i[14]=a,i[15]=o,i[16]=s,i[17]=l,i[18]=x,i[19]=S,i[20]=C,i[21]=u,i[22]=d,i[23]=f,i[24]=p,i[25]=w):w=i[25];let T=w,E=N(),D;i[26]!==s||i[27]!==E?(D=()=>({sorted:s.getIsSorted(),options:E}),i[26]=s,i[27]=E,i[28]=D):D=i[28];let O;return i[29]!==s.table.store||i[30]!==T||i[31]!==D?(O=/* @__PURE__ */ _(y,{source:s.table.store,selector:D,children:T}),i[29]=s.table.store,i[30]=T,i[31]=D,i[32]=O):O=i[32],O}function V(e){if(e==null)return;let t=b(e,`getIsSorted`,w);if(t===`asc`)return`ascending`;if(t===`desc`)return`descending`}function H(n){let r=c(21),i,a,o,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5]):({"data-slot":l,children:i,className:a,column:o,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u);let d;r[6]!==i||r[7]!==a||r[8]!==o||r[9]!==l||r[10]!==u?(d=()=>/* @__PURE__ */ _(s.Header,{"aria-sort":V(o),"data-slot":t(l,`data-table-header`),className:e(`has-data-table-header-action:px-0`,a),...u,children:i}),r[6]=i,r[7]=a,r[8]=o,r[9]=l,r[10]=u,r[11]=d):d=r[11];let f=d,p=N();if(o==null){let e;return r[12]===f?e=r[13]:(e=f(),r[12]=f,r[13]=e),e}let m;r[14]!==o||r[15]!==p?(m=()=>({ariaSort:V(o),options:p}),r[14]=o,r[15]=p,r[16]=m):m=r[16];let h;return r[17]!==o.table.store||r[18]!==f||r[19]!==m?(h=/* @__PURE__ */ _(y,{source:o.table.store,selector:m,children:f}),r[17]=o.table.store,r[18]=f,r[19]=m,r[20]=h):h=r[20],h}const U=e=>{let n=c(8),r,i;n[0]===e?(r=n[1],i=n[2]):({"data-slot":r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=t(r,`data-table-body`),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=/* @__PURE__ */ _(s.Body,{"data-slot":a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o};function W(e){let n=c(11),r,i;n[0]===e?(r=n[1],i=n[2]):({"data-slot":r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{table:a}=P(),o;n[3]===r?o=n[4]:(o=t(r,`data-table-head`),n[3]=r,n[4]=o);let l;n[5]===a?l=n[6]:(l=a.getHeaderGroups().map(G),n[5]=a,n[6]=l);let u;return n[7]!==i||n[8]!==o||n[9]!==l?(u=/* @__PURE__ */ _(s.Head,{"data-slot":o,...i,children:l}),n[7]=i,n[8]=o,n[9]=l,n[10]=u):u=n[10],u}function G(e){return/* @__PURE__ */ _(s.Row,{children:e.headers.map(K)},e.id)}function K(e){return/* @__PURE__ */ _(l,{children:e.isPlaceholder?/* @__PURE__ */ _(s.Header,{}):x(e.column.columnDef.header,e.getContext())},e.id)}const q=e(`starting:-translate-y-1 starting:opacity-0`,`motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out-strong`,`data-closing:pointer-events-none data-closing:opacity-0 motion-safe:data-closing:duration-150`);function J(e,t){return t.size===0||e.depth===0?!1:e.getParentRows().some(e=>t.has(e.id))}const Y=u(!1);function ie(e){if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.currentTarget.ownerDocument.getSelection();return t==null||t.isCollapsed?!0:!e.currentTarget.contains(t.anchorNode)}function ae(n){let r=c(21),i,a,o,l,u,f;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":a,className:i,onClick:o,renderExpanded:u,row:f,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p=d(F)?.closingRowIds??I,m;r[7]!==i||r[8]!==p||r[9]!==a||r[10]!==o||r[11]!==l||r[12]!==u||r[13]!==f?(m=()=>{let n=J(f,p),r=b(f,`getIsExpanded`,T),c=b(f,`getVisibleCells`,E),d=/* @__PURE__ */ _(s.Row,{"data-slot":t(a,`data-table-row`),"data-expanded":r||void 0,"data-closing":n||void 0,inert:n||void 0,"data-clickable":o==null?void 0:``,className:e(f.depth>0&&q,o!=null&&`cursor-pointer`,i),onClick:o&&(e=>{ie(e)&&o(e)}),...l,children:/* @__PURE__ */ _(Y.Provider,{value:u!=null,children:c.map(oe)})});return u==null?d:/* @__PURE__ */ v(g,{children:[d,r&&/* @__PURE__ */ _(Q,{row:f,children:u(f)})]})},r[7]=i,r[8]=p,r[9]=a,r[10]=o,r[11]=l,r[12]=u,r[13]=f,r[14]=m):m=r[14];let h=m,x=N(),S;r[15]===x?S=r[16]:(S=e=>({state:e,options:x}),r[15]=x,r[16]=S);let C;return r[17]!==h||r[18]!==f.table.store||r[19]!==S?(C=/* @__PURE__ */ _(y,{source:f.table.store,selector:S,children:h}),r[17]=h,r[18]=f.table.store,r[19]=S,r[20]=C):C=r[20],C}function oe(e){return/* @__PURE__ */ _(l,{children:x(e.column.columnDef.cell,e.getContext())},e.id)}function se(e){let n=c(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({"data-slot":i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{table:o}=P(),l;n[4]===o?l=n[5]:(l=b(o,`getVisibleLeafColumns`,D),n[4]=o,n[5]=l);let u=l.length,d;n[6]===i?d=n[7]:(d=t(i,`data-table-empty-row`),n[6]=i,n[7]=d);let f;n[8]!==r||n[9]!==u?(f=/* @__PURE__ */ _(s.Cell,{colSpan:u,children:r}),n[8]=r,n[9]=u,n[10]=f):f=n[10];let p;return n[11]!==a||n[12]!==d||n[13]!==f?(p=/* @__PURE__ */ _(s.Row,{"data-slot":d,...a,children:f}),n[11]=a,n[12]=d,n[13]=f,n[14]=p):p=n[14],p}function X(){let t=c(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ _(`span`,{"aria-hidden":!0,className:e(`pointer-events-none absolute -inset-y-px -left-1.5 w-1.5`,`opacity-0 transition-opacity group-data-sticky-active/table:opacity-100`,`shadow-[1px_0_0_0_var(--border-color-card-muted)]`,`bg-linear-to-l to-transparent`,`from-[color-mix(in_oklab,var(--shadow-color)_var(--shadow-second-opacity),transparent)]`)}),t[0]=n):n=t[0],n}function ce(n){let r=c(21),i,a,l,u,d;r[0]===n?(i=r[1],a=r[2],l=r[3],u=r[4],d=r[5]):({"data-slot":l,children:i,className:a,onClick:u,...d}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=l,r[4]=u,r[5]=d);let f;r[6]===u?f=r[7]:(f=o({allowClickEventDefault:!0,onClick:u}),r[6]=u,r[7]=f);let{onClick:p}=f,m;r[8]===l?m=r[9]:(m=t(l,`data-table-action-cell`),r[8]=l,r[9]=m);let h;r[10]===a?h=r[11]:(h=e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,a),r[10]=a,r[11]=h);let g;r[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=/* @__PURE__ */ _(X,{}),r[12]=g):g=r[12];let y;r[13]===i?y=r[14]:(y=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-cell-label`,className:`contents`,children:i}),r[13]=i,r[14]=y);let b;return r[15]!==d||r[16]!==p||r[17]!==m||r[18]!==h||r[19]!==y?(b=/* @__PURE__ */ v(s.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":m,className:h,onClick:p,...d,children:[g,y]}),r[15]=d,r[16]=p,r[17]=m,r[18]=h,r[19]=y,r[20]=b):b=r[20],b}function le(n){let r=c(27),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let{table:u}=P(),d;r[5]===u?d=r[6]:(d=u.getRowModel(),r[5]=u,r[6]=d);let f=d.rows.length>0,p;r[7]===f?p=r[8]:(p=f?{"data-mantle-table-sticky-right":!0}:{},r[7]=f,r[8]=p);let m;r[9]===o?m=r[10]:(m=t(o,`data-table-action-header`),r[9]=o,r[10]=m);let h=f&&`sticky z-10 right-0 bg-inherit`,g;r[11]!==a||r[12]!==h?(g=e(h,a),r[11]=a,r[12]=h,r[13]=g):g=r[13];let y;r[14]===i?y=r[15]:(y=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Actions`}),r[14]=i,r[15]=y);let b;r[16]===y?b=r[17]:(b=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-header-label`,className:`contents`,children:y}),r[16]=y,r[17]=b);let x;r[18]===f?x=r[19]:(x=f&&/* @__PURE__ */ _(X,{}),r[18]=f,r[19]=x);let S;return r[20]!==l||r[21]!==p||r[22]!==m||r[23]!==g||r[24]!==b||r[25]!==x?(S=/* @__PURE__ */ v(s.Header,{...p,"data-slot":m,className:g,...l,children:[b,x]}),r[20]=l,r[21]=p,r[22]=m,r[23]=g,r[24]=b,r[25]=x,r[26]=S):S=r[26],S}function ue(e){return e!=null&&`nodeType`in e}function de({"data-slot":n,children:r,className:i,onClick:a,...o}){let c=p(!1);return/* @__PURE__ */ _(s.Cell,{"data-slot":t(n,`data-table-control-cell`),className:e(`w-9 px-0 align-top has-[button:enabled,input:enabled]:cursor-pointer`,i),onClick:e=>{if(c.current){e.stopPropagation();return}a?.(e);let t=e.currentTarget.querySelector(`button:not(:disabled), input:not(:disabled)`);if(t!=null&&(e.stopPropagation(),!e.defaultPrevented&&ue(e.target)&&!t.contains(e.target))){t.focus({preventScroll:!0}),c.current=!0;try{t.click()}finally{c.current=!1}}},...o,children:/* @__PURE__ */ _(`span`,{"data-slot":`data-table-control-cell-label`,className:`flex h-lh items-center justify-center`,children:r})})}function Z(e){return`data-table-expanded-row-${encodeURIComponent(e.id)}`}function fe(n){let r=c(16),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u;r[5]===o?u=r[6]:(u=t(o,`data-table-expand-header`),r[5]=o,r[6]=u);let d;r[7]===a?d=r[8]:(d=e(`w-9 px-0 text-center`,a),r[7]=a,r[8]=d);let f;r[9]===i?f=r[10]:(f=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Row details`}),r[9]=i,r[10]=f);let p;return r[11]!==l||r[12]!==u||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ _(s.Header,{"data-slot":u,className:d,...l,children:f}),r[11]=l,r[12]=u,r[13]=d,r[14]=f,r[15]=p):p=r[15],p}const pe=/* @__PURE__ */ _(C,{weight:`bold`,className:`size-3.5`}),me=/* @__PURE__ */ _(S,{weight:`bold`,className:`size-3.5`});function he(n){let i=c(21),a,o,s,l,u,f,p,m,h,g,v;i[0]===n?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],f=i[6],p=i[7],m=i[8],h=i[9],g=i[10],v=i[11]):({"data-slot":o,appearance:p,className:a,collapseIcon:m,expandIcon:h,intent:g,label:s,onClick:l,row:f,size:v,...u}=n,i[0]=n,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=f,i[7]=p,i[8]=m,i[9]=h,i[10]=g,i[11]=v);let b=p===void 0?`ghost`:p,x=m===void 0?me:m,S=h===void 0?pe:h,C=g===void 0?`neutral`:g,w=v===void 0?`sm`:v,T=()=>{if(!f.getCanExpand())return null;let n=f.getIsExpanded()&&!k,i=f.getToggleExpandedHandler(),c=f.subRows.length>0,d=D||!c;return/* @__PURE__ */ _(r,{type:`button`,"data-slot":t(o,`data-table-row-expand-button`),appearance:b,intent:C,size:w,className:e(`rounded`,a),"aria-expanded":n,"aria-controls":n&&d?Z(f):void 0,icon:n?x:S,label:c?`${n?`Collapse`:`Expand`} ${s}`:`${n?`Hide`:`Show`} details for ${s}`,onClick:e=>{if(e.stopPropagation(),l?.(e),e.defaultPrevented)return;let t=e.currentTarget.closest(`tbody`);O==null?i():k?O.cancelCollapse(f.id):n?O.startCollapse(f.id,t,()=>f.toggleExpanded(!1)):O.startExpand(t,i)},...u})},E=N(),D=d(Y),O=d(F),k=O?.closingRowIds.has(f.id)??!1,A;i[12]!==D||i[13]!==k||i[14]!==E||i[15]!==f?(A=()=>({isExpanded:f.getIsExpanded(),hasDetailPanel:D,isClosing:k,options:E}),i[12]=D,i[13]=k,i[14]=E,i[15]=f,i[16]=A):A=i[16];let j;return i[17]!==T||i[18]!==f.table.store||i[19]!==A?(j=/* @__PURE__ */ _(y,{source:f.table.store,selector:A,children:T}),i[17]=T,i[18]=f.table.store,i[19]=A,i[20]=j):j=i[20],j}function Q(n){let r=c(29),i,a,o,l,u,f;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":l,children:i,className:a,colSpan:o,row:f,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p;r[7]===f?p=r[8]:(p=()=>b(f,`getVisibleCells`,E).length,r[7]=f,r[8]=p);let m=p,h=d(F)?.closingRowIds??I,g;r[9]!==h||r[10]!==f?(g=h.has(f.id)||J(f,h),r[9]=h,r[10]=f,r[11]=g):g=r[11];let v=g,x;r[12]!==i||r[13]!==a||r[14]!==l||r[15]!==v||r[16]!==u||r[17]!==f?(x=n=>{let{numberOfColumns:r}=n;return/* @__PURE__ */ _(s.Row,{"data-slot":t(l,`data-table-expanded-row`),"data-expanded-content":!0,"data-closing":v||void 0,inert:v||void 0,className:e(`[&>td]:border-t-0`,q,a),...u,children:/* @__PURE__ */ _(s.Cell,{id:Z(f),colSpan:r,className:`bg-card font-sans text-body`,children:i})})},r[12]=i,r[13]=a,r[14]=l,r[15]=v,r[16]=u,r[17]=f,r[18]=x):x=r[18];let S=x,C=N();if(o!=null){let e;return r[19]!==o||r[20]!==S?(e=S({numberOfColumns:o}),r[19]=o,r[20]=S,r[21]=e):e=r[21],e}let w;r[22]!==m||r[23]!==C?(w=()=>({numberOfColumns:m(),options:C}),r[22]=m,r[23]=C,r[24]=w):w=r[24];let T;return r[25]!==S||r[26]!==f.table.store||r[27]!==w?(T=/* @__PURE__ */ _(y,{source:f.table.store,selector:w,children:S}),r[25]=S,r[26]=f.table.store,r[27]=w,r[28]=T):T=r[28],T}const ge={Root:ne,ActionCell:ce,ActionHeader:le,Cell:s.Cell,Body:U,EmptyRow:se,Head:W,Header:H,HeaderSortButton:re,Row:ae,ExpandHeader:fe,ControlCell:de,RowExpandButton:he,ExpandedRow:Q};function $(e){let t=c(10),n,r,i;if(t[0]===e?(n=t[1],r=t[2],i=t[3]):({direction:n,mode:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i),n===`unsorted`||!r||!n){let e;return t[4]===i?e=t[5]:(e=/* @__PURE__ */ _(`svg`,{"aria-hidden":!0,...i}),t[4]=i,t[5]=e),e}let o;return t[6]!==n||t[7]!==r||t[8]!==i?(o=/* @__PURE__ */ _(a,{mode:r,direction:n,...i}),t[6]=n,t[7]=r,t[8]=i,t[9]=o):o=t[9],o}function _e(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(A(typeof n==`string`?n:`unsorted`,t)){case`unsorted`:e.clearSorting();return;case`asc`:e.toggleSorting(!1);return;case`desc`:e.toggleSorting(!0);return;default:return}}export{ge as DataTable,Z as expandedRowId};
|
|
1
|
+
import{t as e}from"./cx-CK7o_rVv.js";import{t}from"./data-slot-EM6s2WEU.js";import{t as n}from"./button-b2HKEIE2.js";import{t as r}from"./button-Bkl_QYpp.js";import{t as i}from"./use-prefers-reduced-motion-DimzRx-M.js";import{t as a}from"./icons-CDLz5lpI.js";import{n as o}from"./sandboxed-on-click-C7pPu-2M.js";import{t as s}from"./table-DBbKqOVq.js";import{c}from"react/compiler-runtime";import{Fragment as l,createContext as u,useContext as d,useEffect as f,useRef as p,useState as m}from"react";import h from"tiny-invariant";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import{Subscribe as y,callMemoOrStaticFn as b,flexRender as x}from"@tanstack/react-table";import{MinusIcon as S}from"@phosphor-icons/react/Minus";import{PlusIcon as C}from"@phosphor-icons/react/Plus";import{column_getIsSorted as w,row_getIsExpanded as T,row_getVisibleCells as E,table_getVisibleLeafColumns as D}from"@tanstack/react-table/static-functions";export*from"@tanstack/react-table";const O=[`unsorted`,`asc`,`desc`],k=[`unsorted`,`desc`,`asc`];function A(e,t){return j(t===`alphanumeric`?O:k,e)??`unsorted`}function j(e,t,n){if(e.length===0)return n;let r=e.findIndex(e=>e===t);if(r===-1)return n;let i=(r+1)%e.length;return e.at(i)??n}function M(e){if(typeof e==`object`&&e&&`width`in e)return e.width===`fit`?`fit`:void 0}const N=u(null);function P(){return d(N)?.table.options}function F(){let e=d(N);return h(e,`useDataTableContext should only be used within a DataTable child component`),e}const I=u(null),L=/* @__PURE__ */ new Set;function R(e){return[...e.querySelectorAll(`:scope > tr`)]}function ee(e){let[,t=`0px`]=getComputedStyle(e).translate.split(` `);return e.offsetTop+(Number.parseFloat(t)||0)}function te(e,t,n){let r=/* @__PURE__ */ new Map,i=0,a=0;for(let o of R(e)){o.hasAttribute(`data-closing`)?a+=o.offsetHeight:(i+=a,a=0);let e=-i,s=t.get(o),c=s==null||Math.abs(s-o.offsetTop-e)<.5?e:s-o.offsetTop;r.set(o,o.offsetTop+e);let l=n.get(o);if(c!==e||(l?.to??0)!==e){if(n.delete(o),c!==e||e!==0){let t=o.animate([{translate:`0 ${c}px`},{translate:`0 ${e}px`}],{duration:c===e?0:200,easing:`cubic-bezier(0.23, 1, 0.32, 1)`,fill:e===0?`none`:`forwards`});n.set(o,{animation:t,to:e})}l?.animation.cancel()}}return r}function ne(){let e=c(14),[t,n]=m(L),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=/* @__PURE__ */ new Map,e[0]=r):r=e[0];let a=p(r),o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=/* @__PURE__ */ new Map,e[1]=o):o=e[1];let s=p(o),l;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=/* @__PURE__ */ new WeakMap,e[2]=l):l=e[2];let u=p(l),d,h;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{let e=a.current,t=s.current;return()=>{for(let{timer:t}of e.values())clearTimeout(t);for(let{observer:e}of t.values())e.disconnect()}},h=[],e[3]=d,e[4]=h):(d=e[3],h=e[4]),f(d,h);let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=e=>{n(t=>{if(!t.has(e))return t;let n=new Set(t);return n.delete(e),n})},e[5]=g):g=e[5];let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{let t=s.current.get(e);if(t!=null&&t.before==null){for(let t of a.current.values())if(t.body===e)return;t.observer.disconnect(),s.current.delete(e)}},e[6]=v):v=e[6];let y=v,b;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=(e,t)=>{let n=s.current.get(e),r=t.filter(t=>t.type===`childList`?t.target===e:t.target.parentNode===e);if(n==null||r.length===0)return;let i=n.awaiting==null?null:a.current.get(n.awaiting);for(let e of r){let{target:t}=e;i!=null&&e.type===`attributes`&&t instanceof Element&&t.hasAttribute(`data-closing`)&&i.rows.add(t)}i!=null&&i.rows.size>0&&(n.awaiting=null);for(let[t,n]of a.current)n.body===e&&n.rows.size>0&&![...n.rows].some(ie)&&(clearTimeout(n.timer),a.current.delete(t),_(t));let o=n.before??n.rest;n.before=null,n.rest=te(e,o,u.current),y(e)},e[7]=b):b=e[7];let x=b,S;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=e=>{let t=s.current.get(e);if(t==null){let n=new MutationObserver(t=>x(e,t));n.observe(e,{attributeFilter:[`data-closing`],childList:!0,subtree:!0}),t={observer:n,before:null,rest:/* @__PURE__ */ new Map,awaiting:null},s.current.set(e,t)}if(t.before==null){let n=new Map(R(e).map(re));t.before=n;let r=t;requestAnimationFrame(()=>{r.before===n&&(r.before=null,y(e))})}return t},e[8]=S):S=e[8];let C=S,w;e[9]===Symbol.for(`react.memo_cache_sentinel`)?(w=(e,t)=>{e!=null&&!i()&&C(e),t()},e[9]=w):w=e[9];let T=w,E;e[10]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{let t=a.current.get(e);t!=null&&(clearTimeout(t.timer),a.current.delete(e),C(t.body)),_(e)},e[10]=E):E=e[10];let D=E,O;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(O=(e,t,r)=>{t==null||i()?r():(D(e),C(t).awaiting=e,a.current.set(e,{body:t,rows:/* @__PURE__ */ new Set,timer:setTimeout(()=>{a.current.delete(e),C(t),_(e),r()},200)}),n(t=>new Set(t).add(e)))},e[11]=O):O=e[11];let k=O,A;return e[12]===t?A=e[13]:(A={closingRowIds:t,startExpand:T,startCollapse:k,cancelCollapse:D},e[12]=t,e[13]=A),A}function re(e){return[e,ee(e)]}function ie(e){return e.isConnected}function ae(e){let n=c(21),r,i,a,o;n[0]===e?(r=n[1],i=n[2],a=n[3],o=n[4]):({"data-slot":i,children:r,table:o,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a,n[4]=o);let l;n[5]===o?l=n[6]:(l={table:o},n[5]=o,n[6]=l);let u=l,d=ne(),f;n[7]===i?f=n[8]:(f=t(i,`data-table`),n[7]=i,n[8]=f);let p;n[9]===r?p=n[10]:(p=/* @__PURE__ */ _(s.Element,{children:r}),n[9]=r,n[10]=p);let m;n[11]!==a||n[12]!==f||n[13]!==p?(m=/* @__PURE__ */ _(s.Root,{"data-slot":f,...a,children:p}),n[11]=a,n[12]=f,n[13]=p,n[14]=m):m=n[14];let h;n[15]!==d||n[16]!==m?(h=/* @__PURE__ */ _(I.Provider,{value:d,children:m}),n[15]=d,n[16]=m,n[17]=h):h=n[17];let g;return n[18]!==u||n[19]!==h?(g=/* @__PURE__ */ _(N.Provider,{value:u,children:h}),n[18]=u,n[19]=h,n[20]=g):g=n[20],g}function oe(r){let i=c(33),a,o,s,l,u,d,f,p,m,h,g,v;i[0]===r?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],d=i[6],f=i[7],p=i[8],m=i[9],h=i[10],g=i[11],v=i[12]):({"data-slot":l,appearance:m,children:a,className:o,column:s,disableSorting:h,iconPlacement:g,intent:v,sortingMode:p,sortIcon:d,onClick:u,...f}=r,i[0]=r,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=d,i[7]=f,i[8]=p,i[9]=m,i[10]=h,i[11]=g,i[12]=v);let b=m===void 0?`ghost`:m,x=h!==void 0&&h,S=g===void 0?`end`:g,C=v===void 0?`neutral`:v,w;i[13]!==b||i[14]!==a||i[15]!==o||i[16]!==s||i[17]!==l||i[18]!==x||i[19]!==S||i[20]!==C||i[21]!==u||i[22]!==d||i[23]!==f||i[24]!==p?(w=()=>{let r=s.getIsSorted(),i=!x&&s.getCanSort(),c=i&&typeof r==`string`?r:`unsorted`;if(!i)return/* @__PURE__ */ _(`span`,{"data-slot":t(l,`data-table-header-sort-button`),"data-sort-direction":`unsorted`,className:e(`flex w-full items-center justify-start`,b===`ghost`&&C===`neutral`&&`text-muted`,o),...f,children:a});let m=d?.(c)??/* @__PURE__ */ _(ye,{mode:p,direction:c});return/* @__PURE__ */ _(n,{appearance:b,"data-slot":t(l,`data-table-header-sort-button`),className:e(`flex justify-start w-full h-full rounded-none not-disabled:active:scale-none`,b===`ghost`&&C===`neutral`&&`text-muted`,o),"data-sort-direction":c,"data-table-header-action":!0,icon:m,iconPlacement:S,onClick:e=>{u?.(e),!e.defaultPrevented&&p!==void 0&&be(s,p)},intent:C,type:`button`,...f,children:a})},i[13]=b,i[14]=a,i[15]=o,i[16]=s,i[17]=l,i[18]=x,i[19]=S,i[20]=C,i[21]=u,i[22]=d,i[23]=f,i[24]=p,i[25]=w):w=i[25];let T=w,E=P(),D;i[26]!==s||i[27]!==E?(D=()=>({sorted:s.getIsSorted(),options:E}),i[26]=s,i[27]=E,i[28]=D):D=i[28];let O;return i[29]!==s.table.store||i[30]!==T||i[31]!==D?(O=/* @__PURE__ */ _(y,{source:s.table.store,selector:D,children:T}),i[29]=s.table.store,i[30]=T,i[31]=D,i[32]=O):O=i[32],O}const z=`w-px whitespace-nowrap`;function B(e){if(e==null)return;let t=b(e,`getIsSorted`,w);if(t===`asc`)return`ascending`;if(t===`desc`)return`descending`}function V(n){let r=c(21),i,a,o,l,u;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5]):({"data-slot":l,children:i,className:a,column:o,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u);let d;r[6]!==i||r[7]!==a||r[8]!==o||r[9]!==l||r[10]!==u?(d=()=>{let n=M(o?.columnDef.meta);return/* @__PURE__ */ _(s.Header,{"aria-sort":B(o),"data-column-width":n,"data-slot":t(l,`data-table-header`),className:e(`has-data-table-header-action:px-0`,n===`fit`&&z,a),...u,children:i})},r[6]=i,r[7]=a,r[8]=o,r[9]=l,r[10]=u,r[11]=d):d=r[11];let f=d,p=P();if(o==null){let e;return r[12]===f?e=r[13]:(e=f(),r[12]=f,r[13]=e),e}let m;r[14]!==o||r[15]!==p?(m=()=>({ariaSort:B(o),options:p}),r[14]=o,r[15]=p,r[16]=m):m=r[16];let h;return r[17]!==o.table.store||r[18]!==f||r[19]!==m?(h=/* @__PURE__ */ _(y,{source:o.table.store,selector:m,children:f}),r[17]=o.table.store,r[18]=f,r[19]=m,r[20]=h):h=r[20],h}function H(n){let r=c(17),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,className:i,column:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u=a?.columnDef.meta,d;r[5]===u?d=r[6]:(d=M(u),r[5]=u,r[6]=d);let f=d,p;r[7]===o?p=r[8]:(p=t(o,`data-table-cell`),r[7]=o,r[8]=p);let m=f===`fit`&&z,h;r[9]!==i||r[10]!==m?(h=e(m,i),r[9]=i,r[10]=m,r[11]=h):h=r[11];let g;return r[12]!==l||r[13]!==p||r[14]!==h||r[15]!==f?(g=/* @__PURE__ */ _(s.Cell,{"data-column-width":f,"data-slot":p,className:h,...l}),r[12]=l,r[13]=p,r[14]=h,r[15]=f,r[16]=g):g=r[16],g}const U=e=>{let n=c(8),r,i;n[0]===e?(r=n[1],i=n[2]):({"data-slot":r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let a;n[3]===r?a=n[4]:(a=t(r,`data-table-body`),n[3]=r,n[4]=a);let o;return n[5]!==i||n[6]!==a?(o=/* @__PURE__ */ _(s.Body,{"data-slot":a,...i}),n[5]=i,n[6]=a,n[7]=o):o=n[7],o};function W(e){let n=c(11),r,i;n[0]===e?(r=n[1],i=n[2]):({"data-slot":r,...i}=e,n[0]=e,n[1]=r,n[2]=i);let{table:a}=F(),o;n[3]===r?o=n[4]:(o=t(r,`data-table-head`),n[3]=r,n[4]=o);let l;n[5]===a?l=n[6]:(l=a.getHeaderGroups().map(G),n[5]=a,n[6]=l);let u;return n[7]!==i||n[8]!==o||n[9]!==l?(u=/* @__PURE__ */ _(s.Head,{"data-slot":o,...i,children:l}),n[7]=i,n[8]=o,n[9]=l,n[10]=u):u=n[10],u}function G(e){return/* @__PURE__ */ _(s.Row,{children:e.headers.map(K)},e.id)}function K(e){return/* @__PURE__ */ _(l,{children:e.isPlaceholder?/* @__PURE__ */ _(s.Header,{}):x(e.column.columnDef.header,e.getContext())},e.id)}const q=e(`starting:-translate-y-1 starting:opacity-0`,`motion-safe:transition-[opacity,translate] motion-safe:duration-200 motion-safe:ease-out-strong`,`data-closing:pointer-events-none data-closing:opacity-0 motion-safe:data-closing:duration-150`);function J(e,t){return t.size===0||e.depth===0?!1:e.getParentRows().some(e=>t.has(e.id))}const Y=u(!1);function se(e){if(e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return!1;let t=e.currentTarget.ownerDocument.getSelection();return t==null||t.isCollapsed?!0:!e.currentTarget.contains(t.anchorNode)}function ce(n){let r=c(21),i,a,o,l,u,f;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":a,className:i,onClick:o,renderExpanded:u,row:f,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p=d(I)?.closingRowIds??L,m;r[7]!==i||r[8]!==p||r[9]!==a||r[10]!==o||r[11]!==l||r[12]!==u||r[13]!==f?(m=()=>{let n=J(f,p),r=b(f,`getIsExpanded`,T),c=b(f,`getVisibleCells`,E),d=/* @__PURE__ */ _(s.Row,{"data-slot":t(a,`data-table-row`),"data-expanded":r||void 0,"data-closing":n||void 0,inert:n||void 0,"data-clickable":o==null?void 0:``,className:e(f.depth>0&&q,o!=null&&`cursor-pointer`,i),onClick:o&&(e=>{se(e)&&o(e)}),...l,children:/* @__PURE__ */ _(Y.Provider,{value:u!=null,children:c.map(le)})});return u==null?d:/* @__PURE__ */ v(g,{children:[d,r&&/* @__PURE__ */ _($,{row:f,children:u(f)})]})},r[7]=i,r[8]=p,r[9]=a,r[10]=o,r[11]=l,r[12]=u,r[13]=f,r[14]=m):m=r[14];let h=m,x=P(),S;r[15]===x?S=r[16]:(S=e=>({state:e,options:x}),r[15]=x,r[16]=S);let C;return r[17]!==h||r[18]!==f.table.store||r[19]!==S?(C=/* @__PURE__ */ _(y,{source:f.table.store,selector:S,children:h}),r[17]=h,r[18]=f.table.store,r[19]=S,r[20]=C):C=r[20],C}function le(e){return/* @__PURE__ */ _(l,{children:x(e.column.columnDef.cell,e.getContext())},e.id)}function ue(e){let n=c(15),r,i,a;n[0]===e?(r=n[1],i=n[2],a=n[3]):({"data-slot":i,children:r,...a}=e,n[0]=e,n[1]=r,n[2]=i,n[3]=a);let{table:o}=F(),l;n[4]===o?l=n[5]:(l=b(o,`getVisibleLeafColumns`,D),n[4]=o,n[5]=l);let u=l.length,d;n[6]===i?d=n[7]:(d=t(i,`data-table-empty-row`),n[6]=i,n[7]=d);let f;n[8]!==r||n[9]!==u?(f=/* @__PURE__ */ _(s.Cell,{colSpan:u,children:r}),n[8]=r,n[9]=u,n[10]=f):f=n[10];let p;return n[11]!==a||n[12]!==d||n[13]!==f?(p=/* @__PURE__ */ _(s.Row,{"data-slot":d,...a,children:f}),n[11]=a,n[12]=d,n[13]=f,n[14]=p):p=n[14],p}function X(){let t=c(1),n;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=/* @__PURE__ */ _(`span`,{"aria-hidden":!0,className:e(`pointer-events-none absolute -inset-y-px -left-1.5 w-1.5`,`opacity-0 transition-opacity group-data-sticky-active/table:opacity-100`,`shadow-[1px_0_0_0_var(--border-color-card-muted)]`,`bg-linear-to-l to-transparent`,`from-[color-mix(in_oklab,var(--shadow-color)_var(--shadow-second-opacity),transparent)]`)}),t[0]=n):n=t[0],n}function de(n){let r=c(21),i,a,l,u,d;r[0]===n?(i=r[1],a=r[2],l=r[3],u=r[4],d=r[5]):({"data-slot":l,children:i,className:a,onClick:u,...d}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=l,r[4]=u,r[5]=d);let f;r[6]===u?f=r[7]:(f=o({allowClickEventDefault:!0,onClick:u}),r[6]=u,r[7]=f);let{onClick:p}=f,m;r[8]===l?m=r[9]:(m=t(l,`data-table-action-cell`),r[8]=l,r[9]=m);let h;r[10]===a?h=r[11]:(h=e(`sticky z-10 right-0 text-end align-middle bg-inherit p-2`,a),r[10]=a,r[11]=h);let g;r[12]===Symbol.for(`react.memo_cache_sentinel`)?(g=/* @__PURE__ */ _(X,{}),r[12]=g):g=r[12];let y;r[13]===i?y=r[14]:(y=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-cell-label`,className:`contents`,children:i}),r[13]=i,r[14]=y);let b;return r[15]!==d||r[16]!==p||r[17]!==m||r[18]!==h||r[19]!==y?(b=/* @__PURE__ */ v(s.Cell,{"data-mantle-table-sticky-right":!0,"data-slot":m,className:h,onClick:p,...d,children:[g,y]}),r[15]=d,r[16]=p,r[17]=m,r[18]=h,r[19]=y,r[20]=b):b=r[20],b}function fe(n){let r=c(27),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let{table:u}=F(),d;r[5]===u?d=r[6]:(d=u.getRowModel(),r[5]=u,r[6]=d);let f=d.rows.length>0,p;r[7]===f?p=r[8]:(p=f?{"data-mantle-table-sticky-right":!0}:{},r[7]=f,r[8]=p);let m;r[9]===o?m=r[10]:(m=t(o,`data-table-action-header`),r[9]=o,r[10]=m);let h=f&&`sticky z-10 right-0 bg-inherit`,g;r[11]!==a||r[12]!==h?(g=e(h,a),r[11]=a,r[12]=h,r[13]=g):g=r[13];let y;r[14]===i?y=r[15]:(y=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Actions`}),r[14]=i,r[15]=y);let b;r[16]===y?b=r[17]:(b=/* @__PURE__ */ _(`span`,{"data-slot":`data-table-action-header-label`,className:`contents`,children:y}),r[16]=y,r[17]=b);let x;r[18]===f?x=r[19]:(x=f&&/* @__PURE__ */ _(X,{}),r[18]=f,r[19]=x);let S;return r[20]!==l||r[21]!==p||r[22]!==m||r[23]!==g||r[24]!==b||r[25]!==x?(S=/* @__PURE__ */ v(s.Header,{...p,"data-slot":m,className:g,...l,children:[b,x]}),r[20]=l,r[21]=p,r[22]=m,r[23]=g,r[24]=b,r[25]=x,r[26]=S):S=r[26],S}function pe(e){return e!=null&&`nodeType`in e}function me({"data-slot":n,children:r,className:i,onClick:a,...o}){let c=p(!1);return/* @__PURE__ */ _(s.Cell,{"data-slot":t(n,`data-table-control-cell`),className:e(`w-9 px-0 align-top has-[button:enabled,input:enabled]:cursor-pointer`,i),onClick:e=>{if(c.current){e.stopPropagation();return}a?.(e);let t=e.currentTarget.querySelector(`button:not(:disabled), input:not(:disabled)`);if(t!=null&&(e.stopPropagation(),!e.defaultPrevented&&pe(e.target)&&!t.contains(e.target))){t.focus({preventScroll:!0}),c.current=!0;try{t.click()}finally{c.current=!1}}},...o,children:/* @__PURE__ */ _(`span`,{"data-slot":`data-table-control-cell-label`,className:`flex h-lh items-center justify-center`,children:r})})}function Z(e){return`data-table-expanded-row-${encodeURIComponent(e.id)}`}function Q(n){let r=c(16),i,a,o,l;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4]):({"data-slot":o,children:i,className:a,...l}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l);let u;r[5]===o?u=r[6]:(u=t(o,`data-table-expand-header`),r[5]=o,r[6]=u);let d;r[7]===a?d=r[8]:(d=e(`w-9 px-0 text-center`,a),r[7]=a,r[8]=d);let f;r[9]===i?f=r[10]:(f=i??/* @__PURE__ */ _(`span`,{className:`sr-only`,children:`Row details`}),r[9]=i,r[10]=f);let p;return r[11]!==l||r[12]!==u||r[13]!==d||r[14]!==f?(p=/* @__PURE__ */ _(s.Header,{"data-slot":u,className:d,...l,children:f}),r[11]=l,r[12]=u,r[13]=d,r[14]=f,r[15]=p):p=r[15],p}const he=/* @__PURE__ */ _(C,{weight:`bold`,className:`size-3.5`}),ge=/* @__PURE__ */ _(S,{weight:`bold`,className:`size-3.5`});function _e(n){let i=c(21),a,o,s,l,u,f,p,m,h,g,v;i[0]===n?(a=i[1],o=i[2],s=i[3],l=i[4],u=i[5],f=i[6],p=i[7],m=i[8],h=i[9],g=i[10],v=i[11]):({"data-slot":o,appearance:p,className:a,collapseIcon:m,expandIcon:h,intent:g,label:s,onClick:l,row:f,size:v,...u}=n,i[0]=n,i[1]=a,i[2]=o,i[3]=s,i[4]=l,i[5]=u,i[6]=f,i[7]=p,i[8]=m,i[9]=h,i[10]=g,i[11]=v);let b=p===void 0?`ghost`:p,x=m===void 0?ge:m,S=h===void 0?he:h,C=g===void 0?`neutral`:g,w=v===void 0?`sm`:v,T=()=>{if(!f.getCanExpand())return null;let n=f.getIsExpanded()&&!k,i=f.getToggleExpandedHandler(),c=f.subRows.length>0,d=D||!c;return/* @__PURE__ */ _(r,{type:`button`,"data-slot":t(o,`data-table-row-expand-button`),appearance:b,intent:C,size:w,className:e(`rounded`,a),"aria-expanded":n,"aria-controls":n&&d?Z(f):void 0,icon:n?x:S,label:c?`${n?`Collapse`:`Expand`} ${s}`:`${n?`Hide`:`Show`} details for ${s}`,onClick:e=>{if(e.stopPropagation(),l?.(e),e.defaultPrevented)return;let t=e.currentTarget.closest(`tbody`);O==null?i():k?O.cancelCollapse(f.id):n?O.startCollapse(f.id,t,()=>f.toggleExpanded(!1)):O.startExpand(t,i)},...u})},E=P(),D=d(Y),O=d(I),k=O?.closingRowIds.has(f.id)??!1,A;i[12]!==D||i[13]!==k||i[14]!==E||i[15]!==f?(A=()=>({isExpanded:f.getIsExpanded(),hasDetailPanel:D,isClosing:k,options:E}),i[12]=D,i[13]=k,i[14]=E,i[15]=f,i[16]=A):A=i[16];let j;return i[17]!==T||i[18]!==f.table.store||i[19]!==A?(j=/* @__PURE__ */ _(y,{source:f.table.store,selector:A,children:T}),i[17]=T,i[18]=f.table.store,i[19]=A,i[20]=j):j=i[20],j}function $(n){let r=c(29),i,a,o,l,u,f;r[0]===n?(i=r[1],a=r[2],o=r[3],l=r[4],u=r[5],f=r[6]):({"data-slot":l,children:i,className:a,colSpan:o,row:f,...u}=n,r[0]=n,r[1]=i,r[2]=a,r[3]=o,r[4]=l,r[5]=u,r[6]=f);let p;r[7]===f?p=r[8]:(p=()=>b(f,`getVisibleCells`,E).length,r[7]=f,r[8]=p);let m=p,h=d(I)?.closingRowIds??L,g;r[9]!==h||r[10]!==f?(g=h.has(f.id)||J(f,h),r[9]=h,r[10]=f,r[11]=g):g=r[11];let v=g,x;r[12]!==i||r[13]!==a||r[14]!==l||r[15]!==v||r[16]!==u||r[17]!==f?(x=n=>{let{numberOfColumns:r}=n;return/* @__PURE__ */ _(s.Row,{"data-slot":t(l,`data-table-expanded-row`),"data-expanded-content":!0,"data-closing":v||void 0,inert:v||void 0,className:e(`[&>td]:border-t-0`,q,a),...u,children:/* @__PURE__ */ _(s.Cell,{id:Z(f),colSpan:r,className:`bg-card font-sans text-body`,children:i})})},r[12]=i,r[13]=a,r[14]=l,r[15]=v,r[16]=u,r[17]=f,r[18]=x):x=r[18];let S=x,C=P();if(o!=null){let e;return r[19]!==o||r[20]!==S?(e=S({numberOfColumns:o}),r[19]=o,r[20]=S,r[21]=e):e=r[21],e}let w;r[22]!==m||r[23]!==C?(w=()=>({numberOfColumns:m(),options:C}),r[22]=m,r[23]=C,r[24]=w):w=r[24];let T;return r[25]!==S||r[26]!==f.table.store||r[27]!==w?(T=/* @__PURE__ */ _(y,{source:f.table.store,selector:w,children:S}),r[25]=S,r[26]=f.table.store,r[27]=w,r[28]=T):T=r[28],T}const ve={Root:ae,ActionCell:de,ActionHeader:fe,Cell:H,Body:U,EmptyRow:ue,Head:W,Header:V,HeaderSortButton:oe,Row:ce,ExpandHeader:Q,ControlCell:me,RowExpandButton:_e,ExpandedRow:$};function ye(e){let t=c(10),n,r,i;if(t[0]===e?(n=t[1],r=t[2],i=t[3]):({direction:n,mode:r,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i),n===`unsorted`||!r||!n){let e;return t[4]===i?e=t[5]:(e=/* @__PURE__ */ _(`svg`,{"aria-hidden":!0,...i}),t[4]=i,t[5]=e),e}let o;return t[6]!==n||t[7]!==r||t[8]!==i?(o=/* @__PURE__ */ _(a,{mode:r,direction:n,...i}),t[6]=n,t[7]=r,t[8]=i,t[9]=o):o=t[9],o}function be(e,t){if(!e.getCanSort())return;let n=e.getIsSorted();switch(A(typeof n==`string`?n:`unsorted`,t)){case`unsorted`:e.clearSorting();return;case`asc`:e.toggleSorting(!1);return;case`desc`:e.toggleSorting(!0);return;default:return}}export{ve as DataTable,Z as expandedRowId};
|
package/dist/llms.txt
CHANGED