@gaulatti/bleecker 0.1.30 → 0.1.32

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 (84) hide show
  1. package/dist/components/area-chart.d.ts +13 -0
  2. package/dist/components/area-chart.js +9 -0
  3. package/dist/components/bar-chart.d.ts +13 -0
  4. package/dist/components/bar-chart.js +6 -0
  5. package/dist/components/button.d.ts +3 -1
  6. package/dist/components/button.js +6 -2
  7. package/dist/components/chart-theme.d.ts +46 -0
  8. package/dist/components/chart-theme.js +56 -0
  9. package/dist/components/chart.js +3 -10
  10. package/dist/components/dashboard-grid.d.ts +13 -0
  11. package/dist/components/dashboard-grid.js +8 -0
  12. package/dist/components/dashboard-section.d.ts +10 -0
  13. package/dist/components/dashboard-section.js +5 -0
  14. package/dist/components/data-list.d.ts +13 -0
  15. package/dist/components/data-list.js +5 -0
  16. package/dist/components/data-table-column-toggle.d.ts +7 -0
  17. package/dist/components/data-table-column-toggle.js +27 -0
  18. package/dist/components/data-table-filters.d.ts +22 -0
  19. package/dist/components/data-table-filters.js +11 -0
  20. package/dist/components/data-table-pagination.d.ts +7 -0
  21. package/dist/components/data-table-pagination.js +11 -0
  22. package/dist/components/data-table-toolbar.d.ts +11 -0
  23. package/dist/components/data-table-toolbar.js +9 -0
  24. package/dist/components/date-range-picker.d.ts +15 -0
  25. package/dist/components/date-range-picker.js +17 -0
  26. package/dist/components/donut-chart.d.ts +9 -0
  27. package/dist/components/donut-chart.js +5 -0
  28. package/dist/components/dropdown-menu.d.ts +27 -0
  29. package/dist/components/dropdown-menu.js +32 -0
  30. package/dist/components/error-state.d.ts +10 -0
  31. package/dist/components/error-state.js +7 -0
  32. package/dist/components/filter-chip.d.ts +13 -0
  33. package/dist/components/filter-chip.js +11 -0
  34. package/dist/components/funnel-chart.d.ts +12 -0
  35. package/dist/components/funnel-chart.js +10 -0
  36. package/dist/components/line-chart.d.ts +12 -0
  37. package/dist/components/line-chart.js +9 -0
  38. package/dist/components/loading-overlay.d.ts +8 -0
  39. package/dist/components/loading-overlay.js +9 -0
  40. package/dist/components/metric.d.ts +13 -0
  41. package/dist/components/metric.js +21 -0
  42. package/dist/components/notification-badge.d.ts +15 -0
  43. package/dist/components/notification-badge.js +9 -0
  44. package/dist/components/page-header.d.ts +11 -0
  45. package/dist/components/page-header.js +8 -0
  46. package/dist/components/pie-chart.d.ts +14 -0
  47. package/dist/components/pie-chart.js +6 -0
  48. package/dist/components/progress-stack.d.ts +14 -0
  49. package/dist/components/progress-stack.js +9 -0
  50. package/dist/components/radar-chart.d.ts +15 -0
  51. package/dist/components/radar-chart.js +9 -0
  52. package/dist/components/radial-bar-chart.d.ts +15 -0
  53. package/dist/components/radial-bar-chart.js +10 -0
  54. package/dist/components/sankey-chart.d.ts +29 -0
  55. package/dist/components/sankey-chart.js +26 -0
  56. package/dist/components/scatter-chart.d.ts +19 -0
  57. package/dist/components/scatter-chart.js +6 -0
  58. package/dist/components/search-input.d.ts +6 -0
  59. package/dist/components/search-input.js +9 -0
  60. package/dist/components/sidebar.d.ts +28 -0
  61. package/dist/components/sidebar.js +26 -0
  62. package/dist/components/skeleton.d.ts +18 -0
  63. package/dist/components/skeleton.js +11 -0
  64. package/dist/components/sparkline.d.ts +9 -0
  65. package/dist/components/sparkline.js +7 -0
  66. package/dist/components/stat-card.d.ts +19 -0
  67. package/dist/components/stat-card.js +19 -0
  68. package/dist/components/stepper.d.ts +16 -0
  69. package/dist/components/stepper.js +33 -0
  70. package/dist/components/sunburst-chart.d.ts +14 -0
  71. package/dist/components/sunburst-chart.js +35 -0
  72. package/dist/components/timeline.d.ts +15 -0
  73. package/dist/components/timeline.js +15 -0
  74. package/dist/index.d.ts +38 -0
  75. package/dist/index.js +38 -0
  76. package/dist/layout/admin-shell.d.ts +10 -0
  77. package/dist/layout/admin-shell.js +5 -0
  78. package/dist/styles.css +1 -1
  79. package/dist/utils/format.d.ts +15 -0
  80. package/dist/utils/format.js +63 -0
  81. package/dist/utils/hooks.d.ts +22 -0
  82. package/dist/utils/hooks.js +58 -0
  83. package/package.json +5 -3
  84. package/src/styles/global.css +153 -0
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Locale-aware formatting helpers for dashboard numbers, currency and dates.
3
+ */
4
+ export function formatNumber(value, options = {}) {
5
+ if (value === undefined || value === null || Number.isNaN(value))
6
+ return '';
7
+ const { locale, ...intlOptions } = options;
8
+ return new Intl.NumberFormat(locale, intlOptions).format(value);
9
+ }
10
+ export function formatCurrency(value, currency = 'USD', options = {}) {
11
+ if (value === undefined || value === null || Number.isNaN(value))
12
+ return '';
13
+ return new Intl.NumberFormat(options.locale, { style: 'currency', currency, ...options }).format(value);
14
+ }
15
+ export function formatCompactNumber(value, options = {}) {
16
+ if (value === undefined || value === null || Number.isNaN(value))
17
+ return '';
18
+ return new Intl.NumberFormat(options.locale, { notation: 'compact', ...options }).format(value);
19
+ }
20
+ export function formatPercent(value, options = {}) {
21
+ if (value === undefined || value === null || Number.isNaN(value))
22
+ return '';
23
+ return new Intl.NumberFormat(options.locale, { style: 'percent', minimumFractionDigits: 1, maximumFractionDigits: 1, ...options }).format(value);
24
+ }
25
+ export function formatDate(value, options = {}) {
26
+ if (value === undefined || value === null)
27
+ return '';
28
+ const date = typeof value === 'string' || typeof value === 'number' ? new Date(value) : value;
29
+ if (Number.isNaN(date.getTime()))
30
+ return '';
31
+ const { locale, dateStyle = 'medium', ...intlOptions } = options;
32
+ return new Intl.DateTimeFormat(locale, { dateStyle, ...intlOptions }).format(date);
33
+ }
34
+ export function formatDateTime(value, options = {}) {
35
+ if (value === undefined || value === null)
36
+ return '';
37
+ const date = typeof value === 'string' || typeof value === 'number' ? new Date(value) : value;
38
+ if (Number.isNaN(date.getTime()))
39
+ return '';
40
+ const { locale, ...intlOptions } = options;
41
+ return new Intl.DateTimeFormat(locale, { dateStyle: 'short', timeStyle: 'short', ...intlOptions }).format(date);
42
+ }
43
+ export function formatRelativeTime(value, locale = 'en-US') {
44
+ if (value === undefined || value === null)
45
+ return '';
46
+ const date = typeof value === 'string' || typeof value === 'number' ? new Date(value) : value;
47
+ if (Number.isNaN(date.getTime()))
48
+ return '';
49
+ const now = Date.now();
50
+ const diff = date.getTime() - now;
51
+ const seconds = Math.round(diff / 1000);
52
+ const minutes = Math.round(seconds / 60);
53
+ const hours = Math.round(minutes / 60);
54
+ const days = Math.round(hours / 24);
55
+ const rtf = new Intl.RelativeTimeFormat(locale, { numeric: 'auto' });
56
+ if (Math.abs(seconds) < 60)
57
+ return rtf.format(seconds, 'second');
58
+ if (Math.abs(minutes) < 60)
59
+ return rtf.format(minutes, 'minute');
60
+ if (Math.abs(hours) < 24)
61
+ return rtf.format(hours, 'hour');
62
+ return rtf.format(days, 'day');
63
+ }
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Returns true once the component has mounted. Useful for avoiding SSR
3
+ * hydration mismatches in components that read from `window`/`document`.
4
+ */
5
+ export declare function useMounted(): boolean;
6
+ /**
7
+ * Subscribes to a media query and returns its current match state.
8
+ */
9
+ export declare function useMediaQuery(query: string): boolean;
10
+ /**
11
+ * Tracks whether a debounced value has settled.
12
+ */
13
+ export declare function useDebounce<T>(value: T, delay?: number): T;
14
+ /**
15
+ * Returns the previous value of a prop/state.
16
+ */
17
+ export declare function usePrevious<T>(value: T): T | undefined;
18
+ /**
19
+ * Returns a stable callback that always calls the latest callback reference
20
+ * without causing effect re-runs.
21
+ */
22
+ export declare function useEventCallback<T extends (...args: any[]) => any>(callback?: T): T;
@@ -0,0 +1,58 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * Returns true once the component has mounted. Useful for avoiding SSR
4
+ * hydration mismatches in components that read from `window`/`document`.
5
+ */
6
+ export function useMounted() {
7
+ const [mounted, setMounted] = React.useState(false);
8
+ React.useEffect(() => setMounted(true), []);
9
+ return mounted;
10
+ }
11
+ /**
12
+ * Subscribes to a media query and returns its current match state.
13
+ */
14
+ export function useMediaQuery(query) {
15
+ const [matches, setMatches] = React.useState(false);
16
+ React.useEffect(() => {
17
+ if (typeof window === 'undefined')
18
+ return undefined;
19
+ const media = window.matchMedia(query);
20
+ const update = () => setMatches(media.matches);
21
+ update();
22
+ media.addEventListener('change', update);
23
+ return () => media.removeEventListener('change', update);
24
+ }, [query]);
25
+ return matches;
26
+ }
27
+ /**
28
+ * Tracks whether a debounced value has settled.
29
+ */
30
+ export function useDebounce(value, delay = 300) {
31
+ const [debounced, setDebounced] = React.useState(value);
32
+ React.useEffect(() => {
33
+ const handler = window.setTimeout(() => setDebounced(value), delay);
34
+ return () => window.clearTimeout(handler);
35
+ }, [value, delay]);
36
+ return debounced;
37
+ }
38
+ /**
39
+ * Returns the previous value of a prop/state.
40
+ */
41
+ export function usePrevious(value) {
42
+ const ref = React.useRef(undefined);
43
+ React.useEffect(() => {
44
+ ref.current = value;
45
+ }, [value]);
46
+ return ref.current;
47
+ }
48
+ /**
49
+ * Returns a stable callback that always calls the latest callback reference
50
+ * without causing effect re-runs.
51
+ */
52
+ export function useEventCallback(callback) {
53
+ const ref = React.useRef(callback);
54
+ React.useEffect(() => {
55
+ ref.current = callback;
56
+ }, [callback]);
57
+ return React.useCallback((...args) => ref.current?.(...args), []);
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gaulatti/bleecker",
3
- "version": "0.1.30",
3
+ "version": "0.1.32",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/gaulatti/bleecker"
@@ -43,9 +43,11 @@
43
43
  "react-dom": "^19.0.0"
44
44
  },
