@xsolla/xui-table 0.151.0-pr273.1778117489

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.
@@ -0,0 +1,738 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.tsx
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ Table: () => Table
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/Table.tsx
38
+ var import_react = __toESM(require("react"));
39
+
40
+ // ../../foundation/primitives-native/src/Box.tsx
41
+ var import_react_native = require("react-native");
42
+ var import_jsx_runtime = require("react/jsx-runtime");
43
+ var Box = ({
44
+ children,
45
+ onPress,
46
+ onLayout,
47
+ onMoveShouldSetResponder,
48
+ onResponderGrant,
49
+ onResponderMove,
50
+ onResponderRelease,
51
+ onResponderTerminate,
52
+ backgroundColor,
53
+ borderColor,
54
+ borderWidth,
55
+ borderBottomWidth,
56
+ borderBottomColor,
57
+ borderTopWidth,
58
+ borderTopColor,
59
+ borderLeftWidth,
60
+ borderLeftColor,
61
+ borderRightWidth,
62
+ borderRightColor,
63
+ borderRadius,
64
+ borderStyle,
65
+ height,
66
+ padding,
67
+ paddingHorizontal,
68
+ paddingVertical,
69
+ margin,
70
+ marginTop,
71
+ marginBottom,
72
+ marginLeft,
73
+ marginRight,
74
+ flexDirection,
75
+ alignItems,
76
+ justifyContent,
77
+ position,
78
+ top,
79
+ bottom,
80
+ left,
81
+ right,
82
+ width,
83
+ minWidth,
84
+ minHeight,
85
+ maxWidth,
86
+ maxHeight,
87
+ flex,
88
+ overflow,
89
+ zIndex,
90
+ hoverStyle,
91
+ pressStyle,
92
+ style,
93
+ "data-testid": dataTestId,
94
+ testID,
95
+ as,
96
+ src,
97
+ alt,
98
+ ...rest
99
+ }) => {
100
+ const getContainerStyle = (pressed) => ({
101
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
102
+ borderColor,
103
+ borderWidth,
104
+ borderBottomWidth,
105
+ borderBottomColor,
106
+ borderTopWidth,
107
+ borderTopColor,
108
+ borderLeftWidth,
109
+ borderLeftColor,
110
+ borderRightWidth,
111
+ borderRightColor,
112
+ borderRadius,
113
+ borderStyle,
114
+ overflow,
115
+ zIndex,
116
+ height,
117
+ width,
118
+ minWidth,
119
+ minHeight,
120
+ maxWidth,
121
+ maxHeight,
122
+ padding,
123
+ paddingHorizontal,
124
+ paddingVertical,
125
+ margin,
126
+ marginTop,
127
+ marginBottom,
128
+ marginLeft,
129
+ marginRight,
130
+ flexDirection,
131
+ alignItems,
132
+ justifyContent,
133
+ position,
134
+ top,
135
+ bottom,
136
+ left,
137
+ right,
138
+ flex,
139
+ ...style
140
+ });
141
+ const finalTestID = dataTestId || testID;
142
+ const {
143
+ role,
144
+ tabIndex,
145
+ onKeyDown,
146
+ onKeyUp,
147
+ "aria-label": _ariaLabel,
148
+ "aria-labelledby": _ariaLabelledBy,
149
+ "aria-current": _ariaCurrent,
150
+ "aria-disabled": _ariaDisabled,
151
+ "aria-live": _ariaLive,
152
+ className,
153
+ "data-testid": _dataTestId,
154
+ ...nativeRest
155
+ } = rest;
156
+ if (as === "img" && src) {
157
+ const imageStyle = {
158
+ width,
159
+ height,
160
+ borderRadius,
161
+ position,
162
+ top,
163
+ bottom,
164
+ left,
165
+ right,
166
+ ...style
167
+ };
168
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
169
+ import_react_native.Image,
170
+ {
171
+ source: { uri: src },
172
+ style: imageStyle,
173
+ testID: finalTestID,
174
+ resizeMode: "cover",
175
+ ...nativeRest
176
+ }
177
+ );
178
+ }
179
+ if (onPress) {
180
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
181
+ import_react_native.Pressable,
182
+ {
183
+ onPress,
184
+ onLayout,
185
+ onMoveShouldSetResponder,
186
+ onResponderGrant,
187
+ onResponderMove,
188
+ onResponderRelease,
189
+ onResponderTerminate,
190
+ style: ({ pressed }) => getContainerStyle(pressed),
191
+ testID: finalTestID,
192
+ ...nativeRest,
193
+ children
194
+ }
195
+ );
196
+ }
197
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
198
+ import_react_native.View,
199
+ {
200
+ style: getContainerStyle(),
201
+ testID: finalTestID,
202
+ onLayout,
203
+ onMoveShouldSetResponder,
204
+ onResponderGrant,
205
+ onResponderMove,
206
+ onResponderRelease,
207
+ onResponderTerminate,
208
+ ...nativeRest,
209
+ children
210
+ }
211
+ );
212
+ };
213
+
214
+ // ../../foundation/primitives-native/src/Text.tsx
215
+ var import_react_native2 = require("react-native");
216
+ var import_jsx_runtime2 = require("react/jsx-runtime");
217
+ var roleMap = {
218
+ alert: "alert",
219
+ heading: "header",
220
+ button: "button",
221
+ link: "link",
222
+ text: "text"
223
+ };
224
+ var parseNumericValue = (value) => {
225
+ if (value === void 0) return void 0;
226
+ if (typeof value === "number") return value;
227
+ const parsed = parseFloat(value);
228
+ return isNaN(parsed) ? void 0 : parsed;
229
+ };
230
+ var Text = ({
231
+ children,
232
+ color,
233
+ fontSize,
234
+ fontWeight,
235
+ fontFamily,
236
+ textAlign,
237
+ lineHeight,
238
+ numberOfLines,
239
+ id,
240
+ role,
241
+ style: styleProp,
242
+ ...props
243
+ }) => {
244
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
245
+ if (resolvedFontFamily === "Pilat Wide" || resolvedFontFamily === "Pilat Wide Bold" || resolvedFontFamily === "Aktiv Grotesk") {
246
+ resolvedFontFamily = void 0;
247
+ }
248
+ const incomingStyle = import_react_native2.StyleSheet.flatten(styleProp);
249
+ const baseStyle = {
250
+ color: color ?? incomingStyle?.color,
251
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
252
+ fontWeight,
253
+ fontFamily: resolvedFontFamily,
254
+ textDecorationLine: props.textDecoration,
255
+ textAlign: textAlign ?? incomingStyle?.textAlign,
256
+ lineHeight: parseNumericValue(lineHeight ?? incomingStyle?.lineHeight),
257
+ marginTop: parseNumericValue(
258
+ incomingStyle?.marginTop
259
+ ),
260
+ marginBottom: parseNumericValue(
261
+ incomingStyle?.marginBottom
262
+ )
263
+ };
264
+ const accessibilityRole = role ? roleMap[role] : void 0;
265
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
266
+ import_react_native2.Text,
267
+ {
268
+ style: baseStyle,
269
+ numberOfLines,
270
+ testID: id,
271
+ accessibilityRole,
272
+ children
273
+ }
274
+ );
275
+ };
276
+
277
+ // src/Table.tsx
278
+ var import_xui_core = require("@xsolla/xui-core");
279
+ var import_xui_icons_base = require("@xsolla/xui-icons-base");
280
+ var import_jsx_runtime3 = require("react/jsx-runtime");
281
+ var TableRowGroupContext = (0, import_react.createContext)("body");
282
+ var RowRevealContext = (0, import_react.createContext)({
283
+ revealed: true
284
+ });
285
+ var useHoverCapable = () => {
286
+ const [hoverCapable, setHoverCapable] = (0, import_react.useState)(true);
287
+ (0, import_react.useEffect)(() => {
288
+ if (import_xui_core.isNative) return;
289
+ if (typeof window === "undefined" || !window.matchMedia) return;
290
+ const mq = window.matchMedia("(hover: hover)");
291
+ setHoverCapable(mq.matches);
292
+ const onChange = (e) => setHoverCapable(e.matches);
293
+ mq.addEventListener?.("change", onChange);
294
+ return () => mq.removeEventListener?.("change", onChange);
295
+ }, []);
296
+ return hoverCapable;
297
+ };
298
+ var Divider = ({ color }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
299
+ Box,
300
+ {
301
+ width: "100%",
302
+ height: 1,
303
+ backgroundColor: color,
304
+ style: { flexShrink: 0 }
305
+ }
306
+ );
307
+ var TableRoot = (0, import_react.forwardRef)(
308
+ ({ children, themeMode, themeProductContext }, ref) => {
309
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
310
+ const sizing = theme.sizing.table;
311
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
312
+ Box,
313
+ {
314
+ ref,
315
+ flexDirection: "column",
316
+ alignItems: "stretch",
317
+ gap: sizing.containerGap,
318
+ paddingVertical: sizing.containerPaddingVertical,
319
+ backgroundColor: theme.colors.background.primary,
320
+ borderRadius: sizing.containerRadius,
321
+ width: "100%",
322
+ role: "table",
323
+ style: {
324
+ color: theme.colors.content.primary,
325
+ overflow: "clip"
326
+ },
327
+ children
328
+ }
329
+ );
330
+ }
331
+ );
332
+ TableRoot.displayName = "Table";
333
+ var TableCaption = (0, import_react.forwardRef)(
334
+ ({ children, themeMode, themeProductContext, style, ...props }, ref) => {
335
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
336
+ const sizing = theme.sizing.table;
337
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
338
+ Box,
339
+ {
340
+ ref,
341
+ flexDirection: "row",
342
+ alignItems: "center",
343
+ paddingHorizontal: sizing.headerRowPaddingHorizontal,
344
+ width: "100%",
345
+ ...props,
346
+ style,
347
+ children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
348
+ Text,
349
+ {
350
+ fontSize: sizing.captionFontSize,
351
+ lineHeight: sizing.captionLineHeight,
352
+ color: theme.colors.content.secondary,
353
+ children
354
+ }
355
+ ) : children
356
+ }
357
+ );
358
+ }
359
+ );
360
+ TableCaption.displayName = "Table.Caption";
361
+ var TableHeader = (0, import_react.forwardRef)(
362
+ ({ children, themeMode, themeProductContext, style, ...props }, ref) => {
363
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
364
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TableRowGroupContext.Provider, { value: "header", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
365
+ Box,
366
+ {
367
+ ref,
368
+ flexDirection: "column",
369
+ alignItems: "stretch",
370
+ width: "100%",
371
+ role: "rowgroup",
372
+ ...props,
373
+ style: {
374
+ position: "sticky",
375
+ top: 0,
376
+ zIndex: 1,
377
+ backgroundColor: theme.colors.background.primary,
378
+ ...style
379
+ },
380
+ children: [
381
+ children,
382
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Divider, { color: theme.colors.border.secondary })
383
+ ]
384
+ }
385
+ ) });
386
+ }
387
+ );
388
+ TableHeader.displayName = "Table.Header";
389
+ var TableBody = (0, import_react.forwardRef)(
390
+ ({ children, style, minRows, themeMode, themeProductContext, ...props }, ref) => {
391
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
392
+ const sizing = theme.sizing.table;
393
+ const DIVIDER_HEIGHT = 1;
394
+ const computedMinHeight = minRows ? minRows * sizing.rowHeight + (minRows - 1) * DIVIDER_HEIGHT : void 0;
395
+ let renderedChildren = children;
396
+ if (minRows) {
397
+ const childArray = import_react.default.Children.toArray(children);
398
+ const hasOnlyRowChildren = childArray.length > 0 && childArray.every((c) => import_react.default.isValidElement(c) && c.type === TableRow);
399
+ const realRowCount = hasOnlyRowChildren ? childArray.length : 0;
400
+ const placeholderCount = hasOnlyRowChildren ? Math.max(0, minRows - realRowCount) : 0;
401
+ if (placeholderCount > 0) {
402
+ const patchedRows = childArray.map((child, i) => {
403
+ if (!import_react.default.isValidElement(child)) return child;
404
+ const isLastRealRow = i === realRowCount - 1;
405
+ return import_react.default.cloneElement(child, {
406
+ hideDivider: isLastRealRow ? false : child.props.hideDivider
407
+ });
408
+ });
409
+ const placeholders = Array.from({ length: placeholderCount }).map(
410
+ (_, i) => {
411
+ const isLast = i === placeholderCount - 1;
412
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
413
+ Box,
414
+ {
415
+ "aria-hidden": true,
416
+ style: {
417
+ height: isLast ? sizing.rowHeight : sizing.rowHeight + DIVIDER_HEIGHT,
418
+ flexShrink: 0
419
+ }
420
+ },
421
+ `__table-body-placeholder-${i}`
422
+ );
423
+ }
424
+ );
425
+ renderedChildren = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
426
+ patchedRows,
427
+ placeholders
428
+ ] });
429
+ }
430
+ }
431
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TableRowGroupContext.Provider, { value: "body", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
432
+ Box,
433
+ {
434
+ ref,
435
+ flexDirection: "column",
436
+ alignItems: "stretch",
437
+ width: "100%",
438
+ role: "rowgroup",
439
+ ...props,
440
+ style: {
441
+ ...computedMinHeight !== void 0 && {
442
+ minHeight: computedMinHeight
443
+ },
444
+ ...style
445
+ },
446
+ children: renderedChildren
447
+ }
448
+ ) });
449
+ }
450
+ );
451
+ TableBody.displayName = "Table.Body";
452
+ var TableRow = (0, import_react.forwardRef)(
453
+ ({
454
+ children,
455
+ hoverable: hoverableProp,
456
+ selected,
457
+ hideDivider: hideDividerProp,
458
+ onPress,
459
+ themeMode,
460
+ themeProductContext,
461
+ style,
462
+ onMouseEnter,
463
+ onMouseLeave,
464
+ onFocus,
465
+ onBlur,
466
+ ...props
467
+ }, ref) => {
468
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
469
+ const sizing = theme.sizing.table;
470
+ const rowGroup = (0, import_react.useContext)(TableRowGroupContext);
471
+ const hoverCapable = useHoverCapable();
472
+ const isHeaderRow = rowGroup === "header";
473
+ const hoverable = hoverableProp ?? !isHeaderRow;
474
+ const hideDivider = hideDividerProp ?? isHeaderRow;
475
+ const [hovered, setHovered] = (0, import_react.useState)(false);
476
+ const [focusedWithin, setFocusedWithin] = (0, import_react.useState)(false);
477
+ const revealed = hoverCapable ? hovered || focusedWithin : true;
478
+ const handleMouseEnter = (0, import_react.useCallback)(
479
+ (e) => {
480
+ setHovered(true);
481
+ onMouseEnter?.(e);
482
+ },
483
+ [onMouseEnter]
484
+ );
485
+ const handleMouseLeave = (0, import_react.useCallback)(
486
+ (e) => {
487
+ setHovered(false);
488
+ onMouseLeave?.(e);
489
+ },
490
+ [onMouseLeave]
491
+ );
492
+ const handleFocus = (0, import_react.useCallback)(
493
+ (e) => {
494
+ setFocusedWithin(true);
495
+ onFocus?.(e);
496
+ },
497
+ [onFocus]
498
+ );
499
+ const handleBlur = (0, import_react.useCallback)(
500
+ (e) => {
501
+ if (e.relatedTarget instanceof Node && e.currentTarget.contains(e.relatedTarget)) {
502
+ onBlur?.(e);
503
+ return;
504
+ }
505
+ setFocusedWithin(false);
506
+ onBlur?.(e);
507
+ },
508
+ [onBlur]
509
+ );
510
+ const baseBg = selected ? theme.colors.background.secondary : theme.colors.background.primary;
511
+ const rowHeight = isHeaderRow ? sizing.headerRowHeight : sizing.rowHeight;
512
+ const rowPaddingHorizontal = isHeaderRow ? sizing.headerRowPaddingHorizontal : sizing.rowPaddingHorizontal;
513
+ const ctxValue = (0, import_react.useMemo)(() => ({ revealed }), [revealed]);
514
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(RowRevealContext.Provider, { value: ctxValue, children: [
515
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
516
+ Box,
517
+ {
518
+ ref,
519
+ flexDirection: "row",
520
+ alignItems: "center",
521
+ height: rowHeight,
522
+ paddingHorizontal: rowPaddingHorizontal,
523
+ width: "100%",
524
+ gap: sizing.cellGap,
525
+ backgroundColor: baseBg,
526
+ cursor: onPress ? "pointer" : void 0,
527
+ hoverStyle: hoverable ? { backgroundColor: theme.colors.background.secondary } : void 0,
528
+ onPress,
529
+ role: "row",
530
+ "aria-selected": selected || void 0,
531
+ onMouseEnter: handleMouseEnter,
532
+ onMouseLeave: handleMouseLeave,
533
+ onFocus: handleFocus,
534
+ onBlur: handleBlur,
535
+ ...props,
536
+ style,
537
+ children
538
+ }
539
+ ),
540
+ !hideDivider && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Divider, { color: theme.colors.border.secondary })
541
+ ] });
542
+ }
543
+ );
544
+ TableRow.displayName = "Table.Row";
545
+ var positionToFlex = (position) => {
546
+ switch (position) {
547
+ case "left":
548
+ return { flexShrink: 0 };
549
+ case "right":
550
+ return { flexShrink: 0, marginLeft: "auto" };
551
+ default:
552
+ return {};
553
+ }
554
+ };
555
+ var alignToJustify = (align) => {
556
+ switch (align) {
557
+ case "right":
558
+ return "flex-end";
559
+ case "center":
560
+ return "center";
561
+ default:
562
+ return "flex-start";
563
+ }
564
+ };
565
+ var TableCell = (0, import_react.forwardRef)(
566
+ ({
567
+ children,
568
+ align = "left",
569
+ position = "default",
570
+ width,
571
+ grow,
572
+ revealOnHover,
573
+ themeMode,
574
+ themeProductContext,
575
+ style,
576
+ ...props
577
+ }, ref) => {
578
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
579
+ const sizing = theme.sizing.table;
580
+ const { revealed } = (0, import_react.useContext)(RowRevealContext);
581
+ const positionStyle = (0, import_react.useMemo)(() => positionToFlex(position), [position]);
582
+ const revealStyle = revealOnHover && !revealed ? { opacity: 0, pointerEvents: "none" } : revealOnHover ? { opacity: 1, transition: "opacity 0.15s ease" } : {};
583
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
584
+ Box,
585
+ {
586
+ ref,
587
+ flexDirection: "row",
588
+ alignItems: "center",
589
+ justifyContent: alignToJustify(align),
590
+ gap: 8,
591
+ height: "100%",
592
+ width,
593
+ role: "cell",
594
+ ...props,
595
+ style: {
596
+ flex: width != null ? "0 0 auto" : grow ?? 1,
597
+ minWidth: 0,
598
+ ...positionStyle,
599
+ ...revealStyle,
600
+ ...style
601
+ },
602
+ children: typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
603
+ Text,
604
+ {
605
+ fontSize: sizing.cellFontSize,
606
+ lineHeight: sizing.cellLineHeight,
607
+ color: theme.colors.content.primary,
608
+ style: {
609
+ overflow: "hidden",
610
+ textOverflow: "ellipsis",
611
+ whiteSpace: "nowrap",
612
+ maxWidth: "100%"
613
+ },
614
+ children
615
+ }
616
+ ) : children
617
+ }
618
+ );
619
+ }
620
+ );
621
+ TableCell.displayName = "Table.Cell";
622
+ var SortIcon = ({ direction, color, size }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
623
+ Box,
624
+ {
625
+ style: {
626
+ flexShrink: 0,
627
+ opacity: direction === "none" ? 0.4 : 1,
628
+ transition: "opacity 0.15s ease"
629
+ },
630
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_xui_icons_base.Sort, { variant: "line", size, color, "aria-hidden": true })
631
+ }
632
+ );
633
+ var TableHead = (0, import_react.forwardRef)(
634
+ ({
635
+ children,
636
+ align = "left",
637
+ position = "default",
638
+ width,
639
+ grow,
640
+ sort,
641
+ onSortToggle,
642
+ themeMode,
643
+ themeProductContext,
644
+ style,
645
+ ...props
646
+ }, ref) => {
647
+ const { theme } = (0, import_xui_core.useResolvedTheme)({ themeMode, themeProductContext });
648
+ const sizing = theme.sizing.table;
649
+ const positionStyle = (0, import_react.useMemo)(() => positionToFlex(position), [position]);
650
+ const sortable = sort != null;
651
+ const ariaSort = sortable ? sort : void 0;
652
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
653
+ Box,
654
+ {
655
+ ref,
656
+ flexDirection: "row",
657
+ alignItems: "center",
658
+ justifyContent: alignToJustify(align),
659
+ gap: sizing.headerCellGap,
660
+ height: "100%",
661
+ width,
662
+ role: "columnheader",
663
+ "aria-sort": ariaSort,
664
+ cursor: sortable ? "pointer" : void 0,
665
+ onPress: sortable ? onSortToggle : void 0,
666
+ ...props,
667
+ style: {
668
+ flex: width != null ? "0 0 auto" : grow ?? 1,
669
+ minWidth: 0,
670
+ ...positionStyle,
671
+ ...style
672
+ },
673
+ children: [
674
+ sortable && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
675
+ SortIcon,
676
+ {
677
+ direction: sort,
678
+ color: theme.colors.content.secondary,
679
+ size: sizing.headerCellFontSize + 2
680
+ }
681
+ ),
682
+ typeof children === "string" || typeof children === "number" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
683
+ Text,
684
+ {
685
+ fontSize: sizing.headerCellFontSize,
686
+ lineHeight: sizing.headerCellLineHeight,
687
+ color: theme.colors.content.secondary,
688
+ fontWeight: "500",
689
+ style: {
690
+ overflow: "hidden",
691
+ textOverflow: "ellipsis",
692
+ whiteSpace: "nowrap"
693
+ },
694
+ children
695
+ }
696
+ ) : children
697
+ ]
698
+ }
699
+ );
700
+ }
701
+ );
702
+ TableHead.displayName = "Table.Head";
703
+ var TableFooter = (0, import_react.forwardRef)(
704
+ ({ children, style, ...props }, ref) => {
705
+ const { theme } = (0, import_xui_core.useResolvedTheme)();
706
+ const sizing = theme.sizing.table;
707
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
708
+ Box,
709
+ {
710
+ ref,
711
+ flexDirection: "row",
712
+ alignItems: "center",
713
+ justifyContent: "center",
714
+ gap: sizing.paginationGap,
715
+ paddingHorizontal: sizing.paginationPaddingHorizontal,
716
+ width: "100%",
717
+ ...props,
718
+ style,
719
+ children
720
+ }
721
+ );
722
+ }
723
+ );
724
+ TableFooter.displayName = "Table.Footer";
725
+ var Table = Object.assign(TableRoot, {
726
+ Caption: TableCaption,
727
+ Header: TableHeader,
728
+ Body: TableBody,
729
+ Footer: TableFooter,
730
+ Row: TableRow,
731
+ Head: TableHead,
732
+ Cell: TableCell
733
+ });
734
+ // Annotate the CommonJS export names for ESM import in node:
735
+ 0 && (module.exports = {
736
+ Table
737
+ });
738
+ //# sourceMappingURL=index.js.map