@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Koki Sakano
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
# @k8ordo/ui
|
|
2
|
+
|
|
3
|
+
A modern React UI component library built with TypeScript, Tailwind CSS, and accessibility in mind.
|
|
4
|
+
|
|
5
|
+
- **Documentation**: https://ordo.k8o.me
|
|
6
|
+
- **Storybook**: https://main--687a213c85e2e4589d8db1bb.chromatic.com
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @k8ordo/ui
|
|
12
|
+
# or
|
|
13
|
+
pnpm add @k8ordo/ui
|
|
14
|
+
# or
|
|
15
|
+
yarn add @k8ordo/ui
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Peer Dependencies
|
|
19
|
+
|
|
20
|
+
Make sure you have the following peer dependencies installed:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install react react-dom typescript
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Required versions:
|
|
27
|
+
|
|
28
|
+
- React ≥19.0.0
|
|
29
|
+
- TypeScript ≥6.0.0
|
|
30
|
+
- Tailwind CSS ≥4.0.0 — **optional**, only if you import the `tailwind.css` entry (see below)
|
|
31
|
+
|
|
32
|
+
## Quick Start
|
|
33
|
+
|
|
34
|
+
1. Import the CSS and set up the provider.
|
|
35
|
+
|
|
36
|
+
**No Tailwind in your project?** Import the prebuilt stylesheet — this single
|
|
37
|
+
line is all you need. It works with CSS Modules or plain CSS: every library
|
|
38
|
+
rule sits in `@layer`, so your own (unlayered) CSS takes precedence, and the
|
|
39
|
+
design tokens are available as CSS custom properties (`var(--fg-mute)`, …).
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
@import '@k8ordo/ui/styles.css';
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Using Tailwind CSS 4?** Import the source entry instead. It includes
|
|
46
|
+
`@import 'tailwindcss'`, and it keeps the design tokens usable as Tailwind
|
|
47
|
+
classes (`bg-bg-base`, …) in your own markup. Append your sources after the
|
|
48
|
+
import to add your own utility classes:
|
|
49
|
+
|
|
50
|
+
```css
|
|
51
|
+
@import '@k8ordo/ui/tailwind.css';
|
|
52
|
+
@source './src';
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Note that either entry applies a document-wide base: Tailwind preflight plus
|
|
56
|
+
the library base layer (margins/list styles/heading sizes reset, `b`/`strong`
|
|
57
|
+
weight and `i`/`em` style unset, `body` typography defaults). Adding it to an
|
|
58
|
+
existing app restyles more than the library components.
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
// In your app entry point
|
|
62
|
+
import { UIProvider } from '@k8ordo/ui';
|
|
63
|
+
|
|
64
|
+
function App() {
|
|
65
|
+
return (
|
|
66
|
+
<UIProvider>
|
|
67
|
+
<YourApp />
|
|
68
|
+
</UIProvider>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. Use components:
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import { Button } from '@k8ordo/ui';
|
|
77
|
+
import { Card } from '@k8ordo/ui';
|
|
78
|
+
|
|
79
|
+
function MyPage() {
|
|
80
|
+
return (
|
|
81
|
+
<Card>
|
|
82
|
+
<Button color="primary" variant="solid" onClick={() => alert('Hello!')}>
|
|
83
|
+
Click me
|
|
84
|
+
</Button>
|
|
85
|
+
</Card>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Internationalization (i18n)
|
|
91
|
+
|
|
92
|
+
The wording that components own internally — "close", "required", "loading", and so on — comes from a message dictionary. **It defaults to Japanese**, and that default applies even without a provider, so a Japanese app needs no setup at all.
|
|
93
|
+
|
|
94
|
+
To switch to English, pass the `en` dictionary from `@k8ordo/ui/i18n`:
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
import { UIProvider } from '@k8ordo/ui';
|
|
98
|
+
import { en } from '@k8ordo/ui/i18n';
|
|
99
|
+
|
|
100
|
+
function App() {
|
|
101
|
+
return (
|
|
102
|
+
<UIProvider messages={en}>
|
|
103
|
+
<YourApp />
|
|
104
|
+
</UIProvider>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`messages` takes a `Partial<Messages>`, so you can spread a dictionary and override only the keys you care about:
|
|
110
|
+
|
|
111
|
+
```tsx
|
|
112
|
+
<UIProvider messages={{ ...en, close: 'Dismiss' }}>
|
|
113
|
+
<YourApp />
|
|
114
|
+
</UIProvider>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Resolution order is **component prop > provider dictionary > built-in default (Japanese)**. Components that expose a wording prop of their own — `Spinner`'s `label`, `Alert`'s `closeLabel`, `PasswordInput`'s `showLabel` / `hideLabel`, `Pagination`'s `prevLabel` / `nextLabel` — take that prop over the dictionary.
|
|
118
|
+
|
|
119
|
+
The subpath exports both dictionaries and the type:
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { en, ja, type Messages } from '@k8ordo/ui/i18n';
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`ja` / `en` live behind `@k8ordo/ui/i18n` rather than the root entry so the dictionaries stay out of the main bundle. See [docs/references/components.md](docs/references/components.md) for the full key list.
|
|
126
|
+
|
|
127
|
+
## AI Agent Documentation
|
|
128
|
+
|
|
129
|
+
The design guide ships **inside the package**, so an agent always reads the exact
|
|
130
|
+
version you installed — there is no snapshot to copy or re-sync on upgrade.
|
|
131
|
+
|
|
132
|
+
Point your agent at it once by pasting this into your project's `CLAUDE.md` /
|
|
133
|
+
`AGENTS.md`:
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
Use `@k8ordo/ui` for UI. Before writing or changing UI, read
|
|
137
|
+
`node_modules/@k8ordo/ui/docs/GUIDE.md`, then follow only the
|
|
138
|
+
`docs/references/*.md` links it lists that the task actually needs.
|
|
139
|
+
Colors, spacing, radii and font weights go through semantic tokens —
|
|
140
|
+
never raw values such as `bg-teal-500` or `font-semibold`.
|
|
141
|
+
Look up component props in `docs/references/components.md` instead of
|
|
142
|
+
recalling them; a component that is not listed there does not exist.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
What each surface gives an agent:
|
|
146
|
+
|
|
147
|
+
| Surface | Where |
|
|
148
|
+
| -------------------------- | -------------------------------------------------------- |
|
|
149
|
+
| Design guide (entry point) | `node_modules/@k8ordo/ui/docs/GUIDE.md` |
|
|
150
|
+
| Reference docs | `node_modules/@k8ordo/ui/docs/references/*.md` |
|
|
151
|
+
| Docs index for LLMs | `docs/llms.txt` · https://ordo.k8o.me/llms.txt |
|
|
152
|
+
| Token spec (generated) | https://ordo.k8o.me/design.md |
|
|
153
|
+
| MCP server (Storybook) | https://main--687a213c85e2e4589d8db1bb.chromatic.com/mcp |
|
|
154
|
+
|
|
155
|
+
The MCP server exposes the published Storybook, so an agent can query real
|
|
156
|
+
stories and rendered props rather than relying on trained knowledge:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"mcpServers": {
|
|
161
|
+
"k8ordo": {
|
|
162
|
+
"type": "http",
|
|
163
|
+
"url": "https://main--687a213c85e2e4589d8db1bb.chromatic.com/mcp"
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Component Categories
|
|
170
|
+
|
|
171
|
+
### Buttons
|
|
172
|
+
|
|
173
|
+
- **Button** - Primary action button (use `renderItem` to render as a link)
|
|
174
|
+
- **IconButton** - Button with icon only (use `renderItem` to render as a link)
|
|
175
|
+
|
|
176
|
+
### Navigation
|
|
177
|
+
|
|
178
|
+
- **Anchor** - Text link with external-link awareness
|
|
179
|
+
- **Breadcrumb** - Navigation path indicator
|
|
180
|
+
- **Pagination** - Page navigation controls
|
|
181
|
+
- **Tabs** - Tab-based content organization
|
|
182
|
+
|
|
183
|
+
### Form Controls
|
|
184
|
+
|
|
185
|
+
- **Autocomplete** - Search with suggestions
|
|
186
|
+
- **Checkbox** / **CheckboxCard** / **CheckboxGroup** - Multi-selection inputs
|
|
187
|
+
- **FileField** - File upload with composite pattern
|
|
188
|
+
- **Form** / **FormControl** - Form wrapper and field with label/validation
|
|
189
|
+
- **NumberField** - Numeric input with controls
|
|
190
|
+
- **PasswordInput** - Password input with show/hide toggle
|
|
191
|
+
- **Radio** / **RadioCard** - Single-selection inputs
|
|
192
|
+
- **Select** - Dropdown selection
|
|
193
|
+
- **Slider** - Slider input control
|
|
194
|
+
- **Switch** - Toggle switch
|
|
195
|
+
- **TextField** - Single-line text input
|
|
196
|
+
- **Textarea** - Multi-line text input
|
|
197
|
+
|
|
198
|
+
### Data Display
|
|
199
|
+
|
|
200
|
+
- **Accordion** - Collapsible content panels
|
|
201
|
+
- **Avatar** - User/entity avatar
|
|
202
|
+
- **Badge** - Status/label indicator
|
|
203
|
+
- **Card** - Flexible content container (hover interaction via `interactive`)
|
|
204
|
+
- **Code** - Formatted code display
|
|
205
|
+
- **Heading** - Typography heading component
|
|
206
|
+
- **Table** - Tabular data display
|
|
207
|
+
|
|
208
|
+
### Feedback
|
|
209
|
+
|
|
210
|
+
- **Alert** - Important messages and notifications
|
|
211
|
+
- **Progress** - Progress indication
|
|
212
|
+
- **Skeleton** - Content loading placeholder
|
|
213
|
+
- **Spinner** - Loading indicator
|
|
214
|
+
- **ToastProvider** / **useToast** - Temporary notification messages
|
|
215
|
+
|
|
216
|
+
### Overlays
|
|
217
|
+
|
|
218
|
+
- **Dialog** - Modal dialog boxes
|
|
219
|
+
- **Drawer** - Slide-out panel
|
|
220
|
+
- **DropdownMenu** - Action menu component
|
|
221
|
+
- **ListBox** - Selectable list component
|
|
222
|
+
- **Modal** - Overlay modal component
|
|
223
|
+
- **Popover** - Floating content container
|
|
224
|
+
- **Tooltip** - Contextual help text
|
|
225
|
+
|
|
226
|
+
### Layout
|
|
227
|
+
|
|
228
|
+
- **ScrollLinked** - Scroll progress indicator
|
|
229
|
+
- **Separator** - Visual content divider
|
|
230
|
+
|
|
231
|
+
### Utilities
|
|
232
|
+
|
|
233
|
+
- **UIProvider** - Root provider for the library
|
|
234
|
+
- **PortalRootProvider** / **usePortalRoot** - Customize the portal mount root
|
|
235
|
+
- **Icons** - Icon component collection
|
|
236
|
+
|
|
237
|
+
## Usage Examples
|
|
238
|
+
|
|
239
|
+
### Button
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
import { Button } from '@k8ordo/ui';
|
|
243
|
+
|
|
244
|
+
// Primary action
|
|
245
|
+
<Button color="primary" variant="solid" size="md">
|
|
246
|
+
Save
|
|
247
|
+
</Button>
|
|
248
|
+
|
|
249
|
+
// Secondary accent
|
|
250
|
+
<Button color="secondary" variant="solid">
|
|
251
|
+
Preview
|
|
252
|
+
</Button>
|
|
253
|
+
|
|
254
|
+
// Secondary action
|
|
255
|
+
<Button color="base" variant="outline">
|
|
256
|
+
Cancel
|
|
257
|
+
</Button>
|
|
258
|
+
|
|
259
|
+
// Text-only
|
|
260
|
+
<Button variant="skeleton">
|
|
261
|
+
Learn more
|
|
262
|
+
</Button>
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### Form with Validation
|
|
266
|
+
|
|
267
|
+
```tsx
|
|
268
|
+
import { FormControl } from '@k8ordo/ui';
|
|
269
|
+
import { TextField } from '@k8ordo/ui';
|
|
270
|
+
import { Button } from '@k8ordo/ui';
|
|
271
|
+
|
|
272
|
+
<form>
|
|
273
|
+
<FormControl
|
|
274
|
+
label="Email"
|
|
275
|
+
required
|
|
276
|
+
errorText={error}
|
|
277
|
+
renderInput={(props) => (
|
|
278
|
+
<TextField {...props} placeholder="Enter your email" />
|
|
279
|
+
)}
|
|
280
|
+
/>
|
|
281
|
+
<Button type="submit">Submit</Button>
|
|
282
|
+
</form>;
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Dialog
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
import { Dialog } from '@k8ordo/ui';
|
|
289
|
+
import { Button } from '@k8ordo/ui';
|
|
290
|
+
import { useState } from 'react';
|
|
291
|
+
|
|
292
|
+
function MyComponent() {
|
|
293
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
294
|
+
|
|
295
|
+
return (
|
|
296
|
+
<>
|
|
297
|
+
<Button onClick={() => setIsOpen(true)}>Open Dialog</Button>
|
|
298
|
+
{isOpen && (
|
|
299
|
+
<Dialog.Root>
|
|
300
|
+
<Dialog.Header
|
|
301
|
+
title="Confirm Action"
|
|
302
|
+
onClose={() => setIsOpen(false)}
|
|
303
|
+
/>
|
|
304
|
+
<Dialog.Content>
|
|
305
|
+
<p>Are you sure you want to continue?</p>
|
|
306
|
+
<Button onClick={() => setIsOpen(false)}>Confirm</Button>
|
|
307
|
+
</Dialog.Content>
|
|
308
|
+
</Dialog.Root>
|
|
309
|
+
)}
|
|
310
|
+
</>
|
|
311
|
+
);
|
|
312
|
+
}
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
## Imports & Bundle Size
|
|
316
|
+
|
|
317
|
+
All components and hooks ship from a single ESM entry point — there are no per-component subpaths. The package is tree-shakeable (`sideEffects` is limited to CSS), so bundlers drop everything you don't import:
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
// Named imports from the root entry — unused exports are tree-shaken away
|
|
321
|
+
import { Button, Card, useClickAway, useLocalStorage } from '@k8ordo/ui';
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
Optional features live behind dedicated subpath exports:
|
|
325
|
+
|
|
326
|
+
| Subpath | Contents |
|
|
327
|
+
| --------------------------------- | --------------------------------------------------------------- |
|
|
328
|
+
| `@k8ordo/ui` | All components and hooks |
|
|
329
|
+
| `@k8ordo/ui/tokens` | Design token definitions |
|
|
330
|
+
| `@k8ordo/ui/i18n` | Message dictionaries (`ja` / `en`) and the `Messages` type |
|
|
331
|
+
| `@k8ordo/ui/ai` | AI chat components |
|
|
332
|
+
| `@k8ordo/ui/ai/response` | `Response` Markdown renderer (needs optional peer `streamdown`) |
|
|
333
|
+
| `@k8ordo/ui/ai-sdk` | AI SDK adapter (needs optional peer `ai`) |
|
|
334
|
+
| `@k8ordo/ui/json-render` | json-render catalog (server-safe) |
|
|
335
|
+
| `@k8ordo/ui/json-render/registry` | json-render registry (`'use client'`) |
|
|
336
|
+
| `@k8ordo/ui/openui` | OpenUI library (`'use client'`) |
|
|
337
|
+
| `@k8ordo/ui/openui/prompt` | OpenUI prompt generation (server-safe) |
|
|
338
|
+
| `@k8ordo/ui/styles.css` | Prebuilt stylesheet (no Tailwind required) |
|
|
339
|
+
| `@k8ordo/ui/tailwind.css` | Tailwind source entry (requires Tailwind CSS 4) |
|
|
340
|
+
|
|
341
|
+
## AI Chat Components
|
|
342
|
+
|
|
343
|
+
`@k8ordo/ui/ai` ships building blocks for chat UIs:
|
|
344
|
+
|
|
345
|
+
- **Conversation** (`Root` / `Messages` / `ScrollButton`) - Scroll container with stick-to-bottom behavior and a scroll-to-bottom button
|
|
346
|
+
- **Message** (`Root` / `Content`) - Chat bubble, styled by `from="user" | "assistant"`
|
|
347
|
+
- **PromptInput** (`Root` / `Textarea` / `Submit`) - Message input form with IME-aware Enter-to-send and a stop button while streaming
|
|
348
|
+
- **Reasoning** - Collapsible display of the model's thinking text
|
|
349
|
+
- **Suggestion** (`List` / `Item`) - Suggested prompt chips
|
|
350
|
+
- **ToolInvocation** - Tool call display with input/output and `state` (`'input-streaming' | 'input-available' | 'output-available' | 'output-error'`)
|
|
351
|
+
- **Response** (from `@k8ordo/ui/ai/response`) - Streaming-safe Markdown renderer built on streamdown
|
|
352
|
+
|
|
353
|
+
Two of these need optional peer dependencies:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
# Response (@k8ordo/ui/ai/response)
|
|
357
|
+
pnpm add streamdown
|
|
358
|
+
# AI SDK adapter (@k8ordo/ui/ai-sdk)
|
|
359
|
+
pnpm add ai
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
Minimal chat UI:
|
|
363
|
+
|
|
364
|
+
```tsx
|
|
365
|
+
'use client';
|
|
366
|
+
import { Conversation, Message, PromptInput } from '@k8ordo/ui/ai';
|
|
367
|
+
import { useState } from 'react';
|
|
368
|
+
|
|
369
|
+
type Msg = { id: string; role: 'user' | 'assistant'; text: string };
|
|
370
|
+
|
|
371
|
+
function Chat() {
|
|
372
|
+
const [messages, setMessages] = useState<Msg[]>([]);
|
|
373
|
+
|
|
374
|
+
const send = (text: string) => {
|
|
375
|
+
// Append the user message, then request the assistant reply
|
|
376
|
+
};
|
|
377
|
+
|
|
378
|
+
return (
|
|
379
|
+
<div className="flex h-svh flex-col gap-3 p-4">
|
|
380
|
+
<Conversation.Root>
|
|
381
|
+
<Conversation.Messages>
|
|
382
|
+
{messages.map((m) => (
|
|
383
|
+
<Message.Root from={m.role} key={m.id}>
|
|
384
|
+
<Message.Content>{m.text}</Message.Content>
|
|
385
|
+
</Message.Root>
|
|
386
|
+
))}
|
|
387
|
+
</Conversation.Messages>
|
|
388
|
+
<Conversation.ScrollButton />
|
|
389
|
+
</Conversation.Root>
|
|
390
|
+
<PromptInput.Root onSubmit={send}>
|
|
391
|
+
<PromptInput.Textarea placeholder="Type a message…" />
|
|
392
|
+
<PromptInput.Submit />
|
|
393
|
+
</PromptInput.Root>
|
|
394
|
+
</div>
|
|
395
|
+
);
|
|
396
|
+
}
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
To render assistant Markdown, wrap it in `Response` (children must be a string). Besides installing `streamdown`, import its stylesheet once and register its classes with Tailwind. Note that `Response` is the one component that requires a Tailwind CSS 4 build (the `tailwind.css` entry plus the `@source` line below) — streamdown's styling lives in its own class names, which the prebuilt `styles.css` does not include:
|
|
400
|
+
|
|
401
|
+
```tsx
|
|
402
|
+
import { Response } from '@k8ordo/ui/ai/response';
|
|
403
|
+
import 'streamdown/styles.css';
|
|
404
|
+
|
|
405
|
+
<Message.Content>
|
|
406
|
+
<Response isStreaming>{markdownText}</Response>
|
|
407
|
+
</Message.Content>;
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
`Response` forwards the rest of streamdown's props (`translations`, `controls`, `linkSafety`, `plugins`, …); only `className` and `mode` are owned by the library. Built-in labels come from the message dictionary, so they follow the app's language by default.
|
|
411
|
+
|
|
412
|
+
`linkSafety` defaults to **disabled** here, unlike streamdown. With it enabled, links render as `<button>` instead of `<a>`, which loses ⌘-click, middle-click, "copy link address", and the `link` role for assistive tech. Dangerous schemes such as `javascript:` are neutralized by rehype-harden regardless, so links stay safe with the default. Opt in when you want the confirmation dialog:
|
|
413
|
+
|
|
414
|
+
```tsx
|
|
415
|
+
<Response linkSafety={{ enabled: true }}>{markdownText}</Response>
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
```css
|
|
419
|
+
/* In your CSS entry (path is relative to the CSS file) */
|
|
420
|
+
@source '../node_modules/streamdown/dist/*.js';
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
With the [AI SDK](https://ai-sdk.dev), `mapMessageParts` from `@k8ordo/ui/ai-sdk` converts a `UIMessage` into a flat array of `{ kind: 'text' | 'reasoning' | 'tool', ... }` parts that map 1:1 onto `Response`, `Reasoning`, and `ToolInvocation`.
|
|
424
|
+
|
|
425
|
+
## Generative UI integrations
|
|
426
|
+
|
|
427
|
+
k8ordo UI ships official adapters so an LLM can generate UIs using these components, via either [json-render](https://json-render.dev) or [OpenUI](https://www.openui.com). Each adapter constrains the model to k8ordo UI components with prop schemas locked to the design tokens, so generated UIs stay on-brand. Component-specific `renderItem` render props are bridged internally — the model only ever sees flat data (e.g. `href`).
|
|
428
|
+
|
|
429
|
+
These integrations are exposed as optional subpath exports. Install the framework you use (they are optional peer dependencies):
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
# json-render
|
|
433
|
+
pnpm add @json-render/core @json-render/react zod
|
|
434
|
+
# OpenUI
|
|
435
|
+
pnpm add @openuidev/react-lang zod
|
|
436
|
+
# OpenUI server-safe prompt entry (@k8ordo/ui/openui/prompt) additionally needs:
|
|
437
|
+
pnpm add @openuidev/lang-core
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Supported components (**all 49**, both frameworks):
|
|
441
|
+
|
|
442
|
+
- **Layout / containers**: `Stack`, `Grid`, `Card`, `Form`
|
|
443
|
+
- **Buttons / nav**: `Button`, `IconButton`, `Anchor`, `Breadcrumb`, `Pagination`
|
|
444
|
+
- **Display**: `Badge`, `Heading`, `Avatar`, `Code`, `Icon`, `ChevronIcon`, `StatusIcon`, `Alert`, `Spinner`, `Progress`, `Skeleton`, `Separator`, `Tabs`, `Accordion`, `Table`, `ScrollLinked`
|
|
445
|
+
- **Overlays (self-contained widgets)**: `Modal`, `Dialog`, `Drawer`, `Popover`, `Tooltip`, `DropdownMenu`, `Toast`
|
|
446
|
+
- **Form**: `TextField`, `Textarea`, `PasswordInput`, `NumberField`, `Slider`, `Checkbox`, `Switch`, `Select`, `Radio`, `RadioCard`, `CheckboxCard`, `ListBox`, `CheckboxGroup`, `Autocomplete`, `FileField`, `FormControl`
|
|
447
|
+
|
|
448
|
+
Overlays are exposed as **self-contained widgets**: a `Modal`/`Dialog`/`Drawer`/`Popover` declares its own trigger button via `triggerLabel`, manages open/close internally, and renders the supplied children inside the surface. This lets a model generate UIs that include overlays without modelling imperative open/close state. `Tooltip`/`DropdownMenu`/`Toast` follow the same self-contained pattern (trigger + content).
|
|
449
|
+
|
|
450
|
+
### json-render (RSC-ready)
|
|
451
|
+
|
|
452
|
+
The catalog (schemas / prompt) and the registry (rendering) are split so the catalog is **server-safe** — generate the system prompt in a React Server Component, and render on the client.
|
|
453
|
+
|
|
454
|
+
```tsx
|
|
455
|
+
// Server Component: prompt generation
|
|
456
|
+
import { catalog, uiRules } from '@k8ordo/ui/json-render';
|
|
457
|
+
|
|
458
|
+
// `customRules` injects cross-cutting constraints the model tends to break
|
|
459
|
+
// (Table cell counts match columns, href format, text-only Tabs/Accordion content).
|
|
460
|
+
const systemPrompt = catalog.prompt({ customRules: [...uiRules] });
|
|
461
|
+
```
|
|
462
|
+
|
|
463
|
+
```tsx
|
|
464
|
+
// Client Component: rendering.
|
|
465
|
+
// `JsonRenderUI` wires JSONUIProvider + Renderer and the registry for you —
|
|
466
|
+
// just pass a spec. Pass `onStateChange` to collect form values.
|
|
467
|
+
'use client';
|
|
468
|
+
import { JsonRenderUI } from '@k8ordo/ui/json-render/registry';
|
|
469
|
+
|
|
470
|
+
export function GenUi({ spec }: { spec: unknown }) {
|
|
471
|
+
return <JsonRenderUI spec={spec} />;
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
Validate (and repair) LLM output before rendering. `validateGeneratedSpec` runs auto-fixes, structural checks, and per-component prop validation, returning a ready-to-resend repair prompt on failure:
|
|
476
|
+
|
|
477
|
+
```tsx
|
|
478
|
+
import { validateGeneratedSpec } from '@k8ordo/ui/json-render';
|
|
479
|
+
|
|
480
|
+
const result = validateGeneratedSpec(JSON.parse(llmOutput));
|
|
481
|
+
if (result.ok) {
|
|
482
|
+
return <JsonRenderUI spec={result.spec} />; // result.fixes lists auto-applied fixes
|
|
483
|
+
}
|
|
484
|
+
const retried = await llm(result.repairPrompt); // ask the model to fix, then retry
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
Hand-written or LLM specs can be typed with `satisfies UISpec` so component names and props are checked at compile time (no `as unknown as Spec`):
|
|
488
|
+
|
|
489
|
+
```tsx
|
|
490
|
+
import type { UISpec } from '@k8ordo/ui/json-render';
|
|
491
|
+
|
|
492
|
+
const spec = {
|
|
493
|
+
root: 'root',
|
|
494
|
+
elements: {
|
|
495
|
+
root: { type: 'Stack', props: { direction: 'column' }, children: ['ok'] },
|
|
496
|
+
ok: { type: 'Button', props: { label: 'OK' } }, // typo in `type`/props → compile error
|
|
497
|
+
},
|
|
498
|
+
} satisfies UISpec;
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
For advanced setups (custom `navigate` / `handlers` / `validationFunctions`), pass the lower-level `registry` to `JSONUIProvider` and `Renderer` from `@json-render/react` directly.
|
|
502
|
+
|
|
503
|
+
| Export | Side | Contents |
|
|
504
|
+
| --------------------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------- |
|
|
505
|
+
| `@k8ordo/ui/json-render` | server-safe | `catalog` (schemas + `prompt()`), `validateGeneratedSpec`, `uiRules`, types (`UISpec`, `ComponentName`, `ComponentProps`) |
|
|
506
|
+
| `@k8ordo/ui/json-render/registry` | `'use client'` | `JsonRenderUI` (pre-wired), `registry` (low-level) |
|
|
507
|
+
|
|
508
|
+
### OpenUI
|
|
509
|
+
|
|
510
|
+
```tsx
|
|
511
|
+
'use client';
|
|
512
|
+
import { library } from '@k8ordo/ui/openui';
|
|
513
|
+
import { Renderer } from '@openuidev/react-lang';
|
|
514
|
+
|
|
515
|
+
export function GenUi({ response }: { response: string }) {
|
|
516
|
+
return <Renderer library={library} response={response} />;
|
|
517
|
+
}
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Generate the system prompt on the **server** with the dedicated server-safe entry (symmetric with json-render's `catalog.prompt()`):
|
|
521
|
+
|
|
522
|
+
```tsx
|
|
523
|
+
import { prompt } from '@k8ordo/ui/openui/prompt';
|
|
524
|
+
|
|
525
|
+
const systemPrompt = prompt(); // server-safe, no React — call it from an RSC or API route
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
To generate the prompt inside the client bundle instead, `library.prompt()` still works.
|
|
529
|
+
|
|
530
|
+
| Export | Side | Contents |
|
|
531
|
+
| -------------------------- | -------------- | ------------------------------------- |
|
|
532
|
+
| `@k8ordo/ui/openui` | `'use client'` | `library` (rendering) |
|
|
533
|
+
| `@k8ordo/ui/openui/prompt` | server-safe | `prompt()` (system prompt generation) |
|
|
534
|
+
|
|
535
|
+
> **Notes**
|
|
536
|
+
>
|
|
537
|
+
> - Make sure `@k8ordo/ui/styles.css` (or `tailwind.css` in Tailwind CSS 4 projects) is loaded and the app is wrapped in `UIProvider`.
|
|
538
|
+
> - `@k8ordo/ui/openui/prompt` needs the optional peer `@openuidev/lang-core` (React-free).
|
|
539
|
+
> - `Tabs` panels are text content (`tabs: [{ label, content }]`); rich-component panels are a future enhancement.
|
|
540
|
+
> - In OpenUI, `Card` can contain a `Stack` or `Grid`, but `Stack`/`Grid` cannot directly nest a `Stack`/`Grid`/`Card` (no self-referential schemas) — put nested layout inside a `Card`. json-render nests freely (slots-based).
|
|
541
|
+
|
|
542
|
+
## Custom Hooks
|
|
543
|
+
|
|
544
|
+
The library includes several useful hooks:
|
|
545
|
+
|
|
546
|
+
- **useBreakpoint** - Tailwind breakpoint matcher
|
|
547
|
+
- **useClickAway** - Detect clicks outside an element
|
|
548
|
+
- **useClient** - Client-side rendering detection
|
|
549
|
+
- **useClipboard** - Clipboard operations
|
|
550
|
+
- **useControllableState** - Controlled/uncontrolled state pattern
|
|
551
|
+
- **useDebouncedTransition** - Rate-limited transition with `AbortSignal`
|
|
552
|
+
- **useDeferredDebounce** - `useDeferredValue` with pending flag
|
|
553
|
+
- **useDisclosure** - Open/close/toggle disclosure state
|
|
554
|
+
- **useHash** - URL hash management
|
|
555
|
+
- **useHover** - Element hover detection
|
|
556
|
+
- **useIntersectionObserver** / **useInView** - Element visibility
|
|
557
|
+
- **useInterval** - Interval timer management
|
|
558
|
+
- **useLocalStorage** / **useSessionStorage** - Web Storage with React state
|
|
559
|
+
- **useResize** - Element resize detection (ResizeObserver)
|
|
560
|
+
- **useScrollDirection** - Scroll direction detection
|
|
561
|
+
- **useScrollLock** - Body/element scroll lock
|
|
562
|
+
- **useStep** - Step-based state management
|
|
563
|
+
- **useTimeout** - Timeout management
|
|
564
|
+
- **useWindowResize** - Window resize events
|
|
565
|
+
- **useWindowSize** - Window size tracking
|
|
566
|
+
- **useWritingMode** - Detect horizontal/vertical `writing-mode`
|
|
567
|
+
|
|
568
|
+
## Accessibility
|
|
569
|
+
|
|
570
|
+
All components follow WCAG accessibility guidelines:
|
|
571
|
+
|
|
572
|
+
- Semantic HTML elements
|
|
573
|
+
- Proper ARIA attributes
|
|
574
|
+
- Keyboard navigation support
|
|
575
|
+
- Screen reader compatibility
|
|
576
|
+
- Focus management
|
|
577
|
+
- Color contrast compliance
|
|
578
|
+
|
|
579
|
+
## Styling & Customization
|
|
580
|
+
|
|
581
|
+
Components are built with Tailwind CSS and support customization through:
|
|
582
|
+
|
|
583
|
+
- CSS custom properties (semantic design tokens)
|
|
584
|
+
- Tailwind utility classes
|
|
585
|
+
- Light / Dark mode via semantic color tokens
|
|
586
|
+
|
|
587
|
+
## Development
|
|
588
|
+
|
|
589
|
+
For local development and contributing:
|
|
590
|
+
|
|
591
|
+
```bash
|
|
592
|
+
# Install dependencies
|
|
593
|
+
pnpm install
|
|
594
|
+
|
|
595
|
+
# Start Storybook for component development
|
|
596
|
+
pnpm storybook
|
|
597
|
+
|
|
598
|
+
# Run tests
|
|
599
|
+
pnpm test
|
|
600
|
+
|
|
601
|
+
# Build the library
|
|
602
|
+
pnpm build
|
|
603
|
+
|
|
604
|
+
# Type checking
|
|
605
|
+
pnpm typecheck
|
|
606
|
+
|
|
607
|
+
# Linting and formatting
|
|
608
|
+
pnpm check:write
|
|
609
|
+
```
|
|
610
|
+
|
|
611
|
+
## Browser Support
|
|
612
|
+
|
|
613
|
+
- Chrome (latest)
|
|
614
|
+
- Firefox (latest)
|
|
615
|
+
- Safari (latest)
|
|
616
|
+
- Edge (latest)
|
|
617
|
+
|
|
618
|
+
## License
|
|
619
|
+
|
|
620
|
+
MIT License - see [LICENSE](https://github.com/k35o/k8ordo/blob/main/LICENSE) for details.
|
|
621
|
+
|
|
622
|
+
## Contributing
|
|
623
|
+
|
|
624
|
+
Contributions are welcome! Please see the [main repository](https://github.com/k35o/k8ordo#readme) for contribution guidelines.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/components/_internal/focus-ring.d.ts
|
|
2
|
+
declare const FOCUS_RING = "focus-visible:border-transparent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info";
|
|
3
|
+
declare const FOCUS_RING_NO_BORDER = "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info";
|
|
4
|
+
declare const FOCUS_RING_WITHIN = "focus-within:border-transparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-border-info";
|
|
5
|
+
declare const FOCUS_RING_PEER = "peer-focus-visible:border-transparent peer-focus-visible:outline-hidden peer-focus-visible:ring-2 peer-focus-visible:ring-border-info";
|
|
6
|
+
declare const FOCUS_RING_PEER_NO_BORDER = "peer-focus-visible:outline-hidden peer-focus-visible:ring-2 peer-focus-visible:ring-border-info";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { FOCUS_RING, FOCUS_RING_NO_BORDER, FOCUS_RING_PEER, FOCUS_RING_PEER_NO_BORDER, FOCUS_RING_WITHIN };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/components/_internal/focus-ring.ts
|
|
2
|
+
const FOCUS_RING = "focus-visible:border-transparent focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info";
|
|
3
|
+
const FOCUS_RING_NO_BORDER = "focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-border-info";
|
|
4
|
+
const FOCUS_RING_WITHIN = "focus-within:border-transparent focus-within:outline-hidden focus-within:ring-2 focus-within:ring-border-info";
|
|
5
|
+
const FOCUS_RING_PEER = "peer-focus-visible:border-transparent peer-focus-visible:outline-hidden peer-focus-visible:ring-2 peer-focus-visible:ring-border-info";
|
|
6
|
+
const FOCUS_RING_PEER_NO_BORDER = "peer-focus-visible:outline-hidden peer-focus-visible:ring-2 peer-focus-visible:ring-border-info";
|
|
7
|
+
//#endregion
|
|
8
|
+
export { FOCUS_RING, FOCUS_RING_NO_BORDER, FOCUS_RING_PEER, FOCUS_RING_PEER_NO_BORDER, FOCUS_RING_WITHIN };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
//#region src/components/ai/_internal/collapsible.d.ts
|
|
3
|
+
type Props = {
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
isOpen?: boolean;
|
|
7
|
+
defaultOpen?: boolean;
|
|
8
|
+
onChange?: (isOpen: boolean) => void;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
};
|
|
11
|
+
declare const Collapsible: FC<Props>;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Collapsible };
|