45
45
  "dependencies": {
46
+ "@radix-ui/react-collapsible": "^1.1.14",
46
47
  "@radix-ui/react-context-menu": "^2.2.16",
47
- "@radix-ui/react-label": "^2.1.8",
48
- "@radix-ui/react-popover": "^1.1.15",
48
+ "@radix-ui/react-dropdown-menu": "^2.1.18",
49
+ "@radix-ui/react-label": "^2.1.10",
50
+ "@radix-ui/react-separator": "^1.1.10",
49
51
  "@tanstack/react-table": "^8.21.3",
50
52
  "clsx": "^2.1.1",
51
53
  "lucide-react": "^0.563.0",
@@ -71,6 +71,27 @@
71
71
  --color-text-primary: var(--app-text-primary);
72
72
  --color-text-secondary: var(--app-text-secondary);
73
73
  --color-persgray-50: var(--app-persgray-50);
74
+
75
+ /* Dashboard semantic surface tokens */
76
+ --color-background: var(--app-background);
77
+ --color-foreground: var(--app-foreground);
78
+ --color-card: var(--app-card);
79
+ --color-card-foreground: var(--app-card-foreground);
80
+ --color-popover: var(--app-popover);
81
+ --color-popover-foreground: var(--app-popover-foreground);
82
+ --color-muted: var(--app-muted);
83
+ --color-muted-foreground: var(--app-muted-foreground);
84
+ --color-border: var(--app-border);
85
+ --color-input: var(--app-input);
86
+ --color-ring: var(--app-ring);
87
+ --color-primary: var(--app-primary);
88
+ --color-primary-foreground: var(--app-primary-foreground);
89
+ --color-secondary: var(--app-secondary);
90
+ --color-secondary-foreground: var(--app-secondary-foreground);
91
+ --color-destructive: var(--app-destructive);
92
+ --color-destructive-foreground: var(--app-destructive-foreground);
93
+ --color-accent: var(--app-accent);
94
+ --color-accent-foreground: var(--app-accent-foreground);
74
95
  }
