@hanzo/ui 4.5.4 → 4.7.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 (203) hide show
  1. package/README.md +229 -0
  2. package/bin/create-registry.js +1 -1
  3. package/bin/test-mcp.sh +1 -1
  4. package/bin/update-registry.js +2 -2
  5. package/dist/index.d.mts +16 -0
  6. package/dist/index.d.ts +16 -0
  7. package/dist/index.js +9458 -0
  8. package/dist/index.mjs +9449 -0
  9. package/dist/lib/utils.d.mts +2 -0
  10. package/dist/lib/utils.d.ts +2 -0
  11. package/dist/lib/utils.js +47 -0
  12. package/dist/lib/utils.mjs +28 -0
  13. package/dist/src/utils.d.mts +7 -0
  14. package/dist/src/utils.d.ts +7 -0
  15. package/dist/src/utils.js +47 -0
  16. package/dist/src/utils.mjs +28 -0
  17. package/dist/tailwind/index.d.mts +2 -0
  18. package/dist/tailwind/index.d.ts +2 -0
  19. package/dist/tailwind/index.js +2048 -0
  20. package/dist/tailwind/index.mjs +2017 -0
  21. package/dist/types/index.d.mts +12 -0
  22. package/dist/types/index.d.ts +12 -0
  23. package/dist/types/index.js +79 -0
  24. package/dist/types/index.mjs +56 -0
  25. package/package.json +170 -23
  26. package/style/theme-provider.tsx +1 -1
  27. package/MCP-INSTRUCTIONS.md +0 -73
  28. package/README-MCP.md +0 -175
  29. package/blocks/components/accordian-block.tsx +0 -48
  30. package/blocks/components/block-component-props.ts +0 -11
  31. package/blocks/components/bullet-cards-block.tsx +0 -46
  32. package/blocks/components/card-block/index.tsx +0 -171
  33. package/blocks/components/card-block/link-out-button.tsx +0 -20
  34. package/blocks/components/card-block/util.ts +0 -28
  35. package/blocks/components/carte-blanche-block/index.tsx +0 -127
  36. package/blocks/components/carte-blanche-block/variant-content-left.tsx +0 -49
  37. package/blocks/components/content.tsx +0 -70
  38. package/blocks/components/cta-block.tsx +0 -115
  39. package/blocks/components/enh-heading-block.tsx +0 -204
  40. package/blocks/components/grid-block/grid-block-mutator.ts +0 -12
  41. package/blocks/components/grid-block/index.tsx +0 -83
  42. package/blocks/components/grid-block/mutator-registry.ts +0 -10
  43. package/blocks/components/grid-block/table-borders.mutator.ts +0 -47
  44. package/blocks/components/group-block.tsx +0 -83
  45. package/blocks/components/heading-block.tsx +0 -88
  46. package/blocks/components/image-block.tsx +0 -111
  47. package/blocks/components/index.ts +0 -30
  48. package/blocks/components/screenful-block/content.tsx +0 -123
  49. package/blocks/components/screenful-block/index.tsx +0 -107
  50. package/blocks/components/screenful-block/poster-background.tsx +0 -34
  51. package/blocks/components/screenful-block/video-background.tsx +0 -45
  52. package/blocks/components/space-block.tsx +0 -66
  53. package/blocks/components/video-block.tsx +0 -138
  54. package/blocks/def/accordian-block.ts +0 -14
  55. package/blocks/def/block.ts +0 -7
  56. package/blocks/def/bullet-cards-block.ts +0 -22
  57. package/blocks/def/card-block.ts +0 -22
  58. package/blocks/def/carte-blanche-block.ts +0 -21
  59. package/blocks/def/cta-block.ts +0 -19
  60. package/blocks/def/element-block.ts +0 -11
  61. package/blocks/def/enh-heading-block.ts +0 -44
  62. package/blocks/def/grid-block.ts +0 -16
  63. package/blocks/def/group-block.ts +0 -11
  64. package/blocks/def/heading-block.ts +0 -15
  65. package/blocks/def/image-block.ts +0 -31
  66. package/blocks/def/index.ts +0 -35
  67. package/blocks/def/screenful-block.ts +0 -54
  68. package/blocks/def/space-block.ts +0 -64
  69. package/blocks/def/video-block.ts +0 -9
  70. package/blocks/index.ts +0 -2
  71. package/dist/mcp/enhanced-server.d.ts +0 -29
  72. package/dist/mcp/enhanced-server.js +0 -1128
  73. package/dist/mcp/index.d.ts +0 -28
  74. package/dist/mcp/index.js +0 -436
  75. package/dist/registry/api.d.ts +0 -37
  76. package/dist/registry/api.js +0 -129
  77. package/dist/registry/index.d.ts +0 -353
  78. package/dist/registry/index.js +0 -45
  79. package/environment.d.ts +0 -6
  80. package/primitives/accordion.tsx +0 -66
  81. package/primitives/action-button.tsx +0 -42
  82. package/primitives/apply-typography.tsx +0 -55
  83. package/primitives/aspect-ratio.tsx +0 -5
  84. package/primitives/avatar.tsx +0 -49
  85. package/primitives/badge.tsx +0 -36
  86. package/primitives/breadcrumb.tsx +0 -115
  87. package/primitives/breakpoint-indicator.tsx +0 -19
  88. package/primitives/button.tsx +0 -85
  89. package/primitives/calendar.tsx +0 -72
  90. package/primitives/card.tsx +0 -83
  91. package/primitives/carousel.tsx +0 -237
  92. package/primitives/checkbox.tsx +0 -32
  93. package/primitives/combobox.tsx +0 -239
  94. package/primitives/command.tsx +0 -157
  95. package/primitives/context-menu.tsx +0 -200
  96. package/primitives/dialog-video-controller.tsx +0 -38
  97. package/primitives/dialog.tsx +0 -157
  98. package/primitives/drawer.tsx +0 -138
  99. package/primitives/form.tsx +0 -178
  100. package/primitives/icons/github.tsx +0 -14
  101. package/primitives/icons/index.ts +0 -18
  102. package/primitives/icons/youtube-logo.tsx +0 -59
  103. package/primitives/index-common.ts +0 -224
  104. package/primitives/index-next.ts +0 -2
  105. package/primitives/input-otp.tsx +0 -65
  106. package/primitives/input.tsx +0 -30
  107. package/primitives/label.tsx +0 -28
  108. package/primitives/list-adaptor.ts +0 -12
  109. package/primitives/list-box.tsx +0 -74
  110. package/primitives/loading-spinner.tsx +0 -33
  111. package/primitives/navigation-menu.tsx +0 -147
  112. package/primitives/next/image.tsx +0 -90
  113. package/primitives/next/index.ts +0 -7
  114. package/primitives/next/inline-icon.tsx +0 -36
  115. package/primitives/next/link-element.tsx +0 -109
  116. package/primitives/next/mdx-link.tsx +0 -22
  117. package/primitives/next/media-stack.tsx +0 -69
  118. package/primitives/next/nav-items.tsx +0 -45
  119. package/primitives/next/youtube-embed.tsx +0 -83
  120. package/primitives/popover.tsx +0 -37
  121. package/primitives/progress.tsx +0 -27
  122. package/primitives/radio-group.tsx +0 -56
  123. package/primitives/scroll-area.tsx +0 -47
  124. package/primitives/select.tsx +0 -169
  125. package/primitives/separator.tsx +0 -29
  126. package/primitives/sheet.tsx +0 -178
  127. package/primitives/skeleton.tsx +0 -20
  128. package/primitives/slider.tsx +0 -72
  129. package/primitives/sonner.tsx +0 -35
  130. package/primitives/step-indicator.tsx +0 -69
  131. package/primitives/switch.tsx +0 -35
  132. package/primitives/table.tsx +0 -117
  133. package/primitives/tabs.tsx +0 -60
  134. package/primitives/text-area.tsx +0 -26
  135. package/primitives/toggle-group.tsx +0 -63
  136. package/primitives/toggle.tsx +0 -73
  137. package/primitives/tooltip.tsx +0 -48
  138. package/primitives/video-player.tsx +0 -23
  139. package/public/r/accordion.json +0 -11
  140. package/public/r/alert.json +0 -11
  141. package/public/r/avatar.json +0 -11
  142. package/public/r/badge.json +0 -11
  143. package/public/r/button.json +0 -11
  144. package/public/r/card.json +0 -11
  145. package/public/r/checkbox.json +0 -11
  146. package/public/r/default.json +0 -6
  147. package/public/r/dialog.json +0 -11
  148. package/public/r/input.json +0 -11
  149. package/public/r/label.json +0 -11
  150. package/public/r/new-york.json +0 -6
  151. package/public/r/popover.json +0 -11
  152. package/public/r/select.json +0 -11
  153. package/public/r/table.json +0 -11
  154. package/public/r/tabs.json +0 -11
  155. package/public/r/toast.json +0 -11
  156. package/registry.json +0 -184
  157. package/src/mcp/README.md +0 -141
  158. package/src/mcp/enhanced-server.ts +0 -1208
  159. package/src/mcp/index.ts +0 -518
  160. package/src/mcp/package.json +0 -10
  161. package/src/registry/api.ts +0 -164
  162. package/src/registry/index.ts +0 -60
  163. package/src/registry/package.json +0 -10
  164. package/tailwind/colors.tailwind.js +0 -53
  165. package/tailwind/fontFamily.tailwind.ts +0 -7
  166. package/tailwind/fontSize.tailwind.ts +0 -13
  167. package/tailwind/index.ts +0 -7
  168. package/tailwind/safelist.tailwind.js +0 -26
  169. package/tailwind/screens.tailwind.js +0 -8
  170. package/tailwind/spacing.tailwind.js +0 -65
  171. package/tailwind/tailwind.config.hanzo-preset.d.ts +0 -5
  172. package/tailwind/tailwind.config.hanzo-preset.js +0 -915
  173. package/tailwind/tw-font-desc.ts +0 -15
  174. package/tailwind/typo-plugin/get-plugin-styles.js +0 -679
  175. package/tailwind/typo-plugin/index.d.ts +0 -9
  176. package/tailwind/typo-plugin/index.js +0 -141
  177. package/tailwind/typo-plugin/utils.js +0 -60
  178. package/tailwind/typography-test.mdx +0 -35
  179. package/tailwind/z-index.tailwind.js +0 -71
  180. package/test/test-registry.js +0 -73
  181. package/tsconfig.json +0 -22
  182. package/types/animation-def.ts +0 -3
  183. package/types/breakpoints.ts +0 -11
  184. package/types/bullet-item.ts +0 -10
  185. package/types/button-def.ts +0 -39
  186. package/types/dimensions.ts +0 -8
  187. package/types/grid-def.ts +0 -56
  188. package/types/image-def.ts +0 -32
  189. package/types/index.ts +0 -29
  190. package/types/link-def.ts +0 -56
  191. package/types/media-stack-def.ts +0 -31
  192. package/types/t-shirt-size.ts +0 -5
  193. package/types/tshirt-dimensions.ts +0 -20
  194. package/types/video-def.ts +0 -25
  195. package/util/format-and-abbreviate-as-currency.ts +0 -125
  196. package/util/format-to-max-char.ts +0 -68
  197. package/util/index-client.ts +0 -3
  198. package/util/index.ts +0 -78
  199. package/util/number-abbreviate.ts +0 -49
  200. package/util/specifier.ts +0 -43
  201. package/util/spread-to-transform.ts +0 -24
  202. package/util/step-animation.ts +0 -90
  203. package/util/two-way-map.ts +0 -19
