@object-ui/plugin-grid 3.1.5 → 3.3.1

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 (66) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +21 -1
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +649 -623
  5. package/dist/index.umd.cjs +8 -8
  6. package/package.json +45 -13
  7. package/.turbo/turbo-build.log +0 -32
  8. package/src/FormulaBar.tsx +0 -151
  9. package/src/GroupRow.tsx +0 -69
  10. package/src/ImportWizard.tsx +0 -412
  11. package/src/InlineEditing.tsx +0 -235
  12. package/src/ListColumnExtensions.test.tsx +0 -373
  13. package/src/ListColumnSchema.test.ts +0 -88
  14. package/src/ObjectGrid.EdgeCases.stories.tsx +0 -147
  15. package/src/ObjectGrid.msw.test.tsx +0 -130
  16. package/src/ObjectGrid.stories.tsx +0 -139
  17. package/src/ObjectGrid.tsx +0 -1596
  18. package/src/SplitPaneGrid.tsx +0 -120
  19. package/src/VirtualGrid.tsx +0 -183
  20. package/src/__tests__/GroupRow.test.tsx +0 -206
  21. package/src/__tests__/ImportPreview.test.tsx +0 -171
  22. package/src/__tests__/InlineEditing.test.tsx +0 -360
  23. package/src/__tests__/VirtualGrid.test.tsx +0 -438
  24. package/src/__tests__/accessibility.test.tsx +0 -254
  25. package/src/__tests__/accessorKey-inference.test.tsx +0 -132
  26. package/src/__tests__/airtable-style.test.tsx +0 -508
  27. package/src/__tests__/column-features.test.tsx +0 -490
  28. package/src/__tests__/grid-export.test.tsx +0 -121
  29. package/src/__tests__/mobile-card-view.test.tsx +0 -355
  30. package/src/__tests__/objectdef-enrichment.test.tsx +0 -566
  31. package/src/__tests__/performance-benchmark.test.tsx +0 -182
  32. package/src/__tests__/phase11-features.test.tsx +0 -418
  33. package/src/__tests__/row-bulk-actions.test.tsx +0 -413
  34. package/src/__tests__/row-height.test.tsx +0 -160
  35. package/src/__tests__/useGroupedData.test.ts +0 -165
  36. package/src/__tests__/view-states.test.tsx +0 -203
  37. package/src/components/BulkActionBar.tsx +0 -66
  38. package/src/components/RowActionMenu.tsx +0 -91
  39. package/src/index.test.tsx +0 -29
  40. package/src/index.tsx +0 -99
  41. package/src/useCellClipboard.ts +0 -136
  42. package/src/useColumnSummary.ts +0 -128
  43. package/src/useGradientColor.ts +0 -103
  44. package/src/useGroupReorder.ts +0 -123
  45. package/src/useGroupedData.ts +0 -187
  46. package/src/useRowColor.ts +0 -74
  47. package/tsconfig.json +0 -9
  48. package/vite.config.ts +0 -57
  49. package/vitest.config.ts +0 -13
  50. package/vitest.setup.ts +0 -1
  51. /package/dist/{plugin-grid → packages/plugin-grid}/src/FormulaBar.d.ts +0 -0
  52. /package/dist/{plugin-grid → packages/plugin-grid}/src/GroupRow.d.ts +0 -0
  53. /package/dist/{plugin-grid → packages/plugin-grid}/src/ImportWizard.d.ts +0 -0
  54. /package/dist/{plugin-grid → packages/plugin-grid}/src/InlineEditing.d.ts +0 -0
  55. /package/dist/{plugin-grid → packages/plugin-grid}/src/ObjectGrid.d.ts +0 -0
  56. /package/dist/{plugin-grid → packages/plugin-grid}/src/SplitPaneGrid.d.ts +0 -0
  57. /package/dist/{plugin-grid → packages/plugin-grid}/src/VirtualGrid.d.ts +0 -0
  58. /package/dist/{plugin-grid → packages/plugin-grid}/src/components/BulkActionBar.d.ts +0 -0
  59. /package/dist/{plugin-grid → packages/plugin-grid}/src/components/RowActionMenu.d.ts +0 -0
  60. /package/dist/{plugin-grid → packages/plugin-grid}/src/index.d.ts +0 -0
  61. /package/dist/{plugin-grid → packages/plugin-grid}/src/useCellClipboard.d.ts +0 -0
  62. /package/dist/{plugin-grid → packages/plugin-grid}/src/useColumnSummary.d.ts +0 -0
  63. /package/dist/{plugin-grid → packages/plugin-grid}/src/useGradientColor.d.ts +0 -0
  64. /package/dist/{plugin-grid → packages/plugin-grid}/src/useGroupReorder.d.ts +0 -0
  65. /package/dist/{plugin-grid → packages/plugin-grid}/src/useGroupedData.d.ts +0 -0
  66. /package/dist/{plugin-grid → packages/plugin-grid}/src/useRowColor.d.ts +0 -0
