pivotkit-react 0.8.0 → 0.8.2

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 CHANGED
@@ -6,6 +6,37 @@ All notable changes to `pivotkit-react` are documented in this file. The format
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.2] - 2026-11-19
10
+
11
+ ### Fixed
12
+
13
+ - The arrow keys in a long table no longer leave the focus one cell behind. When the table scrolled
14
+ between two key presses, the focus could stay on the cell before the one the keys moved to, and
15
+ the status line named that row ([#416](https://github.com/eizedev/pivotkit/issues/416)).
16
+
17
+ ## [0.8.1] - 2026-11-18
18
+
19
+ ### Added
20
+
21
+ - Theme tokens for the tabs, icon buttons, button frames and primary buttons, so a host themes them
22
+ without changing the general tokens: `--pk-tab-bg`, `--pk-tab-text`, `--pk-tab-selected-bg`,
23
+ `--pk-tab-selected-text`, `--pk-icon-button-text`, `--pk-icon-button-hover-bg`,
24
+ `--pk-button-border`, `--pk-button-border-hover`, `--pk-primary-bg`, `--pk-primary-text` and
25
+ `--pk-primary-hover-bg`. Their defaults are today's colours
26
+ ([#604](https://github.com/eizedev/pivotkit/issues/604)).
27
+
28
+ ### Changed
29
+
30
+ - The four zones form an even grid. From 640 px of the main area, Filters and Columns sit on top
31
+ and Rows and Values below, in equal halves at every width. Below 640 px they stand in one column.
32
+ A chip never widens a zone, so the drop targets stay in place while fields are added
33
+ ([#605](https://github.com/eizedev/pivotkit/issues/605)).
34
+ - A zone narrower than 26em puts its title row above its chips, as on a phone.
35
+ - Each zone has a frame, from the new token `--pk-zone-border`, and a little more height,
36
+ from the new token `--pk-shelf-pad-block`. `--pk-shelf-min` is now the least width of a half of
37
+ the grid.
38
+ - The Filters hint is shorter: "Add or drop a field to filter".
39
+
9
40
  ## [0.8.0] - 2026-11-18
10
41
 
11
42
  ### Upgrading from 0.7
@@ -1258,7 +1289,9 @@ First release.
1258
1289
  weather (Open-Meteo), countries (World Bank), earthquakes (USGS), Nobel laureates and the release
1259
1290
  cycles of software products (endoflife.date).
1260
1291
 
1261
- [Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.8.0...HEAD
1292
+ [Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.8.2...HEAD
1293
+ [0.8.2]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.8.1...pivotkit-react@0.8.2
1294
+ [0.8.1]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.8.0...pivotkit-react@0.8.1
1262
1295
  [0.8.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.7.0...pivotkit-react@0.8.0
1263
1296
  [0.7.0]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.1...pivotkit-react@0.7.0
1264
1297
  [0.6.1]: https://github.com/eizedev/pivotkit/compare/pivotkit-react@0.6.0...pivotkit-react@0.6.1
@@ -19,7 +19,7 @@ var en = {
19
19
  rows: "Add or drop a field to group rows",
20
20
  cols: "Add or drop a field to group columns",
21
21
  values: "Add or drop a number to sum or count it",
22
- filters: "Add or drop a field to filter the whole report"
22
+ filters: "Add or drop a field to filter"
23
23
  },
24
24
  fields: "Fields",
25
25
  fieldsHint: "Drag a field into Rows, Columns, Values or Filters, or open its menu.",
@@ -404,7 +404,7 @@ var de = {
404
404
  rows: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um Zeilen zu gruppieren",
405
405
  cols: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um Spalten zu gruppieren",
406
406
  values: "Eine Zahl hinzuf\xFCgen oder hierher ziehen, um sie zu summieren oder zu z\xE4hlen",
407
- filters: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um den ganzen Bericht zu filtern"
407
+ filters: "Ein Feld hinzuf\xFCgen oder hierher ziehen, um zu filtern"
408
408
  },
409
409
  fields: "Felder",
410
410
  fieldsHint: "Ein Feld in Zeilen, Spalten, Werte oder Filter ziehen oder sein Men\xFC \xF6ffnen.",
@@ -4,7 +4,7 @@ import {
4
4
  mergeLabels,
5
5
  messageOf,
6
6
  plural
7
- } from "./chunk-SJCG4I57.js";
7
+ } from "./chunk-3WWWKPB4.js";
8
8
 
9
9
  // src/import-labels.js
10
10
  var en = {
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  fill,
9
9
  plural
10
- } from "./chunk-SJCG4I57.js";
10
+ } from "./chunk-3WWWKPB4.js";
11
11
 
12
12
  // src/chart-types.js
13
13
  import { chartPlan as corePlan } from "pivotkit-core";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  MENU_TEXTS,
3
3
  mergeLabels
4
- } from "./chunk-SJCG4I57.js";
4
+ } from "./chunk-3WWWKPB4.js";
5
5
 
6
6
  // src/menu-labels.js
7
7
  var en = {
package/dist/import-ui.js CHANGED
@@ -15,12 +15,12 @@ import {
15
15
  errorText,
16
16
  importLabels,
17
17
  noteText
18
- } from "./chunks/chunk-BHHIZHUE.js";
18
+ } from "./chunks/chunk-6OWC6X5W.js";
19
19
  import {
20
20
  fill,
21
21
  messageOf,
22
22
  plural
23
- } from "./chunks/chunk-SJCG4I57.js";
23
+ } from "./chunks/chunk-3WWWKPB4.js";
24
24
 
25
25
  // src/import-host.jsx
26
26
  import React2 from "react";
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ import {
88
88
  writeStoredView,
89
89
  zoneMax,
90
90
  zoneOverLimit
91
- } from "./chunks/chunk-VMJMDP7C.js";
91
+ } from "./chunks/chunk-W2SVDHGN.js";
92
92
  import {
93
93
  FormNameContext,
94
94
  Group,
@@ -115,7 +115,7 @@ import {
115
115
  removedLabels,
116
116
  resolveLabels,
117
117
  rowCount
118
- } from "./chunks/chunk-SJCG4I57.js";
118
+ } from "./chunks/chunk-3WWWKPB4.js";
119
119
 
120
120
  // src/PivotReport.jsx
121
121
  import React13, { useCallback as useCallback10, useEffect as useEffect11, useId as useId5, useMemo as useMemo8, useRef as useRef12, useState as useState12, useSyncExternalStore as useSyncExternalStore3 } from "react";
@@ -454,7 +454,11 @@ function useActiveDrag() {
454
454
  }
455
455
  function collision(args) {
456
456
  if (!args.pointerCoordinates) {
457
- return closestCenter(args);
457
+ const list2 = closestCenter(args);
458
+ const own = list2.find((c) => c.id === args.active.id);
459
+ const start = args.active.rect.current.initial;
460
+ const unmoved = start && Math.abs(args.collisionRect.left - start.left) < 1 && Math.abs(args.collisionRect.top - start.top) < 1;
461
+ return own && unmoved ? [own, ...list2.filter((c) => c !== own)] : list2;
458
462
  }
459
463
  const hits = pointerWithin(args);
460
464
  const list = hits.length ? hits : rectIntersection(args);
@@ -1224,7 +1228,10 @@ function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version
1224
1228
  []
1225
1229
  );
1226
1230
  const fixedWidths = virtual && labelsWide?.grid === grid ? labelsWide.widths : null;
1227
- const focusNext = useRef4(false);
1231
+ const focusNext = useRef4(
1232
+ /** @type {{ r: number, c: number } | null} */
1233
+ null
1234
+ );
1228
1235
  const [sortNote, setSortNote] = useState5("");
1229
1236
  const focusToggle = useRef4(
1230
1237
  /** @type {string | null} */
@@ -1377,7 +1384,7 @@ function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version
1377
1384
  if (!valueAt(r, c)) {
1378
1385
  return;
1379
1386
  }
1380
- focusNext.current = true;
1387
+ focusNext.current = { r, c };
1381
1388
  setActive({ r, c });
1382
1389
  const el = wrap.current;
1383
1390
  if (virtual && el) {
@@ -1394,10 +1401,16 @@ function PivotTable({ grid, view, labels, onToggle: toggleGroup, onCell, version
1394
1401
  const button = [...table.current.querySelectorAll("button[data-pk-toggle]")].find((b) => b.getAttribute("data-pk-toggle") === key);
1395
1402
  button?.focus({ preventScroll: true });
1396
1403
  }
1397
- if (focusNext.current && current) {
1398
- focusNext.current = false;
1399
- const td = table.current?.querySelector(`td[data-r="${current.r}"][data-c="${current.c}"]`);
1400
- td?.focus({ preventScroll: false });
1404
+ const next = focusNext.current;
1405
+ if (next && current && current.r === next.r && current.c === next.c) {
1406
+ const td = (
1407
+ /** @type {HTMLElement | null} */
1408
+ table.current?.querySelector(`td[data-r="${current.r}"][data-c="${current.c}"]`)
1409
+ );
1410
+ if (td) {
1411
+ focusNext.current = null;
1412
+ td.focus({ preventScroll: false });
1413
+ }
1401
1414
  }
1402
1415
  });
1403
1416
  const onKeyDown = (e) => {
package/dist/labels.js CHANGED
@@ -6,17 +6,17 @@ import {
6
6
  } from "./chunks/chunk-MU5BTKSY.js";
7
7
  import {
8
8
  en
9
- } from "./chunks/chunk-RNQ32FCN.js";
9
+ } from "./chunks/chunk-ZM45YU3W.js";
10
10
  import {
11
11
  de
12
12
  } from "./chunks/chunk-GUSQWPTH.js";
13
13
  import {
14
14
  de as de2,
15
15
  en as en2
16
- } from "./chunks/chunk-BHHIZHUE.js";
16
+ } from "./chunks/chunk-6OWC6X5W.js";
17
17
  import {
18
18
  LABELS
19
- } from "./chunks/chunk-SJCG4I57.js";
19
+ } from "./chunks/chunk-3WWWKPB4.js";
20
20
 
21
21
  // src/all-labels.js
22
22
  var LABELS2 = Object.freeze({ en: { ...LABELS.en, ...en, unused: en3, dataImport: en2 }, de: { ...LABELS.de, ...de, unused: de3, dataImport: de2 } });
package/dist/menus.js CHANGED
@@ -67,12 +67,12 @@ import {
67
67
  withLinkParam,
68
68
  yearOf,
69
69
  yearText
70
- } from "./chunks/chunk-VMJMDP7C.js";
70
+ } from "./chunks/chunk-W2SVDHGN.js";
71
71
  import {
72
72
  addMenuTexts,
73
73
  hasMenuTexts,
74
74
  menuLabels
75
- } from "./chunks/chunk-RNQ32FCN.js";
75
+ } from "./chunks/chunk-ZM45YU3W.js";
76
76
  import {
77
77
  listedFor,
78
78
  sheetOfSource
@@ -98,7 +98,7 @@ import {
98
98
  hostFailure,
99
99
  messageOf,
100
100
  plural
101
- } from "./chunks/chunk-SJCG4I57.js";
101
+ } from "./chunks/chunk-3WWWKPB4.js";
102
102
 
103
103
  // src/chip-menus.jsx
104
104
  import React6, { useId as useId4, useMemo as useMemo3, useState as useState4 } from "react";
@@ -3335,7 +3335,7 @@ async function copyImage(blob, env = { clipboard: typeof navigator !== "undefine
3335
3335
  }
3336
3336
 
3337
3337
  // src/version.js
3338
- var VERSION = true ? "0.8.0" : "0.0.0-source";
3338
+ var VERSION = true ? "0.8.2" : "0.0.0-source";
3339
3339
 
3340
3340
  // src/share-actions.js
3341
3341
  var here = () => typeof location !== "undefined" ? location.href : void 0;
package/dist/styles.css CHANGED
@@ -39,12 +39,25 @@
39
39
  --pk-section-pad: 6px;
40
40
  --pk-shelf-gap: 4px;
41
41
  --pk-shelf-pad: 4px;
42
+ --pk-shelf-pad-block: calc(var(--pk-shelf-pad) + 2px);
42
43
  --pk-shelf-min: 17em;
44
+ --pk-zone-border: var(--pk-border-strong);
43
45
  --pk-chip-gap: 6px;
44
46
  --pk-chip-h: 2.2em;
45
47
  --pk-add-gap: 12px;
46
48
  --pk-add-hover: var(--pk-accent-soft);
47
49
  --pk-tab-mark: 3px;
50
+ --pk-tab-bg: transparent;
51
+ --pk-tab-text: var(--pk-muted);
52
+ --pk-tab-selected-bg: var(--pk-surface);
53
+ --pk-tab-selected-text: var(--pk-accent);
54
+ --pk-icon-button-text: var(--pk-muted);
55
+ --pk-icon-button-hover-bg: var(--pk-surface-3);
56
+ --pk-button-border: var(--pk-border);
57
+ --pk-button-border-hover: var(--pk-border-strong);
58
+ --pk-primary-bg: var(--pk-accent);
59
+ --pk-primary-text: var(--pk-accent-text);
60
+ --pk-primary-hover-bg: color-mix(in srgb, var(--pk-accent) 88%, var(--pk-text));
48
61
  --pk-tooltip-name-w: 12em;
49
62
  --pk-duration: 180ms;
50
63
  --pk-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
@@ -244,7 +257,7 @@
244
257
  gap: 0.45em;
245
258
  height: 2.35em;
246
259
  padding: 0 0.8em;
247
- border: 1px solid var(--pk-border);
260
+ border: 1px solid var(--pk-button-border);
248
261
  border-radius: var(--pk-radius-sm);
249
262
  background: var(--pk-surface);
250
263
  color: var(--pk-text);
@@ -258,7 +271,7 @@
258
271
  }
259
272
  .pk-btn:hover:not(:disabled, .pk-off) {
260
273
  background: var(--pk-surface-3);
261
- border-color: var(--pk-border-strong);
274
+ border-color: var(--pk-button-border-hover);
262
275
  }
263
276
  .pk-btn:active:not(:disabled, .pk-off) {
264
277
  transform: translateY(1px);
@@ -275,13 +288,13 @@
275
288
  border-color: var(--pk-accent);
276
289
  }
277
290
  .pk-btn.pk-primary {
278
- background: var(--pk-accent);
279
- border-color: var(--pk-accent);
280
- color: var(--pk-accent-text);
291
+ background: var(--pk-primary-bg);
292
+ border-color: var(--pk-primary-bg);
293
+ color: var(--pk-primary-text);
281
294
  font-weight: var(--pk-weight-strong);
282
295
  }
283
296
  .pk-btn.pk-primary:hover:not(:disabled) {
284
- background: color-mix(in srgb, var(--pk-accent) 88%, var(--pk-text));
297
+ background: var(--pk-primary-hover-bg);
285
298
  }
286
299
  .pk-caret {
287
300
  opacity: 0.6;
@@ -296,13 +309,13 @@
296
309
  border: 0;
297
310
  border-radius: var(--pk-radius-sm);
298
311
  background: transparent;
299
- color: var(--pk-muted);
312
+ color: var(--pk-icon-button-text);
300
313
  cursor: pointer;
301
314
  transition: background var(--pk-duration), color var(--pk-duration);
302
315
  }
303
316
  .pk-icon-btn:hover,
304
317
  .pk-icon-btn[aria-haspopup][aria-expanded=true] {
305
- background: var(--pk-surface-3);
318
+ background: var(--pk-icon-button-hover-bg);
306
319
  color: var(--pk-text);
307
320
  }
308
321
  .pk-link {
@@ -681,11 +694,16 @@
681
694
  border-radius: 50%;
682
695
  background: var(--pk-accent);
683
696
  }
684
- .pk-zones {
685
- display: flex;
686
- flex-wrap: wrap;
697
+ :is(.pk-zones, .pk-skel-zones) {
698
+ display: grid;
699
+ grid-template-columns: minmax(0, 1fr);
687
700
  gap: var(--pk-shelf-gap);
688
701
  }
702
+ @container pk-main (width >= 640px) {
703
+ :is(.pk-zones, .pk-skel-zones) {
704
+ grid-template-columns: repeat(auto-fit, minmax(max(var(--pk-shelf-min), calc(50% - var(--pk-shelf-gap))), 1fr));
705
+ }
706
+ }
689
707
  .pk-zone-section {
690
708
  display: flex;
691
709
  flex-direction: column;
@@ -763,15 +781,16 @@
763
781
  }
764
782
  }
765
783
  .pk-zone {
784
+ container: pk-zone / inline-size;
766
785
  position: relative;
767
786
  display: flex;
768
- flex: 1 1 auto;
787
+ flex-wrap: wrap;
788
+ align-content: flex-start;
769
789
  align-items: flex-start;
770
790
  gap: var(--pk-chip-gap);
771
- min-width: min(100%, var(--pk-shelf-min));
772
- max-width: 100%;
773
- padding: var(--pk-shelf-pad);
774
- border: 1.5px dashed transparent;
791
+ min-width: 0;
792
+ padding: var(--pk-shelf-pad-block) var(--pk-shelf-pad);
793
+ border: 1.5px solid var(--pk-zone-border);
775
794
  border-radius: var(--pk-radius);
776
795
  background: var(--pk-surface-2);
777
796
  transition:
@@ -780,6 +799,7 @@
780
799
  box-shadow var(--pk-duration);
781
800
  }
782
801
  .pk-zone.pk-dropping {
802
+ border-style: dashed;
783
803
  border-color: var(--pk-drop-border);
784
804
  }
785
805
  .pk-zone.pk-over {
@@ -858,7 +878,7 @@
858
878
  }
859
879
  .pk-chips {
860
880
  display: flex;
861
- flex: 1 1 auto;
881
+ flex: 1 1 0;
862
882
  flex-wrap: wrap;
863
883
  align-items: center;
864
884
  gap: var(--pk-chip-gap);
@@ -2064,8 +2084,8 @@
2064
2084
  border: 1px solid transparent;
2065
2085
  border-bottom: 0;
2066
2086
  border-radius: var(--pk-radius-sm) var(--pk-radius-sm) 0 0;
2067
- background: none;
2068
- color: var(--pk-muted);
2087
+ background: var(--pk-tab-bg);
2088
+ color: var(--pk-tab-text);
2069
2089
  font: inherit;
2070
2090
  font-weight: var(--pk-weight-strong);
2071
2091
  cursor: pointer;
@@ -2076,8 +2096,8 @@
2076
2096
  }
2077
2097
  .pk-tab[aria-selected=true] {
2078
2098
  border-color: var(--pk-border);
2079
- background: var(--pk-surface);
2080
- color: var(--pk-accent);
2099
+ background: var(--pk-tab-selected-bg);
2100
+ color: var(--pk-tab-selected-text);
2081
2101
  }
2082
2102
  .pk-tab[aria-selected=true]::after {
2083
2103
  position: absolute;
@@ -2824,14 +2844,11 @@
2824
2844
  visibility: visible;
2825
2845
  transition: transform calc(var(--pk-duration) * 1.4) var(--pk-ease), visibility 0s;
2826
2846
  }
2827
- @container pk-main (width < 400px) {
2828
- .pk-zone {
2829
- flex-wrap: wrap;
2830
- }
2831
- .pk-zone .pk-zone-head {
2847
+ @container pk-zone (width < 26em) {
2848
+ .pk-zone-head {
2832
2849
  width: 100%;
2833
2850
  }
2834
- .pk-zone .pk-zone-add {
2851
+ .pk-zone-add {
2835
2852
  margin-inline-start: auto;
2836
2853
  }
2837
2854
  }
@@ -2977,6 +2994,7 @@
2977
2994
  display: none;
2978
2995
  }
2979
2996
  .pk-skel-main {
2997
+ container: pk-main / inline-size;
2980
2998
  display: flex;
2981
2999
  flex: 1;
2982
3000
  flex-direction: column;
@@ -2993,11 +3011,6 @@
2993
3011
  .pk-skel-grow {
2994
3012
  flex: 1;
2995
3013
  }
2996
- .pk-skel-zones {
2997
- display: flex;
2998
- flex-wrap: wrap;
2999
- gap: var(--pk-shelf-gap);
3000
- }
3001
3014
  .pk-skel-table {
3002
3015
  display: flex;
3003
3016
  flex-direction: column;
@@ -3031,9 +3044,7 @@
3031
3044
  width: 9em;
3032
3045
  }
3033
3046
  .pk-skel-zone {
3034
- flex: 1 1 calc(50% - var(--pk-shelf-gap));
3035
- min-width: min(100%, var(--pk-shelf-min));
3036
- height: calc(var(--pk-chip-h) + 2 * var(--pk-shelf-pad));
3047
+ height: calc(var(--pk-chip-h) + 2 * var(--pk-shelf-pad-block));
3037
3048
  border-radius: var(--pk-radius);
3038
3049
  }
3039
3050
  .pk-skel-cell {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pivotkit-react",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "description": "React 18/19 pivot report builder on pivotkit-core: drag-and-drop fields, table and Apache ECharts chart, filters, views as JSON files, undo, Excel and CSV export.",
5
5
  "license": "MIT",
6
6
  "author": "eizedev <oss@eize.dev>",