@techsio/ui-kit 0.37.1 → 0.39.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.
Files changed (28) hide show
  1. package/dist/molecules/chart.js +393 -0
  2. package/dist/organisms/data-table.fields.js +720 -0
  3. package/dist/organisms/data-table.helpers.js +168 -0
  4. package/dist/organisms/data-table.js +1736 -0
  5. package/dist/organisms/table.js +7 -3
  6. package/dist/src/molecules/chart.d.ts +64 -0
  7. package/dist/src/molecules/chart.d.ts.map +1 -0
  8. package/dist/src/molecules/switch.d.ts +3 -3
  9. package/dist/src/molecules/toast.d.ts +3 -3
  10. package/dist/src/organisms/data-table.d.ts +357 -0
  11. package/dist/src/organisms/data-table.d.ts.map +1 -0
  12. package/dist/src/organisms/data-table.fields.d.ts +119 -0
  13. package/dist/src/organisms/data-table.fields.d.ts.map +1 -0
  14. package/dist/src/organisms/data-table.helpers.d.ts +240 -0
  15. package/dist/src/organisms/data-table.helpers.d.ts.map +1 -0
  16. package/dist/src/organisms/table.d.ts +15 -7
  17. package/dist/src/organisms/table.d.ts.map +1 -1
  18. package/dist/stories/changelog/changelog.stories.d.ts.map +1 -1
  19. package/dist/stories/molecules/chart.stories.d.ts +24 -0
  20. package/dist/stories/molecules/chart.stories.d.ts.map +1 -0
  21. package/dist/stories/organisms/data-table.stories.d.ts +145 -0
  22. package/dist/stories/organisms/data-table.stories.d.ts.map +1 -0
  23. package/dist/stories/organisms/table.stories.d.ts +7 -0
  24. package/dist/stories/organisms/table.stories.d.ts.map +1 -1
  25. package/package.json +14 -1
  26. package/src/tokens/components/components.css +2 -0
  27. package/src/tokens/components/molecules/_chart.css +98 -0
  28. package/src/tokens/components/organisms/_data-table.css +51 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@techsio/ui-kit",
3
- "version": "0.37.1",
3
+ "version": "0.39.0",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -78,10 +78,19 @@
78
78
  "semantic-release": "semantic-release"
79
79
  },
