@box-kite/react 2.2.4 → 2.2.6
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/.claude/rules/box-kite-rules.md +11 -1
- package/.claude/skills/box-kite/SKILL.md +11 -1
- package/.claude/skills/box-kite/references/components.md +83 -3
- package/.cursor/rules/box-kite.mdc +11 -1
- package/AGENTS.md +11 -1
- package/BOX_AI_CONTEXT.md +371 -25
- package/BOX_KITE_AI_CONTEXT.md +371 -25
- package/behavior.cjs +1 -1
- package/behavior.mjs +57 -57
- package/box.cjs +1 -1
- package/box.d.ts +5 -0
- package/box.mjs +15 -15
- package/catalog.cjs +1 -1
- package/catalog.mjs +906 -0
- package/client.cjs +1 -1
- package/client.mjs +94 -80
- package/components/calendar.cjs +1 -0
- package/components/calendar.d.ts +77 -0
- package/components/calendar.mjs +483 -0
- package/components/dashboard.cjs +1 -1
- package/components/dashboard.mjs +1 -1
- package/components/dataGrid/components/dataGridBooleanValue.d.ts +11 -0
- package/components/dataGrid/components/dataGridDateParts.d.ts +40 -0
- package/components/dataGrid/components/dataGridDateValue.d.ts +14 -0
- package/components/dataGrid/components/dataGridList.d.ts +12 -0
- package/components/dataGrid/components/dataGridListAggregate.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilter.d.ts +7 -0
- package/components/dataGrid/components/dataGridListFilterSheet.d.ts +11 -0
- package/components/dataGrid/components/dataGridListFooter.d.ts +13 -0
- package/components/dataGrid/components/dataGridListGroup.d.ts +13 -0
- package/components/dataGrid/components/dataGridListItem.d.ts +21 -0
- package/components/dataGrid/components/dataGridListLayout.d.ts +20 -0
- package/components/dataGrid/components/dataGridListRecord.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSelectionBar.d.ts +11 -0
- package/components/dataGrid/components/dataGridListSheet.d.ts +30 -0
- package/components/dataGrid/components/dataGridListSortSheet.d.ts +10 -0
- package/components/dataGrid/components/dataGridListToolbar.d.ts +10 -0
- package/components/dataGrid/components/dataGridListValue.d.ts +12 -0
- package/components/dataGrid/contracts/dataGridContract.d.ts +70 -11
- package/components/dataGrid/models/columnModel.d.ts +3 -1
- package/components/dataGrid/models/editModel.d.ts +3 -1
- package/components/dataGrid/models/gridModel.d.ts +3 -0
- package/components/dataGrid/models/listModel.d.ts +129 -0
- package/components/dataGrid/models/localeText.d.ts +36 -0
- package/components/dataGrid/models/viewportModel.d.ts +0 -2
- package/components/dataGrid/useDateParts.d.ts +17 -0
- package/components/dataGrid/useListLayout.d.ts +13 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +1251 -854
- package/components/dateField.cjs +1 -0
- package/components/dateField.d.ts +78 -0
- package/components/dateField.mjs +313 -0
- package/components/datePicker.cjs +1 -0
- package/components/datePicker.d.ts +120 -0
- package/components/datePicker.mjs +529 -0
- package/components/dateTime.cjs +1 -0
- package/components/dateTime.d.ts +23 -0
- package/components/dateTime.mjs +34 -0
- package/components/dialog.cjs +1 -1
- package/components/dialog.mjs +29 -29
- package/components/list/listItemParts.d.ts +9 -0
- package/components/list.cjs +1 -0
- package/components/list.d.ts +118 -0
- package/components/list.mjs +391 -0
- package/components/menu.cjs +1 -1
- package/components/menu.mjs +25 -25
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +12 -12
- package/components/semantics.d.ts +29 -29
- package/components/slider.cjs +1 -1
- package/components/slider.mjs +1 -1
- package/components/sortableList.cjs +1 -0
- package/components/sortableList.d.ts +49 -0
- package/components/sortableList.mjs +384 -0
- package/components/swipeItem.cjs +1 -0
- package/components/swipeItem.d.ts +52 -0
- package/components/swipeItem.mjs +321 -0
- package/components/tabs.cjs +1 -1
- package/components/tabs.mjs +1 -1
- package/components/timeZoneSelect.cjs +1 -0
- package/components/timeZoneSelect.d.ts +52 -0
- package/components/timeZoneSelect.mjs +74 -0
- package/components/toaster.cjs +1 -1
- package/components/toaster.mjs +24 -24
- package/components/virtualList.cjs +1 -0
- package/components/virtualList.d.ts +32 -0
- package/components/virtualList.mjs +188 -0
- package/dataGridDateParts.cjs +1 -0
- package/dataGridDateParts.mjs +223 -0
- package/dataGridList.cjs +1 -0
- package/dataGridList.mjs +1314 -0
- package/dataGridListLayout.cjs +1 -0
- package/dataGridListLayout.mjs +49 -0
- package/date-environment.cjs +1 -0
- package/date-environment.mjs +29 -0
- package/date-input.cjs +1 -0
- package/date-input.mjs +346 -0
- package/date-math.cjs +1 -0
- package/date-math.mjs +317 -0
- package/date.cjs +1 -0
- package/date.d.ts +40 -0
- package/date.mjs +4 -0
- package/dates.cjs +1 -0
- package/dates.mjs +689 -0
- package/docs/components.md +10 -1
- package/icons/closeIcon.d.ts +2 -0
- package/icons/filterIcon.d.ts +2 -0
- package/layer.cjs +1 -1
- package/layer.mjs +1 -1
- package/mcp/src/data.d.ts +2 -0
- package/package.json +178 -22
- package/placement.cjs +1 -1
- package/placement.mjs +10 -10
- package/platform.cjs +1 -1
- package/platform.mjs +4 -1
- package/react/a11y/useControllableState.d.ts +2 -1
- package/react/boxComponent.d.ts +1 -1
- package/react/componentsContext.d.ts +4 -0
- package/react/componentsProvider.d.ts +10 -0
- package/react/date/dateChange.d.ts +18 -0
- package/react/date/dateEnvironment.d.ts +34 -0
- package/react/resolveStyles.d.ts +2 -1
- package/react/theme/theme.d.ts +6 -1
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +6 -6
- package/registry/blocks/dashboard-shell/dashboard-shell.d.ts +3 -1
- package/registry/designs/store/address-form.d.ts +11 -0
- package/registry/designs/store/cart-items.d.ts +10 -0
- package/registry/designs/store/cart-page.d.ts +4 -0
- package/registry/designs/store/checkout-page.d.ts +7 -0
- package/registry/designs/store/credit-card-form.d.ts +10 -0
- package/registry/designs/store/form-field.d.ts +19 -0
- package/registry/designs/store/order-summary.d.ts +18 -0
- package/registry/designs/store/product-art.d.ts +26 -0
- package/registry/designs/store/product-card.d.ts +11 -0
- package/registry/designs/store/product-gallery.d.ts +11 -0
- package/registry/designs/store/product-grid.d.ts +10 -0
- package/registry/designs/store/product-page.d.ts +5 -0
- package/registry/designs/store/quantity-stepper.d.ts +13 -0
- package/registry/designs/store/shipping-method.d.ts +14 -0
- package/registry/designs/store/store-data.d.ts +53 -0
- package/registry/designs/store/store-design.d.ts +63 -0
- package/registry/designs/store/store-shell.d.ts +12 -0
- package/registry/designs/store/storefront-page.d.ts +4 -0
- package/registry/designs/store/variant-picker.d.ts +15 -0
- package/rsc.cjs +1 -1
- package/rsc.d.ts +2 -0
- package/rsc.mjs +1 -1
- package/scrolling.cjs +1 -0
- package/scrolling.mjs +22 -0
- package/utils/date/calendar.d.ts +44 -0
- package/utils/date/calendarModel.d.ts +46 -0
- package/utils/date/dateTime.d.ts +144 -0
- package/utils/date/fieldModel.d.ts +74 -0
- package/utils/date/format.d.ts +39 -0
- package/utils/date/iso.d.ts +40 -0
- package/utils/date/locale.d.ts +17 -0
- package/utils/date/parse.d.ts +20 -0
- package/utils/date/settings.d.ts +26 -0
- package/utils/date/value.d.ts +43 -0
- package/utils/date/zoneOptions.d.ts +19 -0
- package/utils/date/zones.d.ts +32 -0
- package/utils/scroll/scrollUtils.d.ts +6 -0
- package/utils/sortable/sortableUtils.d.ts +25 -0
- package/utils/swipe/swipeUtils.d.ts +53 -0
- package/utils/virtual/measuredWindow.d.ts +28 -0
- package/utils/virtual/rowSearch.d.ts +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../react-shared.cjs"),t=require("../effects.cjs"),n=require("../behavior.cjs"),r=require("../scrolling.cjs"),i=require("./list.cjs");let a=require("react"),o=require("react/jsx-runtime");function s(e,t,n){return Math.min(Math.max(e,t),n)}var c;(function(e){let t=e.DEFAULT_OVERSCAN=4,n=e.PIN_REACH=50;function i(e){let t=Array(e.length+1);t[0]=0;for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}e.offsetsOf=i;function a(e,t){let n=0,r=0;for(let t of e)n+=t,r++;return r?n/r:t}e.typicalSize=a;function o(e){let{offsets:i,viewStart:a,viewEnd:o,overscan:c=t,pin:l=-1}=e,u=i.length-1,d=i[u]??0;if(u<=0)return{startIndex:0,endIndex:0,offsetY:0,totalHeight:0};let f=s(r.n(i,a,u)-c,0,u-1),p=s(r.n(i,o-.5,u)+1+c,f+1,u);return l>=0&&l<u&&(l<f&&f-l<=n?f=l:l>=p&&l-p<n&&(p=l+1)),{startIndex:f,endIndex:p,offsetY:i[f],totalHeight:d}}e.measuredWindow=o})(c||={});var l=c;function u(e,t){for(let n of Array.from(e.children)){let e=n.getBoundingClientRect();if(e.bottom>t)return{element:n,top:e.top}}return null}var d=150;function f(e,s){let{items:c,itemKey:f,children:p,estimateSize:m=57,overscan:h=6,initialCount:g=20,onRangeChange:_,scrollerRef:v,vars:y,css:b,props:x,...S}=e,C=(0,a.useRef)(null),[w,T]=(0,a.useState)(()=>new Map),[,E]=(0,a.useState)(0),[D,O]=(0,a.useState)({startIndex:0,endIndex:Math.min(g,c.length)}),[k,A]=(0,a.useState)(-1),j=n.a(_),M=(0,a.useCallback)(e=>{C.current=e,typeof s==`function`?s(e):s&&(s.current=e)},[s]),[N,P]=(0,a.useState)(null),F=(0,a.useMemo)(()=>c.map((e,t)=>f(e,t)),[c,f]),I=(0,a.useMemo)(()=>l.typicalSize(w.values(),m),[w,m]),L=N?.count===c.length?N:null,R=L?L.estimate:I,z=(0,a.useMemo)(()=>l.offsetsOf(F.map(e=>w.get(e)??R)),[F,w,R]),B=z[c.length],V=n.o({offsets:z,pin:k,overscan:h,count:c.length,total:B,estimate:R}),H=(0,a.useRef)(null),U=Math.min(D.startIndex,Math.max(0,c.length-1)),W=Math.min(Math.max(D.endIndex,U),c.length),G=n.a(()=>{let e=C.current,{offsets:t,pin:n,overscan:i,count:a}=V.current;if(!e||a===0)return;let o=v?.current??r.t(e),s=e.ownerDocument.defaultView,c=o?o.getBoundingClientRect().top+o.clientTop:0,u=o?o.clientHeight:s?.innerHeight??0,d=e.getBoundingClientRect().top+e.clientTop,f=l.measuredWindow({offsets:t,viewStart:c-d,viewEnd:c-d+u,overscan:i,pin:n});O(e=>e.startIndex===f.startIndex&&e.endIndex===f.endIndex?e:{startIndex:f.startIndex,endIndex:f.endIndex})});t.n(()=>{let e=C.current;if(!e)return;let t=null,n=0,i=v?.current??r.t(e),a=i?i.getBoundingClientRect().top:0,o=parseFloat(getComputedStyle(e).rowGap)||0,s=H.current;if(H.current=null,s?.element.isConnected&&(n+=s.element.getBoundingClientRect().top-s.top),Array.from(e.children).forEach((e,r)=>{let i=U+r,s=F[i];if(s===void 0)return;e.setAttribute(`aria-setsize`,String(c.length)),e.setAttribute(`aria-posinset`,String(i+1));let l=e.getBoundingClientRect(),u=l.height+o,d=w.get(s)??R;l.height>0&&w.get(s)!==u&&(t??=new Map(w),t.set(s,u),l.bottom<=a&&(n+=u-d))}),n!==0){let t=i??e.ownerDocument.defaultView,r=i?i.scrollTop:t?.scrollY??0;t?.scrollTo({top:r+n,behavior:`instant`})}t?(H.current=u(e,a),T(t)):G()}),(0,a.useEffect)(()=>{let e=C.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(()=>E(e=>e+1));return Array.from(e.children).forEach(e=>t.observe(e)),()=>t.disconnect()},[D,F]),(0,a.useEffect)(()=>{let e=C.current,t=e?.ownerDocument.defaultView;if(!e||!t)return;let n=v?.current??r.t(e),i=n??t,a=0,o=!1,s=0,c=()=>{a||=requestAnimationFrame(()=>(a=0,G()))},l=()=>{let{count:r,total:i,estimate:a}=V.current;P(e=>e??{count:r,total:i,estimate:a}),clearTimeout(s),s=t.setTimeout(()=>{o||(H.current=u(e,n?n.getBoundingClientRect().top:0),P(null))},d)},f=()=>{l(),c()},p=()=>{o=!0,l()},m=()=>{o&&(o=!1,l())};i.addEventListener(`scroll`,f,{passive:!0}),i.addEventListener(`pointerdown`,p,{capture:!0,passive:!0}),t.addEventListener(`pointerup`,m,!0),t.addEventListener(`pointercancel`,m,!0),t.addEventListener(`resize`,c);let h=typeof ResizeObserver>`u`?null:new ResizeObserver(c);return n&&h?.observe(n),()=>{cancelAnimationFrame(a),clearTimeout(s),i.removeEventListener(`scroll`,f),i.removeEventListener(`pointerdown`,p,!0),t.removeEventListener(`pointerup`,m,!0),t.removeEventListener(`pointercancel`,m,!0),t.removeEventListener(`resize`,c),h?.disconnect()}},[v,G,V]),(0,a.useEffect)(()=>{j({startIndex:D.startIndex,endIndex:D.endIndex})},[D,j]);let K=e=>{let t=C.current,n=Array.from(t?.children??[]).findIndex(t=>t.contains(e.target));n>=0&&A(U+n)},q=e=>{C.current?.contains(e.relatedTarget)||A(-1)},J=[];for(let e=U;e<W;e++)J.push((0,o.jsx)(a.Fragment,{children:p(c[e],e)},F[e]));return(0,o.jsx)(i.default,{ref:M,...S,vars:U>0?{...y,"list-first-divider":`block`}:y,css:{...b,overflowAnchor:`none`},transition:`none`,style:{paddingBlockStart:`${z[U]}px`,paddingBlockEnd:`${Math.max(0,(L&&W<c.length?L.total:B)-z[W])}px`},props:{...x,onFocus:K,onBlur:q},children:J})}var p=e.f(f,`VirtualList`);exports.default=p;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Key, RefAttributes } from 'react';
|
|
2
|
+
import { ComponentsAndVariants } from '@box-kite/core/types';
|
|
3
|
+
import { ListProps } from './list';
|
|
4
|
+
export interface VirtualListRange {
|
|
5
|
+
/** The first item rendered. */
|
|
6
|
+
startIndex: number;
|
|
7
|
+
/** One past the last item rendered. */
|
|
8
|
+
endIndex: number;
|
|
9
|
+
}
|
|
10
|
+
export interface VirtualListProps<TItem, TKey extends keyof ComponentsAndVariants = 'list'> extends Omit<ListProps<TKey>, 'children'> {
|
|
11
|
+
/** Every item, however many — only the ones near the screen are rendered. */
|
|
12
|
+
items: readonly TItem[];
|
|
13
|
+
/** Who an item is: stable across renders, since an item's measured height is kept under it. */
|
|
14
|
+
itemKey: (item: TItem, index: number) => Key;
|
|
15
|
+
/** Draws one item: a `List.Item`, a `SwipeItem` — one `<li>` per item, and nothing around it. */
|
|
16
|
+
children: (item: TItem, index: number) => React.ReactNode;
|
|
17
|
+
/** What an item counts as until one has been drawn, in px — then the mean of those drawn. Default 57, a `md` item. */
|
|
18
|
+
estimateSize?: number;
|
|
19
|
+
/** Items kept either side of what is on screen, so a fast scroll has something to show. Default 6. */
|
|
20
|
+
overscan?: number;
|
|
21
|
+
/** How many items render before anything is measured — on a server, and in the first frame. Default 20. */
|
|
22
|
+
initialCount?: number;
|
|
23
|
+
/** Fires when the rendered range moves. The way to fetch more: load the next page when `endIndex` nears the end. */
|
|
24
|
+
onRangeChange?: (range: VirtualListRange) => void;
|
|
25
|
+
/** What scrolls the list, when it is not the nearest scrolling ancestor — or, with none, the page. */
|
|
26
|
+
scrollerRef?: React.RefObject<HTMLElement | null>;
|
|
27
|
+
}
|
|
28
|
+
type VirtualListType = (<TItem, TKey extends keyof ComponentsAndVariants = 'list'>(props: VirtualListProps<TItem, TKey> & RefAttributes<HTMLUListElement>) => React.ReactNode) & {
|
|
29
|
+
displayName?: string;
|
|
30
|
+
};
|
|
31
|
+
declare const VirtualList: VirtualListType;
|
|
32
|
+
export default VirtualList;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { f as e } from "../react-shared.mjs";
|
|
3
|
+
import { n as t } from "../effects.mjs";
|
|
4
|
+
import { a as n, o as r } from "../behavior.mjs";
|
|
5
|
+
import { n as i, t as a } from "../scrolling.mjs";
|
|
6
|
+
import o from "./list.mjs";
|
|
7
|
+
import { Fragment as s, useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
8
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
9
|
+
//#region src/utils/virtual/measuredWindow.ts
|
|
10
|
+
function m(e, t, n) {
|
|
11
|
+
return Math.min(Math.max(e, t), n);
|
|
12
|
+
}
|
|
13
|
+
var h;
|
|
14
|
+
(function(e) {
|
|
15
|
+
let t = e.DEFAULT_OVERSCAN = 4, n = e.PIN_REACH = 50;
|
|
16
|
+
function r(e) {
|
|
17
|
+
let t = Array(e.length + 1);
|
|
18
|
+
t[0] = 0;
|
|
19
|
+
for (let n = 0; n < e.length; n++) t[n + 1] = t[n] + e[n];
|
|
20
|
+
return t;
|
|
21
|
+
}
|
|
22
|
+
e.offsetsOf = r;
|
|
23
|
+
function a(e, t) {
|
|
24
|
+
let n = 0, r = 0;
|
|
25
|
+
for (let t of e) n += t, r++;
|
|
26
|
+
return r ? n / r : t;
|
|
27
|
+
}
|
|
28
|
+
e.typicalSize = a;
|
|
29
|
+
function o(e) {
|
|
30
|
+
let { offsets: r, viewStart: a, viewEnd: o, overscan: s = t, pin: c = -1 } = e, l = r.length - 1, u = r[l] ?? 0;
|
|
31
|
+
if (l <= 0) return {
|
|
32
|
+
startIndex: 0,
|
|
33
|
+
endIndex: 0,
|
|
34
|
+
offsetY: 0,
|
|
35
|
+
totalHeight: 0
|
|
36
|
+
};
|
|
37
|
+
let d = m(i(r, a, l) - s, 0, l - 1), f = m(i(r, o - .5, l) + 1 + s, d + 1, l);
|
|
38
|
+
return c >= 0 && c < l && (c < d && d - c <= n ? d = c : c >= f && c - f < n && (f = c + 1)), {
|
|
39
|
+
startIndex: d,
|
|
40
|
+
endIndex: f,
|
|
41
|
+
offsetY: r[d],
|
|
42
|
+
totalHeight: u
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
e.measuredWindow = o;
|
|
46
|
+
})(h ||= {});
|
|
47
|
+
var g = h;
|
|
48
|
+
//#endregion
|
|
49
|
+
//#region src/components/virtualList.tsx
|
|
50
|
+
function _(e, t) {
|
|
51
|
+
for (let n of Array.from(e.children)) {
|
|
52
|
+
let e = n.getBoundingClientRect();
|
|
53
|
+
if (e.bottom > t) return {
|
|
54
|
+
element: n,
|
|
55
|
+
top: e.top
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
var v = 150;
|
|
61
|
+
function y(e, i) {
|
|
62
|
+
let { items: m, itemKey: h, children: y, estimateSize: b = 57, overscan: x = 6, initialCount: S = 20, onRangeChange: C, scrollerRef: w, vars: T, css: E, props: D, ...O } = e, k = d(null), [A, j] = f(() => /* @__PURE__ */ new Map()), [, M] = f(0), [N, P] = f({
|
|
63
|
+
startIndex: 0,
|
|
64
|
+
endIndex: Math.min(S, m.length)
|
|
65
|
+
}), [F, I] = f(-1), L = n(C), R = c((e) => {
|
|
66
|
+
k.current = e, typeof i == "function" ? i(e) : i && (i.current = e);
|
|
67
|
+
}, [i]), [z, B] = f(null), V = u(() => m.map((e, t) => h(e, t)), [m, h]), H = u(() => g.typicalSize(A.values(), b), [A, b]), U = z?.count === m.length ? z : null, W = U ? U.estimate : H, G = u(() => g.offsetsOf(V.map((e) => A.get(e) ?? W)), [
|
|
68
|
+
V,
|
|
69
|
+
A,
|
|
70
|
+
W
|
|
71
|
+
]), K = G[m.length], q = r({
|
|
72
|
+
offsets: G,
|
|
73
|
+
pin: F,
|
|
74
|
+
overscan: x,
|
|
75
|
+
count: m.length,
|
|
76
|
+
total: K,
|
|
77
|
+
estimate: W
|
|
78
|
+
}), J = d(null), Y = Math.min(N.startIndex, Math.max(0, m.length - 1)), X = Math.min(Math.max(N.endIndex, Y), m.length), Z = n(() => {
|
|
79
|
+
let e = k.current, { offsets: t, pin: n, overscan: r, count: i } = q.current;
|
|
80
|
+
if (!e || i === 0) return;
|
|
81
|
+
let o = w?.current ?? a(e), s = e.ownerDocument.defaultView, c = o ? o.getBoundingClientRect().top + o.clientTop : 0, l = o ? o.clientHeight : s?.innerHeight ?? 0, u = e.getBoundingClientRect().top + e.clientTop, d = g.measuredWindow({
|
|
82
|
+
offsets: t,
|
|
83
|
+
viewStart: c - u,
|
|
84
|
+
viewEnd: c - u + l,
|
|
85
|
+
overscan: r,
|
|
86
|
+
pin: n
|
|
87
|
+
});
|
|
88
|
+
P((e) => e.startIndex === d.startIndex && e.endIndex === d.endIndex ? e : {
|
|
89
|
+
startIndex: d.startIndex,
|
|
90
|
+
endIndex: d.endIndex
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
t(() => {
|
|
94
|
+
let e = k.current;
|
|
95
|
+
if (!e) return;
|
|
96
|
+
let t = null, n = 0, r = w?.current ?? a(e), i = r ? r.getBoundingClientRect().top : 0, o = parseFloat(getComputedStyle(e).rowGap) || 0, s = J.current;
|
|
97
|
+
if (J.current = null, s?.element.isConnected && (n += s.element.getBoundingClientRect().top - s.top), Array.from(e.children).forEach((e, r) => {
|
|
98
|
+
let a = Y + r, s = V[a];
|
|
99
|
+
if (s === void 0) return;
|
|
100
|
+
e.setAttribute("aria-setsize", String(m.length)), e.setAttribute("aria-posinset", String(a + 1));
|
|
101
|
+
let c = e.getBoundingClientRect(), l = c.height + o, u = A.get(s) ?? W;
|
|
102
|
+
c.height > 0 && A.get(s) !== l && (t ??= new Map(A), t.set(s, l), c.bottom <= i && (n += l - u));
|
|
103
|
+
}), n !== 0) {
|
|
104
|
+
let t = r ?? e.ownerDocument.defaultView, i = r ? r.scrollTop : t?.scrollY ?? 0;
|
|
105
|
+
t?.scrollTo({
|
|
106
|
+
top: i + n,
|
|
107
|
+
behavior: "instant"
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
t ? (J.current = _(e, i), j(t)) : Z();
|
|
111
|
+
}), l(() => {
|
|
112
|
+
let e = k.current;
|
|
113
|
+
if (!e || typeof ResizeObserver > "u") return;
|
|
114
|
+
let t = new ResizeObserver(() => M((e) => e + 1));
|
|
115
|
+
return Array.from(e.children).forEach((e) => t.observe(e)), () => t.disconnect();
|
|
116
|
+
}, [N, V]), l(() => {
|
|
117
|
+
let e = k.current, t = e?.ownerDocument.defaultView;
|
|
118
|
+
if (!e || !t) return;
|
|
119
|
+
let n = w?.current ?? a(e), r = n ?? t, i = 0, o = !1, s = 0, c = () => {
|
|
120
|
+
i ||= requestAnimationFrame(() => (i = 0, Z()));
|
|
121
|
+
}, l = () => {
|
|
122
|
+
let { count: r, total: i, estimate: a } = q.current;
|
|
123
|
+
B((e) => e ?? {
|
|
124
|
+
count: r,
|
|
125
|
+
total: i,
|
|
126
|
+
estimate: a
|
|
127
|
+
}), clearTimeout(s), s = t.setTimeout(() => {
|
|
128
|
+
o || (J.current = _(e, n ? n.getBoundingClientRect().top : 0), B(null));
|
|
129
|
+
}, v);
|
|
130
|
+
}, u = () => {
|
|
131
|
+
l(), c();
|
|
132
|
+
}, d = () => {
|
|
133
|
+
o = !0, l();
|
|
134
|
+
}, f = () => {
|
|
135
|
+
o && (o = !1, l());
|
|
136
|
+
};
|
|
137
|
+
r.addEventListener("scroll", u, { passive: !0 }), r.addEventListener("pointerdown", d, {
|
|
138
|
+
capture: !0,
|
|
139
|
+
passive: !0
|
|
140
|
+
}), t.addEventListener("pointerup", f, !0), t.addEventListener("pointercancel", f, !0), t.addEventListener("resize", c);
|
|
141
|
+
let p = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
|
|
142
|
+
return n && p?.observe(n), () => {
|
|
143
|
+
cancelAnimationFrame(i), clearTimeout(s), r.removeEventListener("scroll", u), r.removeEventListener("pointerdown", d, !0), t.removeEventListener("pointerup", f, !0), t.removeEventListener("pointercancel", f, !0), t.removeEventListener("resize", c), p?.disconnect();
|
|
144
|
+
};
|
|
145
|
+
}, [
|
|
146
|
+
w,
|
|
147
|
+
Z,
|
|
148
|
+
q
|
|
149
|
+
]), l(() => {
|
|
150
|
+
L({
|
|
151
|
+
startIndex: N.startIndex,
|
|
152
|
+
endIndex: N.endIndex
|
|
153
|
+
});
|
|
154
|
+
}, [N, L]);
|
|
155
|
+
let Q = (e) => {
|
|
156
|
+
let t = k.current, n = Array.from(t?.children ?? []).findIndex((t) => t.contains(e.target));
|
|
157
|
+
n >= 0 && I(Y + n);
|
|
158
|
+
}, ee = (e) => {
|
|
159
|
+
k.current?.contains(e.relatedTarget) || I(-1);
|
|
160
|
+
}, $ = [];
|
|
161
|
+
for (let e = Y; e < X; e++) $.push(/* @__PURE__ */ p(s, { children: y(m[e], e) }, V[e]));
|
|
162
|
+
return /* @__PURE__ */ p(o, {
|
|
163
|
+
ref: R,
|
|
164
|
+
...O,
|
|
165
|
+
vars: Y > 0 ? {
|
|
166
|
+
...T,
|
|
167
|
+
"list-first-divider": "block"
|
|
168
|
+
} : T,
|
|
169
|
+
css: {
|
|
170
|
+
...E,
|
|
171
|
+
overflowAnchor: "none"
|
|
172
|
+
},
|
|
173
|
+
transition: "none",
|
|
174
|
+
style: {
|
|
175
|
+
paddingBlockStart: `${G[Y]}px`,
|
|
176
|
+
paddingBlockEnd: `${Math.max(0, (U && X < m.length ? U.total : K) - G[X])}px`
|
|
177
|
+
},
|
|
178
|
+
props: {
|
|
179
|
+
...D,
|
|
180
|
+
onFocus: Q,
|
|
181
|
+
onBlur: ee
|
|
182
|
+
},
|
|
183
|
+
children: $
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
var b = e(y, "VirtualList");
|
|
187
|
+
//#endregion
|
|
188
|
+
export { b as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./box.cjs"),t=require("./dates.cjs"),n=require("./date-math.cjs"),r=require("./date-input.cjs"),i=require("./date-environment.cjs"),a=require("./components/flex.cjs"),o=require("./components/dropdown.cjs"),s=require("./components/dateField.cjs"),c=require("./components/datePicker.cjs"),l=require("./dataGridListLayout.cjs");let u=require("react"),d=require("react/jsx-runtime");var f={date:{dateStyle:`medium`},time:{timeStyle:`short`},datetime:{dateStyle:`medium`,timeStyle:`short`}};function p(e){return e instanceof Date||typeof e==`string`||typeof e==`number`?e:null}function m(e){let{value:n,format:r}=e,{locale:a,zone:o}=i.n();if(r===`relative`)return(0,d.jsx)(d.Fragment,{children:t.r(p(n),{locale:a,zone:o})});let s=typeof r==`string`?f[r]:r;return(0,d.jsx)(d.Fragment,{children:t.t(p(n),{...s,locale:a,zone:s.zone??o})})}function h(e,t){return t===null?null:e instanceof Date?n.w(t):typeof e==`string`&&/z$/i.test(e)?n.j(t):t}function g(e){let{cell:t,label:r,errorId:i,onBlur:a}=e,{type:o,zone:c,min:l,max:u}=t.editor,f=t.draft instanceof Date||typeof t.draft==`string`?n.v(t.draft):null;return(0,d.jsx)(s.default,{type:o,value:f,zone:c,min:typeof l==`string`?l:void 0,max:typeof u==`string`?u:void 0,onValueChange:e=>t.setDraft(o===`datetime`?h(t.value,e):e),width:`fit`,variant:`compact`,b:0,bgColor:`transparent`,focus:{outline:0},invalid:i?!0:void 0,describedBy:i,autoFocus:!0,props:{"aria-label":r,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||a()}}})}function _(e){let t=e.currentFilter?.type===`date`?e.currentFilter:void 0,[n,r]=(0,u.useState)(t?.operator??`on`),[i,a]=(0,u.useState)(t?.valueTo??null),o=t?.value??null;return{operator:n,value:o,valueTo:i,setOperator:t=>{r(t),e.setDateFilter(t,o,i)},setValue:t=>e.setDateFilter(n,t,i),setValueTo:t=>{a(t),e.setDateFilter(n,o,t)},clear:()=>{a(null),e.clearFilter()}}}var v=[{value:`on`,label:`=`},{value:`before`,label:`<`},{value:`after`,label:`>`},{value:`between`,label:`↔`}];function y(e,t){let n=e.filterConfig,r=typeof n?.min==`string`?n.min:void 0,i=typeof n?.max==`string`?n.max:void 0;return{from:{min:r,max:t.operator===`between`&&t.valueTo||i},to:{min:t.value??r,max:i}}}function b(e){let{column:t}=e,n=String(t.header??t.key),r=t.grid.localeText,i=_(t),s=y(t,i),l=(e,t,i,a,o=!1)=>(0,d.jsx)(c.default,{value:e,onValueChange:i,min:a.min,max:a.max,clearable:o,clearLabel:r.clearFilter(n),variant:`compact`,width:`fit`,minWidth:0,b:0,bgColor:`transparent`,focus:{outline:0},tabIndex:-1,props:{"aria-label":t}});return(0,d.jsxs)(a.default,{component:`${t.grid.componentName}.filter.cell.input`,ai:i.operator===`between`?`start`:`center`,gap:1,children:[(0,d.jsx)(o.default,{value:i.operator,variant:`compact`,onChange:e=>e&&i.setOperator(e),minWidth:6,hideIcon:!0,b:0,bgColor:`transparent`,focus:{outline:0},props:{tabIndex:-1,"aria-label":r.filterComparison(n)},children:v.map(e=>(0,d.jsx)(o.default.Item,{value:e.value,children:e.label},e.value))}),(0,d.jsxs)(a.default,{d:`column`,gap:1,flex1:!0,minWidth:0,children:[l(i.value,i.operator===`between`?r.filterFrom(n):r.filterColumn(n),(e,t)=>t.reason===`clear`?i.clear():i.setValue(e),s.from,!0),i.operator===`between`&&l(i.valueTo,r.filterTo(n),i.setValueTo,s.to)]})]})}function x(t){let{column:n}=t,r=n.grid.componentName,i=n.grid.localeText,o=String(n.header??n.key),s=_(n),u=y(n,s);return(0,d.jsxs)(a.default,{gap:2,ai:`center`,flexWrap:`wrap`,children:[(0,d.jsx)(e.default,{tag:`select`,component:`${r}.list.sheet.input`,...l.t.INPUT,width:18,flexShrink:0,props:{value:s.operator,"aria-label":i.filterComparison(o),onChange:e=>s.setOperator(e.target.value)},children:v.map(e=>(0,d.jsx)(`option`,{value:e.value,children:e.label},e.value))}),(0,d.jsx)(c.default,{value:s.value,onValueChange:s.setValue,min:u.from.min,max:u.from.max,flex1:!0,props:{"aria-label":s.operator===`between`?i.filterFrom(o):i.filterColumn(o)}}),s.operator===`between`&&(0,d.jsx)(c.default,{value:s.valueTo,onValueChange:s.setValueTo,min:u.to.min,max:u.to.max,flex1:!0,props:{"aria-label":i.filterTo(o)}})]})}function S(e,t){let n=e.type===`datetime`?e.zone===`none`?`datetime`:`instant`:e.type;return r.m(t,{kind:n,zone:e.zone===`none`?void 0:e.zone})}function C(e,n){return n===void 0?t.t(e):t.n(e,n)}var w={DateValue:m,DateEditor:g,DateFilter:b,ListDateFilter:x,parsePasted:S,describeDay:C};exports.default=w;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import e from "./box.mjs";
|
|
2
|
+
import { n as t, r as n, t as r } from "./dates.mjs";
|
|
3
|
+
import { j as i, v as a, w as o } from "./date-math.mjs";
|
|
4
|
+
import { m as s } from "./date-input.mjs";
|
|
5
|
+
import { n as c } from "./date-environment.mjs";
|
|
6
|
+
import l from "./components/flex.mjs";
|
|
7
|
+
import u from "./components/dropdown.mjs";
|
|
8
|
+
import d from "./components/dateField.mjs";
|
|
9
|
+
import f from "./components/datePicker.mjs";
|
|
10
|
+
import { t as p } from "./dataGridListLayout.mjs";
|
|
11
|
+
import { useState as m } from "react";
|
|
12
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
13
|
+
//#region src/components/dataGrid/components/dataGridDateParts.tsx
|
|
14
|
+
var v = {
|
|
15
|
+
date: { dateStyle: "medium" },
|
|
16
|
+
time: { timeStyle: "short" },
|
|
17
|
+
datetime: {
|
|
18
|
+
dateStyle: "medium",
|
|
19
|
+
timeStyle: "short"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
function y(e) {
|
|
23
|
+
return e instanceof Date || typeof e == "string" || typeof e == "number" ? e : null;
|
|
24
|
+
}
|
|
25
|
+
function b(e) {
|
|
26
|
+
let { value: t, format: i } = e, { locale: a, zone: o } = c();
|
|
27
|
+
if (i === "relative") return /* @__PURE__ */ g(h, { children: n(y(t), {
|
|
28
|
+
locale: a,
|
|
29
|
+
zone: o
|
|
30
|
+
}) });
|
|
31
|
+
let s = typeof i == "string" ? v[i] : i;
|
|
32
|
+
return /* @__PURE__ */ g(h, { children: r(y(t), {
|
|
33
|
+
...s,
|
|
34
|
+
locale: a,
|
|
35
|
+
zone: s.zone ?? o
|
|
36
|
+
}) });
|
|
37
|
+
}
|
|
38
|
+
function x(e, t) {
|
|
39
|
+
return t === null ? null : e instanceof Date ? o(t) : typeof e == "string" && /z$/i.test(e) ? i(t) : t;
|
|
40
|
+
}
|
|
41
|
+
function S(e) {
|
|
42
|
+
let { cell: t, label: n, errorId: r, onBlur: i } = e, { type: o, zone: s, min: c, max: l } = t.editor, u = t.draft instanceof Date || typeof t.draft == "string" ? a(t.draft) : null;
|
|
43
|
+
return /* @__PURE__ */ g(d, {
|
|
44
|
+
type: o,
|
|
45
|
+
value: u,
|
|
46
|
+
zone: s,
|
|
47
|
+
min: typeof c == "string" ? c : void 0,
|
|
48
|
+
max: typeof l == "string" ? l : void 0,
|
|
49
|
+
onValueChange: (e) => t.setDraft(o === "datetime" ? x(t.value, e) : e),
|
|
50
|
+
width: "fit",
|
|
51
|
+
variant: "compact",
|
|
52
|
+
b: 0,
|
|
53
|
+
bgColor: "transparent",
|
|
54
|
+
focus: { outline: 0 },
|
|
55
|
+
invalid: r ? !0 : void 0,
|
|
56
|
+
describedBy: r,
|
|
57
|
+
autoFocus: !0,
|
|
58
|
+
props: {
|
|
59
|
+
"aria-label": n,
|
|
60
|
+
onBlur: (e) => {
|
|
61
|
+
e.currentTarget.contains(e.relatedTarget) || i();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function C(e) {
|
|
67
|
+
let t = e.currentFilter?.type === "date" ? e.currentFilter : void 0, [n, r] = m(t?.operator ?? "on"), [i, a] = m(t?.valueTo ?? null), o = t?.value ?? null;
|
|
68
|
+
return {
|
|
69
|
+
operator: n,
|
|
70
|
+
value: o,
|
|
71
|
+
valueTo: i,
|
|
72
|
+
setOperator: (t) => {
|
|
73
|
+
r(t), e.setDateFilter(t, o, i);
|
|
74
|
+
},
|
|
75
|
+
setValue: (t) => e.setDateFilter(n, t, i),
|
|
76
|
+
setValueTo: (t) => {
|
|
77
|
+
a(t), e.setDateFilter(n, o, t);
|
|
78
|
+
},
|
|
79
|
+
clear: () => {
|
|
80
|
+
a(null), e.clearFilter();
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
var w = [
|
|
85
|
+
{
|
|
86
|
+
value: "on",
|
|
87
|
+
label: "="
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
value: "before",
|
|
91
|
+
label: "<"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
value: "after",
|
|
95
|
+
label: ">"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
value: "between",
|
|
99
|
+
label: "↔"
|
|
100
|
+
}
|
|
101
|
+
];
|
|
102
|
+
function T(e, t) {
|
|
103
|
+
let n = e.filterConfig, r = typeof n?.min == "string" ? n.min : void 0, i = typeof n?.max == "string" ? n.max : void 0;
|
|
104
|
+
return {
|
|
105
|
+
from: {
|
|
106
|
+
min: r,
|
|
107
|
+
max: t.operator === "between" && t.valueTo || i
|
|
108
|
+
},
|
|
109
|
+
to: {
|
|
110
|
+
min: t.value ?? r,
|
|
111
|
+
max: i
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function E(e) {
|
|
116
|
+
let { column: t } = e, n = String(t.header ?? t.key), r = t.grid.localeText, i = C(t), a = T(t, i), o = (e, t, i, a, o = !1) => /* @__PURE__ */ g(f, {
|
|
117
|
+
value: e,
|
|
118
|
+
onValueChange: i,
|
|
119
|
+
min: a.min,
|
|
120
|
+
max: a.max,
|
|
121
|
+
clearable: o,
|
|
122
|
+
clearLabel: r.clearFilter(n),
|
|
123
|
+
variant: "compact",
|
|
124
|
+
width: "fit",
|
|
125
|
+
minWidth: 0,
|
|
126
|
+
b: 0,
|
|
127
|
+
bgColor: "transparent",
|
|
128
|
+
focus: { outline: 0 },
|
|
129
|
+
tabIndex: -1,
|
|
130
|
+
props: { "aria-label": t }
|
|
131
|
+
});
|
|
132
|
+
return /* @__PURE__ */ _(l, {
|
|
133
|
+
component: `${t.grid.componentName}.filter.cell.input`,
|
|
134
|
+
ai: i.operator === "between" ? "start" : "center",
|
|
135
|
+
gap: 1,
|
|
136
|
+
children: [/* @__PURE__ */ g(u, {
|
|
137
|
+
value: i.operator,
|
|
138
|
+
variant: "compact",
|
|
139
|
+
onChange: (e) => e && i.setOperator(e),
|
|
140
|
+
minWidth: 6,
|
|
141
|
+
hideIcon: !0,
|
|
142
|
+
b: 0,
|
|
143
|
+
bgColor: "transparent",
|
|
144
|
+
focus: { outline: 0 },
|
|
145
|
+
props: {
|
|
146
|
+
tabIndex: -1,
|
|
147
|
+
"aria-label": r.filterComparison(n)
|
|
148
|
+
},
|
|
149
|
+
children: w.map((e) => /* @__PURE__ */ g(u.Item, {
|
|
150
|
+
value: e.value,
|
|
151
|
+
children: e.label
|
|
152
|
+
}, e.value))
|
|
153
|
+
}), /* @__PURE__ */ _(l, {
|
|
154
|
+
d: "column",
|
|
155
|
+
gap: 1,
|
|
156
|
+
flex1: !0,
|
|
157
|
+
minWidth: 0,
|
|
158
|
+
children: [o(i.value, i.operator === "between" ? r.filterFrom(n) : r.filterColumn(n), (e, t) => t.reason === "clear" ? i.clear() : i.setValue(e), a.from, !0), i.operator === "between" && o(i.valueTo, r.filterTo(n), i.setValueTo, a.to)]
|
|
159
|
+
})]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function D(t) {
|
|
163
|
+
let { column: n } = t, r = n.grid.componentName, i = n.grid.localeText, a = String(n.header ?? n.key), o = C(n), s = T(n, o);
|
|
164
|
+
return /* @__PURE__ */ _(l, {
|
|
165
|
+
gap: 2,
|
|
166
|
+
ai: "center",
|
|
167
|
+
flexWrap: "wrap",
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ g(e, {
|
|
170
|
+
tag: "select",
|
|
171
|
+
component: `${r}.list.sheet.input`,
|
|
172
|
+
...p.INPUT,
|
|
173
|
+
width: 18,
|
|
174
|
+
flexShrink: 0,
|
|
175
|
+
props: {
|
|
176
|
+
value: o.operator,
|
|
177
|
+
"aria-label": i.filterComparison(a),
|
|
178
|
+
onChange: (e) => o.setOperator(e.target.value)
|
|
179
|
+
},
|
|
180
|
+
children: w.map((e) => /* @__PURE__ */ g("option", {
|
|
181
|
+
value: e.value,
|
|
182
|
+
children: e.label
|
|
183
|
+
}, e.value))
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ g(f, {
|
|
186
|
+
value: o.value,
|
|
187
|
+
onValueChange: o.setValue,
|
|
188
|
+
min: s.from.min,
|
|
189
|
+
max: s.from.max,
|
|
190
|
+
flex1: !0,
|
|
191
|
+
props: { "aria-label": o.operator === "between" ? i.filterFrom(a) : i.filterColumn(a) }
|
|
192
|
+
}),
|
|
193
|
+
o.operator === "between" && /* @__PURE__ */ g(f, {
|
|
194
|
+
value: o.valueTo,
|
|
195
|
+
onValueChange: o.setValueTo,
|
|
196
|
+
min: s.to.min,
|
|
197
|
+
max: s.to.max,
|
|
198
|
+
flex1: !0,
|
|
199
|
+
props: { "aria-label": i.filterTo(a) }
|
|
200
|
+
})
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
function O(e, t) {
|
|
205
|
+
let n = e.type === "datetime" ? e.zone === "none" ? "datetime" : "instant" : e.type;
|
|
206
|
+
return s(t, {
|
|
207
|
+
kind: n,
|
|
208
|
+
zone: e.zone === "none" ? void 0 : e.zone
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function k(e, n) {
|
|
212
|
+
return n === void 0 ? r(e) : t(e, n);
|
|
213
|
+
}
|
|
214
|
+
var A = {
|
|
215
|
+
DateValue: b,
|
|
216
|
+
DateEditor: S,
|
|
217
|
+
DateFilter: E,
|
|
218
|
+
ListDateFilter: D,
|
|
219
|
+
parsePasted: O,
|
|
220
|
+
describeDay: k
|
|
221
|
+
};
|
|
222
|
+
//#endregion
|
|
223
|
+
export { A as default };
|
package/dataGridList.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./box.cjs"),t=require("./components/svg.cjs"),n=require("./components/button.cjs"),r=require("./components/visuallyHidden.cjs"),i=require("./components/flex.cjs"),a=require("./components/checkbox.cjs"),o=require("./components/textbox.cjs"),s=require("./components/semantics.cjs"),c=require("./components/dataGrid.cjs"),l=require("./components/dialog.cjs"),u=require("./components/list.cjs"),d=require("./components/radioButton.cjs"),f=require("./components/skeleton.cjs"),p=require("./dataGridListLayout.cjs");let m=require("react"),h=require("react/jsx-runtime");function g(e){let{cell:t}=e,{AggregateCell:n}=t.column;return n?(0,h.jsx)(n,{cell:t}):(0,h.jsx)(h.Fragment,{children:t.value??`—`})}g.displayName=`DataGridListAggregate`;function _(t){let{grid:r,shown:a}=t,{list:o,pagination:s,aggregation:l}=r,u=r.componentName,d=r.localeText,f=s.state,m=l.hasFooter?l.footerCells.value.filter(e=>e.column.aggregate):[];return(0,h.jsxs)(h.Fragment,{children:[m.length>0&&(0,h.jsxs)(e.default,{bgColor:`currentColor/3`,px:4,py:3,children:[(0,h.jsx)(e.default,{fontWeight:600,fontSize:14,mb:1,children:l.footerLabel}),(0,h.jsx)(e.default,{tag:`dl`,display:`grid`,gridTemplateColumns:2,columnGap:4,rowGap:2,m:0,children:m.map(t=>(0,h.jsxs)(e.default,{minWidth:0,children:[(0,h.jsx)(e.default,{tag:`dt`,component:`list.muted`,fontSize:12,lineHeight:16,children:t.column.header??String(t.column.key)}),(0,h.jsx)(e.default,{tag:`dd`,m:0,fontSize:14,lineHeight:20,fontWeight:600,children:(0,h.jsx)(g,{cell:t})})]},t.column.key))})]}),f?(0,h.jsx)(i.default,{component:`list.muted`,d:`column`,gap:2,ai:`center`,px:4,py:4,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:(0,h.jsxs)(i.default,{ai:`center`,jc:`space-between`,gap:3,width:`fit`,children:[(0,h.jsx)(n.default,{type:`button`,component:`${u}.list.button`,...p.t.ICON_BUTTON,borderRadius:3,disabled:!s.canGoPrev,onClick:s.prevPage,props:{"aria-label":d.previousPage},children:(0,h.jsx)(c.f,{width:`18px`,height:`18px`,rotate:90,rtl:{rotate:-90}})}),(0,h.jsx)(e.default,{textAlign:`center`,children:d.pageRowRange(s.startItem,s.endItem,s.totalItems)}),(0,h.jsx)(n.default,{type:`button`,component:`${u}.list.button`,...p.t.ICON_BUTTON,borderRadius:3,disabled:!s.canGoNext,onClick:s.nextPage,props:{"aria-label":d.nextPage},children:(0,h.jsx)(c.f,{width:`18px`,height:`18px`,rotate:-90,rtl:{rotate:90}})})]})}):(o.hasMore||a!==void 0)&&(0,h.jsxs)(i.default,{component:`list.muted`,d:`column`,gap:2,ai:`center`,px:4,py:4,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:[o.hasMore&&(0,h.jsx)(n.default,{type:`button`,component:`${u}.list.button`,width:`fit`,height:11,borderRadius:3,fontSize:15,fontWeight:500,color:`indigo-600`,cursor:`pointer`,theme:{dark:{color:`indigo-300`}},onClick:o.showMore,children:d.showMore(o.nextBatch)}),a!==void 0&&(0,h.jsx)(e.default,{children:d.shownCount(a,r.source.enabled?r.totalRowCount:r.filterStats.filtered)})]})]})}_.displayName=`DataGridListFooter`;function v(e){let{row:t}=e,{grid:n}=t,r=t.cells.flatMap(e=>e.aggregate?[e.aggregate]:[]),i=t.placeholder?``:String(t.groupValue);return(0,h.jsxs)(u.default.Item,{size:`sm`,bgColor:`currentColor/3`,ps:4+Math.min(t.depth,3)*4,props:{"aria-busy":t.placeholder||void 0},children:[n.list.selecting&&t.selectable&&(0,h.jsx)(u.default.Actions,{children:(0,h.jsx)(a.default,{variant:`datagrid`,checked:t.selected,indeterminate:t.indeterminate,onChange:t.toggleSelectAll,props:{"aria-label":n.localeText.selectGroupRows(i)}})}),(0,h.jsx)(c.f,{width:`16px`,height:`16px`,flexShrink:0,rotate:t.expanded?0:-90,rtl:{rotate:t.expanded?0:90}}),(0,h.jsxs)(u.default.Content,{children:[(0,h.jsx)(u.default.Title,{lines:1,fontSize:14,fontWeight:600,children:(0,h.jsx)(u.default.Action,{onClick:()=>t.toggleRow(),props:{"aria-expanded":t.expanded},children:i})}),r.length>0&&(0,h.jsx)(u.default.Row,{secondary:!0,wrap:!0,columnGap:4,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:r.map(e=>(0,h.jsxs)(s.Span,{display:`inline-flex`,gap:1,children:[(0,h.jsx)(s.Span,{children:e.column.header??String(e.column.key)}),(0,h.jsx)(s.Span,{fontWeight:600,children:(0,h.jsx)(g,{cell:e})})]},e.column.key))})]}),(0,h.jsx)(u.default.Meta,{px:2,borderRadius:999,fontSize:12,fontWeight:600,lineHeight:20,bgColor:`currentColor/10`,alignSelf:`center`,children:t.count})]})}v.displayName=`DataGridListGroup`;var y=(0,m.memo)(v);function b(e){let{row:t,column:n}=e,r=t.cells.find(e=>e.column===n);if(!r)return null;if(n.Cell)return(0,h.jsx)(n.Cell,{cell:r});let{value:i}=r;if(typeof i==`boolean`)return(0,h.jsx)(h.Fragment,{children:i?r.grid.localeText.booleanTrue:r.grid.localeText.booleanFalse});let a=c.u(n,i);return a&&i!=null&&i!==``?(0,h.jsx)(c.l,{value:i,format:a}):(0,h.jsx)(h.Fragment,{children:i==null||i===``?`—`:String(i)})}b.displayName=`DataGridListValue`;function x(t){let{row:r,index:i,position:o,setSize:l}=t,{grid:d}=r,{list:m}=d,{title:g,kicker:_,subtitle:v,end:y,fields:x}=m.layout.value,{selecting:S}=m,C=m.recordViewEnabled&&!r.placeholder,w=c.p(r)?r:void 0,T=d.props.def.rowDetail,E=d.localeText,D={"aria-posinset":o,"aria-setsize":l};if(r.placeholder)return(0,h.jsx)(u.default.Item,{props:{...D,"aria-busy":!0},children:(0,h.jsx)(f.default,{lines:2,flex1:!0})});let O=g?(0,h.jsx)(b,{row:r,column:g}):E.unnamedRow(r.rowIndex+1),k=g?String(r.cells.find(e=>e.column===g)?.value??``):``,A=m.checkboxId(r.key);return(0,h.jsxs)(u.default.Item,{ai:`start`,selected:!!d.props.def.rowSelection&&r.selected,chevron:C&&!S,ps:w?4+Math.min(w.level,3)*4:void 0,props:{...D,"data-list-key":String(r.key)},children:[S&&(0,h.jsx)(u.default.Actions,{width:6,jc:`center`,alignSelf:`center`,children:(0,h.jsx)(a.default,{id:A,variant:`datagrid`,checked:r.selected,indeterminate:r.indeterminate,onChange:r.toggleSelection})}),(0,h.jsxs)(u.default.Content,{children:[_&&(0,h.jsx)(u.default.Overline,{lines:1,children:(0,h.jsx)(b,{row:r,column:_})}),(0,h.jsxs)(u.default.Row,{ai:`start`,gap:3,children:[(0,h.jsxs)(u.default.Row,{jc:`start`,ai:`center`,gap:1,flex1:!0,children:[w?.hasChildren&&(0,h.jsx)(u.default.Actions,{ms:-2,children:(0,h.jsx)(n.default,{type:`button`,component:`${d.componentName}.list.toggle`,...p.t.ICON_BUTTON,width:8,height:8,onClick:w.toggleTree,props:{"aria-expanded":w.treeExpanded,"aria-label":(w.treeExpanded?E.collapseTreeRow:E.expandTreeRow)(k||E.unnamedRow(r.rowIndex+1))},children:(0,h.jsx)(c.f,{width:`16px`,height:`16px`,rotate:w.treeExpanded?0:-90,rtl:{rotate:w.treeExpanded?0:90}})})}),(0,h.jsx)(u.default.Title,{lines:1,flex1:!0,fontWeight:600,children:S?(0,h.jsx)(u.default.Action,{props:{htmlFor:A},children:O}):C?(0,h.jsx)(u.default.Action,{props:{"aria-haspopup":`dialog`},onClick:()=>m.openRecord(r,i),children:O}):O})]}),y&&(0,h.jsxs)(u.default.End,{fontSize:16,fontWeight:600,lineHeight:22,...p.t.TRUNCATE,children:[(0,h.jsx)(b,{row:r,column:y}),(0,h.jsx)(u.default.Meta,{fontWeight:400,...p.t.LABEL,children:y.header??String(y.key)})]})]}),v.length>0&&(0,h.jsx)(u.default.Description,{lines:1,children:v.map((e,t)=>(0,h.jsxs)(s.Span,{children:[t>0&&` · `,(0,h.jsx)(b,{row:r,column:e})]},e.key))}),x.length>0&&(0,h.jsx)(u.default.Fields,{mt:2,css:{gridTemplateColumns:`repeat(2, minmax(0, 1fr))`},children:x.map(t=>(0,h.jsx)(u.default.Field,{label:t.header??String(t.key),children:(0,h.jsx)(e.default,{...p.t.TRUNCATE,children:(0,h.jsx)(b,{row:r,column:t})})},t.key))}),T&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(u.default.Actions,{alignSelf:`start`,mt:1,ms:-2,children:(0,h.jsxs)(n.default,{type:`button`,component:`${d.componentName}.list.toggle`,display:`inline-flex`,ai:`center`,gap:1,minHeight:8,px:2,borderRadius:2,fontSize:13,fontWeight:500,cursor:`pointer`,onClick:r.toggleDetail,props:{"aria-expanded":r.expanded},children:[(0,h.jsx)(c.f,{width:`14px`,height:`14px`,rotate:r.expanded?0:-90,rtl:{rotate:r.expanded?0:90}}),E.details]})}),r.expanded&&(0,h.jsx)(u.default.Actions,{display:`block`,mt:2,children:(0,h.jsx)(e.default,{component:`${d.componentName}.list.detail`,p:3,borderRadius:2,fontSize:14,children:T.content(r.data)})})]})]})]})}x.displayName=`DataGridListItem`;var S=(0,m.memo)(x);function C(e){return(0,h.jsx)(t.Svg,{viewBox:`0 0 24 24`,width:`1.25rem`,fill:`none`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,h.jsx)(t.Path,{d:`M6 6l12 12M18 6L6 18`,strokeLinecap:`round`})})}var w=80;function T(t){let{grid:r,open:a,onOpen:o,onClose:s,title:c,trigger:u,actions:d,footer:f,tall:g,bodyProps:_,bodyRef:v,onKeyDown:y,children:b}=t,x=r.componentName,S=`${x}.list.sheet.line`,T=(0,m.useRef)(null),E=(0,m.useCallback)(e=>{let t=e.currentTarget.closest(`dialog`);e.button!==0||!t||e.target.closest(`button`)||(T.current={id:e.pointerId,y:e.clientY,dy:0,dialog:t},e.currentTarget.setPointerCapture(e.pointerId))},[]),D=(0,m.useCallback)(e=>{let t=T.current;if(!t||t.id!==e.pointerId)return;let{dialog:n}=t;t.dy=Math.max(0,e.clientY-t.y),n.style.transition=`none`,n.style.translate=`0 ${t.dy}px`},[]),O=(0,m.useCallback)(()=>{let e=T.current;if(T.current=null,!e)return;let{dialog:t}=e;t.style.transition=``,t.style.translate=``,e.dy>w&&s()},[s]);return(0,h.jsxs)(l.default,{component:`${x}.list.sheet`,display:`flex`,d:`column`,css:g?{minHeight:`min(32rem, calc(100dvh - 2rem))`}:void 0,open:a,onOpenChange:e=>e?o?.():s(),trigger:u,props:{onKeyDown:y},children:[(0,h.jsxs)(i.default,{d:`column`,flexShrink:0,css:{touchAction:`none`},props:{onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O},children:[(0,h.jsx)(e.default,{width:9,height:1.25,mt:2,mx:`auto`,borderRadius:999,bgColor:`gray-300`,theme:{dark:{bgColor:`gray-600`}},props:{"aria-hidden":!0}}),(0,h.jsxs)(i.default,{component:`${S}`,ai:`center`,gap:2,ps:4,pe:2,py:2,bb:1,children:[(0,h.jsx)(l.default.Title,{flex1:!0,minWidth:0,m:0,fontSize:17,fontWeight:600,lineHeight:24,...p.t.TRUNCATE,children:c}),d,(0,h.jsx)(n.default,{type:`button`,component:`${x}.list.sheet.button`,...p.t.ICON_BUTTON,onClick:s,props:{"aria-label":r.localeText.close},children:(0,h.jsx)(C,{})})]})]}),(0,h.jsx)(e.default,{ref:v,flex1:!0,overflowY:`auto`,px:4,py:2,css:{overscrollBehavior:`contain`,touchAction:`pan-y`},props:_,children:b}),f&&(0,h.jsx)(i.default,{component:S,gap:3,flexShrink:0,px:4,pt:3,pb:4,bt:1,children:f})]})}T.displayName=`DataGridListSheet`;var E=60;function D({cell:t,index:r}){let{grid:a,column:o}=t,s=a.componentName,l=String(o.header??o.key),{editing:u}=t,d=(0,m.useRef)(null),f=(0,m.useRef)(!1);return(0,m.useEffect)(()=>{f.current&&!u&&d.current?.focus(),f.current=u},[u]),(0,h.jsxs)(e.default,{component:`${s}.list.sheet.line`,py:3,bb:1,children:[(0,h.jsx)(e.default,{tag:`dt`,component:`list.muted`,fontSize:13,lineHeight:18,children:l}),(0,h.jsxs)(e.default,{tag:`dd`,display:`flex`,ai:`center`,gap:2,m:0,fontSize:16,lineHeight:24,css:{fontVariantNumeric:`tabular-nums`,overflowWrap:`anywhere`},children:[u?(0,h.jsx)(i.default,{component:`${s}.list.sheet.input`,...p.t.INPUT,flex1:!0,ai:`center`,px:1,children:(0,h.jsx)(c.d,{cell:t,row:-1,columnIndex:r})}):(0,h.jsx)(e.default,{flex1:!0,minWidth:0,children:(0,h.jsx)(b,{row:t.row,column:o})}),t.editable&&!u&&(0,h.jsx)(n.default,{ref:d,type:`button`,component:`${s}.list.sheet.button`,...p.t.SHEET_BUTTON,height:10,onClick:()=>t.beginEdit(),props:{"aria-label":a.localeText.editCell(l)},children:a.localeText.edit})]})]})}function O(t){let{grid:r}=t,{list:o}=r,l=r.componentName,u=r.localeText,d=o.record,f=o.recordPosition,{title:g}=o.layout.value,_=(0,m.useRef)(null),v=(0,m.useRef)(null),y=d?.key;(0,m.useEffect)(()=>{v.current?.scrollTo?.({top:0})},[y]);let x=(0,m.useCallback)(()=>{let e=o.record?.key;r.edits.cancel(),o.closeRecord(),requestAnimationFrame(()=>{let t=r.sizingElement?.querySelectorAll(`[data-list-key]`)??[];Array.from(t).find(t=>t.dataset.listKey===String(e))?.querySelector(`[data-list-action]`)?.focus()})},[r,o]),S=(0,m.useCallback)(e=>{r.edits.isOpen&&r.edits.commit(),r.edits.isOpen||o.stepRecord(e)},[r,o]),C=e=>{_.current=e.pointerType===`touch`?{x:e.clientX,y:e.clientY}:null},w=e=>{let t=_.current;if(_.current=null,!t)return;let n=e.clientX-t.x,i=e.clientY-t.y;Math.abs(n)<E||Math.abs(n)<Math.abs(i)*1.5||S(n<0===r.isRtl?-1:1)},O=e=>{if(e.target.closest(`input,select,textarea,[role="combobox"]`))return;let t=r.isRtl?`ArrowLeft`:`ArrowRight`,n=r.isRtl?`ArrowRight`:`ArrowLeft`;(e.key===t||e.key===n)&&(e.preventDefault(),S(e.key===t?1:-1))},k=d&&f&&(0,h.jsxs)(i.default,{ai:`center`,gap:.5,flexShrink:0,children:[(0,h.jsx)(n.default,{type:`button`,component:`${l}.list.sheet.button`,...p.t.ICON_BUTTON,disabled:!o.hasPreviousRecord,onClick:()=>S(-1),props:{"aria-label":u.previousRow},children:(0,h.jsx)(c.f,{width:`18px`,height:`18px`,rotate:90,rtl:{rotate:-90}})}),(0,h.jsx)(e.default,{fontSize:13,color:`gray-500`,textWrap:`nowrap`,css:{fontVariantNumeric:`tabular-nums`},props:{"aria-live":`polite`},children:u.recordPosition(f.position,f.total)}),(0,h.jsx)(n.default,{type:`button`,component:`${l}.list.sheet.button`,...p.t.ICON_BUTTON,disabled:!o.hasNextRecord,onClick:()=>S(1),props:{"aria-label":u.nextRow},children:(0,h.jsx)(c.f,{width:`18px`,height:`18px`,rotate:-90,rtl:{rotate:90}})})]}),A=r.props.def.rowDetail;return(0,h.jsx)(T,{grid:r,open:!!d,onClose:x,tall:!0,title:d&&g?(0,h.jsx)(b,{row:d,column:g}):``,actions:k,onKeyDown:O,bodyRef:v,bodyProps:{onPointerDown:C,onPointerUp:w},children:d&&(0,h.jsxs)(h.Fragment,{children:[r.props.def.rowSelection&&(0,h.jsx)(e.default,{py:3,children:(0,h.jsx)(a.default,{variant:`datagrid`,checked:d.selected,onChange:d.toggleSelection,label:u.selectRow(d.rowIndex+1),labelProps:{display:`flex`,ai:`center`,gap:3,fontSize:15}})}),(0,h.jsx)(e.default,{tag:`dl`,m:0,children:o.recordColumns.map(e=>{let t=d.cells.findIndex(t=>t.column===e);return t===-1?null:(0,h.jsx)(D,{cell:d.cells[t],index:t},e.key)})}),A&&(0,h.jsxs)(i.default,{d:`column`,gap:2,py:3,children:[(0,h.jsx)(s.H3,{m:0,fontSize:14,fontWeight:600,children:u.details}),A.content(d.data)]})]})})}O.displayName=`DataGridListRecord`;function k(t){let{grid:r}=t,a=r.componentName,o=r.localeText,s=r.selectedRows.size;return!r.props.def.rowSelection||s===0?null:(0,h.jsxs)(i.default,{component:`${a}.list.selectionBar`,position:`sticky`,bottom:0,zIndex:2,ai:`center`,gap:2,px:4,py:2,fontSize:14,fontWeight:500,children:[(0,h.jsx)(e.default,{flex1:!0,minWidth:0,textWrap:`nowrap`,css:{fontVariantNumeric:`tabular-nums`},children:o.selectedRows(s)}),!r.allRowsSelected&&(0,h.jsx)(n.default,{type:`button`,minHeight:10,px:3,borderRadius:2,fontSize:14,fontWeight:500,cursor:`pointer`,active:{bgColor:`white/15`},theme:{dark:{active:{bgColor:`black/10`}}},onClick:r.toggleSelectAllRows,children:o.selectAll}),(0,h.jsx)(n.default,{type:`button`,minHeight:10,px:3,borderRadius:2,fontSize:14,fontWeight:500,cursor:`pointer`,active:{bgColor:`white/15`},theme:{dark:{active:{bgColor:`black/10`}}},onClick:r.clearSelection,children:o.clearSelection})]})}k.displayName=`DataGridListSelectionBar`;function A(e){return(0,h.jsx)(t.Svg,{viewBox:`0 0 24 24`,width:`1rem`,fill:`none`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,h.jsx)(t.Path,{d:`M4 6h16M7 12h10M10 18h4`,strokeLinecap:`round`})})}var j=8,M=[{value:`eq`,label:`=`},{value:`ne`,label:`≠`},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`},{value:`between`,label:`↔`}];function N({column:e}){let{currentFilter:t}=e,n=e.grid.componentName,r=e.grid.localeText,[i,a]=(0,m.useState)(t?.type===`text`?t.value:``),{debounce:s}=c.s(t,e=>c.c.textMatches(i,e),e=>a(e?.type===`text`?e.value:``));return(0,h.jsx)(o.default,{component:`${n}.list.sheet.input`,...p.t.INPUT,type:`search`,value:i,placeholder:e.filterConfig?.placeholder??r.filterPlaceholder,onChange:t=>{let n=t.target.value;a(n),s(`value`,()=>e.setTextFilter(n))},props:{"aria-label":r.filterColumn(String(e.header??e.key))}})}function P({column:t}){let{currentFilter:n}=t,r=t.grid.componentName,a=t.grid.localeText,s=String(t.header??t.key),l=t.filterConfig,[u,d]=(0,m.useState)(()=>c.c.numberDraft(n)),f=(0,m.useRef)(u),g=(0,m.useCallback)(e=>{f.current=e,d(e)},[]),{debounce:_,cancel:v}=c.s(n,e=>c.c.numberMatches(u,e),e=>g(c.c.numberDraft(e))),y=(e,n)=>{g({...f.current,...e});let r=()=>t.setNumberFilter(f.current.operator,f.current.value,f.current.valueTo);n?_(`value`,r):(v(),r())},b=(e,t,n,i)=>(0,h.jsx)(o.default,{component:`${r}.list.sheet.input`,...p.t.INPUT,type:`number`,value:e,step:l?.step,placeholder:n,onChange:e=>y({[i]:e.target.value},!0),props:{"aria-label":t,inputMode:`decimal`,min:l?.min,max:l?.max}});return(0,h.jsxs)(i.default,{gap:2,ai:`center`,children:[(0,h.jsx)(e.default,{tag:`select`,component:`${r}.list.sheet.input`,...p.t.INPUT,width:18,flexShrink:0,props:{value:u.operator,"aria-label":a.filterComparison(s),onChange:e=>y({operator:e.target.value},!1)},children:M.map(e=>(0,h.jsx)(`option`,{value:e.value,children:e.label},e.value))}),b(u.value,u.operator===`between`?a.filterFrom(s):a.filterColumn(s),u.operator===`between`?a.filterFromPlaceholder:l?.placeholder??a.filterValuePlaceholder,`value`),u.operator===`between`&&b(u.valueTo,a.filterTo(s),a.filterToPlaceholder,`valueTo`)]})}function F({column:e}){let t=c.m(!0);return t?(0,h.jsx)(t.ListDateFilter,{column:e}):null}function I({column:e}){let{currentFilter:t}=e,r=e.grid.componentName,s=e.grid.localeText,c=t?.type===`multiselect`?t.values:[],l=e.filterOptions,[u,d]=(0,m.useState)(``),f=t=>{e.setMultiselectFilter(c.includes(t)?c.filter(e=>e!==t):[...c,t])};if(l.length<=j)return(0,h.jsx)(i.default,{flexWrap:`wrap`,gap:2,children:l.map(e=>(0,h.jsx)(n.default,{type:`button`,component:`${r}.list.sheet.chip`,display:`inline-flex`,ai:`center`,minHeight:10,px:3.5,borderRadius:999,fontSize:14,cursor:`pointer`,onClick:()=>f(e.value),props:{"aria-pressed":c.includes(e.value)},children:e.label},String(e.value)))});let g=u.trim().toLocaleLowerCase(),_=g?l.filter(e=>e.label.toLocaleLowerCase().includes(g)):l;return(0,h.jsxs)(i.default,{d:`column`,gap:2,children:[(0,h.jsx)(o.default,{component:`${r}.list.sheet.input`,...p.t.INPUT,type:`search`,value:u,placeholder:s.filterSelectSearchPlaceholder,onChange:e=>d(e.target.value),props:{"aria-label":s.filterColumn(String(e.header??e.key))}}),(0,h.jsx)(i.default,{d:`column`,maxHeight:64,overflowY:`auto`,children:_.map(e=>(0,h.jsx)(a.default,{checked:c.includes(e.value),onChange:()=>f(e.value),label:e.label,labelProps:{component:`${r}.list.sheet.line`,display:`flex`,ai:`center`,gap:3,minHeight:12,fontSize:16,bb:1}},String(e.value)))})]})}function L(e){let{column:t}=e;switch(t.filterConfig?.type){case void 0:return null;case`number`:return(0,h.jsx)(P,{column:t});case`multiselect`:return(0,h.jsx)(I,{column:t});case`date`:return(0,h.jsx)(F,{column:t});default:return(0,h.jsx)(N,{column:t})}}L.displayName=`DataGridListFilter`;function R(t){let{grid:r}=t,{list:a}=r,o=r.componentName,c=r.localeText,l=a.activeFilters.length,u=a.filterableColumns;return u.length===0?null:(0,h.jsx)(T,{grid:r,open:a.sheet===`filter`,onOpen:()=>a.openSheet(`filter`),onClose:()=>a.openSheet(null),title:c.filters,trigger:({ref:t,props:{onClick:r,...i}})=>(0,h.jsxs)(n.default,{type:`button`,component:`${o}.list.toolbar.button`,variant:{active:l>0},...p.t.PILL,ref:t,onClick:r,props:{...i,"aria-label":c.filtersLabel(l)},children:[(0,h.jsx)(A,{}),c.filters,l>0&&(0,h.jsx)(e.default,{tag:`span`,minWidth:5,height:5,px:1.5,borderRadius:999,bgColor:`indigo-600`,color:`white`,fontSize:12,fontWeight:600,lineHeight:20,textAlign:`center`,props:{"aria-hidden":!0},children:l})]}),footer:(0,h.jsxs)(h.Fragment,{children:[l>0&&(0,h.jsx)(n.default,{type:`button`,component:`${o}.list.sheet.button`,...p.t.SHEET_BUTTON,onClick:r.clearColumnFilters,children:c.clearFilters}),(0,h.jsx)(n.default,{type:`button`,component:`${o}.list.sheet.primary`,...p.t.SHEET_BUTTON,flex1:!0,fontWeight:600,onClick:()=>a.openSheet(null),children:c.showRows(r.filterStats.filtered)})]}),children:u.map(e=>(0,h.jsxs)(i.default,{component:`${o}.list.sheet.line`,d:`column`,gap:2,py:3,bb:1,children:[(0,h.jsx)(s.H3,{m:0,fontSize:14,fontWeight:600,children:e.header??String(e.key)}),(0,h.jsx)(L,{column:e})]},e.key))})}R.displayName=`DataGridListFilterSheet`;function z(e){let{grid:t}=e,{list:r}=t,a=t.componentName,o=t.localeText,s=r.sortedColumn,l=t.sortDirection===`DESC`,u=`${t.identifier}-sort`,f={component:`${a}.list.sheet.line`,display:`flex`,ai:`center`,gap:3,minHeight:12,fontSize:16,cursor:`pointer`,bb:1};return(0,h.jsxs)(T,{grid:t,open:r.sheet===`sort`,onClose:()=>r.openSheet(null),title:o.sortBy,onOpen:()=>r.openSheet(`sort`),trigger:({ref:e,props:{onClick:t,...r}})=>(0,h.jsxs)(n.default,{type:`button`,component:`${a}.list.toolbar.button`,variant:{active:!!s},...p.t.PILL,ref:e,onClick:t,props:r,children:[(0,h.jsx)(c.o,{width:`16px`,height:`16px`,fill:`currentColor`,rotate:l?180:0}),s?o.sortedBy(String(s.header??s.key),l):o.sortBy]}),footer:(0,h.jsxs)(h.Fragment,{children:[s&&(0,h.jsx)(n.default,{type:`button`,component:`${a}.list.sheet.button`,...p.t.SHEET_BUTTON,onClick:()=>t.setSortColumn(s.key,void 0),children:o.clearSort}),(0,h.jsx)(n.default,{type:`button`,component:`${a}.list.sheet.primary`,...p.t.SHEET_BUTTON,flex1:!0,fontWeight:600,onClick:()=>r.openSheet(null),children:o.close})]}),children:[(0,h.jsx)(i.default,{tag:`fieldset`,d:`column`,b:0,m:0,p:0,props:{"aria-label":o.sortBy},children:r.sortableColumns.map(e=>(0,h.jsx)(d.default,{name:u,checked:s===e,onChange:()=>t.setSortColumn(e.key,l&&s?`DESC`:`ASC`),label:e.header??String(e.key),labelProps:f},e.key))}),s&&(0,h.jsx)(i.default,{tag:`fieldset`,d:`column`,b:0,m:0,p:0,pt:4,props:{"aria-label":`${o.sortBy}: ${s.header??s.key}`},children:[`ASC`,`DESC`].map(e=>(0,h.jsx)(d.default,{name:`${u}-direction`,checked:t.sortDirection===e,onChange:()=>t.setSortColumn(s.key,e),label:e===`ASC`?o.ascending:o.descending,labelProps:f},e))})]})}z.displayName=`DataGridListSortSheet`;function B({grid:e}){let t=e.componentName,[r,a]=(0,m.useState)(e.globalFilterValue),{debounce:s,cancel:l}=c.s(e.globalFilterValue,e=>e===r,a);return(0,h.jsxs)(i.default,{position:`relative`,ai:`center`,children:[(0,h.jsx)(i.default,{position:`absolute`,insetStart:3.5,pointerEvents:`none`,color:`gray-500`,props:{"aria-hidden":!0},children:(0,h.jsx)(c.r,{fill:`currentColor`,width:`16px`})}),(0,h.jsx)(o.default,{component:`${t}.list.toolbar.search`,width:`fit`,height:11,ps:10,pe:10,b:0,borderRadius:3,fontSize:16,type:`search`,value:r,placeholder:e.localeText.searchPlaceholder,onChange:t=>{let n=t.target.value;a(n),s(`value`,()=>e.filter.setGlobalFilter(n))},props:{"aria-label":e.localeText.searchPlaceholder,enterKeyHint:`search`}}),r&&(0,h.jsx)(n.default,{type:`button`,component:`${t}.list.sheet.button`,display:`inline-flex`,ai:`center`,jc:`center`,width:7,height:7,borderRadius:999,cursor:`pointer`,position:`absolute`,insetEnd:2,onClick:()=>{l(),a(``),e.filter.setGlobalFilter(``)},props:{"aria-label":e.localeText.clearSearch},children:(0,h.jsx)(C,{width:`16px`})})]})}function V(t){let{grid:a}=t,{list:o}=a,{def:s}=a.props,l=a.componentName,u=a.localeText,{filtered:d,total:f}=a.filterStats,m=o.activeFilters,g=o.sortableColumns.length>0;return(0,h.jsxs)(i.default,{component:`${l}.list.toolbar`,d:`column`,gap:3,px:4,pt:4,pb:3,children:[(0,h.jsxs)(i.default,{ai:`center`,gap:3,flexWrap:`wrap`,children:[(0,h.jsxs)(i.default,{d:`column`,flex1:!0,minWidth:0,children:[s.title&&(0,h.jsx)(e.default,{id:a.titleId,fontSize:17,fontWeight:600,lineHeight:24,children:s.title}),(0,h.jsx)(e.default,{component:`${l}.list.toolbar.count`,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:u.rowCount(d,f)})]}),s.topBar&&(0,h.jsxs)(i.default,{ai:`center`,gap:2,flexWrap:`wrap`,children:[(0,h.jsx)(c.n,{grid:a}),(0,h.jsx)(c.t,{grid:a})]})]}),s.globalFilter&&(0,h.jsx)(B,{grid:a}),(0,h.jsxs)(i.default,{gap:2,overflowX:`auto`,scrollbarWidth:`none`,mx:-4,px:4,children:[g&&(0,h.jsx)(z,{grid:a}),(0,h.jsx)(R,{grid:a}),s.rowSelection&&(0,h.jsx)(n.default,{type:`button`,component:`${l}.list.toolbar.button`,...p.t.PILL,variant:{active:o.selecting},onClick:()=>o.setSelecting(!o.selecting),props:{"aria-pressed":o.selecting},children:u.selectRows})]}),m.length>0&&(0,h.jsx)(i.default,{gap:2,overflowX:`auto`,scrollbarWidth:`none`,mx:-4,px:4,children:m.map(t=>(0,h.jsxs)(e.default,{tag:`span`,component:`${l}.list.toolbar.chip`,display:`inline-flex`,ai:`center`,gap:1,flexShrink:0,height:8,ps:3,pe:1,borderRadius:999,fontSize:13,textWrap:`nowrap`,children:[(0,h.jsxs)(e.default,{tag:`span`,fontWeight:500,children:[t.label,`:`]}),(0,h.jsx)(e.default,{tag:`span`,children:t.value}),(0,h.jsx)(n.default,{type:`button`,component:`${l}.list.sheet.button`,display:`inline-flex`,ai:`center`,jc:`center`,width:7,height:7,borderRadius:999,cursor:`pointer`,onClick:()=>t.column.clearFilter(),props:{"aria-label":u.clearFilter(t.label)},children:(0,h.jsx)(C,{width:`14px`})})]},t.column.key))}),s.topBarContent&&(0,h.jsx)(e.default,{children:s.topBarContent}),(0,h.jsx)(r.default,{props:{role:`status`},children:a.hasActiveFilters?u.rowCount(d,f):``})]})}V.displayName=`DataGridListToolbar`;function H(t){let{grid:n}=t,{list:r,source:a}=n,o=n.componentName,s=r.visibleItems,l=n.props.loading||a.isLoading,d=n.groupColumns.size===0&&!n.tree.enabled,f=a.enabled?n.totalRowCount:n.filterStats.filtered,{queryVersion:p}=a;return(0,m.useEffect)(()=>{a.enabled&&a.request(0,Math.max(s.length,1))},[a,p,s.length,n.page,n.pageSize,n.expansionVersion]),(0,h.jsxs)(i.default,{component:`${o}.list`,d:`column`,children:[(0,h.jsx)(V,{grid:n}),(0,h.jsx)(c.i,{grid:n}),l&&(0,h.jsx)(c.a,{grid:n}),s.length===0?(0,h.jsx)(e.default,{component:`list.muted`,px:4,py:10,textAlign:`center`,children:n.props.def.noDataComponent??(l?n.localeText.loadingRows:n.localeText.noRows)}):(0,h.jsx)(u.default,{props:{"aria-labelledby":n.props.def.title?n.titleId:void 0,"aria-busy":l||void 0},children:s.map(({row:e,index:t},r)=>e.kind===`group`?(0,h.jsx)(y,{row:e,version:n.rowVersion(e,t)},e.key):(0,h.jsx)(S,{row:e,index:t,position:d?r+1:void 0,setSize:d?f:void 0,version:n.rowVersion(e,t)},e.key))}),(0,h.jsx)(_,{grid:n,shown:d?s.length:void 0}),(0,h.jsx)(k,{grid:n}),(0,h.jsx)(O,{grid:n})]})}H.displayName=`DataGridList`,exports.default=H;
|