@object-ui/components 0.3.1 → 2.0.0
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.
- package/.turbo/turbo-build.log +34 -0
- package/CHANGELOG.md +13 -0
- package/README.md +13 -0
- package/dist/index.css +1 -1
- package/dist/index.js +36430 -25529
- package/dist/index.umd.cjs +53 -32
- package/dist/src/SchemaRenderer.d.ts +3 -0
- package/dist/src/custom/action-param-dialog.d.ts +21 -0
- package/dist/src/{ui → custom}/button-group.d.ts +1 -1
- package/dist/src/custom/field.d.ts +19 -0
- package/dist/src/custom/index.d.ts +14 -0
- package/dist/src/custom/input-group.d.ts +14 -0
- package/dist/src/{ui → custom}/item.d.ts +1 -1
- package/dist/src/custom/native-select.d.ts +12 -0
- package/dist/src/custom/navigation-overlay.d.ts +50 -0
- package/dist/src/custom/sort-builder.d.ts +22 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/renderers/action/action-button.d.ts +11 -0
- package/dist/src/renderers/action/action-group.d.ts +25 -0
- package/dist/src/renderers/action/action-icon.d.ts +10 -0
- package/dist/src/renderers/action/action-menu.d.ts +19 -0
- package/dist/src/renderers/action/index.d.ts +0 -0
- package/dist/src/renderers/action/resolve-icon.d.ts +6 -0
- package/dist/src/renderers/data-display/table.d.ts +1 -1
- package/dist/src/renderers/layout/page.d.ts +1 -1
- package/dist/src/renderers/placeholders.d.ts +1 -1
- package/dist/src/ui/accordion.d.ts +4 -4
- package/dist/src/ui/alert-dialog.d.ts +17 -11
- package/dist/src/ui/alert.d.ts +4 -5
- package/dist/src/ui/aspect-ratio.d.ts +1 -1
- package/dist/src/ui/avatar.d.ts +3 -3
- package/dist/src/ui/badge.d.ts +3 -3
- package/dist/src/ui/breadcrumb.d.ts +16 -8
- package/dist/src/ui/calendar.d.ts +7 -7
- package/dist/src/ui/card.d.ts +7 -8
- package/dist/src/ui/carousel.d.ts +5 -6
- package/dist/src/ui/chart.d.ts +62 -0
- package/dist/src/ui/checkbox.d.ts +1 -1
- package/dist/src/ui/collapsible.d.ts +3 -3
- package/dist/src/ui/command.d.ts +78 -16
- package/dist/src/ui/context-menu.d.ts +14 -12
- package/dist/src/ui/dialog.d.ts +17 -13
- package/dist/src/ui/drawer.d.ts +19 -10
- package/dist/src/ui/dropdown-menu.d.ts +20 -18
- package/dist/src/ui/form.d.ts +6 -7
- package/dist/src/ui/hover-card.d.ts +3 -3
- package/dist/src/ui/index.d.ts +2 -8
- package/dist/src/ui/input-otp.d.ts +30 -7
- package/dist/src/ui/label.d.ts +2 -1
- package/dist/src/ui/menubar.d.ts +19 -17
- package/dist/src/ui/navigation-menu.d.ts +9 -11
- package/dist/src/ui/pagination.d.ts +25 -10
- package/dist/src/ui/popover.d.ts +4 -5
- package/dist/src/ui/progress.d.ts +1 -1
- package/dist/src/ui/radio-group.d.ts +2 -2
- package/dist/src/ui/resizable.d.ts +5 -8
- package/dist/src/ui/scroll-area.d.ts +2 -2
- package/dist/src/ui/select.d.ts +11 -13
- package/dist/src/ui/sheet.d.ts +23 -11
- package/dist/src/ui/sidebar.d.ts +27 -29
- package/dist/src/ui/skeleton.d.ts +1 -1
- package/dist/src/ui/slider.d.ts +1 -1
- package/dist/src/ui/sonner.d.ts +2 -1
- package/dist/src/ui/switch.d.ts +2 -2
- package/dist/src/ui/tabs.d.ts +1 -1
- package/dist/src/ui/textarea.d.ts +1 -1
- package/dist/src/ui/toast.d.ts +22 -0
- package/dist/src/ui/toggle-group.d.ts +8 -3
- package/dist/src/ui/toggle.d.ts +4 -1
- package/dist/src/ui/tooltip.d.ts +4 -4
- package/dist/src/ui/typography.d.ts +21 -0
- package/package.json +20 -9
- package/shadcn-components.json +52 -47
- package/src/SchemaRenderer.tsx +28 -0
- package/src/__tests__/PageRendererRegions.test.tsx +668 -0
- package/src/__tests__/Registry.test.ts +21 -0
- package/src/__tests__/basic-renderers.test.tsx +1 -1
- package/src/__tests__/complex-disclosure-renderers.test.tsx +3 -2
- package/src/__tests__/compliance.test.tsx +72 -0
- package/src/__tests__/feedback-overlay-renderers.test.tsx +1 -1
- package/src/__tests__/form-renderers.test.tsx +1 -1
- package/src/__tests__/layout-data-renderers.test.tsx +1 -1
- package/src/__tests__/navigation-overlay.test.tsx +273 -0
- package/src/__tests__/view-compliance.test.tsx +153 -0
- package/src/custom/action-param-dialog.tsx +264 -0
- package/src/{ui → custom}/button-group.tsx +1 -1
- package/src/{ui → custom}/combobox.tsx +3 -3
- package/src/{ui → custom}/date-picker.tsx +3 -3
- package/src/custom/field.tsx +81 -0
- package/src/{ui → custom}/filter-builder.tsx +3 -3
- package/src/custom/index.ts +14 -0
- package/src/custom/input-group.tsx +53 -0
- package/src/{ui → custom}/item.tsx +1 -1
- package/src/custom/native-select.tsx +33 -0
- package/src/custom/navigation-overlay.tsx +296 -0
- package/src/custom/sort-builder.tsx +129 -0
- package/src/index.css +20 -1
- package/src/index.ts +2 -0
- package/src/renderers/action/action-button.tsx +147 -0
- package/src/renderers/action/action-group.tsx +270 -0
- package/src/renderers/action/action-icon.tsx +150 -0
- package/src/renderers/action/action-menu.tsx +203 -0
- package/src/renderers/action/index.ts +18 -0
- package/src/renderers/action/resolve-icon.ts +35 -0
- package/src/renderers/basic/button-group.tsx +1 -0
- package/src/renderers/basic/div.tsx +12 -1
- package/src/renderers/basic/html.tsx +1 -0
- package/src/renderers/basic/icon.tsx +1 -0
- package/src/renderers/basic/image.tsx +1 -0
- package/src/renderers/basic/navigation-menu.tsx +1 -0
- package/src/renderers/basic/pagination.tsx +31 -4
- package/src/renderers/basic/separator.tsx +1 -0
- package/src/renderers/basic/span.tsx +12 -1
- package/src/renderers/basic/text.tsx +4 -2
- package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +275 -0
- package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +120 -0
- package/src/renderers/complex/__tests__/data-table-editing.test.tsx +221 -0
- package/src/renderers/complex/carousel.tsx +1 -0
- package/src/renderers/complex/data-table.tsx +355 -95
- package/src/renderers/complex/filter-builder.tsx +2 -1
- package/src/renderers/complex/resizable.tsx +2 -1
- package/src/renderers/complex/scroll-area.tsx +25 -7
- package/src/renderers/complex/table.tsx +1 -0
- package/src/renderers/data-display/alert.tsx +1 -0
- package/src/renderers/data-display/avatar.tsx +1 -0
- package/src/renderers/data-display/badge.tsx +1 -0
- package/src/renderers/data-display/breadcrumb.tsx +1 -0
- package/src/renderers/data-display/kbd.tsx +1 -0
- package/src/renderers/data-display/list.tsx +21 -49
- package/src/renderers/data-display/statistic.tsx +21 -5
- package/src/renderers/data-display/table.tsx +21 -11
- package/src/renderers/data-display/tree-view.tsx +7 -1
- package/src/renderers/disclosure/accordion.tsx +1 -0
- package/src/renderers/disclosure/collapsible.tsx +1 -0
- package/src/renderers/disclosure/toggle-group.tsx +2 -0
- package/src/renderers/feedback/empty.tsx +1 -0
- package/src/renderers/feedback/loading.tsx +2 -1
- package/src/renderers/feedback/progress.tsx +1 -0
- package/src/renderers/feedback/skeleton.tsx +1 -0
- package/src/renderers/feedback/sonner.tsx +1 -0
- package/src/renderers/feedback/spinner.tsx +1 -0
- package/src/renderers/feedback/toast.tsx +1 -0
- package/src/renderers/feedback/toaster.tsx +1 -0
- package/src/renderers/form/button.tsx +35 -1
- package/src/renderers/form/calendar.tsx +1 -0
- package/src/renderers/form/checkbox.tsx +38 -16
- package/src/renderers/form/combobox.tsx +2 -1
- package/src/renderers/form/command.tsx +1 -0
- package/src/renderers/form/date-picker.tsx +1 -0
- package/src/renderers/form/file-upload.tsx +1 -0
- package/src/renderers/form/form.tsx +115 -19
- package/src/renderers/form/input-otp.tsx +1 -0
- package/src/renderers/form/input.tsx +3 -0
- package/src/renderers/form/label.tsx +1 -0
- package/src/renderers/form/radio-group.tsx +1 -0
- package/src/renderers/form/select.tsx +35 -15
- package/src/renderers/form/slider.tsx +1 -0
- package/src/renderers/form/switch.tsx +1 -0
- package/src/renderers/form/textarea.tsx +50 -27
- package/src/renderers/form/toggle.tsx +3 -45
- package/src/renderers/index.ts +1 -0
- package/src/renderers/layout/aspect-ratio.tsx +2 -1
- package/src/renderers/layout/card.tsx +10 -2
- package/src/renderers/layout/container.tsx +1 -0
- package/src/renderers/layout/flex.tsx +1 -0
- package/src/renderers/layout/grid.tsx +23 -8
- package/src/renderers/layout/page.tsx +433 -57
- package/src/renderers/layout/semantic.tsx +1 -0
- package/src/renderers/layout/stack.tsx +2 -1
- package/src/renderers/layout/tabs.tsx +43 -17
- package/src/renderers/navigation/header-bar.tsx +1 -0
- package/src/renderers/navigation/sidebar.tsx +11 -0
- package/src/renderers/overlay/alert-dialog.tsx +1 -0
- package/src/renderers/overlay/context-menu.tsx +1 -0
- package/src/renderers/overlay/dialog.tsx +1 -0
- package/src/renderers/overlay/drawer.tsx +1 -0
- package/src/renderers/overlay/dropdown-menu.tsx +1 -0
- package/src/renderers/overlay/hover-card.tsx +1 -0
- package/src/renderers/overlay/menubar.tsx +1 -0
- package/src/renderers/overlay/popover.tsx +1 -0
- package/src/renderers/overlay/sheet.tsx +1 -0
- package/src/renderers/overlay/tooltip.tsx +1 -0
- package/src/renderers/placeholders.tsx +4 -4
- package/src/stories/CRMApp.stories.tsx +706 -0
- package/src/stories/Guide.mdx +55 -0
- package/src/stories/Introduction.mdx +61 -0
- package/src/stories/MockedData.stories.tsx +121 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/header.css +32 -0
- package/src/stories/page.css +68 -0
- package/src/stories-json/accordion.stories.tsx +43 -0
- package/src/stories-json/aggrid.stories.tsx +103 -0
- package/src/stories-json/alert.stories.tsx +39 -0
- package/src/stories-json/aspect-ratio.stories.tsx +34 -0
- package/src/stories-json/avatar.stories.tsx +38 -0
- package/src/stories-json/badge.stories.tsx +53 -0
- package/src/stories-json/breadcrumb.stories.tsx +30 -0
- package/src/stories-json/button-group.stories.tsx +43 -0
- package/src/stories-json/button.stories.tsx +73 -0
- package/src/stories-json/calendar.stories.tsx +85 -0
- package/src/stories-json/card.stories.tsx +48 -0
- package/src/stories-json/carousel.stories.tsx +33 -0
- package/src/stories-json/charts.stories.tsx +195 -0
- package/src/stories-json/chatbot.stories.tsx +248 -0
- package/src/stories-json/code-editor.stories.tsx +92 -0
- package/src/stories-json/collapsible.stories.tsx +40 -0
- package/src/stories-json/controls.stories.tsx +36 -0
- package/src/stories-json/crm-live-data.stories.tsx +154 -0
- package/src/stories-json/dashboard.stories.tsx +318 -0
- package/src/stories-json/data-table.stories.tsx +136 -0
- package/src/stories-json/data_display_extras.stories.tsx +102 -0
- package/src/stories-json/date-picker.stories.tsx +28 -0
- package/src/stories-json/detail-view.stories.tsx +258 -0
- package/src/stories-json/dialog.stories.tsx +43 -0
- package/src/stories-json/feedback_extras.stories.tsx +40 -0
- package/src/stories-json/feedback_others.stories.tsx +46 -0
- package/src/stories-json/form-variants.stories.tsx +210 -0
- package/src/stories-json/form_advanced.stories.tsx +117 -0
- package/src/stories-json/form_extras.stories.tsx +123 -0
- package/src/stories-json/grid.stories.tsx +56 -0
- package/src/stories-json/icon.stories.tsx +36 -0
- package/src/stories-json/input.stories.tsx +52 -0
- package/src/stories-json/kanban.stories.tsx +295 -0
- package/src/stories-json/layout_extended.stories.tsx +76 -0
- package/src/stories-json/layout_flex.stories.tsx +107 -0
- package/src/stories-json/list-view.stories.tsx +97 -0
- package/src/stories-json/markdown.stories.tsx +129 -0
- package/src/stories-json/menus.stories.tsx +63 -0
- package/src/stories-json/metric-card.stories.tsx +143 -0
- package/src/stories-json/navigation-menu.stories.tsx +37 -0
- package/src/stories-json/object-aggrid-advanced.stories.tsx +389 -0
- package/src/stories-json/object-aggrid.stories.tsx +252 -0
- package/src/stories-json/object-form.stories.tsx +130 -0
- package/src/stories-json/object-gantt.stories.tsx +114 -0
- package/src/stories-json/object-grid.stories.tsx +315 -0
- package/src/stories-json/object-map.stories.tsx +116 -0
- package/src/stories-json/object-view.stories.tsx +118 -0
- package/src/stories-json/overlay_extras.stories.tsx +113 -0
- package/src/stories-json/overlay_others.stories.tsx +76 -0
- package/src/stories-json/page.stories.tsx +55 -0
- package/src/stories-json/reports.stories.tsx +163 -0
- package/src/stories-json/resizable.stories.tsx +44 -0
- package/src/stories-json/select.stories.tsx +34 -0
- package/src/stories-json/separator.stories.tsx +41 -0
- package/src/stories-json/sidebar.stories.tsx +147 -0
- package/src/stories-json/statistic.stories.tsx +44 -0
- package/src/stories-json/tabs.stories.tsx +51 -0
- package/src/stories-json/timeline.stories.tsx +188 -0
- package/src/stories-json/typography.stories.tsx +45 -0
- package/src/ui/accordion.tsx +47 -53
- package/src/ui/alert-dialog.tsx +103 -117
- package/src/ui/alert.tsx +35 -36
- package/src/ui/aspect-ratio.tsx +1 -5
- package/src/ui/avatar.tsx +41 -42
- package/src/ui/badge.tsx +6 -15
- package/src/ui/breadcrumb.tsx +81 -75
- package/src/ui/button.tsx +10 -11
- package/src/ui/calendar.tsx +178 -51
- package/src/ui/card.tsx +51 -110
- package/src/ui/carousel.tsx +136 -113
- package/src/ui/chart.tsx +367 -0
- package/src/ui/checkbox.tsx +20 -22
- package/src/ui/collapsible.tsx +5 -25
- package/src/ui/command.tsx +106 -135
- package/src/ui/context-menu.tsx +69 -116
- package/src/ui/dialog.tsx +94 -113
- package/src/ui/drawer.tsx +82 -99
- package/src/ui/dropdown-menu.tsx +134 -188
- package/src/ui/form.tsx +51 -40
- package/src/ui/hover-card.tsx +18 -33
- package/src/ui/index.ts +2 -8
- package/src/ui/input-otp.tsx +42 -52
- package/src/ui/input.tsx +13 -15
- package/src/ui/label.tsx +17 -15
- package/src/ui/menubar.tsx +188 -206
- package/src/ui/navigation-menu.tsx +96 -136
- package/src/ui/pagination.tsx +86 -96
- package/src/ui/popover.tsx +24 -41
- package/src/ui/progress.tsx +21 -22
- package/src/ui/radio-group.tsx +19 -20
- package/src/ui/resizable.tsx +32 -42
- package/src/ui/scroll-area.tsx +38 -48
- package/src/ui/select.tsx +129 -157
- package/src/ui/separator.tsx +2 -2
- package/src/ui/sheet.tsx +110 -107
- package/src/ui/sidebar.tsx +442 -408
- package/src/ui/skeleton.tsx +6 -11
- package/src/ui/slider.tsx +19 -54
- package/src/ui/sonner.tsx +19 -1
- package/src/ui/switch.tsx +19 -21
- package/src/ui/tabs.tsx +6 -37
- package/src/ui/textarea.tsx +8 -4
- package/src/ui/toast.tsx +137 -0
- package/src/ui/toggle-group.tsx +28 -37
- package/src/ui/toggle.tsx +19 -19
- package/src/ui/tooltip.tsx +21 -52
- package/src/ui/typography.tsx +85 -0
- package/tsconfig.json +1 -1
- package/vite.config.ts +9 -1
- package/vitest.config.ts +5 -0
- package/ISSUES_FOUND.md +0 -128
- /package/dist/src/{ui → custom}/combobox.d.ts +0 -0
- /package/dist/src/{ui → custom}/date-picker.d.ts +0 -0
- /package/dist/src/{ui → custom}/empty.d.ts +0 -0
- /package/dist/src/{ui → custom}/filter-builder.d.ts +0 -0
- /package/dist/src/{ui → custom}/kbd.d.ts +0 -0
- /package/dist/src/{ui → custom}/spinner.d.ts +0 -0
- /package/src/{ui → custom}/empty.tsx +0 -0
- /package/src/{ui → custom}/kbd.tsx +0 -0
- /package/src/{ui → custom}/spinner.tsx +0 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer, SchemaRendererProvider } from '@object-ui/react';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
import { createStorybookDataSource } from '@storybook-config/datasource';
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: 'Plugins/Data Views/Object View',
|
|
8
|
+
component: SchemaRenderer,
|
|
9
|
+
parameters: {
|
|
10
|
+
layout: 'padded',
|
|
11
|
+
},
|
|
12
|
+
tags: ['autodocs'],
|
|
13
|
+
argTypes: {
|
|
14
|
+
schema: { table: { disable: true } },
|
|
15
|
+
},
|
|
16
|
+
} satisfies Meta<any>;
|
|
17
|
+
|
|
18
|
+
export default meta;
|
|
19
|
+
type Story = StoryObj<typeof meta>;
|
|
20
|
+
|
|
21
|
+
// Create a DataSource instance that connects to MSW
|
|
22
|
+
const dataSource = createStorybookDataSource();
|
|
23
|
+
|
|
24
|
+
const renderStory = (args: any) => (
|
|
25
|
+
<SchemaRendererProvider dataSource={dataSource}>
|
|
26
|
+
<SchemaRenderer schema={args as unknown as BaseSchema} />
|
|
27
|
+
</SchemaRendererProvider>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
export const UserProfile: Story = {
|
|
31
|
+
render: renderStory,
|
|
32
|
+
args: {
|
|
33
|
+
type: 'object-view',
|
|
34
|
+
objectName: 'User',
|
|
35
|
+
layout: 'card',
|
|
36
|
+
data: {
|
|
37
|
+
id: 1,
|
|
38
|
+
name: 'John Doe',
|
|
39
|
+
email: 'john.doe@example.com',
|
|
40
|
+
role: 'Administrator',
|
|
41
|
+
status: 'Active',
|
|
42
|
+
joinedDate: '2023-01-15',
|
|
43
|
+
department: 'Engineering'
|
|
44
|
+
},
|
|
45
|
+
fields: [
|
|
46
|
+
{ name: 'id', label: 'User ID', type: 'text' },
|
|
47
|
+
{ name: 'name', label: 'Full Name', type: 'text' },
|
|
48
|
+
{ name: 'email', label: 'Email Address', type: 'email' },
|
|
49
|
+
{ name: 'role', label: 'Role', type: 'text' },
|
|
50
|
+
{ name: 'status', label: 'Status', type: 'badge' },
|
|
51
|
+
{ name: 'joinedDate', label: 'Joined Date', type: 'date' },
|
|
52
|
+
{ name: 'department', label: 'Department', type: 'text' }
|
|
53
|
+
],
|
|
54
|
+
className: 'w-full max-w-2xl'
|
|
55
|
+
} as any,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const ProductDetails: Story = {
|
|
59
|
+
render: renderStory,
|
|
60
|
+
args: {
|
|
61
|
+
type: 'object-view',
|
|
62
|
+
objectName: 'Product',
|
|
63
|
+
layout: 'table',
|
|
64
|
+
data: {
|
|
65
|
+
sku: 'PROD-12345',
|
|
66
|
+
name: 'Professional Laptop',
|
|
67
|
+
category: 'Electronics',
|
|
68
|
+
brand: 'TechCorp',
|
|
69
|
+
price: 1299.99,
|
|
70
|
+
stock: 45,
|
|
71
|
+
description: 'High-performance laptop for professionals',
|
|
72
|
+
rating: 4.5,
|
|
73
|
+
reviews: 128
|
|
74
|
+
},
|
|
75
|
+
fields: [
|
|
76
|
+
{ name: 'sku', label: 'SKU', type: 'text' },
|
|
77
|
+
{ name: 'name', label: 'Product Name', type: 'text' },
|
|
78
|
+
{ name: 'category', label: 'Category', type: 'text' },
|
|
79
|
+
{ name: 'brand', label: 'Brand', type: 'text' },
|
|
80
|
+
{ name: 'price', label: 'Price', type: 'currency' },
|
|
81
|
+
{ name: 'stock', label: 'In Stock', type: 'number' },
|
|
82
|
+
{ name: 'description', label: 'Description', type: 'textarea' },
|
|
83
|
+
{ name: 'rating', label: 'Rating', type: 'number' },
|
|
84
|
+
{ name: 'reviews', label: 'Reviews', type: 'number' }
|
|
85
|
+
],
|
|
86
|
+
className: 'w-full max-w-3xl'
|
|
87
|
+
} as any,
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export const OrderSummary: Story = {
|
|
91
|
+
render: renderStory,
|
|
92
|
+
args: {
|
|
93
|
+
type: 'object-view',
|
|
94
|
+
objectName: 'Order',
|
|
95
|
+
layout: 'card',
|
|
96
|
+
data: {
|
|
97
|
+
orderId: 'ORD-98765',
|
|
98
|
+
customer: 'Alice Johnson',
|
|
99
|
+
orderDate: '2024-01-20',
|
|
100
|
+
total: 456.78,
|
|
101
|
+
status: 'Processing',
|
|
102
|
+
shippingAddress: '456 Oak Street, San Francisco, CA 94102',
|
|
103
|
+
items: 3,
|
|
104
|
+
trackingNumber: 'TRK123456789'
|
|
105
|
+
},
|
|
106
|
+
fields: [
|
|
107
|
+
{ name: 'orderId', label: 'Order ID', type: 'text' },
|
|
108
|
+
{ name: 'customer', label: 'Customer Name', type: 'text' },
|
|
109
|
+
{ name: 'orderDate', label: 'Order Date', type: 'date' },
|
|
110
|
+
{ name: 'total', label: 'Total Amount', type: 'currency' },
|
|
111
|
+
{ name: 'status', label: 'Status', type: 'badge' },
|
|
112
|
+
{ name: 'shippingAddress', label: 'Shipping Address', type: 'textarea' },
|
|
113
|
+
{ name: 'items', label: 'Number of Items', type: 'number' },
|
|
114
|
+
{ name: 'trackingNumber', label: 'Tracking Number', type: 'text' }
|
|
115
|
+
],
|
|
116
|
+
className: 'w-full max-w-2xl'
|
|
117
|
+
} as any,
|
|
118
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: 'Primitives/Overlay/Extras',
|
|
6
|
+
component: SchemaRenderer,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {
|
|
9
|
+
// Schema properties
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
|
|
16
|
+
export const AlertDialogExample: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
type: 'alert-dialog',
|
|
19
|
+
title: 'Schema/Feedback/Delete Account',
|
|
20
|
+
description: 'Are you sure you want to delete your account? This action cannot be undone.',
|
|
21
|
+
actionText: 'Yes, Delete',
|
|
22
|
+
cancelText: 'Cancel',
|
|
23
|
+
trigger: [
|
|
24
|
+
{ type: 'button', content: 'Delete Account', variant: 'destructive' }
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
render: (args) => <SchemaRenderer schema={args} />
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const ContextMenuExample: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
type: 'context-menu',
|
|
33
|
+
triggerClassName: 'flex h-[150px] w-full items-center justify-center rounded-md border border-dashed text-sm',
|
|
34
|
+
trigger: [
|
|
35
|
+
{ type: 'text', content: 'Right click here' }
|
|
36
|
+
],
|
|
37
|
+
items: [
|
|
38
|
+
{ label: 'Back', shortcut: '⌘[' },
|
|
39
|
+
{ label: 'Forward', shortcut: '⌘]', disabled: true },
|
|
40
|
+
{ label: 'Reload', shortcut: '⌘R' },
|
|
41
|
+
{ type: 'separator' },
|
|
42
|
+
{ label: 'Save As...', shortcut: '⇧⌘S' },
|
|
43
|
+
{ label: 'Print...', shortcut: '⌘P' }
|
|
44
|
+
]
|
|
45
|
+
},
|
|
46
|
+
render: (args) => <SchemaRenderer schema={args} />
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const DrawerExample: Story = {
|
|
50
|
+
args: {
|
|
51
|
+
type: 'drawer',
|
|
52
|
+
title: 'Schema/Feedback/Monthly Goal',
|
|
53
|
+
description: 'Set your daily activity goal.',
|
|
54
|
+
trigger: [
|
|
55
|
+
{ type: 'button', content: 'Open Drawer', variant: 'outline' }
|
|
56
|
+
],
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: 'div',
|
|
60
|
+
className: 'p-4 pb-0 items-center justify-center flex',
|
|
61
|
+
children: [
|
|
62
|
+
{
|
|
63
|
+
type: 'div',
|
|
64
|
+
className: 'text-4xl font-bold p-10',
|
|
65
|
+
children: [{ type: 'text', content: '400/500' }]
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
footer: [
|
|
71
|
+
{ type: 'button', content: 'Submit', className: 'w-full' },
|
|
72
|
+
{ type: 'button', content: 'Cancel', variant: 'outline', className: 'w-full' }
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
render: (args) => <SchemaRenderer schema={args} />
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const MenubarExample: Story = {
|
|
79
|
+
args: {
|
|
80
|
+
type: 'menubar',
|
|
81
|
+
menus: [
|
|
82
|
+
{
|
|
83
|
+
label: 'File',
|
|
84
|
+
items: [
|
|
85
|
+
{ label: 'New Tab', shortcut: '⌘T' },
|
|
86
|
+
{ label: 'New Window', shortcut: '⌘N' },
|
|
87
|
+
{ separator: true },
|
|
88
|
+
{ label: 'Share', children: [
|
|
89
|
+
{ label: 'Email link' },
|
|
90
|
+
{ label: 'Messages' }
|
|
91
|
+
]},
|
|
92
|
+
{ separator: true },
|
|
93
|
+
{ label: 'Print' }
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
label: 'Edit',
|
|
98
|
+
items: [
|
|
99
|
+
{ label: 'Undo', shortcut: '⌘Z' },
|
|
100
|
+
{ label: 'Redo', shortcut: '⇧⌘Z' }
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: 'View',
|
|
105
|
+
items: [
|
|
106
|
+
{ label: 'Always Show Bookmarks Bar' },
|
|
107
|
+
{ label: 'Always Show Full URLs' }
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
render: (args) => <SchemaRenderer schema={args} />
|
|
113
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Primitives/Overlay/Others',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: { layout: 'centered' },
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
schema: { table: { disable: true } }
|
|
12
|
+
}
|
|
13
|
+
} satisfies Meta<typeof SchemaRenderer>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
|
|
19
|
+
|
|
20
|
+
export const Tooltip: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'tooltip',
|
|
24
|
+
content: 'Add to library',
|
|
25
|
+
trigger: [
|
|
26
|
+
{ type: 'button', props: { variant: 'outline' }, children: [{type:'text', content: 'Hover Me'}] }
|
|
27
|
+
]
|
|
28
|
+
} as any,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export const Popover: Story = {
|
|
32
|
+
render: renderStory,
|
|
33
|
+
args: {
|
|
34
|
+
type: 'popover',
|
|
35
|
+
trigger: [
|
|
36
|
+
{ type: 'button', props: { variant: 'outline' }, children: [{type: 'text', content: 'Open Popover'}] }
|
|
37
|
+
],
|
|
38
|
+
content: [
|
|
39
|
+
{ type: 'div', className: 'grid gap-4', children: [
|
|
40
|
+
{ type: 'div', className: 'space-y-2', children: [
|
|
41
|
+
{ type: 'html', tag: 'h4', className: 'font-medium leading-none', content: 'Dimensions' },
|
|
42
|
+
{ type: 'text', content: 'Set the dimensions for the layer.', className: 'text-sm text-muted-foreground' }
|
|
43
|
+
]},
|
|
44
|
+
{ type: 'div', className: 'grid gap-2', children: [
|
|
45
|
+
{ type: 'input', label: 'Width', defaultValue: '100%' },
|
|
46
|
+
{ type: 'input', label: 'Max. width', defaultValue: '300px' },
|
|
47
|
+
{ type: 'input', label: 'Height', defaultValue: '25px' },
|
|
48
|
+
{ type: 'input', label: 'Max. height', defaultValue: 'none' },
|
|
49
|
+
]}
|
|
50
|
+
]}
|
|
51
|
+
]
|
|
52
|
+
} as any,
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const HoverCard: Story = {
|
|
56
|
+
render: renderStory,
|
|
57
|
+
args: {
|
|
58
|
+
type: 'hover-card',
|
|
59
|
+
trigger: [
|
|
60
|
+
{ type: 'button', props: { variant: 'link' }, children: [{ type: 'text', content: '@nextjs'}] }
|
|
61
|
+
],
|
|
62
|
+
content: [
|
|
63
|
+
{ type: 'div', className: 'flex justify-between space-x-4', children: [
|
|
64
|
+
{ type: 'avatar', src: 'https://github.com/vercel.png', fallback: 'VC' },
|
|
65
|
+
{ type: 'div', className: 'space-y-1', children: [
|
|
66
|
+
{ type: 'html', tag: 'h4', className: 'text-sm font-semibold', content: '@nextjs' },
|
|
67
|
+
{ type: 'text', content: 'The React Framework – created and maintained by @vercel.', className: 'text-sm' },
|
|
68
|
+
{ type: 'div', className: 'flex items-center pt-2', children: [
|
|
69
|
+
{ type: 'icon', name: 'calendar', className: 'mr-2 h-4 w-4 opacity-70' },
|
|
70
|
+
{ type: 'text', content: 'Joined December 2021', className: 'text-xs text-muted-foreground' }
|
|
71
|
+
]}
|
|
72
|
+
]}
|
|
73
|
+
]}
|
|
74
|
+
]
|
|
75
|
+
} as any,
|
|
76
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer, SchemaRendererProvider } from '@object-ui/react';
|
|
3
|
+
|
|
4
|
+
const meta: Meta = {
|
|
5
|
+
title: 'Templates/Page',
|
|
6
|
+
component: SchemaRenderer,
|
|
7
|
+
parameters: { layout: 'fullscreen' },
|
|
8
|
+
tags: ['autodocs'],
|
|
9
|
+
argTypes: {
|
|
10
|
+
// Schema properties
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
export const Page: Story = {
|
|
18
|
+
args: {
|
|
19
|
+
type: 'page',
|
|
20
|
+
title: 'Schema/Layout/Dashboard',
|
|
21
|
+
description: 'Overview of your project analysis.',
|
|
22
|
+
children: [
|
|
23
|
+
{
|
|
24
|
+
type: 'grid',
|
|
25
|
+
cols: { base: 1, md: 3 },
|
|
26
|
+
gap: 4,
|
|
27
|
+
children: [
|
|
28
|
+
{ type: 'statistic', label: 'Total Revenue', value: '$45,231.89', trend: 'up', description: '+20.1% from last month' },
|
|
29
|
+
{ type: 'statistic', label: 'Subscriptions', value: '+2350', trend: 'up', description: '+180.1% from last month' },
|
|
30
|
+
{ type: 'statistic', label: 'Sales', value: '+12,234', trend: 'down', description: '-19% from last month' }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{ type: 'separator', className: 'my-6' },
|
|
34
|
+
{
|
|
35
|
+
type: 'data-table',
|
|
36
|
+
caption: 'Recent Transactions',
|
|
37
|
+
columns: [
|
|
38
|
+
{ header: 'ID', accessorKey: 'id', width: '80px' },
|
|
39
|
+
{ header: 'Amount', accessorKey: 'amount' },
|
|
40
|
+
{ header: 'Status', accessorKey: 'status' }
|
|
41
|
+
],
|
|
42
|
+
data: [
|
|
43
|
+
{ id: 1, amount: '$350.00', status: 'Paid' },
|
|
44
|
+
{ id: 2, amount: '$120.50', status: 'Processing' },
|
|
45
|
+
{ id: 3, amount: '$850.00', status: 'Paid' }
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
render: (args) => (
|
|
51
|
+
<SchemaRendererProvider dataSource={{}}>
|
|
52
|
+
<SchemaRenderer schema={args} />
|
|
53
|
+
</SchemaRendererProvider>
|
|
54
|
+
)
|
|
55
|
+
};
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Templates/Reports',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
},
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
schema: { table: { disable: true } },
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta<any>;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
type Story = StoryObj<typeof meta>;
|
|
19
|
+
|
|
20
|
+
const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
|
|
21
|
+
|
|
22
|
+
export const ReportViewer: Story = {
|
|
23
|
+
render: renderStory,
|
|
24
|
+
args: {
|
|
25
|
+
type: 'report-viewer',
|
|
26
|
+
report: {
|
|
27
|
+
type: 'report',
|
|
28
|
+
title: 'Quarterly Sales Report',
|
|
29
|
+
description: 'Sales performance analysis for Q1 2024',
|
|
30
|
+
fields: [
|
|
31
|
+
{ name: 'region', label: 'Region', type: 'string' },
|
|
32
|
+
{ name: 'revenue', label: 'Revenue', type: 'number', aggregation: 'sum', showInSummary: true },
|
|
33
|
+
{ name: 'units', label: 'Units Sold', type: 'number', aggregation: 'sum', showInSummary: true }
|
|
34
|
+
],
|
|
35
|
+
sections: [
|
|
36
|
+
{
|
|
37
|
+
type: 'header',
|
|
38
|
+
title: 'Executive Summary'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'summary',
|
|
42
|
+
title: 'Key Metrics'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
type: 'chart',
|
|
46
|
+
title: 'Revenue by Region',
|
|
47
|
+
chart: {
|
|
48
|
+
type: 'chart',
|
|
49
|
+
chartType: 'bar',
|
|
50
|
+
data: [
|
|
51
|
+
{ region: 'North', revenue: 45000 },
|
|
52
|
+
{ region: 'South', revenue: 32000 },
|
|
53
|
+
{ region: 'East', revenue: 38000 },
|
|
54
|
+
{ region: 'West', revenue: 41000 },
|
|
55
|
+
],
|
|
56
|
+
xAxisKey: 'region',
|
|
57
|
+
series: [{ dataKey: 'revenue' }],
|
|
58
|
+
config: {
|
|
59
|
+
revenue: { label: 'Revenue', color: '#3b82f6' }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
type: 'table',
|
|
65
|
+
title: 'Detailed Breakdown',
|
|
66
|
+
columns: [
|
|
67
|
+
{ name: 'region', label: 'Region' },
|
|
68
|
+
{ name: 'revenue', label: 'Revenue' },
|
|
69
|
+
{ name: 'units', label: 'Units Sold' }
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
showExportButtons: true
|
|
74
|
+
},
|
|
75
|
+
data: [
|
|
76
|
+
{ region: 'North', revenue: 45000, units: 1200 },
|
|
77
|
+
{ region: 'South', revenue: 32000, units: 850 },
|
|
78
|
+
{ region: 'East', revenue: 38000, units: 1050 },
|
|
79
|
+
{ region: 'West', revenue: 41000, units: 1100 },
|
|
80
|
+
],
|
|
81
|
+
showToolbar: true,
|
|
82
|
+
allowExport: true,
|
|
83
|
+
allowPrint: true
|
|
84
|
+
} as any,
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const ReportViewerMinimal: Story = {
|
|
88
|
+
render: renderStory,
|
|
89
|
+
args: {
|
|
90
|
+
type: 'report-viewer',
|
|
91
|
+
report: {
|
|
92
|
+
type: 'report',
|
|
93
|
+
title: 'Simple Report',
|
|
94
|
+
description: 'Basic report without sections',
|
|
95
|
+
fields: [
|
|
96
|
+
{ name: 'product', label: 'Product' },
|
|
97
|
+
{ name: 'sales', label: 'Sales' },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
data: [
|
|
101
|
+
{ product: 'Widget A', sales: 1200 },
|
|
102
|
+
{ product: 'Widget B', sales: 850 },
|
|
103
|
+
{ product: 'Widget C', sales: 1450 },
|
|
104
|
+
],
|
|
105
|
+
showToolbar: false,
|
|
106
|
+
} as any,
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export const ReportBuilder: Story = {
|
|
110
|
+
render: renderStory,
|
|
111
|
+
args: {
|
|
112
|
+
type: 'report-builder',
|
|
113
|
+
availableFields: [
|
|
114
|
+
{ name: 'revenue', label: 'Revenue', type: 'number' },
|
|
115
|
+
{ name: 'units', label: 'Units Sold', type: 'number' },
|
|
116
|
+
{ name: 'region', label: 'Region', type: 'string' },
|
|
117
|
+
{ name: 'product', label: 'Product', type: 'string' },
|
|
118
|
+
{ name: 'date', label: 'Date', type: 'date' },
|
|
119
|
+
{ name: 'customer', label: 'Customer', type: 'string' }
|
|
120
|
+
],
|
|
121
|
+
showPreview: true,
|
|
122
|
+
onSave: 'handleSaveReport',
|
|
123
|
+
onCancel: 'handleCancel'
|
|
124
|
+
} as any,
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
export const ReportBuilderWithInitialConfig: Story = {
|
|
128
|
+
render: renderStory,
|
|
129
|
+
args: {
|
|
130
|
+
type: 'report-builder',
|
|
131
|
+
report: {
|
|
132
|
+
type: 'report',
|
|
133
|
+
title: 'Monthly Sales Report',
|
|
134
|
+
description: 'Sales performance tracking by region',
|
|
135
|
+
fields: [
|
|
136
|
+
{ name: 'revenue', label: 'Revenue', type: 'number', aggregation: 'sum', showInSummary: true },
|
|
137
|
+
{ name: 'units', label: 'Units Sold', type: 'number', aggregation: 'count', showInSummary: true },
|
|
138
|
+
{ name: 'region', label: 'Region', type: 'string' }
|
|
139
|
+
],
|
|
140
|
+
filters: [
|
|
141
|
+
{ field: 'date', operator: 'greater_than', value: '2024-01-01' }
|
|
142
|
+
],
|
|
143
|
+
groupBy: [
|
|
144
|
+
{ field: 'region', sort: 'asc' }
|
|
145
|
+
],
|
|
146
|
+
sections: [
|
|
147
|
+
{ type: 'header', title: 'Executive Summary' },
|
|
148
|
+
{ type: 'summary', title: 'Key Metrics' },
|
|
149
|
+
{ type: 'table', title: 'Detailed Data' }
|
|
150
|
+
],
|
|
151
|
+
showExportButtons: true,
|
|
152
|
+
defaultExportFormat: 'pdf'
|
|
153
|
+
},
|
|
154
|
+
availableFields: [
|
|
155
|
+
{ name: 'revenue', label: 'Revenue', type: 'number' },
|
|
156
|
+
{ name: 'units', label: 'Units Sold', type: 'number' },
|
|
157
|
+
{ name: 'region', label: 'Region', type: 'string' },
|
|
158
|
+
{ name: 'product', label: 'Product', type: 'string' },
|
|
159
|
+
{ name: 'date', label: 'Date', type: 'date' }
|
|
160
|
+
],
|
|
161
|
+
showPreview: true,
|
|
162
|
+
} as any,
|
|
163
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Primitives/Layout/Resizable',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: { layout: 'centered' },
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
schema: { table: { disable: true } }
|
|
12
|
+
}
|
|
13
|
+
} satisfies Meta<typeof SchemaRenderer>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
|
|
19
|
+
|
|
20
|
+
export const Resizable: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'resizable',
|
|
24
|
+
className: 'max-w-md rounded-lg border',
|
|
25
|
+
minHeight: '200px',
|
|
26
|
+
panels: [
|
|
27
|
+
{
|
|
28
|
+
defaultSize: 50,
|
|
29
|
+
content: [
|
|
30
|
+
{ type: 'div', className: 'flex h-full items-center justify-center p-6', children: [{type:'text', className:'font-semibold', content:'One'}] }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
defaultSize: 50,
|
|
35
|
+
content: [
|
|
36
|
+
{ type: 'resizable', direction: 'vertical', children: [], panels: [
|
|
37
|
+
{ defaultSize: 25, content: [{ type: 'div', className: 'flex h-full items-center justify-center p-6', children: [{type:'text', className:'font-semibold', content:'Two'}] }] },
|
|
38
|
+
{ defaultSize: 75, content: [{ type: 'div', className: 'flex h-full items-center justify-center p-6', children: [{type:'text', className:'font-semibold', content:'Three'}] }] }
|
|
39
|
+
] }
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
} as any,
|
|
44
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Primitives/Data Entry/Select',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: { layout: 'centered' },
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
schema: { table: { disable: true } }
|
|
12
|
+
}
|
|
13
|
+
} satisfies Meta<typeof SchemaRenderer>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
|
|
19
|
+
|
|
20
|
+
export const Select: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'select',
|
|
24
|
+
label: 'Framework',
|
|
25
|
+
placeholder: 'Select a framework',
|
|
26
|
+
wrapperClass: 'w-[280px]',
|
|
27
|
+
options: [
|
|
28
|
+
{ label: 'Next.js', value: 'next' },
|
|
29
|
+
{ label: 'SvelteKit', value: 'svelte' },
|
|
30
|
+
{ label: 'Astro', value: 'astro' },
|
|
31
|
+
{ label: 'Nuxt', value: 'nuxt' }
|
|
32
|
+
]
|
|
33
|
+
} as any,
|
|
34
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
+
import type { BaseSchema } from '@object-ui/types';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Primitives/General/Separator',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: { layout: 'centered' },
|
|
9
|
+
tags: ['autodocs'],
|
|
10
|
+
argTypes: {
|
|
11
|
+
schema: { table: { disable: true } }
|
|
12
|
+
}
|
|
13
|
+
} satisfies Meta<typeof SchemaRenderer>;
|
|
14
|
+
|
|
15
|
+
export default meta;
|
|
16
|
+
type Story = StoryObj<typeof meta>;
|
|
17
|
+
|
|
18
|
+
const renderStory = (args: any) => <SchemaRenderer schema={args as unknown as BaseSchema} />;
|
|
19
|
+
|
|
20
|
+
export const Separator: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'div',
|
|
24
|
+
className: 'text-sm font-medium',
|
|
25
|
+
children: [
|
|
26
|
+
{ type: 'text', content: 'Radix Primitives' },
|
|
27
|
+
{ type: 'separator', className: 'my-4' },
|
|
28
|
+
{
|
|
29
|
+
type: 'div',
|
|
30
|
+
className: 'flex h-5 items-center space-x-4 text-sm',
|
|
31
|
+
children: [
|
|
32
|
+
{ type: 'text', content: 'Blog' },
|
|
33
|
+
{ type: 'separator', orientation: 'vertical' },
|
|
34
|
+
{ type: 'text', content: 'Docs' },
|
|
35
|
+
{ type: 'separator', orientation: 'vertical' },
|
|
36
|
+
{ type: 'text', content: 'Source' }
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
} as any,
|
|
41
|
+
};
|