@hanzo/ui 4.5.0 → 4.5.3
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 +36 -16
- 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,28 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* MCP Server implementation for @hanzo/ui registry
|
|
4
|
+
* Provides tools for interacting with the registry
|
|
5
|
+
*/
|
|
6
|
+
export declare const server: Server<{
|
|
7
|
+
method: string;
|
|
8
|
+
params?: {
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
_meta?: {
|
|
11
|
+
[x: string]: unknown;
|
|
12
|
+
progressToken?: string | number | undefined;
|
|
13
|
+
} | undefined;
|
|
14
|
+
} | undefined;
|
|
15
|
+
}, {
|
|
16
|
+
method: string;
|
|
17
|
+
params?: {
|
|
18
|
+
[x: string]: unknown;
|
|
19
|
+
_meta?: {
|
|
20
|
+
[x: string]: unknown;
|
|
21
|
+
} | undefined;
|
|
22
|
+
} | undefined;
|
|
23
|
+
}, {
|
|
24
|
+
[x: string]: unknown;
|
|
25
|
+
_meta?: {
|
|
26
|
+
[x: string]: unknown;
|
|
27
|
+
} | undefined;
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import { registrySchema, Registry, RegistryItem } from "../registry";
|
|
2
|
+
import { fetchRegistry, getRegistryItem, getRegistryItemUrl } from "../registry/api";
|
|
3
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
7
|
+
// Get package version
|
|
8
|
+
let packageVersion = "4.5.0";
|
|
9
|
+
try {
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
+
const packageJson = require("../../package.json");
|
|
12
|
+
packageVersion = packageJson.version || packageVersion;
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
console.error("Could not load package.json for version", error);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* MCP Server implementation for @hanzo/ui registry
|
|
19
|
+
* Provides tools for interacting with the registry
|
|
20
|
+
*/
|
|
21
|
+
export const server = new Server({
|
|
22
|
+
name: "hanzo-ui",
|
|
23
|
+
version: packageVersion,
|
|
24
|
+
}, {
|
|
25
|
+
capabilities: {
|
|
26
|
+
resources: {},
|
|
27
|
+
tools: {},
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
// Register the available tools
|
|
31
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
32
|
+
return {
|
|
33
|
+
tools: [
|
|
34
|
+
{
|
|
35
|
+
name: "init",
|
|
36
|
+
description: "Initialize a new project using @hanzo/ui components and styles.",
|
|
37
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
38
|
+
style: z.string().optional().describe("The style to use for the project (e.g., 'default' or 'new-york')"),
|
|
39
|
+
})),
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
name: "list_components",
|
|
43
|
+
description: "List all available components in the registry",
|
|
44
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
45
|
+
type: z.string().optional().describe("Filter components by type (e.g., 'ui', 'block')"),
|
|
46
|
+
category: z.string().optional().describe("Filter components by category"),
|
|
47
|
+
})),
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "get_component",
|
|
51
|
+
description: "Get detailed information about a specific component",
|
|
52
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
53
|
+
name: z
|
|
54
|
+
.string()
|
|
55
|
+
.describe("The name of the component to get from the registry"),
|
|
56
|
+
})),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "add_component",
|
|
60
|
+
description: "Get instructions for adding a component to a project",
|
|
61
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
62
|
+
name: z
|
|
63
|
+
.string()
|
|
64
|
+
.describe("The name of the component to add"),
|
|
65
|
+
style: z
|
|
66
|
+
.string()
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("The style to use (default, new-york, etc.)"),
|
|
69
|
+
})),
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "list_styles",
|
|
73
|
+
description: "List all available styles in the registry",
|
|
74
|
+
inputSchema: zodToJsonSchema(z.object({})),
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "search_registry",
|
|
78
|
+
description: "Search the registry for components matching criteria",
|
|
79
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
80
|
+
query: z
|
|
81
|
+
.string()
|
|
82
|
+
.describe("Search term to look for in component names and descriptions"),
|
|
83
|
+
})),
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
// Handle tool calls
|
|
89
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
90
|
+
try {
|
|
91
|
+
// Ensure we have arguments
|
|
92
|
+
const args = request.params.arguments || {};
|
|
93
|
+
// Get registry URL from environment variable or use default
|
|
94
|
+
const REGISTRY_URL = process.env.REGISTRY_URL || "https://ui.hanzo.ai/registry/registry.json";
|
|
95
|
+
const registry = await getRegistry(REGISTRY_URL);
|
|
96
|
+
switch (request.params.name) {
|
|
97
|
+
case "init": {
|
|
98
|
+
const style = args.style || "default";
|
|
99
|
+
let text = `# Initialize a new project with @hanzo/ui
|
|
100
|
+
|
|
101
|
+
To create a new project with @hanzo/ui components, follow these steps:
|
|
102
|
+
|
|
103
|
+
1. Create a new project first:
|
|
104
|
+
\`\`\`bash
|
|
105
|
+
# Using npm
|
|
106
|
+
npm create next-app@latest my-app
|
|
107
|
+
|
|
108
|
+
# Or using yarn
|
|
109
|
+
yarn create next-app my-app
|
|
110
|
+
|
|
111
|
+
# Or using pnpm
|
|
112
|
+
pnpm create next-app my-app
|
|
113
|
+
\`\`\`
|
|
114
|
+
|
|
115
|
+
2. Navigate to your project directory:
|
|
116
|
+
\`\`\`bash
|
|
117
|
+
cd my-app
|
|
118
|
+
\`\`\`
|
|
119
|
+
|
|
120
|
+
3. Install @hanzo/ui and initialize it:
|
|
121
|
+
\`\`\`bash
|
|
122
|
+
npx @hanzo/ui@latest init${style ? ` --style=${style}` : ""}
|
|
123
|
+
\`\`\`
|
|
124
|
+
|
|
125
|
+
This will:
|
|
126
|
+
- Install all necessary dependencies
|
|
127
|
+
- Set up the project structure for @hanzo/ui
|
|
128
|
+
- Configure tailwind.css with the appropriate theme
|
|
129
|
+
- Add component configuration
|
|
130
|
+
`;
|
|
131
|
+
// Check if the registry has any additional setup instructions
|
|
132
|
+
const setupConfig = registry.items.find((item) => item.type === "registry:config" && item.name === "setup");
|
|
133
|
+
if (setupConfig) {
|
|
134
|
+
text += `
|
|
135
|
+
## Additional Setup
|
|
136
|
+
|
|
137
|
+
${setupConfig.description || "Follow any additional setup instructions provided during initialization."}
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
return {
|
|
141
|
+
content: [
|
|
142
|
+
{ type: "text", text }
|
|
143
|
+
],
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
case "list_components": {
|
|
147
|
+
// Filter components based on type and category if provided
|
|
148
|
+
const typeFilter = args.type ? `ui:${args.type}` : null;
|
|
149
|
+
const categoryFilter = args.category || null;
|
|
150
|
+
let components = registry.items.filter(item => {
|
|
151
|
+
// Filter by type if specified
|
|
152
|
+
if (typeFilter && !item.type.includes(typeFilter)) {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
// Filter by category if specified
|
|
156
|
+
if (categoryFilter && item.category !== categoryFilter) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
return true;
|
|
160
|
+
});
|
|
161
|
+
// Group components by category if they have categories
|
|
162
|
+
const hasCategories = components.some(item => item.category);
|
|
163
|
+
let responseText = "# Available Components\n\n";
|
|
164
|
+
if (hasCategories) {
|
|
165
|
+
// Group by category
|
|
166
|
+
const categorized = components.reduce((acc, item) => {
|
|
167
|
+
const category = item.category || "Uncategorized";
|
|
168
|
+
if (!acc[category]) {
|
|
169
|
+
acc[category] = [];
|
|
170
|
+
}
|
|
171
|
+
acc[category].push(item);
|
|
172
|
+
return acc;
|
|
173
|
+
}, {});
|
|
174
|
+
// Build response
|
|
175
|
+
for (const [category, items] of Object.entries(categorized)) {
|
|
176
|
+
responseText += `## ${category}\n\n`;
|
|
177
|
+
items.forEach(item => {
|
|
178
|
+
responseText += `- **${item.name}** - ${item.description || 'No description available'}\n`;
|
|
179
|
+
});
|
|
180
|
+
responseText += "\n";
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// Simple list
|
|
185
|
+
components.forEach(item => {
|
|
186
|
+
responseText += `- **${item.name}** (${item.type}) - ${item.description || 'No description available'}\n`;
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
responseText += "\nTo get detailed information about a specific component, use the `get_component` tool.\n";
|
|
190
|
+
responseText += "To add a component to your project, use the `add_component` tool.\n";
|
|
191
|
+
return {
|
|
192
|
+
content: [{ type: "text", text: responseText }],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
case "get_component": {
|
|
196
|
+
const name = z.string().parse(args.name);
|
|
197
|
+
if (!name) {
|
|
198
|
+
throw new Error("Component name is required");
|
|
199
|
+
}
|
|
200
|
+
const itemUrl = getRegistryItemUrl(name, REGISTRY_URL);
|
|
201
|
+
const component = await getRegistryItem(itemUrl, "");
|
|
202
|
+
if (!component) {
|
|
203
|
+
return {
|
|
204
|
+
content: [
|
|
205
|
+
{
|
|
206
|
+
type: "text",
|
|
207
|
+
text: `Component '${name}' not found in the registry.`,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// Build a markdown description of the component
|
|
213
|
+
let componentDetails = `# ${component.name}\n\n`;
|
|
214
|
+
if (component.description) {
|
|
215
|
+
componentDetails += `${component.description}\n\n`;
|
|
216
|
+
}
|
|
217
|
+
componentDetails += `**Type:** ${component.type}\n`;
|
|
218
|
+
if (component.category) {
|
|
219
|
+
componentDetails += `**Category:** ${component.category}\n`;
|
|
220
|
+
}
|
|
221
|
+
// Dependencies
|
|
222
|
+
if (component.dependencies && component.dependencies.length > 0) {
|
|
223
|
+
componentDetails += `\n## Dependencies\n\n`;
|
|
224
|
+
component.dependencies.forEach(dep => {
|
|
225
|
+
componentDetails += `- ${dep}\n`;
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
// Registry Dependencies
|
|
229
|
+
if (component.registryDependencies && component.registryDependencies.length > 0) {
|
|
230
|
+
componentDetails += `\n## Required Components\n\n`;
|
|
231
|
+
componentDetails += `This component requires the following components that will be installed automatically:\n\n`;
|
|
232
|
+
component.registryDependencies.forEach(dep => {
|
|
233
|
+
componentDetails += `- ${dep}\n`;
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
// Files
|
|
237
|
+
if (component.files && component.files.length > 0) {
|
|
238
|
+
componentDetails += `\n## Files\n\n`;
|
|
239
|
+
component.files.forEach(file => {
|
|
240
|
+
componentDetails += `- ${file.path} (${file.type})\n`;
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
// Show example usage if available
|
|
244
|
+
const exampleFile = component.files?.find(file => file.type === "registry:example");
|
|
245
|
+
if (exampleFile && exampleFile.content) {
|
|
246
|
+
componentDetails += `\n## Example Usage\n\n\`\`\`tsx\n${exampleFile.content}\n\`\`\`\n`;
|
|
247
|
+
}
|
|
248
|
+
// Add installation instructions
|
|
249
|
+
componentDetails += `\n## Installation\n\n`;
|
|
250
|
+
componentDetails += `Run the following command to add this component to your project:\n\n`;
|
|
251
|
+
componentDetails += `\`\`\`bash\n`;
|
|
252
|
+
componentDetails += `npx @hanzo/ui@latest add ${name}\n`;
|
|
253
|
+
componentDetails += `\`\`\`\n`;
|
|
254
|
+
return {
|
|
255
|
+
content: [{ type: "text", text: componentDetails }],
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
case "add_component": {
|
|
259
|
+
const name = z.string().parse(args.name);
|
|
260
|
+
const style = args.style || "default";
|
|
261
|
+
if (!name) {
|
|
262
|
+
throw new Error("Component name is required");
|
|
263
|
+
}
|
|
264
|
+
const itemUrl = getRegistryItemUrl(name, REGISTRY_URL);
|
|
265
|
+
const component = await getRegistryItem(itemUrl, "");
|
|
266
|
+
if (!component) {
|
|
267
|
+
return {
|
|
268
|
+
content: [
|
|
269
|
+
{
|
|
270
|
+
type: "text",
|
|
271
|
+
text: `Component '${name}' not found in the registry.`,
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
// Check if the component has dependencies
|
|
277
|
+
const hasDeps = component.registryDependencies && component.registryDependencies.length > 0;
|
|
278
|
+
let instructions = `# Adding the ${name} Component\n\n`;
|
|
279
|
+
// Main installation command
|
|
280
|
+
instructions += `Run the following command to add the \`${name}\` component to your project:\n\n`;
|
|
281
|
+
instructions += `\`\`\`bash\n`;
|
|
282
|
+
instructions += `npx @hanzo/ui@latest add ${name} --style=${style}\n`;
|
|
283
|
+
instructions += `\`\`\`\n\n`;
|
|
284
|
+
// Explain what this will do
|
|
285
|
+
instructions += `This will:\n`;
|
|
286
|
+
instructions += `- Add the component file(s) to your project\n`;
|
|
287
|
+
instructions += `- Install any required npm dependencies\n`;
|
|
288
|
+
if (hasDeps) {
|
|
289
|
+
instructions += `- Install required component dependencies: ${component.registryDependencies.join(", ")}\n`;
|
|
290
|
+
}
|
|
291
|
+
// Usage example
|
|
292
|
+
instructions += `\n## Usage\n\nAfter adding the component, you can import it in your project:\n\n`;
|
|
293
|
+
instructions += `\`\`\`tsx\n`;
|
|
294
|
+
instructions += `import { ${name.charAt(0).toUpperCase() + name.slice(1)} } from "@/components/ui/${name}"\n\n`;
|
|
295
|
+
// Add a simple example if possible
|
|
296
|
+
if (component.type.includes("ui:")) {
|
|
297
|
+
instructions += `export default function Example() {\n`;
|
|
298
|
+
instructions += ` return <${name.charAt(0).toUpperCase() + name.slice(1)} />\n`;
|
|
299
|
+
instructions += `}\n`;
|
|
300
|
+
}
|
|
301
|
+
instructions += `\`\`\`\n`;
|
|
302
|
+
return {
|
|
303
|
+
content: [
|
|
304
|
+
{
|
|
305
|
+
type: "text",
|
|
306
|
+
text: instructions,
|
|
307
|
+
},
|
|
308
|
+
],
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
case "list_styles": {
|
|
312
|
+
// Find all style-related items in the registry
|
|
313
|
+
const styles = registry.items.filter(item => item.type === "registry:style" || item.type.includes("style"));
|
|
314
|
+
let styleInfo = "# Available Styles\n\n";
|
|
315
|
+
if (styles.length === 0) {
|
|
316
|
+
styleInfo += "The registry does not define any specific styles.\n\n";
|
|
317
|
+
styleInfo += "The default style will be used when installing components.\n";
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
styles.forEach(style => {
|
|
321
|
+
styleInfo += `## ${style.name}\n\n`;
|
|
322
|
+
styleInfo += `${style.description || 'No description available'}\n\n`;
|
|
323
|
+
// Add usage info
|
|
324
|
+
styleInfo += `**Usage:**\n\n`;
|
|
325
|
+
styleInfo += `\`\`\`bash\n`;
|
|
326
|
+
styleInfo += `# Initialize with this style\n`;
|
|
327
|
+
styleInfo += `npx @hanzo/ui@latest init --style=${style.name}\n\n`;
|
|
328
|
+
styleInfo += `# Install components with this style\n`;
|
|
329
|
+
styleInfo += `npx @hanzo/ui@latest add [component] --style=${style.name}\n`;
|
|
330
|
+
styleInfo += `\`\`\`\n\n`;
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return {
|
|
334
|
+
content: [{ type: "text", text: styleInfo }],
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
case "search_registry": {
|
|
338
|
+
const query = z.string().parse(args.query).toLowerCase();
|
|
339
|
+
if (!query || query.length < 2) {
|
|
340
|
+
return {
|
|
341
|
+
content: [
|
|
342
|
+
{
|
|
343
|
+
type: "text",
|
|
344
|
+
text: "Please provide a search term with at least 2 characters.",
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
// Search through all items in the registry
|
|
350
|
+
const results = registry.items.filter(item => {
|
|
351
|
+
// Search in name
|
|
352
|
+
if (item.name.toLowerCase().includes(query)) {
|
|
353
|
+
return true;
|
|
354
|
+
}
|
|
355
|
+
// Search in description
|
|
356
|
+
if (item.description?.toLowerCase().includes(query)) {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
// Search in category
|
|
360
|
+
if (item.category?.toLowerCase().includes(query)) {
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
});
|
|
365
|
+
if (results.length === 0) {
|
|
366
|
+
return {
|
|
367
|
+
content: [
|
|
368
|
+
{
|
|
369
|
+
type: "text",
|
|
370
|
+
text: `No components found matching '${query}'. Try a different search term.`,
|
|
371
|
+
},
|
|
372
|
+
],
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// Format the results
|
|
376
|
+
let searchResults = `# Search Results for '${query}'\n\n`;
|
|
377
|
+
searchResults += `Found ${results.length} matching components\n\n`;
|
|
378
|
+
results.forEach(item => {
|
|
379
|
+
searchResults += `## ${item.name}\n\n`;
|
|
380
|
+
searchResults += `**Type:** ${item.type}\n`;
|
|
381
|
+
if (item.category) {
|
|
382
|
+
searchResults += `**Category:** ${item.category}\n`;
|
|
383
|
+
}
|
|
384
|
+
if (item.description) {
|
|
385
|
+
searchResults += `\n${item.description}\n`;
|
|
386
|
+
}
|
|
387
|
+
searchResults += `\n**Installation:**\n\n`;
|
|
388
|
+
searchResults += `\`\`\`bash\nnpx @hanzo/ui@latest add ${item.name}\n\`\`\`\n\n`;
|
|
389
|
+
});
|
|
390
|
+
return {
|
|
391
|
+
content: [{ type: "text", text: searchResults }],
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
default:
|
|
395
|
+
throw new Error(`Tool ${request.params.name} not found`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
catch (error) {
|
|
399
|
+
if (error instanceof z.ZodError) {
|
|
400
|
+
return {
|
|
401
|
+
content: [
|
|
402
|
+
{
|
|
403
|
+
type: "text",
|
|
404
|
+
text: `Invalid input: ${JSON.stringify(error.errors)}`,
|
|
405
|
+
},
|
|
406
|
+
],
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
throw error;
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
/**
|
|
413
|
+
* Fetches and parses the registry from the given URL
|
|
414
|
+
* @param registryUrl - URL to the registry.json file
|
|
415
|
+
* @returns The parsed registry object
|
|
416
|
+
*/
|
|
417
|
+
async function getRegistry(registryUrl) {
|
|
418
|
+
try {
|
|
419
|
+
const [registryJson] = await fetchRegistry([registryUrl], {
|
|
420
|
+
useCache: false,
|
|
421
|
+
});
|
|
422
|
+
return registrySchema.parse(registryJson);
|
|
423
|
+
}
|
|
424
|
+
catch (error) {
|
|
425
|
+
console.error(`Failed to fetch registry from ${registryUrl}:`, error);
|
|
426
|
+
// Return a minimal valid registry if we can't fetch the real one
|
|
427
|
+
return {
|
|
428
|
+
name: "hanzo-ui",
|
|
429
|
+
items: [],
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
// Support CommonJS
|
|
434
|
+
if (typeof module !== 'undefined') {
|
|
435
|
+
module.exports = { server };
|
|
436
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
|
+
declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
6
|
+
showChevron?: boolean;
|
|
7
|
+
headerClx?: string;
|
|
8
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
"use client";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
5
|
+
import { ChevronDown } from "lucide-react";
|
|
6
|
+
import { cn } from "../util";
|
|
7
|
+
const Accordion = AccordionPrimitive.Root;
|
|
8
|
+
const AccordionItem = React.forwardRef(({ className, ...props }, ref) => (<AccordionPrimitive.Item ref={ref} className={cn("border-b", className)} {...props}/>));
|
|
9
|
+
AccordionItem.displayName = "AccordionItem";
|
|
10
|
+
const AccordionTrigger = React.forwardRef(({ showChevron = true, headerClx, className, children, ...props }, ref) => (<AccordionPrimitive.Header className={cn('flex', headerClx)}>
|
|
11
|
+
<AccordionPrimitive.Trigger ref={ref} className={cn("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180", className)} {...props}>
|
|
12
|
+
{children}
|
|
13
|
+
{showChevron && <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200"/>}
|
|
14
|
+
</AccordionPrimitive.Trigger>
|
|
15
|
+
</AccordionPrimitive.Header>));
|
|
16
|
+
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
17
|
+
const AccordionContent = React.forwardRef(({ className, children, ...props }, ref) => (<AccordionPrimitive.Content ref={ref} className={cn("overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down", className)} {...props}>
|
|
18
|
+
<div className="pb-4 pt-0">{children}</div>
|
|
19
|
+
</AccordionPrimitive.Content>));
|
|
20
|
+
AccordionContent.displayName = AccordionPrimitive.Content.displayName;
|
|
21
|
+
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type VariantProps } from '../util';
|
|
3
|
+
import type { ButtonDef } from '../types';
|
|
4
|
+
import type { buttonVariants } from './button';
|
|
5
|
+
declare const ActionButton: React.FC<VariantProps<typeof buttonVariants> & {
|
|
6
|
+
def: ButtonDef;
|
|
7
|
+
className?: string;
|
|
8
|
+
}>;
|
|
9
|
+
export default ActionButton;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { cn } from '../util';
|
|
4
|
+
import DVC from './dialog-video-controller';
|
|
5
|
+
const ActionButton = ({ def, className = '', ...rest }) => {
|
|
6
|
+
if (def.action.type === 'modal') {
|
|
7
|
+
const m = def.action.def;
|
|
8
|
+
const Modal = m.Comp;
|
|
9
|
+
return (<DVC>
|
|
10
|
+
<Modal title={m.title} byline={m.byline} buttonText={def.text} buttonProps={{ ...def.props, ...rest, className: cn((def.props?.className ?? ''), className) }} action={m.action} actionEnclosure={m.actionEnclosure} {...m.props}/>
|
|
11
|
+
</DVC>);
|
|
12
|
+
}
|
|
13
|
+
// no other types supported yet
|
|
14
|
+
return <></>;
|
|
15
|
+
};
|
|
16
|
+
export default ActionButton;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type TypographySize = 'responsive' | 'sm' | 'base' | 'lg' | 'xl';
|
|
3
|
+
declare const ApplyTypography: React.FC<React.ComponentProps<'div'> & {
|
|
4
|
+
asTag?: 'div' | 'section' | 'nav' | 'main' | 'article';
|
|
5
|
+
size?: TypographySize;
|
|
6
|
+
}>;
|
|
7
|
+
export { type TypographySize, ApplyTypography as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React, {} from 'react';
|
|
2
|
+
import { cn } from '../util';
|
|
3
|
+
const ApplyTypography = ({ children, className = '', asTag = 'div', size = 'responsive', ...rest }) => {
|
|
4
|
+
// responsive version by default
|
|
5
|
+
let typoClasses = 'typography gap-3 ' +
|
|
6
|
+
'xs:typography-sm ' +
|
|
7
|
+
'sm:typography sm:gap-4 ' +
|
|
8
|
+
'lg:typography-lg lg:gap-5 ' +
|
|
9
|
+
'xl:typography-xl xl:gap-6 ' +
|
|
10
|
+
'typography-headings:font-heading '; // only effects h1-h3 (in plugin)
|
|
11
|
+
switch (size) {
|
|
12
|
+
case 'sm':
|
|
13
|
+
{
|
|
14
|
+
typoClasses = 'typography typography-sm gap-3 typography-headings:font-heading typography-p:text-sm ';
|
|
15
|
+
}
|
|
16
|
+
break;
|
|
17
|
+
case 'base':
|
|
18
|
+
{
|
|
19
|
+
typoClasses = 'typography gap-4 typography-headings:font-heading ';
|
|
20
|
+
}
|
|
21
|
+
break;
|
|
22
|
+
case 'lg':
|
|
23
|
+
{
|
|
24
|
+
typoClasses = 'typography typography-lg gap-5 typography-headings:font-heading typography-p:text-lg ';
|
|
25
|
+
}
|
|
26
|
+
break;
|
|
27
|
+
case 'xl':
|
|
28
|
+
{
|
|
29
|
+
typoClasses = 'typography typography-xl gap-6 typography-headings:font-heading typography-p:text-lg ';
|
|
30
|
+
}
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
const Tag = asTag;
|
|
34
|
+
return (<Tag {...rest} className={cn(typoClasses, className)}>
|
|
35
|
+
{children}
|
|
36
|
+
</Tag>);
|
|
37
|
+
};
|
|
38
|
+
export { ApplyTypography as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
3
|
+
declare const Avatar: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
4
|
+
declare const AvatarImage: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarImageProps & React.RefAttributes<HTMLImageElement>, "ref"> & React.RefAttributes<HTMLImageElement>>;
|
|
5
|
+
declare const AvatarFallback: React.ForwardRefExoticComponent<Omit<AvatarPrimitive.AvatarFallbackProps & React.RefAttributes<HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import * as AvatarPrimitive from '@radix-ui/react-avatar';
|
|
4
|
+
import { cn } from '../util';
|
|
5
|
+
const Avatar = React.forwardRef(({ className, ...props }, ref) => (<AvatarPrimitive.Root ref={ref} className={cn('relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full', className)} {...props}/>));
|
|
6
|
+
Avatar.displayName = AvatarPrimitive.Root.displayName;
|
|
7
|
+
const AvatarImage = React.forwardRef(({ className, ...props }, ref) => (<AvatarPrimitive.Image ref={ref} className={cn('aspect-square h-full w-full', className)} {...props}/>));
|
|
8
|
+
AvatarImage.displayName = AvatarPrimitive.Image.displayName;
|
|
9
|
+
const AvatarFallback = React.forwardRef(({ className, ...props }, ref) => (<AvatarPrimitive.Fallback ref={ref} className={cn('flex h-full w-full items-center justify-center rounded-full bg-muted', className)} {...props}/>));
|
|
10
|
+
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName;
|
|
11
|
+
export { Avatar, AvatarImage, AvatarFallback };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { type VariantProps } from "class-variance-authority";
|
|
3
|
+
declare const badgeVariants: (props?: ({
|
|
4
|
+
variant?: "default" | "secondary" | "outline" | "destructive" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
7
|
+
}
|
|
8
|
+
declare const Badge: React.FC<BadgeProps>;
|
|
9
|
+
export { Badge as default, badgeVariants, type BadgeProps };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cva } from "class-variance-authority";
|
|
3
|
+
import { cn } from "../util";
|
|
4
|
+
const badgeVariants = cva("inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-ring ", {
|
|
5
|
+
variants: {
|
|
6
|
+
variant: {
|
|
7
|
+
default: "border-transparent bg-primary text-primary-fg shadow hover:bg-primary/80",
|
|
8
|
+
secondary: "border-transparent bg-secondary text-secondary-fg hover:bg-secondary/80",
|
|
9
|
+
destructive: "border-transparent bg-destructive text-destructive-fg shadow hover:bg-destructive/80",
|
|
10
|
+
outline: "text-foreground",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
defaultVariants: {
|
|
14
|
+
variant: "default",
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
const Badge = ({ className, variant, ...props }) => (<div className={cn(badgeVariants({ variant }), className)} {...props}/>);
|
|
18
|
+
export { Badge as default, badgeVariants };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
declare const Breadcrumb: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
3
|
+
separator?: React.ReactNode;
|
|
4
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
5
|
+
declare const BreadcrumbList: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, "ref"> & React.RefAttributes<HTMLOListElement>>;
|
|
6
|
+
declare const BreadcrumbItem: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "ref"> & React.RefAttributes<HTMLLIElement>>;
|
|
7
|
+
declare const BreadcrumbLink: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref"> & {
|
|
8
|
+
asChild?: boolean;
|
|
9
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
10
|
+
declare const BreadcrumbPage: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
11
|
+
declare const BreadcrumbSeparator: {
|
|
12
|
+
({ children, className, ...props }: React.ComponentProps<"li">): React.JSX.Element;
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
declare const BreadcrumbEllipsis: {
|
|
16
|
+
({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
17
|
+
displayName: string;
|
|
18
|
+
};
|
|
19
|
+
export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
|