@bfrs/agentic-components 0.9.1 → 0.9.2

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.
@@ -1,79 +1,80 @@
1
- import { jsxs as m, jsx as i } from "react/jsx-runtime";
2
- import { ArrowsDownUp as He } from "../../../node_modules/@phosphor-icons/react/dist/csr/ArrowsDownUp.es.js";
3
- import { CaretDown as Ne } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretDown.es.js";
4
- import { CaretUp as Ee } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretUp.es.js";
5
- import { useRef as Ue, useState as D, useMemo as M, useEffect as Mt, useCallback as $e, useLayoutEffect as je } from "react";
6
- import c from "@emotion/styled";
7
- import { clsx as Ve } from "../../../node_modules/clsx/dist/clsx.js";
8
- import { twRing as ee } from "../../../lib/emotionTw.js";
9
- import { TableEmptyStateContent as Ke } from "./TableEmptyState.js";
10
- import { TableErrorState as Ye } from "./TableErrorState.js";
11
- import { TablePagination as qe } from "./TablePagination.js";
12
- import { TableSkeleton as Ge } from "./TableSkeleton.js";
13
- const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146, Qe = 3, Re = {
1
+ import { jsxs as x, jsx as i } from "react/jsx-runtime";
2
+ import { ArrowsDownUp as Oe } from "../../../node_modules/@phosphor-icons/react/dist/csr/ArrowsDownUp.es.js";
3
+ import { CaretDown as Ce } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretDown.es.js";
4
+ import { CaretUp as tr } from "../../../node_modules/@phosphor-icons/react/dist/csr/CaretUp.es.js";
5
+ import { useRef as se, useState as S, useMemo as L, useEffect as Et, useCallback as er, useLayoutEffect as rr } from "react";
6
+ import l from "@emotion/styled";
7
+ import { clsx as or } from "../../../node_modules/clsx/dist/clsx.js";
8
+ import { twRing as we } from "../../../lib/emotionTw.js";
9
+ import { useMediaQuery as ar, phoneMediaQuery as ir } from "../../../lib/useMediaQuery.js";
10
+ import { TableEmptyStateContent as nr } from "./TableEmptyState.js";
11
+ import { TableErrorState as sr } from "./TableErrorState.js";
12
+ import { TablePagination as cr } from "./TablePagination.js";
13
+ import { TableSkeleton as lr } from "./TableSkeleton.js";
14
+ const ce = typeof window > "u" ? Et : rr, It = 144, Lt = 220, A = 44, le = 146, dr = 3, pr = 1 / 3, hr = {
14
15
  height: "38px",
15
16
  paddingLeft: "1.25rem",
16
17
  paddingRight: "1.25rem",
17
18
  paddingTop: "7px",
18
19
  paddingBottom: "7px"
19
- }, Xe = {
20
+ }, br = {
20
21
  height: "4rem",
21
22
  paddingLeft: "1.25rem",
22
23
  paddingRight: "1.25rem",
23
24
  paddingTop: "1rem",
24
25
  paddingBottom: "1rem"
25
- }, At = {
26
+ }, zt = {
26
27
  fontSize: "12px",
27
28
  fontWeight: 700,
28
29
  letterSpacing: ".24px",
29
30
  "--tw-text-opacity": "1",
30
31
  // `states.tableHeaderText` when set, otherwise the original text-primary.
31
32
  color: "hsl(var(--bfrs-color-table-header-text, var(--bfrs-color-text-primary)) / var(--tw-text-opacity, 1))"
32
- }, re = {
33
+ }, ve = {
33
34
  "--tw-shadow": "3px 0 8px rgba(0,0,0,.05)",
34
35
  "--tw-shadow-colored": "3px 0 8px var(--tw-shadow-color)",
35
36
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)"
36
- }, Ze = {
37
+ }, fr = {
37
38
  "--tw-shadow": "0px 2px 6px rgba(0,0,0,.08)",
38
39
  "--tw-shadow-colored": "0px 2px 6px var(--tw-shadow-color)",
39
40
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)"
40
- }, _e = {
41
+ }, wr = {
41
42
  "--tw-shadow": "-3px 0 4px rgba(0,0,0,.04)",
42
43
  "--tw-shadow-colored": "-3px 0 4px var(--tw-shadow-color)",
43
44
  boxShadow: "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)"
44
- }, oe = {
45
+ }, ye = {
45
46
  "--tw-bg-opacity": "1",
46
47
  backgroundColor: "hsl(var(--bfrs-color-table-header) / var(--tw-bg-opacity, 1))"
47
- }, Xt = {
48
+ }, de = {
48
49
  "--tw-bg-opacity": "1",
49
50
  backgroundColor: "hsl(var(--bfrs-color-row-hover) / var(--tw-bg-opacity, 1))"
50
- }, tt = {
51
+ }, at = {
51
52
  "--tw-bg-opacity": "1",
52
53
  backgroundColor: "hsl(var(--bfrs-color-row-selected) / var(--tw-bg-opacity, 1))"
53
- }, Oe = {
54
+ }, vr = {
54
55
  position: "var(--bfrs-row-hover-position, static)",
55
56
  zIndex: 15,
56
57
  boxShadow: "var(--bfrs-shadow-row-hover, 0 0 #0000)"
57
- }, Z = "hsl(var(--bfrs-color-row-selected-border, 0 0% 0% / 0))", Ce = "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)", tr = (t) => ({
58
+ }, tt = "hsl(var(--bfrs-color-row-selected-border, 0 0% 0% / 0))", yr = "var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)", gr = (e) => ({
58
59
  "--bfrs-row-border-left": "0 0 #0000",
59
60
  "--bfrs-row-border-right": "0 0 #0000",
60
- "&:first-of-type": { "--bfrs-row-border-left": `inset 1px 0 0 ${Z}` },
61
- "&:last-of-type": { "--bfrs-row-border-right": `inset -1px 0 0 ${Z}` },
61
+ "&:first-of-type": { "--bfrs-row-border-left": `inset 1px 0 0 ${tt}` },
62
+ "&:last-of-type": { "--bfrs-row-border-right": `inset -1px 0 0 ${tt}` },
62
63
  boxShadow: [
63
- `inset 0 1px 0 ${Z}`,
64
- `inset 0 -1px 0 ${Z}`,
64
+ `inset 0 1px 0 ${tt}`,
65
+ `inset 0 -1px 0 ${tt}`,
65
66
  "var(--bfrs-row-border-left)",
66
67
  "var(--bfrs-row-border-right)",
67
- t
68
+ e
68
69
  ].filter(Boolean).join(",")
69
- }), er = /* @__PURE__ */ c("div", {
70
+ }), ur = /* @__PURE__ */ l("div", {
70
71
  label: "AgenticDataTable-root",
71
- shouldForwardProp: (t) => t !== "ownerState"
72
- })(({ ownerState: t }) => ({
72
+ shouldForwardProp: (e) => e !== "ownerState"
73
+ })(({ ownerState: e }) => ({
73
74
  display: "flex",
74
75
  minWidth: "0px",
75
76
  minHeight: "0px",
76
- flex: t.fill ? "1 1 auto" : "var(--bfrs-data-table-flex, 0 1 auto)",
77
+ flex: e.fill ? "1 1 auto" : "var(--bfrs-data-table-flex, 0 1 auto)",
77
78
  flexDirection: "column",
78
79
  overflow: "hidden",
79
80
  borderRadius: "var(--bfrs-radius-md)",
@@ -82,13 +83,13 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
82
83
  borderColor: "hsl(var(--bfrs-color-border-strong) / var(--tw-border-opacity, 1))",
83
84
  "--tw-bg-opacity": "1",
84
85
  backgroundColor: "hsl(var(--bfrs-color-surface-card) / var(--tw-bg-opacity, 1))"
85
- })), rr = /* @__PURE__ */ c("div", {
86
+ })), xr = /* @__PURE__ */ l("div", {
86
87
  label: "AgenticDataTable-scroller"
87
88
  })({
88
89
  minHeight: "0px",
89
90
  flex: "1 1 auto",
90
91
  overflow: "auto"
91
- }), or = /* @__PURE__ */ c("div", {
92
+ }), Sr = /* @__PURE__ */ l("div", {
92
93
  label: "AgenticDataTable-stateViewport"
93
94
  })({
94
95
  position: "sticky",
@@ -96,7 +97,7 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
96
97
  width: "100%",
97
98
  minWidth: "0px",
98
99
  boxSizing: "border-box"
99
- }), ar = /* @__PURE__ */ c("table", {
100
+ }), kr = /* @__PURE__ */ l("table", {
100
101
  label: "AgenticDataTable-table"
101
102
  })({
102
103
  width: "100%",
@@ -105,83 +106,83 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
105
106
  "--tw-border-spacing-y": "0px",
106
107
  borderSpacing: "var(--tw-border-spacing-x) var(--tw-border-spacing-y)",
107
108
  textAlign: "left"
108
- }), ir = /* @__PURE__ */ c("thead", {
109
+ }), mr = /* @__PURE__ */ l("thead", {
109
110
  label: "AgenticDataTable-head",
110
- shouldForwardProp: (t) => t !== "ownerState"
111
- })(({ ownerState: t }) => [
112
- t.sticky && {
111
+ shouldForwardProp: (e) => e !== "ownerState"
112
+ })(({ ownerState: e }) => [
113
+ e.sticky && {
113
114
  position: "sticky",
114
115
  top: 0,
115
116
  zIndex: 30
116
117
  }
117
- ]), sr = /* @__PURE__ */ c("tr", {
118
+ ]), Dr = /* @__PURE__ */ l("tr", {
118
119
  label: "AgenticDataTable-headerRow"
119
- })(oe), nr = {
120
+ })(ye), Tr = {
120
121
  // Positioning context so the pin button can float without reserving header width.
121
122
  position: "relative",
122
123
  borderBottomWidth: "1px",
123
124
  "--tw-border-opacity": "1",
124
125
  borderColor: "hsl(var(--bfrs-color-border-strong) / var(--tw-border-opacity, 1))",
125
- ...oe
126
- }, _ = /* @__PURE__ */ c("th", {
126
+ ...ye
127
+ }, et = /* @__PURE__ */ l("th", {
127
128
  label: "AgenticDataTable-headerCell",
128
- shouldForwardProp: (t) => t !== "ownerState"
129
- })(({ ownerState: t }) => [
130
- nr,
131
- t.kind === "selection" && {
129
+ shouldForwardProp: (e) => e !== "ownerState"
130
+ })(({ ownerState: e }) => [
131
+ Tr,
132
+ e.kind === "selection" && {
132
133
  textAlign: "center",
133
134
  "--tw-text-opacity": "1",
134
135
  color: "hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))"
135
136
  },
136
- t.kind === "leading" && {
137
+ e.kind === "leading" && {
137
138
  verticalAlign: "middle",
138
- ...At,
139
+ ...zt,
139
140
  "&:hover button[title]": { opacity: 1 }
140
141
  },
141
- t.kind === "data" && {
142
+ e.kind === "data" && {
142
143
  borderLeftWidth: "2px",
143
144
  borderLeftColor: "transparent",
144
- ...At,
145
+ ...zt,
145
146
  "&:hover button[title]": { opacity: 1 }
146
147
  },
147
- t.kind === "actions" && At,
148
- Re,
149
- t.sortable && {
148
+ e.kind === "actions" && zt,
149
+ hr,
150
+ e.sortable && {
150
151
  "&:hover": {
151
152
  "--tw-text-opacity": "1",
152
153
  color: "hsl(var(--bfrs-color-primary) / var(--tw-text-opacity, 1))"
153
154
  }
154
155
  },
155
- t.sorted && {
156
+ e.sorted && {
156
157
  "--tw-text-opacity": "1",
157
158
  color: "hsl(var(--bfrs-color-primary) / var(--tw-text-opacity, 1))"
158
159
  },
159
- t.reorderable && {
160
+ e.reorderable && {
160
161
  cursor: "grab",
161
162
  WebkitUserSelect: "none",
162
163
  MozUserSelect: "none",
163
164
  userSelect: "none",
164
165
  "&:active": { cursor: "grabbing" }
165
166
  },
166
- t.dropTarget && {
167
+ e.dropTarget && {
167
168
  "--tw-border-opacity": "1",
168
169
  borderLeftColor: "hsl(var(--bfrs-color-primary) / var(--tw-border-opacity, 1))"
169
170
  },
170
- t.edgeShadow && re,
171
- t.actionsShadow && Ze
172
- ]), Zt = /* @__PURE__ */ c("span", {
171
+ e.edgeShadow && ve,
172
+ e.actionsShadow && fr
173
+ ]), pe = /* @__PURE__ */ l("span", {
173
174
  label: "AgenticDataTable-headerContent",
174
- shouldForwardProp: (t) => t !== "ownerState"
175
- })(({ ownerState: t }) => [
175
+ shouldForwardProp: (e) => e !== "ownerState"
176
+ })(({ ownerState: e }) => [
176
177
  {
177
178
  display: "inline-flex",
178
179
  maxWidth: "100%",
179
180
  alignItems: "center",
180
- gap: t.wide ? ".5rem" : ".375rem"
181
+ gap: e.wide ? ".5rem" : ".375rem"
181
182
  },
182
- t.align === "right" && { justifyContent: "flex-end" },
183
- t.align === "center" && { justifyContent: "center" }
184
- ]), lr = /* @__PURE__ */ c("button", {
183
+ e.align === "right" && { justifyContent: "flex-end" },
184
+ e.align === "center" && { justifyContent: "center" }
185
+ ]), Wr = /* @__PURE__ */ l("button", {
185
186
  label: "AgenticDataTable-sortButton"
186
187
  })({
187
188
  display: "inline-flex",
@@ -192,26 +193,26 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
192
193
  outline: "2px solid transparent",
193
194
  outlineOffset: "2px",
194
195
  "&:focus-visible": {
195
- ...ee("2px", "hsl(var(--bfrs-color-border-focus) / var(--tw-ring-opacity, 1))"),
196
+ ...we("2px", "hsl(var(--bfrs-color-border-focus) / var(--tw-ring-opacity, 1))"),
196
197
  "--tw-ring-opacity": "1"
197
198
  }
198
- }), Bt = /* @__PURE__ */ c("span", {
199
+ }), Ft = /* @__PURE__ */ l("span", {
199
200
  label: "AgenticDataTable-truncate",
200
- shouldForwardProp: (t) => t !== "ownerState"
201
- })(({ ownerState: t }) => ({
201
+ shouldForwardProp: (e) => e !== "ownerState"
202
+ })(({ ownerState: e }) => ({
202
203
  minWidth: "0px",
203
- overflow: t.overflow === "visible" ? "visible" : "hidden",
204
- textOverflow: t.overflow === "visible" ? "clip" : "ellipsis",
204
+ overflow: e.overflow === "visible" ? "visible" : "hidden",
205
+ textOverflow: e.overflow === "visible" ? "clip" : "ellipsis",
205
206
  whiteSpace: "nowrap"
206
- })), cr = /* @__PURE__ */ c(He, {
207
+ })), Ar = /* @__PURE__ */ l(Oe, {
207
208
  label: "AgenticDataTable-sortIdleIcon"
208
209
  })({
209
210
  "--tw-text-opacity": "1",
210
211
  color: "hsl(var(--bfrs-color-text-disabled) / var(--tw-text-opacity, 1))"
211
- }), _t = /* @__PURE__ */ c("button", {
212
+ }), he = /* @__PURE__ */ l("button", {
212
213
  label: "AgenticDataTable-pinButton",
213
- shouldForwardProp: (t) => t !== "ownerState"
214
- })(({ ownerState: t }) => [
214
+ shouldForwardProp: (e) => e !== "ownerState"
215
+ })(({ ownerState: e }) => [
215
216
  {
216
217
  // Floated (not a flex item) so the header label keeps its full width; the pin
217
218
  // overlays the cell edge on hover instead of shortening the text box and
@@ -241,13 +242,13 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
241
242
  opacity: 1,
242
243
  outline: "2px solid transparent",
243
244
  outlineOffset: "2px",
244
- ...ee("2px", "hsl(var(--bfrs-color-border-focus) / var(--tw-ring-opacity, 1))"),
245
+ ...we("2px", "hsl(var(--bfrs-color-border-focus) / var(--tw-ring-opacity, 1))"),
245
246
  "--tw-ring-opacity": "1"
246
247
  }
247
248
  },
248
249
  // Anchor to the far edge of the header cell (opposite the text flush side).
249
- t.side === "right" ? { right: "1.25rem" } : { left: "1.25rem" },
250
- t.pinned ? {
250
+ e.side === "right" ? { right: "1.25rem" } : { left: "1.25rem" },
251
+ e.pinned ? {
251
252
  "--tw-bg-opacity": "1",
252
253
  backgroundColor: "hsl(var(--bfrs-color-success-soft) / var(--tw-bg-opacity, 1))",
253
254
  "--tw-text-opacity": "1",
@@ -262,28 +263,28 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
262
263
  color: "hsl(var(--bfrs-color-text-primary) / var(--tw-text-opacity, 1))"
263
264
  }
264
265
  }
265
- ]), dr = /* @__PURE__ */ c("tr", {
266
+ ]), Pr = /* @__PURE__ */ l("tr", {
266
267
  label: "AgenticDataTable-row",
267
- shouldForwardProp: (t) => t !== "ownerState"
268
- })(({ ownerState: t }) => [
268
+ shouldForwardProp: (e) => e !== "ownerState"
269
+ })(({ ownerState: e }) => [
269
270
  {
270
271
  "--tw-bg-opacity": "1",
271
272
  backgroundColor: "hsl(var(--bfrs-color-surface-card) / var(--tw-bg-opacity, 1))",
272
273
  transitionProperty: "color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter",
273
274
  transitionTimingFunction: "cubic-bezier(.4,0,.2,1)",
274
275
  transitionDuration: ".15s",
275
- "&:hover": { ...Xt, ...Oe },
276
- "&:hover > td": Xt
276
+ "&:hover": { ...de, ...vr },
277
+ "&:hover > td": de
277
278
  },
278
279
  // Selection wins over hover (as in Select), so a distinct rowSelectedBg
279
280
  // stays visible while the pointer is over a selected row. Only the
280
281
  // background is overridden, so a selected row keeps the hover shadow.
281
- t.selected && { ...tt, "&:hover": tt, "&:hover > td": tt },
282
- t.clickable && { cursor: "pointer" }
283
- ]), O = /* @__PURE__ */ c("td", {
282
+ e.selected && { ...at, "&:hover": at, "&:hover > td": at },
283
+ e.clickable && { cursor: "pointer" }
284
+ ]), rt = /* @__PURE__ */ l("td", {
284
285
  label: "AgenticDataTable-cell",
285
- shouldForwardProp: (t) => t !== "ownerState"
286
- })(({ ownerState: t }) => [
286
+ shouldForwardProp: (e) => e !== "ownerState"
287
+ })(({ ownerState: e }) => [
287
288
  {
288
289
  borderBottomWidth: "1px",
289
290
  "--tw-border-opacity": "1",
@@ -294,7 +295,7 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
294
295
  // data cells top-align — see the `data` branch below.
295
296
  verticalAlign: "middle"
296
297
  },
297
- t.kind === "data" && {
298
+ e.kind === "data" && {
298
299
  // Content starts at the first line rather than floating in the middle, so a
299
300
  // row made tall by one wrapping cell keeps every other cell readable across
300
301
  // the row instead of scattering values at different heights.
@@ -302,20 +303,20 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
302
303
  "--tw-text-opacity": "1",
303
304
  color: "hsl(var(--bfrs-color-text-secondary) / var(--tw-text-opacity, 1))"
304
305
  },
305
- Xe,
306
- t.selected && tt,
307
- t.kind === "data" && { fontSize: "12px" },
308
- t.cellTextSize === "compact" && {
306
+ br,
307
+ e.selected && at,
308
+ e.kind === "data" && { fontSize: "12px" },
309
+ e.cellTextSize === "compact" && {
309
310
  fontSize: "12px",
310
311
  "& *": {
311
312
  fontSize: "inherit"
312
313
  }
313
314
  },
314
- t.edgeShadow && re,
315
- t.actionsShadow && _e,
315
+ e.edgeShadow && ve,
316
+ e.actionsShadow && wr,
316
317
  // Last, so its box-shadow wins; it re-adds the edge shadow set just above.
317
- t.selected && tr(t.edgeShadow || t.actionsShadow ? Ce : void 0)
318
- ]), C = /* @__PURE__ */ c("input", {
318
+ e.selected && gr(e.edgeShadow || e.actionsShadow ? yr : void 0)
319
+ ]), ot = /* @__PURE__ */ l("input", {
319
320
  label: "AgenticDataTable-checkbox"
320
321
  })({
321
322
  width: ".75rem",
@@ -323,409 +324,417 @@ const Qt = typeof window > "u" ? Mt : je, Rt = 144, Wt = 220, B = 44, Je = 146,
323
324
  flexShrink: 0,
324
325
  cursor: "pointer",
325
326
  accentColor: "hsl(var(--bfrs-color-primary) / 1)"
326
- }), Ot = /* @__PURE__ */ c("div", {
327
+ }), be = /* @__PURE__ */ l("div", {
327
328
  label: "AgenticDataTable-checkboxCenter"
328
329
  })({
329
330
  display: "flex",
330
331
  alignItems: "center",
331
332
  justifyContent: "center"
332
- }), pr = /* @__PURE__ */ c("div", {
333
+ }), Br = /* @__PURE__ */ l("div", {
333
334
  label: "AgenticDataTable-leadingLayout"
334
335
  })({
335
336
  display: "flex",
336
337
  alignItems: "center",
337
338
  gap: ".75rem"
338
- }), hr = /* @__PURE__ */ c("div", {
339
+ }), Mr = /* @__PURE__ */ l("div", {
339
340
  label: "AgenticDataTable-leadingContent"
340
341
  })({
341
342
  minWidth: "0px",
342
343
  flex: "1 1 0%"
343
344
  });
344
- function ae(t, o) {
345
- if (o.accessorFn) return o.accessorFn(t);
346
- if (o.accessorKey) return t[o.accessorKey];
345
+ function ge(e, o) {
346
+ if (o.accessorFn) return o.accessorFn(e);
347
+ if (o.accessorKey) return e[o.accessorKey];
347
348
  }
348
- function Ct(t, o) {
349
- return o.sortValue ? o.sortValue(t) : ae(t, o);
349
+ function fe(e, o) {
350
+ return o.sortValue ? o.sortValue(e) : ge(e, o);
350
351
  }
351
- function br(t, o) {
352
- return typeof t == "number" && typeof o == "number" ? t - o : String(t ?? "").localeCompare(String(o ?? ""), void 0, { numeric: !0, sensitivity: "base" });
352
+ function Ir(e, o) {
353
+ return typeof e == "number" && typeof o == "number" ? e - o : String(e ?? "").localeCompare(String(o ?? ""), void 0, { numeric: !0, sensitivity: "base" });
353
354
  }
354
- function te(t, o) {
355
- if (typeof t == "number") return t;
356
- if (typeof t == "string" && t.endsWith("px")) {
357
- const p = Number.parseFloat(t);
355
+ function Ht(e, o) {
356
+ if (typeof e == "number") return e;
357
+ if (typeof e == "string" && e.endsWith("px")) {
358
+ const p = Number.parseFloat(e);
358
359
  return Number.isFinite(p) ? p : o;
359
360
  }
360
361
  return o;
361
362
  }
362
- function It(t, o) {
363
- const p = t.filter((w) => o.includes(w)), h = o.filter((w) => !p.includes(w));
363
+ function Nt(e, o) {
364
+ const p = e.filter((y) => o.includes(y)), h = o.filter((y) => !p.includes(y));
364
365
  return [...p, ...h];
365
366
  }
366
- function fr(t, o, p) {
367
- const h = [...t], w = h.indexOf(o), z = h.indexOf(p);
368
- return w === -1 || z === -1 || w === z ? t : (h.splice(w, 1), h.splice(z, 0, o), h);
367
+ function Lr(e, o, p) {
368
+ const h = [...e], y = h.indexOf(o), z = h.indexOf(p);
369
+ return y === -1 || z === -1 || y === z ? e : (h.splice(y, 1), h.splice(z, 0, o), h);
369
370
  }
370
- function wr(t) {
371
- return Math.round(t * 100) / 100;
371
+ function zr(e) {
372
+ return Math.round(e * 100) / 100;
372
373
  }
373
- function Pt(t, o) {
374
- return t && t > 0 ? t : o;
374
+ function Y(e, o) {
375
+ return e && e > 0 ? e : o;
375
376
  }
376
- function vr(t, o) {
377
- return !t || t.columns.length !== o.columns.length || Math.abs(t.selection - o.selection) > 0.5 || Math.abs(t.leading - o.leading) > 0.5 || Math.abs(t.rowActions - o.rowActions) > 0.5 ? !1 : t.columns.every((p, h) => Math.abs(p - o.columns[h]) <= 0.5);
377
+ function Fr(e, o) {
378
+ return !e || e.columns.length !== o.columns.length || Math.abs(e.selection - o.selection) > 0.5 || Math.abs(e.leading - o.leading) > 0.5 || Math.abs(e.rowActions - o.rowActions) > 0.5 ? !1 : e.columns.every((p, h) => Math.abs(p - o.columns[h]) <= 0.5);
378
379
  }
379
- function Pr({
380
- data: t,
380
+ function Xr({
381
+ data: e,
381
382
  columns: o,
382
383
  getRowId: p,
383
384
  loading: h,
384
- error: w,
385
+ error: y,
385
386
  emptyState: z,
386
387
  // Default no-data view is a two-line message (title + description). Consumers
387
388
  // can override either line, or replace the whole thing via `emptyState`.
388
- emptyTitle: ie = "No records found",
389
- emptyDescription: se = "There's nothing to show here yet.",
390
- pagination: zt,
391
- enableSorting: et = !0,
389
+ emptyTitle: ue = "No records found",
390
+ emptyDescription: xe = "There's nothing to show here yet.",
391
+ pagination: Ut,
392
+ enableSorting: it = !0,
392
393
  sorting: F,
393
- defaultSorting: rt = null,
394
- onSortingChange: ot,
395
- visibleColumnIds: at,
394
+ defaultSorting: nt = null,
395
+ onSortingChange: st,
396
+ visibleColumnIds: ct,
396
397
  columnOrder: k,
397
- defaultColumnOrder: it,
398
- onColumnOrderChange: st,
399
- enableColumnPinning: K = !0,
400
- pinnedColumnCount: L,
401
- defaultPinnedColumnCount: nt = 0,
402
- onPinnedColumnCountChange: lt,
403
- pinLeadingColumn: H,
404
- defaultPinLeadingColumn: ct = !1,
405
- onPinLeadingColumnChange: dt,
406
- enableColumnReordering: N = !0,
407
- resetKey: Ft,
408
- showSortIcon: Lt = "always",
398
+ defaultColumnOrder: lt,
399
+ onColumnOrderChange: dt,
400
+ enableColumnPinning: q = !0,
401
+ pinnedColumnCount: H,
402
+ defaultPinnedColumnCount: pt = 0,
403
+ onPinnedColumnCountChange: ht,
404
+ pinLeadingColumn: N,
405
+ defaultPinLeadingColumn: bt = !1,
406
+ onPinLeadingColumnChange: ft,
407
+ enableColumnReordering: E = !0,
408
+ resetKey: $t,
409
+ showSortIcon: jt = "always",
409
410
  leadingColumn: s,
410
- rowActions: T,
411
- rowActionsHeader: ne = "Actions",
412
- rowActionsWidth: Y = Je,
413
- stickyRowActions: q = !!T,
411
+ rowActions: m,
412
+ rowActionsHeader: Se = "Actions",
413
+ rowActionsWidth: U = le,
414
+ stickyRowActions: Vt = !!m,
415
+ pinnedMaxShare: ke = pr,
416
+ pinOnMobile: me = !1,
414
417
  selection: G,
415
- selectedRowIds: E = [],
418
+ selectedRowIds: $ = [],
416
419
  onSelectedRowIdsChange: J,
417
- stickyHeader: pt = !0,
418
- fill: le = !1,
419
- headerTextOverflow: ht = "truncate",
420
- cellTextSize: Q = "default",
421
- minWidth: ce = "100%",
422
- maxHeight: Ht,
423
- className: de,
424
- scrollerClassName: pe,
425
- tableClassName: he,
426
- headerClassName: be,
427
- rowClassName: bt,
428
- cellClassName: ft,
429
- onRowClick: R,
430
- "aria-label": fe = "Data table"
420
+ stickyHeader: wt = !0,
421
+ fill: De = !1,
422
+ headerTextOverflow: vt = "truncate",
423
+ cellTextSize: X = "default",
424
+ minWidth: Te = "100%",
425
+ maxHeight: Rt,
426
+ className: We,
427
+ scrollerClassName: Ae,
428
+ tableClassName: Pe,
429
+ headerClassName: Be,
430
+ rowClassName: yt,
431
+ cellClassName: gt,
432
+ onRowClick: Z,
433
+ "aria-label": Me = "Data table"
431
434
  }) {
432
- const wt = Ue(null), [we, Nt] = D(rt), [vt, yt] = D(() => it ?? o.map((e) => e.id)), [ve, Et] = D(nt), [ye, Ut] = D(ct), [X, U] = D(null), [ge, $] = D(null), [ue, $t] = D(null), [v, xe] = D(null), b = et ? F === void 0 ? we : F : null, W = M(() => o.map((e) => e.id), [o]), jt = M(() => new Map(o.map((e) => [e.id, e])), [o]);
433
- Mt(() => {
434
- k === void 0 && yt((e) => It(e, W));
435
- }, [W, k]), Mt(() => {
436
- Ft !== void 0 && (F === void 0 && Nt(rt), k === void 0 && yt(It(it ?? W, W)), L === void 0 && Et(nt), H === void 0 && Ut(ct), U(null), $(null));
435
+ const ut = se(null), Qt = se(null), [Kt, Ie] = S(0), [Le, Yt] = S(nt), [xt, St] = S(() => lt ?? o.map((t) => t.id)), [ze, qt] = S(pt), [Fe, Gt] = S(bt), [_, j] = S(null), [He, V] = S(null), [Ne, Jt] = S(null), [b, Ee] = S(null), f = it ? F === void 0 ? Le : F : null, W = L(() => o.map((t) => t.id), [o]), Xt = L(() => new Map(o.map((t) => [t.id, t])), [o]);
436
+ Et(() => {
437
+ k === void 0 && St((t) => Nt(t, W));
438
+ }, [W, k]), Et(() => {
439
+ $t !== void 0 && (F === void 0 && Yt(nt), k === void 0 && St(Nt(lt ?? W, W)), H === void 0 && qt(pt), N === void 0 && Gt(bt), j(null), V(null));
437
440
  }, [
438
441
  W,
439
442
  k,
440
- it,
443
+ lt,
444
+ pt,
445
+ bt,
441
446
  nt,
442
- ct,
443
- rt,
447
+ N,
444
448
  H,
445
- L,
446
- Ft,
449
+ $t,
447
450
  F
448
451
  ]);
449
- const gt = M(() => It(k ?? vt, W).map((r) => jt.get(r)).filter((r) => !!r), [jt, W, k, vt]), f = M(() => {
450
- if (!at) return gt;
451
- const e = new Set(at);
452
- return gt.filter((r) => e.has(r.id));
453
- }, [gt, at]), Se = M(
454
- () => f.map((e) => te(e.width ?? e.minWidth, Rt)),
455
- [f]
456
- ), u = K ? Math.min(
457
- f.length,
458
- Math.max(0, L === void 0 ? ve : L)
459
- ) : 0, x = !!s && ((K && s ? H === void 0 ? ye : H : !1) || u > 0), Vt = x && u === 0, I = !!(G && !s), A = I && u > 0, me = te((s == null ? void 0 : s.width) ?? (s == null ? void 0 : s.minWidth), Wt), ut = (v == null ? void 0 : v.columns.length) === f.length ? v.columns : void 0, ke = Pt(v == null ? void 0 : v.selection, B), De = Pt(v == null ? void 0 : v.leading, me), Te = (A ? ke : 0) + (x ? De : 0), Kt = f.length + (I ? 1 : 0) + (s ? 1 : 0) + (T ? 1 : 0), xt = (e, r) => (p == null ? void 0 : p(e, r)) ?? String(e.id ?? r), St = $e(() => {
460
- var S, y;
461
- const e = (y = (S = wt.current) == null ? void 0 : S.tHead) == null ? void 0 : y.rows[0];
462
- if (!e) return;
463
- const r = Array.from(e.cells);
464
- let n = 0;
452
+ const kt = L(() => Nt(k ?? xt, W).map((r) => Xt.get(r)).filter((r) => !!r), [Xt, W, k, xt]), v = L(() => {
453
+ if (!ct) return kt;
454
+ const t = new Set(ct);
455
+ return kt.filter((r) => t.has(r.id));
456
+ }, [kt, ct]), Zt = L(
457
+ () => v.map((t) => Ht(t.width ?? t.minWidth, It)),
458
+ [v]
459
+ ), g = q ? Math.min(
460
+ v.length,
461
+ Math.max(0, H === void 0 ? ze : H)
462
+ ) : 0, D = !!s && ((q && s ? N === void 0 ? Fe : N : !1) || g > 0), Ue = D && g === 0, P = !!(G && !s), _t = P && g > 0, $e = Ht((s == null ? void 0 : s.width) ?? (s == null ? void 0 : s.minWidth), Lt), B = (b == null ? void 0 : b.columns.length) === v.length ? b.columns : void 0, je = Y(b == null ? void 0 : b.selection, A), Ve = Y(b == null ? void 0 : b.leading, $e), Ot = (_t ? je : 0) + (D ? Ve : 0), Ct = v.length + (P ? 1 : 0) + (s ? 1 : 0) + (m ? 1 : 0);
463
+ let te = Ot;
464
+ for (let t = 0; t < g; t += 1)
465
+ te += Y(B == null ? void 0 : B[t], Zt[t] ?? It);
466
+ const Re = Vt && m ? Y(b == null ? void 0 : b.rowActions, Ht(U, le)) : 0, Qe = ar(ir), mt = me || !Qe, R = mt && (Kt <= 0 || te + Re <= Kt * ke), Dt = R ? g : 0, M = R && _t, ee = R && D, re = R && Ue, O = R && Vt, Tt = (t, r) => (p == null ? void 0 : p(t, r)) ?? String(t.id ?? r), Wt = er(() => {
467
+ var w, T;
468
+ const t = (T = (w = ut.current) == null ? void 0 : w.tHead) == null ? void 0 : T.rows[0];
469
+ if (!t) return;
470
+ const r = Array.from(t.cells);
471
+ let c = 0;
465
472
  const a = () => {
466
- var l;
467
- return wr(((l = r[n++]) == null ? void 0 : l.getBoundingClientRect().width) ?? 0);
473
+ var n;
474
+ return zr(((n = r[c++]) == null ? void 0 : n.getBoundingClientRect().width) ?? 0);
468
475
  }, d = {
469
- selection: I ? a() : 0,
476
+ selection: P ? a() : 0,
470
477
  leading: s ? a() : 0,
471
- columns: f.map(() => a()),
472
- rowActions: T ? a() : 0
478
+ columns: v.map(() => a()),
479
+ rowActions: m ? a() : 0
473
480
  };
474
- xe((l) => vr(l, d) ? l : d);
475
- }, [f, I, s, T]);
476
- Qt(() => {
477
- St();
478
- }), Qt(() => {
479
- var n, a;
480
- const e = wt.current;
481
- if (!e || typeof window > "u" || typeof window.ResizeObserver > "u") return;
482
- const r = new window.ResizeObserver(St);
483
- return r.observe(e), Array.from(((a = (n = e.tHead) == null ? void 0 : n.rows[0]) == null ? void 0 : a.cells) ?? []).forEach((d) => r.observe(d)), () => r.disconnect();
484
- }, [St]);
485
- const P = M(() => {
486
- if (!b) return t;
487
- const e = o.find((r) => r.id === b.columnId);
488
- return e ? [...t].sort((r, n) => {
489
- const a = br(Ct(r, e), Ct(n, e));
490
- return b.direction === "asc" ? a : -a;
491
- }) : t;
492
- }, [b, o, t]), mt = P.length > 0 && P.every((e, r) => E.includes(xt(e, r))), We = (e) => {
493
- if (!et || !e.sortable) return;
494
- const r = (b == null ? void 0 : b.columnId) === e.id ? { columnId: e.id, direction: b.direction === "asc" ? "desc" : "asc" } : { columnId: e.id, direction: "asc" };
495
- F === void 0 && Nt(r), ot == null || ot(r);
496
- }, Ae = (e) => {
497
- k === void 0 && yt(e), st == null || st(e);
498
- }, kt = (e) => {
499
- const r = Math.min(f.length, Math.max(0, e));
500
- L === void 0 && Et(r), lt == null || lt(r);
501
- }, Yt = (e) => {
502
- H === void 0 && Ut(e), dt == null || dt(e);
503
- }, qt = () => {
504
- J && J(mt ? [] : P.map((e, r) => xt(e, r)));
505
- }, Gt = (e) => {
506
- J && J(E.includes(e) ? E.filter((r) => r !== e) : [...E, e]);
507
- }, Jt = (e) => {
508
- let r = Te;
509
- for (let n = 0; n < e; n += 1)
510
- r += Pt(ut == null ? void 0 : ut[n], Se[n] ?? Rt);
481
+ Ee((n) => Fr(n, d) ? n : d);
482
+ }, [v, P, s, m]);
483
+ ce(() => {
484
+ Wt();
485
+ }), ce(() => {
486
+ var d, w;
487
+ const t = ut.current;
488
+ if (!t || typeof window > "u" || typeof window.ResizeObserver > "u") return;
489
+ const r = Qt.current, c = () => {
490
+ Wt(), r && Ie(r.clientWidth);
491
+ }, a = new window.ResizeObserver(c);
492
+ return a.observe(t), r && a.observe(r), c(), Array.from(((w = (d = t.tHead) == null ? void 0 : d.rows[0]) == null ? void 0 : w.cells) ?? []).forEach((T) => a.observe(T)), () => a.disconnect();
493
+ }, [Wt]);
494
+ const I = L(() => {
495
+ if (!f) return e;
496
+ const t = o.find((r) => r.id === f.columnId);
497
+ return t ? [...e].sort((r, c) => {
498
+ const a = Ir(fe(r, t), fe(c, t));
499
+ return f.direction === "asc" ? a : -a;
500
+ }) : e;
501
+ }, [f, o, e]), At = I.length > 0 && I.every((t, r) => $.includes(Tt(t, r))), Ke = (t) => {
502
+ if (!it || !t.sortable) return;
503
+ const r = (f == null ? void 0 : f.columnId) === t.id ? { columnId: t.id, direction: f.direction === "asc" ? "desc" : "asc" } : { columnId: t.id, direction: "asc" };
504
+ F === void 0 && Yt(r), st == null || st(r);
505
+ }, Ye = (t) => {
506
+ k === void 0 && St(t), dt == null || dt(t);
507
+ }, Pt = (t) => {
508
+ const r = Math.min(v.length, Math.max(0, t));
509
+ H === void 0 && qt(r), ht == null || ht(r);
510
+ }, oe = (t) => {
511
+ N === void 0 && Gt(t), ft == null || ft(t);
512
+ }, ae = () => {
513
+ J && J(At ? [] : I.map((t, r) => Tt(t, r)));
514
+ }, ie = (t) => {
515
+ J && J($.includes(t) ? $.filter((r) => r !== t) : [...$, t]);
516
+ }, ne = (t) => {
517
+ let r = Ot;
518
+ for (let c = 0; c < t; c += 1)
519
+ r += Y(B == null ? void 0 : B[c], Zt[c] ?? It);
511
520
  return r;
512
- }, Be = (e, r) => {
513
- N && (U(r), e.dataTransfer.effectAllowed = "move");
514
- }, Ie = (e, r) => {
515
- N && (e.preventDefault(), $(r));
516
- }, Pe = (e, r) => {
517
- var d, S;
518
- if (!N) return;
519
- if (e.preventDefault(), X === null || X === r) {
520
- U(null), $(null);
521
+ }, qe = (t, r) => {
522
+ E && (j(r), t.dataTransfer.effectAllowed = "move");
523
+ }, Ge = (t, r) => {
524
+ E && (t.preventDefault(), V(r));
525
+ }, Je = (t, r) => {
526
+ var d, w;
527
+ if (!E) return;
528
+ if (t.preventDefault(), _ === null || _ === r) {
529
+ j(null), V(null);
521
530
  return;
522
531
  }
523
- const n = (d = f[X]) == null ? void 0 : d.id, a = (S = f[r]) == null ? void 0 : S.id;
524
- n && a && (Ae(fr(k ?? vt, n, a)), X < u && kt(Math.min(u, r + 1))), U(null), $(null);
525
- }, Dt = (e, r = 20) => ({
532
+ const c = (d = v[_]) == null ? void 0 : d.id, a = (w = v[r]) == null ? void 0 : w.id;
533
+ c && a && (Ye(Lr(k ?? xt, c, a)), _ < g && Pt(Math.min(g, r + 1))), j(null), V(null);
534
+ }, Bt = (t, r = 20) => ({
526
535
  position: "sticky",
527
- left: e,
528
- ...pt ? { top: 0 } : {},
536
+ left: t,
537
+ ...wt ? { top: 0 } : {},
529
538
  zIndex: r
530
- }), Tt = (e, r = 10) => ({
539
+ }), Mt = (t, r = 10) => ({
531
540
  position: "sticky",
532
- left: e,
541
+ left: t,
533
542
  zIndex: r
534
- }), Me = q ? {
543
+ }), Xe = O ? {
535
544
  position: "sticky",
536
545
  right: 0,
537
546
  zIndex: 12
538
- } : {}, ze = q ? {
547
+ } : {}, Ze = O ? {
539
548
  position: "sticky",
540
549
  right: 0,
541
- ...pt ? { top: 0 } : {},
550
+ ...wt ? { top: 0 } : {},
542
551
  zIndex: 24
543
552
  } : {};
544
- return /* @__PURE__ */ m(er, { className: de, ownerState: { fill: le }, children: [
545
- /* @__PURE__ */ m(rr, { className: pe, style: Ht !== void 0 ? { maxHeight: Ht } : void 0, children: [
546
- /* @__PURE__ */ m(ar, { ref: wt, "aria-label": fe, "aria-busy": h || void 0, className: he, style: { minWidth: ce, tableLayout: "fixed" }, children: [
547
- /* @__PURE__ */ i(ir, { ownerState: { sticky: !!pt }, className: be, children: /* @__PURE__ */ m(sr, { children: [
548
- I && /* @__PURE__ */ i(
549
- _,
553
+ return /* @__PURE__ */ x(ur, { className: We, ownerState: { fill: De }, children: [
554
+ /* @__PURE__ */ x(xr, { ref: Qt, className: Ae, style: Rt !== void 0 ? { maxHeight: Rt } : void 0, children: [
555
+ /* @__PURE__ */ x(kr, { ref: ut, "aria-label": Me, "aria-busy": h || void 0, className: Pe, style: { minWidth: Te, tableLayout: "fixed" }, children: [
556
+ /* @__PURE__ */ i(mr, { ownerState: { sticky: !!wt }, className: Be, children: /* @__PURE__ */ x(Dr, { children: [
557
+ P && /* @__PURE__ */ i(
558
+ et,
550
559
  {
551
- ownerState: { kind: "selection", edgeShadow: A },
552
- style: { width: B, minWidth: B, ...A ? Dt(0, 24) : {} },
553
- children: /* @__PURE__ */ i(Ot, { children: /* @__PURE__ */ i(C, { type: "checkbox", checked: mt, onChange: qt, "aria-label": "Select all rows" }) })
560
+ ownerState: { kind: "selection", edgeShadow: M },
561
+ style: { width: A, minWidth: A, ...M ? Bt(0, 24) : {} },
562
+ children: /* @__PURE__ */ i(be, { children: /* @__PURE__ */ i(ot, { type: "checkbox", checked: At, onChange: ae, "aria-label": "Select all rows" }) })
554
563
  }
555
564
  ),
556
565
  s && /* @__PURE__ */ i(
557
- _,
566
+ et,
558
567
  {
559
568
  scope: "col",
560
- ownerState: { kind: "leading", edgeShadow: Vt },
569
+ ownerState: { kind: "leading", edgeShadow: re },
561
570
  className: s.headerClassName,
562
571
  style: {
563
572
  width: s.width,
564
- minWidth: s.minWidth ?? s.width ?? Wt,
565
- ...x ? Dt(A ? B : 0, 23) : {},
573
+ minWidth: s.minWidth ?? s.width ?? Lt,
574
+ ...ee ? Bt(M ? A : 0, 23) : {},
566
575
  ...s.headerStyle
567
576
  },
568
- children: /* @__PURE__ */ m(Zt, { ownerState: { wide: !0 }, children: [
569
- G && /* @__PURE__ */ i(C, { type: "checkbox", checked: mt, onChange: qt, "aria-label": "Select all rows" }),
570
- /* @__PURE__ */ i(Bt, { ownerState: { overflow: ht }, children: s.header }),
571
- K && /* @__PURE__ */ i(
572
- _t,
577
+ children: /* @__PURE__ */ x(pe, { ownerState: { wide: !0 }, children: [
578
+ G && /* @__PURE__ */ i(ot, { type: "checkbox", checked: At, onChange: ae, "aria-label": "Select all rows" }),
579
+ /* @__PURE__ */ i(Ft, { ownerState: { overflow: vt }, children: s.header }),
580
+ q && mt && /* @__PURE__ */ i(
581
+ he,
573
582
  {
574
583
  type: "button",
575
- ownerState: { pinned: x, side: "right" },
576
- title: x ? "Unpin leading column" : "Pin leading column",
577
- "aria-label": x ? "Unpin leading column" : "Pin leading column",
578
- onClick: (e) => {
579
- e.stopPropagation(), x ? (Yt(!1), kt(0)) : Yt(!0);
584
+ ownerState: { pinned: D, side: "right" },
585
+ title: D ? "Unpin leading column" : "Pin leading column",
586
+ "aria-label": D ? "Unpin leading column" : "Pin leading column",
587
+ onClick: (t) => {
588
+ t.stopPropagation(), D ? (oe(!1), Pt(0)) : oe(!0);
580
589
  },
581
- children: x ? "Unpin" : "Pin"
590
+ children: D ? "Unpin" : "Pin"
582
591
  }
583
592
  )
584
593
  ] })
585
594
  }
586
595
  ),
587
- f.map((e, r) => {
588
- const n = (b == null ? void 0 : b.columnId) === e.id, a = r < u, d = r === u - 1, S = {
589
- width: e.width,
590
- minWidth: e.minWidth ?? e.width,
591
- textAlign: e.align,
592
- ...a ? Dt(Jt(r), 22) : {},
593
- ...e.headerStyle
594
- }, y = et && e.sortable, l = y && Lt === "always" && !n, j = y && n && Lt !== "never", V = K && r < Qe && /* @__PURE__ */ i(
595
- _t,
596
+ v.map((t, r) => {
597
+ const c = (f == null ? void 0 : f.columnId) === t.id, a = r < g, d = r === g - 1, w = r < Dt, T = {
598
+ width: t.width,
599
+ minWidth: t.minWidth ?? t.width,
600
+ textAlign: t.align,
601
+ ...w ? Bt(ne(r), 22) : {},
602
+ ...t.headerStyle
603
+ }, n = it && t.sortable, Q = n && jt === "always" && !c, C = n && c && jt !== "never", K = q && mt && r < dr && /* @__PURE__ */ i(
604
+ he,
596
605
  {
597
606
  type: "button",
598
- ownerState: { pinned: a, side: e.align === "right" ? "left" : "right" },
607
+ ownerState: { pinned: a, side: t.align === "right" ? "left" : "right" },
599
608
  title: a && d ? "Unpin columns" : "Pin up to this column",
600
- "aria-label": a && d ? "Unpin columns" : `Pin up to ${String(e.header)}`,
601
- onClick: (g) => {
602
- g.stopPropagation(), kt(a && d ? 0 : r + 1);
609
+ "aria-label": a && d ? "Unpin columns" : `Pin up to ${String(t.header)}`,
610
+ onClick: (u) => {
611
+ u.stopPropagation(), Pt(a && d ? 0 : r + 1);
603
612
  },
604
613
  children: a ? "Unpin" : "Pin"
605
614
  }
606
615
  );
607
616
  return /* @__PURE__ */ i(
608
- _,
617
+ et,
609
618
  {
610
619
  scope: "col",
611
- "aria-sort": y ? n ? b.direction === "asc" ? "ascending" : "descending" : "none" : void 0,
612
- draggable: N,
613
- onDragStart: (g) => Be(g, r),
614
- onDragOver: (g) => Ie(g, r),
615
- onDrop: (g) => Pe(g, r),
620
+ "aria-sort": n ? c ? f.direction === "asc" ? "ascending" : "descending" : "none" : void 0,
621
+ draggable: E,
622
+ onDragStart: (u) => qe(u, r),
623
+ onDragOver: (u) => Ge(u, r),
624
+ onDrop: (u) => Je(u, r),
616
625
  onDragEnd: () => {
617
- U(null), $(null);
626
+ j(null), V(null);
618
627
  },
619
628
  ownerState: {
620
629
  kind: "data",
621
- sortable: !!y,
622
- sorted: !!n,
623
- reorderable: N,
624
- dropTarget: ge === r,
625
- edgeShadow: a && d
630
+ sortable: !!n,
631
+ sorted: !!c,
632
+ reorderable: E,
633
+ dropTarget: He === r,
634
+ edgeShadow: w && d
626
635
  },
627
- className: e.headerClassName,
628
- style: S,
629
- children: /* @__PURE__ */ m(Zt, { ownerState: { align: e.align }, children: [
630
- e.align === "right" && V,
631
- y ? /* @__PURE__ */ m(lr, { type: "button", onClick: () => We(e), children: [
632
- /* @__PURE__ */ i(Bt, { ownerState: { overflow: ht }, children: e.header }),
633
- j && (b.direction === "asc" ? /* @__PURE__ */ i(Ee, { size: 12, weight: "bold" }) : /* @__PURE__ */ i(Ne, { size: 12, weight: "bold" })),
634
- l && /* @__PURE__ */ i(cr, { size: 12 })
635
- ] }) : /* @__PURE__ */ i(Bt, { ownerState: { overflow: ht }, children: e.header }),
636
- e.align !== "right" && V
636
+ className: t.headerClassName,
637
+ style: T,
638
+ children: /* @__PURE__ */ x(pe, { ownerState: { align: t.align }, children: [
639
+ t.align === "right" && K,
640
+ n ? /* @__PURE__ */ x(Wr, { type: "button", onClick: () => Ke(t), children: [
641
+ /* @__PURE__ */ i(Ft, { ownerState: { overflow: vt }, children: t.header }),
642
+ C && (f.direction === "asc" ? /* @__PURE__ */ i(tr, { size: 12, weight: "bold" }) : /* @__PURE__ */ i(Ce, { size: 12, weight: "bold" })),
643
+ Q && /* @__PURE__ */ i(Ar, { size: 12 })
644
+ ] }) : /* @__PURE__ */ i(Ft, { ownerState: { overflow: vt }, children: t.header }),
645
+ t.align !== "right" && K
637
646
  ] })
638
647
  },
639
- e.id
648
+ t.id
640
649
  );
641
650
  }),
642
- T && /* @__PURE__ */ i(
643
- _,
651
+ m && /* @__PURE__ */ i(
652
+ et,
644
653
  {
645
- ownerState: { kind: "actions", actionsShadow: q },
646
- style: { width: Y, minWidth: Y, ...ze },
647
- children: ne
654
+ ownerState: { kind: "actions", actionsShadow: O },
655
+ style: { width: U, minWidth: U, ...Ze },
656
+ children: Se
648
657
  }
649
658
  )
650
659
  ] }) }),
651
- /* @__PURE__ */ i("tbody", { children: h ? /* @__PURE__ */ i(Ge, { rows: 5, columns: Kt }) : w ? /* @__PURE__ */ i(Ye, { description: w, colSpan: Kt }) : P.length === 0 ? null : P.map((e, r) => {
652
- const n = xt(e, r), a = E.includes(n), d = ue === n, S = typeof bt == "function" ? bt(e, r) : bt, y = { rowIndex: r, selected: a, hovered: d };
653
- return /* @__PURE__ */ m(
654
- dr,
660
+ /* @__PURE__ */ i("tbody", { children: h ? /* @__PURE__ */ i(lr, { rows: 5, columns: Ct }) : y ? /* @__PURE__ */ i(sr, { description: y, colSpan: Ct }) : I.length === 0 ? null : I.map((t, r) => {
661
+ const c = Tt(t, r), a = $.includes(c), d = Ne === c, w = typeof yt == "function" ? yt(t, r) : yt, T = { rowIndex: r, selected: a, hovered: d };
662
+ return /* @__PURE__ */ x(
663
+ Pr,
655
664
  {
656
- ownerState: { selected: a, clickable: !!R },
657
- className: S,
658
- onMouseEnter: () => $t(n),
659
- onMouseLeave: () => $t(null),
660
- onClick: () => R == null ? void 0 : R(e),
665
+ ownerState: { selected: a, clickable: !!Z },
666
+ className: w,
667
+ onMouseEnter: () => Jt(c),
668
+ onMouseLeave: () => Jt(null),
669
+ onClick: () => Z == null ? void 0 : Z(t),
661
670
  children: [
662
- I && /* @__PURE__ */ i(
663
- O,
671
+ P && /* @__PURE__ */ i(
672
+ rt,
664
673
  {
665
- ownerState: { kind: "selection", selected: a, cellTextSize: Q, edgeShadow: A },
666
- style: { width: B, minWidth: B, ...A ? Tt(0, 14) : {} },
667
- onClick: (l) => l.stopPropagation(),
668
- children: /* @__PURE__ */ i(Ot, { children: /* @__PURE__ */ i(C, { type: "checkbox", checked: a, onChange: () => Gt(n), "aria-label": `Select row ${r + 1}` }) })
674
+ ownerState: { kind: "selection", selected: a, cellTextSize: X, edgeShadow: M },
675
+ style: { width: A, minWidth: A, ...M ? Mt(0, 14) : {} },
676
+ onClick: (n) => n.stopPropagation(),
677
+ children: /* @__PURE__ */ i(be, { children: /* @__PURE__ */ i(ot, { type: "checkbox", checked: a, onChange: () => ie(c), "aria-label": `Select row ${r + 1}` }) })
669
678
  }
670
679
  ),
671
680
  s && /* @__PURE__ */ i(
672
- O,
681
+ rt,
673
682
  {
674
- ownerState: { kind: "leading", selected: a, cellTextSize: Q, edgeShadow: Vt },
683
+ ownerState: { kind: "leading", selected: a, cellTextSize: X, edgeShadow: re },
675
684
  className: s.className,
676
685
  style: {
677
686
  width: s.width,
678
- minWidth: s.minWidth ?? s.width ?? Wt,
679
- ...x ? Tt(A ? B : 0, 13) : {},
687
+ minWidth: s.minWidth ?? s.width ?? Lt,
688
+ ...ee ? Mt(M ? A : 0, 13) : {},
680
689
  ...s.style
681
690
  },
682
- onClick: G ? (l) => l.stopPropagation() : void 0,
683
- children: /* @__PURE__ */ m(pr, { children: [
684
- G && /* @__PURE__ */ i(C, { type: "checkbox", checked: a, onChange: () => Gt(n), "aria-label": `Select row ${r + 1}` }),
685
- /* @__PURE__ */ i(hr, { children: s.cell(e, y) })
691
+ onClick: G ? (n) => n.stopPropagation() : void 0,
692
+ children: /* @__PURE__ */ x(Br, { children: [
693
+ G && /* @__PURE__ */ i(ot, { type: "checkbox", checked: a, onChange: () => ie(c), "aria-label": `Select row ${r + 1}` }),
694
+ /* @__PURE__ */ i(Mr, { children: s.cell(t, T) })
686
695
  ] })
687
696
  }
688
697
  ),
689
- f.map((l, j) => {
690
- const V = ae(e, l), g = j < u, Fe = j === u - 1, Le = typeof ft == "function" ? ft(e, r, l) : ft;
698
+ v.map((n, Q) => {
699
+ const C = ge(t, n), K = Q < Dt, u = Q === Dt - 1, _e = typeof gt == "function" ? gt(t, r, n) : gt;
691
700
  return /* @__PURE__ */ i(
692
- O,
701
+ rt,
693
702
  {
694
- ownerState: { kind: "data", selected: a, cellTextSize: Q, edgeShadow: g && Fe },
695
- className: Ve(Le, l.className),
703
+ ownerState: { kind: "data", selected: a, cellTextSize: X, edgeShadow: K && u },
704
+ className: or(_e, n.className),
696
705
  style: {
697
- width: l.width,
698
- minWidth: l.minWidth ?? l.width,
699
- textAlign: l.align,
700
- ...g ? Tt(Jt(j), 12) : {},
701
- ...l.style
706
+ width: n.width,
707
+ minWidth: n.minWidth ?? n.width,
708
+ textAlign: n.align,
709
+ ...K ? Mt(ne(Q), 12) : {},
710
+ ...n.style
702
711
  },
703
- children: l.cell ? l.cell(e, { value: V, rowIndex: r, selected: a, hovered: d }) : String(V ?? "")
712
+ children: n.cell ? n.cell(t, { value: C, rowIndex: r, selected: a, hovered: d }) : String(C ?? "")
704
713
  },
705
- l.id
714
+ n.id
706
715
  );
707
716
  }),
708
- T && /* @__PURE__ */ i(
709
- O,
717
+ m && /* @__PURE__ */ i(
718
+ rt,
710
719
  {
711
- ownerState: { kind: "actions", selected: a, cellTextSize: Q, actionsShadow: q },
712
- style: { width: Y, minWidth: Y, ...Me },
713
- onClick: (l) => l.stopPropagation(),
714
- children: T(e)
720
+ ownerState: { kind: "actions", selected: a, cellTextSize: X, actionsShadow: O },
721
+ style: { width: U, minWidth: U, ...Xe },
722
+ onClick: (n) => n.stopPropagation(),
723
+ children: m(t)
715
724
  }
716
725
  )
717
726
  ]
718
727
  },
719
- n
728
+ c
720
729
  );
721
730
  }) })
722
731
  ] }),
723
- !h && !w && P.length === 0 && /* @__PURE__ */ i(or, { children: z ?? /* @__PURE__ */ i(Ke, { title: ie, description: se }) })
732
+ !h && !y && I.length === 0 && /* @__PURE__ */ i(Sr, { children: z ?? /* @__PURE__ */ i(nr, { title: ue, description: xe }) })
724
733
  ] }),
725
- zt && /* @__PURE__ */ i(qe, { ...zt })
734
+ Ut && /* @__PURE__ */ i(cr, { ...Ut })
726
735
  ] });
727
736
  }
728
737
  export {
729
- Pr as DataTable
738
+ Xr as DataTable
730
739
  };
731
740
  //# sourceMappingURL=DataTable.js.map