@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
package/mcp/index.ts
ADDED
|
@@ -0,0 +1,518 @@
|
|
|
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 {
|
|
5
|
+
CallToolRequestSchema,
|
|
6
|
+
ListToolsRequestSchema,
|
|
7
|
+
} from "@modelcontextprotocol/sdk/types.js"
|
|
8
|
+
import { z } from "zod"
|
|
9
|
+
import { zodToJsonSchema } from "zod-to-json-schema"
|
|
10
|
+
|
|
11
|
+
// Get package version
|
|
12
|
+
let packageVersion = "4.5.0"
|
|
13
|
+
try {
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
15
|
+
const packageJson = require("../../package.json")
|
|
16
|
+
packageVersion = packageJson.version || packageVersion
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.error("Could not load package.json for version", error)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* MCP Server implementation for @hanzo/ui registry
|
|
23
|
+
* Provides tools for interacting with the registry
|
|
24
|
+
*/
|
|
25
|
+
export const server = new Server(
|
|
26
|
+
{
|
|
27
|
+
name: "hanzo-ui",
|
|
28
|
+
version: packageVersion,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
capabilities: {
|
|
32
|
+
resources: {},
|
|
33
|
+
tools: {},
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
// Register the available tools
|
|
39
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
40
|
+
return {
|
|
41
|
+
tools: [
|
|
42
|
+
{
|
|
43
|
+
name: "init",
|
|
44
|
+
description:
|
|
45
|
+
"Initialize a new project using @hanzo/ui components and styles.",
|
|
46
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
47
|
+
style: z.string().optional().describe("The style to use for the project (e.g., 'default' or 'new-york')"),
|
|
48
|
+
})),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "list_components",
|
|
52
|
+
description: "List all available components in the registry",
|
|
53
|
+
inputSchema: zodToJsonSchema(z.object({
|
|
54
|
+
type: z.string().optional().describe("Filter components by type (e.g., 'ui', 'block')"),
|
|
55
|
+
category: z.string().optional().describe("Filter components by category"),
|
|
56
|
+
})),
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "get_component",
|
|
60
|
+
description: "Get detailed information about a specific component",
|
|
61
|
+
inputSchema: zodToJsonSchema(
|
|
62
|
+
z.object({
|
|
63
|
+
name: z
|
|
64
|
+
.string()
|
|
65
|
+
.describe("The name of the component to get from the registry"),
|
|
66
|
+
})
|
|
67
|
+
),
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "add_component",
|
|
71
|
+
description: "Get instructions for adding a component to a project",
|
|
72
|
+
inputSchema: zodToJsonSchema(
|
|
73
|
+
z.object({
|
|
74
|
+
name: z
|
|
75
|
+
.string()
|
|
76
|
+
.describe("The name of the component to add"),
|
|
77
|
+
style: z
|
|
78
|
+
.string()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("The style to use (default, new-york, etc.)"),
|
|
81
|
+
})
|
|
82
|
+
),
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "list_styles",
|
|
86
|
+
description: "List all available styles in the registry",
|
|
87
|
+
inputSchema: zodToJsonSchema(z.object({})),
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "search_registry",
|
|
91
|
+
description: "Search the registry for components matching criteria",
|
|
92
|
+
inputSchema: zodToJsonSchema(
|
|
93
|
+
z.object({
|
|
94
|
+
query: z
|
|
95
|
+
.string()
|
|
96
|
+
.describe("Search term to look for in component names and descriptions"),
|
|
97
|
+
})
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
}
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
// Handle tool calls
|
|
105
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
106
|
+
try {
|
|
107
|
+
// Ensure we have arguments
|
|
108
|
+
const args = request.params.arguments || {}
|
|
109
|
+
|
|
110
|
+
// Get registry URL from environment variable or use default
|
|
111
|
+
const REGISTRY_URL = process.env.REGISTRY_URL || "https://ui.hanzo.ai/registry/registry.json"
|
|
112
|
+
const registry = await getRegistry(REGISTRY_URL)
|
|
113
|
+
|
|
114
|
+
switch (request.params.name) {
|
|
115
|
+
case "init": {
|
|
116
|
+
const style = args.style || "default"
|
|
117
|
+
|
|
118
|
+
let text = `# Initialize a new project with @hanzo/ui
|
|
119
|
+
|
|
120
|
+
To create a new project with @hanzo/ui components, follow these steps:
|
|
121
|
+
|
|
122
|
+
1. Create a new project first:
|
|
123
|
+
\`\`\`bash
|
|
124
|
+
# Using npm
|
|
125
|
+
npm create next-app@latest my-app
|
|
126
|
+
|
|
127
|
+
# Or using yarn
|
|
128
|
+
yarn create next-app my-app
|
|
129
|
+
|
|
130
|
+
# Or using pnpm
|
|
131
|
+
pnpm create next-app my-app
|
|
132
|
+
\`\`\`
|
|
133
|
+
|
|
134
|
+
2. Navigate to your project directory:
|
|
135
|
+
\`\`\`bash
|
|
136
|
+
cd my-app
|
|
137
|
+
\`\`\`
|
|
138
|
+
|
|
139
|
+
3. Install @hanzo/ui and initialize it:
|
|
140
|
+
\`\`\`bash
|
|
141
|
+
npx @hanzo/ui@latest init${style ? ` --style=${style}` : ""}
|
|
142
|
+
\`\`\`
|
|
143
|
+
|
|
144
|
+
This will:
|
|
145
|
+
- Install all necessary dependencies
|
|
146
|
+
- Set up the project structure for @hanzo/ui
|
|
147
|
+
- Configure tailwind.css with the appropriate theme
|
|
148
|
+
- Add component configuration
|
|
149
|
+
`
|
|
150
|
+
|
|
151
|
+
// Check if the registry has any additional setup instructions
|
|
152
|
+
const setupConfig = registry.items.find(
|
|
153
|
+
(item) => item.type === "registry:config" && item.name === "setup"
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
if (setupConfig) {
|
|
157
|
+
text += `
|
|
158
|
+
## Additional Setup
|
|
159
|
+
|
|
160
|
+
${setupConfig.description || "Follow any additional setup instructions provided during initialization."}
|
|
161
|
+
`
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
content: [
|
|
166
|
+
{ type: "text", text }
|
|
167
|
+
],
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
case "list_components": {
|
|
172
|
+
// Filter components based on type and category if provided
|
|
173
|
+
const typeFilter = args.type ? `ui:${args.type}` : null
|
|
174
|
+
const categoryFilter = args.category || null
|
|
175
|
+
|
|
176
|
+
let components = registry.items.filter(item => {
|
|
177
|
+
// Filter by type if specified
|
|
178
|
+
if (typeFilter && !item.type.includes(typeFilter)) {
|
|
179
|
+
return false
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Filter by category if specified
|
|
183
|
+
if (categoryFilter && item.category !== categoryFilter) {
|
|
184
|
+
return false
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return true
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
// Group components by category if they have categories
|
|
191
|
+
const hasCategories = components.some(item => item.category)
|
|
192
|
+
let responseText = "# Available Components\n\n"
|
|
193
|
+
|
|
194
|
+
if (hasCategories) {
|
|
195
|
+
// Group by category
|
|
196
|
+
const categorized = components.reduce((acc, item) => {
|
|
197
|
+
const category = item.category || "Uncategorized"
|
|
198
|
+
if (!acc[category]) {
|
|
199
|
+
acc[category] = []
|
|
200
|
+
}
|
|
201
|
+
acc[category].push(item)
|
|
202
|
+
return acc
|
|
203
|
+
}, {} as Record<string, RegistryItem[]>)
|
|
204
|
+
|
|
205
|
+
// Build response
|
|
206
|
+
for (const [category, items] of Object.entries(categorized)) {
|
|
207
|
+
responseText += `## ${category}\n\n`
|
|
208
|
+
|
|
209
|
+
items.forEach(item => {
|
|
210
|
+
responseText += `- **${item.name}** - ${item.description || 'No description available'}\n`
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
responseText += "\n"
|
|
214
|
+
}
|
|
215
|
+
} else {
|
|
216
|
+
// Simple list
|
|
217
|
+
components.forEach(item => {
|
|
218
|
+
responseText += `- **${item.name}** (${item.type}) - ${item.description || 'No description available'}\n`
|
|
219
|
+
})
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
responseText += "\nTo get detailed information about a specific component, use the `get_component` tool.\n"
|
|
223
|
+
responseText += "To add a component to your project, use the `add_component` tool.\n"
|
|
224
|
+
|
|
225
|
+
return {
|
|
226
|
+
content: [{ type: "text", text: responseText }],
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
case "get_component": {
|
|
231
|
+
const name = z.string().parse(args.name)
|
|
232
|
+
|
|
233
|
+
if (!name) {
|
|
234
|
+
throw new Error("Component name is required")
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const itemUrl = getRegistryItemUrl(name, REGISTRY_URL)
|
|
238
|
+
const component = await getRegistryItem(itemUrl, "")
|
|
239
|
+
|
|
240
|
+
if (!component) {
|
|
241
|
+
return {
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
type: "text",
|
|
245
|
+
text: `Component '${name}' not found in the registry.`,
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Build a markdown description of the component
|
|
252
|
+
let componentDetails = `# ${component.name}\n\n`
|
|
253
|
+
|
|
254
|
+
if (component.description) {
|
|
255
|
+
componentDetails += `${component.description}\n\n`
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
componentDetails += `**Type:** ${component.type}\n`
|
|
259
|
+
|
|
260
|
+
if (component.category) {
|
|
261
|
+
componentDetails += `**Category:** ${component.category}\n`
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// Dependencies
|
|
265
|
+
if (component.dependencies && component.dependencies.length > 0) {
|
|
266
|
+
componentDetails += `\n## Dependencies\n\n`
|
|
267
|
+
component.dependencies.forEach(dep => {
|
|
268
|
+
componentDetails += `- ${dep}\n`
|
|
269
|
+
})
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
// Registry Dependencies
|
|
273
|
+
if (component.registryDependencies && component.registryDependencies.length > 0) {
|
|
274
|
+
componentDetails += `\n## Required Components\n\n`
|
|
275
|
+
componentDetails += `This component requires the following components that will be installed automatically:\n\n`
|
|
276
|
+
component.registryDependencies.forEach(dep => {
|
|
277
|
+
componentDetails += `- ${dep}\n`
|
|
278
|
+
})
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// Files
|
|
282
|
+
if (component.files && component.files.length > 0) {
|
|
283
|
+
componentDetails += `\n## Files\n\n`
|
|
284
|
+
component.files.forEach(file => {
|
|
285
|
+
componentDetails += `- ${file.path} (${file.type})\n`
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// Show example usage if available
|
|
290
|
+
const exampleFile = component.files?.find(file => file.type === "registry:example")
|
|
291
|
+
if (exampleFile && exampleFile.content) {
|
|
292
|
+
componentDetails += `\n## Example Usage\n\n\`\`\`tsx\n${exampleFile.content}\n\`\`\`\n`
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Add installation instructions
|
|
296
|
+
componentDetails += `\n## Installation\n\n`
|
|
297
|
+
componentDetails += `Run the following command to add this component to your project:\n\n`
|
|
298
|
+
componentDetails += `\`\`\`bash\n`
|
|
299
|
+
componentDetails += `npx @hanzo/ui@latest add ${name}\n`
|
|
300
|
+
componentDetails += `\`\`\`\n`
|
|
301
|
+
|
|
302
|
+
return {
|
|
303
|
+
content: [{ type: "text", text: componentDetails }],
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
case "add_component": {
|
|
308
|
+
const name = z.string().parse(args.name)
|
|
309
|
+
const style = args.style || "default"
|
|
310
|
+
|
|
311
|
+
if (!name) {
|
|
312
|
+
throw new Error("Component name is required")
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
const itemUrl = getRegistryItemUrl(name, REGISTRY_URL)
|
|
316
|
+
const component = await getRegistryItem(itemUrl, "")
|
|
317
|
+
|
|
318
|
+
if (!component) {
|
|
319
|
+
return {
|
|
320
|
+
content: [
|
|
321
|
+
{
|
|
322
|
+
type: "text",
|
|
323
|
+
text: `Component '${name}' not found in the registry.`,
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
// Check if the component has dependencies
|
|
330
|
+
const hasDeps = component.registryDependencies && component.registryDependencies.length > 0
|
|
331
|
+
|
|
332
|
+
let instructions = `# Adding the ${name} Component\n\n`
|
|
333
|
+
|
|
334
|
+
// Main installation command
|
|
335
|
+
instructions += `Run the following command to add the \`${name}\` component to your project:\n\n`
|
|
336
|
+
instructions += `\`\`\`bash\n`
|
|
337
|
+
instructions += `npx @hanzo/ui@latest add ${name} --style=${style}\n`
|
|
338
|
+
instructions += `\`\`\`\n\n`
|
|
339
|
+
|
|
340
|
+
// Explain what this will do
|
|
341
|
+
instructions += `This will:\n`
|
|
342
|
+
instructions += `- Add the component file(s) to your project\n`
|
|
343
|
+
instructions += `- Install any required npm dependencies\n`
|
|
344
|
+
|
|
345
|
+
if (hasDeps) {
|
|
346
|
+
instructions += `- Install required component dependencies: ${component.registryDependencies!.join(", ")}\n`
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// Usage example
|
|
350
|
+
instructions += `\n## Usage\n\nAfter adding the component, you can import it in your project:\n\n`
|
|
351
|
+
instructions += `\`\`\`tsx\n`
|
|
352
|
+
instructions += `import { ${name.charAt(0).toUpperCase() + name.slice(1)} } from "@/components/ui/${name}"\n\n`
|
|
353
|
+
|
|
354
|
+
// Add a simple example if possible
|
|
355
|
+
if (component.type.includes("ui:")) {
|
|
356
|
+
instructions += `export default function Example() {\n`
|
|
357
|
+
instructions += ` return <${name.charAt(0).toUpperCase() + name.slice(1)} />\n`
|
|
358
|
+
instructions += `}\n`
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
instructions += `\`\`\`\n`
|
|
362
|
+
|
|
363
|
+
return {
|
|
364
|
+
content: [
|
|
365
|
+
{
|
|
366
|
+
type: "text",
|
|
367
|
+
text: instructions,
|
|
368
|
+
},
|
|
369
|
+
],
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
case "list_styles": {
|
|
374
|
+
// Find all style-related items in the registry
|
|
375
|
+
const styles = registry.items.filter(item =>
|
|
376
|
+
item.type === "registry:style" || item.type.includes("style")
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
let styleInfo = "# Available Styles\n\n"
|
|
380
|
+
|
|
381
|
+
if (styles.length === 0) {
|
|
382
|
+
styleInfo += "The registry does not define any specific styles.\n\n"
|
|
383
|
+
styleInfo += "The default style will be used when installing components.\n"
|
|
384
|
+
} else {
|
|
385
|
+
styles.forEach(style => {
|
|
386
|
+
styleInfo += `## ${style.name}\n\n`
|
|
387
|
+
styleInfo += `${style.description || 'No description available'}\n\n`
|
|
388
|
+
|
|
389
|
+
// Add usage info
|
|
390
|
+
styleInfo += `**Usage:**\n\n`
|
|
391
|
+
styleInfo += `\`\`\`bash\n`
|
|
392
|
+
styleInfo += `# Initialize with this style\n`
|
|
393
|
+
styleInfo += `npx @hanzo/ui@latest init --style=${style.name}\n\n`
|
|
394
|
+
styleInfo += `# Install components with this style\n`
|
|
395
|
+
styleInfo += `npx @hanzo/ui@latest add [component] --style=${style.name}\n`
|
|
396
|
+
styleInfo += `\`\`\`\n\n`
|
|
397
|
+
})
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return {
|
|
401
|
+
content: [{ type: "text", text: styleInfo }],
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
case "search_registry": {
|
|
406
|
+
const query = z.string().parse(args.query).toLowerCase()
|
|
407
|
+
|
|
408
|
+
if (!query || query.length < 2) {
|
|
409
|
+
return {
|
|
410
|
+
content: [
|
|
411
|
+
{
|
|
412
|
+
type: "text",
|
|
413
|
+
text: "Please provide a search term with at least 2 characters.",
|
|
414
|
+
},
|
|
415
|
+
],
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Search through all items in the registry
|
|
420
|
+
const results = registry.items.filter(item => {
|
|
421
|
+
// Search in name
|
|
422
|
+
if (item.name.toLowerCase().includes(query)) {
|
|
423
|
+
return true
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
// Search in description
|
|
427
|
+
if (item.description?.toLowerCase().includes(query)) {
|
|
428
|
+
return true
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Search in category
|
|
432
|
+
if (item.category?.toLowerCase().includes(query)) {
|
|
433
|
+
return true
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
return false
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
if (results.length === 0) {
|
|
440
|
+
return {
|
|
441
|
+
content: [
|
|
442
|
+
{
|
|
443
|
+
type: "text",
|
|
444
|
+
text: `No components found matching '${query}'. Try a different search term.`,
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// Format the results
|
|
451
|
+
let searchResults = `# Search Results for '${query}'\n\n`
|
|
452
|
+
searchResults += `Found ${results.length} matching components\n\n`
|
|
453
|
+
|
|
454
|
+
results.forEach(item => {
|
|
455
|
+
searchResults += `## ${item.name}\n\n`
|
|
456
|
+
searchResults += `**Type:** ${item.type}\n`
|
|
457
|
+
|
|
458
|
+
if (item.category) {
|
|
459
|
+
searchResults += `**Category:** ${item.category}\n`
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (item.description) {
|
|
463
|
+
searchResults += `\n${item.description}\n`
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
searchResults += `\n**Installation:**\n\n`
|
|
467
|
+
searchResults += `\`\`\`bash\nnpx @hanzo/ui@latest add ${item.name}\n\`\`\`\n\n`
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
return {
|
|
471
|
+
content: [{ type: "text", text: searchResults }],
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
default:
|
|
476
|
+
throw new Error(`Tool ${request.params.name} not found`)
|
|
477
|
+
}
|
|
478
|
+
} catch (error) {
|
|
479
|
+
if (error instanceof z.ZodError) {
|
|
480
|
+
return {
|
|
481
|
+
content: [
|
|
482
|
+
{
|
|
483
|
+
type: "text",
|
|
484
|
+
text: `Invalid input: ${JSON.stringify(error.errors)}`,
|
|
485
|
+
},
|
|
486
|
+
],
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
throw error
|
|
491
|
+
}
|
|
492
|
+
})
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Fetches and parses the registry from the given URL
|
|
496
|
+
* @param registryUrl - URL to the registry.json file
|
|
497
|
+
* @returns The parsed registry object
|
|
498
|
+
*/
|
|
499
|
+
async function getRegistry(registryUrl: string): Promise<Registry> {
|
|
500
|
+
try {
|
|
501
|
+
const [registryJson] = await fetchRegistry([registryUrl], {
|
|
502
|
+
useCache: false,
|
|
503
|
+
})
|
|
504
|
+
return registrySchema.parse(registryJson)
|
|
505
|
+
} catch (error) {
|
|
506
|
+
console.error(`Failed to fetch registry from ${registryUrl}:`, error)
|
|
507
|
+
// Return a minimal valid registry if we can't fetch the real one
|
|
508
|
+
return {
|
|
509
|
+
name: "hanzo-ui",
|
|
510
|
+
items: [],
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
// Support CommonJS
|
|
516
|
+
if (typeof module !== 'undefined') {
|
|
517
|
+
module.exports = { server }
|
|
518
|
+
}
|
package/mcp/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "4.5.
|
|
3
|
+
"version": "4.5.2",
|
|
4
4
|
"description": "Library that contains shared UI primitives, support for a common design system, and other boilerplate support.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
@@ -31,20 +31,37 @@
|
|
|
31
31
|
"scripts": {
|
|
32
32
|
"lat": "npm show @hanzo/ui version",
|
|
33
33
|
"pub": "npm publish",
|
|
34
|
-
"tc": "tsc"
|
|
34
|
+
"tc": "tsc",
|
|
35
|
+
"build": "tsc -p tsconfig.json",
|
|
36
|
+
"update-registry": "node ./bin/update-registry.js",
|
|
37
|
+
"registry:mcp": "node ./bin/cli.js registry:mcp",
|
|
38
|
+
"registry:mcp:http": "node ./bin/cli.js registry:mcp --http"
|
|
39
|
+
},
|
|
40
|
+
"bin": {
|
|
41
|
+
"@hanzo/ui": "./bin/cli.js",
|
|
42
|
+
"hanzo-ui": "./bin/cli.js"
|
|
35
43
|
},
|
|
36
44
|
"exports": {
|
|
37
45
|
"./blocks": "./blocks/index.ts",
|
|
38
46
|
"./primitives": "./primitives/index-next.ts",
|
|
39
47
|
"./primitives-common": "./primitives/index-common.ts",
|
|
48
|
+
"./registry": {
|
|
49
|
+
"types": "./dist/registry/index.d.ts",
|
|
50
|
+
"default": "./dist/registry/index.js"
|
|
51
|
+
},
|
|
40
52
|
"./style/": "./style/*",
|
|
41
53
|
"./tailwind": "./tailwind/index.ts",
|
|
42
54
|
"./types": "./types/index.ts",
|
|
43
55
|
"./util": "./util/index.ts",
|
|
44
|
-
"./util-client": "./util/index-client.ts"
|
|
56
|
+
"./util-client": "./util/index-client.ts",
|
|
57
|
+
"./mcp": {
|
|
58
|
+
"types": "./dist/mcp/index.d.ts",
|
|
59
|
+
"default": "./dist/mcp/index.js"
|
|
60
|
+
}
|
|
45
61
|
},
|
|
46
62
|
"dependencies": {
|
|
47
63
|
"@hanzo/react-drawer": "^0.1.8",
|
|
64
|
+
"@modelcontextprotocol/sdk": "^1.10.2",
|
|
48
65
|
"@next/third-parties": "^15.0.1",
|
|
49
66
|
"@radix-ui/react-accordion": "^1.1.2",
|
|
50
67
|
"@radix-ui/react-aspect-ratio": "^1.0.3",
|
|
@@ -75,6 +92,7 @@
|
|
|
75
92
|
"class-variance-authority": "^0.7.0",
|
|
76
93
|
"clsx": "^2.1.0",
|
|
77
94
|
"cmdk": "^0.2.0",
|
|
95
|
+
"commander": "^12.1.0",
|
|
78
96
|
"embla-carousel-react": "8.5.1",
|
|
79
97
|
"input-otp": "^1.0.1",
|
|
80
98
|
"lodash.castarray": "^4.4.0",
|
|
@@ -92,15 +110,16 @@
|
|
|
92
110
|
"peerDependencies": {
|
|
93
111
|
"@hookform/resolvers": "^3.3.2",
|
|
94
112
|
"embla-carousel": "^8.1.6",
|
|
95
|
-
"lucide-react": "
|
|
113
|
+
"lucide-react": "0.456.0",
|
|
96
114
|
"mobx": "^6.12.3",
|
|
97
|
-
"next": "
|
|
115
|
+
"next": "14.2.16",
|
|
98
116
|
"next-themes": "^0.2.1",
|
|
99
|
-
"react": "
|
|
100
|
-
"react-dom": "
|
|
101
|
-
"react-hook-form": "
|
|
117
|
+
"react": "18.3.1",
|
|
118
|
+
"react-dom": "18.3.1",
|
|
119
|
+
"react-hook-form": "7.51.4",
|
|
102
120
|
"validator": "^13.11.0",
|
|
103
|
-
"zod": "3.23.8"
|
|
121
|
+
"zod": "3.23.8",
|
|
122
|
+
"zod-to-json-schema": "^3.24.5"
|
|
104
123
|
},
|
|
105
124
|
"devDependencies": {
|
|
106
125
|
"@mdx-js/loader": "^3.0.0",
|
|
@@ -110,10 +129,11 @@
|
|
|
110
129
|
"@types/gtag.js": "^0.0.19",
|
|
111
130
|
"@types/lodash.merge": "^4.6.9",
|
|
112
131
|
"@types/mdx": "^2.0.13",
|
|
113
|
-
"@types/node": "
|
|
114
|
-
"@types/react": "
|
|
115
|
-
"@types/react-dom": "
|
|
116
|
-
"
|
|
117
|
-
"
|
|
132
|
+
"@types/node": "20.14.15",
|
|
133
|
+
"@types/react": "18.3.1",
|
|
134
|
+
"@types/react-dom": "18.3.1",
|
|
135
|
+
"glob": "^11.0.2",
|
|
136
|
+
"tailwindcss": "3.4.14",
|
|
137
|
+
"typescript": "5.6.3"
|
|
118
138
|
}
|
|
119
139
|
}
|
package/primitives/accordion.tsx
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import * as React from "react"
|
|
5
5
|
import * as AccordionPrimitive from "@radix-ui/react-accordion"
|
|
6
|
-
import {
|
|
6
|
+
import { ChevronDown } from "lucide-react"
|
|
7
7
|
|
|
8
8
|
import { cn } from "../util"
|
|
9
9
|
|
|
@@ -29,18 +29,18 @@ type AccordionTriggerProps = React.ComponentPropsWithoutRef<typeof AccordionPrim
|
|
|
29
29
|
const AccordionTrigger = React.forwardRef<
|
|
30
30
|
React.ElementRef<typeof AccordionPrimitive.Trigger>,
|
|
31
31
|
AccordionTriggerProps
|
|
32
|
-
>(({ showChevron, headerClx, className, children, ...props }, ref) => (
|
|
32
|
+
>(({ showChevron = true, headerClx, className, children, ...props }, ref) => (
|
|
33
33
|
<AccordionPrimitive.Header className={cn('flex', headerClx)}>
|
|
34
34
|
<AccordionPrimitive.Trigger
|
|
35
35
|
ref={ref}
|
|
36
36
|
className={cn(
|
|
37
|
-
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]
|
|
37
|
+
"flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",
|
|
38
38
|
className
|
|
39
39
|
)}
|
|
40
40
|
{...props}
|
|
41
41
|
>
|
|
42
42
|
{children}
|
|
43
|
-
{showChevron && <
|
|
43
|
+
{showChevron && <ChevronDown className="h-4 w-4 shrink-0 transition-transform duration-200" />}
|
|
44
44
|
</AccordionPrimitive.Trigger>
|
|
45
45
|
</AccordionPrimitive.Header>
|
|
46
46
|
))
|
|
@@ -58,7 +58,7 @@ const AccordionContent = React.forwardRef<
|
|
|
58
58
|
)}
|
|
59
59
|
{...props}
|
|
60
60
|
>
|
|
61
|
-
{children}
|
|
61
|
+
<div className="pb-4 pt-0">{children}</div>
|
|
62
62
|
</AccordionPrimitive.Content>
|
|
63
63
|
))
|
|
64
64
|
AccordionContent.displayName = AccordionPrimitive.Content.displayName
|
package/primitives/button.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import { cva, type VariantProps } from "class-variance-authority"
|
|
|
4
4
|
|
|
5
5
|
import { cn } from "../util"
|
|
6
6
|
|
|
7
|
+
// Define all variants
|
|
7
8
|
const variant = {
|
|
8
9
|
primary: "bg-primary text-primary-fg sm:hover:bg-primary-hover font-nav whitespace-nowrap not-typography",
|
|
9
10
|
secondary: "bg-secondary text-secondary-fg sm:hover:bg-secondary-hover font-nav whitespace-nowrap not-typography",
|
|
@@ -15,6 +16,7 @@ const variant = {
|
|
|
15
16
|
linkMuted: "text-muted-1 sm:hover:text-foreground font-sans ",
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
// Define all sizes
|
|
18
20
|
const size = {
|
|
19
21
|
link: '',
|
|
20
22
|
xs: "h-8 px-2 text-xs",
|
|
@@ -25,6 +27,7 @@ const size = {
|
|
|
25
27
|
icon: "h-10 w-10",
|
|
26
28
|
}
|
|
27
29
|
|
|
30
|
+
// Define rounded options
|
|
28
31
|
const rounded = {
|
|
29
32
|
full: 'rounded-full',
|
|
30
33
|
sm: 'rounded-sm',
|
|
@@ -34,11 +37,11 @@ const rounded = {
|
|
|
34
37
|
none: ''
|
|
35
38
|
}
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
// Updated buttonVariants with the latest Shadcn patterns
|
|
38
41
|
const buttonVariants = cva(
|
|
39
|
-
"flex items-center justify-center font-medium transition-colors " +
|
|
42
|
+
"inline-flex items-center justify-center font-medium ring-offset-background transition-colors " +
|
|
40
43
|
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 " +
|
|
41
|
-
"disabled:opacity-50 disabled:pointer-events-none
|
|
44
|
+
"disabled:opacity-50 disabled:pointer-events-none",
|
|
42
45
|
{
|
|
43
46
|
variants: {
|
|
44
47
|
variant,
|