75
96
 
76
97
  @layer base {
@@ -93,6 +114,27 @@
93
114
  --app-text-primary: #2d2d2d;
94
115
  --app-text-secondary: #595959;
95
116
  --app-persgray-50: #f9fafb;
117
+
118
+ /* Dashboard semantic surface tokens (light) */
119
+ --app-background: #ffffff;
120
+ --app-foreground: #2d2d2d;
121
+ --app-card: #ffffff;
122
+ --app-card-foreground: #2d2d2d;
123
+ --app-popover: #ffffff;
124
+ --app-popover-foreground: #2d2d2d;
125
+ --app-muted: #f9f6f2;
126
+ --app-muted-foreground: #595959;
127
+ --app-border: rgba(0, 0, 0, 0.08);
128
+ --app-input: rgba(0, 0, 0, 0.08);
129
+ --app-ring: #2c5784;
130
+ --app-primary: #2c5784;
131
+ --app-primary-foreground: #ffffff;
132
+ --app-secondary: #f9f6f2;
133
+ --app-secondary-foreground: #2d2d2d;
134
+ --app-destructive: #a65d57;
135
+ --app-destructive-foreground: #ffffff;
136
+ --app-accent: #f9f6f2;
137
+ --app-accent-foreground: #2d2d2d;
96
138
  }
