@algorithm-shift/design-system 1.2.11 → 1.2.12

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.
Files changed (89) hide show
  1. package/package.json +2 -1
  2. package/src/components/Basic/Image/Image.stories.tsx +13 -0
  3. package/src/components/Basic/Image/Image.tsx +52 -0
  4. package/src/components/Basic/Shape/Shape.tsx +16 -0
  5. package/src/components/Basic/Typography/Typography.stories.tsx +18 -0
  6. package/src/components/Basic/Typography/Typography.tsx +31 -0
  7. package/src/components/DataDisplay/Table/Table.stories.tsx +35 -0
  8. package/src/components/DataDisplay/Table/Table.tsx +15 -0
  9. package/src/components/DataDisplay/index.ts +1 -0
  10. package/src/components/Global/SelectDropdown.tsx +61 -0
  11. package/src/components/Global/TinyMceEditor.tsx +81 -0
  12. package/src/components/Inputs/Checkbox/Checkbox.tsx +18 -0
  13. package/src/components/Inputs/DatePicker/DatePicker.tsx +81 -0
  14. package/src/components/Inputs/DateRange/DateRange.tsx +64 -0
  15. package/src/components/Inputs/Dropdown/Dropdown.tsx +62 -0
  16. package/src/components/Inputs/EmailInput/EmailInput.tsx +64 -0
  17. package/src/components/Inputs/FileInput/FileInput.tsx +24 -0
  18. package/src/components/Inputs/MultiCheckbox/MultiCheckbox.tsx +24 -0
  19. package/src/components/Inputs/NumberInput/NumberInput.tsx +66 -0
  20. package/src/components/Inputs/PasswordInput/PasswordInput.tsx +66 -0
  21. package/src/components/Inputs/PhoneInput/PhoneInput.tsx +58 -0
  22. package/src/components/Inputs/RadioInput/RadioInput.tsx +24 -0
  23. package/src/components/Inputs/RichText/RichText.tsx +10 -0
  24. package/src/components/Inputs/SearchInput/SearchInput.tsx +64 -0
  25. package/src/components/Inputs/SwitchToggle/SwitchToggle.tsx +22 -0
  26. package/src/components/Inputs/TextInput/TextInput.tsx +59 -0
  27. package/src/components/Inputs/Textarea/Textarea.tsx +58 -0
  28. package/src/components/Inputs/UrlInput/UrlInput.tsx +66 -0
  29. package/src/components/Layout/Flex.tsx +13 -0
  30. package/src/components/Layout/Grid.tsx +13 -0
  31. package/src/components/Navigation/Logo/Logo.stories.tsx +25 -0
  32. package/src/components/Navigation/Logo/Logo.tsx +33 -0
  33. package/src/components/Navigation/Notification/Notification.stories.tsx +20 -0
  34. package/src/components/Navigation/Notification/Notification.tsx +20 -0
  35. package/src/components/Navigation/Profile/Profile.stories.tsx +20 -0
  36. package/src/components/Navigation/Profile/Profile.tsx +25 -0
  37. package/src/components/Navigation/Spacer/Spacer.stories.tsx +18 -0
  38. package/src/components/Navigation/Spacer/Spacer.tsx +11 -0
  39. package/src/components/Navigation/Stages/Stages.stories.tsx +24 -0
  40. package/src/components/Navigation/Stages/Stages.tsx +49 -0
  41. package/src/components/Navigation/Tabs/Tabs.stories.tsx +38 -0
  42. package/src/components/Navigation/Tabs/Tabs.tsx +72 -0
  43. package/src/components/Navigation/index.ts +6 -0
  44. package/src/components/index.ts +27 -0
  45. package/src/components/ui/button.stories.tsx +24 -0
  46. package/src/components/ui/button.tsx +59 -0
  47. package/src/components/ui/calendar.tsx +211 -0
  48. package/src/components/ui/checkbox.tsx +30 -0
  49. package/src/components/ui/data-table.tsx +138 -0
  50. package/src/components/ui/dropdown-menu.tsx +258 -0
  51. package/src/components/ui/input.tsx +21 -0
  52. package/src/components/ui/label.tsx +22 -0
  53. package/src/components/ui/popover.tsx +46 -0
  54. package/src/components/ui/radio-group.tsx +43 -0
  55. package/src/components/ui/select.tsx +183 -0
  56. package/src/components/ui/switch.tsx +29 -0
  57. package/src/components/ui/table.tsx +121 -0
  58. package/src/components/ui/textarea.tsx +18 -0
  59. package/src/global.css +6 -0
  60. package/src/index.css +119 -0
  61. package/src/index.ts +4 -0
  62. package/src/lib/utils.ts +6 -0
  63. package/src/stories/Button.stories.ts +54 -0
  64. package/src/stories/Button.tsx +35 -0
  65. package/src/stories/Configure.mdx +364 -0
  66. package/src/stories/Header.stories.ts +34 -0
  67. package/src/stories/Header.tsx +54 -0
  68. package/src/stories/Page.stories.ts +33 -0
  69. package/src/stories/Page.tsx +73 -0
  70. package/src/stories/assets/accessibility.png +0 -0
  71. package/src/stories/assets/accessibility.svg +1 -0
  72. package/src/stories/assets/addon-library.png +0 -0
  73. package/src/stories/assets/assets.png +0 -0
  74. package/src/stories/assets/avif-test-image.avif +0 -0
  75. package/src/stories/assets/context.png +0 -0
  76. package/src/stories/assets/discord.svg +1 -0
  77. package/src/stories/assets/docs.png +0 -0
  78. package/src/stories/assets/figma-plugin.png +0 -0
  79. package/src/stories/assets/github.svg +1 -0
  80. package/src/stories/assets/share.png +0 -0
  81. package/src/stories/assets/styling.png +0 -0
  82. package/src/stories/assets/testing.png +0 -0
  83. package/src/stories/assets/theming.png +0 -0
  84. package/src/stories/assets/tutorials.svg +1 -0
  85. package/src/stories/assets/youtube.svg +1 -0
  86. package/src/stories/button.css +30 -0
  87. package/src/stories/header.css +32 -0
  88. package/src/stories/page.css +68 -0
  89. package/src/types/global.d.ts +85 -0
