@object-ui/plugin-grid 3.3.0 → 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 (49) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +21 -1
  3. package/dist/index.js +631 -599
  4. package/dist/index.umd.cjs +8 -8
  5. package/package.json +44 -12
  6. package/.turbo/turbo-build.log +0 -32
  7. package/src/FormulaBar.tsx +0 -151
  8. package/src/GroupRow.tsx +0 -69
  9. package/src/ImportWizard.tsx +0 -412
  10. package/src/InlineEditing.tsx +0 -235
  11. package/src/ListColumnExtensions.test.tsx +0 -373
  12. package/src/ListColumnSchema.test.ts +0 -88
  13. package/src/ObjectGrid.EdgeCases.stories.tsx +0 -147
  14. package/src/ObjectGrid.msw.test.tsx +0 -130
  15. package/src/ObjectGrid.stories.tsx +0 -139
  16. package/src/ObjectGrid.tsx +0 -1598
  17. package/src/SplitPaneGrid.tsx +0 -120
  18. package/src/VirtualGrid.tsx +0 -183
  19. package/src/__tests__/GroupRow.test.tsx +0 -206
  20. package/src/__tests__/ImportPreview.test.tsx +0 -171
  21. package/src/__tests__/InlineEditing.test.tsx +0 -360
  22. package/src/__tests__/VirtualGrid.test.tsx +0 -438
  23. package/src/__tests__/accessibility.test.tsx +0 -254
  24. package/src/__tests__/accessorKey-inference.test.tsx +0 -132
  25. package/src/__tests__/airtable-style.test.tsx +0 -508
  26. package/src/__tests__/column-features.test.tsx +0 -490
  27. package/src/__tests__/grid-export.test.tsx +0 -121
  28. package/src/__tests__/mobile-card-view.test.tsx +0 -355
  29. package/src/__tests__/objectdef-enrichment.test.tsx +0 -566
  30. package/src/__tests__/performance-benchmark.test.tsx +0 -182
  31. package/src/__tests__/phase11-features.test.tsx +0 -418
  32. package/src/__tests__/row-bulk-actions.test.tsx +0 -413
  33. package/src/__tests__/row-height.test.tsx +0 -160
  34. package/src/__tests__/useGroupedData.test.ts +0 -165
  35. package/src/__tests__/view-states.test.tsx +0 -203
  36. package/src/components/BulkActionBar.tsx +0 -66
  37. package/src/components/RowActionMenu.tsx +0 -91
  38. package/src/index.test.tsx +0 -29
  39. package/src/index.tsx +0 -99
  40. package/src/useCellClipboard.ts +0 -136
  41. package/src/useColumnSummary.ts +0 -128
  42. package/src/useGradientColor.ts +0 -103
  43. package/src/useGroupReorder.ts +0 -123
  44. package/src/useGroupedData.ts +0 -187
  45. package/src/useRowColor.ts +0 -74
  46. package/tsconfig.json +0 -9
  47. package/vite.config.ts +0 -58
  48. package/vitest.config.ts +0 -13
  49. package/vitest.setup.ts +0 -1
@@ -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,58 +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
- compilerOptions: { rootDir: resolve(__dirname, '../..') },
13
- }),
14
- ],
15
- resolve: {
16
- alias: {
17
- '@object-ui/core': resolve(__dirname, '../core/src'),
18
- '@object-ui/types': resolve(__dirname, '../types/src'),
19
- '@object-ui/data-objectstack': resolve(__dirname, '../data-objectstack/src'),
20
- '@object-ui/react': resolve(__dirname, '../react/src'),
21
- '@object-ui/components': resolve(__dirname, '../components/src'),
22
- '@object-ui/fields': resolve(__dirname, '../fields/src'),
23
- '@object-ui/plugin-dashboard': resolve(__dirname, '../plugin-dashboard/src'),
24
- '@object-ui/plugin-grid': resolve(__dirname, '../plugin-grid/src'),
25
- }
26
- },
27
- build: {
28
- lib: {
29
- entry: resolve(__dirname, 'src/index.tsx'),
30
- name: 'ObjectUIPluginGrid',
31
- fileName: 'index',
32
- },
33
- rollupOptions: {
34
- external: [
35
- 'react',
36
- 'react-dom',
37
- '@object-ui/components',
38
- '@object-ui/core',
39
- '@object-ui/fields',
40
- '@object-ui/react',
41
- '@object-ui/types',
42
- 'lucide-react'
43
- ],
44
- output: {
45
- globals: {
46
- react: 'React',
47
- 'react-dom': 'ReactDOM',
48
- },
49
- },
50
- },
51
- },
52
- test: {
53
- globals: true,
54
- environment: 'happy-dom',
55
- setupFiles: ['../../vitest.setup.tsx'],
56
- passWithNoTests: true,
57
- },
58
- });
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';