@k8ordo/ui 1.0.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/LICENSE +21 -0
- package/README.md +624 -0
- package/dist/components/_internal/focus-ring.d.mts +8 -0
- package/dist/components/_internal/focus-ring.mjs +8 -0
- package/dist/components/ai/_internal/collapsible.d.mts +13 -0
- package/dist/components/ai/_internal/collapsible.mjs +49 -0
- package/dist/components/ai/_internal/streaming-cursor.d.mts +5 -0
- package/dist/components/ai/_internal/streaming-cursor.mjs +8 -0
- package/dist/components/ai/conversation/conversation.d.mts +18 -0
- package/dist/components/ai/conversation/conversation.mjs +111 -0
- package/dist/components/ai/conversation/index.d.mts +2 -0
- package/dist/components/ai/conversation/index.mjs +2 -0
- package/dist/components/ai/index.d.mts +14 -0
- package/dist/components/ai/index.mjs +7 -0
- package/dist/components/ai/message/index.d.mts +2 -0
- package/dist/components/ai/message/index.mjs +2 -0
- package/dist/components/ai/message/message.d.mts +17 -0
- package/dist/components/ai/message/message.mjs +34 -0
- package/dist/components/ai/prompt-input/index.d.mts +2 -0
- package/dist/components/ai/prompt-input/index.mjs +2 -0
- package/dist/components/ai/prompt-input/prompt-input.d.mts +27 -0
- package/dist/components/ai/prompt-input/prompt-input.mjs +108 -0
- package/dist/components/ai/reasoning/index.d.mts +2 -0
- package/dist/components/ai/reasoning/index.mjs +2 -0
- package/dist/components/ai/reasoning/reasoning.d.mts +12 -0
- package/dist/components/ai/reasoning/reasoning.mjs +25 -0
- package/dist/components/ai/response/index.d.mts +2 -0
- package/dist/components/ai/response/index.mjs +2 -0
- package/dist/components/ai/response/response.d.mts +20 -0
- package/dist/components/ai/response/response.mjs +57 -0
- package/dist/components/ai/suggestion/index.d.mts +2 -0
- package/dist/components/ai/suggestion/index.mjs +2 -0
- package/dist/components/ai/suggestion/suggestion.d.mts +17 -0
- package/dist/components/ai/suggestion/suggestion.mjs +29 -0
- package/dist/components/ai/tool-invocation/index.d.mts +2 -0
- package/dist/components/ai/tool-invocation/index.mjs +2 -0
- package/dist/components/ai/tool-invocation/tool-invocation.d.mts +17 -0
- package/dist/components/ai/tool-invocation/tool-invocation.mjs +73 -0
- package/dist/components/ai/types.d.mts +5 -0
- package/dist/components/ai/types.mjs +1 -0
- package/dist/components/buttons/button/button.d.mts +27 -0
- package/dist/components/buttons/button/button.mjs +60 -0
- package/dist/components/buttons/button/index.d.mts +2 -0
- package/dist/components/buttons/button/index.mjs +2 -0
- package/dist/components/buttons/icon-button/icon-button.d.mts +29 -0
- package/dist/components/buttons/icon-button/icon-button.mjs +84 -0
- package/dist/components/buttons/icon-button/index.d.mts +2 -0
- package/dist/components/buttons/icon-button/index.mjs +2 -0
- package/dist/components/data-display/accordion/accordion-button.d.mts +5 -0
- package/dist/components/data-display/accordion/accordion-button.mjs +26 -0
- package/dist/components/data-display/accordion/accordion-item.d.mts +9 -0
- package/dist/components/data-display/accordion/accordion-item.mjs +20 -0
- package/dist/components/data-display/accordion/accordion-panel.d.mts +5 -0
- package/dist/components/data-display/accordion/accordion-panel.mjs +18 -0
- package/dist/components/data-display/accordion/accordion.d.mts +5 -0
- package/dist/components/data-display/accordion/accordion.mjs +8 -0
- package/dist/components/data-display/accordion/context.d.mts +14 -0
- package/dist/components/data-display/accordion/context.mjs +32 -0
- package/dist/components/data-display/accordion/index.d.mts +19 -0
- package/dist/components/data-display/accordion/index.mjs +13 -0
- package/dist/components/data-display/avatar/avatar.d.mts +14 -0
- package/dist/components/data-display/avatar/avatar.mjs +43 -0
- package/dist/components/data-display/avatar/index.d.mts +2 -0
- package/dist/components/data-display/avatar/index.mjs +2 -0
- package/dist/components/data-display/badge/badge.d.mts +21 -0
- package/dist/components/data-display/badge/badge.mjs +27 -0
- package/dist/components/data-display/badge/index.d.mts +2 -0
- package/dist/components/data-display/badge/index.mjs +2 -0
- package/dist/components/data-display/card/card.d.mts +10 -0
- package/dist/components/data-display/card/card.mjs +10 -0
- package/dist/components/data-display/card/index.d.mts +2 -0
- package/dist/components/data-display/card/index.mjs +2 -0
- package/dist/components/data-display/code/code.d.mts +8 -0
- package/dist/components/data-display/code/code.mjs +35 -0
- package/dist/components/data-display/code/find-all-colors.d.mts +16 -0
- package/dist/components/data-display/code/find-all-colors.mjs +267 -0
- package/dist/components/data-display/code/index.d.mts +2 -0
- package/dist/components/data-display/code/index.mjs +2 -0
- package/dist/components/data-display/heading/heading.d.mts +9 -0
- package/dist/components/data-display/heading/heading.mjs +46 -0
- package/dist/components/data-display/heading/index.d.mts +2 -0
- package/dist/components/data-display/heading/index.mjs +2 -0
- package/dist/components/data-display/table/index.d.mts +2 -0
- package/dist/components/data-display/table/index.mjs +2 -0
- package/dist/components/data-display/table/table.d.mts +33 -0
- package/dist/components/data-display/table/table.mjs +62 -0
- package/dist/components/feedback/alert/alert.d.mts +19 -0
- package/dist/components/feedback/alert/alert.mjs +71 -0
- package/dist/components/feedback/alert/index.d.mts +2 -0
- package/dist/components/feedback/alert/index.mjs +2 -0
- package/dist/components/feedback/progress/index.d.mts +2 -0
- package/dist/components/feedback/progress/index.mjs +2 -0
- package/dist/components/feedback/progress/progress.d.mts +11 -0
- package/dist/components/feedback/progress/progress.mjs +21 -0
- package/dist/components/feedback/skeleton/index.d.mts +2 -0
- package/dist/components/feedback/skeleton/index.mjs +2 -0
- package/dist/components/feedback/skeleton/skeleton.d.mts +10 -0
- package/dist/components/feedback/skeleton/skeleton.mjs +10 -0
- package/dist/components/feedback/spinner/index.d.mts +2 -0
- package/dist/components/feedback/spinner/index.mjs +2 -0
- package/dist/components/feedback/spinner/spinner.d.mts +9 -0
- package/dist/components/feedback/spinner/spinner.mjs +24 -0
- package/dist/components/feedback/toast/context.d.mts +34 -0
- package/dist/components/feedback/toast/context.mjs +7 -0
- package/dist/components/feedback/toast/index.d.mts +3 -0
- package/dist/components/feedback/toast/index.mjs +3 -0
- package/dist/components/feedback/toast/provider.d.mts +8 -0
- package/dist/components/feedback/toast/provider.mjs +171 -0
- package/dist/components/feedback/toast/toast.d.mts +15 -0
- package/dist/components/feedback/toast/toast.mjs +32 -0
- package/dist/components/form/autocomplete/autocomplete.d.mts +23 -0
- package/dist/components/form/autocomplete/autocomplete.mjs +225 -0
- package/dist/components/form/autocomplete/index.d.mts +2 -0
- package/dist/components/form/autocomplete/index.mjs +2 -0
- package/dist/components/form/checkbox/checkbox.d.mts +21 -0
- package/dist/components/form/checkbox/checkbox.mjs +59 -0
- package/dist/components/form/checkbox/index.d.mts +2 -0
- package/dist/components/form/checkbox/index.mjs +2 -0
- package/dist/components/form/checkbox-card/checkbox-card.d.mts +29 -0
- package/dist/components/form/checkbox-card/checkbox-card.mjs +76 -0
- package/dist/components/form/checkbox-card/index.d.mts +2 -0
- package/dist/components/form/checkbox-card/index.mjs +2 -0
- package/dist/components/form/checkbox-group/checkbox-group.d.mts +29 -0
- package/dist/components/form/checkbox-group/checkbox-group.mjs +43 -0
- package/dist/components/form/checkbox-group/index.d.mts +34 -0
- package/dist/components/form/checkbox-group/index.mjs +9 -0
- package/dist/components/form/file-field/file-field.d.mts +27 -0
- package/dist/components/form/file-field/file-field.mjs +129 -0
- package/dist/components/form/file-field/index.d.mts +2 -0
- package/dist/components/form/file-field/index.mjs +2 -0
- package/dist/components/form/form/form.d.mts +9 -0
- package/dist/components/form/form/form.mjs +11 -0
- package/dist/components/form/form/index.d.mts +2 -0
- package/dist/components/form/form/index.mjs +2 -0
- package/dist/components/form/form-control/form-control.d.mts +23 -0
- package/dist/components/form/form-control/form-control.mjs +61 -0
- package/dist/components/form/form-control/index.d.mts +2 -0
- package/dist/components/form/form-control/index.mjs +2 -0
- package/dist/components/form/number-field/cast.d.mts +4 -0
- package/dist/components/form/number-field/cast.mjs +32 -0
- package/dist/components/form/number-field/index.d.mts +2 -0
- package/dist/components/form/number-field/index.mjs +2 -0
- package/dist/components/form/number-field/number-field.d.mts +25 -0
- package/dist/components/form/number-field/number-field.mjs +115 -0
- package/dist/components/form/password-input/index.d.mts +2 -0
- package/dist/components/form/password-input/index.mjs +2 -0
- package/dist/components/form/password-input/password-input.d.mts +11 -0
- package/dist/components/form/password-input/password-input.mjs +36 -0
- package/dist/components/form/radio/index.d.mts +2 -0
- package/dist/components/form/radio/index.mjs +2 -0
- package/dist/components/form/radio/radio.d.mts +24 -0
- package/dist/components/form/radio/radio.mjs +51 -0
- package/dist/components/form/radio-card/index.d.mts +2 -0
- package/dist/components/form/radio-card/index.mjs +2 -0
- package/dist/components/form/radio-card/radio-card.d.mts +29 -0
- package/dist/components/form/radio-card/radio-card.mjs +74 -0
- package/dist/components/form/select/index.d.mts +2 -0
- package/dist/components/form/select/index.mjs +2 -0
- package/dist/components/form/select/select.d.mts +11 -0
- package/dist/components/form/select/select.mjs +33 -0
- package/dist/components/form/slider/index.d.mts +2 -0
- package/dist/components/form/slider/index.mjs +2 -0
- package/dist/components/form/slider/slider.d.mts +23 -0
- package/dist/components/form/slider/slider.mjs +50 -0
- package/dist/components/form/switch/index.d.mts +2 -0
- package/dist/components/form/switch/index.mjs +2 -0
- package/dist/components/form/switch/switch.d.mts +21 -0
- package/dist/components/form/switch/switch.mjs +50 -0
- package/dist/components/form/text-field/index.d.mts +2 -0
- package/dist/components/form/text-field/index.mjs +2 -0
- package/dist/components/form/text-field/text-field.d.mts +11 -0
- package/dist/components/form/text-field/text-field.mjs +19 -0
- package/dist/components/form/textarea/index.d.mts +2 -0
- package/dist/components/form/textarea/index.mjs +2 -0
- package/dist/components/form/textarea/textarea.d.mts +11 -0
- package/dist/components/form/textarea/textarea.mjs +38 -0
- package/dist/components/icons/base.d.mts +15 -0
- package/dist/components/icons/base.mjs +18 -0
- package/dist/components/icons/browsers.d.mts +9 -0
- package/dist/components/icons/browsers.mjs +891 -0
- package/dist/components/icons/color-scale.d.mts +6 -0
- package/dist/components/icons/color-scale.mjs +44 -0
- package/dist/components/icons/github-mark.d.mts +6 -0
- package/dist/components/icons/github-mark.mjs +19 -0
- package/dist/components/icons/index.d.mts +10 -0
- package/dist/components/icons/index.mjs +9 -0
- package/dist/components/icons/logo.d.mts +7 -0
- package/dist/components/icons/logo.mjs +29 -0
- package/dist/components/icons/lucide-deep.d.mts +9 -0
- package/dist/components/icons/lucide-imports.d.mts +65 -0
- package/dist/components/icons/lucide-imports.mjs +65 -0
- package/dist/components/icons/lucide.d.mts +69 -0
- package/dist/components/icons/lucide.mjs +256 -0
- package/dist/components/icons/qiita.d.mts +6 -0
- package/dist/components/icons/qiita.mjs +28 -0
- package/dist/components/icons/twitter.d.mts +6 -0
- package/dist/components/icons/twitter.mjs +20 -0
- package/dist/components/icons/vertical-writing.d.mts +6 -0
- package/dist/components/icons/vertical-writing.mjs +26 -0
- package/dist/components/index.d.mts +106 -0
- package/dist/components/index.mjs +57 -0
- package/dist/components/layout/_shared/gap.d.mts +11 -0
- package/dist/components/layout/_shared/gap.mjs +10 -0
- package/dist/components/layout/_shared/padding.d.mts +11 -0
- package/dist/components/layout/_shared/padding.mjs +10 -0
- package/dist/components/layout/grid/grid.d.mts +16 -0
- package/dist/components/layout/grid/grid.mjs +35 -0
- package/dist/components/layout/grid/index.d.mts +2 -0
- package/dist/components/layout/grid/index.mjs +2 -0
- package/dist/components/layout/scroll-linked/index.d.mts +2 -0
- package/dist/components/layout/scroll-linked/index.mjs +2 -0
- package/dist/components/layout/scroll-linked/scroll-linked.d.mts +14 -0
- package/dist/components/layout/scroll-linked/scroll-linked.mjs +59 -0
- package/dist/components/layout/separator/index.d.mts +2 -0
- package/dist/components/layout/separator/index.mjs +2 -0
- package/dist/components/layout/separator/separator.d.mts +9 -0
- package/dist/components/layout/separator/separator.mjs +14 -0
- package/dist/components/layout/stack/index.d.mts +2 -0
- package/dist/components/layout/stack/index.mjs +2 -0
- package/dist/components/layout/stack/stack.d.mts +15 -0
- package/dist/components/layout/stack/stack.mjs +24 -0
- package/dist/components/navigation/anchor/anchor.d.mts +20 -0
- package/dist/components/navigation/anchor/anchor.mjs +28 -0
- package/dist/components/navigation/anchor/index.d.mts +2 -0
- package/dist/components/navigation/anchor/index.mjs +2 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.d.mts +19 -0
- package/dist/components/navigation/breadcrumb/breadcrumb.mjs +43 -0
- package/dist/components/navigation/breadcrumb/index.d.mts +14 -0
- package/dist/components/navigation/breadcrumb/index.mjs +10 -0
- package/dist/components/navigation/pagination/index.d.mts +2 -0
- package/dist/components/navigation/pagination/index.mjs +2 -0
- package/dist/components/navigation/pagination/pagination.d.mts +15 -0
- package/dist/components/navigation/pagination/pagination.mjs +74 -0
- package/dist/components/navigation/tabs/index.d.mts +2 -0
- package/dist/components/navigation/tabs/index.mjs +2 -0
- package/dist/components/navigation/tabs/tabs.d.mts +21 -0
- package/dist/components/navigation/tabs/tabs.mjs +130 -0
- package/dist/components/overlays/_internal/index.d.mts +4 -0
- package/dist/components/overlays/_internal/index.mjs +4 -0
- package/dist/components/overlays/_internal/modal-dialog-context.d.mts +14 -0
- package/dist/components/overlays/_internal/modal-dialog-context.mjs +13 -0
- package/dist/components/overlays/_internal/use-can-hover.d.mts +9 -0
- package/dist/components/overlays/_internal/use-can-hover.mjs +20 -0
- package/dist/components/overlays/_internal/use-hover-intent.d.mts +25 -0
- package/dist/components/overlays/_internal/use-hover-intent.mjs +56 -0
- package/dist/components/overlays/_internal/use-list-navigation.d.mts +36 -0
- package/dist/components/overlays/_internal/use-list-navigation.mjs +98 -0
- package/dist/components/overlays/dialog/dialog.d.mts +19 -0
- package/dist/components/overlays/dialog/dialog.mjs +87 -0
- package/dist/components/overlays/dialog/index.d.mts +2 -0
- package/dist/components/overlays/dialog/index.mjs +2 -0
- package/dist/components/overlays/drawer/drawer.d.mts +12 -0
- package/dist/components/overlays/drawer/drawer.mjs +60 -0
- package/dist/components/overlays/drawer/index.d.mts +2 -0
- package/dist/components/overlays/drawer/index.mjs +2 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.d.mts +34 -0
- package/dist/components/overlays/dropdown-menu/dropdown-menu.mjs +85 -0
- package/dist/components/overlays/dropdown-menu/hooks.d.mts +24 -0
- package/dist/components/overlays/dropdown-menu/hooks.mjs +26 -0
- package/dist/components/overlays/dropdown-menu/index.d.mts +2 -0
- package/dist/components/overlays/dropdown-menu/index.mjs +2 -0
- package/dist/components/overlays/dropdown-menu/shared.d.mts +7 -0
- package/dist/components/overlays/dropdown-menu/shared.mjs +8 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.d.mts +10 -0
- package/dist/components/overlays/dropdown-menu/sub-menu.mjs +143 -0
- package/dist/components/overlays/dropdown-menu/use-safe-triangle.d.mts +18 -0
- package/dist/components/overlays/dropdown-menu/use-safe-triangle.mjs +57 -0
- package/dist/components/overlays/list-box/hooks.d.mts +35 -0
- package/dist/components/overlays/list-box/hooks.mjs +43 -0
- package/dist/components/overlays/list-box/index.d.mts +2 -0
- package/dist/components/overlays/list-box/index.mjs +2 -0
- package/dist/components/overlays/list-box/list-box.d.mts +28 -0
- package/dist/components/overlays/list-box/list-box.mjs +150 -0
- package/dist/components/overlays/modal/index.d.mts +2 -0
- package/dist/components/overlays/modal/index.mjs +2 -0
- package/dist/components/overlays/modal/modal.d.mts +15 -0
- package/dist/components/overlays/modal/modal.mjs +72 -0
- package/dist/components/overlays/popover/anchor-positioning.d.mts +26 -0
- package/dist/components/overlays/popover/anchor-positioning.mjs +49 -0
- package/dist/components/overlays/popover/escape-stack.d.mts +7 -0
- package/dist/components/overlays/popover/escape-stack.mjs +34 -0
- package/dist/components/overlays/popover/hooks.d.mts +53 -0
- package/dist/components/overlays/popover/hooks.mjs +141 -0
- package/dist/components/overlays/popover/index.d.mts +3 -0
- package/dist/components/overlays/popover/index.mjs +3 -0
- package/dist/components/overlays/popover/popover.d.mts +25 -0
- package/dist/components/overlays/popover/popover.mjs +90 -0
- package/dist/components/overlays/tooltip/bridge.d.mts +5 -0
- package/dist/components/overlays/tooltip/bridge.mjs +29 -0
- package/dist/components/overlays/tooltip/index.d.mts +2 -0
- package/dist/components/overlays/tooltip/index.mjs +2 -0
- package/dist/components/overlays/tooltip/tooltip.d.mts +34 -0
- package/dist/components/overlays/tooltip/tooltip.mjs +87 -0
- package/dist/components/providers/index.d.mts +4 -0
- package/dist/components/providers/index.mjs +3 -0
- package/dist/components/providers/portal-root.d.mts +8 -0
- package/dist/components/providers/portal-root.mjs +12 -0
- package/dist/components/providers/ui-provider.d.mts +8 -0
- package/dist/components/providers/ui-provider.mjs +11 -0
- package/dist/helpers/chain.d.mts +5 -0
- package/dist/helpers/chain.mjs +29 -0
- package/dist/helpers/cn.d.mts +5 -0
- package/dist/helpers/cn.mjs +27 -0
- package/dist/helpers/create-safe-context.d.mts +6 -0
- package/dist/helpers/create-safe-context.mjs +30 -0
- package/dist/helpers/index.d.mts +6 -0
- package/dist/helpers/index.mjs +6 -0
- package/dist/helpers/merge-props.d.mts +6 -0
- package/dist/helpers/merge-props.mjs +56 -0
- package/dist/helpers/merge-refs.d.mts +5 -0
- package/dist/helpers/merge-refs.mjs +55 -0
- package/dist/hooks/breakpoint/index.d.mts +5 -0
- package/dist/hooks/breakpoint/index.mjs +24 -0
- package/dist/hooks/click-away/index.d.mts +5 -0
- package/dist/hooks/click-away/index.mjs +24 -0
- package/dist/hooks/client/index.d.mts +4 -0
- package/dist/hooks/client/index.mjs +6 -0
- package/dist/hooks/clipboard/index.d.mts +7 -0
- package/dist/hooks/clipboard/index.mjs +15 -0
- package/dist/hooks/controllable-state/index.d.mts +9 -0
- package/dist/hooks/controllable-state/index.mjs +21 -0
- package/dist/hooks/debounced-transition/index.d.mts +5 -0
- package/dist/hooks/debounced-transition/index.mjs +49 -0
- package/dist/hooks/deferred-debounce/index.d.mts +4 -0
- package/dist/hooks/deferred-debounce/index.mjs +9 -0
- package/dist/hooks/disclosure/index.d.mts +10 -0
- package/dist/hooks/disclosure/index.mjs +20 -0
- package/dist/hooks/focus-trap/index.d.mts +18 -0
- package/dist/hooks/focus-trap/index.mjs +51 -0
- package/dist/hooks/hash/index.d.mts +4 -0
- package/dist/hooks/hash/index.mjs +25 -0
- package/dist/hooks/hover/index.d.mts +12 -0
- package/dist/hooks/hover/index.mjs +19 -0
- package/dist/hooks/index.d.mts +25 -0
- package/dist/hooks/index.mjs +24 -0
- package/dist/hooks/intersection-observer/index.d.mts +3 -0
- package/dist/hooks/intersection-observer/index.mjs +3 -0
- package/dist/hooks/intersection-observer/use-in-view.d.mts +11 -0
- package/dist/hooks/intersection-observer/use-in-view.mjs +18 -0
- package/dist/hooks/intersection-observer/use-intersection-observer.d.mts +11 -0
- package/dist/hooks/intersection-observer/use-intersection-observer.mjs +33 -0
- package/dist/hooks/interval/index.d.mts +4 -0
- package/dist/hooks/interval/index.mjs +19 -0
- package/dist/hooks/local-storage/index.d.mts +4 -0
- package/dist/hooks/local-storage/index.mjs +46 -0
- package/dist/hooks/resize/index.d.mts +8 -0
- package/dist/hooks/resize/index.mjs +24 -0
- package/dist/hooks/scroll-direction/index.d.mts +13 -0
- package/dist/hooks/scroll-direction/index.mjs +67 -0
- package/dist/hooks/scroll-lock/index.d.mts +9 -0
- package/dist/hooks/scroll-lock/index.mjs +59 -0
- package/dist/hooks/session-storage/index.d.mts +4 -0
- package/dist/hooks/session-storage/index.mjs +46 -0
- package/dist/hooks/step/index.d.mts +15 -0
- package/dist/hooks/step/index.mjs +39 -0
- package/dist/hooks/timeout/index.d.mts +4 -0
- package/dist/hooks/timeout/index.mjs +19 -0
- package/dist/hooks/window-resize/index.d.mts +11 -0
- package/dist/hooks/window-resize/index.mjs +21 -0
- package/dist/hooks/window-size/index.d.mts +8 -0
- package/dist/hooks/window-size/index.mjs +31 -0
- package/dist/hooks/writing-mode/index.d.mts +6 -0
- package/dist/hooks/writing-mode/index.mjs +24 -0
- package/dist/i18n/context.d.mts +9 -0
- package/dist/i18n/context.mjs +19 -0
- package/dist/i18n/en.d.mts +5 -0
- package/dist/i18n/en.mjs +64 -0
- package/dist/i18n/index.d.mts +5 -0
- package/dist/i18n/index.mjs +4 -0
- package/dist/i18n/ja.d.mts +5 -0
- package/dist/i18n/ja.mjs +64 -0
- package/dist/i18n/messages.d.mts +84 -0
- package/dist/i18n/messages.mjs +1 -0
- package/dist/index.d.mts +94 -0
- package/dist/index.mjs +85 -0
- package/dist/integrations/_shared/openui-defs.d.mts +18 -0
- package/dist/integrations/_shared/openui-defs.mjs +162 -0
- package/dist/integrations/_shared/renderers.d.mts +71 -0
- package/dist/integrations/_shared/renderers.mjs +679 -0
- package/dist/integrations/_shared/schemas.d.mts +718 -0
- package/dist/integrations/_shared/schemas.mjs +545 -0
- package/dist/integrations/ai-sdk/index.d.mts +3 -0
- package/dist/integrations/ai-sdk/index.mjs +2 -0
- package/dist/integrations/ai-sdk/map-parts.d.mts +28 -0
- package/dist/integrations/ai-sdk/map-parts.mjs +32 -0
- package/dist/integrations/json-render/catalog.d.mts +838 -0
- package/dist/integrations/json-render/catalog.mjs +311 -0
- package/dist/integrations/json-render/registry.d.mts +29 -0
- package/dist/integrations/json-render/registry.mjs +159 -0
- package/dist/integrations/openui/form-views.d.mts +21 -0
- package/dist/integrations/openui/form-views.mjs +66 -0
- package/dist/integrations/openui/library.d.mts +151 -0
- package/dist/integrations/openui/library.mjs +69 -0
- package/dist/integrations/openui/prompt.d.mts +5 -0
- package/dist/integrations/openui/prompt.mjs +19 -0
- package/dist/internal/clamp.d.mts +4 -0
- package/dist/internal/clamp.mjs +15 -0
- package/dist/internal/to-precision.d.mts +4 -0
- package/dist/internal/to-precision.mjs +15 -0
- package/dist/styles/base.css +315 -0
- package/dist/styles/index.css +2677 -0
- package/dist/styles/tailwind.css +22 -0
- package/dist/styles/tokens.css +380 -0
- package/dist/styles/tokens.d.mts +2 -0
- package/dist/styles/tokens.generated.d.mts +840 -0
- package/dist/styles/tokens.generated.mjs +813 -0
- package/dist/styles/tokens.mjs +2 -0
- package/dist/styles/utilities.css +62 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/variables.d.mts +23 -0
- package/dist/types/variables.mjs +1 -0
- package/docs/GUIDE.md +324 -0
- package/docs/llms.txt +25 -0
- package/docs/props.generated.json +3519 -0
- package/docs/references/ai-chat.md +354 -0
- package/docs/references/color.md +121 -0
- package/docs/references/components.md +1466 -0
- package/docs/references/generative-ui.md +112 -0
- package/docs/references/helpers.md +120 -0
- package/docs/references/hooks.md +314 -0
- package/docs/references/interaction-design.md +95 -0
- package/docs/references/spatial-design.md +137 -0
- package/docs/references/typography.md +110 -0
- package/package.json +197 -0
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
import { accordionProps, alertProps, anchorProps, autocompleteProps, avatarProps, badgeProps, breadcrumbProps, buttonProps, cardProps, checkboxCardProps, checkboxGroupProps, checkboxProps, chevronIconProps, codeProps, dialogProps, drawerProps, dropdownMenuProps, fileFieldProps, formControlProps, formProps, gridProps, headingProps, iconButtonProps, iconProps, listBoxProps, modalProps, numberFieldProps, paginationProps, passwordInputProps, popoverProps, progressProps, radioCardProps, radioProps, scrollLinkedProps, selectProps, separatorProps, skeletonProps, sliderProps, spinnerProps, stackProps, statusIconProps, switchProps, tableProps, tabsProps, textFieldProps, textareaProps, toastProps, tooltipProps } from "../_shared/schemas.mjs";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { autoFixSpec, defineCatalog, isNonEmptySpec, validateSpec } from "@json-render/core";
|
|
4
|
+
import { schema } from "@json-render/react/schema";
|
|
5
|
+
//#region src/integrations/json-render/catalog.ts
|
|
6
|
+
/**
|
|
7
|
+
* `@k8ordo/ui/json-render`(サーバー安全)
|
|
8
|
+
*
|
|
9
|
+
* LLM が生成してよい部品の契約(Zod スキーマのみ)。React に依存しないので
|
|
10
|
+
* RSC のサーバーコンポーネントから import して `catalog.prompt()` で
|
|
11
|
+
* システムプロンプトを生成できる。
|
|
12
|
+
*
|
|
13
|
+
* 実際の描画は `@k8ordo/ui/json-render/registry`('use client')。
|
|
14
|
+
*/
|
|
15
|
+
const catalog = defineCatalog(schema, {
|
|
16
|
+
components: {
|
|
17
|
+
Stack: {
|
|
18
|
+
props: stackProps,
|
|
19
|
+
slots: ["default"],
|
|
20
|
+
description: "子要素を縦/横に等間隔で並べるレイアウトコンテナ。gap で子要素間の間隔、padding(none〜xl)で内側の余白を付ける。セクションに余白が欲しいときは padding を指定する。"
|
|
21
|
+
},
|
|
22
|
+
Grid: {
|
|
23
|
+
props: gridProps,
|
|
24
|
+
slots: ["default"],
|
|
25
|
+
description: "子要素をグリッド状に並べる。cols(1〜6 / auto-fill / auto-fit)と gap、auto-fill/fit 時は minItemSize で各セルの最小サイズを制御。"
|
|
26
|
+
},
|
|
27
|
+
Button: {
|
|
28
|
+
props: buttonProps,
|
|
29
|
+
description: "アクションボタン。href を指定するとリンク(<a>)になる。"
|
|
30
|
+
},
|
|
31
|
+
Card: {
|
|
32
|
+
props: cardProps,
|
|
33
|
+
slots: ["default"],
|
|
34
|
+
description: "コンテンツをまとめるカード(コンテナ)。内側 padding は size(sm/md/lg、デフォルト md)で決まる。中身を Stack で囲む場合に重ねて padding を指定する必要はない。interactive を付けるとホバー時にスケールする。"
|
|
35
|
+
},
|
|
36
|
+
Badge: {
|
|
37
|
+
props: badgeProps,
|
|
38
|
+
description: "ステータスやラベルのバッジ。"
|
|
39
|
+
},
|
|
40
|
+
Heading: {
|
|
41
|
+
props: headingProps,
|
|
42
|
+
description: "見出し(h1〜h6)。"
|
|
43
|
+
},
|
|
44
|
+
Alert: {
|
|
45
|
+
props: alertProps,
|
|
46
|
+
description: "状態を伝えるアラート。message は文字列または文字列配列。"
|
|
47
|
+
},
|
|
48
|
+
Spinner: {
|
|
49
|
+
props: spinnerProps,
|
|
50
|
+
description: "ローディングスピナー。"
|
|
51
|
+
},
|
|
52
|
+
Separator: {
|
|
53
|
+
props: separatorProps,
|
|
54
|
+
description: "区切り線。"
|
|
55
|
+
},
|
|
56
|
+
TextField: {
|
|
57
|
+
props: textFieldProps,
|
|
58
|
+
description: "1行テキスト入力。defaultValue を $bindState で状態に束縛できる。"
|
|
59
|
+
},
|
|
60
|
+
Checkbox: {
|
|
61
|
+
props: checkboxProps,
|
|
62
|
+
description: "チェックボックス。defaultChecked を $bindState で束縛できる。"
|
|
63
|
+
},
|
|
64
|
+
Switch: {
|
|
65
|
+
props: switchProps,
|
|
66
|
+
description: "オン/オフスイッチ。defaultChecked を $bindState で束縛できる。"
|
|
67
|
+
},
|
|
68
|
+
Select: {
|
|
69
|
+
props: selectProps,
|
|
70
|
+
description: "ドロップダウン選択。defaultValue を $bindState で状態に束縛できる。"
|
|
71
|
+
},
|
|
72
|
+
Tabs: {
|
|
73
|
+
props: tabsProps,
|
|
74
|
+
description: "タブ。各タブは label とテキスト content を持つ。"
|
|
75
|
+
},
|
|
76
|
+
Accordion: {
|
|
77
|
+
props: accordionProps,
|
|
78
|
+
description: "開閉できるアコーディオン。各項目は title とテキスト content。"
|
|
79
|
+
},
|
|
80
|
+
Breadcrumb: {
|
|
81
|
+
props: breadcrumbProps,
|
|
82
|
+
description: "パンくずリスト。"
|
|
83
|
+
},
|
|
84
|
+
Table: {
|
|
85
|
+
props: tableProps,
|
|
86
|
+
description: "テーブル。columns(見出し)と rows(行ごとのセル文字列)。"
|
|
87
|
+
},
|
|
88
|
+
Anchor: {
|
|
89
|
+
props: anchorProps,
|
|
90
|
+
description: "テキストリンク。"
|
|
91
|
+
},
|
|
92
|
+
Avatar: {
|
|
93
|
+
props: avatarProps,
|
|
94
|
+
description: "アバター(画像 or イニシャル)。"
|
|
95
|
+
},
|
|
96
|
+
Code: {
|
|
97
|
+
props: codeProps,
|
|
98
|
+
description: "インラインのコード/値表示。"
|
|
99
|
+
},
|
|
100
|
+
Progress: {
|
|
101
|
+
props: progressProps,
|
|
102
|
+
description: "進捗バー。"
|
|
103
|
+
},
|
|
104
|
+
Skeleton: {
|
|
105
|
+
props: skeletonProps,
|
|
106
|
+
description: "ローディングのプレースホルダ。"
|
|
107
|
+
},
|
|
108
|
+
Icon: {
|
|
109
|
+
props: iconProps,
|
|
110
|
+
description: "アイコン(name で指定)。"
|
|
111
|
+
},
|
|
112
|
+
ChevronIcon: {
|
|
113
|
+
props: chevronIconProps,
|
|
114
|
+
description: "矢印アイコン。direction で向きを指定。"
|
|
115
|
+
},
|
|
116
|
+
StatusIcon: {
|
|
117
|
+
props: statusIconProps,
|
|
118
|
+
description: "ステータスを表すアイコン(success/info/warning/error)。装飾用途で、メッセージ表示なら Alert を使う。"
|
|
119
|
+
},
|
|
120
|
+
IconButton: {
|
|
121
|
+
props: iconButtonProps,
|
|
122
|
+
description: "アイコンのみのボタン(label は必須・ツールチップ)。"
|
|
123
|
+
},
|
|
124
|
+
Textarea: {
|
|
125
|
+
props: textareaProps,
|
|
126
|
+
description: "複数行テキスト入力。defaultValue を $bindState で束縛できる。"
|
|
127
|
+
},
|
|
128
|
+
PasswordInput: {
|
|
129
|
+
props: passwordInputProps,
|
|
130
|
+
description: "パスワード入力。defaultValue を $bindState で束縛できる。"
|
|
131
|
+
},
|
|
132
|
+
NumberField: {
|
|
133
|
+
props: numberFieldProps,
|
|
134
|
+
description: "数値入力。defaultValue を $bindState で束縛できる。"
|
|
135
|
+
},
|
|
136
|
+
Slider: {
|
|
137
|
+
props: sliderProps,
|
|
138
|
+
description: "スライダー。defaultValue を $bindState で束縛できる。"
|
|
139
|
+
},
|
|
140
|
+
Radio: {
|
|
141
|
+
props: radioProps,
|
|
142
|
+
description: "単一選択ラジオ。defaultValue を $bindState で束縛できる。"
|
|
143
|
+
},
|
|
144
|
+
RadioCard: {
|
|
145
|
+
props: radioCardProps,
|
|
146
|
+
description: "カード型の単一選択。defaultValue を $bindState で束縛できる。"
|
|
147
|
+
},
|
|
148
|
+
CheckboxCard: {
|
|
149
|
+
props: checkboxCardProps,
|
|
150
|
+
description: "カード型の複数選択。defaultValue を $bindState で束縛できる。"
|
|
151
|
+
},
|
|
152
|
+
Pagination: {
|
|
153
|
+
props: paginationProps,
|
|
154
|
+
description: "ページネーション。defaultPage を $bindState で束縛できる。"
|
|
155
|
+
},
|
|
156
|
+
Form: {
|
|
157
|
+
props: formProps,
|
|
158
|
+
slots: ["default"],
|
|
159
|
+
description: "フォーム要素のラッパー(縦並びレイアウト)。"
|
|
160
|
+
},
|
|
161
|
+
Modal: {
|
|
162
|
+
props: modalProps,
|
|
163
|
+
slots: ["default"],
|
|
164
|
+
description: "モーダルダイアログ。triggerLabel のボタンで開く自己完結ウィジェット。"
|
|
165
|
+
},
|
|
166
|
+
Dialog: {
|
|
167
|
+
props: dialogProps,
|
|
168
|
+
slots: ["default"],
|
|
169
|
+
description: "センターダイアログ。triggerLabel のボタンで開く。"
|
|
170
|
+
},
|
|
171
|
+
Drawer: {
|
|
172
|
+
props: drawerProps,
|
|
173
|
+
slots: ["default"],
|
|
174
|
+
description: "サイドドロワー。triggerLabel のボタンで開く。"
|
|
175
|
+
},
|
|
176
|
+
Popover: {
|
|
177
|
+
props: popoverProps,
|
|
178
|
+
slots: ["default"],
|
|
179
|
+
description: "ポップオーバー。triggerLabel のボタンで開閉。"
|
|
180
|
+
},
|
|
181
|
+
Tooltip: {
|
|
182
|
+
props: tooltipProps,
|
|
183
|
+
description: "ツールチップ。ホバー/フォーカスで表示。"
|
|
184
|
+
},
|
|
185
|
+
DropdownMenu: {
|
|
186
|
+
props: dropdownMenuProps,
|
|
187
|
+
description: "ドロップダウンメニュー。"
|
|
188
|
+
},
|
|
189
|
+
Toast: {
|
|
190
|
+
props: toastProps,
|
|
191
|
+
description: "トースト通知。triggerLabel のボタンで発火。"
|
|
192
|
+
},
|
|
193
|
+
ScrollLinked: {
|
|
194
|
+
props: scrollLinkedProps,
|
|
195
|
+
description: "ページスクロール進捗バー(fixed top)。"
|
|
196
|
+
},
|
|
197
|
+
ListBox: {
|
|
198
|
+
props: listBoxProps,
|
|
199
|
+
description: "ポップアップ型の単一選択リスト。"
|
|
200
|
+
},
|
|
201
|
+
CheckboxGroup: {
|
|
202
|
+
props: checkboxGroupProps,
|
|
203
|
+
description: "チェックボックスグループ。"
|
|
204
|
+
},
|
|
205
|
+
Autocomplete: {
|
|
206
|
+
props: autocompleteProps,
|
|
207
|
+
description: "タグ風の複数選択オートコンプリート。"
|
|
208
|
+
},
|
|
209
|
+
FileField: {
|
|
210
|
+
props: fileFieldProps,
|
|
211
|
+
description: "ファイル選択フィールド。"
|
|
212
|
+
},
|
|
213
|
+
FormControl: {
|
|
214
|
+
props: formControlProps,
|
|
215
|
+
description: "ラベル+ヘルプ/エラー付きフィールド(text/textarea/password)。"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
actions: {}
|
|
219
|
+
});
|
|
220
|
+
/**
|
|
221
|
+
* LLM が破りやすい制約を `catalog.prompt({ customRules })` に注入するための
|
|
222
|
+
* 横断ルール集。json-render のシステムプロンプト本文に追記される。
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* const systemPrompt = catalog.prompt({ customRules: [...uiRules] });
|
|
226
|
+
*/
|
|
227
|
+
const uiRules = [
|
|
228
|
+
"Table の rows は各行のセル数を columns の数と必ず一致させる。",
|
|
229
|
+
"href は https:// もしくは http:// で始まる絶対 URL か、/ で始まるパスのみ。",
|
|
230
|
+
"Tabs と Accordion の content はプレーンテキストのみ。コンポーネントは入れ子にできない。"
|
|
231
|
+
];
|
|
232
|
+
const buildRepairPrompt = (issues) => ["The generated UI spec is invalid. Fix the following issues and return the corrected spec:", ...issues.map((issue) => issue.elementKey === void 0 ? `- ${issue.message}` : `- [${issue.elementKey}] ${issue.message}`)].join("\n");
|
|
233
|
+
/**
|
|
234
|
+
* スキーマが受け付ける prop キーの集合。
|
|
235
|
+
*
|
|
236
|
+
* zod の `z.object` は未知のキーを **エラーにせず黙って落とす**。そのため
|
|
237
|
+
* `safeParse` だけでは「旧 API のキーを渡した spec」が `ok: true` で通り、
|
|
238
|
+
* 既定値のまま描画されて壊れたことにすら気づけない。キー集合を取り出して
|
|
239
|
+
* 自前で照合する。
|
|
240
|
+
*/
|
|
241
|
+
const knownPropKeys = (propsSchema) => propsSchema instanceof z.ZodObject ? Object.keys(propsSchema.shape) : void 0;
|
|
242
|
+
/** spec 側は LLM 出力なので、型に反して props が欠けていることがある。 */
|
|
243
|
+
const givenPropKeys = (props) => typeof props === "object" && props !== null ? Object.keys(props) : [];
|
|
244
|
+
/**
|
|
245
|
+
* LLM が生成した spec を検証し、描画可能なら型付き spec を、壊れていれば
|
|
246
|
+
* そのまま LLM に投げ返せる修復プロンプトを返す。
|
|
247
|
+
*
|
|
248
|
+
* 内部では (1) 機械修正(`autoFixSpec`)→ (2) 構造検証(`validateSpec`)→
|
|
249
|
+
* (3) 要素ごとに catalog の Zod スキーマで props 検証(未知キーの検出を含む)、
|
|
250
|
+
* を行う。`catalog.validate()` は使わない(現行の上流バージョンでは正常な spec を
|
|
251
|
+
* 誤って弾き、props 検証も実質無効になるため)。
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* const result = validateGeneratedSpec(JSON.parse(llmOutput));
|
|
255
|
+
* if (result.ok) {
|
|
256
|
+
* return <JsonRenderUI spec={result.spec} />;
|
|
257
|
+
* }
|
|
258
|
+
* const retried = await llm(result.repairPrompt);
|
|
259
|
+
*/
|
|
260
|
+
const validateGeneratedSpec = (input) => {
|
|
261
|
+
if (!isNonEmptySpec(input)) {
|
|
262
|
+
const issues = [{ message: "The spec must be an object with a `root` key and an `elements` map." }];
|
|
263
|
+
return {
|
|
264
|
+
ok: false,
|
|
265
|
+
issues,
|
|
266
|
+
repairPrompt: buildRepairPrompt(issues)
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const { spec, fixes } = autoFixSpec(input);
|
|
270
|
+
const issues = validateSpec(spec).issues.map((issue) => ({
|
|
271
|
+
elementKey: issue.elementKey,
|
|
272
|
+
message: issue.message
|
|
273
|
+
}));
|
|
274
|
+
const components = catalog.data.components;
|
|
275
|
+
for (const [key, element] of Object.entries(spec.elements)) {
|
|
276
|
+
const def = components[element.type];
|
|
277
|
+
if (!def) {
|
|
278
|
+
issues.push({
|
|
279
|
+
elementKey: key,
|
|
280
|
+
message: `Unknown component type "${element.type}". Use one of: ${catalog.componentNames.join(", ")}.`
|
|
281
|
+
});
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
const parsed = def.props.safeParse(element.props);
|
|
285
|
+
if (!parsed.success) for (const issue of parsed.error.issues) {
|
|
286
|
+
const path = issue.path.join(".");
|
|
287
|
+
issues.push({
|
|
288
|
+
elementKey: key,
|
|
289
|
+
message: `${element.type}${path ? `.${path}` : ""}: ${issue.message}`
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
const allowed = knownPropKeys(def.props);
|
|
293
|
+
if (allowed === void 0) continue;
|
|
294
|
+
for (const propKey of givenPropKeys(element.props)) if (!allowed.includes(propKey)) issues.push({
|
|
295
|
+
elementKey: key,
|
|
296
|
+
message: `${element.type}: Unknown prop "${propKey}". Allowed props: ${allowed.join(", ")}.`
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
if (issues.length === 0) return {
|
|
300
|
+
ok: true,
|
|
301
|
+
spec,
|
|
302
|
+
fixes
|
|
303
|
+
};
|
|
304
|
+
return {
|
|
305
|
+
ok: false,
|
|
306
|
+
issues,
|
|
307
|
+
repairPrompt: buildRepairPrompt(issues)
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
//#endregion
|
|
311
|
+
export { catalog, uiRules, validateGeneratedSpec };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { Spec } from "@json-render/core";
|
|
3
|
+
//#region src/integrations/json-render/registry.d.ts
|
|
4
|
+
declare const registry: import("@json-render/react").ComponentRegistry;
|
|
5
|
+
/**
|
|
6
|
+
* spec を @k8ordo/ui の部品で描画する、事前結線済みコンポーネント。
|
|
7
|
+
*
|
|
8
|
+
* `JSONUIProvider` と `Renderer` を内部で結線し registry も渡し済みなので、
|
|
9
|
+
* 利用者は spec を渡すだけでよい(上流の生 import や 'use client' 境界ファイルの
|
|
10
|
+
* 自作が不要)。フォーム値を回収したいときは `onStateChange` を渡す。
|
|
11
|
+
* 高度な構成(navigate / handlers / validationFunctions など)が必要なら、
|
|
12
|
+
* 引き続き `registry` を `JSONUIProvider` に直接渡す。
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* 'use client';
|
|
16
|
+
* import { JsonRenderUI } from '@k8ordo/ui/json-render/registry';
|
|
17
|
+
*
|
|
18
|
+
* <JsonRenderUI spec={spec} />
|
|
19
|
+
*/
|
|
20
|
+
declare const JsonRenderUI: FC<{
|
|
21
|
+
spec: Spec | null;
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
onStateChange?: (changes: Array<{
|
|
24
|
+
path: string;
|
|
25
|
+
value: unknown;
|
|
26
|
+
}>) => void;
|
|
27
|
+
}>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { JsonRenderUI, registry };
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { DialogWidget, DrawerWidget, FileFieldWidget, FormControlWidget, ModalWidget, ToastWidget, renderAccordion, renderAlert, renderAnchor, renderAutocomplete, renderAvatar, renderBadge, renderBreadcrumb, renderButton, renderCard, renderCheckbox, renderCheckboxCard, renderCheckboxGroup, renderChevronIcon, renderCode, renderDropdownMenu, renderForm, renderGrid, renderHeading, renderIcon, renderIconButton, renderListBox, renderNumberField, renderPagination, renderPasswordInput, renderPopover, renderProgress, renderRadio, renderRadioCard, renderScrollLinked, renderSelect, renderSeparator, renderSkeleton, renderSlider, renderSpinner, renderStack, renderStatusIcon, renderSwitch, renderTable, renderTabs, renderTextField, renderTextarea, renderTooltip } from "../_shared/renderers.mjs";
|
|
3
|
+
import { catalog } from "./catalog.mjs";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { JSONUIProvider, Renderer, defineRegistry, useBoundProp } from "@json-render/react";
|
|
7
|
+
//#region src/integrations/json-render/registry.tsx
|
|
8
|
+
/**
|
|
9
|
+
* `@k8ordo/ui/json-render/registry`('use client')
|
|
10
|
+
*
|
|
11
|
+
* `<Renderer registry={registry} spec={...} />` に渡す実装対応表。
|
|
12
|
+
* フックを使うためクライアント専用。プロンプト生成だけ行いたい場合は
|
|
13
|
+
* サーバー安全な `@k8ordo/ui/json-render`(catalog)を使う。
|
|
14
|
+
*/
|
|
15
|
+
const useBoundOrLocal = (sourceValue, path, fallback, initial = sourceValue ?? fallback) => {
|
|
16
|
+
const hasBinding = path !== void 0 && path !== "";
|
|
17
|
+
const [bound, setBound] = useBoundProp(sourceValue, path);
|
|
18
|
+
const [local, setLocal] = useState(initial);
|
|
19
|
+
return [hasBinding ? bound ?? fallback : local, hasBinding ? setBound : setLocal];
|
|
20
|
+
};
|
|
21
|
+
const { registry } = defineRegistry(catalog, { components: {
|
|
22
|
+
Stack: ({ props, children }) => renderStack(props, children),
|
|
23
|
+
Grid: ({ props, children }) => renderGrid(props, children),
|
|
24
|
+
Card: ({ props, children }) => renderCard(props, children),
|
|
25
|
+
Button: ({ props }) => renderButton(props),
|
|
26
|
+
Badge: ({ props }) => renderBadge(props),
|
|
27
|
+
Heading: ({ props }) => renderHeading(props),
|
|
28
|
+
Alert: ({ props }) => renderAlert(props),
|
|
29
|
+
Spinner: ({ props }) => renderSpinner(props),
|
|
30
|
+
Separator: ({ props }) => renderSeparator(props),
|
|
31
|
+
Tabs: ({ props }) => renderTabs(props),
|
|
32
|
+
TextField: ({ props, bindings }) => {
|
|
33
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, "");
|
|
34
|
+
return renderTextField(props, value, setValue);
|
|
35
|
+
},
|
|
36
|
+
Checkbox: ({ props, bindings }) => {
|
|
37
|
+
const [checked, setChecked] = useBoundOrLocal(props.defaultChecked, bindings?.defaultChecked, false);
|
|
38
|
+
return renderCheckbox(props, checked, setChecked);
|
|
39
|
+
},
|
|
40
|
+
Switch: ({ props, bindings }) => {
|
|
41
|
+
const [checked, setChecked] = useBoundOrLocal(props.defaultChecked, bindings?.defaultChecked, false);
|
|
42
|
+
return renderSwitch(props, checked, setChecked);
|
|
43
|
+
},
|
|
44
|
+
Select: ({ props, bindings }) => {
|
|
45
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, "", props.defaultValue ?? props.options[0]?.value ?? "");
|
|
46
|
+
return renderSelect(props, value, setValue);
|
|
47
|
+
},
|
|
48
|
+
Anchor: ({ props }) => renderAnchor(props),
|
|
49
|
+
Avatar: ({ props }) => renderAvatar(props),
|
|
50
|
+
Code: ({ props }) => renderCode(props),
|
|
51
|
+
Progress: ({ props }) => renderProgress(props),
|
|
52
|
+
Skeleton: ({ props }) => renderSkeleton(props),
|
|
53
|
+
Icon: ({ props }) => renderIcon(props),
|
|
54
|
+
ChevronIcon: ({ props }) => renderChevronIcon(props),
|
|
55
|
+
StatusIcon: ({ props }) => renderStatusIcon(props),
|
|
56
|
+
IconButton: ({ props }) => renderIconButton(props),
|
|
57
|
+
Accordion: ({ props }) => renderAccordion(props),
|
|
58
|
+
Breadcrumb: ({ props }) => renderBreadcrumb(props),
|
|
59
|
+
Table: ({ props }) => renderTable(props),
|
|
60
|
+
Textarea: ({ props, bindings }) => {
|
|
61
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, "");
|
|
62
|
+
return renderTextarea(props, value, setValue);
|
|
63
|
+
},
|
|
64
|
+
PasswordInput: ({ props, bindings }) => {
|
|
65
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, "");
|
|
66
|
+
return renderPasswordInput(props, value, setValue);
|
|
67
|
+
},
|
|
68
|
+
Radio: ({ props, bindings }) => {
|
|
69
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, "", props.defaultValue ?? props.options[0]?.value ?? "");
|
|
70
|
+
return renderRadio(props, value, setValue);
|
|
71
|
+
},
|
|
72
|
+
RadioCard: ({ props, bindings }) => {
|
|
73
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, "", props.defaultValue ?? props.options[0]?.value ?? "");
|
|
74
|
+
return renderRadioCard(props, value, setValue);
|
|
75
|
+
},
|
|
76
|
+
NumberField: ({ props, bindings }) => {
|
|
77
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, 0);
|
|
78
|
+
return renderNumberField(props, value, setValue);
|
|
79
|
+
},
|
|
80
|
+
Slider: ({ props, bindings }) => {
|
|
81
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, 0, props.defaultValue ?? props.min ?? 0);
|
|
82
|
+
return renderSlider(props, value, setValue);
|
|
83
|
+
},
|
|
84
|
+
CheckboxCard: ({ props, bindings }) => {
|
|
85
|
+
const [value, setValue] = useBoundOrLocal(props.defaultValue, bindings?.defaultValue, []);
|
|
86
|
+
return renderCheckboxCard(props, value, setValue);
|
|
87
|
+
},
|
|
88
|
+
Pagination: ({ props, bindings }) => {
|
|
89
|
+
const [page, setPage] = useBoundOrLocal(props.defaultPage, bindings?.defaultPage, 1);
|
|
90
|
+
return renderPagination(props, page, setPage);
|
|
91
|
+
},
|
|
92
|
+
Form: ({ props, children }) => renderForm(props, children),
|
|
93
|
+
Modal: ({ props, children }) => /* @__PURE__ */ jsx(ModalWidget, {
|
|
94
|
+
props,
|
|
95
|
+
children
|
|
96
|
+
}),
|
|
97
|
+
Dialog: ({ props, children }) => /* @__PURE__ */ jsx(DialogWidget, {
|
|
98
|
+
props,
|
|
99
|
+
children
|
|
100
|
+
}),
|
|
101
|
+
Drawer: ({ props, children }) => /* @__PURE__ */ jsx(DrawerWidget, {
|
|
102
|
+
props,
|
|
103
|
+
children
|
|
104
|
+
}),
|
|
105
|
+
Popover: ({ props, children }) => renderPopover(props, children),
|
|
106
|
+
Tooltip: ({ props }) => renderTooltip(props),
|
|
107
|
+
DropdownMenu: ({ props }) => renderDropdownMenu(props),
|
|
108
|
+
Toast: ({ props }) => /* @__PURE__ */ jsx(ToastWidget, { props }),
|
|
109
|
+
ScrollLinked: ({ props }) => renderScrollLinked(props),
|
|
110
|
+
ListBox: ({ props, bindings }) => {
|
|
111
|
+
const path = bindings?.defaultValue;
|
|
112
|
+
const hasBinding = path !== void 0 && path !== "";
|
|
113
|
+
const [bound, setBound] = useBoundProp(props.defaultValue, path);
|
|
114
|
+
const [local, setLocal] = useState(props.defaultValue ?? props.options[0]?.value ?? "");
|
|
115
|
+
return renderListBox(props, hasBinding ? bound ?? "" : local, hasBinding ? setBound : setLocal);
|
|
116
|
+
},
|
|
117
|
+
CheckboxGroup: ({ props, bindings }) => {
|
|
118
|
+
const path = bindings?.defaultValue;
|
|
119
|
+
const hasBinding = path !== void 0 && path !== "";
|
|
120
|
+
const [bound, setBound] = useBoundProp(props.defaultValue, path);
|
|
121
|
+
const [local, setLocal] = useState(props.defaultValue ?? []);
|
|
122
|
+
return renderCheckboxGroup(props, hasBinding ? bound ?? [] : local, hasBinding ? setBound : setLocal);
|
|
123
|
+
},
|
|
124
|
+
Autocomplete: ({ props, bindings }) => {
|
|
125
|
+
const path = bindings?.defaultValue;
|
|
126
|
+
const hasBinding = path !== void 0 && path !== "";
|
|
127
|
+
const [bound, setBound] = useBoundProp(props.defaultValue, path);
|
|
128
|
+
const [local, setLocal] = useState(props.defaultValue ?? []);
|
|
129
|
+
return renderAutocomplete(props, hasBinding ? bound ?? [] : local, hasBinding ? setBound : setLocal);
|
|
130
|
+
},
|
|
131
|
+
FileField: ({ props }) => /* @__PURE__ */ jsx(FileFieldWidget, { props }),
|
|
132
|
+
FormControl: ({ props }) => /* @__PURE__ */ jsx(FormControlWidget, { props })
|
|
133
|
+
} });
|
|
134
|
+
/**
|
|
135
|
+
* spec を @k8ordo/ui の部品で描画する、事前結線済みコンポーネント。
|
|
136
|
+
*
|
|
137
|
+
* `JSONUIProvider` と `Renderer` を内部で結線し registry も渡し済みなので、
|
|
138
|
+
* 利用者は spec を渡すだけでよい(上流の生 import や 'use client' 境界ファイルの
|
|
139
|
+
* 自作が不要)。フォーム値を回収したいときは `onStateChange` を渡す。
|
|
140
|
+
* 高度な構成(navigate / handlers / validationFunctions など)が必要なら、
|
|
141
|
+
* 引き続き `registry` を `JSONUIProvider` に直接渡す。
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* 'use client';
|
|
145
|
+
* import { JsonRenderUI } from '@k8ordo/ui/json-render/registry';
|
|
146
|
+
*
|
|
147
|
+
* <JsonRenderUI spec={spec} />
|
|
148
|
+
*/
|
|
149
|
+
const JsonRenderUI = ({ spec, loading, onStateChange }) => /* @__PURE__ */ jsx(JSONUIProvider, {
|
|
150
|
+
registry,
|
|
151
|
+
onStateChange,
|
|
152
|
+
children: /* @__PURE__ */ jsx(Renderer, {
|
|
153
|
+
registry,
|
|
154
|
+
spec,
|
|
155
|
+
loading
|
|
156
|
+
})
|
|
157
|
+
});
|
|
158
|
+
//#endregion
|
|
159
|
+
export { JsonRenderUI, registry };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AutocompleteProps, CheckboxCardProps, CheckboxGroupProps, CheckboxProps, ListBoxProps, NumberFieldProps, PaginationProps, PasswordInputProps, RadioCardProps, RadioProps, SelectProps, SliderProps, SwitchProps, TextFieldProps, TextareaProps } from "../_shared/schemas.mjs";
|
|
2
|
+
import { FC } from "react";
|
|
3
|
+
import { ComponentRenderProps } from "@openuidev/react-lang";
|
|
4
|
+
//#region src/integrations/openui/form-views.d.ts
|
|
5
|
+
declare const TextFieldView: FC<ComponentRenderProps<TextFieldProps>>;
|
|
6
|
+
declare const CheckboxView: FC<ComponentRenderProps<CheckboxProps>>;
|
|
7
|
+
declare const SwitchView: FC<ComponentRenderProps<SwitchProps>>;
|
|
8
|
+
declare const SelectView: FC<ComponentRenderProps<SelectProps>>;
|
|
9
|
+
declare const TextareaView: FC<ComponentRenderProps<TextareaProps>>;
|
|
10
|
+
declare const PasswordInputView: FC<ComponentRenderProps<PasswordInputProps>>;
|
|
11
|
+
declare const NumberFieldView: FC<ComponentRenderProps<NumberFieldProps>>;
|
|
12
|
+
declare const SliderView: FC<ComponentRenderProps<SliderProps>>;
|
|
13
|
+
declare const RadioView: FC<ComponentRenderProps<RadioProps>>;
|
|
14
|
+
declare const RadioCardView: FC<ComponentRenderProps<RadioCardProps>>;
|
|
15
|
+
declare const CheckboxCardView: FC<ComponentRenderProps<CheckboxCardProps>>;
|
|
16
|
+
declare const PaginationView: FC<ComponentRenderProps<PaginationProps>>;
|
|
17
|
+
declare const ListBoxView: FC<ComponentRenderProps<ListBoxProps>>;
|
|
18
|
+
declare const CheckboxGroupView: FC<ComponentRenderProps<CheckboxGroupProps>>;
|
|
19
|
+
declare const AutocompleteView: FC<ComponentRenderProps<AutocompleteProps>>;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { AutocompleteView, CheckboxCardView, CheckboxGroupView, CheckboxView, ListBoxView, NumberFieldView, PaginationView, PasswordInputView, RadioCardView, RadioView, SelectView, SliderView, SwitchView, TextFieldView, TextareaView };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { renderAutocomplete, renderCheckbox, renderCheckboxCard, renderCheckboxGroup, renderListBox, renderNumberField, renderPagination, renderPasswordInput, renderRadio, renderRadioCard, renderSelect, renderSlider, renderSwitch, renderTextField, renderTextarea } from "../_shared/renderers.mjs";
|
|
3
|
+
import { useStateField } from "@openuidev/react-lang";
|
|
4
|
+
//#region src/integrations/openui/form-views.tsx
|
|
5
|
+
const TextFieldView = ({ props }) => {
|
|
6
|
+
const field = useStateField(props.name, props.defaultValue ?? "");
|
|
7
|
+
return renderTextField(props, field.value, field.setValue);
|
|
8
|
+
};
|
|
9
|
+
const CheckboxView = ({ props }) => {
|
|
10
|
+
const field = useStateField(props.name, props.defaultChecked ?? false);
|
|
11
|
+
return renderCheckbox(props, field.value, field.setValue);
|
|
12
|
+
};
|
|
13
|
+
const SwitchView = ({ props }) => {
|
|
14
|
+
const field = useStateField(props.name, props.defaultChecked ?? false);
|
|
15
|
+
return renderSwitch(props, field.value, field.setValue);
|
|
16
|
+
};
|
|
17
|
+
const SelectView = ({ props }) => {
|
|
18
|
+
const field = useStateField(props.name, props.defaultValue ?? props.options[0]?.value ?? "");
|
|
19
|
+
return renderSelect(props, field.value, field.setValue);
|
|
20
|
+
};
|
|
21
|
+
const TextareaView = ({ props }) => {
|
|
22
|
+
const field = useStateField(props.name, props.defaultValue ?? "");
|
|
23
|
+
return renderTextarea(props, field.value, field.setValue);
|
|
24
|
+
};
|
|
25
|
+
const PasswordInputView = ({ props }) => {
|
|
26
|
+
const field = useStateField(props.name, props.defaultValue ?? "");
|
|
27
|
+
return renderPasswordInput(props, field.value, field.setValue);
|
|
28
|
+
};
|
|
29
|
+
const NumberFieldView = ({ props }) => {
|
|
30
|
+
const field = useStateField(props.name, props.defaultValue ?? 0);
|
|
31
|
+
return renderNumberField(props, field.value, field.setValue);
|
|
32
|
+
};
|
|
33
|
+
const SliderView = ({ props }) => {
|
|
34
|
+
const field = useStateField(props.name, props.defaultValue ?? props.min ?? 0);
|
|
35
|
+
return renderSlider(props, field.value, field.setValue);
|
|
36
|
+
};
|
|
37
|
+
const RadioView = ({ props }) => {
|
|
38
|
+
const field = useStateField(props.name, props.defaultValue ?? props.options[0]?.value ?? "");
|
|
39
|
+
return renderRadio(props, field.value, field.setValue);
|
|
40
|
+
};
|
|
41
|
+
const RadioCardView = ({ props }) => {
|
|
42
|
+
const field = useStateField(props.name, props.defaultValue ?? props.options[0]?.value ?? "");
|
|
43
|
+
return renderRadioCard(props, field.value, field.setValue);
|
|
44
|
+
};
|
|
45
|
+
const CheckboxCardView = ({ props }) => {
|
|
46
|
+
const field = useStateField(props.name, props.defaultValue ?? []);
|
|
47
|
+
return renderCheckboxCard(props, field.value, field.setValue);
|
|
48
|
+
};
|
|
49
|
+
const PaginationView = ({ props }) => {
|
|
50
|
+
const field = useStateField(props.name, props.defaultPage ?? 1);
|
|
51
|
+
return renderPagination(props, field.value, field.setValue);
|
|
52
|
+
};
|
|
53
|
+
const ListBoxView = ({ props }) => {
|
|
54
|
+
const field = useStateField(props.name, props.defaultValue ?? props.options[0]?.value ?? "");
|
|
55
|
+
return renderListBox(props, field.value, field.setValue);
|
|
56
|
+
};
|
|
57
|
+
const CheckboxGroupView = ({ props }) => {
|
|
58
|
+
const field = useStateField(props.name, props.defaultValue ?? []);
|
|
59
|
+
return renderCheckboxGroup(props, field.value, field.setValue);
|
|
60
|
+
};
|
|
61
|
+
const AutocompleteView = ({ props }) => {
|
|
62
|
+
const field = useStateField(props.name, props.defaultValue ?? []);
|
|
63
|
+
return renderAutocomplete(props, field.value, field.setValue);
|
|
64
|
+
};
|
|
65
|
+
//#endregion
|
|
66
|
+
export { AutocompleteView, CheckboxCardView, CheckboxGroupView, CheckboxView, ListBoxView, NumberFieldView, PaginationView, PasswordInputView, RadioCardView, RadioView, SelectView, SliderView, SwitchView, TextFieldView, TextareaView };
|