@@ -0,0 +1,138 @@
1
+ 'use client';
2
+ import {
3
+ ColumnDef,
4
+ flexRender,
5
+ getCoreRowModel,
6
+ useReactTable,
7
+ } from '@tanstack/react-table';
8
+
9
+ import {
10
+ Table,
11
+ TableBody,
12
+ TableCell,
13
+ TableHead,
14
+ TableHeader,
15
+ TableRow,
16
+ } from '@/components/ui/table';
17
+
18
+ interface DataTableProps<TData, TValue> {
19
+ columns: ColumnDef<TData, TValue>[]
20
+ data: TData[],
21
+ rowActions: { header: string; onClick: (row: TData) => void }[],
22
+ loading?: boolean,
23
+ getRowSelection?: (rowSelection: Record<string, boolean>) => void,
24
+ onCellClick?: (cellData: TData, columnId: string) => void;
25
+ cellClickEnabled?: (cellData: TData, columnId: string) => boolean;
26
+ }
27
+
28
+ export function DataTable<TData, TValue>({
29
+ columns,
30
+ rowActions,
31
+ data,
32
+ loading,
33
+ getRowSelection,
34
+ onCellClick,
35
+ cellClickEnabled = () => false,
36
+ }: DataTableProps<TData, TValue>) {
37
+ const table = useReactTable({
38
+ data,
39
+ columns,
40
+ enableRowSelection: true,
41
+ onRowSelectionChange: getRowSelection
42
+ ? (updaterOrValue) => {
43
+ const value =
44
+ typeof updaterOrValue === 'function'
45
+ ? updaterOrValue(table.getState().rowSelection)
46
+ : updaterOrValue;
47
+ getRowSelection(value);
48
+ }
49
+ : undefined,
50
+ getCoreRowModel: getCoreRowModel(),
51
+ });
52
+
53
+ const handleCellClick = (rowData: TData, columnId: string) => {
54
+ if (onCellClick) {
55
+ onCellClick(rowData, columnId);
56
+ }
57
+ };
58
+
59
+ return (
60
+ <div className="overflow-hidden rounded-md border w-full">
61
+ <Table>
62
+ <TableHeader>
63
+ {table.getHeaderGroups().map((headerGroup) => (
64
+ <TableRow key={headerGroup.id}>
65
+ {headerGroup.headers.map((header) => {
66
+ return (
67
+ <TableHead key={header.id}>
68
+ {header.isPlaceholder
69
+ ? null
70
+ : flexRender(
71
+ header.column.columnDef.header,
72
+ header.getContext()
73
+ )}
74
+ </TableHead>
75
+ );
76
+ })}
77
+ </TableRow>
78
+ ))}
79
+ </TableHeader>
80
+ <TableBody>
81
+ {loading ? (
82
+ <TableRow>
83
+ <TableCell colSpan={columns.length} className="h-24 text-center">
84
+ Loading...
85
+ </TableCell>
86
+ </TableRow>
87
+ ) : (
88
+ <>
89
+ {table.getRowModel().rows?.length ? (
90
+ table.getRowModel().rows.map((row) => (
91
+ <TableRow
92
+ key={row.id}
93
+ data-state={row.getIsSelected() && 'selected'}
94
+ className='relative group'
95
+ >
96
+ {row.getVisibleCells().map((cell) => {
97
+ const isCellClickable = cellClickEnabled(row.original, cell.column.id);
98
+ const dynamicClass = (cell.column.columnDef.meta as any)?.cellClass || '';
99
+ const dynamicStyle = (cell.column.columnDef.meta as any)?.cellStyle || {};
100
+
101
+ return (
102
+ <TableCell
103
+ key={cell.id}
104
+ className={`${dynamicClass} ${isCellClickable ? 'underline cursor-pointer' : ''}`}
105
+ style={dynamicStyle}
106
+ onClick={() => {
107
+ if (isCellClickable) {
108
+ handleCellClick(row.original, cell.column.id);
109
+ }
110
+ }}
111
+ >
112
+ {flexRender(cell.column.columnDef.cell, cell.getContext())}
113
+ </TableCell>
114
+ );
115
+ })}
116
+ {rowActions.length > 0 && (
117
+ <div className='absolute top-0 right-0 bg-white py-3 min-w-[100px] z-50 shadow-md flex items-center justify-center gap-3 p-2 opacity-0 group-hover:opacity-100 duration-300 h-full'>
118
+ {rowActions.map((action, index) => (
119
+ <p key={index} className='text-[#383838] text-[12px] cursor-pointer font-[400]'>{action.header}</p>
120
+ ))}
121
+ </div>
122
+ )}
123
+ </TableRow>
124
+ ))
125
+ ) : (
126
+ <TableRow>
127
+ <TableCell colSpan={columns.length} className="h-24 text-center">
128
+ No results.
129
+ </TableCell>
130
+ </TableRow>
131
+ )}
132
+ </>
133
+ )}
134
+ </TableBody>
135
+ </Table>
136
+ </div>
137
+ );
138
+ }
@@ -0,0 +1,258 @@
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+
5
+ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
6
+ import { CheckIcon, ChevronRightIcon, CircleIcon } from 'lucide-react';
7
+
8
+ import { cn } from '@/lib/utils';
9
+
10
+ function DropdownMenu({
11
+ ...props
12
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
13
+ return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />;
14
+ }
15
+
16
+ function DropdownMenuPortal({
17
+ ...props
18
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Portal>) {
19
+ return (
20
+ <DropdownMenuPrimitive.Portal data-slot="dropdown-menu-portal" {...props} />
21
+ );
22
+ }
23
+
24
+ function DropdownMenuTrigger({
25
+ ...props
26
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
27
+ return (
28
+ <DropdownMenuPrimitive.Trigger
29
+ data-slot="dropdown-menu-trigger"
30
+ {...props}
31
+ />
32
+ );
33
+ }
34
+
35
+ function DropdownMenuContent({
36
+ className,
37
+ sideOffset = 4,
38
+ ...props
39
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
40
+ return (
41
+ <DropdownMenuPrimitive.Portal>
42
+ <DropdownMenuPrimitive.Content
43
+ data-slot="dropdown-menu-content"
44
+ sideOffset={sideOffset}
45
+ className={cn(
46
+ 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 max-h-(--radix-dropdown-menu-content-available-height) min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md',
47
+ className
48
+ )}
49
+ {...props}
50
+ />
51
+ </DropdownMenuPrimitive.Portal>
52
+ );
53
+ }
54
+
55
+ function DropdownMenuGroup({
56
+ ...props
57
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Group>) {
58
+ return (
59
+ <DropdownMenuPrimitive.Group data-slot="dropdown-menu-group" {...props} />
60
+ );
61
+ }
62
+
63
+ function DropdownMenuItem({
64
+ className,
65
+ inset,
66
+ variant = 'default',
67
+ ...props
68
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Item> & {
69
+ inset?: boolean
70
+ variant?: 'default' | 'destructive'
71
+ }) {
72
+ return (
73
+ <DropdownMenuPrimitive.Item
74
+ data-slot="dropdown-menu-item"
75
+ data-inset={inset}
76
+ data-variant={variant}
77
+ className={cn(
78
+ 'focus:bg-accent focus:text-accent-foreground data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 dark:data-[variant=destructive]:focus:bg-destructive/20 data-[variant=destructive]:focus:text-destructive data-[variant=destructive]:*:[svg]:!text-destructive [&_svg:not([class*=\'text-\'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
79
+ className
80
+ )}
81
+ {...props}
82
+ />
83
+ );
84
+ }
85
+
86
+ function DropdownMenuCheckboxItem({
87
+ className,
88
+ children,
89
+ checked,
90
+ ...props
91
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.CheckboxItem>) {
92
+ return (
93
+ <DropdownMenuPrimitive.CheckboxItem
94
+ data-slot="dropdown-menu-checkbox-item"
95
+ className={cn(
96
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
97
+ className
98
+ )}
99
+ checked={checked}
100
+ {...props}
101
+ >
102
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
103
+ <DropdownMenuPrimitive.ItemIndicator>
104
+ <CheckIcon className="size-4" />
105
+ </DropdownMenuPrimitive.ItemIndicator>
106
+ </span>
107
+ {children}
108
+ </DropdownMenuPrimitive.CheckboxItem>
109
+ );
110
+ }
111
+
112
+ function DropdownMenuRadioGroup({
113
+ ...props
114
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioGroup>) {
115
+ return (
116
+ <DropdownMenuPrimitive.RadioGroup
117
+ data-slot="dropdown-menu-radio-group"
118
+ {...props}
119
+ />
120
+ );
121
+ }
122
+
123
+ function DropdownMenuRadioItem({
124
+ className,
125
+ children,
126
+ ...props
127
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.RadioItem>) {
128
+ return (
129
+ <DropdownMenuPrimitive.RadioItem
130
+ data-slot="dropdown-menu-radio-item"
131
+ className={cn(
132
+ 'focus:bg-accent focus:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4',
133
+ className
134
+ )}
135
+ {...props}
136
+ >
137
+ <span className="pointer-events-none absolute left-2 flex size-3.5 items-center justify-center">
138
+ <DropdownMenuPrimitive.ItemIndicator>
139
+ <CircleIcon className="size-2 fill-current" />
140
+ </DropdownMenuPrimitive.ItemIndicator>
141
+ </span>
142
+ {children}
143
+ </DropdownMenuPrimitive.RadioItem>
144
+ );
145
+ }
146
+
147
+ function DropdownMenuLabel({
148
+ className,
149
+ inset,
150
+ ...props
151
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Label> & {
152
+ inset?: boolean
153
+ }) {
154
+ return (
155
+ <DropdownMenuPrimitive.Label
156
+ data-slot="dropdown-menu-label"
157
+ data-inset={inset}
158
+ className={cn(
159
+ 'px-2 py-1.5 text-sm font-medium data-[inset]:pl-8',
160
+ className
161
+ )}
162
+ {...props}
163
+ />
164
+ );
165
+ }
166
+
167
+ function DropdownMenuSeparator({
168
+ className,
169
+ ...props
170
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
171
+ return (
172
+ <DropdownMenuPrimitive.Separator
173
+ data-slot="dropdown-menu-separator"
174
+ className={cn('bg-border -mx-1 my-1 h-px', className)}
175
+ {...props}
176
+ />
177
+ );
178
+ }
179
+
180
+ function DropdownMenuShortcut({
181
+ className,
182
+ ...props
183
+ }: React.ComponentProps<'span'>) {
184
+ return (
185
+ <span
186
+ data-slot="dropdown-menu-shortcut"
187
+ className={cn(
188
+ 'text-muted-foreground ml-auto text-xs tracking-widest',
189
+ className
190
+ )}
191
+ {...props}
192
+ />
193
+ );
194
+ }
195
+
196
+ function DropdownMenuSub({
197
+ ...props
198
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.Sub>) {
199
+ return <DropdownMenuPrimitive.Sub data-slot="dropdown-menu-sub" {...props} />;
200
+ }
201
+
202
+ function DropdownMenuSubTrigger({
203
+ className,
204
+ inset,
205
+ children,
206
+ ...props
207
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubTrigger> & {
208
+ inset?: boolean
209
+ }) {
210
+ return (
211
+ <DropdownMenuPrimitive.SubTrigger
212
+ data-slot="dropdown-menu-sub-trigger"
213
+ data-inset={inset}
214
+ className={cn(
215
+ 'focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[inset]:pl-8',
216
+ className
217
+ )}
218
+ {...props}
219
+ >
220
+ {children}
221
+ <ChevronRightIcon className="ml-auto size-4" />
222
+ </DropdownMenuPrimitive.SubTrigger>
223
+ );
224
+ }
225
+
226
+ function DropdownMenuSubContent({
227
+ className,
228
+ ...props
229
+ }: React.ComponentProps<typeof DropdownMenuPrimitive.SubContent>) {
230
+ return (
231
+ <DropdownMenuPrimitive.SubContent
232
+ data-slot="dropdown-menu-sub-content"
233
+ className={cn(
234
+ 'bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg',
235
+ className
236
+ )}
237
+ {...props}
238
+ />
239
+ );
240
+ }
241
+
242
+ export {
243
+ DropdownMenu,
244
+ DropdownMenuPortal,
245
+ DropdownMenuTrigger,
246
+ DropdownMenuContent,
247
+ DropdownMenuGroup,
248
+ DropdownMenuLabel,
249
+ DropdownMenuItem,
250
+ DropdownMenuCheckboxItem,
251
+ DropdownMenuRadioGroup,
252
+ DropdownMenuRadioItem,
253
+ DropdownMenuSeparator,
254
+ DropdownMenuShortcut,
255
+ DropdownMenuSub,
256
+ DropdownMenuSubTrigger,
257
+ DropdownMenuSubContent,
258
+ };
@@ -0,0 +1,21 @@
1
+ import * as React from "react"
2
+
3
+ import { cn } from "@/lib/utils"
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
13
+ "aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
14
+ className
15
+ )}
16
+ {...props}
17
+ />
18
+ )
19
+ }
20
+
21
+ export { Input }
@@ -0,0 +1,22 @@
1
+ import * as React from "react"
2
+ import * as LabelPrimitive from "@radix-ui/react-label"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ function Label({
7
+ className,
8
+ ...props
9
+ }: React.ComponentProps<typeof LabelPrimitive.Root>) {
10
+ return (
11
+ <LabelPrimitive.Root
12
+ data-slot="label"
13
+ className={cn(
14
+ "flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",
15
+ className
16
+ )}
17
+ {...props}
18
+ />
19
+ )
20
+ }
21
+
22
+ export { Label }
@@ -0,0 +1,46 @@
1
+ import * as React from "react"
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover"
3
+
4
+ import { cn } from "@/lib/utils"
5
+
6
+ function Popover({
7
+ ...props
8
+ }: React.ComponentProps<typeof PopoverPrimitive.Root>) {
9
+ return <PopoverPrimitive.Root data-slot="popover" {...props} />
10
+ }
11
+
12
+ function PopoverTrigger({
13
+ ...props
14
+ }: React.ComponentProps<typeof PopoverPrimitive.Trigger>) {
15
+ return <PopoverPrimitive.Trigger data-slot="popover-trigger" {...props} />
16
+ }
17
+
18
+ function PopoverContent({
19
+ className,
20
+ align = "center",
21
+ sideOffset = 4,
22
+ ...props
23
+ }: React.ComponentProps<typeof PopoverPrimitive.Content>) {
24
+ return (
25
+ <PopoverPrimitive.Portal>
26
+ <PopoverPrimitive.Content
27
+ data-slot="popover-content"
28
+ align={align}
29
+ sideOffset={sideOffset}
30
+ className={cn(
31
+ "bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out 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-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",
32
+ className
33
+ )}
34
+ {...props}
35
+ />
36
+ </PopoverPrimitive.Portal>
37
+ )
38
+ }
39
+
40
+ function PopoverAnchor({
41
+ ...props
42
+ }: React.ComponentProps<typeof PopoverPrimitive.Anchor>) {
43
+ return <PopoverPrimitive.Anchor data-slot="popover-anchor" {...props} />
44
+ }
45
+
46
+ export { Popover, PopoverTrigger, PopoverContent, PopoverAnchor }
@@ -0,0 +1,43 @@
1
+ import * as React from "react"
2
+ import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
3
+ import { CircleIcon } from "lucide-react"
4
+
5
+ import { cn } from "@/lib/utils"
6
+
7
+ function RadioGroup({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
11
+ return (
12
+ <RadioGroupPrimitive.Root
13
+ data-slot="radio-group"
14
+ className={cn("grid gap-3", className)}
15
+ {...props}
16
+ />
17
+ )
18
+ }
19
+
20
+ function RadioGroupItem({
21
+ className,
22
+ ...props
23
+ }: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
24
+ return (
25
+ <RadioGroupPrimitive.Item
26
+ data-slot="radio-group-item"
27
+ className={cn(
28
+ "border-input text-primary focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 aspect-square size-4 shrink-0 rounded-full border shadow-xs transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",
29
+ className
30
+ )}
31
+ {...props}
32
+ >
33
+ <RadioGroupPrimitive.Indicator
34
+ data-slot="radio-group-indicator"
35
+ className="relative flex items-center justify-center"
36
+ >
37
+ <CircleIcon className="fill-primary absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2" />
38
+ </RadioGroupPrimitive.Indicator>
39
+ </RadioGroupPrimitive.Item>
40
+ )
41
+ }
42
+
43
+ export { RadioGroup, RadioGroupItem }