80
80
  "dependencies": {
81
+ "@dnd-kit/core": "^6.3.1",
82
+ "@dnd-kit/modifiers": "^9.0.0",
83
+ "@dnd-kit/sortable": "^10.0.0",
84
+ "@dnd-kit/utilities": "^3.2.2",
81
85
  "@iconify-json/mdi": "^1.2.3",
82
86
  "@iconify-json/mdi-light": "^1.2.2",
83
87
  "@iconify-json/svg-spinners": "^1.2.4",
84
88
  "@iconify/tailwind4": "^1.1.0",
89
+ "@tanstack/charts": "^0.6.5",
90
+ "@tanstack/charts-scales": "^0.6.5",
91
+ "@tanstack/react-charts": "^0.6.5",
92
+ "@tanstack/react-table": "^9.1.2",
93
+ "@tanstack/react-virtual": "^3.14.8",
85
94
  "@zag-js/accordion": "^1.41.2",
86
95
  "@zag-js/carousel": "^1.41.2",
87
96
  "@zag-js/checkbox": "^1.41.2",
@@ -104,6 +113,8 @@
104
113
  "@zag-js/tooltip": "^1.41.2",
105
114
  "@zag-js/tree-view": "^1.41.2",
106
115
  "better-themes": "^1.1.0",
116
+ "d3-scale": "^4.0.2",
117
+ "d3-shape": "^3.2.0",
107
118
  "libphonenumber-js": "^1.13.2",
108
119
  "tailwind-merge": "^3.4.0",
109
120
  "tailwind-variants": "^3.1.1",
@@ -129,6 +140,8 @@
129
140
  "@tailwindcss/postcss": "^4.1.17",
130
141
  "@techsio/storybook-a11y-reporter": "0.1.3",
131
142
  "@techsio/storybook-better-a11y": "0.1.3",
143
+ "@types/d3-scale": "^4.0.9",
144
+ "@types/d3-shape": "^3.1.8",
132
145
  "@typescript-eslint/parser": "^8.47.0",
133
146
  "eslint": "^9.39.1",
134
147
  "eslint-plugin-tailwindcss": "beta",
@@ -19,6 +19,7 @@
19
19
  @import "./molecules/_accordion.css";
20
20
  @import "./molecules/_breadcrumb.css";
21
21
  @import "./molecules/_carousel.css";
22
+ @import "./molecules/_chart.css";
22
23
  @import "./molecules/_color-select.css";
23
24
  @import "./molecules/_combobox.css";
24
25
  @import "./molecules/_dialog.css";
@@ -39,6 +40,7 @@
39
40
  @import "./molecules/_tree-view.css";
40
41
 
41
42
  @import "./organisms/_table.css";
43
+ @import "./organisms/_data-table.css";
42
44
  @import "./organisms/_footer.css";
43
45
  @import "./organisms/_header.css";
44
46
  @import "./organisms/_gallery.css";
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Chart — PROTOTYPE tokens (not yet exported from Figma; once the MVP look is
3
+ * signed off, mirror these into Figma via the figma-token-binding skill).
4
+ *
5
+ * Series palette: six fixed-order categorical hues for data identity. The
6
+ * exact primitive steps were chosen so the SAME values pass the dataviz
7
+ * six-checks validator (lightness band, chroma floor, adjacent-pair CVD
8
+ * separation, normal-vision floor, >=3:1 surface contrast) on BOTH the light
9
+ * (white) and dark (gray-950) chart surfaces — hence no light-dark() split.
10
+ *
11
+ * `--color-primary` (blue-300/sky-300) is deliberately NOT series-1: it sits
12
+ * outside the chart lightness band in light mode. Brand themes that want
13
+ * branded charts should override `--color-chart-series-*` with steps that
14
+ * re-pass the validator, not alias the brand accent directly.
15
+ */
16
+
17
+ @theme static {
18
+ /* Reference layer — series identity, assigned in fixed order. The palette is
19
+ * six entries and TanStack indexes it modulo its length (scales.js), so a 7th
20
+ * distinct series wraps back onto series-1 rather than erroring. Keep charts
21
+ * to <=6 series; Chart warns in dev when a dataset exceeds that.
22
+ *
23
+ * Note: `--color-blue-500` is re-declared by figma/variables.css, which is
24
+ * imported after this file — series-1 therefore resolves to the Figma step
25
+ * (chroma 0.188), not Tailwind's default (chroma 0.214). Series 2-6 have no
26
+ * Figma counterpart and resolve to Tailwind defaults. Re-run the dataviz
27
+ * validator against these *resolved* values before treating the set as
28
+ * signed off. */
29
+ --color-chart-series-1: var(--color-blue-500);
30
+ --color-chart-series-2: var(--color-orange-600);
31
+ --color-chart-series-3: var(--color-emerald-600);
32
+ --color-chart-series-4: var(--color-violet-500);
33
+ --color-chart-series-5: var(--color-rose-500);
34
+ --color-chart-series-6: var(--color-cyan-600);
35
+
36
+ /* Derived layer — chart chrome and tooltip surface. Axis/tick/legend text
37
+ * renders at small sizes inside the SVG, so it wears primary ink rather than
38
+ * the secondary tone.
39
+ *
40
+ * Caveat on the contrast math: TanStack composites this color before it
41
+ * paints — tick/legend labels at fillOpacity 0.68, axis lines at
42
+ * strokeOpacity 0.28 (scene.js). So the *rendered* label is fg-primary at 68%
43
+ * over the surface, not fg-primary itself, and it does not reach the repo's
44
+ * 90 Lc gold gate on its own. Fixing that properly means compensating for the
45
+ * library opacity (or overriding it), not swapping this token — tracked in
46
+ * https://github.com/TechsioCZ/new-engine/issues/608 rather than silently
47
+ * claimed as passing. */
48
+ --color-chart-fg: var(--color-fg-primary);
49
+ --color-chart-tooltip-bg: var(--color-tooltip-bg);
50
+ --color-chart-tooltip-fg: var(--color-tooltip-fg);
51
+ --color-chart-tooltip-border: var(--color-tooltip-border-outline);
52
+ --radius-chart-tooltip: var(--radius-tooltip);
53
+ --text-chart-tooltip: var(--text-tooltip-md);
54
+ --padding-chart-tooltip: var(--padding-tooltip-md);
55
+ --border-width-chart-tooltip: var(--border-width-tooltip);
56
+ --font-chart-tooltip: var(--font-body);
57
+ --font-weight-chart-tooltip: var(--font-weight-medium);
58
+ }
59
+
60
+ /*
61
+ * Bridge our series tokens into TanStack Charts' categorical palette
62
+ * variables (`--ts-chart-1..6`). Axis text, muted labels and grid lines
63
+ * inherit `currentColor`, so the host also carries `text-chart-fg`.
64
+ */
65
+ @utility chart-base {
66
+ --ts-chart-1: var(--color-chart-series-1);
67
+ --ts-chart-2: var(--color-chart-series-2);
68
+ --ts-chart-3: var(--color-chart-series-3);
69
+ --ts-chart-4: var(--color-chart-series-4);
70
+ --ts-chart-5: var(--color-chart-series-5);
71
+ --ts-chart-6: var(--color-chart-series-6);
72
+ }
73
+
74
+ /*
75
+ * Surface styling for the library's native HTML tooltip element.
76
+ *
77
+ * `!important` is load-bearing, not defensive: TanStack's `createTooltip()`
78
+ * writes background/color/border/border-radius/padding and a `font` shorthand
79
+ * directly onto `element.style`, then only *appends* this class. Inline styles
80
+ * beat class rules, so without `!important` every declaration below is dead and
81
+ * the tooltip renders in the system `Canvas`/`CanvasText` colors — visible as an
82
+ * unthemed tooltip under the neo/cyber brands and in dark mode. The `font`
83
+ * shorthand also resets font-size, so that too must win.
84
+ */
85
+ @utility chart-tooltip {
86
+ background: var(--color-chart-tooltip-bg) !important;
87
+ color: var(--color-chart-tooltip-fg) !important;
88
+ border: var(--border-width-chart-tooltip) solid
89
+ var(--color-chart-tooltip-border) !important;
90
+ border-radius: var(--radius-chart-tooltip) !important;
91
+ padding: var(--padding-chart-tooltip) !important;
92
+ /* The inline `font` shorthand sets family, weight, size and line-height in
93
+ * one go, so countering only the size would leave the chart tooltip in
94
+ * system-ui while every other tooltip in the library uses --font-body. */
95
+ font-family: var(--font-chart-tooltip) !important;
96
+ font-size: var(--text-chart-tooltip) !important;
97
+ font-weight: var(--font-weight-chart-tooltip) !important;
98
+ }
@@ -0,0 +1,51 @@
1
+ /*
2
+ * DataTable — nested-row tint.
3
+ *
4
+ * `tintNestedRows` shades a row by `row.depth` as an inset box-shadow rather
5
+ * than a background, so it composes with `striped`'s zebra background instead
6
+ * of losing the Tailwind-merge conflict against it (two `bg-*` utilities on
7
+ * one element can't both render; a shadow layers on top of whichever
8
+ * background is already there). Reuses `--color-table-row-bg-hover`, an
9
+ * existing Figma-exported Table token, rather than a raw semantic token or a
10
+ * new one added ahead of the Figma sync this component's other colors are
11
+ * still waiting on (see the "PROTOTYPE styling" note in data-table.tsx).
12
+ */
13
+ /*
14
+ * Verified: box-shadow on a `<tr>` *does* paint under `border-collapse` in
15
+ * Blink (Chromium 149) — a differential screenshot of a plain vs tinted row in
16
+ * a collapsed table measures 255,255,255 vs 178,178,178. This has been
17
+ * reported several times as a no-op; it is not one in Chrome. Not verified in
18
+ * WebKit/Safari, so if the tint is ever confirmed missing there, the fix is a
19
+ * `background-image` gradient layer (as `data-table-frozen-cell` uses), which
20
+ * composes with `striped` without the Tailwind-merge conflict a `background`
21
+ * would cause.
22
+ */
23
+ @utility data-table-row-nested-tint {
24
+ box-shadow: inset 0 0 0 9999px var(--color-table-row-bg-hover);
25
+ }
26
+
27
+ /*
28
+ * DataTable — frozen (pinned / sticky-actions) cell surface.
29
+ *
30
+ * A frozen cell must be opaque, or the horizontally-scrolled content passes
31
+ * straight under it. It must *also* show the row's own colour, or striping and
32
+ * selection stop dead at the frozen column.
33
+ *
34
+ * `background: inherit` gives the second without the first: every row-level
35
+ * tint in this system is an alpha overlay meant to composite over a surface
36
+ * (`--color-table-row-striped-secondary` is literally `oklch(0 0 0 / 0)`), so
37
+ * inheriting it yields a see-through cell.
38
+ *
39
+ * Compositing solves both at once — the same trick `OPAQUE_HEADER_BG` uses for
40
+ * the header. The opaque table surface is the background-*color*; the row tint
41
+ * is painted over it as a gradient image, read from a custom property the row
42
+ * sets. Custom properties inherit, so the row can drive its cells' tint
43
+ * without either knowing about the other.
44
+ */
45
+ @utility data-table-frozen-cell {
46
+ background-color: var(--color-table-bg);
47
+ background-image: linear-gradient(
48
+ var(--dt-row-tint, transparent),
49
+ var(--dt-row-tint, transparent)
50
+ );
51
+ }