@hanzo/ui 4.5.3 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README-MCP.md +3 -3
- package/README.md +229 -0
- package/assets/ai-icons.tsx +207 -0
- package/assets/crypto.tsx +33 -0
- package/assets/file-type-icon.tsx +66 -0
- package/assets/file.tsx +45 -0
- package/assets/general.tsx +2318 -0
- package/assets/hanzo-logo.svg +9 -0
- package/assets/hanzo-logo.tsx +15 -0
- package/assets/index.ts +8 -0
- package/assets/index.tsx +4 -0
- package/assets/llm-provider.tsx +1094 -0
- package/bin/create-registry.js +1 -1
- package/bin/test-mcp.sh +1 -1
- package/bin/update-registry.js +2 -2
- package/blocks/components/content.tsx +1 -1
- package/blocks/components/grid-block/index.tsx +1 -1
- package/blocks/components/screenful-block/content.tsx +1 -1
- package/blocks/components/screenful-block/poster-background.tsx +1 -1
- package/components/index.ts +56 -0
- package/dist/button.d.ts +1 -0
- package/dist/button.js +1 -0
- package/dist/hooks/index.d.ts +7 -0
- package/dist/hooks/index.js +7 -0
- package/dist/hooks/use-click-away.d.ts +2 -0
- package/dist/hooks/use-click-away.js +23 -0
- package/dist/hooks/use-combined-refs.d.ts +3 -0
- package/dist/hooks/use-combined-refs.js +18 -0
- package/dist/hooks/use-copy-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-clipboard.js +21 -0
- package/dist/hooks/use-debounce.d.ts +1 -0
- package/dist/hooks/use-debounce.js +13 -0
- package/dist/hooks/use-fill-ids.d.ts +8 -0
- package/dist/hooks/use-fill-ids.js +20 -0
- package/dist/hooks/use-map.d.ts +1 -0
- package/dist/hooks/use-map.js +20 -0
- package/dist/hooks/use-measure.d.ts +8 -0
- package/dist/hooks/use-measure.js +25 -0
- package/dist/hooks/use-reverse-video-playback.d.ts +1 -0
- package/dist/hooks/use-reverse-video-playback.js +41 -0
- package/dist/hooks/use-scroll-restoration.d.ts +8 -0
- package/dist/hooks/use-scroll-restoration.js +36 -0
- package/dist/mcp/enhanced-server.js +3 -3
- package/dist/mcp/index.js +1 -1
- package/dist/registry/api.d.ts +1 -1
- package/dist/registry/api.js +3 -4
- package/dist/registry/index.d.ts +348 -4
- package/dist/registry/index.js +3 -3
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/helpers/file.ts +33 -0
- package/helpers/memoization.ts +40 -0
- package/package.json +27 -6
- package/primitives/accordion.tsx +53 -45
- package/primitives/alert-dialog.tsx +185 -0
- package/primitives/alert.tsx +74 -0
- package/primitives/apply-typography.tsx +1 -1
- package/primitives/avatar.tsx +37 -29
- package/primitives/background-beams.tsx +142 -0
- package/primitives/badge.tsx +27 -19
- package/primitives/breadcrumb.tsx +77 -62
- package/primitives/button.tsx +69 -72
- package/primitives/card.tsx +73 -59
- package/primitives/chat/chat-input-area.tsx +87 -0
- package/primitives/chat/chat-input.tsx +71 -0
- package/primitives/chat/files-preview.tsx +330 -0
- package/primitives/chat/index.ts +6 -0
- package/primitives/chat/json-form.tsx +8 -0
- package/primitives/chat/message-list.tsx +307 -0
- package/primitives/chat/message.tsx +569 -0
- package/primitives/chat/sqlite-preview.tsx +215 -0
- package/primitives/checkbox.tsx +18 -19
- package/primitives/collapsible.tsx +9 -0
- package/primitives/command.tsx +75 -83
- package/primitives/context-menu.tsx +115 -109
- package/primitives/copy-to-clipboard-icon.tsx +60 -0
- package/primitives/dialog-video-controller.tsx +1 -1
- package/primitives/dialog.tsx +111 -145
- package/primitives/dot-pattern.tsx +57 -0
- package/primitives/dots-loader.tsx +13 -0
- package/primitives/drawer.tsx +59 -87
- package/primitives/dropdown-menu.tsx +199 -0
- package/primitives/error-message.tsx +19 -0
- package/primitives/file-uploader.tsx +200 -0
- package/primitives/form.tsx +92 -87
- package/primitives/hover-card.tsx +28 -0
- package/primitives/icons/github.tsx +1 -1
- package/primitives/icons/youtube-logo.tsx +1 -1
- package/primitives/index-common.ts +121 -42
- package/primitives/index-next.ts +3 -1
- package/primitives/input.tsx +115 -20
- package/primitives/label.tsx +15 -23
- package/primitives/loading-spinner.tsx +1 -1
- package/primitives/markdown-preview.tsx +609 -0
- package/primitives/mermaid.tsx +196 -0
- package/primitives/next/link-element.tsx +1 -1
- package/primitives/next/mdx-link.tsx +1 -1
- package/primitives/pagination.tsx +117 -0
- package/primitives/popover.tsx +20 -25
- package/primitives/pretty-json-print.tsx +28 -0
- package/primitives/progress.tsx +14 -15
- package/primitives/prompt-textarea.tsx +72 -0
- package/primitives/qr-code.tsx +112 -0
- package/primitives/radio-group.tsx +25 -39
- package/primitives/resizable.tsx +47 -0
- package/primitives/scroll-area.tsx +35 -25
- package/primitives/search-input.tsx +66 -0
- package/primitives/select.tsx +62 -109
- package/primitives/separator.tsx +22 -26
- package/primitives/sheet.tsx +78 -117
- package/primitives/skeleton.tsx +13 -16
- package/primitives/slider.tsx +50 -60
- package/primitives/stepper.tsx +272 -0
- package/primitives/switch.tsx +14 -23
- package/primitives/table.tsx +65 -77
- package/primitives/tabs.tsx +29 -39
- package/primitives/text-link.tsx +25 -0
- package/primitives/textarea.tsx +61 -0
- package/primitives/textfield.tsx +75 -0
- package/primitives/toast.tsx +30 -0
- package/primitives/toggle-group.tsx +33 -33
- package/primitives/toggle.tsx +22 -51
- package/primitives/tooltip.tsx +37 -38
- package/registry.json +1 -1
- package/src/button.ts +1 -0
- package/src/hooks/index.ts +7 -0
- package/src/hooks/use-click-away.ts +31 -0
- package/src/hooks/use-combined-refs.ts +22 -0
- package/src/hooks/use-copy-clipboard.ts +30 -0
- package/src/hooks/use-debounce.ts +17 -0
- package/src/hooks/use-fill-ids.ts +25 -0
- package/src/hooks/use-map.ts +26 -0
- package/src/hooks/use-measure.ts +42 -0
- package/src/hooks/use-reverse-video-playback.ts +43 -0
- package/src/hooks/use-scroll-restoration.ts +50 -0
- package/{mcp → src/mcp}/README.md +1 -1
- package/{mcp → src/mcp}/enhanced-server.ts +2 -2
- package/{registry → src/registry}/api.ts +3 -3
- package/{registry → src/registry}/index.ts +3 -3
- package/src/utils.ts +1 -0
- package/style/theme-provider.tsx +1 -1
- package/test-imports.mjs +19 -0
- package/tsconfig.json +9 -4
- package/types/animation-def.ts +1 -1
- package/types/button-def.ts +1 -1
- package/types/index.ts +1 -1
- package/util/blob.ts +28 -0
- package/util/copy-to-clipboard.ts +17 -0
- package/util/create-shadow-root.ts +22 -0
- package/util/date.ts +83 -0
- package/util/debounce.ts +11 -0
- package/util/file.ts +15 -0
- package/util/format-and-abbreviate-as-currency.ts +1 -1
- package/util/format-text.ts +33 -0
- package/util/index.ts +9 -78
- package/util/timing.ts +3 -0
- package/util/toasts.tsx +17 -0
- package/utils.ts +9 -0
- package/dist/blocks/components/accordian-block.d.ts +0 -4
- package/dist/blocks/components/accordian-block.jsx +0 -25
- package/dist/blocks/components/block-component-props.d.ts +0 -7
- package/dist/blocks/components/block-component-props.js +0 -1
- package/dist/blocks/components/bullet-cards-block.d.ts +0 -4
- package/dist/blocks/components/bullet-cards-block.jsx +0 -25
- package/dist/blocks/components/card-block/index.d.ts +0 -6
- package/dist/blocks/components/card-block/index.jsx +0 -87
- package/dist/blocks/components/card-block/link-out-button.d.ts +0 -6
- package/dist/blocks/components/card-block/link-out-button.jsx +0 -4
- package/dist/blocks/components/card-block/util.d.ts +0 -4
- package/dist/blocks/components/card-block/util.js +0 -6
- package/dist/blocks/components/carte-blanche-block/index.d.ts +0 -4
- package/dist/blocks/components/carte-blanche-block/index.jsx +0 -82
- package/dist/blocks/components/carte-blanche-block/variant-content-left.d.ts +0 -10
- package/dist/blocks/components/carte-blanche-block/variant-content-left.jsx +0 -23
- package/dist/blocks/components/content.d.ts +0 -10
- package/dist/blocks/components/content.jsx +0 -47
- package/dist/blocks/components/cta-block.d.ts +0 -12
- package/dist/blocks/components/cta-block.jsx +0 -69
- package/dist/blocks/components/enh-heading-block.d.ts +0 -7
- package/dist/blocks/components/enh-heading-block.jsx +0 -142
- package/dist/blocks/components/grid-block/grid-block-mutator.d.ts +0 -5
- package/dist/blocks/components/grid-block/grid-block-mutator.js +0 -1
- package/dist/blocks/components/grid-block/index.d.ts +0 -9
- package/dist/blocks/components/grid-block/index.jsx +0 -56
- package/dist/blocks/components/grid-block/mutator-registry.d.ts +0 -3
- package/dist/blocks/components/grid-block/mutator-registry.js +0 -5
- package/dist/blocks/components/grid-block/table-borders.mutator.d.ts +0 -3
- package/dist/blocks/components/grid-block/table-borders.mutator.js +0 -36
- package/dist/blocks/components/group-block.d.ts +0 -7
- package/dist/blocks/components/group-block.jsx +0 -61
- package/dist/blocks/components/heading-block.d.ts +0 -4
- package/dist/blocks/components/heading-block.jsx +0 -99
- package/dist/blocks/components/image-block.d.ts +0 -7
- package/dist/blocks/components/image-block.jsx +0 -69
- package/dist/blocks/components/index.d.ts +0 -14
- package/dist/blocks/components/index.js +0 -13
- package/dist/blocks/components/screenful-block/content.d.ts +0 -8
- package/dist/blocks/components/screenful-block/content.jsx +0 -71
- package/dist/blocks/components/screenful-block/index.d.ts +0 -12
- package/dist/blocks/components/screenful-block/index.jsx +0 -57
- package/dist/blocks/components/screenful-block/poster-background.d.ts +0 -7
- package/dist/blocks/components/screenful-block/poster-background.jsx +0 -14
- package/dist/blocks/components/screenful-block/video-background.d.ts +0 -8
- package/dist/blocks/components/screenful-block/video-background.jsx +0 -20
- package/dist/blocks/components/space-block.d.ts +0 -4
- package/dist/blocks/components/space-block.jsx +0 -42
- package/dist/blocks/components/video-block.d.ts +0 -9
- package/dist/blocks/components/video-block.jsx +0 -83
- package/dist/blocks/def/accordian-block.d.ts +0 -10
- package/dist/blocks/def/accordian-block.js +0 -2
- package/dist/blocks/def/block.d.ts +0 -4
- package/dist/blocks/def/block.js +0 -1
- package/dist/blocks/def/bullet-cards-block.d.ts +0 -17
- package/dist/blocks/def/bullet-cards-block.js +0 -1
- package/dist/blocks/def/card-block.d.ts +0 -17
- package/dist/blocks/def/card-block.js +0 -2
- package/dist/blocks/def/carte-blanche-block.d.ts +0 -12
- package/dist/blocks/def/carte-blanche-block.js +0 -1
- package/dist/blocks/def/cta-block.d.ts +0 -8
- package/dist/blocks/def/cta-block.js +0 -1
- package/dist/blocks/def/element-block.d.ts +0 -7
- package/dist/blocks/def/element-block.js +0 -2
- package/dist/blocks/def/enh-heading-block.d.ts +0 -22
- package/dist/blocks/def/enh-heading-block.js +0 -1
- package/dist/blocks/def/grid-block.d.ts +0 -12
- package/dist/blocks/def/grid-block.js +0 -1
- package/dist/blocks/def/group-block.d.ts +0 -7
- package/dist/blocks/def/group-block.js +0 -1
- package/dist/blocks/def/heading-block.d.ts +0 -11
- package/dist/blocks/def/heading-block.js +0 -1
- package/dist/blocks/def/image-block.d.ts +0 -26
- package/dist/blocks/def/image-block.js +0 -1
- package/dist/blocks/def/index.d.ts +0 -17
- package/dist/blocks/def/index.js +0 -2
- package/dist/blocks/def/screenful-block.d.ts +0 -41
- package/dist/blocks/def/screenful-block.js +0 -1
- package/dist/blocks/def/space-block.d.ts +0 -47
- package/dist/blocks/def/space-block.js +0 -8
- package/dist/blocks/def/video-block.d.ts +0 -5
- package/dist/blocks/def/video-block.js +0 -1
- package/dist/blocks/index.d.ts +0 -2
- package/dist/blocks/index.js +0 -2
- package/dist/primitives/accordion.d.ts +0 -10
- package/dist/primitives/accordion.jsx +0 -21
- package/dist/primitives/action-button.d.ts +0 -9
- package/dist/primitives/action-button.jsx +0 -16
- package/dist/primitives/apply-typography.d.ts +0 -7
- package/dist/primitives/apply-typography.jsx +0 -38
- package/dist/primitives/aspect-ratio.d.ts +0 -3
- package/dist/primitives/aspect-ratio.jsx +0 -4
- package/dist/primitives/avatar.d.ts +0 -6
- package/dist/primitives/avatar.jsx +0 -11
- package/dist/primitives/badge.d.ts +0 -9
- package/dist/primitives/badge.jsx +0 -18
- package/dist/primitives/breadcrumb.d.ts +0 -19
- package/dist/primitives/breadcrumb.jsx +0 -27
- package/dist/primitives/breakpoint-indicator.d.ts +0 -3
- package/dist/primitives/breakpoint-indicator.jsx +0 -14
- package/dist/primitives/button.d.ts +0 -12
- package/dist/primitives/button.jsx +0 -55
- package/dist/primitives/calendar.d.ts +0 -8
- package/dist/primitives/calendar.jsx +0 -40
- package/dist/primitives/card.d.ts +0 -8
- package/dist/primitives/card.jsx +0 -18
- package/dist/primitives/carousel.d.ts +0 -18
- package/dist/primitives/carousel.jsx +0 -106
- package/dist/primitives/checkbox.d.ts +0 -4
- package/dist/primitives/checkbox.jsx +0 -15
- package/dist/primitives/combobox.d.ts +0 -41
- package/dist/primitives/combobox.jsx +0 -77
- package/dist/primitives/command.d.ts +0 -17
- package/dist/primitives/command.jsx +0 -38
- package/dist/primitives/context-menu.d.ts +0 -27
- package/dist/primitives/context-menu.jsx +0 -57
- package/dist/primitives/dialog-video-controller.d.ts +0 -3
- package/dist/primitives/dialog-video-controller.jsx +0 -24
- package/dist/primitives/dialog.d.ts +0 -28
- package/dist/primitives/dialog.jsx +0 -37
- package/dist/primitives/drawer.d.ts +0 -29
- package/dist/primitives/drawer.jsx +0 -34
- package/dist/primitives/form.d.ts +0 -12
- package/dist/primitives/form.jsx +0 -69
- package/dist/primitives/icons/github.d.ts +0 -4
- package/dist/primitives/icons/github.jsx +0 -6
- package/dist/primitives/icons/index.d.ts +0 -4
- package/dist/primitives/icons/index.js +0 -4
- package/dist/primitives/icons/youtube-logo.d.ts +0 -4
- package/dist/primitives/icons/youtube-logo.jsx +0 -39
- package/dist/primitives/index-common.d.ts +0 -47
- package/dist/primitives/index-common.js +0 -46
- package/dist/primitives/index-next.d.ts +0 -2
- package/dist/primitives/index-next.js +0 -2
- package/dist/primitives/input-otp.d.ts +0 -7
- package/dist/primitives/input-otp.jsx +0 -24
- package/dist/primitives/input.d.ts +0 -5
- package/dist/primitives/input.jsx +0 -11
- package/dist/primitives/label.d.ts +0 -5
- package/dist/primitives/label.jsx +0 -11
- package/dist/primitives/list-adaptor.d.ts +0 -9
- package/dist/primitives/list-adaptor.js +0 -1
- package/dist/primitives/list-box.d.ts +0 -10
- package/dist/primitives/list-box.jsx +0 -14
- package/dist/primitives/loading-spinner.d.ts +0 -5
- package/dist/primitives/loading-spinner.jsx +0 -8
- package/dist/primitives/navigation-menu.d.ts +0 -12
- package/dist/primitives/navigation-menu.jsx +0 -38
- package/dist/primitives/next/image.d.ts +0 -11
- package/dist/primitives/next/image.jsx +0 -42
- package/dist/primitives/next/index.d.ts +0 -7
- package/dist/primitives/next/index.js +0 -7
- package/dist/primitives/next/inline-icon.d.ts +0 -13
- package/dist/primitives/next/inline-icon.jsx +0 -15
- package/dist/primitives/next/link-element.d.ts +0 -23
- package/dist/primitives/next/link-element.jsx +0 -56
- package/dist/primitives/next/mdx-link.d.ts +0 -3
- package/dist/primitives/next/mdx-link.jsx +0 -12
- package/dist/primitives/next/media-stack.d.ts +0 -8
- package/dist/primitives/next/media-stack.jsx +0 -28
- package/dist/primitives/next/nav-items.d.ts +0 -10
- package/dist/primitives/next/nav-items.jsx +0 -24
- package/dist/primitives/next/youtube-embed.d.ts +0 -11
- package/dist/primitives/next/youtube-embed.jsx +0 -23
- package/dist/primitives/popover.d.ts +0 -9
- package/dist/primitives/popover.jsx +0 -18
- package/dist/primitives/progress.d.ts +0 -4
- package/dist/primitives/progress.jsx +0 -9
- package/dist/primitives/radio-group.d.ts +0 -7
- package/dist/primitives/radio-group.jsx +0 -18
- package/dist/primitives/scroll-area.d.ts +0 -5
- package/dist/primitives/scroll-area.jsx +0 -19
- package/dist/primitives/select.d.ts +0 -13
- package/dist/primitives/select.jsx +0 -62
- package/dist/primitives/separator.d.ts +0 -4
- package/dist/primitives/separator.jsx +0 -7
- package/dist/primitives/sheet.d.ts +0 -30
- package/dist/primitives/sheet.jsx +0 -56
- package/dist/primitives/skeleton.d.ts +0 -4
- package/dist/primitives/skeleton.jsx +0 -3
- package/dist/primitives/slider.d.ts +0 -9
- package/dist/primitives/slider.jsx +0 -30
- package/dist/primitives/sonner.d.ts +0 -5
- package/dist/primitives/sonner.jsx +0 -16
- package/dist/primitives/step-indicator.d.ts +0 -9
- package/dist/primitives/step-indicator.jsx +0 -23
- package/dist/primitives/switch.d.ts +0 -6
- package/dist/primitives/switch.jsx +0 -14
- package/dist/primitives/table.d.ts +0 -10
- package/dist/primitives/table.jsx +0 -21
- package/dist/primitives/tabs.d.ts +0 -7
- package/dist/primitives/tabs.jsx +0 -18
- package/dist/primitives/text-area.d.ts +0 -5
- package/dist/primitives/text-area.jsx +0 -9
- package/dist/primitives/toggle-group.d.ts +0 -14
- package/dist/primitives/toggle-group.jsx +0 -28
- package/dist/primitives/toggle.d.ts +0 -14
- package/dist/primitives/toggle.jsx +0 -52
- package/dist/primitives/tooltip.d.ts +0 -11
- package/dist/primitives/tooltip.jsx +0 -18
- package/dist/primitives/video-player.d.ts +0 -6
- package/dist/primitives/video-player.jsx +0 -8
- package/dist/style/theme-provider.d.ts +0 -4
- package/dist/style/theme-provider.jsx +0 -11
- package/dist/tailwind/fontFamily.tailwind.d.ts +0 -8
- package/dist/tailwind/fontFamily.tailwind.js +0 -7
- package/dist/tailwind/fontSize.tailwind.d.ts +0 -36
- package/dist/tailwind/fontSize.tailwind.js +0 -13
- package/dist/tailwind/index.d.ts +0 -3
- package/dist/tailwind/index.js +0 -2
- package/dist/tailwind/screens.tailwind.d.ts +0 -9
- package/dist/tailwind/screens.tailwind.js +0 -8
- package/dist/tailwind/tw-font-desc.d.ts +0 -6
- package/dist/tailwind/tw-font-desc.js +0 -6
- package/dist/types/animation-def.d.ts +0 -2
- package/dist/types/animation-def.js +0 -1
- package/dist/types/breakpoints.d.ts +0 -4
- package/dist/types/breakpoints.js +0 -4
- package/dist/types/bullet-item.d.ts +0 -6
- package/dist/types/bullet-item.js +0 -2
- package/dist/types/button-def.d.ts +0 -29
- package/dist/types/button-def.js +0 -2
- package/dist/types/dimensions.d.ts +0 -5
- package/dist/types/dimensions.js +0 -1
- package/dist/types/grid-def.d.ts +0 -36
- package/dist/types/grid-def.js +0 -33
- package/dist/types/image-def.d.ts +0 -27
- package/dist/types/image-def.js +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.js +0 -2
- package/dist/types/link-def.d.ts +0 -44
- package/dist/types/link-def.js +0 -1
- package/dist/types/media-stack-def.d.ts +0 -25
- package/dist/types/media-stack-def.js +0 -1
- package/dist/types/t-shirt-size.d.ts +0 -2
- package/dist/types/t-shirt-size.js +0 -1
- package/dist/types/tshirt-dimensions.d.ts +0 -12
- package/dist/types/tshirt-dimensions.js +0 -1
- package/dist/types/video-def.d.ts +0 -9
- package/dist/types/video-def.js +0 -1
- package/dist/util/format-and-abbreviate-as-currency.d.ts +0 -11
- package/dist/util/format-and-abbreviate-as-currency.js +0 -91
- package/dist/util/format-to-max-char.d.ts +0 -5
- package/dist/util/format-to-max-char.js +0 -57
- package/dist/util/index-client.d.ts +0 -2
- package/dist/util/index-client.js +0 -3
- package/dist/util/index.d.ts +0 -17
- package/dist/util/index.js +0 -41
- package/dist/util/number-abbreviate.d.ts +0 -9
- package/dist/util/number-abbreviate.js +0 -30
- package/dist/util/specifier.d.ts +0 -7
- package/dist/util/specifier.js +0 -31
- package/dist/util/spread-to-transform.d.ts +0 -7
- package/dist/util/spread-to-transform.js +0 -18
- package/dist/util/step-animation.d.ts +0 -5
- package/dist/util/step-animation.js +0 -60
- package/dist/util/two-way-map.d.ts +0 -8
- package/dist/util/two-way-map.js +0 -16
- /package/{mcp → src/mcp}/index.ts +0 -0
- /package/{mcp → src/mcp}/package.json +0 -0
- /package/{registry → src/registry}/package.json +0 -0
package/primitives/form.tsx
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
import { Slot } from "@radix-ui/react-slot"
|
|
5
|
-
|
|
1
|
+
import type * as LabelPrimitive from '@radix-ui/react-label';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import * as React from 'react';
|
|
6
4
|
import {
|
|
7
5
|
Controller,
|
|
8
6
|
type ControllerProps,
|
|
@@ -10,27 +8,27 @@ import {
|
|
|
10
8
|
type FieldValues,
|
|
11
9
|
FormProvider,
|
|
12
10
|
useFormContext,
|
|
13
|
-
} from
|
|
11
|
+
} from 'react-hook-form';
|
|
14
12
|
|
|
15
|
-
import { cn } from
|
|
16
|
-
import Label from
|
|
13
|
+
import { cn } from '../src/utils';
|
|
14
|
+
import { Label } from './label';
|
|
17
15
|
|
|
18
|
-
const Form = FormProvider
|
|
16
|
+
const Form = FormProvider;
|
|
19
17
|
|
|
20
18
|
type FormFieldContextValue<
|
|
21
19
|
TFieldValues extends FieldValues = FieldValues,
|
|
22
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues
|
|
20
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
23
21
|
> = {
|
|
24
|
-
name: TName
|
|
25
|
-
}
|
|
22
|
+
name: TName;
|
|
23
|
+
};
|
|
26
24
|
|
|
27
25
|
const FormFieldContext = React.createContext<FormFieldContextValue>(
|
|
28
|
-
{} as FormFieldContextValue
|
|
29
|
-
)
|
|
26
|
+
{} as FormFieldContextValue,
|
|
27
|
+
);
|
|
30
28
|
|
|
31
29
|
const FormField = <
|
|
32
30
|
TFieldValues extends FieldValues = FieldValues,
|
|
33
|
-
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues
|
|
31
|
+
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,
|
|
34
32
|
>({
|
|
35
33
|
...props
|
|
36
34
|
}: ControllerProps<TFieldValues, TName>) => {
|
|
@@ -38,21 +36,21 @@ const FormField = <
|
|
|
38
36
|
<FormFieldContext.Provider value={{ name: props.name }}>
|
|
39
37
|
<Controller {...props} />
|
|
40
38
|
</FormFieldContext.Provider>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
39
|
+
);
|
|
40
|
+
};
|
|
43
41
|
|
|
44
42
|
const useFormField = () => {
|
|
45
|
-
const fieldContext = React.useContext(FormFieldContext)
|
|
46
|
-
const itemContext = React.useContext(FormItemContext)
|
|
47
|
-
const { getFieldState, formState } = useFormContext()
|
|
43
|
+
const fieldContext = React.useContext(FormFieldContext);
|
|
44
|
+
const itemContext = React.useContext(FormItemContext);
|
|
45
|
+
const { getFieldState, formState } = useFormContext();
|
|
48
46
|
|
|
49
|
-
const fieldState = getFieldState(fieldContext.name, formState)
|
|
47
|
+
const fieldState = getFieldState(fieldContext.name, formState);
|
|
50
48
|
|
|
51
49
|
if (!fieldContext) {
|
|
52
|
-
throw new Error(
|
|
50
|
+
throw new Error('useFormField should be used within <FormField>');
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
const { id } = itemContext
|
|
53
|
+
const { id } = itemContext;
|
|
56
54
|
|
|
57
55
|
return {
|
|
58
56
|
id,
|
|
@@ -61,110 +59,117 @@ const useFormField = () => {
|
|
|
61
59
|
formDescriptionId: `${id}-form-item-description`,
|
|
62
60
|
formMessageId: `${id}-form-item-message`,
|
|
63
61
|
...fieldState,
|
|
64
|
-
}
|
|
65
|
-
}
|
|
62
|
+
};
|
|
63
|
+
};
|
|
66
64
|
|
|
67
65
|
type FormItemContextValue = {
|
|
68
|
-
id: string
|
|
69
|
-
}
|
|
66
|
+
id: string;
|
|
67
|
+
};
|
|
70
68
|
|
|
71
69
|
const FormItemContext = React.createContext<FormItemContextValue>(
|
|
72
|
-
{} as FormItemContextValue
|
|
73
|
-
)
|
|
70
|
+
{} as FormItemContextValue,
|
|
71
|
+
);
|
|
74
72
|
|
|
75
|
-
const FormItem =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
const id = React.useId()
|
|
73
|
+
const FormItem = ({
|
|
74
|
+
className,
|
|
75
|
+
...props
|
|
76
|
+
}: React.HTMLAttributes<HTMLDivElement>) => {
|
|
77
|
+
const id = React.useId();
|
|
80
78
|
|
|
81
79
|
return (
|
|
82
80
|
<FormItemContext.Provider value={{ id }}>
|
|
83
|
-
<div
|
|
81
|
+
<div className={cn('relative', className)} {...props} />
|
|
84
82
|
</FormItemContext.Provider>
|
|
85
|
-
)
|
|
86
|
-
}
|
|
87
|
-
FormItem.displayName =
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
FormItem.displayName = 'FormItem';
|
|
88
86
|
|
|
89
|
-
const FormLabel =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const { error, formItemId } = useFormField()
|
|
87
|
+
const FormLabel = ({
|
|
88
|
+
className,
|
|
89
|
+
...props
|
|
90
|
+
}: React.ComponentProps<typeof LabelPrimitive.Root>) => {
|
|
91
|
+
const { error, formItemId } = useFormField();
|
|
94
92
|
|
|
95
93
|
return (
|
|
96
94
|
<Label
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
className={cn(
|
|
96
|
+
'text-text-secondary pointer-events-none absolute top-3 left-4 flex text-xs leading-tight font-medium transition-all select-none',
|
|
97
|
+
// input
|
|
98
|
+
'peer-placeholder-shown:text-text-tertiary z-[1] peer-placeholder-shown:text-base peer-placeholder-shown:leading-[2.3]',
|
|
99
|
+
'peer-focus:text-text-secondary peer-disabled:peer-placeholder-shown:text-text-tertiary peer-disabled:text-text-tertiary peer-focus:text-xs peer-focus:leading-tight',
|
|
100
|
+
// select
|
|
101
|
+
'peer-data-[placeholder]/select:top-5 peer-data-[placeholder]/select:text-base',
|
|
102
|
+
// adornment
|
|
103
|
+
'peer-[.adornment]/adornment:text-xs',
|
|
104
|
+
error && 'text-red-500',
|
|
105
|
+
className,
|
|
106
|
+
)}
|
|
99
107
|
htmlFor={formItemId}
|
|
100
108
|
{...props}
|
|
101
109
|
/>
|
|
102
|
-
)
|
|
103
|
-
}
|
|
104
|
-
FormLabel.displayName =
|
|
110
|
+
);
|
|
111
|
+
};
|
|
112
|
+
FormLabel.displayName = 'FormLabel';
|
|
105
113
|
|
|
106
|
-
const FormControl = React.
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
>(({ ...props }, ref) => {
|
|
110
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField()
|
|
114
|
+
const FormControl = ({ ...props }: React.ComponentProps<typeof Slot>) => {
|
|
115
|
+
const { error, formItemId, formDescriptionId, formMessageId } =
|
|
116
|
+
useFormField();
|
|
111
117
|
|
|
112
118
|
return (
|
|
113
119
|
<Slot
|
|
114
|
-
ref={ref}
|
|
115
|
-
id={formItemId}
|
|
116
120
|
aria-describedby={
|
|
117
|
-
|
|
118
|
-
? `${formDescriptionId}`
|
|
119
|
-
: `${formDescriptionId} ${formMessageId}`
|
|
121
|
+
error ? `${formDescriptionId} ${formMessageId}` : `${formDescriptionId}`
|
|
120
122
|
}
|
|
121
123
|
aria-invalid={!!error}
|
|
124
|
+
id={formItemId}
|
|
122
125
|
{...props}
|
|
123
126
|
/>
|
|
124
|
-
)
|
|
125
|
-
}
|
|
126
|
-
FormControl.displayName =
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
FormControl.displayName = 'FormControl';
|
|
127
130
|
|
|
128
|
-
const FormDescription =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const { formDescriptionId } = useFormField()
|
|
131
|
+
const FormDescription = ({
|
|
132
|
+
className,
|
|
133
|
+
...props
|
|
134
|
+
}: React.HTMLAttributes<HTMLParagraphElement>) => {
|
|
135
|
+
const { formDescriptionId } = useFormField();
|
|
133
136
|
|
|
134
137
|
return (
|
|
135
138
|
<p
|
|
136
|
-
|
|
139
|
+
className={cn('text-text-secondary py-1 text-[0.75rem]', className)}
|
|
137
140
|
id={formDescriptionId}
|
|
138
|
-
className={cn("text-sm text-muted-1", className)}
|
|
139
141
|
{...props}
|
|
140
142
|
/>
|
|
141
|
-
)
|
|
142
|
-
}
|
|
143
|
-
FormDescription.displayName =
|
|
143
|
+
);
|
|
144
|
+
};
|
|
145
|
+
FormDescription.displayName = 'FormDescription';
|
|
144
146
|
|
|
145
|
-
const FormMessage =
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const
|
|
147
|
+
const FormMessage = ({
|
|
148
|
+
className,
|
|
149
|
+
children,
|
|
150
|
+
...props
|
|
151
|
+
}: React.HTMLAttributes<HTMLParagraphElement>) => {
|
|
152
|
+
const { error, formMessageId } = useFormField();
|
|
153
|
+
const body = error ? String(error?.message) : children;
|
|
151
154
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
if (!body) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
155
158
|
|
|
156
159
|
return (
|
|
157
160
|
<p
|
|
158
|
-
|
|
161
|
+
className={cn(
|
|
162
|
+
'text-red text-[0.75rem] font-medium dark:text-red-900',
|
|
163
|
+
className,
|
|
164
|
+
)}
|
|
159
165
|
id={formMessageId}
|
|
160
|
-
className={cn(classes, className)}
|
|
161
166
|
{...props}
|
|
162
167
|
>
|
|
163
|
-
{body
|
|
168
|
+
{body}
|
|
164
169
|
</p>
|
|
165
|
-
)
|
|
166
|
-
}
|
|
167
|
-
FormMessage.displayName =
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
FormMessage.displayName = 'FormMessage';
|
|
168
173
|
|
|
169
174
|
export {
|
|
170
175
|
useFormField,
|
|
@@ -175,4 +180,4 @@ export {
|
|
|
175
180
|
FormDescription,
|
|
176
181
|
FormMessage,
|
|
177
182
|
FormField,
|
|
178
|
-
}
|
|
183
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import { cn } from '../src/utils';
|
|
5
|
+
|
|
6
|
+
const HoverCard = HoverCardPrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
9
|
+
|
|
10
|
+
const HoverCardContent = ({
|
|
11
|
+
className,
|
|
12
|
+
align = 'center',
|
|
13
|
+
sideOffset = 4,
|
|
14
|
+
...props
|
|
15
|
+
}: React.ComponentProps<typeof HoverCardPrimitive.Content>) => (
|
|
16
|
+
<HoverCardPrimitive.Content
|
|
17
|
+
align={align}
|
|
18
|
+
className={cn(
|
|
19
|
+
'data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-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 bg-bg-dark border-divider z-[1500000000] flex flex-col gap-3 rounded-md border pt-1 shadow-none outline-hidden data-[side=top]:flex-col-reverse',
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
sideOffset={sideOffset}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
);
|
|
26
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
27
|
+
|
|
28
|
+
export { HoverCard, HoverCardTrigger, HoverCardContent };
|
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
export {
|
|
2
|
-
Accordion,
|
|
3
|
-
AccordionItem,
|
|
4
|
-
AccordionTrigger,
|
|
5
|
-
AccordionContent
|
|
1
|
+
export {
|
|
2
|
+
Accordion,
|
|
3
|
+
AccordionItem,
|
|
4
|
+
AccordionTrigger,
|
|
5
|
+
AccordionContent
|
|
6
6
|
} from './accordion'
|
|
7
7
|
|
|
8
|
-
export {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export {
|
|
9
|
+
AlertDialog,
|
|
10
|
+
AlertDialogTrigger,
|
|
11
|
+
AlertDialogContent,
|
|
12
|
+
AlertDialogHeader,
|
|
13
|
+
AlertDialogTitle,
|
|
14
|
+
AlertDialogDescription,
|
|
15
|
+
AlertDialogFooter,
|
|
16
|
+
AlertDialogAction,
|
|
17
|
+
AlertDialogCancel,
|
|
18
|
+
} from './alert-dialog'
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
Alert,
|
|
22
|
+
AlertTitle,
|
|
23
|
+
AlertDescription
|
|
24
|
+
} from './alert'
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
Avatar,
|
|
28
|
+
AvatarImage,
|
|
29
|
+
AvatarFallback
|
|
12
30
|
} from './avatar'
|
|
13
31
|
|
|
14
32
|
export {
|
|
@@ -27,13 +45,13 @@ export {
|
|
|
27
45
|
buttonVariants,
|
|
28
46
|
} from './button'
|
|
29
47
|
|
|
30
|
-
export {
|
|
31
|
-
Card,
|
|
32
|
-
CardHeader,
|
|
33
|
-
CardFooter,
|
|
34
|
-
CardTitle,
|
|
35
|
-
CardDescription,
|
|
36
|
-
CardContent
|
|
48
|
+
export {
|
|
49
|
+
Card,
|
|
50
|
+
CardHeader,
|
|
51
|
+
CardFooter,
|
|
52
|
+
CardTitle,
|
|
53
|
+
CardDescription,
|
|
54
|
+
CardContent
|
|
37
55
|
} from './card'
|
|
38
56
|
|
|
39
57
|
export {
|
|
@@ -58,6 +76,11 @@ export {
|
|
|
58
76
|
CommandSeparator,
|
|
59
77
|
} from './command'
|
|
60
78
|
|
|
79
|
+
export {
|
|
80
|
+
Collapsible,
|
|
81
|
+
CollapsibleTrigger,
|
|
82
|
+
CollapsibleContent,
|
|
83
|
+
} from './collapsible'
|
|
61
84
|
|
|
62
85
|
export {
|
|
63
86
|
ContextMenu,
|
|
@@ -77,7 +100,6 @@ export {
|
|
|
77
100
|
ContextMenuRadioGroup,
|
|
78
101
|
} from './context-menu'
|
|
79
102
|
|
|
80
|
-
|
|
81
103
|
export {
|
|
82
104
|
type DrawerProps,
|
|
83
105
|
Drawer,
|
|
@@ -106,6 +128,24 @@ export {
|
|
|
106
128
|
DialogDescription,
|
|
107
129
|
} from './dialog'
|
|
108
130
|
|
|
131
|
+
export {
|
|
132
|
+
DropdownMenu,
|
|
133
|
+
DropdownMenuTrigger,
|
|
134
|
+
DropdownMenuContent,
|
|
135
|
+
DropdownMenuItem,
|
|
136
|
+
DropdownMenuCheckboxItem,
|
|
137
|
+
DropdownMenuRadioItem,
|
|
138
|
+
DropdownMenuLabel,
|
|
139
|
+
DropdownMenuSeparator,
|
|
140
|
+
DropdownMenuShortcut,
|
|
141
|
+
DropdownMenuGroup,
|
|
142
|
+
DropdownMenuPortal,
|
|
143
|
+
DropdownMenuSub,
|
|
144
|
+
DropdownMenuSubContent,
|
|
145
|
+
DropdownMenuSubTrigger,
|
|
146
|
+
DropdownMenuRadioGroup,
|
|
147
|
+
} from './dropdown-menu'
|
|
148
|
+
|
|
109
149
|
export {
|
|
110
150
|
useFormField,
|
|
111
151
|
Form,
|
|
@@ -117,7 +157,13 @@ export {
|
|
|
117
157
|
FormField,
|
|
118
158
|
} from './form'
|
|
119
159
|
|
|
120
|
-
export {
|
|
160
|
+
export {
|
|
161
|
+
HoverCard,
|
|
162
|
+
HoverCardTrigger,
|
|
163
|
+
HoverCardContent,
|
|
164
|
+
} from './hover-card'
|
|
165
|
+
|
|
166
|
+
export {
|
|
121
167
|
InputOTP,
|
|
122
168
|
InputOTPGroup,
|
|
123
169
|
InputOTPSeparator,
|
|
@@ -136,15 +182,21 @@ export {
|
|
|
136
182
|
NavigationMenuViewport,
|
|
137
183
|
} from './navigation-menu'
|
|
138
184
|
|
|
139
|
-
export {
|
|
140
|
-
Popover,
|
|
141
|
-
PopoverAnchor,
|
|
142
|
-
PopoverArrow,
|
|
143
|
-
PopoverClose,
|
|
144
|
-
PopoverContent,
|
|
145
|
-
PopoverTrigger,
|
|
185
|
+
export {
|
|
186
|
+
Popover,
|
|
187
|
+
PopoverAnchor,
|
|
188
|
+
PopoverArrow,
|
|
189
|
+
PopoverClose,
|
|
190
|
+
PopoverContent,
|
|
191
|
+
PopoverTrigger,
|
|
146
192
|
} from './popover'
|
|
147
193
|
|
|
194
|
+
export {
|
|
195
|
+
ResizablePanelGroup,
|
|
196
|
+
ResizablePanel,
|
|
197
|
+
ResizableHandle,
|
|
198
|
+
} from './resizable'
|
|
199
|
+
|
|
148
200
|
export {
|
|
149
201
|
Select,
|
|
150
202
|
SelectGroup,
|
|
@@ -182,43 +234,70 @@ export {
|
|
|
182
234
|
TableCaption,
|
|
183
235
|
} from './table'
|
|
184
236
|
|
|
185
|
-
export {
|
|
186
|
-
Tabs,
|
|
187
|
-
TabsList,
|
|
188
|
-
TabsTrigger,
|
|
189
|
-
TabsContent
|
|
237
|
+
export {
|
|
238
|
+
Tabs,
|
|
239
|
+
TabsList,
|
|
240
|
+
TabsTrigger,
|
|
241
|
+
TabsContent
|
|
190
242
|
} from './tabs'
|
|
191
243
|
|
|
192
|
-
export * from './tooltip'
|
|
244
|
+
export * from './tooltip'
|
|
193
245
|
|
|
194
246
|
export { default as ActionButton } from './action-button'
|
|
195
247
|
export { default as ApplyTypography, type TypographySize} from './apply-typography'
|
|
196
248
|
export { default as AspectRatio } from './aspect-ratio'
|
|
197
249
|
export { default as Badge } from './badge'
|
|
198
250
|
export { default as BreakpointIndicator } from './breakpoint-indicator'
|
|
199
|
-
export { default as Calendar } from './calendar'
|
|
200
|
-
export { default as Checkbox } from './checkbox'
|
|
201
|
-
export { default as Combobox, type ComboboxTriggerProps } from './combobox'
|
|
251
|
+
export { default as Calendar } from './calendar'
|
|
252
|
+
export { default as Checkbox } from './checkbox'
|
|
253
|
+
export { default as Combobox, type ComboboxTriggerProps } from './combobox'
|
|
202
254
|
export { default as DialogVideoController } from './dialog-video-controller'
|
|
203
255
|
export { default as Input } from './input'
|
|
204
256
|
export { default as Label } from './label'
|
|
205
257
|
export type { default as ListAdaptor } from './list-adaptor'
|
|
206
258
|
export { default as ListBox } from './list-box'
|
|
207
259
|
export { default as LoadingSpinner } from './loading-spinner'
|
|
208
|
-
export { default as Progress } from './progress'
|
|
260
|
+
export { default as Progress } from './progress'
|
|
209
261
|
export { RadioGroup, RadioGroupItem } from './radio-group'
|
|
210
|
-
export { ScrollArea, ScrollBar } from './scroll-area'
|
|
211
|
-
export {
|
|
212
|
-
export { default as
|
|
213
|
-
export { default as
|
|
262
|
+
export { ScrollArea, ScrollBar } from './scroll-area'
|
|
263
|
+
export { SearchInput } from './search-input'
|
|
264
|
+
export { default as Separator } from './separator'
|
|
265
|
+
export { default as Slider } from './slider'
|
|
266
|
+
export { default as Skeleton } from './skeleton'
|
|
214
267
|
export { default as StepIndicator } from './step-indicator'
|
|
215
|
-
export { default as Switch } from './switch'
|
|
216
|
-
export { default as TextArea } from './
|
|
268
|
+
export { default as Switch } from './switch'
|
|
269
|
+
export { default as TextArea } from './textarea'
|
|
270
|
+
export { default as TextField } from './textfield'
|
|
217
271
|
export { Toaster, toast } from './sonner'
|
|
218
272
|
export { Toggle, toggleVariants } from './toggle'
|
|
219
273
|
export { ToggleGroup, ToggleGroupItem } from './toggle-group'
|
|
220
274
|
export { default as VideoPlayer } from './video-player'
|
|
221
275
|
|
|
222
|
-
|
|
276
|
+
// Chat components
|
|
277
|
+
export { ChatInput } from './chat/chat-input'
|
|
278
|
+
export { ChatInputArea } from './chat/chat-input-area'
|
|
279
|
+
export { FileList } from './chat/files-preview'
|
|
280
|
+
|
|
281
|
+
// Additional components
|
|
282
|
+
export { CopyToClipboardIcon } from './copy-to-clipboard-icon'
|
|
283
|
+
export { DotsLoader } from './dots-loader'
|
|
284
|
+
export { FileUploader } from './file-uploader'
|
|
285
|
+
export { default as JsonForm } from './chat/json-form'
|
|
286
|
+
export { MarkdownText, MarkdownPreview } from './markdown-preview'
|
|
287
|
+
export { PrettyJsonPrint } from './pretty-json-print'
|
|
223
288
|
|
|
289
|
+
// Re-export Tooltip components individually
|
|
290
|
+
export {
|
|
291
|
+
TooltipProvider,
|
|
292
|
+
Tooltip,
|
|
293
|
+
TooltipTrigger,
|
|
294
|
+
TooltipContent,
|
|
295
|
+
TooltipArrow,
|
|
296
|
+
TooltipPortal,
|
|
297
|
+
} from './tooltip'
|
|
298
|
+
|
|
299
|
+
// Export icons
|
|
300
|
+
export * as Icons from './icons'
|
|
224
301
|
|
|
302
|
+
// Re-export assets for compatibility
|
|
303
|
+
export * from '../assets'
|
package/primitives/index-next.ts
CHANGED