@@ -1,115 +0,0 @@
1
- import * as React from "react"
2
- import { Slot } from "@radix-ui/react-slot"
3
- import { ChevronRight, MoreHorizontal } from "lucide-react"
4
-
5
- import { cn } from '../util'
6
-
7
- const Breadcrumb = React.forwardRef<
8
- HTMLElement,
9
- React.ComponentPropsWithoutRef<"nav"> & {
10
- separator?: React.ReactNode
11
- }
12
- >(({ ...props }, ref) => <nav ref={ref} aria-label="breadcrumb" {...props} />)
13
- Breadcrumb.displayName = "Breadcrumb"
14
-
15
- const BreadcrumbList = React.forwardRef<
16
- HTMLOListElement,
17
- React.ComponentPropsWithoutRef<"ol">
18
- >(({ className, ...props }, ref) => (
19
- <ol
20
- ref={ref}
21
- className={cn(
22
- "flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-2 sm:gap-2.5",
23
- className
24
- )}
25
- {...props}
26
- />
27
- ))
28
- BreadcrumbList.displayName = "BreadcrumbList"
29
-
30
- const BreadcrumbItem = React.forwardRef<
31
- HTMLLIElement,
32
- React.ComponentPropsWithoutRef<"li">
33
- >(({ className, ...props }, ref) => (
34
- <li
35
- ref={ref}
36
- className={cn("inline-flex items-center gap-1.5", className)}
37
- {...props}
38
- />
39
- ))
40
- BreadcrumbItem.displayName = "BreadcrumbItem"
41
-
42
- const BreadcrumbLink = React.forwardRef<
43
- HTMLAnchorElement,
44
- React.ComponentPropsWithoutRef<"a"> & {
45
- asChild?: boolean
46
- }
47
- >(({ asChild, className, ...props }, ref) => {
48
- const Comp = asChild ? Slot : "a"
49
-
50
- return (
51
- <Comp
52
- ref={ref}
53
- className={cn("transition-colors hover:text-foreground", className)}
54
- {...props}
55
- />
56
- )
57
- })
58
- BreadcrumbLink.displayName = "BreadcrumbLink"
59
-
60
- const BreadcrumbPage = React.forwardRef<
61
- HTMLSpanElement,
62
- React.ComponentPropsWithoutRef<"span">
63
- >(({ className, ...props }, ref) => (
64
- <span
65
- ref={ref}
66
- role="link"
67
- aria-disabled="true"
68
- aria-current="page"
69
- className={cn("font-normal text-foreground", className)}
70
- {...props}
71
- />
72
- ))
73
- BreadcrumbPage.displayName = "BreadcrumbPage"
74
-
75
- const BreadcrumbSeparator = ({
76
- children,
77
- className,
78
- ...props
79
- }: React.ComponentProps<"li">) => (
80
- <li
81
- role="presentation"
82
- aria-hidden="true"
83
- className={cn("[&>svg]:size-3.5", className)}
84
- {...props}
85
- >
86
- {children ?? <ChevronRight />}
87
- </li>
88
- )
89
- BreadcrumbSeparator.displayName = "BreadcrumbSeparator"
90
-
91
- const BreadcrumbEllipsis = ({
92
- className,
93
- ...props
94
- }: React.ComponentProps<"span">) => (
95
- <span
96
- role="presentation"
97
- aria-hidden="true"
98
- className={cn("flex h-9 w-9 items-center justify-center", className)}
99
- {...props}
100
- >
101
- <MoreHorizontal className="h-4 w-4" />
102
- <span className="sr-only">More</span>
103
- </span>
104
- )
105
- BreadcrumbEllipsis.displayName = "BreadcrumbElipssis"
106
-
107
- export {
108
- Breadcrumb,
109
- BreadcrumbList,
110
- BreadcrumbItem,
111
- BreadcrumbLink,
112
- BreadcrumbPage,
113
- BreadcrumbSeparator,
114
- BreadcrumbEllipsis,
115
- }
@@ -1,19 +0,0 @@
1
- import React from 'react'
2
-
3
- const BreakpointIndicator: React.FC = () => {
4
-
5
- if (process?.env?.NODE_ENV !== undefined && process.env.NODE_ENV === "production") return null
6
-
7
- return (
8
- <div className="fixed bottom-1 left-1 z-floating flex h-6 w-6 items-center justify-center rounded-full bg-gray-800 p-3 font-mono text-xs text-primary">
9
- <div className="block sm:hidden">xs</div>
10
- <div className="hidden sm:block md:hidden">sm</div>
11
- <div className="hidden md:block lg:hidden">md</div>
12
- <div className="hidden lg:block xl:hidden">lg</div>
13
- <div className="hidden xl:block 2xl:hidden">xl</div>
14
- <div className="hidden 2xl:block">2xl</div>
15
- </div>
16
- )
17
- }
18
-
19
- export default BreakpointIndicator
@@ -1,85 +0,0 @@
1
- import * as React from "react"
2
- import { Slot } from "@radix-ui/react-slot"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
-
5
- import { cn } from "../util"
6
-
7
- // Define all variants
8
- const variant = {
9
- primary: "bg-primary text-primary-fg sm:hover:bg-primary-hover font-nav whitespace-nowrap not-typography",
10
- secondary: "bg-secondary text-secondary-fg sm:hover:bg-secondary-hover font-nav whitespace-nowrap not-typography",
11
- outline: "text-foreground bg-background border border-muted-4 sm:hover:bg-level-1 sm:hover:text-accent sm:hover:border-accent font-nav whitespace-nowrap not-typography",
12
- destructive: "bg-destructive text-destructive-fg font-sans whitespace-nowrap sm:hover:bg-destructive-hover",
13
- ghost: "text-foreground sm:hover:bg-level-1 sm:hover:text-accent whitespace-nowrap font-sans ",
14
- link: "text-foreground sm:hover:text-muted-1 font-sans ",
15
- linkFG: "text-foreground sm:hover:text-muted-1 font-sans ", // marker to style nav as regular link
16
- linkMuted: "text-muted-1 sm:hover:text-foreground font-sans ",
17
- }
18
-
19
- // Define all sizes
20
- const size = {
21
- link: '',
22
- xs: "h-8 px-2 text-xs",
23
- sm: "h-9 px-3 text-xs",
24
- square: 'h-9 py-2 px-2 text-sm aspect-square',
25
- default: "h-9 py-2 px-4 text-sm md:text-base font-semibold min-w-0",
26
- lg: "h-10 px-8 text-sm md:text-base font-semibold min-w-0 md:min-w-[260px] lg:min-w-[300px]",
27
- icon: "h-10 w-10",
28
- }
29
-
30
- // Define rounded options
31
- const rounded = {
32
- full: 'rounded-full',
33
- sm: 'rounded-sm',
34
- md: 'rounded-md',
35
- lg: 'rounded-lg',
36
- xl: 'rounded-xl',
37
- none: ''
38
- }
39
-
40
- // Updated buttonVariants with the latest Shadcn patterns
41
- const buttonVariants = cva(
42
- "inline-flex items-center justify-center font-medium ring-offset-background transition-colors " +
43
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 " +
44
- "disabled:opacity-50 disabled:pointer-events-none",
45
- {
46
- variants: {
47
- variant,
48
- size,
49
- rounded
50
- },
51
- defaultVariants: {
52
- variant: "primary",
53
- size: "default",
54
- rounded: 'md'
55
- },
56
- }
57
- )
58
-
59
- interface ButtonProps extends
60
- React.ButtonHTMLAttributes<HTMLButtonElement>,
61
- VariantProps<typeof buttonVariants>
62
- {
63
- asChild?: boolean
64
- }
65
-
66
- const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
67
- ({ className, variant, size, rounded, asChild = false, ...props }, ref) => {
68
- const Comp = asChild ? Slot : "button"
69
- return (
70
- <Comp
71
- className={cn(buttonVariants({ variant, size, rounded }), className )}
72
- ref={ref}
73
- {...props}
74
- />
75
- )
76
- }
77
- )
78
-
79
- Button.displayName = "Button"
80
-
81
- export {
82
- Button as default,
83
- type ButtonProps,
84
- buttonVariants,
85
- }
@@ -1,72 +0,0 @@
1
- "use client"
2
- import React from "react"
3
-
4
- import { ChevronLeftIcon, ChevronRightIcon } from "@radix-ui/react-icons"
5
- import { DayPicker } from "react-day-picker"
6
-
7
- import { cn } from "../util"
8
- import { buttonVariants } from "./button"
9
-
10
- export type CalendarProps = React.ComponentProps<typeof DayPicker>
11
-
12
- function Calendar({
13
- className,
14
- classNames,
15
- showOutsideDays = true,
16
- ...props
17
- }: CalendarProps) {
18
- return (
19
- <DayPicker
20
- showOutsideDays={showOutsideDays}
21
- className={cn("p-3", className)}
22
- classNames={{
23
- months: "flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",
24
- month: "space-y-4",
25
- caption: "flex justify-center pt-1 relative items-center",
26
- caption_label: "text-sm font-medium",
27
- nav: "space-x-1 flex items-center",
28
- nav_button: cn(
29
- buttonVariants({ variant: "outline" }),
30
- "h-7 w-7 bg-transparent p-0 opacity-50 hover:opacity-100"
31
- ),
32
- nav_button_previous: "absolute left-1",
33
- nav_button_next: "absolute right-1",
34
- table: "w-full border-collapse space-y-1",
35
- head_row: "flex",
36
- head_cell:
37
- "text-muted-1 rounded-md w-8 font-normal text-[0.8rem]",
38
- row: "flex w-full mt-2",
39
- cell: cn(
40
- "relative p-0 text-center text-sm focus-within:relative focus-within:z-above-content [&:has([aria-selected])]:bg-level-1 [&:has([aria-selected].day-outside)]:bg-level-1/50 [&:has([aria-selected].day-range-end)]:rounded-r-md",
41
- props.mode === "range"
42
- ? "[&:has(>.day-range-end)]:rounded-r-md [&:has(>.day-range-start)]:rounded-l-md first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md"
43
- : "[&:has([aria-selected])]:rounded-md"
44
- ),
45
- day: cn(
46
- buttonVariants({ variant: "ghost" }),
47
- "h-8 w-8 p-0 font-normal aria-selected:opacity-100"
48
- ),
49
- day_range_start: "day-range-start",
50
- day_range_end: "day-range-end",
51
- day_selected:
52
- "bg-primary text-primary-fg hover:bg-primary hover:text-primary-fg focus:bg-primary focus:text-primary-fg",
53
- day_today: "bg-accent text-primary-fg",
54
- day_outside:
55
- "day-outside text-muted-foreground opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-1 aria-selected:opacity-30",
56
- day_disabled: "text-muted-foreground opacity-50",
57
- day_range_middle:
58
- "aria-selected:bg-accent aria-selected:text-primary-fg",
59
- day_hidden: "invisible",
60
- ...classNames,
61
- }}
62
- components={{
63
- IconLeft: ({ ...props }) => <ChevronLeftIcon className="h-4 w-4" />,
64
- IconRight: ({ ...props }) => <ChevronRightIcon className="h-4 w-4" />,
65
- }}
66
- {...props}
67
- />
68
- )
69
- }
70
- Calendar.displayName = "Calendar"
71
-
72
- export default Calendar
@@ -1,83 +0,0 @@
1
- 'use client'
2
- import * as React from "react"
3
-
4
- import { cn } from "../util"
5
-
6
- const Card = React.forwardRef<
7
- HTMLDivElement,
8
- React.HTMLAttributes<HTMLDivElement>
9
- >(({ className, ...props }, ref) => {
10
- return(
11
- <div
12
- ref={ref}
13
- className={cn(
14
- "rounded-lg border overflow-hidden shadow-sm",
15
- className
16
- )}
17
- {...props}
18
- />
19
- )
20
- })
21
-
22
- Card.displayName = "Card"
23
-
24
- const CardHeader = React.forwardRef<
25
- HTMLDivElement,
26
- React.HTMLAttributes<HTMLDivElement>
27
- >(({ className, ...props }, ref) => (
28
- <div
29
- ref={ref}
30
- className={cn("flex flex-col p-4 lg:p-5 xl:px-6 xl:py-5 border-b", className)}
31
- {...props}
32
- />
33
- ))
34
- CardHeader.displayName = "CardHeader"
35
-
36
- const CardTitle = React.forwardRef<
37
- HTMLParagraphElement,
38
- React.HTMLAttributes<HTMLHeadingElement>
39
- >(({ className, ...props }, ref) => (
40
- <h5
41
- ref={ref}
42
- className={cn(
43
- "leading-none tracking-tight",
44
- className
45
- )}
46
- {...props}
47
- />
48
- ))
49
- CardTitle.displayName = "CardTitle"
50
-
51
- const CardDescription = React.forwardRef<
52
- HTMLParagraphElement,
53
- React.HTMLAttributes<HTMLParagraphElement>
54
- >(({ className, ...props }, ref) => (
55
- <h6
56
- ref={ref}
57
- className={className}
58
- {...props}
59
- />
60
- ))
61
- CardDescription.displayName = "CardDescription"
62
-
63
- const CardContent = React.forwardRef<
64
- HTMLDivElement,
65
- React.HTMLAttributes<HTMLDivElement>
66
- >(({ className, ...props }, ref) => (
67
- <div ref={ref} className={cn("p-6", className)} {...props} />
68
- ))
69
- CardContent.displayName = "CardContent"
70
-
71
- const CardFooter = React.forwardRef<
72
- HTMLDivElement,
73
- React.HTMLAttributes<HTMLDivElement>
74
- >(({ className, ...props }, ref) => (
75
- <div
76
- ref={ref}
77
- className={cn("flex items-center px-6 py-3 border-t", className)}
78
- {...props}
79
- />
80
- ))
81
- CardFooter.displayName = "CardFooter"
82
-
83
- export { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent }
@@ -1,237 +0,0 @@
1
- 'use client'
2
-
3
- import * as React from 'react'
4
- import useEmblaCarousel from 'embla-carousel-react'
5
- import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'
6
-
7
- import { ArrowLeft, ArrowRight } from 'lucide-react'
8
-
9
- import { cn } from '../util'
10
- import Button from './button'
11
-
12
- type CarouselApi = EmblaCarouselType
13
- type CarouselOptions = EmblaOptionsType
14
- type CarouselPlugin = EmblaPluginType
15
-
16
- type CarouselProps = {
17
- options?: CarouselOptions
18
- plugins?: CarouselPlugin[]
19
- orientation?: 'horizontal' | 'vertical'
20
- setApi?: (api: CarouselApi) => void
21
- onCarouselSelect?: (api: CarouselApi) => void
22
- }
23
-
24
- type UseCarouselType = {
25
- carouselRef: ReturnType<typeof useEmblaCarousel>[0]
26
- api: ReturnType<typeof useEmblaCarousel>[1]
27
- scrollPrev: () => void
28
- scrollNext: () => void
29
- canScrollPrev: boolean
30
- canScrollNext: boolean
31
- } & CarouselProps
32
-
33
- const CarouselContext = React.createContext<UseCarouselType | null>(null)
34
-
35
- const useCarousel = (): UseCarouselType => {
36
- const service = React.useContext(CarouselContext)
37
- if (!service) { throw new Error('useCarousel must be used within a <Carousel />') }
38
- return service
39
- }
40
-
41
- // https://github.com/emilkowalski/vaul/pull/250
42
- // See data-vaul-no-drag throughout
43
-
44
- const Carousel = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement> & CarouselProps>(
45
- ({
46
- orientation = 'horizontal',
47
- options,
48
- setApi,
49
- plugins,
50
- className,
51
- children,
52
- onCarouselSelect,
53
- ...props
54
- }, ref ) => {
55
-
56
- const [carouselRef, api] = useEmblaCarousel({...options, axis: orientation === 'horizontal' ? 'x' : 'y'}, plugins)
57
-
58
- const [canScrollPrev, setCanScrollPrev] = React.useState<boolean>(false)
59
- const [canScrollNext, setCanScrollNext] = React.useState<boolean>(false)
60
-
61
- const onSelect = React.useCallback((api: CarouselApi) => {
62
- if (!api) { return } // would this ever happen??
63
-
64
- setCanScrollPrev(api.canScrollPrev())
65
- setCanScrollNext(api.canScrollNext())
66
- if (onCarouselSelect) { onCarouselSelect(api)}
67
- }, [])
68
-
69
- const scrollPrev = React.useCallback(() => { api?.scrollPrev()}, [api])
70
- const scrollNext = React.useCallback(() => { api?.scrollNext()}, [api])
71
-
72
- const handleKeyDown = React.useCallback((event: React.KeyboardEvent<HTMLDivElement>) => {
73
- if (event.key === 'ArrowLeft') {
74
- event.preventDefault()
75
- scrollPrev()
76
- }
77
- else if (event.key === 'ArrowRight') {
78
- event.preventDefault()
79
- scrollNext()
80
- }
81
- }, [scrollPrev, scrollNext])
82
-
83
- React.useEffect(() => {
84
- if (!api || !setApi) { return }
85
- setApi(api)
86
- }, [api, setApi])
87
-
88
- React.useEffect(() => {
89
- if (!api) { return }
90
- onSelect(api)
91
- api.on('reInit', onSelect)
92
- api.on('select', onSelect)
93
- return () => { api?.off('select', onSelect) }
94
- }, [api, onSelect])
95
-
96
- return (
97
- <CarouselContext.Provider
98
- value={{
99
- carouselRef,
100
- api,
101
- options,
102
- orientation: orientation || (options?.axis === 'y' ? 'vertical' : 'horizontal'),
103
- scrollPrev,
104
- scrollNext,
105
- canScrollPrev,
106
- canScrollNext,
107
- }}
108
- >
109
- <div
110
- ref={ref}
111
- onKeyDownCapture={handleKeyDown}
112
- className={cn('relative', className)}
113
- role='region'
114
- aria-roledescription='carousel'
115
- data-vaul-no-drag
116
- {...props}
117
- >
118
- {children}
119
- </div>
120
- </CarouselContext.Provider>
121
- )
122
- }
123
- )
124
- Carousel.displayName = 'Carousel'
125
-
126
- const CarouselContent = React.forwardRef<
127
- HTMLDivElement,
128
- React.HTMLAttributes<HTMLDivElement>
129
- >(({ className, ...props }, ref) => {
130
- const { carouselRef, orientation } = useCarousel()
131
-
132
- return (
133
- <div ref={carouselRef} className='overflow-hidden' data-vaul-no-drag >
134
- <div
135
- ref={ref}
136
- className={cn(
137
- 'flex',
138
- orientation === 'horizontal' ? '-ml-4' : '-mt-4 flex-col',
139
- className
140
- )}
141
- {...props}
142
- />
143
- </div>
144
- )
145
- })
146
- CarouselContent.displayName = 'CarouselContent'
147
-
148
- const CarouselItem = React.forwardRef<
149
- HTMLDivElement,
150
- React.HTMLAttributes<HTMLDivElement>
151
- >(({ className, ...props }, ref) => {
152
- const { orientation } = useCarousel()
153
-
154
- return (
155
- <div
156
- ref={ref}
157
- role='group'
158
- aria-roledescription='slide'
159
- data-vaul-no-drag
160
- className={cn(
161
- 'min-w-0 shrink-0 grow-0 basis-full',
162
- orientation === 'horizontal' ? 'pl-4' : 'pt-4',
163
- className
164
- )}
165
- {...props}
166
- />
167
- )
168
- })
169
- CarouselItem.displayName = 'CarouselItem'
170
-
171
- const CarouselPrevious = React.forwardRef<
172
- HTMLButtonElement,
173
- React.ComponentProps<typeof Button>
174
- >(({ className, variant = 'ghost', size = 'icon', ...props }, ref) => {
175
- const { orientation, scrollPrev, canScrollPrev } = useCarousel()
176
-
177
- return (
178
- <Button
179
- ref={ref}
180
- variant={variant}
181
- size={size}
182
- className={cn(
183
- 'absolute h-8 w-8 rounded-full',
184
- orientation === 'horizontal'
185
- ? '-left-12 top-1/2 -translate-y-1/2'
186
- : '-top-12 left-1/2 -translate-x-1/2 rotate-90',
187
- className
188
- )}
189
- disabled={!canScrollPrev}
190
- onClick={scrollPrev}
191
- {...props}
192
- >
193
- <ArrowLeft className='h-4 w-4' />
194
- <span className='sr-only'>Previous slide</span>
195
- </Button>
196
- )
197
- })
198
- CarouselPrevious.displayName = 'CarouselPrevious'
199
-
200
- const CarouselNext = React.forwardRef<
201
- HTMLButtonElement,
202
- React.ComponentProps<typeof Button>
203
- >(({ className, variant = 'ghost', size = 'icon', ...props }, ref) => {
204
- const { orientation, scrollNext, canScrollNext } = useCarousel()
205
-
206
- return (
207
- <Button
208
- ref={ref}
209
- variant={variant}
210
- size={size}
211
- className={cn(
212
- 'absolute h-8 w-8 rounded-full',
213
- orientation === 'horizontal'
214
- ? '-right-12 top-1/2 -translate-y-1/2'
215
- : '-bottom-12 left-1/2 -translate-x-1/2 rotate-90',
216
- className
217
- )}
218
- disabled={!canScrollNext}
219
- onClick={scrollNext}
220
- {...props}
221
- >
222
- <ArrowRight className='h-4 w-4' />
223
- <span className='sr-only'>Next slide</span>
224
- </Button>
225
- )
226
- })
227
- CarouselNext.displayName = 'CarouselNext'
228
-
229
- export {
230
- type CarouselApi,
231
- type CarouselOptions,
232
- Carousel,
233
- CarouselContent,
234
- CarouselItem,
235
- CarouselPrevious,
236
- CarouselNext,
237
- }
@@ -1,32 +0,0 @@
1
- 'use client'
2
- import React from 'react'
3
- import * as CheckboxPrimitive from '@radix-ui/react-checkbox'
4
- import { Check } from 'lucide-react'
5
-
6
- import { cn } from '../util'
7
-
8
- const Checkbox = React.forwardRef<
9
- React.ElementRef<typeof CheckboxPrimitive.Root>,
10
- React.ComponentPropsWithoutRef<typeof CheckboxPrimitive.Root>
11
- >(({ className, ...props }, ref) => (
12
- <CheckboxPrimitive.Root
13
- ref={ref}
14
- className={cn(
15
- 'peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background ' +
16
- 'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ' +
17
- 'focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 ' +
18
- 'data-[state=checked]:bg-primary data-[state=checked]:text-primary-fg',
19
- className
20
- )}
21
- {...props}
22
- >
23
- <CheckboxPrimitive.Indicator
24
- className={cn('flex items-center justify-center text-current')}
25
- >
26
- <Check className='h-4 w-4' />
27
- </CheckboxPrimitive.Indicator>
28
- </CheckboxPrimitive.Root>
29
- ))
30
- Checkbox.displayName = CheckboxPrimitive.Root.displayName
31
-
32
- export default Checkbox