@dinachi/cli 1.0.0 → 1.3.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.
Files changed (105) hide show
  1. package/CHANGELOG.md +69 -0
  2. package/dist/index.js +244 -72
  3. package/package.json +5 -1
  4. package/templates/accordion/accordion.tsx +5 -1
  5. package/templates/agent/agent.tsx +35 -18
  6. package/templates/alert/alert.tsx +345 -0
  7. package/templates/alert/index.ts +16 -0
  8. package/templates/alert-dialog/alert-dialog.tsx +14 -3
  9. package/templates/animated-icon/animated-icon.tsx +1 -0
  10. package/templates/animated-list/animated-list.tsx +2 -1
  11. package/templates/animated-tabs/animated-tabs.tsx +4 -0
  12. package/templates/ask-bar/ask-bar.tsx +1061 -0
  13. package/templates/ask-bar/index.ts +1 -0
  14. package/templates/autocomplete/autocomplete.tsx +14 -4
  15. package/templates/avatar/avatar.tsx +3 -0
  16. package/templates/badge/badge.tsx +1 -0
  17. package/templates/breadcrumb/breadcrumb.tsx +606 -0
  18. package/templates/breadcrumb/index.ts +9 -0
  19. package/templates/button/button.tsx +1 -0
  20. package/templates/calendar/calendar.tsx +1155 -0
  21. package/templates/calendar/index.ts +15 -0
  22. package/templates/card/card.tsx +6 -1
  23. package/templates/carousel/carousel.tsx +7 -0
  24. package/templates/checkbox/checkbox.tsx +1 -0
  25. package/templates/checkbox-group/checkbox-group.tsx +1 -0
  26. package/templates/collapsible/collapsible.tsx +3 -1
  27. package/templates/combobox/combobox.tsx +15 -4
  28. package/templates/command-items/command-items.tsx +69 -0
  29. package/templates/command-items/index.ts +1 -0
  30. package/templates/command-palette/command-palette.tsx +954 -0
  31. package/templates/command-palette/index.ts +1 -0
  32. package/templates/compare-slider/compare-slider.tsx +1 -0
  33. package/templates/comparison-table/comparison-table.tsx +540 -0
  34. package/templates/comparison-table/index.ts +15 -0
  35. package/templates/context-menu/context-menu.tsx +61 -14
  36. package/templates/data-table/data-table.tsx +2077 -0
  37. package/templates/data-table/index.ts +14 -0
  38. package/templates/date-picker/date-picker.tsx +527 -0
  39. package/templates/date-picker/index.ts +2 -0
  40. package/templates/date-range-picker/date-range-picker.tsx +504 -0
  41. package/templates/date-range-picker/index.ts +2 -0
  42. package/templates/detail-list/detail-list.tsx +419 -0
  43. package/templates/detail-list/index.ts +12 -0
  44. package/templates/dialog/dialog.tsx +13 -3
  45. package/templates/drawer/drawer.tsx +19 -6
  46. package/templates/expandable-card/expandable-card.tsx +5 -1
  47. package/templates/field/field.tsx +5 -1
  48. package/templates/fieldset/fieldset.tsx +2 -0
  49. package/templates/form/form.tsx +1 -0
  50. package/templates/heat-table/heat-table.tsx +613 -0
  51. package/templates/heat-table/index.ts +9 -0
  52. package/templates/hold-to-confirm/hold-to-confirm.tsx +1 -0
  53. package/templates/input/input.tsx +1 -0
  54. package/templates/label/label.tsx +1 -0
  55. package/templates/link/link.tsx +1 -0
  56. package/templates/load-transition/load-transition.tsx +1 -0
  57. package/templates/marquee/marquee.tsx +1 -0
  58. package/templates/menu/menu.tsx +27 -6
  59. package/templates/menubar/menubar.tsx +15 -3
  60. package/templates/meter/meter.tsx +5 -1
  61. package/templates/month-picker/index.ts +1 -0
  62. package/templates/month-picker/month-picker.tsx +351 -0
  63. package/templates/navigation-menu/navigation-menu.tsx +13 -2
  64. package/templates/number-field/number-field.tsx +7 -1
  65. package/templates/number-ticker/number-ticker.tsx +3 -0
  66. package/templates/omnibar/index.ts +1 -0
  67. package/templates/omnibar/omnibar.tsx +1009 -0
  68. package/templates/otp-field/otp-field.tsx +4 -0
  69. package/templates/pagination/index.ts +8 -0
  70. package/templates/pagination/pagination.tsx +389 -0
  71. package/templates/popover/popover.tsx +19 -5
  72. package/templates/preview-card/preview-card.tsx +11 -3
  73. package/templates/progress/progress.tsx +5 -1
  74. package/templates/progress-ring/progress-ring.tsx +1 -0
  75. package/templates/radio/radio.tsx +3 -0
  76. package/templates/scroll-area/scroll-area.tsx +14 -4
  77. package/templates/scroll-progress/scroll-progress.tsx +1 -0
  78. package/templates/scroll-reveal/scroll-reveal.tsx +1 -0
  79. package/templates/select/select.tsx +18 -2
  80. package/templates/separator/separator.tsx +1 -0
  81. package/templates/skeleton/skeleton.tsx +1 -0
  82. package/templates/slider/slider.tsx +7 -0
  83. package/templates/sortable/sortable.tsx +3 -0
  84. package/templates/stagger-list/stagger-list.tsx +2 -0
  85. package/templates/streaming-text/streaming-text.tsx +1 -0
  86. package/templates/swipeable-row/swipeable-row.tsx +1 -0
  87. package/templates/switch/switch.tsx +2 -0
  88. package/templates/table/index.ts +13 -0
  89. package/templates/table/table.tsx +265 -0
  90. package/templates/tabs/tabs.tsx +5 -0
  91. package/templates/text/text.tsx +1 -0
  92. package/templates/text-morph/text-morph.tsx +2 -0
  93. package/templates/text-shimmer/text-shimmer.tsx +1 -0
  94. package/templates/textarea/textarea.tsx +1 -0
  95. package/templates/time-slots/index.ts +1 -0
  96. package/templates/time-slots/time-slots.tsx +589 -0
  97. package/templates/toast/toast.tsx +10 -1
  98. package/templates/toggle/toggle.tsx +1 -0
  99. package/templates/toggle-group/toggle-group.tsx +2 -0
  100. package/templates/toolbar/toolbar.tsx +6 -0
  101. package/templates/tooltip/tooltip.tsx +9 -3
  102. package/templates/week-strip/index.ts +1 -0
  103. package/templates/week-strip/week-strip.tsx +329 -0
  104. package/templates/year-view/index.ts +1 -0
  105. package/templates/year-view/year-view.tsx +362 -0
