@object-ui/components 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.
- package/CHANGELOG.md +20 -0
- package/README.md +21 -1
- package/dist/index.css +6339 -2
- package/dist/index.js +17600 -17481
- package/dist/index.umd.cjs +36 -36
- package/dist/packages/components/src/custom/empty.d.ts +12 -1
- package/dist/packages/components/src/renderers/action/action-bar.d.ts +12 -1
- package/dist/packages/components/src/ui/chart.d.ts +10 -29
- package/package.json +65 -44
- package/.turbo/turbo-build.log +0 -84
- package/README_SHADCN_SYNC.md +0 -281
- package/TESTING.md +0 -335
- package/docs/FilterBuilder.md +0 -268
- package/metadata/Chart.component.yml +0 -30
- package/metadata/FilterBuilder.component.yml +0 -39
- package/metadata/GridLayout.component.yml +0 -27
- package/metadata/Menu.component.yml +0 -31
- package/metadata/ObjectForm.component.yml +0 -34
- package/metadata/ObjectGrid.component.yml +0 -72
- package/metadata/Page.component.yml +0 -24
- package/postcss.config.js +0 -14
- package/shadcn-components.json +0 -440
- package/src/SchemaRenderer.tsx +0 -28
- package/src/__tests__/PageRendererRegions.test.tsx +0 -668
- package/src/__tests__/README.md +0 -124
- package/src/__tests__/__snapshots__/snapshot-critical.test.tsx.snap +0 -811
- package/src/__tests__/__snapshots__/snapshot.test.tsx.snap +0 -327
- package/src/__tests__/accessibility.test.tsx +0 -137
- package/src/__tests__/action-bar.test.tsx +0 -206
- package/src/__tests__/api-consistency.test.tsx +0 -596
- package/src/__tests__/basic-renderers.test.tsx +0 -255
- package/src/__tests__/color-contrast.test.tsx +0 -212
- package/src/__tests__/complex-disclosure-renderers.test.tsx +0 -302
- package/src/__tests__/compliance.test.tsx +0 -72
- package/src/__tests__/config-field-renderer.test.tsx +0 -307
- package/src/__tests__/config-panel-renderer.test.tsx +0 -580
- package/src/__tests__/config-primitives.test.tsx +0 -106
- package/src/__tests__/edge-cases.test.tsx +0 -285
- package/src/__tests__/feedback-overlay-renderers.test.tsx +0 -349
- package/src/__tests__/filter-builder.test.tsx +0 -409
- package/src/__tests__/form-renderers.test.tsx +0 -364
- package/src/__tests__/layout-data-renderers.test.tsx +0 -340
- package/src/__tests__/mobile-accessibility.test.tsx +0 -120
- package/src/__tests__/navigation-overlay.test.tsx +0 -370
- package/src/__tests__/snapshot-critical.test.tsx +0 -317
- package/src/__tests__/snapshot.test.tsx +0 -205
- package/src/__tests__/test-utils.tsx +0 -190
- package/src/__tests__/use-config-draft.test.tsx +0 -295
- package/src/__tests__/view-compliance.test.tsx +0 -153
- package/src/__tests__/wcag-audit.test.tsx +0 -493
- package/src/custom/action-param-dialog.tsx +0 -264
- package/src/custom/button-group.tsx +0 -91
- package/src/custom/combobox.tsx +0 -104
- package/src/custom/config-field-renderer.tsx +0 -276
- package/src/custom/config-panel-renderer.tsx +0 -306
- package/src/custom/config-row.tsx +0 -50
- package/src/custom/date-picker.tsx +0 -61
- package/src/custom/empty.tsx +0 -112
- package/src/custom/field.tsx +0 -81
- package/src/custom/filter-builder.tsx +0 -418
- package/src/custom/index.ts +0 -21
- package/src/custom/input-group.tsx +0 -53
- package/src/custom/item.tsx +0 -201
- package/src/custom/kbd.tsx +0 -36
- package/src/custom/mobile-dialog-content.tsx +0 -67
- package/src/custom/native-select.tsx +0 -33
- package/src/custom/navigation-overlay.tsx +0 -334
- package/src/custom/section-header.tsx +0 -68
- package/src/custom/sort-builder.tsx +0 -129
- package/src/custom/spinner.tsx +0 -26
- package/src/custom/view-skeleton.tsx +0 -243
- package/src/custom/view-states.tsx +0 -153
- package/src/debug/DebugPanel.tsx +0 -313
- package/src/debug/__tests__/DebugPanel.test.tsx +0 -134
- package/src/debug/index.ts +0 -10
- package/src/hooks/use-config-draft.ts +0 -127
- package/src/hooks/use-mobile.tsx +0 -27
- package/src/index.css +0 -245
- package/src/index.ts +0 -47
- package/src/lib/use-sync-external-store-shim.ts +0 -10
- package/src/lib/use-sync-external-store-with-selector-shim.ts +0 -90
- package/src/lib/utils.tsx +0 -35
- package/src/new-components.test.ts +0 -73
- package/src/renderers/action/action-bar.tsx +0 -221
- package/src/renderers/action/action-button.tsx +0 -158
- package/src/renderers/action/action-group.tsx +0 -270
- package/src/renderers/action/action-icon.tsx +0 -150
- package/src/renderers/action/action-menu.tsx +0 -203
- package/src/renderers/action/index.ts +0 -19
- package/src/renderers/action/resolve-icon.ts +0 -35
- package/src/renderers/basic/button-group.tsx +0 -79
- package/src/renderers/basic/div.tsx +0 -60
- package/src/renderers/basic/html.tsx +0 -43
- package/src/renderers/basic/icon.tsx +0 -89
- package/src/renderers/basic/image.tsx +0 -49
- package/src/renderers/basic/index.ts +0 -18
- package/src/renderers/basic/navigation-menu.tsx +0 -81
- package/src/renderers/basic/pagination.tsx +0 -109
- package/src/renderers/basic/separator.tsx +0 -57
- package/src/renderers/basic/span.tsx +0 -63
- package/src/renderers/basic/text.tsx +0 -52
- package/src/renderers/complex/README-KANBAN.md +0 -208
- package/src/renderers/complex/TIMELINE.md +0 -353
- package/src/renderers/complex/__tests__/data-table-airtable-ux.test.tsx +0 -239
- package/src/renderers/complex/__tests__/data-table-batch-editing.test.tsx +0 -275
- package/src/renderers/complex/__tests__/data-table-cell-renderer.test.tsx +0 -120
- package/src/renderers/complex/__tests__/data-table-editing.test.tsx +0 -221
- package/src/renderers/complex/__tests__/data-table.test.ts +0 -76
- package/src/renderers/complex/carousel.tsx +0 -69
- package/src/renderers/complex/data-table.tsx +0 -1243
- package/src/renderers/complex/filter-builder.tsx +0 -77
- package/src/renderers/complex/index.ts +0 -16
- package/src/renderers/complex/resizable.tsx +0 -66
- package/src/renderers/complex/scroll-area.tsx +0 -58
- package/src/renderers/complex/table.tsx +0 -95
- package/src/renderers/data-display/alert.tsx +0 -46
- package/src/renderers/data-display/avatar.tsx +0 -38
- package/src/renderers/data-display/badge.tsx +0 -55
- package/src/renderers/data-display/breadcrumb.tsx +0 -61
- package/src/renderers/data-display/index.ts +0 -18
- package/src/renderers/data-display/kbd.tsx +0 -50
- package/src/renderers/data-display/list.tsx +0 -75
- package/src/renderers/data-display/statistic.tsx +0 -95
- package/src/renderers/data-display/table.tsx +0 -78
- package/src/renderers/data-display/tree-view.tsx +0 -176
- package/src/renderers/disclosure/accordion.tsx +0 -69
- package/src/renderers/disclosure/collapsible.tsx +0 -53
- package/src/renderers/disclosure/index.ts +0 -11
- package/src/renderers/disclosure/toggle-group.tsx +0 -79
- package/src/renderers/feedback/empty.tsx +0 -49
- package/src/renderers/feedback/index.ts +0 -16
- package/src/renderers/feedback/loading.tsx +0 -78
- package/src/renderers/feedback/progress.tsx +0 -29
- package/src/renderers/feedback/skeleton.tsx +0 -31
- package/src/renderers/feedback/sonner.tsx +0 -56
- package/src/renderers/feedback/spinner.tsx +0 -55
- package/src/renderers/feedback/toast.tsx +0 -59
- package/src/renderers/feedback/toaster.tsx +0 -23
- package/src/renderers/form/button.tsx +0 -103
- package/src/renderers/form/calendar.tsx +0 -34
- package/src/renderers/form/checkbox.tsx +0 -71
- package/src/renderers/form/combobox.tsx +0 -48
- package/src/renderers/form/command.tsx +0 -58
- package/src/renderers/form/date-picker.tsx +0 -84
- package/src/renderers/form/file-upload.tsx +0 -184
- package/src/renderers/form/form.tsx +0 -540
- package/src/renderers/form/index.ts +0 -26
- package/src/renderers/form/input-otp.tsx +0 -51
- package/src/renderers/form/input.tsx +0 -121
- package/src/renderers/form/label.tsx +0 -45
- package/src/renderers/form/radio-group.tsx +0 -63
- package/src/renderers/form/select.tsx +0 -94
- package/src/renderers/form/slider.tsx +0 -61
- package/src/renderers/form/switch.tsx +0 -48
- package/src/renderers/form/textarea.tsx +0 -76
- package/src/renderers/form/toggle.tsx +0 -42
- package/src/renderers/index.ts +0 -18
- package/src/renderers/layout/aspect-ratio.tsx +0 -51
- package/src/renderers/layout/card.tsx +0 -85
- package/src/renderers/layout/container.tsx +0 -122
- package/src/renderers/layout/flex.tsx +0 -132
- package/src/renderers/layout/grid.tsx +0 -178
- package/src/renderers/layout/index.ts +0 -19
- package/src/renderers/layout/page.tsx +0 -466
- package/src/renderers/layout/semantic.tsx +0 -48
- package/src/renderers/layout/stack.tsx +0 -132
- package/src/renderers/layout/tabs.tsx +0 -97
- package/src/renderers/navigation/header-bar.tsx +0 -118
- package/src/renderers/navigation/index.ts +0 -10
- package/src/renderers/navigation/sidebar.tsx +0 -208
- package/src/renderers/overlay/alert-dialog.tsx +0 -72
- package/src/renderers/overlay/context-menu.tsx +0 -100
- package/src/renderers/overlay/dialog.tsx +0 -77
- package/src/renderers/overlay/drawer.tsx +0 -77
- package/src/renderers/overlay/dropdown-menu.tsx +0 -99
- package/src/renderers/overlay/hover-card.tsx +0 -55
- package/src/renderers/overlay/index.ts +0 -18
- package/src/renderers/overlay/menubar.tsx +0 -76
- package/src/renderers/overlay/popover.tsx +0 -56
- package/src/renderers/overlay/sheet.tsx +0 -77
- package/src/renderers/overlay/tooltip.tsx +0 -67
- package/src/renderers/placeholders.tsx +0 -107
- package/src/stories/CRMApp.stories.tsx +0 -706
- package/src/stories/ConfigPanel.stories.tsx +0 -232
- package/src/stories/Guide.mdx +0 -55
- package/src/stories/MockedData.stories.tsx +0 -121
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- 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 +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- 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 +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/header.css +0 -32
- package/src/stories/page.css +0 -68
- package/src/stories-json/Accessibility.mdx +0 -297
- package/src/stories-json/EdgeCases.stories.tsx +0 -160
- package/src/stories-json/GettingStarted.mdx +0 -89
- package/src/stories-json/Introduction.mdx +0 -127
- package/src/stories-json/accordion.stories.tsx +0 -43
- package/src/stories-json/aggrid.stories.tsx +0 -103
- package/src/stories-json/alert.stories.tsx +0 -39
- package/src/stories-json/aspect-ratio.stories.tsx +0 -34
- package/src/stories-json/avatar.stories.tsx +0 -38
- package/src/stories-json/badge.stories.tsx +0 -53
- package/src/stories-json/breadcrumb.stories.tsx +0 -30
- package/src/stories-json/button-group.stories.tsx +0 -43
- package/src/stories-json/button.stories.tsx +0 -73
- package/src/stories-json/calendar.stories.tsx +0 -85
- package/src/stories-json/card.stories.tsx +0 -48
- package/src/stories-json/carousel.stories.tsx +0 -33
- package/src/stories-json/charts.stories.tsx +0 -195
- package/src/stories-json/chatbot.stories.tsx +0 -349
- package/src/stories-json/code-editor.stories.tsx +0 -92
- package/src/stories-json/collapsible.stories.tsx +0 -40
- package/src/stories-json/controls.stories.tsx +0 -36
- package/src/stories-json/crm-live-data.stories.tsx +0 -154
- package/src/stories-json/dashboard.stories.tsx +0 -318
- package/src/stories-json/data-table.stories.tsx +0 -136
- package/src/stories-json/data_display_extras.stories.tsx +0 -102
- package/src/stories-json/date-picker.stories.tsx +0 -28
- package/src/stories-json/detail-view.stories.tsx +0 -258
- package/src/stories-json/dialog.stories.tsx +0 -43
- package/src/stories-json/feedback_extras.stories.tsx +0 -40
- package/src/stories-json/feedback_others.stories.tsx +0 -46
- package/src/stories-json/form-variants.stories.tsx +0 -210
- package/src/stories-json/form_advanced.stories.tsx +0 -117
- package/src/stories-json/form_extras.stories.tsx +0 -123
- package/src/stories-json/grid.stories.tsx +0 -56
- package/src/stories-json/icon.stories.tsx +0 -36
- package/src/stories-json/input.stories.tsx +0 -52
- package/src/stories-json/kanban.stories.tsx +0 -295
- package/src/stories-json/layout_extended.stories.tsx +0 -76
- package/src/stories-json/layout_flex.stories.tsx +0 -107
- package/src/stories-json/list-view.stories.tsx +0 -97
- package/src/stories-json/markdown.stories.tsx +0 -129
- package/src/stories-json/menus.stories.tsx +0 -63
- package/src/stories-json/metric-card.stories.tsx +0 -143
- package/src/stories-json/navigation-menu.stories.tsx +0 -37
- package/src/stories-json/object-aggrid-advanced.stories.tsx +0 -389
- package/src/stories-json/object-aggrid.stories.tsx +0 -252
- package/src/stories-json/object-form.stories.tsx +0 -130
- package/src/stories-json/object-gantt.stories.tsx +0 -114
- package/src/stories-json/object-grid.stories.tsx +0 -315
- package/src/stories-json/object-map.stories.tsx +0 -116
- package/src/stories-json/object-view.stories.tsx +0 -118
- package/src/stories-json/overlay_extras.stories.tsx +0 -113
- package/src/stories-json/overlay_others.stories.tsx +0 -76
- package/src/stories-json/page.stories.tsx +0 -55
- package/src/stories-json/reports.stories.tsx +0 -163
- package/src/stories-json/resizable.stories.tsx +0 -44
- package/src/stories-json/select.stories.tsx +0 -34
- package/src/stories-json/separator.stories.tsx +0 -41
- package/src/stories-json/sidebar.stories.tsx +0 -147
- package/src/stories-json/statistic.stories.tsx +0 -44
- package/src/stories-json/tabs.stories.tsx +0 -51
- package/src/stories-json/timeline.stories.tsx +0 -188
- package/src/stories-json/typography.stories.tsx +0 -45
- package/src/types/config-panel.ts +0 -101
- package/src/ui/accordion.tsx +0 -66
- package/src/ui/alert-dialog.tsx +0 -149
- package/src/ui/alert.tsx +0 -67
- package/src/ui/aspect-ratio.tsx +0 -15
- package/src/ui/avatar.tsx +0 -58
- package/src/ui/badge.tsx +0 -44
- package/src/ui/breadcrumb.tsx +0 -123
- package/src/ui/button.tsx +0 -64
- package/src/ui/calendar.tsx +0 -221
- package/src/ui/card.tsx +0 -87
- package/src/ui/carousel.tsx +0 -270
- package/src/ui/chart.tsx +0 -377
- package/src/ui/checkbox.tsx +0 -38
- package/src/ui/collapsible.tsx +0 -19
- package/src/ui/command.tsx +0 -161
- package/src/ui/context-menu.tsx +0 -208
- package/src/ui/dialog.tsx +0 -130
- package/src/ui/drawer.tsx +0 -126
- package/src/ui/dropdown-menu.tsx +0 -208
- package/src/ui/form.tsx +0 -186
- package/src/ui/hover-card.tsx +0 -37
- package/src/ui/index.ts +0 -56
- package/src/ui/input-otp.tsx +0 -79
- package/src/ui/input.tsx +0 -30
- package/src/ui/label.tsx +0 -34
- package/src/ui/menubar.tsx +0 -264
- package/src/ui/navigation-menu.tsx +0 -136
- package/src/ui/pagination.tsx +0 -125
- package/src/ui/popover.tsx +0 -39
- package/src/ui/progress.tsx +0 -36
- package/src/ui/radio-group.tsx +0 -52
- package/src/ui/resizable.tsx +0 -53
- package/src/ui/scroll-area.tsx +0 -56
- package/src/ui/select.tsx +0 -168
- package/src/ui/separator.tsx +0 -39
- package/src/ui/sheet.tsx +0 -150
- package/src/ui/sidebar.tsx +0 -781
- package/src/ui/skeleton.tsx +0 -23
- package/src/ui/slider.tsx +0 -39
- package/src/ui/sonner.tsx +0 -53
- package/src/ui/switch.tsx +0 -37
- package/src/ui/table.tsx +0 -125
- package/src/ui/tabs.tsx +0 -63
- package/src/ui/textarea.tsx +0 -30
- package/src/ui/toast.tsx +0 -137
- package/src/ui/toggle-group.tsx +0 -69
- package/src/ui/toggle.tsx +0 -53
- package/src/ui/tooltip.tsx +0 -38
- package/src/ui/typography.tsx +0 -85
- package/tsconfig.json +0 -19
- package/vite.config.ts +0 -71
- package/vitest.config.ts +0 -5
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import { SchemaRenderer } from '../SchemaRenderer';
|
|
3
|
-
|
|
4
|
-
const meta: Meta = {
|
|
5
|
-
title: 'Templates/Sidebar',
|
|
6
|
-
component: SchemaRenderer,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {
|
|
9
|
-
// Schema properties
|
|
10
|
-
},
|
|
11
|
-
parameters: {
|
|
12
|
-
layout: 'fullscreen'
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
type Story = StoryObj<typeof meta>;
|
|
18
|
-
|
|
19
|
-
// Helper to minimize nesting
|
|
20
|
-
const sidebarMenu = (items: { label: string, icon?: string, active?: boolean }[]) => ({
|
|
21
|
-
type: 'sidebar-menu',
|
|
22
|
-
body: items.map(item => ({
|
|
23
|
-
type: 'sidebar-menu-item',
|
|
24
|
-
body: [
|
|
25
|
-
{
|
|
26
|
-
type: 'sidebar-menu-button',
|
|
27
|
-
active: item.active,
|
|
28
|
-
tooltip: item.label,
|
|
29
|
-
body: [
|
|
30
|
-
item.icon ? { type: 'icon', name: item.icon } : null,
|
|
31
|
-
{ type: 'text', content: item.label }
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}))
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export const DefaultSidebar: Story = {
|
|
39
|
-
args: {
|
|
40
|
-
type: 'sidebar-provider',
|
|
41
|
-
defaultOpen: true,
|
|
42
|
-
style: { height: '600px', border: '1px solid #e2e8f0' }, // Constrain height for storybook
|
|
43
|
-
body: [
|
|
44
|
-
{
|
|
45
|
-
type: 'sidebar',
|
|
46
|
-
collapsible: 'icon',
|
|
47
|
-
body: [
|
|
48
|
-
{
|
|
49
|
-
type: 'sidebar-header',
|
|
50
|
-
body: [
|
|
51
|
-
{
|
|
52
|
-
type: 'sidebar-menu',
|
|
53
|
-
body: [{
|
|
54
|
-
type: 'sidebar-menu-item',
|
|
55
|
-
body: [{
|
|
56
|
-
type: 'sidebar-menu-button',
|
|
57
|
-
size: 'lg',
|
|
58
|
-
body: [
|
|
59
|
-
{
|
|
60
|
-
type: 'div',
|
|
61
|
-
className: 'flex aspect-square size-8 items-center justify-center rounded-lg bg-primary text-primary-foreground',
|
|
62
|
-
children: [{ type: 'icon', name: 'flower-2', className: 'size-4' }]
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: 'div',
|
|
66
|
-
className: 'grid flex-1 text-left text-sm leading-tight',
|
|
67
|
-
children: [
|
|
68
|
-
{ type: 'span', className: 'truncate font-semibold', children: [{ type: 'text', content: 'Acme Inc' }] },
|
|
69
|
-
{ type: 'span', className: 'truncate text-xs', children: [{ type: 'text', content: 'Enterprise' }] }
|
|
70
|
-
]
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
}]
|
|
74
|
-
}]
|
|
75
|
-
}
|
|
76
|
-
]
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
type: 'sidebar-content',
|
|
80
|
-
body: [
|
|
81
|
-
{
|
|
82
|
-
type: 'sidebar-group',
|
|
83
|
-
label: 'Platform',
|
|
84
|
-
body: [
|
|
85
|
-
sidebarMenu([
|
|
86
|
-
{ label: 'Playground', icon: 'terminal', active: true },
|
|
87
|
-
{ label: 'Models', icon: 'bot' },
|
|
88
|
-
{ label: 'Documentation', icon: 'book-open' },
|
|
89
|
-
{ label: 'Settings', icon: 'settings-2' }
|
|
90
|
-
])
|
|
91
|
-
]
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
type: 'sidebar-group',
|
|
95
|
-
label: 'Projects',
|
|
96
|
-
body: [
|
|
97
|
-
sidebarMenu([
|
|
98
|
-
{ label: 'Design Engineering', icon: 'frame' },
|
|
99
|
-
{ label: 'Sales & Marketing', icon: 'pie-chart' },
|
|
100
|
-
{ label: 'Travel', icon: 'map' }
|
|
101
|
-
])
|
|
102
|
-
]
|
|
103
|
-
}
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
type: 'sidebar-footer',
|
|
108
|
-
body: [
|
|
109
|
-
sidebarMenu([
|
|
110
|
-
{ label: 'User Account', icon: 'user' }
|
|
111
|
-
])
|
|
112
|
-
]
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
type: 'sidebar-inset',
|
|
118
|
-
body: [
|
|
119
|
-
{
|
|
120
|
-
type: 'header-bar',
|
|
121
|
-
crumbs: [
|
|
122
|
-
{ label: 'Building Your Application', href: '#' },
|
|
123
|
-
{ label: 'Data Fetching' }
|
|
124
|
-
]
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
type: 'div',
|
|
128
|
-
className: 'flex flex-1 flex-col gap-4 p-4 pt-0',
|
|
129
|
-
children: [
|
|
130
|
-
{
|
|
131
|
-
type: 'div',
|
|
132
|
-
className: 'grid auto-rows-min gap-4 md:grid-cols-3',
|
|
133
|
-
children: [
|
|
134
|
-
{ type: 'div', className: 'aspect-video rounded-xl bg-muted/50' },
|
|
135
|
-
{ type: 'div', className: 'aspect-video rounded-xl bg-muted/50' },
|
|
136
|
-
{ type: 'div', className: 'aspect-video rounded-xl bg-muted/50' }
|
|
137
|
-
]
|
|
138
|
-
},
|
|
139
|
-
{ type: 'div', className: 'min-h-[100vh] flex-1 rounded-xl bg-muted/50' }
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
]
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
},
|
|
146
|
-
render: (args) => <SchemaRenderer schema={args} />
|
|
147
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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 Display/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
|
-
};
|
|
@@ -1,51 +0,0 @@
|
|
|
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/Navigation/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
|
-
};
|
|
@@ -1,188 +0,0 @@
|
|
|
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 Display/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
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
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/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
|
-
};
|
|
@@ -1,101 +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
|
-
/**
|
|
10
|
-
* Schema-driven config panel type definitions.
|
|
11
|
-
*
|
|
12
|
-
* Each concrete panel (View, Dashboard, Page…) provides a ConfigPanelSchema,
|
|
13
|
-
* and ConfigPanelRenderer auto-generates the UI.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/** Supported control types for config fields */
|
|
17
|
-
export type ControlType =
|
|
18
|
-
| 'input'
|
|
19
|
-
| 'switch'
|
|
20
|
-
| 'select'
|
|
21
|
-
| 'checkbox'
|
|
22
|
-
| 'slider'
|
|
23
|
-
| 'color'
|
|
24
|
-
| 'field-picker'
|
|
25
|
-
| 'filter'
|
|
26
|
-
| 'sort'
|
|
27
|
-
| 'icon-group'
|
|
28
|
-
| 'summary'
|
|
29
|
-
| 'custom';
|
|
30
|
-
|
|
31
|
-
/** A single field within a config section */
|
|
32
|
-
export interface ConfigField {
|
|
33
|
-
/** Field key in the draft object */
|
|
34
|
-
key: string;
|
|
35
|
-
/** Display label (may be an i18n key) */
|
|
36
|
-
label: string;
|
|
37
|
-
/** Control type determining which widget to render */
|
|
38
|
-
type: ControlType;
|
|
39
|
-
/** Default value for the field */
|
|
40
|
-
defaultValue?: any;
|
|
41
|
-
/** Select/icon-group options */
|
|
42
|
-
options?: Array<{ value: string; label: string; icon?: React.ReactNode }>;
|
|
43
|
-
/** Visibility predicate evaluated against the current draft */
|
|
44
|
-
visibleWhen?: (draft: Record<string, any>) => boolean;
|
|
45
|
-
/** Disabled predicate evaluated against the current draft */
|
|
46
|
-
disabledWhen?: (draft: Record<string, any>) => boolean;
|
|
47
|
-
/** Custom render function for type='custom' */
|
|
48
|
-
render?: (
|
|
49
|
-
value: any,
|
|
50
|
-
onChange: (v: any) => void,
|
|
51
|
-
draft: Record<string, any>,
|
|
52
|
-
) => React.ReactNode;
|
|
53
|
-
/** Placeholder text for input/select controls */
|
|
54
|
-
placeholder?: string;
|
|
55
|
-
/** Help text displayed below the control */
|
|
56
|
-
helpText?: string;
|
|
57
|
-
/** Minimum value for slider */
|
|
58
|
-
min?: number;
|
|
59
|
-
/** Maximum value for slider */
|
|
60
|
-
max?: number;
|
|
61
|
-
/** Step value for slider */
|
|
62
|
-
step?: number;
|
|
63
|
-
/** Whether the field is disabled */
|
|
64
|
-
disabled?: boolean;
|
|
65
|
-
/** Field definitions for filter/sort sub-editors */
|
|
66
|
-
fields?: Array<{ value: string; label: string; type?: string; options?: Array<{ value: string; label: string }> }>;
|
|
67
|
-
/** Summary display text for type='summary' */
|
|
68
|
-
summaryText?: string;
|
|
69
|
-
/** Click handler for the summary gear/action button (type='summary') */
|
|
70
|
-
onSummaryClick?: () => void;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/** A group of related config fields */
|
|
74
|
-
export interface ConfigSection {
|
|
75
|
-
/** Unique section key (used for collapse state tracking) */
|
|
76
|
-
key: string;
|
|
77
|
-
/** Section title (may be an i18n key) */
|
|
78
|
-
title: string;
|
|
79
|
-
/** Hint text displayed below the title */
|
|
80
|
-
hint?: string;
|
|
81
|
-
/** Icon displayed before the section title (e.g. a Lucide icon element) */
|
|
82
|
-
icon?: React.ReactNode;
|
|
83
|
-
/** Whether this section supports collapse/expand */
|
|
84
|
-
collapsible?: boolean;
|
|
85
|
-
/** Default collapsed state */
|
|
86
|
-
defaultCollapsed?: boolean;
|
|
87
|
-
/** Fields belonging to this section */
|
|
88
|
-
fields: ConfigField[];
|
|
89
|
-
/** Nested sub-sections for complex grouping */
|
|
90
|
-
subsections?: ConfigSection[];
|
|
91
|
-
/** Visibility predicate evaluated against the current draft */
|
|
92
|
-
visibleWhen?: (draft: Record<string, any>) => boolean;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/** Top-level schema describing an entire config panel */
|
|
96
|
-
export interface ConfigPanelSchema {
|
|
97
|
-
/** Breadcrumb segments displayed in the panel header */
|
|
98
|
-
breadcrumb: string[];
|
|
99
|
-
/** Ordered list of sections */
|
|
100
|
-
sections: ConfigSection[];
|
|
101
|
-
}
|
package/src/ui/accordion.tsx
DELETED
|
@@ -1,66 +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
|
-
"use client"
|
|
10
|
-
|
|
11
|
-
import * as React from "react"
|
|
12
|
-
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
13
|
-
import { ChevronDown } from "lucide-react"
|
|
14
|
-
|
|
15
|
-
import { cn } from "../lib/utils"
|
|
16
|
-
|
|
17
|
-
const Accordion = AccordionPrimitive.Root
|
|
18
|
-
|
|
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"
|
|
30
|
-
|
|
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
|
-
)}
|
|
42
|
-
{...props}
|
|
43
|
-
>
|
|
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
|
|
65
|
-
|
|
66
|
-
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
|