@postxl/generators 1.1.0 → 1.2.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/backend-core/template/apps/api/src/e2e.ts +13 -4
- package/dist/e2e/e2e.generator.js +2 -14
- package/dist/e2e/e2e.generator.js.map +1 -1
- package/dist/e2e/generators/docker-sh.generator.d.ts +2 -0
- package/dist/e2e/generators/docker-sh.generator.js +25 -0
- package/dist/e2e/generators/docker-sh.generator.js.map +1 -0
- package/dist/frontend-core/frontend.generator.d.ts +0 -58
- package/dist/frontend-core/frontend.generator.js +6 -172
- package/dist/frontend-core/frontend.generator.js.map +1 -1
- package/dist/frontend-core/template/README.md +1 -1
- package/dist/frontend-core/template/src/components/admin/table-filter.tsx +1 -5
- package/dist/frontend-core/template/src/components/ui/color-mode-toggle/color-mode-toggle.tsx +10 -4
- package/dist/frontend-core/template/src/context-providers/auth-context-provider.tsx +2 -5
- package/dist/frontend-core/template/src/pages/dashboard/dashboard.page.tsx +2 -3
- package/dist/frontend-core/template/src/pages/error/default-error.page.tsx +1 -1
- package/dist/frontend-core/template/src/pages/error/not-found-error.page.tsx +1 -1
- package/dist/frontend-core/template/src/styles/styles.css +13 -1
- package/dist/frontend-core/template/tsconfig.json +2 -0
- package/dist/frontend-core/types/component.d.ts +1 -1
- package/dist/frontend-forms/generators/discriminated-union/fields.generator.js +4 -6
- package/dist/frontend-forms/generators/discriminated-union/fields.generator.js.map +1 -1
- package/dist/frontend-forms/generators/discriminated-union/inputs.generator.js +1 -1
- package/dist/frontend-forms/generators/discriminated-union/inputs.generator.js.map +1 -1
- package/dist/frontend-forms/generators/enum/inputs.generator.js +1 -1
- package/dist/frontend-forms/generators/enum/inputs.generator.js.map +1 -1
- package/dist/frontend-forms/generators/model/forms.generator.js +8 -12
- package/dist/frontend-forms/generators/model/forms.generator.js.map +1 -1
- package/dist/frontend-forms/generators/model/inputs.generator.js +2 -6
- package/dist/frontend-forms/generators/model/inputs.generator.js.map +1 -1
- package/dist/frontend-forms/template/src/components/ui/field/field.tsx +1 -4
- package/dist/frontend-tables/generators/model-table.generator.js +1 -5
- package/dist/frontend-tables/generators/model-table.generator.js.map +1 -1
- package/package.json +3 -2
- package/dist/e2e/template/scripts/docker.sh +0 -17
- package/dist/frontend-core/template/src/components/ui/accordion/accordion.stories.tsx +0 -47
- package/dist/frontend-core/template/src/components/ui/accordion/accordion.tsx +0 -52
- package/dist/frontend-core/template/src/components/ui/admin-sidebar/admin-sidebar.tsx +0 -195
- package/dist/frontend-core/template/src/components/ui/alert/alert.stories.tsx +0 -61
- package/dist/frontend-core/template/src/components/ui/alert/alert.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/alert-dialog/alert-dialog.stories.tsx +0 -52
- package/dist/frontend-core/template/src/components/ui/alert-dialog/alert-dialog.tsx +0 -105
- package/dist/frontend-core/template/src/components/ui/avatar/avatar.stories.tsx +0 -30
- package/dist/frontend-core/template/src/components/ui/avatar/avatar.tsx +0 -39
- package/dist/frontend-core/template/src/components/ui/badge/badge.stories.tsx +0 -78
- package/dist/frontend-core/template/src/components/ui/badge/badge.tsx +0 -48
- package/dist/frontend-core/template/src/components/ui/breadcrumb/breadcrumb.stories.tsx +0 -67
- package/dist/frontend-core/template/src/components/ui/breadcrumb/breadcrumb.tsx +0 -85
- package/dist/frontend-core/template/src/components/ui/button/button.stories.tsx +0 -150
- package/dist/frontend-core/template/src/components/ui/button/button.tsx +0 -68
- package/dist/frontend-core/template/src/components/ui/calendar/calendar.stories.tsx +0 -160
- package/dist/frontend-core/template/src/components/ui/calendar/calendar.tsx +0 -293
- package/dist/frontend-core/template/src/components/ui/card/card.stories.tsx +0 -77
- package/dist/frontend-core/template/src/components/ui/card/card.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/card-hover/card-hover.stories.tsx +0 -29
- package/dist/frontend-core/template/src/components/ui/card-hover/card-hover.tsx +0 -28
- package/dist/frontend-core/template/src/components/ui/carousel/carousel.stories.tsx +0 -154
- package/dist/frontend-core/template/src/components/ui/carousel/carousel.tsx +0 -227
- package/dist/frontend-core/template/src/components/ui/checkbox/checkbox.stories.tsx +0 -106
- package/dist/frontend-core/template/src/components/ui/checkbox/checkbox.tsx +0 -88
- package/dist/frontend-core/template/src/components/ui/checkbox/shadcn-checkbox.stories.tsx +0 -90
- package/dist/frontend-core/template/src/components/ui/checkbox/shadcn-checkbox.tsx +0 -54
- package/dist/frontend-core/template/src/components/ui/collapse/collapse.stories.tsx +0 -52
- package/dist/frontend-core/template/src/components/ui/collapse/collapse.tsx +0 -9
- package/dist/frontend-core/template/src/components/ui/combobox/combobox.stories.tsx +0 -207
- package/dist/frontend-core/template/src/components/ui/combobox/combobox.tsx +0 -79
- package/dist/frontend-core/template/src/components/ui/command/command.stories.tsx +0 -186
- package/dist/frontend-core/template/src/components/ui/command/command.tsx +0 -165
- package/dist/frontend-core/template/src/components/ui/command-palette/command-palette.stories.tsx +0 -160
- package/dist/frontend-core/template/src/components/ui/command-palette/command-palette.tsx +0 -134
- package/dist/frontend-core/template/src/components/ui/content-frame/content-frame.stories.tsx +0 -198
- package/dist/frontend-core/template/src/components/ui/content-frame/content-frame.tsx +0 -100
- package/dist/frontend-core/template/src/components/ui/context-menu/context-menu.stories.tsx +0 -78
- package/dist/frontend-core/template/src/components/ui/context-menu/context-menu.tsx +0 -179
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/cell-variant-types.ts +0 -11
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/checkbox-cell.tsx +0 -116
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/date-cell.tsx +0 -157
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/gantt-cell.tsx +0 -82
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/long-text-cell.tsx +0 -180
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/multi-select-cell.tsx +0 -280
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/number-cell.tsx +0 -169
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/react-node-cell.tsx +0 -33
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/select-cell.tsx +0 -175
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/short-text-cell.tsx +0 -138
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/utils/gantt-timeline.tsx +0 -92
- package/dist/frontend-core/template/src/components/ui/data-grid/cell-variants/utils/gantt-timerange-picker.tsx +0 -330
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-cell-wrapper.tsx +0 -212
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-cell.tsx +0 -157
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-column-header.tsx +0 -340
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-context-menu.tsx +0 -271
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-row.tsx +0 -123
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-search.tsx +0 -211
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-types.ts +0 -159
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-utils.ts +0 -67
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid-view-menu.tsx +0 -360
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid.stories.tsx +0 -780
- package/dist/frontend-core/template/src/components/ui/data-grid/data-grid.tsx +0 -217
- package/dist/frontend-core/template/src/components/ui/data-grid/hooks/use-callback-ref.ts +0 -22
- package/dist/frontend-core/template/src/components/ui/data-grid/hooks/use-data-grid.tsx +0 -1892
- package/dist/frontend-core/template/src/components/ui/data-grid/hooks/use-debounced-callback.ts +0 -19
- package/dist/frontend-core/template/src/components/ui/data-grid/styles.css +0 -3
- package/dist/frontend-core/template/src/components/ui/data-table/context-menu-simple.tsx +0 -141
- package/dist/frontend-core/template/src/components/ui/data-table/data-table.stories.tsx +0 -146
- package/dist/frontend-core/template/src/components/ui/data-table/data-table.tsx +0 -447
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/country-array-cell-renderer.tsx +0 -77
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/country-cell-renderer.tsx +0 -56
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/favorite-cell-renderer.tsx +0 -68
- package/dist/frontend-core/template/src/components/ui/data-table/renderers/links-cell-renderer.tsx +0 -205
- package/dist/frontend-core/template/src/components/ui/data-table/utils/columns.ts +0 -351
- package/dist/frontend-core/template/src/components/ui/data-table/utils/data-table.utils.ts +0 -49
- package/dist/frontend-core/template/src/components/ui/date-picker/date-picker.stories.tsx +0 -149
- package/dist/frontend-core/template/src/components/ui/date-picker/date-picker.tsx +0 -30
- package/dist/frontend-core/template/src/components/ui/dialog/dialog.stories.tsx +0 -80
- package/dist/frontend-core/template/src/components/ui/dialog/dialog.tsx +0 -134
- package/dist/frontend-core/template/src/components/ui/drawer/drawer.stories.tsx +0 -104
- package/dist/frontend-core/template/src/components/ui/drawer/drawer.tsx +0 -87
- package/dist/frontend-core/template/src/components/ui/dropdown-menu/dropdown-menu.stories.tsx +0 -168
- package/dist/frontend-core/template/src/components/ui/dropdown-menu/dropdown-menu.tsx +0 -225
- package/dist/frontend-core/template/src/components/ui/input/input.stories.tsx +0 -141
- package/dist/frontend-core/template/src/components/ui/input/input.tsx +0 -47
- package/dist/frontend-core/template/src/components/ui/label/label.stories.tsx +0 -41
- package/dist/frontend-core/template/src/components/ui/label/label.tsx +0 -20
- package/dist/frontend-core/template/src/components/ui/loader/loader.stories.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/loader/loader.tsx +0 -17
- package/dist/frontend-core/template/src/components/ui/mark-value-renderer/mark-value-renderer.stories.tsx +0 -114
- package/dist/frontend-core/template/src/components/ui/mark-value-renderer/mark-value-renderer.tsx +0 -48
- package/dist/frontend-core/template/src/components/ui/menubar/menu.stories.tsx +0 -134
- package/dist/frontend-core/template/src/components/ui/menubar/menubar.tsx +0 -208
- package/dist/frontend-core/template/src/components/ui/modal/modal.stories.tsx +0 -297
- package/dist/frontend-core/template/src/components/ui/modal/modal.tsx +0 -80
- package/dist/frontend-core/template/src/components/ui/navigation-menu/navigation-menu.stories.tsx +0 -213
- package/dist/frontend-core/template/src/components/ui/navigation-menu/navigation-menu.tsx +0 -142
- package/dist/frontend-core/template/src/components/ui/pagination/pagination.stories.tsx +0 -49
- package/dist/frontend-core/template/src/components/ui/pagination/pagination.tsx +0 -84
- package/dist/frontend-core/template/src/components/ui/popover/popover.stories.tsx +0 -82
- package/dist/frontend-core/template/src/components/ui/popover/popover.tsx +0 -55
- package/dist/frontend-core/template/src/components/ui/progress/progress.stories.tsx +0 -80
- package/dist/frontend-core/template/src/components/ui/progress/progress.tsx +0 -17
- package/dist/frontend-core/template/src/components/ui/radio-group/radio-group.stories.tsx +0 -154
- package/dist/frontend-core/template/src/components/ui/radio-group/radio-group.tsx +0 -68
- package/dist/frontend-core/template/src/components/ui/resizable/resizable.stories.tsx +0 -73
- package/dist/frontend-core/template/src/components/ui/resizable/resizeable.tsx +0 -38
- package/dist/frontend-core/template/src/components/ui/scroll-area/scroll-area.stories.tsx +0 -55
- package/dist/frontend-core/template/src/components/ui/scroll-area/scroll-area.tsx +0 -39
- package/dist/frontend-core/template/src/components/ui/select/select.stories.tsx +0 -297
- package/dist/frontend-core/template/src/components/ui/select/select.tsx +0 -227
- package/dist/frontend-core/template/src/components/ui/separator/separator.tsx +0 -21
- package/dist/frontend-core/template/src/components/ui/separator/seperator.stories.tsx +0 -25
- package/dist/frontend-core/template/src/components/ui/sheet/sheet.stories.tsx +0 -45
- package/dist/frontend-core/template/src/components/ui/sheet/sheet.tsx +0 -107
- package/dist/frontend-core/template/src/components/ui/skeleton/skeleton.stories.tsx +0 -26
- package/dist/frontend-core/template/src/components/ui/skeleton/skeleton.tsx +0 -7
- package/dist/frontend-core/template/src/components/ui/slider/slider.stories.tsx +0 -101
- package/dist/frontend-core/template/src/components/ui/slider/slider.tsx +0 -98
- package/dist/frontend-core/template/src/components/ui/spinner/spinner.stories.tsx +0 -19
- package/dist/frontend-core/template/src/components/ui/spinner/spinner.tsx +0 -21
- package/dist/frontend-core/template/src/components/ui/switch/switch.stories.tsx +0 -33
- package/dist/frontend-core/template/src/components/ui/switch/switch.tsx +0 -28
- package/dist/frontend-core/template/src/components/ui/tabs/tabs.stories.tsx +0 -215
- package/dist/frontend-core/template/src/components/ui/tabs/tabs.tsx +0 -70
- package/dist/frontend-core/template/src/components/ui/textarea/textarea.stories.tsx +0 -138
- package/dist/frontend-core/template/src/components/ui/textarea/textarea.tsx +0 -40
- package/dist/frontend-core/template/src/components/ui/toast/toast.mdx +0 -31
- package/dist/frontend-core/template/src/components/ui/toast/toast.stories.tsx +0 -89
- package/dist/frontend-core/template/src/components/ui/toggle/toggle.stories.tsx +0 -65
- package/dist/frontend-core/template/src/components/ui/toggle/toggle.tsx +0 -38
- package/dist/frontend-core/template/src/components/ui/toggle-group/toggle-group.stories.tsx +0 -85
- package/dist/frontend-core/template/src/components/ui/toggle-group/toggle-group.tsx +0 -54
- package/dist/frontend-core/template/src/components/ui/tooltip/tooltip.stories.tsx +0 -29
- package/dist/frontend-core/template/src/components/ui/tooltip/tooltip.tsx +0 -29
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import { ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from '@radix-ui/react-icons'
|
|
2
|
-
|
|
3
|
-
import { useState } from 'react'
|
|
4
|
-
|
|
5
|
-
export function AdminSidebar() {
|
|
6
|
-
const [isOpen, setIsOpen] = useState(false)
|
|
7
|
-
const [isCollapsed, setIsCollapsed] = useState(false)
|
|
8
|
-
const [expandedSchemas, setExpandedSchemas] = useState<Record<string, boolean>>({
|
|
9
|
-
Data: true,
|
|
10
|
-
PXL: true,
|
|
11
|
-
Advanced: true,
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
const toggleSchema = (schema: string) => {
|
|
15
|
-
setExpandedSchemas((prev) => ({
|
|
16
|
-
...prev,
|
|
17
|
-
[schema]: !prev[schema],
|
|
18
|
-
}))
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<>
|
|
23
|
-
{/* Mobile toggle button */}
|
|
24
|
-
<button
|
|
25
|
-
onClick={() => setIsOpen(!isOpen)}
|
|
26
|
-
className="fixed top-4 left-4 z-50 md:hidden p-2 bg-white dark:bg-gray-900 rounded shadow-lg border border-gray-200 dark:border-gray-700"
|
|
27
|
-
aria-label="Toggle admin menu"
|
|
28
|
-
>
|
|
29
|
-
{isOpen ? <ChevronDownIcon className="w-6 h-6" /> : <ChevronRightIcon className="w-6 h-6" />}
|
|
30
|
-
</button>
|
|
31
|
-
|
|
32
|
-
{/* Sidebar */}
|
|
33
|
-
<aside
|
|
34
|
-
className={`
|
|
35
|
-
fixed md:sticky top-0 left-0 h-screen bg-white dark:bg-gray-900 border-r border-gray-200 dark:border-gray-700
|
|
36
|
-
overflow-y-auto transition-all duration-300 z-40
|
|
37
|
-
${isOpen ? 'translate-x-0' : '-translate-x-full md:translate-x-0'}
|
|
38
|
-
${isCollapsed ? 'w-16 min-w-16' : 'w-64 min-w-64'}
|
|
39
|
-
`}
|
|
40
|
-
>
|
|
41
|
-
<div className="p-4">
|
|
42
|
-
<div className="flex items-center justify-between mb-4">
|
|
43
|
-
{!isCollapsed && (
|
|
44
|
-
<a
|
|
45
|
-
href="/admin"
|
|
46
|
-
className="text-lg font-bold hover:text-blue-600 dark:hover:text-blue-400 transition-colors"
|
|
47
|
-
>
|
|
48
|
-
Admin
|
|
49
|
-
</a>
|
|
50
|
-
)}
|
|
51
|
-
<button
|
|
52
|
-
onClick={() => setIsCollapsed(!isCollapsed)}
|
|
53
|
-
className="hidden md:block p-1 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors ml-auto"
|
|
54
|
-
aria-label={isCollapsed ? 'Expand sidebar' : 'Collapse sidebar'}
|
|
55
|
-
>
|
|
56
|
-
{isCollapsed ? <ChevronRightIcon className="w-5 h-5" /> : <ChevronLeftIcon className="w-5 h-5" />}
|
|
57
|
-
</button>
|
|
58
|
-
</div>
|
|
59
|
-
{!isCollapsed && (
|
|
60
|
-
<nav>
|
|
61
|
-
<div key="Data" className="mb-4">
|
|
62
|
-
<button
|
|
63
|
-
onClick={() => toggleSchema('Data')}
|
|
64
|
-
className="flex items-center justify-between w-full px-4 py-2 font-semibold text-left hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
65
|
-
>
|
|
66
|
-
<span>Data</span>
|
|
67
|
-
{expandedSchemas['Data'] ? (
|
|
68
|
-
<ChevronDownIcon className="w-4 h-4" />
|
|
69
|
-
) : (
|
|
70
|
-
<ChevronRightIcon className="w-4 h-4" />
|
|
71
|
-
)}
|
|
72
|
-
</button>
|
|
73
|
-
{expandedSchemas['Data'] && (
|
|
74
|
-
<ul className="mt-2 ml-2 space-y-1">
|
|
75
|
-
<li key="Country">
|
|
76
|
-
<a
|
|
77
|
-
href="/admin/countries"
|
|
78
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
79
|
-
>
|
|
80
|
-
Country
|
|
81
|
-
</a>
|
|
82
|
-
</li>
|
|
83
|
-
<li key="Post">
|
|
84
|
-
<a
|
|
85
|
-
href="/admin/posts"
|
|
86
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
87
|
-
>
|
|
88
|
-
Post
|
|
89
|
-
</a>
|
|
90
|
-
</li>
|
|
91
|
-
<li key="Publication">
|
|
92
|
-
<a
|
|
93
|
-
href="/admin/publications"
|
|
94
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
95
|
-
>
|
|
96
|
-
Publication
|
|
97
|
-
</a>
|
|
98
|
-
</li>
|
|
99
|
-
<li key="ViewStatistic">
|
|
100
|
-
<Link
|
|
101
|
-
href="/admin/viewStatistics"
|
|
102
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
103
|
-
>
|
|
104
|
-
ViewStatistic
|
|
105
|
-
</Link>
|
|
106
|
-
</li>
|
|
107
|
-
</ul>
|
|
108
|
-
)}
|
|
109
|
-
</div>
|
|
110
|
-
<div key="PXL" className="mb-4">
|
|
111
|
-
<button
|
|
112
|
-
onClick={() => toggleSchema('PXL')}
|
|
113
|
-
className="flex items-center justify-between w-full px-4 py-2 font-semibold text-left hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
114
|
-
>
|
|
115
|
-
<span>PXL</span>
|
|
116
|
-
{expandedSchemas['PXL'] ? (
|
|
117
|
-
<ChevronDownIcon className="w-4 h-4" />
|
|
118
|
-
) : (
|
|
119
|
-
<ChevronRightIcon className="w-4 h-4" />
|
|
120
|
-
)}
|
|
121
|
-
</button>
|
|
122
|
-
{expandedSchemas['PXL'] && (
|
|
123
|
-
<ul className="mt-2 ml-2 space-y-1">
|
|
124
|
-
<li key="Action">
|
|
125
|
-
<a
|
|
126
|
-
href="/admin/actions"
|
|
127
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
128
|
-
>
|
|
129
|
-
Action
|
|
130
|
-
</a>
|
|
131
|
-
</li>
|
|
132
|
-
<li key="ActionOperation">
|
|
133
|
-
<a
|
|
134
|
-
href="/admin/actionOperations"
|
|
135
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
136
|
-
>
|
|
137
|
-
ActionOperation
|
|
138
|
-
</a>
|
|
139
|
-
</li>
|
|
140
|
-
<li key="File">
|
|
141
|
-
<a
|
|
142
|
-
href="/admin/files"
|
|
143
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
144
|
-
>
|
|
145
|
-
File
|
|
146
|
-
</a>
|
|
147
|
-
</li>
|
|
148
|
-
<li key="User">
|
|
149
|
-
<a
|
|
150
|
-
href="/admin/users"
|
|
151
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
152
|
-
>
|
|
153
|
-
User
|
|
154
|
-
</a>
|
|
155
|
-
</li>
|
|
156
|
-
</ul>
|
|
157
|
-
)}
|
|
158
|
-
</div>
|
|
159
|
-
{process.env.NEXT_PUBLIC_ALLOW_ADMIN === 'true' && (
|
|
160
|
-
<div key="Advanced" className="mb-4">
|
|
161
|
-
<button
|
|
162
|
-
onClick={() => toggleSchema('Advanced')}
|
|
163
|
-
className="flex items-center justify-between w-full px-4 py-2 font-semibold text-left hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
164
|
-
>
|
|
165
|
-
<span>Advanced</span>
|
|
166
|
-
{expandedSchemas['Advanced'] ? (
|
|
167
|
-
<ChevronDownIcon className="w-4 h-4" />
|
|
168
|
-
) : (
|
|
169
|
-
<ChevronRightIcon className="w-4 h-4" />
|
|
170
|
-
)}
|
|
171
|
-
</button>
|
|
172
|
-
{expandedSchemas['Advanced'] && (
|
|
173
|
-
<ul className="mt-2 ml-2 space-y-1">
|
|
174
|
-
<li key="DataManagement">
|
|
175
|
-
<Link
|
|
176
|
-
href="/admin/data-management"
|
|
177
|
-
className="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-800 rounded transition-colors"
|
|
178
|
-
>
|
|
179
|
-
Data Management
|
|
180
|
-
</Link>
|
|
181
|
-
</li>
|
|
182
|
-
</ul>
|
|
183
|
-
)}
|
|
184
|
-
</div>
|
|
185
|
-
)}
|
|
186
|
-
</nav>
|
|
187
|
-
)}
|
|
188
|
-
</div>
|
|
189
|
-
</aside>
|
|
190
|
-
|
|
191
|
-
{/* Overlay for mobile */}
|
|
192
|
-
{isOpen && <div className="fixed inset-0 bg-black/20 z-30 md:hidden" onClick={() => setIsOpen(false)} />}
|
|
193
|
-
</>
|
|
194
|
-
)
|
|
195
|
-
}
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
|
|
3
|
-
import { Alert, AlertDescription, AlertTitle } from './alert'
|
|
4
|
-
import { RocketIcon, ExclamationTriangleIcon } from '@radix-ui/react-icons'
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: 'Alert',
|
|
8
|
-
component: Alert,
|
|
9
|
-
tags: ['autodocs'],
|
|
10
|
-
argTypes: {
|
|
11
|
-
variant: {
|
|
12
|
-
options: ['default', 'destructive'],
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
} satisfies Meta<typeof Alert>
|
|
16
|
-
|
|
17
|
-
export default meta
|
|
18
|
-
|
|
19
|
-
export const Default: StoryObj<typeof meta> = {
|
|
20
|
-
parameters: {
|
|
21
|
-
docs: {
|
|
22
|
-
description: {
|
|
23
|
-
story: 'The Alert component is used to display a message to the user.',
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
args: {
|
|
28
|
-
variant: 'default',
|
|
29
|
-
},
|
|
30
|
-
render: (args) => (
|
|
31
|
-
<div className="flex items-center justify-center border rounded p-4">
|
|
32
|
-
<Alert {...args}>
|
|
33
|
-
<RocketIcon className="h-4 w-4" />
|
|
34
|
-
<AlertTitle>Heads up!</AlertTitle>
|
|
35
|
-
<AlertDescription>You can add components to your app using the cli.</AlertDescription>
|
|
36
|
-
</Alert>
|
|
37
|
-
</div>
|
|
38
|
-
),
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const Destructive: StoryObj<typeof meta> = {
|
|
42
|
-
parameters: {
|
|
43
|
-
docs: {
|
|
44
|
-
description: {
|
|
45
|
-
story: 'The destructive variant is used for critical alerts that require immediate attention.',
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
args: {
|
|
50
|
-
variant: 'destructive',
|
|
51
|
-
},
|
|
52
|
-
render: (args) => (
|
|
53
|
-
<div className="flex items-center justify-center border rounded p-4">
|
|
54
|
-
<Alert {...args}>
|
|
55
|
-
<ExclamationTriangleIcon className="h-4 w-4" />
|
|
56
|
-
<AlertTitle>Error!</AlertTitle>
|
|
57
|
-
<AlertDescription>Something went wrong. Please try again.</AlertDescription>
|
|
58
|
-
</Alert>
|
|
59
|
-
</div>
|
|
60
|
-
),
|
|
61
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
2
|
-
import * as React from 'react'
|
|
3
|
-
|
|
4
|
-
import { cn } from '@lib/utils'
|
|
5
|
-
|
|
6
|
-
const alertVariants = cva(
|
|
7
|
-
'relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7',
|
|
8
|
-
{
|
|
9
|
-
variants: {
|
|
10
|
-
variant: {
|
|
11
|
-
default: 'bg-background text-foreground',
|
|
12
|
-
destructive: 'border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive',
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
variant: 'default',
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
const Alert = React.forwardRef<
|
|
22
|
-
HTMLDivElement,
|
|
23
|
-
React.HTMLAttributes<HTMLDivElement> & VariantProps<typeof alertVariants>
|
|
24
|
-
>(({ className, variant, ...props }, ref) => (
|
|
25
|
-
<div ref={ref} role="alert" className={cn(alertVariants({ variant }), className)} {...props} />
|
|
26
|
-
))
|
|
27
|
-
Alert.displayName = 'Alert'
|
|
28
|
-
|
|
29
|
-
const AlertTitle = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLHeadingElement>>(
|
|
30
|
-
({ className, children, ...props }, ref) => (
|
|
31
|
-
<h5 ref={ref} className={cn('mb-1 font-medium leading-none tracking-tight', className)} {...props}>
|
|
32
|
-
{children}
|
|
33
|
-
</h5>
|
|
34
|
-
),
|
|
35
|
-
)
|
|
36
|
-
AlertTitle.displayName = 'AlertTitle'
|
|
37
|
-
|
|
38
|
-
const AlertDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(
|
|
39
|
-
({ className, ...props }, ref) => (
|
|
40
|
-
<div ref={ref} className={cn('text-sm [&_p]:leading-relaxed', className)} {...props} />
|
|
41
|
-
),
|
|
42
|
-
)
|
|
43
|
-
AlertDescription.displayName = 'AlertDescription'
|
|
44
|
-
|
|
45
|
-
export { Alert, AlertTitle, AlertDescription }
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
AlertDialog,
|
|
5
|
-
AlertDialogAction,
|
|
6
|
-
AlertDialogCancel,
|
|
7
|
-
AlertDialogContent,
|
|
8
|
-
AlertDialogDescription,
|
|
9
|
-
AlertDialogFooter,
|
|
10
|
-
AlertDialogHeader,
|
|
11
|
-
AlertDialogTitle,
|
|
12
|
-
AlertDialogTrigger,
|
|
13
|
-
} from './alert-dialog'
|
|
14
|
-
|
|
15
|
-
const meta = {
|
|
16
|
-
title: 'AlertDialog',
|
|
17
|
-
component: AlertDialog,
|
|
18
|
-
tags: ['autodocs'],
|
|
19
|
-
} satisfies Meta<typeof AlertDialog>
|
|
20
|
-
|
|
21
|
-
export default meta
|
|
22
|
-
|
|
23
|
-
export const Default: StoryObj<typeof meta> = {
|
|
24
|
-
parameters: {
|
|
25
|
-
docs: {
|
|
26
|
-
description: {
|
|
27
|
-
story:
|
|
28
|
-
'The alert-dialog is a modal dialog that alerts the user of a situation that requires their attention and provides actions to address the situation.',
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
},
|
|
32
|
-
render: () => (
|
|
33
|
-
<div className="flex items-center justify-center">
|
|
34
|
-
<AlertDialog>
|
|
35
|
-
<AlertDialogTrigger>Open</AlertDialogTrigger>
|
|
36
|
-
<AlertDialogContent>
|
|
37
|
-
<AlertDialogHeader>
|
|
38
|
-
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
39
|
-
<AlertDialogDescription>
|
|
40
|
-
This action cannot be undone. This will permanently delete your account and remove your data from our
|
|
41
|
-
servers.
|
|
42
|
-
</AlertDialogDescription>
|
|
43
|
-
</AlertDialogHeader>
|
|
44
|
-
<AlertDialogFooter>
|
|
45
|
-
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
46
|
-
<AlertDialogAction>Continue</AlertDialogAction>
|
|
47
|
-
</AlertDialogFooter>
|
|
48
|
-
</AlertDialogContent>
|
|
49
|
-
</AlertDialog>
|
|
50
|
-
</div>
|
|
51
|
-
),
|
|
52
|
-
}
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
import { buttonVariants } from '@components/ui/button/button'
|
|
6
|
-
import { cn } from '@lib/utils'
|
|
7
|
-
|
|
8
|
-
const AlertDialog = AlertDialogPrimitive.Root
|
|
9
|
-
|
|
10
|
-
const AlertDialogTrigger = AlertDialogPrimitive.Trigger
|
|
11
|
-
|
|
12
|
-
const AlertDialogPortal = AlertDialogPrimitive.Portal
|
|
13
|
-
|
|
14
|
-
const AlertDialogOverlay = React.forwardRef<
|
|
15
|
-
React.ElementRef<typeof AlertDialogPrimitive.Overlay>,
|
|
16
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>
|
|
17
|
-
>(({ className, ...props }, ref) => (
|
|
18
|
-
<AlertDialogPrimitive.Overlay
|
|
19
|
-
className={cn(
|
|
20
|
-
'fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0',
|
|
21
|
-
className,
|
|
22
|
-
)}
|
|
23
|
-
{...props}
|
|
24
|
-
ref={ref}
|
|
25
|
-
/>
|
|
26
|
-
))
|
|
27
|
-
AlertDialogOverlay.displayName = AlertDialogPrimitive.Overlay.displayName
|
|
28
|
-
|
|
29
|
-
const AlertDialogContent = React.forwardRef<
|
|
30
|
-
React.ElementRef<typeof AlertDialogPrimitive.Content>,
|
|
31
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>
|
|
32
|
-
>(({ className, ...props }, ref) => (
|
|
33
|
-
<AlertDialogPortal>
|
|
34
|
-
<AlertDialogOverlay />
|
|
35
|
-
<AlertDialogPrimitive.Content
|
|
36
|
-
ref={ref}
|
|
37
|
-
className={cn(
|
|
38
|
-
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg',
|
|
39
|
-
className,
|
|
40
|
-
)}
|
|
41
|
-
{...props}
|
|
42
|
-
/>
|
|
43
|
-
</AlertDialogPortal>
|
|
44
|
-
))
|
|
45
|
-
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName
|
|
46
|
-
|
|
47
|
-
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
48
|
-
<div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props} />
|
|
49
|
-
)
|
|
50
|
-
AlertDialogHeader.displayName = 'AlertDialogHeader'
|
|
51
|
-
|
|
52
|
-
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
53
|
-
<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props} />
|
|
54
|
-
)
|
|
55
|
-
AlertDialogFooter.displayName = 'AlertDialogFooter'
|
|
56
|
-
|
|
57
|
-
const AlertDialogTitle = React.forwardRef<
|
|
58
|
-
React.ElementRef<typeof AlertDialogPrimitive.Title>,
|
|
59
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>
|
|
60
|
-
>(({ className, ...props }, ref) => (
|
|
61
|
-
<AlertDialogPrimitive.Title ref={ref} className={cn('text-lg font-semibold', className)} {...props} />
|
|
62
|
-
))
|
|
63
|
-
AlertDialogTitle.displayName = AlertDialogPrimitive.Title.displayName
|
|
64
|
-
|
|
65
|
-
const AlertDialogDescription = React.forwardRef<
|
|
66
|
-
React.ElementRef<typeof AlertDialogPrimitive.Description>,
|
|
67
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>
|
|
68
|
-
>(({ className, ...props }, ref) => (
|
|
69
|
-
<AlertDialogPrimitive.Description ref={ref} className={cn('text-sm text-muted-foreground', className)} {...props} />
|
|
70
|
-
))
|
|
71
|
-
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName
|
|
72
|
-
|
|
73
|
-
const AlertDialogAction = React.forwardRef<
|
|
74
|
-
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
75
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
76
|
-
>(({ className, ...props }, ref) => (
|
|
77
|
-
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
78
|
-
))
|
|
79
|
-
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName
|
|
80
|
-
|
|
81
|
-
const AlertDialogCancel = React.forwardRef<
|
|
82
|
-
React.ElementRef<typeof AlertDialogPrimitive.Cancel>,
|
|
83
|
-
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Cancel>
|
|
84
|
-
>(({ className, ...props }, ref) => (
|
|
85
|
-
<AlertDialogPrimitive.Cancel
|
|
86
|
-
ref={ref}
|
|
87
|
-
className={cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', className)}
|
|
88
|
-
{...props}
|
|
89
|
-
/>
|
|
90
|
-
))
|
|
91
|
-
AlertDialogCancel.displayName = AlertDialogPrimitive.Cancel.displayName
|
|
92
|
-
|
|
93
|
-
export {
|
|
94
|
-
AlertDialog,
|
|
95
|
-
AlertDialogPortal,
|
|
96
|
-
AlertDialogOverlay,
|
|
97
|
-
AlertDialogTrigger,
|
|
98
|
-
AlertDialogContent,
|
|
99
|
-
AlertDialogHeader,
|
|
100
|
-
AlertDialogFooter,
|
|
101
|
-
AlertDialogTitle,
|
|
102
|
-
AlertDialogDescription,
|
|
103
|
-
AlertDialogAction,
|
|
104
|
-
AlertDialogCancel,
|
|
105
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
|
|
3
|
-
import { Avatar, AvatarFallback, AvatarImage } from './avatar'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Avatar',
|
|
7
|
-
component: Avatar,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
} satisfies Meta<typeof Avatar>
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
|
|
13
|
-
export const Default: StoryObj<typeof meta> = {
|
|
14
|
-
parameters: {
|
|
15
|
-
docs: {
|
|
16
|
-
description: {
|
|
17
|
-
story:
|
|
18
|
-
'The Avatar component is used to represent a user or entity. It can contain an image or fallback to initials.',
|
|
19
|
-
},
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
render: () => (
|
|
23
|
-
<div className="flex items-center justify-center">
|
|
24
|
-
<Avatar>
|
|
25
|
-
<AvatarImage src="https://github.com/shadcn.png" />
|
|
26
|
-
<AvatarFallback>CN</AvatarFallback>
|
|
27
|
-
</Avatar>
|
|
28
|
-
</div>
|
|
29
|
-
),
|
|
30
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as AvatarPrimitive from '@radix-ui/react-avatar'
|
|
2
|
-
|
|
3
|
-
import * as React from 'react'
|
|
4
|
-
|
|
5
|
-
import { cn } from '@lib/utils'
|
|
6
|
-
|
|
7
|
-
const Avatar = React.forwardRef<
|
|
8
|
-
React.ElementRef<typeof AvatarPrimitive.Root>,
|
|
9
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
|
|
10
|
-
>(({ className, ...props }, ref) => (
|
|
11
|
-
<AvatarPrimitive.Root
|
|
12
|
-
ref={ref}
|
|
13
|
-
className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)}
|
|
14
|
-
{...props}
|
|
15
|
-
/>
|
|
16
|
-
))
|
|
17
|
-
Avatar.displayName = AvatarPrimitive.Root.displayName
|
|
18
|
-
|
|
19
|
-
const AvatarImage = React.forwardRef<
|
|
20
|
-
React.ElementRef<typeof AvatarPrimitive.Image>,
|
|
21
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
|
|
22
|
-
>(({ className, ...props }, ref) => (
|
|
23
|
-
<AvatarPrimitive.Image ref={ref} className={cn('aspect-square h-full w-full', className)} {...props} />
|
|
24
|
-
))
|
|
25
|
-
AvatarImage.displayName = AvatarPrimitive.Image.displayName
|
|
26
|
-
|
|
27
|
-
const AvatarFallback = React.forwardRef<
|
|
28
|
-
React.ElementRef<typeof AvatarPrimitive.Fallback>,
|
|
29
|
-
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
|
|
30
|
-
>(({ className, ...props }, ref) => (
|
|
31
|
-
<AvatarPrimitive.Fallback
|
|
32
|
-
ref={ref}
|
|
33
|
-
className={cn('flex h-full w-full items-center justify-center rounded-full bg-muted', className)}
|
|
34
|
-
{...props}
|
|
35
|
-
/>
|
|
36
|
-
))
|
|
37
|
-
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName
|
|
38
|
-
|
|
39
|
-
export { Avatar, AvatarImage, AvatarFallback }
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react-vite'
|
|
2
|
-
|
|
3
|
-
import { Badge } from './badge'
|
|
4
|
-
|
|
5
|
-
const meta = {
|
|
6
|
-
title: 'Badge',
|
|
7
|
-
component: Badge,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
parameters: {
|
|
10
|
-
layout: 'centered',
|
|
11
|
-
},
|
|
12
|
-
argTypes: {
|
|
13
|
-
variant: {
|
|
14
|
-
control: 'select',
|
|
15
|
-
options: ['default', 'secondary', 'destructive', 'outline', 'filter', 'info'],
|
|
16
|
-
},
|
|
17
|
-
size: {
|
|
18
|
-
control: 'select',
|
|
19
|
-
options: ['default', 'xs', 'sm', 'md', 'lg'],
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
} satisfies Meta<typeof Badge>
|
|
23
|
-
export default meta
|
|
24
|
-
|
|
25
|
-
type Story = StoryObj<typeof meta>
|
|
26
|
-
|
|
27
|
-
export const Default: Story = {
|
|
28
|
-
args: { variant: 'default', size: 'default' },
|
|
29
|
-
render: (args) => <Badge {...args}>Badge</Badge>,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const Variants: Story = {
|
|
33
|
-
render: () => (
|
|
34
|
-
<div className="flex flex-wrap gap-2">
|
|
35
|
-
<Badge variant="default">Default</Badge>
|
|
36
|
-
<Badge variant="secondary">Secondary</Badge>
|
|
37
|
-
<Badge variant="destructive">Destructive</Badge>
|
|
38
|
-
<Badge variant="outline">Outline</Badge>
|
|
39
|
-
<Badge variant="filter">Filter</Badge>
|
|
40
|
-
<Badge variant="info">Info</Badge>
|
|
41
|
-
</div>
|
|
42
|
-
),
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export const Sizes: Story = {
|
|
46
|
-
render: () => (
|
|
47
|
-
<div className="flex flex-wrap gap-2 items-center">
|
|
48
|
-
<Badge size="xs">Extra Small</Badge>
|
|
49
|
-
<Badge size="sm">Small</Badge>
|
|
50
|
-
<Badge size="default">Default</Badge>
|
|
51
|
-
<Badge size="md">Medium</Badge>
|
|
52
|
-
<Badge size="lg">Large</Badge>
|
|
53
|
-
</div>
|
|
54
|
-
),
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
export const WithIcon: Story = {
|
|
58
|
-
render: () => (
|
|
59
|
-
<Badge>
|
|
60
|
-
<svg
|
|
61
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
62
|
-
width="24"
|
|
63
|
-
height="24"
|
|
64
|
-
viewBox="0 0 24 24"
|
|
65
|
-
fill="none"
|
|
66
|
-
stroke="currentColor"
|
|
67
|
-
strokeWidth="2"
|
|
68
|
-
strokeLinecap="round"
|
|
69
|
-
strokeLinejoin="round"
|
|
70
|
-
>
|
|
71
|
-
<circle cx="12" cy="12" r="10" />
|
|
72
|
-
<path d="m15 9-6 6" />
|
|
73
|
-
<path d="m9 9 6 6" />
|
|
74
|
-
</svg>
|
|
75
|
-
With Icon
|
|
76
|
-
</Badge>
|
|
77
|
-
),
|
|
78
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Slot } from '@radix-ui/react-slot'
|
|
2
|
-
|
|
3
|
-
import { cva, type VariantProps } from 'class-variance-authority'
|
|
4
|
-
import * as React from 'react'
|
|
5
|
-
|
|
6
|
-
import { cn } from '@lib/utils'
|
|
7
|
-
|
|
8
|
-
const badgeVariants = cva(
|
|
9
|
-
'inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-base font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden',
|
|
10
|
-
{
|
|
11
|
-
variants: {
|
|
12
|
-
variant: {
|
|
13
|
-
default: 'border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90',
|
|
14
|
-
secondary: 'border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90',
|
|
15
|
-
destructive:
|
|
16
|
-
'border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60',
|
|
17
|
-
outline: 'text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground',
|
|
18
|
-
filter: 'bg-primary text-background border-0',
|
|
19
|
-
info: 'bg-yellow-500 text-foreground border-0',
|
|
20
|
-
},
|
|
21
|
-
size: {
|
|
22
|
-
default: '',
|
|
23
|
-
xs: 'h-3.5 text-sm',
|
|
24
|
-
sm: 'h-4.5 text-xs',
|
|
25
|
-
md: 'h-6 text-md',
|
|
26
|
-
lg: 'h-8 text-lg',
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
defaultVariants: {
|
|
30
|
-
variant: 'default',
|
|
31
|
-
size: 'default',
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
function Badge({
|
|
37
|
-
className,
|
|
38
|
-
variant,
|
|
39
|
-
size,
|
|
40
|
-
asChild = false,
|
|
41
|
-
...props
|
|
42
|
-
}: React.ComponentProps<'span'> & VariantProps<typeof badgeVariants> & { asChild?: boolean }) {
|
|
43
|
-
const Comp = asChild ? Slot : 'span'
|
|
44
|
-
|
|
45
|
-
return <Comp data-slot="badge" className={cn(badgeVariants({ variant, size }), className)} {...props} />
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export { Badge, badgeVariants }
|