@@ -51,6 +51,7 @@ const OTPField = React.forwardRef<
51
51
  return (
52
52
  <OTPFieldPrimitive.Root
53
53
  ref={mergedRef}
54
+ data-slot="otp-field"
54
55
  className={cn(
55
56
  "flex items-center gap-2",
56
57
  "data-[disabled]:opacity-50",
@@ -70,6 +71,7 @@ const OTPFieldGroup = React.forwardRef<
70
71
  >(({ className, ...props }, ref) => (
71
72
  <div
72
73
  ref={ref}
74
+ data-slot="otp-field-group"
73
75
  className={cn("flex items-center", className)}
74
76
  {...props}
75
77
  />
@@ -82,6 +84,7 @@ const OTPFieldInput = React.forwardRef<
82
84
  >(({ className, ...props }, ref) => (
83
85
  <OTPFieldPrimitive.Input
84
86
  ref={ref}
87
+ data-slot="otp-field-input"
85
88
  // The root reports the whole code, so a slot is part of it rather than a control.
86
89
  data-agent-part={useHasAgent() ? "" : undefined}
87
90
  className={cn(
@@ -104,6 +107,7 @@ const OTPFieldSeparator = React.forwardRef<
104
107
  >(({ className, ...props }, ref) => (
105
108
  <OTPFieldPrimitive.Separator
106
109
  ref={ref}
110
+ data-slot="otp-field-separator"
107
111
  role="separator"
108
112
  className={cn("text-muted-foreground", className)}
109
113
  {...props}
@@ -0,0 +1,8 @@
1
+ export {
2
+ Pagination,
3
+ pageItems,
4
+ type PaginationProps,
5
+ type PaginationChangeDetails,
6
+ type PaginationChangeReason,
7
+ type PageItem,
8
+ } from "./pagination"
@@ -0,0 +1,389 @@
1
+ "use client"
2
+
3
+ import * as React from "react"
4
+ import { ChevronLeft, ChevronRight } from "lucide-react"
5
+ import { cn } from "@/lib/utils"
6
+ import { Button } from "@/components/ui/button"
7
+ import { changeAsAgent, useAgentControl, useAgentState, useHasAgent, useMergedRef } from "@/components/ui/agent"
8
+
9
+ export type PageItem = number | "gap"
10
+
11
+ /**
12
+ * The pages a bar shows. Past seven pages it always returns seven slots, so the bar keeps
13
+ * its width and the arrows stay under the pointer as the page changes.
14
+ */
15
+ export function pageItems(page: number, count: number): PageItem[] {
16
+ const total = Math.max(0, Math.floor(count))
17
+ if (total <= 7) return Array.from({ length: total }, (_, i) => i + 1)
18
+ const p = clampPage(page, total)
19
+ if (p <= 4) return [1, 2, 3, 4, 5, "gap", total]
20
+ if (p >= total - 3) return [1, "gap", total - 4, total - 3, total - 2, total - 1, total]
21
+ return [1, "gap", p - 1, p, p + 1, "gap", total]
22
+ }
23
+
24
+ function clampPage(page: number, count: number) {
25
+ const n = Number.isFinite(page) ? Math.round(page) : 1
26
+ return Math.min(Math.max(1, n), Math.max(1, count))
27
+ }
28
+
29
+ export type PaginationChangeReason = "page-press" | "previous" | "next" | "jump" | "none"
30
+
31
+ export interface PaginationChangeDetails {
32
+ reason: PaginationChangeReason | (string & {})
33
+ event?: Event
34
+ isCanceled: boolean
35
+ cancel(): void
36
+ }
37
+
38
+ function changeDetails(reason: PaginationChangeReason, event?: Event): PaginationChangeDetails {
39
+ const details: PaginationChangeDetails = {
40
+ reason,
41
+ event,
42
+ isCanceled: false,
43
+ cancel() {
44
+ details.isCanceled = true
45
+ },
46
+ }
47
+ return details
48
+ }
49
+
50
+ export interface PaginationProps extends Omit<React.HTMLAttributes<HTMLElement>, "onChange" | "defaultValue"> {
51
+ /** How many pages there are. Below one, the bar still shows page 1. */
52
+ count: number
53
+ /** The current page, from 1. */
54
+ page?: number
55
+ defaultPage?: number
56
+ /** Runs on every change, for people and agents. `details.cancel()` refuses it. */
57
+ onPageChange?: (page: number, details: PaginationChangeDetails) => void
58
+ /** Each page's URL. Pages then render as links, through Button's `render`. */
59
+ getHref?: (page: number) => string
60
+ /** `full` shows page numbers. `compact` reads Page 6 of 25, with the number as the jump field. */
61
+ variant?: "full" | "compact"
62
+ /** `lg` makes every target 44px, for touch. */
63
+ size?: "default" | "lg"
64
+ disabled?: boolean
65
+ }
66
+
67
+ const sizes = {
68
+ default: { field: "h-8 w-[3.25rem] text-[13px]", text: "text-[13px]", arrow: "h-8 w-8" },
69
+ lg: { field: "h-11 w-[5.25rem] rounded-xl text-[17px]", text: "text-[15px]", arrow: "h-11 w-11 rounded-xl border border-border text-foreground" },
70
+ }
71
+
72
+ /**
73
+ * Pages of a list: prev and next, the pages near the current one, and gaps that open a
74
+ * field to jump anywhere. The current page is the only filled shape.
75
+ */
76
+ const Pagination = React.forwardRef<HTMLElement, PaginationProps>((props, ref) => {
77
+ const {
78
+ count: countProp,
79
+ page: pageProp,
80
+ defaultPage = 1,
81
+ onPageChange,
82
+ getHref,
83
+ variant = "full",
84
+ size = "default",
85
+ disabled,
86
+ className,
87
+ "aria-label": ariaLabel = "Pagination",
88
+ ...rest
89
+ } = props
90
+ const hasAgent = useHasAgent()
91
+ const part = hasAgent ? "" : undefined
92
+ const count = Number.isFinite(countProp) ? Math.max(1, Math.floor(countProp)) : 1
93
+ const [raw, change] = useAgentState<number, PaginationChangeDetails>(pageProp, defaultPage, onPageChange)
94
+ const page = clampPage(raw, count)
95
+ const nav = React.useRef<HTMLElement | null>(null)
96
+ const navRef = useMergedRef(ref, nav)
97
+ const s = sizes[size]
98
+
99
+ // Which jump field is open: a gap's index, or the compact page number. A gap's index
100
+ // points at another slot once the page moves, so a new page closes it.
101
+ const [editing, setEditing] = React.useState<number | "current" | null>(null)
102
+ const [editingAt, setEditingAt] = React.useState(page)
103
+ if (editingAt !== page) {
104
+ setEditingAt(page)
105
+ if (editing !== null) setEditing(null)
106
+ }
107
+ // Where focus goes on the next render, once what had it is gone or disabled: the
108
+ // current page, or the gap a jump field was opened from.
109
+ const refocus = React.useRef<"current" | number | null>(null)
110
+
111
+ const go = (next: number, reason: PaginationChangeReason, event?: Event) => {
112
+ if (disabled || next === page || next < 1 || next > count) return false
113
+ const details = changeDetails(reason, event)
114
+ change(next, details)
115
+ return !details.isCanceled
116
+ }
117
+
118
+ // Pages with their own URL load it when the change comes from somewhere a link cannot.
119
+ const visit = (next: number) => {
120
+ if (getHref && typeof window !== "undefined") window.location.assign(getHref(next))
121
+ }
122
+
123
+ const pressLink = (next: number, reason: PaginationChangeReason) => (e: React.MouseEvent) => {
124
+ // A new tab or window leaves this page where it is.
125
+ if (e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey) return
126
+ // A refused change keeps the browser where it is too, so the app can route it itself.
127
+ if (!go(next, reason, e.nativeEvent) && next !== page) e.preventDefault()
128
+ }
129
+
130
+ React.useLayoutEffect(() => {
131
+ const target = refocus.current
132
+ if (target === null) return
133
+ refocus.current = null
134
+ const el =
135
+ target === "current"
136
+ ? nav.current?.querySelector('[aria-current="page"], [data-slot="pagination-current"]')
137
+ : nav.current?.querySelectorAll('[data-slot="pagination-gap"]')[target]
138
+ ;(el as HTMLElement | null | undefined)?.focus()
139
+ })
140
+
141
+ /* ---- agent ---- */
142
+ const whole = (value: unknown) => Number(String(value ?? "").trim() || NaN)
143
+ const to = (next: number) => {
144
+ if (next < 1 || next > count) return `Page ${next} is out of range. Pages run from 1 to ${count}.`
145
+ if (next === page) return undefined
146
+ return changeAsAgent((n: number, details: PaginationChangeDetails) => change(n, details), next) ?? visit(next)
147
+ }
148
+ const step = (steps: unknown, dir: 1 | -1) => {
149
+ const n = whole(steps)
150
+ return Number.isInteger(n) ? to(page + dir * n) : `"${String(steps)}" is not a whole number of pages.`
151
+ }
152
+
153
+ useAgentControl(() => ({
154
+ kind: "number",
155
+ element: nav.current,
156
+ value: page,
157
+ min: 1,
158
+ max: count,
159
+ step: 1,
160
+ disabled,
161
+ actions: {
162
+ setValue: (wanted: unknown) => {
163
+ const n = whole(wanted)
164
+ return Number.isInteger(n) ? to(n) : `"${String(wanted)}" is not a page number.`
165
+ },
166
+ increment: (steps: unknown = 1) => step(steps, 1),
167
+ decrement: (steps: unknown = 1) => step(steps, -1),
168
+ },
169
+ }))
170
+
171
+ /* ---- parts ---- */
172
+ // `opener` is the gap a field came from, as its place among the gaps.
173
+ const field = (label: string, opener: number | "current") => (
174
+ <JumpField
175
+ key="jump"
176
+ label={label}
177
+ page={page}
178
+ count={count}
179
+ className={s.field}
180
+ part={part}
181
+ onDone={(n, event, returnFocus) => {
182
+ setEditing(null)
183
+ if (returnFocus) refocus.current = n === null ? opener : "current"
184
+ if (n !== null && go(n, "jump", event)) visit(n)
185
+ }}
186
+ />
187
+ )
188
+
189
+ const arrow = (dir: -1 | 1) => {
190
+ const target = page + dir
191
+ const off = disabled || target < 1 || target > count
192
+ const href = getHref && !off ? getHref(target) : undefined
193
+ const reason = dir < 0 ? "previous" : "next"
194
+ return (
195
+ <Button
196
+ variant="ghost"
197
+ aria-label={dir < 0 ? "Previous page" : "Next page"}
198
+ data-slot={dir < 0 ? "pagination-previous" : "pagination-next"}
199
+ data-agent-part={part}
200
+ disabled={off}
201
+ render={href ? <a href={href} /> : undefined}
202
+ // Base UI names a non-button element a button; a link keeps its own role.
203
+ {...(href ? { role: undefined } : {})}
204
+ onClick={
205
+ href
206
+ ? pressLink(target, reason)
207
+ : (e: React.MouseEvent) => {
208
+ // The arrow is disabled at the end it reaches, which would drop focus.
209
+ if (go(target, reason, e.nativeEvent) && (target === 1 || target === count) && e.currentTarget === document.activeElement) {
210
+ refocus.current = "current"
211
+ }
212
+ }
213
+ }
214
+ className={cn("shrink-0 p-0 text-muted-foreground hover:text-foreground disabled:opacity-40", s.arrow)}
215
+ >
216
+ {dir < 0 ? <ChevronLeft className="size-4 rtl:rotate-180" aria-hidden /> : <ChevronRight className="size-4 rtl:rotate-180" aria-hidden />}
217
+ </Button>
218
+ )
219
+ }
220
+
221
+ // Every slot is as wide as the widest page number, so the bar never changes width.
222
+ const slot = { "--pagination-digits": String(count).length } as React.CSSProperties
223
+ const slotClass = cn(
224
+ "py-0 px-1.5 font-normal tabular-nums text-muted-foreground hover:text-foreground",
225
+ size === "lg"
226
+ ? "h-11 min-w-[max(2.75rem,calc(var(--pagination-digits)*1ch+0.75rem))] text-[15px]"
227
+ : "h-8 min-w-[max(2rem,calc(var(--pagination-digits)*1ch+0.75rem))] text-[13px]"
228
+ )
229
+
230
+ let middle: React.ReactNode
231
+ if (variant === "compact") {
232
+ middle =
233
+ editing === "current" ? (
234
+ field("Go to page", "current")
235
+ ) : (
236
+ <button
237
+ type="button"
238
+ data-slot="pagination-current"
239
+ data-agent-part={part}
240
+ aria-label={`Page ${page} of ${count}, go to page`}
241
+ disabled={disabled}
242
+ onClick={() => setEditing("current")}
243
+ className={cn(
244
+ "inline-block rounded-md px-2 tabular-nums transition-colors hover:bg-accent focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
245
+ size === "lg" && "rounded-[10px] px-3",
246
+ s.text,
247
+ // Last, so merging in the text size cannot drop the line height that sets the target.
248
+ size === "lg" ? "h-11 leading-[2.75rem]" : "h-8 leading-8"
249
+ )}
250
+ >
251
+ Page{" "}
252
+ <b
253
+ className="inline-block text-center font-medium underline decoration-[color:color-mix(in_oklab,var(--foreground)_40%,transparent)] decoration-dotted underline-offset-4"
254
+ style={{ minWidth: `${String(count).length}ch` }}
255
+ >
256
+ {page}
257
+ </b>{" "}
258
+ of {count}
259
+ </button>
260
+ )
261
+ } else {
262
+ const items = pageItems(page, count)
263
+ middle = items.map((item, i) =>
264
+ item === "gap" ? (
265
+ editing === i ? (
266
+ field(`Page 1 to ${count}`, items.slice(0, i).filter((x) => x === "gap").length)
267
+ ) : (
268
+ <Button
269
+ key={`gap-${i}`}
270
+ variant="ghost"
271
+ data-slot="pagination-gap"
272
+ data-agent-part={part}
273
+ aria-label="Jump to a page"
274
+ disabled={disabled}
275
+ onClick={() => setEditing(i)}
276
+ style={slot}
277
+ className={cn(slotClass, "tracking-[1px]")}
278
+ >
279
+ …
280
+ </Button>
281
+ )
282
+ ) : (
283
+ <Button
284
+ // Keyed by slot, not page, so a shifting window changes the numbers in place
285
+ // instead of sliding the current page's fill across the row.
286
+ key={`page-${i}`}
287
+ variant="ghost"
288
+ data-slot="pagination-page"
289
+ data-agent-part={part}
290
+ aria-label={`Page ${item}`}
291
+ aria-current={item === page ? "page" : undefined}
292
+ disabled={disabled}
293
+ render={getHref && !disabled ? <a href={getHref(item)} /> : undefined}
294
+ {...(getHref && !disabled ? { role: undefined } : {})}
295
+ onClick={(e: React.MouseEvent) => {
296
+ // The slot pressed may show another page next render, so focus follows the page.
297
+ if (document.activeElement === e.currentTarget) refocus.current = "current"
298
+ if (getHref && !disabled) pressLink(item, "page-press")(e)
299
+ else go(item, "page-press", e.nativeEvent)
300
+ }}
301
+ style={slot}
302
+ className={cn(
303
+ slotClass,
304
+ "aria-[current=page]:bg-primary aria-[current=page]:font-medium aria-[current=page]:text-primary-foreground",
305
+ "aria-[current=page]:hover:bg-primary aria-[current=page]:hover:text-primary-foreground"
306
+ )}
307
+ >
308
+ {item}
309
+ </Button>
310
+ )
311
+ )
312
+ }
313
+
314
+ return (
315
+ <nav
316
+ {...rest}
317
+ ref={navRef}
318
+ aria-label={ariaLabel}
319
+ data-slot="pagination"
320
+ data-variant={variant}
321
+ data-disabled={disabled || undefined}
322
+ className={cn("inline-flex items-center", variant === "compact" ? (size === "lg" ? "gap-1" : "gap-1.5") : "gap-0.5", s.text, className)}
323
+ >
324
+ {arrow(-1)}
325
+ {middle}
326
+ {arrow(1)}
327
+ </nav>
328
+ )
329
+ })
330
+ Pagination.displayName = "Pagination"
331
+
332
+ /** The go-to-page field a gap or the compact page number opens into. */
333
+ function JumpField({
334
+ label,
335
+ page,
336
+ count,
337
+ className,
338
+ part,
339
+ onDone,
340
+ }: {
341
+ label: string
342
+ page: number
343
+ count: number
344
+ className: string
345
+ part: string | undefined
346
+ /** `returnFocus` is false on blur, where focus has already gone where the person sent it. */
347
+ onDone: (page: number | null, event: Event | undefined, returnFocus: boolean) => void
348
+ }) {
349
+ const input = React.useRef<HTMLInputElement>(null)
350
+ const done = React.useRef(false)
351
+ React.useLayoutEffect(() => {
352
+ input.current?.focus()
353
+ }, [])
354
+ const finish = (commit: boolean, returnFocus: boolean, event?: Event) => {
355
+ if (done.current) return
356
+ done.current = true
357
+ const n = parseInt(input.current?.value ?? "", 10)
358
+ onDone(commit && Number.isFinite(n) ? clampPage(n, count) : null, event, returnFocus)
359
+ }
360
+ return (
361
+ // A plain input rather than Input, so the field stays part of this control for the agent.
362
+ <input
363
+ ref={input}
364
+ data-slot="pagination-jump"
365
+ data-agent-part={part}
366
+ inputMode="numeric"
367
+ autoComplete="off"
368
+ aria-label={label}
369
+ placeholder={String(page)}
370
+ onKeyDown={(e) => {
371
+ if (e.key === "Enter") {
372
+ e.preventDefault()
373
+ finish(true, true, e.nativeEvent)
374
+ } else if (e.key === "Escape") {
375
+ e.preventDefault()
376
+ finish(false, true)
377
+ }
378
+ }}
379
+ onBlur={(e) => finish(true, false, e.nativeEvent)}
380
+ className={cn(
381
+ "shrink-0 rounded-md border border-input bg-background px-1 text-center tabular-nums outline-none placeholder:text-muted-foreground",
382
+ "focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-[color:color-mix(in_oklab,var(--ring)_50%,transparent)]",
383
+ className
384
+ )}
385
+ />
386
+ )
387
+ }
388
+
389
+ export { Pagination }
@@ -19,10 +19,17 @@ function Popover<Payload>({ open, defaultOpen, onOpenChange, ...props }: Popover
19
19
 
20
20
  function PopoverTrigger<Payload>({ ref, ...props }: PopoverPrimitive.Trigger.Props<Payload> & React.RefAttributes<HTMLElement>) {
21
21
  const parts = React.useContext(PopoverAgentContext)
22
- return <PopoverPrimitive.Trigger<Payload> ref={useMergedRef(ref, parts?.trigger)} {...props} />
22
+ return <PopoverPrimitive.Trigger<Payload> ref={useMergedRef(ref, parts?.trigger)} data-slot="popover-trigger" {...props} />
23
23
  }
24
- const PopoverPortal = PopoverPrimitive.Portal
25
- const PopoverClose = PopoverPrimitive.Close
24
+
25
+ function PopoverPortal(props: React.ComponentProps<typeof PopoverPrimitive.Portal>) {
26
+ return <PopoverPrimitive.Portal data-slot="popover-portal" {...props} />
27
+ }
28
+
29
+ function PopoverClose(props: React.ComponentProps<typeof PopoverPrimitive.Close>) {
30
+ return <PopoverPrimitive.Close data-slot="popover-close" {...props} />
31
+ }
32
+
26
33
  const createPopoverHandle = PopoverPrimitive.createHandle
27
34
 
28
35
  const PopoverPositioner = React.forwardRef<
@@ -33,6 +40,7 @@ const PopoverPositioner = React.forwardRef<
33
40
  ref={ref}
34
41
  sideOffset={sideOffset}
35
42
  className={cn("z-50", className)}
43
+ data-slot="popover-positioner"
36
44
  {...props}
37
45
  />
38
46
  ))
@@ -53,6 +61,7 @@ const PopoverPopup = React.forwardRef<
53
61
  "motion-reduce:data-[starting-style]:scale-100 motion-reduce:data-[ending-style]:scale-100",
54
62
  className
55
63
  )}
64
+ data-slot="popover-popup"
56
65
  {...props}
57
66
  />
58
67
  ))
@@ -92,13 +101,13 @@ const PopoverContent = React.forwardRef<
92
101
  collisionPadding={collisionPadding}
93
102
  sticky={sticky}
94
103
  >
95
- <PopoverPopup ref={ref} className={className} {...props} />
104
+ <PopoverPopup ref={ref} className={className} data-slot="popover-content" {...props} />
96
105
  </PopoverPositioner>
97
106
  )
98
107
 
99
108
  if (!portal) return content
100
109
 
101
- return <PopoverPrimitive.Portal>{content}</PopoverPrimitive.Portal>
110
+ return <PopoverPortal>{content}</PopoverPortal>
102
111
  })
103
112
  PopoverContent.displayName = "PopoverContent"
104
113
 
@@ -115,6 +124,7 @@ const PopoverArrow = React.forwardRef<
115
124
  "data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",
116
125
  className
117
126
  )}
127
+ data-slot="popover-arrow"
118
128
  {...props}
119
129
  >
120
130
  {children || (
@@ -144,6 +154,7 @@ const PopoverViewport = React.forwardRef<
144
154
  <PopoverPrimitive.Viewport
145
155
  ref={ref}
146
156
  className={cn("flex flex-col gap-2", className)}
157
+ data-slot="popover-viewport"
147
158
  {...props}
148
159
  />
149
160
  ))
@@ -156,6 +167,7 @@ const PopoverTitle = React.forwardRef<
156
167
  <PopoverPrimitive.Title
157
168
  ref={ref}
158
169
  className={cn("mb-2 text-base font-medium leading-none", className)}
170
+ data-slot="popover-title"
159
171
  {...props}
160
172
  />
161
173
  ))
