@object-ui/plugin-list 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 (52) 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 +30492 -38346
  5. package/dist/index.umd.cjs +30 -38
  6. package/dist/{src → packages/plugin-list/src}/ListView.d.ts +17 -1
  7. package/dist/packages/plugin-list/src/ListView.d.ts.map +1 -0
  8. package/dist/packages/plugin-list/src/ListView.stories.d.ts.map +1 -0
  9. package/dist/packages/plugin-list/src/ObjectGallery.d.ts.map +1 -0
  10. package/dist/packages/plugin-list/src/UserFilters.d.ts.map +1 -0
  11. package/dist/packages/plugin-list/src/ViewSwitcher.d.ts.map +1 -0
  12. package/dist/packages/plugin-list/src/components/TabBar.d.ts.map +1 -0
  13. package/dist/{src → packages/plugin-list/src}/index.d.ts +1 -1
  14. package/dist/packages/plugin-list/src/index.d.ts.map +1 -0
  15. package/dist/plugin-list.css +1 -2
  16. package/package.json +35 -13
  17. package/.turbo/turbo-build.log +0 -24
  18. package/dist/src/ListView.d.ts.map +0 -1
  19. package/dist/src/ListView.stories.d.ts.map +0 -1
  20. package/dist/src/ObjectGallery.d.ts.map +0 -1
  21. package/dist/src/UserFilters.d.ts.map +0 -1
  22. package/dist/src/ViewSwitcher.d.ts.map +0 -1
  23. package/dist/src/components/TabBar.d.ts.map +0 -1
  24. package/dist/src/index.d.ts.map +0 -1
  25. package/src/ListView.stories.tsx +0 -64
  26. package/src/ListView.tsx +0 -1688
  27. package/src/ObjectGallery.tsx +0 -308
  28. package/src/UserFilters.tsx +0 -453
  29. package/src/ViewSwitcher.tsx +0 -113
  30. package/src/__tests__/ConditionalFormatting.test.ts +0 -285
  31. package/src/__tests__/DataFetch.test.tsx +0 -253
  32. package/src/__tests__/Export.test.tsx +0 -175
  33. package/src/__tests__/FilterNormalization.test.ts +0 -162
  34. package/src/__tests__/GalleryGrouping.test.tsx +0 -237
  35. package/src/__tests__/GalleryTimelineSpecConfig.test.tsx +0 -203
  36. package/src/__tests__/ListView.test.tsx +0 -2151
  37. package/src/__tests__/ListViewGroupingPropagation.test.tsx +0 -250
  38. package/src/__tests__/ListViewPersistence.test.tsx +0 -129
  39. package/src/__tests__/ObjectGallery.test.tsx +0 -208
  40. package/src/__tests__/TabBar.test.tsx +0 -199
  41. package/src/__tests__/UserFilters.test.tsx +0 -486
  42. package/src/components/TabBar.tsx +0 -120
  43. package/src/index.tsx +0 -78
  44. package/tsconfig.json +0 -18
  45. package/vite.config.ts +0 -56
  46. package/vitest.config.ts +0 -12
  47. package/vitest.setup.ts +0 -1
  48. /package/dist/{src → packages/plugin-list/src}/ListView.stories.d.ts +0 -0
  49. /package/dist/{src → packages/plugin-list/src}/ObjectGallery.d.ts +0 -0
  50. /package/dist/{src → packages/plugin-list/src}/UserFilters.d.ts +0 -0
  51. /package/dist/{src → packages/plugin-list/src}/ViewSwitcher.d.ts +0 -0
  52. /package/dist/{src → packages/plugin-list/src}/components/TabBar.d.ts +0 -0
