@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.
- package/dist/index.d.mts +16 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9458 -0
- package/dist/index.mjs +9449 -0
- package/dist/lib/utils.d.mts +2 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +47 -0
- package/dist/lib/utils.mjs +28 -0
- package/dist/src/utils.d.mts +7 -0
- package/dist/src/utils.d.ts +7 -0
- package/dist/src/utils.js +47 -0
- package/dist/src/utils.mjs +28 -0
- package/dist/tailwind/index.d.mts +2 -0
- package/dist/tailwind/index.d.ts +2 -0
- package/dist/tailwind/index.js +2048 -0
- package/dist/tailwind/index.mjs +2017 -0
- package/dist/types/index.d.mts +12 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.js +79 -0
- package/dist/types/index.mjs +56 -0
- package/package.json +151 -25
- package/MCP-INSTRUCTIONS.md +0 -73
- package/README-MCP.md +0 -175
- package/assets/ai-icons.tsx +0 -207
- package/assets/crypto.tsx +0 -33
- package/assets/file-type-icon.tsx +0 -66
- package/assets/file.tsx +0 -45
- package/assets/general.tsx +0 -2318
- package/assets/hanzo-logo.svg +0 -9
- package/assets/hanzo-logo.tsx +0 -15
- package/assets/index.ts +0 -8
- package/assets/index.tsx +0 -4
- package/assets/llm-provider.tsx +0 -1094
- package/blocks/components/accordian-block.tsx +0 -48
- package/blocks/components/block-component-props.ts +0 -11
- package/blocks/components/bullet-cards-block.tsx +0 -46
- package/blocks/components/card-block/index.tsx +0 -171
- package/blocks/components/card-block/link-out-button.tsx +0 -20
- package/blocks/components/card-block/util.ts +0 -28
- package/blocks/components/carte-blanche-block/index.tsx +0 -127
- package/blocks/components/carte-blanche-block/variant-content-left.tsx +0 -49
- package/blocks/components/content.tsx +0 -70
- package/blocks/components/cta-block.tsx +0 -115
- package/blocks/components/enh-heading-block.tsx +0 -204
- package/blocks/components/grid-block/grid-block-mutator.ts +0 -12
- package/blocks/components/grid-block/index.tsx +0 -83
- package/blocks/components/grid-block/mutator-registry.ts +0 -10
- package/blocks/components/grid-block/table-borders.mutator.ts +0 -47
- package/blocks/components/group-block.tsx +0 -83
- package/blocks/components/heading-block.tsx +0 -88
- package/blocks/components/image-block.tsx +0 -111
- package/blocks/components/index.ts +0 -30
- package/blocks/components/screenful-block/content.tsx +0 -123
- package/blocks/components/screenful-block/index.tsx +0 -107
- package/blocks/components/screenful-block/poster-background.tsx +0 -34
- package/blocks/components/screenful-block/video-background.tsx +0 -45
- package/blocks/components/space-block.tsx +0 -66
- package/blocks/components/video-block.tsx +0 -138
- package/blocks/def/accordian-block.ts +0 -14
- package/blocks/def/block.ts +0 -7
- package/blocks/def/bullet-cards-block.ts +0 -22
- package/blocks/def/card-block.ts +0 -22
- package/blocks/def/carte-blanche-block.ts +0 -21
- package/blocks/def/cta-block.ts +0 -19
- package/blocks/def/element-block.ts +0 -11
- package/blocks/def/enh-heading-block.ts +0 -44
- package/blocks/def/grid-block.ts +0 -16
- package/blocks/def/group-block.ts +0 -11
- package/blocks/def/heading-block.ts +0 -15
- package/blocks/def/image-block.ts +0 -31
- package/blocks/def/index.ts +0 -35
- package/blocks/def/screenful-block.ts +0 -54
- package/blocks/def/space-block.ts +0 -64
- package/blocks/def/video-block.ts +0 -9
- package/blocks/index.ts +0 -2
- package/components/index.ts +0 -56
- package/dist/button.d.ts +0 -1
- package/dist/button.js +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.js +0 -7
- package/dist/hooks/use-click-away.d.ts +0 -2
- package/dist/hooks/use-click-away.js +0 -23
- package/dist/hooks/use-combined-refs.d.ts +0 -3
- package/dist/hooks/use-combined-refs.js +0 -18
- package/dist/hooks/use-copy-clipboard.d.ts +0 -9
- package/dist/hooks/use-copy-clipboard.js +0 -21
- package/dist/hooks/use-debounce.d.ts +0 -1
- package/dist/hooks/use-debounce.js +0 -13
- package/dist/hooks/use-fill-ids.d.ts +0 -8
- package/dist/hooks/use-fill-ids.js +0 -20
- package/dist/hooks/use-map.d.ts +0 -1
- package/dist/hooks/use-map.js +0 -20
- package/dist/hooks/use-measure.d.ts +0 -8
- package/dist/hooks/use-measure.js +0 -25
- package/dist/hooks/use-reverse-video-playback.d.ts +0 -1
- package/dist/hooks/use-reverse-video-playback.js +0 -41
- package/dist/hooks/use-scroll-restoration.d.ts +0 -8
- package/dist/hooks/use-scroll-restoration.js +0 -36
- package/dist/mcp/enhanced-server.d.ts +0 -29
- package/dist/mcp/enhanced-server.js +0 -1128
- package/dist/mcp/index.d.ts +0 -28
- package/dist/mcp/index.js +0 -436
- package/dist/registry/api.d.ts +0 -37
- package/dist/registry/api.js +0 -129
- package/dist/registry/index.d.ts +0 -353
- package/dist/registry/index.js +0 -45
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +0 -1
- package/environment.d.ts +0 -6
- package/helpers/file.ts +0 -33
- package/helpers/memoization.ts +0 -40
- package/primitives/accordion.tsx +0 -74
- package/primitives/action-button.tsx +0 -42
- package/primitives/alert-dialog.tsx +0 -185
- package/primitives/alert.tsx +0 -74
- package/primitives/apply-typography.tsx +0 -55
- package/primitives/aspect-ratio.tsx +0 -5
- package/primitives/avatar.tsx +0 -57
- package/primitives/background-beams.tsx +0 -142
- package/primitives/badge.tsx +0 -44
- package/primitives/breadcrumb.tsx +0 -130
- package/primitives/breakpoint-indicator.tsx +0 -19
- package/primitives/button.tsx +0 -82
- package/primitives/calendar.tsx +0 -72
- package/primitives/card.tsx +0 -97
- package/primitives/carousel.tsx +0 -237
- package/primitives/chat/chat-input-area.tsx +0 -87
- package/primitives/chat/chat-input.tsx +0 -71
- package/primitives/chat/files-preview.tsx +0 -330
- package/primitives/chat/index.ts +0 -6
- package/primitives/chat/json-form.tsx +0 -8
- package/primitives/chat/message-list.tsx +0 -307
- package/primitives/chat/message.tsx +0 -569
- package/primitives/chat/sqlite-preview.tsx +0 -215
- package/primitives/checkbox.tsx +0 -31
- package/primitives/collapsible.tsx +0 -9
- package/primitives/combobox.tsx +0 -239
- package/primitives/command.tsx +0 -149
- package/primitives/context-menu.tsx +0 -206
- package/primitives/copy-to-clipboard-icon.tsx +0 -60
- package/primitives/dialog-video-controller.tsx +0 -38
- package/primitives/dialog.tsx +0 -123
- package/primitives/dot-pattern.tsx +0 -57
- package/primitives/dots-loader.tsx +0 -13
- package/primitives/drawer.tsx +0 -110
- package/primitives/dropdown-menu.tsx +0 -199
- package/primitives/error-message.tsx +0 -19
- package/primitives/file-uploader.tsx +0 -200
- package/primitives/form.tsx +0 -183
- package/primitives/hover-card.tsx +0 -28
- package/primitives/icons/github.tsx +0 -14
- package/primitives/icons/index.ts +0 -18
- package/primitives/icons/youtube-logo.tsx +0 -59
- package/primitives/index-common.ts +0 -303
- package/primitives/index-next.ts +0 -4
- package/primitives/input-otp.tsx +0 -65
- package/primitives/input.tsx +0 -125
- package/primitives/label.tsx +0 -20
- package/primitives/list-adaptor.ts +0 -12
- package/primitives/list-box.tsx +0 -74
- package/primitives/loading-spinner.tsx +0 -33
- package/primitives/markdown-preview.tsx +0 -609
- package/primitives/mermaid.tsx +0 -196
- package/primitives/navigation-menu.tsx +0 -147
- package/primitives/next/image.tsx +0 -90
- package/primitives/next/index.ts +0 -7
- package/primitives/next/inline-icon.tsx +0 -36
- package/primitives/next/link-element.tsx +0 -109
- package/primitives/next/mdx-link.tsx +0 -22
- package/primitives/next/media-stack.tsx +0 -69
- package/primitives/next/nav-items.tsx +0 -45
- package/primitives/next/youtube-embed.tsx +0 -83
- package/primitives/pagination.tsx +0 -117
- package/primitives/popover.tsx +0 -32
- package/primitives/pretty-json-print.tsx +0 -28
- package/primitives/progress.tsx +0 -26
- package/primitives/prompt-textarea.tsx +0 -72
- package/primitives/qr-code.tsx +0 -112
- package/primitives/radio-group.tsx +0 -42
- package/primitives/resizable.tsx +0 -47
- package/primitives/scroll-area.tsx +0 -57
- package/primitives/search-input.tsx +0 -66
- package/primitives/select.tsx +0 -122
- package/primitives/separator.tsx +0 -25
- package/primitives/sheet.tsx +0 -139
- package/primitives/skeleton.tsx +0 -17
- package/primitives/slider.tsx +0 -62
- package/primitives/sonner.tsx +0 -35
- package/primitives/step-indicator.tsx +0 -69
- package/primitives/stepper.tsx +0 -272
- package/primitives/switch.tsx +0 -26
- package/primitives/table.tsx +0 -105
- package/primitives/tabs.tsx +0 -50
- package/primitives/text-area.tsx +0 -26
- package/primitives/text-link.tsx +0 -25
- package/primitives/textarea.tsx +0 -61
- package/primitives/textfield.tsx +0 -75
- package/primitives/toast.tsx +0 -30
- package/primitives/toggle-group.tsx +0 -63
- package/primitives/toggle.tsx +0 -44
- package/primitives/tooltip.tsx +0 -47
- package/primitives/video-player.tsx +0 -23
- package/public/r/accordion.json +0 -11
- package/public/r/alert.json +0 -11
- package/public/r/avatar.json +0 -11
- package/public/r/badge.json +0 -11
- package/public/r/button.json +0 -11
- package/public/r/card.json +0 -11
- package/public/r/checkbox.json +0 -11
- package/public/r/default.json +0 -6
- package/public/r/dialog.json +0 -11
- package/public/r/input.json +0 -11
- package/public/r/label.json +0 -11
- package/public/r/new-york.json +0 -6
- package/public/r/popover.json +0 -11
- package/public/r/select.json +0 -11
- package/public/r/table.json +0 -11
- package/public/r/tabs.json +0 -11
- package/public/r/toast.json +0 -11
- package/registry.json +0 -184
- package/src/button.ts +0 -1
- package/src/hooks/index.ts +0 -7
- package/src/hooks/use-click-away.ts +0 -31
- package/src/hooks/use-combined-refs.ts +0 -22
- package/src/hooks/use-copy-clipboard.ts +0 -30
- package/src/hooks/use-debounce.ts +0 -17
- package/src/hooks/use-fill-ids.ts +0 -25
- package/src/hooks/use-map.ts +0 -26
- package/src/hooks/use-measure.ts +0 -42
- package/src/hooks/use-reverse-video-playback.ts +0 -43
- package/src/hooks/use-scroll-restoration.ts +0 -50
- package/src/mcp/README.md +0 -141
- package/src/mcp/enhanced-server.ts +0 -1208
- package/src/mcp/index.ts +0 -518
- package/src/mcp/package.json +0 -10
- package/src/registry/api.ts +0 -164
- package/src/registry/index.ts +0 -60
- package/src/registry/package.json +0 -10
- package/src/utils.ts +0 -1
- package/tailwind/colors.tailwind.js +0 -53
- package/tailwind/fontFamily.tailwind.ts +0 -7
- package/tailwind/fontSize.tailwind.ts +0 -13
- package/tailwind/index.ts +0 -7
- package/tailwind/safelist.tailwind.js +0 -26
- package/tailwind/screens.tailwind.js +0 -8
- package/tailwind/spacing.tailwind.js +0 -65
- package/tailwind/tailwind.config.hanzo-preset.d.ts +0 -5
- package/tailwind/tailwind.config.hanzo-preset.js +0 -915
- package/tailwind/tw-font-desc.ts +0 -15
- package/tailwind/typo-plugin/get-plugin-styles.js +0 -679
- package/tailwind/typo-plugin/index.d.ts +0 -9
- package/tailwind/typo-plugin/index.js +0 -141
- package/tailwind/typo-plugin/utils.js +0 -60
- package/tailwind/typography-test.mdx +0 -35
- package/tailwind/z-index.tailwind.js +0 -71
- package/test/test-registry.js +0 -73
- package/test-imports.mjs +0 -19
- package/tsconfig.json +0 -22
- package/types/animation-def.ts +0 -3
- package/types/breakpoints.ts +0 -11
- package/types/bullet-item.ts +0 -10
- package/types/button-def.ts +0 -39
- package/types/dimensions.ts +0 -8
- package/types/grid-def.ts +0 -56
- package/types/image-def.ts +0 -32
- package/types/index.ts +0 -29
- package/types/link-def.ts +0 -56
- package/types/media-stack-def.ts +0 -31
- package/types/t-shirt-size.ts +0 -5
- package/types/tshirt-dimensions.ts +0 -20
- package/types/video-def.ts +0 -25
- package/util/blob.ts +0 -28
- package/util/copy-to-clipboard.ts +0 -17
- package/util/create-shadow-root.ts +0 -22
- package/util/date.ts +0 -83
- package/util/debounce.ts +0 -11
- package/util/file.ts +0 -15
- package/util/format-and-abbreviate-as-currency.ts +0 -125
- package/util/format-text.ts +0 -33
- package/util/format-to-max-char.ts +0 -68
- package/util/index-client.ts +0 -3
- package/util/index.ts +0 -9
- package/util/number-abbreviate.ts +0 -49
- package/util/specifier.ts +0 -43
- package/util/spread-to-transform.ts +0 -24
- package/util/step-animation.ts +0 -90
- package/util/timing.ts +0 -3
- package/util/toasts.tsx +0 -17
- package/util/two-way-map.ts +0 -19
- 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
|
package/primitives/button.tsx
DELETED
|
@@ -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 };
|
package/primitives/calendar.tsx
DELETED
|
@@ -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
|
package/primitives/card.tsx
DELETED
|
@@ -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
|
-
};
|
package/primitives/carousel.tsx
DELETED
|
@@ -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
|
-
}
|