@gridkitjs/theme-tailwind 0.7.0 → 0.8.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/README.md CHANGED
@@ -46,7 +46,7 @@ the grid's own root:
46
46
 
47
47
  ```tsx
48
48
  <div className="gridkit-dark">
49
- <DataGridComponent ... />
49
+ <DataGrid ... />
50
50
  </div>
51
51
  ```
52
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gridkitjs/theme-tailwind",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "Tailwind v4 theme for GridKit — palette tokens, dark mode and grid styles.",
5
5
  "license": "MIT",
6
6
  "author": "Blagoja Blazhevski",
package/src/styles.css CHANGED
@@ -275,6 +275,23 @@
275
275
  opacity: 0.5;
276
276
  }
277
277
 
278
+ /*
279
+ * A header, cell or group row that opens the grid's context menu — its
280
+ * `aria-keyshortcuts` names Shift+F10 then — takes a long-press for that
281
+ * menu, so iOS must not show its own callout, or start selecting the text
282
+ * under the finger, on the same press.
283
+ */
284
+ .gridkit-data-grid [aria-keyshortcuts~="Shift+F10"] {
285
+ -webkit-touch-callout: none;
286
+ }
287
+
288
+ @media (pointer: coarse) {
289
+ .gridkit-data-grid [aria-keyshortcuts~="Shift+F10"] {
290
+ -webkit-user-select: none;
291
+ user-select: none;
292
+ }
293
+ }
294
+
278
295
  /*
279
296
  * The header trailing the pointer. It sits on the body rather than in the
280
297
  * table, so it restates what a header cell gets from its place in the grid.
@@ -751,6 +768,148 @@
751
768
  border-bottom: none;
752
769
  }
753
770
 
771
+ /*
772
+ * The toolbar: the grid's first child, above the group-by bar, and unscoped
773
+ * by `.gridkit-data-grid` for the same reason that bar is. The grid scrolls
774
+ * sideways with everything in it, so the toolbar sticks to its start edge
775
+ * and stays in view while the tables scroll on under it.
776
+ *
777
+ * Its entries keep to one row at their own widths, which is what the
778
+ * overflow measures: what does not fit goes into "More", and `overflow:
779
+ * hidden` keeps the frame before that from spilling out of the toolbar.
780
+ */
781
+ .gridkit-toolbar {
782
+ position: sticky;
783
+ inset-inline-start: 0;
784
+ display: flex;
785
+ align-items: center;
786
+ gap: 0.5rem;
787
+ padding: 0.5rem;
788
+ overflow: hidden;
789
+ font-size: 0.8125rem;
790
+ color: var(--gridkit-fg);
791
+ background-color: var(--gridkit-surface);
792
+ border-bottom: 1px solid var(--gridkit-line);
793
+ }
794
+
795
+ .gridkit-toolbar > * {
796
+ flex-shrink: 0;
797
+ }
798
+
799
+ /*
800
+ * The search box and custom entries never move into "More", so together
801
+ * they can be wider than the toolbar. "More" then sticks to its end edge,
802
+ * over what is clipped there, rather than being clipped itself.
803
+ */
804
+ .gridkit-toolbar > .toolbar-more {
805
+ position: sticky;
806
+ /* Counted from the toolbar's padding edge, so its padding again. */
807
+ inset-inline-end: 0.5rem;
808
+ }
809
+
810
+ /* A command, a dropdown, or "More". */
811
+ .toolbar-button {
812
+ display: inline-flex;
813
+ align-items: center;
814
+ gap: 0.375rem;
815
+ padding: 0.25rem 0.625rem;
816
+ font: inherit;
817
+ color: var(--gridkit-fg);
818
+ white-space: nowrap;
819
+ cursor: pointer;
820
+ background-color: var(--gridkit-surface);
821
+ border: 1px solid var(--gridkit-line);
822
+ border-radius: 0.25rem;
823
+ }
824
+
825
+ .toolbar-button:hover:not([aria-disabled="true"]),
826
+ .toolbar-button[aria-expanded="true"] {
827
+ background-color: var(--gridkit-surface-muted);
828
+ }
829
+
830
+ .toolbar-button:focus-visible {
831
+ outline: 2px solid var(--gridkit-accent);
832
+ outline-offset: 1px;
833
+ }
834
+
835
+ /* Still focusable, as a menu's disabled item is, so a screen reader finds it. */
836
+ .toolbar-button[aria-disabled="true"] {
837
+ color: var(--gridkit-fg-muted);
838
+ cursor: default;
839
+ opacity: 0.5;
840
+ }
841
+
842
+ /* A toggle that is on. */
843
+ .toolbar-button[aria-pressed="true"],
844
+ .toolbar-button[aria-pressed="true"]:hover {
845
+ background-color: var(--gridkit-selected-strong);
846
+ border-color: var(--gridkit-accent);
847
+ }
848
+
849
+ .toolbar-button-icon,
850
+ .toolbar-button-indicator {
851
+ display: inline-flex;
852
+ color: var(--gridkit-fg-muted);
853
+ }
854
+
855
+ /* An icon key the grid has no glyph for draws nothing, and takes no room. */
856
+ .toolbar-button-icon:empty {
857
+ display: none;
858
+ }
859
+
860
+ .toolbar-button-icon svg,
861
+ .toolbar-button-indicator svg {
862
+ width: 1rem;
863
+ height: 1rem;
864
+ }
865
+
866
+ .toolbar-button-indicator {
867
+ margin-inline-end: -0.25rem;
868
+ }
869
+
870
+ /*
871
+ * Narrower in a narrow toolbar, by the toolbar's width alone — never by
872
+ * what else is in it, which the overflow would measure as a width of its
873
+ * own — so it leaves room for "More" beside it.
874
+ */
875
+ .toolbar-search {
876
+ width: 12rem;
877
+ max-width: 50%;
878
+ padding: 0.25rem 0.5rem;
879
+ font: inherit;
880
+ color: var(--gridkit-fg);
881
+ background-color: var(--gridkit-surface);
882
+ border: 1px solid var(--gridkit-line);
883
+ border-radius: 0.25rem;
884
+ }
885
+
886
+ .toolbar-search::placeholder {
887
+ color: var(--gridkit-fg-muted);
888
+ }
889
+
890
+ .toolbar-search:focus-visible {
891
+ outline: 2px solid var(--gridkit-accent);
892
+ outline-offset: 1px;
893
+ }
894
+
895
+ .toolbar-separator {
896
+ align-self: stretch;
897
+ width: 1px;
898
+ margin: 0.125rem 0;
899
+ background-color: var(--gridkit-line);
900
+ }
901
+
902
+ /* Takes the free space, pushing what follows it to the far end. */
903
+ .gridkit-toolbar > .toolbar-spacer {
904
+ flex: 1 1 0;
905
+ }
906
+
907
+ /* Holds what `renderToolbarItem` drew. */
908
+ .toolbar-custom {
909
+ display: inline-flex;
910
+ align-items: center;
911
+ }
912
+
754
913
  /*
755
914
  * The group-by bar. A sibling of the table, not a row inside it — see
756
915
  * `GroupByBar.tsx`'s own note on why — so it's unscoped by `.gridkit-data-grid`
@@ -971,4 +1130,225 @@
971
1130
  outline: 2px solid var(--gridkit-accent);
972
1131
  outline-offset: 1px;
973
1132
  }
1133
+
1134
+ /*
1135
+ * Overlays — the grid's menus and panels — render into `document.body`, outside the
1136
+ * grid and any scrolling ancestor that would clip them, so every selector
1137
+ * from here on is top-level rather than under `.gridkit-data-grid`. The
1138
+ * grid copies the `.gridkit-light`/`.gridkit-dark` it sits under onto the
1139
+ * overlay, since the portal leaves that ancestor's token scope.
1140
+ *
1141
+ * Fixed from the start, so the overlay never takes room at the end of the
1142
+ * page before it is placed; above the grid's own drag ghosts.
1143
+ */
1144
+ .gridkit-overlay {
1145
+ position: fixed;
1146
+ top: 0;
1147
+ left: 0;
1148
+ z-index: 60;
1149
+ color: var(--gridkit-fg);
1150
+ }
1151
+
1152
+ /*
1153
+ * A menu too tall for the viewport scrolls inside itself — a scroll there
1154
+ * does not dismiss it, as one outside would.
1155
+ */
1156
+ .gridkit-menu {
1157
+ min-width: 12rem;
1158
+ max-height: 100vh;
1159
+ overflow-y: auto;
1160
+ padding: 0.25rem 0;
1161
+ font-size: 0.875rem;
1162
+ background-color: var(--gridkit-surface);
1163
+ border: 1px solid var(--gridkit-line);
1164
+ border-radius: 0.375rem;
1165
+ box-shadow: 0 4px 12px oklch(0 0 0 / 0.15);
1166
+ }
1167
+
1168
+ .menu-item {
1169
+ display: flex;
1170
+ align-items: center;
1171
+ gap: 0.5rem;
1172
+ padding: 0.375rem 0.75rem;
1173
+ white-space: nowrap;
1174
+ cursor: pointer;
1175
+ user-select: none;
1176
+ }
1177
+
1178
+ /*
1179
+ * `:focus` rather than `:focus-visible`: the pointer moves focus to the
1180
+ * item under it, so focus is the hover state too, and has to show
1181
+ * whichever moved it.
1182
+ */
1183
+ .menu-item:focus {
1184
+ outline: none;
1185
+ background-color: var(--gridkit-selected);
1186
+ }
1187
+
1188
+ /*
1189
+ * The item whose submenu is open, while focus is in that submenu — the
1190
+ * trail back to it.
1191
+ */
1192
+ .menu-item[aria-expanded="true"]:not(:focus) {
1193
+ background-color: var(--gridkit-surface-muted);
1194
+ }
1195
+
1196
+ /*
1197
+ * Still focusable, so a screen reader finds it: muted, and marked only
1198
+ * faintly when focused, since choosing it does nothing.
1199
+ */
1200
+ .menu-item[aria-disabled="true"] {
1201
+ color: var(--gridkit-fg-muted);
1202
+ cursor: default;
1203
+ }
1204
+
1205
+ .menu-item[aria-disabled="true"]:focus {
1206
+ background-color: var(--gridkit-surface-muted);
1207
+ }
1208
+
1209
+ /*
1210
+ * Always there, empty for an item without an icon, so every label in a
1211
+ * menu starts at the same place. A checked item shows its check here.
1212
+ */
1213
+ .menu-item-icon {
1214
+ display: inline-flex;
1215
+ flex-shrink: 0;
1216
+ align-items: center;
1217
+ justify-content: center;
1218
+ width: 1rem;
1219
+ height: 1rem;
1220
+ color: var(--gridkit-fg-muted);
1221
+ }
1222
+
1223
+ .menu-item-icon svg,
1224
+ .menu-submenu-indicator svg {
1225
+ width: 1rem;
1226
+ height: 1rem;
1227
+ }
1228
+
1229
+ .menu-item[aria-checked="true"] .menu-item-icon {
1230
+ color: var(--gridkit-accent);
1231
+ }
1232
+
1233
+ .menu-item-label {
1234
+ flex: 1;
1235
+ }
1236
+
1237
+ .menu-item-shortcut {
1238
+ margin-inline-start: 1.5rem;
1239
+ font-size: 0.75rem;
1240
+ color: var(--gridkit-fg-muted);
1241
+ }
1242
+
1243
+ .menu-submenu-indicator {
1244
+ display: inline-flex;
1245
+ margin-inline-end: -0.25rem;
1246
+ color: var(--gridkit-fg-muted);
1247
+ }
1248
+
1249
+ .menu-separator {
1250
+ height: 1px;
1251
+ margin: 0.25rem 0;
1252
+ background-color: var(--gridkit-line);
1253
+ }
1254
+
1255
+ /*
1256
+ * The column chooser, an overlay like the menus: a search box, "Show all",
1257
+ * then a checkbox per column. A fixed width, so the panel does not jump
1258
+ * sideways as a search narrows the list.
1259
+ */
1260
+ .gridkit-column-chooser {
1261
+ display: flex;
1262
+ flex-direction: column;
1263
+ gap: 0.375rem;
1264
+ width: 16rem;
1265
+ padding: 0.5rem;
1266
+ font-size: 0.875rem;
1267
+ background-color: var(--gridkit-surface);
1268
+ border: 1px solid var(--gridkit-line);
1269
+ border-radius: 0.375rem;
1270
+ box-shadow: 0 4px 12px oklch(0 0 0 / 0.15);
1271
+ }
1272
+
1273
+ .column-chooser-search {
1274
+ box-sizing: border-box;
1275
+ width: 100%;
1276
+ padding: 0.25rem 0.5rem;
1277
+ font: inherit;
1278
+ color: var(--gridkit-fg);
1279
+ background-color: var(--gridkit-surface);
1280
+ border: 1px solid var(--gridkit-line);
1281
+ border-radius: 0.25rem;
1282
+ }
1283
+
1284
+ .column-chooser-search::placeholder {
1285
+ color: var(--gridkit-fg-muted);
1286
+ }
1287
+
1288
+ .column-chooser-search:focus-visible {
1289
+ outline: 2px solid var(--gridkit-accent);
1290
+ outline-offset: 1px;
1291
+ }
1292
+
1293
+ /*
1294
+ * Past about ten columns the list scrolls inside itself — a scroll there
1295
+ * does not dismiss the chooser, as one outside would — while the search
1296
+ * box and "Show all" stay put above it.
1297
+ */
1298
+ .column-chooser-list {
1299
+ max-height: 17.5rem;
1300
+ margin: 0;
1301
+ padding: 0;
1302
+ overflow-y: auto;
1303
+ list-style: none;
1304
+ }
1305
+
1306
+ /* One checkbox and its label: "Show all", or a column. */
1307
+ .column-chooser-option {
1308
+ display: flex;
1309
+ align-items: center;
1310
+ gap: 0.5rem;
1311
+ padding: 0.25rem;
1312
+ border-radius: 0.25rem;
1313
+ cursor: pointer;
1314
+ user-select: none;
1315
+ }
1316
+
1317
+ .column-chooser-option:hover {
1318
+ background-color: var(--gridkit-surface-muted);
1319
+ }
1320
+
1321
+ /* "Show all", set apart from the columns it acts on. */
1322
+ .column-chooser-all {
1323
+ padding-bottom: 0.375rem;
1324
+ border-bottom: 1px solid var(--gridkit-line);
1325
+ border-radius: 0;
1326
+ }
1327
+
1328
+ .column-chooser-option input {
1329
+ flex-shrink: 0;
1330
+ margin: 0;
1331
+ accent-color: var(--gridkit-accent);
1332
+ }
1333
+
1334
+ .column-chooser-option input:focus-visible {
1335
+ outline: 2px solid var(--gridkit-accent);
1336
+ outline-offset: 1px;
1337
+ }
1338
+
1339
+ /* A column that cannot be hidden, or the last one shown. */
1340
+ .column-chooser-option:has(> input:disabled) {
1341
+ color: var(--gridkit-fg-muted);
1342
+ cursor: default;
1343
+ }
1344
+
1345
+ .column-chooser-option:has(> input:disabled):hover {
1346
+ background-color: transparent;
1347
+ }
1348
+
1349
+ .column-chooser-empty {
1350
+ margin: 0;
1351
+ padding: 0.25rem;
1352
+ color: var(--gridkit-fg-muted);
1353
+ }
974
1354
  }