@@ -168,6 +180,7 @@ const PopoverDescription = React.forwardRef<
168
180
  <PopoverPrimitive.Description
169
181
  ref={ref}
170
182
  className={cn("text-base text-muted-foreground", className)}
183
+ data-slot="popover-description"
171
184
  {...props}
172
185
  />
173
186
  ))
@@ -185,6 +198,7 @@ const PopoverBackdrop = React.forwardRef<
185
198
  "transition-opacity duration-[var(--motion-duration-fast,150ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))]",
186
199
  className
187
200
  )}
201
+ data-slot="popover-backdrop"
188
202
  {...props}
189
203
  />
190
204
  ))
@@ -33,12 +33,15 @@ const PreviewCardTrigger = React.forwardRef<
33
33
  "dark:text-blue-400 dark:decoration-blue-400/60 dark:focus-visible:outline-blue-400",
34
34
  className
35
35
  )}
36
+ data-slot="preview-card-trigger"
36
37
  {...props}
37
38
  />
38
39
  ))
39
40
  PreviewCardTrigger.displayName = "PreviewCardTrigger"
40
41
 
41
- const PreviewCardPortal = BasePreviewCard.Portal
42
+ function PreviewCardPortal(props: React.ComponentProps<typeof BasePreviewCard.Portal>) {
43
+ return <BasePreviewCard.Portal data-slot="preview-card-portal" {...props} />
44
+ }
42
45
 