@@ -1,120 +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 * as React from 'react';
10
- import { cn, Button } from '@object-ui/components';
11
- import { icons, type LucideIcon } from 'lucide-react';
12
-
13
- export interface ViewTab {
14
- name: string;
15
- label: string;
16
- icon?: string;
17
- view?: string;
18
- filter?: any;
19
- order?: number;
20
- pinned?: boolean;
21
- isDefault?: boolean;
22
- visible?: string | boolean;
23
- }
24
-
25
- export interface TabBarProps {
26
- tabs: ViewTab[];
27
- activeTab?: string;
28
- onTabChange?: (tab: ViewTab) => void;
29
- className?: string;
30
- }
31
-
32
- /**
33
- * Resolve a kebab-case or lowercase Lucide icon name to a LucideIcon component.
34
- * E.g. "arrow-right" → ArrowRight, "star" → Star
35
- */
36
- function resolveIcon(iconName?: string): LucideIcon | null {
37
- if (!iconName) return null;
38
- const pascalCase = iconName
39
- .split('-')
40
- .map(w => w.charAt(0).toUpperCase() + w.slice(1))
41
- .join('');
42
- return (icons as Record<string, LucideIcon>)[pascalCase] ?? null;
43
- }
44
-
45
- /**
46
- * Filter visible tabs: exclude tabs where visible is 'false' or boolean false.
47
- * Pinned tabs are always included regardless of other filtering.
48
- */
49
- function getVisibleTabs(tabs: ViewTab[]): ViewTab[] {
50
- return tabs
51
- .filter(tab => tab.pinned || (tab.visible !== 'false' && tab.visible !== false))
52
- .sort((a, b) => (a.order ?? 0) - (b.order ?? 0));
53
- }
54
-
55
- /**
56
- * TabBar renders a row of view tabs above the ListView toolbar.
57
- * Supports icons (resolved via Lucide), pinned tabs, isDefault selection,
58
- * and emits tab changes with filter/sort configuration.
59
- */
60
- export const TabBar: React.FC<TabBarProps> = ({
61
- tabs,
62
- activeTab: controlledActiveTab,
63
- onTabChange,
64
- className,
65
- }) => {
66
- const visibleTabs = React.useMemo(() => getVisibleTabs(tabs), [tabs]);
67
-
68
- // Determine the default tab: first isDefault tab, or first tab
69
- const defaultTab = React.useMemo(() => {
70
- const def = visibleTabs.find(t => t.isDefault);
71
- return def?.name ?? visibleTabs[0]?.name;
72
- }, [visibleTabs]);
73
-
74
- const [internalActiveTab, setInternalActiveTab] = React.useState<string | undefined>(defaultTab);
75
-
76
- const activeTabName = controlledActiveTab ?? internalActiveTab;
77
-
78
- const handleTabClick = React.useCallback(
79
- (tab: ViewTab) => {
80
- setInternalActiveTab(tab.name);
81
- onTabChange?.(tab);
82
- },
83
- [onTabChange],
84
- );
85
-
86
- if (visibleTabs.length === 0) return null;
87
-
88
- return (
89
- <div
90
- className={cn('border-b px-2 sm:px-4 py-1 flex items-center gap-0.5 bg-background', className)}
91
- data-testid="view-tabs"
92
- role="tablist"
93
- >
94
- {visibleTabs.map(tab => {
95
- const TabIcon = resolveIcon(tab.icon);
96
- const isActive = activeTabName === tab.name;
97
- return (
98
- <Button
99
- key={tab.name}
100
- variant="ghost"
101
- size="sm"
102
- className={cn(
103
- "h-7 px-3 py-1.5 text-xs rounded-none transition-colors duration-150",
104
- isActive
105
- ? "border-b-2 border-primary font-medium text-foreground"
106
- : "text-muted-foreground hover:text-foreground"
107
- )}
108
- data-testid={`view-tab-${tab.name}`}
109
- role="tab"
110
- aria-selected={isActive}
111
- onClick={() => handleTabClick(tab)}
112
- >
113
- {TabIcon && <TabIcon className="h-3 w-3 mr-1.5" />}
114
- {tab.label}
115
- </Button>
116
- );
117
- })}
118
- </div>
119
- );
120
- };
package/src/index.tsx DELETED
@@ -1,78 +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 { ComponentRegistry } from '@object-ui/core';
10
- import { ListView } from './ListView';
11
- import { ViewSwitcher } from './ViewSwitcher';
12
- import { ObjectGallery } from './ObjectGallery';
13
-
14
- export { ListView, ViewSwitcher, ObjectGallery };
15
- export { TabBar } from './components/TabBar';
16
- export type { TabBarProps, ViewTab } from './components/TabBar';
17
- export { UserFilters } from './UserFilters';
18
- export type { UserFiltersProps } from './UserFilters';
19
- export { evaluateConditionalFormatting, normalizeFilterCondition, normalizeFilters } from './ListView';
20
- export type { ListViewProps } from './ListView';
21
- export type { ObjectGalleryProps } from './ObjectGallery';
22
- export type { ViewSwitcherProps, ViewType } from './ViewSwitcher';
23
-
24
- // Register ListView component
25
- ComponentRegistry.register('list-view', ListView, {
26
- namespace: 'plugin-list',
27
- label: 'List View',
28
- category: 'Views',
29
- icon: 'LayoutList',
30
- inputs: [
31
- { name: 'objectName', type: 'string', label: 'Object Name', required: true },
32
- { name: 'viewType', type: 'enum', label: 'Default View', enum: [
33
- { label: 'Grid', value: 'grid' },
34
- { label: 'Kanban', value: 'kanban' },
35
- { label: 'Gallery', value: 'gallery' },
36
- { label: 'Calendar', value: 'calendar' },
37
- { label: 'Timeline', value: 'timeline' },
38
- { label: 'Gantt', value: 'gantt' },
39
- { label: 'Map', value: 'map' },
40
- ], defaultValue: 'grid' },
41
- { name: 'fields', type: 'array', label: 'Fields' },
42
- { name: 'filters', type: 'array', label: 'Filters' },
43
- { name: 'sort', type: 'array', label: 'Sort' },
44
- { name: 'options', type: 'object', label: 'View Options' },
45
- ],
46
- defaultProps: {
47
- objectName: '',
48
- viewType: 'grid',
49
- fields: [],
50
- filters: [],
51
- sort: [],
52
- options: {},
53
- }
54
- });
55
-
56
- // Alias for generic view
57
- ComponentRegistry.register('list', ListView, {
58
- namespace: 'view',
59
- category: 'view',
60
- label: 'List',
61
- icon: 'LayoutList',
62
- inputs: [
63
- { name: 'objectName', type: 'string', label: 'Object Name', required: true },
64
- { name: 'viewType', type: 'enum', label: 'Default View', enum: [
65
- { label: 'Grid', value: 'grid' },
66
- { label: 'Kanban', value: 'kanban' },
67
- { label: 'Gallery', value: 'gallery' },
68
- { label: 'Calendar', value: 'calendar' },
69
- { label: 'Timeline', value: 'timeline' },
70
- { label: 'Gantt', value: 'gantt' },
71
- { label: 'Map', value: 'map' },
72
- ], defaultValue: 'grid' },
73
- { name: 'fields', type: 'array', label: 'Fields' },
74
- { name: 'filters', type: 'array', label: 'Filters' },
75
- { name: 'sort', type: 'array', label: 'Sort' },
76
- { name: 'options', type: 'object', label: 'View Options' },
77
- ]
78
- });
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "jsx": "react-jsx",
6
- "baseUrl": ".",
7
- "paths": {
8
- "@/*": ["src/*"]
9
- },
10
- "noEmit": false,
11
- "declaration": true,
12
- "composite": true,
13
- "declarationMap": true,
14
- "skipLibCheck": true
15
- },
16
- "include": ["src"],
17
- "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.test.tsx"]
18
- }
package/vite.config.ts DELETED
@@ -1,56 +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
- outDir: 'dist',
12
- tsconfigPath: './tsconfig.json',
13
- }),
14
- ],
15
- resolve: {
16
- alias: {
17
- '@': resolve(__dirname, './src'),
18
- '@object-ui/core': resolve(__dirname, '../core/src'),
19
- '@object-ui/types': resolve(__dirname, '../types/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: 'ObjectUIPluginList',
31
- formats: ['es', 'umd'],
32
- fileName: (format) => `index.${format === 'es' ? 'js' : 'umd.cjs'}`,
33
- },
34
- rollupOptions: {
35
- external: ['react', 'react-dom', 'react/jsx-runtime'],
36
- output: {
37
- globals: {
38
- react: 'React',
39
- 'react-dom': 'ReactDOM',
40
- 'react/jsx-runtime': 'jsxRuntime',
41
- },
42
- },
43
- },
44
- },
45
- test: {
46
- globals: true,
47
- environment: 'happy-dom',
48
- setupFiles: ['../../vitest.setup.tsx'],
49
- passWithNoTests: true,
50
- css: {
51
- modules: {
52
- classNameStrategy: 'non-scoped',
53
- },
54
- },
55
- },
56
- });
package/vitest.config.ts DELETED
@@ -1,12 +0,0 @@
1
- /// <reference types="vitest" />
2
- import { defineConfig } from 'vite';
3
- import react from '@vitejs/plugin-react';
4
-
5
- export default defineConfig({
6
- plugins: [react()],
7
- test: {
8
- environment: 'happy-dom',
9
- globals: true,
10
- setupFiles: ['./vitest.setup.ts'],
11
- },
12
- });
package/vitest.setup.ts DELETED
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';