@hanzo/ui 4.6.0 → 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 (290) hide show
  1. package/dist/index.d.mts +16 -0
  2. package/dist/index.d.ts +16 -0
  3. package/dist/index.js +9458 -0
  4. package/dist/index.mjs +9449 -0
  5. package/dist/lib/utils.d.mts +2 -0
  6. package/dist/lib/utils.d.ts +2 -0
  7. package/dist/lib/utils.js +47 -0
  8. package/dist/lib/utils.mjs +28 -0
  9. package/dist/src/utils.d.mts +7 -0
  10. package/dist/src/utils.d.ts +7 -0
  11. package/dist/src/utils.js +47 -0
  12. package/dist/src/utils.mjs +28 -0
  13. package/dist/tailwind/index.d.mts +2 -0
  14. package/dist/tailwind/index.d.ts +2 -0
  15. package/dist/tailwind/index.js +2048 -0
  16. package/dist/tailwind/index.mjs +2017 -0
  17. package/dist/types/index.d.mts +12 -0
  18. package/dist/types/index.d.ts +12 -0
  19. package/dist/types/index.js +79 -0
  20. package/dist/types/index.mjs +56 -0
  21. package/package.json +151 -25
  22. package/MCP-INSTRUCTIONS.md +0 -73
  23. package/README-MCP.md +0 -175
  24. package/assets/ai-icons.tsx +0 -207
  25. package/assets/crypto.tsx +0 -33
  26. package/assets/file-type-icon.tsx +0 -66
  27. package/assets/file.tsx +0 -45
  28. package/assets/general.tsx +0 -2318
  29. package/assets/hanzo-logo.svg +0 -9
  30. package/assets/hanzo-logo.tsx +0 -15
  31. package/assets/index.ts +0 -8
  32. package/assets/index.tsx +0 -4
  33. package/assets/llm-provider.tsx +0 -1094
  34. package/blocks/components/accordian-block.tsx +0 -48
  35. package/blocks/components/block-component-props.ts +0 -11
  36. package/blocks/components/bullet-cards-block.tsx +0 -46
  37. package/blocks/components/card-block/index.tsx +0 -171
  38. package/blocks/components/card-block/link-out-button.tsx +0 -20
  39. package/blocks/components/card-block/util.ts +0 -28
  40. package/blocks/components/carte-blanche-block/index.tsx +0 -127
  41. package/blocks/components/carte-blanche-block/variant-content-left.tsx +0 -49
  42. package/blocks/components/content.tsx +0 -70
  43. package/blocks/components/cta-block.tsx +0 -115
  44. package/blocks/components/enh-heading-block.tsx +0 -204
  45. package/blocks/components/grid-block/grid-block-mutator.ts +0 -12
  46. package/blocks/components/grid-block/index.tsx +0 -83
  47. package/blocks/components/grid-block/mutator-registry.ts +0 -10
  48. package/blocks/components/grid-block/table-borders.mutator.ts +0 -47
  49. package/blocks/components/group-block.tsx +0 -83
  50. package/blocks/components/heading-block.tsx +0 -88
  51. package/blocks/components/image-block.tsx +0 -111
  52. package/blocks/components/index.ts +0 -30
  53. package/blocks/components/screenful-block/content.tsx +0 -123
  54. package/blocks/components/screenful-block/index.tsx +0 -107
  55. package/blocks/components/screenful-block/poster-background.tsx +0 -34
  56. package/blocks/components/screenful-block/video-background.tsx +0 -45
  57. package/blocks/components/space-block.tsx +0 -66
  58. package/blocks/components/video-block.tsx +0 -138
  59. package/blocks/def/accordian-block.ts +0 -14
  60. package/blocks/def/block.ts +0 -7
  61. package/blocks/def/bullet-cards-block.ts +0 -22
  62. package/blocks/def/card-block.ts +0 -22
  63. package/blocks/def/carte-blanche-block.ts +0 -21
  64. package/blocks/def/cta-block.ts +0 -19
  65. package/blocks/def/element-block.ts +0 -11
  66. package/blocks/def/enh-heading-block.ts +0 -44
  67. package/blocks/def/grid-block.ts +0 -16
  68. package/blocks/def/group-block.ts +0 -11
  69. package/blocks/def/heading-block.ts +0 -15
  70. package/blocks/def/image-block.ts +0 -31
  71. package/blocks/def/index.ts +0 -35
  72. package/blocks/def/screenful-block.ts +0 -54
  73. package/blocks/def/space-block.ts +0 -64
  74. package/blocks/def/video-block.ts +0 -9
  75. package/blocks/index.ts +0 -2
  76. package/components/index.ts +0 -56
  77. package/dist/button.d.ts +0 -1
  78. package/dist/button.js +0 -1
  79. package/dist/hooks/index.d.ts +0 -7
  80. package/dist/hooks/index.js +0 -7
  81. package/dist/hooks/use-click-away.d.ts +0 -2
  82. package/dist/hooks/use-click-away.js +0 -23
  83. package/dist/hooks/use-combined-refs.d.ts +0 -3
  84. package/dist/hooks/use-combined-refs.js +0 -18
  85. package/dist/hooks/use-copy-clipboard.d.ts +0 -9
  86. package/dist/hooks/use-copy-clipboard.js +0 -21
  87. package/dist/hooks/use-debounce.d.ts +0 -1
  88. package/dist/hooks/use-debounce.js +0 -13
  89. package/dist/hooks/use-fill-ids.d.ts +0 -8
  90. package/dist/hooks/use-fill-ids.js +0 -20
  91. package/dist/hooks/use-map.d.ts +0 -1
  92. package/dist/hooks/use-map.js +0 -20
  93. package/dist/hooks/use-measure.d.ts +0 -8
  94. package/dist/hooks/use-measure.js +0 -25
  95. package/dist/hooks/use-reverse-video-playback.d.ts +0 -1
  96. package/dist/hooks/use-reverse-video-playback.js +0 -41
  97. package/dist/hooks/use-scroll-restoration.d.ts +0 -8
  98. package/dist/hooks/use-scroll-restoration.js +0 -36
  99. package/dist/mcp/enhanced-server.d.ts +0 -29
  100. package/dist/mcp/enhanced-server.js +0 -1128
  101. package/dist/mcp/index.d.ts +0 -28
  102. package/dist/mcp/index.js +0 -436
  103. package/dist/registry/api.d.ts +0 -37
  104. package/dist/registry/api.js +0 -129
  105. package/dist/registry/index.d.ts +0 -353
  106. package/dist/registry/index.js +0 -45
  107. package/dist/utils.d.ts +0 -1
  108. package/dist/utils.js +0 -1
  109. package/environment.d.ts +0 -6
  110. package/helpers/file.ts +0 -33
  111. package/helpers/memoization.ts +0 -40
  112. package/primitives/accordion.tsx +0 -74
  113. package/primitives/action-button.tsx +0 -42
  114. package/primitives/alert-dialog.tsx +0 -185
  115. package/primitives/alert.tsx +0 -74
  116. package/primitives/apply-typography.tsx +0 -55
  117. package/primitives/aspect-ratio.tsx +0 -5
  118. package/primitives/avatar.tsx +0 -57
  119. package/primitives/background-beams.tsx +0 -142
  120. package/primitives/badge.tsx +0 -44
  121. package/primitives/breadcrumb.tsx +0 -130
  122. package/primitives/breakpoint-indicator.tsx +0 -19
  123. package/primitives/button.tsx +0 -82
  124. package/primitives/calendar.tsx +0 -72
  125. package/primitives/card.tsx +0 -97
  126. package/primitives/carousel.tsx +0 -237
  127. package/primitives/chat/chat-input-area.tsx +0 -87
  128. package/primitives/chat/chat-input.tsx +0 -71
  129. package/primitives/chat/files-preview.tsx +0 -330
  130. package/primitives/chat/index.ts +0 -6
  131. package/primitives/chat/json-form.tsx +0 -8
  132. package/primitives/chat/message-list.tsx +0 -307
  133. package/primitives/chat/message.tsx +0 -569
  134. package/primitives/chat/sqlite-preview.tsx +0 -215
  135. package/primitives/checkbox.tsx +0 -31
  136. package/primitives/collapsible.tsx +0 -9
  137. package/primitives/combobox.tsx +0 -239
  138. package/primitives/command.tsx +0 -149
  139. package/primitives/context-menu.tsx +0 -206
  140. package/primitives/copy-to-clipboard-icon.tsx +0 -60
  141. package/primitives/dialog-video-controller.tsx +0 -38
  142. package/primitives/dialog.tsx +0 -123
  143. package/primitives/dot-pattern.tsx +0 -57
  144. package/primitives/dots-loader.tsx +0 -13
  145. package/primitives/drawer.tsx +0 -110
  146. package/primitives/dropdown-menu.tsx +0 -199
  147. package/primitives/error-message.tsx +0 -19
  148. package/primitives/file-uploader.tsx +0 -200
  149. package/primitives/form.tsx +0 -183
  150. package/primitives/hover-card.tsx +0 -28
  151. package/primitives/icons/github.tsx +0 -14
  152. package/primitives/icons/index.ts +0 -18
  153. package/primitives/icons/youtube-logo.tsx +0 -59
  154. package/primitives/index-common.ts +0 -303
  155. package/primitives/index-next.ts +0 -4
  156. package/primitives/input-otp.tsx +0 -65
  157. package/primitives/input.tsx +0 -125
  158. package/primitives/label.tsx +0 -20
  159. package/primitives/list-adaptor.ts +0 -12
  160. package/primitives/list-box.tsx +0 -74
  161. package/primitives/loading-spinner.tsx +0 -33
  162. package/primitives/markdown-preview.tsx +0 -609
  163. package/primitives/mermaid.tsx +0 -196
  164. package/primitives/navigation-menu.tsx +0 -147
  165. package/primitives/next/image.tsx +0 -90
  166. package/primitives/next/index.ts +0 -7
  167. package/primitives/next/inline-icon.tsx +0 -36
  168. package/primitives/next/link-element.tsx +0 -109
  169. package/primitives/next/mdx-link.tsx +0 -22
  170. package/primitives/next/media-stack.tsx +0 -69
  171. package/primitives/next/nav-items.tsx +0 -45
  172. package/primitives/next/youtube-embed.tsx +0 -83
  173. package/primitives/pagination.tsx +0 -117
  174. package/primitives/popover.tsx +0 -32
  175. package/primitives/pretty-json-print.tsx +0 -28
  176. package/primitives/progress.tsx +0 -26
  177. package/primitives/prompt-textarea.tsx +0 -72
  178. package/primitives/qr-code.tsx +0 -112
  179. package/primitives/radio-group.tsx +0 -42
  180. package/primitives/resizable.tsx +0 -47
  181. package/primitives/scroll-area.tsx +0 -57
  182. package/primitives/search-input.tsx +0 -66
  183. package/primitives/select.tsx +0 -122
  184. package/primitives/separator.tsx +0 -25
  185. package/primitives/sheet.tsx +0 -139
  186. package/primitives/skeleton.tsx +0 -17
  187. package/primitives/slider.tsx +0 -62
  188. package/primitives/sonner.tsx +0 -35
  189. package/primitives/step-indicator.tsx +0 -69
  190. package/primitives/stepper.tsx +0 -272
  191. package/primitives/switch.tsx +0 -26
  192. package/primitives/table.tsx +0 -105
  193. package/primitives/tabs.tsx +0 -50
  194. package/primitives/text-area.tsx +0 -26
  195. package/primitives/text-link.tsx +0 -25
  196. package/primitives/textarea.tsx +0 -61
  197. package/primitives/textfield.tsx +0 -75
  198. package/primitives/toast.tsx +0 -30
  199. package/primitives/toggle-group.tsx +0 -63
  200. package/primitives/toggle.tsx +0 -44
  201. package/primitives/tooltip.tsx +0 -47
  202. package/primitives/video-player.tsx +0 -23
  203. package/public/r/accordion.json +0 -11
  204. package/public/r/alert.json +0 -11
  205. package/public/r/avatar.json +0 -11
  206. package/public/r/badge.json +0 -11
  207. package/public/r/button.json +0 -11
  208. package/public/r/card.json +0 -11
  209. package/public/r/checkbox.json +0 -11
  210. package/public/r/default.json +0 -6
  211. package/public/r/dialog.json +0 -11
  212. package/public/r/input.json +0 -11
  213. package/public/r/label.json +0 -11
  214. package/public/r/new-york.json +0 -6
  215. package/public/r/popover.json +0 -11
  216. package/public/r/select.json +0 -11
  217. package/public/r/table.json +0 -11
  218. package/public/r/tabs.json +0 -11
  219. package/public/r/toast.json +0 -11
  220. package/registry.json +0 -184
  221. package/src/button.ts +0 -1
  222. package/src/hooks/index.ts +0 -7
  223. package/src/hooks/use-click-away.ts +0 -31
  224. package/src/hooks/use-combined-refs.ts +0 -22
  225. package/src/hooks/use-copy-clipboard.ts +0 -30
  226. package/src/hooks/use-debounce.ts +0 -17
  227. package/src/hooks/use-fill-ids.ts +0 -25
  228. package/src/hooks/use-map.ts +0 -26
  229. package/src/hooks/use-measure.ts +0 -42
  230. package/src/hooks/use-reverse-video-playback.ts +0 -43
  231. package/src/hooks/use-scroll-restoration.ts +0 -50
  232. package/src/mcp/README.md +0 -141
  233. package/src/mcp/enhanced-server.ts +0 -1208
  234. package/src/mcp/index.ts +0 -518
  235. package/src/mcp/package.json +0 -10
  236. package/src/registry/api.ts +0 -164
  237. package/src/registry/index.ts +0 -60
  238. package/src/registry/package.json +0 -10
  239. package/src/utils.ts +0 -1
  240. package/tailwind/colors.tailwind.js +0 -53
  241. package/tailwind/fontFamily.tailwind.ts +0 -7
  242. package/tailwind/fontSize.tailwind.ts +0 -13
  243. package/tailwind/index.ts +0 -7
  244. package/tailwind/safelist.tailwind.js +0 -26
  245. package/tailwind/screens.tailwind.js +0 -8
  246. package/tailwind/spacing.tailwind.js +0 -65
  247. package/tailwind/tailwind.config.hanzo-preset.d.ts +0 -5
  248. package/tailwind/tailwind.config.hanzo-preset.js +0 -915
  249. package/tailwind/tw-font-desc.ts +0 -15
  250. package/tailwind/typo-plugin/get-plugin-styles.js +0 -679
  251. package/tailwind/typo-plugin/index.d.ts +0 -9
  252. package/tailwind/typo-plugin/index.js +0 -141
  253. package/tailwind/typo-plugin/utils.js +0 -60
  254. package/tailwind/typography-test.mdx +0 -35
  255. package/tailwind/z-index.tailwind.js +0 -71
  256. package/test/test-registry.js +0 -73
  257. package/test-imports.mjs +0 -19
  258. package/tsconfig.json +0 -22
  259. package/types/animation-def.ts +0 -3
  260. package/types/breakpoints.ts +0 -11
  261. package/types/bullet-item.ts +0 -10
  262. package/types/button-def.ts +0 -39
  263. package/types/dimensions.ts +0 -8
  264. package/types/grid-def.ts +0 -56
  265. package/types/image-def.ts +0 -32
  266. package/types/index.ts +0 -29
  267. package/types/link-def.ts +0 -56
  268. package/types/media-stack-def.ts +0 -31
  269. package/types/t-shirt-size.ts +0 -5
  270. package/types/tshirt-dimensions.ts +0 -20
  271. package/types/video-def.ts +0 -25
  272. package/util/blob.ts +0 -28
  273. package/util/copy-to-clipboard.ts +0 -17
  274. package/util/create-shadow-root.ts +0 -22
  275. package/util/date.ts +0 -83
  276. package/util/debounce.ts +0 -11
  277. package/util/file.ts +0 -15
  278. package/util/format-and-abbreviate-as-currency.ts +0 -125
  279. package/util/format-text.ts +0 -33
  280. package/util/format-to-max-char.ts +0 -68
  281. package/util/index-client.ts +0 -3
  282. package/util/index.ts +0 -9
  283. package/util/number-abbreviate.ts +0 -49
  284. package/util/specifier.ts +0 -43
  285. package/util/spread-to-transform.ts +0 -24
  286. package/util/step-animation.ts +0 -90
  287. package/util/timing.ts +0 -3
  288. package/util/toasts.tsx +0 -17
  289. package/util/two-way-map.ts +0 -19
  290. package/utils.ts +0 -9
