@dinachi/cli 0.12.0 → 1.1.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/CHANGELOG.md +131 -0
- package/dist/index.js +73 -7
- package/package.json +1 -1
- package/templates/accordion/accordion.tsx +70 -12
- package/templates/agent/agent.tsx +1865 -0
- package/templates/agent/index.ts +52 -0
- package/templates/alert-dialog/alert-dialog.tsx +59 -19
- package/templates/alert-dialog/index.ts +2 -0
- package/templates/animated-icon/animated-icon.tsx +1 -0
- package/templates/animated-list/animated-list.tsx +2 -1
- package/templates/animated-tabs/animated-tabs.tsx +69 -5
- package/templates/autocomplete/autocomplete.tsx +188 -21
- package/templates/avatar/avatar.tsx +3 -0
- package/templates/badge/badge.tsx +1 -0
- package/templates/button/button.tsx +1 -0
- package/templates/card/card.tsx +6 -1
- package/templates/carousel/carousel.tsx +109 -24
- package/templates/checkbox/checkbox.tsx +61 -4
- package/templates/checkbox-group/checkbox-group.tsx +83 -8
- package/templates/collapsible/collapsible.tsx +15 -4
- package/templates/combobox/combobox.tsx +312 -26
- package/templates/compare-slider/compare-slider.tsx +104 -28
- package/templates/compare-slider/index.ts +1 -1
- package/templates/context-menu/context-menu.tsx +93 -24
- package/templates/dialog/dialog.tsx +53 -14
- package/templates/drawer/drawer.tsx +36 -8
- package/templates/expandable-card/expandable-card.tsx +70 -43
- package/templates/field/field.tsx +7 -1
- package/templates/fieldset/fieldset.tsx +2 -0
- package/templates/form/form.tsx +1 -0
- package/templates/hold-to-confirm/hold-to-confirm.tsx +100 -16
- package/templates/hold-to-confirm/index.ts +1 -1
- package/templates/input/input.tsx +60 -1
- package/templates/label/label.tsx +1 -0
- package/templates/link/link.tsx +1 -0
- package/templates/load-transition/load-transition.tsx +1 -0
- package/templates/marquee/marquee.tsx +1 -0
- package/templates/menu/menu.tsx +45 -12
- package/templates/menubar/menubar.tsx +41 -11
- package/templates/meter/meter.tsx +5 -1
- package/templates/navigation-menu/navigation-menu.tsx +79 -24
- package/templates/number-field/index.ts +1 -0
- package/templates/number-field/number-field.tsx +77 -2
- package/templates/number-ticker/number-ticker.tsx +3 -0
- package/templates/otp-field/otp-field.tsx +61 -11
- package/templates/popover/popover.tsx +36 -7
- package/templates/preview-card/preview-card.tsx +27 -5
- package/templates/progress/progress.tsx +5 -1
- package/templates/progress-ring/progress-ring.tsx +1 -0
- package/templates/radio/radio.tsx +74 -6
- package/templates/scroll-area/scroll-area.tsx +14 -4
- package/templates/scroll-progress/scroll-progress.tsx +1 -0
- package/templates/scroll-reveal/scroll-reveal.tsx +1 -0
- package/templates/select/select.tsx +241 -12
- package/templates/separator/separator.tsx +1 -0
- package/templates/skeleton/skeleton.tsx +1 -0
- package/templates/slider/slider.tsx +84 -8
- package/templates/sortable/sortable.tsx +79 -9
- package/templates/stagger-list/stagger-list.tsx +2 -0
- package/templates/streaming-text/streaming-text.tsx +1 -0
- package/templates/swipeable-row/index.ts +1 -1
- package/templates/swipeable-row/swipeable-row.tsx +126 -41
- package/templates/switch/switch.tsx +43 -4
- package/templates/tabs/tabs.tsx +79 -10
- package/templates/text/text.tsx +1 -0
- package/templates/text-morph/text-morph.tsx +2 -0
- package/templates/text-shimmer/text-shimmer.tsx +1 -0
- package/templates/textarea/index.ts +1 -1
- package/templates/textarea/textarea.tsx +71 -4
- package/templates/toast/toast.tsx +13 -2
- package/templates/toggle/toggle.tsx +40 -7
- package/templates/toggle-group/toggle-group.tsx +98 -18
- package/templates/toolbar/toolbar.tsx +6 -0
- package/templates/tooltip/tooltip.tsx +9 -3
|
@@ -4,19 +4,164 @@ import * as React from "react"
|
|
|
4
4
|
import { Autocomplete as AutocompletePrimitive } from "@base-ui/react/autocomplete"
|
|
5
5
|
import { ChevronDown, X } from "lucide-react"
|
|
6
6
|
import { cn } from "@/lib/utils"
|
|
7
|
+
import {
|
|
8
|
+
agentNodeText,
|
|
9
|
+
changeAsAgent,
|
|
10
|
+
useAgentControl,
|
|
11
|
+
useAgentState,
|
|
12
|
+
useHasAgent,
|
|
13
|
+
useMergedRef,
|
|
14
|
+
waitForAgent,
|
|
15
|
+
type AgentControl,
|
|
16
|
+
} from "@/components/ui/agent"
|
|
7
17
|
|
|
8
|
-
|
|
18
|
+
type ElementRef = React.MutableRefObject<HTMLElement | null>
|
|
19
|
+
|
|
20
|
+
interface AutocompleteAgent {
|
|
21
|
+
input: ElementRef
|
|
22
|
+
list: ElementRef
|
|
23
|
+
/** Suggestions in the open list, by element. */
|
|
24
|
+
items: Set<HTMLElement>
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const AutocompleteAgentContext = React.createContext<AutocompleteAgent | null>(null)
|
|
28
|
+
|
|
29
|
+
type ToText = ((item: never) => string) | undefined
|
|
30
|
+
|
|
31
|
+
/** Base UI's own text for an item: `itemToStringValue`, then `label`, then `value`. */
|
|
32
|
+
function textOf(item: unknown, toText: ToText): string {
|
|
33
|
+
if (toText) return (toText as (i: unknown) => string)(item) ?? ""
|
|
34
|
+
const o = item as { label?: unknown; value?: unknown }
|
|
35
|
+
return String(item && typeof item === "object" ? (o.label ?? o.value ?? "") : item)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const leavesOf = (data: readonly unknown[] = []) =>
|
|
39
|
+
data.flatMap((e) => ((e as { items?: unknown })?.items instanceof Array ? (e as { items: unknown[] }).items : [e]))
|
|
40
|
+
|
|
41
|
+
const liveOf = (items: Set<HTMLElement>) => Array.from(items, (el) => agentNodeText(el.textContent))
|
|
42
|
+
|
|
43
|
+
/** Waits a turn for React to filter, then for the list to be open with every item registered. */
|
|
44
|
+
async function settled({ list, items }: AutocompleteAgent) {
|
|
45
|
+
await new Promise((resolve) => setTimeout(resolve))
|
|
46
|
+
await waitForAgent(
|
|
47
|
+
() => list.current?.isConnected && list.current.querySelectorAll('[role="option"]').length === items.size
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
interface AutocompleteState {
|
|
52
|
+
s: AutocompleteAgent
|
|
53
|
+
value: string
|
|
54
|
+
open: boolean
|
|
55
|
+
catalog: string[]
|
|
56
|
+
disabled: boolean
|
|
57
|
+
change: (text: string) => string | undefined
|
|
58
|
+
setOpen: (open: boolean) => string | undefined
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function autocompleteControl(c: AutocompleteState): AgentControl {
|
|
62
|
+
const live = liveOf(c.s.items)
|
|
63
|
+
const items = live.length ? live : c.catalog
|
|
64
|
+
return {
|
|
65
|
+
kind: "combobox",
|
|
66
|
+
element: c.s.input.current,
|
|
67
|
+
value: c.value,
|
|
68
|
+
disabled: c.disabled,
|
|
69
|
+
...(items.length ? { items } : {}),
|
|
70
|
+
actions: {
|
|
71
|
+
setValue: (text: unknown) => c.change(String(text ?? "")),
|
|
72
|
+
search: async (text: unknown) => {
|
|
73
|
+
const query = String(text ?? "")
|
|
74
|
+
// Opens first, so a refusal at either step leaves the text and the list as they were.
|
|
75
|
+
const notOpened = c.open ? undefined : c.setOpen(true)
|
|
76
|
+
if (notOpened) return notOpened
|
|
77
|
+
const refused = c.change(query)
|
|
78
|
+
if (refused) {
|
|
79
|
+
if (!c.open) c.setOpen(false)
|
|
80
|
+
return refused
|
|
81
|
+
}
|
|
82
|
+
await settled(c.s)
|
|
83
|
+
return { result: liveOf(c.s.items) }
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
type RootProps = AutocompletePrimitive.Root.Props<unknown>
|
|
90
|
+
type Details = AutocompletePrimitive.Root.ChangeEventDetails
|
|
91
|
+
type OpenDetails = AutocompletePrimitive.Root.OpenChangeEventDetails
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Base UI's root, holding its text and open state inside AgentProvider so an agent can
|
|
95
|
+
* set them the way a parent would. Every change, the agent's included, goes through
|
|
96
|
+
* `onValueChange` and `onOpenChange` first, which can cancel it.
|
|
97
|
+
*/
|
|
98
|
+
function AgentAutocomplete({
|
|
99
|
+
value: valueProp,
|
|
100
|
+
defaultValue = "",
|
|
101
|
+
onValueChange,
|
|
102
|
+
open: openProp,
|
|
103
|
+
defaultOpen = false,
|
|
104
|
+
onOpenChange,
|
|
105
|
+
...props
|
|
106
|
+
}: RootProps) {
|
|
107
|
+
const [value, changeValue] = useAgentState<string, Details>(
|
|
108
|
+
valueProp == null ? undefined : String(valueProp),
|
|
109
|
+
String(defaultValue),
|
|
110
|
+
onValueChange
|
|
111
|
+
)
|
|
112
|
+
const [open, changeOpen] = useAgentState<boolean, OpenDetails>(openProp, defaultOpen, onOpenChange)
|
|
113
|
+
const [s] = React.useState<AutocompleteAgent>(() => ({
|
|
114
|
+
input: { current: null },
|
|
115
|
+
list: { current: null },
|
|
116
|
+
items: new Set(),
|
|
117
|
+
}))
|
|
118
|
+
|
|
119
|
+
useAgentControl(() =>
|
|
120
|
+
autocompleteControl({
|
|
121
|
+
s,
|
|
122
|
+
value,
|
|
123
|
+
open,
|
|
124
|
+
catalog: leavesOf(props.items).map((i) => textOf(i, props.itemToStringValue)),
|
|
125
|
+
disabled: Boolean(props.disabled),
|
|
126
|
+
change: (next) => (props.readOnly ? "The autocomplete is read-only." : changeAsAgent(changeValue, next)),
|
|
127
|
+
setOpen: (next) => changeAsAgent(changeOpen, next),
|
|
128
|
+
})
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
return (
|
|
132
|
+
<AutocompleteAgentContext.Provider value={s}>
|
|
133
|
+
<AutocompletePrimitive.Root
|
|
134
|
+
{...props}
|
|
135
|
+
value={value}
|
|
136
|
+
onValueChange={changeValue}
|
|
137
|
+
open={open}
|
|
138
|
+
onOpenChange={changeOpen}
|
|
139
|
+
/>
|
|
140
|
+
</AutocompleteAgentContext.Provider>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Base UI's root as it is, until an AgentProvider is around it. */
|
|
145
|
+
function AutocompleteRoot(props: RootProps) {
|
|
146
|
+
if (!useHasAgent()) return <AutocompletePrimitive.Root {...props} />
|
|
147
|
+
return <AgentAutocomplete {...props} />
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const Autocomplete = AutocompleteRoot as unknown as typeof AutocompletePrimitive.Root
|
|
9
151
|
const AutocompleteValue = AutocompletePrimitive.Value
|
|
10
152
|
const AutocompleteCollection = AutocompletePrimitive.Collection
|
|
11
153
|
const AutocompletePortal = AutocompletePrimitive.Portal
|
|
12
|
-
|
|
154
|
+
function AutocompleteInputGroup(props: React.ComponentProps<typeof AutocompletePrimitive.InputGroup>) {
|
|
155
|
+
return <AutocompletePrimitive.InputGroup data-slot="autocomplete-input-group" {...props} />
|
|
156
|
+
}
|
|
13
157
|
|
|
14
158
|
const AutocompleteInput = React.forwardRef<
|
|
15
159
|
React.ComponentRef<typeof AutocompletePrimitive.Input>,
|
|
16
160
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Input>
|
|
17
161
|
>(({ className, ...props }, ref) => (
|
|
18
162
|
<AutocompletePrimitive.Input
|
|
19
|
-
|
|
163
|
+
data-slot="autocomplete-input"
|
|
164
|
+
ref={useMergedRef(ref, React.useContext(AutocompleteAgentContext)?.input)}
|
|
20
165
|
className={cn(
|
|
21
166
|
"flex h-10 w-full bg-transparent px-3 py-2 text-sm",
|
|
22
167
|
"placeholder:text-muted-foreground",
|
|
@@ -34,6 +179,7 @@ const AutocompleteTrigger = React.forwardRef<
|
|
|
34
179
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Trigger>
|
|
35
180
|
>(({ className, children, ...props }, ref) => (
|
|
36
181
|
<AutocompletePrimitive.Trigger
|
|
182
|
+
data-slot="autocomplete-trigger"
|
|
37
183
|
ref={ref}
|
|
38
184
|
className={cn(
|
|
39
185
|
"inline-flex h-10 items-center justify-center px-3",
|
|
@@ -57,6 +203,7 @@ const AutocompleteClear = React.forwardRef<
|
|
|
57
203
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Clear>
|
|
58
204
|
>(({ className, children, ...props }, ref) => (
|
|
59
205
|
<AutocompletePrimitive.Clear
|
|
206
|
+
data-slot="autocomplete-clear"
|
|
60
207
|
ref={ref}
|
|
61
208
|
className={cn(
|
|
62
209
|
"inline-flex h-8 w-8 items-center justify-center rounded-sm text-muted-foreground",
|
|
@@ -79,6 +226,7 @@ const AutocompleteContent = React.forwardRef<
|
|
|
79
226
|
const content = (
|
|
80
227
|
<AutocompletePrimitive.Positioner sideOffset={4}>
|
|
81
228
|
<AutocompletePrimitive.Popup
|
|
229
|
+
data-slot="autocomplete-content"
|
|
82
230
|
ref={ref}
|
|
83
231
|
className={cn(
|
|
84
232
|
"relative z-50 min-w-[var(--anchor-width)] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md",
|
|
@@ -105,7 +253,8 @@ const AutocompleteList = React.forwardRef<
|
|
|
105
253
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.List>
|
|
106
254
|
>(({ className, ...props }, ref) => (
|
|
107
255
|
<AutocompletePrimitive.List
|
|
108
|
-
|
|
256
|
+
data-slot="autocomplete-list"
|
|
257
|
+
ref={useMergedRef(ref, React.useContext(AutocompleteAgentContext)?.list)}
|
|
109
258
|
className={cn("max-h-80 overflow-y-auto p-1", className)}
|
|
110
259
|
{...props}
|
|
111
260
|
/>
|
|
@@ -117,28 +266,43 @@ const AutocompleteItem = React.forwardRef<
|
|
|
117
266
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Item> & {
|
|
118
267
|
inset?: boolean
|
|
119
268
|
}
|
|
120
|
-
>(({ className, children, inset, ...props }, ref) =>
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
269
|
+
>(({ className, children, inset, ...props }, ref) => {
|
|
270
|
+
const autocomplete = React.useContext(AutocompleteAgentContext)
|
|
271
|
+
const element = React.useRef<HTMLDivElement | null>(null)
|
|
272
|
+
|
|
273
|
+
React.useEffect(() => {
|
|
274
|
+
const el = element.current
|
|
275
|
+
if (!autocomplete || !el) return
|
|
276
|
+
autocomplete.items.add(el)
|
|
277
|
+
return () => {
|
|
278
|
+
autocomplete.items.delete(el)
|
|
279
|
+
}
|
|
280
|
+
}, [autocomplete])
|
|
281
|
+
|
|
282
|
+
return (
|
|
283
|
+
<AutocompletePrimitive.Item
|
|
284
|
+
data-slot="autocomplete-item"
|
|
285
|
+
ref={useMergedRef(ref, element)}
|
|
286
|
+
className={cn(
|
|
287
|
+
"relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm lg:text-base outline-none",
|
|
288
|
+
"data-highlighted:bg-accent font-normal data-highlighted:text-accent-foreground",
|
|
289
|
+
"data-disabled:pointer-events-none data-disabled:opacity-50",
|
|
290
|
+
inset && "pl-8",
|
|
291
|
+
className
|
|
292
|
+
)}
|
|
293
|
+
{...props}
|
|
294
|
+
>
|
|
295
|
+
{children}
|
|
296
|
+
</AutocompletePrimitive.Item>
|
|
297
|
+
)
|
|
298
|
+
})
|
|
135
299
|
AutocompleteItem.displayName = "AutocompleteItem"
|
|
136
300
|
|
|
137
301
|
const AutocompleteGroup = React.forwardRef<
|
|
138
302
|
React.ComponentRef<typeof AutocompletePrimitive.Group>,
|
|
139
303
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Group>
|
|
140
304
|
>(({ className, ...props }, ref) => (
|
|
141
|
-
<AutocompletePrimitive.Group ref={ref} className={cn(className)} {...props} />
|
|
305
|
+
<AutocompletePrimitive.Group data-slot="autocomplete-group" ref={ref} className={cn(className)} {...props} />
|
|
142
306
|
))
|
|
143
307
|
AutocompleteGroup.displayName = "AutocompleteGroup"
|
|
144
308
|
|
|
@@ -147,6 +311,7 @@ const AutocompleteGroupLabel = React.forwardRef<
|
|
|
147
311
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.GroupLabel>
|
|
148
312
|
>(({ className, ...props }, ref) => (
|
|
149
313
|
<AutocompletePrimitive.GroupLabel
|
|
314
|
+
data-slot="autocomplete-group-label"
|
|
150
315
|
ref={ref}
|
|
151
316
|
className={cn("px-2 py-1.5 text-xs font-medium text-muted-foreground", className)}
|
|
152
317
|
{...props}
|
|
@@ -159,6 +324,7 @@ const AutocompleteEmpty = React.forwardRef<
|
|
|
159
324
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Empty>
|
|
160
325
|
>(({ className, ...props }, ref) => (
|
|
161
326
|
<AutocompletePrimitive.Empty
|
|
327
|
+
data-slot="autocomplete-empty"
|
|
162
328
|
ref={ref}
|
|
163
329
|
className={cn("p-2 text-center text-sm text-muted-foreground", className)}
|
|
164
330
|
{...props}
|
|
@@ -170,7 +336,7 @@ const AutocompleteStatus = React.forwardRef<
|
|
|
170
336
|
React.ComponentRef<typeof AutocompletePrimitive.Status>,
|
|
171
337
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Status>
|
|
172
338
|
>(({ className, ...props }, ref) => (
|
|
173
|
-
<AutocompletePrimitive.Status ref={ref} className={cn("sr-only", className)} {...props} />
|
|
339
|
+
<AutocompletePrimitive.Status data-slot="autocomplete-status" ref={ref} className={cn("sr-only", className)} {...props} />
|
|
174
340
|
))
|
|
175
341
|
AutocompleteStatus.displayName = "AutocompleteStatus"
|
|
176
342
|
|
|
@@ -179,6 +345,7 @@ const AutocompleteSeparator = React.forwardRef<
|
|
|
179
345
|
React.ComponentPropsWithoutRef<typeof AutocompletePrimitive.Separator>
|
|
180
346
|
>(({ className, ...props }, ref) => (
|
|
181
347
|
<AutocompletePrimitive.Separator
|
|
348
|
+
data-slot="autocomplete-separator"
|
|
182
349
|
ref={ref}
|
|
183
350
|
className={cn("-mx-1 my-1 h-px bg-border", className)}
|
|
184
351
|
{...props}
|
|
@@ -25,6 +25,7 @@ const Avatar = React.forwardRef<
|
|
|
25
25
|
VariantProps<typeof avatarVariants>
|
|
26
26
|
>(({ className, size, ...props }, ref) => (
|
|
27
27
|
<BaseAvatar.Root
|
|
28
|
+
data-slot="avatar"
|
|
28
29
|
ref={ref}
|
|
29
30
|
className={cn(avatarVariants({ size }), className)}
|
|
30
31
|
{...props}
|
|
@@ -37,6 +38,7 @@ const AvatarImage = React.forwardRef<
|
|
|
37
38
|
React.ComponentPropsWithoutRef<typeof BaseAvatar.Image>
|
|
38
39
|
>(({ className, ...props }, ref) => (
|
|
39
40
|
<BaseAvatar.Image
|
|
41
|
+
data-slot="avatar-image"
|
|
40
42
|
ref={ref}
|
|
41
43
|
className={cn(
|
|
42
44
|
"absolute inset-0 z-[1] aspect-square h-full w-full object-cover data-[error]:invisible data-[loading]:invisible",
|
|
@@ -52,6 +54,7 @@ const AvatarFallback = React.forwardRef<
|
|
|
52
54
|
React.ComponentPropsWithoutRef<typeof BaseAvatar.Fallback>
|
|
53
55
|
>(({ className, ...props }, ref) => (
|
|
54
56
|
<BaseAvatar.Fallback
|
|
57
|
+
data-slot="avatar-fallback"
|
|
55
58
|
ref={ref}
|
|
56
59
|
className={cn(
|
|
57
60
|
"absolute inset-0 flex h-full w-full items-center justify-center rounded-full bg-muted",
|
|
@@ -59,6 +59,7 @@ const Button = React.forwardRef<HTMLElement, ButtonProps>(
|
|
|
59
59
|
({ className, variant, size, render, nativeButton, ...props }, ref) => {
|
|
60
60
|
return (
|
|
61
61
|
<BaseButton
|
|
62
|
+
data-slot="button"
|
|
62
63
|
className={cn(buttonVariants({ variant, size, className }))}
|
|
63
64
|
ref={ref}
|
|
64
65
|
render={render}
|
package/templates/card/card.tsx
CHANGED
|
@@ -6,6 +6,7 @@ const Card = React.forwardRef<
|
|
|
6
6
|
React.HTMLAttributes<HTMLDivElement>
|
|
7
7
|
>(({ className, ...props }, ref) => (
|
|
8
8
|
<div
|
|
9
|
+
data-slot="card"
|
|
9
10
|
ref={ref}
|
|
10
11
|
className={cn(
|
|
11
12
|
"rounded-lg border bg-card text-card-foreground shadow-sm",
|
|
@@ -21,6 +22,7 @@ const CardHeader = React.forwardRef<
|
|
|
21
22
|
React.HTMLAttributes<HTMLDivElement>
|
|
22
23
|
>(({ className, ...props }, ref) => (
|
|
23
24
|
<div
|
|
25
|
+
data-slot="card-header"
|
|
24
26
|
ref={ref}
|
|
25
27
|
className={cn("flex flex-col space-y-1.5 p-6", className)}
|
|
26
28
|
{...props}
|
|
@@ -33,6 +35,7 @@ const CardTitle = React.forwardRef<
|
|
|
33
35
|
React.HTMLAttributes<HTMLHeadingElement>
|
|
34
36
|
>(({ className, ...props }, ref) => (
|
|
35
37
|
<h3
|
|
38
|
+
data-slot="card-title"
|
|
36
39
|
ref={ref}
|
|
37
40
|
className={cn(
|
|
38
41
|
"text-2xl font-medium leading-none tracking-tight",
|
|
@@ -48,6 +51,7 @@ const CardDescription = React.forwardRef<
|
|
|
48
51
|
React.HTMLAttributes<HTMLParagraphElement>
|
|
49
52
|
>(({ className, ...props }, ref) => (
|
|
50
53
|
<p
|
|
54
|
+
data-slot="card-description"
|
|
51
55
|
ref={ref}
|
|
52
56
|
className={cn("text-sm text-muted-foreground", className)}
|
|
53
57
|
{...props}
|
|
@@ -59,7 +63,7 @@ const CardContent = React.forwardRef<
|
|
|
59
63
|
HTMLDivElement,
|
|
60
64
|
React.HTMLAttributes<HTMLDivElement>
|
|
61
65
|
>(({ className, ...props }, ref) => (
|
|
62
|
-
<div ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
66
|
+
<div data-slot="card-content" ref={ref} className={cn("p-6 pt-0", className)} {...props} />
|
|
63
67
|
))
|
|
64
68
|
CardContent.displayName = "CardContent"
|
|
65
69
|
|
|
@@ -68,6 +72,7 @@ const CardFooter = React.forwardRef<
|
|
|
68
72
|
React.HTMLAttributes<HTMLDivElement>
|
|
69
73
|
>(({ className, ...props }, ref) => (
|
|
70
74
|
<div
|
|
75
|
+
data-slot="card-footer"
|
|
71
76
|
ref={ref}
|
|
72
77
|
className={cn("flex items-center p-6 pt-0", className)}
|
|
73
78
|
{...props}
|