@actuate-media/cms-admin 0.10.0 → 0.11.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/dist/AdminRoot.d.ts.map +1 -1
- package/dist/AdminRoot.js +8 -5
- package/dist/AdminRoot.js.map +1 -1
- package/dist/__tests__/layout/primitives.test.d.ts +2 -0
- package/dist/__tests__/layout/primitives.test.d.ts.map +1 -0
- package/dist/__tests__/layout/primitives.test.js +34 -0
- package/dist/__tests__/layout/primitives.test.js.map +1 -0
- package/dist/__tests__/lib/cv.test.d.ts +2 -0
- package/dist/__tests__/lib/cv.test.d.ts.map +1 -0
- package/dist/__tests__/lib/cv.test.js +66 -0
- package/dist/__tests__/lib/cv.test.js.map +1 -0
- package/dist/actuate-admin.css +1 -1
- package/dist/assets/actuate-logo.d.ts +36 -0
- package/dist/assets/actuate-logo.d.ts.map +1 -0
- package/dist/assets/actuate-logo.js +15 -0
- package/dist/assets/actuate-logo.js.map +1 -0
- package/dist/components/Breadcrumbs.js +2 -2
- package/dist/components/CommandPalette.js +10 -10
- package/dist/components/ContentOverviewChart.js +3 -3
- package/dist/components/ErrorBoundary.js +1 -1
- package/dist/components/FocalPointPicker.js +2 -2
- package/dist/components/FolderTree.js +20 -20
- package/dist/components/LivePreview.js +3 -3
- package/dist/components/LocaleSwitcher.js +1 -1
- package/dist/components/MediaPickerModal.js +4 -4
- package/dist/components/PresenceIndicator.js +1 -1
- package/dist/components/SEOConfigPanel.d.ts +2 -0
- package/dist/components/SEOConfigPanel.d.ts.map +1 -0
- package/dist/components/SEOConfigPanel.js +174 -0
- package/dist/components/SEOConfigPanel.js.map +1 -0
- package/dist/components/SEOPanel.js +9 -9
- package/dist/components/SEOPerformance.js +2 -2
- package/dist/components/SchedulePublishDialog.js +1 -1
- package/dist/components/SharePreviewLinkDialog.js +1 -1
- package/dist/components/TipTapEditor.js +5 -5
- package/dist/components/VersionHistory.js +2 -2
- package/dist/components/ui/Badge.d.ts +33 -3
- package/dist/components/ui/Badge.d.ts.map +1 -1
- package/dist/components/ui/Badge.js +42 -8
- package/dist/components/ui/Badge.js.map +1 -1
- package/dist/components/ui/Button.d.ts +19 -8
- package/dist/components/ui/Button.d.ts.map +1 -1
- package/dist/components/ui/Button.js +35 -14
- package/dist/components/ui/Button.js.map +1 -1
- package/dist/components/ui/Card.d.ts +26 -0
- package/dist/components/ui/Card.d.ts.map +1 -0
- package/dist/components/ui/Card.js +45 -0
- package/dist/components/ui/Card.js.map +1 -0
- package/dist/components/ui/DataTable.js +1 -1
- package/dist/components/ui/Input.d.ts +15 -0
- package/dist/components/ui/Input.d.ts.map +1 -0
- package/dist/components/ui/Input.js +23 -0
- package/dist/components/ui/Input.js.map +1 -0
- package/dist/components/ui/SearchInput.js +1 -1
- package/dist/components/ui/Select.d.ts +16 -0
- package/dist/components/ui/Select.d.ts.map +1 -0
- package/dist/components/ui/Select.js +25 -0
- package/dist/components/ui/Select.js.map +1 -0
- package/dist/components/ui/Toast.js +1 -1
- package/dist/components/ui/index.d.ts +10 -4
- package/dist/components/ui/index.d.ts.map +1 -1
- package/dist/components/ui/index.js +5 -2
- package/dist/components/ui/index.js.map +1 -1
- package/dist/fields/BlockBuilderField.js +3 -3
- package/dist/fields/DateField.js +1 -1
- package/dist/fields/RelationshipField.js +3 -3
- package/dist/fields/TextField.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/layout/Header.js +1 -1
- package/dist/layout/Layout.d.ts +14 -0
- package/dist/layout/Layout.d.ts.map +1 -1
- package/dist/layout/Layout.js +17 -11
- package/dist/layout/Layout.js.map +1 -1
- package/dist/layout/Sidebar.d.ts.map +1 -1
- package/dist/layout/Sidebar.js +21 -11
- package/dist/layout/Sidebar.js.map +1 -1
- package/dist/layout/primitives/AdminShell.d.ts +43 -0
- package/dist/layout/primitives/AdminShell.d.ts.map +1 -0
- package/dist/layout/primitives/AdminShell.js +51 -0
- package/dist/layout/primitives/AdminShell.js.map +1 -0
- package/dist/layout/primitives/Box.d.ts +19 -0
- package/dist/layout/primitives/Box.d.ts.map +1 -0
- package/dist/layout/primitives/Box.js +12 -0
- package/dist/layout/primitives/Box.js.map +1 -0
- package/dist/layout/primitives/Cluster.d.ts +27 -0
- package/dist/layout/primitives/Cluster.d.ts.map +1 -0
- package/dist/layout/primitives/Cluster.js +37 -0
- package/dist/layout/primitives/Cluster.js.map +1 -0
- package/dist/layout/primitives/Grid.d.ts +45 -0
- package/dist/layout/primitives/Grid.d.ts.map +1 -0
- package/dist/layout/primitives/Grid.js +59 -0
- package/dist/layout/primitives/Grid.js.map +1 -0
- package/dist/layout/primitives/PageContainer.d.ts +36 -0
- package/dist/layout/primitives/PageContainer.d.ts.map +1 -0
- package/dist/layout/primitives/PageContainer.js +41 -0
- package/dist/layout/primitives/PageContainer.js.map +1 -0
- package/dist/layout/primitives/Split.d.ts +34 -0
- package/dist/layout/primitives/Split.d.ts.map +1 -0
- package/dist/layout/primitives/Split.js +27 -0
- package/dist/layout/primitives/Split.js.map +1 -0
- package/dist/layout/primitives/Stack.d.ts +23 -0
- package/dist/layout/primitives/Stack.d.ts.map +1 -0
- package/dist/layout/primitives/Stack.js +34 -0
- package/dist/layout/primitives/Stack.js.map +1 -0
- package/dist/layout/primitives/index.d.ts +30 -0
- package/dist/layout/primitives/index.d.ts.map +1 -0
- package/dist/layout/primitives/index.js +22 -0
- package/dist/layout/primitives/index.js.map +1 -0
- package/dist/layout/primitives/tokens.d.ts +48 -0
- package/dist/layout/primitives/tokens.d.ts.map +1 -0
- package/dist/layout/primitives/tokens.js +54 -0
- package/dist/layout/primitives/tokens.js.map +1 -0
- package/dist/lib/cv.d.ts +53 -0
- package/dist/lib/cv.d.ts.map +1 -0
- package/dist/lib/cv.js +39 -0
- package/dist/lib/cv.js.map +1 -0
- package/dist/views/ApiKeys.js +7 -7
- package/dist/views/CollectionList.js +8 -8
- package/dist/views/Dashboard.d.ts.map +1 -1
- package/dist/views/Dashboard.js +333 -78
- package/dist/views/Dashboard.js.map +1 -1
- package/dist/views/DocumentEdit.js +3 -3
- package/dist/views/ForgotPassword.js +2 -2
- package/dist/views/FormEditor.js +5 -5
- package/dist/views/FormSubmissions.js +6 -6
- package/dist/views/Forms.js +2 -2
- package/dist/views/Login.d.ts +16 -1
- package/dist/views/Login.d.ts.map +1 -1
- package/dist/views/Login.js +17 -7
- package/dist/views/Login.js.map +1 -1
- package/dist/views/MediaBrowser.js +16 -16
- package/dist/views/PageEditor.js +2 -2
- package/dist/views/Pages.js +10 -10
- package/dist/views/PostEditor.js +2 -2
- package/dist/views/Posts.js +4 -4
- package/dist/views/Redirects.js +4 -4
- package/dist/views/ResetPassword.js +2 -2
- package/dist/views/SEO.js +6 -6
- package/dist/views/ScriptTagEditor.js +4 -4
- package/dist/views/ScriptTags.js +2 -2
- package/dist/views/Settings.d.ts.map +1 -1
- package/dist/views/Settings.js +9 -8
- package/dist/views/Settings.js.map +1 -1
- package/dist/views/SetupWizard.js +2 -2
- package/dist/views/Users.js +4 -4
- package/dist/views/page-builder/AIBlockAssist.js +1 -1
- package/dist/views/page-builder/AIGenerateDialog.js +10 -10
- package/dist/views/page-builder/BlockEditor.js +10 -10
- package/dist/views/page-builder/BlockPicker.js +4 -4
- package/dist/views/page-builder/BottomBar.js +1 -1
- package/dist/views/page-builder/BuilderToolbar.js +2 -2
- package/dist/views/page-builder/ContextPanel.js +2 -2
- package/dist/views/page-builder/DesignScore.js +9 -9
- package/dist/views/page-builder/NodeSettings.js +8 -8
- package/dist/views/page-builder/PageBuilder.js +3 -3
- package/dist/views/page-builder/PageSettings.js +1 -1
- package/dist/views/page-builder/PageTemplates.js +2 -2
- package/dist/views/page-builder/SEOPanel.js +13 -13
- package/dist/views/page-builder/SavedSections.js +5 -5
- package/dist/views/page-builder/TemplatePicker.js +2 -2
- package/dist/views/page-builder/block-renderers/CTAPreview.js +5 -5
- package/dist/views/page-builder/block-renderers/CardsPreview.js +1 -1
- package/dist/views/page-builder/block-renderers/CodePreview.js +1 -1
- package/dist/views/page-builder/block-renderers/FAQPreview.js +3 -3
- package/dist/views/page-builder/block-renderers/FallbackPreview.js +1 -1
- package/dist/views/page-builder/block-renderers/FormPreview.js +3 -3
- package/dist/views/page-builder/block-renderers/GalleryPreview.js +5 -5
- package/dist/views/page-builder/block-renderers/HeroPreview.js +3 -3
- package/dist/views/page-builder/block-renderers/ImagePreview.js +3 -3
- package/dist/views/page-builder/block-renderers/TextPreview.js +3 -3
- package/dist/views/page-builder/block-renderers/VideoPreview.js +4 -4
- package/dist/views/page-builder/canvas/BlockRenderer.js +1 -1
- package/dist/views/page-builder/canvas/BuilderCanvas.js +3 -3
- package/dist/views/page-builder/canvas/ColumnRenderer.js +2 -2
- package/dist/views/page-builder/canvas/ContainerRenderer.js +2 -2
- package/dist/views/page-builder/canvas/RowRenderer.js +2 -2
- package/dist/views/page-builder/canvas/SectionRenderer.js +2 -2
- package/package.json +6 -2
- package/src/AdminRoot.tsx +21 -11
- package/src/__tests__/layout/primitives.test.ts +37 -0
- package/src/__tests__/lib/cv.test.ts +74 -0
- package/src/assets/actuate-logo.tsx +72 -0
- package/src/components/Breadcrumbs.tsx +6 -6
- package/src/components/CommandPalette.tsx +34 -34
- package/src/components/ContentOverviewChart.tsx +3 -3
- package/src/components/ErrorBoundary.tsx +3 -3
- package/src/components/FocalPointPicker.tsx +4 -4
- package/src/components/FolderTree.tsx +38 -38
- package/src/components/LivePreview.tsx +16 -16
- package/src/components/LocaleSwitcher.tsx +7 -7
- package/src/components/MediaPickerModal.tsx +21 -21
- package/src/components/PresenceIndicator.tsx +2 -2
- package/src/components/SEOConfigPanel.tsx +582 -0
- package/src/components/SEOPanel.tsx +46 -46
- package/src/components/SEOPerformance.tsx +21 -21
- package/src/components/SchedulePublishDialog.tsx +4 -4
- package/src/components/SharePreviewLinkDialog.tsx +1 -1
- package/src/components/TipTapEditor.tsx +33 -33
- package/src/components/VersionHistory.tsx +16 -16
- package/src/components/ui/Badge.tsx +66 -14
- package/src/components/ui/Button.tsx +70 -33
- package/src/components/ui/Card.tsx +101 -0
- package/src/components/ui/DataTable.tsx +1 -1
- package/src/components/ui/Input.tsx +35 -0
- package/src/components/ui/SearchInput.tsx +4 -4
- package/src/components/ui/Select.tsx +56 -0
- package/src/components/ui/Toast.tsx +1 -1
- package/src/components/ui/index.ts +18 -4
- package/src/fields/BlockBuilderField.tsx +3 -3
- package/src/fields/DateField.tsx +1 -1
- package/src/fields/RelationshipField.tsx +10 -10
- package/src/fields/TextField.tsx +1 -1
- package/src/index.ts +28 -0
- package/src/layout/Header.tsx +28 -28
- package/src/layout/Layout.tsx +39 -46
- package/src/layout/Sidebar.tsx +37 -64
- package/src/layout/primitives/AdminShell.tsx +118 -0
- package/src/layout/primitives/Box.tsx +30 -0
- package/src/layout/primitives/Cluster.tsx +74 -0
- package/src/layout/primitives/Grid.tsx +120 -0
- package/src/layout/primitives/PageContainer.tsx +96 -0
- package/src/layout/primitives/Split.tsx +73 -0
- package/src/layout/primitives/Stack.tsx +67 -0
- package/src/layout/primitives/index.ts +36 -0
- package/src/layout/primitives/tokens.ts +76 -0
- package/src/lib/cv.ts +96 -0
- package/src/styles/build-input.css +1 -1
- package/src/views/ApiKeys.tsx +57 -57
- package/src/views/CollectionList.tsx +30 -30
- package/src/views/Dashboard.tsx +737 -186
- package/src/views/DocumentEdit.tsx +9 -9
- package/src/views/ForgotPassword.tsx +18 -18
- package/src/views/FormEditor.tsx +75 -75
- package/src/views/FormSubmissions.tsx +76 -76
- package/src/views/Forms.tsx +27 -27
- package/src/views/Login.tsx +65 -25
- package/src/views/MediaBrowser.tsx +127 -127
- package/src/views/PageEditor.tsx +25 -25
- package/src/views/Pages.tsx +59 -59
- package/src/views/PostEditor.tsx +37 -37
- package/src/views/Posts.tsx +48 -48
- package/src/views/Redirects.tsx +21 -21
- package/src/views/ResetPassword.tsx +28 -28
- package/src/views/SEO.tsx +144 -144
- package/src/views/ScriptTagEditor.tsx +24 -24
- package/src/views/ScriptTags.tsx +10 -10
- package/src/views/Settings.tsx +88 -80
- package/src/views/SetupWizard.tsx +28 -28
- package/src/views/Users.tsx +20 -20
- package/src/views/page-builder/AIBlockAssist.tsx +1 -1
- package/src/views/page-builder/AIGenerateDialog.tsx +63 -63
- package/src/views/page-builder/BlockEditor.tsx +26 -26
- package/src/views/page-builder/BlockPicker.tsx +22 -22
- package/src/views/page-builder/BottomBar.tsx +8 -8
- package/src/views/page-builder/BuilderToolbar.tsx +17 -17
- package/src/views/page-builder/ContextPanel.tsx +3 -3
- package/src/views/page-builder/DesignScore.tsx +21 -21
- package/src/views/page-builder/NodeSettings.tsx +27 -27
- package/src/views/page-builder/PageBuilder.tsx +11 -11
- package/src/views/page-builder/PageSettings.tsx +4 -4
- package/src/views/page-builder/PageTemplates.tsx +18 -18
- package/src/views/page-builder/SEOPanel.tsx +53 -53
- package/src/views/page-builder/SavedSections.tsx +37 -37
- package/src/views/page-builder/TemplatePicker.tsx +17 -17
- package/src/views/page-builder/block-renderers/CTAPreview.tsx +13 -13
- package/src/views/page-builder/block-renderers/CardsPreview.tsx +5 -5
- package/src/views/page-builder/block-renderers/CodePreview.tsx +6 -6
- package/src/views/page-builder/block-renderers/FAQPreview.tsx +13 -13
- package/src/views/page-builder/block-renderers/FallbackPreview.tsx +3 -3
- package/src/views/page-builder/block-renderers/FormPreview.tsx +20 -20
- package/src/views/page-builder/block-renderers/GalleryPreview.tsx +8 -8
- package/src/views/page-builder/block-renderers/HeroPreview.tsx +16 -16
- package/src/views/page-builder/block-renderers/ImagePreview.tsx +4 -4
- package/src/views/page-builder/block-renderers/TextPreview.tsx +14 -14
- package/src/views/page-builder/block-renderers/VideoPreview.tsx +12 -12
- package/src/views/page-builder/canvas/BlockRenderer.tsx +4 -4
- package/src/views/page-builder/canvas/BuilderCanvas.tsx +6 -6
- package/src/views/page-builder/canvas/ColumnRenderer.tsx +3 -3
- package/src/views/page-builder/canvas/ContainerRenderer.tsx +2 -2
- package/src/views/page-builder/canvas/RowRenderer.tsx +2 -2
- package/src/views/page-builder/canvas/SectionRenderer.tsx +2 -2
|
@@ -152,11 +152,11 @@ function ToolbarButton({
|
|
|
152
152
|
onClick={onClick}
|
|
153
153
|
disabled={disabled}
|
|
154
154
|
title={title}
|
|
155
|
-
className={`p-1.5
|
|
155
|
+
className={`rounded p-1.5 transition-colors ${
|
|
156
156
|
isActive
|
|
157
157
|
? 'bg-blue-100 text-blue-700'
|
|
158
158
|
: 'text-gray-600 hover:bg-gray-100 hover:text-gray-900'
|
|
159
|
-
} ${disabled ? '
|
|
159
|
+
} ${disabled ? 'cursor-not-allowed opacity-40' : ''}`}
|
|
160
160
|
>
|
|
161
161
|
{children}
|
|
162
162
|
</button>
|
|
@@ -164,7 +164,7 @@ function ToolbarButton({
|
|
|
164
164
|
}
|
|
165
165
|
|
|
166
166
|
function Divider() {
|
|
167
|
-
return <div className="
|
|
167
|
+
return <div className="mx-1 h-6 w-px bg-gray-200" />
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPicker: () => void }) {
|
|
@@ -186,42 +186,42 @@ function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPic
|
|
|
186
186
|
const isInTable = editor.isActive('table')
|
|
187
187
|
|
|
188
188
|
return (
|
|
189
|
-
<div className="
|
|
189
|
+
<div className="sticky top-0 z-10 flex flex-wrap items-center gap-0.5 border-b border-gray-200 bg-gray-50 p-2">
|
|
190
190
|
{/* Group 1: Text formatting */}
|
|
191
191
|
<ToolbarButton
|
|
192
192
|
onClick={() => editor.chain().focus().toggleBold().run()}
|
|
193
193
|
isActive={editor.isActive('bold')}
|
|
194
194
|
title="Bold (Ctrl+B)"
|
|
195
195
|
>
|
|
196
|
-
<Bold className="
|
|
196
|
+
<Bold className="h-4 w-4" />
|
|
197
197
|
</ToolbarButton>
|
|
198
198
|
<ToolbarButton
|
|
199
199
|
onClick={() => editor.chain().focus().toggleItalic().run()}
|
|
200
200
|
isActive={editor.isActive('italic')}
|
|
201
201
|
title="Italic (Ctrl+I)"
|
|
202
202
|
>
|
|
203
|
-
<Italic className="
|
|
203
|
+
<Italic className="h-4 w-4" />
|
|
204
204
|
</ToolbarButton>
|
|
205
205
|
<ToolbarButton
|
|
206
206
|
onClick={() => editor.chain().focus().toggleUnderline().run()}
|
|
207
207
|
isActive={editor.isActive('underline')}
|
|
208
208
|
title="Underline (Ctrl+U)"
|
|
209
209
|
>
|
|
210
|
-
<Underline className="
|
|
210
|
+
<Underline className="h-4 w-4" />
|
|
211
211
|
</ToolbarButton>
|
|
212
212
|
<ToolbarButton
|
|
213
213
|
onClick={() => editor.chain().focus().toggleStrike().run()}
|
|
214
214
|
isActive={editor.isActive('strike')}
|
|
215
215
|
title="Strikethrough"
|
|
216
216
|
>
|
|
217
|
-
<Strikethrough className="
|
|
217
|
+
<Strikethrough className="h-4 w-4" />
|
|
218
218
|
</ToolbarButton>
|
|
219
219
|
<ToolbarButton
|
|
220
220
|
onClick={() => editor.chain().focus().toggleCode().run()}
|
|
221
221
|
isActive={editor.isActive('code')}
|
|
222
222
|
title="Inline code"
|
|
223
223
|
>
|
|
224
|
-
<Code className="
|
|
224
|
+
<Code className="h-4 w-4" />
|
|
225
225
|
</ToolbarButton>
|
|
226
226
|
|
|
227
227
|
<Divider />
|
|
@@ -232,21 +232,21 @@ function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPic
|
|
|
232
232
|
isActive={editor.isActive('heading', { level: 1 })}
|
|
233
233
|
title="Heading 1"
|
|
234
234
|
>
|
|
235
|
-
<Heading1 className="
|
|
235
|
+
<Heading1 className="h-4 w-4" />
|
|
236
236
|
</ToolbarButton>
|
|
237
237
|
<ToolbarButton
|
|
238
238
|
onClick={() => editor.chain().focus().toggleHeading({ level: 2 }).run()}
|
|
239
239
|
isActive={editor.isActive('heading', { level: 2 })}
|
|
240
240
|
title="Heading 2"
|
|
241
241
|
>
|
|
242
|
-
<Heading2 className="
|
|
242
|
+
<Heading2 className="h-4 w-4" />
|
|
243
243
|
</ToolbarButton>
|
|
244
244
|
<ToolbarButton
|
|
245
245
|
onClick={() => editor.chain().focus().toggleHeading({ level: 3 }).run()}
|
|
246
246
|
isActive={editor.isActive('heading', { level: 3 })}
|
|
247
247
|
title="Heading 3"
|
|
248
248
|
>
|
|
249
|
-
<Heading3 className="
|
|
249
|
+
<Heading3 className="h-4 w-4" />
|
|
250
250
|
</ToolbarButton>
|
|
251
251
|
|
|
252
252
|
<Divider />
|
|
@@ -257,34 +257,34 @@ function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPic
|
|
|
257
257
|
isActive={editor.isActive('bulletList')}
|
|
258
258
|
title="Bullet list"
|
|
259
259
|
>
|
|
260
|
-
<List className="
|
|
260
|
+
<List className="h-4 w-4" />
|
|
261
261
|
</ToolbarButton>
|
|
262
262
|
<ToolbarButton
|
|
263
263
|
onClick={() => editor.chain().focus().toggleOrderedList().run()}
|
|
264
264
|
isActive={editor.isActive('orderedList')}
|
|
265
265
|
title="Ordered list"
|
|
266
266
|
>
|
|
267
|
-
<ListOrdered className="
|
|
267
|
+
<ListOrdered className="h-4 w-4" />
|
|
268
268
|
</ToolbarButton>
|
|
269
269
|
<ToolbarButton
|
|
270
270
|
onClick={() => editor.chain().focus().toggleBlockquote().run()}
|
|
271
271
|
isActive={editor.isActive('blockquote')}
|
|
272
272
|
title="Blockquote"
|
|
273
273
|
>
|
|
274
|
-
<Quote className="
|
|
274
|
+
<Quote className="h-4 w-4" />
|
|
275
275
|
</ToolbarButton>
|
|
276
276
|
<ToolbarButton
|
|
277
277
|
onClick={() => editor.chain().focus().toggleCodeBlock().run()}
|
|
278
278
|
isActive={editor.isActive('codeBlock')}
|
|
279
279
|
title="Code block"
|
|
280
280
|
>
|
|
281
|
-
<FileCode className="
|
|
281
|
+
<FileCode className="h-4 w-4" />
|
|
282
282
|
</ToolbarButton>
|
|
283
283
|
<ToolbarButton
|
|
284
284
|
onClick={() => editor.chain().focus().setHorizontalRule().run()}
|
|
285
285
|
title="Horizontal rule"
|
|
286
286
|
>
|
|
287
|
-
<Minus className="
|
|
287
|
+
<Minus className="h-4 w-4" />
|
|
288
288
|
</ToolbarButton>
|
|
289
289
|
|
|
290
290
|
<Divider />
|
|
@@ -295,34 +295,34 @@ function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPic
|
|
|
295
295
|
isActive={editor.isActive({ textAlign: 'left' })}
|
|
296
296
|
title="Align left"
|
|
297
297
|
>
|
|
298
|
-
<AlignLeft className="
|
|
298
|
+
<AlignLeft className="h-4 w-4" />
|
|
299
299
|
</ToolbarButton>
|
|
300
300
|
<ToolbarButton
|
|
301
301
|
onClick={() => editor.chain().focus().setTextAlign('center').run()}
|
|
302
302
|
isActive={editor.isActive({ textAlign: 'center' })}
|
|
303
303
|
title="Align center"
|
|
304
304
|
>
|
|
305
|
-
<AlignCenter className="
|
|
305
|
+
<AlignCenter className="h-4 w-4" />
|
|
306
306
|
</ToolbarButton>
|
|
307
307
|
<ToolbarButton
|
|
308
308
|
onClick={() => editor.chain().focus().setTextAlign('right').run()}
|
|
309
309
|
isActive={editor.isActive({ textAlign: 'right' })}
|
|
310
310
|
title="Align right"
|
|
311
311
|
>
|
|
312
|
-
<AlignRight className="
|
|
312
|
+
<AlignRight className="h-4 w-4" />
|
|
313
313
|
</ToolbarButton>
|
|
314
314
|
|
|
315
315
|
<Divider />
|
|
316
316
|
|
|
317
317
|
{/* Group 5: Insert */}
|
|
318
318
|
<ToolbarButton onClick={addLink} isActive={editor.isActive('link')} title="Insert link">
|
|
319
|
-
<LinkIcon className="
|
|
319
|
+
<LinkIcon className="h-4 w-4" />
|
|
320
320
|
</ToolbarButton>
|
|
321
321
|
<ToolbarButton onClick={onOpenMediaPicker} title="Insert image">
|
|
322
|
-
<ImageIcon className="
|
|
322
|
+
<ImageIcon className="h-4 w-4" />
|
|
323
323
|
</ToolbarButton>
|
|
324
324
|
<ToolbarButton onClick={insertTable} title="Insert table (3×3)">
|
|
325
|
-
<TableIcon className="
|
|
325
|
+
<TableIcon className="h-4 w-4" />
|
|
326
326
|
</ToolbarButton>
|
|
327
327
|
|
|
328
328
|
{/* Group 6: Table controls (visible only when cursor is inside a table) */}
|
|
@@ -333,43 +333,43 @@ function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPic
|
|
|
333
333
|
onClick={() => editor.chain().focus().addColumnBefore().run()}
|
|
334
334
|
title="Add column before"
|
|
335
335
|
>
|
|
336
|
-
<Columns className="
|
|
336
|
+
<Columns className="h-4 w-4" />
|
|
337
337
|
</ToolbarButton>
|
|
338
338
|
<ToolbarButton
|
|
339
339
|
onClick={() => editor.chain().focus().addColumnAfter().run()}
|
|
340
340
|
title="Add column after"
|
|
341
341
|
>
|
|
342
|
-
<Columns className="
|
|
342
|
+
<Columns className="h-4 w-4" />
|
|
343
343
|
</ToolbarButton>
|
|
344
344
|
<ToolbarButton
|
|
345
345
|
onClick={() => editor.chain().focus().deleteColumn().run()}
|
|
346
346
|
title="Delete column"
|
|
347
347
|
>
|
|
348
|
-
<Columns className="
|
|
348
|
+
<Columns className="h-4 w-4" />
|
|
349
349
|
</ToolbarButton>
|
|
350
350
|
<ToolbarButton
|
|
351
351
|
onClick={() => editor.chain().focus().addRowBefore().run()}
|
|
352
352
|
title="Add row before"
|
|
353
353
|
>
|
|
354
|
-
<Rows className="
|
|
354
|
+
<Rows className="h-4 w-4" />
|
|
355
355
|
</ToolbarButton>
|
|
356
356
|
<ToolbarButton
|
|
357
357
|
onClick={() => editor.chain().focus().addRowAfter().run()}
|
|
358
358
|
title="Add row after"
|
|
359
359
|
>
|
|
360
|
-
<Rows className="
|
|
360
|
+
<Rows className="h-4 w-4" />
|
|
361
361
|
</ToolbarButton>
|
|
362
362
|
<ToolbarButton
|
|
363
363
|
onClick={() => editor.chain().focus().deleteRow().run()}
|
|
364
364
|
title="Delete row"
|
|
365
365
|
>
|
|
366
|
-
<Rows className="
|
|
366
|
+
<Rows className="h-4 w-4" />
|
|
367
367
|
</ToolbarButton>
|
|
368
368
|
<ToolbarButton
|
|
369
369
|
onClick={() => editor.chain().focus().deleteTable().run()}
|
|
370
370
|
title="Delete table"
|
|
371
371
|
>
|
|
372
|
-
<Trash2 className="
|
|
372
|
+
<Trash2 className="h-4 w-4" />
|
|
373
373
|
</ToolbarButton>
|
|
374
374
|
</>
|
|
375
375
|
)}
|
|
@@ -382,14 +382,14 @@ function Toolbar({ editor, onOpenMediaPicker }: { editor: Editor; onOpenMediaPic
|
|
|
382
382
|
disabled={!editor.can().undo()}
|
|
383
383
|
title="Undo"
|
|
384
384
|
>
|
|
385
|
-
<Undo className="
|
|
385
|
+
<Undo className="h-4 w-4" />
|
|
386
386
|
</ToolbarButton>
|
|
387
387
|
<ToolbarButton
|
|
388
388
|
onClick={() => editor.chain().focus().redo().run()}
|
|
389
389
|
disabled={!editor.can().redo()}
|
|
390
390
|
title="Redo"
|
|
391
391
|
>
|
|
392
|
-
<Redo className="
|
|
392
|
+
<Redo className="h-4 w-4" />
|
|
393
393
|
</ToolbarButton>
|
|
394
394
|
</div>
|
|
395
395
|
)
|
|
@@ -449,7 +449,7 @@ export function TipTapEditor({
|
|
|
449
449
|
|
|
450
450
|
return (
|
|
451
451
|
<div
|
|
452
|
-
className={`border border-gray-200
|
|
452
|
+
className={`overflow-hidden rounded-lg border border-gray-200 bg-white ${className ?? ''}`}
|
|
453
453
|
>
|
|
454
454
|
{editable && <Toolbar editor={editor} onOpenMediaPicker={() => setMediaPickerOpen(true)} />}
|
|
455
455
|
<EditorContent editor={editor} />
|
|
@@ -93,27 +93,27 @@ export function VersionHistory({
|
|
|
93
93
|
return (
|
|
94
94
|
<div className="fixed inset-0 z-50 flex justify-end">
|
|
95
95
|
<div className="fixed inset-0 bg-black/30" onClick={onClose} />
|
|
96
|
-
<div className="relative w-full max-w-md bg-white shadow-xl
|
|
97
|
-
<div className="flex items-center justify-between
|
|
96
|
+
<div className="animate-in slide-in-from-right relative flex w-full max-w-md flex-col bg-white shadow-xl">
|
|
97
|
+
<div className="flex items-center justify-between border-b border-gray-200 px-4 py-3">
|
|
98
98
|
<div className="flex items-center gap-2">
|
|
99
|
-
<Clock className="
|
|
99
|
+
<Clock className="h-5 w-5 text-gray-600" />
|
|
100
100
|
<h2 className="text-lg font-semibold text-gray-900">Version History</h2>
|
|
101
101
|
</div>
|
|
102
102
|
<button
|
|
103
103
|
onClick={onClose}
|
|
104
|
-
className="p-1.5 hover:bg-gray-100
|
|
104
|
+
className="rounded-lg p-1.5 transition-colors hover:bg-gray-100"
|
|
105
105
|
>
|
|
106
|
-
<X className="
|
|
106
|
+
<X className="h-5 w-5 text-gray-500" />
|
|
107
107
|
</button>
|
|
108
108
|
</div>
|
|
109
109
|
|
|
110
110
|
<div className="flex-1 overflow-y-auto">
|
|
111
111
|
{loading ? (
|
|
112
112
|
<div className="flex items-center justify-center py-16">
|
|
113
|
-
<Loader2 className="
|
|
113
|
+
<Loader2 className="h-6 w-6 animate-spin text-gray-400" />
|
|
114
114
|
</div>
|
|
115
115
|
) : versions.length === 0 ? (
|
|
116
|
-
<div className="
|
|
116
|
+
<div className="py-16 text-center text-sm text-gray-500">
|
|
117
117
|
No version history available
|
|
118
118
|
</div>
|
|
119
119
|
) : (
|
|
@@ -126,23 +126,23 @@ export function VersionHistory({
|
|
|
126
126
|
const isLatest = index === 0
|
|
127
127
|
|
|
128
128
|
return (
|
|
129
|
-
<div key={version.id} className="px-4 py-3 hover:bg-gray-50
|
|
129
|
+
<div key={version.id} className="px-4 py-3 transition-colors hover:bg-gray-50">
|
|
130
130
|
<div className="flex items-start justify-between gap-3">
|
|
131
|
-
<div className="
|
|
132
|
-
<div className="flex items-center gap-2
|
|
131
|
+
<div className="min-w-0 flex-1">
|
|
132
|
+
<div className="mb-1 flex items-center gap-2">
|
|
133
133
|
<span
|
|
134
|
-
className={`inline-flex px-2 py-0.5
|
|
134
|
+
className={`inline-flex rounded-full px-2 py-0.5 text-xs font-medium ${typeInfo.color}`}
|
|
135
135
|
>
|
|
136
136
|
{typeInfo.label}
|
|
137
137
|
</span>
|
|
138
138
|
{isLatest && (
|
|
139
|
-
<span className="text-xs text-gray-400
|
|
139
|
+
<span className="text-xs font-medium text-gray-400">Current</span>
|
|
140
140
|
)}
|
|
141
141
|
</div>
|
|
142
142
|
<div className="flex items-center gap-3 text-xs text-gray-500">
|
|
143
143
|
{version.changedBy && (
|
|
144
144
|
<span className="flex items-center gap-1">
|
|
145
|
-
<User className="
|
|
145
|
+
<User className="h-3 w-3" />
|
|
146
146
|
{version.changedBy.name ?? version.changedBy.email ?? 'Unknown'}
|
|
147
147
|
</span>
|
|
148
148
|
)}
|
|
@@ -155,12 +155,12 @@ export function VersionHistory({
|
|
|
155
155
|
<button
|
|
156
156
|
onClick={() => handleRestore(version)}
|
|
157
157
|
disabled={restoring === version.id}
|
|
158
|
-
className="flex items-center gap-1.5 px-2.5 py-1.5 text-xs font-medium text-blue-700
|
|
158
|
+
className="flex items-center gap-1.5 rounded-lg bg-blue-50 px-2.5 py-1.5 text-xs font-medium text-blue-700 transition-colors hover:bg-blue-100 disabled:opacity-50"
|
|
159
159
|
>
|
|
160
160
|
{restoring === version.id ? (
|
|
161
|
-
<Loader2 className="
|
|
161
|
+
<Loader2 className="h-3.5 w-3.5 animate-spin" />
|
|
162
162
|
) : (
|
|
163
|
-
<RotateCcw className="
|
|
163
|
+
<RotateCcw className="h-3.5 w-3.5" />
|
|
164
164
|
)}
|
|
165
165
|
Restore
|
|
166
166
|
</button>
|
|
@@ -1,27 +1,79 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react'
|
|
2
|
+
import { cv, type VariantProps } from '../../lib/cv.js'
|
|
3
|
+
|
|
4
|
+
const badge = cv('inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium', {
|
|
5
|
+
variants: {
|
|
6
|
+
tone: {
|
|
7
|
+
neutral: 'bg-gray-100 text-gray-800 dark:bg-gray-800 dark:text-gray-300',
|
|
8
|
+
success: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400',
|
|
9
|
+
warning: 'bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400',
|
|
10
|
+
danger: 'bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-400',
|
|
11
|
+
info: 'bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400',
|
|
12
|
+
primary: 'bg-[var(--primary)]/15 text-[var(--primary)] dark:bg-[var(--primary)]/25',
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
sm: 'px-2 py-0.5 text-[10px]',
|
|
16
|
+
md: 'px-2.5 py-0.5 text-xs',
|
|
17
|
+
lg: 'px-3 py-1 text-sm',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: { tone: 'neutral', size: 'md' },
|
|
21
|
+
})
|
|
4
22
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
23
|
+
export type BadgeVariants = VariantProps<typeof badge>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Map document statuses to badge tones. Exposed so callers can reuse the
|
|
27
|
+
* mapping (e.g. for the same status rendered as a dot indicator).
|
|
28
|
+
*/
|
|
29
|
+
export const STATUS_TONE: Record<DocumentStatus, BadgeVariants['tone']> = {
|
|
30
|
+
published: 'success',
|
|
31
|
+
draft: 'neutral',
|
|
32
|
+
archived: 'warning',
|
|
33
|
+
scheduled: 'info',
|
|
10
34
|
}
|
|
11
35
|
|
|
12
|
-
const
|
|
36
|
+
export const STATUS_LABEL: Record<DocumentStatus, string> = {
|
|
13
37
|
published: 'Published',
|
|
14
38
|
draft: 'Draft',
|
|
15
39
|
archived: 'Archived',
|
|
16
40
|
scheduled: 'Scheduled',
|
|
17
41
|
}
|
|
18
42
|
|
|
19
|
-
export
|
|
43
|
+
export type DocumentStatus = 'published' | 'draft' | 'archived' | 'scheduled'
|
|
44
|
+
|
|
45
|
+
export interface BadgeProps extends HTMLAttributes<HTMLSpanElement>, BadgeVariants {
|
|
46
|
+
/**
|
|
47
|
+
* Shorthand for the canonical document status badge. When set, takes
|
|
48
|
+
* precedence over `tone` and uses the matching label.
|
|
49
|
+
*/
|
|
50
|
+
status?: DocumentStatus
|
|
51
|
+
/** Render as outlined (border + transparent background). */
|
|
52
|
+
outline?: boolean
|
|
53
|
+
children?: ReactNode
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const OUTLINE_CLASS = 'border border-current bg-transparent'
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Generic typed badge. Pass `status` for the canonical document-status
|
|
60
|
+
* variants (preserves the original Badge API), or `tone` / `outline` /
|
|
61
|
+
* `size` for everything else.
|
|
62
|
+
*/
|
|
63
|
+
export function Badge({ status, tone, outline, size, className, children, ...rest }: BadgeProps) {
|
|
64
|
+
const extras = [outline ? OUTLINE_CLASS : '', className].filter(Boolean).join(' ')
|
|
65
|
+
if (status) {
|
|
66
|
+
return (
|
|
67
|
+
<span className={badge({ tone: STATUS_TONE[status], size, class: extras })} {...rest}>
|
|
68
|
+
{children ?? STATUS_LABEL[status]}
|
|
69
|
+
</span>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
20
72
|
return (
|
|
21
|
-
<span
|
|
22
|
-
|
|
23
|
-
>
|
|
24
|
-
{statusLabels[status]}
|
|
73
|
+
<span className={badge({ tone, size, class: extras })} {...rest}>
|
|
74
|
+
{children}
|
|
25
75
|
</span>
|
|
26
76
|
)
|
|
27
77
|
}
|
|
78
|
+
|
|
79
|
+
export { badge as badgeVariants }
|
|
@@ -1,47 +1,79 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import { type ButtonHTMLAttributes, type ReactNode } from 'react'
|
|
3
|
+
import { forwardRef, type ButtonHTMLAttributes, type ReactNode } from 'react'
|
|
4
|
+
import { cv, type VariantProps } from '../../lib/cv.js'
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
const button = cv(
|
|
7
|
+
// Base classes apply to every variant.
|
|
8
|
+
'focus-visible:ring-offset-background inline-flex items-center justify-center gap-2 rounded-[var(--radius)] font-medium transition-colors focus-visible:ring-2 focus-visible:ring-[var(--ring)] focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50',
|
|
9
|
+
{
|
|
10
|
+
variants: {
|
|
11
|
+
variant: {
|
|
12
|
+
primary: 'bg-[var(--primary)] text-[var(--primary-foreground)] hover:opacity-90',
|
|
13
|
+
secondary: 'bg-[var(--secondary)] text-[var(--secondary-foreground)] hover:opacity-80',
|
|
14
|
+
danger: 'bg-[var(--destructive)] text-[var(--destructive-foreground)] hover:opacity-90',
|
|
15
|
+
ghost: 'bg-transparent text-[var(--foreground)] hover:bg-[var(--accent)]',
|
|
16
|
+
outline:
|
|
17
|
+
'border border-[var(--border)] bg-transparent text-[var(--foreground)] hover:bg-[var(--accent)]',
|
|
18
|
+
link: 'bg-transparent text-[var(--primary)] underline-offset-4 hover:underline',
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
xs: 'h-7 px-2 text-xs',
|
|
22
|
+
sm: 'h-8 px-2.5 text-xs',
|
|
23
|
+
md: 'h-9 px-4 text-sm',
|
|
24
|
+
lg: 'h-10 px-6 text-base',
|
|
25
|
+
icon: 'h-9 w-9 p-0',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
variant: 'primary',
|
|
30
|
+
size: 'md',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
)
|
|
7
34
|
|
|
8
|
-
export
|
|
9
|
-
variant?: ButtonVariant
|
|
10
|
-
size?: ButtonSize
|
|
11
|
-
loading?: boolean
|
|
12
|
-
children: ReactNode
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
const variantClasses: Record<ButtonVariant, string> = {
|
|
16
|
-
primary: 'bg-[var(--primary)] text-[var(--primary-foreground)] hover:opacity-90',
|
|
17
|
-
secondary: 'bg-[var(--secondary)] text-[var(--secondary-foreground)] hover:opacity-80',
|
|
18
|
-
danger: 'bg-[var(--destructive)] text-[var(--destructive-foreground)] hover:opacity-90',
|
|
19
|
-
ghost: 'bg-transparent hover:bg-[var(--accent)] text-[var(--foreground)]',
|
|
20
|
-
}
|
|
35
|
+
export type ButtonVariants = VariantProps<typeof button>
|
|
21
36
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
37
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement>, ButtonVariants {
|
|
38
|
+
loading?: boolean
|
|
39
|
+
/** Stretch the button to fill its container width. */
|
|
40
|
+
full?: boolean
|
|
41
|
+
/** Icon rendered before the children. Use with `size="icon"` for icon-only buttons. */
|
|
42
|
+
leftIcon?: ReactNode
|
|
43
|
+
/** Icon rendered after the children. */
|
|
44
|
+
rightIcon?: ReactNode
|
|
45
|
+
children?: ReactNode
|
|
26
46
|
}
|
|
27
47
|
|
|
28
|
-
export function Button(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
export const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
|
|
49
|
+
{
|
|
50
|
+
variant,
|
|
51
|
+
size,
|
|
52
|
+
full,
|
|
53
|
+
loading = false,
|
|
54
|
+
disabled,
|
|
55
|
+
leftIcon,
|
|
56
|
+
rightIcon,
|
|
57
|
+
children,
|
|
58
|
+
className,
|
|
59
|
+
...rest
|
|
60
|
+
},
|
|
61
|
+
ref,
|
|
62
|
+
) {
|
|
37
63
|
return (
|
|
38
64
|
<button
|
|
65
|
+
ref={ref}
|
|
39
66
|
disabled={disabled || loading}
|
|
40
|
-
|
|
67
|
+
aria-busy={loading || undefined}
|
|
68
|
+
className={button({
|
|
69
|
+
variant,
|
|
70
|
+
size,
|
|
71
|
+
class: [full ? 'w-full' : '', className].filter(Boolean).join(' '),
|
|
72
|
+
})}
|
|
41
73
|
{...rest}
|
|
42
74
|
>
|
|
43
|
-
{loading
|
|
44
|
-
<svg className="h-4 w-4 animate-spin" viewBox="0 0 24 24" fill="none">
|
|
75
|
+
{loading ? (
|
|
76
|
+
<svg className="h-4 w-4 animate-spin" viewBox="0 0 24 24" fill="none" aria-hidden>
|
|
45
77
|
<circle
|
|
46
78
|
className="opacity-25"
|
|
47
79
|
cx="12"
|
|
@@ -56,8 +88,13 @@ export function Button({
|
|
|
56
88
|
d="M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"
|
|
57
89
|
/>
|
|
58
90
|
</svg>
|
|
91
|
+
) : (
|
|
92
|
+
leftIcon
|
|
59
93
|
)}
|
|
60
94
|
{children}
|
|
95
|
+
{!loading && rightIcon}
|
|
61
96
|
</button>
|
|
62
97
|
)
|
|
63
|
-
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
export { button as buttonVariants }
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { forwardRef, type HTMLAttributes, type ReactNode } from 'react'
|
|
2
|
+
import { cv, type VariantProps } from '../../lib/cv.js'
|
|
3
|
+
|
|
4
|
+
const card = cv(
|
|
5
|
+
'rounded-[var(--radius)] border border-[var(--border)] bg-[var(--card)] text-[var(--card-foreground)]',
|
|
6
|
+
{
|
|
7
|
+
variants: {
|
|
8
|
+
padding: {
|
|
9
|
+
none: 'p-0',
|
|
10
|
+
sm: 'p-4',
|
|
11
|
+
md: 'p-6',
|
|
12
|
+
lg: 'p-8',
|
|
13
|
+
},
|
|
14
|
+
elevation: {
|
|
15
|
+
flat: 'shadow-none',
|
|
16
|
+
sm: 'shadow-sm',
|
|
17
|
+
md: 'shadow-md',
|
|
18
|
+
lg: 'shadow-lg',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
defaultVariants: { padding: 'md', elevation: 'sm' },
|
|
22
|
+
},
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
export type CardVariants = VariantProps<typeof card>
|
|
26
|
+
|
|
27
|
+
const INTERACTIVE_CLASS = 'transition-shadow hover:shadow-md focus-within:shadow-md'
|
|
28
|
+
|
|
29
|
+
export interface CardProps extends HTMLAttributes<HTMLDivElement>, CardVariants {
|
|
30
|
+
/** Apply hover/focus elevation transitions (e.g. for clickable cards). */
|
|
31
|
+
interactive?: boolean
|
|
32
|
+
children?: ReactNode
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const Card = forwardRef<HTMLDivElement, CardProps>(function Card(
|
|
36
|
+
{ padding, elevation, interactive, className, children, ...rest },
|
|
37
|
+
ref,
|
|
38
|
+
) {
|
|
39
|
+
const extras = [interactive ? INTERACTIVE_CLASS : '', className].filter(Boolean).join(' ')
|
|
40
|
+
return (
|
|
41
|
+
<div ref={ref} className={card({ padding, elevation, class: extras })} {...rest}>
|
|
42
|
+
{children}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Header slot — sits at the top of a card. Pair with CardTitle / CardDescription.
|
|
49
|
+
*/
|
|
50
|
+
export function CardHeader({ className = '', children, ...rest }: HTMLAttributes<HTMLDivElement>) {
|
|
51
|
+
return (
|
|
52
|
+
<div className={`flex flex-col space-y-1.5 ${className}`} {...rest}>
|
|
53
|
+
{children}
|
|
54
|
+
</div>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function CardTitle({
|
|
59
|
+
className = '',
|
|
60
|
+
children,
|
|
61
|
+
...rest
|
|
62
|
+
}: HTMLAttributes<HTMLHeadingElement>) {
|
|
63
|
+
return (
|
|
64
|
+
<h3
|
|
65
|
+
className={`text-lg leading-tight font-semibold tracking-tight text-[var(--card-foreground)] ${className}`}
|
|
66
|
+
{...rest}
|
|
67
|
+
>
|
|
68
|
+
{children}
|
|
69
|
+
</h3>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function CardDescription({
|
|
74
|
+
className = '',
|
|
75
|
+
children,
|
|
76
|
+
...rest
|
|
77
|
+
}: HTMLAttributes<HTMLParagraphElement>) {
|
|
78
|
+
return (
|
|
79
|
+
<p className={`text-sm text-[var(--muted-foreground)] ${className}`} {...rest}>
|
|
80
|
+
{children}
|
|
81
|
+
</p>
|
|
82
|
+
)
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function CardContent({ className = '', children, ...rest }: HTMLAttributes<HTMLDivElement>) {
|
|
86
|
+
return (
|
|
87
|
+
<div className={className} {...rest}>
|
|
88
|
+
{children}
|
|
89
|
+
</div>
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export function CardFooter({ className = '', children, ...rest }: HTMLAttributes<HTMLDivElement>) {
|
|
94
|
+
return (
|
|
95
|
+
<div className={`flex items-center justify-end gap-2 pt-4 ${className}`} {...rest}>
|
|
96
|
+
{children}
|
|
97
|
+
</div>
|
|
98
|
+
)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { card as cardVariants }
|
|
@@ -161,7 +161,7 @@ function RowActionsMenu({ actions, row }: { actions: RowAction[]; row: Row }) {
|
|
|
161
161
|
<MoreVerticalIcon />
|
|
162
162
|
</button>
|
|
163
163
|
{open && (
|
|
164
|
-
<div className="absolute right-0
|
|
164
|
+
<div className="absolute top-full right-0 z-50 mt-1 w-40 rounded-md border border-[var(--border)] bg-[var(--popover)] py-1 shadow-lg">
|
|
165
165
|
{actions.map((action) => (
|
|
166
166
|
<button
|
|
167
167
|
key={action.key}
|