@adapttable/shadcn 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,12 @@
1
+ # @adapttable/shadcn
2
+
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - c90b4ae: Add **`@adapttable/shadcn`** โ€” a shadcn/ui adapter that gives a fully-styled AdaptTable in a single import (`import { DataTable } from "@adapttable/shadcn"`). It wraps `@adapttable/unstyled` with the shadcn class preset applied by default; pass your own `classNames` to override any part, or import the raw `shadcnClassNames` map directly. Requires shadcn/ui (its CSS variables + Tailwind config) in your app.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [0fe5eca]
12
+ - @adapttable/unstyled@0.2.2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Orwa Mahmoud
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # @adapttable/shadcn
2
+
3
+ ![@adapttable/shadcn โ€” a shadcn/ui data table built on AdaptTable](https://raw.githubusercontent.com/orwa-mahmoud/adapttable/main/assets/hero-shadcn.png)
4
+
5
+ **[๐Ÿ“– Documentation](https://orwa-mahmoud.github.io/adapttable/)** ยท **[๐Ÿš€ Live demo](https://orwa-mahmoud.github.io/adapttable/demo/)** ยท **[Get started](https://orwa-mahmoud.github.io/adapttable/getting-started/)**
6
+
7
+ The **shadcn/ui adapter** for [AdaptTable](https://github.com/orwa-mahmoud/adapttable) โ€”
8
+ a fully-styled React data table in **one import**, with sorting, filtering,
9
+ URL-synced state, selection + bulk actions, column management, RTL, and dark
10
+ mode. It's a thin wrapper over `@adapttable/unstyled` that applies the shadcn
11
+ class preset for you, built on the headless `@adapttable/core` engine.
12
+
13
+ ```bash
14
+ pnpm add @adapttable/shadcn @adapttable/core react react-dom
15
+ ```
16
+
17
+ > Requires shadcn/ui set up in your app (its CSS variables + Tailwind config) โ€”
18
+ > this adapter only references shadcn's design tokens (`bg-card`,
19
+ > `text-muted-foreground`, `border-border`, `bg-primary`, โ€ฆ).
20
+
21
+ ## Quickstart
22
+
23
+ ```tsx
24
+ import { DataTable, useFrontendData, type ColumnDef } from "@adapttable/shadcn";
25
+
26
+ interface Person {
27
+ id: string;
28
+ name: string;
29
+ city: string;
30
+ }
31
+
32
+ const columns: ColumnDef<Person>[] = [
33
+ { key: "name", header: "Name", accessor: (r) => r.name, sortable: true },
34
+ { key: "city", header: "City", accessor: (r) => r.city },
35
+ ];
36
+
37
+ export function People({ data }: { data: Person[] }) {
38
+ const source = useFrontendData<Person>({ data, columns });
39
+ return <DataTable source={source} columns={columns} rowKey={(r) => r.id} />;
40
+ }
41
+ ```
42
+
43
+ That's it โ€” a styled shadcn table, no class wiring. Swap `useFrontendData` for
44
+ `useBackendData` to drive it from a server-paginated query; the component doesn't
45
+ change.
46
+
47
+ ## Customizing
48
+
49
+ Restyle any part by passing your own `classNames` โ€” they're merged **over** the
50
+ preset, per part, so you only override what you name:
51
+
52
+ ```tsx
53
+ <DataTable
54
+ source={source}
55
+ columns={columns}
56
+ rowKey={(r) => r.id}
57
+ classNames={{ root: "rounded-2xl border-2 border-primary" }} // only the root changes
58
+ />
59
+ ```
60
+
61
+ Need the raw class map (e.g. to spread into your own `@adapttable/unstyled`
62
+ table)? It's exported:
63
+
64
+ ```tsx
65
+ import { shadcnClassNames } from "@adapttable/shadcn";
66
+ ```
67
+
68
+ ## Documentation
69
+
70
+ [Getting started](https://orwa-mahmoud.github.io/adapttable/getting-started/) ยท [Live demo](https://orwa-mahmoud.github.io/adapttable/demo/) ยท [Comparison vs ag-Grid ยท MUI X ยท TanStack](https://orwa-mahmoud.github.io/adapttable/comparison/)
71
+
72
+ - **Data** โ€” [client vs server tiers](https://orwa-mahmoud.github.io/adapttable/data-tiers/) ยท [pagination & infinite scroll](https://orwa-mahmoud.github.io/adapttable/pagination/) ยท [URL-synced state](https://orwa-mahmoud.github.io/adapttable/url-state/)
73
+ - **Interaction** โ€” [filtering](https://orwa-mahmoud.github.io/adapttable/filtering/) ยท [sorting](https://orwa-mahmoud.github.io/adapttable/sorting/) ยท [selection & bulk actions](https://orwa-mahmoud.github.io/adapttable/selection/) ยท [row expansion](https://orwa-mahmoud.github.io/adapttable/row-expansion/)
74
+ - **Columns** โ€” [show/hide ยท reorder ยท pin ยท resize](https://orwa-mahmoud.github.io/adapttable/column-management/)
75
+ - **More** โ€” [i18n & RTL](https://orwa-mahmoud.github.io/adapttable/i18n-rtl/) ยท [virtualization](https://orwa-mahmoud.github.io/adapttable/virtualization/) ยท [customization](https://orwa-mahmoud.github.io/adapttable/customization/) ยท [API](https://orwa-mahmoud.github.io/adapttable/api/) ยท [FAQ](https://orwa-mahmoud.github.io/adapttable/faq/)
76
+
77
+ ## License
78
+
79
+ [MIT](./LICENSE) ยฉ Orwa Mahmoud
80
+
81
+ ---
82
+
83
+ <div align="center">
84
+ <sub>Keywords: shadcn table, shadcn/ui data table, react data table, tailwind table, headless table, server-side pagination, url state, rtl table, typescript, dark mode.</sub>
85
+ </div>
package/dist/index.cjs ADDED
@@ -0,0 +1,133 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let react_compiler_runtime = require("react-compiler-runtime");
3
+ let _adapttable_unstyled = require("@adapttable/unstyled");
4
+ let react_jsx_runtime = require("react/jsx-runtime");
5
+ //#region src/classNames.ts
6
+ /**
7
+ * shadcn/ui class preset for AdaptTable. Maps every AdaptTable part to shadcn's
8
+ * design-token utility classes (`bg-card`, `text-muted-foreground`,
9
+ * `border-border`, `bg-primary`, `ring-ring`, โ€ฆ) โ€” deliberately **monochrome
10
+ * with ring focus**, the shadcn signature.
11
+ *
12
+ * It only *references* shadcn's tokens, so your app must have shadcn/ui set up
13
+ * (its CSS variables + Tailwind config). Pass this to a `@adapttable/unstyled`
14
+ * `<DataTable classNames={shadcnClassNames} />`, or just import the pre-wired
15
+ * `DataTable` from `@adapttable/shadcn`. Override any part by merging your own
16
+ * classes over it.
17
+ */
18
+ const shadcnClassNames = {
19
+ root: "rounded-xl border border-border bg-card text-card-foreground shadow-sm",
20
+ toolbar: "flex flex-wrap items-center gap-2 p-3 border-b border-border",
21
+ searchField: "flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 focus-within:ring-offset-background",
22
+ searchIcon: "text-muted-foreground",
23
+ search: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
24
+ sortSelect: "h-9 rounded-md border border-input bg-background px-2 text-sm",
25
+ rowsPerPageSelect: "h-8 rounded-md border border-input bg-background px-1.5 text-sm text-foreground",
26
+ filtersButton: "shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent hover:text-accent-foreground",
27
+ filtersBackdrop: "fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",
28
+ filtersPanel: "fixed inset-y-0 end-0 z-50 flex w-[340px] max-w-[88vw] flex-col border-s border-border bg-card text-card-foreground shadow-2xl",
29
+ filtersPopover: "z-50 mt-2 w-80 max-w-[88vw] overflow-hidden rounded-lg border border-border bg-card text-card-foreground shadow-xl",
30
+ filtersCount: "inline-grid h-5 min-w-5 place-items-center rounded-full bg-primary px-1 text-xs font-bold leading-none text-primary-foreground",
31
+ filtersHeader: "flex items-center justify-between border-b border-border px-4 py-3",
32
+ filtersTitle: "text-base font-semibold",
33
+ filtersClose: "flex h-8 w-8 items-center justify-center rounded-md text-lg leading-none text-muted-foreground hover:bg-accent",
34
+ filtersBody: "flex flex-1 flex-col gap-4 overflow-auto p-4",
35
+ filterField: "m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0",
36
+ filterLabel: "p-0 text-xs font-medium text-muted-foreground",
37
+ filterInput: "h-9 w-full rounded-md border border-input bg-background px-2.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring",
38
+ filterSelect: "h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring",
39
+ filterCheckboxGroup: "flex flex-wrap gap-1.5",
40
+ filterCheckbox: "inline-flex cursor-pointer select-none items-center rounded-full border border-input bg-background px-3 py-1 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground has-[:checked]:border-primary has-[:checked]:bg-primary has-[:checked]:text-primary-foreground [&>input]:sr-only",
41
+ filtersFooter: "flex items-center justify-between gap-2 border-t border-border p-4",
42
+ filtersClear: "h-9 rounded-md px-3 text-sm text-muted-foreground hover:bg-accent disabled:opacity-50",
43
+ filtersDone: "h-9 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90",
44
+ table: "w-full border-collapse text-sm",
45
+ headerCell: "border-b border-border bg-card px-3 py-2.5 text-start font-medium text-muted-foreground",
46
+ sortButton: "inline-flex items-center gap-1 font-medium hover:text-foreground",
47
+ row: "border-b border-border last:border-0 hover:bg-muted/50 data-[selected]:bg-accent",
48
+ cell: "px-3 py-2.5 [&[data-pinned]]:bg-card",
49
+ actionButton: "h-8 w-8 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",
50
+ footer: "flex items-center justify-between gap-2 border-t border-border p-3 text-sm text-muted-foreground",
51
+ pageButton: "inline-grid h-8 min-w-8 place-items-center rounded-md border border-input bg-background px-2 text-foreground hover:bg-accent disabled:opacity-40",
52
+ chips: "flex flex-wrap gap-2 px-3 pb-2",
53
+ chip: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-xs text-muted-foreground",
54
+ chipRemove: "rounded px-1 text-muted-foreground transition-colors hover:text-foreground",
55
+ empty: "flex flex-wrap items-center justify-center gap-3 px-4 py-10 text-sm text-muted-foreground",
56
+ emptyClear: "rounded-md border border-input px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted",
57
+ columnMenuButton: "shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent data-[active]:bg-accent",
58
+ columnMenuPanel: "z-50 min-w-[264px] rounded-xl border border-border bg-card p-1.5 text-card-foreground shadow-xl",
59
+ columnMenuHeader: "px-1.5 pb-1.5 pt-1",
60
+ columnMenuTitle: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",
61
+ columnMenuItem: "flex cursor-grab items-center gap-2 rounded-md px-1.5 py-1.5 hover:bg-muted/60",
62
+ columnMenuGrip: "inline-flex cursor-grab text-muted-foreground/50 hover:text-foreground",
63
+ columnMenuLabel: "flex-1 truncate text-[13px] font-medium data-[hidden]:text-muted-foreground data-[hidden]:line-through",
64
+ columnMenuVisibility: "inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted hover:text-foreground",
65
+ columnMenuPin: "inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted data-[active]:text-primary",
66
+ columnMenuReset: "mt-1.5 w-full border-t border-border px-2 pb-1 pt-2 text-start text-[13px] font-medium text-primary hover:opacity-80",
67
+ resizeHandle: "hover:bg-border",
68
+ card: "mb-2 rounded-lg border border-border p-3",
69
+ cardRow: "flex justify-between gap-3 py-0.5 text-sm",
70
+ cardLabel: "text-muted-foreground",
71
+ cardValue: "font-medium"
72
+ };
73
+ //#endregion
74
+ //#region src/DataTable.tsx
75
+ /**
76
+ * AdaptTable, pre-styled with **shadcn/ui** design tokens โ€” a fully-styled data
77
+ * table in a single import. A thin wrapper over `@adapttable/unstyled` that
78
+ * applies the {@link shadcnClassNames} preset, so you don't hand-wire the
79
+ * class map.
80
+ *
81
+ * Requires shadcn/ui set up in your app (its CSS variables + Tailwind config).
82
+ * Restyle any part by passing your own `classNames` โ€” they're merged **over**
83
+ * the preset, per part, so `classNames={{ root: "โ€ฆ" }}` only replaces the root.
84
+ *
85
+ * @typeParam TRow - The row type.
86
+ */
87
+ function DataTable(props) {
88
+ const $ = (0, react_compiler_runtime.c)(8);
89
+ let classNames;
90
+ let rest;
91
+ if ($[0] !== props) {
92
+ ({classNames, ...rest} = props);
93
+ $[0] = props;
94
+ $[1] = classNames;
95
+ $[2] = rest;
96
+ } else {
97
+ classNames = $[1];
98
+ rest = $[2];
99
+ }
100
+ let t0;
101
+ if ($[3] !== classNames) {
102
+ t0 = classNames ? {
103
+ ...shadcnClassNames,
104
+ ...classNames
105
+ } : shadcnClassNames;
106
+ $[3] = classNames;
107
+ $[4] = t0;
108
+ } else t0 = $[4];
109
+ let t1;
110
+ if ($[5] !== rest || $[6] !== t0) {
111
+ t1 = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_adapttable_unstyled.DataTable, {
112
+ ...rest,
113
+ classNames: t0
114
+ });
115
+ $[5] = rest;
116
+ $[6] = t0;
117
+ $[7] = t1;
118
+ } else t1 = $[7];
119
+ return t1;
120
+ }
121
+ //#endregion
122
+ exports.DataTable = DataTable;
123
+ exports.shadcnClassNames = shadcnClassNames;
124
+ Object.keys(_adapttable_unstyled).forEach(function(k) {
125
+ if (k !== "default" && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
126
+ enumerable: true,
127
+ get: function() {
128
+ return _adapttable_unstyled[k];
129
+ }
130
+ });
131
+ });
132
+
133
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","names":["shadcnClassNames","root","toolbar","searchField","searchIcon","search","sortSelect","rowsPerPageSelect","filtersButton","filtersBackdrop","filtersPanel","filtersPopover","filtersCount","filtersHeader","filtersTitle","filtersClose","filtersBody","filterField","filterLabel","filterInput","filterSelect","filterCheckboxGroup","filterCheckbox","filtersFooter","filtersClear","filtersDone","table","headerCell","sortButton","row","cell","actionButton","footer","pageButton","chips","chip","chipRemove","empty","emptyClear","columnMenuButton","columnMenuPanel","columnMenuHeader","columnMenuTitle","columnMenuItem","columnMenuGrip","columnMenuLabel","columnMenuVisibility","columnMenuPin","columnMenuReset","resizeHandle","card","cardRow","cardLabel","cardValue","DataTable","UnstyledDataTable","shadcnClassNames","props","$","_c","classNames","rest","t0","t1"],"sources":["../src/classNames.ts","../src/DataTable.tsx"],"sourcesContent":["import type { DataTableClassNames } from \"@adapttable/unstyled\";\n\n/**\n * shadcn/ui class preset for AdaptTable. Maps every AdaptTable part to shadcn's\n * design-token utility classes (`bg-card`, `text-muted-foreground`,\n * `border-border`, `bg-primary`, `ring-ring`, โ€ฆ) โ€” deliberately **monochrome\n * with ring focus**, the shadcn signature.\n *\n * It only *references* shadcn's tokens, so your app must have shadcn/ui set up\n * (its CSS variables + Tailwind config). Pass this to a `@adapttable/unstyled`\n * `<DataTable classNames={shadcnClassNames} />`, or just import the pre-wired\n * `DataTable` from `@adapttable/shadcn`. Override any part by merging your own\n * classes over it.\n */\nexport const shadcnClassNames: DataTableClassNames = {\n root: \"rounded-xl border border-border bg-card text-card-foreground shadow-sm\",\n toolbar: \"flex flex-wrap items-center gap-2 p-3 border-b border-border\",\n searchField:\n \"flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 focus-within:ring-offset-background\",\n searchIcon: \"text-muted-foreground\",\n search:\n \"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground\",\n sortSelect: \"h-9 rounded-md border border-input bg-background px-2 text-sm\",\n rowsPerPageSelect:\n \"h-8 rounded-md border border-input bg-background px-1.5 text-sm text-foreground\",\n filtersButton:\n \"shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent hover:text-accent-foreground\",\n filtersBackdrop: \"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]\",\n filtersPanel:\n \"fixed inset-y-0 end-0 z-50 flex w-[340px] max-w-[88vw] flex-col border-s border-border bg-card text-card-foreground shadow-2xl\",\n filtersPopover:\n \"z-50 mt-2 w-80 max-w-[88vw] overflow-hidden rounded-lg border border-border bg-card text-card-foreground shadow-xl\",\n filtersCount:\n \"inline-grid h-5 min-w-5 place-items-center rounded-full bg-primary px-1 text-xs font-bold leading-none text-primary-foreground\",\n filtersHeader:\n \"flex items-center justify-between border-b border-border px-4 py-3\",\n filtersTitle: \"text-base font-semibold\",\n filtersClose:\n \"flex h-8 w-8 items-center justify-center rounded-md text-lg leading-none text-muted-foreground hover:bg-accent\",\n filtersBody: \"flex flex-1 flex-col gap-4 overflow-auto p-4\",\n // โ”€โ”€ Auto-built filter form (declarative `filters` definitions) โ”€โ”€\n filterField: \"m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0\",\n filterLabel: \"p-0 text-xs font-medium text-muted-foreground\",\n filterInput:\n \"h-9 w-full rounded-md border border-input bg-background px-2.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring\",\n filterSelect:\n \"h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring\",\n filterCheckboxGroup: \"flex flex-wrap gap-1.5\",\n filterCheckbox:\n \"inline-flex cursor-pointer select-none items-center rounded-full border border-input bg-background px-3 py-1 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground has-[:checked]:border-primary has-[:checked]:bg-primary has-[:checked]:text-primary-foreground [&>input]:sr-only\",\n filtersFooter:\n \"flex items-center justify-between gap-2 border-t border-border p-4\",\n filtersClear:\n \"h-9 rounded-md px-3 text-sm text-muted-foreground hover:bg-accent disabled:opacity-50\",\n filtersDone:\n \"h-9 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90\",\n table: \"w-full border-collapse text-sm\",\n headerCell:\n \"border-b border-border bg-card px-3 py-2.5 text-start font-medium text-muted-foreground\",\n sortButton:\n \"inline-flex items-center gap-1 font-medium hover:text-foreground\",\n row: \"border-b border-border last:border-0 hover:bg-muted/50 data-[selected]:bg-accent\",\n // Pinned cells must be opaque so scrolled content never shows through.\n cell: \"px-3 py-2.5 [&[data-pinned]]:bg-card\",\n actionButton:\n \"h-8 w-8 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50\",\n footer:\n \"flex items-center justify-between gap-2 border-t border-border p-3 text-sm text-muted-foreground\",\n pageButton:\n \"inline-grid h-8 min-w-8 place-items-center rounded-md border border-input bg-background px-2 text-foreground hover:bg-accent disabled:opacity-40\",\n chips: \"flex flex-wrap gap-2 px-3 pb-2\",\n chip: \"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-xs text-muted-foreground\",\n chipRemove:\n \"rounded px-1 text-muted-foreground transition-colors hover:text-foreground\",\n empty:\n \"flex flex-wrap items-center justify-center gap-3 px-4 py-10 text-sm text-muted-foreground\",\n emptyClear:\n \"rounded-md border border-input px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted\",\n // โ”€โ”€ Column popover โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n columnMenuButton:\n \"shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent data-[active]:bg-accent\",\n columnMenuPanel:\n \"z-50 min-w-[264px] rounded-xl border border-border bg-card p-1.5 text-card-foreground shadow-xl\",\n columnMenuHeader: \"px-1.5 pb-1.5 pt-1\",\n columnMenuTitle:\n \"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\",\n columnMenuItem:\n \"flex cursor-grab items-center gap-2 rounded-md px-1.5 py-1.5 hover:bg-muted/60\",\n columnMenuGrip:\n \"inline-flex cursor-grab text-muted-foreground/50 hover:text-foreground\",\n columnMenuLabel:\n \"flex-1 truncate text-[13px] font-medium data-[hidden]:text-muted-foreground data-[hidden]:line-through\",\n columnMenuVisibility:\n \"inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted hover:text-foreground\",\n columnMenuPin:\n \"inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted data-[active]:text-primary\",\n columnMenuReset:\n \"mt-1.5 w-full border-t border-border px-2 pb-1 pt-2 text-start text-[13px] font-medium text-primary hover:opacity-80\",\n resizeHandle: \"hover:bg-border\",\n card: \"mb-2 rounded-lg border border-border p-3\",\n cardRow: \"flex justify-between gap-3 py-0.5 text-sm\",\n cardLabel: \"text-muted-foreground\",\n cardValue: \"font-medium\",\n};\n","import {\n DataTable as UnstyledDataTable,\n type DataTableProps,\n} from \"@adapttable/unstyled\";\n\nimport { shadcnClassNames } from \"./classNames\";\n\n/**\n * AdaptTable, pre-styled with **shadcn/ui** design tokens โ€” a fully-styled data\n * table in a single import. A thin wrapper over `@adapttable/unstyled` that\n * applies the {@link shadcnClassNames} preset, so you don't hand-wire the\n * class map.\n *\n * Requires shadcn/ui set up in your app (its CSS variables + Tailwind config).\n * Restyle any part by passing your own `classNames` โ€” they're merged **over**\n * the preset, per part, so `classNames={{ root: \"โ€ฆ\" }}` only replaces the root.\n *\n * @typeParam TRow - The row type.\n */\nexport function DataTable<TRow>(props: Readonly<DataTableProps<TRow>>) {\n const { classNames, ...rest } = props;\n return (\n <UnstyledDataTable\n {...rest}\n classNames={\n classNames ? { ...shadcnClassNames, ...classNames } : shadcnClassNames\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAaA,mBAAwC;CACnDC,MAAM;CACNC,SAAS;CACTC,aACE;CACFC,YAAY;CACZC,QACE;CACFC,YAAY;CACZC,mBACE;CACFC,eACE;CACFC,iBAAiB;CACjBC,cACE;CACFC,gBACE;CACFC,cACE;CACFC,eACE;CACFC,cAAc;CACdC,cACE;CACFC,aAAa;CAEbC,aAAa;CACbC,aAAa;CACbC,aACE;CACFC,cACE;CACFC,qBAAqB;CACrBC,gBACE;CACFC,eACE;CACFC,cACE;CACFC,aACE;CACFC,OAAO;CACPC,YACE;CACFC,YACE;CACFC,KAAK;CAELC,MAAM;CACNC,cACE;CACFC,QACE;CACFC,YACE;CACFC,OAAO;CACPC,MAAM;CACNC,YACE;CACFC,OACE;CACFC,YACE;CAEFC,kBACE;CACFC,iBACE;CACFC,kBAAkB;CAClBC,iBACE;CACFC,gBACE;CACFC,gBACE;CACFC,iBACE;CACFC,sBACE;CACFC,eACE;CACFC,iBACE;CACFC,cAAc;CACdC,MAAM;CACNC,SAAS;CACTC,WAAW;CACXC,WAAW;AACb;;;;;;;;;;;;;;;ACpFA,SAAOC,UAAAG,OAAA;CAAA,MAAAC,KAAAA,GAAAA,uBAAAA,EAAAA,CAAA,CAAA;CAAA,IAAAE;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,OAAA;EACL,CAAA,CAAAG,eAAAC,QAAgCJ;EAAMC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAD,aAAAF,EAAA;EAAAG,OAAAH,EAAA;CAAA;CAAA,IAAAI;CAAA,IAAAJ,EAAA,OAAAE,YAAA;EAKhCE,KAAAF,aAAA;GAAA,GAAkBJ;GAAgB,GAAKI;EAA8B,IAArEJ;EAAsEE,EAAA,KAAAE;EAAAF,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAG,QAAAH,EAAA,OAAAI,IAAA;EAH1EC,KAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,qBAAA,WAAD;GAAkB,GACZF;GAEF,YAAAC;EAAsE,CAAA;EAExEJ,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OALFK;AAKE"}
@@ -0,0 +1,35 @@
1
+ import { DataTableClassNames, DataTableProps } from "@adapttable/unstyled";
2
+ export * from "@adapttable/unstyled";
3
+
4
+ //#region src/classNames.d.ts
5
+ /**
6
+ * shadcn/ui class preset for AdaptTable. Maps every AdaptTable part to shadcn's
7
+ * design-token utility classes (`bg-card`, `text-muted-foreground`,
8
+ * `border-border`, `bg-primary`, `ring-ring`, โ€ฆ) โ€” deliberately **monochrome
9
+ * with ring focus**, the shadcn signature.
10
+ *
11
+ * It only *references* shadcn's tokens, so your app must have shadcn/ui set up
12
+ * (its CSS variables + Tailwind config). Pass this to a `@adapttable/unstyled`
13
+ * `<DataTable classNames={shadcnClassNames} />`, or just import the pre-wired
14
+ * `DataTable` from `@adapttable/shadcn`. Override any part by merging your own
15
+ * classes over it.
16
+ */
17
+ declare const shadcnClassNames: DataTableClassNames;
18
+ //#endregion
19
+ //#region src/DataTable.d.ts
20
+ /**
21
+ * AdaptTable, pre-styled with **shadcn/ui** design tokens โ€” a fully-styled data
22
+ * table in a single import. A thin wrapper over `@adapttable/unstyled` that
23
+ * applies the {@link shadcnClassNames} preset, so you don't hand-wire the
24
+ * class map.
25
+ *
26
+ * Requires shadcn/ui set up in your app (its CSS variables + Tailwind config).
27
+ * Restyle any part by passing your own `classNames` โ€” they're merged **over**
28
+ * the preset, per part, so `classNames={{ root: "โ€ฆ" }}` only replaces the root.
29
+ *
30
+ * @typeParam TRow - The row type.
31
+ */
32
+ declare function DataTable<TRow>(props: Readonly<DataTableProps<TRow>>): import("react").JSX.Element;
33
+ //#endregion
34
+ export { DataTable, shadcnClassNames };
35
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/classNames.ts","../src/DataTable.tsx"],"mappings":";;;;;;;;AAcA;;;;AAyFC;;;;cAzFY,gBAAA,EAAkB,mBAyF9B;;;;;;;AAzFD;;;;AAyFC;;;;iBCpFe,SAAA,OAAgB,KAAA,EAAO,QAAA,CAAS,cAAA,CAAe,IAAA,qBAAM,GAAA,CAAA,OAAA"}
@@ -0,0 +1,35 @@
1
+ import { DataTableClassNames, DataTableProps } from "@adapttable/unstyled";
2
+ export * from "@adapttable/unstyled";
3
+
4
+ //#region src/classNames.d.ts
5
+ /**
6
+ * shadcn/ui class preset for AdaptTable. Maps every AdaptTable part to shadcn's
7
+ * design-token utility classes (`bg-card`, `text-muted-foreground`,
8
+ * `border-border`, `bg-primary`, `ring-ring`, โ€ฆ) โ€” deliberately **monochrome
9
+ * with ring focus**, the shadcn signature.
10
+ *
11
+ * It only *references* shadcn's tokens, so your app must have shadcn/ui set up
12
+ * (its CSS variables + Tailwind config). Pass this to a `@adapttable/unstyled`
13
+ * `<DataTable classNames={shadcnClassNames} />`, or just import the pre-wired
14
+ * `DataTable` from `@adapttable/shadcn`. Override any part by merging your own
15
+ * classes over it.
16
+ */
17
+ declare const shadcnClassNames: DataTableClassNames;
18
+ //#endregion
19
+ //#region src/DataTable.d.ts
20
+ /**
21
+ * AdaptTable, pre-styled with **shadcn/ui** design tokens โ€” a fully-styled data
22
+ * table in a single import. A thin wrapper over `@adapttable/unstyled` that
23
+ * applies the {@link shadcnClassNames} preset, so you don't hand-wire the
24
+ * class map.
25
+ *
26
+ * Requires shadcn/ui set up in your app (its CSS variables + Tailwind config).
27
+ * Restyle any part by passing your own `classNames` โ€” they're merged **over**
28
+ * the preset, per part, so `classNames={{ root: "โ€ฆ" }}` only replaces the root.
29
+ *
30
+ * @typeParam TRow - The row type.
31
+ */
32
+ declare function DataTable<TRow>(props: Readonly<DataTableProps<TRow>>): import("react").JSX.Element;
33
+ //#endregion
34
+ export { DataTable, shadcnClassNames };
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/classNames.ts","../src/DataTable.tsx"],"mappings":";;;;;;;;AAcA;;;;AAyFC;;;;cAzFY,gBAAA,EAAkB,mBAyF9B;;;;;;;AAzFD;;;;AAyFC;;;;iBCpFe,SAAA,OAAgB,KAAA,EAAO,QAAA,CAAS,cAAA,CAAe,IAAA,qBAAM,GAAA,CAAA,OAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,124 @@
1
+ import { c } from "react-compiler-runtime";
2
+ import { DataTable as DataTable$1 } from "@adapttable/unstyled";
3
+ import { jsx } from "react/jsx-runtime";
4
+ export * from "@adapttable/unstyled";
5
+ //#region src/classNames.ts
6
+ /**
7
+ * shadcn/ui class preset for AdaptTable. Maps every AdaptTable part to shadcn's
8
+ * design-token utility classes (`bg-card`, `text-muted-foreground`,
9
+ * `border-border`, `bg-primary`, `ring-ring`, โ€ฆ) โ€” deliberately **monochrome
10
+ * with ring focus**, the shadcn signature.
11
+ *
12
+ * It only *references* shadcn's tokens, so your app must have shadcn/ui set up
13
+ * (its CSS variables + Tailwind config). Pass this to a `@adapttable/unstyled`
14
+ * `<DataTable classNames={shadcnClassNames} />`, or just import the pre-wired
15
+ * `DataTable` from `@adapttable/shadcn`. Override any part by merging your own
16
+ * classes over it.
17
+ */
18
+ const shadcnClassNames = {
19
+ root: "rounded-xl border border-border bg-card text-card-foreground shadow-sm",
20
+ toolbar: "flex flex-wrap items-center gap-2 p-3 border-b border-border",
21
+ searchField: "flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 focus-within:ring-offset-background",
22
+ searchIcon: "text-muted-foreground",
23
+ search: "w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground",
24
+ sortSelect: "h-9 rounded-md border border-input bg-background px-2 text-sm",
25
+ rowsPerPageSelect: "h-8 rounded-md border border-input bg-background px-1.5 text-sm text-foreground",
26
+ filtersButton: "shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent hover:text-accent-foreground",
27
+ filtersBackdrop: "fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]",
28
+ filtersPanel: "fixed inset-y-0 end-0 z-50 flex w-[340px] max-w-[88vw] flex-col border-s border-border bg-card text-card-foreground shadow-2xl",
29
+ filtersPopover: "z-50 mt-2 w-80 max-w-[88vw] overflow-hidden rounded-lg border border-border bg-card text-card-foreground shadow-xl",
30
+ filtersCount: "inline-grid h-5 min-w-5 place-items-center rounded-full bg-primary px-1 text-xs font-bold leading-none text-primary-foreground",
31
+ filtersHeader: "flex items-center justify-between border-b border-border px-4 py-3",
32
+ filtersTitle: "text-base font-semibold",
33
+ filtersClose: "flex h-8 w-8 items-center justify-center rounded-md text-lg leading-none text-muted-foreground hover:bg-accent",
34
+ filtersBody: "flex flex-1 flex-col gap-4 overflow-auto p-4",
35
+ filterField: "m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0",
36
+ filterLabel: "p-0 text-xs font-medium text-muted-foreground",
37
+ filterInput: "h-9 w-full rounded-md border border-input bg-background px-2.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring",
38
+ filterSelect: "h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring",
39
+ filterCheckboxGroup: "flex flex-wrap gap-1.5",
40
+ filterCheckbox: "inline-flex cursor-pointer select-none items-center rounded-full border border-input bg-background px-3 py-1 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground has-[:checked]:border-primary has-[:checked]:bg-primary has-[:checked]:text-primary-foreground [&>input]:sr-only",
41
+ filtersFooter: "flex items-center justify-between gap-2 border-t border-border p-4",
42
+ filtersClear: "h-9 rounded-md px-3 text-sm text-muted-foreground hover:bg-accent disabled:opacity-50",
43
+ filtersDone: "h-9 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90",
44
+ table: "w-full border-collapse text-sm",
45
+ headerCell: "border-b border-border bg-card px-3 py-2.5 text-start font-medium text-muted-foreground",
46
+ sortButton: "inline-flex items-center gap-1 font-medium hover:text-foreground",
47
+ row: "border-b border-border last:border-0 hover:bg-muted/50 data-[selected]:bg-accent",
48
+ cell: "px-3 py-2.5 [&[data-pinned]]:bg-card",
49
+ actionButton: "h-8 w-8 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50",
50
+ footer: "flex items-center justify-between gap-2 border-t border-border p-3 text-sm text-muted-foreground",
51
+ pageButton: "inline-grid h-8 min-w-8 place-items-center rounded-md border border-input bg-background px-2 text-foreground hover:bg-accent disabled:opacity-40",
52
+ chips: "flex flex-wrap gap-2 px-3 pb-2",
53
+ chip: "inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-xs text-muted-foreground",
54
+ chipRemove: "rounded px-1 text-muted-foreground transition-colors hover:text-foreground",
55
+ empty: "flex flex-wrap items-center justify-center gap-3 px-4 py-10 text-sm text-muted-foreground",
56
+ emptyClear: "rounded-md border border-input px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted",
57
+ columnMenuButton: "shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent data-[active]:bg-accent",
58
+ columnMenuPanel: "z-50 min-w-[264px] rounded-xl border border-border bg-card p-1.5 text-card-foreground shadow-xl",
59
+ columnMenuHeader: "px-1.5 pb-1.5 pt-1",
60
+ columnMenuTitle: "text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",
61
+ columnMenuItem: "flex cursor-grab items-center gap-2 rounded-md px-1.5 py-1.5 hover:bg-muted/60",
62
+ columnMenuGrip: "inline-flex cursor-grab text-muted-foreground/50 hover:text-foreground",
63
+ columnMenuLabel: "flex-1 truncate text-[13px] font-medium data-[hidden]:text-muted-foreground data-[hidden]:line-through",
64
+ columnMenuVisibility: "inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted hover:text-foreground",
65
+ columnMenuPin: "inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted data-[active]:text-primary",
66
+ columnMenuReset: "mt-1.5 w-full border-t border-border px-2 pb-1 pt-2 text-start text-[13px] font-medium text-primary hover:opacity-80",
67
+ resizeHandle: "hover:bg-border",
68
+ card: "mb-2 rounded-lg border border-border p-3",
69
+ cardRow: "flex justify-between gap-3 py-0.5 text-sm",
70
+ cardLabel: "text-muted-foreground",
71
+ cardValue: "font-medium"
72
+ };
73
+ //#endregion
74
+ //#region src/DataTable.tsx
75
+ /**
76
+ * AdaptTable, pre-styled with **shadcn/ui** design tokens โ€” a fully-styled data
77
+ * table in a single import. A thin wrapper over `@adapttable/unstyled` that
78
+ * applies the {@link shadcnClassNames} preset, so you don't hand-wire the
79
+ * class map.
80
+ *
81
+ * Requires shadcn/ui set up in your app (its CSS variables + Tailwind config).
82
+ * Restyle any part by passing your own `classNames` โ€” they're merged **over**
83
+ * the preset, per part, so `classNames={{ root: "โ€ฆ" }}` only replaces the root.
84
+ *
85
+ * @typeParam TRow - The row type.
86
+ */
87
+ function DataTable(props) {
88
+ const $ = c(8);
89
+ let classNames;
90
+ let rest;
91
+ if ($[0] !== props) {
92
+ ({classNames, ...rest} = props);
93
+ $[0] = props;
94
+ $[1] = classNames;
95
+ $[2] = rest;
96
+ } else {
97
+ classNames = $[1];
98
+ rest = $[2];
99
+ }
100
+ let t0;
101
+ if ($[3] !== classNames) {
102
+ t0 = classNames ? {
103
+ ...shadcnClassNames,
104
+ ...classNames
105
+ } : shadcnClassNames;
106
+ $[3] = classNames;
107
+ $[4] = t0;
108
+ } else t0 = $[4];
109
+ let t1;
110
+ if ($[5] !== rest || $[6] !== t0) {
111
+ t1 = /* @__PURE__ */ jsx(DataTable$1, {
112
+ ...rest,
113
+ classNames: t0
114
+ });
115
+ $[5] = rest;
116
+ $[6] = t0;
117
+ $[7] = t1;
118
+ } else t1 = $[7];
119
+ return t1;
120
+ }
121
+ //#endregion
122
+ export { DataTable, shadcnClassNames };
123
+
124
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["shadcnClassNames","root","toolbar","searchField","searchIcon","search","sortSelect","rowsPerPageSelect","filtersButton","filtersBackdrop","filtersPanel","filtersPopover","filtersCount","filtersHeader","filtersTitle","filtersClose","filtersBody","filterField","filterLabel","filterInput","filterSelect","filterCheckboxGroup","filterCheckbox","filtersFooter","filtersClear","filtersDone","table","headerCell","sortButton","row","cell","actionButton","footer","pageButton","chips","chip","chipRemove","empty","emptyClear","columnMenuButton","columnMenuPanel","columnMenuHeader","columnMenuTitle","columnMenuItem","columnMenuGrip","columnMenuLabel","columnMenuVisibility","columnMenuPin","columnMenuReset","resizeHandle","card","cardRow","cardLabel","cardValue","DataTable","UnstyledDataTable","shadcnClassNames","props","$","_c","classNames","rest","t0","t1"],"sources":["../src/classNames.ts","../src/DataTable.tsx"],"sourcesContent":["import type { DataTableClassNames } from \"@adapttable/unstyled\";\n\n/**\n * shadcn/ui class preset for AdaptTable. Maps every AdaptTable part to shadcn's\n * design-token utility classes (`bg-card`, `text-muted-foreground`,\n * `border-border`, `bg-primary`, `ring-ring`, โ€ฆ) โ€” deliberately **monochrome\n * with ring focus**, the shadcn signature.\n *\n * It only *references* shadcn's tokens, so your app must have shadcn/ui set up\n * (its CSS variables + Tailwind config). Pass this to a `@adapttable/unstyled`\n * `<DataTable classNames={shadcnClassNames} />`, or just import the pre-wired\n * `DataTable` from `@adapttable/shadcn`. Override any part by merging your own\n * classes over it.\n */\nexport const shadcnClassNames: DataTableClassNames = {\n root: \"rounded-xl border border-border bg-card text-card-foreground shadow-sm\",\n toolbar: \"flex flex-wrap items-center gap-2 p-3 border-b border-border\",\n searchField:\n \"flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-1 focus-within:ring-offset-background\",\n searchIcon: \"text-muted-foreground\",\n search:\n \"w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground\",\n sortSelect: \"h-9 rounded-md border border-input bg-background px-2 text-sm\",\n rowsPerPageSelect:\n \"h-8 rounded-md border border-input bg-background px-1.5 text-sm text-foreground\",\n filtersButton:\n \"shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent hover:text-accent-foreground\",\n filtersBackdrop: \"fixed inset-0 z-40 bg-black/40 backdrop-blur-[1px]\",\n filtersPanel:\n \"fixed inset-y-0 end-0 z-50 flex w-[340px] max-w-[88vw] flex-col border-s border-border bg-card text-card-foreground shadow-2xl\",\n filtersPopover:\n \"z-50 mt-2 w-80 max-w-[88vw] overflow-hidden rounded-lg border border-border bg-card text-card-foreground shadow-xl\",\n filtersCount:\n \"inline-grid h-5 min-w-5 place-items-center rounded-full bg-primary px-1 text-xs font-bold leading-none text-primary-foreground\",\n filtersHeader:\n \"flex items-center justify-between border-b border-border px-4 py-3\",\n filtersTitle: \"text-base font-semibold\",\n filtersClose:\n \"flex h-8 w-8 items-center justify-center rounded-md text-lg leading-none text-muted-foreground hover:bg-accent\",\n filtersBody: \"flex flex-1 flex-col gap-4 overflow-auto p-4\",\n // โ”€โ”€ Auto-built filter form (declarative `filters` definitions) โ”€โ”€\n filterField: \"m-0 flex min-w-0 flex-col gap-1.5 border-0 p-0\",\n filterLabel: \"p-0 text-xs font-medium text-muted-foreground\",\n filterInput:\n \"h-9 w-full rounded-md border border-input bg-background px-2.5 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring\",\n filterSelect:\n \"h-9 w-full rounded-md border border-input bg-background px-2 text-sm text-foreground outline-none focus:ring-2 focus:ring-ring\",\n filterCheckboxGroup: \"flex flex-wrap gap-1.5\",\n filterCheckbox:\n \"inline-flex cursor-pointer select-none items-center rounded-full border border-input bg-background px-3 py-1 text-[13px] font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-accent-foreground has-[:checked]:border-primary has-[:checked]:bg-primary has-[:checked]:text-primary-foreground [&>input]:sr-only\",\n filtersFooter:\n \"flex items-center justify-between gap-2 border-t border-border p-4\",\n filtersClear:\n \"h-9 rounded-md px-3 text-sm text-muted-foreground hover:bg-accent disabled:opacity-50\",\n filtersDone:\n \"h-9 rounded-md bg-primary px-4 text-sm font-medium text-primary-foreground hover:bg-primary/90\",\n table: \"w-full border-collapse text-sm\",\n headerCell:\n \"border-b border-border bg-card px-3 py-2.5 text-start font-medium text-muted-foreground\",\n sortButton:\n \"inline-flex items-center gap-1 font-medium hover:text-foreground\",\n row: \"border-b border-border last:border-0 hover:bg-muted/50 data-[selected]:bg-accent\",\n // Pinned cells must be opaque so scrolled content never shows through.\n cell: \"px-3 py-2.5 [&[data-pinned]]:bg-card\",\n actionButton:\n \"h-8 w-8 rounded-md text-muted-foreground hover:bg-accent hover:text-foreground disabled:opacity-50\",\n footer:\n \"flex items-center justify-between gap-2 border-t border-border p-3 text-sm text-muted-foreground\",\n pageButton:\n \"inline-grid h-8 min-w-8 place-items-center rounded-md border border-input bg-background px-2 text-foreground hover:bg-accent disabled:opacity-40\",\n chips: \"flex flex-wrap gap-2 px-3 pb-2\",\n chip: \"inline-flex items-center gap-1 rounded-full bg-muted px-2 py-1 text-xs text-muted-foreground\",\n chipRemove:\n \"rounded px-1 text-muted-foreground transition-colors hover:text-foreground\",\n empty:\n \"flex flex-wrap items-center justify-center gap-3 px-4 py-10 text-sm text-muted-foreground\",\n emptyClear:\n \"rounded-md border border-input px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted\",\n // โ”€โ”€ Column popover โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€\n columnMenuButton:\n \"shrink-0 whitespace-nowrap inline-flex h-9 items-center gap-2 rounded-md border border-input bg-background px-3 text-sm font-medium hover:bg-accent data-[active]:bg-accent\",\n columnMenuPanel:\n \"z-50 min-w-[264px] rounded-xl border border-border bg-card p-1.5 text-card-foreground shadow-xl\",\n columnMenuHeader: \"px-1.5 pb-1.5 pt-1\",\n columnMenuTitle:\n \"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground\",\n columnMenuItem:\n \"flex cursor-grab items-center gap-2 rounded-md px-1.5 py-1.5 hover:bg-muted/60\",\n columnMenuGrip:\n \"inline-flex cursor-grab text-muted-foreground/50 hover:text-foreground\",\n columnMenuLabel:\n \"flex-1 truncate text-[13px] font-medium data-[hidden]:text-muted-foreground data-[hidden]:line-through\",\n columnMenuVisibility:\n \"inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted hover:text-foreground\",\n columnMenuPin:\n \"inline-grid place-items-center rounded p-[3px] text-muted-foreground hover:bg-muted data-[active]:text-primary\",\n columnMenuReset:\n \"mt-1.5 w-full border-t border-border px-2 pb-1 pt-2 text-start text-[13px] font-medium text-primary hover:opacity-80\",\n resizeHandle: \"hover:bg-border\",\n card: \"mb-2 rounded-lg border border-border p-3\",\n cardRow: \"flex justify-between gap-3 py-0.5 text-sm\",\n cardLabel: \"text-muted-foreground\",\n cardValue: \"font-medium\",\n};\n","import {\n DataTable as UnstyledDataTable,\n type DataTableProps,\n} from \"@adapttable/unstyled\";\n\nimport { shadcnClassNames } from \"./classNames\";\n\n/**\n * AdaptTable, pre-styled with **shadcn/ui** design tokens โ€” a fully-styled data\n * table in a single import. A thin wrapper over `@adapttable/unstyled` that\n * applies the {@link shadcnClassNames} preset, so you don't hand-wire the\n * class map.\n *\n * Requires shadcn/ui set up in your app (its CSS variables + Tailwind config).\n * Restyle any part by passing your own `classNames` โ€” they're merged **over**\n * the preset, per part, so `classNames={{ root: \"โ€ฆ\" }}` only replaces the root.\n *\n * @typeParam TRow - The row type.\n */\nexport function DataTable<TRow>(props: Readonly<DataTableProps<TRow>>) {\n const { classNames, ...rest } = props;\n return (\n <UnstyledDataTable\n {...rest}\n classNames={\n classNames ? { ...shadcnClassNames, ...classNames } : shadcnClassNames\n }\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAcA,MAAaA,mBAAwC;CACnDC,MAAM;CACNC,SAAS;CACTC,aACE;CACFC,YAAY;CACZC,QACE;CACFC,YAAY;CACZC,mBACE;CACFC,eACE;CACFC,iBAAiB;CACjBC,cACE;CACFC,gBACE;CACFC,cACE;CACFC,eACE;CACFC,cAAc;CACdC,cACE;CACFC,aAAa;CAEbC,aAAa;CACbC,aAAa;CACbC,aACE;CACFC,cACE;CACFC,qBAAqB;CACrBC,gBACE;CACFC,eACE;CACFC,cACE;CACFC,aACE;CACFC,OAAO;CACPC,YACE;CACFC,YACE;CACFC,KAAK;CAELC,MAAM;CACNC,cACE;CACFC,QACE;CACFC,YACE;CACFC,OAAO;CACPC,MAAM;CACNC,YACE;CACFC,OACE;CACFC,YACE;CAEFC,kBACE;CACFC,iBACE;CACFC,kBAAkB;CAClBC,iBACE;CACFC,gBACE;CACFC,gBACE;CACFC,iBACE;CACFC,sBACE;CACFC,eACE;CACFC,iBACE;CACFC,cAAc;CACdC,MAAM;CACNC,SAAS;CACTC,WAAW;CACXC,WAAW;AACb;;;;;;;;;;;;;;;ACpFA,SAAOC,UAAAG,OAAA;CAAA,MAAAC,IAAAC,EAAA,CAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAH,EAAA,OAAAD,OAAA;EACL,CAAA,CAAAG,eAAAC,QAAgCJ;EAAMC,EAAA,KAAAD;EAAAC,EAAA,KAAAE;EAAAF,EAAA,KAAAG;CAAA,OAAA;EAAAD,aAAAF,EAAA;EAAAG,OAAAH,EAAA;CAAA;CAAA,IAAAI;CAAA,IAAAJ,EAAA,OAAAE,YAAA;EAKhCE,KAAAF,aAAA;GAAA,GAAkBJ;GAAgB,GAAKI;EAA8B,IAArEJ;EAAsEE,EAAA,KAAAE;EAAAF,EAAA,KAAAI;CAAA,OAAAA,KAAAJ,EAAA;CAAA,IAAAK;CAAA,IAAAL,EAAA,OAAAG,QAAAH,EAAA,OAAAI,IAAA;EAH1EC,KAAA,oBAAC,aAAD;GAAkB,GACZF;GAEF,YAAAC;EAAsE,CAAA;EAExEJ,EAAA,KAAAG;EAAAH,EAAA,KAAAI;EAAAJ,EAAA,KAAAK;CAAA,OAAAA,KAAAL,EAAA;CAAA,OALFK;AAKE"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@adapttable/shadcn",
3
+ "version": "0.1.0",
4
+ "description": "shadcn/ui adapter for AdaptTable โ€” a fully-styled React data table in one import, built on the headless @adapttable/core engine and shadcn's design tokens.",
5
+ "keywords": [
6
+ "react",
7
+ "data-table",
8
+ "table",
9
+ "shadcn",
10
+ "shadcn-ui",
11
+ "tailwind",
12
+ "headless",
13
+ "url-state",
14
+ "rtl",
15
+ "typescript"
16
+ ],
17
+ "license": "MIT",
18
+ "author": "Orwa Mahmoud",
19
+ "homepage": "https://orwa-mahmoud.github.io/adapttable/",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/orwa-mahmoud/adapttable.git",
23
+ "directory": "packages/adapter-shadcn"
24
+ },
25
+ "bugs": "https://github.com/orwa-mahmoud/adapttable/issues",
26
+ "type": "module",
27
+ "sideEffects": false,
28
+ "files": [
29
+ "dist",
30
+ "README.md",
31
+ "CHANGELOG.md"
32
+ ],
33
+ "main": "./dist/index.cjs",
34
+ "module": "./dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "exports": {
37
+ ".": {
38
+ "import": {
39
+ "types": "./dist/index.d.ts",
40
+ "default": "./dist/index.js"
41
+ },
42
+ "require": {
43
+ "types": "./dist/index.d.cts",
44
+ "default": "./dist/index.cjs"
45
+ }
46
+ },
47
+ "./package.json": "./package.json"
48
+ },
49
+ "dependencies": {
50
+ "react-compiler-runtime": "^1.0.0",
51
+ "@adapttable/unstyled": "0.2.2"
52
+ },
53
+ "peerDependencies": {
54
+ "react": "^18.0.0 || ^19.0.0",
55
+ "react-dom": "^18.0.0 || ^19.0.0"
56
+ },
57
+ "devDependencies": {
58
+ "@testing-library/dom": "^10.4.1",
59
+ "@testing-library/jest-dom": "^6.9.1",
60
+ "@testing-library/react": "^16.3.2",
61
+ "axe-core": "^4.12.1",
62
+ "react": "^19.2.7",
63
+ "react-dom": "^19.2.7",
64
+ "vitest-axe": "^0.1.0",
65
+ "@adapttable/core": "0.2.2"
66
+ },
67
+ "publishConfig": {
68
+ "access": "public"
69
+ },
70
+ "engines": {
71
+ "node": ">=18.18.0"
72
+ },
73
+ "scripts": {
74
+ "build": "tsdown",
75
+ "dev": "tsdown --watch",
76
+ "test": "vitest run",
77
+ "test:coverage": "vitest run --coverage",
78
+ "lint": "eslint .",
79
+ "typecheck": "tsc --noEmit",
80
+ "clean": "rimraf dist coverage .turbo"
81
+ }
82
+ }