@gridkitjs/theme-tailwind 0.0.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Blagoja Blazhevski
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,59 @@
1
+ # @gridkitjs/theme-tailwind
2
+
3
+ Tailwind v4 theme for [GridKit](https://github.com/blagojablazhevski/gridkit) —
4
+ palette tokens, dark mode and the grid's styles.
5
+
6
+ > **Early development.** The API is still moving and may break between minor
7
+ > versions.
8
+
9
+ ```bash
10
+ pnpm add @gridkitjs/theme-tailwind
11
+ ```
12
+
13
+ Import it after Tailwind, in the stylesheet where you import `tailwindcss`:
14
+
15
+ ```css
16
+ @import "tailwindcss";
17
+ @import "@gridkitjs/theme-tailwind/styles.css";
18
+ ```
19
+
20
+ That is all — `@gridkitjs/react` renders semantic class names
21
+ (`gridkit-data-grid`, `header-cell`, `grid-row`), and this stylesheet targets
22
+ them directly. Nothing needs to scan the component source.
23
+
24
+ ## Dark mode
25
+
26
+ The `dark:` variant is bound to a `.dark` class rather than the OS preference,
27
+ so you drive the theme yourself:
28
+
29
+ ```js
30
+ document.documentElement.classList.toggle("dark", isDark);
31
+ ```
32
+
33
+ ## Theming
34
+
35
+ Every colour is a CSS custom property, so overriding one is plain CSS — no
36
+ Tailwind config:
37
+
38
+ ```css
39
+ :root {
40
+ --gridkit-accent: oklch(0.6 0.17 145);
41
+ --gridkit-line: oklch(0.9 0.01 145);
42
+ }
43
+ ```
44
+
45
+ | Token | What it colours |
46
+ | ------------------------- | ------------------------------- |
47
+ | `--gridkit-surface` | Header background |
48
+ | `--gridkit-surface-muted` | Hover background |
49
+ | `--gridkit-line` | Borders |
50
+ | `--gridkit-hover-line` | Cell hover outline, resize edge |
51
+ | `--gridkit-fg` | Text |
52
+ | `--gridkit-fg-muted` | Secondary text, resize grip |
53
+ | `--gridkit-accent` | Accent |
54
+
55
+ Redefine them under `.dark` to change the dark palette too.
56
+
57
+ ## License
58
+
59
+ MIT © Blagoja Blazhevski
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "@gridkitjs/theme-tailwind",
3
+ "version": "0.0.1",
4
+ "description": "Tailwind v4 theme for GridKit — palette tokens, dark mode and grid styles.",
5
+ "license": "MIT",
6
+ "author": "Blagoja Blazhevski",
7
+ "homepage": "https://github.com/blagojablazhevski/gridkit#readme",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/blagojablazhevski/gridkit.git",
11
+ "directory": "packages/theme-tailwind"
12
+ },
13
+ "keywords": [
14
+ "gridkit",
15
+ "datagrid",
16
+ "tailwind",
17
+ "tailwindcss",
18
+ "theme",
19
+ "css"
20
+ ],
21
+ "exports": {
22
+ "./styles.css": "./src/styles.css"
23
+ },
24
+ "files": [
25
+ "src",
26
+ "LICENSE",
27
+ "README.md"
28
+ ],
29
+ "peerDependencies": {
30
+ "tailwindcss": "^4.3.3"
31
+ }
32
+ }
package/src/styles.css ADDED
@@ -0,0 +1,201 @@
1
+ /*
2
+ * GridKit tailwind theme.
3
+ *
4
+ */
5
+
6
+ /*
7
+ * Tailwind's `dark:` variant follows the OS preference by default. Bind it to
8
+ * a `.dark` class instead so consumers can drive the theme themselves.
9
+ */
10
+ @custom-variant dark (&:where(.dark, .dark *));
11
+
12
+ /*
13
+ * The palette. Light is the default; `.dark` redefines the same names, so a
14
+ * token means "the header background", not "light grey".
15
+ */
16
+ :root {
17
+ color-scheme: light;
18
+
19
+ --gridkit-surface: oklch(1 0 0);
20
+ --gridkit-surface-muted: oklch(0.97 0.003 250);
21
+ --gridkit-line: oklch(0.92 0.005 250);
22
+ --gridkit-hover-line: oklch(0.65 0.09 255);
23
+ --gridkit-fg: oklch(0.21 0.01 250);
24
+ --gridkit-fg-muted: oklch(0.55 0.015 250);
25
+ --gridkit-accent: oklch(0.6 0.17 255);
26
+ }
27
+
28
+ .dark {
29
+ color-scheme: dark;
30
+
31
+ --gridkit-surface: oklch(0.21 0.01 250);
32
+ --gridkit-surface-muted: oklch(0.26 0.012 250);
33
+ --gridkit-line: oklch(0.33 0.014 250);
34
+ --gridkit-hover-line: oklch(0.75 0.09 255);
35
+ --gridkit-fg: oklch(0.97 0.003 250);
36
+ --gridkit-fg-muted: oklch(0.7 0.015 250);
37
+ --gridkit-accent: oklch(0.7 0.15 255);
38
+ }
39
+
40
+ /*
41
+ * `inline` is what makes the swap work. Without it Tailwind emits
42
+ * `--color-surface: var(--gridkit-surface)` on `:root`, which resolves once
43
+ * against the light values and is then inherited already-resolved — a `.dark`
44
+ * further down the tree would have nothing left to override. `inline`
45
+ * substitutes the var into each utility instead, so it resolves at the element
46
+ * the class sits on.
47
+ */
48
+ @theme inline {
49
+ --color-surface: var(--gridkit-surface);
50
+ --color-surface-muted: var(--gridkit-surface-muted);
51
+ --color-line: var(--gridkit-line);
52
+ --color-fg: var(--gridkit-fg);
53
+ --color-fg-muted: var(--gridkit-fg-muted);
54
+ --color-accent: var(--gridkit-accent);
55
+ }
56
+
57
+ /*
58
+ * Grid styles.
59
+ */
60
+
61
+ @layer base {
62
+ /*
63
+ * The table is exactly as wide as its columns, so anything wider than the
64
+ * space available scrolls here rather than squashing the columns.
65
+ */
66
+ .gridkit-data-grid-viewport {
67
+ overflow-x: auto;
68
+ }
69
+
70
+ /*
71
+ * `fixed` is what makes a width a width. Under the default `auto` layout the
72
+ * browser treats the colgroup as a hint and re-apportions space by content,
73
+ * so dragging one column visibly shifts its neighbours.
74
+ */
75
+ .gridkit-data-grid {
76
+ border-collapse: collapse;
77
+ table-layout: fixed;
78
+ }
79
+
80
+ /*
81
+ * Fixed layout does not grow a cell to fit, so content has to be told what to
82
+ * do when it does not. Keeping it on one line is also what lets a column be
83
+ * measured against its content.
84
+ */
85
+ .gridkit-data-grid .header-cell,
86
+ .gridkit-data-grid .grid-cell {
87
+ overflow: hidden;
88
+ text-overflow: ellipsis;
89
+ white-space: nowrap;
90
+ }
91
+
92
+ .gridkit-data-grid .grid-header {
93
+ background-color: var(--gridkit-surface);
94
+ }
95
+
96
+ .gridkit-data-grid .grid-header .header-cell {
97
+ padding: 0.5rem;
98
+ position: relative;
99
+ }
100
+
101
+ .gridkit-data-grid .header-resize-handle {
102
+ position: absolute;
103
+ top: 0;
104
+ right: 0;
105
+ bottom: 0;
106
+ width: 6px;
107
+ cursor: col-resize;
108
+ /* Without this a touch drag scrolls the page instead of resizing. */
109
+ touch-action: none;
110
+ user-select: none;
111
+ }
112
+
113
+ /*
114
+ * A resize colours the edge being dragged on every cell in the column, so it
115
+ * reads as one line down the grid rather than a stack of outlined cells.
116
+ * `box-shadow` rather than `border-right`: under `borders="none"` there is no
117
+ * border to recolour, and adding one would shift the cell's content by a
118
+ * pixel mid-drag.
119
+ *
120
+ * Focus gets the same line as far as CSS can reach — the handle is tabbable
121
+ * and resizes with the arrow keys, so it has to say which edge it is on.
122
+ */
123
+ .gridkit-data-grid .header-cell.is-resizing,
124
+ .gridkit-data-grid .grid-cell.is-resizing,
125
+ .gridkit-data-grid .header-cell:has(.header-resize-handle:focus-visible) {
126
+ box-shadow: inset -2px 0 0 0 var(--gridkit-hover-line);
127
+ }
128
+
129
+ /*
130
+ * `pointer-events: none` keeps the grab zone exactly the handle's 6px — the
131
+ * grip only says where to click.
132
+ */
133
+ .gridkit-data-grid .header-resize-grip {
134
+ position: absolute;
135
+ top: 50%;
136
+ right: 0;
137
+ transform: translateY(-50%);
138
+ color: var(--gridkit-fg-muted);
139
+ fill: currentColor;
140
+ opacity: 0;
141
+ pointer-events: none;
142
+ }
143
+
144
+ /*
145
+ * Unscoped by `no-hover-columns`: the grip is a resize affordance, not part
146
+ * of the hover styling a consumer can turn off.
147
+ */
148
+ .gridkit-data-grid .grid-header .header-cell:hover .header-resize-grip,
149
+ .gridkit-data-grid .header-resize-handle:focus-visible .header-resize-grip {
150
+ opacity: 1;
151
+ }
152
+
153
+ .gridkit-data-grid .header-cell.is-resizing .header-resize-grip {
154
+ opacity: 0;
155
+ }
156
+
157
+ .gridkit-data-grid:not(.no-hover-columns) .grid-header .header-cell:hover {
158
+ background-color: var(--gridkit-surface-muted);
159
+ }
160
+
161
+ .gridkit-data-grid .grid-cell {
162
+ padding: 0.5rem;
163
+ }
164
+
165
+ .gridkit-data-grid:not(.no-hover-cells) .grid-cell:hover {
166
+ outline: 1px solid var(--gridkit-hover-line);
167
+ background-color: var(--gridkit-surface-muted);
168
+ }
169
+
170
+ .gridkit-data-grid:not(.no-hover-rows) .grid-row:hover {
171
+ background-color: var(--gridkit-surface-muted);
172
+ }
173
+
174
+ /* Horizontal borders */
175
+ .gridkit-data-grid.borders-horizontal .grid-header .header-cell,
176
+ .gridkit-data-grid.borders-horizontal .grid-cell {
177
+ border-bottom: 1px solid var(--gridkit-line);
178
+ }
179
+
180
+ /* Vertical borders */
181
+ .gridkit-data-grid.borders-vertical .grid-header .header-cell,
182
+ .gridkit-data-grid.borders-vertical .grid-cell {
183
+ border-right: 1px solid var(--gridkit-line);
184
+ }
185
+
186
+ .gridkit-data-grid.borders-vertical .grid-header .header-cell:last-child,
187
+ .gridkit-data-grid.borders-vertical .grid-cell:last-child {
188
+ border-right: none;
189
+ }
190
+
191
+ /* Borders on all sides */
192
+ .gridkit-data-grid.borders-all .grid-header .header-cell,
193
+ .gridkit-data-grid.borders-all .grid-cell {
194
+ border: 1px solid var(--gridkit-line);
195
+ }
196
+
197
+ .gridkit-data-grid.borders-all .grid-header .header-cell:last-child,
198
+ .gridkit-data-grid.borders-all .grid-cell:last-child {
199
+ border-right: none;
200
+ }
201
+ }