@hanzo/ui 4.5.0 → 4.5.2
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/MCP-INSTRUCTIONS.md +73 -0
- package/README-MCP.md +175 -0
- package/bin/cli.js +100 -0
- package/bin/create-registry.js +108 -0
- package/bin/mcp.js +403 -0
- package/bin/npx-registry-mcp.js +15 -0
- package/bin/registry-mcp-wrapper.sh +19 -0
- package/bin/registry-mcp.js +100 -0
- package/bin/start-mcp-server.sh +22 -0
- package/bin/test-mcp.sh +52 -0
- package/bin/update-registry.js +196 -0
- package/blocks/components/screenful-block/index.tsx +2 -0
- package/dist/blocks/components/accordian-block.d.ts +4 -0
- package/dist/blocks/components/accordian-block.jsx +25 -0
- package/dist/blocks/components/block-component-props.d.ts +7 -0
- package/dist/blocks/components/block-component-props.js +1 -0
- package/dist/blocks/components/bullet-cards-block.d.ts +4 -0
- package/dist/blocks/components/bullet-cards-block.jsx +25 -0
- package/dist/blocks/components/card-block/index.d.ts +6 -0
- package/dist/blocks/components/card-block/index.jsx +87 -0
- package/dist/blocks/components/card-block/link-out-button.d.ts +6 -0
- package/dist/blocks/components/card-block/link-out-button.jsx +4 -0
- package/dist/blocks/components/card-block/util.d.ts +4 -0
- package/dist/blocks/components/card-block/util.js +6 -0
- package/dist/blocks/components/carte-blanche-block/index.d.ts +4 -0
- package/dist/blocks/components/carte-blanche-block/index.jsx +82 -0
- package/dist/blocks/components/carte-blanche-block/variant-content-left.d.ts +10 -0
- package/dist/blocks/components/carte-blanche-block/variant-content-left.jsx +23 -0
- package/dist/blocks/components/content.d.ts +10 -0
- package/dist/blocks/components/content.jsx +47 -0
- package/dist/blocks/components/cta-block.d.ts +12 -0
- package/dist/blocks/components/cta-block.jsx +69 -0
- package/dist/blocks/components/enh-heading-block.d.ts +7 -0
- package/dist/blocks/components/enh-heading-block.jsx +142 -0
- package/dist/blocks/components/grid-block/grid-block-mutator.d.ts +5 -0
- package/dist/blocks/components/grid-block/grid-block-mutator.js +1 -0
- package/dist/blocks/components/grid-block/index.d.ts +9 -0
- package/dist/blocks/components/grid-block/index.jsx +56 -0
- package/dist/blocks/components/grid-block/mutator-registry.d.ts +3 -0
- package/dist/blocks/components/grid-block/mutator-registry.js +5 -0
- package/dist/blocks/components/grid-block/table-borders.mutator.d.ts +3 -0
- package/dist/blocks/components/grid-block/table-borders.mutator.js +36 -0
- package/dist/blocks/components/group-block.d.ts +7 -0
- package/dist/blocks/components/group-block.jsx +61 -0
- package/dist/blocks/components/heading-block.d.ts +4 -0
- package/dist/blocks/components/heading-block.jsx +99 -0
- package/dist/blocks/components/image-block.d.ts +7 -0
- package/dist/blocks/components/image-block.jsx +69 -0
- package/dist/blocks/components/index.d.ts +14 -0
- package/dist/blocks/components/index.js +13 -0
- package/dist/blocks/components/screenful-block/content.d.ts +8 -0
- package/dist/blocks/components/screenful-block/content.jsx +71 -0
- package/dist/blocks/components/screenful-block/index.d.ts +12 -0
- package/dist/blocks/components/screenful-block/index.jsx +57 -0
- package/dist/blocks/components/screenful-block/poster-background.d.ts +7 -0
- package/dist/blocks/components/screenful-block/poster-background.jsx +14 -0
- package/dist/blocks/components/screenful-block/video-background.d.ts +8 -0
- package/dist/blocks/components/screenful-block/video-background.jsx +20 -0
- package/dist/blocks/components/space-block.d.ts +4 -0
- package/dist/blocks/components/space-block.jsx +42 -0
- package/dist/blocks/components/video-block.d.ts +9 -0
- package/dist/blocks/components/video-block.jsx +83 -0
- package/dist/blocks/def/accordian-block.d.ts +10 -0
- package/dist/blocks/def/accordian-block.js +2 -0
- package/dist/blocks/def/block.d.ts +4 -0
- package/dist/blocks/def/block.js +1 -0
- package/dist/blocks/def/bullet-cards-block.d.ts +17 -0
- package/dist/blocks/def/bullet-cards-block.js +1 -0
- package/dist/blocks/def/card-block.d.ts +17 -0
- package/dist/blocks/def/card-block.js +2 -0
- package/dist/blocks/def/carte-blanche-block.d.ts +12 -0
- package/dist/blocks/def/carte-blanche-block.js +1 -0
- package/dist/blocks/def/cta-block.d.ts +8 -0
- package/dist/blocks/def/cta-block.js +1 -0
- package/dist/blocks/def/element-block.d.ts +7 -0
- package/dist/blocks/def/element-block.js +2 -0
- package/dist/blocks/def/enh-heading-block.d.ts +22 -0
- package/dist/blocks/def/enh-heading-block.js +1 -0
- package/dist/blocks/def/grid-block.d.ts +12 -0
- package/dist/blocks/def/grid-block.js +1 -0
- package/dist/blocks/def/group-block.d.ts +7 -0
- package/dist/blocks/def/group-block.js +1 -0
- package/dist/blocks/def/heading-block.d.ts +11 -0
- package/dist/blocks/def/heading-block.js +1 -0
- package/dist/blocks/def/image-block.d.ts +26 -0
- package/dist/blocks/def/image-block.js +1 -0
- package/dist/blocks/def/index.d.ts +17 -0
- package/dist/blocks/def/index.js +2 -0
- package/dist/blocks/def/screenful-block.d.ts +41 -0
- package/dist/blocks/def/screenful-block.js +1 -0
- package/dist/blocks/def/space-block.d.ts +47 -0
- package/dist/blocks/def/space-block.js +8 -0
- package/dist/blocks/def/video-block.d.ts +5 -0
- package/dist/blocks/def/video-block.js +1 -0
- package/dist/blocks/index.d.ts +2 -0
- package/dist/blocks/index.js +2 -0
- package/dist/mcp/enhanced-server.d.ts +29 -0
- package/dist/mcp/enhanced-server.js +1128 -0
- package/dist/mcp/index.d.ts +28 -0
- package/dist/mcp/index.js +436 -0
- package/dist/primitives/accordion.d.ts +10 -0
- package/dist/primitives/accordion.jsx +21 -0
- package/dist/primitives/action-button.d.ts +9 -0
- package/dist/primitives/action-button.jsx +16 -0
- package/dist/primitives/apply-typography.d.ts +7 -0
- package/dist/primitives/apply-typography.jsx +38 -0
- package/dist/primitives/aspect-ratio.d.ts +3 -0
- package/dist/primitives/aspect-ratio.jsx +4 -0
- package/dist/primitives/avatar.d.ts +6 -0
- package/dist/primitives/avatar.jsx +11 -0
- package/dist/primitives/badge.d.ts +9 -0
- package/dist/primitives/badge.jsx +18 -0
- package/dist/primitives/breadcrumb.d.ts +19 -0
- package/dist/primitives/breadcrumb.jsx +27 -0
- package/dist/primitives/breakpoint-indicator.d.ts +3 -0
- package/dist/primitives/breakpoint-indicator.jsx +14 -0
- package/dist/primitives/button.d.ts +12 -0
- package/dist/primitives/button.jsx +55 -0
- package/dist/primitives/calendar.d.ts +8 -0
- package/dist/primitives/calendar.jsx +40 -0
- package/dist/primitives/card.d.ts +8 -0
- package/dist/primitives/card.jsx +18 -0
- package/dist/primitives/carousel.d.ts +18 -0
- package/dist/primitives/carousel.jsx +106 -0
- package/dist/primitives/checkbox.d.ts +4 -0
- package/dist/primitives/checkbox.jsx +15 -0
- package/dist/primitives/combobox.d.ts +41 -0
- package/dist/primitives/combobox.jsx +77 -0
- package/dist/primitives/command.d.ts +17 -0
- package/dist/primitives/command.jsx +38 -0
- package/dist/primitives/context-menu.d.ts +27 -0
- package/dist/primitives/context-menu.jsx +57 -0
- package/dist/primitives/dialog-video-controller.d.ts +3 -0
- package/dist/primitives/dialog-video-controller.jsx +24 -0
- package/dist/primitives/dialog.d.ts +28 -0
- package/dist/primitives/dialog.jsx +37 -0
- package/dist/primitives/drawer.d.ts +29 -0
- package/dist/primitives/drawer.jsx +34 -0
- package/dist/primitives/form.d.ts +12 -0
- package/dist/primitives/form.jsx +69 -0
- package/dist/primitives/icons/github.d.ts +4 -0
- package/dist/primitives/icons/github.jsx +6 -0
- package/dist/primitives/icons/index.d.ts +4 -0
- package/dist/primitives/icons/index.js +4 -0
- package/dist/primitives/icons/youtube-logo.d.ts +4 -0
- package/dist/primitives/icons/youtube-logo.jsx +39 -0
- package/dist/primitives/index-common.d.ts +47 -0
- package/dist/primitives/index-common.js +46 -0
- package/dist/primitives/index-next.d.ts +2 -0
- package/dist/primitives/index-next.js +2 -0
- package/dist/primitives/input-otp.d.ts +7 -0
- package/dist/primitives/input-otp.jsx +24 -0
- package/dist/primitives/input.d.ts +5 -0
- package/dist/primitives/input.jsx +11 -0
- package/dist/primitives/label.d.ts +5 -0
- package/dist/primitives/label.jsx +11 -0
- package/dist/primitives/list-adaptor.d.ts +9 -0
- package/dist/primitives/list-adaptor.js +1 -0
- package/dist/primitives/list-box.d.ts +10 -0
- package/dist/primitives/list-box.jsx +14 -0
- package/dist/primitives/loading-spinner.d.ts +5 -0
- package/dist/primitives/loading-spinner.jsx +8 -0
- package/dist/primitives/navigation-menu.d.ts +12 -0
- package/dist/primitives/navigation-menu.jsx +38 -0
- package/dist/primitives/next/image.d.ts +11 -0
- package/dist/primitives/next/image.jsx +42 -0
- package/dist/primitives/next/index.d.ts +7 -0
- package/dist/primitives/next/index.js +7 -0
- package/dist/primitives/next/inline-icon.d.ts +13 -0
- package/dist/primitives/next/inline-icon.jsx +15 -0
- package/dist/primitives/next/link-element.d.ts +23 -0
- package/dist/primitives/next/link-element.jsx +56 -0
- package/dist/primitives/next/mdx-link.d.ts +3 -0
- package/dist/primitives/next/mdx-link.jsx +12 -0
- package/dist/primitives/next/media-stack.d.ts +8 -0
- package/dist/primitives/next/media-stack.jsx +28 -0
- package/dist/primitives/next/nav-items.d.ts +10 -0
- package/dist/primitives/next/nav-items.jsx +24 -0
- package/dist/primitives/next/youtube-embed.d.ts +11 -0
- package/dist/primitives/next/youtube-embed.jsx +23 -0
- package/dist/primitives/popover.d.ts +9 -0
- package/dist/primitives/popover.jsx +18 -0
- package/dist/primitives/progress.d.ts +4 -0
- package/dist/primitives/progress.jsx +9 -0
- package/dist/primitives/radio-group.d.ts +7 -0
- package/dist/primitives/radio-group.jsx +18 -0
- package/dist/primitives/scroll-area.d.ts +5 -0
- package/dist/primitives/scroll-area.jsx +19 -0
- package/dist/primitives/select.d.ts +13 -0
- package/dist/primitives/select.jsx +62 -0
- package/dist/primitives/separator.d.ts +4 -0
- package/dist/primitives/separator.jsx +7 -0
- package/dist/primitives/sheet.d.ts +30 -0
- package/dist/primitives/sheet.jsx +56 -0
- package/dist/primitives/skeleton.d.ts +4 -0
- package/dist/primitives/skeleton.jsx +3 -0
- package/dist/primitives/slider.d.ts +9 -0
- package/dist/primitives/slider.jsx +30 -0
- package/dist/primitives/sonner.d.ts +5 -0
- package/dist/primitives/sonner.jsx +16 -0
- package/dist/primitives/step-indicator.d.ts +9 -0
- package/dist/primitives/step-indicator.jsx +23 -0
- package/dist/primitives/switch.d.ts +6 -0
- package/dist/primitives/switch.jsx +14 -0
- package/dist/primitives/table.d.ts +10 -0
- package/dist/primitives/table.jsx +21 -0
- package/dist/primitives/tabs.d.ts +7 -0
- package/dist/primitives/tabs.jsx +18 -0
- package/dist/primitives/text-area.d.ts +5 -0
- package/dist/primitives/text-area.jsx +9 -0
- package/dist/primitives/toggle-group.d.ts +14 -0
- package/dist/primitives/toggle-group.jsx +28 -0
- package/dist/primitives/toggle.d.ts +14 -0
- package/dist/primitives/toggle.jsx +52 -0
- package/dist/primitives/tooltip.d.ts +11 -0
- package/dist/primitives/tooltip.jsx +18 -0
- package/dist/primitives/video-player.d.ts +6 -0
- package/dist/primitives/video-player.jsx +8 -0
- package/dist/registry/api.d.ts +37 -0
- package/dist/registry/api.js +130 -0
- package/dist/registry/index.d.ts +9 -0
- package/dist/registry/index.js +45 -0
- package/dist/style/theme-provider.d.ts +4 -0
- package/dist/style/theme-provider.jsx +11 -0
- package/dist/tailwind/fontFamily.tailwind.d.ts +8 -0
- package/dist/tailwind/fontFamily.tailwind.js +7 -0
- package/dist/tailwind/fontSize.tailwind.d.ts +36 -0
- package/dist/tailwind/fontSize.tailwind.js +13 -0
- package/dist/tailwind/index.d.ts +3 -0
- package/dist/tailwind/index.js +2 -0
- package/dist/tailwind/screens.tailwind.d.ts +9 -0
- package/dist/tailwind/screens.tailwind.js +8 -0
- package/dist/tailwind/tw-font-desc.d.ts +6 -0
- package/dist/tailwind/tw-font-desc.js +6 -0
- package/dist/types/animation-def.d.ts +2 -0
- package/dist/types/animation-def.js +1 -0
- package/dist/types/breakpoints.d.ts +4 -0
- package/dist/types/breakpoints.js +4 -0
- package/dist/types/bullet-item.d.ts +6 -0
- package/dist/types/bullet-item.js +2 -0
- package/dist/types/button-def.d.ts +29 -0
- package/dist/types/button-def.js +2 -0
- package/dist/types/dimensions.d.ts +5 -0
- package/dist/types/dimensions.js +1 -0
- package/dist/types/grid-def.d.ts +36 -0
- package/dist/types/grid-def.js +33 -0
- package/dist/types/image-def.d.ts +27 -0
- package/dist/types/image-def.js +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.js +2 -0
- package/dist/types/link-def.d.ts +44 -0
- package/dist/types/link-def.js +1 -0
- package/dist/types/media-stack-def.d.ts +25 -0
- package/dist/types/media-stack-def.js +1 -0
- package/dist/types/t-shirt-size.d.ts +2 -0
- package/dist/types/t-shirt-size.js +1 -0
- package/dist/types/tshirt-dimensions.d.ts +12 -0
- package/dist/types/tshirt-dimensions.js +1 -0
- package/dist/types/video-def.d.ts +9 -0
- package/dist/types/video-def.js +1 -0
- package/dist/util/format-and-abbreviate-as-currency.d.ts +11 -0
- package/dist/util/format-and-abbreviate-as-currency.js +91 -0
- package/dist/util/format-to-max-char.d.ts +5 -0
- package/dist/util/format-to-max-char.js +57 -0
- package/dist/util/index-client.d.ts +2 -0
- package/dist/util/index-client.js +3 -0
- package/dist/util/index.d.ts +17 -0
- package/dist/util/index.js +41 -0
- package/dist/util/number-abbreviate.d.ts +9 -0
- package/dist/util/number-abbreviate.js +30 -0
- package/dist/util/specifier.d.ts +7 -0
- package/dist/util/specifier.js +31 -0
- package/dist/util/spread-to-transform.d.ts +7 -0
- package/dist/util/spread-to-transform.js +18 -0
- package/dist/util/step-animation.d.ts +5 -0
- package/dist/util/step-animation.js +60 -0
- package/dist/util/two-way-map.d.ts +8 -0
- package/dist/util/two-way-map.js +16 -0
- package/mcp/README.md +141 -0
- package/mcp/enhanced-server.ts +1208 -0
- package/mcp/index.ts +518 -0
- package/mcp/package.json +10 -0
- package/package.json +34 -14
- package/primitives/accordion.tsx +5 -5
- package/primitives/button.tsx +6 -3
- package/primitives/dialog.tsx +12 -7
- package/primitives/tabs.tsx +1 -1
- package/primitives/tooltip.tsx +1 -1
- package/public/r/accordion.json +11 -0
- package/public/r/alert.json +11 -0
- package/public/r/avatar.json +11 -0
- package/public/r/badge.json +11 -0
- package/public/r/button.json +11 -0
- package/public/r/card.json +11 -0
- package/public/r/checkbox.json +11 -0
- package/public/r/default.json +6 -0
- package/public/r/dialog.json +11 -0
- package/public/r/input.json +11 -0
- package/public/r/label.json +11 -0
- package/public/r/new-york.json +6 -0
- package/public/r/popover.json +11 -0
- package/public/r/select.json +11 -0
- package/public/r/table.json +11 -0
- package/public/r/tabs.json +11 -0
- package/public/r/toast.json +11 -0
- package/registry/api.ts +164 -0
- package/registry/index.ts +60 -0
- package/registry/package.json +10 -0
- package/registry.json +184 -0
- package/test/test-registry.js +73 -0
- package/tsconfig.json +8 -1
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
'use client';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as SheetPrimitive from '@radix-ui/react-dialog';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { cn } from '../util';
|
|
7
|
+
const Sheet = SheetPrimitive.Root;
|
|
8
|
+
const SheetTrigger = SheetPrimitive.Trigger;
|
|
9
|
+
const SheetClose = SheetPrimitive.Close;
|
|
10
|
+
const SheetPortal = SheetPrimitive.Portal;
|
|
11
|
+
const SheetOverlay = React.forwardRef(({ className, ...props }, ref) => (<SheetPrimitive.Overlay className={cn('fixed inset-0 z-below-modal bg-overlay backdrop-blur-sm', 'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0', className)} {...props} ref={ref}/>));
|
|
12
|
+
SheetOverlay.displayName = SheetPrimitive.Overlay.displayName;
|
|
13
|
+
const sheetVariants = cva('fixed z-modal gap-4 bg-background p-3 sm:p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-300', {
|
|
14
|
+
variants: {
|
|
15
|
+
side: {
|
|
16
|
+
top: 'inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top',
|
|
17
|
+
bottom: 'inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom',
|
|
18
|
+
left: 'inset-y-0 left-0 h-full w-5/6 sm:w-2/3 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm',
|
|
19
|
+
right: 'inset-y-0 right-0 h-full w-5/6 sm:w-2/3 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
defaultVariants: {
|
|
23
|
+
side: 'right',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const closeUIclx = 'rounded-sm opacity-70 ring-offset-background ' +
|
|
27
|
+
'transition-opacity hover:opacity-100 disabled:pointer-events-none data-[state=open]:bg-primary';
|
|
28
|
+
const SheetContent = React.forwardRef(({ side = 'right', className, children, closeElement, centerElement, duplicateCloseOnBottom = false, closeButtonClass, ...props }, ref) => {
|
|
29
|
+
const xOfCloseUIClass = (side === 'right') ? 'left-2' : 'right-2';
|
|
30
|
+
return (<SheetPortal>
|
|
31
|
+
<SheetOverlay />
|
|
32
|
+
<SheetPrimitive.Content ref={ref} className={cn(sheetVariants({ side }), className)} {...props}>
|
|
33
|
+
{children}
|
|
34
|
+
|
|
35
|
+
{closeElement && (<SheetPrimitive.Close className={cn(closeUIclx, 'absolute z-above-content top-3', xOfCloseUIClass, closeButtonClass)}>
|
|
36
|
+
{closeElement}
|
|
37
|
+
</SheetPrimitive.Close>)}
|
|
38
|
+
{closeElement && duplicateCloseOnBottom && (<SheetPrimitive.Close className={cn(closeUIclx, 'absolute z-above-content bottom-3', xOfCloseUIClass, closeButtonClass)}>
|
|
39
|
+
{closeElement}
|
|
40
|
+
</SheetPrimitive.Close>)}
|
|
41
|
+
{centerElement && (<div className={'absolute z-content top-3 left-0 right-0 flex flex-row justify-center align-start'}>
|
|
42
|
+
{centerElement}
|
|
43
|
+
</div>)}
|
|
44
|
+
</SheetPrimitive.Content>
|
|
45
|
+
</SheetPortal>);
|
|
46
|
+
});
|
|
47
|
+
SheetContent.displayName = SheetPrimitive.Content.displayName;
|
|
48
|
+
const SheetHeader = ({ className, ...props }) => (<div className={cn('flex flex-col space-y-2 text-center sm:text-left', className)} {...props}/>);
|
|
49
|
+
SheetHeader.displayName = 'SheetHeader';
|
|
50
|
+
const SheetFooter = ({ className, ...props }) => (<div className={cn('flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2', className)} {...props}/>);
|
|
51
|
+
SheetFooter.displayName = 'SheetFooter';
|
|
52
|
+
const SheetTitle = React.forwardRef(({ className, ...props }, ref) => (<SheetPrimitive.Title ref={ref} className={cn('text-lg font-semibold text-foreground', className)} {...props}/>));
|
|
53
|
+
SheetTitle.displayName = SheetPrimitive.Title.displayName;
|
|
54
|
+
const SheetDescription = React.forwardRef(({ className, ...props }, ref) => (<SheetPrimitive.Description ref={ref} className={cn('text-sm text-muted-1', className)} {...props}/>));
|
|
55
|
+
SheetDescription.displayName = SheetPrimitive.Description.displayName;
|
|
56
|
+
export { Sheet, SheetPortal, SheetOverlay, SheetTrigger, SheetClose, SheetContent, SheetHeader, SheetFooter, SheetTitle, SheetDescription, };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
|
+
declare const Slider: React.ForwardRefExoticComponent<Omit<SliderPrimitive.SliderProps & React.RefAttributes<HTMLSpanElement>, "ref"> & {
|
|
4
|
+
trackBgClx?: string;
|
|
5
|
+
rangeBgClx?: string;
|
|
6
|
+
thumbClx?: string;
|
|
7
|
+
thumbSlidingClx?: string;
|
|
8
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
9
|
+
export default Slider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
4
|
+
import { cn } from '../util';
|
|
5
|
+
import { useState } from 'react';
|
|
6
|
+
const Slider = React.forwardRef(({ className, trackBgClx = 'bg-level-2', rangeBgClx = 'bg-primary', thumbClx = '', thumbSlidingClx = '', onValueChange, onValueCommit, ...rest }, ref) => {
|
|
7
|
+
const [sliding, setSliding] = useState(false);
|
|
8
|
+
const _onChange = (value) => {
|
|
9
|
+
if (!sliding) {
|
|
10
|
+
setSliding(true);
|
|
11
|
+
}
|
|
12
|
+
if (onValueChange) {
|
|
13
|
+
onValueChange(value);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
const _onCommit = (value) => {
|
|
17
|
+
setSliding(false);
|
|
18
|
+
if (onValueCommit) {
|
|
19
|
+
onValueCommit(value);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return (<SliderPrimitive.Root ref={ref} className={cn('relative flex w-full touch-none select-none items-center', className)} onValueChange={_onChange} onValueCommit={_onCommit} {...rest}>
|
|
23
|
+
<SliderPrimitive.Track data-vaul-no-drag className={'relative h-2 w-full grow overflow-hidden rounded-full ' + trackBgClx}>
|
|
24
|
+
<SliderPrimitive.Range data-vaul-no-drag className={'absolute h-full ' + rangeBgClx}/>
|
|
25
|
+
</SliderPrimitive.Track>
|
|
26
|
+
<SliderPrimitive.Thumb data-vaul-no-drag className={cn('block h-5 w-5 rounded-full border-2 border-primary bg-background ', 'ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-1 ', 'focus-visible:ring-muted-2 focus-visible:ring-offset-1 disabled:pointer-events-none disabled:opacity-50', thumbClx, (sliding ? thumbSlidingClx : ''))}/>
|
|
27
|
+
</SliderPrimitive.Root>);
|
|
28
|
+
});
|
|
29
|
+
Slider.displayName = SliderPrimitive.Root.displayName;
|
|
30
|
+
export default Slider;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useTheme } from 'next-themes';
|
|
3
|
+
import { Toaster as Sonner } from 'sonner';
|
|
4
|
+
import { toast } from 'sonner';
|
|
5
|
+
const Toaster = ({ ...props }) => {
|
|
6
|
+
const { theme = 'system' } = useTheme();
|
|
7
|
+
return (<Sonner theme={theme} className='toaster group' toastOptions={{
|
|
8
|
+
classNames: {
|
|
9
|
+
toast: 'group toast group-[.toaster]:bg-level-2 group-[.toaster]:text-foreground group-[.toaster]:border-muted-3 group-[.toaster]:shadow-lg',
|
|
10
|
+
description: 'group-[.toast]:text-foreground',
|
|
11
|
+
actionButton: 'group-[.toast]:bg-primary group-[.toast]:text-primary-fg',
|
|
12
|
+
cancelButton: 'group-[.toast]:bg-transparent group-[.toast]:text-foreground',
|
|
13
|
+
},
|
|
14
|
+
}} {...props}/>);
|
|
15
|
+
};
|
|
16
|
+
export { toast, Toaster };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cn } from '../util';
|
|
3
|
+
const StepIndicator = ({ steps, currentStep, dotSizeRem, className = '', muted = false }) => {
|
|
4
|
+
const pX = `calc(${1 / (steps.length * 2) * 100}% - ${dotSizeRem / 2}rem)`;
|
|
5
|
+
// This code current throws 'Warning: Each child in a list should have a unique "key" prop.'
|
|
6
|
+
// As is evident, we supply keys that should suffice. < shrug >
|
|
7
|
+
return (<div className={cn('flex flex-col', className)}>
|
|
8
|
+
<div key='one'
|
|
9
|
+
/* id='FOO' */
|
|
10
|
+
className='flex flex-row items-center justify-start w-full' style={{ paddingLeft: pX, paddingRight: pX }}>
|
|
11
|
+
{steps.map((ignore, index) => (<>
|
|
12
|
+
{index !== 0 && (<div key={`sep-${index}`} className={cn('h-[1px] grow', currentStep >= index ? (muted ? 'bg-muted' : 'bg-foreground') : (muted ? 'bg-muted-3' : 'bg-level-3'))}/>)}
|
|
13
|
+
<div key={`circle-${index}`} style={{ width: `${dotSizeRem}rem`, height: `${dotSizeRem}rem` }} className={cn('shrink-0 rounded-full border-[1.5px]', currentStep >= index ? (muted ? 'bg-muted border-muted' : 'bg-foreground border-foreground') : '')}/>
|
|
14
|
+
</>))}
|
|
15
|
+
</div>
|
|
16
|
+
<div key='two' className={'grid ' + `grid-cols-${steps.length}` /* These are white listed already */}>
|
|
17
|
+
{steps.map((label, index) => (<div key={index} className={cn('text-center whitespace-nowrap', (muted ? 'text-muted' : 'text-foreground'))}>
|
|
18
|
+
{label}
|
|
19
|
+
</div>))}
|
|
20
|
+
</div>
|
|
21
|
+
</div>);
|
|
22
|
+
};
|
|
23
|
+
export default StepIndicator;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
3
|
+
declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
4
|
+
thumbClx?: string;
|
|
5
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export default Switch;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import * as SwitchPrimitives from '@radix-ui/react-switch';
|
|
4
|
+
import { cn } from '../util';
|
|
5
|
+
const Switch = React.forwardRef(({ className, thumbClx = '', ...props }, ref) => (<SwitchPrimitives.Root className={cn('peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full ' +
|
|
6
|
+
'border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none ' +
|
|
7
|
+
'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 ' +
|
|
8
|
+
'focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 ' +
|
|
9
|
+
'data-[state=checked]:bg-primary data-[state=unchecked]:bg-level-3', className)} {...props} ref={ref}>
|
|
10
|
+
<SwitchPrimitives.Thumb className={cn('pointer-events-none block h-4 w-4 rounded-full bg-background shadow-lg ' +
|
|
11
|
+
'ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0', thumbClx)}/>
|
|
12
|
+
</SwitchPrimitives.Root>));
|
|
13
|
+
Switch.displayName = SwitchPrimitives.Root.displayName;
|
|
14
|
+
export default Switch;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
3
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
4
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
5
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
6
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
7
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
8
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
9
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
10
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { cn } from '../util';
|
|
3
|
+
const Table = React.forwardRef(({ className, ...props }, ref) => (<div className='relative w-full overflow-auto'>
|
|
4
|
+
<table ref={ref} className={cn('w-full caption-bottom text-sm', className)} {...props}/>
|
|
5
|
+
</div>));
|
|
6
|
+
Table.displayName = 'Table';
|
|
7
|
+
const TableHeader = React.forwardRef(({ className, ...props }, ref) => (<thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props}/>));
|
|
8
|
+
TableHeader.displayName = 'TableHeader';
|
|
9
|
+
const TableBody = React.forwardRef(({ className, ...props }, ref) => (<tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props}/>));
|
|
10
|
+
TableBody.displayName = 'TableBody';
|
|
11
|
+
const TableFooter = React.forwardRef(({ className, ...props }, ref) => (<tfoot ref={ref} className={cn('border-t bg-level-1 font-medium [&>tr]:last:border-b-0', className)} {...props}/>));
|
|
12
|
+
TableFooter.displayName = 'TableFooter';
|
|
13
|
+
const TableRow = React.forwardRef(({ className, ...props }, ref) => (<tr ref={ref} className={cn('border-b transition-colors hover:bg-level-1 data-[state=selected]:bg-level-1', className)} {...props}/>));
|
|
14
|
+
TableRow.displayName = 'TableRow';
|
|
15
|
+
const TableHead = React.forwardRef(({ className, ...props }, ref) => (<th ref={ref} className={cn('h-12 px-4 text-left align-middle font-medium text-muted [&:has([role=checkbox])]:pr-0', className)} {...props}/>));
|
|
16
|
+
TableHead.displayName = 'TableHead';
|
|
17
|
+
const TableCell = React.forwardRef(({ className, ...props }, ref) => (<td ref={ref} className={cn('p-4 align-middle [&:has([role=checkbox])]:pr-0', className)} {...props}/>));
|
|
18
|
+
TableCell.displayName = 'TableCell';
|
|
19
|
+
const TableCaption = React.forwardRef(({ className, ...props }, ref) => (<caption ref={ref} className={cn('mt-4 text-sm text-muted', className)} {...props}/>));
|
|
20
|
+
TableCaption.displayName = 'TableCaption';
|
|
21
|
+
export { Table, TableHeader, TableBody, TableFooter, TableHead, TableRow, TableCell, TableCaption, };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
3
|
+
declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
4
|
+
import { cn } from '../util';
|
|
5
|
+
const Tabs = TabsPrimitive.Root;
|
|
6
|
+
const TabsList = React.forwardRef(({ className, ...props }, ref) => (<TabsPrimitive.List ref={ref} className={cn('inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground', className)} {...props}/>));
|
|
7
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
8
|
+
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (<TabsPrimitive.Trigger ref={ref} className={cn('inline-flex items-center justify-center whitespace-nowrap rounded-sm ' +
|
|
9
|
+
'px-3 py-1.5 text-sm font-medium ring-offset-background transition-all ' +
|
|
10
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ' +
|
|
11
|
+
'focus-visible:ring-offset-2 disabled:pointer-events-none ' +
|
|
12
|
+
'disabled:opacity-50 data-[state=active]:bg-background ' +
|
|
13
|
+
'data-[state=active]:text-foreground data-[state=active]:shadow-sm', className)} {...props}/>));
|
|
14
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
15
|
+
const TabsContent = React.forwardRef(({ className, ...props }, ref) => (<TabsPrimitive.Content ref={ref} className={cn('mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 ' +
|
|
16
|
+
'focus-visible:ring-ring focus-visible:ring-offset-2', className)} {...props}/>));
|
|
17
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
18
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { cn } from '../util';
|
|
3
|
+
const TextArea = React.forwardRef(({ className, ...props }, ref) => {
|
|
4
|
+
return (<textarea className={cn('flex min-h-[80px] w-full rounded-md border border-muted-3 px-3 py-2 text-sm ' +
|
|
5
|
+
'placeholder:text-muted-2 focus-visible:outline-none focus-visible:ring-2 ' +
|
|
6
|
+
'focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50', className)} ref={ref} {...props}/>);
|
|
7
|
+
});
|
|
8
|
+
TextArea.displayName = 'TextArea';
|
|
9
|
+
export default TextArea;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
3
|
+
import type { VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const ToggleGroup: React.ForwardRefExoticComponent<((Omit<ToggleGroupPrimitive.ToggleGroupSingleProps & React.RefAttributes<HTMLDivElement>, "ref"> | Omit<ToggleGroupPrimitive.ToggleGroupMultipleProps & React.RefAttributes<HTMLDivElement>, "ref">) & VariantProps<(props?: ({
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | "hfull" | null | undefined;
|
|
7
|
+
rounded?: "none" | "md" | "sm" | "lg" | "full" | "xl" | "lsm" | "rsm" | "lmd" | "rmd" | "llg" | "rlg" | "lxl" | "rxl" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string>) & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
declare const ToggleGroupItem: React.ForwardRefExoticComponent<Omit<ToggleGroupPrimitive.ToggleGroupItemProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
10
|
+
variant?: "default" | "outline" | null | undefined;
|
|
11
|
+
size?: "default" | "sm" | "lg" | "hfull" | null | undefined;
|
|
12
|
+
rounded?: "none" | "md" | "sm" | "lg" | "full" | "xl" | "lsm" | "rsm" | "lmd" | "rmd" | "llg" | "rlg" | "lxl" | "rxl" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
4
|
+
import { cn } from '../util';
|
|
5
|
+
import { toggleVariants } from './toggle';
|
|
6
|
+
const ToggleGroupContext = React.createContext({
|
|
7
|
+
size: 'default',
|
|
8
|
+
variant: 'default',
|
|
9
|
+
rounded: 'md'
|
|
10
|
+
});
|
|
11
|
+
const ToggleGroup = React.forwardRef(({ className, variant, size, rounded, children, ...props }, ref) => (<ToggleGroupPrimitive.Root ref={ref} className={cn('flex items-center justify-center gap-1', className)} {...props}>
|
|
12
|
+
<ToggleGroupContext.Provider value={{ variant, size, rounded }}>
|
|
13
|
+
{children}
|
|
14
|
+
</ToggleGroupContext.Provider>
|
|
15
|
+
</ToggleGroupPrimitive.Root>));
|
|
16
|
+
ToggleGroup.displayName = ToggleGroupPrimitive.Root.displayName;
|
|
17
|
+
const ToggleGroupItem = React.forwardRef(({ className, children, variant, size, rounded, ...props }, ref) => {
|
|
18
|
+
const context = React.useContext(ToggleGroupContext);
|
|
19
|
+
return (<ToggleGroupPrimitive.Item ref={ref} className={cn(toggleVariants({
|
|
20
|
+
variant: context.variant || variant,
|
|
21
|
+
size: context.size || size,
|
|
22
|
+
rounded: context.rounded || rounded,
|
|
23
|
+
}), className)} {...props}>
|
|
24
|
+
{children}
|
|
25
|
+
</ToggleGroupPrimitive.Item>);
|
|
26
|
+
});
|
|
27
|
+
ToggleGroupItem.displayName = ToggleGroupPrimitive.Item.displayName;
|
|
28
|
+
export { ToggleGroup, ToggleGroupItem };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const toggleVariants: (props?: ({
|
|
5
|
+
variant?: "default" | "outline" | null | undefined;
|
|
6
|
+
size?: "default" | "sm" | "lg" | "hfull" | null | undefined;
|
|
7
|
+
rounded?: "none" | "md" | "sm" | "lg" | "full" | "xl" | "lsm" | "rsm" | "lmd" | "rmd" | "llg" | "rlg" | "lxl" | "rxl" | null | undefined;
|
|
8
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
9
|
+
declare const Toggle: React.ForwardRefExoticComponent<Omit<TogglePrimitive.ToggleProps & React.RefAttributes<HTMLButtonElement>, "ref"> & VariantProps<(props?: ({
|
|
10
|
+
variant?: "default" | "outline" | null | undefined;
|
|
11
|
+
size?: "default" | "sm" | "lg" | "hfull" | null | undefined;
|
|
12
|
+
rounded?: "none" | "md" | "sm" | "lg" | "full" | "xl" | "lsm" | "rsm" | "lmd" | "rmd" | "llg" | "rlg" | "lxl" | "rxl" | null | undefined;
|
|
13
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
export { Toggle, toggleVariants };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { cn } from '../util';
|
|
6
|
+
const toggleVariants = cva('inline-flex items-center justify-center text-sm font-medium ' +
|
|
7
|
+
'ring-offset-background ' +
|
|
8
|
+
'focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring ' +
|
|
9
|
+
'focus-visible:ring-offset-2 disabled:pointer-events-none ' +
|
|
10
|
+
'active:bg-level-3 active:text-accent ', {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: 'text-muted-1 hover:text-accent ' +
|
|
14
|
+
'data-[state=off]:bg-level-1 hover:data-[state=off]:text-foreground ' +
|
|
15
|
+
'data-[state=on]:text-foreground data-[state=on]:bg-level-3 ' +
|
|
16
|
+
'data-[state=on]:hover:bg-level-3 ',
|
|
17
|
+
outline: 'border border-muted-3 text-muted-1 ' +
|
|
18
|
+
'data-[state=off]:bg-level-1 hover:data-[state=off]:text-foreground ' +
|
|
19
|
+
'data-[state=on]:bg-level-3 data-[state=on]:border-muted data-[state=on]:text-foreground',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
default: 'h-10 px-3',
|
|
23
|
+
hfull: 'h-full px-3',
|
|
24
|
+
sm: 'h-9 px-2',
|
|
25
|
+
lg: 'h-11 px-5',
|
|
26
|
+
},
|
|
27
|
+
rounded: {
|
|
28
|
+
full: 'rounded-full',
|
|
29
|
+
sm: 'rounded-sm',
|
|
30
|
+
lsm: 'rounded-l-sm',
|
|
31
|
+
rsm: 'rounded-r-sm',
|
|
32
|
+
md: 'rounded-md',
|
|
33
|
+
lmd: 'rounded-l-md',
|
|
34
|
+
rmd: 'rounded-r-md',
|
|
35
|
+
lg: 'rounded-lg',
|
|
36
|
+
llg: 'rounded-l-lg',
|
|
37
|
+
rlg: 'rounded-r-lg',
|
|
38
|
+
xl: 'rounded-xl',
|
|
39
|
+
lxl: 'rounded-l-xl',
|
|
40
|
+
rxl: 'rounded-r-xl',
|
|
41
|
+
none: 'rounded-none'
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
variant: 'default',
|
|
46
|
+
size: 'default',
|
|
47
|
+
rounded: 'md'
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
const Toggle = React.forwardRef(({ className, variant, size, rounded, ...props }, ref) => (<TogglePrimitive.Root ref={ref} className={cn(toggleVariants({ variant, size, rounded }), className)} {...props}/>));
|
|
51
|
+
Toggle.displayName = TogglePrimitive.Root.displayName;
|
|
52
|
+
export { Toggle, toggleVariants };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
3
|
+
declare const TooltipProvider: React.FC<TooltipPrimitive.TooltipProviderProps>;
|
|
4
|
+
declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
|
|
5
|
+
declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const TooltipWrapper: React.FC<{
|
|
8
|
+
text: string;
|
|
9
|
+
tooltipClx?: string;
|
|
10
|
+
} & React.PropsWithChildren>;
|
|
11
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipWrapper };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
4
|
+
import { cn } from '../util';
|
|
5
|
+
const TooltipProvider = TooltipPrimitive.Provider;
|
|
6
|
+
const Tooltip = TooltipPrimitive.Root;
|
|
7
|
+
const TooltipTrigger = TooltipPrimitive.Trigger;
|
|
8
|
+
const TooltipContent = React.forwardRef(({ className, sideOffset = 4, ...props }, ref) => (<TooltipPrimitive.Content ref={ref} sideOffset={sideOffset} className={cn('z-50 overflow-hidden rounded-md border bg-level-1 px-3 py-1.5 text-sm text-muted-foreground shadow-md animate-in fade-in-50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2', className)} {...props}/>));
|
|
9
|
+
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
10
|
+
const TooltipWrapper = ({ children, text, tooltipClx = '' }) => (<Tooltip>
|
|
11
|
+
<TooltipTrigger asChild>
|
|
12
|
+
{children}
|
|
13
|
+
</TooltipTrigger>
|
|
14
|
+
<TooltipContent className={tooltipClx}>
|
|
15
|
+
{text}
|
|
16
|
+
</TooltipContent>
|
|
17
|
+
</Tooltip>);
|
|
18
|
+
export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider, TooltipWrapper };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
const VideoPlayer = React.forwardRef(({ sources, ...rest }, ref) => {
|
|
4
|
+
return (<video ref={ref} {...rest}>
|
|
5
|
+
{sources.map((source, index) => (<source key={index} src={source}/>))}
|
|
6
|
+
</video>);
|
|
7
|
+
});
|
|
8
|
+
export default VideoPlayer;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RegistryItem, Registry } from ".";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the full registry URL based on the registry name or URL provided
|
|
4
|
+
* @param registry - Registry name, URL, or file path
|
|
5
|
+
* @returns The complete registry URL
|
|
6
|
+
*/
|
|
7
|
+
export declare function getRegistryUrl(registry: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Fetches a specific registry item by URL
|
|
10
|
+
* @param itemUrl - The URL of the item to fetch
|
|
11
|
+
* @param basePath - Base path for resolving imports
|
|
12
|
+
* @returns The registry item or null if not found
|
|
13
|
+
*/
|
|
14
|
+
export declare function getRegistryItem(itemUrl: string, basePath: string): Promise<RegistryItem | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Resolves an import path relative to a base path
|
|
17
|
+
* @param importPath - The import path to resolve
|
|
18
|
+
* @param basePath - The base path to resolve against
|
|
19
|
+
* @returns The resolved import path
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveImport(importPath: string, basePath: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Fetches registry data from one or more paths
|
|
24
|
+
* @param paths - Array of registry paths to fetch
|
|
25
|
+
* @param options - Options for fetching the registry
|
|
26
|
+
* @returns Array of registry data
|
|
27
|
+
*/
|
|
28
|
+
export declare function fetchRegistry(paths: string[], options?: {
|
|
29
|
+
useCache?: boolean;
|
|
30
|
+
}): Promise<Registry[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Gets the URL for a specific registry item
|
|
33
|
+
* @param itemName - The name of the registry item
|
|
34
|
+
* @param registryUrl - The base registry URL
|
|
35
|
+
* @returns The URL for the specific registry item
|
|
36
|
+
*/
|
|
37
|
+
export declare function getRegistryItemUrl(itemName: string, registryUrl: string): string;
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { registryItemSchema, RegistryItem, Registry } from ".";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const registryCache = new Map();
|
|
4
|
+
/**
|
|
5
|
+
* Gets the full registry URL based on the registry name or URL provided
|
|
6
|
+
* @param registry - Registry name, URL, or file path
|
|
7
|
+
* @returns The complete registry URL
|
|
8
|
+
*/
|
|
9
|
+
export function getRegistryUrl(registry) {
|
|
10
|
+
// Check if registry is a full URL
|
|
11
|
+
if (registry.startsWith("http")) {
|
|
12
|
+
return registry;
|
|
13
|
+
}
|
|
14
|
+
// Default to Hanzo registry if REGISTRY_BASE_URL is defined, otherwise use shadcn
|
|
15
|
+
const baseUrl = process.env.REGISTRY_BASE_URL || "https://ui.shadcn.com/registry";
|
|
16
|
+
// Check if registry is a path to a JSON file
|
|
17
|
+
if (registry.endsWith(".json")) {
|
|
18
|
+
return `${baseUrl}/${registry}`;
|
|
19
|
+
}
|
|
20
|
+
// Assume registry is a registry style
|
|
21
|
+
return `${baseUrl}/${registry}/registry.json`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Fetches a specific registry item by URL
|
|
25
|
+
* @param itemUrl - The URL of the item to fetch
|
|
26
|
+
* @param basePath - Base path for resolving imports
|
|
27
|
+
* @returns The registry item or null if not found
|
|
28
|
+
*/
|
|
29
|
+
export async function getRegistryItem(itemUrl, basePath) {
|
|
30
|
+
try {
|
|
31
|
+
const response = await fetch(itemUrl);
|
|
32
|
+
if (!response.ok) {
|
|
33
|
+
console.error(`Failed to fetch registry item from ${itemUrl}: ${response.status} ${response.statusText}`);
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
const item = await response.json();
|
|
37
|
+
const validatedItem = registryItemSchema.safeParse(item);
|
|
38
|
+
if (!validatedItem.success) {
|
|
39
|
+
console.error(`Invalid registry item format: ${JSON.stringify(validatedItem.error)}`);
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
// Process and resolve file paths
|
|
43
|
+
if (validatedItem.data.files) {
|
|
44
|
+
for (const file of validatedItem.data.files) {
|
|
45
|
+
if (!file.content) {
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
// If the file has a target, we resolve it from the target
|
|
49
|
+
if (file.target) {
|
|
50
|
+
file.target = resolveImport(file.target, basePath);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return validatedItem.data;
|
|
55
|
+
}
|
|
56
|
+
catch (error) {
|
|
57
|
+
console.error(`Error fetching registry item: ${error}`);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Resolves an import path relative to a base path
|
|
63
|
+
* @param importPath - The import path to resolve
|
|
64
|
+
* @param basePath - The base path to resolve against
|
|
65
|
+
* @returns The resolved import path
|
|
66
|
+
*/
|
|
67
|
+
export function resolveImport(importPath, basePath) {
|
|
68
|
+
const importParts = importPath?.split("/");
|
|
69
|
+
// Check if it's a relative import
|
|
70
|
+
if (importPath.startsWith(".")) {
|
|
71
|
+
return [basePath.replace(/^@/, ""), ...importParts].filter(Boolean).join("/");
|
|
72
|
+
}
|
|
73
|
+
// Check if it's a scope package
|
|
74
|
+
if (importParts?.[0]?.startsWith("@")) {
|
|
75
|
+
return importPath;
|
|
76
|
+
}
|
|
77
|
+
return importPath;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Fetches registry data from one or more paths
|
|
81
|
+
* @param paths - Array of registry paths to fetch
|
|
82
|
+
* @param options - Options for fetching the registry
|
|
83
|
+
* @returns Array of registry data
|
|
84
|
+
*/
|
|
85
|
+
export async function fetchRegistry(paths, options = {}) {
|
|
86
|
+
options = {
|
|
87
|
+
useCache: true,
|
|
88
|
+
...options,
|
|
89
|
+
};
|
|
90
|
+
try {
|
|
91
|
+
const results = await Promise.all(paths.map(async (path) => {
|
|
92
|
+
const url = getRegistryUrl(path);
|
|
93
|
+
// Check cache first if caching is enabled
|
|
94
|
+
if (options.useCache && registryCache.has(url)) {
|
|
95
|
+
return registryCache.get(url);
|
|
96
|
+
}
|
|
97
|
+
// Store the promise in the cache before awaiting if caching is enabled
|
|
98
|
+
const fetchPromise = (async () => {
|
|
99
|
+
const response = await fetch(url);
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
throw new Error(`Failed to fetch registry from ${url}. ${response.status} ${response.statusText}`);
|
|
102
|
+
}
|
|
103
|
+
return response.json();
|
|
104
|
+
})();
|
|
105
|
+
if (options.useCache) {
|
|
106
|
+
registryCache.set(url, fetchPromise);
|
|
107
|
+
}
|
|
108
|
+
return fetchPromise;
|
|
109
|
+
}));
|
|
110
|
+
return results;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
console.error(`Error fetching registry: ${error}`);
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Gets the URL for a specific registry item
|
|
119
|
+
* @param itemName - The name of the registry item
|
|
120
|
+
* @param registryUrl - The base registry URL
|
|
121
|
+
* @returns The URL for the specific registry item
|
|
122
|
+
*/
|
|
123
|
+
export function getRegistryItemUrl(itemName, registryUrl) {
|
|
124
|
+
const registryBaseUrl = registryUrl.replace(/\/registry\.json$/, "");
|
|
125
|
+
return `${registryBaseUrl}/r/${itemName}.json`;
|
|
126
|
+
}
|
|
127
|
+
// Support CommonJS
|
|
128
|
+
if (typeof module !== 'undefined') {
|
|
129
|
+
module.exports = { getRegistryUrl, getRegistryItem, resolveImport, fetchRegistry, getRegistryItemUrl };
|
|
130
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const fileSchema: any;
|
|
3
|
+
export declare const registryItemSchema: any;
|
|
4
|
+
export declare const registrySchema: any;
|
|
5
|
+
export declare const registryWithContentSchema: any;
|
|
6
|
+
export type RegistryItem = z.infer<typeof registryItemSchema>;
|
|
7
|
+
export type Registry = z.infer<typeof registrySchema>;
|
|
8
|
+
export type RegistryWithContent = z.infer<typeof registryWithContentSchema>;
|
|
9
|
+
export type RegistryFile = z.infer<typeof fileSchema>;
|