97
139
 
98
140
  html {
@@ -118,6 +160,28 @@
118
160
  --app-text-secondary: #b8c5d6;
119
161
  --app-accent-gold: #d4af37;
120
162
  --app-accent-blue: #5ba3f5;
163
+
164
+ /* Dashboard semantic surface tokens (dark) */
165
+ --app-background: #0d1821;
166
+ --app-foreground: #f0f4f8;
167
+ --app-card: #182533;
168
+ --app-card-foreground: #f0f4f8;
169
+ --app-popover: #182533;
170
+ --app-popover-foreground: #f0f4f8;
171
+ --app-muted: #1a2332;
172
+ --app-muted-foreground: #b8c5d6;
173
+ --app-border: rgba(255, 255, 255, 0.08);
174
+ --app-input: rgba(255, 255, 255, 0.08);
175
+ --app-ring: #5ba3f5;
176
+ --app-primary: #5ba3f5;
177
+ --app-primary-foreground: #0d1821;
178
+ --app-secondary: #1a2332;
179
+ --app-secondary-foreground: #f0f4f8;
180
+ --app-destructive: #d47b75;
181
+ --app-destructive-foreground: #0d1821;
182
+ --app-accent: #1a2332;
183
+ --app-accent-foreground: #f0f4f8;
184
+
121
185
  color-scheme: dark;
122
186
  }