43
46
  const PreviewCardBackdrop = React.forwardRef<
44
47
  React.ComponentRef<typeof BasePreviewCard.Backdrop>,
@@ -51,6 +54,7 @@ const PreviewCardBackdrop = React.forwardRef<
51
54
  "data-[starting-style]:opacity-0 data-[ending-style]:opacity-0",
52
55
  className
53
56
  )}
57
+ data-slot="preview-card-backdrop"
54
58
  {...props}
55
59
  />
56
60
  ))
@@ -64,6 +68,7 @@ const PreviewCardPositioner = React.forwardRef<
64
68
  ref={ref}
65
69
  sideOffset={sideOffset}
66
70
  className={cn("z-50", className)}
71
+ data-slot="preview-card-positioner"
67
72
  {...props}
68
73
  />
69
74
  ))
@@ -85,6 +90,7 @@ const PreviewCardPopup = React.forwardRef<
85
90
  "backdrop-blur-sm dark:shadow-none dark:-outline-offset-1",
86
91
  className
87
92
  )}
93
+ data-slot="preview-card-popup"
88
94
  {...props}
89
95
  />
90
96
  ))
@@ -102,6 +108,7 @@ const PreviewCardArrow = React.forwardRef<
102
108
  "data-[side=top]:bottom-[-8px] data-[side=top]:rotate-180",
