@siyahi/ui 0.1.9-next.17 → 0.1.9-next.19

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 (93) hide show
  1. package/README.md +77 -207
  2. package/agents/examples/accordion.tsx +39 -0
  3. package/agents/examples/alert.tsx +25 -0
  4. package/agents/examples/app-sidebar.tsx +38 -0
  5. package/agents/examples/avatar.tsx +14 -0
  6. package/agents/examples/badge.tsx +18 -0
  7. package/agents/examples/bar-list-labels.tsx +22 -0
  8. package/agents/examples/bar-list-sides.tsx +30 -0
  9. package/agents/examples/bar-list.tsx +24 -0
  10. package/agents/examples/breadcrumb.tsx +28 -0
  11. package/agents/examples/button.tsx +21 -0
  12. package/agents/examples/calendar.tsx +15 -0
  13. package/agents/examples/card.tsx +34 -0
  14. package/agents/examples/chart-area.tsx +38 -0
  15. package/agents/examples/chart-bar-flows.tsx +31 -0
  16. package/agents/examples/chart-bar-hourly.tsx +28 -0
  17. package/agents/examples/chart-bar-losses.tsx +29 -0
  18. package/agents/examples/chart-bar-sectors.tsx +70 -0
  19. package/agents/examples/chart-bar-years.tsx +40 -0
  20. package/agents/examples/chart-bar.tsx +56 -0
  21. package/agents/examples/chart-category-ticks.tsx +50 -0
  22. package/agents/examples/chart-line-events.tsx +47 -0
  23. package/agents/examples/chart-line-timeline.tsx +41 -0
  24. package/agents/examples/chart-line.tsx +57 -0
  25. package/agents/examples/code-block.tsx +38 -0
  26. package/agents/examples/collapsible.tsx +16 -0
  27. package/agents/examples/command.tsx +27 -0
  28. package/agents/examples/context-menu.tsx +15 -0
  29. package/agents/examples/copy-button.tsx +8 -0
  30. package/agents/examples/data-bar.tsx +121 -0
  31. package/agents/examples/data-table-filters.tsx +103 -0
  32. package/agents/examples/data-table.tsx +98 -0
  33. package/agents/examples/delta.tsx +13 -0
  34. package/agents/examples/dialog.tsx +28 -0
  35. package/agents/examples/distribution-bar-budget.tsx +30 -0
  36. package/agents/examples/distribution-bar-tug.tsx +72 -0
  37. package/agents/examples/dropdown-menu.tsx +31 -0
  38. package/agents/examples/formatters.tsx +42 -0
  39. package/agents/examples/heatmap-calendar.tsx +50 -0
  40. package/agents/examples/heatmap-status.tsx +51 -0
  41. package/agents/examples/heatmap-weekday.tsx +53 -0
  42. package/agents/examples/input.tsx +17 -0
  43. package/agents/examples/local-time.tsx +14 -0
  44. package/agents/examples/metric-strip.tsx +40 -0
  45. package/agents/examples/page-section.tsx +52 -0
  46. package/agents/examples/popover.tsx +23 -0
  47. package/agents/examples/price-chart.tsx +32 -0
  48. package/agents/examples/progress-tone.tsx +28 -0
  49. package/agents/examples/progress.tsx +10 -0
  50. package/agents/examples/scroll-area.tsx +20 -0
  51. package/agents/examples/section-cards-select.tsx +27 -0
  52. package/agents/examples/section-cards-trend.tsx +30 -0
  53. package/agents/examples/section-cards.tsx +48 -0
  54. package/agents/examples/select.tsx +27 -0
  55. package/agents/examples/separator.tsx +13 -0
  56. package/agents/examples/sheet.tsx +15 -0
  57. package/agents/examples/skeleton.tsx +11 -0
  58. package/agents/examples/slider.tsx +5 -0
  59. package/agents/examples/surfaces.tsx +115 -0
  60. package/agents/examples/table.tsx +50 -0
  61. package/agents/examples/tabs.tsx +16 -0
  62. package/agents/examples/toggle-group.tsx +12 -0
  63. package/agents/examples/toggle.tsx +11 -0
  64. package/agents/examples/tooltip.tsx +13 -0
  65. package/agents/examples/treemap.tsx +87 -0
  66. package/agents/manifest.json +931 -0
  67. package/agents/report-rules.json +7 -0
  68. package/dist/components/registry/charts/bar-chart-card.js +1 -0
  69. package/dist/components/registry/dashboardcn/bar-list.js +8 -7
  70. package/dist/components/registry/heatmap/calendar-heatmap.js +8 -1
  71. package/dist/components/registry/heatmap/status-heatmap.js +8 -1
  72. package/dist/components/registry/heatmap/weekday-heatmap.d.ts +6 -2
  73. package/dist/components/registry/heatmap/weekday-heatmap.js +56 -37
  74. package/dist/components/registry/niko-table/core/data-table-context.d.ts +2 -0
  75. package/dist/components/registry/niko-table/core/data-table-context.js +21 -0
  76. package/dist/components/registry/niko-table/core/data-table-grouped-row.js +3 -1
  77. package/dist/components/registry/niko-table/core/data-table-structure.js +15 -12
  78. package/dist/components/registry/niko-table/core/data-table.d.ts +2 -2
  79. package/dist/components/registry/niko-table/core/data-table.js +5 -1
  80. package/dist/components/registry/niko-table/filters/table-search-filter.js +1 -1
  81. package/dist/components/registry/niko-table/lib/flex-columns.d.ts +1 -1
  82. package/dist/components/registry/niko-table/lib/flex-columns.js +3 -3
  83. package/dist/components/registry/niko-table/lib/styles.d.ts +1 -1
  84. package/dist/components/registry/niko-table/lib/styles.js +2 -2
  85. package/dist/components/registry/sidebar-07/nav-main.js +7 -1
  86. package/dist/components/siyahi/treemap.js +46 -4
  87. package/dist/lib/chart-frame.js +180 -124
  88. package/dist/lib/chart-series.d.ts +1 -1
  89. package/dist/lib/format.js +32 -13
  90. package/dist/lib/heatmap-navigation.d.ts +8 -0
  91. package/dist/lib/heatmap-navigation.js +49 -0
  92. package/package.json +3 -1
  93. package/styles/siyahi.css +24 -0
