@object-ui/components 0.3.1 → 0.5.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 +47 -0
- package/README.md +13 -0
- package/dist/index.css +1 -1
- package/dist/index.js +34610 -24854
- package/dist/index.umd.cjs +53 -32
- package/dist/src/SchemaRenderer.d.ts +3 -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 +12 -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/sort-builder.d.ts +22 -0
- package/dist/src/index.d.ts +1 -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 +17 -7
- package/shadcn-components.json +52 -47
- package/src/SchemaRenderer.tsx +28 -0
- package/src/__tests__/PageRendererRegions.test.tsx +59 -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__/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/{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 +12 -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/sort-builder.tsx +129 -0
- package/src/index.css +20 -1
- package/src/index.ts +1 -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/carousel.tsx +1 -0
- package/src/renderers/complex/data-table.tsx +134 -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 +92 -15
- 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/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 +35 -23
- 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 +5 -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 +2 -2
- package/src/stories/CRMApp.stories.tsx +706 -0
- package/src/stories/Guide.mdx +55 -0
- package/src/stories/Introduction.mdx +34 -0
- package/src/stories/MockedData.stories.tsx +71 -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/dashboard.stories.tsx +318 -0
- package/src/stories-json/data-table.stories.tsx +60 -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_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.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 +157 -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,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: 'Components/Statistic',
|
|
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 Default: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'statistic',
|
|
24
|
+
label: 'Total Revenue',
|
|
25
|
+
value: '$45,231.89',
|
|
26
|
+
icon: 'dollar-sign',
|
|
27
|
+
trend: 'up',
|
|
28
|
+
description: '+20.1% from last month',
|
|
29
|
+
className: 'w-[300px]'
|
|
30
|
+
} as any,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const DownTrend: Story = {
|
|
34
|
+
render: renderStory,
|
|
35
|
+
args: {
|
|
36
|
+
type: 'statistic',
|
|
37
|
+
label: 'Bounce Rate',
|
|
38
|
+
value: '42.3%',
|
|
39
|
+
icon: 'activity',
|
|
40
|
+
trend: 'down',
|
|
41
|
+
description: '-5% better than average',
|
|
42
|
+
className: 'w-[300px]'
|
|
43
|
+
} as any,
|
|
44
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
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: 'Components/Tabs',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: { layout: 'padded' },
|
|
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 Default: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'tabs',
|
|
24
|
+
defaultValue: 'account',
|
|
25
|
+
className: 'w-[400px]',
|
|
26
|
+
items: [
|
|
27
|
+
{
|
|
28
|
+
label: 'Account',
|
|
29
|
+
value: 'account',
|
|
30
|
+
body: [
|
|
31
|
+
{ type: 'card', title: 'Schema/Navigation/Account', description: "Make changes to your account here.", children: [
|
|
32
|
+
{ type: 'input', label: 'Name', defaultValue: 'Pedro Duarte', wrapperClass: 'mb-4' },
|
|
33
|
+
{ type: 'input', label: 'Username', defaultValue: '@peduarte' },
|
|
34
|
+
{ type: 'button', children: [{type:'text', content: 'Save changes'}], className: 'mt-4' }
|
|
35
|
+
]}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
label: 'Password',
|
|
40
|
+
value: 'password',
|
|
41
|
+
body: [
|
|
42
|
+
{ type: 'card', title: 'Schema/Navigation/Password', description: "Change your password here.", children: [
|
|
43
|
+
{ type: 'input', label: 'Current Password', inputType: 'password', wrapperClass: 'mb-4' },
|
|
44
|
+
{ type: 'input', label: 'New Password', inputType: 'password' },
|
|
45
|
+
{ type: 'button', children: [{type:'text', content: 'Save password'}], className: 'mt-4' }
|
|
46
|
+
]}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
} as any,
|
|
51
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
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: 'Components/Timeline',
|
|
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 Vertical: Story = {
|
|
23
|
+
render: renderStory,
|
|
24
|
+
args: {
|
|
25
|
+
type: 'timeline',
|
|
26
|
+
variant: 'vertical',
|
|
27
|
+
dateFormat: 'short',
|
|
28
|
+
items: [
|
|
29
|
+
{
|
|
30
|
+
time: '2024-01-15',
|
|
31
|
+
title: 'Schema/Data Display/Project Started',
|
|
32
|
+
description: 'Kickoff meeting and initial planning',
|
|
33
|
+
variant: 'success',
|
|
34
|
+
icon: '🚀',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
time: '2024-02-01',
|
|
38
|
+
title: 'Schema/Data Display/First Milestone',
|
|
39
|
+
description: 'Completed initial design phase',
|
|
40
|
+
variant: 'info',
|
|
41
|
+
icon: '🎨',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
time: '2024-03-15',
|
|
45
|
+
title: 'Schema/Data Display/Beta Release',
|
|
46
|
+
description: 'Released beta version to testers',
|
|
47
|
+
variant: 'warning',
|
|
48
|
+
icon: '⚡',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
time: '2024-04-01',
|
|
52
|
+
title: 'Schema/Data Display/Launch',
|
|
53
|
+
description: 'Official product launch',
|
|
54
|
+
variant: 'success',
|
|
55
|
+
icon: '🎉',
|
|
56
|
+
},
|
|
57
|
+
]
|
|
58
|
+
} as any,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
export const Horizontal: Story = {
|
|
62
|
+
render: renderStory,
|
|
63
|
+
args: {
|
|
64
|
+
type: 'timeline',
|
|
65
|
+
variant: 'horizontal',
|
|
66
|
+
dateFormat: 'short',
|
|
67
|
+
items: [
|
|
68
|
+
{
|
|
69
|
+
time: '2024-01-01',
|
|
70
|
+
title: 'Schema/Data Display/Q1',
|
|
71
|
+
description: 'First quarter goals',
|
|
72
|
+
variant: 'default',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
time: '2024-04-01',
|
|
76
|
+
title: 'Schema/Data Display/Q2',
|
|
77
|
+
description: 'Second quarter goals',
|
|
78
|
+
variant: 'info',
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
time: '2024-07-01',
|
|
82
|
+
title: 'Schema/Data Display/Q3',
|
|
83
|
+
description: 'Third quarter goals',
|
|
84
|
+
variant: 'warning',
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
time: '2024-10-01',
|
|
88
|
+
title: 'Schema/Data Display/Q4',
|
|
89
|
+
description: 'Fourth quarter goals',
|
|
90
|
+
variant: 'success',
|
|
91
|
+
},
|
|
92
|
+
]
|
|
93
|
+
} as any,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const Gantt: Story = {
|
|
97
|
+
render: renderStory,
|
|
98
|
+
args: {
|
|
99
|
+
type: 'timeline',
|
|
100
|
+
variant: 'gantt',
|
|
101
|
+
dateFormat: 'short',
|
|
102
|
+
timeScale: 'month',
|
|
103
|
+
rowLabel: 'Projects',
|
|
104
|
+
items: [
|
|
105
|
+
{
|
|
106
|
+
label: 'Backend Development',
|
|
107
|
+
items: [
|
|
108
|
+
{
|
|
109
|
+
title: 'Schema/Data Display/API Design',
|
|
110
|
+
startDate: '2024-01-01',
|
|
111
|
+
endDate: '2024-01-31',
|
|
112
|
+
variant: 'success',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
title: 'Schema/Data Display/Implementation',
|
|
116
|
+
startDate: '2024-02-01',
|
|
117
|
+
endDate: '2024-03-31',
|
|
118
|
+
variant: 'info',
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
label: 'Frontend Development',
|
|
124
|
+
items: [
|
|
125
|
+
{
|
|
126
|
+
title: 'Schema/Data Display/UI Design',
|
|
127
|
+
startDate: '2024-01-15',
|
|
128
|
+
endDate: '2024-02-15',
|
|
129
|
+
variant: 'warning',
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
title: 'Schema/Data Display/Component Dev',
|
|
133
|
+
startDate: '2024-02-15',
|
|
134
|
+
endDate: '2024-04-15',
|
|
135
|
+
variant: 'default',
|
|
136
|
+
},
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: 'Testing',
|
|
141
|
+
items: [
|
|
142
|
+
{
|
|
143
|
+
title: 'Schema/Data Display/QA Phase',
|
|
144
|
+
startDate: '2024-03-01',
|
|
145
|
+
endDate: '2024-04-30',
|
|
146
|
+
variant: 'danger',
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
className: 'w-full'
|
|
152
|
+
} as any,
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const ProductRoadmap: Story = {
|
|
156
|
+
render: renderStory,
|
|
157
|
+
args: {
|
|
158
|
+
type: 'timeline',
|
|
159
|
+
variant: 'vertical',
|
|
160
|
+
dateFormat: 'long',
|
|
161
|
+
items: [
|
|
162
|
+
{
|
|
163
|
+
time: '2024-01-01',
|
|
164
|
+
title: 'Schema/Data Display/Phase 1: Foundation',
|
|
165
|
+
description: 'Core infrastructure and basic features',
|
|
166
|
+
variant: 'success',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
time: '2024-03-01',
|
|
170
|
+
title: 'Schema/Data Display/Phase 2: Enhancement',
|
|
171
|
+
description: 'Advanced features and integrations',
|
|
172
|
+
variant: 'info',
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
time: '2024-06-01',
|
|
176
|
+
title: 'Schema/Data Display/Phase 3: Optimization',
|
|
177
|
+
description: 'Performance improvements and scaling',
|
|
178
|
+
variant: 'warning',
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
time: '2024-09-01',
|
|
182
|
+
title: 'Schema/Data Display/Phase 4: Enterprise',
|
|
183
|
+
description: 'Enterprise features and support',
|
|
184
|
+
variant: 'default',
|
|
185
|
+
},
|
|
186
|
+
]
|
|
187
|
+
} as any,
|
|
188
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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: 'Components/Typography',
|
|
7
|
+
component: SchemaRenderer,
|
|
8
|
+
parameters: { layout: 'padded' },
|
|
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 Headings: Story = {
|
|
21
|
+
render: renderStory,
|
|
22
|
+
args: {
|
|
23
|
+
type: 'div',
|
|
24
|
+
className: 'space-y-4',
|
|
25
|
+
children: [
|
|
26
|
+
{ type: 'html', html: '<h1>Taxing Laughter: The Joke Tax Chronicles</h1>', className: 'scroll-m-20 text-4xl font-extrabold tracking-tight lg:text-5xl' },
|
|
27
|
+
{ type: 'html', html: '<h2>The People of the Kingdom</h2>', className: 'scroll-m-20 border-b pb-2 text-3xl font-semibold tracking-tight first:mt-0' },
|
|
28
|
+
{ type: 'html', html: '<h3>The Joke Tax</h3>', className: 'scroll-m-20 text-2xl font-semibold tracking-tight' },
|
|
29
|
+
{ type: 'html', html: '<h4>People stopped telling jokes</h4>', className: 'scroll-m-20 text-xl font-semibold tracking-tight' },
|
|
30
|
+
]
|
|
31
|
+
} as any,
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Paragraphs: Story = {
|
|
35
|
+
render: renderStory,
|
|
36
|
+
args: {
|
|
37
|
+
type: 'div',
|
|
38
|
+
className: 'space-y-4 max-w-lg',
|
|
39
|
+
children: [
|
|
40
|
+
{ type: 'html', html: '<p>The king, seeing how much happier his subjects were, realized the error of his ways and repealed the joke tax.</p>', className: 'leading-7 [&:not(:first-child)]:mt-6' },
|
|
41
|
+
{ type: 'html', html: '<blockquote>"After all," he said, "everyone enjoys a good joke, so it\'s only fair that they should pay for the privilege."</blockquote>', className: 'mt-6 border-l-2 pl-6 italic' },
|
|
42
|
+
{ type: 'text', content: 'Just a plain text node without wrapper.' }
|
|
43
|
+
]
|
|
44
|
+
} as any,
|
|
45
|
+
};
|
package/src/ui/accordion.tsx
CHANGED
|
@@ -6,67 +6,61 @@
|
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
+
"use client"
|
|
10
|
+
|
|
9
11
|
import * as React from "react"
|
|
10
12
|
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
11
|
-
import {
|
|
13
|
+
import { ChevronDown } from "lucide-react"
|
|
12
14
|
|
|
13
15
|
import { cn } from "../lib/utils"
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
...props
|
|
17
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
|
|
18
|
-
return <AccordionPrimitive.Root data-slot="accordion" {...props} />
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function AccordionItem({
|
|
22
|
-
className,
|
|
23
|
-
...props
|
|
24
|
-
}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
|
|
25
|
-
return (
|
|
26
|
-
<AccordionPrimitive.Item
|
|
27
|
-
data-slot="accordion-item"
|
|
28
|
-
className={cn("border-b last:border-b-0", className)}
|
|
29
|
-
{...props}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
17
|
+
const Accordion = AccordionPrimitive.Root
|
|
33
18
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
className
|
|
46
|
-
)}
|
|
47
|
-
{...props}
|
|
48
|
-
>
|
|
49
|
-
{children}
|
|
50
|
-
<ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
|
|
51
|
-
</AccordionPrimitive.Trigger>
|
|
52
|
-
</AccordionPrimitive.Header>
|
|
53
|
-
)
|
|
54
|
-
}
|
|
19
|
+
const AccordionItem = React.forwardRef<
|
|
20
|
+
React.ElementRef<typeof AccordionPrimitive.Item>,
|
|
21
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Item>
|
|
22
|
+
>(({ className, ...props }, ref) => (
|
|
23
|
+
<AccordionPrimitive.Item
|
|
24
|
+
ref={ref}
|
|
25
|
+
className={cn("border-b", className)}
|
|
26
|
+
{...props}
|
|
27
|
+
/>
|
|
28
|
+
))
|
|
29
|
+
AccordionItem.displayName = "AccordionItem"
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
31
|
+
const AccordionTrigger = React.forwardRef<
|
|
32
|
+
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
33
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Trigger>
|
|
34
|
+
>(({ className, children, ...props }, ref) => (
|
|
35
|
+
<AccordionPrimitive.Header className="flex">
|
|
36
|
+
<AccordionPrimitive.Trigger
|
|
37
|
+
ref={ref}
|
|
38
|
+
className={cn(
|
|
39
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
40
|
+
className
|
|
41
|
+
)}
|
|
65
42
|
{...props}
|
|
66
43
|
>
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
44
|
+
{children}
|
|
45
|
+
<ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />
|
|
46
|
+
</AccordionPrimitive.Trigger>
|
|
47
|
+
</AccordionPrimitive.Header>
|
|
48
|
+
))
|
|
49
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName
|
|
50
|
+
|
|
51
|
+
const AccordionContent = React.forwardRef<
|
|
52
|
+
React.ElementRef<typeof AccordionPrimitive.Content>,
|
|
53
|
+
React.ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
|
|
54
|
+
>(({ className, children, ...props }, ref) => (
|
|
55
|
+
<AccordionPrimitive.Content
|
|
56
|
+
ref={ref}
|
|
57
|
+
className="overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
58
|
+
{...props}
|
|
59
|
+
>
|
|
60
|
+
<div className={cn("pb-4 pt-0", className)}>{children}</div>
|
|
61
|
+
</AccordionPrimitive.Content>
|
|
62
|
+
))
|
|
63
|
+
|
|
64
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
|
71
65
|
|
|
72
66
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|