103
109
  className
104
110
  )}
111
+ data-slot="preview-card-arrow"
105
112
  {...props}
106
113
  >
107
114
  {children || <PreviewCardArrowSvg />}
@@ -115,7 +122,7 @@ const PreviewCardContent = React.forwardRef<
115
122
  >(({ className, children, ...props }, ref) => (
116
123
  <PreviewCardPortal>
117
124
  <PreviewCardPositioner>
118
- <PreviewCardPopup ref={ref} className={className} {...props}>
125
+ <PreviewCardPopup ref={ref} className={className} data-slot="preview-card-content" {...props}>
119
126
  <PreviewCardArrow />
120
127
  {children}
121
128
  </PreviewCardPopup>
@@ -131,6 +138,7 @@ const PreviewCardViewport = React.forwardRef<
131
138
  <BasePreviewCard.Viewport
132
139
  ref={ref}
133
140
  className={cn("flex flex-col gap-3", className)}
141
+ data-slot="preview-card-viewport"
134
142
  {...props}
135
143
  />
136
144
  ))
@@ -140,7 +148,7 @@ const createPreviewCardHandle = BasePreviewCard.createHandle
140
148
 
141
149
  function PreviewCardArrowSvg(props: React.ComponentProps<'svg'>) {
142
150
  return (
143
- <svg width="20" height="10" viewBox="0 0 20 10" fill="none" {...props}>
151
+ <svg width="20" height="10" viewBox="0 0 20 10" fill="none" data-slot="preview-card-arrow-svg" {...props}>
144
152
  <path
145
153
  d="M9.66437 2.60207L4.80758 6.97318C4.07308 7.63423 3.11989 8 2.13172 8H0V10H20V8H18.5349C17.5468 8 16.5936 7.63423 15.8591 6.97318L11.0023 2.60207C10.622 2.2598 10.0447 2.25979 9.66437 2.60207Z"
146
154
  className="fill-secondary"
@@ -8,7 +8,7 @@ const Progress = React.forwardRef<
8
8
  React.ComponentRef<typeof ProgressPrimitive.Root>,
9
9
  React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Root>
10
10
  >(({ className, ...props }, ref) => (
11
- <ProgressPrimitive.Root ref={ref} className={cn("grid gap-2", className)} {...props} />
11
+ <ProgressPrimitive.Root data-slot="progress" ref={ref} className={cn("grid gap-2", className)} {...props} />
12
12
  ))
13
13
  Progress.displayName = "Progress"
14
14
 
@@ -17,6 +17,7 @@ const ProgressTrack = React.forwardRef<
17
17
  React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Track>
18
18
  >(({ className, ...props }, ref) => (
19
19
  <ProgressPrimitive.Track
20
+ data-slot="progress-track"
20
21
  ref={ref}
21
22
  className={cn("relative h-2 w-full overflow-hidden rounded-full bg-secondary", className)}
22
23
  {...props}
@@ -29,6 +30,7 @@ const ProgressIndicator = React.forwardRef<
29
30
  React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Indicator>
30
31
  >(({ className, ...props }, ref) => (
31
32
  <ProgressPrimitive.Indicator
33
+ data-slot="progress-indicator"
32
34
  ref={ref}
33
35
  className={cn("h-full rounded-full bg-primary transition-[width] duration-[var(--motion-duration-base,200ms)] ease-[var(--motion-ease-out,cubic-bezier(0.23,1,0.32,1))] motion-reduce:transition-none", className)}
34
36
  {...props}
@@ -41,6 +43,7 @@ const ProgressLabel = React.forwardRef<
41
43
  React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Label>
42
44
  >(({ className, ...props }, ref) => (
43
45
  <ProgressPrimitive.Label
46
+ data-slot="progress-label"
44
47
  ref={ref}
45
48
  className={cn("text-sm font-medium leading-none", className)}
46
49
  {...props}
@@ -53,6 +56,7 @@ const ProgressValue = React.forwardRef<
53
56
  React.ComponentPropsWithoutRef<typeof ProgressPrimitive.Value>
54
57
  >(({ className, ...props }, ref) => (
55
58
  <ProgressPrimitive.Value
59
+ data-slot="progress-value"
56
60
  ref={ref}
57
61
  className={cn("text-xs text-muted-foreground", className)}
58
62
  {...props}
@@ -126,6 +126,7 @@ const ProgressRing = React.forwardRef<HTMLDivElement, ProgressRingProps>(
126
126
  return (
127
127
  <div
128
128
  ref={ref}
129
+ data-slot="progress-ring"
129
130
  className={cn("relative", className)}
130
131
  style={{ width: size, height: size }}
131
132
  {...props}
@@ -61,6 +61,7 @@ const RadioGroup = React.forwardRef<
61
61
  <RadioAgentContext.Provider value={useHasAgent() ? items : null}>
62
62
  <RadioGroupPrimitive
63
63
  ref={mergedRef}
64
+ data-slot="radio-group"
64
65
  className={cn("grid gap-2", className)}
65
66
  {...props}
66
67
  value={value}
@@ -77,6 +78,7 @@ const RadioIndicator = React.forwardRef<
77
78
  >(({ className, ...props }, ref) => (
78
79
  <RadioPrimitive.Indicator
79
80
  ref={ref}
81
+ data-slot="radio-indicator"
80
82
  className={cn(
81
83
  "flex items-center justify-center",
82
84
  "after:h-2.5 after:w-2.5 after:rounded-full after:bg-current",
@@ -100,6 +102,7 @@ const Radio = React.forwardRef<
100
102
  <span className="relative inline-flex [&>input]:!absolute">
101
103
  <RadioPrimitive.Root
102
104
  ref={mergedRef}
105
+ data-slot="radio"
103
106
  className={cn(
104
107
  "flex items-center justify-center aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background",
105
108
  "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",