@@ -1,74 +0,0 @@
1
- /**
2
- * ObjectUI
3
- * Copyright (c) 2024-present ObjectStack Inc.
4
- *
5
- * This source code is licensed under the MIT license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- */
8
-
9
- import { useCallback } from 'react';
10
- import type { RowColorConfig } from '@object-ui/types';
11
-
12
- /**
13
- * CSS color to Tailwind-compatible background class mapping.
14
- * For colors not in this map, a CSS custom property approach is used.
15
- */
16
- const COLOR_TO_CLASS: Record<string, string> = {
17
- red: 'bg-red-100',
18
- green: 'bg-green-100',
19
- blue: 'bg-blue-100',
20
- yellow: 'bg-yellow-100',
21
- orange: 'bg-orange-100',
22
- purple: 'bg-purple-100',
23
- pink: 'bg-pink-100',
24
- gray: 'bg-gray-100',
25
- grey: 'bg-gray-100',
26
- indigo: 'bg-indigo-100',
27
- teal: 'bg-teal-100',
28
- cyan: 'bg-cyan-100',
29
- amber: 'bg-amber-100',
30
- lime: 'bg-lime-100',
31
- emerald: 'bg-emerald-100',
32
- rose: 'bg-rose-100',
33
- sky: 'bg-sky-100',
34
- violet: 'bg-violet-100',
35
- fuchsia: 'bg-fuchsia-100',
36
- slate: 'bg-slate-100',
37
- zinc: 'bg-zinc-100',
38
- stone: 'bg-stone-100',
39
- neutral: 'bg-neutral-100',
40
- };
41
-
42
- /**
43
- * Maps a CSS color string to a Tailwind background class.
44
- * Falls back to undefined for unrecognised values (dynamic CSS colors
45
- * that cannot be represented as static Tailwind classes).
46
- */
47
- function colorToClass(color: string): string | undefined {
48
- // Direct Tailwind class (e.g. "bg-red-200")
49
- if (color.startsWith('bg-')) return color;
50
-
51
- const lower = color.toLowerCase().trim();
52
- return COLOR_TO_CLASS[lower];
53
- }
54
-
55
- /**
56
- * Hook that returns a row-className resolver based on RowColorConfig.
57
- *
58
- * @param config - RowColorConfig from the grid schema (optional)
59
- * @returns a function `(row) => className | undefined`
60
- */
61
- export function useRowColor(config: RowColorConfig | undefined) {
62
- return useCallback(
63
- (row: Record<string, any>): string | undefined => {
64
- if (!config?.field || !config.colors) return undefined;
65
-
66
- const value = String(row[config.field] ?? '');
67
- const color = config.colors[value];
68
- if (!color) return undefined;
69
-
70
- return colorToClass(color);
71
- },
72
- [config?.field, config?.colors],
73
- );
74
- }
package/tsconfig.json DELETED
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "jsx": "react-jsx"
6
- },
7
- "include": ["src"],
8
- "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx", "**/*.stories.tsx"]
9
- }
package/vite.config.ts DELETED
@@ -1,57 +0,0 @@
1
- import { defineConfig } from 'vite';
2
- import react from '@vitejs/plugin-react';
3
- import dts from 'vite-plugin-dts';
4
- import { resolve } from 'path';
5
-
6
- export default defineConfig({
7
- plugins: [
8
- react(),
9
- dts({
10
- insertTypesEntry: true,
11
- include: ['src'],
12
- }),
13
- ],
14
- resolve: {
15
- alias: {
16
- '@object-ui/core': resolve(__dirname, '../core/src'),
17
- '@object-ui/types': resolve(__dirname, '../types/src'),
18
- '@object-ui/data-objectstack': resolve(__dirname, '../data-objectstack/src'),
19
- '@object-ui/react': resolve(__dirname, '../react/src'),
20
- '@object-ui/components': resolve(__dirname, '../components/src'),
21
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
22
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
23
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
24
- }
25
- },
26
- build: {
27
- lib: {
28
- entry: resolve(__dirname, 'src/index.tsx'),
29
- name: 'ObjectUIPluginGrid',
30
- fileName: 'index',
31
- },
32
- rollupOptions: {
33
- external: [
34
- 'react',
35
- 'react-dom',
36
- '@object-ui/components',
37
- '@object-ui/core',
38
- '@object-ui/fields',
39
- '@object-ui/react',
40
- '@object-ui/types',
41
- 'lucide-react'
42
- ],
43
- output: {
44
- globals: {
45
- react: 'React',
46
- 'react-dom': 'ReactDOM',
47
- },
48
- },
49
- },
50
- },
51
- test: {
52
- globals: true,
53
- environment: 'happy-dom',
54
- setupFiles: ['../../vitest.setup.tsx'],
55
- passWithNoTests: true,
56
- },
57
- });
package/vitest.config.ts DELETED
@@ -1,13 +0,0 @@
1
- /// <reference types="vitest" />
2
- import { defineConfig } from 'vite';
3
- import react from '@vitejs/plugin-react';
4
- import path from 'path';
5
-
6
- export default defineConfig({
7
- plugins: [react()],
8
- test: {
9
- environment: 'happy-dom',
10
- globals: true,
11
- setupFiles: ['./vitest.setup.ts'],
12
- },
13
- });
package/vitest.setup.ts DELETED
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';