@stackshift-ui/table 1.0.0-beta.2 → 1.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,134 @@
1
+ // src/table.tsx
2
+ import { cn, DefaultComponent, useStackShiftUIComponents } from "@stackshift-ui/system";
3
+ import { jsx } from "react/jsx-runtime";
4
+ var displayName = "Table";
5
+ var displayNameHeader = "TableHeader";
6
+ var displayNameBody = "TableBody";
7
+ var displayNameFooter = "TableFooter";
8
+ var displayNameRow = "TableRow";
9
+ var displayNameHead = "TableHead";
10
+ var displayNameCell = "TableCell";
11
+ var displayNameCaption = "TableCaption";
12
+ function Table({ className, ...props }) {
13
+ const { [displayName]: Component = DefaultComponent } = useStackShiftUIComponents();
14
+ return /* @__PURE__ */ jsx(Component, { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: /* @__PURE__ */ jsx(
15
+ "table",
16
+ {
17
+ "data-slot": "table",
18
+ className: cn("w-full caption-bottom text-sm", className),
19
+ ...props
20
+ }
21
+ ) });
22
+ }
23
+ Table.displayName = displayName;
24
+ function TableHeader({ className, ...props }) {
25
+ const { [displayNameHeader]: Component = DefaultComponent } = useStackShiftUIComponents();
26
+ return /* @__PURE__ */ jsx(
27
+ Component,
28
+ {
29
+ as: "thead",
30
+ "data-slot": "table-header",
31
+ className: cn("[&_tr]:border-b", className),
32
+ ...props
33
+ }
34
+ );
35
+ }
36
+ TableHeader.displayName = displayNameHeader;
37
+ function TableBody({ className, ...props }) {
38
+ const { [displayNameBody]: Component = DefaultComponent } = useStackShiftUIComponents();
39
+ return /* @__PURE__ */ jsx(
40
+ Component,
41
+ {
42
+ as: "tbody",
43
+ "data-slot": "table-body",
44
+ className: cn("[&_tr:last-child]:border-0", className),
45
+ ...props
46
+ }
47
+ );
48
+ }
49
+ TableBody.displayName = displayNameBody;
50
+ function TableFooter({ className, ...props }) {
51
+ const { [displayNameFooter]: Component = DefaultComponent } = useStackShiftUIComponents();
52
+ return /* @__PURE__ */ jsx(
53
+ Component,
54
+ {
55
+ as: "tfoot",
56
+ "data-slot": "table-footer",
57
+ className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className),
58
+ ...props
59
+ }
60
+ );
61
+ }
62
+ TableFooter.displayName = displayNameFooter;
63
+ function TableRow({ className, ...props }) {
64
+ const { [displayNameRow]: Component = DefaultComponent } = useStackShiftUIComponents();
65
+ return /* @__PURE__ */ jsx(
66
+ Component,
67
+ {
68
+ as: "tr",
69
+ "data-slot": "table-row",
70
+ className: cn(
71
+ "hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",
72
+ className
73
+ ),
74
+ ...props
75
+ }
76
+ );
77
+ }
78
+ TableRow.displayName = displayNameRow;
79
+ function TableHead({ className, ...props }) {
80
+ const { [displayNameHead]: Component = DefaultComponent } = useStackShiftUIComponents();
81
+ return /* @__PURE__ */ jsx(
82
+ Component,
83
+ {
84
+ as: "th",
85
+ "data-slot": "table-head",
86
+ className: cn(
87
+ "text-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
88
+ className
89
+ ),
90
+ ...props
91
+ }
92
+ );
93
+ }
94
+ TableHead.displayName = displayNameHead;
95
+ function TableCell({ className, ...props }) {
96
+ const { [displayNameCell]: Component = DefaultComponent } = useStackShiftUIComponents();
97
+ return /* @__PURE__ */ jsx(
98
+ Component,
99
+ {
100
+ as: "td",
101
+ "data-slot": "table-cell",
102
+ className: cn(
103
+ "p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
104
+ className
105
+ ),
106
+ ...props
107
+ }
108
+ );
109
+ }
110
+ TableCell.displayName = displayNameCell;
111
+ function TableCaption({ className, ...props }) {
112
+ const { [displayNameCaption]: Component = DefaultComponent } = useStackShiftUIComponents();
113
+ return /* @__PURE__ */ jsx(
114
+ Component,
115
+ {
116
+ as: "caption",
117
+ "data-slot": "table-caption",
118
+ className: cn("text-muted-foreground mt-4 text-sm", className),
119
+ ...props
120
+ }
121
+ );
122
+ }
123
+ TableCaption.displayName = displayNameCaption;
124
+
125
+ export {
126
+ Table,
127
+ TableHeader,
128
+ TableBody,
129
+ TableFooter,
130
+ TableRow,
131
+ TableHead,
132
+ TableCell,
133
+ TableCaption
134
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stackshift-ui/table",
3
3
  "description": "A responsive table component.",
4
- "version": "1.0.0-beta.2",
4
+ "version": "1.0.0-beta.4",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "main": "./dist/index.js",
@@ -29,20 +29,20 @@
29
29
  "typescript": "^5.6.2",
30
30
  "vite-tsconfig-paths": "^5.0.1",
31
31
  "vitest": "^2.1.1",
32
- "@stackshift-ui/typescript-config": "6.0.10",
33
- "@stackshift-ui/eslint-config": "6.0.10"
32
+ "@stackshift-ui/eslint-config": "6.0.10",
33
+ "@stackshift-ui/typescript-config": "6.0.10"
34
34
  },
35
35
  "dependencies": {
36
36
  "classnames": "^2.5.1",
37
- "@stackshift-ui/system": "6.1.0-beta.1",
38
- "@stackshift-ui/scripts": "6.1.0-beta.0"
37
+ "@stackshift-ui/system": "6.1.0-beta.3",
38
+ "@stackshift-ui/scripts": "6.1.0-beta.2"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "@types/react": "16.8 - 19",
42
42
  "next": "10 - 14",
43
43
  "react": "16.8 - 19",
44
44
  "react-dom": "16.8 - 19",
45
- "@stackshift-ui/system": ">=6.1.0-beta.1"
45
+ "@stackshift-ui/system": ">=6.1.0-beta.3"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "next": {