@@ -0,0 +1,49 @@
1
+ import { useLayoutEffect, useRef } from "react";
2
+ //#region src/lib/heatmap-navigation.ts
3
+ /** One tab stop per heatmap; arrows move between its actual drawn cells. */
4
+ function useHeatmapNavigation() {
5
+ const ref = useRef(null);
6
+ const cells = () => [...ref.current?.querySelectorAll("rect[role=\"button\"]") ?? []];
7
+ useLayoutEffect(() => {
8
+ const buttons = cells();
9
+ const active = buttons.find((cell) => cell === document.activeElement) ?? buttons[0];
10
+ for (const cell of buttons) cell.tabIndex = cell === active ? 0 : -1;
11
+ });
12
+ const onKeyDown = (event) => {
13
+ if (!(event.target instanceof SVGElement) || event.target.getAttribute("role") !== "button") return;
14
+ const buttons = cells();
15
+ let next;
16
+ if (event.key === "Home") next = buttons[0];
17
+ else if (event.key === "End") next = buttons.at(-1);
18
+ else if ([
19
+ "ArrowLeft",
20
+ "ArrowRight",
21
+ "ArrowUp",
22
+ "ArrowDown"
23
+ ].includes(event.key)) {
24
+ const origin = event.target.getBoundingClientRect();
25
+ const horizontal = event.key === "ArrowLeft" || event.key === "ArrowRight";
26
+ const direction = event.key === "ArrowLeft" || event.key === "ArrowUp" ? -1 : 1;
27
+ let nearest = Infinity;
28
+ for (const cell of buttons) {
29
+ const box = cell.getBoundingClientRect();
30
+ const primary = (horizontal ? box.x - origin.x : box.y - origin.y) * direction;
31
+ const distance = primary + Math.abs(horizontal ? box.y - origin.y : box.x - origin.x) * 4;
32
+ if (primary > 1 && distance < nearest) {
33
+ nearest = distance;
34
+ next = cell;
35
+ }
36
+ }
37
+ } else return;
38
+ event.preventDefault();
39
+ if (!next) return;
40
+ for (const cell of buttons) cell.tabIndex = cell === next ? 0 : -1;
41
+ next.focus();
42
+ };
43
+ return {
44
+ ref,
45
+ onKeyDown
46
+ };
47
+ }
48
+ //#endregion
49
+ export { useHeatmapNavigation };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siyahi/ui",
3
- "version": "0.1.9-next.17",
3
+ "version": "0.1.9-next.19",
4
4
  "description": "Stock shadcn/ui on Base UI and Tailwind v4, a finance theme, a few compositions and formatters.",
5
5
  "keywords": [
6
6
  "base-ui",
@@ -19,6 +19,7 @@
19
19
  "directory": "packages/ui"
20
20
  },
21
21
  "files": [
22
+ "agents",
22
23
  "dist",
23
24
  "styles",
24
25
  "report.css",
@@ -32,6 +33,7 @@
32
33
  "**/*.css"
33
34
  ],
34
35
  "exports": {
36
+ "./agents/*": "./agents/*",
35
37
  ".": {
36
38
  "types": "./dist/index.d.ts",
37
39
  "default": "./dist/index.js"
package/styles/siyahi.css CHANGED
@@ -205,6 +205,30 @@
205
205
  }
206
206
  }
207
207
 
208
+ /* Touch targets follow input capability, including touch laptops. */
209
+ @media (pointer: coarse) {
210
+ :is(
211
+ [class~="group/button"],
212
+ [data-slot="toggle"],
213
+ [data-slot="toggle-group-item"],
214
+ [data-slot="select-trigger"],
215
+ [data-slot="tabs-trigger"],
216
+ [data-slot="input-group-button"]
217
+ ) {
218
+ min-height: --spacing(11);
219
+ min-width: --spacing(11);
220
+ }
221
+ :is([data-slot="input"], [data-slot="textarea"], [data-slot="input-group"], [data-slot="input-group-control"]) {
222
+ min-height: --spacing(11);
223
+ }
224
+ :is([data-slot="input"], [data-slot="textarea"], [data-slot="input-group-control"], [data-slot="command-input"]) {
225
+ font-size: 1rem;
226
+ }
227
+ [role="search"] > [data-slot="input"] {
228
+ padding-right: --spacing(14);
229
+ }
230
+ }
231
+
208
232
  /*
209
233
  * On a narrow card a header action (a toggle, a button) drops under the title
210
234
  * and description, left-aligned. Stock CardHeader keeps the action in its own