@@ -1,130 +0,0 @@
1
- import { Slot } from '@radix-ui/react-slot';
2
- import { ChevronRight, MoreHorizontal } from 'lucide-react';
3
- import * as React from 'react';
4
-
5
- import { cn } from '../src/utils';
6
-
7
- type BreadcrumbProps = React.ComponentPropsWithoutRef<'nav'> & {
8
- separator?: React.ReactNode;
9
- ref?: React.RefObject<HTMLDivElement>;
10
- };
11
-
12
- const Breadcrumb = ({ ref, ...props }: BreadcrumbProps) => (
13
- <nav aria-label="breadcrumb" ref={ref} {...props} />
14
- );
15
-
16
- Breadcrumb.displayName = 'Breadcrumb';
17
-
18
- type BreadcrumbListProps = React.ComponentPropsWithoutRef<'ol'> & {
19
- ref?: React.RefObject<HTMLOListElement>;
20
- };
21
-
22
- const BreadcrumbList = ({ className, ref, ...props }: BreadcrumbListProps) => (
23
- <ol
24
- className={cn(
25
- 'text-text-secondary flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5',
26
- className,
27
- )}
28
- ref={ref}
29
- {...props}
30
- />
31
- );
32
- BreadcrumbList.displayName = 'BreadcrumbList';
33
-
34
- type BreadcrumbItemProps = React.ComponentPropsWithoutRef<'li'> & {
35
- ref?: React.RefObject<HTMLLIElement>;
36
- };
37
-
38
- const BreadcrumbItem = ({ className, ref, ...props }: BreadcrumbItemProps) => (
39
- <li
40
- className={cn('inline-flex items-center gap-1.5', className)}
41
- ref={ref}
42
- {...props}
43
- />
44
- );
45
- BreadcrumbItem.displayName = 'BreadcrumbItem';
46
-
47
- type BreadcrumbLinkProps = React.ComponentPropsWithoutRef<'a'> & {
48
- asChild?: boolean;
49
- ref?: React.RefObject<HTMLAnchorElement>;
50
- };
51
-
52
- const BreadcrumbLink = ({
53
- asChild,
54
- className,
55
- ref,
56
- ...props
57
- }: BreadcrumbLinkProps) => {
58
- const Comp = asChild ? Slot : 'a';
59
-
60
- return (
61
- <Comp
62
- className={cn('hover:text-text-default transition-colors', className)}
63
- ref={ref}
64
- {...props}
65
- />
66
- );
67
- };
68
- BreadcrumbLink.displayName = 'BreadcrumbLink';
69
-
70
- type BreadcrumbPageProps = React.ComponentPropsWithoutRef<'span'> & {
71
- ref?: React.RefObject<HTMLSpanElement>;
72
- };
73
-
74
- const BreadcrumbPage = ({ className, ref, ...props }: BreadcrumbPageProps) => (
75
- <span
76
- aria-current="page"
77
- aria-disabled="true"
78
- className={cn('text-text-default font-normal', className)}
79
- ref={ref}
80
- role="link"
81
- {...props}
82
- />
83
- );
84
- BreadcrumbPage.displayName = 'BreadcrumbPage';
85
-
86
- type BreadcrumbSeparatorProps = React.ComponentProps<'li'> & {
87
- ref?: React.RefObject<HTMLLIElement>;
88
- };
89
-
90
- const BreadcrumbSeparator = ({
91
- children,
92
- className,
93
- ...props
94
- }: BreadcrumbSeparatorProps) => (
95
- <li
96
- aria-hidden="true"
97
- className={cn('[&>svg]:h-4 [&>svg]:w-4', className)}
98
- role="presentation"
99
- {...props}
100
- >
101
- {children ?? <ChevronRight />}
102
- </li>
103
- );
104
- BreadcrumbSeparator.displayName = 'BreadcrumbSeparator';
105
-
106
- const BreadcrumbEllipsis = ({
107
- className,
108
- ...props
109
- }: React.ComponentProps<'span'>) => (
110
- <span
111
- aria-hidden="true"
112
- className={cn('flex h-9 w-9 items-center justify-center', className)}
113
- role="presentation"
114
- {...props}
115
- >
116
- <MoreHorizontal className="h-4 w-4" />
117
- <span className="sr-only">More</span>
118
- </span>
119
- );
120
- BreadcrumbEllipsis.displayName = 'BreadcrumbElipssis';
121
-
122
- export {
123
- Breadcrumb,
124
- BreadcrumbList,
125
- BreadcrumbItem,
126
- BreadcrumbLink,
127
- BreadcrumbPage,
128
- BreadcrumbSeparator,
129
- BreadcrumbEllipsis,
130
- };
@@ -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,82 +0,0 @@
1
- import { Slot } from '@radix-ui/react-slot';
2
- import { cva, type VariantProps } from 'class-variance-authority';
3
- import { Loader2 } from 'lucide-react';
4
- import * as React from 'react';
5
-
6
- import { cn } from '../src/utils';
7
-
8
- const buttonVariants = cva(
9
- 'inline-flex items-center justify-center gap-2 border border-transparent text-sm font-semibold transition-colors focus-visible:ring-1 focus-visible:ring-gray-50 focus-visible:outline-hidden focus-visible:ring-inset',
10
- {
11
- variants: {
12
- variant: {
13
- default:
14
- 'bg-brand hover:bg-brand-500 text-black disabled:bg-gray-800 disabled:text-gray-400 disabled:opacity-60',
15
- destructive:
16
- 'disabled:text-text-secondary bg-red-500 text-white hover:bg-red-500/90 disabled:bg-gray-600',
17
- outline:
18
- 'border border-gray-600 bg-transparent text-white hover:border-gray-400 hover:bg-gray-900 hover:text-white',
19
- tertiary:
20
- 'bg-transparent text-gray-300 hover:bg-gray-900 hover:text-white',
21
- link: 'text-white underline-offset-4 hover:underline',
22
- },
23
- size: {
24
- default: 'h-[50px] px-8 text-sm',
25
- xs: 'h-[34px] gap-1.5 px-3 text-xs',
26
- sm: 'h-[36px] gap-1.5 px-3 text-xs',
27
- md: 'h-[40px] gap-1.5 px-3 text-xs',
28
- lg: 'h-[48px] gap-2 px-2 text-sm',
29
- icon: 'h-9 w-9',
30
- auto: 'h-auto p-4',
31
- },
32
- rounded: {
33
- full: 'rounded-full',
34
- lg: 'rounded-lg',
35
- },
36
- },
37
- defaultVariants: {
38
- variant: 'default',
39
- size: 'default',
40
- rounded: 'full',
41
- },
42
- },
43
- );
44
-
45
- export interface ButtonProps
46
- extends React.ButtonHTMLAttributes<HTMLButtonElement>,
47
- VariantProps<typeof buttonVariants> {
48
- asChild?: boolean;
49
- isLoading?: boolean;
50
- ref?: React.RefObject<HTMLButtonElement>;
51
- }
52
-
53
- const Button = ({
54
- className,
55
- variant,
56
- size,
57
- rounded,
58
- asChild = false,
59
- isLoading = false,
60
- ref,
61
- ...props
62
- }: ButtonProps) => {
63
- const Comp = asChild ? Slot : 'button';
64
- return (
65
- <Comp
66
- className={cn(buttonVariants({ variant, size, className }))}
67
- ref={ref}
68
- {...props}
69
- >
70
- {isLoading ? (
71
- <Loader2
72
- className={cn('h-4 w-4 animate-spin', size !== 'icon' && 'mr-2')}
73
- />
74
- ) : null}
75
- {isLoading && size === 'icon' ? null : props.children}
76
- </Comp>
77
- );
78
- };
79
-
80
- Button.displayName = 'Button';
81
-
82
- export { Button, buttonVariants };
@@ -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,97 +0,0 @@
1
- import * as React from 'react';
2
-
3
- import { cn } from '../src/utils';
4
-
5
- type CardProps = React.HTMLAttributes<HTMLDivElement> & {
6
- ref?: React.RefObject<HTMLDivElement>;
7
- };
8
-
9
- const Card = ({ className, ref, ...props }: CardProps) => (
10
- <div
11
- className={cn(
12
- 'bg-card text-card-foreground rounded-lg border shadow-xs',
13
- className,
14
- )}
15
- ref={ref}
16
- {...props}
17
- />
18
- );
19
- Card.displayName = 'Card';
20
-
21
- type CardHeaderProps = React.HTMLAttributes<HTMLDivElement> & {
22
- ref?: React.RefObject<HTMLDivElement>;
23
- };
24
-
25
- const CardHeader = ({ className, ref, ...props }: CardHeaderProps) => (
26
- <div
27
- className={cn('flex flex-col space-y-1.5 p-6', className)}
28
- ref={ref}
29
- {...props}
30
- />
31
- );
32
-
33
- CardHeader.displayName = 'CardHeader';
34
-
35
- type CardTitleProps = React.HTMLAttributes<HTMLHeadingElement> & {
36
- ref?: React.RefObject<HTMLHeadingElement>;
37
- };
38
-
39
- const CardTitle = ({ className, ref, ...props }: CardTitleProps) => (
40
- <h3
41
- className={cn(
42
- 'text-2xl leading-none font-semibold tracking-tight',
43
- className,
44
- )}
45
- ref={ref}
46
- {...props}
47
- />
48
- );
49
- CardTitle.displayName = 'CardTitle';
50
-
51
- type CardDescriptionProps = React.HTMLAttributes<HTMLParagraphElement> & {
52
- ref?: React.RefObject<HTMLParagraphElement>;
53
- };
54
-
55
- const CardDescription = ({
56
- className,
57
- ref,
58
- ...props
59
- }: CardDescriptionProps) => (
60
- <p
61
- className={cn('text-text-secondary text-sm', className)}
62
- ref={ref}
63
- {...props}
64
- />
65
- );
66
- CardDescription.displayName = 'CardDescription';
67
-
68
- type CardContentProps = React.HTMLAttributes<HTMLDivElement> & {
69
- ref?: React.RefObject<HTMLDivElement>;
70
- };
71
-
72
- const CardContent = ({ className, ref, ...props }: CardContentProps) => (
73
- <div className={cn('p-6 pt-0', className)} ref={ref} {...props} />
74
- );
75
- CardContent.displayName = 'CardContent';
76
-
77
- type CardFooterProps = React.HTMLAttributes<HTMLDivElement> & {
78
- ref?: React.RefObject<HTMLDivElement>;
79
- };
80
-
81
- const CardFooter = ({ className, ref, ...props }: CardFooterProps) => (
82
- <div
83
- className={cn('flex items-center p-6 pt-0', className)}
84
- ref={ref}
85
- {...props}
86
- />
87
- );
88
- CardFooter.displayName = 'CardFooter';
89
-
90
- export {
91
- Card,
92
- CardHeader,
93
- CardFooter,
94
- CardTitle,
95
- CardDescription,
96
- CardContent,
97
- };
@@ -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
- }