@box-kite/react 2.2.5 → 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 +3 -1
- package/.claude/skills/box-kite/SKILL.md +3 -1
- package/.claude/skills/box-kite/references/components.md +34 -0
- package/.cursor/rules/box-kite.mdc +3 -1
- package/AGENTS.md +3 -1
- package/BOX_AI_CONTEXT.md +95 -5
- package/BOX_KITE_AI_CONTEXT.md +95 -5
- package/box.cjs +1 -1
- package/box.mjs +7 -7
- package/catalog.cjs +1 -1
- package/catalog.mjs +521 -0
- package/client.cjs +1 -1
- package/client.mjs +94 -106
- package/components/calendar.cjs +1 -0
- package/components/calendar.d.ts +77 -0
- package/components/calendar.mjs +483 -0
- 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/contracts/dataGridContract.d.ts +38 -11
- package/components/dataGrid/models/columnModel.d.ts +3 -1
- package/components/dataGrid/models/editModel.d.ts +3 -1
- package/components/dataGrid/models/localeText.d.ts +4 -0
- package/components/dataGrid/useDateParts.d.ts +17 -0
- package/components/dataGrid.cjs +3 -3
- package/components/dataGrid.mjs +797 -664
- 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 +87 -75
- package/components/overlay.cjs +1 -1
- package/components/overlay.mjs +1 -1
- package/components/semantics.d.ts +29 -29
- 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 +1 -1
- package/dataGridDateParts.cjs +1 -0
- package/dataGridDateParts.mjs +223 -0
- package/dataGridList.cjs +1 -1
- package/dataGridList.mjs +328 -365
- 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 +6 -1
- package/package.json +118 -26
- package/react/boxComponent.d.ts +1 -1
- package/react/date/dateChange.d.ts +18 -0
- package/react/date/dateEnvironment.d.ts +34 -0
- package/react-shared.cjs +1 -1
- package/react-shared.mjs +1 -1
- package/ssg.cjs +1 -1
- package/ssg.mjs +1 -1
- 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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../box.cjs"),t=require("../behavior.cjs"),n=require("../dates.cjs"),r=require("../date-environment.cjs"),i=require("./combobox.cjs");let a=require("react"),o=require("react/jsx-runtime");function s(e=n.M(),t=Date.now()){return e.map(e=>{let r=e===`UTC`?0:n.A(e,t),i=e.split(`/`),a=i[i.length-1].replace(/_/g,` `),o=`UTC${r===0?``:n.D(r)}`;return{id:e,city:a,region:i.length>1?i.slice(0,-1).join(`/`).replace(/_/g,` `):``,offset:r,offsetText:o,label:`${a} (${o})`}}).sort((e,t)=>e.offset-t.offset||e.city.localeCompare(t.city))}function c(e,t){let n=t.trim().toLowerCase().replace(/\s+/g,` `);if(!n)return!0;let r=e.offsetText.replace(/:00$/,``).replace(/([+-])0/,`$1`);return`${e.id} ${e.city} ${e.region} ${e.offsetText} ${r} gmt${e.offsetText.slice(3)}`.toLowerCase().replace(/_/g,` `).includes(n)}function l(l){let{value:u,defaultValue:d,onValueChange:f,zones:p,label:m,placeholder:h,name:g,disabled:_,props:v,emptyText:y=`No time zone matches`,...b}=l,x=r.n(),S=(0,a.useMemo)(()=>s(p),[p]),C=(0,a.useMemo)(()=>new Map(S.map(e=>[e.id,e])),[S]),[w,T]=t.i({value:u===void 0?void 0:u&&(n.k(u)??u),defaultValue:d===void 0?x.readerZone:d,onChange:f});return(0,o.jsx)(i.default,{...b,data:S,def:{label:`label`,key:`id`,display:t=>(0,o.jsxs)(e.default,{display:`flex`,jc:`space-between`,gap:4,width:`fit`,children:[(0,o.jsx)(e.default,{tag:`span`,children:t.city}),(0,o.jsxs)(e.default,{tag:`span`,opacity:.7,fontSize:12,css:{fontVariantNumeric:`tabular-nums`},children:[t.region?`${t.region} · `:``,t.offsetText]})]})},value:(w?C.get(w):void 0)??null,onValueChange:(e,t)=>T(e?.id??null,t),filter:(e,t)=>e.filter(e=>c(e,t)),label:m,placeholder:h,name:g,disabled:_,emptyText:y,props:v})}var u=l;u.displayName=`TimeZoneSelect`,exports.default=u;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BoxProps } from '../box';
|
|
2
|
+
import { ChangeHandler } from '../react/a11y/useControllableState';
|
|
3
|
+
import { ZoneOption } from '../utils/date/zoneOptions';
|
|
4
|
+
import { ComboboxValueReason } from './combobox';
|
|
5
|
+
export type { ZoneOption };
|
|
6
|
+
type TimeZoneSelectBoxProps = Omit<BoxProps<'div', 'combobox'>, 'ref' | 'tag' | 'children' | 'defaultValue' | 'onChange' | 'disabled' | 'placeholder' | 'open' | 'props'>;
|
|
7
|
+
export interface TimeZoneSelectProps extends TimeZoneSelectBoxProps {
|
|
8
|
+
/** The chosen IANA zone (`Europe/Chisinau`, `UTC`), or `null`. Controlled. */
|
|
9
|
+
value?: string | null;
|
|
10
|
+
/** The zone it starts with when it owns its state. Default the reader's own. */
|
|
11
|
+
defaultValue?: string | null;
|
|
12
|
+
/** Fires with the zone's IANA name. */
|
|
13
|
+
onValueChange?: ChangeHandler<string | null, ComboboxValueReason>;
|
|
14
|
+
/** Only these zones, in IANA names. Default every zone the runtime knows, UTC first. */
|
|
15
|
+
zones?: readonly string[];
|
|
16
|
+
/** The select's visible name. */
|
|
17
|
+
label?: React.ReactNode;
|
|
18
|
+
/** The field's placeholder. Not a name — it is gone on the first keystroke. */
|
|
19
|
+
placeholder?: string;
|
|
20
|
+
/** What the zone posts under in a form. */
|
|
21
|
+
name?: string;
|
|
22
|
+
/** Not editable and not openable, but still read out. */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Attributes for the `<input>` itself — an `aria-label`, an `id`. */
|
|
25
|
+
props?: Record<string, unknown>;
|
|
26
|
+
/** What the list says when nothing matches. Default `'No time zone matches'`. */
|
|
27
|
+
emptyText?: React.ReactNode;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Picks a time zone by place, region or offset — `chis`, `europe` and `+3` all find Chisinau — out of every zone
|
|
31
|
+
* the runtime knows, each with the offset it is at now.
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* const [zone, setZone] = useState('Europe/Chisinau');
|
|
35
|
+
* <TimeZoneSelect label="Time zone" value={zone} onValueChange={setZone} />
|
|
36
|
+
* <DateField type="datetime" zone={zone} label="Meeting" />
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* It is a `Combobox` over the runtime's own list (`Intl.supportedValuesOf('timeZone')`), so it ships no zone
|
|
40
|
+
* database, and the value is the IANA name every date component and every server takes.
|
|
41
|
+
*
|
|
42
|
+
* @pattern https://www.w3.org/WAI/ARIA/apg/patterns/combobox/
|
|
43
|
+
* @a11y The APG editable combobox: `role="combobox"` on the field, a `role="listbox"` of options, the active one
|
|
44
|
+
* named by `aria-activedescendant`. A thousand-odd options are windowed, so it opens in one frame.
|
|
45
|
+
* @keyboard A printable character — Searches by place, region, IANA name or offset.
|
|
46
|
+
* @keyboard Down / Up — Opens, or moves through what the search left.
|
|
47
|
+
* @keyboard Enter — Chooses the highlighted zone.
|
|
48
|
+
* @keyboard Escape — Closes the list, then clears what was typed.
|
|
49
|
+
*/
|
|
50
|
+
declare function TimeZoneSelectImpl(props: TimeZoneSelectProps): import("react").JSX.Element;
|
|
51
|
+
declare const TimeZoneSelect: typeof TimeZoneSelectImpl;
|
|
52
|
+
export default TimeZoneSelect;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import e from "../box.mjs";
|
|
3
|
+
import { i as t } from "../behavior.mjs";
|
|
4
|
+
import { A as n, D as r, M as i, k as a } from "../dates.mjs";
|
|
5
|
+
import { n as o } from "../date-environment.mjs";
|
|
6
|
+
import s from "./combobox.mjs";
|
|
7
|
+
import { useMemo as c } from "react";
|
|
8
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
9
|
+
//#region src/utils/date/zoneOptions.ts
|
|
10
|
+
function d(e = i(), t = Date.now()) {
|
|
11
|
+
return e.map((e) => {
|
|
12
|
+
let i = e === "UTC" ? 0 : n(e, t), a = e.split("/"), o = a[a.length - 1].replace(/_/g, " "), s = `UTC${i === 0 ? "" : r(i)}`;
|
|
13
|
+
return {
|
|
14
|
+
id: e,
|
|
15
|
+
city: o,
|
|
16
|
+
region: a.length > 1 ? a.slice(0, -1).join("/").replace(/_/g, " ") : "",
|
|
17
|
+
offset: i,
|
|
18
|
+
offsetText: s,
|
|
19
|
+
label: `${o} (${s})`
|
|
20
|
+
};
|
|
21
|
+
}).sort((e, t) => e.offset - t.offset || e.city.localeCompare(t.city));
|
|
22
|
+
}
|
|
23
|
+
function f(e, t) {
|
|
24
|
+
let n = t.trim().toLowerCase().replace(/\s+/g, " ");
|
|
25
|
+
if (!n) return !0;
|
|
26
|
+
let r = e.offsetText.replace(/:00$/, "").replace(/([+-])0/, "$1");
|
|
27
|
+
return `${e.id} ${e.city} ${e.region} ${e.offsetText} ${r} gmt${e.offsetText.slice(3)}`.toLowerCase().replace(/_/g, " ").includes(n);
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/components/timeZoneSelect.tsx
|
|
31
|
+
function p(n) {
|
|
32
|
+
let { value: r, defaultValue: i, onValueChange: p, zones: m, label: h, placeholder: g, name: _, disabled: v, props: y, emptyText: b = "No time zone matches", ...x } = n, S = o(), C = c(() => d(m), [m]), w = c(() => new Map(C.map((e) => [e.id, e])), [C]), [T, E] = t({
|
|
33
|
+
value: r === void 0 ? void 0 : r && (a(r) ?? r),
|
|
34
|
+
defaultValue: i === void 0 ? S.readerZone : i,
|
|
35
|
+
onChange: p
|
|
36
|
+
});
|
|
37
|
+
return /* @__PURE__ */ l(s, {
|
|
38
|
+
...x,
|
|
39
|
+
data: C,
|
|
40
|
+
def: {
|
|
41
|
+
label: "label",
|
|
42
|
+
key: "id",
|
|
43
|
+
display: (t) => /* @__PURE__ */ u(e, {
|
|
44
|
+
display: "flex",
|
|
45
|
+
jc: "space-between",
|
|
46
|
+
gap: 4,
|
|
47
|
+
width: "fit",
|
|
48
|
+
children: [/* @__PURE__ */ l(e, {
|
|
49
|
+
tag: "span",
|
|
50
|
+
children: t.city
|
|
51
|
+
}), /* @__PURE__ */ u(e, {
|
|
52
|
+
tag: "span",
|
|
53
|
+
opacity: .7,
|
|
54
|
+
fontSize: 12,
|
|
55
|
+
css: { fontVariantNumeric: "tabular-nums" },
|
|
56
|
+
children: [t.region ? `${t.region} · ` : "", t.offsetText]
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
},
|
|
60
|
+
value: (T ? w.get(T) : void 0) ?? null,
|
|
61
|
+
onValueChange: (e, t) => E(e?.id ?? null, t),
|
|
62
|
+
filter: (e, t) => e.filter((e) => f(e, t)),
|
|
63
|
+
label: h,
|
|
64
|
+
placeholder: g,
|
|
65
|
+
name: _,
|
|
66
|
+
disabled: v,
|
|
67
|
+
emptyText: b,
|
|
68
|
+
props: y
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
var m = p;
|
|
72
|
+
m.displayName = "TimeZoneSelect";
|
|
73
|
+
//#endregion
|
|
74
|
+
export { m as default };
|
package/components/toaster.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../client.cjs"),t=require("../platform.cjs"),n=require("../effects.cjs"),r=require("../box.cjs"),i=require("../layer.cjs"),a=require("../motion.cjs");let o=require("react"),s=require("react/jsx-runtime"),c=require("react-dom"),l=require("use-sync-external-store/shim");var u={toasts:[],overflow:0},d=0;function f(){return d+=1,`toast-${d}`}function p(e){let t=[],n=u,r=e?.limit??3,i=e?.duration??5e3,a=!1,o=new Set,s=new Map,c=e=>{let t=s.get(e);t?.handle&&clearTimeout(t.handle),s.delete(e)},l=()=>{let e=0;t=t.map(t=>{let n=!t.open||e++<r;return t.visible===n?t:{...t,visible:n}}),n={toasts:t,overflow:Math.max(0,e-r)},d(),o.forEach(e=>e())};function d(){let e=new Set;for(let n of t){if(!n.open||!n.visible||!Number.isFinite(n.duration))continue;e.add(n.id);let t=s.get(n.id)??{handle:null,remaining:n.duration,startedAt:0};s.set(n.id,t),!(a||t.handle)&&(t.startedAt=Date.now(),t.handle=setTimeout(()=>{s.delete(n.id),m(n.id,`timeout`)},t.remaining))}for(let t of[...s.keys()])e.has(t)||c(t)}let p=(e,t)=>t??(e===`loading`?1/0:i);function m(e,n=`imperative`){let r=[];t=t.map(t=>!t.open||e!==void 0&&t.id!==e?t:(r.push(t),c(t.id),{...t,open:!1})),r.length&&(l(),r.forEach(e=>e.onDismiss?.(n)))}function h(e,n,r){let i=!1;t=t.map(t=>{if(t.id!==e)return t;i=!0,c(e);let a=r?.kind??t.kind;return{...t,...r,id:e,message:n,kind:a,duration:r?.duration??(r?.kind?p(a):t.duration),open:!0}}),i&&l()}function g(e,n){let r=n?.id??f();if(n?.id&&t.some(e=>e.id===r))return h(r,e,n),r;let i=n?.kind??`default`;return t=[...t,{id:r,kind:i,message:e,description:n?.description,duration:p(i,n?.duration),action:n?.action,dismissible:n?.dismissible??!0,onDismiss:n?.onDismiss,open:!0,visible:!1}],l(),r}return{subscribe(e){return o.add(e),()=>o.delete(e)},getSnapshot:()=>n,getServerSnapshot:()=>u,add:g,update:h,dismiss:m,remove(e){let n=t.filter(t=>t.id!==e);n.length!==t.length&&(c(e),t=n,l())},setLimit(e){e!==r&&(r=e,l())},setDefaultDuration(e){i=e},pause(){if(!a){a=!0;for(let e of s.values())e.handle&&(clearTimeout(e.handle),e.handle=null,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}},resume(){a&&(a=!1,d())},reset(){for(let e of[...s.keys()])c(e);t=[],n=u,o.forEach(e=>e())}}}var m=p(),h=e=>(t,n)=>m.add(t,{...n,kind:e}),g=Object.assign((e,t)=>m.add(e,t),{success:h(`success`),error:h(`error`),warning:h(`warning`),info:h(`info`),loading:h(`loading`),update:(e,t,n)=>m.update(e,t,n),dismiss:e=>m.dismiss(e,`imperative`),promise(e,t,n){let r=m.add(t.loading,{...n,id:n?.id,kind:`loading`}),i=(e,t)=>typeof e==`function`?e(t):e;return e.then(e=>m.update(r,i(t.success,e),{kind:`success`}),e=>m.update(r,i(t.error,e),{kind:`error`})),e}}),_={"top-start":`topStart`,"top-center":`topCenter`,"top-end":`topEnd`,"bottom-start":`bottomStart`,"bottom-center":`bottomCenter`,"bottom-end":`bottomEnd`};function v(e,t){let n=t.toLowerCase().split(`+`),r=n[n.length-1],i=new Set(n.slice(0,-1));return e.key.toLowerCase()===r&&e.altKey===i.has(`alt`)&&e.ctrlKey===i.has(`ctrl`)&&e.shiftKey===i.has(`shift`)&&e.metaKey===i.has(`meta`)}function y(e){let{toast:t,store:i,fromTop:o,closeLabel:c}=e,{mounted:l,ref:u,props:d}=a.t({present:t.open});if(n.n(()=>{l||i.remove(t.id)},[l,i,t.id]),!l)return null;let f=t.action,p=()=>{f?.onClick(),f?.closeOnClick!==!1&&i.dismiss(t.id,`action`)};return(0,s.jsxs)(r.default,{ref:u,component:`toaster.toast`,variant:{[t.kind]:t.kind!=="default",fromTop:o},props:{...t.kind===`error`?{role:`alert`}:{},"data-toast-id":t.id,...d},children:[(0,s.jsx)(r.default,{component:`toaster.message`,children:t.message}),t.description!==void 0&&(0,s.jsx)(r.default,{component:`toaster.description`,children:t.description}),f&&(0,s.jsx)(r.default,{tag:`button`,component:`toaster.action`,props:{type:`button`,onClick:p},children:f.label}),t.dismissible&&(0,s.jsx)(r.default,{tag:`button`,component:`toaster.close`,props:{type:`button`,"aria-label":c,onClick:()=>i.dismiss(t.id,`close`)}})]})}function b(a){let{position:u=`bottom-end`,limit:d=3,duration:f=5e3,label:p=`Notifications`,closeLabel:h=`Close`,overflowLabel:g=e=>`+${e} more`,hotkey:b=`F6`,store:x=m,props:S,...C}=a,w=(0,l.useSyncExternalStore)(x.subscribe,x.getSnapshot,x.getServerSnapshot),T=i.n(),E=e.
|
|
1
|
+
"use client";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require("../client.cjs"),t=require("../platform.cjs"),n=require("../effects.cjs"),r=require("../box.cjs"),i=require("../layer.cjs"),a=require("../motion.cjs");let o=require("react"),s=require("react/jsx-runtime"),c=require("react-dom"),l=require("use-sync-external-store/shim");var u={toasts:[],overflow:0},d=0;function f(){return d+=1,`toast-${d}`}function p(e){let t=[],n=u,r=e?.limit??3,i=e?.duration??5e3,a=!1,o=new Set,s=new Map,c=e=>{let t=s.get(e);t?.handle&&clearTimeout(t.handle),s.delete(e)},l=()=>{let e=0;t=t.map(t=>{let n=!t.open||e++<r;return t.visible===n?t:{...t,visible:n}}),n={toasts:t,overflow:Math.max(0,e-r)},d(),o.forEach(e=>e())};function d(){let e=new Set;for(let n of t){if(!n.open||!n.visible||!Number.isFinite(n.duration))continue;e.add(n.id);let t=s.get(n.id)??{handle:null,remaining:n.duration,startedAt:0};s.set(n.id,t),!(a||t.handle)&&(t.startedAt=Date.now(),t.handle=setTimeout(()=>{s.delete(n.id),m(n.id,`timeout`)},t.remaining))}for(let t of[...s.keys()])e.has(t)||c(t)}let p=(e,t)=>t??(e===`loading`?1/0:i);function m(e,n=`imperative`){let r=[];t=t.map(t=>!t.open||e!==void 0&&t.id!==e?t:(r.push(t),c(t.id),{...t,open:!1})),r.length&&(l(),r.forEach(e=>e.onDismiss?.(n)))}function h(e,n,r){let i=!1;t=t.map(t=>{if(t.id!==e)return t;i=!0,c(e);let a=r?.kind??t.kind;return{...t,...r,id:e,message:n,kind:a,duration:r?.duration??(r?.kind?p(a):t.duration),open:!0}}),i&&l()}function g(e,n){let r=n?.id??f();if(n?.id&&t.some(e=>e.id===r))return h(r,e,n),r;let i=n?.kind??`default`;return t=[...t,{id:r,kind:i,message:e,description:n?.description,duration:p(i,n?.duration),action:n?.action,dismissible:n?.dismissible??!0,onDismiss:n?.onDismiss,open:!0,visible:!1}],l(),r}return{subscribe(e){return o.add(e),()=>o.delete(e)},getSnapshot:()=>n,getServerSnapshot:()=>u,add:g,update:h,dismiss:m,remove(e){let n=t.filter(t=>t.id!==e);n.length!==t.length&&(c(e),t=n,l())},setLimit(e){e!==r&&(r=e,l())},setDefaultDuration(e){i=e},pause(){if(!a){a=!0;for(let e of s.values())e.handle&&(clearTimeout(e.handle),e.handle=null,e.remaining=Math.max(0,e.remaining-(Date.now()-e.startedAt)))}},resume(){a&&(a=!1,d())},reset(){for(let e of[...s.keys()])c(e);t=[],n=u,o.forEach(e=>e())}}}var m=p(),h=e=>(t,n)=>m.add(t,{...n,kind:e}),g=Object.assign((e,t)=>m.add(e,t),{success:h(`success`),error:h(`error`),warning:h(`warning`),info:h(`info`),loading:h(`loading`),update:(e,t,n)=>m.update(e,t,n),dismiss:e=>m.dismiss(e,`imperative`),promise(e,t,n){let r=m.add(t.loading,{...n,id:n?.id,kind:`loading`}),i=(e,t)=>typeof e==`function`?e(t):e;return e.then(e=>m.update(r,i(t.success,e),{kind:`success`}),e=>m.update(r,i(t.error,e),{kind:`error`})),e}}),_={"top-start":`topStart`,"top-center":`topCenter`,"top-end":`topEnd`,"bottom-start":`bottomStart`,"bottom-center":`bottomCenter`,"bottom-end":`bottomEnd`};function v(e,t){let n=t.toLowerCase().split(`+`),r=n[n.length-1],i=new Set(n.slice(0,-1));return e.key.toLowerCase()===r&&e.altKey===i.has(`alt`)&&e.ctrlKey===i.has(`ctrl`)&&e.shiftKey===i.has(`shift`)&&e.metaKey===i.has(`meta`)}function y(e){let{toast:t,store:i,fromTop:o,closeLabel:c}=e,{mounted:l,ref:u,props:d}=a.t({present:t.open});if(n.n(()=>{l||i.remove(t.id)},[l,i,t.id]),!l)return null;let f=t.action,p=()=>{f?.onClick(),f?.closeOnClick!==!1&&i.dismiss(t.id,`action`)};return(0,s.jsxs)(r.default,{ref:u,component:`toaster.toast`,variant:{[t.kind]:t.kind!=="default",fromTop:o},props:{...t.kind===`error`?{role:`alert`}:{},"data-toast-id":t.id,...d},children:[(0,s.jsx)(r.default,{component:`toaster.message`,children:t.message}),t.description!==void 0&&(0,s.jsx)(r.default,{component:`toaster.description`,children:t.description}),f&&(0,s.jsx)(r.default,{tag:`button`,component:`toaster.action`,props:{type:`button`,onClick:p},children:f.label}),t.dismissible&&(0,s.jsx)(r.default,{tag:`button`,component:`toaster.close`,props:{type:`button`,"aria-label":c,onClick:()=>i.dismiss(t.id,`close`)}})]})}function b(a){let{position:u=`bottom-end`,limit:d=3,duration:f=5e3,label:p=`Notifications`,closeLabel:h=`Close`,overflowLabel:g=e=>`+${e} more`,hotkey:b=`F6`,store:x=m,props:S,...C}=a,w=(0,l.useSyncExternalStore)(x.subscribe,x.getSnapshot,x.getServerSnapshot),T=i.n(),E=e.t(!T),D=(0,o.useRef)(null),O=(0,o.useRef)(null),k=(0,o.useRef)({hovered:!1,focused:!1,hidden:!1}),A=(0,o.useCallback)(()=>{let{hovered:e,focused:t,hidden:n}=k.current;e||t||n?x.pause():x.resume()},[x]);n.n(()=>x.setLimit(d),[x,d]),n.n(()=>x.setDefaultDuration(f),[x,f]),n.n(()=>{let e=D.current;!T||!t.o()||!e||!e.isConnected||e.matches(`:popover-open`)||e.showPopover()}),n.n(()=>{let e=t.t();if(!e)return;let n=new AbortController;return e.addEventListener(`visibilitychange`,()=>{k.current.hidden=e.hidden,A()},{signal:n.signal}),()=>n.abort()},[A]),n.n(()=>{let e=t.t();if(!b||!e)return;let n=new AbortController;return e.addEventListener(`keydown`,t=>{!v(t,b)||!D.current||(t.preventDefault(),O.current=e.activeElement,D.current.focus())},{signal:n.signal}),()=>n.abort()},[b]);let j=e=>!!e&&!!D.current?.contains(e),M=()=>{k.current.hovered=!0,A()},N=e=>{j(e.relatedTarget)||(k.current.hovered=!1,A())},P=e=>{k.current.focused=!0,A(),j(e.relatedTarget)||(O.current=e.relatedTarget)},F=e=>{j(e.relatedTarget)||(k.current.focused=!1,A())},I=e=>{if(e.key!==`Escape`)return;let t=(e.target.closest?.(`[data-toast-id]`))?.getAttribute(`data-toast-id`);t&&x.dismiss(t,`close`),x.getSnapshot().toasts.some(e=>e.open)?D.current?.focus():O.current?.focus()},L=u.startsWith(`top`),R=w.toasts.filter(e=>e.visible),z=L?[...R].reverse():R,B=w.overflow>0&&(0,s.jsx)(r.default,{component:`toaster.overflow`,children:g(w.overflow)}),V=(0,s.jsxs)(r.default,{tag:`section`,ref:D,component:`toaster`,...C,variant:[C.variant,{[_[u]]:!0}],props:{...T?{popover:`manual`}:{},"aria-live":`polite`,"aria-atomic":`false`,"aria-relevant":`additions text`,"aria-label":p,tabIndex:-1,...S,onPointerOver:M,onPointerOut:N,onFocus:P,onBlur:F,onKeyDown:I},children:[!L&&B,z.map(e=>(0,s.jsx)(y,{toast:e,store:x,fromTop:L,closeLabel:h},e.id)),L&&B]});return T?V:E?(0,c.createPortal)(V,E):null}var x=b;x.displayName=`Toaster`,exports.createToastStore=p,exports.default=x,exports.defaultToastStore=m,exports.toast=g;
|
package/components/toaster.mjs
CHANGED
|
@@ -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
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./box.cjs"),t=require("./components/svg.cjs"),n=require("./components/button.cjs"),r=require("./components/flex.cjs"),i=require("./components/checkbox.cjs"),a=require("./components/visuallyHidden.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");let p=require("react"),m=require("react/jsx-runtime");function h(e){let{cell:t}=e,{AggregateCell:n}=t.column;return n?(0,m.jsx)(n,{cell:t}):(0,m.jsx)(m.Fragment,{children:t.value??`—`})}h.displayName=`DataGridListAggregate`;var g;(function(e){e.ICON_BUTTON={display:`inline-flex`,ai:`center`,jc:`center`,width:11,height:11,flexShrink:0,borderRadius:999,cursor:`pointer`},e.PILL={display:`inline-flex`,ai:`center`,gap:1.5,flexShrink:0,height:10,px:3.5,borderRadius:999,fontSize:14,fontWeight:500,textWrap:`nowrap`,cursor:`pointer`},e.TRUNCATE={textOverflow:`ellipsis`,overflow:`hidden`,textWrap:`nowrap`},e.INPUT={width:`fit`,height:11,px:3,borderRadius:2,fontSize:16},e.LABEL={fontSize:12,lineHeight:16},e.SHEET_BUTTON={height:12,px:4,borderRadius:3,fontSize:16,fontWeight:500,cursor:`pointer`}})(g||={});var _=g;function v(t){let{grid:i,shown:a}=t,{list:o,pagination:s,aggregation:l}=i,u=i.componentName,d=i.localeText,f=s.state,p=l.hasFooter?l.footerCells.value.filter(e=>e.column.aggregate):[];return(0,m.jsxs)(m.Fragment,{children:[p.length>0&&(0,m.jsxs)(e.default,{bgColor:`currentColor/3`,px:4,py:3,children:[(0,m.jsx)(e.default,{fontWeight:600,fontSize:14,mb:1,children:l.footerLabel}),(0,m.jsx)(e.default,{tag:`dl`,display:`grid`,gridTemplateColumns:2,columnGap:4,rowGap:2,m:0,children:p.map(t=>(0,m.jsxs)(e.default,{minWidth:0,children:[(0,m.jsx)(e.default,{tag:`dt`,component:`list.muted`,fontSize:12,lineHeight:16,children:t.column.header??String(t.column.key)}),(0,m.jsx)(e.default,{tag:`dd`,m:0,fontSize:14,lineHeight:20,fontWeight:600,children:(0,m.jsx)(h,{cell:t})})]},t.column.key))})]}),f?(0,m.jsx)(r.default,{component:`list.muted`,d:`column`,gap:2,ai:`center`,px:4,py:4,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:(0,m.jsxs)(r.default,{ai:`center`,jc:`space-between`,gap:3,width:`fit`,children:[(0,m.jsx)(n.default,{type:`button`,component:`${u}.list.button`,..._.ICON_BUTTON,borderRadius:3,disabled:!s.canGoPrev,onClick:s.prevPage,props:{"aria-label":d.previousPage},children:(0,m.jsx)(c.u,{width:`18px`,height:`18px`,rotate:90,rtl:{rotate:-90}})}),(0,m.jsx)(e.default,{textAlign:`center`,children:d.pageRowRange(s.startItem,s.endItem,s.totalItems)}),(0,m.jsx)(n.default,{type:`button`,component:`${u}.list.button`,..._.ICON_BUTTON,borderRadius:3,disabled:!s.canGoNext,onClick:s.nextPage,props:{"aria-label":d.nextPage},children:(0,m.jsx)(c.u,{width:`18px`,height:`18px`,rotate:-90,rtl:{rotate:90}})})]})}):(o.hasMore||a!==void 0)&&(0,m.jsxs)(r.default,{component:`list.muted`,d:`column`,gap:2,ai:`center`,px:4,py:4,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:[o.hasMore&&(0,m.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,m.jsx)(e.default,{children:d.shownCount(a,i.source.enabled?i.totalRowCount:i.filterStats.filtered)})]})]})}v.displayName=`DataGridListFooter`;function y(e){let{row:t}=e,{grid:n}=t,r=t.cells.flatMap(e=>e.aggregate?[e.aggregate]:[]),a=t.placeholder?``:String(t.groupValue);return(0,m.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,m.jsx)(u.default.Actions,{children:(0,m.jsx)(i.default,{variant:`datagrid`,checked:t.selected,indeterminate:t.indeterminate,onChange:t.toggleSelectAll,props:{"aria-label":n.localeText.selectGroupRows(a)}})}),(0,m.jsx)(c.u,{width:`16px`,height:`16px`,flexShrink:0,rotate:t.expanded?0:-90,rtl:{rotate:t.expanded?0:90}}),(0,m.jsxs)(u.default.Content,{children:[(0,m.jsx)(u.default.Title,{lines:1,fontSize:14,fontWeight:600,children:(0,m.jsx)(u.default.Action,{onClick:()=>t.toggleRow(),props:{"aria-expanded":t.expanded},children:a})}),r.length>0&&(0,m.jsx)(u.default.Row,{secondary:!0,wrap:!0,columnGap:4,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:r.map(e=>(0,m.jsxs)(s.Span,{display:`inline-flex`,gap:1,children:[(0,m.jsx)(s.Span,{children:e.column.header??String(e.column.key)}),(0,m.jsx)(s.Span,{fontWeight:600,children:(0,m.jsx)(h,{cell:e})})]},e.column.key))})]}),(0,m.jsx)(u.default.Meta,{px:2,borderRadius:999,fontSize:12,fontWeight:600,lineHeight:20,bgColor:`currentColor/10`,alignSelf:`center`,children:t.count})]})}y.displayName=`DataGridListGroup`;var b=(0,p.memo)(y);function x(e){let{row:t,column:n}=e,r=t.cells.find(e=>e.column===n);if(!r)return null;if(n.Cell)return(0,m.jsx)(n.Cell,{cell:r});let{value:i}=r;return(0,m.jsx)(m.Fragment,{children:i==null||i===``?`—`:String(i)})}x.displayName=`DataGridListValue`;function S(t){let{row:r,index:a,position:o,setSize:l}=t,{grid:d}=r,{list:p}=d,{title:h,kicker:g,subtitle:v,end:y,fields:b}=p.layout.value,{selecting:S}=p,C=p.recordViewEnabled&&!r.placeholder,w=c.d(r)?r:void 0,T=d.props.def.rowDetail,E=d.localeText,D={"aria-posinset":o,"aria-setsize":l};if(r.placeholder)return(0,m.jsx)(u.default.Item,{props:{...D,"aria-busy":!0},children:(0,m.jsx)(f.default,{lines:2,flex1:!0})});let O=h?(0,m.jsx)(x,{row:r,column:h}):E.unnamedRow(r.rowIndex+1),k=h?String(r.cells.find(e=>e.column===h)?.value??``):``,A=p.checkboxId(r.key);return(0,m.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,m.jsx)(u.default.Actions,{width:6,jc:`center`,alignSelf:`center`,children:(0,m.jsx)(i.default,{id:A,variant:`datagrid`,checked:r.selected,indeterminate:r.indeterminate,onChange:r.toggleSelection})}),(0,m.jsxs)(u.default.Content,{children:[g&&(0,m.jsx)(u.default.Overline,{lines:1,children:(0,m.jsx)(x,{row:r,column:g})}),(0,m.jsxs)(u.default.Row,{ai:`start`,gap:3,children:[(0,m.jsxs)(u.default.Row,{jc:`start`,ai:`center`,gap:1,flex1:!0,children:[w?.hasChildren&&(0,m.jsx)(u.default.Actions,{ms:-2,children:(0,m.jsx)(n.default,{type:`button`,component:`${d.componentName}.list.toggle`,..._.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,m.jsx)(c.u,{width:`16px`,height:`16px`,rotate:w.treeExpanded?0:-90,rtl:{rotate:w.treeExpanded?0:90}})})}),(0,m.jsx)(u.default.Title,{lines:1,flex1:!0,fontWeight:600,children:S?(0,m.jsx)(u.default.Action,{props:{htmlFor:A},children:O}):C?(0,m.jsx)(u.default.Action,{props:{"aria-haspopup":`dialog`},onClick:()=>p.openRecord(r,a),children:O}):O})]}),y&&(0,m.jsxs)(u.default.End,{fontSize:16,fontWeight:600,lineHeight:22,..._.TRUNCATE,children:[(0,m.jsx)(x,{row:r,column:y}),(0,m.jsx)(u.default.Meta,{fontWeight:400,..._.LABEL,children:y.header??String(y.key)})]})]}),v.length>0&&(0,m.jsx)(u.default.Description,{lines:1,children:v.map((e,t)=>(0,m.jsxs)(s.Span,{children:[t>0&&` · `,(0,m.jsx)(x,{row:r,column:e})]},e.key))}),b.length>0&&(0,m.jsx)(u.default.Fields,{mt:2,css:{gridTemplateColumns:`repeat(2, minmax(0, 1fr))`},children:b.map(t=>(0,m.jsx)(u.default.Field,{label:t.header??String(t.key),children:(0,m.jsx)(e.default,{..._.TRUNCATE,children:(0,m.jsx)(x,{row:r,column:t})})},t.key))}),T&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(u.default.Actions,{alignSelf:`start`,mt:1,ms:-2,children:(0,m.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,m.jsx)(c.u,{width:`14px`,height:`14px`,rotate:r.expanded?0:-90,rtl:{rotate:r.expanded?0:90}}),E.details]})}),r.expanded&&(0,m.jsx)(u.default.Actions,{display:`block`,mt:2,children:(0,m.jsx)(e.default,{component:`${d.componentName}.list.detail`,p:3,borderRadius:2,fontSize:14,children:T.content(r.data)})})]})]})]})}S.displayName=`DataGridListItem`;var C=(0,p.memo)(S);function w(e){return(0,m.jsx)(t.Svg,{viewBox:`0 0 24 24`,width:`1.25rem`,fill:`none`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,m.jsx)(t.Path,{d:`M6 6l12 12M18 6L6 18`,strokeLinecap:`round`})})}var T=80;function E(t){let{grid:i,open:a,onOpen:o,onClose:s,title:c,trigger:u,actions:d,footer:f,tall:h,bodyProps:g,bodyRef:v,onKeyDown:y,children:b}=t,x=i.componentName,S=`${x}.list.sheet.line`,C=(0,p.useRef)(null),E=(0,p.useCallback)(e=>{let t=e.currentTarget.closest(`dialog`);e.button!==0||!t||e.target.closest(`button`)||(C.current={id:e.pointerId,y:e.clientY,dy:0,dialog:t},e.currentTarget.setPointerCapture(e.pointerId))},[]),D=(0,p.useCallback)(e=>{let t=C.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,p.useCallback)(()=>{let e=C.current;if(C.current=null,!e)return;let{dialog:t}=e;t.style.transition=``,t.style.translate=``,e.dy>T&&s()},[s]);return(0,m.jsxs)(l.default,{component:`${x}.list.sheet`,display:`flex`,d:`column`,css:h?{minHeight:`min(32rem, calc(100dvh - 2rem))`}:void 0,open:a,onOpenChange:e=>e?o?.():s(),trigger:u,props:{onKeyDown:y},children:[(0,m.jsxs)(r.default,{d:`column`,flexShrink:0,css:{touchAction:`none`},props:{onPointerDown:E,onPointerMove:D,onPointerUp:O,onPointerCancel:O},children:[(0,m.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,m.jsxs)(r.default,{component:`${S}`,ai:`center`,gap:2,ps:4,pe:2,py:2,bb:1,children:[(0,m.jsx)(l.default.Title,{flex1:!0,minWidth:0,m:0,fontSize:17,fontWeight:600,lineHeight:24,..._.TRUNCATE,children:c}),d,(0,m.jsx)(n.default,{type:`button`,component:`${x}.list.sheet.button`,..._.ICON_BUTTON,onClick:s,props:{"aria-label":i.localeText.close},children:(0,m.jsx)(w,{})})]})]}),(0,m.jsx)(e.default,{ref:v,flex1:!0,overflowY:`auto`,px:4,py:2,css:{overscrollBehavior:`contain`,touchAction:`pan-y`},props:g,children:b}),f&&(0,m.jsx)(r.default,{component:S,gap:3,flexShrink:0,px:4,pt:3,pb:4,bt:1,children:f})]})}E.displayName=`DataGridListSheet`;var D=60;function O({cell:t,index:i}){let{grid:a,column:o}=t,s=a.componentName,l=String(o.header??o.key),{editing:u}=t,d=(0,p.useRef)(null),f=(0,p.useRef)(!1);return(0,p.useEffect)(()=>{f.current&&!u&&d.current?.focus(),f.current=u},[u]),(0,m.jsxs)(e.default,{component:`${s}.list.sheet.line`,py:3,bb:1,children:[(0,m.jsx)(e.default,{tag:`dt`,component:`list.muted`,fontSize:13,lineHeight:18,children:l}),(0,m.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,m.jsx)(r.default,{component:`${s}.list.sheet.input`,..._.INPUT,flex1:!0,ai:`center`,px:1,children:(0,m.jsx)(c.l,{cell:t,row:-1,columnIndex:i})}):(0,m.jsx)(e.default,{flex1:!0,minWidth:0,children:(0,m.jsx)(x,{row:t.row,column:o})}),t.editable&&!u&&(0,m.jsx)(n.default,{ref:d,type:`button`,component:`${s}.list.sheet.button`,..._.SHEET_BUTTON,height:10,onClick:()=>t.beginEdit(),props:{"aria-label":a.localeText.editCell(l)},children:a.localeText.edit})]})]})}function k(t){let{grid:a}=t,{list:o}=a,l=a.componentName,u=a.localeText,d=o.record,f=o.recordPosition,{title:h}=o.layout.value,g=(0,p.useRef)(null),v=(0,p.useRef)(null),y=d?.key;(0,p.useEffect)(()=>{v.current?.scrollTo?.({top:0})},[y]);let b=(0,p.useCallback)(()=>{let e=o.record?.key;a.edits.cancel(),o.closeRecord(),requestAnimationFrame(()=>{let t=a.sizingElement?.querySelectorAll(`[data-list-key]`)??[];Array.from(t).find(t=>t.dataset.listKey===String(e))?.querySelector(`[data-list-action]`)?.focus()})},[a,o]),S=(0,p.useCallback)(e=>{a.edits.isOpen&&a.edits.commit(),a.edits.isOpen||o.stepRecord(e)},[a,o]),C=e=>{g.current=e.pointerType===`touch`?{x:e.clientX,y:e.clientY}:null},w=e=>{let t=g.current;if(g.current=null,!t)return;let n=e.clientX-t.x,r=e.clientY-t.y;Math.abs(n)<D||Math.abs(n)<Math.abs(r)*1.5||S(n<0===a.isRtl?-1:1)},T=e=>{if(e.target.closest(`input,select,textarea,[role="combobox"]`))return;let t=a.isRtl?`ArrowLeft`:`ArrowRight`,n=a.isRtl?`ArrowRight`:`ArrowLeft`;(e.key===t||e.key===n)&&(e.preventDefault(),S(e.key===t?1:-1))},k=d&&f&&(0,m.jsxs)(r.default,{ai:`center`,gap:.5,flexShrink:0,children:[(0,m.jsx)(n.default,{type:`button`,component:`${l}.list.sheet.button`,..._.ICON_BUTTON,disabled:!o.hasPreviousRecord,onClick:()=>S(-1),props:{"aria-label":u.previousRow},children:(0,m.jsx)(c.u,{width:`18px`,height:`18px`,rotate:90,rtl:{rotate:-90}})}),(0,m.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,m.jsx)(n.default,{type:`button`,component:`${l}.list.sheet.button`,..._.ICON_BUTTON,disabled:!o.hasNextRecord,onClick:()=>S(1),props:{"aria-label":u.nextRow},children:(0,m.jsx)(c.u,{width:`18px`,height:`18px`,rotate:-90,rtl:{rotate:90}})})]}),A=a.props.def.rowDetail;return(0,m.jsx)(E,{grid:a,open:!!d,onClose:b,tall:!0,title:d&&h?(0,m.jsx)(x,{row:d,column:h}):``,actions:k,onKeyDown:T,bodyRef:v,bodyProps:{onPointerDown:C,onPointerUp:w},children:d&&(0,m.jsxs)(m.Fragment,{children:[a.props.def.rowSelection&&(0,m.jsx)(e.default,{py:3,children:(0,m.jsx)(i.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,m.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,m.jsx)(O,{cell:d.cells[t],index:t},e.key)})}),A&&(0,m.jsxs)(r.default,{d:`column`,gap:2,py:3,children:[(0,m.jsx)(s.H3,{m:0,fontSize:14,fontWeight:600,children:u.details}),A.content(d.data)]})]})})}k.displayName=`DataGridListRecord`;function A(t){let{grid:i}=t,a=i.componentName,o=i.localeText,s=i.selectedRows.size;return!i.props.def.rowSelection||s===0?null:(0,m.jsxs)(r.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,m.jsx)(e.default,{flex1:!0,minWidth:0,textWrap:`nowrap`,css:{fontVariantNumeric:`tabular-nums`},children:o.selectedRows(s)}),!i.allRowsSelected&&(0,m.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:i.toggleSelectAllRows,children:o.selectAll}),(0,m.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:i.clearSelection,children:o.clearSelection})]})}A.displayName=`DataGridListSelectionBar`;function j(e){return(0,m.jsx)(t.Svg,{viewBox:`0 0 24 24`,width:`1rem`,fill:`none`,stroke:`currentColor`,strokeWidth:2,...e,children:(0,m.jsx)(t.Path,{d:`M4 6h16M7 12h10M10 18h4`,strokeLinecap:`round`})})}var M=8,N=[{value:`eq`,label:`=`},{value:`ne`,label:`≠`},{value:`gt`,label:`>`},{value:`gte`,label:`≥`},{value:`lt`,label:`<`},{value:`lte`,label:`≤`},{value:`between`,label:`↔`}];function P({column:e}){let{currentFilter:t}=e,n=e.grid.componentName,r=e.grid.localeText,[i,a]=(0,p.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,m.jsx)(o.default,{component:`${n}.list.sheet.input`,..._.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 F({column:t}){let{currentFilter:n}=t,i=t.grid.componentName,a=t.grid.localeText,s=String(t.header??t.key),l=t.filterConfig,[u,d]=(0,p.useState)(()=>c.c.numberDraft(n)),f=(0,p.useRef)(u),h=(0,p.useCallback)(e=>{f.current=e,d(e)},[]),{debounce:g,cancel:v}=c.s(n,e=>c.c.numberMatches(u,e),e=>h(c.c.numberDraft(e))),y=(e,n)=>{h({...f.current,...e});let r=()=>t.setNumberFilter(f.current.operator,f.current.value,f.current.valueTo);n?g(`value`,r):(v(),r())},b=(e,t,n,r)=>(0,m.jsx)(o.default,{component:`${i}.list.sheet.input`,..._.INPUT,type:`number`,value:e,step:l?.step,placeholder:n,onChange:e=>y({[r]:e.target.value},!0),props:{"aria-label":t,inputMode:`decimal`,min:l?.min,max:l?.max}});return(0,m.jsxs)(r.default,{gap:2,ai:`center`,children:[(0,m.jsx)(e.default,{tag:`select`,component:`${i}.list.sheet.input`,..._.INPUT,width:18,flexShrink:0,props:{value:u.operator,"aria-label":a.filterComparison(s),onChange:e=>y({operator:e.target.value},!1)},children:N.map(e=>(0,m.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 I({column:e}){let{currentFilter:t}=e,a=e.grid.componentName,s=e.grid.localeText,c=t?.type===`multiselect`?t.values:[],l=e.filterOptions,[u,d]=(0,p.useState)(``),f=t=>{e.setMultiselectFilter(c.includes(t)?c.filter(e=>e!==t):[...c,t])};if(l.length<=M)return(0,m.jsx)(r.default,{flexWrap:`wrap`,gap:2,children:l.map(e=>(0,m.jsx)(n.default,{type:`button`,component:`${a}.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 h=u.trim().toLocaleLowerCase(),g=h?l.filter(e=>e.label.toLocaleLowerCase().includes(h)):l;return(0,m.jsxs)(r.default,{d:`column`,gap:2,children:[(0,m.jsx)(o.default,{component:`${a}.list.sheet.input`,..._.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,m.jsx)(r.default,{d:`column`,maxHeight:64,overflowY:`auto`,children:g.map(e=>(0,m.jsx)(i.default,{checked:c.includes(e.value),onChange:()=>f(e.value),label:e.label,labelProps:{component:`${a}.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,m.jsx)(F,{column:t});case`multiselect`:return(0,m.jsx)(I,{column:t});default:return(0,m.jsx)(P,{column:t})}}L.displayName=`DataGridListFilter`;function R(t){let{grid:i}=t,{list:a}=i,o=i.componentName,c=i.localeText,l=a.activeFilters.length,u=a.filterableColumns;return u.length===0?null:(0,m.jsx)(E,{grid:i,open:a.sheet===`filter`,onOpen:()=>a.openSheet(`filter`),onClose:()=>a.openSheet(null),title:c.filters,trigger:({ref:t,props:{onClick:r,...i}})=>(0,m.jsxs)(n.default,{type:`button`,component:`${o}.list.toolbar.button`,variant:{active:l>0},..._.PILL,ref:t,onClick:r,props:{...i,"aria-label":c.filtersLabel(l)},children:[(0,m.jsx)(j,{}),c.filters,l>0&&(0,m.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,m.jsxs)(m.Fragment,{children:[l>0&&(0,m.jsx)(n.default,{type:`button`,component:`${o}.list.sheet.button`,..._.SHEET_BUTTON,onClick:i.clearColumnFilters,children:c.clearFilters}),(0,m.jsx)(n.default,{type:`button`,component:`${o}.list.sheet.primary`,..._.SHEET_BUTTON,flex1:!0,fontWeight:600,onClick:()=>a.openSheet(null),children:c.showRows(i.filterStats.filtered)})]}),children:u.map(e=>(0,m.jsxs)(r.default,{component:`${o}.list.sheet.line`,d:`column`,gap:2,py:3,bb:1,children:[(0,m.jsx)(s.H3,{m:0,fontSize:14,fontWeight:600,children:e.header??String(e.key)}),(0,m.jsx)(L,{column:e})]},e.key))})}R.displayName=`DataGridListFilterSheet`;function z(e){let{grid:t}=e,{list:i}=t,a=t.componentName,o=t.localeText,s=i.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,m.jsxs)(E,{grid:t,open:i.sheet===`sort`,onClose:()=>i.openSheet(null),title:o.sortBy,onOpen:()=>i.openSheet(`sort`),trigger:({ref:e,props:{onClick:t,...r}})=>(0,m.jsxs)(n.default,{type:`button`,component:`${a}.list.toolbar.button`,variant:{active:!!s},..._.PILL,ref:e,onClick:t,props:r,children:[(0,m.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,m.jsxs)(m.Fragment,{children:[s&&(0,m.jsx)(n.default,{type:`button`,component:`${a}.list.sheet.button`,..._.SHEET_BUTTON,onClick:()=>t.setSortColumn(s.key,void 0),children:o.clearSort}),(0,m.jsx)(n.default,{type:`button`,component:`${a}.list.sheet.primary`,..._.SHEET_BUTTON,flex1:!0,fontWeight:600,onClick:()=>i.openSheet(null),children:o.close})]}),children:[(0,m.jsx)(r.default,{tag:`fieldset`,d:`column`,b:0,m:0,p:0,props:{"aria-label":o.sortBy},children:i.sortableColumns.map(e=>(0,m.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,m.jsx)(r.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,m.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,[i,a]=(0,p.useState)(e.globalFilterValue),{debounce:s,cancel:l}=c.s(e.globalFilterValue,e=>e===i,a);return(0,m.jsxs)(r.default,{position:`relative`,ai:`center`,children:[(0,m.jsx)(r.default,{position:`absolute`,insetStart:3.5,pointerEvents:`none`,color:`gray-500`,props:{"aria-hidden":!0},children:(0,m.jsx)(c.r,{fill:`currentColor`,width:`16px`})}),(0,m.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:i,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`}}),i&&(0,m.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,m.jsx)(w,{width:`16px`})})]})}function V(t){let{grid:i}=t,{list:o}=i,{def:s}=i.props,l=i.componentName,u=i.localeText,{filtered:d,total:f}=i.filterStats,p=o.activeFilters,h=o.sortableColumns.length>0;return(0,m.jsxs)(r.default,{component:`${l}.list.toolbar`,d:`column`,gap:3,px:4,pt:4,pb:3,children:[(0,m.jsxs)(r.default,{ai:`center`,gap:3,flexWrap:`wrap`,children:[(0,m.jsxs)(r.default,{d:`column`,flex1:!0,minWidth:0,children:[s.title&&(0,m.jsx)(e.default,{id:i.titleId,fontSize:17,fontWeight:600,lineHeight:24,children:s.title}),(0,m.jsx)(e.default,{component:`${l}.list.toolbar.count`,fontSize:13,css:{fontVariantNumeric:`tabular-nums`},children:u.rowCount(d,f)})]}),s.topBar&&(0,m.jsxs)(r.default,{ai:`center`,gap:2,flexWrap:`wrap`,children:[(0,m.jsx)(c.n,{grid:i}),(0,m.jsx)(c.t,{grid:i})]})]}),s.globalFilter&&(0,m.jsx)(B,{grid:i}),(0,m.jsxs)(r.default,{gap:2,overflowX:`auto`,scrollbarWidth:`none`,mx:-4,px:4,children:[h&&(0,m.jsx)(z,{grid:i}),(0,m.jsx)(R,{grid:i}),s.rowSelection&&(0,m.jsx)(n.default,{type:`button`,component:`${l}.list.toolbar.button`,..._.PILL,variant:{active:o.selecting},onClick:()=>o.setSelecting(!o.selecting),props:{"aria-pressed":o.selecting},children:u.selectRows})]}),p.length>0&&(0,m.jsx)(r.default,{gap:2,overflowX:`auto`,scrollbarWidth:`none`,mx:-4,px:4,children:p.map(t=>(0,m.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,m.jsxs)(e.default,{tag:`span`,fontWeight:500,children:[t.label,`:`]}),(0,m.jsx)(e.default,{tag:`span`,children:t.value}),(0,m.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,m.jsx)(w,{width:`14px`})})]},t.column.key))}),s.topBarContent&&(0,m.jsx)(e.default,{children:s.topBarContent}),(0,m.jsx)(a.default,{props:{role:`status`},children:i.hasActiveFilters?u.rowCount(d,f):``})]})}V.displayName=`DataGridListToolbar`;function H(t){let{grid:n}=t,{list:i,source:a}=n,o=n.componentName,s=i.visibleItems,l=n.props.loading||a.isLoading,d=n.groupColumns.size===0&&!n.tree.enabled,f=a.enabled?n.totalRowCount:n.filterStats.filtered,{queryVersion:h}=a;return(0,p.useEffect)(()=>{a.enabled&&a.request(0,Math.max(s.length,1))},[a,h,s.length,n.page,n.pageSize,n.expansionVersion]),(0,m.jsxs)(r.default,{component:`${o}.list`,d:`column`,children:[(0,m.jsx)(V,{grid:n}),(0,m.jsx)(c.i,{grid:n}),l&&(0,m.jsx)(c.a,{grid:n}),s.length===0?(0,m.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,m.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,m.jsx)(b,{row:e,version:n.rowVersion(e,t)},e.key):(0,m.jsx)(C,{row:e,index:t,position:d?r+1:void 0,setSize:d?f:void 0,version:n.rowVersion(e,t)},e.key))}),(0,m.jsx)(v,{grid:n,shown:d?s.length:void 0}),(0,m.jsx)(A,{grid:n}),(0,m.jsx)(k,{grid:n})]})}H.displayName=`DataGridList`,exports.default=H;
|
|
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;
|