123
187
 
@@ -205,6 +269,95 @@
205
269
  button[data-dot].active .dot-indicator {
206
270
  background-color: rgb(255 255 255);
207
271
  }
272
+
273
+ /* Dashboard layout utilities */
274
+ .dashboard-grid {
275
+ display: grid;
276
+ gap: 1.5rem;
277
+ grid-template-columns: repeat(1, minmax(0, 1fr));
278
+ }
279
+
280
+ @media (min-width: 640px) {
281
+ .dashboard-grid {
282
+ grid-template-columns: repeat(2, minmax(0, 1fr));
283
+ }
284
+ }
285
+
286
+ @media (min-width: 1024px) {
287
+ .dashboard-grid {
288
+ grid-template-columns: repeat(3, minmax(0, 1fr));
289
+ }
290
+ }
291
+
292
+ @media (min-width: 1280px) {
293
+ .dashboard-grid {
294
+ grid-template-columns: repeat(4, minmax(0, 1fr));
295
+ }
296
+ }
297
+
298
+ .dashboard-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
299
+ .dashboard-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
300
+ .dashboard-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
301
+ .dashboard-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
302
+ .dashboard-grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
303
+ .dashboard-grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
304
+
305
+ .dashboard-card {
306
+ border-radius: var(--radius-card);
307
+ background-color: var(--color-card);
308
+ color: var(--color-card-foreground);
309
+ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02), 0 8px 32px rgba(26, 55, 77, 0.04);
310
+ ring: 1px inset rgba(0, 0, 0, 0.04);
311
+ }
312
+
313
+ .dark .dashboard-card {
314
+ box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
315
+ ring: 1px inset rgba(255, 255, 255, 0.08);
316
+ }
317
+
318
+ .dashboard-surface {
319
+ background-color: var(--color-card);
320
+ border: 1px solid var(--color-border);
321
+ border-radius: var(--radius-ui);
322
+ }
323
+
324
+ /* Cross-browser thin scrollbar utility (used by Panel and dashboard scroll areas) */
325
+ .scrollbar-thin {
326
+ scrollbar-width: thin;
327
+ scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
328
+ }
329
+
330
+ .dark .scrollbar-thin {
331
+ scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
332
+ }
333
+
334
+ .scrollbar-thin::-webkit-scrollbar {
335
+ width: 6px;
336
+ height: 6px;
337
+ }
338
+
339
+ .scrollbar-thin::-webkit-scrollbar-track {
340
+ background: transparent;
341
+ }
342
+
343
+ .scrollbar-thin::-webkit-scrollbar-thumb {
344
+ background: rgba(0, 0, 0, 0.15);
345
+ border-radius: 9999px;
346
+ }
347
+
348
+ .dark .scrollbar-thin::-webkit-scrollbar-thumb {
349
+ background: rgba(255, 255, 255, 0.12);
350
+ }
351
+
352
+ .scrollbar-thin::-webkit-scrollbar-thumb:hover {
353
+ background: rgba(0, 0, 0, 0.25);
354
+ }
355
+
356
+ .dark .scrollbar-thin::-webkit-scrollbar-thumb:hover {
357
+ background: rgba(255, 255, 255, 0.2);
358
+ }
359
+
360
+ /* Animate-in utilities used by menus/dropdowns are provided by Tailwind 4 */
208
361
  }
209
362
 
210
363
  @keyframes elegantFadeIn {